summaryrefslogtreecommitdiff
path: root/libavutil/opt.h
diff options
context:
space:
mode:
authorLukasz Marek <lukasz.m.luki2@gmail.com>2014-11-10 22:28:44 +0100
committerLukasz Marek <lukasz.m.luki2@gmail.com>2014-11-16 01:13:38 +0100
commitbee5844ddd4efc771a85caf6168d79abe42769a2 (patch)
tree16da64c5f40a2032c684af9fae26ba0965f11f04 /libavutil/opt.h
parenteec693328a09f0dc6cbe398c199d093405ba7cf9 (diff)
lavu/opt: introduce av_opt_serialize()
Function allows to create string containing object's serialized options. Such string may be passed back to av_set_options_string() in order to restore options. Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Diffstat (limited to 'libavutil/opt.h')
-rw-r--r--libavutil/opt.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 1b458e1860..7338e78368 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -869,6 +869,27 @@ int av_opt_is_set_to_default(void *obj, const AVOption *o);
*/
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.
+ *
+ * @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
+ */
+int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer,
+ const char key_val_sep, const char pairs_sep);
/**
* @}
*/