summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-01-09 01:41:02 +0100
committerwm4 <wm4@nowhere>2013-01-09 01:48:40 +0100
commitf96dd88b41d5786afd181b833d62d1b1bcfcee10 (patch)
tree6a9a1103cf8691fcf07cbc38e7d1fb49c5869349 /core
parentc45132cb92f95e56b0c0e6380c9c83bc4d92c4f0 (diff)
downloadmpv-f96dd88b41d5786afd181b833d62d1b1bcfcee10.tar.bz2
mpv-f96dd88b41d5786afd181b833d62d1b1bcfcee10.tar.xz
mplayer: make --loop loop the playlist instead of each playlist entry
This is simpler and more useful. We could add a new switch for the old functionality, but that would probably be more confusing than helpful. When passing only a single file to the command line, this commit shouldn't change behavior. (Classic mplayer provided both features by duplicating the loop functionality in the "playtree".)
Diffstat (limited to 'core')
-rw-r--r--core/cfg-mplayer.h2
-rw-r--r--core/mplayer.c39
2 files changed, 9 insertions, 32 deletions
diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h
index 9121359b02..cbe705ebc4 100644
--- a/core/cfg-mplayer.h
+++ b/core/cfg-mplayer.h
@@ -667,7 +667,7 @@ const m_option_t mplayer_opts[]={
{"leak-report", "", CONF_TYPE_PRINT, 0, 0, 0, (void*)1},
OPT_FLAG_CONSTANTS("no-loop", loop_times, 0, 0, -1),
- OPT_CHOICE_OR_INT("loop", loop_times, M_OPT_LOCAL, 1, 10000,
+ OPT_CHOICE_OR_INT("loop", loop_times, CONF_GLOBAL, 1, 10000,
({"no", -1}, {"0", -1},
{"inf", 0})),
diff --git a/core/mplayer.c b/core/mplayer.c
index 99fdd128d1..17b5404537 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -3511,32 +3511,6 @@ static void run_playloop(struct MPContext *mpctx)
}
}
- /* Looping. */
- if (opts->loop_times >= 0 && (mpctx->stop_play == AT_END_OF_FILE ||
- mpctx->stop_play == PT_NEXT_ENTRY)) {
- mp_msg(MSGT_CPLAYER, MSGL_V, "loop_times = %d\n", opts->loop_times);
-
- int stop_reason = mpctx->stop_play;
-
- if (opts->loop_times > 1)
- opts->loop_times--;
- else if (opts->loop_times == 1)
- opts->loop_times = -1;
- play_n_frames = play_n_frames_mf;
- mpctx->stop_play = 0;
- mpctx->seek = (struct seek_params) {0};
- struct seek_params sp = {
- .type = MPSEEK_ABSOLUTE,
- .amount = rel_time_to_abs(mpctx, opts->play_start, 0),
- .exact = 1,
- };
- if (seek(mpctx, sp, false) != 0) {
- mp_msg(MSGT_CPLAYER, MSGL_ERR, "Can't loop an unseekable file.\n");
- opts->loop_times = -1;
- mpctx->stop_play = stop_reason;
- }
- }
-
if (mpctx->seek.type) {
seek(mpctx, mpctx->seek, false);
mpctx->seek = (struct seek_params){ 0 };
@@ -4097,11 +4071,6 @@ goto_enable_cache: ;
//==================== START PLAYING =======================
- if (opts->loop_times > 1)
- opts->loop_times--;
- else if (opts->loop_times == 1)
- opts->loop_times = -1;
-
mp_tmsg(MSGT_CPLAYER, MSGL_V, "Starting playback...\n");
drop_frame_cnt = 0; // fix for multifile fps benchmark
@@ -4216,6 +4185,14 @@ static void play_files(struct MPContext *mpctx)
if (mpctx->stop_play == PT_NEXT_ENTRY) {
new_entry = playlist_get_next(mpctx->playlist, +1);
+ if (!new_entry && mpctx->opts.loop_times >= 0) {
+ new_entry = mpctx->playlist->first;
+ if (mpctx->opts.loop_times > 0) {
+ mpctx->opts.loop_times--;
+ if (mpctx->opts.loop_times == 0)
+ mpctx->opts.loop_times = -1;
+ }
+ }
} else if (mpctx->stop_play == PT_CURRENT_ENTRY) {
new_entry = mpctx->playlist->current;
} else if (mpctx->stop_play == PT_RESTART) {