HI all, Is there a way of finding out the length of an Ogg Vorbis file without decoding the whole file and counting samples? TIA, Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "... the industrial-capitalist mode of software production was doomed to be outcompeted from the moment capitalism began to create enough of a wealth surplus for many programmers to live in a post-scarcity gift culture." -- Eric S. Raymond
ov_pcm_total? It's in the vorbis docs. John Erik de Castro Lopo wrote:> HI all, > > Is there a way of finding out the length of an Ogg Vorbis file without > decoding the whole file and counting samples? > > TIA, > Erik
On Sat, Dec 01, 2007 at 01:06:46PM +1100, Erik de Castro Lopo wrote:> Is there a way of finding out the length of an Ogg Vorbis file without > decoding the whole file and counting samples?You can parse the header(s) for the sample rate, then use it to decode the first and last timestamps on each chain segment. Modulo holes, the sum of the differences will give you the duration. See ov_time_tell in vorbisfile.c. -r