about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libde265
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libde265')
-rw-r--r--nixpkgs/pkgs/development/libraries/libde265/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/libde265/test-corpus-decode.nix48
2 files changed, 95 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libde265/default.nix b/nixpkgs/pkgs/development/libraries/libde265/default.nix
new file mode 100644
index 000000000000..de366da98b96
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libde265/default.nix
@@ -0,0 +1,47 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, autoreconfHook
+, pkg-config
+
+, callPackage
+
+  # for passthru.tests
+, imagemagick
+, libheif
+, imlib2Full
+, gst_all_1
+}:
+
+stdenv.mkDerivation (finalAttrs: rec {
+  version = "1.0.14";
+  pname = "libde265";
+
+  src = fetchFromGitHub {
+    owner = "strukturag";
+    repo = "libde265";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-aZRtF4wYWxi/6ORNu7yVxFFdkvJTvBwPinL5lC0Mlqg=";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkg-config ];
+
+  enableParallelBuilding = true;
+
+  passthru.tests = {
+    inherit imagemagick libheif imlib2Full;
+    inherit (gst_all_1) gst-plugins-bad;
+
+    test-corpus-decode = callPackage ./test-corpus-decode.nix {
+      libde265 = finalAttrs.finalPackage;
+    };
+  };
+
+  meta = {
+    homepage = "https://github.com/strukturag/libde265";
+    description = "Open h.265 video codec implementation";
+    license = lib.licenses.lgpl3;
+    platforms = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ gebner ];
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/libde265/test-corpus-decode.nix b/nixpkgs/pkgs/development/libraries/libde265/test-corpus-decode.nix
new file mode 100644
index 000000000000..763c93e6a993
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libde265/test-corpus-decode.nix
@@ -0,0 +1,48 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, libde265
+}:
+
+stdenv.mkDerivation {
+  pname = "libde265-test-corpus-decode";
+  version = "unstable-2020-02-19";
+
+  src = fetchFromGitHub {
+    owner = "strukturag";
+    repo = "libde265-data";
+    rev = "bdfdfdbe682f514c5185c270c74eac42731a7fa8";
+    sha256 = "sha256-fOgu7vMoyH30Zzbkfm4a6JVDZtYLO/0R2syC2Wux+Z8=";
+  };
+
+  dontConfigure = true;
+  dontBuild = true;
+
+  doCheck = true;
+  nativeCheckInputs = [ libde265 ];
+  # based on invocations in https://github.com/strukturag/libde265/blob/0b1752abff97cb542941d317a0d18aa50cb199b1/scripts/ci-run.sh
+  checkPhase = ''
+    echo "Single-threaded:"
+    find . -name '*.bin' | while read f; do
+      echo "Decoding $f"
+      dec265 -q -c $f
+      dec265 -0 -q -c $f
+      dec265 -q --disable-deblocking --disable-sao $f
+    done
+    echo "Multi-threaded:"
+    find RandomAccess/ -name '*.bin' | while read f; do
+      echo "Decoding $f"
+      dec265 -t 4 -q -c $f
+      dec265 -t 4 -0 -q -c $f
+      dec265 -t 4 -q --disable-deblocking --disable-sao $f
+    done
+  '';
+  # a larger corpus of files can be found
+  # as an ubuntu package libde265-teststreams @
+  # https://launchpad.net/~strukturag/+archive/ubuntu/libde265/+packages
+  # but it is *much* larger
+
+  installPhase = ''
+    touch $out
+  '';
+}