Mercurial > otakunoraifu
diff music2/koedec_ogg.cc @ 18:4d7486cb20a9
Sync with upstream
author | thib |
---|---|
date | Tue, 16 Sep 2008 15:30:03 +0000 |
parents | fa8511a21d05 |
children | a85cdca1980a |
line wrap: on
line diff
--- a/music2/koedec_ogg.cc +++ b/music2/koedec_ogg.cc @@ -98,10 +98,20 @@ static long ogg_tellfunc(void* datasourc static int ogg_closefunc(void* datasource) { return 0; } + +static int fseek_wrap(FILE *f,ogg_int64_t off,int whence){ + if(f==NULL)return(-1); + return fseek(f,off,whence); +} + + int ogg_get_rate(FILE *stream) { OggVorbis_File vf; - ov_callbacks callback(OV_CALLBACKS_DEFAULT); + ov_callbacks callback; + callback.read_func = (size_t (*)(void*, size_t, size_t, void*))fread; + callback.seek_func = (int (*)(void*, ogg_int64_t, int))fseek_wrap; + callback.tell_func = (long int (*)(void*))ftell; callback.close_func = NULL; ov_test_callbacks(stream, &vf, NULL, 0, callback); int rate = vf.vi->rate;