mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: strip and add the _alibpref from device names
Strip the _alibpref from the device name, it contains a local counter to identify the ucm card that should remain internal. We set a flag on the device to notify of this. Re-add the _alibpref of the local card to the device name if the device was flagged. See #1286
This commit is contained in:
parent
283e13629c
commit
1c513464c8
2 changed files with 8 additions and 3 deletions
|
|
@ -252,6 +252,9 @@ static void init_device(pa_card *impl, pa_alsa_device *dev, pa_alsa_direction_t
|
|||
char **d;
|
||||
for (d = m->device_strings; *d; d++) {
|
||||
if (pa_startswith(*d, alibpref)) {
|
||||
size_t plen = strlen(alibpref);
|
||||
size_t len = strlen(*d);
|
||||
memmove(*d, (*d) + plen, len - plen + 1);
|
||||
dev->device.flags |= ACP_DEVICE_UCM_DEVICE;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <limits.h>
|
||||
|
||||
#include <spa/pod/filter.h>
|
||||
#include <spa/utils/string.h>
|
||||
#include <spa/support/system.h>
|
||||
|
||||
#define NAME "alsa-pcm"
|
||||
|
|
@ -49,9 +50,10 @@ int spa_alsa_init(struct state *state)
|
|||
if ((snd_use_case_get(state->ucm, "_alibpref", &alibpref) != 0))
|
||||
alibpref = NULL;
|
||||
if (alibpref != NULL) {
|
||||
size_t len = strlen(alibpref);
|
||||
if (len > 4 && strncmp(state->props.device, alibpref, 4) == 0)
|
||||
memcpy(state->props.device, alibpref, len);
|
||||
char name[sizeof(state->props.device)];
|
||||
spa_scnprintf(name, sizeof(name), "%s%s", alibpref,
|
||||
state->props.device);
|
||||
strcpy(state->props.device, name);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue