[pulseaudio-discuss] [PATCH 2/2] alsa-mixer: Add support for defining port property lists in the path configuration files.

Tanu Kaskinen tanuk at iki.fi
Fri Dec 2 12:31:03 PST 2011


From: Tanu Kaskinen <tanu.kaskinen at digia.com>

---
 src/modules/alsa/alsa-mixer.c                      |   13 ++++++++++++-
 src/modules/alsa/alsa-mixer.h                      |    1 +
 .../alsa/mixer/paths/analog-output.conf.common     |    1 +
 3 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 36f3351..4cfc7f6 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -545,6 +545,8 @@ void pa_alsa_path_free(pa_alsa_path *p) {
 
     pa_assert(p);
 
+    pa_proplist_free(p->proplist);
+
     while ((e = p->elements)) {
         PA_LLIST_REMOVE(pa_alsa_element, p->elements, e);
         element_free(e);
@@ -2353,6 +2355,7 @@ pa_alsa_path* pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa
         { "priority",            pa_config_parse_unsigned,          NULL, "General" },
         { "description",         pa_config_parse_string,            NULL, "General" },
         { "name",                pa_config_parse_string,            NULL, "General" },
+        { "proplist",            pa_config_parse_proplist,          NULL, "General" },
 
         /* [Option ...] */
         { "priority",            option_parse_priority,             NULL, NULL },
@@ -2379,11 +2382,13 @@ pa_alsa_path* pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa
     p = pa_xnew0(pa_alsa_path, 1);
     n = pa_path_get_filename(fname);
     p->name = pa_xstrndup(n, strcspn(n, "."));
+    p->proplist = pa_proplist_new();
     p->direction = direction;
 
     items[0].data = &p->priority;
     items[1].data = &p->description;
     items[2].data = &p->name;
+    items[3].data = &p->proplist;
 
     if (!paths_dir)
         paths_dir = get_default_paths_dir();
@@ -4371,13 +4376,19 @@ static pa_device_port* device_port_alsa_init(pa_hashmap *ports,
     pa_hashmap *extra,
     pa_core *core) {
 
-    pa_device_port * p = pa_hashmap_get(ports, name);
+    pa_device_port *p;
+
+    pa_assert(path);
+
+    p = pa_hashmap_get(ports, name);
+
     if (!p) {
         pa_alsa_port_data *data;
 
         p = pa_device_port_new(core, name, description, sizeof(pa_alsa_port_data));
         pa_assert(p);
         pa_hashmap_put(ports, name, p);
+        pa_proplist_update(p->proplist, PA_UPDATE_REPLACE, path->proplist);
         p->profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
 
         data = PA_DEVICE_PORT_DATA(p);
diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h
index aa340b9..0f36660 100644
--- a/src/modules/alsa/alsa-mixer.h
+++ b/src/modules/alsa/alsa-mixer.h
@@ -163,6 +163,7 @@ struct pa_alsa_path {
     char *name;
     char *description;
     unsigned priority;
+    pa_proplist *proplist;
 
     pa_bool_t probed:1;
     pa_bool_t supported:1;
diff --git a/src/modules/alsa/mixer/paths/analog-output.conf.common b/src/modules/alsa/mixer/paths/analog-output.conf.common
index db6b473..7cc8070 100644
--- a/src/modules/alsa/mixer/paths/analog-output.conf.common
+++ b/src/modules/alsa/mixer/paths/analog-output.conf.common
@@ -56,6 +56,7 @@
 ; [General]
 ; priority = ...                         # Priority for this path
 ; description = ...
+; proplist = ...                         # Property list for this path. Will be merged into the port property list.
 ;
 ; [Option ...:...]                       # For each option of an enumeration or switch element
 ;                                        # that shall be exposed as a sink/source port. Needs to
-- 
1.7.7.3



More information about the pulseaudio-discuss mailing list