[MPlayer-dev-eng] [PATCH] theora support

David Kuehling dvdkhlng at gmx.de
Sun May 11 19:53:50 CEST 2003


Moritz Bunkus wrote:

> Sorry, I've overlooked this thread :/ Yes, the patch is ok, and I've
> committed it to main.

There are two points about demux_ogg.c, which are somewhat ugly:

1. keyframe detection in demux_ogg_seek should use the theora stream
   handler's theora-state for properly determining keyframes

   theora's method of encoding keyframe information is unbelievably
   stupid: the granule pos of theora pckets is calculated like this:
   (keyframeNo<<keyframeShift | interframeNo).  if the intermediated
   frame number `interframeNo' is zero, you know that you've a key
   frame.  unfortunately `keyframeShift' is NOT FIXED.  it's not even
   stored directly in the stream header, instead you will have to
   calculate the base-2 logarithm of `keyframe_frequency_force-1'
   (theora/lib/toplevel.c:theora_decode_init).

   currently my code just calculates `granulePos&0x1FF' and tests
   whether it's zero.  there's some chance that this will make it skip
   some keyframes or sync on a non-keyframe, but won't cause fatal
   errors.

   is there any possibility that `demux_ogg_seek' is called, before
   there is a stream handler and a `theora_state' object?

2. i don't understand demux_ogg_build_syncpoints_table, and i'm not sure
   that it will work properly with vorbis or theora streams.  since
   granulepos for vorbis and theora cannot be processed without stream
   information (`vorbis_info' respectively `theora_state'), building the
   syncpoint table should take place, _after_ stream handlers were
   created.  currently it seems to be build in `demux_ogg_open', before
   there are any stream handlers.

I could try to solve point 1, but this might take me some weeks, since
I'm currently quite busy with other things.  

cu

David Kühling
-- 
GnuPG public key: http://user.cs.tu-berlin.de/~dvdkhlng/dk.gpg
Fingerprint: B17A DC95 D293 657B 4205  D016 7DEF 5323 C174 7D40



More information about the MPlayer-dev-eng mailing list