Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/.SRCINFO b/.SRCINFO
- index 51a3523..7f0510b 100644
- --- a/.SRCINFO
- +++ b/.SRCINFO
- @@ -15,9 +15,13 @@ pkgbase = kodi-addon-inputstream-ffmpegdirect
- makedepends = pkgconf
- makedepends = kodi-dev
- depends = kodi
- - depends = ffmpeg6.1
- + depends = ffmpeg
- provides = kodi-addon-inputstream-ffmpegdirect
- source = https://github.com/xbmc/inputstream.ffmpegdirect/archive/21.3.8-Omega.tar.gz
- - sha256sums = 0648c6bbb2143cec0c3f48ad476f2c213f20c809caaf5ac74c8ceb4e53635f4e
- + source = 0000-ffmpeg7.patch
- + source = 0001-ffmpeg8.patch
- + sha256sums = 0648c6bbb2143cec0c3f48ad476f2c213f20c809caaf5ac74c8ceb4e53635f4e
- + sha256sums = 87334d9b32b2dd62aa3756e9d46487d4184f3d70155c0afc34b5f14926d280ff
- + sha256sums = 1968f6299d58984f7782fbfda4da6ec5f1796ac84377d4131a42cf671edf4b4a
- pkgname = kodi-addon-inputstream-ffmpegdirect
- diff --git a/0000-ffmpeg7.patch b/0000-ffmpeg7.patch
- new file mode 100644
- index 0000000..e5b306f
- --- /dev/null
- +++ b/0000-ffmpeg7.patch
- @@ -0,0 +1,227 @@
- +From 5552d0bde9ec84c42ef7a72972179f99755a2618 Mon Sep 17 00:00:00 2001
- +From: Vasyl Gello <[email protected]>
- +Date: Fri, 9 Aug 2024 07:11:41 +0000
- +Subject: [PATCH] Port FFmpeg 7.0 to ffmpegdirect Omega
- +
- +From https://github.com/xbmc/xbmc/pull/24972
- +
- +Signed-off-by: Vasyl Gello <[email protected]>
- +---
- + FindFFMPEG.cmake | 16 ++--
- + depends/common/ffmpeg/CMakeLists.txt | 4 +-
- + depends/common/ffmpeg/ffmpeg.sha256 | 2 +-
- + depends/common/ffmpeg/ffmpeg.txt | 2 +-
- + src/stream/FFmpegStream.cpp | 125 ++++++++-------------------
- + 5 files changed, 46 insertions(+), 103 deletions(-)
- +
- +diff --git a/FindFFMPEG.cmake b/FindFFMPEG.cmake
- +index d03f329..8b20538 100644
- +--- a/FindFFMPEG.cmake
- ++++ b/FindFFMPEG.cmake
- +@@ -33,14 +33,14 @@
- + #
- +
- + # required ffmpeg library versions
- +-set(REQUIRED_FFMPEG_VERSION 5.0.0)
- +-set(_avcodec_ver ">=59.18.100")
- +-set(_avfilter_ver ">=8.24.100")
- +-set(_avformat_ver ">=59.16.100")
- +-set(_avutil_ver ">=57.17.100")
- +-set(_postproc_ver ">=56.3.100")
- +-set(_swresample_ver ">=4.3.100")
- +-set(_swscale_ver ">=6.4.100")
- ++set(REQUIRED_FFMPEG_VERSION 7.0.0)
- ++set(_avcodec_ver ">=61.3.100")
- ++set(_avfilter_ver ">=10.1.100")
- ++set(_avformat_ver ">=61.1.100")
- ++set(_avutil_ver ">=59.8.100")
- ++set(_postproc_ver ">=58.1.100")
- ++set(_swresample_ver ">=5.1.100")
- ++set(_swscale_ver ">=8.1.100")
- +
- + # Allows building with external ffmpeg not found in system paths,
- + # without library version checks
- +diff --git a/src/stream/FFmpegStream.cpp b/src/stream/FFmpegStream.cpp
- +index 8bf474f..c77e09d 100644
- +--- a/src/stream/FFmpegStream.cpp
- ++++ b/src/stream/FFmpegStream.cpp
- +@@ -1012,74 +1012,7 @@ bool FFmpegStream::OpenWithCURL(const AVInputFormat* iformat)
- + if (iformat == nullptr)
- + {
- + // let ffmpeg decide which demuxer we have to open
- +- bool trySPDIFonly = (m_curlInput->GetContent() == "audio/x-spdif-compressed");
- +-
- +- if (!trySPDIFonly)
- +- av_probe_input_buffer(m_ioContext, &iformat, strFile.c_str(), NULL, 0, 0);
- +-
- +- // Use the more low-level code in case we have been built against an old
- +- // FFmpeg without the above av_probe_input_buffer(), or in case we only
- +- // want to probe for spdif (DTS or IEC 61937) compressed audio
- +- // specifically, or in case the file is a wav which may contain DTS or
- +- // IEC 61937 (e.g. ac3-in-wav) and we want to check for those formats.
- +- if (trySPDIFonly || (iformat && strcmp(iformat->name, "wav") == 0))
- +- {
- +- AVProbeData pd;
- +- int probeBufferSize = 32768;
- +- std::unique_ptr<uint8_t[]> probe_buffer (new uint8_t[probeBufferSize + AVPROBE_PADDING_SIZE]);
- +-
- +- // init probe data
- +- pd.buf = probe_buffer.get();
- +- pd.filename = strFile.c_str();
- +-
- +- // read data using avformat's buffers
- +- pd.buf_size = avio_read(m_ioContext, pd.buf, probeBufferSize);
- +- if (pd.buf_size <= 0)
- +- {
- +- Log(LOGLEVEL_ERROR, "%s - error reading from input stream, %s", __FUNCTION__, CURL::GetRedacted(strFile).c_str());
- +- return false;
- +- }
- +- memset(pd.buf + pd.buf_size, 0, AVPROBE_PADDING_SIZE);
- +-
- +- // restore position again
- +- avio_seek(m_ioContext , 0, SEEK_SET);
- +-
- +- // the advancedsetting is for allowing the user to force outputting the
- +- // 44.1 kHz DTS wav file as PCM, so that an A/V receiver can decode
- +- // it (this is temporary until we handle 44.1 kHz passthrough properly)
- +- if (trySPDIFonly || (iformat && strcmp(iformat->name, "wav") == 0)) // && !CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_VideoPlayerIgnoreDTSinWAV))
- +- {
- +- // check for spdif and dts
- +- // This is used with wav files and audio CDs that may contain
- +- // a DTS or AC3 track padded for S/PDIF playback. If neither of those
- +- // is present, we assume it is PCM audio.
- +- // AC3 is always wrapped in iec61937 (ffmpeg "spdif"), while DTS
- +- // may be just padded.
- +- const AVInputFormat* iformat2 = av_find_input_format("spdif");
- +-
- +- if (iformat2 && iformat2->read_probe(&pd) > AVPROBE_SCORE_MAX / 4)
- +- {
- +- iformat = iformat2;
- +- }
- +- else
- +- {
- +- // not spdif or no spdif demuxer, try dts
- +- iformat2 = av_find_input_format("dts");
- +-
- +- if (iformat2 && iformat2->read_probe(&pd) > AVPROBE_SCORE_MAX / 4)
- +- {
- +- iformat = iformat2;
- +- }
- +- else if (trySPDIFonly)
- +- {
- +- // not dts either, return false in case we were explicitly
- +- // requested to only check for S/PDIF padded compressed audio
- +- Log(LOGLEVEL_DEBUG, "%s - not spdif or dts file, falling back", __FUNCTION__);
- +- return false;
- +- }
- +- }
- +- }
- +- }
- ++ av_probe_input_buffer(m_ioContext, &iformat, strFile.c_str(), NULL, 0, 0);
- +
- + if (!iformat)
- + {
- +@@ -1535,7 +1468,7 @@ bool FFmpegStream::SeekTime(double time, bool backwards, double* startpts)
- +
- + if (ret >= 0)
- + {
- +- if (m_pFormatContext->iformat->read_seek)
- ++ if (!(m_pFormatContext->iformat->flags & AVFMT_NOTIMESTAMPS))
- + m_seekToKeyFrame = true;
- +
- + m_currentPts = STREAM_NOPTS_VALUE;
- +@@ -2059,43 +1992,49 @@ DemuxStream* FFmpegStream::AddStream(int streamIdx)
- + st->colorRange = pStream->codecpar->color_range;
- + st->hdr_type = DetermineHdrType(pStream);
- +
- +- // https://github.com/FFmpeg/FFmpeg/blob/release/5.0/doc/APIchanges
- +- size_t size = 0;
- +- uint8_t* side_data = nullptr;
- ++ // https://github.com/FFmpeg/FFmpeg/blob/release/7.0/doc/APIchanges
- ++ const AVPacketSideData* sideData = nullptr;
- +
- + if (st->hdr_type == StreamHdrType::HDR_TYPE_DOLBYVISION)
- + {
- +- side_data = av_stream_get_side_data(pStream, AV_PKT_DATA_DOVI_CONF, &size);
- +- if (side_data && size)
- ++
- ++ sideData =
- ++ av_packet_side_data_get(pStream->codecpar->coded_side_data,
- ++ pStream->codecpar->nb_coded_side_data, AV_PKT_DATA_DOVI_CONF);
- ++ if (sideData && sideData->size)
- + {
- +- st->dovi = *reinterpret_cast<AVDOVIDecoderConfigurationRecord*>(side_data);
- ++ st->dovi = *reinterpret_cast<const AVDOVIDecoderConfigurationRecord*>(sideData->data);
- + }
- + }
- +
- +- side_data = av_stream_get_side_data(pStream, AV_PKT_DATA_MASTERING_DISPLAY_METADATA, &size);
- +- if (side_data && size)
- ++ sideData = av_packet_side_data_get(pStream->codecpar->coded_side_data,
- ++ pStream->codecpar->nb_coded_side_data,
- ++ AV_PKT_DATA_MASTERING_DISPLAY_METADATA);
- ++ if (sideData && sideData->size)
- + {
- + st->masteringMetaData = std::make_shared<AVMasteringDisplayMetadata>(
- +- *reinterpret_cast<AVMasteringDisplayMetadata*>(side_data));
- ++ *reinterpret_cast<const AVMasteringDisplayMetadata*>(sideData->data));
- + }
- +
- +- side_data = av_stream_get_side_data(pStream, AV_PKT_DATA_CONTENT_LIGHT_LEVEL, &size);
- +- if (side_data && size)
- ++ sideData = av_packet_side_data_get(pStream->codecpar->coded_side_data,
- ++ pStream->codecpar->nb_coded_side_data,
- ++ AV_PKT_DATA_CONTENT_LIGHT_LEVEL);
- ++ if (sideData && sideData->size)
- + {
- + st->contentLightMetaData = std::make_shared<AVContentLightMetadata>(
- +- *reinterpret_cast<AVContentLightMetadata*>(side_data));
- ++ *reinterpret_cast<const AVContentLightMetadata*>(sideData->data));
- + }
- +
- +- AVDictionaryEntry* rtag = av_dict_get(pStream->metadata, "rotate", NULL, 0);
- +- uint8_t* displayMatrixSideData =
- +- av_stream_get_side_data(pStream, AV_PKT_DATA_DISPLAYMATRIX, nullptr);
- +- if (displayMatrixSideData)
- ++ sideData = av_packet_side_data_get(pStream->codecpar->coded_side_data,
- ++ pStream->codecpar->nb_coded_side_data,
- ++ AV_PKT_DATA_DISPLAYMATRIX);
- ++ if (sideData)
- + {
- +- const double tetha =
- +- av_display_rotation_get(reinterpret_cast<int32_t*>(displayMatrixSideData));
- +- if (!std::isnan(tetha))
- ++ const double theta =
- ++ av_display_rotation_get(reinterpret_cast<const int32_t*>(sideData->data));
- ++ if (!std::isnan(theta))
- + {
- +- st->iOrientation = ((static_cast<int>(-tetha) % 360) + 360) % 360;
- ++ st->iOrientation = ((static_cast<int>(-theta) % 360) + 360) % 360;
- + }
- + }
- +
- +@@ -2271,7 +2210,9 @@ StreamHdrType FFmpegStream::DetermineHdrType(AVStream* pStream)
- + {
- + StreamHdrType hdrType = StreamHdrType::HDR_TYPE_NONE;
- +
- +- if (av_stream_get_side_data(pStream, AV_PKT_DATA_DOVI_CONF, nullptr)) // DoVi
- ++ if (av_packet_side_data_get(pStream->codecpar->coded_side_data,
- ++ pStream->codecpar->nb_coded_side_data,
- ++ AV_PKT_DATA_DOVI_CONF)) // DoVi
- + hdrType = StreamHdrType::HDR_TYPE_DOLBYVISION;
- + else if (pStream->codecpar->color_trc == AVCOL_TRC_SMPTE2084) // HDR10
- + hdrType = StreamHdrType::HDR_TYPE_HDR10;
- +@@ -2279,7 +2220,9 @@ StreamHdrType FFmpegStream::DetermineHdrType(AVStream* pStream)
- + hdrType = StreamHdrType::HDR_TYPE_HLG;
- + // file could be SMPTE2086 which FFmpeg currently returns as unknown
- + // so use the presence of static metadata to detect it
- +- else if (av_stream_get_side_data(pStream, AV_PKT_DATA_MASTERING_DISPLAY_METADATA, nullptr))
- ++ else if (av_packet_side_data_get(pStream->codecpar->coded_side_data,
- ++ pStream->codecpar->nb_coded_side_data,
- ++ AV_PKT_DATA_MASTERING_DISPLAY_METADATA))
- + hdrType = StreamHdrType::HDR_TYPE_HDR10;
- +
- + return hdrType;
- +--
- +2.43.0
- +
- diff --git a/0001-ffmpeg8.patch b/0001-ffmpeg8.patch
- new file mode 100644
- index 0000000..9d85707
- --- /dev/null
- +++ b/0001-ffmpeg8.patch
- @@ -0,0 +1,49 @@
- +diff --git a/src/stream/DemuxStream.h b/src/stream/DemuxStream.h
- +index e66ecf0..00e071f 100644
- +--- a/src/stream/DemuxStream.h
- ++++ b/src/stream/DemuxStream.h
- +@@ -80,8 +80,8 @@ public:
- + dvdNavId = 0;
- + demuxerId = -1;
- + codec_fourcc = 0;
- +- profile = FF_PROFILE_UNKNOWN;
- +- level = FF_LEVEL_UNKNOWN;
- ++ profile = AV_PROFILE_UNKNOWN;
- ++ level = AV_LEVEL_UNKNOWN;
- + type = INPUTSTREAM_TYPE_NONE;
- + iDuration = 0;
- + pPrivate = NULL;
- +diff --git a/src/stream/FFmpegStream.cpp b/src/stream/FFmpegStream.cpp
- +index 8bf474f..9633728 100644
- +--- a/src/stream/FFmpegStream.cpp
- ++++ b/src/stream/FFmpegStream.cpp
- +@@ -1582,7 +1582,7 @@ bool FFmpegStream::SeekTime(double time, bool backwards, double* startpts)
- +
- + FFmpegExtraData FFmpegStream::GetPacketExtradata(const AVPacket* pkt, const AVCodecParameters* codecPar)
- + {
- +- constexpr int FF_MAX_EXTRADATA_SIZE = ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE);
- ++ constexpr int AV_MAX_EXTRADATA_SIZE = ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE);
- +
- + if (!pkt)
- + return {};
- +@@ -1675,7 +1675,7 @@ FFmpegExtraData FFmpegStream::GetPacketExtradata(const AVPacket* pkt, const AVCo
- + size_t retExtraDataSize = 0;
- + uint8_t* retExtraData =
- + av_packet_get_side_data(pktRef, AV_PKT_DATA_NEW_EXTRADATA, &retExtraDataSize);
- +- if (retExtraData && retExtraDataSize > 0 && retExtraDataSize < FF_MAX_EXTRADATA_SIZE)
- ++ if (retExtraData && retExtraDataSize > 0 && retExtraDataSize < AV_MAX_EXTRADATA_SIZE)
- + {
- + try
- + {
- +@@ -2317,9 +2317,9 @@ std::string FFmpegStream::GetStreamCodecName(int iStreamId)
- + /* use profile to determine the DTS type */
- + if (stream->codec == AV_CODEC_ID_DTS)
- + {
- +- if (stream->profile == FF_PROFILE_DTS_HD_MA)
- ++ if (stream->profile == AV_PROFILE_DTS_HD_MA)
- + strName = "dtshd_ma";
- +- else if (stream->profile == FF_PROFILE_DTS_HD_HRA)
- ++ else if (stream->profile == AV_PROFILE_DTS_HD_HRA)
- + strName = "dtshd_hra";
- + else
- + strName = "dca";
- diff --git a/PKGBUILD b/PKGBUILD
- index acaf10d..e280072 100644
- --- a/PKGBUILD
- +++ b/PKGBUILD
- @@ -11,20 +11,35 @@ license=('GPL')
- groups=('kodi')
- makedepends=('cmake' 'git' 'pkgconf' 'kodi-dev')
- provides=('kodi-addon-inputstream-ffmpegdirect')
- -depends=('kodi' 'ffmpeg6.1')
- -source=("https://github.com/xbmc/${_gitname}/archive/${pkgver}-${_koditarget}.tar.gz")
- +depends=('kodi' 'ffmpeg')
- +source=(
- + "https://github.com/xbmc/${_gitname}/archive/${pkgver}-${_koditarget}.tar.gz"
- + "0000-ffmpeg7.patch"
- + "0001-ffmpeg8.patch"
- +)
- -sha256sums=('0648c6bbb2143cec0c3f48ad476f2c213f20c809caaf5ac74c8ceb4e53635f4e')
- +sha256sums=(
- + '0648c6bbb2143cec0c3f48ad476f2c213f20c809caaf5ac74c8ceb4e53635f4e'
- + '87334d9b32b2dd62aa3756e9d46487d4184f3d70155c0afc34b5f14926d280ff'
- + '1968f6299d58984f7782fbfda4da6ec5f1796ac84377d4131a42cf671edf4b4a'
- +)
- +
- +prepare() {
- + cd "${_gitname}-${pkgver}-${_koditarget}"
- + patch -Np1 -i ../0000-ffmpeg7.patch
- + patch -Np1 -i ../0001-ffmpeg8.patch
- +}
- build() {
- mkdir -p "${_gitname}-${pkgver}-${_koditarget}/build"
- cd "${_gitname}-${pkgver}-${_koditarget}/build"
- - PKG_CONFIG_PATH=/usr/lib/ffmpeg6.1/pkgconfig cmake \
- + cmake \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_BUILD_TYPE=Release \
- - -DLIBXML2_INCLUDE_DIRS=/usr/include/libxml2/libxml \
- + -DLIBXML2_INCLUDE_DIRS=/usr/include/libxml2/libxml \
- ..
- +
- make
- }
Advertisement
Add Comment
Please, Sign In to add comment