[packages/kodi] - fix building with ffmpeg 4.0 - rel 2
baggins
baggins at pld-linux.org
Tue May 1 12:49:00 CEST 2018
commit a59816c3e40a50ba0e03bebc486b83b6b72a34cb
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Tue May 1 12:48:46 2018 +0200
- fix building with ffmpeg 4.0
- rel 2
ffmpeg4.patch | 290 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
kodi.spec | 4 +-
2 files changed, 293 insertions(+), 1 deletion(-)
---
diff --git a/kodi.spec b/kodi.spec
index 2e41897..d159f21 100644
--- a/kodi.spec
+++ b/kodi.spec
@@ -56,7 +56,7 @@
Summary: Kodi is a free and open source media-player and entertainment hub
Name: kodi
Version: 17.6
-Release: 1
+Release: 2
License: GPL v2+ and GPL v3+
Group: Applications/Multimedia
#Source0: http://mirrors.kodi.tv/releases/source/%{version}-%{codename}.tar.gz
@@ -68,6 +68,7 @@ Patch2: dvdread.patch
Patch3: ffmpeg3.patch
Patch4: gcc5.patch
Patch5: libdvd.patch
+Patch6: ffmpeg4.patch
URL: http://kodi.tv/
BuildRequires: Mesa-libEGL-devel
BuildRequires: OpenGL-GLU-devel
@@ -190,6 +191,7 @@ all common digital media files from local and network storage media.
#%patch3 -p1
#%patch4 -p1
%{!?with_system_dvdread:%patch5 -p1}
+%patch6 -p1
#%{__rm} -r lib/cximage-6.0/zlib
#%{__rm} -r lib/libhdhomerun
diff --git a/ffmpeg4.patch b/ffmpeg4.patch
new file mode 100644
index 0000000..fe26280
--- /dev/null
+++ b/ffmpeg4.patch
@@ -0,0 +1,290 @@
+--- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp~ 2017-11-14 17:55:01.000000000 +0100
++++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp 2018-05-01 11:34:27.375469235 +0200
+@@ -82,8 +82,8 @@
+ m_pCodecContext->debug = 0;
+ m_pCodecContext->workaround_bugs = 1;
+
+- if (pCodec->capabilities & CODEC_CAP_TRUNCATED)
+- m_pCodecContext->flags |= CODEC_FLAG_TRUNCATED;
++ if (pCodec->capabilities & AV_CODEC_CAP_TRUNCATED)
++ m_pCodecContext->flags |= AV_CODEC_FLAG_TRUNCATED;
+
+ m_matrixEncoding = AV_MATRIX_ENCODING_NONE;
+ m_channels = 0;
+@@ -98,7 +98,7 @@
+
+ if( hints.extradata && hints.extrasize > 0 )
+ {
+- m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + FF_INPUT_BUFFER_PADDING_SIZE);
++ m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + AV_INPUT_BUFFER_PADDING_SIZE);
+ if(m_pCodecContext->extradata)
+ {
+ m_pCodecContext->extradata_size = hints.extrasize;
+--- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp~ 2017-11-14 17:55:01.000000000 +0100
++++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp 2018-05-01 11:43:04.599472804 +0200
+@@ -73,7 +73,7 @@
+ if( hints.extradata && hints.extrasize > 0 )
+ {
+ m_pCodecContext->extradata_size = hints.extrasize;
+- m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + FF_INPUT_BUFFER_PADDING_SIZE);
++ m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + AV_INPUT_BUFFER_PADDING_SIZE);
+ memcpy(m_pCodecContext->extradata, hints.extradata, hints.extrasize);
+
+ // start parsing of extra data - create a copy to be safe and make it zero-terminating to avoid access violations!
+--- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp.orig 2017-11-14 17:55:01.000000000 +0100
++++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp 2018-05-01 11:56:20.100550333 +0200
+@@ -382,16 +382,6 @@
+ else
+ m_decoderState = STATE_SW_SINGLE;
+
+-#if defined(TARGET_DARWIN_IOS)
+- // ffmpeg with enabled neon will crash and burn if this is enabled
+- m_pCodecContext->flags &= CODEC_FLAG_EMU_EDGE;
+-#else
+- if (pCodec->id != AV_CODEC_ID_H264 && pCodec->capabilities & CODEC_CAP_DR1
+- && pCodec->id != AV_CODEC_ID_VP8
+- )
+- m_pCodecContext->flags |= CODEC_FLAG_EMU_EDGE;
+-#endif
+-
+ // if we don't do this, then some codecs seem to fail.
+ m_pCodecContext->coded_height = hints.height;
+ m_pCodecContext->coded_width = hints.width;
+@@ -400,7 +390,7 @@
+ if( hints.extradata && hints.extrasize > 0 )
+ {
+ m_pCodecContext->extradata_size = hints.extrasize;
+- m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + FF_INPUT_BUFFER_PADDING_SIZE);
++ m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + AV_INPUT_BUFFER_PADDING_SIZE);
+ memcpy(m_pCodecContext->extradata, hints.extradata, hints.extrasize);
+ }
+
+@@ -885,6 +875,13 @@
+ int qscale_type;
+ pDvdVideoPicture->qp_table = av_frame_get_qp_table(m_pFrame, &pDvdVideoPicture->qstride, &qscale_type);
+
++#if LIBAVCODEC_VERSION_MAJOR >= 58
++#define FF_QSCALE_TYPE_MPEG1 0
++#define FF_QSCALE_TYPE_MPEG2 1
++#define FF_QSCALE_TYPE_H264 2
++#define FF_QSCALE_TYPE_VP56 3
++#endif
++
+ switch (qscale_type)
+ {
+ case FF_QSCALE_TYPE_MPEG1:
+@@ -989,8 +986,8 @@
+ return -1;
+ }
+
+- AVFilter* srcFilter = avfilter_get_by_name("buffer");
+- AVFilter* outFilter = avfilter_get_by_name("buffersink"); // should be last filter in the graph for now
++ const AVFilter* srcFilter = avfilter_get_by_name("buffer");
++ const AVFilter* outFilter = avfilter_get_by_name("buffersink"); // should be last filter in the graph for now
+
+ std::string args = StringUtils::Format("%d:%d:%d:%d:%d:%d:%d",
+ m_pCodecContext->width,
+--- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp~ 2017-11-14 17:55:01.000000000 +0100
++++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp 2018-05-01 11:57:01.334455188 +0200
+@@ -3090,8 +3090,8 @@
+ return false;
+ }
+
+- AVFilter* srcFilter = avfilter_get_by_name("buffer");
+- AVFilter* outFilter = avfilter_get_by_name("buffersink");
++ const AVFilter* srcFilter = avfilter_get_by_name("buffer");
++ const AVFilter* outFilter = avfilter_get_by_name("buffersink");
+
+ std::string args = StringUtils::Format("%d:%d:%d:%d:%d:%d:%d",
+ m_config.vidWidth,
+--- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp~ 2017-11-14 17:55:01.000000000 +0100
++++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp 2018-05-01 12:01:36.284929753 +0200
+@@ -78,7 +78,7 @@
+ {}
+ };
+
+-#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE)
++#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE)
+
+ std::string CDemuxStreamAudioFFmpeg::GetStreamName()
+ {
+@@ -1881,12 +1881,12 @@
+ // Found extradata, fill it in. This will cause
+ // a new stream to be created and used.
+ st->codec->extradata_size = i;
+- st->codec->extradata = (uint8_t*)av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
++ st->codec->extradata = (uint8_t*)av_malloc(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (st->codec->extradata)
+ {
+ CLog::Log(LOGDEBUG, "CDVDDemuxFFmpeg::Read() fetching extradata, extradata_size(%d)", st->codec->extradata_size);
+ memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size);
+- memset(st->codec->extradata + i, 0, FF_INPUT_BUFFER_PADDING_SIZE);
++ memset(st->codec->extradata + i, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+ }
+ else
+ {
+--- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp~ 2017-11-14 17:55:01.000000000 +0100
++++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp 2018-05-01 12:02:14.022118728 +0200
+@@ -25,7 +25,7 @@
+ #include "settings/Settings.h"
+ #include "../DVDClock.h"
+
+-#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE)
++#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE)
+
+
+ class CDemuxStreamClientInternal
+@@ -179,9 +179,9 @@
+ st->changes++;
+ st->disabled = false;
+ st->ExtraSize = len;
+- st->ExtraData = new uint8_t[len+FF_INPUT_BUFFER_PADDING_SIZE];
++ st->ExtraData = new uint8_t[len+AV_INPUT_BUFFER_PADDING_SIZE];
+ memcpy(st->ExtraData, pkt->pData, len);
+- memset((uint8_t*)st->ExtraData + len, 0 , FF_INPUT_BUFFER_PADDING_SIZE);
++ memset((uint8_t*)st->ExtraData + len, 0 , AV_INPUT_BUFFER_PADDING_SIZE);
+ stream->m_parser_split = false;
+ }
+ }
+--- xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp~ 2017-11-14 17:55:01.000000000 +0100
++++ xbmc-17.6-Krypton/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp 2018-05-01 12:02:36.792433855 +0200
+@@ -68,7 +68,7 @@
+ * Note, if the first 23 bits of the additional bytes are not 0 then damaged
+ * MPEG bitstreams could cause overread and segfault
+ */
+- pPacket->pData =(uint8_t*)_aligned_malloc(iDataSize + FF_INPUT_BUFFER_PADDING_SIZE, 16);
++ pPacket->pData =(uint8_t*)_aligned_malloc(iDataSize + AV_INPUT_BUFFER_PADDING_SIZE, 16);
+ if (!pPacket->pData)
+ {
+ FreeDemuxPacket(pPacket);
+@@ -76,7 +76,7 @@
+ }
+
+ // reset the last 8 bytes to 0;
+- memset(pPacket->pData + iDataSize, 0, FF_INPUT_BUFFER_PADDING_SIZE);
++ memset(pPacket->pData + iDataSize, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+ }
+
+ // setup defaults
+--- xbmc-17.6-Krypton/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp~ 2017-11-14 17:55:01.000000000 +0100
++++ xbmc-17.6-Krypton/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp 2018-05-01 12:03:59.533578761 +0200
+@@ -2955,7 +2955,7 @@
+ int fileSize = sound->GetFileSize();
+
+ fmt_ctx = avformat_alloc_context();
+- unsigned char* buffer = (unsigned char*)av_malloc(SOUNDBUFFER_SIZE+FF_INPUT_BUFFER_PADDING_SIZE);
++ unsigned char* buffer = (unsigned char*)av_malloc(SOUNDBUFFER_SIZE+AV_INPUT_BUFFER_PADDING_SIZE);
+ io_ctx = avio_alloc_context(buffer, SOUNDBUFFER_SIZE, 0,
+ sound, CActiveAESound::Read, NULL, CActiveAESound::Seek);
+ io_ctx->max_packet_size = sound->GetChunkSize();
+--- xbmc-17.6-Krypton/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h~ 2017-11-14 17:55:01.000000000 +0100
++++ xbmc-17.6-Krypton/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h 2018-05-01 12:04:52.404310213 +0200
+@@ -56,7 +56,7 @@
+ SwrContext *m_SwrCtx;
+ CAEChannelInfo m_Layout;
+ AVPacket m_Pkt;
+- uint8_t m_Buffer[8 + FF_MIN_BUFFER_SIZE];
++ uint8_t m_Buffer[8 + AV_INPUT_BUFFER_MIN_SIZE];
+ int m_BufferSize;
+ int m_OutputSize;
+ double m_OutputRatio;
+--- xbmc-17.6-Krypton/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp~ 2017-11-14 17:55:01.000000000 +0100
++++ xbmc-17.6-Krypton/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp 2018-05-01 12:06:10.788727810 +0200
+@@ -91,8 +91,8 @@
+ return false;
+ }
+
+- AVFilter* srcFilter = avfilter_get_by_name("abuffer");
+- AVFilter* outFilter = avfilter_get_by_name("abuffersink");
++ const AVFilter* srcFilter = avfilter_get_by_name("abuffer");
++ const AVFilter* outFilter = avfilter_get_by_name("abuffersink");
+
+ std::string args = StringUtils::Format("time_base=1/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%" PRIx64,
+ m_sampleRate,
+@@ -121,9 +121,7 @@
+
+ bool CActiveAEFilter::CreateAtempoFilter()
+ {
+- AVFilter *atempo;
+-
+- atempo = avfilter_get_by_name("atempo");
++ const AVFilter* atempo = avfilter_get_by_name("atempo");
+ m_pFilterCtxAtempo = avfilter_graph_alloc_filter(m_pFilterGraph, atempo, "atempo");
+ std::string args = StringUtils::Format("tempo=%f", m_tempo);
+ int ret = avfilter_init_str(m_pFilterCtxAtempo, args.c_str());
+--- xbmc-17.6-Krypton/xbmc/cdrip/EncoderFFmpeg.cpp~ 2017-11-14 17:55:01.000000000 +0100
++++ xbmc-17.6-Krypton/xbmc/cdrip/EncoderFFmpeg.cpp 2018-05-01 12:25:36.631509834 +0200
+@@ -119,8 +119,8 @@
+
+ if(m_Format->oformat->flags & AVFMT_GLOBALHEADER)
+ {
+- m_CodecCtx->flags |= CODEC_FLAG_GLOBAL_HEADER;
+- m_Format->flags |= CODEC_FLAG_GLOBAL_HEADER;
++ m_CodecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
++ m_Format->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+ }
+
+ switch(m_iInBitsPerSample)
+--- xbmc-17.6-Krypton/xbmc/utils/BitstreamConverter.cpp~ 2017-11-14 17:55:01.000000000 +0100
++++ xbmc-17.6-Krypton/xbmc/utils/BitstreamConverter.cpp 2018-05-01 12:28:47.337478450 +0200
+@@ -686,13 +686,13 @@
+ unit_size = extradata[0] << 8 | extradata[1];
+ total_size += unit_size + 4;
+
+- if (total_size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE ||
++ if (total_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE ||
+ (extradata + 2 + unit_size) > ((uint8_t*)in_extradata + in_extrasize))
+ {
+ av_free(out);
+ return false;
+ }
+- tmp = av_realloc(out, total_size + FF_INPUT_BUFFER_PADDING_SIZE);
++ tmp = av_realloc(out, total_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (!tmp)
+ {
+ av_free(out);
+@@ -713,7 +713,7 @@
+ }
+
+ if (out)
+- memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
++ memset(out + total_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+
+ if (!sps_seen)
+ CLog::Log(LOGDEBUG, "SPS NALU missing or invalid. The resulting stream may not play");
+@@ -776,13 +776,13 @@
+ }
+ total_size += unit_size + 4;
+
+- if (total_size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE ||
++ if (total_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE ||
+ (extradata + unit_size) > ((uint8_t*)in_extradata + in_extrasize))
+ {
+ av_free(out);
+ return false;
+ }
+- tmp = av_realloc(out, total_size + FF_INPUT_BUFFER_PADDING_SIZE);
++ tmp = av_realloc(out, total_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (!tmp)
+ {
+ av_free(out);
+@@ -796,7 +796,7 @@
+ }
+
+ if (out)
+- memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
++ memset(out + total_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+
+ if (!sps_seen)
+ CLog::Log(LOGDEBUG, "SPS NALU missing or invalid. The resulting stream may not play");
+--- xbmc-17.6-Krypton/xbmc/guilib/FFmpegImage.cpp~ 2017-11-14 17:55:01.000000000 +0100
++++ xbmc-17.6-Krypton/xbmc/guilib/FFmpegImage.cpp 2018-05-01 12:31:41.013211670 +0200
+@@ -551,7 +551,7 @@
+ tdm.avOutctx->time_base.num = 1;
+ tdm.avOutctx->time_base.den = 1;
+ tdm.avOutctx->pix_fmt = jpg_output ? AV_PIX_FMT_YUVJ420P : AV_PIX_FMT_RGBA;
+- tdm.avOutctx->flags = CODEC_FLAG_QSCALE;
++ tdm.avOutctx->flags = AV_CODEC_FLAG_QSCALE;
+ tdm.avOutctx->mb_lmin = tdm.avOutctx->qmin * FF_QP2LAMBDA;
+ tdm.avOutctx->mb_lmax = tdm.avOutctx->qmax * FF_QP2LAMBDA;
+ tdm.avOutctx->global_quality = tdm.avOutctx->qmin * FF_QP2LAMBDA;
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/kodi.git/commitdiff/a59816c3e40a50ba0e03bebc486b83b6b72a34cb
More information about the pld-cvs-commit
mailing list