diff options
Diffstat (limited to 'libavutil/opt.h')
-rw-r--r-- | libavutil/opt.h | 62 |
1 files changed, 60 insertions, 2 deletions
diff --git a/libavutil/opt.h b/libavutil/opt.h index e402f6a0a0..77797b3fbe 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -253,6 +253,17 @@ enum AVOptionType{ #endif AV_OPT_TYPE_BOOL, AV_OPT_TYPE_CHLAYOUT, + + /** + * May be combined with another regular option type to declare an array + * option. + * + * For array options, @ref AVOption.offset should refer to a pointer + * corresponding to the option type. The pointer should be immediately + * followed by an unsigned int that will store the number of elements in the + * array. + */ + AV_OPT_TYPE_FLAG_ARRAY = (1 << 16), }; /** @@ -299,6 +310,46 @@ enum AVOptionType{ #define AV_OPT_FLAG_CHILD_CONSTS (1 << 18) /** + * Must be set as default_val for AV_OPT_TYPE_FLAG_ARRAY options. + */ +typedef struct AVOptionArrayDef { + /** + * Must be set to sizeof(AVOptionArrayDef), in order to allow extending this + * struct without breaking ABI. + */ + size_t sizeof_self; + + /** + * Native access only. + * + * Default value of the option, as would be serialized by av_opt_get() (i.e. + * using the value of sep as the separator). + */ + const char *def; + + /** + * Minimum number of elements in the array. When this field is non-zero, def + * must be non-NULL and contain at least this number of elements. + */ + unsigned size_min; + /** + * Maximum number of elements in the array, 0 when unlimited. + */ + unsigned size_max; + + /** + * Separator between array elements in string representations of this + * option, used by av_opt_set() and av_opt_get(). It must be a printable + * ASCII character, excluding alphanumeric and the backslash. A comma is + * used when sep=0. + * + * The separator and the backslash must be backslash-escaped in order to + * appear in string representations of the option value. + */ + uint8_t sep; +} AVOptionArrayDef; + +/** * AVOption */ typedef struct AVOption { @@ -320,8 +371,7 @@ typedef struct AVOption { enum AVOptionType type; /** - * Native access only. - * + * Native access only, except when documented otherwise. * the default value for scalar options */ union { @@ -330,6 +380,14 @@ typedef struct AVOption { const char *str; /* TODO those are unused now */ AVRational q; + + /** + * Used for AV_OPT_TYPE_FLAG_ARRAY options. May be NULL. + * + * Foreign access to some members allowed, as noted in AVOptionArrayDef + * documentation. + */ + const AVOptionArrayDef *arr; } default_val; double min; ///< minimum valid value for the option double max; ///< maximum valid value for the option |