libcamera/monitors: rebase libcamera monitor into a bunch of hooks
This commit is contained in:

committed by
George Kiagiadakis

parent
6596d71c4f
commit
bb0e15e631
32
src/scripts/monitors/libcamera/enumerate-device.lua
Normal file
32
src/scripts/monitors/libcamera/enumerate-device.lua
Normal 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
|
Reference in New Issue
Block a user