[pulseaudio-discuss] [PATCH v3 09/18] alsa: Add node support

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Wed Jul 3 04:09:12 PDT 2013


---
 src/modules/alsa/alsa-mixer.c  | 2 ++
 src/modules/alsa/alsa-sink.c   | 5 +++++
 src/modules/alsa/alsa-source.c | 5 +++++
 src/modules/alsa/alsa-ucm.c    | 2 ++
 4 files changed, 14 insertions(+)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 364c40c..3bce653 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -4496,6 +4496,8 @@ static pa_device_port* device_port_alsa_init(pa_hashmap *ports, /* card ports */
         pa_device_port_new_data_set_name(&port_data, name);
         pa_device_port_new_data_set_description(&port_data, description);
         pa_device_port_new_data_set_direction(&port_data, path->direction == PA_ALSA_DIRECTION_OUTPUT ? PA_DIRECTION_OUTPUT : PA_DIRECTION_INPUT);
+        pa_device_port_new_data_set_create_node(&port_data, true);
+        pa_node_new_data_set_fallback_name_prefix(&port_data.node_data, "alsa");
 
         p = pa_device_port_new(core, &port_data, sizeof(pa_alsa_port_data));
         pa_device_port_new_data_done(&port_data);
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 759f9f8..5318a3c 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -2292,6 +2292,11 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
     else if (u->mixer_path_set)
         pa_alsa_add_ports(&data, u->mixer_path_set, card);
 
+    if (pa_hashmap_isempty(data.ports)) {
+        pa_sink_new_data_set_create_node(&data, true);
+        pa_node_new_data_set_fallback_name_prefix(&data.node_data, "alsa");
+    }
+
     u->sink = pa_sink_new(m->core, &data, PA_SINK_HARDWARE | PA_SINK_LATENCY | (u->use_tsched ? PA_SINK_DYNAMIC_LATENCY : 0) |
                           (set_formats ? PA_SINK_SET_FORMATS : 0));
     pa_sink_new_data_done(&data);
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 8b6fe82..ff7f8a2 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1991,6 +1991,11 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
     else if (u->mixer_path_set)
         pa_alsa_add_ports(&data, u->mixer_path_set, card);
 
+    if (pa_hashmap_isempty(data.ports)) {
+        pa_source_new_data_set_create_node(&data, true);
+        pa_node_new_data_set_fallback_name_prefix(&data.node_data, "alsa");
+    }
+
     u->source = pa_source_new(m->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY|(u->use_tsched ? PA_SOURCE_DYNAMIC_LATENCY : 0));
     pa_source_new_data_done(&data);
 
diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index 1c1cd9c..fdded87 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -694,6 +694,8 @@ static void ucm_add_port_combination(
         pa_device_port_new_data_set_name(&port_data, name);
         pa_device_port_new_data_set_description(&port_data, desc);
         pa_device_port_new_data_set_direction(&port_data, is_sink ? PA_DIRECTION_OUTPUT : PA_DIRECTION_INPUT);
+        pa_device_port_new_data_set_create_node(&port_data, true);
+        pa_node_new_data_set_fallback_name_prefix(&port_data.node_data, "alsa");
 
         port = pa_device_port_new(core, &port_data, 0);
         pa_device_port_new_data_done(&port_data);
-- 
1.8.1.2



More information about the pulseaudio-discuss mailing list