[polypaudio-commits] r631 - in /trunk/src/modules: module-alsa-sink.c module-alsa-source.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Sun Mar 5 12:59:58 PST 2006
Author: ossman
Date: Sun Mar 5 21:59:57 2006
New Revision: 631
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=631&root=polypaudio&view=rev
Log:
Fetch sound card name into sink/source description.
Modified:
trunk/src/modules/module-alsa-sink.c
trunk/src/modules/module-alsa-source.c
Modified: trunk/src/modules/module-alsa-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-alsa-sink.c?rev=631&root=polypaudio&r1=630&r2=631&view=diff
==============================================================================
--- trunk/src/modules/module-alsa-sink.c (original)
+++ trunk/src/modules/module-alsa-sink.c Sun Mar 5 21:59:57 2006
@@ -308,6 +308,7 @@
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))) {
@@ -337,6 +338,12 @@
snd_config_update_free_global();
if ((err = snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0) {
pa_log(__FILE__": Error opening PCM device %s: %s", dev, snd_strerror(err));
+ 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;
}
@@ -375,7 +382,7 @@
}
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 @@
finish:
if (ma)
pa_modargs_free(ma);
+
+ if (pcm_info)
+ snd_pcm_info_free(pcm_info);
return ret;
Modified: trunk/src/modules/module-alsa-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-alsa-source.c?rev=631&root=polypaudio&r1=630&r2=631&view=diff
==============================================================================
--- trunk/src/modules/module-alsa-source.c (original)
+++ trunk/src/modules/module-alsa-source.c Sun Mar 5 21:59:57 2006
@@ -299,6 +299,7 @@
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))) {
@@ -328,6 +329,12 @@
snd_config_update_free_global();
if ((err = snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK)) < 0) {
pa_log(__FILE__": Error opening PCM device %s: %s", dev, snd_strerror(err));
+ 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;
}
@@ -366,7 +373,7 @@
}
}
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 @@
finish:
if (ma)
pa_modargs_free(ma);
+
+ if (pcm_info)
+ snd_pcm_info_free(pcm_info);
return ret;
More information about the pulseaudio-commits
mailing list