diff --git a/packages/mediacenter/kodi/patches/kodi-200.01-add-settings-for-libcec-button-repeats.patch b/packages/mediacenter/kodi/patches/kodi-200.01-add-settings-for-libcec-button-repeats.patch deleted file mode 100644 index ef7ec5618e..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-200.01-add-settings-for-libcec-button-repeats.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 486c88dcd90bbbadb5fb5f69a697872adf12c43a Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 28 Oct 2014 00:19:40 +0000 -Subject: [PATCH] [cec] Add settings for configuring button repeats - ---- - addons/resource.language.en_gb/resources/strings.po | 15 +++++++++++++++ - system/peripherals.xml | 4 +++- - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 16 ++++++++++++++++ - 3 files changed, 34 insertions(+), 1 deletion(-) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index bedbd87..6db61ed 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16687,3 +16687,18 @@ msgstr "" - msgctxt "#38009" - msgid "%i dB" - msgstr "" -+ -+#: system/peripherals.xml -+msgctxt "#38050" -+msgid "Remote button press delay before repeating (ms)" -+msgstr "" -+ -+#: system/peripherals.xml -+msgctxt "#38051" -+msgid "Remote button press repeat rate (ms)" -+msgstr "" -+ -+#: system/peripherals.xml -+msgctxt "#38052" -+msgid "Remote button press release time (ms)" -+msgstr "" -diff --git a/system/peripherals.xml b/system/peripherals.xml -index a67dc2f..6841bda 100644 ---- a/system/peripherals.xml -+++ b/system/peripherals.xml -@@ -30,7 +30,9 @@ - - - -- -+ -+ -+ - - - -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index ea702e5..b5ff693 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -1267,6 +1267,20 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu - m_configuration.bSendInactiveSource = config.bSendInactiveSource; - bChanged |= SetSetting("send_inactive_source", m_configuration.bSendInactiveSource == 1); - -+#if defined(CEC_DOUBLE_TAP_TIMEOUT_MS_OLD) -+ m_configuration.iDoubleTapTimeout50Ms = config.iDoubleTapTimeout50Ms; -+ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeout50Ms * 50); -+#else -+ m_configuration.iDoubleTapTimeoutMs = config.iDoubleTapTimeoutMs; -+ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeoutMs; -+#endif -+ -+ m_configuration.iButtonRepeatRateMs = config.iButtonRepeatRateMs; -+ bChanged |= SetSetting("button_repeat_rate_ms", (int)m_configuration.iButtonRepeatRateMs); -+ -+ m_configuration.iButtonReleaseDelayMs = config.iButtonReleaseDelayMs; -+ bChanged |= SetSetting("button_release_delay_ms", (int)m_configuration.iButtonReleaseDelayMs); -+ - m_configuration.iFirmwareVersion = config.iFirmwareVersion; - m_configuration.bShutdownOnStandby = config.bShutdownOnStandby; - -@@ -1371,6 +1385,8 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void) - // backwards compatibility. will be removed once the next major release of libCEC is out - m_configuration.iDoubleTapTimeoutMs = GetSettingInt("double_tap_timeout_ms"); - #endif -+ m_configuration.iButtonRepeatRateMs = GetSettingInt("button_repeat_rate_ms"); -+ m_configuration.iButtonReleaseDelayMs = GetSettingInt("button_release_delay_ms"); - } - - void CPeripheralCecAdapter::ReadLogicalAddresses(const std::string &strString, cec_logical_addresses &addresses) diff --git a/packages/mediacenter/kodi/patches/kodi-200.02-dont-discard-libcec-buttons-when-repeat-enabled.patch b/packages/mediacenter/kodi/patches/kodi-200.02-dont-discard-libcec-buttons-when-repeat-enabled.patch deleted file mode 100644 index e6f2e5cf31..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-200.02-dont-discard-libcec-buttons-when-repeat-enabled.patch +++ /dev/null @@ -1,25 +0,0 @@ -From defea2828a7b4dba7c94c33896c1cd16d1f29f29 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Nov 2014 23:17:46 +0000 -Subject: [PATCH] [cec] Don't discard buttons when repeat mode is enabled - ---- - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index b5ff693..6086bf5 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -767,7 +767,10 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) - CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration); - - CSingleLock lock(m_critSection); -- if (key.iDuration > 0) -+ // avoid the queue getting too long -+ if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5) -+ return; -+ if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0) - { - if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0) - { diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-buildfix.patch b/packages/mediacenter/kodi/patches/kodi-999.99-buildfix.patch deleted file mode 100644 index b0cb92442d..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-999.99-buildfix.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur kodi-15.0-rc1-9ff25f8/configure.ac kodi-15.0-rc1-9ff25f8.patch/configure.ac ---- kodi-15.0-rc1-9ff25f8/configure.ac 2015-07-02 23:35:21.000000000 +0200 -+++ kodi-15.0-rc1-9ff25f8.patch/configure.ac 2015-07-04 08:15:52.284856500 +0200 -@@ -1051,7 +1051,7 @@ - AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."]) - AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."]) - AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.) -- LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util" -+ LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm" - else - AC_CHECK_LIB([EGL], [main],, AC_MSG_ERROR($missing_library)) - AC_CHECK_LIB([GLESv2],[main],, AC_MSG_ERROR($missing_library)) diff --git a/projects/RPi/patches/kodi/kodi-001-isengard-rpb-backports.patch b/projects/RPi/patches/kodi/kodi-001-isengard-rpb-backports.patch index e1ec4be1b1..e3696ce176 100644 --- a/projects/RPi/patches/kodi/kodi-001-isengard-rpb-backports.patch +++ b/projects/RPi/patches/kodi/kodi-001-isengard-rpb-backports.patch @@ -1,7 +1,7 @@ -From d4dbab9f0c3bc4ab02ba312ba0d4aa9f41371fdf Mon Sep 17 00:00:00 2001 +From 132222ecf736483f8a28e3bcc79e203d2472f69f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 01/58] [rbp/omxplayer] When opening a stream don't try to +Subject: [PATCH 01/78] [rbp/omxplayer] When opening a stream don't try to update gui so often --- @@ -9,7 +9,7 @@ Subject: [PATCH 01/58] [rbp/omxplayer] When opening a stream don't try to 1 file changed, 4 insertions(+) diff --git a/xbmc/dialogs/GUIDialogBusy.cpp b/xbmc/dialogs/GUIDialogBusy.cpp -index 2faceea..889d7a2 100644 +index 318ecec..59698f6 100644 --- a/xbmc/dialogs/GUIDialogBusy.cpp +++ b/xbmc/dialogs/GUIDialogBusy.cpp @@ -68,7 +68,11 @@ bool CGUIDialogBusy::WaitOnEvent(CEvent &event, unsigned int displaytime /* = 10 @@ -25,10 +25,10 @@ index 2faceea..889d7a2 100644 g_windowManager.ProcessRenderLoop(false); if (allowCancel && dialog->IsCanceled()) -From 1ecf22c5b4c919e3aed5274c67f748bbae86fbf0 Mon Sep 17 00:00:00 2001 +From fbca4865a19906cb3e97c9322608ab095b12c9f7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 03/58] [hifiberry] Hack: force it to be recognised as IEC958 +Subject: [PATCH 03/78] [hifiberry] Hack: force it to be recognised as IEC958 capable to enable passthrough options --- @@ -51,10 +51,10 @@ index e22db7a..0120bd5 100644 info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") { -From ac054e5b5efd9ec9205598f9b7549a8e953272fd Mon Sep 17 00:00:00 2001 +From cc8731845cea144fc5de5192c54ae6fba29bfa52 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 04/58] Improved file buffering in CArchive +Subject: [PATCH 04/78] 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 @@ -114,20 +114,20 @@ index 6ed0f8f..8506d95 100644 } else -From 1a7d63a938850a884f08bd3af66808bef91b7588 Mon Sep 17 00:00:00 2001 +From 850fc8907cffcf06cd9be909bd810bbd241e3886 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 12 Aug 2014 00:31:36 +0100 -Subject: [PATCH 05/58] [omxcodec] Don't force software codec with dvds +Subject: [PATCH 05/78] [omxcodec] Don't force software codec with dvds --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 82b5baa..70b1ac3 100644 +index 9f45a22..e702c35 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -3421,7 +3421,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) +@@ -3417,7 +3417,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) hint.aspect = aspect; hint.forced_aspect = true; } @@ -138,10 +138,10 @@ index 82b5baa..70b1ac3 100644 else if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) { -From 47e9b3430cd67a4e9e17de65df96f9c0dbb7c39c Mon Sep 17 00:00:00 2001 +From a38ae3033670378db15e94fa36e7f6bbd5bb0e6d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 06/58] filesystem: Make support of browsing into archives +Subject: [PATCH 06/78] 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. @@ -159,10 +159,10 @@ We'll let people who don't use archives disable it manually 3 files changed, 18 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index ff32bfd..5345dc2 100644 +index faf423c..52117a2 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16582,6 +16582,15 @@ msgstr "" +@@ -16605,6 +16605,15 @@ msgstr "" #: system/settings/rbp.xml msgctxt "#38010" msgid "GPU accelerated" @@ -179,7 +179,7 @@ index ff32bfd..5345dc2 100644 #. Setting #38011 "Videos -> Library -> Show All Items entry" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 8f69bcb..cbcde85 100644 +index 3ef33e0..10e8552 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -304,6 +304,11 @@ @@ -224,10 +224,10 @@ index 5af92e7..568a1a8 100644 { // XBMC Smart playlist - just XML renamed to XSP // read the name of the playlist in -From e863fd0253902d92c56ed85e589bffadc98b245f Mon Sep 17 00:00:00 2001 +From 559b4641f94a1cac143b83562a3ed2d1c4839842 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 13:06:57 +0000 -Subject: [PATCH 08/58] [rbp] Make cachemembuffersize default depend on memory +Subject: [PATCH 08/78] [rbp] Make cachemembuffersize default depend on memory size --- @@ -328,11 +328,10 @@ index 2e3282c..d1606a2 100644 m_initialized = true; } - -From 06bd0674846783738e6b81f351ba49bb633c473b Mon Sep 17 00:00:00 2001 +From 3a76692d6b72eb5a96d2a9ad59085938a8034c1c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 10/58] [settings] Experiment: Report DESKTOP resolution in +Subject: [PATCH 10/78] [settings] Experiment: Report DESKTOP resolution in video settings --- @@ -354,10 +353,10 @@ index 4376463..fc4e5ea 100644 StringUtils::Format("%dx%d%s", resolution->width, resolution->height, ModeFlagsToString(resolution->flags, false).c_str()), -From c2b0eafa1ed07258aa09a24a443d4535db8b3a1e Mon Sep 17 00:00:00 2001 +From 7d47259501b8e78a4488b3c77d301dc3092da768 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 9 Sep 2014 12:04:26 +0100 -Subject: [PATCH 11/58] egl: Treat unknown display aspect ratio as square pixel +Subject: [PATCH 11/78] egl: Treat unknown display aspect ratio as square pixel --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 ++-- @@ -386,10 +385,10 @@ index bda7430..68fc647 100644 SetResolutionString(m_desktopRes); -From 5f1821e4d8157a890c795744841dcb895a1349b4 Mon Sep 17 00:00:00 2001 +From 84167d1a7f7dc96ac0af89c9a1c29845e55b9265 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 12/58] [dvdplayer/rbp] Add pi specific option to maintain +Subject: [PATCH 12/78] [dvdplayer/rbp] Add pi specific option to maintain vsync with pll adjustment New A/V sync option in settings/video/playback to do "Adjust PLL". @@ -414,7 +413,7 @@ Needed updated firmware 9 files changed, 91 insertions(+), 7 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 5345dc2..6d08156 100644 +index 52117a2..530b3d4 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -6321,7 +6321,22 @@ msgctxt "#13459" @@ -441,7 +440,7 @@ index 5345dc2..6d08156 100644 #: system/settings/settings.xml msgctxt "#13505" -@@ -16628,3 +16643,10 @@ msgstr "" +@@ -16651,3 +16666,10 @@ msgstr "" msgctxt "#38016" msgid "%d fps" msgstr "" @@ -453,7 +452,7 @@ index 5345dc2..6d08156 100644 +msgstr "" + diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index cbcde85..a3d4728 100644 +index 10e8552..f493675 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -572,6 +572,20 @@ @@ -681,10 +680,10 @@ index 7df1bf7..732b69d 100644 float m_audioPlayCountMinimumPercent; bool m_dvdplayerIgnoreDTSinWAV; -From 6ead5d132f5d43c6ea3063c5fcd1c7d3b23eca18 Mon Sep 17 00:00:00 2001 +From 3cd283fec4a380188697c9f576e3f30debdb3481 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 13/58] [audio] Add settings option to boost centre channel +Subject: [PATCH 13/78] [audio] Add settings option to boost centre channel when downmixing This allows a dB volume increase to be added to centre channel. @@ -702,10 +701,10 @@ Should work with Pi Sink (dvdplayer/paplayer) and omxplayer 5 files changed, 45 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 6d08156..6e36b42 100644 +index 530b3d4..bedbd87 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16650,3 +16650,17 @@ msgctxt "#38006" +@@ -16673,3 +16673,17 @@ msgctxt "#38006" msgid "Audio has to stay in sync, this can either be done by resampling, or adjusting the PLL" msgstr "" @@ -724,7 +723,7 @@ index 6d08156..6e36b42 100644 +msgid "%i dB" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index a3d4728..09c3d10 100644 +index f493675..4843ab8 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -2597,6 +2597,18 @@ @@ -806,10 +805,10 @@ index f99c0e6..1911189 100644 // stereo upmix if (upmix && m_src_channels == 2 && m_dst_channels > 2) -From aca0d43f243143b6776e1cc8ef259197d2bee97a Mon Sep 17 00:00:00 2001 +From 1d5a34df606f823333a0b4f0c9fdde54910c0e5f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 15:23:51 +0000 -Subject: [PATCH 14/58] [rbp] Default extract thumbnails to false +Subject: [PATCH 14/78] [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 @@ -839,10 +838,1065 @@ index 50fe36a..a54a4c4 100644
-From 35f0f171ab8a9c37b2ebb5aca81b2242834fda72 Mon Sep 17 00:00:00 2001 +From d15976f38c7a551134ffff9b92a45e9e167634b0 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 10 Feb 2015 15:29:16 +0000 +Subject: [PATCH 15/78] [libcec] Add repeating keypress patch from popcornmix' + repo + +--- + tools/depends/target/libcec/Makefile | 1 + + tools/depends/target/libcec/popcornmix.patch | 859 +++++++++++++++++++++++++++ + 2 files changed, 860 insertions(+) + create mode 100644 tools/depends/target/libcec/popcornmix.patch + +diff --git a/tools/depends/target/libcec/Makefile b/tools/depends/target/libcec/Makefile +index f54af9e..ddf9963 100644 +--- a/tools/depends/target/libcec/Makefile ++++ b/tools/depends/target/libcec/Makefile +@@ -21,6 +21,7 @@ $(TARBALLS_LOCATION)/$(ARCHIVE): + $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) + rm -rf $(PLATFORM); mkdir -p $(PLATFORM)/build + cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) ++ cd $(PLATFORM); patch -p1 < ../popcornmix.patch + cd $(PLATFORM)/build; $(CMAKE) -DBUILD_SHARED_LIBS=1 -DSKIP_PYTHON_WRAPPER:STRING=1 -DCMAKE_INSTALL_LIBDIR=$(PREFIX)/lib .. + + $(LIBDYLIB): $(PLATFORM) +diff --git a/tools/depends/target/libcec/popcornmix.patch b/tools/depends/target/libcec/popcornmix.patch +new file mode 100644 +index 0000000..8366a69 +--- /dev/null ++++ b/tools/depends/target/libcec/popcornmix.patch +@@ -0,0 +1,859 @@ ++From ec982e9800ae312972d306b67779215a2add6cde Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Fri, 24 Oct 2014 13:45:21 +0100 ++Subject: [PATCH 1/6] Make released key polling wait for exact time until key ++ gets released ++ ++--- ++ src/libcec/CECClient.cpp | 16 ++++++++++++++-- ++ src/libcec/CECClient.h | 2 +- ++ src/libcec/CECProcessor.cpp | 8 +++++--- ++ src/libcec/LibCEC.cpp | 10 ++++++++-- ++ src/libcec/LibCEC.h | 4 +++- ++ 5 files changed, 31 insertions(+), 9 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index 35c2d3e..e307c0e 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -1067,7 +1067,7 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) ++ AddKey(key); ++ } ++ ++-void CCECClient::CheckKeypressTimeout(void) +++uint16_t CCECClient::CheckKeypressTimeout(void) ++ { ++ cec_keypress key; ++ ++@@ -1091,12 +1091,24 @@ void CCECClient::CheckKeypressTimeout(void) ++ } ++ else ++ { ++- return; +++ // time when this keypress will be released and we'd like to be called again +++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) +++ timeout = iTimeoutMs - (iNow - m_buttontime) + 1; +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) +++ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; +++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) +++ { +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ } +++ return timeout; ++ } ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); ++ QueueAddKey(key); +++ return CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ ++ bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index 12f8a3b..c9ce5e3 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -272,7 +272,7 @@ namespace CEC ++ virtual void AddKey(bool bSendComboKey = false); ++ virtual void AddKey(const cec_keypress &key); ++ virtual void SetCurrentButton(const cec_user_control_code iButtonCode); ++- virtual void CheckKeypressTimeout(void); +++ virtual uint16_t CheckKeypressTimeout(void); ++ virtual void SourceActivated(const cec_logical_address logicalAddress); ++ virtual void SourceDeactivated(const cec_logical_address logicalAddress); ++ ++diff --git a/src/libcec/CECProcessor.cpp b/src/libcec/CECProcessor.cpp ++index 99f71aa..604b950 100644 ++--- a/src/libcec/CECProcessor.cpp +++++ b/src/libcec/CECProcessor.cpp ++@@ -52,7 +52,6 @@ ++ using namespace CEC; ++ using namespace PLATFORM; ++ ++-#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 ++ #define ACTIVE_SOURCE_CHECK_INTERVAL 500 ++ #define TV_PRESENT_CHECK_INTERVAL 30000 ++ ++@@ -260,6 +259,7 @@ bool CCECProcessor::OnCommandReceived(const cec_command &command) ++ ++ void *CCECProcessor::Process(void) ++ { +++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started"); ++ ++ if (!m_connCheck) ++@@ -274,13 +274,13 @@ void *CCECProcessor::Process(void) ++ while (!IsStopped() && m_communication->IsOpen()) ++ { ++ // wait for a new incoming command, and process it ++- if (m_inBuffer.Pop(command, CEC_PROCESSOR_SIGNAL_WAIT_TIME)) +++ if (m_inBuffer.Pop(command, timeout)) ++ ProcessCommand(command); ++ ++ if (CECInitialised() && !IsStopped()) ++ { ++ // check clients for keypress timeouts ++- m_libcec->CheckKeypressTimeout(); +++ timeout = m_libcec->CheckKeypressTimeout(); ++ ++ // check if we need to replace handlers ++ ReplaceHandlers(); ++@@ -311,6 +311,8 @@ void *CCECProcessor::Process(void) ++ tvPresentCheck.Init(TV_PRESENT_CHECK_INTERVAL); ++ } ++ } +++ else +++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ ++ return NULL; ++diff --git a/src/libcec/LibCEC.cpp b/src/libcec/LibCEC.cpp ++index af36b79..5ccb8dd 100644 ++--- a/src/libcec/LibCEC.cpp +++++ b/src/libcec/LibCEC.cpp ++@@ -361,11 +361,17 @@ bool CLibCEC::IsValidPhysicalAddress(uint16_t iPhysicalAddress) ++ iPhysicalAddress <= CEC_MAX_PHYSICAL_ADDRESS; ++ } ++ ++-void CLibCEC::CheckKeypressTimeout(void) +++uint16_t CLibCEC::CheckKeypressTimeout(void) ++ { +++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ // check all clients ++ for (std::vector::iterator it = m_clients.begin(); it != m_clients.end(); it++) ++- (*it)->CheckKeypressTimeout(); +++ { +++ uint16_t t = (*it)->CheckKeypressTimeout(); +++ if (t < timeout) +++ timeout = t; +++ } +++ return timeout; ++ } ++ ++ void CLibCEC::AddLog(const cec_log_level level, const char *strFormat, ...) ++diff --git a/src/libcec/LibCEC.h b/src/libcec/LibCEC.h ++index 6d9a229..d9d1e7b 100644 ++--- a/src/libcec/LibCEC.h +++++ b/src/libcec/LibCEC.h ++@@ -39,6 +39,8 @@ ++ #include "CECTypeUtils.h" ++ #include ++ +++#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 +++ ++ namespace CEC ++ { ++ class CAdapterCommunication; ++@@ -125,7 +127,7 @@ namespace CEC ++ ++ void AddLog(const cec_log_level level, const char *strFormat, ...); ++ void AddCommand(const cec_command &command); ++- void CheckKeypressTimeout(void); +++ uint16_t CheckKeypressTimeout(void); ++ void Alert(const libcec_alert type, const libcec_parameter ¶m); ++ ++ static bool IsValidPhysicalAddress(uint16_t iPhysicalAddress); ++-- ++1.9.1 ++ ++ ++From 41f0f3ec9ac136da3565c96fd5a7075499f3938d Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Fri, 24 Oct 2014 13:51:34 +0100 ++Subject: [PATCH 2/6] Keep track of time since initial button press and last ++ button update ++ ++--- ++ src/libcec/CECClient.cpp | 44 +++++++++++++++++++++++++++----------------- ++ src/libcec/CECClient.h | 3 ++- ++ 2 files changed, 29 insertions(+), 18 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index e307c0e..e7935b9 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -54,7 +54,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_bInitialised(false), ++ m_bRegistered(false), ++ m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), ++- m_buttontime(0), +++ m_initialButtontime(0), +++ m_updateButtontime(0), ++ m_iPreventForwardingPowerOffCommand(0), ++ m_iLastKeypressTime(0) ++ { ++@@ -981,9 +982,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++- key.duration = (unsigned int) (GetTimeMs() - m_buttontime); +++ unsigned int duration = (unsigned int) (GetTimeMs() - m_updateButtontime); +++ key.duration = (unsigned int) (GetTimeMs() - m_initialButtontime); ++ ++- if (key.duration > m_configuration.iComboKeyTimeoutMs || +++ if (duration > m_configuration.iComboKeyTimeoutMs || ++ m_configuration.iComboKeyTimeoutMs == 0 || ++ m_iCurrentButton != m_configuration.comboKey || ++ bSendComboKey) ++@@ -991,14 +993,15 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) ++ key.keycode = m_iCurrentButton; ++ ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_buttontime = 0; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; ++ } ++ } ++ } ++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x)", ToString(key.keycode), key.keycode); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++ QueueAddKey(key); ++ } ++ } ++@@ -1012,7 +1015,7 @@ void CCECClient::AddKey(const cec_keypress &key) ++ AddKey(); ++ return; ++ } ++- +++ bool isrepeat = false; ++ cec_keypress transmitKey(key); ++ cec_user_control_code comboKey(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); ++@@ -1035,22 +1038,27 @@ void CCECClient::AddKey(const cec_keypress &key) ++ AddKey(true); ++ } ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); +++ ++ if (m_iCurrentButton == key.keycode) ++ { ++- m_buttontime = GetTimeMs(); +++ m_updateButtontime = GetTimeMs(); +++ isrepeat = true; ++ } ++ else ++ { ++- AddKey(); +++ if (m_iCurrentButton != transmitKey.keycode) +++ AddKey(); ++ if (key.duration == 0) ++ { ++ m_iCurrentButton = transmitKey.keycode; ++- m_buttontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); +++ m_initialButtontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); +++ m_updateButtontime = m_initialButtontime; ++ } ++ } ++ } ++ ++- if (key.keycode != comboKey || key.duration > 0) +++ if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); ++ QueueAddKey(transmitKey); ++@@ -1074,32 +1082,34 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ { ++ CLockObject lock(m_mutex); ++ uint64_t iNow = GetTimeMs(); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s T:%.3f", __FUNCTION__, iNow*1e-3); ++ cec_user_control_code comboKey(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); ++ uint32_t iTimeoutMs(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_buttontime > iTimeoutMs) || ++- (m_iCurrentButton != comboKey && iNow - m_buttontime > CEC_BUTTON_TIMEOUT))) +++ ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime > iTimeoutMs) || +++ (m_iCurrentButton != comboKey && iNow - m_updateButtontime > CEC_BUTTON_TIMEOUT))) ++ { ++- key.duration = (unsigned int) (iNow - m_buttontime); +++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++ ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_buttontime = 0; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; ++ } ++ else ++ { ++ // time when this keypress will be released and we'd like to be called again ++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) ++- timeout = iTimeoutMs - (iNow - m_buttontime) + 1; +++ timeout = iTimeoutMs - (iNow - m_updateButtontime) + 1; ++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) ++- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; +++ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_updateButtontime) + 1; ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ return timeout; ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index c9ce5e3..611c68b 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -404,7 +404,8 @@ namespace CEC ++ PLATFORM::CMutex m_mutex; /**< mutex for changes to this instance */ ++ PLATFORM::CMutex m_cbMutex; /**< mutex that is held when doing anything with callbacks */ ++ cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ ++- int64_t m_buttontime; /**< the timestamp when the button was pressed (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++ int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++ cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++-- ++1.9.1 ++ ++ ++From 273ead6980b69eddf98810eb1eb33d94a7d74fce Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Tue, 28 Oct 2014 00:09:18 +0000 ++Subject: [PATCH 3/6] Support repeating button presses with configurable repeat ++ rate ++ ++--- ++ include/cectypes.h | 6 ++ ++ src/libcec/CECClient.cpp | 100 +++++++++++++++++++---- ++ src/libcec/CECClient.h | 6 +- ++ src/libcec/implementations/CECCommandHandler.cpp | 2 +- ++ 4 files changed, 96 insertions(+), 18 deletions(-) ++ ++diff --git a/include/cectypes.h b/include/cectypes.h ++index acff259..8f098ef 100644 ++--- a/include/cectypes.h +++++ b/include/cectypes.h ++@@ -1493,6 +1493,8 @@ struct libcec_configuration ++ XXX changed meaning in 2.2.0 to not break binary compatibility. next major (3.0) release will fix it in a nicer way */ ++ cec_user_control_code comboKey; /*!< key code that initiates combo keys. defaults to CEC_USER_CONTROL_CODE_F1_BLUE. CEC_USER_CONTROL_CODE_UNKNOWN to disable. added in 2.0.5 */ ++ uint32_t iComboKeyTimeoutMs; /*!< timeout until the combo key is sent as normal keypress */ +++ uint32_t iButtonRepeatRateMs; /*!< rate at which buttons autorepeat. 0 means rely on CEC device */ +++ uint32_t iButtonReleaseDelayMs;/*!< duration after last update until a button is considered released */ ++ ++ #ifdef __cplusplus ++ libcec_configuration(void) { Clear(); } ++@@ -1527,6 +1529,8 @@ struct libcec_configuration ++ cecVersion == other.cecVersion && ++ adapterType == other.adapterType && ++ iDoubleTapTimeout50Ms == other.iDoubleTapTimeout50Ms && +++ iButtonRepeatRateMs == other.iButtonRepeatRateMs && +++ iButtonReleaseDelayMs == other.iButtonReleaseDelayMs && ++ (other.clientVersion <= LIBCEC_VERSION_TO_UINT(2, 0, 4) || comboKey == other.comboKey) && ++ (other.clientVersion <= LIBCEC_VERSION_TO_UINT(2, 0, 4) || iComboKeyTimeoutMs == other.iComboKeyTimeoutMs) && ++ (other.clientVersion < LIBCEC_VERSION_TO_UINT(2, 1, 0) || bPowerOnScreensaver == other.bPowerOnScreensaver)); ++@@ -1567,6 +1571,8 @@ struct libcec_configuration ++ iDoubleTapTimeout50Ms = CEC_DOUBLE_TAP_TIMEOUT_50_MS; ++ comboKey = CEC_USER_CONTROL_CODE_STOP; ++ iComboKeyTimeoutMs = CEC_DEFAULT_COMBO_TIMEOUT_MS; +++ iButtonRepeatRateMs = 0; +++ iButtonReleaseDelayMs = CEC_BUTTON_TIMEOUT; ++ ++ memset(strDeviceName, 0, 13); ++ deviceTypes.Clear(); ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index e7935b9..598628d 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -56,6 +56,10 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), ++ m_initialButtontime(0), ++ m_updateButtontime(0), +++ m_repeatButtontime(0), +++ m_releaseButtontime(0), +++ m_pressedButtoncount(0), +++ m_releasedButtoncount(0), ++ m_iPreventForwardingPowerOffCommand(0), ++ m_iLastKeypressTime(0) ++ { ++@@ -851,6 +855,9 @@ bool CCECClient::GetCurrentConfiguration(libcec_configuration &configuration) ++ configuration.bMonitorOnly = m_configuration.bMonitorOnly; ++ configuration.cecVersion = m_configuration.cecVersion; ++ configuration.adapterType = m_configuration.adapterType; +++ configuration.iDoubleTapTimeout50Ms = m_configuration.iDoubleTapTimeout50Ms; +++ configuration.iButtonRepeatRateMs = m_configuration.iButtonRepeatRateMs; +++ configuration.iButtonReleaseDelayMs = m_configuration.iButtonReleaseDelayMs; ++ ++ return true; ++ } ++@@ -894,6 +901,9 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) ++ m_configuration.cecVersion = configuration.cecVersion; ++ m_configuration.adapterType = configuration.adapterType; ++ m_configuration.iDoubleTapTimeout50Ms = configuration.iDoubleTapTimeout50Ms; +++ m_configuration.iButtonRepeatRateMs = configuration.iButtonRepeatRateMs; +++ m_configuration.iButtonReleaseDelayMs = configuration.iButtonReleaseDelayMs; +++ ++ m_configuration.deviceTypes.Add(configuration.deviceTypes[0]); ++ ++ if (m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5)) ++@@ -950,6 +960,7 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) ++ primary->ActivateSource(); ++ } ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: %d:%d:%d", __FUNCTION__, DoubleTapTimeoutMS(), m_configuration.iButtonRepeatRateMs, m_configuration.iButtonReleaseDelayMs); ++ return true; ++ } ++ ++@@ -973,11 +984,15 @@ void CCECClient::AddCommand(const cec_command &command) ++ } ++ } ++ ++-void CCECClient::AddKey(bool bSendComboKey /* = false */) +++void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* = false */) ++ { ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ +++ // we ignore button releases when supporting repeating keys +++ if (bButtonRelease && m_configuration.iButtonRepeatRateMs && m_configuration.iButtonReleaseDelayMs) +++ return; +++ ++ { ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++@@ -995,6 +1010,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++ m_initialButtontime = 0; ++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; ++ } ++ } ++ } ++@@ -1012,6 +1031,7 @@ void CCECClient::AddKey(const cec_keypress &key) ++ key.keycode < CEC_USER_CONTROL_CODE_SELECT) ++ { ++ // send back the previous key if there is one +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Unexpected key %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(); ++ return; ++ } ++@@ -1035,7 +1055,10 @@ void CCECClient::AddKey(const cec_keypress &key) ++ transmitKey.keycode = CEC_USER_CONTROL_CODE_DOT; ++ // default, send back the previous key ++ else +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Combo key %s (%1x) D%dms:", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(true); +++ } ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); ++@@ -1043,17 +1066,44 @@ void CCECClient::AddKey(const cec_keypress &key) ++ if (m_iCurrentButton == key.keycode) ++ { ++ m_updateButtontime = GetTimeMs(); ++- isrepeat = true; +++ m_releaseButtontime = m_updateButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); +++ // want to have seen some updated before considering a repeat +++ if (m_configuration.iButtonRepeatRateMs) +++ { +++ if (!m_repeatButtontime && m_pressedButtoncount > 1) +++ m_repeatButtontime = m_initialButtontime + DoubleTapTimeoutMS(); +++ isrepeat = true; +++ } +++ m_pressedButtoncount++; ++ } ++ else ++ { ++ if (m_iCurrentButton != transmitKey.keycode) +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Changed key %s (%1x) D:%dms cur:%lx", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration, m_iCurrentButton); ++ AddKey(); +++ } ++ if (key.duration == 0) ++ { ++ m_iCurrentButton = transmitKey.keycode; ++- m_initialButtontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); ++- m_updateButtontime = m_initialButtontime; +++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) +++ { +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; +++ } +++ else +++ { +++ m_initialButtontime = GetTimeMs(); +++ m_updateButtontime = m_initialButtontime; +++ m_repeatButtontime = 0; // set this on next update +++ m_releaseButtontime = m_initialButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); +++ m_pressedButtoncount = 1; +++ m_releasedButtoncount = 0; +++ } ++ } ++ } ++ } ++@@ -1072,12 +1122,16 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) ++ key.duration = 0; ++ key.keycode = iButtonCode; ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "SetCurrentButton %s (%1x) D:%dms cur:%lx", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(key); ++ } ++ ++ uint16_t CCECClient::CheckKeypressTimeout(void) ++ { +++ // time when we'd like to be called again +++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ cec_keypress key; +++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ ++ { ++ CLockObject lock(m_mutex); ++@@ -1089,8 +1143,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime > iTimeoutMs) || ++- (m_iCurrentButton != comboKey && iNow - m_updateButtontime > CEC_BUTTON_TIMEOUT))) +++ ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) || +++ (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime))) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1098,27 +1152,41 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++ m_initialButtontime = 0; ++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; +++ } +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +++ (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) +++ { +++ key.duration = 0; +++ key.keycode = m_iCurrentButton; +++ m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; +++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ } ++ else ++ { ++- // time when this keypress will be released and we'd like to be called again ++- unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) ++- timeout = iTimeoutMs - (iNow - m_updateButtontime) + 1; ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) ++- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_updateButtontime) + 1; +++ timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_releaseButtontime) +++ timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_repeatButtontime) +++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, m_releaseButtontime*1e-3, m_iCurrentButton); ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++- return timeout; ++ } +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key %s: %s (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : key.duration ? "released" : "repeated", +++ ToString(m_iCurrentButton), m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); ++ } ++ ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); ++- QueueAddKey(key); ++- return CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) +++ QueueAddKey(key); +++ +++ return timeout; ++ } ++ ++ bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index 611c68b..adeb5af 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -269,7 +269,7 @@ namespace CEC ++ // callbacks ++ virtual void Alert(const libcec_alert type, const libcec_parameter ¶m) { QueueAlert(type, param); } ++ virtual void AddLog(const cec_log_message &message) { QueueAddLog(message); } ++- virtual void AddKey(bool bSendComboKey = false); +++ virtual void AddKey(bool bSendComboKey = false, bool bButtonRelease = false); ++ virtual void AddKey(const cec_keypress &key); ++ virtual void SetCurrentButton(const cec_user_control_code iButtonCode); ++ virtual uint16_t CheckKeypressTimeout(void); ++@@ -406,6 +406,10 @@ namespace CEC ++ cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ ++ int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ ++ int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_repeatButtontime; /**< the timestamp when the button will next repeat (in seconds since epoch), or 0 if repeat is disabled. */ +++ int64_t m_releaseButtontime; /**< the timestamp when the button will be released (in seconds since epoch), or 0 if none was pressed. */ +++ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ +++ int32_t m_releasedButtoncount; /**< the number of times a button pressed message has been seen for this press. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++ int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++ cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++diff --git a/src/libcec/implementations/CECCommandHandler.cpp b/src/libcec/implementations/CECCommandHandler.cpp ++index 6d6244e..d64186f 100644 ++--- a/src/libcec/implementations/CECCommandHandler.cpp +++++ b/src/libcec/implementations/CECCommandHandler.cpp ++@@ -770,7 +770,7 @@ int CCECCommandHandler::HandleUserControlRelease(const cec_command &command) ++ ++ CECClientPtr client = m_processor->GetClient(command.destination); ++ if (client) ++- client->AddKey(); +++ client->AddKey(false, true); ++ ++ return COMMAND_HANDLED; ++ } ++-- ++1.9.1 ++ ++ ++From 3336d0827f7fd159430f3431642b07090c06c869 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Tue, 28 Oct 2014 01:21:35 +0000 ++Subject: [PATCH 4/6] Skip double press removal. It is handled through other ++ means. ++ ++--- ++ src/libcec/CECClient.cpp | 18 +----------------- ++ src/libcec/CECClient.h | 2 -- ++ 2 files changed, 1 insertion(+), 19 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index 598628d..dccd874 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -60,11 +60,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_releaseButtontime(0), ++ m_pressedButtoncount(0), ++ m_releasedButtoncount(0), ++- m_iPreventForwardingPowerOffCommand(0), ++- m_iLastKeypressTime(0) +++ m_iPreventForwardingPowerOffCommand(0) ++ { ++- m_lastKeypress.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_lastKeypress.duration = 0; ++ m_configuration.Clear(); ++ // set the initial configuration ++ SetConfiguration(configuration); ++@@ -1647,20 +1644,7 @@ void CCECClient::CallbackAddKey(const cec_keypress &key) ++ { ++ CLockObject lock(m_cbMutex); ++ if (m_configuration.callbacks && m_configuration.callbacks->CBCecKeyPress) ++- { ++- // prevent double taps ++- int64_t now = GetTimeMs(); ++- if (m_lastKeypress.keycode != key.keycode || ++- key.duration > 0 || ++- now - m_iLastKeypressTime >= DoubleTapTimeoutMS()) ++- { ++- // no double tap ++- if (key.duration == 0) ++- m_iLastKeypressTime = now; ++- m_lastKeypress = key; ++ m_configuration.callbacks->CBCecKeyPress(m_configuration.callbackParam, key); ++- } ++- } ++ } ++ ++ void CCECClient::CallbackAddLog(const cec_log_message &message) ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index adeb5af..43a713b 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -411,8 +411,6 @@ namespace CEC ++ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ ++ int32_t m_releasedButtoncount; /**< the number of times a button pressed message has been seen for this press. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++- int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++- cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++ PLATFORM::SyncedBuffer m_callbackCalls; ++ }; ++ } ++-- ++1.9.1 ++ ++ ++From 0dd0234f620a546bfa843172648383f83d88088c Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Mon, 3 Nov 2014 23:28:04 +0000 ++Subject: [PATCH 5/6] Pass through duration on all button repeats ++ ++--- ++ src/libcec/CECClient.cpp | 34 ++++++++++++++++++++++++---------- ++ 1 file changed, 24 insertions(+), 10 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index dccd874..1946148 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -986,10 +986,6 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ ++- // we ignore button releases when supporting repeating keys ++- if (bButtonRelease && m_configuration.iButtonRepeatRateMs && m_configuration.iButtonReleaseDelayMs) ++- return; ++- ++ { ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++@@ -1015,6 +1011,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* ++ } ++ } ++ +++ // we don't forward releases when supporting repeating keys +++ if (bButtonRelease && m_configuration.iButtonRepeatRateMs) +++ return; +++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++@@ -1107,7 +1107,7 @@ void CCECClient::AddKey(const cec_keypress &key) ++ ++ if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) ++ { ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x, %d)", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration); ++ QueueAddKey(transmitKey); ++ } ++ } ++@@ -1129,6 +1129,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +++ key.duration = 0; ++ ++ { ++ CLockObject lock(m_mutex); ++@@ -1140,8 +1141,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) || ++- (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime))) +++ m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1155,9 +1155,23 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_releasedButtoncount = 0; ++ } ++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +++ m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) +++ { +++ key.duration = (unsigned int) (iNow - m_initialButtontime); +++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +++ +++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; +++ } +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++ (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) ++ { ++- key.duration = 0; +++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++ m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; ++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++@@ -1176,8 +1190,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ } ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key %s: %s (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : key.duration ? "released" : "repeated", ++- ToString(m_iCurrentButton), m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Key %s: %s (duration:%d) (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", ToString(m_iCurrentButton), key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : m_repeatButtontime ? "repeated" : "released", key.duration, +++ m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); ++ } ++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++-- ++1.9.1 ++ ++ ++From 1ea01f59d8186d4d53af41961aaccbbc11651115 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Wed, 5 Nov 2014 21:04:25 +0000 ++Subject: [PATCH 6/6] squash: Fix for stop needing to be pressed twice ++ ++--- ++ src/libcec/CECClient.cpp | 17 ++++++++--------- ++ 1 file changed, 8 insertions(+), 9 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index 1946148..f4f114b 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -1131,6 +1131,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ key.duration = 0; ++ +++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) +++ return timeout; ++ { ++ CLockObject lock(m_mutex); ++ uint64_t iNow = GetTimeMs(); ++@@ -1140,8 +1142,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ uint32_t iTimeoutMs(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) +++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1154,8 +1155,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_pressedButtoncount = 0; ++ m_releasedButtoncount = 0; ++ } ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) +++ else if (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++@@ -1168,8 +1168,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_pressedButtoncount = 0; ++ m_releasedButtoncount = 0; ++ } ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) +++ else if (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1178,11 +1177,11 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ } ++ else ++ { ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) +++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0) ++ timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_releaseButtontime) +++ if (m_iCurrentButton != comboKey && m_releaseButtontime) ++ timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_repeatButtontime) +++ if (m_iCurrentButton != comboKey && m_repeatButtontime) ++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++-- ++1.9.1 ++ + +From 48f3222f1cc3eb51884018918c8c652a99cef2a7 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Oct 2014 00:19:40 +0000 +Subject: [PATCH 16/78] [cec] Add settings for configuring button repeats + +--- + addons/resource.language.en_gb/resources/strings.po | 15 +++++++++++++++ + system/peripherals.xml | 4 +++- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 16 ++++++++++++++++ + 3 files changed, 34 insertions(+), 1 deletion(-) + +diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po +index bedbd87..6db61ed 100644 +--- a/addons/resource.language.en_gb/resources/strings.po ++++ b/addons/resource.language.en_gb/resources/strings.po +@@ -16687,3 +16687,18 @@ msgstr "" + msgctxt "#38009" + msgid "%i dB" + msgstr "" ++ ++#: system/peripherals.xml ++msgctxt "#38050" ++msgid "Remote button press delay before repeating (ms)" ++msgstr "" ++ ++#: system/peripherals.xml ++msgctxt "#38051" ++msgid "Remote button press repeat rate (ms)" ++msgstr "" ++ ++#: system/peripherals.xml ++msgctxt "#38052" ++msgid "Remote button press release time (ms)" ++msgstr "" +diff --git a/system/peripherals.xml b/system/peripherals.xml +index a67dc2f..6841bda 100644 +--- a/system/peripherals.xml ++++ b/system/peripherals.xml +@@ -30,7 +30,9 @@ + + + +- ++ ++ ++ + + + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index ea702e5..b5ff693 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -1267,6 +1267,20 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu + m_configuration.bSendInactiveSource = config.bSendInactiveSource; + bChanged |= SetSetting("send_inactive_source", m_configuration.bSendInactiveSource == 1); + ++#if defined(CEC_DOUBLE_TAP_TIMEOUT_MS_OLD) ++ m_configuration.iDoubleTapTimeout50Ms = config.iDoubleTapTimeout50Ms; ++ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeout50Ms * 50); ++#else ++ m_configuration.iDoubleTapTimeoutMs = config.iDoubleTapTimeoutMs; ++ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeoutMs; ++#endif ++ ++ m_configuration.iButtonRepeatRateMs = config.iButtonRepeatRateMs; ++ bChanged |= SetSetting("button_repeat_rate_ms", (int)m_configuration.iButtonRepeatRateMs); ++ ++ m_configuration.iButtonReleaseDelayMs = config.iButtonReleaseDelayMs; ++ bChanged |= SetSetting("button_release_delay_ms", (int)m_configuration.iButtonReleaseDelayMs); ++ + m_configuration.iFirmwareVersion = config.iFirmwareVersion; + m_configuration.bShutdownOnStandby = config.bShutdownOnStandby; + +@@ -1371,6 +1385,8 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void) + // backwards compatibility. will be removed once the next major release of libCEC is out + m_configuration.iDoubleTapTimeoutMs = GetSettingInt("double_tap_timeout_ms"); + #endif ++ m_configuration.iButtonRepeatRateMs = GetSettingInt("button_repeat_rate_ms"); ++ m_configuration.iButtonReleaseDelayMs = GetSettingInt("button_release_delay_ms"); + } + + void CPeripheralCecAdapter::ReadLogicalAddresses(const std::string &strString, cec_logical_addresses &addresses) + +From 1976d9680172ac8af7f543d952a8a9785e52ae6d Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 3 Nov 2014 23:17:46 +0000 +Subject: [PATCH 17/78] [cec] Don't discard buttons when repeat mode is enabled + +--- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index b5ff693..6086bf5 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -767,7 +767,10 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration); + + CSingleLock lock(m_critSection); +- if (key.iDuration > 0) ++ // avoid the queue getting too long ++ if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5) ++ return; ++ if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0) + { + if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0) + { + +From 39d8231d117444c81d96d79e38d23458e18d81ec Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 4 Nov 2014 18:50:00 +0000 +Subject: [PATCH 18/78] [cec] Temp - more logging + +--- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index 6086bf5..417b0d8 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -764,12 +764,15 @@ void CPeripheralCecAdapter::GetNextKey(void) + + void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + { +- CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration); ++ CLog::Log(LOGDEBUG, "%s - received key %2x duration %d (rep:%d size:%d)", __FUNCTION__, key.iButton, key.iDuration, m_configuration.iButtonRepeatRateMs, m_buttonQueue.size()); + + CSingleLock lock(m_critSection); + // avoid the queue getting too long + if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5) ++ { ++ CLog::Log(LOGDEBUG, "%s - discarded key %2x", __FUNCTION__, key.iButton); + return; ++ } + if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0) + { + if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0) +@@ -778,6 +781,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + if (m_bHasButton) + m_currentButton.iDuration = key.iDuration; + // ignore this one, since it's already been handled by xbmc ++ CLog::Log(LOGDEBUG, "%s - ignored key %2x", __FUNCTION__, key.iButton); + return; + } + // if we received a keypress with a duration set, try to find the same one without a duration set, and replace it +@@ -788,6 +792,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + if ((*it).iDuration == 0) + { + // replace this entry ++ CLog::Log(LOGDEBUG, "%s - replaced key %2x", __FUNCTION__, key.iButton); + (*it).iDuration = key.iDuration; + return; + } +@@ -797,6 +802,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + } + } + ++ CLog::Log(LOGDEBUG, "%s - added key %2x", __FUNCTION__, key.iButton); + m_buttonQueue.push_back(key); + } + + +From 5a250e44c87f1d6537bac25a0aba6d87c2ff9495 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 15 Nov 2014 12:03:34 +0000 -Subject: [PATCH 19/58] [dvdplayer] Add lock for player creation +Subject: [PATCH 19/78] [dvdplayer] Add lock for player creation --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 3 +++ @@ -850,7 +1904,7 @@ Subject: [PATCH 19/58] [dvdplayer] Add lock for player creation 2 files changed, 4 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 70b1ac3..b41c8f0 100644 +index e702c35..8252192 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -517,6 +517,7 @@ int CSelectionStreams::CountSource(StreamType type, StreamSource source) const @@ -869,7 +1923,7 @@ index 70b1ac3..b41c8f0 100644 if (!m_players_created) return; delete m_dvdPlayerVideo; -@@ -4255,6 +4257,7 @@ double CDVDPlayer::GetQueueTime() +@@ -4251,6 +4253,7 @@ double CDVDPlayer::GetQueueTime() void CDVDPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info) { @@ -888,10 +1942,10 @@ index ab6a228..32e76c1 100644 + CCriticalSection m_players_lock; }; -From 51e261109f6a8d1cb0e96bdaa56a01aa7077633f Mon Sep 17 00:00:00 2001 +From 0598120209d780b0aef824f45fc03d2c085459c6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 24 Nov 2014 22:07:25 +0000 -Subject: [PATCH 20/58] [dvdplayervideo] Prod decoder when in stills mode +Subject: [PATCH 20/78] [dvdplayervideo] Prod decoder when in stills mode An asynchronous hardware decoder doesn't only produce output pictures when new packets arrive. In dvd stills mode give it a chance to return pictures that weren't ready when frame was decoded. @@ -900,7 +1954,7 @@ In dvd stills mode give it a chance to return pictures that weren't ready when f 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index f1a7e60..9be8aae 100644 +index cbfefe0..fe3b2c2 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -314,7 +314,8 @@ void CDVDPlayerVideo::Process() @@ -968,10 +2022,10 @@ index f1a7e60..9be8aae 100644 if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE)) -From deb376b5dad3cef8f86cef69aab9a4280bac9b21 Mon Sep 17 00:00:00 2001 +From 0022598c8beb8f6dce97ca959a66348e7d498a97 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 27 Nov 2014 16:31:56 +0000 -Subject: [PATCH 21/58] [languageinvoker] Reduce priority of python threads +Subject: [PATCH 21/78] [languageinvoker] Reduce priority of python threads --- xbmc/interfaces/generic/LanguageInvokerThread.cpp | 5 +++++ @@ -994,10 +2048,10 @@ index fcdd063..16f0c89 100644 } -From 7351fa296cd1740f04c6c5a2047c11e3b607f700 Mon Sep 17 00:00:00 2001 +From 9a26e5bba11a26b9437a93cfbc1e55ccc3245170 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Dec 2013 16:55:05 +0000 -Subject: [PATCH 22/58] logging: Add microsecond timer to log messages +Subject: [PATCH 22/78] logging: Add microsecond timer to log messages --- xbmc/utils/log.cpp | 17 +++++++++++++++-- @@ -1050,10 +2104,10 @@ index 3443f12..31c4a99 100644 levelNames[logLevel]) + strData; -From c2bc1032b22f6214ffbbbecb29e3538f9790f016 Mon Sep 17 00:00:00 2001 +From 38d419b7cc3e0fe22602ec0819f089583e349952 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 29 Nov 2014 15:25:16 +0000 -Subject: [PATCH 23/58] [rbp] hack: wait for splash to complete before changing +Subject: [PATCH 23/78] [rbp] hack: wait for splash to complete before changing hdmi mode --- @@ -1127,10 +2181,10 @@ index 68fc647..c80114e 100644 if(!m_fixedMode && GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) -From 58ed12b2f7dd77fc57b3ddbff8fbaa04a0172716 Mon Sep 17 00:00:00 2001 +From 83db1723e20ced83b80e352a5d2154ecea953100 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 11 Dec 2014 17:00:57 +0000 -Subject: [PATCH 24/58] Fix for UI not showing both extractflags and +Subject: [PATCH 24/78] Fix for UI not showing both extractflags and extractthumb --- @@ -1139,7 +2193,7 @@ Subject: [PATCH 24/58] Fix for UI not showing both extractflags and 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 788a831..a794cd8 100644 +index 6db61ed..9f2eb3c 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -11015,7 +11015,7 @@ msgstr "" @@ -1151,7 +2205,7 @@ index 788a831..a794cd8 100644 msgstr "" #: xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp -@@ -14549,7 +14549,7 @@ msgstr "" +@@ -14572,7 +14572,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36178" @@ -1160,7 +2214,7 @@ index 788a831..a794cd8 100644 msgstr "" #. Description of setting "Videos -> File lists -> Replace file names with library titles" with label #20419 -@@ -14561,7 +14561,7 @@ msgstr "" +@@ -14584,7 +14584,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36180" @@ -1169,7 +2223,7 @@ index 788a831..a794cd8 100644 msgstr "" #: system/settings/settings.xml -@@ -16679,3 +16679,8 @@ msgstr "" +@@ -16702,3 +16702,8 @@ msgstr "" msgctxt "#38052" msgid "Remote button press release time (ms)" msgstr "" @@ -1179,7 +2233,7 @@ index 788a831..a794cd8 100644 +msgid "Extract thumbnails from video files" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 09c3d10..1059b09 100644 +index 4843ab8..f1cbefa 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -861,8 +861,8 @@ @@ -1194,10 +2248,10 @@ index 09c3d10..1059b09 100644 -From 6f0adae04039766326ebb5a735433dac07787a0f Mon Sep 17 00:00:00 2001 +From 0f830a21ca9227d80e8caae04ff11b7bae247298 Mon Sep 17 00:00:00 2001 From: anaconda Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 25/58] Disable autoscrolling while on screensaver and while +Subject: [PATCH 25/78] Disable autoscrolling while on screensaver and while opening streams. --- @@ -1307,7 +2361,7 @@ index 759ac09..bed6ad2 100644 else { diff --git a/xbmc/guilib/GUITextBox.cpp b/xbmc/guilib/GUITextBox.cpp -index 0d5b3f7..6d23024 100644 +index dd78377..6b731e2 100644 --- a/xbmc/guilib/GUITextBox.cpp +++ b/xbmc/guilib/GUITextBox.cpp @@ -23,6 +23,7 @@ @@ -1328,10 +2382,10 @@ index 0d5b3f7..6d23024 100644 if (m_lastRenderTime) m_autoScrollDelayTime += currentTime - m_lastRenderTime; -From 9b85c054f66cb5efde618d34198bd533f16f26d5 Mon Sep 17 00:00:00 2001 +From b1843145fb9ab380c34fb8d85969c01228c74249 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 13 Dec 2014 18:35:20 +0000 -Subject: [PATCH 26/58] [demuxer] Avoid memcpy on every demuxer packet +Subject: [PATCH 26/78] [demuxer] Avoid memcpy on every demuxer packet Avoids an unnecessary memcpy on every demuxer packet which for high bitrate videos can be significant. @@ -1426,10 +2480,10 @@ index ab298b2..10c5ee0 100644 } catch(...) { -From cb5bcc331593fa2d2088c0a0f8f72aefce1030e2 Mon Sep 17 00:00:00 2001 +From e73b4ea6dc1b545c381dc516e804f8079da37f7b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 15 Feb 2015 14:06:12 +0000 -Subject: [PATCH 27/58] [mmal] Allow mmal codec for dvd stills +Subject: [PATCH 27/78] [mmal] Allow mmal codec for dvd stills --- xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 7 +++++++ @@ -1461,10 +2515,10 @@ index 4c363cf..b90237b 100644 { // If dvd is an mpeg2 and hint.stills -From 3873604d5ef7443bdfc33603c979495fe8a0f17c Mon Sep 17 00:00:00 2001 +From acb552f04e57174607dc946fae1916e6f4092d45 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 31 Mar 2015 17:31:47 +0100 -Subject: [PATCH 28/58] [mmalrenderer] Add SetCodecControl function and prefer +Subject: [PATCH 28/78] [mmalrenderer] Add SetCodecControl function and prefer to return pictures when renderer is low (disabled) --- @@ -1535,10 +2589,10 @@ index 51a64d1..bde8c06 100644 CCriticalSection m_sharedSection; MMAL_COMPONENT_T *m_dec; -From 8f077b7937e519bbe44a02c3559808672696903e Mon Sep 17 00:00:00 2001 +From 8bf8dffb44284741978fd9492d80f3502fabe4b2 Mon Sep 17 00:00:00 2001 From: anaconda Date: Wed, 25 Feb 2015 18:22:21 +0100 -Subject: [PATCH 29/58] Load OSD dialogs on startup. +Subject: [PATCH 29/78] 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. @@ -1633,10 +2687,10 @@ index 9f25fa5..3ece45b 100644 CGUIDialogVideoSettings::~CGUIDialogVideoSettings() { } -From 2c96de41d5df402113fb6f675c5c6766ad48b267 Mon Sep 17 00:00:00 2001 +From a94b96aed5604f9612ab5cf13f6aecd44dba8ffb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 7 Mar 2015 22:46:21 +0000 -Subject: [PATCH 30/58] configure: Add raspberry-pi2 platform +Subject: [PATCH 30/78] configure: Add raspberry-pi2 platform --- configure.ac | 14 +++++++-- @@ -1648,7 +2702,7 @@ Subject: [PATCH 30/58] configure: Add raspberry-pi2 platform 6 files changed, 44 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac -index 71883d2..6beec97 100644 +index cf945a0..ab4214f 100644 --- a/configure.ac +++ b/configure.ac @@ -744,8 +744,17 @@ case $use_platform in @@ -1810,10 +2864,10 @@ index cdc2fe4..379bd1d 100644 set(CMAKE_SYSTEM_NAME Linux) endif() -From ecf7d1b7364dd7cb121825168aa51a6b14946614 Mon Sep 17 00:00:00 2001 +From 25ca4c7c98f464dfcea7e70e589f21297fab2713 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 10 Mar 2015 17:05:18 +0000 -Subject: [PATCH 31/58] [players] Add settings option to enable MVC support +Subject: [PATCH 31/78] [players] Add settings option to enable MVC support --- addons/resource.language.en_gb/resources/strings.po | 10 ++++++++++ @@ -1823,10 +2877,10 @@ Subject: [PATCH 31/58] [players] Add settings option to enable MVC support 4 files changed, 27 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index a794cd8..acb6372 100644 +index 9f2eb3c..bf956f7 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16680,6 +16680,16 @@ msgctxt "#38052" +@@ -16703,6 +16703,16 @@ msgctxt "#38052" msgid "Remote button press release time (ms)" msgstr "" @@ -1894,10 +2948,10 @@ index e4f6d86..5d324f4 100644 case AV_CODEC_ID_MPEG4: // (role name) video_decoder.mpeg4 -From 7c831c1cf47b62ee6ea8d57457b4b5ee35f29882 Mon Sep 17 00:00:00 2001 +From 8daeaefb1120ce7ff4a5ed29c32dfeba07a8d7e0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Mar 2015 12:38:08 +0000 -Subject: [PATCH 32/58] [mmalrenderer] Switch to using transform flags for 3d +Subject: [PATCH 32/78] [mmalrenderer] Switch to using transform flags for 3d modes --- @@ -1911,10 +2965,10 @@ Subject: [PATCH 32/58] [mmalrenderer] Switch to using transform flags for 3d 7 files changed, 75 insertions(+), 130 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index acb6372..e1b691d 100644 +index bf956f7..530d882 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16690,6 +16690,16 @@ msgctxt "#38111" +@@ -16713,6 +16713,16 @@ msgctxt "#38111" msgid "This option decodes frames for both eyes of MVC video. Disabling may improve performance if you don't require 3D" msgstr "" @@ -2276,11 +3330,10 @@ index c80114e..3816b55 100644 CLog::Log(LOGDEBUG, "EGL set resolution %dx%d -> %dx%d @ %.2f fps (%d,%d) flags:%x aspect:%.2f\n", m_width, m_height, dst_rect.width, dst_rect.height, res.fRefreshRate, GETFLAGS_GROUP(res.dwFlags), GETFLAGS_MODE(res.dwFlags), (int)res.dwFlags, res.fPixelRatio); - -From 404462b4bf655a3dd1f50f619162839f47f6efaa Mon Sep 17 00:00:00 2001 +From 16c142faadaa31be66a296796daa6d6ac40b0cad Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 14 Apr 2015 20:51:14 +0100 -Subject: [PATCH 35/58] [gui] Also limit GUI updates when in non full-screen +Subject: [PATCH 35/78] [gui] Also limit GUI updates when in non full-screen video mode --- @@ -2310,10 +3363,10 @@ index a2a7fd2..95ec768 100644 g_windowManager.FrameMove(); } -From f83aef5f43795b2e08d87dc1ba8723bd7c7f09a2 Mon Sep 17 00:00:00 2001 +From fc48d8306d53e54cef1467ce09de7a07f223f632 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:24:42 +0200 -Subject: [PATCH 36/58] Added some vc_tv_* functions that were missing in +Subject: [PATCH 36/78] Added some vc_tv_* functions that were missing in DllBCM. --- @@ -2348,10 +3401,10 @@ index b92fdb8..9c7e293 100644 HDMI_INTERLACED_T scan_mode, EDID_MODE_MATCH_FLAG_T match_flags) { return ::vc_tv_hdmi_power_on_best(width, height, frame_rate, scan_mode, match_flags); }; -From f72df42ab7b2987446c08230917f59391f58c1ef Mon Sep 17 00:00:00 2001 +From b5abdd3df0fdd4bf3efbd79fe891921cd300885a Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:29:03 +0200 -Subject: [PATCH 37/58] Added private utility function to map a float display +Subject: [PATCH 37/78] Added private utility function to map a float display aspect, to the respective SDTV_ASPECT_* enum value. --- @@ -2400,10 +3453,10 @@ index 3816b55..520bf95 100644 bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &resolutions) -From dbb24dacba5c40c0d536f4f71f5ac8b3b01fab41 Mon Sep 17 00:00:00 2001 +From 1d7dac8976e95b11aa39936fd5260cd30567dcd9 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:50:58 +0200 -Subject: [PATCH 38/58] Changed SDTV resolutions to be treated similarly to +Subject: [PATCH 38/78] Changed SDTV resolutions to be treated similarly to HDMI resolutions in SetNativeResolution. This means that the SDTV interface is powered up and set to the right mode. @@ -2500,10 +3553,10 @@ index 59401f5..a0acb1a 100644 int m_width; int m_height; -From 06f189a4535e06b3d21f89e43b7caee7dedbe0d3 Mon Sep 17 00:00:00 2001 +From c7bfece4cf2a4febe45cf1f5beae412307e93f3a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 17:11:09 +0100 -Subject: [PATCH 39/58] Revert "[3D] don't back out from 3D handling on +Subject: [PATCH 39/78] Revert "[3D] don't back out from 3D handling on resolution changes if we're switching to a different 3D mode" This reverts commit 3c4c236a799dab8369b4bb74ff9993bc58a61a72. @@ -2538,10 +3591,10 @@ index bd7dff9..fc4cc95 100644 if(stereo_mode != m_stereoMode) -From 445dce97603e36fadc97ee3d479abe6f581f6a07 Mon Sep 17 00:00:00 2001 +From c988d3d6608cd13ed2534315ed3bf730d2ddba2c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 10 Jun 2015 20:42:03 +0100 -Subject: [PATCH 40/58] [rbp] Fix zoom modes with stereoscopic videos +Subject: [PATCH 40/78] [rbp] Fix zoom modes with stereoscopic videos --- xbmc/cores/VideoRenderers/MMALRenderer.cpp | 12 ++++++++++-- @@ -2597,10 +3650,10 @@ index ba17a46..298eaff 100644 if (gui != display) { -From 84bc87e546d79c342b8a7c169f81e8521611cdb3 Mon Sep 17 00:00:00 2001 +From 72029e483a5d1ff5dbf7a1eda6f02b2755bc6ed4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 17:42:03 +0100 -Subject: [PATCH 41/58] [WinSystemEGL] Remove unused Support3D function +Subject: [PATCH 41/78] [WinSystemEGL] Remove unused Support3D function --- xbmc/windowing/egl/WinSystemEGL.cpp | 29 ----------------------------- @@ -2660,10 +3713,10 @@ index 9d4baf6..1ec4225 100644 EGLConfig GetEGLConfig(); -From 1597e6d82c667d55a763e965cb1e6448e0fbc01e Mon Sep 17 00:00:00 2001 +From bbe2c4e3962048ecd493268e586b86749af9e038 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 16 Apr 2014 21:18:06 +0100 -Subject: [PATCH 42/58] [omxplayer] Don't propagate 3d flags based on supported +Subject: [PATCH 42/78] [omxplayer] Don't propagate 3d flags based on supported 3d modes --- @@ -2719,10 +3772,10 @@ index 298eaff..3bf7c2e 100644 unsigned int iDisplayHeight = height; -From abadc22d9bed0fdf91c3a5be16dd07d8aa8d9f79 Mon Sep 17 00:00:00 2001 +From 0a56a42e0a89375e00451fd0727742bb897f4090 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 18:52:28 +0100 -Subject: [PATCH 43/58] [3d] Avoid switching stereo mode based on current +Subject: [PATCH 43/78] [3d] Avoid switching stereo mode based on current display mode --- @@ -2762,10 +3815,10 @@ index fc4cc95..e18232e 100644 RESOLUTION_INFO info_mod = GetResInfo(res); -From ecb3cd064f5df496cbf685eec4c4d680c3c79704 Mon Sep 17 00:00:00 2001 +From a96d0b58fb180abb244b7bdd73ddca8ab5c99f9c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jun 2015 23:13:51 +0100 -Subject: [PATCH 44/58] [rpi] Always add desktop resolution to supported list +Subject: [PATCH 44/78] [rpi] Always add desktop resolution to supported list There was an assumption that the desktop resolution would be in the probed list, but that is sometimes not the case. We don't add interlaced resolutions to list, but they can be the preferred resolution read from edid. See: @@ -2834,10 +3887,10 @@ index a1f67fd..69ce9b7 100644 CLog::Log(LOGDEBUG, "EGL mode %d: %s (%.2f) %s%s:%x\n", i, res.strMode.c_str(), res.fPixelRatio, tv->native ? "N" : "", tv->scan_mode ? "I" : "", tv->code); -From 71f32189c08f3001e0a00f3d21d799eb7b0ac9ba Mon Sep 17 00:00:00 2001 +From 5d0ec460e72d1265a001e609618852d56918feae Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 18:53:29 +0100 -Subject: [PATCH 45/58] [rbp] Drop reporting 3D modes and just use current +Subject: [PATCH 45/78] [rbp] Drop reporting 3D modes and just use current rendering mode to request 3D signalling --- @@ -2994,10 +4047,10 @@ index 69ce9b7..25a97ad 100644 } if (supported_modes) -From 23e4fb99f6f4ad1cc969cc8361dc55338769419f Mon Sep 17 00:00:00 2001 +From ad622b30e433dcdc0ea015fd46cb75fb1c73afe4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 30 Jun 2015 14:08:24 +0100 -Subject: [PATCH 46/58] [rbp] Ignore video stereo mode when 3D display mode is +Subject: [PATCH 46/78] [rbp] Ignore video stereo mode when 3D display mode is disabled --- @@ -3036,10 +4089,10 @@ index 3bf7c2e..5f6b402 100644 if (m_hints.orientation == 90 || m_hints.orientation == 270) { -From 72e7fc2a4f0701ce47e624c5c73f457ae8db93fd Mon Sep 17 00:00:00 2001 +From 78f4bccdbd9ef9509d7a704e08359a72a49416b0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 Jun 2015 16:27:15 +0100 -Subject: [PATCH 47/58] [EGL] Don't skip out when HDMI mode is considered the +Subject: [PATCH 47/78] [EGL] Don't skip out when HDMI mode is considered the same It might have different 3D signalling. TODO: keep track of 3D signalling @@ -3061,10 +4114,10 @@ index c43c4d0..13b75b1 100644 m_bFullScreen = fullScreen; -From 9747f3d0ba4d3fabe46c35ceaeb74d2ee5daf547 Mon Sep 17 00:00:00 2001 +From b7f37a646000c97a9bb5519624ec34857cb7ad42 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 21 Apr 2015 14:32:07 +0100 -Subject: [PATCH 48/58] [mmalrenderer] Add sharpness control +Subject: [PATCH 48/78] [mmalrenderer] Add sharpness control --- addons/resource.language.en_gb/resources/strings.po | 2 +- @@ -3073,7 +4126,7 @@ Subject: [PATCH 48/58] [mmalrenderer] Add sharpness control 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 6d861c1..c41b177 100644 +index 26ac2d7..f06ced6 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -7503,7 +7503,7 @@ msgstr "" @@ -3136,17 +4189,17 @@ index 1404fb3..9bced7e 100644 CCriticalSection m_sharedSection; MMAL_COMPONENT_T *m_vout; -From 7995698144c5b5c44dd9f4f80f17fa7803962586 Mon Sep 17 00:00:00 2001 +From bea8f5136835083a1cad4f7afdaad417d7c9d2ec Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 24 Apr 2015 13:49:51 +0100 -Subject: [PATCH 49/58] [dvdplayer] Add back required include +Subject: [PATCH 49/78] [dvdplayer] Add back required include --- xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 9be8aae..ebec92d 100644 +index fe3b2c2..73e9ce6 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -33,6 +33,7 @@ @@ -3158,10 +4211,10 @@ index 9be8aae..ebec92d 100644 #include "guilib/GraphicContext.h" #include -From 9cb45bcb661cf5de4814e304706d982352453f48 Mon Sep 17 00:00:00 2001 +From 57bd1fdf720099a9614cb65404800b093e59677e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 5 May 2015 23:58:06 +0100 -Subject: [PATCH 50/58] [screensaver] Leave GUI contents available for +Subject: [PATCH 50/78] [screensaver] Leave GUI contents available for screensaver --- @@ -3169,7 +4222,7 @@ Subject: [PATCH 50/58] [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 ba33908..17ea269 100644 +index 6030c4c..ccc2922 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -796,7 +796,16 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const vector Date: Fri, 15 May 2015 14:04:11 +0100 -Subject: [PATCH 52/58] [omxplayer] Make unsupported when ac3transcode is +Subject: [PATCH 52/78] [omxplayer] Make unsupported when ac3transcode is enabled --- @@ -3219,10 +4272,10 @@ index eff47e0..b954276 100644 { // find video stream -From 8294881aca9494a55c30f7347599779fe770c50d Mon Sep 17 00:00:00 2001 +From 0ba2a4632d72a370b06a633f2389d9cef26ade0b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 1 Jun 2015 14:14:43 +0100 -Subject: [PATCH 53/58] [omximage] Don't report failed decode of progressive +Subject: [PATCH 53/78] [omximage] Don't report failed decode of progressive jpegs as as error --- @@ -3308,10 +4361,10 @@ index a43a446..890ca88 100644 } -From 61003a22eb36823420523a2d3df994e1222e0cea Mon Sep 17 00:00:00 2001 +From 1fcc7db8cdd957520fd2891efd339ca22c8041a0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 25 May 2015 19:01:00 +0100 -Subject: [PATCH 54/58] [rbp] Allow settings option for timestamp preference +Subject: [PATCH 54/78] [rbp] Allow settings option for timestamp preference We currently have some files that play better with pts timestamps and some that play better with dts timestamps Provide a gui setting to allow users to adjust this behaviour until we have a better solution @@ -3323,10 +4376,10 @@ Provide a gui setting to allow users to adjust this behaviour until we have a be 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 0138e5f..2d043ec 100644 +index eb31d58..a631d80 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16714,3 +16714,13 @@ msgstr "" +@@ -16737,3 +16737,13 @@ msgstr "" msgctxt "#38121" msgid "This option supports 8 channel DTS HD decoding, but may use more CPU. It is only available when DTS and DTS-HD audio passthrough is disabled" msgstr "" @@ -3385,10 +4438,10 @@ index 5f6b402..ce23bec 100644 if (pts == DVD_NOPTS_VALUE) pts = dts; -From 9fc7a4289b865202e2b8d4ac9bc8174e1001e1ad Mon Sep 17 00:00:00 2001 +From 1a903b160ef9ffe7863809dcd9823ce988b14985 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 6 Jun 2015 18:44:37 +0100 -Subject: [PATCH 55/58] [rbp] Ignore pts value when m_hints.ptsinvalid set +Subject: [PATCH 55/78] [rbp] Ignore pts value when m_hints.ptsinvalid set --- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- @@ -3422,10 +4475,10 @@ index ce23bec..e17fdb8 100644 if (pts == DVD_NOPTS_VALUE) pts = dts; -From 08b2eeaffdfdd1dc124ee3eb2f5a21b664074eca Mon Sep 17 00:00:00 2001 +From ad59ec8d6c5a9ea0d19cd5811328d248c91d6fee Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 6 Jun 2015 18:43:57 +0100 -Subject: [PATCH 56/58] ffmpeg: Automatic switch to software decode for GMC +Subject: [PATCH 56/78] ffmpeg: Automatic switch to software decode for GMC with more than one warp point --- @@ -3596,10 +4649,10 @@ index b954276..b5ee4b6 100644 else if ((hint.codec == AV_CODEC_ID_VC1 || hint.codec == AV_CODEC_ID_WMV3) && g_RBP.GetCodecWvc1()) supported = true; -From e51804ed122dd0a642104d102315787970fffb8d Mon Sep 17 00:00:00 2001 +From d2e8678eee1dbe76045263a5e9d4717a1b38317d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 Jun 2015 21:46:57 +0100 -Subject: [PATCH 57/58] [rbp] Use default resampling setting on Pi2 +Subject: [PATCH 57/78] [rbp] Use default resampling setting on Pi2 --- system/settings/rbp2.xml | 5 +++++ @@ -3622,10 +4675,10 @@ index b29a428..1c8b116 100644
-From 175260bab79c330366834bd86512afc2902dba0a Mon Sep 17 00:00:00 2001 +From 4fee25bba08a77b13f2892f587cf30ee8f402c41 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 25 Jun 2015 19:43:10 +0100 -Subject: [PATCH 58/58] [rbp] HW mouse pointer +Subject: [PATCH 58/78] [rbp] HW mouse pointer Updating the mouse point provokes a complete screen update which can make it feel laggy and results in high cpu. @@ -3644,7 +4697,7 @@ Requires recent firmware. create mode 100644 xbmc/linux/rpi_user_vcsm.h diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp -index 17ea269..6965319 100644 +index ccc2922..7bcda5c 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -193,7 +193,9 @@ void CGUIWindowManager::CreateWindows() @@ -4662,3 +5715,1068 @@ index f6c8df0..5c2b583 100644 }; #endif + +From 58fc811ecf11a4d58f09dd6146acf6031e17cd44 Mon Sep 17 00:00:00 2001 +From: Roman Kraevskiy +Date: Fri, 10 Jul 2015 23:36:34 +0300 +Subject: [PATCH 59/78] Mouse wheel support for X11-less linux distros + (openelec) + +--- + xbmc/input/linux/LinuxInputDevices.cpp | 125 +++++++++++++++++++++------------ + xbmc/input/linux/LinuxInputDevices.h | 2 + + 2 files changed, 82 insertions(+), 45 deletions(-) + +diff --git a/xbmc/input/linux/LinuxInputDevices.cpp b/xbmc/input/linux/LinuxInputDevices.cpp +index 32a3b46..b028cd1 100644 +--- a/xbmc/input/linux/LinuxInputDevices.cpp ++++ b/xbmc/input/linux/LinuxInputDevices.cpp +@@ -558,22 +558,27 @@ bool CLinuxInputDevice::KeyEvent(const struct input_event& levt, XBMC_Event& dev + */ + bool CLinuxInputDevice::RelEvent(const struct input_event& levt, XBMC_Event& devt) + { ++ bool motion = false; ++ bool wheel = false; ++ + switch (levt.code) + { + case REL_X: + m_mouseX += levt.value; + devt.motion.xrel = levt.value; + devt.motion.yrel = 0; ++ motion = true; + break; +- + case REL_Y: + m_mouseY += levt.value; + devt.motion.xrel = 0; + devt.motion.yrel = levt.value; ++ motion = true; + break; +- +- case REL_Z: + case REL_WHEEL: ++ wheel = (levt.value != 0); // process wheel event only when there was some delta ++ break; ++ case REL_Z: + default: + CLog::Log(LOGWARNING, "CLinuxInputDevice::RelEvent: Unknown rel event code: %d\n", levt.code); + return false; +@@ -588,13 +593,35 @@ bool CLinuxInputDevice::RelEvent(const struct input_event& levt, XBMC_Event& dev + m_mouseY = std::max(0, m_mouseY); + + +- devt.type = XBMC_MOUSEMOTION; +- devt.motion.type = XBMC_MOUSEMOTION; +- devt.motion.x = m_mouseX; +- devt.motion.y = m_mouseY; +- devt.motion.state = 0; +- devt.motion.which = m_deviceIndex; +- ++ if (motion) ++ { ++ devt.type = XBMC_MOUSEMOTION; ++ devt.motion.type = XBMC_MOUSEMOTION; ++ devt.motion.x = m_mouseX; ++ devt.motion.y = m_mouseY; ++ devt.motion.state = 0; ++ devt.motion.which = m_deviceIndex; ++ } ++ else if (wheel) ++ { ++ devt.type = XBMC_MOUSEBUTTONUP; ++ devt.button.state = XBMC_RELEASED; ++ devt.button.type = devt.type; ++ devt.button.x = m_mouseX; ++ devt.button.y = m_mouseY; ++ devt.button.button = (levt.value<0) ? XBMC_BUTTON_WHEELDOWN:XBMC_BUTTON_WHEELUP; ++ ++ /* but WHEEL up enent to the queue */ ++ m_equeue.push_back(devt); ++ ++ /* prepare and return WHEEL down event */ ++ devt.button.state = XBMC_PRESSED; ++ devt.type = XBMC_MOUSEBUTTONDOWN; ++ } ++ else ++ { ++ return false; ++ } + + return true; + } +@@ -693,57 +720,65 @@ XBMC_Event CLinuxInputDevice::ReadEvent() + + XBMC_Event devt; + +- while (1) ++ if (m_equeue.empty()) + { +- bzero(&levt, sizeof(levt)); ++ while (1) ++ { ++ bzero(&levt, sizeof(levt)); + +- bzero(&devt, sizeof(devt)); +- devt.type = XBMC_NOEVENT; ++ bzero(&devt, sizeof(devt)); ++ devt.type = XBMC_NOEVENT; + +- if(m_devicePreferredId == LI_DEVICE_NONE) +- return devt; ++ if(m_devicePreferredId == LI_DEVICE_NONE) ++ return devt; + +- readlen = read(m_fd, &levt, sizeof(levt)); ++ readlen = read(m_fd, &levt, sizeof(levt)); + +- if (readlen <= 0) +- { +- if (errno == ENODEV) ++ if (readlen <= 0) + { +- CLog::Log(LOGINFO,"input device was unplugged %s",m_deviceName); +- m_bUnplugged = true; ++ if (errno == ENODEV) ++ { ++ CLog::Log(LOGINFO,"input device was unplugged %s",m_deviceName); ++ m_bUnplugged = true; ++ } ++ ++ break; + } + +- break; +- } ++ //printf("read event readlen = %d device name %s m_fileName %s\n", readlen, m_deviceName, m_fileName.c_str()); + +- //printf("read event readlen = %d device name %s m_fileName %s\n", readlen, m_deviceName, m_fileName.c_str()); ++ // sanity check if we realy read the event ++ if(readlen != sizeof(levt)) ++ { ++ printf("CLinuxInputDevice: read error : %s\n", strerror(errno)); ++ break; ++ } + +- // sanity check if we realy read the event +- if(readlen != sizeof(levt)) +- { +- printf("CLinuxInputDevice: read error : %s\n", strerror(errno)); +- break; +- } ++ if (!TranslateEvent(levt, devt)) ++ continue; + +- if (!TranslateEvent(levt, devt)) +- continue; ++ /* Flush previous event with DIEF_FOLLOW? */ ++ if (devt.type != XBMC_NOEVENT) ++ { ++ //printf("new event! type = %d\n", devt.type); ++ //printf("key: %d %d %d %c\n", devt.key.keysym.scancode, devt.key.keysym.sym, devt.key.keysym.mod, devt.key.keysym.unicode); + +- /* Flush previous event with DIEF_FOLLOW? */ +- if (devt.type != XBMC_NOEVENT) +- { +- //printf("new event! type = %d\n", devt.type); +- //printf("key: %d %d %d %c\n", devt.key.keysym.scancode, devt.key.keysym.sym, devt.key.keysym.mod, devt.key.keysym.unicode); ++ if (m_hasLeds && (m_keyMods != m_lastKeyMods)) ++ { ++ SetLed(LED_NUML, m_keyMods & XBMCKMOD_NUM); ++ SetLed(LED_CAPSL, m_keyMods & XBMCKMOD_CAPS); ++ m_lastKeyMods = m_keyMods; ++ } + +- if (m_hasLeds && (m_keyMods != m_lastKeyMods)) +- { +- SetLed(LED_NUML, m_keyMods & XBMCKMOD_NUM); +- SetLed(LED_CAPSL, m_keyMods & XBMCKMOD_CAPS); +- m_lastKeyMods = m_keyMods; ++ break; + } +- +- break; + } + } ++ else ++ { ++ devt = m_equeue.front(); ++ m_equeue.pop_front(); ++ } + + return devt; + } +diff --git a/xbmc/input/linux/LinuxInputDevices.h b/xbmc/input/linux/LinuxInputDevices.h +index cf1c5ce..954d823 100644 +--- a/xbmc/input/linux/LinuxInputDevices.h ++++ b/xbmc/input/linux/LinuxInputDevices.h +@@ -22,6 +22,7 @@ + + #include + #include ++#include + #include "windowing/XBMC_events.h" + #include "input/XBMC_keyboard.h" + #include "threads/SingleLock.h" +@@ -79,6 +80,7 @@ class CLinuxInputDevice + int m_deviceMaxAxis; + bool m_bSkipNonKeyEvents; + bool m_bUnplugged; ++ std::deque m_equeue; + }; + + class CLinuxInputDevices + +From 6680f853007efce192edf2ce2a9b1cf88158c647 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 22 Jun 2015 22:06:53 +0100 +Subject: [PATCH 60/78] [rbp] Flip default of prefer pts timestamps + +--- + system/settings/rbp.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index 8c6e69d..f9528bc 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -45,7 +45,7 @@ + + + 3 +- false ++ true + + + + +From 1bbcc8240084f5a5fdd76ed25217f0598b30da0a Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 7 May 2015 14:28:37 +0100 +Subject: [PATCH 61/78] build: Add vcsm lib + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 084c2cf..98a1b26 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1059,7 +1059,7 @@ if test "$use_gles" = "yes"; then + AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."]) + AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."]) + AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.) +- LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util" ++ LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm" + else + AC_CHECK_LIB([EGL], [main],, AC_MSG_ERROR($missing_library)) + AC_CHECK_LIB([GLESv2],[main],, AC_MSG_ERROR($missing_library)) + +From aab122b6015b5274836cb1f6e59229f21e7cc72c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 20 Jul 2015 16:11:37 +0100 +Subject: [PATCH 62/78] [mmalcodec] Populate the framerate of video decoder + +When timestamps are unknown, they may be interpolated based on the framerate. Without setting this, +a default of 30fps is used which may be incorrect and cause stutters +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 3e97f1d..5b064d2 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -629,6 +629,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + m_dec_input->format->es->video.width = ALIGN_UP(m_hints.width, 32); + m_dec_input->format->es->video.height = ALIGN_UP(m_hints.height, 16); + } ++ if (hints.fpsrate > 0 && hints.fpsscale > 0) ++ { ++ m_dec_input->format->es->video.frame_rate.num = hints.fpsrate; ++ m_dec_input->format->es->video.frame_rate.den = hints.fpsscale; ++ } + m_dec_input->format->flags |= MMAL_ES_FORMAT_FLAG_FRAMED; + + error_concealment.hdr.id = MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT; + +From c448fb336cd6b7e07dae7dc0b1c357da26f2d0f5 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 22 Jul 2015 22:52:46 +0100 +Subject: [PATCH 63/78] [mmalcodec] Enable interpolate timestamps + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 5b064d2..a202421 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -647,7 +647,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + if (status != MMAL_SUCCESS) + CLog::Log(LOGERROR, "%s::%s Failed to enable extra buffers on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); + +- status = mmal_port_parameter_set_uint32(m_dec_input, MMAL_PARAMETER_VIDEO_INTERPOLATE_TIMESTAMPS, 0); ++ status = mmal_port_parameter_set_uint32(m_dec_input, MMAL_PARAMETER_VIDEO_INTERPOLATE_TIMESTAMPS, 1); + if (status != MMAL_SUCCESS) + CLog::Log(LOGERROR, "%s::%s Failed to disable interpolate timestamps mode on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); + + +From e5e72775474a6c93f8dc776331e123ea77bd7e88 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 23 Jul 2015 00:55:47 +0100 +Subject: [PATCH 64/78] Revert "[rbp] Flip default of prefer pts timestamps" + +This reverts commit 34100dcdf830a0e957df585108066c48d6c5c38d. +--- + system/settings/rbp.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index f9528bc..8c6e69d 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -45,7 +45,7 @@ + + + 3 +- true ++ false + + + + +From 4e8844c1c9c32823ae7ca342982e1b355dfee132 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 23 Jul 2015 00:56:56 +0100 +Subject: [PATCH 65/78] Revert "[rbp] Allow settings option for timestamp + preference" + +This reverts commit c0eef926dd376cbf8a7857b2848e118ea3689b98. +--- + addons/resource.language.en_gb/resources/strings.po | 10 ---------- + system/settings/rbp.xml | 7 ------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- + xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 2 +- + 4 files changed, 2 insertions(+), 19 deletions(-) + +diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po +index a631d80..eb31d58 100644 +--- a/addons/resource.language.en_gb/resources/strings.po ++++ b/addons/resource.language.en_gb/resources/strings.po +@@ -16737,13 +16737,3 @@ msgstr "" + msgctxt "#38121" + msgid "This option supports 8 channel DTS HD decoding, but may use more CPU. It is only available when DTS and DTS-HD audio passthrough is disabled" + msgstr "" +- +-#: system/settings/rbp.xml +-msgctxt "#38210" +-msgid "Prefer PTS timestamps" +-msgstr "" +- +-#: system/settings/rbp.xml +-msgctxt "#38211" +-msgid "Try enabling this if you have stutter with video files" +-msgstr "" +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index 8c6e69d..b27d23f 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -42,13 +42,6 @@ + +
+ +- +- +- 3 +- false +- +- +- + + + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index a202421..5d054bb 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -804,7 +804,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + pts = 0; + buffer->pts = pts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : pts; + buffer->dts = dts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : dts; +- if (m_hints.ptsinvalid || (buffer->dts != MMAL_TIME_UNKNOWN && !CSettings::Get().GetBool("videoplayer.preferptstimestamps"))) buffer->pts = MMAL_TIME_UNKNOWN; ++ if (m_hints.ptsinvalid) buffer->pts = MMAL_TIME_UNKNOWN; + buffer->length = demuxer_bytes > buffer->alloc_size ? buffer->alloc_size : demuxer_bytes; + // set a flag so we can identify primary frames from generated frames (deinterlace) + buffer->flags = MMAL_BUFFER_HEADER_FLAG_USER0; +diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +index e17fdb8..f06ee9c 100644 +--- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp ++++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +@@ -495,7 +495,7 @@ void OMXPlayerVideo::Process() + if (pts != DVD_NOPTS_VALUE) + pts += m_iVideoDelay; + +- m_omxVideo.Decode(pPacket->pData, pPacket->iSize, dts, m_hints.ptsinvalid || (dts != DVD_NOPTS_VALUE && !CSettings::Get().GetBool("videoplayer.preferptstimestamps")) ? DVD_NOPTS_VALUE : pts); ++ m_omxVideo.Decode(pPacket->pData, pPacket->iSize, dts, m_hints.ptsinvalid ? DVD_NOPTS_VALUE : pts); + + if (pts == DVD_NOPTS_VALUE) + pts = dts; + +From 0f328c607bcbecb752f06752996146d92bfcdd7d Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 23 Jul 2015 15:52:39 +0100 +Subject: [PATCH 66/78] [omxhelper] Ignore embedded coverart image when looking + for supported video streams + +--- + xbmc/cores/omxplayer/OMXHelper.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp +index b5ee4b6..59479fe 100644 +--- a/xbmc/cores/omxplayer/OMXHelper.cpp ++++ b/xbmc/cores/omxplayer/OMXHelper.cpp +@@ -72,7 +72,7 @@ bool OMXPlayerUnsuitable(bool m_HasVideo, bool m_HasAudio, CDVDDemux* m_pDemuxer + { + int iStream = it->id; + CDemuxStream *stream = m_pDemuxer->GetStream(iStream); +- if(!stream || stream->disabled) ++ if(!stream || stream->disabled || stream->flags & AV_DISPOSITION_ATTACHED_PIC) + continue; + CDVDStreamInfo hint(*stream, true); + +From fc3e55399cf44677546fde77958e96a455015f1c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 24 Jul 2015 18:39:25 +0100 +Subject: [PATCH 68/78] [mmalcodec] Don't set initial unknown timestamps to + zero + +This used to be done to keep the firmware happy, but is no longer required and messes with timestamp statistics +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 8 -------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 - + 2 files changed, 9 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 5d054bb..b2ac68f 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -106,7 +106,6 @@ CMMALVideo::CMMALVideo() + + m_interlace_mode = MMAL_InterlaceProgressive; + m_interlace_method = VS_INTERLACEMETHOD_NONE; +- m_startframe = false; + m_decoderPts = DVD_NOPTS_VALUE; + + m_dec = NULL; +@@ -713,7 +712,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + return false; + + Prime(); +- m_startframe = false; + m_preroll = !m_hints.stills; + m_speed = DVD_PLAYSPEED_NORMAL; + +@@ -800,8 +798,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + mmal_buffer_header_reset(buffer); + buffer->cmd = 0; +- if (!m_startframe && pts == DVD_NOPTS_VALUE) +- pts = 0; + buffer->pts = pts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : pts; + buffer->dts = dts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : dts; + if (m_hints.ptsinvalid) buffer->pts = MMAL_TIME_UNKNOWN; +@@ -829,9 +825,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + if (demuxer_bytes == 0) + { +- pthread_mutex_lock(&m_output_mutex); +- m_startframe = true; +- pthread_mutex_unlock(&m_output_mutex); + EDEINTERLACEMODE deinterlace_request = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; + EINTERLACEMETHOD interlace_method = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); + +@@ -956,7 +949,6 @@ void CMMALVideo::Reset(void) + SendCodecConfigData(); + Prime(); + } +- m_startframe = false; + m_decoderPts = DVD_NOPTS_VALUE; + m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); + m_codecControlFlags = 0; +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index bde8c06..42d6a7b 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -127,7 +127,6 @@ class CMMALVideo : public CDVDVideoCodec + // Components + MMAL_INTERLACETYPE_T m_interlace_mode; + EINTERLACEMETHOD m_interlace_method; +- bool m_startframe; + double m_decoderPts; + int m_speed; + bool m_preroll; + +From fa541caf9b865c84267f4173ddbbc7125891551f Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 24 Jul 2015 22:53:21 +0100 +Subject: [PATCH 69/78] [mmalcodec] Tidy up setting of timestamp flags + +--- + xbmc/cores/omxplayer/OMXVideo.cpp | 27 ++++++++++++++------------- + 1 file changed, 14 insertions(+), 13 deletions(-) + +diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp +index 832a9c9..1a08aa9 100644 +--- a/xbmc/cores/omxplayer/OMXVideo.cpp ++++ b/xbmc/cores/omxplayer/OMXVideo.cpp +@@ -754,6 +754,19 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts) + + if (demuxer_content && demuxer_bytes > 0) + { ++ OMX_U32 nFlags = 0; ++ ++ if(m_setStartTime) ++ { ++ nFlags |= OMX_BUFFERFLAG_STARTTIME; ++ CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE); ++ m_setStartTime = false; ++ } ++ if (pts == DVD_NOPTS_VALUE && dts == DVD_NOPTS_VALUE) ++ nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN; ++ else if (pts == DVD_NOPTS_VALUE) ++ nFlags |= OMX_BUFFERFLAG_TIME_IS_DTS; ++ + while(demuxer_bytes) + { + // 500ms timeout +@@ -764,21 +777,9 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts) + return false; + } + +- omx_buffer->nFlags = 0; ++ omx_buffer->nFlags = nFlags; + omx_buffer->nOffset = 0; + omx_buffer->nTimeStamp = ToOMXTime((uint64_t)(pts != DVD_NOPTS_VALUE ? pts : dts != DVD_NOPTS_VALUE ? dts : 0)); +- +- if(m_setStartTime) +- { +- omx_buffer->nFlags |= OMX_BUFFERFLAG_STARTTIME; +- CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE); +- m_setStartTime = false; +- } +- else if (pts == DVD_NOPTS_VALUE && dts == DVD_NOPTS_VALUE) +- omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN; +- else if (pts == DVD_NOPTS_VALUE) +- omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_IS_DTS; +- + omx_buffer->nFilledLen = std::min((OMX_U32)demuxer_bytes, omx_buffer->nAllocLen); + memcpy(omx_buffer->pBuffer, demuxer_content, omx_buffer->nFilledLen); + + +From 4b4e9d07037b9c8174f9e94f0fc8e613f2e69b6c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Sat, 25 Jul 2015 15:32:35 +0100 +Subject: [PATCH 70/78] [rbp] Only send changes in hw cursor state + +--- + xbmc/linux/RBP.cpp | 9 ++++++++- + xbmc/linux/RBP.h | 5 ++++- + 2 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp +index 2c8d09b..3953740 100644 +--- a/xbmc/linux/RBP.cpp ++++ b/xbmc/linux/RBP.cpp +@@ -61,6 +61,9 @@ CRBP::CRBP() + m_OMX = new COMXCore(); + m_display = DISPMANX_NO_HANDLE; + m_p = NULL; ++ m_x = 0; ++ m_y = 0; ++ m_enabled = 0; + m_mb = mbox_open(); + vcsm_init(); + } +@@ -482,7 +485,11 @@ void CRBP::update_cursor(int x, int y, bool enabled) + int y2 = y * display.Height() / gui.Height(); + + //printf("%s %d,%d (%d)\n", __func__, x, y, enabled); +- mailbox_set_cursor_position(m_mb, enabled, x2, y2); ++ if (m_x != x2 || m_y != y2 || m_enabled != enabled) ++ mailbox_set_cursor_position(m_mb, enabled, x2, y2); ++ m_x = x2; ++ m_y = y2; ++ m_enabled = enabled; + } + + void CRBP::uninit_cursor() +diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h +index f233a5e..be0cafc 100644 +--- a/xbmc/linux/RBP.h ++++ b/xbmc/linux/RBP.h +@@ -86,7 +86,10 @@ class CRBP + + struct gpu_mem_ptr_s *m_p; + int m_mb; +-public: ++ int m_x; ++ int m_y; ++ bool m_enabled; ++ public: + void init_cursor(); + void set_cursor(const void *pixels, int width, int height, int hotspot_x, int hotspot_y); + void update_cursor(int x, int y, bool enabled); + +From ba118a42fd57aea853f2a869dc93f325eb20f8cb Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Jul 2015 00:08:58 +0100 +Subject: [PATCH 71/78] [mmalcodec] Use both dts and pts for determining amount + of queued data + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 10 ++++++++-- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 + + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index b2ac68f..6cf4023 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -107,6 +107,7 @@ CMMALVideo::CMMALVideo() + m_interlace_mode = MMAL_InterlaceProgressive; + m_interlace_method = VS_INTERLACEMETHOD_NONE; + m_decoderPts = DVD_NOPTS_VALUE; ++ m_demuxerPts = DVD_NOPTS_VALUE; + + m_dec = NULL; + m_dec_input = NULL; +@@ -853,7 +854,11 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + break; + } + int ret = 0; +- double queued = m_decoderPts != DVD_NOPTS_VALUE && pts != DVD_NOPTS_VALUE ? pts - m_decoderPts : 0.0; ++ if (pts != DVD_NOPTS_VALUE) ++ m_demuxerPts = pts; ++ else if (dts != DVD_NOPTS_VALUE) ++ m_demuxerPts = dts; ++ double queued = m_decoderPts != DVD_NOPTS_VALUE && m_demuxerPts != DVD_NOPTS_VALUE ? m_demuxerPts - m_decoderPts : 0.0; + if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !m_demux_queue_length && queued <= DVD_MSEC_TO_TIME(500)) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -950,6 +955,7 @@ void CMMALVideo::Reset(void) + Prime(); + } + m_decoderPts = DVD_NOPTS_VALUE; ++ m_demuxerPts = DVD_NOPTS_VALUE; + m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); + m_codecControlFlags = 0; + } +@@ -1043,7 +1049,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) + if (pDvdVideoPicture->pts != DVD_NOPTS_VALUE) + m_decoderPts = pDvdVideoPicture->pts; + else +- m_decoderPts = pDvdVideoPicture->dts; // xxx is DVD_NOPTS_VALUE better? ++ m_decoderPts = pDvdVideoPicture->dts; + + return true; + } +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index 42d6a7b..f8f5209 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -127,6 +127,7 @@ class CMMALVideo : public CDVDVideoCodec + // Components + MMAL_INTERLACETYPE_T m_interlace_mode; + EINTERLACEMETHOD m_interlace_method; ++ double m_demuxerPts; + double m_decoderPts; + int m_speed; + bool m_preroll; + +From e2c51d36ef4283b01faf81014f6df1c328d8cd97 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Jul 2015 17:47:33 +0100 +Subject: [PATCH 72/78] [rbp] Refactor the vsync handle to support multiple + callers + +--- + xbmc/linux/RBP.cpp | 68 ++++++++++++++++++++++++++++++------------------------ + xbmc/linux/RBP.h | 7 ++++-- + 2 files changed, 43 insertions(+), 32 deletions(-) + +diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp +index 3953740..901250e 100644 +--- a/xbmc/linux/RBP.cpp ++++ b/xbmc/linux/RBP.cpp +@@ -66,6 +66,7 @@ CRBP::CRBP() + m_enabled = 0; + m_mb = mbox_open(); + vcsm_init(); ++ m_vsync_count = 0; + } + + CRBP::~CRBP() +@@ -143,11 +144,45 @@ void CRBP::LogFirmwareVerison() + CLog::Log(LOGNOTICE, "Config:\n%s", response); + } + ++static void vsync_callback_static(DISPMANX_UPDATE_HANDLE_T u, void *arg) ++{ ++ CRBP *rbp = reinterpret_cast(arg); ++ rbp->VSyncCallback(); ++} ++ ++void CRBP::VSyncCallback() ++{ ++ CSingleLock lock(m_vsync_lock); ++ m_vsync_count++; ++ m_vsync_cond.notifyAll(); ++} ++ ++unsigned int CRBP::WaitVsync(unsigned int target) ++{ ++ CSingleLock lock(m_vsync_lock); ++ if (target == ~0U) ++ target = m_vsync_count+1; ++ ++ if (m_display == DISPMANX_NO_HANDLE) ++ { ++ CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); ++ return m_vsync_count; ++ } ++ ++ while (m_vsync_count < target) ++ if (!m_vsync_cond.wait(lock, 100)) ++ break; ++ ++ return m_vsync_count; ++} ++ + DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) + { + if (m_display == DISPMANX_NO_HANDLE) + { + m_display = vc_dispmanx_display_open( 0 /*screen*/ ); ++ int s = vc_dispmanx_vsync_callback(m_display, vsync_callback_static, (void *)this); ++ assert(s == 0); + init_cursor(); + } + return m_display; +@@ -156,9 +191,11 @@ DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) + void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display) + { + assert(display == m_display); ++ int s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); ++ assert(s == 0); ++ uninit_cursor(); + vc_dispmanx_display_close(m_display); + m_display = DISPMANX_NO_HANDLE; +- uninit_cursor(); + } + + void CRBP::GetDisplaySize(int &width, int &height) +@@ -211,35 +248,6 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw + return image; + } + +- +-static void vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *arg) +-{ +- CEvent *sync = (CEvent *)arg; +- sync->Set(); +-} +- +-void CRBP::WaitVsync() +-{ +- int s; +- DISPMANX_DISPLAY_HANDLE_T m_display = vc_dispmanx_display_open( 0 /*screen*/ ); +- if (m_display == DISPMANX_NO_HANDLE) +- { +- CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); +- return; +- } +- m_vsync.Reset(); +- s = vc_dispmanx_vsync_callback(m_display, vsync_callback, (void *)&m_vsync); +- if (s == 0) +- { +- m_vsync.WaitMSec(1000); +- } +- else assert(0); +- s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); +- assert(s == 0); +- vc_dispmanx_display_close( m_display ); +-} +- +- + void CRBP::Deinitialize() + { + if (m_omx_image_init) +diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h +index be0cafc..0572b47 100644 +--- a/xbmc/linux/RBP.h ++++ b/xbmc/linux/RBP.h +@@ -65,7 +65,8 @@ class CRBP + // stride can be null for packed output + unsigned char *CaptureDisplay(int width, int height, int *stride, bool swap_red_blue, bool video_only = true); + DllOMX *GetDllOMX() { return m_OMX ? m_OMX->GetDll() : NULL; } +- void WaitVsync(); ++ unsigned int WaitVsync(unsigned int target = ~0U); ++ void VSyncCallback(); + double AdjustHDMIClock(double adjust); + + private: +@@ -80,7 +81,9 @@ class CRBP + bool m_codec_wvc1_enabled; + COMXCore *m_OMX; + DISPMANX_DISPLAY_HANDLE_T m_display; +- CEvent m_vsync; ++ CCriticalSection m_vsync_lock; ++ XbmcThreads::ConditionVariable m_vsync_cond; ++ unsigned int m_vsync_count; + class DllLibOMXCore; + CCriticalSection m_critSection; + + +From 25b97dad714c40d7f5bc254237dfe303635dfc9c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 14:06:17 +0100 +Subject: [PATCH 73/78] [mmalrenderer] Wait for vsync before submitting to mmal + when display sync is disabled + +This avoids an issue where video occasionally goes stuttery after a seek, until the next pause/play or seek. +The issue is when display sync is disabled, and framerate of video matches display, and render times are coincident with vsync +you find that depending on timestamp/scheduling jitter, you may or may not get an update each vsync resulting in stuttery video. + +Some scheme to force render times to be dependent on vsync is required. We do this by blocking in RenderUpdate unto next vsync. +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 23 +++++++++++++++++++++-- + xbmc/cores/VideoRenderers/MMALRenderer.h | 2 ++ + 2 files changed, 23 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index fb92079..2e2bc83 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -208,6 +208,7 @@ CMMALRenderer::CMMALRenderer() + m_bMMALConfigured = false; + m_iYV12RenderBuffer = 0; + m_sharpness = -2.0f; ++ m_vsyncCount = ~0; + } + + CMMALRenderer::~CMMALRenderer() +@@ -357,6 +358,24 @@ void CMMALRenderer::Update() + ManageDisplay(); + } + ++void CMMALRenderer::SubmitFrame(MMAL_BUFFER_HEADER_T *buffer) ++{ ++ if (!CSettings::Get().GetBool("videoplayer.usedisplayasclock")) ++ { ++ if (fabs(m_fps - g_graphicsContext.GetFPS()) < 1e-2) ++ { ++ #if defined(MMAL_DEBUG_VERBOSE) ++ CLog::Log(LOGDEBUG, "%s::%s - buffer:%p vfps:%.3f dfps:%.3f vsync:%d dsync:%d", CLASSNAME, __func__, buffer, m_fps, g_graphicsContext.GetFPS(), m_vsyncCount, CSettings::Get().GetBool("videoplayer.usedisplayasclock")); ++ #endif ++ m_vsyncCount = g_RBP.WaitVsync(m_vsyncCount) + 1; ++ #if defined(MMAL_DEBUG_VERBOSE) ++ CLog::Log(LOGDEBUG, "%s::%s - done vsync:%d", CLASSNAME, __func__, m_vsyncCount); ++ #endif ++ } ++ } ++ mmal_port_send_buffer(m_vout_input, buffer); ++} ++ + void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + { + CSingleLock lock(m_sharedSection); +@@ -402,7 +421,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + return; + omvb->Acquire(); + omvb->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; +- mmal_port_send_buffer(m_vout_input, omvb->mmal_buffer); ++ SubmitFrame(omvb->mmal_buffer); + } + else + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); +@@ -417,7 +436,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + return; + // sanity check it is not on display + buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; +- mmal_port_send_buffer(m_vout_input, buffer->mmal_buffer); ++ SubmitFrame(buffer->mmal_buffer); + } + else + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h +index 9bced7e..ec279ed 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.h ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.h +@@ -99,6 +99,7 @@ class CMMALRenderer : public CBaseRenderer + unsigned int m_destWidth; + unsigned int m_destHeight; + int m_neededBuffers; ++ int m_vsyncCount; + + CRect m_src_rect; + CRect m_dst_rect; +@@ -115,4 +116,5 @@ class CMMALRenderer : public CBaseRenderer + bool init_vout(ERenderFormat format); + void ReleaseBuffers(); + void UnInitMMAL(); ++ void SubmitFrame(MMAL_BUFFER_HEADER_T *buffer); + }; + +From 76a3c63f0af369ff0bcf906f3890b67f9d03c3ff Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 15:07:22 +0100 +Subject: [PATCH 74/78] [omxplayer] Support per refresh rate display latency + settings + +--- + xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +index f06ee9c..4ad66a8 100644 +--- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp ++++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +@@ -490,10 +490,10 @@ void OMXPlayerVideo::Process() + double pts = pPacket->pts; + + if (dts != DVD_NOPTS_VALUE) +- dts += m_iVideoDelay; ++ dts += m_iVideoDelay - DVD_SEC_TO_TIME(g_renderManager.GetDisplayLatency()); + + if (pts != DVD_NOPTS_VALUE) +- pts += m_iVideoDelay; ++ pts += m_iVideoDelay - DVD_SEC_TO_TIME(g_renderManager.GetDisplayLatency()); + + m_omxVideo.Decode(pPacket->pData, pPacket->iSize, dts, m_hints.ptsinvalid ? DVD_NOPTS_VALUE : pts); + + +From b69979329ae249cb2ba4959d0bf59dcd2838054b Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 15:46:18 +0100 +Subject: [PATCH 75/78] squash: release gfx lock when blocking + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 2e2bc83..c80a8a6 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -367,6 +367,7 @@ void CMMALRenderer::SubmitFrame(MMAL_BUFFER_HEADER_T *buffer) + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - buffer:%p vfps:%.3f dfps:%.3f vsync:%d dsync:%d", CLASSNAME, __func__, buffer, m_fps, g_graphicsContext.GetFPS(), m_vsyncCount, CSettings::Get().GetBool("videoplayer.usedisplayasclock")); + #endif ++ CSingleExit lock(g_graphicsContext); + m_vsyncCount = g_RBP.WaitVsync(m_vsyncCount) + 1; + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - done vsync:%d", CLASSNAME, __func__, m_vsyncCount); + +From af3782bcc1597444ef517c6426edeab184ca7d9d Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 17:34:11 +0100 +Subject: [PATCH 76/78] [rbp] Leave 3D framepacking output disabled by default + +--- + system/settings/rbp.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index b27d23f..bf3b05f 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -38,7 +38,7 @@ + true + + 2 +- true ++ false + +
+ + +From 6ee5be10bfd9d9e3dd219a81191e0a5e94b4f990 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 17:26:30 +0100 +Subject: [PATCH 77/78] [omxplayer] Allow automatic switching back to omxplayer + after it has been disabled + +Omxplayer gets disabled when it is unsuitable (e.g. software decoder required, or ALSA audio or AC3 transcode). +However if you play another file without quitting dvdplayer, it doesn't reconsider. + +E.g. play divx3 file and omxplayer is disabled. If you then launch a h.264 file while first file is still playing it doesn't switch +back to omxplayer as you might expect. + +This patch allows a switch back to omxplayer mode +--- + xbmc/cores/dvdplayer/DVDPlayer.cpp | 5 +++-- + xbmc/cores/omxplayer/OMXHelper.cpp | 3 +++ + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp +index 8252192..f8e7570 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp +@@ -519,10 +519,11 @@ void CDVDPlayer::CreatePlayers() + { + CSingleLock lock(m_players_lock); + #ifdef HAS_OMXPLAYER +- if (m_omxplayer_mode && OMXPlayerUnsuitable(m_HasVideo, m_HasAudio, m_pDemuxer, m_pInputStream, m_SelectionStreams)) ++ bool omx_suitable = !OMXPlayerUnsuitable(m_HasVideo, m_HasAudio, m_pDemuxer, m_pInputStream, m_SelectionStreams); ++ if (m_omxplayer_mode != omx_suitable) + { + DestroyPlayers(); +- m_omxplayer_mode = false; ++ m_omxplayer_mode = omx_suitable; + } + #endif + if (m_players_created) +diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp +index 59479fe..014eaf1 100644 +--- a/xbmc/cores/omxplayer/OMXHelper.cpp ++++ b/xbmc/cores/omxplayer/OMXHelper.cpp +@@ -44,6 +44,9 @@ static bool PredicateVideoPriority(const SelectionStream& lh, const SelectionStr + + bool OMXPlayerUnsuitable(bool m_HasVideo, bool m_HasAudio, CDVDDemux* m_pDemuxer, CDVDInputStream* m_pInputStream, CSelectionStreams &m_SelectionStreams) + { ++ // if no OMXPlayer acceleration then it is not suitable ++ if (!CSettings::Get().GetBool("videoplayer.useomxplayer")) ++ return true; + // if no MMAL acceleration stick with omxplayer regardless + if (!CSettings::Get().GetBool("videoplayer.usemmal")) + return false; + +From c0678ee3627c08eac315da9c81187cc7bd61ff62 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 21:05:41 +0100 +Subject: [PATCH 78/78] [omxplayer] Set audio properties for passthrough + +We weren't setting the stream_channels property for passthrough for omxplayer (we do with Pi Sink) +That means we were using 2 in number of channels of the AudioInfoFrame packet, rather then 0 +which is 'refer to stream header' which is correct for passthrough +--- + xbmc/cores/omxplayer/OMXAudio.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp +index 1911189..4072f7d 100644 +--- a/xbmc/cores/omxplayer/OMXAudio.cpp ++++ b/xbmc/cores/omxplayer/OMXAudio.cpp +@@ -731,6 +731,8 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo + + m_wave_header.dwChannelMask = m_src_chan_layout; + } ++ else ++ SetAudioProps(m_Passthrough, 0); + + m_SampleRate = m_format.m_sampleRate; + m_BitsPerSample = CAEUtil::DataFormatToBits(m_format.m_dataFormat); diff --git a/projects/RPi2/patches/kodi/kodi-001-isengard-rpb-backports.patch b/projects/RPi2/patches/kodi/kodi-001-isengard-rpb-backports.patch index e1ec4be1b1..e3696ce176 100644 --- a/projects/RPi2/patches/kodi/kodi-001-isengard-rpb-backports.patch +++ b/projects/RPi2/patches/kodi/kodi-001-isengard-rpb-backports.patch @@ -1,7 +1,7 @@ -From d4dbab9f0c3bc4ab02ba312ba0d4aa9f41371fdf Mon Sep 17 00:00:00 2001 +From 132222ecf736483f8a28e3bcc79e203d2472f69f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 01/58] [rbp/omxplayer] When opening a stream don't try to +Subject: [PATCH 01/78] [rbp/omxplayer] When opening a stream don't try to update gui so often --- @@ -9,7 +9,7 @@ Subject: [PATCH 01/58] [rbp/omxplayer] When opening a stream don't try to 1 file changed, 4 insertions(+) diff --git a/xbmc/dialogs/GUIDialogBusy.cpp b/xbmc/dialogs/GUIDialogBusy.cpp -index 2faceea..889d7a2 100644 +index 318ecec..59698f6 100644 --- a/xbmc/dialogs/GUIDialogBusy.cpp +++ b/xbmc/dialogs/GUIDialogBusy.cpp @@ -68,7 +68,11 @@ bool CGUIDialogBusy::WaitOnEvent(CEvent &event, unsigned int displaytime /* = 10 @@ -25,10 +25,10 @@ index 2faceea..889d7a2 100644 g_windowManager.ProcessRenderLoop(false); if (allowCancel && dialog->IsCanceled()) -From 1ecf22c5b4c919e3aed5274c67f748bbae86fbf0 Mon Sep 17 00:00:00 2001 +From fbca4865a19906cb3e97c9322608ab095b12c9f7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 03/58] [hifiberry] Hack: force it to be recognised as IEC958 +Subject: [PATCH 03/78] [hifiberry] Hack: force it to be recognised as IEC958 capable to enable passthrough options --- @@ -51,10 +51,10 @@ index e22db7a..0120bd5 100644 info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") { -From ac054e5b5efd9ec9205598f9b7549a8e953272fd Mon Sep 17 00:00:00 2001 +From cc8731845cea144fc5de5192c54ae6fba29bfa52 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 04/58] Improved file buffering in CArchive +Subject: [PATCH 04/78] 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 @@ -114,20 +114,20 @@ index 6ed0f8f..8506d95 100644 } else -From 1a7d63a938850a884f08bd3af66808bef91b7588 Mon Sep 17 00:00:00 2001 +From 850fc8907cffcf06cd9be909bd810bbd241e3886 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 12 Aug 2014 00:31:36 +0100 -Subject: [PATCH 05/58] [omxcodec] Don't force software codec with dvds +Subject: [PATCH 05/78] [omxcodec] Don't force software codec with dvds --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 82b5baa..70b1ac3 100644 +index 9f45a22..e702c35 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -3421,7 +3421,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) +@@ -3417,7 +3417,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) hint.aspect = aspect; hint.forced_aspect = true; } @@ -138,10 +138,10 @@ index 82b5baa..70b1ac3 100644 else if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) { -From 47e9b3430cd67a4e9e17de65df96f9c0dbb7c39c Mon Sep 17 00:00:00 2001 +From a38ae3033670378db15e94fa36e7f6bbd5bb0e6d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 06/58] filesystem: Make support of browsing into archives +Subject: [PATCH 06/78] 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. @@ -159,10 +159,10 @@ We'll let people who don't use archives disable it manually 3 files changed, 18 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index ff32bfd..5345dc2 100644 +index faf423c..52117a2 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16582,6 +16582,15 @@ msgstr "" +@@ -16605,6 +16605,15 @@ msgstr "" #: system/settings/rbp.xml msgctxt "#38010" msgid "GPU accelerated" @@ -179,7 +179,7 @@ index ff32bfd..5345dc2 100644 #. Setting #38011 "Videos -> Library -> Show All Items entry" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 8f69bcb..cbcde85 100644 +index 3ef33e0..10e8552 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -304,6 +304,11 @@ @@ -224,10 +224,10 @@ index 5af92e7..568a1a8 100644 { // XBMC Smart playlist - just XML renamed to XSP // read the name of the playlist in -From e863fd0253902d92c56ed85e589bffadc98b245f Mon Sep 17 00:00:00 2001 +From 559b4641f94a1cac143b83562a3ed2d1c4839842 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 13:06:57 +0000 -Subject: [PATCH 08/58] [rbp] Make cachemembuffersize default depend on memory +Subject: [PATCH 08/78] [rbp] Make cachemembuffersize default depend on memory size --- @@ -328,11 +328,10 @@ index 2e3282c..d1606a2 100644 m_initialized = true; } - -From 06bd0674846783738e6b81f351ba49bb633c473b Mon Sep 17 00:00:00 2001 +From 3a76692d6b72eb5a96d2a9ad59085938a8034c1c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 10/58] [settings] Experiment: Report DESKTOP resolution in +Subject: [PATCH 10/78] [settings] Experiment: Report DESKTOP resolution in video settings --- @@ -354,10 +353,10 @@ index 4376463..fc4e5ea 100644 StringUtils::Format("%dx%d%s", resolution->width, resolution->height, ModeFlagsToString(resolution->flags, false).c_str()), -From c2b0eafa1ed07258aa09a24a443d4535db8b3a1e Mon Sep 17 00:00:00 2001 +From 7d47259501b8e78a4488b3c77d301dc3092da768 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 9 Sep 2014 12:04:26 +0100 -Subject: [PATCH 11/58] egl: Treat unknown display aspect ratio as square pixel +Subject: [PATCH 11/78] egl: Treat unknown display aspect ratio as square pixel --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 ++-- @@ -386,10 +385,10 @@ index bda7430..68fc647 100644 SetResolutionString(m_desktopRes); -From 5f1821e4d8157a890c795744841dcb895a1349b4 Mon Sep 17 00:00:00 2001 +From 84167d1a7f7dc96ac0af89c9a1c29845e55b9265 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 12/58] [dvdplayer/rbp] Add pi specific option to maintain +Subject: [PATCH 12/78] [dvdplayer/rbp] Add pi specific option to maintain vsync with pll adjustment New A/V sync option in settings/video/playback to do "Adjust PLL". @@ -414,7 +413,7 @@ Needed updated firmware 9 files changed, 91 insertions(+), 7 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 5345dc2..6d08156 100644 +index 52117a2..530b3d4 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -6321,7 +6321,22 @@ msgctxt "#13459" @@ -441,7 +440,7 @@ index 5345dc2..6d08156 100644 #: system/settings/settings.xml msgctxt "#13505" -@@ -16628,3 +16643,10 @@ msgstr "" +@@ -16651,3 +16666,10 @@ msgstr "" msgctxt "#38016" msgid "%d fps" msgstr "" @@ -453,7 +452,7 @@ index 5345dc2..6d08156 100644 +msgstr "" + diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index cbcde85..a3d4728 100644 +index 10e8552..f493675 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -572,6 +572,20 @@ @@ -681,10 +680,10 @@ index 7df1bf7..732b69d 100644 float m_audioPlayCountMinimumPercent; bool m_dvdplayerIgnoreDTSinWAV; -From 6ead5d132f5d43c6ea3063c5fcd1c7d3b23eca18 Mon Sep 17 00:00:00 2001 +From 3cd283fec4a380188697c9f576e3f30debdb3481 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 13/58] [audio] Add settings option to boost centre channel +Subject: [PATCH 13/78] [audio] Add settings option to boost centre channel when downmixing This allows a dB volume increase to be added to centre channel. @@ -702,10 +701,10 @@ Should work with Pi Sink (dvdplayer/paplayer) and omxplayer 5 files changed, 45 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 6d08156..6e36b42 100644 +index 530b3d4..bedbd87 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16650,3 +16650,17 @@ msgctxt "#38006" +@@ -16673,3 +16673,17 @@ msgctxt "#38006" msgid "Audio has to stay in sync, this can either be done by resampling, or adjusting the PLL" msgstr "" @@ -724,7 +723,7 @@ index 6d08156..6e36b42 100644 +msgid "%i dB" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index a3d4728..09c3d10 100644 +index f493675..4843ab8 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -2597,6 +2597,18 @@ @@ -806,10 +805,10 @@ index f99c0e6..1911189 100644 // stereo upmix if (upmix && m_src_channels == 2 && m_dst_channels > 2) -From aca0d43f243143b6776e1cc8ef259197d2bee97a Mon Sep 17 00:00:00 2001 +From 1d5a34df606f823333a0b4f0c9fdde54910c0e5f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 15:23:51 +0000 -Subject: [PATCH 14/58] [rbp] Default extract thumbnails to false +Subject: [PATCH 14/78] [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 @@ -839,10 +838,1065 @@ index 50fe36a..a54a4c4 100644
-From 35f0f171ab8a9c37b2ebb5aca81b2242834fda72 Mon Sep 17 00:00:00 2001 +From d15976f38c7a551134ffff9b92a45e9e167634b0 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 10 Feb 2015 15:29:16 +0000 +Subject: [PATCH 15/78] [libcec] Add repeating keypress patch from popcornmix' + repo + +--- + tools/depends/target/libcec/Makefile | 1 + + tools/depends/target/libcec/popcornmix.patch | 859 +++++++++++++++++++++++++++ + 2 files changed, 860 insertions(+) + create mode 100644 tools/depends/target/libcec/popcornmix.patch + +diff --git a/tools/depends/target/libcec/Makefile b/tools/depends/target/libcec/Makefile +index f54af9e..ddf9963 100644 +--- a/tools/depends/target/libcec/Makefile ++++ b/tools/depends/target/libcec/Makefile +@@ -21,6 +21,7 @@ $(TARBALLS_LOCATION)/$(ARCHIVE): + $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) + rm -rf $(PLATFORM); mkdir -p $(PLATFORM)/build + cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) ++ cd $(PLATFORM); patch -p1 < ../popcornmix.patch + cd $(PLATFORM)/build; $(CMAKE) -DBUILD_SHARED_LIBS=1 -DSKIP_PYTHON_WRAPPER:STRING=1 -DCMAKE_INSTALL_LIBDIR=$(PREFIX)/lib .. + + $(LIBDYLIB): $(PLATFORM) +diff --git a/tools/depends/target/libcec/popcornmix.patch b/tools/depends/target/libcec/popcornmix.patch +new file mode 100644 +index 0000000..8366a69 +--- /dev/null ++++ b/tools/depends/target/libcec/popcornmix.patch +@@ -0,0 +1,859 @@ ++From ec982e9800ae312972d306b67779215a2add6cde Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Fri, 24 Oct 2014 13:45:21 +0100 ++Subject: [PATCH 1/6] Make released key polling wait for exact time until key ++ gets released ++ ++--- ++ src/libcec/CECClient.cpp | 16 ++++++++++++++-- ++ src/libcec/CECClient.h | 2 +- ++ src/libcec/CECProcessor.cpp | 8 +++++--- ++ src/libcec/LibCEC.cpp | 10 ++++++++-- ++ src/libcec/LibCEC.h | 4 +++- ++ 5 files changed, 31 insertions(+), 9 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index 35c2d3e..e307c0e 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -1067,7 +1067,7 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) ++ AddKey(key); ++ } ++ ++-void CCECClient::CheckKeypressTimeout(void) +++uint16_t CCECClient::CheckKeypressTimeout(void) ++ { ++ cec_keypress key; ++ ++@@ -1091,12 +1091,24 @@ void CCECClient::CheckKeypressTimeout(void) ++ } ++ else ++ { ++- return; +++ // time when this keypress will be released and we'd like to be called again +++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) +++ timeout = iTimeoutMs - (iNow - m_buttontime) + 1; +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) +++ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; +++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) +++ { +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ } +++ return timeout; ++ } ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); ++ QueueAddKey(key); +++ return CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ ++ bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index 12f8a3b..c9ce5e3 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -272,7 +272,7 @@ namespace CEC ++ virtual void AddKey(bool bSendComboKey = false); ++ virtual void AddKey(const cec_keypress &key); ++ virtual void SetCurrentButton(const cec_user_control_code iButtonCode); ++- virtual void CheckKeypressTimeout(void); +++ virtual uint16_t CheckKeypressTimeout(void); ++ virtual void SourceActivated(const cec_logical_address logicalAddress); ++ virtual void SourceDeactivated(const cec_logical_address logicalAddress); ++ ++diff --git a/src/libcec/CECProcessor.cpp b/src/libcec/CECProcessor.cpp ++index 99f71aa..604b950 100644 ++--- a/src/libcec/CECProcessor.cpp +++++ b/src/libcec/CECProcessor.cpp ++@@ -52,7 +52,6 @@ ++ using namespace CEC; ++ using namespace PLATFORM; ++ ++-#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 ++ #define ACTIVE_SOURCE_CHECK_INTERVAL 500 ++ #define TV_PRESENT_CHECK_INTERVAL 30000 ++ ++@@ -260,6 +259,7 @@ bool CCECProcessor::OnCommandReceived(const cec_command &command) ++ ++ void *CCECProcessor::Process(void) ++ { +++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started"); ++ ++ if (!m_connCheck) ++@@ -274,13 +274,13 @@ void *CCECProcessor::Process(void) ++ while (!IsStopped() && m_communication->IsOpen()) ++ { ++ // wait for a new incoming command, and process it ++- if (m_inBuffer.Pop(command, CEC_PROCESSOR_SIGNAL_WAIT_TIME)) +++ if (m_inBuffer.Pop(command, timeout)) ++ ProcessCommand(command); ++ ++ if (CECInitialised() && !IsStopped()) ++ { ++ // check clients for keypress timeouts ++- m_libcec->CheckKeypressTimeout(); +++ timeout = m_libcec->CheckKeypressTimeout(); ++ ++ // check if we need to replace handlers ++ ReplaceHandlers(); ++@@ -311,6 +311,8 @@ void *CCECProcessor::Process(void) ++ tvPresentCheck.Init(TV_PRESENT_CHECK_INTERVAL); ++ } ++ } +++ else +++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ ++ return NULL; ++diff --git a/src/libcec/LibCEC.cpp b/src/libcec/LibCEC.cpp ++index af36b79..5ccb8dd 100644 ++--- a/src/libcec/LibCEC.cpp +++++ b/src/libcec/LibCEC.cpp ++@@ -361,11 +361,17 @@ bool CLibCEC::IsValidPhysicalAddress(uint16_t iPhysicalAddress) ++ iPhysicalAddress <= CEC_MAX_PHYSICAL_ADDRESS; ++ } ++ ++-void CLibCEC::CheckKeypressTimeout(void) +++uint16_t CLibCEC::CheckKeypressTimeout(void) ++ { +++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ // check all clients ++ for (std::vector::iterator it = m_clients.begin(); it != m_clients.end(); it++) ++- (*it)->CheckKeypressTimeout(); +++ { +++ uint16_t t = (*it)->CheckKeypressTimeout(); +++ if (t < timeout) +++ timeout = t; +++ } +++ return timeout; ++ } ++ ++ void CLibCEC::AddLog(const cec_log_level level, const char *strFormat, ...) ++diff --git a/src/libcec/LibCEC.h b/src/libcec/LibCEC.h ++index 6d9a229..d9d1e7b 100644 ++--- a/src/libcec/LibCEC.h +++++ b/src/libcec/LibCEC.h ++@@ -39,6 +39,8 @@ ++ #include "CECTypeUtils.h" ++ #include ++ +++#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 +++ ++ namespace CEC ++ { ++ class CAdapterCommunication; ++@@ -125,7 +127,7 @@ namespace CEC ++ ++ void AddLog(const cec_log_level level, const char *strFormat, ...); ++ void AddCommand(const cec_command &command); ++- void CheckKeypressTimeout(void); +++ uint16_t CheckKeypressTimeout(void); ++ void Alert(const libcec_alert type, const libcec_parameter ¶m); ++ ++ static bool IsValidPhysicalAddress(uint16_t iPhysicalAddress); ++-- ++1.9.1 ++ ++ ++From 41f0f3ec9ac136da3565c96fd5a7075499f3938d Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Fri, 24 Oct 2014 13:51:34 +0100 ++Subject: [PATCH 2/6] Keep track of time since initial button press and last ++ button update ++ ++--- ++ src/libcec/CECClient.cpp | 44 +++++++++++++++++++++++++++----------------- ++ src/libcec/CECClient.h | 3 ++- ++ 2 files changed, 29 insertions(+), 18 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index e307c0e..e7935b9 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -54,7 +54,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_bInitialised(false), ++ m_bRegistered(false), ++ m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), ++- m_buttontime(0), +++ m_initialButtontime(0), +++ m_updateButtontime(0), ++ m_iPreventForwardingPowerOffCommand(0), ++ m_iLastKeypressTime(0) ++ { ++@@ -981,9 +982,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++- key.duration = (unsigned int) (GetTimeMs() - m_buttontime); +++ unsigned int duration = (unsigned int) (GetTimeMs() - m_updateButtontime); +++ key.duration = (unsigned int) (GetTimeMs() - m_initialButtontime); ++ ++- if (key.duration > m_configuration.iComboKeyTimeoutMs || +++ if (duration > m_configuration.iComboKeyTimeoutMs || ++ m_configuration.iComboKeyTimeoutMs == 0 || ++ m_iCurrentButton != m_configuration.comboKey || ++ bSendComboKey) ++@@ -991,14 +993,15 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) ++ key.keycode = m_iCurrentButton; ++ ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_buttontime = 0; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; ++ } ++ } ++ } ++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x)", ToString(key.keycode), key.keycode); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++ QueueAddKey(key); ++ } ++ } ++@@ -1012,7 +1015,7 @@ void CCECClient::AddKey(const cec_keypress &key) ++ AddKey(); ++ return; ++ } ++- +++ bool isrepeat = false; ++ cec_keypress transmitKey(key); ++ cec_user_control_code comboKey(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); ++@@ -1035,22 +1038,27 @@ void CCECClient::AddKey(const cec_keypress &key) ++ AddKey(true); ++ } ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); +++ ++ if (m_iCurrentButton == key.keycode) ++ { ++- m_buttontime = GetTimeMs(); +++ m_updateButtontime = GetTimeMs(); +++ isrepeat = true; ++ } ++ else ++ { ++- AddKey(); +++ if (m_iCurrentButton != transmitKey.keycode) +++ AddKey(); ++ if (key.duration == 0) ++ { ++ m_iCurrentButton = transmitKey.keycode; ++- m_buttontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); +++ m_initialButtontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); +++ m_updateButtontime = m_initialButtontime; ++ } ++ } ++ } ++ ++- if (key.keycode != comboKey || key.duration > 0) +++ if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); ++ QueueAddKey(transmitKey); ++@@ -1074,32 +1082,34 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ { ++ CLockObject lock(m_mutex); ++ uint64_t iNow = GetTimeMs(); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s T:%.3f", __FUNCTION__, iNow*1e-3); ++ cec_user_control_code comboKey(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); ++ uint32_t iTimeoutMs(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_buttontime > iTimeoutMs) || ++- (m_iCurrentButton != comboKey && iNow - m_buttontime > CEC_BUTTON_TIMEOUT))) +++ ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime > iTimeoutMs) || +++ (m_iCurrentButton != comboKey && iNow - m_updateButtontime > CEC_BUTTON_TIMEOUT))) ++ { ++- key.duration = (unsigned int) (iNow - m_buttontime); +++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++ ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_buttontime = 0; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; ++ } ++ else ++ { ++ // time when this keypress will be released and we'd like to be called again ++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) ++- timeout = iTimeoutMs - (iNow - m_buttontime) + 1; +++ timeout = iTimeoutMs - (iNow - m_updateButtontime) + 1; ++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) ++- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; +++ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_updateButtontime) + 1; ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ return timeout; ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index c9ce5e3..611c68b 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -404,7 +404,8 @@ namespace CEC ++ PLATFORM::CMutex m_mutex; /**< mutex for changes to this instance */ ++ PLATFORM::CMutex m_cbMutex; /**< mutex that is held when doing anything with callbacks */ ++ cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ ++- int64_t m_buttontime; /**< the timestamp when the button was pressed (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++ int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++ cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++-- ++1.9.1 ++ ++ ++From 273ead6980b69eddf98810eb1eb33d94a7d74fce Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Tue, 28 Oct 2014 00:09:18 +0000 ++Subject: [PATCH 3/6] Support repeating button presses with configurable repeat ++ rate ++ ++--- ++ include/cectypes.h | 6 ++ ++ src/libcec/CECClient.cpp | 100 +++++++++++++++++++---- ++ src/libcec/CECClient.h | 6 +- ++ src/libcec/implementations/CECCommandHandler.cpp | 2 +- ++ 4 files changed, 96 insertions(+), 18 deletions(-) ++ ++diff --git a/include/cectypes.h b/include/cectypes.h ++index acff259..8f098ef 100644 ++--- a/include/cectypes.h +++++ b/include/cectypes.h ++@@ -1493,6 +1493,8 @@ struct libcec_configuration ++ XXX changed meaning in 2.2.0 to not break binary compatibility. next major (3.0) release will fix it in a nicer way */ ++ cec_user_control_code comboKey; /*!< key code that initiates combo keys. defaults to CEC_USER_CONTROL_CODE_F1_BLUE. CEC_USER_CONTROL_CODE_UNKNOWN to disable. added in 2.0.5 */ ++ uint32_t iComboKeyTimeoutMs; /*!< timeout until the combo key is sent as normal keypress */ +++ uint32_t iButtonRepeatRateMs; /*!< rate at which buttons autorepeat. 0 means rely on CEC device */ +++ uint32_t iButtonReleaseDelayMs;/*!< duration after last update until a button is considered released */ ++ ++ #ifdef __cplusplus ++ libcec_configuration(void) { Clear(); } ++@@ -1527,6 +1529,8 @@ struct libcec_configuration ++ cecVersion == other.cecVersion && ++ adapterType == other.adapterType && ++ iDoubleTapTimeout50Ms == other.iDoubleTapTimeout50Ms && +++ iButtonRepeatRateMs == other.iButtonRepeatRateMs && +++ iButtonReleaseDelayMs == other.iButtonReleaseDelayMs && ++ (other.clientVersion <= LIBCEC_VERSION_TO_UINT(2, 0, 4) || comboKey == other.comboKey) && ++ (other.clientVersion <= LIBCEC_VERSION_TO_UINT(2, 0, 4) || iComboKeyTimeoutMs == other.iComboKeyTimeoutMs) && ++ (other.clientVersion < LIBCEC_VERSION_TO_UINT(2, 1, 0) || bPowerOnScreensaver == other.bPowerOnScreensaver)); ++@@ -1567,6 +1571,8 @@ struct libcec_configuration ++ iDoubleTapTimeout50Ms = CEC_DOUBLE_TAP_TIMEOUT_50_MS; ++ comboKey = CEC_USER_CONTROL_CODE_STOP; ++ iComboKeyTimeoutMs = CEC_DEFAULT_COMBO_TIMEOUT_MS; +++ iButtonRepeatRateMs = 0; +++ iButtonReleaseDelayMs = CEC_BUTTON_TIMEOUT; ++ ++ memset(strDeviceName, 0, 13); ++ deviceTypes.Clear(); ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index e7935b9..598628d 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -56,6 +56,10 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), ++ m_initialButtontime(0), ++ m_updateButtontime(0), +++ m_repeatButtontime(0), +++ m_releaseButtontime(0), +++ m_pressedButtoncount(0), +++ m_releasedButtoncount(0), ++ m_iPreventForwardingPowerOffCommand(0), ++ m_iLastKeypressTime(0) ++ { ++@@ -851,6 +855,9 @@ bool CCECClient::GetCurrentConfiguration(libcec_configuration &configuration) ++ configuration.bMonitorOnly = m_configuration.bMonitorOnly; ++ configuration.cecVersion = m_configuration.cecVersion; ++ configuration.adapterType = m_configuration.adapterType; +++ configuration.iDoubleTapTimeout50Ms = m_configuration.iDoubleTapTimeout50Ms; +++ configuration.iButtonRepeatRateMs = m_configuration.iButtonRepeatRateMs; +++ configuration.iButtonReleaseDelayMs = m_configuration.iButtonReleaseDelayMs; ++ ++ return true; ++ } ++@@ -894,6 +901,9 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) ++ m_configuration.cecVersion = configuration.cecVersion; ++ m_configuration.adapterType = configuration.adapterType; ++ m_configuration.iDoubleTapTimeout50Ms = configuration.iDoubleTapTimeout50Ms; +++ m_configuration.iButtonRepeatRateMs = configuration.iButtonRepeatRateMs; +++ m_configuration.iButtonReleaseDelayMs = configuration.iButtonReleaseDelayMs; +++ ++ m_configuration.deviceTypes.Add(configuration.deviceTypes[0]); ++ ++ if (m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5)) ++@@ -950,6 +960,7 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) ++ primary->ActivateSource(); ++ } ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: %d:%d:%d", __FUNCTION__, DoubleTapTimeoutMS(), m_configuration.iButtonRepeatRateMs, m_configuration.iButtonReleaseDelayMs); ++ return true; ++ } ++ ++@@ -973,11 +984,15 @@ void CCECClient::AddCommand(const cec_command &command) ++ } ++ } ++ ++-void CCECClient::AddKey(bool bSendComboKey /* = false */) +++void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* = false */) ++ { ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ +++ // we ignore button releases when supporting repeating keys +++ if (bButtonRelease && m_configuration.iButtonRepeatRateMs && m_configuration.iButtonReleaseDelayMs) +++ return; +++ ++ { ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++@@ -995,6 +1010,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++ m_initialButtontime = 0; ++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; ++ } ++ } ++ } ++@@ -1012,6 +1031,7 @@ void CCECClient::AddKey(const cec_keypress &key) ++ key.keycode < CEC_USER_CONTROL_CODE_SELECT) ++ { ++ // send back the previous key if there is one +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Unexpected key %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(); ++ return; ++ } ++@@ -1035,7 +1055,10 @@ void CCECClient::AddKey(const cec_keypress &key) ++ transmitKey.keycode = CEC_USER_CONTROL_CODE_DOT; ++ // default, send back the previous key ++ else +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Combo key %s (%1x) D%dms:", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(true); +++ } ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); ++@@ -1043,17 +1066,44 @@ void CCECClient::AddKey(const cec_keypress &key) ++ if (m_iCurrentButton == key.keycode) ++ { ++ m_updateButtontime = GetTimeMs(); ++- isrepeat = true; +++ m_releaseButtontime = m_updateButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); +++ // want to have seen some updated before considering a repeat +++ if (m_configuration.iButtonRepeatRateMs) +++ { +++ if (!m_repeatButtontime && m_pressedButtoncount > 1) +++ m_repeatButtontime = m_initialButtontime + DoubleTapTimeoutMS(); +++ isrepeat = true; +++ } +++ m_pressedButtoncount++; ++ } ++ else ++ { ++ if (m_iCurrentButton != transmitKey.keycode) +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Changed key %s (%1x) D:%dms cur:%lx", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration, m_iCurrentButton); ++ AddKey(); +++ } ++ if (key.duration == 0) ++ { ++ m_iCurrentButton = transmitKey.keycode; ++- m_initialButtontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); ++- m_updateButtontime = m_initialButtontime; +++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) +++ { +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; +++ } +++ else +++ { +++ m_initialButtontime = GetTimeMs(); +++ m_updateButtontime = m_initialButtontime; +++ m_repeatButtontime = 0; // set this on next update +++ m_releaseButtontime = m_initialButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); +++ m_pressedButtoncount = 1; +++ m_releasedButtoncount = 0; +++ } ++ } ++ } ++ } ++@@ -1072,12 +1122,16 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) ++ key.duration = 0; ++ key.keycode = iButtonCode; ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "SetCurrentButton %s (%1x) D:%dms cur:%lx", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(key); ++ } ++ ++ uint16_t CCECClient::CheckKeypressTimeout(void) ++ { +++ // time when we'd like to be called again +++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ cec_keypress key; +++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ ++ { ++ CLockObject lock(m_mutex); ++@@ -1089,8 +1143,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime > iTimeoutMs) || ++- (m_iCurrentButton != comboKey && iNow - m_updateButtontime > CEC_BUTTON_TIMEOUT))) +++ ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) || +++ (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime))) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1098,27 +1152,41 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++ m_initialButtontime = 0; ++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; +++ } +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +++ (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) +++ { +++ key.duration = 0; +++ key.keycode = m_iCurrentButton; +++ m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; +++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ } ++ else ++ { ++- // time when this keypress will be released and we'd like to be called again ++- unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) ++- timeout = iTimeoutMs - (iNow - m_updateButtontime) + 1; ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) ++- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_updateButtontime) + 1; +++ timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_releaseButtontime) +++ timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_repeatButtontime) +++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, m_releaseButtontime*1e-3, m_iCurrentButton); ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++- return timeout; ++ } +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key %s: %s (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : key.duration ? "released" : "repeated", +++ ToString(m_iCurrentButton), m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); ++ } ++ ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); ++- QueueAddKey(key); ++- return CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) +++ QueueAddKey(key); +++ +++ return timeout; ++ } ++ ++ bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index 611c68b..adeb5af 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -269,7 +269,7 @@ namespace CEC ++ // callbacks ++ virtual void Alert(const libcec_alert type, const libcec_parameter ¶m) { QueueAlert(type, param); } ++ virtual void AddLog(const cec_log_message &message) { QueueAddLog(message); } ++- virtual void AddKey(bool bSendComboKey = false); +++ virtual void AddKey(bool bSendComboKey = false, bool bButtonRelease = false); ++ virtual void AddKey(const cec_keypress &key); ++ virtual void SetCurrentButton(const cec_user_control_code iButtonCode); ++ virtual uint16_t CheckKeypressTimeout(void); ++@@ -406,6 +406,10 @@ namespace CEC ++ cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ ++ int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ ++ int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_repeatButtontime; /**< the timestamp when the button will next repeat (in seconds since epoch), or 0 if repeat is disabled. */ +++ int64_t m_releaseButtontime; /**< the timestamp when the button will be released (in seconds since epoch), or 0 if none was pressed. */ +++ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ +++ int32_t m_releasedButtoncount; /**< the number of times a button pressed message has been seen for this press. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++ int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++ cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++diff --git a/src/libcec/implementations/CECCommandHandler.cpp b/src/libcec/implementations/CECCommandHandler.cpp ++index 6d6244e..d64186f 100644 ++--- a/src/libcec/implementations/CECCommandHandler.cpp +++++ b/src/libcec/implementations/CECCommandHandler.cpp ++@@ -770,7 +770,7 @@ int CCECCommandHandler::HandleUserControlRelease(const cec_command &command) ++ ++ CECClientPtr client = m_processor->GetClient(command.destination); ++ if (client) ++- client->AddKey(); +++ client->AddKey(false, true); ++ ++ return COMMAND_HANDLED; ++ } ++-- ++1.9.1 ++ ++ ++From 3336d0827f7fd159430f3431642b07090c06c869 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Tue, 28 Oct 2014 01:21:35 +0000 ++Subject: [PATCH 4/6] Skip double press removal. It is handled through other ++ means. ++ ++--- ++ src/libcec/CECClient.cpp | 18 +----------------- ++ src/libcec/CECClient.h | 2 -- ++ 2 files changed, 1 insertion(+), 19 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index 598628d..dccd874 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -60,11 +60,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_releaseButtontime(0), ++ m_pressedButtoncount(0), ++ m_releasedButtoncount(0), ++- m_iPreventForwardingPowerOffCommand(0), ++- m_iLastKeypressTime(0) +++ m_iPreventForwardingPowerOffCommand(0) ++ { ++- m_lastKeypress.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_lastKeypress.duration = 0; ++ m_configuration.Clear(); ++ // set the initial configuration ++ SetConfiguration(configuration); ++@@ -1647,20 +1644,7 @@ void CCECClient::CallbackAddKey(const cec_keypress &key) ++ { ++ CLockObject lock(m_cbMutex); ++ if (m_configuration.callbacks && m_configuration.callbacks->CBCecKeyPress) ++- { ++- // prevent double taps ++- int64_t now = GetTimeMs(); ++- if (m_lastKeypress.keycode != key.keycode || ++- key.duration > 0 || ++- now - m_iLastKeypressTime >= DoubleTapTimeoutMS()) ++- { ++- // no double tap ++- if (key.duration == 0) ++- m_iLastKeypressTime = now; ++- m_lastKeypress = key; ++ m_configuration.callbacks->CBCecKeyPress(m_configuration.callbackParam, key); ++- } ++- } ++ } ++ ++ void CCECClient::CallbackAddLog(const cec_log_message &message) ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index adeb5af..43a713b 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -411,8 +411,6 @@ namespace CEC ++ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ ++ int32_t m_releasedButtoncount; /**< the number of times a button pressed message has been seen for this press. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++- int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++- cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++ PLATFORM::SyncedBuffer m_callbackCalls; ++ }; ++ } ++-- ++1.9.1 ++ ++ ++From 0dd0234f620a546bfa843172648383f83d88088c Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Mon, 3 Nov 2014 23:28:04 +0000 ++Subject: [PATCH 5/6] Pass through duration on all button repeats ++ ++--- ++ src/libcec/CECClient.cpp | 34 ++++++++++++++++++++++++---------- ++ 1 file changed, 24 insertions(+), 10 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index dccd874..1946148 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -986,10 +986,6 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ ++- // we ignore button releases when supporting repeating keys ++- if (bButtonRelease && m_configuration.iButtonRepeatRateMs && m_configuration.iButtonReleaseDelayMs) ++- return; ++- ++ { ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++@@ -1015,6 +1011,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* ++ } ++ } ++ +++ // we don't forward releases when supporting repeating keys +++ if (bButtonRelease && m_configuration.iButtonRepeatRateMs) +++ return; +++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++@@ -1107,7 +1107,7 @@ void CCECClient::AddKey(const cec_keypress &key) ++ ++ if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) ++ { ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x, %d)", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration); ++ QueueAddKey(transmitKey); ++ } ++ } ++@@ -1129,6 +1129,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +++ key.duration = 0; ++ ++ { ++ CLockObject lock(m_mutex); ++@@ -1140,8 +1141,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) || ++- (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime))) +++ m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1155,9 +1155,23 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_releasedButtoncount = 0; ++ } ++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +++ m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) +++ { +++ key.duration = (unsigned int) (iNow - m_initialButtontime); +++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +++ +++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; +++ } +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++ (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) ++ { ++- key.duration = 0; +++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++ m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; ++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++@@ -1176,8 +1190,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ } ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key %s: %s (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : key.duration ? "released" : "repeated", ++- ToString(m_iCurrentButton), m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Key %s: %s (duration:%d) (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", ToString(m_iCurrentButton), key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : m_repeatButtontime ? "repeated" : "released", key.duration, +++ m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); ++ } ++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++-- ++1.9.1 ++ ++ ++From 1ea01f59d8186d4d53af41961aaccbbc11651115 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Wed, 5 Nov 2014 21:04:25 +0000 ++Subject: [PATCH 6/6] squash: Fix for stop needing to be pressed twice ++ ++--- ++ src/libcec/CECClient.cpp | 17 ++++++++--------- ++ 1 file changed, 8 insertions(+), 9 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index 1946148..f4f114b 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -1131,6 +1131,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ key.duration = 0; ++ +++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) +++ return timeout; ++ { ++ CLockObject lock(m_mutex); ++ uint64_t iNow = GetTimeMs(); ++@@ -1140,8 +1142,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ uint32_t iTimeoutMs(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) +++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1154,8 +1155,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_pressedButtoncount = 0; ++ m_releasedButtoncount = 0; ++ } ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) +++ else if (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++@@ -1168,8 +1168,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_pressedButtoncount = 0; ++ m_releasedButtoncount = 0; ++ } ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) +++ else if (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1178,11 +1177,11 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ } ++ else ++ { ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) +++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0) ++ timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_releaseButtontime) +++ if (m_iCurrentButton != comboKey && m_releaseButtontime) ++ timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_repeatButtontime) +++ if (m_iCurrentButton != comboKey && m_repeatButtontime) ++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++-- ++1.9.1 ++ + +From 48f3222f1cc3eb51884018918c8c652a99cef2a7 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Oct 2014 00:19:40 +0000 +Subject: [PATCH 16/78] [cec] Add settings for configuring button repeats + +--- + addons/resource.language.en_gb/resources/strings.po | 15 +++++++++++++++ + system/peripherals.xml | 4 +++- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 16 ++++++++++++++++ + 3 files changed, 34 insertions(+), 1 deletion(-) + +diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po +index bedbd87..6db61ed 100644 +--- a/addons/resource.language.en_gb/resources/strings.po ++++ b/addons/resource.language.en_gb/resources/strings.po +@@ -16687,3 +16687,18 @@ msgstr "" + msgctxt "#38009" + msgid "%i dB" + msgstr "" ++ ++#: system/peripherals.xml ++msgctxt "#38050" ++msgid "Remote button press delay before repeating (ms)" ++msgstr "" ++ ++#: system/peripherals.xml ++msgctxt "#38051" ++msgid "Remote button press repeat rate (ms)" ++msgstr "" ++ ++#: system/peripherals.xml ++msgctxt "#38052" ++msgid "Remote button press release time (ms)" ++msgstr "" +diff --git a/system/peripherals.xml b/system/peripherals.xml +index a67dc2f..6841bda 100644 +--- a/system/peripherals.xml ++++ b/system/peripherals.xml +@@ -30,7 +30,9 @@ + + + +- ++ ++ ++ + + + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index ea702e5..b5ff693 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -1267,6 +1267,20 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu + m_configuration.bSendInactiveSource = config.bSendInactiveSource; + bChanged |= SetSetting("send_inactive_source", m_configuration.bSendInactiveSource == 1); + ++#if defined(CEC_DOUBLE_TAP_TIMEOUT_MS_OLD) ++ m_configuration.iDoubleTapTimeout50Ms = config.iDoubleTapTimeout50Ms; ++ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeout50Ms * 50); ++#else ++ m_configuration.iDoubleTapTimeoutMs = config.iDoubleTapTimeoutMs; ++ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeoutMs; ++#endif ++ ++ m_configuration.iButtonRepeatRateMs = config.iButtonRepeatRateMs; ++ bChanged |= SetSetting("button_repeat_rate_ms", (int)m_configuration.iButtonRepeatRateMs); ++ ++ m_configuration.iButtonReleaseDelayMs = config.iButtonReleaseDelayMs; ++ bChanged |= SetSetting("button_release_delay_ms", (int)m_configuration.iButtonReleaseDelayMs); ++ + m_configuration.iFirmwareVersion = config.iFirmwareVersion; + m_configuration.bShutdownOnStandby = config.bShutdownOnStandby; + +@@ -1371,6 +1385,8 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void) + // backwards compatibility. will be removed once the next major release of libCEC is out + m_configuration.iDoubleTapTimeoutMs = GetSettingInt("double_tap_timeout_ms"); + #endif ++ m_configuration.iButtonRepeatRateMs = GetSettingInt("button_repeat_rate_ms"); ++ m_configuration.iButtonReleaseDelayMs = GetSettingInt("button_release_delay_ms"); + } + + void CPeripheralCecAdapter::ReadLogicalAddresses(const std::string &strString, cec_logical_addresses &addresses) + +From 1976d9680172ac8af7f543d952a8a9785e52ae6d Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 3 Nov 2014 23:17:46 +0000 +Subject: [PATCH 17/78] [cec] Don't discard buttons when repeat mode is enabled + +--- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index b5ff693..6086bf5 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -767,7 +767,10 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration); + + CSingleLock lock(m_critSection); +- if (key.iDuration > 0) ++ // avoid the queue getting too long ++ if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5) ++ return; ++ if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0) + { + if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0) + { + +From 39d8231d117444c81d96d79e38d23458e18d81ec Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 4 Nov 2014 18:50:00 +0000 +Subject: [PATCH 18/78] [cec] Temp - more logging + +--- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index 6086bf5..417b0d8 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -764,12 +764,15 @@ void CPeripheralCecAdapter::GetNextKey(void) + + void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + { +- CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration); ++ CLog::Log(LOGDEBUG, "%s - received key %2x duration %d (rep:%d size:%d)", __FUNCTION__, key.iButton, key.iDuration, m_configuration.iButtonRepeatRateMs, m_buttonQueue.size()); + + CSingleLock lock(m_critSection); + // avoid the queue getting too long + if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5) ++ { ++ CLog::Log(LOGDEBUG, "%s - discarded key %2x", __FUNCTION__, key.iButton); + return; ++ } + if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0) + { + if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0) +@@ -778,6 +781,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + if (m_bHasButton) + m_currentButton.iDuration = key.iDuration; + // ignore this one, since it's already been handled by xbmc ++ CLog::Log(LOGDEBUG, "%s - ignored key %2x", __FUNCTION__, key.iButton); + return; + } + // if we received a keypress with a duration set, try to find the same one without a duration set, and replace it +@@ -788,6 +792,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + if ((*it).iDuration == 0) + { + // replace this entry ++ CLog::Log(LOGDEBUG, "%s - replaced key %2x", __FUNCTION__, key.iButton); + (*it).iDuration = key.iDuration; + return; + } +@@ -797,6 +802,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + } + } + ++ CLog::Log(LOGDEBUG, "%s - added key %2x", __FUNCTION__, key.iButton); + m_buttonQueue.push_back(key); + } + + +From 5a250e44c87f1d6537bac25a0aba6d87c2ff9495 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 15 Nov 2014 12:03:34 +0000 -Subject: [PATCH 19/58] [dvdplayer] Add lock for player creation +Subject: [PATCH 19/78] [dvdplayer] Add lock for player creation --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 3 +++ @@ -850,7 +1904,7 @@ Subject: [PATCH 19/58] [dvdplayer] Add lock for player creation 2 files changed, 4 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 70b1ac3..b41c8f0 100644 +index e702c35..8252192 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -517,6 +517,7 @@ int CSelectionStreams::CountSource(StreamType type, StreamSource source) const @@ -869,7 +1923,7 @@ index 70b1ac3..b41c8f0 100644 if (!m_players_created) return; delete m_dvdPlayerVideo; -@@ -4255,6 +4257,7 @@ double CDVDPlayer::GetQueueTime() +@@ -4251,6 +4253,7 @@ double CDVDPlayer::GetQueueTime() void CDVDPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info) { @@ -888,10 +1942,10 @@ index ab6a228..32e76c1 100644 + CCriticalSection m_players_lock; }; -From 51e261109f6a8d1cb0e96bdaa56a01aa7077633f Mon Sep 17 00:00:00 2001 +From 0598120209d780b0aef824f45fc03d2c085459c6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 24 Nov 2014 22:07:25 +0000 -Subject: [PATCH 20/58] [dvdplayervideo] Prod decoder when in stills mode +Subject: [PATCH 20/78] [dvdplayervideo] Prod decoder when in stills mode An asynchronous hardware decoder doesn't only produce output pictures when new packets arrive. In dvd stills mode give it a chance to return pictures that weren't ready when frame was decoded. @@ -900,7 +1954,7 @@ In dvd stills mode give it a chance to return pictures that weren't ready when f 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index f1a7e60..9be8aae 100644 +index cbfefe0..fe3b2c2 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -314,7 +314,8 @@ void CDVDPlayerVideo::Process() @@ -968,10 +2022,10 @@ index f1a7e60..9be8aae 100644 if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE)) -From deb376b5dad3cef8f86cef69aab9a4280bac9b21 Mon Sep 17 00:00:00 2001 +From 0022598c8beb8f6dce97ca959a66348e7d498a97 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 27 Nov 2014 16:31:56 +0000 -Subject: [PATCH 21/58] [languageinvoker] Reduce priority of python threads +Subject: [PATCH 21/78] [languageinvoker] Reduce priority of python threads --- xbmc/interfaces/generic/LanguageInvokerThread.cpp | 5 +++++ @@ -994,10 +2048,10 @@ index fcdd063..16f0c89 100644 } -From 7351fa296cd1740f04c6c5a2047c11e3b607f700 Mon Sep 17 00:00:00 2001 +From 9a26e5bba11a26b9437a93cfbc1e55ccc3245170 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Dec 2013 16:55:05 +0000 -Subject: [PATCH 22/58] logging: Add microsecond timer to log messages +Subject: [PATCH 22/78] logging: Add microsecond timer to log messages --- xbmc/utils/log.cpp | 17 +++++++++++++++-- @@ -1050,10 +2104,10 @@ index 3443f12..31c4a99 100644 levelNames[logLevel]) + strData; -From c2bc1032b22f6214ffbbbecb29e3538f9790f016 Mon Sep 17 00:00:00 2001 +From 38d419b7cc3e0fe22602ec0819f089583e349952 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 29 Nov 2014 15:25:16 +0000 -Subject: [PATCH 23/58] [rbp] hack: wait for splash to complete before changing +Subject: [PATCH 23/78] [rbp] hack: wait for splash to complete before changing hdmi mode --- @@ -1127,10 +2181,10 @@ index 68fc647..c80114e 100644 if(!m_fixedMode && GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) -From 58ed12b2f7dd77fc57b3ddbff8fbaa04a0172716 Mon Sep 17 00:00:00 2001 +From 83db1723e20ced83b80e352a5d2154ecea953100 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 11 Dec 2014 17:00:57 +0000 -Subject: [PATCH 24/58] Fix for UI not showing both extractflags and +Subject: [PATCH 24/78] Fix for UI not showing both extractflags and extractthumb --- @@ -1139,7 +2193,7 @@ Subject: [PATCH 24/58] Fix for UI not showing both extractflags and 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 788a831..a794cd8 100644 +index 6db61ed..9f2eb3c 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -11015,7 +11015,7 @@ msgstr "" @@ -1151,7 +2205,7 @@ index 788a831..a794cd8 100644 msgstr "" #: xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp -@@ -14549,7 +14549,7 @@ msgstr "" +@@ -14572,7 +14572,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36178" @@ -1160,7 +2214,7 @@ index 788a831..a794cd8 100644 msgstr "" #. Description of setting "Videos -> File lists -> Replace file names with library titles" with label #20419 -@@ -14561,7 +14561,7 @@ msgstr "" +@@ -14584,7 +14584,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36180" @@ -1169,7 +2223,7 @@ index 788a831..a794cd8 100644 msgstr "" #: system/settings/settings.xml -@@ -16679,3 +16679,8 @@ msgstr "" +@@ -16702,3 +16702,8 @@ msgstr "" msgctxt "#38052" msgid "Remote button press release time (ms)" msgstr "" @@ -1179,7 +2233,7 @@ index 788a831..a794cd8 100644 +msgid "Extract thumbnails from video files" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 09c3d10..1059b09 100644 +index 4843ab8..f1cbefa 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -861,8 +861,8 @@ @@ -1194,10 +2248,10 @@ index 09c3d10..1059b09 100644 -From 6f0adae04039766326ebb5a735433dac07787a0f Mon Sep 17 00:00:00 2001 +From 0f830a21ca9227d80e8caae04ff11b7bae247298 Mon Sep 17 00:00:00 2001 From: anaconda Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 25/58] Disable autoscrolling while on screensaver and while +Subject: [PATCH 25/78] Disable autoscrolling while on screensaver and while opening streams. --- @@ -1307,7 +2361,7 @@ index 759ac09..bed6ad2 100644 else { diff --git a/xbmc/guilib/GUITextBox.cpp b/xbmc/guilib/GUITextBox.cpp -index 0d5b3f7..6d23024 100644 +index dd78377..6b731e2 100644 --- a/xbmc/guilib/GUITextBox.cpp +++ b/xbmc/guilib/GUITextBox.cpp @@ -23,6 +23,7 @@ @@ -1328,10 +2382,10 @@ index 0d5b3f7..6d23024 100644 if (m_lastRenderTime) m_autoScrollDelayTime += currentTime - m_lastRenderTime; -From 9b85c054f66cb5efde618d34198bd533f16f26d5 Mon Sep 17 00:00:00 2001 +From b1843145fb9ab380c34fb8d85969c01228c74249 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 13 Dec 2014 18:35:20 +0000 -Subject: [PATCH 26/58] [demuxer] Avoid memcpy on every demuxer packet +Subject: [PATCH 26/78] [demuxer] Avoid memcpy on every demuxer packet Avoids an unnecessary memcpy on every demuxer packet which for high bitrate videos can be significant. @@ -1426,10 +2480,10 @@ index ab298b2..10c5ee0 100644 } catch(...) { -From cb5bcc331593fa2d2088c0a0f8f72aefce1030e2 Mon Sep 17 00:00:00 2001 +From e73b4ea6dc1b545c381dc516e804f8079da37f7b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 15 Feb 2015 14:06:12 +0000 -Subject: [PATCH 27/58] [mmal] Allow mmal codec for dvd stills +Subject: [PATCH 27/78] [mmal] Allow mmal codec for dvd stills --- xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 7 +++++++ @@ -1461,10 +2515,10 @@ index 4c363cf..b90237b 100644 { // If dvd is an mpeg2 and hint.stills -From 3873604d5ef7443bdfc33603c979495fe8a0f17c Mon Sep 17 00:00:00 2001 +From acb552f04e57174607dc946fae1916e6f4092d45 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 31 Mar 2015 17:31:47 +0100 -Subject: [PATCH 28/58] [mmalrenderer] Add SetCodecControl function and prefer +Subject: [PATCH 28/78] [mmalrenderer] Add SetCodecControl function and prefer to return pictures when renderer is low (disabled) --- @@ -1535,10 +2589,10 @@ index 51a64d1..bde8c06 100644 CCriticalSection m_sharedSection; MMAL_COMPONENT_T *m_dec; -From 8f077b7937e519bbe44a02c3559808672696903e Mon Sep 17 00:00:00 2001 +From 8bf8dffb44284741978fd9492d80f3502fabe4b2 Mon Sep 17 00:00:00 2001 From: anaconda Date: Wed, 25 Feb 2015 18:22:21 +0100 -Subject: [PATCH 29/58] Load OSD dialogs on startup. +Subject: [PATCH 29/78] 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. @@ -1633,10 +2687,10 @@ index 9f25fa5..3ece45b 100644 CGUIDialogVideoSettings::~CGUIDialogVideoSettings() { } -From 2c96de41d5df402113fb6f675c5c6766ad48b267 Mon Sep 17 00:00:00 2001 +From a94b96aed5604f9612ab5cf13f6aecd44dba8ffb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 7 Mar 2015 22:46:21 +0000 -Subject: [PATCH 30/58] configure: Add raspberry-pi2 platform +Subject: [PATCH 30/78] configure: Add raspberry-pi2 platform --- configure.ac | 14 +++++++-- @@ -1648,7 +2702,7 @@ Subject: [PATCH 30/58] configure: Add raspberry-pi2 platform 6 files changed, 44 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac -index 71883d2..6beec97 100644 +index cf945a0..ab4214f 100644 --- a/configure.ac +++ b/configure.ac @@ -744,8 +744,17 @@ case $use_platform in @@ -1810,10 +2864,10 @@ index cdc2fe4..379bd1d 100644 set(CMAKE_SYSTEM_NAME Linux) endif() -From ecf7d1b7364dd7cb121825168aa51a6b14946614 Mon Sep 17 00:00:00 2001 +From 25ca4c7c98f464dfcea7e70e589f21297fab2713 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 10 Mar 2015 17:05:18 +0000 -Subject: [PATCH 31/58] [players] Add settings option to enable MVC support +Subject: [PATCH 31/78] [players] Add settings option to enable MVC support --- addons/resource.language.en_gb/resources/strings.po | 10 ++++++++++ @@ -1823,10 +2877,10 @@ Subject: [PATCH 31/58] [players] Add settings option to enable MVC support 4 files changed, 27 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index a794cd8..acb6372 100644 +index 9f2eb3c..bf956f7 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16680,6 +16680,16 @@ msgctxt "#38052" +@@ -16703,6 +16703,16 @@ msgctxt "#38052" msgid "Remote button press release time (ms)" msgstr "" @@ -1894,10 +2948,10 @@ index e4f6d86..5d324f4 100644 case AV_CODEC_ID_MPEG4: // (role name) video_decoder.mpeg4 -From 7c831c1cf47b62ee6ea8d57457b4b5ee35f29882 Mon Sep 17 00:00:00 2001 +From 8daeaefb1120ce7ff4a5ed29c32dfeba07a8d7e0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Mar 2015 12:38:08 +0000 -Subject: [PATCH 32/58] [mmalrenderer] Switch to using transform flags for 3d +Subject: [PATCH 32/78] [mmalrenderer] Switch to using transform flags for 3d modes --- @@ -1911,10 +2965,10 @@ Subject: [PATCH 32/58] [mmalrenderer] Switch to using transform flags for 3d 7 files changed, 75 insertions(+), 130 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index acb6372..e1b691d 100644 +index bf956f7..530d882 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16690,6 +16690,16 @@ msgctxt "#38111" +@@ -16713,6 +16713,16 @@ msgctxt "#38111" msgid "This option decodes frames for both eyes of MVC video. Disabling may improve performance if you don't require 3D" msgstr "" @@ -2276,11 +3330,10 @@ index c80114e..3816b55 100644 CLog::Log(LOGDEBUG, "EGL set resolution %dx%d -> %dx%d @ %.2f fps (%d,%d) flags:%x aspect:%.2f\n", m_width, m_height, dst_rect.width, dst_rect.height, res.fRefreshRate, GETFLAGS_GROUP(res.dwFlags), GETFLAGS_MODE(res.dwFlags), (int)res.dwFlags, res.fPixelRatio); - -From 404462b4bf655a3dd1f50f619162839f47f6efaa Mon Sep 17 00:00:00 2001 +From 16c142faadaa31be66a296796daa6d6ac40b0cad Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 14 Apr 2015 20:51:14 +0100 -Subject: [PATCH 35/58] [gui] Also limit GUI updates when in non full-screen +Subject: [PATCH 35/78] [gui] Also limit GUI updates when in non full-screen video mode --- @@ -2310,10 +3363,10 @@ index a2a7fd2..95ec768 100644 g_windowManager.FrameMove(); } -From f83aef5f43795b2e08d87dc1ba8723bd7c7f09a2 Mon Sep 17 00:00:00 2001 +From fc48d8306d53e54cef1467ce09de7a07f223f632 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:24:42 +0200 -Subject: [PATCH 36/58] Added some vc_tv_* functions that were missing in +Subject: [PATCH 36/78] Added some vc_tv_* functions that were missing in DllBCM. --- @@ -2348,10 +3401,10 @@ index b92fdb8..9c7e293 100644 HDMI_INTERLACED_T scan_mode, EDID_MODE_MATCH_FLAG_T match_flags) { return ::vc_tv_hdmi_power_on_best(width, height, frame_rate, scan_mode, match_flags); }; -From f72df42ab7b2987446c08230917f59391f58c1ef Mon Sep 17 00:00:00 2001 +From b5abdd3df0fdd4bf3efbd79fe891921cd300885a Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:29:03 +0200 -Subject: [PATCH 37/58] Added private utility function to map a float display +Subject: [PATCH 37/78] Added private utility function to map a float display aspect, to the respective SDTV_ASPECT_* enum value. --- @@ -2400,10 +3453,10 @@ index 3816b55..520bf95 100644 bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &resolutions) -From dbb24dacba5c40c0d536f4f71f5ac8b3b01fab41 Mon Sep 17 00:00:00 2001 +From 1d7dac8976e95b11aa39936fd5260cd30567dcd9 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:50:58 +0200 -Subject: [PATCH 38/58] Changed SDTV resolutions to be treated similarly to +Subject: [PATCH 38/78] Changed SDTV resolutions to be treated similarly to HDMI resolutions in SetNativeResolution. This means that the SDTV interface is powered up and set to the right mode. @@ -2500,10 +3553,10 @@ index 59401f5..a0acb1a 100644 int m_width; int m_height; -From 06f189a4535e06b3d21f89e43b7caee7dedbe0d3 Mon Sep 17 00:00:00 2001 +From c7bfece4cf2a4febe45cf1f5beae412307e93f3a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 17:11:09 +0100 -Subject: [PATCH 39/58] Revert "[3D] don't back out from 3D handling on +Subject: [PATCH 39/78] Revert "[3D] don't back out from 3D handling on resolution changes if we're switching to a different 3D mode" This reverts commit 3c4c236a799dab8369b4bb74ff9993bc58a61a72. @@ -2538,10 +3591,10 @@ index bd7dff9..fc4cc95 100644 if(stereo_mode != m_stereoMode) -From 445dce97603e36fadc97ee3d479abe6f581f6a07 Mon Sep 17 00:00:00 2001 +From c988d3d6608cd13ed2534315ed3bf730d2ddba2c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 10 Jun 2015 20:42:03 +0100 -Subject: [PATCH 40/58] [rbp] Fix zoom modes with stereoscopic videos +Subject: [PATCH 40/78] [rbp] Fix zoom modes with stereoscopic videos --- xbmc/cores/VideoRenderers/MMALRenderer.cpp | 12 ++++++++++-- @@ -2597,10 +3650,10 @@ index ba17a46..298eaff 100644 if (gui != display) { -From 84bc87e546d79c342b8a7c169f81e8521611cdb3 Mon Sep 17 00:00:00 2001 +From 72029e483a5d1ff5dbf7a1eda6f02b2755bc6ed4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 17:42:03 +0100 -Subject: [PATCH 41/58] [WinSystemEGL] Remove unused Support3D function +Subject: [PATCH 41/78] [WinSystemEGL] Remove unused Support3D function --- xbmc/windowing/egl/WinSystemEGL.cpp | 29 ----------------------------- @@ -2660,10 +3713,10 @@ index 9d4baf6..1ec4225 100644 EGLConfig GetEGLConfig(); -From 1597e6d82c667d55a763e965cb1e6448e0fbc01e Mon Sep 17 00:00:00 2001 +From bbe2c4e3962048ecd493268e586b86749af9e038 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 16 Apr 2014 21:18:06 +0100 -Subject: [PATCH 42/58] [omxplayer] Don't propagate 3d flags based on supported +Subject: [PATCH 42/78] [omxplayer] Don't propagate 3d flags based on supported 3d modes --- @@ -2719,10 +3772,10 @@ index 298eaff..3bf7c2e 100644 unsigned int iDisplayHeight = height; -From abadc22d9bed0fdf91c3a5be16dd07d8aa8d9f79 Mon Sep 17 00:00:00 2001 +From 0a56a42e0a89375e00451fd0727742bb897f4090 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 18:52:28 +0100 -Subject: [PATCH 43/58] [3d] Avoid switching stereo mode based on current +Subject: [PATCH 43/78] [3d] Avoid switching stereo mode based on current display mode --- @@ -2762,10 +3815,10 @@ index fc4cc95..e18232e 100644 RESOLUTION_INFO info_mod = GetResInfo(res); -From ecb3cd064f5df496cbf685eec4c4d680c3c79704 Mon Sep 17 00:00:00 2001 +From a96d0b58fb180abb244b7bdd73ddca8ab5c99f9c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jun 2015 23:13:51 +0100 -Subject: [PATCH 44/58] [rpi] Always add desktop resolution to supported list +Subject: [PATCH 44/78] [rpi] Always add desktop resolution to supported list There was an assumption that the desktop resolution would be in the probed list, but that is sometimes not the case. We don't add interlaced resolutions to list, but they can be the preferred resolution read from edid. See: @@ -2834,10 +3887,10 @@ index a1f67fd..69ce9b7 100644 CLog::Log(LOGDEBUG, "EGL mode %d: %s (%.2f) %s%s:%x\n", i, res.strMode.c_str(), res.fPixelRatio, tv->native ? "N" : "", tv->scan_mode ? "I" : "", tv->code); -From 71f32189c08f3001e0a00f3d21d799eb7b0ac9ba Mon Sep 17 00:00:00 2001 +From 5d0ec460e72d1265a001e609618852d56918feae Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 18:53:29 +0100 -Subject: [PATCH 45/58] [rbp] Drop reporting 3D modes and just use current +Subject: [PATCH 45/78] [rbp] Drop reporting 3D modes and just use current rendering mode to request 3D signalling --- @@ -2994,10 +4047,10 @@ index 69ce9b7..25a97ad 100644 } if (supported_modes) -From 23e4fb99f6f4ad1cc969cc8361dc55338769419f Mon Sep 17 00:00:00 2001 +From ad622b30e433dcdc0ea015fd46cb75fb1c73afe4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 30 Jun 2015 14:08:24 +0100 -Subject: [PATCH 46/58] [rbp] Ignore video stereo mode when 3D display mode is +Subject: [PATCH 46/78] [rbp] Ignore video stereo mode when 3D display mode is disabled --- @@ -3036,10 +4089,10 @@ index 3bf7c2e..5f6b402 100644 if (m_hints.orientation == 90 || m_hints.orientation == 270) { -From 72e7fc2a4f0701ce47e624c5c73f457ae8db93fd Mon Sep 17 00:00:00 2001 +From 78f4bccdbd9ef9509d7a704e08359a72a49416b0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 Jun 2015 16:27:15 +0100 -Subject: [PATCH 47/58] [EGL] Don't skip out when HDMI mode is considered the +Subject: [PATCH 47/78] [EGL] Don't skip out when HDMI mode is considered the same It might have different 3D signalling. TODO: keep track of 3D signalling @@ -3061,10 +4114,10 @@ index c43c4d0..13b75b1 100644 m_bFullScreen = fullScreen; -From 9747f3d0ba4d3fabe46c35ceaeb74d2ee5daf547 Mon Sep 17 00:00:00 2001 +From b7f37a646000c97a9bb5519624ec34857cb7ad42 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 21 Apr 2015 14:32:07 +0100 -Subject: [PATCH 48/58] [mmalrenderer] Add sharpness control +Subject: [PATCH 48/78] [mmalrenderer] Add sharpness control --- addons/resource.language.en_gb/resources/strings.po | 2 +- @@ -3073,7 +4126,7 @@ Subject: [PATCH 48/58] [mmalrenderer] Add sharpness control 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 6d861c1..c41b177 100644 +index 26ac2d7..f06ced6 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -7503,7 +7503,7 @@ msgstr "" @@ -3136,17 +4189,17 @@ index 1404fb3..9bced7e 100644 CCriticalSection m_sharedSection; MMAL_COMPONENT_T *m_vout; -From 7995698144c5b5c44dd9f4f80f17fa7803962586 Mon Sep 17 00:00:00 2001 +From bea8f5136835083a1cad4f7afdaad417d7c9d2ec Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 24 Apr 2015 13:49:51 +0100 -Subject: [PATCH 49/58] [dvdplayer] Add back required include +Subject: [PATCH 49/78] [dvdplayer] Add back required include --- xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 9be8aae..ebec92d 100644 +index fe3b2c2..73e9ce6 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -33,6 +33,7 @@ @@ -3158,10 +4211,10 @@ index 9be8aae..ebec92d 100644 #include "guilib/GraphicContext.h" #include -From 9cb45bcb661cf5de4814e304706d982352453f48 Mon Sep 17 00:00:00 2001 +From 57bd1fdf720099a9614cb65404800b093e59677e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 5 May 2015 23:58:06 +0100 -Subject: [PATCH 50/58] [screensaver] Leave GUI contents available for +Subject: [PATCH 50/78] [screensaver] Leave GUI contents available for screensaver --- @@ -3169,7 +4222,7 @@ Subject: [PATCH 50/58] [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 ba33908..17ea269 100644 +index 6030c4c..ccc2922 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -796,7 +796,16 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const vector Date: Fri, 15 May 2015 14:04:11 +0100 -Subject: [PATCH 52/58] [omxplayer] Make unsupported when ac3transcode is +Subject: [PATCH 52/78] [omxplayer] Make unsupported when ac3transcode is enabled --- @@ -3219,10 +4272,10 @@ index eff47e0..b954276 100644 { // find video stream -From 8294881aca9494a55c30f7347599779fe770c50d Mon Sep 17 00:00:00 2001 +From 0ba2a4632d72a370b06a633f2389d9cef26ade0b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 1 Jun 2015 14:14:43 +0100 -Subject: [PATCH 53/58] [omximage] Don't report failed decode of progressive +Subject: [PATCH 53/78] [omximage] Don't report failed decode of progressive jpegs as as error --- @@ -3308,10 +4361,10 @@ index a43a446..890ca88 100644 } -From 61003a22eb36823420523a2d3df994e1222e0cea Mon Sep 17 00:00:00 2001 +From 1fcc7db8cdd957520fd2891efd339ca22c8041a0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 25 May 2015 19:01:00 +0100 -Subject: [PATCH 54/58] [rbp] Allow settings option for timestamp preference +Subject: [PATCH 54/78] [rbp] Allow settings option for timestamp preference We currently have some files that play better with pts timestamps and some that play better with dts timestamps Provide a gui setting to allow users to adjust this behaviour until we have a better solution @@ -3323,10 +4376,10 @@ Provide a gui setting to allow users to adjust this behaviour until we have a be 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 0138e5f..2d043ec 100644 +index eb31d58..a631d80 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16714,3 +16714,13 @@ msgstr "" +@@ -16737,3 +16737,13 @@ msgstr "" msgctxt "#38121" msgid "This option supports 8 channel DTS HD decoding, but may use more CPU. It is only available when DTS and DTS-HD audio passthrough is disabled" msgstr "" @@ -3385,10 +4438,10 @@ index 5f6b402..ce23bec 100644 if (pts == DVD_NOPTS_VALUE) pts = dts; -From 9fc7a4289b865202e2b8d4ac9bc8174e1001e1ad Mon Sep 17 00:00:00 2001 +From 1a903b160ef9ffe7863809dcd9823ce988b14985 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 6 Jun 2015 18:44:37 +0100 -Subject: [PATCH 55/58] [rbp] Ignore pts value when m_hints.ptsinvalid set +Subject: [PATCH 55/78] [rbp] Ignore pts value when m_hints.ptsinvalid set --- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- @@ -3422,10 +4475,10 @@ index ce23bec..e17fdb8 100644 if (pts == DVD_NOPTS_VALUE) pts = dts; -From 08b2eeaffdfdd1dc124ee3eb2f5a21b664074eca Mon Sep 17 00:00:00 2001 +From ad59ec8d6c5a9ea0d19cd5811328d248c91d6fee Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 6 Jun 2015 18:43:57 +0100 -Subject: [PATCH 56/58] ffmpeg: Automatic switch to software decode for GMC +Subject: [PATCH 56/78] ffmpeg: Automatic switch to software decode for GMC with more than one warp point --- @@ -3596,10 +4649,10 @@ index b954276..b5ee4b6 100644 else if ((hint.codec == AV_CODEC_ID_VC1 || hint.codec == AV_CODEC_ID_WMV3) && g_RBP.GetCodecWvc1()) supported = true; -From e51804ed122dd0a642104d102315787970fffb8d Mon Sep 17 00:00:00 2001 +From d2e8678eee1dbe76045263a5e9d4717a1b38317d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 Jun 2015 21:46:57 +0100 -Subject: [PATCH 57/58] [rbp] Use default resampling setting on Pi2 +Subject: [PATCH 57/78] [rbp] Use default resampling setting on Pi2 --- system/settings/rbp2.xml | 5 +++++ @@ -3622,10 +4675,10 @@ index b29a428..1c8b116 100644
-From 175260bab79c330366834bd86512afc2902dba0a Mon Sep 17 00:00:00 2001 +From 4fee25bba08a77b13f2892f587cf30ee8f402c41 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 25 Jun 2015 19:43:10 +0100 -Subject: [PATCH 58/58] [rbp] HW mouse pointer +Subject: [PATCH 58/78] [rbp] HW mouse pointer Updating the mouse point provokes a complete screen update which can make it feel laggy and results in high cpu. @@ -3644,7 +4697,7 @@ Requires recent firmware. create mode 100644 xbmc/linux/rpi_user_vcsm.h diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp -index 17ea269..6965319 100644 +index ccc2922..7bcda5c 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -193,7 +193,9 @@ void CGUIWindowManager::CreateWindows() @@ -4662,3 +5715,1068 @@ index f6c8df0..5c2b583 100644 }; #endif + +From 58fc811ecf11a4d58f09dd6146acf6031e17cd44 Mon Sep 17 00:00:00 2001 +From: Roman Kraevskiy +Date: Fri, 10 Jul 2015 23:36:34 +0300 +Subject: [PATCH 59/78] Mouse wheel support for X11-less linux distros + (openelec) + +--- + xbmc/input/linux/LinuxInputDevices.cpp | 125 +++++++++++++++++++++------------ + xbmc/input/linux/LinuxInputDevices.h | 2 + + 2 files changed, 82 insertions(+), 45 deletions(-) + +diff --git a/xbmc/input/linux/LinuxInputDevices.cpp b/xbmc/input/linux/LinuxInputDevices.cpp +index 32a3b46..b028cd1 100644 +--- a/xbmc/input/linux/LinuxInputDevices.cpp ++++ b/xbmc/input/linux/LinuxInputDevices.cpp +@@ -558,22 +558,27 @@ bool CLinuxInputDevice::KeyEvent(const struct input_event& levt, XBMC_Event& dev + */ + bool CLinuxInputDevice::RelEvent(const struct input_event& levt, XBMC_Event& devt) + { ++ bool motion = false; ++ bool wheel = false; ++ + switch (levt.code) + { + case REL_X: + m_mouseX += levt.value; + devt.motion.xrel = levt.value; + devt.motion.yrel = 0; ++ motion = true; + break; +- + case REL_Y: + m_mouseY += levt.value; + devt.motion.xrel = 0; + devt.motion.yrel = levt.value; ++ motion = true; + break; +- +- case REL_Z: + case REL_WHEEL: ++ wheel = (levt.value != 0); // process wheel event only when there was some delta ++ break; ++ case REL_Z: + default: + CLog::Log(LOGWARNING, "CLinuxInputDevice::RelEvent: Unknown rel event code: %d\n", levt.code); + return false; +@@ -588,13 +593,35 @@ bool CLinuxInputDevice::RelEvent(const struct input_event& levt, XBMC_Event& dev + m_mouseY = std::max(0, m_mouseY); + + +- devt.type = XBMC_MOUSEMOTION; +- devt.motion.type = XBMC_MOUSEMOTION; +- devt.motion.x = m_mouseX; +- devt.motion.y = m_mouseY; +- devt.motion.state = 0; +- devt.motion.which = m_deviceIndex; +- ++ if (motion) ++ { ++ devt.type = XBMC_MOUSEMOTION; ++ devt.motion.type = XBMC_MOUSEMOTION; ++ devt.motion.x = m_mouseX; ++ devt.motion.y = m_mouseY; ++ devt.motion.state = 0; ++ devt.motion.which = m_deviceIndex; ++ } ++ else if (wheel) ++ { ++ devt.type = XBMC_MOUSEBUTTONUP; ++ devt.button.state = XBMC_RELEASED; ++ devt.button.type = devt.type; ++ devt.button.x = m_mouseX; ++ devt.button.y = m_mouseY; ++ devt.button.button = (levt.value<0) ? XBMC_BUTTON_WHEELDOWN:XBMC_BUTTON_WHEELUP; ++ ++ /* but WHEEL up enent to the queue */ ++ m_equeue.push_back(devt); ++ ++ /* prepare and return WHEEL down event */ ++ devt.button.state = XBMC_PRESSED; ++ devt.type = XBMC_MOUSEBUTTONDOWN; ++ } ++ else ++ { ++ return false; ++ } + + return true; + } +@@ -693,57 +720,65 @@ XBMC_Event CLinuxInputDevice::ReadEvent() + + XBMC_Event devt; + +- while (1) ++ if (m_equeue.empty()) + { +- bzero(&levt, sizeof(levt)); ++ while (1) ++ { ++ bzero(&levt, sizeof(levt)); + +- bzero(&devt, sizeof(devt)); +- devt.type = XBMC_NOEVENT; ++ bzero(&devt, sizeof(devt)); ++ devt.type = XBMC_NOEVENT; + +- if(m_devicePreferredId == LI_DEVICE_NONE) +- return devt; ++ if(m_devicePreferredId == LI_DEVICE_NONE) ++ return devt; + +- readlen = read(m_fd, &levt, sizeof(levt)); ++ readlen = read(m_fd, &levt, sizeof(levt)); + +- if (readlen <= 0) +- { +- if (errno == ENODEV) ++ if (readlen <= 0) + { +- CLog::Log(LOGINFO,"input device was unplugged %s",m_deviceName); +- m_bUnplugged = true; ++ if (errno == ENODEV) ++ { ++ CLog::Log(LOGINFO,"input device was unplugged %s",m_deviceName); ++ m_bUnplugged = true; ++ } ++ ++ break; + } + +- break; +- } ++ //printf("read event readlen = %d device name %s m_fileName %s\n", readlen, m_deviceName, m_fileName.c_str()); + +- //printf("read event readlen = %d device name %s m_fileName %s\n", readlen, m_deviceName, m_fileName.c_str()); ++ // sanity check if we realy read the event ++ if(readlen != sizeof(levt)) ++ { ++ printf("CLinuxInputDevice: read error : %s\n", strerror(errno)); ++ break; ++ } + +- // sanity check if we realy read the event +- if(readlen != sizeof(levt)) +- { +- printf("CLinuxInputDevice: read error : %s\n", strerror(errno)); +- break; +- } ++ if (!TranslateEvent(levt, devt)) ++ continue; + +- if (!TranslateEvent(levt, devt)) +- continue; ++ /* Flush previous event with DIEF_FOLLOW? */ ++ if (devt.type != XBMC_NOEVENT) ++ { ++ //printf("new event! type = %d\n", devt.type); ++ //printf("key: %d %d %d %c\n", devt.key.keysym.scancode, devt.key.keysym.sym, devt.key.keysym.mod, devt.key.keysym.unicode); + +- /* Flush previous event with DIEF_FOLLOW? */ +- if (devt.type != XBMC_NOEVENT) +- { +- //printf("new event! type = %d\n", devt.type); +- //printf("key: %d %d %d %c\n", devt.key.keysym.scancode, devt.key.keysym.sym, devt.key.keysym.mod, devt.key.keysym.unicode); ++ if (m_hasLeds && (m_keyMods != m_lastKeyMods)) ++ { ++ SetLed(LED_NUML, m_keyMods & XBMCKMOD_NUM); ++ SetLed(LED_CAPSL, m_keyMods & XBMCKMOD_CAPS); ++ m_lastKeyMods = m_keyMods; ++ } + +- if (m_hasLeds && (m_keyMods != m_lastKeyMods)) +- { +- SetLed(LED_NUML, m_keyMods & XBMCKMOD_NUM); +- SetLed(LED_CAPSL, m_keyMods & XBMCKMOD_CAPS); +- m_lastKeyMods = m_keyMods; ++ break; + } +- +- break; + } + } ++ else ++ { ++ devt = m_equeue.front(); ++ m_equeue.pop_front(); ++ } + + return devt; + } +diff --git a/xbmc/input/linux/LinuxInputDevices.h b/xbmc/input/linux/LinuxInputDevices.h +index cf1c5ce..954d823 100644 +--- a/xbmc/input/linux/LinuxInputDevices.h ++++ b/xbmc/input/linux/LinuxInputDevices.h +@@ -22,6 +22,7 @@ + + #include + #include ++#include + #include "windowing/XBMC_events.h" + #include "input/XBMC_keyboard.h" + #include "threads/SingleLock.h" +@@ -79,6 +80,7 @@ class CLinuxInputDevice + int m_deviceMaxAxis; + bool m_bSkipNonKeyEvents; + bool m_bUnplugged; ++ std::deque m_equeue; + }; + + class CLinuxInputDevices + +From 6680f853007efce192edf2ce2a9b1cf88158c647 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 22 Jun 2015 22:06:53 +0100 +Subject: [PATCH 60/78] [rbp] Flip default of prefer pts timestamps + +--- + system/settings/rbp.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index 8c6e69d..f9528bc 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -45,7 +45,7 @@ + + + 3 +- false ++ true + + + + +From 1bbcc8240084f5a5fdd76ed25217f0598b30da0a Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 7 May 2015 14:28:37 +0100 +Subject: [PATCH 61/78] build: Add vcsm lib + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 084c2cf..98a1b26 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1059,7 +1059,7 @@ if test "$use_gles" = "yes"; then + AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."]) + AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."]) + AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.) +- LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util" ++ LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm" + else + AC_CHECK_LIB([EGL], [main],, AC_MSG_ERROR($missing_library)) + AC_CHECK_LIB([GLESv2],[main],, AC_MSG_ERROR($missing_library)) + +From aab122b6015b5274836cb1f6e59229f21e7cc72c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 20 Jul 2015 16:11:37 +0100 +Subject: [PATCH 62/78] [mmalcodec] Populate the framerate of video decoder + +When timestamps are unknown, they may be interpolated based on the framerate. Without setting this, +a default of 30fps is used which may be incorrect and cause stutters +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 3e97f1d..5b064d2 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -629,6 +629,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + m_dec_input->format->es->video.width = ALIGN_UP(m_hints.width, 32); + m_dec_input->format->es->video.height = ALIGN_UP(m_hints.height, 16); + } ++ if (hints.fpsrate > 0 && hints.fpsscale > 0) ++ { ++ m_dec_input->format->es->video.frame_rate.num = hints.fpsrate; ++ m_dec_input->format->es->video.frame_rate.den = hints.fpsscale; ++ } + m_dec_input->format->flags |= MMAL_ES_FORMAT_FLAG_FRAMED; + + error_concealment.hdr.id = MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT; + +From c448fb336cd6b7e07dae7dc0b1c357da26f2d0f5 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 22 Jul 2015 22:52:46 +0100 +Subject: [PATCH 63/78] [mmalcodec] Enable interpolate timestamps + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 5b064d2..a202421 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -647,7 +647,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + if (status != MMAL_SUCCESS) + CLog::Log(LOGERROR, "%s::%s Failed to enable extra buffers on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); + +- status = mmal_port_parameter_set_uint32(m_dec_input, MMAL_PARAMETER_VIDEO_INTERPOLATE_TIMESTAMPS, 0); ++ status = mmal_port_parameter_set_uint32(m_dec_input, MMAL_PARAMETER_VIDEO_INTERPOLATE_TIMESTAMPS, 1); + if (status != MMAL_SUCCESS) + CLog::Log(LOGERROR, "%s::%s Failed to disable interpolate timestamps mode on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); + + +From e5e72775474a6c93f8dc776331e123ea77bd7e88 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 23 Jul 2015 00:55:47 +0100 +Subject: [PATCH 64/78] Revert "[rbp] Flip default of prefer pts timestamps" + +This reverts commit 34100dcdf830a0e957df585108066c48d6c5c38d. +--- + system/settings/rbp.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index f9528bc..8c6e69d 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -45,7 +45,7 @@ + + + 3 +- true ++ false + + + + +From 4e8844c1c9c32823ae7ca342982e1b355dfee132 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 23 Jul 2015 00:56:56 +0100 +Subject: [PATCH 65/78] Revert "[rbp] Allow settings option for timestamp + preference" + +This reverts commit c0eef926dd376cbf8a7857b2848e118ea3689b98. +--- + addons/resource.language.en_gb/resources/strings.po | 10 ---------- + system/settings/rbp.xml | 7 ------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- + xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 2 +- + 4 files changed, 2 insertions(+), 19 deletions(-) + +diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po +index a631d80..eb31d58 100644 +--- a/addons/resource.language.en_gb/resources/strings.po ++++ b/addons/resource.language.en_gb/resources/strings.po +@@ -16737,13 +16737,3 @@ msgstr "" + msgctxt "#38121" + msgid "This option supports 8 channel DTS HD decoding, but may use more CPU. It is only available when DTS and DTS-HD audio passthrough is disabled" + msgstr "" +- +-#: system/settings/rbp.xml +-msgctxt "#38210" +-msgid "Prefer PTS timestamps" +-msgstr "" +- +-#: system/settings/rbp.xml +-msgctxt "#38211" +-msgid "Try enabling this if you have stutter with video files" +-msgstr "" +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index 8c6e69d..b27d23f 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -42,13 +42,6 @@ + +
+ +- +- +- 3 +- false +- +- +- + + + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index a202421..5d054bb 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -804,7 +804,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + pts = 0; + buffer->pts = pts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : pts; + buffer->dts = dts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : dts; +- if (m_hints.ptsinvalid || (buffer->dts != MMAL_TIME_UNKNOWN && !CSettings::Get().GetBool("videoplayer.preferptstimestamps"))) buffer->pts = MMAL_TIME_UNKNOWN; ++ if (m_hints.ptsinvalid) buffer->pts = MMAL_TIME_UNKNOWN; + buffer->length = demuxer_bytes > buffer->alloc_size ? buffer->alloc_size : demuxer_bytes; + // set a flag so we can identify primary frames from generated frames (deinterlace) + buffer->flags = MMAL_BUFFER_HEADER_FLAG_USER0; +diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +index e17fdb8..f06ee9c 100644 +--- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp ++++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +@@ -495,7 +495,7 @@ void OMXPlayerVideo::Process() + if (pts != DVD_NOPTS_VALUE) + pts += m_iVideoDelay; + +- m_omxVideo.Decode(pPacket->pData, pPacket->iSize, dts, m_hints.ptsinvalid || (dts != DVD_NOPTS_VALUE && !CSettings::Get().GetBool("videoplayer.preferptstimestamps")) ? DVD_NOPTS_VALUE : pts); ++ m_omxVideo.Decode(pPacket->pData, pPacket->iSize, dts, m_hints.ptsinvalid ? DVD_NOPTS_VALUE : pts); + + if (pts == DVD_NOPTS_VALUE) + pts = dts; + +From 0f328c607bcbecb752f06752996146d92bfcdd7d Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 23 Jul 2015 15:52:39 +0100 +Subject: [PATCH 66/78] [omxhelper] Ignore embedded coverart image when looking + for supported video streams + +--- + xbmc/cores/omxplayer/OMXHelper.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp +index b5ee4b6..59479fe 100644 +--- a/xbmc/cores/omxplayer/OMXHelper.cpp ++++ b/xbmc/cores/omxplayer/OMXHelper.cpp +@@ -72,7 +72,7 @@ bool OMXPlayerUnsuitable(bool m_HasVideo, bool m_HasAudio, CDVDDemux* m_pDemuxer + { + int iStream = it->id; + CDemuxStream *stream = m_pDemuxer->GetStream(iStream); +- if(!stream || stream->disabled) ++ if(!stream || stream->disabled || stream->flags & AV_DISPOSITION_ATTACHED_PIC) + continue; + CDVDStreamInfo hint(*stream, true); + +From fc3e55399cf44677546fde77958e96a455015f1c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 24 Jul 2015 18:39:25 +0100 +Subject: [PATCH 68/78] [mmalcodec] Don't set initial unknown timestamps to + zero + +This used to be done to keep the firmware happy, but is no longer required and messes with timestamp statistics +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 8 -------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 - + 2 files changed, 9 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 5d054bb..b2ac68f 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -106,7 +106,6 @@ CMMALVideo::CMMALVideo() + + m_interlace_mode = MMAL_InterlaceProgressive; + m_interlace_method = VS_INTERLACEMETHOD_NONE; +- m_startframe = false; + m_decoderPts = DVD_NOPTS_VALUE; + + m_dec = NULL; +@@ -713,7 +712,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + return false; + + Prime(); +- m_startframe = false; + m_preroll = !m_hints.stills; + m_speed = DVD_PLAYSPEED_NORMAL; + +@@ -800,8 +798,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + mmal_buffer_header_reset(buffer); + buffer->cmd = 0; +- if (!m_startframe && pts == DVD_NOPTS_VALUE) +- pts = 0; + buffer->pts = pts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : pts; + buffer->dts = dts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : dts; + if (m_hints.ptsinvalid) buffer->pts = MMAL_TIME_UNKNOWN; +@@ -829,9 +825,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + if (demuxer_bytes == 0) + { +- pthread_mutex_lock(&m_output_mutex); +- m_startframe = true; +- pthread_mutex_unlock(&m_output_mutex); + EDEINTERLACEMODE deinterlace_request = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; + EINTERLACEMETHOD interlace_method = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); + +@@ -956,7 +949,6 @@ void CMMALVideo::Reset(void) + SendCodecConfigData(); + Prime(); + } +- m_startframe = false; + m_decoderPts = DVD_NOPTS_VALUE; + m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); + m_codecControlFlags = 0; +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index bde8c06..42d6a7b 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -127,7 +127,6 @@ class CMMALVideo : public CDVDVideoCodec + // Components + MMAL_INTERLACETYPE_T m_interlace_mode; + EINTERLACEMETHOD m_interlace_method; +- bool m_startframe; + double m_decoderPts; + int m_speed; + bool m_preroll; + +From fa541caf9b865c84267f4173ddbbc7125891551f Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 24 Jul 2015 22:53:21 +0100 +Subject: [PATCH 69/78] [mmalcodec] Tidy up setting of timestamp flags + +--- + xbmc/cores/omxplayer/OMXVideo.cpp | 27 ++++++++++++++------------- + 1 file changed, 14 insertions(+), 13 deletions(-) + +diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp +index 832a9c9..1a08aa9 100644 +--- a/xbmc/cores/omxplayer/OMXVideo.cpp ++++ b/xbmc/cores/omxplayer/OMXVideo.cpp +@@ -754,6 +754,19 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts) + + if (demuxer_content && demuxer_bytes > 0) + { ++ OMX_U32 nFlags = 0; ++ ++ if(m_setStartTime) ++ { ++ nFlags |= OMX_BUFFERFLAG_STARTTIME; ++ CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE); ++ m_setStartTime = false; ++ } ++ if (pts == DVD_NOPTS_VALUE && dts == DVD_NOPTS_VALUE) ++ nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN; ++ else if (pts == DVD_NOPTS_VALUE) ++ nFlags |= OMX_BUFFERFLAG_TIME_IS_DTS; ++ + while(demuxer_bytes) + { + // 500ms timeout +@@ -764,21 +777,9 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts) + return false; + } + +- omx_buffer->nFlags = 0; ++ omx_buffer->nFlags = nFlags; + omx_buffer->nOffset = 0; + omx_buffer->nTimeStamp = ToOMXTime((uint64_t)(pts != DVD_NOPTS_VALUE ? pts : dts != DVD_NOPTS_VALUE ? dts : 0)); +- +- if(m_setStartTime) +- { +- omx_buffer->nFlags |= OMX_BUFFERFLAG_STARTTIME; +- CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE); +- m_setStartTime = false; +- } +- else if (pts == DVD_NOPTS_VALUE && dts == DVD_NOPTS_VALUE) +- omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN; +- else if (pts == DVD_NOPTS_VALUE) +- omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_IS_DTS; +- + omx_buffer->nFilledLen = std::min((OMX_U32)demuxer_bytes, omx_buffer->nAllocLen); + memcpy(omx_buffer->pBuffer, demuxer_content, omx_buffer->nFilledLen); + + +From 4b4e9d07037b9c8174f9e94f0fc8e613f2e69b6c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Sat, 25 Jul 2015 15:32:35 +0100 +Subject: [PATCH 70/78] [rbp] Only send changes in hw cursor state + +--- + xbmc/linux/RBP.cpp | 9 ++++++++- + xbmc/linux/RBP.h | 5 ++++- + 2 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp +index 2c8d09b..3953740 100644 +--- a/xbmc/linux/RBP.cpp ++++ b/xbmc/linux/RBP.cpp +@@ -61,6 +61,9 @@ CRBP::CRBP() + m_OMX = new COMXCore(); + m_display = DISPMANX_NO_HANDLE; + m_p = NULL; ++ m_x = 0; ++ m_y = 0; ++ m_enabled = 0; + m_mb = mbox_open(); + vcsm_init(); + } +@@ -482,7 +485,11 @@ void CRBP::update_cursor(int x, int y, bool enabled) + int y2 = y * display.Height() / gui.Height(); + + //printf("%s %d,%d (%d)\n", __func__, x, y, enabled); +- mailbox_set_cursor_position(m_mb, enabled, x2, y2); ++ if (m_x != x2 || m_y != y2 || m_enabled != enabled) ++ mailbox_set_cursor_position(m_mb, enabled, x2, y2); ++ m_x = x2; ++ m_y = y2; ++ m_enabled = enabled; + } + + void CRBP::uninit_cursor() +diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h +index f233a5e..be0cafc 100644 +--- a/xbmc/linux/RBP.h ++++ b/xbmc/linux/RBP.h +@@ -86,7 +86,10 @@ class CRBP + + struct gpu_mem_ptr_s *m_p; + int m_mb; +-public: ++ int m_x; ++ int m_y; ++ bool m_enabled; ++ public: + void init_cursor(); + void set_cursor(const void *pixels, int width, int height, int hotspot_x, int hotspot_y); + void update_cursor(int x, int y, bool enabled); + +From ba118a42fd57aea853f2a869dc93f325eb20f8cb Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Jul 2015 00:08:58 +0100 +Subject: [PATCH 71/78] [mmalcodec] Use both dts and pts for determining amount + of queued data + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 10 ++++++++-- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 + + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index b2ac68f..6cf4023 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -107,6 +107,7 @@ CMMALVideo::CMMALVideo() + m_interlace_mode = MMAL_InterlaceProgressive; + m_interlace_method = VS_INTERLACEMETHOD_NONE; + m_decoderPts = DVD_NOPTS_VALUE; ++ m_demuxerPts = DVD_NOPTS_VALUE; + + m_dec = NULL; + m_dec_input = NULL; +@@ -853,7 +854,11 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + break; + } + int ret = 0; +- double queued = m_decoderPts != DVD_NOPTS_VALUE && pts != DVD_NOPTS_VALUE ? pts - m_decoderPts : 0.0; ++ if (pts != DVD_NOPTS_VALUE) ++ m_demuxerPts = pts; ++ else if (dts != DVD_NOPTS_VALUE) ++ m_demuxerPts = dts; ++ double queued = m_decoderPts != DVD_NOPTS_VALUE && m_demuxerPts != DVD_NOPTS_VALUE ? m_demuxerPts - m_decoderPts : 0.0; + if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !m_demux_queue_length && queued <= DVD_MSEC_TO_TIME(500)) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -950,6 +955,7 @@ void CMMALVideo::Reset(void) + Prime(); + } + m_decoderPts = DVD_NOPTS_VALUE; ++ m_demuxerPts = DVD_NOPTS_VALUE; + m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); + m_codecControlFlags = 0; + } +@@ -1043,7 +1049,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) + if (pDvdVideoPicture->pts != DVD_NOPTS_VALUE) + m_decoderPts = pDvdVideoPicture->pts; + else +- m_decoderPts = pDvdVideoPicture->dts; // xxx is DVD_NOPTS_VALUE better? ++ m_decoderPts = pDvdVideoPicture->dts; + + return true; + } +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index 42d6a7b..f8f5209 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -127,6 +127,7 @@ class CMMALVideo : public CDVDVideoCodec + // Components + MMAL_INTERLACETYPE_T m_interlace_mode; + EINTERLACEMETHOD m_interlace_method; ++ double m_demuxerPts; + double m_decoderPts; + int m_speed; + bool m_preroll; + +From e2c51d36ef4283b01faf81014f6df1c328d8cd97 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Jul 2015 17:47:33 +0100 +Subject: [PATCH 72/78] [rbp] Refactor the vsync handle to support multiple + callers + +--- + xbmc/linux/RBP.cpp | 68 ++++++++++++++++++++++++++++++------------------------ + xbmc/linux/RBP.h | 7 ++++-- + 2 files changed, 43 insertions(+), 32 deletions(-) + +diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp +index 3953740..901250e 100644 +--- a/xbmc/linux/RBP.cpp ++++ b/xbmc/linux/RBP.cpp +@@ -66,6 +66,7 @@ CRBP::CRBP() + m_enabled = 0; + m_mb = mbox_open(); + vcsm_init(); ++ m_vsync_count = 0; + } + + CRBP::~CRBP() +@@ -143,11 +144,45 @@ void CRBP::LogFirmwareVerison() + CLog::Log(LOGNOTICE, "Config:\n%s", response); + } + ++static void vsync_callback_static(DISPMANX_UPDATE_HANDLE_T u, void *arg) ++{ ++ CRBP *rbp = reinterpret_cast(arg); ++ rbp->VSyncCallback(); ++} ++ ++void CRBP::VSyncCallback() ++{ ++ CSingleLock lock(m_vsync_lock); ++ m_vsync_count++; ++ m_vsync_cond.notifyAll(); ++} ++ ++unsigned int CRBP::WaitVsync(unsigned int target) ++{ ++ CSingleLock lock(m_vsync_lock); ++ if (target == ~0U) ++ target = m_vsync_count+1; ++ ++ if (m_display == DISPMANX_NO_HANDLE) ++ { ++ CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); ++ return m_vsync_count; ++ } ++ ++ while (m_vsync_count < target) ++ if (!m_vsync_cond.wait(lock, 100)) ++ break; ++ ++ return m_vsync_count; ++} ++ + DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) + { + if (m_display == DISPMANX_NO_HANDLE) + { + m_display = vc_dispmanx_display_open( 0 /*screen*/ ); ++ int s = vc_dispmanx_vsync_callback(m_display, vsync_callback_static, (void *)this); ++ assert(s == 0); + init_cursor(); + } + return m_display; +@@ -156,9 +191,11 @@ DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) + void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display) + { + assert(display == m_display); ++ int s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); ++ assert(s == 0); ++ uninit_cursor(); + vc_dispmanx_display_close(m_display); + m_display = DISPMANX_NO_HANDLE; +- uninit_cursor(); + } + + void CRBP::GetDisplaySize(int &width, int &height) +@@ -211,35 +248,6 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw + return image; + } + +- +-static void vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *arg) +-{ +- CEvent *sync = (CEvent *)arg; +- sync->Set(); +-} +- +-void CRBP::WaitVsync() +-{ +- int s; +- DISPMANX_DISPLAY_HANDLE_T m_display = vc_dispmanx_display_open( 0 /*screen*/ ); +- if (m_display == DISPMANX_NO_HANDLE) +- { +- CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); +- return; +- } +- m_vsync.Reset(); +- s = vc_dispmanx_vsync_callback(m_display, vsync_callback, (void *)&m_vsync); +- if (s == 0) +- { +- m_vsync.WaitMSec(1000); +- } +- else assert(0); +- s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); +- assert(s == 0); +- vc_dispmanx_display_close( m_display ); +-} +- +- + void CRBP::Deinitialize() + { + if (m_omx_image_init) +diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h +index be0cafc..0572b47 100644 +--- a/xbmc/linux/RBP.h ++++ b/xbmc/linux/RBP.h +@@ -65,7 +65,8 @@ class CRBP + // stride can be null for packed output + unsigned char *CaptureDisplay(int width, int height, int *stride, bool swap_red_blue, bool video_only = true); + DllOMX *GetDllOMX() { return m_OMX ? m_OMX->GetDll() : NULL; } +- void WaitVsync(); ++ unsigned int WaitVsync(unsigned int target = ~0U); ++ void VSyncCallback(); + double AdjustHDMIClock(double adjust); + + private: +@@ -80,7 +81,9 @@ class CRBP + bool m_codec_wvc1_enabled; + COMXCore *m_OMX; + DISPMANX_DISPLAY_HANDLE_T m_display; +- CEvent m_vsync; ++ CCriticalSection m_vsync_lock; ++ XbmcThreads::ConditionVariable m_vsync_cond; ++ unsigned int m_vsync_count; + class DllLibOMXCore; + CCriticalSection m_critSection; + + +From 25b97dad714c40d7f5bc254237dfe303635dfc9c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 14:06:17 +0100 +Subject: [PATCH 73/78] [mmalrenderer] Wait for vsync before submitting to mmal + when display sync is disabled + +This avoids an issue where video occasionally goes stuttery after a seek, until the next pause/play or seek. +The issue is when display sync is disabled, and framerate of video matches display, and render times are coincident with vsync +you find that depending on timestamp/scheduling jitter, you may or may not get an update each vsync resulting in stuttery video. + +Some scheme to force render times to be dependent on vsync is required. We do this by blocking in RenderUpdate unto next vsync. +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 23 +++++++++++++++++++++-- + xbmc/cores/VideoRenderers/MMALRenderer.h | 2 ++ + 2 files changed, 23 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index fb92079..2e2bc83 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -208,6 +208,7 @@ CMMALRenderer::CMMALRenderer() + m_bMMALConfigured = false; + m_iYV12RenderBuffer = 0; + m_sharpness = -2.0f; ++ m_vsyncCount = ~0; + } + + CMMALRenderer::~CMMALRenderer() +@@ -357,6 +358,24 @@ void CMMALRenderer::Update() + ManageDisplay(); + } + ++void CMMALRenderer::SubmitFrame(MMAL_BUFFER_HEADER_T *buffer) ++{ ++ if (!CSettings::Get().GetBool("videoplayer.usedisplayasclock")) ++ { ++ if (fabs(m_fps - g_graphicsContext.GetFPS()) < 1e-2) ++ { ++ #if defined(MMAL_DEBUG_VERBOSE) ++ CLog::Log(LOGDEBUG, "%s::%s - buffer:%p vfps:%.3f dfps:%.3f vsync:%d dsync:%d", CLASSNAME, __func__, buffer, m_fps, g_graphicsContext.GetFPS(), m_vsyncCount, CSettings::Get().GetBool("videoplayer.usedisplayasclock")); ++ #endif ++ m_vsyncCount = g_RBP.WaitVsync(m_vsyncCount) + 1; ++ #if defined(MMAL_DEBUG_VERBOSE) ++ CLog::Log(LOGDEBUG, "%s::%s - done vsync:%d", CLASSNAME, __func__, m_vsyncCount); ++ #endif ++ } ++ } ++ mmal_port_send_buffer(m_vout_input, buffer); ++} ++ + void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + { + CSingleLock lock(m_sharedSection); +@@ -402,7 +421,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + return; + omvb->Acquire(); + omvb->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; +- mmal_port_send_buffer(m_vout_input, omvb->mmal_buffer); ++ SubmitFrame(omvb->mmal_buffer); + } + else + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); +@@ -417,7 +436,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + return; + // sanity check it is not on display + buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; +- mmal_port_send_buffer(m_vout_input, buffer->mmal_buffer); ++ SubmitFrame(buffer->mmal_buffer); + } + else + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h +index 9bced7e..ec279ed 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.h ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.h +@@ -99,6 +99,7 @@ class CMMALRenderer : public CBaseRenderer + unsigned int m_destWidth; + unsigned int m_destHeight; + int m_neededBuffers; ++ int m_vsyncCount; + + CRect m_src_rect; + CRect m_dst_rect; +@@ -115,4 +116,5 @@ class CMMALRenderer : public CBaseRenderer + bool init_vout(ERenderFormat format); + void ReleaseBuffers(); + void UnInitMMAL(); ++ void SubmitFrame(MMAL_BUFFER_HEADER_T *buffer); + }; + +From 76a3c63f0af369ff0bcf906f3890b67f9d03c3ff Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 15:07:22 +0100 +Subject: [PATCH 74/78] [omxplayer] Support per refresh rate display latency + settings + +--- + xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +index f06ee9c..4ad66a8 100644 +--- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp ++++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +@@ -490,10 +490,10 @@ void OMXPlayerVideo::Process() + double pts = pPacket->pts; + + if (dts != DVD_NOPTS_VALUE) +- dts += m_iVideoDelay; ++ dts += m_iVideoDelay - DVD_SEC_TO_TIME(g_renderManager.GetDisplayLatency()); + + if (pts != DVD_NOPTS_VALUE) +- pts += m_iVideoDelay; ++ pts += m_iVideoDelay - DVD_SEC_TO_TIME(g_renderManager.GetDisplayLatency()); + + m_omxVideo.Decode(pPacket->pData, pPacket->iSize, dts, m_hints.ptsinvalid ? DVD_NOPTS_VALUE : pts); + + +From b69979329ae249cb2ba4959d0bf59dcd2838054b Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 15:46:18 +0100 +Subject: [PATCH 75/78] squash: release gfx lock when blocking + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 2e2bc83..c80a8a6 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -367,6 +367,7 @@ void CMMALRenderer::SubmitFrame(MMAL_BUFFER_HEADER_T *buffer) + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - buffer:%p vfps:%.3f dfps:%.3f vsync:%d dsync:%d", CLASSNAME, __func__, buffer, m_fps, g_graphicsContext.GetFPS(), m_vsyncCount, CSettings::Get().GetBool("videoplayer.usedisplayasclock")); + #endif ++ CSingleExit lock(g_graphicsContext); + m_vsyncCount = g_RBP.WaitVsync(m_vsyncCount) + 1; + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - done vsync:%d", CLASSNAME, __func__, m_vsyncCount); + +From af3782bcc1597444ef517c6426edeab184ca7d9d Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 17:34:11 +0100 +Subject: [PATCH 76/78] [rbp] Leave 3D framepacking output disabled by default + +--- + system/settings/rbp.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index b27d23f..bf3b05f 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -38,7 +38,7 @@ + true + + 2 +- true ++ false + +
+ + +From 6ee5be10bfd9d9e3dd219a81191e0a5e94b4f990 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 17:26:30 +0100 +Subject: [PATCH 77/78] [omxplayer] Allow automatic switching back to omxplayer + after it has been disabled + +Omxplayer gets disabled when it is unsuitable (e.g. software decoder required, or ALSA audio or AC3 transcode). +However if you play another file without quitting dvdplayer, it doesn't reconsider. + +E.g. play divx3 file and omxplayer is disabled. If you then launch a h.264 file while first file is still playing it doesn't switch +back to omxplayer as you might expect. + +This patch allows a switch back to omxplayer mode +--- + xbmc/cores/dvdplayer/DVDPlayer.cpp | 5 +++-- + xbmc/cores/omxplayer/OMXHelper.cpp | 3 +++ + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp +index 8252192..f8e7570 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp +@@ -519,10 +519,11 @@ void CDVDPlayer::CreatePlayers() + { + CSingleLock lock(m_players_lock); + #ifdef HAS_OMXPLAYER +- if (m_omxplayer_mode && OMXPlayerUnsuitable(m_HasVideo, m_HasAudio, m_pDemuxer, m_pInputStream, m_SelectionStreams)) ++ bool omx_suitable = !OMXPlayerUnsuitable(m_HasVideo, m_HasAudio, m_pDemuxer, m_pInputStream, m_SelectionStreams); ++ if (m_omxplayer_mode != omx_suitable) + { + DestroyPlayers(); +- m_omxplayer_mode = false; ++ m_omxplayer_mode = omx_suitable; + } + #endif + if (m_players_created) +diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp +index 59479fe..014eaf1 100644 +--- a/xbmc/cores/omxplayer/OMXHelper.cpp ++++ b/xbmc/cores/omxplayer/OMXHelper.cpp +@@ -44,6 +44,9 @@ static bool PredicateVideoPriority(const SelectionStream& lh, const SelectionStr + + bool OMXPlayerUnsuitable(bool m_HasVideo, bool m_HasAudio, CDVDDemux* m_pDemuxer, CDVDInputStream* m_pInputStream, CSelectionStreams &m_SelectionStreams) + { ++ // if no OMXPlayer acceleration then it is not suitable ++ if (!CSettings::Get().GetBool("videoplayer.useomxplayer")) ++ return true; + // if no MMAL acceleration stick with omxplayer regardless + if (!CSettings::Get().GetBool("videoplayer.usemmal")) + return false; + +From c0678ee3627c08eac315da9c81187cc7bd61ff62 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 21:05:41 +0100 +Subject: [PATCH 78/78] [omxplayer] Set audio properties for passthrough + +We weren't setting the stream_channels property for passthrough for omxplayer (we do with Pi Sink) +That means we were using 2 in number of channels of the AudioInfoFrame packet, rather then 0 +which is 'refer to stream header' which is correct for passthrough +--- + xbmc/cores/omxplayer/OMXAudio.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp +index 1911189..4072f7d 100644 +--- a/xbmc/cores/omxplayer/OMXAudio.cpp ++++ b/xbmc/cores/omxplayer/OMXAudio.cpp +@@ -731,6 +731,8 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo + + m_wave_header.dwChannelMask = m_src_chan_layout; + } ++ else ++ SetAudioProps(m_Passthrough, 0); + + m_SampleRate = m_format.m_sampleRate; + m_BitsPerSample = CAEUtil::DataFormatToBits(m_format.m_dataFormat);