aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/ffmpeg_metadata.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-02-11 19:12:02 +0100
committerMax Kellermann <max@duempel.org>2012-02-11 17:04:29 +0100
commit5d73215a8dad922c8e383f3837f3ec9e26503389 (patch)
tree8fc4b96d93a907054a05d3250f97bf4f68c6df85 /src/decoder/ffmpeg_metadata.c
parentb7356bc526dbbd6fa00d40caff2addec10ae7c7e (diff)
downloadmpd-5d73215a8dad922c8e383f3837f3ec9e26503389.tar.gz
mpd-5d73215a8dad922c8e383f3837f3ec9e26503389.tar.xz
mpd-5d73215a8dad922c8e383f3837f3ec9e26503389.zip
decoder_plugin: scan tags with callback table
Pass a callback table to scan_file() and scan_stream(), instead of returning a tag object.
Diffstat (limited to '')
-rw-r--r--src/decoder/ffmpeg_metadata.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/decoder/ffmpeg_metadata.c b/src/decoder/ffmpeg_metadata.c
index d091afbc6..5325c1cae 100644
--- a/src/decoder/ffmpeg_metadata.c
+++ b/src/decoder/ffmpeg_metadata.c
@@ -19,8 +19,8 @@
#include "config.h"
#include "ffmpeg_metadata.h"
-#include "tag.h"
#include "tag_table.h"
+#include "tag_handler.h"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "ffmpeg"
@@ -39,23 +39,27 @@ static const struct tag_table ffmpeg_tags[] = {
};
static void
-ffmpeg_copy_metadata(struct tag *tag, enum tag_type type,
- AVDictionary *m, const char *name)
+ffmpeg_copy_metadata(enum tag_type type,
+ AVDictionary *m, const char *name,
+ const struct tag_handler *handler, void *handler_ctx)
{
AVDictionaryEntry *mt = NULL;
while ((mt = av_dict_get(m, name, mt, 0)) != NULL)
- tag_add_item(tag, type, mt->value);
+ tag_handler_invoke_tag(handler, handler_ctx,
+ type, mt->value);
}
void
-ffmpeg_copy_dictionary(struct tag *tag, AVDictionary *dict)
+ffmpeg_scan_dictionary(AVDictionary *dict,
+ const struct tag_handler *handler, void *handler_ctx)
{
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i)
- ffmpeg_copy_metadata(tag, i,
- dict, tag_item_names[i]);
+ ffmpeg_copy_metadata(i, dict, tag_item_names[i],
+ handler, handler_ctx);
for (const struct tag_table *i = ffmpeg_tags;
i->name != NULL; ++i)
- ffmpeg_copy_metadata(tag, i->type, dict, i->name);
+ ffmpeg_copy_metadata(i->type, dict, i->name,
+ handler, handler_ctx);
}