00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _vorbis_codec_h_
00019 #define _vorbis_codec_h_
00020
00021 #ifdef __cplusplus
00022 extern "C"
00023 {
00024 #endif
00025
00026 #include <ogg/ogg.h>
00027
00028 typedef struct vorbis_info{
00029 int version;
00030 int channels;
00031 long rate;
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 long bitrate_upper;
00049 long bitrate_nominal;
00050 long bitrate_lower;
00051 long bitrate_window;
00052
00053 void *codec_setup;
00054 } vorbis_info;
00055
00056
00057
00058
00059 typedef struct vorbis_dsp_state{
00060 int analysisp;
00061 vorbis_info *vi;
00062
00063 float **pcm;
00064 float **pcmret;
00065 int pcm_storage;
00066 int pcm_current;
00067 int pcm_returned;
00068
00069 int preextrapolate;
00070 int eofflag;
00071
00072 long lW;
00073 long W;
00074 long nW;
00075 long centerW;
00076
00077 ogg_int64_t granulepos;
00078 ogg_int64_t sequence;
00079
00080 ogg_int64_t glue_bits;
00081 ogg_int64_t time_bits;
00082 ogg_int64_t floor_bits;
00083 ogg_int64_t res_bits;
00084
00085 void *backend_state;
00086 } vorbis_dsp_state;
00087
00088 typedef struct vorbis_block{
00089
00090 float **pcm;
00091 oggpack_buffer opb;
00092
00093 long lW;
00094 long W;
00095 long nW;
00096 int pcmend;
00097 int mode;
00098
00099 int eofflag;
00100 ogg_int64_t granulepos;
00101 ogg_int64_t sequence;
00102 vorbis_dsp_state *vd;
00103
00104
00105
00106 void *localstore;
00107 long localtop;
00108 long localalloc;
00109 long totaluse;
00110 struct alloc_chain *reap;
00111
00112
00113 long glue_bits;
00114 long time_bits;
00115 long floor_bits;
00116 long res_bits;
00117
00118 void *internal;
00119
00120 } vorbis_block;
00121
00122
00123
00124
00125
00126
00127 struct alloc_chain{
00128 void *ptr;
00129 struct alloc_chain *next;
00130 };
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 typedef struct vorbis_comment{
00141
00142
00143 char **user_comments;
00144 int *comment_lengths;
00145 int comments;
00146 char *vendor;
00147
00148 } vorbis_comment;
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 extern void vorbis_info_init(vorbis_info *vi);
00166 extern void vorbis_info_clear(vorbis_info *vi);
00167 extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
00168 extern void vorbis_comment_init(vorbis_comment *vc);
00169 extern void vorbis_comment_add(vorbis_comment *vc, char *comment);
00170 extern void vorbis_comment_add_tag(vorbis_comment *vc,
00171 char *tag, char *contents);
00172 extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
00173 extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag);
00174 extern void vorbis_comment_clear(vorbis_comment *vc);
00175
00176 extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
00177 extern int vorbis_block_clear(vorbis_block *vb);
00178 extern void vorbis_dsp_clear(vorbis_dsp_state *v);
00179 extern double vorbis_granule_time(vorbis_dsp_state *v,
00180 ogg_int64_t granulepos);
00181
00182
00183
00184 extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
00185 extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
00186 extern int vorbis_analysis_headerout(vorbis_dsp_state *v,
00187 vorbis_comment *vc,
00188 ogg_packet *op,
00189 ogg_packet *op_comm,
00190 ogg_packet *op_code);
00191 extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
00192 extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
00193 extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
00194 extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op);
00195
00196 extern int vorbis_bitrate_addblock(vorbis_block *vb);
00197 extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,
00198 ogg_packet *op);
00199
00200
00201 extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
00202 ogg_packet *op);
00203
00204 extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
00205 extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
00206 extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op);
00207 extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op);
00208 extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
00209 extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm);
00210 extern int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm);
00211 extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
00212 extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
00213
00214 extern int vorbis_synthesis_halfrate(vorbis_info *v,int flag);
00215 extern int vorbis_synthesis_halfrate_p(vorbis_info *v);
00216
00217
00218
00219 #define OV_FALSE -1
00220 #define OV_EOF -2
00221 #define OV_HOLE -3
00222
00223 #define OV_EREAD -128
00224 #define OV_EFAULT -129
00225 #define OV_EIMPL -130
00226 #define OV_EINVAL -131
00227 #define OV_ENOTVORBIS -132
00228 #define OV_EBADHEADER -133
00229 #define OV_EVERSION -134
00230 #define OV_ENOTAUDIO -135
00231 #define OV_EBADPACKET -136
00232 #define OV_EBADLINK -137
00233 #define OV_ENOSEEK -138
00234
00235 #ifdef __cplusplus
00236 }
00237 #endif
00238
00239 #endif
00240