summaryrefslogtreecommitdiffstats
path: root/node.c
diff options
context:
space:
mode:
authorManuel Bachmann <manuel.bachmann@iot.bzh>2016-07-07 17:29:08 +0200
committerYannick Gicquel <yannick.gicquel@iot.bzh>2016-10-11 17:09:07 +0200
commitcc70e0ae30920ca835bf011f8040afb6fea43f45 (patch)
treec4d503c5a556bee69842f38b28e85a182c70bfb8 /node.c
parent2478974dfde05063cbf0233e3d3c434ca2f46c7c (diff)
Implement routing groups and volume ramp up/down
Change-Id: I0e9d3b8b8be4d124907214c165617d86be6906fc Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
Diffstat (limited to 'node.c')
-rw-r--r--node.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/node.c b/node.c
index 1876a67..c85d512 100644
--- a/node.c
+++ b/node.c
@@ -20,6 +20,7 @@
*
*/
#include "node.h"
+#include "router.h"
#include <pulsecore/idxset.h>
@@ -129,12 +130,22 @@ agl_node *agl_node_create (struct userdata *u, agl_node *data)
}
}
- /* TODO : register the node to the router */
- /* agl_router_register_node (u, node); */
-
return node;
}
+void agl_node_destroy (struct userdata *u, agl_node *node)
+{
+ agl_nodeset *ns;
+
+ pa_assert (u);
+ pa_assert (node);
+ pa_assert_se (ns = u->nodeset);
+
+ pa_idxset_remove_by_index (ns->nodes, node->index);
+
+ pa_xfree (node);
+}
+
const char *agl_node_type_str (agl_node_type type)
{
switch (type) {
@@ -208,3 +219,24 @@ agl_node *agl_node_get_from_client (struct userdata *u, pa_client *client)
return NULL;
}
+
+bool agl_node_has_highest_priority (struct userdata *u, agl_node *node)
+{
+ agl_nodeset *nodeset;
+ agl_node *n;
+ int priority;
+ uint32_t index;
+
+ pa_assert (u);
+ pa_assert (node);
+ pa_assert (nodeset = u->nodeset);
+
+ priority = agl_router_get_node_priority (u, node);
+
+ PA_IDXSET_FOREACH(n, nodeset->nodes, index) {
+ if ((n != node) && (agl_router_get_node_priority (u, n) >= priority))
+ return false;
+ }
+
+ return true;
+}