src/modules/module-ladspa-sink.c | 19 +++++++++++++------ src/modules/module-virtual-surround-sink.c | 19 +++++++++++++------ 2 files changed, 26 insertions(+), 12 deletions(-)
New commits: commit 65f7ca44148e8c79fa965a6ecbc889e3f9668178 Author: Tanu Kaskinen <[email protected]> Date: Fri Apr 14 18:20:40 2017 +0300 ladspa-sink, virtual-surround-sink: fix master sink argument handling The old code worked incorrectly in several situations. For example, trying to use the "master" argument wouldn't work, because if "sink_master" wasn't specified, pa_namereg_get() would pick the default sink as the master sink. diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c index 2409d610..7b0c0d6d 100644 --- a/src/modules/module-ladspa-sink.c +++ b/src/modules/module-ladspa-sink.c @@ -967,6 +967,7 @@ int pa__init(pa_module*m) { pa_channel_map map; pa_modargs *ma; char *t; + const char *master_name; pa_sink *master; pa_sink_input_new_data sink_input_data; pa_sink_new_data sink_data; @@ -987,12 +988,18 @@ int pa__init(pa_module*m) { goto fail; } - if (!(master = pa_namereg_get(m->core, pa_modargs_get_value(ma, "sink_master", NULL), PA_NAMEREG_SINK))) { - if (!(master = pa_namereg_get(m->core, pa_modargs_get_value(ma, "master", NULL), PA_NAMEREG_SINK))) { - pa_log("Master sink not found."); - goto fail; - } else - pa_log("Argument 'master' will be deprecated, please use 'sink_master' instead."); + master_name = pa_modargs_get_value(ma, "sink_master", NULL); + if (!master_name) { + master_name = pa_modargs_get_value(ma, "master", NULL); + if (master_name) + pa_log_warn("The 'master' module argument is deprecated and may be removed in the future, " + "please use the 'sink_master' argument instead."); + } + + master = pa_namereg_get(m->core, master_name, PA_NAMEREG_SINK); + if (!master) { + pa_log("Master sink not found."); + goto fail; } ss = master->sample_spec; diff --git a/src/modules/module-virtual-surround-sink.c b/src/modules/module-virtual-surround-sink.c index 47716da2..60093e69 100644 --- a/src/modules/module-virtual-surround-sink.c +++ b/src/modules/module-virtual-surround-sink.c @@ -581,6 +581,7 @@ int pa__init(pa_module*m) { pa_sample_spec ss, sink_input_ss; pa_channel_map map, sink_input_map; pa_modargs *ma; + const char *master_name; pa_sink *master = NULL; pa_sink_input_new_data sink_input_data; pa_sink_new_data sink_data; @@ -611,12 +612,18 @@ int pa__init(pa_module*m) { goto fail; } - if (!(master = pa_namereg_get(m->core, pa_modargs_get_value(ma, "sink_master", NULL), PA_NAMEREG_SINK))) { - if (!(master = pa_namereg_get(m->core, pa_modargs_get_value(ma, "master", NULL), PA_NAMEREG_SINK))) { - pa_log("Master sink not found."); - goto fail; - } else - pa_log("Argument 'master' will be deprecated, please use 'sink_master' instead."); + master_name = pa_modargs_get_value(ma, "sink_master", NULL); + if (!master_name) { + master_name = pa_modargs_get_value(ma, "master", NULL); + if (master_name) + pa_log_warn("The 'master' module argument is deprecated and may be removed in the future, " + "please use the 'sink_master' argument instead."); + } + + master = pa_namereg_get(m->core, master_name, PA_NAMEREG_SINK); + if (!master) { + pa_log("Master sink not found."); + goto fail; } pa_assert(master); _______________________________________________ pulseaudio-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits
