From e505a9b2e2ac53169281d58bc302dca2086feeb7 Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Sun, 4 Aug 2024 13:50:26 +0300 Subject: [PATCH] nongnu: Add obs-ndi. * nongnu/packages/video.scm (obs-ndi): New variable. --- nongnu/packages/video.scm | 52 +++++++++++++++++++++++++++++++++++++ obs-ndi-hardcode-path.patch | 14 ++++++++++ 2 files changed, 66 insertions(+) create mode 100644 obs-ndi-hardcode-path.patch diff --git a/nongnu/packages/video.scm b/nongnu/packages/video.scm index 4100270..c4734cb 100644 --- a/nongnu/packages/video.scm +++ b/nongnu/packages/video.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2024 Oleg Pykhalov (define-module (nongnu packages video) + #:use-module (gnu packages) #:use-module (gnu packages avahi) #:use-module (gnu packages base) #:use-module (gnu packages bash) @@ -11,6 +12,7 @@ #:use-module (gnu packages gawk) #:use-module (gnu packages gcc) #:use-module (gnu packages pkg-config) + #:use-module (gnu packages qt) #:use-module (gnu packages video) #:use-module (guix build utils) #:use-module (guix build-system cmake) @@ -282,3 +284,53 @@ Once you have downloaded the file, re-run the installation.") (license (nonguix-license:nonfree "https://downloads.ndi.tv/SDK/NDI_SDK/NDI%20License%20Agreement.pdf")))) + +(define-public obs-ndi + (package + (name "obs-ndi") + (version "4.11.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/DistroAV/DistroAV") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1wsb1k0jilcn6gqgpq5kq8hjiwnb6mi2w32fsqgb88iicwj1qa3y")) + (patches (append (search-patches "obs-ndi-hardcode-path.patch"))))) + (build-system cmake-build-system) + (inputs (list ndi obs qtbase-5)) + (arguments + (list + #:tests? #f ;no tests + #:phases + #~(modify-phases %standard-phases + (add-before 'configure 'ndi + (lambda* (#:key inputs #:allow-other-keys) + (let ((ndi #$(this-package-input "ndi"))) + (substitute* "src/obs-ndi.cpp" + (("@NDI@") ndi)) + (delete-file-recursively "lib/ndi") + (symlink (string-append ndi "/include") + "lib/ndi")))) + (add-after 'install 'obs-plugins + (lambda* (#:key outputs #:allow-other-keys) + (mkdir-p (string-append #$output "/lib/obs-plugins")) + (symlink + (string-append #$output + "/obs-plugins/64bit/obs-ndi.so") + (string-append #$output + "/lib/obs-plugins/obs-ndi.so"))))))) + (home-page "https://github.com/DistroAV/DistroAV") + (synopsis "Network Audio/Video in OBS-Studio using NDI technology") + (description "This packages provides a network A/V plugin for OBS Studio. + +Features: +@itemize +@item NDI Source: Receive NDI video and audio in OBS. +@item NDI Output: Transmit OBS video and audio to NDI. +@item NDI Filter (a.k.a. NDI Dedicated Output): Transmit a single OBS source +or scene audio to NDI. +@end itemize\n") + (license license:gpl2))) diff --git a/obs-ndi-hardcode-path.patch b/obs-ndi-hardcode-path.patch new file mode 100644 index 0000000..00daa40 --- /dev/null +++ b/obs-ndi-hardcode-path.patch @@ -0,0 +1,14 @@ +--- a/src/obs-ndi.cpp 1970-01-01 03:00:01.000000000 +0300 ++++ b/src/obs-ndi.cpp 2024-08-04 03:58:33.271766959 +0300 +@@ -229,10 +229,7 @@ + if (!path.isEmpty()) { + locations << path; + } +-#if defined(__linux__) || defined(__APPLE__) +- locations << "/usr/lib"; +- locations << "/usr/local/lib"; +-#endif ++ locations << "@NDI@/lib"; + for (QString location : locations) { + path = QDir::cleanPath( + QDir(location).absoluteFilePath(NDILIB_LIBRARY_NAME));