1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-06-23 06:25:24 +00:00
icecast-server/src/format.c
Michael Smith cb398ff41c Bunch of fixes:
- connections are now matched to format plugins based on content-type headers,
   and are rejected if there isn't a format handler for that content-type, or
   there is no content-type at all.
 - format_vorbis now handles pages with granulepos of -1 in the headers
   correctly (this happens if the headers are fairly large, because of
   many comments, for example).
 - various #include fixes.
 - buffer overflow in httpp.c fixed.

svn path=/trunk/avl/; revision=3042
2002-02-11 09:11:18 +00:00

44 lines
745 B
C

/* format.c
**
** format plugin implementation
**
*/
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "connection.h"
#include "refbuf.h"
#include "format.h"
#include "format_vorbis.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
return -1;
}
format_plugin_t *format_get_plugin(format_type_t type, char *mount)
{
format_plugin_t *plugin;
switch (type) {
case FORMAT_TYPE_VORBIS:
plugin = format_vorbis_get_plugin();
if (plugin) plugin->mount = mount;
break;
default:
plugin = NULL;
break;
}
return plugin;
}