]> git.sesse.net Git - ffmpeg/commitdiff
avutil/opt: add AV_OPT_FLAG_CHILD_CONSTS
authorMarton Balint <cus@passwd.hu>
Sun, 10 May 2020 17:54:51 +0000 (19:54 +0200)
committerMarton Balint <cus@passwd.hu>
Fri, 22 May 2020 20:16:52 +0000 (22:16 +0200)
This will be used for AVCodecContext->profile. By specifying constants in the
encoders we won't have to use the common AVCodecContext options table and
different encoders can use the same profile name even with different values.

Signed-off-by: Marton Balint <cus@passwd.hu>
doc/APIchanges
libavutil/opt.c
libavutil/opt.h
libavutil/version.h

index 208258be05cc028497a971b6c6f6eefd16da2e22..34ca7ec1bbbf18cac7796834de7034bbe8e9209a 100644 (file)
@@ -15,6 +15,9 @@ libavutil:     2017-10-21
 
 API changes, most recent first:
 
+2020-05-22 - xxxxxxxxxx - lavu 56.46.101 - opt.h
+  Add AV_OPT_FLAG_CHILD_CONSTS.
+
 2020-xx-xx - xxxxxxxxxx - lavc 58.87.100 - avcodec.h codec_par.h
   Move AVBitstreamFilter-related public API to new header bsf.h.
   Move AVCodecParameters-related public API to new header codec_par.h.
index b792dec01cb9bac73b2b272fcac0f264222c7817..423313bce2b3ea7051250cad72cacc5e4074e0a6 100644 (file)
@@ -256,11 +256,12 @@ static int set_string_number(void *obj, void *target_obj, const AVOption *o, con
         }
 
         {
-            const AVOption *o_named = av_opt_find(target_obj, i ? buf : val, o->unit, 0, 0);
             int res;
             int ci = 0;
             double const_values[64];
             const char * const_names[64];
+            int search_flags = (o->flags & AV_OPT_FLAG_CHILD_CONSTS) ? AV_OPT_SEARCH_CHILDREN : 0;
+            const AVOption *o_named = av_opt_find(target_obj, i ? buf : val, o->unit, 0, search_flags);
             if (o_named && o_named->type == AV_OPT_TYPE_CONST)
                 d = DEFAULT_NUMVAL(o_named);
             else {
index 1969c984dd46d5982fca422605f0b0e986bb47a8..e46119572aa6f8f967629ea79b8623727e57d607 100644 (file)
@@ -291,6 +291,7 @@ typedef struct AVOption {
 #define AV_OPT_FLAG_RUNTIME_PARAM   (1<<15) ///< a generic parameter which can be set by the user at runtime
 #define AV_OPT_FLAG_FILTERING_PARAM (1<<16) ///< a generic parameter which can be set by the user for filtering
 #define AV_OPT_FLAG_DEPRECATED      (1<<17) ///< set if option is deprecated, users should refer to AVOption.help text for more information
+#define AV_OPT_FLAG_CHILD_CONSTS    (1<<18) ///< set if option constants can also reside in child objects
 //FIXME think about enc-audio, ... style flags
 
     /**
index de53229068dc55d9771b03de2479db9d51e2e653..20085dfde96b2f661c3bda1c00f38bb43f5fed96 100644 (file)
@@ -80,7 +80,7 @@
 
 #define LIBAVUTIL_VERSION_MAJOR  56
 #define LIBAVUTIL_VERSION_MINOR  46
-#define LIBAVUTIL_VERSION_MICRO 100
+#define LIBAVUTIL_VERSION_MICRO 101
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
                                                LIBAVUTIL_VERSION_MINOR, \