[FFmpeg-cvslog] avutil/opt: factor set_string_video_rate() 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:04:38 2013 +0100| [758d4e4067f066fbe8ff9c3240d7748338cd8fad] | committer: Michael Niedermayer

avutil/opt: factor set_string_video_rate() out

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

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

 libavutil/opt.c |   23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 107be6a..bf82d2d 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -267,6 +267,19 @@ static int set_string_image_size(void *obj, const AVOption *o, const char *val,
     return ret;
 }
 
+static int set_string_video_rate(void *obj, const AVOption *o, const char *val, AVRational *dst)
+{
+    int ret;
+    if (!val) {
+        ret = AVERROR(EINVAL);
+    } else {
+        ret = av_parse_video_rate(dst, val);
+    }
+    if (ret < 0)
+        av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as video rate\n", val);
+    return ret;
+}
+
 #if FF_API_OLD_AVOPTIONS
 int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out)
 {
@@ -302,15 +315,7 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
     case AV_OPT_TYPE_DOUBLE:
     case AV_OPT_TYPE_RATIONAL: return set_string_number(obj, target_obj, o, val, dst);
     case AV_OPT_TYPE_IMAGE_SIZE: return set_string_image_size(obj, o, val, dst);
-    case AV_OPT_TYPE_VIDEO_RATE:
-        if (!val) {
-            ret = AVERROR(EINVAL);
-        } else {
-            ret = av_parse_video_rate(dst, val);
-        }
-        if (ret < 0)
-            av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as video rate\n", val);
-        return ret;
+    case AV_OPT_TYPE_VIDEO_RATE: return set_string_video_rate(obj, o, val, dst);
     case AV_OPT_TYPE_PIXEL_FMT:
         if (!val || !strcmp(val, "none")) {
             ret = AV_PIX_FMT_NONE;



More information about the ffmpeg-cvslog mailing list