[PATCH 01/30] node: Add monitor and monitor_of fields to pa_node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Given a node, it's nice to have a way to get to its monitor node (if
any), or to get to the origin node from a monitor node.
---
 src/pulsecore/node.c | 7 +++++++
 src/pulsecore/node.h | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/src/pulsecore/node.c b/src/pulsecore/node.c
index 18249d2..8cc6dc3 100644
--- a/src/pulsecore/node.c
+++ b/src/pulsecore/node.c
@@ -125,6 +125,7 @@ pa_node *pa_node_new(pa_core *core, pa_node_new_data *data) {
     n->description = pa_xstrdup(data->description);
     n->type = data->type;
     n->direction = data->direction;
+    n->monitor_of = data->monitor_of;
 
     return n;
 
@@ -159,6 +160,9 @@ void pa_node_put(pa_node *node) {
     pa_assert_se(pa_idxset_put(node->core->nodes, node, &node->index) >= 0);
     node->state = PA_NODE_STATE_LINKED;
 
+    if (node->monitor_of)
+        node->monitor_of->monitor = node;
+
     pa_hook_fire(&node->core->hooks[PA_CORE_HOOK_NODE_SET_INITIAL_ROUTING], node);
 
     pa_log_debug("Created node %s.", node->name);
@@ -173,6 +177,9 @@ void pa_node_unlink(pa_node *node) {
 
     pa_log_debug("Unlinking node %s.", node->name);
 
+    if (node->monitor_of)
+        node->monitor_of->monitor = NULL;
+
     pa_assert_se(pa_idxset_remove_by_index(node->core->nodes, node->index));
 
     node->state = PA_NODE_STATE_UNLINKED;
diff --git a/src/pulsecore/node.h b/src/pulsecore/node.h
index 4504c79..d593b54 100644
--- a/src/pulsecore/node.h
+++ b/src/pulsecore/node.h
@@ -71,6 +71,8 @@ struct pa_node {
     pa_direction_t direction;
 
     pa_node_state_t state;
+    pa_node *monitor;
+    pa_node *monitor_of;
 
     void *owner;
 };
-- 
1.8.3.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux