diff options
author | Claude Heiland-Allen <claude@mathr.co.uk> | 2023-10-11 12:02:32 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-10-18 16:52:47 +0200 |
commit | a6d1c9dd0fb912891abc1aa10d35f928188641d4 (patch) | |
tree | d8ab58662bf867a8aa30668e49e70bce18b7091d /common/tags.c | |
parent | 02d009bc5c2dca3326c1a2551093c4bc3a67a6f7 (diff) | |
download | mpv-a6d1c9dd0fb912891abc1aa10d35f928188641d4.tar.bz2 mpv-a6d1c9dd0fb912891abc1aa10d35f928188641d4.tar.xz |
common/tags: add mp_tags_move_from_av_dictionary()
Abstracts a common pattern,
in which the av dictionary is cleared
immediately after copying to mp tags,
so that additional tags later in the stream
get appended to empty tags,
instead of being appended to existing tags
that were already copied.
Diffstat (limited to 'common/tags.c')
-rw-r--r-- | common/tags.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/tags.c b/common/tags.c index f7e85ace3d..43f557dd6c 100644 --- a/common/tags.c +++ b/common/tags.c @@ -142,3 +142,10 @@ void mp_tags_copy_from_av_dictionary(struct mp_tags *tags, while ((entry = av_dict_get(av_dict, "", entry, AV_DICT_IGNORE_SUFFIX))) mp_tags_set_str(tags, entry->key, entry->value); } + +void mp_tags_move_from_av_dictionary(struct mp_tags *tags, + struct AVDictionary **av_dict_ptr) +{ + mp_tags_copy_from_av_dictionary(tags, *av_dict_ptr); + av_dict_free(av_dict_ptr); +} |