2020-04-21 15:59:49 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2020-04-21 16:00:36 +01:00
|
|
|
, fetchpatch
|
2020-04-21 15:59:49 +01:00
|
|
|
, cmake
|
|
|
|
, qtbase
|
|
|
|
, obs-studio
|
|
|
|
}:
|
2020-03-21 02:01:04 +00:00
|
|
|
|
2020-04-21 15:59:49 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "obs-v4l2sink";
|
2020-09-22 20:27:46 +01:00
|
|
|
version = "0.1.0-12-g1ec3c8a";
|
2020-03-21 02:01:04 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "CatxFish";
|
|
|
|
repo = "obs-v4l2sink";
|
2020-04-21 15:59:49 +01:00
|
|
|
rev = version;
|
2020-09-22 20:27:46 +01:00
|
|
|
sha256 = "03ah91cm1qz26k90mfx51l0d598i9bcmw39lkikjs1msm4c9dfxx";
|
2020-03-21 02:01:04 +00:00
|
|
|
};
|
|
|
|
|
2020-04-21 15:59:49 +01:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = [ qtbase obs-studio ];
|
2020-03-21 02:01:04 +00:00
|
|
|
|
2020-04-21 16:00:36 +01:00
|
|
|
patches = [
|
|
|
|
# Fixes the segfault when stopping the plugin
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/CatxFish/obs-v4l2sink/commit/6604f01796d1b84a95714730ea51a6b8ac0e450b.diff";
|
|
|
|
sha256 = "0crcvw02dj0aqy7hnhizjdsnhiw03zmg6cbdkasxz2mrrbyc3s88";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-04-21 15:59:49 +01:00
|
|
|
cmakeFlags = with lib; [
|
|
|
|
"-DLIBOBS_INCLUDE_DIR=${obs-studio.src}/libobs"
|
2020-03-21 02:01:04 +00:00
|
|
|
];
|
|
|
|
|
2020-04-21 15:59:49 +01:00
|
|
|
# obs-studio expects the shared object to be located in bin/32bit or bin/64bit
|
|
|
|
# https://github.com/obsproject/obs-studio/blob/d60c736cb0ec0491013293c8a483d3a6573165cb/libobs/obs-nix.c#L48
|
|
|
|
postInstall = let
|
|
|
|
pluginPath = {
|
|
|
|
i686-linux = "bin/32bit";
|
|
|
|
x86_64-linux = "bin/64bit";
|
|
|
|
}.${stdenv.targetPlatform.system} or (throw "Unsupported system: ${stdenv.targetPlatform.system}");
|
|
|
|
in ''
|
|
|
|
mkdir -p $out/share/obs/obs-plugins/v4l2sink/${pluginPath}
|
|
|
|
ln -s $out/lib/obs-plugins/v4l2sink.so $out/share/obs/obs-plugins/v4l2sink/${pluginPath}
|
2020-03-21 02:01:04 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-21 15:59:49 +01:00
|
|
|
meta = with lib; {
|
2020-03-21 02:01:04 +00:00
|
|
|
description = "obs studio output plugin for Video4Linux2 device";
|
|
|
|
homepage = "https://github.com/CatxFish/obs-v4l2sink";
|
2020-04-25 00:25:48 +01:00
|
|
|
maintainers = with maintainers; [ colemickens peelz ];
|
2020-03-21 02:01:04 +00:00
|
|
|
license = licenses.gpl2;
|
2020-04-21 15:59:49 +01:00
|
|
|
platforms = [ "x86_64-linux" "i686-linux" ];
|
2020-03-21 02:01:04 +00:00
|
|
|
};
|
|
|
|
}
|