mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
Fetch sound card name into sink/source description.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@631 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
06eaebf0b4
commit
53c266f663
2 changed files with 22 additions and 2 deletions
|
|
@ -308,6 +308,7 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
uint32_t periods, fragsize;
|
uint32_t periods, fragsize;
|
||||||
snd_pcm_uframes_t period_size;
|
snd_pcm_uframes_t period_size;
|
||||||
size_t frame_size;
|
size_t frame_size;
|
||||||
|
snd_pcm_info_t *pcm_info = NULL;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
|
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
|
||||||
|
|
@ -340,6 +341,12 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
goto fail;
|
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) {
|
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));
|
pa_log(__FILE__": Failed to set hardware parameters: %s", snd_strerror(err));
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
@ -375,7 +382,7 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
}
|
}
|
||||||
u->sink->userdata = u;
|
u->sink->userdata = u;
|
||||||
pa_sink_set_owner(u->sink, m);
|
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();
|
u->pcm_fdl = pa_alsa_fdlist_new();
|
||||||
assert(u->pcm_fdl);
|
assert(u->pcm_fdl);
|
||||||
|
|
@ -420,6 +427,9 @@ finish:
|
||||||
if (ma)
|
if (ma)
|
||||||
pa_modargs_free(ma);
|
pa_modargs_free(ma);
|
||||||
|
|
||||||
|
if (pcm_info)
|
||||||
|
snd_pcm_info_free(pcm_info);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
|
||||||
|
|
@ -299,6 +299,7 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
unsigned periods, fragsize;
|
unsigned periods, fragsize;
|
||||||
snd_pcm_uframes_t period_size;
|
snd_pcm_uframes_t period_size;
|
||||||
size_t frame_size;
|
size_t frame_size;
|
||||||
|
snd_pcm_info_t *pcm_info = NULL;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
|
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
|
||||||
|
|
@ -331,6 +332,12 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
goto fail;
|
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) {
|
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));
|
pa_log(__FILE__": Failed to set hardware parameters: %s", snd_strerror(err));
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
@ -366,7 +373,7 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pa_source_set_owner(u->source, 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();
|
u->pcm_fdl = pa_alsa_fdlist_new();
|
||||||
assert(u->pcm_fdl);
|
assert(u->pcm_fdl);
|
||||||
|
|
@ -408,6 +415,9 @@ finish:
|
||||||
if (ma)
|
if (ma)
|
||||||
pa_modargs_free(ma);
|
pa_modargs_free(ma);
|
||||||
|
|
||||||
|
if (pcm_info)
|
||||||
|
snd_pcm_info_free(pcm_info);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue