summaryrefslogtreecommitdiff
path: root/libavutil/rational.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-10-04 13:41:01 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-10-04 13:41:01 +0000
commit6b4ed22f7512056f47bc7f39cd16bbbb83b2781d (patch)
treea035682ce9a76f2cba4194018c96717cd7965ad3 /libavutil/rational.c
parent9276bdddca3dba697ffead22ce591657b7b33e24 (diff)
downloadffmpeg-6b4ed22f7512056f47bc7f39cd16bbbb83b2781d.tar.gz
Make av_d2q() manage the case in which the value to convert is inf.
Originally committed as revision 25332 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/rational.c')
-rw-r--r--libavutil/rational.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavutil/rational.c b/libavutil/rational.c
index efed674a32..a82bc84ad4 100644
--- a/libavutil/rational.c
+++ b/libavutil/rational.c
@@ -100,6 +100,8 @@ AVRational av_d2q(double d, int max){
int64_t den;
if (isnan(d))
return (AVRational){0,0};
+ if (isinf(d))
+ return (AVRational){ d<0 ? -1:1, 0 };
exponent = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0);
den = 1LL << (61 - exponent);
av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max);