aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-09-25 09:37:16 +0200
committerMax Kellermann <max@duempel.org>2012-09-25 09:37:16 +0200
commit7088a679a25cc62424b532ca47a6c13f62eb04a0 (patch)
tree08f769bf509d2b1c8d5428266605c8f74b0317b7
parent04c02a1eb89f0ccc7984976afb708b675d494578 (diff)
downloadmpd-7088a679a25cc62424b532ca47a6c13f62eb04a0.tar.gz
mpd-7088a679a25cc62424b532ca47a6c13f62eb04a0.tar.xz
mpd-7088a679a25cc62424b532ca47a6c13f62eb04a0.zip
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.
-rw-r--r--NEWS1
-rw-r--r--src/decoder/wavpack_decoder_plugin.c28
-rw-r--r--src/tag_ape.c2
-rw-r--r--src/tag_ape.h4
4 files changed, 18 insertions, 17 deletions
diff --git a/NEWS b/NEWS
index 22f42b775..fe9d77542 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ ver 0.17.2 (2012/??/??)
- fluidsynth: stop playback at end of file
- fluidsynth: check MIDI file format while scanning
- fluidsynth: add sample rate setting
+ - wavpack: support all APEv2 tags
* output:
- httpd: use monotonic clock, avoid hiccups after system clock adjustment
- httpd: fix throttling bug after resuming playback
diff --git a/src/decoder/wavpack_decoder_plugin.c b/src/decoder/wavpack_decoder_plugin.c
index ae85b0e27..9ebd0fccc 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 <wavpack/wavpack.h>
#include <glib.h>
@@ -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);
diff --git a/src/tag_ape.c b/src/tag_ape.c
index b941a29bc..0adc43092 100644
--- a/src/tag_ape.c
+++ b/src/tag_ape.c
@@ -24,7 +24,7 @@
#include "tag_handler.h"
#include "ape.h"
-static const struct tag_table ape_tags[] = {
+const struct tag_table ape_tags[] = {
{ "album artist", TAG_ALBUM_ARTIST },
{ "year", TAG_DATE },
{ NULL, TAG_NUM_OF_ITEM_TYPES }
diff --git a/src/tag_ape.h b/src/tag_ape.h
index 9b5856115..e2daf088d 100644
--- a/src/tag_ape.h
+++ b/src/tag_ape.h
@@ -20,10 +20,14 @@
#ifndef MPD_TAG_APE_H
#define MPD_TAG_APE_H
+#include "tag_table.h"
+
#include <stdbool.h>
struct tag_handler;
+extern const struct tag_table ape_tags[];
+
/**
* Scan the APE tags of a file.
*