Add improved relative seek mode
commit73fb23c1cfc40a9e0683f0a82cb1a669005eaa67
authorUoti Urpala <uau@glyph.nonexistent.invalid>
Thu, 19 Mar 2009 03:25:12 +0000 (19 05:25 +0200)
committerUoti Urpala <uau@glyph.nonexistent.invalid>
Tue, 24 Mar 2009 02:05:04 +0000 (24 04:05 +0200)
treea67ac6e34674e8466149b2f15743171c08a8d7ee
parent327940361170a4d830bc7c120503cdd0396a125a
Add improved relative seek mode

When the new mode is active relative seeks are converted to absolute
ones (current video pts + relative seek amount) and forward/backward
flag before being sent to the demuxer. This mode is used if the
demuxer has set the accurate_seek field in the demuxer struct and
there is a video stream. At the moment the mkv and lavf demuxers
enable the flag.

This change is useful for later Matroska ordered chapter support (and
for more general timelime editing), but also fixes problems in
existing functionality. The main problem with the old mode, where
relative seeks are passed directly to the demuxer, is that the user
wants to seek relative to the currently displayed position but the
demuxer does not know what that position is. There can be an arbitrary
amount of buffering between the demuxer read position and what is
displayed on the screen. In some situations this makes small seeks
fail to move backward at all (especially visible at high playback
speed, when audio needs to be demuxed and decoded further ahead to
fill the output buffers after resampling).

Some container formats that can be used with the lavf demuxer do not
always have reliable timestamps that could be used for unambiguous
absolute seeking. However I made the demuxer always enable the new
mode because it already converted all seeks to absolute ones before
sending them to libavformat, so cases without reliable absolute seeks
were failing already and this should only improve the working cases.
libmpdemux/demux_lavf.c
libmpdemux/demux_mkv.c
libmpdemux/demuxer.h
mplayer.c