Commit 92648107 authored by Nicolas George's avatar Nicolas George

lavu/opt: fix av_opt_get_key_value() API.

Do not skip the end delimiter.
Reserve positive return values.
This is an API break, but the function was introduced less than
two weeks ago.
parent 468781f8
...@@ -582,6 +582,8 @@ static int init_report(const char *env) ...@@ -582,6 +582,8 @@ static int init_report(const char *env)
av_err2str(ret)); av_err2str(ret));
break; break;
} }
if (*env)
env++;
count++; count++;
if (!strcmp(key, "file")) { if (!strcmp(key, "file")) {
filename_template = val; filename_template = val;
......
...@@ -15,12 +15,12 @@ libavutil: 2012-10-22 ...@@ -15,12 +15,12 @@ libavutil: 2012-10-22
API changes, most recent first: API changes, most recent first:
2012-11-15 - xxxxxxx - lavu 52.7.100 - opt.h
Add av_opt_get_key_value().
2012-11-13 - xxxxxxx - lavfi 3.23.100 - avfilter.h 2012-11-13 - xxxxxxx - lavfi 3.23.100 - avfilter.h
Add channels field to AVFilterBufferRefAudioProps. Add channels field to AVFilterBufferRefAudioProps.
2012-11-02 - xxxxxxx - lavu 52.4.100 - opt.h
Add av_opt_get_key_value().
2012-11-03 - xxxxxxx - lavu 52.3.100 - opt.h 2012-11-03 - xxxxxxx - lavu 52.3.100 - opt.h
Add AV_OPT_TYPE_SAMPLE_FMT value to AVOptionType enum. Add AV_OPT_TYPE_SAMPLE_FMT value to AVOptionType enum.
......
...@@ -870,8 +870,6 @@ int av_opt_get_key_value(const char **ropts, ...@@ -870,8 +870,6 @@ int av_opt_get_key_value(const char **ropts,
av_free(key); av_free(key);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
if (*opts && strchr(pairs_sep, *opts))
opts++;
*ropts = opts; *ropts = opts;
*rkey = key; *rkey = key;
*rval = val; *rval = val;
...@@ -904,6 +902,8 @@ int av_opt_set_from_string(void *ctx, const char *opts, ...@@ -904,6 +902,8 @@ int av_opt_set_from_string(void *ctx, const char *opts,
av_err2str(ret)); av_err2str(ret));
return ret; return ret;
} }
if (*opts)
opts++;
if (parsed_key) { if (parsed_key) {
key = parsed_key; key = parsed_key;
while (*shorthand) /* discard all remaining shorthand */ while (*shorthand) /* discard all remaining shorthand */
......
...@@ -459,7 +459,8 @@ int av_opt_set_dict(void *obj, struct AVDictionary **options); ...@@ -459,7 +459,8 @@ int av_opt_set_dict(void *obj, struct AVDictionary **options);
* Extract a key-value pair from the beginning of a string. * Extract a key-value pair from the beginning of a string.
* *
* @param ropts pointer to the options string, will be updated to * @param ropts pointer to the options string, will be updated to
* point to the rest of the string * point to the rest of the string (one of the pairs_sep
* or the final NUL)
* @param key_val_sep a 0-terminated list of characters used to separate * @param key_val_sep a 0-terminated list of characters used to separate
* key from value, for example '=' * key from value, for example '='
* @param pairs_sep a 0-terminated list of characters used to separate * @param pairs_sep a 0-terminated list of characters used to separate
...@@ -468,8 +469,8 @@ int av_opt_set_dict(void *obj, struct AVDictionary **options); ...@@ -468,8 +469,8 @@ int av_opt_set_dict(void *obj, struct AVDictionary **options);
* @param rkey parsed key; must be freed using av_free() * @param rkey parsed key; must be freed using av_free()
* @param rval parsed value; 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 * @return >=0 for success, or a negative value corresponding to an
* code in case of error; in particular: * AVERROR code in case of error; in particular:
* AVERROR(EINVAL) if no key is present * AVERROR(EINVAL) if no key is present
* *
*/ */
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
*/ */
#define LIBAVUTIL_VERSION_MAJOR 52 #define LIBAVUTIL_VERSION_MAJOR 52
#define LIBAVUTIL_VERSION_MINOR 6 #define LIBAVUTIL_VERSION_MINOR 7
#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment