summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Andrews <candrews@gentoo.org>2019-02-17 21:59:41 -0500
committerCraig Andrews <candrews@gentoo.org>2019-02-17 21:59:41 -0500
commitb9b28fe5e5935dccc94539383cba437071a4254c (patch)
tree3ab877c4e92e8bc4133d157aa1f792b84e3ae70b /media-tv
parentmedia-libs/mlt: add vidstab use flag (diff)
downloadgentoo-b9b28fe5e5935dccc94539383cba437071a4254c.tar.gz
gentoo-b9b28fe5e5935dccc94539383cba437071a4254c.tar.bz2
gentoo-b9b28fe5e5935dccc94539383cba437071a4254c.zip
media-tv/kodi: ffmpeg 3.4.5 fixes, don't unbundle fonts
Bug: https://bugs.gentoo.org/678222 Closes: https://bugs.gentoo.org/669204 Package-Manager: Portage-2.3.60, Repoman-2.3.12 Signed-off-by: Craig Andrews <candrews@gentoo.org>
Diffstat (limited to 'media-tv')
-rw-r--r--media-tv/kodi/files/kodi-17-adapt-to-deprecated-symbols-and-functions.patch401
-rw-r--r--media-tv/kodi/files/kodi-17-fix-audio-with-latest-ffmpeg.patch15
-rw-r--r--media-tv/kodi/kodi-17.6-r10.ebuild278
3 files changed, 694 insertions, 0 deletions
diff --git a/media-tv/kodi/files/kodi-17-adapt-to-deprecated-symbols-and-functions.patch b/media-tv/kodi/files/kodi-17-adapt-to-deprecated-symbols-and-functions.patch
new file mode 100644
index 000000000000..0ec08810db5e
--- /dev/null
+++ b/media-tv/kodi/files/kodi-17-adapt-to-deprecated-symbols-and-functions.patch
@@ -0,0 +1,401 @@
+From 19f28e88a5dfed82e9844f69210f7c045f18ca8e Mon Sep 17 00:00:00 2001
+From: Rainer Hochecker <fernetmenta@online.de>
+Date: Wed, 1 Nov 2017 16:12:13 +0100
+Subject: [PATCH] ffmpeg: drop deprecated symbols and functions
+
+---
+ xbmc/cdrip/EncoderFFmpeg.cpp | 4 +-
+ .../AudioEngine/Encoders/AEEncoderFFmpeg.h | 2 +-
+ .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 2 +-
+ .../Engines/ActiveAE/ActiveAEFilter.cpp | 6 +--
+ .../DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp | 6 +--
+ .../Overlay/DVDOverlayCodecFFmpeg.cpp | 2 +-
+ .../DVDCodecs/Video/DVDVideoCodec.h | 1 +
+ .../DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 39 +++++--------------
+ .../DVDCodecs/Video/DVDVideoPPFFmpeg.cpp | 5 +--
+ .../VideoPlayer/DVDCodecs/Video/VAAPI.cpp | 4 +-
+ .../DVDDemuxers/DVDDemuxClient.cpp | 6 +--
+ .../DVDDemuxers/DVDDemuxFFmpeg.cpp | 6 +--
+ .../VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp | 4 +-
+ xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp | 1 -
+ xbmc/guilib/FFmpegImage.cpp | 4 +-
+ xbmc/utils/BitstreamConverter.cpp | 12 +++---
+ 16 files changed, 40 insertions(+), 64 deletions(-)
+
+Index: kodi-17.6+dfsg1/xbmc/cdrip/EncoderFFmpeg.cpp
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/cdrip/EncoderFFmpeg.cpp
++++ kodi-17.6+dfsg1/xbmc/cdrip/EncoderFFmpeg.cpp
+@@ -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)
+Index: kodi-17.6+dfsg1/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h
++++ kodi-17.6+dfsg1/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h
+@@ -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;
+Index: kodi-17.6+dfsg1/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
++++ kodi-17.6+dfsg1/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
+@@ -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();
+Index: kodi-17.6+dfsg1/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp
++++ kodi-17.6+dfsg1/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp
+@@ -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,7 +121,7 @@
+
+ bool CActiveAEFilter::CreateAtempoFilter()
+ {
+- AVFilter *atempo;
++ const AVFilter *atempo;
+
+ atempo = avfilter_get_by_name("atempo");
+ m_pFilterCtxAtempo = avfilter_graph_alloc_filter(m_pFilterGraph, atempo, "atempo");
+Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
+@@ -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;
+Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
+@@ -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!
+Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h
++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h
+@@ -118,6 +118,7 @@
+ int8_t* qp_table; //< Quantization parameters, primarily used by filters
+ int qstride;
+ int qscale_type;
++ int pict_type;
+
+ unsigned int iWidth;
+ unsigned int iHeight;
+Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
+@@ -171,7 +171,7 @@
+ ctx->SetHardware(NULL);
+ avctx->get_buffer2 = avcodec_default_get_buffer2;
+ avctx->slice_flags = 0;
+- avctx->hwaccel_context = 0;
++ av_buffer_unref(&avctx->hw_frames_ctx);
+ }
+
+ const AVPixelFormat * cur = fmt;
+@@ -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);
+ }
+
+@@ -791,6 +781,7 @@
+ m_droppedFrames = 0;
+ m_iLastKeyframe = m_pCodecContext->has_b_frames;
+ avcodec_flush_buffers(m_pCodecContext);
++ av_frame_unref(m_pFrame);
+
+ if (m_pHardware)
+ m_pHardware->Reset();
+@@ -883,22 +874,10 @@
+ pDvdVideoPicture->color_range = 0;
+
+ int qscale_type;
+- pDvdVideoPicture->qp_table = av_frame_get_qp_table(m_pFrame, &pDvdVideoPicture->qstride, &qscale_type);
+-
+- switch (qscale_type)
+- {
+- case FF_QSCALE_TYPE_MPEG1:
+- pDvdVideoPicture->qscale_type = DVP_QSCALE_MPEG1;
+- break;
+- case FF_QSCALE_TYPE_MPEG2:
+- pDvdVideoPicture->qscale_type = DVP_QSCALE_MPEG2;
+- break;
+- case FF_QSCALE_TYPE_H264:
+- pDvdVideoPicture->qscale_type = DVP_QSCALE_H264;
+- break;
+- default:
+- pDvdVideoPicture->qscale_type = DVP_QSCALE_UNKNOWN;
+- }
++ pDvdVideoPicture->qp_table = av_frame_get_qp_table(m_pFrame,
++ &pDvdVideoPicture->qstride,
++ &pDvdVideoPicture->qscale_type);
++ pDvdVideoPicture->pict_type = m_pFrame->pict_type;
+
+ if (pDvdVideoPicture->iRepeatPicture)
+ pDvdVideoPicture->dts = DVD_NOPTS_VALUE;
+@@ -989,8 +968,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,
+Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp
++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp
+@@ -132,15 +132,12 @@
+ }
+ }
+
+- int pict_type = (m_pSource->qscale_type != DVP_QSCALE_MPEG1) ?
+- PP_PICT_TYPE_QP2 : 0;
+-
+ pp_postprocess((const uint8_t**)m_pSource->data, m_pSource->iLineSize,
+ m_pTarget->data, m_pTarget->iLineSize,
+ m_pSource->iWidth, m_pSource->iHeight,
+ m_pSource->qp_table, m_pSource->qstride,
+ m_pMode, m_pContext,
+- pict_type); //m_pSource->iFrameType);
++ m_pSource->pict_type | m_pSource->qscale_type ? PP_PICT_TYPE_QP2 : 0);
+
+ //Copy frame information over to target, but make sure it is set as allocated should decoder have forgotten
+ m_pTarget->iFlags = m_pSource->iFlags | DVP_FLAG_ALLOCATED;
+Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
+@@ -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,
+Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
+@@ -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;
+ }
+ }
+Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+@@ -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
+ {
+Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp
++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp
+@@ -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
+Index: kodi-17.6+dfsg1/xbmc/guilib/FFmpegImage.cpp
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/guilib/FFmpegImage.cpp
++++ kodi-17.6+dfsg1/xbmc/guilib/FFmpegImage.cpp
+@@ -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;
+Index: kodi-17.6+dfsg1/xbmc/utils/BitstreamConverter.cpp
+===================================================================
+--- kodi-17.6+dfsg1.orig/xbmc/utils/BitstreamConverter.cpp
++++ kodi-17.6+dfsg1/xbmc/utils/BitstreamConverter.cpp
+@@ -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");
diff --git a/media-tv/kodi/files/kodi-17-fix-audio-with-latest-ffmpeg.patch b/media-tv/kodi/files/kodi-17-fix-audio-with-latest-ffmpeg.patch
new file mode 100644
index 000000000000..5f5e613bed2d
--- /dev/null
+++ b/media-tv/kodi/files/kodi-17-fix-audio-with-latest-ffmpeg.patch
@@ -0,0 +1,15 @@
+From: Stefan Hachmann <stefan@hachmann-it.de>
+To: 881536@bugs.debian.org
+Subject: Re: Bug#881536: ffmpeg: Breaks sound in kodi
+
+--- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
++++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
+@@ -486,7 +486,7 @@
+ // guess next pts
+ m_audioClock += audioframe.duration;
+
+- int ret = m_pAudioCodec->Decode(nullptr, 0, DVD_NOPTS_VALUE, DVD_NOPTS_VALUE);
++ int ret = 0;
+ if (ret < 0)
+ {
+ CLog::Log(LOGERROR, "CVideoPlayerAudio::DecodeFrame - Decode Error. Skipping audio packet (%d)", ret);
diff --git a/media-tv/kodi/kodi-17.6-r10.ebuild b/media-tv/kodi/kodi-17.6-r10.ebuild
new file mode 100644
index 000000000000..240a7f8fc808
--- /dev/null
+++ b/media-tv/kodi/kodi-17.6-r10.ebuild
@@ -0,0 +1,278 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+# Does not work with py3 here
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="sqlite"
+
+inherit autotools cmake-utils eutils linux-info pax-utils python-single-r1 versionator
+
+LIBDVDCSS_COMMIT="2f12236bc1c92f73c21e973363f79eb300de603f"
+LIBDVDREAD_COMMIT="17d99db97e7b8f23077b342369d3c22a6250affd"
+LIBDVDNAV_COMMIT="43b5f81f5fe30bceae3b7cecf2b0ca57fc930dac"
+FFMPEG_VERSION="3.1.11"
+FFMPEG_KODI_VERSION="17.5"
+CODENAME="Krypton"
+PATCHES=(
+ "${FILESDIR}/${P}-nmblookup.patch"
+ "${FILESDIR}/${P}-wrapper.patch"
+ "${FILESDIR}/${PN}-17-adapt-to-deprecated-symbols-and-functions.patch"
+ "${FILESDIR}/${PN}-17-fix-audio-with-latest-ffmpeg.patch"
+)
+SRC_URI="https://github.com/xbmc/libdvdcss/archive/${LIBDVDCSS_COMMIT}.tar.gz -> libdvdcss-${LIBDVDCSS_COMMIT}.tar.gz
+ https://github.com/xbmc/libdvdread/archive/${LIBDVDREAD_COMMIT}.tar.gz -> libdvdread-${LIBDVDREAD_COMMIT}.tar.gz
+ https://github.com/xbmc/libdvdnav/archive/${LIBDVDNAV_COMMIT}.tar.gz -> libdvdnav-${LIBDVDNAV_COMMIT}.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 )"
+
+DESCRIPTION="A free and open source media-player and entertainment hub"
+HOMEPAGE="https://kodi.tv/ https://kodi.wiki/"
+
+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 debug dvd gles lcms libressl libusb lirc mariadb mysql nfs nonfree +opengl pulseaudio samba sftp systemd +system-ffmpeg test +udev udisks upnp upower vaapi vdpau webserver +xslt zeroconf"
+REQUIRED_USE="
+ ${PYTHON_REQUIRED_USE}
+ || ( gles opengl )
+ ?? ( mariadb mysql )
+ udev? ( !libusb )
+ udisks? ( dbus )
+ upower? ( dbus )
+"
+
+COMMON_DEPEND="${PYTHON_DEPS}
+ airplay? (
+ app-pda/libplist
+ net-libs/shairplay
+ )
+ alsa? ( media-libs/alsa-lib )
+ bluetooth? ( net-wireless/bluez )
+ bluray? ( >=media-libs/libbluray-0.7.0 )
+ caps? ( sys-libs/libcap )
+ dbus? ( sys-apps/dbus )
+ dev-db/sqlite
+ dev-libs/expat
+ dev-libs/fribidi
+ cec? ( >=dev-libs/libcec-4.0 )
+ dev-libs/libpcre[cxx]
+ dev-libs/libxml2
+ >=dev-libs/lzo-2.04
+ dev-libs/tinyxml[stl]
+ >=dev-libs/yajl-2
+ dev-python/pillow[${PYTHON_USEDEP}]
+ dev-libs/libcdio
+ gles? ( media-libs/mesa[gles2] )
+ lcms? ( media-libs/lcms:2 )
+ libusb? ( virtual/libusb:1 )
+ virtual/ttf-fonts
+ media-libs/fontconfig
+ media-libs/freetype
+ >=media-libs/libass-0.13.4
+ media-libs/mesa[egl]
+ >=media-libs/taglib-1.11.1
+ system-ffmpeg? (
+ >=media-video/ffmpeg-${FFMPEG_VERSION}:=[encode,openssl,postproc]
+ <media-video/ffmpeg-3.4
+ )
+ mysql? ( dev-db/mysql-connector-c:= )
+ mariadb? ( dev-db/mariadb-connector-c:=[mysqlcompat] )
+ >=net-misc/curl-7.51.0
+ nfs? ( net-fs/libnfs:= )
+ opengl? ( media-libs/glu )
+ !libressl? ( >=dev-libs/openssl-1.0.2j:0= )
+ libressl? ( dev-libs/libressl:0= )
+ pulseaudio? ( media-sound/pulseaudio )
+ samba? ( >=net-fs/samba-3.4.6[smbclient(+)] )
+ sftp? ( net-libs/libssh[sftp] )
+ sys-libs/zlib
+ udev? ( virtual/udev )
+ vaapi? ( x11-libs/libva:=[opengl] )
+ vdpau? (
+ || ( >=x11-libs/libvdpau-1.1 >=x11-drivers/nvidia-drivers-180.51 )
+ system-ffmpeg? ( media-video/ffmpeg[vdpau] )
+ )
+ webserver? ( >=net-libs/libmicrohttpd-0.9.50[messages] )
+ xslt? ( dev-libs/libxslt )
+ zeroconf? ( net-dns/avahi[dbus] )
+"
+RDEPEND="${COMMON_DEPEND}
+ lirc? (
+ || ( app-misc/lirc app-misc/inputlircd )
+ )
+ !media-tv/xbmc
+ udisks? ( sys-fs/udisks:0 )
+ upower? ( sys-power/upower )"
+
+DEPEND="${COMMON_DEPEND}
+ app-arch/bzip2
+ app-arch/unzip
+ app-arch/xz-utils
+ app-arch/zip
+ dev-lang/swig
+ dev-libs/crossguid
+ dev-util/cmake
+ dev-util/gperf
+ media-libs/giflib
+ >=media-libs/libjpeg-turbo-1.5.1:=
+ >=media-libs/libpng-1.6.26:0=
+ test? ( dev-cpp/gtest )
+ virtual/pkgconfig
+ x86? ( dev-lang/nasm )
+"
+case ${PV} in
+9999)
+ EGIT_REPO_URI="https://github.com/xbmc/xbmc.git"
+ inherit git-r3
+ # Force java for latest git version to avoid having to hand maintain the
+ # generated addons package. #488118
+ DEPEND+="
+ virtual/jre
+ "
+ ;;
+*)
+ MY_PV=${PV/_p/_r}
+ MY_PV=${MY_PV/_alpha/a}
+ MY_PV=${MY_PV/_beta/b}
+ MY_PV=${MY_PV/_rc/rc}
+ MY_P="${PN}-${MY_PV}"
+ SRC_URI+=" https://github.com/xbmc/xbmc/archive/${MY_PV}-${CODENAME}.tar.gz -> ${MY_P}.tar.gz
+ !java? ( https://github.com/candrews/gentoo-kodi/raw/master/${MY_P}-generated-addons.tar.xz )"
+ KEYWORDS="~amd64 ~x86"
+ IUSE+=" java"
+ DEPEND+="
+ java? ( virtual/jre )
+ "
+
+ S=${WORKDIR}/xbmc-${MY_PV}-${CODENAME}
+ ;;
+esac
+
+CONFIG_CHECK="~IP_MULTICAST"
+ERROR_IP_MULTICAST="
+In some cases Kodi needs to access multicast addresses.
+Please consider enabling IP_MULTICAST under Networking options.
+"
+
+CMAKE_USE_DIR=${S}/project/cmake/
+
+pkg_setup() {
+ check_extra_config
+ python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ if in_iuse java && use !java; then
+ eapply "${FILESDIR}"/${PN}-cmake-no-java.patch
+ fi
+ cmake-utils_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/linux/*.cpp || die
+
+ # Prepare tools and libs witch are configured with autotools during compile time
+ AUTOTOOLS_DIRS=(
+ "${S}"/lib/cpluff
+ "${S}"/tools/depends/native/TexturePacker/src
+ "${S}"/tools/depends/native/JsonSchemaBuilder/src
+ )
+
+ local d
+ for d in "${AUTOTOOLS_DIRS[@]}" ; do
+ pushd ${d} >/dev/null || die
+ AT_NOELIBTOOLIZE="yes" AT_TOPLEVEL_EAUTORECONF="yes" eautoreconf
+ popd >/dev/null || die
+ done
+ elibtoolize
+
+ # Prevent autoreconf rerun
+ sed -e 's/autoreconf -vif/echo "autoreconf already done in src_prepare()"/' -i \
+ "${S}"/project/cmake/modules/FindCpluff.cmake \
+ "${S}"/tools/depends/native/TexturePacker/src/autogen.sh \
+ "${S}"/tools/depends/native/JsonSchemaBuilder/src/autogen.sh \
+ || die
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -Ddocdir="${EPREFIX}/usr/share/doc/${PF}"
+ -DENABLE_LDGOLD=OFF # https://bugs.gentoo.org/show_bug.cgi?id=606124
+ -DENABLE_ALSA=$(usex alsa)
+ -DENABLE_AIRTUNES=$(usex airplay)
+ -DENABLE_AVAHI=$(usex zeroconf)
+ -DENABLE_BLUETOOTH=$(usex bluetooth)
+ -DENABLE_BLURAY=$(usex bluray)
+ -DENABLE_CCACHE=OFF
+ -DENABLE_CEC=$(usex cec)
+ -DENABLE_DBUS=$(usex dbus)
+ -DENABLE_DVDCSS=$(usex css)
+ -DENABLE_INTERNAL_CROSSGUID=OFF
+ -DENABLE_INTERNAL_FFMPEG="$(usex !system-ffmpeg)"
+ -DENABLE_CAP=$(usex caps)
+ -DENABLE_LCMS2=$(usex lcms)
+ -DENABLE_LIRC=$(usex lirc)
+ -DENABLE_MICROHTTPD=$(usex webserver)
+ -DENABLE_NFS=$(usex nfs)
+ -DENABLE_NONFREE=$(usex nonfree)
+ -DENABLE_OPENGLES=$(usex gles)
+ -DENABLE_OPENGL=$(usex opengl)
+ -DENABLE_OPENSSL=ON
+ -DENABLE_OPTICAL=$(usex dvd)
+ -DENABLE_PLIST=$(usex airplay)
+ -DENABLE_PULSEAUDIO=$(usex pulseaudio)
+ -DENABLE_SMBCLIENT=$(usex samba)
+ -DENABLE_SSH=$(usex sftp)
+ -DENABLE_UDEV=$(usex udev)
+ -DENABLE_UPNP=$(usex upnp)
+ -DENABLE_VAAPI=$(usex vaapi)
+ -DENABLE_VDPAU=$(usex vdpau)
+ -DENABLE_X11=ON
+ -DENABLE_XSLT=$(usex xslt)
+ -Dlibdvdread_URL="${DISTDIR}/libdvdread-${LIBDVDREAD_COMMIT}.tar.gz"
+ -Dlibdvdnav_URL="${DISTDIR}/libdvdnav-${LIBDVDNAV_COMMIT}.tar.gz"
+ -Dlibdvdcss_URL="${DISTDIR}/libdvdcss-${LIBDVDCSS_COMMIT}.tar.gz"
+ )
+
+ if use mysql || use mariadb ; then
+ mycmakeargs+=( -DENABLE_MYSQLCLIENT="yes" )
+ else
+ mycmakeargs+=( -DENABLE_MYSQLCLIENT="no" )
+ fi
+
+ use libusb && mycmakeargs+=( -DENABLE_LIBUSB=$(usex libusb) )
+
+ if use system-ffmpeg; then
+ mycmakeargs+=( -DWITH_FFMPEG="yes" )
+ else
+ mycmakeargs+=( -DFFMPEG_URL="${DISTDIR}/ffmpeg-${PN}-${FFMPEG_VERSION}-${CODENAME}-${FFMPEG_KODI_VERSION}.tar.gz" )
+ fi
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile all
+ use test && emake -C "${BUILD_DIR}" kodi-test
+}
+
+src_test() {
+ emake -C "${BUILD_DIR}" test
+}
+
+src_install() {
+ cmake-utils_src_install
+
+ pax-mark Em "${ED%/}"/usr/$(get_libdir)/${PN}/${PN}.bin
+
+ rm "${ED%/}"/usr/share/doc/*/{LICENSE.GPL,copying.txt}* || die
+
+ newicon media/icon48x48.png kodi.png
+
+ python_domodule tools/EventClients/lib/python/xbmcclient.py
+ python_newscript "tools/EventClients/Clients/Kodi Send/kodi-send.py" kodi-send
+}