1 /* Icecast
2  *
3  * This program is distributed under the GNU General Public License, version 2.
4  * A copy of this license is included with this source.
5  *
6  * Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
7  *                      Michael Smith <msmith@xiph.org>,
8  *                      oddsock <oddsock@xiph.org>,
9  *                      Karl Heyes <karl@xiph.org>
10  *                      and others (see AUTHORS for details).
11  */
12 
13 /* format_ogg.h
14 **
15 ** vorbis format plugin header
16 **
17 */
18 #ifndef __FORMAT_OGG_H__
19 #define __FORMAT_OGG_H__
20 
21 #include <ogg/ogg.h>
22 #include "refbuf.h"
23 #include "format.h"
24 
25 typedef struct ogg_state_tag
26 {
27     char *mount;
28     ogg_sync_state oy;
29     int error;
30 
31     int codec_count;
32     struct ogg_codec_tag *codecs;
33     char *artist;
34     char *title;
35     int log_metadata;
36     int use_url_metadata;
37     int passthrough;
38     int admin_comments_only;
39     refbuf_t *file_headers;
40     refbuf_t *header_pages;
41     refbuf_t *header_pages_tail;
42     refbuf_t **bos_end;
43     int bos_completed;
44     long bitrate;
45     int filter_theora;
46     struct ogg_codec_tag *current;
47     struct ogg_codec_tag *codec_sync;
48 } ogg_state_t;
49 
50 
51 /* per codec/logical structure */
52 typedef struct ogg_codec_tag
53 {
54     struct ogg_codec_tag *next;
55     ogg_state_t *parent;
56     ogg_stream_state os;
57     unsigned headers;
58     const char *name;
59     int filtered;
60     void *specific;
61     refbuf_t        *possible_start;
62     refbuf_t        *page;
63 
64     refbuf_t *(*process)(ogg_state_t *ogg_info, struct ogg_codec_tag *codec);
65     refbuf_t *(*process_page)(ogg_state_t *ogg_info,
66             struct ogg_codec_tag *codec, ogg_page *page);
67     void (*codec_free)(ogg_state_t *ogg_info, struct ogg_codec_tag *codec);
68     int  (*get_image)(client_t *client, struct ogg_codec_tag *codec);
69 } ogg_codec_t;
70 
71 
72 refbuf_t *make_refbuf_with_page (ogg_codec_t *codec, ogg_page *page);
73 void format_ogg_attach_header (ogg_codec_t *codec, ogg_page *page);
74 void format_ogg_free_headers (ogg_state_t *ogg_info);
75 int  format_ogg_get_plugin (format_plugin_t *plugin);
76 
77 #endif  /* __FORMAT_OGG_H__ */
78