Subject: [PATCH 4/4] community/kodi: upgrade to 18.2

From: Bart Ribbers <[email-masked]>
Date: Wed, 31 Jul 2019 00:45:52 +0200

The main build system switched to cmake, but some of the dependencies still require autotools.

libdvdcss, libdvdread and libdvdnav can not be used with system-wide versions. CrossGuid in theory can, but it seems to fail in practice so I made it use the Kodi version instead for now.
---
 .../19-fix-audio-with-latest-ffmpeg.patch     |  15 -
 community/kodi/APKBUILD                       | 154 +++---
 community/kodi/add-missing-includes.patch     |  10 -
 community/kodi/ffmpeg-4.0.1.patch             | 345 -------------
 community/kodi/fix-fileemu.patch              | 467 ------------------
 community/kodi/fix-musl-incompability.patch   | 108 ++++
 community/kodi/fix-musl.patch                 | 124 -----
 community/kodi/fortify-source-fix.patch       |  11 -
 community/kodi/remove-filewrap.patch          |  44 --
 community/kodi/vaapi.patch                    |  15 -
 10 files changed, 205 insertions(+), 1088 deletions(-)
 delete mode 100644 community/kodi/19-fix-audio-with-latest-ffmpeg.patch
 delete mode 100644 community/kodi/add-missing-includes.patch
 delete mode 100644 community/kodi/ffmpeg-4.0.1.patch
 delete mode 100644 community/kodi/fix-fileemu.patch
 create mode 100644 community/kodi/fix-musl-incompability.patch
 delete mode 100644 community/kodi/fix-musl.patch
 delete mode 100644 community/kodi/fortify-source-fix.patch
 delete mode 100644 community/kodi/remove-filewrap.patch
 delete mode 100644 community/kodi/vaapi.patch

