diff options
-rw-r--r-- | DOCS/man/options.rst | 14 | ||||
-rw-r--r-- | options/options.c | 4 | ||||
-rw-r--r-- | player/playloop.c | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index c6df057834..33431a03e7 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -205,11 +205,15 @@ Playback Control Note that ``--playlist`` always loads all entries, so you use that instead if you really have the need for this functionality. -``--loop-file`` - Loop a single file. The difference to ``--loop=inf`` is that this doesn't - loop the playlist, just the file itself. If the playlist contains only a - single file, the difference between the two option is that this option - performs a seek on loop, instead of reloading the file. +``--loop-file=<N|inf|no>`` + Loop a single file N times. ``inf`` means forever, ``no`` means normal + playback. For compatibility, ``--loop-file`` and ``--loop-file=yes`` are + also accepted, and are the same as ``--loop-file=inf``. + + The difference to ``--loop`` is that this doesn't loop the playlist, just + the file itself. If the playlist contains only a single file, the difference + between the two option is that this option performs a seek on loop, instead + of reloading the file. ``--ordered-chapters``, ``--no-ordered-chapters`` Enabled by default. diff --git a/options/options.c b/options/options.c index 5085366389..0e570705ef 100644 --- a/options/options.c +++ b/options/options.c @@ -481,7 +481,9 @@ const m_option_t mp_opts[] = { OPT_CHOICE_OR_INT("loop", loop_times, M_OPT_GLOBAL, 2, 10000, ({"no", -1}, {"1", -1}, {"inf", 0})), - OPT_FLAG("loop-file", loop_file, 0), + OPT_CHOICE_OR_INT("loop-file", loop_file, M_OPT_OPTIONAL_PARAM, 0, 10000, + ({"yes", -1}, {"", -1}, {"no", 0}, // compat + {"inf", -1})), OPT_FLAG("resume-playback", position_resume, 0), OPT_FLAG("save-position-on-quit", position_save_on_quit, 0), diff --git a/player/playloop.c b/player/playloop.c index 647a864513..b9e35b41eb 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -756,6 +756,8 @@ static void handle_loop_file(struct MPContext *mpctx) mpctx->stop_play = KEEP_PLAYING; set_osd_function(mpctx, OSD_FFW); queue_seek(mpctx, MPSEEK_ABSOLUTE, get_start_time(mpctx), 0, true); + if (opts->loop_file > 0) + opts->loop_file--; } } |