Work on unifying client and server

Remove context and extensions, make client API also use the core.
Make a new pw_remote object that keeps connections with remote
instances.
Remove introspection API, it's just as easy to connect to the registry
and get updates like that.
Expand the protocol a little to make it useful for making listeners
and connections.
Move protocol specific connection to the module. Make some new
convenience methods.
Make a factory to create nodes from spa objects
Add an example of a local pipeline displaying a v4l2 source.
This commit is contained in:
Wim Taymans 2017-07-11 12:24:03 +02:00
parent 2ece95ea48
commit 847cef83b6
65 changed files with 2634 additions and 2713 deletions

View file

@ -38,32 +38,36 @@ static inline void spa_graph_scheduler_init(struct spa_graph_scheduler *sched,
sched->node = NULL;
}
static inline int spa_graph_scheduler_input(struct spa_graph_node *node, void *user_data)
static inline int spa_graph_node_scheduler_input(struct spa_graph_node *node, void *user_data)
{
struct spa_node *n = node->user_data;
return spa_node_process_input(n);
}
static inline int spa_graph_scheduler_output(struct spa_graph_node *node, void *user_data)
static inline int spa_graph_node_scheduler_output(struct spa_graph_node *node, void *user_data)
{
struct spa_node *n = node->user_data;
return spa_node_process_output(n);
}
static inline int spa_graph_scheduler_reuse_buffer(struct spa_graph_port *port,
uint32_t buffer_id, void *user_data)
static const struct spa_graph_node_methods spa_graph_node_scheduler_default = {
SPA_VERSION_GRAPH_NODE_METHODS,
spa_graph_node_scheduler_input,
spa_graph_node_scheduler_output,
};
static inline int spa_graph_port_scheduler_reuse_buffer(struct spa_graph_port *port,
uint32_t buffer_id, void *user_data)
{
printf("port %p reuse buffer %d\n", port, buffer_id);
struct spa_graph_node *node = port->node;
struct spa_node *n = node->user_data;
return spa_node_port_reuse_buffer(n, port->port_id, buffer_id);
struct spa_node *node = port->node->user_data;
return spa_node_port_reuse_buffer(node, port->port_id, buffer_id);
}
static const struct spa_graph_node_methods spa_graph_scheduler_default = {
SPA_VERSION_GRAPH_NODE_METHODS,
spa_graph_scheduler_input,
spa_graph_scheduler_output,
spa_graph_scheduler_reuse_buffer,
static const struct spa_graph_port_methods spa_graph_port_scheduler_default = {
SPA_VERSION_GRAPH_PORT_METHODS,
spa_graph_port_scheduler_reuse_buffer,
};
static inline void spa_graph_scheduler_pull(struct spa_graph_scheduler *sched, struct spa_graph_node *node)
@ -92,8 +96,8 @@ static inline void spa_graph_scheduler_pull(struct spa_graph_scheduler *sched, s
}
spa_list_for_each_safe(n, t, &ready, ready_link) {
n->state = n->methods->schedule_output(n, n->user_data);
debug("peer %p scheduled out %d\n", n, n->state);
n->state = n->methods->process_output(n, n->user_data);
debug("peer %p processed out %d\n", n, n->state);
if (n->state == SPA_RESULT_NEED_BUFFER)
spa_graph_scheduler_pull(sched, n);
else {
@ -109,8 +113,8 @@ static inline void spa_graph_scheduler_pull(struct spa_graph_scheduler *sched, s
debug("node %p %d %d\n", node, node->ready_in, node->required_in);
if (node->required_in > 0 && node->ready_in == node->required_in) {
node->state = node->methods->schedule_input(node, node->user_data);
debug("node %p scheduled in %d\n", node, node->state);
node->state = node->methods->process_input(node, node->user_data);
debug("node %p processed in %d\n", node, node->state);
if (node->state == SPA_RESULT_HAVE_BUFFER) {
spa_list_for_each(p, &node->ports[SPA_DIRECTION_OUTPUT], link) {
if (p->io->status == SPA_RESULT_HAVE_BUFFER)
@ -154,8 +158,8 @@ static inline void spa_graph_scheduler_push(struct spa_graph_scheduler *sched, s
}
spa_list_for_each_safe(n, t, &ready, ready_link) {
n->state = n->methods->schedule_input(n, n->user_data);
debug("peer %p scheduled in %d\n", n, n->state);
n->state = n->methods->process_input(n, n->user_data);
debug("peer %p processed in %d\n", n, n->state);
if (n->state == SPA_RESULT_HAVE_BUFFER)
spa_graph_scheduler_push(sched, n);
else {
@ -169,8 +173,8 @@ static inline void spa_graph_scheduler_push(struct spa_graph_scheduler *sched, s
n->ready_link.next = NULL;
}
node->state = node->methods->schedule_output(node, node->user_data);
debug("node %p scheduled out %d\n", node, node->state);
node->state = node->methods->process_output(node, node->user_data);
debug("node %p processed out %d\n", node, node->state);
if (node->state == SPA_RESULT_NEED_BUFFER) {
node->ready_in = 0;
spa_list_for_each(p, &node->ports[SPA_DIRECTION_INPUT], link) {