Existing av_opt_set_dict doesn't accept flags. It doesn't allow to pass options to nested structs. New function alllows that.
Unified · Split
| @@ -15,6 +15,9 @@ libavutil: 2012-10-22 · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | API changes, most recent first: |
| 17 | 17 | |
| 18 | +2014-05-xx - xxxxxxx - lavu 52.81.0 - opt.h | |
| 19 | + Add av_opt_set_dict2() function. | |
| 20 | + | |
| 18 | 21 | 2014-04-xx - xxxxxxx - lavc 55.50.3 - avcodec.h |
| 19 | 22 | Deprecate CODEC_FLAG_MV0. It is replaced by the flag "mv0" in the |
| 20 | 23 | "mpv_flags" private option of the mpegvideo encoders. |
| @@ -1415,7 +1415,7 @@ void av_opt_free(void *obj) · 1414 unmodified lines | ||
| 1415 | 1415 | av_freep((uint8_t *)obj + o->offset); |
| 1416 | 1416 | } |
| 1417 | 1417 | |
| 1418 | −int av_opt_set_dict(void *obj, AVDictionary **options) | |
| 1418 | +int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags) | |
| 1419 | 1419 | { |
| 1420 | 1420 | AVDictionaryEntry *t = NULL; |
| 1421 | 1421 | AVDictionary *tmp = NULL; |
| @@ -1425,7 +1425,7 @@ int av_opt_set_dict(void *obj, AVDictionary **options) · 3 unmodified lines | ||
| 1425 | 1425 | return 0; |
| 1426 | 1426 | |
| 1427 | 1427 | while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) { |
| 1428 | − ret = av_opt_set(obj, t->key, t->value, 0); | |
| 1428 | + ret = av_opt_set(obj, t->key, t->value, search_flags); | |
| 1429 | 1429 | if (ret == AVERROR_OPTION_NOT_FOUND) |
| 1430 | 1430 | av_dict_set(&tmp, t->key, t->value, 0); |
| 1431 | 1431 | else if (ret < 0) { |
| @@ -1439,6 +1439,11 @@ int av_opt_set_dict(void *obj, AVDictionary **options) · 7 unmodified lines | ||
| 1439 | 1439 | return ret; |
| 1440 | 1440 | } |
| 1441 | 1441 | |
| 1442 | +int av_opt_set_dict(void *obj, AVDictionary **options) | |
| 1443 | +{ | |
| 1444 | + return av_opt_set_dict2(obj, options, 0); | |
| 1445 | +} | |
| 1446 | + | |
| 1442 | 1447 | const AVOption *av_opt_find(void *obj, const char *name, const char *unit, |
| 1443 | 1448 | int opt_flags, int search_flags) |
| 1444 | 1449 | { |
| @@ -541,6 +541,24 @@ int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name) · 540 unmodified lines | ||
| 541 | 541 | */ |
| 542 | 542 | int av_opt_set_dict(void *obj, struct AVDictionary **options); |
| 543 | 543 | |
| 544 | + | |
| 545 | +/** | |
| 546 | + * Set all the options from a given dictionary on an object. | |
| 547 | + * | |
| 548 | + * @param obj a struct whose first element is a pointer to AVClass | |
| 549 | + * @param options options to process. This dictionary will be freed and replaced | |
| 550 | + * by a new one containing all options not found in obj. | |
| 551 | + * Of course this new dictionary needs to be freed by caller | |
| 552 | + * with av_dict_free(). | |
| 553 | + * @param search_flags A combination of AV_OPT_SEARCH_*. | |
| 554 | + * | |
| 555 | + * @return 0 on success, a negative AVERROR if some option was found in obj, | |
| 556 | + * but could not be set. | |
| 557 | + * | |
| 558 | + * @see av_dict_copy() | |
| 559 | + */ | |
| 560 | +int av_opt_set_dict2(void *obj, struct AVDictionary **options, int search_flags); | |
| 561 | + | |
| 544 | 562 | /** |
| 545 | 563 | * Extract a key-value pair from the beginning of a string. |
| 546 | 564 | * |
| @@ -56,7 +56,7 @@ · 55 unmodified lines | ||
| 56 | 56 | */ |
| 57 | 57 | |
| 58 | 58 | #define LIBAVUTIL_VERSION_MAJOR 52 |
| 59 | −#define LIBAVUTIL_VERSION_MINOR 80 | |
| 59 | +#define LIBAVUTIL_VERSION_MINOR 81 | |
| 60 | 60 | #define LIBAVUTIL_VERSION_MICRO 100 |
| 61 | 61 | |
| 62 | 62 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |