From 4fa6bcbb902d500ca0a1b9d2feeab5a4e5a98345 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 2 Sep 2016 14:49:34 +0200 Subject: m_config: add helper function for initializing af/ao/vf/vo suboptions Normally I'd prefer a bunch of smaller functions with fewer parameters over a single function with a lot of parameters. But future changes will require messing with the parameters in a slightly more complex way, so a combined function will be needed anyway. The now-unused "global" parameter is required for later as well. --- audio/filter/af.c | 8 ++++---- audio/out/ao.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'audio') diff --git a/audio/filter/af.c b/audio/filter/af.c index f380459747..e6f19b3e37 100644 --- a/audio/filter/af.c +++ b/audio/filter/af.c @@ -166,10 +166,10 @@ static struct af_instance *af_create(struct af_stream *s, char *name, .replaygain_data = s->replaygain_data, .out_pool = mp_audio_pool_create(af), }; - struct m_config *config = m_config_from_obj_desc(af, s->log, &desc); - if (m_config_apply_defaults(config, name, s->opts->af_defs) < 0) - goto error; - if (m_config_set_obj_params(config, args) < 0) + struct m_config *config = + m_config_from_obj_desc_and_args(af, s->log, NULL, &desc, + name, s->opts->af_defs, args); + if (!config) goto error; af->priv = config->optstruct; diff --git a/audio/out/ao.c b/audio/out/ao.c index fcbc44b139..189434cf0b 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -145,10 +145,10 @@ static struct ao *ao_alloc(bool probing, struct mpv_global *global, .def_buffer = opts->audio_buffer, .client_name = talloc_strdup(ao, opts->audio_client_name), }; - struct m_config *config = m_config_from_obj_desc(ao, ao->log, &desc); - if (m_config_apply_defaults(config, name, opts->ao_defs) < 0) - goto error; - if (m_config_set_obj_params(config, args) < 0) + struct m_config *config = + m_config_from_obj_desc_and_args(ao, ao->log, global, &desc, + name, opts->ao_defs, args); + if (!config) goto error; ao->priv = config->optstruct; return ao; -- cgit v1.2.3