mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
remote-node: handle driver nodes
This commit is contained in:
parent
f42e214c2d
commit
936dcbea2e
4 changed files with 35 additions and 13 deletions
|
|
@ -1241,24 +1241,12 @@ static void client_node_resource_pong(void *data, int seq)
|
||||||
void pw_client_node_registered(struct pw_client_node *this, uint32_t node_id)
|
void pw_client_node_registered(struct pw_client_node *this, uint32_t node_id)
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
|
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
|
||||||
struct pw_node *node = this->node;
|
|
||||||
struct mem *m;
|
|
||||||
|
|
||||||
pw_log_debug("client-node %p: %d", this, node_id);
|
pw_log_debug("client-node %p: %d", this, node_id);
|
||||||
pw_client_node_resource_transport(this->resource,
|
pw_client_node_resource_transport(this->resource,
|
||||||
node_id,
|
node_id,
|
||||||
impl->other_fds[0],
|
impl->other_fds[0],
|
||||||
impl->other_fds[1]);
|
impl->other_fds[1]);
|
||||||
|
|
||||||
|
|
||||||
m = ensure_mem(impl, node->activation->fd, SPA_DATA_MemFd, node->activation->flags);
|
|
||||||
|
|
||||||
pw_client_node_resource_set_activation(this->resource,
|
|
||||||
node_id,
|
|
||||||
impl->other_fds[1],
|
|
||||||
m->id,
|
|
||||||
0,
|
|
||||||
sizeof(struct pw_node_activation));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void node_initialized(void *data)
|
static void node_initialized(void *data)
|
||||||
|
|
|
||||||
|
|
@ -970,6 +970,8 @@ static void client_node_initialized(void *data)
|
||||||
else
|
else
|
||||||
monitor = false;
|
monitor = false;
|
||||||
|
|
||||||
|
impl->client_node->node->driver_node = impl->this.node;
|
||||||
|
|
||||||
impl->client_port = pw_node_find_port(impl->client_node->node, impl->direction, 0);
|
impl->client_port = pw_node_find_port(impl->client_node->node, impl->direction, 0);
|
||||||
if (impl->client_port == NULL)
|
if (impl->client_port == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1141,6 +1141,35 @@ static const struct pw_proxy_events proxy_events = {
|
||||||
.destroy = node_proxy_destroy,
|
.destroy = node_proxy_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int node_ready(void *d, int status)
|
||||||
|
{
|
||||||
|
struct node_data *data = d;
|
||||||
|
struct pw_node *node = data->node;
|
||||||
|
uint64_t cmd = 1;
|
||||||
|
|
||||||
|
pw_log_trace("node %p: ready driver:%d exported:%d status:%d", node,
|
||||||
|
node->driver, node->exported, status);
|
||||||
|
|
||||||
|
if (status == SPA_STATUS_HAVE_BUFFER)
|
||||||
|
spa_graph_node_process(&node->rt.root);
|
||||||
|
|
||||||
|
if (write(data->rtwritefd, &cmd, sizeof(cmd)) != sizeof(cmd))
|
||||||
|
pw_log_warn("node %p: write failed %m", node);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int node_reuse_buffer(void *data, uint32_t port_id, uint32_t buffer_id)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct spa_node_callbacks node_callbacks = {
|
||||||
|
SPA_VERSION_NODE_CALLBACKS,
|
||||||
|
.ready = node_ready,
|
||||||
|
.reuse_buffer = node_reuse_buffer
|
||||||
|
};
|
||||||
|
|
||||||
static struct pw_proxy *node_export(struct pw_remote *remote, void *object, bool do_free)
|
static struct pw_proxy *node_export(struct pw_remote *remote, void *object, bool do_free)
|
||||||
{
|
{
|
||||||
struct pw_node *node = object;
|
struct pw_node *node = object;
|
||||||
|
|
@ -1179,6 +1208,7 @@ static struct pw_proxy *node_export(struct pw_remote *remote, void *object, bool
|
||||||
pw_array_ensure_size(&data->links, sizeof(struct link) * 64);
|
pw_array_ensure_size(&data->links, sizeof(struct link) * 64);
|
||||||
|
|
||||||
pw_proxy_add_listener(proxy, &data->proxy_listener, &proxy_events, data);
|
pw_proxy_add_listener(proxy, &data->proxy_listener, &proxy_events, data);
|
||||||
|
spa_node_set_callbacks(node->node, &node_callbacks, data);
|
||||||
pw_node_add_listener(node, &data->node_listener, &node_events, data);
|
pw_node_add_listener(node, &data->node_listener, &node_events, data);
|
||||||
|
|
||||||
pw_client_node_proxy_add_listener(data->node_proxy,
|
pw_client_node_proxy_add_listener(data->node_proxy,
|
||||||
|
|
|
||||||
|
|
@ -900,8 +900,10 @@ static int node_ready(void *data, int status)
|
||||||
pw_log_trace("node %p: ready driver:%d exported:%d %p status:%d", node,
|
pw_log_trace("node %p: ready driver:%d exported:%d %p status:%d", node,
|
||||||
node->driver, node->exported, driver, status);
|
node->driver, node->exported, driver, status);
|
||||||
|
|
||||||
if (driver->rt.root.graph == NULL)
|
if (driver->rt.root.graph == NULL) {
|
||||||
|
pw_log_error("node %p: no graph", node);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
spa_graph_run(driver->rt.driver);
|
spa_graph_run(driver->rt.driver);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue