From 9d5c62ba5b586c80af508b5914934b1c439f6652 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sat, 29 Sep 2012 00:34:28 -0400 Subject: lavu/opt: do not filter out the initial sign character except for flags This allows parsing of special-case negative numbers like decibels. --- libavutil/opt.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'libavutil/opt.c') 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; -- cgit v1.2.3