player: don't decrement --ab-loop-count=N and add remaining-ab-loops

Follow up to the previous commit. Stop decreasing --ab-loop-count=N on
each iteration so it is preserved across different loops. In particular
it is preserved between different files without adding it to
--reset-on-next-file. Add a property to expose the remaning A-B loop
count instead.

The current behavior of --ab-loop-count=N is even worse than --loop-file
since it also doesn't reset when defining a new A-B loop in the same
file. Defining it has no effect after --ab-loop-count has decreased to
0, and this can't be fixed by adding it to --reset-on-next-file. This
commit also resets remaining-ab-loops every time --ab-loop-a and
--ab-loop-b are set to fix this.
This commit is contained in:
Guido Cella
2024-07-04 22:07:10 +02:00
committed by Kacper Michajłow
parent f411f3145b
commit 6107112b32
8 changed files with 34 additions and 11 deletions

View File

@@ -1,2 +1,4 @@
numerical values of `--loop-file` no longer decrease on each iteration
add `remaining-file-loops` property as a replacement to get the remaining loop count
numerical values of `--ab-loop-count` no longer decrease on each iteration
add `remaining-ab-loops` property as a replacement to get the remaining loop count

View File

@@ -2148,6 +2148,12 @@ Property list
times it causes the player to seek to the beginning of the file, so it is 0
the last the time is played. -1 corresponds to infinity.
``remaining-ab-loops``
How many more times the current A-B loop is going to be looped, if one is
active. This is initialized from the value of ``--ab-loop-count``. This
counts the number of times it causes the player to seek to ``--ab-loop-a``,
so it is 0 the last the time the loop is played. -1 corresponds to infinity.
``chapter`` (RW)
Current chapter number. The number of the first chapter is 0.

View File

@@ -441,11 +441,10 @@ Playback Control
``--ab-loop-count=<N|inf>``
Run A-B loops only N times, then ignore the A-B loop points (default: inf).
Every finished loop iteration will decrement this option by 1 (unless it is
set to ``inf`` or 0). ``inf`` means that looping goes on forever. If this
option is set to 0, A-B looping is ignored, and even the ``ab-loop`` command
will not enable looping again (the command will show ``(disabled)`` on the
OSD message if both loop points are set, but ``ab-loop-count`` is 0).
``inf`` means that looping goes on forever. If this option is set to 0, A-B
looping is ignored, and even the ``ab-loop`` command will not enable looping
again (the command will show ``(disabled)`` on the OSD message if both loop
points are set, but ``ab-loop-count`` is 0).
``--ordered-chapters=<yes|no>``
Enable support for Matroska ordered chapters. mpv will load and