summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-07-28 09:21:48 +0100
committerCarl Hetherington <cth@carlh.net>2016-07-28 09:21:48 +0100
commit6ec390c3a6259848cb6a85ee5dfda79f76161942 (patch)
tree987960273cb4ee19620961504f8d9e5132c20498 /src/lib
parentaf122f0f10c23e81a5d1de2ea11112a0e998aa5a (diff)
Some more fixes missing from 2704fe5.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ffmpeg.cc5
-rw-r--r--src/lib/ffmpeg_decoder.cc8
2 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc
index 8c0f0798e..bbf9bbed9 100644
--- a/src/lib/ffmpeg.cc
+++ b/src/lib/ffmpeg.cc
@@ -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;
}
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index f7c435a74..a47cd405d 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -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? */