Hi guys:
This patch add two new boolean arguments sink_dont_move and source_dont_move into module-loopback,so we can make the module unloading when the sink or source was unavailable.
To enable this feature we can do something like:
>>>load-module module-loopback source=bluez_source.00_22_A5_AA_BF_85 sink=alsa_output.pci-0000_00_1b.0.analog-stereo source_dont_move=TRUE

And you can just feel free to ignore these arguments.

--
B.R

Cai Yuanqing

>From e36b16b87c973e6c09ae9aa2c8eb2ca8be9db810 Mon Sep 17 00:00:00 2001
From: Cai Yuanqing <yuanqing....@tieto.com>
Date: Thu, 23 Dec 2010 19:25:36 +0800
Subject: [PATCH] [PATCH] [module-loopback] Add new arguments sink_dont_move and source_dont_move to toggle module automatic unloading when the sink or source were not available

---
 src/modules/module-loopback.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 55716b2..0efec38 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -57,7 +57,9 @@ PA_MODULE_USAGE(
         "sink_input_name=<custom name for the sink input> "
         "source_output_name=<custom name for the source output> "
         "sink_input_role=<media.role for the sink input> "
-        "source_output_role=<media.role for the source output>");
+        "source_output_role=<media.role for the source output> "
+        "source_dont_move=<boolean> "
+        "sink_dont_move=<boolean>");
 
 #define DEFAULT_LATENCY_MSEC 200
 
@@ -115,6 +117,8 @@ static const char* const valid_modargs[] = {
     "source_output_name",
     "sink_input_role",
     "source_output_role",
+    "source_dont_move",
+    "sink_dont_move",
     NULL,
 };
 
@@ -626,6 +630,8 @@ int pa__init(pa_module *m) {
     pa_memchunk silence;
     uint32_t adjust_time_sec;
     const char *n;
+    pa_bool_t  sink_dont_move = FALSE;
+    pa_bool_t  source_dont_move = FALSE;
 
     pa_assert(m);
 
@@ -678,6 +684,15 @@ int pa__init(pa_module *m) {
     sink_input_data.module = m;
     sink_input_data.sink = sink;
 
+    if (pa_modargs_get_value_boolean(ma, "sink_dont_move", &sink_dont_move) < 0) {
+        pa_log("sink_dont_move= expects a boolean argument.");
+        goto fail;
+    }
+
+    if (sink_dont_move) {
+        sink_input_data.flags = PA_SINK_INPUT_DONT_MOVE;
+    }
+
     if ((n = pa_modargs_get_value(ma, "sink_input_name", NULL)))
         pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, n);
     else
@@ -721,6 +736,15 @@ int pa__init(pa_module *m) {
     source_output_data.module = m;
     source_output_data.source = source;
 
+    if (pa_modargs_get_value_boolean(ma, "source_dont_move", &source_dont_move) < 0) {
+        pa_log("source_dont_move= expects a boolean argument.");
+        goto fail;
+    }
+
+    if (source_dont_move) {
+        source_output_data.flags = PA_SOURCE_OUTPUT_DONT_MOVE;
+    }
+
     if ((n = pa_modargs_get_value(ma, "source_output_name", NULL)))
         pa_proplist_sets(source_output_data.proplist, PA_PROP_MEDIA_NAME, n);
     else
-- 
1.7.1

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss

Reply via email to