This stops decreasing numerical values of --loop-file on each iteration so that loop-file=N loops every playlist entry without having to add --loop-file to --reset-on-next-file. The current behavior confuses users as seen in: https://github.com/mpv-player/mpv/issues/2481 https://github.com/mpv-player/mpv/issues/5943 https://github.com/mpv-player/mpv/issues/11291 https://github.com/mpv-player/mpv/issues/13860 https://www.reddit.com/r/mpv/comments/rcwnrw/looping_each_file_n_times_in_a_playlist/ Also options are supposed to reflect the value configured by the user and not change on their own. A remaining-file-loops property is exposed as a replacement to check how many loops are left.
Showing the changes to player/command.c (1 of 6 files). Show all
Unified · Split
| @@ -869,6 +869,13 @@ static int mp_property_playtime_remaining(void *ctx, struct m_property *prop, · 868 unmodified lines | ||
| 869 | 869 | return property_time(action, arg, remaining / speed); |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | +static int mp_property_remaining_file_loops(void *ctx, struct m_property *prop, | |
| 873 | + int action, void *arg) | |
| 874 | +{ | |
| 875 | + MPContext *mpctx = ctx; | |
| 876 | + return m_property_int_ro(action, arg, mpctx->remaining_file_loops); | |
| 877 | +} | |
| 878 | + | |
| 872 | 879 | /// Current chapter (RW) |
| 873 | 880 | static int mp_property_chapter(void *ctx, struct m_property *prop, |
| 874 | 881 | int action, void *arg) |
| @@ -3999,7 +4006,7 @@ static const struct m_property mp_properties_base[] = { · 3124 unmodified lines | ||
| 3999 | 4006 | {"audio-pts", mp_property_audio_pts}, |
| 4000 | 4007 | {"playtime-remaining", mp_property_playtime_remaining}, |
| 4001 | 4008 | M_PROPERTY_ALIAS("playback-time", "time-pos"), |
| 4002 | − {"chapter", mp_property_chapter}, | |
| 4009 | + {"remaining-file-loops", mp_property_remaining_file_loops}, | |
| 4003 | 4010 | {"edition", mp_property_edition}, |
| 4004 | 4011 | {"current-edition", mp_property_current_edition}, |
| 4005 | 4012 | {"chapters", mp_property_chapters}, |
| @@ -7484,6 +7491,11 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags, · 3478 unmodified lines | ||
| 7484 | 7491 | mpctx->stop_play = PT_CURRENT_ENTRY; |
| 7485 | 7492 | } |
| 7486 | 7493 | |
| 7494 | + if (opt_ptr == &opts->loop_file) { | |
| 7495 | + mpctx->remaining_file_loops = opts->loop_file; | |
| 7496 | + mp_notify_property(mpctx, "remaining-file-loops"); | |
| 7497 | + } | |
| 7498 | + | |
| 7487 | 7499 | if (opt_ptr == &opts->ab_loop[0] || opt_ptr == &opts->ab_loop[1]) { |
| 7488 | 7500 | update_ab_loop_clip(mpctx); |
| 7489 | 7501 | // Update if visible |