1
0
mirror of https://github.com/dguglielmi/sunny-overlay.git synced 2025-12-06 11:42:40 +01:00

media-tv/kodi: removal, available in ::gentoo

This commit is contained in:
2024-04-28 19:08:24 +02:00
parent 01f794a375
commit 091efe9902
12 changed files with 0 additions and 4643 deletions

View File

@@ -1,21 +0,0 @@
AUX kodi-20.5-CDVDInputStreamFile-use-64K-read-chunk-size-when-filesystem.patch 1326 BLAKE2B 0a0900e464cf92e217c0b228e1b65482894601b5f7a277cbfaa547b1540ff3a5ade7aca05d37df151d2193a58dfa70df7765e83a246992b39b5a118df3ea8a59 SHA512 b4e5ead1d582d409004a091e134d6575857456951907521d4776326315c5db5e6ae9660e2a242c2824676a3afe05fcb21afc73db44bbedc36af135be1f3a082e
AUX kodi-20.5-VideoPlayerAudio-invalidate-previous-sync-type-after-Audio.patch 1010 BLAKE2B e623854a71f0b53b90950fbbf71ee4d666a24c3071c6ae8489d476a8407068e01028a69c8ec5cbff909a646dd15efe7a1807aeee214995ae1486281bce309e30 SHA512 3db461ebad0f922fab7727e902beada28b5b43e2b71d9c6e39bdf9b2a7767d214ea6caf3a975649a27ba77b7a9a93d5e7b1df6c1ec0edf61223855e2463d5115
AUX kodi-20.5-binutils-2.41.patch 3399 BLAKE2B 5608adfb32777371a71091de237e6173c72c272a5911e999c3e4bde6f0c0f788db644ccf1098ddabbbba7e6d2a0d65fbfa7570f6acf83cd351a6e779dd8b7f5f SHA512 aec2995737c78cf4ae3e9a4e9212f0481664fd91eb83e07d0bd354cede014015929628833e8b5a87fb19dda20d30abc5585d676a69bff3ee0111fb1f21bb87e7
AUX kodi-20.5-ffmpeg5.patch 94498 BLAKE2B f8244260911df037ec6cdf945fe19dae7e71e98c052c0ce3ec4c9bf5459205bef7696af599b00a86d5b554d0cbc674fed6f7835a45dd6df40ae4e83549e55175 SHA512 9dc21d7e41eac956816330e79e826456566a88c5fdc747be234fe873ff3b9e7241d87dcc6ecd804189fff8b61c027ac4e31e1af0da5de0537f91e8f51b3d96c5
AUX kodi-20.5-ffmpeg6.patch 24798 BLAKE2B d9ed0a7e8d0d873f46ffe95e84eefb94ca4f5328da80a447acd3996971b3b913a2ce249ddf8b5c4019db58e5fdb158b2c5d1034cd3962c8ca6d6aab34e9c6f15 SHA512 3e419a882a112bc9c12078f9c8f8c31c6eb5546f12e71e558f31a862ac8119999aa1e63c8e42cc654361534024e0483288da3bec62a45c601ecf7694c04a66c2
AUX kodi-20.5-fix-crash-in-avcodec_parameters_from_context.patch 1351 BLAKE2B 0c1739fbda97c0e5a8064c0242a2d1d2e5db499bf336abc8d0119398aef156128a114f1f8616cee235f09e39752df156d99f3049fd2f13693246526593c5e08f SHA512 34da97b3803b585f90f2e5fced64bc0c7447c36df73384df29f539348bc8d230bbb9fcdfa7a12baf2794d0d0e1493248723e012ebe3ac0862e1d4add06f64b94
AUX kodi-20.5-smart_ptr-and-custom-destructor-for-AVCodecParameters.patch 2113 BLAKE2B 4e6e3401c8b25297f633ff88457eda364de639e915b210d71a5905877c309bc81cf7d6e748307e76e8b9badca76024e313e7d32d88bba626642d4daa91e63357 SHA512 2b1a50e6f7f5eec62f2dc13cf3afb126cb0a05a5db7c87a5dfc9a4962b45c93c12ea71cb77fa007b4fab2a98109c08b1890a78cc5a85c99b658ac7e9648d0bcd
AUX kodi-20.5-swig-4.2.patch 446 BLAKE2B 6b11113506dce61aa951a3b8c533fa2478a6c686f309c79187dc681fa9ea7e813ac6c902f613b68293e6ce28ce81a30dd5f2705fdc58ab25984bf387a6d9b37c SHA512 8e570d10eff512f45ea926b3cf0af8167cab2ae5097d0e8602634d6948eb064e5196bc60d8a4d6b7a6145bea8a2dd295df0731b9d5e1081879f628520225e336
AUX kodi-21.0-fix-head-use-after-free.patch 32519 BLAKE2B f5f9d4005da38381bd156307789253c358b32df3284e1eb84848f68d9c9e2b9b854c3801a5e4076ba172801dcd2e655505f446ceee89f5040e129003f85d7f84 SHA512 f654300c5d1d3d0bd49388430b843da4768c7fe225dd50f9908e0494375d22aadb3dc1251fb77af47796971769a872ee6d13ede5dc0b0aaeea07c49bc7e0b940
DIST apache-groovy-binary-4.0.16.zip 29793704 BLAKE2B 30f77c6400c85821cf78f6ba1070da1e68644531f85f71cf7695443b13b81393cc89d4103eb869d1523f0a22a6e1c3428dcabf4f79c8a2c6eb2a6dea74e84e8f SHA512 743698979c801f3cfb36545888b5303e1e25dae5692bb45cab7ebbe102a6eda31f09abc6978349ad90ecaf630416fc87eacba7781244855e7e771a3c44041fa0
DIST commons-lang3-3.14.0-bin.tar.gz 9442785 BLAKE2B 2ecdd06f97ac2688220055a08f67da9b859bed3ab00ff41800d5d9a1cebda599db2e816425c10c265dd6827a0ef79fc3dd094a8b3c9b9ae4ceae8f5750a59cf2 SHA512 8e7e62418a49ba810512c13a640a8bf35f878fcd54af32fdaab1111e37817f58b21b475980ba663fba4887e45ef8d88af8ff17796f20d202e929e8e2574546dc
DIST commons-text-1.11.0-bin.tar.gz 3018564 BLAKE2B c32e41c6b8c90dea876caf4c2cedc9358d5e49506bfee7aee42ac6b92dbe8505d5e5d81c860a739bb06214b832cc29e91ddb95f3cfc24515c970302a519a5e43 SHA512 2e94877000dd270b69e2e8cbf49f258a90b4c628b6b6b0814e300a2f0e9c391f0816dceb0707e596ae3b7c9532f93e7a4917df47c77f44b3a810e14042ce5f3f
DIST ffmpeg-kodi-4.4.1-Nexus-Alpha1.tar.gz 13725564 BLAKE2B 51d310e7000aeba657d55341c5fdb540474e197b85062228ab4b314c8309ec11985aa7f105193333fc6106529e8e58c86eafe268190894be8532d0e0b9065fa6 SHA512 8beb04d577b5251e74b0d52f4d130997a8ba94bbd488c7c8309e6b45095c27807e150212888ce3a384b23dff52f8df1a7bde5407bae924ddc363f8125c0616c5
DIST ffmpeg-kodi-6.0.1-Omega.tar.gz 15437409 BLAKE2B 6424e30c6d354abbbea8a807822ae61589413189e9c4ba7aa51c307179287506b9072626e9745861fe83753c0015b50d179f9b4f298fe9abf74bee13936639af SHA512 945e34840092dc0fd3824eb1af2be79868af2afb4fe13159b19a9bcfc464cc4d53243c13ff065199290e9393ddbf4b1c5c8abccf83a31a31d6c7490e499fd1fc
DIST kodi-20.5-Nexus.tar.gz 54568445 BLAKE2B 15eb409918fa3768528d9abd24c52fd8b94c82699ef2ce10a529278fe25544dc335b66d137ae8ae304511cd92c1c0be34881937ec705ba936f5a4b0d737903f7 SHA512 a47a54ca11e1d3daeddea8c1ae716cd4461e3441de43a026a920c709b2ff5c7e0acc2a5fd4ac8c15f0da1940bd7f21a65eff32203ad8e167603c1576b21d4dcc
DIST kodi-21.0-Omega.tar.gz 40987733 BLAKE2B 33adaf588b3362dc9d184bfb66c36ad5fa2e442255da47db4813f926e73f5a607dd7de809ecf8a4982f985bc8dac53cba17fb9db6a009bb0cdb6284db3b1edb4 SHA512 9c2ca6b6e72197d2b1c26a47cf4ddc209318fcaa5a30ea20475ecc5518c7d1395c2e9cf3e3a75a13334b0505e7b417acdb0d76a20567a0c86841b3e69232625b
DIST libdvdcss-1.4.3-Next-Nexus-Alpha2-2.tar.gz 102124 BLAKE2B 2f503d3ab767094958f7ec10b4ad11ffd02665deee571c8f3c739bef5fc7e2ff84babc5a3fdee638dc095f896b72fe3ce65e6b688674cb5f7b7b77190992688c SHA512 d3be3bfc13c5ea56d8db745c2aab090c99760684fe4c8f62a13d266feb319e9180ceeecf8116bfd2ed90d9accba2c11dbbf93b61ad00f69a40812ebf4eabcdda
DIST libdvdnav-6.1.1-Next-Nexus-Alpha2-2.tar.gz 128547 BLAKE2B db4d05836d8fbb3637ae50bdbfc0e4b612ee6b3be24addfea94ce772c3bf28d58b63a3f252d6f9f016f72f8cbb841cc1820b091226b136f4c4664385a32da73c SHA512 51e6fc033121241354a5f0b3fc9a430577ae3ff6bb7f31445aa548ef4893037fb80eea3b2c6774c81e9ebaf9c45e9b490c98c2c65eb38f9f7daba84b236f7e1d
DIST libdvdread-6.1.3-Next-Nexus-Alpha2-2.tar.gz 110513 BLAKE2B c94feb5a03a12efa5b7767965118d2500a088299ea36f3b82e46d157e45893e6b04503cb50f179ca681bac914457607fab26acfa6e304752b355c407578572d1 SHA512 629a41157d07b8ec0ea1fe89ae5ec48f63047472a862782b805c531ae31a0376fc4dc15175f8280c3ef91d7fa977bacebb1b51232640034a34bab2293210fc5e
EBUILD kodi-20.5.ebuild 12607 BLAKE2B bcf5ac4df923c3c789a56bdb5d93997d3e52b63c480717d18ccd0dd1d6dfa92e309e0e2da79febba946b685295aea9791766bd20fb3ad86055aa93ba96419659 SHA512 d58c5693c42dd1ba6d41d4e8bd0986ae35edb80b63c79619659d51fac5f617bd3cb97631ecd8626d974b75d611fe88c4d53e0ed185c5b11612db9e5bd53b978e
EBUILD kodi-21.0.ebuild 12985 BLAKE2B 1f92981dbf88468dd487878635faa413606d1f23dc4f39b2feb2fabaaeb3ac93c68efd291ddbb67b80bb10fefc3fc0507862d5892d6b1c082cd319b64f845cc0 SHA512 0b5c839b0d0a82fff064ccf818141a343f01377e0644922d15a2b70710923d316f056706b3a5f25f440fa3b7519ceef2996321518e4a552f510dae8c0900b015

View File

@@ -1,36 +0,0 @@
From 033988b975d65b791bc4ff282b9461f2b5b1c704 Mon Sep 17 00:00:00 2001
From: thexai <58434170+thexai@users.noreply.github.com>
Date: Wed, 8 Mar 2023 18:19:51 +0100
Subject: [PATCH] CDVDInputStreamFile: use 64K read chunk size when filesystem
not has specific requirement
This is used for media files as MKV, MP4, etc. but not DVD, Blu-Ray that
may have specific blocksize/sectorsize requirements.
---
.../DVDInputStreams/DVDInputStreamFile.cpp | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamFile.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamFile.cpp
index bebc68324af47..4214673f081c7 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamFile.cpp
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamFile.cpp
@@ -142,12 +142,15 @@ BitstreamStats CDVDInputStreamFile::GetBitstreamStats() const
return m_stats;
}
+// Use value returned by filesystem if is > 1
+// otherwise defaults to 64K
int CDVDInputStreamFile::GetBlockSize()
{
- if(m_pFile)
- return m_pFile->GetChunkSize();
- else
- return 0;
+ int chunk = 0;
+ if (m_pFile)
+ chunk = m_pFile->GetChunkSize();
+
+ return ((chunk > 1) ? chunk : 64 * 1024);
}
void CDVDInputStreamFile::SetReadRate(uint32_t rate)

View File

@@ -1,24 +0,0 @@
From 52a424a3ca743c9a6ad9ab21bea8b17df7999311 Mon Sep 17 00:00:00 2001
From: mglae <mglmail@arcor.de>
Date: Sun, 16 Apr 2023 19:38:54 +0200
Subject: [PATCH] VideoPlayerAudio: invalidate previous sync type after Audio
Sink created
Sync type will be set for the new created Sink
---
xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
index 01be866fcf9ed..2c246da6204f5 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
@@ -526,6 +526,8 @@ bool CVideoPlayerAudio::ProcessDecoderOutput(DVDAudioFrame &audioframe)
if (!m_audioSink.Create(audioframe, m_streaminfo.codec, m_synctype == SYNC_RESAMPLE))
CLog::Log(LOGERROR, "{} - failed to create audio renderer", __FUNCTION__);
+ m_prevsynctype = -1;
+
if (m_syncState == IDVDStreamPlayer::SYNC_INSYNC)
m_audioSink.Resume();
}

View File

