[theora-dev] Seek issue in cortado player

salsaman salsaman at gmail.com
Mon Mar 15 13:45:01 PDT 2010

Just for reference, here is the ogg seeking algorithm I use, which has
proven 100% accurate for me:

1) Parse stream headers to get data. Some files have a first keyframe
of 0, others have a first keyframe of 1. So:-

2) Begin reading pages until we get at least one packet. Then check
the granulepos to find the first keyframe number (0 or 1). Store this
as e.g. keyframe_offset.


3) To get a target frame, first search through the file to find the
largest granulepos<=target, taking into account the keyframe_offset.

More information about the theora-dev mailing list