[xiph-cvs] cvs commit: icecast/src format_mp3.c slave.c source.c util.c

Michael Smith msmith at xiph.org
Tue Feb 25 01:40:35 PST 2003



msmith      03/02/25 04:40:35

  Modified:    src      format_mp3.c slave.c source.c util.c
  Log:
  mp3 metadata relaying now works (lots of bugs fixed)

Revision  Changes    Path
1.16      +7 -8      icecast/src/format_mp3.c

Index: format_mp3.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/format_mp3.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- format_mp3.c	24 Feb 2003 13:37:15 -0000	1.15
+++ format_mp3.c	25 Feb 2003 09:40:34 -0000	1.16
@@ -132,7 +132,6 @@
 
     if (len > 1) {
         strncpy(buf+1, fullmetadata + client_state->metadata_offset, len-2);
-        DEBUG1("Sending metadata (%s)", buf+1);
     }
 
     thread_mutex_unlock(&(source_state->lock));
@@ -219,7 +218,7 @@
 
     if(!data)
         return 0;
-    
+
     if(state->inline_metadata_interval) {
         /* Source is sending metadata, handle it... */
 
@@ -257,6 +256,7 @@
 
                 /* According to the "spec"... this byte * 16 */
                 state->metadata_length = byte * 16;
+
                 if(state->metadata_length) {
                     state->metadata_buffer = 
                         calloc(state->metadata_length + 1, 1);
@@ -282,14 +282,13 @@
                 memcpy(state->metadata_buffer + state->metadata_offset, 
                         data, readable);
 
+                state->metadata_offset += readable;
+
                 data += readable;
                 len -= readable;
 
                 if(state->metadata_offset == state->metadata_length)
                 {
-                    state->offset = 0;
-                    state->metadata_length = 0;
-                
                     if(state->metadata_length)
                     {
                         thread_mutex_lock(&(state->lock));
@@ -300,6 +299,9 @@
                         state->metadata_raw = 1;
                         thread_mutex_unlock(&(state->lock));
                     }
+
+                    state->offset = 0;
+                    state->metadata_length = 0;
                 }
             }
         }
@@ -365,7 +367,4 @@
             client->con->sent_bytes += bytes;
     }
 }
-
-
-
 

<p><p>1.20      +10 -1     icecast/src/slave.c

Index: slave.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/slave.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- slave.c	24 Feb 2003 13:37:15 -0000	1.19
+++ slave.c	25 Feb 2003 09:40:34 -0000	1.20
@@ -86,7 +86,13 @@
         }
         con = create_connection(streamsock, NULL);
     if(mp3) {
-    	sock_write(streamsock, "GET %s HTTP/1.0\r\nIcy-MetaData: 1\r\n", 
+        /* Some mp3 servers are bitchy, send a user-agent string to make them
+         * send the right response.
+         */
+    	sock_write(streamsock, "GET %s HTTP/1.0\r\n"
+                               "User-Agent: " ICECAST_VERSION_STRING "\r\n"
+                               "Icy-MetaData: 1\r\n"
+                               "\r\n", 
                 remotemount);
     }
     else {
@@ -94,6 +100,7 @@
     }
         memset(header, 0, sizeof(header));
         if (util_read_header(con->sock, header, 4096) == 0) {
+        WARN0("Header read failed");
                 connection_close(con);
                 return;
         }
@@ -114,8 +121,10 @@
     client = client_create(con, parser);
         if (!connection_create_source(client, con, parser, 
                 httpp_getvar(parser, HTTPP_VAR_URI))) {
+        DEBUG0("Failed to create source");
         client_destroy(client);
         }
+
     return;
 }
 

<p><p>1.36      +2 -0      icecast/src/source.c

Index: source.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/source.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- source.c	24 Feb 2003 13:37:15 -0000	1.35
+++ source.c	25 Feb 2003 09:40:34 -0000	1.36
@@ -284,6 +284,8 @@
             }
     }
 
+    DEBUG0("Source creation complete");
+
         while (global.running == ICE_RUNNING && source->running) {
                 if(!suppress_yp) {
             current_time = time(NULL);

<p><p>1.16      +1 -1      icecast/src/util.c

Index: util.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/util.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- util.c	31 Dec 2002 06:28:38 -0000	1.15
+++ util.c	25 Feb 2003 09:40:34 -0000	1.16
@@ -94,7 +94,7 @@
                                 }
                         }
                 } else {
-			break;
+    		break;
                 }
         }
 

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list