From: KimJeongYeon Date: Thu, 13 Apr 2017 22:41:22 +0000 (+0900) Subject: virtual-surround-sink: Add sink_master argument to enable filter-apply to load the... X-Git-Tag: accepted/tizen/unified/20170531.082625~6^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=018272df09d6c28d5b34fc25d712189b1f052d06;p=platform%2Fupstream%2Fpulseaudio.git virtual-surround-sink: Add sink_master argument to enable filter-apply to load the module Currently, module-filter-apply cannot load module-virtual-surround-sink because filter-apply provides the argument "sink_master" but virtual-surround-sink expects "master" instead. Therefore this patch adds the sink_master argument to module-virtual-surround-sink. Additionally, the autoloaded argument was also added. This patch based on: https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=ba4de85b530d91f5f7d81f3bf29a0ae8bc60b04e 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: I25b328ffd308e09c6082ed39ec4aa299a56422bf --- diff --git a/src/modules/module-virtual-surround-sink.c b/src/modules/module-virtual-surround-sink.c index f46d073..6a2399e 100644 --- a/src/modules/module-virtual-surround-sink.c +++ b/src/modules/module-virtual-surround-sink.c @@ -52,11 +52,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= " @@ -64,16 +61,11 @@ PA_MODULE_USAGE( "use_volume_sharing= " "force_flat_volume= " "hrir=/path/to/left_hrir.wav " -#ifdef __TIZEN__ "autoloaded= " -#endif )); #define MEMBLOCKQ_MAXLENGTH (16*1024*1024) - -#ifdef __TIZEN__ #define DEFAULT_AUTOLOADED false -#endif struct userdata { pa_module *module; @@ -101,19 +93,14 @@ struct userdata { float *input_buffer; int input_buffer_offset; -#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", @@ -121,9 +108,7 @@ static const char* const valid_modargs[] = { "use_volume_sharing", "force_flat_volume", "hrir", -#ifdef __TIZEN__ "autoloaded", -#endif NULL }; @@ -451,7 +436,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; @@ -464,7 +448,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) { @@ -561,7 +544,8 @@ int pa__init(pa_module*m) { pa_sample_spec ss, sink_input_ss; pa_channel_map map, sink_input_map; pa_modargs *ma; - pa_sink *master=NULL; + const char *master_name; + pa_sink *master = NULL; pa_sink_input_new_data sink_input_data; pa_sink_new_data sink_data; bool use_volume_sharing = true; @@ -592,12 +576,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; } @@ -677,13 +666,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; @@ -744,9 +731,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->volume_changed = use_volume_sharing ? NULL : sink_input_volume_changed_cb; u->sink_input->mute_changed = sink_input_mute_changed_cb;