bump kodi

This commit is contained in:
Fredrik Eriksson 2024-04-14 09:32:58 +02:00
parent 6333477dd2
commit b8b528b159
Signed by: feffe
GPG Key ID: E6B5580B853D322B
15 changed files with 897 additions and 1 deletions

View File

@ -0,0 +1,3 @@
DIST bento4-1.6.0-639-7-Omega.tar.gz 5481533 BLAKE2B 0636f0c94ebb3246c8720e120f3b505e4a82ed2e37d9ed44351875dcf3fab8bc2e53b83e0be43fb711aac3144d6df3d8ae2ead24fcd55bd116f3c54f07e3c19f SHA512 bf257e5831eec44db944d1313858262c1ba32b6e67564bb8f809a1aa0fc8a55faaaac2357d80f1ce2e794914f6bec5263548e77802db2b9e52998af2b6276809
DIST kodi-inputstream-adaptive-20.3.18.tar.gz 779751 BLAKE2B 201702996b976fde820c8df6abe43b04977946e4ed0d13752e5713db1ca944146915fcdb60b1d6ebdbd42b57678a8f518bc2b683cfc0dc7ba196be85e0cfbef6 SHA512 87435271bedc1e0371356d953a170233c3a259c773f0caec7bf314c23432925215e138c5cac83da1b016fcfd0c9c1a6cbd18c87911a7ef990bc7199ffe2a67de
EBUILD kodi-inputstream-adaptive-20.3.18.ebuild 1074 BLAKE2B 5c000ed0126ea920bada537101c440164a7acfc21ddb9243c8ba875cb6ac132b07df3faa4aacf9e904d42c12eafbcc689d5c8336e8572d6842629c0c1a882d51 SHA512 d277c9361c9a995614af3c74c0e9d0556571f7565c1968d0ce16afa078a720d291be4f4d48fec631c855f0fe46a77b27185e3661118ef79b3258da4cc7fe32e2

View File

@ -0,0 +1,49 @@
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit kodi-addon
DESCRIPTION="Kodi's Adaptive inputstream addon"
HOMEPAGE="https://github.com/xbmc/inputstream.adaptive.git"
CODENAME="Nexus"
BENTO4_VERSION="1.6.0-639-7-Omega"
KEYWORDS="~amd64 ~x86"
SRC_URI="https://github.com/xbmc/inputstream.adaptive/archive/${PV}-${CODENAME}.tar.gz -> ${P}.tar.gz
https://github.com/xbmc/Bento4/archive/${BENTO4_VERSION}.tar.gz -> bento4-${BENTO4_VERSION}.tar.gz"
S="${WORKDIR}/inputstream.adaptive-${PV}-${CODENAME}"
LICENSE="GPL-2"
SLOT="0"
RESTRICT="!test? ( test )"
IUSE="test"
COMMON_DEPEND="
dev-libs/expat
=media-tv/kodi-20*
"
DEPEND="
${COMMON_DEPEND}
test? ( dev-cpp/gtest )
"
RDEPEND="
${COMMON_DEPEND}
"
src_unpack() {
unpack ${P}.tar.gz
}
src_configure() {
local mycmakeargs=(
-DBUILD_TESTING=$(usex test)
-DENABLE_INTERNAL_BENTO4=ON
-DBENTO4_URL="${DISTDIR}/bento4-${BENTO4_VERSION}.tar.gz"
-DCMAKE_INSTALL_LIBDIR="${EPREFIX}/usr/$(get_libdir)/kodi"
-Wno-dev
)
cmake_src_configure
}

View File

@ -0,0 +1,7 @@
AUX kodi-inputstream-ffmpegdirect-20.5.0-Fix-use-after-free-in-TimeshiftSegment.patch 1001 BLAKE2B ee4624253c0ab6bddd22a8ce5da969eb4e7acd22eb658eaf091fc826f714aa1314898b26a283b4e64233d4c5e5f4766a465bbbea4d4fe7b1997740a46f375d91 SHA512 608b45bf89b1430b6d25cf75f402567c1615e6457c20997efe7175aa631501eb967b5961b5dd9ff1b373de32c5d88f9a4b6da0cb92ef1866dfd81d149938e8aa
AUX kodi-inputstream-ffmpegdirect-20.5.0-Get-extradata-with-extract_extradata-BSF.patch 9834 BLAKE2B d26b4a56ddad02488868c94670440ab369a2016416a606b9f05386b615367028379279e270771d6635c69370e670178bd4dc80d4296d8ea69165b297708ded38 SHA512 77964f8d726e6bad4ea20fc9c5320f36a20047d9d9b999cc154f78e1f38612624a742c23a45ae060289e8507cc122fbd828b6f460e9449fa3e44bbc22ac61c14
AUX kodi-inputstream-ffmpegdirect-20.5.0-ffmpeg5.patch 13078 BLAKE2B 50fa84e7790b06960177cc48a097fca12d1f984bd41db335f98e01ebd2ecca5c4fad8e917af5af8a6d8bcc3408856542d44784834fecbd119a82ee75ec243df4 SHA512 63427c395dea7533c0909cbc43fecf8e14998bb108da50a43c2e755f8fa94cdd74751ce4b09ebc8db1780eaaf1fc717f5e4ed156443f78c9fdd6fb3bf730482b
AUX kodi-inputstream-ffmpegdirect-20.5.0-ffmpeg6.patch 1467 BLAKE2B 1a82346927a978c059e0d69bde63451a5463fec0035b8f32ea735a1fd26374254aec3f4b60041f13a49993542f9244ebf232c734b4aff5c5cece0d1bdde2320f SHA512 6c385aad0afa07379235ee7bd70a11e434befabde46dd5185c90ad85258d4ac5451c8426354f4d6e1e16b4e7c6e6a267843c4abba9a2e6601677c2e7023ce9b1
AUX kodi-inputstream-ffmpegdirect-20.5.0-gcc13.patch 1260 BLAKE2B 601ad71dfe4859e3fda621ce58f5687941e454214295514082e4f463bcc886588b83624b7afb28e204d9479c27ea9ed0bbe3b8b845716ce57cde4df164fbf8a8 SHA512 fbeaa550c562b6c29555c88108813cc6f19699506395e3efe9de54022676ebf3e6da893dde8803ea4d84f6b81563a886aac7c62ddeaab8e427d5e48dd3351eba
DIST kodi-inputstream-ffmpegdirect-20.5.0.tar.gz 289362 BLAKE2B 2e8c63bd47d54f84cade2acb092a8e3ef11c31170071f66b5f22d4aa6fd27992a22b19ecb8070ce7d952f80882fe617e5eaed70dcf325b9bdb579220ddd59688 SHA512 9db8e25f04400635e13cf7c79f7079be9c7ffbf427423abcfc449dcd06f6259dcf9ed1ad1eae1563db239978c8399e054e7c6adcbebb5cc70c4de1c01643d074
EBUILD kodi-inputstream-ffmpegdirect-20.5.0-r1.ebuild 1041 BLAKE2B 1da6ae5dffb038656247fa85e5ab6a495519dbf40b732c9e9a0fdba6fedf8b23c9a231a0a0861c8891ddb2a788cfe9b236d5be853021ae3f7f70fb1fa016daec SHA512 a0a53583c144d39edc7958be3ecd2eebfbfd8b60ccc048b360f0d6fc53386d08569885851c2e4d5962e1837530073b7a53a1df388312fb005ad4768271926a43

