Brendan Cully
2004-Aug-06  14:57 UTC
[icecast-dev] icecast 2 compatibility with older clients
I've attached a small patch against icecast 2 which converts ice-
headers to icy- headers for clients that include icy- headers in their
request. This allows a few clients (notably xmms) to pick up stream
info they otherwise miss.
-b
-------------- next part --------------
Index: src/format.c
==================================================================RCS file:
/usr/local/cvsroot/icecast/src/format.c,v
retrieving revision 1.20
diff -u -p -r1.20 format.c
--- src/format.c	15 Mar 2003 02:10:17 -0000	1.20
+++ src/format.c	2 Jul 2003 23:17:53 -0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 4; -*- */
 /* format.c
 **
 ** format plugin implementation
@@ -101,7 +102,11 @@ void format_send_general_headers(format_
     http_var_t *var;
     avl_node *node;
     int bytes;
+    char *client_is_icy;
 
+    /* if the client uses icy headers, we'll respond in kind */
+    client_is_icy = httpp_getvar(client->parser, "icy-metadata");
+    
     /* iterate through source http headers and send to client */
     avl_tree_rlock(source->parser->vars);
     node = avl_get_first(source->parser->vars);
@@ -109,8 +114,12 @@ void format_send_general_headers(format_
         var = (http_var_t *)node->key;
         if (strcasecmp(var->name, "ice-password") && 
                 (!strncasecmp("ice-", var->name, 4) ||
-                 !strncasecmp("icy-", var->name, 4))) { 
-            bytes = sock_write(client->con->sock, 
+                 !strncasecmp("icy-", var->name, 4))) {
+	    if (client_is_icy)
+		bytes = sock_write(client->con->sock, "icy%s:%s\r\n",
+				   var->name + 3, var->value);
+	    else
+		bytes = sock_write(client->con->sock, 
                     "%s: %s\r\n", var->name, var->value);
             if(bytes > 0) client->con->sent_bytes += bytes;
         }
+mb+rzqk7&zzmy:.mkabzhj]zrj)
'+a{
+v&{ay,ry'rzg-b"V	~)mz
Brendan Cully
2004-Aug-06  14:57 UTC
[icecast-dev] icecast 2 compatibility with older clients
On Wednesday, 02 July 2003 at 19:19, Brendan Cully wrote:> I've attached a small patch against icecast 2 which converts ice- > headers to icy- headers for clients that include icy- headers in their > request. This allows a few clients (notably xmms) to pick up stream > info they otherwise miss.Per Jack's suggestion, here's a different version that forces icy mode when the stream is MP3 format. -------------- next part -------------- Index: src/format.c ==================================================================RCS file: /usr/local/cvsroot/icecast/src/format.c,v retrieving revision 1.20 diff -u -p -r1.20 format.c --- src/format.c 15 Mar 2003 02:10:17 -0000 1.20 +++ src/format.c 2 Jul 2003 23:45:51 -0000 @@ -1,3 +1,4 @@ +/* -*- c-basic-offset: 4; -*- */ /* format.c ** ** format plugin implementation @@ -109,8 +110,12 @@ void format_send_general_headers(format_ var = (http_var_t *)node->key; if (strcasecmp(var->name, "ice-password") && (!strncasecmp("ice-", var->name, 4) || - !strncasecmp("icy-", var->name, 4))) { - bytes = sock_write(client->con->sock, + !strncasecmp("icy-", var->name, 4))) { + if (source->format->type == FORMAT_TYPE_MP3) + bytes = sock_write(client->con->sock, "icy%s:%s\r\n", + var->name + 3, var->value); + else + bytes = sock_write(client->con->sock, "%s: %s\r\n", var->name, var->value); if(bytes > 0) client->con->sent_bytes += bytes; }
On Wed, Jul 02, 2003 at 07:48:10PM -0400, Brendan Cully wrote:> Per Jack's suggestion, here's a different version that forces icy mode > when the stream is MP3 format.why not just always provide both? it's just a few extra bytes at connect time. <p> -------------- next part -------------- A non-text attachment was scrubbed... Name: part Type: application/pgp-signature Size: 188 bytes Desc: not available Url : http://lists.xiph.org/pipermail/icecast-dev/attachments/20030702/757c40f1/part.pgp