work on port-update control message

Serialize format and properties.
Simplify the properties by moving the unset-mask inside the property
structure. We can then also just use the index of the property as the
bit in the mask.
Work on stopping on disconnect
This commit is contained in:
Wim Taymans 2016-08-08 22:10:57 +02:00
parent de53315f6e
commit 0d2f5a1386
24 changed files with 318 additions and 238 deletions

View file

@ -864,6 +864,23 @@ 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)
{
@ -872,6 +889,7 @@ 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 |
@ -881,6 +899,11 @@ 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 |
@ -889,7 +912,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 = NULL;
pu.props = &port_props.props;
pu.info = &priv->port_info;
priv->port_info.flags = SPA_PORT_INFO_FLAG_NONE |
SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
@ -1050,9 +1073,9 @@ pinos_stream_connect (PinosStream *stream,
priv->direction = direction;
g_free (priv->path);
priv->path = g_strdup (port_path);
priv->flags = flags;
if (priv->possible_formats)
g_ptr_array_unref (priv->possible_formats);
priv->flags = flags;
priv->possible_formats = possible_formats;
stream_set_state (stream, PINOS_STREAM_STATE_CONNECTING, NULL);