Use v4l2 monitor

Use the v4l2 monitor to dynamically add and remove nodes.
Use the info from the monitor as parameter for the factory init and use
it to configure the new node.
Add info to the node.
Use info from the factory as properties on the PinosNode
This commit is contained in:
Wim Taymans 2016-09-15 17:51:34 +02:00
parent 9f53eda6cb
commit 6497c82a7d
23 changed files with 542 additions and 315 deletions

View file

@ -728,6 +728,7 @@ spa_v4l2_source_node_port_push_event (SpaNode *node,
static const SpaNode v4l2source_node = {
NULL,
sizeof (SpaNode),
NULL,
SPA_NODE_STATE_INIT,
spa_v4l2_source_node_get_props,
spa_v4l2_source_node_set_props,
@ -835,9 +836,10 @@ v4l2_source_clear (SpaHandle *handle)
static SpaResult
v4l2_source_init (const SpaHandleFactory *factory,
SpaHandle *handle,
const void *config)
const SpaDict *info)
{
SpaV4l2Source *this;
unsigned int i;
if (factory == NULL || handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
@ -859,6 +861,13 @@ v4l2_source_init (const SpaHandleFactory *factory,
this->state[0].export_buf = true;
for (i = 0; info && i < info->n_items; i ++) {
if (!strcmp (info->items[i].key, "device.path")) {
strncpy (this->props[1].device, info->items[i].value, 63);
this->props[1].props.unset_mask &= ~1;
}
}
return SPA_RESULT_OK;
}