2004-01-28 20:02:12 -05:00
|
|
|
/* Icecast
|
|
|
|
*
|
|
|
|
* This program is distributed under the GNU General Public License, version 2.
|
|
|
|
* A copy of this license is included with this source.
|
|
|
|
*
|
|
|
|
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
|
|
|
* Michael Smith <msmith@xiph.org>,
|
|
|
|
* oddsock <oddsock@xiph.org>,
|
|
|
|
* Karl Heyes <karl@xiph.org>
|
|
|
|
* and others (see AUTHORS for details).
|
|
|
|
*/
|
|
|
|
|
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-07-16 15:41:59 -04:00
|
|
|
#include "httpp/httpp.h"
|
2002-12-29 03:10:10 -05:00
|
|
|
|
2002-12-30 02:55:56 -05:00
|
|
|
struct source_tag;
|
2005-05-07 16:18:13 -04:00
|
|
|
struct _mount_proxy;
|
2002-12-30 02:55:56 -05:00
|
|
|
|
2001-09-09 22:21:46 -04:00
|
|
|
typedef enum _format_type_tag
|
|
|
|
{
|
2004-12-07 16:06:26 -05:00
|
|
|
FORMAT_ERROR, /* No format, source not processable */
|
|
|
|
FORMAT_TYPE_OGG,
|
|
|
|
FORMAT_TYPE_GENERIC
|
2001-09-09 22:21:46 -04:00
|
|
|
} format_type_t;
|
|
|
|
|
|
|
|
typedef struct _format_plugin_tag
|
|
|
|
{
|
2003-03-14 21:10:19 -05:00
|
|
|
format_type_t type;
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2003-03-14 21:10:19 -05:00
|
|
|
/* we need to know the mount to report statistics */
|
|
|
|
char *mount;
|
2002-02-04 02:08:52 -05:00
|
|
|
|
2004-11-18 18:49:59 -05:00
|
|
|
char *contenttype;
|
2005-05-08 09:51:05 -04:00
|
|
|
uint64_t read_bytes;
|
|
|
|
uint64_t sent_bytes;
|
2002-08-10 04:01:56 -04:00
|
|
|
|
2004-08-20 11:13:59 -04:00
|
|
|
refbuf_t *(*get_buffer)(struct source_tag *);
|
2005-06-07 21:36:51 -04:00
|
|
|
int (*write_buf_to_client)(client_t *client);
|
2004-08-20 11:13:59 -04:00
|
|
|
void (*write_buf_to_file)(struct source_tag *source, refbuf_t *refbuf);
|
|
|
|
int (*create_client_data)(struct source_tag *source, client_t *client);
|
2004-12-07 16:06:26 -05:00
|
|
|
void (*set_tag)(struct _format_plugin_tag *plugin, char *tag, char *value);
|
2003-03-14 21:10:19 -05:00
|
|
|
void (*free_plugin)(struct _format_plugin_tag *self);
|
2005-05-07 16:18:13 -04:00
|
|
|
void (*apply_settings)(client_t *client, struct _format_plugin_tag *format, struct _mount_proxy *mount);
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2003-03-14 21:10:19 -05:00
|
|
|
/* for internal state management */
|
|
|
|
void *_state;
|
2001-09-09 22:21:46 -04:00
|
|
|
} 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);
|
2004-08-20 11:13:59 -04:00
|
|
|
int format_get_plugin(format_type_t type, struct source_tag *source);
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2005-06-07 21:36:51 -04:00
|
|
|
int format_generic_write_to_client (client_t *client);
|
2005-06-03 11:35:52 -04:00
|
|
|
int format_advance_queue (struct source_tag *source, client_t *client);
|
2005-06-07 21:36:51 -04:00
|
|
|
int format_check_http_buffer (struct source_tag *source, client_t *client);
|
2005-06-03 11:35:52 -04:00
|
|
|
int format_check_file_buffer (struct source_tag *source, client_t *client);
|
|
|
|
|
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__ */
|
|
|
|
|