[vorbis] Streaming ogg from filepointer pointing to archive of many oggs. Ogg stream does not stop after end of one ogg file - what to do ?

Ralph Giles giles at xiph.org
Wed Apr 21 12:54:21 PDT 2004



On Wed, Apr 21, 2004 at 09:01:31PM +0200, Andre Krause wrote:

> I'm currently trying to implement streaming off ogg-files out of an archive
> file using SDL and SDL_mixer for playback. Therefore i create a FILE *
> filepointer, place it to the beginning of an ogg file inside the archive and
> hand over the filepointer to ov_open. ( command: ov_open(fp, &music->vf,
> NULL, 0) ). This works fine so far. The problem is: if i put many oggs
> together in one archive, the playback stops only after the last ogg file.
> Why is this a problem ? Suppose i want to play the ogg files in random
> order. The playback must end after the current ogg, so the user can select a
> random new ogg file, place the filepointer to it and play the ogg.

The ogg vorbis libraries are written to 'do their best' when presented 
with corrupt data streams. Likely what's happening is that after 
reaching the end of the whatever segment you've started playback of, it 
just scans ahead and continues playing with the next valid ogg vorbis 
data it finds, and so on until EOF.

> So is there a method to determine when one ogg file ended and the other
> begins ?

This information is available from the vorbisfile internals (the ogg 
layer reports the gaps and segment changes). However, in an application 
where you've packed multiple independent files together in a wrapper, 
the best approach is probably to use the vorbisfile callback interface 
to just unwrap and hand it the data for the segment you want to play.

HTH,
 -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-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 mailing list