mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-15 08:56:38 -05:00
modules: switch more modules to the new property helpers
This commit is contained in:
parent
c59ede837d
commit
32fb369b66
8 changed files with 18 additions and 34 deletions
|
|
@ -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);
|
pw_log_info("client %p: has already access: '%s'", client, str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((str = pw_properties_get(props, PW_KEY_SEC_PID)) != NULL)
|
pw_properties_fetch_int32(props, PW_KEY_SEC_PID, &pid);
|
||||||
pid = atoi(str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
|
|
|
||||||
|
|
@ -179,11 +179,8 @@ static void *create_object(void *_data,
|
||||||
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d",
|
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d",
|
||||||
pw_impl_factory_get_info(d->this)->id);
|
pw_impl_factory_get_info(d->this)->id);
|
||||||
|
|
||||||
str = pw_properties_get(properties, PW_KEY_OBJECT_LINGER);
|
linger = pw_properties_get_bool(properties, PW_KEY_OBJECT_LINGER, false);
|
||||||
linger = str ? pw_properties_parse_bool(str) : false;
|
do_register = pw_properties_get_bool(properties, PW_KEY_OBJECT_REGISTER, true);
|
||||||
|
|
||||||
str = pw_properties_get(properties, PW_KEY_OBJECT_REGISTER);
|
|
||||||
do_register = str ? pw_properties_parse_bool(str) : true;
|
|
||||||
|
|
||||||
client = resource ? pw_resource_get_client(resource): NULL;
|
client = resource ? pw_resource_get_client(resource): NULL;
|
||||||
if (client && !linger) {
|
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);
|
old = pw_impl_port_get_properties(port);
|
||||||
|
|
||||||
is_monitor = (str = pw_properties_get(old, PW_KEY_PORT_MONITOR)) != NULL &&
|
is_monitor = pw_properties_get_bool(old, PW_KEY_PORT_MONITOR, false);
|
||||||
pw_properties_parse_bool(str);
|
|
||||||
|
|
||||||
if (!is_monitor && direction != n->direction)
|
if (!is_monitor && direction != n->direction)
|
||||||
return;
|
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_impl_node *node = object;
|
||||||
struct pw_proxy *client_node;
|
struct pw_proxy *client_node;
|
||||||
struct node_data *data;
|
struct node_data *data;
|
||||||
const char *str;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
user_data_size = SPA_ROUND_UP_N(user_data_size, __alignof__(struct node_data));
|
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->client_node = (struct pw_client_node *)client_node;
|
||||||
data->remote_id = SPA_ID_INVALID;
|
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;
|
data->allow_mlock = pw_properties_get_bool(node->properties, "mem.allow-mlock",
|
||||||
if ((str = pw_properties_get(node->properties, "mem.warn-mlock")) != NULL)
|
data->context->settings.mem_allow_mlock);
|
||||||
data->warn_mlock = pw_properties_parse_bool(str);
|
|
||||||
|
data->warn_mlock = pw_properties_get_bool(node->properties, "mem.warn-mlock",
|
||||||
|
data->context->settings.mem_warn_mlock);
|
||||||
|
|
||||||
node->exported = true;
|
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;
|
const struct spa_support *support;
|
||||||
uint32_t n_support;
|
uint32_t n_support;
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *str;
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
impl = calloc(1, sizeof(struct impl));
|
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;
|
goto error_no_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = pw_properties_get(properties, "pipewire.client.reuse");
|
impl->client_reuse = pw_properties_get_bool(properties, "pipewire.client.reuse", false);
|
||||||
impl->client_reuse = str && pw_properties_parse_bool(str);
|
|
||||||
|
|
||||||
pw_resource_add_listener(this->resource,
|
pw_resource_add_listener(this->resource,
|
||||||
&impl->resource_listener,
|
&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(
|
*info = SPA_AUDIO_INFO_RAW_INIT(
|
||||||
.format = SPA_AUDIO_FORMAT_F32P);
|
.format = SPA_AUDIO_FORMAT_F32P);
|
||||||
if ((str = pw_properties_get(props, PW_KEY_AUDIO_RATE)) != NULL)
|
info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, info->rate);
|
||||||
info->rate = atoi(str);
|
info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, info->channels);
|
||||||
if ((str = pw_properties_get(props, PW_KEY_AUDIO_CHANNELS)) != NULL)
|
|
||||||
info->channels = atoi(str);
|
|
||||||
if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) != NULL)
|
if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) != NULL)
|
||||||
parse_position(info, str, strlen(str));
|
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 PW_LOG_TOPIC_DEFAULT mod_topic
|
||||||
|
|
||||||
#define DEFAULT_FORMAT "S16"
|
#define DEFAULT_FORMAT "S16"
|
||||||
#define DEFAULT_RATE "48000"
|
#define DEFAULT_RATE 48000
|
||||||
#define DEFAULT_CHANNELS "2"
|
#define DEFAULT_CHANNELS "2"
|
||||||
#define DEFAULT_POSITION "[ FL FR ]"
|
#define DEFAULT_POSITION "[ FL FR ]"
|
||||||
|
|
||||||
|
|
@ -65,7 +65,7 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
||||||
"[ node.name=<name of the nodes> ] " \
|
"[ node.name=<name of the nodes> ] " \
|
||||||
"[ node.description=<description of the nodes> ] " \
|
"[ node.description=<description of the nodes> ] " \
|
||||||
"[ audio.format=<format, default:"DEFAULT_FORMAT"> ] " \
|
"[ 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.channels=<number of channels, default:"DEFAULT_CHANNELS"> ] " \
|
||||||
"[ audio.position=<channel map, default:"DEFAULT_POSITION"> ] " \
|
"[ audio.position=<channel map, default:"DEFAULT_POSITION"> ] " \
|
||||||
"[ stream.props=<properties> ] "
|
"[ stream.props=<properties> ] "
|
||||||
|
|
@ -331,9 +331,7 @@ static int parse_audio_info(struct impl *impl)
|
||||||
pw_log_error("unsupported format '%s'", str);
|
pw_log_error("unsupported format '%s'", str);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if ((str = pw_properties_get(props, PW_KEY_AUDIO_RATE)) == NULL)
|
info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, DEFAULT_RATE);
|
||||||
str = DEFAULT_RATE;
|
|
||||||
info->rate = atoi(str);
|
|
||||||
if (info->rate == 0) {
|
if (info->rate == 0) {
|
||||||
pw_log_error("invalid rate '%s'", str);
|
pw_log_error("invalid rate '%s'", str);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
||||||
#define PW_LOG_TOPIC_DEFAULT mod_topic
|
#define PW_LOG_TOPIC_DEFAULT mod_topic
|
||||||
|
|
||||||
#define DEFAULT_FORMAT "S16"
|
#define DEFAULT_FORMAT "S16"
|
||||||
#define DEFAULT_RATE "48000"
|
#define DEFAULT_RATE 48000
|
||||||
#define DEFAULT_CHANNELS "2"
|
#define DEFAULT_CHANNELS "2"
|
||||||
#define DEFAULT_POSITION "[ FL FR ]"
|
#define DEFAULT_POSITION "[ FL FR ]"
|
||||||
|
|
||||||
|
|
@ -65,7 +65,7 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
||||||
"[ node.name=<name of the nodes> ] " \
|
"[ node.name=<name of the nodes> ] " \
|
||||||
"[ node.description=<description of the nodes> ] " \
|
"[ node.description=<description of the nodes> ] " \
|
||||||
"[ audio.format=<format, default:"DEFAULT_FORMAT"> ] " \
|
"[ 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.channels=<number of channels, default:"DEFAULT_CHANNELS"> ] " \
|
||||||
"[ audio.position=<channel map, default:"DEFAULT_POSITION"> ] " \
|
"[ audio.position=<channel map, default:"DEFAULT_POSITION"> ] " \
|
||||||
"[ stream.props=<properties> ] "
|
"[ stream.props=<properties> ] "
|
||||||
|
|
@ -351,9 +351,7 @@ static int parse_audio_info(struct impl *impl)
|
||||||
pw_log_error("unsupported format '%s'", str);
|
pw_log_error("unsupported format '%s'", str);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if ((str = pw_properties_get(props, PW_KEY_AUDIO_RATE)) == NULL)
|
info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, DEFAULT_RATE);
|
||||||
str = DEFAULT_RATE;
|
|
||||||
info->rate = atoi(str);
|
|
||||||
if (info->rate == 0) {
|
if (info->rate == 0) {
|
||||||
pw_log_error("invalid rate '%s'", str);
|
pw_log_error("invalid rate '%s'", str);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue