Add wireplumber-config-agl bbappend 99/29599/2
authorMarius Vlad <marius.vlad@collabora.com>
Wed, 17 Jan 2024 11:11:23 +0000 (13:11 +0200)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Mon, 29 Jan 2024 12:11:17 +0000 (12:11 +0000)
This policy will change the default video source device to a
USB based camera device, such that camera-gstreamer (with default pipewiresrc)
would use the USB camera device to grab video frames.

Bug-AGL: SPEC-5024
Change-Id: I8dc124e1855de21e00dede6ff99f8b148f80b6dc
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl-demo/+/29599
ci-image-build: Jenkins Job builder account
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Tested-by: Jenkins Job builder account
ci-image-boot-test: Jenkins Job builder account

recipes-multimedia/wireplumber/files/30-v4l2-monitor.lua [new file with mode: 0644]
recipes-multimedia/wireplumber/wireplumber-config-agl_%.bbappend [new file with mode: 0644]

diff --git a/recipes-multimedia/wireplumber/files/30-v4l2-monitor.lua b/recipes-multimedia/wireplumber/files/30-v4l2-monitor.lua
new file mode 100644 (file)
index 0000000..3943862
--- /dev/null
@@ -0,0 +1,59 @@
+-- V4L2 monitor config file; with selecting by default USB camera --
+
+v4l2_monitor = {}
+v4l2_monitor.properties = {}
+
+v4l2_monitor.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,
+    },
+  },
+  {
+  matches = {
+    {
+      { "node.name", "matches", "v4l2_input*usb*" },
+    },
+  },
+  apply_properties = {
+    ["priority.driver"]        = 1300,
+    ["priority.session"]       = 1300,
+  },
+  },
+}
+
+function v4l2_monitor.enable()
+  load_monitor("v4l2", {
+    properties = v4l2_monitor.properties,
+    rules = v4l2_monitor.rules,
+  })
+end
diff --git a/recipes-multimedia/wireplumber/wireplumber-config-agl_%.bbappend b/recipes-multimedia/wireplumber/wireplumber-config-agl_%.bbappend
new file mode 100644 (file)
index 0000000..8f93868
--- /dev/null
@@ -0,0 +1,10 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://30-v4l2-monitor.lua"
+
+do_install:append() {
+    # override the one from meta-agl to be able to set as default USB camera
+    # such that camera-gstreamer and implicitly pipewire work out of the box
+    install -D -m 0644 ${WORKDIR}/30-v4l2-monitor.lua ${D}${sysconfdir}/wireplumber/host.lua.d/
+}
+