From 801cacf89bc1089b8c6574d3a4e0891c9902996a Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 28 Jul 2024 13:37:19 +0100 Subject: [PATCH 1/7] ffmpeg: add myself to maintainers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 😣 --- pkgs/development/libraries/ffmpeg/generic.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index 32e9b9d895fd8..9243299ac77ea 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -907,7 +907,7 @@ stdenv.mkDerivation (finalAttrs: { platforms = platforms.all; # See https://github.com/NixOS/nixpkgs/pull/295344#issuecomment-1992263658 broken = stdenv.hostPlatform.isMinGW && stdenv.hostPlatform.is64bit; - maintainers = with maintainers; [ atemu jopejoe1 ]; + maintainers = with maintainers; [ atemu jopejoe1 emily ]; mainProgram = "ffmpeg"; }; } // lib.optionalAttrs withCudaLLVM { From d2225a1ce36cf2666be717589655c937acce3e72 Mon Sep 17 00:00:00 2001 From: Emily Date: Sat, 13 Jul 2024 21:39:46 +0100 Subject: [PATCH 2/7] ffmpeg_7: add a Chromium patch to expose a private API This enables using a modern unvendored FFmpeg. --- pkgs/development/libraries/ffmpeg/generic.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index 9243299ac77ea..c780ad1b545a0 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -485,6 +485,12 @@ stdenv.mkDerivation (finalAttrs: { ] ++ optionals (lib.versionAtLeast version "7.0") [ ./0001-avfoundation.m-macOS-SDK-10.12-compatibility.patch + + # Expose a private API for Chromium / Qt WebEngine. + (fetchpatch2 { + url = "https://gitlab.archlinux.org/archlinux/packaging/packages/ffmpeg/-/raw/a02c1a15706ea832c0d52a4d66be8fb29499801a/add-av_stream_get_first_dts-for-chromium.patch"; + hash = "sha256-DbH6ieJwDwTjKOdQ04xvRcSLeeLP2Z2qEmqeo8HsPr4="; + }) ]; configurePlatforms = []; From 3be3946fc39517fd879e7389c5145821904101a9 Mon Sep 17 00:00:00 2001 From: Emily Date: Sat, 13 Jul 2024 21:12:43 +0100 Subject: [PATCH 3/7] {qt5,qt6}.qtwebengine: add patches for FFmpeg 7 Thank you to the Arch package maintainer for incorporating the WebRTC patches (which I had previously manually added) the day before I went to clean this up for PRing! --- .../libraries/qt-5/modules/qtwebengine.nix | 35 ++++++++++++++++--- .../libraries/qt-6/modules/qtwebengine.nix | 13 +++++-- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/qt-5/modules/qtwebengine.nix b/pkgs/development/libraries/qt-5/modules/qtwebengine.nix index 73920c1646b9b..68f3772a9976c 100644 --- a/pkgs/development/libraries/qt-5/modules/qtwebengine.nix +++ b/pkgs/development/libraries/qt-5/modules/qtwebengine.nix @@ -1,6 +1,7 @@ { qtModule , qtdeclarative, qtquickcontrols, qtlocation, qtwebchannel , fetchpatch +, fetchpatch2 , bison, flex, git, gperf, ninja, pkg-config, python, which , nodejs, perl @@ -24,12 +25,12 @@ , ImageCaptureCore, CoreBluetooth, IOBluetooth, CoreWLAN, Quartz, Cocoa, LocalAuthentication , MediaPlayer, MediaAccessibility, SecurityInterface, Vision, CoreML, OpenDirectory, Accelerate , cups, openbsm, xcbuild, writeScriptBin -, ffmpeg_4 ? null +, ffmpeg_7 ? null , lib, stdenv , version ? null , qtCompatVersion , pipewireSupport ? stdenv.isLinux -, pipewire_0_2 +, pipewire , postPatch ? "" , nspr , lndir @@ -77,6 +78,32 @@ qtModule ({ # which cannot be set at the same time as -Wformat-security hardeningDisable = [ "format" ]; + patches = [ + # Support FFmpeg 5 + (fetchpatch2 { + url = "https://gitlab.archlinux.org/archlinux/packaging/packages/qt5-webengine/-/raw/14074e4d789167bd776939037fe6df8d4d7dc0b3/qt5-webengine-ffmpeg5.patch"; + hash = "sha256-jTbJFXBPwRMzr8IeTxrv9dtS+/xDS/zR4dysV/bRg3I="; + stripLen = 1; + extraPrefix = "src/3rdparty/"; + }) + + # Support FFmpeg 7 + (fetchpatch2 { + url = "https://gitlab.archlinux.org/archlinux/packaging/packages/qt5-webengine/-/raw/e8fb4f86104243b90966b69cdfaa967273d834b6/qt5-webengine-ffmpeg7.patch"; + hash = "sha256-YNeHmOVp0M5HB+b91AOxxJxl+ktBtLYVdHlq13F7xtY="; + stripLen = 1; + extraPrefix = "src/3rdparty/chromium/"; + }) + + # Support PipeWire ≥ 0.3 + (fetchpatch2 { + url = "https://gitlab.archlinux.org/archlinux/packaging/packages/qt5-webengine/-/raw/c9db2cd9e144bd7a5e9246f5f7a01fe52fd089ba/qt5-webengine-pipewire-0.3.patch"; + hash = "sha256-mGexRfVDF3yjNzSi9BjavhzPtsXI0BooSr/rZ1z/BDo="; + stripLen = 1; + extraPrefix = "src/3rdparty/"; + }) + ]; + postPatch = '' # Patch Chromium build tools ( @@ -201,7 +228,7 @@ qtModule ({ harfbuzz icu libevent - ffmpeg_4 + ffmpeg_7 ] ++ lib.optionals (!stdenv.isDarwin) [ dbus zlib minizip snappy nss protobuf jsoncpp @@ -221,7 +248,7 @@ qtModule ({ ] ++ lib.optionals pipewireSupport [ # Pipewire - pipewire_0_2 + pipewire ] # FIXME These dependencies shouldn't be needed but can't find a way diff --git a/pkgs/development/libraries/qt-6/modules/qtwebengine.nix b/pkgs/development/libraries/qt-6/modules/qtwebengine.nix index 997fe0394fa25..8da3b7b628427 100644 --- a/pkgs/development/libraries/qt-6/modules/qtwebengine.nix +++ b/pkgs/development/libraries/qt-6/modules/qtwebengine.nix @@ -3,6 +3,7 @@ , qtwebchannel , qtpositioning , qtwebsockets +, fetchpatch2 , buildPackages , bison , coreutils @@ -49,7 +50,7 @@ , systemd , pipewire , gn -, ffmpeg_4 +, ffmpeg_7 , lib , stdenv , glib @@ -131,6 +132,14 @@ qtModule { # Override locales install path so they go to QtWebEngine's $out ../patches/qtwebengine-locales-path.patch + + # Support FFmpeg 7 + (fetchpatch2 { + url = "https://gitlab.archlinux.org/archlinux/packaging/packages/qt6-webengine/-/raw/6bee5464ac6340e925e08c7ed023026e727ae9d5/qtwebengine-ffmpeg-7.patch"; + hash = "sha256-OdCIu1KMW3YcpCnfUP1uD7OJRl6Iwap9X4aJhGpoaNs="; + stripLen = 1; + extraPrefix = "src/3rdparty/chromium/"; + }) ]; postPatch = '' @@ -228,7 +237,7 @@ qtModule { lcms2 libevent - ffmpeg_4 + ffmpeg_7 ] ++ lib.optionals stdenv.hostPlatform.isLinux [ dbus zlib From 1b74cb45fe84b53af37e62c16e480fa25e722393 Mon Sep 17 00:00:00 2001 From: Emily Date: Sat, 13 Jul 2024 21:12:43 +0100 Subject: [PATCH 4/7] pipewire_0_2: drop --- pkgs/development/libraries/pipewire/0.2.nix | 54 --------------------- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 1 - 3 files changed, 1 insertion(+), 55 deletions(-) delete mode 100644 pkgs/development/libraries/pipewire/0.2.nix diff --git a/pkgs/development/libraries/pipewire/0.2.nix b/pkgs/development/libraries/pipewire/0.2.nix deleted file mode 100644 index 7bcacad37dc92..0000000000000 --- a/pkgs/development/libraries/pipewire/0.2.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ lib, stdenv, fetchFromGitHub, meson, ninja, pkg-config, doxygen, graphviz -, glib, dbus, gst_all_1, alsa-lib, ffmpeg_4, libjack2, udev, libva, xorg -, sbc, SDL2, makeFontsConf -}: - -let - fontsConf = makeFontsConf { - fontDirectories = [ ]; - }; -in stdenv.mkDerivation rec { - pname = "pipewire"; - version = "0.2.7"; - - src = fetchFromGitHub { - owner = "PipeWire"; - repo = "pipewire"; - rev = version; - sha256 = "1q5wrqnhhs6r49p8yvkw1pl0cnsd4rndxy4h5lvdydwgf1civcwc"; - }; - - outputs = [ "out" "lib" "dev" "doc" ]; - - nativeBuildInputs = [ - meson ninja pkg-config doxygen graphviz - ]; - buildInputs = [ - glib dbus gst_all_1.gst-plugins-base gst_all_1.gstreamer - alsa-lib ffmpeg_4 libjack2 udev libva xorg.libX11 sbc SDL2 - ]; - - # Workaround build on gcc-10+ and clang11+: - # spa/plugins/bluez5/libspa-bluez5.so.p/bluez5-monitor.c.o:(.bss+0x0): - # multiple definition of `spa_a2dp_sink_factory' - env.NIX_CFLAGS_COMPILE = toString [ "-fcommon" ]; - - mesonFlags = [ - "-Ddocs=true" - "-Dgstreamer=enabled" - ]; - - PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "${placeholder "out"}/lib/systemd/user"; - - FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file - - doCheck = true; - - meta = with lib; { - description = "Server and user space API to deal with multimedia pipelines"; - homepage = "https://pipewire.org/"; - license = licenses.lgpl21; - platforms = platforms.linux; - maintainers = [ ]; - }; -} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 35d8138fdfa41..00156240f10e9 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1120,6 +1120,7 @@ mapAliases ({ php80Packages = php80; # Added 2023-06-21 php80Extensions = php80; # Added 2023-06-21 + pipewire_0_2 = throw "pipewire_0_2 has been removed as it is outdated and no longer used"; # Added 2024-07-28 pipewire-media-session = throw "pipewire-media-session is no longer maintained and has been removed. Please use Wireplumber instead."; pkgconfig = throw "'pkgconfig' has been renamed to/replaced by 'pkg-config'"; # Converted to throw 2023-09-10 pleroma-otp = pleroma; # Added 2021-07-10 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 94c74d914ebd6..497719a598d94 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17198,7 +17198,6 @@ with pkgs; ffmpeg = ffmpeg-headless; }; - pipewire_0_2 = callPackage ../development/libraries/pipewire/0.2.nix { }; wireplumber = callPackage ../development/libraries/pipewire/wireplumber.nix { }; pw-volume = callPackage ../tools/audio/pw-volume { }; From 2166381c28d7af691f9498a9c2b6fb3f8b913256 Mon Sep 17 00:00:00 2001 From: Emily Date: Mon, 29 Jul 2024 10:49:53 +0100 Subject: [PATCH 5/7] qt6.qtmultimedia: pin FFmpeg 7 for now --- pkgs/development/libraries/qt-6/modules/qtmultimedia.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/qt-6/modules/qtmultimedia.nix b/pkgs/development/libraries/qt-6/modules/qtmultimedia.nix index 39ac1245118a8..83bcb4c2a0d4a 100644 --- a/pkgs/development/libraries/qt-6/modules/qtmultimedia.nix +++ b/pkgs/development/libraries/qt-6/modules/qtmultimedia.nix @@ -13,7 +13,7 @@ , gst-plugins-good , gst-libav , gst-vaapi -, ffmpeg_6 +, ffmpeg_7 , libva , libpulseaudio , wayland @@ -28,7 +28,7 @@ qtModule { pname = "qtmultimedia"; nativeBuildInputs = [ pkg-config ]; - buildInputs = [ ffmpeg_6 ] + buildInputs = [ ffmpeg_7 ] ++ lib.optionals (!stdenv.hostPlatform.isMinGW) [ libunwind orc ] ++ lib.optionals stdenv.hostPlatform.isLinux [ libpulseaudio alsa-lib wayland libXrandr libva ] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform elfutils) [ elfutils ]; From 6d00f45e36e4cb670afa4b7754c3344197749a07 Mon Sep 17 00:00:00 2001 From: Emily Date: Mon, 15 Jul 2024 14:27:45 +0100 Subject: [PATCH 6/7] goldendict-ng: disable FFmpeg backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is an upstream fix for FFmpeg 7 support, but according to : > We don't actually need the FFmpeg backend anymore. Newer Qt6's > multimedia has FFmpeg backend, the supported formats are the same. > > Maybe this is the time to delete the FFmpeg backend 😅 --- pkgs/applications/misc/goldendict-ng/default.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/applications/misc/goldendict-ng/default.nix b/pkgs/applications/misc/goldendict-ng/default.nix index 356059d1d9bde..344f3439ef808 100644 --- a/pkgs/applications/misc/goldendict-ng/default.nix +++ b/pkgs/applications/misc/goldendict-ng/default.nix @@ -4,7 +4,6 @@ , pkg-config , cmake , libvorbis -, ffmpeg , libeb , hunspell , opencc @@ -61,7 +60,6 @@ stdenv.mkDerivation (finalAttrs: { libiconv opencc libeb - ffmpeg xapian libzim ]; @@ -76,7 +74,7 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ "-DWITH_XAPIAN=ON" "-DWITH_ZIM=ON" - "-DWITH_FFMPEG_PLAYER=ON" + "-DWITH_FFMPEG_PLAYER=OFF" "-DWITH_EPWING_SUPPORT=ON" "-DUSE_SYSTEM_FMT=ON" "-DUSE_SYSTEM_TOML=ON" From a402e62e07cf54c7b489f1edcd7a9008e4c2c429 Mon Sep 17 00:00:00 2001 From: Emily Date: Mon, 15 Jul 2024 01:20:24 +0100 Subject: [PATCH 7/7] openboard: add patches for FFmpeg 7 These are already shipped in the AUR package. --- .../graphics/openboard/default.nix | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/graphics/openboard/default.nix b/pkgs/applications/graphics/openboard/default.nix index 9eacdc642ce56..363114fdaafbd 100644 --- a/pkgs/applications/graphics/openboard/default.nix +++ b/pkgs/applications/graphics/openboard/default.nix @@ -1,6 +1,6 @@ -{ stdenv, lib, fetchFromGitHub, copyDesktopItems, makeDesktopItem, qmake +{ stdenv, lib, fetchFromGitHub, fetchpatch2, copyDesktopItems, makeDesktopItem, qmake , qtbase, qtxmlpatterns, qttools, qtwebengine, libGL, fontconfig, openssl, poppler, wrapQtAppsHook -, ffmpeg, libva, alsa-lib, SDL, x264, libvpx, libvorbis, libtheora, libogg +, ffmpeg_7, libva, alsa-lib, SDL, x264, libvpx, libvorbis, libtheora, libogg , libopus, lame, fdk_aac, libass, quazip, libXext, libXfixes }: let @@ -34,6 +34,22 @@ in stdenv.mkDerivation (finalAttrs: { hash = "sha256-OSAogtZoMisyRziv63ag9w8HQaaRdz0J28jQZR7cTMM="; }; + patches = [ + # fix: Support FFmpeg 7.0 + # https://github.com/OpenBoard-org/OpenBoard/pull/1017 + (fetchpatch2 { + url = "https://github.com/OpenBoard-org/OpenBoard/commit/4f45b6c4016972cf5835f9188bda6197b1b4ed2f.patch?full_index=1"; + hash = "sha256-MUJbHfOCMlRO4pg5scm+DrBsngZwB7UPuDJZss5x9Zs="; + }) + + # fix: Resolve FFmpeg 7.0 warnings + # https://github.com/OpenBoard-org/OpenBoard/pull/1017 + (fetchpatch2 { + url = "https://github.com/OpenBoard-org/OpenBoard/commit/315bcac782e10cc6ceef1fc8b78fff40541ea38f.patch?full_index=1"; + hash = "sha256-736eX+uXuZwHJxOXAgxs2/vjjD1JY9mMyj3rR45/7xk="; + }) + ]; + postPatch = '' substituteInPlace OpenBoard.pro \ --replace '/usr/include/quazip5' '${lib.getDev quazip}/include/QuaZip-Qt5-${quazip.version}/quazip' \ @@ -52,7 +68,7 @@ in stdenv.mkDerivation (finalAttrs: { fontconfig openssl poppler - ffmpeg + ffmpeg_7 libva alsa-lib SDL