[xiph-cvs] cvs commit: icecast/src format_mp3.c format_mp3.h main.c logging.c format.c Makefile.am

Michael Smith msmith at xiph.org
Tue Jul 23 08:15:12 PDT 2002



msmith      02/07/23 08:15:12

  Modified:    src      main.c logging.c format.c Makefile.am
  Added:       src      format_mp3.c format_mp3.h
  Log:
  MP3 support for icecast2.
  - no title/metadata support
  - requires modifications to source clients.

Revision  Changes    Path
1.10      +2 -2      icecast/src/main.c

Index: main.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/main.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- main.c	2002/05/21 05:22:32	1.9
+++ main.c	2002/07/23 15:15:11	1.10
@@ -172,7 +172,7 @@
 /* chroot the process. Watch out - we need to do this before starting other
  * threads. Change uid as well, after figuring out uid _first_ */
 
-static void _ch_root_uid__setup(void)
+static void _ch_root_uid_setup(void)
 {
    ice_config_t *conf = config_get_config();
 #ifdef CHUID
@@ -289,7 +289,7 @@
 
     _server_proc_init(); /* Bind socket, before we change userid */
 
-    _ch_root_uid__setup(); /* Change user id and root if requested/possible */
+    _ch_root_uid_setup(); /* Change user id and root if requested/possible */
 
     stats_initialize(); /* We have to do this later on because of threading */
 

<p><p>1.3       +2 -2      icecast/src/logging.c

Index: logging.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/logging.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- logging.c	2001/10/20 06:43:04	1.2
+++ logging.c	2002/07/23 15:15:11	1.3
@@ -16,8 +16,8 @@
 #endif
 
 /* the global log descriptors */
-int errorlog;
-int accesslog;
+int errorlog = 0;
+int accesslog = 0;
 
 /* 
 ** ADDR USER AUTH DATE REQUEST CODE BYTES REFERER AGENT [TIME]

<p><p>1.6       +7 -2      icecast/src/format.c

Index: format.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/format.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- format.c	2002/02/19 22:01:51	1.5
+++ format.c	2002/07/23 15:15:11	1.6
@@ -14,13 +14,14 @@
 #include "format.h"
 
 #include "format_vorbis.h"
+#include "format_mp3.h"
 
 format_type_t format_get_type(char *contenttype)
 {
     if(strcmp(contenttype, "application/x-ogg") == 0)
         return FORMAT_TYPE_VORBIS;
-/*    else if(strcmp(contenttype, "audio/mpeg") == 0)
-        return FORMAT_TYPE_MP3; */
+    else if(strcmp(contenttype, "audio/mpeg") == 0)
+        return FORMAT_TYPE_MP3; 
     else
         return -1;
 }
@@ -34,6 +35,10 @@
                 plugin = format_vorbis_get_plugin();
                 if (plugin) plugin->mount = mount;
                 break;
+    case FORMAT_TYPE_MP3:
+        plugin = format_mp3_get_plugin();
+        if (plugin) plugin->mount = mount;
+        break;
         default:
                 plugin = NULL;
                 break;

<p><p>1.5       +4 -3      icecast/src/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Makefile.am	2001/10/21 16:13:02	1.4
+++ Makefile.am	2002/07/23 15:15:11	1.5
@@ -8,10 +8,11 @@
 
 noinst_HEADERS = config.h os.h logging.h sighandler.h connection.h global.h\
          util.h source.h stats.h refbuf.h client.h format.h format_vorbis.h\
-	 compat.h
+	 compat.h format_mp3.h
 icecast_SOURCES = config.c main.c logging.c sighandler.c connection.c global.c\
-	 util.c source.c stats.c refbuf.c client.c format.c format_vorbis.c
-
+	 util.c source.c stats.c refbuf.c client.c format.c format_vorbis.c\
+	 format_mp3.c
+    
 icecast_LDADD = net/libicenet.la thread/libicethread.la httpp/libicehttpp.la\
                 log/libicelog.la avl/libiceavl.la timing/libicetiming.la
 

<p><p>1.1                  icecast/src/format_mp3.c

Index: format_mp3.c
===================================================================
/* format_mp3.c
**
** format plugin for mp3 (no metadata)
**
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "refbuf.h"

#include "stats.h"
#include "format.h"

void format_mp3_free_plugin(format_plugin_t *self);
int format_mp3_get_buffer(format_plugin_t *self, char *data, unsigned long len, refbuf_t **buffer);
refbuf_queue_t *format_mp3_get_predata(format_plugin_t *self);

format_plugin_t *format_mp3_get_plugin(void)
{
        format_plugin_t *plugin;

        plugin = (format_plugin_t *)malloc(sizeof(format_plugin_t));

        plugin->type = FORMAT_TYPE_MP3;
        plugin->has_predata = 0;
        plugin->get_buffer = format_mp3_get_buffer;
        plugin->get_predata = format_mp3_get_predata;
        plugin->free_plugin = format_mp3_free_plugin;

        plugin->_state = NULL;

        return plugin;
}

void format_mp3_free_plugin(format_plugin_t *self)
{
        /* free the plugin instance */
        free(self);
}

int format_mp3_get_buffer(format_plugin_t *self, char *data, unsigned long len, refbuf_t **buffer)
{
        refbuf_t *refbuf;
    if(!data) {
        *buffer = NULL;
        return 0;
    }
    refbuf = refbuf_new(len);

    memcpy(refbuf->data, data, len);

    *buffer = refbuf;
        return 0;
}

refbuf_queue_t *format_mp3_get_predata(format_plugin_t *self)
{
    return NULL;
}

<p><p><p><p><p>1.1                  icecast/src/format_mp3.h

Index: format_mp3.h
===================================================================
/* format_mp3.h
**
** mp3 format plugin
**
*/
#ifndef __FORMAT_MP3_H__
#define __FORMAT_MP3_H__

format_plugin_t *format_mp3_get_plugin(void);

#endif  /* __FORMAT_MP3_H__ */

<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