Fix bad default scale when sample aspect ratio is given as 0.
authorCarl Hetherington <cth@carlh.net>
Wed, 19 Nov 2014 14:31:25 +0000 (14:31 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 19 Nov 2014 14:31:25 +0000 (14:31 +0000)
src/lib/ffmpeg_examiner.cc

index 46e93b16c322e9d469635b9d5e82cee11f366f3c..5ca05dd55e780080b421b24c44a49cc694604e5f 100644 (file)
@@ -184,6 +184,10 @@ optional<float>
 FFmpegExaminer::sample_aspect_ratio () const
 {
        AVRational sar = av_guess_sample_aspect_ratio (_format_context, _format_context->streams[_video_stream], 0);
+       if (sar.num == 0) {
+               /* I assume this means that we don't know */
+               return optional<float> ();
+       }
        return float (sar.num) / sar.den;
 }