aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-09-29 00:34:28 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2012-12-05 11:23:36 -0500
commit9d5c62ba5b586c80af508b5914934b1c439f6652 (patch)
tree0eee938af388e910075b4904fffcfa1ff82c044b /libavutil
parent5312268b34dc948e87934ae665a79a57c2fe2648 (diff)
downloadffmpeg-9d5c62ba5b586c80af508b5914934b1c439f6652.tar.gz
lavu/opt: do not filter out the initial sign character except for flags
This allows parsing of special-case negative numbers like decibels.
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/opt.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c
index d2cb9ef95a..e199170075 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -154,10 +154,15 @@ static int set_string_number(void *obj, const AVOption *o, const char *val, void
double d, num = 1;
int64_t intnum = 1;
- if (*val == '+' || *val == '-')
- cmd = *(val++);
+ i = 0;
+ if (*val == '+' || *val == '-') {
+ if (o->type == AV_OPT_TYPE_FLAGS)
+ cmd = *(val++);
+ else if (!notfirst)
+ buf[i++] = *val;
+ }
- for (i = 0; i < sizeof(buf) - 1 && val[i] && val[i] != '+' && val[i] != '-'; i++)
+ for (; i < sizeof(buf) - 1 && val[i] && val[i] != '+' && val[i] != '-'; i++)
buf[i] = val[i];
buf[i] = 0;