[FFmpeg-devel] [PATCH 06/21] Make av_set_string3() check in the list of named constants before to try to evaluate the string to set with ff_eval2().
Stefano Sabatini
stefano.sabatini-lala
Sun Apr 11 01:00:29 CEST 2010
Avoid a spurious log error message issued by a call to ff_eval2() in
the case where the string to set is a named constant.
---
libavcodec/opt.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavcodec/opt.c b/libavcodec/opt.c
index 04629b6..7a72c44 100644
--- a/libavcodec/opt.c
+++ b/libavcodec/opt.c
@@ -155,9 +155,7 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons
for(i=0; i<sizeof(buf)-1 && val[i] && val[i]!='+' && val[i]!='-'; i++)
buf[i]= val[i];
buf[i]=0;
-
- d = ff_eval2(buf, const_values, const_names, 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)
+ d = ff_eval2(buf, const_values, const_names, NULL, NULL, NULL, NULL, NULL, &error);
+ if (isnan(d)) {
av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\": %s\n", val, error);
- return AVERROR(EINVAL);
+ return AVERROR(EINVAL);
+ }
}
}
if(o->type == FF_OPT_TYPE_FLAGS){
--
1.7.0
More information about the ffmpeg-devel
mailing list