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

Michael Smith msmith at xiph.org
Mon May 3 20:46:57 PDT 2004



On Tuesday 04 May 2004 13:29, Ken Rogoway wrote:
> I was able to get most of my OGG files to load from a pack file by doing
> what you suggested.  However some of them fail when the stream is not
> seekable in the call to:
>
> ov_pcm_total()
>
> This returns a -131 when I set the callbacks.seek_func to return -1 and set
> the callbacks.tell_func function to NULL.

That's right. There's no way for libvorbisfile to find out how long a stream 
is if it's not seekable - there could be an indefinate amount of information 
to come.

>
> This appears to be returning OV_EINVAL (-131) because the stream is not
> seekable.  However, my code needs to know the number of samples so I can
> allocate a buffer to read into:

Do you really need to allocate a buffer for the entire stream? That could be 
awfully large. I'd not recommend this approach, unless you know with complete 
certainty that the streams will always be extremely short (say... less than a 
couple of seconds long).

If you absolutely _must_ do things this way, then you'll have to tell 
libvorbisfile that your "file" is seekable: if the underlying datasource is 
seekable, this is simple: you just need to make the seek/tell functions work 
relative to the start/end of your sub-file within your archive.

Mike

--- >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