changeset 1030:1aabcccb2efa libavformat

use av_d2q to parse frame rate
author bcoudurier
date Fri, 24 Mar 2006 15:47:44 +0000
parents 6ddc77441867
children 480c84af0f61
files utils.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Fri Mar 24 15:38:15 2006 +0000
+++ b/utils.c	Fri Mar 24 15:47:44 2006 +0000
@@ -2742,8 +2742,9 @@
     }
     else {
         /* Finally we give up and parse it as double */
-        *frame_rate_base = DEFAULT_FRAME_RATE_BASE; //FIXME use av_d2q()
-        *frame_rate = (int)(strtod(arg, 0) * (*frame_rate_base) + 0.5);
+        AVRational time_base = av_d2q(strtod(arg, 0), DEFAULT_FRAME_RATE_BASE);
+        *frame_rate_base = time_base.den;
+        *frame_rate = time_base.num;
     }
     if (!*frame_rate || !*frame_rate_base)
         return -1;