Merge pull request #85690 from LouisTakePILLz/obs-v4l2sink

This commit is contained in:
Jan Tojnar 2020-04-26 04:11:18 +02:00 committed by GitHub
commit 4bcf123f61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 47 deletions

View file

@ -1,25 +0,0 @@
From 5798a2691467604e89fd9fb1cd5289ebd1b1d7b8 Mon Sep 17 00:00:00 2001
From: Graham Christensen <graham@grahamc.com>
Date: Fri, 20 Mar 2020 22:32:02 -0400
Subject: [PATCH] find ObsPluginHelpers.cmake in the obs src
---
external/FindLibObs.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/external/FindLibObs.cmake b/external/FindLibObs.cmake
index ab0a3de..53a46b8 100644
--- a/external/FindLibObs.cmake
+++ b/external/FindLibObs.cmake
@@ -95,7 +95,7 @@ if(LIBOBS_FOUND)
set(LIBOBS_INCLUDE_DIRS ${LIBOBS_INCLUDE_DIR} ${W32_PTHREADS_INCLUDE_DIR})
set(LIBOBS_LIBRARIES ${LIBOBS_LIB} ${W32_PTHREADS_LIB})
- include(${LIBOBS_INCLUDE_DIR}/../cmake/external/ObsPluginHelpers.cmake)
+ include(${OBS_SRC}/cmake/external/ObsPluginHelpers.cmake)
# allows external plugins to easily use/share common dependencies that are often included with libobs (such as FFmpeg)
if(NOT DEFINED INCLUDED_LIBOBS_CMAKE_MODULES)
--
2.25.0

View file

@ -1,42 +1,55 @@
{ stdenv, fetchFromGitHub
, cmake, pkgconfig, wrapQtAppsHook
, obs-studio }:
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, qtbase
, obs-studio
}:
stdenv.mkDerivation {
pname = "obs-v4l2sink-unstable";
version = "20181012";
stdenv.mkDerivation rec {
pname = "obs-v4l2sink";
version = "0.1.0";
src = fetchFromGitHub {
owner = "CatxFish";
repo = "obs-v4l2sink";
rev = "1ec3c8ada0e1040d867ce567f177be55cd278378";
sha256 = "03ah91cm1qz26k90mfx51l0d598i9bcmw39lkikjs1msm4c9dfxx";
rev = version;
sha256 = "0l4lavaywih5lzwgxcbnvdrxhpvkrmh56li06s3aryikngxwsk3z";
};
nativeBuildInputs = [ cmake pkgconfig wrapQtAppsHook ];
buildInputs = [ obs-studio ];
nativeBuildInputs = [ cmake ];
buildInputs = [ qtbase obs-studio ];
patches = [
./0001-find-ObsPluginHelpers.cmake-in-the-obs-src.patch
# Fixes the segfault when stopping the plugin
(fetchpatch {
url = "https://github.com/CatxFish/obs-v4l2sink/commit/6604f01796d1b84a95714730ea51a6b8ac0e450b.diff";
sha256 = "0crcvw02dj0aqy7hnhizjdsnhiw03zmg6cbdkasxz2mrrbyc3s88";
})
];
cmakeFlags = [
"-DLIBOBS_INCLUDE_DIR=${obs-studio}/include/obs"
"-DLIBOBS_LIBRARIES=${obs-studio}/lib"
"-DCMAKE_CXX_FLAGS=-I${obs-studio.src}/UI/obs-frontend-api"
"-DOBS_SRC=${obs-studio.src}"
cmakeFlags = with lib; [
"-DLIBOBS_INCLUDE_DIR=${obs-studio.src}/libobs"
];
installPhase = ''
mkdir -p $out/share/obs/obs-plugins/v4l2sink/bin/64bit
cp ./v4l2sink.so $out/share/obs/obs-plugins/v4l2sink/bin/64bit/
# 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}
'';
meta = with stdenv.lib; {
meta = with lib; {
description = "obs studio output plugin for Video4Linux2 device";
homepage = "https://github.com/CatxFish/obs-v4l2sink";
maintainers = with maintainers; [ colemickens ];
maintainers = with maintainers; [ colemickens peelz ];
license = licenses.gpl2;
platforms = [ "x86_64-linux" ];
platforms = [ "x86_64-linux" "i686-linux" ];
};
}