From 1f132c675a18f0b80fc3159a7b13b5b061f2d93c Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 7 Aug 2020 19:39:46 +0200 Subject: options: add some way to more or less "unapply" profiles Make it possible to restore from profiles by backing up the option values before profile application. This is sort of like unapplying a profile. Since there might be multiple ways to do this, a profile needs to explicitly provide the "profile-restore" option, which specifies how exactly this should be done. This is a big mess. There is not natural way to do this. Profile application is "destructive" and simply changes the values of the options. Maybe one could argue that the option system should have hierarchical "overlays" of profiles instead, where unset options will use the value of the lower profiles. Options set interactively by the user would be the top profile. Default values would be in the lowest profile. You could unapply a profile by simply removing it from this overlay stack. But uh, let's not, so here's something stupid. It reuses some code used for file local options to reduce code size. At least the overlay idea would still be possible in theory, and could be added as another profile-restore mode. This is used by the following commit. --- DOCS/man/input.rst | 14 +++- DOCS/man/mpv.rst | 66 +++++++++++++++++++ options/m_config_frontend.c | 151 ++++++++++++++++++++++++++++++++++---------- options/m_config_frontend.h | 17 ++--- options/parse_configfile.c | 11 +--- player/command.c | 14 +++- 6 files changed, 212 insertions(+), 61 deletions(-) diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 6df7890383..8593dd75a2 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -1220,13 +1220,21 @@ Input Commands that are Possibly Subject to Change ``af-command