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

Tanu Kaskinen tanuk at iki.fi
Sat Dec 3 02:26:10 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     |    4 ++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index c646f31..69d2134 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);
@@ -2379,6 +2381,7 @@ 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;
@@ -2390,7 +2393,7 @@ pa_alsa_path* pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa
 
     fn = pa_maybe_prefix_path(fname, paths_dir);
 
-    r = pa_config_parse(fn, NULL, items, NULL, p);
+    r = pa_config_parse(fn, NULL, items, p->proplist, p);
     pa_xfree(fn);
 
     if (r < 0)
@@ -4371,13 +4374,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..441653d 100644
--- a/src/modules/alsa/mixer/paths/analog-output.conf.common
+++ b/src/modules/alsa/mixer/paths/analog-output.conf.common
@@ -57,6 +57,10 @@
 ; priority = ...                         # Priority for this path
 ; description = ...
 ;
+; [Property List]                        # Property list for this path. The list is merged into the port property list.
+; <key> = <value>                        # Each property is defined on its own line.
+; ...
+;
 ; [Option ...:...]                       # For each option of an enumeration or switch element
 ;                                        # that shall be exposed as a sink/source port. Needs to
 ;                                        # be named after the Element, followed by a colon, followed
-- 
1.7.7.3



More information about the pulseaudio-discuss mailing list