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

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

View file

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

View file

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