[theora] OGGZ Seeking in Theora

Conrad Parker conrad at metadecks.org
Mon Jun 7 15:48:50 PDT 2010


On 7 June 2010 20:02, Stefan Weber <s_weber at blyth.ch> wrote:
> Hi Conrad
>
> Thanks for your reply to my request. I was able to eliminate some questions
> now.
> But I obviously still have some issues calculating the keyframe position.
> This is what I do:
>
> ogg_int64_t granule = oggz_tell_granulepos(oggz);
> int shift = oggz_get_granuleshift(oggz, sn);
> int noOfFramesSinceKeyframe = granule>>shift;
> int keyFramePosition = oldPosition - noOfFramesSinceKeyframe;
> oggz_seek_units(oggz, keyFramePosition, SEEK_SET);
>
> oldPosition being the position where initially has been seeked to as from
> oggz_tell_units().
>
> Seeking works, but not to keyframes :(  Am I getting wrong some units or
> something?

This line:

| int noOfFramesSinceKeyframe = granule>>shift;

calculates the position of the previous keyframe, not the offset since. See:

http://wiki.xiph.org/GranulePosAndSeeking

so you should be able to use that calculation directly for keyFramePosition.

>> If you're working with this now anyway, please try the seek-rewrite
>> branch, from the repo at github: http://github.com/kfish/liboggz
>
> Whats different in this branch? Why would I use it?

It has improvements in both efficiency and accuracy, but does not have
as much real-world testing. If people test it and report good results
then it will be released as the main version sooner.

Conrad.

> Am 06.06.2010 23:54, schrieb Conrad Parker:
>
> 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
>
> cheers,
>
> Conrad.
>
>
>
> _______________________________________________
> theora mailing list
> theora at xiph.org
> http://lists.xiph.org/mailman/listinfo/theora
>
>


More information about the theora mailing list