[pulseaudio-discuss] [PATCH v2 2/3] ladspa-sink: filter-apply able to load this module.
KimJeongYeon
see2002 at gmail.com
Mon Apr 10 13:59:23 UTC 2017
Currently, 'filter-apply' cannot load 'ladspa-sink' filter module.
Because, it always fails due to argument mismatching between 'filter-apply' and 'ladspa-sink'.
(e.g 'master' used instead of 'sink_master') To solve this issue, added 'sink_master' argument.
Additionally, supports autoloaded feature too.
Signed-off-by: KimJeongYeon <jeongyeon.kim at samsung.com>
---
src/modules/module-ladspa-sink.c | 39 ++++++++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c
index 6dd2987..2409d61 100644
--- a/src/modules/module-ladspa-sink.c
+++ b/src/modules/module-ladspa-sink.c
@@ -55,6 +55,7 @@ PA_MODULE_USAGE(
_("sink_name=<name for the sink> "
"sink_properties=<properties for the sink> "
"master=<name of sink to filter> "
+ "sink_master=<name of sink to filter> "
"format=<sample format> "
"rate=<sample rate> "
"channels=<number of channels> "
@@ -63,9 +64,11 @@ PA_MODULE_USAGE(
"label=<ladspa plugin label> "
"control=<comma separated list of input control values> "
"input_ladspaport_map=<comma separated list of input LADSPA port names> "
- "output_ladspaport_map=<comma separated list of output LADSPA port names> "));
+ "output_ladspaport_map=<comma separated list of output LADSPA port names> "
+ "autoloaded=<set if this module is being loaded automatically> "));
#define MEMBLOCKQ_MAXLENGTH (16*1024*1024)
+#define DEFAULT_AUTOLOADED false
/* 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 */
@@ -99,12 +102,14 @@ struct userdata {
#endif
bool auto_desc;
+ bool autoloaded;
};
static const char* const valid_modargs[] = {
"sink_name",
"sink_properties",
- "master",
+ "master", /* Will be deprecated. */
+ "sink_master",
"format",
"rate",
"channels",
@@ -114,6 +119,7 @@ static const char* const valid_modargs[] = {
"control",
"input_ladspaport_map",
"output_ladspaport_map",
+ "autoloaded",
NULL
};
@@ -640,6 +646,19 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
}
/* Called from main context */
+static bool sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) {
+ struct userdata *u;
+
+ pa_sink_input_assert_ref(i);
+ pa_assert_se(u = i->userdata);
+
+ if (u->autoloaded)
+ return false;
+
+ return u->sink != dest;
+}
+
+/* Called from main context */
static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
struct userdata *u;
@@ -968,9 +987,12 @@ int pa__init(pa_module*m) {
goto fail;
}
- 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;
+ 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.");
}
ss = master->sample_spec;
@@ -1231,6 +1253,12 @@ int pa__init(pa_module*m) {
goto fail;
}
+ u->autoloaded = DEFAULT_AUTOLOADED;
+ if (pa_modargs_get_value_boolean(ma, "autoloaded", &u->autoloaded) < 0) {
+ pa_log("Failed to parse autoloaded value");
+ goto fail;
+ }
+
if ((u->auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION))) {
const char *z;
@@ -1283,6 +1311,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;
+ u->sink_input->may_move_to = sink_input_may_move_to_cb;
u->sink_input->moving = sink_input_moving_cb;
u->sink_input->mute_changed = sink_input_mute_changed_cb;
u->sink_input->userdata = u;
--
2.7.4
More information about the pulseaudio-discuss
mailing list