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 88b76d04efc9593e1fc3df632e292c4c19189174..697bfe3ae1a40b80851cf690f95eed703ca966a3 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 a511a2fc1fd20360eab70dbbffaeed4f7efa19bc..5cd70d979cd6722f22fdebc3a22bef7f28a64c12 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 *);