From c765c968070d20485bb6ad8b18c12033a590e67a Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 30 Apr 2021 11:24:17 +1000 Subject: [PATCH] footage: fix bug with loop mode that prevented stills from showing --- app/node/project/footage/footage.cpp | 9 +++++++-- app/node/project/footage/footage.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/node/project/footage/footage.cpp b/app/node/project/footage/footage.cpp index bebf8795e..1070bc0bc 100644 --- a/app/node/project/footage/footage.cpp +++ b/app/node/project/footage/footage.cpp @@ -350,7 +350,7 @@ void Footage::Hash(const QString& output, QCryptographicHash &hash, const ration // Footage timestamp if (params.video_type() != VideoParams::kVideoTypeStill) { - rational adjusted_time = AdjustTimeByLoopMode(time, loop_mode(), GetLength()); + rational adjusted_time = AdjustTimeByLoopMode(time, loop_mode(), GetLength(), params.video_type()); if (!adjusted_time.isNaN()) { int64_t video_ts = Timecode::time_to_timestamp(adjusted_time, params.time_base()); @@ -446,8 +446,13 @@ bool TimeIsOutOfBounds(const rational& time, const rational& length) return time < 0 || time >= length; } -rational Footage::AdjustTimeByLoopMode(rational time, Footage::LoopMode loop_mode, const rational &length) +rational Footage::AdjustTimeByLoopMode(rational time, Footage::LoopMode loop_mode, const rational &length, VideoParams::Type type) { + if (type == VideoParams::kVideoTypeStill) { + // No looping for still images + return 0; + } + if (TimeIsOutOfBounds(time, length)) { switch (loop_mode) { case kLoopModeOff: diff --git a/app/node/project/footage/footage.h b/app/node/project/footage/footage.h index 1d45dbc04..749f72496 100644 --- a/app/node/project/footage/footage.h +++ b/app/node/project/footage/footage.h @@ -191,7 +191,7 @@ public: virtual NodeOutput GetConnectedSampleOutput() override; - static rational AdjustTimeByLoopMode(rational time, LoopMode loop_mode, const rational& length); + static rational AdjustTimeByLoopMode(rational time, LoopMode loop_mode, const rational& length, VideoParams::Type type); static const QString kFilenameInput; static const QString kLoopModeInput;