-namespace {
-
-size_t read(void *ptr, size_t size, size_t nmemb, void *src)
-{
- Msp::IO::Base *in = reinterpret_cast<Msp::IO::Base *>(src);
- unsigned len = in->read(reinterpret_cast<char *>(ptr), size*nmemb);
- return len/size;
-}
-
-int seek(void *src, ogg_int64_t offset, int whence)
-{
- Msp::IO::SeekType type;
- if(whence==SEEK_SET)
- type = Msp::IO::S_BEG;
- else if(whence==SEEK_CUR)
- type = Msp::IO::S_CUR;
- else if(whence==SEEK_END)
- type = Msp::IO::S_END;
- else
- return -1;
-
- Msp::IO::Seekable *in = reinterpret_cast<Msp::IO::Seekable *>(src);
- return in->seek(offset, type);
-}
-
-long tell(void *src)
-{
- return reinterpret_cast<Msp::IO::Seekable *>(src)->tell();
-}
-
-ov_callbacks io_callbacks =
-{
- &read,
- &seek,
- 0,
- &tell
-};
-
-} // namespace
-