I had this problem and after a "few"searches I came to this method:
first decode and setup the ogg file until the point u find the modes
configuration.
If u have the previous page, save the granule postition.
while( !endOfPackets)
{
getPacket;
check if this is and audio packet;
read window configurations;
thisPacketSize = previousPacketWindowSize/4+ thisPacketWindowSize/4;
packetsGranule += thisPacketSize;
realGranule = lastPageGranule+packetsGranule;
}
if u want u can save packets granule inside a realgranule vector. I haven't
covered the case where the page is a continued page
<p>Hope it helps
<p>----- Original Message -----
From: "illiminable" <ogg@illiminable.com>
To: <vorbis-dev@xiph.org>
Sent: Tuesday, May 18, 2004 6:59 AM
Subject: [vorbis-dev] Calculating vorbis packet durations...
<p>> After a few other attempts at hacks to determine start times of
pages, the> only other option left is to partially decode the packets in the demuxer
in> order to give correct start time stamps after a seek.
>
> Someone mentioned it was relatively easy to do without a full decode.
I've
> had a bit of a search in the mailing lists and on the web and can't
find
any> details about it.
>
> What i need is to be able to calculate the duration of all complete
packets> on a page such that i can subtract it from the end granule pos.
>
> Can someone point me to some psuedo-code or actual code of how to do this
?> I assume the info needed is stored somewhere in the vorbis packet. I'm
also> looking for the same information for speex also.
>
> Thanks
>
> Zen.
>
>
>
> --- >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@xiph.org'> containing only the word 'unsubscribe' in the body. No subject is
needed.
> Unsubscribe messages sent to the list will be ignored/filtered.
--- >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@xiph.org'
containing only the word 'unsubscribe' in the body. No subject is
needed.
Unsubscribe messages sent to the list will be ignored/filtered.