summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-05-27 01:33:35 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:05 +0200
commit878d4ea2ee22cc8d11652aee0fe144ca3f6ae131 (patch)
treec2e5c5b76b4141b140b2723e03848db90b8513d3
parent7a0f112a448df1d0390d53a3169606cad4ee6589 (diff)
downloadmpv-878d4ea2ee22cc8d11652aee0fe144ca3f6ae131.tar.bz2
mpv-878d4ea2ee22cc8d11652aee0fe144ca3f6ae131.tar.xz
player: remove some duplication between normal looping and ab-loops
Not sure if this is better or worse. Some minor behavior changes.
-rw-r--r--player/playloop.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/player/playloop.c b/player/playloop.c
index 0d5e9c1779..4067e13459 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -814,25 +814,30 @@ static void handle_loop_file(struct MPContext *mpctx)
{
struct MPOpts *opts = mpctx->opts;
+ if (mpctx->stop_play != AT_END_OF_FILE)
+ return;
+
+ double target = MP_NOPTS_VALUE;
+ enum seek_precision prec = MPSEEK_DEFAULT;
+
double ab[2];
- if (mpctx->stop_play == AT_END_OF_FILE && get_ab_loop_times(mpctx, ab) &&
- mpctx->ab_loop_clip)
- {
- // Assumes execute_queued_seek() happens before next audio/video is
- // attempted to be decoded or filtered.
- mpctx->stop_play = KEEP_PLAYING;
- mark_seek(mpctx);
- queue_seek(mpctx, MPSEEK_ABSOLUTE, ab[0], MPSEEK_EXACT,
- MPSEEK_FLAG_NOFLUSH);
+ if (get_ab_loop_times(mpctx, ab) && mpctx->ab_loop_clip) {
+ target = ab[0];
+ prec = MPSEEK_EXACT;
+ } else if (opts->loop_file) {
+ if (opts->loop_file > 0)
+ opts->loop_file--;
+ target = 0;
}
- // Do not attempt to loop-file if --ab-loop is active.
- else if (opts->loop_file && mpctx->stop_play == AT_END_OF_FILE) {
+ if (target != MP_NOPTS_VALUE) {
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--;
+ mark_seek(mpctx);
+
+ // Assumes execute_queued_seek() happens before next audio/video is
+ // attempted to be decoded or filtered.
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, target, prec, MPSEEK_FLAG_NOFLUSH);
}
}