[theora-dev] Theora packets with granulepos of -1

Ralph Giles giles at xiph.org
Mon Feb 23 09:23:55 PST 2009


On Mon, Feb 23, 2009 at 7:07 AM, salsaman <salsaman at gmail.com> wrote:

> That is correct. You have to calculate the keyframe granule shift for
> each file. For some strange reason best known to the developers this
> is split over 2 bytes:

Yeah, we messed up. Sorry.

> keyframe_granule_shift = (char) ((hpacket[40] & 0x03) << 3); // lower 3 bits
> keyframe_granule_shift |= (hpacket[41] & 0xe0) >> 5; // top 5 bits

lower two bits of byte 40, actually, and upper 4 bits of byte 41. It's
a 5 bit field.

 -r


More information about the theora-dev mailing list