alsa: Catch role matched streams to enable/disable modifier

In UCM basic functions, we only assign intended roles from modifier
to sink/source, but we don't have a chance to set the ucm modifiers.
Here we amend the functions so that when roled stream starts or
stops, we have the following results:
1. stream will be routed to sink/source specified in modifier by
   module-intended-roles
2. After that, modifier will be enabled or disabled.
3. when multiple streams with matched roles of modifier start, only
   the first one will enable the modifier, and when they end, the
   last one will disable the modifier.

Signed-off-by: Feng Wei <wei.feng@freescale.com>
Signed-off-by: Arun Raghavan <arun.raghavan@collabora.co.uk>
This commit is contained in:
Feng Wei 2012-07-17 18:17:21 +08:00 committed by Arun Raghavan
parent 801f286dfd
commit 3a92bda554
5 changed files with 148 additions and 34 deletions

View file

@ -106,6 +106,9 @@ int pa_alsa_ucm_set_port(pa_alsa_ucm_mapping_context *context, pa_device_port *p
void pa_alsa_ucm_free(pa_alsa_ucm_config *ucm);
void pa_alsa_ucm_mapping_context_free(pa_alsa_ucm_mapping_context *context);
void pa_alsa_ucm_roled_stream_begin(pa_alsa_ucm_config *ucm, const char *role, pa_direction_t dir);
void pa_alsa_ucm_roled_stream_end(pa_alsa_ucm_config *ucm, const char *role, pa_direction_t dir);
/* UCM - Use Case Manager is available on some audio cards */
struct pa_alsa_ucm_device {
@ -147,6 +150,9 @@ struct pa_alsa_ucm_modifier {
/* Non-NULL if the modifier has its own PlaybackPCM/CapturePCM */
pa_alsa_mapping *playback_mapping;
pa_alsa_mapping *capture_mapping;
/* Count how many role matched streams are running */
int enabled_counter;
};
struct pa_alsa_ucm_verb {