summaryrefslogtreecommitdiffstats
path: root/player/playloop.c
diff options
context:
space:
mode:
authorLeo Izen <leo.izen@gmail.com>2017-12-03 22:19:16 -0500
committerLeo Izen <leo.izen@gmail.com>2017-12-03 22:23:24 -0500
commitff7e2946103ce35da702e57e03012c29215017d2 (patch)
treecb13071a68dbd3609b44d205964a65e7e4386783 /player/playloop.c
parenta6ca1677941b817cce401eb4d75f9c049b789b55 (diff)
downloadmpv-ff7e2946103ce35da702e57e03012c29215017d2.tar.bz2
mpv-ff7e2946103ce35da702e57e03012c29215017d2.tar.xz
player: use start timestamp for ab-looping if --ab-loop-a is absent
If --ab-loop-b is present, then ab-looping will be enabled and will attempt to seek to the beginning of the file. This patch changes it so it will instead seek to the start of playback, either via --start or some equivalent, rather than always to the beginning of the file.
Diffstat (limited to 'player/playloop.c')
-rw-r--r--player/playloop.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/player/playloop.c b/player/playloop.c
index 2d1db03867..6a22bf166b 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -768,15 +768,16 @@ static void handle_loop_file(struct MPContext *mpctx)
// Assumes execute_queued_seek() happens before next audio/video is
// attempted to be decoded or filtered.
mpctx->stop_play = KEEP_PLAYING;
- double start = 0;
- if (opts->ab_loop[0] != MP_NOPTS_VALUE)
- start = opts->ab_loop[0];
+ double start = get_ab_loop_start_time(mpctx);
+ if (start == MP_NOPTS_VALUE)
+ start = 0;
mark_seek(mpctx);
queue_seek(mpctx, MPSEEK_ABSOLUTE, start, MPSEEK_EXACT,
MPSEEK_FLAG_NOFLUSH);
}
- if (opts->loop_file && mpctx->stop_play == AT_END_OF_FILE) {
+ // Do not attempt to loop-file if --ab-loop is active.
+ else if (opts->loop_file && mpctx->stop_play == AT_END_OF_FILE) {
mpctx->stop_play = KEEP_PLAYING;
set_osd_function(mpctx, OSD_FFW);
queue_seek(mpctx, MPSEEK_ABSOLUTE, 0, MPSEEK_DEFAULT, MPSEEK_FLAG_NOFLUSH);