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

@ -31,6 +31,8 @@
#include <spa/memory.h>
#include <spa/debug.h>
extern const SpaHandleFactory spa_v4l2_source_factory;
typedef struct _SpaV4l2Monitor SpaV4l2Monitor;
typedef struct {
@ -81,16 +83,14 @@ fill_item (V4l2Item *item, struct udev_device *udevice)
if (udevice == NULL)
return;
item->item.id = udev_device_get_devnode (item->udevice);
item->item.id = udev_device_get_syspath (item->udevice);
item->item.flags = 0;
item->item.state = SPA_MONITOR_ITEM_STATE_AVAILABLE;
item->item.klass = "Video/Source";
item->item.info = &item->info;
item->item.factory = NULL;
item->item.config = NULL;
item->item.factory = &spa_v4l2_source_factory;
item->info.items = item->info_items;
i = 0;
item->info_items[i].key = "udev-probed";
item->info_items[i++].value = "1";
@ -351,7 +351,7 @@ v4l2_monitor_clear (SpaHandle *handle)
static SpaResult
v4l2_monitor_init (const SpaHandleFactory *factory,
SpaHandle *handle,
const void *config)
const SpaDict *info)
{
SpaV4l2Monitor *this;