diff options
Diffstat (limited to 'lib/rbcodec/codecs/libspeex/speex/ogg.h')
-rw-r--r-- | lib/rbcodec/codecs/libspeex/speex/ogg.h | 216 |
1 files changed, 216 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libspeex/speex/ogg.h b/lib/rbcodec/codecs/libspeex/speex/ogg.h new file mode 100644 index 0000000000..8898b99582 --- /dev/null +++ b/lib/rbcodec/codecs/libspeex/speex/ogg.h | |||
@@ -0,0 +1,216 @@ | |||
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$ | ||
15 | |||
16 | ********************************************************************/ | ||
17 | #ifndef _OGG_H | ||
18 | #define _OGG_H | ||
19 | |||
20 | #ifdef __cplusplus | ||
21 | extern "C" { | ||
22 | #endif | ||
23 | |||
24 | #include "codeclib.h" | ||
25 | |||
26 | typedef short spx_ogg_int16_t; | ||
27 | typedef unsigned short spx_ogg_uint16_t; | ||
28 | typedef int spx_ogg_int32_t; | ||
29 | typedef unsigned int spx_ogg_uint32_t; | ||
30 | typedef long long spx_ogg_int64_t; | ||
31 | |||
32 | |||
33 | #define _spx_ogg_malloc codec_malloc | ||
34 | #define _spx_ogg_calloc codec_calloc | ||
35 | #define _spx_ogg_realloc codec_realloc | ||
36 | #define _spx_ogg_free codec_free | ||
37 | |||
38 | |||
39 | typedef struct { | ||
40 | long endbyte; | ||
41 | int endbit; | ||
42 | |||
43 | unsigned char *buffer; | ||
44 | unsigned char *ptr; | ||
45 | long storage; | ||
46 | } oggpack_buffer; | ||
47 | |||
48 | /* spx_ogg_page is used to encapsulate the data in one Ogg bitstream page *****/ | ||
49 | |||
50 | typedef struct { | ||
51 | unsigned char *header; | ||
52 | long header_len; | ||
53 | unsigned char *body; | ||
54 | long body_len; | ||
55 | } spx_ogg_page; | ||
56 | |||
57 | /* spx_ogg_stream_state contains the current encode/decode state of a logical | ||
58 | Ogg bitstream **********************************************************/ | ||
59 | |||
60 | typedef struct { | ||
61 | unsigned char *body_data; /* bytes from packet bodies */ | ||
62 | long body_storage; /* storage elements allocated */ | ||
63 | long body_fill; /* elements stored; fill mark */ | ||
64 | long body_returned; /* elements of fill returned */ | ||
65 | |||
66 | |||
67 | int *lacing_vals; /* The values that will go to the segment table */ | ||
68 | spx_ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact | ||
69 | this way, but it is simple coupled to the | ||
70 | lacing fifo */ | ||
71 | long lacing_storage; | ||
72 | long lacing_fill; | ||
73 | long lacing_packet; | ||
74 | long lacing_returned; | ||
75 | |||
76 | unsigned char header[282]; /* working space for header encode */ | ||
77 | int header_fill; | ||
78 | |||
79 | int e_o_s; /* set when we have buffered the last packet in the | ||
80 | logical bitstream */ | ||
81 | int b_o_s; /* set after we've written the initial page | ||
82 | of a logical bitstream */ | ||
83 | long serialno; | ||
84 | long pageno; | ||
85 | spx_ogg_int64_t packetno; /* sequence number for decode; the framing | ||
86 | knows where there's a hole in the data, | ||
87 | but we need coupling so that the codec | ||
88 | (which is in a seperate abstraction | ||
89 | layer) also knows about the gap */ | ||
90 | spx_ogg_int64_t granulepos; | ||
91 | |||
92 | } spx_ogg_stream_state; | ||
93 | |||
94 | /* spx_ogg_packet is used to encapsulate the data and metadata belonging | ||
95 | to a single raw Ogg/Vorbis packet *************************************/ | ||
96 | |||
97 | typedef struct { | ||
98 | unsigned char *packet; | ||
99 | long bytes; | ||
100 | long b_o_s; | ||
101 | long e_o_s; | ||
102 | |||
103 | spx_ogg_int64_t granulepos; | ||
104 | |||
105 | spx_ogg_int64_t packetno; /* sequence number for decode; the framing | ||
106 | knows where there's a hole in the data, | ||
107 | but we need coupling so that the codec | ||
108 | (which is in a seperate abstraction | ||
109 | layer) also knows about the gap */ | ||
110 | } spx_ogg_packet; | ||
111 | |||
112 | typedef struct { | ||
113 | unsigned char *data; | ||
114 | int storage; | ||
115 | int fill; | ||
116 | int returned; | ||
117 | |||
118 | int unsynced; | ||
119 | int headerbytes; | ||
120 | int bodybytes; | ||
121 | } spx_ogg_sync_state; | ||
122 | |||
123 | /* Ogg BITSTREAM PRIMITIVES: bitstream ************************/ | ||
124 | |||
125 | extern void oggpack_writeinit(oggpack_buffer *b); | ||
126 | extern void oggpack_writetrunc(oggpack_buffer *b,long bits); | ||
127 | extern void oggpack_writealign(oggpack_buffer *b); | ||
128 | extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits); | ||
129 | extern void oggpack_reset(oggpack_buffer *b); | ||
130 | extern void oggpack_writeclear(oggpack_buffer *b); | ||
131 | extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); | ||
132 | extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits); | ||
133 | extern long oggpack_look(oggpack_buffer *b,int bits); | ||
134 | extern long oggpack_look1(oggpack_buffer *b); | ||
135 | extern void oggpack_adv(oggpack_buffer *b,int bits); | ||
136 | extern void oggpack_adv1(oggpack_buffer *b); | ||
137 | extern long oggpack_read(oggpack_buffer *b,int bits); | ||
138 | extern long oggpack_read1(oggpack_buffer *b); | ||
139 | extern long oggpack_bytes(oggpack_buffer *b); | ||
140 | extern long oggpack_bits(oggpack_buffer *b); | ||
141 | extern unsigned char *oggpack_get_buffer(oggpack_buffer *b); | ||
142 | |||
143 | extern void oggpackB_writeinit(oggpack_buffer *b); | ||
144 | extern void oggpackB_writetrunc(oggpack_buffer *b,long bits); | ||
145 | extern void oggpackB_writealign(oggpack_buffer *b); | ||
146 | extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits); | ||
147 | extern void oggpackB_reset(oggpack_buffer *b); | ||
148 | extern void oggpackB_writeclear(oggpack_buffer *b); | ||
149 | extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); | ||
150 | extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits); | ||
151 | extern long oggpackB_look(oggpack_buffer *b,int bits); | ||
152 | extern long oggpackB_look1(oggpack_buffer *b); | ||
153 | extern void oggpackB_adv(oggpack_buffer *b,int bits); | ||
154 | extern void oggpackB_adv1(oggpack_buffer *b); | ||
155 | extern long oggpackB_read(oggpack_buffer *b,int bits); | ||
156 | extern long oggpackB_read1(oggpack_buffer *b); | ||
157 | extern long oggpackB_bytes(oggpack_buffer *b); | ||
158 | extern long oggpackB_bits(oggpack_buffer *b); | ||
159 | extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b); | ||
160 | |||
161 | /* Ogg BITSTREAM PRIMITIVES: encoding **************************/ | ||
162 | |||
163 | extern int spx_ogg_stream_packetin(spx_ogg_stream_state *os, spx_ogg_packet *op); | ||
164 | extern int spx_ogg_stream_pageout(spx_ogg_stream_state *os, spx_ogg_page *og); | ||
165 | extern int spx_ogg_stream_flush(spx_ogg_stream_state *os, spx_ogg_page *og); | ||
166 | |||
167 | /* Ogg BITSTREAM PRIMITIVES: decoding **************************/ | ||
168 | |||
169 | extern int spx_ogg_sync_init(spx_ogg_sync_state *oy); | ||
170 | extern int spx_ogg_sync_clear(spx_ogg_sync_state *oy); | ||
171 | extern int spx_ogg_sync_reset(spx_ogg_sync_state *oy); | ||
172 | extern int spx_ogg_sync_destroy(spx_ogg_sync_state *oy); | ||
173 | |||
174 | extern void spx_ogg_alloc_buffer(spx_ogg_sync_state *oy, long size); | ||
175 | extern char *spx_ogg_sync_buffer(spx_ogg_sync_state *oy, long size); | ||
176 | extern int spx_ogg_sync_wrote(spx_ogg_sync_state *oy, long bytes); | ||
177 | extern long spx_ogg_sync_pageseek(spx_ogg_sync_state *oy,spx_ogg_page *og); | ||
178 | extern int spx_ogg_sync_pageout(spx_ogg_sync_state *oy, spx_ogg_page *og); | ||
179 | extern int spx_ogg_stream_pagein(spx_ogg_stream_state *os, spx_ogg_page *og); | ||
180 | extern int spx_ogg_stream_packetout(spx_ogg_stream_state *os,spx_ogg_packet *op); | ||
181 | extern int spx_ogg_stream_packetpeek(spx_ogg_stream_state *os,spx_ogg_packet *op); | ||
182 | |||
183 | /* Ogg BITSTREAM PRIMITIVES: general ***************************/ | ||
184 | |||
185 | extern int spx_ogg_stream_init(spx_ogg_stream_state *os,int serialno); | ||
186 | extern int spx_ogg_stream_clear(spx_ogg_stream_state *os); | ||
187 | extern int spx_ogg_stream_reset(spx_ogg_stream_state *os); | ||
188 | extern int spx_ogg_stream_reset_serialno(spx_ogg_stream_state *os,int serialno); | ||
189 | extern int spx_ogg_stream_destroy(spx_ogg_stream_state *os); | ||
190 | extern int spx_ogg_stream_eos(spx_ogg_stream_state *os); | ||
191 | |||
192 | extern void spx_ogg_page_checksum_set(spx_ogg_page *og); | ||
193 | |||
194 | extern int spx_ogg_page_version(spx_ogg_page *og); | ||
195 | extern int spx_ogg_page_continued(spx_ogg_page *og); | ||
196 | extern int spx_ogg_page_bos(spx_ogg_page *og); | ||
197 | extern int spx_ogg_page_eos(spx_ogg_page *og); | ||
198 | extern spx_ogg_int64_t spx_ogg_page_granulepos(spx_ogg_page *og); | ||
199 | extern int spx_ogg_page_serialno(spx_ogg_page *og); | ||
200 | extern long spx_ogg_page_pageno(spx_ogg_page *og); | ||
201 | extern int spx_ogg_page_packets(spx_ogg_page *og); | ||
202 | |||
203 | extern void spx_ogg_packet_clear(spx_ogg_packet *op); | ||
204 | |||
205 | |||
206 | #ifdef __cplusplus | ||
207 | } | ||
208 | #endif | ||
209 | |||
210 | #endif /* _OGG_H */ | ||
211 | |||
212 | |||
213 | |||
214 | |||
215 | |||
216 | |||