mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
remote: add option for extra user data for proxy
When doing an export, make it possible to add extra data to the resulting proxy for user data.
This commit is contained in:
parent
11393ce9dd
commit
e1cbdaed0b
12 changed files with 30 additions and 21 deletions
|
|
@ -469,7 +469,7 @@ static void make_node(struct data *data)
|
|||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_node, data);
|
||||
pw_remote_export(data->remote, SPA_TYPE_INTERFACE_Node, props, &data->impl_node);
|
||||
pw_remote_export(data->remote, SPA_TYPE_INTERFACE_Node, props, &data->impl_node, 0);
|
||||
}
|
||||
|
||||
static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remote_state state, const char *error)
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ static void make_node(struct data *data)
|
|||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_node, data);
|
||||
pw_remote_export(data->remote, SPA_TYPE_INTERFACE_Node, props, &data->impl_node);
|
||||
pw_remote_export(data->remote, SPA_TYPE_INTERFACE_Node, props, &data->impl_node, 0);
|
||||
}
|
||||
|
||||
static void on_state_changed(void *_data, enum pw_remote_state old,
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ static int make_device(struct data *data)
|
|||
props, SPA_ID_INVALID);
|
||||
|
||||
pw_remote_export(data->remote, SPA_TYPE_INTERFACE_Device, NULL,
|
||||
pw_device_get_implementation(data->device));
|
||||
pw_device_get_implementation(data->device), 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ static int make_node(struct data *data)
|
|||
|
||||
pw_node_set_active(data->node, true);
|
||||
|
||||
pw_remote_export(data->remote, PW_TYPE_INTERFACE_Node, NULL, data->node);
|
||||
pw_remote_export(data->remote, PW_TYPE_INTERFACE_Node, NULL, data->node, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ static const struct spa_dict_item module_props[] = {
|
|||
};
|
||||
|
||||
struct pw_proxy *pw_remote_spa_device_export(struct pw_remote *remote,
|
||||
uint32_t type, struct pw_properties *props, void *object);
|
||||
uint32_t type, struct pw_properties *props, void *object,
|
||||
size_t user_data_size);
|
||||
|
||||
struct pw_protocol *pw_protocol_native_ext_client_device_init(struct pw_core *core);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ static const struct pw_proxy_events proxy_events = {
|
|||
};
|
||||
|
||||
struct pw_proxy *pw_remote_spa_device_export(struct pw_remote *remote,
|
||||
uint32_t type, struct pw_properties *props, void *object)
|
||||
uint32_t type, struct pw_properties *props, void *object,
|
||||
size_t user_data_size)
|
||||
{
|
||||
struct spa_device *device = object;
|
||||
struct spa_interface *iface;
|
||||
|
|
@ -68,11 +69,12 @@ struct pw_proxy *pw_remote_spa_device_export(struct pw_remote *remote,
|
|||
SPA_TYPE_INTERFACE_Device,
|
||||
SPA_VERSION_DEVICE,
|
||||
&props->dict,
|
||||
sizeof(struct device_data));
|
||||
user_data_size + sizeof(struct device_data));
|
||||
if (proxy == NULL)
|
||||
return NULL;
|
||||
|
||||
data = pw_proxy_get_user_data(proxy);
|
||||
data = SPA_MEMBER(data, user_data_size, struct device_data);
|
||||
data->remote = remote;
|
||||
data->device = device;
|
||||
data->core = pw_remote_get_core(remote);
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ static const struct spa_dict_item module_props[] = {
|
|||
};
|
||||
|
||||
struct pw_proxy *pw_remote_node_export(struct pw_remote *remote,
|
||||
uint32_t type, struct pw_properties *props, void *object);
|
||||
uint32_t type, struct pw_properties *props, void *object, size_t user_data_size);
|
||||
struct pw_proxy *pw_remote_spa_node_export(struct pw_remote *remote,
|
||||
uint32_t type, struct pw_properties *props, void *object);
|
||||
uint32_t type, struct pw_properties *props, void *object, size_t user_data_size);
|
||||
|
||||
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_core *core);
|
||||
|
||||
|
|
|
|||
|
|
@ -1170,7 +1170,8 @@ static const struct spa_node_callbacks node_callbacks = {
|
|||
.reuse_buffer = node_reuse_buffer
|
||||
};
|
||||
|
||||
static struct pw_proxy *node_export(struct pw_remote *remote, void *object, bool do_free)
|
||||
static struct pw_proxy *node_export(struct pw_remote *remote, void *object, bool do_free,
|
||||
size_t user_data_size)
|
||||
{
|
||||
struct pw_node *node = object;
|
||||
struct pw_proxy *proxy;
|
||||
|
|
@ -1218,19 +1219,21 @@ static struct pw_proxy *node_export(struct pw_remote *remote, void *object, bool
|
|||
do_node_init(proxy);
|
||||
|
||||
data->proxy = (struct pw_proxy*) pw_client_node_proxy_get_node(data->node_proxy,
|
||||
PW_VERSION_NODE_PROXY, 0);
|
||||
PW_VERSION_NODE_PROXY, user_data_size);
|
||||
|
||||
return data->proxy;
|
||||
}
|
||||
|
||||
struct pw_proxy *pw_remote_node_export(struct pw_remote *remote,
|
||||
uint32_t type, struct pw_properties *props, void *object)
|
||||
uint32_t type, struct pw_properties *props, void *object,
|
||||
size_t user_data_size)
|
||||
{
|
||||
return node_export(remote, object, false);
|
||||
return node_export(remote, object, false, user_data_size);
|
||||
}
|
||||
|
||||
struct pw_proxy *pw_remote_spa_node_export(struct pw_remote *remote,
|
||||
uint32_t type, struct pw_properties *props, void *object)
|
||||
uint32_t type, struct pw_properties *props, void *object,
|
||||
size_t user_data_size)
|
||||
{
|
||||
struct pw_node *node;
|
||||
|
||||
|
|
@ -1242,5 +1245,5 @@ struct pw_proxy *pw_remote_spa_node_export(struct pw_remote *remote,
|
|||
pw_node_register(node, NULL, NULL, NULL);
|
||||
pw_node_set_active(node, true);
|
||||
|
||||
return node_export(remote, node, true);
|
||||
return node_export(remote, node, true, user_data_size);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -442,7 +442,8 @@ int pw_remote_disconnect(struct pw_remote *remote)
|
|||
|
||||
SPA_EXPORT
|
||||
struct pw_proxy *pw_remote_export(struct pw_remote *remote,
|
||||
uint32_t type, struct pw_properties *props, void *object)
|
||||
uint32_t type, struct pw_properties *props, void *object,
|
||||
size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *proxy;
|
||||
const struct pw_export_type *t;
|
||||
|
|
@ -454,7 +455,7 @@ struct pw_proxy *pw_remote_export(struct pw_remote *remote,
|
|||
if (t == NULL)
|
||||
goto no_export_type;
|
||||
|
||||
proxy = t->func(remote, type, props, object);
|
||||
proxy = t->func(remote, type, props, object, user_data_size);
|
||||
if (proxy == NULL)
|
||||
goto proxy_failed;
|
||||
|
||||
|
|
|
|||
|
|
@ -201,14 +201,16 @@ int pw_remote_disconnect(struct pw_remote *remote);
|
|||
struct pw_proxy *pw_remote_export(struct pw_remote *remote, /**< the remote */
|
||||
uint32_t type, /**< the type of object */
|
||||
struct pw_properties *properties, /**< extra properties */
|
||||
void *object /**< object to export */);
|
||||
void *object, /**< object to export */
|
||||
size_t user_data_size /**< extra user data */);
|
||||
|
||||
/** data for registering export functions */
|
||||
struct pw_export_type {
|
||||
struct spa_list link;
|
||||
uint32_t type;
|
||||
struct pw_proxy * (*func) (struct pw_remote *remote,
|
||||
uint32_t type, struct pw_properties *properties, void *object);
|
||||
uint32_t type, struct pw_properties *properties, void *object,
|
||||
size_t user_data_size);
|
||||
};
|
||||
|
||||
/** register a type that can be exported on a remote. This is usually used by
|
||||
|
|
|
|||
|
|
@ -982,7 +982,7 @@ static int handle_connect(struct pw_stream *stream)
|
|||
|
||||
pw_log_debug("stream %p: export node %p", stream, impl->node);
|
||||
stream->proxy = pw_remote_export(stream->remote,
|
||||
PW_TYPE_INTERFACE_Node, NULL, impl->node);
|
||||
PW_TYPE_INTERFACE_Node, NULL, impl->node, 0);
|
||||
if (stream->proxy == NULL)
|
||||
goto no_proxy;
|
||||
|
||||
|
|
|
|||
|
|
@ -1149,7 +1149,7 @@ static bool do_export_node(struct data *data, const char *cmd, char *args, char
|
|||
return false;
|
||||
}
|
||||
node = pw_global_get_object(global);
|
||||
proxy = pw_remote_export(rd->remote, PW_TYPE_INTERFACE_Node, NULL, node);
|
||||
proxy = pw_remote_export(rd->remote, PW_TYPE_INTERFACE_Node, NULL, node, 0);
|
||||
|
||||
id = pw_map_insert_new(&data->vars, proxy);
|
||||
fprintf(stdout, "%d = @proxy:%d\n", id, pw_proxy_get_id((struct pw_proxy*)proxy));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue