diff options
author | Martin Storsjö <martin@martin.st> | 2011-05-27 22:21:40 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2011-06-10 10:47:42 +0300 |
commit | cb7c11cc9e7e05c819fff487a3f486f11ab4b860 (patch) | |
tree | 33df04b40062ce5cb443b9b24cc3b1feb75bff8f /libavutil/opt.c | |
parent | 0558e266a267b5d90d3be1d8d86e60db2c303773 (diff) | |
download | ffmpeg-cb7c11cc9e7e05c819fff487a3f486f11ab4b860.tar.gz |
avoptions: Add an av_opt_flag_is_set function for inspecting flag fields
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r-- | libavutil/opt.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c index 172fcec456..7775bb2af3 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -320,6 +320,16 @@ int64_t av_get_int(void *obj, const char *name, const AVOption **o_out) return num*intnum/den; } +int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name) +{ + const AVOption *field = av_find_opt(obj, field_name, NULL, 0, 0); + const AVOption *flag = av_find_opt(obj, flag_name, NULL, 0, 0); + + if (!field || !flag || flag->type != FF_OPT_TYPE_CONST) + return 0; + return av_get_int(obj, field_name, NULL) & (int) flag->default_val.dbl; +} + static void opt_list(void *obj, void *av_log_obj, const char *unit, int req_flags, int rej_flags) { |