mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-18 07:00:06 -05:00
Improve loop callbacks
Pass just one data item to the callbacks. Add properties to port. Add user data to link Handle autolink with multiple ports More work on jack support
This commit is contained in:
parent
cfd9967637
commit
9ad1f911b2
38 changed files with 1773 additions and 271 deletions
|
|
@ -90,7 +90,8 @@ static inline void spa_graph_scheduler_pull(struct spa_graph_scheduler *sched, s
|
|||
pnode = pport->node;
|
||||
debug("node %p peer %p io %d\n", node, pnode, pport->io->status);
|
||||
if (pport->io->status == SPA_RESULT_NEED_BUFFER) {
|
||||
spa_list_insert(ready.prev, &pnode->ready_link);
|
||||
if (pnode->ready_link.next == NULL)
|
||||
spa_list_append(&ready, &pnode->ready_link);
|
||||
}
|
||||
else if (pport->io->status == SPA_RESULT_OK && !(pnode->flags & SPA_GRAPH_NODE_FLAG_ASYNC))
|
||||
node->ready_in++;
|
||||
|
|
@ -111,7 +112,7 @@ static inline void spa_graph_scheduler_pull(struct spa_graph_scheduler *sched, s
|
|||
n->ready_link.next = NULL;
|
||||
}
|
||||
|
||||
debug("node %p %d %d\n", node, node->ready_in, node->required_in);
|
||||
debug("node %p ready_in:%d required_in:%d\n", node, node->ready_in, node->required_in);
|
||||
|
||||
if (node->required_in > 0 && node->ready_in == node->required_in) {
|
||||
node->state = node->callbacks->process_input(node->callbacks_data);
|
||||
|
|
@ -179,7 +180,8 @@ static inline void spa_graph_scheduler_push(struct spa_graph_scheduler *sched, s
|
|||
pnode->ready_in, pnode->required_in);
|
||||
|
||||
if (pnode->required_in > 0 && pnode->ready_in == pnode->required_in)
|
||||
spa_list_insert(ready.prev, &pnode->ready_link);
|
||||
if (pnode->ready_link.next == NULL)
|
||||
spa_list_append(&ready, &pnode->ready_link);
|
||||
}
|
||||
|
||||
spa_graph_scheduler_chain(sched, &ready);
|
||||
|
|
|
|||
|
|
@ -148,19 +148,11 @@ struct spa_loop_control {
|
|||
#define spa_loop_control_leave(l) (l)->leave(l)
|
||||
|
||||
|
||||
typedef void (*spa_source_io_func_t) (struct spa_loop_utils *utils,
|
||||
struct spa_source *source,
|
||||
int fd, enum spa_io mask, void *data);
|
||||
typedef void (*spa_source_idle_func_t) (struct spa_loop_utils *utils,
|
||||
struct spa_source *source, void *data);
|
||||
typedef void (*spa_source_event_func_t) (struct spa_loop_utils *utils,
|
||||
struct spa_source *source,
|
||||
uint64_t count, void *data);
|
||||
typedef void (*spa_source_timer_func_t) (struct spa_loop_utils *utils,
|
||||
struct spa_source *source, void *data);
|
||||
typedef void (*spa_source_signal_func_t) (struct spa_loop_utils *utils,
|
||||
struct spa_source *source,
|
||||
int signal_number, void *data);
|
||||
typedef void (*spa_source_io_func_t) (void *data, int fd, enum spa_io mask);
|
||||
typedef void (*spa_source_idle_func_t) (void *data);
|
||||
typedef void (*spa_source_event_func_t) (void *data, uint64_t count);
|
||||
typedef void (*spa_source_timer_func_t) (void *data, uint64_t expirations);
|
||||
typedef void (*spa_source_signal_func_t) (void *data, int signal_number);
|
||||
|
||||
/**
|
||||
* struct spa_loop_utils:
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ loop_invoke(struct spa_loop *loop,
|
|||
return res;
|
||||
}
|
||||
|
||||
static void wakeup_func(struct spa_loop_utils *utils, struct spa_source *source, uint64_t count, void *data)
|
||||
static void wakeup_func(void *data, uint64_t count)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
uint32_t index;
|
||||
|
|
@ -357,7 +357,7 @@ static int loop_iterate(struct spa_loop_control *ctrl, int timeout)
|
|||
static void source_io_func(struct spa_source *source)
|
||||
{
|
||||
struct source_impl *impl = SPA_CONTAINER_OF(source, struct source_impl, source);
|
||||
impl->func.io(&impl->impl->utils, source, source->fd, source->rmask, source->data);
|
||||
impl->func.io(source->data, source->fd, source->rmask);
|
||||
}
|
||||
|
||||
static struct spa_source *loop_add_io(struct spa_loop_utils *utils,
|
||||
|
|
@ -398,7 +398,7 @@ static int loop_update_io(struct spa_source *source, enum spa_io mask)
|
|||
static void source_idle_func(struct spa_source *source)
|
||||
{
|
||||
struct source_impl *impl = SPA_CONTAINER_OF(source, struct source_impl, source);
|
||||
impl->func.idle(&impl->impl->utils, source, source->data);
|
||||
impl->func.idle(source->data);
|
||||
}
|
||||
|
||||
static struct spa_source *loop_add_idle(struct spa_loop_utils *utils,
|
||||
|
|
@ -457,7 +457,7 @@ static void source_event_func(struct spa_source *source)
|
|||
spa_log_warn(impl->impl->log, NAME " %p: failed to read event fd %d: %s",
|
||||
source, source->fd, strerror(errno));
|
||||
|
||||
impl->func.event(&impl->impl->utils, source, count, source->data);
|
||||
impl->func.event(source->data, count);
|
||||
}
|
||||
|
||||
static struct spa_source *loop_add_event(struct spa_loop_utils *utils,
|
||||
|
|
@ -499,13 +499,13 @@ static void loop_signal_event(struct spa_source *source)
|
|||
static void source_timer_func(struct spa_source *source)
|
||||
{
|
||||
struct source_impl *impl = SPA_CONTAINER_OF(source, struct source_impl, source);
|
||||
uint64_t expires;
|
||||
uint64_t expirations;
|
||||
|
||||
if (read(source->fd, &expires, sizeof(uint64_t)) != sizeof(uint64_t))
|
||||
if (read(source->fd, &expirations, sizeof(uint64_t)) != sizeof(uint64_t))
|
||||
spa_log_warn(impl->impl->log, NAME " %p: failed to read timer fd %d: %s",
|
||||
source, source->fd, strerror(errno));
|
||||
|
||||
impl->func.timer(&impl->impl->utils, source, source->data);
|
||||
impl->func.timer(source->data, expirations);
|
||||
}
|
||||
|
||||
static struct spa_source *loop_add_timer(struct spa_loop_utils *utils,
|
||||
|
|
@ -568,7 +568,7 @@ static void source_signal_func(struct spa_source *source)
|
|||
spa_log_warn(impl->impl->log, NAME " %p: failed to read signal fd %d: %s",
|
||||
source, source->fd, strerror(errno));
|
||||
|
||||
impl->func.signal(&impl->impl->utils, source, impl->signal_number, source->data);
|
||||
impl->func.signal(source->data, impl->signal_number);
|
||||
}
|
||||
|
||||
static struct spa_source *loop_add_signal(struct spa_loop_utils *utils,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue