diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-03-19 05:25:12 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-03-24 04:05:04 +0200 |
commit | 73fb23c1cfc40a9e0683f0a82cb1a669005eaa67 (patch) | |
tree | a67ac6e34674e8466149b2f15743171c08a8d7ee /libmpdemux/demuxer.h | |
parent | 327940361170a4d830bc7c120503cdd0396a125a (diff) | |
download | mpv-73fb23c1cfc40a9e0683f0a82cb1a669005eaa67.tar.bz2 mpv-73fb23c1cfc40a9e0683f0a82cb1a669005eaa67.tar.xz |
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.
Diffstat (limited to 'libmpdemux/demuxer.h')
-rw-r--r-- | libmpdemux/demuxer.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index 8d1f1d0b88..032552b751 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -96,6 +96,8 @@ struct MPOpts; #define SEEK_ABSOLUTE (1 << 0) #define SEEK_FACTOR (1 << 1) +#define SEEK_FORWARD (1 << 2) +#define SEEK_BACKWARD (1 << 3) #define MP_INPUT_BUFFER_PADDING_SIZE 8 @@ -221,6 +223,9 @@ typedef struct demuxer { int type; // demuxer type: mpeg PS, mpeg ES, avi, avi-ni, avi-nini, asf int file_format; // file format: mpeg/avi/asf int seekable; // flag + /* Set if using absolute seeks for small movements is OK (no pts resets + * that would make pts ambigious, preferably supports back/forward flags */ + bool accurate_seek; // demux_stream_t *audio; // audio buffer/demuxer demux_stream_t *video; // video buffer/demuxer |