summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-12 22:41:45 +0100
committerwm4 <wm4@nowhere>2015-02-12 22:41:45 +0100
commitaee0978d50e21d8f114382fdb9c014c029f71a04 (patch)
tree5f53913088d11b7ae76da58f05a7845ed526485e /player/loadfile.c
parentc59a4f12db96784b054f28d52eaa33cb7553d630 (diff)
downloadmpv-aee0978d50e21d8f114382fdb9c014c029f71a04.tar.bz2
mpv-aee0978d50e21d8f114382fdb9c014c029f71a04.tar.xz
player: add a --loop=force mode
Requested. See manpage additions. This also makes the magical loop_times constants slightly saner, but shouldn't change the semantics of any existing --loop option values.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index 6560fe7806..d9d6a0036c 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -1317,26 +1317,24 @@ struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction,
while (next && next->playback_short)
next = next->prev;
// Always allow jumping to first file
- if (!next && mpctx->opts->loop_times < 0)
+ if (!next && mpctx->opts->loop_times == 1)
next = mpctx->playlist->first;
}
- if (!next && mpctx->opts->loop_times >= 0) {
+ if (!next && mpctx->opts->loop_times != 1) {
if (direction > 0) {
if (mpctx->opts->shuffle)
playlist_shuffle(mpctx->playlist);
next = mpctx->playlist->first;
- if (next && mpctx->opts->loop_times > 1) {
+ if (next && mpctx->opts->loop_times > 1)
mpctx->opts->loop_times--;
- if (mpctx->opts->loop_times == 1)
- mpctx->opts->loop_times = -1;
- }
} else {
next = mpctx->playlist->last;
// Don't jump to files that would immediately go to next file anyway
while (next && next->playback_short)
next = next->prev;
}
- if (!force && next && next->init_failed) {
+ bool ignore_failures = mpctx->opts->loop_times == -2;
+ if (!force && next && next->init_failed && !ignore_failures) {
// Don't endless loop if no file in playlist is playable
bool all_failed = true;
struct playlist_entry *cur;