[pulseaudio-discuss] [PATCH 21/21] native: Add node support for streams

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Wed Jun 19 08:40:18 PDT 2013


---
 src/pulsecore/protocol-native.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 6d5b388..65020b0 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -39,6 +39,8 @@
 
 #include <pulsecore/native-common.h>
 #include <pulsecore/packet.h>
+#include <pulsecore/sink-input-node.h>
+#include <pulsecore/source-output-node.h>
 #include <pulsecore/client.h>
 #include <pulsecore/source-output.h>
 #include <pulsecore/sink-input.h>
@@ -82,6 +84,7 @@ typedef struct record_stream {
     uint32_t index;
 
     pa_source_output *source_output;
+    pa_source_output_node *output_node;
     pa_memblockq *memblockq;
 
     pa_bool_t adjust_latency:1;
@@ -119,6 +122,7 @@ typedef struct playback_stream {
     uint32_t index;
 
     pa_sink_input *sink_input;
+    pa_sink_input_node *input_node;
     pa_memblockq *memblockq;
 
     pa_bool_t adjust_latency:1;
@@ -472,6 +476,11 @@ static void record_stream_unlink(record_stream *s) {
     if (!s->connection)
         return;
 
+    if (s->output_node) {
+        pa_source_output_node_free(s->output_node);
+        s->output_node = NULL;
+    }
+
     if (s->source_output) {
         pa_source_output_unlink(s->source_output);
         pa_source_output_unref(s->source_output);
@@ -742,6 +751,9 @@ static record_stream* record_stream_new(
                 (double) s->configured_source_latency / PA_USEC_PER_MSEC);
 
     pa_source_output_put(s->source_output);
+
+    s->output_node = pa_source_output_node_new(s->source_output, "native-protocol-output");
+
     return s;
 }
 
@@ -764,6 +776,11 @@ static void playback_stream_unlink(playback_stream *s) {
     if (!s->connection)
         return;
 
+    if (s->input_node) {
+        pa_sink_input_node_free(s->input_node);
+        s->input_node = NULL;
+    }
+
     if (s->sink_input) {
         pa_sink_input_unlink(s->sink_input);
         pa_sink_input_unref(s->sink_input);
@@ -1230,6 +1247,8 @@ static playback_stream* playback_stream_new(
 
     pa_sink_input_put(s->sink_input);
 
+    s->input_node = pa_sink_input_node_new(s->sink_input, "native-protocol-input");
+
 out:
     if (formats)
         pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
-- 
1.8.1.2



More information about the pulseaudio-discuss mailing list