[xiph-commits] r8128 - icecast/branches/kh/icecast/src

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Thu Oct 28 09:40:17 PDT 2004


Author: karl
Date: 2004-10-28 09:40:17 -0700 (Thu, 28 Oct 2004)
New Revision: 8128

Modified:
   icecast/branches/kh/icecast/src/format_mp3.c
   icecast/branches/kh/icecast/src/format_mp3.h
Log:
new clients should not depend on metadata settings from the source stream,
however the interval can be stated in the xml file.


Modified: icecast/branches/kh/icecast/src/format_mp3.c
===================================================================
--- icecast/branches/kh/icecast/src/format_mp3.c	2004-10-28 16:11:10 UTC (rev 8127)
+++ icecast/branches/kh/icecast/src/format_mp3.c	2004-10-28 16:40:17 UTC (rev 8128)
@@ -98,6 +98,7 @@
     meta = refbuf_new (1);
     memcpy (meta->data, "", 1);
     state->metadata = meta;
+    state->interval = -1;
 
     metadata = httpp_getvar (source->parser, "icy-metaint");
     if (metadata)
@@ -185,7 +186,7 @@
 {
     mp3_state *source_mp3 = source->format->_state;
 
-    source_mp3->interval = ICY_METADATA_INTERVAL;
+    source_mp3->interval = -1;
     if (mount->mp3_meta_interval >= 0)
         source_mp3->interval = mount->mp3_meta_interval;
     DEBUG2 ("mp3 interval %d, %d", mount->mp3_meta_interval, source_mp3->interval);
@@ -574,6 +575,7 @@
 {
     mp3_client_data *client_mp3 = calloc(1,sizeof(mp3_client_data));
     mp3_state *source_mp3 = source->format->_state;
+    char *metadata = httpp_getvar(client->parser, "icy-metadata");
 
     if (client_mp3 == NULL)
     {
@@ -583,22 +585,21 @@
 
     client->format_data = client_mp3;
     client->free_client_data = free_mp3_client_data;
-    if (source_mp3->interval > 0)
+    
+    if (metadata && atoi(metadata) && source_mp3->interval)
     {
-        char *metadata = httpp_getvar(client->parser, "icy-metadata");
-    
-        if (metadata && atoi(metadata))
-        {
-            unsigned remaining = client->predata_size - client->predata_len + 2;
-            char *ptr = client->predata + client->predata_len - 2;
-            int bytes;
+        unsigned remaining = client->predata_size - client->predata_len + 2;
+        char *ptr = client->predata + client->predata_len - 2;
+        int bytes;
 
+        if (source_mp3->interval < 0)
+            client_mp3->interval = ICY_METADATA_INTERVAL;
+        else
             client_mp3->interval = source_mp3->interval;
-            bytes = snprintf (ptr, remaining, "icy-metaint:%u\r\n\r\n",
-                    client_mp3->interval);
-            if (bytes > 0)
-                client->predata_len += bytes - 2;
-        }
+        bytes = snprintf (ptr, remaining, "icy-metaint:%u\r\n\r\n",
+                client_mp3->interval);
+        if (bytes > 0)
+            client->predata_len += bytes - 2;
     }
 
     return 0;

Modified: icecast/branches/kh/icecast/src/format_mp3.h
===================================================================
--- icecast/branches/kh/icecast/src/format_mp3.h	2004-10-28 16:11:10 UTC (rev 8127)
+++ icecast/branches/kh/icecast/src/format_mp3.h	2004-10-28 16:40:17 UTC (rev 8128)
@@ -22,7 +22,7 @@
     /* These are for inline metadata */
     int inline_metadata_interval;
     int offset;
-    unsigned interval;
+    int interval;
     char *url_artist;
     char *url_title;
     int update_metadata;



More information about the commits mailing list