---
 libavutil/opt.c |   10 ++++++++++
 libavutil/opt.h |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 4e25918..db084eb 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_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)
+        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)
 {
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 6668139..4e9b6ce 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -140,6 +140,7 @@ const AVOption *av_set_int(void *obj, const char *name, 
int64_t n);
 double av_get_double(void *obj, const char *name, const AVOption **o_out);
 AVRational av_get_q(void *obj, const char *name, const AVOption **o_out);
 int64_t av_get_int(void *obj, const char *name, const AVOption **o_out);
+int av_flag_is_set(void *obj, const char *field_name, const char *flag_name);
 const char *av_get_string(void *obj, const char *name, const AVOption **o_out, 
char *buf, int buf_len);
 const AVOption *av_next_option(void *obj, const AVOption *last);
 
-- 
1.7.3.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to