summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-23 21:24:50 +0200
committerwm4 <wm4@nowhere>2016-09-23 21:24:50 +0200
commit9eef41dec15580623cfa62909221fbc1fbf41706 (patch)
treedc03baf40c1905f3af4725404ad16d909f0d1964 /options
parentf0fd6633205fe0b477032d2be5028a204c327e0b (diff)
downloadmpv-9eef41dec15580623cfa62909221fbc1fbf41706.tar.bz2
mpv-9eef41dec15580623cfa62909221fbc1fbf41706.tar.xz
player: do not let pseudo-gui override user config settings
Seems like this confused users quite often. Instead of --profile=pseudo-gui, --player-operation-mode=pseudo-gui now has to be used to invoke pseudo GUI mode. The old way still works, and still behaves in the old way.
Diffstat (limited to 'options')
-rw-r--r--options/m_config.c7
-rw-r--r--options/m_config.h2
-rw-r--r--options/options.c4
-rw-r--r--options/options.h2
4 files changed, 15 insertions, 0 deletions
diff --git a/options/m_config.c b/options/m_config.c
index 5c8a99b372..576527c0c5 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -658,6 +658,10 @@ static int handle_set_opt_flags(struct m_config *config,
if ((flags & M_SETOPT_PRESERVE_CMDLINE) && co->is_set_from_cmdline)
set = false;
+ if ((flags & M_SETOPT_NO_OVERWRITE) &&
+ (co->is_set_from_cmdline || co->is_set_from_config))
+ set = false;
+
if ((flags & M_SETOPT_NO_FIXED) && (optflags & M_OPT_FIXED))
return M_OPT_INVALID;
@@ -680,6 +684,9 @@ void m_config_mark_co_flags(struct m_config_option *co, int flags)
{
if (flags & M_SETOPT_FROM_CMDLINE)
co->is_set_from_cmdline = true;
+
+ if (flags & M_SETOPT_FROM_CONFIG_FILE)
+ co->is_set_from_config = true;
}
// Unlike m_config_set_option_raw() this does not go through the property layer
diff --git a/options/m_config.h b/options/m_config.h
index 4571488051..94a6c9e6ee 100644
--- a/options/m_config.h
+++ b/options/m_config.h
@@ -40,6 +40,7 @@ struct mp_log;
struct m_config_option {
bool is_hidden : 1; // Does not show up in help
bool is_set_from_cmdline : 1; // Set by user from command line
+ bool is_set_from_config : 1; // Set by a config file
bool is_set_locally : 1; // Has a backup entry
bool warning_was_printed : 1;
int16_t shadow_offset; // Offset into m_config_shadow.data
@@ -155,6 +156,7 @@ enum {
M_SETOPT_PRESERVE_CMDLINE = 32, // Don't set if already marked as FROM_CMDLINE
M_SETOPT_NO_FIXED = 64, // Reject M_OPT_FIXED options
M_SETOPT_NO_PRE_PARSE = 128, // Reject M_OPT_PREPARSE options
+ M_SETOPT_NO_OVERWRITE = 256, // Skip options marked with FROM_*
};
// Flags for safe option setting during runtime.
diff --git a/options/options.c b/options/options.c
index f401b00803..bbe74ff8a2 100644
--- a/options/options.c
+++ b/options/options.c
@@ -250,6 +250,10 @@ const m_option_t mp_opts[] = {
OPT_FLAG("list-properties", property_print_help,
CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP),
+ OPT_CHOICE("player-operation-mode", operation_mode,
+ M_OPT_FIXED | M_OPT_PRE_PARSE | M_OPT_NOPROP,
+ ({"cplayer", 0}, {"pseudo-gui", 1})),
+
OPT_FLAG("shuffle", shuffle, 0),
// ------------------------- common options --------------------
diff --git a/options/options.h b/options/options.h
index 3e4978f0cb..7885b9090e 100644
--- a/options/options.h
+++ b/options/options.h
@@ -74,6 +74,8 @@ typedef struct MPOpts {
int msg_time;
char *log_file;
+ int operation_mode;
+
char **reset_options;
char **script_files;
char **script_opts;