mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
Add user_data to callbacks
Add user data to callbacks, it's more flexible and natural
This commit is contained in:
parent
59ec32c039
commit
763bd1100e
27 changed files with 156 additions and 165 deletions
|
|
@ -48,7 +48,6 @@ struct impl {
|
||||||
void *hnd;
|
void *hnd;
|
||||||
|
|
||||||
struct spa_list item_list;
|
struct spa_list item_list;
|
||||||
struct spa_monitor_callbacks callbacks;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void add_item(struct pw_spa_monitor *this, struct spa_monitor_item *item)
|
static void add_item(struct pw_spa_monitor *this, struct spa_monitor_item *item)
|
||||||
|
|
@ -150,10 +149,9 @@ static void remove_item(struct pw_spa_monitor *this, struct spa_monitor_item *it
|
||||||
destroy_item(mitem);
|
destroy_item(mitem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_monitor_event(const struct spa_monitor_callbacks *callbacks,
|
static void on_monitor_event(struct spa_monitor *monitor, struct spa_event *event, void *user_data)
|
||||||
struct spa_monitor *monitor, struct spa_event *event)
|
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(callbacks, struct impl, callbacks);
|
struct impl *impl = user_data;
|
||||||
struct pw_spa_monitor *this = &impl->this;
|
struct pw_spa_monitor *this = &impl->this;
|
||||||
|
|
||||||
if (SPA_EVENT_TYPE(event) == impl->core->type.monitor.Added) {
|
if (SPA_EVENT_TYPE(event) == impl->core->type.monitor.Added) {
|
||||||
|
|
@ -272,8 +270,7 @@ struct pw_spa_monitor *pw_spa_monitor_load(struct pw_core *core,
|
||||||
}
|
}
|
||||||
add_item(this, item);
|
add_item(this, item);
|
||||||
}
|
}
|
||||||
impl->callbacks = callbacks;
|
spa_monitor_set_callbacks(this->monitor, &callbacks, impl);
|
||||||
spa_monitor_set_callbacks(this->monitor, &impl->callbacks);
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ struct proxy {
|
||||||
struct spa_loop *data_loop;
|
struct spa_loop *data_loop;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
struct pw_resource *resource;
|
struct pw_resource *resource;
|
||||||
|
|
||||||
|
|
@ -209,7 +210,8 @@ static int spa_proxy_node_send_command(struct spa_node *node, struct spa_command
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spa_proxy_node_set_callbacks(struct spa_node *node,
|
spa_proxy_node_set_callbacks(struct spa_node *node,
|
||||||
const struct spa_node_callbacks *callbacks)
|
const struct spa_node_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct proxy *this;
|
struct proxy *this;
|
||||||
|
|
||||||
|
|
@ -218,6 +220,7 @@ spa_proxy_node_set_callbacks(struct spa_node *node,
|
||||||
|
|
||||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -847,14 +850,14 @@ static int handle_node_event(struct proxy *this, struct spa_event *event)
|
||||||
*io = impl->transport->outputs[i];
|
*io = impl->transport->outputs[i];
|
||||||
pw_log_trace("%d %d", io->status, io->buffer_id);
|
pw_log_trace("%d %d", io->status, io->buffer_id);
|
||||||
}
|
}
|
||||||
this->callbacks->have_output(this->callbacks, &this->node);
|
this->callbacks->have_output(&this->node, this->user_data);
|
||||||
} else if (SPA_EVENT_TYPE(event) == impl->core->type.event_transport.NeedInput) {
|
} else if (SPA_EVENT_TYPE(event) == impl->core->type.event_transport.NeedInput) {
|
||||||
this->callbacks->need_input(this->callbacks, &this->node);
|
this->callbacks->need_input(&this->node, this->user_data);
|
||||||
} else if (SPA_EVENT_TYPE(event) == impl->core->type.event_transport.ReuseBuffer) {
|
} else if (SPA_EVENT_TYPE(event) == impl->core->type.event_transport.ReuseBuffer) {
|
||||||
struct pw_event_transport_reuse_buffer *p =
|
struct pw_event_transport_reuse_buffer *p =
|
||||||
(struct pw_event_transport_reuse_buffer *) event;
|
(struct pw_event_transport_reuse_buffer *) event;
|
||||||
this->callbacks->reuse_buffer(this->callbacks, &this->node, p->body.port_id.value,
|
this->callbacks->reuse_buffer(&this->node, p->body.port_id.value,
|
||||||
p->body.buffer_id.value);
|
p->body.buffer_id.value, this->user_data);
|
||||||
}
|
}
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -867,7 +870,7 @@ client_node_done(void *object, int seq, int res)
|
||||||
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
||||||
struct proxy *this = &impl->proxy;
|
struct proxy *this = &impl->proxy;
|
||||||
|
|
||||||
this->callbacks->done(this->callbacks, &this->node, seq, res);
|
this->callbacks->done(&this->node, seq, res, this->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -933,7 +936,7 @@ static void client_node_event(void *object, struct spa_event *event)
|
||||||
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
||||||
struct proxy *this = &impl->proxy;
|
struct proxy *this = &impl->proxy;
|
||||||
|
|
||||||
this->callbacks->event(this->callbacks, &this->node, event);
|
this->callbacks->event(&this->node, event, this->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void client_node_destroy(void *object)
|
static void client_node_destroy(void *object)
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ struct impl {
|
||||||
struct pw_work_queue *work;
|
struct pw_work_queue *work;
|
||||||
|
|
||||||
bool async_init;
|
bool async_init;
|
||||||
struct spa_node_callbacks callbacks;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \endcond */
|
/** \endcond */
|
||||||
|
|
@ -314,10 +313,9 @@ static int do_pull(struct pw_node *this)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_node_done(const struct spa_node_callbacks *callbacks,
|
static void on_node_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||||
struct spa_node *node, int seq, int res)
|
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(callbacks, struct impl, callbacks);
|
struct impl *impl = user_data;
|
||||||
struct pw_node *this = &impl->this;
|
struct pw_node *this = &impl->this;
|
||||||
|
|
||||||
pw_log_debug("node %p: async complete event %d %d", this, seq, res);
|
pw_log_debug("node %p: async complete event %d %d", this, seq, res);
|
||||||
|
|
@ -325,10 +323,9 @@ static void on_node_done(const struct spa_node_callbacks *callbacks,
|
||||||
pw_signal_emit(&this->async_complete, this, seq, res);
|
pw_signal_emit(&this->async_complete, this, seq, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_node_event(const struct spa_node_callbacks *callbacks,
|
static void on_node_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||||
struct spa_node *node, struct spa_event *event)
|
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(callbacks, struct impl, callbacks);
|
struct impl *impl = user_data;
|
||||||
struct pw_node *this = &impl->this;
|
struct pw_node *this = &impl->this;
|
||||||
|
|
||||||
if (SPA_EVENT_TYPE(event) == this->core->type.event_node.RequestClockUpdate) {
|
if (SPA_EVENT_TYPE(event) == this->core->type.event_node.RequestClockUpdate) {
|
||||||
|
|
@ -336,19 +333,17 @@ static void on_node_event(const struct spa_node_callbacks *callbacks,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_node_need_input(const struct spa_node_callbacks *callbacks,
|
static void on_node_need_input(struct spa_node *node, void *user_data)
|
||||||
struct spa_node *node)
|
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(callbacks, struct impl, callbacks);
|
struct impl *impl = user_data;
|
||||||
struct pw_node *this = &impl->this;
|
struct pw_node *this = &impl->this;
|
||||||
|
|
||||||
do_pull(this);
|
do_pull(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_node_have_output(const struct spa_node_callbacks *callbacks,
|
static void on_node_have_output(struct spa_node *node, void *user_data)
|
||||||
struct spa_node *node)
|
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(callbacks, struct impl, callbacks);
|
struct impl *impl = user_data;
|
||||||
struct pw_node *this = &impl->this;
|
struct pw_node *this = &impl->this;
|
||||||
int res;
|
int res;
|
||||||
struct pw_port *outport;
|
struct pw_port *outport;
|
||||||
|
|
@ -384,10 +379,9 @@ static void on_node_have_output(const struct spa_node_callbacks *callbacks,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_node_reuse_buffer(const struct spa_node_callbacks *callbacks,
|
on_node_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id, void *user_data)
|
||||||
struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(callbacks, struct impl, callbacks);
|
struct impl *impl = user_data;
|
||||||
struct pw_node *this = &impl->this;
|
struct pw_node *this = &impl->this;
|
||||||
struct pw_port *inport;
|
struct pw_port *inport;
|
||||||
|
|
||||||
|
|
@ -560,8 +554,7 @@ struct pw_node *pw_node_new(struct pw_core *core,
|
||||||
|
|
||||||
spa_list_init(&this->resource_list);
|
spa_list_init(&this->resource_list);
|
||||||
|
|
||||||
impl->callbacks = node_callbacks;
|
if (spa_node_set_callbacks(this->node, &node_callbacks, impl) < 0)
|
||||||
if (spa_node_set_callbacks(this->node, &impl->callbacks) < 0)
|
|
||||||
pw_log_warn("node %p: error setting callback", this);
|
pw_log_warn("node %p: error setting callback", this);
|
||||||
|
|
||||||
pw_signal_init(&this->destroy_signal);
|
pw_signal_init(&this->destroy_signal);
|
||||||
|
|
|
||||||
|
|
@ -112,9 +112,7 @@ enum spa_monitor_item_state {
|
||||||
struct spa_monitor_callbacks {
|
struct spa_monitor_callbacks {
|
||||||
uint32_t version; /**< version of the structure */
|
uint32_t version; /**< version of the structure */
|
||||||
|
|
||||||
void (*event) (const struct spa_monitor_callbacks *callbacks,
|
void (*event) (struct spa_monitor *monitor, struct spa_event *event, void *user_data);
|
||||||
struct spa_monitor *monitor,
|
|
||||||
struct spa_event *event);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SPA_VERSION_MONITOR 0
|
#define SPA_VERSION_MONITOR 0
|
||||||
|
|
@ -147,7 +145,8 @@ struct spa_monitor {
|
||||||
* Returns: #SPA_RESULT_OK on success
|
* Returns: #SPA_RESULT_OK on success
|
||||||
*/
|
*/
|
||||||
int (*set_callbacks) (struct spa_monitor *monitor,
|
int (*set_callbacks) (struct spa_monitor *monitor,
|
||||||
const struct spa_monitor_callbacks *callbacks);
|
const struct spa_monitor_callbacks *callbacks,
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
int (*enum_items) (struct spa_monitor *monitor,
|
int (*enum_items) (struct spa_monitor *monitor,
|
||||||
struct spa_monitor_item **item, uint32_t index);
|
struct spa_monitor_item **item, uint32_t index);
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,7 @@ struct spa_node_callbacks {
|
||||||
uint32_t version; /**< version of this structure */
|
uint32_t version; /**< version of this structure */
|
||||||
|
|
||||||
/** Emited when an async operation completed */
|
/** Emited when an async operation completed */
|
||||||
void (*done) (const struct spa_node_callbacks *callbacks,
|
void (*done) (struct spa_node *node, int seq, int res, void *user_data);
|
||||||
struct spa_node *node, int seq, int res);
|
|
||||||
/**
|
/**
|
||||||
* struct spa_node_callbacks::event:
|
* struct spa_node_callbacks::event:
|
||||||
* @node: a #struct spa_node
|
* @node: a #struct spa_node
|
||||||
|
|
@ -94,8 +93,7 @@ struct spa_node_callbacks {
|
||||||
* This will be called when an out-of-bound event is notified
|
* This will be called when an out-of-bound event is notified
|
||||||
* on @node. the callback can be called from any thread.
|
* on @node. the callback can be called from any thread.
|
||||||
*/
|
*/
|
||||||
void (*event) (const struct spa_node_callbacks *callbacks,
|
void (*event) (struct spa_node *node, struct spa_event *event, void *user_data);
|
||||||
struct spa_node *node, struct spa_event *event);
|
|
||||||
/**
|
/**
|
||||||
* struct spa_node_callbacks::need_input:
|
* struct spa_node_callbacks::need_input:
|
||||||
* @node: a #struct spa_node
|
* @node: a #struct spa_node
|
||||||
|
|
@ -106,8 +104,7 @@ struct spa_node_callbacks {
|
||||||
* When this function is NULL, synchronous operation is requested
|
* When this function is NULL, synchronous operation is requested
|
||||||
* on the input ports.
|
* on the input ports.
|
||||||
*/
|
*/
|
||||||
void (*need_input) (const struct spa_node_callbacks *callbacks,
|
void (*need_input) (struct spa_node *node, void *user_data);
|
||||||
struct spa_node *node);
|
|
||||||
/**
|
/**
|
||||||
* struct spa_node_callbacks::have_output:
|
* struct spa_node_callbacks::have_output:
|
||||||
* @node: a #struct spa_node
|
* @node: a #struct spa_node
|
||||||
|
|
@ -118,8 +115,7 @@ struct spa_node_callbacks {
|
||||||
* When this function is NULL, synchronous operation is requested
|
* When this function is NULL, synchronous operation is requested
|
||||||
* on the output ports.
|
* on the output ports.
|
||||||
*/
|
*/
|
||||||
void (*have_output) (const struct spa_node_callbacks *callbacks,
|
void (*have_output) (struct spa_node *node, void *user_data);
|
||||||
struct spa_node *node);
|
|
||||||
/**
|
/**
|
||||||
* struct spa_node_callbacks::reuse_buffer:
|
* struct spa_node_callbacks::reuse_buffer:
|
||||||
* @node: a #struct spa_node
|
* @node: a #struct spa_node
|
||||||
|
|
@ -132,10 +128,9 @@ struct spa_node_callbacks {
|
||||||
* When this function is NULL, the buffers to reuse will be set in
|
* When this function is NULL, the buffers to reuse will be set in
|
||||||
* the io area or the input ports.
|
* the io area or the input ports.
|
||||||
*/
|
*/
|
||||||
void (*reuse_buffer) (const struct spa_node_callbacks *callbacks,
|
void (*reuse_buffer) (struct spa_node *node,
|
||||||
struct spa_node *node,
|
|
||||||
uint32_t port_id,
|
uint32_t port_id,
|
||||||
uint32_t buffer_id);
|
uint32_t buffer_id, void *user_data);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -235,7 +230,8 @@ struct spa_node {
|
||||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||||
*/
|
*/
|
||||||
int (*set_callbacks) (struct spa_node *node,
|
int (*set_callbacks) (struct spa_node *node,
|
||||||
const struct spa_node_callbacks *callbacks);
|
const struct spa_node_callbacks *callbacks,
|
||||||
|
void *data);
|
||||||
/**
|
/**
|
||||||
* struct spa_node::get_n_ports:
|
* struct spa_node::get_n_ports:
|
||||||
* @node: a #struct spa_node
|
* @node: a #struct spa_node
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ struct impl {
|
||||||
struct spa_loop *main_loop;
|
struct spa_loop *main_loop;
|
||||||
|
|
||||||
const struct spa_monitor_callbacks *callbacks;
|
const struct spa_monitor_callbacks *callbacks;
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
struct udev *udev;
|
struct udev *udev;
|
||||||
struct udev_monitor *umonitor;
|
struct udev_monitor *umonitor;
|
||||||
|
|
@ -349,14 +350,15 @@ 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);
|
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);
|
event = SPA_POD_BUILDER_DEREF(&b, f[0].ref, struct spa_event);
|
||||||
this->callbacks->event(this->callbacks, &this->monitor, event);
|
this->callbacks->event(&this->monitor, event, this->user_data);
|
||||||
}
|
}
|
||||||
close_card(this);
|
close_card(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
||||||
const struct spa_monitor_callbacks *callbacks)
|
const struct spa_monitor_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
|
|
@ -366,6 +368,7 @@ impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
||||||
this = SPA_CONTAINER_OF(monitor, struct impl, monitor);
|
this = SPA_CONTAINER_OF(monitor, struct impl, monitor);
|
||||||
|
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
|
|
||||||
if (callbacks) {
|
if (callbacks) {
|
||||||
if ((res = impl_udev_open(this)) < 0)
|
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;
|
struct state *this = user_data;
|
||||||
|
|
||||||
this->callbacks->done(this->callbacks, &this->node, seq, *(int*)data);
|
this->callbacks->done(&this->node, seq, *(int*)data, this->user_data);
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -150,7 +150,8 @@ static int impl_node_send_command(struct spa_node *node, struct spa_command *com
|
||||||
|
|
||||||
static int
|
static int
|
||||||
impl_node_set_callbacks(struct spa_node *node,
|
impl_node_set_callbacks(struct spa_node *node,
|
||||||
const struct spa_node_callbacks *callbacks)
|
const struct spa_node_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct state *this;
|
struct state *this;
|
||||||
|
|
||||||
|
|
@ -159,6 +160,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
||||||
this = SPA_CONTAINER_OF(node, struct state, node);
|
this = SPA_CONTAINER_OF(node, struct state, node);
|
||||||
|
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
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;
|
struct state *this = user_data;
|
||||||
|
|
||||||
this->callbacks->done(this->callbacks, &this->node, seq, *(int*)data);
|
this->callbacks->done(&this->node, seq, *(int*)data, this->user_data);
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -168,7 +168,8 @@ static int impl_node_send_command(struct spa_node *node, struct spa_command *com
|
||||||
|
|
||||||
static int
|
static int
|
||||||
impl_node_set_callbacks(struct spa_node *node,
|
impl_node_set_callbacks(struct spa_node *node,
|
||||||
const struct spa_node_callbacks *callbacks)
|
const struct spa_node_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct state *this;
|
struct state *this;
|
||||||
|
|
||||||
|
|
@ -177,6 +178,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
||||||
this = SPA_CONTAINER_OF(node, struct state, node);
|
this = SPA_CONTAINER_OF(node, struct state, node);
|
||||||
|
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,7 @@ pull_frames(struct state *state,
|
||||||
io->range.offset = state->sample_count * state->frame_size;
|
io->range.offset = state->sample_count * state->frame_size;
|
||||||
io->range.min_size = state->threshold * state->frame_size;
|
io->range.min_size = state->threshold * state->frame_size;
|
||||||
io->range.max_size = frames * state->frame_size;
|
io->range.max_size = frames * state->frame_size;
|
||||||
state->callbacks->need_input(state->callbacks, &state->node);
|
state->callbacks->need_input(&state->node, state->user_data);
|
||||||
}
|
}
|
||||||
while (!spa_list_is_empty(&state->ready) && to_write > 0) {
|
while (!spa_list_is_empty(&state->ready) && to_write > 0) {
|
||||||
uint8_t *src, *dst;
|
uint8_t *src, *dst;
|
||||||
|
|
@ -371,10 +371,10 @@ pull_frames(struct state *state,
|
||||||
b->outstanding = true;
|
b->outstanding = true;
|
||||||
state->io->buffer_id = b->outbuf->id;
|
state->io->buffer_id = b->outbuf->id;
|
||||||
spa_log_trace(state->log, "alsa-util %p: reuse buffer %u", state, b->outbuf->id);
|
spa_log_trace(state->log, "alsa-util %p: reuse buffer %u", state, b->outbuf->id);
|
||||||
state->callbacks->reuse_buffer(state->callbacks,
|
state->callbacks->reuse_buffer(&state->node,
|
||||||
&state->node,
|
|
||||||
0,
|
0,
|
||||||
b->outbuf->id);
|
b->outbuf->id,
|
||||||
|
state->user_data);
|
||||||
state->ready_offset = 0;
|
state->ready_offset = 0;
|
||||||
}
|
}
|
||||||
total_frames += n_frames;
|
total_frames += n_frames;
|
||||||
|
|
@ -430,7 +430,7 @@ push_frames(struct state *state,
|
||||||
b->outstanding = true;
|
b->outstanding = true;
|
||||||
io->buffer_id = b->outbuf->id;
|
io->buffer_id = b->outbuf->id;
|
||||||
io->status = SPA_RESULT_HAVE_BUFFER;
|
io->status = SPA_RESULT_HAVE_BUFFER;
|
||||||
state->callbacks->have_output(state->callbacks, &state->node);
|
state->callbacks->have_output(&state->node, state->user_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return total_frames;
|
return total_frames;
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ struct state {
|
||||||
snd_output_t *output;
|
snd_output_t *output;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
uint8_t props_buffer[1024];
|
uint8_t props_buffer[1024];
|
||||||
struct props props;
|
struct props props;
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ struct impl {
|
||||||
struct spa_log *log;
|
struct spa_log *log;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
int port_count;
|
int port_count;
|
||||||
int port_queued;
|
int port_queued;
|
||||||
|
|
@ -152,7 +153,8 @@ static int impl_node_send_command(struct spa_node *node, struct spa_command *com
|
||||||
|
|
||||||
static int
|
static int
|
||||||
impl_node_set_callbacks(struct spa_node *node,
|
impl_node_set_callbacks(struct spa_node *node,
|
||||||
const struct spa_node_callbacks *callbacks)
|
const struct spa_node_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -161,6 +163,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
||||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||||
|
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,7 @@ struct impl {
|
||||||
struct props props;
|
struct props props;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
struct spa_source timer_source;
|
struct spa_source timer_source;
|
||||||
struct itimerspec timerspec;
|
struct itimerspec timerspec;
|
||||||
|
|
@ -350,7 +351,7 @@ static void on_output(struct spa_source *source)
|
||||||
res = make_buffer(this);
|
res = make_buffer(this);
|
||||||
|
|
||||||
if (res == SPA_RESULT_HAVE_BUFFER)
|
if (res == SPA_RESULT_HAVE_BUFFER)
|
||||||
this->callbacks->have_output(this->callbacks, &this->node);
|
this->callbacks->have_output(&this->node, this->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
|
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
|
||||||
|
|
@ -404,7 +405,8 @@ static int impl_node_send_command(struct spa_node *node, struct spa_command *com
|
||||||
|
|
||||||
static int
|
static int
|
||||||
impl_node_set_callbacks(struct spa_node *node,
|
impl_node_set_callbacks(struct spa_node *node,
|
||||||
const struct spa_node_callbacks *callbacks)
|
const struct spa_node_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -417,6 +419,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
||||||
return SPA_RESULT_ERROR;
|
return SPA_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -863,7 +866,8 @@ static int impl_node_process_output(struct spa_node *node)
|
||||||
this->io->buffer_id = SPA_ID_INVALID;
|
this->io->buffer_id = SPA_ID_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this->callbacks == NULL || this->callbacks->have_output == NULL) && (io->status == SPA_RESULT_NEED_BUFFER))
|
if ((this->callbacks == NULL || this->callbacks->have_output == NULL) &&
|
||||||
|
(io->status == SPA_RESULT_NEED_BUFFER))
|
||||||
return make_buffer(this);
|
return make_buffer(this);
|
||||||
else
|
else
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ struct impl {
|
||||||
struct spa_log *log;
|
struct spa_log *log;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
struct port in_ports[1];
|
struct port in_ports[1];
|
||||||
struct port out_ports[1];
|
struct port out_ports[1];
|
||||||
|
|
@ -110,7 +111,8 @@ static int spa_ffmpeg_dec_node_send_command(struct spa_node *node, struct spa_co
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spa_ffmpeg_dec_node_set_callbacks(struct spa_node *node,
|
spa_ffmpeg_dec_node_set_callbacks(struct spa_node *node,
|
||||||
const struct spa_node_callbacks *callbacks)
|
const struct spa_node_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -120,6 +122,7 @@ spa_ffmpeg_dec_node_set_callbacks(struct spa_node *node,
|
||||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||||
|
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ struct impl {
|
||||||
struct spa_log *log;
|
struct spa_log *log;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
struct port in_ports[1];
|
struct port in_ports[1];
|
||||||
struct port out_ports[1];
|
struct port out_ports[1];
|
||||||
|
|
@ -114,7 +115,8 @@ static int spa_ffmpeg_enc_node_send_command(struct spa_node *node, struct spa_co
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spa_ffmpeg_enc_node_set_callbacks(struct spa_node *node,
|
spa_ffmpeg_enc_node_set_callbacks(struct spa_node *node,
|
||||||
const struct spa_node_callbacks *callbacks)
|
const struct spa_node_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -124,6 +126,7 @@ spa_ffmpeg_enc_node_set_callbacks(struct spa_node *node,
|
||||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||||
|
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ struct impl {
|
||||||
struct props props;
|
struct props props;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
struct spa_source timer_source;
|
struct spa_source timer_source;
|
||||||
struct itimerspec timerspec;
|
struct itimerspec timerspec;
|
||||||
|
|
@ -225,7 +226,7 @@ static int consume_buffer(struct impl *this)
|
||||||
if (spa_list_is_empty(&this->ready)) {
|
if (spa_list_is_empty(&this->ready)) {
|
||||||
io->status = SPA_RESULT_NEED_BUFFER;
|
io->status = SPA_RESULT_NEED_BUFFER;
|
||||||
if (this->callbacks->need_input)
|
if (this->callbacks->need_input)
|
||||||
this->callbacks->need_input(this->callbacks, &this->node);
|
this->callbacks->need_input(&this->node, this->user_data);
|
||||||
}
|
}
|
||||||
if (spa_list_is_empty(&this->ready)) {
|
if (spa_list_is_empty(&this->ready)) {
|
||||||
spa_log_error(this->log, NAME " %p: no buffers", this);
|
spa_log_error(this->log, NAME " %p: no buffers", this);
|
||||||
|
|
@ -320,7 +321,8 @@ static int impl_node_send_command(struct spa_node *node, struct spa_command *com
|
||||||
|
|
||||||
static int
|
static int
|
||||||
impl_node_set_callbacks(struct spa_node *node,
|
impl_node_set_callbacks(struct spa_node *node,
|
||||||
const struct spa_node_callbacks *callbacks)
|
const struct spa_node_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -333,6 +335,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
||||||
return SPA_RESULT_ERROR;
|
return SPA_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ struct impl {
|
||||||
struct props props;
|
struct props props;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
struct spa_source timer_source;
|
struct spa_source timer_source;
|
||||||
struct itimerspec timerspec;
|
struct itimerspec timerspec;
|
||||||
|
|
@ -278,7 +279,7 @@ static void on_output(struct spa_source *source)
|
||||||
res = make_buffer(this);
|
res = make_buffer(this);
|
||||||
|
|
||||||
if (res == SPA_RESULT_HAVE_BUFFER && this->callbacks && this->callbacks->have_output)
|
if (res == SPA_RESULT_HAVE_BUFFER && this->callbacks && this->callbacks->have_output)
|
||||||
this->callbacks->have_output(this->callbacks, &this->node);
|
this->callbacks->have_output(&this->node, this->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
|
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
|
||||||
|
|
@ -332,7 +333,8 @@ static int impl_node_send_command(struct spa_node *node, struct spa_command *com
|
||||||
|
|
||||||
static int
|
static int
|
||||||
impl_node_set_callbacks(struct spa_node *node,
|
impl_node_set_callbacks(struct spa_node *node,
|
||||||
const struct spa_node_callbacks *callbacks)
|
const struct spa_node_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -345,6 +347,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
||||||
return SPA_RESULT_ERROR;
|
return SPA_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ struct impl {
|
||||||
struct spa_loop *main_loop;
|
struct spa_loop *main_loop;
|
||||||
|
|
||||||
const struct spa_monitor_callbacks *callbacks;
|
const struct spa_monitor_callbacks *callbacks;
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
struct udev *udev;
|
struct udev *udev;
|
||||||
struct udev_monitor *umonitor;
|
struct udev_monitor *umonitor;
|
||||||
|
|
@ -230,12 +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);
|
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);
|
event = SPA_POD_BUILDER_DEREF(&b, f[0].ref, struct spa_event);
|
||||||
this->callbacks->event(this->callbacks, &this->monitor, event);
|
this->callbacks->event(&this->monitor, event, this->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
||||||
const struct spa_monitor_callbacks *callbacks)
|
const struct spa_monitor_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
|
|
@ -245,6 +247,7 @@ impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
||||||
this = SPA_CONTAINER_OF(monitor, struct impl, monitor);
|
this = SPA_CONTAINER_OF(monitor, struct impl, monitor);
|
||||||
|
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
if (callbacks) {
|
if (callbacks) {
|
||||||
if ((res = impl_udev_open(this)) < 0)
|
if ((res = impl_udev_open(this)) < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,7 @@ struct impl {
|
||||||
struct props props;
|
struct props props;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
struct port out_ports[1];
|
struct port out_ports[1];
|
||||||
};
|
};
|
||||||
|
|
@ -236,7 +237,7 @@ static int do_pause_done(struct spa_loop *loop,
|
||||||
if (SPA_RESULT_IS_OK(res))
|
if (SPA_RESULT_IS_OK(res))
|
||||||
res = spa_v4l2_stream_off(this);
|
res = spa_v4l2_stream_off(this);
|
||||||
|
|
||||||
this->callbacks->done(this->callbacks, &this->node, seq, res);
|
this->callbacks->done(&this->node, seq, res, this->user_data);
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -275,7 +276,7 @@ static int do_start_done(struct spa_loop *loop,
|
||||||
struct impl *this = user_data;
|
struct impl *this = user_data;
|
||||||
int res = *(int*)data;
|
int res = *(int*)data;
|
||||||
|
|
||||||
this->callbacks->done(this->callbacks, &this->node, seq, res);
|
this->callbacks->done(&this->node, seq, res, this->user_data);
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -354,7 +355,8 @@ static int impl_node_send_command(struct spa_node *node, struct spa_command *com
|
||||||
}
|
}
|
||||||
|
|
||||||
static int impl_node_set_callbacks(struct spa_node *node,
|
static int impl_node_set_callbacks(struct spa_node *node,
|
||||||
const struct spa_node_callbacks *callbacks)
|
const struct spa_node_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -363,6 +365,7 @@ static int impl_node_set_callbacks(struct spa_node *node,
|
||||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||||
|
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -934,7 +934,7 @@ static int mmap_read(struct impl *this)
|
||||||
b->outstanding = true;
|
b->outstanding = true;
|
||||||
io->buffer_id = b->outbuf->id;
|
io->buffer_id = b->outbuf->id;
|
||||||
io->status = SPA_RESULT_HAVE_BUFFER;
|
io->status = SPA_RESULT_HAVE_BUFFER;
|
||||||
this->callbacks->have_output(this->callbacks, &this->node);
|
this->callbacks->have_output(&this->node, this->user_data);
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ struct impl {
|
||||||
struct props props;
|
struct props props;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
struct spa_source timer_source;
|
struct spa_source timer_source;
|
||||||
struct itimerspec timerspec;
|
struct itimerspec timerspec;
|
||||||
|
|
@ -300,7 +301,7 @@ static void on_output(struct spa_source *source)
|
||||||
res = make_buffer(this);
|
res = make_buffer(this);
|
||||||
|
|
||||||
if (res == SPA_RESULT_HAVE_BUFFER)
|
if (res == SPA_RESULT_HAVE_BUFFER)
|
||||||
this->callbacks->have_output(this->callbacks, &this->node);
|
this->callbacks->have_output(&this->node, this->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
|
static int impl_node_send_command(struct spa_node *node, struct spa_command *command)
|
||||||
|
|
@ -354,7 +355,8 @@ static int impl_node_send_command(struct spa_node *node, struct spa_command *com
|
||||||
|
|
||||||
static int
|
static int
|
||||||
impl_node_set_callbacks(struct spa_node *node,
|
impl_node_set_callbacks(struct spa_node *node,
|
||||||
const struct spa_node_callbacks *callbacks)
|
const struct spa_node_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -367,6 +369,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
||||||
return SPA_RESULT_ERROR;
|
return SPA_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ struct impl {
|
||||||
struct props props;
|
struct props props;
|
||||||
|
|
||||||
const struct spa_node_callbacks *callbacks;
|
const struct spa_node_callbacks *callbacks;
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
uint8_t format_buffer[1024];
|
uint8_t format_buffer[1024];
|
||||||
struct spa_audio_info current_format;
|
struct spa_audio_info current_format;
|
||||||
|
|
@ -207,7 +208,8 @@ static int impl_node_send_command(struct spa_node *node, struct spa_command *com
|
||||||
|
|
||||||
static int
|
static int
|
||||||
impl_node_set_callbacks(struct spa_node *node,
|
impl_node_set_callbacks(struct spa_node *node,
|
||||||
const struct spa_node_callbacks *callbacks)
|
const struct spa_node_callbacks *callbacks,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -216,6 +218,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
||||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||||
|
|
||||||
this->callbacks = callbacks;
|
this->callbacks = callbacks;
|
||||||
|
this->user_data = user_data;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -645,7 +648,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)
|
static inline void release_buffer(struct impl *this, struct spa_buffer *buffer)
|
||||||
{
|
{
|
||||||
if (this->callbacks && this->callbacks->reuse_buffer)
|
if (this->callbacks && this->callbacks->reuse_buffer)
|
||||||
this->callbacks->reuse_buffer(this->callbacks, &this->node, 0, buffer->id);
|
this->callbacks->reuse_buffer(&this->node, 0, buffer->id, this->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_volume(struct impl *this, struct spa_buffer *dbuf, struct spa_buffer *sbuf)
|
static void do_volume(struct impl *this, struct spa_buffer *dbuf, struct spa_buffer *sbuf)
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,6 @@ struct data {
|
||||||
|
|
||||||
struct spa_node *sink;
|
struct spa_node *sink;
|
||||||
struct spa_port_io volume_sink_io[1];
|
struct spa_port_io volume_sink_io[1];
|
||||||
struct spa_node_callbacks sink_callbacks;
|
|
||||||
|
|
||||||
struct spa_node *volume;
|
struct spa_node *volume;
|
||||||
struct spa_buffer *volume_buffers[1];
|
struct spa_buffer *volume_buffers[1];
|
||||||
|
|
@ -216,22 +215,19 @@ static int make_node(struct data *data, struct spa_node **node, const char *lib,
|
||||||
return SPA_RESULT_ERROR;
|
return SPA_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_sink_done(const struct spa_node_callbacks *callbacks,
|
static void on_sink_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||||
struct spa_node *node, int seq, int res)
|
|
||||||
{
|
{
|
||||||
printf("got done %d %d\n", seq, res);
|
printf("got done %d %d\n", seq, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_sink_event(const struct spa_node_callbacks *callbacks,
|
static void on_sink_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||||
struct spa_node *node, struct spa_event *event)
|
|
||||||
{
|
{
|
||||||
printf("got event %d\n", SPA_EVENT_TYPE(event));
|
printf("got event %d\n", SPA_EVENT_TYPE(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_sink_need_input(const struct spa_node_callbacks *callbacks,
|
static void on_sink_need_input(struct spa_node *node, void *user_data)
|
||||||
struct spa_node *node)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, sink_callbacks);
|
struct data *data = user_data;
|
||||||
|
|
||||||
data->sink_node.action = SPA_GRAPH_ACTION_CHECK;
|
data->sink_node.action = SPA_GRAPH_ACTION_CHECK;
|
||||||
data->sink_node.state = SPA_RESULT_NEED_BUFFER;
|
data->sink_node.state = SPA_RESULT_NEED_BUFFER;
|
||||||
|
|
@ -240,10 +236,9 @@ static void on_sink_need_input(const struct spa_node_callbacks *callbacks,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_sink_reuse_buffer(const struct spa_node_callbacks *callbacks,
|
on_sink_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id, void *user_data)
|
||||||
struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, sink_callbacks);
|
struct data *data = user_data;
|
||||||
|
|
||||||
data->volume_sink_io[0].buffer_id = buffer_id;
|
data->volume_sink_io[0].buffer_id = buffer_id;
|
||||||
}
|
}
|
||||||
|
|
@ -297,8 +292,7 @@ static int make_nodes(struct data *data, const char *device)
|
||||||
printf("can't create alsa-sink: %d\n", res);
|
printf("can't create alsa-sink: %d\n", res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
data->sink_callbacks = sink_callbacks;
|
spa_node_set_callbacks(data->sink, &sink_callbacks, data);
|
||||||
spa_node_set_callbacks(data->sink, &data->sink_callbacks);
|
|
||||||
|
|
||||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||||
spa_pod_builder_props(&b, &f[0], data->type.props,
|
spa_pod_builder_props(&b, &f[0], data->type.props,
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,6 @@ struct data {
|
||||||
struct spa_graph_node sink_node;
|
struct spa_graph_node sink_node;
|
||||||
|
|
||||||
struct spa_node *sink;
|
struct spa_node *sink;
|
||||||
struct spa_node_callbacks sink_callbacks;
|
|
||||||
struct spa_port_io mix_sink_io[1];
|
struct spa_port_io mix_sink_io[1];
|
||||||
|
|
||||||
struct spa_node *mix;
|
struct spa_node *mix;
|
||||||
|
|
@ -227,22 +226,19 @@ static int make_node(struct data *data, struct spa_node **node, const char *lib,
|
||||||
return SPA_RESULT_ERROR;
|
return SPA_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_sink_done(const struct spa_node_callbacks *callbacks,
|
static void on_sink_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||||
struct spa_node *node, int seq, int res)
|
|
||||||
{
|
{
|
||||||
printf("got done %d %d\n", seq, res);
|
printf("got done %d %d\n", seq, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_sink_event(const struct spa_node_callbacks *callbacks,
|
static void on_sink_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||||
struct spa_node *node, struct spa_event *event)
|
|
||||||
{
|
{
|
||||||
printf("got event %d\n", SPA_EVENT_TYPE(event));
|
printf("got event %d\n", SPA_EVENT_TYPE(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_sink_need_input(const struct spa_node_callbacks *callbacks,
|
static void on_sink_need_input(struct spa_node *node, void *user_data)
|
||||||
struct spa_node *node)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, sink_callbacks);
|
struct data *data = user_data;
|
||||||
#ifdef USE_GRAPH
|
#ifdef USE_GRAPH
|
||||||
data->sink_node.action = PROCESS_CHECK;
|
data->sink_node.action = PROCESS_CHECK;
|
||||||
data->sink_node.state = SPA_RESULT_NEED_BUFFER;
|
data->sink_node.state = SPA_RESULT_NEED_BUFFER;
|
||||||
|
|
@ -282,12 +278,12 @@ static void on_sink_need_input(const struct spa_node_callbacks *callbacks,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_sink_reuse_buffer(const struct spa_node_callbacks *callbacks,
|
on_sink_reuse_buffer(struct spa_node *node,
|
||||||
struct spa_node *node,
|
|
||||||
uint32_t port_id,
|
uint32_t port_id,
|
||||||
uint32_t buffer_id)
|
uint32_t buffer_id,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, sink_callbacks);
|
struct data *data = user_data;
|
||||||
|
|
||||||
data->mix_sink_io[0].buffer_id = buffer_id;
|
data->mix_sink_io[0].buffer_id = buffer_id;
|
||||||
}
|
}
|
||||||
|
|
@ -341,8 +337,7 @@ static int make_nodes(struct data *data, const char *device)
|
||||||
printf("can't create alsa-sink: %d\n", res);
|
printf("can't create alsa-sink: %d\n", res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
data->sink_callbacks = sink_callbacks;
|
spa_node_set_callbacks(data->sink, &sink_callbacks, data);
|
||||||
spa_node_set_callbacks(data->sink, &data->sink_callbacks);
|
|
||||||
|
|
||||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||||
spa_pod_builder_props(&b, &f[0], data->type.props,
|
spa_pod_builder_props(&b, &f[0], data->type.props,
|
||||||
|
|
|
||||||
|
|
@ -109,12 +109,10 @@ struct data {
|
||||||
|
|
||||||
struct spa_node *sink;
|
struct spa_node *sink;
|
||||||
struct spa_port_io source_sink_io[1];
|
struct spa_port_io source_sink_io[1];
|
||||||
struct spa_node_callbacks sink_callbacks;
|
|
||||||
|
|
||||||
struct spa_node *source;
|
struct spa_node *source;
|
||||||
struct spa_buffer *source_buffers[1];
|
struct spa_buffer *source_buffers[1];
|
||||||
struct buffer source_buffer[1];
|
struct buffer source_buffer[1];
|
||||||
struct spa_node_callbacks source_callbacks;
|
|
||||||
|
|
||||||
bool running;
|
bool running;
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
|
|
@ -242,24 +240,21 @@ static void on_source_push(struct data *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_sink_done(const struct spa_node_callbacks *callbacks,
|
static void on_sink_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||||
struct spa_node *node, int seq, int res)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, sink_callbacks);
|
struct data *data = user_data;
|
||||||
spa_log_trace(data->log, "got sink done %d %d", seq, res);
|
spa_log_trace(data->log, "got sink done %d %d", seq, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_sink_event(const struct spa_node_callbacks *callbacks,
|
static void on_sink_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||||
struct spa_node *node, struct spa_event *event)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, sink_callbacks);
|
struct data *data = user_data;
|
||||||
spa_log_trace(data->log, "got sink event %d", SPA_EVENT_TYPE(event));
|
spa_log_trace(data->log, "got sink event %d", SPA_EVENT_TYPE(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_sink_need_input(const struct spa_node_callbacks *callbacks,
|
static void on_sink_need_input(struct spa_node *node, void *user_data)
|
||||||
struct spa_node *node)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, sink_callbacks);
|
struct data *data = user_data;
|
||||||
spa_log_trace(data->log, "need input");
|
spa_log_trace(data->log, "need input");
|
||||||
on_sink_pull(data);
|
on_sink_pull(data);
|
||||||
if (--data->iterations == 0)
|
if (--data->iterations == 0)
|
||||||
|
|
@ -267,10 +262,9 @@ static void on_sink_need_input(const struct spa_node_callbacks *callbacks,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_sink_reuse_buffer(const struct spa_node_callbacks *callbacks,
|
on_sink_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id, void *user_data)
|
||||||
struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, sink_callbacks);
|
struct data *data = user_data;
|
||||||
|
|
||||||
data->source_sink_io[0].buffer_id = buffer_id;
|
data->source_sink_io[0].buffer_id = buffer_id;
|
||||||
}
|
}
|
||||||
|
|
@ -284,24 +278,21 @@ static const struct spa_node_callbacks sink_callbacks = {
|
||||||
&on_sink_reuse_buffer
|
&on_sink_reuse_buffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static void on_source_done(const struct spa_node_callbacks *callbacks,
|
static void on_source_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||||
struct spa_node *node, int seq, int res)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, source_callbacks);
|
struct data *data = user_data;
|
||||||
spa_log_trace(data->log, "got source done %d %d", seq, res);
|
spa_log_trace(data->log, "got source done %d %d", seq, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_source_event(const struct spa_node_callbacks *callbacks,
|
static void on_source_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||||
struct spa_node *node, struct spa_event *event)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, source_callbacks);
|
struct data *data = user_data;
|
||||||
spa_log_trace(data->log, "got source event %d", SPA_EVENT_TYPE(event));
|
spa_log_trace(data->log, "got source event %d", SPA_EVENT_TYPE(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_source_have_output(const struct spa_node_callbacks *callbacks,
|
static void on_source_have_output(struct spa_node *node, void *user_data)
|
||||||
struct spa_node *node)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, source_callbacks);
|
struct data *data = user_data;
|
||||||
spa_log_trace(data->log, "have_output");
|
spa_log_trace(data->log, "have_output");
|
||||||
on_source_push(data);
|
on_source_push(data);
|
||||||
if (--data->iterations == 0)
|
if (--data->iterations == 0)
|
||||||
|
|
@ -355,9 +346,8 @@ static int make_nodes(struct data *data)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
data->sink_callbacks = sink_callbacks;
|
|
||||||
if (data->mode & MODE_ASYNC_PULL)
|
if (data->mode & MODE_ASYNC_PULL)
|
||||||
spa_node_set_callbacks(data->sink, &data->sink_callbacks);
|
spa_node_set_callbacks(data->sink, &sink_callbacks, data);
|
||||||
|
|
||||||
if ((res = make_node(data, &data->source,
|
if ((res = make_node(data, &data->source,
|
||||||
"build/spa/plugins/test/libspa-test.so", "fakesrc")) < 0) {
|
"build/spa/plugins/test/libspa-test.so", "fakesrc")) < 0) {
|
||||||
|
|
@ -365,9 +355,8 @@ static int make_nodes(struct data *data)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
data->source_callbacks = source_callbacks;
|
|
||||||
if (data->mode & MODE_ASYNC_PUSH)
|
if (data->mode & MODE_ASYNC_PUSH)
|
||||||
spa_node_set_callbacks(data->source, &data->source_callbacks);
|
spa_node_set_callbacks(data->source, &source_callbacks, data);
|
||||||
|
|
||||||
data->source_sink_io[0] = SPA_PORT_IO_INIT;
|
data->source_sink_io[0] = SPA_PORT_IO_INIT;
|
||||||
data->source_sink_io[0].status = SPA_RESULT_NEED_BUFFER;
|
data->source_sink_io[0].status = SPA_RESULT_NEED_BUFFER;
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,6 @@ struct data {
|
||||||
uint32_t n_support;
|
uint32_t n_support;
|
||||||
|
|
||||||
struct spa_node *sink;
|
struct spa_node *sink;
|
||||||
struct spa_node_callbacks sink_callbacks;
|
|
||||||
struct spa_port_io source_sink_io[1];
|
struct spa_port_io source_sink_io[1];
|
||||||
|
|
||||||
struct spa_node *source;
|
struct spa_node *source;
|
||||||
|
|
@ -206,22 +205,19 @@ static int make_node(struct data *data, struct spa_node **node, const char *lib,
|
||||||
return SPA_RESULT_ERROR;
|
return SPA_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_sink_done(const struct spa_node_callbacks *callbacks,
|
static void on_sink_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||||
struct spa_node *node, int seq, int res)
|
|
||||||
{
|
{
|
||||||
printf("got done %d %d\n", seq, res);
|
printf("got done %d %d\n", seq, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_sink_event(const struct spa_node_callbacks *callbacks,
|
static void on_sink_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||||
struct spa_node *node, struct spa_event *event)
|
|
||||||
{
|
{
|
||||||
printf("got event %d\n", SPA_EVENT_TYPE(event));
|
printf("got event %d\n", SPA_EVENT_TYPE(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_sink_need_input(const struct spa_node_callbacks *callbacks,
|
static void on_sink_need_input(struct spa_node *node, void *user_data)
|
||||||
struct spa_node *node)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, sink_callbacks);
|
struct data *data = user_data;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = spa_node_process_output(data->source);
|
res = spa_node_process_output(data->source);
|
||||||
|
|
@ -233,12 +229,12 @@ static void on_sink_need_input(const struct spa_node_callbacks *callbacks,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_sink_reuse_buffer(const struct spa_node_callbacks *callbacks,
|
on_sink_reuse_buffer(struct spa_node *node,
|
||||||
struct spa_node *node,
|
|
||||||
uint32_t port_id,
|
uint32_t port_id,
|
||||||
uint32_t buffer_id)
|
uint32_t buffer_id,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, sink_callbacks);
|
struct data *data = user_data;
|
||||||
data->source_sink_io[0].buffer_id = buffer_id;
|
data->source_sink_io[0].buffer_id = buffer_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -291,8 +287,7 @@ static int make_nodes(struct data *data, const char *device)
|
||||||
printf("can't create alsa-sink: %d\n", res);
|
printf("can't create alsa-sink: %d\n", res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
data->sink_callbacks = sink_callbacks;
|
spa_node_set_callbacks(data->sink, &sink_callbacks, data);
|
||||||
spa_node_set_callbacks(data->sink, &data->sink_callbacks);
|
|
||||||
|
|
||||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||||
spa_pod_builder_props(&b, &f[0], data->type.props,
|
spa_pod_builder_props(&b, &f[0], data->type.props,
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,6 @@ struct data {
|
||||||
|
|
||||||
struct spa_node *source;
|
struct spa_node *source;
|
||||||
struct spa_port_io source_output[1];
|
struct spa_port_io source_output[1];
|
||||||
struct spa_node_callbacks source_callbacks;
|
|
||||||
|
|
||||||
SDL_Renderer *renderer;
|
SDL_Renderer *renderer;
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
|
|
@ -177,26 +176,23 @@ static void handle_events(struct data *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_source_done(const struct spa_node_callbacks *callbacks,
|
static void on_source_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||||
struct spa_node *node, int seq, int res)
|
|
||||||
{
|
{
|
||||||
printf("got done %d %d\n", seq, res);
|
printf("got done %d %d\n", seq, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_source_event(const struct spa_node_callbacks *callbacks,
|
static void on_source_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||||
struct spa_node *node, struct spa_event *event)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, source_callbacks);
|
struct data *data = user_data;
|
||||||
|
|
||||||
handle_events(data);
|
handle_events(data);
|
||||||
|
|
||||||
printf("got event %d\n", SPA_EVENT_TYPE(event));
|
printf("got event %d\n", SPA_EVENT_TYPE(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_source_have_output(const struct spa_node_callbacks *callbacks,
|
static void on_source_have_output(struct spa_node *node, void *user_data)
|
||||||
struct spa_node *node)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, source_callbacks);
|
struct data *data = user_data;
|
||||||
int res;
|
int res;
|
||||||
struct spa_buffer *b;
|
struct spa_buffer *b;
|
||||||
void *sdata, *ddata;
|
void *sdata, *ddata;
|
||||||
|
|
@ -315,8 +311,7 @@ static int make_nodes(struct data *data, const char *device)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
data->source_callbacks = source_callbacks;
|
spa_node_set_callbacks(data->source, &source_callbacks, data);
|
||||||
spa_node_set_callbacks(data->source, &data->source_callbacks);
|
|
||||||
|
|
||||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||||
spa_pod_builder_props(&b, &f[0], data->type.props,
|
spa_pod_builder_props(&b, &f[0], data->type.props,
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,6 @@ struct data {
|
||||||
struct spa_log *log;
|
struct spa_log *log;
|
||||||
struct spa_loop main_loop;
|
struct spa_loop main_loop;
|
||||||
|
|
||||||
struct spa_monitor_callbacks callbacks;
|
|
||||||
|
|
||||||
struct spa_support support[3];
|
struct spa_support support[3];
|
||||||
uint32_t n_support;
|
uint32_t n_support;
|
||||||
|
|
||||||
|
|
@ -65,11 +63,10 @@ static void inspect_item(struct data *data, struct spa_monitor_item *item)
|
||||||
spa_debug_pod(&item->object.pod);
|
spa_debug_pod(&item->object.pod);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_monitor_event(const struct spa_monitor_callbacks *callbacks,
|
static void on_monitor_event(struct spa_monitor *monitor,
|
||||||
struct spa_monitor *monitor,
|
struct spa_event *event, void *user_data)
|
||||||
struct spa_event *event)
|
|
||||||
{
|
{
|
||||||
struct data *data = SPA_CONTAINER_OF(callbacks, struct data, callbacks);
|
struct data *data = user_data;
|
||||||
|
|
||||||
if (SPA_EVENT_TYPE(event) == data->type.monitor.Added) {
|
if (SPA_EVENT_TYPE(event) == data->type.monitor.Added) {
|
||||||
fprintf(stderr, "added:\n");
|
fprintf(stderr, "added:\n");
|
||||||
|
|
@ -126,8 +123,7 @@ static void handle_monitor(struct data *data, struct spa_monitor *monitor)
|
||||||
}
|
}
|
||||||
inspect_item(data, item);
|
inspect_item(data, item);
|
||||||
}
|
}
|
||||||
data->callbacks = impl_callbacks;
|
spa_monitor_set_callbacks(monitor, &impl_callbacks, data);
|
||||||
spa_monitor_set_callbacks(monitor, &data->callbacks);
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
int i, r;
|
int i, r;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue