diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-07-08 10:03:58 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-07-08 10:03:58 +0100 |
| commit | 4a4ba8509f62a325d1074ec488b97b00922c6fc5 (patch) | |
| tree | 003238eebf758b4b3f791424c331fda622152ccd /src/lib/ffmpeg_decoder.cc | |
| parent | 1ffc5c24b2e1248e95b746100bb5c31fab360f25 (diff) | |
Conversion of frame index to FFmpeg time must always use the original or detected FFmpeg video frame rate.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 07f988e2b..f2d434e3b 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -334,7 +334,7 @@ FFmpegDecoder::seek (VideoContent::Frame frame, bool accurate) } /* Initial seek time in the stream's timebase */ - int64_t const initial_vt = ((initial / _ffmpeg_content->video_frame_rate()) - _pts_offset) / time_base; + int64_t const initial_vt = ((initial / _ffmpeg_content->original_video_frame_rate()) - _pts_offset) / time_base; av_seek_frame (_format_context, _video_stream, initial_vt, AVSEEK_FLAG_BACKWARD); @@ -375,7 +375,7 @@ FFmpegDecoder::seek (VideoContent::Frame frame, bool accurate) r = avcodec_decode_video2 (video_codec_context(), _frame, &finished, &_packet); if (r >= 0 && finished) { _video_position = rint ( - (av_frame_get_best_effort_timestamp (_frame) * time_base + _pts_offset) * _ffmpeg_content->video_frame_rate() + (av_frame_get_best_effort_timestamp (_frame) * time_base + _pts_offset) * _ffmpeg_content->original_video_frame_rate() ); if (_video_position >= (frame - 1)) { @@ -495,12 +495,12 @@ FFmpegDecoder::decode_video_packet () /* We just did a seek, so disable any attempts to correct for where we are / should be. */ - _video_position = rint (pts * _ffmpeg_content->video_frame_rate ()); + _video_position = rint (pts * _ffmpeg_content->original_video_frame_rate ()); _just_sought = false; } - double const next = _video_position / _ffmpeg_content->video_frame_rate(); - double const one_frame = 1 / _ffmpeg_content->video_frame_rate (); + double const next = _video_position / _ffmpeg_content->original_video_frame_rate(); + double const one_frame = 1 / _ffmpeg_content->original_video_frame_rate (); double delta = pts - next; while (delta > one_frame) { |
