summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorLeo Izen <leo.izen@gmail.com>2017-12-03 22:28:50 -0500
committerLeo Izen <leo.izen@gmail.com>2017-12-03 22:32:36 -0500
commit4efe330efba296f6f07089d60087ef4e054bfe04 (patch)
tree635ab1bf44a7727c3e97c6a1ec8ef0480fd5d9b0 /player
parentff7e2946103ce35da702e57e03012c29215017d2 (diff)
downloadmpv-4efe330efba296f6f07089d60087ef4e054bfe04.tar.bz2
mpv-4efe330efba296f6f07089d60087ef4e054bfe04.tar.xz
player/playloop.c: respect playback start time when using --loop-file
Using --loop-file should now seek to the position denoted by --start or equivalent option, rather than always seeking to the beginning as it had done before. --loop-playlist already behaves this way, so this brings --loop-file in line for added consistency.
Diffstat (limited to 'player')
-rw-r--r--player/playloop.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/player/playloop.c b/player/playloop.c
index 6a22bf166b..61c9ad3b7b 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -778,11 +778,17 @@ static void handle_loop_file(struct MPContext *mpctx)
// 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);
- if (opts->loop_file > 0)
- opts->loop_file--;
+ double play_start_pts = get_play_start_pts(mpctx);
+ double play_end_pts = get_play_end_pts(mpctx);
+ if (play_start_pts < play_end_pts){
+ mpctx->stop_play = KEEP_PLAYING;
+ set_osd_function(mpctx, OSD_FFW);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, play_start_pts, MPSEEK_EXACT,
+ MPSEEK_FLAG_NOFLUSH);
+ if (opts->loop_file > 0)
+ opts->loop_file--;
+ }
+
}
}