Allow drag of content; fix up some problems with timings.
[dcpomatic.git] / src / lib / ffmpeg_decoder.cc
index b45ba8585f329b259fe1f2eb4d99bc3db28d2f63..799e89a38b50e79763a8c8817d8831ad27257bb0 100644 (file)
@@ -473,7 +473,6 @@ void
 FFmpegDecoder::do_seek (Time t, bool backwards, bool accurate)
 {
        int64_t const vt = t / (av_q2d (_format_context->streams[_video_stream]->time_base) * TIME_HZ);
-       cout << "seek-> " << t << "\n";
        av_seek_frame (_format_context, _video_stream, vt, backwards ? AVSEEK_FLAG_BACKWARD : 0);
 
        avcodec_flush_buffers (_video_codec_context);
@@ -617,5 +616,13 @@ FFmpegDecoder::decode_video_packet ()
 Time
 FFmpegDecoder::next () const
 {
-       return min (_next_video, _next_audio);
+       if (_decode_video && _decode_audio) {
+               return min (_next_video, _next_audio);
+       }
+
+       if (_decode_audio) {
+               return _next_audio;
+       }
+
+       return _next_video;
 }