libcamera/monitors: rebase libcamera monitor into a bunch of hooks

This commit is contained in:
Ashok Sidipotu
2023-07-12 12:51:22 +05:30
committed by George Kiagiadakis
parent 6596d71c4f
commit bb0e15e631
5 changed files with 260 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
-- WirePlumber
--
-- Copyright © 2023 Collabora Ltd.
-- @author Ashok Sidipotu <ashok.sidipotu@collabora.com>
--
-- SPDX-License-Identifier: MIT
log = Log.open_topic ("s-monitors-libcam")
local defaults = {}
defaults.properties = Json.Object {}
local config = {}
config.properties = Conf.get_section (
"monitor.libcamera.properties", defaults.properties):parse ()
function createCamDevice (parent, id, type, factory, properties)
source = source or Plugin.find ("standard-event-source")
local e = source:call ("create-event", "create-libcam-device", parent, properties)
e:set_data ("factory", factory)
e:set_data ("device-sub-id", id)
EventDispatcher.push_event (e)
end
monitor = SpaDevice ("api.libcamera.enum.manager", config.properties)
if monitor then
monitor:connect ("create-object", createCamDevice)
monitor:activate (Feature.SpaDevice.ENABLED)
else
log:notice ("PipeWire's libcamera SPA missing or broken. libcamera not supported.")
end