From 04c02a1eb89f0ccc7984976afb708b675d494578 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 22 Sep 2012 09:48:27 +0200 Subject: locate: cast enum tag_type to int before comparing with integer Avoids clang pickiness. This code is not correct, but we'll fix that another day. --- src/locate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/locate.c b/src/locate.c index 9645da9c..c9684d2b 100644 --- a/src/locate.c +++ b/src/locate.c @@ -127,7 +127,7 @@ locate_tag_search(const struct song *song, enum tag_type type, const char *str) { bool ret = false; - if (type == LOCATE_TAG_FILE_TYPE || type == LOCATE_TAG_ANY_TYPE) { + if (type == LOCATE_TAG_FILE_TYPE || (int)type == LOCATE_TAG_ANY_TYPE) { char *uri = song_get_uri(song); char *p = g_utf8_casefold(uri, -1); g_free(uri); @@ -147,7 +147,7 @@ locate_tag_search(const struct song *song, enum tag_type type, const char *str) for (unsigned i = 0; i < song->tag->num_items && !ret; i++) { visited_types[song->tag->items[i]->type] = true; - if (type != LOCATE_TAG_ANY_TYPE && + if ((int)type != LOCATE_TAG_ANY_TYPE && song->tag->items[i]->type != type) { continue; } @@ -185,7 +185,7 @@ locate_song_search(const struct song *song, static bool locate_tag_match(const struct song *song, enum tag_type type, const char *str) { - if (type == LOCATE_TAG_FILE_TYPE || type == LOCATE_TAG_ANY_TYPE) { + if (type == LOCATE_TAG_FILE_TYPE || (int)type == LOCATE_TAG_ANY_TYPE) { char *uri = song_get_uri(song); bool matches = strcmp(str, uri) == 0; g_free(uri); @@ -205,7 +205,7 @@ locate_tag_match(const struct song *song, enum tag_type type, const char *str) for (unsigned i = 0; i < song->tag->num_items; i++) { visited_types[song->tag->items[i]->type] = true; - if (type != LOCATE_TAG_ANY_TYPE && + if ((int)type != LOCATE_TAG_ANY_TYPE && song->tag->items[i]->type != type) { continue; } -- cgit v1.2.3 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. --- NEWS | 1 + src/decoder/wavpack_decoder_plugin.c | 28 ++++++++++++---------------- src/tag_ape.c | 2 +- src/tag_ape.h | 4 ++++ 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/NEWS b/NEWS index 22f42b77..fe9d7754 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 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); diff --git a/src/tag_ape.c b/src/tag_ape.c index b941a29b..0adc4309 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 9b585611..e2daf088 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 struct tag_handler; +extern const struct tag_table ape_tags[]; + /** * Scan the APE tags of a file. * -- cgit v1.2.3 From c93a28c641be7c89fee5a00f11cbfec14d8f71d8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 25 Sep 2012 10:41:39 +0200 Subject: configure.ac: don't auto-detect the Vorbis encoder when Tremor is enabled libvorbisidec and libvorbis export the same symbols, which is a dangerous thing. Since libvorbisenc depends on libvorbis, this can get nasty, so let's disable the Vorbis encoder unless the user explicitly wants it. --- NEWS | 3 ++- configure.ac | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index fe9d7754..19f86e8a 100644 --- a/NEWS +++ b/NEWS @@ -19,7 +19,8 @@ ver 0.17.2 (2012/??/??) * state_file: save song priorities * player: disable cross-fading in "single" mode * update: fix unsafe readlink() usage - +* configure.ac: + - don't auto-detect the vorbis encoder when Tremor is enabled ver 0.17.1 (2012/07/31) * protocol: diff --git a/configure.ac b/configure.ac index f9062934..87106a4f 100644 --- a/configure.ac +++ b/configure.ac @@ -999,6 +999,11 @@ if test x$enable_tremor = xyes; then AC_MSG_WARN(["OggTremor detected, could not enable Vorbis."]) fi enable_vorbis=no + + if test x$enable_vorbis_encoder = xauto; then + AC_MSG_WARN([OggTremor detected, disabling the Vorbis encoder plugin.]) + enable_vorbis_encoder=no + fi fi MPD_AUTO_PKG(vorbis, VORBIS, [vorbis vorbisfile ogg], -- cgit v1.2.3 From ba6ef53ef95dfd48ce0e5dd161b3199b431044ed Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 25 Sep 2012 11:08:16 +0200 Subject: decoder_control: remove MixRamp debug messages These are confusing, and since MixRamp development has ceased, not useful to anybody. --- src/decoder/_flac_common.c | 5 ++--- src/decoder/mad_decoder_plugin.c | 5 ++--- src/decoder_control.c | 3 --- src/decoder_thread.c | 1 - 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/decoder/_flac_common.c b/src/decoder/_flac_common.c index bab3995f..d7f0c4a8 100644 --- a/src/decoder/_flac_common.c +++ b/src/decoder/_flac_common.c @@ -124,11 +124,10 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block, case FLAC__METADATA_TYPE_VORBIS_COMMENT: if (flac_parse_replay_gain(&rgi, block)) replay_gain_db = decoder_replay_gain(data->decoder, &rgi); - if (flac_parse_mixramp(&mixramp_start, &mixramp_end, block)) { - g_debug("setting mixramp_tags"); + + if (flac_parse_mixramp(&mixramp_start, &mixramp_end, block)) decoder_mixramp(data->decoder, replay_gain_db, mixramp_start, mixramp_end); - } if (data->tag != NULL) flac_vorbis_comments_to_tag(data->tag, NULL, diff --git a/src/decoder/mad_decoder_plugin.c b/src/decoder/mad_decoder_plugin.c index a69284be..62c37164 100644 --- a/src/decoder/mad_decoder_plugin.c +++ b/src/decoder/mad_decoder_plugin.c @@ -365,11 +365,10 @@ static void mp3_parse_id3(struct mp3_data *data, size_t tagsize, replay_gain_db = decoder_replay_gain(data->decoder, &rgi); data->found_replay_gain = true; } - if (parse_id3_mixramp(&mixramp_start, &mixramp_end, id3_tag)) { - g_debug("setting mixramp_tags"); + + if (parse_id3_mixramp(&mixramp_start, &mixramp_end, id3_tag)) decoder_mixramp(data->decoder, replay_gain_db, mixramp_start, mixramp_end); - } } id3_tag_delete(id3_tag); diff --git a/src/decoder_control.c b/src/decoder_control.c index 70f34b33..2ce03b66 100644 --- a/src/decoder_control.c +++ b/src/decoder_control.c @@ -169,7 +169,6 @@ dc_mixramp_start(struct decoder_control *dc, char *mixramp_start) g_free(dc->mixramp_start); dc->mixramp_start = mixramp_start; - g_debug("mixramp_start = %s", mixramp_start ? mixramp_start : "NULL"); } void @@ -179,7 +178,6 @@ dc_mixramp_end(struct decoder_control *dc, char *mixramp_end) g_free(dc->mixramp_end); dc->mixramp_end = mixramp_end; - g_debug("mixramp_end = %s", mixramp_end ? mixramp_end : "NULL"); } void @@ -189,5 +187,4 @@ dc_mixramp_prev_end(struct decoder_control *dc, char *mixramp_prev_end) g_free(dc->mixramp_prev_end); dc->mixramp_prev_end = mixramp_prev_end; - g_debug("mixramp_prev_end = %s", mixramp_prev_end ? mixramp_prev_end : "NULL"); } diff --git a/src/decoder_thread.c b/src/decoder_thread.c index 1440fc27..af80ed45 100644 --- a/src/decoder_thread.c +++ b/src/decoder_thread.c @@ -468,7 +468,6 @@ decoder_task(gpointer arg) switch (dc->command) { case DECODE_COMMAND_START: - g_debug("clearing mixramp tags"); dc_mixramp_start(dc, NULL); dc_mixramp_prev_end(dc, dc->mixramp_end); dc->mixramp_end = NULL; /* Don't free, it's copied above. */ -- cgit v1.2.3