summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-12-16 12:18:08 +0000
committerCarl Hetherington <cth@carlh.net>2012-12-16 12:18:08 +0000
commit9c58fcdb6fd8131c17456dd71c5c277a6b0ae053 (patch)
treeb18c58859a4b2365be252253e47c578bb1c33bf7 /src/lib/ffmpeg_decoder.cc
parent6375f7268d0acd53c6dc7968e17a15471fba3a45 (diff)
Integrated FFmpeg player (slow).
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
-rw-r--r--src/lib/ffmpeg_decoder.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 74eb8934c..f4c7d3d85 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -584,6 +584,14 @@ FFmpegDecoder::filter_and_emit_video (AVFrame* frame)
}
}
+void
+FFmpegDecoder::seek (SourceFrame f)
+{
+ int64_t const t = static_cast<int64_t>(f) / (av_q2d (_format_context->streams[_video_stream]->time_base) * frames_per_second());
+ av_seek_frame (_format_context, _video_stream, t, 0);
+ avcodec_flush_buffers (_video_codec_context);
+}
+
shared_ptr<FFmpegAudioStream>
FFmpegAudioStream::create (string t, optional<int> v)
{
@@ -636,3 +644,4 @@ FFmpegAudioStream::to_string () const
return String::compose ("ffmpeg %1 %2 %3 %4", _id, _sample_rate, _channel_layout, _name);
}
+