diff --git a/app/node/output/viewer/viewer.cpp b/app/node/output/viewer/viewer.cpp index 3543e6fdd..785764422 100644 --- a/app/node/output/viewer/viewer.cpp +++ b/app/node/output/viewer/viewer.cpp @@ -258,11 +258,6 @@ QVector ViewerOutput::inputs_for_output(const QString &output) const return inputs; } -const rational& ViewerOutput::GetLength() const -{ - return last_length_; -} - QVector ViewerOutput::GetEnabledStreamsAsReferences() const { QVector refs; @@ -303,21 +298,21 @@ void ViewerOutput::Retranslate() void ViewerOutput::VerifyLength() { - rational video_length, audio_length, subtitle_length; + rational subtitle_length; - video_length = VerifyLengthInternal(Track::kVideo); + video_length_ = VerifyLengthInternal(Track::kVideo); if (cache_enabled_) { - video_frame_cache_.SetLength(video_length); + video_frame_cache_.SetLength(video_length_); } - audio_length = VerifyLengthInternal(Track::kAudio); + audio_length_ = VerifyLengthInternal(Track::kAudio); if (cache_enabled_) { - audio_playback_cache_.SetLength(audio_length); + audio_playback_cache_.SetLength(audio_length_); } subtitle_length = VerifyLengthInternal(Track::kSubtitle); - rational real_length = qMax(subtitle_length, qMax(video_length, audio_length)); + rational real_length = qMax(subtitle_length, qMax(video_length_, audio_length_)); if (real_length != last_length_) { last_length_ = real_length; diff --git a/app/node/output/viewer/viewer.h b/app/node/output/viewer/viewer.h index a7fc6dc06..8780c17b5 100644 --- a/app/node/output/viewer/viewer.h +++ b/app/node/output/viewer/viewer.h @@ -111,7 +111,9 @@ public: VideoParams GetFirstEnabledVideoStream() const; AudioParams GetFirstEnabledAudioStream() const; - const rational &GetLength() const; + const rational &GetLength() const { return last_length_; } + const rational &GetVideoLength() const { return video_length_; } + const rational &GetAudioLength() const { return audio_length_; } FrameHashCache* video_frame_cache() { @@ -192,6 +194,8 @@ protected: private: rational last_length_; + rational video_length_; + rational audio_length_; FrameHashCache video_frame_cache_; diff --git a/app/widget/viewer/viewer.cpp b/app/widget/viewer/viewer.cpp index 226405287..4e924198a 100644 --- a/app/widget/viewer/viewer.cpp +++ b/app/widget/viewer/viewer.cpp @@ -594,7 +594,7 @@ QString ViewerWidget::GetCachedFilenameFromTime(const rational &time) bool ViewerWidget::FrameExistsAtTime(const rational &time) { - return GetConnectedNode() && time >= 0 && time < GetConnectedNode()->video_frame_cache()->GetLength(); + return GetConnectedNode() && time >= 0 && time < GetConnectedNode()->GetVideoLength(); } void ViewerWidget::SetDisplayImage(FramePtr frame, bool main_only)