changeset 6853:9bfb69f1739e libavcodec

Anoter try to make +- behave sanely.
author michael
date Sat, 24 May 2008 12:58:20 +0000
parents 84dc84916bab
children d4c8338a09a8
files opt.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/opt.c	Sat May 24 12:33:00 2008 +0000
+++ b/opt.c	Sat May 24 12:58:20 2008 +0000
@@ -146,6 +146,7 @@
         return o;
     }
     if(o->type != FF_OPT_TYPE_STRING){
+        int notfirst=0;
         for(;;){
             int i;
             char buf[256];
@@ -180,8 +181,8 @@
                 if     (cmd=='+') d= av_get_int(obj, name, NULL) | (int64_t)d;
                 else if(cmd=='-') d= av_get_int(obj, name, NULL) &~(int64_t)d;
             }else{
-                if     (cmd=='+') d= av_get_double(obj, name, NULL) + d;
-                else if(cmd=='-') d= av_get_double(obj, name, NULL) - d;
+                if     (cmd=='+') d= notfirst*av_get_double(obj, name, NULL) + d;
+                else if(cmd=='-') d= notfirst*av_get_double(obj, name, NULL) - d;
             }
 
             if (!av_set_number(obj, name, d, 1, 1))
@@ -189,6 +190,7 @@
             val+= i;
             if(!*val)
                 return o;
+            notfirst=1;
         }
         return NULL;
     }