diff options
author | Max Kellermann <max@duempel.org> | 2009-05-05 22:51:17 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-05-05 22:51:17 +0200 |
commit | 4818d386771cfda8a0d2a876468c114778d6f4c2 (patch) | |
tree | 012ff9541e2a5763336982842961bd1f21205c45 /src | |
parent | e55e560d4e48eaa9d2791b56a52a52bc6620df82 (diff) | |
download | mpd-4818d386771cfda8a0d2a876468c114778d6f4c2.tar.gz mpd-4818d386771cfda8a0d2a876468c114778d6f4c2.tar.xz mpd-4818d386771cfda8a0d2a876468c114778d6f4c2.zip |
httpd_output: save the page generated by encoder_tag()
Flush the encoder before calling encoder_tag(). The first page
generated by the encoder after sending the tag will be the new
"header" page, which is sent to all HTTP clients when they connect.
This is a little bit specific to the vorbis encoder, but there are no
other encoders which support tags (yet).
Diffstat (limited to '')
-rw-r--r-- | src/output/httpd_output_plugin.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/output/httpd_output_plugin.c b/src/output/httpd_output_plugin.c index e045e8b5a..6465b108c 100644 --- a/src/output/httpd_output_plugin.c +++ b/src/output/httpd_output_plugin.c @@ -402,8 +402,29 @@ httpd_output_tag(void *data, const struct tag *tag) if (httpd->encoder->plugin->tag != NULL) { /* embed encoder tags */ + struct page *page; + + /* flush the current stream, and end it */ + + encoder_flush(httpd->encoder, NULL); + httpd_output_encoder_to_clients(httpd); + + /* send the tag to the encoder - which starts a new + stream now */ encoder_tag(httpd->encoder, tag, NULL); + + /* the first page generated by the encoder will now be + used as the new "header" page, which is sent to all + new clients */ + + page = httpd_output_read_page(httpd); + if (page != NULL) { + if (httpd->header != NULL) + page_unref(httpd->header); + httpd->header = page; + httpd_output_broadcast_page(httpd, page); + } } else { /* use Icy-Metadata */ |