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

Michael Smith msmith at xiph.org
Wed Jul 24 06:55:13 PDT 2002



msmith      02/07/24 06:55:13

  Modified:    src      format.c format.h connection.c
  Log:
  Send the correct mimetype on client request.

Revision  Changes    Path
1.7       +14 -0     icecast/src/format.c

Index: format.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/format.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- format.c	2002/07/23 15:15:11	1.6
+++ format.c	2002/07/24 13:55:12	1.7
@@ -26,6 +26,20 @@
         return -1;
 }
 
+char *format_get_mimetype(format_type_t type)
+{
+    switch(type) {
+        case FORMAT_TYPE_VORBIS:
+            return "application/x-ogg";
+            break;
+        case FORMAT_TYPE_MP3:
+            return "audio/mpeg";
+            break;
+        default:
+            return NULL;
+    }
+}
+
 format_plugin_t *format_get_plugin(format_type_t type, char *mount)
 {
         format_plugin_t *plugin;

<p><p>1.6       +1 -0      icecast/src/format.h

Index: format.h
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/format.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- format.h	2002/04/05 09:28:25	1.5
+++ format.h	2002/07/24 13:55:12	1.6
@@ -34,6 +34,7 @@
 } format_plugin_t;
 
 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);
 
 #endif  /* __FORMAT_H__ */

<p><p>1.11      +2 -2      icecast/src/connection.c

Index: connection.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/connection.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- connection.c	2002/05/03 15:04:55	1.10
+++ connection.c	2002/07/24 13:55:12	1.11
@@ -310,7 +310,7 @@
                 if (global.running != ICE_RUNNING) break;
 
                 /* grab a connection and set the socket to blocking */
-		while (con = _get_connection()) {
+		while ((con = _get_connection())) {
                         stats_event_inc(NULL, "connections");
 
                         sock_set_blocking(con->sock, SOCK_BLOCK);
@@ -483,7 +483,7 @@
                                                 
                                                 if (parser->req_type == httpp_req_get) {
                                                         client->respcode = 200;
-							sock_write(client->con->sock, "HTTP/1.0 200 OK\r\nContent-Type: application/x-ogg\r\n");
+							sock_write(client->con->sock, "HTTP/1.0 200 OK\r\nContent-Type: %s\r\n", format_get_mimetype(source->format->type));
                                                         /* iterate through source http headers and send to client */
                                                         avl_tree_rlock(source->parser->vars);
                                                         node = avl_get_first(source->parser->vars);

<p><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