@@ -1,103 +0,0 @@
https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/effadce6c756247ea8bae32dc13bb3e6f464f0eb
From db99a6e0ed9490478a7af7b6a3299688b1a329e1 Mon Sep 17 00:00:00 2001
From: Alfred Wingate <parona@protonmail.com>
Date: Sun, 24 Dec 2023 14:02:37 +0200
Subject: [PATCH] ffmpeg: add patch to fix build against binutils-2.41
Signed-off-by: Alfred Wingate <parona@protonmail.com>
--- a/cmake/modules/FindFFMPEG.cmake
+++ b/cmake/modules/FindFFMPEG.cmake
@@ -96,7 +96,9 @@ macro(buildFFMPEG)
-DPKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig)
set(PATCH_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/tools/depends/target/ffmpeg/CMakeLists.txt
- <SOURCE_DIR>)
+ <SOURCE_DIR> &&
+ # patch internal ffmpeg, fix build against binutils 2.41
+ patch -p1 < ${CMAKE_SOURCE_DIR}/tools/depends/target/ffmpeg/build-fix-for-binutils-2.41.patch)
if(CMAKE_GENERATOR STREQUAL Xcode)
set(FFMPEG_GENERATOR CMAKE_GENERATOR "Unix Makefiles")
--- /dev/null
+++ b/tools/depends/target/ffmpeg/build-fix-for-binutils-2.41.patch
@@ -0,0 +1,76 @@
+From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001
+From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
+Date: Sun, 16 Jul 2023 18:18:02 +0300
+Subject: [PATCH] avcodec/x86/mathops: clip constants used with shift
+ instructions within inline assembly
+
+Fixes assembling with binutil as >= 2.41
+
+Signed-off-by: James Almer <jamrial@gmail.com>
+---
+ libavcodec/x86/mathops.h | 26 +++++++++++++++++++++++---
+ 1 file changed, 23 insertions(+), 3 deletions(-)
+
+diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
+index 6298f5ed19..ca7e2dffc1 100644
+--- a/libavcodec/x86/mathops.h
++++ b/libavcodec/x86/mathops.h
+@@ -35,12 +35,20 @@
+ static av_always_inline av_const int MULL(int a, int b, unsigned shift)
+ {
+ int rt, dummy;
++ if (__builtin_constant_p(shift))
+ __asm__ (
+ "imull %3 \n\t"
+ "shrdl %4, %%edx, %%eax \n\t"
+ :"=a"(rt), "=d"(dummy)
+- :"a"(a), "rm"(b), "ci"((uint8_t)shift)
++ :"a"(a), "rm"(b), "i"(shift & 0x1F)
+ );
++ else
++ __asm__ (
++ "imull %3 \n\t"
++ "shrdl %4, %%edx, %%eax \n\t"
++ :"=a"(rt), "=d"(dummy)
++ :"a"(a), "rm"(b), "c"((uint8_t)shift)
++ );
+ return rt;
+ }
+
+@@ -113,19 +121,31 @@ __asm__ volatile(\
+ // avoid +32 for shift optimization (gcc should do that ...)
+ #define NEG_SSR32 NEG_SSR32
+ static inline int32_t NEG_SSR32( int32_t a, int8_t s){
++ if (__builtin_constant_p(s))
+ __asm__ ("sarl %1, %0\n\t"
+ : "+r" (a)
+- : "ic" ((uint8_t)(-s))
++ : "i" (-s & 0x1F)
+ );
++ else
++ __asm__ ("sarl %1, %0\n\t"
++ : "+r" (a)
++ : "c" ((uint8_t)(-s))
++ );
+ return a;
+ }
+
+ #define NEG_USR32 NEG_USR32
+ static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
++ if (__builtin_constant_p(s))
+ __asm__ ("shrl %1, %0\n\t"
+ : "+r" (a)
+- : "ic" ((uint8_t)(-s))
++ : "i" (-s & 0x1F)
+ );
++ else
++ __asm__ ("shrl %1, %0\n\t"
++ : "+r" (a)
++ : "c" ((uint8_t)(-s))
++ );
+ return a;
+ }
+
+--
+2.25.1
+
--
2.43.0

File diff suppressed because it is too large Load Diff

View File

