[vorbis] Finding length (time) of encoded birstream

Michael Smith msmith at labyrinth.net.au
Sun Mar 10 23:49:37 PST 2002



At 11:54 PM 3/10/02 -0600, you wrote:
>This is kind of a 'doh!' answer. Search for the last page and get the vi
>info. Nuff said. Thanks all!!!

The better answer is this: If you can seek (i.e. it's not a stream, or
something still being encoded, etc.), then you can seek to the end of
the file and find the last page, then figure all this out. This is 
pretty complex - getting seeking right (in all cases) is a _lot_ harder
than it looks. 

Which is why using vorbisfile is a good idea - it's pretty well 
optimised in the way it searches for stream ends, and gets it right in
all known cases (in CVS, anyway. rc3 had some bugs which you'd rarely
hit). It's also designed to be very simple to use - getting started
shouldn't take more than 5 minutes.

You can open the file (ov_open()), then find out stream length with
ov_time_total(), and then use ov_read() for actual decoding.

Michael

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