Debian Codegraph @

external/vorbis/vorbis_codec.h

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