[FFmpeg-devel] [PATCH] replace ogg seek function by read_timestamp and generic seek

Rich Felker dalias
Thu Oct 4 04:53:23 CEST 2007


On Wed, Oct 03, 2007 at 10:17:27PM +0100, M?ns Rullg?rd wrote:
> Rich Felker <dalias at aerifal.cx> writes:
> 
> > On Wed, Oct 03, 2007 at 06:53:58PM +0200, Reimar D?ffinger wrote:
> >> Hello,
> >> On Wed, Oct 03, 2007 at 05:42:36PM +0100, M?ns Rullg?rd wrote:
> >> > Rich Felker wrote:
> >> > > Shouldn't the generic binary search code handle using the keyframe
> >> > > information?
> >> > 
> >> > That would of course be reasonable, but I can't see that it's being
> >> > done.
> >> 
> >> Not possible currently since read_timestamp does not report keyflag or
> >> not nor does it return data (the index-based binary search does it
> >> though).
> >> You could hack it by making read_timestamp only report keyframes, but
> >> that would probably slow down the search unnecessarily.
> >
> > Umm, just do the binary search as usual, then do a linear search from
> > that point to look for a keyframe.
> 
> Searching forwards for a keyframe is easy, while searching backwards
> is not.  An application can request either.

Searching backwards is not that hard, and yes I know about it and
consider it important. (I'm sure others remember how much time I spent
making sure NUT could seek backward sanely...) Start by scanning back
a reasonable initial interval, then increasingly large intervals as
you fail (a sort of binary-search-to-minus-infinity).

Rich




More information about the ffmpeg-devel mailing list