From 966f0a41a4182cf4027a5d49b248a26ff49368f3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 19 Jan 2015 20:45:31 +0100 Subject: demux_disc: pass seek flags to stream layer Pass through the seek flags to the stream layer. The STREAM_CTRL semantics become a bit awkward, but that's still the least awkward part about optical disc media. Make demux_disc.c request relative seeks. Now the player will use relative seeks if the user sends relative seek commands, and the demuxer announces it wants these by setting rel_seeks to true. This change probably changes seek behavior for dvd, dvdnav, bluray, cdda, and possibly makes seeking useless if the demuxer-cache is set to a high value. Will be used in the next commit. (Split to make reverting the next commit easier.) --- demux/demux_disc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'demux/demux_disc.c') diff --git a/demux/demux_disc.c b/demux/demux_disc.c index 69643a0053..37b189861f 100644 --- a/demux/demux_disc.c +++ b/demux/demux_disc.c @@ -169,6 +169,7 @@ static void d_seek(demuxer_t *demuxer, double rel_seek_secs, int flags) double pts = p->seek_pts; if (flags & SEEK_ABSOLUTE) pts = 0.0f; + double base_pts = pts; // to what pts is relative if (flags & SEEK_FACTOR) { double tmp = 0; @@ -180,7 +181,8 @@ static void d_seek(demuxer_t *demuxer, double rel_seek_secs, int flags) MP_VERBOSE(demuxer, "seek to: %f\n", pts); - stream_control(demuxer->stream, STREAM_CTRL_SEEK_TO_TIME, &pts); + double seek_arg[] = {pts, base_pts, flags}; + stream_control(demuxer->stream, STREAM_CTRL_SEEK_TO_TIME, seek_arg); demux_control(p->slave, DEMUXER_CTRL_RESYNC, NULL); p->seek_pts = pts; @@ -312,6 +314,8 @@ static int d_open(demuxer_t *demuxer, enum demux_check check) // Can be seekable even if the stream isn't. demuxer->seekable = true; + demuxer->rel_seeks = true; + // With cache enabled, the stream can be seekable. This causes demux_lavf.c // (actually libavformat/mpegts.c) to seek sometimes when reading a packet. // It does this to seek back a bit in case the current file position points -- cgit v1.2.3