diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/alsa/alsa-util.c | 15 | ||||
-rw-r--r-- | src/modules/alsa/alsa-util.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c index 016e52ab..274fef45 100644 --- a/src/modules/alsa/alsa-util.c +++ b/src/modules/alsa/alsa-util.c @@ -1637,3 +1637,18 @@ char *pa_alsa_get_driver_name(int card) { return n; } + +char *pa_alsa_get_driver_name_by_pcm(snd_pcm_t *pcm) { + int card; + + snd_pcm_info_t* info; + snd_pcm_info_alloca(&info); + + if (snd_pcm_info(pcm, info) < 0) + return NULL; + + if ((card = snd_pcm_info_get_card(info)) < 0) + return NULL; + + return pa_alsa_get_driver_name(card); +} diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h index 2d0f407e..92f67977 100644 --- a/src/modules/alsa/alsa-util.h +++ b/src/modules/alsa/alsa-util.h @@ -133,4 +133,6 @@ int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas char *pa_alsa_get_driver_name(int card); +char *pa_alsa_get_driver_name_by_pcm(snd_pcm_t *pcm); + #endif |