[FFmpeg-cvslog] avutil/opt: factor set_string_color() out

Michael Niedermayer git at videolan.org
Sat Dec 7 14:19:29 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Dec  7 13:09:33 2013 +0100| [0aedf90e62a828c84a6efe3497ab7438aae8bf2f] | committer: Michael Niedermayer

avutil/opt: factor set_string_color() out

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavutil/opt.c |   26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index bf82d2d..76959fa 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -280,6 +280,21 @@ static int set_string_video_rate(void *obj, const AVOption *o, const char *val,
     return ret;
 }
 
+static int set_string_color(void *obj, const AVOption *o, const char *val, uint8_t *dst)
+{
+    int ret;
+
+    if (!val) {
+        return 0;
+    } else {
+        ret = av_parse_color(dst, val, -1, obj);
+        if (ret < 0)
+            av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as color\n", val);
+        return ret;
+    }
+    return 0;
+}
+
 #if FF_API_OLD_AVOPTIONS
 int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out)
 {
@@ -358,16 +373,7 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
             return ret;
         }
         break;
-    case AV_OPT_TYPE_COLOR:
-        if (!val) {
-            return 0;
-        } else {
-            ret = av_parse_color(dst, val, -1, obj);
-            if (ret < 0)
-                av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as color\n", val);
-            return ret;
-        }
-        break;
+    case AV_OPT_TYPE_COLOR:      return set_string_color(obj, o, val, dst);
     case AV_OPT_TYPE_CHANNEL_LAYOUT:
         if (!val || !strcmp(val, "none")) {
             *(int64_t *)dst = 0;



More information about the ffmpeg-cvslog mailing list