AW: AW: [vorbis-dev] Reading OGG embedded in a pack file - vorbisfile extension

Lourens Veen lourens at rainbowdesert.net
Thu May 6 13:25:31 PDT 2004



On Thu 6 May 2004 12:49, Andre Krause wrote:
> yes, you are right. i always search for quick and easy solution
> and forget in the meantime that vorbis is a low level codec
> library. so probably a wrapper lib is the right way. but as far
> as i understand vorbisfile is already a bunch of convenience
> functions? so to speak a wrapper lib ? so why not enhance a
> little bit vorbisfile ?

You are right, it would be a good idea for vorbisfile I think (but 
ofcourse IANA xiph.org developer). I was thinking about the core 
libraries, but ofcourse ov_open is a libvorbisfile function, and I 
missed that. And if it's an addition then it shouldn't do any harm. 
I still think it would be better to improve documentation for the 
use of the callbacks though, but on the other hand, if you have to 
learn every detail then your program never gets finished. Sometimes 
the easy way out is the best way.

Anyway, I've had a look at ov_open() in vorbisfile.c, but adapting 
that to create your ov_open2() would be rather tricky. The tell and 
seek callbacks need to get passed the offsets of the start and end 
of the file, but they're plain functions, so they don't have a 
state so they can't "remember" them in between calls. Passing them 
each time doesn't work, since it would require passing extra 
arguments to the callback function, and the arguments are fixed in 
the type of the function pointer.

I can think of a nice way to do it in C++ (with a functor) and in 
Haskell (partial parameterization), but I can't see a way to do it 
in C other than with a global table that maps each FILE* used to 
the matching offsets and a set of callbacks that take that into 
account; like a functor but with external state. It'll probably 
work, but it's not very nice IMHO. Any better programmers with 
better solutions out there?

Lourens

-- 
GPG public key: http://home.student.utwente.nl/l.e.veen/lourens.key

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Vorbis-dev mailing list