Some more fixes missing from 2704fe5.
authorCarl Hetherington <cth@carlh.net>
Thu, 28 Jul 2016 08:21:48 +0000 (09:21 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 28 Jul 2016 08:21:48 +0000 (09:21 +0100)
src/lib/ffmpeg.cc
src/lib/ffmpeg_decoder.cc

index 8c0f0798eb0742d7e1ddc388c39a451fafd437c8..bbf9bbed9405fb602b1fd2d69f69d408daa5fc00 100644 (file)
@@ -224,7 +224,10 @@ FFmpeg::setup_decoders ()
 AVCodecContext *
 FFmpeg::video_codec_context () const
 {
-       DCPOMATIC_ASSERT (_video_stream);
+       if (!_video_stream) {
+               return 0;
+       }
+
        return _format_context->streams[_video_stream.get()]->codec;
 }
 
index f7c435a7455a4ccb5993ce55da908749d5b468fe..a47cd405d38f47ae1ea1536b95a5d440bb989c77 100644 (file)
@@ -348,12 +348,14 @@ FFmpegDecoder::seek (ContentTime time, bool accurate)
        }
        av_seek_frame (
                _format_context,
-               _video_stream.get(),
-               u.seconds() / av_q2d (_format_context->streams[_video_stream.get()]->time_base),
+               stream.get(),
+               u.seconds() / av_q2d (_format_context->streams[stream.get()]->time_base),
                AVSEEK_FLAG_BACKWARD
                );
 
-       avcodec_flush_buffers (video_codec_context());
+       if (video_codec_context ()) {
+               avcodec_flush_buffers (video_codec_context());
+       }
 
        /* XXX: should be flushing audio buffers? */