obs-backgroundremoval: init at 0.4.0

This commit is contained in:
Brian McKenna 2022-01-15 07:33:42 +10:00 committed by Franz Pletz
parent 7b06baf385
commit 11d8a148a1
3 changed files with 82 additions and 0 deletions

View File

@ -11,4 +11,5 @@
obs-nvfbc = callPackage ./obs-nvfbc.nix {};
obs-pipewire-audio-capture = callPackage ./obs-pipewire-audio-capture.nix {};
obs-vkcapture = callPackage ./obs-vkcapture.nix {};
obs-backgroundremoval = callPackage ./obs-backgroundremoval.nix {};
}

View File

@ -0,0 +1,36 @@
diff --git a/src/Model.h b/src/Model.h
index 5c21eae..74b8078 100644
--- a/src/Model.h
+++ b/src/Model.h
@@ -1,13 +1,8 @@
#ifndef MODEL_H
#define MODEL_H
-#if defined(__APPLE__)
#include <onnxruntime/core/session/onnxruntime_cxx_api.h>
#include <onnxruntime/core/providers/cpu/cpu_provider_factory.h>
-#else
-#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
--- a/src/background-filter.cpp
+++ b/src/background-filter.cpp
@@ -1,13 +1,8 @@
#include <obs-module.h>
#include <media-io/video-scaler.h>
-#if defined(__APPLE__)
#include <onnxruntime/core/session/onnxruntime_cxx_api.h>
#include <onnxruntime/core/providers/cpu/cpu_provider_factory.h>
-#else
-#include <onnxruntime_cxx_api.h>
-#include <cpu_provider_factory.h>
-#endif
#ifdef _WIN32
#ifdef WITH_CUDA
#include <cuda_provider_factory.h>

View File

@ -0,0 +1,45 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, obs-studio
, onnxruntime
, opencv
}:
stdenv.mkDerivation rec {
pname = "obs-backgroundremoval";
version = "0.4.0";
src = fetchFromGitHub {
owner = "royshil";
repo = "obs-backgroundremoval";
rev = "v${version}";
sha256 = "sha256-TI1FlhE0+JL50gAZCSsI+g8savX8GRQkH3jYli/66hQ=";
};
nativeBuildInputs = [ cmake ];
buildInputs = [ obs-studio onnxruntime opencv ];
dontWrapQtApps = true;
cmakeFlags = [
"-DLIBOBS_INCLUDE_DIR=${obs-studio.src}/libobs"
"-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
'';
meta = with lib; {
description = "OBS plugin to replace the background in portrait images and video";
homepage = "https://github.com/royshil/obs-backgroundremoval";
maintainers = with maintainers; [ puffnfresh ];
license = licenses.mit;
platforms = [ "x86_64-linux" "i686-linux" ];
};
}