1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-09-22 04:15:54 -04:00

Commit some other work so it compiles again (incomplete mp3 metadata relaying)

svn path=/trunk/icecast/; revision=4353
This commit is contained in:
Michael Smith 2003-02-17 12:05:45 +00:00
parent 76fc62810e
commit 469ac14e11
4 changed files with 30 additions and 9 deletions

View File

@ -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 @@ 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)
{
format_plugin_t *plugin;
@ -63,7 +65,7 @@ format_plugin_t *format_get_plugin(format_type_t type, char *mount)
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:

View File

@ -8,6 +8,7 @@
#include "client.h"
#include "refbuf.h"
#include "httpp.h"
struct source_tag;
@ -50,7 +51,8 @@ typedef struct _format_plugin_tag
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);

View File

@ -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 @@ typedef struct {
#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 @@ format_plugin_t *format_mp3_get_plugin(void)
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 @@ static int format_mp3_get_buffer(format_plugin_t *self, char *data,
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)

View File

@ -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__ */