[FFmpeg-cvslog] avutil/opt: factor set_string_image_size() 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:01:38 2013 +0100| [9648c4fe9c24c1afada8e0e37c1317f5e906905a] | committer: Michael Niedermayer
avutil/opt: factor set_string_image_size() out
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9648c4fe9c24c1afada8e0e37c1317f5e906905a
---
libavutil/opt.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 46f60aa..107be6a 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -252,6 +252,21 @@ static int set_string_number(void *obj, void *target_obj, const AVOption *o, con
return 0;
}
+static int set_string_image_size(void *obj, const AVOption *o, const char *val, int *dst)
+{
+ int ret;
+
+ if (!val || !strcmp(val, "none")) {
+ dst[0] =
+ dst[1] = 0;
+ return 0;
+ }
+ ret = av_parse_video_size(dst, dst + 1, val);
+ if (ret < 0)
+ av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as image size\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)
{
@@ -286,15 +301,7 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
case AV_OPT_TYPE_FLOAT:
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:
- if (!val || !strcmp(val, "none")) {
- *(int *)dst = *((int *)dst + 1) = 0;
- return 0;
- }
- ret = av_parse_video_size(dst, ((int *)dst) + 1, val);
- if (ret < 0)
- av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as image size\n", val);
- return ret;
+ 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);
More information about the ffmpeg-cvslog
mailing list