[vorbis-dev] Reading OGG embedded in a pack file

Ralph Giles giles at xiph.org
Sat Apr 17 10:03:50 PDT 2004



On Sat, Apr 17, 2004 at 11:23:46AM -0500, Ken Rogoway wrote:

> After looking at the documentation I thought I could change the 4th parameter to be the offset into the stream for where my sub file (inside the pack file) is located.  This did not work.  It took about 10 seconds for the function to return so I am guessing it was seeking to the beginning of the stream and then scanning forward looking for the OGG headers.

No, the 3rd and 4th parameters are to let you provide a 'prefix buffer' 
in cases where the underlying file isn't seekable, but you've already 
read some of it to do filetype identification. Thus you can pass the bit 
you've read so vorbisfile can parse it, and then continue with the 
actual stream from the read position.

Thus, your hypotheses is likely correct about what it's doing.

> There are comments about using streams that are not "seekable" and I thought this also might be a solution, but I could find nothing on how to tell Vorbis that a stream was not seekable.  Is it as simple as setting the callbacks.seek_func and callbacks.tell_func to NULL?

You can set tell_func to NULL when the stream is not seekable. You must 
always provide a seek_func; the way you mark a stream as not seekable is 
by having that function always return (-1) for failure, regardless of 
the input. See http://xiph.org/ogg/vorbis/doc/vorbisfile/callbacks.html

Another general solution of course is to doctor your read, seek, and 
tell callbacks to operate relative to the offset of the ogg data in 
your pak file.

Hope that helps,
 -r
--- >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