summaryrefslogtreecommitdiffstats
path: root/options/parse_configfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-08-07 19:39:46 +0200
committerwm4 <wm4@nowhere>2020-08-07 19:41:56 +0200
commit1f132c675a18f0b80fc3159a7b13b5b061f2d93c (patch)
treebb421d3c4dcae749c4161bd3e2abeb981c28ee44 /options/parse_configfile.c
parentd5a02dd9342f5c61f3e3a9caf2082dd46b5099e3 (diff)
downloadmpv-1f132c675a18f0b80fc3159a7b13b5b061f2d93c.tar.bz2
mpv-1f132c675a18f0b80fc3159a7b13b5b061f2d93c.tar.xz
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.
Diffstat (limited to 'options/parse_configfile.c')
-rw-r--r--options/parse_configfile.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/options/parse_configfile.c b/options/parse_configfile.c
index 96b607d554..627c466948 100644
--- a/options/parse_configfile.c
+++ b/options/parse_configfile.c
@@ -127,16 +127,7 @@ int m_config_parse(m_config_t *config, const char *location, bstr data,
goto error;
}
- int res;
- if (bstr_equals0(option, "profile-desc")) {
- m_profile_set_desc(profile, value);
- res = 0;
- } else if (bstr_equals0(option, "profile-cond")) {
- m_profile_set_cond(profile, value);
- res = 0;
- } else {
- res = m_config_set_profile_option(config, profile, option, value);
- }
+ int res = m_config_set_profile_option(config, profile, option, value);
if (res < 0) {
MP_ERR(config, "%s setting option %.*s='%.*s' failed.\n",
loc, BSTR_P(option), BSTR_P(value));