summaryrefslogtreecommitdiffstats
path: root/demux/demux_mf.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-02-28 19:14:23 +0100
committerwm4 <wm4@nowhere>2016-02-28 19:28:34 +0100
commit92ba63079617f6579c276dd3ec54197b56378913 (patch)
treefff93c447a045a03cbc51ac4a0bac3a360220054 /demux/demux_mf.c
parentb638a413c37e8c892fcf40ca4ae29693f4942d0c (diff)
downloadmpv-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 'demux/demux_mf.c')
-rw-r--r--demux/demux_mf.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/demux/demux_mf.c b/demux/demux_mf.c
index c60f5c6307..c0b159e4ea 100644
--- a/demux/demux_mf.c
+++ b/demux/demux_mf.c
@@ -159,15 +159,12 @@ static mf_t *open_mf_single(void *talloc_ctx, struct mp_log *log, char *filename
return mf;
}
-static void demux_seek_mf(demuxer_t *demuxer, double rel_seek_secs, int flags)
+static void demux_seek_mf(demuxer_t *demuxer, double seek_pts, int flags)
{
mf_t *mf = demuxer->priv;
- int newpos = (flags & SEEK_ABSOLUTE) ? 0 : mf->curr_frame - 1;
-
+ int newpos = seek_pts * mf->sh->codec->fps;
if (flags & SEEK_FACTOR)
- newpos += rel_seek_secs * (mf->nr_of_files - 1);
- else
- newpos += rel_seek_secs * mf->sh->codec->fps;
+ newpos = seek_pts * (mf->nr_of_files - 1);
if (newpos < 0)
newpos = 0;
if (newpos >= mf->nr_of_files)