Don't throw an exception if we can't find bits_per_pixel, as it's not the end of...
authorCarl Hetherington <cth@carlh.net>
Fri, 12 Jan 2018 00:27:16 +0000 (00:27 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 12 Jan 2018 00:27:16 +0000 (00:27 +0000)
src/lib/ffmpeg_examiner.cc
src/lib/ffmpeg_examiner.h

index 88b76d0..697bfe3 100644 (file)
@@ -260,11 +260,11 @@ FFmpegExaminer::stream_name (AVStream* s) const
        return n;
 }
 
-int
+optional<int>
 FFmpegExaminer::bits_per_pixel () const
 {
        if (video_codec_context()->pix_fmt == -1) {
-               throw DecodeError (_("Could not find pixel format for video."));
+               return optional<int>();
        }
 
        AVPixFmtDescriptor const * d = av_pix_fmt_desc_get (video_codec_context()->pix_fmt);
index a511a2f..5cd70d9 100644 (file)
@@ -69,7 +69,7 @@ public:
                return video_codec_context()->colorspace;
        }
 
-       int bits_per_pixel () const;
+       boost::optional<int> bits_per_pixel () const;
 
 private:
        void video_packet (AVCodecContext *);