mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-22 08:56:59 -05:00
modules: switch to new property helpers
This commit is contained in:
parent
12c5a9b7ea
commit
d8de1cb255
4 changed files with 7 additions and 13 deletions
|
|
@ -367,7 +367,6 @@ static void *create_object(void *_data,
|
||||||
const char *output_node_str, *input_node_str;
|
const char *output_node_str, *input_node_str;
|
||||||
const char *output_port_str, *input_port_str;
|
const char *output_port_str, *input_port_str;
|
||||||
struct link_data *ld;
|
struct link_data *ld;
|
||||||
const char *str;
|
|
||||||
int res;
|
int res;
|
||||||
bool linger;
|
bool linger;
|
||||||
|
|
||||||
|
|
@ -401,8 +400,7 @@ static void *create_object(void *_data,
|
||||||
if (inport == NULL)
|
if (inport == NULL)
|
||||||
goto error_input_port;
|
goto error_input_port;
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
||||||
|
|
@ -372,10 +372,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_int32(props, PW_KEY_AUDIO_RATE, 0);
|
||||||
info->rate = atoi(str);
|
info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, 0);
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,6 @@ context_check_access(void *data, struct pw_impl_client *client)
|
||||||
{
|
{
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
const struct pw_properties *props;
|
const struct pw_properties *props;
|
||||||
const char *str;
|
|
||||||
struct pw_permission permissions[1];
|
struct pw_permission permissions[1];
|
||||||
struct spa_dict_item items[1];
|
struct spa_dict_item items[1];
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
@ -114,10 +113,10 @@ context_check_access(void *data, struct pw_impl_client *client)
|
||||||
if ((props = pw_impl_client_get_properties(client)) == NULL)
|
if ((props = pw_impl_client_get_properties(client)) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((str = pw_properties_get(props, PW_KEY_SEC_PID)) == NULL)
|
if (pw_properties_fetch_int32(props, PW_KEY_SEC_PID, &pid) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!spa_atoi32(str, &pid, 10) || pid != impl->portal_pid)
|
if (pid != impl->portal_pid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, "portal");
|
items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, "portal");
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ static void *create_object(void *_data,
|
||||||
struct factory_data *data = _data;
|
struct factory_data *data = _data;
|
||||||
struct pw_context *context = data->context;
|
struct pw_context *context = data->context;
|
||||||
struct pw_impl_node *node;
|
struct pw_impl_node *node;
|
||||||
const char *factory_name, *str;
|
const char *factory_name;
|
||||||
struct node_data *nd;
|
struct node_data *nd;
|
||||||
int res;
|
int res;
|
||||||
struct pw_impl_client *client;
|
struct pw_impl_client *client;
|
||||||
|
|
@ -123,8 +123,7 @@ 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_global_get_id(pw_impl_factory_get_global(data->this)));
|
pw_global_get_id(pw_impl_factory_get_global(data->this)));
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
client = resource ? pw_resource_get_client(resource) : NULL;
|
client = resource ? pw_resource_get_client(resource) : NULL;
|
||||||
if (client && !linger) {
|
if (client && !linger) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue