1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-18 04:45:33 +00:00

demux_mkv: fix relative seeks without index

Relative seeks didn't add the current position as they should. Fix.

Note that this had no effect in normal playback case even if the file
had no index, because the "accurate_seek" logic at higher level would
convert all commands to absolute seeks before calling demuxer level.
This commit is contained in:
Uoti Urpala 2010-11-08 05:18:48 +02:00
parent 259ab1fe2d
commit 0619b75cb1

View File

@ -2522,12 +2522,12 @@ static void demux_mkv_seek(demuxer_t *demuxer, float rel_seek_secs,
if (!(flags & SEEK_FACTOR)) { /* time in secs */
mkv_index_t *index = NULL;
stream_t *s = demuxer->stream;
int64_t target_timecode = 0, diff, min_diff = 0xFFFFFFFFFFFFFFFLL;
int64_t diff, min_diff = 0xFFFFFFFFFFFFFFF;
int i;
if (!(flags & SEEK_ABSOLUTE)) /* relative seek */
target_timecode = (int64_t) (mkv_d->last_pts * 1000.0);
target_timecode += (int64_t) (rel_seek_secs * 1000.0);
rel_seek_secs += mkv_d->last_pts;
int64_t target_timecode = rel_seek_secs * 1000.0;
if (target_timecode < 0)
target_timecode = 0;