Skip to content

Commit

Permalink
Enable first frame to start at 0
Browse files Browse the repository at this point in the history
Signed-off-by: Éloïse Brosseau <[email protected]>
  • Loading branch information
eloisebrosseau committed Dec 17, 2024
1 parent bc93220 commit e0175ac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
5 changes: 2 additions & 3 deletions src/lib/image/MovieFFMpeg/MovieFFMpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1331,9 +1331,8 @@ MovieFFMpegReader::getFirstFrame(AVRational rate)
// 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)));

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

0 comments on commit e0175ac

Please sign in to comment.