diff options
author | wm4 <wm4@nowhere> | 2014-05-18 18:57:02 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-05-18 19:21:39 +0200 |
commit | caa939aa91157937759a8be54f9c794d05fd0120 (patch) | |
tree | c607c46bd72131a28ddb808f03ebd56412b566a5 /options/m_config.h | |
parent | f47a4fc3d900e14653bc059717e2805ad4964a67 (diff) | |
download | mpv-caa939aa91157937759a8be54f9c794d05fd0120.tar.bz2 mpv-caa939aa91157937759a8be54f9c794d05fd0120.tar.xz |
options: unify code for setting string and "raw" options
The code paths for setting options by string and by direct "raw" value
were too different, which resulted in some weird code. Make the code
paths closer to each other.
Also, use this to remove the weirdness in the mpv_set_option()
implementation.
Diffstat (limited to 'options/m_config.h')
-rw-r--r-- | options/m_config.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/options/m_config.h b/options/m_config.h index 57a271f1c4..5a6274b945 100644 --- a/options/m_config.h +++ b/options/m_config.h @@ -116,8 +116,13 @@ enum { M_SETOPT_FROM_CMDLINE = 8, // Mark as set by command line M_SETOPT_BACKUP = 16, // Call m_config_backup_opt() before 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 }; +// Flags for safe option setting during runtime. +#define M_SETOPT_RUNTIME (M_SETOPT_NO_FIXED | M_SETOPT_NO_PRE_PARSE) + // Set the named option to the given string. // flags: combination of M_SETOPT_* flags (0 for normal operation) // Returns >= 0 on success, otherwise see OptionParserReturn. @@ -139,10 +144,15 @@ static inline int m_config_set_option0(struct m_config *config, return m_config_set_option(config, bstr0(name), bstr0(param)); } +// Similar to m_config_set_option_ext(), but set as data in its native format. +// The type data points to is as in co->opt +int m_config_set_option_raw(struct m_config *config, struct m_config_option *co, + void *data, int flags); + // Similar to m_config_set_option_ext(), but set as data using mpv_node. struct mpv_node; int m_config_set_option_node(struct m_config *config, bstr name, - struct mpv_node *data); + struct mpv_node *data, int flags); int m_config_parse_suboptions(struct m_config *config, char *name, |