summaryrefslogtreecommitdiff
path: root/libavutil/opt.h
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-11-02 11:55:53 +0100
committerNicolas George <nicolas.george@normalesup.org>2012-11-04 10:47:52 +0100
commit3bdf4971bab4d6f945035c42c551f76bf426d29b (patch)
treed98ab3fa3d1ef1eed919e2558539bd1b6e5df26a /libavutil/opt.h
parente021eeb9f06f4f4d83690d07b47cdcc4172a61e1 (diff)
lavu/opt: implement av_opt_get_key_value().
This function does the low-level work of av_opt_set_from_string() but can be used when there is no option context or when a generic handling of unknown keys is needed. av_opt_set_from_string() is changed to make use of it.
Diffstat (limited to 'libavutil/opt.h')
-rw-r--r--libavutil/opt.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 5d2031a54a..4a3b7f513a 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -456,6 +456,38 @@ int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
int av_opt_set_dict(void *obj, struct AVDictionary **options);
/**
+ * Extract a key-value pair from the beginning of a string.
+ *
+ * @param ropts pointer to the options string, will be updated to
+ * point to the rest of the string
+ * @param key_val_sep a 0-terminated list of characters used to separate
+ * key from value, for example '='
+ * @param pairs_sep a 0-terminated list of characters used to separate
+ * two pairs from each other, for example ':' or ','
+ * @param flags flags; see the AV_OPT_FLAG_* values below
+ * @param rkey parsed key; must be freed using av_free()
+ * @param rval parsed value; must be freed using av_free()
+ *
+ * @return 0 for success, or a negative value corresponding to an AVERROR
+ * code in case of error; in particular:
+ * AVERROR(EINVAL) if no key is present
+ *
+ */
+int av_opt_get_key_value(const char **ropts,
+ const char *key_val_sep, const char *pairs_sep,
+ unsigned flags,
+ char **rkey, char **rval);
+
+enum {
+
+ /**
+ * Accept to parse a value without a key; the key will then be returned
+ * as NULL.
+ */
+ AV_OPT_FLAG_IMPLICIT_KEY = 1,
+};
+
+/**
* @defgroup opt_eval_funcs Evaluating option strings
* @{
* This group of functions can be used to evaluate option strings