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))) {
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;
}
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);
finish:
if (ma)
pa_modargs_free(ma);
+
+ if (pcm_info)
+ snd_pcm_info_free(pcm_info);
return ret;
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))) {
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;
}
}
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);
finish:
if (ma)
pa_modargs_free(ma);
+
+ if (pcm_info)
+ snd_pcm_info_free(pcm_info);
return ret;