Hi, Searched in Google, browsed xiph vorbis sites but found no good information about how to get the current playtime out of the granuleposition of the ogg_packet. Anyone knows if there is any 'Programming with libvorbis' documentation out there, cause on xiph's site (http://www.xiph.org/vorbis/doc/) there's nothing :( Any help? THX, Tom
On Thu, May 04, 2006 at 03:29:04PM +0200, Thomas Kuglitsch wrote:> Searched in Google, browsed xiph vorbis sites but found no good information > about how to get the current playtime out of the granuleposition of the > ogg_packet.If you have a configured vorbis_dsp_state for the packet you can use vorbis_granule_time() declared in vorbis/codec.h. You can also get an approximate value by just dividing by the sample rate given in the info header; but this will not be exact for some streams. Also keep in mind that streams can have holes in them, especially at the beginning, so you may want to take that into account if you're displaying this to a user.> Anyone knows if there is any 'Programming with libvorbis' documentation out > there, cause on xiph's site (http://www.xiph.org/vorbis/doc/) there's > nothing :(Yes, this is a very unfortunate ommission. :( -r
On Friday 05 May 2006 01:29, Thomas Kuglitsch wrote:> Hi, > > Searched in Google, browsed xiph vorbis sites but found no good > information about how to get the current playtime out of the > granuleposition of the ogg_packet.What granule position means depends on the codec being encapsulated. From http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html, section A 2: # The granule position of pages containing Vorbis audio is in units of PCM audio samples (per channel; a stereo stream's granule position does not increment at twice the speed of a mono stream). There's more, however, so give those docs a read.> Anyone knows if there is any 'Programming with libvorbis' documentation > out there, cause on xiph's site (http://www.xiph.org/vorbis/doc/) there's > nothing :(Nothing that I'm aware off. Most people can get away with using libvorbisfile. John