clip: retrieve any connected viewer on invalidate
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "clip.h"
|
||||
|
||||
#include "node/output/track/track.h"
|
||||
#include "node/output/viewer/viewer.h"
|
||||
#include "widget/slider/floatslider.h"
|
||||
#include "widget/slider/rationalslider.h"
|
||||
|
||||
@@ -35,7 +36,8 @@ const QString ClipBlock::kReverseInput = QStringLiteral("reverse_in");
|
||||
|
||||
ClipBlock::ClipBlock() :
|
||||
in_transition_(nullptr),
|
||||
out_transition_(nullptr)
|
||||
out_transition_(nullptr),
|
||||
connected_viewer_(nullptr)
|
||||
{
|
||||
AddInput(kMediaInInput, NodeValue::kRational, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||
SetInputProperty(kMediaInInput, QStringLiteral("view"), RationalSlider::kTime);
|
||||
@@ -189,6 +191,14 @@ void ClipBlock::InvalidateCache(const TimeRange& range, const QString& from, int
|
||||
adj = TimeRange(MediaToSequenceTime(range.in()), MediaToSequenceTime(range.out()));
|
||||
}
|
||||
|
||||
// Find connected viewer node
|
||||
auto viewers = FindInputNodesConnectedToInput<ViewerOutput>(NodeInput(this, kBufferIn));
|
||||
if (viewers.isEmpty()) {
|
||||
connected_viewer_ = nullptr;
|
||||
} else {
|
||||
connected_viewer_ = viewers.first();
|
||||
}
|
||||
|
||||
super::InvalidateCache(adj, from, element, options);
|
||||
} else {
|
||||
// Otherwise, pass signal along normally
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
class ViewerOutput;
|
||||
|
||||
/**
|
||||
* @brief Node that represents a block of Media
|
||||
*/
|
||||
@@ -99,6 +101,11 @@ public:
|
||||
return waveform_;
|
||||
}
|
||||
|
||||
ViewerOutput *connected_viewer() const
|
||||
{
|
||||
return connected_viewer_;
|
||||
}
|
||||
|
||||
static const QString kBufferIn;
|
||||
static const QString kMediaInInput;
|
||||
static const QString kSpeedInput;
|
||||
@@ -121,6 +128,8 @@ private:
|
||||
TransitionBlock* in_transition_;
|
||||
TransitionBlock* out_transition_;
|
||||
|
||||
ViewerOutput *connected_viewer_;
|
||||
|
||||
private:
|
||||
AudioVisualWaveform waveform_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user