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 46e93b1..5ca05dd 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;
 }