summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorCai Yuanqing <Yuanqing.Cai@tieto.com>2010-12-23 19:25:36 +0800
committerColin Guthrie <cguthrie@mandriva.org>2011-01-03 09:42:12 +0000
commit95ccbf73466529e4c65460010955c355452aa0b1 (patch)
treeab121b313f2f0c390353be1f1b3d2466438e0035 /src/modules
parent06875b67e616f6ade97fda3b41cb7b6d7f9857c1 (diff)
loopback: Add new arguments to disable stream move
The arguments sink_dont_move and source_dont_move have been added to toggle module automatic unloading when the sink or source were no longer available, rather than just moving them to the next available sink/source (via rescue streams). Reviewed and tweaked by Colin Guthrie.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/module-loopback.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 55716b2f..a6553f7d 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,
};
@@ -618,8 +622,10 @@ int pa__init(pa_module *m) {
struct userdata *u;
pa_sink *sink;
pa_sink_input_new_data sink_input_data;
+ pa_bool_t sink_dont_move;
pa_source *source;
pa_source_output_new_data source_output_data;
+ pa_bool_t source_dont_move;
uint32_t latency_msec;
pa_sample_spec ss;
pa_channel_map map;
@@ -696,6 +702,15 @@ int pa__init(pa_module *m) {
pa_sink_input_new_data_set_channel_map(&sink_input_data, &map);
sink_input_data.flags = PA_SINK_INPUT_VARIABLE_RATE;
+ sink_dont_move = FALSE;
+ 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;
+
pa_sink_input_new(&u->sink_input, m->core, &sink_input_data);
pa_sink_input_new_data_done(&sink_input_data);
@@ -737,6 +752,16 @@ int pa__init(pa_module *m) {
pa_source_output_new_data_set_sample_spec(&source_output_data, &ss);
pa_sink_input_new_data_set_channel_map(&sink_input_data, &map);
+ source_output_data.flags = (pa_source_output_flags_t)0;
+
+ source_dont_move = FALSE;
+ 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;
pa_source_output_new(&u->source_output, m->core, &source_output_data);
pa_source_output_new_data_done(&source_output_data);