[pulseaudio-discuss] [PATCH 01/17] alsa: Add a ports array to pa_alsa_path

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Mon Dec 30 05:04:36 PST 2013


One path can be the basis for multiple ports. Having just a single
port pointer in pa_alsa_path doesn't make sense, and I'll remove that
pointer once I have converted the users of that pointer to use this
new ports array.
---
 src/modules/alsa/alsa-mixer.c | 7 +++++++
 src/modules/alsa/alsa-mixer.h | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index f4661f6..e7d137a 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -523,6 +523,10 @@ void pa_alsa_path_free(pa_alsa_path *p) {
     pa_proplist_free(p->proplist);
     pa_xfree(p->name);
     pa_xfree(p->description);
+
+    if (p->ports)
+        pa_dynarray_free(p->ports);
+
     pa_xfree(p);
 }
 
@@ -2423,6 +2427,7 @@ pa_alsa_path* pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa
     pa_assert(fname);
 
     p = pa_xnew0(pa_alsa_path, 1);
+    p->ports = pa_dynarray_new(NULL);
     n = pa_path_get_filename(fname);
     p->name = pa_xstrndup(n, strcspn(n, "."));
     p->proplist = pa_proplist_new();
@@ -2465,6 +2470,7 @@ pa_alsa_path *pa_alsa_path_synthesize(const char *element, pa_alsa_direction_t d
     pa_assert(element);
 
     p = pa_xnew0(pa_alsa_path, 1);
+    p->ports = pa_dynarray_new(NULL);
     p->name = pa_xstrdup(element);
     p->direction = direction;
 
@@ -4513,6 +4519,7 @@ static pa_device_port* device_port_alsa_init(pa_hashmap *ports, /* card ports */
         data->path = path;
         data->setting = setting;
         path->port = p;
+        pa_dynarray_append(path->ports, p);
     }
 
     if (cp)
diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h
index d964927..a557664 100644
--- a/src/modules/alsa/alsa-mixer.h
+++ b/src/modules/alsa/alsa-mixer.h
@@ -30,6 +30,7 @@
 #include <pulse/channelmap.h>
 #include <pulse/volume.h>
 
+#include <pulsecore/dynarray.h>
 #include <pulsecore/llist.h>
 #include <pulsecore/rtpoll.h>
 
@@ -178,6 +179,7 @@ struct pa_alsa_jack {
 struct pa_alsa_path {
     pa_alsa_direction_t direction;
     pa_device_port* port;
+    pa_dynarray *ports;
 
     char *name;
     char *description_key;
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list