diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2012-08-13 16:39:56 +0200 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2012-09-30 09:21:29 +0200 |
commit | 438978fb4b4663c404e7474e8ef98f3c856cd31a (patch) | |
tree | 78575942c2afcdccbf890a4d2fba8c37570bd1cf /libavutil/opt.h | |
parent | 5f1c3c785c786f3c78c350d4503fcfd794fa3c64 (diff) | |
download | ffmpeg-438978fb4b4663c404e7474e8ef98f3c856cd31a.tar.gz |
opt: implement av_opt_set_from_string().
It is similar to av_set_options_string() but accepts a list
of options that can be in shorthand: if the key is omitted
on the first fields, the keys from the shorthand list are
assumed, in order.
Diffstat (limited to 'libavutil/opt.h')
-rw-r--r-- | libavutil/opt.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libavutil/opt.h b/libavutil/opt.h index 285d85448a..3aa912a235 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -394,6 +394,36 @@ int av_set_options_string(void *ctx, const char *opts, const char *key_val_sep, const char *pairs_sep); /** + * Parse the key=value pairs list in opts. For each key=value pair found, + * set the value of the corresponding option in ctx. + * + * @param ctx the AVClass object to set options on + * @param opts the options string, key-value pairs separated by a + * delimiter + * @param shorthand a NULL-terminated array of options names for shorthand + * notation: if the first field in opts has no key part, + * the key is taken from the first element of shorthand; + * then again for the second, etc., until either opts is + * finished, shorthand is finished or a named option is + * found; after that, all options must be named + * @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 ',' + * @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 + * cannot be set + * + * Options names must use only the following characters: a-z A-Z 0-9 - . / _ + * Separators must use characters distinct from from options and from each + * other. + */ +int av_opt_set_from_string(void *ctx, const char *opts, + const char *const *shorthand, + const char *key_val_sep, const char *pairs_sep); +/** * Free all string and binary options in obj. */ void av_opt_free(void *obj); |