[Ffmpeg-devel] [PATCH] Use ff_eval for AVOption parsing

Panagiotis Issaris takis.issaris
Tue Sep 26 17:55:24 CEST 2006


Hi,

Op dinsdag 26 september 2006 17:28, schreef M?ns Rullg?rd:
>[...]
> > The thing I'm changing is the replacement of strtod() with ff_eval() so more
> > complex expressions can be parsed. The strtod() function does _not_ output
> > anything if it can't parse the string it has been given. ff_eval() does, which
> > is why these messages are appearing.
> 
> I see.  Then the warning message should be silenced in these cases.
> Unfortunately, I can't immediately think of a nice clean way to do that.
Hm. Maybe, ... I'm thinking again of Michael Niedermayer's suggestion [1].

With his suggestion, maybe I could solve it like this:

@@ -129,7 +129,7 @@ AVOption *av_set_string(void *obj, const

-            d = ff_eval(buf, const_values, const_names, NULL, NULL, NULL, NULL, NULL);
+            d = ff_eval(buf, const_values, const_names, NULL, NULL, NULL, NULL, NULL, msg);
             if(isnan(d)) {
                 AVOption *o_named= find_opt(obj, buf, o->unit);
                 if(o_named && o_named->type == FF_OPT_TYPE_CONST)
@@ -137,7 +137,10 @@ AVOption *av_set_string(void *obj, const
                 else if(!strcmp(buf, "default")) d= o->default_val;
                 else if(!strcmp(buf, "max"    )) d= o->max;
                 else if(!strcmp(buf, "min"    )) d= o->min;
-                else return NULL;
+                else {
+                    av_log(NULL, AV_LOG_ERROR, msg);
+                    return NULL;
+                }
             }

This way, the message will _only_ be displayed if it is not a known legal value,
such as "default", "min", "max" or one of the AVOption names.

With friendly regards,
Takis

[1] http://article.gmane.org/gmane.comp.video.ffmpeg.devel/37355




More information about the ffmpeg-devel mailing list