node: process -> ready

Change the process callback to ready to avoid confusion with the
process method and it also describes better what happened.
This commit is contained in:
Wim Taymans 2019-02-14 17:04:59 +01:00
parent 8ae5424359
commit 3c78036a97
13 changed files with 28 additions and 27 deletions

View file

@ -233,7 +233,7 @@ static void update_props(struct data *data)
data->volume_accum -= M_PI_M2;
}
static void on_sink_process(void *_data, int status)
static void on_sink_ready(void *_data, int status)
{
struct data *data = _data;
@ -255,7 +255,7 @@ static const struct spa_node_callbacks sink_callbacks = {
SPA_VERSION_NODE_CALLBACKS,
.done = on_sink_done,
.event = on_sink_event,
.process = on_sink_process,
.ready = on_sink_ready,
.reuse_buffer = on_sink_reuse_buffer
};

View file

@ -159,7 +159,7 @@ static void on_source_event(void *_data, struct spa_event *event)
printf("got event %d\n", SPA_EVENT_TYPE(event));
}
static void on_source_process(void *_data, int status)
static void on_source_ready(void *_data, int status)
{
struct data *data = _data;
int res;
@ -239,7 +239,7 @@ static const struct spa_node_callbacks source_callbacks = {
SPA_VERSION_NODE_CALLBACKS,
.done = on_source_done,
.event = on_source_event,
.process = on_source_process
.ready = on_source_ready
};
static int do_add_source(struct spa_loop *loop, struct spa_source *source)

View file

@ -111,7 +111,7 @@ struct spa_node_callbacks {
* When this function is NULL, synchronous operation is requested
* on the ports.
*/
void (*process) (void *data, int state);
void (*ready) (void *data, int state);
/**
* \param node a spa_node

View file

@ -825,7 +825,7 @@ push_frames(struct state *state,
spa_list_append(&state->ready, &b->link);
}
state->callbacks->process(state->callbacks_data, SPA_STATUS_HAVE_BUFFER);
state->callbacks->ready(state->callbacks_data, SPA_STATUS_HAVE_BUFFER);
}
return total_frames;
}
@ -869,7 +869,7 @@ static int handle_play(struct state *state)
state->range->min_size = state->threshold * state->frame_size;
state->range->max_size = state->threshold * state->frame_size;
}
state->callbacks->process(state->callbacks_data, SPA_STATUS_NEED_BUFFER);
state->callbacks->ready(state->callbacks_data, SPA_STATUS_NEED_BUFFER);
}
else {
spa_alsa_write(state, 0, true);

View file

@ -388,7 +388,7 @@ static void on_output(struct spa_source *source)
res = make_buffer(this);
if (res == SPA_STATUS_HAVE_BUFFER)
this->callbacks->process(this->callbacks_data, res);
this->callbacks->ready(this->callbacks_data, res);
}
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)

View file

@ -624,7 +624,7 @@ static void a2dp_on_timeout(struct spa_source *source)
this->range->min_size = this->threshold * this->frame_size;
this->range->max_size = this->write_samples * this->frame_size;
}
this->callbacks->process(this->callbacks_data, SPA_STATUS_NEED_BUFFER);
this->callbacks->ready(this->callbacks_data, SPA_STATUS_NEED_BUFFER);
}
flush_data(this, now_time);
}

View file

@ -183,7 +183,7 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
static void set_timer(struct impl *this, bool enabled)
{
if ((this->callbacks && this->callbacks->process) || this->props.live) {
if ((this->callbacks && this->callbacks->ready) || this->props.live) {
if (enabled) {
if (this->props.live) {
uint64_t next_time = this->start_time + this->elapsed_time;
@ -205,7 +205,7 @@ static inline void read_timer(struct impl *this)
{
uint64_t expirations;
if ((this->callbacks && this->callbacks->process) || this->props.live) {
if ((this->callbacks && this->callbacks->ready) || this->props.live) {
if (read(this->timer_source.fd, &expirations, sizeof(uint64_t)) != sizeof(uint64_t))
perror("read timerfd");
}
@ -225,8 +225,8 @@ static int consume_buffer(struct impl *this)
if (spa_list_is_empty(&this->ready)) {
io->status = SPA_STATUS_NEED_BUFFER;
if (this->callbacks->process)
this->callbacks->process(this->callbacks_data, SPA_STATUS_NEED_BUFFER);
if (this->callbacks->ready)
this->callbacks->ready(this->callbacks_data, SPA_STATUS_NEED_BUFFER);
}
if (spa_list_is_empty(&this->ready)) {
spa_log_error(this->log, NAME " %p: no buffers", this);
@ -694,7 +694,7 @@ static int impl_node_process(struct spa_node *node)
input->buffer_id = SPA_ID_INVALID;
input->status = SPA_STATUS_OK;
}
if (this->callbacks == NULL || this->callbacks->process == NULL)
if (this->callbacks == NULL || this->callbacks->ready == NULL)
return consume_buffer(this);
else
return SPA_STATUS_OK;

View file

@ -203,7 +203,7 @@ static int fill_buffer(struct impl *this, struct buffer *b)
static void set_timer(struct impl *this, bool enabled)
{
if ((this->callbacks && this->callbacks->process) || this->props.live) {
if ((this->callbacks && this->callbacks->ready) || this->props.live) {
if (enabled) {
if (this->props.live) {
uint64_t next_time = this->start_time + this->elapsed_time;
@ -225,7 +225,7 @@ static inline void read_timer(struct impl *this)
{
uint64_t expirations;
if ((this->callbacks && this->callbacks->process) || this->props.live) {
if ((this->callbacks && this->callbacks->ready) || this->props.live) {
if (read(this->timer_source.fd, &expirations, sizeof(uint64_t)) != sizeof(uint64_t))
perror("read timerfd");
}
@ -282,8 +282,8 @@ static void on_output(struct spa_source *source)
res = make_buffer(this);
if (res == SPA_STATUS_HAVE_BUFFER && this->callbacks && this->callbacks->process)
this->callbacks->process(this->callbacks_data, res);
if (res == SPA_STATUS_HAVE_BUFFER && this->callbacks && this->callbacks->ready)
this->callbacks->ready(this->callbacks_data, res);
}
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
@ -728,7 +728,7 @@ static int impl_node_process(struct spa_node *node)
this->io->buffer_id = SPA_ID_INVALID;
}
if ((this->callbacks == NULL || this->callbacks->process == NULL) &&
if ((this->callbacks == NULL || this->callbacks->ready == NULL) &&
(io->status == SPA_STATUS_NEED_BUFFER))
return make_buffer(this);
else

View file

@ -1193,7 +1193,7 @@ static int mmap_read(struct impl *this)
}
spa_log_trace(this->log, "v4l2 %p: now queued %d", this, b->id);
this->callbacks->process(this->callbacks_data, SPA_STATUS_HAVE_BUFFER);
this->callbacks->ready(this->callbacks_data, SPA_STATUS_HAVE_BUFFER);
return 0;
}

View file

@ -333,7 +333,7 @@ static void on_output(struct spa_source *source)
res = make_buffer(this);
if (res == SPA_STATUS_HAVE_BUFFER)
this->callbacks->process(this->callbacks_data, res);
this->callbacks->ready(this->callbacks_data, res);
}
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)

View file

@ -1139,8 +1139,9 @@ static void node_on_data_fd_events(struct spa_source *source)
if (read(this->data_source.fd, &cmd, sizeof(cmd)) != sizeof(cmd) || cmd != 1)
spa_log_warn(this->log, "node %p: read %"PRIu64" failed %m", this, cmd);
spa_log_trace(this->log, "node %p: got process", this);
this->callbacks->process(this->callbacks_data, SPA_STATUS_HAVE_BUFFER);
spa_log_trace(this->log, "node %p: got ready", this);
if (this->callbacks && this->callbacks->ready)
this->callbacks->ready(this->callbacks_data, SPA_STATUS_HAVE_BUFFER);
}
}

View file

@ -908,12 +908,12 @@ static void node_event(void *data, struct spa_event *event)
}
static void node_process(void *data, int status)
static void node_ready(void *data, int status)
{
struct pw_node *node = data;
struct pw_node *driver = node->driver_node;
pw_log_trace("node %p: process driver:%d exported:%d %p", node,
pw_log_trace("node %p: ready driver:%d exported:%d %p", node,
node->driver, node->exported, driver);
if (driver->rt.root.graph == NULL)
@ -946,7 +946,7 @@ static const struct spa_node_callbacks node_callbacks = {
.info = node_info,
.done = node_done,
.event = node_event,
.process = node_process,
.ready = node_ready,
.reuse_buffer = node_reuse_buffer,
};

View file

@ -1294,7 +1294,7 @@ do_process(struct spa_loop *loop,
bool async, uint32_t seq, const void *data, size_t size, void *user_data)
{
struct stream *impl = user_data;
impl->callbacks->process(impl->callbacks_data, SPA_STATUS_HAVE_BUFFER);
impl->callbacks->ready(impl->callbacks_data, SPA_STATUS_HAVE_BUFFER);
return 0;
}