Debian Codegraph @

src/scripts/monitors/v4l2/enumerate-device.lua

raw
1 -- WirePlumber
2 --
3 -- Copyright © 2023 Collabora Ltd.
4 -- @author Ashok Sidipotu <[email protected]>
5 --
6 -- SPDX-License-Identifier: MIT
7
8 cutils = require ("common-utils")
9 log = Log.open_topic ("s-monitors-v4l2")
10
11 config = {}
12 config.properties = Conf.get_section_as_properties ("monitor.v4l2.properties")
13
14 function createCamDevice (parent, id, type, factory, properties)
15 source = source or Plugin.find ("standard-event-source")
16
17 local e = source:call ("create-event", "create-v4l2-device", parent, nil)
18 e:set_data ("device-properties", properties)
19 e:set_data ("factory", factory)
20 e:set_data ("device-sub-id", id)
21
22 EventDispatcher.push_event (e)
23 end
24
25 monitor = SpaDevice ("api.v4l2.enum.udev", config.properties)
26 if monitor then
27 monitor:connect ("create-object", createCamDevice)
28 monitor:activate (Feature.SpaDevice.ENABLED)
29 else
30 log:notice ("PipeWire's V4L2 SPA plugin is missing or broken. " ..
31 "Some camera types may not be supported.")
32 end