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.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 ogg_int32_t **pcm;
00064 ogg_int32_t **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 void *backend_state;
00081 } vorbis_dsp_state;
00082
00083 typedef struct vorbis_block{
00084
00085 ogg_int32_t **pcm;
00086 oggpack_buffer opb;
00087
00088 long lW;
00089 long W;
00090 long nW;
00091 int pcmend;
00092 int mode;
00093
00094 int eofflag;
00095 ogg_int64_t granulepos;
00096 ogg_int64_t sequence;
00097 vorbis_dsp_state *vd;
00098
00099
00100
00101 void *localstore;
00102 long localtop;
00103 long localalloc;
00104 long totaluse;
00105 struct alloc_chain *reap;
00106
00107 } vorbis_block;
00108
00109
00110
00111
00112
00113
00114 struct alloc_chain{
00115 void *ptr;
00116 struct alloc_chain *next;
00117 };
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 typedef struct vorbis_comment{
00128
00129
00130 char **user_comments;
00131 int *comment_lengths;
00132 int comments;
00133 char *vendor;
00134
00135 } vorbis_comment;
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152 extern void vorbis_info_init(vorbis_info *vi);
00153 extern void vorbis_info_clear(vorbis_info *vi);
00154 extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
00155 extern void vorbis_comment_init(vorbis_comment *vc);
00156 extern void vorbis_comment_add(vorbis_comment *vc, char *comment);
00157 extern void vorbis_comment_add_tag(vorbis_comment *vc,
00158 char *tag, char *contents);
00159 extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
00160 extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag);
00161 extern void vorbis_comment_clear(vorbis_comment *vc);
00162
00163 extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
00164 extern int vorbis_block_clear(vorbis_block *vb);
00165 extern void vorbis_dsp_clear(vorbis_dsp_state *v);
00166
00167
00168 extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
00169 ogg_packet *op);
00170
00171 extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
00172 extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
00173 extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep);
00174 extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
00175 extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm);
00176 extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
00177 extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
00178
00179
00180
00181 #define OV_FALSE -1
00182 #define OV_EOF -2
00183 #define OV_HOLE -3
00184
00185 #define OV_EREAD -128
00186 #define OV_EFAULT -129
00187 #define OV_EIMPL -130
00188 #define OV_EINVAL -131
00189 #define OV_ENOTVORBIS -132
00190 #define OV_EBADHEADER -133
00191 #define OV_EVERSION -134
00192 #define OV_ENOTAUDIO -135
00193 #define OV_EBADPACKET -136
00194 #define OV_EBADLINK -137
00195 #define OV_ENOSEEK -138
00196
00197 #ifdef __cplusplus
00198 }
00199 #endif
00200
00201 #endif
00202