Mercurial > libavcodec.hg
diff opt.c @ 11749:c6368258b694 libavcodec
Change eval API to take parent log context and log level offset.
this is based on stefanos work, especially all bugs are his fault ;)
author | michael |
---|---|
date | Wed, 19 May 2010 22:55:29 +0000 |
parents | ceffa0ca7596 |
children | 026edf66e3a9 |
line wrap: on
line diff
--- a/opt.c Wed May 19 20:48:29 2010 +0000 +++ b/opt.c Wed May 19 22:55:29 2010 +0000 @@ -147,7 +147,6 @@ char buf[256]; int cmd=0; double d; - const char *error = NULL; if(*val == '+' || *val == '-') cmd= *(val++); @@ -156,8 +155,7 @@ buf[i]= val[i]; buf[i]=0; - d = ff_parse_and_eval_expr(buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, &error); - if(isnan(d)) { + { const AVOption *o_named= av_find_opt(obj, buf, o->unit, 0, 0); if(o_named && o_named->type == FF_OPT_TYPE_CONST) d= o_named->default_val; @@ -167,9 +165,11 @@ else if(!strcmp(buf, "none" )) d= 0; else if(!strcmp(buf, "all" )) d= ~0; else { - if (error) - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\": %s\n", val, error); + d = ff_parse_and_eval_expr(buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj); + if (isnan(d)){ + av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val); return AVERROR(EINVAL); + } } } if(o->type == FF_OPT_TYPE_FLAGS){