diff --git a/community/kodi/19-fix-audio-with-latest-ffmpeg.patch b/community/kodi/19-fix-audio-with-latest-ffmpeg.patch
deleted file mode 100644
index 5f5e613bed..0000000000
--- a/community/kodi/19-fix-audio-with-latest-ffmpeg.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-From: Stefan Hachmann <[email-masked]>
-To: [email-masked]
-Subject: Re: Bug#881536: ffmpeg: Breaks sound in kodi
-
---- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
-+++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
-@@ -486,7 +486,7 @@
-         // guess next pts
-         m_audioClock += audioframe.duration;
- 
--        int ret = m_pAudioCodec->Decode(nullptr, 0, DVD_NOPTS_VALUE, DVD_NOPTS_VALUE);
-+        int ret = 0;
-         if (ret < 0)
-         {
-           CLog::Log(LOGERROR, "CVideoPlayerAudio::DecodeFrame - Decode Error. Skipping audio packet (%d)", ret);
diff --git a/community/kodi/APKBUILD b/community/kodi/APKBUILD
index d797b41dd5..1adc99f3aa 100644
--- a/community/kodi/APKBUILD
+++ b/community/kodi/APKBUILD
@@ -1,86 +1,126 @@
 # Contributor: Carlo Landmeter <[email-masked]>
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=kodi
-pkgver=17.6
-_realname=Krypton
-pkgrel=12
+pkgver=18.2
+_realname=Leia
+pkgrel=0
+_libdvdcss_pkgver="1.4.2-Leia-Beta-5"
+_libdvdread_pkgver="6.0.0-Leia-Alpha-3"
+_libdvdnav_pkgver="6.0.0-Leia-Alpha-3"
+_crossguid_hash="8f399e8bd4"
 pkgdesc="A software media player and entertainment hub for digital media"
 url="https://kodi.tv"
 arch="x86 x86_64"
 license="GPL-2.0-only"
-depends="python2 hicolor-icon-theme xdpyinfo unrar mesa-demos curl py-pillow
-	py-bluez py-simplejson"
-depends_dev="gettext-dev boost-dev mesa-dev glew-dev glu-dev mariadb-connector-c-dev
-	libass-dev libogg-dev libvorbis-dev libmodplug-dev curl-dev flac-dev
-	libgcrypt-dev bzip2-dev tiff-dev lzo-dev yajl-dev bluez-dev tinyxml-dev
-	fribidi-dev sqlite-dev libpng-dev libcdio-dev pcre-dev freetype-dev
-	taglib-dev jasper-dev alsa-lib-dev dbus-dev sdl-dev sdl_image-dev
-	lame-dev libmicrohttpd-dev libbluray-dev avahi-dev libxrandr-dev
-	libxt-dev libxmu-dev samba-dev gawk libssh-dev libva-glx-dev libnfs-dev
-	yasm-dev libmpeg2-dev libmad-dev libsamplerate-dev rtmpdump-dev
-	libjpeg-turbo-dev eudev-dev libcap-dev udisks2-dev faac-dev gnutls-dev
-	libxslt-dev libplist-dev libshairport-dev ffmpeg-dev afpfs-ng-dev
-	libcec-dev x264-dev bsd-compat-headers python2-dev dcadec-dev
-	libdvdcss-dev"
-makedepends="$depends_dev automake autoconf m4 libtool swig findutils
-	openjdk8-jre-base boost-thread zip gperf cmake coreutils nasm tar
-	git bash xz"
+depends="python2 
+	hicolor-icon-theme
+	xdpyinfo
+	curl
+	py-pillow
+	py-bluez
+	py-simplejson"
+# Required dependencies
+depends_dev="libass-dev
+	libcdio-dev
+	curl-dev
+	ffmpeg-dev
+	flatbuffers-dev
+	fmt-dev
+	freetype-dev
+	fribidi-dev
+	fstrcmp-dev
+	libdvdcss-dev
+	lzo-dev
+	openssl-dev
+	pcre-dev
+	rapidjson-dev
+	sqlite-dev
+	taglib-dev
+	tinyxml-dev
+	zlib-dev
+	giflib-dev
+	mesa-dev
+	glu-dev
+	libjpeg-turbo-dev
+
+	alsa-lib-dev
+	avahi-dev
+	bluez-dev
+	libbluray-dev
+	libcap-dev
+	libcec-dev
+	dbus-dev
+	libmicrohttpd-dev
+	libnfs-dev
+	libplist-dev
+	pulseaudio-dev
+	python2-dev
+	samba-dev
+	eudev-dev
+	libxslt-dev
+	mariadb-connector-c-dev
+	libshairport-dev
+	libva-glx-dev"
+makedepends="$depends_dev
+	cmake
+	swig
+	autoconf
+	automake
+	libtool
+	doxygen
+	graphviz
+	xz
+	tar
+	openjdk8-jre-base"
 subpackages="$pkgname-dev $pkgname-doc $pkgname-dbg"
 replaces="xbmc"
 options="ldpath-recursive !check" # No testsuite
 source="https://github.com/xbmc/xbmc/archive/$pkgver-$_realname.tar.gz
-	fix-musl.patch
-	fix-fileemu.patch
-	fortify-source-fix.patch
-	remove-filewrap.patch
-	add-missing-includes.patch
+	libdvdcss-$_libdvdcss_pkgver.tar.gz::https://github.com/xbmc/libdvdcss/archive/$_libdvdcss_pkgver.tar.gz
+	libdvdread-$_libdvdread_pkgver.tar.gz::https://github.com/xbmc/libdvdread/archive/$_libdvdread_pkgver.tar.gz
+	libdvdnav-$_libdvdnav_pkgver.tar.gz::https://github.com/xbmc/libdvdnav/archive/$_libdvdnav_pkgver.tar.gz
+	crossguid-$_crossguid_hash.tar.gz::https://mirrors.kodi.tv/build-deps/sources/crossguid-$_crossguid_hash.tar.gz
 	set-default-stacksize.patch
-	19-fix-audio-with-latest-ffmpeg.patch
-	ffmpeg-4.0.1.patch
-	vaapi.patch
+	fix-musl-incompability.patch
 	"
 
 builddir="$srcdir/xbmc-$pkgver-$_realname"
 
 prepare() {
 	default_prepare
-	MAKEFLAGS="-j1" ./bootstrap
-	mkdir -p crossguid
-	make -j1 -C tools/depends/target/crossguid PREFIX="$PWD"/crossguid
+
+	mkdir "$builddir"/build
 }
 
 build() {
-	LDFLAGS="$LDFLAGS -L$PWD/crossguid/lib" \
-	CXXFLAGS="$CXXFLAGS -I$PWD/crossguid/include" \
-	CONFIG_SHELL=/bin/bash \
-	./configure \
-		--build=$CBUILD \
-		--host=$CHOST \
-		--prefix=/usr \
-		--sysconfdir=/etc \
-		--mandir=/usr/share/man \
-		--infodir=/usr/share/info \
-		--localstatedir=/var \
-		--disable-non-free \
-		--disable-debug \
-		--with-ffmpeg=shared \
-		--enable-static=no \
-		--enable-libbluray \
-		--enable-external-libraries
+	make -C tools/depends/target/crossguid PREFIX="$PWD"/usr
+	cd "$builddir"/build
+	cmake "$builddir" \
+		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DCMAKE_INSTALL_LIBDIR=lib \
+		-DENABLE_INTERNAL_CROSSGUID=ON \
+		-DENABLE_INTERNAL_FFMPEG=OFF \
+		-DENABLE_INTERNAL_RapidJSON=OFF \
+		-DENABLE_INTERNAL_FMT=OFF \
+		-DENABLE_INTERNAL_FSTRCMP=OFF \
+		-DENABLE_INTERNAL_FLATBUFFERS=OFF \
+		-Dlibdvdcss_URL="$srcdir"/libdvdcss-$_libdvdcss_pkgver.tar.gz \
+		-Dlibdvdread_URL="$srcdir"/libdvdread-$_libdvdread_pkgver.tar.gz \
+		-Dlibdvdnav_URL="$srcdir"/libdvdnav-$_libdvdnav_pkgver.tar.gz \
+		-DCROSSGUID_URL="$srcdir"/crossguid-$_crossguid_hash.tar.gz
 	make
 }
 
 package() {
+	cd "$builddir"/build
 	make DESTDIR="$pkgdir" install
 }
 
-sha512sums="1f1ba91e6129ab423f9ad47b63d7bb75775dbf18638a96413a572aaa790f4f0d738ca35486513e158a7f55d501f78f08dd9d68aabe2fbb80a729c6091b264111  17.6-Krypton.tar.gz
-f225073ca75647581463094c0a9d1dd1fa3e1a58353292e1c99da30eb6f97026f4647853da2bbdc7777c6c1b13a16b368b09c93f5d4c1be13f8a11b4bbfbabbf  fix-musl.patch
-7dea044f77d9a38a4bccc9d542ba62d0146f2bf60f92999ddada1a4fc020b88e054c7f047ba9b8b21639889b31c3f117308f38aa50fab759f941cc014cb0e69d  fix-fileemu.patch
-5e972e6f6ad13f5dc8ac5e9d593171988e0cc93879178aa7621af44d41b89b5b86429af4d0c2e6516b626d042f247bcf0b1f957f647138a03ce73c5c7b3311b9  fortify-source-fix.patch
-118a4e10ac5abdd9b6cfc87ad1b91cf03b3641023337571250beb5125c2c830e678eced1e42703253d66af61ec9fe3ce6c44cf7c0012d457f9bebc0ddfe992d2  remove-filewrap.patch
-378a0e8fd9676dd76cfb30d62085b953625dd0185e2673de2331fc7ae0802dae4f56d0b74e878e4d313942fda8831e9669bff284dbe974db5ad16fe07af884d6  add-missing-includes.patch
+sha512sums="7b63dc9c082f538690d28dd6da10999888af2b9de2e532bca54420753f64238f42e1c2aa0f7481c823e544260a1e4d68e1ba50f84db53307d08f0749992dff2f  18.2-Leia.tar.gz
+5185dbdbeb1bd13ea9d8723f1f4ab599d6f3102f5ba1096cd085aa1cda252c045f327c719227bba8e1b742352ade5e335106c8d0c1637a5a6b93ce661620dd7e  libdvdcss-1.4.2-Leia-Beta-5.tar.gz
+b3419ba0a1a2dd70f1bb6236afdfe1c6e88c9ad4264198b289e3bba9375e077cecf7f89848c7b09debaa445327f3507101f3d157e692f7a7163b2bb52643e1e7  libdvdread-6.0.0-Leia-Alpha-3.tar.gz
+11c93eaacd156f8fd7dec7c43d366438b201f31ad55b2870463a9e286912b6ada08882319a021fb7992190f87b909a49f2b83e0321cc17aedc29f7fe5898fa72  libdvdnav-6.0.0-Leia-Alpha-3.tar.gz
+2682d63609d3dcdfcd8136be632e45df26ad88ce93b9c49745cf728bbd2e6254a7b05c8b059ab581d532372e504206a525a52564b64d076dfdae9c965a09fd16  crossguid-8f399e8bd4.tar.gz
 3fd97e9fa22e59b3cd30fdad19474e177a9d062598765fa8ba4955f1da4e10581ff1463dd0794d3ee3cefebf753007a4d445b2bc47a257574d3927c1408b8876  set-default-stacksize.patch
-3c35ef05b79cf0af9bacc74bb79dd1178efb1cb6de0354b7a35c732c2006cc7071748a062f3b274591dcb30179d4cc0af527a223dcad2919426bac663f038dbb  19-fix-audio-with-latest-ffmpeg.patch
-e6f0065cd4e505ae861f3df810d62bbd2255c38d3fd7d622cfb742dba26bad1a992a1c1812aaf540e17ce23d95bcb9c3895b6e78e0a2cfceebbd3a60b3a5cc24  ffmpeg-4.0.1.patch
-d30e0c1c7e68ce67a35e4d552517058a1da96a7bd0b441ec9084f4e8d695d3c368b3230660a069a74fa2cb7c2d32bbfdcce51517c7d88fc9b043068e953b5cc9  vaapi.patch"
+65b78a96bef33cec975b371f1a930d551d7b224955d6075b7edc7e51ec30fec9c77d34f622abbaf827c60df6029206b72c02ee2d2f138d276c1b843336fd14ab  fix-musl-incompability.patch"
diff --git a/community/kodi/add-missing-includes.patch b/community/kodi/add-missing-includes.patch
deleted file mode 100644
index 236bfa6fd0..0000000000
--- a/community/kodi/add-missing-includes.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/xbmc/filesystem/ZipManager.h.orig
-+++ b/xbmc/filesystem/ZipManager.h
-@@ -33,6 +33,7 @@
- #include <string>
- #include <vector>
- #include <map>
-+#include <stdint.h>
- 
- class CURL;
- 
diff --git a/community/kodi/ffmpeg-4.0.1.patch b/community/kodi/ffmpeg-4.0.1.patch
deleted file mode 100644
index ba1a5320e2..0000000000
--- a/community/kodi/ffmpeg-4.0.1.patch
+++ /dev/null
@@ -1,345 +0,0 @@
---- xbmc-17.6-Krypton/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h	2017-11-14 17:55:01.000000000 +0100
-+++ xbmc-17.6-Krypton/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h	2018-07-02 20:54:54.388785087 +0200
-@@ -56,7 +56,7 @@
-   SwrContext *m_SwrCtx;
-   CAEChannelInfo m_Layout;
-   AVPacket m_Pkt;
--  uint8_t m_Buffer[8 + FF_MIN_BUFFER_SIZE];
-+  uint8_t m_Buffer[8 + AV_INPUT_BUFFER_MIN_SIZE];
-   int m_BufferSize;
-   int m_OutputSize;
-   double m_OutputRatio;
---- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp	2017-11-14 17:55:01.000000000 +0100
-+++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp	2018-07-02 21:13:08.856841550 +0200
-@@ -82,8 +82,8 @@
-   m_pCodecContext->debug = 0;
-   m_pCodecContext->workaround_bugs = 1;
- 
--  if (pCodec->capabilities & CODEC_CAP_TRUNCATED)
--    m_pCodecContext->flags |= CODEC_FLAG_TRUNCATED;
-+  if (pCodec->capabilities & AV_CODEC_CAP_TRUNCATED)
-+    m_pCodecContext->flags |= AV_CODEC_FLAG_TRUNCATED;
- 
-   m_matrixEncoding = AV_MATRIX_ENCODING_NONE;
-   m_channels = 0;
-@@ -98,7 +98,7 @@
- 
-   if( hints.extradata && hints.extrasize > 0 )
-   {
--    m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + FF_INPUT_BUFFER_PADDING_SIZE);
-+    m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + AV_INPUT_BUFFER_PADDING_SIZE);
-     if(m_pCodecContext->extradata)
-     {
-       m_pCodecContext->extradata_size = hints.extrasize;
---- xbmc-17.6-Krypton/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp	2017-11-14 17:55:01.000000000 +0100
-+++ xbmc-17.6-Krypton/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp	2018-07-02 21:06:40.206821500 +0200
-@@ -91,7 +91,13 @@
-     return false;
-   }
- 
-+#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(7,0,0)
-+  const
-+#endif
-   AVFilter* srcFilter = avfilter_get_by_name("abuffer");
-+#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(7,0,0)
-+  const
-+#endif
-   AVFilter* outFilter = avfilter_get_by_name("abuffersink");
- 
-   std::string args = StringUtils::Format("time_base=1/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%" PRIx64,
-@@ -121,6 +127,9 @@
- 
- bool CActiveAEFilter::CreateAtempoFilter()
- {
-+#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(7,0,0)
-+  const
-+#endif
-   AVFilter *atempo;
- 
-   atempo = avfilter_get_by_name("atempo");
---- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp	2017-11-14 17:55:01.000000000 +0100
-+++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp	2018-07-02 21:22:36.309870824 +0200
-@@ -73,7 +73,7 @@
-   if( hints.extradata && hints.extrasize > 0 )
-   {
-     m_pCodecContext->extradata_size = hints.extrasize;
--    m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + FF_INPUT_BUFFER_PADDING_SIZE);
-+    m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + AV_INPUT_BUFFER_PADDING_SIZE);
-     memcpy(m_pCodecContext->extradata, hints.extradata, hints.extrasize);
- 
-     // start parsing of extra data - create a copy to be safe and make it zero-terminating to avoid access violations!
---- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp	2017-11-14 17:55:01.000000000 +0100
-+++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp	2018-07-02 21:23:35.419873874 +0200
-@@ -68,7 +68,7 @@
-         * Note, if the first 23 bits of the additional bytes are not 0 then damaged
-         * MPEG bitstreams could cause overread and segfault
-         */
--      pPacket->pData =(uint8_t*)_aligned_malloc(iDataSize + FF_INPUT_BUFFER_PADDING_SIZE, 16);
-+      pPacket->pData =(uint8_t*)_aligned_malloc(iDataSize + AV_INPUT_BUFFER_PADDING_SIZE, 16);
-       if (!pPacket->pData)
-       {
-         FreeDemuxPacket(pPacket);
-@@ -76,7 +76,7 @@
-       }
- 
-       // reset the last 8 bytes to 0;
--      memset(pPacket->pData + iDataSize, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-+      memset(pPacket->pData + iDataSize, 0, AV_INPUT_BUFFER_PADDING_SIZE);
-     }
- 
-     // setup defaults
---- xbmc-17.6-Krypton/xbmc/utils/BitstreamConverter.cpp	2017-11-14 17:55:01.000000000 +0100
-+++ xbmc-17.6-Krypton/xbmc/utils/BitstreamConverter.cpp	2018-07-02 21:26:49.852883905 +0200
-@@ -686,13 +686,13 @@
-     unit_size = extradata[0] << 8 | extradata[1];
-     total_size += unit_size + 4;
- 
--    if (total_size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE ||
-+    if (total_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE ||
-       (extradata + 2 + unit_size) > ((uint8_t*)in_extradata + in_extrasize))
-     {
-       av_free(out);
-       return false;
-     }
--    tmp = av_realloc(out, total_size + FF_INPUT_BUFFER_PADDING_SIZE);
-+    tmp = av_realloc(out, total_size + AV_INPUT_BUFFER_PADDING_SIZE);
-     if (!tmp)
-     {
-       av_free(out);
-@@ -713,7 +713,7 @@
-   }
- 
-   if (out)
--    memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-+    memset(out + total_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
- 
-   if (!sps_seen)
-       CLog::Log(LOGDEBUG, "SPS NALU missing or invalid. The resulting stream may not play");
-@@ -776,13 +776,13 @@
-       }
-       total_size += unit_size + 4;
- 
--      if (total_size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE ||
-+      if (total_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE ||
-         (extradata + unit_size) > ((uint8_t*)in_extradata + in_extrasize))
-       {
-         av_free(out);
-         return false;
-       }
--      tmp = av_realloc(out, total_size + FF_INPUT_BUFFER_PADDING_SIZE);
-+      tmp = av_realloc(out, total_size + AV_INPUT_BUFFER_PADDING_SIZE);
-       if (!tmp)
-       {
-         av_free(out);
-@@ -796,7 +796,7 @@
-   }
- 
-   if (out)
--    memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-+    memset(out + total_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
- 
-   if (!sps_seen)
-       CLog::Log(LOGDEBUG, "SPS NALU missing or invalid. The resulting stream may not play");
---- xbmc-17.6-Krypton/xbmc/guilib/FFmpegImage.cpp	2017-11-14 17:55:01.000000000 +0100
-+++ xbmc-17.6-Krypton/xbmc/guilib/FFmpegImage.cpp	2018-07-02 21:29:40.403892703 +0200
-@@ -551,7 +551,7 @@
-   tdm.avOutctx->time_base.num = 1;
-   tdm.avOutctx->time_base.den = 1;
-   tdm.avOutctx->pix_fmt = jpg_output ? AV_PIX_FMT_YUVJ420P : AV_PIX_FMT_RGBA;
--  tdm.avOutctx->flags = CODEC_FLAG_QSCALE;
-+  tdm.avOutctx->flags = AV_CODEC_FLAG_QSCALE;
-   tdm.avOutctx->mb_lmin = tdm.avOutctx->qmin * FF_QP2LAMBDA;
-   tdm.avOutctx->mb_lmax = tdm.avOutctx->qmax * FF_QP2LAMBDA;
-   tdm.avOutctx->global_quality = tdm.avOutctx->qmin * FF_QP2LAMBDA;
---- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp	2017-11-14 17:55:01.000000000 +0100
-+++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp	2018-07-02 21:32:30.151901460 +0200
-@@ -25,7 +25,7 @@
- #include "settings/Settings.h"
- #include "../DVDClock.h"
- 
--#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE)
-+#define AV_MAX_EXTRADATA_SIZE ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE)
- 
- 
- class CDemuxStreamClientInternal
-@@ -172,16 +172,16 @@
-   if (stream->m_parser_split && stream->m_parser->parser->split)
-   {
-     int len = stream->m_parser->parser->split(stream->m_context, pkt->pData, pkt->iSize);
--    if (len > 0 && len < FF_MAX_EXTRADATA_SIZE)
-+    if (len > 0 && len < AV_MAX_EXTRADATA_SIZE)
-     {
-       if (st->ExtraData)
-         delete[] (uint8_t*)st->ExtraData;
-       st->changes++;
-       st->disabled = false;
-       st->ExtraSize = len;
--      st->ExtraData = new uint8_t[len+FF_INPUT_BUFFER_PADDING_SIZE];
-+      st->ExtraData = new uint8_t[len+AV_INPUT_BUFFER_PADDING_SIZE];
-       memcpy(st->ExtraData, pkt->pData, len);
--      memset((uint8_t*)st->ExtraData + len, 0 , FF_INPUT_BUFFER_PADDING_SIZE);
-+      memset((uint8_t*)st->ExtraData + len, 0 , AV_INPUT_BUFFER_PADDING_SIZE);
-       stream->m_parser_split = false;
-     }
-   }
---- xbmc-17.6-Krypton/xbmc/cores/omxplayer/OMXAudioCodecOMX.cpp	2017-11-14 17:55:01.000000000 +0100
-+++ xbmc-17.6-Krypton/xbmc/cores/omxplayer/OMXAudioCodecOMX.cpp	2018-07-02 21:39:23.350922777 +0200
-@@ -86,8 +86,8 @@
-   m_pCodecContext->debug = 0;
-   m_pCodecContext->workaround_bugs = 1;
- 
--  if (pCodec->capabilities & CODEC_CAP_TRUNCATED)
--    m_pCodecContext->flags |= CODEC_FLAG_TRUNCATED;
-+  if (pCodec->capabilities & AV_CODEC_CAP_TRUNCATED)
-+    m_pCodecContext->flags |= AV_CODEC_FLAG_TRUNCATED;
- 
-   m_channels = 0;
-   m_pCodecContext->channels = hints.channels;
-@@ -110,7 +110,7 @@
- 
-   if( hints.extradata && hints.extrasize > 0 )
-   {
--    m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + FF_INPUT_BUFFER_PADDING_SIZE);
-+    m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + AV_INPUT_BUFFER_PADDING_SIZE);
-     if(m_pCodecContext->extradata)
-     {
-       m_pCodecContext->extradata_size = hints.extrasize;
-@@ -222,7 +222,7 @@
- 
-   if (m_iBufferOutputAlloced < m_iBufferOutputUsed + outputSize)
-   {
--     m_pBufferOutput = (BYTE*)av_realloc(m_pBufferOutput, m_iBufferOutputUsed + outputSize + FF_INPUT_BUFFER_PADDING_SIZE);
-+     m_pBufferOutput = (BYTE*)av_realloc(m_pBufferOutput, m_iBufferOutputUsed + outputSize + AV_INPUT_BUFFER_PADDING_SIZE);
-      m_iBufferOutputAlloced = m_iBufferOutputUsed + outputSize;
-   }
- 
-
---- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp.orig	2018-07-03 03:58:00.987120857 +0200
-+++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp	2018-07-03 04:00:22.013863754 +0200
-@@ -382,16 +382,6 @@
-   else
-     m_decoderState = STATE_SW_SINGLE;
- 
--#if defined(TARGET_DARWIN_IOS)
--  // ffmpeg with enabled neon will crash and burn if this is enabled
--  m_pCodecContext->flags &= CODEC_FLAG_EMU_EDGE;
--#else
--  if (pCodec->id != AV_CODEC_ID_H264 && pCodec->capabilities & CODEC_CAP_DR1
--      && pCodec->id != AV_CODEC_ID_VP8
--     )
--    m_pCodecContext->flags |= CODEC_FLAG_EMU_EDGE;
--#endif
--
-   // if we don't do this, then some codecs seem to fail.
-   m_pCodecContext->coded_height = hints.height;
-   m_pCodecContext->coded_width = hints.width;
-@@ -882,23 +872,7 @@
-   else
-     pDvdVideoPicture->color_range = 0;
- 
--  int qscale_type;
--  pDvdVideoPicture->qp_table = av_frame_get_qp_table(m_pFrame, &pDvdVideoPicture->qstride, &qscale_type);
--
--  switch (qscale_type)
--  {
--  case FF_QSCALE_TYPE_MPEG1:
--    pDvdVideoPicture->qscale_type = DVP_QSCALE_MPEG1;
--    break;
--  case FF_QSCALE_TYPE_MPEG2:
--    pDvdVideoPicture->qscale_type = DVP_QSCALE_MPEG2;
--    break;
--  case FF_QSCALE_TYPE_H264:
--    pDvdVideoPicture->qscale_type = DVP_QSCALE_H264;
--    break;
--  default:
--    pDvdVideoPicture->qscale_type = DVP_QSCALE_UNKNOWN;
--  }
-+  pDvdVideoPicture->qp_table = av_frame_get_qp_table(m_pFrame, &pDvdVideoPicture->qstride, &pDvdVideoPicture->qscale_type);
- 
-   if (pDvdVideoPicture->iRepeatPicture)
-     pDvdVideoPicture->dts = DVD_NOPTS_VALUE;
-@@ -989,7 +963,13 @@
-     return -1;
-   }
- 
-+#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(7,0,0)
-+  const
-+#endif
-   AVFilter* srcFilter = avfilter_get_by_name("buffer");
-+#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(7,0,0)
-+  const
-+#endif
-   AVFilter* outFilter = avfilter_get_by_name("buffersink"); // should be last filter in the graph for now
- 
-   std::string args = StringUtils::Format("%d:%d:%d:%d:%d:%d:%d",
-
---- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp.orig	2018-07-03 04:09:57.457702946 +0200
-+++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp	2018-07-03 04:10:31.769395588 +0200
-@@ -390,7 +390,7 @@
-   if( hints.extradata && hints.extrasize > 0 )
-   {
-     m_pCodecContext->extradata_size = hints.extrasize;
--    m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + FF_INPUT_BUFFER_PADDING_SIZE);
-+    m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + AV_INPUT_BUFFER_PADDING_SIZE);
-     memcpy(m_pCodecContext->extradata, hints.extradata, hints.extrasize);
-   }
-
---- xbmc-17.6-Krypton/xbmc/cdrip/EncoderFFmpeg.cpp.orig	2018-07-03 04:15:20.761822331 +0200
-+++ xbmc-17.6-Krypton/xbmc/cdrip/EncoderFFmpeg.cpp	2018-07-03 04:16:14.960339734 +0200
-@@ -119,8 +119,8 @@
- 
-   if(m_Format->oformat->flags & AVFMT_GLOBALHEADER)
-   {
--    m_CodecCtx->flags |= CODEC_FLAG_GLOBAL_HEADER;
--    m_Format->flags   |= CODEC_FLAG_GLOBAL_HEADER;
-+    m_CodecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
-+    m_Format->flags   |= AV_CODEC_FLAG_GLOBAL_HEADER;
-   }
- 
-   switch(m_iInBitsPerSample)
-
---- xbmc-17.6-Krypton/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp.orig	2018-07-03 04:22:26.222041472 +0200
-+++ xbmc-17.6-Krypton/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp	2018-07-03 04:22:44.318880987 +0200
-@@ -2955,7 +2955,7 @@
-   int fileSize = sound->GetFileSize();
- 
-   fmt_ctx = avformat_alloc_context();
--  unsigned char* buffer = (unsigned char*)av_malloc(SOUNDBUFFER_SIZE+FF_INPUT_BUFFER_PADDING_SIZE);
-+  unsigned char* buffer = (unsigned char*)av_malloc(SOUNDBUFFER_SIZE+AV_INPUT_BUFFER_PADDING_SIZE);
-   io_ctx = avio_alloc_context(buffer, SOUNDBUFFER_SIZE, 0,
-                                             sound, CActiveAESound::Read, NULL, CActiveAESound::Seek);
-   io_ctx->max_packet_size = sound->GetChunkSize();
-
---- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp.orig	2018-07-03 04:29:28.402298801 +0200
-+++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp	2018-07-03 04:30:42.334643983 +0200
-@@ -78,7 +78,7 @@
-   {}
- };
- 
--#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE)
-+#define AV_MAX_EXTRADATA_SIZE ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE)
- 
- std::string CDemuxStreamAudioFFmpeg::GetStreamName()
- {
-@@ -1876,17 +1876,17 @@
-   if(st->parser && st->parser->parser->split && !st->codec->extradata)
-   {
-     int i = st->parser->parser->split(st->codec, pkt->data, pkt->size);
--    if (i > 0 && i < FF_MAX_EXTRADATA_SIZE)
-+    if (i > 0 && i < AV_MAX_EXTRADATA_SIZE)
-     {
-       // Found extradata, fill it in. This will cause
-       // a new stream to be created and used.
-       st->codec->extradata_size = i;
--      st->codec->extradata = (uint8_t*)av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-+      st->codec->extradata = (uint8_t*)av_malloc(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
-       if (st->codec->extradata)
-       {
-         CLog::Log(LOGDEBUG, "CDVDDemuxFFmpeg::Read() fetching extradata, extradata_size(%d)", st->codec->extradata_size);
-         memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size);
--        memset(st->codec->extradata + i, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-+        memset(st->codec->extradata + i, 0, AV_INPUT_BUFFER_PADDING_SIZE);
-       }
-       else
-       {
-
diff --git a/community/kodi/fix-fileemu.patch b/community/kodi/fix-fileemu.patch
deleted file mode 100644
index 79ecdca772..0000000000
--- a/community/kodi/fix-fileemu.patch
+++ /dev/null
@@ -1,467 +0,0 @@
-diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
-index ab14942..cf9d73d 100644
---- a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
-+++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
-@@ -51,6 +51,7 @@
- #include <fcntl.h>
- #include <time.h>
- #include <signal.h>
-+#include <paths.h>
- #ifdef TARGET_POSIX
- #include "PlatformDefs.h" // for __stat64
- #include "XFileUtils.h"
-@@ -476,13 +477,10 @@ extern "C"
-     EmuFileObject* o = g_emuFileWrapper.GetFileObjectByDescriptor(fd);
-     if (o)
-     {
--      if(!o->used)
--        return NULL;
--
-       int nmode = convert_fmode(mode);
-       if( (o->mode & nmode) != nmode)
-         CLog::Log(LOGWARNING, "dll_fdopen - mode 0x%x differs from fd mode 0x%x", nmode, o->mode);
--      return &o->file_emu;
-+      return g_emuFileWrapper.GetStreamByFileObject(o);
-     }
-     else if (!IS_STD_DESCRIPTOR(fd))
-     {
-@@ -545,7 +543,7 @@ extern "C"
-         return -1;
-       }
-       object->mode = iMode;
--      return g_emuFileWrapper.GetDescriptorByStream(&object->file_emu);
-+      return g_emuFileWrapper.GetDescriptorByFileObject(object);
-     }
-     delete pFile;
-     return -1;
-@@ -1214,8 +1212,8 @@ extern "C"
-   {
-     FILE* file = NULL;
- #if defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
--    if (strcmp(filename, MOUNTED) == 0
--    ||  strcmp(filename, MNTTAB) == 0)
-+    if (strcmp(filename, _PATH_MOUNTED) == 0
-+    ||  strcmp(filename, _PATH_MNTTAB) == 0)
-     {
-       CLog::Log(LOGINFO, "%s - something opened the mount file, let's hope it knows what it's doing", __FUNCTION__);
-       return fopen(filename, mode);
-@@ -1622,7 +1620,7 @@ extern "C"
-     int ret;
- 
-     ret = dll_fgetpos64(stream, &tmpPos);
--#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
-+#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
-     *pos = (fpos_t)tmpPos;
- #else
-     pos->__pos = (off_t)tmpPos.__pos;
-@@ -1635,8 +1633,9 @@ extern "C"
-     CFile* pFile = g_emuFileWrapper.GetFileXbmcByStream(stream);
-     if (pFile != NULL)
-     {
--#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
--      *pos = pFile->GetPosition();
-+#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
-+      uint64_t *ppos = (uint64_t *) pos;
-+      *ppos = pFile->GetPosition();
- #else
-       pos->__pos = pFile->GetPosition();
- #endif
-@@ -1657,8 +1656,9 @@ extern "C"
-     int fd = g_emuFileWrapper.GetDescriptorByStream(stream);
-     if (fd >= 0)
-     {
--#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
--      if (dll_lseeki64(fd, *pos, SEEK_SET) >= 0)
-+#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
-+      const uint64_t *ppos = (const uint64_t *) pos;
-+      if (dll_lseeki64(fd, *ppos, SEEK_SET) >= 0)
- #else
-       if (dll_lseeki64(fd, (__off64_t)pos->__pos, SEEK_SET) >= 0)
- #endif
-@@ -1674,7 +1674,7 @@ extern "C"
-     {
-       // it might be something else than a file, or the file is not emulated
-       // let the operating system handle it
--#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
-+#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
-       return fsetpos(stream, pos);
- #else
-       return fsetpos64(stream, pos);
-@@ -1690,7 +1690,7 @@ extern "C"
-     if (fd >= 0)
-     {
-       fpos64_t tmpPos;
--#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
-+#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
-       tmpPos= *pos;
- #else
-       tmpPos.__pos = (off64_t)(pos->__pos);
-diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.h b/xbmc/cores/DllLoader/exports/emu_msvcrt.h
-index 3294d9a..3ce8b24 100644
---- a/xbmc/cores/DllLoader/exports/emu_msvcrt.h
-+++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.h
-@@ -24,7 +24,7 @@
- #define _onexit_t void*
- #endif
- 
--#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
-+#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) || !defined(GLIBC)
- typedef off_t __off_t;
- typedef int64_t off64_t;
- typedef off64_t __off64_t;
-diff --git a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp
-index 8927d41..0e78707 100644
---- a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp
-+++ b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp
-@@ -53,15 +53,7 @@ constexpr bool isValidFilePtr(FILE* f)
- CEmuFileWrapper::CEmuFileWrapper()
- {
-   // since we always use dlls we might just initialize it directly
--  for (int i = 0; i < MAX_EMULATED_FILES; i++)
--  {
--    memset(&m_files[i], 0, sizeof(EmuFileObject));
--    m_files[i].used = false;
--#if defined(TARGET_WINDOWS) && (_MSC_VER >= 1900)
--    m_files[i].file_emu._Placeholder = new kodi_iobuf();
--#endif
--    FileDescriptor(m_files[i].file_emu)->_file = -1;
--  }
-+  memset(m_files, 0, sizeof(m_files));
- }
- 
- CEmuFileWrapper::~CEmuFileWrapper()
-@@ -73,29 +65,7 @@ void CEmuFileWrapper::CleanUp()
- {
-   CSingleLock lock(m_criticalSection);
-   for (int i = 0; i < MAX_EMULATED_FILES; i++)
--  {
--    if (m_files[i].used)
--    {
--      m_files[i].file_xbmc->Close();
--      delete m_files[i].file_xbmc;
--
--      if (m_files[i].file_lock)
--      {
--        delete m_files[i].file_lock;
--        m_files[i].file_lock = nullptr;
--      }
--#if !defined(TARGET_WINDOWS)
--      //Don't memset on Windows as it overwrites our pointer
--      memset(&m_files[i], 0, sizeof(EmuFileObject));
--#endif
--      m_files[i].used = false;
--      FileDescriptor(m_files[i].file_emu)->_file = -1;
--    }
--#if defined(TARGET_WINDOWS) && (_MSC_VER >= 1900)
--    delete static_cast<kodi_iobuf*>(m_files[i].file_emu._Placeholder);
--    m_files[i].file_emu._Placeholder = nullptr;
--#endif
--  }
-+    UnRegisterFileObject(&m_files[i], true);
- }
- 
- EmuFileObject* CEmuFileWrapper::RegisterFileObject(XFILE::CFile* pFile)
-@@ -106,13 +76,11 @@ EmuFileObject* CEmuFileWrapper::RegisterFileObject(XFILE::CFile* pFile)
- 
-   for (int i = 0; i < MAX_EMULATED_FILES; i++)
-   {
--    if (!m_files[i].used)
-+    if (!m_files[i].file_xbmc)
-     {
-       // found a free location
-       object = &m_files[i];
--      object->used = true;
-       object->file_xbmc = pFile;
--      FileDescriptor(object->file_emu)->_file = (i + FILE_WRAPPER_OFFSET);
-       object->file_lock = new CCriticalSection();
-       break;
-     }
-@@ -121,82 +89,70 @@ EmuFileObject* CEmuFileWrapper::RegisterFileObject(XFILE::CFile* pFile)
-   return object;
- }
- 
--void CEmuFileWrapper::UnRegisterFileObjectByDescriptor(int fd)
-+void CEmuFileWrapper::UnRegisterFileObject(EmuFileObject *object, bool free_file)
- {
--  int i = fd - FILE_WRAPPER_OFFSET;
--  if (! (i >= 0 && i < MAX_EMULATED_FILES))
-+  if (! (object && object->file_xbmc))
-     return;
- 
--  if (!m_files[i].used)
--    return;
--
--  CSingleLock lock(m_criticalSection);
--
--  // we assume the emulated function alreay deleted the CFile object
--  if (m_files[i].file_lock)
-+  if (object->file_xbmc && free_file)
-   {
--    delete m_files[i].file_lock;
--    m_files[i].file_lock = nullptr;
-+    CSingleLock lock(m_criticalSection);
-+
-+    object->file_xbmc->Close();
-+    delete object->file_xbmc;
-   }
--#if !defined(TARGET_WINDOWS)
--  //Don't memset on Windows as it overwrites our pointer
--  memset(&m_files[i], 0, sizeof(EmuFileObject));
--#endif
--  m_files[i].used = false;
--  FileDescriptor(m_files[i].file_emu)->_file = -1;
-+  if (object->file_lock)
-+    delete object->file_lock;
-+
-+  memset(object, 0, sizeof(*object));
-+}
-+
-+void CEmuFileWrapper::UnRegisterFileObjectByDescriptor(int fd)
-+{
-+  CSingleLock lock(m_criticalSection);
-+  UnRegisterFileObject(GetFileObjectByDescriptor(fd), false);
- }
- 
- void CEmuFileWrapper::UnRegisterFileObjectByStream(FILE* stream)
- {
--  if (isValidFilePtr(stream))
--  {
--    return UnRegisterFileObjectByDescriptor(FileDescriptor(*stream)->_file);
--  }
-+  CSingleLock lock(m_criticalSection);
-+  UnRegisterFileObject(GetFileObjectByStream(stream), false);
- }
- 
- void CEmuFileWrapper::LockFileObjectByDescriptor(int fd)
- {
--  int i = fd - FILE_WRAPPER_OFFSET;
--  if (i >= 0 && i < MAX_EMULATED_FILES)
-+  EmuFileObject* object = GetFileObjectByDescriptor(fd);
-+  if (object && object->file_xbmc)
-   {
--    if (m_files[i].used)
--    {
--      m_files[i].file_lock->lock();
--    }
-+    object->file_lock->lock();
-   }
- }
- 
- bool CEmuFileWrapper::TryLockFileObjectByDescriptor(int fd)
- {
--  int i = fd - FILE_WRAPPER_OFFSET;
--  if (i >= 0 && i < MAX_EMULATED_FILES)
-+  EmuFileObject* object = GetFileObjectByDescriptor(fd);
-+  if (object && object->file_xbmc)
-   {
--    if (m_files[i].used)
--    {
--      return m_files[i].file_lock->try_lock();
--    }
-+    return object->file_lock->try_lock();
-   }
-   return false;
- }
- 
- void CEmuFileWrapper::UnlockFileObjectByDescriptor(int fd)
- {
--  int i = fd - FILE_WRAPPER_OFFSET;
--  if (i >= 0 && i < MAX_EMULATED_FILES)
-+  EmuFileObject* object = GetFileObjectByDescriptor(fd);
-+  if (object && object->file_xbmc)
-   {
--    if (m_files[i].used)
--    {
--      m_files[i].file_lock->unlock();
--    }
-+    object->file_lock->unlock();
-   }
- }
- 
- EmuFileObject* CEmuFileWrapper::GetFileObjectByDescriptor(int fd)
- {
--  int i = fd - FILE_WRAPPER_OFFSET;
-+  int i = fd - 0x7000000;
-   if (i >= 0 && i < MAX_EMULATED_FILES)
-   {
--    if (m_files[i].used)
-+    if (m_files[i].file_xbmc)
-     {
-       return &m_files[i];
-     }
-@@ -204,20 +160,38 @@ EmuFileObject* CEmuFileWrapper::GetFileObjectByDescriptor(int fd)
-   return nullptr;
- }
- 
--EmuFileObject* CEmuFileWrapper::GetFileObjectByStream(FILE* stream)
-+int CEmuFileWrapper::GetDescriptorByFileObject(EmuFileObject *object)
- {
--  if (isValidFilePtr(stream))
-+  int i = object - m_files;
-+  if (i >= 0 && i < MAX_EMULATED_FILES)
-   {
--    return GetFileObjectByDescriptor(FileDescriptor(*stream)->_file);
-+    return 0x7000000 + i;
-   }
-+  return -1;
-+}
- 
-+EmuFileObject* CEmuFileWrapper::GetFileObjectByStream(FILE* stream)
-+{
-+  EmuFileObject *object = (EmuFileObject*) stream;
-+  if (object >= &m_files[0] || object < &m_files[MAX_EMULATED_FILES])
-+  {
-+    if (object->file_xbmc)
-+    {
-+      return object;
-+    }
-+  }
-   return nullptr;
- }
- 
-+FILE* CEmuFileWrapper::GetStreamByFileObject(EmuFileObject *object)
-+{
-+  return (FILE*) object;
-+}
-+
- XFILE::CFile* CEmuFileWrapper::GetFileXbmcByDescriptor(int fd)
- {
-   auto object = GetFileObjectByDescriptor(fd);
--  if (object != nullptr && object->used)
-+  if (object != nullptr)
-   {
-     return object->file_xbmc;
-   }
-@@ -228,8 +202,8 @@ XFILE::CFile* CEmuFileWrapper::GetFileXbmcByStream(FILE* stream)
- {
-   if (isValidFilePtr(stream))
-   {
--    auto object = GetFileObjectByDescriptor(FileDescriptor(*stream)->_file);
--    if (object != nullptr && object->used)
-+    auto object = GetFileObjectByStream(stream);
-+    if (object != nullptr)
-     {
-       return object->file_xbmc;
-     }
-@@ -239,32 +213,25 @@ XFILE::CFile* CEmuFileWrapper::GetFileXbmcByStream(FILE* stream)
- 
- int CEmuFileWrapper::GetDescriptorByStream(FILE* stream)
- {
--  if (isValidFilePtr(stream))
--  {
--    int i = FileDescriptor(*stream)->_file - FILE_WRAPPER_OFFSET;
--    if (i >= 0 && i < MAX_EMULATED_FILES)
--    {
--      return i + FILE_WRAPPER_OFFSET;
--    }
--  }
--  return -1;
-+  return GetDescriptorByFileObject(GetFileObjectByStream(stream));
- }
- 
- FILE* CEmuFileWrapper::GetStreamByDescriptor(int fd)
- {
--  auto object = GetFileObjectByDescriptor(fd);
--  if (object != nullptr && object->used)
--  {
--    return &object->file_emu;
--  }
--  return nullptr;
-+  return GetStreamByFileObject(GetFileObjectByDescriptor(fd));
- }
- 
- bool CEmuFileWrapper::StreamIsEmulatedFile(FILE* stream)
- {
-   if (isValidFilePtr(stream))
-   {
--    return DescriptorIsEmulatedFile(FileDescriptor(*stream)->_file);
-+    return DescriptorIsEmulatedFile(GetDescriptorByStream(stream));
-   }
-   return false;
- }
-+
-+bool CEmuFileWrapper::DescriptorIsEmulatedFile(int fd)
-+{
-+  return GetFileObjectByDescriptor(fd) != NULL;
-+}
-+
-diff --git a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h
-index 786fa85..311a5cf 100644
---- a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h
-+++ b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h
-@@ -25,14 +25,14 @@
- #include "system.h"
- #include "threads/CriticalSection.h"
- 
--#if defined(TARGET_POSIX) && !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_ANDROID) && !defined(__UCLIBC__)
--#define _file _fileno
--#elif defined(__UCLIBC__)
--#define _file __filedes
--#endif
-+//#if defined(TARGET_POSIX) && !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_ANDROID) && !defined(__UCLIBC__)
-+//#define _file _fileno
-+//#elif defined(__UCLIBC__)
-+//#define _file __filedes
-+//#endif
- 
- #define MAX_EMULATED_FILES    50
--#define FILE_WRAPPER_OFFSET   0x00000200
-+//#define FILE_WRAPPER_OFFSET   0x00000200
- 
- namespace XFILE
- {
-@@ -47,12 +47,9 @@ struct kodi_iobuf {
- 
- typedef struct stEmuFileObject
- {
--  FILE    file_emu;
-   XFILE::CFile*  file_xbmc;
-   CCriticalSection *file_lock;
-   int mode;
--  //Stick this last to avoid 3-7 bytes of padding
--  bool    used;
- } EmuFileObject;
- 
- class CEmuFileWrapper
-@@ -67,22 +64,22 @@ public:
-   void CleanUp();
- 
-   EmuFileObject* RegisterFileObject(XFILE::CFile* pFile);
-+  void UnRegisterFileObject(EmuFileObject*, bool free_file);
-   void UnRegisterFileObjectByDescriptor(int fd);
-   void UnRegisterFileObjectByStream(FILE* stream);
-   void LockFileObjectByDescriptor(int fd);
-   bool TryLockFileObjectByDescriptor(int fd);
-   void UnlockFileObjectByDescriptor(int fd);
-   EmuFileObject* GetFileObjectByDescriptor(int fd);
-+  int GetDescriptorByFileObject(EmuFileObject*);
-   EmuFileObject* GetFileObjectByStream(FILE* stream);
-+  FILE* GetStreamByFileObject(EmuFileObject*);
-   XFILE::CFile* GetFileXbmcByDescriptor(int fd);
-   XFILE::CFile* GetFileXbmcByStream(FILE* stream);
--  static int GetDescriptorByStream(FILE* stream);
-+  int GetDescriptorByStream(FILE* stream);
-   FILE* GetStreamByDescriptor(int fd);
--  static constexpr bool DescriptorIsEmulatedFile(int fd)
--  {
--    return fd >= FILE_WRAPPER_OFFSET && fd < FILE_WRAPPER_OFFSET + MAX_EMULATED_FILES;
--  }
--  static bool StreamIsEmulatedFile(FILE* stream);
-+  bool DescriptorIsEmulatedFile(int fd);
-+  bool StreamIsEmulatedFile(FILE* stream);
- private:
-   EmuFileObject m_files[MAX_EMULATED_FILES];
-   CCriticalSection m_criticalSection;
-diff --git a/xbmc/cores/DllLoader/exports/wrapper.c b/xbmc/cores/DllLoader/exports/wrapper.c
-index e363662..4498c27 100644
---- a/xbmc/cores/DllLoader/exports/wrapper.c
-+++ b/xbmc/cores/DllLoader/exports/wrapper.c
-@@ -39,7 +39,7 @@
- #endif
- #include <dlfcn.h>
- 
--#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
-+#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) || !defined(GLIBC)
- typedef off_t     __off_t;
- typedef int64_t   off64_t;
- typedef off64_t   __off64_t;
diff --git a/community/kodi/fix-musl-incompability.patch b/community/kodi/fix-musl-incompability.patch
new file mode 100644
index 0000000000..77d9bb8e10
--- /dev/null
+++ b/community/kodi/fix-musl-incompability.patch
@@ -0,0 +1,108 @@
+diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
+index 1d5564c8c5..73c07fb586 100644
+--- a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
++++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
+@@ -72,6 +72,13 @@
+ #include "platform/win32/CharsetConverter.h"
+ #endif
+ 
++#ifndef _PATH_MOUNTED
++#define _PATH_MOUNTED "/proc/mounts"
++#endif
++#ifndef _PATH_MNTTAB
++#define _PATH_MNTTAB "/etc/fstab"
++#endif
++
+ using namespace XFILE;
+ 
+ struct SDirData
+@@ -124,7 +131,7 @@ extern "C" void __stdcall init_emu_environ()
+   dll_putenv("OS=win10");
+ #elif defined(TARGET_DARWIN)
+   dll_putenv("OS=darwin");
+-#elif defined(TARGET_POSIX)
++#elif defined(TARGET_POSIX) || !defined(__GLIBC__)
+   dll_putenv("OS=linux");
+ #else
+   dll_putenv("OS=unknown");
+@@ -1480,7 +1487,7 @@ extern "C"
+     int ret;
+ 
+     ret = dll_fgetpos64(stream, &tmpPos);
+-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if !defined(__GLIBC__) || !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+     *pos = (fpos_t)tmpPos;
+ #else
+     pos->__pos = (off_t)tmpPos.__pos;
+@@ -1493,8 +1500,9 @@ extern "C"
+     CFile* pFile = g_emuFileWrapper.GetFileXbmcByStream(stream);
+     if (pFile != NULL)
+     {
+-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+-      *pos = pFile->GetPosition();
++#if !defined(__GLIBC__) || !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++      uint64_t *ppos = (uint64_t *)pos;
++      *ppos = pFile->GetPosition();
+ #else
+       pos->__pos = pFile->GetPosition();
+ #endif
+@@ -1509,8 +1517,9 @@ extern "C"
+     int fd = g_emuFileWrapper.GetDescriptorByStream(stream);
+     if (fd >= 0)
+     {
+-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+-      if (dll_lseeki64(fd, *pos, SEEK_SET) >= 0)
++#if !defined(TARGET_POSIX) || !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++      const uint64_t *ppos = (const uint64_t *) pos;
++      if (dll_lseeki64(fd, *ppos, SEEK_SET) >= 0)
+ #else
+       if (dll_lseeki64(fd, (__off64_t)pos->__pos, SEEK_SET) >= 0)
+ #endif
+@@ -1532,7 +1541,7 @@ extern "C"
+     if (fd >= 0)
+     {
+       fpos64_t tmpPos;
+-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if !defined(__GLIBC__) || !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+       tmpPos= *pos;
+ #else
+       tmpPos.__pos = (off64_t)(pos->__pos);
+diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.h b/xbmc/cores/DllLoader/exports/emu_msvcrt.h
+index 7869dc221c..3b86d6b45b 100644
+--- a/xbmc/cores/DllLoader/exports/emu_msvcrt.h
++++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.h
+@@ -17,7 +17,7 @@
+ #define _onexit_t void*
+ #endif
+ 
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+ typedef off_t __off_t;
+ typedef int64_t off64_t;
+ typedef off64_t __off64_t;
+diff --git a/xbmc/cores/DllLoader/exports/wrapper.c b/xbmc/cores/DllLoader/exports/wrapper.c
+index 33ab3437c1..5a68de2c64 100644
+--- a/xbmc/cores/DllLoader/exports/wrapper.c
++++ b/xbmc/cores/DllLoader/exports/wrapper.c
+@@ -23,7 +23,7 @@
+ #include <dirent.h>
+ #include <dlfcn.h>
+ 
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+ typedef off_t     __off_t;
+ typedef int64_t   off64_t;
+ typedef off64_t   __off64_t;
+diff --git a/xbmc/cores/DllLoader/ldt_keeper.c b/xbmc/cores/DllLoader/ldt_keeper.c
+index 0e6bc81bf7..73f1346458 100644
+--- a/xbmc/cores/DllLoader/ldt_keeper.c
++++ b/xbmc/cores/DllLoader/ldt_keeper.c
+@@ -49,7 +49,7 @@
+ #ifdef  __cplusplus
+ extern "C" {
+ #endif
+-#if defined(TARGET_ANDROID) && defined(__i386__) && !defined(modify_ldt)
++#if defined(__linux__) && !defined(__GLIBC__) && !defined(modify_ldt)
+ #define modify_ldt(a,b,c) syscall( __NR_modify_ldt,  a, b, c);
+ #else
+ int modify_ldt(int func, void *ptr, unsigned long bytecount);
diff --git a/community/kodi/fix-musl.patch b/community/kodi/fix-musl.patch
deleted file mode 100644
index a5a9d92141..0000000000
--- a/community/kodi/fix-musl.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-diff --git a/configure.ac b/configure.ac
-index 9bd8d6e..205acfc 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -526,7 +526,7 @@ case $host in
-      use_x11=no
-      build_shared_lib=yes
-      ;;
--  i*86*-linux-gnu*|i*86*-*-linux-uclibc*)
-+  i*86*-linux-*)
-      target_platform=target_linux
-      CORE_SYSTEM_NAME=linux
-      ARCH="i486-linux"
-@@ -549,7 +549,7 @@ case $host in
-        fi
-      fi
-      ;;
--  x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*)
-+  x86_64-*-linux-*)
-      target_platform=target_linux
-      CORE_SYSTEM_NAME=linux
-      ARCH="x86_64-linux"
-diff --git a/m4/xbmc_arch.m4 b/m4/xbmc_arch.m4
-index d28f263..6fb6210 100644
---- a/m4/xbmc_arch.m4
-+++ b/m4/xbmc_arch.m4
-@@ -2,10 +2,10 @@ AC_DEFUN([XBMC_SETUP_ARCH_DEFINES],[
- 
- # build detection and setup - this is the native arch
- case $build in
--  i*86*-linux-gnu*|i*86*-*-linux-uclibc*)
-+  i*86*-linux-*)
-      AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
-      ;;
--  x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*)
-+  x86_64-*-linux-*)
-      AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
-      ;;
-   i386-*-freebsd*)
-@@ -17,13 +17,13 @@ case $build in
-   *86*-apple-darwin*)
-      AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX")
-      ;;
--  powerpc-*-linux-gnu*|powerpc-*-linux-uclibc*)
-+  powerpc-*-linux-*)
-      AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC")
-      ;;
--  powerpc64-*-linux-gnu*|powerpc64-*-linux-uclibc*)
-+  powerpc64-*-linux-*)
-      AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC64")
-      ;;
--  arm*-*-linux-gnu*|arm*-*-linux-uclibc*)
-+  arm*-*-linux-*)
-      AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
-      ;;
-   *)
-@@ -33,10 +33,10 @@ esac
- 
- # host detection and setup - this is the target arch
- case $host in
--  i*86*-linux-gnu*|i*86*-*-linux-uclibc*)
-+  i*86*-linux-*)
-      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
-      ;;
--  x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*)
-+  x86_64-*-linux-*)
-      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
-      ;;
-   i386-*-freebsd*)
-@@ -54,16 +54,16 @@ case $host in
-   powerpc-apple-darwin*)
-      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX")
-      ;;
--  powerpc-*-linux-gnu*|powerpc-*-linux-uclibc*)
-+  powerpc-*-linux-*)
-      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC")
-      ;;
--  powerpc64*-*-linux-gnu*|powerpc64*-*-linux-uclibc*)
-+  powerpc64*-*-linux-*)
-      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC64")
-      ;;
--  arm*-*-linux-gnu*|arm*-*-linux-uclibc*|aarch64*-*-linux-gnu*|aarch64*-*-linux-uclibc*)
-+  arm*-*-linux-*)
-      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
-      ;;
--  mips*-*-linux-gnu*|mips*-*-linux-uclibc*)
-+  mips*-*-linux-*)
-      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
-      ;;
-   *-*linux-android*)
-diff --git a/tools/depends/configure.ac b/tools/depends/configure.ac
-index 3626ea5..f178f7a 100644
---- a/tools/depends/configure.ac
-+++ b/tools/depends/configure.ac
-@@ -120,13 +120,13 @@ platform_cc=gcc
- platform_cxx=g++
- 
- case $build in
--  arm*-*-linux-gnu*|arm*-*-linux-uclibc*)
-+  arm*-*-linux-*)
-     build_os="linux"
-   ;;
--  *i686*-linux-gnu*|i*86*-*-linux-uclibc*)
-+  i*86*-*-linux-*)
-     build_os="linux"
-   ;;
--  x86_64*-linux-gnu*|x86_64-*-linux-uclibc*)
-+  x86_64*-linux-*)
-     build_os="linux"
-   ;;
-   *darwin*)
-diff --git a/xbmc/cores/DllLoader/ldt_keeper.c b/xbmc/cores/DllLoader/ldt_keeper.c
-index 3fe6854..ca78612 100644
---- a/xbmc/cores/DllLoader/ldt_keeper.c
-+++ b/xbmc/cores/DllLoader/ldt_keeper.c
-@@ -48,7 +48,7 @@ extern "C" {
- #if defined(__GLIBC__) &&  (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0))
- _syscall3( int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount );
- #else
--#if defined(TARGET_ANDROID) && defined(__i386__) && !defined(modify_ldt)
-+#if defined(__linux__) && !defined(__GLIBC__) && !defined(modify_ldt)
- #define modify_ldt(a,b,c) syscall( __NR_modify_ldt,  a, b, c);
- #else
- int modify_ldt(int func, void *ptr, unsigned long bytecount);
diff --git a/community/kodi/fortify-source-fix.patch b/community/kodi/fortify-source-fix.patch
deleted file mode 100644
index 5717746e09..0000000000
--- a/community/kodi/fortify-source-fix.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/xbmc/cores/DllLoader/exports/wrapper.c.orig
-+++ b/xbmc/cores/DllLoader/exports/wrapper.c
-@@ -462,7 +462,7 @@
- // are actually #defines which are inlined when compiled with -O. Those defines
- // actally call __*chk (for example, __fread_chk). We need to bypass this whole
- // thing to actually call our wrapped functions. 
--#if _FORTIFY_SOURCE > 1
-+#if defined(__GLIBC__) && _FORTIFY_SOURCE > 1
- 
- size_t __wrap___fread_chk(void * ptr, size_t ptrlen, size_t size, size_t n, FILE * stream)
- {
diff --git a/community/kodi/remove-filewrap.patch b/community/kodi/remove-filewrap.patch
deleted file mode 100644
index 9f20397e8b..0000000000
--- a/community/kodi/remove-filewrap.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-diff --git a/xbmc/utils/posix/PosixInterfaceForCLog.cpp b/xbmc/utils/posix/PosixInterfaceForCLog.cpp
-index a3d4983..8443024 100644
---- a/xbmc/utils/posix/PosixInterfaceForCLog.cpp
-+++ b/xbmc/utils/posix/PosixInterfaceForCLog.cpp
-@@ -29,10 +29,6 @@
- #include "platform/android/activity/XBMCApp.h"
- #endif // TARGET_ANDROID
- 
--struct FILEWRAP : public FILE
--{};
--
--
- CPosixInterfaceForCLog::CPosixInterfaceForCLog() :
-   m_file(NULL)
- { }
-@@ -52,7 +48,7 @@ bool CPosixInterfaceForCLog::OpenLogFile(const std::string &logFilename, const s
-   (void)remove(backupOldLogToFilename.c_str()); // if it's failed, try to continue
-   (void)rename(logFilename.c_str(), backupOldLogToFilename.c_str()); // if it's failed, try to continue
- 
--  m_file = (FILEWRAP*)fopen(logFilename.c_str(), "wb");
-+  m_file = fopen(logFilename.c_str(), "wb");
-   if (!m_file)
-     return false; // error, can't open log file
- 
-diff --git a/xbmc/utils/posix/PosixInterfaceForCLog.h b/xbmc/utils/posix/PosixInterfaceForCLog.h
-index c1e8ffe..9999ead 100644
---- a/xbmc/utils/posix/PosixInterfaceForCLog.h
-+++ b/xbmc/utils/posix/PosixInterfaceForCLog.h
-@@ -21,8 +21,6 @@
- 
- #include <string>
- 
--struct FILEWRAP; // forward declaration, wrapper for FILE
--
- class CPosixInterfaceForCLog
- {
- public:
-@@ -34,5 +32,5 @@ public:
-   void PrintDebugString(const std::string& debugString);
-   static void GetCurrentLocalTime(int& hour, int& minute, int& second, double& millisecond);
- private:
--  FILEWRAP* m_file;
-+  FILE * m_file;
- };
diff --git a/community/kodi/vaapi.patch b/community/kodi/vaapi.patch
deleted file mode 100644
index fb279216be..0000000000
--- a/community/kodi/vaapi.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
-index 2f65025..b69cb61 100644
---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
-+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
-@@ -3090,8 +3090,8 @@ bool CFFmpegPostproc::Init(EINTERLACEMETHOD method)
-     return false;
-   }
- 
--  AVFilter* srcFilter = avfilter_get_by_name("buffer");
--  AVFilter* outFilter = avfilter_get_by_name("buffersink");
-+  const AVFilter* srcFilter = avfilter_get_by_name("buffer");
-+  const AVFilter* outFilter = avfilter_get_by_name("buffersink");
- 
-   std::string args = StringUtils::Format("%d:%d:%d:%d:%d:%d:%d",
-                                         m_config.vidWidth,
-- 
2.22.0