[FFmpeg-devel] [PATCH] First shot at AVCHD seeking via new seeking API
Ivan Schreter
schreter
Tue Jul 7 23:48:27 CEST 2009
Hi,
> I've finally found some time to experiment a bit further with seeking
> code. I've implemented a read_seek2 routine in mpegts.c and some
> generic code for finding proper position in lavf/utils.c. This is just
> a first shot, as I suppose, I can make the generic code a little
> simpler. Comments welcome.
>
> Basically, the implementation in mpegts.c first calls generic seeking
> routine to find approximate position with given timestamp (via
> bisection) and then calls the routine to find exact position in
> lavf/utils.c based on given timestamp criteria.
>
> The lavf patch introduces two functions, one public to be used by
> demuxers (av_gen_syncpoint_search) and one internal to iterate to
> proper position (av_search_keyframe_multi_partial). The implementation
> tries to find for each active stream key frames just before and just
> after the target timestamp. If there is no key frame fulfilling the
> timestamp criteria in given direction, then obviously only one
> direction can be used. Additionally, timestamp and position of minimum
> timestamp frame will be also stored, in order to handle one special
> case (see later).
>
> After the positions and timestamps of key frames are known, we will
> search for closest timestamp to the requested one and then for an
> associated position in the file where to reposition the file pointer
> in order to guarantee that all active streams meet a key frame before
> this position.
>
> There is one special case, however: seeking to a negative timestamp or
> timestamp lower than minimum timestamp in the file. This was handled
> until now by seeking to the beginning of video file. Strictly
> speaking, the new API should simply discard the request returning an
> error. However, this will break just about any player and video
> editor, so I implemented it as a special case.
I've attached new version of the patches for MPEG-TS seeking. The above
still holds in general, but searching routine was simplified. The
filtering of invalid position is done after key frames are found, so
some special cases are removed. Also, seeking by byte position is now
implemented.
Any comments? If nobody vetoes it (Baptiste?, Michael?), I'll probably
commit it on the weekend.
Regards,
Ivan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: seek_cooked_lavf.patch
Type: text/x-patch
Size: 20084 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090707/967e91ba/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: seek_cooked_mpegts.patch
Type: text/x-patch
Size: 3367 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090707/967e91ba/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: seek_cooked_seekregress.patch
Type: text/x-patch
Size: 4719 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090707/967e91ba/attachment-0002.bin>
More information about the ffmpeg-devel
mailing list