diff options
Diffstat (limited to 'src/modules/alsa/alsa-util.c')
-rw-r--r-- | src/modules/alsa/alsa-util.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c index 6740c069..7d833ff7 100644 --- a/src/modules/alsa/alsa-util.c +++ b/src/modules/alsa/alsa-util.c @@ -47,6 +47,10 @@ #include "hal-util.h" #endif +#ifdef HAVE_UDEV +#include "udev-util.h" +#endif + struct pa_alsa_fdlist { unsigned num_fds; struct pollfd *fds; @@ -1362,6 +1366,26 @@ void pa_alsa_redirect_errors_dec(void) { snd_lib_error_set_handler(NULL); } +pa_bool_t pa_alsa_init_description(pa_proplist *p) { + const char *s; + pa_assert(p); + + if (pa_device_init_description(p)) + return TRUE; + + if ((s = pa_proplist_gets(p, "alsa.card_name"))) { + pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, s); + return TRUE; + } + + if ((s = pa_proplist_gets(p, "alsa.name"))) { + pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, s); + return TRUE; + } + + return FALSE; +} + void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) { char *cn, *lcn, *dn; @@ -1385,6 +1409,10 @@ void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) { pa_xfree(dn); } +#ifdef HAVE_UDEV + pa_udev_get_info(c, p, card); +#endif + #ifdef HAVE_HAL pa_hal_get_info(c, p, card); #endif @@ -1411,7 +1439,7 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t * snd_pcm_class_t class; snd_pcm_subclass_t subclass; - const char *n, *id, *sdn, *cn = NULL; + const char *n, *id, *sdn; int card; pa_assert(p); @@ -1426,6 +1454,7 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t * if (alsa_class_table[class]) pa_proplist_sets(p, "alsa.class", alsa_class_table[class]); } + subclass = snd_pcm_info_get_subclass(pcm_info); if (subclass <= SND_PCM_SUBCLASS_LAST) if (alsa_subclass_table[subclass]) @@ -1443,17 +1472,8 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t * pa_proplist_setf(p, "alsa.device", "%u", snd_pcm_info_get_device(pcm_info)); - if ((card = snd_pcm_info_get_card(pcm_info)) >= 0) { + if ((card = snd_pcm_info_get_card(pcm_info)) >= 0) pa_alsa_init_proplist_card(c, p, card); - cn = pa_proplist_gets(p, "alsa.card_name"); - } - - if (cn && n && !strstr(cn, n) && !strstr(n, cn)) - pa_proplist_setf(p, PA_PROP_DEVICE_DESCRIPTION, "%s, %s", cn, n); - else if (cn && (!n || strstr(cn, n))) - pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, cn); - else if (n) - pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, n); } void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm) { |