mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -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
|
|
@ -109,6 +109,7 @@ struct impl {
|
|||
struct props props;
|
||||
|
||||
const struct spa_node_callbacks *callbacks;
|
||||
void *user_data;
|
||||
|
||||
uint8_t format_buffer[1024];
|
||||
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
|
||||
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;
|
||||
|
||||
|
|
@ -216,6 +218,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;
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue