base support for multiple timeline sections
This commit is contained in:
@@ -20,6 +20,5 @@ set(OLIVE_SOURCES
|
||||
node/output/timeline/timeline.cpp
|
||||
node/output/timeline/tracklist.h
|
||||
node/output/timeline/tracklist.cpp
|
||||
node/output/timeline/tracktypes.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
@@ -45,6 +45,8 @@ TimelineOutput::TimelineOutput()
|
||||
connect(list, SIGNAL(LengthChanged(const rational &)), this, SLOT(UpdateLength(const rational &)));
|
||||
connect(list, SIGNAL(BlockAdded(Block*, int)), this, SLOT(TrackListAddedBlock(Block*, int)));
|
||||
connect(list, SIGNAL(BlockRemoved(Block*)), this, SIGNAL(BlockRemoved(Block*)));
|
||||
connect(list, SIGNAL(TrackAdded(TrackOutput*)), this, SLOT(TrackListAddedTrack(TrackOutput*)));
|
||||
connect(list, SIGNAL(TrackRemoved(TrackOutput*)), this, SIGNAL(TrackRemoved(TrackOutput*)));
|
||||
}
|
||||
|
||||
length_output_ = new NodeOutput("length_out");
|
||||
@@ -87,6 +89,11 @@ const rational &TimelineOutput::timeline_length()
|
||||
return length_;
|
||||
}
|
||||
|
||||
const rational &TimelineOutput::Timebase()
|
||||
{
|
||||
return timebase_;
|
||||
}
|
||||
|
||||
QVariant TimelineOutput::Value(NodeOutput *output, const rational &time)
|
||||
{
|
||||
if (output == length_output_) {
|
||||
@@ -136,9 +143,9 @@ void TimelineOutput::UpdateLength(const rational &length)
|
||||
|
||||
void TimelineOutput::SetTimebase(const rational &timebase)
|
||||
{
|
||||
foreach (TrackList* list, track_lists_) {
|
||||
list->SetTimebase(timebase);
|
||||
}
|
||||
timebase_ = timebase;
|
||||
|
||||
emit TimebaseChanged(timebase_);
|
||||
}
|
||||
|
||||
NodeInput *TimelineOutput::track_input(TrackType type)
|
||||
@@ -156,3 +163,9 @@ void TimelineOutput::TrackListAddedBlock(Block *block, int index)
|
||||
TrackType type = static_cast<TrackList*>(sender())->TrackType();
|
||||
emit BlockAdded(block, TrackReference(type, index));
|
||||
}
|
||||
|
||||
void TimelineOutput::TrackListAddedTrack(TrackOutput *track)
|
||||
{
|
||||
TrackType type = static_cast<TrackList*>(sender())->TrackType();
|
||||
emit TrackAdded(track, type);
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "node/block/block.h"
|
||||
#include "node/output/track/track.h"
|
||||
#include "timeline/trackreference.h"
|
||||
#include "timeline/tracktypes.h"
|
||||
#include "tracklist.h"
|
||||
#include "tracktypes.h"
|
||||
|
||||
/**
|
||||
* @brief Node that represents the end of the Timeline as well as a time traversal Node
|
||||
@@ -52,15 +52,20 @@ public:
|
||||
|
||||
const rational& timeline_length();
|
||||
|
||||
const rational& Timebase();
|
||||
|
||||
void SetTimebase(const rational &timebase);
|
||||
|
||||
signals:
|
||||
void LengthChanged(const rational& length);
|
||||
void TimebaseChanged(const rational &timebase);
|
||||
|
||||
void BlockAdded(Block* block, TrackReference track);
|
||||
|
||||
void BlockRemoved(Block* block);
|
||||
|
||||
void TrackAdded(TrackOutput* track, TrackType type);
|
||||
void TrackRemoved(TrackOutput* track);
|
||||
|
||||
protected:
|
||||
virtual QVariant Value(NodeOutput* output, const rational& time) override;
|
||||
|
||||
@@ -75,6 +80,8 @@ private:
|
||||
|
||||
rational length_;
|
||||
|
||||
rational timebase_;
|
||||
|
||||
private slots:
|
||||
void UpdateTrackCache();
|
||||
|
||||
@@ -82,6 +89,8 @@ private slots:
|
||||
|
||||
void TrackListAddedBlock(Block* block, int index);
|
||||
|
||||
void TrackListAddedTrack(TrackOutput* track);
|
||||
|
||||
};
|
||||
|
||||
#endif // TIMELINEOUTPUT_H
|
||||
|
||||
@@ -50,6 +50,7 @@ void TrackList::AttachTrack(TrackOutput *track)
|
||||
connect(current_track, SIGNAL(Refreshed()), this, SLOT(UpdateTotalLength()));
|
||||
|
||||
current_track->SetIndex(track_cache_.size());
|
||||
current_track->set_track_type(type_);
|
||||
|
||||
track_cache_.append(current_track);
|
||||
emit TrackListChanged();
|
||||
@@ -73,6 +74,7 @@ void TrackList::DetachTrack(TrackOutput *track)
|
||||
emit TrackRemoved(current_track);
|
||||
|
||||
current_track->SetIndex(-1);
|
||||
current_track->set_track_type(kTrackTypeNone);
|
||||
|
||||
disconnect(current_track, SIGNAL(EdgeAdded(NodeEdgePtr)), this, SLOT(TrackEdgeAdded(NodeEdgePtr)));
|
||||
disconnect(current_track, SIGNAL(EdgeRemoved(NodeEdgePtr)), this, SLOT(TrackEdgeRemoved(NodeEdgePtr)));
|
||||
@@ -109,18 +111,6 @@ TrackOutput *TrackList::TrackAt(int index)
|
||||
return track_cache_.at(index);
|
||||
}
|
||||
|
||||
const rational &TrackList::Timebase()
|
||||
{
|
||||
return timebase_;
|
||||
}
|
||||
|
||||
void TrackList::SetTimebase(const rational &timebase)
|
||||
{
|
||||
timebase_ = timebase;
|
||||
|
||||
emit TimebaseChanged(timebase_);
|
||||
}
|
||||
|
||||
const rational &TrackList::TrackLength()
|
||||
{
|
||||
return total_length_;
|
||||
@@ -178,9 +168,6 @@ void TrackList::TrackConnectionAdded(NodeEdgePtr edge)
|
||||
}
|
||||
|
||||
AttachTrack(attached_track());
|
||||
|
||||
// FIXME: Is this necessary?
|
||||
emit TimebaseChanged(timebase_);
|
||||
}
|
||||
|
||||
void TrackList::TrackConnectionRemoved(NodeEdgePtr edge)
|
||||
@@ -190,8 +177,6 @@ void TrackList::TrackConnectionRemoved(NodeEdgePtr edge)
|
||||
}
|
||||
|
||||
DetachTrack(Node::ValueToPtr<TrackOutput>(edge->output()->get_value(0)));
|
||||
|
||||
emit TimelineCleared();
|
||||
}
|
||||
|
||||
void TrackList::TrackEdgeAdded(NodeEdgePtr edge)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "node/graph.h"
|
||||
#include "node/output/track/track.h"
|
||||
#include "tracktypes.h"
|
||||
#include "timeline/tracktypes.h"
|
||||
|
||||
class TimelineOutput;
|
||||
|
||||
@@ -48,10 +48,6 @@ public:
|
||||
|
||||
void RemoveTrack();
|
||||
|
||||
const rational& Timebase();
|
||||
|
||||
void SetTimebase(const rational& timebase);
|
||||
|
||||
const rational& TrackLength();
|
||||
|
||||
const enum TrackType& TrackType();
|
||||
@@ -97,10 +93,6 @@ signals:
|
||||
|
||||
void TrackListChanged();
|
||||
|
||||
void TimelineCleared();
|
||||
|
||||
void TimebaseChanged(const rational &timebase);
|
||||
|
||||
void LengthChanged(const rational &length);
|
||||
|
||||
private:
|
||||
@@ -111,8 +103,6 @@ private:
|
||||
*/
|
||||
QVector<TrackOutput*> track_cache_;
|
||||
|
||||
rational timebase_;
|
||||
|
||||
NodeInput* track_input_;
|
||||
|
||||
rational total_length_;
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef TRACKTYPES_H
|
||||
#define TRACKTYPES_H
|
||||
|
||||
enum TrackType {
|
||||
kTrackTypeNone = -1,
|
||||
kTrackTypeVideo,
|
||||
kTrackTypeAudio,
|
||||
kTrackTypeSubtitle,
|
||||
kTrackTypeCount
|
||||
};
|
||||
|
||||
#endif // TRACKTYPES_H
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
TrackOutput::TrackOutput() :
|
||||
current_block_(this),
|
||||
track_type_(kTrackTypeNone),
|
||||
block_invalidate_cache_stack_(0),
|
||||
index_(-1)
|
||||
{
|
||||
@@ -40,6 +41,16 @@ TrackOutput::TrackOutput() :
|
||||
AddParameter(track_output_);
|
||||
}
|
||||
|
||||
void TrackOutput::set_track_type(const TrackType &track_type)
|
||||
{
|
||||
track_type_ = track_type;
|
||||
}
|
||||
|
||||
const TrackType& TrackOutput::track_type()
|
||||
{
|
||||
return track_type_;
|
||||
}
|
||||
|
||||
Block::Type TrackOutput::type()
|
||||
{
|
||||
return kEnd;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#define TRACKOUTPUT_H
|
||||
|
||||
#include "node/block/block.h"
|
||||
#include "timeline/tracktypes.h"
|
||||
|
||||
/**
|
||||
* @brief A time traversal Node for sorting through one channel/track of Blocks
|
||||
@@ -32,6 +33,9 @@ class TrackOutput : public Block
|
||||
public:
|
||||
TrackOutput();
|
||||
|
||||
const TrackType& track_type();
|
||||
void set_track_type(const TrackType& track_type);
|
||||
|
||||
virtual Type type() override;
|
||||
|
||||
virtual Block* copy() override;
|
||||
@@ -170,6 +174,8 @@ private:
|
||||
|
||||
NodeOutput* track_output_;
|
||||
|
||||
TrackType track_type_;
|
||||
|
||||
int block_invalidate_cache_stack_;
|
||||
|
||||
int index_;
|
||||
|
||||
Reference in New Issue
Block a user