1 /********************************************************************
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
5 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
6 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
7 * ALL REDISTRIBUTION RIGHTS RESERVED. *
9 ********************************************************************
11 function: libvorbis codec headers
13 ********************************************************************/
15 #ifndef _vorbis_codec_h_
16 #define _vorbis_codec_h_
21 #endif /* __cplusplus */
25 typedef struct vorbis_info
{
30 /* The below bitrate declarations are *hints*.
31 Combinations of the three values carry the following implications:
33 all three set to the same value:
34 implies a fixed rate bitstream
36 implies a VBR stream that averages the nominal bitrate. No hard
38 upper and or lower set:
39 implies a VBR bitstream that obeys the bitrate limits. nominal
40 may also be set to give a nominal rate.
42 the coder does not care to speculate.
53 /* vorbis_dsp_state buffers the current vorbis audio
54 analysis/synthesis state. The DSP state belongs to a specific
55 logical bitstream ****************************************************/
56 typedef struct vorbis_dsp_state
{
74 ogg_int64_t granulepos
;
80 typedef struct vorbis_block
{
81 /* necessary stream state for linking to the framing abstraction */
82 ogg_int32_t
**pcm
; /* this is a pointer into local storage */
92 ogg_int64_t granulepos
;
94 vorbis_dsp_state
*vd
; /* For read-only access of configuration */
96 /* local storage to avoid remallocing; it's up to the mapping to
102 struct alloc_chain
*reap
;
106 /* vorbis_block is a single block of data to be processed as part of
107 the analysis/synthesis stream; it belongs to a specific logical
108 bitstream, but is independant from other vorbis_blocks belonging to
109 that logical bitstream. *************************************************/
113 struct alloc_chain
*next
;
116 /* vorbis_info contains all the setup information specific to the
117 specific compression/decompression mode in progress (eg,
118 psychoacoustic settings, channel setup, options, codebook
119 etc). vorbis_info and substructures are in backends.h.
120 *********************************************************************/
122 /* the comments are not part of vorbis_info so that vorbis_info can be
124 typedef struct vorbis_comment
{
125 /* unlimited user comment fields. libvorbis writes 'libvorbis'
126 whatever vendor is set to in encode */
127 char **user_comments
;
128 int *comment_lengths
;
135 /* libvorbis encodes in two abstraction layers; first we perform DSP
136 and produce a packet (see docs/analysis.txt). The packet is then
137 coded into a framed OggSquish bitstream by the second layer (see
138 docs/framing.txt). Decode is the reverse process; we sync/frame
139 the bitstream and extract individual packets, then decode the
140 packet back into PCM audio.
142 The extra framing/packetizing is used in streaming formats, such as
143 files. Over the net (such as with UDP), the framing and
144 packetization aren't necessary as they're provided by the transport
145 and the streaming layer is not used */
147 /* Vorbis PRIMITIVES: general ***************************************/
149 extern void vorbis_info_init(vorbis_info
*vi
);
150 extern void vorbis_info_clear(vorbis_info
*vi
);
151 extern int vorbis_info_blocksize(vorbis_info
*vi
,int zo
);
152 extern void vorbis_comment_init(vorbis_comment
*vc
);
153 extern void vorbis_comment_add(vorbis_comment
*vc
, char *comment
);
154 extern void vorbis_comment_add_tag(vorbis_comment
*vc
,
155 char *tag
, char *contents
);
156 extern char *vorbis_comment_query(vorbis_comment
*vc
, char *tag
, int count
);
157 extern int vorbis_comment_query_count(vorbis_comment
*vc
, char *tag
);
158 extern void vorbis_comment_clear(vorbis_comment
*vc
);
160 extern int vorbis_block_init(vorbis_dsp_state
*v
, vorbis_block
*vb
);
161 extern int vorbis_block_clear(vorbis_block
*vb
);
162 extern void vorbis_dsp_clear(vorbis_dsp_state
*v
);
164 /* Vorbis PRIMITIVES: synthesis layer *******************************/
165 extern int vorbis_synthesis_headerin(vorbis_info
*vi
,vorbis_comment
*vc
,
168 extern int vorbis_synthesis_init(vorbis_dsp_state
*v
,vorbis_info
*vi
);
169 extern int vorbis_synthesis(vorbis_block
*vb
,ogg_packet
*op
);
170 extern int vorbis_synthesis_blockin(vorbis_dsp_state
*v
,vorbis_block
*vb
);
171 extern int vorbis_synthesis_pcmout(vorbis_dsp_state
*v
,ogg_int32_t
***pcm
);
172 extern int vorbis_synthesis_read(vorbis_dsp_state
*v
,int samples
);
173 extern long vorbis_packet_blocksize(vorbis_info
*vi
,ogg_packet
*op
);
175 /* Vorbis ERRORS and return codes ***********************************/
181 #define OV_EREAD -128
182 #define OV_EFAULT -129
183 #define OV_EIMPL -130
184 #define OV_EINVAL -131
185 #define OV_ENOTVORBIS -132
186 #define OV_EBADHEADER -133
187 #define OV_EVERSION -134
188 #define OV_ENOTAUDIO -135
189 #define OV_EBADPACKET -136
190 #define OV_EBADLINK -137
191 #define OV_ENOSEEK -138
195 #endif /* __cplusplus */