mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
spa: alsa: Read and expose channel count and position from ELD
The next step will be to propagate this to the correct node.
This commit is contained in:
parent
d268b6e104
commit
91e2f184e2
4 changed files with 90 additions and 3 deletions
|
|
@ -2020,14 +2020,24 @@ int pa_alsa_get_hdmi_eld(snd_hctl_elem_t *elem, pa_hdmi_eld *eld) {
|
|||
sad_count = 0;
|
||||
}
|
||||
|
||||
/* Look up speaker presence in Speaker Allocation Data Block */
|
||||
eld->speakers = elddata[7] & 0x7f;
|
||||
|
||||
eld->lpcm_channels = 0;
|
||||
eld->iec958_codecs = 0;
|
||||
|
||||
for (unsigned i = 0; i < sad_count; i++) {
|
||||
uint8_t *sad = &elddata[20 + mnl + 3 * i];
|
||||
uint8_t lpcm_channels;
|
||||
|
||||
/* https://en.wikipedia.org/wiki/Extended_Display_Identification_Data#Audio_Data_Blocks */
|
||||
switch ((sad[0] & 0x78) >> 3) {
|
||||
case 1:
|
||||
eld->iec958_codecs |= 1ULL << SPA_AUDIO_IEC958_CODEC_PCM;
|
||||
/* Lowest 3 bits are channel count - 1 */
|
||||
lpcm_channels = (sad[0] & 0x07) + 1;
|
||||
if (lpcm_channels > eld->lpcm_channels)
|
||||
eld->lpcm_channels = lpcm_channels;
|
||||
break;
|
||||
case 2:
|
||||
eld->iec958_codecs |= 1ULL << SPA_AUDIO_IEC958_CODEC_AC3;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue