[FFmpeg-cvslog] lavu/opt: do not filter out the initial sign character except for flags

Justin Ruggles git at videolan.org
Thu Dec 6 14:41:23 CET 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Sat Sep 29 00:34:28 2012 -0400| [9d5c62ba5b586c80af508b5914934b1c439f6652] | committer: Justin Ruggles

lavu/opt: do not filter out the initial sign character except for flags

This allows parsing of special-case negative numbers like decibels.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9d5c62ba5b586c80af508b5914934b1c439f6652
---

 libavutil/opt.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index d2cb9ef..e199170 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;
 



More information about the ffmpeg-cvslog mailing list