aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-03 20:20:09 +0100
committerMax Kellermann <max@duempel.org>2008-11-03 20:20:09 +0100
commitb3dfcfef52f30ccdec4011bf0c9fa051feb3590e (patch)
treede359bebd05345366c5ff1a6b6ba6d6cd32cbcb4
parentac96022c1de5573b9c4ff03990ac07c4bba8e3f9 (diff)
downloadmpd-b3dfcfef52f30ccdec4011bf0c9fa051feb3590e.tar.gz
mpd-b3dfcfef52f30ccdec4011bf0c9fa051feb3590e.tar.xz
mpd-b3dfcfef52f30ccdec4011bf0c9fa051feb3590e.zip
decoder_api: send song tag in decoder_data()
Before passing the first chunk to the audio output device, send the current song's tag.
-rw-r--r--src/decoder_api.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c
index 6d577ec79..1f51cb1f6 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -176,14 +176,32 @@ decoder_data(struct decoder *decoder,
char *data;
if (is != NULL && !decoder->stream_tag_sent) {
- struct tag *tag1 = tag_new(), *tag2;
-
- tag2 = tag_add_stream_tags(tag1, is);
- tag_free(tag1);
-
- if (tag2 != NULL) {
- music_pipe_tag(tag2);
- tag_free(tag2);
+ const struct tag *src;
+ struct tag *tag1, *tag2;
+
+ /* base is the current song's tag, or an empty new
+ tag if the song has no tag */
+ src = dc.current_song->tag;
+ if (src == NULL)
+ src = tag1 = tag_new();
+ else
+ tag1 = NULL;
+
+ tag2 = tag_add_stream_tags(src, is);
+ if (tag1 != NULL)
+ /* free the empty tag created by tag_new(), we
+ aren't going to send it */
+ tag_free(tag1);
+
+ if (tag2 != NULL)
+ /* use the composite tag returned by
+ tag_add_stream_tags() */
+ src = tag2;
+
+ if (src != NULL) {
+ music_pipe_tag(src);
+ if (tag2 != NULL)
+ tag_free(tag2);
}
decoder->stream_tag_sent = true;