rev |
line source |
nuclear@0
|
1 /********************************************************************
|
nuclear@0
|
2 * *
|
nuclear@0
|
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
nuclear@0
|
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
nuclear@0
|
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
nuclear@0
|
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
nuclear@0
|
7 * *
|
nuclear@0
|
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
nuclear@0
|
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
|
nuclear@0
|
10 * *
|
nuclear@0
|
11 ********************************************************************
|
nuclear@0
|
12
|
nuclear@0
|
13 function: toplevel libogg include
|
nuclear@0
|
14 last mod: $Id: ogg.h 18044 2011-08-01 17:55:20Z gmaxwell $
|
nuclear@0
|
15
|
nuclear@0
|
16 ********************************************************************/
|
nuclear@0
|
17 #ifndef _OGG_H
|
nuclear@0
|
18 #define _OGG_H
|
nuclear@0
|
19
|
nuclear@0
|
20 #ifdef __cplusplus
|
nuclear@0
|
21 extern "C" {
|
nuclear@0
|
22 #endif
|
nuclear@0
|
23
|
nuclear@0
|
24 #include <stddef.h>
|
nuclear@0
|
25 #include <ogg/os_types.h>
|
nuclear@0
|
26
|
nuclear@0
|
27 typedef struct {
|
nuclear@0
|
28 void *iov_base;
|
nuclear@0
|
29 size_t iov_len;
|
nuclear@0
|
30 } ogg_iovec_t;
|
nuclear@0
|
31
|
nuclear@0
|
32 typedef struct {
|
nuclear@0
|
33 long endbyte;
|
nuclear@0
|
34 int endbit;
|
nuclear@0
|
35
|
nuclear@0
|
36 unsigned char *buffer;
|
nuclear@0
|
37 unsigned char *ptr;
|
nuclear@0
|
38 long storage;
|
nuclear@0
|
39 } oggpack_buffer;
|
nuclear@0
|
40
|
nuclear@0
|
41 /* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/
|
nuclear@0
|
42
|
nuclear@0
|
43 typedef struct {
|
nuclear@0
|
44 unsigned char *header;
|
nuclear@0
|
45 long header_len;
|
nuclear@0
|
46 unsigned char *body;
|
nuclear@0
|
47 long body_len;
|
nuclear@0
|
48 } ogg_page;
|
nuclear@0
|
49
|
nuclear@0
|
50 /* ogg_stream_state contains the current encode/decode state of a logical
|
nuclear@0
|
51 Ogg bitstream **********************************************************/
|
nuclear@0
|
52
|
nuclear@0
|
53 typedef struct {
|
nuclear@0
|
54 unsigned char *body_data; /* bytes from packet bodies */
|
nuclear@0
|
55 long body_storage; /* storage elements allocated */
|
nuclear@0
|
56 long body_fill; /* elements stored; fill mark */
|
nuclear@0
|
57 long body_returned; /* elements of fill returned */
|
nuclear@0
|
58
|
nuclear@0
|
59
|
nuclear@0
|
60 int *lacing_vals; /* The values that will go to the segment table */
|
nuclear@0
|
61 ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact
|
nuclear@0
|
62 this way, but it is simple coupled to the
|
nuclear@0
|
63 lacing fifo */
|
nuclear@0
|
64 long lacing_storage;
|
nuclear@0
|
65 long lacing_fill;
|
nuclear@0
|
66 long lacing_packet;
|
nuclear@0
|
67 long lacing_returned;
|
nuclear@0
|
68
|
nuclear@0
|
69 unsigned char header[282]; /* working space for header encode */
|
nuclear@0
|
70 int header_fill;
|
nuclear@0
|
71
|
nuclear@0
|
72 int e_o_s; /* set when we have buffered the last packet in the
|
nuclear@0
|
73 logical bitstream */
|
nuclear@0
|
74 int b_o_s; /* set after we've written the initial page
|
nuclear@0
|
75 of a logical bitstream */
|
nuclear@0
|
76 long serialno;
|
nuclear@0
|
77 long pageno;
|
nuclear@0
|
78 ogg_int64_t packetno; /* sequence number for decode; the framing
|
nuclear@0
|
79 knows where there's a hole in the data,
|
nuclear@0
|
80 but we need coupling so that the codec
|
nuclear@0
|
81 (which is in a separate abstraction
|
nuclear@0
|
82 layer) also knows about the gap */
|
nuclear@0
|
83 ogg_int64_t granulepos;
|
nuclear@0
|
84
|
nuclear@0
|
85 } ogg_stream_state;
|
nuclear@0
|
86
|
nuclear@0
|
87 /* ogg_packet is used to encapsulate the data and metadata belonging
|
nuclear@0
|
88 to a single raw Ogg/Vorbis packet *************************************/
|
nuclear@0
|
89
|
nuclear@0
|
90 typedef struct {
|
nuclear@0
|
91 unsigned char *packet;
|
nuclear@0
|
92 long bytes;
|
nuclear@0
|
93 long b_o_s;
|
nuclear@0
|
94 long e_o_s;
|
nuclear@0
|
95
|
nuclear@0
|
96 ogg_int64_t granulepos;
|
nuclear@0
|
97
|
nuclear@0
|
98 ogg_int64_t packetno; /* sequence number for decode; the framing
|
nuclear@0
|
99 knows where there's a hole in the data,
|
nuclear@0
|
100 but we need coupling so that the codec
|
nuclear@0
|
101 (which is in a separate abstraction
|
nuclear@0
|
102 layer) also knows about the gap */
|
nuclear@0
|
103 } ogg_packet;
|
nuclear@0
|
104
|
nuclear@0
|
105 typedef struct {
|
nuclear@0
|
106 unsigned char *data;
|
nuclear@0
|
107 int storage;
|
nuclear@0
|
108 int fill;
|
nuclear@0
|
109 int returned;
|
nuclear@0
|
110
|
nuclear@0
|
111 int unsynced;
|
nuclear@0
|
112 int headerbytes;
|
nuclear@0
|
113 int bodybytes;
|
nuclear@0
|
114 } ogg_sync_state;
|
nuclear@0
|
115
|
nuclear@0
|
116 /* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
|
nuclear@0
|
117
|
nuclear@0
|
118 extern void oggpack_writeinit(oggpack_buffer *b);
|
nuclear@0
|
119 extern int oggpack_writecheck(oggpack_buffer *b);
|
nuclear@0
|
120 extern void oggpack_writetrunc(oggpack_buffer *b,long bits);
|
nuclear@0
|
121 extern void oggpack_writealign(oggpack_buffer *b);
|
nuclear@0
|
122 extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits);
|
nuclear@0
|
123 extern void oggpack_reset(oggpack_buffer *b);
|
nuclear@0
|
124 extern void oggpack_writeclear(oggpack_buffer *b);
|
nuclear@0
|
125 extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
|
nuclear@0
|
126 extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits);
|
nuclear@0
|
127 extern long oggpack_look(oggpack_buffer *b,int bits);
|
nuclear@0
|
128 extern long oggpack_look1(oggpack_buffer *b);
|
nuclear@0
|
129 extern void oggpack_adv(oggpack_buffer *b,int bits);
|
nuclear@0
|
130 extern void oggpack_adv1(oggpack_buffer *b);
|
nuclear@0
|
131 extern long oggpack_read(oggpack_buffer *b,int bits);
|
nuclear@0
|
132 extern long oggpack_read1(oggpack_buffer *b);
|
nuclear@0
|
133 extern long oggpack_bytes(oggpack_buffer *b);
|
nuclear@0
|
134 extern long oggpack_bits(oggpack_buffer *b);
|
nuclear@0
|
135 extern unsigned char *oggpack_get_buffer(oggpack_buffer *b);
|
nuclear@0
|
136
|
nuclear@0
|
137 extern void oggpackB_writeinit(oggpack_buffer *b);
|
nuclear@0
|
138 extern int oggpackB_writecheck(oggpack_buffer *b);
|
nuclear@0
|
139 extern void oggpackB_writetrunc(oggpack_buffer *b,long bits);
|
nuclear@0
|
140 extern void oggpackB_writealign(oggpack_buffer *b);
|
nuclear@0
|
141 extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits);
|
nuclear@0
|
142 extern void oggpackB_reset(oggpack_buffer *b);
|
nuclear@0
|
143 extern void oggpackB_writeclear(oggpack_buffer *b);
|
nuclear@0
|
144 extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
|
nuclear@0
|
145 extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits);
|
nuclear@0
|
146 extern long oggpackB_look(oggpack_buffer *b,int bits);
|
nuclear@0
|
147 extern long oggpackB_look1(oggpack_buffer *b);
|
nuclear@0
|
148 extern void oggpackB_adv(oggpack_buffer *b,int bits);
|
nuclear@0
|
149 extern void oggpackB_adv1(oggpack_buffer *b);
|
nuclear@0
|
150 extern long oggpackB_read(oggpack_buffer *b,int bits);
|
nuclear@0
|
151 extern long oggpackB_read1(oggpack_buffer *b);
|
nuclear@0
|
152 extern long oggpackB_bytes(oggpack_buffer *b);
|
nuclear@0
|
153 extern long oggpackB_bits(oggpack_buffer *b);
|
nuclear@0
|
154 extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b);
|
nuclear@0
|
155
|
nuclear@0
|
156 /* Ogg BITSTREAM PRIMITIVES: encoding **************************/
|
nuclear@0
|
157
|
nuclear@0
|
158 extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
|
nuclear@0
|
159 extern int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov,
|
nuclear@0
|
160 int count, long e_o_s, ogg_int64_t granulepos);
|
nuclear@0
|
161 extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
|
nuclear@0
|
162 extern int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill);
|
nuclear@0
|
163 extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
|
nuclear@0
|
164 extern int ogg_stream_flush_fill(ogg_stream_state *os, ogg_page *og, int nfill);
|
nuclear@0
|
165
|
nuclear@0
|
166 /* Ogg BITSTREAM PRIMITIVES: decoding **************************/
|
nuclear@0
|
167
|
nuclear@0
|
168 extern int ogg_sync_init(ogg_sync_state *oy);
|
nuclear@0
|
169 extern int ogg_sync_clear(ogg_sync_state *oy);
|
nuclear@0
|
170 extern int ogg_sync_reset(ogg_sync_state *oy);
|
nuclear@0
|
171 extern int ogg_sync_destroy(ogg_sync_state *oy);
|
nuclear@0
|
172 extern int ogg_sync_check(ogg_sync_state *oy);
|
nuclear@0
|
173
|
nuclear@0
|
174 extern char *ogg_sync_buffer(ogg_sync_state *oy, long size);
|
nuclear@0
|
175 extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
|
nuclear@0
|
176 extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
|
nuclear@0
|
177 extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
|
nuclear@0
|
178 extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
|
nuclear@0
|
179 extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
|
nuclear@0
|
180 extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
|
nuclear@0
|
181
|
nuclear@0
|
182 /* Ogg BITSTREAM PRIMITIVES: general ***************************/
|
nuclear@0
|
183
|
nuclear@0
|
184 extern int ogg_stream_init(ogg_stream_state *os,int serialno);
|
nuclear@0
|
185 extern int ogg_stream_clear(ogg_stream_state *os);
|
nuclear@0
|
186 extern int ogg_stream_reset(ogg_stream_state *os);
|
nuclear@0
|
187 extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
|
nuclear@0
|
188 extern int ogg_stream_destroy(ogg_stream_state *os);
|
nuclear@0
|
189 extern int ogg_stream_check(ogg_stream_state *os);
|
nuclear@0
|
190 extern int ogg_stream_eos(ogg_stream_state *os);
|
nuclear@0
|
191
|
nuclear@0
|
192 extern void ogg_page_checksum_set(ogg_page *og);
|
nuclear@0
|
193
|
nuclear@0
|
194 extern int ogg_page_version(const ogg_page *og);
|
nuclear@0
|
195 extern int ogg_page_continued(const ogg_page *og);
|
nuclear@0
|
196 extern int ogg_page_bos(const ogg_page *og);
|
nuclear@0
|
197 extern int ogg_page_eos(const ogg_page *og);
|
nuclear@0
|
198 extern ogg_int64_t ogg_page_granulepos(const ogg_page *og);
|
nuclear@0
|
199 extern int ogg_page_serialno(const ogg_page *og);
|
nuclear@0
|
200 extern long ogg_page_pageno(const ogg_page *og);
|
nuclear@0
|
201 extern int ogg_page_packets(const ogg_page *og);
|
nuclear@0
|
202
|
nuclear@0
|
203 extern void ogg_packet_clear(ogg_packet *op);
|
nuclear@0
|
204
|
nuclear@0
|
205
|
nuclear@0
|
206 #ifdef __cplusplus
|
nuclear@0
|
207 }
|
nuclear@0
|
208 #endif
|
nuclear@0
|
209
|
nuclear@0
|
210 #endif /* _OGG_H */
|