annotate src/libvorbis-1.3.3/include/vorbis/codec.h @ 84:08ae793730bd

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