mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-12 13:30:10 -05:00
alsa: Use card description in default sink/source prefix when available
When given an explicit device.description in card_properties, prefer this information over other default prefixes (e.g. 'Built-in Audio') when constructing sink/source descriptions. For example, if I manually configure the card description to be "FooBar", I then expect that the sinks and created by the card also have "FooBar" in their description instead of generic "Built-in Audio".
This commit is contained in:
parent
efec98280f
commit
fe6e41d7d2
9 changed files with 19 additions and 14 deletions
|
|
@ -201,7 +201,7 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
|
|||
c->userdata = NULL;
|
||||
c->set_profile = NULL;
|
||||
|
||||
pa_device_init_description(c->proplist);
|
||||
pa_device_init_description(c->proplist, c);
|
||||
pa_device_init_icon(c->proplist, true);
|
||||
pa_device_init_intended_roles(c->proplist);
|
||||
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ pa_sink* pa_sink_new(
|
|||
if (data->card)
|
||||
pa_proplist_update(data->proplist, PA_UPDATE_MERGE, data->card->proplist);
|
||||
|
||||
pa_device_init_description(data->proplist);
|
||||
pa_device_init_description(data->proplist, data->card);
|
||||
pa_device_init_icon(data->proplist, true);
|
||||
pa_device_init_intended_roles(data->proplist);
|
||||
|
||||
|
|
@ -3441,16 +3441,21 @@ bool pa_device_init_icon(pa_proplist *p, bool is_sink) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool pa_device_init_description(pa_proplist *p) {
|
||||
bool pa_device_init_description(pa_proplist *p, pa_card *card) {
|
||||
const char *s, *d = NULL, *k;
|
||||
pa_assert(p);
|
||||
|
||||
if (pa_proplist_contains(p, PA_PROP_DEVICE_DESCRIPTION))
|
||||
return true;
|
||||
|
||||
if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_FORM_FACTOR)))
|
||||
if (pa_streq(s, "internal"))
|
||||
d = _("Built-in Audio");
|
||||
if (card)
|
||||
if ((s = pa_proplist_gets(card->proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
d = s;
|
||||
|
||||
if (!d)
|
||||
if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_FORM_FACTOR)))
|
||||
if (pa_streq(s, "internal"))
|
||||
d = _("Built-in Audio");
|
||||
|
||||
if (!d)
|
||||
if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_CLASS)))
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ void pa_sink_mute_changed(pa_sink *s, bool new_muted);
|
|||
|
||||
void pa_sink_update_flags(pa_sink *s, pa_sink_flags_t mask, pa_sink_flags_t value);
|
||||
|
||||
bool pa_device_init_description(pa_proplist *p);
|
||||
bool pa_device_init_description(pa_proplist *p, pa_card *card);
|
||||
bool pa_device_init_icon(pa_proplist *p, bool is_sink);
|
||||
bool pa_device_init_intended_roles(pa_proplist *p);
|
||||
unsigned pa_device_init_priority(pa_proplist *p);
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ pa_source* pa_source_new(
|
|||
if (data->card)
|
||||
pa_proplist_update(data->proplist, PA_UPDATE_MERGE, data->card->proplist);
|
||||
|
||||
pa_device_init_description(data->proplist);
|
||||
pa_device_init_description(data->proplist, data->card);
|
||||
pa_device_init_icon(data->proplist, false);
|
||||
pa_device_init_intended_roles(data->proplist);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue