History

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

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.

Guido Cella committed 2 years ago

Commit f411f311 parent 397212a6 files · +30 −5Browse files

Showing the changes to player/command.c (1 of 6 files). Show all

Unified · Split

player/command.c+13−1
@@ -869,6 +869,13 @@ static int mp_property_playtime_remaining(void *ctx, struct m_property *prop, · 868 unmodified lines
869869 return property_time(action, arg, remaining / speed);
870870 }
871871
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+
872879 /// Current chapter (RW)
873880 static int mp_property_chapter(void *ctx, struct m_property *prop,
874881 int action, void *arg)
@@ -3999,7 +4006,7 @@ static const struct m_property mp_properties_base[] = { · 3124 unmodified lines
39994006 {"audio-pts", mp_property_audio_pts},
40004007 {"playtime-remaining", mp_property_playtime_remaining},
40014008 M_PROPERTY_ALIAS("playback-time", "time-pos"),
4002− {"chapter", mp_property_chapter},
4009+ {"remaining-file-loops", mp_property_remaining_file_loops},
40034010 {"edition", mp_property_edition},
40044011 {"current-edition", mp_property_current_edition},
40054012 {"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
74847491 mpctx->stop_play = PT_CURRENT_ENTRY;
74857492 }
74867493
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+
74877499 if (opt_ptr == &opts->ab_loop[0] || opt_ptr == &opts->ab_loop[1]) {
74887500 update_ab_loop_clip(mpctx);
74897501 // Update if visible

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t