static void delete_object_property(struct pa_policy_object *object, const char *property) { pa_proplist *proplist; if (object->ptr != NULL) { if ((proplist = get_object_proplist(object)) != NULL) { pa_proplist_unset(proplist, property); fire_object_property_changed_hook(object); } } }
static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_sink_input) { const char *want; pa_proplist *pl, *parent_pl; if (is_sink_input) { pl = PA_SINK_INPUT(o)->proplist; parent_pl = PA_SINK_INPUT(o)->sink->proplist; } else { pl = PA_SOURCE_OUTPUT(o)->proplist; parent_pl = PA_SOURCE_OUTPUT(o)->source->proplist; } /* If the stream already specifies what it must have, then let it be. */ if (!pa_proplist_gets(pl, PA_PROP_FILTER_HEURISTICS) && pa_proplist_gets(pl, PA_PROP_FILTER_APPLY)) return PA_HOOK_OK; /* On phone sinks, make sure we're not applying echo cancellation */ if (pa_str_in_list_spaces(pa_proplist_gets(parent_pl, PA_PROP_DEVICE_INTENDED_ROLES), "phone")) { const char *apply = pa_proplist_gets(pl, PA_PROP_FILTER_APPLY); if (apply && pa_streq(apply, "echo-cancel")) { pa_proplist_unset(pl, PA_PROP_FILTER_APPLY); pa_proplist_unset(pl, PA_PROP_FILTER_HEURISTICS); } return PA_HOOK_OK; } want = pa_proplist_gets(pl, PA_PROP_FILTER_WANT); if (want) { /* There's a filter that we want, ask module-filter-apply to apply it, and remember that we're managing filter.apply */ pa_proplist_sets(pl, PA_PROP_FILTER_APPLY, want); pa_proplist_sets(pl, PA_PROP_FILTER_HEURISTICS, "1"); } return PA_HOOK_OK; }
int pa_sink_input_ext_set_policy_group(struct pa_sink_input *sinp, const char *group) { int ret; assert(sinp); if (group) ret = pa_proplist_sets(sinp->proplist, PA_PROP_POLICY_GROUP, group); else ret = pa_proplist_unset(sinp->proplist, PA_PROP_POLICY_GROUP); return ret; }
/* Called from main context */ void pa_source_output_set_name(pa_source_output *o, const char *name) { const char *old; pa_assert_ctl_context(); pa_source_output_assert_ref(o); if (!name && !pa_proplist_contains(o->proplist, PA_PROP_MEDIA_NAME)) return; old = pa_proplist_gets(o->proplist, PA_PROP_MEDIA_NAME); if (old && name && !strcmp(old, name)) return; if (name) pa_proplist_sets(o->proplist, PA_PROP_MEDIA_NAME, name); else pa_proplist_unset(o->proplist, PA_PROP_MEDIA_NAME); if (PA_SOURCE_OUTPUT_IS_LINKED(o->state)) { pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PROPLIST_CHANGED], o); pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, o->index); } }