00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _OGG_H
00018 #define _OGG_H
00019
00020 #ifndef __SYMBIAN32__
00021 # define IMPORT_C extern
00022 # define EXPORT_C
00023 #else
00024 # ifndef __cplusplus
00025 # undef IMPORT_C
00026 # define IMPORT_C __declspec(dllexport)
00027 # define EXPORT_C __declspec(dllexport)
00028 # endif
00029 #endif
00030
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034
00035 #include "os_types.h"
00036
00037 typedef struct ogg_buffer_state{
00038 struct ogg_buffer *unused_buffers;
00039 struct ogg_reference *unused_references;
00040 int outstanding;
00041 int shutdown;
00042 } ogg_buffer_state;
00043
00044 typedef struct ogg_buffer {
00045 unsigned char *data;
00046 long size;
00047 int refcount;
00048
00049 union {
00050 ogg_buffer_state *owner;
00051 struct ogg_buffer *next;
00052 } ptr;
00053 } ogg_buffer;
00054
00055 typedef struct ogg_reference {
00056 ogg_buffer *buffer;
00057 long begin;
00058 long length;
00059
00060 struct ogg_reference *next;
00061 } ogg_reference;
00062
00063 typedef struct oggpack_buffer {
00064 int headbit;
00065 unsigned char *headptr;
00066 long headend;
00067
00068
00069 ogg_reference *head;
00070 ogg_reference *tail;
00071
00072
00073 long count;
00074 } oggpack_buffer;
00075
00076 typedef struct oggbyte_buffer {
00077 ogg_reference *baseref;
00078
00079 ogg_reference *ref;
00080 unsigned char *ptr;
00081 long pos;
00082 long end;
00083 } oggbyte_buffer;
00084
00085 typedef struct ogg_sync_state {
00086
00087 ogg_buffer_state *bufferpool;
00088
00089
00090 ogg_reference *fifo_head;
00091 ogg_reference *fifo_tail;
00092 long fifo_fill;
00093
00094
00095 int unsynced;
00096 int headerbytes;
00097 int bodybytes;
00098
00099 } ogg_sync_state;
00100
00101 typedef struct ogg_stream_state {
00102 ogg_reference *header_head;
00103 ogg_reference *header_tail;
00104 ogg_reference *body_head;
00105 ogg_reference *body_tail;
00106
00107 int e_o_s;
00108
00109 int b_o_s;
00110
00111 long serialno;
00112 long pageno;
00113 ogg_int64_t packetno;
00114
00115
00116
00117
00118 ogg_int64_t granulepos;
00119
00120 int lacing_fill;
00121 ogg_uint32_t body_fill;
00122
00123
00124 int holeflag;
00125 int spanflag;
00126 int clearflag;
00127 int laceptr;
00128 ogg_uint32_t body_fill_next;
00129
00130 } ogg_stream_state;
00131
00132 typedef struct {
00133 ogg_reference *packet;
00134 long bytes;
00135 long b_o_s;
00136 long e_o_s;
00137 ogg_int64_t granulepos;
00138 ogg_int64_t packetno;
00139
00140
00141
00142
00143 } ogg_packet;
00144
00145 typedef struct {
00146 ogg_reference *header;
00147 int header_len;
00148 ogg_reference *body;
00149 long body_len;
00150 } ogg_page;
00151
00152
00153
00154 IMPORT_C void oggpack_readinit(oggpack_buffer *b,ogg_reference *r);
00155 IMPORT_C long oggpack_look(oggpack_buffer *b,int bits);
00156 IMPORT_C void oggpack_adv(oggpack_buffer *b,int bits);
00157 IMPORT_C long oggpack_read(oggpack_buffer *b,int bits);
00158 IMPORT_C long oggpack_bytes(oggpack_buffer *b);
00159 IMPORT_C long oggpack_bits(oggpack_buffer *b);
00160 IMPORT_C int oggpack_eop(oggpack_buffer *b);
00161
00162
00163
00164 IMPORT_C ogg_sync_state *ogg_sync_create(void);
00165 IMPORT_C int ogg_sync_destroy(ogg_sync_state *oy);
00166 IMPORT_C int ogg_sync_reset(ogg_sync_state *oy);
00167
00168 IMPORT_C unsigned char *ogg_sync_bufferin(ogg_sync_state *oy, long size);
00169 IMPORT_C int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
00170 IMPORT_C long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
00171 IMPORT_C int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
00172 IMPORT_C int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
00173 IMPORT_C int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
00174 IMPORT_C int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
00175
00176
00177
00178 IMPORT_C ogg_stream_state *ogg_stream_create(int serialno);
00179 IMPORT_C int ogg_stream_destroy(ogg_stream_state *os);
00180 IMPORT_C int ogg_stream_reset(ogg_stream_state *os);
00181 IMPORT_C int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
00182 IMPORT_C int ogg_stream_eos(ogg_stream_state *os);
00183
00184 IMPORT_C int ogg_page_checksum_set(ogg_page *og);
00185
00186 IMPORT_C int ogg_page_version(ogg_page *og);
00187 IMPORT_C int ogg_page_continued(ogg_page *og);
00188 IMPORT_C int ogg_page_bos(ogg_page *og);
00189 IMPORT_C int ogg_page_eos(ogg_page *og);
00190 IMPORT_C ogg_int64_t ogg_page_granulepos(ogg_page *og);
00191 IMPORT_C ogg_uint32_t ogg_page_serialno(ogg_page *og);
00192 IMPORT_C ogg_uint32_t ogg_page_pageno(ogg_page *og);
00193 IMPORT_C int ogg_page_packets(ogg_page *og);
00194 IMPORT_C int ogg_page_getbuffer(ogg_page *og, unsigned char **buffer);
00195
00196 IMPORT_C int ogg_packet_release(ogg_packet *op);
00197 IMPORT_C int ogg_page_release(ogg_page *og);
00198
00199 IMPORT_C void ogg_page_dup(ogg_page *d, ogg_page *s);
00200
00201
00202
00203 #define OGG_SUCCESS 0
00204
00205 #define OGG_HOLE -10
00206 #define OGG_SPAN -11
00207 #define OGG_EVERSION -12
00208 #define OGG_ESERIAL -13
00209 #define OGG_EINVAL -14
00210 #define OGG_EEOS -15
00211
00212
00213 #ifdef __cplusplus
00214 }
00215 #endif
00216
00217 #endif