[theora-dev] Theora packets with granulepos of -1

ogg.k.ogg.k at googlemail.com ogg.k.ogg.k at googlemail.com
Tue Feb 24 05:10:15 PST 2009

> Well, your procedure for seeking is dangerously wrong for a start. If
> you follow your advice, one would begin decoding from the _last_ page
> of the previous keyframe - as opposed to the first page (or as near as
> posible) of the keyframe.

Could you be more specific about what is wrong ? This page seems to
be a high level overview of seeking, I believe Conrad had posted a
finer grained list of steps to ogg-dev a few months ago, and I thought
this had been copied to the wiki, but maybe not (or somewhere else).

Bear in mind that the granpos effectively seeked to is strictly earlier
than the target - an error I've made in the past, leading me to believe
decoding would start slightly too late.

> Also there is no mention of -1 granulepos, the value of the first
> keyframe, or of how to calculate the keyframe shift.

-1 granpos is for continued pages, so you wouldn't consider them for
seeking since their granpos is unknown.

The value of the first keyframe is irrelevant for seeking. The corner
cases are seeking exactly to one bound (eg, seeking to the start of
the stream, in which case you don't find a valid granpos < target),
and seeking out of the bounds of your stream. I don't think you need
to worry about the first granpos in each case.

The keyframe shift is a given, its calculation is codec dependent.

Hope I haven't said anything wrong in there, I'm taking the opportunity
to exercise my ogg-fu :)

More information about the theora-dev mailing list