diff options
author | wm4 <wm4@nowhere> | 2013-12-01 00:12:10 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-12-01 00:12:10 +0100 |
commit | b18f02d1ad5e5ce4031438f1cd0f1f3aaaf83003 (patch) | |
tree | b723192a213fbdb0b64a742c91bc106237e5d539 /mpvcore/m_config.c | |
parent | aaddcb702ef93eac9087852202a59f91abb31433 (diff) | |
download | mpv-b18f02d1ad5e5ce4031438f1cd0f1f3aaaf83003.tar.bz2 mpv-b18f02d1ad5e5ce4031438f1cd0f1f3aaaf83003.tar.xz |
options: add options that set defaults for af/vf/ao/vo
There are some use cases for this. For example, you can use it to set
defaults of automatically inserted filters (like af_lavrresample). It's
also useful if you have a non-trivial VO configuration, and want to use
--vo to quickly change between the drivers without repeating the whole
configuration in the --vo argument.
Diffstat (limited to 'mpvcore/m_config.c')
-rw-r--r-- | mpvcore/m_config.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mpvcore/m_config.c b/mpvcore/m_config.c index 7ada99e068..2d6cc5a554 100644 --- a/mpvcore/m_config.c +++ b/mpvcore/m_config.c @@ -230,6 +230,26 @@ int m_config_set_obj_params(struct m_config *conf, char **args) return 0; } +int m_config_apply_defaults(struct m_config *config, const char *name, + struct m_obj_settings *defaults) +{ + int r = 0; + for (int n = 0; defaults && defaults[n].name; n++) { + struct m_obj_settings *entry = &defaults[n]; + if (name && strcmp(entry->name, name) == 0) { + if (entry->attribs && strcmp(entry->attribs[0], "_oldargs_") == 0) { + mp_tmsg(MSGT_CFGPARSER, MSGL_ERR, + "Filter '%s' can't take defaults, because it uses " + "custom option parsing.\n", name); + return -1; + } + r = m_config_set_obj_params(config, entry->attribs); + break; + } + } + return r; +} + int m_config_initialize_obj(struct m_config *config, struct m_obj_desc *desc, void **ppriv, char ***pargs) { |