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
|
2014-11-30 15:32:30 -05:00
|
|
|
**
|
|
|
|
** format plugin header
|
|
|
|
**
|
|
|
|
*/
|
2001-09-09 22:21:46 -04:00
|
|
|
#ifndef __FORMAT_H__
|
|
|
|
#define __FORMAT_H__
|
|
|
|
|
2014-12-09 11:08:27 -05:00
|
|
|
#include <vorbis/codec.h>
|
|
|
|
|
2002-12-29 03:10:10 -05:00
|
|
|
#include "client.h"
|
|
|
|
#include "refbuf.h"
|
2014-12-02 16:50:57 -05:00
|
|
|
#include "common/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,
|
2012-05-18 13:33:17 -04:00
|
|
|
FORMAT_TYPE_EBML,
|
2004-12-07 16:06:26 -05:00
|
|
|
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
|
|
|
|
2014-11-30 15:32:30 -05:00
|
|
|
const char *contenttype;
|
|
|
|
char *charset;
|
|
|
|
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);
|
2007-08-30 19:36:19 -04:00
|
|
|
void (*set_tag)(struct _format_plugin_tag *plugin, const char *tag, const char *value, const char *charset);
|
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
|
|
|
|
2014-12-09 11:08:27 -05:00
|
|
|
/* meta data */
|
|
|
|
vorbis_comment vc;
|
|
|
|
|
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;
|
|
|
|
|
2007-08-16 18:49:13 -04:00
|
|
|
format_type_t format_get_type(const 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);
|
|
|
|
|
2014-12-09 11:08:27 -05:00
|
|
|
|
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
|
|
|
|
2014-12-09 11:08:27 -05:00
|
|
|
void format_set_vorbiscomment(format_plugin_t *plugin, const char *tag, const char *value);
|
|
|
|
|
2001-09-09 22:21:46 -04:00
|
|
|
#endif /* __FORMAT_H__ */
|
|
|
|
|