]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/opt.c
Remove misplaced Doxygen comment.
[ffmpeg] / libavcodec / opt.c
index c7218296f6bf23ac7e1a9022b0f0cbd5b328adc5..128d95d1ce63c9247988e57f967c85427a44b062 100644 (file)
  */
 
 /**
- * @file libavcodec/opt.c
+ * @file
  * AVOptions
  * @author Michael Niedermayer <michaelni@gmx.at>
  */
 
 #include "avcodec.h"
 #include "opt.h"
-#include "eval.h"
+#include "libavutil/eval.h"
 
 //FIXME order them and do a bin search
 const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mask, int flags){
@@ -112,10 +112,8 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons
     const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
     if (o_out)
         *o_out = o;
-    if(!o) {
-        av_log(obj, AV_LOG_ERROR, "Unknown option '%s'\n", name);
+    if(!o)
         return AVERROR(ENOENT);
-    }
     if(!val || o->offset<=0)
         return AVERROR(EINVAL);
 
@@ -149,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++);
@@ -158,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_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;
@@ -169,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);
-                    return AVERROR(EINVAL);
+                    int res = av_parse_and_eval_expr(&d, buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj);
+                    if (res < 0) {
+                        av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val);
+                        return res;
+                    }
                 }
             }
             if(o->type == FF_OPT_TYPE_FLAGS){
@@ -426,7 +424,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
             break;
             case FF_OPT_TYPE_INT64:
                 if((double)(opt->default_val+0.6) == opt->default_val)
-                    av_log(s, AV_LOG_DEBUG, "loss of precission in default of %s\n", opt->name);
+                    av_log(s, AV_LOG_DEBUG, "loss of precision in default of %s\n", opt->name);
                 av_set_int(s, opt->name, opt->default_val);
             break;
             case FF_OPT_TYPE_FLOAT: {