From 9a0fbbe8461f70418881a807508bc9ca2aa0ffad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lo=C3=AFse=20Brosseau?= Date: Mon, 18 Nov 2024 10:35:56 -0500 Subject: [PATCH] Add evStartFrameAtOne to enable the old behaviour if necessary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Éloïse Brosseau --- src/lib/image/MovieFFMpeg/MovieFFMpeg.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/image/MovieFFMpeg/MovieFFMpeg.cpp b/src/lib/image/MovieFFMpeg/MovieFFMpeg.cpp index 4f4156fb2..3239d99d7 100644 --- a/src/lib/image/MovieFFMpeg/MovieFFMpeg.cpp +++ b/src/lib/image/MovieFFMpeg/MovieFFMpeg.cpp @@ -52,7 +52,10 @@ extern "C" { //#include } -static ENVVAR_BOOL( evUseUploadedMovieForStreaming, "RV_SHOTGRID_USE_UPLOADED_MOVIE_FOR_STREAMING", false ); +namespace { + ENVVAR_BOOL( evUseUploadedMovieForStreaming, "RV_SHOTGRID_USE_UPLOADED_MOVIE_FOR_STREAMING", false ); + ENVVAR_BOOL(evStartFrameAtOne, "RV_START_FRAME_AT_ONE", false); +} namespace TwkMovie { @@ -1330,9 +1333,13 @@ MovieFFMpegReader::getFirstFrame(AVRational rate) // format start time, then we have to assume that the source's start is // offset by the given positive value. // - + int64_t firstFrame = std::max(static_cast(0), static_cast(0.49 + av_q2d(rate) * static_cast(m_avFormatContext->start_time) / static_cast(AV_TIME_BASE))); + if (evStartFrameAtOne.getValue()) + { + firstFrame = max(int64_t(m_formatStartFrame), int64_t(1)); + } for (int i = 0; i < m_avFormatContext->nb_streams; i++) {