mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-11 13:30:02 -05:00
prop: introduce new PA_PROP_DEVICE_INTENDED_ROLES property
This commit is contained in:
parent
12d53826f6
commit
f13bbd576f
7 changed files with 28 additions and 0 deletions
|
|
@ -164,6 +164,7 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
|
|||
|
||||
pa_device_init_description(c->proplist);
|
||||
pa_device_init_icon(c->proplist, TRUE);
|
||||
pa_device_init_intended_roles(c->proplist);
|
||||
|
||||
pa_assert_se(pa_idxset_put(core->cards, c, &c->index) >= 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -177,6 +177,7 @@ pa_sink* pa_sink_new(
|
|||
|
||||
pa_device_init_description(data->proplist);
|
||||
pa_device_init_icon(data->proplist, TRUE);
|
||||
pa_device_init_intended_roles(data->proplist);
|
||||
|
||||
if (pa_hook_fire(&core->hooks[PA_CORE_HOOK_SINK_FIXATE], data) < 0) {
|
||||
pa_xfree(s);
|
||||
|
|
@ -2287,3 +2288,19 @@ pa_bool_t pa_device_init_description(pa_proplist *p) {
|
|||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pa_bool_t pa_device_init_intended_roles(pa_proplist *p) {
|
||||
const char *s;
|
||||
pa_assert(p);
|
||||
|
||||
if (pa_proplist_contains(p, PA_PROP_DEVICE_INTENDED_ROLES))
|
||||
return TRUE;
|
||||
|
||||
if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_FORM_FACTOR)))
|
||||
if (pa_streq(s, "handset") || pa_streq(s, "hands-free")) {
|
||||
pa_proplist_sets(p, PA_PROP_DEVICE_INTENDED_ROLES, "phone");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,6 +241,7 @@ void pa_sink_mute_changed(pa_sink *s, pa_bool_t new_muted);
|
|||
|
||||
pa_bool_t pa_device_init_description(pa_proplist *p);
|
||||
pa_bool_t pa_device_init_icon(pa_proplist *p, pa_bool_t is_sink);
|
||||
pa_bool_t pa_device_init_intended_roles(pa_proplist *p);
|
||||
|
||||
/**** May be called by everyone, from main context */
|
||||
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ pa_source* pa_source_new(
|
|||
|
||||
pa_device_init_description(data->proplist);
|
||||
pa_device_init_icon(data->proplist, FALSE);
|
||||
pa_device_init_intended_roles(data->proplist);
|
||||
|
||||
if (pa_hook_fire(&core->hooks[PA_CORE_HOOK_SOURCE_FIXATE], data) < 0) {
|
||||
pa_xfree(s);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue