alsa: rework UCM open

Use _alibpref to check if a device needs a UCM local config. Mark
the device as such and use this to set the OPEN_UCM property on
the device.
Open the UCM for a card when the device has the property set. Use the
same logic for loading the UCM as the acp code.

See #1251
This commit is contained in:
Wim Taymans 2021-06-02 17:25:21 +02:00
parent 58d0e44664
commit 35e81fbfdc
8 changed files with 61 additions and 18 deletions

View file

@ -829,6 +829,10 @@ impl_init(const struct spa_handle_factory *factory,
const char *s = info->items[i].value;
if (spa_streq(k, SPA_KEY_API_ALSA_PATH)) {
snprintf(this->props.device, 63, "%s", s);
} else if (spa_streq(k, SPA_KEY_API_ALSA_PCM_CARD)) {
this->card_index = atoi(s);
} else if (spa_streq(k, SPA_KEY_API_ALSA_OPEN_UCM)) {
this->open_ucm = spa_atob(s);
} else if (spa_streq(k, SPA_KEY_AUDIO_CHANNELS)) {
this->default_channels = atoi(s);
} else if (spa_streq(k, SPA_KEY_AUDIO_RATE)) {