mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-05 07:48:01 +02:00
monitors: enable libcamera by default and set priority on all camera nodes
Currently v4l2 nodes will get higher priority than libcamera ones. The default can be changed, of course, with wpctl. Things are still not great if a camera is enumerated by both monitors. The first node to be linked will grab the device and the second one from the other subsystem will fail to negotiate.
This commit is contained in:
parent
13b85bd4a2
commit
9ec2757d27
3 changed files with 22 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ default_access.enable()
|
|||
-- Load devices
|
||||
alsa_monitor.enable()
|
||||
v4l2_monitor.enable()
|
||||
libcamera_monitor.enable()
|
||||
|
||||
-- Track/store/restore user choices about devices
|
||||
device_defaults.enable()
|
||||
|
|
|
|||
|
|
@ -86,6 +86,20 @@ function createNode(parent, id, type, factory, properties)
|
|||
-- sanitize description, replace ':' with ' '
|
||||
properties["node.description"] = desc:gsub("(:)", " ")
|
||||
|
||||
-- set priority
|
||||
if not properties["priority.session"] then
|
||||
local location = properties["api.libcamera.location"]
|
||||
local priority = 700
|
||||
if location == "front" then
|
||||
priority = priority + 150
|
||||
elseif location == "external" then
|
||||
priority = priority + 100
|
||||
elseif location == "back" then
|
||||
priority = priority + 50
|
||||
end
|
||||
properties["priority.session"] = priority
|
||||
end
|
||||
|
||||
-- apply properties from config.rules
|
||||
rulesApplyProperties(properties)
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,13 @@ function createNode(parent, id, type, factory, properties)
|
|||
-- sanitize description, replace ':' with ' '
|
||||
properties["node.description"] = desc:gsub("(:)", " ")
|
||||
|
||||
-- set priority
|
||||
if not properties["priority.session"] then
|
||||
local path = properties["api.v4l2.path"] or "/dev/video100"
|
||||
local dev = path:gsub("/dev/video(%d+)", "%1")
|
||||
properties["priority.session"] = 1000 - (tonumber(dev) * 10)
|
||||
end
|
||||
|
||||
-- apply properties from config.rules
|
||||
rulesApplyProperties(properties)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue