mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
interface: add an interface struct
The interface struct has the type,version and methods of the interface. Make spa interfaces extend from spa_interface and make a separate structure for the methods. Pass a generic void* as the first argument of methods, like we don in PipeWire. Bundle the methods + implementation in a versioned inteface and use that to invoke methods. This way we can do version checks on the methods. Make resource and proxy interfaces that we can can call. We can then make the core interfaces independent on proxy/resource and hide them in the lower layers. Add add_listener method to methods of core interfaces, just like SPA.
This commit is contained in:
parent
eb6481efb3
commit
ff946e3d4b
85 changed files with 3051 additions and 3000 deletions
|
|
@ -129,17 +129,17 @@ static void update_param(struct data *data)
|
|||
data->param_accum -= M_PI_M2;
|
||||
}
|
||||
|
||||
static int impl_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
static int impl_send_command(void *object, const struct spa_command *command)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_add_listener(struct spa_node *node,
|
||||
static int impl_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct spa_node_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
struct spa_hook_list save;
|
||||
|
||||
spa_hook_list_isolate(&d->hooks, &save, listener, events, data);
|
||||
|
|
@ -154,23 +154,23 @@ static int impl_add_listener(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_set_callbacks(struct spa_node *node,
|
||||
static int impl_set_callbacks(void *object,
|
||||
const struct spa_node_callbacks *callbacks, void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_set_io(struct spa_node *node,
|
||||
static int impl_set_io(void *object,
|
||||
uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_set_io(struct spa_node *node,
|
||||
static int impl_port_set_io(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
|
||||
switch (id) {
|
||||
case SPA_IO_Buffers:
|
||||
|
|
@ -186,12 +186,12 @@ static int impl_port_set_io(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_enum_params(struct spa_node *node, int seq,
|
||||
static int impl_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
struct spa_pod *param;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
uint8_t buffer[1024];
|
||||
|
|
@ -288,11 +288,11 @@ static int impl_port_enum_params(struct spa_node *node, int seq,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int port_set_format(struct spa_node *node,
|
||||
static int port_set_format(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags, const struct spa_pod *format)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
Uint32 sdl_format;
|
||||
void *dest;
|
||||
|
||||
|
|
@ -327,22 +327,22 @@ static int port_set_format(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_set_param(struct spa_node *node,
|
||||
static int impl_port_set_param(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
if (id == SPA_PARAM_Format) {
|
||||
return port_set_format(node, direction, port_id, flags, param);
|
||||
return port_set_format(object, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
static int impl_port_use_buffers(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < n_buffers; i++)
|
||||
|
|
@ -417,9 +417,9 @@ static int do_render(struct spa_loop *loop, bool async, uint32_t seq,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_process(struct spa_node *node)
|
||||
static int impl_node_process(void *object)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
struct spa_buffer *buf;
|
||||
int res;
|
||||
|
||||
|
|
@ -441,8 +441,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
return d->io->status = SPA_STATUS_NEED_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
static const struct spa_node_methods impl_node = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.add_listener = impl_add_listener,
|
||||
.set_callbacks = impl_set_callbacks,
|
||||
.set_io = impl_set_io,
|
||||
|
|
@ -465,7 +465,10 @@ static void make_node(struct data *data)
|
|||
pw_properties_set(props, PW_NODE_PROP_CATEGORY, "Capture");
|
||||
pw_properties_set(props, PW_NODE_PROP_ROLE, "Camera");
|
||||
|
||||
data->impl_node = impl_node;
|
||||
data->impl_node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_node, data);
|
||||
pw_remote_export(data->remote, SPA_TYPE_INTERFACE_Node, props, &data->impl_node);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,17 +102,17 @@ static void update_volume(struct data *data)
|
|||
data->volume_accum -= M_PI_M2;
|
||||
}
|
||||
|
||||
static int impl_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
static int impl_send_command(void *object, const struct spa_command *command)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_add_listener(struct spa_node *node,
|
||||
static int impl_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct spa_node_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
struct spa_hook_list save;
|
||||
|
||||
spa_hook_list_isolate(&d->hooks, &save, listener, events, data);
|
||||
|
|
@ -125,22 +125,22 @@ static int impl_add_listener(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_set_callbacks(struct spa_node *node,
|
||||
static int impl_set_callbacks(void *object,
|
||||
const struct spa_node_callbacks *callbacks, void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_set_io(struct spa_node *node,
|
||||
static int impl_set_io(void *object,
|
||||
uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_set_io(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
static int impl_port_set_io(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
|
||||
switch (id) {
|
||||
case SPA_IO_Buffers:
|
||||
|
|
@ -156,12 +156,12 @@ static int impl_port_set_io(struct spa_node *node, enum spa_direction direction,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_enum_params(struct spa_node *node, int seq,
|
||||
static int impl_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
struct spa_pod *param;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
uint8_t buffer[1024];
|
||||
|
|
@ -260,11 +260,11 @@ static int impl_port_enum_params(struct spa_node *node, int seq,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int port_set_format(struct spa_node *node,
|
||||
static int port_set_format(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags, const struct spa_pod *format)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
|
||||
d->info.change_mask = SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
if (format == NULL) {
|
||||
|
|
@ -291,22 +291,22 @@ static int port_set_format(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_set_param(struct spa_node *node,
|
||||
static int impl_port_set_param(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
if (id == SPA_PARAM_Format) {
|
||||
return port_set_format(node, direction, port_id, flags, param);
|
||||
return port_set_format(object, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
static int impl_port_use_buffers(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
uint32_t i;
|
||||
for (i = 0; i < n_buffers; i++) {
|
||||
struct buffer *b = &d->buffers[i];
|
||||
|
|
@ -347,9 +347,9 @@ static inline void reuse_buffer(struct data *d, uint32_t id)
|
|||
spa_list_append(&d->empty, &d->buffers[id].link);
|
||||
}
|
||||
|
||||
static int impl_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
||||
static int impl_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
reuse_buffer(d, buffer_id);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -396,9 +396,9 @@ static void fill_s16(struct data *d, void *dest, int avail)
|
|||
}
|
||||
}
|
||||
|
||||
static int impl_node_process(struct spa_node *node)
|
||||
static int impl_node_process(void *object)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
struct buffer *b;
|
||||
int avail;
|
||||
struct spa_io_buffers *io = d->io;
|
||||
|
|
@ -446,8 +446,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
return SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
static const struct spa_node_methods impl_node = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.add_listener = impl_add_listener,
|
||||
.set_callbacks = impl_set_callbacks,
|
||||
.set_io = impl_set_io,
|
||||
|
|
@ -473,7 +473,10 @@ static void make_node(struct data *data)
|
|||
if (data->path)
|
||||
pw_properties_set(props, PW_NODE_PROP_TARGET_NODE, data->path);
|
||||
|
||||
data->impl_node = impl_node;
|
||||
data->impl_node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_node, data);
|
||||
pw_remote_export(data->remote, SPA_TYPE_INTERFACE_Node, props, &data->impl_node);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ static int make_node(struct data *data)
|
|||
data->node = pw_factory_create_object(factory,
|
||||
NULL,
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
props, SPA_ID_INVALID);
|
||||
|
||||
pw_node_set_active(data->node, true);
|
||||
|
|
|
|||
|
|
@ -80,22 +80,22 @@ static void handle_events(struct data *data)
|
|||
}
|
||||
}
|
||||
|
||||
static int impl_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
static int impl_set_io(void *object, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
static int impl_send_command(void *object, const struct spa_command *command)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_add_listener(struct spa_node *node,
|
||||
static int impl_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct spa_node_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
struct spa_port_info info;
|
||||
struct spa_hook_list save;
|
||||
|
||||
|
|
@ -112,16 +112,16 @@ static int impl_add_listener(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_set_callbacks(struct spa_node *node,
|
||||
static int impl_set_callbacks(void *object,
|
||||
const struct spa_node_callbacks *callbacks, void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_set_io(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
static int impl_port_set_io(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
|
||||
if (id == SPA_IO_Buffers)
|
||||
d->io = data;
|
||||
|
|
@ -131,12 +131,12 @@ static int impl_port_set_io(struct spa_node *node, enum spa_direction direction,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_enum_params(struct spa_node *node, int seq,
|
||||
static int impl_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
struct spa_pod *param;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
uint8_t buffer[1024];
|
||||
|
|
@ -200,10 +200,10 @@ static int impl_port_enum_params(struct spa_node *node, int seq,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int port_set_format(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
static int port_set_format(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags, const struct spa_pod *format)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
Uint32 sdl_format;
|
||||
void *dest;
|
||||
|
||||
|
|
@ -229,22 +229,22 @@ static int port_set_format(struct spa_node *node, enum spa_direction direction,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_set_param(struct spa_node *node,
|
||||
static int impl_port_set_param(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
if (id == SPA_PARAM_Format) {
|
||||
return port_set_format(node, direction, port_id, flags, param);
|
||||
return port_set_format(object, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
static int impl_port_use_buffers(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < n_buffers; i++)
|
||||
|
|
@ -303,9 +303,9 @@ static int do_render(struct spa_loop *loop, bool async, uint32_t seq,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_process(struct spa_node *node)
|
||||
static int impl_node_process(void *object)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct data *d = object;
|
||||
int res;
|
||||
|
||||
if ((res = pw_loop_invoke(pw_main_loop_get_loop(d->loop), do_render,
|
||||
|
|
@ -319,9 +319,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
return SPA_STATUS_NEED_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
static const struct spa_node_methods impl_node = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.add_listener = impl_add_listener,
|
||||
.set_callbacks = impl_set_callbacks,
|
||||
.set_io = impl_set_io,
|
||||
|
|
@ -339,7 +338,10 @@ static void make_nodes(struct data *data)
|
|||
struct pw_properties *props;
|
||||
|
||||
data->node = pw_node_new(data->core, "SDL-sink", NULL, 0);
|
||||
data->impl_node = impl_node;
|
||||
data->impl_node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_node, data);
|
||||
pw_node_set_implementation(data->node, &data->impl_node);
|
||||
|
||||
pw_node_register(data->node, NULL, NULL, NULL);
|
||||
|
|
@ -350,7 +352,7 @@ static void make_nodes(struct data *data)
|
|||
data->v4l2 = pw_factory_create_object(factory,
|
||||
NULL,
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
props,
|
||||
SPA_ID_INVALID);
|
||||
data->link = pw_link_new(data->core,
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ static int link_session_dsp(struct impl *impl, struct session *session)
|
|||
session->link_proxy = pw_core_proxy_create_object(impl->core_proxy,
|
||||
"link-factory",
|
||||
PW_TYPE_INTERFACE_Link,
|
||||
PW_VERSION_LINK,
|
||||
PW_VERSION_LINK_PROXY,
|
||||
&props->dict,
|
||||
0);
|
||||
pw_proxy_add_listener(session->link_proxy, &session->link_listener, &link_proxy_events, session);
|
||||
|
|
@ -481,7 +481,7 @@ handle_node(struct impl *impl, uint32_t id, uint32_t parent_id,
|
|||
media_class = props ? spa_dict_lookup(props, "media.class") : NULL;
|
||||
|
||||
p = pw_registry_proxy_bind(impl->registry_proxy,
|
||||
id, type, PW_VERSION_NODE,
|
||||
id, type, PW_VERSION_NODE_PROXY,
|
||||
sizeof(struct node));
|
||||
|
||||
node = pw_proxy_get_user_data(p);
|
||||
|
|
@ -657,7 +657,7 @@ handle_port(struct impl *impl, uint32_t id, uint32_t parent_id, uint32_t type,
|
|||
return -EINVAL;
|
||||
|
||||
p = pw_registry_proxy_bind(impl->registry_proxy,
|
||||
id, type, PW_VERSION_PORT,
|
||||
id, type, PW_VERSION_PORT_PROXY,
|
||||
sizeof(struct port));
|
||||
|
||||
port = pw_proxy_get_user_data(p);
|
||||
|
|
@ -737,7 +737,7 @@ handle_client(struct impl *impl, uint32_t id, uint32_t parent_id,
|
|||
const char *str;
|
||||
|
||||
p = pw_registry_proxy_bind(impl->registry_proxy,
|
||||
id, type, PW_VERSION_CLIENT,
|
||||
id, type, PW_VERSION_CLIENT_PROXY,
|
||||
sizeof(struct client));
|
||||
|
||||
client = pw_proxy_get_user_data(p);
|
||||
|
|
@ -932,7 +932,7 @@ static int link_nodes(struct node *peer, enum pw_direction direction, struct nod
|
|||
pw_core_proxy_create_object(impl->core_proxy,
|
||||
"link-factory",
|
||||
PW_TYPE_INTERFACE_Link,
|
||||
PW_VERSION_LINK,
|
||||
PW_VERSION_LINK_PROXY,
|
||||
&props->dict,
|
||||
0);
|
||||
|
||||
|
|
@ -1259,7 +1259,7 @@ static void rescan_session(struct impl *impl, struct session *sess)
|
|||
sess->dsp_proxy = pw_core_proxy_create_object(impl->core_proxy,
|
||||
"audio-dsp",
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
&props->dict,
|
||||
0);
|
||||
pw_properties_free(props);
|
||||
|
|
@ -1299,7 +1299,7 @@ static void do_rescan(struct impl *impl)
|
|||
static void core_done(void *data, uint32_t id, int seq)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
pw_log_debug("media-session %p: sync %d %d/%d", impl, id, seq, impl->seq);
|
||||
pw_log_debug("media-session %p: sync %u %d/%d", impl, id, seq, impl->seq);
|
||||
if (impl->seq == seq)
|
||||
do_rescan(impl);
|
||||
}
|
||||
|
|
@ -1326,7 +1326,7 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
|||
&impl->core_listener,
|
||||
&core_events, impl);
|
||||
impl->registry_proxy = pw_core_proxy_get_registry(impl->core_proxy,
|
||||
PW_VERSION_REGISTRY, 0);
|
||||
PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(impl->registry_proxy,
|
||||
&impl->registry_listener,
|
||||
®istry_events, impl);
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@ extern "C" {
|
|||
#include <spa/utils/defs.h>
|
||||
#include <spa/param/param.h>
|
||||
|
||||
#include <pipewire/proxy.h>
|
||||
|
||||
struct pw_client_node_proxy;
|
||||
struct pw_client_node_proxy { struct spa_interface iface; };
|
||||
|
||||
#define PW_VERSION_CLIENT_NODE 0
|
||||
|
||||
|
|
@ -48,117 +46,6 @@ struct pw_client_node_buffer {
|
|||
struct spa_buffer *buffer; /**< buffer describing metadata and buffer memory */
|
||||
};
|
||||
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_GET_NODE 0
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_UPDATE 1
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_PORT_UPDATE 2
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_SET_ACTIVE 3
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_EVENT 4
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_NUM 5
|
||||
|
||||
/** \ref pw_client_node methods */
|
||||
struct pw_client_node_proxy_methods {
|
||||
#define PW_VERSION_CLIENT_NODE_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
/** get the node object
|
||||
*/
|
||||
int (*get_node) (void *object, uint32_t version, uint32_t new_id);
|
||||
/**
|
||||
* Update the node ports and properties
|
||||
*
|
||||
* Update the maximum number of ports and the params of the
|
||||
* client node.
|
||||
* \param change_mask bitfield with changed parameters
|
||||
* \param max_input_ports new max input ports
|
||||
* \param max_output_ports new max output ports
|
||||
* \param params new params
|
||||
*/
|
||||
int (*update) (void *object,
|
||||
#define PW_CLIENT_NODE_UPDATE_PARAMS (1 << 0)
|
||||
#define PW_CLIENT_NODE_UPDATE_INFO (1 << 1)
|
||||
uint32_t change_mask,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod **params,
|
||||
const struct spa_node_info *info);
|
||||
|
||||
/**
|
||||
* Update a node port
|
||||
*
|
||||
* Update the information of one port of a node.
|
||||
* \param direction the direction of the port
|
||||
* \param port_id the port id to update
|
||||
* \param change_mask a bitfield of changed items
|
||||
* \param n_params number of port parameters
|
||||
* \param params array of port parameters
|
||||
* \param info port information
|
||||
*/
|
||||
int (*port_update) (void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
#define PW_CLIENT_NODE_PORT_UPDATE_PARAMS (1 << 0)
|
||||
#define PW_CLIENT_NODE_PORT_UPDATE_INFO (1 << 1)
|
||||
uint32_t change_mask,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod **params,
|
||||
const struct spa_port_info *info);
|
||||
/**
|
||||
* Activate or deactivate the node
|
||||
*/
|
||||
int (*set_active) (void *object, bool active);
|
||||
/**
|
||||
* Send an event to the node
|
||||
* \param event the event to send
|
||||
*/
|
||||
int (*event) (void *object, struct spa_event *event);
|
||||
};
|
||||
|
||||
static inline struct pw_node_proxy *
|
||||
pw_client_node_proxy_get_node(struct pw_client_node_proxy *p, uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *np = pw_proxy_new((struct pw_proxy*)p, PW_TYPE_INTERFACE_Node, user_data_size);
|
||||
pw_proxy_do((struct pw_proxy*)p, struct pw_client_node_proxy_methods,
|
||||
get_node, version, pw_proxy_get_id(np));
|
||||
return (struct pw_node_proxy *) np;
|
||||
}
|
||||
|
||||
static inline int
|
||||
pw_client_node_proxy_update(struct pw_client_node_proxy *p,
|
||||
uint32_t change_mask,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod **params,
|
||||
const struct spa_node_info *info)
|
||||
{
|
||||
return pw_proxy_do((struct pw_proxy*)p, struct pw_client_node_proxy_methods,
|
||||
update,
|
||||
change_mask, n_params, params, info);
|
||||
}
|
||||
|
||||
static inline int
|
||||
pw_client_node_proxy_port_update(struct pw_client_node_proxy *p,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t change_mask,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod **params,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
return pw_proxy_do((struct pw_proxy*)p, struct pw_client_node_proxy_methods,
|
||||
port_update, direction, port_id, change_mask,
|
||||
n_params, params, info);
|
||||
}
|
||||
|
||||
static inline int
|
||||
pw_client_node_proxy_set_active(struct pw_client_node_proxy *p, bool active)
|
||||
{
|
||||
return pw_proxy_do((struct pw_proxy*)p, struct pw_client_node_proxy_methods, set_active, active);
|
||||
}
|
||||
|
||||
static inline int
|
||||
pw_client_node_proxy_event(struct pw_client_node_proxy *p, struct spa_event *event)
|
||||
{
|
||||
return pw_proxy_do((struct pw_proxy*)p, struct pw_client_node_proxy_methods, event, event);
|
||||
}
|
||||
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_ADD_MEM 0
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_TRANSPORT 1
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_SET_PARAM 2
|
||||
|
|
@ -331,39 +218,102 @@ struct pw_client_node_proxy_events {
|
|||
uint32_t size);
|
||||
};
|
||||
|
||||
static inline void
|
||||
pw_client_node_proxy_add_listener(struct pw_client_node_proxy *p,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_client_node_proxy_events *events,
|
||||
void *data)
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_GET_NODE 1
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_UPDATE 2
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_PORT_UPDATE 3
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_SET_ACTIVE 4
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_EVENT 5
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_NUM 6
|
||||
|
||||
/** \ref pw_client_node methods */
|
||||
struct pw_client_node_proxy_methods {
|
||||
#define PW_VERSION_CLIENT_NODE_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_client_node_proxy_events *events,
|
||||
void *data);
|
||||
/** get the node object
|
||||
*/
|
||||
struct pw_node_proxy * (*get_node) (void *object, uint32_t version, size_t user_data_size);
|
||||
/**
|
||||
* Update the node ports and properties
|
||||
*
|
||||
* Update the maximum number of ports and the params of the
|
||||
* client node.
|
||||
* \param change_mask bitfield with changed parameters
|
||||
* \param max_input_ports new max input ports
|
||||
* \param max_output_ports new max output ports
|
||||
* \param params new params
|
||||
*/
|
||||
int (*update) (void *object,
|
||||
#define PW_CLIENT_NODE_UPDATE_PARAMS (1 << 0)
|
||||
#define PW_CLIENT_NODE_UPDATE_INFO (1 << 1)
|
||||
uint32_t change_mask,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod **params,
|
||||
const struct spa_node_info *info);
|
||||
|
||||
/**
|
||||
* Update a node port
|
||||
*
|
||||
* Update the information of one port of a node.
|
||||
* \param direction the direction of the port
|
||||
* \param port_id the port id to update
|
||||
* \param change_mask a bitfield of changed items
|
||||
* \param n_params number of port parameters
|
||||
* \param params array of port parameters
|
||||
* \param info port information
|
||||
*/
|
||||
int (*port_update) (void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
#define PW_CLIENT_NODE_PORT_UPDATE_PARAMS (1 << 0)
|
||||
#define PW_CLIENT_NODE_PORT_UPDATE_INFO (1 << 1)
|
||||
uint32_t change_mask,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod **params,
|
||||
const struct spa_port_info *info);
|
||||
/**
|
||||
* Activate or deactivate the node
|
||||
*/
|
||||
int (*set_active) (void *object, bool active);
|
||||
/**
|
||||
* Send an event to the node
|
||||
* \param event the event to send
|
||||
*/
|
||||
int (*event) (void *object, struct spa_event *event);
|
||||
};
|
||||
|
||||
|
||||
#define pw_client_node_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
struct pw_client_node_proxy *_p = o; \
|
||||
spa_interface_call_res(&_p->iface, \
|
||||
struct pw_client_node_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_client_node_proxy_add_listener(c,...) pw_client_node_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
|
||||
static inline struct pw_node_proxy *
|
||||
pw_client_node_proxy_get_node(struct pw_client_node_proxy *p, uint32_t version, size_t user_data_size)
|
||||
{
|
||||
pw_proxy_add_proxy_listener((struct pw_proxy*)p, listener, events, data);
|
||||
struct pw_node_proxy *res = NULL;
|
||||
spa_interface_call_res(&p->iface,
|
||||
struct pw_client_node_proxy_methods, res,
|
||||
get_node, 0, version, user_data_size);
|
||||
return res;
|
||||
}
|
||||
|
||||
#define pw_client_node_resource_add_mem(r,...) \
|
||||
pw_resource_notify(r,struct pw_client_node_proxy_events,add_mem,__VA_ARGS__)
|
||||
#define pw_client_node_resource_transport(r,...) \
|
||||
pw_resource_notify(r,struct pw_client_node_proxy_events,transport,__VA_ARGS__)
|
||||
#define pw_client_node_resource_set_param(r,...) \
|
||||
pw_resource_notify(r,struct pw_client_node_proxy_events,set_param,__VA_ARGS__)
|
||||
#define pw_client_node_resource_set_io(r,...) \
|
||||
pw_resource_notify(r,struct pw_client_node_proxy_events,set_io,__VA_ARGS__)
|
||||
#define pw_client_node_resource_event(r,...) \
|
||||
pw_resource_notify(r,struct pw_client_node_proxy_events,event,__VA_ARGS__)
|
||||
#define pw_client_node_resource_command(r,...) \
|
||||
pw_resource_notify(r,struct pw_client_node_proxy_events,command,__VA_ARGS__)
|
||||
#define pw_client_node_resource_add_port(r,...) \
|
||||
pw_resource_notify(r,struct pw_client_node_proxy_events,add_port,__VA_ARGS__)
|
||||
#define pw_client_node_resource_remove_port(r,...) \
|
||||
pw_resource_notify(r,struct pw_client_node_proxy_events,remove_port,__VA_ARGS__)
|
||||
#define pw_client_node_resource_port_set_param(r,...) \
|
||||
pw_resource_notify(r,struct pw_client_node_proxy_events,port_set_param,__VA_ARGS__)
|
||||
#define pw_client_node_resource_port_use_buffers(r,...) \
|
||||
pw_resource_notify(r,struct pw_client_node_proxy_events,port_use_buffers,__VA_ARGS__)
|
||||
#define pw_client_node_resource_port_set_io(r,...) \
|
||||
pw_resource_notify(r,struct pw_client_node_proxy_events,port_set_io,__VA_ARGS__)
|
||||
#define pw_client_node_resource_set_activation(r,...) \
|
||||
pw_resource_notify(r,struct pw_client_node_proxy_events,set_activation,__VA_ARGS__)
|
||||
#define pw_client_node_proxy_update(c,...) pw_client_node_proxy_method(c,update,0,__VA_ARGS__)
|
||||
#define pw_client_node_proxy_port_update(c,...) pw_client_node_proxy_method(c,port_update,0,__VA_ARGS__)
|
||||
#define pw_client_node_proxy_set_active(c,...) pw_client_node_proxy_method(c,set_active,0,__VA_ARGS__)
|
||||
#define pw_client_node_proxy_event(c,...) pw_client_node_proxy_method(c,event,0,__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t parent_id, u
|
|||
|
||||
node = pw_registry_proxy_bind(rd->registry,
|
||||
id, PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE, sizeof(*nd));
|
||||
PW_VERSION_NODE_PROXY, sizeof(*nd));
|
||||
if (node == NULL)
|
||||
goto no_mem;
|
||||
|
||||
|
|
@ -486,7 +486,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t parent_id, u
|
|||
|
||||
port = pw_registry_proxy_bind(rd->registry,
|
||||
id, PW_TYPE_INTERFACE_Port,
|
||||
PW_VERSION_PORT, sizeof(*pd));
|
||||
PW_VERSION_PORT_PROXY, sizeof(*pd));
|
||||
if (port == NULL)
|
||||
goto no_mem;
|
||||
|
||||
|
|
@ -580,8 +580,7 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
|
|||
self->list_only = TRUE;
|
||||
self->devices = NULL;
|
||||
|
||||
data->registry = pw_core_proxy_get_registry(self->core_proxy,
|
||||
PW_VERSION_REGISTRY, 0);
|
||||
data->registry = pw_core_proxy_get_registry(self->core_proxy, PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(data->registry, &data->registry_listener, ®istry_events, data);
|
||||
pw_core_proxy_sync(self->core_proxy, 0, self->seq++);
|
||||
|
||||
|
|
@ -666,8 +665,8 @@ gst_pipewire_device_provider_start (GstDeviceProvider * provider)
|
|||
}
|
||||
GST_DEBUG_OBJECT (self, "connected");
|
||||
|
||||
self->registry = pw_core_proxy_get_registry(self->core_proxy,
|
||||
PW_VERSION_REGISTRY, 0);
|
||||
self->registry = pw_core_proxy_get_registry(self->core_proxy, PW_VERSION_REGISTRY_PROXY, 0);
|
||||
|
||||
data->registry = self->registry;
|
||||
|
||||
pw_registry_proxy_add_listener(self->registry, &data->registry_listener, ®istry_events, data);
|
||||
|
|
|
|||
|
|
@ -136,7 +136,8 @@ static void *create_object(void *_data,
|
|||
pw_node_register(dsp, client, pw_module_get_global(d->module), NULL);
|
||||
pw_node_add_listener(dsp, &nd->dsp_listener, &node_events, nd);
|
||||
|
||||
res = pw_global_bind(pw_node_get_global(dsp), client, PW_PERM_RWX, PW_VERSION_NODE, new_id);
|
||||
res = pw_global_bind(pw_node_get_global(dsp), client,
|
||||
PW_PERM_RWX, PW_VERSION_NODE_PROXY, new_id);
|
||||
if (res < 0)
|
||||
goto no_bind;
|
||||
|
||||
|
|
@ -208,7 +209,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
factory = pw_factory_new(core,
|
||||
"audio-dsp",
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
NULL,
|
||||
sizeof(*data));
|
||||
if (factory == NULL)
|
||||
|
|
|
|||
|
|
@ -124,33 +124,31 @@ struct impl {
|
|||
#define GET_OUT_PORT(this,p) (&this->out_ports[p])
|
||||
#define GET_PORT(this,d,p) (d == SPA_DIRECTION_INPUT ? GET_IN_PORT(this,p) : GET_OUT_PORT(this,p))
|
||||
|
||||
static int impl_node_enum_params(struct spa_node *node, int seq,
|
||||
static int impl_node_enum_params(void *object, int seq,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
static int impl_node_send_command(void *object, const struct spa_command *command)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(command != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
switch (SPA_NODE_COMMAND_ID(command)) {
|
||||
case SPA_NODE_COMMAND_Start:
|
||||
this->started = true;
|
||||
|
|
@ -185,18 +183,17 @@ static void emit_port_info(struct impl *this, struct port *port, bool full)
|
|||
}
|
||||
}
|
||||
|
||||
static int impl_node_add_listener(struct spa_node *node,
|
||||
static int impl_node_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct spa_node_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct spa_hook_list save;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
spa_hook_list_isolate(&this->hooks, &save, listener, events, data);
|
||||
|
||||
emit_node_info(this, true);
|
||||
|
|
@ -212,23 +209,20 @@ static int impl_node_add_listener(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
impl_node_set_callbacks(void *object,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *user_data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
static int impl_node_add_port(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
const struct spa_dict *props)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_FREE_IN_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_IN_PORT (this, port_id);
|
||||
|
|
@ -266,15 +260,12 @@ static int impl_node_add_port(struct spa_node *node, enum spa_direction directio
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id)
|
||||
impl_node_remove_port(void *object, enum spa_direction direction, uint32_t port_id)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_IN_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_IN_PORT (this, port_id);
|
||||
|
|
@ -303,13 +294,13 @@ impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint3
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int port_enum_formats(struct spa_node *node,
|
||||
static int port_enum_formats(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t index,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct impl *this = object;
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
|
|
@ -333,12 +324,12 @@ static int port_enum_formats(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_enum_params(struct spa_node *node, int seq,
|
||||
impl_node_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
struct spa_pod *param;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
|
|
@ -347,11 +338,8 @@ impl_node_port_enum_params(struct spa_node *node, int seq,
|
|||
uint32_t count = 0;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(num != 0, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
|
@ -365,7 +353,7 @@ impl_node_port_enum_params(struct spa_node *node, int seq,
|
|||
|
||||
switch (id) {
|
||||
case SPA_PARAM_EnumFormat:
|
||||
if ((res = port_enum_formats(node, direction, port_id, result.index, ¶m, &b)) <= 0)
|
||||
if ((res = port_enum_formats(this, direction, port_id, result.index, ¶m, &b)) <= 0)
|
||||
return res;
|
||||
break;
|
||||
|
||||
|
|
@ -471,13 +459,13 @@ static struct buffer *dequeue_buffer(struct impl *this, struct port *port)
|
|||
return b;
|
||||
}
|
||||
|
||||
static int port_set_format(struct spa_node *node,
|
||||
static int port_set_format(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const struct spa_pod *format)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
int res;
|
||||
|
||||
|
|
@ -538,41 +526,35 @@ static int port_set_format(struct spa_node *node,
|
|||
|
||||
|
||||
static int
|
||||
impl_node_port_set_param(struct spa_node *node,
|
||||
impl_node_port_set_param(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct impl *this = object;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
if (id == SPA_PARAM_Format) {
|
||||
return port_set_format(node, direction, port_id, flags, param);
|
||||
return port_set_format(this, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_use_buffers(struct spa_node *node,
|
||||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
|
@ -612,7 +594,7 @@ impl_node_port_use_buffers(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
impl_node_port_alloc_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod **params,
|
||||
|
|
@ -624,17 +606,14 @@ impl_node_port_alloc_buffers(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_set_io(struct spa_node *node,
|
||||
impl_node_port_set_io(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
|
@ -649,15 +628,12 @@ impl_node_port_set_io(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
||||
static int impl_node_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, SPA_DIRECTION_OUTPUT, port_id), -EINVAL);
|
||||
port = GET_OUT_PORT(this, 0);
|
||||
|
||||
|
|
@ -721,18 +697,16 @@ static void mix_2(float * dst, const float * SPA_RESTRICT src1,
|
|||
#endif
|
||||
|
||||
|
||||
static int impl_node_process(struct spa_node *node)
|
||||
static int impl_node_process(void *object)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *outport;
|
||||
struct spa_io_buffers *outio;
|
||||
uint32_t n_samples, n_buffers, i, maxsize;
|
||||
struct buffer **buffers;
|
||||
struct buffer *outb;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
outport = GET_OUT_PORT(this, 0);
|
||||
outio = outport->io;
|
||||
|
|
@ -825,8 +799,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
return SPA_STATUS_HAVE_BUFFER | SPA_STATUS_NEED_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
static const struct spa_node_methods impl_node = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.add_listener = impl_node_add_listener,
|
||||
.set_callbacks = impl_node_set_callbacks,
|
||||
.enum_params = impl_node_enum_params,
|
||||
|
|
@ -899,7 +873,10 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
this->node = impl_node;
|
||||
this->node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_node, this);
|
||||
this->info = SPA_NODE_INFO_INIT();
|
||||
this->info.max_input_ports = MAX_PORTS;
|
||||
this->info.max_output_ports = 1;
|
||||
|
|
|
|||
|
|
@ -173,6 +173,33 @@ struct impl {
|
|||
int other_fds[2];
|
||||
};
|
||||
|
||||
#define pw_client_node_resource(r,m,v,...) \
|
||||
pw_resource_notify_res(r,struct pw_client_node_proxy_events,m,v,__VA_ARGS__)
|
||||
|
||||
#define pw_client_node_resource_add_mem(r,...) \
|
||||
pw_client_node_resource(r,add_mem,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_transport(r,...) \
|
||||
pw_client_node_resource(r,transport,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_set_param(r,...) \
|
||||
pw_client_node_resource(r,set_param,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_set_io(r,...) \
|
||||
pw_client_node_resource(r,set_io,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_event(r,...) \
|
||||
pw_client_node_resource(r,event,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_command(r,...) \
|
||||
pw_client_node_resource(r,command,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_add_port(r,...) \
|
||||
pw_client_node_resource(r,add_port,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_remove_port(r,...) \
|
||||
pw_client_node_resource(r,remove_port,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_port_set_param(r,...) \
|
||||
pw_client_node_resource(r,port_set_param,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_port_use_buffers(r,...) \
|
||||
pw_client_node_resource(r,port_use_buffers,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_port_set_io(r,...) \
|
||||
pw_client_node_resource(r,port_set_io,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_set_activation(r,...) \
|
||||
pw_client_node_resource(r,set_activation,0,__VA_ARGS__)
|
||||
static int
|
||||
do_port_use_buffers(struct impl *impl,
|
||||
enum spa_direction direction,
|
||||
|
|
@ -356,21 +383,19 @@ static void mix_clear(struct node *this, struct mix *mix)
|
|||
mix->valid = false;
|
||||
}
|
||||
|
||||
static int impl_node_enum_params(struct spa_node *node, int seq,
|
||||
static int impl_node_enum_params(void *object, int seq,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
uint8_t buffer[1024];
|
||||
struct spa_pod_builder b = { 0 };
|
||||
struct spa_result_node_params result;
|
||||
uint32_t count = 0;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(num != 0, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
|
||||
result.id = id;
|
||||
result.next = start;
|
||||
|
||||
|
|
@ -399,14 +424,12 @@ static int impl_node_enum_params(struct spa_node *node, int seq,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
if (this->resource == NULL)
|
||||
return -EIO;
|
||||
|
|
@ -414,17 +437,16 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
return pw_client_node_resource_set_param(this->resource, id, flags, param);
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
struct pw_memblock *mem;
|
||||
struct mem *m;
|
||||
uint32_t memid, mem_offset, mem_size;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (impl->this.flags & 1)
|
||||
|
|
@ -461,19 +483,17 @@ static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
static int impl_node_send_command(void *object, const struct spa_command *command)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(command != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
|
||||
if (this->resource == NULL)
|
||||
return -EIO;
|
||||
|
||||
pw_log_debug("client-node %p: send command %d", node, SPA_COMMAND_TYPE(command));
|
||||
pw_log_debug("client-node %p: send command %d", this, SPA_COMMAND_TYPE(command));
|
||||
return pw_client_node_resource_command(this->resource, command);
|
||||
}
|
||||
|
||||
|
|
@ -484,18 +504,17 @@ static void emit_port_info(struct node *this, struct port *port)
|
|||
port->direction, port->id, &port->info);
|
||||
}
|
||||
|
||||
static int impl_node_add_listener(struct spa_node *node,
|
||||
static int impl_node_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct spa_node_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct spa_hook_list save;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
spa_hook_list_isolate(&this->hooks, &save, listener, events, data);
|
||||
|
||||
for (i = 0; i < MAX_INPUTS; i++) {
|
||||
|
|
@ -512,29 +531,30 @@ static int impl_node_add_listener(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
impl_node_set_callbacks(void *object,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *data)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
this->callbacks = SPA_CALLBACKS_INIT(callbacks, data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_sync(struct spa_node *node, int seq)
|
||||
impl_node_sync(void *object, int seq)
|
||||
{
|
||||
struct node *this;
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
pw_log_debug("client-node %p: sync", node);
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
pw_log_debug("client-node %p: sync", this);
|
||||
if (this->resource == NULL)
|
||||
return -EIO;
|
||||
|
||||
return pw_resource_ping(this->resource, seq);
|
||||
}
|
||||
|
||||
|
|
@ -622,50 +642,43 @@ clear_port(struct node *this, struct port *port)
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
impl_node_add_port(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
const struct spa_dict *props)
|
||||
{
|
||||
struct node *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_FREE_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
return pw_client_node_resource_add_port(this->resource, direction, port_id, props);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id)
|
||||
impl_node_remove_port(void *object, enum spa_direction direction, uint32_t port_id)
|
||||
{
|
||||
struct node *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
return pw_client_node_resource_remove_port(this->resource, direction, port_id);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_enum_params(struct spa_node *node, int seq,
|
||||
impl_node_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct port *port;
|
||||
uint8_t buffer[1024];
|
||||
struct spa_pod_builder b = { 0 };
|
||||
struct spa_result_node_params result;
|
||||
uint32_t count = 0;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(num != 0, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
|
@ -702,17 +715,14 @@ impl_node_port_enum_params(struct spa_node *node, int seq,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_set_param(struct spa_node *node,
|
||||
impl_node_port_set_param(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct node *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
if (this->resource == NULL)
|
||||
|
|
@ -783,7 +793,7 @@ static int do_port_set_io(struct impl *impl,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_set_io(struct spa_node *node,
|
||||
impl_node_port_set_io(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t id,
|
||||
|
|
@ -907,18 +917,17 @@ do_port_use_buffers(struct impl *impl,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_use_buffers(struct spa_node *node,
|
||||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
return do_port_use_buffers(impl, direction, port_id,
|
||||
|
|
@ -926,7 +935,7 @@ impl_node_port_use_buffers(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
impl_node_port_alloc_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod **params,
|
||||
|
|
@ -934,14 +943,11 @@ impl_node_port_alloc_buffers(struct spa_node *node,
|
|||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(buffers != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
|
@ -954,13 +960,11 @@ impl_node_port_alloc_buffers(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
||||
impl_node_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct node *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_OUT_PORT(this, SPA_DIRECTION_OUTPUT, port_id), -EINVAL);
|
||||
|
||||
spa_log_trace_fp(this->log, "reuse buffer %d", buffer_id);
|
||||
|
|
@ -968,9 +972,9 @@ impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t bu
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_process(struct spa_node *node)
|
||||
static int impl_node_process(void *object)
|
||||
{
|
||||
struct node *this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
struct node *this = object;
|
||||
struct impl *impl = this->impl;
|
||||
struct pw_node *n = impl->this.node;
|
||||
struct timespec ts;
|
||||
|
|
@ -988,18 +992,22 @@ static int impl_node_process(struct spa_node *node)
|
|||
return SPA_STATUS_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
static struct pw_node_proxy *
|
||||
client_node_get_node(void *data,
|
||||
uint32_t version,
|
||||
uint32_t new_id)
|
||||
size_t user_data_size)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
struct node *this = &impl->node;
|
||||
uint32_t new_id = user_data_size;
|
||||
|
||||
pw_log_debug("node %p: bind %u/%u", this, new_id, version);
|
||||
|
||||
impl->bind_node_version = version;
|
||||
impl->bind_node_id = new_id;
|
||||
pw_map_insert_at(&this->resource->client->objects, new_id, NULL);
|
||||
return 0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -1118,9 +1126,8 @@ static void node_on_data_fd_events(struct spa_source *source)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
static const struct spa_node_methods impl_node = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.add_listener = impl_node_add_listener,
|
||||
.set_callbacks = impl_node_set_callbacks,
|
||||
.sync = impl_node_sync,
|
||||
|
|
@ -1164,7 +1171,10 @@ node_init(struct node *this,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
this->node = impl_node;
|
||||
this->node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_node, this);
|
||||
spa_hook_list_init(&this->hooks);
|
||||
spa_list_init(&this->pending_list);
|
||||
|
||||
|
|
@ -1380,59 +1390,59 @@ static const struct pw_port_implementation port_impl = {
|
|||
};
|
||||
|
||||
static int
|
||||
impl_mix_port_enum_params(struct spa_node *node, int seq,
|
||||
impl_mix_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct port *port = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
struct port *port = object;
|
||||
return impl_node_port_enum_params(&port->node->node, seq, direction, port->id,
|
||||
id, start, num, filter);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_mix_port_set_param(struct spa_node *node,
|
||||
impl_mix_port_set_param(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct port *port = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
struct port *port = object;
|
||||
return impl_node_port_set_param(&port->node->node, direction, port->id,
|
||||
id, flags, param);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_mix_add_port(struct spa_node *node, enum spa_direction direction, uint32_t mix_id,
|
||||
impl_mix_add_port(void *object, enum spa_direction direction, uint32_t mix_id,
|
||||
const struct spa_dict *props)
|
||||
{
|
||||
struct port *port = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
pw_log_debug("client-node %p: add port %d:%d.%d", node, direction, port->id, mix_id);
|
||||
struct port *port = object;
|
||||
pw_log_debug("client-node %p: add port %d:%d.%d", object, direction, port->id, mix_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_mix_remove_port(struct spa_node *node, enum spa_direction direction, uint32_t mix_id)
|
||||
impl_mix_remove_port(void *object, enum spa_direction direction, uint32_t mix_id)
|
||||
{
|
||||
struct port *port = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
pw_log_debug("client-node %p: remove port %d:%d.%d", node, direction, port->id, mix_id);
|
||||
struct port *port = object;
|
||||
pw_log_debug("client-node %p: remove port %d:%d.%d", object, direction, port->id, mix_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_mix_port_use_buffers(struct spa_node *node,
|
||||
impl_mix_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t mix_id,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
struct port *port = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
struct port *port = object;
|
||||
struct impl *impl = port->impl;
|
||||
|
||||
return do_port_use_buffers(impl, direction, port->id, mix_id, buffers, n_buffers);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_mix_port_alloc_buffers(struct spa_node *node,
|
||||
impl_mix_port_alloc_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod **params,
|
||||
|
|
@ -1443,11 +1453,11 @@ impl_mix_port_alloc_buffers(struct spa_node *node,
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_mix_port_set_io(struct spa_node *node,
|
||||
static int impl_mix_port_set_io(void *object,
|
||||
enum spa_direction direction, uint32_t mix_id,
|
||||
uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct port *p = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
struct port *p = object;
|
||||
struct pw_port *port = p->port;
|
||||
struct impl *impl = port->owner_data;
|
||||
struct pw_port_mix *mix;
|
||||
|
|
@ -1469,20 +1479,19 @@ static int impl_mix_port_set_io(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_mix_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
||||
impl_mix_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct port *p = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
struct port *p = object;
|
||||
return impl_node_port_reuse_buffer(&p->node->node, p->id, buffer_id);
|
||||
}
|
||||
|
||||
static int impl_mix_process(struct spa_node *data)
|
||||
static int impl_mix_process(void *object)
|
||||
{
|
||||
return SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_node impl_port_mix = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
static const struct spa_node_methods impl_port_mix = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.port_enum_params = impl_mix_port_enum_params,
|
||||
.port_set_param = impl_mix_port_set_param,
|
||||
.add_port = impl_mix_add_port,
|
||||
|
|
@ -1508,7 +1517,10 @@ static void node_port_init(void *data, struct pw_port *port)
|
|||
p->direction = port->direction;
|
||||
p->id = port->port_id;
|
||||
p->impl = impl;
|
||||
p->mix_node = impl_port_mix;
|
||||
p->mix_node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_port_mix, p);
|
||||
mix_init(&p->mix[MAX_MIX], p, SPA_ID_INVALID);
|
||||
|
||||
if (p->direction == SPA_DIRECTION_INPUT) {
|
||||
|
|
@ -1526,7 +1538,7 @@ static void node_port_added(void *data, struct pw_port *port)
|
|||
struct impl *impl = data;
|
||||
struct port *p = pw_port_get_user_data(port);
|
||||
|
||||
pw_port_set_mix(port, &p->mix_node,
|
||||
pw_port_set_mix(port, (struct spa_node *)&p->mix_node,
|
||||
PW_PORT_MIX_FLAG_MULTI |
|
||||
PW_PORT_MIX_FLAG_MIX_ONLY);
|
||||
|
||||
|
|
@ -1613,7 +1625,7 @@ static int process_node(void *data)
|
|||
{
|
||||
struct impl *impl = data;
|
||||
pw_log_trace_fp("client-node %p: process", impl);
|
||||
return spa_node_process(&impl->node.node);
|
||||
return spa_node_process((struct spa_node*)&impl->node.node);
|
||||
}
|
||||
|
||||
/** Create a new client node
|
||||
|
|
@ -1670,7 +1682,7 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
|||
name,
|
||||
PW_SPA_NODE_FLAG_ASYNC |
|
||||
(do_register ? 0 : PW_SPA_NODE_FLAG_NO_REGISTER),
|
||||
&impl->node.node,
|
||||
(struct spa_node *)&impl->node.node,
|
||||
NULL,
|
||||
properties, 0);
|
||||
if (this->node == NULL)
|
||||
|
|
|
|||
|
|
@ -116,11 +116,11 @@ struct impl {
|
|||
|
||||
/** \endcond */
|
||||
|
||||
static int impl_node_enum_params(struct spa_node *node, int seq,
|
||||
static int impl_node_enum_params(void *object, int seq,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
struct spa_pod *param;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
|
|
@ -129,10 +129,9 @@ static int impl_node_enum_params(struct spa_node *node, int seq,
|
|||
uint32_t count = 0;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(num != 0, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
result.id = id;
|
||||
|
|
@ -224,14 +223,13 @@ static void emit_node_info(struct node *this, bool full)
|
|||
}
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
int res = 0;
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
switch (id) {
|
||||
|
|
@ -263,15 +261,14 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
return res;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
int res = 0;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (impl->adapter)
|
||||
|
|
@ -283,15 +280,14 @@ static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size
|
|||
return res;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
static int impl_node_send_command(void *object, const struct spa_command *command)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
switch (SPA_NODE_COMMAND_ID(command)) {
|
||||
|
|
@ -343,19 +339,18 @@ static const struct spa_node_events adapter_node_events = {
|
|||
.result = adapter_result,
|
||||
};
|
||||
|
||||
static int impl_node_add_listener(struct spa_node *node,
|
||||
static int impl_node_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct spa_node_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
struct spa_hook l;
|
||||
struct spa_hook_list save;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
pw_log_debug("%p: add listener %p", this, listener);
|
||||
|
|
@ -375,15 +370,14 @@ static int impl_node_add_listener(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
impl_node_set_callbacks(void *object,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *data)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
|
||||
this->callbacks = SPA_CALLBACKS_INIT(callbacks, data);
|
||||
|
||||
|
|
@ -391,30 +385,28 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_sync(struct spa_node *node, int seq)
|
||||
impl_node_sync(void *object, int seq)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
return spa_node_sync(impl->cnode, seq);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
impl_node_add_port(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
const struct spa_dict *props)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (direction != impl->direction)
|
||||
|
|
@ -427,14 +419,13 @@ impl_node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id)
|
||||
impl_node_remove_port(void *object, enum spa_direction direction, uint32_t port_id)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (direction != this->impl->direction)
|
||||
|
|
@ -444,18 +435,17 @@ impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint3
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_enum_params(struct spa_node *node, int seq,
|
||||
impl_node_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(num != 0, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (direction != impl->direction)
|
||||
|
|
@ -698,18 +688,17 @@ static int negotiate_buffers(struct impl *impl)
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_set_param(struct spa_node *node,
|
||||
impl_node_port_set_param(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (direction != impl->direction)
|
||||
|
|
@ -737,19 +726,18 @@ impl_node_port_set_param(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_set_io(struct spa_node *node,
|
||||
impl_node_port_set_io(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t id,
|
||||
void *data, size_t size)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
int res = 0;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
spa_log_debug(this->log, "set io %d %d %d %d", port_id, id, direction, impl->direction);
|
||||
|
|
@ -769,19 +757,18 @@ impl_node_port_set_io(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_use_buffers(struct spa_node *node,
|
||||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (direction != impl->direction)
|
||||
|
|
@ -802,7 +789,7 @@ impl_node_port_use_buffers(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
impl_node_port_alloc_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod **params,
|
||||
|
|
@ -810,12 +797,11 @@ impl_node_port_alloc_buffers(struct spa_node *node,
|
|||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (direction != impl->direction)
|
||||
|
|
@ -826,22 +812,21 @@ impl_node_port_alloc_buffers(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
||||
impl_node_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
return spa_node_port_reuse_buffer(impl->adapter, port_id, buffer_id);
|
||||
}
|
||||
|
||||
static int impl_node_process(struct spa_node *node)
|
||||
static int impl_node_process(void *object)
|
||||
{
|
||||
struct node *this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
struct node *this = object;
|
||||
struct impl *impl = this->impl;
|
||||
struct spa_io_position *q = impl->this.node->driver_node->rt.position;
|
||||
int status, trigger;
|
||||
|
|
@ -890,8 +875,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
return status;
|
||||
}
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
static const struct spa_node_methods impl_node = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.add_listener = impl_node_add_listener,
|
||||
.set_callbacks = impl_node_set_callbacks,
|
||||
.sync = impl_node_sync,
|
||||
|
|
@ -922,7 +907,10 @@ node_init(struct node *this,
|
|||
if (support[i].type == SPA_TYPE_INTERFACE_Log)
|
||||
this->log = support[i].data;
|
||||
}
|
||||
this->node = impl_node;
|
||||
this->node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_node, this);
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
this->info_all = SPA_NODE_CHANGE_MASK_PARAMS;
|
||||
|
|
@ -1301,7 +1289,7 @@ struct pw_client_stream *pw_client_stream_new(struct pw_resource *resource,
|
|||
name,
|
||||
PW_SPA_NODE_FLAG_ASYNC |
|
||||
PW_SPA_NODE_FLAG_ACTIVATE,
|
||||
&impl->node.node,
|
||||
(struct spa_node *)&impl->node.node,
|
||||
NULL,
|
||||
properties, 0);
|
||||
if (this->node == NULL)
|
||||
|
|
|
|||
|
|
@ -47,11 +47,29 @@ static void push_dict(struct spa_pod_builder *b, const struct spa_dict *dict)
|
|||
spa_pod_builder_pop(b, &f);
|
||||
}
|
||||
|
||||
static int
|
||||
client_node_marshal_get_node(void *object, uint32_t version, uint32_t new_id)
|
||||
static int client_node_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_client_node_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct pw_node_proxy *
|
||||
client_node_marshal_get_node(void *object, uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
struct pw_proxy *res;
|
||||
uint32_t new_id;
|
||||
|
||||
res = pw_proxy_new(object, PW_TYPE_INTERFACE_Node, user_data_size);
|
||||
if (res == NULL)
|
||||
return NULL;
|
||||
|
||||
new_id = pw_proxy_get_id(res);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_PROXY_METHOD_GET_NODE, NULL);
|
||||
|
||||
|
|
@ -59,7 +77,9 @@ client_node_marshal_get_node(void *object, uint32_t version, uint32_t new_id)
|
|||
SPA_POD_Int(version),
|
||||
SPA_POD_Int(new_id));
|
||||
|
||||
return pw_protocol_native_end_proxy(proxy, b);
|
||||
pw_protocol_native_end_proxy(proxy, b);
|
||||
|
||||
return (struct pw_node_proxy *) res;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -1000,50 +1020,56 @@ static int client_node_demarshal_event_method(void *object, const struct pw_prot
|
|||
|
||||
static const struct pw_client_node_proxy_methods pw_protocol_native_client_node_method_marshal = {
|
||||
PW_VERSION_CLIENT_NODE_PROXY_METHODS,
|
||||
&client_node_marshal_get_node,
|
||||
&client_node_marshal_update,
|
||||
&client_node_marshal_port_update,
|
||||
&client_node_marshal_set_active,
|
||||
&client_node_marshal_event_method
|
||||
.add_listener = &client_node_marshal_add_listener,
|
||||
.get_node = &client_node_marshal_get_node,
|
||||
.update = &client_node_marshal_update,
|
||||
.port_update = &client_node_marshal_port_update,
|
||||
.set_active = &client_node_marshal_set_active,
|
||||
.event = &client_node_marshal_event_method
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_client_node_method_demarshal[] = {
|
||||
{ &client_node_demarshal_get_node, 0 },
|
||||
{ &client_node_demarshal_update, 0 },
|
||||
{ &client_node_demarshal_port_update, 0 },
|
||||
{ &client_node_demarshal_set_active, 0 },
|
||||
{ &client_node_demarshal_event_method, 0 }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_client_node_method_demarshal[PW_CLIENT_NODE_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_CLIENT_NODE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_METHOD_GET_NODE] = { &client_node_demarshal_get_node, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_METHOD_UPDATE] = { &client_node_demarshal_update, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_METHOD_PORT_UPDATE] = { &client_node_demarshal_port_update, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_METHOD_SET_ACTIVE] = { &client_node_demarshal_set_active, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_METHOD_EVENT] = { &client_node_demarshal_event_method, 0 }
|
||||
};
|
||||
|
||||
static const struct pw_client_node_proxy_events pw_protocol_native_client_node_event_marshal = {
|
||||
PW_VERSION_CLIENT_NODE_PROXY_EVENTS,
|
||||
&client_node_marshal_add_mem,
|
||||
&client_node_marshal_transport,
|
||||
&client_node_marshal_set_param,
|
||||
&client_node_marshal_set_io,
|
||||
&client_node_marshal_event_event,
|
||||
&client_node_marshal_command,
|
||||
&client_node_marshal_add_port,
|
||||
&client_node_marshal_remove_port,
|
||||
&client_node_marshal_port_set_param,
|
||||
&client_node_marshal_port_use_buffers,
|
||||
&client_node_marshal_port_set_io,
|
||||
&client_node_marshal_set_activation,
|
||||
.add_mem = &client_node_marshal_add_mem,
|
||||
.transport = &client_node_marshal_transport,
|
||||
.set_param = &client_node_marshal_set_param,
|
||||
.set_io = &client_node_marshal_set_io,
|
||||
.event = &client_node_marshal_event_event,
|
||||
.command = &client_node_marshal_command,
|
||||
.add_port = &client_node_marshal_add_port,
|
||||
.remove_port = &client_node_marshal_remove_port,
|
||||
.port_set_param = &client_node_marshal_port_set_param,
|
||||
.port_use_buffers = &client_node_marshal_port_use_buffers,
|
||||
.port_set_io = &client_node_marshal_port_set_io,
|
||||
.set_activation = &client_node_marshal_set_activation,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_client_node_event_demarshal[] = {
|
||||
{ &client_node_demarshal_add_mem, 0 },
|
||||
{ &client_node_demarshal_transport, 0 },
|
||||
{ &client_node_demarshal_set_param, 0 },
|
||||
{ &client_node_demarshal_set_io, 0 },
|
||||
{ &client_node_demarshal_event_event, 0 },
|
||||
{ &client_node_demarshal_command, 0 },
|
||||
{ &client_node_demarshal_add_port, 0 },
|
||||
{ &client_node_demarshal_remove_port, 0 },
|
||||
{ &client_node_demarshal_port_set_param, 0 },
|
||||
{ &client_node_demarshal_port_use_buffers, 0 },
|
||||
{ &client_node_demarshal_port_set_io, 0 },
|
||||
{ &client_node_demarshal_set_activation, 0 }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_client_node_event_demarshal[PW_CLIENT_NODE_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_ADD_MEM] = { &client_node_demarshal_add_mem, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_TRANSPORT] = { &client_node_demarshal_transport, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_SET_PARAM] = { &client_node_demarshal_set_param, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_SET_IO] = { &client_node_demarshal_set_io, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_EVENT] = { &client_node_demarshal_event_event, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_COMMAND] = { &client_node_demarshal_command, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_ADD_PORT] = { &client_node_demarshal_add_port, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_REMOVE_PORT] = { &client_node_demarshal_remove_port, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_PORT_SET_PARAM] = { &client_node_demarshal_port_set_param, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_PORT_USE_BUFFERS] = { &client_node_demarshal_port_use_buffers, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_PORT_SET_IO] = { &client_node_demarshal_port_set_io, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_SET_ACTIVATION] = { &client_node_demarshal_set_activation, 0 }
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_client_node_marshal = {
|
||||
|
|
|
|||
|
|
@ -1218,7 +1218,7 @@ 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, 0);
|
||||
PW_VERSION_NODE_PROXY, 0);
|
||||
|
||||
return data->proxy;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ static void *create_object(void *_data,
|
|||
ld->global = pw_link_get_global(link);
|
||||
pw_global_add_listener(ld->global, &ld->global_listener, &global_events, ld);
|
||||
|
||||
res = pw_global_bind(ld->global, client, PW_PERM_RWX, PW_VERSION_LINK, new_id);
|
||||
res = pw_global_bind(ld->global, client, PW_PERM_RWX, PW_VERSION_LINK_PROXY, new_id);
|
||||
if (res < 0)
|
||||
goto no_bind;
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
factory = pw_factory_new(core,
|
||||
"link-factory",
|
||||
PW_TYPE_INTERFACE_Link,
|
||||
PW_VERSION_LINK,
|
||||
PW_VERSION_LINK_PROXY,
|
||||
NULL,
|
||||
sizeof(*data));
|
||||
if (factory == NULL)
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ static struct pw_client *client_new(struct server *s, int fd)
|
|||
pw_client_add_listener(client, &this->client_listener, &client_events, this);
|
||||
|
||||
if (pw_global_bind(pw_core_get_global(core), client,
|
||||
PW_PERM_RWX, PW_VERSION_CORE, 0) < 0)
|
||||
PW_PERM_RWX, PW_VERSION_CORE_PROXY, 0) < 0)
|
||||
goto cleanup_client;
|
||||
|
||||
props = pw_properties_copy(pw_client_get_properties(client));
|
||||
|
|
@ -307,7 +307,7 @@ static struct pw_client *client_new(struct server *s, int fd)
|
|||
goto cleanup_client;
|
||||
|
||||
if (pw_global_bind(pw_client_get_global(client), client,
|
||||
PW_PERM_RWX, PW_VERSION_CLIENT, 1) < 0)
|
||||
PW_PERM_RWX, PW_VERSION_CLIENT_PROXY, 1) < 0)
|
||||
goto cleanup_client;
|
||||
|
||||
return client;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,16 @@
|
|||
|
||||
#include "connection.h"
|
||||
|
||||
static int core_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_core_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int core_method_marshal_hello(void *object, uint32_t version)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
|
|
@ -90,10 +100,19 @@ static int core_method_marshal_error(void *object, uint32_t id, int seq, int res
|
|||
return pw_protocol_native_end_proxy(proxy, b);
|
||||
}
|
||||
|
||||
static int core_method_marshal_get_registry(void *object, uint32_t version, uint32_t new_id)
|
||||
static struct pw_registry_proxy * core_method_marshal_get_registry(void *object,
|
||||
uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
struct pw_proxy *res;
|
||||
uint32_t new_id;
|
||||
|
||||
res = pw_proxy_new(object, PW_TYPE_INTERFACE_Registry, user_data_size);
|
||||
if (res == NULL)
|
||||
return NULL;
|
||||
|
||||
new_id = pw_proxy_get_id(res);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_GET_REGISTRY, NULL);
|
||||
|
||||
|
|
@ -101,7 +120,9 @@ static int core_method_marshal_get_registry(void *object, uint32_t version, uint
|
|||
SPA_POD_Int(version),
|
||||
SPA_POD_Int(new_id));
|
||||
|
||||
return pw_protocol_native_end_proxy(proxy, b);
|
||||
pw_protocol_native_end_proxy(proxy, b);
|
||||
|
||||
return (struct pw_registry_proxy *) res;
|
||||
}
|
||||
|
||||
static void push_dict(struct spa_pod_builder *b, const struct spa_dict *dict)
|
||||
|
|
@ -135,15 +156,23 @@ static void push_params(struct spa_pod_builder *b, uint32_t n_params,
|
|||
spa_pod_builder_pop(b, &f);
|
||||
}
|
||||
|
||||
static int
|
||||
static void *
|
||||
core_method_marshal_create_object(void *object,
|
||||
const char *factory_name,
|
||||
uint32_t type, uint32_t version,
|
||||
const struct spa_dict *props, uint32_t new_id)
|
||||
const struct spa_dict *props, size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
struct pw_proxy *res;
|
||||
uint32_t new_id;
|
||||
|
||||
res = pw_proxy_new(object, type, user_data_size);
|
||||
if (res == NULL)
|
||||
return NULL;
|
||||
|
||||
new_id = pw_proxy_get_id(res);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_CREATE_OBJECT, NULL);
|
||||
|
||||
|
|
@ -157,14 +186,17 @@ core_method_marshal_create_object(void *object,
|
|||
spa_pod_builder_int(b, new_id);
|
||||
spa_pod_builder_pop(b, &f);
|
||||
|
||||
return pw_protocol_native_end_proxy(proxy, b);
|
||||
pw_protocol_native_end_proxy(proxy, b);
|
||||
|
||||
return (void *)res;
|
||||
}
|
||||
|
||||
static int
|
||||
core_method_marshal_destroy(void *object, uint32_t id)
|
||||
core_method_marshal_destroy(void *object, void *p)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
uint32_t id = pw_proxy_get_id(p);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_DESTROY, NULL);
|
||||
|
||||
|
|
@ -480,6 +512,8 @@ static int core_method_demarshal_create_object(void *object, const struct pw_pro
|
|||
static int core_method_demarshal_destroy(void *object, const struct pw_protocol_native_message *msg)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_client *client = pw_resource_get_client(resource);
|
||||
struct pw_resource *r;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t id;
|
||||
|
||||
|
|
@ -488,7 +522,27 @@ static int core_method_demarshal_destroy(void *object, const struct pw_protocol_
|
|||
SPA_POD_Int(&id)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_do(resource, struct pw_core_proxy_methods, destroy, 0, id);
|
||||
pw_log_debug("client %p: destroy resource %d", client, id);
|
||||
|
||||
if ((r = pw_client_find_resource(client, id)) == NULL)
|
||||
goto no_resource;
|
||||
|
||||
return pw_resource_do(resource, struct pw_core_proxy_methods, destroy, 0, r);
|
||||
|
||||
no_resource:
|
||||
pw_log_error("client %p: can't find resouce %d", client, id);
|
||||
pw_resource_error(resource, -EINVAL, "unknown resource %d", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int registry_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_registry_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void registry_marshal_global(void *object, uint32_t id, uint32_t parent_id, uint32_t permissions,
|
||||
|
|
@ -557,6 +611,16 @@ static int registry_demarshal_destroy(void *object, const struct pw_protocol_nat
|
|||
return pw_resource_do(resource, struct pw_registry_proxy_methods, destroy, 0, id);
|
||||
}
|
||||
|
||||
static int module_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_module_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void module_marshal_info(void *object, const struct pw_module_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -614,6 +678,16 @@ static int module_demarshal_info(void *object, const struct pw_protocol_native_m
|
|||
return pw_proxy_notify(proxy, struct pw_module_proxy_events, info, 0, &info);
|
||||
}
|
||||
|
||||
static int device_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_device_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void device_marshal_info(void *object, const struct pw_device_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -795,6 +869,16 @@ static int device_demarshal_set_param(void *object, const struct pw_protocol_nat
|
|||
return pw_resource_do(resource, struct pw_device_proxy_methods, set_param, 0, id, flags, param);
|
||||
}
|
||||
|
||||
static int factory_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_factory_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void factory_marshal_info(void *object, const struct pw_factory_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -852,6 +936,16 @@ static int factory_demarshal_info(void *object, const struct pw_protocol_native_
|
|||
return pw_proxy_notify(proxy, struct pw_factory_proxy_events, info, 0, &info);
|
||||
}
|
||||
|
||||
static int node_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_node_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void node_marshal_info(void *object, const struct pw_node_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -1102,6 +1196,16 @@ static int node_demarshal_send_command(void *object, const struct pw_protocol_na
|
|||
return pw_resource_do(resource, struct pw_node_proxy_methods, send_command, 0, command);
|
||||
}
|
||||
|
||||
static int port_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_port_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void port_marshal_info(void *object, const struct pw_port_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -1282,6 +1386,16 @@ static int port_demarshal_enum_params(void *object, const struct pw_protocol_nat
|
|||
seq, id, index, num, filter);
|
||||
}
|
||||
|
||||
static int client_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_client_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void client_marshal_info(void *object, const struct pw_client_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -1540,6 +1654,16 @@ static int client_demarshal_update_permissions(void *object, const struct pw_pro
|
|||
n_permissions, permissions);
|
||||
}
|
||||
|
||||
static int link_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_link_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void link_marshal_info(void *object, const struct pw_link_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -1655,11 +1779,19 @@ static int registry_demarshal_global_remove(void *object, const struct pw_protoc
|
|||
return pw_proxy_notify(proxy, struct pw_registry_proxy_events, global_remove, 0, id);
|
||||
}
|
||||
|
||||
static int registry_marshal_bind(void *object, uint32_t id,
|
||||
uint32_t type, uint32_t version, uint32_t new_id)
|
||||
static void * registry_marshal_bind(void *object, uint32_t id,
|
||||
uint32_t type, uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
struct pw_proxy *res;
|
||||
uint32_t new_id;
|
||||
|
||||
res = pw_proxy_new(object, type, user_data_size);
|
||||
if (res == NULL)
|
||||
return NULL;
|
||||
|
||||
new_id = pw_proxy_get_id(res);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_REGISTRY_PROXY_METHOD_BIND, NULL);
|
||||
|
||||
|
|
@ -1669,7 +1801,9 @@ static int registry_marshal_bind(void *object, uint32_t id,
|
|||
SPA_POD_Int(version),
|
||||
SPA_POD_Int(new_id));
|
||||
|
||||
return pw_protocol_native_end_proxy(proxy, b);
|
||||
pw_protocol_native_end_proxy(proxy, b);
|
||||
|
||||
return (void *) res;
|
||||
}
|
||||
|
||||
static int registry_marshal_destroy(void *object, uint32_t id)
|
||||
|
|
@ -1685,45 +1819,49 @@ static int registry_marshal_destroy(void *object, uint32_t id)
|
|||
|
||||
static const struct pw_core_proxy_methods pw_protocol_native_core_method_marshal = {
|
||||
PW_VERSION_CORE_PROXY_METHODS,
|
||||
&core_method_marshal_hello,
|
||||
&core_method_marshal_sync,
|
||||
&core_method_marshal_pong,
|
||||
&core_method_marshal_error,
|
||||
&core_method_marshal_get_registry,
|
||||
&core_method_marshal_create_object,
|
||||
&core_method_marshal_destroy,
|
||||
.add_listener = &core_method_marshal_add_listener,
|
||||
.hello = &core_method_marshal_hello,
|
||||
.sync = &core_method_marshal_sync,
|
||||
.pong = &core_method_marshal_pong,
|
||||
.error = &core_method_marshal_error,
|
||||
.get_registry = &core_method_marshal_get_registry,
|
||||
.create_object = &core_method_marshal_create_object,
|
||||
.destroy = &core_method_marshal_destroy,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_method_demarshal[PW_CORE_PROXY_METHOD_NUM] = {
|
||||
{ &core_method_demarshal_hello, 0, },
|
||||
{ &core_method_demarshal_sync, 0, },
|
||||
{ &core_method_demarshal_pong, 0, },
|
||||
{ &core_method_demarshal_error, 0, },
|
||||
{ &core_method_demarshal_get_registry, 0, },
|
||||
{ &core_method_demarshal_create_object, 0, },
|
||||
{ &core_method_demarshal_destroy, 0, }
|
||||
[PW_CORE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_CORE_PROXY_METHOD_HELLO] = { &core_method_demarshal_hello, 0, },
|
||||
[PW_CORE_PROXY_METHOD_SYNC] = { &core_method_demarshal_sync, 0, },
|
||||
[PW_CORE_PROXY_METHOD_PONG] = { &core_method_demarshal_pong, 0, },
|
||||
[PW_CORE_PROXY_METHOD_ERROR] = { &core_method_demarshal_error, 0, },
|
||||
[PW_CORE_PROXY_METHOD_GET_REGISTRY] = { &core_method_demarshal_get_registry, 0, },
|
||||
[PW_CORE_PROXY_METHOD_CREATE_OBJECT] = { &core_method_demarshal_create_object, 0, },
|
||||
[PW_CORE_PROXY_METHOD_DESTROY] = { &core_method_demarshal_destroy, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_core_proxy_events pw_protocol_native_core_event_marshal = {
|
||||
PW_VERSION_CORE_PROXY_EVENTS,
|
||||
&core_event_marshal_info,
|
||||
&core_event_marshal_done,
|
||||
&core_event_marshal_ping,
|
||||
&core_event_marshal_error,
|
||||
&core_event_marshal_remove_id,
|
||||
.info = &core_event_marshal_info,
|
||||
.done = &core_event_marshal_done,
|
||||
.ping = &core_event_marshal_ping,
|
||||
.error = &core_event_marshal_error,
|
||||
.remove_id = &core_event_marshal_remove_id,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_event_demarshal[PW_CORE_PROXY_EVENT_NUM] = {
|
||||
{ &core_event_demarshal_info, 0, },
|
||||
{ &core_event_demarshal_done, 0, },
|
||||
{ &core_event_demarshal_ping, 0, },
|
||||
{ &core_event_demarshal_error, 0, },
|
||||
{ &core_event_demarshal_remove_id, 0, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_core_event_demarshal[PW_CORE_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_CORE_PROXY_EVENT_INFO] = { &core_event_demarshal_info, 0, },
|
||||
[PW_CORE_PROXY_EVENT_DONE] = { &core_event_demarshal_done, 0, },
|
||||
[PW_CORE_PROXY_EVENT_PING] = { &core_event_demarshal_ping, 0, },
|
||||
[PW_CORE_PROXY_EVENT_ERROR] = { &core_event_demarshal_error, 0, },
|
||||
[PW_CORE_PROXY_EVENT_REMOVE_ID] = { &core_event_demarshal_remove_id, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
||||
PW_TYPE_INTERFACE_Core,
|
||||
PW_VERSION_CORE,
|
||||
PW_VERSION_CORE_PROXY,
|
||||
PW_CORE_PROXY_METHOD_NUM,
|
||||
PW_CORE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_core_method_marshal,
|
||||
|
|
@ -1734,29 +1872,35 @@ static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
|||
|
||||
static const struct pw_registry_proxy_methods pw_protocol_native_registry_method_marshal = {
|
||||
PW_VERSION_REGISTRY_PROXY_METHODS,
|
||||
®istry_marshal_bind,
|
||||
®istry_marshal_destroy,
|
||||
.add_listener = ®istry_method_marshal_add_listener,
|
||||
.bind = ®istry_marshal_bind,
|
||||
.destroy = ®istry_marshal_destroy,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_registry_method_demarshal[] = {
|
||||
{ ®istry_demarshal_bind, 0, },
|
||||
{ ®istry_demarshal_destroy, 0, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_registry_method_demarshal[PW_REGISTRY_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_REGISTRY_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_REGISTRY_PROXY_METHOD_BIND] = { ®istry_demarshal_bind, 0, },
|
||||
[PW_REGISTRY_PROXY_METHOD_DESTROY] = { ®istry_demarshal_destroy, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_registry_proxy_events pw_protocol_native_registry_event_marshal = {
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
®istry_marshal_global,
|
||||
®istry_marshal_global_remove,
|
||||
.global = ®istry_marshal_global,
|
||||
.global_remove = ®istry_marshal_global_remove,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_registry_event_demarshal[] = {
|
||||
{ ®istry_demarshal_global, 0, },
|
||||
{ ®istry_demarshal_global_remove, 0, }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_registry_event_demarshal[PW_REGISTRY_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_REGISTRY_PROXY_EVENT_GLOBAL] = { ®istry_demarshal_global, 0, },
|
||||
[PW_REGISTRY_PROXY_EVENT_GLOBAL_REMOVE] = { ®istry_demarshal_global_remove, 0, }
|
||||
};
|
||||
|
||||
const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
|
||||
PW_TYPE_INTERFACE_Registry,
|
||||
PW_VERSION_REGISTRY,
|
||||
PW_VERSION_REGISTRY_PROXY,
|
||||
PW_REGISTRY_PROXY_METHOD_NUM,
|
||||
PW_REGISTRY_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_registry_method_marshal,
|
||||
|
|
@ -1767,67 +1911,100 @@ const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
|
|||
|
||||
static const struct pw_module_proxy_events pw_protocol_native_module_event_marshal = {
|
||||
PW_VERSION_MODULE_PROXY_EVENTS,
|
||||
&module_marshal_info,
|
||||
.info = &module_marshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_module_event_demarshal[] = {
|
||||
{ &module_demarshal_info, 0, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_module_event_demarshal[PW_MODULE_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_MODULE_PROXY_EVENT_INFO] = { &module_demarshal_info, 0, },
|
||||
};
|
||||
|
||||
|
||||
static const struct pw_module_proxy_methods pw_protocol_native_module_method_marshal = {
|
||||
PW_VERSION_MODULE_PROXY_METHODS,
|
||||
.add_listener = &module_method_marshal_add_listener,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_module_method_demarshal[PW_MODULE_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_MODULE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
};
|
||||
|
||||
const struct pw_protocol_marshal pw_protocol_native_module_marshal = {
|
||||
PW_TYPE_INTERFACE_Module,
|
||||
PW_VERSION_MODULE,
|
||||
0,
|
||||
PW_VERSION_MODULE_PROXY,
|
||||
PW_MODULE_PROXY_METHOD_NUM,
|
||||
PW_MODULE_PROXY_EVENT_NUM,
|
||||
NULL, NULL,
|
||||
&pw_protocol_native_module_method_marshal,
|
||||
pw_protocol_native_module_method_demarshal,
|
||||
&pw_protocol_native_module_event_marshal,
|
||||
pw_protocol_native_module_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_factory_proxy_events pw_protocol_native_factory_event_marshal = {
|
||||
PW_VERSION_FACTORY_PROXY_EVENTS,
|
||||
&factory_marshal_info,
|
||||
.info = &factory_marshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_factory_event_demarshal[] = {
|
||||
{ &factory_demarshal_info, 0, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_factory_event_demarshal[PW_FACTORY_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_FACTORY_PROXY_EVENT_INFO] = { &factory_demarshal_info, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_factory_proxy_methods pw_protocol_native_factory_method_marshal = {
|
||||
PW_VERSION_FACTORY_PROXY_METHODS,
|
||||
.add_listener = &factory_method_marshal_add_listener,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_factory_method_demarshal[PW_FACTORY_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_FACTORY_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
};
|
||||
|
||||
const struct pw_protocol_marshal pw_protocol_native_factory_marshal = {
|
||||
PW_TYPE_INTERFACE_Factory,
|
||||
PW_VERSION_FACTORY,
|
||||
0,
|
||||
PW_VERSION_FACTORY_PROXY,
|
||||
PW_FACTORY_PROXY_METHOD_NUM,
|
||||
PW_FACTORY_PROXY_EVENT_NUM,
|
||||
NULL, NULL,
|
||||
&pw_protocol_native_factory_method_marshal,
|
||||
pw_protocol_native_factory_method_demarshal,
|
||||
&pw_protocol_native_factory_event_marshal,
|
||||
pw_protocol_native_factory_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_device_proxy_methods pw_protocol_native_device_method_marshal = {
|
||||
PW_VERSION_DEVICE_PROXY_METHODS,
|
||||
&device_marshal_enum_params,
|
||||
&device_marshal_set_param,
|
||||
.add_listener = &device_method_marshal_add_listener,
|
||||
.enum_params = &device_marshal_enum_params,
|
||||
.set_param = &device_marshal_set_param,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_device_method_demarshal[] = {
|
||||
{ &device_demarshal_enum_params, 0, },
|
||||
{ &device_demarshal_set_param, PW_PERM_W, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_device_method_demarshal[PW_DEVICE_PROXY_METHOD_NUM] = {
|
||||
[PW_DEVICE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_DEVICE_PROXY_METHOD_ENUM_PARAMS] = { &device_demarshal_enum_params, 0, },
|
||||
[PW_DEVICE_PROXY_METHOD_SET_PARAM] = { &device_demarshal_set_param, PW_PERM_W, },
|
||||
};
|
||||
|
||||
static const struct pw_device_proxy_events pw_protocol_native_device_event_marshal = {
|
||||
PW_VERSION_DEVICE_PROXY_EVENTS,
|
||||
&device_marshal_info,
|
||||
&device_marshal_param,
|
||||
.info = &device_marshal_info,
|
||||
.param = &device_marshal_param,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_device_event_demarshal[] = {
|
||||
{ &device_demarshal_info, 0, },
|
||||
{ &device_demarshal_param, 0, }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_device_event_demarshal[PW_DEVICE_PROXY_EVENT_NUM] = {
|
||||
[PW_DEVICE_PROXY_EVENT_INFO] = { &device_demarshal_info, 0, },
|
||||
[PW_DEVICE_PROXY_EVENT_PARAM] = { &device_demarshal_param, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_device_marshal = {
|
||||
PW_TYPE_INTERFACE_Device,
|
||||
PW_VERSION_DEVICE,
|
||||
PW_VERSION_DEVICE_PROXY,
|
||||
PW_DEVICE_PROXY_METHOD_NUM,
|
||||
PW_DEVICE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_device_method_marshal,
|
||||
|
|
@ -1838,33 +2015,38 @@ static const struct pw_protocol_marshal pw_protocol_native_device_marshal = {
|
|||
|
||||
static const struct pw_node_proxy_methods pw_protocol_native_node_method_marshal = {
|
||||
PW_VERSION_NODE_PROXY_METHODS,
|
||||
&node_marshal_subscribe_params,
|
||||
&node_marshal_enum_params,
|
||||
&node_marshal_set_param,
|
||||
&node_marshal_send_command,
|
||||
.add_listener = &node_method_marshal_add_listener,
|
||||
.subscribe_params = &node_marshal_subscribe_params,
|
||||
.enum_params = &node_marshal_enum_params,
|
||||
.set_param = &node_marshal_set_param,
|
||||
.send_command = &node_marshal_send_command,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_node_method_demarshal[] = {
|
||||
{ &node_demarshal_subscribe_params, 0, },
|
||||
{ &node_demarshal_enum_params, 0, },
|
||||
{ &node_demarshal_set_param, PW_PERM_W, },
|
||||
{ &node_demarshal_send_command, PW_PERM_W, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_node_method_demarshal[PW_NODE_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_NODE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_NODE_PROXY_METHOD_SUBSCRIBE_PARAMS] = { &node_demarshal_subscribe_params, 0, },
|
||||
[PW_NODE_PROXY_METHOD_ENUM_PARAMS] = { &node_demarshal_enum_params, 0, },
|
||||
[PW_NODE_PROXY_METHOD_SET_PARAM] = { &node_demarshal_set_param, PW_PERM_W, },
|
||||
[PW_NODE_PROXY_METHOD_SEND_COMMAND] = { &node_demarshal_send_command, PW_PERM_W, },
|
||||
};
|
||||
|
||||
static const struct pw_node_proxy_events pw_protocol_native_node_event_marshal = {
|
||||
PW_VERSION_NODE_PROXY_EVENTS,
|
||||
&node_marshal_info,
|
||||
&node_marshal_param,
|
||||
.info = &node_marshal_info,
|
||||
.param = &node_marshal_param,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_node_event_demarshal[] = {
|
||||
{ &node_demarshal_info, 0, },
|
||||
{ &node_demarshal_param, 0, }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_node_event_demarshal[PW_NODE_PROXY_EVENT_NUM] = {
|
||||
[PW_NODE_PROXY_EVENT_INFO] = { &node_demarshal_info, 0, },
|
||||
[PW_NODE_PROXY_EVENT_PARAM] = { &node_demarshal_param, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_node_marshal = {
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
PW_NODE_PROXY_METHOD_NUM,
|
||||
PW_NODE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_node_method_marshal,
|
||||
|
|
@ -1876,29 +2058,35 @@ static const struct pw_protocol_marshal pw_protocol_native_node_marshal = {
|
|||
|
||||
static const struct pw_port_proxy_methods pw_protocol_native_port_method_marshal = {
|
||||
PW_VERSION_PORT_PROXY_METHODS,
|
||||
&port_marshal_subscribe_params,
|
||||
&port_marshal_enum_params,
|
||||
.add_listener = &port_method_marshal_add_listener,
|
||||
.subscribe_params = &port_marshal_subscribe_params,
|
||||
.enum_params = &port_marshal_enum_params,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_port_method_demarshal[] = {
|
||||
{ &port_demarshal_subscribe_params, 0, },
|
||||
{ &port_demarshal_enum_params, 0, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_port_method_demarshal[PW_PORT_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_PORT_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_PORT_PROXY_METHOD_SUBSCRIBE_PARAMS] = { &port_demarshal_subscribe_params, 0, },
|
||||
[PW_PORT_PROXY_METHOD_ENUM_PARAMS] = { &port_demarshal_enum_params, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_port_proxy_events pw_protocol_native_port_event_marshal = {
|
||||
PW_VERSION_PORT_PROXY_EVENTS,
|
||||
&port_marshal_info,
|
||||
&port_marshal_param,
|
||||
.info = &port_marshal_info,
|
||||
.param = &port_marshal_param,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_port_event_demarshal[] = {
|
||||
{ &port_demarshal_info, 0, },
|
||||
{ &port_demarshal_param, 0, }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_port_event_demarshal[PW_PORT_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_PORT_PROXY_EVENT_INFO] = { &port_demarshal_info, 0, },
|
||||
[PW_PORT_PROXY_EVENT_PARAM] = { &port_demarshal_param, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_port_marshal = {
|
||||
PW_TYPE_INTERFACE_Port,
|
||||
PW_VERSION_PORT,
|
||||
PW_VERSION_PORT_PROXY,
|
||||
PW_PORT_PROXY_METHOD_NUM,
|
||||
PW_PORT_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_port_method_marshal,
|
||||
|
|
@ -1909,33 +2097,39 @@ static const struct pw_protocol_marshal pw_protocol_native_port_marshal = {
|
|||
|
||||
static const struct pw_client_proxy_methods pw_protocol_native_client_method_marshal = {
|
||||
PW_VERSION_CLIENT_PROXY_METHODS,
|
||||
&client_marshal_error,
|
||||
&client_marshal_update_properties,
|
||||
&client_marshal_get_permissions,
|
||||
&client_marshal_update_permissions,
|
||||
.add_listener = &client_method_marshal_add_listener,
|
||||
.error = &client_marshal_error,
|
||||
.update_properties = &client_marshal_update_properties,
|
||||
.get_permissions = &client_marshal_get_permissions,
|
||||
.update_permissions = &client_marshal_update_permissions,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_client_method_demarshal[] = {
|
||||
{ &client_demarshal_error, PW_PERM_W, },
|
||||
{ &client_demarshal_update_properties, PW_PERM_W, },
|
||||
{ &client_demarshal_get_permissions, 0, },
|
||||
{ &client_demarshal_update_permissions, PW_PERM_W, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_client_method_demarshal[PW_CLIENT_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_CLIENT_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_CLIENT_PROXY_METHOD_ERROR] = { &client_demarshal_error, PW_PERM_W, },
|
||||
[PW_CLIENT_PROXY_METHOD_UPDATE_PROPERTIES] = { &client_demarshal_update_properties, PW_PERM_W, },
|
||||
[PW_CLIENT_PROXY_METHOD_GET_PERMISSIONS] = { &client_demarshal_get_permissions, 0, },
|
||||
[PW_CLIENT_PROXY_METHOD_UPDATE_PERMISSIONS] = { &client_demarshal_update_permissions, PW_PERM_W, },
|
||||
};
|
||||
|
||||
static const struct pw_client_proxy_events pw_protocol_native_client_event_marshal = {
|
||||
PW_VERSION_CLIENT_PROXY_EVENTS,
|
||||
&client_marshal_info,
|
||||
&client_marshal_permissions,
|
||||
.info = &client_marshal_info,
|
||||
.permissions = &client_marshal_permissions,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_client_event_demarshal[] = {
|
||||
{ &client_demarshal_info, 0, },
|
||||
{ &client_demarshal_permissions, 0, }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_client_event_demarshal[PW_CLIENT_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_CLIENT_PROXY_EVENT_INFO] = { &client_demarshal_info, 0, },
|
||||
[PW_CLIENT_PROXY_EVENT_PERMISSIONS] = { &client_demarshal_permissions, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_client_marshal = {
|
||||
PW_TYPE_INTERFACE_Client,
|
||||
PW_VERSION_CLIENT,
|
||||
PW_VERSION_CLIENT_PROXY,
|
||||
PW_CLIENT_PROXY_METHOD_NUM,
|
||||
PW_CLIENT_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_client_method_marshal,
|
||||
|
|
@ -1944,21 +2138,36 @@ static const struct pw_protocol_marshal pw_protocol_native_client_marshal = {
|
|||
pw_protocol_native_client_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_link_proxy_events pw_protocol_native_link_event_marshal = {
|
||||
PW_VERSION_LINK_PROXY_EVENTS,
|
||||
&link_marshal_info,
|
||||
|
||||
static const struct pw_link_proxy_methods pw_protocol_native_link_method_marshal = {
|
||||
PW_VERSION_LINK_PROXY_METHODS,
|
||||
.add_listener = &link_method_marshal_add_listener,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_link_event_demarshal[] = {
|
||||
{ &link_demarshal_info, 0, }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_link_method_demarshal[PW_LINK_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_LINK_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_link_proxy_events pw_protocol_native_link_event_marshal = {
|
||||
PW_VERSION_LINK_PROXY_EVENTS,
|
||||
.info = &link_marshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_link_event_demarshal[PW_LINK_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_LINK_PROXY_EVENT_INFO] = { &link_demarshal_info, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_link_marshal = {
|
||||
PW_TYPE_INTERFACE_Link,
|
||||
PW_VERSION_LINK,
|
||||
0,
|
||||
PW_VERSION_LINK_PROXY,
|
||||
PW_LINK_PROXY_METHOD_NUM,
|
||||
PW_LINK_PROXY_EVENT_NUM,
|
||||
NULL, NULL,
|
||||
&pw_protocol_native_link_method_marshal,
|
||||
pw_protocol_native_link_method_demarshal,
|
||||
&pw_protocol_native_link_event_marshal,
|
||||
pw_protocol_native_link_event_demarshal,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
factory = pw_factory_new(core,
|
||||
"spa-node-factory",
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
NULL,
|
||||
sizeof(*data));
|
||||
if (factory == NULL)
|
||||
|
|
|
|||
|
|
@ -38,6 +38,10 @@ struct impl {
|
|||
struct pw_array permissions;
|
||||
};
|
||||
|
||||
#define pw_client_resource(r,m,v,...) pw_resource_notify(r,struct pw_client_proxy_events,m,v,__VA_ARGS__)
|
||||
#define pw_client_resource_info(r,...) pw_client_resource(r,info,0,__VA_ARGS__)
|
||||
#define pw_client_resource_permissions(r,...) pw_client_resource(r,permissions,0,__VA_ARGS__)
|
||||
|
||||
struct resource_data {
|
||||
struct spa_hook resource_listener;
|
||||
struct pw_client *client;
|
||||
|
|
@ -320,7 +324,8 @@ int pw_client_register(struct pw_client *client,
|
|||
client->registered = true;
|
||||
|
||||
client->global = pw_global_new(core,
|
||||
PW_TYPE_INTERFACE_Client, PW_VERSION_CLIENT,
|
||||
PW_TYPE_INTERFACE_Client,
|
||||
PW_VERSION_CLIENT_PROXY,
|
||||
properties,
|
||||
global_bind,
|
||||
client);
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ static int port_set_io(struct pw_port *port, uint32_t mix, uint32_t id, void *da
|
|||
uint32_t p;
|
||||
int res;
|
||||
|
||||
if (port->mix && port->mix->port_set_io) {
|
||||
if (port->mix) {
|
||||
n = port->mix;
|
||||
p = mix;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -57,15 +57,14 @@ struct resource_data {
|
|||
};
|
||||
|
||||
/** \endcond */
|
||||
|
||||
static int registry_bind(void *object, uint32_t id,
|
||||
uint32_t type, uint32_t version, uint32_t new_id)
|
||||
static void * registry_bind(void *object, uint32_t id,
|
||||
uint32_t type, uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_client *client = resource->client;
|
||||
struct pw_core *core = resource->core;
|
||||
struct pw_global *global;
|
||||
uint32_t permissions;
|
||||
uint32_t permissions, new_id = user_data_size;
|
||||
|
||||
if ((global = pw_core_find_global(core, id)) == NULL)
|
||||
goto no_id;
|
||||
|
|
@ -84,7 +83,7 @@ static int registry_bind(void *object, uint32_t id,
|
|||
if (pw_global_bind(global, client, permissions, version, new_id) < 0)
|
||||
goto exit;
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
|
||||
no_id:
|
||||
pw_log_debug("registry %p: no global with id %u to bind to %u", resource, id, new_id);
|
||||
|
|
@ -100,7 +99,7 @@ static int registry_bind(void *object, uint32_t id,
|
|||
* new_id as 'used and freed' */
|
||||
pw_map_insert_at(&client->objects, new_id, NULL);
|
||||
pw_core_resource_remove_id(client->core_resource, new_id);
|
||||
return -EFAULT;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int registry_destroy(void *object, uint32_t id)
|
||||
|
|
@ -213,7 +212,7 @@ static int core_error(void *object, uint32_t id, int seq, int res, const char *m
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int core_get_registry(void *object, uint32_t version, uint32_t new_id)
|
||||
static struct pw_registry_proxy * core_get_registry(void *object, uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_client *client = resource->client;
|
||||
|
|
@ -221,6 +220,7 @@ static int core_get_registry(void *object, uint32_t version, uint32_t new_id)
|
|||
struct pw_global *global;
|
||||
struct pw_resource *registry_resource;
|
||||
struct resource_data *data;
|
||||
uint32_t new_id = user_data_size;
|
||||
|
||||
registry_resource = pw_resource_new(client,
|
||||
new_id,
|
||||
|
|
@ -257,7 +257,7 @@ static int core_get_registry(void *object, uint32_t version, uint32_t new_id)
|
|||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (struct pw_registry_proxy *)registry_resource;
|
||||
|
||||
no_mem:
|
||||
pw_log_error("can't create registry resource");
|
||||
|
|
@ -265,22 +265,24 @@ static int core_get_registry(void *object, uint32_t version, uint32_t new_id)
|
|||
client->recv_seq, -ENOMEM, "no memory");
|
||||
pw_map_insert_at(&client->objects, new_id, NULL);
|
||||
pw_core_resource_remove_id(client->core_resource, new_id);
|
||||
return -ENOMEM;
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
static void *
|
||||
core_create_object(void *object,
|
||||
const char *factory_name,
|
||||
uint32_t type,
|
||||
uint32_t version,
|
||||
const struct spa_dict *props,
|
||||
uint32_t new_id)
|
||||
size_t user_data_size)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_client *client = resource->client;
|
||||
struct pw_factory *factory;
|
||||
void *obj;
|
||||
struct pw_properties *properties;
|
||||
uint32_t new_id = user_data_size;
|
||||
int res;
|
||||
|
||||
factory = pw_core_find_factory(client->core, factory_name);
|
||||
|
|
@ -330,27 +332,17 @@ core_create_object(void *object,
|
|||
error:
|
||||
pw_map_insert_at(&client->objects, new_id, NULL);
|
||||
pw_core_resource_remove_id(client->core_resource, new_id);
|
||||
return res;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int core_destroy(void *object, uint32_t id)
|
||||
static int core_destroy(void *object, void *proxy)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_client *client = resource->client;
|
||||
struct pw_resource *r;
|
||||
|
||||
pw_log_debug("core %p: destroy resource %d from client %p", resource->core, id, client);
|
||||
|
||||
if ((r = pw_client_find_resource(client, id)) == NULL)
|
||||
goto no_resource;
|
||||
|
||||
struct pw_resource *r = proxy;
|
||||
pw_log_debug("core %p: destroy resource %p from client %p", resource->core, r, client);
|
||||
pw_resource_destroy(r);
|
||||
return 0;
|
||||
|
||||
no_resource:
|
||||
pw_log_error("can't find resouce %d", id);
|
||||
pw_resource_error(resource, -EINVAL, "unknown resource %d", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static const struct pw_core_proxy_methods core_methods = {
|
||||
|
|
@ -525,7 +517,7 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop,
|
|||
|
||||
this->global = pw_global_new(this,
|
||||
PW_TYPE_INTERFACE_Core,
|
||||
PW_VERSION_CORE,
|
||||
PW_VERSION_CORE_PROXY,
|
||||
pw_properties_new(
|
||||
PW_CORE_PROP_USER_NAME, this->info.user_name,
|
||||
PW_CORE_PROP_HOST_NAME, this->info.host_name,
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@ struct impl {
|
|||
struct pw_device this;
|
||||
};
|
||||
|
||||
#define pw_device_resource(r,m,v,...) pw_resource_notify(r,struct pw_device_proxy_events,m,v,__VA_ARGS__)
|
||||
#define pw_device_resource_info(r,...) pw_device_resource(r,info,0,__VA_ARGS__)
|
||||
#define pw_device_resource_param(r,...) pw_device_resource(r,param,0,__VA_ARGS__)
|
||||
|
||||
struct resource_data {
|
||||
struct spa_hook resource_listener;
|
||||
struct pw_device *device;
|
||||
|
|
@ -291,7 +295,7 @@ int pw_device_register(struct pw_device *device,
|
|||
device->registered = true;
|
||||
|
||||
device->global = pw_global_new(core,
|
||||
PW_TYPE_INTERFACE_Device, PW_VERSION_DEVICE,
|
||||
PW_TYPE_INTERFACE_Device, PW_VERSION_DEVICE_PROXY,
|
||||
properties,
|
||||
global_bind,
|
||||
device);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
#include "pipewire/type.h"
|
||||
#include "pipewire/interfaces.h"
|
||||
|
||||
#define pw_factory_resource_info(r,...) pw_resource_notify(r,struct pw_factory_proxy_events,info,0,__VA_ARGS__)
|
||||
|
||||
struct resource_data {
|
||||
struct spa_hook resource_listener;
|
||||
};
|
||||
|
|
@ -163,7 +165,8 @@ int pw_factory_register(struct pw_factory *factory,
|
|||
factory->registered = true;
|
||||
|
||||
factory->global = pw_global_new(core,
|
||||
PW_TYPE_INTERFACE_Factory, PW_VERSION_FACTORY,
|
||||
PW_TYPE_INTERFACE_Factory,
|
||||
PW_VERSION_FACTORY_PROXY,
|
||||
properties,
|
||||
global_bind,
|
||||
factory);
|
||||
|
|
|
|||
|
|
@ -272,8 +272,7 @@ void pw_global_add_listener(struct pw_global *global,
|
|||
*
|
||||
* \memberof pw_global
|
||||
*/
|
||||
SPA_EXPORT
|
||||
int
|
||||
SPA_EXPORT int
|
||||
pw_global_bind(struct pw_global *global, struct pw_client *client, uint32_t permissions,
|
||||
uint32_t version, uint32_t id)
|
||||
{
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -47,6 +47,8 @@
|
|||
|
||||
#define MAX_BUFFERS 64
|
||||
|
||||
#define pw_link_resource_info(r,...) pw_resource_notify(r,struct pw_link_proxy_events,info,0,__VA_ARGS__)
|
||||
|
||||
/** \cond */
|
||||
struct impl {
|
||||
struct pw_link this;
|
||||
|
|
@ -518,11 +520,13 @@ static int port_set_io(struct pw_link *this, struct pw_port *port, uint32_t id,
|
|||
pw_direction_as_string(port->direction),
|
||||
port, port->port_id, mix->port.port_id, id, data, size);
|
||||
|
||||
if (port->mix->port_set_io) {
|
||||
if ((res = spa_node_port_set_io(port->mix,
|
||||
mix->port.direction,
|
||||
mix->port.port_id,
|
||||
id, data, size)) < 0)
|
||||
if ((res = spa_node_port_set_io(port->mix,
|
||||
mix->port.direction,
|
||||
mix->port.port_id,
|
||||
id, data, size)) < 0) {
|
||||
if (res == -ENOTSUP)
|
||||
res = 0;
|
||||
else
|
||||
pw_log_warn("port %p: can't set io: %s", port, spa_strerror(res));
|
||||
}
|
||||
return res;
|
||||
|
|
@ -1417,7 +1421,8 @@ int pw_link_register(struct pw_link *link,
|
|||
link->registered = true;
|
||||
|
||||
link->global = pw_global_new(core,
|
||||
PW_TYPE_INTERFACE_Link, PW_VERSION_LINK,
|
||||
PW_TYPE_INTERFACE_Link,
|
||||
PW_VERSION_LINK_PROXY,
|
||||
properties,
|
||||
global_bind,
|
||||
link);
|
||||
|
|
|
|||
|
|
@ -86,7 +86,9 @@ pw_log_log(enum spa_log_level level,
|
|||
if (SPA_UNLIKELY(pw_log_level_enabled(level) && global_log)) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
global_log->logv(global_log, level, file, line, func, fmt, args);
|
||||
spa_interface_call(&global_log->iface,
|
||||
struct spa_log_methods, logv, 0, level, file, line,
|
||||
func, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
|
@ -111,7 +113,9 @@ pw_log_logv(enum spa_log_level level,
|
|||
va_list args)
|
||||
{
|
||||
if (SPA_UNLIKELY(pw_log_level_enabled(level) && global_log)) {
|
||||
global_log->logv(global_log, level, file, line, func, fmt, args);
|
||||
spa_interface_call(&global_log->iface,
|
||||
struct spa_log_methods, logv, 0, level, file, line,
|
||||
func, fmt, args);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ struct impl {
|
|||
void *hnd;
|
||||
};
|
||||
|
||||
#define pw_module_resource_info(r,...) pw_resource_notify(r,struct pw_module_proxy_events,info,0,__VA_ARGS__)
|
||||
|
||||
struct resource_data {
|
||||
struct spa_hook resource_listener;
|
||||
};
|
||||
|
|
@ -240,7 +242,8 @@ pw_module_load(struct pw_core *core,
|
|||
spa_list_append(&core->module_list, &this->link);
|
||||
|
||||
this->global = pw_global_new(core,
|
||||
PW_TYPE_INTERFACE_Module, PW_VERSION_MODULE,
|
||||
PW_TYPE_INTERFACE_Module,
|
||||
PW_VERSION_MODULE_PROXY,
|
||||
pw_properties_new(
|
||||
PW_MODULE_PROP_NAME, name,
|
||||
NULL),
|
||||
|
|
|
|||
|
|
@ -54,6 +54,10 @@ struct impl {
|
|||
unsigned int pause_on_idle:1;
|
||||
};
|
||||
|
||||
#define pw_node_resource(r,m,v,...) pw_resource_notify(r,struct pw_node_proxy_events,m,v,__VA_ARGS__)
|
||||
#define pw_node_resource_info(r,...) pw_node_resource(r,info,0,__VA_ARGS__)
|
||||
#define pw_node_resource_param(r,...) pw_node_resource(r,param,0,__VA_ARGS__)
|
||||
|
||||
struct resource_data {
|
||||
struct spa_hook resource_listener;
|
||||
struct pw_node *node;
|
||||
|
|
@ -497,7 +501,8 @@ int pw_node_register(struct pw_node *this,
|
|||
this->registered = true;
|
||||
|
||||
this->global = pw_global_new(core,
|
||||
PW_TYPE_INTERFACE_Node, PW_VERSION_NODE,
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
properties,
|
||||
global_bind,
|
||||
this);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ struct impl {
|
|||
struct spa_node mix_node; /**< mix node implementation */
|
||||
};
|
||||
|
||||
#define pw_port_resource(r,m,v,...) pw_resource_notify(r,struct pw_port_proxy_events,m,v,__VA_ARGS__)
|
||||
#define pw_port_resource_info(r,...) pw_port_resource(r,info,0,__VA_ARGS__)
|
||||
#define pw_port_resource_param(r,...) pw_port_resource(r,param,0,__VA_ARGS__)
|
||||
|
||||
struct resource_data {
|
||||
struct spa_hook resource_listener;
|
||||
struct pw_port *port;
|
||||
|
|
@ -81,9 +85,9 @@ void pw_port_update_state(struct pw_port *port, enum pw_port_state state)
|
|||
}
|
||||
}
|
||||
|
||||
static int tee_process(struct spa_node *data)
|
||||
static int tee_process(void *object)
|
||||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(data, struct impl, mix_node);
|
||||
struct impl *impl = object;
|
||||
struct pw_port *this = &impl->this;
|
||||
struct pw_port_mix *mix;
|
||||
struct spa_io_buffers *io = &this->rt.io;
|
||||
|
|
@ -99,9 +103,9 @@ static int tee_process(struct spa_node *data)
|
|||
return SPA_STATUS_HAVE_BUFFER | SPA_STATUS_NEED_BUFFER;
|
||||
}
|
||||
|
||||
static int tee_reuse_buffer(struct spa_node *data, uint32_t port_id, uint32_t buffer_id)
|
||||
static int tee_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(data, struct impl, mix_node);
|
||||
struct impl *impl = object;
|
||||
struct pw_port *this = &impl->this;
|
||||
|
||||
pw_log_trace_fp("port %p: tee reuse buffer %d %d", this, port_id, buffer_id);
|
||||
|
|
@ -110,16 +114,15 @@ static int tee_reuse_buffer(struct spa_node *data, uint32_t port_id, uint32_t bu
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_node schedule_tee_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
static const struct spa_node_methods schedule_tee_node = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.process = tee_process,
|
||||
.port_reuse_buffer = tee_reuse_buffer,
|
||||
};
|
||||
|
||||
static int schedule_mix_input(struct spa_node *data)
|
||||
static int schedule_mix_input(void *object)
|
||||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(data, struct impl, mix_node);
|
||||
struct impl *impl = object;
|
||||
struct pw_port *this = &impl->this;
|
||||
struct spa_io_buffers *io = &this->rt.io;
|
||||
struct pw_port_mix *mix;
|
||||
|
|
@ -137,9 +140,9 @@ static int schedule_mix_input(struct spa_node *data)
|
|||
return SPA_STATUS_HAVE_BUFFER | SPA_STATUS_NEED_BUFFER;
|
||||
}
|
||||
|
||||
static int schedule_mix_reuse_buffer(struct spa_node *data, uint32_t port_id, uint32_t buffer_id)
|
||||
static int schedule_mix_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(data, struct impl, mix_node);
|
||||
struct impl *impl = object;
|
||||
struct pw_port *this = &impl->this;
|
||||
struct pw_port_mix *mix;
|
||||
|
||||
|
|
@ -150,9 +153,8 @@ static int schedule_mix_reuse_buffer(struct spa_node *data, uint32_t port_id, ui
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_node schedule_mix_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
static const struct spa_node_methods schedule_mix_node = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.process = schedule_mix_input,
|
||||
.port_reuse_buffer = schedule_mix_reuse_buffer,
|
||||
};
|
||||
|
|
@ -172,13 +174,12 @@ int pw_port_init_mix(struct pw_port *port, struct pw_port_mix *mix)
|
|||
port->n_mix++;
|
||||
mix->p = port;
|
||||
|
||||
if (port->mix->add_port)
|
||||
port->mix->add_port(port->mix, port->direction, port_id, NULL);
|
||||
spa_node_add_port(port->mix, port->direction, port_id, NULL);
|
||||
|
||||
res = pw_port_call_init_mix(port, mix);
|
||||
|
||||
/* set the same format on the mixer as on the port if any */
|
||||
if (port->mix->enum_params && port->mix->set_param) {
|
||||
if (1) {
|
||||
uint32_t idx = 0;
|
||||
uint8_t buffer[1024];
|
||||
struct spa_pod_builder b;
|
||||
|
|
@ -212,9 +213,7 @@ int pw_port_release_mix(struct pw_port *port, struct pw_port_mix *mix)
|
|||
|
||||
res = pw_port_call_release_mix(port, mix);
|
||||
|
||||
if (port->mix->remove_port) {
|
||||
port->mix->remove_port(port->mix, port->direction, port_id);
|
||||
}
|
||||
spa_node_remove_port(port->mix, port->direction, port_id);
|
||||
|
||||
pw_log_debug("port %p: release mix %d.%d", port,
|
||||
port->port_id, mix->port.port_id);
|
||||
|
|
@ -334,6 +333,7 @@ struct pw_port *pw_port_new(enum pw_direction direction,
|
|||
struct impl *impl;
|
||||
struct pw_port *this;
|
||||
struct pw_properties *properties;
|
||||
const struct spa_node_methods *mix_methods;
|
||||
|
||||
impl = calloc(1, sizeof(struct impl) + user_data_size);
|
||||
if (impl == NULL)
|
||||
|
|
@ -379,10 +379,17 @@ struct pw_port *pw_port_new(enum pw_direction direction,
|
|||
|
||||
spa_hook_list_init(&this->listener_list);
|
||||
|
||||
impl->mix_node = this->direction == PW_DIRECTION_INPUT ?
|
||||
schedule_mix_node :
|
||||
schedule_tee_node;
|
||||
pw_port_set_mix(this, &impl->mix_node, 0);
|
||||
if (this->direction == PW_DIRECTION_INPUT)
|
||||
mix_methods = &schedule_mix_node;
|
||||
else
|
||||
mix_methods = &schedule_tee_node;
|
||||
|
||||
impl->mix_node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
mix_methods, impl);
|
||||
|
||||
pw_port_set_mix(this, NULL, 0);
|
||||
|
||||
pw_map_init(&this->mix_port_map, 64, 64);
|
||||
|
||||
|
|
@ -405,7 +412,7 @@ int pw_port_set_mix(struct pw_port *port, struct spa_node *node, uint32_t flags)
|
|||
struct impl *impl = SPA_CONTAINER_OF(port, struct impl, this);
|
||||
|
||||
if (node == NULL) {
|
||||
node = &impl->mix_node;
|
||||
node = (struct spa_node *)&impl->mix_node;
|
||||
flags = 0;
|
||||
}
|
||||
pw_log_debug("port %p: mix node %p->%p", port, port->mix, node);
|
||||
|
|
@ -631,7 +638,8 @@ int pw_port_register(struct pw_port *port,
|
|||
struct pw_core *core = node->core;
|
||||
|
||||
port->global = pw_global_new(core,
|
||||
PW_TYPE_INTERFACE_Port, PW_VERSION_PORT,
|
||||
PW_TYPE_INTERFACE_Port,
|
||||
PW_VERSION_PORT_PROXY,
|
||||
properties,
|
||||
global_bind,
|
||||
port);
|
||||
|
|
@ -702,12 +710,10 @@ int pw_port_add(struct pw_port *port, struct pw_node *node)
|
|||
SPA_IO_Buffers,
|
||||
&port->rt.io, sizeof(port->rt.io));
|
||||
|
||||
if (port->mix->port_set_io) {
|
||||
spa_node_port_set_io(port->mix,
|
||||
pw_direction_reverse(port->direction), 0,
|
||||
SPA_IO_Buffers,
|
||||
&port->rt.io, sizeof(port->rt.io));
|
||||
}
|
||||
spa_node_port_set_io(port->mix,
|
||||
pw_direction_reverse(port->direction), 0,
|
||||
SPA_IO_Buffers,
|
||||
&port->rt.io, sizeof(port->rt.io));
|
||||
}
|
||||
|
||||
pw_log_debug("port %p: %d add to node %p", port, port_id, node);
|
||||
|
|
@ -952,7 +958,7 @@ int pw_port_set_param(struct pw_port *port, uint32_t id, uint32_t flags,
|
|||
pw_log_debug("port %p: %d set param %d %p", port, port->state, id, param);
|
||||
|
||||
/* set the parameters on all ports of the mixer node if possible */
|
||||
if (port->mix->port_set_param != NULL) {
|
||||
if (1) {
|
||||
struct pw_port_mix *mix;
|
||||
|
||||
spa_list_for_each(mix, &port->mix_list, link) {
|
||||
|
|
@ -1010,7 +1016,7 @@ int pw_port_use_buffers(struct pw_port *port, uint32_t mix_id,
|
|||
if ((mix = pw_map_lookup(&port->mix_port_map, mix_id)) == NULL)
|
||||
return -EIO;
|
||||
|
||||
if (port->mix->port_use_buffers != NULL) {
|
||||
if (1) {
|
||||
res = spa_node_port_use_buffers(port->mix,
|
||||
mix->port.direction, mix->port.port_id,
|
||||
buffers, n_buffers);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ extern "C" {
|
|||
#include "pipewire/remote.h"
|
||||
#include "pipewire/mem.h"
|
||||
#include "pipewire/introspect.h"
|
||||
#include "pipewire/interfaces.h"
|
||||
#include "pipewire/stream.h"
|
||||
#include "pipewire/log.h"
|
||||
|
||||
|
|
@ -170,6 +171,38 @@ struct pw_global {
|
|||
#define pw_core_emit_global_added(c,g) pw_core_emit(c, global_added, 0, g)
|
||||
#define pw_core_emit_global_removed(c,g) pw_core_emit(c, global_removed, 0, g)
|
||||
|
||||
#define pw_core_resource(r,m,v,...) pw_resource_notify(r, struct pw_core_proxy_events, m, v, ##__VA_ARGS__)
|
||||
#define pw_core_resource_info(r,...) pw_core_resource(r,info,0,__VA_ARGS__)
|
||||
#define pw_core_resource_done(r,...) pw_core_resource(r,done,0,__VA_ARGS__)
|
||||
#define pw_core_resource_ping(r,...) pw_core_resource(r,ping,0,__VA_ARGS__)
|
||||
#define pw_core_resource_error(r,...) pw_core_resource(r,error,0,__VA_ARGS__)
|
||||
#define pw_core_resource_remove_id(r,...) pw_core_resource(r,remove_id,0,__VA_ARGS__)
|
||||
|
||||
static inline void
|
||||
pw_core_resource_errorv(struct pw_resource *resource, uint32_t id, int seq,
|
||||
int res, const char *message, va_list args)
|
||||
{
|
||||
char buffer[1024];
|
||||
vsnprintf(buffer, sizeof(buffer), message, args);
|
||||
buffer[1023] = '\0';
|
||||
pw_core_resource_error(resource, id, seq, res, buffer);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pw_core_resource_errorf(struct pw_resource *resource, uint32_t id, int seq,
|
||||
int res, const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
pw_core_resource_errorv(resource, id, seq, res, message, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#define pw_registry_resource(r,m,v,...) pw_resource_notify(r, struct pw_registry_proxy_events,m,v,##__VA_ARGS__)
|
||||
#define pw_registry_resource_global(r,...) pw_registry_resource(r,global,0,__VA_ARGS__)
|
||||
#define pw_registry_resource_global_remove(r,...) pw_registry_resource(r,global_remove,0,__VA_ARGS__)
|
||||
|
||||
|
||||
struct pw_core {
|
||||
struct pw_global *global; /**< the global of the core */
|
||||
struct spa_hook global_listener;
|
||||
|
|
@ -592,6 +625,7 @@ struct pw_link {
|
|||
#define pw_resource_emit_error(o,s,r,m) pw_resource_emit(o, error, 0, s, r, m)
|
||||
|
||||
struct pw_resource {
|
||||
struct spa_interface impl; /**< event implementation */
|
||||
struct pw_core *core; /**< the core object */
|
||||
struct spa_list link; /**< link in object resource_list */
|
||||
|
||||
|
|
@ -620,6 +654,7 @@ struct pw_resource {
|
|||
#define pw_proxy_emit_error(p,s,r,m) pw_proxy_emit(p, error, 0, s, r, m)
|
||||
|
||||
struct pw_proxy {
|
||||
struct spa_interface impl; /**< method implementation */
|
||||
struct pw_remote *remote; /**< the owner remote of this proxy */
|
||||
struct spa_list link; /**< link in the remote */
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,11 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory,
|
|||
|
||||
this->marshal = pw_protocol_get_marshal(remote->conn->protocol, type);
|
||||
|
||||
this->impl = SPA_INTERFACE_INIT(
|
||||
type,
|
||||
this->marshal->version,
|
||||
this->marshal->method_marshal, this);
|
||||
|
||||
spa_list_append(&this->remote->proxy_list, &this->link);
|
||||
|
||||
pw_log_debug("proxy %p: new %u %s remote %p, marshal %p",
|
||||
|
|
|
|||
|
|
@ -164,7 +164,6 @@ struct spa_hook_list *pw_proxy_get_proxy_listeners(struct pw_proxy *proxy);
|
|||
const struct pw_protocol_marshal *pw_proxy_get_marshal(struct pw_proxy *proxy);
|
||||
|
||||
#define pw_proxy_notify(p,type,event,ver,...) spa_hook_list_call(pw_proxy_get_proxy_listeners(p),type,event,ver,## __VA_ARGS__)
|
||||
#define pw_proxy_do(p,type,method,...) ((type*) pw_proxy_get_marshal(p)->method_marshal)->method(p, ## __VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ static int do_connect(struct pw_remote *remote)
|
|||
pw_core_proxy_add_listener(remote->core_proxy, &impl->core_listener, &core_proxy_events, remote);
|
||||
|
||||
pw_client_proxy_update_properties(remote->client_proxy, &remote->properties->dict);
|
||||
pw_core_proxy_hello(remote->core_proxy, PW_VERSION_CORE);
|
||||
pw_core_proxy_hello(remote->core_proxy, PW_VERSION_CORE_PROXY);
|
||||
pw_remote_update_state(remote, PW_REMOTE_STATE_CONNECTED, NULL);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,11 @@ struct pw_resource *pw_resource_new(struct pw_client *client,
|
|||
|
||||
this->marshal = pw_protocol_get_marshal(client->protocol, type);
|
||||
|
||||
this->impl = SPA_INTERFACE_INIT(
|
||||
type,
|
||||
this->marshal->version,
|
||||
this->marshal->event_marshal, this);
|
||||
|
||||
pw_log_debug("resource %p: new %u %s/%d client %p marshal %p",
|
||||
this, id,
|
||||
spa_debug_type_find_name(pw_type_info(), type), version,
|
||||
|
|
|
|||
|
|
@ -141,8 +141,17 @@ const struct pw_protocol_marshal *pw_resource_get_marshal(struct pw_resource *re
|
|||
#define pw_resource_do_parent(r,l,type,method,...) \
|
||||
spa_hook_list_call_once_start(pw_resource_get_implementation(r),l,type,method,v,## __VA_ARGS__)
|
||||
|
||||
#define pw_resource_notify(r,type,event,...) \
|
||||
((type*) pw_resource_get_marshal(r)->event_marshal)->event(r, ## __VA_ARGS__)
|
||||
#define pw_resource_notify(r,type,event,version,...) \
|
||||
spa_interface_call((struct spa_interface*)r, \
|
||||
type, event, version, ##__VA_ARGS__);
|
||||
|
||||
#define pw_resource_notify_res(r,type,event,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)r, \
|
||||
type, _res, event, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ struct stream {
|
|||
struct spa_port_info port_info;
|
||||
|
||||
struct spa_node impl_node;
|
||||
struct spa_node_methods node_methods;
|
||||
struct spa_hook_list hooks;
|
||||
struct spa_callbacks callbacks;
|
||||
struct spa_io_buffers *io;
|
||||
|
|
@ -304,9 +305,9 @@ static void call_process(struct stream *impl)
|
|||
}
|
||||
}
|
||||
|
||||
static int impl_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
static int impl_set_io(void *object, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct stream *impl = SPA_CONTAINER_OF(node, struct stream, impl_node);
|
||||
struct stream *impl = object;
|
||||
switch(id) {
|
||||
case SPA_IO_Position:
|
||||
if (data && size >= sizeof(struct spa_io_position))
|
||||
|
|
@ -320,9 +321,9 @@ static int impl_set_io(struct spa_node *node, uint32_t id, void *data, size_t si
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
static int impl_send_command(void *object, const struct spa_command *command)
|
||||
{
|
||||
struct stream *impl = SPA_CONTAINER_OF(node, struct stream, impl_node);
|
||||
struct stream *impl = object;
|
||||
struct pw_stream *stream = &impl->this;
|
||||
|
||||
switch (SPA_NODE_COMMAND_ID(command)) {
|
||||
|
|
@ -383,12 +384,12 @@ static void emit_port_info(struct stream *d)
|
|||
spa_node_emit_port_info(&d->hooks, d->direction, 0, &info);
|
||||
}
|
||||
|
||||
static int impl_add_listener(struct spa_node *node,
|
||||
static int impl_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct spa_node_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct stream *d = SPA_CONTAINER_OF(node, struct stream, impl_node);
|
||||
struct stream *d = object;
|
||||
struct spa_hook_list save;
|
||||
|
||||
spa_hook_list_isolate(&d->hooks, &save, listener, events, data);
|
||||
|
|
@ -401,20 +402,20 @@ static int impl_add_listener(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_set_callbacks(struct spa_node *node,
|
||||
static int impl_set_callbacks(void *object,
|
||||
const struct spa_node_callbacks *callbacks, void *data)
|
||||
{
|
||||
struct stream *d = SPA_CONTAINER_OF(node, struct stream, impl_node);
|
||||
struct stream *d = object;
|
||||
|
||||
d->callbacks = SPA_CALLBACKS_INIT(callbacks, data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_set_io(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
static int impl_port_set_io(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct stream *impl = SPA_CONTAINER_OF(node, struct stream, impl_node);
|
||||
struct stream *impl = object;
|
||||
|
||||
pw_log_debug("stream %p: set io %s %p %zd", impl,
|
||||
spa_debug_type_find_name(spa_type_io, id), data, size);
|
||||
|
|
@ -432,12 +433,12 @@ static int impl_port_set_io(struct spa_node *node, enum spa_direction direction,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_enum_params(struct spa_node *node, int seq,
|
||||
static int impl_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct stream *d = SPA_CONTAINER_OF(node, struct stream, impl_node);
|
||||
struct stream *d = object;
|
||||
struct spa_result_node_params result;
|
||||
uint8_t buffer[1024];
|
||||
struct spa_pod_builder b = { 0 };
|
||||
|
|
@ -473,11 +474,11 @@ static int impl_port_enum_params(struct spa_node *node, int seq,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int port_set_format(struct spa_node *node,
|
||||
static int port_set_format(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags, const struct spa_pod *format)
|
||||
{
|
||||
struct stream *impl = SPA_CONTAINER_OF(node, struct stream, impl_node);
|
||||
struct stream *impl = object;
|
||||
struct pw_stream *stream = &impl->this;
|
||||
struct param *p;
|
||||
int count;
|
||||
|
|
@ -520,13 +521,13 @@ static int port_set_format(struct spa_node *node,
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
static int impl_port_set_param(struct spa_node *node,
|
||||
static int impl_port_set_param(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
if (id == SPA_PARAM_Format) {
|
||||
return port_set_format(node, direction, port_id, flags, param);
|
||||
return port_set_format(object, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -590,10 +591,10 @@ static void clear_buffers(struct pw_stream *stream)
|
|||
clear_queue(impl, &impl->queued);
|
||||
}
|
||||
|
||||
static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
static int impl_port_use_buffers(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
{
|
||||
struct stream *impl = SPA_CONTAINER_OF(node, struct stream, impl_node);
|
||||
struct stream *impl = object;
|
||||
struct pw_stream *stream = &impl->this;
|
||||
uint32_t i, j, flags = impl->flags;
|
||||
int prot, res;
|
||||
|
|
@ -662,9 +663,9 @@ static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direc
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
||||
static int impl_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct stream *d = SPA_CONTAINER_OF(node, struct stream, impl_node);
|
||||
struct stream *d = object;
|
||||
pw_log_trace("stream %p: recycle buffer %d", d, buffer_id);
|
||||
if (buffer_id < d->n_buffers)
|
||||
push_queue(d, &d->queued, &d->buffers[buffer_id]);
|
||||
|
|
@ -685,9 +686,9 @@ static inline void copy_position(struct stream *impl, int64_t queued)
|
|||
}
|
||||
}
|
||||
|
||||
static int impl_node_process_input(struct spa_node *node)
|
||||
static int impl_node_process_input(void *object)
|
||||
{
|
||||
struct stream *impl = SPA_CONTAINER_OF(node, struct stream, impl_node);
|
||||
struct stream *impl = object;
|
||||
struct pw_stream *stream = &impl->this;
|
||||
struct spa_io_buffers *io = impl->io;
|
||||
struct buffer *b;
|
||||
|
|
@ -724,9 +725,9 @@ static int impl_node_process_input(struct spa_node *node)
|
|||
return SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
|
||||
static int impl_node_process_output(struct spa_node *node)
|
||||
static int impl_node_process_output(void *object)
|
||||
{
|
||||
struct stream *impl = SPA_CONTAINER_OF(node, struct stream, impl_node);
|
||||
struct stream *impl = object;
|
||||
struct pw_stream *stream = &impl->this;
|
||||
struct spa_io_buffers *io = impl->io;
|
||||
struct buffer *b;
|
||||
|
|
@ -771,8 +772,8 @@ static int impl_node_process_output(struct spa_node *node)
|
|||
return res;
|
||||
}
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
static const struct spa_node_methods impl_node = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.add_listener = impl_add_listener,
|
||||
.set_callbacks = impl_set_callbacks,
|
||||
.set_io = impl_set_io,
|
||||
|
|
@ -961,12 +962,17 @@ static int handle_connect(struct pw_stream *stream)
|
|||
if (impl->node == NULL)
|
||||
goto no_node;
|
||||
|
||||
impl->impl_node = impl_node;
|
||||
impl->node_methods = impl_node;
|
||||
|
||||
if (impl->direction == SPA_DIRECTION_INPUT)
|
||||
impl->impl_node.process = impl_node_process_input;
|
||||
impl->node_methods.process = impl_node_process_input;
|
||||
else
|
||||
impl->impl_node.process = impl_node_process_output;
|
||||
impl->node_methods.process = impl_node_process_output;
|
||||
|
||||
impl->impl_node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl->node_methods, impl);
|
||||
|
||||
pw_node_set_implementation(impl->node, &impl->impl_node);
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ static void test_create(void)
|
|||
spa_assert(pw_global_get_owner(global) == NULL);
|
||||
spa_assert(pw_global_get_parent(global) == global);
|
||||
spa_assert(pw_global_get_type(global) == PW_TYPE_INTERFACE_Core);
|
||||
spa_assert(pw_global_get_version(global) == PW_VERSION_CORE);
|
||||
spa_assert(pw_global_get_version(global) == PW_VERSION_CORE_PROXY);
|
||||
spa_assert(pw_global_get_id(global) == 0);
|
||||
spa_assert(pw_global_get_object(global) == (void*)core);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,18 +37,23 @@ static void test_core_abi(void)
|
|||
struct pw_core_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_core_proxy_events *events,
|
||||
void *data);
|
||||
int (*hello) (void *object, uint32_t version);
|
||||
int (*sync) (void *object, uint32_t id, int seq);
|
||||
int (*pong) (void *object, uint32_t id, int seq);
|
||||
int (*error) (void *object, uint32_t id, int seq, int res, const char *error);
|
||||
int (*get_registry) (void *object, uint32_t version, uint32_t new_id);
|
||||
int (*create_object) (void *object,
|
||||
struct pw_registry_proxy * (*get_registry) (void *object,
|
||||
uint32_t version, size_t user_data_size);
|
||||
void * (*create_object) (void *object,
|
||||
const char *factory_name,
|
||||
uint32_t type,
|
||||
uint32_t version,
|
||||
const struct spa_dict *props,
|
||||
uint32_t new_id);
|
||||
int (*destroy) (void *object, uint32_t id);
|
||||
size_t user_data_size);
|
||||
int (*destroy) (void *object, void *proxy);
|
||||
} methods = { PW_VERSION_CORE_PROXY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
|
|
@ -60,6 +65,7 @@ static void test_core_abi(void)
|
|||
} events = { PW_VERSION_CORE_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
TEST_FUNC(m, methods, add_listener);
|
||||
TEST_FUNC(m, methods, hello);
|
||||
TEST_FUNC(m, methods, sync);
|
||||
TEST_FUNC(m, methods, pong);
|
||||
|
|
@ -86,7 +92,12 @@ static void test_registry_abi(void)
|
|||
struct pw_registry_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
int (*bind) (void *object, uint32_t id, uint32_t type, uint32_t version, uint32_t new_id);
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_registry_proxy_events *events,
|
||||
void *data);
|
||||
void * (*bind) (void *object, uint32_t id, uint32_t type, uint32_t version,
|
||||
size_t user_data_size);
|
||||
int (*destroy) (void *object, uint32_t id);
|
||||
} methods = { PW_VERSION_REGISTRY_PROXY_METHODS, };
|
||||
struct {
|
||||
|
|
@ -98,6 +109,7 @@ static void test_registry_abi(void)
|
|||
} events = { PW_VERSION_REGISTRY_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
TEST_FUNC(m, methods, add_listener);
|
||||
TEST_FUNC(m, methods, bind);
|
||||
TEST_FUNC(m, methods, destroy);
|
||||
spa_assert(PW_VERSION_REGISTRY_PROXY_METHODS == 0);
|
||||
|
|
@ -116,6 +128,10 @@ static void test_module_abi(void)
|
|||
struct pw_module_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_module_proxy_events *events,
|
||||
void *data);
|
||||
} methods = { PW_VERSION_MODULE_PROXY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
|
|
@ -123,6 +139,7 @@ static void test_module_abi(void)
|
|||
} events = { PW_VERSION_MODULE_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
TEST_FUNC(m, methods, add_listener);
|
||||
spa_assert(PW_VERSION_MODULE_PROXY_METHODS == 0);
|
||||
spa_assert(sizeof(m) == sizeof(methods));
|
||||
|
||||
|
|
@ -138,6 +155,10 @@ static void test_device_abi(void)
|
|||
struct pw_device_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_device_proxy_events *events,
|
||||
void *data);
|
||||
int (*enum_params) (void *object, int seq, uint32_t id,
|
||||
uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter);
|
||||
|
|
@ -153,6 +174,7 @@ static void test_device_abi(void)
|
|||
} events = { PW_VERSION_DEVICE_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
TEST_FUNC(m, methods, add_listener);
|
||||
TEST_FUNC(m, methods, enum_params);
|
||||
TEST_FUNC(m, methods, set_param);
|
||||
spa_assert(PW_VERSION_DEVICE_PROXY_METHODS == 0);
|
||||
|
|
@ -171,6 +193,10 @@ static void test_node_abi(void)
|
|||
struct pw_node_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_node_proxy_events *events,
|
||||
void *data);
|
||||
int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
|
||||
int (*enum_params) (void *object, int seq, uint32_t id,
|
||||
uint32_t start, uint32_t num, const struct spa_pod *filter);
|
||||
|
|
@ -187,6 +213,7 @@ static void test_node_abi(void)
|
|||
} events = { PW_VERSION_NODE_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
TEST_FUNC(m, methods, add_listener);
|
||||
TEST_FUNC(m, methods, subscribe_params);
|
||||
TEST_FUNC(m, methods, enum_params);
|
||||
TEST_FUNC(m, methods, set_param);
|
||||
|
|
@ -207,6 +234,10 @@ static void test_port_abi(void)
|
|||
struct pw_port_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_port_proxy_events *events,
|
||||
void *data);
|
||||
int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
|
||||
int (*enum_params) (void *object, int seq, uint32_t id,
|
||||
uint32_t start, uint32_t num, const struct spa_pod *filter);
|
||||
|
|
@ -220,6 +251,7 @@ static void test_port_abi(void)
|
|||
} events = { PW_VERSION_PORT_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
TEST_FUNC(m, methods, add_listener);
|
||||
TEST_FUNC(m, methods, enum_params);
|
||||
spa_assert(PW_VERSION_PORT_PROXY_METHODS == 0);
|
||||
spa_assert(sizeof(m) == sizeof(methods));
|
||||
|
|
@ -237,6 +269,10 @@ static void test_factory_abi(void)
|
|||
struct pw_factory_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_factory_proxy_events *events,
|
||||
void *data);
|
||||
} methods = { PW_VERSION_FACTORY_PROXY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
|
|
@ -244,6 +280,7 @@ static void test_factory_abi(void)
|
|||
} events = { PW_VERSION_FACTORY_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
TEST_FUNC(m, methods, add_listener);
|
||||
spa_assert(PW_VERSION_FACTORY_PROXY_METHODS == 0);
|
||||
spa_assert(sizeof(m) == sizeof(methods));
|
||||
|
||||
|
|
@ -259,6 +296,10 @@ static void test_client_abi(void)
|
|||
struct pw_client_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_client_proxy_events *events,
|
||||
void *data);
|
||||
int (*error) (void *object, uint32_t id, int res, const char *error);
|
||||
int (*update_properties) (void *object, const struct spa_dict *props);
|
||||
int (*get_permissions) (void *object, uint32_t index, uint32_t num);
|
||||
|
|
@ -273,6 +314,8 @@ static void test_client_abi(void)
|
|||
} events = { PW_VERSION_CLIENT_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
TEST_FUNC(m, methods, add_listener);
|
||||
TEST_FUNC(m, methods, error);
|
||||
TEST_FUNC(m, methods, update_properties);
|
||||
TEST_FUNC(m, methods, get_permissions);
|
||||
TEST_FUNC(m, methods, update_permissions);
|
||||
|
|
@ -292,6 +335,10 @@ static void test_link_abi(void)
|
|||
struct pw_link_proxy_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_link_proxy_events *events,
|
||||
void *data);
|
||||
} methods = { PW_VERSION_LINK_PROXY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
|
|
@ -299,6 +346,7 @@ static void test_link_abi(void)
|
|||
} events = { PW_VERSION_LINK_PROXY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
TEST_FUNC(m, methods, add_listener);
|
||||
spa_assert(PW_VERSION_LINK_PROXY_METHODS == 0);
|
||||
spa_assert(sizeof(m) == sizeof(methods));
|
||||
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ static void on_state_changed(void *_data, enum pw_remote_state old,
|
|||
&rd->core_listener,
|
||||
&remote_core_events, rd);
|
||||
rd->registry_proxy = pw_core_proxy_get_registry(rd->core_proxy,
|
||||
PW_VERSION_REGISTRY, 0);
|
||||
PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(rd->registry_proxy,
|
||||
&rd->registry_listener,
|
||||
®istry_events, rd);
|
||||
|
|
@ -881,49 +881,49 @@ static bool bind_global(struct remote_data *rd, struct global *global, char **er
|
|||
switch (global->type) {
|
||||
case PW_TYPE_INTERFACE_Core:
|
||||
events = &core_events;
|
||||
client_version = PW_VERSION_CORE;
|
||||
client_version = PW_VERSION_CORE_PROXY;
|
||||
destroy = (pw_destroy_t) pw_core_info_free;
|
||||
info_func = info_core;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Module:
|
||||
events = &module_events;
|
||||
client_version = PW_VERSION_MODULE;
|
||||
client_version = PW_VERSION_MODULE_PROXY;
|
||||
destroy = (pw_destroy_t) pw_module_info_free;
|
||||
info_func = info_module;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Device:
|
||||
events = &device_events;
|
||||
client_version = PW_VERSION_DEVICE;
|
||||
client_version = PW_VERSION_DEVICE_PROXY;
|
||||
destroy = (pw_destroy_t) pw_device_info_free;
|
||||
info_func = info_device;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Node:
|
||||
events = &node_events;
|
||||
client_version = PW_VERSION_NODE;
|
||||
client_version = PW_VERSION_NODE_PROXY;
|
||||
destroy = (pw_destroy_t) pw_node_info_free;
|
||||
info_func = info_node;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Port:
|
||||
events = &port_events;
|
||||
client_version = PW_VERSION_PORT;
|
||||
client_version = PW_VERSION_PORT_PROXY;
|
||||
destroy = (pw_destroy_t) pw_port_info_free;
|
||||
info_func = info_port;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Factory:
|
||||
events = &factory_events;
|
||||
client_version = PW_VERSION_FACTORY;
|
||||
client_version = PW_VERSION_FACTORY_PROXY;
|
||||
destroy = (pw_destroy_t) pw_factory_info_free;
|
||||
info_func = info_factory;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Client:
|
||||
events = &client_events;
|
||||
client_version = PW_VERSION_CLIENT;
|
||||
client_version = PW_VERSION_CLIENT_PROXY;
|
||||
destroy = (pw_destroy_t) pw_client_info_free;
|
||||
info_func = info_client;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Link:
|
||||
events = &link_events;
|
||||
client_version = PW_VERSION_LINK;
|
||||
client_version = PW_VERSION_LINK_PROXY;
|
||||
destroy = (pw_destroy_t) pw_link_info_free;
|
||||
info_func = info_link;
|
||||
break;
|
||||
|
|
@ -1030,7 +1030,8 @@ static bool do_create_node(struct data *data, const char *cmd, char *args, char
|
|||
props = parse_props(a[1]);
|
||||
|
||||
proxy = pw_core_proxy_create_object(rd->core_proxy, a[0],
|
||||
PW_TYPE_INTERFACE_Node, PW_VERSION_NODE,
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
props ? &props->dict : NULL,
|
||||
sizeof(struct proxy_data));
|
||||
|
||||
|
|
@ -1099,7 +1100,7 @@ static bool do_create_link(struct data *data, const char *cmd, char *args, char
|
|||
proxy = (struct pw_proxy*)pw_core_proxy_create_object(rd->core_proxy,
|
||||
"link-factory",
|
||||
PW_TYPE_INTERFACE_Link,
|
||||
PW_VERSION_LINK,
|
||||
PW_VERSION_LINK_PROXY,
|
||||
props ? &props->dict : NULL,
|
||||
sizeof(struct proxy_data));
|
||||
|
||||
|
|
|
|||
|
|
@ -589,40 +589,40 @@ static void registry_event_global(void *data, uint32_t id, uint32_t parent_id,
|
|||
switch (type) {
|
||||
case PW_TYPE_INTERFACE_Node:
|
||||
events = &node_events;
|
||||
client_version = PW_VERSION_NODE;
|
||||
client_version = PW_VERSION_NODE_PROXY;
|
||||
destroy = (pw_destroy_t) pw_node_info_free;
|
||||
print_func = print_node;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Port:
|
||||
events = &port_events;
|
||||
client_version = PW_VERSION_PORT;
|
||||
client_version = PW_VERSION_PORT_PROXY;
|
||||
destroy = (pw_destroy_t) pw_port_info_free;
|
||||
print_func = print_port;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Module:
|
||||
events = &module_events;
|
||||
client_version = PW_VERSION_MODULE;
|
||||
client_version = PW_VERSION_MODULE_PROXY;
|
||||
destroy = (pw_destroy_t) pw_module_info_free;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Device:
|
||||
events = &device_events;
|
||||
client_version = PW_VERSION_DEVICE;
|
||||
client_version = PW_VERSION_DEVICE_PROXY;
|
||||
destroy = (pw_destroy_t) pw_device_info_free;
|
||||
print_func = print_device;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Factory:
|
||||
events = &factory_events;
|
||||
client_version = PW_VERSION_FACTORY;
|
||||
client_version = PW_VERSION_FACTORY_PROXY;
|
||||
destroy = (pw_destroy_t) pw_factory_info_free;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Client:
|
||||
events = &client_events;
|
||||
client_version = PW_VERSION_CLIENT;
|
||||
client_version = PW_VERSION_CLIENT_PROXY;
|
||||
destroy = (pw_destroy_t) pw_client_info_free;
|
||||
break;
|
||||
case PW_TYPE_INTERFACE_Link:
|
||||
events = &link_events;
|
||||
client_version = PW_VERSION_LINK;
|
||||
client_version = PW_VERSION_LINK_PROXY;
|
||||
destroy = (pw_destroy_t) pw_link_info_free;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -702,7 +702,7 @@ static void on_state_changed(void *_data, enum pw_remote_state old,
|
|||
&data->core_listener,
|
||||
&core_events, data);
|
||||
data->registry_proxy = pw_core_proxy_get_registry(data->core_proxy,
|
||||
PW_VERSION_REGISTRY, 0);
|
||||
PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(data->registry_proxy,
|
||||
&data->registry_listener,
|
||||
®istry_events, data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue