v4l2-relayd

This commit is contained in:
Ryan Hughes
2026-05-08 01:04:52 -04:00
parent 8319f510f5
commit 8ba1b8e9c7
6 changed files with 162 additions and 6 deletions
+3 -1
View File
@@ -1,7 +1,7 @@
pkgbase = v4l2-relayd
pkgdesc = Plays gstreamer sources into v4l2loopback devices.
pkgver = 0.2.0
pkgrel = 1
pkgrel = 2.1
url = https://gitlab.com/vicamo/v4l2-relayd
arch = x86_64
license = GPL
@@ -12,6 +12,8 @@ pkgbase = v4l2-relayd
depends = gst-plugins-good
depends = v4l2loopback-dkms
source = https://gitlab.com/vicamo/v4l2-relayd/-/archive/upstream/0.2.0/v4l2-relayd-upstream-0.2.0.tar.gz
source = 0001-reset-output-on-idle.patch
sha256sums = 0c063edf18dcc6edcdef46e695128cfc2b2d60964ea8538c7e79a2454310c53d
sha256sums = SKIP
pkgname = v4l2-relayd
+44
View File
@@ -0,0 +1,44 @@
# v4l2-relayd - reset output on idle
## Overview
Omarchy carries a small patch for `v4l2-relayd` that resets the output pipeline after a real camera streaming session ends.
Without this, stale `v4l2loopback` state can cause format negotiation failures when switching between camera apps.
## What the patches do
### `patches/reset-output-on-idle.patch`
Adds the package source patch file:
```text
0001-reset-output-on-idle.patch
```
That source patch modifies `src/v4l2-relayd.c` to:
- track how long the input pipeline was active
- ignore brief PipeWire/WirePlumber probes
- after a real streaming session longer than 3 seconds, reset the output pipeline from `READY` back to `PLAYING`
### `patches/add-reset-output-source.patch`
Updates `PKGBUILD` to:
- include `0001-reset-output-on-idle.patch` in `source=()`
- add a `SKIP` checksum for the local patch file
- apply the patch in `prepare()`
## pkgrel
`package.json` includes a `pkgrel` suffix/offset so users who already received Omarchy's previous `0.2.0-2` build will upgrade to `0.2.0-2.1`.
The `pkgrel` metadata is automatically removed by `bin/sync-aur` when AUR moves to a new `pkgver`.
## Testing
```bash
bin/sync-aur v4l2-relayd
bin/repo build --package v4l2-relayd
```
+6 -1
View File
@@ -1,3 +1,8 @@
{
"source": "aur"
"source": "aur",
"pkgrel": {
"suffix": 1,
"offset": 1
},
"upstream_commit": "086fa284d7f5ad562ea6ba79b3cb4fd798e759d3"
}
@@ -0,0 +1,65 @@
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,35 +8,42 @@
url="https://gitlab.com/vicamo/v4l2-relayd"
license=('GPL')
depends=(
- 'glib2'
- 'gstreamer'
- 'gst-plugins-base-libs'
- 'gst-plugins-good'
- 'v4l2loopback-dkms'
+ 'glib2'
+ 'gstreamer'
+ 'gst-plugins-base-libs'
+ 'gst-plugins-good'
+ 'v4l2loopback-dkms'
)
makedepends=('git')
-source=("https://gitlab.com/vicamo/v4l2-relayd/-/archive/upstream/${pkgver}/v4l2-relayd-upstream-${pkgver}.tar.gz")
-sha256sums=('0c063edf18dcc6edcdef46e695128cfc2b2d60964ea8538c7e79a2454310c53d')
+source=("https://gitlab.com/vicamo/v4l2-relayd/-/archive/upstream/${pkgver}/v4l2-relayd-upstream-${pkgver}.tar.gz"
+ "0001-reset-output-on-idle.patch")
+sha256sums=('0c063edf18dcc6edcdef46e695128cfc2b2d60964ea8538c7e79a2454310c53d'
+ 'SKIP')
+
+prepare() {
+ cd "$srcdir/${pkgname}-upstream-${pkgver}"
+ patch -p0 < "$srcdir/0001-reset-output-on-idle.patch"
+}
build() {
- cd "$srcdir/${pkgname}-upstream-${pkgver}"
- ./autogen.sh
- ./configure --prefix=/usr --sysconfdir=/etc
- make
+ cd "$srcdir/${pkgname}-upstream-${pkgver}"
+ ./autogen.sh
+ ./configure --prefix=/usr --sysconfdir=/etc
+ make
}
check() {
- cd "$srcdir/${pkgname}-upstream-${pkgver}"
- make -k check
+ cd "$srcdir/${pkgname}-upstream-${pkgver}"
+ make -k check
}
package() {
- cd "$srcdir/${pkgname}-upstream-${pkgver}"
- make DESTDIR="$pkgdir/" install
+ cd "$srcdir/${pkgname}-upstream-${pkgver}"
+ make DESTDIR="$pkgdir/" install
- # The module supports configuring multiple loopback devices; since we
- # don't know whether the user might be using some for other purposes,
- # we should not override its options unilaterally.
- rm "$pkgdir/etc/modprobe.d/v4l2-relayd.conf"
- rmdir "$pkgdir/etc/modprobe.d/"
+ # The module supports configuring multiple loopback devices; since we
+ # don't know whether the user might be using some for other purposes,
+ # we should not override its options unilaterally.
+ rm "$pkgdir/etc/modprobe.d/v4l2-relayd.conf"
+ rmdir "$pkgdir/etc/modprobe.d/"
}
@@ -0,0 +1,40 @@
--- /dev/null
+++ b/0001-reset-output-on-idle.patch
@@ -0,0 +1,37 @@
+--- src/v4l2-relayd.c.orig 2026-03-30 09:59:14.804751921 -0700
++++ src/v4l2-relayd.c 2026-03-30 09:59:14.827617699 -0700
+@@ -58,6 +58,7 @@
+ static GstElement *input_pipeline = NULL;
+ static GstElement *output_pipeline = NULL;
+ static GstElement *splash_pipeline = NULL;
++static GTimer *input_timer = NULL;
+
+ static gboolean backend_pipeline_bus_call (GstBus *bus,
+ GstMessage *msg,
+@@ -278,6 +279,10 @@
+ {
+ gst_element_set_state (splash_pipeline_get (), GST_STATE_NULL);
+ gst_element_set_state (input_pipeline_get (), GST_STATE_PLAYING);
++ if (input_timer == NULL)
++ input_timer = g_timer_new ();
++ else
++ g_timer_start (input_timer);
+ }
+
+ static void
+@@ -285,6 +290,15 @@
+ {
+ if (input_pipeline != NULL)
+ gst_element_set_state (input_pipeline, GST_STATE_NULL);
++ /* After a real streaming session (>3s), reset the output pipeline
++ * to clear stale v4l2loopback state that causes format negotiation
++ * failures when switching between camera apps. Brief probes from
++ * PipeWire/WirePlumber (<1s) are skipped. */
++ if (input_timer != NULL && g_timer_elapsed (input_timer, NULL) > 3.0
++ && output_pipeline != NULL) {
++ gst_element_set_state (output_pipeline, GST_STATE_READY);
++ gst_element_set_state (output_pipeline, GST_STATE_PLAYING);
++ }
+ if (input_pipeline != NULL)
+ gst_element_set_state (splash_pipeline, GST_STATE_PLAYING);
+ }
+4 -4
View File
@@ -2,7 +2,7 @@
pkgname=v4l2-relayd
pkgver=0.2.0
pkgrel=2
pkgrel=2.1
pkgdesc="Plays gstreamer sources into v4l2loopback devices."
arch=('x86_64')
url="https://gitlab.com/vicamo/v4l2-relayd"
@@ -16,13 +16,13 @@ depends=(
)
makedepends=('git')
source=("https://gitlab.com/vicamo/v4l2-relayd/-/archive/upstream/${pkgver}/v4l2-relayd-upstream-${pkgver}.tar.gz"
"0001-reset-output-on-idle.patch")
"0001-reset-output-on-idle.patch")
sha256sums=('0c063edf18dcc6edcdef46e695128cfc2b2d60964ea8538c7e79a2454310c53d'
'SKIP')
'SKIP')
prepare() {
cd "$srcdir/${pkgname}-upstream-${pkgver}"
patch -p0 <"$srcdir/0001-reset-output-on-idle.patch"
patch -p0 < "$srcdir/0001-reset-output-on-idle.patch"
}
build() {