pipewire: switch to new property helpers

This commit is contained in:
Peter Hutterer 2021-10-12 13:26:12 +10:00 committed by Wim Taymans
parent 56bc3508c4
commit c59ede837d
5 changed files with 12 additions and 32 deletions

View file

@ -253,7 +253,6 @@ int pw_buffers_negotiate(struct pw_context *context, uint32_t flags,
uint32_t types, *data_types; uint32_t types, *data_types;
struct port output = { outnode, SPA_DIRECTION_OUTPUT, out_port_id }; struct port output = { outnode, SPA_DIRECTION_OUTPUT, out_port_id };
struct port input = { innode, SPA_DIRECTION_INPUT, in_port_id }; struct port input = { innode, SPA_DIRECTION_INPUT, in_port_id };
const char *str;
int res; int res;
res = param_filter(result, &input, &output, SPA_PARAM_Buffers, &b); res = param_filter(result, &input, &output, SPA_PARAM_Buffers, &b);
@ -281,10 +280,7 @@ int pw_buffers_negotiate(struct pw_context *context, uint32_t flags,
max_buffers = context->settings.link_max_buffers; max_buffers = context->settings.link_max_buffers;
if ((str = pw_properties_get(context->properties, PW_KEY_CPU_MAX_ALIGN)) != NULL) align = pw_properties_get_uint32(context->properties, PW_KEY_CPU_MAX_ALIGN, MAX_ALIGN);
align = pw_properties_parse_int(str);
else
align = MAX_ALIGN;
minsize = stride = 0; minsize = stride = 0;
types = SPA_ID_INVALID; /* bitmask of allowed types */ types = SPA_ID_INVALID; /* bitmask of allowed types */

View file

@ -408,8 +408,7 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop,
(str = pw_properties_get(properties, "log.level")) != NULL) (str = pw_properties_get(properties, "log.level")) != NULL)
pw_log_set_level(atoi(str)); pw_log_set_level(atoi(str));
if ((str = pw_properties_get(properties, "mem.mlock-all")) != NULL && if (pw_properties_get_bool(properties, "mem.mlock-all", false)) {
pw_properties_parse_bool(str)) {
if (mlockall(MCL_CURRENT | MCL_FUTURE) < 0) if (mlockall(MCL_CURRENT | MCL_FUTURE) < 0)
pw_log_warn("%p: could not mlockall; %m", impl); pw_log_warn("%p: could not mlockall; %m", impl);
else else

View file

@ -1455,7 +1455,6 @@ pw_filter_connect(struct pw_filter *filter,
uint32_t n_params) uint32_t n_params)
{ {
struct filter *impl = SPA_CONTAINER_OF(filter, struct filter, this); struct filter *impl = SPA_CONTAINER_OF(filter, struct filter, this);
const char *str;
int res; int res;
uint32_t i; uint32_t i;
struct spa_dict_item items[1]; struct spa_dict_item items[1];
@ -1465,8 +1464,7 @@ pw_filter_connect(struct pw_filter *filter,
impl->process_rt = SPA_FLAG_IS_SET(flags, PW_FILTER_FLAG_RT_PROCESS); impl->process_rt = SPA_FLAG_IS_SET(flags, PW_FILTER_FLAG_RT_PROCESS);
if ((str = pw_properties_get(filter->properties, "mem.warn-mlock")) != NULL) impl->warn_mlock = pw_properties_get_bool(filter->properties, "mem.warn-mlock", impl->warn_mlock);
impl->warn_mlock = pw_properties_parse_bool(str);
impl->impl_node.iface = SPA_INTERFACE_INIT( impl->impl_node.iface = SPA_INTERFACE_INIT(
SPA_TYPE_INTERFACE_Node, SPA_TYPE_INTERFACE_Node,

View file

@ -1166,7 +1166,6 @@ struct pw_impl_link *pw_context_create_link(struct pw_context *context,
struct impl *impl; struct impl *impl;
struct pw_impl_link *this; struct pw_impl_link *this;
struct pw_impl_node *input_node, *output_node; struct pw_impl_node *input_node, *output_node;
const char *str;
int res; int res;
if (output == input) if (output == input)
@ -1218,8 +1217,7 @@ struct pw_impl_link *pw_context_create_link(struct pw_context *context,
this->input = input; this->input = input;
/* passive means that this link does not make the nodes active */ /* passive means that this link does not make the nodes active */
if ((str = pw_properties_get(properties, PW_KEY_LINK_PASSIVE)) != NULL) this->passive = pw_properties_get_bool(properties, PW_KEY_LINK_PASSIVE, false);
this->passive = pw_properties_parse_bool(str);
spa_hook_list_init(&this->listener_list); spa_hook_list_init(&this->listener_list);

View file

@ -837,17 +837,10 @@ static void check_properties(struct pw_impl_node *node)
pw_log_debug("%p: name '%s'", node, node->name); pw_log_debug("%p: name '%s'", node, node->name);
} }
str = pw_properties_get(node->properties, PW_KEY_NODE_PAUSE_ON_IDLE); impl->pause_on_idle = pw_properties_get_bool(node->properties, PW_KEY_NODE_PAUSE_ON_IDLE, true);
impl->pause_on_idle = str ? pw_properties_parse_bool(str) : true; impl->cache_params = pw_properties_get_bool(node->properties, PW_KEY_NODE_CACHE_PARAMS, true);
node->transport_sync = pw_properties_get_bool(node->properties, "node.transport.sync", false);
str = pw_properties_get(node->properties, PW_KEY_NODE_CACHE_PARAMS); driver = pw_properties_get_bool(node->properties, PW_KEY_NODE_DRIVER, false);
impl->cache_params = str ? pw_properties_parse_bool(str) : true;
str = pw_properties_get(node->properties, "node.transport.sync");
node->transport_sync = str ? pw_properties_parse_bool(str) : false;
str = pw_properties_get(node->properties, PW_KEY_NODE_DRIVER);
driver = str ? pw_properties_parse_bool(str) : false;
if (node->driver != driver) { if (node->driver != driver) {
pw_log_debug("%p: driver %d -> %d", node, node->driver, driver); pw_log_debug("%p: driver %d -> %d", node, node->driver, driver);
@ -872,11 +865,9 @@ static void check_properties(struct pw_impl_node *node)
recalc_reason = "group changed"; recalc_reason = "group changed";
} }
str = pw_properties_get(node->properties, PW_KEY_NODE_WANT_DRIVER);
node->want_driver = str ? pw_properties_parse_bool(str) : false;
str = pw_properties_get(node->properties, PW_KEY_NODE_ALWAYS_PROCESS); node->want_driver = pw_properties_get_bool(node->properties, PW_KEY_NODE_WANT_DRIVER, false);
node->always_process = str ? pw_properties_parse_bool(str) : false; node->always_process = pw_properties_get_bool(node->properties, PW_KEY_NODE_ALWAYS_PROCESS, false);
if (node->always_process) if (node->always_process)
node->want_driver = true; node->want_driver = true;
@ -903,8 +894,7 @@ static void check_properties(struct pw_impl_node *node)
} }
} }
} }
str = pw_properties_get(node->properties, PW_KEY_NODE_LOCK_QUANTUM); node->lock_quantum = pw_properties_get_bool(node->properties, PW_KEY_NODE_LOCK_QUANTUM, false);
node->lock_quantum = str ? pw_properties_parse_bool(str) : false;
if ((str = pw_properties_get(node->properties, PW_KEY_NODE_RATE))) { if ((str = pw_properties_get(node->properties, PW_KEY_NODE_RATE))) {
if (sscanf(str, "%u/%u", &frac.num, &frac.denom) == 2 && frac.denom != 0) { if (sscanf(str, "%u/%u", &frac.num, &frac.denom) == 2 && frac.denom != 0) {
@ -917,8 +907,7 @@ static void check_properties(struct pw_impl_node *node)
} }
} }
} }
str = pw_properties_get(node->properties, PW_KEY_NODE_LOCK_RATE); node->lock_rate = pw_properties_get_bool(node->properties, PW_KEY_NODE_LOCK_RATE, false);
node->lock_rate = str ? pw_properties_parse_bool(str) : false;
pw_log_debug("%p: driver:%d recalc:%s active:%d", node, node->driver, pw_log_debug("%p: driver:%d recalc:%s active:%d", node, node->driver,
recalc_reason, node->active); recalc_reason, node->active);