v4l2-relayd: init at 0.1.3

This commit is contained in:
betaboon 2023-04-07 12:29:47 +02:00
parent fc6c5c71b4
commit 0bf0d21e9b
3 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,81 @@
{ lib
, stdenv
, fetchgit
, autoreconfHook
, coreutils
, glib
, gnugrep
, gst_all_1
, icamerasrc
, libtool
, makeWrapper
, pkg-config
, which
}:
let
gst = [
gst_all_1.gstreamer.out
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
icamerasrc
];
in
stdenv.mkDerivation rec {
pname = "v4l2-relayd-${icamerasrc.ipuVersion}";
version = "0.1.3";
src = fetchgit {
url = "https://git.launchpad.net/v4l2-relayd";
rev = "refs/tags/upstream/${version}";
hash = "sha256-oU6naDFZ0PQVHZ3brANfMULDqYMYxeJN+MCUCvN/DpU=";
};
patches = [
./upstream-v4l2loopback-compatibility.patch
];
nativeBuildInputs = [
autoreconfHook
libtool
makeWrapper
pkg-config
which
];
buildInputs = [
glib
] ++ gst;
preConfigure = "./autogen.sh --prefix=$out";
postInstall = ''
mkdir -p $out/lib/systemd/system $out/etc/default
cp data/systemd/v4l2-relayd.service $out/lib/systemd/system
cp data/etc/default/v4l2-relayd $out/etc/default
substituteInPlace $out/lib/systemd/system/v4l2-relayd.service \
--replace grep ${gnugrep}/bin/grep \
--replace cut ${coreutils}/bin/cut \
--replace /usr/bin/test ${coreutils}/bin/test \
--replace /usr/bin/v4l2-relayd $out/bin/v4l2-relayd \
--replace /etc/default $out/etc/default \
--replace "DeviceAllow=char-video4linux" ""
substituteInPlace $out/etc/default/v4l2-relayd \
--replace 'FORMAT=YUY2' 'FORMAT=NV12' \
--replace 'CARD_LABEL="Virtual Camera"' 'CARD_LABEL="Intel MIPI Camera"' \
--replace 'VIDEOSRC="videotestsrc"' 'VIDEOSRC="icamerasrc"'
wrapProgram $out/bin/v4l2-relayd \
--prefix GST_PLUGIN_PATH : ${lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" gst}
'';
meta = with lib; {
description = "Streaming relay for v4l2loopback using GStreamer";
homepage = "https://git.launchpad.net/v4l2-relayd";
license = licenses.gpl2;
maintainers = with maintainers; [ betaboon ];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -0,0 +1,16 @@
diff --git a/src/v4l2-relayd.c b/src/v4l2-relayd.c
index 21bb0d5..cfc9e27 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_BASE (V4L2_EVENT_PRIVATE_START)
+#define V4L2LOOPBACK_EVENT_OFFSET 0x08E00000
+#define V4L2_EVENT_PRI_CLIENT_USAGE \
+ (V4L2LOOPBACK_EVENT_BASE + V4L2LOOPBACK_EVENT_OFFSET + 1)
struct v4l2_event_client_usage {
__u32 count;

View file

@ -27424,6 +27424,13 @@ with pkgs;
v4l-utils = qt5.callPackage ../os-specific/linux/v4l-utils { };
v4l2-relayd-ipu6 = callPackage ../os-specific/linux/v4l2-relayd {
icamerasrc = gst_all_1.icamerasrc-ipu6;
};
v4l2-relayd-ipu6ep = callPackage ../os-specific/linux/v4l2-relayd {
icamerasrc = gst_all_1.icamerasrc-ipu6ep;
};
vendir = callPackage ../development/tools/vendir { };
vndr = callPackage ../development/tools/vndr { };