pass spa_dict around as config

Don't pass pw_properties around when we simply need to pass around
config info, only use pw_properties when used to construct an object
that keeps the properties.
This commit is contained in:
Wim Taymans 2019-12-13 11:26:05 +01:00
parent 3eec3f5abf
commit 1317ca140c
20 changed files with 73 additions and 68 deletions

View file

@ -142,7 +142,7 @@ static struct node *create_node(struct object *obj, uint32_t id,
node->handle = handle;
node->node = iface;
node->proxy = pw_core_export(impl->core,
info->type, pw_properties_new_dict(info->props), node->node, 0);
info->type, info->props, node->node, 0);
if (node->proxy == NULL)
goto clean_node;
@ -250,7 +250,7 @@ static struct object *create_object(struct impl *impl, uint32_t id,
obj->handle = handle;
obj->device = iface;
obj->proxy = pw_core_export(impl->core,
info->type, pw_properties_new_dict(info->props), obj->device, 0);
info->type, info->props, obj->device, 0);
if (obj->proxy == NULL)
goto clean_object;

View file

@ -474,7 +474,9 @@ static void make_node(struct data *data)
SPA_TYPE_INTERFACE_Node,
SPA_VERSION_NODE,
&impl_node, data);
pw_core_export(data->core, SPA_TYPE_INTERFACE_Node, props, &data->impl_node, 0);
pw_core_export(data->core, SPA_TYPE_INTERFACE_Node,
&props->dict, &data->impl_node, 0);
pw_properties_free(props);
}
static void set_permissions(struct data *data)

View file

@ -482,7 +482,9 @@ static void make_node(struct data *data)
SPA_TYPE_INTERFACE_Node,
SPA_VERSION_NODE,
&impl_node, data);
pw_core_export(data->core, SPA_TYPE_INTERFACE_Node, props, &data->impl_node, 0);
pw_core_export(data->core, SPA_TYPE_INTERFACE_Node,
&props->dict, &data->impl_node, 0);
pw_properties_free(props);
}
static void on_core_error(void *data, uint32_t id, int seq, int res, const char *message)

View file

@ -92,8 +92,10 @@ static int make_node(struct data *data)
}
data->proxy = pw_core_export(data->core,
SPA_TYPE_INTERFACE_Node, props,
SPA_TYPE_INTERFACE_Node, &props->dict,
data->node, 0);
pw_properties_free(props);
if (data->proxy == NULL)
return -errno;

View file

@ -583,8 +583,7 @@ static struct device *alsa_create_device(struct impl *impl, uint32_t id,
update_device_props(device);
device->sdevice = sm_media_session_export_device(impl->session,
pw_properties_copy(device->props),
device->device);
&device->props->dict, device->device);
if (device->sdevice == NULL) {
res = -errno;
goto clean_device;

View file

@ -161,7 +161,7 @@ static struct bluez5_node *bluez5_create_node(struct bluez5_object *obj, uint32_
}
node->proxy = sm_media_session_export(impl->session,
PW_TYPE_INTERFACE_Node,
pw_properties_copy(node->props),
&node->props->dict,
node->adapter, 0);
spa_list_append(&obj->node_list, &node->link);
@ -276,7 +276,7 @@ static struct bluez5_object *bluez5_create_object(struct impl *impl, uint32_t id
obj->device = iface;
obj->props = pw_properties_new_dict(info->props);
obj->proxy = sm_media_session_export(impl->session,
info->type, pw_properties_copy(obj->props), obj->device, 0);
info->type, &obj->props->dict, obj->device, 0);
if (obj->proxy == NULL) {
res = -errno;
goto clean_object;

View file

@ -1210,16 +1210,16 @@ static const struct pw_registry_events registry_events = {
};
struct pw_proxy *sm_media_session_export(struct sm_media_session *sess,
uint32_t type, struct pw_properties *properties,
uint32_t type, const struct spa_dict *props,
void *object, size_t user_data_size)
{
struct impl *impl = SPA_CONTAINER_OF(sess, struct impl, this);
return pw_core_export(impl->monitor_core, type,
properties, object, user_data_size);
props, object, user_data_size);
}
struct sm_device *sm_media_session_export_device(struct sm_media_session *sess,
struct pw_properties *properties, struct spa_device *object)
const struct spa_dict *props, struct spa_device *object)
{
struct impl *impl = SPA_CONTAINER_OF(sess, struct impl, this);
struct sm_device *device;
@ -1228,9 +1228,9 @@ struct sm_device *sm_media_session_export_device(struct sm_media_session *sess,
pw_log_debug(NAME " %p: device %p", impl, object);
proxy = pw_core_export(impl->monitor_core, SPA_TYPE_INTERFACE_Device,
properties, object, sizeof(struct sm_device));
props, object, sizeof(struct sm_device));
device = (struct sm_device *) create_object(impl, proxy, &properties->dict);
device = (struct sm_device *) create_object(impl, proxy, props);
return device;
}

View file

@ -218,11 +218,11 @@ struct sm_object *sm_media_session_find_object(struct sm_media_session *sess, ui
int sm_media_session_schedule_rescan(struct sm_media_session *sess);
struct pw_proxy *sm_media_session_export(struct sm_media_session *sess,
uint32_t type, struct pw_properties *properties,
uint32_t type, const struct spa_dict *props,
void *object, size_t user_data_size);
struct sm_device *sm_media_session_export_device(struct sm_media_session *sess,
struct pw_properties *properties, struct spa_device *device);
const struct spa_dict *props, struct spa_device *device);
struct pw_proxy *sm_media_session_create_object(struct sm_media_session *sess,
const char *factory_name, uint32_t type, uint32_t version,

View file

@ -303,7 +303,7 @@ static struct v4l2_object *v4l2_create_object(struct impl *impl, uint32_t id,
v4l2_update_device_props(obj);
obj->proxy = sm_media_session_export(impl->session,
info->type, pw_properties_copy(obj->props), obj->device, 0);
info->type, &obj->props->dict, obj->device, 0);
if (obj->proxy == NULL) {
res = -errno;
goto clean_object;