diff --git a/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/package.mk b/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/package.mk
index 296e5bb2f6..4bd1db390b 100644
--- a/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="adsp.biquad.filters"
-PKG_VERSION="01236bb"
+PKG_VERSION="e08990f"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/inputstream.mpd/package.mk b/packages/mediacenter/kodi-binary-addons/inputstream.mpd/package.mk
index 5a43f7f38d..2cd3cf0d7b 100644
--- a/packages/mediacenter/kodi-binary-addons/inputstream.mpd/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/inputstream.mpd/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="inputstream.mpd"
-PKG_VERSION="b657bf3"
+PKG_VERSION="7898a67"
PKG_LICENSE="GPL"
PKG_SITE="http://www.kodi.tv"
PKG_URL="https://github.com/liberty-developer/inputstream.mpd/archive/$PKG_VERSION.tar.gz"
diff --git a/packages/mediacenter/kodi-binary-addons/inputstream.rtmp/package.mk b/packages/mediacenter/kodi-binary-addons/inputstream.rtmp/package.mk
index 0482ccb966..030debc226 100644
--- a/packages/mediacenter/kodi-binary-addons/inputstream.rtmp/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/inputstream.rtmp/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="inputstream.rtmp"
-PKG_VERSION="7bf2298"
+PKG_VERSION="9c05b8d"
PKG_LICENSE="GPL"
PKG_SITE="http://www.kodi.tv"
PKG_URL="https://github.com/notspiff/inputstream.rtmp/archive/$PKG_VERSION.tar.gz"
diff --git a/packages/mediacenter/kodi-binary-addons/inputstream.smoothstream/package.mk b/packages/mediacenter/kodi-binary-addons/inputstream.smoothstream/package.mk
index 9611126ca6..64d4d41b9f 100644
--- a/packages/mediacenter/kodi-binary-addons/inputstream.smoothstream/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/inputstream.smoothstream/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="inputstream.smoothstream"
-PKG_VERSION="99e7771"
+PKG_VERSION="b63ecbb"
PKG_LICENSE="GPL"
PKG_SITE="http://www.kodi.tv"
PKG_URL="https://github.com/mapfau/inputstream.smoothstream/archive/$PKG_VERSION.tar.gz"
diff --git a/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk b/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk
index 986c7f7df6..f7cf94aaa3 100644
--- a/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="peripheral.joystick"
-PKG_VERSION="6090a90"
+PKG_VERSION="8653627"
PKG_REV="0"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk
index b0b5eb1b6a..a9d8ea4b88 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.argustv"
-PKG_VERSION="e536f32"
+PKG_VERSION="299088b"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk
index f9ca8beb04..bad265b98e 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.dvblink"
-PKG_VERSION="20e1ccb"
+PKG_VERSION="ea3d98c"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk
index 99b4bee767..c0d4d9c812 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.dvbviewer"
-PKG_VERSION="7a7ead3"
+PKG_VERSION="f72c62f"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk
index 87c2283570..7ced351e63 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.filmon"
-PKG_VERSION="efd379b"
+PKG_VERSION="675c2b4"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.hdhomerun/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.hdhomerun/package.mk
index fd723511ed..ee189e3c72 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.hdhomerun/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.hdhomerun/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.hdhomerun"
-PKG_VERSION="a71e816"
+PKG_VERSION="eef1bd1"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk
index 9073632575..a2eb7f73c7 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.hts"
-PKG_VERSION="66dcb89"
+PKG_VERSION="48b2e26"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk
index 16c57e0b5c..cdcc9f5def 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.iptvsimple"
-PKG_VERSION="21e91a5"
+PKG_VERSION="a4c5255"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk
index 140728abbd..a5ade58a20 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.mediaportal.tvserver"
-PKG_VERSION="72452b9"
+PKG_VERSION="1042a71"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk
index 650d731054..21f0fce0e6 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.mythtv"
-PKG_VERSION="d10d210"
+PKG_VERSION="b1b426f"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk
index 0a77ca6439..4e5a046b47 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.nextpvr"
-PKG_VERSION="32b3c2f"
+PKG_VERSION="4dabcf4"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk
index 6e0a7447df..ceb533db70 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.pctv"
-PKG_VERSION="12d8baf"
+PKG_VERSION="d6d969f"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk
index 912c19e1ca..b0a4ad2f64 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.stalker"
-PKG_VERSION="b6cb9b8"
+PKG_VERSION="9c9c72e"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk
index 81df43829d..c7b7e85172 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.vbox"
-PKG_VERSION="f38f82f"
+PKG_VERSION="2750c92"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk
index 020fd77ddf..caec3e142f 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.vdr.vnsi"
-PKG_VERSION="8515b4b"
+PKG_VERSION="40c45dc"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk
index e1304f8886..ed52de19e4 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.vuplus"
-PKG_VERSION="4f2ad62"
+PKG_VERSION="7ab30d3"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk
index 7aaa50336e..a1c5ea566d 100644
--- a/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="pvr.wmc"
-PKG_VERSION="979c37d"
+PKG_VERSION="d9eac84"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.asteroids/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.asteroids/package.mk
index ae30f134eb..3ccaf3bfee 100644
--- a/packages/mediacenter/kodi-binary-addons/screensaver.asteroids/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/screensaver.asteroids/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="screensaver.asteroids"
-PKG_VERSION="2adf852"
+PKG_VERSION="0fc066d"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi-theme-Estuary/package.mk b/packages/mediacenter/kodi-theme-Estuary/package.mk
index fd4ff32f9a..8896eed39a 100644
--- a/packages/mediacenter/kodi-theme-Estuary/package.mk
+++ b/packages/mediacenter/kodi-theme-Estuary/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="kodi-theme-Estuary"
-PKG_VERSION="17.0-alpha3-fc46cf2"
+PKG_VERSION="17.0-beta1-81d5d26"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
diff --git a/packages/mediacenter/kodi/config/appliance.xml b/packages/mediacenter/kodi/config/appliance.xml
index f076765f84..0ad1fdccd2 100644
--- a/packages/mediacenter/kodi/config/appliance.xml
+++ b/packages/mediacenter/kodi/config/appliance.xml
@@ -1,16 +1,6 @@
-
-
@@ -45,15 +35,7 @@
-
-
-
- true
-
-
-
-
-
+
true
diff --git a/packages/mediacenter/kodi/config/repository.kodi.game/addon.xml b/packages/mediacenter/kodi/config/repository.kodi.game/addon.xml
index c2ce2650c7..f74c68aa72 100644
--- a/packages/mediacenter/kodi/config/repository.kodi.game/addon.xml
+++ b/packages/mediacenter/kodi/config/repository.kodi.game/addon.xml
@@ -5,7 +5,6 @@
provider-name="Team Kodi">
-
https://raw.githubusercontent.com/kodi-game/repository.kodi.game/master/release/addons.xml
diff --git a/packages/mediacenter/kodi/package.mk b/packages/mediacenter/kodi/package.mk
index f60022cde0..5d84f4711b 100644
--- a/packages/mediacenter/kodi/package.mk
+++ b/packages/mediacenter/kodi/package.mk
@@ -17,13 +17,13 @@
################################################################################
PKG_NAME="kodi"
-PKG_VERSION="17.0-alpha3-fc46cf2"
+PKG_VERSION="17.0-beta1-81d5d26"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://www.kodi.tv"
PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz"
-PKG_DEPENDS_TARGET="toolchain kodi:host xmlstarlet:host Python zlib systemd pciutils lzo pcre swig:host libass curl fontconfig fribidi tinyxml libjpeg-turbo freetype libcdio taglib libxml2 libxslt yajl sqlite ffmpeg crossguid giflib libdvdnav"
+PKG_DEPENDS_TARGET="toolchain kodi:host xmlstarlet:host Python zlib systemd pciutils lzo pcre swig:host libass curl fontconfig fribidi tinyxml libjpeg-turbo freetype libcdio taglib libxml2 libxslt yajl sqlite ffmpeg crossguid giflib libdvdnav libhdhomerun"
PKG_DEPENDS_HOST="lzo:host libpng:host libjpeg-turbo:host giflib:host"
PKG_PRIORITY="optional"
PKG_SECTION="mediacenter"
diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-PR10164-add-aetempo-filter.patch b/packages/mediacenter/kodi/patches/kodi-999.99-PR10164-add-aetempo-filter.patch
deleted file mode 100644
index e7664ca4cf..0000000000
--- a/packages/mediacenter/kodi/patches/kodi-999.99-PR10164-add-aetempo-filter.patch
+++ /dev/null
@@ -1,2039 +0,0 @@
-From 7f4f89ba3a36454b01c80103068e338a7d65dbfa Mon Sep 17 00:00:00 2001
-From: Rainer Hochecker
-Date: Mon, 18 Jul 2016 08:42:06 +0200
-Subject: [PATCH 1/4] AE: change usage of swr_set_compensation
-
----
- .../Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp | 21 +++++++++++----------
- .../Engines/ActiveAE/ActiveAEResampleFFMPEG.h | 1 +
- 2 files changed, 12 insertions(+), 10 deletions(-)
-
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp
-index c6a7f56..b0ab84b 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp
-@@ -58,6 +58,7 @@ bool CActiveAEResampleFFMPEG::Init(uint64_t dst_chan_layout, int dst_channels, i
- m_src_fmt = src_fmt;
- m_src_bits = src_bits;
- m_src_dither_bits = src_dither;
-+ m_resampleRatio = 1.0;
-
- if (m_dst_chan_layout == 0)
- m_dst_chan_layout = av_get_default_channel_layout(m_dst_channels);
-@@ -180,18 +181,18 @@ bool CActiveAEResampleFFMPEG::Init(uint64_t dst_chan_layout, int dst_channels, i
-
- int CActiveAEResampleFFMPEG::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, double ratio)
- {
-- int delta = 0;
-- int distance = 0;
-- if (ratio != 1.0)
-- {
-- delta = (dst_samples*ratio-dst_samples)*m_dst_rate/m_src_rate;
-- distance = dst_samples*m_dst_rate/m_src_rate;
-- }
-
-- if (swr_set_compensation(m_pContext, delta, distance) < 0)
-+ if (ratio != m_resampleRatio)
- {
-- CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Resample - set compensation failed");
-- return -1;
-+ int delta = m_dst_rate * ratio - m_dst_rate;
-+ int distance = m_dst_rate;
-+
-+ if (swr_set_compensation(m_pContext, delta, distance) < 0)
-+ {
-+ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Resample - set compensation failed");
-+ return -1;
-+ }
-+ m_resampleRatio = ratio;
- }
-
- int ret = swr_convert(m_pContext, dst_buffer, dst_samples, (const uint8_t**)src_buffer, src_samples);
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h
-index 372c8ee..f34f6f4 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h
-@@ -58,6 +58,7 @@ class CActiveAEResampleFFMPEG : public IAEResample
- int m_src_dither_bits, m_dst_dither_bits;
- SwrContext *m_pContext;
- double m_rematrix[AE_CH_MAX][AE_CH_MAX];
-+ double m_resampleRatio;
- };
-
- }
-
-From 8c676dee5542cb1fadca77c1b003f31e0c3d42ef Mon Sep 17 00:00:00 2001
-From: Rainer Hochecker
-Date: Sat, 23 Jul 2016 16:17:06 +0200
-Subject: [PATCH 2/4] AE: refactor resample buffers
-
----
- .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 149 +++++++++-----------
- .../Engines/ActiveAE/ActiveAEBuffer.cpp | 70 ++++++++++
- .../AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h | 52 ++++---
- .../Engines/ActiveAE/ActiveAEStream.cpp | 150 +++++++++++++++++++++
- .../AudioEngine/Engines/ActiveAE/ActiveAEStream.h | 31 ++++-
- 5 files changed, 343 insertions(+), 109 deletions(-)
-
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
-index 5bb87b2..26c99c7 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
-@@ -115,10 +115,10 @@ void CEngineStats::UpdateStream(CActiveAEStream *stream)
- float delay = 0;
- str.m_syncState = stream->m_syncState;
- str.m_syncError = stream->m_syncError.GetLastError(str.m_errorTime);
-- if (stream->m_resampleBuffers)
-+ if (stream->m_processingBuffers)
- {
-- str.m_resampleRatio = stream->m_resampleBuffers->m_resampleRatio;
-- delay += stream->m_resampleBuffers->GetDelay();
-+ str.m_resampleRatio = stream->m_processingBuffers->GetRR();
-+ delay += stream->m_processingBuffers->GetDelay();
- }
- else
- {
-@@ -403,7 +403,7 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg)
- case CActiveAEDataProtocol::DRAINSTREAM:
- stream = *(CActiveAEStream**)msg->data;
- stream->m_drain = true;
-- stream->m_resampleBuffers->m_drain = true;
-+ stream->m_processingBuffers->SetDrain(true);
- msg->Reply(CActiveAEDataProtocol::ACC);
- stream->m_streamPort->SendInMessage(CActiveAEDataProtocol::STREAMDRAINED);
- return;
-@@ -638,9 +638,9 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg)
- return;
- case CActiveAEControlProtocol::STREAMRESAMPLERATIO:
- par = (MsgStreamParameter*)msg->data;
-- if (par->stream->m_resampleBuffers)
-+ if (par->stream->m_processingBuffers)
- {
-- par->stream->m_resampleBuffers->m_resampleRatio = par->parameter.double_par;
-+ par->stream->m_processingBuffers->SetRR(par->parameter.double_par);
- }
- return;
- case CActiveAEControlProtocol::STREAMFFMPEGINFO:
-@@ -724,7 +724,7 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg)
- if (msgData->buffer->pkt->nb_samples == 0)
- msgData->buffer->Return();
- else
-- msgData->stream->m_resampleBuffers->m_inputSamples.push_back(msgData->buffer);
-+ msgData->stream->m_processingBuffers->m_inputSamples.push_back(msgData->buffer);
- m_extTimeout = 0;
- m_state = AE_TOP_CONFIGURED_PLAY;
- return;
-@@ -750,7 +750,7 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg)
- case CActiveAEDataProtocol::DRAINSTREAM:
- stream = *(CActiveAEStream**)msg->data;
- stream->m_drain = true;
-- stream->m_resampleBuffers->m_drain = true;
-+ stream->m_processingBuffers->SetDrain(true);
- m_extTimeout = 0;
- m_state = AE_TOP_CONFIGURED_PLAY;
- msg->Reply(CActiveAEDataProtocol::ACC);
-@@ -1272,26 +1272,28 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt)
- // if input format does not follow ffmpeg channel mask, we may need to remap channels
- (*it)->InitRemapper();
- }
-- if (initSink && (*it)->m_resampleBuffers)
-+ if (initSink && (*it)->m_processingBuffers)
- {
-- m_discardBufferPools.push_back((*it)->m_resampleBuffers);
-- (*it)->m_resampleBuffers = NULL;
-+ m_discardBufferPools.push_back((*it)->m_processingBuffers->GetResampleBuffers());
-+ delete (*it)->m_processingBuffers;
-+ (*it)->m_processingBuffers = nullptr;
- }
-- if (!(*it)->m_resampleBuffers)
-+ if (!(*it)->m_processingBuffers)
- {
- bool useDSP = !isRaw ? m_settings.dspaddonsenabled : false;
-
-- (*it)->m_resampleBuffers = new CActiveAEBufferPoolResample((*it)->m_inputBuffers->m_format, outputFormat, m_settings.resampleQuality);
-- (*it)->m_resampleBuffers->m_forceResampler = (*it)->m_forceResampler;
-- (*it)->m_resampleBuffers->m_bypassDSP = (*it)->m_bypassDSP;
-- if (useDSP && !(*it)->m_resampleBuffers->m_bypassDSP)
-- (*it)->m_resampleBuffers->SetExtraData((*it)->m_profile, (*it)->m_matrixEncoding, (*it)->m_audioServiceType);
-- (*it)->m_resampleBuffers->Create(MAX_CACHE_LEVEL*1000, false, m_settings.stereoupmix, m_settings.normalizelevels, useDSP);
-+ (*it)->m_processingBuffers = new CActiveAEStreamBuffers((*it)->m_inputBuffers->m_format, outputFormat, m_settings.resampleQuality);
-+ (*it)->m_processingBuffers->ForceResampler((*it)->m_forceResampler);
-+ (*it)->m_processingBuffers->SetDSPConfig(useDSP, (*it)->m_bypassDSP);
-+
-+ if (useDSP && !(*it)->m_bypassDSP)
-+ (*it)->m_processingBuffers->SetExtraData((*it)->m_profile, (*it)->m_matrixEncoding, (*it)->m_audioServiceType);
-+ (*it)->m_processingBuffers->Create(MAX_CACHE_LEVEL*1000, false, m_settings.stereoupmix, m_settings.normalizelevels, useDSP);
-
- m_stats.SetDSP(useDSP);
- }
- if (m_mode == MODE_TRANSCODE || m_streams.size() > 1)
-- (*it)->m_resampleBuffers->m_fillPackets = true;
-+ (*it)->m_processingBuffers->FillBuffer();
-
- // amplification
- (*it)->m_limiter.SetSamplerate(outputFormat.m_sampleRate);
-@@ -1395,7 +1397,7 @@ CActiveAEStream* CActiveAE::CreateStream(MsgStreamNew *streamMsg)
-
- // create buffer pool
- stream->m_inputBuffers = NULL; // create in Configure when we know the sink format
-- stream->m_resampleBuffers = NULL; // create in Configure when we know the sink format
-+ stream->m_processingBuffers = NULL; // create in Configure when we know the sink format
- stream->m_fadingSamples = 0;
- stream->m_started = false;
- stream->m_resampleMode = 0;
-@@ -1437,8 +1439,9 @@ void CActiveAE::DiscardStream(CActiveAEStream *stream)
- }
- if ((*it)->m_inputBuffers)
- m_discardBufferPools.push_back((*it)->m_inputBuffers);
-- if ((*it)->m_resampleBuffers)
-- m_discardBufferPools.push_back((*it)->m_resampleBuffers);
-+ if ((*it)->m_processingBuffers)
-+ m_discardBufferPools.push_back((*it)->m_processingBuffers->GetResampleBuffers());
-+ delete (*it)->m_processingBuffers;
- CLog::Log(LOGDEBUG, "CActiveAE::DiscardStream - audio stream deleted");
- m_stats.RemoveStream((*it)->m_id);
- delete (*it)->m_streamPort;
-@@ -1459,7 +1462,7 @@ void CActiveAE::SFlushStream(CActiveAEStream *stream)
- stream->m_processingSamples.front()->Return();
- stream->m_processingSamples.pop_front();
- }
-- stream->m_resampleBuffers->Flush();
-+ stream->m_processingBuffers->Flush();
- stream->m_streamPort->Purge();
- stream->m_bufferedTime = 0.0;
- stream->m_paused = false;
-@@ -1561,36 +1564,7 @@ void CActiveAE::ChangeResamplers()
- std::list::iterator it;
- for(it=m_streams.begin(); it!=m_streams.end(); ++it)
- {
-- bool normalize = true;
-- if (((*it)->m_resampleBuffers->m_format.m_channelLayout.Count() <
-- (*it)->m_resampleBuffers->m_inputFormat.m_channelLayout.Count()) &&
-- !m_settings.normalizelevels)
-- normalize = false;
--
-- /* Disable upmix if DSP layout > 2.0, becomes perfomed by DSP */
-- bool ignoreUpmix = false;
-- if (m_settings.dspaddonsenabled && (*it)->m_resampleBuffers->m_useDSP && (*it)->m_resampleBuffers->m_processor->GetChannelLayout().Count() > 2)
-- ignoreUpmix = true;
--
-- if ((*it)->m_resampleBuffers->m_useResampler &&
-- (((*it)->m_resampleBuffers->m_resampleQuality != m_settings.resampleQuality) ||
-- (((*it)->m_resampleBuffers->m_stereoUpmix != m_settings.stereoupmix) && !ignoreUpmix) ||
-- ((*it)->m_resampleBuffers->m_normalize != normalize)))
-- {
-- (*it)->m_resampleBuffers->m_changeResampler = true;
-- }
-- if ((*it)->m_resampleBuffers->m_useDSP != m_settings.dspaddonsenabled ||
-- ((*it)->m_resampleBuffers->m_useDSP &&
-- (((*it)->m_resampleBuffers->m_resampleQuality != m_settings.resampleQuality) ||
-- ((*it)->m_resampleBuffers->m_stereoUpmix != m_settings.stereoupmix))))
-- {
-- (*it)->m_resampleBuffers->m_changeDSP = true;
-- }
--
-- (*it)->m_resampleBuffers->m_useDSP = m_settings.dspaddonsenabled;
-- (*it)->m_resampleBuffers->m_resampleQuality = m_settings.resampleQuality;
-- (*it)->m_resampleBuffers->m_stereoUpmix = m_settings.stereoupmix;
-- (*it)->m_resampleBuffers->m_normalize = normalize;
-+ (*it)->m_processingBuffers->ConfigureResampler(m_settings.normalizelevels, m_settings.dspaddonsenabled, m_settings.stereoupmix, m_settings.resampleQuality);
- }
- }
-
-@@ -1850,12 +1824,12 @@ bool CActiveAE::RunStages()
- std::list::iterator it;
- for (it = m_streams.begin(); it != m_streams.end(); ++it)
- {
-- if ((*it)->m_resampleBuffers && !(*it)->m_paused)
-- busy = (*it)->m_resampleBuffers->ResampleBuffers();
-+ if ((*it)->m_processingBuffers && !(*it)->m_paused)
-+ busy = (*it)->m_processingBuffers->ProcessBuffers();
-
- if ((*it)->m_streamIsBuffering &&
-- (*it)->m_resampleBuffers &&
-- ((*it)->m_resampleBuffers->m_inputSamples.size() > (*it)->m_resampleBuffers->m_allSamples.size() * 0.5))
-+ (*it)->m_processingBuffers &&
-+ ((*it)->m_processingBuffers->HasInputLevel(50)))
- {
- CSingleLock lock((*it)->m_streamLock);
- (*it)->m_streamIsBuffering = false;
-@@ -1880,13 +1854,12 @@ bool CActiveAE::RunStages()
- }
- else
- {
-- if ((*it)->m_resampleBuffers->m_inputSamples.empty() &&
-- (*it)->m_resampleBuffers->m_outputSamples.empty() &&
-+ if ((*it)->m_processingBuffers->IsDrained() &&
- (*it)->m_processingSamples.empty())
- {
- (*it)->m_streamPort->SendInMessage(CActiveAEDataProtocol::STREAMDRAINED);
- (*it)->m_drain = false;
-- (*it)->m_resampleBuffers->m_drain = false;
-+ (*it)->m_processingBuffers->SetDrain(false);
- (*it)->m_started = false;
-
- // set variables being polled via stream interface
-@@ -1915,13 +1888,13 @@ bool CActiveAE::RunStages()
- // calculate sync error
- for (it = m_streams.begin(); it != m_streams.end(); ++it)
- {
-- if ((*it)->m_paused || !(*it)->m_started || !(*it)->m_resampleBuffers || !(*it)->m_pClock)
-+ if ((*it)->m_paused || !(*it)->m_started || !(*it)->m_processingBuffers || !(*it)->m_pClock)
- continue;
-
-- if ((*it)->m_resampleBuffers->m_outputSamples.empty())
-+ if ((*it)->m_processingBuffers->m_outputSamples.empty())
- continue;
-
-- CSampleBuffer *buf = (*it)->m_resampleBuffers->m_outputSamples.front();
-+ CSampleBuffer *buf = (*it)->m_processingBuffers->m_outputSamples.front();
- if (buf->timestamp)
- {
- AEDelayStatus status;
-@@ -1959,20 +1932,20 @@ bool CActiveAE::RunStages()
- bool allStreamsReady = true;
- for (it = m_streams.begin(); it != m_streams.end(); ++it)
- {
-- if ((*it)->m_paused || !(*it)->m_started || !(*it)->m_resampleBuffers)
-+ if ((*it)->m_paused || !(*it)->m_started || !(*it)->m_processingBuffers)
- continue;
-
-- if ((*it)->m_resampleBuffers->m_outputSamples.empty())
-+ if ((*it)->m_processingBuffers->m_outputSamples.empty())
- allStreamsReady = false;
- }
-
- bool needClamp = false;
- for (it = m_streams.begin(); it != m_streams.end() && allStreamsReady; ++it)
- {
-- if ((*it)->m_paused || !(*it)->m_resampleBuffers)
-+ if ((*it)->m_paused || !(*it)->m_processingBuffers)
- continue;
-
-- if (!(*it)->m_resampleBuffers->m_outputSamples.empty())
-+ if (!(*it)->m_processingBuffers->m_outputSamples.empty())
- {
- CSampleBuffer *tmp = SyncStream(*it);
- m_stats.UpdateStream(*it);
-@@ -1987,8 +1960,8 @@ bool CActiveAE::RunStages()
-
- if (!out)
- {
-- out = (*it)->m_resampleBuffers->m_outputSamples.front();
-- (*it)->m_resampleBuffers->m_outputSamples.pop_front();
-+ out = (*it)->m_processingBuffers->m_outputSamples.front();
-+ (*it)->m_processingBuffers->m_outputSamples.pop_front();
-
- int nb_floats = out->pkt->nb_samples * out->pkt->config.channels / out->pkt->planes;
- int nb_loops = 1;
-@@ -2020,7 +1993,7 @@ bool CActiveAE::RunStages()
- // turned off downmix normalization,
- // or if sink format is float (in order to prevent from clipping)
- // we need to run on a per sample basis
-- if ((*it)->m_amplify != 1.0 || !(*it)->m_resampleBuffers->m_normalize || (m_sinkFormat.m_dataFormat == AE_FMT_FLOAT))
-+ if ((*it)->m_amplify != 1.0 || !(*it)->m_processingBuffers->DoesNormalize() || (m_sinkFormat.m_dataFormat == AE_FMT_FLOAT))
- {
- nb_floats = out->pkt->config.channels / out->pkt->planes;
- nb_loops = out->pkt->nb_samples;
-@@ -2063,8 +2036,8 @@ bool CActiveAE::RunStages()
- else
- {
- CSampleBuffer *mix = NULL;
-- mix = (*it)->m_resampleBuffers->m_outputSamples.front();
-- (*it)->m_resampleBuffers->m_outputSamples.pop_front();
-+ mix = (*it)->m_processingBuffers->m_outputSamples.front();
-+ (*it)->m_processingBuffers->m_outputSamples.pop_front();
-
- int nb_floats = mix->pkt->nb_samples * mix->pkt->config.channels / mix->pkt->planes;
- int nb_loops = 1;
-@@ -2087,7 +2060,7 @@ bool CActiveAE::RunStages()
-
- // for streams amplification of turned off downmix normalization
- // we need to run on a per sample basis
-- if ((*it)->m_amplify != 1.0 || !(*it)->m_resampleBuffers->m_normalize)
-+ if ((*it)->m_amplify != 1.0 || !(*it)->m_processingBuffers->DoesNormalize())
- {
- nb_floats = out->pkt->config.channels / out->pkt->planes;
- nb_loops = out->pkt->nb_samples;
-@@ -2244,15 +2217,15 @@ bool CActiveAE::RunStages()
- CSampleBuffer *buffer;
- for (it = m_streams.begin(); it != m_streams.end(); ++it)
- {
-- if (!(*it)->m_resampleBuffers->m_outputSamples.empty() && !(*it)->m_paused)
-+ if (!(*it)->m_processingBuffers->m_outputSamples.empty() && !(*it)->m_paused)
- {
- (*it)->m_started = true;
- buffer = SyncStream(*it);
- m_stats.UpdateStream(*it);
- if (!buffer)
- {
-- buffer = (*it)->m_resampleBuffers->m_outputSamples.front();
-- (*it)->m_resampleBuffers->m_outputSamples.pop_front();
-+ buffer = (*it)->m_processingBuffers->m_outputSamples.front();
-+ (*it)->m_processingBuffers->m_outputSamples.pop_front();
- }
- m_stats.AddSamples(1, m_streams);
- m_sinkBuffers->m_inputSamples.push_back(buffer);
-@@ -2288,9 +2261,7 @@ bool CActiveAE::HasWork()
- std::list::iterator it;
- for (it = m_streams.begin(); it != m_streams.end(); ++it)
- {
-- if (!(*it)->m_resampleBuffers->m_inputSamples.empty())
-- return true;
-- if (!(*it)->m_resampleBuffers->m_outputSamples.empty())
-+ if (!(*it)->m_processingBuffers->HasWork())
- return true;
- if (!(*it)->m_processingSamples.empty())
- return true;
-@@ -2310,7 +2281,7 @@ CSampleBuffer* CActiveAE::SyncStream(CActiveAEStream *stream)
- {
- stream->m_syncState = CAESyncInfo::AESyncState::SYNC_MUTE;
- stream->m_syncError.Flush(100);
-- stream->m_resampleBuffers->m_resampleRatio = 1.0;
-+ stream->m_processingBuffers->SetRR(1.0);
- stream->m_resampleIntegral = 0;
- CLog::Log(LOGDEBUG,"ActiveAE - start sync of audio stream");
- }
-@@ -2331,7 +2302,7 @@ CSampleBuffer* CActiveAE::SyncStream(CActiveAEStream *stream)
- if (newerror && fabs(error) > threshold && stream->m_syncState == CAESyncInfo::AESyncState::SYNC_INSYNC)
- {
- stream->m_syncState = CAESyncInfo::AESyncState::SYNC_ADJUST;
-- stream->m_resampleBuffers->m_resampleRatio = 1.0;
-+ stream->m_processingBuffers->SetRR(1.0);
- stream->m_resampleIntegral = 0;
- stream->m_lastSyncError = error;
- CLog::Log(LOGDEBUG,"ActiveAE::SyncStream - average error %f above threshold of %f", error, threshold);
-@@ -2345,11 +2316,11 @@ CSampleBuffer* CActiveAE::SyncStream(CActiveAEStream *stream)
-
- if (stream->m_syncState == CAESyncInfo::AESyncState::SYNC_MUTE)
- {
-- CSampleBuffer *buf = stream->m_resampleBuffers->m_outputSamples.front();
-+ CSampleBuffer *buf = stream->m_processingBuffers->m_outputSamples.front();
- if (m_mode == MODE_RAW)
- {
- buf->pkt->nb_samples = 0;
-- buf->pkt->pause_burst_ms = stream->m_resampleBuffers->m_format.m_streamInfo.GetDuration();
-+ buf->pkt->pause_burst_ms = stream->m_processingBuffers->m_inputFormat.m_streamInfo.GetDuration();
- }
- else
- {
-@@ -2408,7 +2379,7 @@ CSampleBuffer* CActiveAE::SyncStream(CActiveAEStream *stream)
- }
- else
- {
-- CSampleBuffer *buf = stream->m_resampleBuffers->m_outputSamples.front();
-+ CSampleBuffer *buf = stream->m_processingBuffers->m_outputSamples.front();
- int framesToSkip = -error / 1000 * buf->pkt->config.sample_rate;
- if (framesToSkip > buf->pkt->nb_samples)
- framesToSkip = buf->pkt->nb_samples;
-@@ -2455,7 +2426,7 @@ CSampleBuffer* CActiveAE::SyncStream(CActiveAEStream *stream)
- stream->m_syncState = CAESyncInfo::AESyncState::SYNC_INSYNC;
- stream->m_syncError.Flush(1000);
- stream->m_resampleIntegral = 0;
-- stream->m_resampleBuffers->m_resampleRatio = 1.0;
-+ stream->m_processingBuffers->SetRR(1.0);
- CLog::Log(LOGDEBUG,"ActiveAE::SyncStream - average error %f below threshold of %f", error, 30.0);
- }
- }
-@@ -2468,14 +2439,14 @@ CSampleBuffer* CActiveAE::SyncStream(CActiveAEStream *stream)
-
- if (stream->m_resampleMode)
- {
-- if (stream->m_resampleBuffers)
-+ if (stream->m_processingBuffers)
- {
-- stream->m_resampleBuffers->m_resampleRatio = stream->CalcResampleRatio(error);
-+ stream->m_processingBuffers->SetRR(stream->CalcResampleRatio(error));
- }
- }
-- else if (stream->m_resampleBuffers)
-+ else if (stream->m_processingBuffers)
- {
-- stream->m_resampleBuffers->m_resampleRatio = 1.0;
-+ stream->m_processingBuffers->SetRR(1.0);
- }
- return ret;
- }
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp
-index bc49ce2..8e58a07 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp
-@@ -544,6 +544,40 @@ bool CActiveAEBufferPoolResample::ResampleBuffers(int64_t timestamp)
- return busy;
- }
-
-+void CActiveAEBufferPoolResample::ConfigureResampler(bool normalizelevels, bool dspenabled, bool stereoupmix, AEQuality quality)
-+{
-+ bool normalize = true;
-+ if ((m_format.m_channelLayout.Count() < m_inputFormat.m_channelLayout.Count()) &&
-+ normalizelevels)
-+ normalize = false;
-+
-+ /* Disable upmix if DSP layout > 2.0, becomes perfomed by DSP */
-+ bool ignoreUpmix = false;
-+ if (dspenabled && m_useDSP && m_processor->GetChannelLayout().Count() > 2)
-+ ignoreUpmix = true;
-+
-+ if (m_useResampler &&
-+ ((m_resampleQuality != quality) ||
-+ ((m_stereoUpmix != stereoupmix) && !ignoreUpmix) ||
-+ (m_normalize != normalize)))
-+ {
-+ m_changeResampler = true;
-+ }
-+
-+ if (m_useDSP != dspenabled ||
-+ (m_useDSP &&
-+ ((m_resampleQuality != quality) ||
-+ (m_stereoUpmix != stereoupmix))))
-+ {
-+ m_changeDSP = true;
-+ }
-+
-+ m_useDSP = dspenabled;
-+ m_resampleQuality = quality;
-+ m_stereoUpmix = stereoupmix;
-+ m_normalize = normalize;
-+}
-+
- float CActiveAEBufferPoolResample::GetDelay()
- {
- float delay = 0;
-@@ -603,3 +637,39 @@ void CActiveAEBufferPoolResample::Flush()
- if (m_resampler)
- ChangeResampler();
- }
-+
-+void CActiveAEBufferPoolResample::SetDrain(bool drain)
-+{
-+ m_drain = drain;
-+}
-+
-+void CActiveAEBufferPoolResample::SetRR(double rr)
-+{
-+ m_resampleRatio = rr;
-+}
-+
-+double CActiveAEBufferPoolResample::GetRR()
-+{
-+ return m_resampleRatio;
-+}
-+
-+void CActiveAEBufferPoolResample::FillBuffer()
-+{
-+ m_fillPackets = true;
-+}
-+
-+bool CActiveAEBufferPoolResample::DoesNormalize()
-+{
-+ return m_normalize;
-+}
-+
-+void CActiveAEBufferPoolResample::ForceResampler(bool force)
-+{
-+ m_forceResampler = force;
-+}
-+
-+void CActiveAEBufferPoolResample::SetDSPConfig(bool usedsp, bool bypassdsp)
-+{
-+ m_useDSP = usedsp;
-+ m_bypassDSP = bypassdsp;
-+}
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h
-index 3bb7990..37e03d2 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h
-@@ -96,42 +96,56 @@ class CActiveAEBufferPoolResample : public CActiveAEBufferPool
- public:
- CActiveAEBufferPoolResample(AEAudioFormat inputFormat, AEAudioFormat outputFormat, AEQuality quality);
- virtual ~CActiveAEBufferPoolResample();
-- virtual bool Create(unsigned int totaltime, bool remap, bool upmix, bool normalize = true, bool useDSP = false);
-+ bool Create(unsigned int totaltime, bool remap, bool upmix, bool normalize = true, bool useDSP = false);
- void SetExtraData(int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type);
-- void ChangeResampler();
-- void ChangeAudioDSP();
- bool ResampleBuffers(int64_t timestamp = 0);
-+ void ConfigureResampler(bool normalizelevels, bool dspenabled, bool stereoupmix, AEQuality quality);
- float GetDelay();
- void Flush();
-+ void SetDrain(bool drain);
-+ void SetRR(double rr);
-+ double GetRR();
-+ void FillBuffer();
-+ bool DoesNormalize();
-+ void ForceResampler(bool force);
-+ void SetDSPConfig(bool usedsp, bool bypassdsp);
- AEAudioFormat m_inputFormat;
-- AEAudioFormat m_dspFormat;
- std::deque m_inputSamples;
- std::deque m_outputSamples;
-+
-+protected:
-+ void ChangeResampler();
-+
-+ uint8_t *m_planes[16];
-+ bool m_empty;
-+ bool m_drain;
-+ int m_Profile;
-+ int64_t m_lastSamplePts;
-+ bool m_remap;
- CSampleBuffer *m_procSample;
- IAEResample *m_resampler;
-- CSampleBuffer *m_dspSample;
-- CActiveAEBufferPool *m_dspBuffer;
-- CActiveAEDSPProcessPtr m_processor;
-- uint8_t *m_planes[16];
-+ double m_resampleRatio;
- bool m_fillPackets;
-- bool m_drain;
-- bool m_empty;
-+ bool m_stereoUpmix;
-+ bool m_normalize;
- bool m_useResampler;
-- bool m_useDSP;
-- bool m_bypassDSP;
- bool m_changeResampler;
- bool m_forceResampler;
-- bool m_changeDSP;
-- double m_resampleRatio;
- AEQuality m_resampleQuality;
-- bool m_stereoUpmix;
-- bool m_normalize;
-- bool m_remap;
-- int64_t m_lastSamplePts;
-+
-+ // ADSP
-+ // TODO move away from resample buffers
-+ void ChangeAudioDSP();
- unsigned int m_streamId;
- enum AVMatrixEncoding m_MatrixEncoding;
- enum AVAudioServiceType m_AudioServiceType;
-- int m_Profile;
-+ CSampleBuffer *m_dspSample;
-+ AEAudioFormat m_dspFormat;
-+ CActiveAEDSPProcessPtr m_processor;
-+ CActiveAEBufferPool *m_dspBuffer;
-+ bool m_changeDSP;
-+ bool m_useDSP;
-+ bool m_bypassDSP;
- };
-
- }
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
-index 1d58691..cc5837f 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
-@@ -569,3 +569,153 @@ void CActiveAEStream::RegisterSlave(IAEStream *slave)
- m_streamSlave = slave;
- }
-
-+//------------------------------------------------------------------------------
-+// CActiveAEStreamBuffers
-+//------------------------------------------------------------------------------
-+
-+CActiveAEStreamBuffers::CActiveAEStreamBuffers(AEAudioFormat inputFormat, AEAudioFormat outputFormat, AEQuality quality)
-+{
-+ m_inputFormat = inputFormat;
-+ m_resampleBuffers = new CActiveAEBufferPoolResample(inputFormat, outputFormat, quality);
-+}
-+
-+CActiveAEStreamBuffers::~CActiveAEStreamBuffers()
-+{
-+ delete m_resampleBuffers;
-+}
-+
-+bool CActiveAEStreamBuffers::HasInputLevel(int level)
-+{
-+ if (m_inputSamples.size() > m_resampleBuffers->m_allSamples.size() * 100 / level)
-+ return true;
-+ else
-+ return false;
-+}
-+
-+bool CActiveAEStreamBuffers::Create(unsigned int totaltime, bool remap, bool upmix, bool normalize, bool useDSP)
-+{
-+ return m_resampleBuffers->Create(totaltime, remap, upmix, normalize, useDSP);
-+}
-+
-+void CActiveAEStreamBuffers::SetExtraData(int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type)
-+{
-+ m_resampleBuffers->SetExtraData(profile, matrix_encoding, audio_service_type);
-+}
-+
-+bool CActiveAEStreamBuffers::ProcessBuffers()
-+{
-+ bool busy = false;
-+ CSampleBuffer *buf;
-+
-+ while (!m_inputSamples.empty())
-+ {
-+ buf = m_inputSamples.front();
-+ m_inputSamples.pop_front();
-+ m_resampleBuffers->m_inputSamples.push_back(buf);
-+ busy = true;
-+ }
-+
-+ busy |= m_resampleBuffers->ResampleBuffers();
-+
-+ while (!m_resampleBuffers->m_outputSamples.empty())
-+ {
-+ buf = m_resampleBuffers->m_outputSamples.front();
-+ m_resampleBuffers->m_outputSamples.pop_front();
-+ m_outputSamples.push_back(buf);
-+ busy = true;
-+ }
-+
-+ return busy;
-+}
-+
-+void CActiveAEStreamBuffers::ConfigureResampler(bool normalizelevels, bool dspenabled, bool stereoupmix, AEQuality quality)
-+{
-+ m_resampleBuffers->ConfigureResampler(normalizelevels, dspenabled, stereoupmix, quality);
-+}
-+
-+float CActiveAEStreamBuffers::GetDelay()
-+{
-+ return m_resampleBuffers->GetDelay();
-+}
-+
-+void CActiveAEStreamBuffers::Flush()
-+{
-+ m_resampleBuffers->Flush();
-+ while (!m_inputSamples.empty())
-+ {
-+ m_inputSamples.front()->Return();
-+ m_inputSamples.pop_front();
-+ }
-+ while (!m_outputSamples.empty())
-+ {
-+ m_outputSamples.front()->Return();
-+ m_outputSamples.pop_front();
-+ }
-+}
-+
-+void CActiveAEStreamBuffers::SetDrain(bool drain)
-+{
-+ m_resampleBuffers->SetDrain(drain);
-+}
-+
-+bool CActiveAEStreamBuffers::IsDrained()
-+{
-+ if (m_resampleBuffers->m_inputSamples.empty() &&
-+ m_resampleBuffers->m_outputSamples.empty() &&
-+ m_inputSamples.empty() &&
-+ m_outputSamples.empty())
-+ return true;
-+ else
-+ return false;
-+}
-+
-+void CActiveAEStreamBuffers::SetRR(double rr)
-+{
-+ m_resampleBuffers->SetRR(rr);
-+}
-+
-+double CActiveAEStreamBuffers::GetRR()
-+{
-+ return m_resampleBuffers->GetRR();
-+}
-+
-+void CActiveAEStreamBuffers::FillBuffer()
-+{
-+ m_resampleBuffers->FillBuffer();
-+}
-+
-+bool CActiveAEStreamBuffers::DoesNormalize()
-+{
-+ return m_resampleBuffers->DoesNormalize();
-+}
-+
-+void CActiveAEStreamBuffers::ForceResampler(bool force)
-+{
-+ m_resampleBuffers->ForceResampler(force);
-+}
-+
-+void CActiveAEStreamBuffers::SetDSPConfig(bool usedsp, bool bypassdsp)
-+{
-+ m_resampleBuffers->SetDSPConfig(usedsp, bypassdsp);
-+}
-+
-+CActiveAEBufferPool* CActiveAEStreamBuffers::GetResampleBuffers()
-+{
-+ CActiveAEBufferPool *ret = m_resampleBuffers;
-+ m_resampleBuffers = nullptr;
-+ return ret;
-+}
-+
-+bool CActiveAEStreamBuffers::HasWork()
-+{
-+ if (!m_inputSamples.empty())
-+ return true;
-+ if (!m_outputSamples.empty())
-+ return true;
-+ if (!m_resampleBuffers->m_inputSamples.empty())
-+ return true;
-+ if (!m_resampleBuffers->m_outputSamples.empty())
-+ return true;
-+
-+ return false;
-+}
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h
-index 0fd959b..1340efd 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h
-@@ -89,6 +89,35 @@ class CSyncError
- XbmcThreads::EndTime m_timer;
- };
-
-+class CActiveAEStreamBuffers
-+{
-+public:
-+ CActiveAEStreamBuffers(AEAudioFormat inputFormat, AEAudioFormat outputFormat, AEQuality quality);
-+ virtual ~CActiveAEStreamBuffers();
-+ bool Create(unsigned int totaltime, bool remap, bool upmix, bool normalize = true, bool useDSP = false);
-+ void SetExtraData(int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type);
-+ bool ProcessBuffers();
-+ void ConfigureResampler(bool normalizelevels, bool dspenabled, bool stereoupmix, AEQuality quality);
-+ bool HasInputLevel(int level);
-+ float GetDelay();
-+ void Flush();
-+ void SetDrain(bool drain);
-+ bool IsDrained();
-+ void SetRR(double rr);
-+ double GetRR();
-+ void FillBuffer();
-+ bool DoesNormalize();
-+ void ForceResampler(bool force);
-+ void SetDSPConfig(bool usedsp, bool bypassdsp);
-+ bool HasWork();
-+ CActiveAEBufferPool *GetResampleBuffers();
-+ AEAudioFormat m_inputFormat;
-+ std::deque m_outputSamples;
-+ std::deque m_inputSamples;
-+
-+protected:
-+ CActiveAEBufferPoolResample *m_resampleBuffers;
-+};
-
- class CActiveAEStream : public IAEStream
- {
-@@ -176,7 +205,7 @@ class CActiveAEStream : public IAEStream
-
- // only accessed by engine
- CActiveAEBufferPool *m_inputBuffers;
-- CActiveAEBufferPoolResample *m_resampleBuffers;
-+ CActiveAEStreamBuffers *m_processingBuffers;
- std::deque m_processingSamples;
- CActiveAEDataProtocol *m_streamPort;
- CEvent m_inMsgEvent;
-
-From 3acccef70908fbcc947307789e91987cfa981395 Mon Sep 17 00:00:00 2001
-From: Rainer Hochecker
-Date: Fri, 15 Jul 2016 08:36:01 +0200
-Subject: [PATCH 3/4] AE: add ffmpeg atempo filter
-
----
- Kodi.xcodeproj/project.pbxproj | 8 +
- project/VS2010Express/XBMC.vcxproj | 2 +
- project/VS2010Express/XBMC.vcxproj.filters | 8 +-
- xbmc/cores/AudioEngine/CMakeLists.txt | 2 +
- .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 6 +
- .../Engines/ActiveAE/ActiveAEBuffer.cpp | 259 +++++++++++++++-
- .../AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h | 32 ++
- .../Engines/ActiveAE/ActiveAEFilter.cpp | 332 +++++++++++++++++++++
- .../AudioEngine/Engines/ActiveAE/ActiveAEFilter.h | 69 +++++
- .../Engines/ActiveAE/ActiveAEStream.cpp | 72 ++++-
- .../AudioEngine/Engines/ActiveAE/ActiveAEStream.h | 3 +
- xbmc/cores/AudioEngine/Makefile.in | 1 +
- 12 files changed, 787 insertions(+), 7 deletions(-)
- create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp
- create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h
-
-diff --git a/Kodi.xcodeproj/project.pbxproj b/Kodi.xcodeproj/project.pbxproj
-index fee595b..7b8f019 100644
---- a/Kodi.xcodeproj/project.pbxproj
-+++ b/Kodi.xcodeproj/project.pbxproj
-@@ -692,6 +692,8 @@
- 7CE3FB911C9D40EA00366A4C /* ServiceBroker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE3FB8E1C9D40EA00366A4C /* ServiceBroker.cpp */; };
- 7CE514AA1CD5154A0046BC5C /* GUIDialogKeyboardTouch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE514A81CD5154A0046BC5C /* GUIDialogKeyboardTouch.cpp */; };
- 7CE514AB1CD5154A0046BC5C /* GUIDialogKeyboardTouch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE514A81CD5154A0046BC5C /* GUIDialogKeyboardTouch.cpp */; };
-+ 7CE5D0B41D37EB6900211428 /* ActiveAEFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE5D0B21D37EB6900211428 /* ActiveAEFilter.cpp */; };
-+ 7CE5D0B51D37EB6900211428 /* ActiveAEFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE5D0B21D37EB6900211428 /* ActiveAEFilter.cpp */; };
- 7CEBD8A80F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEBD8A60F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp */; };
- 7CED59391CD340460093F573 /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CED59381CD340460093F573 /* VideoToolbox.framework */; };
- 7CED593A1CD340460093F573 /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CED59381CD340460093F573 /* VideoToolbox.framework */; };
-@@ -3406,6 +3408,8 @@
- 7CE3FB8F1C9D40EA00366A4C /* ServiceBroker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceBroker.h; sourceTree = ""; };
- 7CE514A81CD5154A0046BC5C /* GUIDialogKeyboardTouch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogKeyboardTouch.cpp; sourceTree = ""; };
- 7CE514A91CD5154A0046BC5C /* GUIDialogKeyboardTouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogKeyboardTouch.h; sourceTree = ""; };
-+ 7CE5D0B21D37EB6900211428 /* ActiveAEFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActiveAEFilter.cpp; sourceTree = ""; };
-+ 7CE5D0B31D37EB6900211428 /* ActiveAEFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActiveAEFilter.h; sourceTree = ""; };
- 7CEBD8A60F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpecialProtocolDirectory.cpp; sourceTree = ""; };
- 7CEBD8A70F33A0D800CAF6AD /* SpecialProtocolDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecialProtocolDirectory.h; sourceTree = ""; };
- 7CED59381CD340460093F573 /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; };
-@@ -9232,6 +9236,8 @@
- F5CC22D41814FF3B006B5E91 /* ActiveAE.h */,
- F5CC22D51814FF3B006B5E91 /* ActiveAEBuffer.cpp */,
- F5CC22D61814FF3B006B5E91 /* ActiveAEBuffer.h */,
-+ 7CE5D0B21D37EB6900211428 /* ActiveAEFilter.cpp */,
-+ 7CE5D0B31D37EB6900211428 /* ActiveAEFilter.h */,
- DF32466019E931A8005E8CFB /* ActiveAEResampleFFMPEG.cpp */,
- DF32466119E931A8005E8CFB /* ActiveAEResampleFFMPEG.h */,
- F5CC22D91814FF3B006B5E91 /* ActiveAESink.cpp */,
-@@ -10387,6 +10393,7 @@
- C84828DE156CFCD8005A996F /* GUIWindowPVRBase.cpp in Sources */,
- C84828DF156CFCD8005A996F /* GUIWindowPVRChannels.cpp in Sources */,
- C84828E1156CFCD8005A996F /* GUIWindowPVRGuide.cpp in Sources */,
-+ 7CE5D0B41D37EB6900211428 /* ActiveAEFilter.cpp in Sources */,
- C84828E2156CFCD8005A996F /* GUIWindowPVRRecordings.cpp in Sources */,
- C84828E3156CFCD8005A996F /* GUIWindowPVRSearch.cpp in Sources */,
- C84828E4156CFCD8005A996F /* GUIWindowPVRTimers.cpp in Sources */,
-@@ -11397,6 +11404,7 @@
- E49913F7174E5FB000741B6D /* PVRChannelGroups.cpp in Sources */,
- E49913F8174E5FB000741B6D /* PVRChannelGroupsContainer.cpp in Sources */,
- E49913F9174E5FB000741B6D /* GUIDialogPVRChannelManager.cpp in Sources */,
-+ 7CE5D0B51D37EB6900211428 /* ActiveAEFilter.cpp in Sources */,
- E49913FA174E5FB000741B6D /* GUIDialogPVRChannelsOSD.cpp in Sources */,
- E49913FD174E5FB000741B6D /* GUIDialogPVRGroupManager.cpp in Sources */,
- E49913FE174E5FB000741B6D /* GUIDialogPVRGuideInfo.cpp in Sources */,
-diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj
-index 8667a55..e657c1c 100644
---- a/project/VS2010Express/XBMC.vcxproj
-+++ b/project/VS2010Express/XBMC.vcxproj
-@@ -261,6 +261,7 @@ copy "..\Win32BuildSetup\dependencies\python27.dll" "$(TargetDir)"
-
-
-
-+
-
-
-
-@@ -1022,6 +1023,7 @@ copy "..\Win32BuildSetup\dependencies\python27.dll" "$(TargetDir)"
-
-
-
-+
-
-
-
-diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters
-index 595e123..04c7024 100644
---- a/project/VS2010Express/XBMC.vcxproj.filters
-+++ b/project/VS2010Express/XBMC.vcxproj.filters
-@@ -2845,6 +2845,9 @@
-
- dialogs
-
-+
-+ cores\AudioEngine\Engines\ActiveAE
-+
-
-
-
-@@ -6706,6 +6709,9 @@
-
-
- dialogs
-+
-+
-+ cores\AudioEngine\Engines\ActiveAE
-
-
-
-@@ -6793,4 +6799,4 @@
- shaders
-
-
--
-\ No newline at end of file
-+
-diff --git a/xbmc/cores/AudioEngine/CMakeLists.txt b/xbmc/cores/AudioEngine/CMakeLists.txt
-index b50fc4d..b088d6f 100644
---- a/xbmc/cores/AudioEngine/CMakeLists.txt
-+++ b/xbmc/cores/AudioEngine/CMakeLists.txt
-@@ -9,6 +9,7 @@ set(SOURCES AEFactory.cpp
- Encoders/AEEncoderFFmpeg.cpp
- Engines/ActiveAE/ActiveAE.cpp
- Engines/ActiveAE/ActiveAEBuffer.cpp
-+ Engines/ActiveAE/ActiveAEFilter.cpp
- Engines/ActiveAE/ActiveAESink.cpp
- Engines/ActiveAE/ActiveAEStream.cpp
- Engines/ActiveAE/ActiveAESound.cpp
-@@ -33,6 +34,7 @@ set(HEADERS AEFactory.h
- Encoders/AEEncoderFFmpeg.h
- Engines/ActiveAE/ActiveAE.h
- Engines/ActiveAE/ActiveAEBuffer.h
-+ Engines/ActiveAE/ActiveAEFilter.h
- Engines/ActiveAE/ActiveAESink.h
- Engines/ActiveAE/ActiveAESound.h
- Engines/ActiveAE/ActiveAEStream.h
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
-index 26c99c7..e77aecb 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
-@@ -1274,7 +1274,9 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt)
- }
- if (initSink && (*it)->m_processingBuffers)
- {
-+ (*it)->m_processingBuffers->Flush();
- m_discardBufferPools.push_back((*it)->m_processingBuffers->GetResampleBuffers());
-+ m_discardBufferPools.push_back((*it)->m_processingBuffers->GetAtempoBuffers());
- delete (*it)->m_processingBuffers;
- (*it)->m_processingBuffers = nullptr;
- }
-@@ -1440,7 +1442,11 @@ void CActiveAE::DiscardStream(CActiveAEStream *stream)
- if ((*it)->m_inputBuffers)
- m_discardBufferPools.push_back((*it)->m_inputBuffers);
- if ((*it)->m_processingBuffers)
-+ {
-+ (*it)->m_processingBuffers->Flush();
- m_discardBufferPools.push_back((*it)->m_processingBuffers->GetResampleBuffers());
-+ m_discardBufferPools.push_back((*it)->m_processingBuffers->GetAtempoBuffers());
-+ }
- delete (*it)->m_processingBuffers;
- CLog::Log(LOGDEBUG, "CActiveAE::DiscardStream - audio stream deleted");
- m_stats.RemoveStream((*it)->m_id);
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp
-index 8e58a07..3ca667c 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp
-@@ -19,6 +19,7 @@
- */
-
- #include "ActiveAEBuffer.h"
-+#include "ActiveAEFilter.h"
- #include "cores/AudioEngine/AEFactory.h"
- #include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.h"
- #include "cores/AudioEngine/Engines/ActiveAE/ActiveAE.h"
-@@ -145,7 +146,9 @@ bool CActiveAEBufferPool::Create(unsigned int totaltime)
- return true;
- }
-
--//-----------------------------------------------------------------------------
-+// ----------------------------------------------------------------------------------
-+// Resample
-+// ----------------------------------------------------------------------------------
-
- CActiveAEBufferPoolResample::CActiveAEBufferPoolResample(AEAudioFormat inputFormat, AEAudioFormat outputFormat, AEQuality quality)
- : CActiveAEBufferPool(outputFormat)
-@@ -180,7 +183,10 @@ CActiveAEBufferPoolResample::CActiveAEBufferPoolResample(AEAudioFormat inputForm
-
- CActiveAEBufferPoolResample::~CActiveAEBufferPoolResample()
- {
-+ Flush();
-+
- delete m_resampler;
-+
- if (m_useDSP)
- CServiceBroker::GetADSP().DestroyDSPs(m_streamId);
- if (m_dspBuffer)
-@@ -673,3 +679,254 @@ void CActiveAEBufferPoolResample::SetDSPConfig(bool usedsp, bool bypassdsp)
- m_useDSP = usedsp;
- m_bypassDSP = bypassdsp;
- }
-+
-+// ----------------------------------------------------------------------------------
-+// Atempo
-+// ----------------------------------------------------------------------------------
-+
-+CActiveAEBufferPoolAtempo::CActiveAEBufferPoolAtempo(AEAudioFormat format) : CActiveAEBufferPool(format)
-+{
-+ m_drain = false;
-+ m_empty = true;
-+ m_tempo = 1.0;
-+ m_changeFilter = false;
-+ m_procSample = nullptr;
-+}
-+
-+CActiveAEBufferPoolAtempo::~CActiveAEBufferPoolAtempo()
-+{
-+ Flush();
-+}
-+
-+bool CActiveAEBufferPoolAtempo::Create(unsigned int totaltime)
-+{
-+ CActiveAEBufferPool::Create(totaltime);
-+
-+ m_pTempoFilter.reset(new CActiveAEFilter());
-+ m_pTempoFilter->Init(CAEUtil::GetAVSampleFormat(m_format.m_dataFormat), m_format.m_sampleRate, CAEUtil::GetAVChannelLayout(m_format.m_channelLayout));
-+
-+ return true;
-+}
-+
-+void CActiveAEBufferPoolAtempo::ChangeFilter()
-+{
-+ m_pTempoFilter->SetTempo(m_tempo);
-+ m_changeFilter = false;
-+}
-+
-+bool CActiveAEBufferPoolAtempo::ProcessBuffers()
-+{
-+ bool busy = false;
-+ CSampleBuffer *in;
-+
-+ if (!m_pTempoFilter->IsActive())
-+ {
-+ if (m_changeFilter)
-+ {
-+ if (m_changeFilter)
-+ ChangeFilter();
-+ return true;
-+ }
-+ while(!m_inputSamples.empty())
-+ {
-+ in = m_inputSamples.front();
-+ m_inputSamples.pop_front();
-+ m_outputSamples.push_back(in);
-+ busy = true;
-+ }
-+ }
-+ else if (m_procSample || !m_freeSamples.empty())
-+ {
-+ int free_samples;
-+ if (m_procSample)
-+ free_samples = m_procSample->pkt->max_nb_samples - m_procSample->pkt->nb_samples;
-+ else
-+ free_samples = m_format.m_frames;
-+
-+ bool skipInput = false;
-+
-+ // avoid that bufferscr grows too large
-+ if (!m_pTempoFilter->NeedData())
-+ skipInput = true;
-+
-+ bool hasInput = !m_inputSamples.empty();
-+
-+ if (hasInput || skipInput || m_drain || m_changeFilter)
-+ {
-+ if (!m_procSample)
-+ {
-+ m_procSample = GetFreeBuffer();
-+ }
-+
-+ if (hasInput && !skipInput && !m_changeFilter)
-+ {
-+ in = m_inputSamples.front();
-+ m_inputSamples.pop_front();
-+ }
-+ else
-+ in = nullptr;
-+
-+ int start = m_procSample->pkt->nb_samples *
-+ m_procSample->pkt->bytes_per_sample *
-+ m_procSample->pkt->config.channels /
-+ m_procSample->pkt->planes;
-+
-+ for (int i=0; ipkt->planes; i++)
-+ {
-+ m_planes[i] = m_procSample->pkt->data[i] + start;
-+ }
-+
-+ int out_samples = m_pTempoFilter->ProcessFilter(m_planes,
-+ m_procSample->pkt->max_nb_samples - m_procSample->pkt->nb_samples,
-+ in ? in->pkt->data : nullptr,
-+ in ? in->pkt->nb_samples : 0,
-+ in ? in->pkt->linesize * in->pkt->planes : 0);
-+
-+ // in case of error, trigger re-create of filter
-+ if (out_samples < 0)
-+ {
-+ out_samples = 0;
-+ m_changeFilter = true;
-+ }
-+
-+ m_procSample->pkt->nb_samples += out_samples;
-+ busy = true;
-+ m_empty = m_pTempoFilter->IsEof();
-+
-+ if (in)
-+ {
-+ if (in->timestamp)
-+ m_lastSamplePts = in->timestamp;
-+ else
-+ in->pkt_start_offset = 0;
-+
-+ // pts of last sample we added to the buffer
-+ m_lastSamplePts += (in->pkt->nb_samples-in->pkt_start_offset) * 1000 / m_format.m_sampleRate;
-+ }
-+
-+ // calculate pts for last sample in m_procSample
-+ int bufferedSamples = m_pTempoFilter->GetBufferedSamples();
-+ m_procSample->pkt_start_offset = m_procSample->pkt->nb_samples;
-+ m_procSample->timestamp = m_lastSamplePts - bufferedSamples * 1000 / m_format.m_sampleRate;
-+
-+ if ((m_drain || m_changeFilter) && m_empty)
-+ {
-+ if (m_fillPackets && m_procSample->pkt->nb_samples != 0)
-+ {
-+ // pad with zero
-+ start = m_procSample->pkt->nb_samples *
-+ m_procSample->pkt->bytes_per_sample *
-+ m_procSample->pkt->config.channels /
-+ m_procSample->pkt->planes;
-+ for (int i=0; ipkt->planes; i++)
-+ {
-+ memset(m_procSample->pkt->data[i]+start, 0, m_procSample->pkt->linesize-start);
-+ }
-+ }
-+
-+ // check if draining is finished
-+ if (m_drain && m_procSample->pkt->nb_samples == 0)
-+ {
-+ m_procSample->Return();
-+ busy = false;
-+ }
-+ else
-+ m_outputSamples.push_back(m_procSample);
-+
-+ m_procSample = nullptr;
-+
-+ if (m_changeFilter)
-+ {
-+ ChangeFilter();
-+ }
-+ }
-+ // some methods like encode require completely filled packets
-+ else if (!m_fillPackets || (m_procSample->pkt->nb_samples == m_procSample->pkt->max_nb_samples))
-+ {
-+ m_outputSamples.push_back(m_procSample);
-+ m_procSample = nullptr;
-+ }
-+
-+ if (in)
-+ in->Return();
-+ }
-+ }
-+ return busy;
-+}
-+
-+void CActiveAEBufferPoolAtempo::Flush()
-+{
-+ if (m_procSample)
-+ {
-+ m_procSample->Return();
-+ m_procSample = nullptr;
-+ }
-+ while (!m_inputSamples.empty())
-+ {
-+ m_inputSamples.front()->Return();
-+ m_inputSamples.pop_front();
-+ }
-+ while (!m_outputSamples.empty())
-+ {
-+ m_outputSamples.front()->Return();
-+ m_outputSamples.pop_front();
-+ }
-+ if (m_pTempoFilter)
-+ ChangeFilter();
-+}
-+
-+float CActiveAEBufferPoolAtempo::GetDelay()
-+{
-+ float delay = 0;
-+
-+ if (m_procSample)
-+ delay += (float)m_procSample->pkt->nb_samples / m_procSample->pkt->config.sample_rate;
-+
-+ for (auto &buf : m_inputSamples)
-+ {
-+ delay += (float)buf->pkt->nb_samples / buf->pkt->config.sample_rate;
-+ }
-+
-+ for (auto &buf : m_outputSamples)
-+ {
-+ delay += (float)buf->pkt->nb_samples / buf->pkt->config.sample_rate;
-+ }
-+
-+ if (m_pTempoFilter->IsActive())
-+ {
-+ int samples = m_pTempoFilter->GetBufferedSamples();
-+ delay += (float)samples / m_format.m_sampleRate;
-+ }
-+
-+ return delay;
-+}
-+
-+void CActiveAEBufferPoolAtempo::SetTempo(float tempo)
-+{
-+ if (tempo > 2.0)
-+ tempo = 2.0;
-+ else if (tempo < 0.5)
-+ tempo = 0.5;
-+
-+ if (tempo != m_tempo)
-+ m_changeFilter = true;
-+
-+ m_tempo = tempo;
-+}
-+
-+float CActiveAEBufferPoolAtempo::GetTempo()
-+{
-+ return m_tempo;
-+}
-+
-+void CActiveAEBufferPoolAtempo::FillBuffer()
-+{
-+ m_fillPackets = true;
-+}
-+
-+void CActiveAEBufferPoolAtempo::SetDrain(bool drain)
-+{
-+ m_drain = drain;
-+ if (!m_drain)
-+ m_changeFilter = true;
-+}
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h
-index 37e03d2..68e8942 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h
-@@ -23,6 +23,7 @@
- #include "cores/AudioEngine/Interfaces/AE.h"
- #include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h"
- #include
-+#include
-
- extern "C" {
- #include "libavutil/avutil.h"
-@@ -148,4 +149,35 @@ class CActiveAEBufferPoolResample : public CActiveAEBufferPool
- bool m_bypassDSP;
- };
-
-+class CActiveAEFilter;
-+
-+class CActiveAEBufferPoolAtempo : public CActiveAEBufferPool
-+{
-+public:
-+ CActiveAEBufferPoolAtempo(AEAudioFormat format);
-+ virtual ~CActiveAEBufferPoolAtempo();
-+ bool Create(unsigned int totaltime) override;
-+ bool ProcessBuffers();
-+ float GetDelay();
-+ void Flush();
-+ void SetTempo(float tempo);
-+ float GetTempo();
-+ void FillBuffer();
-+ void SetDrain(bool drain);
-+ std::deque m_inputSamples;
-+ std::deque m_outputSamples;
-+
-+protected:
-+ void ChangeFilter();
-+ std::unique_ptr m_pTempoFilter;
-+ uint8_t *m_planes[16];
-+ CSampleBuffer *m_procSample;
-+ bool m_empty;
-+ bool m_drain;
-+ bool m_changeFilter;
-+ float m_tempo;
-+ int64_t m_lastSamplePts;
-+ bool m_fillPackets;
-+};
-+
- }
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp
-new file mode 100644
-index 0000000..e721eff
---- /dev/null
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp
-@@ -0,0 +1,332 @@
-+/*
-+ * Copyright (C) 2010-2016 Team Kodi
-+ * http://xbmc.org
-+ *
-+ * This Program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2, or (at your option)
-+ * any later version.
-+ *
-+ * This Program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with XBMC; see the file COPYING. If not, see
-+ * .
-+ *
-+ */
-+
-+#include "ActiveAEFilter.h"
-+#include "utils/log.h"
-+#include "utils/StringUtils.h"
-+#include
-+
-+extern "C" {
-+#include "libavfilter/avfilter.h"
-+#include "libavfilter/buffersink.h"
-+#include "libavfilter/buffersrc.h"
-+#include "libswresample/swresample.h"
-+}
-+
-+using namespace ActiveAE;
-+
-+CActiveAEFilter::CActiveAEFilter()
-+{
-+ m_pFilterGraph = nullptr;
-+ m_pFilterCtxIn = nullptr;
-+ m_pFilterCtxOut = nullptr;
-+ m_pOutFrame = nullptr;
-+ m_pConvertCtx = nullptr;
-+ m_pConvertFrame = nullptr;
-+ m_needConvert = false;
-+}
-+
-+CActiveAEFilter::~CActiveAEFilter()
-+{
-+ CloseFilter();
-+}
-+
-+void CActiveAEFilter::Init(AVSampleFormat fmt, int sampleRate, uint64_t channelLayout)
-+{
-+ m_sampleFormat = fmt;
-+ m_sampleRate = sampleRate;
-+ m_channelLayout = channelLayout;
-+ m_tempo = 1.0;
-+ m_bufferedSamples = 0;
-+}
-+
-+bool CActiveAEFilter::SetTempo(float tempo)
-+{
-+ m_tempo = tempo;
-+ if (m_tempo == 1.0)
-+ {
-+ CloseFilter();
-+ return true;
-+ }
-+
-+ if (!CreateFilterGraph())
-+ return false;
-+
-+ if (!CreateAtempoFilter())
-+ {
-+ CloseFilter();
-+ return false;
-+ }
-+
-+ m_bufferedSamples = 0;
-+ return true;
-+}
-+
-+bool CActiveAEFilter::CreateFilterGraph()
-+{
-+ CloseFilter();
-+
-+ m_pFilterGraph = avfilter_graph_alloc();
-+ if (!m_pFilterGraph)
-+ {
-+ CLog::Log(LOGERROR, "CActiveAEFilter::CreateFilterGraph - unable to alloc filter graph");
-+ return false;
-+ }
-+
-+ AVFilter* srcFilter = avfilter_get_by_name("abuffer");
-+ AVFilter* outFilter = avfilter_get_by_name("abuffersink");
-+
-+ std::string args = StringUtils::Format("time_base=1/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%" PRIx64,
-+ m_sampleRate,
-+ m_sampleRate,
-+ av_get_sample_fmt_name(m_sampleFormat),
-+ m_channelLayout);
-+
-+ int ret = avfilter_graph_create_filter(&m_pFilterCtxIn, srcFilter, "in", args.c_str(), NULL, m_pFilterGraph);
-+ if (ret < 0)
-+ {
-+ CLog::Log(LOGERROR, "CActiveAEFilter::CreateFilterGraph - avfilter_graph_create_filter: src");
-+ return false;
-+ }
-+
-+ ret = avfilter_graph_create_filter(&m_pFilterCtxOut, outFilter, "out", NULL, NULL, m_pFilterGraph);
-+ if (ret < 0)
-+ {
-+ CLog::Log(LOGERROR, "CActiveAEFilter::CreateFilterGraph - avfilter_graph_create_filter: out");
-+ return false;
-+ }
-+
-+ m_pOutFrame = av_frame_alloc();
-+
-+ return true;
-+}
-+
-+bool CActiveAEFilter::CreateAtempoFilter()
-+{
-+ AVFilter *atempo;
-+
-+ atempo = avfilter_get_by_name("atempo");
-+ m_pFilterCtxAtempo = avfilter_graph_alloc_filter(m_pFilterGraph, atempo, "atempo");
-+ std::string args = StringUtils::Format("tempo=%f", m_tempo);
-+ int ret = avfilter_init_str(m_pFilterCtxAtempo, args.c_str());
-+
-+ if (ret < 0)
-+ {
-+ CLog::Log(LOGERROR, "CActiveAEFilter::CreateAtempoFilter - avfilter_init_str failed");
-+ return false;
-+ }
-+
-+ ret = avfilter_link(m_pFilterCtxIn, 0, m_pFilterCtxAtempo, 0);
-+ if (ret < 0)
-+ {
-+ CLog::Log(LOGERROR, "CActiveAEFilter::CreateAtempoFilter - avfilter_link failed for in filter");
-+ return false;
-+ }
-+
-+ ret = avfilter_link(m_pFilterCtxAtempo, 0, m_pFilterCtxOut, 0);
-+ if (ret < 0)
-+ {
-+ CLog::Log(LOGERROR, "CActiveAEFilter::CreateAtempoFilter - avfilter_link failed for out filter");
-+ return false;
-+ }
-+
-+ ret = avfilter_graph_config(m_pFilterGraph, NULL);
-+ if (ret < 0)
-+ {
-+ CLog::Log(LOGERROR, "CActiveAEFilter::CreateAtempoFilter - avfilter_graph_config failed");
-+ return false;
-+ }
-+
-+ m_needConvert = false;
-+ if (m_pFilterCtxAtempo->outputs[0]->format != m_sampleFormat)
-+ {
-+ m_needConvert = true;
-+ m_pConvertCtx = swr_alloc();
-+ m_pConvertFrame = av_frame_alloc();
-+ }
-+
-+ m_hasData = false;
-+ m_needData = true;
-+ m_filterEof = false;
-+
-+ return true;
-+}
-+
-+void CActiveAEFilter::CloseFilter()
-+{
-+ if (m_pFilterGraph)
-+ {
-+ avfilter_graph_free(&m_pFilterGraph);
-+
-+ m_pFilterCtxIn = nullptr;
-+ m_pFilterCtxOut = nullptr;
-+ }
-+
-+ if (m_pOutFrame)
-+ av_frame_free(&m_pOutFrame);
-+
-+ if (m_pConvertFrame)
-+ av_frame_free(&m_pConvertFrame);
-+
-+ if (m_pConvertCtx)
-+ swr_free(&m_pConvertCtx);
-+
-+ m_bufferedSamples = 0;
-+}
-+
-+int CActiveAEFilter::ProcessFilter(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, int src_bufsize)
-+{
-+ int result;
-+
-+ if (src_samples)
-+ {
-+ m_bufferedSamples += src_samples;
-+
-+ AVFrame *frame = av_frame_alloc();
-+ if (!frame)
-+ return -1;
-+
-+ int channels = av_get_channel_layout_nb_channels(m_channelLayout);
-+
-+ av_frame_set_channel_layout(frame, m_channelLayout);
-+ av_frame_set_channels(frame, channels);
-+ av_frame_set_sample_rate(frame, m_sampleRate);
-+ frame->nb_samples = src_samples;
-+ frame->format = m_sampleFormat;
-+
-+ result = avcodec_fill_audio_frame(frame, channels, m_sampleFormat,
-+ src_buffer[0], src_bufsize, 16);
-+ if (result < 0)
-+ {
-+ CLog::Log(LOGERROR, "CActiveAEFilter::ProcessFilter - avcodec_fill_audio_frame failed");
-+ return -1;
-+ }
-+
-+ result = av_buffersrc_write_frame(m_pFilterCtxIn, frame);
-+ av_frame_free(&frame);
-+ if (result < 0)
-+ {
-+ CLog::Log(LOGERROR, "CActiveAEFilter::ProcessFilter - av_buffersrc_add_frame failed");
-+ return -1;
-+ }
-+ }
-+ else if (!m_filterEof && m_needData)
-+ {
-+ result = av_buffersrc_write_frame(m_pFilterCtxIn, nullptr);
-+ if (result < 0)
-+ {
-+ CLog::Log(LOGERROR, "CActiveAEFilter::ProcessFilter - av_buffersrc_add_frame");
-+ return -1;
-+ }
-+ }
-+
-+ if (!m_hasData)
-+ {
-+ m_needData = false;
-+ AVFrame *outFrame = m_needConvert ? m_pConvertFrame : m_pOutFrame;
-+
-+ result = av_buffersink_get_frame(m_pFilterCtxOut, outFrame);
-+
-+ if (result == AVERROR(EAGAIN))
-+ {
-+ m_needData = true;
-+ return 0;
-+ }
-+ else if (result == AVERROR_EOF)
-+ {
-+ result = av_buffersink_get_frame(m_pFilterCtxOut, outFrame);
-+ m_filterEof = true;
-+ if (result < 0)
-+ return 0;
-+ }
-+ else if (result < 0)
-+ {
-+ CLog::Log(LOGERROR, "CActiveAEFilter::ProcessFilter - av_buffersink_get_frame");
-+ return -1;
-+ }
-+
-+ if (m_needConvert)
-+ {
-+ av_frame_unref(m_pOutFrame);
-+ m_pOutFrame->format = m_sampleFormat;
-+ av_frame_set_channel_layout(m_pOutFrame, m_channelLayout);
-+ av_frame_set_sample_rate(m_pOutFrame, m_sampleRate);
-+ result = swr_convert_frame(m_pConvertCtx, m_pOutFrame, m_pConvertFrame);
-+ if (result < 0)
-+ {
-+ CLog::Log(LOGERROR, "CActiveAEFilter::ProcessFilter - swr_convert_frame failed");
-+ return -1;
-+ }
-+ }
-+
-+ m_hasData = true;
-+ m_sampleOffset = 0;
-+ }
-+
-+ if (m_hasData)
-+ {
-+ int channels = av_get_channel_layout_nb_channels(m_channelLayout);
-+ int planes = av_sample_fmt_is_planar(m_sampleFormat) ? channels : 1;
-+ int samples = std::min(dst_samples, m_pOutFrame->nb_samples - m_sampleOffset);
-+ int bytes = samples * av_get_bytes_per_sample(m_sampleFormat) * channels / planes;
-+ int bytesOffset = m_sampleOffset * av_get_bytes_per_sample(m_sampleFormat) * channels / planes;
-+ for (int i=0; iextended_data[i] + bytesOffset, bytes);
-+ }
-+ m_sampleOffset += samples;
-+
-+ if (m_sampleOffset >= m_pOutFrame->nb_samples)
-+ {
-+ av_frame_unref(m_pOutFrame);
-+ m_hasData = false;
-+ }
-+
-+ m_bufferedSamples -= samples * m_tempo;
-+ if (m_bufferedSamples < 0)
-+ m_bufferedSamples = 0;
-+ return samples;
-+ }
-+
-+ return 0;
-+}
-+
-+bool CActiveAEFilter::IsEof()
-+{
-+ return m_filterEof;
-+}
-+
-+bool CActiveAEFilter::NeedData()
-+{
-+ return m_needData;
-+}
-+
-+bool CActiveAEFilter::IsActive()
-+{
-+ if (m_pFilterGraph)
-+ return true;
-+ else
-+ return false;
-+}
-+
-+int CActiveAEFilter::GetBufferedSamples()
-+{
-+ return m_bufferedSamples;
-+}
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h
-new file mode 100644
-index 0000000..5eb9a52
---- /dev/null
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h
-@@ -0,0 +1,69 @@
-+#pragma once
-+/*
-+ * Copyright (C) 2010-2016 Team Kodi
-+ * http://xbmc.org
-+ *
-+ * This Program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2, or (at your option)
-+ * any later version.
-+ *
-+ * This Program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with XBMC; see the file COPYING. If not, see
-+ * .
-+ *
-+ */
-+
-+extern "C" {
-+#include "libavfilter/avfilter.h"
-+#include "libavutil/frame.h"
-+}
-+
-+struct SwrContext;
-+
-+namespace ActiveAE
-+{
-+
-+class CActiveAEFilter
-+{
-+public:
-+ CActiveAEFilter();
-+ virtual ~CActiveAEFilter();
-+ void Init(AVSampleFormat fmt, int sampleRate, uint64_t channelLayout);
-+ int ProcessFilter(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, int src_bufsize);
-+ bool SetTempo(float tempo);
-+ bool NeedData();
-+ bool IsEof();
-+ bool IsActive();
-+ int GetBufferedSamples();
-+
-+protected:
-+ bool CreateFilterGraph();
-+ bool CreateAtempoFilter();
-+ void CloseFilter();
-+
-+ AVSampleFormat m_sampleFormat;
-+ int m_sampleRate;
-+ uint64_t m_channelLayout;
-+ AVFilterGraph* m_pFilterGraph;
-+ AVFilterContext* m_pFilterCtxIn;
-+ AVFilterContext* m_pFilterCtxOut;
-+ AVFilterContext* m_pFilterCtxAtempo;
-+ AVFrame* m_pOutFrame;
-+ SwrContext* m_pConvertCtx;
-+ AVFrame* m_pConvertFrame;
-+ bool m_needConvert;
-+ float m_tempo;
-+ bool m_filterEof;
-+ bool m_hasData;
-+ bool m_needData;
-+ int m_sampleOffset;
-+ int m_bufferedSamples;
-+};
-+
-+}
-\ No newline at end of file
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
-index cc5837f..b7e8125 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
-@@ -577,16 +577,19 @@ CActiveAEStreamBuffers::CActiveAEStreamBuffers(AEAudioFormat inputFormat, AEAudi
- {
- m_inputFormat = inputFormat;
- m_resampleBuffers = new CActiveAEBufferPoolResample(inputFormat, outputFormat, quality);
-+ m_atempoBuffers = new CActiveAEBufferPoolAtempo(outputFormat);
- }
-
- CActiveAEStreamBuffers::~CActiveAEStreamBuffers()
- {
- delete m_resampleBuffers;
-+ delete m_atempoBuffers;
- }
-
- bool CActiveAEStreamBuffers::HasInputLevel(int level)
- {
-- if (m_inputSamples.size() > m_resampleBuffers->m_allSamples.size() * 100 / level)
-+ if ((m_inputSamples.size() + m_resampleBuffers->m_inputSamples.size()) >
-+ (m_resampleBuffers->m_allSamples.size() * level / 100))
- return true;
- else
- return false;
-@@ -594,7 +597,13 @@ bool CActiveAEStreamBuffers::HasInputLevel(int level)
-
- bool CActiveAEStreamBuffers::Create(unsigned int totaltime, bool remap, bool upmix, bool normalize, bool useDSP)
- {
-- return m_resampleBuffers->Create(totaltime, remap, upmix, normalize, useDSP);
-+ if (!m_resampleBuffers->Create(totaltime, remap, upmix, normalize, useDSP))
-+ return false;
-+
-+ if (!m_atempoBuffers->Create(totaltime))
-+ return false;
-+
-+ return true;
- }
-
- void CActiveAEStreamBuffers::SetExtraData(int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type)
-@@ -621,6 +630,16 @@ bool CActiveAEStreamBuffers::ProcessBuffers()
- {
- buf = m_resampleBuffers->m_outputSamples.front();
- m_resampleBuffers->m_outputSamples.pop_front();
-+ m_atempoBuffers->m_inputSamples.push_back(buf);
-+ busy = true;
-+ }
-+
-+ busy |= m_atempoBuffers->ProcessBuffers();
-+
-+ while (!m_atempoBuffers->m_outputSamples.empty())
-+ {
-+ buf = m_atempoBuffers->m_outputSamples.front();
-+ m_atempoBuffers->m_outputSamples.pop_front();
- m_outputSamples.push_back(buf);
- busy = true;
- }
-@@ -635,12 +654,29 @@ void CActiveAEStreamBuffers::ConfigureResampler(bool normalizelevels, bool dspen
-
- float CActiveAEStreamBuffers::GetDelay()
- {
-- return m_resampleBuffers->GetDelay();
-+ float delay = 0;
-+
-+ for (auto &buf : m_inputSamples)
-+ {
-+ delay += (float)buf->pkt->nb_samples / buf->pkt->config.sample_rate;
-+ }
-+
-+ delay += m_resampleBuffers->GetDelay();
-+ delay += m_atempoBuffers->GetDelay();
-+
-+ for (auto &buf : m_outputSamples)
-+ {
-+ delay += (float)buf->pkt->nb_samples / buf->pkt->config.sample_rate;
-+ }
-+
-+ return delay;
- }
-
- void CActiveAEStreamBuffers::Flush()
- {
- m_resampleBuffers->Flush();
-+ m_atempoBuffers->Flush();
-+
- while (!m_inputSamples.empty())
- {
- m_inputSamples.front()->Return();
-@@ -656,12 +692,15 @@ void CActiveAEStreamBuffers::Flush()
- void CActiveAEStreamBuffers::SetDrain(bool drain)
- {
- m_resampleBuffers->SetDrain(drain);
-+ m_atempoBuffers->SetDrain(drain);
- }
-
- bool CActiveAEStreamBuffers::IsDrained()
- {
- if (m_resampleBuffers->m_inputSamples.empty() &&
- m_resampleBuffers->m_outputSamples.empty() &&
-+ m_atempoBuffers->m_inputSamples.empty() &&
-+ m_atempoBuffers->m_outputSamples.empty() &&
- m_inputSamples.empty() &&
- m_outputSamples.empty())
- return true;
-@@ -671,17 +710,29 @@ bool CActiveAEStreamBuffers::IsDrained()
-
- void CActiveAEStreamBuffers::SetRR(double rr)
- {
-- m_resampleBuffers->SetRR(rr);
-+ if (rr < 1.02 && rr > 0.98)
-+ {
-+ m_resampleBuffers->SetRR(rr);
-+ m_atempoBuffers->SetTempo(1.0);
-+ }
-+ else
-+ {
-+ m_resampleBuffers->SetRR(1.0);
-+ m_atempoBuffers->SetTempo(1.0/rr);
-+ }
- }
-
- double CActiveAEStreamBuffers::GetRR()
- {
-- return m_resampleBuffers->GetRR();
-+ double tempo = m_resampleBuffers->GetRR();
-+ tempo /= m_atempoBuffers->GetTempo();
-+ return tempo;
- }
-
- void CActiveAEStreamBuffers::FillBuffer()
- {
- m_resampleBuffers->FillBuffer();
-+ m_atempoBuffers->FillBuffer();
- }
-
- bool CActiveAEStreamBuffers::DoesNormalize()
-@@ -706,6 +757,13 @@ CActiveAEBufferPool* CActiveAEStreamBuffers::GetResampleBuffers()
- return ret;
- }
-
-+CActiveAEBufferPool* CActiveAEStreamBuffers::GetAtempoBuffers()
-+{
-+ CActiveAEBufferPool *ret = m_atempoBuffers;
-+ m_atempoBuffers = nullptr;
-+ return ret;
-+}
-+
- bool CActiveAEStreamBuffers::HasWork()
- {
- if (!m_inputSamples.empty())
-@@ -716,6 +774,10 @@ bool CActiveAEStreamBuffers::HasWork()
- return true;
- if (!m_resampleBuffers->m_outputSamples.empty())
- return true;
-+ if (!m_atempoBuffers->m_inputSamples.empty())
-+ return true;
-+ if (!m_atempoBuffers->m_outputSamples.empty())
-+ return true;
-
- return false;
- }
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h
-index 1340efd..51bcccd 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h
-@@ -111,12 +111,15 @@ class CActiveAEStreamBuffers
- void SetDSPConfig(bool usedsp, bool bypassdsp);
- bool HasWork();
- CActiveAEBufferPool *GetResampleBuffers();
-+ CActiveAEBufferPool *GetAtempoBuffers();
-+
- AEAudioFormat m_inputFormat;
- std::deque m_outputSamples;
- std::deque m_inputSamples;
-
- protected:
- CActiveAEBufferPoolResample *m_resampleBuffers;
-+ CActiveAEBufferPoolAtempo *m_atempoBuffers;
- };
-
- class CActiveAEStream : public IAEStream
-diff --git a/xbmc/cores/AudioEngine/Makefile.in b/xbmc/cores/AudioEngine/Makefile.in
-index 4167eec..fa65acc 100644
---- a/xbmc/cores/AudioEngine/Makefile.in
-+++ b/xbmc/cores/AudioEngine/Makefile.in
-@@ -34,6 +34,7 @@ SRCS += Engines/ActiveAE/ActiveAESound.cpp
- SRCS += Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp
- SRCS += Engines/ActiveAE/ActiveAEResamplePi.cpp
- SRCS += Engines/ActiveAE/ActiveAEBuffer.cpp
-+SRCS += Engines/ActiveAE/ActiveAEFilter.cpp
-
- ifeq (@USE_ANDROID@,1)
- SRCS += Sinks/AESinkAUDIOTRACK.cpp
-
-From 047fc7d74c853b497789f8eb52a8816538540a65 Mon Sep 17 00:00:00 2001
-From: Rainer Hochecker
-Date: Sun, 24 Jul 2016 20:35:44 +0200
-Subject: [PATCH 4/4] VideoPlayer: improve rr related to clockspeed
-
----
- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 11 +++++++----
- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp | 6 ++++++
- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h | 1 +
- xbmc/cores/VideoPlayer/DVDClock.cpp | 4 +++-
- xbmc/cores/VideoPlayer/VideoPlayer.cpp | 2 +-
- 5 files changed, 18 insertions(+), 6 deletions(-)
-
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
-index e77aecb..5196c62 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
-@@ -2296,10 +2296,13 @@ CSampleBuffer* CActiveAE::SyncStream(CActiveAEStream *stream)
- double threshold = 100;
- if (stream->m_resampleMode)
- {
-- if (stream->m_pClock && stream->m_pClock->GetClockSpeed() > 1.1)
-- threshold *= 10;
-- else
-- threshold *= 2;
-+ threshold *= 2;
-+ if (stream->m_pClock)
-+ {
-+ double clockspeed = stream->m_pClock->GetClockSpeed();
-+ if (clockspeed >= 1.05 || clockspeed <= 0.95)
-+ threshold *= 5;
-+ }
- }
-
- int timeout = (stream->m_syncState != CAESyncInfo::AESyncState::SYNC_INSYNC) ? 100 : (int)stream->m_errorInterval;
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
-index b7e8125..430bbf6 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
-@@ -70,6 +70,7 @@ CActiveAEStream::CActiveAEStream(AEAudioFormat *format, unsigned int streamid)
- m_lastPts = 0;
- m_lastPtsJump = 0;
- m_errorInterval = 1000;
-+ m_clockSpeed = 1.0;
- }
-
- CActiveAEStream::~CActiveAEStream()
-@@ -213,7 +214,12 @@ double CActiveAEStream::CalcResampleRatio(double error)
-
- double clockspeed = 1.0;
- if (m_pClock)
-+ {
- clockspeed = m_pClock->GetClockSpeed();
-+ if (m_clockSpeed != clockspeed)
-+ m_resampleIntegral = 0;
-+ m_clockSpeed = clockspeed;
-+ }
-
- double ret = 1.0 / clockspeed + proportional + m_resampleIntegral;
- //CLog::Log(LOGNOTICE,"----- error: %f, rr: %f, prop: %f, int: %f",
-diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h
-index 51bcccd..b44227a 100644
---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h
-+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h
-@@ -227,6 +227,7 @@ class CActiveAEStream : public IAEStream
- int m_profile;
- int m_resampleMode;
- double m_resampleIntegral;
-+ double m_clockSpeed;
- enum AVMatrixEncoding m_matrixEncoding;
- enum AVAudioServiceType m_audioServiceType;
- bool m_forceResampler;
-diff --git a/xbmc/cores/VideoPlayer/DVDClock.cpp b/xbmc/cores/VideoPlayer/DVDClock.cpp
-index bcf9cc7..c4193a8 100644
---- a/xbmc/cores/VideoPlayer/DVDClock.cpp
-+++ b/xbmc/cores/VideoPlayer/DVDClock.cpp
-@@ -297,6 +297,8 @@ double CDVDClock::SystemToPlaying(int64_t system)
-
- double CDVDClock::GetClockSpeed()
- {
-+ CSingleLock lock(m_critSection);
-+
- double speed = (double)m_systemFrequency / m_systemUsed;
-- return m_videoRefClock->GetSpeed() * speed;
-+ return m_videoRefClock->GetSpeed() * speed + m_speedAdjust;
- }
-diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp
-index f8e3079..ca3e719 100644
---- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp
-+++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp
-@@ -1941,7 +1941,7 @@ void CVideoPlayer::HandlePlaySpeed()
- {
- double adjust = -1.0; // a unique value
- if (m_clock.GetSpeedAdjust() >= 0 && m_VideoPlayerAudio->GetLevel() < 5)
-- adjust = -0.01;
-+ adjust = -0.05;
-
- if (m_clock.GetSpeedAdjust() < 0 && m_VideoPlayerAudio->GetLevel() > 10)
- adjust = 0.0;
diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-PR10206-recursive-remove.patch b/packages/mediacenter/kodi/patches/kodi-999.99-PR10206-recursive-remove.patch
deleted file mode 100644
index 411a315a67..0000000000
--- a/packages/mediacenter/kodi/patches/kodi-999.99-PR10206-recursive-remove.patch
+++ /dev/null
@@ -1,278 +0,0 @@
-From 3040f6024904eb1cf92a5b7b0e5268be756aecb0 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?P=C3=A4r=20Bj=C3=B6rklund?=
-Date: Sun, 31 Jul 2016 21:33:55 +0200
-Subject: [PATCH] Add a recursive version of CDirectory::Remove
-
-Tested on Windows and works
-Untested on POSIX systems
----
- xbmc/Application.cpp | 6 ++--
- xbmc/filesystem/Directory.cpp | 27 +++++++++++++++
- xbmc/filesystem/Directory.h | 2 ++
- xbmc/filesystem/IDirectory.h | 7 ++++
- xbmc/filesystem/posix/PosixDirectory.cpp | 50 ++++++++++++++++++++++++++++
- xbmc/filesystem/posix/PosixDirectory.h | 1 +
- xbmc/filesystem/win32/Win32Directory.cpp | 56 ++++++++++++++++++++++++++++++++
- xbmc/filesystem/win32/Win32Directory.h | 13 ++++----
- 8 files changed, 154 insertions(+), 8 deletions(-)
-
-diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
-index edec038..00b24f4 100644
---- a/xbmc/Application.cpp
-+++ b/xbmc/Application.cpp
-@@ -1079,8 +1079,10 @@ void CApplication::CreateUserDirs() const
-
- //Let's clear our archive cache before starting up anything more
- auto archiveCachePath = CSpecialProtocol::TranslatePath("special://temp/archive_cache/");
-- CDirectory::Remove(archiveCachePath);
-- CDirectory::Create(archiveCachePath);
-+ if (CDirectory::RemoveRecursive(archiveCachePath))
-+ CDirectory::Create(archiveCachePath);
-+ else
-+ CLog::Log(LOGWARNING, "Failed to remove the archive cache at %s", archiveCachePath.c_str());
-
- }
-
-diff --git a/xbmc/filesystem/Directory.cpp b/xbmc/filesystem/Directory.cpp
-index 05a3e43..25c0ba4 100644
---- a/xbmc/filesystem/Directory.cpp
-+++ b/xbmc/filesystem/Directory.cpp
-@@ -323,6 +323,11 @@ bool CDirectory::Remove(const std::string& strPath)
- return Remove(pathToUrl);
- }
-
-+bool CDirectory::RemoveRecursive(const std::string& strPath)
-+{
-+ return RemoveRecursive(CURL{ strPath });
-+}
-+
- bool CDirectory::Remove(const CURL& url)
- {
- try
-@@ -345,6 +350,28 @@ bool CDirectory::Remove(const CURL& url)
- return false;
- }
-
-+bool CDirectory::RemoveRecursive(const CURL& url)
-+{
-+ try
-+ {
-+ CURL realURL = URIUtils::SubstitutePath(url);
-+ std::unique_ptr pDirectory(CDirectoryFactory::Create(realURL));
-+ if (pDirectory.get())
-+ if(pDirectory->RemoveRecursive(realURL))
-+ {
-+ g_directoryCache.ClearFile(realURL.Get());
-+ return true;
-+ }
-+ }
-+ XBMCCOMMONS_HANDLE_UNCHECKED
-+ catch (...)
-+ {
-+ CLog::Log(LOGERROR, "%s - Unhandled exception", __FUNCTION__);
-+ }
-+ CLog::Log(LOGERROR, "%s - Error removing %s", __FUNCTION__, url.GetRedacted().c_str());
-+ return false;
-+}
-+
- void CDirectory::FilterFileDirectories(CFileItemList &items, const std::string &mask)
- {
- for (int i=0; i< items.Size(); ++i)
-diff --git a/xbmc/filesystem/Directory.h b/xbmc/filesystem/Directory.h
-index bb06f32..a1f8f85 100644
---- a/xbmc/filesystem/Directory.h
-+++ b/xbmc/filesystem/Directory.h
-@@ -58,6 +58,7 @@ class CDirectory
- static bool Create(const CURL& url);
- static bool Exists(const CURL& url, bool bUseCache = true);
- static bool Remove(const CURL& url);
-+ static bool RemoveRecursive(const CURL& url);
-
- static bool GetDirectory(const std::string& strPath
- , CFileItemList &items
-@@ -73,6 +74,7 @@ class CDirectory
- static bool Create(const std::string& strPath);
- static bool Exists(const std::string& strPath, bool bUseCache = true);
- static bool Remove(const std::string& strPath);
-+ static bool RemoveRecursive(const std::string& strPath);
-
- /*! \brief Filter files that act like directories from the list, replacing them with their directory counterparts
- \param items The item list to filter
-diff --git a/xbmc/filesystem/IDirectory.h b/xbmc/filesystem/IDirectory.h
-index 03e086b..246c4d0 100644
---- a/xbmc/filesystem/IDirectory.h
-+++ b/xbmc/filesystem/IDirectory.h
-@@ -102,6 +102,13 @@ class IDirectory
- virtual bool Remove(const CURL& url) { return false; }
-
- /*!
-+ \brief Recursively removes the directory
-+ \param url Directory to remove.
-+ \return Returns \e false if not succesful
-+ */
-+ virtual bool RemoveRecursive(const CURL& url) { return false; }
-+
-+ /*!
- \brief Whether this file should be listed
- \param url File to test.
- \return Returns \e true if the file should be listed
-diff --git a/xbmc/filesystem/posix/PosixDirectory.cpp b/xbmc/filesystem/posix/PosixDirectory.cpp
-index f23037d..c90572d 100644
---- a/xbmc/filesystem/posix/PosixDirectory.cpp
-+++ b/xbmc/filesystem/posix/PosixDirectory.cpp
-@@ -128,6 +128,56 @@ bool CPosixDirectory::Remove(const CURL& url)
-
- return !Exists(url);
- }
-+ bool CPosixDirectory::RemoveRecursive(const CURL& url)
-+ {
-+ std::string root = url.Get();
-+
-+ if (IsAliasShortcut(root, true))
-+ TranslateAliasShortcut(root);
-+
-+ DIR *dir = opendir(root.c_str());
-+ if (!dir)
-+ return false;
-+
-+ struct dirent* entry;
-+ while ((entry = readdir(dir)) != NULL)
-+ {
-+ if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
-+ continue;
-+
-+ std::string itemLabel(entry->d_name);
-+ CCharsetConverter::unknownToUTF8(itemLabel);
-+ std::string itemPath(URIUtils::AddFileToFolder(root, entry->d_name));
-+
-+ bool bStat = false;
-+ struct stat buffer;
-+
-+ // Unix-based readdir implementations may return an incorrect dirent.d_ino value that
-+ // is not equal to the (correct) stat() obtained one. In this case the file type
-+ // could not be determined and the value of dirent.d_type is set to DT_UNKNOWN.
-+ // In order to get a correct value we have to incur the cost of calling stat.
-+ if (entry->d_type == DT_UNKNOWN || entry->d_type == DT_LNK)
-+ {
-+ if (stat(itemPath.c_str(), &buffer) == 0)
-+ bStat = true;
-+ }
-+
-+ if (entry->d_type == DT_DIR || (bStat && S_ISDIR(buffer.st_mode)))
-+ {
-+ if (!RemoveRecursive(CURL{ itemPath }))
-+ return false;
-+ if (rmdir(itemPath.c_str()) != 0)
-+ return false;
-+ }
-+ else
-+ {
-+ if (unlink(itemPath.c_str()) != 0)
-+ return false;
-+ }
-+ }
-+ closedir(dir);
-+ return true;
-+ }
-
- bool CPosixDirectory::Exists(const CURL& url)
- {
-diff --git a/xbmc/filesystem/posix/PosixDirectory.h b/xbmc/filesystem/posix/PosixDirectory.h
-index 91b97c6..8c2a837 100644
---- a/xbmc/filesystem/posix/PosixDirectory.h
-+++ b/xbmc/filesystem/posix/PosixDirectory.h
-@@ -33,5 +33,6 @@ class CPosixDirectory : public IDirectory
- virtual bool Create(const CURL& url);
- virtual bool Exists(const CURL& url);
- virtual bool Remove(const CURL& url);
-+ virtual bool RemoveRecursive(const CURL& url);
- };
- }
-diff --git a/xbmc/filesystem/win32/Win32Directory.cpp b/xbmc/filesystem/win32/Win32Directory.cpp
-index 339cefa..c580c2b 100644
---- a/xbmc/filesystem/win32/Win32Directory.cpp
-+++ b/xbmc/filesystem/win32/Win32Directory.cpp
-@@ -178,4 +178,60 @@ bool CWin32Directory::Remove(const CURL& url)
- return !Exists(url);
- }
-
-+bool CWin32Directory::RemoveRecursive(const CURL& url)
-+{
-+ std::string pathWithSlash(url.Get());
-+ if (!pathWithSlash.empty() && pathWithSlash.back() != '\\')
-+ pathWithSlash.push_back('\\');
-+
-+ auto basePath = CWIN32Util::ConvertPathToWin32Form(pathWithSlash);
-+ if (basePath.empty())
-+ return false;
-+
-+ auto searchMask = basePath + L'*';
-+
-+ HANDLE hSearch;
-+ WIN32_FIND_DATAW findData = {};
-+
-+ if (g_sysinfo.IsWindowsVersionAtLeast(CSysInfo::WindowsVersionWin7))
-+ hSearch = FindFirstFileExW(searchMask.c_str(), FindExInfoBasic, &findData, FindExSearchNameMatch, nullptr, FIND_FIRST_EX_LARGE_FETCH);
-+ else
-+ hSearch = FindFirstFileExW(searchMask.c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, nullptr, 0);
-+
-+ if (hSearch == INVALID_HANDLE_VALUE)
-+ return GetLastError() == ERROR_FILE_NOT_FOUND ? Exists(url) : false; // return true if directory exist and empty
-+
-+ do
-+ {
-+ std::wstring itemNameW(findData.cFileName);
-+ if (itemNameW == L"." || itemNameW == L"..")
-+ continue;
-+
-+ auto pathW = basePath + itemNameW;
-+ if (0 != (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
-+ {
-+ std::string path;
-+ if (!g_charsetConverter.wToUTF8(pathW, path, true))
-+ {
-+ CLog::Log(LOGERROR, "%s: Can't convert wide string name to UTF-8 encoding", __FUNCTION__);
-+ continue;
-+ }
-+
-+ if (!RemoveRecursive(CURL{ path }))
-+ return false;
-+
-+ if (FALSE == RemoveDirectoryW(pathW.c_str()))
-+ return false;
-+ }
-+ else
-+ {
-+ if (FALSE == DeleteFileW(pathW.c_str()))
-+ return false;
-+ }
-+ } while (FindNextFileW(hSearch, &findData));
-+
-+ FindClose(hSearch);
-+
-+ return true;
-+}
- #endif // TARGET_WINDOWS
-diff --git a/xbmc/filesystem/win32/Win32Directory.h b/xbmc/filesystem/win32/Win32Directory.h
-index 2d77588..c03e68b 100644
---- a/xbmc/filesystem/win32/Win32Directory.h
-+++ b/xbmc/filesystem/win32/Win32Directory.h
-@@ -27,11 +27,12 @@ namespace XFILE
- class CWin32Directory : public IDirectory
- {
- public:
-- CWin32Directory(void);
-- virtual ~CWin32Directory(void);
-- virtual bool GetDirectory(const CURL& url, CFileItemList &items);
-- virtual bool Create(const CURL& url);
-- virtual bool Exists(const CURL& url);
-- virtual bool Remove(const CURL& url);
-+ CWin32Directory();
-+ virtual ~CWin32Directory();
-+ bool GetDirectory(const CURL& url, CFileItemList &items) override;
-+ bool Create(const CURL& url) override;
-+ bool Exists(const CURL& url) override;
-+ bool Remove(const CURL& url) override;
-+ bool RemoveRecursive(const CURL& url) override;
- };
- }
diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-PR10211-videoplayer-fix-handling-of-progressive-content-in-rendermanager.patch b/packages/mediacenter/kodi/patches/kodi-999.99-PR10211-videoplayer-fix-handling-of-progressive-content-in-rendermanager.patch
deleted file mode 100644
index 38b29e3477..0000000000
--- a/packages/mediacenter/kodi/patches/kodi-999.99-PR10211-videoplayer-fix-handling-of-progressive-content-in-rendermanager.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From 793d8434039e88f2fe098c51ff2a98561c54debc Mon Sep 17 00:00:00 2001
-From: Rainer Hochecker
-Date: Mon, 1 Aug 2016 19:58:17 +0200
-Subject: [PATCH] VideoPlayer: fix handling of progressive content in
- RenderManager
-
----
- xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
-index b482fc1..558a1f3 100644
---- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
-+++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
-@@ -806,6 +806,9 @@ void CRenderManager::FlipPage(volatile std::atomic_bool& bStop, double pts /* =
- }
- else
- {
-+ if (sync == FS_NONE)
-+ presentmethod = PRESENT_METHOD_SINGLE;
-+ else
- {
- bool invert = false;
- if (interlacemethod == VS_INTERLACEMETHOD_RENDER_BLEND)
diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-PR10309.patch b/packages/mediacenter/kodi/patches/kodi-999.99-PR10309.patch
new file mode 100644
index 0000000000..72888acee1
--- /dev/null
+++ b/packages/mediacenter/kodi/patches/kodi-999.99-PR10309.patch
@@ -0,0 +1,135 @@
+From ee2dc577a03d86ac61e06bc95aaff1d1eddbf593 Mon Sep 17 00:00:00 2001
+From: Garrett Brown
+Date: Thu, 18 Aug 2016 14:10:36 -0700
+Subject: [PATCH] Rename CPeripherals::GetAddon() to GetAddonWithButtonMap()
+ and move to addon bus
+
+---
+ xbmc/peripherals/Peripherals.cpp | 26 +++++----------------
+ xbmc/peripherals/Peripherals.h | 2 +-
+ xbmc/peripherals/addons/AddonButtonMapping.cpp | 2 +-
+ xbmc/peripherals/addons/AddonInputHandling.cpp | 2 +-
+ .../peripherals/bus/virtual/PeripheralBusAddon.cpp | 27 ++++++++++++++++++----
+ 5 files changed, 31 insertions(+), 28 deletions(-)
+
+diff --git a/xbmc/peripherals/Peripherals.cpp b/xbmc/peripherals/Peripherals.cpp
+index 629846d..30f160e 100644
+--- a/xbmc/peripherals/Peripherals.cpp
++++ b/xbmc/peripherals/Peripherals.cpp
+@@ -762,29 +762,15 @@ void CPeripherals::ProcessEvents(void)
+ bus->ProcessEvents();
+ }
+
+-PeripheralAddonPtr CPeripherals::GetAddon(const CPeripheral* device)
++PeripheralAddonPtr CPeripherals::GetAddonWithButtonMap(const CPeripheral* device)
+ {
+- PeripheralAddonPtr addon;
+-
+ PeripheralBusAddonPtr addonBus = std::static_pointer_cast(GetBusByType(PERIPHERAL_BUS_ADDON));
+- if (device && addonBus)
+- {
+- PeripheralBusType busType = device->GetBusType();
+
+- if (busType == PERIPHERAL_BUS_ADDON)
+- {
+- // If device is from an add-on, use that add-on
+- PeripheralAddonPtr peripheralAddon;
+- unsigned int index;
+- if (addonBus->SplitLocation(device->Location(), addon, index))
+- addon = std::move(peripheralAddon);
+- }
+- else
+- {
+- // Otherwise, have the add-on bus find a suitable add-on
+- addonBus->GetAddonWithButtonMap(device, addon);
+- }
+- }
++ PeripheralAddonPtr addon;
++
++ PeripheralAddonPtr addonWithButtonMap;
++ if (addonBus && addonBus->GetAddonWithButtonMap(device, addonWithButtonMap))
++ addon = std::move(addonWithButtonMap);
+
+ return addon;
+ }
+diff --git a/xbmc/peripherals/Peripherals.h b/xbmc/peripherals/Peripherals.h
+index b66970d..33ca7fb 100644
+--- a/xbmc/peripherals/Peripherals.h
++++ b/xbmc/peripherals/Peripherals.h
+@@ -239,7 +239,7 @@ namespace PERIPHERALS
+ // implementation of IEventScannerCallback
+ virtual void ProcessEvents(void) override;
+
+- virtual PeripheralAddonPtr GetAddon(const CPeripheral* device);
++ virtual PeripheralAddonPtr GetAddonWithButtonMap(const CPeripheral* device);
+
+ virtual void ResetButtonMaps(const std::string& controllerId);
+
+diff --git a/xbmc/peripherals/addons/AddonButtonMapping.cpp b/xbmc/peripherals/addons/AddonButtonMapping.cpp
+index 818e894..32a45c2 100644
+--- a/xbmc/peripherals/addons/AddonButtonMapping.cpp
++++ b/xbmc/peripherals/addons/AddonButtonMapping.cpp
+@@ -29,7 +29,7 @@ using namespace PERIPHERALS;
+
+ CAddonButtonMapping::CAddonButtonMapping(CPeripheral* peripheral, IButtonMapper* mapper)
+ {
+- PeripheralAddonPtr addon = g_peripherals.GetAddon(peripheral);
++ PeripheralAddonPtr addon = g_peripherals.GetAddonWithButtonMap(peripheral);
+
+ if (!addon)
+ {
+diff --git a/xbmc/peripherals/addons/AddonInputHandling.cpp b/xbmc/peripherals/addons/AddonInputHandling.cpp
+index 7a29c9e..89527f4 100644
+--- a/xbmc/peripherals/addons/AddonInputHandling.cpp
++++ b/xbmc/peripherals/addons/AddonInputHandling.cpp
+@@ -32,7 +32,7 @@ using namespace PERIPHERALS;
+
+ CAddonInputHandling::CAddonInputHandling(CPeripheral* peripheral, IInputHandler* handler, IDriverReceiver* receiver)
+ {
+- PeripheralAddonPtr addon = g_peripherals.GetAddon(peripheral);
++ PeripheralAddonPtr addon = g_peripherals.GetAddonWithButtonMap(peripheral);
+
+ if (!addon)
+ {
+diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusAddon.cpp b/xbmc/peripherals/bus/virtual/PeripheralBusAddon.cpp
+index b533686..2426285 100644
+--- a/xbmc/peripherals/bus/virtual/PeripheralBusAddon.cpp
++++ b/xbmc/peripherals/bus/virtual/PeripheralBusAddon.cpp
+@@ -80,15 +80,32 @@ bool CPeripheralBusAddon::GetAddon(const std::string &strId, AddonPtr &addon) co
+ bool CPeripheralBusAddon::GetAddonWithButtonMap(const CPeripheral* device, PeripheralAddonPtr &addon) const
+ {
+ CSingleLock lock(m_critSection);
+- for (const auto& addonIt : m_addons)
++
++ // If device is from an add-on, try to use that add-on
++ if (device && device->GetBusType() == PERIPHERAL_BUS_ADDON)
+ {
+- if (addonIt->HasButtonMaps())
++ PeripheralAddonPtr addonWithButtonMap;
++ unsigned int index;
++ if (SplitLocation(device->Location(), addonWithButtonMap, index))
+ {
+- addon = addonIt;
+- return true;
++ if (addonWithButtonMap->HasButtonMaps())
++ addon = std::move(addonWithButtonMap);
+ }
+ }
+- return false;
++
++ if (!addon)
++ {
++ auto it = std::find_if(m_addons.begin(), m_addons.end(),
++ [](const PeripheralAddonPtr& addon)
++ {
++ return addon->HasButtonMaps();
++ });
++
++ if (it != m_addons.end())
++ addon = *it;
++ }
++
++ return addon.get() != nullptr;
+ }
+
+ unsigned int CPeripheralBusAddon::GetAddonCount(void) const
diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-PR10345.patch b/packages/mediacenter/kodi/patches/kodi-999.99-PR10345.patch
new file mode 100644
index 0000000000..43b06967c6
--- /dev/null
+++ b/packages/mediacenter/kodi/patches/kodi-999.99-PR10345.patch
@@ -0,0 +1,82 @@
+From 11c81dbb3d0ccfbe3a4197890dea09801617eae2 Mon Sep 17 00:00:00 2001
+From: mapfau
+Date: Sun, 28 Aug 2016 23:15:34 +0200
+Subject: [PATCH] check for kodi.inputstream version
+
+---
+ xbmc/addons/InputStream.cpp | 23 +++++++++++++++++++++--
+ xbmc/addons/InputStream.h | 4 +++-
+ 2 files changed, 24 insertions(+), 3 deletions(-)
+
+diff --git a/xbmc/addons/InputStream.cpp b/xbmc/addons/InputStream.cpp
+index 9d6aee2..5d09a4c 100644
+--- a/xbmc/addons/InputStream.cpp
++++ b/xbmc/addons/InputStream.cpp
+@@ -36,8 +36,22 @@ std::unique_ptr CInputStream::FromExtension(AddonProps props, cons
+ std::string extensions = CAddonMgr::GetInstance().GetExtValue(ext->configuration, "@extension");
+ std::string protocols = CAddonMgr::GetInstance().GetExtValue(ext->configuration, "@protocols");
+ std::string name(ext->plugin->identifier);
++
++ bool matchAPIVersion(true);
++ for (unsigned int i(0); i < ext->plugin->num_imports; ++i)
++ if (strcmp(ext->plugin->imports[i].plugin_id, "kodi.inputstream") == 0 && strcmp(ext->plugin->imports[i].version, INPUTSTREAM_API_VERSION) != 0)
++ {
++ matchAPIVersion = false;
++ CLog::Log(LOGNOTICE, "CInputStream::FromExtension - %s (%s) not loaded due to API mismatch, has %s, wanted %s",
++ props.id.c_str(),
++ props.version.Upstream().c_str(),
++ ext->plugin->imports[i].version,
++ INPUTSTREAM_API_VERSION);
++ break;
++ }
++
+ std::unique_ptr istr(new CInputStream(props, name, listitemprops,
+- extensions, protocols));
++ extensions, protocols, matchAPIVersion));
+ istr->CheckConfig();
+ return istr;
+ }
+@@ -46,8 +60,10 @@ CInputStream::CInputStream(const AddonProps& props,
+ const std::string& name,
+ const std::string& listitemprops,
+ const std::string& extensions,
+- const std::string& protocols)
++ const std::string& protocols,
++ bool matchAPIVersion)
+ : InputStreamDll(std::move(props))
++, m_matchAPIVersion(matchAPIVersion)
+ {
+ m_fileItemProps = StringUtils::Tokenize(listitemprops, "|");
+ for (auto &key : m_fileItemProps)
+@@ -71,6 +87,9 @@ CInputStream::CInputStream(const AddonProps& props,
+
+ bool CInputStream::CheckAPIVersion()
+ {
++ if (!m_matchAPIVersion)
++ return false;
++
+ std::string dllVersion = m_pStruct->GetApiVersion();
+ if (dllVersion.compare(INPUTSTREAM_API_VERSION) != 0)
+ {
+diff --git a/xbmc/addons/InputStream.h b/xbmc/addons/InputStream.h
+index c081472..328e036 100644
+--- a/xbmc/addons/InputStream.h
++++ b/xbmc/addons/InputStream.h
+@@ -46,7 +46,8 @@ namespace ADDON
+ const std::string& name,
+ const std::string& listitemprops,
+ const std::string& extensions,
+- const std::string& protocols);
++ const std::string& protocols,
++ bool hasAPIVersion);
+ virtual ~CInputStream() {}
+
+ virtual void SaveSettings() override;
+@@ -100,6 +101,7 @@ namespace ADDON
+ std::vector m_extensionsList;
+ std::vector m_protocolsList;
+ INPUTSTREAM_CAPABILITIES m_caps;
++ bool m_matchAPIVersion;
+ std::map m_streams;
+
+ static CCriticalSection m_parentSection;
diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-VideoPlayer_Fix_build_after_dropping_deinterlacing_mode.patch b/packages/mediacenter/kodi/patches/kodi-999.99-VideoPlayer_Fix_build_after_dropping_deinterlacing_mode.patch
deleted file mode 100644
index 1cb247df17..0000000000
--- a/packages/mediacenter/kodi/patches/kodi-999.99-VideoPlayer_Fix_build_after_dropping_deinterlacing_mode.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 9fe38dcb04d89770e12d374880b3115acd9da4f1 Mon Sep 17 00:00:00 2001
-From: Christian Fetzer
-Date: Tue, 2 Aug 2016 07:54:15 +0200
-Subject: [PATCH] [VideoPlayer] Fix build after dropping deinterlacing mode
-
-25718f4ccebd227eaf63f0f8b53f0552f89f01e5 forgot to remove some methods
-that still use EDEINTERLACEMODE.
----
- .../VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp | 10 ----------
- .../cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h | 1 -
- .../VideoPlayer/VideoRenderers/HwDecRender/RendererOpenMax.cpp | 5 -----
- .../VideoPlayer/VideoRenderers/HwDecRender/RendererOpenMax.h | 1 -
- 4 files changed, 17 deletions(-)
-
-diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp
-index d0baa27..d8674c8 100644
---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp
-+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp
-@@ -81,16 +81,6 @@ bool CRendererAML::Supports(EINTERLACEMETHOD method)
- return false;
- }
-
--bool CRendererAML::Supports(EDEINTERLACEMODE mode)
--{
-- if(mode == VS_DEINTERLACEMODE_OFF
-- || mode == VS_DEINTERLACEMODE_AUTO
-- || mode == VS_DEINTERLACEMODE_FORCE)
-- return true;
--
-- return false;
--}
--
- bool CRendererAML::Supports(ESCALINGMETHOD method)
- {
- return false;
-diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h
-index 819f6e3..828f584a 100644
---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h
-+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h
-@@ -41,7 +41,6 @@ class CRendererAML : public CLinuxRendererGLES
-
- // Feature support
- virtual bool Supports(EINTERLACEMETHOD method);
-- virtual bool Supports(EDEINTERLACEMODE mode);
- virtual bool Supports(ESCALINGMETHOD method);
- virtual bool Supports(ERENDERFEATURE feature);
-
-diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererOpenMax.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererOpenMax.cpp
-index 0fb0312..ba05557 100644
---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererOpenMax.cpp
-+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererOpenMax.cpp
-@@ -71,11 +71,6 @@ bool CRendererOMX::Supports(EINTERLACEMETHOD method)
- return false;
- }
-
--bool CRendererOMX::Supports(EDEINTERLACEMODE mode)
--{
-- return false;
--}
--
- bool CRendererOMX::Supports(ESCALINGMETHOD mode)
- {
- return false;
-diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererOpenMax.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererOpenMax.h
-index 5f18452..6e84cb2 100644
---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererOpenMax.h
-+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererOpenMax.h
-@@ -38,7 +38,6 @@ class CRendererOMX : public CLinuxRendererGLES
-
- // Feature support
- virtual bool Supports(EINTERLACEMETHOD method);
-- virtual bool Supports(EDEINTERLACEMODE mode);
- virtual bool Supports(ESCALINGMETHOD method);
-
-
diff --git a/packages/mediacenter/kodi/scripts/kodi.sh b/packages/mediacenter/kodi/scripts/kodi.sh
index 60bb472b57..b7b33e320d 100755
--- a/packages/mediacenter/kodi/scripts/kodi.sh
+++ b/packages/mediacenter/kodi/scripts/kodi.sh
@@ -45,9 +45,8 @@ single_stacktrace()
print_crash_report()
{
- if [ ! -d $CRASHLOG_DIR ] ; then
- mkdir -p $CRASHLOG_DIR
- fi
+ mkdir -p $CRASHLOG_DIR
+
DATE=`date +%Y%m%d%H%M%S`
FILE="$CRASHLOG_DIR/.kodi_crashlog.log"
echo "############## kodi CRASH LOG ###############" > $FILE
diff --git a/packages/mediacenter/kodi/system.d/kodi.service b/packages/mediacenter/kodi/system.d/kodi.service
index 8b972d89ec..d6d0250037 100644
--- a/packages/mediacenter/kodi/system.d/kodi.service
+++ b/packages/mediacenter/kodi/system.d/kodi.service
@@ -9,6 +9,8 @@ Environment=__GL_YIELD=USLEEP
Environment=DISPLAY=:0.0
Environment=SDL_MOUSE_RELATIVE=0
Environment=HOME=/storage
+Environment=KODI_TEMP=/storage/.kodi/temp
+Environment=KODI_HOME=/usr/share/kodi/
EnvironmentFile=-/run/libreelec/kodi.conf
EnvironmentFile=-/run/libreelec/debug/kodi.conf
ExecStartPre=-/usr/lib/kodi/kodi-config
diff --git a/packages/multimedia/ffmpeg/package.mk b/packages/multimedia/ffmpeg/package.mk
index 237232cced..8dae6ff1cc 100644
--- a/packages/multimedia/ffmpeg/package.mk
+++ b/packages/multimedia/ffmpeg/package.mk
@@ -18,7 +18,7 @@
PKG_NAME="ffmpeg"
# Current branch is: release/3.1-xbmc
-PKG_VERSION="c65cfe4"
+PKG_VERSION="6da2f5f"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="LGPLv2.1+"
diff --git a/packages/textproc/expat/package.mk b/packages/textproc/expat/package.mk
index c599ed7161..2f5d758b98 100644
--- a/packages/textproc/expat/package.mk
+++ b/packages/textproc/expat/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="expat"
-PKG_VERSION="2.1.1"
+PKG_VERSION="2.2.0"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="OSS"
diff --git a/packages/web/curl/package.mk b/packages/web/curl/package.mk
index 28433282b2..2d62c2209f 100644
--- a/packages/web/curl/package.mk
+++ b/packages/web/curl/package.mk
@@ -25,7 +25,7 @@
# there: http://forum.xbmc.org/showthread.php?tid=177557
PKG_NAME="curl"
-PKG_VERSION="7.49.1"
+PKG_VERSION="7.50.1"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="MIT"
diff --git a/projects/Odroid_C2/patches/kodi/kodi-0001-owersun-odroid.patch b/projects/Odroid_C2/patches/kodi/kodi-0001-owersun-odroid.patch
index 1ce9332838..db7bfa0b45 100644
--- a/projects/Odroid_C2/patches/kodi/kodi-0001-owersun-odroid.patch
+++ b/projects/Odroid_C2/patches/kodi/kodi-0001-owersun-odroid.patch
@@ -1,161 +1,19 @@
-From aeef849a8f4307cd1792600602ec8e3d47a7b52e Mon Sep 17 00:00:00 2001
-From: Owersun
-Date: Sat, 23 Apr 2016 22:34:30 +0200
-Subject: [PATCH 1/2] Odroids: All the codecs and display drivers
+From 99f9fb9e1df7f6877bbce3cf90ebf24cacea1797 Mon Sep 17 00:00:00 2001
+From: Markus Pfau
+Date: Tue, 23 Aug 2016 00:06:43 +0200
+Subject: [PATCH] oversun-changes
---
- configure.ac | 41 +-
- m4/xbmc_arch.m4 | 6 +
- xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 39 +-
- .../VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp | 5 +
- .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 18 +-
- .../DVDCodecs/Video/DVDVideoCodecMFC.cpp | 585 +++++++++++++++++++++
- .../VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.h | 64 +++
- xbmc/cores/VideoPlayer/DVDCodecs/Video/Makefile.in | 5 +-
- xbmc/linux/LinuxV4l2Sink.cpp | 311 +++++++++++
- xbmc/linux/LinuxV4l2Sink.h | 71 +++
- xbmc/linux/Makefile.in | 1 +
- xbmc/utils/AMLUtils.cpp | 93 +++-
- xbmc/utils/CPUInfo.cpp | 25 +-
- xbmc/windowing/X11/WinSystemX11.cpp | 2 +-
- xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp | 98 +++-
- xbmc/windowing/egl/EGLNativeTypeAmlogic.h | 19 +-
- xbmc/windowing/egl/EGLNativeTypeFbdev.cpp | 183 +++++++
- xbmc/windowing/egl/EGLNativeTypeFbdev.h | 68 +++
- xbmc/windowing/egl/EGLNativeTypeHybris.cpp | 279 ++++++++++
- xbmc/windowing/egl/EGLNativeTypeHybris.h | 77 +++
- xbmc/windowing/egl/EGLWrapper.cpp | 14 +-
- xbmc/windowing/egl/Makefile.in | 4 +
- 22 files changed, 1933 insertions(+), 75 deletions(-)
- create mode 100644 xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.cpp
- create mode 100644 xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.h
- create mode 100644 xbmc/linux/LinuxV4l2Sink.cpp
- create mode 100644 xbmc/linux/LinuxV4l2Sink.h
- create mode 100644 xbmc/windowing/egl/EGLNativeTypeFbdev.cpp
- create mode 100644 xbmc/windowing/egl/EGLNativeTypeFbdev.h
- create mode 100644 xbmc/windowing/egl/EGLNativeTypeHybris.cpp
- create mode 100644 xbmc/windowing/egl/EGLNativeTypeHybris.h
+ xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 39 ++++++---
+ .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 13 +--
+ xbmc/utils/AMLUtils.cpp | 93 ++++++++++++++++++--
+ xbmc/utils/CPUInfo.cpp | 25 +++---
+ xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp | 98 ++++++++++++++++------
+ xbmc/windowing/egl/EGLNativeTypeAmlogic.h | 19 ++++-
+ 6 files changed, 221 insertions(+), 66 deletions(-)
-diff --git a/configure.ac b/configure.ac
-index 8cc0ba8..6a727bd 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -213,6 +213,10 @@ libbluetooth_enabled="== libbluetooth enabled. =="
- libbluetooth_disabled="== libbluetooth disabled. Bluetooth support will not be available. =="
-
-
-+# Odroid stuff
-+hybris_enabled="== Libhybris enabled. =="
-+hybris_disabled="== Libhybris disabled. =="
-+
- AC_ARG_WITH([ffmpeg],
- [AS_HELP_STRING([--with-ffmpeg],
- [ffmpeg options: auto (search pkg-config or auto build), force (always build ffmpeg), shared (link dynamically), path_to_ffmpeg [default=force]])],
-@@ -474,7 +478,7 @@ AC_ARG_ENABLE([breakpad],
-
- AC_ARG_ENABLE([codec],
- [AS_HELP_STRING([--enable-codec],
-- [enable additional codecs from a list of comma separated names, (default is none, choices are amcodec and imxvpu)])],
-+ [enable additional codecs from a list of comma separated names, (default is none, choices are mfc, amcodec and imxvpu)])],
- [add_codecs=$enableval],
- [add_codecs=no])
-
-@@ -485,6 +489,13 @@ AC_ARG_ENABLE([libav-compat],
- [use_libav_hacks=$enableval],
- [use_libav_hacks=no])
-
-+# Odroid stuff
-+AC_ARG_ENABLE([hybris],
-+ [AS_HELP_STRING([--enable-hybris],
-+ [enable use of Libhybris (default is no) 'Linux only'])],
-+ [use_hybris=$enableval],
-+ [use_hybris=no])
-+
- ### End of external library options
-
- if test "x$host_vendor" != "xapple"; then
-@@ -1480,6 +1491,23 @@ else
- AC_MSG_NOTICE($libcap_disabled)
- fi
-
-+# Odroid stuff
-+if test "x$use_hybris" != "xno"; then
-+ AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_HYBRIS")
-+ USE_HYBRIS=1;
-+ AC_DEFINE(HAS_EGLGLES, [1], [Define if supporting EGL based GLES Framebuffer])
-+ AC_DEFINE(HAS_HYBRIS, [1], [Define if supporting Hybris based systems])
-+ PKG_CHECK_MODULES([HWCOMPOSEREGL], [hwcomposer-egl >= 0.1],
-+ [INCLUDES="$INCLUDES -I/usr/include/hybris $HWCOMPOSEREGL_CFLAGS"; LIBS="$LIBS $HWCOMPOSEREGL_LIBS"],
-+ AC_MSG_ERROR($missing_library))
-+ PKG_CHECK_MODULES([HYBRISEGL], [hybris-egl-platform >= 0.1],
-+ [INCLUDES="$INCLUDES $HYBRISEGL_CFLAGS"; LIBS="$LIBS $HYBRISEGL_LIBS"],
-+ AC_MSG_ERROR($missing_library))
-+ PKG_CHECK_MODULES([LIBHARDWARE], [libhardware >= 0.1],
-+ [INCLUDES="$INCLUDES $LIBHARDWARE_CFLAGS"; LIBS="$LIBS $LIBHARDWARE_LIBS -lsync -lmedia"],
-+ AC_MSG_ERROR($missing_library))
-+fi
-+
- # FFmpeg
- FFMPEG_LIBNAMES="libavcodec >= 56.26.100
- libavfilter >= 5.11.102
-@@ -1701,6 +1729,9 @@ esac
- # remember to convert commas to spaces
- for codecs in `echo $add_codecs | sed 's/,/ /g'`; do
- case $codecs in
-+ *mfc*)
-+ XB_ADD_CODEC([MFC], [mfc], [$codecs])
-+ ;;
- *amcodec*)
- AC_CHECK_HEADER([amcodec/codec_error.h],, AC_MSG_ERROR($missing_headers))
- XB_ADD_CODEC([LIBAMCODEC], [amcodec], [$codecs])
-@@ -2098,6 +2129,13 @@ else
- final_message="$final_message\n additional codecs:\tNo"
- fi
-
-+# Odroid stuff
-+if test "x$use_hybris" != "xno"; then
-+ final_message="$final_message\n Odroid Hybris support:\tYes"
-+else
-+ final_message="$final_message\n Odroid Hybris support:\tNo"
-+fi
-+
- ### External libraries messages
-
- if test "$host_vendor" = "apple" ; then
-@@ -2290,6 +2328,7 @@ AC_SUBST(USE_MMAL)
- AC_SUBST(USE_X11)
- AC_SUBST(USE_OPTICAL_DRIVE)
- AC_SUBST(USE_BREAKPAD)
-+AC_SUBST(USE_HYBRIS)
- AC_SUBST(CROSS_COMPILING)
-
- # pushd and popd are not available in other shells besides bash, so implement
-diff --git a/m4/xbmc_arch.m4 b/m4/xbmc_arch.m4
-index d28f263..07f1770 100644
---- a/m4/xbmc_arch.m4
-+++ b/m4/xbmc_arch.m4
-@@ -26,6 +26,9 @@ case $build in
- arm*-*-linux-gnu*|arm*-*-linux-uclibc*)
- AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
- ;;
-+ aarch64-*-linux-gnu*)
-+ AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
-+ ;;
- *)
- AC_MSG_ERROR(unsupported native build platform: $build)
- esac
-@@ -63,6 +66,9 @@ case $host in
- arm*-*-linux-gnu*|arm*-*-linux-uclibc*|aarch64*-*-linux-gnu*|aarch64*-*-linux-uclibc*)
- AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
- ;;
-+ aarch64-*-linux-gnu*)
-+ AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
-+ ;;
- mips*-*-linux-gnu*|mips*-*-linux-uclibc*)
- AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
- ;;
diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
-index 6a9066b..30653a3 100644
+index 4bb159f..ea2db01 100644
--- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
@@ -490,6 +490,7 @@ snd_pcm_chmap_t* CAESinkALSA::SelectALSAChannelMap(const CAEChannelInfo& info)
@@ -242,7 +100,7 @@ index 6a9066b..30653a3 100644
CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Got: periodSize %lu, bufferSize %lu", periodSize, bufferSize);
/* set the format parameters */
-@@ -1301,6 +1305,15 @@ void CAESinkALSA::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
+@@ -1302,6 +1306,15 @@ void CAESinkALSA::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
AEDeviceType CAESinkALSA::AEDeviceTypeFromName(const std::string &name)
{
@@ -258,7 +116,7 @@ index 6a9066b..30653a3 100644
if (name.substr(0, 4) == "hdmi")
return AE_DEVTYPE_HDMI;
else if (name.substr(0, 6) == "iec958" || name.substr(0, 5) == "spdif")
-@@ -1405,9 +1418,9 @@ void CAESinkALSA::EnumerateDevice(AEDeviceInfoList &list, const std::string &dev
+@@ -1406,9 +1419,9 @@ void CAESinkALSA::EnumerateDevice(AEDeviceInfoList &list, const std::string &dev
if (badHDMI)
{
@@ -271,34 +129,11 @@ index 6a9066b..30653a3 100644
* AMD (fglrx) hardware, so it is not safe to close those
* handles
*/
-diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp
-index bb5bfe0..9351b3e 100644
---- a/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp
-+++ b/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp
-@@ -41,6 +41,9 @@
- #include "Video/DVDVideoCodecAndroidMediaCodec.h"
- #include "platform/android/activity/AndroidFeatures.h"
- #endif
-+#if defined(HAS_MFC)
-+#include "Video/DVDVideoCodecMFC.h"
-+#endif
- #include "Audio/DVDAudioCodecFFmpeg.h"
- #include "Audio/DVDAudioCodecPassthrough.h"
- #include "Overlay/DVDOverlayCodecSSA.h"
-@@ -149,6 +152,8 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, CProces
- pCodec = OpenCodec(new CDVDVideoCodecOpenMax(processInfo), hint, options);
- #elif defined(HAS_MMAL)
- pCodec = OpenCodec(new CMMALVideo(processInfo), hint, options);
-+#elif defined(HAS_MFC)
-+ pCodec = OpenCodec(new CDVDVideoCodecMFC(processInfo), hint, options);
- #endif
- if (pCodec)
- return pCodec;
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
-index aa30474..bfc862e 100644
+index 5dadf82..ca8e964 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
-@@ -398,18 +398,19 @@ void dumpfile_write(am_private_t *para, void* buf, int bufsiz)
+@@ -398,7 +398,7 @@ void dumpfile_write(am_private_t *para, void* buf, int bufsiz)
}
if (para->dumpdemux && para->dumpfile != -1)
@@ -306,21 +141,8 @@ index aa30474..bfc862e 100644
+ int ret = write(para->dumpfile, buf, bufsiz);
}
- static int set_pts_pcrscr(int64_t value)
- {
-+ int ret;
- int fd = open("/sys/class/tsync/pts_pcrscr", O_WRONLY);
- if (fd >= 0)
- {
- char pts_str[64];
- unsigned long pts = (unsigned long)value;
- sprintf(pts_str, "0x%lx", pts);
-- write(fd, pts_str, strlen(pts_str));
-+ ret = write(fd, pts_str, strlen(pts_str));
- close(fd);
- return 0;
- }
-@@ -730,7 +731,7 @@ int write_av_packet(am_private_t *para, am_packet_t *pkt)
+ static vformat_t codecid_to_vformat(enum AVCodecID id)
+@@ -713,7 +713,7 @@ int write_av_packet(am_private_t *para, am_packet_t *pkt)
}
pkt->newflag = 0;
}
@@ -329,7 +151,7 @@ index aa30474..bfc862e 100644
buf = pkt->data;
size = pkt->data_size ;
if (size == 0 && pkt->isvalid) {
-@@ -1580,7 +1581,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
+@@ -1563,7 +1563,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
// h264 in an avi file
if (m_hints.ptsinvalid)
am_private->gcodec.param = (void*)(EXTERNAL_PTS | SYNC_OUTSIDE);
@@ -338,7 +160,7 @@ index aa30474..bfc862e 100644
case VFORMAT_REAL:
am_private->stream_type = AM_STREAM_RM;
am_private->vcodec.noblock = 1;
-@@ -1645,7 +1646,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
+@@ -1628,7 +1628,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
Create();
@@ -347,7 +169,7 @@ index aa30474..bfc862e 100644
std::string strScaler;
SysfsUtils::GetString("/sys/class/ppmgr/ppscaler", strScaler);
-@@ -2187,7 +2188,6 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
+@@ -2154,7 +2154,6 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
int diff = (int) ((dst_rect.Height() - dst_rect.Width()) / 2);
dst_rect = CRect(DestRect.x1 - diff, DestRect.y1, DestRect.x2 + diff, DestRect.y2);
}
@@ -355,7 +177,7 @@ index aa30474..bfc862e 100644
}
if (m_dst_rect != dst_rect)
-@@ -2209,7 +2209,7 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
+@@ -2176,7 +2175,7 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
#ifdef TARGET_ANDROID
display = m_display_rect;
#else
@@ -364,7 +186,7 @@ index aa30474..bfc862e 100644
#endif
if (gui != display)
{
-@@ -2281,6 +2281,8 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
+@@ -2248,6 +2247,8 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
std::string s_gui = StringUtils::Format("%i,%i,%i,%i",
(int)gui.x1, (int)gui.y1,
(int)gui.Width(), (int)gui.Height());
@@ -373,1095 +195,11 @@ index aa30474..bfc862e 100644
CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:display(%s)", s_display.c_str());
CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:gui(%s)", s_gui.c_str());
CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_dst_rect(%s)", s_m_dst_rect.c_str());
-diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.cpp
-new file mode 100644
-index 0000000..900c5d8
---- /dev/null
-+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.cpp
-@@ -0,0 +1,585 @@
-+#include "system.h"
-+
-+#ifndef THIS_IS_NOT_XBMC
-+ #if (defined HAVE_CONFIG_H) && (!defined WIN32)
-+ #include "config.h"
-+ #endif
-+ #include "DVDDemuxers/DVDDemux.h"
-+ #include "DVDStreamInfo.h"
-+ #include "DVDClock.h"
-+ #include "guilib/GraphicContext.h"
-+ #include "DVDCodecs/DVDCodecs.h"
-+ #include "DVDCodecs/DVDCodecUtils.h"
-+ #include "settings/Settings.h"
-+ #include "settings/DisplaySettings.h"
-+ #include "settings/AdvancedSettings.h"
-+ #include "utils/log.h"
-+#endif
-+
-+#include "DVDVideoCodecMFC.h"
-+
-+#include
-+#include
-+#include
-+#include
-+#include
-+#include
-+#include
-+#include
-+
-+#ifdef CLASSNAME
-+#undef CLASSNAME
-+#endif
-+#define CLASSNAME "CDVDVideoCodecMFC"
-+
-+CDVDVideoCodecMFC::CDVDVideoCodecMFC(CProcessInfo &processInfo) : CDVDVideoCodec(processInfo) {
-+
-+ m_iDecoderHandle = NULL;
-+ m_iConverterHandle = NULL;
-+ m_MFCOutput = NULL;
-+ m_MFCCapture = NULL;
-+ m_FIMCOutput = NULL;
-+ m_FIMCCapture = NULL;
-+
-+ m_Buffer = NULL;
-+ m_BufferNowOnScreen = NULL;
-+
-+ memzero(m_videoBuffer);
-+
-+}
-+
-+CDVDVideoCodecMFC::~CDVDVideoCodecMFC() {
-+
-+ Dispose();
-+
-+}
-+
-+bool CDVDVideoCodecMFC::OpenDevices() {
-+ DIR *dir;
-+
-+ if ((dir = opendir ("/sys/class/video4linux/")) != NULL) {
-+ struct dirent *ent;
-+ while ((ent = readdir (dir)) != NULL) {
-+ if (strncmp(ent->d_name, "video", 5) == 0) {
-+ char *p;
-+ char name[64];
-+ char devname[64];
-+ char sysname[64];
-+ char drivername[32];
-+ char target[1024];
-+ int ret;
-+
-+ snprintf(sysname, 64, "/sys/class/video4linux/%s", ent->d_name);
-+ snprintf(name, 64, "/sys/class/video4linux/%s/name", ent->d_name);
-+
-+ FILE* fp = fopen(name, "r");
-+ if (fgets(drivername, 32, fp) != NULL) {
-+ p = strchr(drivername, '\n');
-+ if (p != NULL)
-+ *p = '\0';
-+ } else {
-+ fclose(fp);
-+ continue;
-+ }
-+ fclose(fp);
-+
-+ ret = readlink(sysname, target, sizeof(target));
-+ if (ret < 0)
-+ continue;
-+ target[ret] = '\0';
-+ p = strrchr(target, '/');
-+ if (p == NULL)
-+ continue;
-+
-+ sprintf(devname, "/dev/%s", ++p);
-+
-+ if (!m_iDecoderHandle && strstr(drivername, "mfc") != NULL && strstr(drivername, "dec") != NULL) {
-+ int fd = open(devname, O_RDWR | O_NONBLOCK, 0);
-+ if (fd > -1) {
-+ struct v4l2_capability cap;
-+ memzero(cap);
-+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0)
-+ if (cap.capabilities & V4L2_CAP_STREAMING &&
-+ (cap.capabilities & V4L2_CAP_VIDEO_M2M_MPLANE ||
-+ (cap.capabilities & (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_OUTPUT_MPLANE)))) {
-+ m_iDecoderHandle = new V4l2Device;
-+ m_iDecoderHandle->device = fd;
-+ strcpy(m_iDecoderHandle->name, drivername);
-+ CLog::Log(LOGDEBUG, "%s::%s - MFC Found %s %s", CLASSNAME, __func__, drivername, devname);
-+ struct v4l2_format fmt;
-+ memzero(fmt);
-+ fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
-+ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M;
-+ if (ioctl(fd, VIDIOC_TRY_FMT, &fmt) == 0) {
-+ CLog::Log(LOGDEBUG, "%s::%s - Direct decoding to untiled picture on device %s is supported, no conversion needed", CLASSNAME, __func__, m_iDecoderHandle->name);
-+ delete m_iConverterHandle;
-+ m_iConverterHandle = NULL;
-+ return true;
-+ }
-+ }
-+ }
-+ if (!m_iDecoderHandle)
-+ close(fd);
-+ }
-+ if (!m_iConverterHandle && strstr(drivername, "fimc") != NULL && strstr(drivername, "m2m") != NULL) {
-+ int fd = open(devname, O_RDWR | O_NONBLOCK, 0);
-+ if (fd > -1) {
-+ struct v4l2_capability cap;
-+ memzero(cap);
-+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0)
-+ if (cap.capabilities & V4L2_CAP_STREAMING &&
-+ (cap.capabilities & V4L2_CAP_VIDEO_M2M_MPLANE ||
-+ (cap.capabilities & (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_OUTPUT_MPLANE)))) {
-+ m_iConverterHandle = new V4l2Device;
-+ m_iConverterHandle->device = fd;
-+ strcpy(m_iConverterHandle->name, drivername);
-+ CLog::Log(LOGDEBUG, "%s::%s - FIMC Found %s %s", CLASSNAME, __func__, drivername, devname);
-+ }
-+ }
-+ if (!m_iConverterHandle)
-+ close(fd);
-+ }
-+ if (m_iDecoderHandle && m_iConverterHandle) {
-+ closedir (dir);
-+ return true;
-+ }
-+ }
-+ }
-+ closedir (dir);
-+ }
-+
-+ return false;
-+
-+}
-+
-+void CDVDVideoCodecMFC::Dispose() {
-+
-+ CLog::Log(LOGDEBUG, "%s::%s - Starting cleanup", CLASSNAME, __func__);
-+
-+ delete m_BufferNowOnScreen;
-+ delete m_Buffer;
-+
-+ m_Buffer = NULL;
-+ m_BufferNowOnScreen = NULL;
-+
-+ delete m_FIMCCapture;
-+ delete m_FIMCOutput;
-+ delete m_MFCCapture;
-+ delete m_MFCOutput;
-+
-+ m_MFCOutput = NULL;
-+ m_MFCCapture = NULL;
-+ m_FIMCOutput = NULL;
-+ m_FIMCCapture = NULL;
-+
-+ if (m_iConverterHandle) {
-+ close(m_iConverterHandle->device);
-+ delete m_iConverterHandle;
-+ m_iConverterHandle = NULL;
-+ }
-+
-+ if (m_iDecoderHandle) {
-+ close(m_iDecoderHandle->device);
-+ delete m_iDecoderHandle;
-+ m_iDecoderHandle = NULL;
-+ }
-+
-+}
-+
-+bool CDVDVideoCodecMFC::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) {
-+ struct v4l2_format fmt;
-+ struct v4l2_crop crop;
-+ struct V4l2SinkBuffer sinkBuffer;
-+ V4l2Device *finalSink = NULL;
-+ int finalFormat = -1;
-+ int resultVideoWidth;
-+ int resultVideoHeight;
-+ int resultLineSize;
-+ unsigned int extraSize = 0;
-+ uint8_t *extraData = NULL;
-+
-+ m_hints = hints;
-+ if (m_hints.software)
-+ return false;
-+
-+ Dispose();
-+
-+ m_Buffer = new V4l2SinkBuffer();
-+ m_BufferNowOnScreen = new V4l2SinkBuffer();
-+ m_BufferNowOnScreen->iIndex = -1;
-+ m_bVideoConvert = false;
-+ m_bDropPictures = false;
-+ memzero(m_videoBuffer);
-+
-+ if (!OpenDevices()) {
-+ CLog::Log(LOGERROR, "%s::%s - No Exynos MFC Decoder/Converter found", CLASSNAME, __func__);
-+ return false;
-+ }
-+
-+ m_bVideoConvert = m_converter.Open(m_hints.codec, (uint8_t *)m_hints.extradata, m_hints.extrasize, true);
-+
-+ if(m_bVideoConvert) {
-+ if(m_converter.GetExtraData() != NULL && m_converter.GetExtraSize() > 0) {
-+ extraSize = m_converter.GetExtraSize();
-+ extraData = m_converter.GetExtraData();
-+ }
-+ } else {
-+ if(m_hints.extrasize > 0 && m_hints.extradata != NULL) {
-+ extraSize = m_hints.extrasize;
-+ extraData = (uint8_t*)m_hints.extradata;
-+ }
-+ }
-+
-+ // Test what formats we can get finally
-+ // If converter is present, it is our final sink
-+ (m_iConverterHandle) ? finalSink = m_iConverterHandle : finalSink = m_iDecoderHandle;
-+ // Test NV12 2 Planes Y/CbCr
-+ memzero(fmt);
-+ fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
-+ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M;
-+ if (ioctl(finalSink->device, VIDIOC_TRY_FMT, &fmt) == 0)
-+ finalFormat = V4L2_PIX_FMT_NV12M;
-+ memzero(fmt);
-+/*
-+ // Test YUV420 3 Planes Y/Cb/Cr
-+ fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
-+ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_YUV420M;
-+ if (ioctl(finalSink->device, VIDIOC_TRY_FMT, &fmt) == 0)
-+ finalFormat = V4L2_PIX_FMT_YUV420M;
-+*/
-+
-+ // No suitable output formats available
-+ if (finalFormat < 0) {
-+ CLog::Log(LOGERROR, "%s::%s - No suitable format on %s to convert to found", CLASSNAME, __func__, finalSink->name);
-+ return false;
-+ }
-+
-+ // Create MFC Output sink (the one where encoded frames are feed)
-+ m_MFCOutput = new CLinuxV4l2Sink(m_iDecoderHandle, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
-+ memzero(fmt);
-+ switch(m_hints.codec)
-+ {
-+ case AV_CODEC_ID_VC1:
-+ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VC1_ANNEX_G;
-+ m_name = "mfc-vc1";
-+ break;
-+ case AV_CODEC_ID_MPEG1VIDEO:
-+ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG1;
-+ m_name = "mfc-mpeg1";
-+ break;
-+ case AV_CODEC_ID_MPEG2VIDEO:
-+ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG2;
-+ m_name = "mfc-mpeg2";
-+ break;
-+ case AV_CODEC_ID_MPEG4:
-+ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG4;
-+ m_name = "mfc-mpeg4";
-+ break;
-+ case AV_CODEC_ID_H263:
-+ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H263;
-+ m_name = "mfc-h263";
-+ break;
-+ case AV_CODEC_ID_H264:
-+ fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H264;
-+ m_name = "mfc-h264";
-+ break;
-+ default:
-+ return false;
-+ break;
-+ }
-+ fmt.fmt.pix_mp.plane_fmt[0].sizeimage = BUFFER_SIZE;
-+ // Set encoded format
-+ if (!m_MFCOutput->SetFormat(&fmt))
-+ return false;
-+ // Init with number of input buffers predefined
-+ if (!m_MFCOutput->Init(INPUT_BUFFERS))
-+ return false;
-+
-+ // Get empty buffer to fill
-+ if (!m_MFCOutput->GetBuffer(&sinkBuffer))
-+ return false;
-+ // Fill it with the header
-+ sinkBuffer.iBytesUsed[0] = extraSize;
-+ memcpy(sinkBuffer.cPlane[0], extraData, extraSize);
-+ // Enqueue buffer
-+ if (!m_MFCOutput->PushBuffer(&sinkBuffer))
-+ return false;
-+
-+ // Create MFC Capture sink (the one from which decoded frames are read)
-+ m_MFCCapture = new CLinuxV4l2Sink(m_iDecoderHandle, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
-+ memzero(fmt);
-+ // If there is no converter set output format on the MFC Capture sink
-+ if (!m_iConverterHandle) {
-+ fmt.fmt.pix_mp.pixelformat = finalFormat;
-+ if (!m_MFCCapture->SetFormat(&fmt))
-+ return false;
-+ }
-+
-+ // Turn on MFC Output with header in it to initialize MFC with all we just setup
-+ m_MFCOutput->StreamOn(VIDIOC_STREAMON);
-+
-+ // Initialize MFC Capture
-+ if (!m_MFCCapture->Init(0))
-+ return false;
-+ // Queue all buffers (empty) to MFC Capture
-+ m_MFCCapture->QueueAll();
-+
-+ // Read the format of MFC Capture
-+ if (!m_MFCCapture->GetFormat(&fmt))
-+ return false;
-+ // Size of resulting picture coming out of MFC
-+ // It will be aligned by 16 since the picture is tiled
-+ // We need this to know where to split buffer line by line
-+ resultLineSize = fmt.fmt.pix_mp.width;
-+ // Get MFC capture crop settings
-+ if (!m_MFCCapture->GetCrop(&crop))
-+ return false;
-+ // This is the picture boundaries we are interested in, everything outside is alignement because of tiled MFC output
-+ resultVideoWidth = crop.c.width;
-+ resultVideoHeight = crop.c.height;
-+
-+ // Turn on MFC Capture
-+ m_MFCCapture->StreamOn(VIDIOC_STREAMON);
-+
-+ // If converter is needed (we need to untile the picture from format MFC produces it)
-+ if (m_iConverterHandle) {
-+ // Create FIMC Output sink
-+ m_FIMCOutput = new CLinuxV4l2Sink(m_iConverterHandle, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
-+ // Set the FIMC Output format to the one read from MFC
-+ if (!m_FIMCOutput->SetFormat(&fmt))
-+ return false;
-+ // Set the FIMC Output crop to the one read from MFC
-+ if (!m_FIMCOutput->SetCrop(&crop))
-+ return false;
-+ // Init FIMC Output and link it to buffers of MFC Capture
-+ if (!m_FIMCOutput->Init(m_MFCCapture))
-+ return false;
-+ // Get FIMC Output crop settings
-+ if (!m_FIMCOutput->GetCrop(&crop))
-+ return false;
-+
-+ // Create FIMC Capture sink
-+ m_FIMCCapture = new CLinuxV4l2Sink(m_iConverterHandle, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
-+ // Set the final picture format and the same picture dimension settings to FIMC Capture
-+ // as picture crop coming from MFC (original picture dimensions)
-+ memzero(fmt);
-+ fmt.fmt.pix_mp.pixelformat = finalFormat;
-+ fmt.fmt.pix_mp.width = crop.c.width;
-+ fmt.fmt.pix_mp.height = crop.c.height;
-+ fmt.fmt.pix_mp.field = V4L2_FIELD_ANY;
-+ if (!m_FIMCCapture->SetFormat(&fmt))
-+ return false;
-+ // Init FIMC capture with number of buffers predefined
-+ if (!m_FIMCCapture->Init(OUTPUT_BUFFERS))
-+ return false;
-+
-+ // Queue all buffers (empty) to FIMC Capture
-+ m_FIMCCapture->QueueAll();
-+
-+ // Read FIMC capture format settings
-+ if (!m_FIMCCapture->GetFormat(&fmt))
-+ return false;
-+ resultLineSize = fmt.fmt.pix_mp.width;
-+ // Read FIMC capture crop settings
-+ if (!m_FIMCCapture->GetCrop(&crop))
-+ return false;
-+ resultVideoWidth = crop.c.width;
-+ resultVideoHeight = crop.c.height;
-+
-+ // Turn on FIMC Output and Capture enabling the converter
-+ m_FIMCOutput->StreamOn(VIDIOC_STREAMON);
-+ m_FIMCCapture->StreamOn(VIDIOC_STREAMON);
-+ }
-+
-+ m_videoBuffer.iFlags = DVP_FLAG_ALLOCATED;
-+
-+ m_videoBuffer.color_range = 0;
-+ m_videoBuffer.color_matrix = 4;
-+
-+ m_videoBuffer.iDisplayWidth = resultVideoWidth;
-+ m_videoBuffer.iDisplayHeight = resultVideoHeight;
-+ m_videoBuffer.iWidth = resultVideoWidth;
-+ m_videoBuffer.iHeight = resultVideoHeight;
-+
-+ m_videoBuffer.data[0] = NULL;
-+ m_videoBuffer.data[1] = NULL;
-+ m_videoBuffer.data[2] = NULL;
-+ m_videoBuffer.data[3] = NULL;
-+
-+ m_videoBuffer.pts = DVD_NOPTS_VALUE;
-+ m_videoBuffer.dts = DVD_NOPTS_VALUE;
-+
-+ m_videoBuffer.iLineSize[0] = resultLineSize;
-+ m_videoBuffer.iLineSize[3] = 0;
-+
-+ if (finalFormat == V4L2_PIX_FMT_NV12M) {
-+ m_videoBuffer.format = RENDER_FMT_NV12;
-+ m_videoBuffer.iLineSize[1] = resultLineSize;
-+ m_videoBuffer.iLineSize[2] = 0;
-+ } else if (finalFormat == V4L2_PIX_FMT_YUV420M) {
-+ /*
-+ Due to BUG in MFC v8 (-XU3) firmware the Y plane of the picture has the right line size,
-+ but the U and V planes line sizes are actually halves of Y plane line size padded to 32
-+ This is pure workaround for -XU3 MFCv8 firmware "MFC v8.0, F/W: 14yy, 01mm, 13dd (D)
-+ Seems that only MPEG2 is affected
-+ */
-+ // Only on -XU3 there are no converter, but the output format can be YUV420
-+ // So this is the easiest way to distinguish -XU3 from -U3 with FIMC
-+ if (!m_iConverterHandle && m_hints.codec == AV_CODEC_ID_MPEG2VIDEO)
-+ resultLineSize = resultLineSize + (32 - resultLineSize%32);
-+
-+ m_videoBuffer.format = RENDER_FMT_YUV420P;
-+ m_videoBuffer.iLineSize[1] = resultLineSize >> 1;
-+ m_videoBuffer.iLineSize[2] = resultLineSize >> 1;
-+ }
-+
-+ m_BufferNowOnScreen->iIndex = -1;
-+ m_bCodecHealthy = true;
-+
-+ CLog::Log(LOGNOTICE, "%s::%s - MFC Setup succesfull (%dx%d, linesize %d, format 0x%x), start streaming", CLASSNAME, __func__, resultVideoWidth, resultVideoHeight, resultLineSize, finalFormat);
-+
-+ return true;
-+
-+}
-+
-+void CDVDVideoCodecMFC::SetDropState(bool bDrop) {
-+
-+ m_bDropPictures = bDrop;
-+ if (m_bDropPictures)
-+ m_videoBuffer.iFlags |= DVP_FLAG_DROPPED;
-+ else
-+ m_videoBuffer.iFlags &= ~DVP_FLAG_DROPPED;
-+
-+}
-+
-+int CDVDVideoCodecMFC::Decode(BYTE* pData, int iSize, double dts, double pts) {
-+
-+ if (m_hints.ptsinvalid)
-+ pts = DVD_NOPTS_VALUE;
-+
-+ //unsigned int dtime = XbmcThreads::SystemClockMillis();
-+ debug_log(LOGDEBUG, "%s::%s - input frame iSize %d, pts %lf, dts %lf", CLASSNAME, __func__, iSize, pts, dts);
-+
-+ if(pData) {
-+ int demuxer_bytes = iSize;
-+ uint8_t *demuxer_content = pData;
-+
-+ if(m_bVideoConvert) {
-+ m_converter.Convert(demuxer_content, demuxer_bytes);
-+ demuxer_bytes = m_converter.GetConvertSize();
-+ demuxer_content = m_converter.GetConvertBuffer();
-+ }
-+
-+ m_MFCOutput->Poll(1000/3); // Wait up to 0.3 of a second for buffer availability
-+ if (m_MFCOutput->GetBuffer(m_Buffer)) {
-+ debug_log(LOGDEBUG, "%s::%s - Got empty buffer %d from MFC Output, filling", CLASSNAME, __func__, m_Buffer->iIndex);
-+ m_Buffer->iBytesUsed[0] = demuxer_bytes;
-+ memcpy((uint8_t *)m_Buffer->cPlane[0], demuxer_content, m_Buffer->iBytesUsed[0]);
-+ long* longPts = (long*)&pts;
-+ m_Buffer->timeStamp.tv_sec = longPts[0];
-+ m_Buffer->timeStamp.tv_usec = longPts[1];
-+
-+ if (!m_MFCOutput->PushBuffer(m_Buffer)) {
-+ m_bCodecHealthy = false;
-+ return VC_FLUSHED; // MFC unrecoverable error, reset needed
-+ }
-+ } else {
-+ if (errno == EAGAIN)
-+ CLog::Log(LOGERROR, "%s::%s - MFC OUTPUT All buffers are queued and busy, no space for new frame to decode. Very broken situation. Current encoded frame will be lost", CLASSNAME, __func__);
-+ else {
-+ m_bCodecHealthy = false;
-+ return VC_FLUSHED; // MFC unrecoverable error, reset needed
-+ }
-+ }
-+ }
-+
-+ // Get a buffer from MFC Capture
-+ if (!m_MFCCapture->DequeueBuffer(m_Buffer)) {
-+ if (errno == EAGAIN)
-+ return VC_BUFFER;
-+ else
-+ return VC_ERROR;
-+ }
-+
-+ if (m_bDropPictures) {
-+
-+ CLog::Log(LOGWARNING, "%s::%s - Dropping frame with index %d", CLASSNAME, __func__, m_Buffer->iIndex);
-+ // Queue it back to MFC CAPTURE since the picture is dropped anyway
-+ m_MFCCapture->PushBuffer(m_Buffer);
-+ return VC_DROPPED | VC_BUFFER;
-+
-+ }
-+
-+ if (m_iConverterHandle) {
-+ // Push the buffer got from MFC Capture to FIMC Output (decoded from decoder to converter)
-+ if (!m_FIMCOutput->PushBuffer(m_Buffer)) {
-+ m_bCodecHealthy = false;
-+ return VC_FLUSHED; // FIMC unrecoverable error, reset needed
-+ }
-+ // Get a buffer from FIMC Capture
-+ if (!m_FIMCCapture->DequeueBuffer(m_Buffer)) {
-+ if (errno == EAGAIN)
-+ return VC_BUFFER;
-+ else
-+ return VC_ERROR;
-+ }
-+ }
-+
-+ // We got a new buffer to show, so we can enqeue back the buffer wich was on screen
-+ if (m_BufferNowOnScreen->iIndex > -1) {
-+ if (m_iConverterHandle)
-+ m_FIMCCapture->PushBuffer(m_BufferNowOnScreen);
-+ else
-+ m_MFCCapture->PushBuffer(m_BufferNowOnScreen);
-+ m_BufferNowOnScreen->iIndex = -1;
-+ }
-+
-+ long longPts[2] = { m_Buffer->timeStamp.tv_sec, m_Buffer->timeStamp.tv_usec };
-+ m_videoBuffer.data[0] = (BYTE*)m_Buffer->cPlane[0];
-+ m_videoBuffer.data[1] = (BYTE*)m_Buffer->cPlane[1];
-+ m_videoBuffer.data[2] = (BYTE*)m_Buffer->cPlane[2];
-+ m_videoBuffer.pts = *((double*)&longPts[0]);
-+
-+ std::swap(m_Buffer, m_BufferNowOnScreen);
-+
-+ if (m_iConverterHandle && m_FIMCOutput->DequeueBuffer(m_Buffer))
-+ m_MFCCapture->PushBuffer(m_Buffer);
-+
-+ //debug_log("Decode time: %d", XbmcThreads::SystemClockMillis() - dtime);
-+ // Picture is finally ready to be processed further and more info can be enqueued
-+ return VC_PICTURE | VC_BUFFER;
-+
-+}
-+
-+void CDVDVideoCodecMFC::Reset() {
-+
-+ if (m_bCodecHealthy) {
-+ CLog::Log(LOGDEBUG, "%s::%s - Codec Reset requested, but codec is healthy, doing soft-flush", CLASSNAME, __func__);
-+ m_MFCOutput->SoftRestart();
-+ m_MFCCapture->SoftRestart();
-+ if (!m_iConverterHandle)
-+ m_BufferNowOnScreen->iIndex = -1;
-+ } else {
-+ CLog::Log(LOGERROR, "%s::%s - Codec Reset. Reinitializing", CLASSNAME, __func__);
-+ CDVDCodecOptions options;
-+ // We need full MFC/FIMC reset with device reopening.
-+ // I wasn't able to reinitialize both IP's without fully closing and reopening them.
-+ // There are always some clips that cause MFC or FIMC go into state which cannot be reset without close/open
-+ Open(m_hints, options);
-+ }
-+
-+}
-+
-+bool CDVDVideoCodecMFC::GetPicture(DVDVideoPicture* pDvdVideoPicture) {
-+
-+ *pDvdVideoPicture = m_videoBuffer;
-+ debug_log(LOGDEBUG, "%s::%s - output frame pts %lf", CLASSNAME, __func__, m_videoBuffer.pts);
-+ return true;
-+
-+}
-+
-+bool CDVDVideoCodecMFC::ClearPicture(DVDVideoPicture* pDvdVideoPicture) {
-+
-+ return CDVDVideoCodec::ClearPicture(pDvdVideoPicture);
-+
-+}
-diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.h
-new file mode 100644
-index 0000000..679cf8c
---- /dev/null
-+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecMFC.h
-@@ -0,0 +1,64 @@
-+#pragma once
-+
-+#ifndef THIS_IS_NOT_XBMC
-+ #include "DVDVideoCodec.h"
-+ #include "DVDStreamInfo.h"
-+ #include "utils/BitstreamConverter.h"
-+ #include "xbmc/linux/LinuxV4l2Sink.h"
-+#else
-+ #include "xbmcstubs.h"
-+ #include "LinuxV4l2Sink.h"
-+#endif
-+
-+#ifndef V4L2_CAP_VIDEO_M2M_MPLANE
-+ #define V4L2_CAP_VIDEO_M2M_MPLANE 0x00004000
-+#endif
-+
-+#define BUFFER_SIZE 1048576 // Compressed frame size. 1080p mpeg4 10Mb/s can be >256k in size, so this is to make sure frame fits into the buffer
-+ // For very unknown reason lesser than 1Mb buffer causes MFC to corrupt its own setup, setting inapropriate values
-+#define INPUT_BUFFERS 3 // 3 input buffers. 2 is enough almost for everything, but on some heavy videos 3 makes a difference
-+#define OUTPUT_BUFFERS 3 // Triple buffering for smooth output
-+
-+#define memzero(x) memset(&(x), 0, sizeof (x))
-+
-+class CDVDVideoCodecMFC : public CDVDVideoCodec
-+{
-+public:
-+ CDVDVideoCodecMFC(CProcessInfo &processInfo);
-+ virtual ~CDVDVideoCodecMFC();
-+ virtual bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options);
-+ virtual void Dispose();
-+ virtual int Decode(BYTE* pData, int iSize, double dts, double pts);
-+ virtual void Reset();
-+ bool GetPictureCommon(DVDVideoPicture* pDvdVideoPicture);
-+ virtual bool GetPicture(DVDVideoPicture* pDvdVideoPicture);
-+ virtual bool ClearPicture(DVDVideoPicture* pDvdVideoPicture);
-+ virtual void SetDropState(bool bDrop);
-+ virtual const char* GetName() { return m_name.c_str(); }; // m_name is never changed after open
-+
-+protected:
-+ std::string m_name;
-+
-+ bool m_bCodecHealthy;
-+
-+ V4l2Device *m_iDecoderHandle;
-+ V4l2Device *m_iConverterHandle;
-+
-+ CLinuxV4l2Sink *m_MFCCapture;
-+ CLinuxV4l2Sink *m_MFCOutput;
-+ CLinuxV4l2Sink *m_FIMCCapture;
-+ CLinuxV4l2Sink *m_FIMCOutput;
-+
-+ V4l2SinkBuffer *m_Buffer;
-+ V4l2SinkBuffer *m_BufferNowOnScreen;
-+
-+ bool m_bVideoConvert;
-+ CDVDStreamInfo m_hints;
-+
-+ CBitstreamConverter m_converter;
-+ bool m_bDropPictures;
-+
-+ DVDVideoPicture m_videoBuffer;
-+
-+ bool OpenDevices();
-+};
-diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/Makefile.in b/xbmc/cores/VideoPlayer/DVDCodecs/Video/Makefile.in
-index 62d44ce..99a5556 100644
---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/Makefile.in
-+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/Makefile.in
-@@ -34,8 +34,11 @@ ifeq (@USE_MMAL@,1)
- SRCS += MMALCodec.cpp MMALFFmpeg.cpp
- endif
-
-+ifeq (@USE_MFC@,1)
-+SRCS += DVDVideoCodecMFC.cpp
-+endif
-+
- LIB=Video.a
-
- include @abs_top_srcdir@/Makefile.include
- -include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))
--
-diff --git a/xbmc/linux/LinuxV4l2Sink.cpp b/xbmc/linux/LinuxV4l2Sink.cpp
-new file mode 100644
-index 0000000..bd5201e
---- /dev/null
-+++ b/xbmc/linux/LinuxV4l2Sink.cpp
-@@ -0,0 +1,311 @@
-+#include "system.h"
-+
-+#ifndef THIS_IS_NOT_XBMC
-+ #if (defined HAVE_CONFIG_H) && (!defined WIN32)
-+ #include "config.h"
-+ #endif
-+
-+ #include "utils/log.h"
-+#endif
-+
-+#include
-+#include
-+#include
-+#include
-+#include
-+#include
-+#include
-+#include
-+
-+#include "LinuxV4l2Sink.h"
-+
-+#ifdef CLASSNAME
-+#undef CLASSNAME
-+#endif
-+#define CLASSNAME "CLinuxV4l2Sink"
-+
-+CLinuxV4l2Sink::CLinuxV4l2Sink(V4l2Device *device, enum v4l2_buf_type type) {
-+ CLog::Log(LOGDEBUG, "%s::%s - Creating Sink, Device %s, Type %d", CLASSNAME, __func__, device->name, type);
-+ m_Device = device;
-+ m_Type = type;
-+ m_NumBuffers = 0;
-+ m_NumPlanes = 0;
-+ m_Addresses = NULL;
-+ m_Buffers = NULL;
-+ m_Planes = NULL;
-+}
-+
-+CLinuxV4l2Sink::~CLinuxV4l2Sink() {
-+ CLog::Log(LOGDEBUG, "%s::%s - Destroying Sink, Device %s, Type %d", CLASSNAME, __func__, m_Device->name, m_Type);
-+
-+ StreamOn(VIDIOC_STREAMOFF);
-+
-+ if (m_Memory == V4L2_MEMORY_MMAP)
-+ for (int i = 0; i < m_NumBuffers*m_NumPlanes; i++)
-+ if(m_Addresses[i] != (unsigned long)MAP_FAILED)
-+ if (munmap((void *)m_Addresses[i], m_Planes[i].length) == 0)
-+ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Munmapped Plane %d size %u at 0x%lx", CLASSNAME, __func__, m_Device->name, i, m_Planes[i].length, m_Addresses[i]);
-+ if (m_Planes)
-+ delete[] m_Planes;
-+ if (m_Buffers)
-+ delete[] m_Buffers;
-+ if (m_Addresses)
-+ delete[] m_Addresses;
-+}
-+
-+// Init for MMAP buffers
-+bool CLinuxV4l2Sink::Init(int buffersCount = 0) {
-+ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Type %d, Init MMAP %d buffers", CLASSNAME, __func__, m_Device->name, m_Type, buffersCount);
-+ m_Memory = V4L2_MEMORY_MMAP;
-+
-+ struct v4l2_format format;
-+ if (!GetFormat(&format))
-+ return false;
-+
-+ if (buffersCount == 0 && m_Type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
-+ struct v4l2_control ctrl;
-+ ctrl.id = V4L2_CID_MIN_BUFFERS_FOR_CAPTURE;
-+ if (ioctl(m_Device->device, VIDIOC_G_CTRL, &ctrl)) {
-+ CLog::Log(LOGERROR, "%s::%s - Device %s, Type %d, Error getting number of buffers for capture (V4L2_CID_MIN_BUFFERS_FOR_CAPTURE VIDIOC_G_CTRL)", CLASSNAME, __func__, m_Device->name, m_Type);
-+ return false;
-+ }
-+ buffersCount = (int)(ctrl.value * 1.5); //Most of the time we need 50% more extra capture buffers than device reported would be enough
-+ }
-+
-+ m_NumBuffers = RequestBuffers(buffersCount);
-+ if (m_NumBuffers < 1)
-+ return false;
-+ m_Buffers = new v4l2_buffer[m_NumBuffers];
-+ m_Planes = new v4l2_plane[m_NumPlanes * m_NumBuffers];
-+ m_Addresses = new unsigned long[m_NumPlanes * m_NumBuffers];
-+ if (!QueryBuffers())
-+ return false;
-+ if (!MmapBuffers())
-+ return false;
-+ return true;
-+}
-+// Init for USERPTR buffers
-+bool CLinuxV4l2Sink::Init(CLinuxV4l2Sink *sink) {
-+ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Type %d, Init UserPTR", CLASSNAME, __func__, m_Device->name, m_Type);
-+ m_Memory = V4L2_MEMORY_USERPTR;
-+
-+ struct v4l2_format format;
-+ if (!GetFormat(&format))
-+ return false;
-+
-+ m_NumBuffers = sink->m_NumBuffers;
-+ m_NumBuffers = RequestBuffers(m_NumBuffers);
-+ if (m_NumBuffers < 1)
-+ return false;
-+ m_Buffers = new v4l2_buffer[m_NumBuffers];
-+ m_Planes = new v4l2_plane[m_NumPlanes * m_NumBuffers];
-+ m_Addresses = new unsigned long[m_NumPlanes * m_NumBuffers];
-+ if (!QueryBuffers())
-+ return false;
-+ for (int i = 0; i < m_NumPlanes * m_NumBuffers; i++) {
-+ m_Addresses[i] = sink->m_Addresses[i];
-+ m_Planes[i].m.userptr = m_Addresses[i];
-+ }
-+ return true;
-+}
-+
-+void CLinuxV4l2Sink::SoftRestart() {
-+ StreamOn(VIDIOC_STREAMOFF);
-+
-+ while (!iFreeBuffers.empty())
-+ iFreeBuffers.pop();
-+ for (int i = 0; i < m_NumBuffers; i++)
-+ iFreeBuffers.push(m_Buffers[i].index);
-+
-+ if (m_Type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
-+ QueueAll();
-+
-+ StreamOn(VIDIOC_STREAMON);
-+}
-+
-+bool CLinuxV4l2Sink::GetFormat(v4l2_format *format) {
-+ memset(format, 0, sizeof(struct v4l2_format));
-+ format->type = m_Type;
-+ if (ioctl(m_Device->device, VIDIOC_G_FMT, format)) {
-+ CLog::Log(LOGERROR, "%s::%s - Error getting sink format. Device %s, Type %d. (VIDIOC_G_FMT)", CLASSNAME, __func__, m_Device->name, m_Type);
-+ return false;
-+ }
-+ m_NumPlanes = format->fmt.pix_mp.num_planes;
-+ CLog::Log(LOGDEBUG, "%s::%s - G_FMT Device %s, Type %d format 0x%x (%dx%d), planes=%d, plane[0]=%d plane[1]=%d, plane[2]=%d", CLASSNAME, __func__, m_Device->name, format->type, format->fmt.pix_mp.pixelformat, format->fmt.pix_mp.width, format->fmt.pix_mp.height, format->fmt.pix_mp.num_planes, format->fmt.pix_mp.plane_fmt[0].sizeimage, format->fmt.pix_mp.plane_fmt[1].sizeimage, format->fmt.pix_mp.plane_fmt[2].sizeimage);
-+ return true;
-+}
-+
-+bool CLinuxV4l2Sink::SetFormat(v4l2_format *format) {
-+ format->type = m_Type;
-+ CLog::Log(LOGDEBUG, "%s::%s - S_FMT Device %s, Type %d format 0x%x (%dx%d), planes=%d, plane[0]=%d plane[1]=%d, plane[2]=%d", CLASSNAME, __func__, m_Device->name, format->type, format->fmt.pix_mp.pixelformat, format->fmt.pix_mp.width, format->fmt.pix_mp.height, format->fmt.pix_mp.num_planes, format->fmt.pix_mp.plane_fmt[0].sizeimage, format->fmt.pix_mp.plane_fmt[1].sizeimage, format->fmt.pix_mp.plane_fmt[2].sizeimage);
-+ if (ioctl(m_Device->device, VIDIOC_S_FMT, format)) {
-+ CLog::Log(LOGERROR, "%s::%s - Error setting sink format. Device %s, Type %d. (VIDIOC_G_FMT)", CLASSNAME, __func__, m_Device->name, m_Type);
-+ return false;
-+ }
-+ return true;
-+}
-+
-+bool CLinuxV4l2Sink::GetCrop(v4l2_crop *crop) {
-+ memset(crop, 0, sizeof(struct v4l2_crop));
-+ crop->type = m_Type;
-+ if (ioctl(m_Device->device, VIDIOC_G_CROP, crop)) {
-+ CLog::Log(LOGERROR, "%s::%s - Error getting sink crop. Device %s, Type %d. (VIDIOC_G_CROP)", CLASSNAME, __func__, m_Device->name, m_Type);
-+ return false;
-+ }
-+ CLog::Log(LOGDEBUG, "%s::%s - G_CROP Device %s, Type %d, crop (%dx%d)", CLASSNAME, __func__, m_Device->name, crop->type, crop->c.width, crop->c.height);
-+ return true;
-+}
-+
-+bool CLinuxV4l2Sink::SetCrop(v4l2_crop *crop) {
-+ crop->type = m_Type;
-+ CLog::Log(LOGDEBUG, "%s::%s - S_CROP Device %s, Type %d, crop (%dx%d)", CLASSNAME, __func__, m_Device->name, crop->type, crop->c.width, crop->c.height);
-+ if (ioctl(m_Device->device, VIDIOC_S_CROP, crop)) {
-+ CLog::Log(LOGERROR, "%s::%s - Error setting sink crop. Device %s, Type %d. (VIDIOC_G_CROP)", CLASSNAME, __func__, m_Device->name, m_Type);
-+ return false;
-+ }
-+ return true;
-+}
-+
-+int CLinuxV4l2Sink::RequestBuffers(int buffersCount) {
-+ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Type %d, Memory %d, RequestBuffers %d", CLASSNAME, __func__, m_Device->name, m_Type, m_Memory, buffersCount);
-+ struct v4l2_requestbuffers reqbuf;
-+ memset(&reqbuf, 0, sizeof(struct v4l2_requestbuffers));
-+ reqbuf.type = m_Type;
-+ reqbuf.memory = m_Memory;
-+ reqbuf.count = buffersCount;
-+
-+ if (ioctl(m_Device->device, VIDIOC_REQBUFS, &reqbuf)) {
-+ CLog::Log(LOGERROR, "%s::%s - Error requesting buffers. Device %s, Type %d, Memory %d. (VIDIOC_REQBUFS)", CLASSNAME, __func__, m_Device->name, m_Type, m_Memory);
-+ return V4L2_ERROR;
-+ }
-+
-+ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Type %d, Memory %d, Buffers allowed %d", CLASSNAME, __func__, m_Device->name, m_Type, m_Memory, reqbuf.count);
-+ return reqbuf.count;
-+}
-+
-+bool CLinuxV4l2Sink::QueryBuffers() {
-+ memset(m_Buffers, 0, m_NumBuffers * sizeof(struct v4l2_buffer));
-+ memset(m_Planes, 0, m_NumBuffers * m_NumPlanes * sizeof(struct v4l2_plane));
-+
-+ for(int i = 0; i < m_NumBuffers; i++) {
-+ m_Buffers[i].type = m_Type;
-+ m_Buffers[i].memory = m_Memory;
-+ m_Buffers[i].index = i;
-+ m_Buffers[i].m.planes = &m_Planes[i*m_NumPlanes];
-+ m_Buffers[i].length = m_NumPlanes;
-+
-+ if (ioctl(m_Device->device, VIDIOC_QUERYBUF, &m_Buffers[i])) {
-+ CLog::Log(LOGERROR, "%s::%s - Error querying buffers. Device %s, Type %d, Memory %d. (VIDIOC_QUERYBUF)", CLASSNAME, __func__, m_Device->name, m_Type, m_Memory);
-+ return false;
-+ }
-+
-+ iFreeBuffers.push(m_Buffers[i].index);
-+ }
-+ return true;
-+}
-+
-+bool CLinuxV4l2Sink::MmapBuffers() {
-+ for(int i = 0; i < m_NumBuffers * m_NumPlanes; i++) {
-+ if(m_Planes[i].length) {
-+ m_Addresses[i] = (unsigned long)mmap(NULL, m_Planes[i].length, PROT_READ | PROT_WRITE, MAP_SHARED, m_Device->device, m_Planes[i].m.mem_offset);
-+ if (m_Addresses[i] == (unsigned long)MAP_FAILED)
-+ return false;
-+ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Type %d, MMapped Plane %d at 0x%x to address 0x%lx", CLASSNAME, __func__, m_Device->name, m_Type, i, m_Planes[i].m.mem_offset, m_Addresses[i]);
-+ }
-+ }
-+ return true;
-+}
-+
-+bool CLinuxV4l2Sink::StreamOn(int state) {
-+ if(ioctl(m_Device->device, state, &m_Type)) {
-+ CLog::Log(LOGERROR, "%s::%s - Error setting device state to %d, Device %s, Type %d.", CLASSNAME, __func__, state, m_Device->name, m_Type);
-+ return false;
-+ }
-+ CLog::Log(LOGDEBUG, "%s::%s - Device %s, Type %d, %d", CLASSNAME, __func__, m_Device->name, m_Type, state);
-+ return true;
-+}
-+
-+bool CLinuxV4l2Sink::QueueBuffer(v4l2_buffer *buffer) {
-+ debug_log(LOGDEBUG, "%s::%s - Device %s, Type %d, Memory %d <- %d", CLASSNAME, __func__, m_Device->name, buffer->type, buffer->memory, buffer->index);
-+ if (ioctl(m_Device->device, VIDIOC_QBUF, buffer)) {
-+ CLog::Log(LOGERROR, "%s::%s - Error queueing buffer. Device %s, Type %d, Memory %d. Buffer %d, errno %d", CLASSNAME, __func__, m_Device->name, buffer->type, buffer->memory, buffer->index, errno);
-+ return false;
-+ }
-+ return true;
-+}
-+bool CLinuxV4l2Sink::DequeueBuffer(v4l2_buffer *buffer) {
-+ if (ioctl(m_Device->device, VIDIOC_DQBUF, buffer)) {
-+ if (errno != EAGAIN) CLog::Log(LOGERROR, "%s::%s - Error dequeueing buffer. Device %s, Type %d, Memory %d. Buffer %d, errno %d", CLASSNAME, __func__, m_Device->name, buffer->type, buffer->memory, buffer->index, errno);
-+ return false;
-+ }
-+ debug_log(LOGDEBUG, "%s::%s - Device %s, Type %d, Memory %d -> %d", CLASSNAME, __func__, m_Device->name, buffer->type, buffer->memory, buffer->index);
-+ return true;
-+}
-+
-+bool CLinuxV4l2Sink::DequeueBuffer(V4l2SinkBuffer *buffer) {
-+ struct v4l2_buffer buf;
-+ struct v4l2_plane planes[m_NumPlanes];
-+ memset(&planes, 0, sizeof(struct v4l2_plane) * m_NumPlanes);
-+ memset(&buf, 0, sizeof(struct v4l2_buffer));
-+ buf.type = m_Type;
-+ buf.memory = m_Memory;
-+ buf.m.planes = planes;
-+ buf.length = m_NumPlanes;
-+ if (!DequeueBuffer(&buf))
-+ return false;
-+
-+ buffer->iIndex = buf.index;
-+ buffer->timeStamp = buf.timestamp;
-+ for (int i = 0; i < m_NumPlanes; i++)
-+ buffer->cPlane[i] = (void *)m_Addresses[buffer->iIndex * m_NumPlanes + i];
-+ return true;
-+}
-+
-+bool CLinuxV4l2Sink::GetBuffer(V4l2SinkBuffer *buffer) {
-+ if (iFreeBuffers.empty()) {
-+ if (!DequeueBuffer(buffer))
-+ return false;
-+ } else {
-+ buffer->iIndex = iFreeBuffers.front();
-+ buffer->timeStamp = m_Buffers[buffer->iIndex].timestamp;
-+ iFreeBuffers.pop();
-+ for (int i = 0; i < m_NumPlanes; i++)
-+ buffer->cPlane[i] = (void *)m_Addresses[buffer->iIndex * m_NumPlanes + i];
-+ }
-+ return true;
-+}
-+
-+bool CLinuxV4l2Sink::PushBuffer(V4l2SinkBuffer *buffer) {
-+ if (m_Memory == V4L2_MEMORY_USERPTR)
-+ for (int i = 0; i < m_NumPlanes; i++)
-+ m_Buffers[buffer->iIndex].m.planes[i].m.userptr = (long unsigned int)buffer->cPlane[i];
-+
-+ if (m_Type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
-+ m_Buffers[buffer->iIndex].timestamp = buffer->timeStamp;
-+ m_Buffers[buffer->iIndex].flags |= V4L2_BUF_FLAG_TIMESTAMP_COPY;
-+ for (int i = 0; i < m_NumPlanes; i++)
-+ m_Buffers[buffer->iIndex].m.planes[i].bytesused = buffer->iBytesUsed[i];
-+ }
-+
-+ if (!QueueBuffer(&m_Buffers[buffer->iIndex]))
-+ return false;
-+ return true;
-+}
-+
-+int CLinuxV4l2Sink::Poll(int timeout) {
-+ struct pollfd p;
-+ p.fd = m_Device->device;
-+ p.events = POLLERR;
-+ (m_Type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) ? p.events |= POLLOUT : p.events |= POLLIN;
-+
-+ return poll(&p, 1, timeout);
-+}
-+
-+bool CLinuxV4l2Sink::QueueAll() {
-+ while (!iFreeBuffers.empty()) {
-+ if (!QueueBuffer(&m_Buffers[iFreeBuffers.front()]))
-+ return false;
-+ iFreeBuffers.pop();
-+ }
-+ return true;
-+}
-diff --git a/xbmc/linux/LinuxV4l2Sink.h b/xbmc/linux/LinuxV4l2Sink.h
-new file mode 100644
-index 0000000..d04d52d
---- /dev/null
-+++ b/xbmc/linux/LinuxV4l2Sink.h
-@@ -0,0 +1,71 @@
-+#pragma once
-+
-+#include
-+#include
-+#include
-+#include
-+
-+#ifndef V4L2_BUF_FLAG_TIMESTAMP_COPY
-+ #define V4L2_BUF_FLAG_TIMESTAMP_COPY 0x4000
-+#endif
-+
-+#define V4L2_ERROR -1
-+#define V4L2_BUSY 1
-+#define V4L2_READY 2
-+#define V4L2_OK 3
-+
-+#ifdef _DEBUG
-+ #define debug_log(...) CLog::Log(__VA_ARGS__)
-+#else
-+ #define debug_log(...)
-+#endif
-+
-+typedef struct V4l2Device
-+{
-+ int device;
-+ char name[32];
-+} V4l2Device;
-+
-+typedef struct V4l2SinkBuffer
-+{
-+ int iIndex;
-+ int iBytesUsed[4];
-+ void *cPlane[4];
-+ struct timeval timeStamp;
-+} V4l2SinkBuffer;
-+
-+class CLinuxV4l2Sink
-+{
-+public:
-+ CLinuxV4l2Sink(V4l2Device *device, enum v4l2_buf_type type);
-+ ~CLinuxV4l2Sink();
-+
-+ bool Init(int buffersCount);
-+ bool Init(CLinuxV4l2Sink *sink);
-+ void SoftRestart();
-+ bool GetFormat(v4l2_format *format);
-+ bool SetFormat(v4l2_format *format);
-+ bool GetCrop(v4l2_crop *crop);
-+ bool SetCrop(v4l2_crop *crop);
-+ bool GetBuffer(V4l2SinkBuffer* buffer);
-+ bool DequeueBuffer(V4l2SinkBuffer* buffer);
-+ bool PushBuffer(V4l2SinkBuffer* buffer);
-+ bool StreamOn(int state);
-+ bool QueueAll();
-+ int Poll(int timeout);
-+private:
-+ V4l2Device *m_Device;
-+ int m_NumPlanes;
-+ int m_NumBuffers;
-+ std::queue iFreeBuffers;
-+ enum v4l2_memory m_Memory;
-+ enum v4l2_buf_type m_Type;
-+ v4l2_buffer *m_Buffers;
-+ v4l2_plane *m_Planes;
-+ unsigned long *m_Addresses;
-+ int RequestBuffers(int buffersCount);
-+ bool QueryBuffers();
-+ bool MmapBuffers();
-+ bool QueueBuffer(v4l2_buffer *buffer);
-+ bool DequeueBuffer(v4l2_buffer *buffer);
-+};
-diff --git a/xbmc/linux/Makefile.in b/xbmc/linux/Makefile.in
-index 0cf90d1..ff2c2dc 100644
---- a/xbmc/linux/Makefile.in
-+++ b/xbmc/linux/Makefile.in
-@@ -12,6 +12,7 @@ SRCS += XFileUtils.cpp
- SRCS += XHandle.cpp
- SRCS += XMemUtils.cpp
- SRCS += XTimeUtils.cpp
-+SRCS += LinuxV4l2Sink.cpp
-
- SRCS += RBP.cpp
-
diff --git a/xbmc/utils/AMLUtils.cpp b/xbmc/utils/AMLUtils.cpp
-index 4ae45f3..f4911119 100644
+index 80fb453..0f0fef0 100644
--- a/xbmc/utils/AMLUtils.cpp
+++ b/xbmc/utils/AMLUtils.cpp
-@@ -79,7 +79,7 @@ bool aml_wired_present()
+@@ -78,7 +78,7 @@ bool aml_wired_present()
}
bool aml_permissions()
@@ -1470,7 +208,7 @@ index 4ae45f3..f4911119 100644
if (!aml_present())
return false;
-@@ -210,7 +210,8 @@ bool aml_support_h264_4k2k()
+@@ -209,7 +209,8 @@ bool aml_support_h264_4k2k()
void aml_set_audio_passthrough(bool passthrough)
{
@@ -1480,7 +218,7 @@ index 4ae45f3..f4911119 100644
}
void aml_probe_hdmi_audio()
-@@ -228,7 +229,7 @@ void aml_probe_hdmi_audio()
+@@ -227,7 +228,7 @@ void aml_probe_hdmi_audio()
{
char valstr[1024] = {0};
@@ -1489,7 +227,7 @@ index 4ae45f3..f4911119 100644
valstr[strlen(valstr)] = '\0';
close(fd);
-@@ -363,6 +364,60 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res)
+@@ -362,6 +363,60 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res)
res->fRefreshRate = 50;
res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE;
}
@@ -1550,7 +288,7 @@ index 4ae45f3..f4911119 100644
else if (StringUtils::EqualsNoCase(fromMode, "720p") || StringUtils::EqualsNoCase(fromMode, "720p60hz"))
{
res->iWidth = 1280;
-@@ -408,6 +463,24 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res)
+@@ -407,6 +462,24 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res)
res->fRefreshRate = 24;
res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE;
}
@@ -1575,7 +313,7 @@ index 4ae45f3..f4911119 100644
else if (StringUtils::EqualsNoCase(fromMode, "1080p30hz"))
{
res->iWidth = 1920;
-@@ -516,7 +589,7 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res)
+@@ -515,7 +588,7 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res)
res->fRefreshRate = 30;
res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE;
}
@@ -1584,7 +322,7 @@ index 4ae45f3..f4911119 100644
{
res->iWidth = 1920;
res->iHeight= 1080;
-@@ -525,7 +598,16 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res)
+@@ -524,7 +597,16 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res)
res->fRefreshRate = 50;
res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE;
}
@@ -1602,17 +340,17 @@ index 4ae45f3..f4911119 100644
{
res->iWidth = 1920;
res->iHeight= 1080;
-@@ -550,4 +632,3 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res)
+@@ -549,4 +631,3 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res)
return res->iWidth > 0 && res->iHeight> 0;
}
-
diff --git a/xbmc/utils/CPUInfo.cpp b/xbmc/utils/CPUInfo.cpp
-index a2a775f..f1f9751 100644
+index 6377d35..b50b288 100644
--- a/xbmc/utils/CPUInfo.cpp
+++ b/xbmc/utils/CPUInfo.cpp
-@@ -117,7 +117,7 @@ CCPUInfo::CCPUInfo(void)
- #if defined(TARGET_DARWIN)
+@@ -120,7 +120,7 @@ CCPUInfo::CCPUInfo(void)
+
size_t len = 4;
std::string cpuVendor;
-
@@ -1620,7 +358,7 @@ index a2a775f..f1f9751 100644
// The number of cores.
if (sysctlbyname("hw.activecpu", &m_cpuCount, &len, NULL, 0) == -1)
m_cpuCount = 1;
-@@ -138,7 +138,7 @@ CCPUInfo::CCPUInfo(void)
+@@ -141,7 +141,7 @@ CCPUInfo::CCPUInfo(void)
len = 512;
if (sysctlbyname("machdep.cpu.vendor", &buffer, &len, NULL, 0) == 0)
cpuVendor = buffer;
@@ -1629,7 +367,7 @@ index a2a775f..f1f9751 100644
#endif
// Go through each core.
for (int i=0; isecond.m_fSpeed);
else
-@@ -587,7 +587,7 @@ bool CCPUInfo::getTemperature(CTemperature& temperature)
+@@ -597,7 +597,7 @@ bool CCPUInfo::getTemperature(CTemperature& temperature)
{
int value = 0;
char scale = 0;
@@ -1659,7 +397,7 @@ index a2a775f..f1f9751 100644
#ifdef TARGET_POSIX
#if defined(TARGET_DARWIN_OSX)
value = SMCGetTemperature(SMC_KEY_CPU_TEMP);
-@@ -616,23 +616,24 @@ bool CCPUInfo::getTemperature(CTemperature& temperature)
+@@ -626,23 +626,24 @@ bool CCPUInfo::getTemperature(CTemperature& temperature)
// procfs is deprecated in the linux kernel, we should move away from
// using it for temperature data. It doesn't seem that sysfs has a
// general enough interface to bother implementing ATM.
@@ -1688,7 +426,7 @@ index a2a775f..f1f9751 100644
#endif
#endif // TARGET_POSIX
-@@ -642,7 +643,7 @@ bool CCPUInfo::getTemperature(CTemperature& temperature)
+@@ -652,7 +653,7 @@ bool CCPUInfo::getTemperature(CTemperature& temperature)
temperature = CTemperature::CreateFromFahrenheit(value);
else
return false;
@@ -1697,7 +435,7 @@ index a2a775f..f1f9751 100644
return true;
}
-@@ -697,7 +698,7 @@ bool CCPUInfo::readProcStat(unsigned long long& user, unsigned long long& nice,
+@@ -707,7 +708,7 @@ bool CCPUInfo::readProcStat(unsigned long long& user, unsigned long long& nice,
const LONGLONG deltaTotal = coreTotal - curCore.m_total,
deltaIdle = coreIdle - curCore.m_idle;
const double load = (double(deltaTotal - deltaIdle) * 100.0) / double(deltaTotal);
@@ -1706,19 +444,6 @@ index a2a775f..f1f9751 100644
// win32 has some problems with calculation of load if load close to zero
curCore.m_fPct = (load < 0) ? 0 : load;
if (load >= 0 || deltaTotal > 5 * 10 * 1000 * 1000) // do not update (smooth) values for 5 seconds on negative loads
-diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp
-index ee85585..7261f78 100644
---- a/xbmc/windowing/X11/WinSystemX11.cpp
-+++ b/xbmc/windowing/X11/WinSystemX11.cpp
-@@ -203,7 +203,7 @@ bool CWinSystemX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bl
- mode.hz = CDisplaySettings::GetInstance().GetResolutionInfo(RES_DESKTOP).fRefreshRate;
- mode.id = CDisplaySettings::GetInstance().GetResolutionInfo(RES_DESKTOP).strId;
- }
--
-+
- XMode currmode = g_xrandr.GetCurrentMode(out.name);
- if (!currmode.name.empty())
- {
diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp
index 88cd385..cc62734 100644
--- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp
@@ -2000,723 +725,6 @@ index cfb33ca..bdb08b6 100644
std::string m_framebuffer_name;
};
-diff --git a/xbmc/windowing/egl/EGLNativeTypeFbdev.cpp b/xbmc/windowing/egl/EGLNativeTypeFbdev.cpp
-new file mode 100644
-index 0000000..5c25eb6
---- /dev/null
-+++ b/xbmc/windowing/egl/EGLNativeTypeFbdev.cpp
-@@ -0,0 +1,183 @@
-+/*
-+ * Copyright (C) 2011-2012 Team XBMC
-+ * http://www.xbmc.org
-+ *
-+ * This Program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2, or (at your option)
-+ * any later version.
-+ *
-+ * This Program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with XBMC; see the file COPYING. If not, see
-+ * .
-+ *
-+ */
-+#include
-+#include "EGLNativeTypeFbdev.h"
-+#include "utils/log.h"
-+#include
-+#include
-+#include
-+#include "utils/StringUtils.h"
-+#include "guilib/gui3d.h"
-+#include
-+
-+#include
-+
-+#include "utils/StringUtils.h"
-+
-+#ifdef CLASSNAME
-+#undef CLASSNAME
-+#endif
-+#define CLASSNAME "CEGLNativeTypeFbdev"
-+
-+CEGLNativeTypeFbdev::CEGLNativeTypeFbdev()
-+{
-+ m_iFBHandle = -1;
-+ m_nativeWindow = NULL;
-+ m_nativeDisplay = NULL;
-+}
-+
-+CEGLNativeTypeFbdev::~CEGLNativeTypeFbdev()
-+{
-+}
-+
-+bool CEGLNativeTypeFbdev::CheckCompatibility()
-+{
-+ m_iFBHandle = open("/dev/fb0", O_RDWR, 0);
-+ if(m_iFBHandle < 0)
-+ return false;
-+
-+ vinfo = new fb_var_screeninfo();
-+ if(ioctl(m_iFBHandle, FBIOGET_VSCREENINFO, vinfo) == -1)
-+ return false;
-+
-+ CLog::Log(LOGNOTICE, "%s::%s FBDev device: %d, info.xres %d info.yres %d info.upper_margin %d info.lower_margin %d info.pixclock %d",
-+ CLASSNAME, __func__, m_iFBHandle, vinfo->xres, vinfo->yres, vinfo->upper_margin, vinfo->lower_margin, vinfo->pixclock);
-+
-+ finfo = new fb_fix_screeninfo();
-+ if(ioctl(m_iFBHandle, FBIOGET_FSCREENINFO, finfo) == -1)
-+ return false;
-+
-+ return true;
-+}
-+
-+void CEGLNativeTypeFbdev::Initialize()
-+{
-+ return;
-+}
-+void CEGLNativeTypeFbdev::Destroy()
-+{
-+ return;
-+}
-+
-+bool CEGLNativeTypeFbdev::CreateNativeDisplay()
-+{
-+ m_nativeDisplay = EGL_DEFAULT_DISPLAY;
-+ return true;
-+}
-+
-+bool CEGLNativeTypeFbdev::CreateNativeWindow()
-+{
-+ fbdev_window *nativeWindow = new fbdev_window;
-+ if (!nativeWindow)
-+ return false;
-+
-+ nativeWindow->width = vinfo->xres;
-+ nativeWindow->height = vinfo->yres;
-+ m_nativeWindow = nativeWindow;
-+ return true;
-+}
-+
-+bool CEGLNativeTypeFbdev::GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const
-+{
-+ if (!nativeDisplay)
-+ return false;
-+ *nativeDisplay = (XBNativeDisplayType*) &m_nativeDisplay;
-+ return true;
-+}
-+
-+bool CEGLNativeTypeFbdev::GetNativeWindow(XBNativeWindowType **nativeWindow) const
-+{
-+ if (!nativeWindow)
-+ return false;
-+ *nativeWindow = (XBNativeWindowType*) &m_nativeWindow;
-+ return true;
-+}
-+
-+bool CEGLNativeTypeFbdev::DestroyNativeDisplay()
-+{
-+ return true;
-+}
-+
-+bool CEGLNativeTypeFbdev::DestroyNativeWindow()
-+{
-+ free(m_nativeWindow);
-+ return true;
-+}
-+
-+bool CEGLNativeTypeFbdev::GetNativeResolution(RESOLUTION_INFO *res) const
-+{
-+ res->iWidth = vinfo->xres;
-+ res->iHeight = vinfo->yres;
-+ res->fRefreshRate = 60;
-+ res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE;
-+ res->iScreen = 0;
-+ res->bFullScreen = true;
-+ res->iSubtitles = (int)(0.965 * res->iHeight);
-+ res->fPixelRatio = 1.0f;
-+ res->iScreenWidth = res->iWidth;
-+ res->iScreenHeight = res->iHeight;
-+ res->strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate, res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
-+
-+ CLog::Log(LOGNOTICE, "Current resolution: %s", res->strMode.c_str());
-+ return true;
-+}
-+
-+bool CEGLNativeTypeFbdev::SetNativeResolution(const RESOLUTION_INFO &res)
-+{
-+
-+ vinfo->activate = FB_ACTIVATE_NOW;
-+
-+ if (ioctl(m_iFBHandle, FBIOPUT_VSCREENINFO, vinfo) == -1)
-+ {
-+ CLog::Log(LOGERROR, "%s::%s - FBIOPUT_VSCREENINFO error", CLASSNAME, __func__);
-+ return false;
-+ }
-+ if (ioctl(m_iFBHandle, FBIOPAN_DISPLAY, vinfo) == -1)
-+ {
-+ CLog::Log(LOGERROR, "%s::%s - FBIOPAN_DISPLAY error", CLASSNAME, __func__);
-+ return false;
-+ }
-+
-+ CLog::Log(LOGNOTICE, "%s::%s width %d height %d refresh %f", CLASSNAME, __func__, res.iScreenWidth, res.iScreenHeight, res.fRefreshRate);
-+
-+ return true;
-+}
-+
-+bool CEGLNativeTypeFbdev::ProbeResolutions(std::vector &resolutions)
-+{
-+ RESOLUTION_INFO res;
-+ if (GetNativeResolution(&res) && res.iWidth > 1 && res.iHeight > 1)
-+ {
-+ resolutions.push_back(res);
-+ return true;
-+ }
-+ return false;
-+}
-+
-+bool CEGLNativeTypeFbdev::GetPreferredResolution(RESOLUTION_INFO *res) const
-+{
-+ GetNativeResolution(res);
-+ return true;
-+}
-+
-+bool CEGLNativeTypeFbdev::ShowWindow(bool show)
-+{
-+ return false;
-+}
-diff --git a/xbmc/windowing/egl/EGLNativeTypeFbdev.h b/xbmc/windowing/egl/EGLNativeTypeFbdev.h
-new file mode 100644
-index 0000000..04e7023
---- /dev/null
-+++ b/xbmc/windowing/egl/EGLNativeTypeFbdev.h
-@@ -0,0 +1,68 @@
-+#pragma once
-+
-+/*
-+ * Copyright (C) 2011-2012 Team XBMC
-+ * http://www.xbmc.org
-+ *
-+ * This Program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2, or (at your option)
-+ * any later version.
-+ *
-+ * This Program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with XBMC; see the file COPYING. If not, see
-+ * .
-+ *
-+ */
-+
-+#include "EGLNativeType.h"
-+#include
-+#include
-+
-+#ifndef _FBDEV_WINDOW_H_
-+// Define it right here, since some platforms doesn't has fbdev_window.h at all.
-+// This will not make it fail on these platforms badly, since it will fail softly anyway on some other init steps.
-+#define _FBDEV_WINDOW_H_
-+typedef struct fbdev_window
-+{
-+ unsigned short width;
-+ unsigned short height;
-+} fbdev_window;
-+#endif
-+
-+class CEGLNativeTypeFbdev : public CEGLNativeType
-+{
-+public:
-+ CEGLNativeTypeFbdev();
-+ virtual ~CEGLNativeTypeFbdev();
-+ virtual std::string GetNativeName() const { return "FBDev"; };
-+ virtual bool CheckCompatibility();
-+ virtual void Initialize();
-+ virtual void Destroy();
-+ virtual int GetQuirks() { return EGL_QUIRK_NONE; };
-+
-+ virtual bool CreateNativeDisplay();
-+ virtual bool CreateNativeWindow();
-+ virtual bool GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const;
-+ virtual bool GetNativeWindow(XBNativeWindowType **nativeWindow) const;
-+
-+ virtual bool DestroyNativeWindow();
-+ virtual bool DestroyNativeDisplay();
-+
-+ virtual bool GetNativeResolution(RESOLUTION_INFO *res) const;
-+ virtual bool SetNativeResolution(const RESOLUTION_INFO &res);
-+ virtual bool ProbeResolutions(std::vector &resolutions);
-+ virtual bool GetPreferredResolution(RESOLUTION_INFO *res) const;
-+
-+ virtual bool ShowWindow(bool show);
-+
-+protected:
-+ int m_iFBHandle;
-+ fb_var_screeninfo *vinfo;
-+ fb_fix_screeninfo *finfo;
-+};
-diff --git a/xbmc/windowing/egl/EGLNativeTypeHybris.cpp b/xbmc/windowing/egl/EGLNativeTypeHybris.cpp
-new file mode 100644
-index 0000000..767946e
---- /dev/null
-+++ b/xbmc/windowing/egl/EGLNativeTypeHybris.cpp
-@@ -0,0 +1,279 @@
-+/*
-+ * Copyright (C) 2011-2012 Team XBMC
-+ * http://www.xbmc.org
-+ *
-+ * This Program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2, or (at your option)
-+ * any later version.
-+ *
-+ * This Program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with XBMC; see the file COPYING. If not, see
-+ * .
-+ *
-+ */
-+#if defined(TARGET_HYBRIS)
-+#include
-+#include
-+#include
-+#endif
-+
-+#include "system.h"
-+#include
-+#include "EGLNativeTypeHybris.h"
-+#include "utils/log.h"
-+#include "guilib/gui3d.h"
-+
-+#include "utils/StringUtils.h"
-+
-+HWComposer::HWComposer(unsigned int width,
-+ unsigned int height,
-+ unsigned int format,
-+ hwc_composer_device_1_t *device,
-+ hwc_display_contents_1_t **mList,
-+ hwc_layer_1_t *layer)
-+ : HWComposerNativeWindow(width, height, format)
-+{
-+ fblayer = layer;
-+ hwcdevice = device;
-+ mlist = mList;
-+}
-+
-+void HWComposer::present(HWComposerNativeWindowBuffer *buffer)
-+{
-+ int oldretire = mlist[0]->retireFenceFd;
-+ mlist[0]->retireFenceFd = -1;
-+ fblayer->handle = buffer->handle;
-+ fblayer->acquireFenceFd = getFenceBufferFd(buffer);
-+ fblayer->releaseFenceFd = -1;
-+ int err = hwcdevice->prepare(hwcdevice, HWC_NUM_DISPLAY_TYPES, mlist);
-+ assert(err == 0);
-+
-+ err = hwcdevice->set(hwcdevice, HWC_NUM_DISPLAY_TYPES, mlist);
-+ assert(err == 0);
-+ setFenceBufferFd(buffer, fblayer->releaseFenceFd);
-+
-+ if (oldretire != -1)
-+ {
-+ sync_wait(oldretire, -1);
-+ close(oldretire);
-+ }
-+}
-+
-+CEGLNativeTypeHybris::CEGLNativeTypeHybris()
-+#if defined(TARGET_HYBRIS)
-+ : m_hwcModule(NULL), m_bufferList(NULL), m_hwcDevicePtr(NULL)
-+{
-+ m_nativeWindow = NULL;
-+ m_hwNativeWindow = NULL;
-+ m_swNativeWindow = NULL;
-+}
-+#else
-+{
-+}
-+#endif
-+
-+CEGLNativeTypeHybris::~CEGLNativeTypeHybris()
-+{
-+}
-+
-+bool CEGLNativeTypeHybris::CheckCompatibility()
-+{
-+#if defined(TARGET_HYBRIS)
-+ if(hw_get_module(HWC_HARDWARE_MODULE_ID, (const hw_module_t **) &m_hwcModule))
-+ {
-+ return false;
-+ }
-+
-+ if(hwc_open_1(m_hwcModule, &m_hwcDevicePtr))
-+ {
-+ return false;
-+ }
-+
-+ m_hwcDevicePtr->blank(m_hwcDevicePtr, 0, 0);
-+ return true;
-+#else
-+ return false;
-+#endif
-+}
-+
-+void CEGLNativeTypeHybris::Initialize()
-+{
-+}
-+
-+void CEGLNativeTypeHybris::Destroy()
-+{
-+ return;
-+}
-+
-+bool CEGLNativeTypeHybris::CreateNativeDisplay()
-+{
-+ m_nativeDisplay = EGL_DEFAULT_DISPLAY;
-+ return true;
-+}
-+
-+bool CEGLNativeTypeHybris::CreateNativeWindow()
-+{
-+#if defined(TARGET_HYBRIS)
-+ RESOLUTION_INFO res;
-+ if (!GetNativeResolution(&res))
-+ return false;
-+
-+ size_t size = sizeof(hwc_display_contents_1_t) + 2 * sizeof(hwc_layer_1_t);
-+ hwc_display_contents_1_t *list = (hwc_display_contents_1_t *) malloc(size);
-+ m_bufferList = (hwc_display_contents_1_t **) malloc(HWC_NUM_DISPLAY_TYPES * sizeof(hwc_display_contents_1_t *));
-+ const hwc_rect_t r = { 0, 0, res.iWidth, res.iHeight };
-+
-+ for (int counter = 0; counter < HWC_NUM_DISPLAY_TYPES; counter++)
-+ m_bufferList[counter] = list;
-+
-+ hwc_layer_1_t *layer;
-+
-+ layer = &list->hwLayers[0];
-+ memset(layer, 0, sizeof(hwc_layer_1_t));
-+ layer->compositionType = HWC_FRAMEBUFFER;
-+ layer->hints = 0;
-+ layer->flags = 0;
-+ layer->handle = 0;
-+ layer->transform = 0;
-+ layer->blending = HWC_BLENDING_NONE;
-+ layer->sourceCrop = r;
-+ layer->displayFrame = r;
-+ layer->visibleRegionScreen.numRects = 1;
-+ layer->visibleRegionScreen.rects = &layer->displayFrame;
-+ layer->acquireFenceFd = -1;
-+ layer->releaseFenceFd = -1;
-+
-+ layer = &list->hwLayers[1];
-+ memset(layer, 0, sizeof(hwc_layer_1_t));
-+ layer->compositionType = HWC_FRAMEBUFFER_TARGET;
-+ layer->hints = 0;
-+ layer->flags = 0;
-+ layer->handle = 0;
-+ layer->transform = 0;
-+ layer->blending = HWC_BLENDING_NONE;
-+ layer->sourceCrop = r;
-+ layer->displayFrame = r;
-+ layer->visibleRegionScreen.numRects = 1;
-+ layer->visibleRegionScreen.rects = &layer->displayFrame;
-+ layer->acquireFenceFd = -1;
-+ layer->releaseFenceFd = -1;
-+
-+ list->retireFenceFd = -1;
-+ list->flags = HWC_GEOMETRY_CHANGED;
-+ list->numHwLayers = 2;
-+
-+ m_hwNativeWindow = new HWComposer(res.iWidth, res.iHeight, HAL_PIXEL_FORMAT_RGBA_8888, m_hwcDevicePtr, m_bufferList, &list->hwLayers[1]);
-+ if (m_hwNativeWindow == NULL)
-+ {
-+ CLog::Log(LOGERROR, "HWComposer native window failed!");
-+ return false;
-+ }
-+ m_swNativeWindow = (static_cast (m_hwNativeWindow));
-+
-+ return true;
-+#else
-+ return false;
-+#endif
-+}
-+
-+bool CEGLNativeTypeHybris::GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const
-+{
-+ if (!nativeDisplay)
-+ return false;
-+
-+ *nativeDisplay = (XBNativeDisplayType*) &m_nativeDisplay;
-+
-+ return true;
-+}
-+
-+bool CEGLNativeTypeHybris::GetNativeWindow(XBNativeWindowType **nativeWindow) const
-+{
-+ if (!nativeWindow)
-+ return false;
-+
-+#if defined(TARGET_HYBRIS)
-+ *nativeWindow = (XBNativeWindowType*) &m_swNativeWindow;
-+ return (m_swNativeWindow != NULL);
-+#else
-+ return false;
-+#endif
-+}
-+
-+bool CEGLNativeTypeHybris::DestroyNativeDisplay()
-+{
-+ return true;
-+}
-+
-+bool CEGLNativeTypeHybris::DestroyNativeWindow()
-+{
-+ m_nativeWindow = NULL;
-+ return true;
-+}
-+
-+bool CEGLNativeTypeHybris::GetNativeResolution(RESOLUTION_INFO *res) const
-+{
-+#if defined(TARGET_HYBRIS)
-+ uint32_t configs[5];
-+ size_t numConfigs = 5;
-+
-+ int err = m_hwcDevicePtr->getDisplayConfigs(m_hwcDevicePtr, 0, configs, &numConfigs);
-+ if (err) {
-+ CLog::Log(LOGERROR, "getDisplayConfigs failed!");
-+ return false;
-+ }
-+ int32_t attr_values[3];
-+ uint32_t attributes[] = { HWC_DISPLAY_WIDTH, HWC_DISPLAY_HEIGHT, HWC_DISPLAY_VSYNC_PERIOD, HWC_DISPLAY_NO_ATTRIBUTE };
-+
-+ m_hwcDevicePtr->getDisplayAttributes(m_hwcDevicePtr, 0, configs[0], attributes, attr_values);
-+
-+ res->iWidth = attr_values[0];
-+ res->iHeight = attr_values[1];
-+ res->fRefreshRate = 1000000000 / attr_values[2];
-+
-+ res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE;
-+ res->iScreen = 0;
-+ res->bFullScreen = true;
-+ res->iSubtitles = (int)(0.965 * res->iHeight);
-+ res->fPixelRatio = 1.0f;
-+ res->iScreenWidth = res->iWidth;
-+ res->iScreenHeight = res->iHeight;
-+ res->strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
-+ res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
-+ CLog::Log(LOGNOTICE,"Current resolution: %s\n",res->strMode.c_str());
-+ return true;
-+#endif
-+}
-+
-+bool CEGLNativeTypeHybris::SetNativeResolution(const RESOLUTION_INFO &res)
-+{
-+ return false;
-+}
-+
-+bool CEGLNativeTypeHybris::ProbeResolutions(std::vector &resolutions)
-+{
-+ RESOLUTION_INFO res;
-+ if (GetNativeResolution(&res) && res.iWidth > 1 && res.iHeight > 1)
-+ {
-+ resolutions.push_back(res);
-+ return true;
-+ }
-+ return false;
-+}
-+
-+bool CEGLNativeTypeHybris::GetPreferredResolution(RESOLUTION_INFO *res) const
-+{
-+ if (GetNativeResolution(res))
-+ return true;
-+ return false;
-+}
-+
-+bool CEGLNativeTypeHybris::ShowWindow(bool show)
-+{
-+ return true;
-+}
-diff --git a/xbmc/windowing/egl/EGLNativeTypeHybris.h b/xbmc/windowing/egl/EGLNativeTypeHybris.h
-new file mode 100644
-index 0000000..73aa14d
---- /dev/null
-+++ b/xbmc/windowing/egl/EGLNativeTypeHybris.h
-@@ -0,0 +1,77 @@
-+#pragma once
-+
-+/*
-+ * Copyright (C) 2011-2012 Team XBMC
-+ * http://www.xbmc.org
-+ *
-+ * This Program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2, or (at your option)
-+ * any later version.
-+ *
-+ * This Program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with XBMC; see the file COPYING. If not, see
-+ * .
-+ *
-+ */
-+
-+#if defined(TARGET_HYBRIS)
-+#include
-+#include
-+#include
-+#endif
-+
-+#include "EGLNativeType.h"
-+#include "threads/Thread.h"
-+
-+class HWComposer : public HWComposerNativeWindow
-+{
-+ private:
-+ hwc_layer_1_t *fblayer;
-+ hwc_composer_device_1_t *hwcdevice;
-+ hwc_display_contents_1_t **mlist;
-+ protected:
-+ void present(HWComposerNativeWindowBuffer *buffer);
-+ public:
-+ HWComposer(unsigned int width, unsigned int height, unsigned int format, hwc_composer_device_1_t *device, hwc_display_contents_1_t **mList, hwc_layer_1_t *layer);
-+};
-+
-+class CEGLNativeTypeHybris : public CEGLNativeType
-+{
-+public:
-+ CEGLNativeTypeHybris();
-+ virtual ~CEGLNativeTypeHybris();
-+ virtual std::string GetNativeName() const { return "hybris"; };
-+ virtual bool CheckCompatibility();
-+ virtual void Initialize();
-+ virtual void Destroy();
-+ virtual int GetQuirks() { return 0; };
-+
-+ virtual bool CreateNativeDisplay();
-+ virtual bool CreateNativeWindow();
-+ virtual bool GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const;
-+ virtual bool GetNativeWindow(XBNativeWindowType **nativeWindow) const;
-+
-+ virtual bool DestroyNativeWindow();
-+ virtual bool DestroyNativeDisplay();
-+
-+ virtual bool GetNativeResolution(RESOLUTION_INFO *res) const;
-+ virtual bool SetNativeResolution(const RESOLUTION_INFO &res);
-+ virtual bool ProbeResolutions(std::vector &resolutions);
-+ virtual bool GetPreferredResolution(RESOLUTION_INFO *res) const;
-+
-+ virtual bool ShowWindow(bool show);
-+#if defined(TARGET_HYBRIS)
-+private:
-+ hw_module_t *m_hwcModule;
-+ hwc_display_contents_1_t **m_bufferList;
-+ hwc_composer_device_1_t *m_hwcDevicePtr;
-+ HWComposerNativeWindow *m_hwNativeWindow;
-+ ANativeWindow *m_swNativeWindow;
-+#endif
-+};
-diff --git a/xbmc/windowing/egl/EGLWrapper.cpp b/xbmc/windowing/egl/EGLWrapper.cpp
-index 0074027..526a9fe 100644
---- a/xbmc/windowing/egl/EGLWrapper.cpp
-+++ b/xbmc/windowing/egl/EGLWrapper.cpp
-@@ -34,6 +34,10 @@
- #include "EGLNativeTypeIMX.h"
- #endif
- #include "EGLNativeTypeAmlogic.h"
-+#ifdef HAS_HYBRIS
-+#include "EGLNativeTypeHybris.h"
-+#endif
-+#include "EGLNativeTypeFbdev.h"
- #include "EGLWrapper.h"
-
- #define CheckError() m_result = eglGetError(); if(m_result != EGL_SUCCESS) CLog::Log(LOGERROR, "EGL error in %s: %x",__FUNCTION__, m_result);
-@@ -94,11 +98,14 @@ bool CEGLWrapper::Initialize(const std::string &implementation)
- (nativeGuess = CreateEGLNativeType(implementation)) ||
- #endif
- #if defined(TARGET_RASPBERRY_PI)
-- (nativeGuess = CreateEGLNativeType(implementation))
-+ (nativeGuess = CreateEGLNativeType(implementation)) ||
- #elif defined(HAS_IMXVPU)
-- (nativeGuess = CreateEGLNativeType(implementation))
-+ (nativeGuess = CreateEGLNativeType(implementation)) ||
-+#elif defined(HAS_HYBRIS)
-+ (nativeGuess = CreateEGLNativeType(implementation)) ||
- #else
-- (nativeGuess = CreateEGLNativeType(implementation))
-+ (nativeGuess = CreateEGLNativeType(implementation)) ||
-+ (nativeGuess = CreateEGLNativeType(implementation))
- #endif
- )
- {
-@@ -420,4 +427,3 @@ bool CEGLWrapper::SurfaceAttrib(EGLDisplay display, EGLSurface surface, EGLint a
- return eglSurfaceAttrib(display, surface, attribute, value);
- }
- #endif
--
-diff --git a/xbmc/windowing/egl/Makefile.in b/xbmc/windowing/egl/Makefile.in
-index 3754233..c863504 100644
---- a/xbmc/windowing/egl/Makefile.in
-+++ b/xbmc/windowing/egl/Makefile.in
-@@ -13,6 +13,10 @@ endif
- ifeq (@USE_IMXVPU@,1)
- SRCS+= EGLNativeTypeIMX.cpp
- endif
-+ifeq (@USE_HYBRIS@,1)
-+SRCS+= EGLNativeTypeHybris.cpp
-+endif
-+SRCS+= EGLNativeTypeFbdev.cpp
- SRCS+= EGLWrapper.cpp
-
- LIB = windowing_egl.a
+--
+1.9.1
-From b8dec29c61200cc84d4f7bc5cb1fe195daa63a2b Mon Sep 17 00:00:00 2001
-From: Owersun
-Date: Tue, 10 May 2016 22:18:03 +0200
-Subject: [PATCH 2/2] Changes missing for native compilation
-
----
- m4/xbmc_arch.m4 | 8 +-------
- 1 file changed, 1 insertion(+), 7 deletions(-)
-
-diff --git a/m4/xbmc_arch.m4 b/m4/xbmc_arch.m4
-index 07f1770..b8511d5 100644
---- a/m4/xbmc_arch.m4
-+++ b/m4/xbmc_arch.m4
-@@ -23,10 +23,7 @@ case $build in
- powerpc64-*-linux-gnu*|powerpc64-*-linux-uclibc*)
- AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC64")
- ;;
-- arm*-*-linux-gnu*|arm*-*-linux-uclibc*)
-- AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
-- ;;
-- aarch64-*-linux-gnu*)
-+ arm*-*-linux-gnu*|arm*-*-linux-uclibc*|aarch64*-*-linux-gnu*|aarch64*-*-linux-uclibc*)
- AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
- ;;
- *)
-@@ -66,9 +63,6 @@ case $host in
- arm*-*-linux-gnu*|arm*-*-linux-uclibc*|aarch64*-*-linux-gnu*|aarch64*-*-linux-uclibc*)
- AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
- ;;
-- aarch64-*-linux-gnu*)
-- AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
-- ;;
- mips*-*-linux-gnu*|mips*-*-linux-uclibc*)
- AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
- ;;
diff --git a/projects/RPi/patches/kodi/kodi-001-backport.patch b/projects/RPi/patches/kodi/kodi-001-backport.patch
index baba26d40c..ba7a822daf 100644
--- a/projects/RPi/patches/kodi/kodi-001-backport.patch
+++ b/projects/RPi/patches/kodi/kodi-001-backport.patch
@@ -1,7 +1,7 @@
-From 864954f03895aa990ca985273fef53d962ec0cbf Mon Sep 17 00:00:00 2001
+From 4d1fbbaeba1a6ff1d77df125f9415160c8922380 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Tue, 5 May 2015 17:27:39 +0100
-Subject: [PATCH 01/61] build: Allow installed links to be overwritten
+Subject: [PATCH 01/65] build: Allow installed links to be overwritten
---
tools/depends/target/Makefile | 72 +++++++++++++++++++--------------------
@@ -9,7 +9,7 @@ Subject: [PATCH 01/61] build: Allow installed links to be overwritten
2 files changed, 54 insertions(+), 54 deletions(-)
diff --git a/tools/depends/target/Makefile b/tools/depends/target/Makefile
-index 2f0c83141034374ec5742a96a282391405ec8125..89f24641fd341336545fbdc6024e88eaacc805e7 100644
+index 16c82d3cb06e20adf27e7f429eebda6b7efbdf8c..8dcfe26cbc29ebe47cdb212712ae64745f8a009e 100644
--- a/tools/depends/target/Makefile
+++ b/tools/depends/target/Makefile
@@ -129,41 +129,41 @@ distclean::
@@ -137,10 +137,10 @@ index e5cb842d9f61578efe5df95dfa3a938cf5346663..3ddba3cefb1ca785f7a17c72f42aacbb
+ [ -f $(ADDON_DEPS_DIR)/lib/libm.so ] || ln -sf /usr/lib/$(HOST)/libm.so $(ADDON_DEPS_DIR)/lib/
-From fd2ced63da994a66ab5c060880009f5e9bab652d Mon Sep 17 00:00:00 2001
+From 205dfaa46a1cfab63ed27111be95b9760f70d21f Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Mon, 7 Apr 2014 18:19:32 +0100
-Subject: [PATCH 02/61] [rbp/omxplayer] When opening a stream don't try to
+Subject: [PATCH 02/65] [rbp/omxplayer] When opening a stream don't try to
update gui so often
---
@@ -164,10 +164,10 @@ index 8ea5161637b4e66ddd222859f058521dbc8922b9..811019a39a10acc21b83f0b0c70d5500
dialog->ProcessRenderLoop(false);
if (allowCancel && dialog->IsCanceled())
-From c8caccf7ae230790e5b81b496d664a331c7fbead Mon Sep 17 00:00:00 2001
+From a20bc025b57d5452fd8ab7cb377f5eb6ec0da65b Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Sat, 8 Mar 2014 15:36:06 +0000
-Subject: [PATCH 03/61] [hifiberry] Hack: force it to be recognised as IEC958
+Subject: [PATCH 03/65] [hifiberry] Hack: force it to be recognised as IEC958
capable to enable passthrough options
---
@@ -190,10 +190,10 @@ index 6a9066b2dbe8d505d636b3638c1d35c7c8a698ed..9c6ac5d4cc9bf21b2d48619cc6fb5d27
info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI")
{
-From bf2fbaf79191cbfd18b2b6eff7749d1d28cfdc83 Mon Sep 17 00:00:00 2001
+From 2ca2c495ca734baef60d1e47b0653b72dac024f7 Mon Sep 17 00:00:00 2001
From: Ben Avison
Date: Thu, 1 May 2014 16:28:39 +0100
-Subject: [PATCH 04/61] Improved file buffering in CArchive
+Subject: [PATCH 04/65] Improved file buffering in CArchive
Even though memcpy is typically inlined by the compiler into byte/word loads
and stores (at least for release builds), the frequency with which 1, 2 and 4
@@ -253,10 +253,10 @@ index 23cac2759fb10d532da56fa75c5528c5589e9010..89d31d4db1afa7340ed8cd51a7a9fa7a
}
-From ccdbbe94567517e4cb3bc3904d99893affa5132d Mon Sep 17 00:00:00 2001
+From 99e26b48a0e18ac68c48112ff46675300c00473e Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Sun, 10 Aug 2014 16:45:16 +0100
-Subject: [PATCH 05/61] filesystem: Make support of browsing into archives
+Subject: [PATCH 05/65] filesystem: Make support of browsing into archives
optional
The ability to browse, scan and play content in archives can cause problems on low powered/low memory devices.
@@ -275,10 +275,10 @@ We'll let people who don't use archives disable it manually
4 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
-index 26915cb15fdd589d54c11b1582ef18dc71f38bb2..62bd967a284b0b93820ef75bf8d76c3e78ee889d 100644
+index c89e91bdb0a275cf804df799c2d0a261cf086785..f5ca2397d9169c7dcd28a9f9bc882dc3d8490571 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
-@@ -19173,6 +19173,15 @@ msgstr ""
+@@ -19276,6 +19276,15 @@ msgstr ""
#: system/settings/rbp.xml
msgctxt "#38010"
msgid "GPU accelerated"
@@ -295,10 +295,10 @@ index 26915cb15fdd589d54c11b1582ef18dc71f38bb2..62bd967a284b0b93820ef75bf8d76c3e
#. Setting #38011 "Show All Items entry"
diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml
-index 265f3982ceee40ece6e3c5073a0e92902f482212..cf15fcbdb860608b2658b310614e1cd78cc94a18 100644
+index 62e9c8ed2199f8c57a640b06b0216ee4c8f0ca1e..e8b0d3d472b02fd161a4b51e957b9129e3cb9792 100644
--- a/system/settings/rbp.xml
+++ b/system/settings/rbp.xml
-@@ -99,4 +99,15 @@
+@@ -102,4 +102,15 @@
@@ -315,10 +315,10 @@ index 265f3982ceee40ece6e3c5073a0e92902f482212..cf15fcbdb860608b2658b310614e1cd7
+
diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp
-index f1754ef7343daebd51e6bc892b49fd5c1773cd73..b73ecebb203b11e2e7f1bdc8731fafbaf7f070fa 100644
+index 618e7dc98b0f474f93684f6aec266a9033feee9c..22a61d0177d4165a37ddef1ca2dd9fe972a3b47b 100644
--- a/xbmc/Util.cpp
+++ b/xbmc/Util.cpp
-@@ -1778,7 +1778,7 @@ void CUtil::ScanPathsForAssociatedItems(const std::string& videoName,
+@@ -1855,7 +1855,7 @@ void CUtil::ScanPathsForAssociatedItems(const std::string& videoName,
URIUtils::RemoveExtension(strCandidate);
if (StringUtils::StartsWithNoCase(strCandidate, videoName))
{
@@ -327,7 +327,7 @@ index f1754ef7343daebd51e6bc892b49fd5c1773cd73..b73ecebb203b11e2e7f1bdc8731fafba
CUtil::ScanArchiveForAssociatedItems(pItem->GetPath(), "", item_exts, associatedFiles);
else
{
-@@ -1788,7 +1788,7 @@ void CUtil::ScanPathsForAssociatedItems(const std::string& videoName,
+@@ -1865,7 +1865,7 @@ void CUtil::ScanPathsForAssociatedItems(const std::string& videoName,
}
else
{
@@ -366,10 +366,10 @@ index a0fd0a9011e71f4af1535110c696b6ea5c4b37db..688b71a297c7c617c6764bfe6be157d7
{
CURL xbtUrl = URIUtils::CreateArchivePath("xbt", url);
-From d6eca1347e4e38394f6016def44d98a8fcb0fe61 Mon Sep 17 00:00:00 2001
+From f7bedecdb5bc79b6f082c925eaa305b682ac218b Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Mon, 27 Oct 2014 13:06:57 +0000
-Subject: [PATCH 06/61] [rbp] Make cachemembuffersize default depend on memory
+Subject: [PATCH 06/65] [rbp] Make cachemembuffersize default depend on memory
size
---
@@ -471,10 +471,10 @@ index 6beebe0c9c11b0bab63e5abbd4aea2d62bb05f0c..03f566d3ee4eab690d2236b773908026
}
-From 76c3457a5abf0177d379ed4054938bb73379cc4d Mon Sep 17 00:00:00 2001
+From 85725ac945cbdc5a8e970d54ea6beda5b7bc9641 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Fri, 30 May 2014 14:58:43 +0100
-Subject: [PATCH 07/61] [settings] Experiment: Report DESKTOP resolution in
+Subject: [PATCH 07/65] [settings] Experiment: Report DESKTOP resolution in
video settings
---
@@ -496,10 +496,10 @@ index c1cca7efdd5d119b07308b947c569911f2a9bdc9..e03f3c8ef21ba824c0d707042e5a735a
StringUtils::Format("%dx%d%s", resolution->width, resolution->height,
ModeFlagsToString(resolution->flags, false).c_str()),
-From 645bd37c7f9472f391282c5bee72b4d3378dd979 Mon Sep 17 00:00:00 2001
+From 58d65ba07bc8254b433b1eec4f3ecf2aac895bd3 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Wed, 24 Sep 2014 23:13:52 +0100
-Subject: [PATCH 08/61] [audio] Add settings option to boost centre channel
+Subject: [PATCH 08/65] [audio] Add settings option to boost centre channel
when downmixing
This allows a dB volume increase to be added to centre channel.
@@ -517,10 +517,10 @@ Should work with Pi Sink (dvdplayer/paplayer) and omxplayer
5 files changed, 46 insertions(+)
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
-index 62bd967a284b0b93820ef75bf8d76c3e78ee889d..dd36abb9f58c1ea2c6e5591c1b43f138434aad1c 100644
+index f5ca2397d9169c7dcd28a9f9bc882dc3d8490571..4ff4c60c7a867e9d0a40adc0711287c8be324b8e 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
-@@ -19347,6 +19347,21 @@ msgstr ""
+@@ -19450,6 +19450,21 @@ msgstr ""
#empty strings from id 38043 to 38099
@@ -543,10 +543,10 @@ index 62bd967a284b0b93820ef75bf8d76c3e78ee889d..dd36abb9f58c1ea2c6e5591c1b43f138
#: system/settings/settings.xml
msgctxt "#38100"
diff --git a/system/settings/settings.xml b/system/settings/settings.xml
-index 3ab531e9d4fa6c1305a833ba58aaf2a6c44ce310..f7a0ded4e39f1836c7a7cf19a3160d12a30e1a75 100644
+index ca912cd996d3236161ba7934da32d22df6b065ab..4197841131914f98cd29f5fd7b9ec3cedd2d01da 100644
--- a/system/settings/settings.xml
+++ b/system/settings/settings.xml
-@@ -2268,6 +2268,18 @@
+@@ -2366,6 +2366,18 @@
@@ -625,10 +625,10 @@ index f16b822ed7b4aebe18b5d339b3f71ee66e97c23f..993d4b33a294e88c2c004b7943895ba5
// stereo upmix
if (upmix && m_src_channels == 2 && m_dst_channels > 2)
-From c092967c5512c2632533991f6cc25778ad2cb0af Mon Sep 17 00:00:00 2001
+From b3ec4c120398f86571ca6539a0b46911e3e03849 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Mon, 27 Oct 2014 15:23:51 +0000
-Subject: [PATCH 09/61] [rbp] Default extract thumbnails to false
+Subject: [PATCH 09/65] [rbp] Default extract thumbnails to false
It can take 80 seconds for a single file on a Pi. It can cause crashes with out-of-memory errors.
It genereates a lot of support issues. Best to default to disabled and let users enable it if they must
@@ -637,7 +637,7 @@ It genereates a lot of support issues. Best to default to disabled and let users
1 file changed, 6 insertions(+)
diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml
-index cf15fcbdb860608b2658b310614e1cd78cc94a18..770c628a15304856504676af82d46d57c97b86b8 100644
+index e8b0d3d472b02fd161a4b51e957b9129e3cb9792..289dc55ec41aa44848519a05f8ee1ccc72740085 100644
--- a/system/settings/rbp.xml
+++ b/system/settings/rbp.xml
@@ -43,6 +43,12 @@
@@ -654,10 +654,10 @@ index cf15fcbdb860608b2658b310614e1cd78cc94a18..770c628a15304856504676af82d46d57
-From 880e3ee7b784c9deddb66df4d80927699059c199 Mon Sep 17 00:00:00 2001
+From bdb8c0811d58ebe6de69db82e9003456a677a059 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Thu, 27 Nov 2014 16:31:56 +0000
-Subject: [PATCH 10/61] [languageinvoker] Reduce priority of python threads
+Subject: [PATCH 10/65] [languageinvoker] Reduce priority of python threads
---
xbmc/interfaces/generic/LanguageInvokerThread.cpp | 5 +++++
@@ -680,10 +680,10 @@ index fcdd0633f30cd9595ae6cc4ed293677cdcb1f422..16f0c8916b5e0a9e90973d194cf2ebd1
}
-From de8e9ca53ad455e535526f9973fb775fbc349d6e Mon Sep 17 00:00:00 2001
+From eec3216e64389a02e22180a626d8291db2b949ea Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Sat, 14 Dec 2013 16:55:05 +0000
-Subject: [PATCH 11/61] logging: Add microsecond timer to log messages
+Subject: [PATCH 11/65] logging: Add microsecond timer to log messages
---
xbmc/utils/log.cpp | 15 +++++++++++++--
@@ -734,10 +734,10 @@ index 3443f1293d86018830269ed992c90a4e69c0430c..d330320842243df6f5ff256e608dddfa
levelNames[logLevel]) + strData;
-From 9ca4200de7da40564dd08b6e1d955df3045f27d3 Mon Sep 17 00:00:00 2001
+From 7c900d5144d7a912db7360b92eff90702fa3f366 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Sat, 29 Nov 2014 15:25:16 +0000
-Subject: [PATCH 12/61] [rbp] hack: wait for splash to complete before changing
+Subject: [PATCH 12/65] [rbp] hack: wait for splash to complete before changing
hdmi mode
---
@@ -821,22 +821,22 @@ index ee297700f8583dbb15cbe53baf8c887b36bd2ea0..bbe501d40c5e101f1d0d64b8b59b1928
RENDER_STEREO_MODE stereo_mode = g_graphicsContext.GetStereoMode();
-From c86a562cac08f054425e46f2c814b4f2f0d25a3a Mon Sep 17 00:00:00 2001
+From b3107b218150f1923a0b973cc85b589182ac8df7 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Thu, 11 Dec 2014 17:00:57 +0000
-Subject: [PATCH 13/61] Fix for UI not showing both extractflags and
+Subject: [PATCH 13/65] Fix for UI not showing both extractflags and
extractthumb
---
- addons/resource.language.en_gb/resources/strings.po | 9 ++++++---
- system/settings/settings.xml | 4 ++--
- 2 files changed, 8 insertions(+), 5 deletions(-)
+ addons/resource.language.en_gb/resources/strings.po | 10 +++++++---
+ system/settings/settings.xml | 4 ++--
+ 2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
-index dd36abb9f58c1ea2c6e5591c1b43f138434aad1c..3208dad8988fba4bce7687861037274a42ffd21f 100644
+index 4ff4c60c7a867e9d0a40adc0711287c8be324b8e..f4abad73fa75574576383fca3956f9f4ecb4c94c 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
-@@ -12385,7 +12385,7 @@ msgstr ""
+@@ -12430,7 +12430,7 @@ msgstr ""
#: system/settings/settings.xml
msgctxt "#20433"
@@ -845,7 +845,7 @@ index dd36abb9f58c1ea2c6e5591c1b43f138434aad1c..3208dad8988fba4bce7687861037274a
msgstr ""
#: xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp
-@@ -16821,7 +16821,7 @@ msgstr ""
+@@ -16912,7 +16912,7 @@ msgstr ""
#. Description of setting with label #20433 "Extract thumbnails and video information"
#: system/settings/settings.xml
msgctxt "#36178"
@@ -854,7 +854,7 @@ index dd36abb9f58c1ea2c6e5591c1b43f138434aad1c..3208dad8988fba4bce7687861037274a
msgstr ""
#. Description of setting with label #20419 "Replace file names with library titles"
-@@ -16833,7 +16833,7 @@ msgstr ""
+@@ -16924,7 +16924,7 @@ msgstr ""
#. Description of setting with label #20433 "Extract thumbnails and video information"
#: system/settings/settings.xml
msgctxt "#36180"
@@ -863,18 +863,19 @@ index dd36abb9f58c1ea2c6e5591c1b43f138434aad1c..3208dad8988fba4bce7687861037274a
msgstr ""
#: system/settings/settings.xml
-@@ -19480,3 +19480,6 @@ msgctxt "#39007"
+@@ -19582,3 +19582,7 @@ msgstr ""
+ msgctxt "#39007"
msgid "This provides access to where picture sources can be added and otherwise managed."
msgstr ""
-
++
+msgctxt "#38190"
+msgid "Extract thumbnails from video files"
+msgstr ""
diff --git a/system/settings/settings.xml b/system/settings/settings.xml
-index f7a0ded4e39f1836c7a7cf19a3160d12a30e1a75..88b67c1869246037e81fb3efbe293f9fee37d25e 100644
+index 4197841131914f98cd29f5fd7b9ec3cedd2d01da..dc7144ac8756fb1af9d7f3bb56c0b471f0ae3f9b 100644
--- a/system/settings/settings.xml
+++ b/system/settings/settings.xml
-@@ -972,8 +972,8 @@
+@@ -977,8 +977,8 @@
true
@@ -886,10 +887,10 @@ index f7a0ded4e39f1836c7a7cf19a3160d12a30e1a75..88b67c1869246037e81fb3efbe293f9f
-From 589e105736d4d65fea6812e1346317ed7afe518d Mon Sep 17 00:00:00 2001
+From a7bb3ad02267746ae24fdcedcc29ccae4620cfb2 Mon Sep 17 00:00:00 2001
From: anaconda
Date: Thu, 11 Sep 2014 21:30:43 +0200
-Subject: [PATCH 14/61] Disable autoscrolling while on screensaver and while
+Subject: [PATCH 14/65] Disable autoscrolling while on screensaver and while
opening streams.
---
@@ -902,10 +903,10 @@ Subject: [PATCH 14/61] Disable autoscrolling while on screensaver and while
6 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
-index def6ed703b25087c4f61f71acb3fbb5257b8c44b..4fffdfad5296775161989468cb8197f892c204e1 100644
+index b3d5c77bb51c6a67964a695ce81efb42ea76a7bf..9b29a8cdb796db3bb6a3419c493aadb914f60956 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
-@@ -5188,3 +5188,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const
+@@ -5200,3 +5200,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const
return false;
}
@@ -1020,10 +1021,10 @@ index d7bc1c5ba6067af9a460589920367288c640a915..ac766293f1c47c7f145cb46f6b152144
if (m_lastRenderTime)
m_autoScrollDelayTime += currentTime - m_lastRenderTime;
-From 6dfdde4dd31580ab361d73b46342ca78c2f1abce Mon Sep 17 00:00:00 2001
+From 3ced3be4ca859b1b236c9c1fae2098751b95a18e Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Sat, 13 Dec 2014 18:35:20 +0000
-Subject: [PATCH 15/61] [demuxer] Avoid memcpy on every demuxer packet
+Subject: [PATCH 15/65] [demuxer] Avoid memcpy on every demuxer packet
Avoids an unnecessary memcpy on every demuxer packet which for
high bitrate videos can be significant.
@@ -1034,10 +1035,10 @@ high bitrate videos can be significant.
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
-index 929f9879e28d6a496ddf713081dcece2cc773a48..bfdec6ffdb882465bb7a4b9db9bd6561963726de 100644
+index c99916652866bfd4cc60271507a43444492f8eb8..1069710e3702aa6fc39e5fb550d0cabcf525ada6 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
-@@ -851,7 +851,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
+@@ -854,7 +854,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
{
if(m_pkt.pkt.stream_index == (int)m_pFormatContext->programs[m_program]->stream_index[i])
{
@@ -1046,7 +1047,7 @@ index 929f9879e28d6a496ddf713081dcece2cc773a48..bfdec6ffdb882465bb7a4b9db9bd6561
break;
}
}
-@@ -860,7 +860,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
+@@ -863,7 +863,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
bReturnEmpty = true;
}
else
@@ -1055,7 +1056,7 @@ index 929f9879e28d6a496ddf713081dcece2cc773a48..bfdec6ffdb882465bb7a4b9db9bd6561
}
else
bReturnEmpty = true;
-@@ -890,9 +890,13 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
+@@ -893,9 +893,13 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
// copy contents into our own packet
pPacket->iSize = m_pkt.pkt.size;
@@ -1071,7 +1072,7 @@ index 929f9879e28d6a496ddf713081dcece2cc773a48..bfdec6ffdb882465bb7a4b9db9bd6561
pPacket->pts = ConvertTimestamp(m_pkt.pkt.pts, stream->time_base.den, stream->time_base.num);
pPacket->dts = ConvertTimestamp(m_pkt.pkt.dts, stream->time_base.den, stream->time_base.num);
-@@ -946,7 +950,10 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
+@@ -949,7 +953,10 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
pPacket->iStreamId = m_pkt.pkt.stream_index;
}
m_pkt.result = -1;
@@ -1123,10 +1124,10 @@ index df0f35bd49c65b302de4ccd110d859e8b881ea5f..b4b591ae4c4dd4fb0b36d4d00fedca96
}
catch(...) {
-From 83e6d7254eb884e2aaf47445f58b1e96223c93d2 Mon Sep 17 00:00:00 2001
+From 5fa52de0fa29ad2bed6c5dcd2faf129a8a61729c Mon Sep 17 00:00:00 2001
From: anaconda
Date: Wed, 25 Feb 2015 18:22:21 +0100
-Subject: [PATCH 16/61] Load OSD dialogs on startup.
+Subject: [PATCH 16/65] Load OSD dialogs on startup.
Fixes skipped frames the first time they're loaded in memory on less powered
devices, like a Raspberry Pi, when using DVDPlayer.
@@ -1141,7 +1142,7 @@ See http://forum.kodi.tv/showthread.php?tid=211501&pid=1938811#pid1938811
6 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp
-index 65071639e216a37d7b3cec119f1fe573718f44b6..52966fce668bbd1c58aa7e76feb5a2dbf93b1ab7 100644
+index 1beb8560a1030f6198b22f5d9c082a27dd85d8a8..ca7c90b0c4a7fc34a31fe6dcf787b8980d28df71 100644
--- a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp
+++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp
@@ -49,6 +49,7 @@ using namespace KODI::MESSAGING;
@@ -1206,7 +1207,7 @@ index e498e1fd476d9ab5300bb00bc39946a22cfd93cb..a6648d016b07e2eb3e52f8d927697cc5
CGUIDialogVideoOSD::~CGUIDialogVideoOSD(void)
diff --git a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp
-index f9bc12da1aea3ea0926fefff93856cdd4328cb2f..ee6984c469023878b1fad18a29056b114d04fdcc 100644
+index 5adebf41429241be1224167e9b52262e0a446889..fa9772a45da94208b9ece407966a898fc5013a0f 100644
--- a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp
+++ b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp
@@ -65,7 +65,9 @@
@@ -1221,10 +1222,10 @@ index f9bc12da1aea3ea0926fefff93856cdd4328cb2f..ee6984c469023878b1fad18a29056b11
CGUIDialogVideoSettings::~CGUIDialogVideoSettings()
{ }
-From b4180c7279375d6ef4c38535c6fa0b09b9cea66d Mon Sep 17 00:00:00 2001
+From 74963aa37bbea2fad5a631bbca4bb4bf7bc410dd Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Tue, 14 Apr 2015 20:51:14 +0100
-Subject: [PATCH 17/61] [gui] Also limit GUI updates when in non full-screen
+Subject: [PATCH 17/65] [gui] Also limit GUI updates when in non full-screen
video mode
---
@@ -1232,10 +1233,10 @@ Subject: [PATCH 17/61] [gui] Also limit GUI updates when in non full-screen
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
-index 4fffdfad5296775161989468cb8197f892c204e1..a98acfce3442f896250fad8003fb5991d1bf0bdc 100644
+index 9b29a8cdb796db3bb6a3419c493aadb914f60956..d39017434d819ca3190161c34a5dc70bb6a2022b 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
-@@ -2743,7 +2743,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI)
+@@ -2756,7 +2756,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI)
#if defined(TARGET_RASPBERRY_PI) || defined(HAS_IMXVPU)
// This code reduces rendering fps of the GUI layer when playing videos in fullscreen mode
// it makes only sense on architectures with multiple layers
@@ -1244,7 +1245,7 @@ index 4fffdfad5296775161989468cb8197f892c204e1..a98acfce3442f896250fad8003fb5991
fps = CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_LIMITGUIUPDATE);
#endif
-@@ -2756,6 +2756,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI)
+@@ -2769,6 +2769,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI)
{
if (!m_skipGuiRender)
g_windowManager.Process(CTimeUtils::GetFrameTime());
@@ -1254,10 +1255,10 @@ index 4fffdfad5296775161989468cb8197f892c204e1..a98acfce3442f896250fad8003fb5991
g_windowManager.FrameMove();
}
-From 7a8d7fb1bc28289af5f658441709c03bec33d092 Mon Sep 17 00:00:00 2001
+From 10844c301cea6e5f07a55bf91599b9c094d318f6 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Tue, 5 May 2015 23:58:06 +0100
-Subject: [PATCH 18/61] [screensaver] Leave GUI contents available for
+Subject: [PATCH 18/65] [screensaver] Leave GUI contents available for
screensaver
---
@@ -1265,10 +1266,10 @@ Subject: [PATCH 18/61] [screensaver] Leave GUI contents available for
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp
-index 82b8b32eee8ab95555bbee462b36bfbf819f39b8..14b51568a959afa5648b844a2a87efbb57b5249a 100644
+index 227f323083b0fb9cee3b576bfcc7b51d5e27ac10..6994f16290ca3ec9da124fbf1cfa21716333855d 100644
--- a/xbmc/guilib/GUIWindowManager.cpp
+++ b/xbmc/guilib/GUIWindowManager.cpp
-@@ -792,7 +792,16 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const std::vector
+@@ -795,7 +795,16 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const std::vector
int currentWindow = GetActiveWindow();
CGUIWindow *pWindow = GetWindow(currentWindow);
if (pWindow)
@@ -1287,10 +1288,10 @@ index 82b8b32eee8ab95555bbee462b36bfbf819f39b8..14b51568a959afa5648b844a2a87efbb
// Add window to the history list (we must do this before we activate it,
-From 3baa1a6cc514b6ceeed4c10fe72d725395b28a06 Mon Sep 17 00:00:00 2001
+From cca5e7cfe42db8cdb67457a41b7ef3dcd7b721ae Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Sat, 6 Jun 2015 18:43:57 +0100
-Subject: [PATCH 19/61] ffmpeg: Automatic switch to software decode for GMC
+Subject: [PATCH 19/65] ffmpeg: Automatic switch to software decode for GMC
with more than one warp point
---
@@ -1439,10 +1440,10 @@ index 03fdf6efa072219d55cac21b7f7923ffc6c00e17..e3a32aebfe59016b43cd7c2b304921b5
class CDemuxStreamAudio : public CDemuxStream
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
-index bfdec6ffdb882465bb7a4b9db9bd6561963726de..c8ba4f869e844550e47ab9084aad1c59ba10f53a 100644
+index 1069710e3702aa6fc39e5fb550d0cabcf525ada6..87674a3e45b0991447c817499524c09a3b595ca4 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
-@@ -1323,7 +1323,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx)
+@@ -1326,7 +1326,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx)
if (!stereoMode.empty())
st->stereo_mode = stereoMode;
@@ -1518,10 +1519,10 @@ index f135d423c0ca76fd70e79ae5b7d035f0cb79fc75..d9b576bc46055fdab1c134e5f2c63cd4
else if ((hint.codec == AV_CODEC_ID_VC1 || hint.codec == AV_CODEC_ID_WMV3) && g_RBP.GetCodecWvc1())
supported = true;
-From 43dc7e2beea8ce8abebc3ae26ac7ac31263949ee Mon Sep 17 00:00:00 2001
+From 3d13e28a7a009dae14e1ed72d94c4192e7bee0fe Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Thu, 10 Mar 2016 17:56:11 +0000
-Subject: [PATCH 20/61] [rbp] HW mouse pointer
+Subject: [PATCH 20/65] [rbp] HW mouse pointer
Updating the mouse point provokes a complete screen update which can make it feel laggy
and results in high cpu.
@@ -1536,7 +1537,7 @@ Render the mouse with an overlay to avoid redrawing the normal gui.
5 files changed, 282 insertions(+)
diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp
-index 14b51568a959afa5648b844a2a87efbb57b5249a..5384f5686578ee455263b0ee636b2adc332e0264 100644
+index 6994f16290ca3ec9da124fbf1cfa21716333855d..97a693ad29a54a53acbdc9abe7f83c103e5e1dac 100644
--- a/xbmc/guilib/GUIWindowManager.cpp
+++ b/xbmc/guilib/GUIWindowManager.cpp
@@ -199,7 +199,9 @@ void CGUIWindowManager::CreateWindows()
@@ -1954,10 +1955,10 @@ index 1b1d2f2e60334ed0f3a9964d106957f58e69f1b3..c82ba84625fe3556ff49764d40ceb3ec
#endif
-From a3fffaef5c155d74ff051a7bbb2c1b56449ece13 Mon Sep 17 00:00:00 2001
+From e09807bed7411203a4c032e46a839cb215194ac7 Mon Sep 17 00:00:00 2001
From: Claudio-Sjo
Date: Mon, 16 Feb 2015 14:51:26 +0100
-Subject: [PATCH 21/61] - allow reads < CDIO_CD_FRAMESIZE_RAW by using a buffer
+Subject: [PATCH 21/65] - allow reads < CDIO_CD_FRAMESIZE_RAW by using a buffer
- fixes #15794
---
@@ -2149,10 +2150,10 @@ index 0427af4534bfe59a343f0518c7f4242d93299836..e99236294fa8b9b613e465a8ecaf3ad3
lsn_t m_lsnCurrent; // Position inside the track in logical sector number
lsn_t m_lsnEnd; // End of m_iTrack in logical sector number
-From 60a1b2ccb05742807a0fcbceaf5da47c8c13a66f Mon Sep 17 00:00:00 2001
+From 23eb36012a54590dc75e2b0a9a2304092272d483 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Fri, 24 Jun 2016 19:38:13 +0100
-Subject: [PATCH 22/61] codecoverlay: Include codec name in overlay
+Subject: [PATCH 22/65] codecoverlay: Include codec name in overlay
---
xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp | 4 ++++
@@ -2163,7 +2164,7 @@ Subject: [PATCH 22/61] codecoverlay: Include codec name in overlay
5 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
-index 24228154ecf99911f74407d73d280778e6f98fcd..188b85b12b86f887324cdcfda3c3aa4cd90d3a11 100644
+index a0cae3e603a3d0bcd954c75c9796f1afa995a9a1..5eee488a59a689e66325e8f8a9467ad2bb394a54 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
@@ -210,6 +210,10 @@ void CVideoPlayerAudio::UpdatePlayerInfo()
@@ -2178,10 +2179,10 @@ index 24228154ecf99911f74407d73d280778e6f98fcd..188b85b12b86f887324cdcfda3c3aa4c
//print the inverse of the resample ratio, since that makes more sense
//if the resample ratio is 0.5, then we're playing twice as fast
diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
-index fee65c3bd9ccdb3b7fc6e677c0473dfdd3d131bc..11ffffb23b435b1ea77fc756cf321013393f9f4a 100644
+index 06305e13c0687ba6899a6ab1f364345a3115c0f1..7f090615d5696e538fdd7ab376b76ef8212927cf 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
-@@ -909,10 +909,13 @@ int CVideoPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts)
+@@ -915,10 +915,13 @@ int CVideoPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts)
std::string CVideoPlayerVideo::GetPlayerInfo()
{
@@ -2246,10 +2247,10 @@ index 0df7e72cc9d1947173c2bac5e72eb09976b51aa5..b5050081c360d29b1b478c27e6b88291
double m_iSubtitleDelay;
bool m_bRenderSubs;
-From 34b921907166a74b1f941cb54e6437bbddc50e1e Mon Sep 17 00:00:00 2001
+From d0279647e6ebd58b37bb61385942e912f1d7cc73 Mon Sep 17 00:00:00 2001
From: Anton Fedchin
Date: Tue, 8 Mar 2016 21:20:58 +0300
-Subject: [PATCH 23/61] [DebugInfo] Add cpu usage info.
+Subject: [PATCH 23/65] [DebugInfo] Add cpu usage info.
---
.../VideoPlayer/VideoRenderers/DebugRenderer.cpp | 56 ++++++++--------------
@@ -2258,10 +2259,10 @@ Subject: [PATCH 23/61] [DebugInfo] Add cpu usage info.
3 files changed, 30 insertions(+), 42 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.cpp
-index 846868967e15309c22b4ee46795a914230dc65d1..36be6ce222cfae9680af6834e934d88495a55950 100644
+index 539a560f9554478ad25a5631121dc74e667d9b40..08721e153e5f3232585eb776d1d1b44396f63de4 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.cpp
-@@ -27,7 +27,7 @@ using namespace OVERLAY;
+@@ -28,7 +28,7 @@ using namespace OVERLAY;
CDebugRenderer::CDebugRenderer()
{
@@ -2270,7 +2271,7 @@ index 846868967e15309c22b4ee46795a914230dc65d1..36be6ce222cfae9680af6834e934d884
{
m_overlay[i] = nullptr;
m_strDebug[i] = " ";
-@@ -36,54 +36,36 @@ CDebugRenderer::CDebugRenderer()
+@@ -37,54 +37,36 @@ CDebugRenderer::CDebugRenderer()
CDebugRenderer::~CDebugRenderer()
{
@@ -2342,15 +2343,15 @@ index 846868967e15309c22b4ee46795a914230dc65d1..36be6ce222cfae9680af6834e934d884
}
void CDebugRenderer::Render(CRect &src, CRect &dst, CRect &view)
-@@ -120,7 +102,7 @@ void CDebugRenderer::CRenderer::Render(int idx)
+@@ -121,7 +103,7 @@ void CDebugRenderer::CRenderer::Render(int idx)
COverlayText *text = dynamic_cast(o);
if (text)
- text->PrepareRender("arial.ttf", 1, 16, 0, m_font, m_fontBorder);
+ text->PrepareRender("arial.ttf", 1, 12, 0, m_font, m_fontBorder);
- o->m_pos = COverlay::POSITION_ABSOLUTE;
- o->m_align = COverlay::ALIGN_SCREEN;
+ RESOLUTION_INFO res = g_graphicsContext.GetResInfo(g_graphicsContext.GetVideoResolution());
+
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.h b/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.h
index 85aefaace73994730f7d2bdff9de85c79e99b2a2..8005a13bc220be0c5c596d276197c11ed938ffb0 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.h
@@ -2386,7 +2387,7 @@ index 85aefaace73994730f7d2bdff9de85c79e99b2a2..8005a13bc220be0c5c596d276197c11e
};
\ No newline at end of file
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
-index 558a1f3df9ac82f3c7f32a91a1f2235c7f6563c6..f2a133e1ff7b440ebc741878ccf87e6da090aa8c 100644
+index f96be370c6ff7e19aa22b47b559f7a2bee192069..4d5b9f740d08b95b1780caf6da0200583d9c6318 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
@@ -24,6 +24,7 @@
@@ -2397,7 +2398,7 @@ index 558a1f3df9ac82f3c7f32a91a1f2235c7f6563c6..f2a133e1ff7b440ebc741878ccf87e6d
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "windowing/WindowingFactory.h"
-@@ -922,7 +923,7 @@ void CRenderManager::Render(bool clear, DWORD flags, DWORD alpha, bool gui)
+@@ -925,7 +926,7 @@ void CRenderManager::Render(bool clear, DWORD flags, DWORD alpha, bool gui)
if (m_renderDebug)
{
@@ -2406,9 +2407,9 @@ index 558a1f3df9ac82f3c7f32a91a1f2235c7f6563c6..f2a133e1ff7b440ebc741878ccf87e6d
m_playerPort->GetDebugInfo(audio, video, player);
-@@ -936,8 +937,10 @@ void CRenderManager::Render(bool clear, DWORD flags, DWORD alpha, bool gui)
+@@ -939,8 +940,10 @@ void CRenderManager::Render(bool clear, DWORD flags, DWORD alpha, bool gui)
missedvblanks,
- clockspeed - 100.0);
+ clockspeed * 100);
}
+ cpu = g_cpuInfo.GetCoresUsageString();
@@ -2419,10 +2420,10 @@ index 558a1f3df9ac82f3c7f32a91a1f2235c7f6563c6..f2a133e1ff7b440ebc741878ccf87e6d
m_debugTimer.Set(1000);
-From 5732950f2b9b5c9488bf669fc1dabfe773098900 Mon Sep 17 00:00:00 2001
+From 5a5fb07850e90081f355f308f3f785cdd68d3148 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Fri, 22 May 2015 13:56:29 +0100
-Subject: [PATCH 24/61] ffmpeg: Allow neon to be enabled in unified builds
+Subject: [PATCH 24/65] ffmpeg: Allow neon to be enabled in unified builds
---
tools/depends/target/ffmpeg/Makefile | 4 ++++
@@ -2445,10 +2446,10 @@ index dffe2da1dfd09e06c5f15c362f7cbe3cf2a26f75..4081dddb6bc2db53559d35506cad6af4
ifeq ($(OS), linux)
ffmpg_config += --target-os=$(OS) --cpu=$(CPU)
-From 2bdca30180c30357bf1ad3f2266622acc44605a9 Mon Sep 17 00:00:00 2001
+From 0daa9854de558357b37bfd9755fdf7d9094ed692 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Fri, 27 Feb 2015 14:37:27 +0000
-Subject: [PATCH 25/61] ffmpeg: Add some upstream HEVC optimisations
+Subject: [PATCH 25/65] ffmpeg: Add some upstream HEVC optimisations
---
tools/depends/target/ffmpeg/Makefile | 6 +-
@@ -6246,10 +6247,10 @@ index 0000000000000000000000000000000000000000..5e8e07d407f045fc99554f0f061d1e81
+2.5.0
+
-From 68dcdd8420309caf7e4f7896b5c27df98705590c Mon Sep 17 00:00:00 2001
+From 6d71c6a31c4adfee8f95156360ddae12e821db21 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Thu, 7 May 2015 14:04:18 +0100
-Subject: [PATCH 26/61] [ffmpeg] Add GPU acceleration to hevc
+Subject: [PATCH 26/65] [ffmpeg] Add GPU acceleration to hevc
---
tools/depends/target/ffmpeg/Makefile | 4 +-
@@ -44435,10 +44436,10 @@ index 0000000000000000000000000000000000000000..e172ebf157aebffe1ae50b4a2b25fd71
+2.7.4
+
-From 8d0b79d79bc31d6f84ee57e9b40b45dbe92be56d Mon Sep 17 00:00:00 2001
+From dd2ed73dfc759d5afd988e4e544aee0cfa6b1e37 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Sat, 22 Aug 2015 23:06:56 +0100
-Subject: [PATCH 27/61] [dvdmessage] Increase timeout on
+Subject: [PATCH 27/65] [dvdmessage] Increase timeout on
CDVDMsgGeneralSynchronize
---
@@ -44459,10 +44460,10 @@ index 0dcc664fd862706c60659f3664c7d964597c94d5..7614c831af9dfc821121a4111546fd4d
long CDVDMsgGeneralSynchronize::Release()
-From 3ccd3f7c40d9211b26df3479d89e931eb4ff3a95 Mon Sep 17 00:00:00 2001
+From d3f5e306acd46cc7b8173c2e96a78a993764222d Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Wed, 16 Sep 2015 19:05:12 +0100
-Subject: [PATCH 28/61] [3d] Make MVC a valid 3D filename tag
+Subject: [PATCH 28/65] [3d] Make MVC a valid 3D filename tag
---
xbmc/guilib/StereoscopicsManager.cpp | 9 +++++++++
@@ -44523,20 +44524,20 @@ index 1727580c0c8de2b6fda19a741f90721a570b96b8..4fa973515df6e677418a6bf7f9d0b4a3
bool m_useDisplayControlHWStereo;
-From 55dd622a6608b801350e62955c891a6a78a3e8e9 Mon Sep 17 00:00:00 2001
+From 6c07d703eda3708c2a3f95ac4217003d9935b5ba Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Mon, 5 Oct 2015 14:58:05 +0100
-Subject: [PATCH 29/61] [3d] Swap top/bottom sides of GUI
+Subject: [PATCH 29/65] [3d] Swap top/bottom sides of GUI
---
xbmc/guilib/GraphicContext.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xbmc/guilib/GraphicContext.cpp b/xbmc/guilib/GraphicContext.cpp
-index 9caa43113f63139d277bd71242a858a581736845..3ace73527a7c359ac21c87bf38b5d648a0f4d9c2 100644
+index e9d8e18445bcd82b09d5ed9f86e85a5a6fef8472..324852946dfc4e06d66915f35f8f37376795e041 100644
--- a/xbmc/guilib/GraphicContext.cpp
+++ b/xbmc/guilib/GraphicContext.cpp
-@@ -265,7 +265,7 @@ CPoint CGraphicContext::StereoCorrection(const CPoint &point) const
+@@ -267,7 +267,7 @@ CPoint CGraphicContext::StereoCorrection(const CPoint &point) const
{
const RESOLUTION_INFO info = GetResInfo();
@@ -44546,10 +44547,10 @@ index 9caa43113f63139d277bd71242a858a581736845..3ace73527a7c359ac21c87bf38b5d648
}
if(m_stereoMode == RENDER_STEREO_MODE_SPLIT_VERTICAL)
-From 79e39f5976fccbf9e9699b60b4f45a5f59d19bb5 Mon Sep 17 00:00:00 2001
+From 6e570a0f04536712cc7cb8dd0ff64bb05461fa72 Mon Sep 17 00:00:00 2001
From: popcornmix
Date: Sun, 11 Oct 2015 20:51:37 +0100
-Subject: [PATCH 30/61] Revert "Revert "Disable extra logging by default""
+Subject: [PATCH 30/65] Revert "Revert "Disable extra logging by default""
This reverts commit a880554325be187b877cd8f0e2b338e7267da636.
---
@@ -44557,10 +44558,10 @@ This reverts commit a880554325be187b877cd8f0e2b338e7267da636.
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/system/settings/settings.xml b/system/settings/settings.xml
-index 88b67c1869246037e81fb3efbe293f9fee37d25e..df60cf2d052f5a1570bd445468b156211a870007 100644
+index dc7144ac8756fb1af9d7f3bb56c0b471f0ae3f9b..8f62f7ca494ea5b3322653f0a2b9431ebd54c7ea 100644
--- a/system/settings/settings.xml
+++ b/system/settings/settings.xml
-@@ -2672,12 +2672,12 @@
+@@ -2820,12 +2820,12 @@