Skip to content

Commit

Permalink
lavu/opt: fix av_opt_get_key_value() API.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Nicolas George committed Nov 16, 2012
1 parent 468781f commit 9264810
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 2 additions & 0 deletions cmdutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions doc/APIchanges
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions libavutil/opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
7 changes: 4 additions & 3 deletions libavutil/opt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
*
*/
Expand Down
2 changes: 1 addition & 1 deletion libavutil/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand Down

0 comments on commit 9264810

Please sign in to comment.