summaryrefslogtreecommitdiffstats
path: root/pkgs/applications/video/obs-studio
diff options
context:
space:
mode:
authorRaphael Robatsch <raphael-git@tapesoftware.net>2022-10-14 17:10:12 +0200
committerFranz Pletz <fpletz@fnordicwalking.de>2022-11-11 07:04:11 +0100
commita9dacbba4203a3dfa84d8c5012da96d63e38b2fe (patch)
tree27c83e873b2143c7218cd1373cd0ec6fda5531ee /pkgs/applications/video/obs-studio
parent9e7a3b07e472fe9485e01d8f418b1f2ea8170f53 (diff)
obs-studio-plugins.obs-backgroundremoval: 0.4.0 -> unstable-2022-05-02
There is no release with OBS 28 support yet.
Diffstat (limited to 'pkgs/applications/video/obs-studio')
-rw-r--r--pkgs/applications/video/obs-studio/plugins/default.nix2
-rw-r--r--pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/default.nix (renamed from pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval.nix)18
-rw-r--r--pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/includes.patch (renamed from pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval-includes.patch)8
-rw-r--r--pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/use-cpu-backend.patch32
4 files changed, 49 insertions, 11 deletions
diff --git a/pkgs/applications/video/obs-studio/plugins/default.nix b/pkgs/applications/video/obs-studio/plugins/default.nix
index be4637f4d0ef..fd2cee40f6ec 100644
--- a/pkgs/applications/video/obs-studio/plugins/default.nix
+++ b/pkgs/applications/video/obs-studio/plugins/default.nix
@@ -8,7 +8,7 @@
{
looking-glass-obs = callPackage ./looking-glass-obs.nix { };
- obs-backgroundremoval = callPackage ./obs-backgroundremoval.nix { };
+ obs-backgroundremoval = callPackage ./obs-backgroundremoval { };
obs-gstreamer = callPackage ./obs-gstreamer.nix { };
diff --git a/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval.nix b/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/default.nix
index 6175a48a1b96..79a3f82fec87 100644
--- a/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval.nix
+++ b/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/default.nix
@@ -1,7 +1,6 @@
{ lib
, stdenv
, fetchFromGitHub
-, fetchpatch
, cmake
, obs-studio
, onnxruntime
@@ -10,15 +9,23 @@
stdenv.mkDerivation rec {
pname = "obs-backgroundremoval";
- version = "0.4.0";
+ version = "unstable-2022-05-02";
src = fetchFromGitHub {
owner = "royshil";
repo = "obs-backgroundremoval";
- rev = "v${version}";
- sha256 = "sha256-TI1FlhE0+JL50gAZCSsI+g8savX8GRQkH3jYli/66hQ=";
+ rev = "cc9d4a5711f9388ed110230f9f793bb071577a23";
+ hash = "sha256-xkVZ4cB642p4DvZAPwI2EVhkfVl5lJhgOQobjNMqpec=";
};
+ patches = [
+ # Fix c++ include directives
+ ./includes.patch
+
+ # Use CPU backend instead of CUDA/DirectML
+ ./use-cpu-backend.patch
+ ];
+
nativeBuildInputs = [ cmake ];
buildInputs = [ obs-studio onnxruntime opencv ];
@@ -29,10 +36,9 @@ stdenv.mkDerivation rec {
"-DOnnxruntime_INCLUDE_DIRS=${onnxruntime.dev}/include/onnxruntime/core/session"
];
- patches = [ ./obs-backgroundremoval-includes.patch ];
prePatch = ''
- sed -i 's/version_from_git()/set(VERSION "${version}")/' CMakeLists.txt
+ sed -i 's/version_from_git()/set(VERSION "0.4.0")/' CMakeLists.txt
'';
meta = with lib; {
diff --git a/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval-includes.patch b/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/includes.patch
index 2a1b59a6b128..b99fc1181881 100644
--- a/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval-includes.patch
+++ b/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/includes.patch
@@ -1,5 +1,5 @@
diff --git a/src/Model.h b/src/Model.h
-index 5c21eae..74b8078 100644
+index 6a73745..6bb8a7d 100644
--- a/src/Model.h
+++ b/src/Model.h
@@ -1,13 +1,8 @@
@@ -13,11 +13,11 @@ index 5c21eae..74b8078 100644
-#include <onnxruntime_cxx_api.h>
-#include <cpu_provider_factory.h>
-#endif
- #ifdef _WIN32
+
#ifdef WITH_CUDA
#include <cuda_provider_factory.h>
diff --git a/src/background-filter.cpp b/src/background-filter.cpp
-index 9fa5794..5d66aee 100644
+index 0853818..32c6483 100644
--- a/src/background-filter.cpp
+++ b/src/background-filter.cpp
@@ -1,13 +1,8 @@
@@ -31,6 +31,6 @@ index 9fa5794..5d66aee 100644
-#include <onnxruntime_cxx_api.h>
-#include <cpu_provider_factory.h>
-#endif
- #ifdef _WIN32
#ifdef WITH_CUDA
#include <cuda_provider_factory.h>
+ #endif
diff --git a/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/use-cpu-backend.patch b/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/use-cpu-backend.patch
new file mode 100644
index 000000000000..0db5592e5cdb
--- /dev/null
+++ b/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/use-cpu-backend.patch
@@ -0,0 +1,32 @@
+From d04e167f9081a3ec8c49f0967b5b0cec79e40e4d Mon Sep 17 00:00:00 2001
+From: Raphael Robatsch <raphael-git@tapesoftware.net>
+Date: Fri, 14 Oct 2022 16:55:36 +0200
+Subject: [PATCH] unix: use CPU backend instead of DirectML
+
+---
+ src/background-filter.cpp | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/background-filter.cpp b/src/background-filter.cpp
+index 32c6483..55e838f 100644
+--- a/src/background-filter.cpp
++++ b/src/background-filter.cpp
+@@ -205,10 +205,14 @@ static void createOrtSession(struct background_removal_filter *tf) {
+ if (tf->useGPU == USEGPU_CUDA) {
+ Ort::ThrowOnError(OrtSessionOptionsAppendExecutionProvider_CUDA(sessionOptions, 0));
+ }
+-#else
++#elseif _WIN32
+ if (tf->useGPU == USEGPU_DML) {
+ Ort::ThrowOnError(OrtSessionOptionsAppendExecutionProvider_DML(sessionOptions, 0));
+ }
++#else
++ if (tf->useGPU == USEGPU_CPU) {
++ Ort::ThrowOnError(OrtSessionOptionsAppendExecutionProvider_CPU(sessionOptions, 0));
++ }
+ #endif
+ tf->session.reset(new Ort::Session(*tf->env, tf->modelFilepath, sessionOptions));
+ } catch (const std::exception& e) {
+--
+2.37.3
+