conf: support property rules

Add pw_conf_section_update_props_rules() that will not only update the
properties of a section but wil also apply rules in section.rules and
match against the context properties.

Use this by default when using pw_context_conf_update_props().

Add a new method to get a string name of the VM type. Place the
cpu.vm.name in the context properties.

This makes it possible to deprecate the vm.overrides with something more
flexible based on rules. Update the conf files and docs to refect this.
This commit is contained in:
Wim Taymans 2024-03-15 11:55:18 +01:00
parent afd0affd97
commit 7e9e261fa6
12 changed files with 178 additions and 41 deletions

View file

@ -5502,6 +5502,8 @@ struct pw_protocol_pulse *pw_protocol_pulse_new(struct pw_context *context,
pw_context_conf_update_props(context, "pulse.properties", props);
if ((str = pw_properties_get(props, "vm.overrides")) != NULL) {
pw_log_warn("vm.overrides in pulse.properties are deprecated, "
"use pulse.properties.rules instead");
if (cpu != NULL && spa_cpu_get_vm_type(cpu) != SPA_CPU_VM_NONE)
pw_properties_update_string(props, str, strlen(str));
pw_properties_set(props, "vm.overrides", NULL);