mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
fix target node path handling
This commit is contained in:
parent
837c23a370
commit
4153fac9bb
3 changed files with 34 additions and 39 deletions
|
|
@ -864,23 +864,6 @@ unhandle_socket (PinosStream *stream)
|
|||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
SpaProps props;
|
||||
uint32_t unset_mask;
|
||||
char target_node[64];
|
||||
} PortProps;
|
||||
|
||||
static const SpaPropInfo port_props_info[] =
|
||||
{
|
||||
{ 0, "pinos.target.node", "The pinos target node",
|
||||
SPA_PROP_FLAG_READWRITE,
|
||||
SPA_PROP_TYPE_STRING, 64,
|
||||
0, NULL,
|
||||
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
||||
NULL,
|
||||
offsetof (PortProps, target_node) },
|
||||
};
|
||||
|
||||
static void
|
||||
do_node_init (PinosStream *stream)
|
||||
{
|
||||
|
|
@ -889,7 +872,6 @@ do_node_init (PinosStream *stream)
|
|||
SpaControlCmdPortUpdate pu;
|
||||
SpaControlBuilder builder;
|
||||
SpaControl control;
|
||||
PortProps port_props;
|
||||
|
||||
control_builder_init (stream, &builder);
|
||||
nu.change_mask = SPA_CONTROL_CMD_NODE_UPDATE_MAX_INPUTS |
|
||||
|
|
@ -899,11 +881,6 @@ do_node_init (PinosStream *stream)
|
|||
nu.props = NULL;
|
||||
spa_control_builder_add_cmd (&builder, SPA_CONTROL_CMD_NODE_UPDATE, &nu);
|
||||
|
||||
port_props.props.n_prop_info = SPA_N_ELEMENTS (port_props_info);
|
||||
port_props.props.prop_info = port_props_info;
|
||||
strncpy (port_props.target_node, priv->path, 64);
|
||||
port_props.target_node[63] = '\0';
|
||||
|
||||
pu.port_id = 0;
|
||||
pu.change_mask = SPA_CONTROL_CMD_PORT_UPDATE_DIRECTION |
|
||||
SPA_CONTROL_CMD_PORT_UPDATE_POSSIBLE_FORMATS |
|
||||
|
|
@ -912,7 +889,7 @@ do_node_init (PinosStream *stream)
|
|||
pu.direction = priv->direction;
|
||||
pu.n_possible_formats = priv->possible_formats->len;
|
||||
pu.possible_formats = (const SpaFormat **)priv->possible_formats->pdata;
|
||||
pu.props = &port_props.props;
|
||||
pu.props = NULL;
|
||||
pu.info = &priv->port_info;
|
||||
priv->port_info.flags = SPA_PORT_INFO_FLAG_NONE |
|
||||
SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
|
||||
|
|
@ -1027,6 +1004,11 @@ do_connect (PinosStream *stream)
|
|||
PinosStreamPrivate *priv = stream->priv;
|
||||
PinosContext *context = priv->context;
|
||||
|
||||
if (priv->properties == NULL)
|
||||
priv->properties = pinos_properties_new (NULL, NULL);
|
||||
pinos_properties_set (priv->properties,
|
||||
"pinos.target.node", priv->path);
|
||||
|
||||
g_dbus_proxy_call (context->priv->daemon,
|
||||
"CreateClientNode",
|
||||
g_variant_new ("(s@a{sv})",
|
||||
|
|
|
|||
|
|
@ -271,8 +271,7 @@ on_node_event (SpaNode *node, SpaEvent *event, void *user_data)
|
|||
case SPA_EVENT_TYPE_PORT_ADDED:
|
||||
{
|
||||
SpaEventPortAdded *pa = event->data;
|
||||
PinosPort *port, *target;
|
||||
PinosLink *link;
|
||||
PinosPort *port;
|
||||
PinosNode *pnode = PINOS_NODE (this);
|
||||
GError *error = NULL;
|
||||
|
||||
|
|
@ -288,19 +287,6 @@ on_node_event (SpaNode *node, SpaEvent *event, void *user_data)
|
|||
}
|
||||
pinos_port_set_received_cb (port, on_received_buffer, on_received_event, this, NULL);
|
||||
|
||||
target = pinos_daemon_find_port (pinos_node_get_daemon (pnode),
|
||||
pinos_direction_reverse (pa->direction),
|
||||
"/org/pinos/node_1",
|
||||
NULL,
|
||||
NULL,
|
||||
&error);
|
||||
if (target == NULL) {
|
||||
g_warning ("proxy %p: can't find port target: %s", this, error->message);
|
||||
g_clear_error (&error);
|
||||
break;
|
||||
}
|
||||
link = pinos_link_new (pinos_node_get_daemon (pnode), port, target, NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
case SPA_EVENT_TYPE_PORT_REMOVED:
|
||||
|
|
|
|||
|
|
@ -185,6 +185,33 @@ no_node:
|
|||
static void
|
||||
on_port_added (PinosNode *node, PinosPort *port, PinosClient *client)
|
||||
{
|
||||
PinosDaemon *this;
|
||||
PinosProperties *props;
|
||||
PinosPort *target;
|
||||
const gchar *path;
|
||||
GError *error = NULL;
|
||||
PinosLink *link;
|
||||
|
||||
this = pinos_node_get_daemon (node);
|
||||
|
||||
props = pinos_node_get_properties (node);
|
||||
path = pinos_properties_get (props, "pinos.target.node");
|
||||
|
||||
if (path) {
|
||||
target = pinos_daemon_find_port (this,
|
||||
pinos_direction_reverse (port->direction),
|
||||
path,
|
||||
NULL,
|
||||
NULL,
|
||||
&error);
|
||||
if (target == NULL) {
|
||||
g_warning ("daemon %p: can't find port target: %s", this, error->message);
|
||||
g_clear_error (&error);
|
||||
return;
|
||||
}
|
||||
link = pinos_link_new (pinos_node_get_daemon (node), port, target, NULL);
|
||||
pinos_client_add_object (client, G_OBJECT (link));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue