Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/lib/image/MovieFFMpeg/MovieFFMpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ extern "C" {
//#include <libavcodec/ass_split.h>
}

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 {

Expand Down Expand Up @@ -1330,10 +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.
//

m_formatStartFrame = max(int64_t(0), int64_t(0.49 + av_q2d(rate) *
double(m_avFormatContext->start_time) / double(AV_TIME_BASE)));
int64_t firstFrame = max(int64_t(m_formatStartFrame), int64_t(1));

int64_t firstFrame = std::max(static_cast<int64_t>(0), static_cast<int64_t>(0.49 + av_q2d(rate) *
static_cast<double>(m_avFormatContext->start_time) / static_cast<double>(AV_TIME_BASE)));
if (evStartFrameAtOne.getValue())
{
firstFrame = max(int64_t(m_formatStartFrame), int64_t(1));
Copy link
Contributor

@bernie-laberge bernie-laberge Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I am wrong but the m_formatStartFrame is no longer initialized right ? (with or without the new env var)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Is the variable still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not needed anymore, but I did not update the code since I'm not sure we still need the changes from this PR. This was first done to try to fix an issue with Live Review in a web to RV session that has since been fixed from the web side. I kept this PR open in the meantime, but I think it might be fine to close it and let RV have its first frame at 1 since it is now able to set it to 0 when that's the value sent by the ReviewApp without changing anything.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we could close it and we can always re-open it if we realize we need it.

}

for (int i = 0; i < m_avFormatContext->nb_streams; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ip/IPBaseNodes/StackIPNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ StackIPNode::computeRanges()

m_info.cutIn = m_info.start;
m_info.cutOut = m_info.end;
m_offset = m_info.start - 1;
m_offset = std::max(m_info.start - 1, 0);

if (m_outputFPS->front() == 0.0 && !m_rangeInfos.empty() && ! m_rangeInfos[0].isUndiscovered)
{
Expand Down
24 changes: 12 additions & 12 deletions src/lib/ip/IPCore/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,14 @@ Session::Session(IPGraph* graph)
m_waitForUploadThreadPrefetch(false),
m_readingGTO(false),
m_sessionType(SequenceSession),
m_rangeStart(1),
m_rangeEnd(2),
m_rangeStart(0),
m_rangeEnd(1),
m_outputVideoDevice(0),
m_controlVideoDevice(0),
m_narrowedRangeStart(1),
m_narrowedRangeEnd(2),
m_inPoint(1),
m_outPoint(2),
m_narrowedRangeStart(0),
m_narrowedRangeEnd(1),
m_inPoint(0),
m_outPoint(1),
m_notPersistent(0),
m_inc(1),
//m_loadingError(false),
Expand All @@ -336,7 +336,7 @@ Session::Session(IPGraph* graph)
m_overhead(0),
m_shift(0),
m_skipped(0),
m_frame(1),
m_frame(0),
m_fastStart(true),
m_bufferWait(false),
m_latencyWait(false),
Expand Down Expand Up @@ -1706,11 +1706,11 @@ Session::clear()
graph().flushAudioCache();
if (!m_beingDeleted) graph().reset(App()->videoModules());
setFileName("Untitled");
setInPoint(1);
setOutPoint(2);
setRangeStart(1);
setRangeEnd(2);
setFrameInternal(1);
setInPoint(0);
setOutPoint(1);
setRangeStart(0);
setRangeEnd(1);
setFrameInternal(0);

if (!m_beingDeleted)
{
Expand Down
Loading