[theora] OGGZ Seeking in Theora
conrad at metadecks.org
Sun Jun 6 14:54:10 PDT 2010
On 7 June 2010 02:12, Stefan Weber <s_weber at blyth.ch> wrote:
> Dear all
> Excuse me for pushing this again.
> Can't somebody give me a little hint on how to setup OGGZ for seeking
> with Theora?
what you wrote sounds right. You should only need a page callback to
handle the intermediate step. The callbacks are not asynchronous, they
all happen in the same thread and only see data that gets passed
through the most recent call to oggz_read().
You can get the granuleshift with oggz_get_granuleshift(). The
difference between ogg_page_granulepos() and oggz_tell_granulepos() is
that the oggz version will work out the granulepos for a packet, even
if it was not recorded in the stream. At the page level it doesn't
matter so much.
If you're working with this now anyway, please try the seek-rewrite
branch, from the repo at github: http://github.com/kfish/liboggz
> Dear all
> 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.
> theora mailing list
> theora at xiph.org
More information about the theora