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