@@ -1,624 +0,0 @@
From c9e25dc15acf1214b079da7021ad89acf85fa77d Mon Sep 17 00:00:00 2001
From: CastagnaIT <gottardo.stefano.83@gmail.com>
Date: Sun, 29 Jan 2023 17:51:51 +0100
Subject: [PATCH] [VideoPlayerVideo] Log an error when codec extradata is
required
---
xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
index 20f6b3b1cb51d..38f63f0766718 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
@@ -114,8 +114,11 @@ bool CVideoPlayerVideo::OpenStream(CDVDStreamInfo hint)
hint.codec == AV_CODEC_ID_WMV3 ||
hint.codec == AV_CODEC_ID_VC1 ||
hint.codec == AV_CODEC_ID_AV1)
- // clang-format on
+ {
+ CLog::LogF(LOGERROR, "Codec id {} require extradata.", hint.codec);
return false;
+ }
+ // clang-format on
}
CLog::Log(LOGINFO, "Creating video codec with codec id: {}", hint.codec);
From 2559466404d342428d43076bf90fcacc24313af0 Mon Sep 17 00:00:00 2001
From: enen92 <92enen@gmail.com>
Date: Mon, 6 Feb 2023 15:36:11 +0000
Subject: [PATCH] video: remove ffmpeg bsf hack
Manually setting the codecID on the bsf filter is wrong.
avcodec_parameters_copy should be used instead.
---
xbmc/cores/FFmpeg.cpp | 13 ++++++++-----
xbmc/cores/FFmpeg.h | 3 +--
.../VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp | 10 +++++++++-
.../VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 3 +--
4 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/xbmc/cores/FFmpeg.cpp b/xbmc/cores/FFmpeg.cpp
index d071f6d8e33a3..73b7ea2ae875c 100644
--- a/xbmc/cores/FFmpeg.cpp
+++ b/xbmc/cores/FFmpeg.cpp
@@ -135,9 +135,7 @@ void ff_avutil_log(void* ptr, int level, const char* format, va_list va)
buffer.erase(0, start);
}
-std::tuple<uint8_t*, int> GetPacketExtradata(const AVPacket* pkt,
- const AVCodecParserContext* parserCtx,
- AVCodecContext* codecCtx)
+std::tuple<uint8_t*, int> GetPacketExtradata(const AVPacket* pkt, const AVCodecParameters* codecPar)
{
constexpr int FF_MAX_EXTRADATA_SIZE = ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE);
@@ -151,7 +149,7 @@ std::tuple<uint8_t*, int> GetPacketExtradata(const AVPacket* pkt,
* for certain codecs, as noted in discussion of PR#21248
*/
- AVCodecID codecId = codecCtx->codec_id;
+ AVCodecID codecId = codecPar->codec_id;
// clang-format off
if (
@@ -178,7 +176,12 @@ std::tuple<uint8_t*, int> GetPacketExtradata(const AVPacket* pkt,
if (ret < 0)
return std::make_tuple(nullptr, 0);
- bsf->par_in->codec_id = codecId;
+ ret = avcodec_parameters_copy(bsf->par_in, codecPar);
+ if (ret < 0)
+ {
+ av_bsf_free(&bsf);
+ return std::make_tuple(nullptr, 0);
+ }
ret = av_bsf_init(bsf);
if (ret < 0)
diff --git a/xbmc/cores/FFmpeg.h b/xbmc/cores/FFmpeg.h
index 05547a0ba2b5f..5e35d58c6b0a6 100644
--- a/xbmc/cores/FFmpeg.h
+++ b/xbmc/cores/FFmpeg.h
@@ -73,5 +73,4 @@ class CFFmpegLog
};
std::tuple<uint8_t*, int> GetPacketExtradata(const AVPacket* pkt,
- const AVCodecParserContext* parserCtx,
- AVCodecContext* codecCtx);
+ const AVCodecParameters* codecPar);
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
index 052332331702a..9ca07b9a2dd39 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
@@ -162,7 +162,15 @@ bool CDVDDemuxClient::ParsePacket(DemuxPacket* pkt)
avpkt->size = pkt->iSize;
avpkt->dts = avpkt->pts = AV_NOPTS_VALUE;
- auto [retExtraData, len] = GetPacketExtradata(avpkt, stream->m_parser, stream->m_context);
+ AVCodecParameters* codecPar = nullptr;
+ int ret = avcodec_parameters_from_context(codecPar, stream->m_context);
+ if (ret < 0)
+ {
+ CLog::LogF(LOGERROR, "avcodec_parameters_from_context failed");
+ return false;
+ }
+
+ auto [retExtraData, len] = GetPacketExtradata(avpkt, codecPar);
if (len > 0)
{
st->changes++;
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
index 7e6a2e10616d7..bc6b54c87235d 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -2290,8 +2290,7 @@ void CDVDDemuxFFmpeg::ParsePacket(AVPacket* pkt)
parser->second->m_parserCtx->parser &&
!st->codecpar->extradata)
{
- auto [retExtraData, i] =
- GetPacketExtradata(pkt, parser->second->m_parserCtx, parser->second->m_codecCtx);
+ auto [retExtraData, i] = GetPacketExtradata(pkt, st->codecpar);
if (i > 0)
{
st->codecpar->extradata_size = i;
From f30f1e6418ea60bc7cb081c59f5f1d9431d264e6 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Sat, 11 Mar 2023 13:28:38 -0800
Subject: [PATCH 01/10] CDVDAudioCodecFFmpeg: ifdef use of
AV_CODEC_FLAG_TRUNCATED for ffmpeg 6.0
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
---
xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
index b2849c797dbc4..325bb0b7549ab 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
@@ -73,8 +73,10 @@ bool CDVDAudioCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
m_pCodecContext->debug = 0;
m_pCodecContext->workaround_bugs = 1;
+#if LIBAVCODEC_VERSION_MAJOR < 60
if (pCodec->capabilities & AV_CODEC_CAP_TRUNCATED)
m_pCodecContext->flags |= AV_CODEC_FLAG_TRUNCATED;
+#endif
m_matrixEncoding = AV_MATRIX_ENCODING_NONE;
m_channels = 0;
From 3b71910ee0bb650816456ecc9a21251aff650c4d Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Sat, 11 Mar 2023 13:29:18 -0800
Subject: [PATCH 02/10] CDVDAudioCodecFFmpeg: fix setting channel layout mask
when opening codec
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
---
.../DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
index 325bb0b7549ab..d1fb2cfe96afc 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
@@ -80,13 +80,21 @@
m_channels = 0;
#if LIBAVCODEC_BUILD >= AV_VERSION_INT(59, 37, 100) && \
LIBAVUTIL_BUILD >= AV_VERSION_INT(57, 28, 100)
- av_channel_layout_uninit(&m_pCodecContext->ch_layout);
- m_pCodecContext->ch_layout.order = AV_CHANNEL_ORDER_NATIVE;
- m_pCodecContext->ch_layout.nb_channels = hints.channels;
+ if (hints.channels > 0 && hints.channellayout > 0)
+ {
+ m_pCodecContext->ch_layout.order = AV_CHANNEL_ORDER_NATIVE;
+ m_pCodecContext->ch_layout.nb_channels = hints.channels;
+ m_pCodecContext->ch_layout.u.mask = hints.channellayout;
+ }
+ else if (hints.channels > 0)
+ {
+ av_channel_layout_default(&m_pCodecContext->ch_layout, hints.channels);
+ }
+
+ m_hint_layout = m_pCodecContext->ch_layout.u.mask;
#else
m_pCodecContext->channels = hints.channels;
#endif
- m_hint_layout = hints.channellayout;
m_pCodecContext->sample_rate = hints.samplerate;
m_pCodecContext->block_align = hints.blockalign;
m_pCodecContext->bit_rate = hints.bitrate;
From f4fadb3ba4583c45fb06908a3eb352be8c29f235 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Sat, 11 Mar 2023 13:29:34 -0800
Subject: [PATCH 03/10] CDVDAudioCodecFFmpeg: drop unneeded use of
AVFMT_FLAG_PRIV_OPT
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
---
xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
index bc6b54c87235d..016d198206716 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -323,7 +323,6 @@ bool CDVDDemuxFFmpeg::Open(const std::shared_ptr<CDVDInputStream>& pInput, bool
}
if (result < 0)
{
- m_pFormatContext->flags |= AVFMT_FLAG_PRIV_OPT;
if (avformat_open_input(&m_pFormatContext, strFile.c_str(), iformat, &options) < 0)
{
CLog::Log(LOGDEBUG, "Error, could not open file {}", CURL::GetRedacted(strFile));
@@ -335,7 +334,6 @@ bool CDVDDemuxFFmpeg::Open(const std::shared_ptr<CDVDInputStream>& pInput, bool
avformat_close_input(&m_pFormatContext);
m_pFormatContext = avformat_alloc_context();
m_pFormatContext->interrupt_callback = int_cb;
- m_pFormatContext->flags &= ~AVFMT_FLAG_PRIV_OPT;
AVDictionary* options = GetFFMpegOptionsFromInput();
av_dict_set_int(&options, "load_all_variants", 0, AV_OPT_SEARCH_CHILDREN);
if (avformat_open_input(&m_pFormatContext, strFile.c_str(), iformat, &options) < 0)
From 7d03f33b83e5fb127a7495798a20c3b63ac06795 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Wed, 15 Mar 2023 19:58:56 -0700
Subject: [PATCH 04/10] CDVDVideoCodecFFmpeg: update filter args to use
key/value pairs
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
---
.../VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
index bb9c20bf9d06e..c080589896ce7 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
@@ -1164,8 +1164,9 @@ int CDVDVideoCodecFFmpeg::FilterOpen(const std::string& filters, bool scale)
const AVFilter* outFilter = avfilter_get_by_name("buffersink"); // should be last filter in the graph for now
std::string args = StringUtils::Format(
- "{}:{}:{}:{}:{}:{}:{}", m_pCodecContext->width, m_pCodecContext->height,
- m_pCodecContext->pix_fmt, m_pCodecContext->time_base.num ? m_pCodecContext->time_base.num : 1,
+ "video_size={}x{}:pix_fmt={}:time_base={}/{}:pixel_aspect={}/{}", m_pCodecContext->width,
+ m_pCodecContext->height, m_pCodecContext->pix_fmt,
+ m_pCodecContext->time_base.num ? m_pCodecContext->time_base.num : 1,
m_pCodecContext->time_base.num ? m_pCodecContext->time_base.den : 1,
m_pCodecContext->sample_aspect_ratio.num != 0 ? m_pCodecContext->sample_aspect_ratio.num : 1,
m_pCodecContext->sample_aspect_ratio.num != 0 ? m_pCodecContext->sample_aspect_ratio.den : 1);
From 30bd7912802cf0f608751c452c48fc1a2eb8d91b Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Wed, 15 Mar 2023 19:59:27 -0700
Subject: [PATCH 05/10] CFFmpegPostproc: update filter args to use key/value
pairs
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
---
xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
index 81b969d119667..6c4f664591a04 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
@@ -2962,10 +2962,11 @@ bool CFFmpegPostproc::Init(EINTERLACEMETHOD method)
const AVFilter* srcFilter = avfilter_get_by_name("buffer");
const AVFilter* outFilter = avfilter_get_by_name("buffersink");
- std::string args = StringUtils::Format("{}:{}:{}:{}:{}:{}:{}", m_config.vidWidth,
- m_config.vidHeight, AV_PIX_FMT_NV12, 1, 1,
- (m_config.aspect.num != 0) ? m_config.aspect.num : 1,
- (m_config.aspect.num != 0) ? m_config.aspect.den : 1);
+ std::string args =
+ StringUtils::Format("video_size={}x{}:pix_fmt={}:time_base={}/{}:pixel_aspect={}/{}",
+ m_config.vidWidth, m_config.vidHeight, AV_PIX_FMT_NV12, 1, 1,
+ (m_config.aspect.num != 0) ? m_config.aspect.num : 1,
+ (m_config.aspect.num != 0) ? m_config.aspect.den : 1);
if (avfilter_graph_create_filter(&m_pFilterIn, srcFilter, "src", args.c_str(), NULL, m_pFilterGraph) < 0)
{
From 54a21151374a2d40a2a452fae2709205ed8e8836 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Sat, 11 Mar 2023 19:32:09 -0800
Subject: [PATCH 08/10] DXVA: CDecoder: replace removed av_mallocz_array with
av_calloc
ref: https://ffmpeg.org/doxygen/5.0/group__lavu__mem__funcs.html\#ga6627f140c3f70847bc6d9690a2fd001f
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
---
xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp
index a1bc3761c59d1..c06bd1ac0c7e6 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp
@@ -972,7 +972,8 @@ CDecoder::CDecoder(CProcessInfo& processInfo)
m_event.Set();
m_avD3D11Context = av_d3d11va_alloc_context();
m_avD3D11Context->cfg = reinterpret_cast<D3D11_VIDEO_DECODER_CONFIG*>(av_mallocz(sizeof(D3D11_VIDEO_DECODER_CONFIG)));
- m_avD3D11Context->surface = reinterpret_cast<ID3D11VideoDecoderOutputView**>(av_mallocz_array(32, sizeof(ID3D11VideoDecoderOutputView*)));
+ m_avD3D11Context->surface = reinterpret_cast<ID3D11VideoDecoderOutputView**>(
+ av_calloc(32, sizeof(ID3D11VideoDecoderOutputView*)));
m_bufferPool.reset();
DX::Windowing()->Register(this);
From be1247d627cee6561174467094f1e8a46357df79 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Sat, 11 Mar 2023 19:45:46 -0800
Subject: [PATCH 09/10] CFFmpegImage: remove deprecated use of pkt_duration
ref: https://ffmpeg.org/doxygen/6.0/structAVFrame.html\#a91725a40000e348b0607adf7f577e646
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
---
xbmc/guilib/FFmpegImage.cpp | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/xbmc/guilib/FFmpegImage.cpp b/xbmc/guilib/FFmpegImage.cpp
index e71980998b2e5..7171c046a9ce5 100644
--- a/xbmc/guilib/FFmpegImage.cpp
+++ b/xbmc/guilib/FFmpegImage.cpp
@@ -294,7 +294,15 @@ AVFrame* CFFmpegImage::ExtractFrame()
return nullptr;
}
//we need milliseconds
- frame->pkt_duration = av_rescale_q(frame->pkt_duration, m_fctx->streams[0]->time_base, AVRational{ 1, 1000 });
+
+#if LIBAVCODEC_VERSION_MAJOR < 60
+ frame->pkt_duration =
+ av_rescale_q(frame->pkt_duration, m_fctx->streams[0]->time_base, AVRational{1, 1000});
+#else
+ frame->duration =
+ av_rescale_q(frame->duration, m_fctx->streams[0]->time_base, AVRational{1, 1000});
+#endif
+
m_height = frame->height;
m_width = frame->width;
m_originalWidth = m_width;
@@ -745,7 +753,13 @@ std::shared_ptr<Frame> CFFmpegImage::ReadFrame()
if (avframe == nullptr)
return nullptr;
std::shared_ptr<Frame> frame(new Frame());
+
+#if LIBAVCODEC_VERSION_MAJOR < 60
frame->m_delay = (unsigned int)avframe->pkt_duration;
+#else
+ frame->m_delay = (unsigned int)avframe->duration;
+#endif
+
frame->m_pitch = avframe->width * 4;
frame->m_pImage = (unsigned char*) av_malloc(avframe->height * frame->m_pitch);
DecodeFrame(avframe, avframe->width, avframe->height, frame->m_pitch, frame->m_pImage);
From c12af890b0973f7c86316087e823f8a31c6b2ed3 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Sat, 11 Mar 2023 19:45:01 -0800
Subject: [PATCH 10/10] CDVDVideoCodecFFmpeg: remove deprecated use of
reordered_opaque
ref: https://ffmpeg.org/doxygen/6.0/structAVFrame.html#a12f572ed19a2cba6be3790393cee76b5
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
---
.../DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 11 ++++++++++-
xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp | 6 ++++--
xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp | 3 +++
xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp | 5 ++++-
4 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
index c080589896ce7..6a53ade4a7351 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
@@ -370,6 +370,10 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
m_pCodecContext->get_format = GetFormat;
m_pCodecContext->codec_tag = hints.codec_tag;
+#if LIBAVCODEC_VERSION_MAJOR >= 60
+ m_pCodecContext->flags = AV_CODEC_FLAG_COPY_OPAQUE;
+#endif
+
// setup threading model
if (!(hints.codecOptions & CODEC_FORCE_SOFTWARE))
{
@@ -545,9 +549,10 @@ void CDVDVideoCodecFFmpeg::UpdateName()
CLog::Log(LOGDEBUG, "CDVDVideoCodecFFmpeg - Updated codec: {}", m_name);
}
+#if LIBAVCODEC_VERSION_MAJOR < 60
union pts_union
{
- double pts_d;
+ double pts_d;
int64_t pts_i;
};
@@ -557,6 +562,7 @@ static int64_t pts_dtoi(double pts)
u.pts_d = pts;
return u.pts_i;
}
+#endif
bool CDVDVideoCodecFFmpeg::AddData(const DemuxPacket &packet)
{
@@ -575,7 +581,10 @@ bool CDVDVideoCodecFFmpeg::AddData(const DemuxPacket &packet)
m_started = true;
m_dts = packet.dts;
+
+#if LIBAVCODEC_VERSION_MAJOR < 60
m_pCodecContext->reordered_opaque = pts_dtoi(packet.pts);
+#endif
AVPacket* avpkt = av_packet_alloc();
if (!avpkt)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp
index c06bd1ac0c7e6..81451995ca1db 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp
@@ -1538,8 +1538,6 @@ int CDecoder::GetBuffer(AVCodecContext* avctx, AVFrame* pic)
return -1;
}
- pic->reordered_opaque = avctx->reordered_opaque;
-
for (unsigned i = 0; i < 4; i++)
{
pic->data[i] = nullptr;
@@ -1556,6 +1554,10 @@ int CDecoder::GetBuffer(AVCodecContext* avctx, AVFrame* pic)
}
pic->buf[0] = buffer;
+#if LIBAVCODEC_VERSION_MAJOR < 60
+ pic->reordered_opaque = avctx->reordered_opaque;
+#endif
+
Acquire();
return 0;
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
index 6c4f664591a04..447a13495d4e8 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
@@ -867,7 +867,10 @@ int CDecoder::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic, int flags)
}
pic->buf[0] = buffer;
+#if LIBAVCODEC_VERSION_MAJOR < 60
pic->reordered_opaque = avctx->reordered_opaque;
+#endif
+
va->Acquire();
return 0;
}
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp
index ec07af79de819..50e16d492ebc7 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp
@@ -1041,7 +1041,10 @@ int CDecoder::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic, int flags)
}
pic->buf[0] = buffer;
- pic->reordered_opaque= avctx->reordered_opaque;
+#if LIBAVCODEC_VERSION_MAJOR < 60
+ pic->reordered_opaque = avctx->reordered_opaque;
+#endif
+
return 0;
}
From 928a7e4196046154419727a23c734d904e5e1b6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20H=C3=A4rer?= <markus.haerer@gmx.net>
Date: Sun, 23 Apr 2023 23:29:28 +0200
Subject: [PATCH] FFmpegImage: Switch back to jpeg_pipe for FFmpeg>=6.0
---
xbmc/guilib/FFmpegImage.cpp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/xbmc/guilib/FFmpegImage.cpp b/xbmc/guilib/FFmpegImage.cpp
index 7171c046a9ce5..429037740a7d2 100644
--- a/xbmc/guilib/FFmpegImage.cpp
+++ b/xbmc/guilib/FFmpegImage.cpp
@@ -198,9 +198,16 @@ bool CFFmpegImage::Initialize(unsigned char* buffer, size_t bufSize)
bool is_png = (bufSize > 3 && buffer[1] == 'P' && buffer[2] == 'N' && buffer[3] == 'G');
bool is_tiff = (bufSize > 2 && buffer[0] == 'I' && buffer[1] == 'I' && buffer[2] == '*');
+ // See Github #19113
+#if LIBAVCODEC_VERSION_MAJOR < 60
+ constexpr char jpegFormat[] = "image2";
+#else
+ constexpr char jpegFormat[] = "jpeg_pipe";
+#endif
+
FFMPEG_FMT_CONST AVInputFormat* inp = nullptr;
if (is_jpeg)
- inp = av_find_input_format("image2");
+ inp = av_find_input_format(jpegFormat);
else if (m_strMimeType == "image/apng")
inp = av_find_input_format("apng");
else if (is_png)
@@ -213,7 +220,7 @@ bool CFFmpegImage::Initialize(unsigned char* buffer, size_t bufSize)
inp = av_find_input_format("webp_pipe");
// brute force parse if above check already failed
else if (m_strMimeType == "image/jpeg" || m_strMimeType == "image/jpg")
- inp = av_find_input_format("image2");
+ inp = av_find_input_format(jpegFormat);
else if (m_strMimeType == "image/png")
inp = av_find_input_format("png_pipe");
else if (m_strMimeType == "image/tiff")
From 9d7f4dfd00d89d4a5d6d8095ee9b0b746051b30c Mon Sep 17 00:00:00 2001
From: CrystalP <crystalp@kodi.tv>
Date: Mon, 1 May 2023 13:26:56 -0400
Subject: [PATCH] [fix] extern C for ffmpeg includes
---
xbmc/cores/RetroPlayer/process/RPProcessInfo.h | 3 +++
xbmc/cores/RetroPlayer/rendering/RenderTranslator.h | 3 +++
xbmc/cores/VideoPlayer/DVDFileInfo.cpp | 4 ++--
xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.h | 4 ++++
.../VideoPlayer/VideoRenderers/windows/RendererShaders.h | 4 ++++
5 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/xbmc/cores/RetroPlayer/process/RPProcessInfo.h b/xbmc/cores/RetroPlayer/process/RPProcessInfo.h
index 9f930e78e9d84..f5ffe670d68aa 100644
--- a/xbmc/cores/RetroPlayer/process/RPProcessInfo.h
+++ b/xbmc/cores/RetroPlayer/process/RPProcessInfo.h
@@ -17,7 +17,10 @@
#include <string>
#include <vector>
+extern "C"
+{
#include <libavutil/pixfmt.h>
+}
class CDataCacheCore;
diff --git a/xbmc/cores/RetroPlayer/rendering/RenderTranslator.h b/xbmc/cores/RetroPlayer/rendering/RenderTranslator.h
index 575ad814fc125..d78e1c25e4070 100644
--- a/xbmc/cores/RetroPlayer/rendering/RenderTranslator.h
+++ b/xbmc/cores/RetroPlayer/rendering/RenderTranslator.h
@@ -10,7 +10,10 @@
#include "cores/GameSettings.h"
+extern "C"
+{
#include <libavutil/pixfmt.h>
+}
namespace KODI
{
diff --git a/xbmc/cores/VideoPlayer/DVDFileInfo.cpp b/xbmc/cores/VideoPlayer/DVDFileInfo.cpp
index 0860b40475b18..c7253bbd5497f 100644
--- a/xbmc/cores/VideoPlayer/DVDFileInfo.cpp
+++ b/xbmc/cores/VideoPlayer/DVDFileInfo.cpp
@@ -32,8 +32,6 @@
#include "DVDDemuxers/DVDDemuxVobsub.h"
#include "Process/ProcessInfo.h"
-#include <libavcodec/avcodec.h>
-#include <libswscale/swscale.h>
#include "filesystem/File.h"
#include "cores/FFmpeg.h"
#include "TextureCache.h"
@@ -44,7 +42,9 @@
#include <memory>
extern "C" {
+#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
+#include <libswscale/swscale.h>
}
bool CDVDFileInfo::GetFileDuration(const std::string &path, int& duration)
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.h b/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.h
index 9412377157f94..0eed9503dc9ac 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.h
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.h
@@ -13,7 +13,11 @@
#include <map>
#include <d3d11_4.h>
+
+extern "C"
+{
#include <libavutil/pixfmt.h>
+}
enum RenderMethod;
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererShaders.h b/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererShaders.h
index 945cadda76841..af4d677aae923 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererShaders.h
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererShaders.h
@@ -13,7 +13,11 @@
#include <map>
#include <d3d11_4.h>
+
+extern "C"
+{
#include <libavutil/pixfmt.h>
+}
#define PLANE_Y 0
#define PLANE_U 1

View File

@@ -1,36 +0,0 @@
From 3ad9588656e30abd421e48147b23aee9fb4b3557 Mon Sep 17 00:00:00 2001
From: Miguel Borges de Freitas <92enen@gmail.com>
Date: Sun, 12 Feb 2023 12:08:36 +0000
Subject: [PATCH] [video] fix crash in avcodec_parameters_from_context
---
xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
index 9ca07b9a2dd39..26fa9522eea7a 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
@@ -162,11 +162,12 @@ bool CDVDDemuxClient::ParsePacket(DemuxPacket* pkt)
avpkt->size = pkt->iSize;
avpkt->dts = avpkt->pts = AV_NOPTS_VALUE;
- AVCodecParameters* codecPar = nullptr;
+ AVCodecParameters* codecPar = avcodec_parameters_alloc();
int ret = avcodec_parameters_from_context(codecPar, stream->m_context);
if (ret < 0)
{
CLog::LogF(LOGERROR, "avcodec_parameters_from_context failed");
+ avcodec_parameters_free(&codecPar);
return false;
}
@@ -188,7 +189,7 @@ bool CDVDDemuxClient::ParsePacket(DemuxPacket* pkt)
avcodec_close(stream->m_context);
}
}
-
+ avcodec_parameters_free(&codecPar);
av_packet_free(&avpkt);
}

View File

