From: KimJeongYeon Date: Thu, 13 Apr 2017 22:45:00 +0000 (+0900) Subject: ladspa-sink: Add sink_master argument to enable filter-apply to load the module X-Git-Tag: accepted/tizen/unified/20170531.082625~5^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4340a7886d08855c31b0c507b2110eee2ab4011c;p=platform%2Fupstream%2Fpulseaudio.git ladspa-sink: Add sink_master argument to enable filter-apply to load the module Currently, module-filter-apply cannot load module-ladspa-sink because filter-apply provides the argument "sink_master" but ladspa-sink expects "master" instead. Therefore this patch adds the sink_master argument to module-ladspa-sink. Additionally, the autoloaded argument was also added. This patch based on: https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=145da09aca8b54d611999ebf661b05ceb9e1c62f 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. This patch based on: https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=65f7ca44148e8c79fa965a6ecbc889e3f9668178 Signed-off-by: KimJeongYeon Change-Id: I15382f0f2551bcd2d3bcb9bf117914ed2cc3e5ff --- diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c index e9523de..3af759d 100644 --- a/src/modules/module-ladspa-sink.c +++ b/src/modules/module-ladspa-sink.c @@ -56,11 +56,8 @@ PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( _("sink_name= " "sink_properties= " -#ifdef __TIZEN__ - "sink_master= " -#else "master= " -#endif + "sink_master= " "format= " "rate= " "channels= " @@ -70,16 +67,10 @@ PA_MODULE_USAGE( "control= " "input_ladspaport_map= " "output_ladspaport_map= " -#ifdef __TIZEN__ - "autoloaded= " -#endif - )); + "autoloaded= ")); #define MEMBLOCKQ_MAXLENGTH (16*1024*1024) - -#ifdef __TIZEN__ #define DEFAULT_AUTOLOADED false -#endif /* PLEASE NOTICE: The PortAudio ports and the LADSPA ports are two different concepts. They are not related and where possible the names of the LADSPA port variables contains "ladspa" to avoid confusion */ @@ -113,20 +104,14 @@ struct userdata { #endif bool auto_desc; - -#ifdef __TIZEN__ bool autoloaded; -#endif }; static const char* const valid_modargs[] = { "sink_name", "sink_properties", -#ifdef __TIZEN__ + "master", /* Will be deprecated. */ "sink_master", -#else - "master", -#endif "format", "rate", "channels", @@ -136,9 +121,7 @@ static const char* const valid_modargs[] = { "control", "input_ladspaport_map", "output_ladspaport_map", -#ifdef __TIZEN__ "autoloaded", -#endif NULL }; @@ -664,7 +647,6 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s } } -#ifdef __TIZEN__ /* Called from main context */ static bool sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) { struct userdata *u; @@ -677,7 +659,6 @@ static bool sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) { return u->sink != dest; } -#endif /* Called from main context */ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) { @@ -988,6 +969,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; @@ -1008,12 +990,17 @@ int pa__init(pa_module*m) { goto fail; } -#ifdef __TIZEN__ - if (!(master = pa_namereg_get(m->core, pa_modargs_get_value(ma, "sink_master", NULL), PA_NAMEREG_SINK))) { -#else - if (!(master = pa_namereg_get(m->core, pa_modargs_get_value(ma, "master", NULL), PA_NAMEREG_SINK))) { -#endif - pa_log("Master sink not found"); + 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; } @@ -1275,13 +1262,11 @@ int pa__init(pa_module*m) { goto fail; } -#ifdef __TIZEN__ u->autoloaded = DEFAULT_AUTOLOADED; if (pa_modargs_get_value_boolean(ma, "autoloaded", &u->autoloaded) < 0) { pa_log("Failed to parse autoloaded value"); goto fail; } -#endif if ((u->auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION))) { const char *z; @@ -1335,9 +1320,7 @@ int pa__init(pa_module*m) { u->sink_input->attach = sink_input_attach_cb; u->sink_input->detach = sink_input_detach_cb; u->sink_input->state_change = sink_input_state_change_cb; -#ifdef __TIZEN__ u->sink_input->may_move_to = sink_input_may_move_to_cb; -#endif u->sink_input->moving = sink_input_moving_cb; u->sink_input->mute_changed = sink_input_mute_changed_cb; u->sink_input->userdata = u;