From 4fdccf529266dde29581b5ccf056321b29550bfd Mon Sep 17 00:00:00 2001 From: George Kiagiadakis <george.kiagiadakis@collabora.com> Date: Fri, 12 Feb 2021 19:48:52 +0200 Subject: [PATCH] config: mimick media-session's v4l2-monitor.conf --- src/config/config.lua | 3 -- src/config/config.lua.d/30-v4l2-monitor.lua | 47 +++++++++++++++++++++ src/config/config.lua.d/90-enable-video.lua | 1 + 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 src/config/config.lua.d/30-v4l2-monitor.lua create mode 100644 src/config/config.lua.d/90-enable-video.lua diff --git a/src/config/config.lua b/src/config/config.lua index a54bafea..274250f6 100644 --- a/src/config/config.lua +++ b/src/config/config.lua @@ -57,9 +57,6 @@ load_module("si-standard-link") -- -- load_pw_module ("spa-node-factory") --- Video4Linux2 device management via udev -load_monitor("v4l2") - -- Automatically suspends idle nodes after 3 seconds load_script("suspend-node.lua") diff --git a/src/config/config.lua.d/30-v4l2-monitor.lua b/src/config/config.lua.d/30-v4l2-monitor.lua new file mode 100644 index 00000000..45db9e36 --- /dev/null +++ b/src/config/config.lua.d/30-v4l2-monitor.lua @@ -0,0 +1,47 @@ +-- V4L2 monitor config file -- + +local properties = { } + +local rules = { + -- An array of matches/actions to evaluate. + { + -- Rules for matching a device or node. It is an array of + -- properties that all need to match the regexp. If any of the + -- matches work, the actions are executed for the object. + matches = { + { + -- This matches all cards. + { "device.name", "matches", "v4l2_device.*" }, + }, + }, + -- Apply properties on the matched object. + apply_properties = { + -- ["device.nick"] = "My Device", + }, + }, + { + matches = { + { + -- Matches all sources. + { "node.name", "matches", "v4l2_input.*" }, + }, + { + -- Matches all sinks. + { "node.name", "matches", "v4l2_output.*" }, + }, + }, + apply_properties = { + --["node.nick"] = "My Node", + --["priority.driver"] = 100, + --["priority.session"] = 100, + --["node.pause-on-idle"] = false, + }, + }, +} + +function enable_v4l2() + load_monitor("v4l2", { + properties = properties, + rules = rules, + }) +end diff --git a/src/config/config.lua.d/90-enable-video.lua b/src/config/config.lua.d/90-enable-video.lua new file mode 100644 index 00000000..ed904655 --- /dev/null +++ b/src/config/config.lua.d/90-enable-video.lua @@ -0,0 +1 @@ +enable_v4l2() -- GitLab