View File

@ -0,0 +1,25 @@
From e6541a98b64631836336de17e57efa8e8e0b8425 Mon Sep 17 00:00:00 2001
From: Vasyl Gello <vasek.gello@gmail.com>
Date: Sat, 15 Oct 2022 16:09:20 +0000
Subject: [PATCH] Fix use-after-free in TimeshiftSegment
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
---
src/stream/TimeshiftSegment.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/stream/TimeshiftSegment.cpp b/src/stream/TimeshiftSegment.cpp
index 9323a44a..9e1cd09c 100644
--- a/src/stream/TimeshiftSegment.cpp
+++ b/src/stream/TimeshiftSegment.cpp
@@ -90,8 +90,8 @@ void TimeshiftSegment::AddPacket(DEMUX_PACKET* packet)
m_packetBuffer.emplace_back(newPacket);
int secondsSinceStart = 0;
- if (packet->pts != STREAM_NOPTS_VALUE && packet->pts > 0)
- secondsSinceStart = packet->pts / STREAM_TIME_BASE;
+ if (newPacket->pts != STREAM_NOPTS_VALUE && newPacket->pts > 0)
+ secondsSinceStart = newPacket->pts / STREAM_TIME_BASE;
if (secondsSinceStart != m_lastPacketSecondsSinceStart)
{

View File

@ -0,0 +1,290 @@
From 07ea26d7ce6bde1350ceb15380f4908da454f004 Mon Sep 17 00:00:00 2001
From: Vasyl Gello <vasek.gello@gmail.com>
Date: Sat, 15 Oct 2022 16:17:48 +0000
Subject: [PATCH] ffmpeg5: Get extradata with extract_extradata BSF
Fixes the transport stream playback failures described in
https://bugs.debian.org/1016925
@Rogo95 made an excellent technical analysis of the root cause
and reported that to the bug thread.
Later on, James Almer (@jamrial) suggested the solution to use
extract_extradata bitstream filter to replace the removed split()
function.
Finally, I adapted the following code snippet:
https://gist.github.com/moonpfe/f6795d51294d91ee0f82f62ff6985db0
to Kodi and tested it by playing the affected files in TS format.
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
---
src/stream/FFmpegStream.cpp | 222 ++++++++++++++++++++++++++++++------
src/stream/FFmpegStream.h | 2 +
2 files changed, 192 insertions(+), 32 deletions(-)
diff --git a/src/stream/FFmpegStream.cpp b/src/stream/FFmpegStream.cpp
index f2140a17..95d1da83 100644
--- a/src/stream/FFmpegStream.cpp
+++ b/src/stream/FFmpegStream.cpp
@@ -29,6 +29,7 @@
#endif
extern "C" {
+#include <libavcodec/bsf.h>
#include <libavutil/dict.h>
#include <libavutil/opt.h>
}
@@ -1586,6 +1587,168 @@ bool FFmpegStream::SeekTime(double time, bool backwards, double* startpts)
return false;
}
+int FFmpegStream::GetPacketExtradata(const AVPacket* pkt, const AVCodecParserContext* parserCtx, AVCodecContext* codecCtx, uint8_t **p_extradata)
+{
+ int extradata_size = 0;
+
+ if (!pkt || !p_extradata)
+ return 0;
+
+ *p_extradata = nullptr;
+
+#if LIBAVFORMAT_BUILD >= AV_VERSION_INT(59, 0, 100)
+ /* extract_extradata bitstream filter is implemented only
+ * for certain codecs, as noted in discussion of PR#21248
+ */
+
+ AVCodecID codecId = codecCtx->codec_id;
+
+ // clang-format off
+ if (
+ codecId != AV_CODEC_ID_MPEG1VIDEO &&
+ codecId != AV_CODEC_ID_MPEG2VIDEO &&
+ codecId != AV_CODEC_ID_H264 &&
+ codecId != AV_CODEC_ID_HEVC &&
+ codecId != AV_CODEC_ID_MPEG4 &&
+ codecId != AV_CODEC_ID_VC1 &&
+ codecId != AV_CODEC_ID_AV1 &&
+ codecId != AV_CODEC_ID_AVS2 &&
+ codecId != AV_CODEC_ID_AVS3 &&
+ codecId != AV_CODEC_ID_CAVS
+ )
+ // clang-format on
+ return 0;
+
+ AVBSFContext *bsf = nullptr;
+ AVPacket *dst_pkt = nullptr;
+ const AVBitStreamFilter *f;
+ AVPacket *pkt_ref = nullptr;
+ int ret = 0;
+ uint8_t *ret_extradata = nullptr;
+ size_t ret_extradata_size = 0;
+
+ f = av_bsf_get_by_name("extract_extradata");
+ if (!f)
+ return 0;
+
+ bsf = nullptr;
+ ret = av_bsf_alloc(f, &bsf);
+ if (ret < 0)
+ return 0;
+
+ bsf->par_in->codec_id = codecCtx->codec_id;
+
+ ret = av_bsf_init(bsf);
+ if (ret < 0)
+ {
+ av_bsf_free(&bsf);
+ return 0;
+ }
+
+ dst_pkt = av_packet_alloc();
+ pkt_ref = dst_pkt;
+
+ ret = av_packet_ref(pkt_ref, pkt);
+ if (ret < 0)
+ {
+ av_bsf_free(&bsf);
+ av_packet_free(&dst_pkt);
+ return 0;
+ }
+
+ ret = av_bsf_send_packet(bsf, pkt_ref);
+ if (ret < 0)
+ {
+ av_packet_unref(pkt_ref);
+ av_bsf_free(&bsf);
+ av_packet_free(&dst_pkt);
+ return 0;
+ }
+
+ ret = 0;
+ while (ret >= 0)
+ {
+ ret = av_bsf_receive_packet(bsf, pkt_ref);
+ if (ret < 0)
+ {
+ if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
+ break;
+
+ continue;
+ }
+
+ ret_extradata = av_packet_get_side_data(pkt_ref,
+ AV_PKT_DATA_NEW_EXTRADATA,
+ &ret_extradata_size);
+ if (ret_extradata &&
+ ret_extradata_size > 0 &&
+ ret_extradata_size < FF_MAX_EXTRADATA_SIZE)
+ {
+ *p_extradata = (uint8_t*)av_malloc(ret_extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (!*p_extradata)
+ {
+ Log(LOGLEVEL_ERROR,
+ "%s - failed to allocate %zu bytes for extradata",
+ __FUNCTION__,
+ ret_extradata_size);
+
+ av_packet_unref(pkt_ref);
+ av_bsf_free(&bsf);
+ av_packet_free(&dst_pkt);
+ return 0;
+ }
+
+ Log(LOGLEVEL_DEBUG,
+ "%s - fetching extradata, extradata_size(%zu)",
+ __FUNCTION__,
+ ret_extradata_size);
+
+ memcpy(*p_extradata, ret_extradata, ret_extradata_size);
+ memset(*p_extradata + ret_extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+ extradata_size = ret_extradata_size;
+
+ av_packet_unref(pkt_ref);
+ break;
+ }
+
+ av_packet_unref(pkt_ref);
+ }
+
+ av_bsf_free(&bsf);
+ av_packet_free(&dst_pkt);
+#else
+ if (codecCtx && parserCtx && parserCtx->parser && parserCtx->parser->split)
+ extradata_size = parserCtx->parser->split(codecCtx, pkt->data, pkt->size);
+
+ if (extradata_size <= 0 || extradata_size >= FF_MAX_EXTRADATA_SIZE)
+ {
+ Log(LOGLEVEL_DEBUG, "%s - fetched extradata of weird size %zd",
+ __FUNCTION__, extradata_size);
+ return 0;
+ }
+
+ *p_extradata = (uint8_t*)av_malloc(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (!*p_extradata)
+ {
+ Log(LOGLEVEL_ERROR,
+ "%s - failed to allocate %zd bytes for extradata",
+ __FUNCTION__,
+ extradata_size);
+ return 0;
+ }
+
+ Log(LOGLEVEL_DEBUG,
+ "%s - fetching extradata, extradata_size(%zd)",
+ __FUNCTION__,
+ extradata_size);
+
+ memcpy(*p_extradata, pkt->data, extradata_size);
+ memset(*p_extradata + extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+#endif
+
+ return extradata_size;
+}
+
void FFmpegStream::ParsePacket(AVPacket* pkt)
{
AVStream* st = m_pFormatContext->streams[pkt->stream_index];
@@ -1617,43 +1780,38 @@ void FFmpegStream::ParsePacket(AVPacket* pkt)
if (parser->second->m_parserCtx &&
parser->second->m_parserCtx->parser &&
- parser->second->m_parserCtx->parser->split &&
!st->codecpar->extradata)
{
- int i = parser->second->m_parserCtx->parser->split(parser->second->m_codecCtx, pkt->data, pkt->size);
- if (i > 0 && i < FF_MAX_EXTRADATA_SIZE)
+ int i = GetPacketExtradata(pkt,
+ parser->second->m_parserCtx,
+ parser->second->m_codecCtx,
+ &st->codecpar->extradata);
+ if (i > 0)
{
- st->codecpar->extradata = (uint8_t*)av_malloc(i + AV_INPUT_BUFFER_PADDING_SIZE);
- if (st->codecpar->extradata)
- {
- Log(LOGLEVEL_DEBUG, "CDVDDemuxFFmpeg::ParsePacket() fetching extradata, extradata_size(%d)", i);
- st->codecpar->extradata_size = i;
- memcpy(st->codecpar->extradata, pkt->data, i);
- memset(st->codecpar->extradata + i, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+ st->codecpar->extradata_size = i;
- if (parser->second->m_parserCtx->parser->parser_parse)
+ if (parser->second->m_parserCtx->parser->parser_parse)
+ {
+ parser->second->m_codecCtx->extradata = st->codecpar->extradata;
+ parser->second->m_codecCtx->extradata_size = st->codecpar->extradata_size;
+ const uint8_t* outbufptr;
+ int bufSize;
+ parser->second->m_parserCtx->flags |= PARSER_FLAG_COMPLETE_FRAMES;
+ parser->second->m_parserCtx->parser->parser_parse(parser->second->m_parserCtx,
+ parser->second->m_codecCtx,
+ &outbufptr, &bufSize,
+ pkt->data, pkt->size);
+ parser->second->m_codecCtx->extradata = nullptr;
+ parser->second->m_codecCtx->extradata_size = 0;
+
+ if (parser->second->m_parserCtx->width != 0)
{
- parser->second->m_codecCtx->extradata = st->codecpar->extradata;
- parser->second->m_codecCtx->extradata_size = st->codecpar->extradata_size;
- const uint8_t* outbufptr;
- int bufSize;
- parser->second->m_parserCtx->flags |= PARSER_FLAG_COMPLETE_FRAMES;
- parser->second->m_parserCtx->parser->parser_parse(parser->second->m_parserCtx,
- parser->second->m_codecCtx,
- &outbufptr, &bufSize,
- pkt->data, pkt->size);
- parser->second->m_codecCtx->extradata = nullptr;
- parser->second->m_codecCtx->extradata_size = 0;
-
- if (parser->second->m_parserCtx->width != 0)
- {
- st->codecpar->width = parser->second->m_parserCtx->width;
- st->codecpar->height = parser->second->m_parserCtx->height;
- }
- else
- {
- Log(LOGLEVEL_ERROR, "CDVDDemuxFFmpeg::ParsePacket() invalid width/height");
- }
+ st->codecpar->width = parser->second->m_parserCtx->width;
+ st->codecpar->height = parser->second->m_parserCtx->height;
+ }
+ else
+ {
+ Log(LOGLEVEL_ERROR, "CDVDDemuxFFmpeg::ParsePacket() invalid width/height");
}
}
}
diff --git a/src/stream/FFmpegStream.h b/src/stream/FFmpegStream.h
index 356905dd..f0634d0f 100644
--- a/src/stream/FFmpegStream.h
+++ b/src/stream/FFmpegStream.h
@@ -109,6 +109,8 @@ class FFmpegStream
bool IsPaused() { return m_speed == STREAM_PLAYSPEED_PAUSE; }
virtual bool CheckReturnEmptyOnPacketResult(int result);
+ int GetPacketExtradata(const AVPacket* pkt, const AVCodecParserContext* parserCtx, AVCodecContext* codecCtx, uint8_t **p_extradata);
+
int64_t m_demuxerId;
mutable std::recursive_mutex m_mutex;
double m_currentPts; // used for stream length estimation

View File

@ -0,0 +1,319 @@
From fcad1884954ec1998f353750dd7332501e204ddb Mon Sep 17 00:00:00 2001
From: Vasyl Gello <vasek.gello@gmail.com>
Date: Sat, 15 Oct 2022 16:08:14 +0000
Subject: [PATCH] Adapt AlwinEsch's ffmpeg5 port patch
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
---
src/stream/FFmpegStream.cpp | 96 ++++++++++++++++++++++++++++++++-----
src/stream/FFmpegStream.h | 6 ++-
src/utils/FFmpegCompat.h | 20 ++++++++
3 files changed, 107 insertions(+), 15 deletions(-)
create mode 100644 src/utils/FFmpegCompat.h
diff --git a/src/stream/FFmpegStream.cpp b/src/stream/FFmpegStream.cpp
index 73e0963c..f2140a17 100644
--- a/src/stream/FFmpegStream.cpp
+++ b/src/stream/FFmpegStream.cpp
@@ -462,7 +462,14 @@ DEMUX_PACKET* FFmpegStream::DemuxRead()
// we already check for a valid m_streams[pPacket->iStreamId] above
else if (stream->type == INPUTSTREAM_TYPE_AUDIO)
{
- if (static_cast<DemuxStreamAudio*>(stream)->iChannels != m_pFormatContext->streams[pPacket->iStreamId]->codecpar->channels ||
+#if LIBAVCODEC_BUILD >= AV_VERSION_INT(59, 37, 100) && \
+ LIBAVUTIL_BUILD >= AV_VERSION_INT(57, 28, 100)
+ int codecparChannels =
+ m_pFormatContext->streams[pPacket->iStreamId]->codecpar->ch_layout.nb_channels;
+#else
+ int codecparChannels = m_pFormatContext->streams[pPacket->iStreamId]->codecpar->channels;
+#endif
+ if (static_cast<DemuxStreamAudio*>(stream)->iChannels != codecparChannels ||
static_cast<DemuxStreamAudio*>(stream)->iSampleRate != m_pFormatContext->streams[pPacket->iStreamId]->codecpar->sample_rate)
{
// content has changed
@@ -658,7 +665,7 @@ bool FFmpegStream::Aborted()
bool FFmpegStream::Open(bool fileinfo)
{
- AVInputFormat* iformat = NULL;
+ FFMPEG_FMT_CONST AVInputFormat* iformat = nullptr;
std::string strFile;
m_streaminfo = !m_isRealTimeStream && !m_reopen;;
m_currentPts = STREAM_NOPTS_VALUE;
@@ -729,6 +736,8 @@ bool FFmpegStream::Open(bool fileinfo)
m_streaminfo = true;
}
+ // https://github.com/FFmpeg/FFmpeg/blob/56450a0ee4/doc/APIchanges#L18-L26
+#if LIBAVFORMAT_BUILD < AV_VERSION_INT(59, 0, 100)
if (iformat && (strcmp(iformat->name, "mov,mp4,m4a,3gp,3g2,mj2") == 0))
{
CURL url(m_streamUrl);
@@ -736,6 +745,7 @@ bool FFmpegStream::Open(bool fileinfo)
if (!url.GetProtocol().empty() && !url.IsProtocol("file"))
m_pFormatContext->iformat->flags |= AVFMT_NOGENSEARCH;
}
+#endif
// we need to know if this is matroska, avi or sup later
m_bMatroska = strncmp(m_pFormatContext->iformat->name, "matroska", 8) == 0; // for "matroska.webm"
@@ -785,8 +795,11 @@ bool FFmpegStream::Open(bool fileinfo)
// if format can be nonblocking, let's use that
m_pFormatContext->flags |= AVFMT_FLAG_NONBLOCK;
- // deprecated, will be always set in future versions
+ // https://github.com/FFmpeg/FFmpeg/blob/d682ae70b4/doc/APIchanges#L18-L21
+#if LIBAVFORMAT_BUILD < AV_VERSION_INT(57, 66, 105) && \
+ LIBAVCODEC_BUILD < AV_VERSION_INT(57, 83, 101)
m_pFormatContext->flags |= AVFMT_FLAG_KEEP_SIDE_DATA;
+#endif
UpdateCurrentPTS();
@@ -828,12 +841,23 @@ bool FFmpegStream::Open(bool fileinfo)
{
int idx = m_pFormatContext->programs[i]->stream_index[j];
AVStream* st = m_pFormatContext->streams[idx];
+#if LIBAVFORMAT_BUILD >= AV_VERSION_INT(59, 3, 100)
+ // Related to https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210429143825.53040-1-jamrial@gmail.com/
+ // has been replaced with AVSTREAM_EVENT_FLAG_NEW_PACKETS.
+ if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && (st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)) ||
+ (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->sample_rate > 0))
+ {
+ nProgram = i;
+ break;
+ }
+#else
if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st->codec_info_nb_frames > 0) ||
(st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->sample_rate > 0))
{
nProgram = i;
break;
}
+#endif
}
}
@@ -870,7 +894,7 @@ bool FFmpegStream::Open(bool fileinfo)
return true;
}
-bool FFmpegStream::OpenWithFFmpeg(AVInputFormat* iformat, const AVIOInterruptCB& int_cb)
+bool FFmpegStream::OpenWithFFmpeg(FFMPEG_FMT_CONST AVInputFormat* iformat, const AVIOInterruptCB& int_cb)
{
Log(LOGLEVEL_INFO, "%s - IO handled by FFmpeg's AVFormat", __FUNCTION__);
@@ -959,7 +983,7 @@ bool FFmpegStream::OpenWithFFmpeg(AVInputFormat* iformat, const AVIOInterruptCB&
return true;
}
-bool FFmpegStream::OpenWithCURL(AVInputFormat* iformat)
+bool FFmpegStream::OpenWithCURL(FFMPEG_FMT_CONST AVInputFormat* iformat)
{
Log(LOGLEVEL_INFO, "%s - IO handled by Kodi's cURL", __FUNCTION__);
@@ -1039,8 +1063,7 @@ bool FFmpegStream::OpenWithCURL(AVInputFormat* iformat)
// is present, we assume it is PCM audio.
// AC3 is always wrapped in iec61937 (ffmpeg "spdif"), while DTS
// may be just padded.
- AVInputFormat* iformat2;
- iformat2 = av_find_input_format("spdif");
+ FFMPEG_FMT_CONST AVInputFormat* iformat2 = av_find_input_format("spdif");
if (iformat2 && iformat2->read_probe(&pd) > AVPROBE_SCORE_MAX / 4)
{
@@ -1147,11 +1170,19 @@ void FFmpegStream::UpdateCurrentPTS()
if (idx >= 0)
{
AVStream* stream = m_pFormatContext->streams[idx];
+#if LIBAVFORMAT_BUILD >= AV_VERSION_INT(59, 3, 100)
+ if (stream && m_pkt.pkt.dts != (int64_t)AV_NOPTS_VALUE)
+ {
+ double ts = ConvertTimestamp(m_pkt.pkt.dts, stream->time_base.den, stream->time_base.num);
+ m_currentPts = ts;
+ }
+#else
if (stream && stream->cur_dts != (int64_t)AV_NOPTS_VALUE)
{
double ts = ConvertTimestamp(stream->cur_dts, stream->time_base.den, stream->time_base.num);
m_currentPts = ts;
}
+#endif
}
}
@@ -1230,9 +1261,15 @@ bool FFmpegStream::IsProgramChange()
return true;
if (m_pFormatContext->streams[idx]->codecpar->codec_id != stream->codec)
return true;
+#if LIBAVCODEC_BUILD >= AV_VERSION_INT(59, 37, 100) && \
+ LIBAVUTIL_BUILD >= AV_VERSION_INT(57, 28, 100)
+ int codecparChannels =
+ m_pFormatContext->streams[idx]->codecpar->ch_layout.nb_channels;
+#else
+ int codecparChannels = m_pFormatContext->streams[idx]->codecpar->channels;
+#endif
if (m_pFormatContext->streams[idx]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
- m_pFormatContext->streams[idx]->codecpar->channels !=
- static_cast<DemuxStreamAudio*>(stream)->iChannels)
+ codecparChannels != static_cast<DemuxStreamAudio*>(stream)->iChannels)
return true;
if (m_pFormatContext->streams[idx]->codecpar->extradata_size != static_cast<int>(stream->ExtraSize))
return true;
@@ -1564,7 +1601,7 @@ void FFmpegStream::ParsePacket(AVPacket* pkt)
parser->second->m_parserCtx = av_parser_init(st->codecpar->codec_id);
- AVCodec* codec = avcodec_find_decoder(st->codecpar->codec_id);
+ FFMPEG_FMT_CONST AVCodec* codec = avcodec_find_decoder(st->codecpar->codec_id);
if (codec == nullptr)
{
Log(LOGLEVEL_ERROR, "%s - can't find decoder", __FUNCTION__);
@@ -1641,7 +1678,11 @@ TRANSPORT_STREAM_STATE FFmpegStream::TransportStreamAudioState()
{
if (!m_startTime)
{
+#if LIBAVFORMAT_BUILD >= AV_VERSION_INT(59, 3, 100)
+ m_startTime = av_rescale(m_pkt.pkt.dts, st->time_base.num, st->time_base.den) - 0.000001;
+#else
m_startTime = av_rescale(st->cur_dts, st->time_base.num, st->time_base.den) - 0.000001;
+#endif
m_seekStream = idx;
}
return TRANSPORT_STREAM_STATE::READY;
@@ -1661,7 +1702,11 @@ TRANSPORT_STREAM_STATE FFmpegStream::TransportStreamAudioState()
{
if (!m_startTime)
{
+#if LIBAVFORMAT_BUILD >= AV_VERSION_INT(59, 3, 100)
+ m_startTime = av_rescale(m_pkt.pkt.dts, st->time_base.num, st->time_base.den) - 0.000001;
+#else
m_startTime = av_rescale(st->cur_dts, st->time_base.num, st->time_base.den) - 0.000001;
+#endif
m_seekStream = i;
}
return TRANSPORT_STREAM_STATE::READY;
@@ -1694,7 +1739,11 @@ TRANSPORT_STREAM_STATE FFmpegStream::TransportStreamVideoState()
{
if (!m_startTime)
{
+#if LIBAVFORMAT_BUILD >= AV_VERSION_INT(59, 3, 100)
+ m_startTime = av_rescale(m_pkt.pkt.dts, st->time_base.num, st->time_base.den) - 0.000001;
+#else
m_startTime = av_rescale(st->cur_dts, st->time_base.num, st->time_base.den) - 0.000001;
+#endif
m_seekStream = idx;
}
return TRANSPORT_STREAM_STATE::READY;
@@ -1714,7 +1763,11 @@ TRANSPORT_STREAM_STATE FFmpegStream::TransportStreamVideoState()
{
if (!m_startTime)
{
+#if LIBAVFORMAT_BUILD >= AV_VERSION_INT(59, 3, 100)
+ m_startTime = av_rescale(m_pkt.pkt.dts, st->time_base.num, st->time_base.den) - 0.000001;
+#else
m_startTime = av_rescale(st->cur_dts, st->time_base.num, st->time_base.den) - 0.000001;
+#endif
m_seekStream = i;
}
return TRANSPORT_STREAM_STATE::READY;
@@ -1824,14 +1877,31 @@ DemuxStream* FFmpegStream::AddStream(int streamIdx)
{
DemuxStreamAudioFFmpeg* st = new DemuxStreamAudioFFmpeg(pStream);
stream = st;
- st->iChannels = pStream->codecpar->channels;
+#if LIBAVCODEC_BUILD >= AV_VERSION_INT(59, 37, 100) && \
+ LIBAVUTIL_BUILD >= AV_VERSION_INT(57, 28, 100)
+ int codecparChannels = pStream->codecpar->ch_layout.nb_channels;
+ int codecparChannelLayout = pStream->codecpar->ch_layout.u.mask;
+#else
+ int codecparChannels = pStream->codecpar->channels;
+ int codecparChannelLayout = pStream->codecpar->channel_layout;
+#endif
+ st->iChannels = codecparChannels;
+ st->iChannelLayout = codecparChannelLayout;
st->iSampleRate = pStream->codecpar->sample_rate;
st->iBlockAlign = pStream->codecpar->block_align;
st->iBitRate = static_cast<int>(pStream->codecpar->bit_rate);
st->iBitsPerSample = pStream->codecpar->bits_per_raw_sample;
- st->iChannelLayout = pStream->codecpar->channel_layout;
char buf[32] = { 0 };
+ // https://github.com/FFmpeg/FFmpeg/blob/6ccc3989d15/doc/APIchanges#L50-L53
+#if LIBAVCODEC_BUILD >= AV_VERSION_INT(59, 37, 100) && \
+ LIBAVUTIL_BUILD >= AV_VERSION_INT(57, 28, 100)
+ AVChannelLayout layout = {};
+ av_channel_layout_from_mask(&layout, st->iChannelLayout);
+ av_channel_layout_describe(&layout, buf, sizeof(buf));
+ av_channel_layout_uninit(&layout);
+#else
av_get_channel_layout_string(buf, 31, st->iChannels, st->iChannelLayout);
+#endif
st->m_channelLayoutName = buf;
if (st->iBitsPerSample == 0)
st->iBitsPerSample = pStream->codecpar->bits_per_coded_sample;
@@ -2070,7 +2140,7 @@ std::string FFmpegStream::GetStreamCodecName(int iStreamId)
return strName;
}
- AVCodec* codec = avcodec_find_decoder(stream->codec);
+ FFMPEG_FMT_CONST AVCodec* codec = avcodec_find_decoder(stream->codec);
if (codec)
strName = codec->name;
}
diff --git a/src/stream/FFmpegStream.h b/src/stream/FFmpegStream.h
index bf8a50f9..356905dd 100644
--- a/src/stream/FFmpegStream.h
+++ b/src/stream/FFmpegStream.h
@@ -7,6 +7,7 @@
#pragma once
+#include "../utils/FFmpegCompat.h"
#include "../utils/HttpProxy.h"
#include "../utils/Properties.h"
#include "BaseStream.h"
@@ -33,6 +34,7 @@ extern "C"
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/mastering_display_metadata.h>
+#include <libavutil/version.h>
}
#ifndef __GNUC__
@@ -117,8 +119,8 @@ class FFmpegStream
private:
bool Open(bool fileinfo);
- bool OpenWithFFmpeg(AVInputFormat* iformat, const AVIOInterruptCB& int_cb);
- bool OpenWithCURL(AVInputFormat* iformat);
+ bool OpenWithFFmpeg(FFMPEG_FMT_CONST AVInputFormat* iformat, const AVIOInterruptCB& int_cb);
+ bool OpenWithCURL(FFMPEG_FMT_CONST AVInputFormat* iformat);
AVDictionary* GetFFMpegOptionsFromInput();
void ResetVideoStreams();
double ConvertTimestamp(int64_t pts, int den, int num);
diff --git a/src/utils/FFmpegCompat.h b/src/utils/FFmpegCompat.h
new file mode 100644
index 00000000..46cff53f
--- /dev/null
+++ b/src/utils/FFmpegCompat.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2005-2022 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+extern "C" {
+#include <libavformat/avformat.h>
+}
+
+// https://github.com/FFmpeg/FFmpeg/blob/56450a0ee4/doc/APIchanges#L18-L26
+#if LIBAVFORMAT_BUILD >= AV_VERSION_INT(59, 0, 100)
+#define FFMPEG_FMT_CONST const
+#else
+#define FFMPEG_FMT_CONST
+#endif

View File

@ -0,0 +1,31 @@
From 98ccdd2f4263eb1590c65f175c11deeec18fe6c2 Mon Sep 17 00:00:00 2001
From: Bernd Kuhls <bernd.kuhls@t-online.de>
Date: Fri, 3 Mar 2023 19:33:04 +0100
Subject: [PATCH] Fix build with ffmpeg 6.0
This feature was removed from ffmpeg:
http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=add33e370d241d947209c914de1bf062fe44d58e
---
src/stream/FFmpegStream.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/stream/FFmpegStream.cpp b/src/stream/FFmpegStream.cpp
index 341062ed..0996b446 100644
--- a/src/stream/FFmpegStream.cpp
+++ b/src/stream/FFmpegStream.cpp
@@ -920,7 +920,6 @@ bool FFmpegStream::OpenWithFFmpeg(const AVInputFormat* iformat, const AVIOInterr
// We only process this condition for manifest streams when this setting is disabled
if (!kodi::addon::GetSettingBoolean("useFastOpenForManifestStreams") || m_manifestType.empty())
{
- m_pFormatContext->flags |= AVFMT_FLAG_PRIV_OPT;
if (avformat_open_input(&m_pFormatContext, strFile.c_str(), iformat, &options) < 0)
{
Log(LOGLEVEL_DEBUG, "Error, could not open file %s", CURL::GetRedacted(strFile).c_str());
@@ -935,7 +934,6 @@ bool FFmpegStream::OpenWithFFmpeg(const AVInputFormat* iformat, const AVIOInterr
}
m_pFormatContext->interrupt_callback = int_cb;
- m_pFormatContext->flags &= ~AVFMT_FLAG_PRIV_OPT;
options = GetFFMpegOptionsFromInput();
av_dict_set_int(&options, "load_all_variants", 0, AV_OPT_SEARCH_CHILDREN);

View File

@ -0,0 +1,47 @@
From fd7bd5ad86fd0006ad571a051fa5d5603a47e4b4 Mon Sep 17 00:00:00 2001
From: Rudi Heitbaum <rudi@heitbaum.com>
Date: Wed, 26 Apr 2023 17:15:00 +0000
Subject: [PATCH] include missing <cstdint> to support gcc-13
gcc 13 moved some includes around and as a result <cstdint> is no longer transitively
included [1]. Explicitly include it for uint{32,64}_t.
[1] https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
---
src/utils/DiskUtils.h | 1 +
src/utils/HttpProxy.h | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/utils/DiskUtils.h b/src/utils/DiskUtils.h
index 79e34268..f900ec58 100644
--- a/src/utils/DiskUtils.h
+++ b/src/utils/DiskUtils.h
@@ -7,6 +7,7 @@
#pragma once
+#include <cstdint>
#include <string>
namespace ffmpegdirect
diff --git a/src/utils/HttpProxy.h b/src/utils/HttpProxy.h
index eb0c99cb..d203ce36 100644
--- a/src/utils/HttpProxy.h
+++ b/src/utils/HttpProxy.h
@@ -7,6 +7,7 @@
#pragma once
+#include <cstdint>
#include <string>
namespace ffmpegdirect
@@ -36,4 +37,4 @@ namespace ffmpegdirect
std::string m_user;
std::string m_password;
};
-} //namespace ffmpegdirect
\ No newline at end of file
+} //namespace ffmpegdirect

View File

@ -0,0 +1,51 @@
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit kodi-addon
DESCRIPTION="Kodi's FFMpeg Direct Inputstream addon"
HOMEPAGE="https://github.com/xbmc/inputstream.ffmpegdirect"
SRC_URI=""
KEYWORDS="~amd64 ~arm ~arm64 ~x86"
CODENAME="Nexus"
SRC_URI="https://github.com/xbmc/inputstream.ffmpegdirect/archive/${PV}-${CODENAME}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/inputstream.ffmpegdirect-${PV}-${CODENAME}"
LICENSE="GPL-2"
SLOT="0"
IUSE=""
BDEPEND="
virtual/pkgconfig
"
COMMON_DEPEND="
media-video/ffmpeg:=[encode,libxml2,zlib]
virtual/libiconv
app-arch/bzip2
=media-tv/kodi-20*
"
DEPEND="
${COMMON_DEPEND}
"
RDEPEND="
${COMMON_DEPEND}
"
PATCHES=(
"${FILESDIR}"/${P}-ffmpeg5.patch
"${FILESDIR}"/${P}-Get-extradata-with-extract_extradata-BSF.patch
"${FILESDIR}"/${P}-Fix-use-after-free-in-TimeshiftSegment.patch
"${FILESDIR}"/${P}-ffmpeg6.patch
"${FILESDIR}"/${P}-gcc13.patch
)
src_prepare() {
[ -d depends ] && rm -rf depends || die
cmake_src_prepare
}

View File

@ -0,0 +1,2 @@
DIST kodi-pvr-hts-20.7.2.tar.gz 218776 BLAKE2B e09b9462f9b8913b1e156c2fa966170e4f59b5d6a88b5694159027006e22ce610a9217eae345f41752a81083a450b3f466db685e03231ae30ffd26884b21675b SHA512 ef16355ff0a9e00a44717ab5216bd88d9a63e745f656694dace73e35437b945034ae852cf1415c04ebab7c1bb102a8cf8b913c7fc8bce49237aa7c3c96c2f290
EBUILD kodi-pvr-hts-20.7.2.ebuild 533 BLAKE2B 07c143a1238780c37408bf45965d13126d554f4bb5cb0e10f1b319ee51f283265b189a949dedf60a4d6a7adfd43bb156524d187523247ecff70af7dcb95ae36c SHA512 aa3072bb411bc3c393f80767d68a217ac56873997eddb38c721a2a668c770b69d85781cfd90538751f32cc518554776a8e9f4b16d98ad94359fbceade63f423f

View File

@ -0,0 +1,27 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit cmake kodi-addon
DESCRIPTION="Tvheadend Live TV and Radio PVR client addon for Kodi"
HOMEPAGE="https://github.com/kodi-pvr/pvr.hts"
SRC_URI=""
CODENAME="Nexus"
KEYWORDS="~amd64 ~x86"
SRC_URI="https://github.com/kodi-pvr/pvr.hts/archive/${PV}-${CODENAME}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/pvr.hts-${PV}-${CODENAME}"
LICENSE="GPL-2"
SLOT="0"
IUSE=""
DEPEND="
=media-tv/kodi-20*
"
RDEPEND="
${DEPEND}
"

View File

@ -0,0 +1,2 @@
DIST kodi-vfs-sftp-20.1.0.tar.gz 45904 BLAKE2B f9c0f4359075609122627fbec2c945d643a844d7cb07eb09d7ab1581856a2c46790a36398e414ba9ef03c4b36eb361f2ea5a5a23aef980a83a8e6124e1b19f52 SHA512 ea2b205a5b4f279f8211a5744d0f5e6efb6346052ba927aef95733e1c964df5b97fc1176e2fa5d2b378561464f868cdc37e564ca120079f6ff70d2e79b48667c
EBUILD kodi-vfs-sftp-20.1.0.ebuild 738 BLAKE2B 82b07146904bf3c2f3af62da6ab1cd80040c8246e86a9d0706af5d024d462bdeb516cf8f14f002870c06b851d6521d88e1114ab181276c3ef6817b50b411ff1f SHA512 774f4ac5d310e7826d120a9e9029b8a631df8159cb331e00c45b595b444a7003859ab9a05a8412c4bb0090a0a3fe26704226fb5d7a4ae5b0f0e0469603e21fd2

View File

@ -0,0 +1,40 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit cmake kodi-addon
DESCRIPTION="SFTP VFS addon for Kodi"
HOMEPAGE="https://github.com/xbmc/vfs.sftp"
SRC_URI=""
case ${PV} in
9999)
SRC_URI=""
EGIT_REPO_URI="https://github.com/xbmc/vfs.sftp.git"
EGIT_BRANCH="Omega"
inherit git-r3
;;
*)
CODENAME="Nexus"
KEYWORDS="~amd64 ~x86"
SRC_URI="https://github.com/xbmc/vfs.sftp/archive/${PV}-${CODENAME}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/vfs.sftp-${PV}-${CODENAME}"
;;
esac
LICENSE="GPL-2"
SLOT="0"
IUSE=""
DEPEND="
net-libs/libssh[sftp]
>=media-tv/kodi-20
"
RDEPEND="${DEPEND}"
src_prepare() {
[ -d depends ] && rm -rf depends || die
cmake_src_prepare
}

View File

@ -12,7 +12,7 @@ USE="${USE}
kerberos ldap gssapi
X gui widgets rdp vnc wayland tray systray
fcitx4 truetype fontconfig spell harfbuzz xft
opengl vaapi xinerama libkms dri egl qsv vulkan vmaf
opengl vaapi xinerama libkms dri egl qsv vulkan vmaf libplacebo shaderc
bluray drm dvd lcms bdplus v4l aacs colord optical udf archive
pulseaudio ogg mp3 alsa vorbis native-headset ofono-headset opus
jpeg zimg png tiff gif exif xmp svg hdri heif corefonts webp raw x265 libde265 wallpapers vpx gdk-pixbuf libdovi

View File

@ -1,3 +1,6 @@
=media-tv/kodi-20.3 ~amd64
media-plugins/kodi-vfs-sftp ~amd64
media-plugins/kodi-repository-jellyfin ~amd64
media-plugins/kodi-inputstream-adaptive ~amd64
media-plugins/kodi-inputstream-ffmpegdirect ~amd64
media-plugins/kodi-pvr-hts ~amd64