Gentoo Archives: gentoo-commits

From: Craig Andrews <candrews@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-tv/kodi/files/, media-tv/kodi/
Date: Mon, 18 Feb 2019 03:01:50
Message-Id: 1550458781.b9b28fe5e5935dccc94539383cba437071a4254c.candrews@gentoo
1 commit: b9b28fe5e5935dccc94539383cba437071a4254c
2 Author: Craig Andrews <candrews <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 18 02:59:41 2019 +0000
4 Commit: Craig Andrews <candrews <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 18 02:59:41 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b9b28fe5
7
8 media-tv/kodi: ffmpeg 3.4.5 fixes, don't unbundle fonts
9
10 Bug: https://bugs.gentoo.org/678222
11 Closes: https://bugs.gentoo.org/669204
12 Package-Manager: Portage-2.3.60, Repoman-2.3.12
13 Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>
14
15 ...adapt-to-deprecated-symbols-and-functions.patch | 401 +++++++++++++++++++++
16 .../kodi-17-fix-audio-with-latest-ffmpeg.patch | 15 +
17 media-tv/kodi/kodi-17.6-r10.ebuild | 278 ++++++++++++++
18 3 files changed, 694 insertions(+)
19
20 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
21 new file mode 100644
22 index 00000000000..0ec08810db5
23 --- /dev/null
24 +++ b/media-tv/kodi/files/kodi-17-adapt-to-deprecated-symbols-and-functions.patch
25 @@ -0,0 +1,401 @@
26 +From 19f28e88a5dfed82e9844f69210f7c045f18ca8e Mon Sep 17 00:00:00 2001
27 +From: Rainer Hochecker <fernetmenta@××××××.de>
28 +Date: Wed, 1 Nov 2017 16:12:13 +0100
29 +Subject: [PATCH] ffmpeg: drop deprecated symbols and functions
30 +
31 +---
32 + xbmc/cdrip/EncoderFFmpeg.cpp | 4 +-
33 + .../AudioEngine/Encoders/AEEncoderFFmpeg.h | 2 +-
34 + .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 2 +-
35 + .../Engines/ActiveAE/ActiveAEFilter.cpp | 6 +--
36 + .../DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp | 6 +--
37 + .../Overlay/DVDOverlayCodecFFmpeg.cpp | 2 +-
38 + .../DVDCodecs/Video/DVDVideoCodec.h | 1 +
39 + .../DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 39 +++++--------------
40 + .../DVDCodecs/Video/DVDVideoPPFFmpeg.cpp | 5 +--
41 + .../VideoPlayer/DVDCodecs/Video/VAAPI.cpp | 4 +-
42 + .../DVDDemuxers/DVDDemuxClient.cpp | 6 +--
43 + .../DVDDemuxers/DVDDemuxFFmpeg.cpp | 6 +--
44 + .../VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp | 4 +-
45 + xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp | 1 -
46 + xbmc/guilib/FFmpegImage.cpp | 4 +-
47 + xbmc/utils/BitstreamConverter.cpp | 12 +++---
48 + 16 files changed, 40 insertions(+), 64 deletions(-)
49 +
50 +Index: kodi-17.6+dfsg1/xbmc/cdrip/EncoderFFmpeg.cpp
51 +===================================================================
52 +--- kodi-17.6+dfsg1.orig/xbmc/cdrip/EncoderFFmpeg.cpp
53 ++++ kodi-17.6+dfsg1/xbmc/cdrip/EncoderFFmpeg.cpp
54 +@@ -119,8 +119,8 @@
55 +
56 + if(m_Format->oformat->flags & AVFMT_GLOBALHEADER)
57 + {
58 +- m_CodecCtx->flags |= CODEC_FLAG_GLOBAL_HEADER;
59 +- m_Format->flags |= CODEC_FLAG_GLOBAL_HEADER;
60 ++ m_CodecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
61 ++ m_Format->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
62 + }
63 +
64 + switch(m_iInBitsPerSample)
65 +Index: kodi-17.6+dfsg1/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h
66 +===================================================================
67 +--- kodi-17.6+dfsg1.orig/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h
68 ++++ kodi-17.6+dfsg1/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h
69 +@@ -56,7 +56,7 @@
70 + SwrContext *m_SwrCtx;
71 + CAEChannelInfo m_Layout;
72 + AVPacket m_Pkt;
73 +- uint8_t m_Buffer[8 + FF_MIN_BUFFER_SIZE];
74 ++ uint8_t m_Buffer[8 + AV_INPUT_BUFFER_MIN_SIZE];
75 + int m_BufferSize;
76 + int m_OutputSize;
77 + double m_OutputRatio;
78 +Index: kodi-17.6+dfsg1/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
79 +===================================================================
80 +--- kodi-17.6+dfsg1.orig/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
81 ++++ kodi-17.6+dfsg1/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
82 +@@ -2955,7 +2955,7 @@
83 + int fileSize = sound->GetFileSize();
84 +
85 + fmt_ctx = avformat_alloc_context();
86 +- unsigned char* buffer = (unsigned char*)av_malloc(SOUNDBUFFER_SIZE+FF_INPUT_BUFFER_PADDING_SIZE);
87 ++ unsigned char* buffer = (unsigned char*)av_malloc(SOUNDBUFFER_SIZE+AV_INPUT_BUFFER_PADDING_SIZE);
88 + io_ctx = avio_alloc_context(buffer, SOUNDBUFFER_SIZE, 0,
89 + sound, CActiveAESound::Read, NULL, CActiveAESound::Seek);
90 + io_ctx->max_packet_size = sound->GetChunkSize();
91 +Index: kodi-17.6+dfsg1/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp
92 +===================================================================
93 +--- kodi-17.6+dfsg1.orig/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp
94 ++++ kodi-17.6+dfsg1/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp
95 +@@ -91,8 +91,8 @@
96 + return false;
97 + }
98 +
99 +- AVFilter* srcFilter = avfilter_get_by_name("abuffer");
100 +- AVFilter* outFilter = avfilter_get_by_name("abuffersink");
101 ++ const AVFilter* srcFilter = avfilter_get_by_name("abuffer");
102 ++ const AVFilter* outFilter = avfilter_get_by_name("abuffersink");
103 +
104 + std::string args = StringUtils::Format("time_base=1/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%" PRIx64,
105 + m_sampleRate,
106 +@@ -121,7 +121,7 @@
107 +
108 + bool CActiveAEFilter::CreateAtempoFilter()
109 + {
110 +- AVFilter *atempo;
111 ++ const AVFilter *atempo;
112 +
113 + atempo = avfilter_get_by_name("atempo");
114 + m_pFilterCtxAtempo = avfilter_graph_alloc_filter(m_pFilterGraph, atempo, "atempo");
115 +Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
116 +===================================================================
117 +--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
118 ++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
119 +@@ -82,8 +82,8 @@
120 + m_pCodecContext->debug = 0;
121 + m_pCodecContext->workaround_bugs = 1;
122 +
123 +- if (pCodec->capabilities & CODEC_CAP_TRUNCATED)
124 +- m_pCodecContext->flags |= CODEC_FLAG_TRUNCATED;
125 ++ if (pCodec->capabilities & AV_CODEC_CAP_TRUNCATED)
126 ++ m_pCodecContext->flags |= AV_CODEC_FLAG_TRUNCATED;
127 +
128 + m_matrixEncoding = AV_MATRIX_ENCODING_NONE;
129 + m_channels = 0;
130 +@@ -98,7 +98,7 @@
131 +
132 + if( hints.extradata && hints.extrasize > 0 )
133 + {
134 +- m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + FF_INPUT_BUFFER_PADDING_SIZE);
135 ++ m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + AV_INPUT_BUFFER_PADDING_SIZE);
136 + if(m_pCodecContext->extradata)
137 + {
138 + m_pCodecContext->extradata_size = hints.extrasize;
139 +Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
140 +===================================================================
141 +--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
142 ++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
143 +@@ -73,7 +73,7 @@
144 + if( hints.extradata && hints.extrasize > 0 )
145 + {
146 + m_pCodecContext->extradata_size = hints.extrasize;
147 +- m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + FF_INPUT_BUFFER_PADDING_SIZE);
148 ++ m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + AV_INPUT_BUFFER_PADDING_SIZE);
149 + memcpy(m_pCodecContext->extradata, hints.extradata, hints.extrasize);
150 +
151 + // start parsing of extra data - create a copy to be safe and make it zero-terminating to avoid access violations!
152 +Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h
153 +===================================================================
154 +--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h
155 ++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h
156 +@@ -118,6 +118,7 @@
157 + int8_t* qp_table; //< Quantization parameters, primarily used by filters
158 + int qstride;
159 + int qscale_type;
160 ++ int pict_type;
161 +
162 + unsigned int iWidth;
163 + unsigned int iHeight;
164 +Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
165 +===================================================================
166 +--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
167 ++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
168 +@@ -171,7 +171,7 @@
169 + ctx->SetHardware(NULL);
170 + avctx->get_buffer2 = avcodec_default_get_buffer2;
171 + avctx->slice_flags = 0;
172 +- avctx->hwaccel_context = 0;
173 ++ av_buffer_unref(&avctx->hw_frames_ctx);
174 + }
175 +
176 + const AVPixelFormat * cur = fmt;
177 +@@ -382,16 +382,6 @@
178 + else
179 + m_decoderState = STATE_SW_SINGLE;
180 +
181 +-#if defined(TARGET_DARWIN_IOS)
182 +- // ffmpeg with enabled neon will crash and burn if this is enabled
183 +- m_pCodecContext->flags &= CODEC_FLAG_EMU_EDGE;
184 +-#else
185 +- if (pCodec->id != AV_CODEC_ID_H264 && pCodec->capabilities & CODEC_CAP_DR1
186 +- && pCodec->id != AV_CODEC_ID_VP8
187 +- )
188 +- m_pCodecContext->flags |= CODEC_FLAG_EMU_EDGE;
189 +-#endif
190 +-
191 + // if we don't do this, then some codecs seem to fail.
192 + m_pCodecContext->coded_height = hints.height;
193 + m_pCodecContext->coded_width = hints.width;
194 +@@ -400,7 +390,7 @@
195 + if( hints.extradata && hints.extrasize > 0 )
196 + {
197 + m_pCodecContext->extradata_size = hints.extrasize;
198 +- m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + FF_INPUT_BUFFER_PADDING_SIZE);
199 ++ m_pCodecContext->extradata = (uint8_t*)av_mallocz(hints.extrasize + AV_INPUT_BUFFER_PADDING_SIZE);
200 + memcpy(m_pCodecContext->extradata, hints.extradata, hints.extrasize);
201 + }
202 +
203 +@@ -791,6 +781,7 @@
204 + m_droppedFrames = 0;
205 + m_iLastKeyframe = m_pCodecContext->has_b_frames;
206 + avcodec_flush_buffers(m_pCodecContext);
207 ++ av_frame_unref(m_pFrame);
208 +
209 + if (m_pHardware)
210 + m_pHardware->Reset();
211 +@@ -883,22 +874,10 @@
212 + pDvdVideoPicture->color_range = 0;
213 +
214 + int qscale_type;
215 +- pDvdVideoPicture->qp_table = av_frame_get_qp_table(m_pFrame, &pDvdVideoPicture->qstride, &qscale_type);
216 +-
217 +- switch (qscale_type)
218 +- {
219 +- case FF_QSCALE_TYPE_MPEG1:
220 +- pDvdVideoPicture->qscale_type = DVP_QSCALE_MPEG1;
221 +- break;
222 +- case FF_QSCALE_TYPE_MPEG2:
223 +- pDvdVideoPicture->qscale_type = DVP_QSCALE_MPEG2;
224 +- break;
225 +- case FF_QSCALE_TYPE_H264:
226 +- pDvdVideoPicture->qscale_type = DVP_QSCALE_H264;
227 +- break;
228 +- default:
229 +- pDvdVideoPicture->qscale_type = DVP_QSCALE_UNKNOWN;
230 +- }
231 ++ pDvdVideoPicture->qp_table = av_frame_get_qp_table(m_pFrame,
232 ++ &pDvdVideoPicture->qstride,
233 ++ &pDvdVideoPicture->qscale_type);
234 ++ pDvdVideoPicture->pict_type = m_pFrame->pict_type;
235 +
236 + if (pDvdVideoPicture->iRepeatPicture)
237 + pDvdVideoPicture->dts = DVD_NOPTS_VALUE;
238 +@@ -989,8 +968,8 @@
239 + return -1;
240 + }
241 +
242 +- AVFilter* srcFilter = avfilter_get_by_name("buffer");
243 +- AVFilter* outFilter = avfilter_get_by_name("buffersink"); // should be last filter in the graph for now
244 ++ const AVFilter* srcFilter = avfilter_get_by_name("buffer");
245 ++ const AVFilter* outFilter = avfilter_get_by_name("buffersink"); // should be last filter in the graph for now
246 +
247 + std::string args = StringUtils::Format("%d:%d:%d:%d:%d:%d:%d",
248 + m_pCodecContext->width,
249 +Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp
250 +===================================================================
251 +--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp
252 ++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp
253 +@@ -132,15 +132,12 @@
254 + }
255 + }
256 +
257 +- int pict_type = (m_pSource->qscale_type != DVP_QSCALE_MPEG1) ?
258 +- PP_PICT_TYPE_QP2 : 0;
259 +-
260 + pp_postprocess((const uint8_t**)m_pSource->data, m_pSource->iLineSize,
261 + m_pTarget->data, m_pTarget->iLineSize,
262 + m_pSource->iWidth, m_pSource->iHeight,
263 + m_pSource->qp_table, m_pSource->qstride,
264 + m_pMode, m_pContext,
265 +- pict_type); //m_pSource->iFrameType);
266 ++ m_pSource->pict_type | m_pSource->qscale_type ? PP_PICT_TYPE_QP2 : 0);
267 +
268 + //Copy frame information over to target, but make sure it is set as allocated should decoder have forgotten
269 + m_pTarget->iFlags = m_pSource->iFlags | DVP_FLAG_ALLOCATED;
270 +Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
271 +===================================================================
272 +--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
273 ++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
274 +@@ -3090,8 +3090,8 @@
275 + return false;
276 + }
277 +
278 +- AVFilter* srcFilter = avfilter_get_by_name("buffer");
279 +- AVFilter* outFilter = avfilter_get_by_name("buffersink");
280 ++ const AVFilter* srcFilter = avfilter_get_by_name("buffer");
281 ++ const AVFilter* outFilter = avfilter_get_by_name("buffersink");
282 +
283 + std::string args = StringUtils::Format("%d:%d:%d:%d:%d:%d:%d",
284 + m_config.vidWidth,
285 +Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
286 +===================================================================
287 +--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
288 ++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
289 +@@ -25,7 +25,7 @@
290 + #include "settings/Settings.h"
291 + #include "../DVDClock.h"
292 +
293 +-#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE)
294 ++#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE)
295 +
296 +
297 + class CDemuxStreamClientInternal
298 +@@ -179,9 +179,9 @@
299 + st->changes++;
300 + st->disabled = false;
301 + st->ExtraSize = len;
302 +- st->ExtraData = new uint8_t[len+FF_INPUT_BUFFER_PADDING_SIZE];
303 ++ st->ExtraData = new uint8_t[len+AV_INPUT_BUFFER_PADDING_SIZE];
304 + memcpy(st->ExtraData, pkt->pData, len);
305 +- memset((uint8_t*)st->ExtraData + len, 0 , FF_INPUT_BUFFER_PADDING_SIZE);
306 ++ memset((uint8_t*)st->ExtraData + len, 0 , AV_INPUT_BUFFER_PADDING_SIZE);
307 + stream->m_parser_split = false;
308 + }
309 + }
310 +Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
311 +===================================================================
312 +--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
313 ++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
314 +@@ -78,7 +78,7 @@
315 + {}
316 + };
317 +
318 +-#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE)
319 ++#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE)
320 +
321 + std::string CDemuxStreamAudioFFmpeg::GetStreamName()
322 + {
323 +@@ -1881,12 +1881,12 @@
324 + // Found extradata, fill it in. This will cause
325 + // a new stream to be created and used.
326 + st->codec->extradata_size = i;
327 +- st->codec->extradata = (uint8_t*)av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
328 ++ st->codec->extradata = (uint8_t*)av_malloc(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
329 + if (st->codec->extradata)
330 + {
331 + CLog::Log(LOGDEBUG, "CDVDDemuxFFmpeg::Read() fetching extradata, extradata_size(%d)", st->codec->extradata_size);
332 + memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size);
333 +- memset(st->codec->extradata + i, 0, FF_INPUT_BUFFER_PADDING_SIZE);
334 ++ memset(st->codec->extradata + i, 0, AV_INPUT_BUFFER_PADDING_SIZE);
335 + }
336 + else
337 + {
338 +Index: kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp
339 +===================================================================
340 +--- kodi-17.6+dfsg1.orig/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp
341 ++++ kodi-17.6+dfsg1/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp
342 +@@ -68,7 +68,7 @@
343 + * Note, if the first 23 bits of the additional bytes are not 0 then damaged
344 + * MPEG bitstreams could cause overread and segfault
345 + */
346 +- pPacket->pData =(uint8_t*)_aligned_malloc(iDataSize + FF_INPUT_BUFFER_PADDING_SIZE, 16);
347 ++ pPacket->pData =(uint8_t*)_aligned_malloc(iDataSize + AV_INPUT_BUFFER_PADDING_SIZE, 16);
348 + if (!pPacket->pData)
349 + {
350 + FreeDemuxPacket(pPacket);
351 +@@ -76,7 +76,7 @@
352 + }
353 +
354 + // reset the last 8 bytes to 0;
355 +- memset(pPacket->pData + iDataSize, 0, FF_INPUT_BUFFER_PADDING_SIZE);
356 ++ memset(pPacket->pData + iDataSize, 0, AV_INPUT_BUFFER_PADDING_SIZE);
357 + }
358 +
359 + // setup defaults
360 +Index: kodi-17.6+dfsg1/xbmc/guilib/FFmpegImage.cpp
361 +===================================================================
362 +--- kodi-17.6+dfsg1.orig/xbmc/guilib/FFmpegImage.cpp
363 ++++ kodi-17.6+dfsg1/xbmc/guilib/FFmpegImage.cpp
364 +@@ -551,7 +551,7 @@
365 + tdm.avOutctx->time_base.num = 1;
366 + tdm.avOutctx->time_base.den = 1;
367 + tdm.avOutctx->pix_fmt = jpg_output ? AV_PIX_FMT_YUVJ420P : AV_PIX_FMT_RGBA;
368 +- tdm.avOutctx->flags = CODEC_FLAG_QSCALE;
369 ++ tdm.avOutctx->flags = AV_CODEC_FLAG_QSCALE;
370 + tdm.avOutctx->mb_lmin = tdm.avOutctx->qmin * FF_QP2LAMBDA;
371 + tdm.avOutctx->mb_lmax = tdm.avOutctx->qmax * FF_QP2LAMBDA;
372 + tdm.avOutctx->global_quality = tdm.avOutctx->qmin * FF_QP2LAMBDA;
373 +Index: kodi-17.6+dfsg1/xbmc/utils/BitstreamConverter.cpp
374 +===================================================================
375 +--- kodi-17.6+dfsg1.orig/xbmc/utils/BitstreamConverter.cpp
376 ++++ kodi-17.6+dfsg1/xbmc/utils/BitstreamConverter.cpp
377 +@@ -686,13 +686,13 @@
378 + unit_size = extradata[0] << 8 | extradata[1];
379 + total_size += unit_size + 4;
380 +
381 +- if (total_size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE ||
382 ++ if (total_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE ||
383 + (extradata + 2 + unit_size) > ((uint8_t*)in_extradata + in_extrasize))
384 + {
385 + av_free(out);
386 + return false;
387 + }
388 +- tmp = av_realloc(out, total_size + FF_INPUT_BUFFER_PADDING_SIZE);
389 ++ tmp = av_realloc(out, total_size + AV_INPUT_BUFFER_PADDING_SIZE);
390 + if (!tmp)
391 + {
392 + av_free(out);
393 +@@ -713,7 +713,7 @@
394 + }
395 +
396 + if (out)
397 +- memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
398 ++ memset(out + total_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
399 +
400 + if (!sps_seen)
401 + CLog::Log(LOGDEBUG, "SPS NALU missing or invalid. The resulting stream may not play");
402 +@@ -776,13 +776,13 @@
403 + }
404 + total_size += unit_size + 4;
405 +
406 +- if (total_size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE ||
407 ++ if (total_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE ||
408 + (extradata + unit_size) > ((uint8_t*)in_extradata + in_extrasize))
409 + {
410 + av_free(out);
411 + return false;
412 + }
413 +- tmp = av_realloc(out, total_size + FF_INPUT_BUFFER_PADDING_SIZE);
414 ++ tmp = av_realloc(out, total_size + AV_INPUT_BUFFER_PADDING_SIZE);
415 + if (!tmp)
416 + {
417 + av_free(out);
418 +@@ -796,7 +796,7 @@
419 + }
420 +
421 + if (out)
422 +- memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
423 ++ memset(out + total_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
424 +
425 + if (!sps_seen)
426 + CLog::Log(LOGDEBUG, "SPS NALU missing or invalid. The resulting stream may not play");
427
428 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
429 new file mode 100644
430 index 00000000000..5f5e613bed2
431 --- /dev/null
432 +++ b/media-tv/kodi/files/kodi-17-fix-audio-with-latest-ffmpeg.patch
433 @@ -0,0 +1,15 @@
434 +From: Stefan Hachmann <stefan@×××××××××××.de>
435 +To: 881536@×××××××××××.org
436 +Subject: Re: Bug#881536: ffmpeg: Breaks sound in kodi
437 +
438 +--- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
439 ++++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
440 +@@ -486,7 +486,7 @@
441 + // guess next pts
442 + m_audioClock += audioframe.duration;
443 +
444 +- int ret = m_pAudioCodec->Decode(nullptr, 0, DVD_NOPTS_VALUE, DVD_NOPTS_VALUE);
445 ++ int ret = 0;
446 + if (ret < 0)
447 + {
448 + CLog::Log(LOGERROR, "CVideoPlayerAudio::DecodeFrame - Decode Error. Skipping audio packet (%d)", ret);
449
450 diff --git a/media-tv/kodi/kodi-17.6-r10.ebuild b/media-tv/kodi/kodi-17.6-r10.ebuild
451 new file mode 100644
452 index 00000000000..240a7f8fc80
453 --- /dev/null
454 +++ b/media-tv/kodi/kodi-17.6-r10.ebuild
455 @@ -0,0 +1,278 @@
456 +# Copyright 1999-2019 Gentoo Authors
457 +# Distributed under the terms of the GNU General Public License v2
458 +
459 +EAPI=6
460 +
461 +# Does not work with py3 here
462 +PYTHON_COMPAT=( python2_7 )
463 +PYTHON_REQ_USE="sqlite"
464 +
465 +inherit autotools cmake-utils eutils linux-info pax-utils python-single-r1 versionator
466 +
467 +LIBDVDCSS_COMMIT="2f12236bc1c92f73c21e973363f79eb300de603f"
468 +LIBDVDREAD_COMMIT="17d99db97e7b8f23077b342369d3c22a6250affd"
469 +LIBDVDNAV_COMMIT="43b5f81f5fe30bceae3b7cecf2b0ca57fc930dac"
470 +FFMPEG_VERSION="3.1.11"
471 +FFMPEG_KODI_VERSION="17.5"
472 +CODENAME="Krypton"
473 +PATCHES=(
474 + "${FILESDIR}/${P}-nmblookup.patch"
475 + "${FILESDIR}/${P}-wrapper.patch"
476 + "${FILESDIR}/${PN}-17-adapt-to-deprecated-symbols-and-functions.patch"
477 + "${FILESDIR}/${PN}-17-fix-audio-with-latest-ffmpeg.patch"
478 +)
479 +SRC_URI="https://github.com/xbmc/libdvdcss/archive/${LIBDVDCSS_COMMIT}.tar.gz -> libdvdcss-${LIBDVDCSS_COMMIT}.tar.gz
480 + https://github.com/xbmc/libdvdread/archive/${LIBDVDREAD_COMMIT}.tar.gz -> libdvdread-${LIBDVDREAD_COMMIT}.tar.gz
481 + https://github.com/xbmc/libdvdnav/archive/${LIBDVDNAV_COMMIT}.tar.gz -> libdvdnav-${LIBDVDNAV_COMMIT}.tar.gz
482 + !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 )"
483 +
484 +DESCRIPTION="A free and open source media-player and entertainment hub"
485 +HOMEPAGE="https://kodi.tv/ https://kodi.wiki/"
486 +
487 +LICENSE="GPL-2"
488 +SLOT="0"
489 +# use flag is called libusb so that it doesn't fool people in thinking that
490 +# it is _required_ for USB support. Otherwise they'll disable udev and
491 +# that's going to be worse.
492 +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"
493 +REQUIRED_USE="
494 + ${PYTHON_REQUIRED_USE}
495 + || ( gles opengl )
496 + ?? ( mariadb mysql )
497 + udev? ( !libusb )
498 + udisks? ( dbus )
499 + upower? ( dbus )
500 +"
501 +
502 +COMMON_DEPEND="${PYTHON_DEPS}
503 + airplay? (
504 + app-pda/libplist
505 + net-libs/shairplay
506 + )
507 + alsa? ( media-libs/alsa-lib )
508 + bluetooth? ( net-wireless/bluez )
509 + bluray? ( >=media-libs/libbluray-0.7.0 )
510 + caps? ( sys-libs/libcap )
511 + dbus? ( sys-apps/dbus )
512 + dev-db/sqlite
513 + dev-libs/expat
514 + dev-libs/fribidi
515 + cec? ( >=dev-libs/libcec-4.0 )
516 + dev-libs/libpcre[cxx]
517 + dev-libs/libxml2
518 + >=dev-libs/lzo-2.04
519 + dev-libs/tinyxml[stl]
520 + >=dev-libs/yajl-2
521 + dev-python/pillow[${PYTHON_USEDEP}]
522 + dev-libs/libcdio
523 + gles? ( media-libs/mesa[gles2] )
524 + lcms? ( media-libs/lcms:2 )
525 + libusb? ( virtual/libusb:1 )
526 + virtual/ttf-fonts
527 + media-libs/fontconfig
528 + media-libs/freetype
529 + >=media-libs/libass-0.13.4
530 + media-libs/mesa[egl]
531 + >=media-libs/taglib-1.11.1
532 + system-ffmpeg? (
533 + >=media-video/ffmpeg-${FFMPEG_VERSION}:=[encode,openssl,postproc]
534 + <media-video/ffmpeg-3.4
535 + )
536 + mysql? ( dev-db/mysql-connector-c:= )
537 + mariadb? ( dev-db/mariadb-connector-c:=[mysqlcompat] )
538 + >=net-misc/curl-7.51.0
539 + nfs? ( net-fs/libnfs:= )
540 + opengl? ( media-libs/glu )
541 + !libressl? ( >=dev-libs/openssl-1.0.2j:0= )
542 + libressl? ( dev-libs/libressl:0= )
543 + pulseaudio? ( media-sound/pulseaudio )
544 + samba? ( >=net-fs/samba-3.4.6[smbclient(+)] )
545 + sftp? ( net-libs/libssh[sftp] )
546 + sys-libs/zlib
547 + udev? ( virtual/udev )
548 + vaapi? ( x11-libs/libva:=[opengl] )
549 + vdpau? (
550 + || ( >=x11-libs/libvdpau-1.1 >=x11-drivers/nvidia-drivers-180.51 )
551 + system-ffmpeg? ( media-video/ffmpeg[vdpau] )
552 + )
553 + webserver? ( >=net-libs/libmicrohttpd-0.9.50[messages] )
554 + xslt? ( dev-libs/libxslt )
555 + zeroconf? ( net-dns/avahi[dbus] )
556 +"
557 +RDEPEND="${COMMON_DEPEND}
558 + lirc? (
559 + || ( app-misc/lirc app-misc/inputlircd )
560 + )
561 + !media-tv/xbmc
562 + udisks? ( sys-fs/udisks:0 )
563 + upower? ( sys-power/upower )"
564 +
565 +DEPEND="${COMMON_DEPEND}
566 + app-arch/bzip2
567 + app-arch/unzip
568 + app-arch/xz-utils
569 + app-arch/zip
570 + dev-lang/swig
571 + dev-libs/crossguid
572 + dev-util/cmake
573 + dev-util/gperf
574 + media-libs/giflib
575 + >=media-libs/libjpeg-turbo-1.5.1:=
576 + >=media-libs/libpng-1.6.26:0=
577 + test? ( dev-cpp/gtest )
578 + virtual/pkgconfig
579 + x86? ( dev-lang/nasm )
580 +"
581 +case ${PV} in
582 +9999)
583 + EGIT_REPO_URI="https://github.com/xbmc/xbmc.git"
584 + inherit git-r3
585 + # Force java for latest git version to avoid having to hand maintain the
586 + # generated addons package. #488118
587 + DEPEND+="
588 + virtual/jre
589 + "
590 + ;;
591 +*)
592 + MY_PV=${PV/_p/_r}
593 + MY_PV=${MY_PV/_alpha/a}
594 + MY_PV=${MY_PV/_beta/b}
595 + MY_PV=${MY_PV/_rc/rc}
596 + MY_P="${PN}-${MY_PV}"
597 + SRC_URI+=" https://github.com/xbmc/xbmc/archive/${MY_PV}-${CODENAME}.tar.gz -> ${MY_P}.tar.gz
598 + !java? ( https://github.com/candrews/gentoo-kodi/raw/master/${MY_P}-generated-addons.tar.xz )"
599 + KEYWORDS="~amd64 ~x86"
600 + IUSE+=" java"
601 + DEPEND+="
602 + java? ( virtual/jre )
603 + "
604 +
605 + S=${WORKDIR}/xbmc-${MY_PV}-${CODENAME}
606 + ;;
607 +esac
608 +
609 +CONFIG_CHECK="~IP_MULTICAST"
610 +ERROR_IP_MULTICAST="
611 +In some cases Kodi needs to access multicast addresses.
612 +Please consider enabling IP_MULTICAST under Networking options.
613 +"
614 +
615 +CMAKE_USE_DIR=${S}/project/cmake/
616 +
617 +pkg_setup() {
618 + check_extra_config
619 + python-single-r1_pkg_setup
620 +}
621 +
622 +src_prepare() {
623 + if in_iuse java && use !java; then
624 + eapply "${FILESDIR}"/${PN}-cmake-no-java.patch
625 + fi
626 + cmake-utils_src_prepare
627 +
628 + # avoid long delays when powerkit isn't running #348580
629 + sed -i \
630 + -e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \
631 + xbmc/linux/*.cpp || die
632 +
633 + # Prepare tools and libs witch are configured with autotools during compile time
634 + AUTOTOOLS_DIRS=(
635 + "${S}"/lib/cpluff
636 + "${S}"/tools/depends/native/TexturePacker/src
637 + "${S}"/tools/depends/native/JsonSchemaBuilder/src
638 + )
639 +
640 + local d
641 + for d in "${AUTOTOOLS_DIRS[@]}" ; do
642 + pushd ${d} >/dev/null || die
643 + AT_NOELIBTOOLIZE="yes" AT_TOPLEVEL_EAUTORECONF="yes" eautoreconf
644 + popd >/dev/null || die
645 + done
646 + elibtoolize
647 +
648 + # Prevent autoreconf rerun
649 + sed -e 's/autoreconf -vif/echo "autoreconf already done in src_prepare()"/' -i \
650 + "${S}"/project/cmake/modules/FindCpluff.cmake \
651 + "${S}"/tools/depends/native/TexturePacker/src/autogen.sh \
652 + "${S}"/tools/depends/native/JsonSchemaBuilder/src/autogen.sh \
653 + || die
654 +}
655 +
656 +src_configure() {
657 + local mycmakeargs=(
658 + -Ddocdir="${EPREFIX}/usr/share/doc/${PF}"
659 + -DENABLE_LDGOLD=OFF # https://bugs.gentoo.org/show_bug.cgi?id=606124
660 + -DENABLE_ALSA=$(usex alsa)
661 + -DENABLE_AIRTUNES=$(usex airplay)
662 + -DENABLE_AVAHI=$(usex zeroconf)
663 + -DENABLE_BLUETOOTH=$(usex bluetooth)
664 + -DENABLE_BLURAY=$(usex bluray)
665 + -DENABLE_CCACHE=OFF
666 + -DENABLE_CEC=$(usex cec)
667 + -DENABLE_DBUS=$(usex dbus)
668 + -DENABLE_DVDCSS=$(usex css)
669 + -DENABLE_INTERNAL_CROSSGUID=OFF
670 + -DENABLE_INTERNAL_FFMPEG="$(usex !system-ffmpeg)"
671 + -DENABLE_CAP=$(usex caps)
672 + -DENABLE_LCMS2=$(usex lcms)
673 + -DENABLE_LIRC=$(usex lirc)
674 + -DENABLE_MICROHTTPD=$(usex webserver)
675 + -DENABLE_NFS=$(usex nfs)
676 + -DENABLE_NONFREE=$(usex nonfree)
677 + -DENABLE_OPENGLES=$(usex gles)
678 + -DENABLE_OPENGL=$(usex opengl)
679 + -DENABLE_OPENSSL=ON
680 + -DENABLE_OPTICAL=$(usex dvd)
681 + -DENABLE_PLIST=$(usex airplay)
682 + -DENABLE_PULSEAUDIO=$(usex pulseaudio)
683 + -DENABLE_SMBCLIENT=$(usex samba)
684 + -DENABLE_SSH=$(usex sftp)
685 + -DENABLE_UDEV=$(usex udev)
686 + -DENABLE_UPNP=$(usex upnp)
687 + -DENABLE_VAAPI=$(usex vaapi)
688 + -DENABLE_VDPAU=$(usex vdpau)
689 + -DENABLE_X11=ON
690 + -DENABLE_XSLT=$(usex xslt)
691 + -Dlibdvdread_URL="${DISTDIR}/libdvdread-${LIBDVDREAD_COMMIT}.tar.gz"
692 + -Dlibdvdnav_URL="${DISTDIR}/libdvdnav-${LIBDVDNAV_COMMIT}.tar.gz"
693 + -Dlibdvdcss_URL="${DISTDIR}/libdvdcss-${LIBDVDCSS_COMMIT}.tar.gz"
694 + )
695 +
696 + if use mysql || use mariadb ; then
697 + mycmakeargs+=( -DENABLE_MYSQLCLIENT="yes" )
698 + else
699 + mycmakeargs+=( -DENABLE_MYSQLCLIENT="no" )
700 + fi
701 +
702 + use libusb && mycmakeargs+=( -DENABLE_LIBUSB=$(usex libusb) )
703 +
704 + if use system-ffmpeg; then
705 + mycmakeargs+=( -DWITH_FFMPEG="yes" )
706 + else
707 + mycmakeargs+=( -DFFMPEG_URL="${DISTDIR}/ffmpeg-${PN}-${FFMPEG_VERSION}-${CODENAME}-${FFMPEG_KODI_VERSION}.tar.gz" )
708 + fi
709 +
710 + cmake-utils_src_configure
711 +}
712 +
713 +src_compile() {
714 + cmake-utils_src_compile all
715 + use test && emake -C "${BUILD_DIR}" kodi-test
716 +}
717 +
718 +src_test() {
719 + emake -C "${BUILD_DIR}" test
720 +}
721 +
722 +src_install() {
723 + cmake-utils_src_install
724 +
725 + pax-mark Em "${ED%/}"/usr/$(get_libdir)/${PN}/${PN}.bin
726 +
727 + rm "${ED%/}"/usr/share/doc/*/{LICENSE.GPL,copying.txt}* || die
728 +
729 + newicon media/icon48x48.png kodi.png
730 +
731 + python_domodule tools/EventClients/lib/python/xbmcclient.py
732 + python_newscript "tools/EventClients/Clients/Kodi Send/kodi-send.py" kodi-send
733 +}