summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-02-18 13:52:41 +0000
committerCarl Hetherington <cth@carlh.net>2016-02-18 13:52:41 +0000
commit48e56e1c8b9343ae84ddcda8bab795f763d2d544 (patch)
tree0c9b66ff9b7fe10f99cc1551571b594645d3c7c6 /src
parentda3dd9df4287cbaf2f015a88484a7b5944ba2f3f (diff)
Fix crash when FFmpeg doesn't recognise a file's pixel format.
Diffstat (limited to 'src')
-rw-r--r--src/lib/ffmpeg_examiner.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc
index dacc652bb..29cc69063 100644
--- a/src/lib/ffmpeg_examiner.cc
+++ b/src/lib/ffmpeg_examiner.cc
@@ -353,7 +353,13 @@ FFmpegExaminer::stream_name (AVStream* s) const
int
FFmpegExaminer::bits_per_pixel () const
{
- return av_get_bits_per_pixel (av_pix_fmt_desc_get (video_codec_context()->pix_fmt));
+ if (video_codec_context()->pix_fmt == -1) {
+ throw DecodeError (_("Could not find pixel format for video."));
+ }
+
+ AVPixFmtDescriptor const * d = av_pix_fmt_desc_get (video_codec_context()->pix_fmt);
+ DCPOMATIC_ASSERT (d);
+ return av_get_bits_per_pixel (d);
}
bool