format_ogg.h 1.81 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
/* 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).
 */

/* format_ogg.h
14 15 16 17
 **
 ** vorbis format plugin header
 **
 */
18 19 20 21 22 23 24 25 26 27 28 29 30
#ifndef __FORMAT_OGG_H__
#define __FORMAT_OGG_H__

#include <ogg/ogg.h>
#include "refbuf.h"
#include "format.h"

typedef struct ogg_state_tag
{
    char *mount;
    ogg_sync_state oy;
    int error;

31
    int codec_count;
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
    struct ogg_codec_tag *codecs;
    int log_metadata;
    refbuf_t *file_headers;
    refbuf_t *header_pages;
    refbuf_t *header_pages_tail;
    refbuf_t **bos_end;
    int bos_completed;
    long bitrate;
    struct ogg_codec_tag *current;
    struct ogg_codec_tag *codec_sync;
} ogg_state_t;


/* per codec/logical structure */
typedef struct ogg_codec_tag
{
    struct ogg_codec_tag *next;
    ogg_stream_state os;
    unsigned headers;
51
    const char *name;
52 53 54 55
    void *specific;
    refbuf_t        *possible_start;
    refbuf_t        *page;

56
    refbuf_t *(*process)(ogg_state_t *ogg_info, struct ogg_codec_tag *codec, format_plugin_t *plugin);
57
    refbuf_t *(*process_page)(ogg_state_t *ogg_info,
58
            struct ogg_codec_tag *codec, ogg_page *page, format_plugin_t *plugin);
59 60 61 62 63 64 65 66 67 68
    void (*codec_free)(ogg_state_t *ogg_info, struct ogg_codec_tag *codec);
} ogg_codec_t;


refbuf_t *make_refbuf_with_page (ogg_page *page);
void format_ogg_attach_header (ogg_state_t *ogg_info, ogg_page *page);
void format_ogg_free_headers (ogg_state_t *ogg_info);
int format_ogg_get_plugin (source_t *source);

#endif  /* __FORMAT_OGG_H__ */