aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2010-05-24 02:27:43 +0000
committerDiego Biurrun <diego@biurrun.de>2010-05-24 02:27:43 +0000
commit0b374e40b1df87d21c6870e998849dd51027c637 (patch)
tree25a754b1f6bc3629577349a91f3005ed69f8ad08
parenta2a26d108b9ef0689493387c7058032e4245b74d (diff)
downloadffmpeg-0b374e40b1df87d21c6870e998849dd51027c637.tar.gz
Convert NaN to 0/0 in av_d2q
This fixes aspect ratio calculation for encoding from files with 0/0 stored, common with ogg/theora backport r23280 by conrad Originally committed as revision 23283 to svn://svn.ffmpeg.org/ffmpeg/branches/0.6
-rw-r--r--libavutil/rational.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavutil/rational.c b/libavutil/rational.c
index 3217b7daeb..3e8b885d49 100644
--- a/libavutil/rational.c
+++ b/libavutil/rational.c
@@ -98,6 +98,8 @@ AVRational av_d2q(double d, int max){
#define LOG2 0.69314718055994530941723212145817656807550013436025
int exponent= FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0);
int64_t den= 1LL << (61 - exponent);
+ if (isnan(d))
+ return (AVRational){0,0};
av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max);
return a;