summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLan Tian <xuyh0120@outlook.com>2024-01-27 13:52:25 -0800
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2024-05-06 03:25:49 +0000
commitb0ec0767927931032c27ed62435ea0b6cf9c6792 (patch)
tree8c36648d7c69cc8d080b56524d9ae7077a5504c8
parentmaintainers: add xddxdd (diff)
downloadnixpkgs-origin/backport-254332-to-release-23.11.tar.gz
(cherry picked from commit 8d355e4b66167c39e0e124a857e5e9e956f64d2d)
-rw-r--r--pkgs/by-name/sv/svp/mpv.nix24
-rw-r--r--pkgs/by-name/sv/svp/package.nix147
2 files changed, 171 insertions, 0 deletions
diff --git a/pkgs/by-name/sv/svp/mpv.nix b/pkgs/by-name/sv/svp/mpv.nix
new file mode 100644
index 000000000000..752d76baf794
--- /dev/null
+++ b/pkgs/by-name/sv/svp/mpv.nix
@@ -0,0 +1,24 @@
+{ lib
+, mpv-unwrapped
+, wrapMpv
+, ocl-icd
+, ...
+}:
+let
+ libraries = [
+ ocl-icd
+ ];
+in
+wrapMpv
+ (mpv-unwrapped.override {
+ vapoursynthSupport = true;
+ })
+{
+ extraMakeWrapperArgs = [
+ # Add paths to required libraries
+ "--prefix"
+ "LD_LIBRARY_PATH"
+ ":"
+ "/run/opengl-driver/lib:${lib.makeLibraryPath libraries}"
+ ];
+}
diff --git a/pkgs/by-name/sv/svp/package.nix b/pkgs/by-name/sv/svp/package.nix
new file mode 100644
index 000000000000..639c67d8cd11
--- /dev/null
+++ b/pkgs/by-name/sv/svp/package.nix
@@ -0,0 +1,147 @@
+{ stdenv
+, buildFHSEnv
+, writeShellScriptBin
+, fetchurl
+, callPackage
+, makeDesktopItem
+, copyDesktopItems
+, ffmpeg
+, glibc
+, gnome
+, jq
+, lib
+, libmediainfo
+, libsForQt5
+, libusb1
+, ocl-icd
+, p7zip
+, patchelf
+, socat
+, vapoursynth
+, xdg-utils
+, xorg
+}:
+let
+ mpvForSVP = callPackage ./mpv.nix { };
+
+ # Script provided by GitHub user @xrun1
+ # https://github.com/xddxdd/nur-packages/issues/31#issuecomment-1812591688
+ fakeLsof = writeShellScriptBin "lsof" ''
+ for arg in "$@"; do
+ if [ -S "$arg" ]; then
+ printf %s p
+ echo '{"command": ["get_property", "pid"]}' |
+ ${socat}/bin/socat - "UNIX-CONNECT:$arg" |
+ ${jq}/bin/jq -Mr .data
+ printf '\n'
+ fi
+ done
+ '';
+
+ libraries = [
+ fakeLsof
+ ffmpeg.bin
+ glibc
+ gnome.zenity
+ libmediainfo
+ libsForQt5.qtbase
+ libsForQt5.qtwayland
+ libsForQt5.qtdeclarative
+ libsForQt5.qtscript
+ libsForQt5.qtsvg
+ libusb1
+ mpvForSVP
+ ocl-icd
+ stdenv.cc.cc.lib
+ vapoursynth
+ xdg-utils
+ xorg.libX11
+ ];
+
+ svp-dist = stdenv.mkDerivation rec {
+ pname = "svp-dist";
+ version = "4.5.210-2";
+ src = fetchurl {
+ url = "https://www.svp-team.com/files/svp4-linux.${version}.tar.bz2";
+ hash = "sha256-dY9uQ9jzTHiN2XSnOrXtHD11IIJW6t9BUzGGQFfZ+yg=";
+ };
+
+ nativeBuildInputs = [ p7zip patchelf ];
+ dontFixup = true;
+
+ unpackPhase = ''
+ tar xf ${src}
+ '';
+
+ buildPhase = ''
+ mkdir installer
+ LANG=C grep --only-matching --byte-offset --binary --text $'7z\xBC\xAF\x27\x1C' "svp4-linux-64.run" |
+ cut -f1 -d: |
+ while read ofs; do dd if="svp4-linux-64.run" bs=1M iflag=skip_bytes status=none skip=$ofs of="installer/bin-$ofs.7z"; done
+ '';
+
+ installPhase = ''
+ mkdir -p $out/opt
+ for f in "installer/"*.7z; do
+ 7z -bd -bb0 -y x -o"$out/opt/" "$f" || true
+ done
+
+ for SIZE in 32 48 64 128; do
+ mkdir -p "$out/share/icons/hicolor/''${SIZE}x''${SIZE}/apps"
+ mv "$out/opt/svp-manager4-''${SIZE}.png" "$out/share/icons/hicolor/''${SIZE}x''${SIZE}/apps/svp-manager4.png"
+ done
+ rm -f $out/opt/{add,remove}-menuitem.sh
+ '';
+ };
+
+ fhs = buildFHSEnv {
+ name = "SVPManager";
+ targetPkgs = pkgs: libraries;
+ runScript = "${svp-dist}/opt/SVPManager";
+ unshareUser = false;
+ unshareIpc = false;
+ unsharePid = false;
+ unshareNet = false;
+ unshareUts = false;
+ unshareCgroup = false;
+ };
+in
+stdenv.mkDerivation {
+ pname = "svp";
+ inherit (svp-dist) version;
+
+ dontUnpack = true;
+
+ nativeBuildInputs = [ copyDesktopItems ];
+
+ postInstall = ''
+ mkdir -p $out/bin $out/share
+ ln -s ${fhs}/bin/SVPManager $out/bin/SVPManager
+ ln -s ${svp-dist}/share/icons $out/share/icons
+ '';
+
+ passthru.mpv = mpvForSVP;
+
+ desktopItems = [
+ (makeDesktopItem {
+ name = "svp-manager4";
+ exec = "${fhs}/bin/SVPManager %f";
+ desktopName = "SVP 4 Linux";
+ genericName = "Real time frame interpolation";
+ icon = "svp-manager4";
+ categories = [ "AudioVideo" "Player" "Video" ];
+ mimeTypes = [ "video/x-msvideo" "video/x-matroska" "video/webm" "video/mpeg" "video/mp4" ];
+ terminal = false;
+ startupNotify = true;
+ })
+ ];
+
+ meta = with lib; {
+ description = "SmoothVideo Project 4 (SVP4) converts any video to 60 fps (and even higher) and performs this in real time right in your favorite video player.";
+ homepage = "https://www.svp-team.com/wiki/SVP:Linux";
+ platforms = [ "x86_64-linux" ];
+ license = licenses.unfree;
+ sourceProvenance = with sourceTypes; [ binaryNativeCode ];
+ maintainers = with lib.maintainers; [ xddxdd ];
+ };
+}