Merge pull request #254332 from xddxdd/svp-bin

svp: init at 4.5.210-2
This commit is contained in:
Sandro 2024-01-28 19:12:27 +01:00 committed by GitHub
commit 14d6bf2ef1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 181 additions and 0 deletions

View file

@ -20443,6 +20443,16 @@
githubId = 13489144;
name = "Calle Rosenquist";
};
xddxdd = {
email = "b980120@hotmail.com";
github = "xddxdd";
githubId = 5778879;
keys = [
{ fingerprint = "2306 7C13 B6AE BDD7 C0BB 5673 27F3 1700 E751 EC22"; }
{ fingerprint = "B195 E8FB 873E 6020 DCD1 C0C6 B50E C319 385F CB0D"; }
];
name = "Yuhui Xu";
};
xdhampus = {
name = "Hampus";
github = "xdHampus";

View file

@ -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}"
];
}

View file

@ -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 ];
};
}