mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
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:
parent
1d4b24d02b
commit
e3d3f04780
4 changed files with 34 additions and 6 deletions
|
|
@ -724,6 +724,7 @@ static int impl_clear(struct spa_handle *handle)
|
|||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
this = (struct state *) handle;
|
||||
spa_alsa_close(this);
|
||||
spa_alsa_clear(this);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -805,8 +806,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
spa_list_init(&this->ready);
|
||||
|
||||
snd_config_update_free_global();
|
||||
|
||||
for (i = 0; info && i < info->n_items; i++) {
|
||||
const char *k = info->items[i].key;
|
||||
const char *s = info->items[i].value;
|
||||
|
|
@ -834,7 +833,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->props.use_chmap = spa_atob(s);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
return spa_alsa_init(this);
|
||||
}
|
||||
|
||||
static const struct spa_interface_info impl_interfaces[] = {
|
||||
|
|
|
|||
|
|
@ -744,6 +744,7 @@ static int impl_clear(struct spa_handle *handle)
|
|||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
this = (struct state *) handle;
|
||||
spa_alsa_close(this);
|
||||
spa_alsa_clear(this);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -823,8 +824,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
spa_list_init(&this->free);
|
||||
spa_list_init(&this->ready);
|
||||
|
||||
snd_config_update_free_global();
|
||||
|
||||
for (i = 0; info && i < info->n_items; i++) {
|
||||
const char *k = info->items[i].key;
|
||||
const char *s = info->items[i].value;
|
||||
|
|
@ -850,7 +849,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->props.use_chmap = spa_atob(s);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return spa_alsa_init(this);
|
||||
}
|
||||
|
||||
static const struct spa_interface_info impl_interfaces[] = {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ extern "C" {
|
|||
#include <math.h>
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
#include <alsa/use-case.h>
|
||||
|
||||
#include <spa/support/plugin.h>
|
||||
#include <spa/support/loop.h>
|
||||
|
|
@ -194,6 +195,8 @@ struct state {
|
|||
double max_error;
|
||||
|
||||
struct spa_latency_info latency;
|
||||
|
||||
snd_use_case_mgr_t *ucm;
|
||||
};
|
||||
|
||||
int
|
||||
|
|
@ -203,6 +206,9 @@ spa_alsa_enum_format(struct state *state, int seq,
|
|||
|
||||
int spa_alsa_set_format(struct state *state, struct spa_audio_info *info, uint32_t flags);
|
||||
|
||||
int spa_alsa_init(struct state *state);
|
||||
int spa_alsa_clear(struct state *state);
|
||||
|
||||
int spa_alsa_open(struct state *state);
|
||||
int spa_alsa_start(struct state *state);
|
||||
int spa_alsa_reassign_follower(struct state *state);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue