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

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


The node is 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, 13 insertions(+)

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 10ae8d1..08ddbe4 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -339,6 +339,11 @@ pa_source* pa_source_new(
     if (s->card)
         pa_assert_se(pa_idxset_put(s->card->sources, s, NULL) >= 0);
 
+    if (data->monitor_of && data->monitor_of->node) {
+        pa_source_new_data_set_create_node(data, true);
+        pa_node_new_data_set_monitor_of(&data->node_data, data->monitor_of->node);
+    }
+
     if (data->create_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