[pulseaudio-discuss] [PATCH 10/17] alsa: Add a ports array to pa_alsa_ucm_mapping_context

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


Currently UCM ports are created at the same time with profiles, but
I want to create the ports before the profiles. This new array will
allow creating the ports separately from the profiles.
---
 src/modules/alsa/alsa-ucm.c | 8 ++++++++
 src/modules/alsa/alsa-ucm.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index ce10970..302c8fc 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -740,6 +740,7 @@ static void ucm_add_port_combination(
         }
 
         pa_hashmap_put(ports, port->name, port);
+        pa_dynarray_append(context->ports, port);
         pa_log_debug("Add port %s: %s", port->name, port->description);
         port->profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
     }
@@ -1165,6 +1166,7 @@ static int ucm_create_mapping_direction(
 
     if (!m->ucm_context.ucm_devices) {   /* new mapping */
         m->ucm_context.ucm_devices = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
+        m->ucm_context.ports = pa_dynarray_new(NULL);
         m->ucm_context.ucm = ucm;
         m->ucm_context.direction = is_sink ? PA_DIRECTION_OUTPUT : PA_DIRECTION_INPUT;
 
@@ -1218,6 +1220,7 @@ static int ucm_create_mapping_for_modifier(
     if (!m->ucm_context.ucm_devices && !m->ucm_context.ucm_modifiers) {   /* new mapping */
         m->ucm_context.ucm_devices = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
         m->ucm_context.ucm_modifiers = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
+        m->ucm_context.ports = pa_dynarray_new(NULL);
         m->ucm_context.ucm = ucm;
         m->ucm_context.direction = is_sink ? PA_DIRECTION_OUTPUT : PA_DIRECTION_INPUT;
 
@@ -1597,6 +1600,11 @@ void pa_alsa_ucm_mapping_context_free(pa_alsa_ucm_mapping_context *context) {
     pa_alsa_ucm_modifier *mod;
     uint32_t idx;
 
+    pa_assert(context);
+
+    if (context->ports)
+        pa_dynarray_free(context->ports);
+
     if (context->ucm_devices) {
         /* clear ucm device pointer to mapping */
         PA_IDXSET_FOREACH(dev, context->ucm_devices, idx) {
diff --git a/src/modules/alsa/alsa-ucm.h b/src/modules/alsa/alsa-ucm.h
index 2fae6c4..66b27a0 100644
--- a/src/modules/alsa/alsa-ucm.h
+++ b/src/modules/alsa/alsa-ucm.h
@@ -192,6 +192,7 @@ struct pa_alsa_ucm_mapping_context {
 
     pa_idxset *ucm_devices;
     pa_idxset *ucm_modifiers;
+    pa_dynarray *ports;
 };
 
 #endif
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list