[pulseaudio-discuss] [PATCH 4/9] Create nodes for sources

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Thu Nov 7 18:00:09 CET 2013


All sources that don't have ports should have nodes, because otherwise
routing streams to those sources won't work when source output routing
is changed to be node-based.

Support for monitor sources is not yet added in this commit, because
that's a bit less straightforward thing to implement.
---
 src/modules/echo-cancel/module-echo-cancel.c | 3 +++
 src/modules/macosx/module-coreaudio-device.c | 3 +++
 src/modules/module-null-source.c             | 3 +++
 src/modules/module-pipe-source.c             | 3 +++
 src/modules/module-remap-source.c            | 3 +++
 src/modules/module-sine-source.c             | 3 +++
 src/modules/module-solaris.c                 | 3 +++
 src/modules/module-tunnel-source-new.c       | 4 ++++
 src/modules/module-tunnel.c                  | 3 +++
 src/modules/module-virtual-source.c          | 3 +++
 src/modules/module-waveout.c                 | 4 ++++
 src/modules/oss/module-oss.c                 | 3 +++
 todo                                         | 5 ++++-
 13 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
index c31019d..b371b2c 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -1787,6 +1787,9 @@ int pa__init(pa_module*m) {
         pa_proplist_setf(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "%s (echo cancelled with %s)",
                 pa_source_get_description(source_master), pa_sink_get_description(sink_master));
 
+    pa_source_new_data_set_create_node(&source_data, true);
+    pa_node_new_data_set_fallback_name_prefix(&source_data.node_data, "echo-cancel");
+
     u->source = pa_source_new(m->core, &source_data, (source_master->flags & (PA_SOURCE_LATENCY | PA_SOURCE_DYNAMIC_LATENCY))
                                                      | (u->use_volume_sharing ? PA_SOURCE_SHARE_VOLUME_WITH_MASTER : 0));
     pa_source_new_data_done(&source_data);
diff --git a/src/modules/macosx/module-coreaudio-device.c b/src/modules/macosx/module-coreaudio-device.c
index efa61fa..dfb91d3 100644
--- a/src/modules/macosx/module-coreaudio-device.c
+++ b/src/modules/macosx/module-coreaudio-device.c
@@ -568,6 +568,9 @@ static int ca_device_create_source(pa_module *m, AudioBuffer *buf, int channel_i
     if (u->vendor_name)
         pa_proplist_sets(new_data.proplist, PA_PROP_DEVICE_VENDOR_NAME, u->vendor_name);
 
+    pa_source_new_data_set_create_node(&new_data, true);
+    pa_node_new_data_set_fallback_name_prefix(&new_data.node_data, "coreaudio");
+
     source = pa_source_new(m->core, &new_data, flags);
     pa_source_new_data_done(&new_data);
 
diff --git a/src/modules/module-null-source.c b/src/modules/module-null-source.c
index e3e0167..2d3cf06 100644
--- a/src/modules/module-null-source.c
+++ b/src/modules/module-null-source.c
@@ -213,6 +213,9 @@ int pa__init(pa_module*m) {
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_DESCRIPTION, pa_modargs_get_value(ma, "description", "Null Input"));
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_CLASS, "abstract");
 
+    pa_source_new_data_set_create_node(&data, true);
+    pa_node_new_data_set_fallback_name_prefix(&data.node_data, "null");
+
     u->source = pa_source_new(m->core, &data, PA_SOURCE_LATENCY | PA_SOURCE_DYNAMIC_LATENCY);
     pa_source_new_data_done(&data);
 
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index 36e8732..03d5d40 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -276,6 +276,9 @@ int pa__init(pa_module *m) {
         goto fail;
     }
 
+    pa_source_new_data_set_create_node(&data, true);
+    pa_node_new_data_set_fallback_name_prefix(&data.node_data, "pipe");
+
     u->source = pa_source_new(m->core, &data, PA_SOURCE_LATENCY);
     pa_source_new_data_done(&data);
 
diff --git a/src/modules/module-remap-source.c b/src/modules/module-remap-source.c
index 4cdd7aa..e3a85a6 100644
--- a/src/modules/module-remap-source.c
+++ b/src/modules/module-remap-source.c
@@ -330,6 +330,9 @@ int pa__init(pa_module*m) {
     if ((u->auto_desc = !pa_proplist_contains(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION)))
         pa_proplist_setf(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Remapped %s", pa_source_get_description(master));
 
+    pa_source_new_data_set_create_node(&source_data, true);
+    pa_node_new_data_set_fallback_name_prefix(&source_data.node_data, "remap");
+
     u->source = pa_source_new(m->core, &source_data, master->flags & (PA_SOURCE_LATENCY|PA_SOURCE_DYNAMIC_LATENCY));
     pa_source_new_data_done(&source_data);
 
diff --git a/src/modules/module-sine-source.c b/src/modules/module-sine-source.c
index bb3f8c4..a86da6e 100644
--- a/src/modules/module-sine-source.c
+++ b/src/modules/module-sine-source.c
@@ -248,6 +248,9 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
+    pa_source_new_data_set_create_node(&data, true);
+    pa_node_new_data_set_fallback_name_prefix(&data.node_data, "sine");
+
     u->source = pa_source_new(m->core, &data, PA_SOURCE_LATENCY);
     pa_source_new_data_done(&data);
 
diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c
index 0d02010..3ccc200 100644
--- a/src/modules/module-solaris.c
+++ b/src/modules/module-solaris.c
@@ -939,6 +939,9 @@ int pa__init(pa_module *m) {
             goto fail;
         }
 
+        pa_source_new_data_set_create_node(&source_new_data, true);
+        pa_node_new_data_set_fallback_name_prefix(&source_new_data.node_data, "solaris");
+
         u->source = pa_source_new(m->core, &source_new_data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY);
         pa_source_new_data_done(&source_new_data);
         pa_xfree(name_buf);
diff --git a/src/modules/module-tunnel-source-new.c b/src/modules/module-tunnel-source-new.c
index 8169b07..6704679 100644
--- a/src/modules/module-tunnel-source-new.c
+++ b/src/modules/module-tunnel-source-new.c
@@ -483,6 +483,10 @@ int pa__init(pa_module *m) {
         pa_source_new_data_done(&source_data);
         goto fail;
     }
+
+    pa_source_new_data_set_create_node(&source_data, true);
+    pa_node_new_data_set_fallback_name_prefix(&source_data.node_data, "tunnel");
+
     if (!(u->source = pa_source_new(m->core, &source_data, PA_SOURCE_LATENCY | PA_SOURCE_DYNAMIC_LATENCY | PA_SOURCE_NETWORK))) {
         pa_log("Failed to create source.");
         pa_source_new_data_done(&source_data);
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index 2ad316b..3ed1c59 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -2185,6 +2185,9 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
+    pa_source_new_data_set_create_node(&data, true);
+    pa_node_new_data_set_fallback_name_prefix(&data.node_data, "tunnel");
+
     u->source = pa_source_new(m->core, &data, PA_SOURCE_NETWORK|PA_SOURCE_LATENCY);
     pa_source_new_data_done(&data);
 
diff --git a/src/modules/module-virtual-source.c b/src/modules/module-virtual-source.c
index 6f19dd3..3b50089 100644
--- a/src/modules/module-virtual-source.c
+++ b/src/modules/module-virtual-source.c
@@ -547,6 +547,9 @@ int pa__init(pa_module*m) {
         pa_proplist_setf(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION,
                          "Virtual Source %s on %s", source_data.name, pa_source_get_description(master));
 
+    pa_source_new_data_set_create_node(&source_data, true);
+    pa_node_new_data_set_fallback_name_prefix(&source_data.node_data, "virtual");
+
     u->source = pa_source_new(m->core, &source_data, (master->flags & (PA_SOURCE_LATENCY|PA_SOURCE_DYNAMIC_LATENCY))
                                                      | (use_volume_sharing ? PA_SOURCE_SHARE_VOLUME_WITH_MASTER : 0));
 
diff --git a/src/modules/module-waveout.c b/src/modules/module-waveout.c
index 0ed43d7..5dee3ba 100644
--- a/src/modules/module-waveout.c
+++ b/src/modules/module-waveout.c
@@ -616,6 +616,10 @@ int pa__init(pa_module *m) {
         pa_source_new_data_set_channel_map(&data, &map);
         pa_source_new_data_set_name(&data, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME));
         pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "WaveIn on %s", device_name);
+
+        pa_source_new_data_set_create_node(&data, true);
+        pa_node_new_data_set_fallback_name_prefix(&data.node_data, "wavein");
+
         u->source = pa_source_new(m->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY);
         pa_source_new_data_done(&data);
 
diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c
index 998cb1d..92bc771 100644
--- a/src/modules/oss/module-oss.c
+++ b/src/modules/oss/module-oss.c
@@ -1332,6 +1332,9 @@ int pa__init(pa_module*m) {
             goto fail;
         }
 
+        pa_source_new_data_set_create_node(&source_new_data, true);
+        pa_node_new_data_set_fallback_name_prefix(&source_new_data.node_data, "oss");
+
         u->source = pa_source_new(m->core, &source_new_data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY);
         pa_source_new_data_done(&source_new_data);
         pa_xfree(name_buf);
diff --git a/todo b/todo
index 8445c47..9353021 100644
--- a/todo
+++ b/todo
@@ -47,4 +47,7 @@ Backends for:
 - portaudio  (semi-done)
 
 Routing:
-- Create nodes for sources.
+- Create nodes for monitor sources.
+- Take over the initial routing of new sink inputs and source outputs.
+- Take over moving streams.
+- Take over stream rescuing.
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list