[theora] OGGZ Seeking in Theora
s_weber at blyth.ch
Sun Jun 6 10:12:42 PDT 2010
Excuse me for pushing this again.
Can't somebody give me a little hint on how to setup OGGZ for seeking
Thanks in advance for your support.
I'm aware that there have been several discussions about the seeking
issue and I'm sorry to bring this up again.
To solve the problem with Inter-Frame garbage, a seek to the previous
keyframe has to be made. The keyframe number should be extracted from
the granulepos of the frame where we want to seek to. I hope I
understood the theory - unfortunately a few questions have rised during
- How do I extract the keyframe number? Is shifting the granule position
by "keyframe_granule_shift" correct?
- How can this be implemented using the OGGZ library? My current,
_UGLY_, approach is the following:
a) At the start of seeking, set the Packet-/Page-Callback to a new
b) A first OGGZ seek jumps to the desired frame number.
c) OGGZ read() with some Bytes is called until the Seek-Packet/Page
Callback was executed
d) In the callback function, I get the granule pos
(ogg_page_granulepos or oggz_tell_granulepos?), then I extract the
keyframe number by shifting the granule position.
e) A final OGGZ seek is made to the calculated keyframe number.
f) Set callback(s) back to the actual data decoding functions.
As the callbacks are being called asynchronously, I'm not even sure if
my seek callback is being called with the desired frames/packets.
I hope my question was not too confusing...
Thanks for your help and any replies.
More information about the theora