18 gdkPixbufModuleDir = "${placeholder "out"}/${gdk-pixbuf.moduleDir}";
19 gdkPixbufModuleFile = "${placeholder "out"}/${gdk-pixbuf.binaryDir}/avif-loaders.cache";
22 stdenv.mkDerivation rec {
26 src = fetchFromGitHub {
27 owner = "AOMediaCodec";
30 hash = "sha256-kop1S4A/+hP2YdgoMXP7OMVPc2eoRnHpoBrPnW6KWyM=";
33 # reco: encode libaom slowest but best, decode dav1d fastest
36 "-DBUILD_SHARED_LIBS=ON"
37 "-DAVIF_CODEC_AOM=ON" # best encoder (slow but small)
38 "-DAVIF_CODEC_DAV1D=ON" # best decoder (fast)
39 "-DAVIF_CODEC_AOM_DECODE=OFF"
40 "-DAVIF_BUILD_APPS=ON"
41 "-DAVIF_BUILD_GDK_PIXBUF=ON"
58 propagatedBuildInputs = [
65 substituteInPlace contrib/gdk-pixbuf/avif.thumbnailer.in \
66 --replace '@CMAKE_INSTALL_FULL_BINDIR@/gdk-pixbuf-thumbnailer' "$out/libexec/gdk-pixbuf-thumbnailer-avif"
69 env.PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = gdkPixbufModuleDir;
73 GDK_PIXBUF_MODULEDIR=${gdkPixbufModuleDir} \
74 GDK_PIXBUF_MODULE_FILE=${gdkPixbufModuleFile} \
75 gdk-pixbuf-query-loaders --update-cache
78 # Cross-compiled gdk-pixbuf doesn't support thumbnailers
79 + lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
81 makeWrapper ${gdk-pixbuf}/bin/gdk-pixbuf-thumbnailer "$out/libexec/gdk-pixbuf-thumbnailer-avif" \
82 --set GDK_PIXBUF_MODULE_FILE ${gdkPixbufModuleFile}
86 description = "C implementation of the AV1 Image File Format";
88 Libavif aims to be a friendly, portable C implementation of the
89 AV1 Image File Format. It is a work-in-progress, but can already
90 encode and decode all AOM supported YUV formats and bit depths
91 (with alpha). It also features an encoder and a decoder
94 homepage = "https://github.com/AOMediaCodec/libavif";
95 changelog = "https://github.com/AOMediaCodec/libavif/blob/v${version}/CHANGELOG.md";
96 maintainers = with maintainers; [ mkg20001 ];
97 platforms = platforms.all;
98 license = licenses.bsd2;