Only pass data to callbacks.
Rename some structs
Provide methods to access structs
This commit is contained in:
Wim Taymans 2017-08-06 06:42:26 +02:00
parent 1b79419554
commit 0602d76b9e
57 changed files with 716 additions and 422 deletions

View file

@ -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;
}

View file

@ -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;
}