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

Michael Smith msmith at xiph.org
Mon Dec 30 03:27:21 PST 2002



msmith      02/12/30 06:27:21

  Modified:    src      format_mp3.c
  Log:
  Fix some minor errors.

Revision  Changes    Path
1.6       +11 -4     icecast/src/format_mp3.c

Index: format_mp3.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/format_mp3.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- format_mp3.c	30 Dec 2002 11:22:59 -0000	1.5
+++ format_mp3.c	30 Dec 2002 11:27:21 -0000	1.6
@@ -63,6 +63,8 @@
 
         plugin->_state = state;
 
+    state->metadata_age = 0;
+    state->metadata = strdup("");
     thread_mutex_create(&(state->lock));
 
         return plugin;
@@ -88,10 +90,13 @@
     }
 
     source_age = source_state->metadata_age;
-    send_metadata = (source_age != client_state->metadata_age) || 
-        client_state->metadata_offset;
-    len_byte = send_metadata?(strlen(source_state->metadata)/16 + 1 - 
-            client_state->metadata_offset):0;
+    send_metadata = source_age != client_state->metadata_age;
+
+    if(send_metadata && strlen(source_state->metadata) > 0)
+        len_byte = strlen(source_state->metadata)/16 + 1 - 
+            client_state->metadata_offset;
+    else
+        len_byte = 0;
     len = 1 + len_byte*16;
     buf = alloca(len);
 
@@ -163,6 +168,8 @@
         /* free the plugin instance */
     mp3_state *state = self->_state;
     thread_mutex_destroy(&(state->lock));
+
+    free(state->metadata);
     free(state);
         free(self);
 }

<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