summaryrefslogtreecommitdiffstats
path: root/mpvcore/mplayer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-08-19 00:50:39 +0200
committerwm4 <wm4@nowhere>2013-08-19 01:05:49 +0200
commit4579cce768d0c9c84dc5f318b7189ffb03b49ece (patch)
tree86ddbbbeb92e4e0c78e72d9d393c27c91dcc9580 /mpvcore/mplayer.c
parent2508f38a92f8863cfc156b2b7310512863db7d4e (diff)
downloadmpv-4579cce768d0c9c84dc5f318b7189ffb03b49ece.tar.bz2
mpv-4579cce768d0c9c84dc5f318b7189ffb03b49ece.tar.xz
mplayer: reshuffle on every loop if --loop and --shuffle are used
See github issue #194. Unfortunately, this breaks the property that going back in the playlist always works as expected. This changes, because the playlist_prev command will work on the reshuffled playlist, instead of loading the previously played files in order. If this ever becomes an issue, I might revert this commit.
Diffstat (limited to 'mpvcore/mplayer.c')
-rw-r--r--mpvcore/mplayer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mpvcore/mplayer.c b/mpvcore/mplayer.c
index ab8ebe3968..fe1d18740b 100644
--- a/mpvcore/mplayer.c
+++ b/mpvcore/mplayer.c
@@ -4473,6 +4473,8 @@ struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction)
struct playlist_entry *next = playlist_get_next(mpctx->playlist, direction);
if (!next && mpctx->opts->loop_times >= 0) {
if (direction > 0) {
+ if (mpctx->opts->shuffle)
+ playlist_shuffle(mpctx->playlist);
next = mpctx->playlist->first;
if (next && mpctx->opts->loop_times > 0) {
mpctx->opts->loop_times--;
@@ -4733,6 +4735,8 @@ static int mpv_main(int argc, char *argv[])
mpctx->osd = osd_create(opts, mpctx->ass_library);
+ if (opts->shuffle)
+ playlist_shuffle(mpctx->playlist);
mpctx->playlist->current = mpctx->playlist->first;
play_files(mpctx);