[pulseaudio-discuss] [PATCH 06/23] Don't create nodes for monitor sources if the sink has ports

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Wed Nov 20 01:25:58 PST 2013


The monitor source node should be created only if the sink has a node.
If the sink has ports, then a separate monitor node should be created
for each of the sink ports (will be implemented later).
---
 src/pulsecore/node.c   | 6 ++++++
 src/pulsecore/node.h   | 2 ++
 src/pulsecore/source.c | 5 ++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/pulsecore/node.c b/src/pulsecore/node.c
index 3f1ca7c..8749295 100644
--- a/src/pulsecore/node.c
+++ b/src/pulsecore/node.c
@@ -65,6 +65,12 @@ void pa_node_new_data_set_direction(pa_node_new_data *data, pa_direction_t direc
     data->direction = direction;
 }
 
+void pa_node_new_data_set_monitor_of(pa_node_new_data *data, pa_node *monitor_of) {
+    pa_assert(data);
+
+    data->monitor_of = monitor_of;
+}
+
 void pa_node_new_data_done(pa_node_new_data *data) {
     pa_assert(data);
 
diff --git a/src/pulsecore/node.h b/src/pulsecore/node.h
index 305853f..4168533 100644
--- a/src/pulsecore/node.h
+++ b/src/pulsecore/node.h
@@ -56,6 +56,7 @@ struct pa_node_new_data {
 
     pa_node_type_t type;
     pa_direction_t direction;
+    pa_node *monitor_of;
 };
 
 struct pa_node {
@@ -78,6 +79,7 @@ void pa_node_new_data_set_fallback_name_prefix(pa_node_new_data *data, const cha
 void pa_node_new_data_set_description(pa_node_new_data *data, const char *description);
 void pa_node_new_data_set_type(pa_node_new_data *data, pa_node_type_t type);
 void pa_node_new_data_set_direction(pa_node_new_data *data, pa_direction_t direction);
+void pa_node_new_data_set_monitor_of(pa_node_new_data *data, pa_node *monitor_of);
 void pa_node_new_data_done(pa_node_new_data *data);
 
 pa_node *pa_node_new(pa_core *core, pa_node_new_data *data);
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index b252ed5..0fc3e81 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -333,7 +333,10 @@ pa_source* pa_source_new(
     if (s->card)
         pa_assert_se(pa_idxset_put(s->card->sources, s, NULL) >= 0);
 
-    if (pa_hashmap_isempty(s->ports)) {
+    if (pa_hashmap_isempty(s->ports) && (!data->monitor_of || data->monitor_of->node)) {
+        if (data->monitor_of)
+            pa_node_new_data_set_monitor_of(&data->node_data, data->monitor_of->node);
+
         if (!data->node_data.description)
             pa_node_new_data_set_description(&data->node_data, pa_source_get_description(s));
 
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list