add new remix= parameter to remap sink
authorLennart Poettering <lennart@poettering.net>
Thu, 19 Jun 2008 17:23:14 +0000 (19:23 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 19 Jun 2008 17:23:14 +0000 (19:23 +0200)
src/modules/module-remap-sink.c

index 7cb516d..b9e7301 100644 (file)
@@ -49,7 +49,8 @@ PA_MODULE_USAGE(
         "format=<sample format> "
         "channels=<number of channels> "
         "rate=<sample rate> "
-        "channel_map=<channel map>");
+        "channel_map=<channel map> "
+        "remix=<remix channels?>");
 
 struct userdata {
     pa_core *core;
@@ -67,6 +68,7 @@ static const char* const valid_modargs[] = {
     "format",
     "channels",
     "channel_map",
+    "remix",
     NULL
 };
 
@@ -258,6 +260,7 @@ int pa__init(pa_module*m) {
     pa_sink *master;
     pa_sink_input_new_data sink_input_data;
     pa_sink_new_data sink_data;
+    pa_bool_t remix = TRUE;
 
     pa_assert(m);
 
@@ -280,7 +283,7 @@ int pa__init(pa_module*m) {
 
     stream_map = sink_map;
     if (pa_modargs_get_channel_map(ma, "master_channel_map", &stream_map) < 0) {
-        pa_log("Invalid master hannel map");
+        pa_log("Invalid master channel map");
         goto fail;
     }
 
@@ -292,6 +295,11 @@ int pa__init(pa_module*m) {
     if (pa_channel_map_equal(&stream_map, &master->channel_map))
         pa_log_warn("No remapping configured, proceeding nonetheless!");
 
+    if (pa_modargs_get_value_boolean(ma, "remix", &remix) < 0) {
+        pa_log("Invalid boolean remix parameter");
+        goto fail;
+    }
+
     u = pa_xnew0(struct userdata, 1);
     u->core = m->core;
     u->module = m;
@@ -340,7 +348,7 @@ int pa__init(pa_module*m) {
     pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
     pa_sink_input_new_data_set_channel_map(&sink_input_data, &stream_map);
 
-    u->sink_input = pa_sink_input_new(m->core, &sink_input_data, PA_SINK_INPUT_DONT_MOVE);
+    u->sink_input = pa_sink_input_new(m->core, &sink_input_data, PA_SINK_INPUT_DONT_MOVE | (remix ? PA_SINK_INPUT_NO_REMIX : 0));
     pa_sink_input_new_data_done(&sink_input_data);
 
     if (!u->sink_input)