summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/module-alsa-sink.c12
-rw-r--r--src/modules/module-alsa-source.c12
2 files changed, 22 insertions, 2 deletions
diff --git a/src/modules/module-alsa-sink.c b/src/modules/module-alsa-sink.c
index 0053acd2..6ace7aff 100644
--- a/src/modules/module-alsa-sink.c
+++ b/src/modules/module-alsa-sink.c
@@ -308,6 +308,7 @@ int pa__init(pa_core *c, pa_module*m) {
uint32_t periods, fragsize;
snd_pcm_uframes_t period_size;
size_t frame_size;
+ snd_pcm_info_t *pcm_info = NULL;
int err;
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
@@ -340,6 +341,12 @@ int pa__init(pa_core *c, pa_module*m) {
goto fail;
}
+ if ((err = snd_pcm_info_malloc(&pcm_info)) < 0 ||
+ (err = snd_pcm_info(u->pcm_handle, pcm_info)) < 0) {
+ pa_log(__FILE__": Error fetching PCM info: %s", snd_strerror(err));
+ goto fail;
+ }
+
if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &periods, &period_size)) < 0) {
pa_log(__FILE__": Failed to set hardware parameters: %s", snd_strerror(err));
goto fail;
@@ -375,7 +382,7 @@ int pa__init(pa_core *c, pa_module*m) {
}
u->sink->userdata = u;
pa_sink_set_owner(u->sink, m);
- u->sink->description = pa_sprintf_malloc("Advanced Linux Sound Architecture PCM on '%s'", dev);
+ u->sink->description = pa_sprintf_malloc("Advanced Linux Sound Architecture PCM on '%s' (%s)", dev, snd_pcm_info_get_name(pcm_info));
u->pcm_fdl = pa_alsa_fdlist_new();
assert(u->pcm_fdl);
@@ -419,6 +426,9 @@ int pa__init(pa_core *c, pa_module*m) {
finish:
if (ma)
pa_modargs_free(ma);
+
+ if (pcm_info)
+ snd_pcm_info_free(pcm_info);
return ret;
diff --git a/src/modules/module-alsa-source.c b/src/modules/module-alsa-source.c
index 5a6dc144..3343e0b6 100644
--- a/src/modules/module-alsa-source.c
+++ b/src/modules/module-alsa-source.c
@@ -299,6 +299,7 @@ int pa__init(pa_core *c, pa_module*m) {
unsigned periods, fragsize;
snd_pcm_uframes_t period_size;
size_t frame_size;
+ snd_pcm_info_t *pcm_info = NULL;
int err;
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
@@ -331,6 +332,12 @@ int pa__init(pa_core *c, pa_module*m) {
goto fail;
}
+ if ((err = snd_pcm_info_malloc(&pcm_info)) < 0 ||
+ (err = snd_pcm_info(u->pcm_handle, pcm_info)) < 0) {
+ pa_log(__FILE__": Error fetching PCM info: %s", snd_strerror(err));
+ goto fail;
+ }
+
if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &periods, &period_size)) < 0) {
pa_log(__FILE__": Failed to set hardware parameters: %s", snd_strerror(err));
goto fail;
@@ -366,7 +373,7 @@ int pa__init(pa_core *c, pa_module*m) {
}
}
pa_source_set_owner(u->source, m);
- u->source->description = pa_sprintf_malloc("Advanced Linux Sound Architecture PCM on '%s'", dev);
+ u->source->description = pa_sprintf_malloc("Advanced Linux Sound Architecture PCM on '%s' (%s)", dev, snd_pcm_info_get_name(pcm_info));
u->pcm_fdl = pa_alsa_fdlist_new();
assert(u->pcm_fdl);
@@ -407,6 +414,9 @@ int pa__init(pa_core *c, pa_module*m) {
finish:
if (ma)
pa_modargs_free(ma);
+
+ if (pcm_info)
+ snd_pcm_info_free(pcm_info);
return ret;