@@ -1,55 +0,0 @@
From 456d6557ea570f63dc18831242b9189f96c1097d Mon Sep 17 00:00:00 2001
From: Steve Hartwell <steve.hartwell@gmail.com>
Date: Sun, 12 Feb 2023 18:10:45 +0000
Subject: [PATCH] [video] use smart_ptr and custom destructor for
AVCodecParameters
Co-authored-by: Miguel Borges de Freitas <92enen@gmail.com>
---
.../cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
index 26fa9522eea7a..2a42244b62b68 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
@@ -14,7 +14,9 @@
#include "cores/VideoPlayer/Interface/TimingConstants.h"
#include "utils/log.h"
+#include <memory>
#include <tuple>
+#include <type_traits>
#include <utility>
class CDemuxStreamClientInternal
@@ -162,16 +164,17 @@ bool CDVDDemuxClient::ParsePacket(DemuxPacket* pkt)
avpkt->size = pkt->iSize;
avpkt->dts = avpkt->pts = AV_NOPTS_VALUE;
- AVCodecParameters* codecPar = avcodec_parameters_alloc();
- int ret = avcodec_parameters_from_context(codecPar, stream->m_context);
+ constexpr auto codecParDeleter = [](AVCodecParameters* p) { avcodec_parameters_free(&p); };
+ auto codecPar = std::unique_ptr<AVCodecParameters, decltype(codecParDeleter)>(
+ avcodec_parameters_alloc(), codecParDeleter);
+ int ret = avcodec_parameters_from_context(codecPar.get(), stream->m_context);
if (ret < 0)
{
CLog::LogF(LOGERROR, "avcodec_parameters_from_context failed");
- avcodec_parameters_free(&codecPar);
return false;
}
- auto [retExtraData, len] = GetPacketExtradata(avpkt, codecPar);
+ auto [retExtraData, len] = GetPacketExtradata(avpkt, codecPar.get());
if (len > 0)
{
st->changes++;
@@ -189,7 +192,6 @@ bool CDVDDemuxClient::ParsePacket(DemuxPacket* pkt)
avcodec_close(stream->m_context);
}
}
- avcodec_parameters_free(&codecPar);
av_packet_free(&avpkt);
}

View File

@@ -1,10 +0,0 @@
diff -dNur a/xbmc/interfaces/swig/AddonModuleXbmcaddon.i b/xbmc/interfaces/swig/AddonModuleXbmcaddon.i
--- a/xbmc/interfaces/swig/AddonModuleXbmcaddon.i 2024-01-10 04:24:09.000000000 +0100
+++ b/xbmc/interfaces/swig/AddonModuleXbmcaddon.i 2024-01-14 21:58:20.619762773 +0100
@@ -33,5 +33,6 @@
%include "interfaces/legacy/AddonString.h"
%include "interfaces/legacy/Addon.h"
+%nodefaultctor Settings;
%include "interfaces/legacy/Settings.h"

View File

