diff options
author | wm4 <wm4@nowhere> | 2016-02-28 19:14:23 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-02-28 19:28:34 +0100 |
commit | 92ba63079617f6579c276dd3ec54197b56378913 (patch) | |
tree | fff93c447a045a03cbc51ac4a0bac3a360220054 /player | |
parent | b638a413c37e8c892fcf40ca4ae29693f4942d0c (diff) | |
download | mpv-92ba63079617f6579c276dd3ec54197b56378913.tar.bz2 mpv-92ba63079617f6579c276dd3ec54197b56378913.tar.xz |
demux: remove relative seeking
Ever since a change in mplayer2 or so, relative seeks were translated to
absolute seeks before sending them to the demuxer in most cases. The
only exception in current mpv is DVD seeking.
Remove the SEEK_ABSOLUTE flag; it's not the implied default. SEEK_FACTOR
is kept, because it's sometimes slightly useful for seeking in things
like transport streams. (And maybe mkv files without duration set?)
DVD seeking is terrible because DVD and libdvdnav are terrible, but
mostly because libdvdnav is terrible. libdvdnav does not expose seeking
with seek tables. (Although I know xbmc/kodi use an undocumented API
that is not declared in the headers by dladdr()ing it - I think the
function is dvdnav_jump_to_sector_by_time().) With the current mpv
policy if not giving a shit about DVD, just revert our half-working seek
hacks and always use dvdnav_time_search(). Relative seeking might get
stuck sometimes; in this case --hr-seek=always is recommended.
Diffstat (limited to 'player')
-rw-r--r-- | player/loadfile.c | 2 | ||||
-rw-r--r-- | player/playloop.c | 15 | ||||
-rw-r--r-- | player/sub.c | 2 |
3 files changed, 5 insertions, 14 deletions
diff --git a/player/loadfile.c b/player/loadfile.c index 9ab930dfa7..b1e9cd2057 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -209,7 +209,7 @@ void reselect_demux_stream(struct MPContext *mpctx, struct track *track) double pts = get_current_time(mpctx); if (pts == MP_NOPTS_VALUE) pts = 0; - demux_seek(track->demuxer, pts, SEEK_ABSOLUTE); + demux_seek(track->demuxer, pts, 0); } } } diff --git a/player/playloop.c b/player/playloop.c index 3e68ee9027..07a21e462c 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -242,8 +242,7 @@ static int mp_seek(MPContext *mpctx, struct seek_params seek) // Prefer doing absolute seeks, unless not possible. if ((seek.type == MPSEEK_FACTOR && !mpctx->demuxer->ts_resets_possible && - target_time != MP_NOPTS_VALUE) || - (seek.type == MPSEEK_RELATIVE && (!mpctx->demuxer->rel_seeks || hr_seek))) + target_time != MP_NOPTS_VALUE) || seek.type == MPSEEK_RELATIVE) { seek.type = MPSEEK_ABSOLUTE; seek.amount = target_time; @@ -253,15 +252,7 @@ static int mp_seek(MPContext *mpctx, struct seek_params seek) double demuxer_amount = seek.amount; - int demuxer_style = 0; - switch (seek.type) { - case MPSEEK_FACTOR: - demuxer_style |= SEEK_ABSOLUTE | SEEK_FACTOR; - break; - case MPSEEK_ABSOLUTE: - demuxer_style |= SEEK_ABSOLUTE; - break; - } + int demuxer_style = seek.type == MPSEEK_FACTOR ? SEEK_FACTOR : 0; if (hr_seek || direction < 0) { demuxer_style |= SEEK_BACKWARD; } else if (direction > 0) { @@ -281,7 +272,7 @@ static int mp_seek(MPContext *mpctx, struct seek_params seek) double main_new_pos = demuxer_amount; if (seek.type != MPSEEK_ABSOLUTE) main_new_pos = target_time; - demux_seek(track->demuxer, main_new_pos, SEEK_ABSOLUTE | SEEK_BACKWARD); + demux_seek(track->demuxer, main_new_pos, 0); } } diff --git a/player/sub.c b/player/sub.c index 6b2a3664dc..6892ac935b 100644 --- a/player/sub.c +++ b/player/sub.c @@ -103,7 +103,7 @@ static bool update_subtitle(struct MPContext *mpctx, double video_pts, { // Assume fully_read implies no interleaved audio/video streams. // (Reading packets will change the demuxer position.) - demux_seek(track->demuxer, 0, SEEK_ABSOLUTE); + demux_seek(track->demuxer, 0, 0); track->preloaded = sub_read_all_packets(track->d_sub); } |