2001-09-10 02:21:46 +00:00
|
|
|
/* format.h
|
|
|
|
**
|
|
|
|
** format plugin header
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
#ifndef __FORMAT_H__
|
|
|
|
#define __FORMAT_H__
|
|
|
|
|
2002-12-29 08:10:10 +00:00
|
|
|
#include "client.h"
|
|
|
|
#include "refbuf.h"
|
|
|
|
|
2001-09-10 02:21:46 +00:00
|
|
|
typedef enum _format_type_tag
|
|
|
|
{
|
|
|
|
FORMAT_TYPE_VORBIS,
|
|
|
|
FORMAT_TYPE_MP3
|
|
|
|
} format_type_t;
|
|
|
|
|
|
|
|
typedef struct _format_plugin_tag
|
|
|
|
{
|
|
|
|
format_type_t type;
|
|
|
|
|
2002-02-04 07:08:52 +00:00
|
|
|
/* we need to know the mount to report statistics */
|
|
|
|
char *mount;
|
|
|
|
|
2002-08-10 08:01:56 +00:00
|
|
|
char *format_description;
|
|
|
|
|
2001-09-10 02:21:46 +00:00
|
|
|
/* set this is the data format has a header that
|
|
|
|
** we must send before regular data
|
|
|
|
*/
|
|
|
|
int has_predata;
|
|
|
|
|
2002-04-05 09:28:26 +00:00
|
|
|
int (*get_buffer)(struct _format_plugin_tag *self, char *data, unsigned long
|
|
|
|
len, refbuf_t **buffer);
|
2001-09-10 02:21:46 +00:00
|
|
|
refbuf_queue_t *(*get_predata)(struct _format_plugin_tag *self);
|
2002-12-29 08:10:10 +00:00
|
|
|
int (*write_buf_to_client)(struct _format_plugin_tag *format,
|
|
|
|
client_t *client, unsigned char *buf, int len);
|
|
|
|
void *(*create_client_data)(struct _format_plugin_tag *format);
|
|
|
|
|
2002-01-05 00:29:27 +00:00
|
|
|
void (*free_plugin)(struct _format_plugin_tag *self);
|
2001-09-10 02:21:46 +00:00
|
|
|
|
|
|
|
/* for internal state management */
|
|
|
|
void *_state;
|
|
|
|
} format_plugin_t;
|
|
|
|
|
2002-02-11 09:11:18 +00:00
|
|
|
format_type_t format_get_type(char *contenttype);
|
2002-07-24 13:55:12 +00:00
|
|
|
char *format_get_mimetype(format_type_t type);
|
2002-02-04 07:08:52 +00:00
|
|
|
format_plugin_t *format_get_plugin(format_type_t type, char *mount);
|
2001-09-10 02:21:46 +00:00
|
|
|
|
2002-12-29 08:10:10 +00:00
|
|
|
int format_generic_write_buf_to_client(format_plugin_t *format,
|
|
|
|
client_t *client, unsigned char *buf, int len);
|
|
|
|
|
2001-09-10 02:21:46 +00:00
|
|
|
#endif /* __FORMAT_H__ */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|