avutil: use av_dict_iterate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
cb9ab38c52
commit
81747b5259
@ -1742,14 +1742,14 @@ void av_opt_free(void *obj)
|
|||||||
|
|
||||||
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
|
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
|
||||||
{
|
{
|
||||||
AVDictionaryEntry *t = NULL;
|
const AVDictionaryEntry *t = NULL;
|
||||||
AVDictionary *tmp = NULL;
|
AVDictionary *tmp = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!options)
|
if (!options)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
|
while ((t = av_dict_iterate(*options, t))) {
|
||||||
ret = av_opt_set(obj, t->key, t->value, search_flags);
|
ret = av_opt_set(obj, t->key, t->value, search_flags);
|
||||||
if (ret == AVERROR_OPTION_NOT_FOUND)
|
if (ret == AVERROR_OPTION_NOT_FOUND)
|
||||||
ret = av_dict_set(&tmp, t->key, t->value, 0);
|
ret = av_dict_set(&tmp, t->key, t->value, 0);
|
||||||
@ -2137,16 +2137,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
case AV_OPT_TYPE_DICT: {
|
case AV_OPT_TYPE_DICT: {
|
||||||
AVDictionary *dict1 = NULL;
|
AVDictionary *dict1 = NULL;
|
||||||
AVDictionary *dict2 = *(AVDictionary **)dst;
|
AVDictionary *dict2 = *(AVDictionary **)dst;
|
||||||
AVDictionaryEntry *en1 = NULL;
|
const AVDictionaryEntry *en1 = NULL;
|
||||||
AVDictionaryEntry *en2 = NULL;
|
const AVDictionaryEntry *en2 = NULL;
|
||||||
ret = av_dict_parse_string(&dict1, o->default_val.str, "=", ":", 0);
|
ret = av_dict_parse_string(&dict1, o->default_val.str, "=", ":", 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_dict_free(&dict1);
|
av_dict_free(&dict1);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
en1 = av_dict_get(dict1, "", en1, AV_DICT_IGNORE_SUFFIX);
|
en1 = av_dict_iterate(dict1, en1);
|
||||||
en2 = av_dict_get(dict2, "", en2, AV_DICT_IGNORE_SUFFIX);
|
en2 = av_dict_iterate(dict2, en2);
|
||||||
} while (en1 && en2 && !strcmp(en1->key, en2->key) && !strcmp(en1->value, en2->value));
|
} while (en1 && en2 && !strcmp(en1->key, en2->key) && !strcmp(en1->value, en2->value));
|
||||||
av_dict_free(&dict1);
|
av_dict_free(&dict1);
|
||||||
return (!en1 && !en2);
|
return (!en1 && !en2);
|
||||||
|
@ -52,7 +52,7 @@ static void test_separators(const AVDictionary *m, const char pair, const char v
|
|||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
AVDictionary *dict = NULL;
|
AVDictionary *dict = NULL;
|
||||||
AVDictionaryEntry *e;
|
const AVDictionaryEntry *e;
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
|
|
||||||
printf("Testing av_dict_get_string() and av_dict_parse_string()\n");
|
printf("Testing av_dict_get_string() and av_dict_parse_string()\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user