diff options
author | wm4 <wm4@nowhere> | 2018-01-12 04:02:55 +0100 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2018-01-13 03:26:45 -0800 |
commit | 6d4b4c0de3152bc2deb2df09ec3e98e032124593 (patch) | |
tree | e257216a98e0a40610dc90e6e526152ea7f63833 /options/m_config.c | |
parent | 23edaf4412e378dabf061b6e852f7314b38b8020 (diff) | |
download | mpv-6d4b4c0de3152bc2deb2df09ec3e98e032124593.tar.bz2 mpv-6d4b4c0de3152bc2deb2df09ec3e98e032124593.tar.xz |
audio: add global options for resampler defaults
This is part of trying to get rid of --af-defaults, and the af
resample filter.
It requires a complicated mechanism to set the defaults on the resample
filter for backwards compatibility.
Diffstat (limited to 'options/m_config.c')
-rw-r--r-- | options/m_config.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/options/m_config.c b/options/m_config.c index 8bf7e0ef91..a487b64869 100644 --- a/options/m_config.c +++ b/options/m_config.c @@ -194,11 +194,18 @@ struct m_config *m_config_new(void *talloc_ctx, struct mp_log *log, return config; } -struct m_config *m_config_from_obj_desc(void *talloc_ctx, struct mp_log *log, - struct m_obj_desc *desc) +static struct m_config *m_config_from_obj_desc(void *talloc_ctx, + struct mp_log *log, + struct mpv_global *global, + struct m_obj_desc *desc) { - return m_config_new(talloc_ctx, log, desc->priv_size, desc->priv_defaults, - desc->options); + struct m_config *c = + m_config_new(talloc_ctx, log, desc->priv_size, desc->priv_defaults, + desc->options); + c->global = global; + if (desc->set_defaults && c->global) + desc->set_defaults(c->global, c->optstruct); + return c; } // Like m_config_from_obj_desc(), but don't allocate option struct. @@ -260,7 +267,7 @@ struct m_config *m_config_from_obj_desc_and_args(void *ta_parent, struct mp_log *log, struct mpv_global *global, struct m_obj_desc *desc, const char *name, struct m_obj_settings *defaults, char **args) { - struct m_config *config = m_config_from_obj_desc(ta_parent, log, desc); + struct m_config *config = m_config_from_obj_desc(ta_parent, log, global, desc); for (int n = 0; defaults && defaults[n].name; n++) { struct m_obj_settings *entry = &defaults[n]; |