summaryrefslogtreecommitdiffstats
path: root/player/configfiles.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-01-08 00:16:15 -0600
committerDudemanguy <random342@airmail.cc>2023-01-09 16:37:14 +0000
commit6471afecd0277138efdb3a80dec12dbfff75c72f (patch)
tree3dbf1c722b0c473e53b44d6b415fd15a8459deb1 /player/configfiles.c
parentc4ec47a65e5840643024ba056ba4db20a4300ed2 (diff)
downloadmpv-6471afecd0277138efdb3a80dec12dbfff75c72f.tar.bz2
mpv-6471afecd0277138efdb3a80dec12dbfff75c72f.tar.xz
player: don't force saving start in watch-later-options
The watch-later mechanism has always unconditionally wrote start to files to save the playback position. When this was later expanded to watch-later-options, this logic was kept in place. But we don't actually have to unconditionally write this and can allow users to remove the option from the list if they want to. The start value still requires some special handling; it should always be written if possible regardless of the value changing. However, we can just place it within the default set of options for watch-later-options so it can be removed like any other.
Diffstat (limited to 'player/configfiles.c')
-rw-r--r--player/configfiles.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/player/configfiles.c b/player/configfiles.c
index 65dd9df425..ce7563995f 100644
--- a/player/configfiles.c
+++ b/player/configfiles.c
@@ -303,18 +303,23 @@ void mp_write_watch_later_conf(struct MPContext *mpctx)
write_filename(mpctx, file, cur->filename);
+ bool write_start = true;
double pos = get_current_time(mpctx);
if ((demux && (!demux->seekable || demux->partially_seekable)) ||
pos == MP_NOPTS_VALUE)
{
+ write_start = false;
MP_INFO(mpctx, "Not seekable, or time unknown - not saving position.\n");
- } else {
- fprintf(file, "start=%f\n", pos);
}
char **watch_later_options = mpctx->opts->watch_later_options;
for (int i = 0; watch_later_options && watch_later_options[i]; i++) {
char *pname = watch_later_options[i];
+ // Always save start if we have it in the array.
+ if (write_start && strcmp(pname, "start") == 0) {
+ fprintf(file, "%s=%f\n", pname, pos);
+ continue;
+ }
// Only store it if it's different from the initial value.
if (m_config_watch_later_backup_opt_changed(mpctx->mconfig, pname)) {
char *val = NULL;