multicam: implemented queuing of future node selections during playback
This commit is contained in:
@@ -14,14 +14,6 @@ public:
|
||||
|
||||
MulticamWidget *GetMulticamWidget() const { return static_cast<MulticamWidget *>(GetTimeBasedWidget()); }
|
||||
|
||||
public slots:
|
||||
void SetMulticamNode(ViewerOutput *viewer, MultiCamNode *n, ClipBlock *clip)
|
||||
{
|
||||
ConnectViewerNode(viewer);
|
||||
GetMulticamWidget()->SetMulticamNode(n);
|
||||
GetMulticamWidget()->SetClip(clip);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void Retranslate() override;
|
||||
|
||||
|
||||
@@ -100,16 +100,17 @@ void ViewerPanelBase::SetViewerWidget(ViewerWidget *vw)
|
||||
connect(vw, &ViewerWidget::TextureChanged, this, &ViewerPanelBase::TextureChanged);
|
||||
connect(vw, &ViewerWidget::ColorProcessorChanged, this, &ViewerPanelBase::ColorProcessorChanged);
|
||||
connect(vw, &ViewerWidget::ColorManagerChanged, this, &ViewerPanelBase::ColorManagerChanged);
|
||||
connect(vw, &ViewerWidget::MulticamNodeDetected, this, &ViewerPanelBase::MulticamNodeDetected);
|
||||
|
||||
SetTimeBasedWidget(vw);
|
||||
}
|
||||
|
||||
void ViewerPanelBase::FocusedPanelChanged(PanelWidget *panel)
|
||||
{
|
||||
auto vw = GetViewerWidget();
|
||||
if (vw->IsPlaying() && panel != this) {
|
||||
vw->Pause();
|
||||
if (dynamic_cast<ViewerPanelBase*>(panel)) {
|
||||
auto vw = GetViewerWidget();
|
||||
if (vw->IsPlaying() && panel != this) {
|
||||
vw->Pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,9 +77,9 @@ public:
|
||||
GetViewerWidget()->SetTimelineSelectedBlocks(b);
|
||||
}
|
||||
|
||||
void ConnectMulticamPanel(MulticamPanel *p)
|
||||
void ConnectMulticamWidget(MulticamWidget *p)
|
||||
{
|
||||
GetViewerWidget()->ConnectMulticamPanel(p);
|
||||
GetViewerWidget()->ConnectMulticamWidget(p);
|
||||
}
|
||||
|
||||
public slots:
|
||||
@@ -110,8 +110,6 @@ signals:
|
||||
*/
|
||||
void ColorManagerChanged(ColorManager* color_manager);
|
||||
|
||||
void MulticamNodeDetected(ViewerOutput *viewer, MultiCamNode *n, ClipBlock *clip);
|
||||
|
||||
protected:
|
||||
void SetViewerWidget(ViewerWidget *vw);
|
||||
|
||||
|
||||
@@ -56,15 +56,23 @@ MulticamWidget::MulticamWidget(QWidget *parent) :
|
||||
}
|
||||
}
|
||||
|
||||
void MulticamWidget::SetMulticamNode(MultiCamNode *n)
|
||||
void MulticamWidget::SetMulticamNodeInternal(ViewerOutput *viewer, MultiCamNode *n, ClipBlock *clip)
|
||||
{
|
||||
ConnectViewerNode(viewer);
|
||||
node_ = n;
|
||||
display_->SetMulticamNode(n);
|
||||
clip_ = clip;
|
||||
}
|
||||
|
||||
void MulticamWidget::SetClip(ClipBlock *clip)
|
||||
void MulticamWidget::SetMulticamNode(ViewerOutput *viewer, MultiCamNode *n, ClipBlock *clip, const rational &time)
|
||||
{
|
||||
clip_ = clip;
|
||||
if (time == rational::NaN || time == GetTime()) {
|
||||
SetMulticamNodeInternal(viewer, n, clip);
|
||||
play_queue_.clear();
|
||||
} else {
|
||||
MulticamNodeQueue m = {time, viewer, n, clip};
|
||||
play_queue_.push_back(m);
|
||||
}
|
||||
}
|
||||
|
||||
void MulticamWidget::ConnectNodeEvent(ViewerOutput *n)
|
||||
@@ -83,6 +91,19 @@ void MulticamWidget::DisconnectNodeEvent(ViewerOutput *n)
|
||||
disconnect(n, &ViewerOutput::PixelAspectChanged, sizer_, &ViewerSizer::SetPixelAspectRatio);
|
||||
}
|
||||
|
||||
void MulticamWidget::TimeChangedEvent(const rational &t)
|
||||
{
|
||||
super::TimeChangedEvent(t);
|
||||
|
||||
if (!play_queue_.empty()) {
|
||||
const MulticamNodeQueue &m = play_queue_.front();
|
||||
if (m.time >= t) {
|
||||
SetMulticamNodeInternal(m.viewer, m.node, m.clip);
|
||||
play_queue_.pop_front();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MulticamWidget::Switch(int source, bool split_clip)
|
||||
{
|
||||
if (!node_) {
|
||||
@@ -112,13 +133,6 @@ void MulticamWidget::Switch(int source, bool split_clip)
|
||||
command->add_child(new NodeParamSetStandardValueCommand(NodeKeyframeTrackReference(NodeInput(cam, cam->kCurrentInput)), source));
|
||||
Core::instance()->undo_stack()->push(command);
|
||||
|
||||
if (cam != node_) {
|
||||
SetMulticamNode(cam);
|
||||
}
|
||||
if (clip != clip_) {
|
||||
SetClip(clip);
|
||||
}
|
||||
|
||||
display_->update();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,15 +35,16 @@ public:
|
||||
|
||||
MulticamDisplay *GetDisplayWidget() const { return display_; }
|
||||
|
||||
void SetMulticamNode(MultiCamNode *n);
|
||||
|
||||
void SetClip(ClipBlock *clip);
|
||||
void SetMulticamNode(ViewerOutput *viewer, MultiCamNode *n, ClipBlock *clip, const rational &time);
|
||||
|
||||
protected:
|
||||
virtual void ConnectNodeEvent(ViewerOutput *n) override;
|
||||
virtual void DisconnectNodeEvent(ViewerOutput *n) override;
|
||||
virtual void TimeChangedEvent(const rational &t) override;
|
||||
|
||||
private:
|
||||
void SetMulticamNodeInternal(ViewerOutput *viewer, MultiCamNode *n, ClipBlock *clip);
|
||||
|
||||
void Switch(int source, bool split_clip);
|
||||
|
||||
ViewerSizer *sizer_;
|
||||
@@ -54,6 +55,16 @@ private:
|
||||
|
||||
ClipBlock *clip_;
|
||||
|
||||
struct MulticamNodeQueue
|
||||
{
|
||||
rational time;
|
||||
ViewerOutput *viewer;
|
||||
MultiCamNode *node;
|
||||
ClipBlock *clip;
|
||||
};
|
||||
|
||||
std::list<MulticamNodeQueue> play_queue_;
|
||||
|
||||
private slots:
|
||||
void DisplayClicked(const QPoint &p);
|
||||
|
||||
|
||||
@@ -419,6 +419,11 @@ void ViewerWidget::StartCapture(TimelineWidget *source, const TimeRange &time, c
|
||||
recording_track_ = track;
|
||||
}
|
||||
|
||||
void ViewerWidget::ConnectMulticamWidget(MulticamWidget *p)
|
||||
{
|
||||
multicam_panel_ = p;
|
||||
}
|
||||
|
||||
FramePtr ViewerWidget::DecodeCachedImage(const QString &cache_path, const QUuid &cache_id, const int64_t& time)
|
||||
{
|
||||
FramePtr frame = FrameHashCache::LoadCacheFrame(cache_path, cache_id, time);
|
||||
@@ -646,11 +651,15 @@ void ViewerWidget::DetectMulticamNode(const rational &time)
|
||||
}
|
||||
|
||||
if (multicam) {
|
||||
emit MulticamNodeDetected(GetConnectedNode(), multicam, clip);
|
||||
if (multicam_panel_) {
|
||||
multicam_panel_->SetMulticamNode(GetConnectedNode(), multicam, clip, time);
|
||||
}
|
||||
auto_cacher()->SetMulticamNode(multicam);
|
||||
} else {
|
||||
auto_cacher()->SetMulticamNode(nullptr);
|
||||
emit MulticamNodeDetected(nullptr, nullptr, nullptr);
|
||||
if (multicam_panel_) {
|
||||
multicam_panel_->SetMulticamNode(nullptr, nullptr, nullptr, time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
class MulticamPanel;
|
||||
class MulticamWidget;
|
||||
|
||||
/**
|
||||
* @brief An OpenGL-based viewer widget with playback controls (a PlaybackControls widget).
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectMulticamPanel(MulticamPanel *p) { multicam_panel_ = p; }
|
||||
void ConnectMulticamWidget(MulticamWidget *p);
|
||||
|
||||
public slots:
|
||||
void Play(bool in_to_out_only);
|
||||
@@ -180,8 +180,6 @@ signals:
|
||||
*/
|
||||
void ColorManagerChanged(ColorManager* color_manager);
|
||||
|
||||
void MulticamNodeDetected(ViewerOutput *viewer, MultiCamNode *n, ClipBlock *clip);
|
||||
|
||||
protected:
|
||||
ViewerWidget(ViewerDisplayWidget *display, QWidget* parent = nullptr);
|
||||
|
||||
@@ -343,7 +341,7 @@ private:
|
||||
|
||||
QVector<Block*> timeline_selected_blocks_;
|
||||
|
||||
MulticamPanel *multicam_panel_;
|
||||
MulticamWidget *multicam_panel_;
|
||||
|
||||
private slots:
|
||||
void PlaybackTimerUpdate();
|
||||
|
||||
@@ -118,8 +118,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(PanelManager::instance(), &PanelManager::FocusedPanelChanged, this, &MainWindow::FocusedPanelChanged);
|
||||
|
||||
sequence_viewer_panel_->AddPlaybackDevice(multicam_panel_->GetMulticamWidget()->GetDisplayWidget());
|
||||
sequence_viewer_panel_->ConnectMulticamPanel(multicam_panel_);
|
||||
connect(sequence_viewer_panel_, &ViewerPanelBase::MulticamNodeDetected, multicam_panel_, &MulticamPanel::SetMulticamNode);
|
||||
sequence_viewer_panel_->ConnectMulticamWidget(multicam_panel_->GetMulticamWidget());
|
||||
|
||||
scope_panel_->SetViewerPanel(sequence_viewer_panel_);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user