some timeline refactoring, preparing for rewrites
This commit is contained in:
@@ -34,8 +34,8 @@ Block::Block() :
|
||||
length_input_ = new NodeInput(this, QStringLiteral("length_in"), NodeValue::kRational);
|
||||
length_input_->SetConnectable(false);
|
||||
length_input_->SetKeyframable(false);
|
||||
disconnect(length_input_, &NodeInput::ValueChanged, this, &Block::InputChanged);
|
||||
connect(length_input_, &NodeInput::ValueChanged, this, &Block::LengthInputChanged);
|
||||
IgnoreInvalidationsFrom(length_input_);
|
||||
connect(length_input_, &NodeInput::ValueChanged, this, &Block::LengthChanged);
|
||||
|
||||
media_in_input_ = new NodeInput(this, QStringLiteral("media_in_in"), NodeValue::kRational);
|
||||
media_in_input_->SetConnectable(false);
|
||||
@@ -92,11 +92,7 @@ void Block::set_length_and_media_out(const rational &length)
|
||||
return;
|
||||
}
|
||||
|
||||
rational old_length = this->length();
|
||||
|
||||
set_length_internal(length);
|
||||
|
||||
LengthChangedEvent(old_length, length, Timeline::kTrimOut);
|
||||
}
|
||||
|
||||
void Block::set_length_and_media_in(const rational &length)
|
||||
@@ -110,12 +106,8 @@ void Block::set_length_and_media_in(const rational &length)
|
||||
// Calculate media_in adjustment
|
||||
set_media_in(SequenceToMediaTime(in() + (this->length() - length)));
|
||||
|
||||
rational old_length = this->length();
|
||||
|
||||
// Set the length without setting media out
|
||||
set_length_internal(length);
|
||||
|
||||
LengthChangedEvent(old_length, length, Timeline::kTrimIn);
|
||||
}
|
||||
|
||||
TimeRange Block::range() const
|
||||
@@ -249,18 +241,9 @@ QVector<NodeInput *> Block::GetInputsToHash() const
|
||||
return inputs;
|
||||
}
|
||||
|
||||
void Block::LengthChangedEvent(const rational &, const rational &, const Timeline::MovementMode &)
|
||||
{
|
||||
}
|
||||
|
||||
void Block::set_length_internal(const rational &length)
|
||||
{
|
||||
length_input_->SetStandardValue (QVariant::fromValue(length));
|
||||
}
|
||||
|
||||
void Block::LengthInputChanged()
|
||||
{
|
||||
emit LengthChanged(length());
|
||||
length_input_->SetStandardValue(QVariant::fromValue(length));
|
||||
}
|
||||
|
||||
bool Block::Link(Block *a, Block *b)
|
||||
|
||||
+2
-16
@@ -86,19 +86,12 @@ public:
|
||||
public slots:
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief Signal emitted when this Block is refreshed
|
||||
*
|
||||
* Can be used as essentially a "changed" signal for UI widgets to know when to update their views
|
||||
*/
|
||||
void Refreshed();
|
||||
|
||||
void LengthChanged(const rational& length);
|
||||
|
||||
void LinksChanged();
|
||||
|
||||
void EnabledChanged();
|
||||
|
||||
void LengthChanged();
|
||||
|
||||
protected:
|
||||
rational SequenceToMediaTime(const rational& sequence_time) const;
|
||||
|
||||
@@ -110,10 +103,6 @@ protected:
|
||||
|
||||
virtual QVector<NodeInput*> GetInputsToHash() const override;
|
||||
|
||||
virtual void LengthChangedEvent(const rational& old_length,
|
||||
const rational& new_length,
|
||||
const Timeline::MovementMode& mode);
|
||||
|
||||
Block* previous_;
|
||||
Block* next_;
|
||||
|
||||
@@ -130,9 +119,6 @@ private:
|
||||
|
||||
QVector<Block*> linked_clips_;
|
||||
|
||||
private slots:
|
||||
void LengthInputChanged();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef CONNECTABLE_H
|
||||
#define CONNECTABLE_H
|
||||
|
||||
#include <QHash>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
|
||||
@@ -77,7 +77,7 @@ protected:
|
||||
return output_connections_;
|
||||
}
|
||||
|
||||
const QHash<int, Node*>& input_connections() const
|
||||
const QMap<int, Node*>& input_connections() const
|
||||
{
|
||||
return input_connections_;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ protected:
|
||||
private:
|
||||
QVector<InputConnection> output_connections_;
|
||||
|
||||
QHash<int, Node*> input_connections_;
|
||||
QMap<int, Node*> input_connections_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ Node *NodeFactory::CreateFromFactoryIndex(const NodeFactory::InternalID &id)
|
||||
case kFootageInput:
|
||||
return new MediaInput();
|
||||
case kTrackOutput:
|
||||
return new TrackOutput();
|
||||
return new Track();
|
||||
case kViewerOutput:
|
||||
return new ViewerOutput();
|
||||
case kAudioVolume:
|
||||
|
||||
+30
-14
@@ -226,7 +226,7 @@ void NodeInput::Init(Node* parent, const QString &id, NodeValue::Type type, cons
|
||||
array_size_ = 0;
|
||||
data_type_ = type;
|
||||
|
||||
primary_ = new NodeInputImmediate(type, default_value_);
|
||||
primary_ = CreateImmediate();
|
||||
}
|
||||
|
||||
void NodeInput::LoadImmediate(QXmlStreamReader *reader, int element, XMLNodeData &xml_node_data, const QAtomicInt *cancelled)
|
||||
@@ -374,6 +374,18 @@ void NodeInput::SaveImmediate(QXmlStreamWriter* writer, int element) const
|
||||
}
|
||||
}
|
||||
|
||||
void NodeInput::ChangeArraySizeInternal(int size)
|
||||
{
|
||||
array_size_ = size;
|
||||
emit ArraySizeChanged(array_size_);
|
||||
emit ValueChanged(TimeRange(RATIONAL_MIN, RATIONAL_MAX), -1);
|
||||
}
|
||||
|
||||
NodeInputImmediate *NodeInput::CreateImmediate()
|
||||
{
|
||||
return new NodeInputImmediate(data_type_, default_value_);
|
||||
}
|
||||
|
||||
void NodeInput::GetDependencies(QVector<Node *> &list, bool traverse, bool exclusive_only) const
|
||||
{
|
||||
for (auto it=input_connections().cbegin(); it!=input_connections().cend(); it++) {
|
||||
@@ -423,28 +435,26 @@ QVector<Node *> NodeInput::GetImmediateDependencies() const
|
||||
|
||||
void NodeInput::ArrayInsert(int index)
|
||||
{
|
||||
// Prepend new input
|
||||
subinputs_.insert(index, new NodeInputImmediate(GetDataType(), default_value_));
|
||||
// Add new input
|
||||
subinputs_.insert(index, CreateImmediate());
|
||||
|
||||
// Move connections down
|
||||
QHash<int, Node*> copied_edges = edges();
|
||||
for (auto it=copied_edges.cbegin(); it!=copied_edges.cend(); it++) {
|
||||
auto copied_edges = edges();
|
||||
for (auto it=copied_edges.cend(); it!=copied_edges.cbegin(); it--) {
|
||||
if (it.key() >= index) {
|
||||
// Disconnect this and reconnect it one element down
|
||||
DisconnectEdge(it.value(), this, it.key());
|
||||
ConnectEdge(it.value(), this, it.key() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
ChangeArraySizeInternal(array_size_ + 1);
|
||||
}
|
||||
|
||||
void NodeInput::ArrayRemove(int index)
|
||||
{
|
||||
// Remove subinput here
|
||||
delete subinputs_.at(index);
|
||||
subinputs_.removeAt(index);
|
||||
|
||||
// Move connections up
|
||||
QHash<int, Node*> copied_edges = edges();
|
||||
auto copied_edges = edges();
|
||||
for (auto it=copied_edges.cbegin(); it!=copied_edges.cend(); it++) {
|
||||
if (it.key() >= index) {
|
||||
// Disconnect this and reconnect it one element up if it's not the element being removed
|
||||
@@ -455,6 +465,10 @@ void NodeInput::ArrayRemove(int index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove input
|
||||
delete subinputs_.takeAt(index);
|
||||
ChangeArraySizeInternal(array_size_ - 1);
|
||||
}
|
||||
|
||||
void NodeInput::ArrayPrepend()
|
||||
@@ -479,13 +493,12 @@ void NodeInput::ArrayResize(int size)
|
||||
} else {
|
||||
// Size is larger, create any immediates that don't exist
|
||||
for (int i=subinputs_.size(); i<size; i++) {
|
||||
subinputs_.append(new NodeInputImmediate(GetDataType(), default_value_));
|
||||
subinputs_.append(CreateImmediate());
|
||||
}
|
||||
}
|
||||
|
||||
// Update array size
|
||||
array_size_ = size;
|
||||
emit ArraySizeChanged(array_size_);
|
||||
ChangeArraySizeInternal(size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -665,7 +678,10 @@ void NodeInput::CopyValuesOfElement(NodeInput *src, NodeInput *dst, int element)
|
||||
dst->SetIsKeyframing(src->IsKeyframing(element), element);
|
||||
}
|
||||
|
||||
emit dst->ValueChanged(TimeRange(RATIONAL_MIN, RATIONAL_MAX), element);
|
||||
// If this is the root of an array, copy the array size
|
||||
if (element == -1) {
|
||||
dst->ArrayResize(src->ArraySize());
|
||||
}
|
||||
}
|
||||
|
||||
QStringList NodeInput::get_combobox_strings() const
|
||||
|
||||
+5
-1
@@ -106,7 +106,7 @@ public:
|
||||
emit DataTypeChanged(type);
|
||||
}
|
||||
|
||||
const QHash<int, Node*>& edges() const
|
||||
const QMap<int, Node*>& edges() const
|
||||
{
|
||||
return input_connections();
|
||||
}
|
||||
@@ -367,6 +367,10 @@ private:
|
||||
|
||||
void SaveImmediate(QXmlStreamWriter *writer, int element) const;
|
||||
|
||||
void ChangeArraySizeInternal(int size);
|
||||
|
||||
NodeInputImmediate* CreateImmediate();
|
||||
|
||||
const NodeInputImmediate* GetImmediate(int element = -1) const
|
||||
{
|
||||
return element > -1 ? subinputs_.at(element) : primary_;
|
||||
|
||||
+7
-1
@@ -276,7 +276,7 @@ void Node::SendInvalidateCache(const TimeRange &range)
|
||||
}
|
||||
}
|
||||
|
||||
void Node::IgnoreConnectionSignalsFrom(NodeInput *input)
|
||||
void Node::IgnoreInvalidationsFrom(NodeInput *input)
|
||||
{
|
||||
ignore_connections_.append(input);
|
||||
}
|
||||
@@ -723,6 +723,12 @@ void Node::SetPosition(const QPointF &pos)
|
||||
|
||||
void Node::InputChanged(const TimeRange& range, int element)
|
||||
{
|
||||
NodeInput* input = static_cast<NodeInput*>(sender());
|
||||
|
||||
if (ignore_connections_.contains(input)) {
|
||||
return;
|
||||
}
|
||||
|
||||
InvalidateCache(range, InputConnection(static_cast<NodeInput*>(sender()), element));
|
||||
}
|
||||
|
||||
|
||||
+6
-8
@@ -411,7 +411,7 @@ protected:
|
||||
* parameters has changed throughout the duration of the clip (essential from 0 to infinity).
|
||||
* In some scenarios, it may be preferable to handle this signal separately in order to
|
||||
*/
|
||||
void IgnoreConnectionSignalsFrom(NodeInput* input);
|
||||
void IgnoreInvalidationsFrom(NodeInput* input);
|
||||
|
||||
virtual void LoadInternal(QXmlStreamReader* reader, XMLNodeData& xml_node_data);
|
||||
|
||||
@@ -439,11 +439,6 @@ protected:
|
||||
|
||||
virtual void childEvent(QChildEvent* event) override;
|
||||
|
||||
protected slots:
|
||||
void InputChanged(const olive::TimeRange &range, int element);
|
||||
|
||||
void InputConnectionChanged(Node* source, int element);
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief Signal emitted whenever the position is set through SetPosition()
|
||||
@@ -455,6 +450,11 @@ signals:
|
||||
*/
|
||||
void LabelChanged(const QString& s);
|
||||
|
||||
protected slots:
|
||||
void InputChanged(const olive::TimeRange &range, int element);
|
||||
|
||||
void InputConnectionChanged(Node* source, int element);
|
||||
|
||||
private:
|
||||
template<class T>
|
||||
static void FindInputNodeInternal(const Node* n, QVector<T *>& list);
|
||||
@@ -485,8 +485,6 @@ private:
|
||||
*/
|
||||
QString label_;
|
||||
|
||||
private slots:
|
||||
|
||||
};
|
||||
|
||||
template<class T>
|
||||
|
||||
@@ -29,85 +29,85 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
const double TrackOutput::kTrackHeightDefault = 3.0;
|
||||
const double TrackOutput::kTrackHeightMinimum = 1.5;
|
||||
const double TrackOutput::kTrackHeightInterval = 0.5;
|
||||
const double Track::kTrackHeightDefault = 3.0;
|
||||
const double Track::kTrackHeightMinimum = 1.5;
|
||||
const double Track::kTrackHeightInterval = 0.5;
|
||||
|
||||
TrackOutput::TrackOutput() :
|
||||
track_type_(Timeline::kTrackTypeNone),
|
||||
Track::Track() :
|
||||
track_type_(Track::kNone),
|
||||
index_(-1),
|
||||
locked_(false)
|
||||
{
|
||||
block_input_ = new NodeInput(this, QStringLiteral("block_in"), NodeValue::kNone);
|
||||
block_input_->SetKeyframable(false);
|
||||
connect(block_input_, &NodeInput::InputConnected, this, &TrackOutput::BlockConnected);
|
||||
connect(block_input_, &NodeInput::InputDisconnected, this, &TrackOutput::BlockDisconnected);
|
||||
connect(block_input_, &NodeInput::InputConnected, this, &Track::BlockConnected);
|
||||
connect(block_input_, &NodeInput::InputDisconnected, this, &Track::BlockDisconnected);
|
||||
|
||||
// Since blocks are time based, we can handle the invalidate timing a little more intelligently
|
||||
// on our end
|
||||
IgnoreConnectionSignalsFrom(block_input_);
|
||||
IgnoreInvalidationsFrom(block_input_);
|
||||
|
||||
muted_input_ = new NodeInput(this, QStringLiteral("muted_in"), NodeValue::kBoolean);
|
||||
muted_input_->SetKeyframable(false);
|
||||
connect(muted_input_, &NodeInput::ValueChanged, this, &TrackOutput::MutedInputValueChanged);
|
||||
connect(muted_input_, &NodeInput::ValueChanged, this, &Track::MutedInputValueChanged);
|
||||
|
||||
// Set default height
|
||||
track_height_ = kTrackHeightDefault;
|
||||
}
|
||||
|
||||
TrackOutput::~TrackOutput()
|
||||
Track::~Track()
|
||||
{
|
||||
DisconnectAll();
|
||||
}
|
||||
|
||||
void TrackOutput::set_track_type(const Timeline::TrackType &track_type)
|
||||
void Track::set_track_type(const Type &track_type)
|
||||
{
|
||||
track_type_ = track_type;
|
||||
}
|
||||
|
||||
const Timeline::TrackType& TrackOutput::track_type() const
|
||||
const Track::Type& Track::track_type() const
|
||||
{
|
||||
return track_type_;
|
||||
}
|
||||
|
||||
Node *TrackOutput::copy() const
|
||||
Node *Track::copy() const
|
||||
{
|
||||
return new TrackOutput();
|
||||
return new Track();
|
||||
}
|
||||
|
||||
QString TrackOutput::Name() const
|
||||
QString Track::Name() const
|
||||
{
|
||||
return tr("Track");
|
||||
}
|
||||
|
||||
QString TrackOutput::id() const
|
||||
QString Track::id() const
|
||||
{
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.track");
|
||||
}
|
||||
|
||||
QVector<Node::CategoryID> TrackOutput::Category() const
|
||||
QVector<Node::CategoryID> Track::Category() const
|
||||
{
|
||||
return {kCategoryTimeline};
|
||||
}
|
||||
|
||||
QString TrackOutput::Description() const
|
||||
QString Track::Description() const
|
||||
{
|
||||
return tr("Node for representing and processing a single array of Blocks sorted by time. Also represents the end of "
|
||||
"a Sequence.");
|
||||
}
|
||||
|
||||
const double &TrackOutput::GetTrackHeight() const
|
||||
const double &Track::GetTrackHeight() const
|
||||
{
|
||||
return track_height_;
|
||||
}
|
||||
|
||||
void TrackOutput::SetTrackHeight(const double &height)
|
||||
void Track::SetTrackHeight(const double &height)
|
||||
{
|
||||
track_height_ = height;
|
||||
emit TrackHeightChangedInPixels(GetTrackHeightInPixels());
|
||||
}
|
||||
|
||||
void TrackOutput::LoadInternal(QXmlStreamReader *reader, XMLNodeData &)
|
||||
void Track::LoadInternal(QXmlStreamReader *reader, XMLNodeData &)
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("height")) {
|
||||
@@ -118,12 +118,12 @@ void TrackOutput::LoadInternal(QXmlStreamReader *reader, XMLNodeData &)
|
||||
}
|
||||
}
|
||||
|
||||
void TrackOutput::SaveInternal(QXmlStreamWriter *writer) const
|
||||
void Track::SaveInternal(QXmlStreamWriter *writer) const
|
||||
{
|
||||
writer->writeTextElement(QStringLiteral("height"), QString::number(GetTrackHeight()));
|
||||
}
|
||||
|
||||
void TrackOutput::Retranslate()
|
||||
void Track::Retranslate()
|
||||
{
|
||||
Node::Retranslate();
|
||||
|
||||
@@ -131,19 +131,19 @@ void TrackOutput::Retranslate()
|
||||
muted_input_->set_name(tr("Muted"));
|
||||
}
|
||||
|
||||
const int &TrackOutput::Index()
|
||||
const int &Track::Index()
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
void TrackOutput::SetIndex(const int &index)
|
||||
void Track::SetIndex(const int &index)
|
||||
{
|
||||
index_ = index;
|
||||
|
||||
emit IndexChanged(index);
|
||||
}
|
||||
|
||||
Block *TrackOutput::BlockContainingTime(const rational &time) const
|
||||
Block *Track::BlockContainingTime(const rational &time) const
|
||||
{
|
||||
foreach (Block* block, block_cache_) {
|
||||
if (block->in() < time && block->out() > time) {
|
||||
@@ -156,7 +156,7 @@ Block *TrackOutput::BlockContainingTime(const rational &time) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Block *TrackOutput::NearestBlockBefore(const rational &time) const
|
||||
Block *Track::NearestBlockBefore(const rational &time) const
|
||||
{
|
||||
foreach (Block* block, block_cache_) {
|
||||
// Blocks are sorted by time, so the first Block who's out point is at/after this time is the correct Block
|
||||
@@ -168,7 +168,7 @@ Block *TrackOutput::NearestBlockBefore(const rational &time) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Block *TrackOutput::NearestBlockBeforeOrAt(const rational &time) const
|
||||
Block *Track::NearestBlockBeforeOrAt(const rational &time) const
|
||||
{
|
||||
foreach (Block* block, block_cache_) {
|
||||
// Blocks are sorted by time, so the first Block who's out point is at/after this time is the correct Block
|
||||
@@ -180,7 +180,7 @@ Block *TrackOutput::NearestBlockBeforeOrAt(const rational &time) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Block *TrackOutput::NearestBlockAfterOrAt(const rational &time) const
|
||||
Block *Track::NearestBlockAfterOrAt(const rational &time) const
|
||||
{
|
||||
foreach (Block* block, block_cache_) {
|
||||
// Blocks are sorted by time, so the first Block after this time is the correct Block
|
||||
@@ -192,7 +192,7 @@ Block *TrackOutput::NearestBlockAfterOrAt(const rational &time) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Block *TrackOutput::NearestBlockAfter(const rational &time) const
|
||||
Block *Track::NearestBlockAfter(const rational &time) const
|
||||
{
|
||||
foreach (Block* block, block_cache_) {
|
||||
// Blocks are sorted by time, so the first Block after this time is the correct Block
|
||||
@@ -204,7 +204,7 @@ Block *TrackOutput::NearestBlockAfter(const rational &time) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Block *TrackOutput::BlockAtTime(const rational &time) const
|
||||
Block *Track::BlockAtTime(const rational &time) const
|
||||
{
|
||||
if (IsMuted()) {
|
||||
return nullptr;
|
||||
@@ -225,7 +225,7 @@ Block *TrackOutput::BlockAtTime(const rational &time) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QVector<Block *> TrackOutput::BlocksAtTimeRange(const TimeRange &range) const
|
||||
QVector<Block *> Track::BlocksAtTimeRange(const TimeRange &range) const
|
||||
{
|
||||
QVector<Block*> list;
|
||||
|
||||
@@ -245,7 +245,7 @@ QVector<Block *> TrackOutput::BlocksAtTimeRange(const TimeRange &range) const
|
||||
return list;
|
||||
}
|
||||
|
||||
void TrackOutput::InvalidateCache(const TimeRange& range, const InputConnection& from)
|
||||
void Track::InvalidateCache(const TimeRange& range, const InputConnection& from)
|
||||
{
|
||||
TimeRange limited;
|
||||
|
||||
@@ -267,12 +267,12 @@ void TrackOutput::InvalidateCache(const TimeRange& range, const InputConnection&
|
||||
Node::InvalidateCache(limited, from);
|
||||
}
|
||||
|
||||
void TrackOutput::InsertBlockBefore(Block* block, Block* after)
|
||||
void Track::InsertBlockBefore(Block* block, Block* after)
|
||||
{
|
||||
InsertBlockAtIndex(block, block_cache_.indexOf(after));
|
||||
}
|
||||
|
||||
void TrackOutput::InsertBlockAfter(Block *block, Block *before)
|
||||
void Track::InsertBlockAfter(Block *block, Block *before)
|
||||
{
|
||||
int before_index = block_cache_.indexOf(before);
|
||||
|
||||
@@ -285,7 +285,7 @@ void TrackOutput::InsertBlockAfter(Block *block, Block *before)
|
||||
}
|
||||
}
|
||||
|
||||
void TrackOutput::PrependBlock(Block *block)
|
||||
void Track::PrependBlock(Block *block)
|
||||
{
|
||||
BeginOperation();
|
||||
|
||||
@@ -298,7 +298,7 @@ void TrackOutput::PrependBlock(Block *block)
|
||||
Node::InvalidateCache(TimeRange(0, track_length()), InputConnection());
|
||||
}
|
||||
|
||||
void TrackOutput::InsertBlockAtIndex(Block *block, int index)
|
||||
void Track::InsertBlockAtIndex(Block *block, int index)
|
||||
{
|
||||
BeginOperation();
|
||||
|
||||
@@ -311,7 +311,7 @@ void TrackOutput::InsertBlockAtIndex(Block *block, int index)
|
||||
Node::InvalidateCache(TimeRange(block->in(), track_length()));
|
||||
}
|
||||
|
||||
void TrackOutput::AppendBlock(Block *block)
|
||||
void Track::AppendBlock(Block *block)
|
||||
{
|
||||
BeginOperation();
|
||||
|
||||
@@ -324,7 +324,7 @@ void TrackOutput::AppendBlock(Block *block)
|
||||
Node::InvalidateCache(TimeRange(block->in(), track_length()));
|
||||
}
|
||||
|
||||
void TrackOutput::RippleRemoveBlock(Block *block)
|
||||
void Track::RippleRemoveBlock(Block *block)
|
||||
{
|
||||
BeginOperation();
|
||||
|
||||
@@ -338,7 +338,7 @@ void TrackOutput::RippleRemoveBlock(Block *block)
|
||||
Node::InvalidateCache(TimeRange(remove_in, qMax(track_length(), remove_out)));
|
||||
}
|
||||
|
||||
void TrackOutput::ReplaceBlock(Block *old, Block *replace)
|
||||
void Track::ReplaceBlock(Block *old, Block *replace)
|
||||
{
|
||||
BeginOperation();
|
||||
|
||||
@@ -357,57 +357,44 @@ void TrackOutput::ReplaceBlock(Block *old, Block *replace)
|
||||
}
|
||||
}
|
||||
|
||||
TrackOutput *TrackOutput::TrackFromBlock(const Block *block)
|
||||
{
|
||||
foreach (const InputConnection& conn, block->edges()) {
|
||||
TrackOutput* track = dynamic_cast<TrackOutput*>(conn.input->parent());
|
||||
|
||||
if (track) {
|
||||
return track;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const rational &TrackOutput::track_length() const
|
||||
const rational &Track::track_length() const
|
||||
{
|
||||
return track_length_;
|
||||
}
|
||||
|
||||
QString TrackOutput::GetDefaultTrackName(Timeline::TrackType type, int index)
|
||||
QString Track::GetDefaultTrackName(Track::Type type, int index)
|
||||
{
|
||||
// Starts tracks at 1 rather than 0
|
||||
int user_friendly_index = index+1;
|
||||
|
||||
switch (type) {
|
||||
case Timeline::kTrackTypeVideo: return tr("Video %1").arg(user_friendly_index);
|
||||
case Timeline::kTrackTypeAudio: return tr("Audio %1").arg(user_friendly_index);
|
||||
case Timeline::kTrackTypeSubtitle: return tr("Subtitle %1").arg(user_friendly_index);
|
||||
case Timeline::kTrackTypeNone:
|
||||
case Timeline::kTrackTypeCount:
|
||||
case Track::kVideo: return tr("Video %1").arg(user_friendly_index);
|
||||
case Track::kAudio: return tr("Audio %1").arg(user_friendly_index);
|
||||
case Track::kSubtitle: return tr("Subtitle %1").arg(user_friendly_index);
|
||||
case Track::kNone:
|
||||
case Track::kCount:
|
||||
break;
|
||||
}
|
||||
|
||||
return tr("Track %1").arg(user_friendly_index);
|
||||
}
|
||||
|
||||
bool TrackOutput::IsMuted() const
|
||||
bool Track::IsMuted() const
|
||||
{
|
||||
return muted_input_->GetStandardValue().toBool();
|
||||
}
|
||||
|
||||
bool TrackOutput::IsLocked() const
|
||||
bool Track::IsLocked() const
|
||||
{
|
||||
return locked_;
|
||||
}
|
||||
|
||||
NodeInput *TrackOutput::block_input() const
|
||||
NodeInput *Track::block_input() const
|
||||
{
|
||||
return block_input_;
|
||||
}
|
||||
|
||||
void TrackOutput::Hash(QCryptographicHash &hash, const rational &time) const
|
||||
void Track::Hash(QCryptographicHash &hash, const rational &time) const
|
||||
{
|
||||
Block* b = BlockAtTime(time);
|
||||
|
||||
@@ -417,18 +404,18 @@ void TrackOutput::Hash(QCryptographicHash &hash, const rational &time) const
|
||||
}
|
||||
}
|
||||
|
||||
void TrackOutput::SetMuted(bool e)
|
||||
void Track::SetMuted(bool e)
|
||||
{
|
||||
muted_input_->SetStandardValue(e);
|
||||
Node::InvalidateCache(TimeRange(0, track_length()));
|
||||
}
|
||||
|
||||
void TrackOutput::SetLocked(bool e)
|
||||
void Track::SetLocked(bool e)
|
||||
{
|
||||
locked_ = e;
|
||||
}
|
||||
|
||||
void TrackOutput::UpdateInOutFrom(int index)
|
||||
void Track::UpdateInOutFrom(int index)
|
||||
{
|
||||
// Find block just before this one to find the last out point
|
||||
rational last_out = (index == 0) ? 0 : block_cache_.at(index - 1)->out();
|
||||
@@ -442,20 +429,18 @@ void TrackOutput::UpdateInOutFrom(int index)
|
||||
last_out += b->length();
|
||||
|
||||
b->set_out(last_out);
|
||||
|
||||
emit b->Refreshed();
|
||||
}
|
||||
|
||||
// Update track length
|
||||
SetLengthInternal(last_out);
|
||||
}
|
||||
|
||||
int TrackOutput::GetInputIndexFromCacheIndex(int cache_index)
|
||||
int Track::GetInputIndexFromCacheIndex(int cache_index)
|
||||
{
|
||||
return GetInputIndexFromCacheIndex(block_cache_.at(cache_index));
|
||||
}
|
||||
|
||||
int TrackOutput::GetInputIndexFromCacheIndex(Block *block)
|
||||
int Track::GetInputIndexFromCacheIndex(Block *block)
|
||||
{
|
||||
for (int i=0; i<block_input_->ArraySize(); i++) {
|
||||
if (block_input_->GetConnectedNode(i) == block) {
|
||||
@@ -466,7 +451,7 @@ int TrackOutput::GetInputIndexFromCacheIndex(Block *block)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void TrackOutput::SetLengthInternal(const rational &r, bool invalidate)
|
||||
void Track::SetLengthInternal(const rational &r, bool invalidate)
|
||||
{
|
||||
if (r != track_length_) {
|
||||
TimeRange invalidate_range(track_length_, r);
|
||||
@@ -480,7 +465,7 @@ void TrackOutput::SetLengthInternal(const rational &r, bool invalidate)
|
||||
}
|
||||
}
|
||||
|
||||
void TrackOutput::BlockConnected(Node *node, int element)
|
||||
void Track::BlockConnected(Node *node, int element)
|
||||
{
|
||||
if (element == -1) {
|
||||
// User has replaced the entire array, we will invalidate everything
|
||||
@@ -541,7 +526,7 @@ void TrackOutput::BlockConnected(Node *node, int element)
|
||||
UpdateInOutFrom(cache_index);
|
||||
|
||||
// Connect to the block
|
||||
connect(block, &Block::LengthChanged, this, &TrackOutput::BlockLengthChanged);
|
||||
connect(block, &Block::LengthChanged, this, &Track::BlockLengthChanged);
|
||||
|
||||
// Invalidate cache now that block should have an in point
|
||||
Node::InvalidateCache(TimeRange(block->in(), track_length()));
|
||||
@@ -550,7 +535,7 @@ void TrackOutput::BlockConnected(Node *node, int element)
|
||||
emit BlockAdded(block);
|
||||
}
|
||||
|
||||
void TrackOutput::BlockDisconnected(Node* node, int element)
|
||||
void Track::BlockDisconnected(Node* node, int element)
|
||||
{
|
||||
if (element == -1) {
|
||||
// User has replaced the entire array, we will invalidate everything
|
||||
@@ -592,14 +577,14 @@ void TrackOutput::BlockDisconnected(Node* node, int element)
|
||||
SetLengthInternal(block_cache_.last()->out());
|
||||
}
|
||||
|
||||
disconnect(b, &Block::LengthChanged, this, &TrackOutput::BlockLengthChanged);
|
||||
disconnect(b, &Block::LengthChanged, this, &Track::BlockLengthChanged);
|
||||
|
||||
emit BlockRemoved(b);
|
||||
|
||||
Node::InvalidateCache(invalidate_range);
|
||||
}
|
||||
|
||||
void TrackOutput::BlockLengthChanged()
|
||||
void Track::BlockLengthChanged()
|
||||
{
|
||||
// Assumes sender is a Block
|
||||
Block* b = static_cast<Block*>(sender());
|
||||
@@ -615,7 +600,7 @@ void TrackOutput::BlockLengthChanged()
|
||||
Node::InvalidateCache(invalidate_region);
|
||||
}
|
||||
|
||||
void TrackOutput::MutedInputValueChanged()
|
||||
void Track::MutedInputValueChanged()
|
||||
{
|
||||
emit MutedChanged(IsMuted());
|
||||
}
|
||||
|
||||
@@ -30,16 +30,24 @@ namespace olive {
|
||||
/**
|
||||
* @brief A time traversal Node for sorting through one channel/track of Blocks
|
||||
*/
|
||||
class TrackOutput : public Node
|
||||
class Track : public Node
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrackOutput();
|
||||
enum Type {
|
||||
kNone = -1,
|
||||
kVideo,
|
||||
kAudio,
|
||||
kSubtitle,
|
||||
kCount
|
||||
};
|
||||
|
||||
virtual ~TrackOutput() override;
|
||||
Track();
|
||||
|
||||
const Timeline::TrackType& track_type() const;
|
||||
void set_track_type(const Timeline::TrackType& track_type);
|
||||
virtual ~Track() override;
|
||||
|
||||
const Track::Type& track_type() const;
|
||||
void set_track_type(const Track::Type& track_type);
|
||||
|
||||
virtual Node* copy() const override;
|
||||
|
||||
@@ -199,11 +207,9 @@ public:
|
||||
*/
|
||||
void ReplaceBlock(Block* old, Block* replace);
|
||||
|
||||
static TrackOutput* TrackFromBlock(const Block *block);
|
||||
|
||||
const rational& track_length() const;
|
||||
|
||||
static QString GetDefaultTrackName(Timeline::TrackType type, int index);
|
||||
static QString GetDefaultTrackName(Track::Type type, int index);
|
||||
|
||||
bool IsMuted() const;
|
||||
|
||||
@@ -282,7 +288,7 @@ private:
|
||||
|
||||
NodeInput* muted_input_;
|
||||
|
||||
Timeline::TrackType track_type_;
|
||||
Track::Type track_type_;
|
||||
|
||||
rational track_length_;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
TrackList::TrackList(ViewerOutput *parent, const Timeline::TrackType &type, NodeInput *track_input) :
|
||||
TrackList::TrackList(ViewerOutput *parent, const Track::Type &type, NodeInput *track_input) :
|
||||
QObject(parent),
|
||||
track_input_(track_input),
|
||||
type_(type)
|
||||
@@ -36,14 +36,14 @@ TrackList::TrackList(ViewerOutput *parent, const Timeline::TrackType &type, Node
|
||||
connect(track_input_, &NodeInput::InputDisconnected, this, &TrackList::TrackDisconnected);
|
||||
}
|
||||
|
||||
const Timeline::TrackType &TrackList::type() const
|
||||
const Track::Type &TrackList::type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
void TrackList::TrackAddedBlock(Block *block)
|
||||
{
|
||||
emit BlockAdded(block, static_cast<TrackOutput*>(sender())->Index());
|
||||
emit BlockAdded(block, static_cast<Track*>(sender())->Index());
|
||||
}
|
||||
|
||||
void TrackList::TrackRemovedBlock(Block *block)
|
||||
@@ -51,12 +51,12 @@ void TrackList::TrackRemovedBlock(Block *block)
|
||||
emit BlockRemoved(block);
|
||||
}
|
||||
|
||||
const QVector<TrackOutput *> &TrackList::GetTracks() const
|
||||
const QVector<Track *> &TrackList::GetTracks() const
|
||||
{
|
||||
return track_cache_;
|
||||
}
|
||||
|
||||
TrackOutput *TrackList::GetTrackAt(int index) const
|
||||
Track *TrackList::GetTrackAt(int index) const
|
||||
{
|
||||
if (index < track_cache_.size()) {
|
||||
return track_cache_.at(index);
|
||||
@@ -83,16 +83,16 @@ void TrackList::TrackConnected(Node *node, int element)
|
||||
return;
|
||||
}
|
||||
|
||||
TrackOutput* track = dynamic_cast<TrackOutput*>(node);
|
||||
Track* track = dynamic_cast<Track*>(node);
|
||||
|
||||
if (!track) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find "real" index
|
||||
TrackOutput* next = nullptr;
|
||||
Track* next = nullptr;
|
||||
for (int i=element+1; i<track_input_->ArraySize(); i++) {
|
||||
next = dynamic_cast<TrackOutput*>(track_input_->GetConnectedNode(i));
|
||||
next = dynamic_cast<Track*>(track_input_->GetConnectedNode(i));
|
||||
|
||||
if (next) {
|
||||
break;
|
||||
@@ -114,10 +114,10 @@ void TrackList::TrackConnected(Node *node, int element)
|
||||
// Update track indexes in the list (including this track)
|
||||
UpdateTrackIndexesFrom(track_index);
|
||||
|
||||
connect(track, &TrackOutput::BlockAdded, this, &TrackList::TrackAddedBlock);
|
||||
connect(track, &TrackOutput::BlockRemoved, this, &TrackList::TrackRemovedBlock);
|
||||
connect(track, &TrackOutput::TrackLengthChanged, this, &TrackList::UpdateTotalLength);
|
||||
connect(track, &TrackOutput::TrackHeightChangedInPixels, this, &TrackList::TrackHeightChangedSlot);
|
||||
connect(track, &Track::BlockAdded, this, &TrackList::TrackAddedBlock);
|
||||
connect(track, &Track::BlockRemoved, this, &TrackList::TrackRemovedBlock);
|
||||
connect(track, &Track::TrackLengthChanged, this, &TrackList::UpdateTotalLength);
|
||||
connect(track, &Track::TrackHeightChangedInPixels, this, &TrackList::TrackHeightChangedSlot);
|
||||
|
||||
track->set_track_type(type_);
|
||||
|
||||
@@ -134,7 +134,7 @@ void TrackList::TrackDisconnected(Node *node, int element)
|
||||
{
|
||||
Q_UNUSED(element)
|
||||
|
||||
TrackOutput* track = dynamic_cast<TrackOutput*>(node);
|
||||
Track* track = dynamic_cast<Track*>(node);
|
||||
|
||||
if (!track) {
|
||||
return;
|
||||
@@ -150,12 +150,12 @@ void TrackList::TrackDisconnected(Node *node, int element)
|
||||
emit TrackRemoved(track);
|
||||
|
||||
track->SetIndex(-1);
|
||||
track->set_track_type(Timeline::kTrackTypeNone);
|
||||
track->set_track_type(Track::kNone);
|
||||
|
||||
disconnect(track, &TrackOutput::BlockAdded, this, &TrackList::TrackAddedBlock);
|
||||
disconnect(track, &TrackOutput::BlockRemoved, this, &TrackList::TrackRemovedBlock);
|
||||
disconnect(track, &TrackOutput::TrackLengthChanged, this, &TrackList::UpdateTotalLength);
|
||||
disconnect(track, &TrackOutput::TrackHeightChangedInPixels, this, &TrackList::TrackHeightChangedSlot);
|
||||
disconnect(track, &Track::BlockAdded, this, &TrackList::TrackAddedBlock);
|
||||
disconnect(track, &Track::BlockRemoved, this, &TrackList::TrackRemovedBlock);
|
||||
disconnect(track, &Track::TrackLengthChanged, this, &TrackList::UpdateTotalLength);
|
||||
disconnect(track, &Track::TrackHeightChangedInPixels, this, &TrackList::TrackHeightChangedSlot);
|
||||
|
||||
emit TrackListChanged();
|
||||
|
||||
@@ -178,7 +178,7 @@ void TrackList::UpdateTotalLength()
|
||||
{
|
||||
total_length_ = 0;
|
||||
|
||||
foreach (TrackOutput* track, track_cache_) {
|
||||
foreach (Track* track, track_cache_) {
|
||||
if (track) {
|
||||
total_length_ = qMax(total_length_, track->track_length());
|
||||
}
|
||||
@@ -189,7 +189,7 @@ void TrackList::UpdateTotalLength()
|
||||
|
||||
void TrackList::TrackHeightChangedSlot(int height)
|
||||
{
|
||||
emit TrackHeightChanged(static_cast<TrackOutput*>(sender())->Index(), height);
|
||||
emit TrackHeightChanged(static_cast<Track*>(sender())->Index(), height);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,13 +35,13 @@ class TrackList : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrackList(ViewerOutput *parent, const Timeline::TrackType& type, NodeInput* track_input);
|
||||
TrackList(ViewerOutput *parent, const Track::Type& type, NodeInput* track_input);
|
||||
|
||||
const Timeline::TrackType& type() const;
|
||||
const Track::Type& type() const;
|
||||
|
||||
const QVector<TrackOutput*>& GetTracks() const;
|
||||
const QVector<Track*>& GetTracks() const;
|
||||
|
||||
TrackOutput* GetTrackAt(int index) const;
|
||||
Track* GetTrackAt(int index) const;
|
||||
|
||||
const rational& GetTotalLength() const;
|
||||
|
||||
@@ -59,9 +59,9 @@ signals:
|
||||
|
||||
void BlockRemoved(Block* block);
|
||||
|
||||
void TrackAdded(TrackOutput* track);
|
||||
void TrackAdded(Track* track);
|
||||
|
||||
void TrackRemoved(TrackOutput* track);
|
||||
void TrackRemoved(Track* track);
|
||||
|
||||
void TrackListChanged();
|
||||
|
||||
@@ -75,13 +75,13 @@ private:
|
||||
/**
|
||||
* @brief A cache of connected Tracks
|
||||
*/
|
||||
QVector<TrackOutput*> track_cache_;
|
||||
QVector<Track*> track_cache_;
|
||||
|
||||
NodeInput* track_input_;
|
||||
|
||||
rational total_length_;
|
||||
|
||||
enum Timeline::TrackType type_;
|
||||
enum Track::Type type_;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
|
||||
@@ -34,16 +34,16 @@ ViewerOutput::ViewerOutput() :
|
||||
samples_input_ = new NodeInput(this, QStringLiteral("samples_in"), NodeValue::kSamples);
|
||||
|
||||
// Create TrackList instances
|
||||
track_inputs_.resize(Timeline::kTrackTypeCount);
|
||||
track_lists_.resize(Timeline::kTrackTypeCount);
|
||||
track_inputs_.resize(Track::kCount);
|
||||
track_lists_.resize(Track::kCount);
|
||||
|
||||
for (int i=0;i<Timeline::kTrackTypeCount;i++) {
|
||||
for (int i=0;i<Track::kCount;i++) {
|
||||
// Create track input
|
||||
NodeInput* track_input = new NodeInput(this, QStringLiteral("track_in_%1").arg(i), NodeValue::kNone);
|
||||
IgnoreConnectionSignalsFrom(track_input);
|
||||
IgnoreInvalidationsFrom(track_input);
|
||||
track_inputs_.replace(i, track_input);
|
||||
|
||||
TrackList* list = new TrackList(this, static_cast<Timeline::TrackType>(i), track_input);
|
||||
TrackList* list = new TrackList(this, static_cast<Track::Type>(i), track_input);
|
||||
track_lists_.replace(i, list);
|
||||
connect(list, &TrackList::TrackListChanged, this, &ViewerOutput::UpdateTrackCache);
|
||||
connect(list, &TrackList::LengthChanged, this, &ViewerOutput::VerifyLength);
|
||||
@@ -97,7 +97,7 @@ void ViewerOutput::ShiftAudioCache(const rational &from, const rational &to)
|
||||
{
|
||||
audio_playback_cache_.Shift(from, to);
|
||||
|
||||
foreach (TrackOutput* track, track_lists_.at(Timeline::kTrackTypeAudio)->GetTracks()) {
|
||||
foreach (Track* track, track_lists_.at(Track::kAudio)->GetTracks()) {
|
||||
track->waveform().Shift(from, to);
|
||||
}
|
||||
}
|
||||
@@ -176,9 +176,9 @@ rational ViewerOutput::GetLength()
|
||||
return last_length_;
|
||||
}
|
||||
|
||||
QVector<TrackOutput *> ViewerOutput::GetUnlockedTracks() const
|
||||
QVector<Track *> ViewerOutput::GetUnlockedTracks() const
|
||||
{
|
||||
QVector<TrackOutput*> tracks = GetTracks();
|
||||
QVector<Track*> tracks = GetTracks();
|
||||
|
||||
for (int i=0;i<tracks.size();i++) {
|
||||
if (tracks.at(i)->IsLocked()) {
|
||||
@@ -195,7 +195,7 @@ void ViewerOutput::UpdateTrackCache()
|
||||
track_cache_.clear();
|
||||
|
||||
foreach (TrackList* list, track_lists_) {
|
||||
foreach (TrackOutput* track, list->GetTracks()) {
|
||||
foreach (Track* track, list->GetTracks()) {
|
||||
track_cache_.append(track);
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ void ViewerOutput::VerifyLength()
|
||||
rational video_length, audio_length, subtitle_length;
|
||||
|
||||
{
|
||||
video_length = track_lists_.at(Timeline::kTrackTypeVideo)->GetTotalLength();
|
||||
video_length = track_lists_.at(Track::kVideo)->GetTotalLength();
|
||||
|
||||
if (video_length.isNull() && texture_input_->IsConnected()) {
|
||||
NodeValueTable t = traverser.GenerateTable(texture_input_->GetConnectedNode(), 0, 0);
|
||||
@@ -223,7 +223,7 @@ void ViewerOutput::VerifyLength()
|
||||
}
|
||||
|
||||
{
|
||||
audio_length = track_lists_.at(Timeline::kTrackTypeAudio)->GetTotalLength();
|
||||
audio_length = track_lists_.at(Track::kAudio)->GetTotalLength();
|
||||
|
||||
if (audio_length.isNull() && samples_input_->IsConnected()) {
|
||||
NodeValueTable t = traverser.GenerateTable(samples_input_->GetConnectedNode(), 0, 0);
|
||||
@@ -234,7 +234,7 @@ void ViewerOutput::VerifyLength()
|
||||
}
|
||||
|
||||
{
|
||||
subtitle_length = track_lists_.at(Timeline::kTrackTypeSubtitle)->GetTotalLength();
|
||||
subtitle_length = track_lists_.at(Track::kSubtitle)->GetTotalLength();
|
||||
}
|
||||
|
||||
rational real_length = qMax(subtitle_length, qMax(video_length, audio_length));
|
||||
@@ -256,18 +256,18 @@ void ViewerOutput::Retranslate()
|
||||
for (int i=0;i<track_inputs_.size();i++) {
|
||||
QString input_name;
|
||||
|
||||
switch (static_cast<Timeline::TrackType>(i)) {
|
||||
case Timeline::kTrackTypeVideo:
|
||||
switch (static_cast<Track::Type>(i)) {
|
||||
case Track::kVideo:
|
||||
input_name = tr("Video Tracks");
|
||||
break;
|
||||
case Timeline::kTrackTypeAudio:
|
||||
case Track::kAudio:
|
||||
input_name = tr("Audio Tracks");
|
||||
break;
|
||||
case Timeline::kTrackTypeSubtitle:
|
||||
case Track::kSubtitle:
|
||||
input_name = tr("Subtitle Tracks");
|
||||
break;
|
||||
case Timeline::kTrackTypeNone:
|
||||
case Timeline::kTrackTypeCount:
|
||||
case Track::kNone:
|
||||
case Track::kCount:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -293,13 +293,13 @@ void ViewerOutput::EndOperation()
|
||||
|
||||
void ViewerOutput::TrackListAddedBlock(Block *block, int index)
|
||||
{
|
||||
Timeline::TrackType type = static_cast<TrackList*>(sender())->type();
|
||||
Track::Type type = static_cast<TrackList*>(sender())->type();
|
||||
emit BlockAdded(block, TrackReference(type, index));
|
||||
}
|
||||
|
||||
void ViewerOutput::TrackListAddedTrack(TrackOutput *track)
|
||||
void ViewerOutput::TrackListAddedTrack(Track *track)
|
||||
{
|
||||
Timeline::TrackType type = static_cast<TrackList*>(sender())->type();
|
||||
Track::Type type = static_cast<TrackList*>(sender())->type();
|
||||
emit TrackAdded(track, type);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
return uuid_;
|
||||
}
|
||||
|
||||
const QVector<TrackOutput *> &GetTracks() const
|
||||
const QVector<Track *> &GetTracks() const
|
||||
{
|
||||
return track_cache_;
|
||||
}
|
||||
@@ -100,14 +100,14 @@ public:
|
||||
/**
|
||||
* @brief Same as GetTracks() but omits tracks that are locked.
|
||||
*/
|
||||
QVector<TrackOutput *> GetUnlockedTracks() const;
|
||||
QVector<Track *> GetUnlockedTracks() const;
|
||||
|
||||
NodeInput* track_input(Timeline::TrackType type) const
|
||||
NodeInput* track_input(Track::Type type) const
|
||||
{
|
||||
return track_inputs_.at(type);
|
||||
}
|
||||
|
||||
TrackList* track_list(Timeline::TrackType type) const
|
||||
TrackList* track_list(Track::Type type) const
|
||||
{
|
||||
return track_lists_.at(type);
|
||||
}
|
||||
@@ -145,10 +145,10 @@ signals:
|
||||
void BlockAdded(Block* block, TrackReference track);
|
||||
void BlockRemoved(Block* block);
|
||||
|
||||
void TrackAdded(TrackOutput* track, Timeline::TrackType type);
|
||||
void TrackRemoved(TrackOutput* track);
|
||||
void TrackAdded(Track* track, Track::Type type);
|
||||
void TrackRemoved(Track* track);
|
||||
|
||||
void TrackHeightChanged(Timeline::TrackType type, int index, int height);
|
||||
void TrackHeightChanged(Track::Type type, int index, int height);
|
||||
|
||||
private:
|
||||
QUuid uuid_;
|
||||
@@ -165,7 +165,7 @@ private:
|
||||
|
||||
QVector<TrackList*> track_lists_;
|
||||
|
||||
QVector<TrackOutput*> track_cache_;
|
||||
QVector<Track*> track_cache_;
|
||||
|
||||
rational last_length_;
|
||||
|
||||
@@ -182,7 +182,7 @@ private slots:
|
||||
|
||||
void TrackListAddedBlock(Block* block, int index);
|
||||
|
||||
void TrackListAddedTrack(TrackOutput* track);
|
||||
void TrackListAddedTrack(Track* track);
|
||||
|
||||
void TrackHeightChangedSlot(int index, int height);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ NodeValueTable NodeTraverser::ProcessInput(NodeInput* input, const TimeRange& ra
|
||||
|
||||
NodeValueTable NodeTraverser::GenerateTable(const Node *n, const TimeRange& range)
|
||||
{
|
||||
const TrackOutput* track = dynamic_cast<const TrackOutput*>(n);
|
||||
const Track* track = dynamic_cast<const Track*>(n);
|
||||
if (track) {
|
||||
// If the range is not wholly contained in this Block, we'll need to do some extra processing
|
||||
return GenerateBlockTable(track, range);
|
||||
@@ -117,7 +117,7 @@ NodeValueTable NodeTraverser::GenerateTable(const Node *n, const rational &in, c
|
||||
return GenerateTable(n, TimeRange(in, out));
|
||||
}
|
||||
|
||||
NodeValueTable NodeTraverser::GenerateBlockTable(const TrackOutput *track, const TimeRange &range)
|
||||
NodeValueTable NodeTraverser::GenerateBlockTable(const Track *track, const TimeRange &range)
|
||||
{
|
||||
// By default, just follow the in point
|
||||
Block* active_block = track->BlockAtTime(range.in());
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
protected:
|
||||
NodeValueTable ProcessInput(NodeInput *input, const TimeRange &range);
|
||||
|
||||
virtual NodeValueTable GenerateBlockTable(const TrackOutput *track, const TimeRange& range);
|
||||
virtual NodeValueTable GenerateBlockTable(const Track *track, const TimeRange& range);
|
||||
|
||||
virtual QVariant ProcessVideoFootage(VideoStream* stream, const rational &input_time);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user