- if (_subtitle_codec_context) {
- avcodec_flush_buffers (_subtitle_codec_context);
- }
-}
-
-void
-FFmpegDecoder::seek (ContentTime time, bool accurate)
-{
- Decoder::seek (time, accurate);
-
- /* If we are doing an accurate seek, our initial shot will be 200ms (200 being
- a number plucked from the air) earlier than we want to end up. The loop below
- will hopefully then step through to where we want to be.
- */
-
- ContentTime pre_roll = accurate ? (0.2 * TIME_HZ) : 0;
- ContentTime initial_seek = time - pre_roll;
- if (initial_seek < 0) {
- initial_seek = 0;
- }
-
- /* Initial seek time in the video stream's timebase */
-
- seek_and_flush (initial_seek);
-
- if (!accurate) {
- /* That'll do */
- return;
- }
-
- int const N = minimal_run (boost::bind (&FFmpegDecoder::seek_overrun_finished, this, time, _1, _2));
-
- seek_and_flush (initial_seek);
- if (N > 0) {
- minimal_run (boost::bind (&FFmpegDecoder::seek_final_finished, this, N - 1, _3));