aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/mad_decoder_plugin.c
diff options
context:
space:
mode:
authorTim Phipps <mpd@phipps-hutton.freeserve.co.uk>2010-03-21 18:21:47 +0100
committerMax Kellermann <max@duempel.org>2010-03-21 18:21:47 +0100
commite7a515c8b11c643332406d60a13ab1fe06d2b226 (patch)
treeaa7179b453b6fe7b163d1b4b807157359cb436cf /src/decoder/mad_decoder_plugin.c
parente9b75d462c4d0ffee3b3b26582800ec4f657a333 (diff)
downloadmpd-e7a515c8b11c643332406d60a13ab1fe06d2b226.tar.gz
mpd-e7a515c8b11c643332406d60a13ab1fe06d2b226.tar.xz
mpd-e7a515c8b11c643332406d60a13ab1fe06d2b226.zip
Add support for MixRamp tags
Adds mixrampdb and mixrampdelay commands. Reads MIXRAP_START and MIXRAMP_END tags from FLAC files and overlaps instead of crossfading.
Diffstat (limited to '')
-rw-r--r--src/decoder/mad_decoder_plugin.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/decoder/mad_decoder_plugin.c b/src/decoder/mad_decoder_plugin.c
index 379cb9b8a..6f6ee8fa4 100644
--- a/src/decoder/mad_decoder_plugin.c
+++ b/src/decoder/mad_decoder_plugin.c
@@ -347,6 +347,47 @@ parse_id3_replay_gain_info(struct replay_gain_info *replay_gain_info,
}
#endif
+#ifdef HAVE_ID3TAG
+static bool
+parse_id3_mixramp(char **mixramp_start, char **mixramp_end,
+ struct id3_tag *tag)
+{
+ int i;
+ char *key;
+ char *value;
+ struct id3_frame *frame;
+ bool found = false;
+
+ *mixramp_start = NULL;
+ *mixramp_end = NULL;
+
+ for (i = 0; (frame = id3_tag_findframe(tag, "TXXX", i)); i++) {
+ if (frame->nfields < 3)
+ continue;
+
+ key = (char *)
+ id3_ucs4_latin1duplicate(id3_field_getstring
+ (&frame->fields[1]));
+ value = (char *)
+ id3_ucs4_latin1duplicate(id3_field_getstring
+ (&frame->fields[2]));
+
+ if (g_ascii_strcasecmp(key, "mixramp_start") == 0) {
+ *mixramp_start = strdup(value);
+ found = true;
+ } else if (g_ascii_strcasecmp(key, "mixramp_end") == 0) {
+ *mixramp_end = strdup(value);
+ found = true;
+ }
+
+ free(key);
+ free(value);
+ }
+
+ return found;
+}
+#endif
+
static void mp3_parse_id3(struct mp3_data *data, size_t tagsize,
struct tag **mpd_tag)
{
@@ -403,10 +444,16 @@ static void mp3_parse_id3(struct mp3_data *data, size_t tagsize,
if (data->decoder != NULL) {
struct replay_gain_info rgi;
+ char *mixramp_start;
+ char *mixramp_end;
if (parse_id3_replay_gain_info(&rgi, id3_tag)) {
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");
+ decoder_mixramp(data->decoder, mixramp_start, mixramp_end);
+ }
}
id3_tag_delete(id3_tag);