summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-04-09 23:43:00 +0100
committerCarl Hetherington <cth@carlh.net>2013-04-09 23:43:00 +0100
commitb66010a281acd3e3e58ef7202bce55023fc29d7f (patch)
treee23ee83991adef3577caf8dd605f5ce06d00704c /src/lib/ffmpeg_decoder.cc
parente94cd129dcd66a76210880bfdf19d27f7992651b (diff)
Merge ImageMagick and FFmpeg content into VideoContent list; remove seek_to_last hacks.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
-rw-r--r--src/lib/ffmpeg_decoder.cc16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index a0949f635..d0b1de748 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -518,22 +518,12 @@ FFmpegDecoder::filter_and_emit_video (AVFrame* frame)
bool
FFmpegDecoder::seek (double p)
{
- return do_seek (p, false);
-}
-
-bool
-FFmpegDecoder::seek_to_last ()
-{
- /* This AVSEEK_FLAG_BACKWARD in do_seek is a bit of a hack; without it, if we ask for a seek to the same place as last time
+ /* This use of AVSEEK_FLAG_BACKWARD is a bit of a hack; without it, if we ask for a seek to the same place as last time
(used when we change decoder parameters and want to re-fetch the frame) we end up going forwards rather than
staying in the same place.
*/
- return do_seek (last_source_time(), true);
-}
-
-bool
-FFmpegDecoder::do_seek (double p, bool backwards)
-{
+ bool const backwards = (p == last_content_time());
+
int64_t const vt = p / av_q2d (_format_context->streams[_video_stream]->time_base);
int const r = av_seek_frame (_format_context, _video_stream, vt, backwards ? AVSEEK_FLAG_BACKWARD : 0);