From eacd6045187b2d8b64f9c2e0f467145889a16795 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Thu, 25 Jun 2009 08:43:59 +0200
Subject: [PATCH] ffmpeg: support multiple tags

Call av_metadata_get() in a loop.
---
 NEWS                        | 2 ++
 src/decoder/ffmpeg_plugin.c | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index e064f67cc..94941fc21 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,6 @@
 ver 0.16 (20??/??/??)
+* decoders:
+  - ffmpeg: support multiple tags
 * mixers:
   - removed support for legacy mixer configuration
 * commands:
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c
index abccdf977..03c46a732 100644
--- a/src/decoder/ffmpeg_plugin.c
+++ b/src/decoder/ffmpeg_plugin.c
@@ -342,8 +342,9 @@ static void
 ffmpeg_copy_metadata(struct tag *tag, AVMetadata *m,
 		     enum tag_type type, const char *name)
 {
-	AVMetadataTag *mt = av_metadata_get(m, name, NULL, 0);
-	if (mt != NULL)
+	AVMetadataTag *mt = NULL;
+
+	while ((mt = av_metadata_get(m, name, mt, 0)) != NULL)
 		tag_add_item(tag, type, mt->value);
 }
 #endif