mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
add new function pa_alsa_get_driver_name()
This commit is contained in:
parent
1c94cfe29f
commit
4bd654542e
2 changed files with 21 additions and 0 deletions
|
|
@ -31,6 +31,7 @@
|
|||
#include <pulse/sample.h>
|
||||
#include <pulse/xmalloc.h>
|
||||
#include <pulse/timeval.h>
|
||||
#include <pulse/util.h>
|
||||
|
||||
#include <pulsecore/log.h>
|
||||
#include <pulsecore/macro.h>
|
||||
|
|
@ -1477,3 +1478,21 @@ int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas
|
|||
|
||||
return r;
|
||||
}
|
||||
|
||||
char *pa_alsa_get_driver_name(int card) {
|
||||
char *t, *m, *n;
|
||||
|
||||
pa_assert(card >= 0);
|
||||
|
||||
t = pa_sprintf_malloc("/sys/class/sound/card%i/device/driver/module", card);
|
||||
m = pa_readlink(t);
|
||||
pa_xfree(t);
|
||||
|
||||
if (!m)
|
||||
return NULL;
|
||||
|
||||
n = pa_xstrdup(pa_path_get_filename(m));
|
||||
pa_xfree(m);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,4 +129,6 @@ pa_rtpoll_item* pa_alsa_build_pollfd(snd_pcm_t *pcm, pa_rtpoll *rtpoll);
|
|||
snd_pcm_sframes_t pa_alsa_safe_avail_update(snd_pcm_t *pcm, size_t hwbuf_size, const pa_sample_spec *ss);
|
||||
int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames, size_t hwbuf_size, const pa_sample_spec *ss);
|
||||
|
||||
char *pa_alsa_get_driver_name(int card);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue