From 7088a679a25cc62424b532ca47a6c13f62eb04a0 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 25 Sep 2012 09:37:16 +0200 Subject: decoder/wavpack: support all APEv2 tags WavPack tags are always APEv2, by definition. Reuse the tag_table from tag_ape.c, instead of rolling our own. --- src/decoder/wavpack_decoder_plugin.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src/decoder') diff --git a/src/decoder/wavpack_decoder_plugin.c b/src/decoder/wavpack_decoder_plugin.c index ae85b0e2..9ebd0fcc 100644 --- a/src/decoder/wavpack_decoder_plugin.c +++ b/src/decoder/wavpack_decoder_plugin.c @@ -24,6 +24,7 @@ #include "utils.h" #include "tag_table.h" #include "tag_handler.h" +#include "tag_ape.h" #include #include @@ -38,21 +39,6 @@ #define ERRORLEN 80 -static const struct tag_table wavpack_tags[] = { - { "artist", TAG_ARTIST }, - { "album", TAG_ALBUM }, - { "title", TAG_TITLE }, - { "track", TAG_TRACK }, - { "name", TAG_NAME }, - { "genre", TAG_GENRE }, - { "date", TAG_DATE }, - { "composer", TAG_COMPOSER }, - { "performer", TAG_PERFORMER }, - { "comment", TAG_COMMENT }, - { "disc", TAG_DISC }, - { NULL, TAG_NUM_OF_ITEM_TYPES } -}; - /** A pointer type for format converter function. */ typedef void (*format_samples_t)( int bytes_per_sample, @@ -321,7 +307,17 @@ wavpack_scan_file(const char *fname, WavpackGetNumSamples(wpc) / WavpackGetSampleRate(wpc)); - for (const struct tag_table *i = wavpack_tags; i->name != NULL; ++i) + /* the WavPack format implies APEv2 tags, which means we can + reuse the mapping from tag_ape.c */ + + for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) { + const char *name = tag_item_names[i]; + if (name != NULL) + wavpack_scan_tag_item(wpc, name, (enum tag_type)i, + handler, handler_ctx); + } + + for (const struct tag_table *i = ape_tags; i->name != NULL; ++i) wavpack_scan_tag_item(wpc, i->name, i->type, handler, handler_ctx); -- cgit v1.2.3