24 #include "../ogg/ogg.h"
25 #include "../vorbis/codec.h"
35 static int ilog2(
unsigned int v){
59 memset(vc,0,
sizeof(*vc));
75 char *comment=alloca(strlen(tag)+strlen(contents)+2);
78 strcat(comment, contents);
84 static int tagcompare(
const char *s1,
const char *s2,
int n){
87 if(toupper(s1[c]) != toupper(s2[c]))
97 int taglen = strlen(tag)+1;
98 char *fulltag = alloca(taglen+ 1);
100 strcpy(fulltag, tag);
101 strcat(fulltag,
"=");
117 int taglen = strlen(tag)+1;
118 char *fulltag = alloca(taglen+1);
120 strcat(fulltag,
"=");
139 memset(vc,0,
sizeof(*vc));
151 memset(vi,0,
sizeof(*vi));
161 for(i=0;i<ci->
modes;i++)
164 for(i=0;i<ci->
maps;i++)
173 for(i=0;i<ci->
books;i++){
184 for(i=0;i<ci->
psys;i++)
190 memset(vi,0,
sizeof(*vi));
212 if(vi->
rate<1)
goto err_out;
228 if(vendorlen<0)
goto err_out;
230 _v_readstring(opb,vc->
vendor,vendorlen);
238 if(len<0)
goto err_out;
261 for(i=0;i<ci->
books;i++){
269 for(i=0;i<times;i++){
271 if(test<0 || test>=
VI_TIMEB)
goto err_out;
279 for(i=0;i<ci->
floors;i++){
301 for(i=0;i<ci->
maps;i++){
311 for(i=0;i<ci->
modes;i++){
348 _v_readstring(&opb,buffer,6);
349 if(memcmp(buffer,
"vorbis",6)){
364 return(_vorbis_unpack_info(vi,&opb));
372 return(_vorbis_unpack_comment(vc,&opb));
380 return(_vorbis_unpack_books(vi,&opb));
400 _v_writestring(opb,
"vorbis", 6);
419 char temp[]=
"Xiph.Org libVorbis I 20030909";
420 int bytes = strlen(temp);
424 _v_writestring(opb,
"vorbis", 6);
428 _v_writestring(opb,temp, bytes);
455 _v_writestring(opb,
"vorbis", 6);
459 for(i=0;i<ci->
books;i++)
468 for(i=0;i<ci->
floors;i++){
485 for(i=0;i<ci->
maps;i++){
492 for(i=0;i<ci->
modes;i++){
511 if(_vorbis_pack_comment(&opb,vc))
return OV_EIMPL;
542 if(_vorbis_pack_info(&opb,vi))
goto err_out;
557 if(_vorbis_pack_comment(&opb,vc))
goto err_out;
571 if(_vorbis_pack_books(&opb,vi))
goto err_out;
586 memset(op,0,
sizeof(*op));
587 memset(op_comm,0,
sizeof(*op_comm));
588 memset(op_code,0,
sizeof(*op_code));
601 return((
double)granulepos/v->
vi->
rate);
void(* free_info)(vorbis_info_floor *)
vorbis_func_mapping * _mapping_P[]
vorbis_info_floor *(* unpack)(vorbis_info *, oggpack_buffer *)
vorbis_info_residue * residue_param[64]
void vorbis_comment_add(vorbis_comment *vc, char *comment)
void vorbis_staticbook_destroy(static_codebook *b)
int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op)
vorbis_info_floor * floor_param[64]
static_codebook * book_param[256]
void oggpack_write(oggpack_buffer *b, unsigned long value, int bits)
double vorbis_granule_time(vorbis_dsp_state *v, ogg_int64_t granulepos)
vorbis_info_mode * mode_param[64]
void(* free_info)(vorbis_info_mapping *)
void vorbis_info_init(vorbis_info *vi)
int vorbis_info_blocksize(vorbis_info *vi, int zo)
void vorbis_comment_init(vorbis_comment *vc)
int vorbis_synthesis_headerin(vorbis_info *vi, vorbis_comment *vc, ogg_packet *op)
void(* pack)(vorbis_info_floor *, oggpack_buffer *)
int vorbis_staticbook_pack(const static_codebook *c, oggpack_buffer *opb)
vorbis_info_mapping *(* unpack)(vorbis_info *, oggpack_buffer *)
GLuint GLuint GLsizei count
void vorbis_book_clear(codebook *b)
void(* pack)(vorbis_info *, vorbis_info_mapping *, oggpack_buffer *)
vorbis_func_floor * _floor_P[]
vorbis_info_residue *(* unpack)(vorbis_info *, oggpack_buffer *)
vorbis_func_residue * _residue_P[]
void _vi_psy_free(vorbis_info_psy *i)
void oggpack_readinit(oggpack_buffer *b, unsigned char *buf, int bytes)
void(* pack)(vorbis_info_residue *, oggpack_buffer *)
int vorbis_analysis_headerout(vorbis_dsp_state *v, vorbis_comment *vc, ogg_packet *op, ogg_packet *op_comm, ogg_packet *op_code)
int vorbis_staticbook_unpack(oggpack_buffer *opb, static_codebook *s)
void oggpack_writeinit(oggpack_buffer *b)
long oggpack_bytes(oggpack_buffer *b)
int vorbis_comment_query_count(vorbis_comment *vc, char *tag)
void oggpack_reset(oggpack_buffer *b)
vorbis_info_psy * psy_param[4]
void vorbis_comment_clear(vorbis_comment *vc)
void oggpack_writeclear(oggpack_buffer *b)
long oggpack_read(oggpack_buffer *b, int bits)
void vorbis_comment_add_tag(vorbis_comment *vc, char *tag, char *contents)
void(* free_info)(vorbis_info_residue *)
void vorbis_info_clear(vorbis_info *vi)
char * vorbis_comment_query(vorbis_comment *vc, char *tag, int count)
vorbis_info_mapping * map_param[64]