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.) --- player/playloop.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'player') diff --git a/player/playloop.c b/player/playloop.c index cabdb4e441..bcec02e21a 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -204,7 +204,7 @@ static int mp_seek(MPContext *mpctx, struct seek_params seek, } } int direction = 0; - if (seek.type == MPSEEK_RELATIVE) { + if (seek.type == MPSEEK_RELATIVE && (!mpctx->demuxer->rel_seeks || hr_seek)) { seek.type = MPSEEK_ABSOLUTE; direction = seek.amount > 0 ? 1 : -1; seek.amount += get_current_time(mpctx); @@ -233,10 +233,13 @@ static int mp_seek(MPContext *mpctx, struct seek_params seek, demuxer_style |= SEEK_ABSOLUTE; break; } - if (hr_seek || direction < 0) + if (hr_seek || direction < 0) { demuxer_style |= SEEK_BACKWARD; - else if (direction > 0) + } else if (direction > 0) { demuxer_style |= SEEK_FORWARD; + } + if (hr_seek) + demuxer_style |= SEEK_HR; if (hr_seek || opts->mkv_subtitle_preroll) demuxer_style |= SEEK_SUBPREROLL; -- cgit v1.2.3