annotate win64-mingw/include/vorbis/codec.h @ 134:41e769c91eca

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