spa: alsa: Detect ports for HDMI AC3 profiles

Because the a52 plugin (being an ioplug) does not proxy snd_pcm_info for
its slave PCM, we need a different way to figure out the card associated
with the device. It turns out we do have access to the card index
already in the caller, so let's pass that index down as a fallback.

This is done as a fallback rather than replacing the existing lookup in
case there are situations where they might be mismatched. We could
possibly just replace the existing lookup, but the cost seems low enough
to not merit the risk of changing this.
This commit is contained in:
Arun Raghavan 2026-06-05 19:05:47 -07:00
parent bb634fb0f9
commit cb327e5762
5 changed files with 17 additions and 11 deletions

View file

@ -1923,16 +1923,19 @@ __close:
return NULL;
}
snd_mixer_t *pa_alsa_open_mixer_for_pcm(pa_hashmap *mixers, snd_pcm_t *pcm, bool probe) {
snd_mixer_t *pa_alsa_open_mixer_for_pcm(pa_hashmap *mixers, snd_pcm_t *pcm, bool probe, uint32_t fallback_index) {
snd_pcm_info_t* info;
snd_pcm_info_alloca(&info);
pa_assert(pcm);
if (snd_pcm_info(pcm, info) >= 0) {
int card_idx;
int card_idx = snd_pcm_info_get_card(info);
if ((card_idx = snd_pcm_info_get_card(info)) >= 0)
if (card_idx < 0)
card_idx = fallback_index;
if (card_idx >= 0)
return pa_alsa_open_mixer(mixers, card_idx, probe);
}