comparison music2/koedec_ogg.cc @ 18:4d7486cb20a9

Sync with upstream
author thib
date Tue, 16 Sep 2008 15:30:03 +0000
parents fa8511a21d05
children a85cdca1980a
comparison
equal deleted inserted replaced
17:a95c130b567b 18:4d7486cb20a9
96 return pos-info->offset; 96 return pos-info->offset;
97 } 97 }
98 static int ogg_closefunc(void* datasource) { 98 static int ogg_closefunc(void* datasource) {
99 return 0; 99 return 0;
100 } 100 }
101
102 static int fseek_wrap(FILE *f,ogg_int64_t off,int whence){
103 if(f==NULL)return(-1);
104 return fseek(f,off,whence);
105 }
106
107
101 int ogg_get_rate(FILE *stream) 108 int ogg_get_rate(FILE *stream)
102 { 109 {
103 OggVorbis_File vf; 110 OggVorbis_File vf;
104 ov_callbacks callback(OV_CALLBACKS_DEFAULT); 111 ov_callbacks callback;
112 callback.read_func = (size_t (*)(void*, size_t, size_t, void*))fread;
113 callback.seek_func = (int (*)(void*, ogg_int64_t, int))fseek_wrap;
114 callback.tell_func = (long int (*)(void*))ftell;
105 callback.close_func = NULL; 115 callback.close_func = NULL;
106 ov_test_callbacks(stream, &vf, NULL, 0, callback); 116 ov_test_callbacks(stream, &vf, NULL, 0, callback);
107 int rate = vf.vi->rate; 117 int rate = vf.vi->rate;
108 ov_clear(&vf); 118 ov_clear(&vf);
109 return rate; 119 return rate;