aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/opt.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-05-24 12:58:20 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-05-24 12:58:20 +0000
commit9d2e6e84ceb10932713f8c1bdc11a0fa01de0fc1 (patch)
treee81bd9008a4acf22a4385329ec07ce7d0c5d0f1c /libavcodec/opt.c
parentebea1d7668c7468da3b243b2e6f695fdbbae0a48 (diff)
downloadffmpeg-9d2e6e84ceb10932713f8c1bdc11a0fa01de0fc1.tar.gz
Anoter try to make +- behave sanely.
Originally committed as revision 13281 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/opt.c')
-rw-r--r--libavcodec/opt.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/opt.c b/libavcodec/opt.c
index 70f2f3d91f..1b429ab160 100644
--- a/libavcodec/opt.c
+++ b/libavcodec/opt.c
@@ -146,6 +146,7 @@ const AVOption *av_set_string(void *obj, const char *name, const char *val){
return o;
}
if(o->type != FF_OPT_TYPE_STRING){
+ int notfirst=0;
for(;;){
int i;
char buf[256];
@@ -180,8 +181,8 @@ const AVOption *av_set_string(void *obj, const char *name, const char *val){
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 @@ const AVOption *av_set_string(void *obj, const char *name, const char *val){
val+= i;
if(!*val)
return o;
+ notfirst=1;
}
return NULL;
}