mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-15 07:00:05 -05:00
Use graph to schedule things
Make real spa_graph nodes and ports and schedule those. This makes it possible to add explicit tee and mixers in the real graph. Rework the way we add and remove ports and nodes from the graph. Remove confusing pw_port_link and merge core with pw_link_new() Move scheduling in separate files, add some more graph-schedulers.
This commit is contained in:
parent
7297c18839
commit
d2f877912a
19 changed files with 845 additions and 428 deletions
|
|
@ -34,6 +34,7 @@
|
|||
#include <spa/format-utils.h>
|
||||
#include <spa/format-builder.h>
|
||||
#include <spa/graph.h>
|
||||
#include <spa/graph-scheduler1.h>
|
||||
|
||||
#define MODE_SYNC_PUSH (1<<0)
|
||||
#define MODE_SYNC_PULL (1<<1)
|
||||
|
|
@ -102,6 +103,7 @@ struct data {
|
|||
int iterations;
|
||||
|
||||
struct spa_graph graph;
|
||||
struct spa_graph_scheduler sched;
|
||||
struct spa_graph_node source_node;
|
||||
struct spa_graph_port source_out;
|
||||
struct spa_graph_port sink_in;
|
||||
|
|
@ -223,8 +225,8 @@ static void on_sink_pull(struct data *data)
|
|||
spa_node_process_output(data->source);
|
||||
spa_node_process_input(data->sink);
|
||||
} else {
|
||||
spa_graph_node_pull(&data->graph, &data->sink_node);
|
||||
while (spa_graph_node_iterate(&data->graph));
|
||||
spa_graph_scheduler_pull(&data->sched, &data->sink_node);
|
||||
while (spa_graph_scheduler_iterate(&data->sched));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -235,8 +237,8 @@ static void on_source_push(struct data *data)
|
|||
spa_node_process_output(data->source);
|
||||
spa_node_process_input(data->sink);
|
||||
} else {
|
||||
spa_graph_node_push(&data->graph, &data->source_node);
|
||||
while (spa_graph_node_iterate(&data->graph));
|
||||
spa_graph_scheduler_push(&data->sched, &data->source_node);
|
||||
while (spa_graph_scheduler_iterate(&data->sched));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -365,12 +367,12 @@ static int make_nodes(struct data *data)
|
|||
spa_node_port_set_io(data->sink, SPA_DIRECTION_INPUT, 0, &data->source_sink_io[0]);
|
||||
|
||||
spa_graph_node_add(&data->graph, &data->source_node,
|
||||
spa_graph_node_schedule_default, data->source);
|
||||
spa_graph_scheduler_default, data->source);
|
||||
data->source_node.flags = (data->mode & MODE_ASYNC_PUSH) ? SPA_GRAPH_NODE_FLAG_ASYNC : 0;
|
||||
spa_graph_port_add(&data->graph, &data->source_node,
|
||||
&data->source_out, SPA_DIRECTION_OUTPUT, 0, 0, &data->source_sink_io[0]);
|
||||
|
||||
spa_graph_node_add(&data->graph, &data->sink_node, spa_graph_node_schedule_default,
|
||||
spa_graph_node_add(&data->graph, &data->sink_node, spa_graph_scheduler_default,
|
||||
data->sink);
|
||||
data->sink_node.flags = (data->mode & MODE_ASYNC_PULL) ? SPA_GRAPH_NODE_FLAG_ASYNC : 0;
|
||||
spa_graph_port_add(&data->graph, &data->sink_node,
|
||||
|
|
@ -526,6 +528,7 @@ int main(int argc, char *argv[])
|
|||
const char *str;
|
||||
|
||||
spa_graph_init(&data.graph);
|
||||
spa_graph_scheduler_init(&data.sched, &data.graph);
|
||||
|
||||
data.map = &default_map.map;
|
||||
data.log = &default_log.log;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue