mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
cleanups
Remove signals. Rename callbacks -> events, use listeners to listen for events. Callbacks are still used in spa for things you can listen to only once.
This commit is contained in:
parent
b898eb46cd
commit
1b79419554
64 changed files with 779 additions and 880 deletions
|
|
@ -30,7 +30,6 @@
|
|||
#include <spa/lib/debug.h>
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
#include <pipewire/sig.h>
|
||||
#include <pipewire/module.h>
|
||||
#include <pipewire/node-factory.h>
|
||||
|
||||
|
|
@ -77,7 +76,7 @@ struct data {
|
|||
struct pw_type *t;
|
||||
|
||||
struct pw_remote *remote;
|
||||
struct pw_callback_info remote_callbacks;
|
||||
struct pw_listener remote_listener;
|
||||
|
||||
struct pw_node *node;
|
||||
struct pw_port *port;
|
||||
|
|
@ -463,8 +462,8 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_remote_callbacks remote_callbacks = {
|
||||
PW_VERSION_REMOTE_CALLBACKS,
|
||||
static const struct pw_remote_events remote_events = {
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.state_changed = on_state_changed,
|
||||
};
|
||||
|
||||
|
|
@ -498,7 +497,7 @@ int main(int argc, char *argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
pw_remote_add_callbacks(data.remote, &data.remote_callbacks, &remote_callbacks, &data);
|
||||
pw_remote_add_listener(data.remote, &data.remote_listener, &remote_events, &data);
|
||||
|
||||
pw_remote_connect(data.remote);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include <spa/lib/debug.h>
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
#include <pipewire/sig.h>
|
||||
#include <pipewire/module.h>
|
||||
#include <pipewire/node-factory.h>
|
||||
|
||||
|
|
@ -67,7 +66,7 @@ struct data {
|
|||
struct pw_type *t;
|
||||
|
||||
struct pw_remote *remote;
|
||||
struct pw_callback_info remote_callbacks;
|
||||
struct pw_listener remote_listener;
|
||||
|
||||
struct pw_node *node;
|
||||
};
|
||||
|
|
@ -107,8 +106,8 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_remote_callbacks remote_callbacks = {
|
||||
PW_VERSION_REMOTE_CALLBACKS,
|
||||
static const struct pw_remote_events remote_events = {
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.state_changed = on_state_changed,
|
||||
};
|
||||
|
||||
|
|
@ -130,7 +129,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
spa_debug_set_type_map(data.t->map);
|
||||
|
||||
pw_remote_add_callbacks(data.remote, &data.remote_callbacks, &remote_callbacks, &data);
|
||||
pw_remote_add_listener(data.remote, &data.remote_listener, &remote_events, &data);
|
||||
|
||||
pw_remote_connect(data.remote);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include <spa/lib/debug.h>
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
#include <pipewire/sig.h>
|
||||
#include <pipewire/module.h>
|
||||
#include <pipewire/node-factory.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include <spa/lib/debug.h>
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
#include <pipewire/sig.h>
|
||||
|
||||
struct type {
|
||||
uint32_t format;
|
||||
|
|
@ -74,10 +73,10 @@ struct data {
|
|||
struct pw_core *core;
|
||||
struct pw_type *t;
|
||||
struct pw_remote *remote;
|
||||
struct pw_callback_info remote_callbacks;
|
||||
struct pw_listener remote_listener;
|
||||
|
||||
struct pw_stream *stream;
|
||||
struct pw_callback_info stream_callbacks;
|
||||
struct pw_listener stream_listener;
|
||||
|
||||
struct spa_video_info_raw format;
|
||||
int32_t stride;
|
||||
|
|
@ -288,8 +287,8 @@ on_stream_format_changed(void *_data, struct spa_format *format)
|
|||
pw_stream_finish_format(stream, SPA_RESULT_OK, params, 2);
|
||||
}
|
||||
|
||||
static const struct pw_stream_callbacks stream_callbacks = {
|
||||
PW_VERSION_STREAM_CALLBACKS,
|
||||
static const struct pw_stream_events stream_events = {
|
||||
PW_VERSION_STREAM_EVENTS,
|
||||
.state_changed = on_stream_state_changed,
|
||||
.format_changed = on_stream_format_changed,
|
||||
.new_buffer = on_stream_new_buffer,
|
||||
|
|
@ -358,9 +357,9 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
|||
printf("supported formats:\n");
|
||||
spa_debug_format(formats[0]);
|
||||
|
||||
pw_stream_add_callbacks(data->stream,
|
||||
&data->stream_callbacks,
|
||||
&stream_callbacks,
|
||||
pw_stream_add_listener(data->stream,
|
||||
&data->stream_listener,
|
||||
&stream_events,
|
||||
data);
|
||||
|
||||
pw_stream_connect(data->stream,
|
||||
|
|
@ -375,8 +374,8 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_remote_callbacks remote_callbacks = {
|
||||
PW_VERSION_REMOTE_CALLBACKS,
|
||||
static const struct pw_remote_events remote_events = {
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.state_changed = on_state_changed,
|
||||
};
|
||||
|
||||
|
|
@ -408,7 +407,7 @@ int main(int argc, char *argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
pw_remote_add_callbacks(data.remote, &data.remote_callbacks, &remote_callbacks, &data);
|
||||
pw_remote_add_listener(data.remote, &data.remote_listener, &remote_events, &data);
|
||||
|
||||
pw_remote_connect(data.remote);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include <spa/lib/debug.h>
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
#include <pipewire/sig.h>
|
||||
|
||||
struct type {
|
||||
uint32_t format;
|
||||
|
|
@ -67,10 +66,10 @@ struct data {
|
|||
struct pw_core *core;
|
||||
struct pw_type *t;
|
||||
struct pw_remote *remote;
|
||||
struct pw_callback_info remote_callbacks;
|
||||
struct pw_listener remote_listener;
|
||||
|
||||
struct pw_stream *stream;
|
||||
struct pw_callback_info stream_callbacks;
|
||||
struct pw_listener stream_listener;
|
||||
|
||||
struct spa_video_info_raw format;
|
||||
int32_t stride;
|
||||
|
|
@ -213,8 +212,8 @@ on_stream_format_changed(void *_data, struct spa_format *format)
|
|||
pw_stream_finish_format(stream, SPA_RESULT_OK, params, 2);
|
||||
}
|
||||
|
||||
static const struct pw_stream_callbacks stream_callbacks = {
|
||||
PW_VERSION_STREAM_CALLBACKS,
|
||||
static const struct pw_stream_events stream_events = {
|
||||
PW_VERSION_STREAM_EVENTS,
|
||||
.state_changed = on_stream_state_changed,
|
||||
.format_changed = on_stream_format_changed,
|
||||
};
|
||||
|
|
@ -254,9 +253,9 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
|||
25, 1));
|
||||
formats[0] = SPA_POD_BUILDER_DEREF(&b, f[0].ref, struct spa_format);
|
||||
|
||||
pw_stream_add_callbacks(data->stream,
|
||||
&data->stream_callbacks,
|
||||
&stream_callbacks,
|
||||
pw_stream_add_listener(data->stream,
|
||||
&data->stream_listener,
|
||||
&stream_events,
|
||||
data);
|
||||
|
||||
pw_stream_connect(data->stream,
|
||||
|
|
@ -271,8 +270,8 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_remote_callbacks remote_callbacks = {
|
||||
PW_VERSION_REMOTE_CALLBACKS,
|
||||
static const struct pw_remote_events remote_events = {
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.state_changed = on_state_changed,
|
||||
};
|
||||
|
||||
|
|
@ -292,7 +291,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
data.timer = pw_loop_add_timer(data.loop, on_timeout, &data);
|
||||
|
||||
pw_remote_add_callbacks(data.remote, &data.remote_callbacks, &remote_callbacks, &data);
|
||||
pw_remote_add_listener(data.remote, &data.remote_listener, &remote_events, &data);
|
||||
|
||||
pw_remote_connect(data.remote);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ extern "C" {
|
|||
|
||||
#include <pipewire/proxy.h>
|
||||
|
||||
struct pw_client_node_proxy { struct pw_proxy proxy; };
|
||||
struct pw_client_node_proxy;
|
||||
|
||||
#define PW_TYPE_INTERFACE__ClientNode PW_TYPE_INTERFACE_BASE "ClientNode"
|
||||
|
||||
|
|
@ -46,16 +46,16 @@ struct pw_client_node_buffer {
|
|||
struct spa_buffer *buffer; /**< buffer describing metadata and buffer memory */
|
||||
};
|
||||
|
||||
#define PW_CLIENT_NODE_METHOD_DONE 0
|
||||
#define PW_CLIENT_NODE_METHOD_UPDATE 1
|
||||
#define PW_CLIENT_NODE_METHOD_PORT_UPDATE 2
|
||||
#define PW_CLIENT_NODE_METHOD_EVENT 3
|
||||
#define PW_CLIENT_NODE_METHOD_DESTROY 4
|
||||
#define PW_CLIENT_NODE_METHOD_NUM 5
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_DONE 0
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_UPDATE 1
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_PORT_UPDATE 2
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_EVENT 3
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_DESTROY 4
|
||||
#define PW_CLIENT_NODE_PROXY_METHOD_NUM 5
|
||||
|
||||
/** \ref pw_client_node methods */
|
||||
struct pw_client_node_methods {
|
||||
#define PW_VERSION_CLIENT_NODE_METHODS 0
|
||||
struct pw_client_node_proxy_methods {
|
||||
#define PW_VERSION_CLIENT_NODE_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
/** Complete an async operation */
|
||||
|
|
@ -122,7 +122,7 @@ struct pw_client_node_methods {
|
|||
static inline void
|
||||
pw_client_node_proxy_done(struct pw_client_node_proxy *p, int seq, int res)
|
||||
{
|
||||
pw_proxy_do(&p->proxy, struct pw_client_node_methods, done, seq, res);
|
||||
pw_proxy_do((struct pw_proxy*)p, struct pw_client_node_proxy_methods, done, seq, res);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
@ -132,7 +132,7 @@ pw_client_node_proxy_update(struct pw_client_node_proxy *p,
|
|||
uint32_t max_output_ports,
|
||||
const struct spa_props *props)
|
||||
{
|
||||
pw_proxy_do(&p->proxy, struct pw_client_node_methods, update, change_mask,
|
||||
pw_proxy_do((struct pw_proxy*)p, struct pw_client_node_proxy_methods, update, change_mask,
|
||||
max_input_ports,
|
||||
max_output_ports,
|
||||
props);
|
||||
|
|
@ -150,7 +150,7 @@ pw_client_node_proxy_port_update(struct pw_client_node_proxy *p,
|
|||
const struct spa_param **params,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
pw_proxy_do(&p->proxy, struct pw_client_node_methods, port_update, direction,
|
||||
pw_proxy_do((struct pw_proxy*)p, struct pw_client_node_proxy_methods, port_update, direction,
|
||||
port_id,
|
||||
change_mask,
|
||||
n_possible_formats,
|
||||
|
|
@ -164,32 +164,32 @@ pw_client_node_proxy_port_update(struct pw_client_node_proxy *p,
|
|||
static inline void
|
||||
pw_client_node_proxy_event(struct pw_client_node_proxy *p, struct spa_event *event)
|
||||
{
|
||||
pw_proxy_do(&p->proxy, struct pw_client_node_methods, event, event);
|
||||
pw_proxy_do((struct pw_proxy*)p, struct pw_client_node_proxy_methods, event, event);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pw_client_node_proxy_destroy(struct pw_client_node_proxy *p)
|
||||
{
|
||||
pw_proxy_do_na(&p->proxy, struct pw_client_node_methods, destroy);
|
||||
pw_proxy_do_na((struct pw_proxy*)p, struct pw_client_node_proxy_methods, destroy);
|
||||
}
|
||||
|
||||
|
||||
#define PW_CLIENT_NODE_EVENT_TRANSPORT 0
|
||||
#define PW_CLIENT_NODE_EVENT_SET_PROPS 1
|
||||
#define PW_CLIENT_NODE_EVENT_EVENT 2
|
||||
#define PW_CLIENT_NODE_EVENT_ADD_PORT 3
|
||||
#define PW_CLIENT_NODE_EVENT_REMOVE_PORT 4
|
||||
#define PW_CLIENT_NODE_EVENT_SET_FORMAT 5
|
||||
#define PW_CLIENT_NODE_EVENT_SET_PARAM 6
|
||||
#define PW_CLIENT_NODE_EVENT_ADD_MEM 7
|
||||
#define PW_CLIENT_NODE_EVENT_USE_BUFFERS 8
|
||||
#define PW_CLIENT_NODE_EVENT_NODE_COMMAND 9
|
||||
#define PW_CLIENT_NODE_EVENT_PORT_COMMAND 10
|
||||
#define PW_CLIENT_NODE_EVENT_NUM 11
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_TRANSPORT 0
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_SET_PROPS 1
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_EVENT 2
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_ADD_PORT 3
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_REMOVE_PORT 4
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_SET_FORMAT 5
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_SET_PARAM 6
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_ADD_MEM 7
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_USE_BUFFERS 8
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_NODE_COMMAND 9
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_PORT_COMMAND 10
|
||||
#define PW_CLIENT_NODE_PROXY_EVENT_NUM 11
|
||||
|
||||
/** \ref pw_client_node events */
|
||||
struct pw_client_node_events {
|
||||
#define PW_VERSION_CLIENT_NODE_EVENTS 0
|
||||
struct pw_client_node_proxy_events {
|
||||
#define PW_VERSION_CLIENT_NODE_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify of a new transport area
|
||||
|
|
@ -339,24 +339,24 @@ struct pw_client_node_events {
|
|||
|
||||
static inline void
|
||||
pw_client_node_proxy_add_listener(struct pw_client_node_proxy *p,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_client_node_events *events,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_client_node_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_proxy_add_listener((struct pw_proxy*)p, info, events, data);
|
||||
pw_proxy_add_proxy_listener((struct pw_proxy*)p, listener, events, data);
|
||||
}
|
||||
|
||||
#define pw_client_node_resource_transport(r,...) pw_resource_notify(r,struct pw_client_node_events,transport,__VA_ARGS__)
|
||||
#define pw_client_node_resource_set_props(r,...) pw_resource_notify(r,struct pw_client_node_events,props,__VA_ARGS__)
|
||||
#define pw_client_node_resource_event(r,...) pw_resource_notify(r,struct pw_client_node_events,event,__VA_ARGS__)
|
||||
#define pw_client_node_resource_add_port(r,...) pw_resource_notify(r,struct pw_client_node_events,add_port,__VA_ARGS__)
|
||||
#define pw_client_node_resource_remove_port(r,...) pw_resource_notify(r,struct pw_client_node_events,remove_port,__VA_ARGS__)
|
||||
#define pw_client_node_resource_set_format(r,...) pw_resource_notify(r,struct pw_client_node_events,set_format,__VA_ARGS__)
|
||||
#define pw_client_node_resource_set_param(r,...) pw_resource_notify(r,struct pw_client_node_events,set_param,__VA_ARGS__)
|
||||
#define pw_client_node_resource_add_mem(r,...) pw_resource_notify(r,struct pw_client_node_events,add_mem,__VA_ARGS__)
|
||||
#define pw_client_node_resource_use_buffers(r,...) pw_resource_notify(r,struct pw_client_node_events,use_buffers,__VA_ARGS__)
|
||||
#define pw_client_node_resource_node_command(r,...) pw_resource_notify(r,struct pw_client_node_events,node_command,__VA_ARGS__)
|
||||
#define pw_client_node_resource_port_command(r,...) pw_resource_notify(r,struct pw_client_node_events,port_command,__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_props(r,...) pw_resource_notify(r,struct pw_client_node_proxy_events,props,__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_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_set_format(r,...) pw_resource_notify(r,struct pw_client_node_proxy_events,set_format,__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_add_mem(r,...) pw_resource_notify(r,struct pw_client_node_proxy_events,add_mem,__VA_ARGS__)
|
||||
#define pw_client_node_resource_use_buffers(r,...) pw_resource_notify(r,struct pw_client_node_proxy_events,use_buffers,__VA_ARGS__)
|
||||
#define pw_client_node_resource_node_command(r,...) pw_resource_notify(r,struct pw_client_node_proxy_events,node_command,__VA_ARGS__)
|
||||
#define pw_client_node_resource_port_command(r,...) pw_resource_notify(r,struct pw_client_node_proxy_events,port_command,__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -327,13 +327,13 @@ struct node_data {
|
|||
struct pw_node_proxy *node;
|
||||
uint32_t id;
|
||||
uint32_t parent_id;
|
||||
struct pw_callback_info node_listener;
|
||||
struct pw_listener node_listener;
|
||||
};
|
||||
|
||||
struct registry_data {
|
||||
GstPipeWireDeviceProvider *self;
|
||||
struct pw_registry_proxy *registry;
|
||||
struct pw_callback_info registry_listener;
|
||||
struct pw_listener registry_listener;
|
||||
};
|
||||
|
||||
static void node_event_info(void *data, struct pw_node_info *info)
|
||||
|
|
@ -351,8 +351,8 @@ static void node_event_info(void *data, struct pw_node_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_node_events node_events = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
static const struct pw_node_proxy_events node_events = {
|
||||
PW_VERSION_NODE_PROXY_EVENTS,
|
||||
.info = node_event_info
|
||||
};
|
||||
|
||||
|
|
@ -399,14 +399,14 @@ static void registry_event_global_remove(void *data, uint32_t id)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_registry_events registry_events = {
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
static const struct pw_registry_proxy_events registry_events = {
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
.global = registry_event_global,
|
||||
.global_remove = registry_event_global_remove,
|
||||
};
|
||||
|
||||
static const struct pw_remote_callbacks remote_callbacks = {
|
||||
PW_VERSION_REMOTE_CALLBACKS,
|
||||
static const struct pw_remote_events remote_events = {
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.state_changed = on_state_changed,
|
||||
.sync_reply = on_sync_reply,
|
||||
};
|
||||
|
|
@ -421,7 +421,7 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
|
|||
struct pw_remote *r = NULL;
|
||||
struct pw_registry_proxy *reg = NULL;
|
||||
struct registry_data *data;
|
||||
struct pw_callback_info callbacks;
|
||||
struct pw_listener listener;
|
||||
|
||||
GST_DEBUG_OBJECT (self, "starting probe");
|
||||
|
||||
|
|
@ -436,7 +436,7 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
|
|||
if (!(r = pw_remote_new (c, NULL)))
|
||||
goto failed;
|
||||
|
||||
pw_remote_add_callbacks(r, &callbacks, &remote_callbacks, self);
|
||||
pw_remote_add_listener(r, &listener, &remote_events, self);
|
||||
|
||||
pw_remote_connect (r);
|
||||
|
||||
|
|
@ -528,7 +528,7 @@ gst_pipewire_device_provider_start (GstDeviceProvider * provider)
|
|||
goto failed_remote;
|
||||
}
|
||||
|
||||
pw_remote_add_callbacks (self->remote, &self->remote_callbacks, &remote_callbacks, self);
|
||||
pw_remote_add_listener (self->remote, &self->remote_listener, &remote_events, self);
|
||||
|
||||
pw_remote_connect (self->remote);
|
||||
for (;;) {
|
||||
|
|
|
|||
|
|
@ -86,14 +86,16 @@ struct _GstPipeWireDeviceProvider {
|
|||
|
||||
struct pw_core *core;
|
||||
struct pw_type *type;
|
||||
|
||||
struct pw_remote *remote;
|
||||
struct pw_listener remote_listener;
|
||||
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_registry_proxy *registry;
|
||||
|
||||
gboolean end;
|
||||
gboolean list_only;
|
||||
GList **devices;
|
||||
struct pw_callback_info remote_callbacks;
|
||||
};
|
||||
|
||||
struct _GstPipeWireDeviceProviderClass {
|
||||
|
|
|
|||
|
|
@ -734,8 +734,8 @@ copy_properties (GQuark field_id,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static const struct pw_stream_callbacks stream_callbacks = {
|
||||
PW_VERSION_STREAM_CALLBACKS,
|
||||
static const struct pw_stream_events stream_events = {
|
||||
PW_VERSION_STREAM_EVENTS,
|
||||
.state_changed = on_state_changed,
|
||||
.format_changed = on_format_changed,
|
||||
.add_buffer = on_add_buffer,
|
||||
|
|
@ -763,9 +763,9 @@ gst_pipewire_sink_start (GstBaseSink * basesink)
|
|||
pwsink->stream = pw_stream_new (pwsink->remote, pwsink->client_name, props);
|
||||
pwsink->pool->stream = pwsink->stream;
|
||||
|
||||
pw_stream_add_callbacks(pwsink->stream,
|
||||
&pwsink->stream_callbacks,
|
||||
&stream_callbacks,
|
||||
pw_stream_add_listener(pwsink->stream,
|
||||
&pwsink->stream_listener,
|
||||
&stream_events,
|
||||
pwsink);
|
||||
|
||||
pw_thread_loop_unlock (pwsink->main_loop);
|
||||
|
|
@ -812,8 +812,8 @@ on_remote_state_changed (void *data, enum pw_remote_state old, enum pw_remote_st
|
|||
pw_thread_loop_signal (pwsink->main_loop, FALSE);
|
||||
}
|
||||
|
||||
static const struct pw_remote_callbacks remote_callbacks = {
|
||||
PW_VERSION_REMOTE_CALLBACKS,
|
||||
static const struct pw_remote_events remote_events = {
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.state_changed = on_remote_state_changed,
|
||||
};
|
||||
|
||||
|
|
@ -828,9 +828,9 @@ gst_pipewire_sink_open (GstPipeWireSink * pwsink)
|
|||
pw_thread_loop_lock (pwsink->main_loop);
|
||||
pwsink->remote = pw_remote_new (pwsink->core, NULL);
|
||||
|
||||
pw_remote_add_callbacks (pwsink->remote,
|
||||
&pwsink->remote_callbacks,
|
||||
&remote_callbacks, pwsink);
|
||||
pw_remote_add_listener (pwsink->remote,
|
||||
&pwsink->remote_listener,
|
||||
&remote_events, pwsink);
|
||||
|
||||
pw_remote_connect (pwsink->remote);
|
||||
|
||||
|
|
|
|||
|
|
@ -83,10 +83,10 @@ struct _GstPipeWireSink {
|
|||
struct pw_core *core;
|
||||
struct pw_type *type;
|
||||
struct pw_remote *remote;
|
||||
struct pw_callback_info remote_callbacks;
|
||||
struct pw_listener remote_listener;
|
||||
|
||||
struct pw_stream *stream;
|
||||
struct pw_callback_info stream_callbacks;
|
||||
struct pw_listener stream_listener;
|
||||
|
||||
GstAllocator *allocator;
|
||||
GstStructure *properties;
|
||||
|
|
|
|||
|
|
@ -1008,13 +1008,13 @@ copy_properties (GQuark field_id,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static const struct pw_remote_callbacks remote_callbacks = {
|
||||
PW_VERSION_REMOTE_CALLBACKS,
|
||||
static const struct pw_remote_events remote_events = {
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.state_changed = on_remote_state_changed,
|
||||
};
|
||||
|
||||
static const struct pw_stream_callbacks stream_callbacks = {
|
||||
PW_VERSION_STREAM_CALLBACKS,
|
||||
static const struct pw_stream_events stream_events = {
|
||||
PW_VERSION_STREAM_EVENTS,
|
||||
.state_changed = on_state_changed,
|
||||
.format_changed = on_format_changed,
|
||||
.add_buffer = on_add_buffer,
|
||||
|
|
@ -1035,9 +1035,9 @@ gst_pipewire_src_open (GstPipeWireSrc * pwsrc)
|
|||
if ((pwsrc->remote = pw_remote_new (pwsrc->core, NULL)) == NULL)
|
||||
goto no_remote;
|
||||
|
||||
pw_remote_add_callbacks (pwsrc->remote,
|
||||
&pwsrc->remote_callbacks,
|
||||
&remote_callbacks, pwsrc);
|
||||
pw_remote_add_listener (pwsrc->remote,
|
||||
&pwsrc->remote_listener,
|
||||
&remote_events, pwsrc);
|
||||
|
||||
pw_remote_connect (pwsrc->remote);
|
||||
|
||||
|
|
@ -1065,9 +1065,9 @@ gst_pipewire_src_open (GstPipeWireSrc * pwsrc)
|
|||
goto no_stream;
|
||||
|
||||
|
||||
pw_stream_add_callbacks(pwsrc->stream,
|
||||
&pwsrc->stream_callbacks,
|
||||
&stream_callbacks,
|
||||
pw_stream_add_listener(pwsrc->stream,
|
||||
&pwsrc->stream_listener,
|
||||
&stream_events,
|
||||
pwsrc);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -70,10 +70,10 @@ struct _GstPipeWireSrc {
|
|||
struct pw_core *core;
|
||||
struct pw_type *type;
|
||||
struct pw_remote *remote;
|
||||
struct pw_callback_info remote_callbacks;
|
||||
struct pw_listener remote_listener;
|
||||
|
||||
struct pw_stream *stream;
|
||||
struct pw_callback_info stream_callbacks;
|
||||
struct pw_listener stream_listener;
|
||||
|
||||
GstAllocator *fd_allocator;
|
||||
GstStructure *properties;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ struct impl {
|
|||
struct pw_module *module;
|
||||
struct pw_properties *properties;
|
||||
|
||||
struct pw_callback_info core_callbacks;
|
||||
struct pw_listener core_listener;
|
||||
|
||||
struct spa_list node_list;
|
||||
};
|
||||
|
|
@ -43,10 +43,10 @@ struct node_info {
|
|||
|
||||
struct impl *impl;
|
||||
struct pw_node *node;
|
||||
struct pw_callback_info node_callbacks;
|
||||
struct pw_listener node_listener;
|
||||
|
||||
struct pw_link *link;
|
||||
struct pw_callback_info link_callbacks;
|
||||
struct pw_listener link_listener;
|
||||
};
|
||||
|
||||
static struct node_info *find_node_info(struct impl *impl, struct pw_node *node)
|
||||
|
|
@ -63,8 +63,8 @@ static struct node_info *find_node_info(struct impl *impl, struct pw_node *node)
|
|||
static void node_info_free(struct node_info *info)
|
||||
{
|
||||
spa_list_remove(&info->l);
|
||||
pw_callback_remove(&info->node_callbacks);
|
||||
pw_callback_remove(&info->link_callbacks);
|
||||
pw_listener_remove(&info->node_listener);
|
||||
pw_listener_remove(&info->link_listener);
|
||||
free(info);
|
||||
}
|
||||
|
||||
|
|
@ -130,12 +130,12 @@ link_destroy(void *data)
|
|||
struct impl *impl = info->impl;
|
||||
|
||||
pw_log_debug("module %p: link %p destroyed", impl, link);
|
||||
pw_callback_remove(&info->link_callbacks);
|
||||
spa_list_init(&info->link_callbacks.link);
|
||||
pw_listener_remove(&info->link_listener);
|
||||
spa_list_init(&info->link_listener.link);
|
||||
}
|
||||
|
||||
static const struct pw_link_callbacks link_callbacks = {
|
||||
PW_VERSION_LINK_CALLBACKS,
|
||||
static const struct pw_link_events link_events = {
|
||||
PW_VERSION_LINK_EVENTS,
|
||||
.destroy = link_destroy,
|
||||
.port_unlinked = link_port_unlinked,
|
||||
.state_changed = link_state_changed,
|
||||
|
|
@ -185,7 +185,7 @@ static void try_link_port(struct pw_node *node, struct pw_port *port, struct nod
|
|||
|
||||
info->link = link;
|
||||
|
||||
pw_link_add_callbacks(link, &info->link_callbacks, &link_callbacks, info);
|
||||
pw_link_add_listener(link, &info->link_listener, &link_events, info);
|
||||
pw_link_activate(link);
|
||||
|
||||
return;
|
||||
|
|
@ -230,8 +230,8 @@ node_state_changed(void *data, enum pw_node_state old, enum pw_node_state state,
|
|||
on_node_created(info->node, info);
|
||||
}
|
||||
|
||||
static const struct pw_node_callbacks node_callbacks = {
|
||||
PW_VERSION_NODE_CALLBACKS,
|
||||
static const struct pw_node_events node_events = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
.port_added = node_port_added,
|
||||
.port_removed = node_port_removed,
|
||||
.state_changed = node_state_changed,
|
||||
|
|
@ -252,8 +252,8 @@ core_global_added(void *data, struct pw_global *global)
|
|||
|
||||
spa_list_insert(impl->node_list.prev, &ninfo->l);
|
||||
|
||||
pw_node_add_callbacks(node, &ninfo->node_callbacks, &node_callbacks, ninfo);
|
||||
spa_list_init(&ninfo->link_callbacks.link);
|
||||
pw_node_add_listener(node, &ninfo->node_listener, &node_events, ninfo);
|
||||
spa_list_init(&ninfo->link_listener.link);
|
||||
|
||||
pw_log_debug("module %p: node %p added", impl, node);
|
||||
|
||||
|
|
@ -279,8 +279,8 @@ core_global_removed(void *data, struct pw_global *global)
|
|||
}
|
||||
|
||||
|
||||
const struct pw_core_callbacks core_callbacks = {
|
||||
PW_VERSION_CORE_CALLBACKS,
|
||||
const struct pw_core_events core_events = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
.global_added = core_global_added,
|
||||
.global_removed = core_global_removed,
|
||||
};
|
||||
|
|
@ -308,7 +308,7 @@ static bool module_init(struct pw_module *module, struct pw_properties *properti
|
|||
|
||||
spa_list_init(&impl->node_list);
|
||||
|
||||
pw_core_add_callbacks(core, &impl->core_callbacks, &core_callbacks, impl);
|
||||
pw_core_add_listener(core, &impl->core_listener, &core_events, impl);
|
||||
|
||||
return impl;
|
||||
}
|
||||
|
|
@ -318,14 +318,7 @@ static void module_destroy(struct impl *impl)
|
|||
{
|
||||
pw_log_debug("module %p: destroy", impl);
|
||||
|
||||
pw_global_destroy(impl->global);
|
||||
|
||||
pw_signal_remove(&impl->global_added);
|
||||
pw_signal_remove(&impl->global_removed);
|
||||
pw_signal_remove(&impl->port_added);
|
||||
pw_signal_remove(&impl->port_removed);
|
||||
pw_signal_remove(&impl->port_unlinked);
|
||||
pw_signal_remove(&impl->link_state_changed);
|
||||
pw_listener_remove(&impl->core_listener);
|
||||
free(impl);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -121,8 +121,8 @@ struct impl {
|
|||
|
||||
struct pw_transport *transport;
|
||||
|
||||
struct pw_callback_info node_callbacks;
|
||||
struct pw_callback_info resource_callbacks;
|
||||
struct pw_listener node_listener;
|
||||
struct pw_listener resource_listener;
|
||||
|
||||
int fds[2];
|
||||
int other_fds[2];
|
||||
|
|
@ -904,8 +904,8 @@ static void client_node_destroy(void *data)
|
|||
pw_client_node_destroy(&impl->this);
|
||||
}
|
||||
|
||||
static struct pw_client_node_methods client_node_methods = {
|
||||
PW_VERSION_CLIENT_NODE_METHODS,
|
||||
static struct pw_client_node_proxy_methods client_node_methods = {
|
||||
PW_VERSION_CLIENT_NODE_PROXY_METHODS,
|
||||
.done = client_node_done,
|
||||
.update = client_node_update,
|
||||
.port_update = client_node_port_update,
|
||||
|
|
@ -1071,7 +1071,6 @@ static void client_node_resource_destroy(void *data)
|
|||
struct proxy *proxy = &impl->proxy;
|
||||
|
||||
pw_log_debug("client-node %p: destroy", impl);
|
||||
pw_signal_emit(&this->destroy_signal, this);
|
||||
|
||||
impl->proxy.resource = this->resource = NULL;
|
||||
|
||||
|
|
@ -1091,7 +1090,7 @@ static void node_free(void *data)
|
|||
if (impl->transport)
|
||||
pw_transport_destroy(impl->transport);
|
||||
|
||||
pw_callback_remove(&impl->node_callbacks);
|
||||
pw_listener_remove(&impl->node_listener);
|
||||
|
||||
if (impl->fds[0] != -1)
|
||||
close(impl->fds[0]);
|
||||
|
|
@ -1100,14 +1099,14 @@ static void node_free(void *data)
|
|||
free(impl);
|
||||
}
|
||||
|
||||
static const struct pw_node_callbacks node_callbacks = {
|
||||
PW_VERSION_NODE_CALLBACKS,
|
||||
static const struct pw_node_events node_events = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
.free = node_free,
|
||||
.initialized = node_initialized,
|
||||
};
|
||||
|
||||
static const struct pw_resource_callbacks resource_callbacks = {
|
||||
PW_VERSION_RESOURCE_CALLBACKS,
|
||||
static const struct pw_resource_events resource_events = {
|
||||
PW_VERSION_RESOURCE_EVENTS,
|
||||
.destroy = client_node_resource_destroy,
|
||||
};
|
||||
|
||||
|
|
@ -1140,8 +1139,6 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
|||
impl->fds[0] = impl->fds[1] = -1;
|
||||
pw_log_debug("client-node %p: new", impl);
|
||||
|
||||
pw_signal_init(&this->destroy_signal);
|
||||
|
||||
proxy_init(&impl->proxy, NULL, core->support, core->n_support);
|
||||
impl->proxy.impl = impl;
|
||||
|
||||
|
|
@ -1157,9 +1154,9 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
|||
if (this->node == NULL)
|
||||
goto error_no_node;
|
||||
|
||||
pw_resource_add_callbacks(this->resource,
|
||||
&impl->resource_callbacks,
|
||||
&resource_callbacks,
|
||||
pw_resource_add_listener(this->resource,
|
||||
&impl->resource_listener,
|
||||
&resource_events,
|
||||
impl);
|
||||
pw_resource_set_implementation(this->resource,
|
||||
&client_node_methods,
|
||||
|
|
@ -1167,7 +1164,7 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
|||
|
||||
impl->proxy.resource = this->resource;
|
||||
|
||||
pw_node_add_callbacks(this->node, &impl->node_callbacks, &node_callbacks, impl);
|
||||
pw_node_add_listener(this->node, &impl->node_listener, &node_events, impl);
|
||||
|
||||
return this;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ struct pw_client_node {
|
|||
struct pw_node *node;
|
||||
|
||||
struct pw_resource *resource;
|
||||
|
||||
PW_SIGNAL(destroy_signal, (struct pw_listener *listener, struct pw_client_node *node));
|
||||
};
|
||||
|
||||
struct pw_client_node *
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ client_node_marshal_done(void *object, int seq, int res)
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_METHOD_DONE);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_PROXY_METHOD_DONE);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, seq,
|
||||
|
|
@ -57,7 +57,7 @@ client_node_marshal_update(void *object,
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_METHOD_UPDATE);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_PROXY_METHOD_UPDATE);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, change_mask,
|
||||
|
|
@ -83,7 +83,7 @@ client_node_marshal_port_update(void *object,
|
|||
struct spa_pod_frame f[2];
|
||||
int i;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_METHOD_PORT_UPDATE);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_PROXY_METHOD_PORT_UPDATE);
|
||||
|
||||
spa_pod_builder_add(b,
|
||||
SPA_POD_TYPE_STRUCT, &f[0],
|
||||
|
|
@ -120,7 +120,7 @@ static void client_node_marshal_event_method(void *object, struct spa_event *eve
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_METHOD_EVENT);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_PROXY_METHOD_EVENT);
|
||||
|
||||
spa_pod_builder_struct(b, &f, SPA_POD_TYPE_POD, event);
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ static void client_node_marshal_destroy(void *object)
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_METHOD_DESTROY);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_PROXY_METHOD_DESTROY);
|
||||
|
||||
spa_pod_builder_struct(b, &f, 0);
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ static bool client_node_demarshal_set_props(void *object, void *data, size_t siz
|
|||
-SPA_POD_TYPE_OBJECT, &props, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, set_props, seq, props);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, set_props, seq, props);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ static bool client_node_demarshal_event_event(void *object, void *data, size_t s
|
|||
!spa_pod_iter_get(&it, SPA_POD_TYPE_OBJECT, &event, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, event, event);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, event, event);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ static bool client_node_demarshal_add_port(void *object, void *data, size_t size
|
|||
SPA_POD_TYPE_INT, &direction, SPA_POD_TYPE_INT, &port_id, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, add_port, seq, direction, port_id);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, add_port, seq, direction, port_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -199,7 +199,7 @@ static bool client_node_demarshal_remove_port(void *object, void *data, size_t s
|
|||
SPA_POD_TYPE_INT, &direction, SPA_POD_TYPE_INT, &port_id, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, remove_port, seq, direction, port_id);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, remove_port, seq, direction, port_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ static bool client_node_demarshal_set_format(void *object, void *data, size_t si
|
|||
-SPA_POD_TYPE_OBJECT, &format, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, set_format, seq, direction, port_id,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, set_format, seq, direction, port_id,
|
||||
flags, format);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -239,7 +239,7 @@ static bool client_node_demarshal_set_param(void *object, void *data, size_t siz
|
|||
-SPA_POD_TYPE_OBJECT, ¶m, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, set_param, seq, direction, port_id, param);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, set_param, seq, direction, port_id, param);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ static bool client_node_demarshal_add_mem(void *object, void *data, size_t size)
|
|||
|
||||
memfd = pw_protocol_native_get_proxy_fd(proxy, memfd_idx);
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, add_mem, direction,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, add_mem, direction,
|
||||
port_id,
|
||||
mem_id,
|
||||
type,
|
||||
|
|
@ -325,7 +325,7 @@ static bool client_node_demarshal_use_buffers(void *object, void *data, size_t s
|
|||
d->data = SPA_UINT32_TO_PTR(data_id);
|
||||
}
|
||||
}
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, use_buffers, seq,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, use_buffers, seq,
|
||||
direction,
|
||||
port_id,
|
||||
n_buffers, buffers);
|
||||
|
|
@ -343,7 +343,7 @@ static bool client_node_demarshal_node_command(void *object, void *data, size_t
|
|||
!spa_pod_iter_get(&it, SPA_POD_TYPE_INT, &seq, SPA_POD_TYPE_OBJECT, &command, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, node_command, seq, command);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, node_command, seq, command);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -361,7 +361,7 @@ static bool client_node_demarshal_port_command(void *object, void *data, size_t
|
|||
SPA_POD_TYPE_OBJECT, &command, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, port_command, direction,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, port_command, direction,
|
||||
port_id,
|
||||
command);
|
||||
return true;
|
||||
|
|
@ -390,7 +390,7 @@ static bool client_node_demarshal_transport(void *object, void *data, size_t siz
|
|||
if (readfd == -1 || writefd == -1 || memfd_idx == -1)
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, transport, node_id,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, transport, node_id,
|
||||
readfd, writefd,
|
||||
memfd, offset, sz);
|
||||
return true;
|
||||
|
|
@ -403,7 +403,7 @@ client_node_marshal_set_props(void *object, uint32_t seq, const struct spa_props
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_SET_PROPS);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_SET_PROPS);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, seq,
|
||||
|
|
@ -418,7 +418,7 @@ static void client_node_marshal_event_event(void *object, const struct spa_event
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_EVENT);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_EVENT);
|
||||
|
||||
spa_pod_builder_struct(b, &f, SPA_POD_TYPE_POD, event);
|
||||
|
||||
|
|
@ -433,7 +433,7 @@ client_node_marshal_add_port(void *object,
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_ADD_PORT);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_ADD_PORT);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, seq,
|
||||
|
|
@ -450,7 +450,7 @@ client_node_marshal_remove_port(void *object,
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_REMOVE_PORT);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_REMOVE_PORT);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, seq,
|
||||
|
|
@ -471,7 +471,7 @@ client_node_marshal_set_format(void *object,
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_SET_FORMAT);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_SET_FORMAT);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, seq,
|
||||
|
|
@ -494,7 +494,7 @@ client_node_marshal_set_param(void *object,
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_SET_PARAM);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_SET_PARAM);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, seq,
|
||||
|
|
@ -517,7 +517,7 @@ client_node_marshal_add_mem(void *object,
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_ADD_MEM);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_ADD_MEM);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, direction,
|
||||
|
|
@ -543,7 +543,7 @@ client_node_marshal_use_buffers(void *object,
|
|||
struct spa_pod_frame f;
|
||||
uint32_t i, j;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_USE_BUFFERS);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_USE_BUFFERS);
|
||||
|
||||
spa_pod_builder_add(b,
|
||||
SPA_POD_TYPE_STRUCT, &f,
|
||||
|
|
@ -588,7 +588,7 @@ client_node_marshal_node_command(void *object, uint32_t seq, const struct spa_co
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_NODE_COMMAND);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_NODE_COMMAND);
|
||||
|
||||
spa_pod_builder_struct(b, &f, SPA_POD_TYPE_INT, seq, SPA_POD_TYPE_POD, command);
|
||||
|
||||
|
|
@ -605,7 +605,7 @@ client_node_marshal_port_command(void *object,
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_PORT_COMMAND);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_PORT_COMMAND);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, direction,
|
||||
|
|
@ -622,7 +622,7 @@ static void client_node_marshal_transport(void *object, uint32_t node_id, int re
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_TRANSPORT);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_TRANSPORT);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, node_id,
|
||||
|
|
@ -647,7 +647,7 @@ static bool client_node_demarshal_done(void *object, void *data, size_t size)
|
|||
SPA_POD_TYPE_INT, &res, 0))
|
||||
return false;
|
||||
|
||||
pw_resource_do(resource, struct pw_client_node_methods, done, seq, res);
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, done, seq, res);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -665,7 +665,7 @@ static bool client_node_demarshal_update(void *object, void *data, size_t size)
|
|||
SPA_POD_TYPE_INT, &max_output_ports, -SPA_POD_TYPE_OBJECT, &props, 0))
|
||||
return false;
|
||||
|
||||
pw_resource_do(resource, struct pw_client_node_methods, update, change_mask,
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, update, change_mask,
|
||||
max_input_ports,
|
||||
max_output_ports,
|
||||
props);
|
||||
|
|
@ -717,7 +717,7 @@ static bool client_node_demarshal_port_update(void *object, void *data, size_t s
|
|||
return false;
|
||||
}
|
||||
|
||||
pw_resource_do(resource, struct pw_client_node_methods, port_update, direction,
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, port_update, direction,
|
||||
port_id,
|
||||
change_mask,
|
||||
n_possible_formats,
|
||||
|
|
@ -738,7 +738,7 @@ static bool client_node_demarshal_event_method(void *object, void *data, size_t
|
|||
!spa_pod_iter_get(&it, SPA_POD_TYPE_OBJECT, &event, 0))
|
||||
return false;
|
||||
|
||||
pw_resource_do(resource, struct pw_client_node_methods, event, event);
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, event, event);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -750,12 +750,12 @@ static bool client_node_demarshal_destroy(void *object, void *data, size_t size)
|
|||
if (!spa_pod_iter_struct(&it, data, size))
|
||||
return false;
|
||||
|
||||
pw_resource_do_na(resource, struct pw_client_node_methods, destroy);
|
||||
pw_resource_do_na(resource, struct pw_client_node_proxy_methods, destroy);
|
||||
return true;
|
||||
}
|
||||
|
||||
static const struct pw_client_node_methods pw_protocol_native_client_node_method_marshal = {
|
||||
PW_VERSION_CLIENT_NODE_METHODS,
|
||||
static const struct pw_client_node_proxy_methods pw_protocol_native_client_node_method_marshal = {
|
||||
PW_VERSION_CLIENT_NODE_PROXY_METHODS,
|
||||
&client_node_marshal_done,
|
||||
&client_node_marshal_update,
|
||||
&client_node_marshal_port_update,
|
||||
|
|
@ -771,8 +771,8 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_client_node_
|
|||
{ &client_node_demarshal_destroy, 0 },
|
||||
};
|
||||
|
||||
static const struct pw_client_node_events pw_protocol_native_client_node_event_marshal = {
|
||||
PW_VERSION_CLIENT_NODE_EVENTS,
|
||||
static const struct pw_client_node_proxy_events pw_protocol_native_client_node_event_marshal = {
|
||||
PW_VERSION_CLIENT_NODE_PROXY_EVENTS,
|
||||
&client_node_marshal_transport,
|
||||
&client_node_marshal_set_props,
|
||||
&client_node_marshal_event_event,
|
||||
|
|
@ -803,10 +803,10 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_client_node_
|
|||
const struct pw_protocol_marshal pw_protocol_native_client_node_marshal = {
|
||||
PW_TYPE_INTERFACE__ClientNode,
|
||||
PW_VERSION_CLIENT_NODE,
|
||||
PW_CLIENT_NODE_METHOD_NUM,
|
||||
PW_CLIENT_NODE_PROXY_METHOD_NUM,
|
||||
&pw_protocol_native_client_node_method_marshal,
|
||||
&pw_protocol_native_client_node_method_demarshal,
|
||||
PW_CLIENT_NODE_EVENT_NUM,
|
||||
PW_CLIENT_NODE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_client_node_event_marshal,
|
||||
pw_protocol_native_client_node_event_demarshal,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ struct impl {
|
|||
|
||||
DBusConnection *bus;
|
||||
|
||||
struct pw_callback_info core_callbacks;
|
||||
struct pw_listener core_listener;
|
||||
|
||||
struct spa_list client_list;
|
||||
|
||||
|
|
@ -54,10 +54,10 @@ struct client_info {
|
|||
struct spa_list link;
|
||||
struct pw_client *client;
|
||||
bool is_sandboxed;
|
||||
const struct pw_core_methods *old_methods;
|
||||
struct pw_core_methods core_methods;
|
||||
const struct pw_core_proxy_methods *old_methods;
|
||||
struct pw_core_proxy_methods core_methods;
|
||||
struct spa_list async_pending;
|
||||
struct pw_callback_info client_callback;
|
||||
struct pw_listener client_listener;
|
||||
};
|
||||
|
||||
struct async_pending {
|
||||
|
|
@ -138,7 +138,7 @@ static void client_info_free(struct client_info *cinfo)
|
|||
spa_list_for_each_safe(p, tmp, &cinfo->async_pending, link)
|
||||
free_pending(p);
|
||||
|
||||
pw_callback_remove(&cinfo->client_callback);
|
||||
pw_listener_remove(&cinfo->client_listener);
|
||||
spa_list_remove(&cinfo->link);
|
||||
free(cinfo);
|
||||
}
|
||||
|
|
@ -447,8 +447,8 @@ static void client_resource_impl(void *data, struct pw_resource *resource)
|
|||
}
|
||||
}
|
||||
|
||||
const struct pw_client_callbacks client_callbacks = {
|
||||
PW_VERSION_CLIENT_CALLBACKS,
|
||||
const struct pw_client_events client_events = {
|
||||
PW_VERSION_CLIENT_EVENTS,
|
||||
.resource_impl = client_resource_impl,
|
||||
};
|
||||
|
||||
|
|
@ -467,7 +467,7 @@ core_global_added(void *data, struct pw_global *global)
|
|||
cinfo->is_sandboxed = client_is_sandboxed(client);
|
||||
spa_list_init(&cinfo->async_pending);
|
||||
|
||||
pw_client_add_callbacks(client, &cinfo->client_callback, &client_callbacks, cinfo);
|
||||
pw_client_add_listener(client, &cinfo->client_listener, &client_events, cinfo);
|
||||
|
||||
spa_list_insert(impl->client_list.prev, &cinfo->link);
|
||||
|
||||
|
|
@ -491,8 +491,8 @@ core_global_removed(void *data, struct pw_global *global)
|
|||
}
|
||||
}
|
||||
|
||||
const struct pw_core_callbacks core_callbacks = {
|
||||
PW_VERSION_CORE_CALLBACKS,
|
||||
const struct pw_core_events core_events = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
.global_added = core_global_added,
|
||||
.global_removed = core_global_removed,
|
||||
};
|
||||
|
|
@ -699,7 +699,7 @@ static struct impl *module_new(struct pw_core *core, struct pw_properties *prope
|
|||
|
||||
spa_list_init(&impl->client_list);
|
||||
|
||||
pw_core_add_callbacks(core, &impl->core_callbacks, &core_callbacks, impl);
|
||||
pw_core_add_listener(core, &impl->core_listener, &core_events, impl);
|
||||
|
||||
core->permission_func = do_permission;
|
||||
core->permission_data = impl;
|
||||
|
|
|
|||
|
|
@ -96,9 +96,9 @@ struct client {
|
|||
struct impl *impl;
|
||||
struct spa_list link;
|
||||
struct pw_client *client;
|
||||
struct pw_listener client_listener;
|
||||
int fd;
|
||||
struct spa_source *source;
|
||||
struct pw_callback_info client_callbacks;
|
||||
};
|
||||
|
||||
static int process_messages(struct client *client);
|
||||
|
|
@ -429,8 +429,8 @@ connection_data(struct spa_loop_utils *utils,
|
|||
process_messages(client);
|
||||
}
|
||||
|
||||
static const struct pw_client_callbacks client_callbacks = {
|
||||
PW_VERSION_CLIENT_CALLBACKS,
|
||||
static const struct pw_client_events client_events = {
|
||||
PW_VERSION_CLIENT_EVENTS,
|
||||
.destroy = client_destroy,
|
||||
.busy_changed = client_busy_changed,
|
||||
};
|
||||
|
|
@ -467,7 +467,7 @@ static struct client *client_new(struct impl *impl, int fd)
|
|||
|
||||
spa_list_insert(impl->client_list.prev, &this->link);
|
||||
|
||||
pw_client_add_callbacks(client, &this->client_callbacks, &client_callbacks, this);
|
||||
pw_client_add_listener(client, &this->client_listener, &client_events, this);
|
||||
|
||||
pw_log_error("module-jack %p: added new client", impl);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,11 +65,12 @@ struct connection {
|
|||
int fd;
|
||||
|
||||
struct spa_source *source;
|
||||
|
||||
struct pw_protocol_native_connection *connection;
|
||||
struct pw_listener conn_listener;
|
||||
|
||||
bool disconnecting;
|
||||
bool flush_signaled;
|
||||
struct pw_listener need_flush;
|
||||
struct spa_source *flush_event;
|
||||
};
|
||||
|
||||
|
|
@ -88,10 +89,10 @@ struct listener {
|
|||
|
||||
struct client_data {
|
||||
struct pw_client *client;
|
||||
struct pw_listener client_listener;
|
||||
int fd;
|
||||
struct spa_source *source;
|
||||
struct pw_protocol_native_connection *connection;
|
||||
struct pw_callback_info client_callbacks;
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
@ -221,8 +222,8 @@ static void client_free(void *data)
|
|||
close(this->fd);
|
||||
}
|
||||
|
||||
static const struct pw_client_callbacks client_callbacks = {
|
||||
PW_VERSION_CLIENT_CALLBACKS,
|
||||
static const struct pw_client_events client_events = {
|
||||
PW_VERSION_CLIENT_EVENTS,
|
||||
.free = client_free,
|
||||
.busy_changed = client_busy_changed,
|
||||
};
|
||||
|
|
@ -264,7 +265,7 @@ static struct pw_client *client_new(struct listener *l, int fd)
|
|||
client->protocol = protocol;
|
||||
spa_list_insert(l->this.client_list.prev, &client->protocol_link);
|
||||
|
||||
pw_client_add_callbacks(client, &this->client_callbacks, &client_callbacks, client);
|
||||
pw_client_add_listener(client, &this->client_listener, &client_events, client);
|
||||
|
||||
pw_global_bind(protocol->core->global, client, PW_PERM_RWX, PW_VERSION_CORE, 0);
|
||||
|
||||
|
|
@ -526,9 +527,9 @@ static void do_flush_event(struct spa_loop_utils *utils, struct spa_source *sour
|
|||
impl->this.disconnect(&impl->this);
|
||||
}
|
||||
|
||||
static void on_need_flush(struct pw_listener *listener, struct pw_protocol_native_connection *connection)
|
||||
static void on_need_flush(void *data)
|
||||
{
|
||||
struct connection *impl = SPA_CONTAINER_OF(listener, struct connection, need_flush);
|
||||
struct connection *impl = data;
|
||||
struct pw_remote *remote = impl->this.remote;
|
||||
|
||||
if (!impl->flush_signaled) {
|
||||
|
|
@ -537,6 +538,11 @@ static void on_need_flush(struct pw_listener *listener, struct pw_protocol_nativ
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_protocol_native_connection_events conn_events = {
|
||||
PW_VERSION_PROTOCOL_NATIVE_CONNECTION_EVENTS,
|
||||
.need_flush = on_need_flush,
|
||||
};
|
||||
|
||||
static int impl_connect_fd(struct pw_protocol_connection *conn, int fd)
|
||||
{
|
||||
struct connection *impl = SPA_CONTAINER_OF(conn, struct connection, this);
|
||||
|
|
@ -546,7 +552,10 @@ static int impl_connect_fd(struct pw_protocol_connection *conn, int fd)
|
|||
if (impl->connection == NULL)
|
||||
goto error_close;
|
||||
|
||||
pw_signal_add(&impl->connection->need_flush, &impl->need_flush, on_need_flush);
|
||||
pw_protocol_native_connection_add_listener(impl->connection,
|
||||
&impl->conn_listener,
|
||||
&conn_events,
|
||||
impl);
|
||||
|
||||
impl->fd = fd;
|
||||
impl->source = pw_loop_add_io(remote->core->main_loop,
|
||||
|
|
@ -788,10 +797,6 @@ static void pw_protocol_native_destroy(struct impl *impl)
|
|||
|
||||
pw_log_debug("protocol-native %p: destroy", impl);
|
||||
|
||||
pw_signal_remove(&impl->before_iterate);
|
||||
|
||||
pw_global_destroy(impl->global);
|
||||
|
||||
spa_list_for_each_safe(object, tmp, &impl->object_list, link)
|
||||
object_destroy(object);
|
||||
|
||||
|
|
|
|||
|
|
@ -203,8 +203,7 @@ struct pw_protocol_native_connection *pw_protocol_native_connection_new(int fd)
|
|||
pw_log_debug("connection %p: new", this);
|
||||
|
||||
this->fd = fd;
|
||||
pw_signal_init(&this->need_flush);
|
||||
pw_signal_init(&this->destroy_signal);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
|
||||
impl->out.buffer_data = malloc(MAX_BUFFER_SIZE);
|
||||
impl->out.buffer_maxsize = MAX_BUFFER_SIZE;
|
||||
|
|
@ -236,7 +235,7 @@ void pw_protocol_native_connection_destroy(struct pw_protocol_native_connection
|
|||
|
||||
pw_log_debug("connection %p: destroy", conn);
|
||||
|
||||
pw_signal_emit(&conn->destroy_signal, conn);
|
||||
pw_listener_list_emit_na(&conn->listener_list, struct pw_protocol_native_connection_events, destroy);
|
||||
|
||||
free(impl->out.buffer_data);
|
||||
free(impl->in.buffer_data);
|
||||
|
|
@ -431,8 +430,7 @@ pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn,
|
|||
printf(">>>>>>>>> out:\n");
|
||||
spa_debug_pod((struct spa_pod *)p);
|
||||
}
|
||||
|
||||
pw_signal_emit(&conn->need_flush, conn);
|
||||
pw_listener_list_emit_na(&conn->listener_list, struct pw_protocol_native_connection_events, need_flush);
|
||||
}
|
||||
|
||||
/** Flush the connection object
|
||||
|
|
|
|||
|
|
@ -25,7 +25,14 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <pipewire/sig.h>
|
||||
#include <pipewire/listener.h>
|
||||
|
||||
struct pw_protocol_native_connection_events {
|
||||
#define PW_VERSION_PROTOCOL_NATIVE_CONNECTION_EVENTS 0
|
||||
void (*destroy) (void *data);
|
||||
|
||||
void (*need_flush) (void *data);
|
||||
};
|
||||
|
||||
/** \class pw_protocol_native_connection
|
||||
*
|
||||
|
|
@ -37,14 +44,18 @@ extern "C" {
|
|||
struct pw_protocol_native_connection {
|
||||
int fd; /**< the socket */
|
||||
|
||||
/** Emited when data has been written that needs to be flushed */
|
||||
PW_SIGNAL(need_flush, (struct pw_listener *listener,
|
||||
struct pw_protocol_native_connection *conn));
|
||||
/** Emited when the connection is destroyed */
|
||||
PW_SIGNAL(destroy_signal, (struct pw_listener *listener,
|
||||
struct pw_protocol_native_connection *conn));
|
||||
struct pw_listener_list listener_list;
|
||||
};
|
||||
|
||||
static inline void
|
||||
pw_protocol_native_connection_add_listener(struct pw_protocol_native_connection *conn,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_protocol_native_connection_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_listener_list_add(&conn->listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
struct pw_protocol_native_connection *
|
||||
pw_protocol_native_connection_new(int fd);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ static void core_marshal_client_update(void *object, const struct spa_dict *prop
|
|||
struct spa_pod_frame f;
|
||||
int i, n_items;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_METHOD_CLIENT_UPDATE);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_CLIENT_UPDATE);
|
||||
|
||||
n_items = props ? props->n_items : 0;
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ static void core_marshal_sync(void *object, uint32_t seq)
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_METHOD_SYNC);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_SYNC);
|
||||
|
||||
spa_pod_builder_struct(b, &f, SPA_POD_TYPE_INT, seq);
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ static void core_marshal_get_registry(void *object, uint32_t version, uint32_t n
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_METHOD_GET_REGISTRY);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_GET_REGISTRY);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, version,
|
||||
|
|
@ -93,7 +93,7 @@ core_marshal_create_node(void *object,
|
|||
struct spa_pod_frame f;
|
||||
uint32_t i, n_items;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_METHOD_CREATE_NODE);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_CREATE_NODE);
|
||||
|
||||
n_items = props ? props->n_items : 0;
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ core_marshal_create_link(void *object,
|
|||
struct spa_pod_frame f;
|
||||
uint32_t i, n_items;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_METHOD_CREATE_LINK);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_CREATE_LINK);
|
||||
|
||||
n_items = props ? props->n_items : 0;
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ core_marshal_update_types_client(void *object, uint32_t first_id, uint32_t n_typ
|
|||
struct spa_pod_frame f;
|
||||
uint32_t i;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_METHOD_UPDATE_TYPES);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_UPDATE_TYPES);
|
||||
|
||||
spa_pod_builder_add(b,
|
||||
SPA_POD_TYPE_STRUCT, &f,
|
||||
|
|
@ -205,7 +205,7 @@ static bool core_demarshal_info(void *object, void *data, size_t size)
|
|||
SPA_POD_TYPE_STRING, &props.items[i].value, 0))
|
||||
return false;
|
||||
}
|
||||
pw_proxy_notify(proxy, struct pw_core_events, info, &info);
|
||||
pw_proxy_notify(proxy, struct pw_core_proxy_events, info, &info);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ static bool core_demarshal_done(void *object, void *data, size_t size)
|
|||
!spa_pod_iter_get(&it, SPA_POD_TYPE_INT, &seq, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_core_events, done, seq);
|
||||
pw_proxy_notify(proxy, struct pw_core_proxy_events, done, seq);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ static bool core_demarshal_error(void *object, void *data, size_t size)
|
|||
SPA_POD_TYPE_INT, &res, SPA_POD_TYPE_STRING, &error, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_core_events, error, id, res, error);
|
||||
pw_proxy_notify(proxy, struct pw_core_proxy_events, error, id, res, error);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ static bool core_demarshal_remove_id(void *object, void *data, size_t size)
|
|||
!spa_pod_iter_get(&it, SPA_POD_TYPE_INT, &id, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_core_events, remove_id, id);
|
||||
pw_proxy_notify(proxy, struct pw_core_proxy_events, remove_id, id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ static bool core_demarshal_update_types_client(void *object, void *data, size_t
|
|||
if (!spa_pod_iter_get(&it, SPA_POD_TYPE_STRING, &types[i], 0))
|
||||
return false;
|
||||
}
|
||||
pw_proxy_notify(proxy, struct pw_core_events, update_types, first_id, n_types, types);
|
||||
pw_proxy_notify(proxy, struct pw_core_proxy_events, update_types, first_id, n_types, types);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -282,7 +282,7 @@ static void core_marshal_info(void *object, struct pw_core_info *info)
|
|||
struct spa_pod_frame f;
|
||||
uint32_t i, n_items;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_INFO);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_INFO);
|
||||
|
||||
n_items = info->props ? info->props->n_items : 0;
|
||||
|
||||
|
|
@ -311,7 +311,7 @@ static void core_marshal_done(void *object, uint32_t seq)
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_DONE);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_DONE);
|
||||
|
||||
spa_pod_builder_struct(b, &f, SPA_POD_TYPE_INT, seq);
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ static void core_marshal_error(void *object, uint32_t id, int res, const char *e
|
|||
struct spa_pod_frame f;
|
||||
va_list ap;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_ERROR);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_ERROR);
|
||||
|
||||
va_start(ap, error);
|
||||
vsnprintf(buffer, sizeof(buffer), error, ap);
|
||||
|
|
@ -346,7 +346,7 @@ static void core_marshal_remove_id(void *object, uint32_t id)
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_REMOVE_ID);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_REMOVE_ID);
|
||||
|
||||
spa_pod_builder_struct(b, &f, SPA_POD_TYPE_INT, id);
|
||||
|
||||
|
|
@ -361,7 +361,7 @@ core_marshal_update_types_server(void *object, uint32_t first_id, uint32_t n_typ
|
|||
struct spa_pod_frame f;
|
||||
uint32_t i;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_UPDATE_TYPES);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_UPDATE_TYPES);
|
||||
|
||||
spa_pod_builder_add(b,
|
||||
SPA_POD_TYPE_STRUCT, &f,
|
||||
|
|
@ -393,7 +393,7 @@ static bool core_demarshal_client_update(void *object, void *data, size_t size)
|
|||
SPA_POD_TYPE_STRING, &props.items[i].value, 0))
|
||||
return false;
|
||||
}
|
||||
pw_resource_do(resource, struct pw_core_methods, client_update, &props);
|
||||
pw_resource_do(resource, struct pw_core_proxy_methods, client_update, &props);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -407,7 +407,7 @@ static bool core_demarshal_sync(void *object, void *data, size_t size)
|
|||
!spa_pod_iter_get(&it, SPA_POD_TYPE_INT, &seq, 0))
|
||||
return false;
|
||||
|
||||
pw_resource_do(resource, struct pw_core_methods, sync, seq);
|
||||
pw_resource_do(resource, struct pw_core_proxy_methods, sync, seq);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -424,7 +424,7 @@ static bool core_demarshal_get_registry(void *object, void *data, size_t size)
|
|||
|
||||
return false;
|
||||
|
||||
pw_resource_do(resource, struct pw_core_methods, get_registry, version, new_id);
|
||||
pw_resource_do(resource, struct pw_core_proxy_methods, get_registry, version, new_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -456,7 +456,7 @@ static bool core_demarshal_create_node(void *object, void *data, size_t size)
|
|||
SPA_POD_TYPE_INT, &new_id, 0))
|
||||
return false;
|
||||
|
||||
pw_resource_do(resource, struct pw_core_methods, create_node, factory_name, name,
|
||||
pw_resource_do(resource, struct pw_core_proxy_methods, create_node, factory_name, name,
|
||||
type, version,
|
||||
&props, new_id);
|
||||
return true;
|
||||
|
|
@ -491,7 +491,7 @@ static bool core_demarshal_create_link(void *object, void *data, size_t size)
|
|||
if (!spa_pod_iter_get(&it, SPA_POD_TYPE_INT, &new_id, 0))
|
||||
return false;
|
||||
|
||||
pw_resource_do(resource, struct pw_core_methods, create_link, output_node_id,
|
||||
pw_resource_do(resource, struct pw_core_proxy_methods, create_link, output_node_id,
|
||||
output_port_id,
|
||||
input_node_id,
|
||||
input_port_id,
|
||||
|
|
@ -518,7 +518,7 @@ static bool core_demarshal_update_types_server(void *object, void *data, size_t
|
|||
if (!spa_pod_iter_get(&it, SPA_POD_TYPE_STRING, &types[i], 0))
|
||||
return false;
|
||||
}
|
||||
pw_resource_do(resource, struct pw_core_methods, update_types, first_id, n_types, types);
|
||||
pw_resource_do(resource, struct pw_core_proxy_methods, update_types, first_id, n_types, types);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -529,7 +529,7 @@ static void registry_marshal_global(void *object, uint32_t id, uint32_t parent_i
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_EVENT_GLOBAL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_PROXY_EVENT_GLOBAL);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, id,
|
||||
|
|
@ -547,7 +547,7 @@ static void registry_marshal_global_remove(void *object, uint32_t id)
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_EVENT_GLOBAL_REMOVE);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_PROXY_EVENT_GLOBAL_REMOVE);
|
||||
|
||||
spa_pod_builder_struct(b, &f, SPA_POD_TYPE_INT, id);
|
||||
|
||||
|
|
@ -568,7 +568,7 @@ static bool registry_demarshal_bind(void *object, void *data, size_t size)
|
|||
SPA_POD_TYPE_INT, &new_id, 0))
|
||||
return false;
|
||||
|
||||
pw_resource_do(resource, struct pw_registry_methods, bind, id, type, version, new_id);
|
||||
pw_resource_do(resource, struct pw_registry_proxy_methods, bind, id, type, version, new_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -579,7 +579,7 @@ static void module_marshal_info(void *object, struct pw_module_info *info)
|
|||
struct spa_pod_frame f;
|
||||
uint32_t i, n_items;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_MODULE_EVENT_INFO);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_MODULE_PROXY_EVENT_INFO);
|
||||
|
||||
n_items = info->props ? info->props->n_items : 0;
|
||||
|
||||
|
|
@ -624,7 +624,7 @@ static bool module_demarshal_info(void *object, void *data, size_t size)
|
|||
SPA_POD_TYPE_STRING, &props.items[i].value, 0))
|
||||
return false;
|
||||
}
|
||||
pw_proxy_notify(proxy, struct pw_module_events, info, &info);
|
||||
pw_proxy_notify(proxy, struct pw_module_proxy_events, info, &info);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -635,7 +635,7 @@ static void node_marshal_info(void *object, struct pw_node_info *info)
|
|||
struct spa_pod_frame f;
|
||||
uint32_t i, n_items;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_NODE_EVENT_INFO);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_NODE_PROXY_EVENT_INFO);
|
||||
|
||||
spa_pod_builder_add(b,
|
||||
SPA_POD_TYPE_STRUCT, &f,
|
||||
|
|
@ -719,7 +719,7 @@ static bool node_demarshal_info(void *object, void *data, size_t size)
|
|||
SPA_POD_TYPE_STRING, &props.items[i].value, 0))
|
||||
return false;
|
||||
}
|
||||
pw_proxy_notify(proxy, struct pw_node_events, info, &info);
|
||||
pw_proxy_notify(proxy, struct pw_node_proxy_events, info, &info);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -730,7 +730,7 @@ static void client_marshal_info(void *object, struct pw_client_info *info)
|
|||
struct spa_pod_frame f;
|
||||
uint32_t i, n_items;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_EVENT_INFO);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_PROXY_EVENT_INFO);
|
||||
|
||||
n_items = info->props ? info->props->n_items : 0;
|
||||
|
||||
|
|
@ -771,7 +771,7 @@ static bool client_demarshal_info(void *object, void *data, size_t size)
|
|||
SPA_POD_TYPE_STRING, &props.items[i].value, 0))
|
||||
return false;
|
||||
}
|
||||
pw_proxy_notify(proxy, struct pw_client_events, info, &info);
|
||||
pw_proxy_notify(proxy, struct pw_client_proxy_events, info, &info);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -781,7 +781,7 @@ static void link_marshal_info(void *object, struct pw_link_info *info)
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_LINK_EVENT_INFO);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_LINK_PROXY_EVENT_INFO);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_LONG, info->change_mask,
|
||||
|
|
@ -810,7 +810,7 @@ static bool link_demarshal_info(void *object, void *data, size_t size)
|
|||
-SPA_POD_TYPE_OBJECT, &info.format, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_link_events, info, &info);
|
||||
pw_proxy_notify(proxy, struct pw_link_proxy_events, info, &info);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -829,7 +829,7 @@ static bool registry_demarshal_global(void *object, void *data, size_t size)
|
|||
SPA_POD_TYPE_INT, &version, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_registry_events, global, id, parent_id, permissions, type, version);
|
||||
pw_proxy_notify(proxy, struct pw_registry_proxy_events, global, id, parent_id, permissions, type, version);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -843,7 +843,7 @@ static bool registry_demarshal_global_remove(void *object, void *data, size_t si
|
|||
!spa_pod_iter_get(&it, SPA_POD_TYPE_INT, &id, 0))
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_registry_events, global_remove, id);
|
||||
pw_proxy_notify(proxy, struct pw_registry_proxy_events, global_remove, id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -854,7 +854,7 @@ static void registry_marshal_bind(void *object, uint32_t id,
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_REGISTRY_METHOD_BIND);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_REGISTRY_PROXY_METHOD_BIND);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, id,
|
||||
|
|
@ -865,8 +865,8 @@ static void registry_marshal_bind(void *object, uint32_t id,
|
|||
pw_protocol_native_end_proxy(proxy, b);
|
||||
}
|
||||
|
||||
static const struct pw_core_methods pw_protocol_native_core_method_marshal = {
|
||||
PW_VERSION_CORE_METHODS,
|
||||
static const struct pw_core_proxy_methods pw_protocol_native_core_method_marshal = {
|
||||
PW_VERSION_CORE_PROXY_METHODS,
|
||||
&core_marshal_update_types_client,
|
||||
&core_marshal_sync,
|
||||
&core_marshal_get_registry,
|
||||
|
|
@ -875,7 +875,7 @@ static const struct pw_core_methods pw_protocol_native_core_method_marshal = {
|
|||
&core_marshal_create_link
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_method_demarshal[PW_CORE_METHOD_NUM] = {
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_method_demarshal[PW_CORE_PROXY_METHOD_NUM] = {
|
||||
{ &core_demarshal_update_types_server, 0, },
|
||||
{ &core_demarshal_sync, 0, },
|
||||
{ &core_demarshal_get_registry, 0, },
|
||||
|
|
@ -884,8 +884,8 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_core_method_
|
|||
{ &core_demarshal_create_link, PW_PROTOCOL_NATIVE_REMAP, }
|
||||
};
|
||||
|
||||
static const struct pw_core_events pw_protocol_native_core_event_marshal = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
static const struct pw_core_proxy_events pw_protocol_native_core_event_marshal = {
|
||||
PW_VERSION_CORE_PROXY_EVENTS,
|
||||
&core_marshal_update_types_server,
|
||||
&core_marshal_done,
|
||||
&core_marshal_error,
|
||||
|
|
@ -893,7 +893,7 @@ static const struct pw_core_events pw_protocol_native_core_event_marshal = {
|
|||
&core_marshal_info
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_event_demarshal[PW_CORE_EVENT_NUM] = {
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_event_demarshal[PW_CORE_PROXY_EVENT_NUM] = {
|
||||
{ &core_demarshal_update_types_client, 0, },
|
||||
{ &core_demarshal_done, 0, },
|
||||
{ &core_demarshal_error, 0, },
|
||||
|
|
@ -904,16 +904,16 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_core_event_d
|
|||
static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
||||
PW_TYPE_INTERFACE__Core,
|
||||
PW_VERSION_CORE,
|
||||
PW_CORE_METHOD_NUM,
|
||||
PW_CORE_PROXY_METHOD_NUM,
|
||||
&pw_protocol_native_core_method_marshal,
|
||||
pw_protocol_native_core_method_demarshal,
|
||||
PW_CORE_EVENT_NUM,
|
||||
PW_CORE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_core_event_marshal,
|
||||
pw_protocol_native_core_event_demarshal
|
||||
};
|
||||
|
||||
static const struct pw_registry_methods pw_protocol_native_registry_method_marshal = {
|
||||
PW_VERSION_REGISTRY_METHODS,
|
||||
static const struct pw_registry_proxy_methods pw_protocol_native_registry_method_marshal = {
|
||||
PW_VERSION_REGISTRY_PROXY_METHODS,
|
||||
®istry_marshal_bind
|
||||
};
|
||||
|
||||
|
|
@ -921,8 +921,8 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_registry_met
|
|||
{ ®istry_demarshal_bind, PW_PROTOCOL_NATIVE_REMAP, }
|
||||
};
|
||||
|
||||
static const struct pw_registry_events pw_protocol_native_registry_event_marshal = {
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
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,
|
||||
};
|
||||
|
|
@ -935,16 +935,16 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_registry_eve
|
|||
const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
|
||||
PW_TYPE_INTERFACE__Registry,
|
||||
PW_VERSION_REGISTRY,
|
||||
PW_REGISTRY_METHOD_NUM,
|
||||
PW_REGISTRY_PROXY_METHOD_NUM,
|
||||
&pw_protocol_native_registry_method_marshal,
|
||||
pw_protocol_native_registry_method_demarshal,
|
||||
PW_REGISTRY_EVENT_NUM,
|
||||
PW_REGISTRY_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_registry_event_marshal,
|
||||
pw_protocol_native_registry_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_module_events pw_protocol_native_module_event_marshal = {
|
||||
PW_VERSION_MODULE_EVENTS,
|
||||
static const struct pw_module_proxy_events pw_protocol_native_module_event_marshal = {
|
||||
PW_VERSION_MODULE_PROXY_EVENTS,
|
||||
&module_marshal_info,
|
||||
};
|
||||
|
||||
|
|
@ -956,13 +956,13 @@ const struct pw_protocol_marshal pw_protocol_native_module_marshal = {
|
|||
PW_TYPE_INTERFACE__Module,
|
||||
PW_VERSION_MODULE,
|
||||
0, NULL, NULL,
|
||||
PW_MODULE_EVENT_NUM,
|
||||
PW_MODULE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_module_event_marshal,
|
||||
pw_protocol_native_module_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_node_events pw_protocol_native_node_event_marshal = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
static const struct pw_node_proxy_events pw_protocol_native_node_event_marshal = {
|
||||
PW_VERSION_NODE_PROXY_EVENTS,
|
||||
&node_marshal_info,
|
||||
};
|
||||
|
||||
|
|
@ -974,13 +974,13 @@ static const struct pw_protocol_marshal pw_protocol_native_node_marshal = {
|
|||
PW_TYPE_INTERFACE__Node,
|
||||
PW_VERSION_NODE,
|
||||
0, NULL, NULL,
|
||||
PW_NODE_EVENT_NUM,
|
||||
PW_NODE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_node_event_marshal,
|
||||
pw_protocol_native_node_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_client_events pw_protocol_native_client_event_marshal = {
|
||||
PW_VERSION_CLIENT_EVENTS,
|
||||
static const struct pw_client_proxy_events pw_protocol_native_client_event_marshal = {
|
||||
PW_VERSION_CLIENT_PROXY_EVENTS,
|
||||
&client_marshal_info,
|
||||
};
|
||||
|
||||
|
|
@ -992,13 +992,13 @@ static const struct pw_protocol_marshal pw_protocol_native_client_marshal = {
|
|||
PW_TYPE_INTERFACE__Client,
|
||||
PW_VERSION_CLIENT,
|
||||
0, NULL, NULL,
|
||||
PW_CLIENT_EVENT_NUM,
|
||||
PW_CLIENT_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_client_event_marshal,
|
||||
pw_protocol_native_client_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_link_events pw_protocol_native_link_event_marshal = {
|
||||
PW_VERSION_LINK_EVENTS,
|
||||
static const struct pw_link_proxy_events pw_protocol_native_link_event_marshal = {
|
||||
PW_VERSION_LINK_PROXY_EVENTS,
|
||||
&link_marshal_info,
|
||||
};
|
||||
|
||||
|
|
@ -1010,7 +1010,7 @@ static const struct pw_protocol_marshal pw_protocol_native_link_marshal = {
|
|||
PW_TYPE_INTERFACE__Link,
|
||||
PW_VERSION_LINK,
|
||||
0, NULL, NULL,
|
||||
PW_LINK_EVENT_NUM,
|
||||
PW_LINK_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_link_event_marshal,
|
||||
pw_protocol_native_link_event_demarshal,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ struct impl {
|
|||
struct pw_type *t;
|
||||
struct pw_properties *properties;
|
||||
|
||||
struct pw_callback_info core_callbacks;
|
||||
struct pw_listener core_listener;
|
||||
|
||||
struct spa_list node_list;
|
||||
};
|
||||
|
|
@ -40,7 +40,7 @@ struct node_info {
|
|||
struct spa_list link;
|
||||
struct impl *impl;
|
||||
struct pw_node *node;
|
||||
struct pw_callback_info node_callbacks;
|
||||
struct pw_listener node_listener;
|
||||
struct spa_source *idle_timeout;
|
||||
};
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ static void node_info_free(struct node_info *info)
|
|||
{
|
||||
spa_list_remove(&info->link);
|
||||
remove_idle_timeout(info);
|
||||
pw_callback_remove(&info->node_callbacks);
|
||||
pw_listener_remove(&info->node_listener);
|
||||
free(info);
|
||||
}
|
||||
|
||||
|
|
@ -107,8 +107,8 @@ node_state_changed(void *data, enum pw_node_state old, enum pw_node_state state,
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_node_callbacks node_callbacks = {
|
||||
PW_VERSION_NODE_CALLBACKS,
|
||||
static const struct pw_node_events node_events = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
.state_request = node_state_request,
|
||||
.state_changed = node_state_changed,
|
||||
};
|
||||
|
|
@ -127,7 +127,7 @@ core_global_added(void *data, struct pw_global *global)
|
|||
info->node = node;
|
||||
spa_list_insert(impl->node_list.prev, &info->link);
|
||||
|
||||
pw_node_add_callbacks(node, &info->node_callbacks, &node_callbacks, info);
|
||||
pw_node_add_listener(node, &info->node_listener, &node_events, info);
|
||||
|
||||
pw_log_debug("module %p: node %p added", impl, node);
|
||||
}
|
||||
|
|
@ -149,8 +149,8 @@ core_global_removed(void *data, struct pw_global *global)
|
|||
}
|
||||
}
|
||||
|
||||
const struct pw_core_callbacks core_callbacks = {
|
||||
PW_VERSION_CORE_CALLBACKS,
|
||||
const struct pw_core_events core_events = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
.global_added = core_global_added,
|
||||
.global_removed = core_global_removed,
|
||||
};
|
||||
|
|
@ -177,7 +177,7 @@ static bool module_init(struct pw_module *module, struct pw_properties *properti
|
|||
|
||||
spa_list_init(&impl->node_list);
|
||||
|
||||
pw_core_add_callbacks(impl->core, &impl->core_callbacks, &core_callbacks, impl);
|
||||
pw_core_add_listener(impl->core, &impl->core_listener, &core_events, impl);
|
||||
|
||||
return impl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,7 +276,6 @@ struct pw_spa_monitor *pw_spa_monitor_load(struct pw_core *core,
|
|||
impl->hnd = hnd;
|
||||
|
||||
this = &impl->this;
|
||||
pw_signal_init(&this->destroy_signal);
|
||||
this->monitor = iface;
|
||||
this->lib = filename;
|
||||
this->factory_name = strdup(factory_name);
|
||||
|
|
@ -321,7 +320,6 @@ void pw_spa_monitor_destroy(struct pw_spa_monitor *monitor)
|
|||
struct monitor_item *mitem, *tmp;
|
||||
|
||||
pw_log_debug("spa-monitor %p: dispose", impl);
|
||||
pw_signal_emit(&monitor->destroy_signal, monitor);
|
||||
|
||||
spa_list_for_each_safe(mitem, tmp, &impl->item_list, link)
|
||||
destroy_item(mitem);
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ struct pw_spa_monitor {
|
|||
char *factory_name;
|
||||
char *system_name;
|
||||
struct spa_handle *handle;
|
||||
|
||||
PW_SIGNAL(destroy_signal, (struct pw_listener *listener, struct pw_spa_monitor *monitor));
|
||||
};
|
||||
|
||||
struct pw_spa_monitor *
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ struct impl {
|
|||
char *lib;
|
||||
char *factory_name;
|
||||
|
||||
struct pw_callback_info node_callbacks;
|
||||
struct pw_listener node_listener;
|
||||
};
|
||||
|
||||
struct port {
|
||||
|
|
@ -337,7 +337,7 @@ static void on_node_done(struct spa_node *node, int seq, int res, void *user_dat
|
|||
}
|
||||
|
||||
pw_log_debug("spa-node %p: async complete event %d %d", this, seq, res);
|
||||
pw_callback_emit(&this->callback_list, struct pw_node_callbacks, async_complete, seq, res);
|
||||
pw_listener_list_emit(&this->listener_list, struct pw_node_events, async_complete, seq, res);
|
||||
}
|
||||
|
||||
static void on_node_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||
|
|
@ -345,21 +345,21 @@ static void on_node_event(struct spa_node *node, struct spa_event *event, void *
|
|||
struct impl *impl = user_data;
|
||||
struct pw_node *this = impl->this;
|
||||
|
||||
pw_callback_emit(&this->callback_list, struct pw_node_callbacks, event, event);
|
||||
pw_listener_list_emit(&this->listener_list, struct pw_node_events, event, event);
|
||||
}
|
||||
|
||||
static void on_node_need_input(struct spa_node *node, void *user_data)
|
||||
{
|
||||
struct impl *impl = user_data;
|
||||
struct pw_node *this = impl->this;
|
||||
pw_callback_emit_na(&this->callback_list, struct pw_node_callbacks, need_input);
|
||||
pw_listener_list_emit_na(&this->listener_list, struct pw_node_events, need_input);
|
||||
}
|
||||
|
||||
static void on_node_have_output(struct spa_node *node, void *user_data)
|
||||
{
|
||||
struct impl *impl = user_data;
|
||||
struct pw_node *this = impl->this;
|
||||
pw_callback_emit_na(&this->callback_list, struct pw_node_callbacks, have_output);
|
||||
pw_listener_list_emit_na(&this->listener_list, struct pw_node_events, have_output);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -390,8 +390,8 @@ static const struct spa_node_callbacks spa_node_callbacks = {
|
|||
.reuse_buffer = on_node_reuse_buffer,
|
||||
};
|
||||
|
||||
static const struct pw_node_callbacks node_callbacks = {
|
||||
PW_VERSION_NODE_CALLBACKS,
|
||||
static const struct pw_node_events node_events = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
.destroy = pw_spa_node_destroy,
|
||||
};
|
||||
|
||||
|
|
@ -434,7 +434,7 @@ pw_spa_node_new(struct pw_core *core,
|
|||
impl->node = node;
|
||||
impl->async_init = async;
|
||||
|
||||
pw_node_add_callbacks(this, &impl->node_callbacks, &node_callbacks, impl);
|
||||
pw_node_add_listener(this, &impl->node_listener, &node_events, impl);
|
||||
|
||||
pw_node_set_implementation(this, &node_impl, impl);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ struct impl {
|
|||
};
|
||||
|
||||
struct resource_data {
|
||||
struct pw_callback_info resource_callbacks;
|
||||
struct pw_listener resource_listener;
|
||||
};
|
||||
|
||||
/** \endcond */
|
||||
|
|
@ -43,8 +43,8 @@ static void client_unbind_func(void *data)
|
|||
spa_list_remove(&resource->link);
|
||||
}
|
||||
|
||||
static const struct pw_resource_callbacks resource_callbacks = {
|
||||
PW_VERSION_RESOURCE_CALLBACKS,
|
||||
static const struct pw_resource_events resource_events = {
|
||||
PW_VERSION_RESOURCE_EVENTS,
|
||||
.destroy = client_unbind_func,
|
||||
};
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ client_bind_func(struct pw_global *global,
|
|||
goto no_mem;
|
||||
|
||||
data = pw_resource_get_user_data(resource);
|
||||
pw_resource_add_callbacks(resource, &data->resource_callbacks, &resource_callbacks, resource);
|
||||
pw_resource_add_listener(resource, &data->resource_listener, &resource_events, resource);
|
||||
|
||||
pw_log_debug("client %p: bound to %d", this, resource->id);
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ struct pw_client *pw_client_new(struct pw_core *core,
|
|||
this->user_data = SPA_MEMBER(impl, sizeof(struct impl), void);
|
||||
|
||||
spa_list_init(&this->resource_list);
|
||||
pw_callback_init(&this->callback_list);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
|
||||
pw_map_init(&this->objects, 0, 32);
|
||||
pw_map_init(&this->types, 0, 32);
|
||||
|
|
@ -152,7 +152,7 @@ void pw_client_destroy(struct pw_client *client)
|
|||
struct impl *impl = SPA_CONTAINER_OF(client, struct impl, this);
|
||||
|
||||
pw_log_debug("client %p: destroy", client);
|
||||
pw_callback_emit_na(&client->callback_list, struct pw_client_callbacks, destroy);
|
||||
pw_listener_list_emit_na(&client->listener_list, struct pw_client_events, destroy);
|
||||
|
||||
spa_list_remove(&client->link);
|
||||
pw_global_destroy(client->global);
|
||||
|
|
@ -162,7 +162,7 @@ void pw_client_destroy(struct pw_client *client)
|
|||
|
||||
pw_map_for_each(&client->objects, destroy_resource, client);
|
||||
|
||||
pw_callback_emit_na(&client->callback_list, struct pw_client_callbacks, free);
|
||||
pw_listener_list_emit_na(&client->listener_list, struct pw_client_events, free);
|
||||
pw_log_debug("client %p: free", impl);
|
||||
|
||||
pw_map_clear(&client->objects);
|
||||
|
|
@ -174,12 +174,12 @@ void pw_client_destroy(struct pw_client *client)
|
|||
free(impl);
|
||||
}
|
||||
|
||||
void pw_client_add_callbacks(struct pw_client *client,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_client_callbacks *callbacks,
|
||||
void pw_client_add_listener(struct pw_client *client,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_client_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&client->callback_list, info, callbacks, data);
|
||||
pw_listener_list_add(&client->listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
const struct pw_client_info *pw_client_get_info(struct pw_client *client)
|
||||
|
|
@ -216,7 +216,7 @@ void pw_client_update_properties(struct pw_client *client, const struct spa_dict
|
|||
client->info.change_mask |= 1 << 0;
|
||||
client->info.props = client->properties ? &client->properties->dict : NULL;
|
||||
|
||||
pw_callback_emit(&client->callback_list, struct pw_client_callbacks, info_changed, &client->info);
|
||||
pw_listener_list_emit(&client->listener_list, struct pw_client_events, info_changed, &client->info);
|
||||
|
||||
spa_list_for_each(resource, &client->resource_list, link)
|
||||
pw_client_resource_info(resource, &client->info);
|
||||
|
|
@ -228,6 +228,6 @@ void pw_client_set_busy(struct pw_client *client, bool busy)
|
|||
{
|
||||
if (client->busy != busy) {
|
||||
client->busy = busy;
|
||||
pw_callback_emit(&client->callback_list, struct pw_client_callbacks, busy_changed, busy);
|
||||
pw_listener_list_emit(&client->listener_list, struct pw_client_events, busy_changed, busy);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ struct pw_client;
|
|||
#include <pipewire/core.h>
|
||||
#include <pipewire/introspect.h>
|
||||
#include <pipewire/properties.h>
|
||||
#include <pipewire/sig.h>
|
||||
#include <pipewire/callback.h>
|
||||
#include <pipewire/listener.h>
|
||||
#include <pipewire/resource.h>
|
||||
|
||||
#define PW_TYPE__Client PW_TYPE_OBJECT_BASE "Client"
|
||||
|
|
@ -82,8 +81,8 @@ struct pw_client;
|
|||
* See also \ref page_resource
|
||||
*/
|
||||
|
||||
struct pw_client_callbacks {
|
||||
#define PW_VERSION_CLIENT_CALLBACKS 0
|
||||
struct pw_client_events {
|
||||
#define PW_VERSION_CLIENT_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
void (*destroy) (void *data);
|
||||
|
|
@ -112,9 +111,9 @@ void pw_client_destroy(struct pw_client *client);
|
|||
|
||||
void *pw_client_get_user_data(struct pw_client *client);
|
||||
|
||||
void pw_client_add_callbacks(struct pw_client *client,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_client_callbacks *callbacks,
|
||||
void pw_client_add_listener(struct pw_client *client,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_client_events *events,
|
||||
void *data);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <spa/format-utils.h>
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
#include <pipewire/callback.h>
|
||||
#include <pipewire/listener.h>
|
||||
#include <pipewire/private.h>
|
||||
#include <pipewire/interfaces.h>
|
||||
#include <pipewire/protocol.h>
|
||||
|
|
@ -37,7 +37,7 @@ struct global_impl {
|
|||
};
|
||||
|
||||
struct resource_data {
|
||||
struct pw_callback_info resource_callbacks;
|
||||
struct pw_listener resource_listener;
|
||||
};
|
||||
|
||||
/** \endcond */
|
||||
|
|
@ -107,8 +107,8 @@ static void registry_bind(void *object, uint32_t id,
|
|||
return;
|
||||
}
|
||||
|
||||
static const struct pw_registry_methods registry_methods = {
|
||||
PW_VERSION_REGISTRY_METHODS,
|
||||
static const struct pw_registry_proxy_methods registry_methods = {
|
||||
PW_VERSION_REGISTRY_PROXY_METHODS,
|
||||
.bind = registry_bind
|
||||
};
|
||||
|
||||
|
|
@ -118,8 +118,8 @@ static void destroy_registry_resource(void *object)
|
|||
spa_list_remove(&resource->link);
|
||||
}
|
||||
|
||||
static const struct pw_resource_callbacks resource_callbacks = {
|
||||
PW_VERSION_RESOURCE_CALLBACKS,
|
||||
static const struct pw_resource_events resource_events = {
|
||||
PW_VERSION_RESOURCE_EVENTS,
|
||||
.destroy = destroy_registry_resource
|
||||
};
|
||||
|
||||
|
|
@ -155,9 +155,9 @@ static void core_get_registry(void *object, uint32_t version, uint32_t new_id)
|
|||
goto no_mem;
|
||||
|
||||
data = pw_resource_get_user_data(registry_resource);
|
||||
pw_resource_add_callbacks(registry_resource,
|
||||
&data->resource_callbacks,
|
||||
&resource_callbacks,
|
||||
pw_resource_add_listener(registry_resource,
|
||||
&data->resource_listener,
|
||||
&resource_events,
|
||||
registry_resource);
|
||||
|
||||
pw_resource_set_implementation(registry_resource,
|
||||
|
|
@ -274,14 +274,14 @@ static void core_update_types(void *object, uint32_t first_id, uint32_t n_types,
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_core_methods core_methods = {
|
||||
PW_VERSION_CORE_METHODS,
|
||||
&core_update_types,
|
||||
&core_sync,
|
||||
&core_get_registry,
|
||||
&core_client_update,
|
||||
&core_create_node,
|
||||
&core_create_link
|
||||
static const struct pw_core_proxy_methods core_methods = {
|
||||
PW_VERSION_CORE_PROXY_METHODS,
|
||||
.update_types = core_update_types,
|
||||
.sync = core_sync,
|
||||
.get_registry = core_get_registry,
|
||||
.client_update = core_client_update,
|
||||
.create_node = core_create_node,
|
||||
.create_link = core_create_link
|
||||
};
|
||||
|
||||
static void core_unbind_func(void *data)
|
||||
|
|
@ -291,8 +291,8 @@ static void core_unbind_func(void *data)
|
|||
spa_list_remove(&resource->link);
|
||||
}
|
||||
|
||||
static const struct pw_resource_callbacks core_resource_callbacks = {
|
||||
PW_VERSION_RESOURCE_CALLBACKS,
|
||||
static const struct pw_resource_events core_resource_events = {
|
||||
PW_VERSION_RESOURCE_EVENTS,
|
||||
.destroy = core_unbind_func,
|
||||
};
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ core_bind_func(struct pw_global *global,
|
|||
goto no_mem;
|
||||
|
||||
data = pw_resource_get_user_data(resource);
|
||||
pw_resource_add_callbacks(resource, &data->resource_callbacks, &core_resource_callbacks, resource);
|
||||
pw_resource_add_listener(resource, &data->resource_listener, &core_resource_events, resource);
|
||||
|
||||
pw_resource_set_implementation(resource, &core_methods, resource);
|
||||
|
||||
|
|
@ -381,7 +381,7 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop, struct pw_properties *pro
|
|||
spa_list_init(&this->node_list);
|
||||
spa_list_init(&this->node_factory_list);
|
||||
spa_list_init(&this->link_list);
|
||||
pw_callback_init(&this->callback_list);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
|
||||
this->info.change_mask = 0;
|
||||
this->info.user_name = pw_get_user_name();
|
||||
|
|
@ -420,7 +420,7 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop, struct pw_properties *pro
|
|||
void pw_core_destroy(struct pw_core *core)
|
||||
{
|
||||
pw_log_debug("core %p: destroy", core);
|
||||
pw_callback_emit(&core->callback_list, struct pw_core_callbacks, destroy, core);
|
||||
pw_listener_list_emit(&core->listener_list, struct pw_core_events, destroy, core);
|
||||
|
||||
pw_data_loop_destroy(core->data_loop_impl);
|
||||
|
||||
|
|
@ -482,7 +482,7 @@ pw_core_add_global(struct pw_core *core,
|
|||
|
||||
spa_list_insert(core->global_list.prev, &this->link);
|
||||
|
||||
pw_callback_emit(&core->callback_list, struct pw_core_callbacks, global_added, this);
|
||||
pw_listener_list_emit(&core->listener_list, struct pw_core_events, global_added, this);
|
||||
|
||||
pw_log_debug("global %p: new %u %s, owner %p", this, this->id,
|
||||
spa_type_map_get_type(core->type.map, this->type), owner);
|
||||
|
|
@ -581,18 +581,18 @@ void pw_global_destroy(struct pw_global *global)
|
|||
pw_map_remove(&core->globals, global->id);
|
||||
|
||||
spa_list_remove(&global->link);
|
||||
pw_callback_emit(&core->callback_list, struct pw_core_callbacks, global_removed, global);
|
||||
pw_listener_list_emit(&core->listener_list, struct pw_core_events, global_removed, global);
|
||||
|
||||
pw_log_debug("global %p: free", global);
|
||||
free(global);
|
||||
}
|
||||
|
||||
void pw_core_add_callbacks(struct pw_core *core,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_core_callbacks *callbacks,
|
||||
void pw_core_add_listener(struct pw_core *core,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_core_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&core->callback_list, info, callbacks, data);
|
||||
pw_listener_list_add(&core->listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
struct pw_type *pw_core_get_type(struct pw_core *core)
|
||||
|
|
@ -643,7 +643,7 @@ void pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict
|
|||
core->info.change_mask = PW_CORE_CHANGE_MASK_PROPS;
|
||||
core->info.props = core->properties ? &core->properties->dict : NULL;
|
||||
|
||||
pw_callback_emit(&core->callback_list, struct pw_core_callbacks, info_changed, &core->info);
|
||||
pw_listener_list_emit(&core->listener_list, struct pw_core_events, info_changed, &core->info);
|
||||
|
||||
spa_list_for_each(resource, &core->resource_list, link) {
|
||||
pw_core_resource_info(resource, &core->info);
|
||||
|
|
|
|||
|
|
@ -41,11 +41,10 @@ struct pw_global;
|
|||
struct pw_core;
|
||||
|
||||
#include <pipewire/type.h>
|
||||
#include <pipewire/callback.h>
|
||||
#include <pipewire/listener.h>
|
||||
#include <pipewire/loop.h>
|
||||
#include <pipewire/client.h>
|
||||
#include <pipewire/port.h>
|
||||
#include <pipewire/sig.h>
|
||||
#include <pipewire/node.h>
|
||||
#include <pipewire/node-factory.h>
|
||||
|
||||
|
|
@ -140,8 +139,8 @@ typedef uint32_t (*pw_permission_func_t) (struct pw_global *global,
|
|||
*/
|
||||
struct pw_global;
|
||||
|
||||
struct pw_core_callbacks {
|
||||
#define PW_VERSION_CORE_CALLBACKS 0
|
||||
struct pw_core_events {
|
||||
#define PW_VERSION_CORE_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
void (*destroy) (void *data, struct pw_core *core);
|
||||
|
|
@ -158,9 +157,9 @@ pw_core_new(struct pw_loop *main_loop, struct pw_properties *props);
|
|||
|
||||
void pw_core_destroy(struct pw_core *core);
|
||||
|
||||
void pw_core_add_callbacks(struct pw_core *core,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_core_callbacks *callbacks,
|
||||
void pw_core_add_listener(struct pw_core *core,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_core_events *events,
|
||||
void *data);
|
||||
|
||||
struct pw_type *pw_core_get_type(struct pw_core *core);
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ struct pw_data_loop *pw_data_loop_new(void)
|
|||
if (this->loop == NULL)
|
||||
goto no_loop;
|
||||
|
||||
pw_callback_init(&this->callback_list);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
|
||||
this->event = pw_loop_add_event(this->loop, do_stop, this);
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ void pw_data_loop_destroy(struct pw_data_loop *loop)
|
|||
{
|
||||
pw_log_debug("data-loop %p: destroy", loop);
|
||||
|
||||
pw_callback_emit_na(&loop->callback_list, struct pw_data_loop_callbacks, destroy);
|
||||
pw_listener_list_emit_na(&loop->listener_list, struct pw_data_loop_events, destroy);
|
||||
|
||||
pw_data_loop_stop(loop);
|
||||
|
||||
|
|
@ -143,12 +143,12 @@ void pw_data_loop_destroy(struct pw_data_loop *loop)
|
|||
free(loop);
|
||||
}
|
||||
|
||||
void pw_data_loop_add_callbacks(struct pw_data_loop *loop,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_data_loop_callbacks *callbacks,
|
||||
void pw_data_loop_add_listener(struct pw_data_loop *loop,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_data_loop_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&loop->callback_list, info, callbacks, data);
|
||||
pw_listener_list_add(&loop->listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
struct pw_loop *
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ extern "C" {
|
|||
struct pw_data_loop;
|
||||
|
||||
#include <pipewire/loop.h>
|
||||
#include <pipewire/callback.h>
|
||||
#include <pipewire/listener.h>
|
||||
|
||||
struct pw_data_loop_callbacks {
|
||||
#define PW_VERSION_DATA_LOOP_CALLBACKS 0
|
||||
struct pw_data_loop_events {
|
||||
#define PW_VERSION_DATA_LOOP_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
void (*destroy) (void *data);
|
||||
|
|
@ -43,9 +43,9 @@ struct pw_data_loop_callbacks {
|
|||
struct pw_data_loop *
|
||||
pw_data_loop_new(void);
|
||||
|
||||
void pw_data_loop_add_callbacks(struct pw_data_loop *loop,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_data_loop_callbacks *callbacks,
|
||||
void pw_data_loop_add_listener(struct pw_data_loop *loop,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_data_loop_events *events,
|
||||
void *data);
|
||||
|
||||
struct pw_loop *
|
||||
|
|
|
|||
|
|
@ -70,24 +70,24 @@ struct pw_link_proxy;
|
|||
|
||||
#define PW_VERSION_CORE 0
|
||||
|
||||
#define PW_CORE_METHOD_UPDATE_TYPES 0
|
||||
#define PW_CORE_METHOD_SYNC 1
|
||||
#define PW_CORE_METHOD_GET_REGISTRY 2
|
||||
#define PW_CORE_METHOD_CLIENT_UPDATE 3
|
||||
#define PW_CORE_METHOD_CREATE_NODE 4
|
||||
#define PW_CORE_METHOD_CREATE_LINK 5
|
||||
#define PW_CORE_METHOD_NUM 6
|
||||
#define PW_CORE_PROXY_METHOD_UPDATE_TYPES 0
|
||||
#define PW_CORE_PROXY_METHOD_SYNC 1
|
||||
#define PW_CORE_PROXY_METHOD_GET_REGISTRY 2
|
||||
#define PW_CORE_PROXY_METHOD_CLIENT_UPDATE 3
|
||||
#define PW_CORE_PROXY_METHOD_CREATE_NODE 4
|
||||
#define PW_CORE_PROXY_METHOD_CREATE_LINK 5
|
||||
#define PW_CORE_PROXY_METHOD_NUM 6
|
||||
|
||||
/**
|
||||
* \struct pw_core_methods
|
||||
* \struct pw_core_proxy_methods
|
||||
* \brief Core methods
|
||||
*
|
||||
* The core global object. This is a singleton object used for
|
||||
* creating new objects in the PipeWire server. It is also used
|
||||
* for internal features.
|
||||
*/
|
||||
struct pw_core_methods {
|
||||
#define PW_VERSION_CORE_METHODS 0
|
||||
struct pw_core_proxy_methods {
|
||||
#define PW_VERSION_CORE_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Update the type map
|
||||
|
|
@ -169,27 +169,27 @@ struct pw_core_methods {
|
|||
static inline void
|
||||
pw_core_proxy_update_types(struct pw_core_proxy *core, uint32_t first_id, uint32_t n_types, const char **types)
|
||||
{
|
||||
pw_proxy_do((struct pw_proxy*)core, struct pw_core_methods, update_types, first_id, n_types, types);
|
||||
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, update_types, first_id, n_types, types);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pw_core_proxy_sync(struct pw_core_proxy *core, uint32_t seq)
|
||||
{
|
||||
pw_proxy_do((struct pw_proxy*)core, struct pw_core_methods, sync, seq);
|
||||
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, sync, seq);
|
||||
}
|
||||
|
||||
static inline struct pw_registry_proxy *
|
||||
pw_core_proxy_get_registry(struct pw_core_proxy *core, uint32_t type, uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *p = pw_proxy_new((struct pw_proxy*)core, type, user_data_size);
|
||||
pw_proxy_do((struct pw_proxy*)core, struct pw_core_methods, get_registry, version, pw_proxy_get_id(p));
|
||||
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, get_registry, version, pw_proxy_get_id(p));
|
||||
return (struct pw_registry_proxy *) p;
|
||||
}
|
||||
|
||||
static inline void
|
||||
pw_core_proxy_client_update(struct pw_core_proxy *core, const struct spa_dict *props)
|
||||
{
|
||||
pw_proxy_do((struct pw_proxy*)core, struct pw_core_methods, client_update, props);
|
||||
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, client_update, props);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
|
|
@ -202,7 +202,7 @@ pw_core_proxy_create_node(struct pw_core_proxy *core,
|
|||
size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *p = pw_proxy_new((struct pw_proxy*)core, type, user_data_size);
|
||||
pw_proxy_do((struct pw_proxy*)core, struct pw_core_methods, create_node, factory_name,
|
||||
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, create_node, factory_name,
|
||||
name, type, version, props, pw_proxy_get_id(p));
|
||||
return p;
|
||||
}
|
||||
|
|
@ -219,25 +219,25 @@ pw_core_proxy_create_link(struct pw_core_proxy *core,
|
|||
size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *p = pw_proxy_new((struct pw_proxy*)core, type, user_data_size);
|
||||
pw_proxy_do((struct pw_proxy*)core, struct pw_core_methods, create_link, output_node_id, output_port_id,
|
||||
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, create_link, output_node_id, output_port_id,
|
||||
input_node_id, input_port_id, filter, prop, pw_proxy_get_id(p));
|
||||
return (struct pw_link_proxy*) p;
|
||||
}
|
||||
|
||||
|
||||
#define PW_CORE_EVENT_UPDATE_TYPES 0
|
||||
#define PW_CORE_EVENT_DONE 1
|
||||
#define PW_CORE_EVENT_ERROR 2
|
||||
#define PW_CORE_EVENT_REMOVE_ID 3
|
||||
#define PW_CORE_EVENT_INFO 4
|
||||
#define PW_CORE_EVENT_NUM 5
|
||||
#define PW_CORE_PROXY_EVENT_UPDATE_TYPES 0
|
||||
#define PW_CORE_PROXY_EVENT_DONE 1
|
||||
#define PW_CORE_PROXY_EVENT_ERROR 2
|
||||
#define PW_CORE_PROXY_EVENT_REMOVE_ID 3
|
||||
#define PW_CORE_PROXY_EVENT_INFO 4
|
||||
#define PW_CORE_PROXY_EVENT_NUM 5
|
||||
|
||||
/** \struct pw_core_events
|
||||
/** \struct pw_core_proxy_events
|
||||
* \brief Core events
|
||||
* \ingroup pw_core_interface The pw_core interface
|
||||
*/
|
||||
struct pw_core_events {
|
||||
#define PW_VERSION_CORE_EVENTS 0
|
||||
struct pw_core_proxy_events {
|
||||
#define PW_VERSION_CORE_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Update the type map
|
||||
|
|
@ -294,30 +294,29 @@ struct pw_core_events {
|
|||
|
||||
static inline void
|
||||
pw_core_proxy_add_listener(struct pw_core_proxy *core,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_core_events *events,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_core_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_proxy_add_listener((struct pw_proxy*)core, info, events, data);
|
||||
pw_proxy_add_proxy_listener((struct pw_proxy*)core, listener, events, data);
|
||||
}
|
||||
|
||||
|
||||
#define pw_core_resource_update_types(r,...) pw_resource_notify(r,struct pw_core_events,update_types,__VA_ARGS__)
|
||||
#define pw_core_resource_done(r,...) pw_resource_notify(r,struct pw_core_events,done,__VA_ARGS__)
|
||||
#define pw_core_resource_error(r,...) pw_resource_notify(r,struct pw_core_events,error,__VA_ARGS__)
|
||||
#define pw_core_resource_remove_id(r,...) pw_resource_notify(r,struct pw_core_events,remove_id,__VA_ARGS__)
|
||||
#define pw_core_resource_info(r,...) pw_resource_notify(r,struct pw_core_events,info,__VA_ARGS__)
|
||||
|
||||
#define pw_core_resource_update_types(r,...) pw_resource_notify(r,struct pw_core_proxy_events,update_types,__VA_ARGS__)
|
||||
#define pw_core_resource_done(r,...) pw_resource_notify(r,struct pw_core_proxy_events,done,__VA_ARGS__)
|
||||
#define pw_core_resource_error(r,...) pw_resource_notify(r,struct pw_core_proxy_events,error,__VA_ARGS__)
|
||||
#define pw_core_resource_remove_id(r,...) pw_resource_notify(r,struct pw_core_proxy_events,remove_id,__VA_ARGS__)
|
||||
#define pw_core_resource_info(r,...) pw_resource_notify(r,struct pw_core_proxy_events,info,__VA_ARGS__)
|
||||
|
||||
|
||||
#define PW_VERSION_REGISTRY 0
|
||||
|
||||
#define PW_REGISTRY_METHOD_BIND 0
|
||||
#define PW_REGISTRY_METHOD_NUM 1
|
||||
#define PW_REGISTRY_PROXY_METHOD_BIND 0
|
||||
#define PW_REGISTRY_PROXY_METHOD_NUM 1
|
||||
|
||||
/** Registry methods */
|
||||
struct pw_registry_methods {
|
||||
#define PW_VERSION_REGISTRY_METHODS 0
|
||||
struct pw_registry_proxy_methods {
|
||||
#define PW_VERSION_REGISTRY_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Bind to a global object
|
||||
|
|
@ -342,17 +341,17 @@ pw_registry_proxy_bind(struct pw_registry_proxy *registry,
|
|||
{
|
||||
struct pw_proxy *reg = (struct pw_proxy*)registry;
|
||||
struct pw_proxy *p = pw_proxy_new(reg, type, user_data_size);
|
||||
pw_proxy_do(reg, struct pw_registry_methods, bind, id, type, version, pw_proxy_get_id(p));
|
||||
pw_proxy_do(reg, struct pw_registry_proxy_methods, bind, id, type, version, pw_proxy_get_id(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
#define PW_REGISTRY_EVENT_GLOBAL 0
|
||||
#define PW_REGISTRY_EVENT_GLOBAL_REMOVE 1
|
||||
#define PW_REGISTRY_EVENT_NUM 2
|
||||
#define PW_REGISTRY_PROXY_EVENT_GLOBAL 0
|
||||
#define PW_REGISTRY_PROXY_EVENT_GLOBAL_REMOVE 1
|
||||
#define PW_REGISTRY_PROXY_EVENT_NUM 2
|
||||
|
||||
/** Registry events */
|
||||
struct pw_registry_events {
|
||||
#define PW_VERSION_REGISTRY_EVENTS 0
|
||||
struct pw_registry_proxy_events {
|
||||
#define PW_VERSION_REGISTRY_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify of a new global object
|
||||
|
|
@ -382,25 +381,25 @@ struct pw_registry_events {
|
|||
|
||||
static inline void
|
||||
pw_registry_proxy_add_listener(struct pw_registry_proxy *registry,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_registry_events *events,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_registry_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_proxy_add_listener((struct pw_proxy*)registry, info, events, data);
|
||||
pw_proxy_add_proxy_listener((struct pw_proxy*)registry, listener, events, data);
|
||||
}
|
||||
|
||||
#define pw_registry_resource_global(r,...) pw_resource_notify(r,struct pw_registry_events,global,__VA_ARGS__)
|
||||
#define pw_registry_resource_global_remove(r,...) pw_resource_notify(r,struct pw_registry_events,global_remove,__VA_ARGS__)
|
||||
#define pw_registry_resource_global(r,...) pw_resource_notify(r,struct pw_registry_proxy_events,global,__VA_ARGS__)
|
||||
#define pw_registry_resource_global_remove(r,...) pw_resource_notify(r,struct pw_registry_proxy_events,global_remove,__VA_ARGS__)
|
||||
|
||||
|
||||
#define PW_VERSION_MODULE 0
|
||||
|
||||
#define PW_MODULE_EVENT_INFO 0
|
||||
#define PW_MODULE_EVENT_NUM 1
|
||||
#define PW_MODULE_PROXY_EVENT_INFO 0
|
||||
#define PW_MODULE_PROXY_EVENT_NUM 1
|
||||
|
||||
/** Module events */
|
||||
struct pw_module_events {
|
||||
#define PW_VERSION_MODULE_EVENTS 0
|
||||
struct pw_module_proxy_events {
|
||||
#define PW_VERSION_MODULE_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify module info
|
||||
|
|
@ -412,23 +411,23 @@ struct pw_module_events {
|
|||
|
||||
static inline void
|
||||
pw_module_proxy_add_listener(struct pw_module_proxy *module,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_module_events *events,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_module_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_proxy_add_listener((struct pw_proxy*)module, info, events, data);
|
||||
pw_proxy_add_proxy_listener((struct pw_proxy*)module, listener, events, data);
|
||||
}
|
||||
|
||||
#define pw_module_resource_info(r,...) pw_resource_notify(r,struct pw_module_events,info,__VA_ARGS__)
|
||||
#define pw_module_resource_info(r,...) pw_resource_notify(r,struct pw_module_proxy_events,info,__VA_ARGS__)
|
||||
|
||||
#define PW_VERSION_NODE 0
|
||||
|
||||
#define PW_NODE_EVENT_INFO 0
|
||||
#define PW_NODE_EVENT_NUM 1
|
||||
#define PW_NODE_PROXY_EVENT_INFO 0
|
||||
#define PW_NODE_PROXY_EVENT_NUM 1
|
||||
|
||||
/** Node events */
|
||||
struct pw_node_events {
|
||||
#define PW_VERSION_NODE_EVENTS 0
|
||||
struct pw_node_proxy_events {
|
||||
#define PW_VERSION_NODE_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify node info
|
||||
|
|
@ -440,23 +439,23 @@ struct pw_node_events {
|
|||
|
||||
static inline void
|
||||
pw_node_proxy_add_listener(struct pw_node_proxy *node,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_node_events *events,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_node_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_proxy_add_listener((struct pw_proxy*)node, info, events, data);
|
||||
pw_proxy_add_proxy_listener((struct pw_proxy*)node, listener, events, data);
|
||||
}
|
||||
|
||||
#define pw_node_resource_info(r,...) pw_resource_notify(r,struct pw_node_events,info,__VA_ARGS__)
|
||||
#define pw_node_resource_info(r,...) pw_resource_notify(r,struct pw_node_proxy_events,info,__VA_ARGS__)
|
||||
|
||||
#define PW_VERSION_CLIENT 0
|
||||
|
||||
#define PW_CLIENT_EVENT_INFO 0
|
||||
#define PW_CLIENT_EVENT_NUM 1
|
||||
#define PW_CLIENT_PROXY_EVENT_INFO 0
|
||||
#define PW_CLIENT_PROXY_EVENT_NUM 1
|
||||
|
||||
/** Client events */
|
||||
struct pw_client_events {
|
||||
#define PW_VERSION_CLIENT_EVENTS 0
|
||||
struct pw_client_proxy_events {
|
||||
#define PW_VERSION_CLIENT_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify client info
|
||||
|
|
@ -469,24 +468,24 @@ struct pw_client_events {
|
|||
/** Client */
|
||||
static inline void
|
||||
pw_client_proxy_add_listener(struct pw_client_proxy *client,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_client_events *events,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_client_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_proxy_add_listener((struct pw_proxy*)client, info, events, data);
|
||||
pw_proxy_add_proxy_listener((struct pw_proxy*)client, listener, events, data);
|
||||
}
|
||||
|
||||
#define pw_client_resource_info(r,...) pw_resource_notify(r,struct pw_client_events,info,__VA_ARGS__)
|
||||
#define pw_client_resource_info(r,...) pw_resource_notify(r,struct pw_client_proxy_events,info,__VA_ARGS__)
|
||||
|
||||
|
||||
#define PW_VERSION_LINK 0
|
||||
|
||||
#define PW_LINK_EVENT_INFO 0
|
||||
#define PW_LINK_EVENT_NUM 1
|
||||
#define PW_LINK_PROXY_EVENT_INFO 0
|
||||
#define PW_LINK_PROXY_EVENT_NUM 1
|
||||
|
||||
/** Link events */
|
||||
struct pw_link_events {
|
||||
#define PW_VERSION_LINK_EVENTS 0
|
||||
struct pw_link_proxy_events {
|
||||
#define PW_VERSION_LINK_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify link info
|
||||
|
|
@ -499,14 +498,14 @@ struct pw_link_events {
|
|||
/** Link */
|
||||
static inline void
|
||||
pw_link_proxy_add_listener(struct pw_link_proxy *link,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_link_events *events,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_link_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_proxy_add_listener((struct pw_proxy*)link, info, events, data);
|
||||
pw_proxy_add_proxy_listener((struct pw_proxy*)link, listener, events, data);
|
||||
}
|
||||
|
||||
#define pw_link_resource_info(r,...) pw_resource_notify(r,struct pw_link_events,info,__VA_ARGS__)
|
||||
#define pw_link_resource_info(r,...) pw_resource_notify(r,struct pw_link_proxy_events,info,__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#include <spa/lib/format.h>
|
||||
#include <spa/lib/props.h>
|
||||
|
||||
#include "callback.h"
|
||||
#include "pipewire.h"
|
||||
#include "private.h"
|
||||
#include "interfaces.h"
|
||||
|
|
@ -47,10 +46,10 @@ struct impl {
|
|||
struct spa_format *format_filter;
|
||||
struct pw_properties *properties;
|
||||
|
||||
struct pw_callback_info input_port_callbacks;
|
||||
struct pw_callback_info input_node_callbacks;
|
||||
struct pw_callback_info output_port_callbacks;
|
||||
struct pw_callback_info output_node_callbacks;
|
||||
struct pw_listener input_port_listener;
|
||||
struct pw_listener input_node_listener;
|
||||
struct pw_listener output_port_listener;
|
||||
struct pw_listener output_node_listener;
|
||||
|
||||
void *buffer_owner;
|
||||
struct pw_memblock buffer_mem;
|
||||
|
|
@ -59,7 +58,7 @@ struct impl {
|
|||
};
|
||||
|
||||
struct resource_data {
|
||||
struct pw_callback_info resource_callbacks;
|
||||
struct pw_listener resource_listener;
|
||||
};
|
||||
|
||||
/** \endcond */
|
||||
|
|
@ -77,7 +76,7 @@ static void pw_link_update_state(struct pw_link *link, enum pw_link_state state,
|
|||
free(link->error);
|
||||
link->error = error;
|
||||
|
||||
pw_callback_emit(&link->callback_list, struct pw_link_callbacks, state_changed, old, state, error);
|
||||
pw_listener_list_emit(&link->listener_list, struct pw_link_events, state_changed, old, state, error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -777,8 +776,8 @@ static void input_remove(struct pw_link *this, struct pw_port *port)
|
|||
struct impl *impl = (struct impl *) this;
|
||||
|
||||
pw_log_debug("link %p: remove input port %p", this, port);
|
||||
pw_callback_remove(&impl->input_port_callbacks);
|
||||
pw_callback_remove(&impl->input_node_callbacks);
|
||||
pw_listener_remove(&impl->input_port_listener);
|
||||
pw_listener_remove(&impl->input_node_listener);
|
||||
|
||||
pw_loop_invoke(port->node->data_loop,
|
||||
do_remove_input, 1, 0, NULL, true, this);
|
||||
|
|
@ -800,8 +799,8 @@ static void output_remove(struct pw_link *this, struct pw_port *port)
|
|||
struct impl *impl = (struct impl *) this;
|
||||
|
||||
pw_log_debug("link %p: remove output port %p", this, port);
|
||||
pw_callback_remove(&impl->output_port_callbacks);
|
||||
pw_callback_remove(&impl->output_node_callbacks);
|
||||
pw_listener_remove(&impl->output_port_listener);
|
||||
pw_listener_remove(&impl->output_node_listener);
|
||||
|
||||
pw_loop_invoke(port->node->data_loop,
|
||||
do_remove_output, 1, 0, NULL, true, this);
|
||||
|
|
@ -832,7 +831,7 @@ static void on_port_destroy(struct pw_link *this, struct pw_port *port)
|
|||
impl->buffer_owner = NULL;
|
||||
}
|
||||
|
||||
pw_callback_emit(&this->callback_list, struct pw_link_callbacks, port_unlinked, port);
|
||||
pw_listener_list_emit(&this->listener_list, struct pw_link_events, port_unlinked, port);
|
||||
|
||||
pw_link_update_state(this, PW_LINK_STATE_UNLINKED, NULL);
|
||||
pw_link_destroy(this);
|
||||
|
|
@ -942,8 +941,8 @@ static void link_unbind_func(void *data)
|
|||
spa_list_remove(&resource->link);
|
||||
}
|
||||
|
||||
static const struct pw_resource_callbacks resource_callbacks = {
|
||||
PW_VERSION_RESOURCE_CALLBACKS,
|
||||
static const struct pw_resource_events resource_events = {
|
||||
PW_VERSION_RESOURCE_EVENTS,
|
||||
.destroy = link_unbind_func,
|
||||
};
|
||||
|
||||
|
|
@ -961,7 +960,7 @@ link_bind_func(struct pw_global *global,
|
|||
goto no_mem;
|
||||
|
||||
data = pw_resource_get_user_data(resource);
|
||||
pw_resource_add_callbacks(resource, &data->resource_callbacks, &resource_callbacks, resource);
|
||||
pw_resource_add_listener(resource, &data->resource_listener, &resource_events, resource);
|
||||
|
||||
pw_log_debug("link %p: bound to %d", this, resource->id);
|
||||
|
||||
|
|
@ -996,23 +995,23 @@ do_add_link(struct spa_loop *loop,
|
|||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static const struct pw_port_callbacks input_port_callbacks = {
|
||||
PW_VERSION_PORT_CALLBACKS,
|
||||
static const struct pw_port_events input_port_events = {
|
||||
PW_VERSION_PORT_EVENTS,
|
||||
.destroy = input_port_destroy,
|
||||
};
|
||||
|
||||
static const struct pw_port_callbacks output_port_callbacks = {
|
||||
PW_VERSION_PORT_CALLBACKS,
|
||||
static const struct pw_port_events output_port_events = {
|
||||
PW_VERSION_PORT_EVENTS,
|
||||
.destroy = output_port_destroy,
|
||||
};
|
||||
|
||||
static const struct pw_node_callbacks input_node_callbacks = {
|
||||
PW_VERSION_NODE_CALLBACKS,
|
||||
static const struct pw_node_events input_node_events = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
.async_complete = input_node_async_complete,
|
||||
};
|
||||
|
||||
static const struct pw_node_callbacks output_node_callbacks = {
|
||||
PW_VERSION_NODE_CALLBACKS,
|
||||
static const struct pw_node_events output_node_events = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
.async_complete = output_node_async_complete,
|
||||
};
|
||||
|
||||
|
|
@ -1054,14 +1053,14 @@ struct pw_link *pw_link_new(struct pw_core *core,
|
|||
output_node = output->node;
|
||||
|
||||
spa_list_init(&this->resource_list);
|
||||
pw_callback_init(&this->callback_list);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
|
||||
impl->format_filter = format_filter;
|
||||
|
||||
pw_port_add_callbacks(input, &impl->input_port_callbacks, &input_port_callbacks, impl);
|
||||
pw_node_add_callbacks(input_node, &impl->input_node_callbacks, &input_node_callbacks, impl);
|
||||
pw_port_add_callbacks(output, &impl->output_port_callbacks, &output_port_callbacks, impl);
|
||||
pw_node_add_callbacks(output_node, &impl->output_node_callbacks, &output_node_callbacks, impl);
|
||||
pw_port_add_listener(input, &impl->input_port_listener, &input_port_events, impl);
|
||||
pw_node_add_listener(input_node, &impl->input_node_listener, &input_node_events, impl);
|
||||
pw_port_add_listener(output, &impl->output_port_listener, &output_port_events, impl);
|
||||
pw_node_add_listener(output_node, &impl->output_node_listener, &output_node_events, impl);
|
||||
|
||||
pw_log_debug("link %p: constructed %p:%d -> %p:%d", impl,
|
||||
output_node, output->port_id, input_node, input->port_id);
|
||||
|
|
@ -1124,7 +1123,7 @@ void pw_link_destroy(struct pw_link *link)
|
|||
struct pw_resource *resource, *tmp;
|
||||
|
||||
pw_log_debug("link %p: destroy", impl);
|
||||
pw_callback_emit_na(&link->callback_list, struct pw_link_callbacks, destroy);
|
||||
pw_listener_list_emit_na(&link->listener_list, struct pw_link_events, destroy);
|
||||
|
||||
pw_link_deactivate(link);
|
||||
|
||||
|
|
@ -1153,12 +1152,12 @@ void pw_link_destroy(struct pw_link *link)
|
|||
free(impl);
|
||||
}
|
||||
|
||||
void pw_link_add_callbacks(struct pw_link *link,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_link_callbacks *callbacks,
|
||||
void pw_link_add_listener(struct pw_link *link,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_link_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&link->callback_list, info, callbacks, data);
|
||||
pw_listener_list_add(&link->listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
struct pw_link *pw_link_find(struct pw_port *output_port, struct pw_port *input_port)
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ struct pw_link;
|
|||
* the nodes.
|
||||
*/
|
||||
|
||||
struct pw_link_callbacks {
|
||||
#define PW_VERSION_LINK_CALLBACKS 0
|
||||
struct pw_link_events {
|
||||
#define PW_VERSION_LINK_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
void (*destroy) (void *data);
|
||||
|
|
@ -82,9 +82,9 @@ pw_link_new(struct pw_core *core, /**< the core object */
|
|||
/** Destroy a link \memberof pw_link */
|
||||
void pw_link_destroy(struct pw_link *link);
|
||||
|
||||
void pw_link_add_callbacks(struct pw_link *link,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_link_callbacks *callbacks,
|
||||
void pw_link_add_listener(struct pw_link *link,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_link_events *events,
|
||||
void *data);
|
||||
|
||||
/** Find the link between 2 ports \memberof pw_link */
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __PIPEWIRE_CALLBACK_H__
|
||||
#define __PIPEWIRE_CALLBACK_H__
|
||||
#ifndef __PIPEWIRE_LISTENER_H__
|
||||
#define __PIPEWIRE_LISTENER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -26,52 +26,52 @@ extern "C" {
|
|||
|
||||
#include <spa/list.h>
|
||||
|
||||
struct pw_callback_list {
|
||||
struct pw_listener_list {
|
||||
struct spa_list list;
|
||||
};
|
||||
|
||||
struct pw_callback_info {
|
||||
struct pw_listener {
|
||||
struct spa_list link;
|
||||
const void *callbacks;
|
||||
const void *events;
|
||||
void *data;
|
||||
};
|
||||
|
||||
static inline void pw_callback_init(struct pw_callback_list *list)
|
||||
static inline void pw_listener_list_init(struct pw_listener_list *list)
|
||||
{
|
||||
spa_list_init(&list->list);
|
||||
}
|
||||
|
||||
/** Add a callback \memberof pw_callback */
|
||||
static inline void pw_callback_add(struct pw_callback_list *list,
|
||||
struct pw_callback_info *info,
|
||||
const void *callbacks, void *data)
|
||||
/** Add a listener \memberof pw_listener */
|
||||
static inline void pw_listener_list_add(struct pw_listener_list *list,
|
||||
struct pw_listener *listener,
|
||||
const void *events, void *data)
|
||||
{
|
||||
info->callbacks = callbacks;
|
||||
info->data = data;
|
||||
spa_list_insert(list->list.prev, &info->link);
|
||||
listener->events = events;
|
||||
listener->data = data;
|
||||
spa_list_insert(list->list.prev, &listener->link);
|
||||
}
|
||||
|
||||
/** Remove a signal listener \memberof pw_callback */
|
||||
static inline void pw_callback_remove(struct pw_callback_info *info)
|
||||
/** Remove a listener \memberof pw_listener */
|
||||
static inline void pw_listener_remove(struct pw_listener *listener)
|
||||
{
|
||||
spa_list_remove(&info->link);
|
||||
spa_list_remove(&listener->link);
|
||||
}
|
||||
|
||||
#define pw_callback_emit(l,type,method,...) ({ \
|
||||
struct pw_callback_list *list = l; \
|
||||
struct pw_callback_info *ci, *t; \
|
||||
#define pw_listener_list_emit(l,type,method,...) ({ \
|
||||
struct pw_listener_list *list = l; \
|
||||
struct pw_listener *ci, *t; \
|
||||
spa_list_for_each_safe(ci, t, &list->list, link) { \
|
||||
const type *cb = ci->callbacks; \
|
||||
const type *cb = ci->events; \
|
||||
if (cb->method) \
|
||||
cb->method(ci->data, __VA_ARGS__); \
|
||||
} \
|
||||
});
|
||||
|
||||
#define pw_callback_emit_na(l,type,method) ({ \
|
||||
struct pw_callback_list *list = l; \
|
||||
struct pw_callback_info *ci, *t; \
|
||||
#define pw_listener_list_emit_na(l,type,method) ({ \
|
||||
struct pw_listener_list *list = l; \
|
||||
struct pw_listener *ci, *t; \
|
||||
spa_list_for_each_safe(ci, t, &list->list, link) { \
|
||||
const type *cb = ci->callbacks; \
|
||||
const type *cb = ci->events; \
|
||||
if (cb->method) \
|
||||
cb->method(ci->data); \
|
||||
} \
|
||||
|
|
@ -81,4 +81,4 @@ static inline void pw_callback_remove(struct pw_callback_info *info)
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PIPEWIRE_CALLBACK_H__ */
|
||||
#endif /* __PIPEWIRE_LISTENER_H__ */
|
||||
|
|
@ -26,7 +26,6 @@ extern "C" {
|
|||
|
||||
#include <spa/loop.h>
|
||||
|
||||
#include <pipewire/sig.h>
|
||||
|
||||
/** \class pw_loop
|
||||
*
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ struct pw_main_loop *pw_main_loop_new(void)
|
|||
if (this->loop == NULL)
|
||||
goto no_loop;
|
||||
|
||||
pw_callback_init(&this->callback_list);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
|
||||
return this;
|
||||
|
||||
|
|
@ -57,19 +57,19 @@ struct pw_main_loop *pw_main_loop_new(void)
|
|||
void pw_main_loop_destroy(struct pw_main_loop *loop)
|
||||
{
|
||||
pw_log_debug("main-loop %p: destroy", loop);
|
||||
pw_callback_emit_na(&loop->callback_list, struct pw_main_loop_callbacks, destroy);
|
||||
pw_listener_list_emit_na(&loop->listener_list, struct pw_main_loop_events, destroy);
|
||||
|
||||
pw_loop_destroy(loop->loop);
|
||||
|
||||
free(loop);
|
||||
}
|
||||
|
||||
void pw_main_loop_add_callbacks(struct pw_main_loop *loop,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_main_loop_callbacks *callbacks,
|
||||
void pw_main_loop_add_listener(struct pw_main_loop *loop,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_main_loop_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&loop->callback_list, info, callbacks, data);
|
||||
pw_listener_list_add(&loop->listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
struct pw_loop * pw_main_loop_get_loop(struct pw_main_loop *loop)
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ extern "C" {
|
|||
struct pw_main_loop;
|
||||
|
||||
#include <pipewire/loop.h>
|
||||
#include <pipewire/callback.h>
|
||||
#include <pipewire/listener.h>
|
||||
|
||||
struct pw_main_loop_callbacks {
|
||||
#define PW_VERSION_MAIN_LOOP_CALLBACKS 0
|
||||
struct pw_main_loop_events {
|
||||
#define PW_VERSION_MAIN_LOOP_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
void (*destroy) (void *data);
|
||||
|
|
@ -46,9 +46,9 @@ struct pw_main_loop_callbacks {
|
|||
struct pw_main_loop *
|
||||
pw_main_loop_new(void);
|
||||
|
||||
void pw_main_loop_add_callbacks(struct pw_main_loop *loop,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_main_loop_callbacks *callbacks,
|
||||
void pw_main_loop_add_listener(struct pw_main_loop *loop,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_main_loop_events *events,
|
||||
void *data);
|
||||
|
||||
struct pw_loop *
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ pipewire_headers = [
|
|||
'interfaces.h',
|
||||
'introspect.h',
|
||||
'link.h',
|
||||
'listener.h',
|
||||
'log.h',
|
||||
'loop.h',
|
||||
'main-loop.h',
|
||||
|
|
@ -23,7 +24,6 @@ pipewire_headers = [
|
|||
'remote.h',
|
||||
'resource.h',
|
||||
'rtkit.h',
|
||||
'sig.h',
|
||||
'stream.h',
|
||||
'thread-loop.h',
|
||||
'transport.h',
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ struct impl {
|
|||
};
|
||||
|
||||
struct resource_data {
|
||||
struct pw_callback_info resource_callbacks;
|
||||
struct pw_listener resource_listener;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -100,8 +100,8 @@ static void module_unbind_func(void *data)
|
|||
spa_list_remove(&resource->link);
|
||||
}
|
||||
|
||||
static const struct pw_resource_callbacks resource_callbacks = {
|
||||
PW_VERSION_RESOURCE_CALLBACKS,
|
||||
static const struct pw_resource_events resource_events = {
|
||||
PW_VERSION_RESOURCE_EVENTS,
|
||||
.destroy = module_unbind_func,
|
||||
};
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ module_bind_func(struct pw_global *global,
|
|||
goto no_mem;
|
||||
|
||||
data = pw_resource_get_user_data(resource);
|
||||
pw_resource_add_callbacks(resource, &data->resource_callbacks, &resource_callbacks, resource);
|
||||
pw_resource_add_listener(resource, &data->resource_listener, &resource_events, resource);
|
||||
|
||||
pw_log_debug("module %p: bound to %d", this, resource->id);
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ struct pw_module *pw_module_load(struct pw_core *core, const char *name, const c
|
|||
this->core = core;
|
||||
|
||||
spa_list_init(&this->resource_list);
|
||||
pw_callback_init(&this->callback_list);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
|
||||
this->info.name = name ? strdup(name) : NULL;
|
||||
this->info.filename = filename;
|
||||
|
|
@ -257,7 +257,7 @@ void pw_module_destroy(struct pw_module *module)
|
|||
struct impl *impl = SPA_CONTAINER_OF(module, struct impl, this);
|
||||
struct pw_resource *resource, *tmp;
|
||||
|
||||
pw_callback_emit(&module->callback_list, struct pw_module_callbacks, destroy, module);
|
||||
pw_listener_list_emit_na(&module->listener_list, struct pw_module_events, destroy);
|
||||
|
||||
spa_list_for_each_safe(resource, tmp, &module->resource_list, link)
|
||||
pw_resource_destroy(resource);
|
||||
|
|
@ -292,10 +292,10 @@ pw_module_get_info(struct pw_module *module)
|
|||
return &module->info;
|
||||
}
|
||||
|
||||
void pw_module_add_callbacks(struct pw_module *module,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_module_callbacks *callbacks,
|
||||
void pw_module_add_listener(struct pw_module *module,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_module_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&module->callback_list, info, callbacks, data);
|
||||
pw_listener_list_add(&module->listener_list, listener, events, data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,11 +51,11 @@ struct pw_module;
|
|||
*/
|
||||
typedef bool (*pw_module_init_func_t) (struct pw_module *module, char *args);
|
||||
|
||||
struct pw_module_callbacks {
|
||||
#define PW_VERSION_MODULE_CALLBACKS 0
|
||||
struct pw_module_events {
|
||||
#define PW_VERSION_MODULE_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
void (*destroy) (void *data, struct pw_module *module);
|
||||
void (*destroy) (void *data);
|
||||
};
|
||||
|
||||
struct pw_module *
|
||||
|
|
@ -68,9 +68,9 @@ struct pw_global * pw_module_get_global(struct pw_module *module);
|
|||
const struct pw_module_info *
|
||||
pw_module_get_info(struct pw_module *module);
|
||||
|
||||
void pw_module_add_callbacks(struct pw_module *module,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_module_callbacks *callbacks,
|
||||
void pw_module_add_listener(struct pw_module *module,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_module_events *events,
|
||||
void *data);
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -39,13 +39,13 @@ struct impl {
|
|||
|
||||
struct pw_work_queue *work;
|
||||
|
||||
struct pw_callback_info node_callbacks;
|
||||
struct pw_listener node_listener;
|
||||
|
||||
bool registered;
|
||||
};
|
||||
|
||||
struct resource_data {
|
||||
struct pw_callback_info resource_callbacks;
|
||||
struct pw_listener resource_listener;
|
||||
};
|
||||
|
||||
/** \endcond */
|
||||
|
|
@ -247,8 +247,8 @@ clear_info(struct pw_node *this)
|
|||
|
||||
}
|
||||
|
||||
static const struct pw_resource_callbacks resource_callbacks = {
|
||||
PW_VERSION_RESOURCE_CALLBACKS,
|
||||
static const struct pw_resource_events resource_events = {
|
||||
PW_VERSION_RESOURCE_EVENTS,
|
||||
.destroy = node_unbind_func,
|
||||
};
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ node_bind_func(struct pw_global *global,
|
|||
goto no_mem;
|
||||
|
||||
data = pw_resource_get_user_data(resource);
|
||||
pw_resource_add_callbacks(resource, &data->resource_callbacks, &resource_callbacks, resource);
|
||||
pw_resource_add_listener(resource, &data->resource_listener, &resource_events, resource);
|
||||
|
||||
pw_log_debug("node %p: bound to %d", this, resource->id);
|
||||
|
||||
|
|
@ -315,7 +315,7 @@ void pw_node_register(struct pw_node *this)
|
|||
node_bind_func, this);
|
||||
|
||||
impl->registered = true;
|
||||
pw_callback_emit_na(&this->callback_list, struct pw_node_callbacks, initialized);
|
||||
pw_listener_list_emit_na(&this->listener_list, struct pw_node_events, initialized);
|
||||
|
||||
pw_node_update_state(this, PW_NODE_STATE_SUSPENDED, NULL);
|
||||
}
|
||||
|
|
@ -346,12 +346,12 @@ graph_impl_process_output(struct spa_graph_node *node, void *user_data)
|
|||
|
||||
static const struct spa_graph_node_methods graph_methods = {
|
||||
SPA_VERSION_GRAPH_NODE_METHODS,
|
||||
graph_impl_process_input,
|
||||
graph_impl_process_output,
|
||||
.process_input = graph_impl_process_input,
|
||||
.process_output = graph_impl_process_output,
|
||||
};
|
||||
|
||||
static const struct pw_node_callbacks node_callbacks = {
|
||||
PW_VERSION_NODE_CALLBACKS,
|
||||
static const struct pw_node_events node_events = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
.async_complete = node_async_complete,
|
||||
.event = node_event,
|
||||
.need_input = node_need_input,
|
||||
|
|
@ -397,9 +397,9 @@ struct pw_node *pw_node_new(struct pw_core *core,
|
|||
|
||||
spa_list_init(&this->resource_list);
|
||||
|
||||
pw_callback_init(&this->callback_list);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
|
||||
pw_node_add_callbacks(this, &impl->node_callbacks, &node_callbacks, impl);
|
||||
pw_node_add_listener(this, &impl->node_listener, &node_events, impl);
|
||||
|
||||
this->info.state = PW_NODE_STATE_CREATING;
|
||||
|
||||
|
|
@ -438,12 +438,12 @@ void pw_node_set_implementation(struct pw_node *node,
|
|||
node->implementation_data = data;
|
||||
}
|
||||
|
||||
void pw_node_add_callbacks(struct pw_node *node,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_node_callbacks *callbacks,
|
||||
void pw_node_add_listener(struct pw_node *node,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_node_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&node->callback_list, info, callbacks, data);
|
||||
pw_listener_list_add(&node->listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -474,7 +474,7 @@ void pw_node_destroy(struct pw_node *node)
|
|||
struct pw_port *port, *tmpp;
|
||||
|
||||
pw_log_debug("node %p: destroy", impl);
|
||||
pw_callback_emit_na(&node->callback_list, struct pw_node_callbacks, destroy);
|
||||
pw_listener_list_emit_na(&node->listener_list, struct pw_node_events, destroy);
|
||||
|
||||
pw_loop_invoke(node->data_loop, do_node_remove, 1, 0, NULL, true, node);
|
||||
|
||||
|
|
@ -489,17 +489,17 @@ void pw_node_destroy(struct pw_node *node)
|
|||
|
||||
pw_log_debug("node %p: destroy ports", node);
|
||||
spa_list_for_each_safe(port, tmpp, &node->input_ports, link) {
|
||||
pw_callback_emit(&node->callback_list, struct pw_node_callbacks, port_removed, port);
|
||||
pw_listener_list_emit(&node->listener_list, struct pw_node_events, port_removed, port);
|
||||
pw_port_destroy(port);
|
||||
}
|
||||
|
||||
spa_list_for_each_safe(port, tmpp, &node->output_ports, link) {
|
||||
pw_callback_emit(&node->callback_list, struct pw_node_callbacks, port_removed, port);
|
||||
pw_listener_list_emit(&node->listener_list, struct pw_node_events, port_removed, port);
|
||||
pw_port_destroy(port);
|
||||
}
|
||||
|
||||
pw_log_debug("node %p: free", node);
|
||||
pw_callback_emit_na(&node->callback_list, struct pw_node_callbacks, free);
|
||||
pw_listener_list_emit_na(&node->listener_list, struct pw_node_events, free);
|
||||
|
||||
pw_work_queue_destroy(impl->work);
|
||||
|
||||
|
|
@ -652,7 +652,7 @@ int pw_node_set_state(struct pw_node *node, enum pw_node_state state)
|
|||
int res = SPA_RESULT_OK;
|
||||
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
||||
|
||||
pw_callback_emit(&node->callback_list, struct pw_node_callbacks, state_request, state);
|
||||
pw_listener_list_emit(&node->listener_list, struct pw_node_events, state_request, state);
|
||||
|
||||
pw_log_debug("node %p: set state %s", node, pw_node_state_as_string(state));
|
||||
|
||||
|
|
@ -715,11 +715,11 @@ void pw_node_update_state(struct pw_node *node, enum pw_node_state state, char *
|
|||
if (state == PW_NODE_STATE_IDLE)
|
||||
node_deactivate(node);
|
||||
|
||||
pw_callback_emit(&node->callback_list, struct pw_node_callbacks, state_changed,
|
||||
pw_listener_list_emit(&node->listener_list, struct pw_node_events, state_changed,
|
||||
old, state, error);
|
||||
|
||||
node->info.change_mask |= 1 << 5;
|
||||
pw_callback_emit(&node->callback_list, struct pw_node_callbacks, info_changed, &node->info);
|
||||
pw_listener_list_emit(&node->listener_list, struct pw_node_events, info_changed, &node->info);
|
||||
|
||||
spa_list_for_each(resource, &node->resource_list, link)
|
||||
pw_node_resource_info(resource, &node->info);
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ struct pw_node_implementation {
|
|||
};
|
||||
|
||||
|
||||
struct pw_node_callbacks {
|
||||
#define PW_VERSION_NODE_CALLBACKS 0
|
||||
struct pw_node_events {
|
||||
#define PW_VERSION_NODE_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
/** the node is destroyed */
|
||||
|
|
@ -135,9 +135,9 @@ void pw_node_set_implementation(struct pw_node *node,
|
|||
const struct pw_node_implementation *implementation,
|
||||
void *data);
|
||||
|
||||
void pw_node_add_callbacks(struct pw_node *node,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_node_callbacks *callbacks,
|
||||
void pw_node_add_listener(struct pw_node *node,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_node_events *events,
|
||||
void *data);
|
||||
|
||||
/** Find the port with direction and port_id or NULL when not found */
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ extern "C" {
|
|||
#include <pipewire/proxy.h>
|
||||
#include <pipewire/remote.h>
|
||||
#include <pipewire/resource.h>
|
||||
#include <pipewire/sig.h>
|
||||
#include <pipewire/listener.h>
|
||||
#include <pipewire/stream.h>
|
||||
#include <pipewire/thread-loop.h>
|
||||
#include <pipewire/type.h>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ static void port_update_state(struct pw_port *port, enum pw_port_state state)
|
|||
if (port->state != state) {
|
||||
pw_log_debug("port %p: state %d -> %d", port, port->state, state);
|
||||
port->state = state;
|
||||
pw_callback_emit(&port->callback_list, struct pw_port_callbacks, state_changed, state);
|
||||
pw_listener_list_emit(&port->listener_list, struct pw_port_events, state_changed, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ struct pw_port *pw_port_new(enum pw_direction direction,
|
|||
|
||||
spa_list_init(&this->links);
|
||||
|
||||
pw_callback_init(&this->callback_list);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
|
||||
spa_graph_port_init(&this->rt.port,
|
||||
this->direction,
|
||||
|
|
@ -194,12 +194,12 @@ void pw_port_set_implementation(struct pw_port *port,
|
|||
port->implementation_data = data;
|
||||
}
|
||||
|
||||
void pw_port_add_callbacks(struct pw_port *port,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_port_callbacks *callbacks,
|
||||
void pw_port_add_listener(struct pw_port *port,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_port_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&port->callback_list, info, callbacks, data);
|
||||
pw_listener_list_add(&port->listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
void * pw_port_get_user_data(struct pw_port *port)
|
||||
|
|
@ -246,7 +246,7 @@ void pw_port_add(struct pw_port *port, struct pw_node *node)
|
|||
|
||||
port_update_state(port, PW_PORT_STATE_CONFIGURE);
|
||||
|
||||
pw_callback_emit(&node->callback_list, struct pw_node_callbacks, port_added, port);
|
||||
pw_listener_list_emit(&node->listener_list, struct pw_node_events, port_added, port);
|
||||
}
|
||||
|
||||
static int do_remove_port(struct spa_loop *loop,
|
||||
|
|
@ -273,7 +273,7 @@ void pw_port_destroy(struct pw_port *port)
|
|||
|
||||
pw_log_debug("port %p: destroy", port);
|
||||
|
||||
pw_callback_emit_na(&port->callback_list, struct pw_port_callbacks, destroy);
|
||||
pw_listener_list_emit_na(&port->listener_list, struct pw_port_events, destroy);
|
||||
|
||||
if (node) {
|
||||
pw_loop_invoke(port->node->data_loop, do_remove_port, SPA_ID_INVALID, 0, NULL, true, port);
|
||||
|
|
@ -287,7 +287,7 @@ void pw_port_destroy(struct pw_port *port)
|
|||
node->info.n_output_ports--;
|
||||
}
|
||||
spa_list_remove(&port->link);
|
||||
pw_callback_emit(&node->callback_list, struct pw_node_callbacks, port_removed, port);
|
||||
pw_listener_list_emit(&node->listener_list, struct pw_node_events, port_removed, port);
|
||||
}
|
||||
free(port);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ struct pw_port_implementation {
|
|||
int (*send_command) (void *data, struct spa_command *command);
|
||||
};
|
||||
|
||||
struct pw_port_callbacks {
|
||||
#define PW_VERSION_PORT_CALLBACKS 0
|
||||
struct pw_port_events {
|
||||
#define PW_VERSION_PORT_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
void (*destroy) (void *data);
|
||||
|
|
@ -112,9 +112,9 @@ void pw_port_set_implementation(struct pw_port *port,
|
|||
const struct pw_port_implementation *implementation,
|
||||
void *data);
|
||||
|
||||
void pw_port_add_callbacks(struct pw_port *port,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_port_callbacks *callbacks,
|
||||
void pw_port_add_listener(struct pw_port *port,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_port_events *events,
|
||||
void *data);
|
||||
|
||||
/** Destroy a port \memberof pw_port */
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ struct pw_client {
|
|||
|
||||
bool busy;
|
||||
|
||||
struct pw_callback_list callback_list;
|
||||
struct pw_listener_list listener_list;
|
||||
|
||||
struct pw_protocol *protocol; /**< protocol in use */
|
||||
struct spa_list protocol_link; /**< link in the protocol client_list */
|
||||
|
|
@ -104,7 +104,7 @@ struct pw_core {
|
|||
struct spa_list node_list; /**< list of nodes */
|
||||
struct spa_list node_factory_list; /**< list of node factories */
|
||||
struct spa_list link_list; /**< list of links */
|
||||
struct pw_callback_list callback_list;
|
||||
struct pw_listener_list listener_list;
|
||||
|
||||
struct pw_loop *main_loop; /**< main loop for control */
|
||||
struct pw_loop *data_loop; /**< data loop for data passing */
|
||||
|
|
@ -122,7 +122,7 @@ struct pw_core {
|
|||
struct pw_data_loop {
|
||||
struct pw_loop *loop;
|
||||
|
||||
struct pw_callback_list callback_list;
|
||||
struct pw_listener_list listener_list;
|
||||
|
||||
struct spa_source *event;
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ struct pw_data_loop {
|
|||
struct pw_main_loop {
|
||||
struct pw_loop *loop;
|
||||
|
||||
struct pw_callback_list callback_list;
|
||||
struct pw_listener_list listener_list;
|
||||
|
||||
bool running;
|
||||
};
|
||||
|
|
@ -158,7 +158,7 @@ struct pw_link {
|
|||
struct pw_port *input; /**< input port */
|
||||
struct spa_list input_link; /**< link in input port links */
|
||||
|
||||
struct pw_callback_list callback_list;
|
||||
struct pw_listener_list listener_list;
|
||||
|
||||
struct {
|
||||
struct spa_graph_port out_port;
|
||||
|
|
@ -175,7 +175,7 @@ struct pw_module {
|
|||
|
||||
struct spa_list resource_list; /**< list of resources for this module */
|
||||
|
||||
struct pw_callback_list callback_list;
|
||||
struct pw_listener_list listener_list;
|
||||
|
||||
void *user_data; /**< module user_data */
|
||||
};
|
||||
|
|
@ -209,7 +209,7 @@ struct pw_node {
|
|||
uint32_t n_used_output_links; /**< number of active output links */
|
||||
uint32_t idle_used_output_links; /**< number of active output to be idle */
|
||||
|
||||
struct pw_callback_list callback_list;
|
||||
struct pw_listener_list listener_list;
|
||||
|
||||
struct pw_loop *data_loop; /**< the data loop for this node */
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ struct pw_port {
|
|||
|
||||
struct spa_list links; /**< list of \ref pw_link */
|
||||
|
||||
struct pw_callback_list callback_list;
|
||||
struct pw_listener_list listener_list;
|
||||
|
||||
void *mix; /**< optional port buffer mix/split */
|
||||
|
||||
|
|
@ -272,7 +272,7 @@ struct pw_resource {
|
|||
const void *implementation;
|
||||
void *implementation_data;
|
||||
|
||||
struct pw_callback_list callback_list;
|
||||
struct pw_listener_list listener_list;
|
||||
|
||||
const struct pw_protocol_marshal *marshal;
|
||||
|
||||
|
|
@ -287,8 +287,8 @@ struct pw_proxy {
|
|||
|
||||
uint32_t id; /**< client side id */
|
||||
|
||||
struct pw_callback_list callback_list;
|
||||
struct pw_callback_list listener_list;
|
||||
struct pw_listener_list listener_list;
|
||||
struct pw_listener_list proxy_listener_list;
|
||||
|
||||
const struct pw_protocol_marshal *marshal; /**< protocol specific marshal functions */
|
||||
|
||||
|
|
@ -317,7 +317,7 @@ struct pw_remote {
|
|||
enum pw_remote_state state;
|
||||
char *error;
|
||||
|
||||
struct pw_callback_list callback_list;
|
||||
struct pw_listener_list listener_list;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -333,7 +333,7 @@ struct pw_stream {
|
|||
enum pw_stream_state state; /**< stream state */
|
||||
char *error; /**< error reason when state is in error */
|
||||
|
||||
struct pw_callback_list callback_list;
|
||||
struct pw_listener_list listener_list;
|
||||
};
|
||||
|
||||
struct pw_node_factory {
|
||||
|
|
|
|||
|
|
@ -44,8 +44,6 @@ struct pw_protocol *pw_protocol_new(struct pw_core *core,
|
|||
spa_list_init(&protocol->connection_list);
|
||||
spa_list_init(&protocol->listener_list);
|
||||
|
||||
pw_signal_init(&protocol->destroy_signal);
|
||||
|
||||
if (user_data_size > 0)
|
||||
protocol->user_data = SPA_MEMBER(protocol, sizeof(struct impl), void);
|
||||
|
||||
|
|
@ -69,7 +67,6 @@ void pw_protocol_destroy(struct pw_protocol *protocol)
|
|||
struct pw_protocol_connection *connection, *t3;
|
||||
|
||||
pw_log_info("protocol %p: destroy", protocol);
|
||||
pw_signal_emit(&protocol->destroy_signal, protocol);
|
||||
|
||||
spa_list_remove(&protocol->link);
|
||||
|
||||
|
|
|
|||
|
|
@ -97,9 +97,6 @@ struct pw_protocol {
|
|||
|
||||
const struct pw_protocol_implementaton *implementation; /**< implementation of the protocol */
|
||||
|
||||
/** Emited when the protocol is destroyed */
|
||||
PW_SIGNAL(destroy_signal, (struct pw_listener *listener, struct pw_protocol *protocol));
|
||||
|
||||
const void *extension; /**< extension API */
|
||||
|
||||
void *user_data; /**< user data for the implementation */
|
||||
|
|
|
|||
|
|
@ -43,13 +43,13 @@ struct proxy {
|
|||
*
|
||||
* \memberof pw_proxy
|
||||
*/
|
||||
struct pw_proxy *pw_proxy_new(struct pw_proxy *proxy,
|
||||
struct pw_proxy *pw_proxy_new(struct pw_proxy *factory,
|
||||
uint32_t type,
|
||||
size_t user_data_size)
|
||||
{
|
||||
struct proxy *impl;
|
||||
struct pw_proxy *this;
|
||||
struct pw_remote *remote = proxy->remote;
|
||||
struct pw_remote *remote = factory->remote;
|
||||
|
||||
impl = calloc(1, sizeof(struct proxy) + user_data_size);
|
||||
if (impl == NULL)
|
||||
|
|
@ -58,8 +58,8 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *proxy,
|
|||
this = &impl->this;
|
||||
this->remote = remote;
|
||||
|
||||
pw_callback_init(&this->callback_list);
|
||||
pw_callback_init(&this->listener_list);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
pw_listener_list_init(&this->proxy_listener_list);
|
||||
|
||||
this->id = pw_map_insert_new(&remote->objects, this);
|
||||
|
||||
|
|
@ -85,20 +85,20 @@ uint32_t pw_proxy_get_id(struct pw_proxy *proxy)
|
|||
return proxy->id;
|
||||
}
|
||||
|
||||
void pw_proxy_add_callbacks(struct pw_proxy *proxy,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_proxy_callbacks *callbacks,
|
||||
void pw_proxy_add_listener(struct pw_proxy *proxy,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&proxy->callback_list, info, callbacks, data);
|
||||
pw_listener_list_add(&proxy->listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
void pw_proxy_add_listener(struct pw_proxy *proxy,
|
||||
struct pw_callback_info *info,
|
||||
const void *callbacks,
|
||||
void pw_proxy_add_proxy_listener(struct pw_proxy *proxy,
|
||||
struct pw_listener *listener,
|
||||
const void *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&proxy->listener_list, info, callbacks, data);
|
||||
pw_listener_list_add(&proxy->proxy_listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
/** Destroy a proxy object
|
||||
|
|
@ -114,7 +114,7 @@ void pw_proxy_destroy(struct pw_proxy *proxy)
|
|||
struct proxy *impl = SPA_CONTAINER_OF(proxy, struct proxy, this);
|
||||
|
||||
pw_log_debug("proxy %p: destroy %u", proxy, proxy->id);
|
||||
pw_callback_emit_na(&proxy->callback_list, struct pw_proxy_callbacks, destroy);
|
||||
pw_listener_list_emit_na(&proxy->listener_list, struct pw_proxy_events, destroy);
|
||||
|
||||
pw_map_remove(&proxy->remote->objects, proxy->id);
|
||||
spa_list_remove(&proxy->link);
|
||||
|
|
@ -122,12 +122,12 @@ void pw_proxy_destroy(struct pw_proxy *proxy)
|
|||
free(impl);
|
||||
}
|
||||
|
||||
struct pw_callback_list *pw_proxy_get_listeners(struct pw_proxy *proxy)
|
||||
struct pw_listener_list *pw_proxy_get_proxy_listeners(struct pw_proxy *proxy)
|
||||
{
|
||||
return &proxy->listener_list;
|
||||
return &proxy->proxy_listener_list;
|
||||
}
|
||||
|
||||
const void *pw_proxy_get_implementation(struct pw_proxy *proxy)
|
||||
const void *pw_proxy_get_proxy_implementation(struct pw_proxy *proxy)
|
||||
{
|
||||
return proxy->marshal->method_marshal;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,10 +88,10 @@ struct pw_proxy;
|
|||
|
||||
#include <pipewire/type.h>
|
||||
#include <pipewire/utils.h>
|
||||
#include <pipewire/callback.h>
|
||||
#include <pipewire/listener.h>
|
||||
|
||||
struct pw_proxy_callbacks {
|
||||
#define PW_VERSION_PROXY_CALLBACKS 0
|
||||
struct pw_proxy_events {
|
||||
#define PW_VERSION_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
void (*destroy) (void *data);
|
||||
|
|
@ -99,20 +99,20 @@ struct pw_proxy_callbacks {
|
|||
|
||||
/** Make a new proxy object. The id can be used to bind to a remote object. */
|
||||
struct pw_proxy *
|
||||
pw_proxy_new(struct pw_proxy *proxy, /**< proxy as factory */
|
||||
pw_proxy_new(struct pw_proxy *factory, /**< factory */
|
||||
uint32_t type, /**< interface type */
|
||||
size_t user_data_size /**< size of user data */);
|
||||
|
||||
void
|
||||
pw_proxy_add_callbacks(struct pw_proxy *proxy,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_proxy_callbacks *callbacks,
|
||||
pw_proxy_add_listener(struct pw_proxy *proxy,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_proxy_events *events,
|
||||
void *data);
|
||||
|
||||
void
|
||||
pw_proxy_add_listener(struct pw_proxy *proxy, /**< the proxy */
|
||||
struct pw_callback_info *info,
|
||||
const void *callbacks, /**< events */
|
||||
pw_proxy_add_proxy_listener(struct pw_proxy *proxy, /**< the proxy */
|
||||
struct pw_listener *listener, /**< listener */
|
||||
const void *events, /**< proxied events */
|
||||
void *data /**< data passed to events */);
|
||||
|
||||
void pw_proxy_destroy(struct pw_proxy *proxy);
|
||||
|
|
@ -121,15 +121,15 @@ void *pw_proxy_get_user_data(struct pw_proxy *proxy);
|
|||
|
||||
uint32_t pw_proxy_get_id(struct pw_proxy *proxy);
|
||||
|
||||
struct pw_callback_list *pw_proxy_get_listeners(struct pw_proxy *proxy);
|
||||
struct pw_listener_list *pw_proxy_get_proxy_listeners(struct pw_proxy *proxy);
|
||||
|
||||
const void *pw_proxy_get_implementation(struct pw_proxy *proxy);
|
||||
const void *pw_proxy_get_proxy_implementation(struct pw_proxy *proxy);
|
||||
|
||||
#define pw_proxy_notify(p,type,event,...) pw_callback_emit(pw_proxy_get_listeners(p),type,event,__VA_ARGS__)
|
||||
#define pw_proxy_notify_na(p,type,event) pw_callback_emit_na(pw_proxy_get_listeners(p),type,event)
|
||||
#define pw_proxy_notify(p,type,event,...) pw_listener_list_emit(pw_proxy_get_proxy_listeners(p),type,event,__VA_ARGS__)
|
||||
#define pw_proxy_notify_na(p,type,event) pw_listener_list_emit_na(pw_proxy_get_proxy_listeners(p),type,event)
|
||||
|
||||
#define pw_proxy_do(p,type,method,...) ((type*) pw_proxy_get_implementation(p))->method(p, __VA_ARGS__)
|
||||
#define pw_proxy_do_na(p,type,method) ((type*) pw_proxy_get_implementation(p))->method(p)
|
||||
#define pw_proxy_do(p,type,method,...) ((type*) pw_proxy_get_proxy_implementation(p))->method(p, __VA_ARGS__)
|
||||
#define pw_proxy_do_na(p,type,method) ((type*) pw_proxy_get_proxy_implementation(p))->method(p)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
struct remote {
|
||||
struct pw_remote this;
|
||||
uint32_t type_client_node;
|
||||
struct pw_callback_info core_callbacks;
|
||||
struct pw_listener core_listener;
|
||||
};
|
||||
|
||||
struct mem_id {
|
||||
|
|
@ -62,11 +62,9 @@ struct buffer_id {
|
|||
};
|
||||
|
||||
struct node_data {
|
||||
struct pw_node *node;
|
||||
struct pw_remote *remote;
|
||||
struct pw_core *core;
|
||||
struct pw_type *t;
|
||||
struct pw_client_node_proxy *node_proxy;
|
||||
uint32_t node_id;
|
||||
|
||||
int rtreadfd;
|
||||
|
|
@ -74,9 +72,11 @@ struct node_data {
|
|||
struct spa_source *rtsocket_source;
|
||||
struct pw_transport *trans;
|
||||
|
||||
struct pw_listener node_proxy_destroy;
|
||||
struct pw_callback_info node_callbacks;
|
||||
struct pw_callback_info node_listener;
|
||||
struct pw_node *node;
|
||||
struct pw_listener node_listener;
|
||||
|
||||
struct pw_client_node_proxy *node_proxy;
|
||||
struct pw_listener proxy_listener;
|
||||
|
||||
struct pw_array mem_ids;
|
||||
struct pw_array buffer_ids;
|
||||
|
|
@ -132,7 +132,7 @@ pw_remote_update_state(struct pw_remote *remote, enum pw_remote_state state, con
|
|||
pw_remote_state_as_string(state), remote->error);
|
||||
|
||||
remote->state = state;
|
||||
pw_callback_emit(&remote->callback_list, struct pw_remote_callbacks, state_changed,
|
||||
pw_listener_list_emit(&remote->listener_list, struct pw_remote_events, state_changed,
|
||||
old, state, remote->error);
|
||||
}
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ static void core_event_info(void *data, struct pw_core_info *info)
|
|||
|
||||
pw_log_debug("got core info");
|
||||
this->info = pw_core_info_update(this->info, info);
|
||||
pw_callback_emit(&this->callback_list, struct pw_remote_callbacks, info_changed, info);
|
||||
pw_listener_list_emit(&this->listener_list, struct pw_remote_events, info_changed, info);
|
||||
}
|
||||
|
||||
static void core_event_done(void *data, uint32_t seq)
|
||||
|
|
@ -154,7 +154,7 @@ static void core_event_done(void *data, uint32_t seq)
|
|||
if (seq == 0)
|
||||
pw_remote_update_state(this, PW_REMOTE_STATE_CONNECTED, NULL);
|
||||
|
||||
pw_callback_emit(&this->callback_list, struct pw_remote_callbacks, sync_reply, seq);
|
||||
pw_listener_list_emit(&this->listener_list, struct pw_remote_events, sync_reply, seq);
|
||||
}
|
||||
|
||||
static void core_event_error(void *data, uint32_t id, int res, const char *error, ...)
|
||||
|
|
@ -188,8 +188,8 @@ core_event_update_types(void *data, uint32_t first_id, uint32_t n_types, const c
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_core_events core_events = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
static const struct pw_core_proxy_events core_proxy_events = {
|
||||
PW_VERSION_CORE_PROXY_EVENTS,
|
||||
.update_types = core_event_update_types,
|
||||
.done = core_event_done,
|
||||
.error = core_event_error,
|
||||
|
|
@ -231,7 +231,7 @@ struct pw_remote *pw_remote_new(struct pw_core *core,
|
|||
spa_list_init(&this->proxy_list);
|
||||
spa_list_init(&this->stream_list);
|
||||
|
||||
pw_callback_init(&this->callback_list);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
|
||||
if ((protocol_name = pw_properties_get(properties, "pipewire.protocol")) == NULL) {
|
||||
if (!pw_module_load(core, "libpipewire-module-protocol-native", NULL))
|
||||
|
|
@ -268,7 +268,7 @@ void pw_remote_destroy(struct pw_remote *remote)
|
|||
struct pw_stream *stream, *s2;
|
||||
|
||||
pw_log_debug("remote %p: destroy", remote);
|
||||
pw_callback_emit_na(&remote->callback_list, struct pw_remote_callbacks, destroy);
|
||||
pw_listener_list_emit_na(&remote->listener_list, struct pw_remote_events, destroy);
|
||||
|
||||
if (remote->state != PW_REMOTE_STATE_UNCONNECTED)
|
||||
pw_remote_disconnect(remote);
|
||||
|
|
@ -298,12 +298,12 @@ enum pw_remote_state pw_remote_get_state(struct pw_remote *remote, const char **
|
|||
return remote->state;
|
||||
}
|
||||
|
||||
void pw_remote_add_callbacks(struct pw_remote *remote,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_remote_callbacks *callbacks,
|
||||
void pw_remote_add_listener(struct pw_remote *remote,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_remote_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&remote->callback_list, info, callbacks, data);
|
||||
pw_listener_list_add(&remote->listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
static int do_connect(struct pw_remote *remote)
|
||||
|
|
@ -317,7 +317,7 @@ static int do_connect(struct pw_remote *remote)
|
|||
if (remote->core_proxy == NULL)
|
||||
goto no_proxy;
|
||||
|
||||
pw_core_proxy_add_listener(remote->core_proxy, &impl->core_callbacks, &core_events, remote);
|
||||
pw_core_proxy_add_listener(remote->core_proxy, &impl->core_listener, &core_proxy_events, remote);
|
||||
|
||||
pw_core_proxy_client_update(remote->core_proxy, &remote->properties->dict);
|
||||
pw_core_proxy_sync(remote->core_proxy, 0);
|
||||
|
|
@ -906,8 +906,8 @@ client_node_port_command(void *object,
|
|||
pw_log_warn("port command not supported");
|
||||
}
|
||||
|
||||
static const struct pw_client_node_events client_node_events = {
|
||||
PW_VERSION_CLIENT_NODE_EVENTS,
|
||||
static const struct pw_client_node_proxy_events client_node_events = {
|
||||
PW_VERSION_CLIENT_NODE_PROXY_EVENTS,
|
||||
.transport = client_node_transport,
|
||||
.set_props = client_node_set_props,
|
||||
.event = client_node_event,
|
||||
|
|
@ -967,8 +967,8 @@ static void do_node_init(struct pw_proxy *proxy)
|
|||
pw_client_node_proxy_done(data->node_proxy, 0, SPA_RESULT_OK);
|
||||
}
|
||||
|
||||
static const struct pw_node_callbacks node_callbacks = {
|
||||
PW_VERSION_NODE_CALLBACKS,
|
||||
static const struct pw_node_events node_events = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
.need_input = node_need_input,
|
||||
.have_output = node_have_output,
|
||||
};
|
||||
|
|
@ -1002,9 +1002,9 @@ struct pw_proxy *pw_remote_export(struct pw_remote *remote,
|
|||
pw_array_init(&data->buffer_ids, 32);
|
||||
pw_array_ensure_size(&data->buffer_ids, sizeof(struct buffer_id) * 64);
|
||||
|
||||
pw_node_add_callbacks(node, &data->node_callbacks, &node_callbacks, data);
|
||||
pw_node_add_listener(node, &data->node_listener, &node_events, data);
|
||||
|
||||
pw_client_node_proxy_add_listener(data->node_proxy, &data->node_listener, &client_node_events, proxy);
|
||||
pw_client_node_proxy_add_listener(data->node_proxy, &data->proxy_listener, &client_node_events, proxy);
|
||||
do_node_init(proxy);
|
||||
|
||||
return proxy;
|
||||
|
|
|
|||
|
|
@ -117,8 +117,8 @@ enum pw_remote_state {
|
|||
/** Convert a \ref pw_remote_state to a readable string \memberof pw_remote */
|
||||
const char *pw_remote_state_as_string(enum pw_remote_state state);
|
||||
|
||||
struct pw_remote_callbacks {
|
||||
#define PW_VERSION_REMOTE_CALLBACKS 0
|
||||
struct pw_remote_events {
|
||||
#define PW_VERSION_REMOTE_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
void (*destroy) (void *data);
|
||||
|
|
@ -147,10 +147,10 @@ struct pw_core *pw_remote_get_core(struct pw_remote *remote);
|
|||
/** Get the current state, \a error is set when state is \ref PW_REMOTE_STATE_ERROR */
|
||||
enum pw_remote_state pw_remote_get_state(struct pw_remote *remote, const char **error);
|
||||
|
||||
/** Add callbacks to the remote */
|
||||
void pw_remote_add_callbacks(struct pw_remote *remote,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_remote_callbacks *callbacks,
|
||||
/** Add listener for events */
|
||||
void pw_remote_add_listener(struct pw_remote *remote,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_remote_events *events,
|
||||
void *data);
|
||||
|
||||
/** Connect to a remote PipeWire \memberof pw_remote
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ struct pw_resource *pw_resource_new(struct pw_client *client,
|
|||
this->type = type;
|
||||
this->version = version;
|
||||
|
||||
pw_callback_init(&this->callback_list);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
|
||||
if (id == SPA_ID_INVALID) {
|
||||
id = pw_map_insert_new(&client->objects, this);
|
||||
|
|
@ -66,7 +66,7 @@ struct pw_resource *pw_resource_new(struct pw_client *client,
|
|||
this->marshal = pw_protocol_get_marshal(client->protocol, type);
|
||||
|
||||
pw_log_debug("resource %p: new for client %p id %u", this, client, id);
|
||||
pw_callback_emit(&client->callback_list, struct pw_client_callbacks, resource_added, this);
|
||||
pw_listener_list_emit(&client->listener_list, struct pw_client_events, resource_added, this);
|
||||
|
||||
return this;
|
||||
|
||||
|
|
@ -81,12 +81,12 @@ void *pw_resource_get_user_data(struct pw_resource *resource)
|
|||
return resource->user_data;
|
||||
}
|
||||
|
||||
void pw_resource_add_callbacks(struct pw_resource *resource,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_resource_callbacks *callbacks,
|
||||
void pw_resource_add_listener(struct pw_resource *resource,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_resource_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&resource->callback_list, info, callbacks, data);
|
||||
pw_listener_list_add(&resource->listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
void pw_resource_set_implementation(struct pw_resource *resource,
|
||||
|
|
@ -96,7 +96,7 @@ void pw_resource_set_implementation(struct pw_resource *resource,
|
|||
struct pw_client *client = resource->client;
|
||||
resource->implementation = implementation;
|
||||
resource->implementation_data = data;
|
||||
pw_callback_emit(&client->callback_list, struct pw_client_callbacks, resource_impl, resource);
|
||||
pw_listener_list_emit(&client->listener_list, struct pw_client_events, resource_impl, resource);
|
||||
}
|
||||
|
||||
void pw_resource_destroy(struct pw_resource *resource)
|
||||
|
|
@ -104,10 +104,10 @@ void pw_resource_destroy(struct pw_resource *resource)
|
|||
struct pw_client *client = resource->client;
|
||||
|
||||
pw_log_trace("resource %p: destroy %u", resource, resource->id);
|
||||
pw_callback_emit_na(&resource->callback_list, struct pw_resource_callbacks, destroy);
|
||||
pw_listener_list_emit_na(&resource->listener_list, struct pw_resource_events, destroy);
|
||||
|
||||
pw_map_insert_at(&client->objects, resource->id, NULL);
|
||||
pw_callback_emit(&client->callback_list, struct pw_client_callbacks, resource_removed, resource);
|
||||
pw_listener_list_emit(&client->listener_list, struct pw_client_events, resource_removed, resource);
|
||||
|
||||
if (client->core_resource)
|
||||
pw_core_resource_remove_id(client->core_resource, resource->id);
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ struct pw_resource;
|
|||
#include <pipewire/core.h>
|
||||
#include <pipewire/client.h>
|
||||
|
||||
struct pw_resource_callbacks {
|
||||
#define PW_VERSION_RESOURCE_CALLBACKS 0
|
||||
struct pw_resource_events {
|
||||
#define PW_VERSION_RESOURCE_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
void (*destroy) (void *data);
|
||||
|
|
@ -78,9 +78,9 @@ pw_resource_new(struct pw_client *client, /**< the client owning the resource */
|
|||
|
||||
void *pw_resource_get_user_data(struct pw_resource *resource);
|
||||
|
||||
void pw_resource_add_callbacks(struct pw_resource *resource,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_resource_callbacks *callbacks,
|
||||
void pw_resource_add_listener(struct pw_resource *resource,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_resource_events *events,
|
||||
void *data);
|
||||
|
||||
void pw_resource_set_implementation(struct pw_resource *resource,
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
/* PipeWire
|
||||
* Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __PIPEWIRE_SIGNAL_H__
|
||||
#define __PIPEWIRE_SIGNAL_H__
|
||||
|
||||
#include <spa/list.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \class pw_signal
|
||||
* Signal emission helpers
|
||||
*/
|
||||
|
||||
/** A listener \memberof pw_signal */
|
||||
struct pw_listener {
|
||||
struct spa_list link; /**< link in the signal listeners */
|
||||
void (*notify) (void *); /**< notify function */
|
||||
};
|
||||
|
||||
/** A signal definition \memberof pw_signal */
|
||||
#define PW_SIGNAL(name,func) \
|
||||
union { \
|
||||
struct spa_list listeners; \
|
||||
void (*notify) func; \
|
||||
} name;
|
||||
|
||||
/** Initialize a signal \memberof pw_signal */
|
||||
#define pw_signal_init(signal) \
|
||||
spa_list_init(&(signal)->listeners);
|
||||
|
||||
/** Add a signal listener \memberof pw_signal */
|
||||
#define pw_signal_add(signal,listener,func) \
|
||||
do { \
|
||||
__typeof__((signal)->notify) n = (func); \
|
||||
(listener)->notify = (void(*)(void *)) n; \
|
||||
spa_list_insert((signal)->listeners.prev, &(listener)->link); \
|
||||
} while (false);
|
||||
|
||||
/** Remove a signal listener \memberof pw_signal */
|
||||
static inline void pw_signal_remove(struct pw_listener *listener)
|
||||
{
|
||||
spa_list_remove(&listener->link);
|
||||
}
|
||||
|
||||
/** Emit a signal \memberof pw_signal */
|
||||
#define pw_signal_emit(signal,...) \
|
||||
do { \
|
||||
struct pw_listener *l, *next; \
|
||||
spa_list_for_each_safe(l, next, &(signal)->listeners, link) \
|
||||
((__typeof__((signal)->notify))l->notify)(l,__VA_ARGS__); \
|
||||
} while (false);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PIPEWIRE_SIGNAL_H__ */
|
||||
|
|
@ -85,8 +85,8 @@ struct stream {
|
|||
|
||||
struct pw_client_node_proxy *node_proxy;
|
||||
bool disconnecting;
|
||||
struct pw_callback_info node_listener;
|
||||
struct pw_callback_info proxy_callbacks;
|
||||
struct pw_listener node_listener;
|
||||
struct pw_listener proxy_listener;
|
||||
|
||||
struct pw_transport *trans;
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ static void clear_buffers(struct pw_stream *stream)
|
|||
pw_log_debug("stream %p: clear buffers", stream);
|
||||
|
||||
pw_array_for_each(bid, &impl->buffer_ids) {
|
||||
pw_callback_emit(&stream->callback_list, struct pw_stream_callbacks, remove_buffer, bid->id);
|
||||
pw_listener_list_emit(&stream->listener_list, struct pw_stream_events, remove_buffer, bid->id);
|
||||
free(bid->buf);
|
||||
bid->buf = NULL;
|
||||
bid->used = false;
|
||||
|
|
@ -155,7 +155,7 @@ static bool stream_set_state(struct pw_stream *stream, enum pw_stream_state stat
|
|||
pw_stream_state_as_string(state), stream->error);
|
||||
|
||||
stream->state = state;
|
||||
pw_callback_emit(&stream->callback_list, struct pw_stream_callbacks, state_changed,
|
||||
pw_listener_list_emit(&stream->listener_list, struct pw_stream_events, state_changed,
|
||||
old, state, error);
|
||||
}
|
||||
return res;
|
||||
|
|
@ -209,7 +209,7 @@ struct pw_stream *pw_stream_new(struct pw_remote *remote,
|
|||
this->name = strdup(name);
|
||||
impl->type_client_node = spa_type_map_get_id(remote->core->type.map, PW_TYPE_INTERFACE__ClientNode);
|
||||
|
||||
pw_callback_init(&this->callback_list);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
|
||||
this->state = PW_STREAM_STATE_UNCONNECTED;
|
||||
|
||||
|
|
@ -241,12 +241,12 @@ struct pw_properties *pw_stream_get_properties(struct pw_stream *stream)
|
|||
return stream->properties;
|
||||
}
|
||||
|
||||
void pw_stream_add_callbacks(struct pw_stream *stream,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_stream_callbacks *callbacks,
|
||||
void pw_stream_add_listener(struct pw_stream *stream,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_stream_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&stream->callback_list, info, callbacks, data);
|
||||
pw_listener_list_add(&stream->listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
static void unhandle_socket(struct pw_stream *stream)
|
||||
|
|
@ -309,14 +309,14 @@ void pw_stream_destroy(struct pw_stream *stream)
|
|||
|
||||
pw_log_debug("stream %p: destroy", stream);
|
||||
|
||||
pw_callback_emit_na(&stream->callback_list, struct pw_stream_callbacks, destroy);
|
||||
pw_listener_list_emit_na(&stream->listener_list, struct pw_stream_events, destroy);
|
||||
|
||||
unhandle_socket(stream);
|
||||
|
||||
spa_list_remove(&stream->link);
|
||||
|
||||
if (impl->node_proxy)
|
||||
pw_callback_remove(&impl->proxy_callbacks);
|
||||
pw_listener_remove(&impl->proxy_listener);
|
||||
|
||||
set_possible_formats(stream, 0, NULL);
|
||||
set_params(stream, 0, NULL);
|
||||
|
|
@ -475,7 +475,7 @@ static inline void reuse_buffer(struct pw_stream *stream, uint32_t id)
|
|||
pw_log_trace("stream %p: reuse buffer %u", stream, id);
|
||||
bid->used = false;
|
||||
spa_list_insert(impl->free.prev, &bid->link);
|
||||
pw_callback_emit(&stream->callback_list, struct pw_stream_callbacks, new_buffer, id);
|
||||
pw_listener_list_emit(&stream->listener_list, struct pw_stream_events, new_buffer, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -495,7 +495,7 @@ static void handle_rtnode_event(struct pw_stream *stream, struct spa_event *even
|
|||
if (input->buffer_id == SPA_ID_INVALID)
|
||||
continue;
|
||||
|
||||
pw_callback_emit(&stream->callback_list, struct pw_stream_callbacks,
|
||||
pw_listener_list_emit(&stream->listener_list, struct pw_stream_events,
|
||||
new_buffer, input->buffer_id);
|
||||
input->buffer_id = SPA_ID_INVALID;
|
||||
}
|
||||
|
|
@ -514,7 +514,7 @@ static void handle_rtnode_event(struct pw_stream *stream, struct spa_event *even
|
|||
}
|
||||
pw_log_trace("stream %p: process output", stream);
|
||||
impl->in_need_buffer = true;
|
||||
pw_callback_emit_na(&stream->callback_list, struct pw_stream_callbacks, need_buffer);
|
||||
pw_listener_list_emit_na(&stream->listener_list, struct pw_stream_events, need_buffer);
|
||||
impl->in_need_buffer = false;
|
||||
} else if (SPA_EVENT_TYPE(event) == remote->core->type.event_transport.ReuseBuffer) {
|
||||
struct pw_event_transport_reuse_buffer *p =
|
||||
|
|
@ -608,7 +608,7 @@ handle_node_command(struct pw_stream *stream, uint32_t seq, const struct spa_com
|
|||
send_need_input(stream);
|
||||
else {
|
||||
impl->in_need_buffer = true;
|
||||
pw_callback_emit_na(&stream->callback_list, struct pw_stream_callbacks,
|
||||
pw_listener_list_emit_na(&stream->listener_list, struct pw_stream_events,
|
||||
need_buffer);
|
||||
impl->in_need_buffer = false;
|
||||
}
|
||||
|
|
@ -672,7 +672,7 @@ client_node_set_format(void *data,
|
|||
impl->format = format ? spa_format_copy(format) : NULL;
|
||||
impl->pending_seq = seq;
|
||||
|
||||
pw_callback_emit(&stream->callback_list, struct pw_stream_callbacks, format_changed, impl->format);
|
||||
pw_listener_list_emit(&stream->listener_list, struct pw_stream_events, format_changed, impl->format);
|
||||
|
||||
if (format)
|
||||
stream_set_state(stream, PW_STREAM_STATE_READY, NULL);
|
||||
|
|
@ -821,7 +821,7 @@ client_node_use_buffers(void *data,
|
|||
pw_log_warn("unknown buffer data type %d", d->type);
|
||||
}
|
||||
}
|
||||
pw_callback_emit(&stream->callback_list, struct pw_stream_callbacks, add_buffer, bid->id);
|
||||
pw_listener_list_emit(&stream->listener_list, struct pw_stream_events, add_buffer, bid->id);
|
||||
}
|
||||
|
||||
add_async_complete(stream, seq, SPA_RESULT_OK);
|
||||
|
|
@ -876,8 +876,8 @@ static void client_node_transport(void *data, uint32_t node_id,
|
|||
stream_set_state(stream, PW_STREAM_STATE_CONFIGURE, NULL);
|
||||
}
|
||||
|
||||
static const struct pw_client_node_events client_node_events = {
|
||||
PW_VERSION_CLIENT_NODE_EVENTS,
|
||||
static const struct pw_client_node_proxy_events client_node_events = {
|
||||
PW_VERSION_CLIENT_NODE_PROXY_EVENTS,
|
||||
.transport = client_node_transport,
|
||||
.set_props = client_node_set_props,
|
||||
.event = client_node_event,
|
||||
|
|
@ -899,13 +899,13 @@ static void on_node_proxy_destroy(void *data)
|
|||
impl->disconnecting = false;
|
||||
impl->node_proxy = NULL;
|
||||
|
||||
pw_callback_remove(&impl->proxy_callbacks);
|
||||
pw_listener_remove(&impl->proxy_listener);
|
||||
|
||||
stream_set_state(this, PW_STREAM_STATE_UNCONNECTED, NULL);
|
||||
}
|
||||
|
||||
static const struct pw_proxy_callbacks proxy_callbacks = {
|
||||
PW_VERSION_PROXY_CALLBACKS,
|
||||
static const struct pw_proxy_events proxy_events = {
|
||||
PW_VERSION_PROXY_EVENTS,
|
||||
.destroy = on_node_proxy_destroy,
|
||||
};
|
||||
|
||||
|
|
@ -946,7 +946,7 @@ pw_stream_connect(struct pw_stream *stream,
|
|||
return false;
|
||||
|
||||
pw_client_node_proxy_add_listener(impl->node_proxy, &impl->node_listener, &client_node_events, impl);
|
||||
pw_proxy_add_callbacks((struct pw_proxy*)impl->node_proxy, &impl->proxy_callbacks, &proxy_callbacks, impl);
|
||||
pw_proxy_add_listener((struct pw_proxy*)impl->node_proxy, &impl->proxy_listener, &proxy_events, impl);
|
||||
|
||||
do_node_init(stream);
|
||||
|
||||
|
|
|
|||
|
|
@ -179,8 +179,8 @@ enum pw_stream_state {
|
|||
PW_STREAM_STATE_STREAMING = 5 /**< streaming */
|
||||
};
|
||||
|
||||
struct pw_stream_callbacks {
|
||||
#define PW_VERSION_STREAM_CALLBACKS 0
|
||||
struct pw_stream_events {
|
||||
#define PW_VERSION_STREAM_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
void (*destroy) (void *data);
|
||||
|
|
@ -238,9 +238,9 @@ pw_stream_new(struct pw_remote *remote, /**< a \ref pw_remote */
|
|||
/** Destroy a stream \memberof pw_stream */
|
||||
void pw_stream_destroy(struct pw_stream *stream);
|
||||
|
||||
void pw_stream_add_callbacks(struct pw_stream *stream,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_stream_callbacks *callbacks,
|
||||
void pw_stream_add_listener(struct pw_stream *stream,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_stream_events *events,
|
||||
void *data);
|
||||
|
||||
enum pw_stream_state pw_stream_get_state(struct pw_stream *stream, const char **error);
|
||||
|
|
@ -294,7 +294,7 @@ bool pw_stream_recycle_buffer(struct pw_stream *stream, uint32_t id);
|
|||
/** Get the buffer with \a id from \a stream \memberof pw_stream
|
||||
* \return a \ref spa_buffer or NULL when there is no buffer
|
||||
*
|
||||
* This function should be called from the new-buffer signal callback. */
|
||||
* This function should be called from the new-buffer event. */
|
||||
struct spa_buffer *
|
||||
pw_stream_peek_buffer(struct pw_stream *stream, uint32_t id);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ struct pw_thread_loop {
|
|||
struct pw_loop *loop;
|
||||
char *name;
|
||||
|
||||
struct pw_callback_list callback_list;
|
||||
struct pw_listener_list listener_list;
|
||||
|
||||
pthread_mutex_t lock;
|
||||
pthread_cond_t cond;
|
||||
|
|
@ -102,7 +102,7 @@ struct pw_thread_loop *pw_thread_loop_new(struct pw_loop *loop, const char *name
|
|||
this->hooks = impl_hooks;
|
||||
pw_loop_add_hooks(loop, &this->hooks);
|
||||
|
||||
pw_callback_init(&this->callback_list);
|
||||
pw_listener_list_init(&this->listener_list);
|
||||
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
|
|
@ -118,7 +118,7 @@ struct pw_thread_loop *pw_thread_loop_new(struct pw_loop *loop, const char *name
|
|||
/** Destroy a threaded loop \memberof pw_thread_loop */
|
||||
void pw_thread_loop_destroy(struct pw_thread_loop *loop)
|
||||
{
|
||||
pw_callback_emit_na(&loop->callback_list, struct pw_thread_loop_callbacks, destroy);
|
||||
pw_listener_list_emit_na(&loop->listener_list, struct pw_thread_loop_events, destroy);
|
||||
|
||||
pw_thread_loop_stop(loop);
|
||||
|
||||
|
|
@ -133,12 +133,12 @@ void pw_thread_loop_destroy(struct pw_thread_loop *loop)
|
|||
free(loop);
|
||||
}
|
||||
|
||||
void pw_thread_loop_add_callbacks(struct pw_thread_loop *loop,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_thread_loop_callbacks *callbacks,
|
||||
void pw_thread_loop_add_listener(struct pw_thread_loop *loop,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_thread_loop_events *events,
|
||||
void *data)
|
||||
{
|
||||
pw_callback_add(&loop->callback_list, info, callbacks, data);
|
||||
pw_listener_list_add(&loop->listener_list, listener, events, data);
|
||||
}
|
||||
|
||||
struct pw_loop *
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ extern "C" {
|
|||
*/
|
||||
struct pw_thread_loop;
|
||||
|
||||
struct pw_thread_loop_callbacks {
|
||||
#define PW_VERSION_THREAD_LOOP_CALLBACKS 0
|
||||
struct pw_thread_loop_events {
|
||||
#define PW_VERSION_THREAD_LOOP_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
void (*destroy) (void *data);
|
||||
|
|
@ -102,9 +102,9 @@ pw_thread_loop_new(struct pw_loop *loop, const char *name);
|
|||
void
|
||||
pw_thread_loop_destroy(struct pw_thread_loop *loop);
|
||||
|
||||
void pw_thread_loop_add_callbacks(struct pw_thread_loop *loop,
|
||||
struct pw_callback_info *info,
|
||||
const struct pw_thread_loop_callbacks *callbacks,
|
||||
void pw_thread_loop_add_listener(struct pw_thread_loop *loop,
|
||||
struct pw_listener *listener,
|
||||
const struct pw_thread_loop_events *events,
|
||||
void *data);
|
||||
struct pw_loop *
|
||||
pw_thread_loop_get_loop(struct pw_thread_loop *loop);
|
||||
|
|
|
|||
|
|
@ -118,7 +118,6 @@ struct pw_transport *pw_transport_new(uint32_t max_input_ports, uint32_t max_out
|
|||
return NULL;
|
||||
|
||||
trans = &impl->trans;
|
||||
pw_signal_init(&trans->destroy_signal);
|
||||
impl->offset = 0;
|
||||
|
||||
if(user_data_size > 0)
|
||||
|
|
@ -146,7 +145,6 @@ struct pw_transport *pw_transport_new_from_info(struct pw_transport_info *info,
|
|||
return NULL;
|
||||
|
||||
trans = &impl->trans;
|
||||
pw_signal_init(&trans->destroy_signal);
|
||||
|
||||
if(user_data_size > 0)
|
||||
trans->user_data = SPA_MEMBER(impl, sizeof(struct transport), void);
|
||||
|
|
@ -190,8 +188,6 @@ void pw_transport_destroy(struct pw_transport *trans)
|
|||
|
||||
pw_log_debug("transport %p: destroy", trans);
|
||||
|
||||
pw_signal_emit(&trans->destroy_signal, trans);
|
||||
|
||||
pw_memblock_free(&impl->mem);
|
||||
free(impl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ extern "C" {
|
|||
#include <spa/node.h>
|
||||
|
||||
#include <pipewire/mem.h>
|
||||
#include <pipewire/sig.h>
|
||||
|
||||
/** information about the transport region \memberof pw_transport */
|
||||
struct pw_transport_info {
|
||||
|
|
@ -56,9 +55,6 @@ struct pw_transport_area {
|
|||
* lockfree way.
|
||||
*/
|
||||
struct pw_transport {
|
||||
/** Emited when the transport is destroyed */
|
||||
PW_SIGNAL(destroy_signal, (struct pw_listener *listener, struct pw_transport *trans));
|
||||
|
||||
struct pw_transport_area *area; /**< the transport area */
|
||||
struct spa_port_io *inputs; /**< array of input port io */
|
||||
struct spa_port_io *outputs; /**< array of output port io */
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include <pipewire/pipewire.h>
|
||||
#include <pipewire/interfaces.h>
|
||||
#include <pipewire/type.h>
|
||||
#include <pipewire/sig.h>
|
||||
|
||||
struct data {
|
||||
bool running;
|
||||
|
|
@ -32,12 +31,12 @@ struct data {
|
|||
struct pw_core *core;
|
||||
|
||||
struct pw_remote *remote;
|
||||
struct pw_callback_info remote_callbacks;
|
||||
struct pw_listener remote_listener;
|
||||
|
||||
struct pw_core_proxy *core_proxy;
|
||||
|
||||
struct pw_registry_proxy *registry_proxy;
|
||||
struct pw_callback_info registry_listener;
|
||||
struct pw_listener registry_listener;
|
||||
};
|
||||
|
||||
struct proxy_data {
|
||||
|
|
@ -49,8 +48,8 @@ struct proxy_data {
|
|||
uint32_t type;
|
||||
void *info;
|
||||
pw_destroy_t destroy;
|
||||
struct pw_callback_info proxy_listener;
|
||||
struct pw_callback_info proxy_callbacks;
|
||||
struct pw_listener proxy_listener;
|
||||
struct pw_listener proxy_proxy_listener;
|
||||
};
|
||||
|
||||
static void print_properties(struct spa_dict *props, char mark)
|
||||
|
|
@ -115,8 +114,8 @@ static void module_event_info(void *object, struct pw_module_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_module_events module_events = {
|
||||
PW_VERSION_MODULE_EVENTS,
|
||||
static const struct pw_module_proxy_events module_events = {
|
||||
PW_VERSION_MODULE_PROXY_EVENTS,
|
||||
.info = module_event_info,
|
||||
};
|
||||
|
||||
|
|
@ -167,8 +166,8 @@ static void node_event_info(void *object, struct pw_node_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_node_events node_events = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
static const struct pw_node_proxy_events node_events = {
|
||||
PW_VERSION_NODE_PROXY_EVENTS,
|
||||
.info = node_event_info
|
||||
};
|
||||
|
||||
|
|
@ -201,8 +200,8 @@ static void client_event_info(void *object, struct pw_client_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_client_events client_events = {
|
||||
PW_VERSION_CLIENT_EVENTS,
|
||||
static const struct pw_client_proxy_events client_events = {
|
||||
PW_VERSION_CLIENT_PROXY_EVENTS,
|
||||
.info = client_event_info
|
||||
};
|
||||
|
||||
|
|
@ -243,8 +242,8 @@ static void link_event_info(void *object, struct pw_link_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_link_events link_events = {
|
||||
PW_VERSION_LINK_EVENTS,
|
||||
static const struct pw_link_proxy_events link_events = {
|
||||
PW_VERSION_LINK_PROXY_EVENTS,
|
||||
.info = link_event_info
|
||||
};
|
||||
|
||||
|
|
@ -261,8 +260,8 @@ destroy_proxy (void *data)
|
|||
user_data->info = NULL;
|
||||
}
|
||||
|
||||
static const struct pw_proxy_callbacks proxy_callbacks = {
|
||||
PW_VERSION_PROXY_CALLBACKS,
|
||||
static const struct pw_proxy_events proxy_events = {
|
||||
PW_VERSION_PROXY_EVENTS,
|
||||
.destroy = destroy_proxy,
|
||||
};
|
||||
|
||||
|
|
@ -322,8 +321,8 @@ static void registry_event_global(void *data, uint32_t id, uint32_t parent_id,
|
|||
pd->permissions = permissions;
|
||||
pd->version = version;
|
||||
pd->destroy = destroy;
|
||||
pw_proxy_add_listener(proxy, &pd->proxy_listener, events, pd);
|
||||
pw_proxy_add_callbacks(proxy, &pd->proxy_callbacks, &proxy_callbacks, pd);
|
||||
pw_proxy_add_proxy_listener(proxy, &pd->proxy_proxy_listener, events, pd);
|
||||
pw_proxy_add_listener(proxy, &pd->proxy_listener, &proxy_events, pd);
|
||||
|
||||
return;
|
||||
|
||||
|
|
@ -338,8 +337,8 @@ static void registry_event_global_remove(void *object, uint32_t id)
|
|||
printf("\tid: %u\n", id);
|
||||
}
|
||||
|
||||
static const struct pw_registry_events registry_events = {
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
static const struct pw_registry_proxy_events registry_events = {
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
.global = registry_event_global,
|
||||
.global_remove = registry_event_global_remove,
|
||||
};
|
||||
|
|
@ -374,8 +373,8 @@ static void on_state_changed(void *_data, enum pw_remote_state old,
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_remote_callbacks remote_callbacks = {
|
||||
PW_VERSION_REMOTE_CALLBACKS,
|
||||
static const struct pw_remote_events remote_events = {
|
||||
PW_VERSION_REMOTE_EVENTS,
|
||||
.info_changed = on_info_changed,
|
||||
.state_changed = on_state_changed,
|
||||
};
|
||||
|
|
@ -391,7 +390,7 @@ int main(int argc, char *argv[])
|
|||
data.core = pw_core_new(data.loop, NULL);
|
||||
data.remote = pw_remote_new(data.core, NULL);
|
||||
|
||||
pw_remote_add_callbacks(data.remote, &data.remote_callbacks, &remote_callbacks, &data);
|
||||
pw_remote_add_listener(data.remote, &data.remote_listener, &remote_events, &data);
|
||||
pw_remote_connect(data.remote);
|
||||
|
||||
pw_loop_enter(data.loop);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue