X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavutil%2Fopt.h;h=5fc8a9b58a39bcf8594bcd7cb68d941671dfe02c;hp=4905ee30c0451b4eb5aa24b78a7042873a16cdd3;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavutil/opt.h b/ffmpeg/libavutil/opt.h index 4905ee3..5fc8a9b 100644 --- a/ffmpeg/libavutil/opt.h +++ b/ffmpeg/libavutil/opt.h @@ -33,6 +33,7 @@ #include "log.h" #include "pixfmt.h" #include "samplefmt.h" +#include "version.h" /** * @defgroup avoptions AVOptions @@ -378,25 +379,6 @@ typedef struct AVOptionRanges { } AVOptionRanges; -#if FF_API_FIND_OPT -/** - * Look for an option in obj. Look only for the options which - * have the flags set as specified in mask and flags (that is, - * for which it is the case that (opt->flags & mask) == flags). - * - * @param[in] obj a pointer to a struct whose first element is a - * pointer to an AVClass - * @param[in] name the name of the option to look for - * @param[in] unit the unit of the option to look for, or any if NULL - * @return a pointer to the option found, or NULL if no option - * has been found - * - * @deprecated use av_opt_find. - */ -attribute_deprecated -const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); -#endif - #if FF_API_OLD_AVOPTIONS /** * Set the field of obj with the given name to value. @@ -435,7 +417,7 @@ 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); attribute_deprecated const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); -attribute_deprecated const AVOption *av_next_option(void *obj, const AVOption *last); +attribute_deprecated const AVOption *av_next_option(FF_CONST_AVUTIL55 void *obj, const AVOption *last); #endif /** @@ -475,7 +457,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags); * @return the number of successfully set key/value pairs, or a negative * value corresponding to an AVERROR code in case of error: * AVERROR(EINVAL) if opts cannot be parsed, - * the error code issued by av_set_string3() if a key/value pair + * the error code issued by av_opt_set() if a key/value pair * cannot be set */ int av_set_options_string(void *ctx, const char *opts, @@ -652,7 +634,7 @@ int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational * was found. * * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable - * directly with av_set_string3(). Use special calls which take an options + * directly with av_opt_set(). Use special calls which take an options * AVDictionary (e.g. avformat_open_input()) to set options found with this * flag. */ @@ -692,7 +674,7 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, * or NULL * @return next AVOption or NULL */ -const AVOption *av_opt_next(void *obj, const AVOption *prev); +const AVOption *av_opt_next(FF_CONST_AVUTIL55 void *obj, const AVOption *prev); /** * Iterate over AVOptions-enabled children of obj. @@ -834,7 +816,17 @@ void av_opt_freep_ranges(AVOptionRanges **ranges); */ int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags); -int av_opt_copy(void *dest, void *src); +/** + * Copy options from src object into dest object. + * + * Options that require memory allocation (e.g. string or binary) are malloc'ed in dest object. + * Original memory allocated for such options is freed unless both src and dest options points to the same memory. + * + * @param dest Object to copy from + * @param src Object to copy into + * @return 0 on success, negative on error + */ +int av_opt_copy(void *dest, FF_CONST_AVUTIL55 void *src); /** * Get a default list of allowed ranges for the given option. @@ -852,6 +844,56 @@ int av_opt_copy(void *dest, void *src); */ int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags); +/** + * Check if given option is set to its default value. + * + * Options o must belong to the obj. This function must not be called to check child's options state. + * @see av_opt_is_set_to_default_by_name(). + * + * @param obj AVClass object to check option on + * @param o option to be checked + * @return >0 when option is set to its default, + * 0 when option is not set its default, + * <0 on error + */ +int av_opt_is_set_to_default(void *obj, const AVOption *o); + +/** + * Check if given option is set to its default value. + * + * @param obj AVClass object to check option on + * @param name option name + * @param search_flags combination of AV_OPT_SEARCH_* + * @return >0 when option is set to its default, + * 0 when option is not set its default, + * <0 on error + */ +int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags); + + +#define AV_OPT_SERIALIZE_SKIP_DEFAULTS 0x00000001 ///< Serialize options that are not set to default values only. +#define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT 0x00000002 ///< Serialize options that exactly match opt_flags only. + +/** + * Serialize object's options. + * + * Create a string containing object's serialized options. + * Such string may be passed back to av_opt_set_from_string() in order to restore option values. + * A key/value or pairs separator occurring in the serialized value or + * name string are escaped through the av_escape() function. + * + * @param[in] obj AVClass object to serialize + * @param[in] opt_flags serialize options with all the specified flags set (AV_OPT_FLAG) + * @param[in] flags combination of AV_OPT_SERIALIZE_* flags + * @param[out] buffer Pointer to buffer that will be allocated with string containg serialized options. + * Buffer must be freed by the caller when is no longer needed. + * @param[in] key_val_sep character used to separate key from value + * @param[in] pairs_sep character used to separate two pairs from each other + * @return >= 0 on success, negative on error + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same. + */ +int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, + const char key_val_sep, const char pairs_sep); /** * @} */