@@ -1,333 +0,0 @@
From 02e6b6f9003aaf3984ccb83b91df4bf4cd183c6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20H=C3=A4rer?= <markus.haerer@gmx.net>
Date: Mon, 1 Apr 2024 19:15:07 +0200
Subject: [PATCH 1/2] [GUIIncludes] Fix heap-use-after-free
Only remove the child if the node is actually a child.
==51989==ERROR: AddressSanitizer: heap-use-after-free on address 0x511003b69210 at pc 0x5ce4b249275e bp 0x7fff43e1d430 sp 0x7fff43e1d428
READ of size 8 at 0x511003b69210 thread T0
#0 0x5ce4b249275d in TiXmlAttributeSet::First() /usr/include/tinyxml.h:915:50
#1 0x5ce4b2492098 in TiXmlElement::FirstAttribute() /usr/include/tinyxml.h:1087:61
#2 0x5ce4b2bb091e in CGUIIncludes::ResolveParametersForNode(TiXmlElement*, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>> const&) xbmc/guilib/GUIIncludes.cpp:586:37
#3 0x5ce4b2bae9bb in CGUIIncludes::ResolveIncludes(TiXmlElement*, std::map<std::shared_ptr<INFO::InfoBool>, bool, std::less<std::shared_ptr<INFO::InfoBool>>, std::allocator<std::pair<std::shared_ptr<INFO::InfoBool> const, bool>>>*) xbmc/guilib/GUIIncludes.cpp:485:9
#4 0x5ce4b2ba8eaf in CGUIIncludes::Resolve(TiXmlElement*, std::map<std::shared_ptr<INFO::InfoBool>, bool, std::less<std::shared_ptr<INFO::InfoBool>>, std::allocator<std::pair<std::shared_ptr<INFO::InfoBool> const, bool>>>*) xbmc/guilib/GUIIncludes.cpp:312:3
#5 0x5ce4b2ba8fce in CGUIIncludes::Resolve(TiXmlElement*, std::map<std::shared_ptr<INFO::InfoBool>, bool, std::less<std::shared_ptr<INFO::InfoBool>>, std::allocator<std::pair<std::shared_ptr<INFO::InfoBool> const, bool>>>*) xbmc/guilib/GUIIncludes.cpp:318:5
#6 0x5ce4b3e808d3 in ADDON::CSkinInfo::ResolveIncludes(TiXmlElement*, std::map<std::shared_ptr<INFO::InfoBool>, bool, std::less<std::shared_ptr<INFO::InfoBool>>, std::allocator<std::pair<std::shared_ptr<INFO::InfoBool> const, bool>>>*) xbmc/addons/Skin.cpp:307:14
#7 0x5ce4b2e00084 in CGUIWindow::Prepare(std::unique_ptr<TiXmlElement, std::default_delete<TiXmlElement>> const&) xbmc/guilib/GUIWindow.cpp:168:15
#8 0x5ce4b2dff45e in CGUIWindow::LoadXML(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) xbmc/guilib/GUIWindow.cpp:155:15
#9 0x5ce4b2dfd540 in CGUIWindow::Load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool) xbmc/guilib/GUIWindow.cpp:109:14
#10 0x5ce4b2e1cac5 in CGUIWindow::AllocResources(bool) xbmc/guilib/GUIWindow.cpp:765:7
#11 0x5ce4b2e14c77 in CGUIWindow::OnMessage(CGUIMessage&) xbmc/guilib/GUIWindow.cpp:594:52
#12 0x5ce4b19ce9d2 in CGUIWindowHome::OnMessage(CGUIMessage&) xbmc/windows/GUIWindowHome.cpp:182:22
#13 0x5ce4b2e613a1 in CGUIWindowManager::ActivateWindow_Internal(int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, bool, bool) xbmc/guilib/GUIWindowManager.cpp:896:15
#14 0x5ce4b2e5ce3c in CGUIWindowManager::ActivateWindow(int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, bool, bool) xbmc/guilib/GUIWindowManager.cpp:802:5
#15 0x5ce4b683ad63 in int (anonymous namespace)::ActivateWindow<true>(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) xbmc/interfaces/builtins/GUIBuiltins.cpp:109:52
#16 0x5ce4b6822865 in CBuiltins::Execute(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) xbmc/interfaces/builtins/Builtins.cpp:158:14
#17 0x5ce4b34047ff in CApplication::ExecuteXBMCAction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::shared_ptr<CGUIListItem> const&) xbmc/application/Application.cpp:3037:32
#18 0x5ce4b3400a16 in CApplication::OnMessage(CGUIMessage&) xbmc/application/Application.cpp:3013:14
#19 0x5ce4b34058a0 in non-virtual thunk to CApplication::OnMessage(CGUIMessage&) xbmc/application/Application.cpp
#20 0x5ce4b2e52261 in CGUIWindowManager::SendMessage(CGUIMessage&) xbmc/guilib/GUIWindowManager.cpp:510:23
#21 0x5ce4b2e7cc7f in CGUIWindowManager::DispatchThreadMessages() xbmc/guilib/GUIWindowManager.cpp:1572:7
#22 0x5ce4b3405bfa in CApplication::Process() xbmc/application/Application.cpp:3139:48
#23 0x5ce4b33ddc98 in CApplication::Run() xbmc/application/Application.cpp:1855:5
#24 0x5ce4b251b323 in XBMC_Run xbmc/platform/xbmc.cpp:61:26
#25 0x5ce4af14af0f in main xbmc/platform/posix/main.cpp:70:16
#26 0x76d804243ccf (/usr/lib/libc.so.6+0x25ccf) (BuildId: c0caa0b7709d3369ee575fcd7d7d0b0fc48733af)
#27 0x76d804243d89 in __libc_start_main (/usr/lib/libc.so.6+0x25d89) (BuildId: c0caa0b7709d3369ee575fcd7d7d0b0fc48733af)
#28 0x5ce4af010b94 in _start (/home/mark/Coding/Repos/kodi-git/build_clang_debug_sanitizer/kodi.bin+0xa317b94) (BuildId: 923aa634157be6adc50052366abd3ca0edfeffc0)
0x511003b69210 is located 208 bytes inside of 216-byte region [0x511003b69140,0x511003b69218)
freed by thread T0 here:
#0 0x5ce4af148d72 in operator delete(void*, unsigned long) (/home/mark/Coding/Repos/kodi-git/build_clang_debug_sanitizer/kodi.bin+0xa44fd72) (BuildId: 923aa634157be6adc50052366abd3ca0edfeffc0)
#1 0x76d80670ea48 in TiXmlNode::RemoveChild(TiXmlNode*) (/usr/lib/libtinyxml.so.0+0x8a48) (BuildId: 2f5d236264d4d695dbe432f41e1eb46c7bc2d5d4)
#2 0x5ce4b2bae9a3 in CGUIIncludes::ResolveIncludes(TiXmlElement*, std::map<std::shared_ptr<INFO::InfoBool>, bool, std::less<std::shared_ptr<INFO::InfoBool>>, std::allocator<std::pair<std::shared_ptr<INFO::InfoBool> const, bool>>>*) xbmc/guilib/GUIIncludes.cpp:482:9
#3 0x5ce4b2ba8eaf in CGUIIncludes::Resolve(TiXmlElement*, std::map<std::shared_ptr<INFO::InfoBool>, bool, std::less<std::shared_ptr<INFO::InfoBool>>, std::allocator<std::pair<std::shared_ptr<INFO::InfoBool> const, bool>>>*) xbmc/guilib/GUIIncludes.cpp:312:3
#4 0x5ce4b2ba8fce in CGUIIncludes::Resolve(TiXmlElement*, std::map<std::shared_ptr<INFO::InfoBool>, bool, std::less<std::shared_ptr<INFO::InfoBool>>, std::allocator<std::pair<std::shared_ptr<INFO::InfoBool> const, bool>>>*) xbmc/guilib/GUIIncludes.cpp:318:5
#5 0x5ce4b3e808d3 in ADDON::CSkinInfo::ResolveIncludes(TiXmlElement*, std::map<std::shared_ptr<INFO::InfoBool>, bool, std::less<std::shared_ptr<INFO::InfoBool>>, std::allocator<std::pair<std::shared_ptr<INFO::InfoBool> const, bool>>>*) xbmc/addons/Skin.cpp:307:14
#6 0x5ce4b2e00084 in CGUIWindow::Prepare(std::unique_ptr<TiXmlElement, std::default_delete<TiXmlElement>> const&) xbmc/guilib/GUIWindow.cpp:168:15
#7 0x5ce4b2dff45e in CGUIWindow::LoadXML(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) xbmc/guilib/GUIWindow.cpp:155:15
#8 0x5ce4b2dfd540 in CGUIWindow::Load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool) xbmc/guilib/GUIWindow.cpp:109:14
#9 0x5ce4b2e1cac5 in CGUIWindow::AllocResources(bool) xbmc/guilib/GUIWindow.cpp:765:7
#10 0x5ce4b2e14c77 in CGUIWindow::OnMessage(CGUIMessage&) xbmc/guilib/GUIWindow.cpp:594:52
#11 0x5ce4b19ce9d2 in CGUIWindowHome::OnMessage(CGUIMessage&) xbmc/windows/GUIWindowHome.cpp:182:22
#12 0x5ce4b2e613a1 in CGUIWindowManager::ActivateWindow_Internal(int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, bool, bool) xbmc/guilib/GUIWindowManager.cpp:896:15
#13 0x5ce4b2e5ce3c in CGUIWindowManager::ActivateWindow(int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, bool, bool) xbmc/guilib/GUIWindowManager.cpp:802:5
#14 0x5ce4b683ad63 in int (anonymous namespace)::ActivateWindow<true>(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) xbmc/interfaces/builtins/GUIBuiltins.cpp:109:52
#15 0x5ce4b6822865 in CBuiltins::Execute(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) xbmc/interfaces/builtins/Builtins.cpp:158:14
#16 0x5ce4b34047ff in CApplication::ExecuteXBMCAction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::shared_ptr<CGUIListItem> const&) xbmc/application/Application.cpp:3037:32
#17 0x5ce4b3400a16 in CApplication::OnMessage(CGUIMessage&) xbmc/application/Application.cpp:3013:14
#18 0x5ce4b34058a0 in non-virtual thunk to CApplication::OnMessage(CGUIMessage&) xbmc/application/Application.cpp
#19 0x5ce4b2e52261 in CGUIWindowManager::SendMessage(CGUIMessage&) xbmc/guilib/GUIWindowManager.cpp:510:23
#20 0x5ce4b2e7cc7f in CGUIWindowManager::DispatchThreadMessages() xbmc/guilib/GUIWindowManager.cpp:1572:7
#21 0x5ce4b3405bfa in CApplication::Process() xbmc/application/Application.cpp:3139:48
#22 0x5ce4b33ddc98 in CApplication::Run() xbmc/application/Application.cpp:1855:5
#23 0x5ce4b251b323 in XBMC_Run xbmc/platform/xbmc.cpp:61:26
#24 0x5ce4af14af0f in main xbmc/platform/posix/main.cpp:70:16
#25 0x76d804243ccf (/usr/lib/libc.so.6+0x25ccf) (BuildId: c0caa0b7709d3369ee575fcd7d7d0b0fc48733af)
previously allocated by thread T0 here:
#0 0x5ce4af147e12 in operator new(unsigned long) (/home/mark/Coding/Repos/kodi-git/build_clang_debug_sanitizer/kodi.bin+0xa44ee12) (BuildId: 923aa634157be6adc50052366abd3ca0edfeffc0)
#1 0x76d806711497 in TiXmlElement::Clone() const (/usr/lib/libtinyxml.so.0+0xb497) (BuildId: 2f5d236264d4d695dbe432f41e1eb46c7bc2d5d4)
SUMMARY: AddressSanitizer: heap-use-after-free /usr/include/tinyxml.h:915:50 in TiXmlAttributeSet::First()
Shadow bytes around the buggy address:
0x511003b68f80: 00 00 00 fa fa fa fa fa fa fa fa fa fa fa fa fa
0x511003b69000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x511003b69080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x511003b69100: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
0x511003b69180: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x511003b69200: fd fd[fd]fa fa fa fa fa fa fa fa fa fa fa fa fa
0x511003b69280: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x511003b69300: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x511003b69380: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x511003b69400: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x511003b69480: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==51989==ABORTING
(cherry picked from commit 52988c92e934e593ddb8e93d6369f0636dc7db84)
---
xbmc/guilib/GUIIncludes.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xbmc/guilib/GUIIncludes.cpp b/xbmc/guilib/GUIIncludes.cpp
index 55d967346f1f5..da8f3a33c943e 100644
--- a/xbmc/guilib/GUIIncludes.cpp
+++ b/xbmc/guilib/GUIIncludes.cpp
@@ -529,7 +529,8 @@ void CGUIIncludes::InsertNested(TiXmlElement *controls, TiXmlElement *include, T
}
child = child->NextSiblingElement();
}
- target->RemoveChild(nested);
+ if (nested != node)
+ target->RemoveChild(nested);
}
}
From 25dec1b0ee14b65cc44d0fd1792e4e6b583fbdcb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20H=C3=A4rer?= <markus.haerer@gmx.net>
Date: Mon, 1 Apr 2024 19:24:57 +0200
Subject: [PATCH 2/2] [GUIBaseContainer] Fix heap-use-after-free
See comment in code for information.
==30885==ERROR: AddressSanitizer: heap-use-after-free on address 0x51800050bbe8 at pc 0x56aa085d20db bp 0x7ffd92777f50 sp 0x7ffd92777f48
READ of size 1 at 0x51800050bbe8 thread T0
#0 0x56aa085d20da in CGUIAction::ExecuteActions(int, int, std::shared_ptr<CGUIListItem> const&) const xbmc/guilib/GUIAction.cpp:86:9
#1 0x56aa084b7701 in CStaticListProvider::OnClick(std::shared_ptr<CGUIListItem> const&) xbmc/guilib/listproviders/StaticProvider.cpp:136:40
#2 0x56aa0862e065 in CGUIBaseContainer::OnClick(int) xbmc/guilib/GUIBaseContainer.cpp:881:27
#3 0x56aa0862b09c in CGUIBaseContainer::OnAction(CAction const&) xbmc/guilib/GUIBaseContainer.cpp:474:28
#4 0x56aa08c4bdf5 in CGUIWrappingListContainer::OnAction(CAction const&) xbmc/guilib/GUIWrappingListContainer.cpp:75:29
#5 0x56aa08b8f441 in CGUIWindow::OnAction(CAction const&) xbmc/guilib/GUIWindow.cpp:429:27
#6 0x56aa08bee00c in CGUIWindowManager::HandleAction(CAction const&) const xbmc/guilib/GUIWindowManager.cpp:1199:20
#7 0x56aa08bec973 in CGUIWindowManager::OnAction(CAction const&) const xbmc/guilib/GUIWindowManager.cpp:1144:11
#8 0x56aa0912be04 in CApplication::OnAction(CAction const&) xbmc/application/Application.cpp:913:54
#9 0x56aa0c914de1 in CInputManager::ExecuteInputAction(CAction const&) xbmc/input/InputManager.cpp:746:29
#10 0x56aa0c921842 in CInputManager::HandleKey(CKey const&) xbmc/input/InputManager.cpp:680:10
#11 0x56aa0c91c2ec in CInputManager::OnKeyUp(CKey const&) xbmc/input/InputManager.cpp:693:5
#12 0x56aa0c917737 in CInputManager::OnEvent(XBMC_Event&) xbmc/input/InputManager.cpp:361:7
#13 0x56aa090fe458 in CAppInboundProtocol::HandleEvents() xbmc/application/AppInboundProtocol.cpp:113:43
#14 0x56aa0915b240 in CApplication::FrameMove(bool, bool) xbmc/application/Application.cpp:1756:17
#15 0x56aa0915f200 in CApplication::Run() xbmc/application/Application.cpp:1860:7
#16 0x56aa0829c3e3 in XBMC_Run xbmc/platform/xbmc.cpp:61:26
#17 0x56aa04ecbfcf in main xbmc/platform/posix/main.cpp:70:16
#18 0x7517fb043ccf (/usr/lib/libc.so.6+0x25ccf) (BuildId: c0caa0b7709d3369ee575fcd7d7d0b0fc48733af)
#19 0x7517fb043d89 in __libc_start_main (/usr/lib/libc.so.6+0x25d89) (BuildId: c0caa0b7709d3369ee575fcd7d7d0b0fc48733af)
#20 0x56aa04d91c54 in _start (/home/mark/Coding/Repos/kodi-git/build_clang_debug_sanitizer/kodi.bin+0xa317c54) (BuildId: 7f84180dd757174de6de03b115843129667234d3)
0x51800050bbe8 is located 872 bytes inside of 880-byte region [0x51800050b880,0x51800050bbf0)
freed by thread T0 here:
#0 0x56aa04ec996a in operator delete(void*) (/home/mark/Coding/Repos/kodi-git/build_clang_debug_sanitizer/kodi.bin+0xa44f96a) (BuildId: 7f84180dd757174de6de03b115843129667234d3)
#1 0x56aa08ae24d1 in CGUIStaticItem::~CGUIStaticItem() xbmc/guilib/GUIStaticItem.h:55:38
#2 0x56aa05922763 in std::_Sp_counted_ptr<CGUIStaticItem*, (__gnu_cxx::_Lock_policy)2>::_M_dispose() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/shared_ptr_base.h:428:9
#3 0x56aa04ecd0bc in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/shared_ptr_base.h:346:8
#4 0x56aa04eccca9 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/shared_ptr_base.h:1071:11
#5 0x56aa050d1c6c in std::__shared_ptr<CGUIListItem, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/shared_ptr_base.h:1524:31
#6 0x56aa050c6ee8 in std::shared_ptr<CGUIListItem>::~shared_ptr() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/shared_ptr.h:175:11
#7 0x56aa08465110 in void std::_Destroy<std::shared_ptr<CGUIListItem>>(std::shared_ptr<CGUIListItem>*) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/stl_construct.h:151:19
#8 0x56aa0846505e in void std::_Destroy_aux<false>::__destroy<std::shared_ptr<CGUIListItem>*>(std::shared_ptr<CGUIListItem>*, std::shared_ptr<CGUIListItem>*) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/stl_construct.h:163:6
#9 0x56aa08465024 in void std::_Destroy<std::shared_ptr<CGUIListItem>*>(std::shared_ptr<CGUIListItem>*, std::shared_ptr<CGUIListItem>*) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/stl_construct.h:195:7
#10 0x56aa084a624b in void std::_Destroy<std::shared_ptr<CGUIListItem>*, std::shared_ptr<CGUIListItem>>(std::shared_ptr<CGUIListItem>*, std::shared_ptr<CGUIListItem>*, std::allocator<std::shared_ptr<CGUIListItem>>&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/alloc_traits.h:947:7
#11 0x56aa084a624b in std::vector<std::shared_ptr<CGUIListItem>, std::allocator<std::shared_ptr<CGUIListItem>>>::~vector() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/stl_vector.h:732:2
#12 0x56aa086169e5 in CGUIBaseContainer::~CGUIBaseContainer() xbmc/guilib/GUIBaseContainer.cpp:117:1
#13 0x56aa08c4a148 in CGUIWrappingListContainer::~CGUIWrappingListContainer() xbmc/guilib/GUIWrappingListContainer.cpp:26:59
#14 0x56aa08c4a198 in CGUIWrappingListContainer::~CGUIWrappingListContainer() xbmc/guilib/GUIWrappingListContainer.cpp:26:59
#15 0x56aa08758935 in CGUIControlGroup::ClearAll() xbmc/guilib/GUIControlGroup.cpp:525:5
#16 0x56aa08743bb9 in CGUIControlGroup::~CGUIControlGroup() xbmc/guilib/GUIControlGroup.cpp:56:3
#17 0x56aa08743c48 in CGUIControlGroup::~CGUIControlGroup() xbmc/guilib/GUIControlGroup.cpp:55:1
#18 0x56aa08758935 in CGUIControlGroup::ClearAll() xbmc/guilib/GUIControlGroup.cpp:525:5
#19 0x56aa08743bb9 in CGUIControlGroup::~CGUIControlGroup() xbmc/guilib/GUIControlGroup.cpp:56:3
#20 0x56aa08743c48 in CGUIControlGroup::~CGUIControlGroup() xbmc/guilib/GUIControlGroup.cpp:55:1
#21 0x56aa08758935 in CGUIControlGroup::ClearAll() xbmc/guilib/GUIControlGroup.cpp:525:5
#22 0x56aa08743bb9 in CGUIControlGroup::~CGUIControlGroup() xbmc/guilib/GUIControlGroup.cpp:56:3
#23 0x56aa08743c48 in CGUIControlGroup::~CGUIControlGroup() xbmc/guilib/GUIControlGroup.cpp:55:1
#24 0x56aa08758935 in CGUIControlGroup::ClearAll() xbmc/guilib/GUIControlGroup.cpp:525:5
#25 0x56aa08743bb9 in CGUIControlGroup::~CGUIControlGroup() xbmc/guilib/GUIControlGroup.cpp:56:3
#26 0x56aa08743c48 in CGUIControlGroup::~CGUIControlGroup() xbmc/guilib/GUIControlGroup.cpp:55:1
#27 0x56aa08758935 in CGUIControlGroup::ClearAll() xbmc/guilib/GUIControlGroup.cpp:525:5
#28 0x56aa08b9f39d in CGUIWindow::ClearAll() xbmc/guilib/GUIWindow.cpp:816:21
#29 0x56aa08b9ed97 in CGUIWindow::FreeResources(bool) xbmc/guilib/GUIWindow.cpp:799:53
#30 0x56aa08bf8e34 in CGUIWindowManager::DeInitialize() xbmc/guilib/GUIWindowManager.cpp:1452:14
#31 0x56aa09264d22 in CApplicationSkinHandling::UnloadSkin() xbmc/application/ApplicationSkinHandling.cpp:235:29
#32 0x56aa0925e0fd in CApplicationSkinHandling::LoadSkin(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) xbmc/application/ApplicationSkinHandling.cpp:111:3
#33 0x56aa0926a8e6 in CApplicationSkinHandling::ReloadSkin(bool) xbmc/application/ApplicationSkinHandling.cpp:390:7
#34 0x56aa0c635399 in ReloadSkin(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) xbmc/interfaces/builtins/SkinBuiltins.cpp:46:12
#35 0x56aa0c5a39e5 in CBuiltins::Execute(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) xbmc/interfaces/builtins/Builtins.cpp:158:14
#36 0x56aa0918597f in CApplication::ExecuteXBMCAction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::shared_ptr<CGUIListItem> const&) xbmc/application/Application.cpp:3037:32
#37 0x56aa09181b96 in CApplication::OnMessage(CGUIMessage&) xbmc/application/Application.cpp:3013:14
#38 0x56aa09186a20 in non-virtual thunk to CApplication::OnMessage(CGUIMessage&) xbmc/application/Application.cpp
#39 0x56aa08bd33e1 in CGUIWindowManager::SendMessage(CGUIMessage&) xbmc/guilib/GUIWindowManager.cpp:510:23
#40 0x56aa085d2502 in CGUIAction::ExecuteActions(int, int, std::shared_ptr<CGUIListItem> const&) const xbmc/guilib/GUIAction.cpp:89:52
#41 0x56aa084b7701 in CStaticListProvider::OnClick(std::shared_ptr<CGUIListItem> const&) xbmc/guilib/listproviders/StaticProvider.cpp:136:40
#42 0x56aa0862e065 in CGUIBaseContainer::OnClick(int) xbmc/guilib/GUIBaseContainer.cpp:881:27
#43 0x56aa0862b09c in CGUIBaseContainer::OnAction(CAction const&) xbmc/guilib/GUIBaseContainer.cpp:474:28
#44 0x56aa08c4bdf5 in CGUIWrappingListContainer::OnAction(CAction const&) xbmc/guilib/GUIWrappingListContainer.cpp:75:29
#45 0x56aa08b8f441 in CGUIWindow::OnAction(CAction const&) xbmc/guilib/GUIWindow.cpp:429:27
#46 0x56aa08bee00c in CGUIWindowManager::HandleAction(CAction const&) const xbmc/guilib/GUIWindowManager.cpp:1199:20
#47 0x56aa08bec973 in CGUIWindowManager::OnAction(CAction const&) const xbmc/guilib/GUIWindowManager.cpp:1144:11
#48 0x56aa0912be04 in CApplication::OnAction(CAction const&) xbmc/application/Application.cpp:913:54
#49 0x56aa0c914de1 in CInputManager::ExecuteInputAction(CAction const&) xbmc/input/InputManager.cpp:746:29
#50 0x56aa0c921842 in CInputManager::HandleKey(CKey const&) xbmc/input/InputManager.cpp:680:10
#51 0x56aa0c91c2ec in CInputManager::OnKeyUp(CKey const&) xbmc/input/InputManager.cpp:693:5
#52 0x56aa0c917737 in CInputManager::OnEvent(XBMC_Event&) xbmc/input/InputManager.cpp:361:7
#53 0x56aa090fe458 in CAppInboundProtocol::HandleEvents() xbmc/application/AppInboundProtocol.cpp:113:43
#54 0x56aa0915b240 in CApplication::FrameMove(bool, bool) xbmc/application/Application.cpp:1756:17
#55 0x56aa0915f200 in CApplication::Run() xbmc/application/Application.cpp:1860:7
#56 0x56aa0829c3e3 in XBMC_Run xbmc/platform/xbmc.cpp:61:26
#57 0x56aa04ecbfcf in main xbmc/platform/posix/main.cpp:70:16
#58 0x7517fb043ccf (/usr/lib/libc.so.6+0x25ccf) (BuildId: c0caa0b7709d3369ee575fcd7d7d0b0fc48733af)
previously allocated by thread T0 here:
#0 0x56aa04ec8ed2 in operator new(unsigned long) (/home/mark/Coding/Repos/kodi-git/build_clang_debug_sanitizer/kodi.bin+0xa44eed2) (BuildId: 7f84180dd757174de6de03b115843129667234d3)
#1 0x56aa084b3183 in CStaticListProvider::CStaticListProvider(TiXmlElement const*, int) xbmc/guilib/listproviders/StaticProvider.cpp:28:33
#2 0x56aa0849c590 in std::__detail::_MakeUniq<CStaticListProvider>::__single_object std::make_unique<CStaticListProvider, TiXmlElement const*, int&>(TiXmlElement const*&&, int&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/unique_ptr.h:1070:34
#3 0x56aa0849bac7 in IListProvider::CreateSingle(TiXmlNode const*, int) xbmc/guilib/listproviders/IListProvider.cpp:34:12
#4 0x56aa0849b582 in IListProvider::Create(TiXmlNode const*, int) xbmc/guilib/listproviders/IListProvider.cpp:25:12
#5 0x56aa0864bbe8 in CGUIBaseContainer::LoadListProvider(TiXmlElement*, int, bool) xbmc/guilib/GUIBaseContainer.cpp:1282:20
#6 0x56aa0871b1c3 in CGUIControlFactory::Create(int, CRectGen<float> const&, TiXmlElement*, bool) xbmc/guilib/GUIControlFactory.cpp:1543:17
#7 0x56aa08b884c4 in CGUIWindow::LoadControl(TiXmlElement*, CGUIControlGroup*, CRectGen<float> const&) xbmc/guilib/GUIWindow.cpp:281:38
#8 0x56aa08b8a088 in CGUIWindow::LoadControl(TiXmlElement*, CGUIControlGroup*, CRectGen<float> const&) xbmc/guilib/GUIWindow.cpp:309:9
#9 0x56aa08b8a088 in CGUIWindow::LoadControl(TiXmlElement*, CGUIControlGroup*, CRectGen<float> const&) xbmc/guilib/GUIWindow.cpp:309:9
#10 0x56aa08b8a088 in CGUIWindow::LoadControl(TiXmlElement*, CGUIControlGroup*, CRectGen<float> const&) xbmc/guilib/GUIWindow.cpp:309:9
#11 0x56aa08b8a088 in CGUIWindow::LoadControl(TiXmlElement*, CGUIControlGroup*, CRectGen<float> const&) xbmc/guilib/GUIWindow.cpp:309:9
#12 0x56aa08b87cf6 in CGUIWindow::Load(TiXmlElement*) xbmc/guilib/GUIWindow.cpp:264:11
#13 0x56aa08b80657 in CGUIWindow::LoadXML(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) xbmc/guilib/GUIWindow.cpp:155:10
#14 0x56aa08b7e6c0 in CGUIWindow::Load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool) xbmc/guilib/GUIWindow.cpp:109:14
#15 0x56aa08b9dc45 in CGUIWindow::AllocResources(bool) xbmc/guilib/GUIWindow.cpp:765:7
#16 0x56aa08b95df7 in CGUIWindow::OnMessage(CGUIMessage&) xbmc/guilib/GUIWindow.cpp:594:52
#17 0x56aa08be2521 in CGUIWindowManager::ActivateWindow_Internal(int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, bool, bool) xbmc/guilib/GUIWindowManager.cpp:896:15
#18 0x56aa08bddfbc in CGUIWindowManager::ActivateWindow(int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, bool, bool) xbmc/guilib/GUIWindowManager.cpp:802:5
#19 0x56aa0c5b75f3 in int (anonymous namespace)::ActivateWindow<false>(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) xbmc/interfaces/builtins/GUIBuiltins.cpp:109:52
#20 0x56aa0c5a39e5 in CBuiltins::Execute(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) xbmc/interfaces/builtins/Builtins.cpp:158:14
#21 0x56aa0918597f in CApplication::ExecuteXBMCAction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::shared_ptr<CGUIListItem> const&) xbmc/application/Application.cpp:3037:32
#22 0x56aa09181b96 in CApplication::OnMessage(CGUIMessage&) xbmc/application/Application.cpp:3013:14
#23 0x56aa09186a20 in non-virtual thunk to CApplication::OnMessage(CGUIMessage&) xbmc/application/Application.cpp
#24 0x56aa08bd33e1 in CGUIWindowManager::SendMessage(CGUIMessage&) xbmc/guilib/GUIWindowManager.cpp:510:23
#25 0x56aa085d2502 in CGUIAction::ExecuteActions(int, int, std::shared_ptr<CGUIListItem> const&) const xbmc/guilib/GUIAction.cpp:89:52
#26 0x56aa0867f896 in CGUIButtonControl::OnClick() xbmc/guilib/GUIButtonControl.cpp:393:16
#27 0x56aa08677e86 in CGUIButtonControl::OnAction(CAction const&) xbmc/guilib/GUIButtonControl.cpp:212:5
#28 0x56aa08b8f441 in CGUIWindow::OnAction(CAction const&) xbmc/guilib/GUIWindow.cpp:429:27
#29 0x56aa08bee00c in CGUIWindowManager::HandleAction(CAction const&) const xbmc/guilib/GUIWindowManager.cpp:1199:20
#30 0x56aa08bec973 in CGUIWindowManager::OnAction(CAction const&) const xbmc/guilib/GUIWindowManager.cpp:1144:11
#31 0x56aa0912be04 in CApplication::OnAction(CAction const&) xbmc/application/Application.cpp:913:54
#32 0x56aa0c914de1 in CInputManager::ExecuteInputAction(CAction const&) xbmc/input/InputManager.cpp:746:29
#33 0x56aa0c921842 in CInputManager::HandleKey(CKey const&) xbmc/input/InputManager.cpp:680:10
#34 0x56aa0c91c2ec in CInputManager::OnKeyUp(CKey const&) xbmc/input/InputManager.cpp:693:5
#35 0x56aa0c917737 in CInputManager::OnEvent(XBMC_Event&) xbmc/input/InputManager.cpp:361:7
#36 0x56aa090fe458 in CAppInboundProtocol::HandleEvents() xbmc/application/AppInboundProtocol.cpp:113:43
#37 0x56aa0915b240 in CApplication::FrameMove(bool, bool) xbmc/application/Application.cpp:1756:17
#38 0x56aa0915f200 in CApplication::Run() xbmc/application/Application.cpp:1860:7
#39 0x56aa0829c3e3 in XBMC_Run xbmc/platform/xbmc.cpp:61:26
#40 0x56aa04ecbfcf in main xbmc/platform/posix/main.cpp:70:16
#41 0x7517fb043ccf (/usr/lib/libc.so.6+0x25ccf) (BuildId: c0caa0b7709d3369ee575fcd7d7d0b0fc48733af)
SUMMARY: AddressSanitizer: heap-use-after-free xbmc/guilib/GUIAction.cpp:86:9 in CGUIAction::ExecuteActions(int, int, std::shared_ptr<CGUIListItem> const&) const
Shadow bytes around the buggy address:
0x51800050b900: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x51800050b980: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x51800050ba00: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x51800050ba80: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x51800050bb00: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x51800050bb80: fd fd fd fd fd fd fd fd fd fd fd fd fd[fd]fa fa
0x51800050bc00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x51800050bc80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x51800050bd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x51800050bd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x51800050be00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==30885==ABORTING
(cherry picked from commit 9e4cfd2d174bd939191d64e1788835a00ffcb28f)
---
xbmc/guilib/GUIBaseContainer.cpp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/xbmc/guilib/GUIBaseContainer.cpp b/xbmc/guilib/GUIBaseContainer.cpp
index c22eb71284f27..897459790dd76 100644
--- a/xbmc/guilib/GUIBaseContainer.cpp
+++ b/xbmc/guilib/GUIBaseContainer.cpp
@@ -13,6 +13,7 @@
#include "GUIListItemLayout.h"
#include "GUIMessage.h"
#include "ServiceBroker.h"
+#include "guilib/GUIListItem.h"
#include "guilib/guiinfo/GUIInfoLabels.h"
#include "guilib/listproviders/IListProvider.h"
#include "input/actions/Action.h"
@@ -875,10 +876,16 @@ bool CGUIBaseContainer::OnClick(int actionID)
int selected = GetSelectedItem();
if (selected >= 0 && selected < static_cast<int>(m_items.size()))
{
+ // One of the actions could trigger a reload of the GUI which destroys
+ // this CGUIBaseContainer and therefore the m_items[selected] we are
+ // going to process. The shared_ptr ensures that item survives until
+ // it has been processed.
+ std::shared_ptr<CGUIListItem> item = m_items[selected];
+
if (m_clickActions.HasActionsMeetingCondition())
- m_clickActions.ExecuteActions(0, GetParentID(), m_items[selected]);
+ m_clickActions.ExecuteActions(0, GetParentID(), item);
else
- m_listProvider->OnClick(m_items[selected]);
+ m_listProvider->OnClick(item);
}
return true;
}

