alsa-pcm: allow setting number of channels

Allow passing the number of channels when creating a device to
restrict the negotiated channels.
This commit is contained in:
Wim Taymans 2020-07-01 12:54:27 +02:00
parent 267eabaf69
commit 8168dfdbc1
5 changed files with 15 additions and 0 deletions

View file

@ -770,6 +770,8 @@ impl_init(const struct spa_handle_factory *factory,
for (i = 0; info && i < info->n_items; i++) {
if (!strcmp(info->items[i].key, SPA_KEY_API_ALSA_PATH)) {
snprintf(this->props.device, 63, "%s", info->items[i].value);
} else if (!strcmp(info->items[i].key, SPA_KEY_AUDIO_CHANNELS)) {
this->default_channels = atoi(info->items[i].value);
}
}
return 0;