[pulseaudio-discuss] [PATCH v2 03/21] Remove create_node from sink and source new data

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


Every sink and source that doesn't have ports should have a node. The
ports/no ports checking can be done by the core, so node backends
don't need to explicitly tell whether a node should be created or not.
---
 src/modules/alsa/alsa-sink.c          | 5 +----
 src/modules/alsa/alsa-source.c        | 5 +----
 src/modules/jack/module-jack-sink.c   | 1 -
 src/modules/jack/module-jack-source.c | 1 -
 src/pulsecore/sink.c                  | 8 +-------
 src/pulsecore/sink.h                  | 2 --
 src/pulsecore/source.c                | 8 +-------
 src/pulsecore/source.h                | 2 --
 8 files changed, 4 insertions(+), 28 deletions(-)

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index af081b9..1600334 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -2297,10 +2297,7 @@ 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");
-    }
+    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));
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index f9d5b1a..432d61f 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1996,10 +1996,7 @@ 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");
-    }
+    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/jack/module-jack-sink.c b/src/modules/jack/module-jack-sink.c
index 62b04f4..b064354 100644
--- a/src/modules/jack/module-jack-sink.c
+++ b/src/modules/jack/module-jack-sink.c
@@ -399,7 +399,6 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
-    pa_sink_new_data_set_create_node(&data, true);
     pa_node_new_data_set_fallback_name_prefix(&data.node_data, "jack");
 
     u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY);
diff --git a/src/modules/jack/module-jack-source.c b/src/modules/jack/module-jack-source.c
index 8fb1820..0d46cc9 100644
--- a/src/modules/jack/module-jack-source.c
+++ b/src/modules/jack/module-jack-source.c
@@ -346,7 +346,6 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
-    pa_source_new_data_set_create_node(&data, true);
     pa_node_new_data_set_fallback_name_prefix(&data.node_data, "jack");
 
     u->source = pa_source_new(m->core, &data, PA_SOURCE_LATENCY);
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index be69c94..f393d42 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -139,12 +139,6 @@ void pa_sink_new_data_set_port(pa_sink_new_data *data, const char *port) {
     data->active_port = pa_xstrdup(port);
 }
 
-void pa_sink_new_data_set_create_node(pa_sink_new_data *data, bool create) {
-    pa_assert(data);
-
-    data->create_node = create;
-}
-
 void pa_sink_new_data_done(pa_sink_new_data *data) {
     pa_assert(data);
 
@@ -378,7 +372,7 @@ pa_sink* pa_sink_new(
     pa_source_set_fixed_latency(s->monitor_source, s->thread_info.fixed_latency);
     pa_source_set_max_rewind(s->monitor_source, s->thread_info.max_rewind);
 
-    if (data->create_node) {
+    if (pa_hashmap_isempty(s->ports)) {
         if (!data->node_data.description)
             pa_node_new_data_set_description(&data->node_data, pa_sink_get_description(s));
 
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index 8ff0c36..a4cd324 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -360,7 +360,6 @@ typedef struct pa_sink_new_data {
     bool save_volume:1;
     bool save_muted:1;
 
-    bool create_node;
     pa_node_new_data node_data;
 } pa_sink_new_data;
 
@@ -372,7 +371,6 @@ void pa_sink_new_data_set_alternate_sample_rate(pa_sink_new_data *data, const ui
 void pa_sink_new_data_set_volume(pa_sink_new_data *data, const pa_cvolume *volume);
 void pa_sink_new_data_set_muted(pa_sink_new_data *data, bool mute);
 void pa_sink_new_data_set_port(pa_sink_new_data *data, const char *port);
-void pa_sink_new_data_set_create_node(pa_sink_new_data *data, bool create);
 void pa_sink_new_data_done(pa_sink_new_data *data);
 
 /*** To be called exclusively by the sink driver, from main context */
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index a0ed9b2..09866ea 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -130,12 +130,6 @@ void pa_source_new_data_set_port(pa_source_new_data *data, const char *port) {
     data->active_port = pa_xstrdup(port);
 }
 
-void pa_source_new_data_set_create_node(pa_source_new_data *data, bool create) {
-    pa_assert(data);
-
-    data->create_node = create;
-}
-
 void pa_source_new_data_done(pa_source_new_data *data) {
     pa_assert(data);
 
@@ -333,7 +327,7 @@ pa_source* pa_source_new(
     if (s->card)
         pa_assert_se(pa_idxset_put(s->card->sources, s, NULL) >= 0);
 
-    if (data->create_node) {
+    if (pa_hashmap_isempty(s->ports)) {
         if (!data->node_data.description)
             pa_node_new_data_set_description(&data->node_data, pa_source_get_description(s));
 
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index 606dc1e..99bdf83 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -297,7 +297,6 @@ typedef struct pa_source_new_data {
     bool save_volume:1;
     bool save_muted:1;
 
-    bool create_node;
     pa_node_new_data node_data;
 } pa_source_new_data;
 
@@ -309,7 +308,6 @@ void pa_source_new_data_set_alternate_sample_rate(pa_source_new_data *data, cons
 void pa_source_new_data_set_volume(pa_source_new_data *data, const pa_cvolume *volume);
 void pa_source_new_data_set_muted(pa_source_new_data *data, bool mute);
 void pa_source_new_data_set_port(pa_source_new_data *data, const char *port);
-void pa_source_new_data_set_create_node(pa_source_new_data *data, bool create);
 void pa_source_new_data_done(pa_source_new_data *data);
 
 /*** To be called exclusively by the source driver, from main context */
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list