alsa: move codec config to acp-device

Just like the latency, move the codecs to the device Route param.
This way, it is easier for the session manager to save and restore
the codecs as part of the Route settings.
This commit is contained in:
Wim Taymans 2021-09-02 10:05:33 +02:00
parent 1a93165e84
commit 80628f38e7
4 changed files with 151 additions and 20 deletions

View file

@ -205,6 +205,7 @@ static void init_device(pa_card *impl, pa_alsa_device *dev, pa_alsa_direction_t
pa_alsa_mapping *m, uint32_t index)
{
uint32_t i;
char **d;
dev->card = impl;
dev->mapping = m;
@ -244,18 +245,21 @@ static void init_device(pa_card *impl, pa_alsa_device *dev, pa_alsa_direction_t
if (m->ucm_context.ucm) {
dev->ucm_context = &m->ucm_context;
if (impl->ucm.alibpref != NULL) {
char **d;
for (d = m->device_strings; *d; d++) {
if (pa_startswith(*d, impl->ucm.alibpref)) {
size_t plen = strlen(impl->ucm.alibpref);
size_t len = strlen(*d);
memmove(*d, (*d) + plen, len - plen + 1);
dev->device.flags |= ACP_DEVICE_UCM_DEVICE;
break;
}
}
}
}
for (d = m->device_strings; *d; d++) {
if (pa_startswith(*d, "iec958") ||
pa_startswith(*d, "hdmi"))
dev->device.flags |= ACP_DEVICE_IEC958;
}
pa_dynarray_init(&dev->port_array, NULL);
}