View File

@@ -1,482 +0,0 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# FFmpeg can be unbundled, but is currently stuck at a very old version.
# libdvd{css,read,nav} are not unbundlable without patching the buildsystem.
# Versions for the forked projects that are bundled
# See tools/depends/target/<project>/<project>-VERSION
LIBDVDCSS_VERSION="1.4.3-Next-Nexus-Alpha2-2"
LIBDVDREAD_VERSION="6.1.3-Next-Nexus-Alpha2-2"
LIBDVDNAV_VERSION="6.1.1-Next-Nexus-Alpha2-2"
FFMPEG_VERSION="4.4.1"
CODENAME="Nexus"
FFMPEG_KODI_VERSION="Alpha1"
# Doesn't build with jdk-21
_JAVA_PKG_WANT_BUILD_VM=( {openjdk{,-jre},icedtea}{,-bin}-{8,11,17} )
JAVA_PKG_WANT_BUILD_VM=${_JAVA_PKG_WANT_BUILD_VM[@]}
# Required to be set, but not used.
JAVA_PKG_WANT_SOURCE="17"
JAVA_PKG_WANT_TARGET="17"
PYTHON_REQ_USE="sqlite,ssl"
PYTHON_COMPAT=( python3_{10..11} ) # python3.12 support added in 21
CPU_FLAGS="cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 cpu_flags_x86_sse4_1 cpu_flags_x86_sse4_2 cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_arm_neon"
inherit cmake desktop flag-o-matic java-pkg-2 linux-info optfeature pax-utils python-single-r1 xdg
DESCRIPTION="A free and open source media-player and entertainment hub"
HOMEPAGE="https://kodi.tv/"
SRC_URI="
https://github.com/xbmc/libdvdnav/archive/${LIBDVDNAV_VERSION}.tar.gz
-> libdvdnav-${LIBDVDNAV_VERSION}.tar.gz
https://github.com/xbmc/libdvdread/archive/${LIBDVDREAD_VERSION}.tar.gz
-> libdvdread-${LIBDVDREAD_VERSION}.tar.gz
css? (
https://github.com/xbmc/libdvdcss/archive/${LIBDVDCSS_VERSION}.tar.gz
-> libdvdcss-${LIBDVDCSS_VERSION}.tar.gz
)
!system-ffmpeg? (
https://github.com/xbmc/FFmpeg/archive/${FFMPEG_VERSION}-${CODENAME}-${FFMPEG_KODI_VERSION}.tar.gz
-> ffmpeg-${PN}-${FFMPEG_VERSION}-${CODENAME}-${FFMPEG_KODI_VERSION}.tar.gz
)
"
if [[ ${PV} == *9999 ]] ; then
EGIT_REPO_URI="https://github.com/xbmc/xbmc.git"
if [[ ${PV} != "9999" ]]; then
EGIT_BRANCH="${CODENAME}"
fi
inherit git-r3
else
MY_PV=${PV/_p/_r}
MY_PV=${MY_PV/_alpha/a}
MY_PV=${MY_PV/_beta/b}
MY_PV=${MY_PV/_rc/RC}
MY_PV="${MY_PV}-${CODENAME}"
MY_P="${PN}-${MY_PV}"
SRC_URI+=" https://github.com/xbmc/xbmc/archive/${MY_PV}.tar.gz -> ${MY_P}.tar.gz"
KEYWORDS="~amd64 ~arm ~arm64 ~x86"
S=${WORKDIR}/xbmc-${MY_PV}
fi
LICENSE="GPL-2+"
SLOT="0"
# use flag is called libusb so that it doesn't fool people in thinking that
# it is _required_ for USB support. Otherwise they'll disable udev and
# that's going to be worse.
IUSE="airplay alsa bluetooth bluray caps cec +css dbus doc eventclients gbm gles lcms libusb lirc mariadb mysql nfs +optical pipewire pulseaudio raspberry-pi samba system-ffmpeg test udf udev upnp vaapi vdpau wayland webserver X +xslt zeroconf ${CPU_FLAGS}"
REQUIRED_USE="
${PYTHON_REQUIRED_USE}
^^ ( gbm wayland X )
?? ( mariadb mysql )
bluray? ( udf )
gbm? ( udev )
udev? ( !libusb )
vdpau? ( X !gles !gbm )
zeroconf? ( dbus )
"
RESTRICT="!test? ( test )"
# dev-libs/libcec[-cubox] bug #818262
COMMON_DEPEND="
>=dev-libs/flatbuffers-1.12.0:=
>=dev-libs/lzo-2.04:2
media-libs/giflib:=
>=media-libs/libjpeg-turbo-2.0.4:=
>=media-libs/libpng-1.6.26:0=
wayland? (
dev-cpp/waylandpp:=
)
"
COMMON_TARGET_DEPEND="${PYTHON_DEPS}
>=net-misc/curl-7.68.0[http2]
>=sys-libs/zlib-1.2.11
dev-db/sqlite:3
dev-libs/crossguid
>=dev-libs/fribidi-1.0.5
>=dev-libs/libcdio-2.1.0:=[cxx]
>=dev-libs/libfmt-6.1.2:=
dev-libs/libfstrcmp
dev-libs/libpcre[cxx]
>=dev-libs/openssl-1.1.1k:0=
>=dev-libs/spdlog-1.5.0:=
dev-libs/tinyxml[stl]
media-fonts/roboto
media-libs/libglvnd[X?]
>=media-libs/freetype-2.10.1
media-libs/harfbuzz:=
>=media-libs/libass-0.13.4:=
media-libs/mesa[egl(+),gbm(+)?,wayland?,X?]
>=media-libs/taglib-1.9.0
sci-libs/kissfft
virtual/libiconv
virtual/ttf-fonts
x11-libs/libdrm
$(python_gen_cond_dep '
dev-python/pillow[${PYTHON_USEDEP}]
dev-python/pycryptodome[${PYTHON_USEDEP}]
')
airplay? (
>=app-pda/libplist-2.0.0:=
net-libs/shairplay
)
alsa? (
>=media-libs/alsa-lib-1.1.4.1
)
bluetooth? (
net-wireless/bluez:=
)
bluray? (
>=media-libs/libbluray-1.1.2:=
)
caps? (
sys-libs/libcap
)
cec? (
>=dev-libs/libcec-4.0[-cubox,raspberry-pi?]
)
dbus? (
sys-apps/dbus
)
gbm? (
>=dev-libs/libinput-1.10.5:=
x11-libs/libxkbcommon
)
gles? (
!raspberry-pi? (
media-libs/mesa[gles2]
)
)
!gles? (
media-libs/glu
)
lcms? (
>=media-libs/lcms-2.10:2
)
libusb? (
virtual/libusb:1
)
lirc? (
app-misc/lirc
)
mariadb? (
dev-db/mariadb-connector-c:=
)
mysql? (
dev-db/mysql-connector-c:=
)
nfs? (
>=net-fs/libnfs-2.0.0:=
)
pipewire? (
>=media-video/pipewire-0.3.24:=
)
pulseaudio? (
media-libs/libpulse
)
raspberry-pi? (
|| (
media-libs/raspberrypi-userland
media-libs/raspberrypi-userland-bin
media-libs/mesa[gles2,video_cards_vc4]
)
)
samba? (
>=net-fs/samba-3.4.6[smbclient(+)]
)
system-ffmpeg? (
media-video/ffmpeg:=[openssl,encode,postproc,vaapi?,vdpau?,X?]
)
!system-ffmpeg? (
app-arch/bzip2
media-libs/dav1d:=
)
udf? (
>=dev-libs/libudfread-1.0.0
)
udev? (
virtual/libudev:=
)
vaapi? (
media-libs/libva:=[wayland?,X?]
)
vdpau? (
|| (
>=x11-libs/libvdpau-1.1
>=x11-drivers/nvidia-drivers-180.51
)
)
wayland? (
>=x11-libs/libxkbcommon-0.4.1[wayland]
)
webserver? (
>=net-libs/libmicrohttpd-0.9.55:=[messages(+)]
)
X? (
x11-libs/libX11
x11-libs/libXext
x11-libs/libXrandr
)
xslt? (
dev-libs/libxslt
>=dev-libs/libxml2-2.9.4
)
zeroconf? (
net-dns/avahi[dbus]
)
"
RDEPEND="
${COMMON_DEPEND}
${COMMON_TARGET_DEPEND}
"
DEPEND="
${COMMON_DEPEND}
${COMMON_TARGET_DEPEND}
dev-libs/rapidjson
test? (
>=dev-cpp/gtest-1.10.0
)
wayland? (
>=dev-libs/wayland-protocols-1.7
)
X? (
x11-base/xorg-proto
x11-libs/libXrender
)
"
BDEPEND="
${COMMON_DEPEND}
dev-build/cmake
dev-lang/swig
virtual/pkgconfig
<=virtual/jre-17:*
doc? (
app-text/doxygen
)
"
# bug #544020
CONFIG_CHECK="~IP_MULTICAST"
ERROR_IP_MULTICAST="
In some cases Kodi needs to access multicast addresses.
Please consider enabling IP_MULTICAST under Networking options.
"
PATCHES=(
"${FILESDIR}"/${P}-VideoPlayerAudio-invalidate-previous-sync-type-after-Audio.patch
"${FILESDIR}"/${P}-CDVDInputStreamFile-use-64K-read-chunk-size-when-filesystem.patch
"${FILESDIR}"/${P}-swig-4.2.patch
"${FILESDIR}"/${P}-binutils-2.41.patch
)
pkg_setup() {
check_extra_config
java-pkg-2_pkg_setup
python-single-r1_pkg_setup
}
src_unpack() {
if [[ ${PV} == *9999 ]] ; then
git-r3_src_unpack
else
unpack ${MY_P}.tar.gz
fi
}
src_prepare() {
cmake_src_prepare
# avoid long delays when powerkit isn't running #348580
sed -i \
-e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \
xbmc/platform/linux/*.cpp || die
# Add all possible names for kissfft libraries
for datatype in {float,int16,int32,simd}; do
sed -i \
-e "s/\(find_library(KISSFFT_LIBRARY NAMES .*\)/\1 kissfft-${datatype} kissfft-${datatype}-openmp/" \
cmake/modules/FindKissFFT.cmake || die
done
if use system-ffmpeg; then
eapply "${FILESDIR}"/${P}-ffmpeg5.patch
eapply "${FILESDIR}"/${P}-ffmpeg6.patch
eapply "${FILESDIR}"/${P}-fix-crash-in-avcodec_parameters_from_context.patch
eapply "${FILESDIR}"/${P}-smart_ptr-and-custom-destructor-for-AVCodecParameters.patch
fi
}
src_configure() {
local mycmakeargs=(
-Wno-dev # less noise
-DAPP_RENDER_SYSTEM=$(usex gles gles gl)
-DCORE_PLATFORM_NAME=$(usev gbm)$(usev wayland)$(usev X x11)
-Ddocdir="${EPREFIX}/usr/share/doc/${PF}"
-DENABLE_TESTING=$(usex test)
-DVERBOSE=ON
# Enforce use of configured python interpeter
-DPYTHON_PATH=$(python_get_library_path)
-DPYTHON_VER=${EPYTHON##python} # wont work for pypy
# Toolchain
-DENABLE_CCACHE=OFF
-DENABLE_CLANGFORMAT=OFF
-DENABLE_CLANGTIDY=OFF
-DENABLE_CPPCHECK=OFF
-DENABLE_INCLUDEWHATYOUUSE=OFF
# https://bugs.gentoo.org/show_bug.cgi?id=606124
-DENABLE_GOLD=OFF
-DENABLE_LLD=OFF
-DENABLE_MOLD=OFF
-DUSE_LTO=OFF
# Features
-DENABLE_AIRTUNES=$(usex airplay)
-DENABLE_ALSA=$(usex alsa)
-DENABLE_AVAHI=$(usex zeroconf)
-DENABLE_BLUETOOTH=$(usex bluetooth)
-DENABLE_BLURAY=$(usex bluray)
-DENABLE_CAP=$(usex caps)
-DENABLE_CEC=$(usex cec)
-DENABLE_DBUS=$(usex dbus)
-DENABLE_DVDCSS=$(usex css)
-DENABLE_EVENTCLIENTS=ON # alway enable to have 'kodi-send' and filter extra staff in 'src_install()'
-DENABLE_ISO9660PP=$(usex optical)
-DENABLE_LCMS2=$(usex lcms)
-DENABLE_LIRCCLIENT=$(usex lirc)
-DENABLE_MARIADBCLIENT=$(usex mariadb)
-DENABLE_MDNS=OFF # used only on Android
-DENABLE_MICROHTTPD=$(usex webserver)
-DENABLE_MYSQLCLIENT=$(usex mysql)
-DENABLE_NFS=$(usex nfs)
-DENABLE_OPENGL=$(usex !gles)
-DENABLE_OPENGLES=$(usex gles)
-DENABLE_OPTICAL=$(usex optical)
-DENABLE_PIPEWIRE=$(usex pipewire)
-DENABLE_PLIST=$(usex airplay)
-DENABLE_PULSEAUDIO=$(usex pulseaudio)
-DENABLE_SMBCLIENT=$(usex samba)
-DENABLE_SNDIO=OFF
-DENABLE_UDEV=$(usex udev)
-DENABLE_UDFREAD=$(usex udf)
-DENABLE_UPNP=$(usex upnp)
-DENABLE_VAAPI=$(usex vaapi)
-DENABLE_VDPAU=$(usex vdpau)
-DENABLE_XSLT=$(usex xslt)
#To bundle or not
-DENABLE_INTERNAL_CROSSGUID=OFF
-DENABLE_INTERNAL_DAV1D=OFF
-DENABLE_INTERNAL_FFMPEG="$(usex !system-ffmpeg)"
-DENABLE_INTERNAL_FLATBUFFERS=OFF
-DENABLE_INTERNAL_FMT=OFF
-DENABLE_INTERNAL_FSTRCMP=OFF
-DENABLE_INTERNAL_GTEST=OFF
-DENABLE_INTERNAL_KISSFFT=OFF
-DENABLE_INTERNAL_PCRE=OFF
-DENABLE_INTERNAL_RapidJSON=OFF
-DENABLE_INTERNAL_SPDLOG=OFF
-DENABLE_INTERNAL_TAGLIB=OFF
-DENABLE_INTERNAL_UDFREAD=OFF
-DWITH_FFMPEG=$(usex system-ffmpeg)
-Dlibdvdnav_URL="${DISTDIR}/libdvdnav-${LIBDVDNAV_VERSION}.tar.gz"
-Dlibdvdread_URL="${DISTDIR}/libdvdread-${LIBDVDREAD_VERSION}.tar.gz"
)
# Separated to avoid "Manually-specified variables were not used by the project:"
use css && mycmakeargs+=( -Dlibdvdcss_URL="${DISTDIR}/libdvdcss-${LIBDVDCSS_VERSION}.tar.gz" )
use !system-ffmpeg && mycmakeargs+=(
-DFFMPEG_URL="${DISTDIR}/ffmpeg-${PN}-${FFMPEG_VERSION}-${CODENAME}-${FFMPEG_KODI_VERSION}.tar.gz"
)
use nfs && mycmakeargs+=( -DENABLE_INTERNAL_NFS=OFF )
use !udev && mycmakeargs+=( -DENABLE_LIBUSB=$(usex libusb) )
use X && use !gles && mycmakeargs+=( -DENABLE_GLX=ON )
for flag in ${CPU_FLAGS[@]} ; do
local name=${flag#cpu_flags_*_}
mycmakeargs+=( -DENABLE_${name^^}=$(usex ${flag}) )
done
if ! is-flag -DNDEBUG && ! is-flag -D_DEBUG ; then
# Kodi requires one of the 'NDEBUG' or '_DEBUG' defines
append-cflags -DNDEBUG
append-cxxflags -DNDEBUG
fi
# Violates ODR (bug #860984) and USE_LTO does spooky stuff
# https://github.com/xbmc/xbmc/commit/cb72a22d54a91845b1092c295f84eeb48328921e
filter-lto
cmake_src_configure
}
src_compile() {
cmake_src_compile all
use doc && cmake_build doc
use test && cmake_build kodi-test
}
src_test() {
local -x CMAKE_SKIP_TESTS=(
# Known failing, unreliable test
# bug #743938
TestCPUInfo.GetCPUFrequency
# Test failure stemming from sci-libs/kissfft
# The difference between output[2i] and (i==freq1?1.0:0.0) is inf, which exceeds 1e-7, where output[2i]
# evaluates to inf,(i==freq1?1.0:0.0) evaluates to 0, and 1e-7 evaluates to 9.9999999999999995e-08.
TestRFFT.SimpleSignal
# bug #779184
# https://github.com/xbmc/xbmc/issues/18594
$(usev x86 TestDateTime.SetFromDBTime)
)
# see https://github.com/xbmc/xbmc/issues/17860#issuecomment-630120213
local -x KODI_HOME="${BUILD_DIR}"
cmake_src_test
}
src_install() {
cmake_src_install
# bug #457588
pax-mark Em "${ED}"/usr/$(get_libdir)/${PN}/${PN}.bin
newicon media/icon48x48.png kodi.png
rm "${ED}"/usr/share/kodi/addons/skin.estuary/fonts/Roboto-Thin.ttf || die
dosym ../../../../fonts/roboto/Roboto-Thin.ttf \
usr/share/kodi/addons/skin.estuary/fonts/Roboto-Thin.ttf
if use !eventclients ; then
rm -f "${ED}"/usr/bin/kodi-ps3remote || die
rm -f "${D}"$(python_get_sitedir)/kodi/ps3_remote.py || die
rm -rf "${D}"$(python_get_sitedir)/kodi/ps3 || die
rm -rf "${D}"$(python_get_sitedir)/kodi/bt || die
rm -rf "${ED}"/usr/share/doc/${PF}/kodi-eventclients-dev || die
fi
python_optimize "${D}$(python_get_sitedir)"
einstalldocs
use doc && dodoc -r "${S}"/docs/html/
}
pkg_postinst() {
xdg_pkg_postinst
if use dbus ; then
optfeature "getting battery level and active power source" sys-power/upower
optfeature "control of shutdown, reboot, suspend, and hibernate" sys-auth/elogind sys-apps/systemd
optfeature "storage management support (automounting, volume monitoring, etc)" sys-fs/udisks:2
fi
}

View File

@@ -1,490 +0,0 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# FFmpeg can be unbundled, but is currently stuck at a very old version.
# libdvd{css,read,nav} are not unbundlable without patching the buildsystem.
# Versions for the forked projects that are bundled
# See tools/depends/target/<project>/<project>-VERSION
APACHE_COMMONS_LANG_VERSION="3.14.0"
APACHE_COMMONS_TEXT_VERSION="1.11.0"
FFMPEG_VERSION="6.0.1"
GROOVY_VERSION="4.0.16"
LIBDVDCSS_VERSION="1.4.3-Next-Nexus-Alpha2-2"
LIBDVDREAD_VERSION="6.1.3-Next-Nexus-Alpha2-2"
LIBDVDNAV_VERSION="6.1.1-Next-Nexus-Alpha2-2"
CODENAME="Omega"
# Doesn't build with jdk-21
_JAVA_PKG_WANT_BUILD_VM=( {openjdk{,-jre},icedtea}{,-bin}-{8,11,17} )
JAVA_PKG_WANT_BUILD_VM=${_JAVA_PKG_WANT_BUILD_VM[@]}
# Required to be set, but not used.
JAVA_PKG_WANT_SOURCE="17"
JAVA_PKG_WANT_TARGET="17"
PYTHON_REQ_USE="sqlite,ssl"
PYTHON_COMPAT=( python3_{10..12} )
CPU_FLAGS="cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 cpu_flags_x86_sse4_1 cpu_flags_x86_sse4_2 cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_arm_neon"
inherit cmake desktop flag-o-matic java-pkg-2 linux-info optfeature pax-utils python-single-r1 xdg
DESCRIPTION="A free and open source media-player and entertainment hub"
HOMEPAGE="https://kodi.tv/"
SRC_URI="
http://mirrors.kodi.tv/build-deps/sources/apache-groovy-binary-${GROOVY_VERSION}.zip
-> apache-groovy-binary-${GROOVY_VERSION}.zip
http://mirrors.kodi.tv/build-deps/sources/commons-lang3-${APACHE_COMMONS_LANG_VERSION}-bin.tar.gz
-> commons-lang3-${APACHE_COMMONS_LANG_VERSION}-bin.tar.gz
http://mirrors.kodi.tv/build-deps/sources/commons-text-${APACHE_COMMONS_TEXT_VERSION}-bin.tar.gz
-> commons-text-${APACHE_COMMONS_TEXT_VERSION}-bin.tar.gz
https://github.com/xbmc/libdvdnav/archive/${LIBDVDNAV_VERSION}.tar.gz
-> libdvdnav-${LIBDVDNAV_VERSION}.tar.gz
https://github.com/xbmc/libdvdread/archive/${LIBDVDREAD_VERSION}.tar.gz
-> libdvdread-${LIBDVDREAD_VERSION}.tar.gz
css? (
https://github.com/xbmc/libdvdcss/archive/${LIBDVDCSS_VERSION}.tar.gz
-> libdvdcss-${LIBDVDCSS_VERSION}.tar.gz
)
!system-ffmpeg? (
https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz
-> ffmpeg-${PN}-${FFMPEG_VERSION}-${CODENAME}.tar.gz
)
"
if [[ ${PV} == *9999 ]] ; then
EGIT_REPO_URI="https://github.com/xbmc/xbmc.git"
if [[ ${PV} != "9999" ]]; then
EGIT_BRANCH="${CODENAME}"
fi
inherit git-r3
else
MY_PV=${PV/_p/_r}
MY_PV=${MY_PV/_alpha/a}
MY_PV=${MY_PV/_beta/b}
MY_PV=${MY_PV/_rc/RC}
MY_PV="${MY_PV}-${CODENAME}"
MY_P="${PN}-${MY_PV}"
SRC_URI+=" https://github.com/xbmc/xbmc/archive/${MY_PV}.tar.gz -> ${MY_P}.tar.gz"
KEYWORDS="~amd64 ~arm ~arm64 ~x86"
S=${WORKDIR}/xbmc-${MY_PV}
fi
LICENSE="GPL-2+"
SLOT="0"
# use flag is called libusb so that it doesn't fool people in thinking that
# it is _required_ for USB support. Otherwise they'll disable udev and
# that's going to be worse.
IUSE="airplay alsa bluetooth bluray caps cec +css dbus doc eventclients gbm gles lcms libusb lirc mariadb mysql nfs +optical pipewire pulseaudio raspberry-pi samba system-ffmpeg test udf udev upnp vaapi vdpau wayland webserver X +xslt zeroconf ${CPU_FLAGS}"
REQUIRED_USE="
${PYTHON_REQUIRED_USE}
^^ ( gbm wayland X )
?? ( mariadb mysql )
bluray? ( udf )
gbm? ( udev )
udev? ( !libusb )
vdpau? ( X !gles !gbm )
zeroconf? ( dbus )
"
RESTRICT="!test? ( test )"
# dev-libs/libcec[-cubox] bug #818262
COMMON_DEPEND="
>=dev-libs/flatbuffers-1.12.0:=
>=dev-libs/lzo-2.04:2
media-libs/giflib:=
>=media-libs/libjpeg-turbo-2.0.4:=
>=media-libs/libpng-1.6.26:0=
wayland? (
dev-cpp/waylandpp:=
)
"
COMMON_TARGET_DEPEND="${PYTHON_DEPS}
>=net-misc/curl-7.68.0[http2]
>=sys-libs/zlib-1.2.11
dev-db/sqlite:3
dev-libs/crossguid
>=dev-libs/fribidi-1.0.5
>=dev-libs/libcdio-2.1.0:=[cxx]
>=dev-libs/libfmt-6.1.2:=
dev-libs/libfstrcmp
dev-libs/libpcre[cxx]
>=dev-libs/openssl-1.1.1k:0=
>=dev-libs/spdlog-1.5.0:=
dev-libs/tinyxml[stl]
>=dev-libs/tinyxml2-9.0.0:=
media-fonts/roboto
media-libs/libglvnd[X?]
>=media-libs/freetype-2.10.1
media-libs/harfbuzz:=
>=media-libs/libass-0.13.4:=
media-libs/mesa[egl(+),gbm(+)?,wayland?,X?]
>=media-libs/taglib-1.9.0
sci-libs/kissfft
virtual/libiconv
virtual/ttf-fonts
x11-libs/libdrm
$(python_gen_cond_dep '
dev-python/pillow[${PYTHON_USEDEP}]
dev-python/pycryptodome[${PYTHON_USEDEP}]
')
airplay? (
>=app-pda/libplist-2.0.0:=
net-libs/shairplay
)
alsa? (
>=media-libs/alsa-lib-1.1.4.1
)
bluetooth? (
net-wireless/bluez:=
)
bluray? (
>=media-libs/libbluray-1.1.2:=
)
caps? (
sys-libs/libcap
)
cec? (
>=dev-libs/libcec-4.0[-cubox,raspberry-pi?]
)
dbus? (
sys-apps/dbus
)
gbm? (
>=dev-libs/libinput-1.10.5:=
x11-libs/libxkbcommon
)
gles? (
!raspberry-pi? (
media-libs/mesa[gles2]
)
)
!gles? (
media-libs/glu
)
lcms? (
>=media-libs/lcms-2.10:2
)
libusb? (
virtual/libusb:1
)
lirc? (
app-misc/lirc
)
mariadb? (
dev-db/mariadb-connector-c:=
)
mysql? (
dev-db/mysql-connector-c:=
)
nfs? (
>=net-fs/libnfs-2.0.0:=
)
pipewire? (
>=media-video/pipewire-0.3.24:=
)
pulseaudio? (
media-libs/libpulse
)
raspberry-pi? (
|| (
media-libs/raspberrypi-userland
media-libs/raspberrypi-userland-bin
media-libs/mesa[gles2,video_cards_vc4]
)
)
samba? (
>=net-fs/samba-3.4.6[smbclient(+)]
)
system-ffmpeg? (
media-video/ffmpeg:=[openssl,encode,postproc,vaapi?,vdpau?,X?]
)
!system-ffmpeg? (
app-arch/bzip2
media-libs/dav1d:=
)
udf? (
>=dev-libs/libudfread-1.0.0
)
udev? (
virtual/libudev:=
)
vaapi? (
media-libs/libva:=[wayland?,X?]
)
vdpau? (
|| (
>=x11-libs/libvdpau-1.1
>=x11-drivers/nvidia-drivers-180.51
)
)
wayland? (
>=x11-libs/libxkbcommon-0.4.1[wayland]
)
webserver? (
>=net-libs/libmicrohttpd-0.9.55:=[messages(+)]
)
X? (
x11-libs/libX11
x11-libs/libXext
x11-libs/libXrandr
)
xslt? (
dev-libs/libxslt
>=dev-libs/libxml2-2.9.4
)
zeroconf? (
net-dns/avahi[dbus]
)
"
RDEPEND="
${COMMON_DEPEND}
${COMMON_TARGET_DEPEND}
"
DEPEND="
${COMMON_DEPEND}
${COMMON_TARGET_DEPEND}
dev-libs/rapidjson
test? (
>=dev-cpp/gtest-1.10.0
)
wayland? (
>=dev-libs/wayland-protocols-1.7
)
X? (
x11-base/xorg-proto
x11-libs/libXrender
)
"
BDEPEND="
${COMMON_DEPEND}
dev-build/cmake
dev-lang/swig
virtual/pkgconfig
<=virtual/jre-17:*
doc? (
app-text/doxygen
)
"
# bug #544020
CONFIG_CHECK="~IP_MULTICAST"
ERROR_IP_MULTICAST="
In some cases Kodi needs to access multicast addresses.
Please consider enabling IP_MULTICAST under Networking options.
"
PATCHES=(
"${FILESDIR}/${P}-fix-head-use-after-free.patch"
)
pkg_setup() {
check_extra_config
java-pkg-2_pkg_setup
python-single-r1_pkg_setup
}
src_unpack() {
if [[ ${PV} == *9999 ]] ; then
git-r3_src_unpack
else
unpack ${MY_P}.tar.gz
fi
unpack apache-groovy-binary-${GROOVY_VERSION}.zip
unpack commons-lang3-${APACHE_COMMONS_LANG_VERSION}-bin.tar.gz
unpack commons-text-${APACHE_COMMONS_TEXT_VERSION}-bin.tar.gz
}
src_prepare() {
cmake_src_prepare
# avoid long delays when powerkit isn't running #348580
sed -i \
-e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \
xbmc/platform/linux/*.cpp || die
# Add all possible names for kissfft libraries
for datatype in {float,int16,int32,simd}; do
sed -i \
-e "s/\(find_library(KISSFFT_LIBRARY NAMES .*\)/\1 kissfft-${datatype} kissfft-${datatype}-openmp/" \
cmake/modules/FindKissFFT.cmake || die
done
}
src_configure() {
local mycmakeargs=(
-Wno-dev # less noise
-DAPP_RENDER_SYSTEM=$(usex gles gles gl)
-DCORE_PLATFORM_NAME=$(usev gbm)$(usev wayland)$(usev X x11)
-Ddocdir="${EPREFIX}/usr/share/doc/${PF}"
-DENABLE_TESTING=$(usex test)
-DVERBOSE=ON
# Enforce use of configured python interpeter
-DPYTHON_PATH=$(python_get_library_path)
-DPYTHON_VER=${EPYTHON##python} # wont work for pypy
# Toolchain
-DENABLE_CCACHE=OFF
-DENABLE_CLANGFORMAT=OFF
-DENABLE_CLANGTIDY=OFF
-DENABLE_CPPCHECK=OFF
-DENABLE_INCLUDEWHATYOUUSE=OFF
# https://bugs.gentoo.org/show_bug.cgi?id=606124
-DENABLE_GOLD=OFF
-DENABLE_LLD=OFF
-DENABLE_MOLD=OFF
-DUSE_LTO=OFF
# Features
-DENABLE_AIRTUNES=$(usex airplay)
-DENABLE_ALSA=$(usex alsa)
-DENABLE_AVAHI=$(usex zeroconf)
-DENABLE_BLUETOOTH=$(usex bluetooth)
-DENABLE_BLURAY=$(usex bluray)
-DENABLE_CAP=$(usex caps)
-DENABLE_CEC=$(usex cec)
-DENABLE_DBUS=$(usex dbus)
-DENABLE_DVDCSS=$(usex css)
-DENABLE_EVENTCLIENTS=ON # alway enable to have 'kodi-send' and filter extra staff in 'src_install()'
-DENABLE_ISO9660PP=$(usex optical)
-DENABLE_LCMS2=$(usex lcms)
-DENABLE_LIRCCLIENT=$(usex lirc)
-DENABLE_MARIADBCLIENT=$(usex mariadb)
-DENABLE_MDNS=OFF # used only on Android
-DENABLE_MICROHTTPD=$(usex webserver)
-DENABLE_MYSQLCLIENT=$(usex mysql)
-DENABLE_NFS=$(usex nfs)
-DENABLE_OPENGL=$(usex !gles)
-DENABLE_OPENGLES=$(usex gles)
-DENABLE_OPTICAL=$(usex optical)
-DENABLE_PIPEWIRE=$(usex pipewire)
-DENABLE_PLIST=$(usex airplay)
-DENABLE_PULSEAUDIO=$(usex pulseaudio)
-DENABLE_SMBCLIENT=$(usex samba)
-DENABLE_SNDIO=OFF
-DENABLE_UDEV=$(usex udev)
-DENABLE_UDFREAD=$(usex udf)
-DENABLE_UPNP=$(usex upnp)
-DENABLE_VAAPI=$(usex vaapi)
-DENABLE_VDPAU=$(usex vdpau)
-DENABLE_XSLT=$(usex xslt)
#To bundle or not
-DENABLE_INTERNAL_CROSSGUID=OFF
-DENABLE_INTERNAL_DAV1D=OFF
-DENABLE_INTERNAL_FFMPEG="$(usex !system-ffmpeg)"
-DENABLE_INTERNAL_FLATBUFFERS=OFF
-DENABLE_INTERNAL_FMT=OFF
-DENABLE_INTERNAL_FSTRCMP=OFF
-DENABLE_INTERNAL_GTEST=OFF
-DENABLE_INTERNAL_KISSFFT=OFF
-DENABLE_INTERNAL_PCRE=OFF
-DENABLE_INTERNAL_RapidJSON=OFF
-DENABLE_INTERNAL_SPDLOG=OFF
-DENABLE_INTERNAL_TAGLIB=OFF
-DENABLE_INTERNAL_UDFREAD=OFF
-DWITH_FFMPEG=$(usex system-ffmpeg)
-Dlibdvdnav_URL="${DISTDIR}/libdvdnav-${LIBDVDNAV_VERSION}.tar.gz"
-Dlibdvdread_URL="${DISTDIR}/libdvdread-${LIBDVDREAD_VERSION}.tar.gz"
-Dgroovy_SOURCE_DIR="${WORKDIR}/groovy-${GROOVY_VERSION}"
-Dapache-commons-lang_SOURCE_DIR="${WORKDIR}/commons-lang3-${APACHE_COMMONS_LANG_VERSION}"
-Dapache-commons-text_SOURCE_DIR="${WORKDIR}/commons-text-${APACHE_COMMONS_TEXT_VERSION}"
)
# Separated to avoid "Manually-specified variables were not used by the project:"
use css && mycmakeargs+=( -Dlibdvdcss_URL="${DISTDIR}/libdvdcss-${LIBDVDCSS_VERSION}.tar.gz" )
use !system-ffmpeg && mycmakeargs+=(
-DFFMPEG_URL="${DISTDIR}/ffmpeg-${PN}-${FFMPEG_VERSION}-${CODENAME}.tar.gz"
)
use nfs && mycmakeargs+=( -DENABLE_INTERNAL_NFS=OFF )
use !udev && mycmakeargs+=( -DENABLE_LIBUSB=$(usex libusb) )
use X && use !gles && mycmakeargs+=( -DENABLE_GLX=ON )
for flag in ${CPU_FLAGS[@]} ; do
local name=${flag#cpu_flags_*_}
mycmakeargs+=( -DENABLE_${name^^}=$(usex ${flag}) )
done
if ! is-flag -DNDEBUG && ! is-flag -D_DEBUG ; then
# Kodi requires one of the 'NDEBUG' or '_DEBUG' defines
append-cflags -DNDEBUG
append-cxxflags -DNDEBUG
fi
# Violates ODR (bug #860984) and USE_LTO does spooky stuff
# https://github.com/xbmc/xbmc/commit/cb72a22d54a91845b1092c295f84eeb48328921e
filter-lto
cmake_src_configure
}
src_compile() {
cmake_src_compile all
use doc && cmake_build doc
use test && cmake_build kodi-test
}
src_test() {
local -x CMAKE_SKIP_TESTS=(
# Known failing, unreliable test
# bug #743938
TestCPUInfo.GetCPUFrequency
# Test failure stemming from sci-libs/kissfft
# The difference between output[2i] and (i==freq1?1.0:0.0) is inf, which exceeds 1e-7, where output[2i]
# evaluates to inf,(i==freq1?1.0:0.0) evaluates to 0, and 1e-7 evaluates to 9.9999999999999995e-08.
TestRFFT.SimpleSignal
# bug #779184
# https://github.com/xbmc/xbmc/issues/18594
$(usev x86 TestDateTime.SetFromDBTime)
)
# see https://github.com/xbmc/xbmc/issues/17860#issuecomment-630120213
local -x KODI_HOME="${BUILD_DIR}"
cmake_src_test
}
src_install() {
cmake_src_install
# bug #457588
pax-mark Em "${ED}"/usr/$(get_libdir)/${PN}/${PN}.bin
newicon media/icon48x48.png kodi.png
rm "${ED}"/usr/share/kodi/addons/skin.estuary/fonts/Roboto-Thin.ttf || die
dosym ../../../../fonts/roboto/Roboto-Thin.ttf \
usr/share/kodi/addons/skin.estuary/fonts/Roboto-Thin.ttf
if use !eventclients ; then
rm -f "${ED}"/usr/bin/kodi-ps3remote || die
rm -f "${D}"$(python_get_sitedir)/kodi/ps3_remote.py || die
rm -rf "${D}"$(python_get_sitedir)/kodi/ps3 || die
rm -rf "${D}"$(python_get_sitedir)/kodi/bt || die
rm -rf "${ED}"/usr/share/doc/${PF}/kodi-eventclients-dev || die
fi
python_optimize "${D}$(python_get_sitedir)"
einstalldocs
use doc && dodoc -r "${S}"/docs/html/
}
pkg_postinst() {
xdg_pkg_postinst
if use dbus ; then
optfeature "getting battery level and active power source" sys-power/upower
optfeature "control of shutdown, reboot, suspend, and hibernate" sys-auth/elogind sys-apps/systemd
optfeature "storage management support (automounting, volume monitoring, etc)" sys-fs/udisks:2
fi
}