mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-14 06:59:53 -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
|
|
@ -1622,6 +1622,8 @@ static int add_sink(struct userdata *u) {
|
|||
data.module = u->module;
|
||||
pa_sink_new_data_set_sample_spec(&data, &u->sample_spec);
|
||||
pa_proplist_sets(data.proplist, "bluetooth.protocol", u->profile == PROFILE_A2DP ? "a2dp" : "sco");
|
||||
if (u->profile == PROFILE_HSP)
|
||||
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone");
|
||||
data.card = u->card;
|
||||
data.name = get_name("sink", u->modargs, u->address, &b);
|
||||
data.namereg_fail = b;
|
||||
|
|
@ -1680,6 +1682,8 @@ static int add_source(struct userdata *u) {
|
|||
data.module = u->module;
|
||||
pa_source_new_data_set_sample_spec(&data, &u->sample_spec);
|
||||
pa_proplist_sets(data.proplist, "bluetooth.protocol", u->profile == PROFILE_A2DP ? "a2dp" : "hsp");
|
||||
if (u->profile == PROFILE_HSP)
|
||||
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone");
|
||||
data.card = u->card;
|
||||
data.name = get_name("source", u->modargs, u->address, &b);
|
||||
data.namereg_fail = b;
|
||||
|
|
|
|||
|
|
@ -583,6 +583,7 @@ int pa__init(pa_module*m) {
|
|||
pa_sink_new_data_set_name(&data, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME));
|
||||
pa_sink_new_data_set_sample_spec(&data, &ss);
|
||||
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, server);
|
||||
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "music");
|
||||
if ((desc = pa_modargs_get_value(ma, "description", NULL)))
|
||||
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_DESCRIPTION, desc);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -206,6 +206,9 @@ PA_C_DECL_BEGIN
|
|||
/** For devices: profile identifier for the profile this devices is in. e.g. "analog-stereo", "analog-surround-40", "iec958-stereo", ...*/
|
||||
#define PA_PROP_DEVICE_PROFILE_NAME "device.profile.name"
|
||||
|
||||
/** For devices: intended use. A comma seperated list of roles (see PA_PROP_MEDIA_ROLE) this device is particularly well suited for, due to latency, quality or form factor. \since 0.9.16 */
|
||||
#define PA_PROP_DEVICE_INTENDED_ROLES "device.intended_roles"
|
||||
|
||||
/** For devices: human readable one-line description of the profile this device is in. e.g. "Analog Stereo", ... */
|
||||
#define PA_PROP_DEVICE_PROFILE_DESCRIPTION "device.profile.description"
|
||||
|
||||
|
|
|
|||
|
|
@ -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