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

Michael Smith msmith at xiph.org
Mon Feb 17 04:05:45 PST 2003



msmith      03/02/17 07:05:45

  Modified:    src      format.c format.h format_mp3.c format_mp3.h
  Log:
  Commit some other work so it compiles again (incomplete mp3 metadata relaying)

Revision  Changes    Path
1.18      +4 -2      icecast/src/format.c

Index: format.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/format.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- format.c	14 Feb 2003 13:17:38 -0000	1.17
+++ format.c	17 Feb 2003 12:05:45 -0000	1.18
@@ -14,6 +14,7 @@
 #include "source.h"
 #include "format.h"
 #include "global.h"
+#include "httpp.h"
 
 #include "format_vorbis.h"
 #include "format_mp3.h"
@@ -53,7 +54,8 @@
     }
 }
 
-format_plugin_t *format_get_plugin(format_type_t type, char *mount)
+format_plugin_t *format_get_plugin(format_type_t type, char *mount, 
+        http_parser_t *parser)
 {
         format_plugin_t *plugin;
 
@@ -63,7 +65,7 @@
                 if (plugin) plugin->mount = mount;
                 break;
     case FORMAT_TYPE_MP3:
-        plugin = format_mp3_get_plugin();
+        plugin = format_mp3_get_plugin(parser);
         if (plugin) plugin->mount = mount;
         break;
         default:

<p><p>1.11      +3 -1      icecast/src/format.h

Index: format.h
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/format.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- format.h	14 Feb 2003 10:31:21 -0000	1.10
+++ format.h	17 Feb 2003 12:05:45 -0000	1.11
@@ -8,6 +8,7 @@
 
 #include "client.h"
 #include "refbuf.h"
+#include "httpp.h"
 
 struct source_tag;
 
@@ -50,7 +51,8 @@
 
 format_type_t format_get_type(char *contenttype);
 char *format_get_mimetype(format_type_t type);
-format_plugin_t *format_get_plugin(format_type_t type, char *mount);
+format_plugin_t *format_get_plugin(format_type_t type, char *mount, 
+        http_parser_t *parser);
 
 int format_generic_write_buf_to_client(format_plugin_t *format, 
         client_t *client, unsigned char *buf, int len);

<p><p>1.14      +20 -5     icecast/src/format_mp3.c

Index: format_mp3.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/format_mp3.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- format_mp3.c	14 Feb 2003 13:39:02 -0000	1.13
+++ format_mp3.c	17 Feb 2003 12:05:45 -0000	1.14
@@ -23,6 +23,9 @@
 
 #define CATMODULE "format-mp3"
 
+/* Note that this seems to be 8192 in shoutcast - perhaps we want to be the
+ * same for compability with crappy clients?
+ */
 #define ICY_METADATA_INTERVAL 16000
 
 static void format_mp3_free_plugin(format_plugin_t *self);
@@ -48,8 +51,9 @@
 #define alloca _alloca
 #endif
 
-format_plugin_t *format_mp3_get_plugin(void)
+format_plugin_t *format_mp3_get_plugin(http_parser_t *parser)
 {
+    char *metadata;
         format_plugin_t *plugin;
     mp3_state *state = calloc(1, sizeof(mp3_state));
 
@@ -71,6 +75,10 @@
     state->metadata = strdup("");
     thread_mutex_create(&(state->lock));
 
+    metadata = httpp_getvar(parser, "icy-metaint");
+    if(metadata)
+        state->inline_metadata_interval = atoi(metadata);
+
         return plugin;
 }
 
@@ -200,16 +208,23 @@
     unsigned long len, refbuf_t **buffer)
 {
         refbuf_t *refbuf;
+    mp3_state *state = self->_state;
+
     if(!data) {
         *buffer = NULL;
         return 0;
     }
-    refbuf = refbuf_new(len);
+    if(state->inline_metadata_interval) {
+        return 0;
+    }
+    else {
+        refbuf = refbuf_new(len);
 
-    memcpy(refbuf->data, data, len);
+        memcpy(refbuf->data, data, len);
 
-    *buffer = refbuf;
-	return 0;
+        *buffer = refbuf;
+	    return 0;
+    }
 }
 
 static refbuf_queue_t *format_mp3_get_predata(format_plugin_t *self)

<p><p>1.4       +3 -1      icecast/src/format_mp3.h

Index: format_mp3.h
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/format_mp3.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- format_mp3.h	30 Dec 2002 11:22:59 -0000	1.3
+++ format_mp3.h	17 Feb 2003 12:05:45 -0000	1.4
@@ -9,9 +9,11 @@
 typedef struct {
     char *metadata;
     int metadata_age;
+    int metadata_formatted;
+    int inline_metadata_interval;
     mutex_t lock;
 } mp3_state;
 
-format_plugin_t *format_mp3_get_plugin(void);
+format_plugin_t *format_mp3_get_plugin(http_parser_t *parser);
 
 #endif  /* __FORMAT_MP3_H__ */

<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