format.c 750 Bytes
Newer Older
Jack Moffitt's avatar
Jack Moffitt committed
1 2 3 4 5 6 7 8
/* format.c
**
** format plugin implementation
**
*/

#include <stdlib.h>
#include <string.h>
9
#include <time.h>
Jack Moffitt's avatar
Jack Moffitt committed
10 11 12 13 14 15 16 17

#include "connection.h"
#include "refbuf.h"

#include "format.h"

#include "format_vorbis.h"

Michael Smith's avatar
Michael Smith committed
18 19 20 21
format_type_t format_get_type(char *contenttype)
{
    if(strcmp(contenttype, "application/x-ogg") == 0)
        return FORMAT_TYPE_VORBIS;
22 23
/*    else if(strcmp(contenttype, "audio/mpeg") == 0)
        return FORMAT_TYPE_MP3; */
Michael Smith's avatar
Michael Smith committed
24 25 26 27
    else
        return -1;
}

Jack Moffitt's avatar
Jack Moffitt committed
28
format_plugin_t *format_get_plugin(format_type_t type, char *mount)
Jack Moffitt's avatar
Jack Moffitt committed
29 30 31 32 33 34
{
	format_plugin_t *plugin;

	switch (type) {
	case FORMAT_TYPE_VORBIS:
		plugin = format_vorbis_get_plugin();
Jack Moffitt's avatar
Jack Moffitt committed
35
		if (plugin) plugin->mount = mount;
Jack Moffitt's avatar
Jack Moffitt committed
36 37 38 39 40 41 42 43
		break;
	default:
		plugin = NULL;
		break;
	}

	return plugin;
}