Mercurial > otakunoraifu
diff music2/koedec.cc @ 45:53a311ea8289
Patched an old patch of mine (OGG koe files handling)... It's a bit less ugly, and it works with tremor!
author | thib |
---|---|
date | Wed, 25 Mar 2009 17:32:52 +0000 |
parents | 01aa5ddf7dc8 |
children | 35ce1a30f3f9 |
line wrap: on
line diff
--- a/music2/koedec.cc +++ b/music2/koedec.cc @@ -86,9 +86,7 @@ static AvgKoeCache koe_cache; AvgKoeInfo FindKoe(int file_number, int index) { return koe_cache.Find(file_number, index); }; -#if HAVE_LIBVORBISFILE || HAVE_LIBVORBISIDEC -extern int ogg_get_rate(FILE*); -#endif + AvgKoeInfo AvgKoeCache::Find(int file_number, int index) { AvgKoeInfo info; info.stream = 0; info.length = 0; info.offset = 0; @@ -113,19 +111,16 @@ AvgKoeInfo AvgKoeCache::Find(int file_nu } #if HAVE_LIBVORBISFILE || HAVE_LIBVORBISIDEC if (arcinfo == 0) { + //FIXME: OMG that's ugly, improve it as soon as you can! DIRFILE* koedir = (DIRFILE*) file_searcher.MakeARCFILE((FILESEARCH::ARCTYPE)0, "koe"); sprintf(fname, "%04d", file_number); koedir = new DIRFILE(koedir->SearchFile(fname)); sprintf(fname, "z%04d%05d.ogg", file_number, index); arcinfo = koedir->Find(fname, ".ogg"); delete koedir; - + if (arcinfo == 0) return info; - FILE* stream = arcinfo->OpenFile(); - info.rate = ogg_get_rate(stream); - fseek(stream, 0L, SEEK_END); - info.length = ftell(stream); - fseek(stream, 0L, SEEK_CUR); + FILE* stream = arcinfo->OpenFile(&info.length); info.type = koe_ogg; info.stream = stream; return info;