viewer: keep track of viewer length

Useful for determining if the view should be updated from a length change.
This commit is contained in:
itsmattkc
2020-06-05 04:31:44 +10:00
parent 8051a42fcc
commit 2fd897c380
2 changed files with 13 additions and 2 deletions
+11 -2
View File
@@ -187,6 +187,7 @@ void ViewerWidget::ConnectNodeInternal(ViewerOutput *n)
SampleFormat::kInternalFormat));
SizeChangedSlot(n->video_params().width(), n->video_params().height());
last_length_ = rational();
LengthChangedSlot(n->GetLength());
ColorManager* using_manager;
@@ -1180,8 +1181,16 @@ void ViewerWidget::SizeChangedSlot(int width, int height)
void ViewerWidget::LengthChangedSlot(const rational &length)
{
controls_->SetEndTime(Timecode::time_to_timestamp(length, timebase()));
UpdateMinimumScale();
if (last_length_ != length) {
controls_->SetEndTime(Timecode::time_to_timestamp(length, timebase()));
UpdateMinimumScale();
if (length < last_length_ && GetTime() >= length) {
ForceUpdate();
}
last_length_ = length;
}
}
void ViewerWidget::SetDividerFromMenu(QAction *action)
+2
View File
@@ -249,6 +249,8 @@ private:
CacheTask* our_cache_background_task_;
rational last_length_;
static CacheTask* cache_background_task_;
static int busy_viewers_;