[ogg-dev] Seeking to granules in discontinuous streams

ogg.k.ogg.k at googlemail.com ogg.k.ogg.k at googlemail.com
Thu Feb 14 03:15:59 PST 2008


Some more thinking about this whole granulepos splitting. Sorry for
the badgering :)

The CMML way was presented as a similar way as the Theora way, which I didn't
see (I actually use such a system to allow multiple events to start at
the same time,
and this feels like the Theora way).
Theora can find any frame's previous keyframe granulepos by clearing
the low bits
of the frame's granulepos. In CMML, this is the other way round: you
have to shift
left by 32 to get the previous frame. This is what puzzled me I think.

Now, if one were to swap the 2 32 bit granulepos bits in CMML granules, then you
would still get a strictly increasing granulepos (since the previous
pointer can never
get backwards in time), and this would be more similar to Theora (eg,
clear off the low
bits). The high bits are now the backlink, and the low bits are the
granulepos are the
actual granule of the current packet (not an offset from the frame as
Theora does,
but closer to what it does).

You still lose 32 bits of granulespace, of course, which really
bothers me. At millisecond
precision, 32 bits (signed) just give 24 days. Yeah, I know I've said
it before :)

Anyway, this makes a generic seeking algorithm handle Theora and CMML the same
way, clear off the low bits below the granule shift and start off from there.


More information about the ogg-dev mailing list