zenilib: zenilib/jni/external/libvorbis/include/vorbis/codec.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
codec.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-2001 *
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
10
11 ********************************************************************
12
13 function: libvorbis codec headers
14 last mod: $Id: codec.h 17021 2010-03-24 09:29:41Z xiphmont $
15
16 ********************************************************************/
17
18 #ifndef _vorbis_codec_h_
19 #define _vorbis_codec_h_
20
21 #ifdef __cplusplus
22 extern "C"
23 {
24 #endif /* __cplusplus */
25
26 #include <ogg/ogg.h>
27
28 typedef struct vorbis_info{
29 int version;
30 int channels;
31 long rate;
32
33 /* The below bitrate declarations are *hints*.
34 Combinations of the three values carry the following implications:
35
36 all three set to the same value:
37 implies a fixed rate bitstream
38 only nominal set:
39 implies a VBR stream that averages the nominal bitrate. No hard
40 upper/lower limit
41 upper and or lower set:
42 implies a VBR bitstream that obeys the bitrate limits. nominal
43 may also be set to give a nominal rate.
44 none set:
45 the coder does not care to speculate.
46 */
47
48 long bitrate_upper;
49 long bitrate_nominal;
50 long bitrate_lower;
51 long bitrate_window;
52
53 void *codec_setup;
54 } vorbis_info;
55
56 /* vorbis_dsp_state buffers the current vorbis audio
57 analysis/synthesis state. The DSP state belongs to a specific
58 logical bitstream ****************************************************/
59 typedef struct vorbis_dsp_state{
60 int analysisp;
61 vorbis_info *vi;
62
63 float **pcm;
64 float **pcmret;
65 int pcm_storage;
66 int pcm_current;
67 int pcm_returned;
68
69 int preextrapolate;
70 int eofflag;
71
72 long lW;
73 long W;
74 long nW;
75 long centerW;
76
77 ogg_int64_t granulepos;
78 ogg_int64_t sequence;
79
80 ogg_int64_t glue_bits;
81 ogg_int64_t time_bits;
82 ogg_int64_t floor_bits;
83 ogg_int64_t res_bits;
84
85 void *backend_state;
86 } vorbis_dsp_state;
87
88 typedef struct vorbis_block{
89 /* necessary stream state for linking to the framing abstraction */
90 float **pcm; /* this is a pointer into local storage */
91 oggpack_buffer opb;
92
93 long lW;
94 long W;
95 long nW;
96 int pcmend;
97 int mode;
98
99 int eofflag;
100 ogg_int64_t granulepos;
101 ogg_int64_t sequence;
102 vorbis_dsp_state *vd; /* For read-only access of configuration */
103
104 /* local storage to avoid remallocing; it's up to the mapping to
105 structure it */
106 void *localstore;
107 long localtop;
108 long localalloc;
109 long totaluse;
110 struct alloc_chain *reap;
111
112 /* bitmetrics for the frame */
113 long glue_bits;
114 long time_bits;
115 long floor_bits;
116 long res_bits;
117
118 void *internal;
119
120 } vorbis_block;
121
122 /* vorbis_block is a single block of data to be processed as part of
123 the analysis/synthesis stream; it belongs to a specific logical
124 bitstream, but is independent from other vorbis_blocks belonging to
125 that logical bitstream. *************************************************/
126
127 struct alloc_chain{
128 void *ptr;
129 struct alloc_chain *next;
130 };
131
132 /* vorbis_info contains all the setup information specific to the
133 specific compression/decompression mode in progress (eg,
134 psychoacoustic settings, channel setup, options, codebook
135 etc). vorbis_info and substructures are in backends.h.
136 *********************************************************************/
137
138 /* the comments are not part of vorbis_info so that vorbis_info can be
139 static storage */
140 typedef struct vorbis_comment{
141 /* unlimited user comment fields. libvorbis writes 'libvorbis'
142 whatever vendor is set to in encode */
143 char **user_comments;
144 int *comment_lengths;
145 int comments;
146 char *vendor;
147
148 } vorbis_comment;
149
150
151 /* libvorbis encodes in two abstraction layers; first we perform DSP
152 and produce a packet (see docs/analysis.txt). The packet is then
153 coded into a framed OggSquish bitstream by the second layer (see
154 docs/framing.txt). Decode is the reverse process; we sync/frame
155 the bitstream and extract individual packets, then decode the
156 packet back into PCM audio.
157
158 The extra framing/packetizing is used in streaming formats, such as
159 files. Over the net (such as with UDP), the framing and
160 packetization aren't necessary as they're provided by the transport
161 and the streaming layer is not used */
162
163 /* Vorbis PRIMITIVES: general ***************************************/
164
165 VORBIS_DLL extern void vorbis_info_init(vorbis_info *vi);
166 VORBIS_DLL extern void vorbis_info_clear(vorbis_info *vi);
167 VORBIS_DLL extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
168 VORBIS_DLL extern void vorbis_comment_init(vorbis_comment *vc);
169 VORBIS_DLL extern void vorbis_comment_add(vorbis_comment *vc, const char *comment);
170 VORBIS_DLL extern void vorbis_comment_add_tag(vorbis_comment *vc,
171 const char *tag, const char *contents);
172 VORBIS_DLL extern char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count);
173 VORBIS_DLL extern int vorbis_comment_query_count(vorbis_comment *vc, const char *tag);
174 VORBIS_DLL extern void vorbis_comment_clear(vorbis_comment *vc);
175
176 VORBIS_DLL extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
177 VORBIS_DLL extern int vorbis_block_clear(vorbis_block *vb);
178 VORBIS_DLL extern void vorbis_dsp_clear(vorbis_dsp_state *v);
179 VORBIS_DLL extern double vorbis_granule_time(vorbis_dsp_state *v,
180 ogg_int64_t granulepos);
181
182 VORBIS_DLL extern const char *vorbis_version_string(void);
183
184 /* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
185
186 VORBIS_DLL extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
187 VORBIS_DLL extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
188 VORBIS_DLL extern int vorbis_analysis_headerout(vorbis_dsp_state *v,
189 vorbis_comment *vc,
190 ogg_packet *op,
191 ogg_packet *op_comm,
192 ogg_packet *op_code);
193 VORBIS_DLL extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
194 VORBIS_DLL extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
195 VORBIS_DLL extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
196 VORBIS_DLL extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op);
197
198 VORBIS_DLL extern int vorbis_bitrate_addblock(vorbis_block *vb);
199 VORBIS_DLL extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,
200 ogg_packet *op);
201
202 /* Vorbis PRIMITIVES: synthesis layer *******************************/
203 VORBIS_DLL extern int vorbis_synthesis_idheader(ogg_packet *op);
204 VORBIS_DLL extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
205 ogg_packet *op);
206
207 VORBIS_DLL extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
208 VORBIS_DLL extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
209 VORBIS_DLL extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op);
210 VORBIS_DLL extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op);
211 VORBIS_DLL extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
212 VORBIS_DLL extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm);
213 VORBIS_DLL extern int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm);
214 VORBIS_DLL extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
215 VORBIS_DLL extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
216
217 VORBIS_DLL extern int vorbis_synthesis_halfrate(vorbis_info *v,int flag);
218 VORBIS_DLL extern int vorbis_synthesis_halfrate_p(vorbis_info *v);
219
220 /* Vorbis ERRORS and return codes ***********************************/
221
222 #define OV_FALSE -1
223 #define OV_EOF -2
224 #define OV_HOLE -3
225
226 #define OV_EREAD -128
227 #define OV_EFAULT -129
228 #define OV_EIMPL -130
229 #define OV_EINVAL -131
230 #define OV_ENOTVORBIS -132
231 #define OV_EBADHEADER -133
232 #define OV_EVERSION -134
233 #define OV_ENOTAUDIO -135
234 #define OV_EBADPACKET -136
235 #define OV_EBADLINK -137
236 #define OV_ENOSEEK -138
237
238 #ifdef __cplusplus
239 }
240 #endif /* __cplusplus */
241
242 #endif
243
vorbis_dsp_state::pcm
float ** pcm
Definition: codec.h:63
vorbis_block::glue_bits
long glue_bits
Definition: codec.h:113
vorbis_comment_init
void vorbis_comment_init(vorbis_comment *vc)
Definition: info.c:61
vorbis_comment_add_tag
void vorbis_comment_add_tag(vorbis_comment *vc, const char *tag, const char *contents)
Definition: info.c:77
vorbis_dsp_state::lW
long lW
Definition: codec.h:72
vorbis_dsp_state::pcm_current
int pcm_current
Definition: codec.h:66
vorbis_block::opb
oggpack_buffer opb
Definition: codec.h:91
vorbis_dsp_state::granulepos
ogg_int64_t granulepos
Definition: codec.h:77
vorbis_block::mode
int mode
Definition: codec.h:97
vorbis_granule_time
double vorbis_granule_time(vorbis_dsp_state *v, ogg_int64_t granulepos)
Definition: info.c:647
vorbis_comment_query_count
int vorbis_comment_query_count(vorbis_comment *vc, const char *tag)
Definition: info.c:118
vorbis_comment
Definition: codec.h:140
ogg_packet
Definition: ogg.h:90
vorbis_block_init
int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb)
Definition: block.c:88
vorbis_synthesis_halfrate_p
int vorbis_synthesis_halfrate_p(vorbis_info *v)
Definition: synthesis.c:181
vorbis_block::vd
vorbis_dsp_state * vd
Definition: codec.h:102
vorbis_synthesis_headerin
int vorbis_synthesis_headerin(vorbis_info *vi, vorbis_comment *vc, ogg_packet *op)
Definition: info.c:379
vorbis_comment_clear
void vorbis_comment_clear(vorbis_comment *vc)
Definition: info.c:133
vorbis_analysis_buffer
float ** vorbis_analysis_buffer(vorbis_dsp_state *v, int vals)
Definition: block.c:389
vorbis_dsp_state::analysisp
int analysisp
Definition: codec.h:60
vorbis_commentheader_out
int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op)
Definition: info.c:547
vorbis_synthesis_blockin
int vorbis_synthesis_blockin(vorbis_dsp_state *v, vorbis_block *vb)
Definition: block.c:721
vorbis_block::W
long W
Definition: codec.h:94
vorbis_dsp_state::pcm_storage
int pcm_storage
Definition: codec.h:65
vorbis_analysis
int vorbis_analysis(vorbis_block *vb, ogg_packet *op)
Definition: analysis.c:30
vorbis_block::lW
long lW
Definition: codec.h:93
vorbis_synthesis_read
int vorbis_synthesis_read(vorbis_dsp_state *v, int samples)
Definition: block.c:952
vorbis_dsp_state::nW
long nW
Definition: codec.h:74
vorbis_synthesis_pcmout
int vorbis_synthesis_pcmout(vorbis_dsp_state *v, float ***pcm)
Definition: block.c:937
vorbis_info::bitrate_lower
long bitrate_lower
Definition: codec.h:50
ogg.h
vorbis_dsp_state::vi
vorbis_info * vi
Definition: codec.h:61
vorbis_dsp_state::preextrapolate
int preextrapolate
Definition: codec.h:69
vorbis_comment::comments
int comments
Definition: codec.h:145
vorbis_dsp_state::glue_bits
ogg_int64_t glue_bits
Definition: codec.h:80
vorbis_synthesis_init
int vorbis_synthesis_init(vorbis_dsp_state *v, vorbis_info *vi)
Definition: block.c:708
vorbis_bitrate_addblock
int vorbis_bitrate_addblock(vorbis_block *vb)
Definition: bitrate.c:74
vorbis_block::reap
struct alloc_chain * reap
Definition: codec.h:110
vorbis_info::codec_setup
void * codec_setup
Definition: codec.h:53
vorbis_info::bitrate_upper
long bitrate_upper
Definition: codec.h:48
vorbis_info::channels
int channels
Definition: codec.h:30
vorbis_dsp_state::floor_bits
ogg_int64_t floor_bits
Definition: codec.h:82
vorbis_info::bitrate_nominal
long bitrate_nominal
Definition: codec.h:49
vorbis_synthesis_lapout
int vorbis_synthesis_lapout(vorbis_dsp_state *v, float ***pcm)
Definition: block.c:963
vorbis_analysis_wrote
int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals)
Definition: block.c:460
vorbis_block::pcm
float ** pcm
Definition: codec.h:90
v
const GLdouble * v
Definition: glew.h:1377
vorbis_synthesis_restart
int vorbis_synthesis_restart(vorbis_dsp_state *v)
Definition: block.c:685
vorbis_dsp_clear
void vorbis_dsp_clear(vorbis_dsp_state *v)
Definition: block.c:315
vorbis_analysis_init
int vorbis_analysis_init(vorbis_dsp_state *v, vorbis_info *vi)
Definition: block.c:295
count
GLint GLsizei count
Definition: gl2ext.h:1011
vorbis_dsp_state::centerW
long centerW
Definition: codec.h:75
samples
GLsizei samples
Definition: gl2ext.h:970
vorbis_block::pcmend
int pcmend
Definition: codec.h:96
vorbis_info::bitrate_window
long bitrate_window
Definition: codec.h:51
vorbis_info
struct vorbis_info vorbis_info
vorbis_block::totaluse
long totaluse
Definition: codec.h:109
vorbis_block::floor_bits
long floor_bits
Definition: codec.h:115
oggpack_buffer
Definition: ogg.h:32
vorbis_info_blocksize
int vorbis_info_blocksize(vorbis_info *vi, int zo)
Definition: info.c:149
vorbis_analysis_headerout
int vorbis_analysis_headerout(vorbis_dsp_state *v, vorbis_comment *vc, ogg_packet *op, ogg_packet *op_comm, ogg_packet *op_code)
Definition: info.c:567
vorbis_bitrate_flushpacket
int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, ogg_packet *op)
Definition: bitrate.c:230
vorbis_block
Definition: codec.h:88
vorbis_block::nW
long nW
Definition: codec.h:95
vorbis_comment::vendor
char * vendor
Definition: codec.h:146
vorbis_block::localtop
long localtop
Definition: codec.h:107
vi
XVisualInfo * vi
Definition: glewinfo_tail.c:221
alloc_chain::next
struct alloc_chain * next
Definition: codec.h:129
vorbis_block::time_bits
long time_bits
Definition: codec.h:114
vorbis_block::eofflag
int eofflag
Definition: codec.h:99
vorbis_comment::comment_lengths
int * comment_lengths
Definition: codec.h:144
vorbis_block::localalloc
long localalloc
Definition: codec.h:108
vorbis_synthesis_idheader
int vorbis_synthesis_idheader(ogg_packet *op)
Definition: info.c:350
vorbis_info::rate
long rate
Definition: codec.h:31
vorbis_block::granulepos
ogg_int64_t granulepos
Definition: codec.h:100
vorbis_dsp_state::W
long W
Definition: codec.h:73
vorbis_synthesis
int vorbis_synthesis(vorbis_block *vb, ogg_packet *op)
Definition: synthesis.c:26
vorbis_synthesis_trackonly
int vorbis_synthesis_trackonly(vorbis_block *vb, ogg_packet *op)
Definition: synthesis.c:94
alloc_chain::ptr
void * ptr
Definition: codec.h:128
vorbis_info_clear
void vorbis_info_clear(vorbis_info *vi)
Definition: info.c:160
vorbis_dsp_state::pcmret
float ** pcmret
Definition: codec.h:64
vorbis_info::version
int version
Definition: codec.h:29
alloc_chain
Definition: codec.h:127
vorbis_info_init
void vorbis_info_init(vorbis_info *vi)
Definition: info.c:155
vorbis_dsp_state::sequence
ogg_int64_t sequence
Definition: codec.h:78
vorbis_block::res_bits
long res_bits
Definition: codec.h:116
vorbis_dsp_state::time_bits
ogg_int64_t time_bits
Definition: codec.h:81
vorbis_analysis_blockout
int vorbis_analysis_blockout(vorbis_dsp_state *v, vorbis_block *vb)
Definition: block.c:524
vorbis_comment
struct vorbis_comment vorbis_comment
vorbis_dsp_state::res_bits
ogg_int64_t res_bits
Definition: codec.h:83
vorbis_version_string
const char * vorbis_version_string(void)
Definition: info.c:662
vorbis_dsp_state
struct vorbis_dsp_state vorbis_dsp_state
vorbis_synthesis_halfrate
int vorbis_synthesis_halfrate(vorbis_info *v, int flag)
Definition: synthesis.c:171
vorbis_dsp_state::eofflag
int eofflag
Definition: codec.h:70
vorbis_packet_blocksize
long vorbis_packet_blocksize(vorbis_info *vi, ogg_packet *op)
Definition: synthesis.c:143
vorbis_block
struct vorbis_block vorbis_block
vorbis_comment::user_comments
char ** user_comments
Definition: codec.h:143
vorbis_comment_query
char * vorbis_comment_query(vorbis_comment *vc, const char *tag, int count)
Definition: info.c:97
vorbis_block::localstore
void * localstore
Definition: codec.h:106
vorbis_comment_add
void vorbis_comment_add(vorbis_comment *vc, const char *comment)
Definition: info.c:65
vorbis_block::sequence
ogg_int64_t sequence
Definition: codec.h:101
vorbis_dsp_state::pcm_returned
int pcm_returned
Definition: codec.h:67
ogg_int64_t
long ogg_int64_t
Definition: config_types.h:23
vorbis_dsp_state::backend_state
void * backend_state
Definition: codec.h:85
vorbis_block_clear
int vorbis_block_clear(vorbis_block *vb)
Definition: block.c:159
vorbis_info
Definition: codec.h:28
vorbis_dsp_state
Definition: codec.h:59