mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04: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
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue