[pulseaudio-discuss] [PATCH v2 07/21] node: Generate a nice name for monitor nodes

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Thu Dec 5 06:19:07 PST 2013


Just take the name of the node that this node is a monitor of, and
append ".monitor".
---
 src/pulsecore/node.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/pulsecore/node.c b/src/pulsecore/node.c
index 8749295..7b4d61f 100644
--- a/src/pulsecore/node.c
+++ b/src/pulsecore/node.c
@@ -81,6 +81,7 @@ void pa_node_new_data_done(pa_node_new_data *data) {
 pa_node *pa_node_new(pa_core *core, pa_node_new_data *data) {
     bool use_fallback_name_prefix;
     pa_strbuf *name_buf;
+    bool append_direction = true;
     char *name = NULL;
     pa_node *n = NULL;
     const char *registered_name = NULL;
@@ -93,12 +94,19 @@ pa_node *pa_node_new(pa_core *core, pa_node_new_data *data) {
 
     name_buf = pa_strbuf_new();
 
+    if (data->monitor_of) {
+        pa_strbuf_printf(name_buf, "%s.monitor", data->monitor_of->name);
+        use_fallback_name_prefix = false;
+        append_direction = false;
+    }
+
     /* Automatic name generation code will appear here... */
 
     if (use_fallback_name_prefix)
         pa_strbuf_printf(name_buf, "%s-", data->fallback_name_prefix);
 
-    pa_strbuf_puts(name_buf, data->direction == PA_DIRECTION_OUTPUT ? "output" : "input");
+    if (append_direction)
+        pa_strbuf_puts(name_buf, data->direction == PA_DIRECTION_OUTPUT ? "output" : "input");
 
     name = pa_strbuf_tostring_free(name_buf);
 
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list