Add: v4l2-relayd (#2904) (#2909)

(cherry picked from commit 8cec8576cf)

Co-authored-by: Gil <rockgrub@protonmail.com>
This commit is contained in:
Raboneko
2025-01-12 02:13:47 -08:00
committed by GitHub
parent 3ab42e4f9a
commit 5b531887f8
5 changed files with 107 additions and 0 deletions
@@ -0,0 +1,34 @@
From 1be2bafe7a9aabf0389da9e685051859c56e64ce Mon Sep 17 00:00:00 2001
From: Kate Hsuan <hpa@redhat.com>
Date: Thu, 9 Feb 2023 15:26:37 +0800
Subject: [PATCH] Set a new ID offset for the private event
According to the v4l2loopback, the private event ID should be
start from V4L2_EVENT_PRIVATE_START+0x08E00000. Therefore, the
V4L2_EVENT_PRI_CLIENT_USAGE is V4L2_EVENT_PRIVATE_START+
0x08E00000+1
Signed-off-by: Kate Hsuan <hpa@redhat.com>
---
src/v4l2-relayd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/v4l2-relayd.c b/src/v4l2-relayd.c
index 21bb0d5..d731af0 100644
--- a/src/v4l2-relayd.c
+++ b/src/v4l2-relayd.c
@@ -27,7 +27,10 @@
#include <gst/app/gstappsrc.h>
#include <gst/video/video-info.h>
-#define V4L2_EVENT_PRI_CLIENT_USAGE V4L2_EVENT_PRIVATE_START
+#define V4L2LOOPBACK_EVENT_OFFSET 0x08E00000
+#define V4L2_EVENT_PRI_CLIENT_USAGE (V4L2_EVENT_PRIVATE_START+\
+ V4L2LOOPBACK_EVENT_OFFSET+\
+ 1)
struct v4l2_event_client_usage {
__u32 count;
--
2.39.2
+8
View File
@@ -0,0 +1,8 @@
project pkg {
rpm {
spec = "v4l2-relayd.spec"
}
labels {
weekly = 1
}
}
+1
View File
@@ -0,0 +1 @@
rpm.version(gitlab("24306684"));
@@ -0,0 +1 @@
enable v4l2-relayd.service
+63
View File
@@ -0,0 +1,63 @@
%global commit 2e4d5c9ba53bfe8cfe16ea91932c8e5ecb090a87
%global commitdate 20220126
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: v4l2-relayd
Summary: Utils for relaying the video stream between two video devices
Version: %{commitdate}.%{shortcommit}
Release: 1%{?dist}
License: GPL-2.0-only
Source0: https://gitlab.com/vicamo/v4l2-relayd//-/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
Source1: v4l2-relayd.preset
### RPM Fusion | [v4l2-relayd] Set output stream to I420
## https://lists.rpmfusion.org/archives/list/rpmfusion-commits@lists.rpmfusion.org/thread/VUMAJABDYISF3UVOSESSFYQBAMQK7VKY/
Patch0: 0000-set-new-offset.patch
BuildRequires: systemd-rpm-macros
BuildRequires: gcc
BuildRequires: g++
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: glib2-devel
BuildRequires: gstreamer1-devel
BuildRequires: gstreamer1-plugins-base-devel
BuildRequires: systemd
Requires: v4l2loopback
%description
This is used to relay the input GStreamer source to an output source or a V4L2 device.
%prep
%autosetup -p1 -n %{name}-%{commit}
autoreconf --force --install --verbose
%build
%configure
%make_build
%install
%make_install modprobedir=%{_modprobedir}
sed -i '/^EnvironmentFile=\/etc\/default\/v4l2-relayd/a EnvironmentFile=-\/run\/v4l2-relayd' %{buildroot}%{_unitdir}/v4l2-relayd.service
sed -i 's/videoconvert/videoconvert ! video\/x-raw,format=I420/g' %{buildroot}%{_unitdir}/v4l2-relayd.service
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_presetdir}/95-v4l2-relayd.preset
%post
%systemd_post v4l2-relayd.service
%preun
%systemd_preun v4l2-relayd.service
%postun
%systemd_postun_with_restart v4l2-relayd.service
%files
%license LICENSE
%{_bindir}/v4l2-relayd
%{_sysconfdir}/default/v4l2-relayd
%{_modprobedir}/v4l2-relayd.conf
%{_modulesloaddir}/v4l2-relayd.conf
%{_unitdir}/v4l2-relayd.service
%{_presetdir}/95-v4l2-relayd.preset
%changelog
%autochangelog