annotate win32-mingw/include/vorbis/codec.h @ 23:619f715526df sv_v2.1

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