[vorbis-dev] song length calculation

Michael Smith msmith at labyrinth.net.au
Wed Sep 20 20:32:52 PDT 2000



At 05:29 PM 9/20/00 -0500, you wrote:
>Hey guys,
>
>Is there any example code for determining
>song length without using the direct file access
>functions? (such as ov_time_total() ) 
>What's the formula for the time calculation?

The only 'example code' for this is the implementation of ov_time_total() -
it isn't trivial, but it's not too hard, just a fair amount of code.

It's mostly made hard by chained streams, so you have to first find the
stream boundaries (which is a bit of a pain). Then you just capture the
page at the end of the logical bitstream, find the total length (samples),
which is easy, and divide by sample rate (which is constant for a logical
bitstream, but possibly not for a physical bitstream containing multiple
chained streams).

Michael

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