Files
LibreELEC.tv/projects/imx6/patches/kodi/kodi-050-from-openbricks.patch
Peter Vicman df45834fe0 imx6: update kodi patch (stop/resume streams on OnLostDisplay/OnResetDisplay)
fixes alsa errors (after boot there is no sound for almost 2 minutes)

16:27:16.182 T:1929376672   ERROR: CAESinkALSA - snd_pcm_writei(-5) Input/output error - trying to recover
16:27:16.182 T:1929376672   ERROR: CAESinkALSA::HandleError(snd_pcm_writei(1)) - snd_pcm_writei returned -5 (Input/output error)
2017-02-22 17:39:45 +01:00

1820 lines
69 KiB
Diff

https://github.com/OpenBricks/openbricks/tree/krypton-glibc
https://github.com/OpenBricks/openbricks/tree/krypton-glibc/packages/multimedia/kodi/patches
https://github.com/OpenBricks/openbricks/tree//packages/multimedia/kodi/patches
==============================================================
file 0027-stop-resume-streams-on-OnLostDisplay-OnResetDisplay.patch
==============================================================
From ef590549752c0b7daccb12c28d34feb5e7ed2171 Mon Sep 17 00:00:00 2001
From: Matus Kral <matuskral@me.com>
Date: Mon, 18 Jul 2016 23:34:51 +0200
Subject: [PATCH] stop/resume streams on OnLostDisplay/OnResetDisplay
---
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
index 4f55b37..4aad146 100644
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
@@ -2843,6 +2843,11 @@ AEAudioFormat CActiveAE::GetCurrentSinkFormat()
void CActiveAE::OnLostDisplay()
{
Message *reply;
+ for(auto &&stream : m_streams)
+ m_controlPort.SendOutMessageSync(CActiveAEControlProtocol::PAUSESTREAM,
+ &reply, 1000,
+ &stream, sizeof(CActiveAEStream*));
+
if (m_controlPort.SendOutMessageSync(CActiveAEControlProtocol::DISPLAYLOST,
&reply,
5000))
@@ -2862,7 +2867,12 @@ void CActiveAE::OnLostDisplay()
void CActiveAE::OnResetDisplay()
{
- m_controlPort.SendOutMessage(CActiveAEControlProtocol::DISPLAYRESET);
+ Message *reply;
+ m_controlPort.SendOutMessageSync(CActiveAEControlProtocol::DISPLAYRESET, &reply, 1000);
+ for(auto &&stream : m_streams)
+ m_controlPort.SendOutMessageSync(CActiveAEControlProtocol::RESUMESTREAM,
+ &reply, 1000,
+ &stream, sizeof(CActiveAEStream*));
}
void CActiveAE::OnAppFocusChange(bool focus)
--
1.9.1
==============================================================
file 0034-IMXCODEC-Use-uint32_t-for-physical-addresses.patch
==============================================================
From 2dc612adfcc74c6439e5df47aba2cf63573f93f1 Mon Sep 17 00:00:00 2001
From: Rudi <r.ihle@s-t.de>
Date: Sat, 24 Sep 2016 15:36:23 +0200
Subject: [PATCH] IMXCODEC: Use uint32_t for physical addresses
---
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 2 +-
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 2 +-
xbmc/linux/imx/IMX.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
index b1147d2..705b4a9 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
@@ -1198,7 +1198,7 @@ CDVDVideoCodecIMXBuffer::CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo,
iHeight = (((frameInfo->pExtInfo->nFrmHeight) + 15) & ~15);
pVirtAddr = m_frameBuffer->pbufVirtY;
- pPhysAddr = (int)m_frameBuffer->pbufY;
+ pPhysAddr = (uint32_t)m_frameBuffer->pbufY;
#ifdef IMX_INPUT_FORMAT_I420
iFormat = _4CC('I', '4', '2', '0');
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
index 32e3a6c..fdac8ec 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
@@ -187,7 +187,7 @@ private:
int m_fbLineLength;
int m_fbPageSize;
int m_fbPhysSize;
- int m_fbPhysAddr;
+ uint32_t m_fbPhysAddr;
uint8_t *m_fbVirtAddr;
struct fb_var_screeninfo m_fbVar;
int m_ipuHandle;
diff --git a/xbmc/linux/imx/IMX.h b/xbmc/linux/imx/IMX.h
index a269af0..2bc6761 100644
--- a/xbmc/linux/imx/IMX.h
+++ b/xbmc/linux/imx/IMX.h
@@ -182,7 +182,7 @@ public:
public:
uint32_t iWidth;
uint32_t iHeight;
- int pPhysAddr;
+ uint32_t pPhysAddr;
uint8_t *pVirtAddr;
int iFormat;
double m_fps;
--
1.9.1
==============================================================
file 0035-IMXCODEC-Fix-page-counting-avoid-compiler-warning.patch
==============================================================
From 527cc00d7b56f01277be9abce0de48a63f388dd7 Mon Sep 17 00:00:00 2001
From: Rudi <r.ihle@s-t.de>
Date: Sat, 24 Sep 2016 15:39:38 +0200
Subject: [PATCH] IMXCODEC: Fix page counting, avoid compiler warning
---
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
index 705b4a9..9b7a9ea 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
@@ -1562,15 +1562,15 @@ void CIMXContext::SetIPUMotion(EINTERLACEMETHOD imethod)
void CIMXContext::Blit(CIMXBuffer *source_p, CIMXBuffer *source, const CRect &srcRect,
const CRect &dstRect, uint8_t fieldFmt, int page)
{
- static unsigned char pg;
+ static int pg = 0;
if (page == RENDER_TASK_AUTOPAGE)
page = pg;
- else if (page < 0 && page >= m_fbPages)
+ else if (page < 0 || page >= m_fbPages)
return;
IPUTaskPtr ipu(new IPUTask(source_p, source, page));
- pg = ++pg % m_fbPages;
+ pg = (page + 1) % m_fbPages;
#ifdef IMX_PROFILE_BUFFERS
unsigned long long before = XbmcThreads::SystemClockMillis();
--
1.9.1
==============================================================
file 0036-IMXCODEC-Honour-forced-aspect-ratio-hint.patch
==============================================================
From eab2f97c91ec724f1c30af5b6d570d73e76689c8 Mon Sep 17 00:00:00 2001
From: Rudi <r.ihle@s-t.de>
Date: Mon, 3 Oct 2016 18:08:34 +0200
Subject: [PATCH] IMXCODEC: Honour forced aspect ratio hint
---
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 6 +++++-
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
index 9b7a9ea..ac2ad8d 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
@@ -546,6 +546,8 @@ bool CIMXCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, std::stri
#endif
m_warnOnce = true;
+ m_forcedWidthHeightRatio = m_hints.forced_aspect ? (65536 * m_hints.aspect) : 0;
+
switch(m_hints.codec)
{
case AV_CODEC_ID_MPEG1VIDEO:
@@ -1160,7 +1162,9 @@ bool CIMXCodec::GetPicture(DVDVideoPicture* pDvdVideoPicture)
pDvdVideoPicture->iWidth = pDvdVideoPicture->IMXBuffer->m_pctWidth;
pDvdVideoPicture->iHeight = pDvdVideoPicture->IMXBuffer->m_pctHeight;
- pDvdVideoPicture->iDisplayWidth = ((pDvdVideoPicture->iWidth * m_frameInfo.pExtInfo->nQ16ShiftWidthDivHeightRatio) + 32767) >> 16;
+ int ratio = m_forcedWidthHeightRatio ? m_forcedWidthHeightRatio : m_frameInfo.pExtInfo->nQ16ShiftWidthDivHeightRatio;
+
+ pDvdVideoPicture->iDisplayWidth = ((pDvdVideoPicture->iWidth * ratio) + 32767) >> 16;
pDvdVideoPicture->iDisplayHeight = pDvdVideoPicture->iHeight;
pDvdVideoPicture->pts = pDvdVideoPicture->IMXBuffer->GetPts();
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
index fdac8ec..3d26a50 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
@@ -380,6 +380,7 @@ protected:
int m_codecControlFlags;
CCriticalSection m_signalLock;
CCriticalSection m_queuesLock;
+ int m_forcedWidthHeightRatio;
#ifdef DUMP_STREAM
FILE *m_dump;
#endif
--
1.9.1
==============================================================
file 0037-IMXCODEC-Cleanup-mediainfo-logging.patch
==============================================================
From 2ca3bdccc4f4723297a51abb1dbe09b97d7115d0 Mon Sep 17 00:00:00 2001
From: Rudi <r.ihle@s-t.de>
Date: Mon, 3 Oct 2016 18:11:31 +0200
Subject: [PATCH] IMXCODEC: Cleanup mediainfo logging
---
.../DVDCodecs/Video/DVDVideoCodecIMX.cpp | 52 +++++++++++-----------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
index ac2ad8d..810537f 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
@@ -506,8 +506,6 @@ bool CIMXCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, std::stri
}
m_hints = hints;
- if (g_advancedSettings.CanLogComponent(LOGVIDEO))
- CLog::Log(LOGDEBUG, "Let's decode with iMX VPU\n");
int param = 0;
SetVPUParams(VPU_DEC_CONF_INPUTTYPE, &param);
@@ -516,32 +514,31 @@ bool CIMXCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, std::stri
#ifdef MEDIAINFO
if (g_advancedSettings.CanLogComponent(LOGVIDEO))
{
- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: fpsrate %d / fpsscale %d\n", m_hints.fpsrate, m_hints.fpsscale);
- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: CodecID %d \n", m_hints.codec);
- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: StreamType %d \n", m_hints.type);
- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Level %d \n", m_hints.level);
- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Profile %d \n", m_hints.profile);
- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: PTS_invalid %d \n", m_hints.ptsinvalid);
- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Tag %d \n", m_hints.codec_tag);
- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %dx%d \n", m_hints.width, m_hints.height);
- }
- { char str_tag[128]; av_get_codec_tag_string(str_tag, sizeof(str_tag), m_hints.codec_tag);
- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Tag fourcc %s\n", str_tag);
- }
- if (m_hints.extrasize)
- {
- char buf[4096];
+ CLog::Log(LOGNOTICE, "MEDIAINFO: fpsrate %d / fpsscale %d\n", m_hints.fpsrate, m_hints.fpsscale);
+ CLog::Log(LOGNOTICE, "MEDIAINFO: CodecID %d\n", m_hints.codec);
+ CLog::Log(LOGNOTICE, "MEDIAINFO: StreamType %d\n", m_hints.type);
+ CLog::Log(LOGNOTICE, "MEDIAINFO: Level %d\n", m_hints.level);
+ CLog::Log(LOGNOTICE, "MEDIAINFO: Profile %d\n", m_hints.profile);
+ CLog::Log(LOGNOTICE, "MEDIAINFO: PTS_invalid %d\n", m_hints.ptsinvalid);
+ CLog::Log(LOGNOTICE, "MEDIAINFO: Tag %d\n", m_hints.codec_tag);
+ CLog::Log(LOGNOTICE, "MEDIAINFO: %dx%d\n", m_hints.width, m_hints.height);
- for (unsigned int i=0; i < m_hints.extrasize; i++)
- sprintf(buf+i*2, "%02x", ((uint8_t*)m_hints.extradata)[i]);
+ char str_tag[128];
+ av_get_codec_tag_string(str_tag, sizeof(str_tag), m_hints.codec_tag);
+ CLog::Log(LOGNOTICE, "MEDIAINFO: Tag fourcc %s\n", str_tag);
- if (g_advancedSettings.CanLogComponent(LOGVIDEO))
- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %s extradata %d %s\n", *(char*)m_hints.extradata == 1 ? "AnnexB" : "avcC", m_hints.extrasize, buf);
- }
- if (g_advancedSettings.CanLogComponent(LOGVIDEO))
- {
- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %d / %d \n", m_hints.width, m_hints.height);
- CLog::Log(LOGDEBUG, "Decode: aspect %f - forced aspect %d\n", m_hints.aspect, m_hints.forced_aspect);
+ if (m_hints.extrasize)
+ {
+ char buf[4096];
+
+ for (unsigned int i=0; i < m_hints.extrasize; i++)
+ sprintf(buf+i*2, "%02x", ((uint8_t*)m_hints.extradata)[i]);
+
+ CLog::Log(LOGNOTICE, "MEDIAINFO: %s extradata %d %s\n", *(char*)m_hints.extradata == 1 ? "AnnexB" : "avcC", m_hints.extrasize, buf);
+ }
+
+ CLog::Log(LOGNOTICE, "MEDIAINFO: %d / %d\n", m_hints.width, m_hints.height);
+ CLog::Log(LOGNOTICE, "MEDIAINFO: aspect %f - forced_aspect %d\n", m_hints.aspect, m_hints.forced_aspect);
}
#endif
@@ -634,6 +631,9 @@ bool CIMXCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, std::stri
return false;
}
+ if (g_advancedSettings.CanLogComponent(LOGVIDEO))
+ CLog::Log(LOGNOTICE, "Let's decode with iMX VPU\n");
+
std::list<EINTERLACEMETHOD> deintMethods({ EINTERLACEMETHOD::VS_INTERLACEMETHOD_AUTO,
EINTERLACEMETHOD::VS_INTERLACEMETHOD_RENDER_BOB });
--
1.9.1
==============================================================
file 0038-IMXCODEC-Remove-m_frameInfo-member-variable-from-CIM.patch
==============================================================
From 9a21a0256d49f2f9d44a08d077ef2dbc393161f6 Mon Sep 17 00:00:00 2001
From: Rudi <r.ihle@s-t.de>
Date: Sun, 1 Jan 2017 11:15:09 +0100
Subject: [PATCH] IMXCODEC: Remove m_frameInfo member variable from CIMXCodec
class
---
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 10 ++++++----
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 2 +-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
index 810537f..ee7178a 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
@@ -855,6 +855,7 @@ void CIMXCodec::AddExtraData(VpuBufferNode *bn, bool force)
void CIMXCodec::Process()
{
VpuDecFrameLengthInfo frameLengthInfo;
+ VpuDecOutFrameInfo frameInfo;
VpuBufferNode inData;
VpuBufferNode dummy;
VpuDecRetCode ret;
@@ -1002,16 +1003,16 @@ void CIMXCodec::Process()
if (!VPU_DecGetConsumedFrameInfo(m_vpuHandle, &frameLengthInfo) && frameLengthInfo.pFrame)
m_pts[frameLengthInfo.pFrame] = task->demux.pts;
- if (m_decRet & CLASS_PICTURE && getOutputFrame(&m_frameInfo))
+ if (m_decRet & CLASS_PICTURE && getOutputFrame(&frameInfo))
{
++m_nrOut;
- CDVDVideoCodecIMXBuffer *buffer = new CDVDVideoCodecIMXBuffer(&m_frameInfo, m_fps, m_decOpenParam.nMapType);
+ CDVDVideoCodecIMXBuffer *buffer = new CDVDVideoCodecIMXBuffer(&frameInfo, m_fps, m_decOpenParam.nMapType);
/* quick & dirty fix to get proper timestamping for VP8 codec */
if (m_decOpenParam.CodecFormat == VPU_V_VP8)
buffer->SetPts(task->demux.pts);
else
- buffer->SetPts(m_pts[m_frameInfo.pDisplayFrameBuf]);
+ buffer->SetPts(m_pts[frameInfo.pDisplayFrameBuf]);
buffer->SetDts(task->demux.dts);
@@ -1162,7 +1163,7 @@ bool CIMXCodec::GetPicture(DVDVideoPicture* pDvdVideoPicture)
pDvdVideoPicture->iWidth = pDvdVideoPicture->IMXBuffer->m_pctWidth;
pDvdVideoPicture->iHeight = pDvdVideoPicture->IMXBuffer->m_pctHeight;
- int ratio = m_forcedWidthHeightRatio ? m_forcedWidthHeightRatio : m_frameInfo.pExtInfo->nQ16ShiftWidthDivHeightRatio;
+ int ratio = m_forcedWidthHeightRatio ? m_forcedWidthHeightRatio : pDvdVideoPicture->IMXBuffer->m_widthHeightRatio;
pDvdVideoPicture->iDisplayWidth = ((pDvdVideoPicture->iWidth * ratio) + 32767) >> 16;
pDvdVideoPicture->iDisplayHeight = pDvdVideoPicture->iHeight;
@@ -1196,6 +1197,7 @@ CDVDVideoCodecIMXBuffer::CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo,
{
m_pctWidth = frameInfo->pExtInfo->FrmCropRect.nRight - frameInfo->pExtInfo->FrmCropRect.nLeft;
m_pctHeight = frameInfo->pExtInfo->FrmCropRect.nBottom - frameInfo->pExtInfo->FrmCropRect.nTop;
+ m_widthHeightRatio = frameInfo->pExtInfo->nQ16ShiftWidthDivHeightRatio;
// Some codecs (VC1?) lie about their frame size (mod 16). Adjust...
iWidth = (((frameInfo->pExtInfo->nFrmWidth) + 15) & ~15);
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
index 3d26a50..aeb1692 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
@@ -268,6 +268,7 @@ public:
protected:
unsigned int m_pctWidth;
unsigned int m_pctHeight;
+ int m_widthHeightRatio;
private:
double m_pts;
@@ -374,7 +375,6 @@ protected:
std::unordered_map<VpuFrameBuffer*,double>
m_pts;
double m_lastPTS;
- VpuDecOutFrameInfo m_frameInfo; // Store last VPU output frame info
CBitstreamConverter *m_converter; // H264 annex B converter
bool m_warnOnce; // Track warning messages to only warn once
int m_codecControlFlags;
--
1.9.1
==============================================================
file 0039-IMXCODEC-Add-enum-VPU_MAPTYPE.patch
==============================================================
From 951095cdf14af35d0d2aefcd4122da1699075616 Mon Sep 17 00:00:00 2001
From: Rudi <r.ihle@s-t.de>
Date: Sun, 1 Jan 2017 11:32:11 +0100
Subject: [PATCH] IMXCODEC: Add enum VPU_MAPTYPE
---
.../cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 14 +++++++-------
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 9 ++++++++-
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
index ee7178a..3e77132 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
@@ -780,7 +780,7 @@ int CIMXCodec::Decode(BYTE *pData, int iSize, double dts, double pts)
else
m_fps = 60;
- m_decOpenParam.nMapType = 1;
+ m_decOpenParam.nMapType = MAPTYPE_TILED_FRAME;
ptrn.Flush();
g_IMXCodec->Create();
@@ -968,9 +968,9 @@ void CIMXCodec::Process()
if (!VpuFreeBuffers(false) || !VpuAllocFrameBuffers())
ExitError("VPU error while registering frame buffers");
- if (m_initInfo.nInterlace && m_fps >= 49 && m_decOpenParam.nMapType == 1)
+ if (m_initInfo.nInterlace && m_fps >= 49 && m_decOpenParam.nMapType == MAPTYPE_TILED_FRAME)
{
- m_decOpenParam.nMapType = 0;
+ m_decOpenParam.nMapType = MAPTYPE_LINEAR_FRAME;
Dispose();
VpuOpen();
continue;
@@ -1188,7 +1188,7 @@ bool CIMXCodec::IsCurrentThread() const
}
/*******************************************/
-CDVDVideoCodecIMXBuffer::CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, double fps, int map)
+CDVDVideoCodecIMXBuffer::CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, double fps, int mapType)
: m_dts(DVD_NOPTS_VALUE)
, m_fieldType(frameInfo->eFieldType)
, m_frameBuffer(frameInfo->pDisplayFrameBuf)
@@ -1209,9 +1209,9 @@ CDVDVideoCodecIMXBuffer::CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo,
#ifdef IMX_INPUT_FORMAT_I420
iFormat = _4CC('I', '4', '2', '0');
#else
- iFormat = map == 1 ? _4CC('T', 'N', 'V', 'P'):
- map == 0 ? _4CC('N', 'V', '1', '2'):
- _4CC('T', 'N', 'V', 'F');
+ iFormat = mapType == MAPTYPE_TILED_FRAME ? _4CC('T', 'N', 'V', 'P'):
+ mapType == MAPTYPE_LINEAR_FRAME ? _4CC('N', 'V', '1', '2'):
+ _4CC('T', 'N', 'V', 'F');
#endif
m_fps = fps;
#if defined(IMX_PROFILE) || defined(IMX_PROFILE_BUFFERS) || defined(TRACE_FRAMES)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
index aeb1692..22da54d 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
@@ -84,6 +84,13 @@ enum RENDER_TASK
RENDER_TASK_CAPTURE = -2,
};
+enum VPU_MAPTYPE
+{
+ MAPTYPE_LINEAR_FRAME = 0,
+ MAPTYPE_TILED_FRAME = 1,
+ MAPTYPE_TILED_FIELD = 2,
+};
+
#define CLASS_PICTURE (VPU_DEC_OUTPUT_DIS | VPU_DEC_OUTPUT_MOSAIC_DIS)
#define CLASS_NOBUF (VPU_DEC_OUTPUT_NODIS | VPU_DEC_NO_ENOUGH_BUF | VPU_DEC_OUTPUT_REPEAT)
#define CLASS_FORCEBUF (VPU_DEC_OUTPUT_EOS | VPU_DEC_NO_ENOUGH_INBUF)
@@ -244,7 +251,7 @@ class CDVDVideoCodecIMXBuffer : public CIMXBuffer
friend class CIMXCodec;
friend class CIMXContext;
public:
- CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, double fps, int map);
+ CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, double fps, int mapType);
virtual ~CDVDVideoCodecIMXBuffer();
// reference counting
--
1.9.1
==============================================================
file 0040-IMXCODEC-Prevent-lkFIFO-from-returning-uninitialized.patch
==============================================================
From c458ee2820562d7f7e6d015a6ff25c7ef126bb88 Mon Sep 17 00:00:00 2001
From: Rudi <r.ihle@s-t.de>
Date: Sun, 1 Jan 2017 11:47:08 +0100
Subject: [PATCH] IMXCODEC: Prevent lkFIFO from returning uninitialized data
---
.../VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 15 +++++++++++----
xbmc/linux/imx/IMX.h | 16 ++++++++--------
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
index 3e77132..773c878 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
@@ -889,7 +889,7 @@ void CIMXCodec::Process()
{
RecycleFrameBuffers();
SAFE_DELETE(task);
- if (!(task = m_decInput.pop()))
+ if (!m_decInput.pop(task))
task = new VPUTask();
#if defined(IMX_PROFILE) || defined(IMX_PROFILE_BUFFERS)
@@ -1048,7 +1048,11 @@ void CIMXCodec::Process()
if (m_decRet & VPU_DEC_NO_ENOUGH_BUF && m_decOutput.size())
{
- m_decOutput.pop()->Release();
+ CDVDVideoCodecIMXBuffer *buffer;
+
+ if (m_decOutput.pop(buffer))
+ buffer->Release();
+
FlushVPU();
continue;
}
@@ -1124,8 +1128,11 @@ void CIMXCodec::ExitError(const char *msg, ...)
bool CIMXCodec::GetPicture(DVDVideoPicture* pDvdVideoPicture)
{
- pDvdVideoPicture->IMXBuffer = m_decOutput.pop();
- assert(pDvdVideoPicture->IMXBuffer);
+ if (!m_decOutput.pop(pDvdVideoPicture->IMXBuffer))
+ {
+ memset(pDvdVideoPicture, 0, sizeof(*pDvdVideoPicture));
+ return false;
+ }
#ifdef IMX_PROFILE
static unsigned int previous = 0;
diff --git a/xbmc/linux/imx/IMX.h b/xbmc/linux/imx/IMX.h
index 2bc6761..201c1e9 100644
--- a/xbmc/linux/imx/IMX.h
+++ b/xbmc/linux/imx/IMX.h
@@ -79,23 +79,22 @@ public:
lkFIFO() { m_size = queue.max_size(); queue.clear(); m_abort = false; }
public:
- T pop()
+ bool pop(T &item)
{
std::unique_lock<std::mutex> m_lock(lkqueue);
m_abort = false;
while (!queue.size() && !m_abort)
read.wait(m_lock);
- T val;
- if (!queue.empty())
- {
- val = queue.front();
- queue.pop_front();
- }
+ if (queue.empty())
+ return false;
+
+ item = queue.front();
+ queue.pop_front();
m_lock.unlock();
write.notify_one();
- return val;
+ return true;
}
bool push(const T& item)
@@ -109,6 +108,7 @@ public:
return false;
queue.push_back(item);
+
m_lock.unlock();
read.notify_one();
return true;
--
1.9.1
==============================================================
file 0041-IMXCODEC-Cleanup-IMXBuffer-classes.patch
==============================================================
From abe53ea7362fe251b9cfc7e814dd78b7b06089b9 Mon Sep 17 00:00:00 2001
From: Rudi <r.ihle@s-t.de>
Date: Sun, 1 Jan 2017 17:23:23 +0100
Subject: [PATCH] IMXCODEC: Cleanup IMXBuffer classes
---
.../DVDCodecs/Video/DVDVideoCodecIMX.cpp | 38 +++++++++++++---------
.../VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 13 ++++----
xbmc/linux/imx/IMX.h | 2 --
3 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
index 773c878..d498b45 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
@@ -1128,7 +1128,9 @@ void CIMXCodec::ExitError(const char *msg, ...)
bool CIMXCodec::GetPicture(DVDVideoPicture* pDvdVideoPicture)
{
- if (!m_decOutput.pop(pDvdVideoPicture->IMXBuffer))
+ CDVDVideoCodecIMXBuffer *pBuffer;
+
+ if (!m_decOutput.pop(pBuffer))
{
memset(pDvdVideoPicture, 0, sizeof(*pDvdVideoPicture));
return false;
@@ -1139,9 +1141,9 @@ bool CIMXCodec::GetPicture(DVDVideoPicture* pDvdVideoPicture)
unsigned int current;
current = XbmcThreads::SystemClockMillis();
- CLog::Log(LOGDEBUG, "+G 0x%x %f/%f tm:%03d : Interlaced 0x%x\n", pDvdVideoPicture->IMXBuffer->GetIdx(),
- recalcPts(pDvdVideoPicture->IMXBuffer->GetDts()), recalcPts(pDvdVideoPicture->IMXBuffer->GetPts()), current - previous,
- m_initInfo.nInterlace ? pDvdVideoPicture->IMXBuffer->GetFieldType() : 0);
+ CLog::Log(LOGDEBUG, "+G 0x%x %f/%f tm:%03d : Interlaced 0x%x\n", pBuffer->GetIdx(),
+ recalcPts(pBuffer->GetDts()), recalcPts(pBuffer->GetPts()), current - previous,
+ m_initInfo.nInterlace ? pBuffer->GetFieldType() : 0);
previous = current;
#endif
@@ -1151,35 +1153,37 @@ bool CIMXCodec::GetPicture(DVDVideoPicture* pDvdVideoPicture)
++m_dropped;
}
else
- pDvdVideoPicture->iFlags = pDvdVideoPicture->IMXBuffer->GetFlags();
+ pDvdVideoPicture->iFlags = pBuffer->GetFlags();
if (m_initInfo.nInterlace)
{
- if (pDvdVideoPicture->IMXBuffer->GetFieldType() == VPU_FIELD_NONE && m_warnOnce)
+ if (pBuffer->GetFieldType() == VPU_FIELD_NONE && m_warnOnce)
{
m_warnOnce = false;
CLog::Log(LOGWARNING, "Interlaced content reported by VPU, but full frames detected - Please turn off deinterlacing manually.");
}
- else if (pDvdVideoPicture->IMXBuffer->GetFieldType() == VPU_FIELD_TB || pDvdVideoPicture->IMXBuffer->GetFieldType() == VPU_FIELD_TOP)
+ else if (pBuffer->GetFieldType() == VPU_FIELD_TB || pBuffer->GetFieldType() == VPU_FIELD_TOP)
pDvdVideoPicture->iFlags |= DVP_FLAG_TOP_FIELD_FIRST;
pDvdVideoPicture->iFlags |= DVP_FLAG_INTERLACED;
}
pDvdVideoPicture->format = RENDER_FMT_IMXMAP;
- pDvdVideoPicture->iWidth = pDvdVideoPicture->IMXBuffer->m_pctWidth;
- pDvdVideoPicture->iHeight = pDvdVideoPicture->IMXBuffer->m_pctHeight;
+ pDvdVideoPicture->iWidth = pBuffer->GetPictureWidth();
+ pDvdVideoPicture->iHeight = pBuffer->GetPictureHeight();
- int ratio = m_forcedWidthHeightRatio ? m_forcedWidthHeightRatio : pDvdVideoPicture->IMXBuffer->m_widthHeightRatio;
+ int ratio = m_forcedWidthHeightRatio ? m_forcedWidthHeightRatio : pBuffer->GetWidthHeightRatio();
pDvdVideoPicture->iDisplayWidth = ((pDvdVideoPicture->iWidth * ratio) + 32767) >> 16;
pDvdVideoPicture->iDisplayHeight = pDvdVideoPicture->iHeight;
- pDvdVideoPicture->pts = pDvdVideoPicture->IMXBuffer->GetPts();
- pDvdVideoPicture->dts = pDvdVideoPicture->IMXBuffer->GetDts();
+ pDvdVideoPicture->pts = pBuffer->GetPts();
+ pDvdVideoPicture->dts = pBuffer->GetDts();
if (pDvdVideoPicture->iFlags & DVP_FLAG_DROPPED)
- SAFE_RELEASE(pDvdVideoPicture->IMXBuffer);
+ SAFE_RELEASE(pBuffer);
+
+ pDvdVideoPicture->IMXBuffer = pBuffer;
return true;
}
@@ -1229,15 +1233,17 @@ CDVDVideoCodecIMXBuffer::CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo,
void CDVDVideoCodecIMXBuffer::Lock()
{
- long count = ++m_iRefs;
#ifdef TRACE_FRAMES
- CLog::Log(LOGDEBUG, "R+ 0x%x - ref : %ld (VPU)\n", m_idx, count);
+ CLog::Log(LOGDEBUG, "R+ 0x%x - ref : %ld (VPU)\n", m_idx, ++m_iRefs);
+#else
+ ++m_iRefs;
#endif
}
long CDVDVideoCodecIMXBuffer::Release()
{
long count = --m_iRefs;
+
#ifdef TRACE_FRAMES
CLog::Log(LOGDEBUG, "R- 0x%x - ref : %ld (VPU)\n", m_idx, count);
#endif
@@ -1803,7 +1809,7 @@ bool CIMXContext::TileTask(IPUTaskPtr &ipu)
return false;
}
- ((CDVDVideoCodecIMXBuffer*)ipu->current)->m_convBuffer = conv;
+ ((CDVDVideoCodecIMXBuffer*)ipu->current)->SetConvBuffer(conv);
vdoa.output.paddr = conv->buf_paddr;
}
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
index 22da54d..91f9b8c 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
@@ -248,8 +248,6 @@ public:
// Base class of IMXVPU and IMXIPU buffer
class CDVDVideoCodecIMXBuffer : public CIMXBuffer
{
-friend class CIMXCodec;
-friend class CIMXContext;
public:
CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, double fps, int mapType);
virtual ~CDVDVideoCodecIMXBuffer();
@@ -272,12 +270,16 @@ public:
#endif
VpuFieldType GetFieldType() const { return m_fieldType; }
-protected:
+ unsigned int GetPictureWidth() { return m_pctWidth; }
+ unsigned int GetPictureHeight() { return m_pctHeight; }
+ int GetWidthHeightRatio() { return m_widthHeightRatio; }
+
+ void SetConvBuffer(struct g2d_buf *b) { m_convBuffer = b; }
+
+private:
unsigned int m_pctWidth;
unsigned int m_pctHeight;
int m_widthHeightRatio;
-
-private:
double m_pts;
double m_dts;
VpuFieldType m_fieldType;
@@ -288,7 +290,6 @@ private:
static unsigned char i;
#endif
-public:
struct g2d_buf *m_convBuffer;
};
diff --git a/xbmc/linux/imx/IMX.h b/xbmc/linux/imx/IMX.h
index 201c1e9..50c1cdb 100644
--- a/xbmc/linux/imx/IMX.h
+++ b/xbmc/linux/imx/IMX.h
@@ -177,8 +177,6 @@ public:
virtual void Lock() = 0;
virtual long Release() = 0;
- int GetFormat() { return iFormat; }
-
public:
uint32_t iWidth;
uint32_t iHeight;
--
1.9.1
==============================================================
file 0042-IMXRender-Refactor-to-improve-readability-and-perfor.patch
==============================================================
From bc3d7cdaaeb4e6c532672f65d27509f312eff21e Mon Sep 17 00:00:00 2001
From: Rudi <r.ihle@s-t.de>
Date: Sun, 1 Jan 2017 17:56:17 +0100
Subject: [PATCH] IMXRender: Refactor to improve readability and performance
---
.../VideoRenderers/HwDecRender/RendererIMX.cpp | 29 ++++++++++------------
.../VideoRenderers/HwDecRender/RendererIMX.h | 5 ++--
2 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp
index b5c7095..5167bd2 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp
@@ -34,13 +34,14 @@
CRendererIMX::CRendererIMX()
{
- m_bufHistory.clear();
+ m_bufHistory[0] = m_bufHistory[1] = nullptr;
}
CRendererIMX::~CRendererIMX()
{
UnInit();
- std::for_each(m_bufHistory.begin(), m_bufHistory.end(), Release);
+ SAFE_RELEASE(m_bufHistory[1]);
+ SAFE_RELEASE(m_bufHistory[0]);
g_IMX.Deinitialize();
}
@@ -139,12 +140,7 @@ bool CRendererIMX::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha)
CDVDVideoCodecIMXBuffer *buffer = static_cast<CDVDVideoCodecIMXBuffer*>(m_buffers[m_iYV12RenderBuffer].hwDec);
if (buffer)
{
- if (!m_bufHistory.empty() && m_bufHistory.back() != buffer || m_bufHistory.empty())
- {
- buffer->Lock();
- m_bufHistory.push_back(buffer);
- }
- else if (!m_bufHistory.empty() && m_bufHistory.back() == buffer && flagsPrev == flags)
+ if (buffer == m_bufHistory[0] && flagsPrev == flags)
{
g_IMX.WaitVsync();
return true;
@@ -152,12 +148,14 @@ bool CRendererIMX::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha)
flagsPrev = flags;
- int size = flags & RENDER_FLAG_FIELDMASK ? 2 : 1;
- while (m_bufHistory.size() > size)
- {
- m_bufHistory.front()->Release();
- m_bufHistory.pop_front();
- }
+ buffer->Lock();
+
+ SAFE_RELEASE(m_bufHistory[1]);
+ m_bufHistory[1] = m_bufHistory[0];
+ m_bufHistory[0] = buffer;
+
+ if (!(flags & RENDER_FLAG_FIELDMASK))
+ SAFE_RELEASE(m_bufHistory[1]);
// this hack is needed to get the 2D mode of a 3D movie going
RENDER_STEREO_MODE stereo_mode = g_graphicsContext.GetStereoMode();
@@ -206,8 +204,7 @@ bool CRendererIMX::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha)
}
}
- CDVDVideoCodecIMXBuffer *buffer_p = m_bufHistory.front();
- g_IMXContext.Blit(buffer_p == buffer ? nullptr : buffer_p, buffer, srcRect, dstRect, fieldFmt);
+ g_IMXContext.Blit(m_bufHistory[1], m_bufHistory[0], srcRect, dstRect, fieldFmt);
}
#if 0
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.h
index fc71e89..1a1ee2c 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.h
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.h
@@ -30,6 +30,8 @@
class CRendererIMX : public CLinuxRendererGLES
{
+ CDVDVideoCodecIMXBuffer *m_bufHistory[2];
+
public:
CRendererIMX();
virtual ~CRendererIMX();
@@ -61,9 +63,6 @@ protected:
virtual bool RenderHook(int index);
virtual int GetImageHook(YV12Image *image, int source = AUTOSOURCE, bool readonly = false);
virtual bool RenderUpdateVideoHook(bool clear, DWORD flags = 0, DWORD alpha = 255);
-
- std::deque<CDVDVideoCodecIMXBuffer*> m_bufHistory;
- static void Release(CDVDVideoCodecIMXBuffer *&t) { if (t) t->Release(); }
};
#endif
--
1.9.1
==============================================================
file 0043-IMXCODEC-Refactor-IPUTask-for-better-readability-and.patch
==============================================================
From 4228f95268bf1c9b1f4dec483914ee32f2f0b621 Mon Sep 17 00:00:00 2001
From: warped-rudi <r.ihle@s-t.de>
Date: Mon, 2 Jan 2017 09:20:05 +0100
Subject: [PATCH] IMXCODEC: Refactor IPUTask for better readability and
performance
---
.../DVDCodecs/Video/DVDVideoCodecIMX.cpp | 168 ++++++++++-----------
.../VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 28 ++--
2 files changed, 95 insertions(+), 101 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
index d498b45..6b0e2ee 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
@@ -1588,23 +1588,23 @@ void CIMXContext::Blit(CIMXBuffer *source_p, CIMXBuffer *source, const CRect &sr
else if (page < 0 || page >= m_fbPages)
return;
- IPUTaskPtr ipu(new IPUTask(source_p, source, page));
+ IPUTask task(source_p, source, page);
pg = (page + 1) % m_fbPages;
#ifdef IMX_PROFILE_BUFFERS
unsigned long long before = XbmcThreads::SystemClockMillis();
#endif
SetFieldData(fieldFmt, source->m_fps);
- PrepareTask(ipu, srcRect, dstRect);
+ PrepareTask(task, srcRect, dstRect);
- if (DoTask(ipu))
- m_fbCurrentPage = ipu->page | checkIPUStrideOffset(&ipu->task.input.deinterlace, IsDoubleRate()) << 4;
+ if (DoTask(task))
+ m_fbCurrentPage = task.targetPage | checkIPUStrideOffset(&task.input.deinterlace, IsDoubleRate()) << 4;
m_pingFlip.Set();
#ifdef IMX_PROFILE_BUFFERS
unsigned long long after = XbmcThreads::SystemClockMillis();
- CLog::Log(LOGDEBUG, "+P 0x%x@%d %d\n", ((CDVDVideoCodecIMXBuffer*)ipu->current)->GetIdx(), ipu->page, (int)(after-before));
+ CLog::Log(LOGDEBUG, "+P 0x%x@%d %d\n", ((CDVDVideoCodecIMXBuffer*)task.currBuf)->GetIdx(), task.targetPage, (int)(after-before));
#endif
}
@@ -1676,7 +1676,7 @@ void CIMXContext::Clear(int page)
SetProcessInfo(m_processInfo);
}
-void CIMXContext::PrepareTask(IPUTaskPtr &ipu, CRect srcRect, CRect dstRect)
+void CIMXContext::PrepareTask(IPUTask &task, CRect srcRect, CRect dstRect)
{
CRectInt iSrcRect, iDstRect;
@@ -1721,95 +1721,95 @@ void CIMXContext::PrepareTask(IPUTaskPtr &ipu, CRect srcRect, CRect dstRect)
iDstRect.x2 = Align2((int)dstRect.x2,8);
iDstRect.y2 = Align2((int)dstRect.y2,8);
- ipu->task.input.crop.pos.x = iSrcRect.x1;
- ipu->task.input.crop.pos.y = iSrcRect.y1;
- ipu->task.input.crop.w = iSrcRect.Width();
- ipu->task.input.crop.h = iSrcRect.Height();
+ task.input.crop.pos.x = iSrcRect.x1;
+ task.input.crop.pos.y = iSrcRect.y1;
+ task.input.crop.w = iSrcRect.Width();
+ task.input.crop.h = iSrcRect.Height();
- ipu->task.output.crop.pos.x = iDstRect.x1;
- ipu->task.output.crop.pos.y = iDstRect.y1;
- ipu->task.output.crop.w = iDstRect.Width();
- ipu->task.output.crop.h = iDstRect.Height();
+ task.output.crop.pos.x = iDstRect.x1;
+ task.output.crop.pos.y = iDstRect.y1;
+ task.output.crop.w = iDstRect.Width();
+ task.output.crop.h = iDstRect.Height();
// Setup deinterlacing if enabled
if (m_currentFieldFmt)
{
- ipu->task.input.deinterlace.enable = 1;
- ipu->task.input.deinterlace.motion = ipu->previous ? m_motion : HIGH_MOTION;
- ipu->task.input.deinterlace.field_fmt = m_currentFieldFmt;
+ task.input.deinterlace.enable = 1;
+ task.input.deinterlace.motion = task.prevBuf ? m_motion : HIGH_MOTION;
+ task.input.deinterlace.field_fmt = m_currentFieldFmt;
}
}
-bool CIMXContext::TileTask(IPUTaskPtr &ipu)
+bool CIMXContext::TileTask(IPUTask &task)
{
m_zoomAllowed = true;
// on double rate deinterlacing this is reusing previous already rasterised frame
- if (ipu->current->iFormat != _4CC('T', 'N', 'V', 'F') && ipu->current->iFormat != _4CC('T', 'N', 'V', 'P'))
+ if (task.currBuf->iFormat != _4CC('T', 'N', 'V', 'F') && task.currBuf->iFormat != _4CC('T', 'N', 'V', 'P'))
{
- if (ipu->task.input.deinterlace.enable && ipu->task.input.deinterlace.motion != HIGH_MOTION)
+ if (task.input.deinterlace.enable && task.input.deinterlace.motion != HIGH_MOTION)
{
- ipu->task.input.paddr_n = ipu->task.input.paddr;
- ipu->task.input.paddr = ipu->previous->pPhysAddr;
+ task.input.paddr_n = task.input.paddr;
+ task.input.paddr = task.prevBuf->pPhysAddr;
}
return true;
}
// Use band mode directly to FB, as no transformations needed (eg cropping)
- if (m_fps >= 49 && m_fbWidth == 1920 && ipu->task.input.width == 1920 && !ipu->task.input.deinterlace.enable)
+ if (m_fps >= 49 && m_fbWidth == 1920 && task.input.width == 1920 && !task.input.deinterlace.enable)
{
m_zoomAllowed = false;
- ipu->task.output.crop.pos.x = ipu->task.input.crop.pos.x = 0;
- ipu->task.output.crop.pos.y = ipu->task.input.crop.pos.y = 0;
- ipu->task.output.crop.h = ipu->task.input.height = ipu->task.input.crop.h = ipu->current->iHeight;
- ipu->task.output.crop.w = ipu->task.input.width = ipu->task.input.crop.w = ipu->current->iWidth;
- if (ipu->task.input.crop.h < m_fbHeight)
- ipu->task.output.paddr += m_fbLineLength * (m_fbHeight - ipu->task.input.crop.h)/2;
+ task.output.crop.pos.x = task.input.crop.pos.x = 0;
+ task.output.crop.pos.y = task.input.crop.pos.y = 0;
+ task.output.crop.h = task.input.height = task.input.crop.h = task.currBuf->iHeight;
+ task.output.crop.w = task.input.width = task.input.crop.w = task.currBuf->iWidth;
+ if (task.input.crop.h < m_fbHeight)
+ task.output.paddr += m_fbLineLength * (m_fbHeight - task.input.crop.h)/2;
return true;
}
// check for 3-field deinterlace (no HIGH_MOTION allowed) from tile field format
- if (ipu->previous && ipu->current->iFormat == _4CC('T', 'N', 'V', 'F'))
+ if (task.prevBuf && task.currBuf->iFormat == _4CC('T', 'N', 'V', 'F'))
{
- ipu->task.input.paddr = ipu->previous->pPhysAddr;
- ipu->task.input.paddr_n = ipu->current->pPhysAddr;
- ipu->task.input.deinterlace.field_fmt = IPU_DEINTERLACE_FIELD_TOP;
- ipu->task.input.deinterlace.enable = true;
+ task.input.paddr = task.prevBuf->pPhysAddr;
+ task.input.paddr_n = task.currBuf->pPhysAddr;
+ task.input.deinterlace.field_fmt = IPU_DEINTERLACE_FIELD_TOP;
+ task.input.deinterlace.enable = true;
- ipu->task.output.crop.pos.x = ipu->task.input.crop.pos.x = 0;
- ipu->task.output.crop.pos.y = ipu->task.input.crop.pos.y = 0;
- ipu->task.output.crop.h = ipu->task.input.height = ipu->task.input.crop.h = ipu->current->iHeight;
- ipu->task.output.crop.w = ipu->task.input.width = ipu->task.input.crop.w = ipu->current->iWidth;
+ task.output.crop.pos.x = task.input.crop.pos.x = 0;
+ task.output.crop.pos.y = task.input.crop.pos.y = 0;
+ task.output.crop.h = task.input.height = task.input.crop.h = task.currBuf->iHeight;
+ task.output.crop.w = task.input.width = task.input.crop.w = task.currBuf->iWidth;
- return CheckTask(ipu) == 0;
+ return CheckTask(task) == 0;
}
// rasterize from tile (frame)
struct ipu_task vdoa;
- memset(&vdoa, 0, sizeof(ipu->task));
- vdoa.input.width = vdoa.output.width = ipu->current->iWidth;
- vdoa.input.height = vdoa.output.height = ipu->current->iHeight;
- vdoa.input.format = ipu->current->iFormat;
+ memset(&vdoa, 0, sizeof(vdoa));
+ vdoa.input.width = vdoa.output.width = task.currBuf->iWidth;
+ vdoa.input.height = vdoa.output.height = task.currBuf->iHeight;
+ vdoa.input.format = task.currBuf->iFormat;
- vdoa.input.paddr = vdoa.input.paddr_n ? ipu->previous->pPhysAddr : ipu->current->pPhysAddr;
- vdoa.output.format = ipu->task.input.format = m_fbVar.bits_per_pixel == 16 ? _4CC('Y', 'U', 'Y', 'V') : _4CC('N', 'V', '1', '2');
+ vdoa.input.paddr = vdoa.input.paddr_n ? task.prevBuf->pPhysAddr : task.currBuf->pPhysAddr;
+ vdoa.output.format = task.input.format = m_fbVar.bits_per_pixel == 16 ? _4CC('Y', 'U', 'Y', 'V') : _4CC('N', 'V', '1', '2');
- int check = CheckTask(ipu);
+ int check = CheckTask(task);
if (check == IPU_CHECK_ERR_PROC_NO_NEED)
{
- vdoa.output.paddr = ipu->task.output.paddr;
+ vdoa.output.paddr = task.output.paddr;
}
else
{
- struct g2d_buf *conv = g2d_alloc(ipu->current->iWidth *ipu->current->iHeight * 3, 0);
+ struct g2d_buf *conv = g2d_alloc(task.currBuf->iWidth *task.currBuf->iHeight * 3, 0);
if (!conv)
{
CLog::Log(LOGERROR, "iMX: can't allocate crop buffer");
return false;
}
- ((CDVDVideoCodecIMXBuffer*)ipu->current)->SetConvBuffer(conv);
+ ((CDVDVideoCodecIMXBuffer*)task.currBuf)->SetConvBuffer(conv);
vdoa.output.paddr = conv->buf_paddr;
}
@@ -1820,50 +1820,50 @@ bool CIMXContext::TileTask(IPUTaskPtr &ipu)
return false;
}
- ipu->task.input.paddr = vdoa.output.paddr;
+ task.input.paddr = vdoa.output.paddr;
- if (ipu->current->iFormat == _4CC('T', 'N', 'V', 'F'))
+ if (task.currBuf->iFormat == _4CC('T', 'N', 'V', 'F'))
return true;
// output of VDOA task was sent directly to FB. no more processing needed.
if (check == IPU_CHECK_ERR_PROC_NO_NEED)
return true;
- if (ipu->task.input.deinterlace.enable && ipu->task.input.deinterlace.motion != HIGH_MOTION)
+ if (task.input.deinterlace.enable && task.input.deinterlace.motion != HIGH_MOTION)
{
- ipu->task.input.paddr_n = ipu->task.input.paddr;
- ipu->task.input.paddr = ipu->previous->pPhysAddr;
+ task.input.paddr_n = task.input.paddr;
+ task.input.paddr = task.prevBuf->pPhysAddr;
}
- ipu->current->iFormat = vdoa.output.format;
- ipu->current->pPhysAddr = vdoa.output.paddr;
+ task.currBuf->iFormat = vdoa.output.format;
+ task.currBuf->pPhysAddr = vdoa.output.paddr;
return true;
}
-int CIMXContext::CheckTask(IPUTaskPtr &ipu)
+int CIMXContext::CheckTask(IPUTask &task)
{
//We really use IPU only if we have to deinterlace (using VDIC)
int ret = IPU_CHECK_ERR_INPUT_CROP;
while (ret > IPU_CHECK_ERR_MIN)
{
- ret = ioctl(m_ipuHandle, IPU_CHECK_TASK, &ipu->task);
+ ret = ioctl(m_ipuHandle, IPU_CHECK_TASK, &task);
switch (ret)
{
case IPU_CHECK_OK:
break;
case IPU_CHECK_ERR_SPLIT_INPUTW_OVER:
- ipu->task.input.crop.w -= 8;
+ task.input.crop.w -= 8;
break;
case IPU_CHECK_ERR_SPLIT_INPUTH_OVER:
- ipu->task.input.crop.h -= 8;
+ task.input.crop.h -= 8;
break;
case IPU_CHECK_ERR_SPLIT_OUTPUTW_OVER:
- ipu->task.output.width -= 8;
- ipu->task.output.crop.w = ipu->task.output.width;
+ task.output.width -= 8;
+ task.output.crop.w = task.output.width;
break;
case IPU_CHECK_ERR_SPLIT_OUTPUTH_OVER:
- ipu->task.output.height -= 8;
- ipu->task.output.crop.h = ipu->task.output.height;
+ task.output.height -= 8;
+ task.output.crop.h = task.output.height;
break;
// deinterlacing setup changing, m_ipuHandle is closed
case -1:
@@ -1879,41 +1879,41 @@ int CIMXContext::CheckTask(IPUTaskPtr &ipu)
return 0;
}
-bool CIMXContext::DoTask(IPUTaskPtr &ipu, CRect *dest)
+bool CIMXContext::DoTask(IPUTask &task, CRect *dest)
{
// Clear page if cropping changes
- CRectInt dstRect(ipu->task.output.crop.pos.x, ipu->task.output.crop.pos.y,
- ipu->task.output.crop.pos.x + ipu->task.output.crop.w,
- ipu->task.output.crop.pos.y + ipu->task.output.crop.h);
+ CRectInt dstRect(task.output.crop.pos.x, task.output.crop.pos.y,
+ task.output.crop.pos.x + task.output.crop.w,
+ task.output.crop.pos.y + task.output.crop.h);
// Populate input block
- ipu->task.input.width = ipu->current->iWidth;
- ipu->task.input.height = ipu->current->iHeight;
- ipu->task.input.format = ipu->current->iFormat;
- ipu->task.input.paddr = ipu->current->pPhysAddr;
+ task.input.width = task.currBuf->iWidth;
+ task.input.height = task.currBuf->iHeight;
+ task.input.format = task.currBuf->iFormat;
+ task.input.paddr = task.currBuf->pPhysAddr;
- ipu->task.output.width = m_fbWidth;
- ipu->task.output.height = m_fbHeight;
- ipu->task.output.format = m_fbVar.nonstd;
- ipu->task.output.paddr = m_fbPhysAddr + ipu->page*m_fbPageSize;
+ task.output.width = m_fbWidth;
+ task.output.height = m_fbHeight;
+ task.output.format = m_fbVar.nonstd;
+ task.output.paddr = m_fbPhysAddr + task.targetPage*m_fbPageSize;
- if (m_pageCrops[ipu->page] != dstRect)
+ if (m_pageCrops[task.targetPage] != dstRect)
{
- m_pageCrops[ipu->page] = dstRect;
- Clear(ipu->page);
+ m_pageCrops[task.targetPage] = dstRect;
+ Clear(task.targetPage);
}
- if ((ipu->task.input.crop.w <= 0) || (ipu->task.input.crop.h <= 0)
- || (ipu->task.output.crop.w <= 0) || (ipu->task.output.crop.h <= 0))
+ if ((task.input.crop.w <= 0) || (task.input.crop.h <= 0)
+ || (task.output.crop.w <= 0) || (task.output.crop.h <= 0))
return false;
- if (!TileTask(ipu))
+ if (!TileTask(task))
return false;
- if (CheckTask(ipu) == IPU_CHECK_ERR_PROC_NO_NEED)
+ if (CheckTask(task) == IPU_CHECK_ERR_PROC_NO_NEED)
return true;
- int ret = ioctl(m_ipuHandle, IPU_QUEUE_TASK, &ipu->task);
+ int ret = ioctl(m_ipuHandle, IPU_QUEUE_TASK, &task);
if (ret < 0)
CLog::Log(LOGERROR, "IPU task failed: %s at #%d (ret %d)\n", strerror(errno), __LINE__, ret);
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
index 91f9b8c..5b56293 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h
@@ -149,33 +149,27 @@ public:
static const int m_fbPages;
private:
- struct IPUTask
+ struct IPUTask : public ipu_task
{
- IPUTask(CIMXBuffer *buffer_p, CIMXBuffer *buffer, int p = 0)
- : previous(buffer_p), current(buffer), page(p)
+ IPUTask(CIMXBuffer *buffer_p, CIMXBuffer *buffer, int page)
+ : prevBuf(buffer_p), currBuf(buffer), targetPage(page)
{
- memset(&task, 0, sizeof(task));
+ memset(this, 0, sizeof(ipu_task));
}
// Kept for reference
- CIMXBuffer *previous;
- CIMXBuffer *current;
+ CIMXBuffer *prevBuf;
+ CIMXBuffer *currBuf;
- // The actual task
- struct ipu_task task;
-
- unsigned int page;
- int shift = true;
+ unsigned int targetPage;
};
- typedef std::shared_ptr<struct IPUTask> IPUTaskPtr;
-
bool GetFBInfo(const std::string &fbdev, struct fb_var_screeninfo *fbVar);
- void PrepareTask(IPUTaskPtr &ipu, CRect srcRect, CRect dstRect);
- bool DoTask(IPUTaskPtr &ipu, CRect *dest = nullptr);
- bool TileTask(IPUTaskPtr &ipu);
- int CheckTask(IPUTaskPtr &ipu);
+ void PrepareTask(IPUTask &task, CRect srcRect, CRect dstRect);
+ bool DoTask(IPUTask &task, CRect *dest = nullptr);
+ bool TileTask(IPUTask &task);
+ int CheckTask(IPUTask &task);
void SetFieldData(uint8_t fieldFmt, double fps);
--
1.9.1
==============================================================
file 0044-IMXCODEC-Fix-hang-on-exit-and-invalid-file-descripto.patch
==============================================================
From 89ab2c4de60034d81df3c91a19f7e0e7522d1b5e Mon Sep 17 00:00:00 2001
From: Rudi <r.ihle@s-t.de>
Date: Mon, 2 Jan 2017 22:23:24 +0100
Subject: [PATCH] IMXCODEC: Fix hang on exit and invalid file descriptor
handling
---
.../DVDCodecs/Video/DVDVideoCodecIMX.cpp | 28 +++++++++++++---------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
index 6b0e2ee..9436d4e 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
@@ -1268,11 +1268,11 @@ CDVDVideoCodecIMXBuffer::~CDVDVideoCodecIMXBuffer()
CIMXContext::CIMXContext()
: CThread("iMX IPU")
- , m_fbHandle(0)
+ , m_fbHandle(-1)
, m_fbCurrentPage(0)
, m_fbPhysAddr(0)
, m_fbVirtAddr(NULL)
- , m_ipuHandle(0)
+ , m_ipuHandle(-1)
, m_vsync(true)
, m_pageCrops(NULL)
, m_bFbIsConfigured(false)
@@ -1281,13 +1281,17 @@ CIMXContext::CIMXContext()
, m_deviceName("/dev/fb1")
{
m_pageCrops = new CRectInt[m_fbPages];
+ m_processInfo = 0;
OpenDevices();
}
CIMXContext::~CIMXContext()
{
- Stop(false);
+ Stop();
Dispose();
+
+ m_processInfo = 0;
+ Clear(-1);
CloseDevices();
}
@@ -1439,7 +1443,7 @@ bool CIMXContext::OpenDevices()
m_fbHandle = open(m_deviceName.c_str(), O_RDWR, 0);
OpenIPU();
- bool opened = m_fbHandle > 0 && m_ipuHandle > 0;
+ bool opened = m_fbHandle != -1 && m_ipuHandle != -1;
if (!opened)
CLog::Log(LOGWARNING, "iMX : Failed to open framebuffer: %s\n", m_deviceName.c_str());
@@ -1448,10 +1452,10 @@ bool CIMXContext::OpenDevices()
void CIMXContext::CloseIPU()
{
- if (m_ipuHandle)
+ if (m_ipuHandle != -1)
{
close(m_ipuHandle);
- m_ipuHandle = 0;
+ m_ipuHandle = -1;
}
}
@@ -1459,10 +1463,10 @@ void CIMXContext::CloseDevices()
{
CLog::Log(LOGINFO, "iMX : Closing devices\n");
- if (m_fbHandle)
+ if (m_fbHandle != -1)
{
close(m_fbHandle);
- m_fbHandle = 0;
+ m_fbHandle = -1;
}
CloseIPU();
@@ -1470,7 +1474,7 @@ void CIMXContext::CloseDevices()
bool CIMXContext::Blank()
{
- if (!m_fbHandle) return false;
+ if (m_fbHandle == -1) return false;
m_bFbIsConfigured = false;
return ioctl(m_fbHandle, FBIOBLANK, 1) == 0;
@@ -1478,7 +1482,7 @@ bool CIMXContext::Blank()
bool CIMXContext::Unblank()
{
- if (!m_fbHandle) return false;
+ if (m_fbHandle == -1) return false;
int ret = ioctl(m_fbHandle, FBIOBLANK, FB_BLANK_UNBLANK);
m_bFbIsConfigured = true;
@@ -1620,7 +1624,7 @@ bool CIMXContext::ShowPage()
{
CSingleLock lk(m_pageSwapLock);
- if (!m_bFbIsConfigured)
+ if (!m_bFbIsConfigured || m_fbHandle == -1 )
return false;
}
@@ -1632,6 +1636,8 @@ bool CIMXContext::ShowPage()
if (ioctl(m_fbHandle, MXCFB_WAIT_FOR_VSYNC, nullptr) < 0 && !CIMX::IsBlank())
CLog::Log(LOGWARNING, "Vsync failed: %s\n", strerror(errno));
+
+ return true;
}
void CIMXContext::SetProcessInfo(CProcessInfo *m_pProcessInfo)
--
1.9.1
==============================================================
file 0045-IMXRender-Fix-deinterlace-broken-by-refactor-patch.patch
==============================================================
From 710564e27cc8fd7b83d0913ac72c311fa6fece3c Mon Sep 17 00:00:00 2001
From: Rudi <r.ihle@s-t.de>
Date: Sun, 8 Jan 2017 16:32:13 +0100
Subject: [PATCH] IMXRender: Fix deinterlace broken by refactor patch
---
.../VideoRenderers/HwDecRender/RendererIMX.cpp | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp
index 5167bd2..bd15091 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp
@@ -140,7 +140,14 @@ bool CRendererIMX::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha)
CDVDVideoCodecIMXBuffer *buffer = static_cast<CDVDVideoCodecIMXBuffer*>(m_buffers[m_iYV12RenderBuffer].hwDec);
if (buffer)
{
- if (buffer == m_bufHistory[0] && flagsPrev == flags)
+ if (m_bufHistory[0] != buffer)
+ {
+ buffer->Lock();
+ SAFE_RELEASE(m_bufHistory[1]);
+ m_bufHistory[1] = m_bufHistory[0];
+ m_bufHistory[0] = buffer;
+ }
+ else if (flagsPrev == flags)
{
g_IMX.WaitVsync();
return true;
@@ -148,15 +155,6 @@ bool CRendererIMX::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha)
flagsPrev = flags;
- buffer->Lock();
-
- SAFE_RELEASE(m_bufHistory[1]);
- m_bufHistory[1] = m_bufHistory[0];
- m_bufHistory[0] = buffer;
-
- if (!(flags & RENDER_FLAG_FIELDMASK))
- SAFE_RELEASE(m_bufHistory[1]);
-
// this hack is needed to get the 2D mode of a 3D movie going
RENDER_STEREO_MODE stereo_mode = g_graphicsContext.GetStereoMode();
if (stereo_mode)
@@ -204,7 +202,7 @@ bool CRendererIMX::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha)
}
}
- g_IMXContext.Blit(m_bufHistory[1], m_bufHistory[0], srcRect, dstRect, fieldFmt);
+ g_IMXContext.Blit(m_bufHistory[1], buffer, srcRect, dstRect, fieldFmt);
}
#if 0
--
2.7.4
==============================================================
file 400-Boost-Center-Audio-Channel-on-Downmixing.patch
==============================================================
commit a509bdf1ed001423cad530c2f230937825ff2254
Author: WRXTASY <kodi@Ubuntu.12.04.5>
Date: Tue Aug 18 09:40:19 2015 +0800
Boost Center Audio Channel on Downmixing
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index faf423c..cf123fe 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -18893,6 +18893,21 @@ msgstr ""
#empty strings from id 37046 to 38009
+#: system/settings/settings.xml
+msgctxt "#38007"
+msgid "Boost centre channel when downmixing"
+msgstr ""
+
+#: system/settings/settings.xml
+msgctxt "#38008"
+msgid "Increase this value to make the dialogue louder compared to background sounds when downmixing multichannel audio"
+msgstr ""
+
+#: system/settings/settings.xml
+msgctxt "#38009"
+msgid "%i dB"
+msgstr ""
+
#: system/settings/rbp.xml
msgctxt "#38010"
msgid "GPU accelerated"
diff --git a/system/settings/settings.xml b/system/settings/settings.xml
index 3ef33e0..44a9036 100644
--- a/system/settings/settings.xml
+++ b/system/settings/settings.xml
@@ -2040,6 +2040,18 @@
</dependencies>
<control type="toggle" />
</setting>
+ <setting id="audiooutput.boostcenter" type="integer" label="38007" help="38008">
+ <level>2</level>
+ <default>0</default>
+ <constraints>
+ <minimum>0</minimum>
+ <step>1</step>
+ <maximum>30</maximum>
+ </constraints>
+ <control type="spinner" format="string">
+ <formatlabel>38009</formatlabel>
+ </control>
+ </setting>
<setting id="audiooutput.processquality" type="integer" label="13505" help="36169">
<requirement>HAS_AE_QUALITY_LEVELS</requirement>
<level>2</level>
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp
index e4ddf9e..34d0152 100644
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp
@@ -20,6 +20,7 @@
#include "cores/AudioEngine/Utils/AEUtil.h"
#include "ActiveAEResampleFFMPEG.h"
+#include "settings/Settings.h"
#include "utils/log.h"
extern "C" {
@@ -104,6 +105,12 @@ bool CActiveAEResampleFFMPEG::Init(uint64_t dst_chan_layout, int dst_channels, i
{
av_opt_set_double(m_pContext, "rematrix_maxval", 1.0, 0);
}
+ int boost_center = CSettings::GetInstance().GetInt("audiooutput.boostcenter");
+ if (boost_center)
+ {
+ float gain = pow(10.0f, ((float)(-3 + boost_center))/20.0f);
+ av_opt_set_double(m_pContext, "center_mix_level", gain, 0);
+ }
if (remapLayout)
{
==============================================================
file 53-imx-fix-edid-readout.patch
==============================================================
--- a/xbmc/windowing/egl/EGLNativeTypeIMX.cpp 2016-09-25 15:18:47.780677140 +0200
+++ b/xbmc/windowing/egl/EGLNativeTypeIMX.cpp 2016-09-25 15:18:47.808677141 +0200
@@ -336,67 +336,55 @@
float CEGLNativeTypeIMX::GetMonitorSAR()
{
FILE *f_edid;
- char *str = NULL;
- unsigned char p;
- size_t n;
- int done = 0;
+ int len;
// kernels <= 3.18 use ./soc0/soc.1 in official imx kernel
// kernels > 3.18 use ./soc0/soc
f_edid = fopen("/sys/devices/soc0/soc/20e0000.hdmi_video/edid", "r");
if(!f_edid)
f_edid = fopen("/sys/devices/soc0/soc.1/20e0000.hdmi_video/edid", "r");
+ if(!f_edid)
+ f_edid = fopen("/sys/devices/soc0/soc.0/20e0000.hdmi_video/edid", "r");
if(!f_edid)
return 0;
+ len = fread(m_edid, 1, EDID_MAXSIZE, f_edid);
+ if (len < 128)
+ {
+ fclose(f_edid);
+ return 0;
+ }
+
// first check if EDID is in binary format by reading 512bytes, compare 1st 8bytes
// against EDID 1.4 identificator [0x0,0xff,0xff,0xff,0xff,0xff,0xff,0x0]
// if no match, seek to 0 input file and continue with previous method.
- if (((done = fread(m_edid, 1, EDID_MAXSIZE, f_edid)) % 128) == 0 && done)
- if (!memcmp(m_edid, EDID_HEADER, EDID_HEADERSIZE))
- {
- fclose(f_edid);
- return true;
- }
-
- done = 0;
- memset(m_edid, 0, EDID_MAXSIZE);
- fseek(f_edid, 0L, SEEK_SET);
- // we need to convert mxc_hdmi output format to binary array
- // mxc_hdmi provides the EDID as space delimited 1bytes blocks
- // exported as text with format specifier %x eg:
- // 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 0x4C 0x2D 0x7A 0x0A 0x00 0x00 0x00 0x00
- //
- // this translates into the inner cycle where we move pointer first
- // with +2 to skip '0x',
- // we sscanf actual data (eg FF) into a byte,
- // we move over the FF and delimiting space with +3
- //
- // this parses whole 512 byte long info into internal binary array for future
- // reference and use. current use is only to grab screen's physical params
- // at EGL init.
- while(getline(&str, &n, f_edid) > 0)
+ if (memcmp(m_edid, EDID_HEADER, EDID_HEADERSIZE) != 0)
{
- char *c = str;
- while(*c != '\n' && done < EDID_MAXSIZE)
- {
- c += 2;
- sscanf(c, "%hhx", &p);
- m_edid[done++] = p;
- c += 3;
- }
- if (str)
- free(str);
- str = NULL;
+ // we need to convert mxc_hdmi output format to binary array
+ // mxc_hdmi provides the EDID as space delimited 1bytes blocks
+ // exported as text with format specifier %x eg:
+ // 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 0x4C 0x2D 0x7A 0x0A 0x00 0x00 0x00 0x00
+ //
+ // this parses whole 512 byte long info into internal binary array for future
+ // reference and use. current use is only to grab screen's physical params
+ // at EGL init.
+ len = 0;
+ fseek(f_edid, 0, SEEK_SET);
+ while (len < EDID_MAXSIZE && fscanf(f_edid, " 0x%2hhx", m_edid + len) == 1)
+ len++;
}
+
+ if (len < EDID_MAXSIZE)
+ memset(m_edid + len, 0, EDID_MAXSIZE - len);
+
fclose(f_edid);
// info related to 'Basic display parameters.' is at offset 0x14-0x18.
// where W is 2nd byte, H 3rd.
- int cmWidth = (int)*(m_edid +EDID_STRUCT_DISPLAY +1);
- int cmHeight = (int)*(m_edid +EDID_STRUCT_DISPLAY +2);
- if (cmHeight > 0)
+ int cmWidth = m_edid[EDID_STRUCT_DISPLAY + 1];
+ int cmHeight = m_edid[EDID_STRUCT_DISPLAY + 2];
+ if (cmHeight > 0 && cmWidth > 0)
{
float t_sar = (float) cmWidth / cmHeight;
if (t_sar >= 0.33 && t_sar <= 3.0)
==============================================================
file 55-cec-power-button.diff
==============================================================
--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp 2015-10-17 10:00:03.704969969 +0200
+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp 2015-10-17 10:00:03.724969970 +0200
@@ -935,8 +935,14 @@
case CEC_USER_CONTROL_CODE_POWER:
case CEC_USER_CONTROL_CODE_POWER_TOGGLE_FUNCTION:
case CEC_USER_CONTROL_CODE_POWER_OFF_FUNCTION:
- xbmcKey.iButton = XINPUT_IR_REMOTE_POWER;
- PushCecKeypress(xbmcKey);
+ // Instead of translating to XINPUT_IR_REMOTE_POWER key, we simulate
+ // CEC_OPCODE_STANDBY to avoid unconditional shutdown with some TVs.
+ {
+ cec_command command;
+ command.opcode = CEC_OPCODE_STANDBY;
+ command.initiator = CECDEVICE_TV;
+ CecCommand(this, &command);
+ }
break;
case CEC_USER_CONTROL_CODE_VOLUME_UP:
xbmcKey.iButton = XINPUT_IR_REMOTE_VOLUME_PLUS;
==============================================================
file 58-kodi-fractional-rates.diff
==============================================================
--- a/xbmc/windowing/egl/EGLNativeTypeIMX.cpp 2015-12-21 17:45:47.575690959 +0100
+++ b/xbmc/windowing/egl/EGLNativeTypeIMX.cpp 2015-12-21 17:45:47.615712478 +0100
@@ -434,7 +434,12 @@
res->iHeight= h;
res->iScreenWidth = w;
res->iScreenHeight= h;
- res->fRefreshRate = r;
+
+ if(r == 23 || (r % 10) == 9)
+ res->fRefreshRate = (float)((r + 1) * 1000) / 1001;
+ else
+ res->fRefreshRate = r;
+
res->dwFlags = p[0] == 'p' ? D3DPRESENTFLAG_PROGRESSIVE : D3DPRESENTFLAG_INTERLACED;
res->iScreen = 0;
==============================================================
file 59-kodi-cache-embedded-thumbnails.diff
==============================================================
--- a/xbmc/music/MusicThumbLoader.cpp 2016-01-31 15:03:34.251330287 +0100
+++ b/xbmc/music/MusicThumbLoader.cpp 2016-01-31 15:03:34.275330288 +0100
@@ -153,8 +153,11 @@
if (!pItem->HasArt("thumb"))
{
+ EmbeddedArt ea;
+
// Look for embedded art
- if (pItem->HasMusicInfoTag() && !pItem->GetMusicInfoTag()->GetCoverArtInfo().empty())
+ if (pItem->HasMusicInfoTag() &&
+ (!pItem->GetMusicInfoTag()->GetCoverArtInfo().empty() || GetEmbeddedThumb(pItem->GetPath(), ea)))
{
// The item has got embedded art but user thumbs overrule, so check for those first
if (!FillThumb(*pItem, false)) // Check for user thumbs but ignore folder thumbs
@@ -162,6 +165,7 @@
// No user thumb, use embedded art
std::string thumb = CTextureUtils::GetWrappedImageURL(pItem->GetPath(), "music");
pItem->SetArt("thumb", thumb);
+ SetCachedImage(*pItem, "thumb", thumb);
}
}
else
==============================================================
file 60-kodi-accumulate-data-for-visualisation.diff
==============================================================
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp 2015-10-19 08:31:15.000000000 +0200
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp 2016-02-07 18:32:00.431735589 +0100
@@ -1315,15 +1315,19 @@
if (!m_vizBuffers && !m_audioCallback.empty())
{
AEAudioFormat vizFormat = m_internalFormat;
- vizFormat.m_channelLayout = AE_CH_LAYOUT_2_0;
- vizFormat.m_dataFormat = AE_FMT_FLOAT;
- vizFormat.m_sampleRate = 44100;
+
+ // accumulate samples for the visualization addon
+ if (vizFormat.m_frames < 1536)
+ vizFormat.m_frames = 1536;
// input buffers
- m_vizBuffersInput = new CActiveAEBufferPool(m_internalFormat);
+ m_vizBuffersInput = new CActiveAEBufferPool(vizFormat);
m_vizBuffersInput->Create(2000);
// resample buffers
+ vizFormat.m_channelLayout = AE_CH_LAYOUT_2_0;
+ vizFormat.m_dataFormat = AE_FMT_FLOAT;
+ vizFormat.m_sampleRate = 44100;
m_vizBuffers = new CActiveAEBufferPoolResample(m_internalFormat, vizFormat, m_settings.resampleQuality);
//! @todo use cache of sync + water level
m_vizBuffers->Create(2000, false, false);
@@ -2147,18 +2151,33 @@
m_vizInitialized = true;
}
+ const int vizNumSamples = 512; // !!! Hack: This should be AUDIO_BUFFER_SIZE (addons/Visualization.h)
if (!m_vizBuffersInput->m_freeSamples.empty())
{
- // copy the samples into the viz input buffer
- CSampleBuffer *viz = m_vizBuffersInput->GetFreeBuffer();
- int samples = out->pkt->nb_samples;
- int bytes = samples * out->pkt->config.channels / out->pkt->planes * out->pkt->bytes_per_sample;
- for(int i= 0; i < out->pkt->planes; i++)
+ // copy the samples into the viz input buffer
+ CSampleBuffer *viz = m_vizBuffersInput->m_freeSamples.front();
+ int samples = std::min(vizNumSamples - viz->pkt->nb_samples, out->pkt->nb_samples);
+
+ // don't copy more than vizNumSamples
+ if (samples > 0)
{
- memcpy(viz->pkt->data[i], out->pkt->data[i], bytes);
+ int bytes = samples * out->pkt->config.channels / out->pkt->planes * out->pkt->bytes_per_sample;
+ int offset = viz->pkt->nb_samples * out->pkt->config.channels / out->pkt->planes * out->pkt->bytes_per_sample;
+ for(int i = 0; i < out->pkt->planes; i++)
+ memcpy(viz->pkt->data[i] + offset, out->pkt->data[i], bytes);
+ }
+
+ // consume complete source packet
+ viz->pkt->nb_samples += out->pkt->nb_samples;
+ if (viz->pkt->nb_samples >= viz->pkt->max_nb_samples)
+ {
+ // set valid sample count
+ viz->pkt->nb_samples = vizNumSamples;
+
+ m_vizBuffersInput->m_freeSamples.pop_front();
+ viz->refCount = 1;
+ m_vizBuffers->m_inputSamples.push_back(viz);
}
- viz->pkt->nb_samples = samples;
- m_vizBuffers->m_inputSamples.push_back(viz);
}
else
CLog::Log(LOGWARNING,"ActiveAE::%s - viz ran out of free buffers", __FUNCTION__);
@@ -2183,7 +2202,12 @@
}
}
else if (m_vizBuffers)
+ {
+ if (!m_vizBuffersInput->m_freeSamples.empty())
+ m_vizBuffersInput->m_freeSamples.front()->pkt->nb_samples = 0;
+
m_vizBuffers->Flush();
+ }
}
// mix gui sounds
==============================================================
file 65-fix-cec-dialog-text.diff
==============================================================
--- a/addons/resource.language.en_gb/resources/strings.po 2016-08-06 13:03:04.169879835 +0200
+++ b/addons/resource.language.en_gb/resources/strings.po 2016-08-06 13:03:04.197879836 +0200
@@ -16416,7 +16416,7 @@
#: system/peripherals.xml
msgctxt "#36026"
-msgid "Devices to also put in standby mode"
+msgid "Switch off the TV when the PC goes to standby"
msgstr ""
#: xbmc/peripherals/devices/PeripheralCecAdapter.cpp
==============================================================
file 66-fix-buffering-indicator.diff
==============================================================
--- a/xbmc/video/windows/GUIWindowFullScreen.cpp 2016-10-01 14:30:58.000000000 +0200
+++ b/xbmc/video/windows/GUIWindowFullScreen.cpp 2016-10-01 20:02:57.037598834 +0200
@@ -485,14 +485,16 @@
void CGUIWindowFullScreen::Process(unsigned int currentTime, CDirtyRegionList &dirtyregion)
{
- if (g_application.m_pPlayer->IsRenderingGuiLayer())
- MarkDirtyRegion();
+ unsigned int oldDirty = dirtyregion.size();
CGUIWindow::Process(currentTime, dirtyregion);
//! @todo This isn't quite optimal - ideally we'd only be dirtying up the actual video render rect
//! which is probably the job of the renderer as it can more easily track resizing etc.
m_renderRegion.SetRect(0, 0, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight());
+
+ if (dirtyregion.size() != oldDirty || g_application.m_pPlayer->IsRenderingGuiLayer())
+ dirtyregion.push_back(m_renderRegion);
}
void CGUIWindowFullScreen::Render()