Change eval API to take parent log context and log level offset.

this is based on stefanos work, especially all bugs are his fault ;)

Originally committed as revision 23201 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer
2010-05-19 22:55:29 +00:00
parent 4880cfd952
commit 2b65bb45b5
4 changed files with 30 additions and 23 deletions

View File

@@ -147,7 +147,6 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons
char buf[256];
int cmd=0;
double d;
const char *error = NULL;
if(*val == '+' || *val == '-')
cmd= *(val++);
@@ -156,8 +155,7 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons
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 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons
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){