control: decode HDMI device name from ELD

The HDMI drivers set an uniform PCM names. Use ELD (EDID) to obtain
the HDMI device name and send this string to applications for a better
user experience.

Example (aplay -l):

  card 1: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
    Subdevices: 1/1

  vs improved:

  card 1: PCH [HDA Intel PCH], device 8: HDMI 2 [Philips 272P4]
    Subdevices: 1/1

Fixes: https://github.com/alsa-project/alsa-lib/issues/209
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2022-05-05 14:28:41 +02:00
parent 9c0c757b85
commit 859448f010
5 changed files with 111 additions and 1 deletions

View file

@ -124,3 +124,12 @@ int __snd_ctl_add_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
int __snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst,
const char *str,
const char **ret_ptr);
static inline int
__snd_pcm_info_eld_fixup_check(snd_pcm_info_t *info)
{
return info->stream == SND_PCM_STREAM_PLAYBACK &&
strncmp((char *)info->name, "HDMI ", 5) == 0;
}
int __snd_pcm_info_eld_fixup(snd_pcm_info_t *info);