From 2681d7e3ec7d0cb9a71d1e003d5b584fef3b5c86 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 31 Jan 2023 15:59:39 +0100 Subject: [PATCH] acp: add option to set Pro Audio channels We always probe the Pro Audio profile with the maximum number of channels but this can lead to a more limited amount of sample rates. Add an option to set the channels used when probing so that the other samplerates become available. Fixes #2990 --- spa/plugins/alsa/acp/acp.c | 5 ++++- spa/plugins/alsa/acp/card.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/spa/plugins/alsa/acp/acp.c b/spa/plugins/alsa/acp/acp.c index f9985b4ff..b77c6dabf 100644 --- a/spa/plugins/alsa/acp/acp.c +++ b/spa/plugins/alsa/acp/acp.c @@ -315,7 +315,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index) ss.format = PA_SAMPLE_S32LE; ss.rate = impl->rate; - ss.channels = 64; + ss.channels = impl->pro_channels; ap = pa_xnew0(pa_alsa_profile, 1); ap->profile_set = ps; @@ -1564,6 +1564,7 @@ struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props) impl->auto_port = true; impl->ignore_dB = false; impl->rate = DEFAULT_RATE; + impl->pro_channels = 64; if (props) { if ((s = acp_dict_lookup(props, "api.alsa.use-ucm")) != NULL) @@ -1582,6 +1583,8 @@ struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props) impl->auto_port = spa_atob(s); if ((s = acp_dict_lookup(props, "api.acp.probe-rate")) != NULL) impl->rate = atoi(s); + if ((s = acp_dict_lookup(props, "api.acp.pro-channels")) != NULL) + impl->pro_channels = atoi(s); } impl->ucm.default_sample_spec.format = PA_SAMPLE_S16NE; diff --git a/spa/plugins/alsa/acp/card.h b/spa/plugins/alsa/acp/card.h index 5a9406420..c58f89abe 100644 --- a/spa/plugins/alsa/acp/card.h +++ b/spa/plugins/alsa/acp/card.h @@ -48,6 +48,7 @@ struct pa_card { bool auto_port; bool ignore_dB; uint32_t rate; + uint32_t pro_channels; pa_alsa_ucm_config ucm; pa_alsa_profile_set *profile_set;