[theora-dev] newest cvs and mplayer

Ralph Giles giles at xiph.org
Thu Jun 5 15:20:17 PDT 2003

On Thursday, June 5, 2003, at 09:54 pm, David Kuehling wrote:

> What is the cleanest way to detect header packets?  For vorbis that was
> done by checking some bits in the packet, but that method failed for
> theora.  I currently don't have the time to do read all the docs and
> sources, so I'd be very pleased for helpful comments...

the header packets all begin with 0x8*, 'theora'. That is, the first 
bit is '1' for non-data packets. 0x80 is the first header, 0x81 are the 
comments and 0x82 are the decoder tables. Data packets begin with the 
bit '0'.

> Another problem is the detection of keyframes which I implemented using
> some kind of stupid "heuristic".  Someone on mplayer-dev told me that 
> it
> should break when bitstream changes, but it still works so far.  So I'm
> not very motivated to change it as long as theora bitstream isn't
> frozen...

There's a hack with the granulepos to assist seeking; the granulepos is 
really a fixed point number, with the integer part counting keyframes 
and the fractional part counting frames since the last keyframe. 
Therefore you can look for the lower-order bits being zero to identify 
a keyframe. The radix is variable from file to file however, you'll 
have to pull it out of the header to be reliable.


--- >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 'theora-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 Theora-dev mailing list