aboutsummaryrefslogtreecommitdiffstats
path: root/src/decode.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-06-01 11:18:25 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-06-01 11:18:25 +0000
commitfe0b751c8278ab07a350cd4d363743b734f4f830 (patch)
tree288ce38c0401ed60f416da239c94654df4413657 /src/decode.c
parent187eba5754ddc99f5105fe2edac9c817fd2f7561 (diff)
downloadmpd-fe0b751c8278ab07a350cd4d363743b734f4f830.tar.gz
mpd-fe0b751c8278ab07a350cd4d363743b734f4f830.tar.xz
mpd-fe0b751c8278ab07a350cd4d363743b734f4f830.zip
ogg voribs comment parsing on the fly in the decoder
git-svn-id: https://svn.musicpd.org/mpd/trunk@1279 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/decode.c')
-rw-r--r--src/decode.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/decode.c b/src/decode.c
index d403c5e25..e5c1bfa03 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -118,6 +118,8 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) {
DECODE_METADATA_LENGTH); \
pc->metadata[DECODE_METADATA_LENGTH-1] = '\0'; \
pc->title = dc->title; \
+ pc->artist = dc->artist; \
+ pc->album = dc->album; \
} \
pc->metadataState = PLAYER_METADATA_STATE_READ; \
pc->totalTime = dc->totalTime; \
@@ -265,6 +267,8 @@ void decodeStart(PlayerControl * pc, OutputBuffer * cb, DecoderControl * dc) {
dc->metadataSet = 0;
memset(dc->metadata, 0, DECODE_METADATA_LENGTH);
dc->title = -1;
+ dc->album = -1;
+ dc->artist = -1;
strncpy(dc->utf8url, pc->utf8url, MAXPATHLEN);
dc->utf8url[MAXPATHLEN] = '\0';
@@ -595,4 +599,31 @@ void decode() {
decodeParent(pc, dc, cb);
}
-/* vim:set shiftwidth=8 tabstop=8 expandtab: */
+
+/* this is stuff for inputPlugins to use! */
+#define copyStringToMetadata(string, element) { \
+ if(string && (slen = strlen(string)) && \
+ pos < DECODE_METADATA_LENGTH-1) \
+ { \
+ strncpy(dc->metadata+pos, string, \
+ DECODE_METADATA_LENGTH-1-pos); \
+ element = pos; \
+ pos += slen; \
+ } \
+}
+
+void copyMpdTagToDecoderControlMetadata(DecoderControl * dc, MpdTag * tag) {
+ int pos = 0;
+ int slen;
+
+ if(dc->metadataSet) return;
+ if(!tag) return;
+
+ memset(dc->metadata, 0, DECODE_METADATA_LENGTH);
+
+ copyStringToMetadata(tag->title, dc->title);
+ copyStringToMetadata(tag->artist, dc->artist);
+ copyStringToMetadata(tag->album, dc->album);
+
+ dc->metadataSet = 1;
+}