mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-09-16 06:29:56 +00:00
modules: switch more modules to the new property helpers
This commit is contained in:
parent
c59ede837d
commit
32fb369b66
|
@ -246,8 +246,7 @@ context_check_access(void *data, struct pw_impl_client *client)
|
|||
pw_log_info("client %p: has already access: '%s'", client, str);
|
||||
return;
|
||||
}
|
||||
if ((str = pw_properties_get(props, PW_KEY_SEC_PID)) != NULL)
|
||||
pid = atoi(str);
|
||||
pw_properties_fetch_int32(props, PW_KEY_SEC_PID, &pid);
|
||||
}
|
||||
|
||||
if (pid < 0) {
|
||||
|
|
|
@ -179,11 +179,8 @@ static void *create_object(void *_data,
|
|||
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d",
|
||||
pw_impl_factory_get_info(d->this)->id);
|
||||
|
||||
str = pw_properties_get(properties, PW_KEY_OBJECT_LINGER);
|
||||
linger = str ? pw_properties_parse_bool(str) : false;
|
||||
|
||||
str = pw_properties_get(properties, PW_KEY_OBJECT_REGISTER);
|
||||
do_register = str ? pw_properties_parse_bool(str) : true;
|
||||
linger = pw_properties_get_bool(properties, PW_KEY_OBJECT_LINGER, false);
|
||||
do_register = pw_properties_get_bool(properties, PW_KEY_OBJECT_REGISTER, true);
|
||||
|
||||
client = resource ? pw_resource_get_client(resource): NULL;
|
||||
if (client && !linger) {
|
||||
|
|
|
@ -96,9 +96,7 @@ static void node_port_init(void *data, struct pw_impl_port *port)
|
|||
|
||||
old = pw_impl_port_get_properties(port);
|
||||
|
||||
is_monitor = (str = pw_properties_get(old, PW_KEY_PORT_MONITOR)) != NULL &&
|
||||
pw_properties_parse_bool(str);
|
||||
|
||||
is_monitor = pw_properties_get_bool(old, PW_KEY_PORT_MONITOR, false);
|
||||
if (!is_monitor && direction != n->direction)
|
||||
return;
|
||||
|
||||
|
|
|
@ -1203,7 +1203,6 @@ static struct pw_proxy *node_export(struct pw_core *core, void *object, bool do_
|
|||
struct pw_impl_node *node = object;
|
||||
struct pw_proxy *client_node;
|
||||
struct node_data *data;
|
||||
const char *str;
|
||||
int i;
|
||||
|
||||
user_data_size = SPA_ROUND_UP_N(user_data_size, __alignof__(struct node_data));
|
||||
|
@ -1226,13 +1225,12 @@ static struct pw_proxy *node_export(struct pw_core *core, void *object, bool do_
|
|||
data->client_node = (struct pw_client_node *)client_node;
|
||||
data->remote_id = SPA_ID_INVALID;
|
||||
|
||||
data->allow_mlock = data->context->settings.mem_allow_mlock;
|
||||
if ((str = pw_properties_get(node->properties, "mem.allow-mlock")) != NULL)
|
||||
data->allow_mlock = pw_properties_parse_bool(str);
|
||||
|
||||
data->warn_mlock = data->context->settings.mem_warn_mlock;
|
||||
if ((str = pw_properties_get(node->properties, "mem.warn-mlock")) != NULL)
|
||||
data->warn_mlock = pw_properties_parse_bool(str);
|
||||
data->allow_mlock = pw_properties_get_bool(node->properties, "mem.allow-mlock",
|
||||
data->context->settings.mem_allow_mlock);
|
||||
|
||||
data->warn_mlock = pw_properties_get_bool(node->properties, "mem.warn-mlock",
|
||||
data->context->settings.mem_warn_mlock);
|
||||
|
||||
node->exported = true;
|
||||
|
||||
|
|
|
@ -1343,7 +1343,6 @@ struct pw_impl_client_node0 *pw_impl_client_node0_new(struct pw_resource *resour
|
|||
const struct spa_support *support;
|
||||
uint32_t n_support;
|
||||
const char *name;
|
||||
const char *str;
|
||||
int res;
|
||||
|
||||
impl = calloc(1, sizeof(struct impl));
|
||||
|
@ -1389,8 +1388,7 @@ struct pw_impl_client_node0 *pw_impl_client_node0_new(struct pw_resource *resour
|
|||
goto error_no_node;
|
||||
}
|
||||
|
||||
str = pw_properties_get(properties, "pipewire.client.reuse");
|
||||
impl->client_reuse = str && pw_properties_parse_bool(str);
|
||||
impl->client_reuse = pw_properties_get_bool(properties, "pipewire.client.reuse", false);
|
||||
|
||||
pw_resource_add_listener(this->resource,
|
||||
&impl->resource_listener,
|
||||
|
|
|
@ -795,10 +795,8 @@ static void parse_audio_info(struct pw_properties *props, struct spa_audio_info_
|
|||
|
||||
*info = SPA_AUDIO_INFO_RAW_INIT(
|
||||
.format = SPA_AUDIO_FORMAT_F32P);
|
||||
if ((str = pw_properties_get(props, PW_KEY_AUDIO_RATE)) != NULL)
|
||||
info->rate = atoi(str);
|
||||
if ((str = pw_properties_get(props, PW_KEY_AUDIO_CHANNELS)) != NULL)
|
||||
info->channels = atoi(str);
|
||||
info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, info->rate);
|
||||
info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, info->channels);
|
||||
if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) != NULL)
|
||||
parse_position(info, str, strlen(str));
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
|||
#define PW_LOG_TOPIC_DEFAULT mod_topic
|
||||
|
||||
#define DEFAULT_FORMAT "S16"
|
||||
#define DEFAULT_RATE "48000"
|
||||
#define DEFAULT_RATE 48000
|
||||
#define DEFAULT_CHANNELS "2"
|
||||
#define DEFAULT_POSITION "[ FL FR ]"
|
||||
|
||||
|
@ -65,7 +65,7 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
|||
"[ node.name=<name of the nodes> ] " \
|
||||
"[ node.description=<description of the nodes> ] " \
|
||||
"[ audio.format=<format, default:"DEFAULT_FORMAT"> ] " \
|
||||
"[ audio.rate=<sample rate, default:"DEFAULT_RATE"> ] " \
|
||||
"[ audio.rate=<sample rate, default: 48000> ] " \
|
||||
"[ audio.channels=<number of channels, default:"DEFAULT_CHANNELS"> ] " \
|
||||
"[ audio.position=<channel map, default:"DEFAULT_POSITION"> ] " \
|
||||
"[ stream.props=<properties> ] "
|
||||
|
@ -331,9 +331,7 @@ static int parse_audio_info(struct impl *impl)
|
|||
pw_log_error("unsupported format '%s'", str);
|
||||
return -EINVAL;
|
||||
}
|
||||
if ((str = pw_properties_get(props, PW_KEY_AUDIO_RATE)) == NULL)
|
||||
str = DEFAULT_RATE;
|
||||
info->rate = atoi(str);
|
||||
info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, DEFAULT_RATE);
|
||||
if (info->rate == 0) {
|
||||
pw_log_error("invalid rate '%s'", str);
|
||||
return -EINVAL;
|
||||
|
|
|
@ -57,7 +57,7 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
|||
#define PW_LOG_TOPIC_DEFAULT mod_topic
|
||||
|
||||
#define DEFAULT_FORMAT "S16"
|
||||
#define DEFAULT_RATE "48000"
|
||||
#define DEFAULT_RATE 48000
|
||||
#define DEFAULT_CHANNELS "2"
|
||||
#define DEFAULT_POSITION "[ FL FR ]"
|
||||
|
||||
|
@ -65,7 +65,7 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
|||
"[ node.name=<name of the nodes> ] " \
|
||||
"[ node.description=<description of the nodes> ] " \
|
||||
"[ audio.format=<format, default:"DEFAULT_FORMAT"> ] " \
|
||||
"[ audio.rate=<sample rate, default:"DEFAULT_RATE"> ] " \
|
||||
"[ audio.rate=<sample rate, default: 48000> ] " \
|
||||
"[ audio.channels=<number of channels, default:"DEFAULT_CHANNELS"> ] " \
|
||||
"[ audio.position=<channel map, default:"DEFAULT_POSITION"> ] " \
|
||||
"[ stream.props=<properties> ] "
|
||||
|
@ -351,9 +351,7 @@ static int parse_audio_info(struct impl *impl)
|
|||
pw_log_error("unsupported format '%s'", str);
|
||||
return -EINVAL;
|
||||
}
|
||||
if ((str = pw_properties_get(props, PW_KEY_AUDIO_RATE)) == NULL)
|
||||
str = DEFAULT_RATE;
|
||||
info->rate = atoi(str);
|
||||
info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, DEFAULT_RATE);
|
||||
if (info->rate == 0) {
|
||||
pw_log_error("invalid rate '%s'", str);
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Reference in a new issue