alsa: if we are passed a UCM device, make sure to open UCM

UCM devices can require local data from use_case_mgr_open() but since
we do that in a separate process, make sure we reopen the use case
manager in case we are passed a UCM device so that the config is
available.

See #1251
This commit is contained in:
Wim Taymans 2021-06-02 13:23:08 +02:00
parent 1d4b24d02b
commit e3d3f04780
4 changed files with 34 additions and 6 deletions

View file

@ -15,6 +15,29 @@
#include "alsa-pcm.h"
int spa_alsa_init(struct state *state)
{
int err;
snd_config_update_free_global();
if (strncmp(state->props.device, "_ucm", 4) == 0 &&
strlen(state->props.device) >= 12 &&
state->props.device[8] == '.') {
if ((err = snd_use_case_mgr_open(&state->ucm, &state->props.device[9])) < 0)
return err;
}
return 0;
}
int spa_alsa_clear(struct state *state)
{
if (state->ucm)
snd_use_case_mgr_close(state->ucm);
state->ucm = NULL;
return 0;
}
#define CHECK(s,msg,...) if ((err = (s)) < 0) { spa_log_error(state->log, msg ": %s", ##__VA_ARGS__, snd_strerror(err)); return err; }
int spa_alsa_open(struct state *state)