summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-10-05 18:30:45 +0200
committerwm4 <wm4@nowhere>2013-10-05 22:46:55 +0200
commit1be863afdbe9017aa227234e8525b209fb818224 (patch)
treea577f44058231a0e2ab2092cfa24d6f14c9f6a3b
parentc3ea08a2d7df3a782ce8e40a99caa807b6bc60b0 (diff)
downloadmpv-1be863afdbe9017aa227234e8525b209fb818224.tar.bz2
mpv-1be863afdbe9017aa227234e8525b209fb818224.tar.xz
mplayer: fix some issues with playlist_prev command
You couldn't jump to the first entry in the playlist, if that entry was marked as "too short". But this is usually fine, because it doesn't get into the way of the user. (This feature is meant to allow being able to jump backwards through the playlist even if a file immediately stops playback right after initialization, not to prevent playing these files at all.) Also, apply the skip logic when wrapping around the playlist when going backwards. This happens with --loop, because looping pretends the playlist is infinitely repeated forwards and backwards (as long as the playlist_prev/next commands are concerned). Also add some comments.
-rw-r--r--mpvcore/mplayer.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/mpvcore/mplayer.c b/mpvcore/mplayer.c
index 7669a83851..b82e6a9e5d 100644
--- a/mpvcore/mplayer.c
+++ b/mpvcore/mplayer.c
@@ -4719,9 +4719,13 @@ struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction,
bool force)
{
struct playlist_entry *next = playlist_get_next(mpctx->playlist, direction);
- if (direction < 0 && !force) {
+ if (next && direction < 0 && !force) {
+ // Don't jump to files that would immediately go to next file anyway
while (next && next->playback_short)
next = next->prev;
+ // Always allow jumping to first file
+ if (!next && mpctx->opts->loop_times < 0)
+ next = mpctx->playlist->first;
}
if (!next && mpctx->opts->loop_times >= 0) {
if (direction > 0) {
@@ -4735,8 +4739,12 @@ struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction,
}
} 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) {
+ // Don't endless loop if no file in playlist is playable
bool all_failed = true;
struct playlist_entry *cur;
for (cur = mpctx->playlist->first; cur; cur = cur->next) {