[FFmpeg-devel] [PATCH 1/2] add support for generic seeking by?reading timestamps in nuv

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Sep 12 17:56:51 CEST 2011

On Mon, Sep 12, 2011 at 02:12:48PM +0000, Joakim Plate wrote:
> Reimar Döffinger <Reimar.Doeffinger <at> gmx.de> writes:
> > 
> > Not a proper review yet, but your approach is inefficient.
> > You should not scan bytewise, but instead always read a 32 bit block and look 
> for jjjj - once you have a match,
> > check for a full RTjjjjjjjj...
> > I thought I had seen this implemented somewhere (in MPlayer? Or maybe just one 
> of the things I never finished.
> This patch has done several round already. Seems the last version in that thread 
> is not what we still had applied locally. You intended to look at it seems:
> http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/68778/focus=68794

Sorry for it going under.
But I think the idea I had back then was to do this:
Scan for jjjj using avio_rn32() or such.
If found:
- store current position
- seek back 5
- read 4 bytes
- check whether they contain 'R', 'RT', 'RTj' or 'RTjj', if not continue
- depending on that read and validate 0 - 3 bytes
- check the next 8 bytes are all j, if not continue
- if so, do resync code - if that fails continue

to continue, seek to stored position.

I believe this should result in both efficient and fairly readable way,
but considering how old this feature is I won't make this a requirement
if you don't want to do it.
But I think you didn't answer my question if you had a good sample for
this back then?


More information about the ffmpeg-devel mailing list