doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ogg.h
Go to the documentation of this file.
1 /********************************************************************
2  * *
3  * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7  * *
8  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
9  * by the Xiph.Org Foundation http://www.xiph.org/ *
10  * *
11  ********************************************************************
12 
13  function: toplevel libogg include
14  last mod: $Id: ogg.h,v 1.19 2002/09/15 23:48:02 xiphmont Exp $
15 
16  ********************************************************************/
17 #ifndef _OGG_H
18 #define _OGG_H
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #include "os_types.h"
25 
26 typedef struct {
27  long endbyte;
28  int endbit;
29 
30  unsigned char *buffer;
31  unsigned char *ptr;
32  long storage;
34 
35 /* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/
36 
37 typedef struct {
38  unsigned char *header;
39  long header_len;
40  unsigned char *body;
41  long body_len;
42 } ogg_page;
43 
44 /* ogg_stream_state contains the current encode/decode state of a logical
45  Ogg bitstream **********************************************************/
46 
47 typedef struct {
48  unsigned char *body_data; /* bytes from packet bodies */
49  long body_storage; /* storage elements allocated */
50  long body_fill; /* elements stored; fill mark */
51  long body_returned; /* elements of fill returned */
52 
53 
54  int *lacing_vals; /* The values that will go to the segment table */
55  ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact
56  this way, but it is simple coupled to the
57  lacing fifo */
62 
63  unsigned char header[282]; /* working space for header encode */
65 
66  int e_o_s; /* set when we have buffered the last packet in the
67  logical bitstream */
68  int b_o_s; /* set after we've written the initial page
69  of a logical bitstream */
70  long serialno;
71  long pageno;
72  ogg_int64_t packetno; /* sequence number for decode; the framing
73  knows where there's a hole in the data,
74  but we need coupling so that the codec
75  (which is in a seperate abstraction
76  layer) also knows about the gap */
78 
80 
81 /* ogg_packet is used to encapsulate the data and metadata belonging
82  to a single raw Ogg/Vorbis packet *************************************/
83 
84 typedef struct {
85  unsigned char *packet;
86  long bytes;
87  long b_o_s;
88  long e_o_s;
89 
91 
92  ogg_int64_t packetno; /* sequence number for decode; the framing
93  knows where there's a hole in the data,
94  but we need coupling so that the codec
95  (which is in a seperate abstraction
96  layer) also knows about the gap */
97 } ogg_packet;
98 
99 typedef struct {
100  unsigned char *data;
101  int storage;
102  int fill;
103  int returned;
104 
105  int unsynced;
109 
110 /* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
111 
112 extern void oggpack_writeinit(oggpack_buffer *b);
113 extern void oggpack_writetrunc(oggpack_buffer *b,long bits);
114 extern void oggpack_writealign(oggpack_buffer *b);
115 extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits);
116 extern void oggpack_reset(oggpack_buffer *b);
117 extern void oggpack_writeclear(oggpack_buffer *b);
118 extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
119 extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits);
120 extern long oggpack_look(oggpack_buffer *b,int bits);
121 extern long oggpack_look1(oggpack_buffer *b);
122 extern void oggpack_adv(oggpack_buffer *b,int bits);
123 extern void oggpack_adv1(oggpack_buffer *b);
124 extern long oggpack_read(oggpack_buffer *b,int bits);
125 extern long oggpack_read1(oggpack_buffer *b);
126 extern long oggpack_bytes(oggpack_buffer *b);
127 extern long oggpack_bits(oggpack_buffer *b);
128 extern unsigned char *oggpack_get_buffer(oggpack_buffer *b);
129 
130 extern void oggpackB_writeinit(oggpack_buffer *b);
131 extern void oggpackB_writetrunc(oggpack_buffer *b,long bits);
132 extern void oggpackB_writealign(oggpack_buffer *b);
133 extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits);
134 extern void oggpackB_reset(oggpack_buffer *b);
135 extern void oggpackB_writeclear(oggpack_buffer *b);
136 extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
137 extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits);
138 extern long oggpackB_look(oggpack_buffer *b,int bits);
139 extern long oggpackB_look1(oggpack_buffer *b);
140 extern void oggpackB_adv(oggpack_buffer *b,int bits);
141 extern void oggpackB_adv1(oggpack_buffer *b);
142 extern long oggpackB_read(oggpack_buffer *b,int bits);
143 extern long oggpackB_read1(oggpack_buffer *b);
144 extern long oggpackB_bytes(oggpack_buffer *b);
145 extern long oggpackB_bits(oggpack_buffer *b);
146 extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b);
147 
148 /* Ogg BITSTREAM PRIMITIVES: encoding **************************/
149 
150 extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
151 extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
152 extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
153 
154 /* Ogg BITSTREAM PRIMITIVES: decoding **************************/
155 
156 extern int ogg_sync_init(ogg_sync_state *oy);
157 extern int ogg_sync_clear(ogg_sync_state *oy);
158 extern int ogg_sync_reset(ogg_sync_state *oy);
159 extern int ogg_sync_destroy(ogg_sync_state *oy);
160 
161 extern char *ogg_sync_buffer(ogg_sync_state *oy, long size);
162 extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
163 extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
164 extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
165 extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
168 
169 /* Ogg BITSTREAM PRIMITIVES: general ***************************/
170 
171 extern int ogg_stream_init(ogg_stream_state *os,int serialno);
172 extern int ogg_stream_clear(ogg_stream_state *os);
173 extern int ogg_stream_reset(ogg_stream_state *os);
174 extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
175 extern int ogg_stream_destroy(ogg_stream_state *os);
176 extern int ogg_stream_eos(ogg_stream_state *os);
177 
178 extern void ogg_page_checksum_set(ogg_page *og);
179 
180 extern int ogg_page_version(ogg_page *og);
181 extern int ogg_page_continued(ogg_page *og);
182 extern int ogg_page_bos(ogg_page *og);
183 extern int ogg_page_eos(ogg_page *og);
185 extern int ogg_page_serialno(ogg_page *og);
186 extern long ogg_page_pageno(ogg_page *og);
187 extern int ogg_page_packets(ogg_page *og);
188 
189 extern void ogg_packet_clear(ogg_packet *op);
190 
191 
192 #ifdef __cplusplus
193 }
194 #endif
195 
196 #endif /* _OGG_H */
197 
198 
199 
200 
201 
202 
unsigned char * ptr
Definition: ogg.h:31
long lacing_storage
Definition: ogg.h:58
int ogg_page_bos(ogg_page *og)
Definition: framing.c:37
int b_o_s
Definition: ogg.h:68
GLsizei const GLfloat * value
Definition: glext.h:3614
int fill
Definition: ogg.h:102
long oggpackB_bits(oggpack_buffer *b)
Definition: bitwise.c:438
Definition: ogg.h:37
int ogg_stream_flush(ogg_stream_state *os, ogg_page *og)
Definition: framing.c:334
unsigned char * body
Definition: ogg.h:40
long oggpack_bits(oggpack_buffer *b)
Definition: bitwise.c:430
long oggpack_look(oggpack_buffer *b, int bits)
Definition: bitwise.c:225
ogg_int64_t ogg_page_granulepos(ogg_page *og)
Definition: framing.c:45
long body_fill
Definition: ogg.h:50
void oggpackB_writeclear(oggpack_buffer *b)
Definition: bitwise.c:210
unsigned char * oggpackB_get_buffer(oggpack_buffer *b)
Definition: bitwise.c:446
long lacing_fill
Definition: ogg.h:59
Definition: ogg.h:84
unsigned char * data
Definition: ogg.h:100
long storage
Definition: ogg.h:32
unsigned char * body_data
Definition: ogg.h:48
long oggpackB_read(oggpack_buffer *b, int bits)
Definition: bitwise.c:348
void oggpackB_writecopy(oggpack_buffer *b, void *source, long bits)
Definition: bitwise.c:191
long header_len
Definition: ogg.h:39
long body_returned
Definition: ogg.h:51
void oggpack_write(oggpack_buffer *b, unsigned long value, int bits)
Definition: bitwise.c:69
int ogg_page_serialno(ogg_page *og)
Definition: framing.c:58
long oggpackB_bytes(oggpack_buffer *b)
Definition: bitwise.c:434
int ogg_sync_wrote(ogg_sync_state *oy, long bytes)
Definition: framing.c:531
long oggpack_look1(oggpack_buffer *b)
Definition: bitwise.c:278
int bodybytes
Definition: ogg.h:107
void oggpackB_adv1(oggpack_buffer *b)
Definition: bitwise.c:307
int unsynced
Definition: ogg.h:105
int ogg_stream_eos(ogg_stream_state *os)
Definition: framing.c:461
ogg_int64_t * granule_vals
Definition: ogg.h:55
void oggpack_writetrunc(oggpack_buffer *b, long bits)
Definition: bitwise.c:50
long ogg_page_pageno(ogg_page *og)
Definition: framing.c:65
void oggpack_writecopy(oggpack_buffer *b, void *source, long bits)
Definition: bitwise.c:187
int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og)
Definition: framing.c:643
long serialno
Definition: ogg.h:70
void oggpackB_reset(oggpack_buffer *b)
Definition: bitwise.c:201
void oggpackB_write(oggpack_buffer *b, unsigned long value, int bits)
Definition: bitwise.c:103
GLsizei GLsizei GLcharARB * source
Definition: glext.h:3633
void oggpack_adv(oggpack_buffer *b, int bits)
Definition: bitwise.c:288
int endbit
Definition: ogg.h:28
char * ogg_sync_buffer(ogg_sync_state *oy, long size)
Definition: framing.c:506
int ogg_sync_reset(ogg_sync_state *oy)
Definition: framing.c:798
void oggpackB_writetrunc(oggpack_buffer *b, long bits)
Definition: bitwise.c:59
long oggpackB_look(oggpack_buffer *b, int bits)
Definition: bitwise.c:252
long pageno
Definition: ogg.h:71
int storage
Definition: ogg.h:101
long bytes
Definition: ogg.h:86
void oggpackB_adv(oggpack_buffer *b, int bits)
Definition: bitwise.c:295
int * lacing_vals
Definition: ogg.h:54
long oggpackB_look1(oggpack_buffer *b)
Definition: bitwise.c:283
int ogg_stream_packetpeek(ogg_stream_state *os, ogg_packet *op)
Definition: framing.c:890
int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op)
Definition: framing.c:272
int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og)
Definition: framing.c:674
unsigned char * packet
Definition: ogg.h:85
void ogg_packet_clear(ogg_packet *op)
Definition: framing.c:894
void ogg_page_checksum_set(ogg_page *og)
Definition: framing.c:248
long oggpackB_read1(oggpack_buffer *b)
Definition: bitwise.c:404
int ogg_page_version(ogg_page *og)
Definition: framing.c:29
void oggpack_adv1(oggpack_buffer *b)
Definition: bitwise.c:299
int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og)
Definition: framing.c:447
void oggpack_readinit(oggpack_buffer *b, unsigned char *buf, int bytes)
Definition: bitwise.c:214
int ogg_sync_clear(ogg_sync_state *oy)
Definition: framing.c:490
long endbyte
Definition: ogg.h:27
int ogg_sync_destroy(ogg_sync_state *oy)
Definition: framing.c:498
unsigned char * header
Definition: ogg.h:38
long b_o_s
Definition: ogg.h:87
GLubyte GLubyte b
Definition: glext.h:4662
int ogg_stream_clear(ogg_stream_state *os)
Definition: framing.c:207
long lacing_returned
Definition: ogg.h:61
#define bits
Definition: Unzip.cpp:3797
long ogg_sync_pageseek(ogg_sync_state *oy, ogg_page *og)
Definition: framing.c:547
ogg_int64_t packetno
Definition: ogg.h:72
int ogg_page_continued(ogg_page *og)
Definition: framing.c:33
int ogg_stream_destroy(ogg_stream_state *os)
Definition: framing.c:218
GLsizeiptr size
Definition: glext.h:3112
void oggpack_writeinit(oggpack_buffer *b)
Definition: bitwise.c:39
long oggpack_bytes(oggpack_buffer *b)
Definition: bitwise.c:426
ogg_int64_t granulepos
Definition: ogg.h:90
int ogg_stream_packetout(ogg_stream_state *os, ogg_packet *op)
Definition: framing.c:886
void oggpack_reset(oggpack_buffer *b)
Definition: bitwise.c:195
unsigned char * oggpack_get_buffer(oggpack_buffer *b)
Definition: bitwise.c:442
int ogg_page_eos(ogg_page *og)
Definition: framing.c:41
int ogg_page_packets(ogg_page *og)
Definition: framing.c:91
int ogg_stream_reset(ogg_stream_state *os)
Definition: framing.c:807
int ogg_sync_init(ogg_sync_state *oy)
Definition: framing.c:482
int e_o_s
Definition: ogg.h:66
int returned
Definition: ogg.h:103
int header_fill
Definition: ogg.h:64
void oggpackB_writeinit(oggpack_buffer *b)
Definition: bitwise.c:46
int ogg_stream_reset_serialno(ogg_stream_state *os, int serialno)
Definition: framing.c:826
void oggpack_writealign(oggpack_buffer *b)
Definition: bitwise.c:136
long body_len
Definition: ogg.h:41
void oggpack_writeclear(oggpack_buffer *b)
Definition: bitwise.c:205
int64_t ogg_int64_t
Definition: os_types.h:140
long oggpack_read(oggpack_buffer *b, int bits)
Definition: bitwise.c:312
long lacing_packet
Definition: ogg.h:60
long e_o_s
Definition: ogg.h:88
int headerbytes
Definition: ogg.h:106
ogg_int64_t granulepos
Definition: ogg.h:77
long oggpack_read1(oggpack_buffer *b)
Definition: bitwise.c:382
unsigned char * buffer
Definition: ogg.h:30
int ogg_stream_init(ogg_stream_state *os, int serialno)
Definition: framing.c:188
ogg_int64_t packetno
Definition: ogg.h:92
long body_storage
Definition: ogg.h:49
void oggpackB_readinit(oggpack_buffer *b, unsigned char *buf, int bytes)
Definition: bitwise.c:220
void oggpackB_writealign(oggpack_buffer *b)
Definition: bitwise.c:142