diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-08-23 15:02:25 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-10-12 16:51:16 +0200 |
commit | dca055be3ae1a79209051a3f581802e3d21b7ad5 (patch) | |
tree | bcf09253669fd1d4b03c94f33a3661a9b18d39e4 /libavutil/opt.c | |
parent | 059a037fbd0f0f6e47426f5c40ff315fca3e0099 (diff) | |
download | ffmpeg-dca055be3ae1a79209051a3f581802e3d21b7ad5.tar.gz |
AVOptions: add functions for evaluating option strings.
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r-- | libavutil/opt.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c index 08fba8bc0f..8af2ac223b 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -239,6 +239,21 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags) return AVERROR(EINVAL); } +#define OPT_EVAL_NUMBER(name, opttype, vartype)\ + int av_opt_eval_ ## name(void *obj, const AVOption *o, const char *val, vartype *name ## _out)\ + {\ + if (!o || o->type != opttype)\ + return AVERROR(EINVAL);\ + return set_string_number(obj, o, val, name ## _out);\ + } + +OPT_EVAL_NUMBER(flags, FF_OPT_TYPE_FLAGS, int) +OPT_EVAL_NUMBER(int, FF_OPT_TYPE_INT, int) +OPT_EVAL_NUMBER(int64, FF_OPT_TYPE_INT64, int64_t) +OPT_EVAL_NUMBER(float, FF_OPT_TYPE_FLOAT, float) +OPT_EVAL_NUMBER(double, FF_OPT_TYPE_DOUBLE, double) +OPT_EVAL_NUMBER(q, FF_OPT_TYPE_RATIONAL, AVRational) + static int set_number(void *obj, const char *name, double num, int den, int64_t intnum, int search_flags) { |