Commit 4764daf3 authored by Max Kellermann's avatar Max Kellermann

decoder/ffmpeg: pass tag_type and name to _copy_metadata()

Allow using this function without the ffmpeg_tag_map struct.
parent 6357496d
...@@ -614,20 +614,21 @@ static const ffmpeg_tag_map ffmpeg_tag_maps[] = { ...@@ -614,20 +614,21 @@ static const ffmpeg_tag_map ffmpeg_tag_maps[] = {
#endif #endif
static void static void
ffmpeg_copy_metadata(struct tag *tag, AVDictionary *m, ffmpeg_copy_metadata(struct tag *tag, enum tag_type type,
const ffmpeg_tag_map tag_map) AVDictionary *m, const char *name)
{ {
AVDictionaryEntry *mt = NULL; AVDictionaryEntry *mt = NULL;
while ((mt = av_dict_get(m, tag_map.name, mt, 0)) != NULL) while ((mt = av_dict_get(m, name, mt, 0)) != NULL)
tag_add_item(tag, tag_map.type, mt->value); tag_add_item(tag, type, mt->value);
} }
static void static void
ffmpeg_copy_dictionary(struct tag *tag, AVDictionary *dict) ffmpeg_copy_dictionary(struct tag *tag, AVDictionary *dict)
{ {
for (unsigned i = 0; i < G_N_ELEMENTS(ffmpeg_tag_maps); i++) for (unsigned i = 0; i < G_N_ELEMENTS(ffmpeg_tag_maps); i++)
ffmpeg_copy_metadata(tag, dict, ffmpeg_tag_maps[i]); ffmpeg_copy_metadata(tag, ffmpeg_tag_maps[i].type,
dict, ffmpeg_tag_maps[i].name);
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment