Hi How do I find the duration of a OGA file programmatically ? Please let me know . thanks kiran -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/ogg-dev/attachments/20080410/fe746979/attachment-0001.htm
ogg.k.ogg.k at googlemail.com
2008-Aug-11 09:05 UTC
[ogg-dev] Reg: Finding Duration of OGA file
> How do I find the duration of a OGA file programmatically ? Please let me > know .For the first chain, you need to compute the length of each chain. The chain duration is the max of all of these. For Vorbis, the length of a stream is the difference between the granulepos of the last packet less that of the first one, divided by the sample rate. For Speex and/or FLAC, it's likely similar, but I do not know for certain. If there is more than one chain, you need to repeat this for all chains, and add the durations. Binary search may be required to get the BOS packets for subsequent chains. If it's a "simple" stream, libvorbisfile could tell you this easily, though simple ones tend to be ogg files - newer libvorbisfile can read and discard other streams though, so may be enough.