mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-18 07:00:06 -05:00
Cleanups
Only pass data to callbacks. Rename some structs Provide methods to access structs
This commit is contained in:
parent
1b79419554
commit
0602d76b9e
57 changed files with 716 additions and 422 deletions
|
|
@ -42,20 +42,20 @@ static inline void spa_graph_scheduler_init(struct spa_graph_scheduler *sched,
|
|||
sched->node = NULL;
|
||||
}
|
||||
|
||||
static inline int spa_graph_scheduler_input(struct spa_graph_node *node, void *user_data)
|
||||
static inline int spa_graph_scheduler_input(void *data)
|
||||
{
|
||||
struct spa_node *n = node->user_data;
|
||||
struct spa_node *n = data;
|
||||
return spa_node_process_input(n);
|
||||
}
|
||||
|
||||
static inline int spa_graph_scheduler_output(struct spa_graph_node *node, void *user_data)
|
||||
static inline int spa_graph_scheduler_output(void *data)
|
||||
{
|
||||
struct spa_node *n = node->user_data;
|
||||
struct spa_node *n = data;
|
||||
return spa_node_process_output(n);
|
||||
}
|
||||
|
||||
static const struct spa_graph_node_methods spa_graph_scheduler_default = {
|
||||
SPA_VERSION_GRAPH_NODE_METHODS,
|
||||
static const struct spa_graph_node_callbacks spa_graph_scheduler_default = {
|
||||
SPA_VERSION_GRAPH_NODE_CALLBACKS,
|
||||
spa_graph_scheduler_input,
|
||||
spa_graph_scheduler_output,
|
||||
};
|
||||
|
|
@ -96,7 +96,7 @@ static inline bool spa_graph_scheduler_iterate(struct spa_graph_scheduler *sched
|
|||
|
||||
switch (n->action) {
|
||||
case SPA_GRAPH_ACTION_IN:
|
||||
n->state = n->methods->process_input(n, n->user_data);
|
||||
n->state = n->callbacks->process_input(n->callbacks_data);
|
||||
debug("node %p processed input state %d\n", n, n->state);
|
||||
if (n == sched->node)
|
||||
break;
|
||||
|
|
@ -105,7 +105,7 @@ static inline bool spa_graph_scheduler_iterate(struct spa_graph_scheduler *sched
|
|||
break;
|
||||
|
||||
case SPA_GRAPH_ACTION_OUT:
|
||||
n->state = n->methods->process_output(n, n->user_data);
|
||||
n->state = n->callbacks->process_output(n->callbacks_data);
|
||||
debug("node %p processed output state %d\n", n, n->state);
|
||||
n->action = SPA_GRAPH_ACTION_CHECK;
|
||||
spa_list_insert(sched->ready.prev, &n->ready_link);
|
||||
|
|
|
|||
|
|
@ -38,35 +38,36 @@ static inline void spa_graph_scheduler_init(struct spa_graph_scheduler *sched,
|
|||
sched->node = NULL;
|
||||
}
|
||||
|
||||
static inline int spa_graph_node_scheduler_input(struct spa_graph_node *node, void *user_data)
|
||||
static inline int spa_graph_node_scheduler_input(void *data)
|
||||
{
|
||||
struct spa_node *n = node->user_data;
|
||||
struct spa_node *n = data;
|
||||
return spa_node_process_input(n);
|
||||
}
|
||||
|
||||
static inline int spa_graph_node_scheduler_output(struct spa_graph_node *node, void *user_data)
|
||||
static inline int spa_graph_node_scheduler_output(void *data)
|
||||
{
|
||||
struct spa_node *n = node->user_data;
|
||||
struct spa_node *n = data;
|
||||
return spa_node_process_output(n);
|
||||
}
|
||||
|
||||
|
||||
static const struct spa_graph_node_methods spa_graph_node_scheduler_default = {
|
||||
SPA_VERSION_GRAPH_NODE_METHODS,
|
||||
static const struct spa_graph_node_callbacks spa_graph_node_scheduler_default = {
|
||||
SPA_VERSION_GRAPH_NODE_CALLBACKS,
|
||||
spa_graph_node_scheduler_input,
|
||||
spa_graph_node_scheduler_output,
|
||||
};
|
||||
|
||||
static inline int spa_graph_port_scheduler_reuse_buffer(struct spa_graph_port *port,
|
||||
uint32_t buffer_id, void *user_data)
|
||||
static inline int spa_graph_port_scheduler_reuse_buffer(void *data,
|
||||
uint32_t buffer_id)
|
||||
{
|
||||
struct spa_graph_port *port = data;
|
||||
struct spa_node *node = port->node->callbacks_data;
|
||||
debug("port %p reuse buffer %d\n", port, buffer_id);
|
||||
struct spa_node *node = port->node->user_data;
|
||||
return spa_node_port_reuse_buffer(node, port->port_id, buffer_id);
|
||||
}
|
||||
|
||||
static const struct spa_graph_port_methods spa_graph_port_scheduler_default = {
|
||||
SPA_VERSION_GRAPH_PORT_METHODS,
|
||||
static const struct spa_graph_port_callbacks spa_graph_port_scheduler_default = {
|
||||
SPA_VERSION_GRAPH_PORT_CALLBACKS,
|
||||
spa_graph_port_scheduler_reuse_buffer,
|
||||
};
|
||||
|
||||
|
|
@ -96,7 +97,7 @@ static inline void spa_graph_scheduler_pull(struct spa_graph_scheduler *sched, s
|
|||
}
|
||||
|
||||
spa_list_for_each_safe(n, t, &ready, ready_link) {
|
||||
n->state = n->methods->process_output(n, n->user_data);
|
||||
n->state = n->callbacks->process_output(n->callbacks_data);
|
||||
debug("peer %p processed out %d\n", n, n->state);
|
||||
if (n->state == SPA_RESULT_NEED_BUFFER)
|
||||
spa_graph_scheduler_pull(sched, n);
|
||||
|
|
@ -113,7 +114,7 @@ static inline void spa_graph_scheduler_pull(struct spa_graph_scheduler *sched, s
|
|||
debug("node %p %d %d\n", node, node->ready_in, node->required_in);
|
||||
|
||||
if (node->required_in > 0 && node->ready_in == node->required_in) {
|
||||
node->state = node->methods->process_input(node, node->user_data);
|
||||
node->state = node->callbacks->process_input(node->callbacks_data);
|
||||
debug("node %p processed in %d\n", node, node->state);
|
||||
if (node->state == SPA_RESULT_HAVE_BUFFER) {
|
||||
spa_list_for_each(p, &node->ports[SPA_DIRECTION_OUTPUT], link) {
|
||||
|
|
@ -140,7 +141,7 @@ static inline void spa_graph_scheduler_chain(struct spa_graph_scheduler *sched,
|
|||
|
||||
|
||||
spa_list_for_each_safe(n, t, ready, ready_link) {
|
||||
n->state = n->methods->process_input(n, n->user_data);
|
||||
n->state = n->callbacks->process_input(n->callbacks_data);
|
||||
debug("node %p chain processed in %d\n", n, n->state);
|
||||
if (n->state == SPA_RESULT_HAVE_BUFFER)
|
||||
spa_graph_scheduler_push(sched, n);
|
||||
|
|
@ -183,7 +184,7 @@ static inline void spa_graph_scheduler_push(struct spa_graph_scheduler *sched, s
|
|||
|
||||
spa_graph_scheduler_chain(sched, &ready);
|
||||
|
||||
node->state = node->methods->process_output(node, node->user_data);
|
||||
node->state = node->callbacks->process_output(node->callbacks_data);
|
||||
debug("node %p processed out %d\n", node, node->state);
|
||||
if (node->state == SPA_RESULT_NEED_BUFFER) {
|
||||
node->ready_in = 0;
|
||||
|
|
|
|||
|
|
@ -44,19 +44,19 @@ struct spa_graph {
|
|||
struct spa_list nodes;
|
||||
};
|
||||
|
||||
struct spa_graph_node_methods {
|
||||
#define SPA_VERSION_GRAPH_NODE_METHODS 0
|
||||
struct spa_graph_node_callbacks {
|
||||
#define SPA_VERSION_GRAPH_NODE_CALLBACKS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*process_input) (struct spa_graph_node *node, void *user_data);
|
||||
int (*process_output) (struct spa_graph_node *node, void *user_data);
|
||||
int (*process_input) (void *data);
|
||||
int (*process_output) (void *data);
|
||||
};
|
||||
|
||||
struct spa_graph_port_methods {
|
||||
#define SPA_VERSION_GRAPH_PORT_METHODS 0
|
||||
struct spa_graph_port_callbacks {
|
||||
#define SPA_VERSION_GRAPH_PORT_CALLBACKS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*reuse_buffer) (struct spa_graph_port *port, uint32_t buffer_id, void *user_data);
|
||||
int (*reuse_buffer) (void *data, uint32_t buffer_id);
|
||||
};
|
||||
|
||||
struct spa_graph_node {
|
||||
|
|
@ -73,8 +73,8 @@ struct spa_graph_node {
|
|||
uint32_t max_in;
|
||||
uint32_t required_in;
|
||||
uint32_t ready_in;
|
||||
const struct spa_graph_node_methods *methods;
|
||||
void *user_data;
|
||||
const struct spa_graph_node_callbacks *callbacks;
|
||||
void *callbacks_data;
|
||||
};
|
||||
|
||||
struct spa_graph_port {
|
||||
|
|
@ -85,8 +85,8 @@ struct spa_graph_port {
|
|||
uint32_t flags;
|
||||
struct spa_port_io *io;
|
||||
struct spa_graph_port *peer;
|
||||
const struct spa_graph_port_methods *methods;
|
||||
void *user_data;
|
||||
const struct spa_graph_port_callbacks *callbacks;
|
||||
void *callbacks_data;
|
||||
};
|
||||
|
||||
static inline void spa_graph_init(struct spa_graph *graph)
|
||||
|
|
@ -105,12 +105,12 @@ spa_graph_node_init(struct spa_graph_node *node)
|
|||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_node_set_methods(struct spa_graph_node *node,
|
||||
const struct spa_graph_node_methods *methods,
|
||||
void *user_data)
|
||||
spa_graph_node_set_callbacks(struct spa_graph_node *node,
|
||||
const struct spa_graph_node_callbacks *callbacks,
|
||||
void *data)
|
||||
{
|
||||
node->methods = methods;
|
||||
node->user_data = user_data;
|
||||
node->callbacks = callbacks;
|
||||
node->callbacks_data = data;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
@ -139,12 +139,12 @@ spa_graph_port_init(struct spa_graph_port *port,
|
|||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_port_set_methods(struct spa_graph_port *port,
|
||||
const struct spa_graph_port_methods *methods,
|
||||
void *user_data)
|
||||
spa_graph_port_set_callbacks(struct spa_graph_port *port,
|
||||
const struct spa_graph_port_callbacks *callbacks,
|
||||
void *data)
|
||||
{
|
||||
port->methods = methods;
|
||||
port->user_data = user_data;
|
||||
port->callbacks = callbacks;
|
||||
port->callbacks_data = data;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ struct spa_monitor_callbacks {
|
|||
#define SPA_VERSION_MONITOR_CALLBACKS 0
|
||||
uint32_t version;
|
||||
|
||||
void (*event) (struct spa_monitor *monitor, struct spa_event *event, void *user_data);
|
||||
void (*event) (void *data, struct spa_event *event);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -145,7 +145,7 @@ struct spa_monitor {
|
|||
*/
|
||||
int (*set_callbacks) (struct spa_monitor *monitor,
|
||||
const struct spa_monitor_callbacks *callbacks,
|
||||
void *user_data);
|
||||
void *data);
|
||||
|
||||
int (*enum_items) (struct spa_monitor *monitor,
|
||||
struct spa_monitor_item **item, uint32_t index);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ struct spa_node_callbacks {
|
|||
uint32_t version; /**< version of this structure */
|
||||
|
||||
/** Emited when an async operation completed */
|
||||
void (*done) (struct spa_node *node, int seq, int res, void *user_data);
|
||||
void (*done) (void *data, int seq, int res);
|
||||
/**
|
||||
* struct spa_node_callbacks::event:
|
||||
* @node: a #struct spa_node
|
||||
|
|
@ -93,7 +93,7 @@ struct spa_node_callbacks {
|
|||
* This will be called when an out-of-bound event is notified
|
||||
* on @node. the callback can be called from any thread.
|
||||
*/
|
||||
void (*event) (struct spa_node *node, struct spa_event *event, void *user_data);
|
||||
void (*event) (void *data, struct spa_event *event);
|
||||
/**
|
||||
* struct spa_node_callbacks::need_input:
|
||||
* @node: a #struct spa_node
|
||||
|
|
@ -104,7 +104,7 @@ struct spa_node_callbacks {
|
|||
* When this function is NULL, synchronous operation is requested
|
||||
* on the input ports.
|
||||
*/
|
||||
void (*need_input) (struct spa_node *node, void *user_data);
|
||||
void (*need_input) (void *data);
|
||||
/**
|
||||
* struct spa_node_callbacks::have_output:
|
||||
* @node: a #struct spa_node
|
||||
|
|
@ -115,7 +115,7 @@ struct spa_node_callbacks {
|
|||
* When this function is NULL, synchronous operation is requested
|
||||
* on the output ports.
|
||||
*/
|
||||
void (*have_output) (struct spa_node *node, void *user_data);
|
||||
void (*have_output) (void *data);
|
||||
/**
|
||||
* struct spa_node_callbacks::reuse_buffer:
|
||||
* @node: a #struct spa_node
|
||||
|
|
@ -128,9 +128,9 @@ struct spa_node_callbacks {
|
|||
* When this function is NULL, the buffers to reuse will be set in
|
||||
* the io area or the input ports.
|
||||
*/
|
||||
void (*reuse_buffer) (struct spa_node *node,
|
||||
void (*reuse_buffer) (void *data,
|
||||
uint32_t port_id,
|
||||
uint32_t buffer_id, void *user_data);
|
||||
uint32_t buffer_id);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ struct impl {
|
|||
struct spa_loop *main_loop;
|
||||
|
||||
const struct spa_monitor_callbacks *callbacks;
|
||||
void *user_data;
|
||||
void *callbacks_data;
|
||||
|
||||
struct udev *udev;
|
||||
struct udev_monitor *umonitor;
|
||||
|
|
@ -350,7 +350,7 @@ static void impl_on_fd_events(struct spa_source *source)
|
|||
|
||||
spa_pod_builder_object(&b, &f[0], 0, type, SPA_POD_TYPE_POD, this->item);
|
||||
event = SPA_POD_BUILDER_DEREF(&b, f[0].ref, struct spa_event);
|
||||
this->callbacks->event(&this->monitor, event, this->user_data);
|
||||
this->callbacks->event(this->callbacks_data, event);
|
||||
}
|
||||
close_card(this);
|
||||
}
|
||||
|
|
@ -358,7 +358,7 @@ static void impl_on_fd_events(struct spa_source *source)
|
|||
static int
|
||||
impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
||||
const struct spa_monitor_callbacks *callbacks,
|
||||
void *user_data)
|
||||
void *data)
|
||||
{
|
||||
int res;
|
||||
struct impl *this;
|
||||
|
|
@ -368,7 +368,7 @@ impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
|||
this = SPA_CONTAINER_OF(monitor, struct impl, monitor);
|
||||
|
||||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
this->callbacks_data = data;
|
||||
|
||||
if (callbacks) {
|
||||
if ((res = impl_udev_open(this)) < 0)
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ static int do_send_done(struct spa_loop *loop, bool async, uint32_t seq, size_t
|
|||
{
|
||||
struct state *this = user_data;
|
||||
|
||||
this->callbacks->done(&this->node, seq, *(int*)data, this->user_data);
|
||||
this->callbacks->done(this->callbacks_data, seq, *(int*)data);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *user_data)
|
||||
void *data)
|
||||
{
|
||||
struct state *this;
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this = SPA_CONTAINER_OF(node, struct state, node);
|
||||
|
||||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
this->callbacks_data = data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ static int do_send_done(struct spa_loop *loop, bool async, uint32_t seq, size_t
|
|||
{
|
||||
struct state *this = user_data;
|
||||
|
||||
this->callbacks->done(&this->node, seq, *(int*)data, this->user_data);
|
||||
this->callbacks->done(this->callbacks_data, seq, *(int*)data);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *user_data)
|
||||
void *data)
|
||||
{
|
||||
struct state *this;
|
||||
|
||||
|
|
@ -180,7 +180,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this = SPA_CONTAINER_OF(node, struct state, node);
|
||||
|
||||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
this->callbacks_data = data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ pull_frames(struct state *state,
|
|||
io->range.offset = state->sample_count * state->frame_size;
|
||||
io->range.min_size = state->threshold * state->frame_size;
|
||||
io->range.max_size = frames * state->frame_size;
|
||||
state->callbacks->need_input(&state->node, state->user_data);
|
||||
state->callbacks->need_input(state->callbacks_data);
|
||||
}
|
||||
while (!spa_list_is_empty(&state->ready) && to_write > 0) {
|
||||
uint8_t *src, *dst;
|
||||
|
|
@ -373,10 +373,9 @@ pull_frames(struct state *state,
|
|||
b->outstanding = true;
|
||||
state->io->buffer_id = b->outbuf->id;
|
||||
spa_log_trace(state->log, "alsa-util %p: reuse buffer %u", state, b->outbuf->id);
|
||||
state->callbacks->reuse_buffer(&state->node,
|
||||
state->callbacks->reuse_buffer(state->callbacks_data,
|
||||
0,
|
||||
b->outbuf->id,
|
||||
state->user_data);
|
||||
b->outbuf->id);
|
||||
state->ready_offset = 0;
|
||||
}
|
||||
total_frames += n_frames;
|
||||
|
|
@ -432,7 +431,7 @@ push_frames(struct state *state,
|
|||
b->outstanding = true;
|
||||
io->buffer_id = b->outbuf->id;
|
||||
io->status = SPA_RESULT_HAVE_BUFFER;
|
||||
state->callbacks->have_output(&state->node, state->user_data);
|
||||
state->callbacks->have_output(state->callbacks_data);
|
||||
}
|
||||
}
|
||||
return total_frames;
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ struct state {
|
|||
snd_output_t *output;
|
||||
|
||||
const struct spa_node_callbacks *callbacks;
|
||||
void *user_data;
|
||||
void *callbacks_data;
|
||||
|
||||
uint8_t props_buffer[1024];
|
||||
struct props props;
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ struct impl {
|
|||
struct props props;
|
||||
|
||||
const struct spa_node_callbacks *callbacks;
|
||||
void *user_data;
|
||||
void *callbacks_data;
|
||||
|
||||
struct spa_source timer_source;
|
||||
struct itimerspec timerspec;
|
||||
|
|
@ -352,7 +352,7 @@ static void on_output(struct spa_source *source)
|
|||
res = make_buffer(this);
|
||||
|
||||
if (res == SPA_RESULT_HAVE_BUFFER)
|
||||
this->callbacks->have_output(&this->node, this->user_data);
|
||||
this->callbacks->have_output(this->callbacks_data);
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
|
|
@ -407,7 +407,7 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *user_data)
|
||||
void *data)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -420,7 +420,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
this->callbacks_data = data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ struct impl {
|
|||
struct props props;
|
||||
|
||||
const struct spa_node_callbacks *callbacks;
|
||||
void *user_data;
|
||||
void *callbacks_data;
|
||||
|
||||
struct spa_source timer_source;
|
||||
struct itimerspec timerspec;
|
||||
|
|
@ -226,7 +226,7 @@ static int consume_buffer(struct impl *this)
|
|||
if (spa_list_is_empty(&this->ready)) {
|
||||
io->status = SPA_RESULT_NEED_BUFFER;
|
||||
if (this->callbacks->need_input)
|
||||
this->callbacks->need_input(&this->node, this->user_data);
|
||||
this->callbacks->need_input(this->callbacks_data);
|
||||
}
|
||||
if (spa_list_is_empty(&this->ready)) {
|
||||
spa_log_error(this->log, NAME " %p: no buffers", this);
|
||||
|
|
@ -322,7 +322,7 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *user_data)
|
||||
void *data)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
this->callbacks_data = data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ struct impl {
|
|||
struct props props;
|
||||
|
||||
const struct spa_node_callbacks *callbacks;
|
||||
void *user_data;
|
||||
void *callbacks_data;
|
||||
|
||||
struct spa_source timer_source;
|
||||
struct itimerspec timerspec;
|
||||
|
|
@ -279,7 +279,7 @@ static void on_output(struct spa_source *source)
|
|||
res = make_buffer(this);
|
||||
|
||||
if (res == SPA_RESULT_HAVE_BUFFER && this->callbacks && this->callbacks->have_output)
|
||||
this->callbacks->have_output(&this->node, this->user_data);
|
||||
this->callbacks->have_output(this->callbacks_data);
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
|
|
@ -334,7 +334,7 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *user_data)
|
||||
void *data)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -347,7 +347,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
this->callbacks_data = data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ struct impl {
|
|||
struct spa_loop *main_loop;
|
||||
|
||||
const struct spa_monitor_callbacks *callbacks;
|
||||
void *user_data;
|
||||
void *callbacks_data;
|
||||
|
||||
struct udev *udev;
|
||||
struct udev_monitor *umonitor;
|
||||
|
|
@ -231,13 +231,13 @@ static void impl_on_fd_events(struct spa_source *source)
|
|||
spa_pod_builder_object(&b, &f[0], 0, type, SPA_POD_TYPE_POD, this->uitem.item);
|
||||
|
||||
event = SPA_POD_BUILDER_DEREF(&b, f[0].ref, struct spa_event);
|
||||
this->callbacks->event(&this->monitor, event, this->user_data);
|
||||
this->callbacks->event(this->callbacks_data, event);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
||||
const struct spa_monitor_callbacks *callbacks,
|
||||
void *user_data)
|
||||
void *data)
|
||||
{
|
||||
int res;
|
||||
struct impl *this;
|
||||
|
|
@ -247,7 +247,7 @@ impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
|||
this = SPA_CONTAINER_OF(monitor, struct impl, monitor);
|
||||
|
||||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
this->callbacks_data = data;
|
||||
if (callbacks) {
|
||||
if ((res = impl_udev_open(this)) < 0)
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ struct impl {
|
|||
struct props props;
|
||||
|
||||
const struct spa_node_callbacks *callbacks;
|
||||
void *user_data;
|
||||
void *callbacks_data;
|
||||
|
||||
struct port out_ports[1];
|
||||
};
|
||||
|
|
@ -237,7 +237,7 @@ static int do_pause_done(struct spa_loop *loop,
|
|||
if (SPA_RESULT_IS_OK(res))
|
||||
res = spa_v4l2_stream_off(this);
|
||||
|
||||
this->callbacks->done(&this->node, seq, res, this->user_data);
|
||||
this->callbacks->done(this->callbacks_data, seq, res);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -277,7 +277,7 @@ static int do_start_done(struct spa_loop *loop,
|
|||
struct impl *this = user_data;
|
||||
int res = *(int*)data;
|
||||
|
||||
this->callbacks->done(&this->node, seq, res, this->user_data);
|
||||
this->callbacks->done(this->callbacks_data, seq, res);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -360,7 +360,7 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
|
||||
static int impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *user_data)
|
||||
void *data)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -369,7 +369,7 @@ static int impl_node_set_callbacks(struct spa_node *node,
|
|||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
this->callbacks_data = data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -934,7 +934,7 @@ static int mmap_read(struct impl *this)
|
|||
b->outstanding = true;
|
||||
io->buffer_id = b->outbuf->id;
|
||||
io->status = SPA_RESULT_HAVE_BUFFER;
|
||||
this->callbacks->have_output(&this->node, this->user_data);
|
||||
this->callbacks->have_output(this->callbacks_data);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ struct impl {
|
|||
struct props props;
|
||||
|
||||
const struct spa_node_callbacks *callbacks;
|
||||
void *user_data;
|
||||
void *callbacks_data;
|
||||
|
||||
struct spa_source timer_source;
|
||||
struct itimerspec timerspec;
|
||||
|
|
@ -303,7 +303,7 @@ static void on_output(struct spa_source *source)
|
|||
res = make_buffer(this);
|
||||
|
||||
if (res == SPA_RESULT_HAVE_BUFFER)
|
||||
this->callbacks->have_output(&this->node, this->user_data);
|
||||
this->callbacks->have_output(this->callbacks_data);
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
|
|
@ -358,7 +358,7 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *user_data)
|
||||
void *data)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -371,7 +371,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
this->callbacks_data = data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ struct impl {
|
|||
struct props props;
|
||||
|
||||
const struct spa_node_callbacks *callbacks;
|
||||
void *user_data;
|
||||
void *callbacks_data;
|
||||
|
||||
uint8_t format_buffer[1024];
|
||||
struct spa_audio_info current_format;
|
||||
|
|
@ -210,7 +210,7 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *user_data)
|
||||
void *data)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
this->callbacks_data = data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -649,7 +649,7 @@ static struct spa_buffer *find_free_buffer(struct impl *this, struct port *port)
|
|||
static inline void release_buffer(struct impl *this, struct spa_buffer *buffer)
|
||||
{
|
||||
if (this->callbacks && this->callbacks->reuse_buffer)
|
||||
this->callbacks->reuse_buffer(&this->node, 0, buffer->id, this->user_data);
|
||||
this->callbacks->reuse_buffer(this->callbacks_data, 0, buffer->id);
|
||||
}
|
||||
|
||||
static void do_volume(struct impl *this, struct spa_buffer *dbuf, struct spa_buffer *sbuf)
|
||||
|
|
|
|||
|
|
@ -217,19 +217,19 @@ static int make_node(struct data *data, struct spa_node **node, const char *lib,
|
|||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
|
||||
static void on_sink_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||
static void on_sink_done(void *data, int seq, int res)
|
||||
{
|
||||
printf("got done %d %d\n", seq, res);
|
||||
}
|
||||
|
||||
static void on_sink_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||
static void on_sink_event(void *data, struct spa_event *event)
|
||||
{
|
||||
printf("got event %d\n", SPA_EVENT_TYPE(event));
|
||||
}
|
||||
|
||||
static void on_sink_need_input(struct spa_node *node, void *user_data)
|
||||
static void on_sink_need_input(void *_data)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
|
||||
spa_graph_scheduler_pull(&data->sched, &data->sink_node);
|
||||
|
||||
|
|
@ -237,20 +237,19 @@ static void on_sink_need_input(struct spa_node *node, void *user_data)
|
|||
}
|
||||
|
||||
static void
|
||||
on_sink_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id, void *user_data)
|
||||
on_sink_reuse_buffer(void *_data, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
|
||||
data->volume_sink_io[0].buffer_id = buffer_id;
|
||||
}
|
||||
|
||||
static const struct spa_node_callbacks sink_callbacks = {
|
||||
SPA_VERSION_NODE_CALLBACKS,
|
||||
&on_sink_done,
|
||||
&on_sink_event,
|
||||
&on_sink_need_input,
|
||||
NULL,
|
||||
&on_sink_reuse_buffer
|
||||
.done = on_sink_done,
|
||||
.event = on_sink_event,
|
||||
.need_input = on_sink_need_input,
|
||||
.reuse_buffer = on_sink_reuse_buffer
|
||||
};
|
||||
|
||||
static int do_add_source(struct spa_loop *loop, struct spa_source *source)
|
||||
|
|
@ -341,13 +340,13 @@ static int make_nodes(struct data *data, const char *device)
|
|||
spa_node_port_set_io(data->sink, SPA_DIRECTION_INPUT, 0, &data->volume_sink_io[0]);
|
||||
|
||||
spa_graph_node_init(&data->source_node);
|
||||
spa_graph_node_set_methods(&data->source_node, &spa_graph_scheduler_default, data->source);
|
||||
spa_graph_node_set_callbacks(&data->source_node, &spa_graph_scheduler_default, data->source);
|
||||
spa_graph_node_add(&data->graph, &data->source_node);
|
||||
spa_graph_port_init(&data->source_out, SPA_DIRECTION_OUTPUT, 0, 0, &data->source_volume_io[0]);
|
||||
spa_graph_port_add(&data->source_node, &data->source_out);
|
||||
|
||||
spa_graph_node_init(&data->volume_node);
|
||||
spa_graph_node_set_methods(&data->volume_node, &spa_graph_scheduler_default, data->volume);
|
||||
spa_graph_node_set_callbacks(&data->volume_node, &spa_graph_scheduler_default, data->volume);
|
||||
spa_graph_node_add(&data->graph, &data->volume_node);
|
||||
spa_graph_port_init(&data->volume_in, SPA_DIRECTION_INPUT, 0, 0, &data->source_volume_io[0]);
|
||||
spa_graph_port_add(&data->volume_node, &data->volume_in);
|
||||
|
|
@ -358,7 +357,7 @@ static int make_nodes(struct data *data, const char *device)
|
|||
spa_graph_port_add(&data->volume_node, &data->volume_out);
|
||||
|
||||
spa_graph_node_init(&data->sink_node);
|
||||
spa_graph_node_set_methods(&data->sink_node, &spa_graph_scheduler_default, data->sink);
|
||||
spa_graph_node_set_callbacks(&data->sink_node, &spa_graph_scheduler_default, data->sink);
|
||||
spa_graph_node_add(&data->graph, &data->sink_node);
|
||||
spa_graph_port_init(&data->sink_in, SPA_DIRECTION_INPUT, 0, 0, &data->volume_sink_io[0]);
|
||||
spa_graph_port_add(&data->sink_node, &data->sink_in);
|
||||
|
|
|
|||
|
|
@ -228,19 +228,19 @@ static int make_node(struct data *data, struct spa_node **node, const char *lib,
|
|||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
|
||||
static void on_sink_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||
static void on_sink_done(void *data, int seq, int res)
|
||||
{
|
||||
printf("got done %d %d\n", seq, res);
|
||||
}
|
||||
|
||||
static void on_sink_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||
static void on_sink_event(void *data, struct spa_event *event)
|
||||
{
|
||||
printf("got event %d\n", SPA_EVENT_TYPE(event));
|
||||
}
|
||||
|
||||
static void on_sink_need_input(struct spa_node *node, void *user_data)
|
||||
static void on_sink_need_input(void *_data)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
#ifdef USE_GRAPH
|
||||
spa_graph_scheduler_pull(&data->sched, &data->sink_node);
|
||||
while (spa_graph_scheduler_iterate(&data->sched));
|
||||
|
|
@ -279,23 +279,20 @@ static void on_sink_need_input(struct spa_node *node, void *user_data)
|
|||
}
|
||||
|
||||
static void
|
||||
on_sink_reuse_buffer(struct spa_node *node,
|
||||
on_sink_reuse_buffer(void *_data,
|
||||
uint32_t port_id,
|
||||
uint32_t buffer_id,
|
||||
void *user_data)
|
||||
uint32_t buffer_id)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
|
||||
struct data *data = _data;
|
||||
data->mix_sink_io[0].buffer_id = buffer_id;
|
||||
}
|
||||
|
||||
static const struct spa_node_callbacks sink_callbacks = {
|
||||
SPA_VERSION_NODE_CALLBACKS,
|
||||
&on_sink_done,
|
||||
&on_sink_event,
|
||||
&on_sink_need_input,
|
||||
NULL,
|
||||
&on_sink_reuse_buffer
|
||||
.done = on_sink_done,
|
||||
.event = on_sink_event,
|
||||
.need_input = &on_sink_need_input,
|
||||
.reuse_buffer = on_sink_reuse_buffer
|
||||
};
|
||||
|
||||
static int do_add_source(struct spa_loop *loop, struct spa_source *source)
|
||||
|
|
@ -419,19 +416,19 @@ static int make_nodes(struct data *data, const char *device)
|
|||
|
||||
#ifdef USE_GRAPH
|
||||
spa_graph_node_init(&data->source1_node);
|
||||
spa_graph_node_set_methods(&data->source1_node, &spa_graph_scheduler_default, data->source1);
|
||||
spa_graph_node_set_callbacks(&data->source1_node, &spa_graph_scheduler_default, data->source1);
|
||||
spa_graph_port_init(&data->source1_out, SPA_DIRECTION_OUTPUT, 0, 0, &data->source1_mix_io[0]);
|
||||
spa_graph_port_add(&data->source1_node, &data->source1_out);
|
||||
spa_graph_node_add(&data->graph, &data->source1_node);
|
||||
|
||||
spa_graph_node_init(&data->source2_node);
|
||||
spa_graph_node_set_methods(&data->source2_node, &spa_graph_scheduler_default, data->source2);
|
||||
spa_graph_node_set_callbacks(&data->source2_node, &spa_graph_scheduler_default, data->source2);
|
||||
spa_graph_port_init(&data->source2_out, SPA_DIRECTION_OUTPUT, 0, 0, &data->source2_mix_io[0]);
|
||||
spa_graph_port_add(&data->source2_node, &data->source2_out);
|
||||
spa_graph_node_add(&data->graph, &data->source2_node);
|
||||
|
||||
spa_graph_node_init(&data->mix_node);
|
||||
spa_graph_node_set_methods(&data->mix_node, &spa_graph_scheduler_default, data->mix);
|
||||
spa_graph_node_set_callbacks(&data->mix_node, &spa_graph_scheduler_default, data->mix);
|
||||
spa_graph_port_init(&data->mix_in[0], SPA_DIRECTION_INPUT,
|
||||
data->mix_ports[0], 0, &data->source1_mix_io[0]);
|
||||
spa_graph_port_add(&data->mix_node, &data->mix_in[0]);
|
||||
|
|
@ -447,7 +444,7 @@ static int make_nodes(struct data *data, const char *device)
|
|||
spa_graph_port_add(&data->mix_node, &data->mix_out);
|
||||
|
||||
spa_graph_node_init(&data->sink_node);
|
||||
spa_graph_node_set_methods(&data->sink_node, &spa_graph_scheduler_default, data->sink);
|
||||
spa_graph_node_set_callbacks(&data->sink_node, &spa_graph_scheduler_default, data->sink);
|
||||
spa_graph_port_init(&data->sink_in, SPA_DIRECTION_INPUT, 0, 0, &data->mix_sink_io[0]);
|
||||
spa_graph_port_add(&data->sink_node, &data->sink_in);
|
||||
spa_graph_node_add(&data->graph, &data->sink_node);
|
||||
|
|
|
|||
|
|
@ -242,21 +242,21 @@ static void on_source_push(struct data *data)
|
|||
}
|
||||
}
|
||||
|
||||
static void on_sink_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||
static void on_sink_done(void *_data, int seq, int res)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
spa_log_trace(data->log, "got sink done %d %d", seq, res);
|
||||
}
|
||||
|
||||
static void on_sink_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||
static void on_sink_event(void *_data, struct spa_event *event)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
spa_log_trace(data->log, "got sink event %d", SPA_EVENT_TYPE(event));
|
||||
}
|
||||
|
||||
static void on_sink_need_input(struct spa_node *node, void *user_data)
|
||||
static void on_sink_need_input(void *_data)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
spa_log_trace(data->log, "need input");
|
||||
on_sink_pull(data);
|
||||
if (--data->iterations == 0)
|
||||
|
|
@ -264,37 +264,36 @@ static void on_sink_need_input(struct spa_node *node, void *user_data)
|
|||
}
|
||||
|
||||
static void
|
||||
on_sink_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id, void *user_data)
|
||||
on_sink_reuse_buffer(void *_data, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
|
||||
data->source_sink_io[0].buffer_id = buffer_id;
|
||||
}
|
||||
|
||||
static const struct spa_node_callbacks sink_callbacks = {
|
||||
SPA_VERSION_NODE_CALLBACKS,
|
||||
&on_sink_done,
|
||||
&on_sink_event,
|
||||
&on_sink_need_input,
|
||||
NULL,
|
||||
&on_sink_reuse_buffer
|
||||
.done = on_sink_done,
|
||||
.event = on_sink_event,
|
||||
.need_input = on_sink_need_input,
|
||||
.reuse_buffer = on_sink_reuse_buffer
|
||||
};
|
||||
|
||||
static void on_source_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||
static void on_source_done(void *_data, int seq, int res)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
spa_log_trace(data->log, "got source done %d %d", seq, res);
|
||||
}
|
||||
|
||||
static void on_source_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||
static void on_source_event(void *_data, struct spa_event *event)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
spa_log_trace(data->log, "got source event %d", SPA_EVENT_TYPE(event));
|
||||
}
|
||||
|
||||
static void on_source_have_output(struct spa_node *node, void *user_data)
|
||||
static void on_source_have_output(void *_data)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
spa_log_trace(data->log, "have_output");
|
||||
on_source_push(data);
|
||||
if (--data->iterations == 0)
|
||||
|
|
@ -303,11 +302,9 @@ static void on_source_have_output(struct spa_node *node, void *user_data)
|
|||
|
||||
static const struct spa_node_callbacks source_callbacks = {
|
||||
SPA_VERSION_NODE_CALLBACKS,
|
||||
&on_source_done,
|
||||
&on_source_event,
|
||||
NULL,
|
||||
&on_source_have_output,
|
||||
NULL
|
||||
.done = on_source_done,
|
||||
.event = on_source_event,
|
||||
.have_output = on_source_have_output
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -367,7 +364,7 @@ static int make_nodes(struct data *data)
|
|||
spa_node_port_set_io(data->sink, SPA_DIRECTION_INPUT, 0, &data->source_sink_io[0]);
|
||||
|
||||
spa_graph_node_init(&data->source_node);
|
||||
spa_graph_node_set_methods(&data->source_node, &spa_graph_scheduler_default, data->source);
|
||||
spa_graph_node_set_callbacks(&data->source_node, &spa_graph_scheduler_default, data->source);
|
||||
spa_graph_node_add(&data->graph, &data->source_node);
|
||||
|
||||
data->source_node.flags = (data->mode & MODE_ASYNC_PUSH) ? SPA_GRAPH_NODE_FLAG_ASYNC : 0;
|
||||
|
|
@ -375,7 +372,7 @@ static int make_nodes(struct data *data)
|
|||
spa_graph_port_add(&data->source_node, &data->source_out);
|
||||
|
||||
spa_graph_node_init(&data->sink_node);
|
||||
spa_graph_node_set_methods(&data->sink_node, &spa_graph_scheduler_default, data->sink);
|
||||
spa_graph_node_set_callbacks(&data->sink_node, &spa_graph_scheduler_default, data->sink);
|
||||
spa_graph_node_add(&data->graph, &data->sink_node);
|
||||
|
||||
data->sink_node.flags = (data->mode & MODE_ASYNC_PULL) ? SPA_GRAPH_NODE_FLAG_ASYNC : 0;
|
||||
|
|
|
|||
|
|
@ -205,19 +205,19 @@ static int make_node(struct data *data, struct spa_node **node, const char *lib,
|
|||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
|
||||
static void on_sink_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||
static void on_sink_done(void *data, int seq, int res)
|
||||
{
|
||||
printf("got done %d %d\n", seq, res);
|
||||
}
|
||||
|
||||
static void on_sink_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||
static void on_sink_event(void *data, struct spa_event *event)
|
||||
{
|
||||
printf("got event %d\n", SPA_EVENT_TYPE(event));
|
||||
}
|
||||
|
||||
static void on_sink_need_input(struct spa_node *node, void *user_data)
|
||||
static void on_sink_need_input(void *_data)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
int res;
|
||||
|
||||
res = spa_node_process_output(data->source);
|
||||
|
|
@ -229,22 +229,20 @@ static void on_sink_need_input(struct spa_node *node, void *user_data)
|
|||
}
|
||||
|
||||
static void
|
||||
on_sink_reuse_buffer(struct spa_node *node,
|
||||
on_sink_reuse_buffer(void *_data,
|
||||
uint32_t port_id,
|
||||
uint32_t buffer_id,
|
||||
void *user_data)
|
||||
uint32_t buffer_id)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
data->source_sink_io[0].buffer_id = buffer_id;
|
||||
}
|
||||
|
||||
static const struct spa_node_callbacks sink_callbacks = {
|
||||
SPA_VERSION_NODE_CALLBACKS,
|
||||
&on_sink_done,
|
||||
&on_sink_event,
|
||||
&on_sink_need_input,
|
||||
NULL,
|
||||
&on_sink_reuse_buffer
|
||||
.done = on_sink_done,
|
||||
.event = on_sink_event,
|
||||
.need_input = on_sink_need_input,
|
||||
.reuse_buffer = on_sink_reuse_buffer
|
||||
};
|
||||
|
||||
static int do_add_source(struct spa_loop *loop, struct spa_source *source)
|
||||
|
|
|
|||
|
|
@ -176,23 +176,23 @@ static void handle_events(struct data *data)
|
|||
}
|
||||
}
|
||||
|
||||
static void on_source_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||
static void on_source_done(void *data, int seq, int res)
|
||||
{
|
||||
printf("got done %d %d\n", seq, res);
|
||||
}
|
||||
|
||||
static void on_source_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||
static void on_source_event(void *_data, struct spa_event *event)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
|
||||
handle_events(data);
|
||||
|
||||
printf("got event %d\n", SPA_EVENT_TYPE(event));
|
||||
}
|
||||
|
||||
static void on_source_have_output(struct spa_node *node, void *user_data)
|
||||
static void on_source_have_output(void *_data)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
int res;
|
||||
struct spa_buffer *b;
|
||||
void *sdata, *ddata;
|
||||
|
|
@ -262,11 +262,9 @@ static void on_source_have_output(struct spa_node *node, void *user_data)
|
|||
|
||||
static const struct spa_node_callbacks source_callbacks = {
|
||||
SPA_VERSION_NODE_CALLBACKS,
|
||||
&on_source_done,
|
||||
&on_source_event,
|
||||
NULL,
|
||||
&on_source_have_output,
|
||||
NULL
|
||||
.done = on_source_done,
|
||||
.event = on_source_event,
|
||||
.have_output = on_source_have_output
|
||||
};
|
||||
|
||||
static int do_add_source(struct spa_loop *loop, struct spa_source *source)
|
||||
|
|
|
|||
|
|
@ -63,10 +63,9 @@ static void inspect_item(struct data *data, struct spa_monitor_item *item)
|
|||
spa_debug_pod(&item->object.pod);
|
||||
}
|
||||
|
||||
static void on_monitor_event(struct spa_monitor *monitor,
|
||||
struct spa_event *event, void *user_data)
|
||||
static void on_monitor_event(void *_data, struct spa_event *event)
|
||||
{
|
||||
struct data *data = user_data;
|
||||
struct data *data = _data;
|
||||
|
||||
if (SPA_EVENT_TYPE(event) == data->type.monitor.Added) {
|
||||
fprintf(stderr, "added:\n");
|
||||
|
|
@ -102,7 +101,7 @@ static void do_remove_source(struct spa_source *source)
|
|||
|
||||
static const struct spa_monitor_callbacks impl_callbacks = {
|
||||
SPA_VERSION_MONITOR_CALLBACKS,
|
||||
on_monitor_event,
|
||||
.event = on_monitor_event,
|
||||
};
|
||||
|
||||
static void handle_monitor(struct data *data, struct spa_monitor *monitor)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue