Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 May 2024 05:33:54 GMT
From:      Bernhard Froehlich <decke@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: edac4920e0a1 - main - multimedia/kodi: Update to 21.0
Message-ID:  <202405260533.44Q5XsPo059911@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by decke:

URL: https://cgit.FreeBSD.org/ports/commit/?id=edac4920e0a19b7c6979fb2b4a891418d2fbd871

commit edac4920e0a19b7c6979fb2b4a891418d2fbd871
Author:     yzrh <yzrh@noema.org>
AuthorDate: 2024-05-25 19:24:48 +0000
Commit:     Bernhard Froehlich <decke@FreeBSD.org>
CommitDate: 2024-05-26 05:32:32 +0000

    multimedia/kodi: Update to 21.0
    
    PR:             278334
---
 multimedia/kodi/Makefile                           |   71 +-
 multimedia/kodi/distinfo                           |   24 +-
 .../files/patch-cmake_modules_FindCrossGUID.cmake  |   37 +-
 .../files/patch-cmake_modules_FindLibDvdCSS.cmake  |   11 -
 .../files/patch-cmake_modules_FindLibDvdNav.cmake  |   11 -
 .../files/patch-cmake_modules_FindLibDvdRead.cmake |   11 -
 multimedia/kodi/files/patch-ffmpeg6-support        | 2155 --------------------
 ...tch-xbmc_cores_AudioEngine_Sinks_AESinkALSA.cpp |    4 +-
 ...ch-xbmc_cores_AudioEngine_Utils_AEELDParser.cpp |   11 -
 multimedia/kodi/pkg-plist                          |  275 +--
 10 files changed, 156 insertions(+), 2454 deletions(-)

diff --git a/multimedia/kodi/Makefile b/multimedia/kodi/Makefile
index 6407e95a6982..e4ca578bd2a5 100644
--- a/multimedia/kodi/Makefile
+++ b/multimedia/kodi/Makefile
@@ -1,6 +1,11 @@
 PORTNAME=	kodi
-DISTVERSION=	20.5
+DISTVERSION=	21.0
 CATEGORIES=	multimedia java
+MASTER_SITES=	http://mirrors.kodi.tv/build-deps/sources/
+DISTFILES=	apache-groovy-binary-${GROOVY_VERSION}.zip \
+		commons-lang3-${COMMONS_LANG_VERSION}-bin.tar.gz \
+		commons-text-${COMMONS_TEXT_VERSION}-bin.tar.gz
+DIST_SUBDIR=	${PORTNAME}
 # do not forget to fix devel/kodi-platform when updating kodi
 
 MAINTAINER=	yzrh@noema.org
@@ -38,6 +43,8 @@ LIB_DEPENDS=	libass.so:multimedia/libass \
 		libswscale.so:multimedia/ffmpeg \
 		libtag.so:audio/taglib \
 		libtinyxml.so:textproc/tinyxml \
+		libtinyxml2.so:textproc/tinyxml2 \
+		libudfread.so:multimedia/libudfread \
 		libuuid.so:misc/e2fsprogs-libuuid
 RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}sqlite3>0:databases/py-sqlite3@${PY_FLAVOR}
 
@@ -45,10 +52,13 @@ USES=		autoreconf:build cmake:noninja compiler:c++17-lang cpe \
 		desktop-file-utils gettext gmake gnome iconv jpeg libtool \
 		pkgconfig python sqlite ssl
 
-KODI_CODENAME=		Nexus
+KODI_CODENAME=		Omega
 LIBDVDCSS_VERSION=	1.4.3-Next-Nexus-Alpha2-2
 LIBDVDNAV_VERSION=	6.1.1-Next-Nexus-Alpha2-2
 LIBDVDREAD_VERSION=	6.1.3-Next-Nexus-Alpha2-2
+GROOVY_VERSION=		4.0.16
+COMMONS_LANG_VERSION=	3.14.0
+COMMONS_TEXT_VERSION=	1.11.0
 
 USE_GITHUB=	yes
 GH_TUPLE=	xbmc:xbmc:${DISTVERSION}-${KODI_CODENAME} \
@@ -71,20 +81,24 @@ USE_JAVA=	yes
 JAVA_BUILD=	jre
 USE_GNOME=	libxml2
 CMAKE_ARGS=	-DGIT_VERSION="${DISTVERSION}-${KODI_CODENAME}" \
-		-DLIBDVDCSS_URL="${DISTDIR}/xbmc-libdvdcss-${LIBDVDCSS_VERSION}_GH0.tar.gz" \
-		-DLIBDVDNAV_URL="${DISTDIR}/xbmc-libdvdnav-${LIBDVDNAV_VERSION}_GH0.tar.gz" \
-		-DLIBDVDREAD_URL="${DISTDIR}/xbmc-libdvdread-${LIBDVDREAD_VERSION}_GH0.tar.gz" \
-		-DCROSSGUID_INCLUDE_DIR="${LOCALBASE}/include"
-CMAKE_OFF=	ENABLE_INTERNAL_CROSSGUID ENABLE_INTERNAL_RapidJSON
+		-DLIBDVDCSS_URL="${DISTDIR}/${PORTNAME}/xbmc-libdvdcss-${LIBDVDCSS_VERSION}_GH0.tar.gz" \
+		-DLIBDVDNAV_URL="${DISTDIR}/${PORTNAME}/xbmc-libdvdnav-${LIBDVDNAV_VERSION}_GH0.tar.gz" \
+		-DLIBDVDREAD_URL="${DISTDIR}/${PORTNAME}/xbmc-libdvdread-${LIBDVDREAD_VERSION}_GH0.tar.gz" \
+		-Dgroovy_SOURCE_DIR="${WRKSRC}/tools/depends/share/groovy" \
+		-Dapache-commons-lang_SOURCE_DIR="${WRKSRC}/tools/depends/share/java/lang" \
+		-Dapache-commons-text_SOURCE_DIR="${WRKSRC}/tools/depends/share/java/text" \
+		-DCROSSGUID_INCLUDE_DIR="${LOCALBASE}/include" \
+		-DCORE_PLATFORM_NAME:STRING="${KODI_PLATFORM}" \
+		-DCMAKE_VERBOSE_MAKEFILE=ON
+CMAKE_OFF=	ENABLE_INTERNAL_CROSSGUID
 CONFIGURE_ENV=	_CPU_FEATURE="${CPU_FEATURE}"
 
 OPTIONS_SUB=		yes
-# Broken: BLUETOOTH
 OPTIONS_DEFINE=		AIRPLAY AVAHI LIBBLURAY CEC DAV1D DBUS \
 			DVDCSS LCMS2 LIRC WEBSERVER MYSQL NFS DVD SMB TEST \
 			UDEV UPNP VAAPI VDPAU XSLT DOCS
 OPTIONS_DEFAULT=	LIBBLURAY CEC LCMS2 WEBSERVER DAV1D \
-			DVD UPNP VAAPI VDPAU XSLT WAYLAND X11 GL
+			DVD UPNP VAAPI VDPAU XSLT GBM WAYLAND X11 GL
 OPTIONS_DEFAULT_amd64=	SSE SSE2 SSE3 SSSE3 SSE4_1 SSE4_2
 OPTIONS_DEFAULT_i386=	SSE SSE2 SSE3
 OPTIONS_SINGLE=		RENDER
@@ -103,7 +117,6 @@ PLATFORM_DESC=	Kodi platform
 FEATURE_DESC=	X86 CPU feature
 
 AIRPLAY_DESC=	AirPlay support
-BLUETOOTH_DESC=	Bluetooth support
 CEC_DESC=	CEC adapter support
 DAV1D_DESC=	Use dav1d as AV1 decoder
 DVD_DESC=	DVD support
@@ -132,9 +145,6 @@ AIRPLAY_CMAKE_BOOL=	ENABLE_PLIST \
 AVAHI_LIB_DEPENDS=	libavahi-client.so:net/avahi-app
 AVAHI_CMAKE_BOOL=	ENABLE_AVAHI
 
-BLUETOOTH_CMAKE_BOOL=	ENABLE_BLUETOOTH
-BLUETOOTH_CMAKE_ON=	-DBLUETOOTH_INCLUDE_DIR="${LOCALBASE}/include"
-
 LIBBLURAY_LIB_DEPENDS=	libbluray.so:multimedia/libbluray
 LIBBLURAY_CMAKE_BOOL=	ENABLE_BLURAY
 
@@ -177,6 +187,7 @@ UPNP_CMAKE_BOOL=	ENABLE_UPNP
 VAAPI_LIB_DEPENDS=	libva.so:multimedia/libva
 VAAPI_CMAKE_BOOL=	ENABLE_VAAPI
 
+VDPAU_IMPLIES=		X11 GL
 VDPAU_LIB_DEPENDS=	libvdpau.so:multimedia/libvdpau
 VDPAU_CMAKE_BOOL=	ENABLE_VDPAU
 
@@ -216,17 +227,18 @@ AVX_VARS=		CPU_FEATURE+=AVX
 AVX2_VARS=		CPU_FEATURE+=AVX2
 
 GBM_IMPLIES=		UDEV
+GBM_VARS=		KODI_PLATFORM+=gbm
 GBM_USES=		gl
 GBM_USE=		GL=egl,gbm,glu
-GBM_CFLAGS=		-I${LOCALBASE}/include/libepoll-shim
-GBM_LDFLAGS=		-L${LOCALBASE}/lib -lepoll-shim
 GBM_BUILD_DEPENDS=	evdev-proto>0:devel/evdev-proto
 GBM_LIB_DEPENDS=	libepoll-shim.so:devel/libepoll-shim \
 			libdrm.so:graphics/libdrm \
 			libxkbcommon.so:x11/libxkbcommon \
-			libinput.so:x11/libinput
+			libinput.so:x11/libinput \
+			libdisplay-info.so:sysutils/libdisplay-info
 GBM_RUN_DEPENDS=	mesa-dri>0:graphics/mesa-dri
 
+WAYLAND_VARS=		KODI_PLATFORM+=wayland
 WAYLAND_CATEGORIES=	wayland
 WAYLAND_USES=		gl
 WAYLAND_USE=		GL=egl,glu
@@ -237,6 +249,7 @@ WAYLAND_LIB_DEPENDS=	libdrm.so:graphics/libdrm \
 			libinput.so:x11/libinput \
 			libwayland-client++.so:graphics/waylandpp
 
+X11_VARS=		KODI_PLATFORM+=x11
 X11_USES=		xorg gl
 X11_USE=		XORG=x11,xext,xrandr GL=egl,gbm,glu
 X11_LIB_DEPENDS=	libdrm.so:graphics/libdrm
@@ -247,22 +260,6 @@ X11_LIB_DEPENDS=	libdrm.so:graphics/libdrm
 BROKEN=	option GLES does not build with multiple PLATFORM
 .endif
 
-.if !empty(PORT_OPTIONS:MGBM) && !empty(PORT_OPTIONS:MWAYLAND) && !empty(PORT_OPTIONS:MX11)
-CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="gbm wayland x11"
-.elif empty(PORT_OPTIONS:MGBM) && !empty(PORT_OPTIONS:MWAYLAND) && !empty(PORT_OPTIONS:MX11)
-CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="wayland x11"
-.elif !empty(PORT_OPTIONS:MGBM) && empty(PORT_OPTIONS:MWAYLAND) && !empty(PORT_OPTIONS:MX11)
-CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="gbm x11"
-.elif !empty(PORT_OPTIONS:MGBM) && !empty(PORT_OPTIONS:MWAYLAND) && empty(PORT_OPTIONS:MX11)
-CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="gbm wayland"
-.elif empty(PORT_OPTIONS:MGBM) && empty(PORT_OPTIONS:MWAYLAND) && !empty(PORT_OPTIONS:MX11)
-CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="x11"
-.elif empty(PORT_OPTIONS:MGBM) && !empty(PORT_OPTIONS:MWAYLAND) && empty(PORT_OPTIONS:MX11)
-CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="wayland"
-.elif !empty(PORT_OPTIONS:MGBM) && empty(PORT_OPTIONS:MWAYLAND) && empty(PORT_OPTIONS:MX11)
-CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="gbm"
-.endif
-
 .if !empty(PORT_OPTIONS:MGBM) && !empty(PORT_OPTIONS:MWAYLAND) || !empty(PORT_OPTIONS:MGBM) && !empty(PORT_OPTIONS:MX11) || !empty(PORT_OPTIONS:MWAYLAND) && !empty(PORT_OPTIONS:MX11)
 PLIST_SUB+=	KODICOMBINED="" \
 		KODIGBM="@comment " \
@@ -290,6 +287,14 @@ PLIST_SUB+=	KODIX11="@comment "
 .endif
 .endif
 
+post-extract:
+	@${MKDIR} ${WRKSRC}/tools/depends/share
+	@${MV} ${WRKDIR}/groovy-${GROOVY_VERSION} ${WRKSRC}/tools/depends/share/groovy
+
+	@${MKDIR} ${WRKSRC}/tools/depends/share/java
+	@${MV} ${WRKDIR}/commons-lang3-${COMMONS_LANG_VERSION} ${WRKSRC}/tools/depends/share/java/lang
+	@${MV} ${WRKDIR}/commons-text-${COMMONS_TEXT_VERSION} ${WRKSRC}/tools/depends/share/java/text
+
 post-patch:
 	${REINPLACE_CMD} 's|/usr/share|${LOCALBASE}/share|' \
 		${WRKSRC}/xbmc/platform/linux/input/LibInputSettings.cpp
@@ -297,7 +302,7 @@ post-patch:
 post-install:
 	${INSTALL_MAN} ${WRKSRC}/docs/manpages/kodi.bin.1 ${STAGEDIR}${PREFIX}/share/man/man1
 	cd ${STAGEDIR}${PREFIX}/share/man/man1 && ${LN} -s kodi.bin.1.gz kodi.1.gz
-	cd ${STAGEDIR}${PREFIX}/bin && ${STRIP_CMD} JsonSchemaBuilder kodi-TexturePacker
+	cd ${STAGEDIR}${PREFIX}/bin && ${STRIP_CMD} kodi-TexturePacker TexturePacker
 	${FIND} ${STAGEDIR}${PREFIX}/lib/kodi -type f -name '*.so' -print0 | ${XARGS} -0 ${STRIP_CMD}
 	${RM} -r ${STAGEDIR}${PREFIX}/lib/firewalld
 
diff --git a/multimedia/kodi/distinfo b/multimedia/kodi/distinfo
index 9962dfff28b0..da2b055758eb 100644
--- a/multimedia/kodi/distinfo
+++ b/multimedia/kodi/distinfo
@@ -1,9 +1,15 @@
-TIMESTAMP = 1709571779
-SHA256 (xbmc-xbmc-20.5-20.5-Nexus_GH0.tar.gz) = 9bf3257ebf251d20f276b7f90681985a270779150af2fb395d4b593c04002deb
-SIZE (xbmc-xbmc-20.5-20.5-Nexus_GH0.tar.gz) = 54568445
-SHA256 (xbmc-libdvdcss-1.4.3-Next-Nexus-Alpha2-2_GH0.tar.gz) = f38c4a4e7a4f4da6d8e83b8852489aa3bb6588a915dc41f5ee89d9aad305a06e
-SIZE (xbmc-libdvdcss-1.4.3-Next-Nexus-Alpha2-2_GH0.tar.gz) = 102124
-SHA256 (xbmc-libdvdnav-6.1.1-Next-Nexus-Alpha2-2_GH0.tar.gz) = 584f62a3896794408d46368e2ecf2c6217ab9c676ce85921b2d68b8961f49dfc
-SIZE (xbmc-libdvdnav-6.1.1-Next-Nexus-Alpha2-2_GH0.tar.gz) = 128547
-SHA256 (xbmc-libdvdread-6.1.3-Next-Nexus-Alpha2-2_GH0.tar.gz) = 719130091e3adc9725ba72df808f24a14737a009dca5a4c38c601c0c76449b62
-SIZE (xbmc-libdvdread-6.1.3-Next-Nexus-Alpha2-2_GH0.tar.gz) = 110513
+TIMESTAMP = 1712510398
+SHA256 (kodi/apache-groovy-binary-4.0.16.zip) = b8c3bec88a3f5a62235d9429a97e371032bf7216f3e28724823a9169dd10befc
+SIZE (kodi/apache-groovy-binary-4.0.16.zip) = 29793704
+SHA256 (kodi/commons-lang3-3.14.0-bin.tar.gz) = 317c3e3fcd5fcca3781a7996ff1e0c50c13244ee961e94e5f6f6d84b84733b16
+SIZE (kodi/commons-lang3-3.14.0-bin.tar.gz) = 9442785
+SHA256 (kodi/commons-text-1.11.0-bin.tar.gz) = 4169cb90571fb28fad4c5eea7c1c994c18f1995452f73e8ea7a86087c0e3822e
+SIZE (kodi/commons-text-1.11.0-bin.tar.gz) = 3018564
+SHA256 (kodi/xbmc-xbmc-21.0-21.0-Omega_GH0.tar.gz) = 7f54c1fd8456ac46221fbc85e447362bdc209163c6cb19fca98d106560071b7c
+SIZE (kodi/xbmc-xbmc-21.0-21.0-Omega_GH0.tar.gz) = 40987733
+SHA256 (kodi/xbmc-libdvdcss-1.4.3-Next-Nexus-Alpha2-2_GH0.tar.gz) = f38c4a4e7a4f4da6d8e83b8852489aa3bb6588a915dc41f5ee89d9aad305a06e
+SIZE (kodi/xbmc-libdvdcss-1.4.3-Next-Nexus-Alpha2-2_GH0.tar.gz) = 102124
+SHA256 (kodi/xbmc-libdvdnav-6.1.1-Next-Nexus-Alpha2-2_GH0.tar.gz) = 584f62a3896794408d46368e2ecf2c6217ab9c676ce85921b2d68b8961f49dfc
+SIZE (kodi/xbmc-libdvdnav-6.1.1-Next-Nexus-Alpha2-2_GH0.tar.gz) = 128547
+SHA256 (kodi/xbmc-libdvdread-6.1.3-Next-Nexus-Alpha2-2_GH0.tar.gz) = 719130091e3adc9725ba72df808f24a14737a009dca5a4c38c601c0c76449b62
+SIZE (kodi/xbmc-libdvdread-6.1.3-Next-Nexus-Alpha2-2_GH0.tar.gz) = 110513
diff --git a/multimedia/kodi/files/patch-cmake_modules_FindCrossGUID.cmake b/multimedia/kodi/files/patch-cmake_modules_FindCrossGUID.cmake
index 4fd05dca7c94..9abea5170820 100644
--- a/multimedia/kodi/files/patch-cmake_modules_FindCrossGUID.cmake
+++ b/multimedia/kodi/files/patch-cmake_modules_FindCrossGUID.cmake
@@ -1,29 +1,20 @@
---- cmake/modules/FindCrossGUID.cmake.orig	2022-07-08 10:04:52 UTC
+--- cmake/modules/FindCrossGUID.cmake.orig	2024-03-04 21:39:38 UTC
 +++ cmake/modules/FindCrossGUID.cmake
-@@ -45,7 +45,7 @@ else()
-   endif()
+@@ -45,7 +45,7 @@ if(NOT TARGET CrossGUID::CrossGUID)
+       set(CROSSGUID_VERSION ${PC_CROSSGUID_VERSION})
+     endif()
  
-   if(CROSSGUID_FOUND)
 -    find_path(CROSSGUID_INCLUDE_DIR NAMES crossguid/guid.hpp guid.h
 +    find_path(CROSSGUID_INCLUDE_DIR NAMES guid.hpp guid.h
-     PATHS ${PC_CROSSGUID_INCLUDEDIR})
- 
-     find_library(CROSSGUID_LIBRARY_RELEASE NAMES crossguid
-@@ -53,7 +53,7 @@ else()
-     find_library(CROSSGUID_LIBRARY_DEBUG NAMES crossguidd crossguid-dgb
-           PATHS ${PC_CROSSGUID_LIBDIR})
-   else()
--    find_path(CROSSGUID_INCLUDE_DIR NAMES crossguid/guid.hpp guid.h)
-+    find_path(CROSSGUID_INCLUDE_DIR NAMES guid.hpp guid.h)
-     find_library(CROSSGUID_LIBRARY_RELEASE NAMES crossguid)
-     find_library(CROSSGUID_LIBRARY_DEBUG NAMES crossguidd)
-   endif()
-@@ -73,7 +73,7 @@ if(CROSSGUID_FOUND)
-   set(CROSSGUID_INCLUDE_DIRS ${CROSSGUID_INCLUDE_DIR})
+                                     HINTS ${DEPENDS_PATH}/include ${PC_CROSSGUID_INCLUDEDIR}
+                                     ${${CORE_PLATFORM_LC}_SEARCH_CONFIG}
+                                     NO_CACHE)
+@@ -59,7 +59,7 @@ if(NOT TARGET CrossGUID::CrossGUID)
+                                          NO_CACHE)
  
-   # NEW_CROSSGUID >= 0.2.0 release
--  if(EXISTS "${CROSSGUID_INCLUDE_DIR}/crossguid/guid.hpp")
-+  if(EXISTS "${CROSSGUID_INCLUDE_DIR}/guid.hpp")
-     list(APPEND CROSSGUID_DEFINITIONS -DHAVE_NEW_CROSSGUID)
+     # NEW_CROSSGUID >= 0.2.0 release
+-    if(EXISTS "${CROSSGUID_INCLUDE_DIR}/crossguid/guid.hpp")
++    if(EXISTS "${CROSSGUID_INCLUDE_DIR}/guid.hpp")
+       list(APPEND _crossguid_definitions HAVE_NEW_CROSSGUID)
+     endif()
    endif()
- 
diff --git a/multimedia/kodi/files/patch-cmake_modules_FindLibDvdCSS.cmake b/multimedia/kodi/files/patch-cmake_modules_FindLibDvdCSS.cmake
deleted file mode 100644
index 450c48a9ed4d..000000000000
--- a/multimedia/kodi/files/patch-cmake_modules_FindLibDvdCSS.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
---- cmake/modules/FindLibDvdCSS.cmake.orig	2022-08-18 23:36:30 UTC
-+++ cmake/modules/FindLibDvdCSS.cmake
-@@ -63,7 +63,7 @@ if(ENABLE_DVDCSS)
-                    ${LIBDVD_ADDITIONAL_ARGS})
-   else()
-     find_program(AUTORECONF autoreconf REQUIRED)
--    find_program(MAKE_EXECUTABLE make REQUIRED)
-+    find_program(MAKE_EXECUTABLE gmake REQUIRED)
- 
-     set(CONFIGURE_COMMAND ${AUTORECONF} -vif
-                   COMMAND ac_cv_path_GIT= ./configure
diff --git a/multimedia/kodi/files/patch-cmake_modules_FindLibDvdNav.cmake b/multimedia/kodi/files/patch-cmake_modules_FindLibDvdNav.cmake
deleted file mode 100644
index c8efbe69cbc6..000000000000
--- a/multimedia/kodi/files/patch-cmake_modules_FindLibDvdNav.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
---- cmake/modules/FindLibDvdNav.cmake.orig	2022-08-18 23:36:26 UTC
-+++ cmake/modules/FindLibDvdNav.cmake
-@@ -76,7 +76,7 @@ if(NOT TARGET LibDvdNav::LibDvdNav)
-     string(APPEND LIBDVDNAV_CFLAGS " -I$<TARGET_PROPERTY:LibDvdRead::LibDvdRead,INTERFACE_INCLUDE_DIRECTORIES> $<TARGET_PROPERTY:LibDvdRead::LibDvdRead,INTERFACE_COMPILE_DEFINITIONS>")
- 
-     find_program(AUTORECONF autoreconf REQUIRED)
--    find_program(MAKE_EXECUTABLE make REQUIRED)
-+    find_program(MAKE_EXECUTABLE gmake REQUIRED)
- 
-     set(CONFIGURE_COMMAND ${AUTORECONF} -vif
-                   COMMAND ac_cv_path_GIT= ./configure
diff --git a/multimedia/kodi/files/patch-cmake_modules_FindLibDvdRead.cmake b/multimedia/kodi/files/patch-cmake_modules_FindLibDvdRead.cmake
deleted file mode 100644
index 44208f126053..000000000000
--- a/multimedia/kodi/files/patch-cmake_modules_FindLibDvdRead.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
---- cmake/modules/FindLibDvdRead.cmake.orig	2022-08-18 23:36:34 UTC
-+++ cmake/modules/FindLibDvdRead.cmake
-@@ -81,7 +81,7 @@ if(NOT TARGET LibDvdRead::LibDvdRead)
-     endif()
- 
-     find_program(AUTORECONF autoreconf REQUIRED)
--    find_program(MAKE_EXECUTABLE make REQUIRED)
-+    find_program(MAKE_EXECUTABLE gmake REQUIRED)
- 
-     set(CONFIGURE_COMMAND ${AUTORECONF} -vif
-                   COMMAND ac_cv_path_GIT= ./configure
diff --git a/multimedia/kodi/files/patch-ffmpeg6-support b/multimedia/kodi/files/patch-ffmpeg6-support
deleted file mode 100644
index f337f73931b2..000000000000
--- a/multimedia/kodi/files/patch-ffmpeg6-support
+++ /dev/null
@@ -1,2155 +0,0 @@
-diff -urN cmake/modules/FindFFMPEG.cmake.orig cmake/modules/FindFFMPEG.cmake
---- cmake/modules/FindFFMPEG.cmake.orig	2023-03-11 22:16:38.000000000 +0000
-+++ cmake/modules/FindFFMPEG.cmake	2023-04-19 10:01:30.831589000 +0000
-@@ -151,14 +151,14 @@
-   set(REQUIRED_FFMPEG_VERSION undef)
- else()
-   # required ffmpeg library versions
--  set(REQUIRED_FFMPEG_VERSION 4.4.1)
--  set(_avcodec_ver ">=58.134.100")
--  set(_avfilter_ver ">=7.110.100")
--  set(_avformat_ver ">=58.76.100")
--  set(_avutil_ver ">=56.70.100")
--  set(_postproc_ver ">=55.9.100")
--  set(_swresample_ver ">=3.9.100")
--  set(_swscale_ver ">=5.9.100")
-+  set(REQUIRED_FFMPEG_VERSION 6.0.0)
-+  set(_avcodec_ver ">=60.2.100")
-+  set(_avfilter_ver ">=9.3.100")
-+  set(_avformat_ver ">=60.3.100")
-+  set(_avutil_ver ">=58.2.100")
-+  set(_postproc_ver ">=57.1.100")
-+  set(_swresample_ver ">=4.10.100")
-+  set(_swscale_ver ">=7.1.100")
- endif()
- 
- # Allows building with external ffmpeg not found in system paths,
-diff -urN tools/buildsteps/windows/patches/0001-ffmpeg-windows-configure-detect-openssl.patch.orig tools/buildsteps/windows/patches/0001-ffmpeg-windows-configure-detect-openssl.patch
---- tools/buildsteps/windows/patches/0001-ffmpeg-windows-configure-detect-openssl.patch.orig	2023-03-11 22:16:38.000000000 +0000
-+++ tools/buildsteps/windows/patches/0001-ffmpeg-windows-configure-detect-openssl.patch	2023-04-19 10:01:22.854832000 +0000
-@@ -11,7 +11,7 @@
- index d7a3f507e8..4b85e881b1 100755
- --- a/configure
- +++ b/configure
--@@ -6530,6 +6530,8 @@ enabled openssl           && { check_pkg_config openssl openssl openssl/ssl.h OP
-+@@ -6728,6 +6728,8 @@ enabled openssl           && { check_pkg_config openssl openssl openssl/ssl.h OP
-                                 check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
-                                 check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
-                                 check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
-diff -urN tools/buildsteps/windows/patches/0002-ffmpeg-windows-configure-fix-zlib-conflict.patch.orig tools/buildsteps/windows/patches/0002-ffmpeg-windows-configure-fix-zlib-conflict.patch
---- tools/buildsteps/windows/patches/0002-ffmpeg-windows-configure-fix-zlib-conflict.patch.orig	2023-03-11 22:16:38.000000000 +0000
-+++ tools/buildsteps/windows/patches/0002-ffmpeg-windows-configure-fix-zlib-conflict.patch	2023-04-19 10:01:22.854952000 +0000
-@@ -11,16 +11,16 @@
- index 4b85e881b1..da457705d1 100755
- --- a/configure
- +++ b/configure
--@@ -7627,6 +7627,9 @@ print_config CONFIG_ "$config_files" $CONFIG_LIST       \
-+@@ -7825,6 +7825,9 @@ print_config CONFIG_ "$config_files" $CONFIG_LIST       \
-+ print_config CONFIG_ "$config_files" $CONFIG_LIST       \
-                                       $CONFIG_EXTRA      \
--                                      $ALL_COMPONENTS    \
-  
- +echo "#if defined(HAVE_UNISTD_H) && HAVE_UNISTD_H == 0" >> $TMPH
- +echo "#undef HAVE_UNISTD_H" >> $TMPH
- +echo "#endif" >> $TMPH
-  echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
-- echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak
-  
-+ # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
- -- 
- 2.29.2
- 
-diff -urN tools/buildsteps/windows/patches/0003-ffmpeg-windows-configure-allow-building-static.patch.orig tools/buildsteps/windows/patches/0003-ffmpeg-windows-configure-allow-building-static.patch
---- tools/buildsteps/windows/patches/0003-ffmpeg-windows-configure-allow-building-static.patch.orig	2023-03-11 22:16:38.000000000 +0000
-+++ tools/buildsteps/windows/patches/0003-ffmpeg-windows-configure-allow-building-static.patch	2023-04-19 10:01:22.855081000 +0000
-@@ -11,7 +11,7 @@
- index da457705d1..e3a8f45ff4 100755
- --- a/configure
- +++ b/configure
--@@ -5440,6 +5440,8 @@ case $target_os in
-+@@ -5566,6 +5566,8 @@ case $target_os in
-          enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
-          enabled x86_32 && check_ldflags -Wl,--large-address-aware
-          shlibdir_default="$bindir_default"
-@@ -20,7 +20,7 @@
-          SLIBPREF=""
-          SLIBSUF=".dll"
-          SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
--@@ -5489,6 +5491,8 @@ case $target_os in
-+@@ -5615,6 +5617,8 @@ case $target_os in
-          fi
-          enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
-          shlibdir_default="$bindir_default"
-diff -urN tools/buildsteps/windows/patches/0004-ffmpeg-windows-configure-detect-libdav1d.patch.orig tools/buildsteps/windows/patches/0004-ffmpeg-windows-configure-detect-libdav1d.patch
---- tools/buildsteps/windows/patches/0004-ffmpeg-windows-configure-detect-libdav1d.patch.orig	2023-03-11 22:16:38.000000000 +0000
-+++ tools/buildsteps/windows/patches/0004-ffmpeg-windows-configure-detect-libdav1d.patch	2023-04-19 10:01:22.855205000 +0000
-@@ -11,7 +11,7 @@
- index e3a8f45ff4..983d7e1078 100755
- --- a/configure
- +++ b/configure
--@@ -6358,7 +6358,7 @@ enabled libcelt           && require libcelt celt/celt.h celt_decode -lcelt0 &&
-+@@ -6541,7 +6541,7 @@ enabled libcelt           && require libcelt celt/celt.h celt_decode -lcelt0 &&
-                                 die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
-  enabled libcaca           && require_pkg_config libcaca caca caca.h caca_create_canvas
-  enabled libcodec2         && require libcodec2 codec2/codec2.h codec2_create -lcodec2
-diff -urN tools/depends/target/ffmpeg/CMakeLists.txt.orig tools/depends/target/ffmpeg/CMakeLists.txt
---- tools/depends/target/ffmpeg/CMakeLists.txt.orig	2023-03-11 22:16:38.000000000 +0000
-+++ tools/depends/target/ffmpeg/CMakeLists.txt	2023-04-19 10:01:22.854687000 +0000
-@@ -92,6 +92,7 @@
- elseif(CORE_SYSTEM_NAME STREQUAL darwin_embedded)
-   list(APPEND ffmpeg_conf --disable-crystalhd
-                           --enable-videotoolbox
-+                          --disable-filter=yadif_videotoolbox
-                           --target-os=darwin
-               )
- elseif(CORE_SYSTEM_NAME STREQUAL osx)
-diff -urN tools/depends/target/ffmpeg/FFMPEG-VERSION.orig tools/depends/target/ffmpeg/FFMPEG-VERSION
---- tools/depends/target/ffmpeg/FFMPEG-VERSION.orig	2023-03-11 22:16:38.000000000 +0000
-+++ tools/depends/target/ffmpeg/FFMPEG-VERSION	2023-04-19 10:02:41.108169000 +0000
-@@ -1,5 +1,5 @@
- LIBNAME=ffmpeg
--BASE_URL=https://github.com/xbmc/FFmpeg
--VERSION=4.4.1-Nexus-Alpha1
-+VERSION=6.0
- ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
--SHA512=8beb04d577b5251e74b0d52f4d130997a8ba94bbd488c7c8309e6b45095c27807e150212888ce3a384b23dff52f8df1a7bde5407bae924ddc363f8125c0616c5
-+SHA512=b3214328f2792364353f38c6b46a71d4970c071d8656b20780abf0e02950167d0933eae825c09102cf8fb19fc679ac444bf1f41a448b624eaa5ea6b0f0bdf4f5
-+
-diff -urN xbmc/cdrip/EncoderFFmpeg.cpp.orig xbmc/cdrip/EncoderFFmpeg.cpp
---- xbmc/cdrip/EncoderFFmpeg.cpp.orig	2023-03-11 22:16:38.000000000 +0000
-+++ xbmc/cdrip/EncoderFFmpeg.cpp	2023-04-19 10:01:22.848595000 +0000
-@@ -11,6 +11,7 @@
- #include "ServiceBroker.h"
- #include "addons/Addon.h"
- #include "addons/AddonManager.h"
-+#include "cores/FFmpeg.h"
- #include "settings/Settings.h"
- #include "settings/SettingsComponent.h"
- #include "utils/StringUtils.h"
-@@ -19,24 +20,9 @@
- #include "utils/log.h"
- 
- using namespace KODI::CDRIP;
-+using FFMPEG_HELP_TOOLS::FFMpegErrorToString;
-+using FFMPEG_HELP_TOOLS::FFMpegException;
- 
--namespace
--{
--
--struct EncoderException : public std::exception
--{
--  std::string s;
--  template<typename... Args>
--  EncoderException(const std::string& fmt, Args&&... args)
--    : s(StringUtils::Format(fmt, std::forward<Args>(args)...))
--  {
--  }
--  ~EncoderException() throw() {} // Updated
--  const char* what() const throw() { return s.c_str(); }
--};
--
--} /* namespace */
--
- bool CEncoderFFmpeg::Init()
- {
-   try
-@@ -54,7 +40,7 @@
-     }
-     else
-     {
--      throw EncoderException("Could not get add-on: {}", addonId);
-+      throw FFMpegException("Could not get add-on: {}", addonId);
-     }
- 
-     // Hack fix about PTS on generated files.
-@@ -66,50 +52,50 @@
-     else if (addonId == "audioencoder.kodi.builtin.wma")
-       m_samplesCountMultiply = 1000;
-     else
--      throw EncoderException("Internal add-on id \"{}\" not known as usable", addonId);
-+      throw FFMpegException("Internal add-on id \"{}\" not known as usable", addonId);
- 
-     const std::string filename = URIUtils::GetFileName(m_strFile);
- 
-     m_formatCtx = avformat_alloc_context();
-     if (!m_formatCtx)
--      throw EncoderException("Could not allocate output format context");
-+      throw FFMpegException("Could not allocate output format context");
- 
-     m_bcBuffer = static_cast<uint8_t*>(av_malloc(BUFFER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE));
-     if (!m_bcBuffer)
--      throw EncoderException("Could not allocate buffer");
-+      throw FFMpegException("Could not allocate buffer");
- 
-     m_formatCtx->pb = avio_alloc_context(m_bcBuffer, BUFFER_SIZE, AVIO_FLAG_WRITE, this, nullptr,
-                                          avio_write_callback, avio_seek_callback);
-     if (!m_formatCtx->pb)
--      throw EncoderException("Failed to allocate ByteIOContext");
-+      throw FFMpegException("Failed to allocate ByteIOContext");
- 
-     /* Guess the desired container format based on the file extension. */
-     m_formatCtx->oformat = av_guess_format(nullptr, filename.c_str(), nullptr);
-     if (!m_formatCtx->oformat)
--      throw EncoderException("Could not find output file format");
-+      throw FFMpegException("Could not find output file format");
- 
-     m_formatCtx->url = av_strdup(filename.c_str());
-     if (!m_formatCtx->url)
--      throw EncoderException("Could not allocate url");
-+      throw FFMpegException("Could not allocate url");
- 
-     /* Find the encoder to be used by its name. */
--    AVCodec* codec = avcodec_find_encoder(m_formatCtx->oformat->audio_codec);
-+    const AVCodec* codec = avcodec_find_encoder(m_formatCtx->oformat->audio_codec);
-     if (!codec)
--      throw EncoderException("Unable to find a suitable FFmpeg encoder");
-+      throw FFMpegException("Unable to find a suitable FFmpeg encoder");
- 
-     /* Create a new audio stream in the output file container. */
-     m_stream = avformat_new_stream(m_formatCtx, nullptr);
-     if (!m_stream)
--      throw EncoderException("Failed to allocate AVStream context");
-+      throw FFMpegException("Failed to allocate AVStream context");
- 
-     m_codecCtx = avcodec_alloc_context3(codec);
-     if (!m_codecCtx)
--      throw EncoderException("Failed to allocate the encoder context");
-+      throw FFMpegException("Failed to allocate the encoder context");
- 
-     /* Set the basic encoder parameters.
-      * The input file's sample rate is used to avoid a sample rate conversion. */
--    m_codecCtx->channels = m_iInChannels;
--    m_codecCtx->channel_layout = av_get_default_channel_layout(m_iInChannels);
-+    av_channel_layout_uninit(&m_codecCtx->ch_layout);
-+    av_channel_layout_default(&m_codecCtx->ch_layout, m_iInChannels);
-     m_codecCtx->sample_rate = m_iInSampleRate;
-     m_codecCtx->sample_fmt = codec->sample_fmts[0];
-     m_codecCtx->bit_rate = bitrate;
-@@ -128,14 +114,14 @@
- 
-     int err = avcodec_open2(m_codecCtx, codec, nullptr);
-     if (err < 0)
--      throw EncoderException("Failed to open the codec {} (error '{}')",
--                             codec->long_name ? codec->long_name : codec->name,
--                             FFmpegErrorToString(err));
-+      throw FFMpegException("Failed to open the codec {} (error '{}')",
-+                            codec->long_name ? codec->long_name : codec->name,
-+                            FFMpegErrorToString(err));
- 
-     err = avcodec_parameters_from_context(m_stream->codecpar, m_codecCtx);
-     if (err < 0)
--      throw EncoderException("Failed to copy encoder parameters to output stream (error '{}')",
--                             FFmpegErrorToString(err));
-+      throw FFMpegException("Failed to copy encoder parameters to output stream (error '{}')",
-+                            FFMpegErrorToString(err));
- 
-     m_inFormat = GetInputFormat(m_iInBitsPerSample);
-     m_outFormat = m_codecCtx->sample_fmt;
-@@ -150,44 +136,48 @@
- 
-     m_bufferFrame = av_frame_alloc();
-     if (!m_bufferFrame || !m_buffer)
--      throw EncoderException("Failed to allocate necessary buffers");
-+      throw FFMpegException("Failed to allocate necessary buffers");
- 
-     m_bufferFrame->nb_samples = m_codecCtx->frame_size;
-     m_bufferFrame->format = m_inFormat;
--    m_bufferFrame->channel_layout = m_codecCtx->channel_layout;
-+
-+    av_channel_layout_uninit(&m_bufferFrame->ch_layout);
-+    av_channel_layout_copy(&m_bufferFrame->ch_layout, &m_codecCtx->ch_layout);
-+
-     m_bufferFrame->sample_rate = m_codecCtx->sample_rate;
- 
-     err = av_frame_get_buffer(m_bufferFrame, 0);
-     if (err < 0)
--      throw EncoderException("Could not allocate output frame samples (error '{}')",
--                             FFmpegErrorToString(err));
-+      throw FFMpegException("Could not allocate output frame samples (error '{}')",
-+                            FFMpegErrorToString(err));
- 
-     avcodec_fill_audio_frame(m_bufferFrame, m_iInChannels, m_inFormat, m_buffer, m_neededBytes, 0);
- 
-     if (m_needConversion)
-     {
--      m_swrCtx = swr_alloc_set_opts(nullptr, m_codecCtx->channel_layout, m_outFormat,
--                                    m_codecCtx->sample_rate, m_codecCtx->channel_layout, m_inFormat,
-+      int ret = swr_alloc_set_opts2(&m_swrCtx, &m_codecCtx->ch_layout, m_outFormat,
-+                                    m_codecCtx->sample_rate, &m_codecCtx->ch_layout, m_inFormat,
-                                     m_codecCtx->sample_rate, 0, nullptr);
--      if (!m_swrCtx || swr_init(m_swrCtx) < 0)
--        throw EncoderException("Failed to initialize the resampler");
-+      if (ret || swr_init(m_swrCtx) < 0)
-+        throw FFMpegException("Failed to initialize the resampler");
- 
-       m_resampledBufferSize =
-           av_samples_get_buffer_size(nullptr, m_iInChannels, m_neededFrames, m_outFormat, 0);
-       m_resampledBuffer = static_cast<uint8_t*>(av_malloc(m_resampledBufferSize));
-       m_resampledFrame = av_frame_alloc();
-       if (!m_resampledBuffer || !m_resampledFrame)
--        throw EncoderException("Failed to allocate a frame for resampling");
-+        throw FFMpegException("Failed to allocate a frame for resampling");
- 
-       m_resampledFrame->nb_samples = m_neededFrames;
-       m_resampledFrame->format = m_outFormat;
--      m_resampledFrame->channel_layout = m_codecCtx->channel_layout;
-+      av_channel_layout_uninit(&m_resampledFrame->ch_layout);
-+      av_channel_layout_copy(&m_resampledFrame->ch_layout, &m_codecCtx->ch_layout);
-       m_resampledFrame->sample_rate = m_codecCtx->sample_rate;
- 
-       err = av_frame_get_buffer(m_resampledFrame, 0);
-       if (err < 0)
--        throw EncoderException("Could not allocate output resample frame samples (error '{}')",
--                               FFmpegErrorToString(err));
-+        throw FFMpegException("Could not allocate output resample frame samples (error '{}')",
-+                              FFMpegErrorToString(err));
- 
-       avcodec_fill_audio_frame(m_resampledFrame, m_iInChannels, m_outFormat, m_resampledBuffer,
-                                m_resampledBufferSize, 0);
-@@ -204,7 +194,7 @@
-     /* write the header */
-     err = avformat_write_header(m_formatCtx, nullptr);
-     if (err != 0)
--      throw EncoderException("Failed to write the header (error '{}')", FFmpegErrorToString(err));
-+      throw FFMpegException("Failed to write the header (error '{}')", FFMpegErrorToString(err));
- 
-     CLog::Log(LOGDEBUG, "CEncoderFFmpeg::{} - Successfully initialized with muxer {} and codec {}",
-               __func__,
-@@ -212,16 +202,19 @@
-                                               : m_formatCtx->oformat->name,
-               codec->long_name ? codec->long_name : codec->name);
-   }
--  catch (EncoderException& caught)
-+  catch (const FFMpegException& caught)
-   {
-     CLog::Log(LOGERROR, "CEncoderFFmpeg::{} - {}", __func__, caught.what());
- 
-     av_freep(&m_buffer);
-+    av_channel_layout_uninit(&m_bufferFrame->ch_layout);
-     av_frame_free(&m_bufferFrame);
-     swr_free(&m_swrCtx);
-+    av_channel_layout_uninit(&m_resampledFrame->ch_layout);
-     av_frame_free(&m_resampledFrame);
-     av_freep(&m_resampledBuffer);
-     av_free(m_bcBuffer);
-+    av_channel_layout_uninit(&m_codecCtx->ch_layout);
-     avcodec_free_context(&m_codecCtx);
-     if (m_formatCtx)
-     {
-@@ -299,7 +292,7 @@
-       if (swr_convert(m_swrCtx, m_resampledFrame->data, m_neededFrames,
-                       const_cast<const uint8_t**>(m_bufferFrame->extended_data),
-                       m_neededFrames) < 0)
--        throw EncoderException("Error resampling audio");
-+        throw FFMpegException("Error resampling audio");
- 
-       frame = m_resampledFrame;
-     }
-@@ -316,8 +309,8 @@
-     m_bufferSize = 0;
-     err = avcodec_send_frame(m_codecCtx, frame);
-     if (err < 0)
--      throw EncoderException("Error sending a frame for encoding (error '{}')", __func__,
--                             FFmpegErrorToString(err));
-+      throw FFMpegException("Error sending a frame for encoding (error '{}')",
-+                            FFMpegErrorToString(err));
- 
-     while (err >= 0)
-     {
-@@ -329,19 +322,18 @@
-       }
-       else if (err < 0)
-       {
--        throw EncoderException("Error during encoding (error '{}')", __func__,
--                               FFmpegErrorToString(err));
-+        throw FFMpegException("Error during encoding (error '{}')", FFMpegErrorToString(err));
-       }
- 
-       err = av_write_frame(m_formatCtx, pkt);
-       if (err < 0)
--        throw EncoderException("Failed to write the frame data (error '{}')", __func__,
--                               FFmpegErrorToString(err));
-+        throw FFMpegException("Failed to write the frame data (error '{}')",
-+                              FFMpegErrorToString(err));
- 
-       av_packet_unref(pkt);
-     }
-   }
--  catch (EncoderException& caught)
-+  catch (const FFMpegException& caught)
-   {
-     CLog::Log(LOGERROR, "CEncoderFFmpeg::{} - {}", __func__, caught.what());
-   }
-@@ -366,8 +358,10 @@
- 
-     /* Flush if needed */
-     av_freep(&m_buffer);
-+    av_channel_layout_uninit(&m_bufferFrame->ch_layout);
-     av_frame_free(&m_bufferFrame);
-     swr_free(&m_swrCtx);
-+    av_channel_layout_uninit(&m_resampledFrame->ch_layout);
-     av_frame_free(&m_resampledFrame);
-     av_freep(&m_resampledBuffer);
-     m_needConversion = false;
-@@ -379,6 +373,7 @@
- 
-     /* cleanup */
-     av_free(m_bcBuffer);
-+    av_channel_layout_uninit(&m_codecCtx->ch_layout);
-     avcodec_free_context(&m_codecCtx);
-     av_freep(&m_formatCtx->pb);
-     avformat_free_context(m_formatCtx);
-@@ -400,14 +395,6 @@
-     case 32:
-       return AV_SAMPLE_FMT_S32;
-     default:
--      throw EncoderException("Invalid input bits per sample");
-+      throw FFMpegException("Invalid input bits per sample");
-   }
--}
--
--std::string CEncoderFFmpeg::FFmpegErrorToString(int err)
--{
--  std::string text;
--  text.reserve(AV_ERROR_MAX_STRING_SIZE);
--  av_strerror(err, text.data(), AV_ERROR_MAX_STRING_SIZE);
--  return text;
- }
-diff -urN xbmc/cdrip/EncoderFFmpeg.h.orig xbmc/cdrip/EncoderFFmpeg.h
---- xbmc/cdrip/EncoderFFmpeg.h.orig	2023-03-11 22:16:38.000000000 +0000
-+++ xbmc/cdrip/EncoderFFmpeg.h	2023-04-19 10:01:22.835616000 +0000
-@@ -39,7 +39,6 @@
-   void SetTag(const std::string& tag, const std::string& value);
-   bool WriteFrame();
-   AVSampleFormat GetInputFormat(int inBitsPerSample);
--  std::string FFmpegErrorToString(int err);
- 
-   AVFormatContext* m_formatCtx{nullptr};
-   AVCodecContext* m_codecCtx{nullptr};
-diff -urN xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp.orig xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp
---- xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp.orig	2023-03-11 22:16:38.000000000 +0000
-+++ xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp	2023-04-19 10:01:22.848879000 +0000
-@@ -10,14 +10,25 @@
- #define DTS_ENCODE_BITRATE 1411200
- 
- #include "cores/AudioEngine/Encoders/AEEncoderFFmpeg.h"
--#include "cores/AudioEngine/Utils/AEUtil.h"
-+
- #include "ServiceBroker.h"
--#include "utils/log.h"
-+#include "cores/AudioEngine/Utils/AEUtil.h"
-+#include "cores/FFmpeg.h"
- #include "settings/Settings.h"
- #include "settings/SettingsComponent.h"
--#include <string.h>
-+#include "utils/log.h"
-+
-+extern "C"
-+{
-+#include <libavutil/channel_layout.h>
-+}
-+
- #include <cassert>
-+#include <string.h>
- 
-+using FFMPEG_HELP_TOOLS::FFMpegErrorToString;
-+using FFMPEG_HELP_TOOLS::FFMpegException;
-+
- CAEEncoderFFmpeg::CAEEncoderFFmpeg() : m_CodecCtx(NULL), m_SwrCtx(NULL)
- {
- }
-@@ -26,6 +37,7 @@
- {
-   Reset();
-   swr_free(&m_SwrCtx);
-+  av_channel_layout_uninit(&m_CodecCtx->ch_layout);
-   avcodec_free_context(&m_CodecCtx);
- }
- 
-@@ -81,7 +93,7 @@
- 
-   bool ac3 = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_AUDIOOUTPUT_AC3PASSTHROUGH);
- 
--  AVCodec *codec = NULL;
-+  const AVCodec* codec = nullptr;
- 
-   /* fallback to ac3 if we support it, we might not have DTS support */
-   if (ac3)
-@@ -102,7 +114,8 @@
- 
-   m_CodecCtx->bit_rate = m_BitRate;
-   m_CodecCtx->sample_rate = format.m_sampleRate;
--  m_CodecCtx->channel_layout = AV_CH_LAYOUT_5POINT1_BACK;
-+  av_channel_layout_uninit(&m_CodecCtx->ch_layout);
-+  av_channel_layout_from_mask(&m_CodecCtx->ch_layout, AV_CH_LAYOUT_5POINT1_BACK);
- 
-   /* select a suitable data format */
-   if (codec->sample_fmts)
-@@ -179,22 +192,28 @@
-           LOGERROR,
-           "CAEEncoderFFmpeg::Initialize - Unable to find a suitable data format for the codec ({})",
-           m_CodecName);
-+      av_channel_layout_uninit(&m_CodecCtx->ch_layout);
-       avcodec_free_context(&m_CodecCtx);
-       return false;
-     }
-   }
- 
--  m_CodecCtx->channels = BuildChannelLayout(m_CodecCtx->channel_layout, m_Layout);
-+  uint64_t mask = m_CodecCtx->ch_layout.u.mask;
-+  av_channel_layout_uninit(&m_CodecCtx->ch_layout);
-+  av_channel_layout_from_mask(&m_CodecCtx->ch_layout, mask);
-+  m_CodecCtx->ch_layout.nb_channels = BuildChannelLayout(mask, m_Layout);
- 
-   /* open the codec */
-   if (avcodec_open2(m_CodecCtx, codec, NULL))
-   {
-+    av_channel_layout_uninit(&m_CodecCtx->ch_layout);
-     avcodec_free_context(&m_CodecCtx);
-     return false;
-   }
- 
-   format.m_frames = m_CodecCtx->frame_size;
--  format.m_frameSize = m_CodecCtx->channels * (CAEUtil::DataFormatToBits(format.m_dataFormat) >> 3);
-+  int channels = m_CodecCtx->ch_layout.nb_channels;
-+  format.m_frameSize = channels * (CAEUtil::DataFormatToBits(format.m_dataFormat) >> 3);
-   format.m_channelLayout = m_Layout;
- 
-   m_CurrentFormat = format;
-@@ -204,14 +223,14 @@
- 
-   if (m_NeedConversion)
-   {
--    m_SwrCtx = swr_alloc_set_opts(NULL,
--                      m_CodecCtx->channel_layout, m_CodecCtx->sample_fmt, m_CodecCtx->sample_rate,
--                      m_CodecCtx->channel_layout, AV_SAMPLE_FMT_FLT, m_CodecCtx->sample_rate,
--                      0, NULL);
--    if (!m_SwrCtx || swr_init(m_SwrCtx) < 0)
-+    int ret = swr_alloc_set_opts2(&m_SwrCtx, &m_CodecCtx->ch_layout, m_CodecCtx->sample_fmt,
-+                                  m_CodecCtx->sample_rate, &m_CodecCtx->ch_layout,
-+                                  AV_SAMPLE_FMT_FLT, m_CodecCtx->sample_rate, 0, NULL);
-+    if (ret || swr_init(m_SwrCtx) < 0)
-     {
-       CLog::Log(LOGERROR, "CAEEncoderFFmpeg::Initialize - Failed to initialise resampler.");
-       swr_free(&m_SwrCtx);
-+      av_channel_layout_uninit(&m_CodecCtx->ch_layout);
-       avcodec_free_context(&m_CodecCtx);
-       return false;
-     }
-@@ -242,62 +261,83 @@
- 
- int CAEEncoderFFmpeg::Encode(uint8_t *in, int in_size, uint8_t *out, int out_size)
- {
--  int got_output;
--  AVFrame *frame;
-+  int size = 0;
-+  int err = AVERROR_UNKNOWN;
-+  AVFrame* frame = nullptr;
-+  AVPacket* pkt = nullptr;
- 
-   if (!m_CodecCtx)
--    return 0;
-+    return size;
- 
--  /* allocate the input frame
--   * sadly, we have to alloc/dealloc it everytime since we have no guarantee the
--   * data argument will be constant over iterated calls and the frame needs to
--   * setup pointers inside data */
--  frame = av_frame_alloc();
--  if (!frame)
--    return 0;
-+  try
-+  {
-+    /* allocate the input frame and output packet
-+     * sadly, we have to alloc/dealloc it everytime since we have no guarantee the
-+     * data argument will be constant over iterated calls and the frame needs to
-+     * setup pointers inside data */
-+    frame = av_frame_alloc();
-+    pkt = av_packet_alloc();
-+    if (!frame || !pkt)
-+      throw FFMpegException(
-+          "Failed to allocate \"AVFrame\" or \"AVPacket\" for encoding (error '{}')",
-+          strerror(errno));
- 
--  frame->nb_samples = m_CodecCtx->frame_size;
--  frame->format = m_CodecCtx->sample_fmt;
--  frame->channel_layout = m_CodecCtx->channel_layout;
--  frame->channels = m_CodecCtx->channels;
-+    frame->nb_samples = m_CodecCtx->frame_size;
-+    frame->format = m_CodecCtx->sample_fmt;
-+    av_channel_layout_uninit(&frame->ch_layout);
-+    av_channel_layout_copy(&frame->ch_layout, &m_CodecCtx->ch_layout);
-+    int channelNum = m_CodecCtx->ch_layout.nb_channels;
- 
--  avcodec_fill_audio_frame(frame, m_CodecCtx->channels, m_CodecCtx->sample_fmt,
--                    in, in_size, 0);
-+    avcodec_fill_audio_frame(frame, channelNum, m_CodecCtx->sample_fmt, in, in_size, 0);
- 
--  /* initialize the output packet */
--  AVPacket* pkt = av_packet_alloc();
--  if (!pkt)
-+    /* encode it */
-+    err = avcodec_send_frame(m_CodecCtx, frame);
-+    if (err < 0)
-+      throw FFMpegException("Error sending a frame for encoding (error '{}')",
-+                            FFMpegErrorToString(err));
-+
-+    err = avcodec_receive_packet(m_CodecCtx, pkt);
-+    //! @TODO: This is a workaround for our current design. The caller should be made
-+    // aware of the potential error values to use the ffmpeg API in a proper way, which means
-+    // copying with EAGAIN and multiple packet output.
-+    // For the current situation there is a relationship implicitely assumed of:
-+    // 1 frame in - 1 packet out. This holds true in practice but the API does not guarantee it.
-+    if (err >= 0)
-+    {
-+      if (pkt->size <= out_size)
-+      {
-+        memset(out, 0, out_size);
-+        memcpy(out, pkt->data, pkt->size);
-+        size = pkt->size;
-+      }
-+      else
-+      {
-+        CLog::LogF(LOGERROR, "Encoded pkt size ({}) is bigger than buffer ({})", pkt->size,
-+                   out_size);
-+      }
-+      av_packet_unref(pkt);
-+    }
-+    else
-+    {
-+      CLog::LogF(LOGERROR, "Error receiving encoded paket ({})", err);
-+    }
-+  }
-+  catch (const FFMpegException& caught)
-   {
--    CLog::Log(LOGERROR, "CAEEncoderFFmpeg::{} - av_packet_alloc failed: {}", __FUNCTION__,
--              strerror(errno));
--    av_frame_free(&frame);
--    return 0;
-+    CLog::Log(LOGERROR, "CAEEncoderFFmpeg::{} - {}", __func__, caught.what());
-   }
- 
--  pkt->size = out_size;
--  pkt->data = out;
-+  av_channel_layout_uninit(&frame->ch_layout);
- 
--  /* encode it */
--  int ret = avcodec_encode_audio2(m_CodecCtx, pkt, frame, &got_output);
--
--  int size = pkt->size;
--
-   /* free temporary data */
-   av_frame_free(&frame);
- 
-   /* free the packet */
-   av_packet_free(&pkt);
- 
--  if (ret < 0 || !got_output)
--  {
--    CLog::Log(LOGERROR, "CAEEncoderFFmpeg::Encode - Encoding failed");
--    return 0;
--  }
*** 1912 LINES SKIPPED ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405260533.44Q5XsPo059911>