a first attempt at a new render system
This commit is contained in:
@@ -55,7 +55,7 @@ void TrackOutput::set_track_type(const Timeline::TrackType &track_type)
|
||||
track_type_ = track_type;
|
||||
}
|
||||
|
||||
const Timeline::TrackType& TrackOutput::track_type()
|
||||
const Timeline::TrackType& TrackOutput::track_type() const
|
||||
{
|
||||
return track_type_;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class TrackOutput : public Block
|
||||
public:
|
||||
TrackOutput();
|
||||
|
||||
const Timeline::TrackType& track_type();
|
||||
const Timeline::TrackType& track_type() const;
|
||||
void set_track_type(const Timeline::TrackType& track_type);
|
||||
|
||||
virtual Type type() const override;
|
||||
|
||||
@@ -55,6 +55,8 @@ ViewerOutput::ViewerOutput()
|
||||
|
||||
// Create UUID for this node
|
||||
uuid_ = QUuid::createUuid();
|
||||
|
||||
connect(this, &ViewerOutput::LengthChanged, &video_frame_cache_, &FrameHashCache::SetLength);
|
||||
}
|
||||
|
||||
Node *ViewerOutput::copy() const
|
||||
@@ -82,22 +84,16 @@ QString ViewerOutput::Description() const
|
||||
return tr("Interface between a Viewer panel and the node system.");
|
||||
}
|
||||
|
||||
NodeInput *ViewerOutput::texture_input() const
|
||||
{
|
||||
return texture_input_;
|
||||
}
|
||||
|
||||
NodeInput *ViewerOutput::samples_input() const
|
||||
{
|
||||
return samples_input_;
|
||||
}
|
||||
|
||||
void ViewerOutput::InvalidateCache(const TimeRange &range, NodeInput *from, NodeInput *source)
|
||||
{
|
||||
if (from == texture_input()) {
|
||||
emit VideoChangedBetween(range, source);
|
||||
emit GraphChangedFrom(from, source);
|
||||
|
||||
video_frame_cache_.Invalidate(range);
|
||||
} else if (from == samples_input()) {
|
||||
emit AudioChangedBetween(range, source);
|
||||
emit GraphChangedFrom(from, source);
|
||||
|
||||
audio_playback_cache_.Invalidate(range);
|
||||
}
|
||||
|
||||
Node::InvalidateCache(range, from, source);
|
||||
@@ -112,16 +108,6 @@ void ViewerOutput::InvalidateVisible(NodeInput* from, NodeInput *source)
|
||||
Node::InvalidateVisible(from, source);
|
||||
}
|
||||
|
||||
const VideoParams &ViewerOutput::video_params() const
|
||||
{
|
||||
return video_params_;
|
||||
}
|
||||
|
||||
const AudioParams &ViewerOutput::audio_params() const
|
||||
{
|
||||
return audio_params_;
|
||||
}
|
||||
|
||||
void ViewerOutput::set_video_params(const VideoParams &video)
|
||||
{
|
||||
video_params_ = video;
|
||||
@@ -134,34 +120,31 @@ void ViewerOutput::set_video_params(const VideoParams &video)
|
||||
void ViewerOutput::set_audio_params(const AudioParams &audio)
|
||||
{
|
||||
audio_params_ = audio;
|
||||
|
||||
emit AudioParamsChanged();
|
||||
}
|
||||
|
||||
rational ViewerOutput::Length()
|
||||
rational ViewerOutput::GetLength()
|
||||
{
|
||||
NodeTraverser traverser;
|
||||
|
||||
rational video_length;
|
||||
|
||||
if (texture_input_->IsConnected()) {
|
||||
NodeValueTable t = traverser.ProcessNode(NodeDependency(texture_input_->get_connected_node(), 0, 0));
|
||||
NodeValueTable t = traverser.GenerateTable(texture_input_->get_connected_node(), 0, 0);
|
||||
video_length = t.Get(NodeParam::kNumber, "length").value<rational>();
|
||||
}
|
||||
|
||||
rational audio_length;
|
||||
|
||||
if (samples_input_->IsConnected()) {
|
||||
NodeValueTable t = traverser.ProcessNode(NodeDependency(samples_input_->get_connected_node(), 0, 0));
|
||||
NodeValueTable t = traverser.GenerateTable(samples_input_->get_connected_node(), 0, 0);
|
||||
audio_length = t.Get(NodeParam::kNumber, "length").value<rational>();
|
||||
}
|
||||
|
||||
return qMax(video_length, qMax(audio_length, timeline_length_));
|
||||
}
|
||||
|
||||
const QUuid &ViewerOutput::uuid() const
|
||||
{
|
||||
return uuid_;
|
||||
}
|
||||
|
||||
void ViewerOutput::UpdateTrackCache()
|
||||
{
|
||||
track_cache_.clear();
|
||||
@@ -231,11 +214,6 @@ void ViewerOutput::Retranslate()
|
||||
}
|
||||
}
|
||||
|
||||
const QString &ViewerOutput::media_name() const
|
||||
{
|
||||
return media_name_;
|
||||
}
|
||||
|
||||
void ViewerOutput::set_media_name(const QString &name)
|
||||
{
|
||||
media_name_ = name;
|
||||
@@ -243,21 +221,6 @@ void ViewerOutput::set_media_name(const QString &name)
|
||||
emit MediaNameChanged(media_name_);
|
||||
}
|
||||
|
||||
const QVector<TrackOutput *>& ViewerOutput::Tracks() const
|
||||
{
|
||||
return track_cache_;
|
||||
}
|
||||
|
||||
NodeInput *ViewerOutput::track_input(Timeline::TrackType type) const
|
||||
{
|
||||
return track_inputs_.at(type);
|
||||
}
|
||||
|
||||
TrackList *ViewerOutput::track_list(Timeline::TrackType type) const
|
||||
{
|
||||
return track_lists_.at(type);
|
||||
}
|
||||
|
||||
void ViewerOutput::TrackListAddedBlock(Block *block, int index)
|
||||
{
|
||||
Timeline::TrackType type = static_cast<TrackList*>(sender())->type();
|
||||
|
||||
@@ -28,8 +28,10 @@
|
||||
#include "node/output/track/track.h"
|
||||
#include "node/output/track/tracklist.h"
|
||||
#include "node/node.h"
|
||||
#include "render/videoparams.h"
|
||||
#include "render/audioparams.h"
|
||||
#include "render/audioplaybackcache.h"
|
||||
#include "render/framehashcache.h"
|
||||
#include "render/videoparams.h"
|
||||
#include "timeline/trackreference.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
@@ -52,39 +54,66 @@ public:
|
||||
virtual QList<CategoryID> Category() const override;
|
||||
virtual QString Description() const override;
|
||||
|
||||
NodeInput* texture_input() const;
|
||||
NodeInput* samples_input() const;
|
||||
NodeInput* texture_input() const {
|
||||
return texture_input_;
|
||||
}
|
||||
|
||||
NodeInput* samples_input() const {
|
||||
return samples_input_;
|
||||
}
|
||||
|
||||
virtual void InvalidateCache(const TimeRange &range, NodeInput *from, NodeInput* source) override;
|
||||
virtual void InvalidateVisible(NodeInput *from, NodeInput* source) override;
|
||||
|
||||
const VideoParams& video_params() const;
|
||||
const AudioParams& audio_params() const;
|
||||
const VideoParams& video_params() const {
|
||||
return video_params_;
|
||||
}
|
||||
|
||||
const AudioParams& audio_params() const {
|
||||
return audio_params_;
|
||||
}
|
||||
|
||||
void set_video_params(const VideoParams& video);
|
||||
void set_audio_params(const AudioParams& audio);
|
||||
|
||||
rational Length();
|
||||
rational GetLength();
|
||||
|
||||
const QUuid& uuid() const;
|
||||
const QUuid& uuid() const {
|
||||
return uuid_;
|
||||
}
|
||||
|
||||
const QVector<TrackOutput *> &Tracks() const;
|
||||
const QVector<TrackOutput *> &GetTracks() const {
|
||||
return track_cache_;
|
||||
}
|
||||
|
||||
NodeInput* track_input(Timeline::TrackType type) const;
|
||||
NodeInput* track_input(Timeline::TrackType type) const {
|
||||
return track_inputs_.at(type);
|
||||
}
|
||||
|
||||
TrackList* track_list(Timeline::TrackType type) const;
|
||||
TrackList* track_list(Timeline::TrackType type) const {
|
||||
return track_lists_.at(type);
|
||||
}
|
||||
|
||||
virtual void Retranslate() override;
|
||||
|
||||
const QString& media_name() const;
|
||||
const QString& media_name() const {
|
||||
return media_name_;
|
||||
}
|
||||
|
||||
void set_media_name(const QString& name);
|
||||
|
||||
FrameHashCache* video_frame_cache() {
|
||||
return &video_frame_cache_;
|
||||
}
|
||||
|
||||
AudioPlaybackCache* audio_playback_cache() {
|
||||
return &audio_playback_cache_;
|
||||
}
|
||||
|
||||
signals:
|
||||
void TimebaseChanged(const rational&);
|
||||
|
||||
void VideoChangedBetween(const TimeRange& range, NodeInput* source);
|
||||
|
||||
void AudioChangedBetween(const TimeRange& range, NodeInput* source);
|
||||
void GraphChangedFrom(NodeInput* from, NodeInput* source);
|
||||
|
||||
void VisibleInvalidated(NodeInput* source);
|
||||
|
||||
@@ -93,6 +122,7 @@ signals:
|
||||
void SizeChanged(int width, int height);
|
||||
|
||||
void VideoParamsChanged();
|
||||
void AudioParamsChanged();
|
||||
|
||||
void BlockAdded(Block* block, TrackReference track);
|
||||
void BlockRemoved(Block* block);
|
||||
@@ -125,6 +155,10 @@ private:
|
||||
|
||||
QString media_name_;
|
||||
|
||||
FrameHashCache video_frame_cache_;
|
||||
|
||||
AudioPlaybackCache audio_playback_cache_;
|
||||
|
||||
private slots:
|
||||
void UpdateTrackCache();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user