summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2020-05-10 19:54:51 +0200
committerMarton Balint <cus@passwd.hu>2020-05-22 22:16:52 +0200
commitaf9e622776c9268fd473cc23a0fd6b29f0017f64 (patch)
tree05e06f184d51dbca9a73ffd88def10bbb03920a1
parent638b5d51cf65b384e8632e650056ed0e62b16884 (diff)
avutil/opt: add AV_OPT_FLAG_CHILD_CONSTS
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>
-rw-r--r--doc/APIchanges3
-rw-r--r--libavutil/opt.c3
-rw-r--r--libavutil/opt.h1
-rw-r--r--libavutil/version.h2
4 files changed, 7 insertions, 2 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index 208258be05..34ca7ec1bb 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -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.
diff --git a/libavutil/opt.c b/libavutil/opt.c
index b792dec01c..423313bce2 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -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 {
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 1969c984dd..e46119572a 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -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
/**
diff --git a/libavutil/version.h b/libavutil/version.h
index de53229068..20085dfde9 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -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, \