summaryrefslogtreecommitdiff
path: root/libavutil/opt.h
diff options
context:
space:
mode:
authorAndrew Stone <andrew@clovar.com>2014-07-31 19:56:34 -0400
committerAnton Khirnov <anton@khirnov.net>2014-08-13 16:07:40 +0000
commita8c104a511f97e4ea617df73b31737e28a8a5126 (patch)
tree311c7da06d0705948f7f5872460104b02dd03974 /libavutil/opt.h
parentafbd4b7e093adf6d7a830b32759ca3ba8500363d (diff)
AVOption: add support for dictionary types.
In order to support metadata being set as an option, it's necessary to be able to set dictionaries as values. Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavutil/opt.h')
-rw-r--r--libavutil/opt.h31
1 files changed, 21 insertions, 10 deletions
diff --git a/libavutil/opt.h b/libavutil/opt.h
index b90feaad8f..ac722ee08c 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -224,6 +224,7 @@ enum AVOptionType{
AV_OPT_TYPE_STRING,
AV_OPT_TYPE_RATIONAL,
AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length
+ AV_OPT_TYPE_DICT,
AV_OPT_TYPE_CONST = 128,
};
@@ -325,7 +326,7 @@ int av_set_options_string(void *ctx, const char *opts,
const char *key_val_sep, const char *pairs_sep);
/**
- * Free all string and binary options in obj.
+ * Free all allocated objects in obj.
*/
void av_opt_free(void *obj);
@@ -491,11 +492,16 @@ const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *pre
* AVERROR(ERANGE) if the value is out of range
* AVERROR(EINVAL) if the value is not valid
*/
-int av_opt_set (void *obj, const char *name, const char *val, int search_flags);
-int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags);
-int av_opt_set_double(void *obj, const char *name, double val, int search_flags);
-int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags);
-int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags);
+int av_opt_set (void *obj, const char *name, const char *val, int search_flags);
+int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags);
+int av_opt_set_double (void *obj, const char *name, double val, int search_flags);
+int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags);
+int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags);
+/**
+ * @note Any old dictionary present is discarded and replaced with a copy of the new one. The
+ * caller still owns val is and responsible for freeing it.
+ */
+int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags);
/**
* @}
*/
@@ -515,10 +521,15 @@ int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size,
/**
* @note the returned string will av_malloc()ed and must be av_free()ed by the caller
*/
-int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val);
-int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val);
-int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val);
-int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val);
+int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val);
+int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val);
+int av_opt_get_double (void *obj, const char *name, int search_flags, double *out_val);
+int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val);
+/**
+ * @param[out] out_val The returned dictionary is a copy of the actual value and must
+ * be freed with av_dict_free() by the caller
+ */
+int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val);
/**
* @}
* @}