aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/httpd_output_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-05-05 22:41:36 +0200
committerMax Kellermann <max@duempel.org>2009-05-05 22:41:36 +0200
commit9080797025d73eb32ce0c7041a0d365015b51f41 (patch)
treecb04458bb336a255468ab465844645eaf862c57b /src/output/httpd_output_plugin.c
parentebc1d3516c0334a093d8426e52402febb3dd6b00 (diff)
downloadmpd-9080797025d73eb32ce0c7041a0d365015b51f41.tar.gz
mpd-9080797025d73eb32ce0c7041a0d365015b51f41.tar.xz
mpd-9080797025d73eb32ce0c7041a0d365015b51f41.zip
httpd_output: disable Icy-Metadata when encoder supports tags
There's no reason to send both encoder tags and Icy-Metadata to the client. Let's disable Icy-Metadata when the encoder supports embedded tags.
Diffstat (limited to 'src/output/httpd_output_plugin.c')
-rw-r--r--src/output/httpd_output_plugin.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/output/httpd_output_plugin.c b/src/output/httpd_output_plugin.c
index b9befb0d6..883dff773 100644
--- a/src/output/httpd_output_plugin.c
+++ b/src/output/httpd_output_plugin.c
@@ -118,7 +118,9 @@ httpd_output_finish(void *data)
static void
httpd_client_add(struct httpd_output *httpd, int fd)
{
- struct httpd_client *client = httpd_client_new(httpd, fd);
+ struct httpd_client *client =
+ httpd_client_new(httpd, fd,
+ httpd->encoder->plugin->tag == NULL);
httpd->clients = g_list_prepend(httpd->clients, client);
@@ -380,21 +382,28 @@ httpd_output_tag(void *data, const struct tag *tag)
assert(tag != NULL);
- if (httpd->metadata != NULL)
- page_unref (httpd->metadata);
-
- httpd->metadata = icy_server_metadata_page(tag, TAG_ITEM_ALBUM,
- TAG_ITEM_ARTIST,
- TAG_ITEM_TITLE,
- TAG_NUM_OF_ITEM_TYPES);
-
- if (httpd->metadata) {
- g_mutex_lock(httpd->mutex);
- g_list_foreach(httpd->clients, httpd_send_metadata, httpd->metadata);
- g_mutex_unlock(httpd->mutex);
+ if (httpd->encoder->plugin->tag != NULL) {
+ /* embed encoder tags */
+
+ encoder_tag(httpd->encoder, tag, NULL);
+ } else {
+ /* use Icy-Metadata */
+
+ if (httpd->metadata != NULL)
+ page_unref (httpd->metadata);
+
+ httpd->metadata =
+ icy_server_metadata_page(tag, TAG_ITEM_ALBUM,
+ TAG_ITEM_ARTIST,
+ TAG_ITEM_TITLE,
+ TAG_NUM_OF_ITEM_TYPES);
+ if (httpd->metadata != NULL) {
+ g_mutex_lock(httpd->mutex);
+ g_list_foreach(httpd->clients,
+ httpd_send_metadata, httpd->metadata);
+ g_mutex_unlock(httpd->mutex);
+ }
}
-
- encoder_tag(httpd->encoder, tag, NULL);
}
static void