BugFix MediaPlayer first PTS used for rewind video

Also shows the gap in the video timeline
This commit is contained in:
Bruno Herbelin
2023-08-11 17:16:07 +02:00
parent 57154e5d0b
commit 1413490579
2 changed files with 10 additions and 0 deletions

View File

@@ -1495,6 +1495,9 @@ bool MediaPlayer::fill_frame(GstBuffer *buf, FrameStatus status)
// set the start position (i.e. pts of first frame we got)
if (timeline_.first() == GST_CLOCK_TIME_NONE) {
timeline_.setFirst(buf->pts);
// add a gap to show that before
if (buf->pts > 0 && !timeline_.gapAt( buf->pts ))
timeline_.addGap(0, buf->pts);
}
}
// full but invalid frame : will be deleted next iteration

View File

@@ -101,6 +101,7 @@ void Timeline::setStep(GstClockTime dt)
void Timeline::setTiming(TimeInterval interval, GstClockTime step)
{
timing_ = interval;
first_ = GST_CLOCK_TIME_NONE;
if (step != GST_CLOCK_TIME_NONE)
step_ = step;
}
@@ -113,6 +114,9 @@ GstClockTime Timeline::next(GstClockTime time) const
if (getGapAt(time, gap) && gap.is_valid())
next_time = gap.end;
if ( first_ != GST_CLOCK_TIME_NONE && next_time < first_ )
next_time = first_;
return next_time;
}
@@ -123,6 +127,9 @@ GstClockTime Timeline::previous(GstClockTime time) const
if (getGapAt(time, gap) && gap.is_valid())
prev_time = gap.begin;
if ( first_ != GST_CLOCK_TIME_NONE && prev_time < first_ )
prev_time = first_;
return prev_time;
}