aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-02 17:02:28 +0100
committerMax Kellermann <max@duempel.org>2008-11-02 17:02:28 +0100
commit020c04e7020226a258e6dbffe3435944264823d1 (patch)
treeee7f8ec54b0a89506f89fb74f3619cd7e2fdbd17
parent5b13f067cd38b23e567acf16fd8506dcbdad9b31 (diff)
downloadmpd-020c04e7020226a258e6dbffe3435944264823d1.tar.gz
mpd-020c04e7020226a258e6dbffe3435944264823d1.tar.xz
mpd-020c04e7020226a258e6dbffe3435944264823d1.zip
decoder_api: added decoder_tag()
Provide an API for submitting additional tags from the stream.
Diffstat (limited to '')
-rw-r--r--src/decoder/oggvorbis_plugin.c8
-rw-r--r--src/decoder_api.c13
-rw-r--r--src/decoder_api.h11
3 files changed, 30 insertions, 2 deletions
diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c
index d950c4e1d..47192ae68 100644
--- a/src/decoder/oggvorbis_plugin.c
+++ b/src/decoder/oggvorbis_plugin.c
@@ -179,7 +179,9 @@ static struct tag *oggCommentsParse(char **comments)
return tag;
}
-static void putOggCommentsIntoOutputBuffer(char *streamName,
+static void putOggCommentsIntoOutputBuffer(struct decoder *decoder,
+ struct input_stream *is,
+ char *streamName,
char **comments)
{
struct tag *tag;
@@ -196,6 +198,7 @@ static void putOggCommentsIntoOutputBuffer(char *streamName,
tag_add_item(tag, TAG_ITEM_NAME, streamName);
}
+ decoder_tag(decoder, is, tag);
tag_free(tag);
}
@@ -284,7 +287,8 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
initialized = true;
}
comments = ov_comment(&vf, -1)->user_comments;
- putOggCommentsIntoOutputBuffer(inStream->meta_name,
+ putOggCommentsIntoOutputBuffer(decoder, inStream,
+ inStream->meta_name,
comments);
ogg_getReplayGainInfo(comments, &replayGainInfo);
}
diff --git a/src/decoder_api.c b/src/decoder_api.c
index e2879808d..bab24daed 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -190,3 +190,16 @@ decoder_data(struct decoder *decoder,
return DECODE_COMMAND_NONE;
}
+
+enum decoder_command
+decoder_tag(mpd_unused struct decoder *decoder, struct input_stream *is,
+ const struct tag *tag)
+{
+ while (!music_pipe_tag(tag)) {
+ enum decoder_command cmd = need_chunks(is);
+ if (cmd != DECODE_COMMAND_NONE)
+ return cmd;
+ }
+
+ return DECODE_COMMAND_NONE;
+}
diff --git a/src/decoder_api.h b/src/decoder_api.h
index a755dd3c9..486712d99 100644
--- a/src/decoder_api.h
+++ b/src/decoder_api.h
@@ -155,4 +155,15 @@ decoder_data(struct decoder *decoder,
void *data, size_t datalen, float data_time, uint16_t bitRate,
ReplayGainInfo * replayGainInfo);
+/**
+ * This function is called by the decoder plugin when it has
+ * successfully decoded a tag.
+ *
+ * @param is an input stream which is buffering while we are waiting
+ * for the player
+ */
+enum decoder_command
+decoder_tag(struct decoder *decoder, struct input_stream *is,
+ const struct tag *tag);
+
#endif