[vorbis-dev] Packet Granule position

Michael Smith msmith at xiph.org
Sun Mar 28 18:02:01 PST 2004



On Saturday 27 March 2004 01:36, Adriano Almeida wrote:
> Is there a way to know the exact packet granule position before I decode
> it? is there any relationship between packet size and granule position? I
> know each page has its own granule position, can i calculate it for each
> packet??
>

Calculating per-packet granulepos values is possible, but non-trivial. It 
requires several things:
 - The page granulepos (you may have to use this to adjust the final 
calculated granulepos).
 - The previous packet granulepos (you can use a page granulepos here instead 
if you want to start from some arbitrary point)
 - The previous packet blocksize.
 - The current packet blocksize.

The latter requires partial decode of the packet (it's in the first few bits 
somewhere), as well as header information.

Mike

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