diff options
-rw-r--r-- | DOCS/interface-changes.rst | 5 | ||||
-rw-r--r-- | DOCS/man/input.rst | 5 | ||||
-rw-r--r-- | DOCS/man/options.rst | 9 | ||||
-rw-r--r-- | etc/input.conf | 2 | ||||
-rw-r--r-- | player/command.c | 12 | ||||
-rw-r--r-- | player/osd.c | 9 |
6 files changed, 26 insertions, 16 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 1a175d798e..3be16933ba 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -20,8 +20,9 @@ Interface changes :: --- mpv 0.17.1 --- - - now ab-loops are active even if the "ab-loop-b" property is unset ("no"), - in which case the end of the file is used as B loop point + - now ab-loops are active even if one of the "ab-loop-a"/"-b" properties is + unset ("no"), in which case the start of the file is used if the A loop + point is unsert, and the end of the file for an unset B loop point --- mpv 0.17.0 --- - deprecate "track-list/N/audio-channels" property (use "track-list/N/demux-channel-count" instead) diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 52ace4aada..83fddcf968 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -1081,9 +1081,8 @@ Property list "default" MPV_FORMAT_FLAG ``ab-loop-a``, ``ab-loop-b`` (RW) - Set/get A-B loop points. See corresponding options and ``ab-loop`` command. - The special value ``no`` on ``ab-loop-a`` disables looping, while setting - ``ab-loop-b`` to ``no`` loops when the end of the file is reached. + Set/get A-B loop points. See corresponding options and ``ab-loop`` command + for details. ``angle`` (RW) Current DVD angle. diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 18ac7fd2f0..2bd76fa800 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -261,8 +261,13 @@ Playback Control ``--ab-loop-a=<time>``, ``--ab-loop-b=<time>`` Set loop points. If playback passes the ``b`` timestamp, it will seek to the ``a`` timestamp. Seeking past the ``b`` point doesn't loop (this is - intentional). The loop-points can be adjusted at runtime with the - corresponding properties. See also ``ab_loop`` command. + intentional). + + If both options are set to ``no``, looping is disabled. Otherwise, the + start/end of the file is used if one of the options is set to ``no``. + + The loop-points can be adjusted at runtime with the corresponding + properties. See also ``ab-loop`` command. ``--ordered-chapters``, ``--no-ordered-chapters`` Enabled by default. diff --git a/etc/input.conf b/etc/input.conf index b4438bbcae..0c29a47eb1 100644 --- a/etc/input.conf +++ b/etc/input.conf @@ -142,7 +142,7 @@ #CLOSE_WIN quit #CLOSE_WIN {encode} quit 4 #E cycle edition # next edition -#l ab_loop # Set/clear A-B loop points +#l ab-loop # Set/clear A-B loop points #L cycle-values loop "inf" "no" # toggle infinite looping #ctrl+c quit 4 diff --git a/player/command.c b/player/command.c index bfdcb820d3..7f65534d84 100644 --- a/player/command.c +++ b/player/command.c @@ -5245,16 +5245,20 @@ void handle_ab_loop(struct MPContext *mpctx) struct MPOpts *opts = mpctx->opts; double now = mpctx->restart_complete ? mpctx->playback_pts : MP_NOPTS_VALUE; - if (now != MP_NOPTS_VALUE && opts->ab_loop[0] != MP_NOPTS_VALUE) { + if (now != MP_NOPTS_VALUE && (opts->ab_loop[0] != MP_NOPTS_VALUE || + opts->ab_loop[1] != MP_NOPTS_VALUE)) + { + double start = opts->ab_loop[0]; + if (start == MP_NOPTS_VALUE) + start = 0; double end = opts->ab_loop[1]; if (end == MP_NOPTS_VALUE) end = INFINITY; - if (ctx->prev_pts >= opts->ab_loop[0] && - ctx->prev_pts < end && + if (ctx->prev_pts >= start && ctx->prev_pts < end && (now >= end || mpctx->stop_play == AT_END_OF_FILE)) { mark_seek(mpctx); - queue_seek(mpctx, MPSEEK_ABSOLUTE, opts->ab_loop[0], + queue_seek(mpctx, MPSEEK_ABSOLUTE, start, MPSEEK_EXACT, false); } } diff --git a/player/osd.c b/player/osd.c index 7da4a038bf..810df73719 100644 --- a/player/osd.c +++ b/player/osd.c @@ -362,14 +362,15 @@ void set_osd_bar_chapters(struct MPContext *mpctx, int type) mpctx->osd_progbar.num_stops = 0; double len = get_time_length(mpctx); if (len > 0) { - if (opts->ab_loop[0] != MP_NOPTS_VALUE && - opts->ab_loop[1] != MP_NOPTS_VALUE) - { + if (opts->ab_loop[0] != MP_NOPTS_VALUE) { MP_TARRAY_APPEND(mpctx, mpctx->osd_progbar.stops, mpctx->osd_progbar.num_stops, opts->ab_loop[0] / len); + } + if (opts->ab_loop[1] != MP_NOPTS_VALUE) { MP_TARRAY_APPEND(mpctx, mpctx->osd_progbar.stops, mpctx->osd_progbar.num_stops, opts->ab_loop[1] / len); - } else { + } + if (mpctx->osd_progbar.stops == 0) { int num = get_chapter_count(mpctx); for (int n = 0; n < num; n++) { double time = chapter_start_time(mpctx, n); |