From f6d2a67e07f3380a6960809c9071ee3bbbf5d672 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Sat, 18 Apr 2015 16:12:37 +0200 Subject: [PATCH] projects/RPi*/patches/kodi: update RPi support patches Signed-off-by: Stephan Raue --- .../kodi-001-isengard-rpb-backports.patch | 4920 +++++++++-------- .../kodi-001-isengard-rpb-backports.patch | 4920 +++++++++-------- 2 files changed, 5146 insertions(+), 4694 deletions(-) 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 05de2d0d20..ccba80a8a5 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 9d98beccd9d65e5a86b488f0ceb90448f2c9a5f3 Mon Sep 17 00:00:00 2001 +From cef01168572238112d543362f6b4a6dc65b38cf2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 001/103] [rbp/omxplayer] When opening a stream don't try to +Subject: [PATCH 01/89] [rbp/omxplayer] When opening a stream don't try to update gui so often --- @@ -25,10 +25,10 @@ index 2faceea..889d7a2 100644 g_windowManager.ProcessRenderLoop(false); if (allowCancel && dialog->IsCanceled()) -From 274fcbff2f4a4c64f92a0d4cf1cdfed8f3045259 Mon Sep 17 00:00:00 2001 +From ac38c688a0443bd965bf167def9f30e105e7227c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 29 Apr 2014 15:23:22 +0100 -Subject: [PATCH 002/103] [ffmpeg] Speed up wtv index creation +Subject: [PATCH 02/89] [ffmpeg] Speed up wtv index creation The index creation is O(N^2) with number of entries (typically thousands). On a Pi this can take more than 60 seconds to execute for a recording of a few hours. @@ -114,17 +114,17 @@ index 0000000..4ac5636 + } + } -From 681ca292791c12e51b745db0629376902377367b Mon Sep 17 00:00:00 2001 +From 10fca829203615581df049df3ab697eb26a0df13 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 2 Aug 2014 17:48:04 +0100 -Subject: [PATCH 003/103] [omx] Report decoded image name +Subject: [PATCH 03/89] [omx] Report decoded image name --- xbmc/cores/omxplayer/OMXImage.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp -index 161ec5a..86a683a 100644 +index a43a446..d99d719 100644 --- a/xbmc/cores/omxplayer/OMXImage.cpp +++ b/xbmc/cores/omxplayer/OMXImage.cpp @@ -327,6 +327,7 @@ bool COMXImage::DecodeJpegToTexture(COMXImageFile *file, unsigned int width, uns @@ -136,10 +136,10 @@ index 161ec5a..86a683a 100644 else { -From 3e320b31a6b000fbcd212e8b7138c88e2b77dfaa Mon Sep 17 00:00:00 2001 +From db0a6dc35272b3b14e9c463ed357ebd9df0431be Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 004/103] [hifiberry] Hack: force it to be recognised as IEC958 +Subject: [PATCH 04/89] [hifiberry] Hack: force it to be recognised as IEC958 capable to enable passthrough options --- @@ -162,10 +162,10 @@ index e22db7a..0120bd5 100644 info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") { -From 6828241cd39ce51a64ef4e25394620d034afd10f Mon Sep 17 00:00:00 2001 +From d21d0015b0df19c700e1c63d5525546cc5f71f15 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 005/103] Improved file buffering in CArchive +Subject: [PATCH 05/89] 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 @@ -225,10 +225,10 @@ index 6ed0f8f..8506d95 100644 } else -From cdd2b2e9dacd31ab126e635aee2061bc8dc1e920 Mon Sep 17 00:00:00 2001 +From 02ffcb9c5cac171a3fb3e8ace0fb24fda0dd0db0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 12 Aug 2014 00:31:36 +0100 -Subject: [PATCH 006/103] [omxcodec] Don't force software codec with dvds +Subject: [PATCH 06/89] [omxcodec] Don't force software codec with dvds --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 2 ++ @@ -249,10 +249,10 @@ index 143ea06..e029c16 100644 else if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) { -From bb8c24c64263afa825341429bd22a49a774c96b8 Mon Sep 17 00:00:00 2001 +From 965be36a5564ce176d5d9c135b313e2323395242 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 007/103] filesystem: Make support of browsing into archives +Subject: [PATCH 07/89] 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. @@ -270,10 +270,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 e7244d1..a762609 100644 +index dedca23..629f726 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16519,6 +16519,15 @@ msgstr "" +@@ -16527,6 +16527,15 @@ msgstr "" #: system/settings/rbp.xml msgctxt "#38010" msgid "GPU accelerated" @@ -290,10 +290,10 @@ index e7244d1..a762609 100644 #. Setting #38011 "Videos -> Library -> Show All Items entry" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 323a2f1..f008579 100644 +index 3940ca8..8f1bfc4 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml -@@ -301,6 +301,11 @@ +@@ -304,6 +304,11 @@ false @@ -335,11 +335,11 @@ index 3a5ba4e..f1f6f79 100644 { // XBMC Smart playlist - just XML renamed to XSP // read the name of the playlist in -From 14b7c230cf053a22a015126b6bce83bc8ad7cf5c Mon Sep 17 00:00:00 2001 +From d1698689aedc5255eaf125d2bbf7940c6ce8b1e2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 13:06:57 +0000 -Subject: [PATCH 009/103] [rbp] Make cachemembuffersize default depend on - memory size +Subject: [PATCH 09/89] [rbp] Make cachemembuffersize default depend on memory + size --- xbmc/linux/RBP.cpp | 5 +++++ @@ -347,18 +347,18 @@ Subject: [PATCH 009/103] [rbp] Make cachemembuffersize default depend on 2 files changed, 10 insertions(+) diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index ba1a3d0..5119949 100644 +index 59dd1da..aedae18 100644 --- a/xbmc/linux/RBP.cpp +++ b/xbmc/linux/RBP.cpp -@@ -22,6 +22,7 @@ - #if defined(TARGET_RASPBERRY_PI) +@@ -23,6 +23,7 @@ + #include #include "settings/Settings.h" +#include "settings/AdvancedSettings.h" #include "utils/log.h" #include "cores/omxplayer/OMXImage.h" -@@ -84,6 +85,9 @@ bool CRBP::Initialize() +@@ -82,6 +83,9 @@ bool CRBP::Initialize() if (!m_gui_resolution_limit) m_gui_resolution_limit = m_gpu_mem < 128 ? 720:1080; @@ -368,7 +368,7 @@ index ba1a3d0..5119949 100644 g_OMXImage.Initialize(); m_omx_image_init = true; return true; -@@ -96,6 +100,7 @@ void CRBP::LogFirmwareVerison() +@@ -94,6 +98,7 @@ void CRBP::LogFirmwareVerison() response[sizeof(response) - 1] = '\0'; CLog::Log(LOGNOTICE, "Raspberry PI firmware version: %s", response); CLog::Log(LOGNOTICE, "ARM mem: %dMB GPU mem: %dMB MPG2:%d WVC1:%d", m_arm_mem, m_gpu_mem, m_codec_mpg2_enabled, m_codec_wvc1_enabled); @@ -377,7 +377,7 @@ index ba1a3d0..5119949 100644 response[sizeof(response) - 1] = '\0'; CLog::Log(LOGNOTICE, "Config:\n%s", response); diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index ba15502..7797edf 100644 +index fab9a82..25ef7b8 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -352,7 +352,12 @@ void CAdvancedSettings::Initialize() @@ -394,10 +394,11 @@ index ba15502..7797edf 100644 // the following setting determines the readRate of a player data // as multiply of the default data read rate -From 910468040e6fe46799e99ecdd4ae3223c37b2b50 Mon Sep 17 00:00:00 2001 + +From 1690732bafc24f041aabaccd168f35e86ebdbbd2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 011/103] [settings] Experiment: Report DESKTOP resolution in +Subject: [PATCH 11/89] [settings] Experiment: Report DESKTOP resolution in video settings --- @@ -419,18 +420,17 @@ index 1fafd9a..e0288aa 100644 StringUtils::Format("%dx%d%s", resolution->width, resolution->height, ModeFlagsToString(resolution->flags, false).c_str()), -From 7285aff9a873a23fd65867428cb0007b9ea07948 Mon Sep 17 00:00:00 2001 +From 2e5b318953c5635129b69c01f24919392b0af5da Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 9 Sep 2014 12:04:26 +0100 -Subject: [PATCH 012/103] egl: Treat unknown display aspect ratio as square - pixel +Subject: [PATCH 12/89] egl: Treat unknown display aspect ratio as square pixel --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 749de8d..98072e8 100644 +index bda7430..68fc647 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp @@ -447,7 +447,7 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r @@ -452,44 +452,10 @@ index 749de8d..98072e8 100644 SetResolutionString(m_desktopRes); -From 897c19a7803148ca067b9e5cea4e43e320c4fd67 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 18 Sep 2014 14:24:56 +0100 -Subject: [PATCH 013/103] [omxplayer] Only enable audio clock master when A/V - sync method is set to audio clock - ---- - xbmc/cores/omxplayer/OMXAudio.cpp | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 45a35bb..691b9a7 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -247,7 +247,8 @@ bool COMXAudio::PortSettingsChanged() - { - // By default audio_render is the clock master, and if output samples don't fit the timestamps, it will speed up/slow down the clock. - // This tends to be better for maintaining audio sync and avoiding audio glitches, but can affect video/display sync -- if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -+ if((CSettings::Get().GetBool("videoplayer.usedisplayasclock") && CSettings::Get().GetInt("videoplayer.synctype") == SYNC_DISCON) || -+ CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") - { - OMX_CONFIG_BOOLEANTYPE configBool; - OMX_INIT_STRUCTURE(configBool); -@@ -273,7 +274,7 @@ bool COMXAudio::PortSettingsChanged() - { - // By default audio_render is the clock master, and if output samples don't fit the timestamps, it will speed up/slow down the clock. - // This tends to be better for maintaining audio sync and avoiding audio glitches, but can affect video/display sync -- if(CSettings::Get().GetBool("videoplayer.usedisplayasclock")) -+ if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") && CSettings::Get().GetInt("videoplayer.synctype") == SYNC_DISCON) - { - OMX_CONFIG_BOOLEANTYPE configBool; - OMX_INIT_STRUCTURE(configBool); - -From 503f7e7fb4a0e74ff3092c7ff461620634f01d09 Mon Sep 17 00:00:00 2001 +From f585eaf62527f49edaa92c95322968c05189ac2f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 014/103] [dvdplayer/rbp] Add pi specific option to maintain +Subject: [PATCH 13/89] [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". @@ -514,10 +480,10 @@ 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 a762609..8cd2b39 100644 +index 629f726..129f0c7 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -6334,7 +6334,22 @@ msgctxt "#13459" +@@ -6336,7 +6336,22 @@ msgctxt "#13459" msgid "Use OMXPlayer for decoding of video files." msgstr "" @@ -541,7 +507,7 @@ index a762609..8cd2b39 100644 #: system/settings/settings.xml msgctxt "#13505" -@@ -16565,3 +16580,10 @@ msgstr "" +@@ -16573,3 +16588,10 @@ msgstr "" msgctxt "#38016" msgid "%d fps" msgstr "" @@ -553,10 +519,10 @@ index a762609..8cd2b39 100644 +msgstr "" + diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index f008579..8395973 100644 +index 8f1bfc4..ad90e8c 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml -@@ -569,6 +569,20 @@ +@@ -572,6 +572,20 @@ false @@ -592,7 +558,7 @@ index 782a9ba..3e0390c 100644 struct AEDelayStatus diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -index 74df969..416e6f8 100644 +index a345a88..bd357aa 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp @@ -25,6 +25,7 @@ @@ -636,7 +602,7 @@ index 74df969..416e6f8 100644 CLog::Log(LOGNOTICE, "Deleting audio codec"); if (m_pAudioCodec) { -@@ -484,7 +489,11 @@ void CDVDPlayerAudio::UpdatePlayerInfo() +@@ -486,7 +491,11 @@ void CDVDPlayerAudio::UpdatePlayerInfo() //print the inverse of the resample ratio, since that makes more sense //if the resample ratio is 0.5, then we're playing twice as fast if (m_synctype == SYNC_RESAMPLE) @@ -649,7 +615,7 @@ index 74df969..416e6f8 100644 s << ", att:" << fixed << setprecision(1) << log(GetCurrentAttenuation()) * 20.0f << " dB"; -@@ -638,8 +647,8 @@ void CDVDPlayerAudio::SetSyncType(bool passthrough) +@@ -641,8 +650,8 @@ void CDVDPlayerAudio::SetSyncType(bool passthrough) if (m_synctype != m_prevsynctype) { @@ -660,7 +626,7 @@ index 74df969..416e6f8 100644 CLog::Log(LOGDEBUG, "CDVDPlayerAudio:: synctype set to %i: %s", m_synctype, synctypes[synctype]); m_prevsynctype = m_synctype; } -@@ -749,7 +758,19 @@ void CDVDPlayerAudio::HandleSyncError(double duration) +@@ -752,7 +761,19 @@ void CDVDPlayerAudio::HandleSyncError(double duration) proportional = m_error / DVD_TIME_BASE / proportionaldiv; } m_resampleratio = 1.0 / m_pClock->GetClockSpeed() + proportional + m_integral; @@ -680,7 +646,7 @@ index 74df969..416e6f8 100644 } bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) -@@ -802,6 +823,7 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) +@@ -805,6 +826,7 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) { m_dvdAudio.AddPackets(audioframe); } @@ -688,7 +654,7 @@ index 74df969..416e6f8 100644 } else if (m_synctype == SYNC_DISCON) { -@@ -836,6 +858,10 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) +@@ -839,6 +861,10 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) m_dvdAudio.SetResampleRatio(m_resampleratio); m_dvdAudio.AddPackets(audioframe); } @@ -714,10 +680,10 @@ index 99ce952..635c184 100644 struct SInfo { diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index 5119949..ce09fce 100644 +index aedae18..a4b0c2a 100644 --- a/xbmc/linux/RBP.cpp +++ b/xbmc/linux/RBP.cpp -@@ -212,4 +212,18 @@ void CRBP::Deinitialize() +@@ -220,4 +220,18 @@ void CRBP::Deinitialize() m_initialized = false; m_omx_initialized = false; } @@ -737,10 +703,10 @@ index 5119949..ce09fce 100644 + #endif diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index 4fd18f3..6456657 100644 +index 9559914..65492fa 100644 --- a/xbmc/linux/RBP.h +++ b/xbmc/linux/RBP.h -@@ -58,6 +58,7 @@ class CRBP +@@ -63,6 +63,7 @@ class CRBP 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(); @@ -749,7 +715,7 @@ index 4fd18f3..6456657 100644 private: DllBcmHost *m_DllBcmHost; diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 7797edf..59d45c8 100644 +index 25ef7b8..76b5ce8 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -110,6 +110,7 @@ void CAdvancedSettings::Initialize() @@ -781,11 +747,11 @@ index b0b4df1..5e0b14c 100644 float m_audioPlayCountMinimumPercent; bool m_dvdplayerIgnoreDTSinWAV; -From 3f55c9edc572baeb0c43fdd4e60a030ce1a6ea9e Mon Sep 17 00:00:00 2001 +From dfbee238810b1825c24c466b6f7c90140a6c602f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 27 Sep 2014 15:32:37 +0100 -Subject: [PATCH 015/103] [dvdplayer] exerimental: don't raise priority of - audio thread +Subject: [PATCH 14/89] [dvdplayer] exerimental: don't raise priority of audio + thread --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 4 ++++ @@ -808,10 +774,10 @@ index e029c16..63f4a30 100644 } -From 3d434543097974c95cc25dc07f9ece37ba2e6bc1 Mon Sep 17 00:00:00 2001 +From e8a3d13ea42fc7a4f654a1b1b419a5cf0e3a1edc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 016/103] [audio] Add settings option to boost centre channel +Subject: [PATCH 15/89] [audio] Add settings option to boost centre channel when downmixing This allows a dB volume increase to be added to centre channel. @@ -829,10 +795,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 8cd2b39..fa7c455 100644 +index 129f0c7..7f44813 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16587,3 +16587,17 @@ msgctxt "#38006" +@@ -16595,3 +16595,17 @@ msgctxt "#38006" msgid "Audio has to stay in sync, this can either be done by resampling, or adjusting the PLL" msgstr "" @@ -851,10 +817,10 @@ index 8cd2b39..fa7c455 100644 +msgid "%i dB" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 8395973..29a9ef6 100644 +index ad90e8c..ede89e4 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml -@@ -2640,6 +2640,18 @@ +@@ -2645,6 +2645,18 @@ true @@ -899,7 +865,7 @@ index e4ddf9e..34d0152 100644 if (remapLayout) { diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -index b037317..fa8112d 100644 +index 7807149..759ba7b 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp @@ -164,6 +164,12 @@ bool CActiveAEResamplePi::Init(uint64_t dst_chan_layout, int dst_channels, int d @@ -916,10 +882,10 @@ index b037317..fa8112d 100644 if (remapLayout) { diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 691b9a7..602d2fa 100644 +index f99c0e6..1911189 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -634,6 +634,12 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo +@@ -641,6 +641,12 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo { av_opt_set_double(m_pContext, "rematrix_maxval", 1.0, 0); } @@ -933,21 +899,20 @@ index 691b9a7..602d2fa 100644 // stereo upmix if (upmix && m_src_channels == 2 && m_dst_channels > 2) -From ccd32242f5696ac4e639cb2c686c277b876112f5 Mon Sep 17 00:00:00 2001 +From 726e56391004744900c2ab04c27e58a3e21f0d44 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 3 Oct 2014 18:40:06 +0100 -Subject: [PATCH 017/103] [SinkPi] Handle multichannel layout more like - OMXAudio +Subject: [PATCH 16/89] [SinkPi] Handle multichannel layout more like OMXAudio --- xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -index 318df3b..3cb6bfb 100644 +index a7691e8..d72a97a 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -@@ -93,9 +93,9 @@ static void SetAudioProps(bool stream_channels, uint32_t channel_map) +@@ -94,9 +94,9 @@ static void SetAudioProps(bool stream_channels, uint32_t channel_map) CLog::Log(LOGDEBUG, "%s:%s hdmi_stream_channels %d hdmi_channel_map %08x", CLASSNAME, __func__, stream_channels, channel_map); } @@ -959,7 +924,7 @@ index 318df3b..3cb6bfb 100644 uint32_t channel_map = 0; if (passthrough) return 0; -@@ -134,12 +134,12 @@ static uint32_t GetChannelMap(AEAudioFormat &format, bool passthrough) +@@ -135,12 +135,12 @@ static uint32_t GetChannelMap(AEAudioFormat &format, bool passthrough) // According to CEA-861-D only RL and RR are known. In case of a format having SL and SR channels // but no BR BL channels, we use the wide map in order to open only the num of channels really // needed. @@ -974,7 +939,7 @@ index 318df3b..3cb6bfb 100644 unsigned int chan = 0; if ((unsigned int)c < sizeof map_normal / sizeof *map_normal) chan = map[(unsigned int)c]; -@@ -170,9 +170,9 @@ static uint32_t GetChannelMap(AEAudioFormat &format, bool passthrough) +@@ -171,9 +171,9 @@ static uint32_t GetChannelMap(AEAudioFormat &format, bool passthrough) 0xff, // 7 0x13, // 7.1 }; @@ -986,7 +951,7 @@ index 318df3b..3cb6bfb 100644 channel_map |= cea << 24; -@@ -209,7 +209,7 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) +@@ -215,7 +215,7 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) format.m_frames = format.m_sampleRate * AUDIO_PLAYBUFFER / NUM_OMX_BUFFERS; format.m_frameSamples = format.m_frames * channels; @@ -996,10 +961,10 @@ index 318df3b..3cb6bfb 100644 m_format = format; m_sinkbuffer_sec_per_byte = 1.0 / (double)(m_format.m_frameSize * m_format.m_sampleRate); -From d54c0004c7889382e48a3b2015d7e6920fdae119 Mon Sep 17 00:00:00 2001 +From d424942bfc56c3d49521f7c6ac5410385d1147c8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 15:23:51 +0000 -Subject: [PATCH 018/103] [rbp] Default extract thumbnails to false +Subject: [PATCH 17/89] [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 @@ -1029,10 +994,11 @@ index cb83297..8496abf 100644
-From 49ef564d2e2c4f15a81fb727ed4abb03f299a66e Mon Sep 17 00:00:00 2001 + +From bdb2bce42352230100067f6ab19ac077ab391ca9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 15 Nov 2014 12:03:34 +0000 -Subject: [PATCH 022/103] [dvdplayer] Add lock for player creation +Subject: [PATCH 21/89] [dvdplayer] Add lock for player creation --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 3 +++ @@ -1078,10 +1044,10 @@ index 468239c..3b8cefb 100644 + CCriticalSection m_players_lock; }; -From d2e6086e65aa2bb6fee41c413db5cac0e31b2c0e Mon Sep 17 00:00:00 2001 +From a40900ba3edf82d8ba63eb3e5e2ffd9a9810e42e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 24 Nov 2014 22:07:25 +0000 -Subject: [PATCH 023/103] [dvdplayervideo] Prod decoder when in stills mode +Subject: [PATCH 22/89] [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. @@ -1158,10 +1124,10 @@ index 69dc501..5832c58 100644 if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE)) -From 4f95fb3b9cacf2e968291b0bc448df6ce684928b Mon Sep 17 00:00:00 2001 +From 8674cc04f73067ac9b26562f5ed1bbc87b61571c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 27 Nov 2014 16:31:56 +0000 -Subject: [PATCH 024/103] [languageinvoker] Reduce priority of python threads +Subject: [PATCH 23/89] [languageinvoker] Reduce priority of python threads --- xbmc/interfaces/generic/LanguageInvokerThread.cpp | 5 +++++ @@ -1184,10 +1150,10 @@ index fcdd063..16f0c89 100644 } -From 4ac74fa770ca65859284e1541d1b8ef5ed658d30 Mon Sep 17 00:00:00 2001 +From c0d94a5d0a90ac3e0c8304f551d59ae150a04ccb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Dec 2013 16:55:05 +0000 -Subject: [PATCH 025/103] logging: Add microsecond timer to log messages +Subject: [PATCH 24/89] logging: Add microsecond timer to log messages --- xbmc/utils/log.cpp | 17 +++++++++++++++-- @@ -1240,10 +1206,10 @@ index 3443f12..31c4a99 100644 levelNames[logLevel]) + strData; -From 602c2edc4b65379dd6872e245ced5f240505f932 Mon Sep 17 00:00:00 2001 +From 9148d35d4664d75cfa38af607202cb79e535d425 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:24:42 +0200 -Subject: [PATCH 026/103] Added some vc_tv_* functions that were missing in +Subject: [PATCH 25/89] Added some vc_tv_* functions that were missing in DllBCM. --- @@ -1278,10 +1244,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 cac8aa5c89dbfe566b0d410bb4b66012b0ffaa2c Mon Sep 17 00:00:00 2001 +From 1c09b17c3d8d8631708d0feaa2b03ac38451d23b Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:29:03 +0200 -Subject: [PATCH 027/103] Added private utility function to map a float display +Subject: [PATCH 26/89] Added private utility function to map a float display aspect, to the respective SDTV_ASPECT_* enum value. --- @@ -1289,7 +1255,7 @@ Subject: [PATCH 027/103] Added private utility function to map a float display 1 file changed, 19 insertions(+) diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 98072e8..da36944 100644 +index 68fc647..6b1f3b9 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp @@ -412,6 +412,25 @@ static void SetResolutionString(RESOLUTION_INFO &res) @@ -1319,10 +1285,10 @@ index 98072e8..da36944 100644 bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &resolutions) -From 3861ee5d79e6daa334b19247ace9753027fad450 Mon Sep 17 00:00:00 2001 +From d339ba599375b756dbbe5e878519b3b02f19d8bd Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:50:58 +0200 -Subject: [PATCH 028/103] Changed SDTV resolutions to be treated similarly to +Subject: [PATCH 27/89] 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. @@ -1332,7 +1298,7 @@ Subject: [PATCH 028/103] Changed SDTV resolutions to be treated similarly to 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index da36944..2ebd74c 100644 +index 6b1f3b9..4826d37 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp @@ -222,7 +222,7 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) @@ -1376,7 +1342,7 @@ index da36944..2ebd74c 100644 + m_desktopRes = res; + } - m_dispman_display = m_DllBcmHost->vc_dispmanx_display_open(0); + m_dispman_display = g_RBP.OpenDisplay(0); @@ -441,8 +468,6 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r if(!m_DllBcmHost) @@ -1419,10 +1385,10 @@ index 59401f5..a0acb1a 100644 int m_width; int m_height; -From bfe83fe7109a35fc5b323cd71fededa78375cc8f Mon Sep 17 00:00:00 2001 +From 8ebee675392f628fd18e803d549f69fcac428f01 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:54:59 +0200 -Subject: [PATCH 029/103] Added methods SuspendVideoOutput() and +Subject: [PATCH 28/89] Added methods SuspendVideoOutput() and ResumeVideoOutput() to CRBP class, which can be used to power down the Raspberry PI's video interface, and restore it at a later point. @@ -1433,10 +1399,10 @@ Subject: [PATCH 029/103] Added methods SuspendVideoOutput() and 3 files changed, 19 insertions(+) diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index ce09fce..a18aa49 100644 +index a4b0c2a..160eb96 100644 --- a/xbmc/linux/RBP.cpp +++ b/xbmc/linux/RBP.cpp -@@ -225,5 +225,18 @@ double CRBP::AdjustHDMIClock(double adjust) +@@ -233,5 +233,18 @@ double CRBP::AdjustHDMIClock(double adjust) return new_adjust; } @@ -1456,10 +1422,10 @@ index ce09fce..a18aa49 100644 #endif diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index 6456657..606c24f 100644 +index 65492fa..38fb252 100644 --- a/xbmc/linux/RBP.h +++ b/xbmc/linux/RBP.h -@@ -60,6 +60,9 @@ class CRBP +@@ -65,6 +65,9 @@ class CRBP void WaitVsync(); double AdjustHDMIClock(double adjust); @@ -1470,7 +1436,7 @@ index 6456657..606c24f 100644 DllBcmHost *m_DllBcmHost; bool m_initialized; diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 2ebd74c..335f6d5 100644 +index 4826d37..7d9b0d3 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp @@ -60,7 +60,10 @@ @@ -1485,12 +1451,12 @@ index 2ebd74c..335f6d5 100644 CEGLNativeTypeRaspberryPI::CEGLNativeTypeRaspberryPI() { -From b3fc8a5fc3e58091b95aa0f2ca9f78353ce27c9e Mon Sep 17 00:00:00 2001 +From 0739fee7877f4856d12321465b2b9744de086b46 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 11 Aug 2013 15:03:36 +0100 -Subject: [PATCH 030/103] PowerManager (and its IPowerSyscall instance) now - gets called from CApplication::OnKey() and can process and suppress key - presses. This is a requirement to implement a virtual sleep state. +Subject: [PATCH 29/89] PowerManager (and its IPowerSyscall instance) now gets + called from CApplication::OnKey() and can process and suppress key presses. + This is a requirement to implement a virtual sleep state. --- xbmc/Application.cpp | 1 - @@ -1501,10 +1467,10 @@ Subject: [PATCH 030/103] PowerManager (and its IPowerSyscall instance) now 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 51fdf84..e00916a 100644 +index 135b466..df6e8ca 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -2037,7 +2037,6 @@ void CApplication::SetStandAlone(bool value) +@@ -2043,7 +2043,6 @@ void CApplication::SetStandAlone(bool value) g_advancedSettings.m_handleMounting = m_bStandalone = value; } @@ -1602,12 +1568,12 @@ index 0b1f10a..e42b143 100644 void OnSleep(); void OnWake(); -From bdd759a61f9ff2da25014aa45da9997fd51bd7a6 Mon Sep 17 00:00:00 2001 +From 94a8bac3feaeed3edd78e9e49f209b92ef5c87f9 Mon Sep 17 00:00:00 2001 From: macrule Date: Wed, 17 Apr 2013 13:23:01 +0200 -Subject: [PATCH 031/103] Added CPowerSyscallVirtualSleep class, which acts as - a base class for devices that have no native standby mode, and need to fake - it in some way. +Subject: [PATCH 30/89] Added CPowerSyscallVirtualSleep class, which acts as a + base class for devices that have no native standby mode, and need to fake it + in some way. --- xbmc/powermanagement/Makefile | 1 + @@ -1781,10 +1747,10 @@ index 0000000..ef6e682 + +#endif // _POWER_SYSCALL_VIRTUAL_SLEEP_H_ -From 33be5d47278da30a21fda820324af9a3423fb2e8 Mon Sep 17 00:00:00 2001 +From 4e72dbc0c34cd319b3168551ee14ebc6ea78739c Mon Sep 17 00:00:00 2001 From: macrule Date: Wed, 17 Apr 2013 13:24:22 +0200 -Subject: [PATCH 032/103] Added power management support for the Raspberry Pi. +Subject: [PATCH 31/89] Added power management support for the Raspberry Pi. Since it doesn't support true standby, we fake it by turning video on or off, and ignoring remote inputs during the standby phase. @@ -1930,10 +1896,10 @@ index 0000000..fd1d67c + +#endif // _RASPBERRY_PI_POWER_SYSCALL_H_ -From 709dfc42ba253ec392a266efa986b3da0f2020b2 Mon Sep 17 00:00:00 2001 +From 1e00d7bc6e5e193d12b3224d6801fb1dc8bf3b61 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 16:16:29 +0000 -Subject: [PATCH 033/103] [power] hack - don't kill lirc or cec +Subject: [PATCH 32/89] [power] hack - don't kill lirc or cec --- xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 37 +++++++++++++++++++++++ @@ -2017,10 +1983,10 @@ index 2d8c750..901f449 100644 CBuiltins::Execute("LIRC.Start"); #endif -From d3f8b6d306df8585bf4109b29bcab90c8a938ab4 Mon Sep 17 00:00:00 2001 +From ca8103aa0469ee82fe6da538e2d19cf33cabfc2c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 16:47:54 +0000 -Subject: [PATCH 034/103] [power] hack - wake on any action +Subject: [PATCH 33/89] [power] hack - wake on any action --- xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 6 +++--- @@ -2049,10 +2015,10 @@ index 9e6c8e4..78566ec 100644 if(VirtualWake()) { -From 27bc221d7dd08c12f07a7c3b7ddef78e19798777 Mon Sep 17 00:00:00 2001 +From 2db6f609de8998c2db449d0471699e02c6a6f46c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 17:30:07 +0000 -Subject: [PATCH 035/103] [power] hack - Make suspend toggle suspend state +Subject: [PATCH 34/89] [power] hack - Make suspend toggle suspend state --- xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 5 +++++ @@ -2075,10 +2041,10 @@ index 78566ec..4cffcce 100644 return false; } -From 8609e7646814b273206d83b4fb973eab4ce768fe Mon Sep 17 00:00:00 2001 +From c42ebe26c18468fb40569e4f5b0eb387ac835670 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 4 Mar 2014 19:33:44 +0000 -Subject: [PATCH 036/103] [power] Add back in powerdown and reboot +Subject: [PATCH 35/89] [power] Add back in powerdown and reboot --- .../linux/RaspberryPIPowerSyscall.cpp | 34 ++++++++++++++++++++++ @@ -2156,11 +2122,11 @@ index fd1d67c..062132e 100644 virtual bool CanReboot() { return true; } -From c8eceb5866e755200441f9301d96d6cf99760b77 Mon Sep 17 00:00:00 2001 +From 21ff1d4748a4297716e53e78b347cf0f1c60ff4c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 26 Apr 2014 17:27:52 +0100 -Subject: [PATCH 037/103] [cec] Don't suspend pi on tv switch off - it can't - wake up +Subject: [PATCH 36/89] [cec] Don't suspend pi on tv switch off - it can't wake + up --- system/peripherals.xml | 2 +- @@ -2180,20 +2146,20 @@ index 094a3c1..0b89ee8 100644 -From 15b45e982c686259159223839618d0422c789f92 Mon Sep 17 00:00:00 2001 +From 2697d6cb2ff2bbbb7be8fd40370e654c227a1b86 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 27 Jun 2014 00:01:05 +0100 -Subject: [PATCH 038/103] [rbp] Resume video output on startup +Subject: [PATCH 37/89] [rbp] Resume video output on startup --- xbmc/linux/RBP.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index a18aa49..6514c2d 100644 +index 160eb96..1472d10 100644 --- a/xbmc/linux/RBP.cpp +++ b/xbmc/linux/RBP.cpp -@@ -88,6 +88,9 @@ bool CRBP::Initialize() +@@ -86,6 +86,9 @@ bool CRBP::Initialize() if (g_advancedSettings.m_cacheMemBufferSize == ~0U) g_advancedSettings.m_cacheMemBufferSize = m_arm_mem < 256 ? 1024 * 1024 * 2 : 1024 * 1024 * 20; @@ -2204,10 +2170,10 @@ index a18aa49..6514c2d 100644 m_omx_image_init = true; return true; -From 20f0bf8ef85a8c11b6fe4b6318ee925b753a9097 Mon Sep 17 00:00:00 2001 +From 266a5a51a12a418f95c2c366e147e0c5e9c6eaee Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 11 Apr 2014 16:12:27 +0100 -Subject: [PATCH 039/103] [omxplayer] Add ability to log more timestamp info in +Subject: [PATCH 38/89] [omxplayer] Add ability to log more timestamp info in extra debug settings --- @@ -2220,10 +2186,10 @@ Subject: [PATCH 039/103] [omxplayer] Add ability to log more timestamp info in 6 files changed, 25 insertions(+), 13 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 22a1696..5fc9d65 100644 +index 804e295..1b70492 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2908,6 +2908,11 @@ msgctxt "#680" +@@ -2915,6 +2915,11 @@ msgctxt "#680" msgid "Verbose logging for VIDEO component" msgstr "" @@ -2317,7 +2283,7 @@ index c2da2d2..2f1df45 100644 { // we are not running until something is cached in output device diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index bee7086..4e599e3 100644 +index 5ca7665..8becff1 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp @@ -42,6 +42,7 @@ @@ -2344,7 +2310,7 @@ index bee7086..4e599e3 100644 || m_speed < 0) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 59d45c8..e46233a 100644 +index 76b5ce8..139e12d 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -1364,6 +1364,9 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se @@ -2358,10 +2324,10 @@ index 59d45c8..e46233a 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From 61c67e0ee0a882807b80a4ad85c5c9a476fc58b0 Mon Sep 17 00:00:00 2001 +From ba20c596cce9f4e3e6112921182a25c899847c7d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 040/103] [omxplayer] Add ability to dump out audio/video data +Subject: [PATCH 39/89] [omxplayer] Add ability to dump out audio/video data for later debugging --- @@ -2373,10 +2339,10 @@ Subject: [PATCH 040/103] [omxplayer] Add ability to dump out audio/video data 5 files changed, 112 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 5fc9d65..caf6ee6 100644 +index 1b70492..19b94b5 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2913,6 +2913,16 @@ msgctxt "#697" +@@ -2920,6 +2920,16 @@ msgctxt "#697" msgid "Verbose logging for OMXPLAYER" msgstr "" @@ -2407,7 +2373,7 @@ index e4ffb5e..4f8926c 100644 #include "utils/params_check_macros.h" diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 602d2fa..0b8fd69 100644 +index 1911189..6dff6aa 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp @@ -56,6 +56,49 @@ using namespace std; @@ -2460,7 +2426,7 @@ index 602d2fa..0b8fd69 100644 ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// -@@ -868,6 +911,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo +@@ -871,6 +914,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo memcpy((unsigned char *)omx_buffer->pBuffer, &m_wave_header, omx_buffer->nFilledLen); omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; @@ -2468,7 +2434,7 @@ index 602d2fa..0b8fd69 100644 omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); if (omx_err != OMX_ErrorNone) { -@@ -900,6 +944,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo +@@ -899,6 +943,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo memcpy((unsigned char *)omx_buffer->pBuffer, m_extradata, omx_buffer->nFilledLen); omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; @@ -2485,15 +2451,15 @@ index 602d2fa..0b8fd69 100644 if ( m_omx_tunnel_clock_analog.IsInitialized() ) m_omx_tunnel_clock_analog.Deestablish(); if ( m_omx_tunnel_clock_hdmi.IsInitialized() ) -@@ -1226,6 +1273,7 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt - int nRetry = 0; - while(true) +@@ -1223,6 +1270,7 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt + if(demuxer_samples_sent == demuxer_samples) + omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; + ++ dump_omx_buffer(omx_buffer); + omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); + if (omx_err != OMX_ErrorNone) { -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err == OMX_ErrorNone) - { -@@ -1473,6 +1521,7 @@ void COMXAudio::SubmitEOS() +@@ -1461,6 +1509,7 @@ void COMXAudio::SubmitEOS() omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; @@ -2502,7 +2468,7 @@ index 602d2fa..0b8fd69 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 55e16c4..4489546 100644 +index ca40a37..0fb426c 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp @@ -65,6 +65,49 @@ @@ -2555,7 +2521,7 @@ index 55e16c4..4489546 100644 COMXVideo::COMXVideo() : m_video_codec_name("") { m_is_open = false; -@@ -120,6 +163,7 @@ bool COMXVideo::SendDecoderConfig() +@@ -115,6 +158,7 @@ bool COMXVideo::SendDecoderConfig() memcpy((unsigned char *)omx_buffer->pBuffer, m_extradata, omx_buffer->nFilledLen); omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; @@ -2563,7 +2529,7 @@ index 55e16c4..4489546 100644 omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); if (omx_err != OMX_ErrorNone) { -@@ -697,6 +741,7 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de +@@ -692,6 +736,7 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de void COMXVideo::Close() { CSingleLock lock (m_critSection); @@ -2571,15 +2537,15 @@ index 55e16c4..4489546 100644 m_omx_tunnel_clock.Deestablish(); m_omx_tunnel_decoder.Deestablish(); if(m_deinterlace) -@@ -815,6 +860,7 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) - int nRetry = 0; - while(true) +@@ -807,6 +852,7 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) + if(demuxer_bytes == 0) + omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; + ++ dump_omx_buffer(omx_buffer); + omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); + if (omx_err != OMX_ErrorNone) { -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err == OMX_ErrorNone) - { -@@ -945,6 +991,7 @@ void COMXVideo::SubmitEOS() +@@ -928,6 +974,7 @@ void COMXVideo::SubmitEOS() omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; @@ -2588,7 +2554,7 @@ index 55e16c4..4489546 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index e46233a..9119877 100644 +index 139e12d..ea45381 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -1367,6 +1367,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se @@ -2603,243 +2569,11 @@ index e46233a..9119877 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From 3d935ad808f8f753468091b5f7461d0cc4b781a6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 18 Aug 2014 19:09:32 +0100 -Subject: [PATCH 041/103] rbp: Use new dispmanx function for vsync callbacks - ---- - xbmc/linux/RBP.cpp | 86 ++++++++++++++----------- - xbmc/linux/RBP.h | 7 +- - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 +- - 3 files changed, 55 insertions(+), 42 deletions(-) - -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index 6514c2d..fe1df00 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -21,6 +21,7 @@ - #include "RBP.h" - #if defined(TARGET_RASPBERRY_PI) - -+#include - #include "settings/Settings.h" - #include "settings/AdvancedSettings.h" - #include "utils/log.h" -@@ -33,7 +34,7 @@ CRBP::CRBP() - m_omx_initialized = false; - m_DllBcmHost = new DllBcmHost(); - m_OMX = new COMXCore(); -- m_element = 0; -+ m_display = DISPMANX_NO_HANDLE; - } - - CRBP::~CRBP() -@@ -55,8 +56,7 @@ bool CRBP::Initialize() - - m_DllBcmHost->bcm_host_init(); - -- uint32_t vc_image_ptr; -- m_resource = vc_dispmanx_resource_create( VC_IMAGE_RGB565, 1, 1, &vc_image_ptr ); -+ //OpenDisplay(0 /*screen*/); - - m_omx_initialized = m_OMX->Initialize(); - if(!m_omx_initialized) -@@ -112,13 +112,24 @@ void CRBP::LogFirmwareVerison() - CLog::Log(LOGNOTICE, "Config:\n%s", response); - } - -+DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) -+{ -+ if (m_display == DISPMANX_NO_HANDLE) -+ m_display = vc_dispmanx_display_open( 0 /*screen*/ ); -+ return m_display; -+} -+ -+void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display) -+{ -+ assert(display == m_display); -+ vc_dispmanx_display_close(m_display); -+ m_display = DISPMANX_NO_HANDLE; -+} -+ - void CRBP::GetDisplaySize(int &width, int &height) - { -- DISPMANX_DISPLAY_HANDLE_T display; - DISPMANX_MODEINFO_T info; -- -- display = vc_dispmanx_display_open( 0 /*screen*/ ); -- if (vc_dispmanx_display_get_info(display, &info) == 0) -+ if (vc_dispmanx_display_get_info(m_display, &info) == 0) - { - width = info.width; - height = info.height; -@@ -128,12 +139,10 @@ void CRBP::GetDisplaySize(int &width, int &height) - width = 0; - height = 0; - } -- vc_dispmanx_display_close(display ); - } - - unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool swap_red_blue, bool video_only) - { -- DISPMANX_DISPLAY_HANDLE_T display; - DISPMANX_RESOURCE_HANDLE_T resource; - VC_RECT_T rect; - unsigned char *image = NULL; -@@ -148,7 +157,6 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw - if (!pstride) - flags |= DISPMANX_SNAPSHOT_PACK; - -- display = vc_dispmanx_display_open( 0 /*screen*/ ); - stride = ((width + 15) & ~15) * 4; - image = new unsigned char [height * stride]; - -@@ -156,45 +164,44 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw - { - resource = vc_dispmanx_resource_create( VC_IMAGE_RGBA32, width, height, &vc_image_ptr ); - -- vc_dispmanx_snapshot(display, resource, (DISPMANX_TRANSFORM_T)flags); -+ assert(m_display != DISPMANX_NO_HANDLE); -+ vc_dispmanx_snapshot(m_display, resource, (DISPMANX_TRANSFORM_T)flags); - - vc_dispmanx_rect_set(&rect, 0, 0, width, height); - vc_dispmanx_resource_read_data(resource, &rect, image, stride); - vc_dispmanx_resource_delete( resource ); -- vc_dispmanx_display_close(display ); - } - if (pstride) - *pstride = stride; - return image; - } - --void CRBP::WaitVsync(void) -+ -+static void vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *arg) - { -- DISPMANX_DISPLAY_HANDLE_T display = vc_dispmanx_display_open( 0 /*screen*/ ); -- DISPMANX_UPDATE_HANDLE_T update = vc_dispmanx_update_start(0); -- -- VC_DISPMANX_ALPHA_T alpha = { (DISPMANX_FLAGS_ALPHA_T)(DISPMANX_FLAGS_ALPHA_FROM_SOURCE | DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS), 120, /*alpha 0->255*/ 0 }; -- VC_RECT_T src_rect; -- VC_RECT_T dst_rect; -- vc_dispmanx_rect_set( &src_rect, 0, 0, 1 << 16, 1 << 16 ); -- vc_dispmanx_rect_set( &dst_rect, 0, 0, 1, 1 ); -- -- if (m_element) -- vc_dispmanx_element_remove( update, m_element ); -- -- m_element = vc_dispmanx_element_add( update, -- display, -- 2000, // layer -- &dst_rect, -- m_resource, -- &src_rect, -- DISPMANX_PROTECTION_NONE, -- &alpha, -- NULL, // clamp -- (DISPMANX_TRANSFORM_T)0 ); -- -- vc_dispmanx_update_submit_sync(update); -- vc_dispmanx_display_close( display ); -+ 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.Wait(); -+ } -+ else assert(0); -+ s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); -+ assert(s == 0); -+ vc_dispmanx_display_close( m_display ); - } - - -@@ -206,6 +213,9 @@ void CRBP::Deinitialize() - if(m_omx_initialized) - m_OMX->Deinitialize(); - -+ if (m_display) -+ CloseDisplay(m_display); -+ - m_DllBcmHost->bcm_host_deinit(); - - if(m_initialized) -diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index 606c24f..82146d6 100644 ---- a/xbmc/linux/RBP.h -+++ b/xbmc/linux/RBP.h -@@ -38,6 +38,7 @@ - #include "DllBCM.h" - #include "OMXCore.h" - #include "threads/CriticalSection.h" -+#include "threads/Event.h" - - class CRBP - { -@@ -53,6 +54,8 @@ class CRBP - bool GetCodecMpg2() { return m_codec_mpg2_enabled; } - bool GetCodecWvc1() { return m_codec_wvc1_enabled; } - void GetDisplaySize(int &width, int &height); -+ DISPMANX_DISPLAY_HANDLE_T OpenDisplay(uint32_t device); -+ void CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display); - int GetGUIResolutionLimit() { return m_gui_resolution_limit; } - // stride can be null for packed output - unsigned char *CaptureDisplay(int width, int height, int *stride, bool swap_red_blue, bool video_only = true); -@@ -74,10 +77,10 @@ class CRBP - bool m_codec_mpg2_enabled; - bool m_codec_wvc1_enabled; - COMXCore *m_OMX; -- DISPMANX_RESOURCE_HANDLE_T m_resource; -- DISPMANX_ELEMENT_HANDLE_T m_element; - class DllLibOMXCore; - CCriticalSection m_critSection; -+ DISPMANX_DISPLAY_HANDLE_T m_display; -+ CEvent m_vsync; - }; - - extern CRBP g_RBP; -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 335f6d5..7d9b0d3 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -307,7 +307,7 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) - m_desktopRes = res; - } - -- m_dispman_display = m_DllBcmHost->vc_dispmanx_display_open(0); -+ m_dispman_display = g_RBP.OpenDisplay(0); - - m_width = res.iWidth; - m_height = res.iHeight; -@@ -578,7 +578,7 @@ void CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow() - - if (m_dispman_display != DISPMANX_NO_HANDLE) - { -- m_DllBcmHost->vc_dispmanx_display_close(m_dispman_display); -+ g_RBP.CloseDisplay(m_dispman_display); - m_dispman_display = DISPMANX_NO_HANDLE; - } - DLOG("CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow\n"); - -From 648a6b3b7564b05e77b0039560755225c02852c4 Mon Sep 17 00:00:00 2001 +From 4f9a70ab2488ac8b8dd154613e368a0060493d88 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Nov 2014 17:16:54 +0000 -Subject: [PATCH 042/103] Revert "[omxplayer] Add ability to dump out - audio/video data for later debugging" +Subject: [PATCH 40/89] Revert "[omxplayer] Add ability to dump out audio/video + data for later debugging" This reverts commit 417416bd29d00f1b42c77488d06e9e6840b8c4f4. --- @@ -2851,10 +2585,10 @@ This reverts commit 417416bd29d00f1b42c77488d06e9e6840b8c4f4. 5 files changed, 112 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index caf6ee6..5fc9d65 100644 +index 19b94b5..1b70492 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2913,16 +2913,6 @@ msgctxt "#697" +@@ -2920,16 +2920,6 @@ msgctxt "#697" msgid "Verbose logging for OMXPLAYER" msgstr "" @@ -2885,7 +2619,7 @@ index 4f8926c..e4ffb5e 100644 #include "utils/params_check_macros.h" diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 0b8fd69..602d2fa 100644 +index 6dff6aa..1911189 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp @@ -56,49 +56,6 @@ using namespace std; @@ -2938,7 +2672,7 @@ index 0b8fd69..602d2fa 100644 ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// -@@ -911,7 +868,6 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo +@@ -914,7 +871,6 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo memcpy((unsigned char *)omx_buffer->pBuffer, &m_wave_header, omx_buffer->nFilledLen); omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; @@ -2946,7 +2680,7 @@ index 0b8fd69..602d2fa 100644 omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); if (omx_err != OMX_ErrorNone) { -@@ -944,7 +900,6 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo +@@ -943,7 +899,6 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo memcpy((unsigned char *)omx_buffer->pBuffer, m_extradata, omx_buffer->nFilledLen); omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; @@ -2963,15 +2697,15 @@ index 0b8fd69..602d2fa 100644 if ( m_omx_tunnel_clock_analog.IsInitialized() ) m_omx_tunnel_clock_analog.Deestablish(); if ( m_omx_tunnel_clock_hdmi.IsInitialized() ) -@@ -1273,7 +1226,6 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt - int nRetry = 0; - while(true) +@@ -1270,7 +1223,6 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt + if(demuxer_samples_sent == demuxer_samples) + omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; + +- dump_omx_buffer(omx_buffer); + omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); + if (omx_err != OMX_ErrorNone) { -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err == OMX_ErrorNone) - { -@@ -1521,7 +1473,6 @@ void COMXAudio::SubmitEOS() +@@ -1509,7 +1461,6 @@ void COMXAudio::SubmitEOS() omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; @@ -2980,7 +2714,7 @@ index 0b8fd69..602d2fa 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 4489546..55e16c4 100644 +index 0fb426c..ca40a37 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp @@ -65,49 +65,6 @@ @@ -3033,7 +2767,7 @@ index 4489546..55e16c4 100644 COMXVideo::COMXVideo() : m_video_codec_name("") { m_is_open = false; -@@ -163,7 +120,6 @@ bool COMXVideo::SendDecoderConfig() +@@ -158,7 +115,6 @@ bool COMXVideo::SendDecoderConfig() memcpy((unsigned char *)omx_buffer->pBuffer, m_extradata, omx_buffer->nFilledLen); omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; @@ -3041,7 +2775,7 @@ index 4489546..55e16c4 100644 omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); if (omx_err != OMX_ErrorNone) { -@@ -741,7 +697,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de +@@ -736,7 +692,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de void COMXVideo::Close() { CSingleLock lock (m_critSection); @@ -3049,15 +2783,15 @@ index 4489546..55e16c4 100644 m_omx_tunnel_clock.Deestablish(); m_omx_tunnel_decoder.Deestablish(); if(m_deinterlace) -@@ -860,7 +815,6 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) - int nRetry = 0; - while(true) +@@ -852,7 +807,6 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) + if(demuxer_bytes == 0) + omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; + +- dump_omx_buffer(omx_buffer); + omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); + if (omx_err != OMX_ErrorNone) { -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err == OMX_ErrorNone) - { -@@ -991,7 +945,6 @@ void COMXVideo::SubmitEOS() +@@ -974,7 +928,6 @@ void COMXVideo::SubmitEOS() omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; @@ -3066,7 +2800,7 @@ index 4489546..55e16c4 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 9119877..e46233a 100644 +index ea45381..139e12d 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -1367,10 +1367,6 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se @@ -3081,10 +2815,10 @@ index 9119877..e46233a 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From 14bfe644ca9aba1a482bf631ca0fa714d4502b61 Mon Sep 17 00:00:00 2001 +From 1dd87e754c11ac47b4e96eb465b5503206a04aef Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 043/103] [omxplayer] Add ability to dump out audio/video data +Subject: [PATCH 41/89] [omxplayer] Add ability to dump out audio/video data for later debugging --- @@ -3095,10 +2829,10 @@ Subject: [PATCH 043/103] [omxplayer] Add ability to dump out audio/video data 4 files changed, 79 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 5fc9d65..caf6ee6 100644 +index 1b70492..19b94b5 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2913,6 +2913,16 @@ msgctxt "#697" +@@ -2920,6 +2920,16 @@ msgctxt "#697" msgid "Verbose logging for OMXPLAYER" msgstr "" @@ -3217,7 +2951,7 @@ index 3c313cd..8ceb498 100644 if(player) player->CloseStream(bWaitForBuffers); diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index e46233a..9119877 100644 +index 139e12d..ea45381 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -1367,6 +1367,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se @@ -3232,11 +2966,11 @@ index e46233a..9119877 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From 718edc6ac5a59f2473592bd4646f54f904807a6f Mon Sep 17 00:00:00 2001 +From c5426decde782f01e418f10fa2b4221b1b8e6157 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 29 Nov 2014 15:25:16 +0000 -Subject: [PATCH 044/103] [rbp] hack: wait for splash to complete before - changing hdmi mode +Subject: [PATCH 42/89] [rbp] hack: wait for splash to complete before changing + hdmi mode --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 49 +++++++++++++++++++++++++ @@ -3309,10 +3043,10 @@ index 7d9b0d3..d388373 100644 if(GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) -From 0b3bfb6bac019ffbd0af4689fbdd3e785cc44957 Mon Sep 17 00:00:00 2001 +From 9ed5eff1125f8484ce829b87342fb99856ef8bea Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 5 Oct 2014 14:05:25 +0100 -Subject: [PATCH 045/103] [PiSink] Allow audio output latency to be set in +Subject: [PATCH 43/89] [PiSink] Allow audio output latency to be set in settings --- @@ -3323,10 +3057,10 @@ Subject: [PATCH 045/103] [PiSink] Allow audio output latency to be set in 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index caf6ee6..7b1089d 100644 +index 19b94b5..37932be 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16631,3 +16631,18 @@ msgstr "" +@@ -16639,3 +16639,18 @@ msgstr "" msgctxt "#38052" msgid "Remote button press release time (ms)" msgstr "" @@ -3369,7 +3103,7 @@ index 8496abf..5068b20 100644 diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -index 3cb6bfb..363b7d5 100644 +index d72a97a..b69925a 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp @@ -35,7 +35,6 @@ @@ -3387,18 +3121,18 @@ index 3cb6bfb..363b7d5 100644 + m_latency(0), m_Initialized(false), m_submitted(0), - m_omx_output(NULL) -@@ -190,6 +190,9 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) + m_omx_output(NULL), +@@ -191,6 +191,9 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) m_initDevice = device; m_initFormat = format; + m_latency = CSettings::Get().GetInt("audiooutput.latency") * 1e-3; + m_latency = std::max(m_latency, 50e-3); + - // analogue only supports stereo - if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue" || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") - { -@@ -206,7 +209,7 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) + if (m_passthrough || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:HDMI") + m_output = AESINKPI_HDMI; + else if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") +@@ -212,7 +215,7 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) unsigned int sample_size = CAEUtil::DataFormatToBits(format.m_dataFormat) >> 3; format.m_frameSize = sample_size * channels; format.m_sampleRate = std::max(8000U, std::min(192000U, format.m_sampleRate)); @@ -3407,7 +3141,7 @@ index 3cb6bfb..363b7d5 100644 format.m_frameSamples = format.m_frames * channels; SetAudioProps(m_passthrough, GetChannelMap(format.m_channelLayout, m_passthrough)); -@@ -421,7 +424,7 @@ void CAESinkPi::GetDelay(AEDelayStatus& status) +@@ -427,7 +430,7 @@ void CAESinkPi::GetDelay(AEDelayStatus& status) double CAESinkPi::GetCacheTotal() { @@ -3416,7 +3150,7 @@ index 3cb6bfb..363b7d5 100644 } unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned int offset) -@@ -469,8 +472,8 @@ unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned +@@ -478,8 +481,8 @@ unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned m_submitted++; GetDelay(status); delay = status.GetDelay(); @@ -3428,7 +3162,7 @@ index 3cb6bfb..363b7d5 100644 } diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.h b/xbmc/cores/AudioEngine/Sinks/AESinkPi.h -index 5c57999..cac5051 100644 +index 55ae1b4..10b0ec6 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.h +++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.h @@ -53,6 +53,7 @@ class CAESinkPi : public IAESink @@ -3440,10 +3174,10 @@ index 5c57999..cac5051 100644 bool m_Initialized; uint32_t m_submitted; -From 15eeb598e03a492404dfb754a0eb5e07342f990e Mon Sep 17 00:00:00 2001 +From 3a60bf2bb5ce7d064c719ec96d385cf8167a7b04 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 11 Dec 2014 17:00:57 +0000 -Subject: [PATCH 046/103] Fix for UI not showing both extractflags and +Subject: [PATCH 44/89] Fix for UI not showing both extractflags and extractthumb --- @@ -3453,10 +3187,10 @@ Subject: [PATCH 046/103] Fix for UI not showing both extractflags and 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 7b1089d..e8d5f7c 100644 +index 37932be..647befc 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -10974,7 +10974,7 @@ msgstr "" +@@ -10979,7 +10979,7 @@ msgstr "" #: system/settings/settings.xml msgctxt "#20433" @@ -3465,7 +3199,7 @@ index 7b1089d..e8d5f7c 100644 msgstr "" #: xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp -@@ -14501,7 +14501,7 @@ msgstr "" +@@ -14509,7 +14509,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36178" @@ -3474,7 +3208,7 @@ index 7b1089d..e8d5f7c 100644 msgstr "" #. Description of setting "Videos -> File lists -> Replace file names with library titles" with label #20419 -@@ -14513,7 +14513,7 @@ msgstr "" +@@ -14521,7 +14521,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36180" @@ -3483,13 +3217,13 @@ index 7b1089d..e8d5f7c 100644 msgstr "" #: system/settings/settings.xml -@@ -16646,3 +16646,8 @@ msgstr "" +@@ -16654,3 +16654,8 @@ msgstr "" msgctxt "#38102" msgid "%i ms" msgstr "" + +#: system/settings/settings.xml -+msgctxt "#38015" ++msgctxt "#38103" +msgid "Extract thumbnails from video files" +msgstr "" diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml @@ -3508,10 +3242,10 @@ index 5068b20..6e9ceaf 100644 false diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 29a9ef6..bdba486 100644 +index ede89e4..f3022c3 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml -@@ -899,23 +899,23 @@ +@@ -902,23 +902,23 @@ @@ -3528,7 +3262,7 @@ index 29a9ef6..bdba486 100644 - -+ ++ 1 true @@ -3541,10 +3275,10 @@ index 29a9ef6..bdba486 100644 -From b2a98eb56639907c3305775d0fcaee9f6bc0f03e Mon Sep 17 00:00:00 2001 +From 85c30bde9f23146c332ffeaeecf2c0de5b784900 Mon Sep 17 00:00:00 2001 From: anaconda Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 047/103] Disable autoscrolling while on screensaver and while +Subject: [PATCH 45/89] Disable autoscrolling while on screensaver and while opening streams. --- @@ -3557,10 +3291,10 @@ Subject: [PATCH 047/103] Disable autoscrolling while on screensaver and while 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index e00916a..6e0aeff 100644 +index df6e8ca..5889613 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -4948,3 +4948,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const +@@ -4959,3 +4959,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const return false; } @@ -3675,10 +3409,10 @@ index 0d5b3f7..6d23024 100644 if (m_lastRenderTime) m_autoScrollDelayTime += currentTime - m_lastRenderTime; -From 7b7f2ac4ef55297e4328736678a5ed436f83a830 Mon Sep 17 00:00:00 2001 +From 67692cfba74ca0e49e21c805c503605501fb5de2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 13 Dec 2014 18:35:20 +0000 -Subject: [PATCH 048/103] [demuxer] Avoid memcpy on every demuxer packet +Subject: [PATCH 46/89] [demuxer] Avoid memcpy on every demuxer packet Avoids an unnecessary memcpy on every demuxer packet which for high bitrate videos can be significant. @@ -3773,10 +3507,10 @@ index ab298b2..10c5ee0 100644 } catch(...) { -From 6b4af4de9aaa4c125272e087680652db3b924ec1 Mon Sep 17 00:00:00 2001 +From 32561c3475489b45a10a23b1f00896759a4a8e35 Mon Sep 17 00:00:00 2001 From: Memphiz Date: Tue, 18 Nov 2014 13:27:59 +0100 -Subject: [PATCH 049/103] - added setting for allowing to hide watched +Subject: [PATCH 47/89] - added setting for allowing to hide watched movies/episodes/musicvideos in the recently added lists of the home screen --- @@ -3785,10 +3519,10 @@ Subject: [PATCH 049/103] - added setting for allowing to hide watched 2 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 e8d5f7c..8858c95 100644 +index 647befc..bf466b0 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -11142,7 +11142,13 @@ msgctxt "#20469" +@@ -11148,7 +11148,13 @@ msgctxt "#20469" msgid "Keep current set (%s)" msgstr "" @@ -3803,7 +3537,7 @@ index e8d5f7c..8858c95 100644 #up to 21329 is reserved for the video db !! ! #: system/settings/settings.xml -@@ -15958,7 +15964,13 @@ msgctxt "#36435" +@@ -15966,7 +15972,13 @@ msgctxt "#36435" msgid "Use DVDPlayer for decoding of video files with MMAL acceleration." msgstr "" @@ -3819,10 +3553,10 @@ index e8d5f7c..8858c95 100644 #. label of a setting for the stereoscopic 3D mode of the GUI that is/should be applied diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index bdba486..67472f6 100644 +index f3022c3..823f181 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml -@@ -465,6 +465,11 @@ +@@ -468,6 +468,11 @@ false @@ -3835,10 +3569,10 @@ index bdba486..67472f6 100644 -From 8eb308d186e18f8c8d23c1d77fa28fd11fa0238f Mon Sep 17 00:00:00 2001 +From 299f258f82d0bf10105053affec0d811bfa20002 Mon Sep 17 00:00:00 2001 From: Memphiz Date: Tue, 18 Nov 2014 13:28:36 +0100 -Subject: [PATCH 050/103] - evaluate the setting for hiding watched +Subject: [PATCH 48/89] - evaluate the setting for hiding watched movies/episodes/musicvideos in recently added job (should influence homescreen of skins only) @@ -3891,7 +3625,7 @@ index 1f8ec36..de45783 100644 for (; i < MusicVideoItems.Size(); ++i) { diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp -index a703de3..1212e09 100644 +index 89fbfcc..aa370af 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -6552,27 +6552,48 @@ bool CVideoDatabase::GetMusicVideosNav(const std::string& strBaseDir, CFileItemL @@ -3964,122 +3698,10 @@ index ca62f23..b905e48 100644 bool HasContent(); bool HasContent(VIDEODB_CONTENT_TYPE type); -From 6626ed33fcd8daa13811c72bbdd1fe455dd19366 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 11 Jan 2015 21:48:31 +0000 -Subject: [PATCH 051/103] [omximage] Increase timeout - this is sometimes hit - ---- - xbmc/cores/omxplayer/OMXImage.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp -index 86a683a..54a52a7 100644 ---- a/xbmc/cores/omxplayer/OMXImage.cpp -+++ b/xbmc/cores/omxplayer/OMXImage.cpp -@@ -1885,7 +1885,7 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns - } - if (m_encoded_buffer) - { -- omx_err = m_omx_encoder.WaitForOutputDone(1000); -+ omx_err = m_omx_encoder.WaitForOutputDone(2000); - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s %s m_omx_encoder.WaitForOutputDone result(0x%x)\n", CLASSNAME, __func__, srcFile.GetFilename(), omx_err); - -From 1664527d983c1a063d7145e90749af5b0d212990 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 24 Jan 2015 17:34:04 +0000 -Subject: [PATCH 052/103] temp: Some hacks to help profiling - ---- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 5 +++++ - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 4 ++-- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 2 ++ - 3 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index 7c68e1c..6a2fee9 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -564,6 +564,7 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg) - CActiveAEStream *stream; - streamMsg = (MsgStreamNew*)msg->data; - stream = CreateStream(streamMsg); -+ CLog::Log(LOGNOTICE, "ActiveAE::%s - NEWSTREAM %p %p", __FUNCTION__, streamMsg, stream); - if(stream) - { - msg->Reply(CActiveAEDataProtocol::ACC, &stream, sizeof(CActiveAEStream*)); -@@ -1228,6 +1229,7 @@ CActiveAEStream* CActiveAE::CreateStream(MsgStreamNew *streamMsg) - } - if (hasRawStream || (hasStream && AE_IS_RAW(streamMsg->format.m_dataFormat))) - { -+ CLog::Log(LOGNOTICE, "CActiveAE::CreateStream - raw"); - return NULL; - } - -@@ -1256,6 +1258,7 @@ CActiveAEStream* CActiveAE::CreateStream(MsgStreamNew *streamMsg) - - m_streams.push_back(stream); - -+ CLog::Log(LOGNOTICE, "CActiveAE::CreateStream - %p", stream); - return stream; - } - -@@ -2750,11 +2753,13 @@ IAEStream *CActiveAE::MakeStream(enum AEDataFormat dataFormat, unsigned int samp - msg.options = options; - - Message *reply; -+ CLog::Log(LOGNOTICE, "ActiveAE::%s - about to create stream", __FUNCTION__); - if (m_dataPort.SendOutMessageSync(CActiveAEDataProtocol::NEWSTREAM, - &reply,10000, - &msg, sizeof(MsgStreamNew))) - { - bool success = reply->signal == CActiveAEControlProtocol::ACC; -+ CLog::Log(LOGNOTICE, "ActiveAE::%s - created stream : %d", __FUNCTION__, success); - if (success) - { - CActiveAEStream *stream = *(CActiveAEStream**)reply->data; -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index a064da5..ebc4458 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -36,7 +36,7 @@ - #define CLASSNAME "CMMALRenderer" - - #ifdef _DEBUG --#define MMAL_DEBUG_VERBOSE -+//#define MMAL_DEBUG_VERBOSE - #endif - - static void vout_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) -@@ -372,7 +372,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - #endif - omvb->Acquire(); - mmal_port_send_buffer(m_vout_input, omvb->mmal_buffer); -- } else assert(0); -+ } //else assert(0); - } - else if (m_format == RENDER_FMT_YUV420P) - { -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 5832c58..76c708d 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -162,6 +162,8 @@ CDVDPlayerVideo::CDVDPlayerVideo( CDVDClock* pClock - - CDVDPlayerVideo::~CDVDPlayerVideo() - { -+ CLog::Log(LOGNOTICE, "drop:%d skip:%d", m_iDroppedFrames, g_renderManager.GetSkippedFrames()); -+ - StopThread(); - g_VideoReferenceClock.Stop(); - } - -From e4f51eb17146ed9b71c99968cc8a539894c02b97 Mon Sep 17 00:00:00 2001 +From 2373aa7571337304e255fe7039fbd49fcfa3a4f9 Mon Sep 17 00:00:00 2001 From: fritsch Date: Wed, 4 Feb 2015 22:32:03 +0100 -Subject: [PATCH 053/103] NFSFile: Chank ChunkSize to 1MB +Subject: [PATCH 49/89] NFSFile: Chank ChunkSize to 1MB --- xbmc/filesystem/NFSFile.h | 2 +- @@ -4099,10 +3721,10 @@ index 4c01e4e..7afa6b8 100644 virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false); virtual bool Delete(const CURL& url); -From 1bf1cc0f8335f67ab3ddff9aac3bfe86d57b6138 Mon Sep 17 00:00:00 2001 +From 2862d65f247cbff597c3a4f2a54342ae9e653e11 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 10 Feb 2015 00:19:51 +0000 -Subject: [PATCH 056/103] [libnfs] Add streaming cache +Subject: [PATCH 52/89] [libnfs] Add streaming cache --- .../libnfs/0001-Sequential-Readahead-Mode.patch | 949 +++++++++++++++++++++ @@ -5121,10 +4743,10 @@ index 9354fd5..eaa1dd7 100644 if( Stat(&tmpBuffer) ) -From 4b88d98c3ba80b522d1a34cfebe6e9a629113cee Mon Sep 17 00:00:00 2001 +From 37b404211c9d8c6e1545f2f6fd6dda25ce553ad7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 15 Feb 2015 14:06:12 +0000 -Subject: [PATCH 057/103] [mmal] Allow mmal codec for dvd stills +Subject: [PATCH 53/89] [mmal] Allow mmal codec for dvd stills --- xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 7 +++++++ @@ -5156,183 +4778,11 @@ index 0cd267a..9d8de2a 100644 { // If dvd is an mpeg2 and hint.stills -From 17f7f8502ce5429461202b3f4b609d9478577485 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 15 Feb 2015 15:29:51 +0000 -Subject: [PATCH 058/103] [rbp] Add Pi 2 specific settings defaults - -Disable omxplayer by default and don't need to warn against using ac3 transcode ---- - system/settings/rbp2.xml | 106 +++++++++++++++++++++++++++++++++++++++++++++ - xbmc/linux/RBP.h | 2 + - xbmc/settings/Settings.cpp | 7 ++- - 3 files changed, 114 insertions(+), 1 deletion(-) - create mode 100644 system/settings/rbp2.xml - -diff --git a/system/settings/rbp2.xml b/system/settings/rbp2.xml -new file mode 100644 -index 0000000..ffdcb36 ---- /dev/null -+++ b/system/settings/rbp2.xml -@@ -0,0 +1,106 @@ -+ -+ -+
-+ -+ -+ false -+ -+ -+ -+ false -+ -+ -+ -+ 1 -+ -+ 2 -+ true -+ -+ -+ -+ -+ -+ 2 -+ 10 -+ -+ 0 -+ 5 -+ 25 -+ -+ -+ 38016 -+ -+ -+ -+ -+ -+ -+ -+ -+ false -+ -+ -+ false -+ -+ -+ false -+ -+ -+ -+
-+ -+
-+ -+ -+ -+ false -+ -+ -+ false -+ -+ -+ false -+ -+ -+ 2 -+ true -+ -+ -+ -+ 2 -+ 0 -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ 101 -+ -+ -+ 3 -+ 100 -+ -+ 50 -+ 50 -+ 300 -+ -+ -+ 38102 -+ -+ -+ -+ -+
-+
-diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index 82146d6..4a04183 100644 ---- a/xbmc/linux/RBP.h -+++ b/xbmc/linux/RBP.h -@@ -37,6 +37,7 @@ - #if defined(TARGET_RASPBERRY_PI) - #include "DllBCM.h" - #include "OMXCore.h" -+#include "xbmc/utils/CPUInfo.h" - #include "threads/CriticalSection.h" - #include "threads/Event.h" - -@@ -52,6 +53,7 @@ class CRBP - int GetArmMem() { return m_arm_mem; } - int GetGpuMem() { return m_gpu_mem; } - bool GetCodecMpg2() { return m_codec_mpg2_enabled; } -+ int RasberryPiVersion() { return g_cpuInfo.getCPUCount() == 1 ? 1 : 2; }; - bool GetCodecWvc1() { return m_codec_wvc1_enabled; } - void GetDisplaySize(int &width, int &height); - DISPMANX_DISPLAY_HANDLE_T OpenDisplay(uint32_t device); -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 139817f..ab9c6fd 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -49,6 +49,9 @@ - #if defined(TARGET_DARWIN) - #include "osx/DarwinUtils.h" - #endif -+#if defined(TARGET_RASPBERRY_PI) -+#include "linux/RBP.h" -+#endif - #include "peripherals/Peripherals.h" - #include "powermanagement/PowerManager.h" - #include "profiles/ProfilesManager.h" -@@ -454,8 +457,10 @@ bool CSettings::InitializeDefinitions() - if (CFile::Exists(SETTINGS_XML_FOLDER "android.xml") && !Initialize(SETTINGS_XML_FOLDER "android.xml")) - CLog::Log(LOGFATAL, "Unable to load android-specific settings definitions"); - #elif defined(TARGET_RASPBERRY_PI) -- if (CFile::Exists(SETTINGS_XML_FOLDER "rbp.xml") && !Initialize(SETTINGS_XML_FOLDER "rbp.xml")) -+ if (g_RBP.RasberryPiVersion() == 1 && CFile::Exists(SETTINGS_XML_FOLDER "rbp.xml") && !Initialize(SETTINGS_XML_FOLDER "rbp.xml")) - CLog::Log(LOGFATAL, "Unable to load rbp-specific settings definitions"); -+ if (g_RBP.RasberryPiVersion() > 1 && CFile::Exists(SETTINGS_XML_FOLDER "rbp2.xml") && !Initialize(SETTINGS_XML_FOLDER "rbp2.xml")) -+ CLog::Log(LOGFATAL, "Unable to load rbp2-specific settings definitions"); - #elif defined(TARGET_FREEBSD) - if (CFile::Exists(SETTINGS_XML_FOLDER "freebsd.xml") && !Initialize(SETTINGS_XML_FOLDER "freebsd.xml")) - CLog::Log(LOGFATAL, "Unable to load freebsd-specific settings definitions"); - -From 750290b96315c47a5cf1dbc2f4696481d9be8750 Mon Sep 17 00:00:00 2001 +From 1c666d5d6570d68e1099f8961cc9f2c52d6e04e1 Mon Sep 17 00:00:00 2001 From: Claudio-Sjo Date: Mon, 16 Feb 2015 14:51:26 +0100 -Subject: [PATCH 059/103] - allow reads < CDIO_CD_FRAMESIZE_RAW by using a - buffer - fixes #15794 +Subject: [PATCH 54/89] - allow reads < CDIO_CD_FRAMESIZE_RAW by using a buffer + - fixes #15794 --- xbmc/filesystem/CDDAFile.cpp | 120 ++++++++++++++++++++++++++++++++----------- @@ -5523,10 +4973,10 @@ index 0427af4..e992362 100644 lsn_t m_lsnCurrent; // Position inside the track in logical sector number lsn_t m_lsnEnd; // End of m_iTrack in logical sector number -From af144ae9182175bd150cfd6c5920d019f7608d34 Mon Sep 17 00:00:00 2001 +From bc5577e298d7939945b5700dbbbc42b4fe196a1e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 20 Feb 2015 14:11:57 +0000 -Subject: [PATCH 060/103] libavformat: add mvcC handling in .mov/.mp4 +Subject: [PATCH 55/89] libavformat: add mvcC handling in .mov/.mp4 --- ...ibavformat-add-mvcC-handling-in-.mov-.mp4.patch | 57 ++++++++++++++++++++++ @@ -5618,46 +5068,10 @@ index 6e8364a..43dc4ff 100644 CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ ./configure $(ffmpg_config) -From d51cbcb8bab40754cf93919b1c5604944781375e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 24 Feb 2015 00:09:19 +0000 -Subject: [PATCH 061/103] [omxplayer] Limit subtitle updates to 10fps to avoid - stuttering with closed captions - ---- - xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index 4e599e3..b32bd7f 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -222,7 +222,7 @@ double OMXPlayerVideo::NextOverlay(double pts) - else if (delta_stop > 0.0 && (min_delta == DVD_NOPTS_VALUE || delta_stop < min_delta)) - min_delta = delta_stop; - } -- return min_delta == DVD_NOPTS_VALUE ? pts+DVD_MSEC_TO_TIME(500) : pts+min_delta; -+ return min_delta == DVD_NOPTS_VALUE ? pts+DVD_MSEC_TO_TIME(500) : pts+std::max(min_delta, DVD_MSEC_TO_TIME(100)); - } - - -@@ -306,9 +306,9 @@ void OMXPlayerVideo::Output(double pts, bool bDropPacket) - double subtitle_pts = m_nextOverlay; - double time = subtitle_pts != DVD_NOPTS_VALUE ? subtitle_pts - media_pts : 0.0; - -- m_nextOverlay = NextOverlay(media_pts); -+ m_nextOverlay = NextOverlay(media_pts + preroll); - -- ProcessOverlays(media_pts); -+ ProcessOverlays(media_pts + preroll); - - time += m_av_clock->GetAbsoluteClock(); - g_renderManager.FlipPage(CThread::m_bStop, time/DVD_TIME_BASE); - -From a7fd3cef4b00d619163cf633077536887fc0f36d Mon Sep 17 00:00:00 2001 +From fccae33d78ecc18c9edcec5f6e5a36005c6b8b8c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 24 Feb 2015 15:57:29 +0000 -Subject: [PATCH 062/103] [mmalrenderer] Fix for stereo view modes +Subject: [PATCH 56/89] [mmalrenderer] Fix for stereo view modes PR6090 (dirty regions for video) meant that RenderUpate is no longer called with the expected stereo view mode. So, just explicitly set this before calling ManageDisplay to get the desired rectangles @@ -5666,10 +5080,10 @@ So, just explicitly set this before calling ManageDisplay to get the desired rec 1 file changed, 4 insertions(+) diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index ebc4458..b9d9cd9 100644 +index 3329980..d53de35 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp +++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -346,7 +346,11 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) +@@ -351,7 +351,11 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) if (!m_bConfigured) return; @@ -5682,10 +5096,10 @@ index ebc4458..b9d9cd9 100644 // if running bypass, then the player might need the src/dst rects // for sizing video playback on a layer other than the gles layer. -From 25817c925fec4954e78a2e852b7ca1c0ef50ba6c Mon Sep 17 00:00:00 2001 +From 76958643f9e7aa870f3038a960baf3f987c39be8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 27 Feb 2015 14:37:27 +0000 -Subject: [PATCH 063/103] ffmpeg: Add some upstream HEVC optimisations +Subject: [PATCH 57/89] ffmpeg: Add some upstream HEVC optimisations --- tools/depends/target/ffmpeg/Makefile | 5 +- @@ -6128,34 +5542,10 @@ index 0000000..de95ba6 + c->put_hevc_qpel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; + c->put_hevc_qpel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; -From 2780425800930e12a685727f6ea67d47bace6b41 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 27 Feb 2015 19:07:17 +0000 -Subject: [PATCH 064/103] [omxplayer] Attempt to fix missing subtitles after - seek - ---- - xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index b32bd7f..8becff1 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -296,7 +296,7 @@ void OMXPlayerVideo::Output(double pts, bool bDropPacket) - const double preroll = DVD_MSEC_TO_TIME(100); - double media_pts = m_av_clock->OMXMediaTime(); - -- if (m_nextOverlay != DVD_NOPTS_VALUE && media_pts + preroll <= m_nextOverlay) -+ if (m_nextOverlay != DVD_NOPTS_VALUE && media_pts != 0.0 && media_pts + preroll <= m_nextOverlay) - return; - - int buffer = g_renderManager.WaitForBuffer(CThread::m_bStop); - -From 59faf7fd1d9849cd8f6524a14d86b02b065ebdd3 Mon Sep 17 00:00:00 2001 +From e885adeaa52b27c769c7c0f599e95c772f93f0fa Mon Sep 17 00:00:00 2001 From: anaconda Date: Wed, 25 Feb 2015 18:22:21 +0100 -Subject: [PATCH 065/103] Load OSD dialogs on startup. +Subject: [PATCH 58/89] 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. @@ -6250,10 +5640,10 @@ index 4940561..f52698c 100644 CGUIDialogVideoSettings::~CGUIDialogVideoSettings() { } -From 50d352d6656308960ad3e651f78688aec8237423 Mon Sep 17 00:00:00 2001 +From 018f759a0be60d10f72bb35df22e074ceb88ae72 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 5 Mar 2015 20:00:59 +0000 -Subject: [PATCH 066/103] [ffmpmeg] Discard data before VO/VOL in mpeg-4 over +Subject: [PATCH 59/89] [ffmpmeg] Discard data before VO/VOL in mpeg-4 over mpegts --- @@ -6360,10 +5750,10 @@ index 757721c..fbef09a 100644 cd $(PLATFORM);\ CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ -From e0feb4ed215e9fbe93c44eceb45214027f3c87c0 Mon Sep 17 00:00:00 2001 +From 91db23dc25c5ea12f5183dc99379ac79d9e6a1dd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 7 Mar 2015 22:46:21 +0000 -Subject: [PATCH 067/103] configure: Add raspberry-pi2 platform +Subject: [PATCH 60/89] configure: Add raspberry-pi2 platform --- configure.ac | 14 +++++++-- @@ -6375,7 +5765,7 @@ Subject: [PATCH 067/103] configure: Add raspberry-pi2 platform 6 files changed, 44 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac -index fb7c782..129c57a 100644 +index b7b2a87..be28bf6 100644 --- a/configure.ac +++ b/configure.ac @@ -746,8 +746,17 @@ case $use_platform in @@ -6438,7 +5828,7 @@ index e1ac05c..d60cccf 100644 AAPT=@AAPT@ DX=@DX@ diff --git a/tools/depends/configure.ac b/tools/depends/configure.ac -index ae0626f..85d0c72 100644 +index 9435fca..4eff331 100644 --- a/tools/depends/configure.ac +++ b/tools/depends/configure.ac @@ -17,7 +17,8 @@ AC_ARG_WITH([toolchain], @@ -6537,11 +5927,11 @@ index cdc2fe4..379bd1d 100644 set(CMAKE_SYSTEM_NAME Linux) endif() -From da6be7609a0ce66cc87d86b308e0561b04835875 Mon Sep 17 00:00:00 2001 +From ae3bcf13b7c5e8f372410cea93f85fc44067d402 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 16 Apr 2014 21:18:06 +0100 -Subject: [PATCH 068/103] [omxplayer] Don't propagate 3d flags based on - supported 3d modes +Subject: [PATCH 61/89] [omxplayer] Don't propagate 3d flags based on supported + 3d modes --- xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 29 +++-------------------------- @@ -6596,10 +5986,10 @@ index 8becff1..86d97bd 100644 unsigned int iDisplayHeight = height; -From 595f15cd5e389f7d3c37b06d5cdddb878560a303 Mon Sep 17 00:00:00 2001 +From a969c6c631b7fbf6b9c246ed3152448df288339a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:01:51 +0100 -Subject: [PATCH 069/103] [graphics] Allow switching to a more suitable 3D +Subject: [PATCH 62/89] [graphics] Allow switching to a more suitable 3D resolution --- @@ -6685,10 +6075,10 @@ index 5c1501a..aba11cd 100644 void ResetOverscan(RESOLUTION_INFO &resinfo); void ResetScreenParameters(RESOLUTION res); -From 241c252fd08754d237c78288b6aaed2595c86dda Mon Sep 17 00:00:00 2001 +From eb7a1712a184b4d997998b97359d20d6a2ab95ac Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:38:55 +0100 -Subject: [PATCH 070/103] [3D] Support switching to 3D resolutions +Subject: [PATCH 63/89] [3D] Support switching to 3D resolutions Include matching 3D flags (SBS/TAB) in the score of a resolution to switch to, to enable switching to 3d modes. Also remove the old code that treated 3D modes differently when assigning a score. @@ -6770,10 +6160,10 @@ index 4345c0f..cc5dc60 100644 return current; } -From a813ff2c01902d9e5c7f59ae43b08c3c63a7c3db Mon Sep 17 00:00:00 2001 +From 776a7d653349f024a92f4ee065527cb558ad389c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 23 Apr 2014 00:05:07 +0100 -Subject: [PATCH 071/103] [graphics] Make pixel ratio for 3d modes consistent +Subject: [PATCH 64/89] [graphics] Make pixel ratio for 3d modes consistent Note: Use the stored stereo flags from lists of resolutions. Use current stereo mode for current resolution. @@ -6976,24 +6366,23 @@ index d388373..ba14e40 100644 AddUniqueResolution(res2, resolutions); -From 8e2a045b4f3746e523f40d22db434801c72d9adf Mon Sep 17 00:00:00 2001 +From d341efba61fba5ce9738b208a23fdb4cb4b95e96 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 10 Mar 2015 17:05:18 +0000 -Subject: [PATCH 072/103] [players] Add settings option to enable MVC support +Subject: [PATCH 65/89] [players] Add settings option to enable MVC support --- addons/resource.language.en_gb/resources/strings.po | 10 ++++++++++ system/settings/rbp.xml | 10 ++++++++++ - system/settings/rbp2.xml | 10 ++++++++++ xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 5 +++++ xbmc/cores/omxplayer/OMXVideo.cpp | 5 +++++ - 5 files changed, 40 insertions(+) + 4 files changed, 30 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 8858c95..82bb99d 100644 +index bf466b0..d45f05d 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16659,6 +16659,16 @@ msgctxt "#38102" +@@ -16667,6 +16667,16 @@ msgctxt "#38102" msgid "%i ms" msgstr "" @@ -7008,7 +6397,7 @@ index 8858c95..82bb99d 100644 +msgstr "" + #: system/settings/settings.xml - msgctxt "#38015" + msgctxt "#38103" msgid "Extract thumbnails from video files" diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml index 6e9ceaf..ed61ca6 100644 @@ -7027,36 +6416,15 @@ index 6e9ceaf..ed61ca6 100644 + true + +
-+
- - - -diff --git a/system/settings/rbp2.xml b/system/settings/rbp2.xml -index ffdcb36..e909cc4 100644 ---- a/system/settings/rbp2.xml -+++ b/system/settings/rbp2.xml -@@ -33,6 +33,16 @@ - -
- -+ -+ -+ -+ 1 -+ -+ 2 -+ true -+ -+ + diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 1bfec44..21282dc 100644 +index df282f3..9e0aa66 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -534,6 +534,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -549,6 +549,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide // H.264 m_codingType = MMAL_ENCODING_H264; m_pFormatName = "mmal-h264"; @@ -7069,10 +6437,10 @@ index 1bfec44..21282dc 100644 case AV_CODEC_ID_H263: case AV_CODEC_ID_MPEG4: diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 55e16c4..5a74c79 100644 +index ca40a37..ec8fe9c 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -434,6 +434,11 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de +@@ -430,6 +430,11 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de break; } } @@ -7085,28 +6453,27 @@ index 55e16c4..5a74c79 100644 case AV_CODEC_ID_MPEG4: // (role name) video_decoder.mpeg4 -From 18240f9b0072c6ea1e8707824ab8ff4b3e75aa5b Mon Sep 17 00:00:00 2001 +From 6802d4a755bb5609e27a797242b7f858d722716a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Mar 2015 12:38:08 +0000 -Subject: [PATCH 073/103] [mmalrenderer] Switch to using transform flags for 3d +Subject: [PATCH 66/89] [mmalrenderer] Switch to using transform flags for 3d modes --- .../resource.language.en_gb/resources/strings.po | 10 +++ system/settings/rbp.xml | 8 ++ - system/settings/rbp2.xml | 8 ++ xbmc/cores/VideoRenderers/MMALRenderer.cpp | 92 ++++++---------------- xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 46 ++--------- xbmc/cores/omxplayer/OMXVideo.cpp | 36 ++++----- xbmc/cores/omxplayer/OMXVideo.h | 2 +- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 11 ++- - 8 files changed, 83 insertions(+), 130 deletions(-) + 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 82bb99d..d0d77c5 100644 +index d45f05d..bce7527 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16669,6 +16669,16 @@ msgctxt "#38111" +@@ -16677,6 +16677,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 "" @@ -7121,7 +6488,7 @@ index 82bb99d..d0d77c5 100644 +msgstr "" + #: system/settings/settings.xml - msgctxt "#38015" + msgctxt "#38103" msgid "Extract thumbnails from video files" diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml index ed61ca6..42d4da7 100644 @@ -7138,34 +6505,15 @@ index ed61ca6..42d4da7 100644 + 2 + true + -+ - - - -diff --git a/system/settings/rbp2.xml b/system/settings/rbp2.xml -index e909cc4..dff4da8 100644 ---- a/system/settings/rbp2.xml -+++ b/system/settings/rbp2.xml -@@ -42,6 +42,14 @@ - true - - -+ -+ -+ true -+ -+ 2 -+ true -+ + diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index b9d9cd9..f4c59ea 100644 +index d53de35..c30de9c 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp +++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -346,11 +346,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) +@@ -351,11 +351,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) if (!m_bConfigured) return; @@ -7177,7 +6525,7 @@ index b9d9cd9..f4c59ea 100644 // if running bypass, then the player might need the src/dst rects // for sizing video playback on a layer other than the gles layer. -@@ -541,9 +537,7 @@ EINTERLACEMETHOD CMMALRenderer::AutoInterlaceMethod() +@@ -560,9 +556,7 @@ EINTERLACEMETHOD CMMALRenderer::AutoInterlaceMethod() void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect) { @@ -7188,7 +6536,7 @@ index b9d9cd9..f4c59ea 100644 if (!m_vout_input) return; -@@ -585,41 +579,10 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect +@@ -604,41 +598,10 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect CRect gui(0, 0, CDisplaySettings::Get().GetResolutionInfo(res).iWidth, CDisplaySettings::Get().GetResolutionInfo(res).iHeight); CRect display(0, 0, CDisplaySettings::Get().GetResolutionInfo(res).iScreenWidth, CDisplaySettings::Get().GetResolutionInfo(res).iScreenHeight); @@ -7234,7 +6582,7 @@ index b9d9cd9..f4c59ea 100644 if (gui != display) { -@@ -634,7 +597,7 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect +@@ -653,7 +616,7 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect MMAL_DISPLAYREGION_T region; memset(®ion, 0, sizeof region); @@ -7243,7 +6591,7 @@ index b9d9cd9..f4c59ea 100644 region.dest_rect.x = lrintf(DestRect.x1); region.dest_rect.y = lrintf(DestRect.y1); region.dest_rect.width = lrintf(DestRect.Width()); -@@ -647,35 +610,32 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect +@@ -666,35 +629,32 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect region.fullscreen = MMAL_FALSE; region.noaspect = MMAL_TRUE; @@ -7371,10 +6719,10 @@ index 86d97bd..018e65f 100644 void OMXPlayerVideo::RenderUpdateCallBack(const void *ctx, const CRect &SrcRect, const CRect &DestRect) diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 5a74c79..aa97396 100644 +index ec8fe9c..3f37d44 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -224,15 +224,6 @@ bool COMXVideo::PortSettingsChanged() +@@ -220,15 +220,6 @@ bool COMXVideo::PortSettingsChanged() OMX_INIT_STRUCTURE(configDisplay); configDisplay.nPortIndex = m_omx_render.GetInputPort(); @@ -7390,7 +6738,7 @@ index 5a74c79..aa97396 100644 if(m_hdmi_clock_sync) { OMX_CONFIG_LATENCYTARGETTYPE latencyTarget; -@@ -877,7 +868,7 @@ void COMXVideo::Reset(void) +@@ -860,7 +851,7 @@ void COMXVideo::Reset(void) } /////////////////////////////////////////////////////////////////////////////////////////// @@ -7399,7 +6747,7 @@ index 5a74c79..aa97396 100644 { CSingleLock lock (m_critSection); if(!m_is_open) -@@ -887,7 +878,7 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER +@@ -870,7 +861,7 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER OMX_INIT_STRUCTURE(configDisplay); configDisplay.nPortIndex = m_omx_render.GetInputPort(); @@ -7408,7 +6756,7 @@ index 5a74c79..aa97396 100644 configDisplay.dest_rect.x_offset = lrintf(DestRect.x1); configDisplay.dest_rect.y_offset = lrintf(DestRect.y1); configDisplay.dest_rect.width = lrintf(DestRect.Width()); -@@ -900,23 +891,24 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER +@@ -883,23 +874,24 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER configDisplay.fullscreen = OMX_FALSE; configDisplay.noaspect = OMX_TRUE; @@ -7487,10 +6835,10 @@ index ba14e40..10a0409 100644 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 a45bafbf944a6a91f9b2d778714877bd7cb89b0f Mon Sep 17 00:00:00 2001 +From 3531e8d698ce4d38ce16c7697f6a5111563a9238 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 17 Mar 2015 20:33:54 +0000 -Subject: [PATCH 074/103] alsa: enable-shared is required +Subject: [PATCH 67/89] alsa: enable-shared is required --- tools/depends/target/alsa-lib/Makefile | 2 +- @@ -7510,700 +6858,11 @@ index b03fc19..a04d933 100644 LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a -From fc62ae2cfaac76e0fc667ce298befbf240d7981b Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 21 Mar 2015 21:46:16 +0000 -Subject: [PATCH 075/103] squash: Move m_output_busy into lock - ---- - 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 21282dc..3d90b92 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -273,7 +273,6 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - else - { - CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); -- m_output_busy++; - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s - %p (%p) buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x frame:%d", - CLASSNAME, __func__, buffer, omvb, buffer->length, dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags, omvb->m_changed_count); -@@ -285,6 +284,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - omvb->height = m_decoded_height; - omvb->m_aspect_ratio = m_aspect_ratio; - pthread_mutex_lock(&m_output_mutex); -+ m_output_busy++; - m_output_ready.push(omvb); - pthread_mutex_unlock(&m_output_mutex); - kept = true; - -From 6881d9550814c63db3c9eeea719c73a34f3ccd0e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 22 Mar 2015 19:32:36 +0000 -Subject: [PATCH 076/103] [omxplayer] Handle failures from EmptyThisBuffer and - FillThisBuffer - -Avoid leak of buffer as seen in PR6260 ---- - .../Engines/ActiveAE/ActiveAEResamplePi.cpp | 6 +++- - xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 3 ++ - xbmc/cores/omxplayer/OMXAudio.cpp | 42 +++++++--------------- - xbmc/cores/omxplayer/OMXImage.cpp | 28 ++++++++++++--- - xbmc/cores/omxplayer/OMXVideo.cpp | 38 ++++++-------------- - 5 files changed, 55 insertions(+), 62 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -index fa8112d..759ba7b 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -@@ -506,6 +506,7 @@ int CActiveAEResamplePi::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s OMX_EmptyThisBuffer() failed with result(0x%x)", CLASSNAME, __func__, omx_err); -+ m_omx_mixer.DecoderEmptyBufferDone(m_omx_mixer.GetComponent(), omx_buffer); - return false; - } - -@@ -518,8 +519,11 @@ int CActiveAEResamplePi::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t - } - omx_err = m_omx_mixer.FillThisBuffer(m_encoded_buffer); - if (omx_err != OMX_ErrorNone) -+ { -+ CLog::Log(LOGERROR, "%s::%s m_omx_mixer.FillThisBuffer result(0x%x)", CLASSNAME, __func__, omx_err); -+ m_omx_mixer.DecoderFillBufferDone(m_omx_mixer.GetComponent(), m_encoded_buffer); - return false; -- -+ } - omx_err = m_omx_mixer.WaitForOutputDone(1000); - if (omx_err != OMX_ErrorNone) - { -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -index 363b7d5..7f4d103 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -@@ -468,7 +468,10 @@ unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned - } - omx_err = m_omx_output->EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) -+ { - CLog::Log(LOGERROR, "%s:%s frames=%d err=%x", CLASSNAME, __func__, frames, omx_err); -+ m_omx_output->DecoderEmptyBufferDone(m_omx_output->GetComponent(), omx_buffer); -+ } - m_submitted++; - GetDelay(status); - delay = status.GetDelay(); -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 602d2fa..2e39224 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -858,12 +858,8 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - } - - omx_buffer->nOffset = 0; -- omx_buffer->nFilledLen = sizeof(m_wave_header); -- if(omx_buffer->nFilledLen > omx_buffer->nAllocLen) -- { -- CLog::Log(LOGERROR, "COMXAudio::Initialize - omx_buffer->nFilledLen > omx_buffer->nAllocLen"); -- return false; -- } -+ omx_buffer->nFilledLen = std::min(sizeof(m_wave_header), omx_buffer->nAllocLen); -+ - memset((unsigned char *)omx_buffer->pBuffer, 0x0, omx_buffer->nAllocLen); - memcpy((unsigned char *)omx_buffer->pBuffer, &m_wave_header, omx_buffer->nFilledLen); - omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; -@@ -872,6 +868,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return false; - } - } -@@ -889,12 +886,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - } - - omx_buffer->nOffset = 0; -- omx_buffer->nFilledLen = m_extrasize; -- if(omx_buffer->nFilledLen > omx_buffer->nAllocLen) -- { -- CLog::Log(LOGERROR, "%s::%s - omx_buffer->nFilledLen > omx_buffer->nAllocLen", CLASSNAME, __func__); -- return false; -- } -+ omx_buffer->nFilledLen = std::min((OMX_U32)m_extrasize, omx_buffer->nAllocLen); - - memset((unsigned char *)omx_buffer->pBuffer, 0x0, omx_buffer->nAllocLen); - memcpy((unsigned char *)omx_buffer->pBuffer, m_extradata, omx_buffer->nFilledLen); -@@ -904,6 +896,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return false; - } - } -@@ -1223,26 +1216,14 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt - if(demuxer_samples_sent == demuxer_samples) - omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; - -- int nRetry = 0; -- while(true) -+ omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); -+ if (omx_err != OMX_ErrorNone) - { -- omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); -- if (omx_err == OMX_ErrorNone) -- { -- //CLog::Log(LOGINFO, "AudiD: dts:%.0f pts:%.0f size:%d\n", dts, pts, len); -- break; -- } -- else -- { -- CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -- nRetry++; -- } -- if(nRetry == 5) -- { -- CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() finaly failed\n", CLASSNAME, __func__); -- return 0; -- } -+ CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() finaly failed\n", CLASSNAME, __func__); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); -+ return 0; - } -+ //CLog::Log(LOGINFO, "AudiD: dts:%.0f pts:%.0f size:%d\n", dts, pts, len); - - omx_err = m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged, 0); - if (omx_err == OMX_ErrorNone) -@@ -1477,6 +1458,7 @@ void COMXAudio::SubmitEOS() - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return; - } - CLog::Log(LOGINFO, "%s::%s", CLASSNAME, __func__); -diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp -index 54a52a7..e79f41d 100644 ---- a/xbmc/cores/omxplayer/OMXImage.cpp -+++ b/xbmc/cores/omxplayer/OMXImage.cpp -@@ -1058,6 +1058,7 @@ bool COMXImageDec::HandlePortSettingChange(unsigned int resize_width, unsigned i - if(omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s m_omx_resize FillThisBuffer result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_resize.DecoderFillBufferDone(m_omx_resize.GetComponent(), m_decoded_buffer); - return false; - } - } -@@ -1174,6 +1175,7 @@ bool COMXImageDec::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return false; - } - } -@@ -1240,8 +1242,17 @@ COMXImageEnc::~COMXImageEnc() - - OMX_INIT_STRUCTURE(m_encoded_format); - m_encoded_buffer = NULL; -- if(m_omx_encoder.IsInitialized()) -- m_omx_encoder.Deinitialize(); -+ if (!m_success) -+ { -+ if(m_omx_encoder.IsInitialized()) -+ { -+ m_omx_encoder.SetStateForComponent(OMX_StateIdle); -+ m_omx_encoder.FlushAll(); -+ m_omx_encoder.FreeInputBuffers(); -+ m_omx_encoder.FreeOutputBuffers(); -+ m_omx_encoder.Deinitialize(); -+ } -+ } - limit_calls_leave(); - } - -@@ -1383,6 +1394,7 @@ bool COMXImageEnc::Encode(unsigned char *buffer, int size, unsigned width, unsig - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_encoder.DecoderEmptyBufferDone(m_omx_encoder.GetComponent(), omx_buffer); - break; - } - } -@@ -1397,12 +1409,15 @@ bool COMXImageEnc::Encode(unsigned char *buffer, int size, unsigned width, unsig - - omx_err = m_omx_encoder.FillThisBuffer(m_encoded_buffer); - if(omx_err != OMX_ErrorNone) -+ { -+ CLog::Log(LOGERROR, "%s::%s m_omx_encoder.FillThisBuffer result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_encoder.DecoderFillBufferDone(m_omx_encoder.GetComponent(), m_encoded_buffer); - return false; -- -+ } - omx_err = m_omx_encoder.WaitForOutputDone(1000); - if(omx_err != OMX_ErrorNone) - { -- CLog::Log(LOGERROR, "%s::%s m_omx_resize.WaitForOutputDone result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ CLog::Log(LOGERROR, "%s::%s m_omx_encoder.WaitForOutputDone result(0x%x)\n", CLASSNAME, __func__, omx_err); - return false; - } - -@@ -1445,6 +1460,7 @@ bool COMXImageEnc::CreateThumbnailFromSurface(unsigned char* buffer, unsigned in - return true; - } - -+ m_success = true; - return false; - } - -@@ -1842,6 +1858,7 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s %s OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, srcFile.GetFilename(), omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return false; - } - } -@@ -1880,6 +1897,7 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns - if(omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s %s FillThisBuffer() failed (%x)\n", CLASSNAME, __func__, srcFile.GetFilename(), omx_err); -+ m_omx_encoder.DecoderFillBufferDone(m_omx_encoder.GetComponent(), m_encoded_buffer); - return false; - } - } -@@ -2199,6 +2217,7 @@ bool COMXTexture::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes, - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s - m_omx_decoder.OMX_EmptyThisBuffer (%x)", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return false; - } - } -@@ -2248,6 +2267,7 @@ bool COMXTexture::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes, - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s error m_omx_egl_render.FillThisBuffer (%x)", CLASSNAME, __func__, omx_err); -+ m_omx_egl_render.DecoderFillBufferDone(m_omx_egl_render.GetComponent(), m_egl_buffer); - return false; - } - -diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index aa97396..3f37d44 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -109,12 +109,7 @@ bool COMXVideo::SendDecoderConfig() - } - - omx_buffer->nOffset = 0; -- omx_buffer->nFilledLen = m_extrasize; -- if(omx_buffer->nFilledLen > omx_buffer->nAllocLen) -- { -- CLog::Log(LOGERROR, "%s::%s - omx_buffer->nFilledLen > omx_buffer->nAllocLen", CLASSNAME, __func__); -- return false; -- } -+ omx_buffer->nFilledLen = std::min((OMX_U32)m_extrasize, omx_buffer->nAllocLen); - - memset((unsigned char *)omx_buffer->pBuffer, 0x0, omx_buffer->nAllocLen); - memcpy((unsigned char *)omx_buffer->pBuffer, m_extradata, omx_buffer->nFilledLen); -@@ -124,6 +119,7 @@ bool COMXVideo::SendDecoderConfig() - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return false; - } - } -@@ -654,8 +650,7 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de - return false; - } - -- if(!SendDecoderConfig()) -- return false; -+ SendDecoderConfig(); - - m_is_open = true; - m_drop_state = false; -@@ -799,7 +794,7 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) - omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN; - - omx_buffer->nTimeStamp = ToOMXTime((uint64_t)(pts == DVD_NOPTS_VALUE) ? 0 : pts); -- omx_buffer->nFilledLen = (demuxer_bytes > omx_buffer->nAllocLen) ? omx_buffer->nAllocLen : demuxer_bytes; -+ omx_buffer->nFilledLen = std::min((OMX_U32)demuxer_bytes, omx_buffer->nAllocLen); - memcpy(omx_buffer->pBuffer, demuxer_content, omx_buffer->nFilledLen); - - demuxer_bytes -= omx_buffer->nFilledLen; -@@ -808,26 +803,14 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) - if(demuxer_bytes == 0) - omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; - -- int nRetry = 0; -- while(true) -+ omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); -+ if (omx_err != OMX_ErrorNone) - { -- omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); -- if (omx_err == OMX_ErrorNone) -- { -- //CLog::Log(LOGINFO, "VideD: dts:%.0f pts:%.0f size:%d)\n", dts, pts, iSize); -- break; -- } -- else -- { -- CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -- nRetry++; -- } -- if(nRetry == 5) -- { -- CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() finally failed\n", CLASSNAME, __func__); -- return false; -- } -+ CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); -+ return false; - } -+ //CLog::Log(LOGINFO, "VideD: dts:%.0f pts:%.0f size:%d)\n", dts, pts, iSize); - - omx_err = m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged, 0); - if (omx_err == OMX_ErrorNone) -@@ -946,6 +929,7 @@ void COMXVideo::SubmitEOS() - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return; - } - CLog::Log(LOGINFO, "%s::%s", CLASSNAME, __func__); - - -From cd89da5ff195c665573488bc23d5064590b5dfb6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 23 Mar 2015 23:50:50 +0000 -Subject: [PATCH 079/103] [OMXAudio] Make stereoupmix and fixed behave more - like dvdplayer - ---- - xbmc/cores/omxplayer/OMXAudio.cpp | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 2e39224..dd5cdb8 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -600,13 +600,12 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both" || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") - stdLayout = AE_CH_LAYOUT_2_0; - -- // force out layout to stereo if input is not multichannel - it gives the receiver a chance to upmix -- if (m_InputChannels <= 2) -- stdLayout = AE_CH_LAYOUT_2_0; -- -- - CAEChannelInfo resolvedMap = channelMap; - resolvedMap.ResolveChannels(stdLayout); -+ -+ if (CSettings::Get().GetInt("audiooutput.config") == AE_CONFIG_FIXED || (upmix && channelMap.Count() <= 2)) -+ resolvedMap = stdLayout; -+ - uint64_t m_dst_chan_layout = GetAVChannelLayout(resolvedMap); - uint64_t m_src_chan_layout = GetAVChannelLayout(channelMap); - - -From ca7ac79e3ae84f9004d6ad1ff97f284d5792963e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 24 Mar 2015 17:24:27 +0000 -Subject: [PATCH 080/103] [mmal] Explicitly use fast deinterlace for HD and - reduce buffers allocated by 2 - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 17 ++++++++++++++--- - 1 file changed, 14 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 3d90b92..03d397f 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -361,10 +361,13 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) - CLog::Log(LOGERROR, "%s::%s Failed to create deinterlace component (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status)); - return false; - } -+ bool advanced_deinterlace = (interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED || interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF) && -+ m_decoded_width * m_decoded_height <= 576 * 720; -+ bool half_framerate = interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF || interlace_method == VS_INTERLACEMETHOD_MMAL_BOB_HALF; -+ - MMAL_PARAMETER_IMAGEFX_PARAMETERS_T imfx_param = {{MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, sizeof(imfx_param)}, -- interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED || interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF ? -- MMAL_PARAM_IMAGEFX_DEINTERLACE_ADV : MMAL_PARAM_IMAGEFX_DEINTERLACE_FAST, -- 3, {3, 0, interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF || interlace_method == VS_INTERLACEMETHOD_MMAL_BOB_HALF }}; -+ advanced_deinterlace ? MMAL_PARAM_IMAGEFX_DEINTERLACE_ADV : MMAL_PARAM_IMAGEFX_DEINTERLACE_FAST, 3, {3, 0, half_framerate }}; -+ - status = mmal_port_parameter_set(m_deint->output[0], &imfx_param.hdr); - if (status != MMAL_SUCCESS) - { -@@ -375,6 +378,14 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) - MMAL_PORT_T *m_deint_input = m_deint->input[0]; - m_deint_input->userdata = (struct MMAL_PORT_USERDATA_T *)this; - -+ if (!advanced_deinterlace) -+ { -+ // Image_fx assumed 3 frames of context. simple deinterlace doesn't require this -+ status = mmal_port_parameter_set_uint32(m_deint_input, MMAL_PARAMETER_EXTRA_BUFFERS, -2); -+ if (status != MMAL_SUCCESS) -+ CLog::Log(LOGERROR, "%s::%s Failed to enable extra buffers on %s (status=%x %s)", CLASSNAME, __func__, m_deint_input->name, status, mmal_status_to_string(status)); -+ } -+ - // Now connect the decoder output port to deinterlace input port - status = mmal_connection_create(&m_deint_connection, m_dec->output[0], m_deint->input[0], MMAL_CONNECTION_FLAG_TUNNELLING | MMAL_CONNECTION_FLAG_ALLOCATION_ON_INPUT); - if (status != MMAL_SUCCESS) - -From 93285a243328c5d05e7437715e90c4fb4ed701b2 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 31 Mar 2015 00:36:48 +0100 -Subject: [PATCH 081/103] [mmalrenderer] Avoid submitting a buffer to renderer - twice - -Bad things happen when submitting a buffer to renderer twice. We were attempting to protect against that with -a flip count. However that was getting reset from AddProcessor, the the sequence: -Decode->AddProcessor->RenderUpdate->AddProcessor->RenderUpdate -could occur. Instead use a bit from the MMAL flags which is unlikely to get out of sync with the MMAL buffer. ---- - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 15 ++++++++++++--- - xbmc/cores/VideoRenderers/MMALRenderer.h | 1 - - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 3 ++- - 3 files changed, 14 insertions(+), 5 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index f4c59ea..357d023 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -54,6 +54,7 @@ void CMMALRenderer::vout_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T * - - if (m_format == RENDER_FMT_MMAL) - { -+ buffer->flags &= ~MMAL_BUFFER_HEADER_FLAG_USER2; - mmal_queue_put(m_release_queue, buffer); - } - else if (m_format == RENDER_FMT_YUV420P) -@@ -359,9 +360,6 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - SetVideoRect(m_sourceRect, m_destRect); - - YUVBUFFER *buffer = &m_buffers[source]; -- // we only want to upload frames once -- if (buffer->flipindex++) -- return; - if (m_format == RENDER_FMT_MMAL) - { - CMMALVideoBuffer *omvb = buffer->MMALBuffer; -@@ -370,7 +368,11 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - #if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s %p (%p)", CLASSNAME, __func__, omvb, omvb->mmal_buffer); - #endif -+ // we only want to upload frames once -+ if (omvb->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) -+ 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); - } //else assert(0); - } -@@ -378,7 +380,14 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - { - CLog::Log(LOGDEBUG, "%s::%s - %p %d", CLASSNAME, __func__, buffer->mmal_buffer, source); - if (buffer->mmal_buffer) -+ { -+ // we only want to upload frames once -+ if (buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) -+ return; -+ // sanity check it is not on display -+ buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1; - mmal_port_send_buffer(m_vout_input, buffer->mmal_buffer); -+ } - else assert(0); - } - else assert(0); -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h -index 3422e2d..6e8f240 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.h -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.h -@@ -49,7 +49,6 @@ class CMMALRenderer : public CBaseRenderer, public CThread - { - CMMALVideoBuffer *MMALBuffer; // used for hw decoded buffers - MMAL_BUFFER_HEADER_T *mmal_buffer; // used for sw decoded buffers -- unsigned flipindex; /* used to decide if this has been uploaded */ - }; - public: - CMMALRenderer(); -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 03d397f..7410c36 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -1007,7 +1007,8 @@ void CMMALVideo::ReturnBuffer(CMMALVideoBuffer *buffer) - { - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s %p (%d)", CLASSNAME, __func__, buffer, m_output_busy); -- -+ // sanity check it is not on display -+ assert(!(buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER2)); - mmal_buffer_header_release(buffer->mmal_buffer); - } - - -From e0aa63a4be636c5f6bee31df646170d616836c72 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 31 Mar 2015 00:37:25 +0100 -Subject: [PATCH 082/103] [omximage] Increase timeout on encode - ---- - xbmc/cores/omxplayer/OMXImage.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp -index e79f41d..d99d719 100644 ---- a/xbmc/cores/omxplayer/OMXImage.cpp -+++ b/xbmc/cores/omxplayer/OMXImage.cpp -@@ -1414,7 +1414,7 @@ bool COMXImageEnc::Encode(unsigned char *buffer, int size, unsigned width, unsig - m_omx_encoder.DecoderFillBufferDone(m_omx_encoder.GetComponent(), m_encoded_buffer); - return false; - } -- omx_err = m_omx_encoder.WaitForOutputDone(1000); -+ omx_err = m_omx_encoder.WaitForOutputDone(2000); - if(omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s m_omx_encoder.WaitForOutputDone result(0x%x)\n", CLASSNAME, __func__, omx_err); - -From 6b974ed76e12bd270969ad6f8bf3ec43f2193d34 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 31 Mar 2015 01:25:04 +0100 -Subject: [PATCH 083/103] [mmalrenderer] Reset m_buffers on PreInit - -When switching rapidly between different files you sometimes ended up with a stale buffer ---- - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index 357d023..82a066b 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -374,7 +374,9 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - 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); -- } //else assert(0); -+ } -+ else -+ CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); - } - else if (m_format == RENDER_FMT_YUV420P) - { -@@ -388,7 +390,8 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1; - mmal_port_send_buffer(m_vout_input, buffer->mmal_buffer); - } -- else assert(0); -+ else -+ CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); - } - else assert(0); - } -@@ -423,6 +426,7 @@ unsigned int CMMALRenderer::PreInit() - m_formats.push_back(RENDER_FMT_MMAL); - m_formats.push_back(RENDER_FMT_BYPASS); - -+ memset(m_buffers, 0, sizeof m_buffers); - m_iYV12RenderBuffer = 0; - m_NumYV12Buffers = NUM_BUFFERS; - - -From f3983e34dde74a7cb8b0f0c8b3bd8c573ec66b3d Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 31 Mar 2015 17:34:00 +0100 -Subject: [PATCH 084/103] [mmalrenderer] Add locking around m_droppedPics - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 7410c36..5018f3e 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -267,6 +267,9 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - - if (m_drop_state) - { -+ pthread_mutex_lock(&m_output_mutex); -+ m_droppedPics++; -+ pthread_mutex_unlock(&m_output_mutex); - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s - dropping %p (drop:%d)", CLASSNAME, __func__, buffer, m_drop_state); - } -@@ -756,6 +759,7 @@ void CMMALVideo::SetDropState(bool bDrop) - { - buffer = m_output_ready.front(); - m_output_ready.pop(); -+ m_droppedPics++; - } - pthread_mutex_unlock(&m_output_mutex); - if (buffer) -@@ -869,6 +873,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) - - if (demuxer_bytes == 0) - { -+ pthread_mutex_lock(&m_output_mutex); - m_decode_frame_number++; - m_startframe = true; - if (m_drop_state) -@@ -878,11 +883,10 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) - else - { - // only push if we are successful with feeding mmal -- pthread_mutex_lock(&m_output_mutex); - m_dts_queue.push(dts); - assert(m_dts_queue.size() < 5000); -- pthread_mutex_unlock(&m_output_mutex); - } -+ pthread_mutex_unlock(&m_output_mutex); - if (m_changed_count_dec != m_changed_count) - { - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -981,6 +985,7 @@ void CMMALVideo::Reset(void) - while (!m_demux_queue.empty()) - m_demux_queue.pop(); - m_demux_queue_length = 0; -+ m_droppedPics = 0; - pthread_mutex_unlock(&m_output_mutex); - if (!old_drop_state) - SetDropState(false); -@@ -990,7 +995,6 @@ void CMMALVideo::Reset(void) - - m_startframe = false; - m_decoderPts = DVD_NOPTS_VALUE; -- m_droppedPics = 0; - m_decode_frame_number = 1; - m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); - } -@@ -1124,9 +1128,11 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) - - bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) - { -+ pthread_mutex_lock(&m_output_mutex); - pts = m_decoderPts; - droppedPics = m_droppedPics; - m_droppedPics = 0; -+ pthread_mutex_unlock(&m_output_mutex); - //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - // CLog::Log(LOGDEBUG, "%s::%s - pts:%.0f droppedPics:%d", CLASSNAME, __func__, pts, droppedPics); - return true; - -From 26a386aac6449208c791dbf0de920aca4c46a4ce Mon Sep 17 00:00:00 2001 +From 63a3a45ee208669b1b74a4f88aa9802ab5bf6c49 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 31 Mar 2015 17:31:47 +0100 -Subject: [PATCH 085/103] [mmalrenderer] Add SetCodecControl function and - prefer to return pictures when renderer is low (disabled) +Subject: [PATCH 70/89] [mmalrenderer] Add SetCodecControl function and prefer + to return pictures when renderer is low (disabled) --- xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp | 5 +++++ @@ -8241,10 +6900,10 @@ index a768e70..aa8e87f 100644 protected: diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 5018f3e..3868342 100644 +index 9e0aa66..1e711b4 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -130,6 +130,7 @@ CMMALVideo::CMMALVideo() +@@ -128,6 +128,7 @@ CMMALVideo::CMMALVideo() m_es_format = mmal_format_alloc(); m_preroll = true; m_speed = DVD_PLAYSPEED_NORMAL; @@ -8252,7 +6911,7 @@ index 5018f3e..3868342 100644 } CMMALVideo::~CMMALVideo() -@@ -945,6 +946,9 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -944,6 +945,9 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) if (g_advancedSettings.CanLogComponent(LOGVIDEO)) CLog::Log(LOGDEBUG, "%s::%s - got output picture:%d", CLASSNAME, __func__, m_output_ready.size()); ret |= VC_PICTURE; @@ -8262,15 +6921,15 @@ index 5018f3e..3868342 100644 } if (!ret) { -@@ -997,6 +1001,7 @@ void CMMALVideo::Reset(void) +@@ -995,6 +999,7 @@ void CMMALVideo::Reset(void) + m_startframe = false; m_decoderPts = DVD_NOPTS_VALUE; - m_decode_frame_number = 1; m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); + m_codecControlFlags = 0; } void CMMALVideo::SetSpeed(int iSpeed) -@@ -1137,3 +1142,10 @@ bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) +@@ -1128,3 +1133,10 @@ bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) // CLog::Log(LOGDEBUG, "%s::%s - pts:%.0f droppedPics:%d", CLASSNAME, __func__, pts, droppedPics); return true; } @@ -8282,10 +6941,10 @@ index 5018f3e..3868342 100644 + CLog::Log(LOGDEBUG, "%s::%s flags:%x", CLASSNAME, __func__, flags); +} diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -index ca513f6..ec44b13 100644 +index 4c9b20f..c405aa1 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -@@ -90,6 +90,7 @@ class CMMALVideo +@@ -89,6 +89,7 @@ class CMMALVideo virtual void SetDropState(bool bDrop); virtual const char* GetName(void) { return (const char*)m_pFormatName; } virtual bool GetCodecStats(double &pts, int &droppedPics); @@ -8293,7 +6952,7 @@ index ca513f6..ec44b13 100644 virtual void SetSpeed(int iSpeed); // MMAL decoder callback routines. -@@ -143,6 +144,7 @@ class CMMALVideo +@@ -140,6 +141,7 @@ class CMMALVideo unsigned int m_droppedPics; int m_speed; bool m_preroll; @@ -8302,10 +6961,10 @@ index ca513f6..ec44b13 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; -From 74cc992c8216da6e5a39fe5f470005c9d1accdbb Mon Sep 17 00:00:00 2001 +From be88e53ace69911dd0400e19c087f6bac7318ec9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 Apr 2015 16:31:37 +0100 -Subject: [PATCH 086/103] [mmalcodec] Limit submitted video frames. Seems to +Subject: [PATCH 71/89] [mmalcodec] Limit submitted video frames. Seems to avoid stutter issues with low bitrate videos --- @@ -8313,10 +6972,10 @@ Subject: [PATCH 086/103] [mmalcodec] Limit submitted video frames. Seems to 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 3868342..2e23430 100644 +index 1e711b4..77c31f2 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -929,7 +929,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -928,7 +928,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) break; } int ret = 0; @@ -8327,370 +6986,10 @@ index 3868342..2e23430 100644 if (g_advancedSettings.CanLogComponent(LOGVIDEO)) CLog::Log(LOGDEBUG, "%s::%s - got space for output: demux_queue(%d) space(%d)", CLASSNAME, __func__, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); -From 66bb7019bb917be310d6a2bd21fb206302d8ee1a Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 1 Apr 2015 18:35:01 +0100 -Subject: [PATCH 087/103] [rbp] Disable analogue output of sync when - passthrough is enabled - -The analogue and output of Pi Sink doesn't support passthrough. -This also applies to the 'Both' (HDMI and Analogue) setting. -If passthrough is enabled in GUI you get black screen and errors: -https://discourse.osmc.tv/t/some-streams-are-staying-black/2311 - -We need to either disable passthrough or disable analogue. - -I think the best solution to this is to force HDMI output when passthrough is active. - -This allows a user to use receiver for videos with dts/ac3 and TV for music or lower quality formats. ---- - xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 22 ++++++++++++++-------- - xbmc/cores/AudioEngine/Sinks/AESinkPi.h | 1 + - xbmc/cores/omxplayer/OMXAudio.cpp | 21 +++++++++++++++------ - xbmc/cores/omxplayer/OMXAudio.h | 1 + - 4 files changed, 31 insertions(+), 14 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -index 7f4d103..b69925a 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -@@ -45,7 +45,8 @@ CAESinkPi::CAESinkPi() : - m_latency(0), - m_Initialized(false), - m_submitted(0), -- m_omx_output(NULL) -+ m_omx_output(NULL), -+ m_output(AESINKPI_UNKNOWN) - { - } - -@@ -60,7 +61,7 @@ void CAESinkPi::SetAudioDest() - OMX_INIT_STRUCTURE(audioDest); - if ( m_omx_render.IsInitialized() ) - { -- if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") -+ if (m_output == AESINKPI_ANALOGUE) - strncpy((char *)audioDest.sName, "local", strlen("local")); - else - strncpy((char *)audioDest.sName, "hdmi", strlen("hdmi")); -@@ -70,7 +71,7 @@ void CAESinkPi::SetAudioDest() - } - if ( m_omx_render_slave.IsInitialized() ) - { -- if (CSettings::Get().GetString("audiooutput.audiodevice") != "PI:Analogue") -+ if (m_output != AESINKPI_ANALOGUE) - strncpy((char *)audioDest.sName, "local", strlen("local")); - else - strncpy((char *)audioDest.sName, "hdmi", strlen("hdmi")); -@@ -193,12 +194,17 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) - m_latency = CSettings::Get().GetInt("audiooutput.latency") * 1e-3; - m_latency = std::max(m_latency, 50e-3); - -+ if (m_passthrough || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:HDMI") -+ m_output = AESINKPI_HDMI; -+ else if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") -+ m_output = AESINKPI_ANALOGUE; -+ else if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -+ m_output = AESINKPI_BOTH; -+ else assert(0); -+ - // analogue only supports stereo -- if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue" || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -- { -+ if (m_output == AESINKPI_ANALOGUE || m_output == AESINKPI_BOTH) - format.m_channelLayout = AE_CH_LAYOUT_2_0; -- m_passthrough = false; -- } - - // setup for a 50ms sink feed from SoftAE - if (format.m_dataFormat != AE_FMT_FLOATP && format.m_dataFormat != AE_FMT_FLOAT && -@@ -226,7 +232,7 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) - if (!m_omx_render.Initialize("OMX.broadcom.audio_render", OMX_IndexParamAudioInit)) - CLog::Log(LOGERROR, "%s::%s - m_omx_render.Initialize omx_err(0x%08x)", CLASSNAME, __func__, omx_err); - -- if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -+ if (m_output == AESINKPI_BOTH) - { - if (!m_omx_splitter.Initialize("OMX.broadcom.audio_splitter", OMX_IndexParamAudioInit)) - CLog::Log(LOGERROR, "%s::%s - m_omx_splitter.Initialize omx_err(0x%08x)", CLASSNAME, __func__, omx_err); -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.h b/xbmc/cores/AudioEngine/Sinks/AESinkPi.h -index cac5051..10b0ec6 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.h -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.h -@@ -65,6 +65,7 @@ class CAESinkPi : public IAESink - bool m_passthrough; - COMXCoreTunel m_omx_tunnel_splitter; - COMXCoreTunel m_omx_tunnel_splitter_slave; -+ enum { AESINKPI_UNKNOWN, AESINKPI_HDMI, AESINKPI_ANALOGUE, AESINKPI_BOTH } m_output; - }; - - #endif -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index dd5cdb8..9d960aa 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -88,7 +88,8 @@ COMXAudio::COMXAudio() : - m_extrasize (0 ), - m_last_pts (DVD_NOPTS_VALUE), - m_submitted_eos (false ), -- m_failed_eos (false ) -+ m_failed_eos (false ), -+ m_output (AESINKPI_UNKNOWN) - { - CAEFactory::Suspend(); - while (!CAEFactory::IsSuspended()) -@@ -119,17 +120,17 @@ bool COMXAudio::PortSettingsChanged() - if(!m_omx_mixer.Initialize("OMX.broadcom.audio_mixer", OMX_IndexParamAudioInit)) - return false; - } -- if(CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -+ if(m_output == AESINKPI_BOTH) - { - if(!m_omx_splitter.Initialize("OMX.broadcom.audio_splitter", OMX_IndexParamAudioInit)) - return false; - } -- if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both" || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") -+ if (m_output == AESINKPI_BOTH || m_output == AESINKPI_ANALOGUE) - { - if(!m_omx_render_analog.Initialize("OMX.broadcom.audio_render", OMX_IndexParamAudioInit)) - return false; - } -- if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both" || CSettings::Get().GetString("audiooutput.audiodevice") != "PI:Analogue") -+ if (m_output == AESINKPI_BOTH || m_output != AESINKPI_ANALOGUE) - { - if(!m_omx_render_hdmi.Initialize("OMX.broadcom.audio_render", OMX_IndexParamAudioInit)) - return false; -@@ -248,7 +249,7 @@ bool COMXAudio::PortSettingsChanged() - // By default audio_render is the clock master, and if output samples don't fit the timestamps, it will speed up/slow down the clock. - // This tends to be better for maintaining audio sync and avoiding audio glitches, but can affect video/display sync - if((CSettings::Get().GetBool("videoplayer.usedisplayasclock") && CSettings::Get().GetInt("videoplayer.synctype") == SYNC_DISCON) || -- CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -+ m_output == AESINKPI_BOTH) - { - OMX_CONFIG_BOOLEANTYPE configBool; - OMX_INIT_STRUCTURE(configBool); -@@ -570,6 +571,14 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - } - SetCodingType(format.m_dataFormat); - -+ if (m_Passthrough || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:HDMI") -+ m_output = AESINKPI_HDMI; -+ else if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") -+ m_output = AESINKPI_ANALOGUE; -+ else if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -+ m_output = AESINKPI_BOTH; -+ else assert(0); -+ - if(hints.extrasize > 0 && hints.extradata != NULL) - { - m_extrasize = hints.extrasize; -@@ -597,7 +606,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - CAEChannelInfo stdLayout = (enum AEStdChLayout)CSettings::Get().GetInt("audiooutput.channels"); - - // ignore layout setting for analogue -- if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both" || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") -+ if (m_output == AESINKPI_ANALOGUE || m_output == AESINKPI_BOTH) - stdLayout = AE_CH_LAYOUT_2_0; - - CAEChannelInfo resolvedMap = channelMap; -diff --git a/xbmc/cores/omxplayer/OMXAudio.h b/xbmc/cores/omxplayer/OMXAudio.h -index 569cb09..c31d25e 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.h -+++ b/xbmc/cores/omxplayer/OMXAudio.h -@@ -124,6 +124,7 @@ class COMXAudio - double m_last_pts; - bool m_submitted_eos; - bool m_failed_eos; -+ enum { AESINKPI_UNKNOWN, AESINKPI_HDMI, AESINKPI_ANALOGUE, AESINKPI_BOTH } m_output; - - typedef struct { - double pts; - -From 91009891251f052d8a1dc74deac32990cd8deb65 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 2 Apr 2015 15:40:22 +0100 -Subject: [PATCH 088/103] [mmalrenderer] Discard corrupt frames later so we can - track the number of discarded frames - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 2e23430..a842ddd 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -274,6 +274,11 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s - dropping %p (drop:%d)", CLASSNAME, __func__, buffer, m_drop_state); - } -+ else if (g_advancedSettings.m_omxDecodeStartWithValidFrame && (buffer->flags & MMAL_BUFFER_HEADER_FLAG_CORRUPTED)) -+ { -+ CLog::Log(LOGDEBUG, "%s::%s - %p buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x Corrupted", -+ CLASSNAME, __func__, buffer, buffer->length, dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags); -+ } - else - { - CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); -@@ -643,7 +648,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide - - error_concealment.hdr.id = MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT; - error_concealment.hdr.size = sizeof(MMAL_PARAMETER_BOOLEAN_T); -- error_concealment.enable = g_advancedSettings.m_omxDecodeStartWithValidFrame; -+ error_concealment.enable = false; - status = mmal_port_parameter_set(m_dec_input, &error_concealment.hdr); - if (status != MMAL_SUCCESS) - CLog::Log(LOGERROR, "%s::%s Failed to disable error concealment on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); - -From 0e0ac43fad3b3ec91c7fb11ac482e7e0b655d213 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 6 Apr 2015 19:08:20 +0100 -Subject: [PATCH 089/103] Revert "[mmalrenderer] Discard corrupt frames later - so we can track the number of discarded frames" - -This reverts commit e3f57826eff42a3f1843dffd978ac98bda372826. ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index a842ddd..2e23430 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -274,11 +274,6 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s - dropping %p (drop:%d)", CLASSNAME, __func__, buffer, m_drop_state); - } -- else if (g_advancedSettings.m_omxDecodeStartWithValidFrame && (buffer->flags & MMAL_BUFFER_HEADER_FLAG_CORRUPTED)) -- { -- CLog::Log(LOGDEBUG, "%s::%s - %p buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x Corrupted", -- CLASSNAME, __func__, buffer, buffer->length, dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags); -- } - else - { - CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); -@@ -648,7 +643,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide - - error_concealment.hdr.id = MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT; - error_concealment.hdr.size = sizeof(MMAL_PARAMETER_BOOLEAN_T); -- error_concealment.enable = false; -+ error_concealment.enable = g_advancedSettings.m_omxDecodeStartWithValidFrame; - status = mmal_port_parameter_set(m_dec_input, &error_concealment.hdr); - if (status != MMAL_SUCCESS) - CLog::Log(LOGERROR, "%s::%s Failed to disable error concealment on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); - -From 3c322da17a4b5e38cd9e683db4353badca1dab42 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 2 Apr 2015 00:25:26 +0100 -Subject: [PATCH 090/103] [mmalcodec] Allocate more buffers when deinterlacing - -Needed with trickplay with deinterlace. TODO: can this be reduced ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 11 ++++------- - 1 file changed, 4 insertions(+), 7 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 2e23430..180b96f 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -382,13 +382,10 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) - MMAL_PORT_T *m_deint_input = m_deint->input[0]; - m_deint_input->userdata = (struct MMAL_PORT_USERDATA_T *)this; - -- if (!advanced_deinterlace) -- { -- // Image_fx assumed 3 frames of context. simple deinterlace doesn't require this -- status = mmal_port_parameter_set_uint32(m_deint_input, MMAL_PARAMETER_EXTRA_BUFFERS, -2); -- if (status != MMAL_SUCCESS) -- CLog::Log(LOGERROR, "%s::%s Failed to enable extra buffers on %s (status=%x %s)", CLASSNAME, __func__, m_deint_input->name, status, mmal_status_to_string(status)); -- } -+ // Image_fx assumed 3 frames of context. simple deinterlace doesn't require this -+ status = mmal_port_parameter_set_uint32(m_deint_input, MMAL_PARAMETER_EXTRA_BUFFERS, GetAllowedReferences() - 5 + advanced_deinterlace ? 2:0); -+ if (status != MMAL_SUCCESS) -+ CLog::Log(LOGERROR, "%s::%s Failed to enable extra buffers on %s (status=%x %s)", CLASSNAME, __func__, m_deint_input->name, status, mmal_status_to_string(status)); - - // Now connect the decoder output port to deinterlace input port - status = mmal_connection_create(&m_deint_connection, m_dec->output[0], m_deint->input[0], MMAL_CONNECTION_FLAG_TUNNELLING | MMAL_CONNECTION_FLAG_ALLOCATION_ON_INPUT); - -From 0248c175316462dfe5bf4721b062db88f109c561 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 3 Apr 2015 10:49:55 +0200 -Subject: [PATCH 091/103] dvdplayer: cosmetics - ---- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 41 ++++++++++++++++++++------------------ - 1 file changed, 22 insertions(+), 19 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 8ceb498..1f220c6 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -1454,16 +1454,18 @@ void CDVDPlayer::Process() - - m_OmxPlayerState.bOmxSentEOFs = true; - } -+ - if(m_CurrentAudio.inited) -- m_dvdPlayerAudio->SendMessage (new CDVDMsg(CDVDMsg::GENERAL_EOF)); -+ m_dvdPlayerAudio->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); - if(m_CurrentVideo.inited) -- m_dvdPlayerVideo->SendMessage (new CDVDMsg(CDVDMsg::GENERAL_EOF)); -+ m_dvdPlayerVideo->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); - if(m_CurrentSubtitle.inited) - m_dvdPlayerSubtitle->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); - if(m_CurrentTeletext.inited) - m_dvdPlayerTeletext->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); -- m_CurrentAudio.inited = false; -- m_CurrentVideo.inited = false; -+ -+ m_CurrentAudio.inited = false; -+ m_CurrentVideo.inited = false; - m_CurrentSubtitle.inited = false; - m_CurrentTeletext.inited = false; - -@@ -1573,21 +1575,22 @@ bool CDVDPlayer::CheckIsCurrent(CCurrentStream& current, CDemuxStream* stream, D - - void CDVDPlayer::ProcessPacket(CDemuxStream* pStream, DemuxPacket* pPacket) - { -- /* process packet if it belongs to selected stream. for dvd's don't allow automatic opening of streams*/ -- -- if (CheckIsCurrent(m_CurrentAudio, pStream, pPacket)) -- ProcessAudioData(pStream, pPacket); -- else if (CheckIsCurrent(m_CurrentVideo, pStream, pPacket)) -- ProcessVideoData(pStream, pPacket); -- else if (CheckIsCurrent(m_CurrentSubtitle, pStream, pPacket)) -- ProcessSubData(pStream, pPacket); -- else if (CheckIsCurrent(m_CurrentTeletext, pStream, pPacket)) -- ProcessTeletextData(pStream, pPacket); -- else -- { -- pStream->SetDiscard(AVDISCARD_ALL); -- CDVDDemuxUtils::FreeDemuxPacket(pPacket); // free it since we won't do anything with it -- } -+ // process packet if it belongs to selected stream. -+ // for dvd's don't allow automatic opening of streams*/ -+ -+ if (CheckIsCurrent(m_CurrentAudio, pStream, pPacket)) -+ ProcessAudioData(pStream, pPacket); -+ else if (CheckIsCurrent(m_CurrentVideo, pStream, pPacket)) -+ ProcessVideoData(pStream, pPacket); -+ else if (CheckIsCurrent(m_CurrentSubtitle, pStream, pPacket)) -+ ProcessSubData(pStream, pPacket); -+ else if (CheckIsCurrent(m_CurrentTeletext, pStream, pPacket)) -+ ProcessTeletextData(pStream, pPacket); -+ else -+ { -+ pStream->SetDiscard(AVDISCARD_ALL); -+ CDVDDemuxUtils::FreeDemuxPacket(pPacket); // free it since we won't do anything with it -+ } - } - - void CDVDPlayer::CheckStreamChanges(CCurrentStream& current, CDemuxStream* stream) - -From c1a1141d6ed1699fc2ab1bae805786a58d38786f Mon Sep 17 00:00:00 2001 +From ae1a4baf6e3fe6ebd229a1b56d5cd6314c2390a0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 6 Apr 2015 19:06:26 +0100 -Subject: [PATCH 092/103] [mmalcodec] Remove the decoder queue and use gpu +Subject: [PATCH 72/89] [mmalcodec] Remove the decoder queue and use gpu timestamps There are too many streams that don't have a 1:1 mapping of encoded video frames to decoded pictures. @@ -8700,15 +6999,15 @@ Interlaces streams and streams with errors cause issues. Instead remove the dts queue and use the gpu's timestamps. --- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 91 +++++++++++----------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 88 +++++++++++----------- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 2 +- - 2 files changed, 46 insertions(+), 47 deletions(-) + 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 180b96f..e5ea365 100644 +index 77c31f2..d8d733e 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -131,6 +131,7 @@ CMMALVideo::CMMALVideo() +@@ -129,6 +129,7 @@ CMMALVideo::CMMALVideo() m_preroll = true; m_speed = DVD_PLAYSPEED_NORMAL; m_codecControlFlags = 0; @@ -8716,7 +7015,7 @@ index 180b96f..e5ea365 100644 } CMMALVideo::~CMMALVideo() -@@ -254,27 +255,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf +@@ -258,27 +259,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf { assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_DECODEONLY)); double dts = DVD_NOPTS_VALUE; @@ -8745,7 +7044,7 @@ index 180b96f..e5ea365 100644 { CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -293,6 +274,14 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf +@@ -297,6 +278,14 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf pthread_mutex_unlock(&m_output_mutex); kept = true; } @@ -8760,7 +7059,7 @@ index 180b96f..e5ea365 100644 } } else if (buffer->cmd == MMAL_EVENT_FORMAT_CHANGED) -@@ -649,6 +638,10 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -653,6 +642,10 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide 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)); @@ -8771,7 +7070,7 @@ index 180b96f..e5ea365 100644 status = mmal_port_format_commit(m_dec_input); if (status != MMAL_SUCCESS) { -@@ -717,6 +710,8 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -721,6 +714,8 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide m_startframe = false; m_preroll = !m_hints.stills; m_speed = DVD_PLAYSPEED_NORMAL; @@ -8780,7 +7079,7 @@ index 180b96f..e5ea365 100644 return true; } -@@ -732,10 +727,9 @@ void CMMALVideo::Dispose() +@@ -736,10 +731,9 @@ void CMMALVideo::Dispose() done = true; pthread_mutex_unlock(&m_output_mutex); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8792,7 +7091,7 @@ index 180b96f..e5ea365 100644 m_myself.reset(); } } -@@ -768,11 +762,19 @@ void CMMALVideo::SetDropState(bool bDrop) +@@ -772,11 +766,19 @@ void CMMALVideo::SetDropState(bool bDrop) } } @@ -8814,7 +7113,7 @@ index 180b96f..e5ea365 100644 unsigned int demuxer_bytes = 0; uint8_t *demuxer_content = NULL; -@@ -836,6 +838,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -840,6 +842,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) return VC_ERROR; } @@ -8827,18 +7126,8 @@ index 180b96f..e5ea365 100644 + mmal_buffer_header_reset(buffer); buffer->cmd = 0; - if (m_startframe && pts == DVD_NOPTS_VALUE) -@@ -843,9 +852,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) - buffer->pts = pts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : pts; - buffer->dts = dts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : dts; - buffer->length = demuxer_bytes > buffer->alloc_size ? buffer->alloc_size : demuxer_bytes; -- buffer->user_data = (void *)m_decode_frame_number; -- // set a flag so we can identify primary frames from generated frames (deinterlace) -- buffer->flags = MMAL_BUFFER_HEADER_FLAG_USER0; - - // Request decode only (maintain ref frames, but don't return a picture) - if (m_drop_state) -@@ -859,8 +865,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + if (!m_startframe && pts == DVD_NOPTS_VALUE) +@@ -862,8 +871,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) buffer->flags |= MMAL_BUFFER_HEADER_FLAG_FRAME_END; if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8849,7 +7138,7 @@ index 180b96f..e5ea365 100644 assert((int)buffer->length > 0); status = mmal_port_send_buffer(m_dec_input, buffer); if (status != MMAL_SUCCESS) -@@ -878,12 +884,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -880,12 +889,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { m_droppedPics += m_deint ? 2:1; } @@ -8862,7 +7151,7 @@ index 180b96f..e5ea365 100644 pthread_mutex_unlock(&m_output_mutex); if (m_changed_count_dec != m_changed_count) { -@@ -926,11 +926,11 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -928,11 +931,11 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) break; } int ret = 0; @@ -8877,7 +7166,7 @@ index 180b96f..e5ea365 100644 ret |= VC_BUFFER; } else -@@ -951,8 +951,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -953,8 +956,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) if (!ret) { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8888,7 +7177,7 @@ index 180b96f..e5ea365 100644 Sleep(10); // otherwise we busy spin } return ret; -@@ -982,8 +982,6 @@ void CMMALVideo::Reset(void) +@@ -984,8 +987,6 @@ void CMMALVideo::Reset(void) bool old_drop_state = m_drop_state; SetDropState(true); pthread_mutex_lock(&m_output_mutex); @@ -8897,15 +7186,15 @@ index 180b96f..e5ea365 100644 while (!m_demux_queue.empty()) m_demux_queue.pop(); m_demux_queue_length = 0; -@@ -1000,6 +998,7 @@ void CMMALVideo::Reset(void) - m_decode_frame_number = 1; +@@ -1001,6 +1002,7 @@ void CMMALVideo::Reset(void) + m_decoderPts = DVD_NOPTS_VALUE; m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); m_codecControlFlags = 0; + m_history_valid_pts = ~0; } void CMMALVideo::SetSpeed(int iSpeed) -@@ -1028,8 +1027,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) +@@ -1020,8 +1022,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) mmal_buffer_header_reset(buffer); buffer->cmd = 0; if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8916,7 +7205,7 @@ index 180b96f..e5ea365 100644 status = mmal_port_send_buffer(m_dec_output, buffer); if (status != MMAL_SUCCESS) { -@@ -1054,7 +1053,7 @@ void CMMALVideo::ReleaseBuffer(CMMALVideoBuffer *buffer) +@@ -1048,7 +1050,7 @@ void CMMALVideo::ReleaseBuffer(CMMALVideoBuffer *buffer) if (done) m_myself.reset(); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8926,10 +7215,10 @@ index 180b96f..e5ea365 100644 } diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -index ec44b13..a859467 100644 +index c405aa1..f5f664a 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -@@ -119,7 +119,6 @@ class CMMALVideo +@@ -118,7 +118,6 @@ class CMMALVideo const char *m_pFormatName; MMALVideoPtr m_myself; @@ -8937,7 +7226,7 @@ index ec44b13..a859467 100644 std::queue m_demux_queue; unsigned m_demux_queue_length; -@@ -145,6 +144,7 @@ class CMMALVideo +@@ -142,6 +141,7 @@ class CMMALVideo int m_speed; bool m_preroll; int m_codecControlFlags; @@ -8946,92 +7235,11 @@ index ec44b13..a859467 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; -From b4f0f4e150544d573bd61baa8842ecd10212a526 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 7 Apr 2015 19:50:15 +0100 -Subject: [PATCH 093/103] [mmalrenderer] Fix for inverted check for first frame - ---- - 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 e5ea365..7c53347 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -847,7 +847,7 @@ 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) -+ 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; - -From 8f998d7464019a7aa254b08f338ba73a0f8e4c03 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 8 Apr 2015 22:52:03 +0100 -Subject: [PATCH 094/103] Revert "[omxplayer] Only enable audio clock master - when A/V sync method is set to audio clock" - -This reverts commit 56491e6e9f01744f4c43abe7a7ddc1f5a5b179c3. ---- - xbmc/cores/omxplayer/OMXAudio.cpp | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 9d960aa..9bb967a 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -248,8 +248,7 @@ bool COMXAudio::PortSettingsChanged() - { - // By default audio_render is the clock master, and if output samples don't fit the timestamps, it will speed up/slow down the clock. - // This tends to be better for maintaining audio sync and avoiding audio glitches, but can affect video/display sync -- if((CSettings::Get().GetBool("videoplayer.usedisplayasclock") && CSettings::Get().GetInt("videoplayer.synctype") == SYNC_DISCON) || -- m_output == AESINKPI_BOTH) -+ if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") || m_output == AESINKPI_BOTH) - { - OMX_CONFIG_BOOLEANTYPE configBool; - OMX_INIT_STRUCTURE(configBool); -@@ -275,7 +274,7 @@ bool COMXAudio::PortSettingsChanged() - { - // By default audio_render is the clock master, and if output samples don't fit the timestamps, it will speed up/slow down the clock. - // This tends to be better for maintaining audio sync and avoiding audio glitches, but can affect video/display sync -- if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") && CSettings::Get().GetInt("videoplayer.synctype") == SYNC_DISCON) -+ if(CSettings::Get().GetBool("videoplayer.usedisplayasclock")) - { - OMX_CONFIG_BOOLEANTYPE configBool; - OMX_INIT_STRUCTURE(configBool); - -From a71bb2cbab462337944da1c6499b5c0c8973bff3 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 9 Apr 2015 17:12:56 +0100 -Subject: [PATCH 095/103] squash: add timeout to vc_dispmanx_vsync_callback - ---- - xbmc/linux/RBP.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index fe1df00..8bf0f14 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -196,7 +196,7 @@ void CRBP::WaitVsync() - s = vc_dispmanx_vsync_callback(m_display, vsync_callback, (void *)&m_vsync); - if (s == 0) - { -- m_vsync.Wait(); -+ m_vsync.WaitMSec(1000); - } - else assert(0); - s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); - -From 3da7de0426191fae9e88ff8b39fd4c850d7b00df Mon Sep 17 00:00:00 2001 +From 2f763b28cb818300befb9f7a4c6fd79c7ced9d7f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 9 Apr 2015 18:18:09 +0100 -Subject: [PATCH 096/103] [mmalrenderer] Remove dropping logic. It only seems - to make things worse +Subject: [PATCH 73/89] [mmalrenderer] Remove dropping logic. It only seems to + make things worse --- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 76 +++++++--------------- @@ -9039,10 +7247,10 @@ Subject: [PATCH 096/103] [mmalrenderer] Remove dropping logic. It only seems 2 files changed, 23 insertions(+), 55 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 7c53347..670e13f 100644 +index d8d733e..cfe106a 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -98,7 +98,6 @@ CMMALVideo::CMMALVideo() +@@ -97,7 +97,6 @@ CMMALVideo::CMMALVideo() CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); pthread_mutex_init(&m_output_mutex, NULL); @@ -9050,15 +7258,15 @@ index 7c53347..670e13f 100644 m_decoded_width = 0; m_decoded_height = 0; -@@ -109,7 +108,6 @@ CMMALVideo::CMMALVideo() +@@ -108,7 +107,6 @@ CMMALVideo::CMMALVideo() m_interlace_method = VS_INTERLACEMETHOD_NONE; m_startframe = false; m_decoderPts = DVD_NOPTS_VALUE; - m_droppedPics = 0; - m_decode_frame_number = 1; m_dec = NULL; -@@ -255,7 +253,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf + m_dec_input = NULL; +@@ -259,7 +257,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf { assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_DECODEONLY)); double dts = DVD_NOPTS_VALUE; @@ -9067,7 +7275,7 @@ index 7c53347..670e13f 100644 { CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -276,11 +274,8 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf +@@ -280,11 +278,8 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf } else { @@ -9080,7 +7288,7 @@ index 7c53347..670e13f 100644 } } } -@@ -706,7 +701,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -710,7 +705,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide if (!SendCodecConfigData()) return false; @@ -9088,7 +7296,7 @@ index 7c53347..670e13f 100644 m_startframe = false; m_preroll = !m_hints.stills; m_speed = DVD_PLAYSPEED_NORMAL; -@@ -736,30 +730,8 @@ void CMMALVideo::Dispose() +@@ -740,30 +734,8 @@ void CMMALVideo::Dispose() void CMMALVideo::SetDropState(bool bDrop) { @@ -9121,9 +7329,9 @@ index 7c53347..670e13f 100644 } static unsigned count_bits(int32_t value) -@@ -853,10 +825,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) - buffer->dts = dts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : dts; - buffer->length = demuxer_bytes > buffer->alloc_size ? buffer->alloc_size : demuxer_bytes; +@@ -859,10 +831,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + // set a flag so we can identify primary frames from generated frames (deinterlace) + buffer->flags = MMAL_BUFFER_HEADER_FLAG_USER0; - // Request decode only (maintain ref frames, but don't return a picture) - if (m_drop_state) @@ -9132,9 +7340,9 @@ index 7c53347..670e13f 100644 memcpy(buffer->data, demuxer_content, buffer->length); demuxer_bytes -= buffer->length; demuxer_content += buffer->length; -@@ -880,10 +848,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -885,10 +853,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + { pthread_mutex_lock(&m_output_mutex); - m_decode_frame_number++; m_startframe = true; - if (m_drop_state) - { @@ -9143,7 +7351,7 @@ index 7c53347..670e13f 100644 pthread_mutex_unlock(&m_output_mutex); if (m_changed_count_dec != m_changed_count) { -@@ -979,16 +943,28 @@ void CMMALVideo::Reset(void) +@@ -984,16 +948,28 @@ void CMMALVideo::Reset(void) mmal_port_enable(m_dec_output, dec_output_port_cb_static); } // blow all ready video frames @@ -9177,7 +7385,7 @@ index 7c53347..670e13f 100644 if (!m_finished) SendCodecConfigData(); -@@ -1130,14 +1106,8 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) +@@ -1127,14 +1103,8 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) { @@ -9195,10 +7403,10 @@ index 7c53347..670e13f 100644 void CMMALVideo::SetCodecControl(int flags) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -index a859467..7161f59 100644 +index f5f664a..f79fed5 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -@@ -110,7 +110,6 @@ class CMMALVideo +@@ -109,7 +109,6 @@ class CMMALVideo bool DestroyDeinterlace(); // Video format @@ -9206,62 +7414,19 @@ index a859467..7161f59 100644 int m_decoded_width; int m_decoded_height; unsigned int m_egl_buffer_count; -@@ -140,7 +139,6 @@ class CMMALVideo +@@ -137,7 +136,6 @@ class CMMALVideo + EINTERLACEMETHOD m_interlace_method; bool m_startframe; - unsigned int m_decode_frame_number; double m_decoderPts; - unsigned int m_droppedPics; int m_speed; bool m_preroll; int m_codecControlFlags; -From e533440ab93a6682c978dbdc6a4fb915f1eb216c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 10 Apr 2015 13:24:41 +0100 -Subject: [PATCH 097/103] [mmalrenderer] squash: logging - ---- - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index 82a066b..52eb6b3 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -46,9 +46,8 @@ static void vout_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer - - void CMMALRenderer::vout_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) - { -- CMMALVideoBuffer *omvb = (CMMALVideoBuffer *)buffer->user_data; -- - #if defined(MMAL_DEBUG_VERBOSE) -+ CMMALVideoBuffer *omvb = (CMMALVideoBuffer *)buffer->user_data; - CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p (%p), len %d cmd:%x", CLASSNAME, __func__, port, buffer, omvb, buffer->length, buffer->cmd); - #endif - -@@ -305,7 +304,7 @@ void CMMALRenderer::ReleaseBuffer(int idx) - return; - - #if defined(MMAL_DEBUG_VERBOSE) -- CLog::Log(LOGDEBUG, "%s::%s - %d", CLASSNAME, __func__, idx); -+ CLog::Log(LOGDEBUG, "%s::%s - %d (%p)", CLASSNAME, __func__, idx, m_buffers[idx].MMALBuffer); - #endif - YUVBUFFER &buf = m_buffers[idx]; - SAFE_RELEASE(buf.MMALBuffer); -@@ -314,7 +313,7 @@ void CMMALRenderer::ReleaseBuffer(int idx) - void CMMALRenderer::ReleaseImage(int source, bool preserve) - { - #if defined(MMAL_DEBUG_VERBOSE) -- CLog::Log(LOGDEBUG, "%s::%s - %d %d", CLASSNAME, __func__, source, preserve); -+ CLog::Log(LOGDEBUG, "%s::%s - %d %d (%p)", CLASSNAME, __func__, source, preserve, m_buffers[idx].MMALBuffer); - #endif - } - - -From af78e68c38ce0b9ae50856f54391eac299895a21 Mon Sep 17 00:00:00 2001 +From d0eb9742af9ecf3de62d560d0e5c57de2531486f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 Apr 2015 12:47:04 +0100 -Subject: [PATCH 098/103] [players] Make use of new scheme to submit DTS +Subject: [PATCH 74/89] [players] Make use of new scheme to submit DTS timestamps Latest firmware supports marking timestamps as DTS, @@ -9279,18 +7444,18 @@ timestamps in a single field. 6 files changed, 23 insertions(+), 70 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 670e13f..c5746bb 100644 +index cfe106a..237a581 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -58,7 +58,6 @@ CMMALVideoBuffer::CMMALVideoBuffer(CMMALVideo *omv) - index = 0; +@@ -57,7 +57,6 @@ CMMALVideoBuffer::CMMALVideoBuffer(CMMALVideo *omv) + height = 0; m_aspect_ratio = 0.0f; m_changed_count = 0; - dts = DVD_NOPTS_VALUE; } CMMALVideoBuffer::~CMMALVideoBuffer() -@@ -129,7 +128,6 @@ CMMALVideo::CMMALVideo() +@@ -127,7 +126,6 @@ CMMALVideo::CMMALVideo() m_preroll = true; m_speed = DVD_PLAYSPEED_NORMAL; m_codecControlFlags = 0; @@ -9298,7 +7463,7 @@ index 670e13f..c5746bb 100644 } CMMALVideo::~CMMALVideo() -@@ -252,17 +250,15 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf +@@ -256,17 +254,15 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf if (buffer->length > 0) { assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_DECODEONLY)); @@ -9317,7 +7482,7 @@ index 670e13f..c5746bb 100644 omvb->width = m_decoded_width; omvb->height = m_decoded_height; omvb->m_aspect_ratio = m_aspect_ratio; -@@ -275,7 +271,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf +@@ -279,7 +275,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf else { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -9326,7 +7491,7 @@ index 670e13f..c5746bb 100644 } } } -@@ -633,7 +629,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -637,7 +633,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide 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)); @@ -9339,7 +7504,7 @@ index 670e13f..c5746bb 100644 if (status != MMAL_SUCCESS) CLog::Log(LOGERROR, "%s::%s Failed to enable timestamp fifo mode on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); -@@ -704,8 +704,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -708,8 +708,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide m_startframe = false; m_preroll = !m_hints.stills; m_speed = DVD_PLAYSPEED_NORMAL; @@ -9348,7 +7513,7 @@ index 670e13f..c5746bb 100644 return true; } -@@ -734,14 +732,6 @@ void CMMALVideo::SetDropState(bool bDrop) +@@ -738,14 +736,6 @@ void CMMALVideo::SetDropState(bool bDrop) CLog::Log(LOGDEBUG, "%s::%s - bDrop(%d)", CLASSNAME, __func__, bDrop); } @@ -9363,7 +7528,7 @@ index 670e13f..c5746bb 100644 int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -809,14 +799,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -813,14 +803,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) CLog::Log(LOGERROR, "%s::%s - mmal_queue_get failed", CLASSNAME, __func__); return VC_ERROR; } @@ -9378,15 +7543,15 @@ index 670e13f..c5746bb 100644 mmal_buffer_header_reset(buffer); buffer->cmd = 0; if (!m_startframe && pts == DVD_NOPTS_VALUE) -@@ -974,7 +956,6 @@ void CMMALVideo::Reset(void) - m_decode_frame_number = 1; +@@ -978,7 +960,6 @@ void CMMALVideo::Reset(void) + m_decoderPts = DVD_NOPTS_VALUE; m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); m_codecControlFlags = 0; - m_history_valid_pts = ~0; } void CMMALVideo::SetSpeed(int iSpeed) -@@ -1067,7 +1048,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) +@@ -1064,7 +1045,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) } // timestamp is in microseconds @@ -9396,18 +7561,18 @@ index 670e13f..c5746bb 100644 pDvdVideoPicture->MMALBuffer->Acquire(); diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -index 7161f59..52290b6 100644 +index f79fed5..415f3e3 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -@@ -56,7 +56,6 @@ class CMMALVideoBuffer +@@ -55,7 +55,6 @@ class CMMALVideoBuffer + int width; int height; float m_aspect_ratio; - int index; - double dts; uint32_t m_changed_count; // reference counting CMMALVideoBuffer* Acquire(); -@@ -142,7 +141,6 @@ class CMMALVideo +@@ -139,7 +138,6 @@ class CMMALVideo int m_speed; bool m_preroll; int m_codecControlFlags; @@ -9565,161 +7730,2222 @@ index 3ea02dc..86e94ce 100644 void SetDropState(bool bDrop); std::string GetDecoderName() { return m_video_codec_name; }; -From 7bf14e5742366171b81f30d6ef6f93017903ccdc Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Mon, 13 Apr 2015 18:18:00 +0200 -Subject: [PATCH 099/103] dvdplayer audio: do not consider dropped packets for - sync error +From c5d5f34a04502ef918ad35de044862e4a6e4f843 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 14 Apr 2015 20:51:14 +0100 +Subject: [PATCH 75/89] [gui] Also limit GUI updates when in non full-screen + video mode --- - xbmc/cores/dvdplayer/DVDPlayerAudio.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -index 416e6f8..58761e9 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -@@ -557,7 +557,7 @@ void CDVDPlayerAudio::Process() - if( audioframe.nb_frames == 0 ) - continue; - -- packetadded = true; -+ packetadded = false; - - // we have succesfully decoded an audio frame, setup renderer to match - if (!m_dvdAudio.IsValidFormat(audioframe)) -@@ -607,7 +607,7 @@ void CDVDPlayerAudio::Process() - } - - // signal to our parent that we have initialized -- if(m_started == false && packetadded) -+ if(m_started == false) - { - m_started = true; - m_messageParent.Put(new CDVDMsgInt(CDVDMsg::PLAYER_STARTED, DVDPLAYER_AUDIO)); - -From 5b007c4c0b681703f5a0e4eb170f68be7797cf41 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Mon, 13 Apr 2015 18:18:59 +0200 -Subject: [PATCH 100/103] dvdplayer audio: fix/improve calculation of playing - pts - ---- - xbmc/cores/dvdplayer/DVDAudio.cpp | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDAudio.cpp b/xbmc/cores/dvdplayer/DVDAudio.cpp -index a2b1325..d1601b1 100644 ---- a/xbmc/cores/dvdplayer/DVDAudio.cpp -+++ b/xbmc/cores/dvdplayer/DVDAudio.cpp -@@ -276,5 +276,17 @@ double CDVDAudio::GetPlayingPts() - if (m_playingPts == DVD_NOPTS_VALUE) - return 0.0; - -- return m_playingPts + CDVDClock::GetAbsoluteClock() - m_timeOfPts; -+ double now = CDVDClock::GetAbsoluteClock(); -+ double diff = now - m_timeOfPts; -+ double cache = GetCacheTime(); -+ double played = 0.0; -+ -+ if (diff < cache) -+ played = diff; -+ else -+ played = cache; -+ -+ m_timeOfPts = now; -+ m_playingPts += played; -+ return m_playingPts; - } - -From 19e1a724d89949b78e2153840ce5b9d15d9f4cd6 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Mon, 13 Apr 2015 17:11:47 +0200 -Subject: [PATCH 101/103] Application: Don't slow down videos rendered on - GuiLayer - ---- - xbmc/Application.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + xbmc/Application.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 6e0aeff..059b7de 100644 +index 5889613..9ba0d23 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -2485,7 +2485,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) +@@ -2496,7 +2496,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) #if defined(TARGET_RASPBERRY_PI) || defined(HAS_IMXVPU) // This code reduces rendering fps of the GUI layer when playing videos in fullscreen mode // it makes only sense on architectures with multiple layers -- if (g_graphicsContext.IsFullScreenVideo() && !m_pPlayer->IsPausedPlayback()) -+ if (g_renderManager.IsVideoLayer() && g_graphicsContext.IsFullScreenVideo() && !m_pPlayer->IsPausedPlayback()) +- if (g_graphicsContext.IsFullScreenVideo() && !m_pPlayer->IsPausedPlayback() && g_renderManager.IsVideoLayer()) ++ if (m_pPlayer->IsPlayingVideo() && !m_pPlayer->IsPausedPlayback() && g_renderManager.IsVideoLayer()) fps = CSettings::Get().GetInt("videoplayer.limitguiupdate"); #endif - -From 299175629df95667144a23b8fa7530775a9d6afd Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 10 Apr 2015 13:23:11 +0100 -Subject: [PATCH 102/103] [mmalrenderer] Avoid blank frame on resolution change - ---- - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index 52eb6b3..5164ffb 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -178,6 +178,7 @@ void CMMALRenderer::AddProcessor(CMMALVideoBuffer *buffer, int index) - - bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags, ERenderFormat format, unsigned extended_format, unsigned int orientation) - { -+ bool formatChanged = m_format != format; - ReleaseBuffers(); - - m_sourceWidth = width; -@@ -230,9 +231,10 @@ bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned - else if (CONF_FLAGS_YUVCOEF_MASK(m_iFlags) == CONF_FLAGS_YUVCOEF_240M) - es_format->es->video.color_space = MMAL_COLOR_SPACE_SMPTE240M; +@@ -2509,6 +2509,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) + { + if (!m_skipGuiRender) + g_windowManager.Process(CTimeUtils::GetFrameTime()); ++ else if (!g_graphicsContext.IsFullScreenVideo()) ++ g_renderManager.FrameMove(); } -- if (m_bConfigured) -+ if (m_bConfigured && formatChanged) - UnInitMMAL(); -- m_bConfigured = init_vout(es_format); -+ if (!m_bConfigured) -+ m_bConfigured = init_vout(es_format); - mmal_format_free(es_format); + g_windowManager.FrameMove(); } - else -From 62360236fc8ad14ce64a50ce4e91567d7cb14dbf Mon Sep 17 00:00:00 2001 +From e40d733fa86aa4835daaec2484169c05fe5796c9 Mon Sep 17 00:00:00 2001 From: popcornmix -Date: Wed, 8 Apr 2015 17:04:55 +0100 -Subject: [PATCH 103/103] [mmalcodec] Discard corrupt frames later so we can - still count dropped frames +Date: Wed, 15 Apr 2015 22:57:45 +0100 +Subject: [PATCH 76/89] [mmalcodec] Return mmal buffers explicitly --- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 29 ++++++++++++++-------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 + + 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index c5746bb..5ac12dd 100644 +index 237a581..486dc4b 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -250,7 +250,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - if (buffer->length > 0) - { - assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_DECODEONLY)); -- if (1)//(!(g_advancedSettings.m_omxDecodeStartWithValidFrame && (buffer->flags & MMAL_BUFFER_HEADER_FLAG_CORRUPTED))) -+ if (!(g_advancedSettings.m_omxDecodeStartWithValidFrame && (buffer->flags & MMAL_BUFFER_HEADER_FLAG_CORRUPTED))) +@@ -133,7 +133,6 @@ CMMALVideo::~CMMALVideo() + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); + assert(m_finished); +- Reset(); + + pthread_mutex_destroy(&m_output_mutex); + +@@ -413,7 +412,7 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) + + m_dec_output = m_deint->output[0]; + m_interlace_method = interlace_method; +- ++ Prime(); + return true; + } + +@@ -469,6 +468,7 @@ bool CMMALVideo::DestroyDeinterlace() + + m_dec_output = m_dec->output[0]; + m_interlace_method = VS_INTERLACEMETHOD_NONE; ++ Prime(); + return true; + } + +@@ -705,6 +705,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide + if (!SendCodecConfigData()) + return false; + ++ Prime(); + m_startframe = false; + m_preroll = !m_hints.stills; + m_speed = DVD_PLAYSPEED_NORMAL; +@@ -747,8 +748,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + MMAL_BUFFER_HEADER_T *buffer; + MMAL_STATUS_T status; + +- while (buffer = mmal_queue_get(m_dec_output_pool->queue), buffer) +- Recycle(buffer); + // we need to queue then de-queue the demux packet, seems silly but + // mmal might not have an input buffer available when we are called + // and we must store the demuxer packet and try again later. +@@ -775,9 +774,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + while (1) + { +- while (buffer = mmal_queue_get(m_dec_output_pool->queue), buffer) +- Recycle(buffer); +- + space = mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size; + if (!demuxer_bytes && !m_demux_queue.empty()) + { +@@ -869,8 +865,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + demuxer_content = NULL; + continue; + } +- while (buffer = mmal_queue_get(m_dec_output_pool->queue), buffer) +- Recycle(buffer); + } + } + if (!demuxer_bytes) +@@ -909,6 +903,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + return ret; + } + ++void CMMALVideo::Prime() ++{ ++ MMAL_BUFFER_HEADER_T *buffer; ++ while (buffer = mmal_queue_get(m_dec_output_pool->queue), buffer) ++ Recycle(buffer); ++} ++ + void CMMALVideo::Reset(void) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -954,8 +955,10 @@ void CMMALVideo::Reset(void) + pthread_mutex_unlock(&m_output_mutex); + + if (!m_finished) ++ { + 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); +@@ -975,6 +978,12 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, buffer); + ++ if (m_finished) ++ { ++ mmal_buffer_header_release(buffer); ++ return; ++ } ++ + MMAL_STATUS_T status; + mmal_buffer_header_reset(buffer); + buffer->cmd = 0; +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index 415f3e3..011ae04 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -106,6 +106,7 @@ class CMMALVideo + void QueryCodec(void); + bool CreateDeinterlace(EINTERLACEMETHOD interlace_method); + bool DestroyDeinterlace(); ++ void Prime(); + + // Video format + int m_decoded_width; + +From 444b6fc43e09650a22ac1ef9d6fe4c62fffaff19 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 15 Apr 2015 23:26:47 +0100 +Subject: [PATCH 77/89] [mmalcodec] Handle resolution change from callback + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 26 +++++----------------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 3 --- + 2 files changed, 6 insertions(+), 23 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 486dc4b..39d6e60 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -56,7 +56,6 @@ CMMALVideoBuffer::CMMALVideoBuffer(CMMALVideo *omv) + width = 0; + height = 0; + m_aspect_ratio = 0.0f; +- m_changed_count = 0; + } + + CMMALVideoBuffer::~CMMALVideoBuffer() +@@ -118,8 +117,6 @@ CMMALVideo::CMMALVideo() + + m_codingType = 0; + +- m_changed_count = 0; +- m_changed_count_dec = 0; + m_output_busy = 0; + m_demux_queue_length = 0; + m_es_format = mmal_format_alloc(); +@@ -183,7 +180,6 @@ void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *bu + { + MMAL_EVENT_FORMAT_CHANGED_T *fmt = mmal_event_format_changed_get(buffer); + mmal_format_copy(m_es_format, fmt->format); +- m_changed_count++; + + if (m_es_format->es->video.crop.width && m_es_format->es->video.crop.height) + { +@@ -192,10 +188,13 @@ void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *bu + m_decoded_width = m_es_format->es->video.crop.width; + m_decoded_height = m_es_format->es->video.crop.height; + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s format changed: %dx%d %.2f frame:%d", CLASSNAME, __func__, m_decoded_width, m_decoded_height, m_aspect_ratio, m_changed_count); ++ CLog::Log(LOGDEBUG, "%s::%s format changed: %dx%d %.2f", CLASSNAME, __func__, m_decoded_width, m_decoded_height, m_aspect_ratio); + } + else + CLog::Log(LOGERROR, "%s::%s format changed: Unexpected %dx%d", CLASSNAME, __func__, m_es_format->es->video.crop.width, m_es_format->es->video.crop.height); ++ ++ if (!change_dec_output_format()) ++ CLog::Log(LOGERROR, "%s::%s - change_dec_output_format() failed", CLASSNAME, __func__); + } + + void CMMALVideo::dec_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) +@@ -257,11 +256,10 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf { CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -620,7 +620,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +- CLog::Log(LOGDEBUG, "%s::%s - %p (%p) buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x frame:%d", +- CLASSNAME, __func__, buffer, omvb, buffer->length, buffer->dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags, omvb->m_changed_count); ++ CLog::Log(LOGDEBUG, "%s::%s - %p (%p) buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x", ++ CLASSNAME, __func__, buffer, omvb, buffer->length, buffer->dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags); + omvb->mmal_buffer = buffer; + buffer->user_data = (void *)omvb; +- omvb->m_changed_count = m_changed_count; + omvb->width = m_decoded_width; + omvb->height = m_decoded_height; + omvb->m_aspect_ratio = m_aspect_ratio; +@@ -313,7 +311,6 @@ bool CMMALVideo::change_dec_output_format() + else + CLog::Log(LOGERROR, "%s::%s Failed to query interlace type on %s (status=%x %s)", CLASSNAME, __func__, m_dec_output->name, status, mmal_status_to_string(status)); - error_concealment.hdr.id = MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT; - error_concealment.hdr.size = sizeof(MMAL_PARAMETER_BOOLEAN_T); -- error_concealment.enable = g_advancedSettings.m_omxDecodeStartWithValidFrame; -+ error_concealment.enable = false; - status = mmal_port_parameter_set(m_dec_input, &error_concealment.hdr); +- // todo: if we don't disable/enable we can do this from callback + mmal_format_copy(m_dec_output->format, m_es_format); + status = mmal_port_format_commit(m_dec_output); if (status != MMAL_SUCCESS) - CLog::Log(LOGERROR, "%s::%s Failed to disable error concealment on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); +@@ -832,17 +829,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + pthread_mutex_lock(&m_output_mutex); + m_startframe = true; + pthread_mutex_unlock(&m_output_mutex); +- if (m_changed_count_dec != m_changed_count) +- { +- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s format changed frame:%d(%d)", CLASSNAME, __func__, m_changed_count_dec, m_changed_count); +- m_changed_count_dec = m_changed_count; +- if (!change_dec_output_format()) +- { +- CLog::Log(LOGERROR, "%s::%s - change_dec_output_format() failed", CLASSNAME, __func__); +- return VC_ERROR; +- } +- } + EDEINTERLACEMODE deinterlace_request = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; + EINTERLACEMETHOD interlace_method = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index 011ae04..fcc6a15 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -55,7 +55,6 @@ class CMMALVideoBuffer + int width; + int height; + float m_aspect_ratio; +- uint32_t m_changed_count; + // reference counting + CMMALVideoBuffer* Acquire(); + long Release(); +@@ -99,8 +98,6 @@ class CMMALVideo + void dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); + void dec_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); + void dec_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); +- uint32_t m_changed_count; +- uint32_t m_changed_count_dec; + + protected: + void QueryCodec(void); + +From 3e33a9a5a6874b992bed68821b8d779380a13f14 Mon Sep 17 00:00:00 2001 +From: Rainer Hochecker +Date: Fri, 17 Apr 2015 20:18:40 +0200 +Subject: [PATCH 78/89] dvdplayer: reduce time for initial audio sync + +--- + xbmc/cores/dvdplayer/DVDPlayerAudio.cpp | 6 +++--- + xbmc/cores/dvdplayer/DVDPlayerAudio.h | 4 ++-- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp +index bd357aa..ebf4d93 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp +@@ -676,7 +676,7 @@ void CDVDPlayerAudio::HandleSyncError(double duration) + // error because drop/dupe changes the value + if (m_syncclock && fabs(error) > threshold1) + { +- m_errors.Flush(500); ++ m_errors.Flush(); + m_integral = 0.0; + m_resampleratio = 0.0; + return; +@@ -693,13 +693,13 @@ void CDVDPlayerAudio::HandleSyncError(double duration) + // 500ms in order to get first resample ratio early. If we don't adjust rr early, error + // may get above threshold1 again. Too small values for interval result in worse average errors + +- if (!m_errors.Get(m_error, m_syncclock ? 500 : 2000)) ++ if (!m_errors.Get(m_error, m_syncclock ? 100 : 2000)) + return; + + if (fabs(m_error) > threshold1) + { + m_syncclock = true; +- m_errors.Flush(500); ++ m_errors.Flush(100); + m_integral = 0.0; + m_resampleratio = 0.0; + CLog::Log(LOGDEBUG,"CDVDPlayerAudio::HandleSyncError - average error %f above threshold of %f", +diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.h b/xbmc/cores/dvdplayer/DVDPlayerAudio.h +index 635c184..bf51863 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayerAudio.h ++++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.h +@@ -69,7 +69,7 @@ class CDVDErrorAverage + m_count++; + } + +- void Flush(int interval = 500) ++ void Flush(int interval = 100) + { + m_buffer = 0.0f; + m_count = 0; +@@ -84,7 +84,7 @@ class CDVDErrorAverage + return 0.0; + } + +- bool Get(double& error, int interval = 500) ++ bool Get(double& error, int interval = 100) + { + if(m_timer.IsTimePast()) + { + +From 9a35c9bd5494c4b9a39339fe5c9205f8f2890a9b Mon Sep 17 00:00:00 2001 +From: Rainer Hochecker +Date: Fri, 3 Apr 2015 10:49:55 +0200 +Subject: [PATCH 79/89] dvdplayer: cosmetics + +--- + xbmc/cores/dvdplayer/DVDPlayer.cpp | 41 ++++++++++++++++++++------------------ + 1 file changed, 22 insertions(+), 19 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp +index 8ceb498..1f220c6 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp +@@ -1454,16 +1454,18 @@ void CDVDPlayer::Process() + + m_OmxPlayerState.bOmxSentEOFs = true; + } ++ + if(m_CurrentAudio.inited) +- m_dvdPlayerAudio->SendMessage (new CDVDMsg(CDVDMsg::GENERAL_EOF)); ++ m_dvdPlayerAudio->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); + if(m_CurrentVideo.inited) +- m_dvdPlayerVideo->SendMessage (new CDVDMsg(CDVDMsg::GENERAL_EOF)); ++ m_dvdPlayerVideo->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); + if(m_CurrentSubtitle.inited) + m_dvdPlayerSubtitle->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); + if(m_CurrentTeletext.inited) + m_dvdPlayerTeletext->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); +- m_CurrentAudio.inited = false; +- m_CurrentVideo.inited = false; ++ ++ m_CurrentAudio.inited = false; ++ m_CurrentVideo.inited = false; + m_CurrentSubtitle.inited = false; + m_CurrentTeletext.inited = false; + +@@ -1573,21 +1575,22 @@ bool CDVDPlayer::CheckIsCurrent(CCurrentStream& current, CDemuxStream* stream, D + + void CDVDPlayer::ProcessPacket(CDemuxStream* pStream, DemuxPacket* pPacket) + { +- /* process packet if it belongs to selected stream. for dvd's don't allow automatic opening of streams*/ +- +- if (CheckIsCurrent(m_CurrentAudio, pStream, pPacket)) +- ProcessAudioData(pStream, pPacket); +- else if (CheckIsCurrent(m_CurrentVideo, pStream, pPacket)) +- ProcessVideoData(pStream, pPacket); +- else if (CheckIsCurrent(m_CurrentSubtitle, pStream, pPacket)) +- ProcessSubData(pStream, pPacket); +- else if (CheckIsCurrent(m_CurrentTeletext, pStream, pPacket)) +- ProcessTeletextData(pStream, pPacket); +- else +- { +- pStream->SetDiscard(AVDISCARD_ALL); +- CDVDDemuxUtils::FreeDemuxPacket(pPacket); // free it since we won't do anything with it +- } ++ // process packet if it belongs to selected stream. ++ // for dvd's don't allow automatic opening of streams*/ ++ ++ if (CheckIsCurrent(m_CurrentAudio, pStream, pPacket)) ++ ProcessAudioData(pStream, pPacket); ++ else if (CheckIsCurrent(m_CurrentVideo, pStream, pPacket)) ++ ProcessVideoData(pStream, pPacket); ++ else if (CheckIsCurrent(m_CurrentSubtitle, pStream, pPacket)) ++ ProcessSubData(pStream, pPacket); ++ else if (CheckIsCurrent(m_CurrentTeletext, pStream, pPacket)) ++ ProcessTeletextData(pStream, pPacket); ++ else ++ { ++ pStream->SetDiscard(AVDISCARD_ALL); ++ CDVDDemuxUtils::FreeDemuxPacket(pPacket); // free it since we won't do anything with it ++ } + } + + void CDVDPlayer::CheckStreamChanges(CCurrentStream& current, CDemuxStream* stream) + +From 7c8937a10c0441e815ec4743dfc38b22c6f38d09 Mon Sep 17 00:00:00 2001 +From: Rainer Hochecker +Date: Fri, 3 Apr 2015 14:03:44 +0200 +Subject: [PATCH 80/89] dvdplayer/omxplayer: protect live streams (pvr) from + stalling + +--- + xbmc/cores/VideoRenderers/RenderManager.cpp | 9 +++++ + xbmc/cores/dvdplayer/DVDClock.cpp | 53 +++++++++++++++-------------- + xbmc/cores/dvdplayer/DVDClock.h | 10 ++++-- + xbmc/cores/dvdplayer/DVDPlayer.cpp | 30 ++++++++++++++++ + xbmc/cores/dvdplayer/DVDPlayer.h | 1 + + xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 5 +-- + xbmc/linux/OMXClock.cpp | 20 ++++++++++- + xbmc/linux/OMXClock.h | 2 ++ + xbmc/video/VideoReferenceClock.cpp | 8 +++++ + xbmc/video/VideoReferenceClock.h | 1 + + 10 files changed, 106 insertions(+), 33 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp +index 25323ef..25d3809 100644 +--- a/xbmc/cores/VideoRenderers/RenderManager.cpp ++++ b/xbmc/cores/VideoRenderers/RenderManager.cpp +@@ -175,6 +175,15 @@ void CXBMCRenderManager::WaitPresentTime(double presenttime) + return; + } + ++ CDVDClock *dvdclock = CDVDClock::GetMasterClock(); ++ if(dvdclock != NULL && dvdclock->GetSpeedAdjust() != 0.0) ++ { ++ CDVDClock::WaitAbsoluteClock(presenttime * DVD_TIME_BASE); ++ m_presenterr = 0; ++ m_presentcorr = 0; ++ return; ++ } ++ + double clock = CDVDClock::WaitAbsoluteClock(presenttime * DVD_TIME_BASE) / DVD_TIME_BASE; + double target = 0.5; + double error = ( clock - presenttime ) / frametime - target; +diff --git a/xbmc/cores/dvdplayer/DVDClock.cpp b/xbmc/cores/dvdplayer/DVDClock.cpp +index a496ec0..2629530 100644 +--- a/xbmc/cores/dvdplayer/DVDClock.cpp ++++ b/xbmc/cores/dvdplayer/DVDClock.cpp +@@ -29,7 +29,7 @@ + int64_t CDVDClock::m_systemOffset; + int64_t CDVDClock::m_systemFrequency; + CCriticalSection CDVDClock::m_systemsection; +-CDVDClock *CDVDClock::m_playerclock = NULL;; ++CDVDClock *CDVDClock::m_playerclock = NULL; + + CDVDClock::CDVDClock() + : m_master(MASTER_CLOCK_NONE) +@@ -42,6 +42,9 @@ CDVDClock::CDVDClock() + m_bReset = true; + m_iDisc = 0; + m_maxspeedadjust = 0.0; ++ m_lastSystemTime = g_VideoReferenceClock.GetTime(); ++ m_systemAdjust = 0; ++ m_speedAdjust = 0; + + m_startClock = 0; + +@@ -103,7 +106,12 @@ CDVDClock* CDVDClock::GetMasterClock() + double CDVDClock::GetClock(bool interpolated /*= true*/) + { + CSharedLock lock(m_critSection); +- return SystemToPlaying(g_VideoReferenceClock.GetTime(interpolated)); ++ ++ int64_t current = g_VideoReferenceClock.GetTime(interpolated); ++ m_systemAdjust += m_speedAdjust * (current - m_lastSystemTime); ++ m_lastSystemTime = current; ++ ++ return SystemToPlaying(current); + } + + double CDVDClock::GetClock(double& absolute, bool interpolated /*= true*/) +@@ -115,8 +123,7 @@ double CDVDClock::GetClock(double& absolute, bool interpolated /*= true*/) + absolute = SystemToAbsolute(current); + } + +- CSharedLock lock(m_critSection); +- return SystemToPlaying(current); ++ return GetClock(interpolated); + } + + void CDVDClock::SetSpeed(int iSpeed) +@@ -145,6 +152,18 @@ void CDVDClock::SetSpeed(int iSpeed) + m_systemUsed = newfreq; + } + ++void CDVDClock::SetSpeedAdjust(double adjust) ++{ ++ CExclusiveLock lock(m_critSection); ++ m_speedAdjust = adjust; ++} ++ ++double CDVDClock::GetSpeedAdjust() ++{ ++ CExclusiveLock lock(m_critSection); ++ return m_speedAdjust; ++} ++ + bool CDVDClock::Update(double clock, double absolute, double limit, const char* log) + { + CExclusiveLock lock(m_critSection); +@@ -174,26 +193,8 @@ void CDVDClock::Discontinuity(double clock, double absolute) + m_pauseClock = m_startClock; + m_iDisc = clock; + m_bReset = false; +-} +- +-void CDVDClock::Pause() +-{ +- CExclusiveLock lock(m_critSection); +- if(!m_pauseClock) +- m_pauseClock = g_VideoReferenceClock.GetTime(); +-} +- +-void CDVDClock::Resume() +-{ +- CExclusiveLock lock(m_critSection); +- if( m_pauseClock ) +- { +- int64_t current; +- current = g_VideoReferenceClock.GetTime(); +- +- m_startClock += current - m_pauseClock; +- m_pauseClock = 0; +- } ++ m_systemAdjust = 0; ++ m_speedAdjust = 0; + } + + void CDVDClock::SetMaxSpeedAdjust(double speed) +@@ -265,6 +266,8 @@ double CDVDClock::SystemToPlaying(int64_t system) + if(m_pauseClock) + m_pauseClock = m_startClock; + m_iDisc = 0; ++ m_systemAdjust = 0; ++ m_speedAdjust = 0; + m_bReset = false; + } + +@@ -273,7 +276,7 @@ double CDVDClock::SystemToPlaying(int64_t system) + else + current = system; + +- return DVD_TIME_BASE * (double)(current - m_startClock) / m_systemUsed + m_iDisc; ++ return DVD_TIME_BASE * (double)(current - m_startClock + m_systemAdjust) / m_systemUsed + m_iDisc; + } + + EMasterClock CDVDClock::GetMaster() +diff --git a/xbmc/cores/dvdplayer/DVDClock.h b/xbmc/cores/dvdplayer/DVDClock.h +index d6b2d0a..cf03af5 100644 +--- a/xbmc/cores/dvdplayer/DVDClock.h ++++ b/xbmc/cores/dvdplayer/DVDClock.h +@@ -66,9 +66,9 @@ class CDVDClock + } + + void Reset() { m_bReset = true; } +- void Pause(); +- void Resume(); + void SetSpeed(int iSpeed); ++ void SetSpeedAdjust(double adjust); ++ double GetSpeedAdjust(); + + double GetClockSpeed(); /**< get the current speed of the clock relative normal system time */ + +@@ -101,7 +101,11 @@ class CDVDClock + static int64_t m_systemOffset; + static CCriticalSection m_systemsection; + +- double m_maxspeedadjust; ++ int64_t m_systemAdjust; ++ int64_t m_lastSystemTime; ++ double m_speedAdjust; ++ ++ double m_maxspeedadjust; + CCriticalSection m_speedsection; + static CDVDClock *m_playerclock; + }; +diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp +index 1f220c6..4db38e2 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp +@@ -1841,6 +1841,7 @@ void CDVDPlayer::HandlePlaySpeed() + if(m_caching != caching) + SetCaching(caching); + ++ // check buffering levels and adjust clock + if (m_playSpeed == DVD_PLAYSPEED_NORMAL && m_caching == CACHESTATE_DONE) + { + // due to i.e. discontinuities of pts the stream may have drifted away +@@ -1851,6 +1852,31 @@ void CDVDPlayer::HandlePlaySpeed() + CLog::Log(LOGDEBUG,"CDVDPlayer::HandlePlaySpeed - audio stream stalled, tiggering re-sync"); + TriggerResync(); + } ++ ++ if (CachePVRStream()) ++ { ++ if (m_CurrentAudio.id >= 0) ++ { ++ double adjust = -1.0; // a unique value ++ if (m_clock.GetSpeedAdjust() == 0.0 && m_dvdPlayerAudio->GetLevel() < 5) ++ adjust = -0.01; ++ else if (m_clock.GetSpeedAdjust() == 0.0 && m_dvdPlayerAudio->GetLevel() > 95) ++ adjust = 0.01; ++ ++ if (m_clock.GetSpeedAdjust() < 0 && m_dvdPlayerAudio->GetLevel() > 20) ++ adjust = 0.0; ++ else if (m_clock.GetSpeedAdjust() > 0 && m_dvdPlayerAudio->GetLevel() < 80) ++ adjust = 0.0; ++ ++ if (adjust != -1.0) ++ { ++ m_clock.SetSpeedAdjust(adjust); ++ if (m_omxplayer_mode) ++ m_OmxPlayerState.av_clock.OMXSetSpeedAdjust(adjust); ++ CLog::Log(LOGDEBUG, "CDVDPlayer::HandlePlaySpeed set clock adjust: %f", adjust); ++ } ++ } ++ } + } + + if(GetPlaySpeed() != DVD_PLAYSPEED_NORMAL && GetPlaySpeed() != DVD_PLAYSPEED_PAUSE) +@@ -2762,6 +2788,10 @@ void CDVDPlayer::SetCaching(ECacheState state) + m_pInputStream->ResetScanTimeout(0); + } + m_caching = state; ++ ++ m_clock.SetSpeedAdjust(0); ++ if (m_omxplayer_mode) ++ m_OmxPlayerState.av_clock.OMXSetSpeedAdjust(0); + } + + void CDVDPlayer::SetPlaySpeed(int speed) +diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h +index 3b8cefb..3dbb809 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayer.h ++++ b/xbmc/cores/dvdplayer/DVDPlayer.h +@@ -68,6 +68,7 @@ class OMXClock + bool OMXStateExecute(bool lock = true) { return false; } + void OMXStateIdle(bool lock = true) {} + bool HDMIClockSync(bool lock = true) { return false; } ++ void OMXSetSpeedAdjust(double adjust, bool lock = true) {} + }; + #endif + +diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +index 5832c58..f5e6de9 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +@@ -201,10 +201,7 @@ bool CDVDPlayerVideo::OpenStream( CDVDStreamInfo &hint ) + return false; + } + +- if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") && !g_VideoReferenceClock.IsRunning()) +- { +- g_VideoReferenceClock.Create(); +- } ++ g_VideoReferenceClock.Start(); + + if(m_messageQueue.IsInited()) + m_messageQueue.Put(new CDVDMsgVideoCodecChange(hint, codec), 0); +diff --git a/xbmc/linux/OMXClock.cpp b/xbmc/linux/OMXClock.cpp +index 46df52e..4f094df 100644 +--- a/xbmc/linux/OMXClock.cpp ++++ b/xbmc/linux/OMXClock.cpp +@@ -45,6 +45,7 @@ OMXClock::OMXClock() + m_clock = NULL; + m_last_media_time = 0.0f; + m_last_media_time_read = 0.0f; ++ m_speedAdjust = 0; + + pthread_mutex_init(&m_lock, NULL); + } +@@ -477,7 +478,7 @@ bool OMXClock::OMXSetSpeed(int speed, bool lock /* = true */, bool pause_resume + if(lock) + Lock(); + +- CLog::Log(LOGDEBUG, "OMXClock::OMXSetSpeed(%.2f) pause_resume:%d", (float)speed / (float)DVD_PLAYSPEED_NORMAL, pause_resume); ++ CLog::Log(LOGDEBUG, "OMXClock::OMXSetSpeed(%.3f) pause_resume:%d", (float)speed / (float)DVD_PLAYSPEED_NORMAL * (1.0 + m_speedAdjust), pause_resume); + + if (pause_resume) + { +@@ -485,6 +486,8 @@ bool OMXClock::OMXSetSpeed(int speed, bool lock /* = true */, bool pause_resume + OMX_INIT_STRUCTURE(scaleType); + + scaleType.xScale = (speed << 16) / DVD_PLAYSPEED_NORMAL; ++ scaleType.xScale += scaleType.xScale * m_speedAdjust; ++ + OMX_ERRORTYPE omx_err = m_omx_clock.SetConfig(OMX_IndexConfigTimeScale, &scaleType); + if(omx_err != OMX_ErrorNone) + { +@@ -504,6 +507,21 @@ bool OMXClock::OMXSetSpeed(int speed, bool lock /* = true */, bool pause_resume + return true; + } + ++void OMXClock::OMXSetSpeedAdjust(double adjust, bool lock /* = true */) ++{ ++ if(lock) ++ Lock(); ++ // we only support resampling (and hence clock adjustment) in this mode ++ if (CSettings::Get().GetBool("videoplayer.usedisplayasclock")) ++ { ++ m_speedAdjust = adjust; ++ OMXSetSpeed(m_omx_speed, false, true); ++ m_last_media_time = 0.0f; ++ } ++ if(lock) ++ UnLock(); ++} ++ + bool OMXClock::OMXFlush(bool lock) + { + if(m_omx_clock.GetComponent() == NULL) +diff --git a/xbmc/linux/OMXClock.h b/xbmc/linux/OMXClock.h +index 8f06134..df0d4cf 100644 +--- a/xbmc/linux/OMXClock.h ++++ b/xbmc/linux/OMXClock.h +@@ -59,6 +59,7 @@ class OMXClock + COMXCoreComponent m_omx_clock; + double m_last_media_time; + double m_last_media_time_read; ++ double m_speedAdjust; + public: + OMXClock(); + ~OMXClock(); +@@ -82,6 +83,7 @@ class OMXClock + bool OMXPause(bool lock = true); + bool OMXResume(bool lock = true); + bool OMXSetSpeed(int speed, bool lock = true, bool pause_resume = false); ++ void OMXSetSpeedAdjust(double adjust, bool lock = true); + int OMXPlaySpeed() { return m_omx_speed; }; + bool OMXFlush(bool lock = true); + COMXCoreComponent *GetOMXClock(); +diff --git a/xbmc/video/VideoReferenceClock.cpp b/xbmc/video/VideoReferenceClock.cpp +index f97e0bf..a363c36 100644 +--- a/xbmc/video/VideoReferenceClock.cpp ++++ b/xbmc/video/VideoReferenceClock.cpp +@@ -28,6 +28,7 @@ + #include "guilib/GraphicContext.h" + #include "video/videosync/VideoSync.h" + #include "windowing/WindowingFactory.h" ++#include "settings/Settings.h" + + #if defined(HAS_GLX) + #include "video/videosync/VideoSyncGLX.h" +@@ -72,6 +73,13 @@ CVideoReferenceClock::~CVideoReferenceClock() + { + } + ++void CVideoReferenceClock::Start() ++{ ++ CSingleExit lock(g_graphicsContext); ++ if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") && !IsRunning()) ++ Create(); ++} ++ + void CVideoReferenceClock::Stop() + { + CSingleExit lock(g_graphicsContext); +diff --git a/xbmc/video/VideoReferenceClock.h b/xbmc/video/VideoReferenceClock.h +index 937b53e..d0a9c3f 100644 +--- a/xbmc/video/VideoReferenceClock.h ++++ b/xbmc/video/VideoReferenceClock.h +@@ -39,6 +39,7 @@ class CVideoReferenceClock : public CThread + bool GetClockInfo(int& MissedVblanks, double& ClockSpeed, double& RefreshRate); + void SetFineAdjust(double fineadjust); + void RefreshChanged(); ++ void Start(); + void Stop(); + + private: + +From 1026004dc183fad879d872223a263c5f36aa1056 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 14 Apr 2015 17:51:27 +0100 +Subject: [PATCH 81/89] Avoid double rate deinterlace when not fullscreen or + with OSD + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index c30de9c..998d3d5 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -32,6 +32,7 @@ + #include "windowing/WindowingFactory.h" + #include "cores/dvdplayer/DVDCodecs/Video/MMALCodec.h" + #include "xbmc/Application.h" ++#include "guilib/GUIWindowManager.h" + + #define CLASSNAME "CMMALRenderer" + +@@ -551,7 +552,10 @@ bool CMMALRenderer::Supports(ESCALINGMETHOD method) + + EINTERLACEMETHOD CMMALRenderer::AutoInterlaceMethod() + { +- return VS_INTERLACEMETHOD_MMAL_ADVANCED; ++ if (!g_graphicsContext.IsFullScreenVideo() || g_windowManager.HasDialogOnScreen()) ++ return VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF; ++ else ++ return VS_INTERLACEMETHOD_MMAL_ADVANCED; + } + + void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect) + +From 76b915c21c082ea4a827a3b5d1e7279ff7fba60b Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 16 Apr 2015 17:27:27 +0100 +Subject: [PATCH 82/89] Enable zero copy + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 6 ++++++ + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 18 ++++++++++++++++-- + 2 files changed, 22 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 998d3d5..3eb4060 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -133,6 +133,12 @@ bool CMMALRenderer::init_vout(ERenderFormat format) + es_format->es->video.color_space = MMAL_COLOR_SPACE_SMPTE240M; + } + ++ if (m_format == RENDER_FMT_MMAL) ++ { ++ status = mmal_port_parameter_set_boolean(m_vout_input, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); ++ if (status != MMAL_SUCCESS) ++ CLog::Log(LOGERROR, "%s::%s Failed to enable zero copy mode on %s (status=%x %s)", CLASSNAME, __func__, m_vout_input->name, status, mmal_status_to_string(status)); ++ } + status = mmal_port_format_commit(m_vout_input); + if (status != MMAL_SUCCESS) + { +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 39d6e60..1ab5254 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -312,6 +312,11 @@ bool CMMALVideo::change_dec_output_format() + CLog::Log(LOGERROR, "%s::%s Failed to query interlace type on %s (status=%x %s)", CLASSNAME, __func__, m_dec_output->name, status, mmal_status_to_string(status)); + + mmal_format_copy(m_dec_output->format, m_es_format); ++ ++ status = mmal_port_parameter_set_boolean(m_dec_output, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); ++ if (status != MMAL_SUCCESS) ++ CLog::Log(LOGERROR, "%s::%s Failed to enable zero copy mode on %s (status=%x %s)", CLASSNAME, __func__, m_dec_output->name, status, mmal_status_to_string(status)); ++ + status = mmal_port_format_commit(m_dec_output); + if (status != MMAL_SUCCESS) + { +@@ -383,6 +388,11 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) + } + + mmal_format_copy(m_deint->output[0]->format, m_es_format); ++ ++ status = mmal_port_parameter_set_boolean(m_deint->output[0], MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); ++ if (status != MMAL_SUCCESS) ++ CLog::Log(LOGERROR, "%s::%s Failed to enable zero copy mode on %s (status=%x %s)", CLASSNAME, __func__, m_deint->output[0]->name, status, mmal_status_to_string(status)); ++ + status = mmal_port_format_commit(m_deint->output[0]); + if (status != MMAL_SUCCESS) + { +@@ -661,6 +671,10 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide + m_dec_output->format->encoding = MMAL_ENCODING_OPAQUE; + mmal_format_copy(m_es_format, m_dec_output->format); + ++ status = mmal_port_parameter_set_boolean(m_dec_output, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); ++ if (status != MMAL_SUCCESS) ++ CLog::Log(LOGERROR, "%s::%s Failed to enable zero copy mode on %s (status=%x %s)", CLASSNAME, __func__, m_dec_output->name, status, mmal_status_to_string(status)); ++ + status = mmal_port_format_commit(m_dec_output); + if (status != MMAL_SUCCESS) + { +@@ -685,14 +699,14 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide + return false; + } + +- m_dec_input_pool = mmal_pool_create(m_dec_input->buffer_num, m_dec_input->buffer_size); ++ m_dec_input_pool = mmal_port_pool_create(m_dec_input, m_dec_input->buffer_num, m_dec_input->buffer_size); + if (!m_dec_input_pool) + { + CLog::Log(LOGERROR, "%s::%s Failed to create pool for decoder input port (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status)); + return false; + } + +- m_dec_output_pool = mmal_pool_create(m_dec_output->buffer_num, m_dec_output->buffer_size); ++ m_dec_output_pool = mmal_port_pool_create(m_dec_output, m_dec_output->buffer_num, m_dec_output->buffer_size); + if(!m_dec_output_pool) + { + CLog::Log(LOGERROR, "%s::%s Failed to create pool for decode output port (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status)); + +From 332c505cf424b7356a31aa5b2d44652377f4e490 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 16 Apr 2015 19:09:31 +0100 +Subject: [PATCH 83/89] flags debug + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 11 ++++++----- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 ++ + 2 files changed, 8 insertions(+), 5 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 3eb4060..fa65c2b 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -49,12 +49,13 @@ void CMMALRenderer::vout_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T * + { + #if defined(MMAL_DEBUG_VERBOSE) + CMMALVideoBuffer *omvb = (CMMALVideoBuffer *)buffer->user_data; +- CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p (%p), len %d cmd:%x", CLASSNAME, __func__, port, buffer, omvb, buffer->length, buffer->cmd); ++ CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p (%p), len %d cmd:%x f:%x", CLASSNAME, __func__, port, buffer, omvb, buffer->length, buffer->cmd, buffer->flags); + #endif + ++ assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED)); ++ buffer->flags &= ~MMAL_BUFFER_HEADER_FLAG_USER2; + if (m_format == RENDER_FMT_MMAL) + { +- buffer->flags &= ~MMAL_BUFFER_HEADER_FLAG_USER2; + mmal_queue_put(m_release_queue, buffer); + } + else if (m_format == RENDER_FMT_YUV420P) +@@ -377,7 +378,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + if (omvb) + { + #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s %p (%p)", CLASSNAME, __func__, omvb, omvb->mmal_buffer); ++ CLog::Log(LOGDEBUG, "%s::%s %p (%p) f:%x", CLASSNAME, __func__, omvb, omvb->mmal_buffer, omvb->mmal_buffer->flags); + #endif + // we only want to upload frames once + if (omvb->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) +@@ -391,14 +392,14 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + } + else if (m_format == RENDER_FMT_YUV420P) + { +- CLog::Log(LOGDEBUG, "%s::%s - %p %d", CLASSNAME, __func__, buffer->mmal_buffer, source); ++ CLog::Log(LOGDEBUG, "%s::%s - %p %d f:%x", CLASSNAME, __func__, buffer->mmal_buffer, source, buffer->mmal_buffer->flags); + if (buffer->mmal_buffer) + { + // we only want to upload frames once + if (buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) + return; + // sanity check it is not on display +- buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1; ++ buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; + mmal_port_send_buffer(m_vout_input, buffer->mmal_buffer); + } + else +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 1ab5254..61cf8e2 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -83,6 +83,7 @@ long CMMALVideoBuffer::Release() + { + m_omv->ReleaseBuffer(this); + } ++ else assert(count > 0); + return count; + } + +@@ -247,6 +248,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf + + bool kept = false; + ++ assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED)); + if (buffer->cmd == 0) + { + if (buffer->length > 0) + +From 1757168ee2f38cb7e56b27f9d8a4a8f180ed68b1 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 16 Apr 2015 18:18:14 +0100 +Subject: [PATCH 84/89] Move the image pool from decoder to renderer + +--- + xbmc/cores/VideoRenderers/BaseRenderer.h | 5 ++ + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 77 ++++++++++++++++++---- + xbmc/cores/VideoRenderers/MMALRenderer.h | 4 ++ + xbmc/cores/VideoRenderers/RenderManager.cpp | 8 +++ + xbmc/cores/VideoRenderers/RenderManager.h | 5 ++ + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 30 ++------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 2 - + 7 files changed, 91 insertions(+), 40 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/BaseRenderer.h b/xbmc/cores/VideoRenderers/BaseRenderer.h +index 389695a..264f0ad 100644 +--- a/xbmc/cores/VideoRenderers/BaseRenderer.h ++++ b/xbmc/cores/VideoRenderers/BaseRenderer.h +@@ -112,6 +112,11 @@ class CBaseRenderer + + static void SettingOptionsRenderMethodsFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t, void *data); + ++ /** ++ * Magic api for communicating between codec and renderer ++ */ ++ virtual void *PassCookie(void *cookie) { return NULL; } ++ + protected: + void ChooseBestResolution(float fps); + bool FindResolutionFromOverride(float fps, float& weight, bool fallback); +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index fa65c2b..5fbe2d2 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -40,6 +40,50 @@ + #define MMAL_DEBUG_VERBOSE + #endif + ++ ++ ++void CMMALRenderer::Prime() ++{ ++ #if defined(MMAL_DEBUG_VERBOSE) ++ CLog::Log(LOGDEBUG, "%s::%s format:%d dec:%p pool:%p", CLASSNAME, __func__, m_format, m_mmal_video, m_vout_input_pool); ++ #endif ++ ++ if (m_format != RENDER_FMT_MMAL || !m_vout_input_pool) ++ return; ++ ++ MMAL_BUFFER_HEADER_T *buffer; ++ while (buffer = mmal_queue_get(m_vout_input_pool->queue), buffer) ++ { ++ CLog::Log(LOGDEBUG, "%s::%s buffer:%p mmal_video:%p", CLASSNAME, __func__, buffer, m_mmal_video); ++ if (m_mmal_video) ++ { ++ m_mmal_video->Recycle(buffer); ++ } ++ else ++ { ++ mmal_buffer_header_release(buffer); ++ break; ++ } ++ } ++} ++ ++void *CMMALRenderer::PassCookie(void *cookie) ++{ ++ m_mmal_video = (CMMALVideo *)cookie; ++ #if defined(MMAL_DEBUG_VERBOSE) ++ CLog::Log(LOGDEBUG, "%s::%s cookie:%p", CLASSNAME, __func__, cookie); ++ #endif ++ ++ if (m_mmal_video) ++ { ++ bool formatChanged = m_format != RENDER_FMT_MMAL; ++ m_format = RENDER_FMT_MMAL; ++ m_bConfigured = init_vout(formatChanged); ++ Prime(); ++ } ++ return NULL; ++} ++ + static void vout_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) + { + mmal_buffer_header_release(buffer); +@@ -164,14 +208,11 @@ bool CMMALRenderer::init_vout(ERenderFormat format) + return false; + } + +- if (m_format == RENDER_FMT_YUV420P) ++ m_vout_input_pool = mmal_port_pool_create(m_vout_input , m_vout_input->buffer_num, m_vout_input->buffer_size); ++ if (!m_vout_input_pool) + { +- m_vout_input_pool = mmal_pool_create(m_vout_input->buffer_num, m_vout_input->buffer_size); +- if (!m_vout_input_pool) +- { +- CLog::Log(LOGERROR, "%s::%s Failed to create pool for decoder input port (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status)); +- return false; +- } ++ CLog::Log(LOGERROR, "%s::%s Failed to create pool for decoder input port (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status)); ++ return false; + } + return true; + } +@@ -179,10 +220,17 @@ bool CMMALRenderer::init_vout(ERenderFormat format) + void CMMALRenderer::Process() + { + MMAL_BUFFER_HEADER_T *buffer; +- while (buffer = mmal_queue_wait(m_release_queue), buffer && buffer != &m_quit_packet) ++ while (buffer = mmal_queue_timedwait(m_release_queue, 100), buffer != &m_quit_packet) + { +- CMMALVideoBuffer *omvb = (CMMALVideoBuffer *)buffer->user_data; +- omvb->Release(); ++ if (buffer) ++ { ++ CMMALVideoBuffer *omvb = (CMMALVideoBuffer *)buffer->user_data; ++ omvb->Release(); ++ } ++ else ++ { ++ Prime(); ++ } + } + m_sync.Set(); + } +@@ -382,7 +430,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + #endif + // we only want to upload frames once + if (omvb->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) +- return; ++ goto done; + 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); +@@ -397,7 +445,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + { + // we only want to upload frames once + if (buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) +- return; ++ goto done; + // 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); +@@ -406,6 +454,8 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); + } + else assert(0); ++done: ++ Prime(); + } + + void CMMALRenderer::FlipPage(int source) +@@ -467,6 +517,8 @@ void CMMALRenderer::UnInitMMAL() + m_vout_input = NULL; + } + ++ ReleaseBuffers(); ++ + if (m_vout_input_pool) + { + mmal_pool_destroy(m_vout_input_pool); +@@ -478,7 +530,6 @@ void CMMALRenderer::UnInitMMAL() + mmal_component_release(m_vout); + m_vout = NULL; + } +- ReleaseBuffers(); + + m_RenderUpdateCallBackFn = NULL; + m_RenderUpdateCallBackCtx = NULL; +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h +index 17b189e..f515d7a 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.h ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.h +@@ -40,6 +40,7 @@ + + class CBaseTexture; + class CMMALVideoBuffer; ++class CMMALVideo; + + struct DVDVideoPicture; + +@@ -90,6 +91,7 @@ class CMMALRenderer : public CBaseRenderer, public CThread + virtual bool IsGuiLayer() { return false; } + + void vout_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); ++ virtual void *PassCookie(void *cookie); + protected: + int m_iYV12RenderBuffer; + int m_NumYV12Buffers; +@@ -116,8 +118,10 @@ class CMMALRenderer : public CBaseRenderer, public CThread + MMAL_QUEUE_T *m_release_queue; + CEvent m_sync; + MMAL_BUFFER_HEADER_T m_quit_packet; ++ CMMALVideo *m_mmal_video; + + bool init_vout(ERenderFormat format); + void ReleaseBuffers(); + void UnInitMMAL(); ++ void Prime(); + }; +diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp +index 25d3809..89faa65 100644 +--- a/xbmc/cores/VideoRenderers/RenderManager.cpp ++++ b/xbmc/cores/VideoRenderers/RenderManager.cpp +@@ -949,6 +949,14 @@ unsigned int CXBMCRenderManager::GetOptimalBufferSize() + return m_pRenderer->GetMaxBufferSize(); + } + ++void *CXBMCRenderManager::PassCookie(void *cookie) ++{ ++ if (m_pRenderer) ++ return m_pRenderer->PassCookie(cookie); ++ assert(0); ++} ++ ++ + // Supported pixel formats, can be called before configure + std::vector CXBMCRenderManager::SupportedFormats() + { +diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h +index f32f4a9..1d8fe88 100644 +--- a/xbmc/cores/VideoRenderers/RenderManager.h ++++ b/xbmc/cores/VideoRenderers/RenderManager.h +@@ -195,6 +195,11 @@ class CXBMCRenderManager + */ + void DiscardBuffer(); + ++ /** ++ * Magic api for communicating between codec and renderer ++ */ ++ void *PassCookie(void *cookie); ++ + protected: + + void PresentSingle(bool clear, DWORD flags, DWORD alpha); +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 61cf8e2..1fdc44c 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -111,7 +111,6 @@ CMMALVideo::CMMALVideo() + m_dec_input = NULL; + m_dec_output = NULL; + m_dec_input_pool = NULL; +- m_dec_output_pool = NULL; + + m_deint = NULL; + m_deint_connection = NULL; +@@ -162,10 +161,6 @@ CMMALVideo::~CMMALVideo() + mmal_pool_destroy(m_dec_input_pool); + m_dec_input_pool = NULL; + +- if (m_dec_output_pool) +- mmal_pool_destroy(m_dec_output_pool); +- m_dec_output_pool = NULL; +- + if (m_deint) + mmal_component_destroy(m_deint); + m_deint = NULL; +@@ -421,7 +416,7 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) + + m_dec_output = m_deint->output[0]; + m_interlace_method = interlace_method; +- Prime(); ++ + return true; + } + +@@ -477,7 +472,7 @@ bool CMMALVideo::DestroyDeinterlace() + + m_dec_output = m_dec->output[0]; + m_interlace_method = VS_INTERLACEMETHOD_NONE; +- Prime(); ++ + return true; + } + +@@ -708,21 +703,14 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide + return false; + } + +- m_dec_output_pool = mmal_port_pool_create(m_dec_output, m_dec_output->buffer_num, m_dec_output->buffer_size); +- if(!m_dec_output_pool) +- { +- CLog::Log(LOGERROR, "%s::%s Failed to create pool for decode output port (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status)); +- return false; +- } +- + if (!SendCodecConfigData()) + return false; + +- Prime(); + m_startframe = false; + m_preroll = !m_hints.stills; + m_speed = DVD_PLAYSPEED_NORMAL; + ++ g_renderManager.PassCookie(this); + return true; + } + +@@ -730,6 +718,7 @@ void CMMALVideo::Dispose() + { + // we are happy to exit, but let last shared pointer being deleted trigger the destructor + bool done = false; ++ g_renderManager.PassCookie(NULL); + m_finished = true; + Reset(); + pthread_mutex_lock(&m_output_mutex); +@@ -905,13 +894,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + return ret; + } + +-void CMMALVideo::Prime() +-{ +- MMAL_BUFFER_HEADER_T *buffer; +- while (buffer = mmal_queue_get(m_dec_output_pool->queue), buffer) +- Recycle(buffer); +-} +- + void CMMALVideo::Reset(void) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -957,10 +939,8 @@ void CMMALVideo::Reset(void) + pthread_mutex_unlock(&m_output_mutex); + + if (!m_finished) +- { + 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); +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index fcc6a15..204f004 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -103,7 +103,6 @@ class CMMALVideo + void QueryCodec(void); + bool CreateDeinterlace(EINTERLACEMETHOD interlace_method); + bool DestroyDeinterlace(); +- void Prime(); + + // Video format + int m_decoded_width; +@@ -141,7 +140,6 @@ class CMMALVideo + MMAL_PORT_T *m_dec_input; + MMAL_PORT_T *m_dec_output; + MMAL_POOL_T *m_dec_input_pool; +- MMAL_POOL_T *m_dec_output_pool; + + MMAL_ES_FORMAT_T *m_es_format; + MMAL_COMPONENT_T *m_deint; + +From 77dd3b8de1d73d01867d190bbcd4a82e67179c44 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 17 Apr 2015 16:07:40 +0100 +Subject: [PATCH 85/89] Separate mmal and renderer configured flags + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 26 +++++++++++++++----------- + xbmc/cores/VideoRenderers/MMALRenderer.h | 1 + + 2 files changed, 16 insertions(+), 11 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 5fbe2d2..fe3dce4 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -74,13 +74,12 @@ void *CMMALRenderer::PassCookie(void *cookie) + CLog::Log(LOGDEBUG, "%s::%s cookie:%p", CLASSNAME, __func__, cookie); + #endif + +- if (m_mmal_video) +- { +- bool formatChanged = m_format != RENDER_FMT_MMAL; +- m_format = RENDER_FMT_MMAL; +- m_bConfigured = init_vout(formatChanged); ++ if (m_mmal_video && !m_bMMALConfigured) ++ m_bMMALConfigured = init_vout(RENDER_FMT_MMAL); ++ ++ if (m_mmal_video && m_bMMALConfigured) + Prime(); +- } ++ + return NULL; + } + +@@ -122,10 +121,10 @@ bool CMMALRenderer::init_vout(ERenderFormat format) + + CLog::Log(LOGDEBUG, "%s::%s configured:%d format:%d->%d", CLASSNAME, __func__, m_bConfigured, m_format, format); + +- if (m_bConfigured && formatChanged) ++ if (m_bMMALConfigured && formatChanged) + UnInitMMAL(); + +- if (m_bConfigured) ++ if (m_bMMALConfigured) + return true; + + m_format = RENDER_FMT_MMAL; +@@ -247,6 +246,8 @@ CMMALRenderer::CMMALRenderer() + m_release_queue = mmal_queue_create(); + m_iFlags = 0; + m_format = RENDER_FMT_NONE; ++ m_bConfigured = false; ++ m_bMMALConfigured = false; + m_iYV12RenderBuffer = 0; + Create(); + } +@@ -297,8 +298,9 @@ bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned + SetViewMode(CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode); + ManageDisplay(); + +- m_bConfigured = init_vout(format); +- ++ m_bMMALConfigured = init_vout(format); ++ m_bConfigured = m_bMMALConfigured; ++ assert(m_bConfigured); + return m_bConfigured; + } + +@@ -361,7 +363,8 @@ int CMMALRenderer::GetImage(YV12Image *image, int source, bool readonly) + + void CMMALRenderer::ReleaseBuffer(int idx) + { +- if (!m_bConfigured || m_format == RENDER_FMT_BYPASS) ++ CSingleLock lock(m_sharedSection); ++ if (!m_bMMALConfigured || m_format == RENDER_FMT_BYPASS) + return; + + #if defined(MMAL_DEBUG_VERBOSE) +@@ -541,6 +544,7 @@ void CMMALRenderer::UnInitMMAL() + m_StereoInvert = false; + + m_bConfigured = false; ++ m_bMMALConfigured = false; + } + + void CMMALRenderer::UnInit() +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h +index f515d7a..a694182 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.h ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.h +@@ -100,6 +100,7 @@ class CMMALRenderer : public CBaseRenderer, public CThread + + YUVBUFFER m_buffers[NUM_BUFFERS]; + bool m_bConfigured; ++ bool m_bMMALConfigured; + unsigned int m_extended_format; + unsigned int m_destWidth; + unsigned int m_destHeight; + +From abe0fca00a2e5b063ff45037f543429f4c87305c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 16 Apr 2015 21:43:27 +0100 +Subject: [PATCH 86/89] Separate the buffers from the decoder so decoder can be + destroyed first + +--- + .../DVDCodecs/Video/DVDVideoCodecMMAL.cpp | 4 +- + .../dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h | 2 +- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 63 ++++++---------------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 6 +-- + 4 files changed, 20 insertions(+), 55 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp +index ee7d6f2..48e347c 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp +@@ -44,11 +44,13 @@ CDVDVideoCodecMMAL::~CDVDVideoCodecMMAL() + { + CLog::Log(LOGDEBUG, "%s::%s %p\n", CLASSNAME, __func__, this); + Dispose(); ++ delete m_decoder; ++ m_decoder = NULL; + } + + bool CDVDVideoCodecMMAL::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + { +- return m_decoder->Open(hints, options, m_decoder); ++ return m_decoder->Open(hints, options); + } + + const char* CDVDVideoCodecMMAL::GetName(void) +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h +index aa8e87f..6014363 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h +@@ -46,7 +46,7 @@ class CDVDVideoCodecMMAL : public CDVDVideoCodec + virtual void SetSpeed(int iSpeed); + + protected: +- MMALVideoPtr m_decoder; ++ CMMALVideo *m_decoder; + }; + + #endif +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 1fdc44c..7a45c25 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -81,7 +81,8 @@ long CMMALVideoBuffer::Release() + CLog::Log(LOGDEBUG, "%s::%s %p (%p) ref:%ld", CLASSNAME, __func__, this, mmal_buffer, count); + if (count == 0) + { +- m_omv->ReleaseBuffer(this); ++ mmal_buffer_header_release(mmal_buffer); ++ delete this; + } + else assert(count > 0); + return count; +@@ -117,7 +118,6 @@ CMMALVideo::CMMALVideo() + + m_codingType = 0; + +- m_output_busy = 0; + m_demux_queue_length = 0; + m_es_format = mmal_format_alloc(); + m_preroll = true; +@@ -261,7 +261,6 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf + omvb->height = m_decoded_height; + omvb->m_aspect_ratio = m_aspect_ratio; + pthread_mutex_lock(&m_output_mutex); +- m_output_busy++; + m_output_ready.push(omvb); + pthread_mutex_unlock(&m_output_mutex); + kept = true; +@@ -505,7 +504,7 @@ bool CMMALVideo::SendCodecConfigData() + return true; + } + +-bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVideoPtr myself) ++bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s usemmal:%d software:%d %dx%d", CLASSNAME, __func__, CSettings::Get().GetBool("videoplayer.usemmal"), hints.software, hints.width, hints.height); +@@ -518,7 +517,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide + MMAL_STATUS_T status; + MMAL_PARAMETER_BOOLEAN_T error_concealment; + +- m_myself = myself; + m_decoded_width = hints.width; + m_decoded_height = hints.height; + +@@ -716,21 +714,9 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide + + void CMMALVideo::Dispose() + { +- // we are happy to exit, but let last shared pointer being deleted trigger the destructor +- bool done = false; + g_renderManager.PassCookie(NULL); + m_finished = true; + Reset(); +- pthread_mutex_lock(&m_output_mutex); +- if (!m_output_busy) +- done = true; +- pthread_mutex_unlock(&m_output_mutex); +- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s ready_queue(%d) busy_queue(%d) done:%d", CLASSNAME, __func__, m_output_ready.size(), m_output_busy, done); +- if (done) +- { +- m_myself.reset(); +- } + } + + void CMMALVideo::SetDropState(bool bDrop) +@@ -742,8 +728,8 @@ void CMMALVideo::SetDropState(bool bDrop) + int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + { + //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- // CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d dts:%.3f pts:%.3f ready_queue(%d) busy_queue(%d)", +- // CLASSNAME, __func__, pData, iSize, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, m_output_ready.size(), m_output_busy); ++ // CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d dts:%.3f pts:%.3f ready_queue(%d)", ++ // CLASSNAME, __func__, pData, iSize, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, m_output_ready.size()); + + unsigned int demuxer_bytes = 0; + uint8_t *demuxer_content = NULL; +@@ -819,8 +805,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + buffer->flags |= MMAL_BUFFER_HEADER_FLAG_FRAME_END; + + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d/%-6d dts:%.3f pts:%.3f flags:%x ready_queue(%d) busy_queue(%d) demux_queue(%d) space(%d)", +- CLASSNAME, __func__, buffer, buffer->length, demuxer_bytes, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, buffer->flags, m_output_ready.size(), m_output_busy, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); ++ CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d/%-6d dts:%.3f pts:%.3f flags:%x ready_queue(%d) demux_queue(%d) space(%d)", ++ CLASSNAME, __func__, buffer, buffer->length, demuxer_bytes, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, buffer->flags, m_output_ready.size(), m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); + assert((int)buffer->length > 0); + status = mmal_port_send_buffer(m_dec_input, buffer); + if (status != MMAL_SUCCESS) +@@ -887,8 +873,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + if (!ret) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s - Nothing to do: ready_queue(%d) busy_queue(%d) demux_queue(%d) space(%d) preroll(%d)", +- CLASSNAME, __func__, m_output_ready.size(), m_output_busy, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, m_preroll); ++ CLog::Log(LOGDEBUG, "%s::%s - Nothing to do: ready_queue(%d) demux_queue(%d) space(%d) preroll(%d)", ++ CLASSNAME, __func__, m_output_ready.size(), m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, m_preroll); + Sleep(10); // otherwise we busy spin + } + return ret; +@@ -927,7 +913,10 @@ void CMMALVideo::Reset(void) + } + pthread_mutex_unlock(&m_output_mutex); + if (buffer) +- ReleaseBuffer(buffer); ++ { ++ buffer->Acquire(); ++ buffer->Release(); ++ } + else + break; + } +@@ -970,8 +959,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) + mmal_buffer_header_reset(buffer); + buffer->cmd = 0; + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s Send buffer %p from pool to decoder output port %p ready_queue(%d) busy_queue(%d)", CLASSNAME, __func__, buffer, m_dec_output, +- m_output_ready.size(), m_output_busy); ++ CLog::Log(LOGDEBUG, "%s::%s Send buffer %p from pool to decoder output port %p ready_queue(%d)", CLASSNAME, __func__, buffer, m_dec_output, ++ m_output_ready.size()); + status = mmal_port_send_buffer(m_dec_output, buffer); + if (status != MMAL_SUCCESS) + { +@@ -980,28 +969,6 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) + } + } + +-void CMMALVideo::ReleaseBuffer(CMMALVideoBuffer *buffer) +-{ +- // remove from busy list +- pthread_mutex_lock(&m_output_mutex); +- assert(m_output_busy > 0); +- m_output_busy--; +- pthread_mutex_unlock(&m_output_mutex); +- // sanity check it is not on display +- assert(!(buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER2)); +- Recycle(buffer->mmal_buffer); +- bool done = false; +- pthread_mutex_lock(&m_output_mutex); +- if (m_finished && !m_output_busy) +- done = true; +- pthread_mutex_unlock(&m_output_mutex); +- if (done) +- m_myself.reset(); +- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s %p (%p) ready_queue(%d) busy_queue(%d) done:%d", CLASSNAME, __func__, buffer, buffer->mmal_buffer, m_output_ready.size(), m_output_busy, done); +- delete buffer; +-} +- + bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) + { + if (!m_output_ready.empty()) +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index 204f004..ab6e958 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -42,7 +42,6 @@ + #include "cores/VideoRenderers/BaseRenderer.h" + + class CMMALVideo; +-typedef std::shared_ptr MMALVideoPtr; + + // a mmal video frame + class CMMALVideoBuffer +@@ -77,7 +76,7 @@ class CMMALVideo + virtual ~CMMALVideo(); + + // Required overrides +- virtual bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVideoPtr myself); ++ virtual bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options); + virtual void Dispose(void); + virtual int Decode(uint8_t *pData, int iSize, double dts, double pts); + virtual void Reset(void); +@@ -91,7 +90,6 @@ class CMMALVideo + virtual void SetSpeed(int iSpeed); + + // MMAL decoder callback routines. +- void ReleaseBuffer(CMMALVideoBuffer *buffer); + void Recycle(MMAL_BUFFER_HEADER_T *buffer); + + // MMAL decoder callback routines. +@@ -111,14 +109,12 @@ class CMMALVideo + bool m_finished; + float m_aspect_ratio; + const char *m_pFormatName; +- MMALVideoPtr m_myself; + + std::queue m_demux_queue; + unsigned m_demux_queue_length; + + // mmal output buffers (video frames) + pthread_mutex_t m_output_mutex; +- int m_output_busy; + std::queue m_output_ready; + + // initialize mmal and get decoder component + +From d93944688cae601453f2439169cf9a5834196177 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 16 Apr 2015 21:50:10 +0100 +Subject: [PATCH 87/89] Remove DVDVideoCodecMMAL wrapper + +--- + xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 4 +- + .../DVDCodecs/Video/DVDVideoCodecMMAL.cpp | 111 --------------------- + .../dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h | 52 ---------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 4 +- + xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in | 1 - + 5 files changed, 4 insertions(+), 168 deletions(-) + delete mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp + delete mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +index 9d8de2a..995a14e 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +@@ -39,7 +39,7 @@ + #if defined(HAS_IMXVPU) + #include "Video/DVDVideoCodecIMX.h" + #endif +-#include "Video/DVDVideoCodecMMAL.h" ++#include "Video/MMALCodec.h" + #include "Video/DVDVideoCodecStageFright.h" + #if defined(HAS_LIBAMCODEC) + #include "utils/AMLUtils.h" +@@ -306,7 +306,7 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne + hint.codec == AV_CODEC_ID_VP6 || hint.codec == AV_CODEC_ID_VP6F || hint.codec == AV_CODEC_ID_VP6A || hint.codec == AV_CODEC_ID_VP8 || + hint.codec == AV_CODEC_ID_THEORA || hint.codec == AV_CODEC_ID_MJPEG || hint.codec == AV_CODEC_ID_MJPEGB || hint.codec == AV_CODEC_ID_VC1 || hint.codec == AV_CODEC_ID_WMV3) + { +- if ( (pCodec = OpenCodec(new CDVDVideoCodecMMAL(), hint, options)) ) return pCodec; ++ if ( (pCodec = OpenCodec(new CMMALVideo(), hint, options)) ) return pCodec; + } + } + #endif +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp +deleted file mode 100644 +index 48e347c..0000000 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp ++++ /dev/null +@@ -1,111 +0,0 @@ +-/* +- * Copyright (C) 2010-2013 Team XBMC +- * http://xbmc.org +- * +- * This Program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2, or (at your option) +- * any later version. +- * +- * This Program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with XBMC; see the file COPYING. If not, see +- * . +- * +- */ +- +-#if (defined HAVE_CONFIG_H) && (!defined TARGET_WINDOWS) +- #include "config.h" +-#elif defined(TARGET_WINDOWS) +-#include "system.h" +-#endif +- +-#if defined(HAS_MMAL) +-#include "DVDClock.h" +-#include "DVDStreamInfo.h" +-#include "DVDVideoCodecMMAL.h" +-#include "settings/Settings.h" +-#include "utils/log.h" +- +-#define CLASSNAME "CDVDVideoCodecMMAL" +-//////////////////////////////////////////////////////////////////////////////////////////// +-//////////////////////////////////////////////////////////////////////////////////////////// +-CDVDVideoCodecMMAL::CDVDVideoCodecMMAL() +- : m_decoder( new CMMALVideo ) +-{ +- CLog::Log(LOGDEBUG, "%s::%s %p\n", CLASSNAME, __func__, this); +-} +- +-CDVDVideoCodecMMAL::~CDVDVideoCodecMMAL() +-{ +- CLog::Log(LOGDEBUG, "%s::%s %p\n", CLASSNAME, __func__, this); +- Dispose(); +- delete m_decoder; +- m_decoder = NULL; +-} +- +-bool CDVDVideoCodecMMAL::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) +-{ +- return m_decoder->Open(hints, options); +-} +- +-const char* CDVDVideoCodecMMAL::GetName(void) +-{ +- return m_decoder ? m_decoder->GetName() : "mmal-xxx"; +-} +- +-void CDVDVideoCodecMMAL::Dispose() +-{ +- m_decoder->Dispose(); +-} +- +-void CDVDVideoCodecMMAL::SetDropState(bool bDrop) +-{ +- m_decoder->SetDropState(bDrop); +-} +- +-int CDVDVideoCodecMMAL::Decode(uint8_t* pData, int iSize, double dts, double pts) +-{ +- return m_decoder->Decode(pData, iSize, dts, pts); +-} +- +-unsigned CDVDVideoCodecMMAL::GetAllowedReferences() +-{ +- return m_decoder->GetAllowedReferences(); +-} +- +-void CDVDVideoCodecMMAL::Reset(void) +-{ +- m_decoder->Reset(); +-} +- +-bool CDVDVideoCodecMMAL::GetPicture(DVDVideoPicture* pDvdVideoPicture) +-{ +- return m_decoder->GetPicture(pDvdVideoPicture); +-} +- +-bool CDVDVideoCodecMMAL::ClearPicture(DVDVideoPicture* pDvdVideoPicture) +-{ +- return m_decoder->ClearPicture(pDvdVideoPicture); +-} +- +-bool CDVDVideoCodecMMAL::GetCodecStats(double &pts, int &droppedPics) +-{ +- return m_decoder->GetCodecStats(pts, droppedPics); +-} +- +-void CDVDVideoCodecMMAL::SetCodecControl(int flags) +-{ +- m_decoder->SetCodecControl(flags); +-} +- +-void CDVDVideoCodecMMAL::SetSpeed(int iSpeed) +-{ +- m_decoder->SetSpeed(iSpeed); +-} +- +-#endif +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h +deleted file mode 100644 +index 6014363..0000000 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h ++++ /dev/null +@@ -1,52 +0,0 @@ +-#pragma once +-/* +- * Copyright (C) 2010-2013 Team XBMC +- * http://xbmc.org +- * +- * This Program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2, or (at your option) +- * any later version. +- * +- * This Program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with XBMC; see the file COPYING. If not, see +- * . +- * +- */ +- +-#if defined(HAS_MMAL) +- +-#include "DVDVideoCodec.h" +-#include "MMALCodec.h" +- +-class CMMALVideo; +-class CDVDVideoCodecMMAL : public CDVDVideoCodec +-{ +-public: +- CDVDVideoCodecMMAL(); +- virtual ~CDVDVideoCodecMMAL(); +- +- // Required overrides +- virtual bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options); +- virtual void Dispose(void); +- virtual int Decode(uint8_t *pData, int iSize, double dts, double pts); +- virtual void Reset(void); +- virtual bool GetPicture(DVDVideoPicture *pDvdVideoPicture); +- virtual bool ClearPicture(DVDVideoPicture* pDvdVideoPicture); +- virtual unsigned GetAllowedReferences(); +- virtual void SetDropState(bool bDrop); +- virtual const char* GetName(void); +- virtual bool GetCodecStats(double &pts, int &droppedPics); +- virtual void SetCodecControl(int flags); +- virtual void SetSpeed(int iSpeed); +- +-protected: +- CMMALVideo *m_decoder; +-}; +- +-#endif +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index ab6e958..3e444f7 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -62,7 +62,7 @@ class CMMALVideoBuffer + private: + }; + +-class CMMALVideo ++class CMMALVideo : public CDVDVideoCodec + { + typedef struct mmal_demux_packet { + uint8_t *buff; +@@ -84,7 +84,7 @@ class CMMALVideo + virtual bool ClearPicture(DVDVideoPicture* pDvdVideoPicture); + virtual unsigned GetAllowedReferences() { return 3; } + virtual void SetDropState(bool bDrop); +- virtual const char* GetName(void) { return (const char*)m_pFormatName; } ++ virtual const char* GetName(void) { return m_pFormatName ? m_pFormatName:"mmal-xxx"; } + virtual bool GetCodecStats(double &pts, int &droppedPics); + virtual void SetCodecControl(int flags); + virtual void SetSpeed(int iSpeed); +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in +index 6f5d3e8..56ec6a3 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in +@@ -39,7 +39,6 @@ endif + + ifeq (@USE_MMAL@,1) + SRCS += MMALCodec.cpp +-SRCS += DVDVideoCodecMMAL.cpp + endif + + LIB=Video.a + +From 6b1c7ca35ed7a890db47cf528a4a5ebbd468b852 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 17 Apr 2015 15:46:55 +0100 +Subject: [PATCH 88/89] Add shared lock around MMAL operations + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 17 +++++++++++++++++ + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 + + 2 files changed, 18 insertions(+) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 7a45c25..2a6eb78 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -127,6 +127,7 @@ CMMALVideo::CMMALVideo() + + CMMALVideo::~CMMALVideo() + { ++ CSingleLock lock(m_sharedSection); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); + assert(m_finished); +@@ -174,6 +175,7 @@ CMMALVideo::~CMMALVideo() + + void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) + { ++ CSingleLock lock(m_sharedSection); + MMAL_EVENT_FORMAT_CHANGED_T *fmt = mmal_event_format_changed_get(buffer); + mmal_format_copy(m_es_format, fmt->format); + +@@ -288,6 +290,7 @@ static void dec_output_port_cb_static(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *b + + bool CMMALVideo::change_dec_output_format() + { ++ CSingleLock lock(m_sharedSection); + MMAL_STATUS_T status; + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); +@@ -324,6 +327,7 @@ bool CMMALVideo::change_dec_output_format() + + bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) + { ++ CSingleLock lock(m_sharedSection); + MMAL_STATUS_T status; + + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -421,6 +425,7 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) + + bool CMMALVideo::DestroyDeinterlace() + { ++ CSingleLock lock(m_sharedSection); + MMAL_STATUS_T status; + + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -477,6 +482,7 @@ bool CMMALVideo::DestroyDeinterlace() + + bool CMMALVideo::SendCodecConfigData() + { ++ CSingleLock lock(m_sharedSection); + MMAL_STATUS_T status; + if (!m_dec_input_pool) + return true; +@@ -506,6 +512,7 @@ bool CMMALVideo::SendCodecConfigData() + + bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + { ++ CSingleLock lock(m_sharedSection); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s usemmal:%d software:%d %dx%d", CLASSNAME, __func__, CSettings::Get().GetBool("videoplayer.usemmal"), hints.software, hints.width, hints.height); + +@@ -708,6 +715,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + m_preroll = !m_hints.stills; + m_speed = DVD_PLAYSPEED_NORMAL; + ++ lock.Leave(); + g_renderManager.PassCookie(this); + return true; + } +@@ -715,6 +723,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + void CMMALVideo::Dispose() + { + g_renderManager.PassCookie(NULL); ++ CSingleLock lock(m_sharedSection); + m_finished = true; + Reset(); + } +@@ -727,6 +736,7 @@ void CMMALVideo::SetDropState(bool bDrop) + + int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + { ++ CSingleLock lock(m_sharedSection); + //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + // CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d dts:%.3f pts:%.3f ready_queue(%d)", + // CLASSNAME, __func__, pData, iSize, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, m_output_ready.size()); +@@ -875,6 +885,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s - Nothing to do: ready_queue(%d) demux_queue(%d) space(%d) preroll(%d)", + CLASSNAME, __func__, m_output_ready.size(), m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, m_preroll); ++ lock.Leave(); + Sleep(10); // otherwise we busy spin + } + return ret; +@@ -882,6 +893,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + void CMMALVideo::Reset(void) + { ++ CSingleLock lock(m_sharedSection); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); + +@@ -946,6 +958,7 @@ void CMMALVideo::SetSpeed(int iSpeed) + + void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) + { ++ CSingleLock lock(m_sharedSection); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, buffer); + +@@ -971,6 +984,7 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) + + bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) + { ++ CSingleLock lock(m_sharedSection); + if (!m_output_ready.empty()) + { + CMMALVideoBuffer *buffer; +@@ -1030,6 +1044,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) + + bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) + { ++ CSingleLock lock(m_sharedSection); + if (pDvdVideoPicture->format == RENDER_FMT_MMAL) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -1042,12 +1057,14 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) + + bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) + { ++ CSingleLock lock(m_sharedSection); + droppedPics= -1; + return false; + } + + void CMMALVideo::SetCodecControl(int flags) + { ++ CSingleLock lock(m_sharedSection); + m_codecControlFlags = flags; + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s flags:%x", CLASSNAME, __func__, flags); +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index 3e444f7..e686b4b 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -132,6 +132,7 @@ class CMMALVideo : public CDVDVideoCodec + bool m_preroll; + int m_codecControlFlags; + ++ CCriticalSection m_sharedSection; + MMAL_COMPONENT_T *m_dec; + MMAL_PORT_T *m_dec_input; + MMAL_PORT_T *m_dec_output; + +From ec9d208ad8e921eb4479279154fe4b477d1f9c71 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 17 Apr 2015 15:59:12 +0100 +Subject: [PATCH 89/89] Add shared lock around MMAL operations + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 13 +++++++++++++ + xbmc/cores/VideoRenderers/MMALRenderer.h | 1 + + 2 files changed, 14 insertions(+) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index fe3dce4..7ebc2c9 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -44,6 +44,7 @@ + + void CMMALRenderer::Prime() + { ++ CSingleLock lock(m_sharedSection); + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s format:%d dec:%p pool:%p", CLASSNAME, __func__, m_format, m_mmal_video, m_vout_input_pool); + #endif +@@ -69,6 +70,7 @@ void CMMALRenderer::Prime() + + void *CMMALRenderer::PassCookie(void *cookie) + { ++ CSingleLock lock(m_sharedSection); + m_mmal_video = (CMMALVideo *)cookie; + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s cookie:%p", CLASSNAME, __func__, cookie); +@@ -90,6 +92,7 @@ static void vout_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer + + void CMMALRenderer::vout_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) + { ++ CSingleLock lock(m_sharedSection); + #if defined(MMAL_DEBUG_VERBOSE) + CMMALVideoBuffer *omvb = (CMMALVideoBuffer *)buffer->user_data; + CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p (%p), len %d cmd:%x f:%x", CLASSNAME, __func__, port, buffer, omvb, buffer->length, buffer->cmd, buffer->flags); +@@ -116,6 +119,7 @@ static void vout_input_port_cb_static(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *b + + bool CMMALRenderer::init_vout(ERenderFormat format) + { ++ CSingleLock lock(m_sharedSection); + bool formatChanged = m_format != format; + MMAL_STATUS_T status; + +@@ -254,6 +258,7 @@ CMMALRenderer::CMMALRenderer() + + CMMALRenderer::~CMMALRenderer() + { ++ CSingleLock lock(m_sharedSection); + CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); + // shutdown thread + mmal_queue_put(m_release_queue, &m_quit_packet); +@@ -276,6 +281,7 @@ void CMMALRenderer::AddProcessor(CMMALVideoBuffer *buffer, int index) + + bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags, ERenderFormat format, unsigned extended_format, unsigned int orientation) + { ++ CSingleLock lock(m_sharedSection); + ReleaseBuffers(); + + m_sourceWidth = width; +@@ -306,6 +312,7 @@ bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned + + int CMMALRenderer::GetImage(YV12Image *image, int source, bool readonly) + { ++ CSingleLock lock(m_sharedSection); + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - %p %d %d", CLASSNAME, __func__, image, source, readonly); + #endif +@@ -403,6 +410,7 @@ void CMMALRenderer::Update() + + void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + { ++ CSingleLock lock(m_sharedSection); + int source = m_iYV12RenderBuffer; + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - %d %x %d %d", CLASSNAME, __func__, clear, flags, alpha, source); +@@ -463,6 +471,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + + void CMMALRenderer::FlipPage(int source) + { ++ CSingleLock lock(m_sharedSection); + if (!m_bConfigured || m_format == RENDER_FMT_BYPASS) + return; + +@@ -475,6 +484,7 @@ void CMMALRenderer::FlipPage(int source) + + unsigned int CMMALRenderer::PreInit() + { ++ CSingleLock lock(m_sharedSection); + m_bConfigured = false; + UnInit(); + +@@ -500,12 +510,14 @@ unsigned int CMMALRenderer::PreInit() + + void CMMALRenderer::ReleaseBuffers() + { ++ CSingleLock lock(m_sharedSection); + for (int i=0; i Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 001/103] [rbp/omxplayer] When opening a stream don't try to +Subject: [PATCH 01/89] [rbp/omxplayer] When opening a stream don't try to update gui so often --- @@ -25,10 +25,10 @@ index 2faceea..889d7a2 100644 g_windowManager.ProcessRenderLoop(false); if (allowCancel && dialog->IsCanceled()) -From 274fcbff2f4a4c64f92a0d4cf1cdfed8f3045259 Mon Sep 17 00:00:00 2001 +From ac38c688a0443bd965bf167def9f30e105e7227c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 29 Apr 2014 15:23:22 +0100 -Subject: [PATCH 002/103] [ffmpeg] Speed up wtv index creation +Subject: [PATCH 02/89] [ffmpeg] Speed up wtv index creation The index creation is O(N^2) with number of entries (typically thousands). On a Pi this can take more than 60 seconds to execute for a recording of a few hours. @@ -114,17 +114,17 @@ index 0000000..4ac5636 + } + } -From 681ca292791c12e51b745db0629376902377367b Mon Sep 17 00:00:00 2001 +From 10fca829203615581df049df3ab697eb26a0df13 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 2 Aug 2014 17:48:04 +0100 -Subject: [PATCH 003/103] [omx] Report decoded image name +Subject: [PATCH 03/89] [omx] Report decoded image name --- xbmc/cores/omxplayer/OMXImage.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp -index 161ec5a..86a683a 100644 +index a43a446..d99d719 100644 --- a/xbmc/cores/omxplayer/OMXImage.cpp +++ b/xbmc/cores/omxplayer/OMXImage.cpp @@ -327,6 +327,7 @@ bool COMXImage::DecodeJpegToTexture(COMXImageFile *file, unsigned int width, uns @@ -136,10 +136,10 @@ index 161ec5a..86a683a 100644 else { -From 3e320b31a6b000fbcd212e8b7138c88e2b77dfaa Mon Sep 17 00:00:00 2001 +From db0a6dc35272b3b14e9c463ed357ebd9df0431be Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 004/103] [hifiberry] Hack: force it to be recognised as IEC958 +Subject: [PATCH 04/89] [hifiberry] Hack: force it to be recognised as IEC958 capable to enable passthrough options --- @@ -162,10 +162,10 @@ index e22db7a..0120bd5 100644 info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") { -From 6828241cd39ce51a64ef4e25394620d034afd10f Mon Sep 17 00:00:00 2001 +From d21d0015b0df19c700e1c63d5525546cc5f71f15 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 005/103] Improved file buffering in CArchive +Subject: [PATCH 05/89] 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 @@ -225,10 +225,10 @@ index 6ed0f8f..8506d95 100644 } else -From cdd2b2e9dacd31ab126e635aee2061bc8dc1e920 Mon Sep 17 00:00:00 2001 +From 02ffcb9c5cac171a3fb3e8ace0fb24fda0dd0db0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 12 Aug 2014 00:31:36 +0100 -Subject: [PATCH 006/103] [omxcodec] Don't force software codec with dvds +Subject: [PATCH 06/89] [omxcodec] Don't force software codec with dvds --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 2 ++ @@ -249,10 +249,10 @@ index 143ea06..e029c16 100644 else if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) { -From bb8c24c64263afa825341429bd22a49a774c96b8 Mon Sep 17 00:00:00 2001 +From 965be36a5564ce176d5d9c135b313e2323395242 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 007/103] filesystem: Make support of browsing into archives +Subject: [PATCH 07/89] 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. @@ -270,10 +270,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 e7244d1..a762609 100644 +index dedca23..629f726 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16519,6 +16519,15 @@ msgstr "" +@@ -16527,6 +16527,15 @@ msgstr "" #: system/settings/rbp.xml msgctxt "#38010" msgid "GPU accelerated" @@ -290,10 +290,10 @@ index e7244d1..a762609 100644 #. Setting #38011 "Videos -> Library -> Show All Items entry" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 323a2f1..f008579 100644 +index 3940ca8..8f1bfc4 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml -@@ -301,6 +301,11 @@ +@@ -304,6 +304,11 @@ false @@ -335,11 +335,11 @@ index 3a5ba4e..f1f6f79 100644 { // XBMC Smart playlist - just XML renamed to XSP // read the name of the playlist in -From 14b7c230cf053a22a015126b6bce83bc8ad7cf5c Mon Sep 17 00:00:00 2001 +From d1698689aedc5255eaf125d2bbf7940c6ce8b1e2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 13:06:57 +0000 -Subject: [PATCH 009/103] [rbp] Make cachemembuffersize default depend on - memory size +Subject: [PATCH 09/89] [rbp] Make cachemembuffersize default depend on memory + size --- xbmc/linux/RBP.cpp | 5 +++++ @@ -347,18 +347,18 @@ Subject: [PATCH 009/103] [rbp] Make cachemembuffersize default depend on 2 files changed, 10 insertions(+) diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index ba1a3d0..5119949 100644 +index 59dd1da..aedae18 100644 --- a/xbmc/linux/RBP.cpp +++ b/xbmc/linux/RBP.cpp -@@ -22,6 +22,7 @@ - #if defined(TARGET_RASPBERRY_PI) +@@ -23,6 +23,7 @@ + #include #include "settings/Settings.h" +#include "settings/AdvancedSettings.h" #include "utils/log.h" #include "cores/omxplayer/OMXImage.h" -@@ -84,6 +85,9 @@ bool CRBP::Initialize() +@@ -82,6 +83,9 @@ bool CRBP::Initialize() if (!m_gui_resolution_limit) m_gui_resolution_limit = m_gpu_mem < 128 ? 720:1080; @@ -368,7 +368,7 @@ index ba1a3d0..5119949 100644 g_OMXImage.Initialize(); m_omx_image_init = true; return true; -@@ -96,6 +100,7 @@ void CRBP::LogFirmwareVerison() +@@ -94,6 +98,7 @@ void CRBP::LogFirmwareVerison() response[sizeof(response) - 1] = '\0'; CLog::Log(LOGNOTICE, "Raspberry PI firmware version: %s", response); CLog::Log(LOGNOTICE, "ARM mem: %dMB GPU mem: %dMB MPG2:%d WVC1:%d", m_arm_mem, m_gpu_mem, m_codec_mpg2_enabled, m_codec_wvc1_enabled); @@ -377,7 +377,7 @@ index ba1a3d0..5119949 100644 response[sizeof(response) - 1] = '\0'; CLog::Log(LOGNOTICE, "Config:\n%s", response); diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index ba15502..7797edf 100644 +index fab9a82..25ef7b8 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -352,7 +352,12 @@ void CAdvancedSettings::Initialize() @@ -394,10 +394,11 @@ index ba15502..7797edf 100644 // the following setting determines the readRate of a player data // as multiply of the default data read rate -From 910468040e6fe46799e99ecdd4ae3223c37b2b50 Mon Sep 17 00:00:00 2001 + +From 1690732bafc24f041aabaccd168f35e86ebdbbd2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 011/103] [settings] Experiment: Report DESKTOP resolution in +Subject: [PATCH 11/89] [settings] Experiment: Report DESKTOP resolution in video settings --- @@ -419,18 +420,17 @@ index 1fafd9a..e0288aa 100644 StringUtils::Format("%dx%d%s", resolution->width, resolution->height, ModeFlagsToString(resolution->flags, false).c_str()), -From 7285aff9a873a23fd65867428cb0007b9ea07948 Mon Sep 17 00:00:00 2001 +From 2e5b318953c5635129b69c01f24919392b0af5da Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 9 Sep 2014 12:04:26 +0100 -Subject: [PATCH 012/103] egl: Treat unknown display aspect ratio as square - pixel +Subject: [PATCH 12/89] egl: Treat unknown display aspect ratio as square pixel --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 749de8d..98072e8 100644 +index bda7430..68fc647 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp @@ -447,7 +447,7 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r @@ -452,44 +452,10 @@ index 749de8d..98072e8 100644 SetResolutionString(m_desktopRes); -From 897c19a7803148ca067b9e5cea4e43e320c4fd67 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 18 Sep 2014 14:24:56 +0100 -Subject: [PATCH 013/103] [omxplayer] Only enable audio clock master when A/V - sync method is set to audio clock - ---- - xbmc/cores/omxplayer/OMXAudio.cpp | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 45a35bb..691b9a7 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -247,7 +247,8 @@ bool COMXAudio::PortSettingsChanged() - { - // By default audio_render is the clock master, and if output samples don't fit the timestamps, it will speed up/slow down the clock. - // This tends to be better for maintaining audio sync and avoiding audio glitches, but can affect video/display sync -- if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -+ if((CSettings::Get().GetBool("videoplayer.usedisplayasclock") && CSettings::Get().GetInt("videoplayer.synctype") == SYNC_DISCON) || -+ CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") - { - OMX_CONFIG_BOOLEANTYPE configBool; - OMX_INIT_STRUCTURE(configBool); -@@ -273,7 +274,7 @@ bool COMXAudio::PortSettingsChanged() - { - // By default audio_render is the clock master, and if output samples don't fit the timestamps, it will speed up/slow down the clock. - // This tends to be better for maintaining audio sync and avoiding audio glitches, but can affect video/display sync -- if(CSettings::Get().GetBool("videoplayer.usedisplayasclock")) -+ if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") && CSettings::Get().GetInt("videoplayer.synctype") == SYNC_DISCON) - { - OMX_CONFIG_BOOLEANTYPE configBool; - OMX_INIT_STRUCTURE(configBool); - -From 503f7e7fb4a0e74ff3092c7ff461620634f01d09 Mon Sep 17 00:00:00 2001 +From f585eaf62527f49edaa92c95322968c05189ac2f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 014/103] [dvdplayer/rbp] Add pi specific option to maintain +Subject: [PATCH 13/89] [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". @@ -514,10 +480,10 @@ 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 a762609..8cd2b39 100644 +index 629f726..129f0c7 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -6334,7 +6334,22 @@ msgctxt "#13459" +@@ -6336,7 +6336,22 @@ msgctxt "#13459" msgid "Use OMXPlayer for decoding of video files." msgstr "" @@ -541,7 +507,7 @@ index a762609..8cd2b39 100644 #: system/settings/settings.xml msgctxt "#13505" -@@ -16565,3 +16580,10 @@ msgstr "" +@@ -16573,3 +16588,10 @@ msgstr "" msgctxt "#38016" msgid "%d fps" msgstr "" @@ -553,10 +519,10 @@ index a762609..8cd2b39 100644 +msgstr "" + diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index f008579..8395973 100644 +index 8f1bfc4..ad90e8c 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml -@@ -569,6 +569,20 @@ +@@ -572,6 +572,20 @@ false @@ -592,7 +558,7 @@ index 782a9ba..3e0390c 100644 struct AEDelayStatus diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -index 74df969..416e6f8 100644 +index a345a88..bd357aa 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp @@ -25,6 +25,7 @@ @@ -636,7 +602,7 @@ index 74df969..416e6f8 100644 CLog::Log(LOGNOTICE, "Deleting audio codec"); if (m_pAudioCodec) { -@@ -484,7 +489,11 @@ void CDVDPlayerAudio::UpdatePlayerInfo() +@@ -486,7 +491,11 @@ void CDVDPlayerAudio::UpdatePlayerInfo() //print the inverse of the resample ratio, since that makes more sense //if the resample ratio is 0.5, then we're playing twice as fast if (m_synctype == SYNC_RESAMPLE) @@ -649,7 +615,7 @@ index 74df969..416e6f8 100644 s << ", att:" << fixed << setprecision(1) << log(GetCurrentAttenuation()) * 20.0f << " dB"; -@@ -638,8 +647,8 @@ void CDVDPlayerAudio::SetSyncType(bool passthrough) +@@ -641,8 +650,8 @@ void CDVDPlayerAudio::SetSyncType(bool passthrough) if (m_synctype != m_prevsynctype) { @@ -660,7 +626,7 @@ index 74df969..416e6f8 100644 CLog::Log(LOGDEBUG, "CDVDPlayerAudio:: synctype set to %i: %s", m_synctype, synctypes[synctype]); m_prevsynctype = m_synctype; } -@@ -749,7 +758,19 @@ void CDVDPlayerAudio::HandleSyncError(double duration) +@@ -752,7 +761,19 @@ void CDVDPlayerAudio::HandleSyncError(double duration) proportional = m_error / DVD_TIME_BASE / proportionaldiv; } m_resampleratio = 1.0 / m_pClock->GetClockSpeed() + proportional + m_integral; @@ -680,7 +646,7 @@ index 74df969..416e6f8 100644 } bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) -@@ -802,6 +823,7 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) +@@ -805,6 +826,7 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) { m_dvdAudio.AddPackets(audioframe); } @@ -688,7 +654,7 @@ index 74df969..416e6f8 100644 } else if (m_synctype == SYNC_DISCON) { -@@ -836,6 +858,10 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) +@@ -839,6 +861,10 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) m_dvdAudio.SetResampleRatio(m_resampleratio); m_dvdAudio.AddPackets(audioframe); } @@ -714,10 +680,10 @@ index 99ce952..635c184 100644 struct SInfo { diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index 5119949..ce09fce 100644 +index aedae18..a4b0c2a 100644 --- a/xbmc/linux/RBP.cpp +++ b/xbmc/linux/RBP.cpp -@@ -212,4 +212,18 @@ void CRBP::Deinitialize() +@@ -220,4 +220,18 @@ void CRBP::Deinitialize() m_initialized = false; m_omx_initialized = false; } @@ -737,10 +703,10 @@ index 5119949..ce09fce 100644 + #endif diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index 4fd18f3..6456657 100644 +index 9559914..65492fa 100644 --- a/xbmc/linux/RBP.h +++ b/xbmc/linux/RBP.h -@@ -58,6 +58,7 @@ class CRBP +@@ -63,6 +63,7 @@ class CRBP 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(); @@ -749,7 +715,7 @@ index 4fd18f3..6456657 100644 private: DllBcmHost *m_DllBcmHost; diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 7797edf..59d45c8 100644 +index 25ef7b8..76b5ce8 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -110,6 +110,7 @@ void CAdvancedSettings::Initialize() @@ -781,11 +747,11 @@ index b0b4df1..5e0b14c 100644 float m_audioPlayCountMinimumPercent; bool m_dvdplayerIgnoreDTSinWAV; -From 3f55c9edc572baeb0c43fdd4e60a030ce1a6ea9e Mon Sep 17 00:00:00 2001 +From dfbee238810b1825c24c466b6f7c90140a6c602f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 27 Sep 2014 15:32:37 +0100 -Subject: [PATCH 015/103] [dvdplayer] exerimental: don't raise priority of - audio thread +Subject: [PATCH 14/89] [dvdplayer] exerimental: don't raise priority of audio + thread --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 4 ++++ @@ -808,10 +774,10 @@ index e029c16..63f4a30 100644 } -From 3d434543097974c95cc25dc07f9ece37ba2e6bc1 Mon Sep 17 00:00:00 2001 +From e8a3d13ea42fc7a4f654a1b1b419a5cf0e3a1edc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 016/103] [audio] Add settings option to boost centre channel +Subject: [PATCH 15/89] [audio] Add settings option to boost centre channel when downmixing This allows a dB volume increase to be added to centre channel. @@ -829,10 +795,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 8cd2b39..fa7c455 100644 +index 129f0c7..7f44813 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16587,3 +16587,17 @@ msgctxt "#38006" +@@ -16595,3 +16595,17 @@ msgctxt "#38006" msgid "Audio has to stay in sync, this can either be done by resampling, or adjusting the PLL" msgstr "" @@ -851,10 +817,10 @@ index 8cd2b39..fa7c455 100644 +msgid "%i dB" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 8395973..29a9ef6 100644 +index ad90e8c..ede89e4 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml -@@ -2640,6 +2640,18 @@ +@@ -2645,6 +2645,18 @@ true @@ -899,7 +865,7 @@ index e4ddf9e..34d0152 100644 if (remapLayout) { diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -index b037317..fa8112d 100644 +index 7807149..759ba7b 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp @@ -164,6 +164,12 @@ bool CActiveAEResamplePi::Init(uint64_t dst_chan_layout, int dst_channels, int d @@ -916,10 +882,10 @@ index b037317..fa8112d 100644 if (remapLayout) { diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 691b9a7..602d2fa 100644 +index f99c0e6..1911189 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -634,6 +634,12 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo +@@ -641,6 +641,12 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo { av_opt_set_double(m_pContext, "rematrix_maxval", 1.0, 0); } @@ -933,21 +899,20 @@ index 691b9a7..602d2fa 100644 // stereo upmix if (upmix && m_src_channels == 2 && m_dst_channels > 2) -From ccd32242f5696ac4e639cb2c686c277b876112f5 Mon Sep 17 00:00:00 2001 +From 726e56391004744900c2ab04c27e58a3e21f0d44 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 3 Oct 2014 18:40:06 +0100 -Subject: [PATCH 017/103] [SinkPi] Handle multichannel layout more like - OMXAudio +Subject: [PATCH 16/89] [SinkPi] Handle multichannel layout more like OMXAudio --- xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -index 318df3b..3cb6bfb 100644 +index a7691e8..d72a97a 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -@@ -93,9 +93,9 @@ static void SetAudioProps(bool stream_channels, uint32_t channel_map) +@@ -94,9 +94,9 @@ static void SetAudioProps(bool stream_channels, uint32_t channel_map) CLog::Log(LOGDEBUG, "%s:%s hdmi_stream_channels %d hdmi_channel_map %08x", CLASSNAME, __func__, stream_channels, channel_map); } @@ -959,7 +924,7 @@ index 318df3b..3cb6bfb 100644 uint32_t channel_map = 0; if (passthrough) return 0; -@@ -134,12 +134,12 @@ static uint32_t GetChannelMap(AEAudioFormat &format, bool passthrough) +@@ -135,12 +135,12 @@ static uint32_t GetChannelMap(AEAudioFormat &format, bool passthrough) // According to CEA-861-D only RL and RR are known. In case of a format having SL and SR channels // but no BR BL channels, we use the wide map in order to open only the num of channels really // needed. @@ -974,7 +939,7 @@ index 318df3b..3cb6bfb 100644 unsigned int chan = 0; if ((unsigned int)c < sizeof map_normal / sizeof *map_normal) chan = map[(unsigned int)c]; -@@ -170,9 +170,9 @@ static uint32_t GetChannelMap(AEAudioFormat &format, bool passthrough) +@@ -171,9 +171,9 @@ static uint32_t GetChannelMap(AEAudioFormat &format, bool passthrough) 0xff, // 7 0x13, // 7.1 }; @@ -986,7 +951,7 @@ index 318df3b..3cb6bfb 100644 channel_map |= cea << 24; -@@ -209,7 +209,7 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) +@@ -215,7 +215,7 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) format.m_frames = format.m_sampleRate * AUDIO_PLAYBUFFER / NUM_OMX_BUFFERS; format.m_frameSamples = format.m_frames * channels; @@ -996,10 +961,10 @@ index 318df3b..3cb6bfb 100644 m_format = format; m_sinkbuffer_sec_per_byte = 1.0 / (double)(m_format.m_frameSize * m_format.m_sampleRate); -From d54c0004c7889382e48a3b2015d7e6920fdae119 Mon Sep 17 00:00:00 2001 +From d424942bfc56c3d49521f7c6ac5410385d1147c8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 15:23:51 +0000 -Subject: [PATCH 018/103] [rbp] Default extract thumbnails to false +Subject: [PATCH 17/89] [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 @@ -1029,10 +994,11 @@ index cb83297..8496abf 100644
-From 49ef564d2e2c4f15a81fb727ed4abb03f299a66e Mon Sep 17 00:00:00 2001 + +From bdb2bce42352230100067f6ab19ac077ab391ca9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 15 Nov 2014 12:03:34 +0000 -Subject: [PATCH 022/103] [dvdplayer] Add lock for player creation +Subject: [PATCH 21/89] [dvdplayer] Add lock for player creation --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 3 +++ @@ -1078,10 +1044,10 @@ index 468239c..3b8cefb 100644 + CCriticalSection m_players_lock; }; -From d2e6086e65aa2bb6fee41c413db5cac0e31b2c0e Mon Sep 17 00:00:00 2001 +From a40900ba3edf82d8ba63eb3e5e2ffd9a9810e42e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 24 Nov 2014 22:07:25 +0000 -Subject: [PATCH 023/103] [dvdplayervideo] Prod decoder when in stills mode +Subject: [PATCH 22/89] [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. @@ -1158,10 +1124,10 @@ index 69dc501..5832c58 100644 if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE)) -From 4f95fb3b9cacf2e968291b0bc448df6ce684928b Mon Sep 17 00:00:00 2001 +From 8674cc04f73067ac9b26562f5ed1bbc87b61571c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 27 Nov 2014 16:31:56 +0000 -Subject: [PATCH 024/103] [languageinvoker] Reduce priority of python threads +Subject: [PATCH 23/89] [languageinvoker] Reduce priority of python threads --- xbmc/interfaces/generic/LanguageInvokerThread.cpp | 5 +++++ @@ -1184,10 +1150,10 @@ index fcdd063..16f0c89 100644 } -From 4ac74fa770ca65859284e1541d1b8ef5ed658d30 Mon Sep 17 00:00:00 2001 +From c0d94a5d0a90ac3e0c8304f551d59ae150a04ccb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Dec 2013 16:55:05 +0000 -Subject: [PATCH 025/103] logging: Add microsecond timer to log messages +Subject: [PATCH 24/89] logging: Add microsecond timer to log messages --- xbmc/utils/log.cpp | 17 +++++++++++++++-- @@ -1240,10 +1206,10 @@ index 3443f12..31c4a99 100644 levelNames[logLevel]) + strData; -From 602c2edc4b65379dd6872e245ced5f240505f932 Mon Sep 17 00:00:00 2001 +From 9148d35d4664d75cfa38af607202cb79e535d425 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:24:42 +0200 -Subject: [PATCH 026/103] Added some vc_tv_* functions that were missing in +Subject: [PATCH 25/89] Added some vc_tv_* functions that were missing in DllBCM. --- @@ -1278,10 +1244,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 cac8aa5c89dbfe566b0d410bb4b66012b0ffaa2c Mon Sep 17 00:00:00 2001 +From 1c09b17c3d8d8631708d0feaa2b03ac38451d23b Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:29:03 +0200 -Subject: [PATCH 027/103] Added private utility function to map a float display +Subject: [PATCH 26/89] Added private utility function to map a float display aspect, to the respective SDTV_ASPECT_* enum value. --- @@ -1289,7 +1255,7 @@ Subject: [PATCH 027/103] Added private utility function to map a float display 1 file changed, 19 insertions(+) diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 98072e8..da36944 100644 +index 68fc647..6b1f3b9 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp @@ -412,6 +412,25 @@ static void SetResolutionString(RESOLUTION_INFO &res) @@ -1319,10 +1285,10 @@ index 98072e8..da36944 100644 bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &resolutions) -From 3861ee5d79e6daa334b19247ace9753027fad450 Mon Sep 17 00:00:00 2001 +From d339ba599375b756dbbe5e878519b3b02f19d8bd Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:50:58 +0200 -Subject: [PATCH 028/103] Changed SDTV resolutions to be treated similarly to +Subject: [PATCH 27/89] 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. @@ -1332,7 +1298,7 @@ Subject: [PATCH 028/103] Changed SDTV resolutions to be treated similarly to 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index da36944..2ebd74c 100644 +index 6b1f3b9..4826d37 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp @@ -222,7 +222,7 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) @@ -1376,7 +1342,7 @@ index da36944..2ebd74c 100644 + m_desktopRes = res; + } - m_dispman_display = m_DllBcmHost->vc_dispmanx_display_open(0); + m_dispman_display = g_RBP.OpenDisplay(0); @@ -441,8 +468,6 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r if(!m_DllBcmHost) @@ -1419,10 +1385,10 @@ index 59401f5..a0acb1a 100644 int m_width; int m_height; -From bfe83fe7109a35fc5b323cd71fededa78375cc8f Mon Sep 17 00:00:00 2001 +From 8ebee675392f628fd18e803d549f69fcac428f01 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:54:59 +0200 -Subject: [PATCH 029/103] Added methods SuspendVideoOutput() and +Subject: [PATCH 28/89] Added methods SuspendVideoOutput() and ResumeVideoOutput() to CRBP class, which can be used to power down the Raspberry PI's video interface, and restore it at a later point. @@ -1433,10 +1399,10 @@ Subject: [PATCH 029/103] Added methods SuspendVideoOutput() and 3 files changed, 19 insertions(+) diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index ce09fce..a18aa49 100644 +index a4b0c2a..160eb96 100644 --- a/xbmc/linux/RBP.cpp +++ b/xbmc/linux/RBP.cpp -@@ -225,5 +225,18 @@ double CRBP::AdjustHDMIClock(double adjust) +@@ -233,5 +233,18 @@ double CRBP::AdjustHDMIClock(double adjust) return new_adjust; } @@ -1456,10 +1422,10 @@ index ce09fce..a18aa49 100644 #endif diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index 6456657..606c24f 100644 +index 65492fa..38fb252 100644 --- a/xbmc/linux/RBP.h +++ b/xbmc/linux/RBP.h -@@ -60,6 +60,9 @@ class CRBP +@@ -65,6 +65,9 @@ class CRBP void WaitVsync(); double AdjustHDMIClock(double adjust); @@ -1470,7 +1436,7 @@ index 6456657..606c24f 100644 DllBcmHost *m_DllBcmHost; bool m_initialized; diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 2ebd74c..335f6d5 100644 +index 4826d37..7d9b0d3 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp @@ -60,7 +60,10 @@ @@ -1485,12 +1451,12 @@ index 2ebd74c..335f6d5 100644 CEGLNativeTypeRaspberryPI::CEGLNativeTypeRaspberryPI() { -From b3fc8a5fc3e58091b95aa0f2ca9f78353ce27c9e Mon Sep 17 00:00:00 2001 +From 0739fee7877f4856d12321465b2b9744de086b46 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 11 Aug 2013 15:03:36 +0100 -Subject: [PATCH 030/103] PowerManager (and its IPowerSyscall instance) now - gets called from CApplication::OnKey() and can process and suppress key - presses. This is a requirement to implement a virtual sleep state. +Subject: [PATCH 29/89] PowerManager (and its IPowerSyscall instance) now gets + called from CApplication::OnKey() and can process and suppress key presses. + This is a requirement to implement a virtual sleep state. --- xbmc/Application.cpp | 1 - @@ -1501,10 +1467,10 @@ Subject: [PATCH 030/103] PowerManager (and its IPowerSyscall instance) now 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 51fdf84..e00916a 100644 +index 135b466..df6e8ca 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -2037,7 +2037,6 @@ void CApplication::SetStandAlone(bool value) +@@ -2043,7 +2043,6 @@ void CApplication::SetStandAlone(bool value) g_advancedSettings.m_handleMounting = m_bStandalone = value; } @@ -1602,12 +1568,12 @@ index 0b1f10a..e42b143 100644 void OnSleep(); void OnWake(); -From bdd759a61f9ff2da25014aa45da9997fd51bd7a6 Mon Sep 17 00:00:00 2001 +From 94a8bac3feaeed3edd78e9e49f209b92ef5c87f9 Mon Sep 17 00:00:00 2001 From: macrule Date: Wed, 17 Apr 2013 13:23:01 +0200 -Subject: [PATCH 031/103] Added CPowerSyscallVirtualSleep class, which acts as - a base class for devices that have no native standby mode, and need to fake - it in some way. +Subject: [PATCH 30/89] Added CPowerSyscallVirtualSleep class, which acts as a + base class for devices that have no native standby mode, and need to fake it + in some way. --- xbmc/powermanagement/Makefile | 1 + @@ -1781,10 +1747,10 @@ index 0000000..ef6e682 + +#endif // _POWER_SYSCALL_VIRTUAL_SLEEP_H_ -From 33be5d47278da30a21fda820324af9a3423fb2e8 Mon Sep 17 00:00:00 2001 +From 4e72dbc0c34cd319b3168551ee14ebc6ea78739c Mon Sep 17 00:00:00 2001 From: macrule Date: Wed, 17 Apr 2013 13:24:22 +0200 -Subject: [PATCH 032/103] Added power management support for the Raspberry Pi. +Subject: [PATCH 31/89] Added power management support for the Raspberry Pi. Since it doesn't support true standby, we fake it by turning video on or off, and ignoring remote inputs during the standby phase. @@ -1930,10 +1896,10 @@ index 0000000..fd1d67c + +#endif // _RASPBERRY_PI_POWER_SYSCALL_H_ -From 709dfc42ba253ec392a266efa986b3da0f2020b2 Mon Sep 17 00:00:00 2001 +From 1e00d7bc6e5e193d12b3224d6801fb1dc8bf3b61 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 16:16:29 +0000 -Subject: [PATCH 033/103] [power] hack - don't kill lirc or cec +Subject: [PATCH 32/89] [power] hack - don't kill lirc or cec --- xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 37 +++++++++++++++++++++++ @@ -2017,10 +1983,10 @@ index 2d8c750..901f449 100644 CBuiltins::Execute("LIRC.Start"); #endif -From d3f8b6d306df8585bf4109b29bcab90c8a938ab4 Mon Sep 17 00:00:00 2001 +From ca8103aa0469ee82fe6da538e2d19cf33cabfc2c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 16:47:54 +0000 -Subject: [PATCH 034/103] [power] hack - wake on any action +Subject: [PATCH 33/89] [power] hack - wake on any action --- xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 6 +++--- @@ -2049,10 +2015,10 @@ index 9e6c8e4..78566ec 100644 if(VirtualWake()) { -From 27bc221d7dd08c12f07a7c3b7ddef78e19798777 Mon Sep 17 00:00:00 2001 +From 2db6f609de8998c2db449d0471699e02c6a6f46c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 17:30:07 +0000 -Subject: [PATCH 035/103] [power] hack - Make suspend toggle suspend state +Subject: [PATCH 34/89] [power] hack - Make suspend toggle suspend state --- xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 5 +++++ @@ -2075,10 +2041,10 @@ index 78566ec..4cffcce 100644 return false; } -From 8609e7646814b273206d83b4fb973eab4ce768fe Mon Sep 17 00:00:00 2001 +From c42ebe26c18468fb40569e4f5b0eb387ac835670 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 4 Mar 2014 19:33:44 +0000 -Subject: [PATCH 036/103] [power] Add back in powerdown and reboot +Subject: [PATCH 35/89] [power] Add back in powerdown and reboot --- .../linux/RaspberryPIPowerSyscall.cpp | 34 ++++++++++++++++++++++ @@ -2156,11 +2122,11 @@ index fd1d67c..062132e 100644 virtual bool CanReboot() { return true; } -From c8eceb5866e755200441f9301d96d6cf99760b77 Mon Sep 17 00:00:00 2001 +From 21ff1d4748a4297716e53e78b347cf0f1c60ff4c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 26 Apr 2014 17:27:52 +0100 -Subject: [PATCH 037/103] [cec] Don't suspend pi on tv switch off - it can't - wake up +Subject: [PATCH 36/89] [cec] Don't suspend pi on tv switch off - it can't wake + up --- system/peripherals.xml | 2 +- @@ -2180,20 +2146,20 @@ index 094a3c1..0b89ee8 100644 -From 15b45e982c686259159223839618d0422c789f92 Mon Sep 17 00:00:00 2001 +From 2697d6cb2ff2bbbb7be8fd40370e654c227a1b86 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 27 Jun 2014 00:01:05 +0100 -Subject: [PATCH 038/103] [rbp] Resume video output on startup +Subject: [PATCH 37/89] [rbp] Resume video output on startup --- xbmc/linux/RBP.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index a18aa49..6514c2d 100644 +index 160eb96..1472d10 100644 --- a/xbmc/linux/RBP.cpp +++ b/xbmc/linux/RBP.cpp -@@ -88,6 +88,9 @@ bool CRBP::Initialize() +@@ -86,6 +86,9 @@ bool CRBP::Initialize() if (g_advancedSettings.m_cacheMemBufferSize == ~0U) g_advancedSettings.m_cacheMemBufferSize = m_arm_mem < 256 ? 1024 * 1024 * 2 : 1024 * 1024 * 20; @@ -2204,10 +2170,10 @@ index a18aa49..6514c2d 100644 m_omx_image_init = true; return true; -From 20f0bf8ef85a8c11b6fe4b6318ee925b753a9097 Mon Sep 17 00:00:00 2001 +From 266a5a51a12a418f95c2c366e147e0c5e9c6eaee Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 11 Apr 2014 16:12:27 +0100 -Subject: [PATCH 039/103] [omxplayer] Add ability to log more timestamp info in +Subject: [PATCH 38/89] [omxplayer] Add ability to log more timestamp info in extra debug settings --- @@ -2220,10 +2186,10 @@ Subject: [PATCH 039/103] [omxplayer] Add ability to log more timestamp info in 6 files changed, 25 insertions(+), 13 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 22a1696..5fc9d65 100644 +index 804e295..1b70492 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2908,6 +2908,11 @@ msgctxt "#680" +@@ -2915,6 +2915,11 @@ msgctxt "#680" msgid "Verbose logging for VIDEO component" msgstr "" @@ -2317,7 +2283,7 @@ index c2da2d2..2f1df45 100644 { // we are not running until something is cached in output device diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index bee7086..4e599e3 100644 +index 5ca7665..8becff1 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp @@ -42,6 +42,7 @@ @@ -2344,7 +2310,7 @@ index bee7086..4e599e3 100644 || m_speed < 0) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 59d45c8..e46233a 100644 +index 76b5ce8..139e12d 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -1364,6 +1364,9 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se @@ -2358,10 +2324,10 @@ index 59d45c8..e46233a 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From 61c67e0ee0a882807b80a4ad85c5c9a476fc58b0 Mon Sep 17 00:00:00 2001 +From ba20c596cce9f4e3e6112921182a25c899847c7d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 040/103] [omxplayer] Add ability to dump out audio/video data +Subject: [PATCH 39/89] [omxplayer] Add ability to dump out audio/video data for later debugging --- @@ -2373,10 +2339,10 @@ Subject: [PATCH 040/103] [omxplayer] Add ability to dump out audio/video data 5 files changed, 112 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 5fc9d65..caf6ee6 100644 +index 1b70492..19b94b5 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2913,6 +2913,16 @@ msgctxt "#697" +@@ -2920,6 +2920,16 @@ msgctxt "#697" msgid "Verbose logging for OMXPLAYER" msgstr "" @@ -2407,7 +2373,7 @@ index e4ffb5e..4f8926c 100644 #include "utils/params_check_macros.h" diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 602d2fa..0b8fd69 100644 +index 1911189..6dff6aa 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp @@ -56,6 +56,49 @@ using namespace std; @@ -2460,7 +2426,7 @@ index 602d2fa..0b8fd69 100644 ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// -@@ -868,6 +911,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo +@@ -871,6 +914,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo memcpy((unsigned char *)omx_buffer->pBuffer, &m_wave_header, omx_buffer->nFilledLen); omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; @@ -2468,7 +2434,7 @@ index 602d2fa..0b8fd69 100644 omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); if (omx_err != OMX_ErrorNone) { -@@ -900,6 +944,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo +@@ -899,6 +943,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo memcpy((unsigned char *)omx_buffer->pBuffer, m_extradata, omx_buffer->nFilledLen); omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; @@ -2485,15 +2451,15 @@ index 602d2fa..0b8fd69 100644 if ( m_omx_tunnel_clock_analog.IsInitialized() ) m_omx_tunnel_clock_analog.Deestablish(); if ( m_omx_tunnel_clock_hdmi.IsInitialized() ) -@@ -1226,6 +1273,7 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt - int nRetry = 0; - while(true) +@@ -1223,6 +1270,7 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt + if(demuxer_samples_sent == demuxer_samples) + omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; + ++ dump_omx_buffer(omx_buffer); + omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); + if (omx_err != OMX_ErrorNone) { -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err == OMX_ErrorNone) - { -@@ -1473,6 +1521,7 @@ void COMXAudio::SubmitEOS() +@@ -1461,6 +1509,7 @@ void COMXAudio::SubmitEOS() omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; @@ -2502,7 +2468,7 @@ index 602d2fa..0b8fd69 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 55e16c4..4489546 100644 +index ca40a37..0fb426c 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp @@ -65,6 +65,49 @@ @@ -2555,7 +2521,7 @@ index 55e16c4..4489546 100644 COMXVideo::COMXVideo() : m_video_codec_name("") { m_is_open = false; -@@ -120,6 +163,7 @@ bool COMXVideo::SendDecoderConfig() +@@ -115,6 +158,7 @@ bool COMXVideo::SendDecoderConfig() memcpy((unsigned char *)omx_buffer->pBuffer, m_extradata, omx_buffer->nFilledLen); omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; @@ -2563,7 +2529,7 @@ index 55e16c4..4489546 100644 omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); if (omx_err != OMX_ErrorNone) { -@@ -697,6 +741,7 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de +@@ -692,6 +736,7 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de void COMXVideo::Close() { CSingleLock lock (m_critSection); @@ -2571,15 +2537,15 @@ index 55e16c4..4489546 100644 m_omx_tunnel_clock.Deestablish(); m_omx_tunnel_decoder.Deestablish(); if(m_deinterlace) -@@ -815,6 +860,7 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) - int nRetry = 0; - while(true) +@@ -807,6 +852,7 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) + if(demuxer_bytes == 0) + omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; + ++ dump_omx_buffer(omx_buffer); + omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); + if (omx_err != OMX_ErrorNone) { -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err == OMX_ErrorNone) - { -@@ -945,6 +991,7 @@ void COMXVideo::SubmitEOS() +@@ -928,6 +974,7 @@ void COMXVideo::SubmitEOS() omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; @@ -2588,7 +2554,7 @@ index 55e16c4..4489546 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index e46233a..9119877 100644 +index 139e12d..ea45381 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -1367,6 +1367,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se @@ -2603,243 +2569,11 @@ index e46233a..9119877 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From 3d935ad808f8f753468091b5f7461d0cc4b781a6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 18 Aug 2014 19:09:32 +0100 -Subject: [PATCH 041/103] rbp: Use new dispmanx function for vsync callbacks - ---- - xbmc/linux/RBP.cpp | 86 ++++++++++++++----------- - xbmc/linux/RBP.h | 7 +- - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 +- - 3 files changed, 55 insertions(+), 42 deletions(-) - -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index 6514c2d..fe1df00 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -21,6 +21,7 @@ - #include "RBP.h" - #if defined(TARGET_RASPBERRY_PI) - -+#include - #include "settings/Settings.h" - #include "settings/AdvancedSettings.h" - #include "utils/log.h" -@@ -33,7 +34,7 @@ CRBP::CRBP() - m_omx_initialized = false; - m_DllBcmHost = new DllBcmHost(); - m_OMX = new COMXCore(); -- m_element = 0; -+ m_display = DISPMANX_NO_HANDLE; - } - - CRBP::~CRBP() -@@ -55,8 +56,7 @@ bool CRBP::Initialize() - - m_DllBcmHost->bcm_host_init(); - -- uint32_t vc_image_ptr; -- m_resource = vc_dispmanx_resource_create( VC_IMAGE_RGB565, 1, 1, &vc_image_ptr ); -+ //OpenDisplay(0 /*screen*/); - - m_omx_initialized = m_OMX->Initialize(); - if(!m_omx_initialized) -@@ -112,13 +112,24 @@ void CRBP::LogFirmwareVerison() - CLog::Log(LOGNOTICE, "Config:\n%s", response); - } - -+DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) -+{ -+ if (m_display == DISPMANX_NO_HANDLE) -+ m_display = vc_dispmanx_display_open( 0 /*screen*/ ); -+ return m_display; -+} -+ -+void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display) -+{ -+ assert(display == m_display); -+ vc_dispmanx_display_close(m_display); -+ m_display = DISPMANX_NO_HANDLE; -+} -+ - void CRBP::GetDisplaySize(int &width, int &height) - { -- DISPMANX_DISPLAY_HANDLE_T display; - DISPMANX_MODEINFO_T info; -- -- display = vc_dispmanx_display_open( 0 /*screen*/ ); -- if (vc_dispmanx_display_get_info(display, &info) == 0) -+ if (vc_dispmanx_display_get_info(m_display, &info) == 0) - { - width = info.width; - height = info.height; -@@ -128,12 +139,10 @@ void CRBP::GetDisplaySize(int &width, int &height) - width = 0; - height = 0; - } -- vc_dispmanx_display_close(display ); - } - - unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool swap_red_blue, bool video_only) - { -- DISPMANX_DISPLAY_HANDLE_T display; - DISPMANX_RESOURCE_HANDLE_T resource; - VC_RECT_T rect; - unsigned char *image = NULL; -@@ -148,7 +157,6 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw - if (!pstride) - flags |= DISPMANX_SNAPSHOT_PACK; - -- display = vc_dispmanx_display_open( 0 /*screen*/ ); - stride = ((width + 15) & ~15) * 4; - image = new unsigned char [height * stride]; - -@@ -156,45 +164,44 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw - { - resource = vc_dispmanx_resource_create( VC_IMAGE_RGBA32, width, height, &vc_image_ptr ); - -- vc_dispmanx_snapshot(display, resource, (DISPMANX_TRANSFORM_T)flags); -+ assert(m_display != DISPMANX_NO_HANDLE); -+ vc_dispmanx_snapshot(m_display, resource, (DISPMANX_TRANSFORM_T)flags); - - vc_dispmanx_rect_set(&rect, 0, 0, width, height); - vc_dispmanx_resource_read_data(resource, &rect, image, stride); - vc_dispmanx_resource_delete( resource ); -- vc_dispmanx_display_close(display ); - } - if (pstride) - *pstride = stride; - return image; - } - --void CRBP::WaitVsync(void) -+ -+static void vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *arg) - { -- DISPMANX_DISPLAY_HANDLE_T display = vc_dispmanx_display_open( 0 /*screen*/ ); -- DISPMANX_UPDATE_HANDLE_T update = vc_dispmanx_update_start(0); -- -- VC_DISPMANX_ALPHA_T alpha = { (DISPMANX_FLAGS_ALPHA_T)(DISPMANX_FLAGS_ALPHA_FROM_SOURCE | DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS), 120, /*alpha 0->255*/ 0 }; -- VC_RECT_T src_rect; -- VC_RECT_T dst_rect; -- vc_dispmanx_rect_set( &src_rect, 0, 0, 1 << 16, 1 << 16 ); -- vc_dispmanx_rect_set( &dst_rect, 0, 0, 1, 1 ); -- -- if (m_element) -- vc_dispmanx_element_remove( update, m_element ); -- -- m_element = vc_dispmanx_element_add( update, -- display, -- 2000, // layer -- &dst_rect, -- m_resource, -- &src_rect, -- DISPMANX_PROTECTION_NONE, -- &alpha, -- NULL, // clamp -- (DISPMANX_TRANSFORM_T)0 ); -- -- vc_dispmanx_update_submit_sync(update); -- vc_dispmanx_display_close( display ); -+ 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.Wait(); -+ } -+ else assert(0); -+ s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); -+ assert(s == 0); -+ vc_dispmanx_display_close( m_display ); - } - - -@@ -206,6 +213,9 @@ void CRBP::Deinitialize() - if(m_omx_initialized) - m_OMX->Deinitialize(); - -+ if (m_display) -+ CloseDisplay(m_display); -+ - m_DllBcmHost->bcm_host_deinit(); - - if(m_initialized) -diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index 606c24f..82146d6 100644 ---- a/xbmc/linux/RBP.h -+++ b/xbmc/linux/RBP.h -@@ -38,6 +38,7 @@ - #include "DllBCM.h" - #include "OMXCore.h" - #include "threads/CriticalSection.h" -+#include "threads/Event.h" - - class CRBP - { -@@ -53,6 +54,8 @@ class CRBP - bool GetCodecMpg2() { return m_codec_mpg2_enabled; } - bool GetCodecWvc1() { return m_codec_wvc1_enabled; } - void GetDisplaySize(int &width, int &height); -+ DISPMANX_DISPLAY_HANDLE_T OpenDisplay(uint32_t device); -+ void CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display); - int GetGUIResolutionLimit() { return m_gui_resolution_limit; } - // stride can be null for packed output - unsigned char *CaptureDisplay(int width, int height, int *stride, bool swap_red_blue, bool video_only = true); -@@ -74,10 +77,10 @@ class CRBP - bool m_codec_mpg2_enabled; - bool m_codec_wvc1_enabled; - COMXCore *m_OMX; -- DISPMANX_RESOURCE_HANDLE_T m_resource; -- DISPMANX_ELEMENT_HANDLE_T m_element; - class DllLibOMXCore; - CCriticalSection m_critSection; -+ DISPMANX_DISPLAY_HANDLE_T m_display; -+ CEvent m_vsync; - }; - - extern CRBP g_RBP; -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 335f6d5..7d9b0d3 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -307,7 +307,7 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) - m_desktopRes = res; - } - -- m_dispman_display = m_DllBcmHost->vc_dispmanx_display_open(0); -+ m_dispman_display = g_RBP.OpenDisplay(0); - - m_width = res.iWidth; - m_height = res.iHeight; -@@ -578,7 +578,7 @@ void CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow() - - if (m_dispman_display != DISPMANX_NO_HANDLE) - { -- m_DllBcmHost->vc_dispmanx_display_close(m_dispman_display); -+ g_RBP.CloseDisplay(m_dispman_display); - m_dispman_display = DISPMANX_NO_HANDLE; - } - DLOG("CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow\n"); - -From 648a6b3b7564b05e77b0039560755225c02852c4 Mon Sep 17 00:00:00 2001 +From 4f9a70ab2488ac8b8dd154613e368a0060493d88 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Nov 2014 17:16:54 +0000 -Subject: [PATCH 042/103] Revert "[omxplayer] Add ability to dump out - audio/video data for later debugging" +Subject: [PATCH 40/89] Revert "[omxplayer] Add ability to dump out audio/video + data for later debugging" This reverts commit 417416bd29d00f1b42c77488d06e9e6840b8c4f4. --- @@ -2851,10 +2585,10 @@ This reverts commit 417416bd29d00f1b42c77488d06e9e6840b8c4f4. 5 files changed, 112 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index caf6ee6..5fc9d65 100644 +index 19b94b5..1b70492 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2913,16 +2913,6 @@ msgctxt "#697" +@@ -2920,16 +2920,6 @@ msgctxt "#697" msgid "Verbose logging for OMXPLAYER" msgstr "" @@ -2885,7 +2619,7 @@ index 4f8926c..e4ffb5e 100644 #include "utils/params_check_macros.h" diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 0b8fd69..602d2fa 100644 +index 6dff6aa..1911189 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp @@ -56,49 +56,6 @@ using namespace std; @@ -2938,7 +2672,7 @@ index 0b8fd69..602d2fa 100644 ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// -@@ -911,7 +868,6 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo +@@ -914,7 +871,6 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo memcpy((unsigned char *)omx_buffer->pBuffer, &m_wave_header, omx_buffer->nFilledLen); omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; @@ -2946,7 +2680,7 @@ index 0b8fd69..602d2fa 100644 omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); if (omx_err != OMX_ErrorNone) { -@@ -944,7 +900,6 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo +@@ -943,7 +899,6 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo memcpy((unsigned char *)omx_buffer->pBuffer, m_extradata, omx_buffer->nFilledLen); omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; @@ -2963,15 +2697,15 @@ index 0b8fd69..602d2fa 100644 if ( m_omx_tunnel_clock_analog.IsInitialized() ) m_omx_tunnel_clock_analog.Deestablish(); if ( m_omx_tunnel_clock_hdmi.IsInitialized() ) -@@ -1273,7 +1226,6 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt - int nRetry = 0; - while(true) +@@ -1270,7 +1223,6 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt + if(demuxer_samples_sent == demuxer_samples) + omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; + +- dump_omx_buffer(omx_buffer); + omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); + if (omx_err != OMX_ErrorNone) { -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err == OMX_ErrorNone) - { -@@ -1521,7 +1473,6 @@ void COMXAudio::SubmitEOS() +@@ -1509,7 +1461,6 @@ void COMXAudio::SubmitEOS() omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; @@ -2980,7 +2714,7 @@ index 0b8fd69..602d2fa 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 4489546..55e16c4 100644 +index 0fb426c..ca40a37 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp @@ -65,49 +65,6 @@ @@ -3033,7 +2767,7 @@ index 4489546..55e16c4 100644 COMXVideo::COMXVideo() : m_video_codec_name("") { m_is_open = false; -@@ -163,7 +120,6 @@ bool COMXVideo::SendDecoderConfig() +@@ -158,7 +115,6 @@ bool COMXVideo::SendDecoderConfig() memcpy((unsigned char *)omx_buffer->pBuffer, m_extradata, omx_buffer->nFilledLen); omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; @@ -3041,7 +2775,7 @@ index 4489546..55e16c4 100644 omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); if (omx_err != OMX_ErrorNone) { -@@ -741,7 +697,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de +@@ -736,7 +692,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de void COMXVideo::Close() { CSingleLock lock (m_critSection); @@ -3049,15 +2783,15 @@ index 4489546..55e16c4 100644 m_omx_tunnel_clock.Deestablish(); m_omx_tunnel_decoder.Deestablish(); if(m_deinterlace) -@@ -860,7 +815,6 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) - int nRetry = 0; - while(true) +@@ -852,7 +807,6 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) + if(demuxer_bytes == 0) + omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; + +- dump_omx_buffer(omx_buffer); + omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); + if (omx_err != OMX_ErrorNone) { -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err == OMX_ErrorNone) - { -@@ -991,7 +945,6 @@ void COMXVideo::SubmitEOS() +@@ -974,7 +928,6 @@ void COMXVideo::SubmitEOS() omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; @@ -3066,7 +2800,7 @@ index 4489546..55e16c4 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 9119877..e46233a 100644 +index ea45381..139e12d 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -1367,10 +1367,6 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se @@ -3081,10 +2815,10 @@ index 9119877..e46233a 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From 14bfe644ca9aba1a482bf631ca0fa714d4502b61 Mon Sep 17 00:00:00 2001 +From 1dd87e754c11ac47b4e96eb465b5503206a04aef Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 043/103] [omxplayer] Add ability to dump out audio/video data +Subject: [PATCH 41/89] [omxplayer] Add ability to dump out audio/video data for later debugging --- @@ -3095,10 +2829,10 @@ Subject: [PATCH 043/103] [omxplayer] Add ability to dump out audio/video data 4 files changed, 79 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 5fc9d65..caf6ee6 100644 +index 1b70492..19b94b5 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2913,6 +2913,16 @@ msgctxt "#697" +@@ -2920,6 +2920,16 @@ msgctxt "#697" msgid "Verbose logging for OMXPLAYER" msgstr "" @@ -3217,7 +2951,7 @@ index 3c313cd..8ceb498 100644 if(player) player->CloseStream(bWaitForBuffers); diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index e46233a..9119877 100644 +index 139e12d..ea45381 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -1367,6 +1367,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se @@ -3232,11 +2966,11 @@ index e46233a..9119877 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From 718edc6ac5a59f2473592bd4646f54f904807a6f Mon Sep 17 00:00:00 2001 +From c5426decde782f01e418f10fa2b4221b1b8e6157 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 29 Nov 2014 15:25:16 +0000 -Subject: [PATCH 044/103] [rbp] hack: wait for splash to complete before - changing hdmi mode +Subject: [PATCH 42/89] [rbp] hack: wait for splash to complete before changing + hdmi mode --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 49 +++++++++++++++++++++++++ @@ -3309,10 +3043,10 @@ index 7d9b0d3..d388373 100644 if(GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) -From 0b3bfb6bac019ffbd0af4689fbdd3e785cc44957 Mon Sep 17 00:00:00 2001 +From 9ed5eff1125f8484ce829b87342fb99856ef8bea Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 5 Oct 2014 14:05:25 +0100 -Subject: [PATCH 045/103] [PiSink] Allow audio output latency to be set in +Subject: [PATCH 43/89] [PiSink] Allow audio output latency to be set in settings --- @@ -3323,10 +3057,10 @@ Subject: [PATCH 045/103] [PiSink] Allow audio output latency to be set in 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index caf6ee6..7b1089d 100644 +index 19b94b5..37932be 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16631,3 +16631,18 @@ msgstr "" +@@ -16639,3 +16639,18 @@ msgstr "" msgctxt "#38052" msgid "Remote button press release time (ms)" msgstr "" @@ -3369,7 +3103,7 @@ index 8496abf..5068b20 100644 diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -index 3cb6bfb..363b7d5 100644 +index d72a97a..b69925a 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp @@ -35,7 +35,6 @@ @@ -3387,18 +3121,18 @@ index 3cb6bfb..363b7d5 100644 + m_latency(0), m_Initialized(false), m_submitted(0), - m_omx_output(NULL) -@@ -190,6 +190,9 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) + m_omx_output(NULL), +@@ -191,6 +191,9 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) m_initDevice = device; m_initFormat = format; + m_latency = CSettings::Get().GetInt("audiooutput.latency") * 1e-3; + m_latency = std::max(m_latency, 50e-3); + - // analogue only supports stereo - if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue" || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") - { -@@ -206,7 +209,7 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) + if (m_passthrough || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:HDMI") + m_output = AESINKPI_HDMI; + else if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") +@@ -212,7 +215,7 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) unsigned int sample_size = CAEUtil::DataFormatToBits(format.m_dataFormat) >> 3; format.m_frameSize = sample_size * channels; format.m_sampleRate = std::max(8000U, std::min(192000U, format.m_sampleRate)); @@ -3407,7 +3141,7 @@ index 3cb6bfb..363b7d5 100644 format.m_frameSamples = format.m_frames * channels; SetAudioProps(m_passthrough, GetChannelMap(format.m_channelLayout, m_passthrough)); -@@ -421,7 +424,7 @@ void CAESinkPi::GetDelay(AEDelayStatus& status) +@@ -427,7 +430,7 @@ void CAESinkPi::GetDelay(AEDelayStatus& status) double CAESinkPi::GetCacheTotal() { @@ -3416,7 +3150,7 @@ index 3cb6bfb..363b7d5 100644 } unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned int offset) -@@ -469,8 +472,8 @@ unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned +@@ -478,8 +481,8 @@ unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned m_submitted++; GetDelay(status); delay = status.GetDelay(); @@ -3428,7 +3162,7 @@ index 3cb6bfb..363b7d5 100644 } diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.h b/xbmc/cores/AudioEngine/Sinks/AESinkPi.h -index 5c57999..cac5051 100644 +index 55ae1b4..10b0ec6 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.h +++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.h @@ -53,6 +53,7 @@ class CAESinkPi : public IAESink @@ -3440,10 +3174,10 @@ index 5c57999..cac5051 100644 bool m_Initialized; uint32_t m_submitted; -From 15eeb598e03a492404dfb754a0eb5e07342f990e Mon Sep 17 00:00:00 2001 +From 3a60bf2bb5ce7d064c719ec96d385cf8167a7b04 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 11 Dec 2014 17:00:57 +0000 -Subject: [PATCH 046/103] Fix for UI not showing both extractflags and +Subject: [PATCH 44/89] Fix for UI not showing both extractflags and extractthumb --- @@ -3453,10 +3187,10 @@ Subject: [PATCH 046/103] Fix for UI not showing both extractflags and 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 7b1089d..e8d5f7c 100644 +index 37932be..647befc 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -10974,7 +10974,7 @@ msgstr "" +@@ -10979,7 +10979,7 @@ msgstr "" #: system/settings/settings.xml msgctxt "#20433" @@ -3465,7 +3199,7 @@ index 7b1089d..e8d5f7c 100644 msgstr "" #: xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp -@@ -14501,7 +14501,7 @@ msgstr "" +@@ -14509,7 +14509,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36178" @@ -3474,7 +3208,7 @@ index 7b1089d..e8d5f7c 100644 msgstr "" #. Description of setting "Videos -> File lists -> Replace file names with library titles" with label #20419 -@@ -14513,7 +14513,7 @@ msgstr "" +@@ -14521,7 +14521,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36180" @@ -3483,13 +3217,13 @@ index 7b1089d..e8d5f7c 100644 msgstr "" #: system/settings/settings.xml -@@ -16646,3 +16646,8 @@ msgstr "" +@@ -16654,3 +16654,8 @@ msgstr "" msgctxt "#38102" msgid "%i ms" msgstr "" + +#: system/settings/settings.xml -+msgctxt "#38015" ++msgctxt "#38103" +msgid "Extract thumbnails from video files" +msgstr "" diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml @@ -3508,10 +3242,10 @@ index 5068b20..6e9ceaf 100644 false diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 29a9ef6..bdba486 100644 +index ede89e4..f3022c3 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml -@@ -899,23 +899,23 @@ +@@ -902,23 +902,23 @@ @@ -3528,7 +3262,7 @@ index 29a9ef6..bdba486 100644 - -+ ++ 1 true @@ -3541,10 +3275,10 @@ index 29a9ef6..bdba486 100644 -From b2a98eb56639907c3305775d0fcaee9f6bc0f03e Mon Sep 17 00:00:00 2001 +From 85c30bde9f23146c332ffeaeecf2c0de5b784900 Mon Sep 17 00:00:00 2001 From: anaconda Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 047/103] Disable autoscrolling while on screensaver and while +Subject: [PATCH 45/89] Disable autoscrolling while on screensaver and while opening streams. --- @@ -3557,10 +3291,10 @@ Subject: [PATCH 047/103] Disable autoscrolling while on screensaver and while 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index e00916a..6e0aeff 100644 +index df6e8ca..5889613 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -4948,3 +4948,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const +@@ -4959,3 +4959,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const return false; } @@ -3675,10 +3409,10 @@ index 0d5b3f7..6d23024 100644 if (m_lastRenderTime) m_autoScrollDelayTime += currentTime - m_lastRenderTime; -From 7b7f2ac4ef55297e4328736678a5ed436f83a830 Mon Sep 17 00:00:00 2001 +From 67692cfba74ca0e49e21c805c503605501fb5de2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 13 Dec 2014 18:35:20 +0000 -Subject: [PATCH 048/103] [demuxer] Avoid memcpy on every demuxer packet +Subject: [PATCH 46/89] [demuxer] Avoid memcpy on every demuxer packet Avoids an unnecessary memcpy on every demuxer packet which for high bitrate videos can be significant. @@ -3773,10 +3507,10 @@ index ab298b2..10c5ee0 100644 } catch(...) { -From 6b4af4de9aaa4c125272e087680652db3b924ec1 Mon Sep 17 00:00:00 2001 +From 32561c3475489b45a10a23b1f00896759a4a8e35 Mon Sep 17 00:00:00 2001 From: Memphiz Date: Tue, 18 Nov 2014 13:27:59 +0100 -Subject: [PATCH 049/103] - added setting for allowing to hide watched +Subject: [PATCH 47/89] - added setting for allowing to hide watched movies/episodes/musicvideos in the recently added lists of the home screen --- @@ -3785,10 +3519,10 @@ Subject: [PATCH 049/103] - added setting for allowing to hide watched 2 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 e8d5f7c..8858c95 100644 +index 647befc..bf466b0 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -11142,7 +11142,13 @@ msgctxt "#20469" +@@ -11148,7 +11148,13 @@ msgctxt "#20469" msgid "Keep current set (%s)" msgstr "" @@ -3803,7 +3537,7 @@ index e8d5f7c..8858c95 100644 #up to 21329 is reserved for the video db !! ! #: system/settings/settings.xml -@@ -15958,7 +15964,13 @@ msgctxt "#36435" +@@ -15966,7 +15972,13 @@ msgctxt "#36435" msgid "Use DVDPlayer for decoding of video files with MMAL acceleration." msgstr "" @@ -3819,10 +3553,10 @@ index e8d5f7c..8858c95 100644 #. label of a setting for the stereoscopic 3D mode of the GUI that is/should be applied diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index bdba486..67472f6 100644 +index f3022c3..823f181 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml -@@ -465,6 +465,11 @@ +@@ -468,6 +468,11 @@ false @@ -3835,10 +3569,10 @@ index bdba486..67472f6 100644 -From 8eb308d186e18f8c8d23c1d77fa28fd11fa0238f Mon Sep 17 00:00:00 2001 +From 299f258f82d0bf10105053affec0d811bfa20002 Mon Sep 17 00:00:00 2001 From: Memphiz Date: Tue, 18 Nov 2014 13:28:36 +0100 -Subject: [PATCH 050/103] - evaluate the setting for hiding watched +Subject: [PATCH 48/89] - evaluate the setting for hiding watched movies/episodes/musicvideos in recently added job (should influence homescreen of skins only) @@ -3891,7 +3625,7 @@ index 1f8ec36..de45783 100644 for (; i < MusicVideoItems.Size(); ++i) { diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp -index a703de3..1212e09 100644 +index 89fbfcc..aa370af 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -6552,27 +6552,48 @@ bool CVideoDatabase::GetMusicVideosNav(const std::string& strBaseDir, CFileItemL @@ -3964,122 +3698,10 @@ index ca62f23..b905e48 100644 bool HasContent(); bool HasContent(VIDEODB_CONTENT_TYPE type); -From 6626ed33fcd8daa13811c72bbdd1fe455dd19366 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 11 Jan 2015 21:48:31 +0000 -Subject: [PATCH 051/103] [omximage] Increase timeout - this is sometimes hit - ---- - xbmc/cores/omxplayer/OMXImage.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp -index 86a683a..54a52a7 100644 ---- a/xbmc/cores/omxplayer/OMXImage.cpp -+++ b/xbmc/cores/omxplayer/OMXImage.cpp -@@ -1885,7 +1885,7 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns - } - if (m_encoded_buffer) - { -- omx_err = m_omx_encoder.WaitForOutputDone(1000); -+ omx_err = m_omx_encoder.WaitForOutputDone(2000); - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s %s m_omx_encoder.WaitForOutputDone result(0x%x)\n", CLASSNAME, __func__, srcFile.GetFilename(), omx_err); - -From 1664527d983c1a063d7145e90749af5b0d212990 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 24 Jan 2015 17:34:04 +0000 -Subject: [PATCH 052/103] temp: Some hacks to help profiling - ---- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 5 +++++ - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 4 ++-- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 2 ++ - 3 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index 7c68e1c..6a2fee9 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -564,6 +564,7 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg) - CActiveAEStream *stream; - streamMsg = (MsgStreamNew*)msg->data; - stream = CreateStream(streamMsg); -+ CLog::Log(LOGNOTICE, "ActiveAE::%s - NEWSTREAM %p %p", __FUNCTION__, streamMsg, stream); - if(stream) - { - msg->Reply(CActiveAEDataProtocol::ACC, &stream, sizeof(CActiveAEStream*)); -@@ -1228,6 +1229,7 @@ CActiveAEStream* CActiveAE::CreateStream(MsgStreamNew *streamMsg) - } - if (hasRawStream || (hasStream && AE_IS_RAW(streamMsg->format.m_dataFormat))) - { -+ CLog::Log(LOGNOTICE, "CActiveAE::CreateStream - raw"); - return NULL; - } - -@@ -1256,6 +1258,7 @@ CActiveAEStream* CActiveAE::CreateStream(MsgStreamNew *streamMsg) - - m_streams.push_back(stream); - -+ CLog::Log(LOGNOTICE, "CActiveAE::CreateStream - %p", stream); - return stream; - } - -@@ -2750,11 +2753,13 @@ IAEStream *CActiveAE::MakeStream(enum AEDataFormat dataFormat, unsigned int samp - msg.options = options; - - Message *reply; -+ CLog::Log(LOGNOTICE, "ActiveAE::%s - about to create stream", __FUNCTION__); - if (m_dataPort.SendOutMessageSync(CActiveAEDataProtocol::NEWSTREAM, - &reply,10000, - &msg, sizeof(MsgStreamNew))) - { - bool success = reply->signal == CActiveAEControlProtocol::ACC; -+ CLog::Log(LOGNOTICE, "ActiveAE::%s - created stream : %d", __FUNCTION__, success); - if (success) - { - CActiveAEStream *stream = *(CActiveAEStream**)reply->data; -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index a064da5..ebc4458 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -36,7 +36,7 @@ - #define CLASSNAME "CMMALRenderer" - - #ifdef _DEBUG --#define MMAL_DEBUG_VERBOSE -+//#define MMAL_DEBUG_VERBOSE - #endif - - static void vout_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) -@@ -372,7 +372,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - #endif - omvb->Acquire(); - mmal_port_send_buffer(m_vout_input, omvb->mmal_buffer); -- } else assert(0); -+ } //else assert(0); - } - else if (m_format == RENDER_FMT_YUV420P) - { -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 5832c58..76c708d 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -162,6 +162,8 @@ CDVDPlayerVideo::CDVDPlayerVideo( CDVDClock* pClock - - CDVDPlayerVideo::~CDVDPlayerVideo() - { -+ CLog::Log(LOGNOTICE, "drop:%d skip:%d", m_iDroppedFrames, g_renderManager.GetSkippedFrames()); -+ - StopThread(); - g_VideoReferenceClock.Stop(); - } - -From e4f51eb17146ed9b71c99968cc8a539894c02b97 Mon Sep 17 00:00:00 2001 +From 2373aa7571337304e255fe7039fbd49fcfa3a4f9 Mon Sep 17 00:00:00 2001 From: fritsch Date: Wed, 4 Feb 2015 22:32:03 +0100 -Subject: [PATCH 053/103] NFSFile: Chank ChunkSize to 1MB +Subject: [PATCH 49/89] NFSFile: Chank ChunkSize to 1MB --- xbmc/filesystem/NFSFile.h | 2 +- @@ -4099,10 +3721,10 @@ index 4c01e4e..7afa6b8 100644 virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false); virtual bool Delete(const CURL& url); -From 1bf1cc0f8335f67ab3ddff9aac3bfe86d57b6138 Mon Sep 17 00:00:00 2001 +From 2862d65f247cbff597c3a4f2a54342ae9e653e11 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 10 Feb 2015 00:19:51 +0000 -Subject: [PATCH 056/103] [libnfs] Add streaming cache +Subject: [PATCH 52/89] [libnfs] Add streaming cache --- .../libnfs/0001-Sequential-Readahead-Mode.patch | 949 +++++++++++++++++++++ @@ -5121,10 +4743,10 @@ index 9354fd5..eaa1dd7 100644 if( Stat(&tmpBuffer) ) -From 4b88d98c3ba80b522d1a34cfebe6e9a629113cee Mon Sep 17 00:00:00 2001 +From 37b404211c9d8c6e1545f2f6fd6dda25ce553ad7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 15 Feb 2015 14:06:12 +0000 -Subject: [PATCH 057/103] [mmal] Allow mmal codec for dvd stills +Subject: [PATCH 53/89] [mmal] Allow mmal codec for dvd stills --- xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 7 +++++++ @@ -5156,183 +4778,11 @@ index 0cd267a..9d8de2a 100644 { // If dvd is an mpeg2 and hint.stills -From 17f7f8502ce5429461202b3f4b609d9478577485 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 15 Feb 2015 15:29:51 +0000 -Subject: [PATCH 058/103] [rbp] Add Pi 2 specific settings defaults - -Disable omxplayer by default and don't need to warn against using ac3 transcode ---- - system/settings/rbp2.xml | 106 +++++++++++++++++++++++++++++++++++++++++++++ - xbmc/linux/RBP.h | 2 + - xbmc/settings/Settings.cpp | 7 ++- - 3 files changed, 114 insertions(+), 1 deletion(-) - create mode 100644 system/settings/rbp2.xml - -diff --git a/system/settings/rbp2.xml b/system/settings/rbp2.xml -new file mode 100644 -index 0000000..ffdcb36 ---- /dev/null -+++ b/system/settings/rbp2.xml -@@ -0,0 +1,106 @@ -+ -+ -+
-+ -+ -+ false -+ -+ -+ -+ false -+ -+ -+ -+ 1 -+ -+ 2 -+ true -+ -+ -+ -+ -+ -+ 2 -+ 10 -+ -+ 0 -+ 5 -+ 25 -+ -+ -+ 38016 -+ -+ -+ -+ -+ -+ -+ -+ -+ false -+ -+ -+ false -+ -+ -+ false -+ -+ -+ -+
-+ -+
-+ -+ -+ -+ false -+ -+ -+ false -+ -+ -+ false -+ -+ -+ 2 -+ true -+ -+ -+ -+ 2 -+ 0 -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ 101 -+ -+ -+ 3 -+ 100 -+ -+ 50 -+ 50 -+ 300 -+ -+ -+ 38102 -+ -+ -+ -+ -+
-+
-diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index 82146d6..4a04183 100644 ---- a/xbmc/linux/RBP.h -+++ b/xbmc/linux/RBP.h -@@ -37,6 +37,7 @@ - #if defined(TARGET_RASPBERRY_PI) - #include "DllBCM.h" - #include "OMXCore.h" -+#include "xbmc/utils/CPUInfo.h" - #include "threads/CriticalSection.h" - #include "threads/Event.h" - -@@ -52,6 +53,7 @@ class CRBP - int GetArmMem() { return m_arm_mem; } - int GetGpuMem() { return m_gpu_mem; } - bool GetCodecMpg2() { return m_codec_mpg2_enabled; } -+ int RasberryPiVersion() { return g_cpuInfo.getCPUCount() == 1 ? 1 : 2; }; - bool GetCodecWvc1() { return m_codec_wvc1_enabled; } - void GetDisplaySize(int &width, int &height); - DISPMANX_DISPLAY_HANDLE_T OpenDisplay(uint32_t device); -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 139817f..ab9c6fd 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -49,6 +49,9 @@ - #if defined(TARGET_DARWIN) - #include "osx/DarwinUtils.h" - #endif -+#if defined(TARGET_RASPBERRY_PI) -+#include "linux/RBP.h" -+#endif - #include "peripherals/Peripherals.h" - #include "powermanagement/PowerManager.h" - #include "profiles/ProfilesManager.h" -@@ -454,8 +457,10 @@ bool CSettings::InitializeDefinitions() - if (CFile::Exists(SETTINGS_XML_FOLDER "android.xml") && !Initialize(SETTINGS_XML_FOLDER "android.xml")) - CLog::Log(LOGFATAL, "Unable to load android-specific settings definitions"); - #elif defined(TARGET_RASPBERRY_PI) -- if (CFile::Exists(SETTINGS_XML_FOLDER "rbp.xml") && !Initialize(SETTINGS_XML_FOLDER "rbp.xml")) -+ if (g_RBP.RasberryPiVersion() == 1 && CFile::Exists(SETTINGS_XML_FOLDER "rbp.xml") && !Initialize(SETTINGS_XML_FOLDER "rbp.xml")) - CLog::Log(LOGFATAL, "Unable to load rbp-specific settings definitions"); -+ if (g_RBP.RasberryPiVersion() > 1 && CFile::Exists(SETTINGS_XML_FOLDER "rbp2.xml") && !Initialize(SETTINGS_XML_FOLDER "rbp2.xml")) -+ CLog::Log(LOGFATAL, "Unable to load rbp2-specific settings definitions"); - #elif defined(TARGET_FREEBSD) - if (CFile::Exists(SETTINGS_XML_FOLDER "freebsd.xml") && !Initialize(SETTINGS_XML_FOLDER "freebsd.xml")) - CLog::Log(LOGFATAL, "Unable to load freebsd-specific settings definitions"); - -From 750290b96315c47a5cf1dbc2f4696481d9be8750 Mon Sep 17 00:00:00 2001 +From 1c666d5d6570d68e1099f8961cc9f2c52d6e04e1 Mon Sep 17 00:00:00 2001 From: Claudio-Sjo Date: Mon, 16 Feb 2015 14:51:26 +0100 -Subject: [PATCH 059/103] - allow reads < CDIO_CD_FRAMESIZE_RAW by using a - buffer - fixes #15794 +Subject: [PATCH 54/89] - allow reads < CDIO_CD_FRAMESIZE_RAW by using a buffer + - fixes #15794 --- xbmc/filesystem/CDDAFile.cpp | 120 ++++++++++++++++++++++++++++++++----------- @@ -5523,10 +4973,10 @@ index 0427af4..e992362 100644 lsn_t m_lsnCurrent; // Position inside the track in logical sector number lsn_t m_lsnEnd; // End of m_iTrack in logical sector number -From af144ae9182175bd150cfd6c5920d019f7608d34 Mon Sep 17 00:00:00 2001 +From bc5577e298d7939945b5700dbbbc42b4fe196a1e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 20 Feb 2015 14:11:57 +0000 -Subject: [PATCH 060/103] libavformat: add mvcC handling in .mov/.mp4 +Subject: [PATCH 55/89] libavformat: add mvcC handling in .mov/.mp4 --- ...ibavformat-add-mvcC-handling-in-.mov-.mp4.patch | 57 ++++++++++++++++++++++ @@ -5618,46 +5068,10 @@ index 6e8364a..43dc4ff 100644 CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ ./configure $(ffmpg_config) -From d51cbcb8bab40754cf93919b1c5604944781375e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 24 Feb 2015 00:09:19 +0000 -Subject: [PATCH 061/103] [omxplayer] Limit subtitle updates to 10fps to avoid - stuttering with closed captions - ---- - xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index 4e599e3..b32bd7f 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -222,7 +222,7 @@ double OMXPlayerVideo::NextOverlay(double pts) - else if (delta_stop > 0.0 && (min_delta == DVD_NOPTS_VALUE || delta_stop < min_delta)) - min_delta = delta_stop; - } -- return min_delta == DVD_NOPTS_VALUE ? pts+DVD_MSEC_TO_TIME(500) : pts+min_delta; -+ return min_delta == DVD_NOPTS_VALUE ? pts+DVD_MSEC_TO_TIME(500) : pts+std::max(min_delta, DVD_MSEC_TO_TIME(100)); - } - - -@@ -306,9 +306,9 @@ void OMXPlayerVideo::Output(double pts, bool bDropPacket) - double subtitle_pts = m_nextOverlay; - double time = subtitle_pts != DVD_NOPTS_VALUE ? subtitle_pts - media_pts : 0.0; - -- m_nextOverlay = NextOverlay(media_pts); -+ m_nextOverlay = NextOverlay(media_pts + preroll); - -- ProcessOverlays(media_pts); -+ ProcessOverlays(media_pts + preroll); - - time += m_av_clock->GetAbsoluteClock(); - g_renderManager.FlipPage(CThread::m_bStop, time/DVD_TIME_BASE); - -From a7fd3cef4b00d619163cf633077536887fc0f36d Mon Sep 17 00:00:00 2001 +From fccae33d78ecc18c9edcec5f6e5a36005c6b8b8c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 24 Feb 2015 15:57:29 +0000 -Subject: [PATCH 062/103] [mmalrenderer] Fix for stereo view modes +Subject: [PATCH 56/89] [mmalrenderer] Fix for stereo view modes PR6090 (dirty regions for video) meant that RenderUpate is no longer called with the expected stereo view mode. So, just explicitly set this before calling ManageDisplay to get the desired rectangles @@ -5666,10 +5080,10 @@ So, just explicitly set this before calling ManageDisplay to get the desired rec 1 file changed, 4 insertions(+) diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index ebc4458..b9d9cd9 100644 +index 3329980..d53de35 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp +++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -346,7 +346,11 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) +@@ -351,7 +351,11 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) if (!m_bConfigured) return; @@ -5682,10 +5096,10 @@ index ebc4458..b9d9cd9 100644 // if running bypass, then the player might need the src/dst rects // for sizing video playback on a layer other than the gles layer. -From 25817c925fec4954e78a2e852b7ca1c0ef50ba6c Mon Sep 17 00:00:00 2001 +From 76958643f9e7aa870f3038a960baf3f987c39be8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 27 Feb 2015 14:37:27 +0000 -Subject: [PATCH 063/103] ffmpeg: Add some upstream HEVC optimisations +Subject: [PATCH 57/89] ffmpeg: Add some upstream HEVC optimisations --- tools/depends/target/ffmpeg/Makefile | 5 +- @@ -6128,34 +5542,10 @@ index 0000000..de95ba6 + c->put_hevc_qpel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; + c->put_hevc_qpel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; -From 2780425800930e12a685727f6ea67d47bace6b41 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 27 Feb 2015 19:07:17 +0000 -Subject: [PATCH 064/103] [omxplayer] Attempt to fix missing subtitles after - seek - ---- - xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index b32bd7f..8becff1 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -296,7 +296,7 @@ void OMXPlayerVideo::Output(double pts, bool bDropPacket) - const double preroll = DVD_MSEC_TO_TIME(100); - double media_pts = m_av_clock->OMXMediaTime(); - -- if (m_nextOverlay != DVD_NOPTS_VALUE && media_pts + preroll <= m_nextOverlay) -+ if (m_nextOverlay != DVD_NOPTS_VALUE && media_pts != 0.0 && media_pts + preroll <= m_nextOverlay) - return; - - int buffer = g_renderManager.WaitForBuffer(CThread::m_bStop); - -From 59faf7fd1d9849cd8f6524a14d86b02b065ebdd3 Mon Sep 17 00:00:00 2001 +From e885adeaa52b27c769c7c0f599e95c772f93f0fa Mon Sep 17 00:00:00 2001 From: anaconda Date: Wed, 25 Feb 2015 18:22:21 +0100 -Subject: [PATCH 065/103] Load OSD dialogs on startup. +Subject: [PATCH 58/89] 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. @@ -6250,10 +5640,10 @@ index 4940561..f52698c 100644 CGUIDialogVideoSettings::~CGUIDialogVideoSettings() { } -From 50d352d6656308960ad3e651f78688aec8237423 Mon Sep 17 00:00:00 2001 +From 018f759a0be60d10f72bb35df22e074ceb88ae72 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 5 Mar 2015 20:00:59 +0000 -Subject: [PATCH 066/103] [ffmpmeg] Discard data before VO/VOL in mpeg-4 over +Subject: [PATCH 59/89] [ffmpmeg] Discard data before VO/VOL in mpeg-4 over mpegts --- @@ -6360,10 +5750,10 @@ index 757721c..fbef09a 100644 cd $(PLATFORM);\ CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ -From e0feb4ed215e9fbe93c44eceb45214027f3c87c0 Mon Sep 17 00:00:00 2001 +From 91db23dc25c5ea12f5183dc99379ac79d9e6a1dd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 7 Mar 2015 22:46:21 +0000 -Subject: [PATCH 067/103] configure: Add raspberry-pi2 platform +Subject: [PATCH 60/89] configure: Add raspberry-pi2 platform --- configure.ac | 14 +++++++-- @@ -6375,7 +5765,7 @@ Subject: [PATCH 067/103] configure: Add raspberry-pi2 platform 6 files changed, 44 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac -index fb7c782..129c57a 100644 +index b7b2a87..be28bf6 100644 --- a/configure.ac +++ b/configure.ac @@ -746,8 +746,17 @@ case $use_platform in @@ -6438,7 +5828,7 @@ index e1ac05c..d60cccf 100644 AAPT=@AAPT@ DX=@DX@ diff --git a/tools/depends/configure.ac b/tools/depends/configure.ac -index ae0626f..85d0c72 100644 +index 9435fca..4eff331 100644 --- a/tools/depends/configure.ac +++ b/tools/depends/configure.ac @@ -17,7 +17,8 @@ AC_ARG_WITH([toolchain], @@ -6537,11 +5927,11 @@ index cdc2fe4..379bd1d 100644 set(CMAKE_SYSTEM_NAME Linux) endif() -From da6be7609a0ce66cc87d86b308e0561b04835875 Mon Sep 17 00:00:00 2001 +From ae3bcf13b7c5e8f372410cea93f85fc44067d402 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 16 Apr 2014 21:18:06 +0100 -Subject: [PATCH 068/103] [omxplayer] Don't propagate 3d flags based on - supported 3d modes +Subject: [PATCH 61/89] [omxplayer] Don't propagate 3d flags based on supported + 3d modes --- xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 29 +++-------------------------- @@ -6596,10 +5986,10 @@ index 8becff1..86d97bd 100644 unsigned int iDisplayHeight = height; -From 595f15cd5e389f7d3c37b06d5cdddb878560a303 Mon Sep 17 00:00:00 2001 +From a969c6c631b7fbf6b9c246ed3152448df288339a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:01:51 +0100 -Subject: [PATCH 069/103] [graphics] Allow switching to a more suitable 3D +Subject: [PATCH 62/89] [graphics] Allow switching to a more suitable 3D resolution --- @@ -6685,10 +6075,10 @@ index 5c1501a..aba11cd 100644 void ResetOverscan(RESOLUTION_INFO &resinfo); void ResetScreenParameters(RESOLUTION res); -From 241c252fd08754d237c78288b6aaed2595c86dda Mon Sep 17 00:00:00 2001 +From eb7a1712a184b4d997998b97359d20d6a2ab95ac Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:38:55 +0100 -Subject: [PATCH 070/103] [3D] Support switching to 3D resolutions +Subject: [PATCH 63/89] [3D] Support switching to 3D resolutions Include matching 3D flags (SBS/TAB) in the score of a resolution to switch to, to enable switching to 3d modes. Also remove the old code that treated 3D modes differently when assigning a score. @@ -6770,10 +6160,10 @@ index 4345c0f..cc5dc60 100644 return current; } -From a813ff2c01902d9e5c7f59ae43b08c3c63a7c3db Mon Sep 17 00:00:00 2001 +From 776a7d653349f024a92f4ee065527cb558ad389c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 23 Apr 2014 00:05:07 +0100 -Subject: [PATCH 071/103] [graphics] Make pixel ratio for 3d modes consistent +Subject: [PATCH 64/89] [graphics] Make pixel ratio for 3d modes consistent Note: Use the stored stereo flags from lists of resolutions. Use current stereo mode for current resolution. @@ -6976,24 +6366,23 @@ index d388373..ba14e40 100644 AddUniqueResolution(res2, resolutions); -From 8e2a045b4f3746e523f40d22db434801c72d9adf Mon Sep 17 00:00:00 2001 +From d341efba61fba5ce9738b208a23fdb4cb4b95e96 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 10 Mar 2015 17:05:18 +0000 -Subject: [PATCH 072/103] [players] Add settings option to enable MVC support +Subject: [PATCH 65/89] [players] Add settings option to enable MVC support --- addons/resource.language.en_gb/resources/strings.po | 10 ++++++++++ system/settings/rbp.xml | 10 ++++++++++ - system/settings/rbp2.xml | 10 ++++++++++ xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 5 +++++ xbmc/cores/omxplayer/OMXVideo.cpp | 5 +++++ - 5 files changed, 40 insertions(+) + 4 files changed, 30 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 8858c95..82bb99d 100644 +index bf466b0..d45f05d 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16659,6 +16659,16 @@ msgctxt "#38102" +@@ -16667,6 +16667,16 @@ msgctxt "#38102" msgid "%i ms" msgstr "" @@ -7008,7 +6397,7 @@ index 8858c95..82bb99d 100644 +msgstr "" + #: system/settings/settings.xml - msgctxt "#38015" + msgctxt "#38103" msgid "Extract thumbnails from video files" diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml index 6e9ceaf..ed61ca6 100644 @@ -7027,36 +6416,15 @@ index 6e9ceaf..ed61ca6 100644 + true + +
-+
- - - -diff --git a/system/settings/rbp2.xml b/system/settings/rbp2.xml -index ffdcb36..e909cc4 100644 ---- a/system/settings/rbp2.xml -+++ b/system/settings/rbp2.xml -@@ -33,6 +33,16 @@ - -
- -+ -+ -+ -+ 1 -+ -+ 2 -+ true -+ -+ + diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 1bfec44..21282dc 100644 +index df282f3..9e0aa66 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -534,6 +534,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -549,6 +549,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide // H.264 m_codingType = MMAL_ENCODING_H264; m_pFormatName = "mmal-h264"; @@ -7069,10 +6437,10 @@ index 1bfec44..21282dc 100644 case AV_CODEC_ID_H263: case AV_CODEC_ID_MPEG4: diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 55e16c4..5a74c79 100644 +index ca40a37..ec8fe9c 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -434,6 +434,11 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de +@@ -430,6 +430,11 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de break; } } @@ -7085,28 +6453,27 @@ index 55e16c4..5a74c79 100644 case AV_CODEC_ID_MPEG4: // (role name) video_decoder.mpeg4 -From 18240f9b0072c6ea1e8707824ab8ff4b3e75aa5b Mon Sep 17 00:00:00 2001 +From 6802d4a755bb5609e27a797242b7f858d722716a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Mar 2015 12:38:08 +0000 -Subject: [PATCH 073/103] [mmalrenderer] Switch to using transform flags for 3d +Subject: [PATCH 66/89] [mmalrenderer] Switch to using transform flags for 3d modes --- .../resource.language.en_gb/resources/strings.po | 10 +++ system/settings/rbp.xml | 8 ++ - system/settings/rbp2.xml | 8 ++ xbmc/cores/VideoRenderers/MMALRenderer.cpp | 92 ++++++---------------- xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 46 ++--------- xbmc/cores/omxplayer/OMXVideo.cpp | 36 ++++----- xbmc/cores/omxplayer/OMXVideo.h | 2 +- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 11 ++- - 8 files changed, 83 insertions(+), 130 deletions(-) + 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 82bb99d..d0d77c5 100644 +index d45f05d..bce7527 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16669,6 +16669,16 @@ msgctxt "#38111" +@@ -16677,6 +16677,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 "" @@ -7121,7 +6488,7 @@ index 82bb99d..d0d77c5 100644 +msgstr "" + #: system/settings/settings.xml - msgctxt "#38015" + msgctxt "#38103" msgid "Extract thumbnails from video files" diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml index ed61ca6..42d4da7 100644 @@ -7138,34 +6505,15 @@ index ed61ca6..42d4da7 100644 + 2 + true + -+ - - - -diff --git a/system/settings/rbp2.xml b/system/settings/rbp2.xml -index e909cc4..dff4da8 100644 ---- a/system/settings/rbp2.xml -+++ b/system/settings/rbp2.xml -@@ -42,6 +42,14 @@ - true - - -+ -+ -+ true -+ -+ 2 -+ true -+ + diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index b9d9cd9..f4c59ea 100644 +index d53de35..c30de9c 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp +++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -346,11 +346,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) +@@ -351,11 +351,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) if (!m_bConfigured) return; @@ -7177,7 +6525,7 @@ index b9d9cd9..f4c59ea 100644 // if running bypass, then the player might need the src/dst rects // for sizing video playback on a layer other than the gles layer. -@@ -541,9 +537,7 @@ EINTERLACEMETHOD CMMALRenderer::AutoInterlaceMethod() +@@ -560,9 +556,7 @@ EINTERLACEMETHOD CMMALRenderer::AutoInterlaceMethod() void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect) { @@ -7188,7 +6536,7 @@ index b9d9cd9..f4c59ea 100644 if (!m_vout_input) return; -@@ -585,41 +579,10 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect +@@ -604,41 +598,10 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect CRect gui(0, 0, CDisplaySettings::Get().GetResolutionInfo(res).iWidth, CDisplaySettings::Get().GetResolutionInfo(res).iHeight); CRect display(0, 0, CDisplaySettings::Get().GetResolutionInfo(res).iScreenWidth, CDisplaySettings::Get().GetResolutionInfo(res).iScreenHeight); @@ -7234,7 +6582,7 @@ index b9d9cd9..f4c59ea 100644 if (gui != display) { -@@ -634,7 +597,7 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect +@@ -653,7 +616,7 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect MMAL_DISPLAYREGION_T region; memset(®ion, 0, sizeof region); @@ -7243,7 +6591,7 @@ index b9d9cd9..f4c59ea 100644 region.dest_rect.x = lrintf(DestRect.x1); region.dest_rect.y = lrintf(DestRect.y1); region.dest_rect.width = lrintf(DestRect.Width()); -@@ -647,35 +610,32 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect +@@ -666,35 +629,32 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect region.fullscreen = MMAL_FALSE; region.noaspect = MMAL_TRUE; @@ -7371,10 +6719,10 @@ index 86d97bd..018e65f 100644 void OMXPlayerVideo::RenderUpdateCallBack(const void *ctx, const CRect &SrcRect, const CRect &DestRect) diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 5a74c79..aa97396 100644 +index ec8fe9c..3f37d44 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -224,15 +224,6 @@ bool COMXVideo::PortSettingsChanged() +@@ -220,15 +220,6 @@ bool COMXVideo::PortSettingsChanged() OMX_INIT_STRUCTURE(configDisplay); configDisplay.nPortIndex = m_omx_render.GetInputPort(); @@ -7390,7 +6738,7 @@ index 5a74c79..aa97396 100644 if(m_hdmi_clock_sync) { OMX_CONFIG_LATENCYTARGETTYPE latencyTarget; -@@ -877,7 +868,7 @@ void COMXVideo::Reset(void) +@@ -860,7 +851,7 @@ void COMXVideo::Reset(void) } /////////////////////////////////////////////////////////////////////////////////////////// @@ -7399,7 +6747,7 @@ index 5a74c79..aa97396 100644 { CSingleLock lock (m_critSection); if(!m_is_open) -@@ -887,7 +878,7 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER +@@ -870,7 +861,7 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER OMX_INIT_STRUCTURE(configDisplay); configDisplay.nPortIndex = m_omx_render.GetInputPort(); @@ -7408,7 +6756,7 @@ index 5a74c79..aa97396 100644 configDisplay.dest_rect.x_offset = lrintf(DestRect.x1); configDisplay.dest_rect.y_offset = lrintf(DestRect.y1); configDisplay.dest_rect.width = lrintf(DestRect.Width()); -@@ -900,23 +891,24 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER +@@ -883,23 +874,24 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER configDisplay.fullscreen = OMX_FALSE; configDisplay.noaspect = OMX_TRUE; @@ -7487,10 +6835,10 @@ index ba14e40..10a0409 100644 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 a45bafbf944a6a91f9b2d778714877bd7cb89b0f Mon Sep 17 00:00:00 2001 +From 3531e8d698ce4d38ce16c7697f6a5111563a9238 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 17 Mar 2015 20:33:54 +0000 -Subject: [PATCH 074/103] alsa: enable-shared is required +Subject: [PATCH 67/89] alsa: enable-shared is required --- tools/depends/target/alsa-lib/Makefile | 2 +- @@ -7510,700 +6858,11 @@ index b03fc19..a04d933 100644 LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a -From fc62ae2cfaac76e0fc667ce298befbf240d7981b Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 21 Mar 2015 21:46:16 +0000 -Subject: [PATCH 075/103] squash: Move m_output_busy into lock - ---- - 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 21282dc..3d90b92 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -273,7 +273,6 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - else - { - CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); -- m_output_busy++; - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s - %p (%p) buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x frame:%d", - CLASSNAME, __func__, buffer, omvb, buffer->length, dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags, omvb->m_changed_count); -@@ -285,6 +284,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - omvb->height = m_decoded_height; - omvb->m_aspect_ratio = m_aspect_ratio; - pthread_mutex_lock(&m_output_mutex); -+ m_output_busy++; - m_output_ready.push(omvb); - pthread_mutex_unlock(&m_output_mutex); - kept = true; - -From 6881d9550814c63db3c9eeea719c73a34f3ccd0e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 22 Mar 2015 19:32:36 +0000 -Subject: [PATCH 076/103] [omxplayer] Handle failures from EmptyThisBuffer and - FillThisBuffer - -Avoid leak of buffer as seen in PR6260 ---- - .../Engines/ActiveAE/ActiveAEResamplePi.cpp | 6 +++- - xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 3 ++ - xbmc/cores/omxplayer/OMXAudio.cpp | 42 +++++++--------------- - xbmc/cores/omxplayer/OMXImage.cpp | 28 ++++++++++++--- - xbmc/cores/omxplayer/OMXVideo.cpp | 38 ++++++-------------- - 5 files changed, 55 insertions(+), 62 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -index fa8112d..759ba7b 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -@@ -506,6 +506,7 @@ int CActiveAEResamplePi::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s OMX_EmptyThisBuffer() failed with result(0x%x)", CLASSNAME, __func__, omx_err); -+ m_omx_mixer.DecoderEmptyBufferDone(m_omx_mixer.GetComponent(), omx_buffer); - return false; - } - -@@ -518,8 +519,11 @@ int CActiveAEResamplePi::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t - } - omx_err = m_omx_mixer.FillThisBuffer(m_encoded_buffer); - if (omx_err != OMX_ErrorNone) -+ { -+ CLog::Log(LOGERROR, "%s::%s m_omx_mixer.FillThisBuffer result(0x%x)", CLASSNAME, __func__, omx_err); -+ m_omx_mixer.DecoderFillBufferDone(m_omx_mixer.GetComponent(), m_encoded_buffer); - return false; -- -+ } - omx_err = m_omx_mixer.WaitForOutputDone(1000); - if (omx_err != OMX_ErrorNone) - { -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -index 363b7d5..7f4d103 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -@@ -468,7 +468,10 @@ unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned - } - omx_err = m_omx_output->EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) -+ { - CLog::Log(LOGERROR, "%s:%s frames=%d err=%x", CLASSNAME, __func__, frames, omx_err); -+ m_omx_output->DecoderEmptyBufferDone(m_omx_output->GetComponent(), omx_buffer); -+ } - m_submitted++; - GetDelay(status); - delay = status.GetDelay(); -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 602d2fa..2e39224 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -858,12 +858,8 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - } - - omx_buffer->nOffset = 0; -- omx_buffer->nFilledLen = sizeof(m_wave_header); -- if(omx_buffer->nFilledLen > omx_buffer->nAllocLen) -- { -- CLog::Log(LOGERROR, "COMXAudio::Initialize - omx_buffer->nFilledLen > omx_buffer->nAllocLen"); -- return false; -- } -+ omx_buffer->nFilledLen = std::min(sizeof(m_wave_header), omx_buffer->nAllocLen); -+ - memset((unsigned char *)omx_buffer->pBuffer, 0x0, omx_buffer->nAllocLen); - memcpy((unsigned char *)omx_buffer->pBuffer, &m_wave_header, omx_buffer->nFilledLen); - omx_buffer->nFlags = OMX_BUFFERFLAG_CODECCONFIG | OMX_BUFFERFLAG_ENDOFFRAME; -@@ -872,6 +868,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return false; - } - } -@@ -889,12 +886,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - } - - omx_buffer->nOffset = 0; -- omx_buffer->nFilledLen = m_extrasize; -- if(omx_buffer->nFilledLen > omx_buffer->nAllocLen) -- { -- CLog::Log(LOGERROR, "%s::%s - omx_buffer->nFilledLen > omx_buffer->nAllocLen", CLASSNAME, __func__); -- return false; -- } -+ omx_buffer->nFilledLen = std::min((OMX_U32)m_extrasize, omx_buffer->nAllocLen); - - memset((unsigned char *)omx_buffer->pBuffer, 0x0, omx_buffer->nAllocLen); - memcpy((unsigned char *)omx_buffer->pBuffer, m_extradata, omx_buffer->nFilledLen); -@@ -904,6 +896,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return false; - } - } -@@ -1223,26 +1216,14 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt - if(demuxer_samples_sent == demuxer_samples) - omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; - -- int nRetry = 0; -- while(true) -+ omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); -+ if (omx_err != OMX_ErrorNone) - { -- omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); -- if (omx_err == OMX_ErrorNone) -- { -- //CLog::Log(LOGINFO, "AudiD: dts:%.0f pts:%.0f size:%d\n", dts, pts, len); -- break; -- } -- else -- { -- CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -- nRetry++; -- } -- if(nRetry == 5) -- { -- CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() finaly failed\n", CLASSNAME, __func__); -- return 0; -- } -+ CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() finaly failed\n", CLASSNAME, __func__); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); -+ return 0; - } -+ //CLog::Log(LOGINFO, "AudiD: dts:%.0f pts:%.0f size:%d\n", dts, pts, len); - - omx_err = m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged, 0); - if (omx_err == OMX_ErrorNone) -@@ -1477,6 +1458,7 @@ void COMXAudio::SubmitEOS() - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return; - } - CLog::Log(LOGINFO, "%s::%s", CLASSNAME, __func__); -diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp -index 54a52a7..e79f41d 100644 ---- a/xbmc/cores/omxplayer/OMXImage.cpp -+++ b/xbmc/cores/omxplayer/OMXImage.cpp -@@ -1058,6 +1058,7 @@ bool COMXImageDec::HandlePortSettingChange(unsigned int resize_width, unsigned i - if(omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s m_omx_resize FillThisBuffer result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_resize.DecoderFillBufferDone(m_omx_resize.GetComponent(), m_decoded_buffer); - return false; - } - } -@@ -1174,6 +1175,7 @@ bool COMXImageDec::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return false; - } - } -@@ -1240,8 +1242,17 @@ COMXImageEnc::~COMXImageEnc() - - OMX_INIT_STRUCTURE(m_encoded_format); - m_encoded_buffer = NULL; -- if(m_omx_encoder.IsInitialized()) -- m_omx_encoder.Deinitialize(); -+ if (!m_success) -+ { -+ if(m_omx_encoder.IsInitialized()) -+ { -+ m_omx_encoder.SetStateForComponent(OMX_StateIdle); -+ m_omx_encoder.FlushAll(); -+ m_omx_encoder.FreeInputBuffers(); -+ m_omx_encoder.FreeOutputBuffers(); -+ m_omx_encoder.Deinitialize(); -+ } -+ } - limit_calls_leave(); - } - -@@ -1383,6 +1394,7 @@ bool COMXImageEnc::Encode(unsigned char *buffer, int size, unsigned width, unsig - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_encoder.DecoderEmptyBufferDone(m_omx_encoder.GetComponent(), omx_buffer); - break; - } - } -@@ -1397,12 +1409,15 @@ bool COMXImageEnc::Encode(unsigned char *buffer, int size, unsigned width, unsig - - omx_err = m_omx_encoder.FillThisBuffer(m_encoded_buffer); - if(omx_err != OMX_ErrorNone) -+ { -+ CLog::Log(LOGERROR, "%s::%s m_omx_encoder.FillThisBuffer result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_encoder.DecoderFillBufferDone(m_omx_encoder.GetComponent(), m_encoded_buffer); - return false; -- -+ } - omx_err = m_omx_encoder.WaitForOutputDone(1000); - if(omx_err != OMX_ErrorNone) - { -- CLog::Log(LOGERROR, "%s::%s m_omx_resize.WaitForOutputDone result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ CLog::Log(LOGERROR, "%s::%s m_omx_encoder.WaitForOutputDone result(0x%x)\n", CLASSNAME, __func__, omx_err); - return false; - } - -@@ -1445,6 +1460,7 @@ bool COMXImageEnc::CreateThumbnailFromSurface(unsigned char* buffer, unsigned in - return true; - } - -+ m_success = true; - return false; - } - -@@ -1842,6 +1858,7 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s %s OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, srcFile.GetFilename(), omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return false; - } - } -@@ -1880,6 +1897,7 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns - if(omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s %s FillThisBuffer() failed (%x)\n", CLASSNAME, __func__, srcFile.GetFilename(), omx_err); -+ m_omx_encoder.DecoderFillBufferDone(m_omx_encoder.GetComponent(), m_encoded_buffer); - return false; - } - } -@@ -2199,6 +2217,7 @@ bool COMXTexture::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes, - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s - m_omx_decoder.OMX_EmptyThisBuffer (%x)", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return false; - } - } -@@ -2248,6 +2267,7 @@ bool COMXTexture::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes, - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s error m_omx_egl_render.FillThisBuffer (%x)", CLASSNAME, __func__, omx_err); -+ m_omx_egl_render.DecoderFillBufferDone(m_omx_egl_render.GetComponent(), m_egl_buffer); - return false; - } - -diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index aa97396..3f37d44 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -109,12 +109,7 @@ bool COMXVideo::SendDecoderConfig() - } - - omx_buffer->nOffset = 0; -- omx_buffer->nFilledLen = m_extrasize; -- if(omx_buffer->nFilledLen > omx_buffer->nAllocLen) -- { -- CLog::Log(LOGERROR, "%s::%s - omx_buffer->nFilledLen > omx_buffer->nAllocLen", CLASSNAME, __func__); -- return false; -- } -+ omx_buffer->nFilledLen = std::min((OMX_U32)m_extrasize, omx_buffer->nAllocLen); - - memset((unsigned char *)omx_buffer->pBuffer, 0x0, omx_buffer->nAllocLen); - memcpy((unsigned char *)omx_buffer->pBuffer, m_extradata, omx_buffer->nFilledLen); -@@ -124,6 +119,7 @@ bool COMXVideo::SendDecoderConfig() - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return false; - } - } -@@ -654,8 +650,7 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de - return false; - } - -- if(!SendDecoderConfig()) -- return false; -+ SendDecoderConfig(); - - m_is_open = true; - m_drop_state = false; -@@ -799,7 +794,7 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) - omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN; - - omx_buffer->nTimeStamp = ToOMXTime((uint64_t)(pts == DVD_NOPTS_VALUE) ? 0 : pts); -- omx_buffer->nFilledLen = (demuxer_bytes > omx_buffer->nAllocLen) ? omx_buffer->nAllocLen : demuxer_bytes; -+ omx_buffer->nFilledLen = std::min((OMX_U32)demuxer_bytes, omx_buffer->nAllocLen); - memcpy(omx_buffer->pBuffer, demuxer_content, omx_buffer->nFilledLen); - - demuxer_bytes -= omx_buffer->nFilledLen; -@@ -808,26 +803,14 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) - if(demuxer_bytes == 0) - omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; - -- int nRetry = 0; -- while(true) -+ omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); -+ if (omx_err != OMX_ErrorNone) - { -- omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); -- if (omx_err == OMX_ErrorNone) -- { -- //CLog::Log(LOGINFO, "VideD: dts:%.0f pts:%.0f size:%d)\n", dts, pts, iSize); -- break; -- } -- else -- { -- CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -- nRetry++; -- } -- if(nRetry == 5) -- { -- CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() finally failed\n", CLASSNAME, __func__); -- return false; -- } -+ CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); -+ return false; - } -+ //CLog::Log(LOGINFO, "VideD: dts:%.0f pts:%.0f size:%d)\n", dts, pts, iSize); - - omx_err = m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged, 0); - if (omx_err == OMX_ErrorNone) -@@ -946,6 +929,7 @@ void COMXVideo::SubmitEOS() - if (omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err); -+ m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer); - return; - } - CLog::Log(LOGINFO, "%s::%s", CLASSNAME, __func__); - - -From cd89da5ff195c665573488bc23d5064590b5dfb6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 23 Mar 2015 23:50:50 +0000 -Subject: [PATCH 079/103] [OMXAudio] Make stereoupmix and fixed behave more - like dvdplayer - ---- - xbmc/cores/omxplayer/OMXAudio.cpp | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 2e39224..dd5cdb8 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -600,13 +600,12 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both" || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") - stdLayout = AE_CH_LAYOUT_2_0; - -- // force out layout to stereo if input is not multichannel - it gives the receiver a chance to upmix -- if (m_InputChannels <= 2) -- stdLayout = AE_CH_LAYOUT_2_0; -- -- - CAEChannelInfo resolvedMap = channelMap; - resolvedMap.ResolveChannels(stdLayout); -+ -+ if (CSettings::Get().GetInt("audiooutput.config") == AE_CONFIG_FIXED || (upmix && channelMap.Count() <= 2)) -+ resolvedMap = stdLayout; -+ - uint64_t m_dst_chan_layout = GetAVChannelLayout(resolvedMap); - uint64_t m_src_chan_layout = GetAVChannelLayout(channelMap); - - -From ca7ac79e3ae84f9004d6ad1ff97f284d5792963e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 24 Mar 2015 17:24:27 +0000 -Subject: [PATCH 080/103] [mmal] Explicitly use fast deinterlace for HD and - reduce buffers allocated by 2 - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 17 ++++++++++++++--- - 1 file changed, 14 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 3d90b92..03d397f 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -361,10 +361,13 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) - CLog::Log(LOGERROR, "%s::%s Failed to create deinterlace component (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status)); - return false; - } -+ bool advanced_deinterlace = (interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED || interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF) && -+ m_decoded_width * m_decoded_height <= 576 * 720; -+ bool half_framerate = interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF || interlace_method == VS_INTERLACEMETHOD_MMAL_BOB_HALF; -+ - MMAL_PARAMETER_IMAGEFX_PARAMETERS_T imfx_param = {{MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, sizeof(imfx_param)}, -- interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED || interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF ? -- MMAL_PARAM_IMAGEFX_DEINTERLACE_ADV : MMAL_PARAM_IMAGEFX_DEINTERLACE_FAST, -- 3, {3, 0, interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF || interlace_method == VS_INTERLACEMETHOD_MMAL_BOB_HALF }}; -+ advanced_deinterlace ? MMAL_PARAM_IMAGEFX_DEINTERLACE_ADV : MMAL_PARAM_IMAGEFX_DEINTERLACE_FAST, 3, {3, 0, half_framerate }}; -+ - status = mmal_port_parameter_set(m_deint->output[0], &imfx_param.hdr); - if (status != MMAL_SUCCESS) - { -@@ -375,6 +378,14 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) - MMAL_PORT_T *m_deint_input = m_deint->input[0]; - m_deint_input->userdata = (struct MMAL_PORT_USERDATA_T *)this; - -+ if (!advanced_deinterlace) -+ { -+ // Image_fx assumed 3 frames of context. simple deinterlace doesn't require this -+ status = mmal_port_parameter_set_uint32(m_deint_input, MMAL_PARAMETER_EXTRA_BUFFERS, -2); -+ if (status != MMAL_SUCCESS) -+ CLog::Log(LOGERROR, "%s::%s Failed to enable extra buffers on %s (status=%x %s)", CLASSNAME, __func__, m_deint_input->name, status, mmal_status_to_string(status)); -+ } -+ - // Now connect the decoder output port to deinterlace input port - status = mmal_connection_create(&m_deint_connection, m_dec->output[0], m_deint->input[0], MMAL_CONNECTION_FLAG_TUNNELLING | MMAL_CONNECTION_FLAG_ALLOCATION_ON_INPUT); - if (status != MMAL_SUCCESS) - -From 93285a243328c5d05e7437715e90c4fb4ed701b2 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 31 Mar 2015 00:36:48 +0100 -Subject: [PATCH 081/103] [mmalrenderer] Avoid submitting a buffer to renderer - twice - -Bad things happen when submitting a buffer to renderer twice. We were attempting to protect against that with -a flip count. However that was getting reset from AddProcessor, the the sequence: -Decode->AddProcessor->RenderUpdate->AddProcessor->RenderUpdate -could occur. Instead use a bit from the MMAL flags which is unlikely to get out of sync with the MMAL buffer. ---- - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 15 ++++++++++++--- - xbmc/cores/VideoRenderers/MMALRenderer.h | 1 - - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 3 ++- - 3 files changed, 14 insertions(+), 5 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index f4c59ea..357d023 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -54,6 +54,7 @@ void CMMALRenderer::vout_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T * - - if (m_format == RENDER_FMT_MMAL) - { -+ buffer->flags &= ~MMAL_BUFFER_HEADER_FLAG_USER2; - mmal_queue_put(m_release_queue, buffer); - } - else if (m_format == RENDER_FMT_YUV420P) -@@ -359,9 +360,6 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - SetVideoRect(m_sourceRect, m_destRect); - - YUVBUFFER *buffer = &m_buffers[source]; -- // we only want to upload frames once -- if (buffer->flipindex++) -- return; - if (m_format == RENDER_FMT_MMAL) - { - CMMALVideoBuffer *omvb = buffer->MMALBuffer; -@@ -370,7 +368,11 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - #if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s %p (%p)", CLASSNAME, __func__, omvb, omvb->mmal_buffer); - #endif -+ // we only want to upload frames once -+ if (omvb->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) -+ 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); - } //else assert(0); - } -@@ -378,7 +380,14 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - { - CLog::Log(LOGDEBUG, "%s::%s - %p %d", CLASSNAME, __func__, buffer->mmal_buffer, source); - if (buffer->mmal_buffer) -+ { -+ // we only want to upload frames once -+ if (buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) -+ return; -+ // sanity check it is not on display -+ buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1; - mmal_port_send_buffer(m_vout_input, buffer->mmal_buffer); -+ } - else assert(0); - } - else assert(0); -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h -index 3422e2d..6e8f240 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.h -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.h -@@ -49,7 +49,6 @@ class CMMALRenderer : public CBaseRenderer, public CThread - { - CMMALVideoBuffer *MMALBuffer; // used for hw decoded buffers - MMAL_BUFFER_HEADER_T *mmal_buffer; // used for sw decoded buffers -- unsigned flipindex; /* used to decide if this has been uploaded */ - }; - public: - CMMALRenderer(); -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 03d397f..7410c36 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -1007,7 +1007,8 @@ void CMMALVideo::ReturnBuffer(CMMALVideoBuffer *buffer) - { - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s %p (%d)", CLASSNAME, __func__, buffer, m_output_busy); -- -+ // sanity check it is not on display -+ assert(!(buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER2)); - mmal_buffer_header_release(buffer->mmal_buffer); - } - - -From e0aa63a4be636c5f6bee31df646170d616836c72 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 31 Mar 2015 00:37:25 +0100 -Subject: [PATCH 082/103] [omximage] Increase timeout on encode - ---- - xbmc/cores/omxplayer/OMXImage.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp -index e79f41d..d99d719 100644 ---- a/xbmc/cores/omxplayer/OMXImage.cpp -+++ b/xbmc/cores/omxplayer/OMXImage.cpp -@@ -1414,7 +1414,7 @@ bool COMXImageEnc::Encode(unsigned char *buffer, int size, unsigned width, unsig - m_omx_encoder.DecoderFillBufferDone(m_omx_encoder.GetComponent(), m_encoded_buffer); - return false; - } -- omx_err = m_omx_encoder.WaitForOutputDone(1000); -+ omx_err = m_omx_encoder.WaitForOutputDone(2000); - if(omx_err != OMX_ErrorNone) - { - CLog::Log(LOGERROR, "%s::%s m_omx_encoder.WaitForOutputDone result(0x%x)\n", CLASSNAME, __func__, omx_err); - -From 6b974ed76e12bd270969ad6f8bf3ec43f2193d34 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 31 Mar 2015 01:25:04 +0100 -Subject: [PATCH 083/103] [mmalrenderer] Reset m_buffers on PreInit - -When switching rapidly between different files you sometimes ended up with a stale buffer ---- - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index 357d023..82a066b 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -374,7 +374,9 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - 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); -- } //else assert(0); -+ } -+ else -+ CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); - } - else if (m_format == RENDER_FMT_YUV420P) - { -@@ -388,7 +390,8 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1; - mmal_port_send_buffer(m_vout_input, buffer->mmal_buffer); - } -- else assert(0); -+ else -+ CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); - } - else assert(0); - } -@@ -423,6 +426,7 @@ unsigned int CMMALRenderer::PreInit() - m_formats.push_back(RENDER_FMT_MMAL); - m_formats.push_back(RENDER_FMT_BYPASS); - -+ memset(m_buffers, 0, sizeof m_buffers); - m_iYV12RenderBuffer = 0; - m_NumYV12Buffers = NUM_BUFFERS; - - -From f3983e34dde74a7cb8b0f0c8b3bd8c573ec66b3d Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 31 Mar 2015 17:34:00 +0100 -Subject: [PATCH 084/103] [mmalrenderer] Add locking around m_droppedPics - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 7410c36..5018f3e 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -267,6 +267,9 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - - if (m_drop_state) - { -+ pthread_mutex_lock(&m_output_mutex); -+ m_droppedPics++; -+ pthread_mutex_unlock(&m_output_mutex); - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s - dropping %p (drop:%d)", CLASSNAME, __func__, buffer, m_drop_state); - } -@@ -756,6 +759,7 @@ void CMMALVideo::SetDropState(bool bDrop) - { - buffer = m_output_ready.front(); - m_output_ready.pop(); -+ m_droppedPics++; - } - pthread_mutex_unlock(&m_output_mutex); - if (buffer) -@@ -869,6 +873,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) - - if (demuxer_bytes == 0) - { -+ pthread_mutex_lock(&m_output_mutex); - m_decode_frame_number++; - m_startframe = true; - if (m_drop_state) -@@ -878,11 +883,10 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) - else - { - // only push if we are successful with feeding mmal -- pthread_mutex_lock(&m_output_mutex); - m_dts_queue.push(dts); - assert(m_dts_queue.size() < 5000); -- pthread_mutex_unlock(&m_output_mutex); - } -+ pthread_mutex_unlock(&m_output_mutex); - if (m_changed_count_dec != m_changed_count) - { - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -981,6 +985,7 @@ void CMMALVideo::Reset(void) - while (!m_demux_queue.empty()) - m_demux_queue.pop(); - m_demux_queue_length = 0; -+ m_droppedPics = 0; - pthread_mutex_unlock(&m_output_mutex); - if (!old_drop_state) - SetDropState(false); -@@ -990,7 +995,6 @@ void CMMALVideo::Reset(void) - - m_startframe = false; - m_decoderPts = DVD_NOPTS_VALUE; -- m_droppedPics = 0; - m_decode_frame_number = 1; - m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); - } -@@ -1124,9 +1128,11 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) - - bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) - { -+ pthread_mutex_lock(&m_output_mutex); - pts = m_decoderPts; - droppedPics = m_droppedPics; - m_droppedPics = 0; -+ pthread_mutex_unlock(&m_output_mutex); - //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - // CLog::Log(LOGDEBUG, "%s::%s - pts:%.0f droppedPics:%d", CLASSNAME, __func__, pts, droppedPics); - return true; - -From 26a386aac6449208c791dbf0de920aca4c46a4ce Mon Sep 17 00:00:00 2001 +From 63a3a45ee208669b1b74a4f88aa9802ab5bf6c49 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 31 Mar 2015 17:31:47 +0100 -Subject: [PATCH 085/103] [mmalrenderer] Add SetCodecControl function and - prefer to return pictures when renderer is low (disabled) +Subject: [PATCH 70/89] [mmalrenderer] Add SetCodecControl function and prefer + to return pictures when renderer is low (disabled) --- xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp | 5 +++++ @@ -8241,10 +6900,10 @@ index a768e70..aa8e87f 100644 protected: diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 5018f3e..3868342 100644 +index 9e0aa66..1e711b4 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -130,6 +130,7 @@ CMMALVideo::CMMALVideo() +@@ -128,6 +128,7 @@ CMMALVideo::CMMALVideo() m_es_format = mmal_format_alloc(); m_preroll = true; m_speed = DVD_PLAYSPEED_NORMAL; @@ -8252,7 +6911,7 @@ index 5018f3e..3868342 100644 } CMMALVideo::~CMMALVideo() -@@ -945,6 +946,9 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -944,6 +945,9 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) if (g_advancedSettings.CanLogComponent(LOGVIDEO)) CLog::Log(LOGDEBUG, "%s::%s - got output picture:%d", CLASSNAME, __func__, m_output_ready.size()); ret |= VC_PICTURE; @@ -8262,15 +6921,15 @@ index 5018f3e..3868342 100644 } if (!ret) { -@@ -997,6 +1001,7 @@ void CMMALVideo::Reset(void) +@@ -995,6 +999,7 @@ void CMMALVideo::Reset(void) + m_startframe = false; m_decoderPts = DVD_NOPTS_VALUE; - m_decode_frame_number = 1; m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); + m_codecControlFlags = 0; } void CMMALVideo::SetSpeed(int iSpeed) -@@ -1137,3 +1142,10 @@ bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) +@@ -1128,3 +1133,10 @@ bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) // CLog::Log(LOGDEBUG, "%s::%s - pts:%.0f droppedPics:%d", CLASSNAME, __func__, pts, droppedPics); return true; } @@ -8282,10 +6941,10 @@ index 5018f3e..3868342 100644 + CLog::Log(LOGDEBUG, "%s::%s flags:%x", CLASSNAME, __func__, flags); +} diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -index ca513f6..ec44b13 100644 +index 4c9b20f..c405aa1 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -@@ -90,6 +90,7 @@ class CMMALVideo +@@ -89,6 +89,7 @@ class CMMALVideo virtual void SetDropState(bool bDrop); virtual const char* GetName(void) { return (const char*)m_pFormatName; } virtual bool GetCodecStats(double &pts, int &droppedPics); @@ -8293,7 +6952,7 @@ index ca513f6..ec44b13 100644 virtual void SetSpeed(int iSpeed); // MMAL decoder callback routines. -@@ -143,6 +144,7 @@ class CMMALVideo +@@ -140,6 +141,7 @@ class CMMALVideo unsigned int m_droppedPics; int m_speed; bool m_preroll; @@ -8302,10 +6961,10 @@ index ca513f6..ec44b13 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; -From 74cc992c8216da6e5a39fe5f470005c9d1accdbb Mon Sep 17 00:00:00 2001 +From be88e53ace69911dd0400e19c087f6bac7318ec9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 Apr 2015 16:31:37 +0100 -Subject: [PATCH 086/103] [mmalcodec] Limit submitted video frames. Seems to +Subject: [PATCH 71/89] [mmalcodec] Limit submitted video frames. Seems to avoid stutter issues with low bitrate videos --- @@ -8313,10 +6972,10 @@ Subject: [PATCH 086/103] [mmalcodec] Limit submitted video frames. Seems to 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 3868342..2e23430 100644 +index 1e711b4..77c31f2 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -929,7 +929,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -928,7 +928,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) break; } int ret = 0; @@ -8327,370 +6986,10 @@ index 3868342..2e23430 100644 if (g_advancedSettings.CanLogComponent(LOGVIDEO)) CLog::Log(LOGDEBUG, "%s::%s - got space for output: demux_queue(%d) space(%d)", CLASSNAME, __func__, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); -From 66bb7019bb917be310d6a2bd21fb206302d8ee1a Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 1 Apr 2015 18:35:01 +0100 -Subject: [PATCH 087/103] [rbp] Disable analogue output of sync when - passthrough is enabled - -The analogue and output of Pi Sink doesn't support passthrough. -This also applies to the 'Both' (HDMI and Analogue) setting. -If passthrough is enabled in GUI you get black screen and errors: -https://discourse.osmc.tv/t/some-streams-are-staying-black/2311 - -We need to either disable passthrough or disable analogue. - -I think the best solution to this is to force HDMI output when passthrough is active. - -This allows a user to use receiver for videos with dts/ac3 and TV for music or lower quality formats. ---- - xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 22 ++++++++++++++-------- - xbmc/cores/AudioEngine/Sinks/AESinkPi.h | 1 + - xbmc/cores/omxplayer/OMXAudio.cpp | 21 +++++++++++++++------ - xbmc/cores/omxplayer/OMXAudio.h | 1 + - 4 files changed, 31 insertions(+), 14 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -index 7f4d103..b69925a 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -@@ -45,7 +45,8 @@ CAESinkPi::CAESinkPi() : - m_latency(0), - m_Initialized(false), - m_submitted(0), -- m_omx_output(NULL) -+ m_omx_output(NULL), -+ m_output(AESINKPI_UNKNOWN) - { - } - -@@ -60,7 +61,7 @@ void CAESinkPi::SetAudioDest() - OMX_INIT_STRUCTURE(audioDest); - if ( m_omx_render.IsInitialized() ) - { -- if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") -+ if (m_output == AESINKPI_ANALOGUE) - strncpy((char *)audioDest.sName, "local", strlen("local")); - else - strncpy((char *)audioDest.sName, "hdmi", strlen("hdmi")); -@@ -70,7 +71,7 @@ void CAESinkPi::SetAudioDest() - } - if ( m_omx_render_slave.IsInitialized() ) - { -- if (CSettings::Get().GetString("audiooutput.audiodevice") != "PI:Analogue") -+ if (m_output != AESINKPI_ANALOGUE) - strncpy((char *)audioDest.sName, "local", strlen("local")); - else - strncpy((char *)audioDest.sName, "hdmi", strlen("hdmi")); -@@ -193,12 +194,17 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) - m_latency = CSettings::Get().GetInt("audiooutput.latency") * 1e-3; - m_latency = std::max(m_latency, 50e-3); - -+ if (m_passthrough || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:HDMI") -+ m_output = AESINKPI_HDMI; -+ else if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") -+ m_output = AESINKPI_ANALOGUE; -+ else if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -+ m_output = AESINKPI_BOTH; -+ else assert(0); -+ - // analogue only supports stereo -- if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue" || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -- { -+ if (m_output == AESINKPI_ANALOGUE || m_output == AESINKPI_BOTH) - format.m_channelLayout = AE_CH_LAYOUT_2_0; -- m_passthrough = false; -- } - - // setup for a 50ms sink feed from SoftAE - if (format.m_dataFormat != AE_FMT_FLOATP && format.m_dataFormat != AE_FMT_FLOAT && -@@ -226,7 +232,7 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) - if (!m_omx_render.Initialize("OMX.broadcom.audio_render", OMX_IndexParamAudioInit)) - CLog::Log(LOGERROR, "%s::%s - m_omx_render.Initialize omx_err(0x%08x)", CLASSNAME, __func__, omx_err); - -- if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -+ if (m_output == AESINKPI_BOTH) - { - if (!m_omx_splitter.Initialize("OMX.broadcom.audio_splitter", OMX_IndexParamAudioInit)) - CLog::Log(LOGERROR, "%s::%s - m_omx_splitter.Initialize omx_err(0x%08x)", CLASSNAME, __func__, omx_err); -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.h b/xbmc/cores/AudioEngine/Sinks/AESinkPi.h -index cac5051..10b0ec6 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.h -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.h -@@ -65,6 +65,7 @@ class CAESinkPi : public IAESink - bool m_passthrough; - COMXCoreTunel m_omx_tunnel_splitter; - COMXCoreTunel m_omx_tunnel_splitter_slave; -+ enum { AESINKPI_UNKNOWN, AESINKPI_HDMI, AESINKPI_ANALOGUE, AESINKPI_BOTH } m_output; - }; - - #endif -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index dd5cdb8..9d960aa 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -88,7 +88,8 @@ COMXAudio::COMXAudio() : - m_extrasize (0 ), - m_last_pts (DVD_NOPTS_VALUE), - m_submitted_eos (false ), -- m_failed_eos (false ) -+ m_failed_eos (false ), -+ m_output (AESINKPI_UNKNOWN) - { - CAEFactory::Suspend(); - while (!CAEFactory::IsSuspended()) -@@ -119,17 +120,17 @@ bool COMXAudio::PortSettingsChanged() - if(!m_omx_mixer.Initialize("OMX.broadcom.audio_mixer", OMX_IndexParamAudioInit)) - return false; - } -- if(CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -+ if(m_output == AESINKPI_BOTH) - { - if(!m_omx_splitter.Initialize("OMX.broadcom.audio_splitter", OMX_IndexParamAudioInit)) - return false; - } -- if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both" || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") -+ if (m_output == AESINKPI_BOTH || m_output == AESINKPI_ANALOGUE) - { - if(!m_omx_render_analog.Initialize("OMX.broadcom.audio_render", OMX_IndexParamAudioInit)) - return false; - } -- if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both" || CSettings::Get().GetString("audiooutput.audiodevice") != "PI:Analogue") -+ if (m_output == AESINKPI_BOTH || m_output != AESINKPI_ANALOGUE) - { - if(!m_omx_render_hdmi.Initialize("OMX.broadcom.audio_render", OMX_IndexParamAudioInit)) - return false; -@@ -248,7 +249,7 @@ bool COMXAudio::PortSettingsChanged() - // By default audio_render is the clock master, and if output samples don't fit the timestamps, it will speed up/slow down the clock. - // This tends to be better for maintaining audio sync and avoiding audio glitches, but can affect video/display sync - if((CSettings::Get().GetBool("videoplayer.usedisplayasclock") && CSettings::Get().GetInt("videoplayer.synctype") == SYNC_DISCON) || -- CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -+ m_output == AESINKPI_BOTH) - { - OMX_CONFIG_BOOLEANTYPE configBool; - OMX_INIT_STRUCTURE(configBool); -@@ -570,6 +571,14 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - } - SetCodingType(format.m_dataFormat); - -+ if (m_Passthrough || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:HDMI") -+ m_output = AESINKPI_HDMI; -+ else if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") -+ m_output = AESINKPI_ANALOGUE; -+ else if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") -+ m_output = AESINKPI_BOTH; -+ else assert(0); -+ - if(hints.extrasize > 0 && hints.extradata != NULL) - { - m_extrasize = hints.extrasize; -@@ -597,7 +606,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - CAEChannelInfo stdLayout = (enum AEStdChLayout)CSettings::Get().GetInt("audiooutput.channels"); - - // ignore layout setting for analogue -- if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both" || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue") -+ if (m_output == AESINKPI_ANALOGUE || m_output == AESINKPI_BOTH) - stdLayout = AE_CH_LAYOUT_2_0; - - CAEChannelInfo resolvedMap = channelMap; -diff --git a/xbmc/cores/omxplayer/OMXAudio.h b/xbmc/cores/omxplayer/OMXAudio.h -index 569cb09..c31d25e 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.h -+++ b/xbmc/cores/omxplayer/OMXAudio.h -@@ -124,6 +124,7 @@ class COMXAudio - double m_last_pts; - bool m_submitted_eos; - bool m_failed_eos; -+ enum { AESINKPI_UNKNOWN, AESINKPI_HDMI, AESINKPI_ANALOGUE, AESINKPI_BOTH } m_output; - - typedef struct { - double pts; - -From 91009891251f052d8a1dc74deac32990cd8deb65 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 2 Apr 2015 15:40:22 +0100 -Subject: [PATCH 088/103] [mmalrenderer] Discard corrupt frames later so we can - track the number of discarded frames - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 2e23430..a842ddd 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -274,6 +274,11 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s - dropping %p (drop:%d)", CLASSNAME, __func__, buffer, m_drop_state); - } -+ else if (g_advancedSettings.m_omxDecodeStartWithValidFrame && (buffer->flags & MMAL_BUFFER_HEADER_FLAG_CORRUPTED)) -+ { -+ CLog::Log(LOGDEBUG, "%s::%s - %p buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x Corrupted", -+ CLASSNAME, __func__, buffer, buffer->length, dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags); -+ } - else - { - CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); -@@ -643,7 +648,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide - - error_concealment.hdr.id = MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT; - error_concealment.hdr.size = sizeof(MMAL_PARAMETER_BOOLEAN_T); -- error_concealment.enable = g_advancedSettings.m_omxDecodeStartWithValidFrame; -+ error_concealment.enable = false; - status = mmal_port_parameter_set(m_dec_input, &error_concealment.hdr); - if (status != MMAL_SUCCESS) - CLog::Log(LOGERROR, "%s::%s Failed to disable error concealment on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); - -From 0e0ac43fad3b3ec91c7fb11ac482e7e0b655d213 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 6 Apr 2015 19:08:20 +0100 -Subject: [PATCH 089/103] Revert "[mmalrenderer] Discard corrupt frames later - so we can track the number of discarded frames" - -This reverts commit e3f57826eff42a3f1843dffd978ac98bda372826. ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index a842ddd..2e23430 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -274,11 +274,6 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s - dropping %p (drop:%d)", CLASSNAME, __func__, buffer, m_drop_state); - } -- else if (g_advancedSettings.m_omxDecodeStartWithValidFrame && (buffer->flags & MMAL_BUFFER_HEADER_FLAG_CORRUPTED)) -- { -- CLog::Log(LOGDEBUG, "%s::%s - %p buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x Corrupted", -- CLASSNAME, __func__, buffer, buffer->length, dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags); -- } - else - { - CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); -@@ -648,7 +643,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide - - error_concealment.hdr.id = MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT; - error_concealment.hdr.size = sizeof(MMAL_PARAMETER_BOOLEAN_T); -- error_concealment.enable = false; -+ error_concealment.enable = g_advancedSettings.m_omxDecodeStartWithValidFrame; - status = mmal_port_parameter_set(m_dec_input, &error_concealment.hdr); - if (status != MMAL_SUCCESS) - CLog::Log(LOGERROR, "%s::%s Failed to disable error concealment on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); - -From 3c322da17a4b5e38cd9e683db4353badca1dab42 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 2 Apr 2015 00:25:26 +0100 -Subject: [PATCH 090/103] [mmalcodec] Allocate more buffers when deinterlacing - -Needed with trickplay with deinterlace. TODO: can this be reduced ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 11 ++++------- - 1 file changed, 4 insertions(+), 7 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 2e23430..180b96f 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -382,13 +382,10 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) - MMAL_PORT_T *m_deint_input = m_deint->input[0]; - m_deint_input->userdata = (struct MMAL_PORT_USERDATA_T *)this; - -- if (!advanced_deinterlace) -- { -- // Image_fx assumed 3 frames of context. simple deinterlace doesn't require this -- status = mmal_port_parameter_set_uint32(m_deint_input, MMAL_PARAMETER_EXTRA_BUFFERS, -2); -- if (status != MMAL_SUCCESS) -- CLog::Log(LOGERROR, "%s::%s Failed to enable extra buffers on %s (status=%x %s)", CLASSNAME, __func__, m_deint_input->name, status, mmal_status_to_string(status)); -- } -+ // Image_fx assumed 3 frames of context. simple deinterlace doesn't require this -+ status = mmal_port_parameter_set_uint32(m_deint_input, MMAL_PARAMETER_EXTRA_BUFFERS, GetAllowedReferences() - 5 + advanced_deinterlace ? 2:0); -+ if (status != MMAL_SUCCESS) -+ CLog::Log(LOGERROR, "%s::%s Failed to enable extra buffers on %s (status=%x %s)", CLASSNAME, __func__, m_deint_input->name, status, mmal_status_to_string(status)); - - // Now connect the decoder output port to deinterlace input port - status = mmal_connection_create(&m_deint_connection, m_dec->output[0], m_deint->input[0], MMAL_CONNECTION_FLAG_TUNNELLING | MMAL_CONNECTION_FLAG_ALLOCATION_ON_INPUT); - -From 0248c175316462dfe5bf4721b062db88f109c561 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 3 Apr 2015 10:49:55 +0200 -Subject: [PATCH 091/103] dvdplayer: cosmetics - ---- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 41 ++++++++++++++++++++------------------ - 1 file changed, 22 insertions(+), 19 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 8ceb498..1f220c6 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -1454,16 +1454,18 @@ void CDVDPlayer::Process() - - m_OmxPlayerState.bOmxSentEOFs = true; - } -+ - if(m_CurrentAudio.inited) -- m_dvdPlayerAudio->SendMessage (new CDVDMsg(CDVDMsg::GENERAL_EOF)); -+ m_dvdPlayerAudio->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); - if(m_CurrentVideo.inited) -- m_dvdPlayerVideo->SendMessage (new CDVDMsg(CDVDMsg::GENERAL_EOF)); -+ m_dvdPlayerVideo->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); - if(m_CurrentSubtitle.inited) - m_dvdPlayerSubtitle->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); - if(m_CurrentTeletext.inited) - m_dvdPlayerTeletext->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); -- m_CurrentAudio.inited = false; -- m_CurrentVideo.inited = false; -+ -+ m_CurrentAudio.inited = false; -+ m_CurrentVideo.inited = false; - m_CurrentSubtitle.inited = false; - m_CurrentTeletext.inited = false; - -@@ -1573,21 +1575,22 @@ bool CDVDPlayer::CheckIsCurrent(CCurrentStream& current, CDemuxStream* stream, D - - void CDVDPlayer::ProcessPacket(CDemuxStream* pStream, DemuxPacket* pPacket) - { -- /* process packet if it belongs to selected stream. for dvd's don't allow automatic opening of streams*/ -- -- if (CheckIsCurrent(m_CurrentAudio, pStream, pPacket)) -- ProcessAudioData(pStream, pPacket); -- else if (CheckIsCurrent(m_CurrentVideo, pStream, pPacket)) -- ProcessVideoData(pStream, pPacket); -- else if (CheckIsCurrent(m_CurrentSubtitle, pStream, pPacket)) -- ProcessSubData(pStream, pPacket); -- else if (CheckIsCurrent(m_CurrentTeletext, pStream, pPacket)) -- ProcessTeletextData(pStream, pPacket); -- else -- { -- pStream->SetDiscard(AVDISCARD_ALL); -- CDVDDemuxUtils::FreeDemuxPacket(pPacket); // free it since we won't do anything with it -- } -+ // process packet if it belongs to selected stream. -+ // for dvd's don't allow automatic opening of streams*/ -+ -+ if (CheckIsCurrent(m_CurrentAudio, pStream, pPacket)) -+ ProcessAudioData(pStream, pPacket); -+ else if (CheckIsCurrent(m_CurrentVideo, pStream, pPacket)) -+ ProcessVideoData(pStream, pPacket); -+ else if (CheckIsCurrent(m_CurrentSubtitle, pStream, pPacket)) -+ ProcessSubData(pStream, pPacket); -+ else if (CheckIsCurrent(m_CurrentTeletext, pStream, pPacket)) -+ ProcessTeletextData(pStream, pPacket); -+ else -+ { -+ pStream->SetDiscard(AVDISCARD_ALL); -+ CDVDDemuxUtils::FreeDemuxPacket(pPacket); // free it since we won't do anything with it -+ } - } - - void CDVDPlayer::CheckStreamChanges(CCurrentStream& current, CDemuxStream* stream) - -From c1a1141d6ed1699fc2ab1bae805786a58d38786f Mon Sep 17 00:00:00 2001 +From ae1a4baf6e3fe6ebd229a1b56d5cd6314c2390a0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 6 Apr 2015 19:06:26 +0100 -Subject: [PATCH 092/103] [mmalcodec] Remove the decoder queue and use gpu +Subject: [PATCH 72/89] [mmalcodec] Remove the decoder queue and use gpu timestamps There are too many streams that don't have a 1:1 mapping of encoded video frames to decoded pictures. @@ -8700,15 +6999,15 @@ Interlaces streams and streams with errors cause issues. Instead remove the dts queue and use the gpu's timestamps. --- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 91 +++++++++++----------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 88 +++++++++++----------- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 2 +- - 2 files changed, 46 insertions(+), 47 deletions(-) + 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 180b96f..e5ea365 100644 +index 77c31f2..d8d733e 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -131,6 +131,7 @@ CMMALVideo::CMMALVideo() +@@ -129,6 +129,7 @@ CMMALVideo::CMMALVideo() m_preroll = true; m_speed = DVD_PLAYSPEED_NORMAL; m_codecControlFlags = 0; @@ -8716,7 +7015,7 @@ index 180b96f..e5ea365 100644 } CMMALVideo::~CMMALVideo() -@@ -254,27 +255,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf +@@ -258,27 +259,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf { assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_DECODEONLY)); double dts = DVD_NOPTS_VALUE; @@ -8745,7 +7044,7 @@ index 180b96f..e5ea365 100644 { CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -293,6 +274,14 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf +@@ -297,6 +278,14 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf pthread_mutex_unlock(&m_output_mutex); kept = true; } @@ -8760,7 +7059,7 @@ index 180b96f..e5ea365 100644 } } else if (buffer->cmd == MMAL_EVENT_FORMAT_CHANGED) -@@ -649,6 +638,10 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -653,6 +642,10 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide 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)); @@ -8771,7 +7070,7 @@ index 180b96f..e5ea365 100644 status = mmal_port_format_commit(m_dec_input); if (status != MMAL_SUCCESS) { -@@ -717,6 +710,8 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -721,6 +714,8 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide m_startframe = false; m_preroll = !m_hints.stills; m_speed = DVD_PLAYSPEED_NORMAL; @@ -8780,7 +7079,7 @@ index 180b96f..e5ea365 100644 return true; } -@@ -732,10 +727,9 @@ void CMMALVideo::Dispose() +@@ -736,10 +731,9 @@ void CMMALVideo::Dispose() done = true; pthread_mutex_unlock(&m_output_mutex); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8792,7 +7091,7 @@ index 180b96f..e5ea365 100644 m_myself.reset(); } } -@@ -768,11 +762,19 @@ void CMMALVideo::SetDropState(bool bDrop) +@@ -772,11 +766,19 @@ void CMMALVideo::SetDropState(bool bDrop) } } @@ -8814,7 +7113,7 @@ index 180b96f..e5ea365 100644 unsigned int demuxer_bytes = 0; uint8_t *demuxer_content = NULL; -@@ -836,6 +838,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -840,6 +842,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) return VC_ERROR; } @@ -8827,18 +7126,8 @@ index 180b96f..e5ea365 100644 + mmal_buffer_header_reset(buffer); buffer->cmd = 0; - if (m_startframe && pts == DVD_NOPTS_VALUE) -@@ -843,9 +852,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) - buffer->pts = pts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : pts; - buffer->dts = dts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : dts; - buffer->length = demuxer_bytes > buffer->alloc_size ? buffer->alloc_size : demuxer_bytes; -- buffer->user_data = (void *)m_decode_frame_number; -- // set a flag so we can identify primary frames from generated frames (deinterlace) -- buffer->flags = MMAL_BUFFER_HEADER_FLAG_USER0; - - // Request decode only (maintain ref frames, but don't return a picture) - if (m_drop_state) -@@ -859,8 +865,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + if (!m_startframe && pts == DVD_NOPTS_VALUE) +@@ -862,8 +871,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) buffer->flags |= MMAL_BUFFER_HEADER_FLAG_FRAME_END; if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8849,7 +7138,7 @@ index 180b96f..e5ea365 100644 assert((int)buffer->length > 0); status = mmal_port_send_buffer(m_dec_input, buffer); if (status != MMAL_SUCCESS) -@@ -878,12 +884,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -880,12 +889,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { m_droppedPics += m_deint ? 2:1; } @@ -8862,7 +7151,7 @@ index 180b96f..e5ea365 100644 pthread_mutex_unlock(&m_output_mutex); if (m_changed_count_dec != m_changed_count) { -@@ -926,11 +926,11 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -928,11 +931,11 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) break; } int ret = 0; @@ -8877,7 +7166,7 @@ index 180b96f..e5ea365 100644 ret |= VC_BUFFER; } else -@@ -951,8 +951,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -953,8 +956,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) if (!ret) { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8888,7 +7177,7 @@ index 180b96f..e5ea365 100644 Sleep(10); // otherwise we busy spin } return ret; -@@ -982,8 +982,6 @@ void CMMALVideo::Reset(void) +@@ -984,8 +987,6 @@ void CMMALVideo::Reset(void) bool old_drop_state = m_drop_state; SetDropState(true); pthread_mutex_lock(&m_output_mutex); @@ -8897,15 +7186,15 @@ index 180b96f..e5ea365 100644 while (!m_demux_queue.empty()) m_demux_queue.pop(); m_demux_queue_length = 0; -@@ -1000,6 +998,7 @@ void CMMALVideo::Reset(void) - m_decode_frame_number = 1; +@@ -1001,6 +1002,7 @@ void CMMALVideo::Reset(void) + m_decoderPts = DVD_NOPTS_VALUE; m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); m_codecControlFlags = 0; + m_history_valid_pts = ~0; } void CMMALVideo::SetSpeed(int iSpeed) -@@ -1028,8 +1027,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) +@@ -1020,8 +1022,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) mmal_buffer_header_reset(buffer); buffer->cmd = 0; if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8916,7 +7205,7 @@ index 180b96f..e5ea365 100644 status = mmal_port_send_buffer(m_dec_output, buffer); if (status != MMAL_SUCCESS) { -@@ -1054,7 +1053,7 @@ void CMMALVideo::ReleaseBuffer(CMMALVideoBuffer *buffer) +@@ -1048,7 +1050,7 @@ void CMMALVideo::ReleaseBuffer(CMMALVideoBuffer *buffer) if (done) m_myself.reset(); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8926,10 +7215,10 @@ index 180b96f..e5ea365 100644 } diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -index ec44b13..a859467 100644 +index c405aa1..f5f664a 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -@@ -119,7 +119,6 @@ class CMMALVideo +@@ -118,7 +118,6 @@ class CMMALVideo const char *m_pFormatName; MMALVideoPtr m_myself; @@ -8937,7 +7226,7 @@ index ec44b13..a859467 100644 std::queue m_demux_queue; unsigned m_demux_queue_length; -@@ -145,6 +144,7 @@ class CMMALVideo +@@ -142,6 +141,7 @@ class CMMALVideo int m_speed; bool m_preroll; int m_codecControlFlags; @@ -8946,92 +7235,11 @@ index ec44b13..a859467 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; -From b4f0f4e150544d573bd61baa8842ecd10212a526 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 7 Apr 2015 19:50:15 +0100 -Subject: [PATCH 093/103] [mmalrenderer] Fix for inverted check for first frame - ---- - 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 e5ea365..7c53347 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -847,7 +847,7 @@ 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) -+ 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; - -From 8f998d7464019a7aa254b08f338ba73a0f8e4c03 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 8 Apr 2015 22:52:03 +0100 -Subject: [PATCH 094/103] Revert "[omxplayer] Only enable audio clock master - when A/V sync method is set to audio clock" - -This reverts commit 56491e6e9f01744f4c43abe7a7ddc1f5a5b179c3. ---- - xbmc/cores/omxplayer/OMXAudio.cpp | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 9d960aa..9bb967a 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -248,8 +248,7 @@ bool COMXAudio::PortSettingsChanged() - { - // By default audio_render is the clock master, and if output samples don't fit the timestamps, it will speed up/slow down the clock. - // This tends to be better for maintaining audio sync and avoiding audio glitches, but can affect video/display sync -- if((CSettings::Get().GetBool("videoplayer.usedisplayasclock") && CSettings::Get().GetInt("videoplayer.synctype") == SYNC_DISCON) || -- m_output == AESINKPI_BOTH) -+ if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") || m_output == AESINKPI_BOTH) - { - OMX_CONFIG_BOOLEANTYPE configBool; - OMX_INIT_STRUCTURE(configBool); -@@ -275,7 +274,7 @@ bool COMXAudio::PortSettingsChanged() - { - // By default audio_render is the clock master, and if output samples don't fit the timestamps, it will speed up/slow down the clock. - // This tends to be better for maintaining audio sync and avoiding audio glitches, but can affect video/display sync -- if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") && CSettings::Get().GetInt("videoplayer.synctype") == SYNC_DISCON) -+ if(CSettings::Get().GetBool("videoplayer.usedisplayasclock")) - { - OMX_CONFIG_BOOLEANTYPE configBool; - OMX_INIT_STRUCTURE(configBool); - -From a71bb2cbab462337944da1c6499b5c0c8973bff3 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 9 Apr 2015 17:12:56 +0100 -Subject: [PATCH 095/103] squash: add timeout to vc_dispmanx_vsync_callback - ---- - xbmc/linux/RBP.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index fe1df00..8bf0f14 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -196,7 +196,7 @@ void CRBP::WaitVsync() - s = vc_dispmanx_vsync_callback(m_display, vsync_callback, (void *)&m_vsync); - if (s == 0) - { -- m_vsync.Wait(); -+ m_vsync.WaitMSec(1000); - } - else assert(0); - s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); - -From 3da7de0426191fae9e88ff8b39fd4c850d7b00df Mon Sep 17 00:00:00 2001 +From 2f763b28cb818300befb9f7a4c6fd79c7ced9d7f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 9 Apr 2015 18:18:09 +0100 -Subject: [PATCH 096/103] [mmalrenderer] Remove dropping logic. It only seems - to make things worse +Subject: [PATCH 73/89] [mmalrenderer] Remove dropping logic. It only seems to + make things worse --- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 76 +++++++--------------- @@ -9039,10 +7247,10 @@ Subject: [PATCH 096/103] [mmalrenderer] Remove dropping logic. It only seems 2 files changed, 23 insertions(+), 55 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 7c53347..670e13f 100644 +index d8d733e..cfe106a 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -98,7 +98,6 @@ CMMALVideo::CMMALVideo() +@@ -97,7 +97,6 @@ CMMALVideo::CMMALVideo() CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); pthread_mutex_init(&m_output_mutex, NULL); @@ -9050,15 +7258,15 @@ index 7c53347..670e13f 100644 m_decoded_width = 0; m_decoded_height = 0; -@@ -109,7 +108,6 @@ CMMALVideo::CMMALVideo() +@@ -108,7 +107,6 @@ CMMALVideo::CMMALVideo() m_interlace_method = VS_INTERLACEMETHOD_NONE; m_startframe = false; m_decoderPts = DVD_NOPTS_VALUE; - m_droppedPics = 0; - m_decode_frame_number = 1; m_dec = NULL; -@@ -255,7 +253,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf + m_dec_input = NULL; +@@ -259,7 +257,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf { assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_DECODEONLY)); double dts = DVD_NOPTS_VALUE; @@ -9067,7 +7275,7 @@ index 7c53347..670e13f 100644 { CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -276,11 +274,8 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf +@@ -280,11 +278,8 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf } else { @@ -9080,7 +7288,7 @@ index 7c53347..670e13f 100644 } } } -@@ -706,7 +701,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -710,7 +705,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide if (!SendCodecConfigData()) return false; @@ -9088,7 +7296,7 @@ index 7c53347..670e13f 100644 m_startframe = false; m_preroll = !m_hints.stills; m_speed = DVD_PLAYSPEED_NORMAL; -@@ -736,30 +730,8 @@ void CMMALVideo::Dispose() +@@ -740,30 +734,8 @@ void CMMALVideo::Dispose() void CMMALVideo::SetDropState(bool bDrop) { @@ -9121,9 +7329,9 @@ index 7c53347..670e13f 100644 } static unsigned count_bits(int32_t value) -@@ -853,10 +825,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) - buffer->dts = dts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : dts; - buffer->length = demuxer_bytes > buffer->alloc_size ? buffer->alloc_size : demuxer_bytes; +@@ -859,10 +831,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + // set a flag so we can identify primary frames from generated frames (deinterlace) + buffer->flags = MMAL_BUFFER_HEADER_FLAG_USER0; - // Request decode only (maintain ref frames, but don't return a picture) - if (m_drop_state) @@ -9132,9 +7340,9 @@ index 7c53347..670e13f 100644 memcpy(buffer->data, demuxer_content, buffer->length); demuxer_bytes -= buffer->length; demuxer_content += buffer->length; -@@ -880,10 +848,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -885,10 +853,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + { pthread_mutex_lock(&m_output_mutex); - m_decode_frame_number++; m_startframe = true; - if (m_drop_state) - { @@ -9143,7 +7351,7 @@ index 7c53347..670e13f 100644 pthread_mutex_unlock(&m_output_mutex); if (m_changed_count_dec != m_changed_count) { -@@ -979,16 +943,28 @@ void CMMALVideo::Reset(void) +@@ -984,16 +948,28 @@ void CMMALVideo::Reset(void) mmal_port_enable(m_dec_output, dec_output_port_cb_static); } // blow all ready video frames @@ -9177,7 +7385,7 @@ index 7c53347..670e13f 100644 if (!m_finished) SendCodecConfigData(); -@@ -1130,14 +1106,8 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) +@@ -1127,14 +1103,8 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) { @@ -9195,10 +7403,10 @@ index 7c53347..670e13f 100644 void CMMALVideo::SetCodecControl(int flags) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -index a859467..7161f59 100644 +index f5f664a..f79fed5 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -@@ -110,7 +110,6 @@ class CMMALVideo +@@ -109,7 +109,6 @@ class CMMALVideo bool DestroyDeinterlace(); // Video format @@ -9206,62 +7414,19 @@ index a859467..7161f59 100644 int m_decoded_width; int m_decoded_height; unsigned int m_egl_buffer_count; -@@ -140,7 +139,6 @@ class CMMALVideo +@@ -137,7 +136,6 @@ class CMMALVideo + EINTERLACEMETHOD m_interlace_method; bool m_startframe; - unsigned int m_decode_frame_number; double m_decoderPts; - unsigned int m_droppedPics; int m_speed; bool m_preroll; int m_codecControlFlags; -From e533440ab93a6682c978dbdc6a4fb915f1eb216c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 10 Apr 2015 13:24:41 +0100 -Subject: [PATCH 097/103] [mmalrenderer] squash: logging - ---- - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index 82a066b..52eb6b3 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -46,9 +46,8 @@ static void vout_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer - - void CMMALRenderer::vout_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) - { -- CMMALVideoBuffer *omvb = (CMMALVideoBuffer *)buffer->user_data; -- - #if defined(MMAL_DEBUG_VERBOSE) -+ CMMALVideoBuffer *omvb = (CMMALVideoBuffer *)buffer->user_data; - CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p (%p), len %d cmd:%x", CLASSNAME, __func__, port, buffer, omvb, buffer->length, buffer->cmd); - #endif - -@@ -305,7 +304,7 @@ void CMMALRenderer::ReleaseBuffer(int idx) - return; - - #if defined(MMAL_DEBUG_VERBOSE) -- CLog::Log(LOGDEBUG, "%s::%s - %d", CLASSNAME, __func__, idx); -+ CLog::Log(LOGDEBUG, "%s::%s - %d (%p)", CLASSNAME, __func__, idx, m_buffers[idx].MMALBuffer); - #endif - YUVBUFFER &buf = m_buffers[idx]; - SAFE_RELEASE(buf.MMALBuffer); -@@ -314,7 +313,7 @@ void CMMALRenderer::ReleaseBuffer(int idx) - void CMMALRenderer::ReleaseImage(int source, bool preserve) - { - #if defined(MMAL_DEBUG_VERBOSE) -- CLog::Log(LOGDEBUG, "%s::%s - %d %d", CLASSNAME, __func__, source, preserve); -+ CLog::Log(LOGDEBUG, "%s::%s - %d %d (%p)", CLASSNAME, __func__, source, preserve, m_buffers[idx].MMALBuffer); - #endif - } - - -From af78e68c38ce0b9ae50856f54391eac299895a21 Mon Sep 17 00:00:00 2001 +From d0eb9742af9ecf3de62d560d0e5c57de2531486f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 Apr 2015 12:47:04 +0100 -Subject: [PATCH 098/103] [players] Make use of new scheme to submit DTS +Subject: [PATCH 74/89] [players] Make use of new scheme to submit DTS timestamps Latest firmware supports marking timestamps as DTS, @@ -9279,18 +7444,18 @@ timestamps in a single field. 6 files changed, 23 insertions(+), 70 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 670e13f..c5746bb 100644 +index cfe106a..237a581 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -58,7 +58,6 @@ CMMALVideoBuffer::CMMALVideoBuffer(CMMALVideo *omv) - index = 0; +@@ -57,7 +57,6 @@ CMMALVideoBuffer::CMMALVideoBuffer(CMMALVideo *omv) + height = 0; m_aspect_ratio = 0.0f; m_changed_count = 0; - dts = DVD_NOPTS_VALUE; } CMMALVideoBuffer::~CMMALVideoBuffer() -@@ -129,7 +128,6 @@ CMMALVideo::CMMALVideo() +@@ -127,7 +126,6 @@ CMMALVideo::CMMALVideo() m_preroll = true; m_speed = DVD_PLAYSPEED_NORMAL; m_codecControlFlags = 0; @@ -9298,7 +7463,7 @@ index 670e13f..c5746bb 100644 } CMMALVideo::~CMMALVideo() -@@ -252,17 +250,15 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf +@@ -256,17 +254,15 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf if (buffer->length > 0) { assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_DECODEONLY)); @@ -9317,7 +7482,7 @@ index 670e13f..c5746bb 100644 omvb->width = m_decoded_width; omvb->height = m_decoded_height; omvb->m_aspect_ratio = m_aspect_ratio; -@@ -275,7 +271,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf +@@ -279,7 +275,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf else { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -9326,7 +7491,7 @@ index 670e13f..c5746bb 100644 } } } -@@ -633,7 +629,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -637,7 +633,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide 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)); @@ -9339,7 +7504,7 @@ index 670e13f..c5746bb 100644 if (status != MMAL_SUCCESS) CLog::Log(LOGERROR, "%s::%s Failed to enable timestamp fifo mode on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); -@@ -704,8 +704,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -708,8 +708,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide m_startframe = false; m_preroll = !m_hints.stills; m_speed = DVD_PLAYSPEED_NORMAL; @@ -9348,7 +7513,7 @@ index 670e13f..c5746bb 100644 return true; } -@@ -734,14 +732,6 @@ void CMMALVideo::SetDropState(bool bDrop) +@@ -738,14 +736,6 @@ void CMMALVideo::SetDropState(bool bDrop) CLog::Log(LOGDEBUG, "%s::%s - bDrop(%d)", CLASSNAME, __func__, bDrop); } @@ -9363,7 +7528,7 @@ index 670e13f..c5746bb 100644 int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -809,14 +799,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -813,14 +803,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) CLog::Log(LOGERROR, "%s::%s - mmal_queue_get failed", CLASSNAME, __func__); return VC_ERROR; } @@ -9378,15 +7543,15 @@ index 670e13f..c5746bb 100644 mmal_buffer_header_reset(buffer); buffer->cmd = 0; if (!m_startframe && pts == DVD_NOPTS_VALUE) -@@ -974,7 +956,6 @@ void CMMALVideo::Reset(void) - m_decode_frame_number = 1; +@@ -978,7 +960,6 @@ void CMMALVideo::Reset(void) + m_decoderPts = DVD_NOPTS_VALUE; m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); m_codecControlFlags = 0; - m_history_valid_pts = ~0; } void CMMALVideo::SetSpeed(int iSpeed) -@@ -1067,7 +1048,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) +@@ -1064,7 +1045,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) } // timestamp is in microseconds @@ -9396,18 +7561,18 @@ index 670e13f..c5746bb 100644 pDvdVideoPicture->MMALBuffer->Acquire(); diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -index 7161f59..52290b6 100644 +index f79fed5..415f3e3 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -@@ -56,7 +56,6 @@ class CMMALVideoBuffer +@@ -55,7 +55,6 @@ class CMMALVideoBuffer + int width; int height; float m_aspect_ratio; - int index; - double dts; uint32_t m_changed_count; // reference counting CMMALVideoBuffer* Acquire(); -@@ -142,7 +141,6 @@ class CMMALVideo +@@ -139,7 +138,6 @@ class CMMALVideo int m_speed; bool m_preroll; int m_codecControlFlags; @@ -9565,161 +7730,2222 @@ index 3ea02dc..86e94ce 100644 void SetDropState(bool bDrop); std::string GetDecoderName() { return m_video_codec_name; }; -From 7bf14e5742366171b81f30d6ef6f93017903ccdc Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Mon, 13 Apr 2015 18:18:00 +0200 -Subject: [PATCH 099/103] dvdplayer audio: do not consider dropped packets for - sync error +From c5d5f34a04502ef918ad35de044862e4a6e4f843 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 14 Apr 2015 20:51:14 +0100 +Subject: [PATCH 75/89] [gui] Also limit GUI updates when in non full-screen + video mode --- - xbmc/cores/dvdplayer/DVDPlayerAudio.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -index 416e6f8..58761e9 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -@@ -557,7 +557,7 @@ void CDVDPlayerAudio::Process() - if( audioframe.nb_frames == 0 ) - continue; - -- packetadded = true; -+ packetadded = false; - - // we have succesfully decoded an audio frame, setup renderer to match - if (!m_dvdAudio.IsValidFormat(audioframe)) -@@ -607,7 +607,7 @@ void CDVDPlayerAudio::Process() - } - - // signal to our parent that we have initialized -- if(m_started == false && packetadded) -+ if(m_started == false) - { - m_started = true; - m_messageParent.Put(new CDVDMsgInt(CDVDMsg::PLAYER_STARTED, DVDPLAYER_AUDIO)); - -From 5b007c4c0b681703f5a0e4eb170f68be7797cf41 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Mon, 13 Apr 2015 18:18:59 +0200 -Subject: [PATCH 100/103] dvdplayer audio: fix/improve calculation of playing - pts - ---- - xbmc/cores/dvdplayer/DVDAudio.cpp | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDAudio.cpp b/xbmc/cores/dvdplayer/DVDAudio.cpp -index a2b1325..d1601b1 100644 ---- a/xbmc/cores/dvdplayer/DVDAudio.cpp -+++ b/xbmc/cores/dvdplayer/DVDAudio.cpp -@@ -276,5 +276,17 @@ double CDVDAudio::GetPlayingPts() - if (m_playingPts == DVD_NOPTS_VALUE) - return 0.0; - -- return m_playingPts + CDVDClock::GetAbsoluteClock() - m_timeOfPts; -+ double now = CDVDClock::GetAbsoluteClock(); -+ double diff = now - m_timeOfPts; -+ double cache = GetCacheTime(); -+ double played = 0.0; -+ -+ if (diff < cache) -+ played = diff; -+ else -+ played = cache; -+ -+ m_timeOfPts = now; -+ m_playingPts += played; -+ return m_playingPts; - } - -From 19e1a724d89949b78e2153840ce5b9d15d9f4cd6 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Mon, 13 Apr 2015 17:11:47 +0200 -Subject: [PATCH 101/103] Application: Don't slow down videos rendered on - GuiLayer - ---- - xbmc/Application.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + xbmc/Application.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 6e0aeff..059b7de 100644 +index 5889613..9ba0d23 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -2485,7 +2485,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) +@@ -2496,7 +2496,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) #if defined(TARGET_RASPBERRY_PI) || defined(HAS_IMXVPU) // This code reduces rendering fps of the GUI layer when playing videos in fullscreen mode // it makes only sense on architectures with multiple layers -- if (g_graphicsContext.IsFullScreenVideo() && !m_pPlayer->IsPausedPlayback()) -+ if (g_renderManager.IsVideoLayer() && g_graphicsContext.IsFullScreenVideo() && !m_pPlayer->IsPausedPlayback()) +- if (g_graphicsContext.IsFullScreenVideo() && !m_pPlayer->IsPausedPlayback() && g_renderManager.IsVideoLayer()) ++ if (m_pPlayer->IsPlayingVideo() && !m_pPlayer->IsPausedPlayback() && g_renderManager.IsVideoLayer()) fps = CSettings::Get().GetInt("videoplayer.limitguiupdate"); #endif - -From 299175629df95667144a23b8fa7530775a9d6afd Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 10 Apr 2015 13:23:11 +0100 -Subject: [PATCH 102/103] [mmalrenderer] Avoid blank frame on resolution change - ---- - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index 52eb6b3..5164ffb 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -178,6 +178,7 @@ void CMMALRenderer::AddProcessor(CMMALVideoBuffer *buffer, int index) - - bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags, ERenderFormat format, unsigned extended_format, unsigned int orientation) - { -+ bool formatChanged = m_format != format; - ReleaseBuffers(); - - m_sourceWidth = width; -@@ -230,9 +231,10 @@ bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned - else if (CONF_FLAGS_YUVCOEF_MASK(m_iFlags) == CONF_FLAGS_YUVCOEF_240M) - es_format->es->video.color_space = MMAL_COLOR_SPACE_SMPTE240M; +@@ -2509,6 +2509,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) + { + if (!m_skipGuiRender) + g_windowManager.Process(CTimeUtils::GetFrameTime()); ++ else if (!g_graphicsContext.IsFullScreenVideo()) ++ g_renderManager.FrameMove(); } -- if (m_bConfigured) -+ if (m_bConfigured && formatChanged) - UnInitMMAL(); -- m_bConfigured = init_vout(es_format); -+ if (!m_bConfigured) -+ m_bConfigured = init_vout(es_format); - mmal_format_free(es_format); + g_windowManager.FrameMove(); } - else -From 62360236fc8ad14ce64a50ce4e91567d7cb14dbf Mon Sep 17 00:00:00 2001 +From e40d733fa86aa4835daaec2484169c05fe5796c9 Mon Sep 17 00:00:00 2001 From: popcornmix -Date: Wed, 8 Apr 2015 17:04:55 +0100 -Subject: [PATCH 103/103] [mmalcodec] Discard corrupt frames later so we can - still count dropped frames +Date: Wed, 15 Apr 2015 22:57:45 +0100 +Subject: [PATCH 76/89] [mmalcodec] Return mmal buffers explicitly --- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 29 ++++++++++++++-------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 + + 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index c5746bb..5ac12dd 100644 +index 237a581..486dc4b 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -250,7 +250,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - if (buffer->length > 0) - { - assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_DECODEONLY)); -- if (1)//(!(g_advancedSettings.m_omxDecodeStartWithValidFrame && (buffer->flags & MMAL_BUFFER_HEADER_FLAG_CORRUPTED))) -+ if (!(g_advancedSettings.m_omxDecodeStartWithValidFrame && (buffer->flags & MMAL_BUFFER_HEADER_FLAG_CORRUPTED))) +@@ -133,7 +133,6 @@ CMMALVideo::~CMMALVideo() + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); + assert(m_finished); +- Reset(); + + pthread_mutex_destroy(&m_output_mutex); + +@@ -413,7 +412,7 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) + + m_dec_output = m_deint->output[0]; + m_interlace_method = interlace_method; +- ++ Prime(); + return true; + } + +@@ -469,6 +468,7 @@ bool CMMALVideo::DestroyDeinterlace() + + m_dec_output = m_dec->output[0]; + m_interlace_method = VS_INTERLACEMETHOD_NONE; ++ Prime(); + return true; + } + +@@ -705,6 +705,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide + if (!SendCodecConfigData()) + return false; + ++ Prime(); + m_startframe = false; + m_preroll = !m_hints.stills; + m_speed = DVD_PLAYSPEED_NORMAL; +@@ -747,8 +748,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + MMAL_BUFFER_HEADER_T *buffer; + MMAL_STATUS_T status; + +- while (buffer = mmal_queue_get(m_dec_output_pool->queue), buffer) +- Recycle(buffer); + // we need to queue then de-queue the demux packet, seems silly but + // mmal might not have an input buffer available when we are called + // and we must store the demuxer packet and try again later. +@@ -775,9 +774,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + while (1) + { +- while (buffer = mmal_queue_get(m_dec_output_pool->queue), buffer) +- Recycle(buffer); +- + space = mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size; + if (!demuxer_bytes && !m_demux_queue.empty()) + { +@@ -869,8 +865,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + demuxer_content = NULL; + continue; + } +- while (buffer = mmal_queue_get(m_dec_output_pool->queue), buffer) +- Recycle(buffer); + } + } + if (!demuxer_bytes) +@@ -909,6 +903,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + return ret; + } + ++void CMMALVideo::Prime() ++{ ++ MMAL_BUFFER_HEADER_T *buffer; ++ while (buffer = mmal_queue_get(m_dec_output_pool->queue), buffer) ++ Recycle(buffer); ++} ++ + void CMMALVideo::Reset(void) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -954,8 +955,10 @@ void CMMALVideo::Reset(void) + pthread_mutex_unlock(&m_output_mutex); + + if (!m_finished) ++ { + 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); +@@ -975,6 +978,12 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, buffer); + ++ if (m_finished) ++ { ++ mmal_buffer_header_release(buffer); ++ return; ++ } ++ + MMAL_STATUS_T status; + mmal_buffer_header_reset(buffer); + buffer->cmd = 0; +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index 415f3e3..011ae04 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -106,6 +106,7 @@ class CMMALVideo + void QueryCodec(void); + bool CreateDeinterlace(EINTERLACEMETHOD interlace_method); + bool DestroyDeinterlace(); ++ void Prime(); + + // Video format + int m_decoded_width; + +From 444b6fc43e09650a22ac1ef9d6fe4c62fffaff19 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 15 Apr 2015 23:26:47 +0100 +Subject: [PATCH 77/89] [mmalcodec] Handle resolution change from callback + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 26 +++++----------------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 3 --- + 2 files changed, 6 insertions(+), 23 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 486dc4b..39d6e60 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -56,7 +56,6 @@ CMMALVideoBuffer::CMMALVideoBuffer(CMMALVideo *omv) + width = 0; + height = 0; + m_aspect_ratio = 0.0f; +- m_changed_count = 0; + } + + CMMALVideoBuffer::~CMMALVideoBuffer() +@@ -118,8 +117,6 @@ CMMALVideo::CMMALVideo() + + m_codingType = 0; + +- m_changed_count = 0; +- m_changed_count_dec = 0; + m_output_busy = 0; + m_demux_queue_length = 0; + m_es_format = mmal_format_alloc(); +@@ -183,7 +180,6 @@ void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *bu + { + MMAL_EVENT_FORMAT_CHANGED_T *fmt = mmal_event_format_changed_get(buffer); + mmal_format_copy(m_es_format, fmt->format); +- m_changed_count++; + + if (m_es_format->es->video.crop.width && m_es_format->es->video.crop.height) + { +@@ -192,10 +188,13 @@ void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *bu + m_decoded_width = m_es_format->es->video.crop.width; + m_decoded_height = m_es_format->es->video.crop.height; + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s format changed: %dx%d %.2f frame:%d", CLASSNAME, __func__, m_decoded_width, m_decoded_height, m_aspect_ratio, m_changed_count); ++ CLog::Log(LOGDEBUG, "%s::%s format changed: %dx%d %.2f", CLASSNAME, __func__, m_decoded_width, m_decoded_height, m_aspect_ratio); + } + else + CLog::Log(LOGERROR, "%s::%s format changed: Unexpected %dx%d", CLASSNAME, __func__, m_es_format->es->video.crop.width, m_es_format->es->video.crop.height); ++ ++ if (!change_dec_output_format()) ++ CLog::Log(LOGERROR, "%s::%s - change_dec_output_format() failed", CLASSNAME, __func__); + } + + void CMMALVideo::dec_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) +@@ -257,11 +256,10 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf { CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -620,7 +620,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +- CLog::Log(LOGDEBUG, "%s::%s - %p (%p) buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x frame:%d", +- CLASSNAME, __func__, buffer, omvb, buffer->length, buffer->dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags, omvb->m_changed_count); ++ CLog::Log(LOGDEBUG, "%s::%s - %p (%p) buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x", ++ CLASSNAME, __func__, buffer, omvb, buffer->length, buffer->dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags); + omvb->mmal_buffer = buffer; + buffer->user_data = (void *)omvb; +- omvb->m_changed_count = m_changed_count; + omvb->width = m_decoded_width; + omvb->height = m_decoded_height; + omvb->m_aspect_ratio = m_aspect_ratio; +@@ -313,7 +311,6 @@ bool CMMALVideo::change_dec_output_format() + else + CLog::Log(LOGERROR, "%s::%s Failed to query interlace type on %s (status=%x %s)", CLASSNAME, __func__, m_dec_output->name, status, mmal_status_to_string(status)); - error_concealment.hdr.id = MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT; - error_concealment.hdr.size = sizeof(MMAL_PARAMETER_BOOLEAN_T); -- error_concealment.enable = g_advancedSettings.m_omxDecodeStartWithValidFrame; -+ error_concealment.enable = false; - status = mmal_port_parameter_set(m_dec_input, &error_concealment.hdr); +- // todo: if we don't disable/enable we can do this from callback + mmal_format_copy(m_dec_output->format, m_es_format); + status = mmal_port_format_commit(m_dec_output); if (status != MMAL_SUCCESS) - CLog::Log(LOGERROR, "%s::%s Failed to disable error concealment on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); +@@ -832,17 +829,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + pthread_mutex_lock(&m_output_mutex); + m_startframe = true; + pthread_mutex_unlock(&m_output_mutex); +- if (m_changed_count_dec != m_changed_count) +- { +- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s format changed frame:%d(%d)", CLASSNAME, __func__, m_changed_count_dec, m_changed_count); +- m_changed_count_dec = m_changed_count; +- if (!change_dec_output_format()) +- { +- CLog::Log(LOGERROR, "%s::%s - change_dec_output_format() failed", CLASSNAME, __func__); +- return VC_ERROR; +- } +- } + EDEINTERLACEMODE deinterlace_request = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; + EINTERLACEMETHOD interlace_method = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index 011ae04..fcc6a15 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -55,7 +55,6 @@ class CMMALVideoBuffer + int width; + int height; + float m_aspect_ratio; +- uint32_t m_changed_count; + // reference counting + CMMALVideoBuffer* Acquire(); + long Release(); +@@ -99,8 +98,6 @@ class CMMALVideo + void dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); + void dec_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); + void dec_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); +- uint32_t m_changed_count; +- uint32_t m_changed_count_dec; + + protected: + void QueryCodec(void); + +From 3e33a9a5a6874b992bed68821b8d779380a13f14 Mon Sep 17 00:00:00 2001 +From: Rainer Hochecker +Date: Fri, 17 Apr 2015 20:18:40 +0200 +Subject: [PATCH 78/89] dvdplayer: reduce time for initial audio sync + +--- + xbmc/cores/dvdplayer/DVDPlayerAudio.cpp | 6 +++--- + xbmc/cores/dvdplayer/DVDPlayerAudio.h | 4 ++-- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp +index bd357aa..ebf4d93 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp +@@ -676,7 +676,7 @@ void CDVDPlayerAudio::HandleSyncError(double duration) + // error because drop/dupe changes the value + if (m_syncclock && fabs(error) > threshold1) + { +- m_errors.Flush(500); ++ m_errors.Flush(); + m_integral = 0.0; + m_resampleratio = 0.0; + return; +@@ -693,13 +693,13 @@ void CDVDPlayerAudio::HandleSyncError(double duration) + // 500ms in order to get first resample ratio early. If we don't adjust rr early, error + // may get above threshold1 again. Too small values for interval result in worse average errors + +- if (!m_errors.Get(m_error, m_syncclock ? 500 : 2000)) ++ if (!m_errors.Get(m_error, m_syncclock ? 100 : 2000)) + return; + + if (fabs(m_error) > threshold1) + { + m_syncclock = true; +- m_errors.Flush(500); ++ m_errors.Flush(100); + m_integral = 0.0; + m_resampleratio = 0.0; + CLog::Log(LOGDEBUG,"CDVDPlayerAudio::HandleSyncError - average error %f above threshold of %f", +diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.h b/xbmc/cores/dvdplayer/DVDPlayerAudio.h +index 635c184..bf51863 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayerAudio.h ++++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.h +@@ -69,7 +69,7 @@ class CDVDErrorAverage + m_count++; + } + +- void Flush(int interval = 500) ++ void Flush(int interval = 100) + { + m_buffer = 0.0f; + m_count = 0; +@@ -84,7 +84,7 @@ class CDVDErrorAverage + return 0.0; + } + +- bool Get(double& error, int interval = 500) ++ bool Get(double& error, int interval = 100) + { + if(m_timer.IsTimePast()) + { + +From 9a35c9bd5494c4b9a39339fe5c9205f8f2890a9b Mon Sep 17 00:00:00 2001 +From: Rainer Hochecker +Date: Fri, 3 Apr 2015 10:49:55 +0200 +Subject: [PATCH 79/89] dvdplayer: cosmetics + +--- + xbmc/cores/dvdplayer/DVDPlayer.cpp | 41 ++++++++++++++++++++------------------ + 1 file changed, 22 insertions(+), 19 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp +index 8ceb498..1f220c6 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp +@@ -1454,16 +1454,18 @@ void CDVDPlayer::Process() + + m_OmxPlayerState.bOmxSentEOFs = true; + } ++ + if(m_CurrentAudio.inited) +- m_dvdPlayerAudio->SendMessage (new CDVDMsg(CDVDMsg::GENERAL_EOF)); ++ m_dvdPlayerAudio->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); + if(m_CurrentVideo.inited) +- m_dvdPlayerVideo->SendMessage (new CDVDMsg(CDVDMsg::GENERAL_EOF)); ++ m_dvdPlayerVideo->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); + if(m_CurrentSubtitle.inited) + m_dvdPlayerSubtitle->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); + if(m_CurrentTeletext.inited) + m_dvdPlayerTeletext->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF)); +- m_CurrentAudio.inited = false; +- m_CurrentVideo.inited = false; ++ ++ m_CurrentAudio.inited = false; ++ m_CurrentVideo.inited = false; + m_CurrentSubtitle.inited = false; + m_CurrentTeletext.inited = false; + +@@ -1573,21 +1575,22 @@ bool CDVDPlayer::CheckIsCurrent(CCurrentStream& current, CDemuxStream* stream, D + + void CDVDPlayer::ProcessPacket(CDemuxStream* pStream, DemuxPacket* pPacket) + { +- /* process packet if it belongs to selected stream. for dvd's don't allow automatic opening of streams*/ +- +- if (CheckIsCurrent(m_CurrentAudio, pStream, pPacket)) +- ProcessAudioData(pStream, pPacket); +- else if (CheckIsCurrent(m_CurrentVideo, pStream, pPacket)) +- ProcessVideoData(pStream, pPacket); +- else if (CheckIsCurrent(m_CurrentSubtitle, pStream, pPacket)) +- ProcessSubData(pStream, pPacket); +- else if (CheckIsCurrent(m_CurrentTeletext, pStream, pPacket)) +- ProcessTeletextData(pStream, pPacket); +- else +- { +- pStream->SetDiscard(AVDISCARD_ALL); +- CDVDDemuxUtils::FreeDemuxPacket(pPacket); // free it since we won't do anything with it +- } ++ // process packet if it belongs to selected stream. ++ // for dvd's don't allow automatic opening of streams*/ ++ ++ if (CheckIsCurrent(m_CurrentAudio, pStream, pPacket)) ++ ProcessAudioData(pStream, pPacket); ++ else if (CheckIsCurrent(m_CurrentVideo, pStream, pPacket)) ++ ProcessVideoData(pStream, pPacket); ++ else if (CheckIsCurrent(m_CurrentSubtitle, pStream, pPacket)) ++ ProcessSubData(pStream, pPacket); ++ else if (CheckIsCurrent(m_CurrentTeletext, pStream, pPacket)) ++ ProcessTeletextData(pStream, pPacket); ++ else ++ { ++ pStream->SetDiscard(AVDISCARD_ALL); ++ CDVDDemuxUtils::FreeDemuxPacket(pPacket); // free it since we won't do anything with it ++ } + } + + void CDVDPlayer::CheckStreamChanges(CCurrentStream& current, CDemuxStream* stream) + +From 7c8937a10c0441e815ec4743dfc38b22c6f38d09 Mon Sep 17 00:00:00 2001 +From: Rainer Hochecker +Date: Fri, 3 Apr 2015 14:03:44 +0200 +Subject: [PATCH 80/89] dvdplayer/omxplayer: protect live streams (pvr) from + stalling + +--- + xbmc/cores/VideoRenderers/RenderManager.cpp | 9 +++++ + xbmc/cores/dvdplayer/DVDClock.cpp | 53 +++++++++++++++-------------- + xbmc/cores/dvdplayer/DVDClock.h | 10 ++++-- + xbmc/cores/dvdplayer/DVDPlayer.cpp | 30 ++++++++++++++++ + xbmc/cores/dvdplayer/DVDPlayer.h | 1 + + xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 5 +-- + xbmc/linux/OMXClock.cpp | 20 ++++++++++- + xbmc/linux/OMXClock.h | 2 ++ + xbmc/video/VideoReferenceClock.cpp | 8 +++++ + xbmc/video/VideoReferenceClock.h | 1 + + 10 files changed, 106 insertions(+), 33 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp +index 25323ef..25d3809 100644 +--- a/xbmc/cores/VideoRenderers/RenderManager.cpp ++++ b/xbmc/cores/VideoRenderers/RenderManager.cpp +@@ -175,6 +175,15 @@ void CXBMCRenderManager::WaitPresentTime(double presenttime) + return; + } + ++ CDVDClock *dvdclock = CDVDClock::GetMasterClock(); ++ if(dvdclock != NULL && dvdclock->GetSpeedAdjust() != 0.0) ++ { ++ CDVDClock::WaitAbsoluteClock(presenttime * DVD_TIME_BASE); ++ m_presenterr = 0; ++ m_presentcorr = 0; ++ return; ++ } ++ + double clock = CDVDClock::WaitAbsoluteClock(presenttime * DVD_TIME_BASE) / DVD_TIME_BASE; + double target = 0.5; + double error = ( clock - presenttime ) / frametime - target; +diff --git a/xbmc/cores/dvdplayer/DVDClock.cpp b/xbmc/cores/dvdplayer/DVDClock.cpp +index a496ec0..2629530 100644 +--- a/xbmc/cores/dvdplayer/DVDClock.cpp ++++ b/xbmc/cores/dvdplayer/DVDClock.cpp +@@ -29,7 +29,7 @@ + int64_t CDVDClock::m_systemOffset; + int64_t CDVDClock::m_systemFrequency; + CCriticalSection CDVDClock::m_systemsection; +-CDVDClock *CDVDClock::m_playerclock = NULL;; ++CDVDClock *CDVDClock::m_playerclock = NULL; + + CDVDClock::CDVDClock() + : m_master(MASTER_CLOCK_NONE) +@@ -42,6 +42,9 @@ CDVDClock::CDVDClock() + m_bReset = true; + m_iDisc = 0; + m_maxspeedadjust = 0.0; ++ m_lastSystemTime = g_VideoReferenceClock.GetTime(); ++ m_systemAdjust = 0; ++ m_speedAdjust = 0; + + m_startClock = 0; + +@@ -103,7 +106,12 @@ CDVDClock* CDVDClock::GetMasterClock() + double CDVDClock::GetClock(bool interpolated /*= true*/) + { + CSharedLock lock(m_critSection); +- return SystemToPlaying(g_VideoReferenceClock.GetTime(interpolated)); ++ ++ int64_t current = g_VideoReferenceClock.GetTime(interpolated); ++ m_systemAdjust += m_speedAdjust * (current - m_lastSystemTime); ++ m_lastSystemTime = current; ++ ++ return SystemToPlaying(current); + } + + double CDVDClock::GetClock(double& absolute, bool interpolated /*= true*/) +@@ -115,8 +123,7 @@ double CDVDClock::GetClock(double& absolute, bool interpolated /*= true*/) + absolute = SystemToAbsolute(current); + } + +- CSharedLock lock(m_critSection); +- return SystemToPlaying(current); ++ return GetClock(interpolated); + } + + void CDVDClock::SetSpeed(int iSpeed) +@@ -145,6 +152,18 @@ void CDVDClock::SetSpeed(int iSpeed) + m_systemUsed = newfreq; + } + ++void CDVDClock::SetSpeedAdjust(double adjust) ++{ ++ CExclusiveLock lock(m_critSection); ++ m_speedAdjust = adjust; ++} ++ ++double CDVDClock::GetSpeedAdjust() ++{ ++ CExclusiveLock lock(m_critSection); ++ return m_speedAdjust; ++} ++ + bool CDVDClock::Update(double clock, double absolute, double limit, const char* log) + { + CExclusiveLock lock(m_critSection); +@@ -174,26 +193,8 @@ void CDVDClock::Discontinuity(double clock, double absolute) + m_pauseClock = m_startClock; + m_iDisc = clock; + m_bReset = false; +-} +- +-void CDVDClock::Pause() +-{ +- CExclusiveLock lock(m_critSection); +- if(!m_pauseClock) +- m_pauseClock = g_VideoReferenceClock.GetTime(); +-} +- +-void CDVDClock::Resume() +-{ +- CExclusiveLock lock(m_critSection); +- if( m_pauseClock ) +- { +- int64_t current; +- current = g_VideoReferenceClock.GetTime(); +- +- m_startClock += current - m_pauseClock; +- m_pauseClock = 0; +- } ++ m_systemAdjust = 0; ++ m_speedAdjust = 0; + } + + void CDVDClock::SetMaxSpeedAdjust(double speed) +@@ -265,6 +266,8 @@ double CDVDClock::SystemToPlaying(int64_t system) + if(m_pauseClock) + m_pauseClock = m_startClock; + m_iDisc = 0; ++ m_systemAdjust = 0; ++ m_speedAdjust = 0; + m_bReset = false; + } + +@@ -273,7 +276,7 @@ double CDVDClock::SystemToPlaying(int64_t system) + else + current = system; + +- return DVD_TIME_BASE * (double)(current - m_startClock) / m_systemUsed + m_iDisc; ++ return DVD_TIME_BASE * (double)(current - m_startClock + m_systemAdjust) / m_systemUsed + m_iDisc; + } + + EMasterClock CDVDClock::GetMaster() +diff --git a/xbmc/cores/dvdplayer/DVDClock.h b/xbmc/cores/dvdplayer/DVDClock.h +index d6b2d0a..cf03af5 100644 +--- a/xbmc/cores/dvdplayer/DVDClock.h ++++ b/xbmc/cores/dvdplayer/DVDClock.h +@@ -66,9 +66,9 @@ class CDVDClock + } + + void Reset() { m_bReset = true; } +- void Pause(); +- void Resume(); + void SetSpeed(int iSpeed); ++ void SetSpeedAdjust(double adjust); ++ double GetSpeedAdjust(); + + double GetClockSpeed(); /**< get the current speed of the clock relative normal system time */ + +@@ -101,7 +101,11 @@ class CDVDClock + static int64_t m_systemOffset; + static CCriticalSection m_systemsection; + +- double m_maxspeedadjust; ++ int64_t m_systemAdjust; ++ int64_t m_lastSystemTime; ++ double m_speedAdjust; ++ ++ double m_maxspeedadjust; + CCriticalSection m_speedsection; + static CDVDClock *m_playerclock; + }; +diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp +index 1f220c6..4db38e2 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp +@@ -1841,6 +1841,7 @@ void CDVDPlayer::HandlePlaySpeed() + if(m_caching != caching) + SetCaching(caching); + ++ // check buffering levels and adjust clock + if (m_playSpeed == DVD_PLAYSPEED_NORMAL && m_caching == CACHESTATE_DONE) + { + // due to i.e. discontinuities of pts the stream may have drifted away +@@ -1851,6 +1852,31 @@ void CDVDPlayer::HandlePlaySpeed() + CLog::Log(LOGDEBUG,"CDVDPlayer::HandlePlaySpeed - audio stream stalled, tiggering re-sync"); + TriggerResync(); + } ++ ++ if (CachePVRStream()) ++ { ++ if (m_CurrentAudio.id >= 0) ++ { ++ double adjust = -1.0; // a unique value ++ if (m_clock.GetSpeedAdjust() == 0.0 && m_dvdPlayerAudio->GetLevel() < 5) ++ adjust = -0.01; ++ else if (m_clock.GetSpeedAdjust() == 0.0 && m_dvdPlayerAudio->GetLevel() > 95) ++ adjust = 0.01; ++ ++ if (m_clock.GetSpeedAdjust() < 0 && m_dvdPlayerAudio->GetLevel() > 20) ++ adjust = 0.0; ++ else if (m_clock.GetSpeedAdjust() > 0 && m_dvdPlayerAudio->GetLevel() < 80) ++ adjust = 0.0; ++ ++ if (adjust != -1.0) ++ { ++ m_clock.SetSpeedAdjust(adjust); ++ if (m_omxplayer_mode) ++ m_OmxPlayerState.av_clock.OMXSetSpeedAdjust(adjust); ++ CLog::Log(LOGDEBUG, "CDVDPlayer::HandlePlaySpeed set clock adjust: %f", adjust); ++ } ++ } ++ } + } + + if(GetPlaySpeed() != DVD_PLAYSPEED_NORMAL && GetPlaySpeed() != DVD_PLAYSPEED_PAUSE) +@@ -2762,6 +2788,10 @@ void CDVDPlayer::SetCaching(ECacheState state) + m_pInputStream->ResetScanTimeout(0); + } + m_caching = state; ++ ++ m_clock.SetSpeedAdjust(0); ++ if (m_omxplayer_mode) ++ m_OmxPlayerState.av_clock.OMXSetSpeedAdjust(0); + } + + void CDVDPlayer::SetPlaySpeed(int speed) +diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h +index 3b8cefb..3dbb809 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayer.h ++++ b/xbmc/cores/dvdplayer/DVDPlayer.h +@@ -68,6 +68,7 @@ class OMXClock + bool OMXStateExecute(bool lock = true) { return false; } + void OMXStateIdle(bool lock = true) {} + bool HDMIClockSync(bool lock = true) { return false; } ++ void OMXSetSpeedAdjust(double adjust, bool lock = true) {} + }; + #endif + +diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +index 5832c58..f5e6de9 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +@@ -201,10 +201,7 @@ bool CDVDPlayerVideo::OpenStream( CDVDStreamInfo &hint ) + return false; + } + +- if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") && !g_VideoReferenceClock.IsRunning()) +- { +- g_VideoReferenceClock.Create(); +- } ++ g_VideoReferenceClock.Start(); + + if(m_messageQueue.IsInited()) + m_messageQueue.Put(new CDVDMsgVideoCodecChange(hint, codec), 0); +diff --git a/xbmc/linux/OMXClock.cpp b/xbmc/linux/OMXClock.cpp +index 46df52e..4f094df 100644 +--- a/xbmc/linux/OMXClock.cpp ++++ b/xbmc/linux/OMXClock.cpp +@@ -45,6 +45,7 @@ OMXClock::OMXClock() + m_clock = NULL; + m_last_media_time = 0.0f; + m_last_media_time_read = 0.0f; ++ m_speedAdjust = 0; + + pthread_mutex_init(&m_lock, NULL); + } +@@ -477,7 +478,7 @@ bool OMXClock::OMXSetSpeed(int speed, bool lock /* = true */, bool pause_resume + if(lock) + Lock(); + +- CLog::Log(LOGDEBUG, "OMXClock::OMXSetSpeed(%.2f) pause_resume:%d", (float)speed / (float)DVD_PLAYSPEED_NORMAL, pause_resume); ++ CLog::Log(LOGDEBUG, "OMXClock::OMXSetSpeed(%.3f) pause_resume:%d", (float)speed / (float)DVD_PLAYSPEED_NORMAL * (1.0 + m_speedAdjust), pause_resume); + + if (pause_resume) + { +@@ -485,6 +486,8 @@ bool OMXClock::OMXSetSpeed(int speed, bool lock /* = true */, bool pause_resume + OMX_INIT_STRUCTURE(scaleType); + + scaleType.xScale = (speed << 16) / DVD_PLAYSPEED_NORMAL; ++ scaleType.xScale += scaleType.xScale * m_speedAdjust; ++ + OMX_ERRORTYPE omx_err = m_omx_clock.SetConfig(OMX_IndexConfigTimeScale, &scaleType); + if(omx_err != OMX_ErrorNone) + { +@@ -504,6 +507,21 @@ bool OMXClock::OMXSetSpeed(int speed, bool lock /* = true */, bool pause_resume + return true; + } + ++void OMXClock::OMXSetSpeedAdjust(double adjust, bool lock /* = true */) ++{ ++ if(lock) ++ Lock(); ++ // we only support resampling (and hence clock adjustment) in this mode ++ if (CSettings::Get().GetBool("videoplayer.usedisplayasclock")) ++ { ++ m_speedAdjust = adjust; ++ OMXSetSpeed(m_omx_speed, false, true); ++ m_last_media_time = 0.0f; ++ } ++ if(lock) ++ UnLock(); ++} ++ + bool OMXClock::OMXFlush(bool lock) + { + if(m_omx_clock.GetComponent() == NULL) +diff --git a/xbmc/linux/OMXClock.h b/xbmc/linux/OMXClock.h +index 8f06134..df0d4cf 100644 +--- a/xbmc/linux/OMXClock.h ++++ b/xbmc/linux/OMXClock.h +@@ -59,6 +59,7 @@ class OMXClock + COMXCoreComponent m_omx_clock; + double m_last_media_time; + double m_last_media_time_read; ++ double m_speedAdjust; + public: + OMXClock(); + ~OMXClock(); +@@ -82,6 +83,7 @@ class OMXClock + bool OMXPause(bool lock = true); + bool OMXResume(bool lock = true); + bool OMXSetSpeed(int speed, bool lock = true, bool pause_resume = false); ++ void OMXSetSpeedAdjust(double adjust, bool lock = true); + int OMXPlaySpeed() { return m_omx_speed; }; + bool OMXFlush(bool lock = true); + COMXCoreComponent *GetOMXClock(); +diff --git a/xbmc/video/VideoReferenceClock.cpp b/xbmc/video/VideoReferenceClock.cpp +index f97e0bf..a363c36 100644 +--- a/xbmc/video/VideoReferenceClock.cpp ++++ b/xbmc/video/VideoReferenceClock.cpp +@@ -28,6 +28,7 @@ + #include "guilib/GraphicContext.h" + #include "video/videosync/VideoSync.h" + #include "windowing/WindowingFactory.h" ++#include "settings/Settings.h" + + #if defined(HAS_GLX) + #include "video/videosync/VideoSyncGLX.h" +@@ -72,6 +73,13 @@ CVideoReferenceClock::~CVideoReferenceClock() + { + } + ++void CVideoReferenceClock::Start() ++{ ++ CSingleExit lock(g_graphicsContext); ++ if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") && !IsRunning()) ++ Create(); ++} ++ + void CVideoReferenceClock::Stop() + { + CSingleExit lock(g_graphicsContext); +diff --git a/xbmc/video/VideoReferenceClock.h b/xbmc/video/VideoReferenceClock.h +index 937b53e..d0a9c3f 100644 +--- a/xbmc/video/VideoReferenceClock.h ++++ b/xbmc/video/VideoReferenceClock.h +@@ -39,6 +39,7 @@ class CVideoReferenceClock : public CThread + bool GetClockInfo(int& MissedVblanks, double& ClockSpeed, double& RefreshRate); + void SetFineAdjust(double fineadjust); + void RefreshChanged(); ++ void Start(); + void Stop(); + + private: + +From 1026004dc183fad879d872223a263c5f36aa1056 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 14 Apr 2015 17:51:27 +0100 +Subject: [PATCH 81/89] Avoid double rate deinterlace when not fullscreen or + with OSD + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index c30de9c..998d3d5 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -32,6 +32,7 @@ + #include "windowing/WindowingFactory.h" + #include "cores/dvdplayer/DVDCodecs/Video/MMALCodec.h" + #include "xbmc/Application.h" ++#include "guilib/GUIWindowManager.h" + + #define CLASSNAME "CMMALRenderer" + +@@ -551,7 +552,10 @@ bool CMMALRenderer::Supports(ESCALINGMETHOD method) + + EINTERLACEMETHOD CMMALRenderer::AutoInterlaceMethod() + { +- return VS_INTERLACEMETHOD_MMAL_ADVANCED; ++ if (!g_graphicsContext.IsFullScreenVideo() || g_windowManager.HasDialogOnScreen()) ++ return VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF; ++ else ++ return VS_INTERLACEMETHOD_MMAL_ADVANCED; + } + + void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect) + +From 76b915c21c082ea4a827a3b5d1e7279ff7fba60b Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 16 Apr 2015 17:27:27 +0100 +Subject: [PATCH 82/89] Enable zero copy + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 6 ++++++ + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 18 ++++++++++++++++-- + 2 files changed, 22 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 998d3d5..3eb4060 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -133,6 +133,12 @@ bool CMMALRenderer::init_vout(ERenderFormat format) + es_format->es->video.color_space = MMAL_COLOR_SPACE_SMPTE240M; + } + ++ if (m_format == RENDER_FMT_MMAL) ++ { ++ status = mmal_port_parameter_set_boolean(m_vout_input, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); ++ if (status != MMAL_SUCCESS) ++ CLog::Log(LOGERROR, "%s::%s Failed to enable zero copy mode on %s (status=%x %s)", CLASSNAME, __func__, m_vout_input->name, status, mmal_status_to_string(status)); ++ } + status = mmal_port_format_commit(m_vout_input); + if (status != MMAL_SUCCESS) + { +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 39d6e60..1ab5254 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -312,6 +312,11 @@ bool CMMALVideo::change_dec_output_format() + CLog::Log(LOGERROR, "%s::%s Failed to query interlace type on %s (status=%x %s)", CLASSNAME, __func__, m_dec_output->name, status, mmal_status_to_string(status)); + + mmal_format_copy(m_dec_output->format, m_es_format); ++ ++ status = mmal_port_parameter_set_boolean(m_dec_output, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); ++ if (status != MMAL_SUCCESS) ++ CLog::Log(LOGERROR, "%s::%s Failed to enable zero copy mode on %s (status=%x %s)", CLASSNAME, __func__, m_dec_output->name, status, mmal_status_to_string(status)); ++ + status = mmal_port_format_commit(m_dec_output); + if (status != MMAL_SUCCESS) + { +@@ -383,6 +388,11 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) + } + + mmal_format_copy(m_deint->output[0]->format, m_es_format); ++ ++ status = mmal_port_parameter_set_boolean(m_deint->output[0], MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); ++ if (status != MMAL_SUCCESS) ++ CLog::Log(LOGERROR, "%s::%s Failed to enable zero copy mode on %s (status=%x %s)", CLASSNAME, __func__, m_deint->output[0]->name, status, mmal_status_to_string(status)); ++ + status = mmal_port_format_commit(m_deint->output[0]); + if (status != MMAL_SUCCESS) + { +@@ -661,6 +671,10 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide + m_dec_output->format->encoding = MMAL_ENCODING_OPAQUE; + mmal_format_copy(m_es_format, m_dec_output->format); + ++ status = mmal_port_parameter_set_boolean(m_dec_output, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); ++ if (status != MMAL_SUCCESS) ++ CLog::Log(LOGERROR, "%s::%s Failed to enable zero copy mode on %s (status=%x %s)", CLASSNAME, __func__, m_dec_output->name, status, mmal_status_to_string(status)); ++ + status = mmal_port_format_commit(m_dec_output); + if (status != MMAL_SUCCESS) + { +@@ -685,14 +699,14 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide + return false; + } + +- m_dec_input_pool = mmal_pool_create(m_dec_input->buffer_num, m_dec_input->buffer_size); ++ m_dec_input_pool = mmal_port_pool_create(m_dec_input, m_dec_input->buffer_num, m_dec_input->buffer_size); + if (!m_dec_input_pool) + { + CLog::Log(LOGERROR, "%s::%s Failed to create pool for decoder input port (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status)); + return false; + } + +- m_dec_output_pool = mmal_pool_create(m_dec_output->buffer_num, m_dec_output->buffer_size); ++ m_dec_output_pool = mmal_port_pool_create(m_dec_output, m_dec_output->buffer_num, m_dec_output->buffer_size); + if(!m_dec_output_pool) + { + CLog::Log(LOGERROR, "%s::%s Failed to create pool for decode output port (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status)); + +From 332c505cf424b7356a31aa5b2d44652377f4e490 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 16 Apr 2015 19:09:31 +0100 +Subject: [PATCH 83/89] flags debug + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 11 ++++++----- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 ++ + 2 files changed, 8 insertions(+), 5 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 3eb4060..fa65c2b 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -49,12 +49,13 @@ void CMMALRenderer::vout_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T * + { + #if defined(MMAL_DEBUG_VERBOSE) + CMMALVideoBuffer *omvb = (CMMALVideoBuffer *)buffer->user_data; +- CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p (%p), len %d cmd:%x", CLASSNAME, __func__, port, buffer, omvb, buffer->length, buffer->cmd); ++ CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p (%p), len %d cmd:%x f:%x", CLASSNAME, __func__, port, buffer, omvb, buffer->length, buffer->cmd, buffer->flags); + #endif + ++ assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED)); ++ buffer->flags &= ~MMAL_BUFFER_HEADER_FLAG_USER2; + if (m_format == RENDER_FMT_MMAL) + { +- buffer->flags &= ~MMAL_BUFFER_HEADER_FLAG_USER2; + mmal_queue_put(m_release_queue, buffer); + } + else if (m_format == RENDER_FMT_YUV420P) +@@ -377,7 +378,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + if (omvb) + { + #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s %p (%p)", CLASSNAME, __func__, omvb, omvb->mmal_buffer); ++ CLog::Log(LOGDEBUG, "%s::%s %p (%p) f:%x", CLASSNAME, __func__, omvb, omvb->mmal_buffer, omvb->mmal_buffer->flags); + #endif + // we only want to upload frames once + if (omvb->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) +@@ -391,14 +392,14 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + } + else if (m_format == RENDER_FMT_YUV420P) + { +- CLog::Log(LOGDEBUG, "%s::%s - %p %d", CLASSNAME, __func__, buffer->mmal_buffer, source); ++ CLog::Log(LOGDEBUG, "%s::%s - %p %d f:%x", CLASSNAME, __func__, buffer->mmal_buffer, source, buffer->mmal_buffer->flags); + if (buffer->mmal_buffer) + { + // we only want to upload frames once + if (buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) + return; + // sanity check it is not on display +- buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1; ++ buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; + mmal_port_send_buffer(m_vout_input, buffer->mmal_buffer); + } + else +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 1ab5254..61cf8e2 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -83,6 +83,7 @@ long CMMALVideoBuffer::Release() + { + m_omv->ReleaseBuffer(this); + } ++ else assert(count > 0); + return count; + } + +@@ -247,6 +248,7 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf + + bool kept = false; + ++ assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED)); + if (buffer->cmd == 0) + { + if (buffer->length > 0) + +From 1757168ee2f38cb7e56b27f9d8a4a8f180ed68b1 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 16 Apr 2015 18:18:14 +0100 +Subject: [PATCH 84/89] Move the image pool from decoder to renderer + +--- + xbmc/cores/VideoRenderers/BaseRenderer.h | 5 ++ + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 77 ++++++++++++++++++---- + xbmc/cores/VideoRenderers/MMALRenderer.h | 4 ++ + xbmc/cores/VideoRenderers/RenderManager.cpp | 8 +++ + xbmc/cores/VideoRenderers/RenderManager.h | 5 ++ + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 30 ++------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 2 - + 7 files changed, 91 insertions(+), 40 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/BaseRenderer.h b/xbmc/cores/VideoRenderers/BaseRenderer.h +index 389695a..264f0ad 100644 +--- a/xbmc/cores/VideoRenderers/BaseRenderer.h ++++ b/xbmc/cores/VideoRenderers/BaseRenderer.h +@@ -112,6 +112,11 @@ class CBaseRenderer + + static void SettingOptionsRenderMethodsFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t, void *data); + ++ /** ++ * Magic api for communicating between codec and renderer ++ */ ++ virtual void *PassCookie(void *cookie) { return NULL; } ++ + protected: + void ChooseBestResolution(float fps); + bool FindResolutionFromOverride(float fps, float& weight, bool fallback); +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index fa65c2b..5fbe2d2 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -40,6 +40,50 @@ + #define MMAL_DEBUG_VERBOSE + #endif + ++ ++ ++void CMMALRenderer::Prime() ++{ ++ #if defined(MMAL_DEBUG_VERBOSE) ++ CLog::Log(LOGDEBUG, "%s::%s format:%d dec:%p pool:%p", CLASSNAME, __func__, m_format, m_mmal_video, m_vout_input_pool); ++ #endif ++ ++ if (m_format != RENDER_FMT_MMAL || !m_vout_input_pool) ++ return; ++ ++ MMAL_BUFFER_HEADER_T *buffer; ++ while (buffer = mmal_queue_get(m_vout_input_pool->queue), buffer) ++ { ++ CLog::Log(LOGDEBUG, "%s::%s buffer:%p mmal_video:%p", CLASSNAME, __func__, buffer, m_mmal_video); ++ if (m_mmal_video) ++ { ++ m_mmal_video->Recycle(buffer); ++ } ++ else ++ { ++ mmal_buffer_header_release(buffer); ++ break; ++ } ++ } ++} ++ ++void *CMMALRenderer::PassCookie(void *cookie) ++{ ++ m_mmal_video = (CMMALVideo *)cookie; ++ #if defined(MMAL_DEBUG_VERBOSE) ++ CLog::Log(LOGDEBUG, "%s::%s cookie:%p", CLASSNAME, __func__, cookie); ++ #endif ++ ++ if (m_mmal_video) ++ { ++ bool formatChanged = m_format != RENDER_FMT_MMAL; ++ m_format = RENDER_FMT_MMAL; ++ m_bConfigured = init_vout(formatChanged); ++ Prime(); ++ } ++ return NULL; ++} ++ + static void vout_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) + { + mmal_buffer_header_release(buffer); +@@ -164,14 +208,11 @@ bool CMMALRenderer::init_vout(ERenderFormat format) + return false; + } + +- if (m_format == RENDER_FMT_YUV420P) ++ m_vout_input_pool = mmal_port_pool_create(m_vout_input , m_vout_input->buffer_num, m_vout_input->buffer_size); ++ if (!m_vout_input_pool) + { +- m_vout_input_pool = mmal_pool_create(m_vout_input->buffer_num, m_vout_input->buffer_size); +- if (!m_vout_input_pool) +- { +- CLog::Log(LOGERROR, "%s::%s Failed to create pool for decoder input port (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status)); +- return false; +- } ++ CLog::Log(LOGERROR, "%s::%s Failed to create pool for decoder input port (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status)); ++ return false; + } + return true; + } +@@ -179,10 +220,17 @@ bool CMMALRenderer::init_vout(ERenderFormat format) + void CMMALRenderer::Process() + { + MMAL_BUFFER_HEADER_T *buffer; +- while (buffer = mmal_queue_wait(m_release_queue), buffer && buffer != &m_quit_packet) ++ while (buffer = mmal_queue_timedwait(m_release_queue, 100), buffer != &m_quit_packet) + { +- CMMALVideoBuffer *omvb = (CMMALVideoBuffer *)buffer->user_data; +- omvb->Release(); ++ if (buffer) ++ { ++ CMMALVideoBuffer *omvb = (CMMALVideoBuffer *)buffer->user_data; ++ omvb->Release(); ++ } ++ else ++ { ++ Prime(); ++ } + } + m_sync.Set(); + } +@@ -382,7 +430,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + #endif + // we only want to upload frames once + if (omvb->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) +- return; ++ goto done; + 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); +@@ -397,7 +445,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + { + // we only want to upload frames once + if (buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) +- return; ++ goto done; + // 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); +@@ -406,6 +454,8 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); + } + else assert(0); ++done: ++ Prime(); + } + + void CMMALRenderer::FlipPage(int source) +@@ -467,6 +517,8 @@ void CMMALRenderer::UnInitMMAL() + m_vout_input = NULL; + } + ++ ReleaseBuffers(); ++ + if (m_vout_input_pool) + { + mmal_pool_destroy(m_vout_input_pool); +@@ -478,7 +530,6 @@ void CMMALRenderer::UnInitMMAL() + mmal_component_release(m_vout); + m_vout = NULL; + } +- ReleaseBuffers(); + + m_RenderUpdateCallBackFn = NULL; + m_RenderUpdateCallBackCtx = NULL; +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h +index 17b189e..f515d7a 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.h ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.h +@@ -40,6 +40,7 @@ + + class CBaseTexture; + class CMMALVideoBuffer; ++class CMMALVideo; + + struct DVDVideoPicture; + +@@ -90,6 +91,7 @@ class CMMALRenderer : public CBaseRenderer, public CThread + virtual bool IsGuiLayer() { return false; } + + void vout_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); ++ virtual void *PassCookie(void *cookie); + protected: + int m_iYV12RenderBuffer; + int m_NumYV12Buffers; +@@ -116,8 +118,10 @@ class CMMALRenderer : public CBaseRenderer, public CThread + MMAL_QUEUE_T *m_release_queue; + CEvent m_sync; + MMAL_BUFFER_HEADER_T m_quit_packet; ++ CMMALVideo *m_mmal_video; + + bool init_vout(ERenderFormat format); + void ReleaseBuffers(); + void UnInitMMAL(); ++ void Prime(); + }; +diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp +index 25d3809..89faa65 100644 +--- a/xbmc/cores/VideoRenderers/RenderManager.cpp ++++ b/xbmc/cores/VideoRenderers/RenderManager.cpp +@@ -949,6 +949,14 @@ unsigned int CXBMCRenderManager::GetOptimalBufferSize() + return m_pRenderer->GetMaxBufferSize(); + } + ++void *CXBMCRenderManager::PassCookie(void *cookie) ++{ ++ if (m_pRenderer) ++ return m_pRenderer->PassCookie(cookie); ++ assert(0); ++} ++ ++ + // Supported pixel formats, can be called before configure + std::vector CXBMCRenderManager::SupportedFormats() + { +diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h +index f32f4a9..1d8fe88 100644 +--- a/xbmc/cores/VideoRenderers/RenderManager.h ++++ b/xbmc/cores/VideoRenderers/RenderManager.h +@@ -195,6 +195,11 @@ class CXBMCRenderManager + */ + void DiscardBuffer(); + ++ /** ++ * Magic api for communicating between codec and renderer ++ */ ++ void *PassCookie(void *cookie); ++ + protected: + + void PresentSingle(bool clear, DWORD flags, DWORD alpha); +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 61cf8e2..1fdc44c 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -111,7 +111,6 @@ CMMALVideo::CMMALVideo() + m_dec_input = NULL; + m_dec_output = NULL; + m_dec_input_pool = NULL; +- m_dec_output_pool = NULL; + + m_deint = NULL; + m_deint_connection = NULL; +@@ -162,10 +161,6 @@ CMMALVideo::~CMMALVideo() + mmal_pool_destroy(m_dec_input_pool); + m_dec_input_pool = NULL; + +- if (m_dec_output_pool) +- mmal_pool_destroy(m_dec_output_pool); +- m_dec_output_pool = NULL; +- + if (m_deint) + mmal_component_destroy(m_deint); + m_deint = NULL; +@@ -421,7 +416,7 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) + + m_dec_output = m_deint->output[0]; + m_interlace_method = interlace_method; +- Prime(); ++ + return true; + } + +@@ -477,7 +472,7 @@ bool CMMALVideo::DestroyDeinterlace() + + m_dec_output = m_dec->output[0]; + m_interlace_method = VS_INTERLACEMETHOD_NONE; +- Prime(); ++ + return true; + } + +@@ -708,21 +703,14 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide + return false; + } + +- m_dec_output_pool = mmal_port_pool_create(m_dec_output, m_dec_output->buffer_num, m_dec_output->buffer_size); +- if(!m_dec_output_pool) +- { +- CLog::Log(LOGERROR, "%s::%s Failed to create pool for decode output port (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status)); +- return false; +- } +- + if (!SendCodecConfigData()) + return false; + +- Prime(); + m_startframe = false; + m_preroll = !m_hints.stills; + m_speed = DVD_PLAYSPEED_NORMAL; + ++ g_renderManager.PassCookie(this); + return true; + } + +@@ -730,6 +718,7 @@ void CMMALVideo::Dispose() + { + // we are happy to exit, but let last shared pointer being deleted trigger the destructor + bool done = false; ++ g_renderManager.PassCookie(NULL); + m_finished = true; + Reset(); + pthread_mutex_lock(&m_output_mutex); +@@ -905,13 +894,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + return ret; + } + +-void CMMALVideo::Prime() +-{ +- MMAL_BUFFER_HEADER_T *buffer; +- while (buffer = mmal_queue_get(m_dec_output_pool->queue), buffer) +- Recycle(buffer); +-} +- + void CMMALVideo::Reset(void) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -957,10 +939,8 @@ void CMMALVideo::Reset(void) + pthread_mutex_unlock(&m_output_mutex); + + if (!m_finished) +- { + 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); +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index fcc6a15..204f004 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -103,7 +103,6 @@ class CMMALVideo + void QueryCodec(void); + bool CreateDeinterlace(EINTERLACEMETHOD interlace_method); + bool DestroyDeinterlace(); +- void Prime(); + + // Video format + int m_decoded_width; +@@ -141,7 +140,6 @@ class CMMALVideo + MMAL_PORT_T *m_dec_input; + MMAL_PORT_T *m_dec_output; + MMAL_POOL_T *m_dec_input_pool; +- MMAL_POOL_T *m_dec_output_pool; + + MMAL_ES_FORMAT_T *m_es_format; + MMAL_COMPONENT_T *m_deint; + +From 77dd3b8de1d73d01867d190bbcd4a82e67179c44 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 17 Apr 2015 16:07:40 +0100 +Subject: [PATCH 85/89] Separate mmal and renderer configured flags + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 26 +++++++++++++++----------- + xbmc/cores/VideoRenderers/MMALRenderer.h | 1 + + 2 files changed, 16 insertions(+), 11 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 5fbe2d2..fe3dce4 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -74,13 +74,12 @@ void *CMMALRenderer::PassCookie(void *cookie) + CLog::Log(LOGDEBUG, "%s::%s cookie:%p", CLASSNAME, __func__, cookie); + #endif + +- if (m_mmal_video) +- { +- bool formatChanged = m_format != RENDER_FMT_MMAL; +- m_format = RENDER_FMT_MMAL; +- m_bConfigured = init_vout(formatChanged); ++ if (m_mmal_video && !m_bMMALConfigured) ++ m_bMMALConfigured = init_vout(RENDER_FMT_MMAL); ++ ++ if (m_mmal_video && m_bMMALConfigured) + Prime(); +- } ++ + return NULL; + } + +@@ -122,10 +121,10 @@ bool CMMALRenderer::init_vout(ERenderFormat format) + + CLog::Log(LOGDEBUG, "%s::%s configured:%d format:%d->%d", CLASSNAME, __func__, m_bConfigured, m_format, format); + +- if (m_bConfigured && formatChanged) ++ if (m_bMMALConfigured && formatChanged) + UnInitMMAL(); + +- if (m_bConfigured) ++ if (m_bMMALConfigured) + return true; + + m_format = RENDER_FMT_MMAL; +@@ -247,6 +246,8 @@ CMMALRenderer::CMMALRenderer() + m_release_queue = mmal_queue_create(); + m_iFlags = 0; + m_format = RENDER_FMT_NONE; ++ m_bConfigured = false; ++ m_bMMALConfigured = false; + m_iYV12RenderBuffer = 0; + Create(); + } +@@ -297,8 +298,9 @@ bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned + SetViewMode(CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode); + ManageDisplay(); + +- m_bConfigured = init_vout(format); +- ++ m_bMMALConfigured = init_vout(format); ++ m_bConfigured = m_bMMALConfigured; ++ assert(m_bConfigured); + return m_bConfigured; + } + +@@ -361,7 +363,8 @@ int CMMALRenderer::GetImage(YV12Image *image, int source, bool readonly) + + void CMMALRenderer::ReleaseBuffer(int idx) + { +- if (!m_bConfigured || m_format == RENDER_FMT_BYPASS) ++ CSingleLock lock(m_sharedSection); ++ if (!m_bMMALConfigured || m_format == RENDER_FMT_BYPASS) + return; + + #if defined(MMAL_DEBUG_VERBOSE) +@@ -541,6 +544,7 @@ void CMMALRenderer::UnInitMMAL() + m_StereoInvert = false; + + m_bConfigured = false; ++ m_bMMALConfigured = false; + } + + void CMMALRenderer::UnInit() +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h +index f515d7a..a694182 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.h ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.h +@@ -100,6 +100,7 @@ class CMMALRenderer : public CBaseRenderer, public CThread + + YUVBUFFER m_buffers[NUM_BUFFERS]; + bool m_bConfigured; ++ bool m_bMMALConfigured; + unsigned int m_extended_format; + unsigned int m_destWidth; + unsigned int m_destHeight; + +From abe0fca00a2e5b063ff45037f543429f4c87305c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 16 Apr 2015 21:43:27 +0100 +Subject: [PATCH 86/89] Separate the buffers from the decoder so decoder can be + destroyed first + +--- + .../DVDCodecs/Video/DVDVideoCodecMMAL.cpp | 4 +- + .../dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h | 2 +- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 63 ++++++---------------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 6 +-- + 4 files changed, 20 insertions(+), 55 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp +index ee7d6f2..48e347c 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp +@@ -44,11 +44,13 @@ CDVDVideoCodecMMAL::~CDVDVideoCodecMMAL() + { + CLog::Log(LOGDEBUG, "%s::%s %p\n", CLASSNAME, __func__, this); + Dispose(); ++ delete m_decoder; ++ m_decoder = NULL; + } + + bool CDVDVideoCodecMMAL::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + { +- return m_decoder->Open(hints, options, m_decoder); ++ return m_decoder->Open(hints, options); + } + + const char* CDVDVideoCodecMMAL::GetName(void) +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h +index aa8e87f..6014363 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h +@@ -46,7 +46,7 @@ class CDVDVideoCodecMMAL : public CDVDVideoCodec + virtual void SetSpeed(int iSpeed); + + protected: +- MMALVideoPtr m_decoder; ++ CMMALVideo *m_decoder; + }; + + #endif +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 1fdc44c..7a45c25 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -81,7 +81,8 @@ long CMMALVideoBuffer::Release() + CLog::Log(LOGDEBUG, "%s::%s %p (%p) ref:%ld", CLASSNAME, __func__, this, mmal_buffer, count); + if (count == 0) + { +- m_omv->ReleaseBuffer(this); ++ mmal_buffer_header_release(mmal_buffer); ++ delete this; + } + else assert(count > 0); + return count; +@@ -117,7 +118,6 @@ CMMALVideo::CMMALVideo() + + m_codingType = 0; + +- m_output_busy = 0; + m_demux_queue_length = 0; + m_es_format = mmal_format_alloc(); + m_preroll = true; +@@ -261,7 +261,6 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf + omvb->height = m_decoded_height; + omvb->m_aspect_ratio = m_aspect_ratio; + pthread_mutex_lock(&m_output_mutex); +- m_output_busy++; + m_output_ready.push(omvb); + pthread_mutex_unlock(&m_output_mutex); + kept = true; +@@ -505,7 +504,7 @@ bool CMMALVideo::SendCodecConfigData() + return true; + } + +-bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVideoPtr myself) ++bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s usemmal:%d software:%d %dx%d", CLASSNAME, __func__, CSettings::Get().GetBool("videoplayer.usemmal"), hints.software, hints.width, hints.height); +@@ -518,7 +517,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide + MMAL_STATUS_T status; + MMAL_PARAMETER_BOOLEAN_T error_concealment; + +- m_myself = myself; + m_decoded_width = hints.width; + m_decoded_height = hints.height; + +@@ -716,21 +714,9 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide + + void CMMALVideo::Dispose() + { +- // we are happy to exit, but let last shared pointer being deleted trigger the destructor +- bool done = false; + g_renderManager.PassCookie(NULL); + m_finished = true; + Reset(); +- pthread_mutex_lock(&m_output_mutex); +- if (!m_output_busy) +- done = true; +- pthread_mutex_unlock(&m_output_mutex); +- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s ready_queue(%d) busy_queue(%d) done:%d", CLASSNAME, __func__, m_output_ready.size(), m_output_busy, done); +- if (done) +- { +- m_myself.reset(); +- } + } + + void CMMALVideo::SetDropState(bool bDrop) +@@ -742,8 +728,8 @@ void CMMALVideo::SetDropState(bool bDrop) + int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + { + //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- // CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d dts:%.3f pts:%.3f ready_queue(%d) busy_queue(%d)", +- // CLASSNAME, __func__, pData, iSize, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, m_output_ready.size(), m_output_busy); ++ // CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d dts:%.3f pts:%.3f ready_queue(%d)", ++ // CLASSNAME, __func__, pData, iSize, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, m_output_ready.size()); + + unsigned int demuxer_bytes = 0; + uint8_t *demuxer_content = NULL; +@@ -819,8 +805,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + buffer->flags |= MMAL_BUFFER_HEADER_FLAG_FRAME_END; + + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d/%-6d dts:%.3f pts:%.3f flags:%x ready_queue(%d) busy_queue(%d) demux_queue(%d) space(%d)", +- CLASSNAME, __func__, buffer, buffer->length, demuxer_bytes, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, buffer->flags, m_output_ready.size(), m_output_busy, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); ++ CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d/%-6d dts:%.3f pts:%.3f flags:%x ready_queue(%d) demux_queue(%d) space(%d)", ++ CLASSNAME, __func__, buffer, buffer->length, demuxer_bytes, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, buffer->flags, m_output_ready.size(), m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); + assert((int)buffer->length > 0); + status = mmal_port_send_buffer(m_dec_input, buffer); + if (status != MMAL_SUCCESS) +@@ -887,8 +873,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + if (!ret) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s - Nothing to do: ready_queue(%d) busy_queue(%d) demux_queue(%d) space(%d) preroll(%d)", +- CLASSNAME, __func__, m_output_ready.size(), m_output_busy, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, m_preroll); ++ CLog::Log(LOGDEBUG, "%s::%s - Nothing to do: ready_queue(%d) demux_queue(%d) space(%d) preroll(%d)", ++ CLASSNAME, __func__, m_output_ready.size(), m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, m_preroll); + Sleep(10); // otherwise we busy spin + } + return ret; +@@ -927,7 +913,10 @@ void CMMALVideo::Reset(void) + } + pthread_mutex_unlock(&m_output_mutex); + if (buffer) +- ReleaseBuffer(buffer); ++ { ++ buffer->Acquire(); ++ buffer->Release(); ++ } + else + break; + } +@@ -970,8 +959,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) + mmal_buffer_header_reset(buffer); + buffer->cmd = 0; + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s Send buffer %p from pool to decoder output port %p ready_queue(%d) busy_queue(%d)", CLASSNAME, __func__, buffer, m_dec_output, +- m_output_ready.size(), m_output_busy); ++ CLog::Log(LOGDEBUG, "%s::%s Send buffer %p from pool to decoder output port %p ready_queue(%d)", CLASSNAME, __func__, buffer, m_dec_output, ++ m_output_ready.size()); + status = mmal_port_send_buffer(m_dec_output, buffer); + if (status != MMAL_SUCCESS) + { +@@ -980,28 +969,6 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) + } + } + +-void CMMALVideo::ReleaseBuffer(CMMALVideoBuffer *buffer) +-{ +- // remove from busy list +- pthread_mutex_lock(&m_output_mutex); +- assert(m_output_busy > 0); +- m_output_busy--; +- pthread_mutex_unlock(&m_output_mutex); +- // sanity check it is not on display +- assert(!(buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER2)); +- Recycle(buffer->mmal_buffer); +- bool done = false; +- pthread_mutex_lock(&m_output_mutex); +- if (m_finished && !m_output_busy) +- done = true; +- pthread_mutex_unlock(&m_output_mutex); +- if (done) +- m_myself.reset(); +- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s %p (%p) ready_queue(%d) busy_queue(%d) done:%d", CLASSNAME, __func__, buffer, buffer->mmal_buffer, m_output_ready.size(), m_output_busy, done); +- delete buffer; +-} +- + bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) + { + if (!m_output_ready.empty()) +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index 204f004..ab6e958 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -42,7 +42,6 @@ + #include "cores/VideoRenderers/BaseRenderer.h" + + class CMMALVideo; +-typedef std::shared_ptr MMALVideoPtr; + + // a mmal video frame + class CMMALVideoBuffer +@@ -77,7 +76,7 @@ class CMMALVideo + virtual ~CMMALVideo(); + + // Required overrides +- virtual bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVideoPtr myself); ++ virtual bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options); + virtual void Dispose(void); + virtual int Decode(uint8_t *pData, int iSize, double dts, double pts); + virtual void Reset(void); +@@ -91,7 +90,6 @@ class CMMALVideo + virtual void SetSpeed(int iSpeed); + + // MMAL decoder callback routines. +- void ReleaseBuffer(CMMALVideoBuffer *buffer); + void Recycle(MMAL_BUFFER_HEADER_T *buffer); + + // MMAL decoder callback routines. +@@ -111,14 +109,12 @@ class CMMALVideo + bool m_finished; + float m_aspect_ratio; + const char *m_pFormatName; +- MMALVideoPtr m_myself; + + std::queue m_demux_queue; + unsigned m_demux_queue_length; + + // mmal output buffers (video frames) + pthread_mutex_t m_output_mutex; +- int m_output_busy; + std::queue m_output_ready; + + // initialize mmal and get decoder component + +From d93944688cae601453f2439169cf9a5834196177 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 16 Apr 2015 21:50:10 +0100 +Subject: [PATCH 87/89] Remove DVDVideoCodecMMAL wrapper + +--- + xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 4 +- + .../DVDCodecs/Video/DVDVideoCodecMMAL.cpp | 111 --------------------- + .../dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h | 52 ---------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 4 +- + xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in | 1 - + 5 files changed, 4 insertions(+), 168 deletions(-) + delete mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp + delete mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +index 9d8de2a..995a14e 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +@@ -39,7 +39,7 @@ + #if defined(HAS_IMXVPU) + #include "Video/DVDVideoCodecIMX.h" + #endif +-#include "Video/DVDVideoCodecMMAL.h" ++#include "Video/MMALCodec.h" + #include "Video/DVDVideoCodecStageFright.h" + #if defined(HAS_LIBAMCODEC) + #include "utils/AMLUtils.h" +@@ -306,7 +306,7 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne + hint.codec == AV_CODEC_ID_VP6 || hint.codec == AV_CODEC_ID_VP6F || hint.codec == AV_CODEC_ID_VP6A || hint.codec == AV_CODEC_ID_VP8 || + hint.codec == AV_CODEC_ID_THEORA || hint.codec == AV_CODEC_ID_MJPEG || hint.codec == AV_CODEC_ID_MJPEGB || hint.codec == AV_CODEC_ID_VC1 || hint.codec == AV_CODEC_ID_WMV3) + { +- if ( (pCodec = OpenCodec(new CDVDVideoCodecMMAL(), hint, options)) ) return pCodec; ++ if ( (pCodec = OpenCodec(new CMMALVideo(), hint, options)) ) return pCodec; + } + } + #endif +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp +deleted file mode 100644 +index 48e347c..0000000 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp ++++ /dev/null +@@ -1,111 +0,0 @@ +-/* +- * Copyright (C) 2010-2013 Team XBMC +- * http://xbmc.org +- * +- * This Program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2, or (at your option) +- * any later version. +- * +- * This Program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with XBMC; see the file COPYING. If not, see +- * . +- * +- */ +- +-#if (defined HAVE_CONFIG_H) && (!defined TARGET_WINDOWS) +- #include "config.h" +-#elif defined(TARGET_WINDOWS) +-#include "system.h" +-#endif +- +-#if defined(HAS_MMAL) +-#include "DVDClock.h" +-#include "DVDStreamInfo.h" +-#include "DVDVideoCodecMMAL.h" +-#include "settings/Settings.h" +-#include "utils/log.h" +- +-#define CLASSNAME "CDVDVideoCodecMMAL" +-//////////////////////////////////////////////////////////////////////////////////////////// +-//////////////////////////////////////////////////////////////////////////////////////////// +-CDVDVideoCodecMMAL::CDVDVideoCodecMMAL() +- : m_decoder( new CMMALVideo ) +-{ +- CLog::Log(LOGDEBUG, "%s::%s %p\n", CLASSNAME, __func__, this); +-} +- +-CDVDVideoCodecMMAL::~CDVDVideoCodecMMAL() +-{ +- CLog::Log(LOGDEBUG, "%s::%s %p\n", CLASSNAME, __func__, this); +- Dispose(); +- delete m_decoder; +- m_decoder = NULL; +-} +- +-bool CDVDVideoCodecMMAL::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) +-{ +- return m_decoder->Open(hints, options); +-} +- +-const char* CDVDVideoCodecMMAL::GetName(void) +-{ +- return m_decoder ? m_decoder->GetName() : "mmal-xxx"; +-} +- +-void CDVDVideoCodecMMAL::Dispose() +-{ +- m_decoder->Dispose(); +-} +- +-void CDVDVideoCodecMMAL::SetDropState(bool bDrop) +-{ +- m_decoder->SetDropState(bDrop); +-} +- +-int CDVDVideoCodecMMAL::Decode(uint8_t* pData, int iSize, double dts, double pts) +-{ +- return m_decoder->Decode(pData, iSize, dts, pts); +-} +- +-unsigned CDVDVideoCodecMMAL::GetAllowedReferences() +-{ +- return m_decoder->GetAllowedReferences(); +-} +- +-void CDVDVideoCodecMMAL::Reset(void) +-{ +- m_decoder->Reset(); +-} +- +-bool CDVDVideoCodecMMAL::GetPicture(DVDVideoPicture* pDvdVideoPicture) +-{ +- return m_decoder->GetPicture(pDvdVideoPicture); +-} +- +-bool CDVDVideoCodecMMAL::ClearPicture(DVDVideoPicture* pDvdVideoPicture) +-{ +- return m_decoder->ClearPicture(pDvdVideoPicture); +-} +- +-bool CDVDVideoCodecMMAL::GetCodecStats(double &pts, int &droppedPics) +-{ +- return m_decoder->GetCodecStats(pts, droppedPics); +-} +- +-void CDVDVideoCodecMMAL::SetCodecControl(int flags) +-{ +- m_decoder->SetCodecControl(flags); +-} +- +-void CDVDVideoCodecMMAL::SetSpeed(int iSpeed) +-{ +- m_decoder->SetSpeed(iSpeed); +-} +- +-#endif +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h +deleted file mode 100644 +index 6014363..0000000 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.h ++++ /dev/null +@@ -1,52 +0,0 @@ +-#pragma once +-/* +- * Copyright (C) 2010-2013 Team XBMC +- * http://xbmc.org +- * +- * This Program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2, or (at your option) +- * any later version. +- * +- * This Program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with XBMC; see the file COPYING. If not, see +- * . +- * +- */ +- +-#if defined(HAS_MMAL) +- +-#include "DVDVideoCodec.h" +-#include "MMALCodec.h" +- +-class CMMALVideo; +-class CDVDVideoCodecMMAL : public CDVDVideoCodec +-{ +-public: +- CDVDVideoCodecMMAL(); +- virtual ~CDVDVideoCodecMMAL(); +- +- // Required overrides +- virtual bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options); +- virtual void Dispose(void); +- virtual int Decode(uint8_t *pData, int iSize, double dts, double pts); +- virtual void Reset(void); +- virtual bool GetPicture(DVDVideoPicture *pDvdVideoPicture); +- virtual bool ClearPicture(DVDVideoPicture* pDvdVideoPicture); +- virtual unsigned GetAllowedReferences(); +- virtual void SetDropState(bool bDrop); +- virtual const char* GetName(void); +- virtual bool GetCodecStats(double &pts, int &droppedPics); +- virtual void SetCodecControl(int flags); +- virtual void SetSpeed(int iSpeed); +- +-protected: +- CMMALVideo *m_decoder; +-}; +- +-#endif +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index ab6e958..3e444f7 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -62,7 +62,7 @@ class CMMALVideoBuffer + private: + }; + +-class CMMALVideo ++class CMMALVideo : public CDVDVideoCodec + { + typedef struct mmal_demux_packet { + uint8_t *buff; +@@ -84,7 +84,7 @@ class CMMALVideo + virtual bool ClearPicture(DVDVideoPicture* pDvdVideoPicture); + virtual unsigned GetAllowedReferences() { return 3; } + virtual void SetDropState(bool bDrop); +- virtual const char* GetName(void) { return (const char*)m_pFormatName; } ++ virtual const char* GetName(void) { return m_pFormatName ? m_pFormatName:"mmal-xxx"; } + virtual bool GetCodecStats(double &pts, int &droppedPics); + virtual void SetCodecControl(int flags); + virtual void SetSpeed(int iSpeed); +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in +index 6f5d3e8..56ec6a3 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in +@@ -39,7 +39,6 @@ endif + + ifeq (@USE_MMAL@,1) + SRCS += MMALCodec.cpp +-SRCS += DVDVideoCodecMMAL.cpp + endif + + LIB=Video.a + +From 6b1c7ca35ed7a890db47cf528a4a5ebbd468b852 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 17 Apr 2015 15:46:55 +0100 +Subject: [PATCH 88/89] Add shared lock around MMAL operations + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 17 +++++++++++++++++ + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 + + 2 files changed, 18 insertions(+) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 7a45c25..2a6eb78 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -127,6 +127,7 @@ CMMALVideo::CMMALVideo() + + CMMALVideo::~CMMALVideo() + { ++ CSingleLock lock(m_sharedSection); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); + assert(m_finished); +@@ -174,6 +175,7 @@ CMMALVideo::~CMMALVideo() + + void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) + { ++ CSingleLock lock(m_sharedSection); + MMAL_EVENT_FORMAT_CHANGED_T *fmt = mmal_event_format_changed_get(buffer); + mmal_format_copy(m_es_format, fmt->format); + +@@ -288,6 +290,7 @@ static void dec_output_port_cb_static(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *b + + bool CMMALVideo::change_dec_output_format() + { ++ CSingleLock lock(m_sharedSection); + MMAL_STATUS_T status; + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); +@@ -324,6 +327,7 @@ bool CMMALVideo::change_dec_output_format() + + bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) + { ++ CSingleLock lock(m_sharedSection); + MMAL_STATUS_T status; + + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -421,6 +425,7 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) + + bool CMMALVideo::DestroyDeinterlace() + { ++ CSingleLock lock(m_sharedSection); + MMAL_STATUS_T status; + + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -477,6 +482,7 @@ bool CMMALVideo::DestroyDeinterlace() + + bool CMMALVideo::SendCodecConfigData() + { ++ CSingleLock lock(m_sharedSection); + MMAL_STATUS_T status; + if (!m_dec_input_pool) + return true; +@@ -506,6 +512,7 @@ bool CMMALVideo::SendCodecConfigData() + + bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + { ++ CSingleLock lock(m_sharedSection); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s usemmal:%d software:%d %dx%d", CLASSNAME, __func__, CSettings::Get().GetBool("videoplayer.usemmal"), hints.software, hints.width, hints.height); + +@@ -708,6 +715,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + m_preroll = !m_hints.stills; + m_speed = DVD_PLAYSPEED_NORMAL; + ++ lock.Leave(); + g_renderManager.PassCookie(this); + return true; + } +@@ -715,6 +723,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + void CMMALVideo::Dispose() + { + g_renderManager.PassCookie(NULL); ++ CSingleLock lock(m_sharedSection); + m_finished = true; + Reset(); + } +@@ -727,6 +736,7 @@ void CMMALVideo::SetDropState(bool bDrop) + + int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + { ++ CSingleLock lock(m_sharedSection); + //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + // CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d dts:%.3f pts:%.3f ready_queue(%d)", + // CLASSNAME, __func__, pData, iSize, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, m_output_ready.size()); +@@ -875,6 +885,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s - Nothing to do: ready_queue(%d) demux_queue(%d) space(%d) preroll(%d)", + CLASSNAME, __func__, m_output_ready.size(), m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, m_preroll); ++ lock.Leave(); + Sleep(10); // otherwise we busy spin + } + return ret; +@@ -882,6 +893,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + void CMMALVideo::Reset(void) + { ++ CSingleLock lock(m_sharedSection); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); + +@@ -946,6 +958,7 @@ void CMMALVideo::SetSpeed(int iSpeed) + + void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) + { ++ CSingleLock lock(m_sharedSection); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, buffer); + +@@ -971,6 +984,7 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) + + bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) + { ++ CSingleLock lock(m_sharedSection); + if (!m_output_ready.empty()) + { + CMMALVideoBuffer *buffer; +@@ -1030,6 +1044,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) + + bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) + { ++ CSingleLock lock(m_sharedSection); + if (pDvdVideoPicture->format == RENDER_FMT_MMAL) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -1042,12 +1057,14 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) + + bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) + { ++ CSingleLock lock(m_sharedSection); + droppedPics= -1; + return false; + } + + void CMMALVideo::SetCodecControl(int flags) + { ++ CSingleLock lock(m_sharedSection); + m_codecControlFlags = flags; + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s flags:%x", CLASSNAME, __func__, flags); +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index 3e444f7..e686b4b 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -132,6 +132,7 @@ class CMMALVideo : public CDVDVideoCodec + bool m_preroll; + int m_codecControlFlags; + ++ CCriticalSection m_sharedSection; + MMAL_COMPONENT_T *m_dec; + MMAL_PORT_T *m_dec_input; + MMAL_PORT_T *m_dec_output; + +From ec9d208ad8e921eb4479279154fe4b477d1f9c71 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 17 Apr 2015 15:59:12 +0100 +Subject: [PATCH 89/89] Add shared lock around MMAL operations + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 13 +++++++++++++ + xbmc/cores/VideoRenderers/MMALRenderer.h | 1 + + 2 files changed, 14 insertions(+) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index fe3dce4..7ebc2c9 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -44,6 +44,7 @@ + + void CMMALRenderer::Prime() + { ++ CSingleLock lock(m_sharedSection); + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s format:%d dec:%p pool:%p", CLASSNAME, __func__, m_format, m_mmal_video, m_vout_input_pool); + #endif +@@ -69,6 +70,7 @@ void CMMALRenderer::Prime() + + void *CMMALRenderer::PassCookie(void *cookie) + { ++ CSingleLock lock(m_sharedSection); + m_mmal_video = (CMMALVideo *)cookie; + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s cookie:%p", CLASSNAME, __func__, cookie); +@@ -90,6 +92,7 @@ static void vout_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer + + void CMMALRenderer::vout_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) + { ++ CSingleLock lock(m_sharedSection); + #if defined(MMAL_DEBUG_VERBOSE) + CMMALVideoBuffer *omvb = (CMMALVideoBuffer *)buffer->user_data; + CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p (%p), len %d cmd:%x f:%x", CLASSNAME, __func__, port, buffer, omvb, buffer->length, buffer->cmd, buffer->flags); +@@ -116,6 +119,7 @@ static void vout_input_port_cb_static(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *b + + bool CMMALRenderer::init_vout(ERenderFormat format) + { ++ CSingleLock lock(m_sharedSection); + bool formatChanged = m_format != format; + MMAL_STATUS_T status; + +@@ -254,6 +258,7 @@ CMMALRenderer::CMMALRenderer() + + CMMALRenderer::~CMMALRenderer() + { ++ CSingleLock lock(m_sharedSection); + CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); + // shutdown thread + mmal_queue_put(m_release_queue, &m_quit_packet); +@@ -276,6 +281,7 @@ void CMMALRenderer::AddProcessor(CMMALVideoBuffer *buffer, int index) + + bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags, ERenderFormat format, unsigned extended_format, unsigned int orientation) + { ++ CSingleLock lock(m_sharedSection); + ReleaseBuffers(); + + m_sourceWidth = width; +@@ -306,6 +312,7 @@ bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned + + int CMMALRenderer::GetImage(YV12Image *image, int source, bool readonly) + { ++ CSingleLock lock(m_sharedSection); + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - %p %d %d", CLASSNAME, __func__, image, source, readonly); + #endif +@@ -403,6 +410,7 @@ void CMMALRenderer::Update() + + void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + { ++ CSingleLock lock(m_sharedSection); + int source = m_iYV12RenderBuffer; + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - %d %x %d %d", CLASSNAME, __func__, clear, flags, alpha, source); +@@ -463,6 +471,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + + void CMMALRenderer::FlipPage(int source) + { ++ CSingleLock lock(m_sharedSection); + if (!m_bConfigured || m_format == RENDER_FMT_BYPASS) + return; + +@@ -475,6 +484,7 @@ void CMMALRenderer::FlipPage(int source) + + unsigned int CMMALRenderer::PreInit() + { ++ CSingleLock lock(m_sharedSection); + m_bConfigured = false; + UnInit(); + +@@ -500,12 +510,14 @@ unsigned int CMMALRenderer::PreInit() + + void CMMALRenderer::ReleaseBuffers() + { ++ CSingleLock lock(m_sharedSection); + for (int i=0; i