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.
This commit is contained in:
Nicolas George 2012-11-10 13:03:09 +01:00
parent 468781f828
commit 926481078b
5 changed files with 12 additions and 9 deletions

View File

@ -582,6 +582,8 @@ static int init_report(const char *env)
av_err2str(ret));
break;
}
if (*env)
env++;
count++;
if (!strcmp(key, "file")) {
filename_template = val;

View File

@ -15,12 +15,12 @@ libavutil: 2012-10-22
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
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
Add AV_OPT_TYPE_SAMPLE_FMT value to AVOptionType enum.

View File

@ -870,8 +870,6 @@ int av_opt_get_key_value(const char **ropts,
av_free(key);
return AVERROR(ENOMEM);
}
if (*opts && strchr(pairs_sep, *opts))
opts++;
*ropts = opts;
*rkey = key;
*rval = val;
@ -904,6 +902,8 @@ int av_opt_set_from_string(void *ctx, const char *opts,
av_err2str(ret));
return ret;
}
if (*opts)
opts++;
if (parsed_key) {
key = parsed_key;
while (*shorthand) /* discard all remaining shorthand */

View File

@ -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.
*
* @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
* key from value, for example '='
* @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);
* @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:
* @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
*
*/

View File

@ -75,7 +75,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 52
#define LIBAVUTIL_VERSION_MINOR 6
#define LIBAVUTIL_VERSION_MINOR 7
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \