diff options
author | betaboon <betaboon@0x80.ninja> | 2023-04-07 12:29:47 +0200 |
---|---|---|
committer | betaboon <betaboon@0x80.ninja> | 2023-04-07 17:34:54 +0200 |
commit | 0bf0d21e9b10694b003ea48cf92562373e7c0208 (patch) | |
tree | be322b9030e6c4fc701acbd84af04d9702208c3f /pkgs/os-specific | |
parent | fc6c5c71b4c571aa0bef04b04f66780f1e88730f (diff) |
v4l2-relayd: init at 0.1.3
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r-- | pkgs/os-specific/linux/v4l2-relayd/default.nix | 81 | ||||
-rw-r--r-- | pkgs/os-specific/linux/v4l2-relayd/upstream-v4l2loopback-compatibility.patch | 16 |
2 files changed, 97 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/v4l2-relayd/default.nix b/pkgs/os-specific/linux/v4l2-relayd/default.nix new file mode 100644 index 0000000000000..293210fa9f570 --- /dev/null +++ b/pkgs/os-specific/linux/v4l2-relayd/default.nix @@ -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" ]; + }; +} diff --git a/pkgs/os-specific/linux/v4l2-relayd/upstream-v4l2loopback-compatibility.patch b/pkgs/os-specific/linux/v4l2-relayd/upstream-v4l2loopback-compatibility.patch new file mode 100644 index 0000000000000..6435352282560 --- /dev/null +++ b/pkgs/os-specific/linux/v4l2-relayd/upstream-v4l2loopback-compatibility.patch @@ -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; |