[PATCH 3/6] alsa: add ucm data structures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The UCM stores the mixer settings per use case in configuration files, these
files contains information such:
- list of use case verbs per card or machine
- supported devices per use case verb
- use case sink device
- use case source device
- hardware playback volume control id (per use case verb and device)
- hardware playback mute switch id
- hardware capture volume control id
- hardware capture mute switch id

The new ucm data structures are used to store that info so it can be used by
pulseaudio.

Signed-off-by: Margarita Olaya Cabrera <magi at slimlogic.co.uk>
---
 src/modules/alsa/alsa-mixer.h |   51 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h
index a29aed1..072a7cb 100644
--- a/src/modules/alsa/alsa-mixer.h
+++ b/src/modules/alsa/alsa-mixer.h
@@ -24,6 +24,7 @@
 ***/

 #include <asoundlib.h>
+#include <use-case.h>

 #include <pulse/sample.h>
 #include <pulse/volume.h>
@@ -49,6 +50,10 @@ typedef struct pa_alsa_profile pa_alsa_profile;
 typedef struct pa_alsa_decibel_fix pa_alsa_decibel_fix;
 typedef struct pa_alsa_profile_set pa_alsa_profile_set;
 typedef struct pa_alsa_port_data pa_alsa_port_data;
+typedef struct pa_alsa_ucm_verb pa_alsa_ucm_verb;
+typedef struct pa_alsa_ucm_modifier pa_alsa_ucm_modifier;
+typedef struct pa_alsa_ucm_device pa_alsa_ucm_device;
+typedef struct pa_alsa_ucm_config pa_alsa_ucm_config;

 #include "alsa-util.h"

@@ -87,6 +92,11 @@ typedef enum pa_alsa_direction {
     PA_ALSA_DIRECTION_INPUT
 } pa_alsa_direction_t;

+typedef enum pa_alsa_ucm_mapping_type {
+    PA_ALSA_UCM_MAPPING_DEVICE,
+    PA_ALSA_UCM_MAPPING_MODIFIER
+} pa_alsa_ucm_mapping_type_t;
+
 /* A setting combines a couple of options into a single entity that
  * may be selected. Only one setting can be active at the same
  * time. */
@@ -229,6 +239,10 @@ void pa_alsa_path_set_probe(pa_alsa_path_set *s,
snd_mixer_t *m, pa_bool_t ignor
 void pa_alsa_path_set_dump(pa_alsa_path_set *s);
 void pa_alsa_path_set_set_callback(pa_alsa_path_set *ps, snd_mixer_t
*m, snd_mixer_elem_callback_t cb, void *userdata);
 void pa_alsa_path_set_free(pa_alsa_path_set *s);
+pa_alsa_mapping *mapping_get(pa_alsa_profile_set *ps, const char *name);
+int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus);
+void profile_set_add_auto(pa_alsa_profile_set *ps);
+int profile_verify(pa_alsa_profile *p);

 struct pa_alsa_mapping {
     pa_alsa_profile_set *profile_set;
@@ -237,6 +251,7 @@ struct pa_alsa_mapping {
     char *description;
     unsigned priority;
     pa_alsa_direction_t direction;
+    pa_alsa_ucm_mapping_type_t ucm_type;

     pa_channel_map channel_map;

@@ -329,4 +344,40 @@ struct pa_alsa_port_data {

 void pa_alsa_add_ports(pa_hashmap **p, pa_alsa_path_set *ps);

+/* UCM - Use Case Manager is available on some audio cards */
+
+typedef enum pa_alsa_ucm_status {
+    PA_ALSA_UCM_DISABLED = 0,
+    PA_ALSA_UCM_ENABLED,
+} pa_alsa_ucm_status_t;
+
+struct pa_alsa_ucm_device {
+    PA_LLIST_FIELDS(pa_alsa_ucm_device);
+    pa_proplist *proplist;
+    pa_alsa_ucm_status_t status;
+};
+
+struct pa_alsa_ucm_modifier {
+    PA_LLIST_FIELDS(pa_alsa_ucm_modifier);
+    pa_proplist *proplist;
+    pa_alsa_ucm_status_t status;
+};
+
+struct pa_alsa_ucm_verb {
+    PA_LLIST_FIELDS(pa_alsa_ucm_verb);
+    pa_proplist *proplist;
+    pa_alsa_ucm_status_t status;
+    PA_LLIST_HEAD(pa_alsa_ucm_device, devices);
+    PA_LLIST_HEAD(pa_alsa_ucm_modifier, modifiers);
+};
+
+struct pa_alsa_ucm_config {
+    snd_use_case_mgr_t *ucm_mgr;
+    const char *verb_ini;
+    const char *verb_new;
+    pa_alsa_ucm_status_t status;
+
+    PA_LLIST_HEAD(pa_alsa_ucm_verb, verbs);
+};
+
 #endif
-- 
1.7.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux