annotate win64-mingw/include/vorbis/codec.h @ 34:05254799ed10

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