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

Tanu Kaskinen tanu.kaskinen at digia.com
Fri Apr 13 04:48:28 PDT 2012


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

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index a3b5944..a60afe5 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -518,6 +518,7 @@ void pa_alsa_path_free(pa_alsa_path *p) {
         setting_free(s);
     }
 
+    pa_proplist_free(p->proplist);
     pa_xfree(p->name);
     pa_xfree(p->description);
     pa_xfree(p);
@@ -2388,6 +2389,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;
@@ -2399,7 +2401,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)
@@ -4379,13 +4381,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, p->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 fdcff76..6b12a7f 100644
--- a/src/modules/alsa/alsa-mixer.h
+++ b/src/modules/alsa/alsa-mixer.h
@@ -181,6 +181,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 160f222..d591686 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 = ...
 ;
+; [Properties]                           # 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.10



More information about the pulseaudio-discuss mailing list