]> git.sesse.net Git - x264/commitdiff
param_parse: Fix framerate rounding issues
authorHenrik Gramner <henrik@gramner.com>
Sun, 26 Jul 2015 22:08:31 +0000 (00:08 +0200)
committerHenrik Gramner <henrik@gramner.com>
Sun, 26 Jul 2015 22:08:31 +0000 (00:08 +0200)
common/common.c

index 3153c7eb9647c17d40084e63f3048652889c9798..273334a1229d1bec618f66048f841df19b0242a4 100644 (file)
@@ -703,14 +703,12 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value )
     }
     OPT("fps")
     {
-        if( sscanf( value, "%u/%u", &p->i_fps_num, &p->i_fps_den ) == 2 )
-            ;
-        else
+        if( sscanf( value, "%u/%u", &p->i_fps_num, &p->i_fps_den ) != 2 )
         {
-            float fps = atof(value);
-            if( fps > 0 && fps <= INT_MAX/1000 )
+            double fps = atof(value);
+            if( fps > 0.0 && fps <= INT_MAX/1000.0 )
             {
-                p->i_fps_num = (int)(fps * 1000 + .5);
+                p->i_fps_num = (int)(fps * 1000.0 + .5);
                 p->i_fps_den = 1000;
             }
             else