mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
MP3 support for icecast2.
- no title/metadata support - requires modifications to source clients. svn path=/trunk/icecast/; revision=3713
This commit is contained in:
parent
0d5bd4b2b0
commit
638ccabd55
@ -8,10 +8,11 @@ bin_PROGRAMS = icecast
|
||||
|
||||
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
|
||||
|
||||
|
@ -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 @@ format_plugin_t *format_get_plugin(format_type_t type, char *mount)
|
||||
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;
|
||||
|
64
src/format_mp3.c
Normal file
64
src/format_mp3.c
Normal file
@ -0,0 +1,64 @@
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
||||
|
11
src/format_mp3.h
Normal file
11
src/format_mp3.h
Normal file
@ -0,0 +1,11 @@
|
||||
/* 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__ */
|
@ -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]
|
||||
|
@ -172,7 +172,7 @@ static void _server_proc(void)
|
||||
/* 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 @@ int main(int argc, char **argv)
|
||||
|
||||
_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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user