[pulseaudio-discuss] [PATCH 08/11] Add possibility to configure connection to jack input devices

David Henningsson david.henningsson at canonical.com
Tue Aug 30 12:25:01 PDT 2011


Signed-off-by: David Henningsson <david.henningsson at canonical.com>
---
 src/modules/alsa/alsa-mixer.c                      |    9 +++++++++
 src/modules/alsa/alsa-mixer.h                      |    3 +++
 .../alsa/mixer/paths/analog-input-dock-mic.conf    |    4 ++++
 .../alsa/mixer/paths/analog-input-front-mic.conf   |    4 ++++
 .../mixer/paths/analog-input-internal-mic.conf     |    4 ++++
 src/modules/alsa/mixer/paths/analog-input-mic.conf |    3 +++
 .../alsa/mixer/paths/analog-input-rear-mic.conf    |    4 ++++
 .../alsa/mixer/paths/analog-output-headphones.conf |    3 +++
 .../alsa/mixer/paths/analog-output.conf.common     |    3 +++
 9 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 1926117..e68258d 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -2325,6 +2325,10 @@ pa_alsa_path* pa_alsa_path_new(const char *fname, pa_alsa_direction_t direction)
         { "description",         pa_config_parse_string,            NULL, "General" },
         { "name",                pa_config_parse_string,            NULL, "General" },
 
+        /* [Jack_InputDevice] */
+        { "name",                pa_config_parse_string,            NULL, "Jack_InputDevice" },
+        { "code",                pa_config_parse_string,            NULL, "Jack_InputDevice" },
+
         /* [Option ...] */
         { "priority",            option_parse_priority,             NULL, NULL },
         { "name",                option_parse_name,                 NULL, NULL },
@@ -2356,6 +2360,9 @@ pa_alsa_path* pa_alsa_path_new(const char *fname, pa_alsa_direction_t direction)
     items[1].data = &p->description;
     items[2].data = &p->name;
 
+    items[3].data = &p->jack_inputdev_name;
+    items[4].data = &p->jack_inputdev_code;
+
     fn = pa_maybe_prefix_path(fname,
                               pa_run_from_build_tree() ? PA_BUILDDIR "/modules/alsa/mixer/paths/" :
                               PA_ALSA_PATHS_DIR);
@@ -3047,6 +3054,8 @@ static void path_set_condense(pa_alsa_path_set *ps, snd_mixer_t *m) {
             if (p == p2)
                 continue;
 
+            /* FIXME: a is not a subset of b if a has a matched port and b has not. */
+
             /* Compare the elements of each set... */
             pa_assert_se(ea = p->elements);
             pa_assert_se(eb = p2->elements);
diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h
index c20904b..1d99b13 100644
--- a/src/modules/alsa/alsa-mixer.h
+++ b/src/modules/alsa/alsa-mixer.h
@@ -166,6 +166,9 @@ struct pa_alsa_path {
     char *description;
     unsigned priority;
 
+    char *jack_inputdev_name;
+    char *jack_inputdev_code;
+
     pa_bool_t probed:1;
     pa_bool_t supported:1;
     pa_bool_t has_mute:1;
diff --git a/src/modules/alsa/mixer/paths/analog-input-dock-mic.conf b/src/modules/alsa/mixer/paths/analog-input-dock-mic.conf
index 489cf90..9d9fc0a 100644
--- a/src/modules/alsa/mixer/paths/analog-input-dock-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-dock-mic.conf
@@ -22,6 +22,10 @@
 priority = 78
 name = analog-input-microphone-dock
 
+[Jack_InputDevice]
+code = Microphone
+name = Dock
+
 [Element Dock Mic Boost]
 required-any = any
 switch = select
diff --git a/src/modules/alsa/mixer/paths/analog-input-front-mic.conf b/src/modules/alsa/mixer/paths/analog-input-front-mic.conf
index 5ae516c..12da7d8 100644
--- a/src/modules/alsa/mixer/paths/analog-input-front-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-front-mic.conf
@@ -22,6 +22,10 @@
 priority = 85
 name = analog-input-microphone-front
 
+[Jack_InputDevice]
+code = Microphone
+name = Front
+
 [Element Front Mic Boost]
 required-any = any
 switch = select
diff --git a/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf b/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf
index 70a1cd1..41d9cf6 100644
--- a/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf
@@ -23,6 +23,10 @@
 priority = 89
 name = analog-input-microphone-internal
 
+[Jack_InputDevice]
+code = Microphone
+name = Int
+
 [Element Internal Mic Boost]
 required-any = any
 switch = select
diff --git a/src/modules/alsa/mixer/paths/analog-input-mic.conf b/src/modules/alsa/mixer/paths/analog-input-mic.conf
index 50d4c45..8ca00fd 100644
--- a/src/modules/alsa/mixer/paths/analog-input-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-mic.conf
@@ -22,6 +22,9 @@
 priority = 87
 name = analog-input-microphone
 
+[Jack_InputDevice]
+code = Microphone
+
 [Element Mic Boost]
 required-any = any
 switch = select
diff --git a/src/modules/alsa/mixer/paths/analog-input-rear-mic.conf b/src/modules/alsa/mixer/paths/analog-input-rear-mic.conf
index 4046106..deeb812 100644
--- a/src/modules/alsa/mixer/paths/analog-input-rear-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-rear-mic.conf
@@ -22,6 +22,10 @@
 priority = 82
 name = analog-input-microphone-rear
 
+[Jack_InputDevice]
+code = Microphone
+name = Rear
+
 [Element Rear Mic Boost]
 required-any = any
 switch = select
diff --git a/src/modules/alsa/mixer/paths/analog-output-headphones.conf b/src/modules/alsa/mixer/paths/analog-output-headphones.conf
index 1d8d3fe..b488122 100644
--- a/src/modules/alsa/mixer/paths/analog-output-headphones.conf
+++ b/src/modules/alsa/mixer/paths/analog-output-headphones.conf
@@ -22,6 +22,9 @@
 priority = 90
 name = analog-output-headphones
 
+[Jack_InputDevice]
+code = Headphone
+
 [Element Hardware Master]
 switch = mute
 volume = merge
diff --git a/src/modules/alsa/mixer/paths/analog-output.conf.common b/src/modules/alsa/mixer/paths/analog-output.conf.common
index db6b473..75f673a 100644
--- a/src/modules/alsa/mixer/paths/analog-output.conf.common
+++ b/src/modules/alsa/mixer/paths/analog-output.conf.common
@@ -57,6 +57,9 @@
 ; priority = ...                         # Priority for this path
 ; description = ...
 ;
+; [Jack_InputDev]
+; name = ...                                                # Name of jack input device must contain this string
+; code = Headphone | Microphone | LineOut | VideoOut        # Type of switch events to listen to
 ; [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.5.4



More information about the pulseaudio-discuss mailing list