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 521019dd08..879938df5e 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,29 @@ -From cef01168572238112d543362f6b4a6dc65b38cf2 Mon Sep 17 00:00:00 2001 +From e7a6d463c7df5946991024540c0b9afbf48e5a0a Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 24 Apr 2015 13:49:51 +0100 +Subject: [PATCH 01/56] [dvdplayer] Add back required include + +--- + xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +index 6b24b25..a3922c0 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +@@ -33,6 +33,7 @@ + #include "DVDCodecs/Video/DVDVideoPPFFmpeg.h" + #include "DVDCodecs/Video/DVDVideoCodecFFmpeg.h" + #include "DVDDemuxers/DVDDemux.h" ++#include "DVDDemuxers/DVDDemuxUtils.h" + #include "DVDOverlayRenderer.h" + #include "guilib/GraphicContext.h" + #include + +From 29b89ed811f96193f85fd761168a9dc88270afd3 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 01/89] [rbp/omxplayer] When opening a stream don't try to +Subject: [PATCH 02/56] [rbp/omxplayer] When opening a stream don't try to update gui so often --- @@ -25,10 +47,10 @@ index 2faceea..889d7a2 100644 g_windowManager.ProcessRenderLoop(false); if (allowCancel && dialog->IsCanceled()) -From ac38c688a0443bd965bf167def9f30e105e7227c Mon Sep 17 00:00:00 2001 +From 3703b7999256e773486d09fdaae7d4345ff8e0f0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 29 Apr 2014 15:23:22 +0100 -Subject: [PATCH 02/89] [ffmpeg] Speed up wtv index creation +Subject: [PATCH 03/56] [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,32 +136,10 @@ index 0000000..4ac5636 + } + } -From 10fca829203615581df049df3ab697eb26a0df13 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 2 Aug 2014 17:48:04 +0100 -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 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 - { - ret = true; - *userdata = tex; -+ CLog::Log(LOGDEBUG, "%s: decoded %s %dx%d", __func__, file->GetFilename(), width, height); - } - else - { - -From db0a6dc35272b3b14e9c463ed357ebd9df0431be Mon Sep 17 00:00:00 2001 +From 7c3357d9c9c6456e35927814af7d54cd4b11bff9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 04/89] [hifiberry] Hack: force it to be recognised as IEC958 +Subject: [PATCH 04/56] [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 d21d0015b0df19c700e1c63d5525546cc5f71f15 Mon Sep 17 00:00:00 2001 +From 18ae905e8eb0987c35e8a10ccfbcbcbf829ba77b Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 05/89] Improved file buffering in CArchive +Subject: [PATCH 05/56] 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,20 +225,20 @@ index 6ed0f8f..8506d95 100644 } else -From 02ffcb9c5cac171a3fb3e8ace0fb24fda0dd0db0 Mon Sep 17 00:00:00 2001 +From e564fb5d4b4f0e0db220c3e9b4017beb307ba377 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 12 Aug 2014 00:31:36 +0100 -Subject: [PATCH 06/89] [omxcodec] Don't force software codec with dvds +Subject: [PATCH 06/56] [omxcodec] Don't force software codec with dvds --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 143ea06..e029c16 100644 +index 37865b5..abe9f92 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -3345,7 +3345,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) +@@ -3372,7 +3372,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) hint.aspect = aspect; hint.forced_aspect = true; } @@ -249,10 +249,10 @@ index 143ea06..e029c16 100644 else if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) { -From 965be36a5564ce176d5d9c135b313e2323395242 Mon Sep 17 00:00:00 2001 +From e4d50075650921f209af54e14e2531824e24660f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 07/89] filesystem: Make support of browsing into archives +Subject: [PATCH 07/56] 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 dedca23..629f726 100644 +index 3e39938..06d261c 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16527,6 +16527,15 @@ msgstr "" +@@ -16525,6 +16525,15 @@ msgstr "" #: system/settings/rbp.xml msgctxt "#38010" msgid "GPU accelerated" @@ -290,7 +290,7 @@ index dedca23..629f726 100644 #. Setting #38011 "Videos -> Library -> Show All Items entry" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 3940ca8..8f1bfc4 100644 +index f89c00a..5b4391f 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -304,6 +304,11 @@ @@ -335,10 +335,10 @@ index 3a5ba4e..f1f6f79 100644 { // XBMC Smart playlist - just XML renamed to XSP // read the name of the playlist in -From d1698689aedc5255eaf125d2bbf7940c6ce8b1e2 Mon Sep 17 00:00:00 2001 +From c61ee467f28a868a6788ebf63c17ad9b9b02fe0e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 13:06:57 +0000 -Subject: [PATCH 09/89] [rbp] Make cachemembuffersize default depend on memory +Subject: [PATCH 09/56] [rbp] Make cachemembuffersize default depend on memory size --- @@ -377,7 +377,7 @@ index 59dd1da..aedae18 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 fab9a82..25ef7b8 100644 +index c4fa298..2ec904c 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -352,7 +352,12 @@ void CAdvancedSettings::Initialize() @@ -394,11 +394,10 @@ index fab9a82..25ef7b8 100644 // the following setting determines the readRate of a player data // as multiply of the default data read rate - -From 1690732bafc24f041aabaccd168f35e86ebdbbd2 Mon Sep 17 00:00:00 2001 +From 8318924e413a137e3dbe33efd9af1ddad6313735 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 11/89] [settings] Experiment: Report DESKTOP resolution in +Subject: [PATCH 11/56] [settings] Experiment: Report DESKTOP resolution in video settings --- @@ -420,10 +419,10 @@ index 1fafd9a..e0288aa 100644 StringUtils::Format("%dx%d%s", resolution->width, resolution->height, ModeFlagsToString(resolution->flags, false).c_str()), -From 2e5b318953c5635129b69c01f24919392b0af5da Mon Sep 17 00:00:00 2001 +From b9b068dce6d2eb40a605a43e97633e2432c87795 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 9 Sep 2014 12:04:26 +0100 -Subject: [PATCH 12/89] egl: Treat unknown display aspect ratio as square pixel +Subject: [PATCH 12/56] egl: Treat unknown display aspect ratio as square pixel --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 ++-- @@ -452,10 +451,10 @@ index bda7430..68fc647 100644 SetResolutionString(m_desktopRes); -From f585eaf62527f49edaa92c95322968c05189ac2f Mon Sep 17 00:00:00 2001 +From b25a9d54ee084817cbf1a73925434f0213c4eb44 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 13/89] [dvdplayer/rbp] Add pi specific option to maintain +Subject: [PATCH 13/56] [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". @@ -480,7 +479,7 @@ Needed updated firmware 9 files changed, 91 insertions(+), 7 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 629f726..129f0c7 100644 +index 06d261c..11f5315 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -6336,7 +6336,22 @@ msgctxt "#13459" @@ -507,7 +506,7 @@ index 629f726..129f0c7 100644 #: system/settings/settings.xml msgctxt "#13505" -@@ -16573,3 +16588,10 @@ msgstr "" +@@ -16571,3 +16586,10 @@ msgstr "" msgctxt "#38016" msgid "%d fps" msgstr "" @@ -519,7 +518,7 @@ index 629f726..129f0c7 100644 +msgstr "" + diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 8f1bfc4..ad90e8c 100644 +index 5b4391f..27f9773 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -572,6 +572,20 @@ @@ -558,18 +557,18 @@ index 782a9ba..3e0390c 100644 struct AEDelayStatus diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -index a345a88..bd357aa 100644 +index a429e11..2871ae2 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -@@ -25,6 +25,7 @@ - #include "DVDCodecs/DVDCodecs.h" +@@ -24,6 +24,7 @@ + #include "DVDCodecs/Audio/DVDAudioCodec.h" #include "DVDCodecs/DVDFactoryCodec.h" #include "settings/Settings.h" +#include "settings/AdvancedSettings.h" #include "video/VideoReferenceClock.h" #include "utils/log.h" - #include "utils/TimeUtils.h" -@@ -113,6 +114,9 @@ CDVDPlayerAudio::CDVDPlayerAudio(CDVDClock* pClock, CDVDMessageQueue& parent) + #include "utils/MathUtils.h" +@@ -111,6 +112,9 @@ CDVDPlayerAudio::CDVDPlayerAudio(CDVDClock* pClock, CDVDMessageQueue& parent) m_started = false; m_silence = false; m_resampleratio = 1.0; @@ -579,7 +578,7 @@ index a345a88..bd357aa 100644 m_synctype = SYNC_DISCON; m_setsynctype = SYNC_DISCON; m_prevsynctype = -1; -@@ -186,11 +190,13 @@ void CDVDPlayerAudio::OpenStream( CDVDStreamInfo &hints, CDVDAudioCodec* codec ) +@@ -184,11 +188,13 @@ void CDVDPlayerAudio::OpenStream( CDVDStreamInfo &hints, CDVDAudioCodec* codec ) m_synctype = SYNC_DISCON; m_setsynctype = SYNC_DISCON; if (CSettings::Get().GetBool("videoplayer.usedisplayasclock")) @@ -594,7 +593,7 @@ index a345a88..bd357aa 100644 m_integral = 0; m_prevskipped = false; m_syncclock = true; -@@ -233,7 +239,6 @@ void CDVDPlayerAudio::CloseStream(bool bWaitForBuffers) +@@ -231,7 +237,6 @@ void CDVDPlayerAudio::CloseStream(bool bWaitForBuffers) // uninit queue m_messageQueue.End(); @@ -602,7 +601,7 @@ index a345a88..bd357aa 100644 CLog::Log(LOGNOTICE, "Deleting audio codec"); if (m_pAudioCodec) { -@@ -486,7 +491,11 @@ void CDVDPlayerAudio::UpdatePlayerInfo() +@@ -484,7 +489,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) @@ -615,7 +614,7 @@ index a345a88..bd357aa 100644 s << ", att:" << fixed << setprecision(1) << log(GetCurrentAttenuation()) * 20.0f << " dB"; -@@ -641,8 +650,8 @@ void CDVDPlayerAudio::SetSyncType(bool passthrough) +@@ -639,8 +648,8 @@ void CDVDPlayerAudio::SetSyncType(bool passthrough) if (m_synctype != m_prevsynctype) { @@ -626,7 +625,7 @@ index a345a88..bd357aa 100644 CLog::Log(LOGDEBUG, "CDVDPlayerAudio:: synctype set to %i: %s", m_synctype, synctypes[synctype]); m_prevsynctype = m_synctype; } -@@ -752,7 +761,19 @@ void CDVDPlayerAudio::HandleSyncError(double duration) +@@ -750,7 +759,19 @@ void CDVDPlayerAudio::HandleSyncError(double duration) proportional = m_error / DVD_TIME_BASE / proportionaldiv; } m_resampleratio = 1.0 / m_pClock->GetClockSpeed() + proportional + m_integral; @@ -646,7 +645,7 @@ index a345a88..bd357aa 100644 } bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) -@@ -805,6 +826,7 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) +@@ -803,6 +824,7 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) { m_dvdAudio.AddPackets(audioframe); } @@ -654,7 +653,7 @@ index a345a88..bd357aa 100644 } else if (m_synctype == SYNC_DISCON) { -@@ -839,6 +861,10 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) +@@ -837,6 +859,10 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) m_dvdAudio.SetResampleRatio(m_resampleratio); m_dvdAudio.AddPackets(audioframe); } @@ -666,10 +665,10 @@ index a345a88..bd357aa 100644 return true; } diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.h b/xbmc/cores/dvdplayer/DVDPlayerAudio.h -index 99ce952..635c184 100644 +index 1122a1d..7389754 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerAudio.h +++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.h -@@ -232,6 +232,9 @@ class CDVDPlayerAudio : public CThread, public IDVDStreamPlayerAudio +@@ -228,6 +228,9 @@ class CDVDPlayerAudio : public CThread, public IDVDStreamPlayerAudio bool m_prevskipped; double m_maxspeedadjust; double m_resampleratio; //resample ratio when using SYNC_RESAMPLE, used for the codec info @@ -715,7 +714,7 @@ index 9559914..65492fa 100644 private: DllBcmHost *m_DllBcmHost; diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 25ef7b8..76b5ce8 100644 +index 2ec904c..fd1c7c8 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -110,6 +110,7 @@ void CAdvancedSettings::Initialize() @@ -747,10 +746,10 @@ index b0b4df1..5e0b14c 100644 float m_audioPlayCountMinimumPercent; bool m_dvdplayerIgnoreDTSinWAV; -From dfbee238810b1825c24c466b6f7c90140a6c602f Mon Sep 17 00:00:00 2001 +From 94cec59be3b05120b76016c51cb96de2960d61ad Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 27 Sep 2014 15:32:37 +0100 -Subject: [PATCH 14/89] [dvdplayer] exerimental: don't raise priority of audio +Subject: [PATCH 14/56] [dvdplayer] exerimental: don't raise priority of audio thread --- @@ -758,10 +757,10 @@ Subject: [PATCH 14/89] [dvdplayer] exerimental: don't raise priority of audio 1 file changed, 4 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index e029c16..63f4a30 100644 +index abe9f92..2f687ac 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -3330,7 +3330,11 @@ bool CDVDPlayer::OpenAudioStream(CDVDStreamInfo& hint, bool reset) +@@ -3357,7 +3357,11 @@ bool CDVDPlayer::OpenAudioStream(CDVDStreamInfo& hint, bool reset) m_dvdPlayerAudio->SendMessage(new CDVDMsg(CDVDMsg::PLAYER_STARTED), 1); /* audio normally won't consume full cpu, so let it have prio */ @@ -774,10 +773,10 @@ index e029c16..63f4a30 100644 } -From e8a3d13ea42fc7a4f654a1b1b419a5cf0e3a1edc Mon Sep 17 00:00:00 2001 +From c0642bc05d3c606cdd62d6e92ddb4684299df785 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 15/89] [audio] Add settings option to boost centre channel +Subject: [PATCH 15/56] [audio] Add settings option to boost centre channel when downmixing This allows a dB volume increase to be added to centre channel. @@ -795,10 +794,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 129f0c7..7f44813 100644 +index 11f5315..b5f4731 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16595,3 +16595,17 @@ msgctxt "#38006" +@@ -16593,3 +16593,17 @@ msgctxt "#38006" msgid "Audio has to stay in sync, this can either be done by resampling, or adjusting the PLL" msgstr "" @@ -817,7 +816,7 @@ index 129f0c7..7f44813 100644 +msgid "%i dB" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index ad90e8c..ede89e4 100644 +index 27f9773..e833d3b 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -2645,6 +2645,18 @@ @@ -899,10 +898,10 @@ index f99c0e6..1911189 100644 // stereo upmix if (upmix && m_src_channels == 2 && m_dst_channels > 2) -From 726e56391004744900c2ab04c27e58a3e21f0d44 Mon Sep 17 00:00:00 2001 +From 6be4a7b9d3912b0a01869703857a97ce2996b3a4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 3 Oct 2014 18:40:06 +0100 -Subject: [PATCH 16/89] [SinkPi] Handle multichannel layout more like OMXAudio +Subject: [PATCH 16/56] [SinkPi] Handle multichannel layout more like OMXAudio --- xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 14 +++++++------- @@ -961,10 +960,10 @@ index a7691e8..d72a97a 100644 m_format = format; m_sinkbuffer_sec_per_byte = 1.0 / (double)(m_format.m_frameSize * m_format.m_sampleRate); -From d424942bfc56c3d49521f7c6ac5410385d1147c8 Mon Sep 17 00:00:00 2001 +From 9da1504c7da584cbec8866b0ede520f9f7652adc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 15:23:51 +0000 -Subject: [PATCH 17/89] [rbp] Default extract thumbnails to false +Subject: [PATCH 17/56] [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 @@ -994,11 +993,10 @@ index cb83297..8496abf 100644
- -From bdb2bce42352230100067f6ab19ac077ab391ca9 Mon Sep 17 00:00:00 2001 +From f8853c406f9824daf3d4f22cd290be3515cf70fe Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 15 Nov 2014 12:03:34 +0000 -Subject: [PATCH 21/89] [dvdplayer] Add lock for player creation +Subject: [PATCH 21/56] [dvdplayer] Add lock for player creation --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 3 +++ @@ -1006,10 +1004,10 @@ Subject: [PATCH 21/89] [dvdplayer] Add lock for player creation 2 files changed, 4 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 63f4a30..3c313cd 100644 +index 2f687ac..5062990 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -529,6 +529,7 @@ int CSelectionStreams::CountSource(StreamType type, StreamSource source) const +@@ -517,6 +517,7 @@ int CSelectionStreams::CountSource(StreamType type, StreamSource source) const void CDVDPlayer::CreatePlayers() { @@ -1017,7 +1015,7 @@ index 63f4a30..3c313cd 100644 #ifdef HAS_OMXPLAYER if (m_omxplayer_mode && OMXPlayerUnsuitable(m_HasVideo, m_HasAudio, m_pDemuxer, m_pInputStream, m_SelectionStreams)) { -@@ -558,6 +559,7 @@ void CDVDPlayer::CreatePlayers() +@@ -546,6 +547,7 @@ void CDVDPlayer::CreatePlayers() void CDVDPlayer::DestroyPlayers() { @@ -1025,7 +1023,7 @@ index 63f4a30..3c313cd 100644 if (!m_players_created) return; delete m_dvdPlayerVideo; -@@ -4190,6 +4192,7 @@ double CDVDPlayer::GetQueueTime() +@@ -4224,6 +4226,7 @@ double CDVDPlayer::GetQueueTime() void CDVDPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info) { @@ -1034,20 +1032,20 @@ index 63f4a30..3c313cd 100644 std::string retVal; diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h -index 468239c..3b8cefb 100644 +index f9e4bf7..41b9f22 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.h +++ b/xbmc/cores/dvdplayer/DVDPlayer.h -@@ -558,4 +558,5 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer +@@ -554,4 +554,5 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer // omxplayer variables struct SOmxPlayerState m_OmxPlayerState; bool m_omxplayer_mode; // using omxplayer acceleration + CCriticalSection m_players_lock; }; -From a40900ba3edf82d8ba63eb3e5e2ffd9a9810e42e Mon Sep 17 00:00:00 2001 +From e992a3be859498cfb4831524f7e2c756a0cea155 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 24 Nov 2014 22:07:25 +0000 -Subject: [PATCH 22/89] [dvdplayervideo] Prod decoder when in stills mode +Subject: [PATCH 22/56] [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. @@ -1056,20 +1054,10 @@ In dvd stills mode give it a chance to return pictures that weren't ready when f 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 69dc501..5832c58 100644 +index a3922c0..7f0073f 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -81,6 +81,9 @@ - #endif - #include "DVDPlayerAudio.h" - -+#include "cores/dvdplayer/DVDMessage.h" -+#include "cores/dvdplayer/DVDDemuxers/DVDDemuxUtils.h" -+ - using namespace std; - using namespace PVR; - -@@ -323,7 +323,8 @@ void CDVDPlayerVideo::Process() +@@ -317,7 +317,8 @@ void CDVDPlayerVideo::Process() while (!m_bStop) { @@ -1079,7 +1067,7 @@ index 69dc501..5832c58 100644 int iPriority = (m_speed == DVD_PLAYSPEED_PAUSE && m_started) ? 1 : 0; CDVDMsg* pMsg; -@@ -340,27 +341,36 @@ void CDVDPlayerVideo::Process() +@@ -334,27 +335,36 @@ void CDVDPlayerVideo::Process() if( iPriority ) continue; @@ -1134,10 +1122,10 @@ index 69dc501..5832c58 100644 if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE)) -From 8674cc04f73067ac9b26562f5ed1bbc87b61571c Mon Sep 17 00:00:00 2001 +From f9456da2ed3d4d15d703c5f366a0c1284369b769 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 27 Nov 2014 16:31:56 +0000 -Subject: [PATCH 23/89] [languageinvoker] Reduce priority of python threads +Subject: [PATCH 23/56] [languageinvoker] Reduce priority of python threads --- xbmc/interfaces/generic/LanguageInvokerThread.cpp | 5 +++++ @@ -1160,1826 +1148,10 @@ index fcdd063..16f0c89 100644 } -From c0d94a5d0a90ac3e0c8304f551d59ae150a04ccb Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 14 Dec 2013 16:55:05 +0000 -Subject: [PATCH 24/89] logging: Add microsecond timer to log messages - ---- - xbmc/utils/log.cpp | 17 +++++++++++++++-- - 1 file changed, 15 insertions(+), 2 deletions(-) - -diff --git a/xbmc/utils/log.cpp b/xbmc/utils/log.cpp -index 3443f12..31c4a99 100644 ---- a/xbmc/utils/log.cpp -+++ b/xbmc/utils/log.cpp -@@ -24,6 +24,7 @@ - #include "threads/Thread.h" - #include "utils/StringUtils.h" - #include "CompileInfo.h" -+#include "utils/TimeUtils.cpp" - - static const char* const levelNames[] = - {"DEBUG", "INFO", "NOTICE", "WARNING", "ERROR", "SEVERE", "FATAL", "NONE"}; -@@ -198,19 +199,31 @@ void CLog::PrintDebugString(const std::string& line) - - bool CLog::WriteLogString(int logLevel, const std::string& logString) - { -+#if defined(TARGET_LINUX) -+ static const char* prefixFormat = "%02.2d:%02.2d:%02.2d %10.6f T:%" PRIu64" %7s: "; -+#else - static const char* prefixFormat = "%02.2d:%02.2d:%02.2d T:%" PRIu64" %7s: "; -- -+#endif - std::string strData(logString); - /* fixup newline alignment, number of spaces should equal prefix length */ - StringUtils::Replace(strData, "\n", "\n "); - - int hour, minute, second; - s_globals.m_platform.GetCurrentLocalTime(hour, minute, second); -- -+ -+#if defined(TARGET_LINUX) -+ struct timespec now; -+ clock_gettime(CLOCK_MONOTONIC, &now); -+ float Now = now.tv_sec + now.tv_nsec * 1e-9; -+#endif -+ - strData = StringUtils::Format(prefixFormat, - hour, - minute, - second, -+#if defined(TARGET_LINUX) -+ Now, -+#endif - (uint64_t)CThread::GetCurrentThreadId(), - levelNames[logLevel]) + strData; - - -From 9148d35d4664d75cfa38af607202cb79e535d425 Mon Sep 17 00:00:00 2001 -From: macrule -Date: Thu, 11 Apr 2013 18:24:42 +0200 -Subject: [PATCH 25/89] Added some vc_tv_* functions that were missing in - DllBCM. - ---- - xbmc/linux/DllBCM.h | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/xbmc/linux/DllBCM.h b/xbmc/linux/DllBCM.h -index b92fdb8..9c7e293 100644 ---- a/xbmc/linux/DllBCM.h -+++ b/xbmc/linux/DllBCM.h -@@ -48,6 +48,9 @@ class DllBcmHostInterface - virtual void bcm_host_init() = 0; - virtual void bcm_host_deinit() = 0; - virtual int32_t graphics_get_display_size( const uint16_t display_number, uint32_t *width, uint32_t *height) = 0; -+ virtual int vc_tv_power_off() = 0; -+ virtual int vc_tv_sdtv_power_on(SDTV_MODE_T mode, SDTV_OPTIONS_T *options) = 0; -+ virtual int vc_tv_hdmi_power_on_preferred() = 0; - virtual int vc_tv_hdmi_power_on_best(uint32_t width, uint32_t height, uint32_t frame_rate, - HDMI_INTERLACED_T scan_mode, EDID_MODE_MATCH_FLAG_T match_flags) = 0; - virtual int vc_tv_hdmi_power_on_best_3d(uint32_t width, uint32_t height, uint32_t frame_rate, -@@ -92,6 +95,12 @@ class DllBcmHost : public DllDynamic, DllBcmHostInterface - { return ::bcm_host_deinit(); }; - virtual int32_t graphics_get_display_size( const uint16_t display_number, uint32_t *width, uint32_t *height) - { return ::graphics_get_display_size(display_number, width, height); }; -+ virtual int vc_tv_power_off() -+ { return ::vc_tv_power_off(); } -+ virtual int vc_tv_sdtv_power_on(SDTV_MODE_T mode, SDTV_OPTIONS_T *options) -+ { return ::vc_tv_sdtv_power_on(mode, options); } -+ virtual int vc_tv_hdmi_power_on_preferred() -+ { return ::vc_tv_hdmi_power_on_preferred(); } - virtual int vc_tv_hdmi_power_on_best(uint32_t width, uint32_t height, uint32_t frame_rate, - 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 1c09b17c3d8d8631708d0feaa2b03ac38451d23b Mon Sep 17 00:00:00 2001 -From: macrule -Date: Thu, 11 Apr 2013 18:29:03 +0200 -Subject: [PATCH 26/89] Added private utility function to map a float display - aspect, to the respective SDTV_ASPECT_* enum value. - ---- - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -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) - res.dwFlags & D3DPRESENTFLAG_MODE3DTB ? " 3DTB" : "", - res.dwFlags & D3DPRESENTFLAG_MODE3DSBS ? " 3DSBS" : ""); - } -+ -+static SDTV_ASPECT_T get_sdtv_aspect_from_display_aspect(float display_aspect) -+{ -+ SDTV_ASPECT_T aspect; -+ const float delta = 1e-3; -+ if(fabs(get_display_aspect_ratio(SDTV_ASPECT_16_9) - display_aspect) < delta) -+ { -+ aspect = SDTV_ASPECT_16_9; -+ } -+ else if(fabs(get_display_aspect_ratio(SDTV_ASPECT_14_9) - display_aspect) < delta) -+ { -+ aspect = SDTV_ASPECT_14_9; -+ } -+ else -+ { -+ aspect = SDTV_ASPECT_4_3; -+ } -+ return aspect; -+} - #endif - - bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &resolutions) - -From d339ba599375b756dbbe5e878519b3b02f19d8bd Mon Sep 17 00:00:00 2001 -From: macrule -Date: Thu, 11 Apr 2013 19:50:58 +0200 -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. - ---- - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 36 ++++++++++++++++++++----- - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.h | 1 - - 2 files changed, 29 insertions(+), 8 deletions(-) - -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -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) - - DestroyDispmaxWindow(); - -- if(!m_fixedMode && GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) -+ if(GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) - { - sem_init(&m_tv_synced, 0, 0); - m_DllBcmHost->vc_tv_register_callback(CallbackTvServiceCallback, this); -@@ -276,6 +276,33 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) - - m_desktopRes = res; - } -+ else if(!GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) -+ { -+ sem_init(&m_tv_synced, 0, 0); -+ m_DllBcmHost->vc_tv_register_callback(CallbackTvServiceCallback, this); -+ -+ SDTV_OPTIONS_T options; -+ options.aspect = get_sdtv_aspect_from_display_aspect((float)res.iScreenWidth / (float)res.iScreenHeight); -+ -+ int success = m_DllBcmHost->vc_tv_sdtv_power_on((SDTV_MODE_T)GETFLAGS_MODE(res.dwFlags), &options); -+ -+ if (success == 0) -+ { -+ CLog::Log(LOGDEBUG, "EGL set SDTV mode (%d,%d)=%d\n", -+ GETFLAGS_GROUP(res.dwFlags), GETFLAGS_MODE(res.dwFlags), success); -+ -+ sem_wait(&m_tv_synced); -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "EGL failed to set SDTV mode (%d,%d)=%d\n", -+ GETFLAGS_GROUP(res.dwFlags), GETFLAGS_MODE(res.dwFlags), success); -+ } -+ m_DllBcmHost->vc_tv_unregister_callback(CallbackTvServiceCallback); -+ sem_destroy(&m_tv_synced); -+ -+ m_desktopRes = res; -+ } - - m_dispman_display = g_RBP.OpenDisplay(0); - -@@ -441,8 +468,6 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r - if(!m_DllBcmHost) - return false; - -- m_fixedMode = false; -- - /* read initial desktop resolution before probe resolutions. - * probing will replace the desktop resolution when it finds the same one. - * we raplace it because probing will generate more detailed -@@ -491,7 +516,7 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r - m_desktopRes.iHeight = tv_state.display.sdtv.height; - m_desktopRes.iScreenWidth = tv_state.display.sdtv.width; - m_desktopRes.iScreenHeight= tv_state.display.sdtv.height; -- m_desktopRes.dwFlags = D3DPRESENTFLAG_INTERLACED; -+ m_desktopRes.dwFlags = MAKEFLAGS(HDMI_RES_GROUP_INVALID, tv_state.display.sdtv.mode, 1); - m_desktopRes.fRefreshRate = (float)tv_state.display.sdtv.frame_rate; - m_desktopRes.fPixelRatio = tv_state.display.hdmi.display_options.aspect == 0 ? 1.0f : get_display_aspect_ratio((SDTV_ASPECT_T)tv_state.display.sdtv.display_options.aspect) / ((float)m_desktopRes.iScreenWidth / (float)m_desktopRes.iScreenHeight); - } -@@ -514,9 +539,6 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r - CLog::Log(LOGDEBUG, "EGL probe resolution %s:%x\n", m_desktopRes.strMode.c_str(), m_desktopRes.dwFlags); - } - -- if(resolutions.size() < 2) -- m_fixedMode = true; -- - DLOG("CEGLNativeTypeRaspberryPI::ProbeResolutions\n"); - return true; - #else -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.h b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.h -index 59401f5..a0acb1a 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.h -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.h -@@ -59,7 +59,6 @@ class CEGLNativeTypeRaspberryPI : public CEGLNativeType - DISPMANX_ELEMENT_HANDLE_T m_dispman_element; - TV_GET_STATE_RESP_T m_tv_state; - sem_t m_tv_synced; -- bool m_fixedMode; - RESOLUTION_INFO m_desktopRes; - int m_width; - int m_height; - -From 8ebee675392f628fd18e803d549f69fcac428f01 Mon Sep 17 00:00:00 2001 -From: macrule -Date: Thu, 11 Apr 2013 19:54:59 +0200 -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. - ---- - xbmc/linux/RBP.cpp | 13 +++++++++++++ - xbmc/linux/RBP.h | 3 +++ - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 3 +++ - 3 files changed, 19 insertions(+) - -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index a4b0c2a..160eb96 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -233,5 +233,18 @@ double CRBP::AdjustHDMIClock(double adjust) - return new_adjust; - } - -+void CRBP::SuspendVideoOutput() -+{ -+ CLog::Log(LOGDEBUG, "Raspberry PI suspending video output\n"); -+ char response[80]; -+ m_DllBcmHost->vc_gencmd(response, sizeof response, "display_power 0"); -+} -+ -+void CRBP::ResumeVideoOutput() -+{ -+ char response[80]; -+ m_DllBcmHost->vc_gencmd(response, sizeof response, "display_power 1"); -+ CLog::Log(LOGDEBUG, "Raspberry PI resuming video output\n"); -+} - - #endif -diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index 65492fa..38fb252 100644 ---- a/xbmc/linux/RBP.h -+++ b/xbmc/linux/RBP.h -@@ -65,6 +65,9 @@ class CRBP - void WaitVsync(); - double AdjustHDMIClock(double adjust); - -+ void SuspendVideoOutput(); -+ void ResumeVideoOutput(); -+ - private: - DllBcmHost *m_DllBcmHost; - bool m_initialized; -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 4826d37..7d9b0d3 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -60,7 +60,10 @@ - # define DLOG(fmt, args...) - #endif - -+#if defined(TARGET_RASPBERRY_PI) - static void SetResolutionString(RESOLUTION_INFO &res); -+static SDTV_ASPECT_T get_sdtv_aspect_from_display_aspect(float display_aspect); -+#endif - - CEGLNativeTypeRaspberryPI::CEGLNativeTypeRaspberryPI() - { - -From 0739fee7877f4856d12321465b2b9744de086b46 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 11 Aug 2013 15:03:36 +0100 -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 - - xbmc/input/InputManager.cpp | 8 ++++++++ - xbmc/powermanagement/IPowerSyscall.h | 7 +++++++ - xbmc/powermanagement/PowerManager.cpp | 6 ++++++ - xbmc/powermanagement/PowerManager.h | 3 +++ - 5 files changed, 24 insertions(+), 1 deletion(-) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 135b466..df6e8ca 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -2043,7 +2043,6 @@ void CApplication::SetStandAlone(bool value) - g_advancedSettings.m_handleMounting = m_bStandalone = value; - } - -- - // OnAppCommand is called in response to a XBMC_APPCOMMAND event. - // This needs to return true if it processed the appcommand or false if it didn't - bool CApplication::OnAppCommand(const CAction &action) -diff --git a/xbmc/input/InputManager.cpp b/xbmc/input/InputManager.cpp -index c6f62d8db0..f90fa89 100644 ---- a/xbmc/input/InputManager.cpp -+++ b/xbmc/input/InputManager.cpp -@@ -30,6 +30,7 @@ - #include "guilib/GUIWindow.h" - #include "guilib/GUIWindowManager.h" - #include "guilib/GUIMessage.h" -+#include "powermanagement/PowerManager.h" - - #ifdef HAS_EVENT_SERVER - #include "network/EventServer.h" -@@ -524,6 +525,13 @@ bool CInputManager::OnKey(const CKey& key) - // special handling if the screensaver is active - CAction action = CButtonTranslator::GetInstance().GetAction(iWin, key); - -+ // give the PowerManager a chance to process a keypress, and -+ // suppress further processing. we need this for virtual sleep. -+ if (g_powerManager.ProcessAction(action)) -+ { -+ return true; -+ } -+ - // a key has been pressed. - // reset Idle Timer - g_application.ResetSystemIdleTimer(); -diff --git a/xbmc/powermanagement/IPowerSyscall.h b/xbmc/powermanagement/IPowerSyscall.h -index 7f9e7ed..711abea 100644 ---- a/xbmc/powermanagement/IPowerSyscall.h -+++ b/xbmc/powermanagement/IPowerSyscall.h -@@ -20,6 +20,9 @@ - * - */ - -+// forward declaration -+class CAction; -+ - class IPowerEventsCallback - { - public: -@@ -60,6 +63,10 @@ class IPowerSyscall - \param callback the callback to signal to - */ - virtual bool PumpPowerEvents(IPowerEventsCallback *callback) = 0; -+ -+ // this is an optional part of the interface, so we provide a no-op implementation here. -+ // return true to suppress further processing of the CAction. -+ virtual bool ProcessAction(const CAction& action) { return false; } - }; - - class CPowerSyscallWithoutEvents : public IPowerSyscall -diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp -index 5900f98..6e819d9 100644 ---- a/xbmc/powermanagement/PowerManager.cpp -+++ b/xbmc/powermanagement/PowerManager.cpp -@@ -225,6 +225,12 @@ void CPowerManager::ProcessEvents() - nesting--; - } - -+bool CPowerManager::ProcessAction(const CAction& action) -+{ -+ return m_instance->ProcessAction(action); -+} -+ -+ - void CPowerManager::OnSleep() - { - CAnnouncementManager::Get().Announce(System, "xbmc", "OnSleep"); -diff --git a/xbmc/powermanagement/PowerManager.h b/xbmc/powermanagement/PowerManager.h -index 0b1f10a..e42b143 100644 ---- a/xbmc/powermanagement/PowerManager.h -+++ b/xbmc/powermanagement/PowerManager.h -@@ -58,6 +58,8 @@ class CNullPowerSyscall : public IPowerSyscall - - - virtual bool PumpPowerEvents(IPowerEventsCallback *callback) { return false; } -+ -+ virtual bool ProcessAction(const CAction& action) { return false; } - }; - - // This class will wrap and handle PowerSyscalls. -@@ -87,6 +89,7 @@ class CPowerManager : public IPowerEventsCallback - - static void SettingOptionsShutdownStatesFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t, void *data); - -+ bool ProcessAction(const CAction& action); - private: - void OnSleep(); - void OnWake(); - -From 94a8bac3feaeed3edd78e9e49f209b92ef5c87f9 Mon Sep 17 00:00:00 2001 -From: macrule -Date: Wed, 17 Apr 2013 13:23:01 +0200 -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 + - xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 84 +++++++++++++++++++++++ - xbmc/powermanagement/PowerSyscallVirtualSleep.h | 56 +++++++++++++++ - 3 files changed, 141 insertions(+) - create mode 100644 xbmc/powermanagement/PowerSyscallVirtualSleep.cpp - create mode 100644 xbmc/powermanagement/PowerSyscallVirtualSleep.h - -diff --git a/xbmc/powermanagement/Makefile b/xbmc/powermanagement/Makefile -index 0b4c029..16056af 100644 ---- a/xbmc/powermanagement/Makefile -+++ b/xbmc/powermanagement/Makefile -@@ -1,5 +1,6 @@ - SRCS=DPMSSupport.cpp \ - PowerManager.cpp \ -+ PowerSyscallVirtualSleep.cpp \ - - LIB=powermanagement.a - -diff --git a/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp b/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -new file mode 100644 -index 0000000..9e6c8e4 ---- /dev/null -+++ b/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -@@ -0,0 +1,84 @@ -+/* -+ * Copyright (C) 2013 Team XBMC -+ * http://www.xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#include "PowerSyscallVirtualSleep.h" -+#include "input/Key.h" -+#include "utils/log.h" -+#include "utils/StringUtils.h" -+ -+bool CPowerSyscallVirtualSleep::Suspend() -+{ -+ if (m_virtualSleepState == VIRTUAL_SLEEP_STATE_AWAKE) -+ { -+ if (VirtualSleep()) -+ { -+ m_virtualSleepState = VIRTUAL_SLEEP_STATE_WILL_SLEEP; -+ return true; -+ } -+ } -+ -+ return false; -+} -+ -+bool CPowerSyscallVirtualSleep::PumpPowerEvents(IPowerEventsCallback *callback) -+{ -+ if (m_virtualSleepState == VIRTUAL_SLEEP_STATE_WILL_WAKE) -+ { -+ callback->OnWake(); -+ m_virtualSleepState = VIRTUAL_SLEEP_STATE_AWAKE; -+ return true; -+ } -+ else if (m_virtualSleepState == VIRTUAL_SLEEP_STATE_WILL_SLEEP) -+ { -+ callback->OnSleep(); -+ m_virtualSleepState = VIRTUAL_SLEEP_STATE_ASLEEP; -+ return true; -+ } -+ -+ return false; -+} -+ -+bool CPowerSyscallVirtualSleep::ProcessAction(const CAction& action) -+{ -+ if (m_virtualSleepState != VIRTUAL_SLEEP_STATE_ASLEEP) -+ return false; -+ -+ // device is in virtual sleep, only one of the power keys will -+ // wake it up again. -+ if (action.GetID() == ACTION_BUILT_IN_FUNCTION) -+ { -+ std::string name = action.GetName(); -+ StringUtils::ToLower(name); -+ if(name.Equals("xbmc.suspend()") || -+ name.Equals("shutdown") || -+ name.Equals("suspend") || -+ name.Equals("hibernate")) -+ { -+ if(VirtualWake()) -+ { -+ m_virtualSleepState = VIRTUAL_SLEEP_STATE_WILL_WAKE; -+ return false; -+ } -+ } -+ } -+ -+ // wasn't a power key, suppress this and stay asleep -+ return true; -+} -diff --git a/xbmc/powermanagement/PowerSyscallVirtualSleep.h b/xbmc/powermanagement/PowerSyscallVirtualSleep.h -new file mode 100644 -index 0000000..ef6e682 ---- /dev/null -+++ b/xbmc/powermanagement/PowerSyscallVirtualSleep.h -@@ -0,0 +1,56 @@ -+/* -+ * Copyright (C) 2013 Team XBMC -+ * http://www.xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#ifndef _POWER_SYSCALL_VIRTUAL_SLEEP_H_ -+#define _POWER_SYSCALL_VIRTUAL_SLEEP_H_ -+#include "IPowerSyscall.h" -+ -+// Systems that have no native standby mode, can base their -+// IPowerSyscall implementation on this class, and need only -+// implement VirtualSleep()/VirtualWake(). -+class CPowerSyscallVirtualSleep : public IPowerSyscall -+{ -+public: -+ CPowerSyscallVirtualSleep() : m_virtualSleepState(VIRTUAL_SLEEP_STATE_AWAKE) {} -+ virtual ~CPowerSyscallVirtualSleep() {} -+ -+ virtual bool CanSuspend() { return true; } -+ virtual bool Suspend(); -+ -+ virtual bool PumpPowerEvents(IPowerEventsCallback *callback); -+ -+ virtual bool ProcessAction(const CAction& action); -+ -+ virtual bool VirtualSleep() = 0; -+ virtual bool VirtualWake() = 0; -+ -+protected: -+ // keep track of virtual sleep state for devices that support it -+ typedef enum { -+ VIRTUAL_SLEEP_STATE_AWAKE = 0, -+ VIRTUAL_SLEEP_STATE_ASLEEP, -+ VIRTUAL_SLEEP_STATE_WILL_WAKE, -+ VIRTUAL_SLEEP_STATE_WILL_SLEEP, -+ } VirtualSleepState; -+ -+ VirtualSleepState m_virtualSleepState; -+}; -+ -+#endif // _POWER_SYSCALL_VIRTUAL_SLEEP_H_ - -From 4e72dbc0c34cd319b3168551ee14ebc6ea78739c Mon Sep 17 00:00:00 2001 -From: macrule -Date: Wed, 17 Apr 2013 13:24:22 +0200 -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. - ---- - xbmc/powermanagement/PowerManager.cpp | 4 ++ - xbmc/powermanagement/linux/Makefile | 1 + - .../linux/RaspberryPIPowerSyscall.cpp | 38 +++++++++++++++++ - .../linux/RaspberryPIPowerSyscall.h | 49 ++++++++++++++++++++++ - 4 files changed, 92 insertions(+) - create mode 100644 xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp - create mode 100644 xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h - -diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp -index 6e819d9..2d8c750 100644 ---- a/xbmc/powermanagement/PowerManager.cpp -+++ b/xbmc/powermanagement/PowerManager.cpp -@@ -38,6 +38,8 @@ - - #if defined(TARGET_DARWIN) - #include "osx/CocoaPowerSyscall.h" -+#elif defined(TARGET_RASPBERRY_PI) -+#include "linux/RaspberryPIPowerSyscall.h" - #elif defined(TARGET_ANDROID) - #include "android/AndroidPowerSyscall.h" - #elif defined(TARGET_POSIX) -@@ -71,6 +73,8 @@ void CPowerManager::Initialize() - { - #if defined(TARGET_DARWIN) - m_instance = new CCocoaPowerSyscall(); -+#elif defined(TARGET_RASPBERRY_PI) -+ m_instance = new CRaspberryPIPowerSyscall(); - #elif defined(TARGET_ANDROID) - m_instance = new CAndroidPowerSyscall(); - #elif defined(TARGET_POSIX) -diff --git a/xbmc/powermanagement/linux/Makefile b/xbmc/powermanagement/linux/Makefile -index e9d95fb..b130812 100644 ---- a/xbmc/powermanagement/linux/Makefile -+++ b/xbmc/powermanagement/linux/Makefile -@@ -1,5 +1,6 @@ - SRCS=ConsoleDeviceKitPowerSyscall.cpp \ - ConsoleUPowerSyscall.cpp \ -+ RaspberryPIPowerSyscall.cpp \ - UPowerSyscall.cpp \ - LogindUPowerSyscall.cpp - -diff --git a/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp -new file mode 100644 -index 0000000..10deeb8 ---- /dev/null -+++ b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp -@@ -0,0 +1,38 @@ -+/* -+ * Copyright (C) 2013 Team XBMC -+ * http://www.xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#if defined(TARGET_RASPBERRY_PI) -+ -+#include "RaspberryPIPowerSyscall.h" -+#include "RBP.h" -+ -+bool CRaspberryPIPowerSyscall::VirtualSleep() -+{ -+ g_RBP.SuspendVideoOutput(); -+ return true; -+} -+ -+bool CRaspberryPIPowerSyscall::VirtualWake() -+{ -+ g_RBP.ResumeVideoOutput(); -+ return true; -+} -+ -+#endif -diff --git a/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h -new file mode 100644 -index 0000000..fd1d67c ---- /dev/null -+++ b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h -@@ -0,0 +1,49 @@ -+#pragma once -+/* -+ * Copyright (C) 2013 Team XBMC -+ * http://www.xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#ifndef _RASPBERRY_PI_POWER_SYSCALL_H_ -+#define _RASPBERRY_PI_POWER_SYSCALL_H_ -+ -+#if defined(TARGET_RASPBERRY_PI) -+#include "powermanagement/PowerSyscallVirtualSleep.h" -+ -+class CRaspberryPIPowerSyscall : public CPowerSyscallVirtualSleep -+{ -+public: -+ CRaspberryPIPowerSyscall() : CPowerSyscallVirtualSleep() {} -+ virtual ~CRaspberryPIPowerSyscall() {} -+ -+ virtual bool Powerdown() { return false; } -+ virtual bool Hibernate() { return false; } -+ virtual bool Reboot() { return false; } -+ -+ virtual bool CanPowerdown() { return false; } -+ virtual bool CanHibernate() { return false; } -+ virtual bool CanReboot() { return true; } -+ -+ virtual int BatteryLevel() { return 0; } -+ -+ virtual bool VirtualSleep(); -+ virtual bool VirtualWake(); -+}; -+#endif // TARGET_RASPBERRY_PI -+ -+#endif // _RASPBERRY_PI_POWER_SYSCALL_H_ - -From 1e00d7bc6e5e193d12b3224d6801fb1dc8bf3b61 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Mar 2014 16:16:29 +0000 -Subject: [PATCH 32/89] [power] hack - don't kill lirc or cec - ---- - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 37 +++++++++++++++++++++++ - xbmc/powermanagement/PowerManager.cpp | 4 +-- - 2 files changed, 39 insertions(+), 2 deletions(-) - -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index 3d0c07d..ae5583d 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -186,12 +186,49 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender, - } - else if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnSleep")) - { -+#if 1 -+ bool bSendStandbyCommands(false); -+ { -+ CSingleLock lock(m_critSection); -+ bSendStandbyCommands = m_iExitCode != EXITCODE_REBOOT && -+ m_iExitCode != EXITCODE_RESTARTAPP && -+ !m_bDeviceRemoved && -+ (!m_bGoingToStandby || GetSettingBool("standby_tv_on_pc_standby")) && -+ GetSettingBool("enabled"); -+ -+ if (m_bGoingToStandby) -+ m_bActiveSourceBeforeStandby = m_cecAdapter->IsLibCECActiveSource(); -+ } -+ -+ if (bSendStandbyCommands) -+ { -+ if (m_cecAdapter->IsLibCECActiveSource()) -+ { -+ if (!m_configuration.powerOffDevices.IsEmpty()) -+ { -+ CLog::Log(LOGDEBUG, "%s - sending standby commands", __FUNCTION__); -+ m_standbySent = CDateTime::GetCurrentDateTime(); -+ m_cecAdapter->StandbyDevices(); -+ } -+ else if (m_configuration.bSendInactiveSource == 1) -+ { -+ CLog::Log(LOGDEBUG, "%s - sending inactive source commands", __FUNCTION__); -+ m_cecAdapter->SetInactiveView(); -+ } -+ } -+ else -+ { -+ CLog::Log(LOGDEBUG, "%s - XBMC is not the active source, not sending any standby commands", __FUNCTION__); -+ } -+ } -+#else - // this will also power off devices when we're the active source - { - CSingleLock lock(m_critSection); - m_bGoingToStandby = true; - } - StopThread(); -+#endif - } - else if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnWake")) - { -diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp -index 2d8c750..901f449 100644 ---- a/xbmc/powermanagement/PowerManager.cpp -+++ b/xbmc/powermanagement/PowerManager.cpp -@@ -241,7 +241,7 @@ void CPowerManager::OnSleep() - CLog::Log(LOGNOTICE, "%s: Running sleep jobs", __FUNCTION__); - - // stop lirc --#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) -+#if 0 //defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - CLog::Log(LOGNOTICE, "%s: Stopping lirc", __FUNCTION__); - CBuiltins::Execute("LIRC.Stop"); - #endif -@@ -277,7 +277,7 @@ void CPowerManager::OnWake() - #endif - - // restart lirc --#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) -+#if 0 // defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - CLog::Log(LOGNOTICE, "%s: Restarting lirc", __FUNCTION__); - CBuiltins::Execute("LIRC.Start"); - #endif - -From ca8103aa0469ee82fe6da538e2d19cf33cabfc2c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Mar 2014 16:47:54 +0000 -Subject: [PATCH 33/89] [power] hack - wake on any action - ---- - xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp b/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -index 9e6c8e4..78566ec 100644 ---- a/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -+++ b/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -@@ -62,14 +62,14 @@ bool CPowerSyscallVirtualSleep::ProcessAction(const CAction& action) - - // device is in virtual sleep, only one of the power keys will - // wake it up again. -- if (action.GetID() == ACTION_BUILT_IN_FUNCTION) -+ //if (action.GetID() == ACTION_BUILT_IN_FUNCTION) - { - std::string name = action.GetName(); - StringUtils::ToLower(name); -- if(name.Equals("xbmc.suspend()") || -+ /*if(name.Equals("system.suspend") || - name.Equals("shutdown") || - name.Equals("suspend") || -- name.Equals("hibernate")) -+ name.Equals("hibernate"))*/ - { - if(VirtualWake()) - { - -From 2db6f609de8998c2db449d0471699e02c6a6f46c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Mar 2014 17:30:07 +0000 -Subject: [PATCH 34/89] [power] hack - Make suspend toggle suspend state - ---- - xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp b/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -index 78566ec..4cffcce 100644 ---- a/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -+++ b/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -@@ -33,6 +33,11 @@ bool CPowerSyscallVirtualSleep::Suspend() - return true; - } - } -+ else if (VirtualWake()) -+ { -+ m_virtualSleepState = VIRTUAL_SLEEP_STATE_WILL_WAKE; -+ return false; -+ } - - return false; - } - -From c42ebe26c18468fb40569e4f5b0eb387ac835670 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 4 Mar 2014 19:33:44 +0000 -Subject: [PATCH 35/89] [power] Add back in powerdown and reboot - ---- - .../linux/RaspberryPIPowerSyscall.cpp | 34 ++++++++++++++++++++++ - .../linux/RaspberryPIPowerSyscall.h | 6 ++-- - 2 files changed, 37 insertions(+), 3 deletions(-) - -diff --git a/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp -index 10deeb8..220bca9 100644 ---- a/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp -+++ b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp -@@ -20,7 +20,11 @@ - - #if defined(TARGET_RASPBERRY_PI) - -+#include "system.h" - #include "RaspberryPIPowerSyscall.h" -+#if defined(HAS_DBUS) -+#include "LogindUPowerSyscall.h" -+#endif - #include "RBP.h" - - bool CRaspberryPIPowerSyscall::VirtualSleep() -@@ -35,4 +39,34 @@ bool CRaspberryPIPowerSyscall::VirtualWake() - return true; - } - -+bool CRaspberryPIPowerSyscall::Powerdown() -+{ -+ int s = false; -+#if defined(HAS_DBUS) -+ if (CLogindUPowerSyscall::HasLogind()) -+ { -+ IPowerSyscall *m_instance = new CLogindUPowerSyscall; -+ if (m_instance->CanPowerdown()) -+ s = m_instance->Powerdown(); -+ delete m_instance; -+ } -+#endif -+ return s; -+} -+ -+bool CRaspberryPIPowerSyscall::Reboot() -+{ -+ int s = false; -+#if defined(HAS_DBUS) -+ if (CLogindUPowerSyscall::HasLogind()) -+ { -+ IPowerSyscall *m_instance = new CLogindUPowerSyscall; -+ if (m_instance->CanReboot()) -+ s = m_instance->Reboot(); -+ delete m_instance; -+ } -+#endif -+ return s; -+} -+ - #endif -diff --git a/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h -index fd1d67c..062132e 100644 ---- a/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h -+++ b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h -@@ -31,11 +31,11 @@ class CRaspberryPIPowerSyscall : public CPowerSyscallVirtualSleep - CRaspberryPIPowerSyscall() : CPowerSyscallVirtualSleep() {} - virtual ~CRaspberryPIPowerSyscall() {} - -- virtual bool Powerdown() { return false; } -+ virtual bool Powerdown(); - virtual bool Hibernate() { return false; } -- virtual bool Reboot() { return false; } -+ virtual bool Reboot(); - -- virtual bool CanPowerdown() { return false; } -+ virtual bool CanPowerdown() { return true; } - virtual bool CanHibernate() { return false; } - virtual bool CanReboot() { return true; } - - -From 21ff1d4748a4297716e53e78b347cf0f1c60ff4c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 26 Apr 2014 17:27:52 +0100 -Subject: [PATCH 36/89] [cec] Don't suspend pi on tv switch off - it can't wake - up - ---- - system/peripherals.xml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/system/peripherals.xml b/system/peripherals.xml -index 094a3c1..0b89ee8 100644 ---- a/system/peripherals.xml -+++ b/system/peripherals.xml -@@ -16,7 +16,7 @@ - - - -- -+ - - - - -From 2697d6cb2ff2bbbb7be8fd40370e654c227a1b86 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 27 Jun 2014 00:01:05 +0100 -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 160eb96..1472d10 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -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; - -+ // in case xbcm was restarted when suspended -+ ResumeVideoOutput(); -+ - g_OMXImage.Initialize(); - m_omx_image_init = true; - return true; - -From 266a5a51a12a418f95c2c366e147e0c5e9c6eaee Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 11 Apr 2014 16:12:27 +0100 -Subject: [PATCH 38/89] [omxplayer] Add ability to log more timestamp info in - extra debug settings - ---- - addons/resource.language.en_gb/resources/strings.po | 5 +++++ - xbmc/commons/ilog.h | 1 + - xbmc/cores/omxplayer/OMXHelper.cpp | 12 +++++++----- - xbmc/cores/omxplayer/OMXPlayerAudio.cpp | 8 ++++---- - xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 9 +++++---- - xbmc/settings/AdvancedSettings.cpp | 3 +++ - 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 804e295..1b70492 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2915,6 +2915,11 @@ msgctxt "#680" - msgid "Verbose logging for VIDEO component" - msgstr "" - -+#: xbmc/settings/AdvancedSettings.cpp -+msgctxt "#697" -+msgid "Verbose logging for OMXPLAYER" -+msgstr "" -+ - #empty strings from id 681 to 699 - - msgctxt "#700" -diff --git a/xbmc/commons/ilog.h b/xbmc/commons/ilog.h -index de90359..e4ffb5e 100644 ---- a/xbmc/commons/ilog.h -+++ b/xbmc/commons/ilog.h -@@ -53,6 +53,7 @@ - #define LOGUPNP (1 << (LOGMASKBIT + 8)) - #define LOGCEC (1 << (LOGMASKBIT + 9)) - #define LOGVIDEO (1 << (LOGMASKBIT + 10)) -+#define LOGOMXPLAYER (1 << (LOGMASKBIT + 16)) - - #include "utils/params_check_macros.h" - -diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp -index be54f31..9739ed0 100644 ---- a/xbmc/cores/omxplayer/OMXHelper.cpp -+++ b/xbmc/cores/omxplayer/OMXHelper.cpp -@@ -23,6 +23,7 @@ - #ifdef HAS_OMXPLAYER - - #include "DVDPlayer.h" -+#include "settings/AdvancedSettings.h" - #include "settings/Settings.h" - #include "settings/MediaSettings.h" - #include "DVDInputStreams/DVDInputStream.h" -@@ -140,7 +141,8 @@ bool OMXDoProcessing(struct SOmxPlayerState &m_OmxPlayerState, int m_playSpeed, - m_OmxPlayerState.video_fifo = (int)(100.0*(m_dvdPlayerVideo->GetDecoderBufferSize()-m_dvdPlayerVideo->GetDecoderFreeSpace())/m_dvdPlayerVideo->GetDecoderBufferSize()); - m_OmxPlayerState.audio_fifo = (int)(100.0*audio_fifo/m_dvdPlayerAudio->GetCacheTotal()); - -- #ifdef _DEBUG -+ if (g_advancedSettings.CanLogComponent(LOGOMXPLAYER)) -+ { - static unsigned count; - if ((count++ & 7) == 0) - { -@@ -160,7 +162,7 @@ bool OMXDoProcessing(struct SOmxPlayerState &m_OmxPlayerState, int m_playSpeed, - vc_gencmd(response, sizeof response, "render_bar 7 audio_queue %d %d %d %d", - m_dvdPlayerAudio->GetLevel(), 0, 0, 100); - } -- #endif -+ } - if (audio_pts != DVD_NOPTS_VALUE) - { - audio_fifo_low = m_HasAudio && audio_fifo < threshold; -@@ -176,15 +178,15 @@ bool OMXDoProcessing(struct SOmxPlayerState &m_OmxPlayerState, int m_playSpeed, - if (!m_HasVideo && m_HasAudio) - video_fifo_high = true; - -- #ifdef _DEBUG -+ if (g_advancedSettings.CanLogComponent(LOGOMXPLAYER)) -+ { - CLog::Log(LOGDEBUG, "%s::%s M:%.6f-%.6f (A:%.6f V:%.6f) PEF:%d%d%d S:%.2f A:%.2f V:%.2f/T:%.2f (A:%d%d V:%d%d) A:%d%% V:%d%% (%.2f,%.2f)", "CDVDPlayer", __FUNCTION__, - m_OmxPlayerState.stamp*1e-6, m_OmxPlayerState.av_clock.OMXClockAdjustment()*1e-6, audio_pts*1e-6, video_pts*1e-6, - m_OmxPlayerState.av_clock.OMXIsPaused(), m_OmxPlayerState.bOmxSentEOFs, not_accepts_data, m_playSpeed * (1.0f/DVD_PLAYSPEED_NORMAL), - audio_pts == DVD_NOPTS_VALUE ? 0.0:audio_fifo, video_pts == DVD_NOPTS_VALUE ? 0.0:video_fifo, m_OmxPlayerState.threshold, - audio_fifo_low, audio_fifo_high, video_fifo_low, video_fifo_high, - m_dvdPlayerAudio->GetLevel(), m_dvdPlayerVideo->GetLevel(), m_dvdPlayerAudio->GetDelay(), (float)m_dvdPlayerAudio->GetCacheTotal()); -- #endif -- -+ } - if(!m_Pause && (m_OmxPlayerState.bOmxSentEOFs || not_accepts_data || (audio_fifo_high && video_fifo_high) || m_playSpeed != DVD_PLAYSPEED_NORMAL)) - { - if (m_OmxPlayerState.av_clock.OMXIsPaused()) -diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -index c2da2d2..2f1df45 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -@@ -366,10 +366,10 @@ void OMXPlayerAudio::Process() - DemuxPacket* pPacket = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacket(); - bool bPacketDrop = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacketDrop(); - -- #ifdef _DEBUG -- CLog::Log(LOGINFO, "Audio: dts:%.0f pts:%.0f size:%d (s:%d f:%d d:%d l:%d) s:%d %d/%d late:%d,%d", pPacket->dts, pPacket->pts, -- (int)pPacket->iSize, m_started, m_flush, bPacketDrop, m_stalled, m_speed, 0, 0, (int)m_omxAudio.GetAudioRenderingLatency(), (int)m_hints_current.samplerate); -- #endif -+ if (g_advancedSettings.CanLogComponent(LOGOMXPLAYER)) -+ CLog::Log(LOGINFO, "Audio: dts:%.0f pts:%.0f size:%d (s:%d f:%d d:%d l:%d) s:%d %d/%d late:%d,%d", pPacket->dts, pPacket->pts, -+ (int)pPacket->iSize, m_started, m_flush, bPacketDrop, m_stalled, m_speed, 0, 0, (int)m_omxAudio.GetAudioRenderingLatency(), (int)m_hints_current.samplerate); -+ - if(Decode(pPacket, m_speed > DVD_PLAYSPEED_NORMAL || m_speed < 0 || bPacketDrop)) - { - // 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 5ca7665..8becff1 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -42,6 +42,7 @@ - #include "DVDOverlayRenderer.h" - #include "settings/DisplaySettings.h" - #include "settings/Settings.h" -+#include "settings/AdvancedSettings.h" - #include "settings/MediaSettings.h" - #include "cores/VideoRenderers/RenderFormats.h" - #include "cores/VideoRenderers/RenderFlags.h" -@@ -461,10 +462,10 @@ void OMXPlayerVideo::Process() - DemuxPacket* pPacket = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacket(); - bool bPacketDrop = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacketDrop(); - -- #ifdef _DEBUG -- CLog::Log(LOGINFO, "Video: dts:%.0f pts:%.0f size:%d (s:%d f:%d d:%d l:%d) s:%d %d/%d late:%d\n", pPacket->dts, pPacket->pts, -- (int)pPacket->iSize, m_started, m_flush, bPacketDrop, m_stalled, m_speed, 0, 0, 0); -- #endif -+ if (g_advancedSettings.CanLogComponent(LOGOMXPLAYER)) -+ CLog::Log(LOGINFO, "Video: dts:%.0f pts:%.0f size:%d (s:%d f:%d d:%d l:%d) s:%d %d/%d late:%d\n", pPacket->dts, pPacket->pts, -+ (int)pPacket->iSize, m_started, m_flush, bPacketDrop, m_stalled, m_speed, 0, 0, 0); -+ - if (m_messageQueue.GetDataSize() == 0 - || m_speed < 0) - { -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 76b5ce8..139e12d 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1364,6 +1364,9 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se - #ifdef HAVE_LIBCEC - list.push_back(std::make_pair(g_localizeStrings.Get(679), LOGCEC)); - #endif -+#ifdef TARGET_RASPBERRY_PI -+ list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); -+#endif - } - - void CAdvancedSettings::setExtraLogLevel(const std::vector &components) - -From ba20c596cce9f4e3e6112921182a25c899847c7d Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 39/89] [omxplayer] Add ability to dump out audio/video data - for later debugging - ---- - .../resource.language.en_gb/resources/strings.po | 10 +++++ - xbmc/commons/ilog.h | 2 + - xbmc/cores/omxplayer/OMXAudio.cpp | 49 ++++++++++++++++++++++ - xbmc/cores/omxplayer/OMXVideo.cpp | 47 +++++++++++++++++++++ - xbmc/settings/AdvancedSettings.cpp | 4 ++ - 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 1b70492..19b94b5 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2920,6 +2920,16 @@ msgctxt "#697" - msgid "Verbose logging for OMXPLAYER" - msgstr "" - -+#: xbmc/settings/AdvancedSettings.cpp -+msgctxt "#698" -+msgid "Dump video frames to debug file" -+msgstr "" -+ -+#: xbmc/settings/AdvancedSettings.cpp -+msgctxt "#699" -+msgid "Dump audio frames to debug file" -+msgstr "" -+ - #empty strings from id 681 to 699 - - msgctxt "#700" -diff --git a/xbmc/commons/ilog.h b/xbmc/commons/ilog.h -index e4ffb5e..4f8926c 100644 ---- a/xbmc/commons/ilog.h -+++ b/xbmc/commons/ilog.h -@@ -54,6 +54,8 @@ - #define LOGCEC (1 << (LOGMASKBIT + 9)) - #define LOGVIDEO (1 << (LOGMASKBIT + 10)) - #define LOGOMXPLAYER (1 << (LOGMASKBIT + 16)) -+#define LOGDUMPVIDEO (1 << (LOGMASKBIT + 17)) -+#define LOGDUMPAUDIO (1 << (LOGMASKBIT + 18)) - - #include "utils/params_check_macros.h" - -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 1911189..6dff6aa 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -56,6 +56,49 @@ using namespace std; - #define AUDIO_DECODE_OUTPUT_BUFFER (32*1024) - static const char rounded_up_channels_shift[] = {0,0,1,2,2,3,3,3,3}; - -+//#define DEBUG_PLAYBACK -+static void dump_omx_buffer(OMX_BUFFERHEADERTYPE *omx_buffer) -+{ -+ if (!(g_advancedSettings.CanLogComponent(LOGDUMPAUDIO))) -+ return; -+ static FILE *fp; -+ if (!omx_buffer) -+ { -+ if (fp) -+ { -+ fclose(fp); -+ fp = NULL; -+ } -+ return; -+ } -+ if (!fp) -+ { -+ char filename[1024]; -+ strcpy(filename, g_advancedSettings.m_logFolder.c_str()); -+ strcat(filename, "audio.dat"); -+#ifdef DEBUG_PLAYBACK -+ fp = fopen(filename, "rb"); -+#else -+ fp = fopen(filename, "wb"); -+#endif -+ } -+ if (fp) -+ { -+#ifdef DEBUG_PLAYBACK -+ OMX_BUFFERHEADERTYPE omx = {0}; -+ int s = fread(&omx, sizeof omx, 1, fp); -+ omx_buffer->nFilledLen = omx.nFilledLen; -+ omx_buffer->nFlags = omx.nFlags; -+ omx_buffer->nTimeStamp = omx.nTimeStamp; -+ if (s==1) -+ fread(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); -+#else -+ if (fwrite(omx_buffer, sizeof *omx_buffer, 1, fp) == 1) -+ fwrite(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); -+#endif -+ } -+} -+ - ////////////////////////////////////////////////////////////////////// - // Construction/Destruction - ////////////////////////////////////////////////////////////////////// -@@ -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; - -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -@@ -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; - -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -@@ -936,6 +981,8 @@ bool COMXAudio::Deinitialize() - { - CSingleLock lock (m_critSection); - -+ dump_omx_buffer(NULL); -+ - if ( m_omx_tunnel_clock_analog.IsInitialized() ) - m_omx_tunnel_clock_analog.Deestablish(); - if ( m_omx_tunnel_clock_hdmi.IsInitialized() ) -@@ -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) - { -@@ -1461,6 +1509,7 @@ void COMXAudio::SubmitEOS() - - omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; - -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index ca40a37..0fb426c 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -65,6 +65,49 @@ - - #define MAX_TEXT_LENGTH 1024 - -+//#define DEBUG_PLAYBACK -+static void dump_omx_buffer(OMX_BUFFERHEADERTYPE *omx_buffer) -+{ -+ if (!(g_advancedSettings.CanLogComponent(LOGDUMPVIDEO))) -+ return; -+ static FILE *fp; -+ if (!omx_buffer) -+ { -+ if (fp) -+ { -+ fclose(fp); -+ fp = NULL; -+ } -+ return; -+ } -+ if (!fp) -+ { -+ char filename[1024]; -+ strcpy(filename, g_advancedSettings.m_logFolder.c_str()); -+ strcat(filename, "video.dat"); -+#ifdef DEBUG_PLAYBACK -+ fp = fopen(filename, "rb"); -+#else -+ fp = fopen(filename, "wb"); -+#endif -+ } -+ if (fp) -+ { -+#ifdef DEBUG_PLAYBACK -+ OMX_BUFFERHEADERTYPE omx = {0}; -+ int s = fread(&omx, sizeof omx, 1, fp); -+ omx_buffer->nFilledLen = omx.nFilledLen; -+ omx_buffer->nFlags = omx.nFlags; -+ omx_buffer->nTimeStamp = omx.nTimeStamp; -+ if (s==1) -+ fread(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); -+#else -+ if (fwrite(omx_buffer, sizeof *omx_buffer, 1, fp) == 1) -+ fwrite(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); -+#endif -+ } -+} -+ - COMXVideo::COMXVideo() : m_video_codec_name("") - { - m_is_open = false; -@@ -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; - -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -@@ -692,6 +736,7 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de - void COMXVideo::Close() - { - CSingleLock lock (m_critSection); -+ dump_omx_buffer(NULL); - m_omx_tunnel_clock.Deestablish(); - m_omx_tunnel_decoder.Deestablish(); - if(m_deinterlace) -@@ -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) - { -@@ -928,6 +974,7 @@ void COMXVideo::SubmitEOS() - - omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; - -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 139e12d..ea45381 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1367,6 +1367,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se - #ifdef TARGET_RASPBERRY_PI - list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); - #endif -+#ifdef TARGET_RASPBERRY_PI -+ list.push_back(std::make_pair(g_localizeStrings.Get(698), LOGDUMPVIDEO)); -+ list.push_back(std::make_pair(g_localizeStrings.Get(699), LOGDUMPAUDIO)); -+#endif - } - - void CAdvancedSettings::setExtraLogLevel(const std::vector &components) - -From 4f9a70ab2488ac8b8dd154613e368a0060493d88 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Nov 2014 17:16:54 +0000 -Subject: [PATCH 40/89] Revert "[omxplayer] Add ability to dump out audio/video - data for later debugging" - -This reverts commit 417416bd29d00f1b42c77488d06e9e6840b8c4f4. ---- - .../resource.language.en_gb/resources/strings.po | 10 ----- - xbmc/commons/ilog.h | 2 - - xbmc/cores/omxplayer/OMXAudio.cpp | 49 ---------------------- - xbmc/cores/omxplayer/OMXVideo.cpp | 47 --------------------- - xbmc/settings/AdvancedSettings.cpp | 4 -- - 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 19b94b5..1b70492 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2920,16 +2920,6 @@ msgctxt "#697" - msgid "Verbose logging for OMXPLAYER" - msgstr "" - --#: xbmc/settings/AdvancedSettings.cpp --msgctxt "#698" --msgid "Dump video frames to debug file" --msgstr "" -- --#: xbmc/settings/AdvancedSettings.cpp --msgctxt "#699" --msgid "Dump audio frames to debug file" --msgstr "" -- - #empty strings from id 681 to 699 - - msgctxt "#700" -diff --git a/xbmc/commons/ilog.h b/xbmc/commons/ilog.h -index 4f8926c..e4ffb5e 100644 ---- a/xbmc/commons/ilog.h -+++ b/xbmc/commons/ilog.h -@@ -54,8 +54,6 @@ - #define LOGCEC (1 << (LOGMASKBIT + 9)) - #define LOGVIDEO (1 << (LOGMASKBIT + 10)) - #define LOGOMXPLAYER (1 << (LOGMASKBIT + 16)) --#define LOGDUMPVIDEO (1 << (LOGMASKBIT + 17)) --#define LOGDUMPAUDIO (1 << (LOGMASKBIT + 18)) - - #include "utils/params_check_macros.h" - -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 6dff6aa..1911189 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -56,49 +56,6 @@ using namespace std; - #define AUDIO_DECODE_OUTPUT_BUFFER (32*1024) - static const char rounded_up_channels_shift[] = {0,0,1,2,2,3,3,3,3}; - --//#define DEBUG_PLAYBACK --static void dump_omx_buffer(OMX_BUFFERHEADERTYPE *omx_buffer) --{ -- if (!(g_advancedSettings.CanLogComponent(LOGDUMPAUDIO))) -- return; -- static FILE *fp; -- if (!omx_buffer) -- { -- if (fp) -- { -- fclose(fp); -- fp = NULL; -- } -- return; -- } -- if (!fp) -- { -- char filename[1024]; -- strcpy(filename, g_advancedSettings.m_logFolder.c_str()); -- strcat(filename, "audio.dat"); --#ifdef DEBUG_PLAYBACK -- fp = fopen(filename, "rb"); --#else -- fp = fopen(filename, "wb"); --#endif -- } -- if (fp) -- { --#ifdef DEBUG_PLAYBACK -- OMX_BUFFERHEADERTYPE omx = {0}; -- int s = fread(&omx, sizeof omx, 1, fp); -- omx_buffer->nFilledLen = omx.nFilledLen; -- omx_buffer->nFlags = omx.nFlags; -- omx_buffer->nTimeStamp = omx.nTimeStamp; -- if (s==1) -- fread(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); --#else -- if (fwrite(omx_buffer, sizeof *omx_buffer, 1, fp) == 1) -- fwrite(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); --#endif -- } --} -- - ////////////////////////////////////////////////////////////////////// - // Construction/Destruction - ////////////////////////////////////////////////////////////////////// -@@ -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; - -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -@@ -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; - -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -@@ -981,8 +936,6 @@ bool COMXAudio::Deinitialize() - { - CSingleLock lock (m_critSection); - -- dump_omx_buffer(NULL); -- - if ( m_omx_tunnel_clock_analog.IsInitialized() ) - m_omx_tunnel_clock_analog.Deestablish(); - if ( m_omx_tunnel_clock_hdmi.IsInitialized() ) -@@ -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) - { -@@ -1509,7 +1461,6 @@ void COMXAudio::SubmitEOS() - - omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; - -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 0fb426c..ca40a37 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -65,49 +65,6 @@ - - #define MAX_TEXT_LENGTH 1024 - --//#define DEBUG_PLAYBACK --static void dump_omx_buffer(OMX_BUFFERHEADERTYPE *omx_buffer) --{ -- if (!(g_advancedSettings.CanLogComponent(LOGDUMPVIDEO))) -- return; -- static FILE *fp; -- if (!omx_buffer) -- { -- if (fp) -- { -- fclose(fp); -- fp = NULL; -- } -- return; -- } -- if (!fp) -- { -- char filename[1024]; -- strcpy(filename, g_advancedSettings.m_logFolder.c_str()); -- strcat(filename, "video.dat"); --#ifdef DEBUG_PLAYBACK -- fp = fopen(filename, "rb"); --#else -- fp = fopen(filename, "wb"); --#endif -- } -- if (fp) -- { --#ifdef DEBUG_PLAYBACK -- OMX_BUFFERHEADERTYPE omx = {0}; -- int s = fread(&omx, sizeof omx, 1, fp); -- omx_buffer->nFilledLen = omx.nFilledLen; -- omx_buffer->nFlags = omx.nFlags; -- omx_buffer->nTimeStamp = omx.nTimeStamp; -- if (s==1) -- fread(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); --#else -- if (fwrite(omx_buffer, sizeof *omx_buffer, 1, fp) == 1) -- fwrite(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); --#endif -- } --} -- - COMXVideo::COMXVideo() : m_video_codec_name("") - { - m_is_open = false; -@@ -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; - -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -@@ -736,7 +692,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de - void COMXVideo::Close() - { - CSingleLock lock (m_critSection); -- dump_omx_buffer(NULL); - m_omx_tunnel_clock.Deestablish(); - m_omx_tunnel_decoder.Deestablish(); - if(m_deinterlace) -@@ -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) - { -@@ -974,7 +928,6 @@ void COMXVideo::SubmitEOS() - - omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; - -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index ea45381..139e12d 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1367,10 +1367,6 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se - #ifdef TARGET_RASPBERRY_PI - list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); - #endif --#ifdef TARGET_RASPBERRY_PI -- list.push_back(std::make_pair(g_localizeStrings.Get(698), LOGDUMPVIDEO)); -- list.push_back(std::make_pair(g_localizeStrings.Get(699), LOGDUMPAUDIO)); --#endif - } - - void CAdvancedSettings::setExtraLogLevel(const std::vector &components) - -From 1dd87e754c11ac47b4e96eb465b5503206a04aef Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 41/89] [omxplayer] Add ability to dump out audio/video data - for later debugging - ---- - .../resource.language.en_gb/resources/strings.po | 10 ++++ - xbmc/commons/ilog.h | 2 + - xbmc/cores/dvdplayer/DVDPlayer.cpp | 63 ++++++++++++++++++++++ - xbmc/settings/AdvancedSettings.cpp | 4 ++ - 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 1b70492..19b94b5 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2920,6 +2920,16 @@ msgctxt "#697" - msgid "Verbose logging for OMXPLAYER" - msgstr "" - -+#: xbmc/settings/AdvancedSettings.cpp -+msgctxt "#698" -+msgid "Dump video frames to debug file" -+msgstr "" -+ -+#: xbmc/settings/AdvancedSettings.cpp -+msgctxt "#699" -+msgid "Dump audio frames to debug file" -+msgstr "" -+ - #empty strings from id 681 to 699 - - msgctxt "#700" -diff --git a/xbmc/commons/ilog.h b/xbmc/commons/ilog.h -index e4ffb5e..4f8926c 100644 ---- a/xbmc/commons/ilog.h -+++ b/xbmc/commons/ilog.h -@@ -54,6 +54,8 @@ - #define LOGCEC (1 << (LOGMASKBIT + 9)) - #define LOGVIDEO (1 << (LOGMASKBIT + 10)) - #define LOGOMXPLAYER (1 << (LOGMASKBIT + 16)) -+#define LOGDUMPVIDEO (1 << (LOGMASKBIT + 17)) -+#define LOGDUMPAUDIO (1 << (LOGMASKBIT + 18)) - - #include "utils/params_check_macros.h" - -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 3c313cd..8ceb498 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -96,6 +96,61 @@ - using namespace std; - using namespace PVR; - -+//#define DEBUG_PLAYBACK -+static void dump_packet(DemuxPacket *packet, bool video, bool audio) -+{ -+ static CCriticalSection m_section; -+ static FILE *fp_video, *fp_audio; -+ if ((!video || !g_advancedSettings.CanLogComponent(LOGDUMPVIDEO)) && -+ (!audio || !g_advancedSettings.CanLogComponent(LOGDUMPAUDIO))) -+ return; -+ const char *fname = video ? "video.dat" : "audio.dat"; -+ FILE *&fp = video ? fp_video : fp_audio; -+ CSingleLock lock(m_section); -+ if (!packet) -+ { -+ if (fp) -+ { -+ CLog::Log(LOGNOTICE, "%s:: Closing file %p", __func__, fp); -+ fclose(fp); -+ fp = NULL; -+ } -+ return; -+ } -+ if (!fp) -+ { -+ char filename[1024]; -+ strcpy(filename, g_advancedSettings.m_logFolder.c_str()); -+ strcat(filename, fname); -+#ifdef DEBUG_PLAYBACK -+ fp = fopen(filename, "rb"); -+#else -+ fp = fopen(filename, "wb"); -+#endif -+ CLog::Log(LOGNOTICE, "%s:: Opening file %s = %p", __func__, filename, fp); -+ } -+ if (fp) -+ { -+#ifdef DEBUG_PLAYBACK -+ DemuxPacket p = {0}; -+ int s = fread(&p, sizeof p, 1, fp); -+ if (s==1) -+ { -+ packet->iSize = p.iSize; -+ packet->dts = p.dts; -+ packet->pts = p.pts; -+ _aligned_free(packet->pData); -+ packet->pData = (uint8_t*)_aligned_malloc(packet->iSize + FF_INPUT_BUFFER_PADDING_SIZE, 16); -+ fread(packet->pData, packet->iSize, 1, fp); -+ } -+#else -+ if (fwrite(packet, sizeof *packet, 1, fp) == 1) -+ fwrite(packet->pData, packet->iSize, 1, fp); -+#endif -+ } -+} -+ -+ - void CSelectionStreams::Clear(StreamType type, StreamSource source) - { - CSingleLock lock(m_section); -@@ -974,6 +1029,12 @@ bool CDVDPlayer::ReadPacket(DemuxPacket*& packet, CDemuxStream*& stream) - return true; - } - -+ if(m_pDemuxer) -+ { -+ stream = m_pDemuxer->GetStream(packet->iStreamId); -+ if (stream) -+ dump_packet(packet, CheckIsCurrent(m_CurrentVideo, stream, packet), CheckIsCurrent(m_CurrentAudio, stream, packet)); -+ } - UpdateCorrection(packet, m_offset_pts); - - if(packet->iStreamId < 0) -@@ -3475,6 +3536,8 @@ bool CDVDPlayer::CloseStream(CCurrentStream& current, bool bWaitForBuffers) - if(bWaitForBuffers) - SetCaching(CACHESTATE_DONE); - -+ dump_packet(NULL, current.player == DVDPLAYER_VIDEO, current.player == DVDPLAYER_AUDIO); -+ - IDVDStreamPlayer* player = GetStreamPlayer(current.player); - if(player) - player->CloseStream(bWaitForBuffers); -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 139e12d..ea45381 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1367,6 +1367,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se - #ifdef TARGET_RASPBERRY_PI - list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); - #endif -+#ifdef TARGET_RASPBERRY_PI -+ list.push_back(std::make_pair(g_localizeStrings.Get(698), LOGDUMPVIDEO)); -+ list.push_back(std::make_pair(g_localizeStrings.Get(699), LOGDUMPAUDIO)); -+#endif - } - - void CAdvancedSettings::setExtraLogLevel(const std::vector &components) - -From c5426decde782f01e418f10fa2b4221b1b8e6157 Mon Sep 17 00:00:00 2001 +From 288777dd146b627d5240bfec658d1b90424a78d0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 29 Nov 2014 15:25:16 +0000 -Subject: [PATCH 42/89] [rbp] hack: wait for splash to complete before changing +Subject: [PATCH 24/56] [rbp] hack: wait for splash to complete before changing hdmi mode --- @@ -2987,10 +1159,10 @@ Subject: [PATCH 42/89] [rbp] hack: wait for splash to complete before changing 1 file changed, 49 insertions(+) diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 7d9b0d3..d388373 100644 +index 68fc647..c80114e 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -217,12 +217,61 @@ int CEGLNativeTypeRaspberryPI::AddUniqueResolution(RESOLUTION_INFO &res, std::ve +@@ -214,12 +214,61 @@ int CEGLNativeTypeRaspberryPI::AddUniqueResolution(RESOLUTION_INFO &res, std::ve } #endif @@ -3051,143 +1223,12 @@ index 7d9b0d3..d388373 100644 + DestroyDispmaxWindow(); - if(GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) + if(!m_fixedMode && GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) -From 9ed5eff1125f8484ce829b87342fb99856ef8bea Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 5 Oct 2014 14:05:25 +0100 -Subject: [PATCH 43/89] [PiSink] Allow audio output latency to be set in - settings - ---- - addons/resource.language.en_gb/resources/strings.po | 15 +++++++++++++++ - system/settings/rbp.xml | 12 ++++++++++++ - xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 13 ++++++++----- - xbmc/cores/AudioEngine/Sinks/AESinkPi.h | 1 + - 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 19b94b5..37932be 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16639,3 +16639,18 @@ msgstr "" - msgctxt "#38052" - msgid "Remote button press release time (ms)" - msgstr "" -+ -+#: system/settings/rbp.xml -+msgctxt "#38100" -+msgid "Audio output latency" -+msgstr "" -+ -+#: system/settings/rbp.xml -+msgctxt "#38101" -+msgid "Increase this to protect against underruns, reduce to have lower latency gui sounds" -+msgstr "" -+ -+#: system/settings/rbp.xml -+msgctxt "#38102" -+msgid "%i ms" -+msgstr "" -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 8496abf..5068b20 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -89,6 +89,18 @@ - - 101 - -+ -+ 3 -+ 100 -+ -+ 50 -+ 50 -+ 300 -+ -+ -+ 38102 -+ -+ - - - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -index d72a97a..b69925a 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -@@ -35,7 +35,6 @@ - #define CLASSNAME "CAESinkPi" - - #define NUM_OMX_BUFFERS 2 --#define AUDIO_PLAYBUFFER (0.1) // 100ms - - static const unsigned int PassthroughSampleRates[] = { 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, 176400, 192000 }; - -@@ -43,6 +42,7 @@ CAEDeviceInfo CAESinkPi::m_info; - - CAESinkPi::CAESinkPi() : - m_sinkbuffer_sec_per_byte(0), -+ m_latency(0), - m_Initialized(false), - m_submitted(0), - 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); -+ - 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)); -- format.m_frames = format.m_sampleRate * AUDIO_PLAYBUFFER / NUM_OMX_BUFFERS; -+ format.m_frames = format.m_sampleRate * m_latency / NUM_OMX_BUFFERS; - format.m_frameSamples = format.m_frames * channels; - - SetAudioProps(m_passthrough, GetChannelMap(format.m_channelLayout, m_passthrough)); -@@ -427,7 +430,7 @@ void CAESinkPi::GetDelay(AEDelayStatus& status) - - double CAESinkPi::GetCacheTotal() - { -- return AUDIO_PLAYBUFFER; -+ return m_latency; - } - - unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned int offset) -@@ -478,8 +481,8 @@ unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned - m_submitted++; - GetDelay(status); - delay = status.GetDelay(); -- if (delay > AUDIO_PLAYBUFFER) -- Sleep((int)(1000.0f * (delay - AUDIO_PLAYBUFFER))); -+ if (delay > m_latency) -+ Sleep((int)(1000.0f * (delay - m_latency))); - return frames; - } - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.h b/xbmc/cores/AudioEngine/Sinks/AESinkPi.h -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 - AEAudioFormat m_initFormat; - AEAudioFormat m_format; - double m_sinkbuffer_sec_per_byte; -+ double m_latency; - static CAEDeviceInfo m_info; - bool m_Initialized; - uint32_t m_submitted; - -From 3a60bf2bb5ce7d064c719ec96d385cf8167a7b04 Mon Sep 17 00:00:00 2001 +From b5262ef9b401ffa4b6d2276e67b742a37c1df79d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 11 Dec 2014 17:00:57 +0000 -Subject: [PATCH 44/89] Fix for UI not showing both extractflags and +Subject: [PATCH 25/56] Fix for UI not showing both extractflags and extractthumb --- @@ -3197,10 +1238,10 @@ Subject: [PATCH 44/89] 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 37932be..647befc 100644 +index 601cd44..fa25d45 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -10979,7 +10979,7 @@ msgstr "" +@@ -10962,7 +10962,7 @@ msgstr "" #: system/settings/settings.xml msgctxt "#20433" @@ -3209,7 +1250,7 @@ index 37932be..647befc 100644 msgstr "" #: xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp -@@ -14509,7 +14509,7 @@ msgstr "" +@@ -14492,7 +14492,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36178" @@ -3218,7 +1259,7 @@ index 37932be..647befc 100644 msgstr "" #. Description of setting "Videos -> File lists -> Replace file names with library titles" with label #20419 -@@ -14521,7 +14521,7 @@ msgstr "" +@@ -14504,7 +14504,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36180" @@ -3227,9 +1268,9 @@ index 37932be..647befc 100644 msgstr "" #: system/settings/settings.xml -@@ -16654,3 +16654,8 @@ msgstr "" - msgctxt "#38102" - msgid "%i ms" +@@ -16622,3 +16622,8 @@ msgstr "" + msgctxt "#38052" + msgid "Remote button press release time (ms)" msgstr "" + +#: system/settings/settings.xml @@ -3237,7 +1278,7 @@ index 37932be..647befc 100644 +msgid "Extract thumbnails from video files" +msgstr "" diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 5068b20..6e9ceaf 100644 +index 8496abf..ad65ce4 100644 --- a/system/settings/rbp.xml +++ b/system/settings/rbp.xml @@ -36,10 +36,6 @@ @@ -3252,7 +1293,7 @@ index 5068b20..6e9ceaf 100644 false diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index ede89e4..f3022c3 100644 +index e833d3b..0e09d3d 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -902,23 +902,23 @@ @@ -3285,10 +1326,10 @@ index ede89e4..f3022c3 100644 -From 85c30bde9f23146c332ffeaeecf2c0de5b784900 Mon Sep 17 00:00:00 2001 +From 913713b6debe33499641ea054f789423a00d1ed9 Mon Sep 17 00:00:00 2001 From: anaconda Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 45/89] Disable autoscrolling while on screensaver and while +Subject: [PATCH 26/56] Disable autoscrolling while on screensaver and while opening streams. --- @@ -3301,10 +1342,10 @@ Subject: [PATCH 45/89] 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 df6e8ca..5889613 100644 +index 0bdaae4..1141d7b 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -4959,3 +4959,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const +@@ -4958,3 +4958,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const return false; } @@ -3419,10 +1460,10 @@ index 0d5b3f7..6d23024 100644 if (m_lastRenderTime) m_autoScrollDelayTime += currentTime - m_lastRenderTime; -From 67692cfba74ca0e49e21c805c503605501fb5de2 Mon Sep 17 00:00:00 2001 +From 9de2f40d2046fdead3be13806c7d20ff39a94dfc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 13 Dec 2014 18:35:20 +0000 -Subject: [PATCH 46/89] [demuxer] Avoid memcpy on every demuxer packet +Subject: [PATCH 27/56] [demuxer] Avoid memcpy on every demuxer packet Avoids an unnecessary memcpy on every demuxer packet which for high bitrate videos can be significant. @@ -3433,10 +1474,10 @@ high bitrate videos can be significant. 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 643c219..2f70412 100644 +index 74ff31f..f9b3232 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -742,7 +742,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() +@@ -738,7 +738,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() { if(m_pkt.pkt.stream_index == (int)m_pFormatContext->programs[m_program]->stream_index[i]) { @@ -3445,7 +1486,7 @@ index 643c219..2f70412 100644 break; } } -@@ -751,7 +751,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() +@@ -747,7 +747,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() bReturnEmpty = true; } else @@ -3454,7 +1495,7 @@ index 643c219..2f70412 100644 } else bReturnEmpty = true; -@@ -793,9 +793,13 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() +@@ -789,9 +789,13 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() // copy contents into our own packet pPacket->iSize = m_pkt.pkt.size; @@ -3470,7 +1511,7 @@ index 643c219..2f70412 100644 pPacket->pts = ConvertTimestamp(m_pkt.pkt.pts, stream->time_base.den, stream->time_base.num); pPacket->dts = ConvertTimestamp(m_pkt.pkt.dts, stream->time_base.den, stream->time_base.num); -@@ -830,7 +834,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() +@@ -826,7 +830,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() pPacket->iStreamId = m_pkt.pkt.stream_index; } m_pkt.result = -1; @@ -3517,1256 +1558,666 @@ index ab298b2..10c5ee0 100644 } catch(...) { -From 32561c3475489b45a10a23b1f00896759a4a8e35 Mon Sep 17 00:00:00 2001 -From: Memphiz -Date: Tue, 18 Nov 2014 13:27:59 +0100 -Subject: [PATCH 47/89] - added setting for allowing to hide watched - movies/episodes/musicvideos in the recently added lists of the home screen - ---- - addons/resource.language.en_gb/resources/strings.po | 16 ++++++++++++++-- - system/settings/settings.xml | 5 +++++ - 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 647befc..bf466b0 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -11148,7 +11148,13 @@ msgctxt "#20469" - msgid "Keep current set (%s)" - msgstr "" - --#empty strings from id 20470 to 21329 -+#. Label of setting "Videos -> Library -> Hide watched videos in recently added list (home screen)" -+#: system/settings/settings.xml -+msgctxt "#20470" -+msgid "Hide watched videos in recently added list (home screen)" -+msgstr "" -+ -+#empty strings from id 20471 to 21329 - #up to 21329 is reserved for the video db !! ! - - #: system/settings/settings.xml -@@ -15966,7 +15972,13 @@ msgctxt "#36435" - msgid "Use DVDPlayer for decoding of video files with MMAL acceleration." - msgstr "" - --#empty strings from id 36436 to 36499 -+#. Description of setting "Videos -> Library -> Hide watched videos in recently added list." -+#: system/settings/settings.xml -+msgctxt "#36436" -+msgid "If enabled all watched items in the recently added list on the home screen will be hidden. This includes movies, episodes and musicvideos. The effect depends on the used skin and its settings." -+msgstr "" -+ -+#empty strings from id 36437 to 36499 - #end reservation - - #. 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 f3022c3..823f181 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -468,6 +468,11 @@ - false - - -+ -+ 1 -+ true -+ -+ - - - - -From 299f258f82d0bf10105053affec0d811bfa20002 Mon Sep 17 00:00:00 2001 -From: Memphiz -Date: Tue, 18 Nov 2014 13:28:36 +0100 -Subject: [PATCH 48/89] - evaluate the setting for hiding watched - movies/episodes/musicvideos in recently added job (should influence - homescreen of skins only) - ---- - xbmc/utils/RecentlyAddedJob.cpp | 10 +++++----- - xbmc/video/VideoDatabase.cpp | 27 ++++++++++++++++++++++++--- - xbmc/video/VideoDatabase.h | 6 +++--- - 3 files changed, 32 insertions(+), 11 deletions(-) - -diff --git a/xbmc/utils/RecentlyAddedJob.cpp b/xbmc/utils/RecentlyAddedJob.cpp -index 1f8ec36..de45783 100644 ---- a/xbmc/utils/RecentlyAddedJob.cpp -+++ b/xbmc/utils/RecentlyAddedJob.cpp -@@ -31,6 +31,7 @@ - #include "utils/Variant.h" - #include "utils/StringUtils.h" - #include "settings/AdvancedSettings.h" -+#include "settings/Settings.h" - #include "music/MusicThumbLoader.h" - #include "video/VideoThumbLoader.h" - -@@ -57,8 +58,8 @@ bool CRecentlyAddedJob::UpdateVideo() - loader.OnLoaderStart(); - - videodatabase.Open(); -- -- if (videodatabase.GetRecentlyAddedMoviesNav("videodb://recentlyaddedmovies/", items, NUM_ITEMS)) -+ bool hideWatched = CSettings::Get().GetBool("videolibrary.hiderecentlywatchedvideos"); -+ if (videodatabase.GetRecentlyAddedMoviesNav("videodb://recentlyaddedmovies/", items, NUM_ITEMS, hideWatched)) - { - for (; i < items.Size(); ++i) - { -@@ -97,8 +98,7 @@ bool CRecentlyAddedJob::UpdateVideo() - - i = 0; - CFileItemList TVShowItems; -- -- if (videodatabase.GetRecentlyAddedEpisodesNav("videodb://recentlyaddedepisodes/", TVShowItems, NUM_ITEMS)) -+ if (videodatabase.GetRecentlyAddedEpisodesNav("videodb://recentlyaddedepisodes/", TVShowItems, NUM_ITEMS, hideWatched)) - { - for (; i < TVShowItems.Size(); ++i) - { -@@ -151,7 +151,7 @@ bool CRecentlyAddedJob::UpdateVideo() - i = 0; - CFileItemList MusicVideoItems; - -- if (videodatabase.GetRecentlyAddedMusicVideosNav("videodb://recentlyaddedmusicvideos/", MusicVideoItems, NUM_ITEMS)) -+ if (videodatabase.GetRecentlyAddedMusicVideosNav("videodb://recentlyaddedmusicvideos/", MusicVideoItems, NUM_ITEMS, hideWatched)) - { - for (; i < MusicVideoItems.Size(); ++i) - { -diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp -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 - return GetMusicVideosByWhere(videoUrl.ToString(), filter, items, true, sortDescription); - } - --bool CVideoDatabase::GetRecentlyAddedMoviesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit) -+bool CVideoDatabase::GetRecentlyAddedMoviesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit, bool hideWatched) - { - Filter filter; - filter.order = "dateAdded desc, idMovie desc"; - filter.limit = PrepareSQL("%u", limit ? limit : g_advancedSettings.m_iVideoLibraryRecentlyAddedItems); -+ -+ if (hideWatched) -+ { -+ filter.AppendWhere("playCount <= 0");// only query unwatched items -+ filter.AppendWhere("playCount IS NULL", false); -+ } -+ - return GetMoviesByWhere(strBaseDir, filter, items); - } - --bool CVideoDatabase::GetRecentlyAddedEpisodesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit) -+bool CVideoDatabase::GetRecentlyAddedEpisodesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit, bool hideWatched) - { - Filter filter; - filter.order = "dateAdded desc, idEpisode desc"; - filter.limit = PrepareSQL("%u", limit ? limit : g_advancedSettings.m_iVideoLibraryRecentlyAddedItems); -+ -+ if (hideWatched) -+ { -+ filter.AppendWhere("playCount <= 0");// only query unwatched items -+ filter.AppendWhere("playCount IS NULL", false); -+ } -+ - return GetEpisodesByWhere(strBaseDir, filter, items, false); - } - --bool CVideoDatabase::GetRecentlyAddedMusicVideosNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit) -+bool CVideoDatabase::GetRecentlyAddedMusicVideosNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit, bool hideWatched) - { - Filter filter; - filter.order = "dateAdded desc, idMVideo desc"; - filter.limit = PrepareSQL("%u", limit ? limit : g_advancedSettings.m_iVideoLibraryRecentlyAddedItems); -+ -+ if (hideWatched) -+ { -+ filter.AppendWhere("playCount <= 0");// only query unwatched items -+ filter.AppendWhere("playCount IS NULL", false); -+ } -+ - return GetMusicVideosByWhere(strBaseDir, filter, items); - } - -diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h -index ca62f23..b905e48 100644 ---- a/xbmc/video/VideoDatabase.h -+++ b/xbmc/video/VideoDatabase.h -@@ -683,9 +683,9 @@ class CVideoDatabase : public CDatabase - bool GetEpisodesNav(const std::string& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idActor=-1, int idDirector=-1, int idShow=-1, int idSeason=-1, const SortDescription &sortDescription = SortDescription()); - bool GetMusicVideosNav(const std::string& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idArtist=-1, int idDirector=-1, int idStudio=-1, int idAlbum=-1, int idTag=-1, const SortDescription &sortDescription = SortDescription()); - -- bool GetRecentlyAddedMoviesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0); -- bool GetRecentlyAddedEpisodesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0); -- bool GetRecentlyAddedMusicVideosNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0); -+ bool GetRecentlyAddedMoviesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0, bool hideWatched=false); -+ bool GetRecentlyAddedEpisodesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0, bool hideWatched=false); -+ bool GetRecentlyAddedMusicVideosNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0, bool hideWatched=false); - - bool HasContent(); - bool HasContent(VIDEODB_CONTENT_TYPE type); - -From 2373aa7571337304e255fe7039fbd49fcfa3a4f9 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Wed, 4 Feb 2015 22:32:03 +0100 -Subject: [PATCH 49/89] NFSFile: Chank ChunkSize to 1MB - ---- - xbmc/filesystem/NFSFile.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/filesystem/NFSFile.h b/xbmc/filesystem/NFSFile.h -index 4c01e4e..7afa6b8 100644 ---- a/xbmc/filesystem/NFSFile.h -+++ b/xbmc/filesystem/NFSFile.h -@@ -148,7 +148,7 @@ namespace XFILE - //implement iocontrol for seek_possible for preventing the stat in File class for - //getting this info ... - virtual int IoControl(EIoControl request, void* param){ if(request == IOCTRL_SEEK_POSSIBLE) return 1;return -1;}; -- virtual int GetChunkSize() {return 1;} -+ virtual int GetChunkSize() {return 1024*1024;} - - virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false); - virtual bool Delete(const CURL& url); - -From 2862d65f247cbff597c3a4f2a54342ae9e653e11 Mon Sep 17 00:00:00 2001 +From 275639e41023b0fb4fe2025379dc5b10764d21ea Mon Sep 17 00:00:00 2001 From: popcornmix -Date: Tue, 10 Feb 2015 00:19:51 +0000 -Subject: [PATCH 52/89] [libnfs] Add streaming cache +Date: Tue, 10 Feb 2015 15:29:16 +0000 +Subject: [PATCH 28/56] [libcec] Add repeating keypress patch from popcornmix' + repo --- - .../libnfs/0001-Sequential-Readahead-Mode.patch | 949 +++++++++++++++++++++ - tools/depends/target/libnfs/Makefile | 1 + - xbmc/filesystem/DllLibNfs.h | 3 + - xbmc/filesystem/NFSFile.cpp | 2 + - 4 files changed, 955 insertions(+) - create mode 100644 tools/depends/target/libnfs/0001-Sequential-Readahead-Mode.patch + tools/depends/target/libcec/Makefile | 1 + + tools/depends/target/libcec/popcornmix.patch | 615 +++++++++++++++++++++++++++ + 2 files changed, 616 insertions(+) + create mode 100644 tools/depends/target/libcec/popcornmix.patch -diff --git a/tools/depends/target/libnfs/0001-Sequential-Readahead-Mode.patch b/tools/depends/target/libnfs/0001-Sequential-Readahead-Mode.patch -new file mode 100644 -index 0000000..83b7e11 ---- /dev/null -+++ b/tools/depends/target/libnfs/0001-Sequential-Readahead-Mode.patch -@@ -0,0 +1,949 @@ -+From ae7ef01ad15ea91f669a59d4fd44aa9c03a3a6fb Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Sat, 7 Feb 2015 11:16:38 -0800 -+Subject: [PATCH 1/7] Sequential Readahead Mode -+ -+Add a new api to activate sequential reading of files. -+It is activated by calling nfs_set_streaming_mode(fs,size) -+with a filehandle and a size. -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ include/nfsc/libnfs-raw.h | 9 ++ -+ include/nfsc/libnfs.h | 14 +++ -+ lib/libnfs-sync.c | 12 ++- -+ lib/libnfs-win32.def | 5 + -+ lib/libnfs.c | 258 +++++++++++++++++++++++++++++++++++++++++++++- -+ lib/socket.c | 15 ++- -+ 6 files changed, 308 insertions(+), 5 deletions(-) -+ -+diff --git a/include/nfsc/libnfs-raw.h b/include/nfsc/libnfs-raw.h -+index 3ba9de3..4593cc6 100644 -+--- a/include/nfsc/libnfs-raw.h -++++ b/include/nfsc/libnfs-raw.h -+@@ -44,6 +44,15 @@ int rpc_get_fd(struct rpc_context *rpc); -+ int rpc_which_events(struct rpc_context *rpc); -+ int rpc_service(struct rpc_context *rpc, int revents); -+ char *rpc_get_error(struct rpc_context *rpc); -++ -++/* Return the number of PDUs in the outqueue. -++ * This is the count of PDUs not yet written to the socket. -++ */ -++int rpc_outqueue_length(struct rpc_context *rpc); -++/* Return the number all in flight PDUs. -++ * This includes both the PDUs not yet written to the socket as well as -++ * all PDUs we have sent to the server but not yet received a reply to. -++ */ -+ int rpc_queue_length(struct rpc_context *rpc); -+ -+ /* Utility function to get an RPC context from a NFS context. Useful for doing low level NFSACL -+diff --git a/include/nfsc/libnfs.h b/include/nfsc/libnfs.h -+index 2d14113..f84650b 100644 -+--- a/include/nfsc/libnfs.h -++++ b/include/nfsc/libnfs.h -+@@ -83,6 +83,15 @@ struct utimbuf { -+ EXTERN int nfs_get_fd(struct nfs_context *nfs); -+ EXTERN int nfs_which_events(struct nfs_context *nfs); -+ EXTERN int nfs_service(struct nfs_context *nfs, int revents); -++ -++/* Return the number of PDUs in the outqueue. -++ * This is the count of PDUs not yet written to the socket. -++ */ -++EXTERN int nfs_outqueue_length(struct nfs_context *nfs); -++/* Return the number all in flight PDUs. -++ * This includes both the PDUs not yet written to the socket as well as -++ * all PDUs we have sent to the server but not yet received a reply to. -++ */ -+ EXTERN int nfs_queue_length(struct nfs_context *nfs); -+ -+ /* -+@@ -191,6 +200,11 @@ EXTERN void nfs_set_uid(struct nfs_context *nfs, int uid); -+ EXTERN void nfs_set_gid(struct nfs_context *nfs, int gid); -+ EXTERN void nfs_set_readahead(struct nfs_context *nfs, uint32_t v); -+ -++/* Optimize for sequentianl streaming reads. size is the amount -++ * of buffering. -++ */ -++EXTERN int nfs_set_streaming_mode(struct nfsfh *nfsfh, uint32_t size); -++ -+ /* -+ * MOUNT THE EXPORT -+ */ -+diff --git a/lib/libnfs-sync.c b/lib/libnfs-sync.c -+index 59911fc..dc696c3 100644 -+--- a/lib/libnfs-sync.c -++++ b/lib/libnfs-sync.c -+@@ -137,9 +137,14 @@ static void wait_for_reply(struct rpc_context *rpc, struct sync_cb_data *cb_data -+ static void wait_for_nfs_reply(struct nfs_context *nfs, struct sync_cb_data *cb_data) -+ { -+ struct pollfd pfd; -+- -+- while (!cb_data->is_finished) { -+- -++ int available; -++ -++ /* loop until the command has completed, and we have written all -++ * queued PDUs to the socket, and we have read and processed all -++ * data in the socket receive buffer. -++ */ -++ ioctl(nfs_get_fd(nfs), FIONREAD, &available); -++ while (!cb_data->is_finished || nfs_outqueue_length(nfs) || available) { -+ pfd.fd = nfs_get_fd(nfs); -+ pfd.events = nfs_which_events(nfs); -+ if (poll(&pfd, 1, -1) < 0) { -+@@ -152,6 +157,7 @@ static void wait_for_nfs_reply(struct nfs_context *nfs, struct sync_cb_data *cb_ -+ cb_data->status = -EIO; -+ break; -+ } -++ ioctl(nfs_get_fd(nfs), FIONREAD, &available); -+ } -+ } -+ -+diff --git a/lib/libnfs-win32.def b/lib/libnfs-win32.def -+index 5a0df03..bdfa737 100644 -+--- a/lib/libnfs-win32.def -++++ b/lib/libnfs-win32.def -+@@ -48,6 +48,7 @@ nfs_open -+ nfs_open_async -+ nfs_opendir -+ nfs_opendir_async -++nfs_outqueue_length -+ nfs_parse_url_full -+ nfs_parse_url_dir -+ nfs_parse_url_incomplete -+@@ -56,6 +57,7 @@ nfs_pread -+ nfs_pread_async -+ nfs_pwrite -+ nfs_pwrite_async -++nfs_queue_length -+ nfs_read -+ nfs_read_async -+ nfs_readdir -+@@ -71,6 +73,7 @@ nfs_set_gid -+ nfs_set_tcp_syncnt -+ nfs_set_uid -+ nfs_set_readahead -++nfs_set_streaming_mode -+ nfs_stat -+ nfs_stat_async -+ nfs_stat64 -+@@ -205,6 +208,8 @@ rpc_nsm1_unmon_async -+ rpc_nsm1_unmonall_async -+ rpc_nsm1_simucrash_async -+ rpc_nsm1_notify_async -++rpc_outqueue_length -++rpc_queue_length -+ rpc_rquota1_null_async -+ rpc_rquota1_getquota_async -+ rpc_rquota1_getactivequota_async -+diff --git a/lib/libnfs.c b/lib/libnfs.c -+index f807822..5fc921d 100644 -+--- a/lib/libnfs.c -++++ b/lib/libnfs.c -+@@ -108,12 +108,37 @@ struct nfs_readahead { -+ uint32_t cur_ra; -+ }; -+ -++/* Store streaming cache in blocks of this size */ -++#define NFS_STREAM_BUF_SIZE (32768 * 4) -++/* Skip trying to streaming caching for reads greater than this */ -++#define NFS_MAX_STREAMING_SIZE (1024 * 1024) -++ -++#define BSS_UNUSED 0 -++#define BSS_PENDING 1 -++#define BSS_VALID 2 -++struct nfs_streaming_block { -++ int state; -++ unsigned char *ptr; -++}; -++ -++struct nfs_streaming_read { -++ uint64_t next_offset; -++ int num_seq; -++ -++ int num_blocks; /* number of buffer blocks */ -++ uint64_t buf_offset; -++ struct nfs_streaming_block *blocks; -++ unsigned char *buf; -++}; -++ -+ struct nfsfh { -+ struct nfs_fh3 fh; -+ int is_sync; -+ int is_append; -+ uint64_t offset; -+- struct nfs_readahead ra; -++ -++ struct nfs_streaming_read *sr; -++ struct nfs_readahead ra; /* broken? */ -+ }; -+ -+ struct nested_mounts { -+@@ -231,6 +256,11 @@ int nfs_get_fd(struct nfs_context *nfs) -+ return rpc_get_fd(nfs->rpc); -+ } -+ -++int nfs_outqueue_length(struct nfs_context *nfs) -++{ -++ return rpc_outqueue_length(nfs->rpc); -++} -++ -+ int nfs_queue_length(struct nfs_context *nfs) -+ { -+ return rpc_queue_length(nfs->rpc); -+@@ -730,12 +760,52 @@ static void free_nfs_cb_data(struct nfs_cb_data *data) -+ free(data); -+ } -+ -++int nfs_set_streaming_mode(struct nfsfh *nfsfh, uint32_t size) -++{ -++ struct nfs_streaming_read *sr; -++ int i; -++ -++ sr = malloc(sizeof(struct nfs_streaming_read)); -++ if (sr == NULL) { -++ return -1; -++ } -++ memset(sr, 0, sizeof(struct nfs_streaming_read)); -++ sr->num_blocks = size / NFS_STREAM_BUF_SIZE; -++ -++ sr->buf = malloc(sr->num_blocks * NFS_STREAM_BUF_SIZE); -++ if (sr->buf == NULL) { -++ free(sr); -++ return -1; -++ } -++ memset(sr->buf, 0, sr->num_blocks * NFS_STREAM_BUF_SIZE); -++ -++ sr->blocks = malloc(sr->num_blocks * sizeof(struct nfs_streaming_block)) -++; -++ if (sr->blocks == NULL) { -++ free(sr->buf); -++ free(sr); -++ return -1; -++ } -++ for (i = 0; i < sr->num_blocks; i++) { -++ sr->blocks[i].state = BSS_UNUSED; -++ sr->blocks[i].ptr = &sr->buf[i * NFS_STREAM_BUF_SIZE]; -++ } -++ nfsfh->sr = sr; -++ -++ return 0; -++} -++ -+ static void free_nfsfh(struct nfsfh *nfsfh) -+ { -+ if (nfsfh->fh.data.data_val != NULL) { -+ free(nfsfh->fh.data.data_val); -+ nfsfh->fh.data.data_val = NULL; -+ } -++ if (nfsfh->sr != NULL) { -++ free(nfsfh->sr->blocks); -++ free(nfsfh->sr->buf); -++ free(nfsfh->sr); -++ } -+ free(nfsfh->ra.buf); -+ free(nfsfh); -+ } -+@@ -2033,6 +2103,8 @@ static void nfs_open_cb(struct rpc_context *rpc, int status, void *command_data, -+ nfsfh->fh = data->fh; -+ data->fh.data.data_val = NULL; -+ -++ nfs_set_streaming_mode(nfsfh, 200 * NFS_STREAM_BUF_SIZE); -++ -+ data->cb(0, nfs, nfsfh, data->private_data); -+ free_nfs_cb_data(data); -+ } -+@@ -2252,10 +2324,194 @@ static void nfs_ra_invalidate(struct nfsfh *nfsfh) { -+ nfsfh->ra.cur_ra = NFS_BLKSIZE; -+ } -+ -++struct stream_cb_data { -++ uint64_t offset; -++ struct nfsfh *nfsfh; -++}; -++ -++static void nfs_stream_cb(struct rpc_context *rpc, int status, void *command_data, void *private_data) -++{ -++ struct stream_cb_data *stream_data = private_data; -++ struct nfsfh *nfsfh = stream_data->nfsfh; -++ READ3res *res; -++ int i; -++ -++ assert(rpc->magic == RPC_CONTEXT_MAGIC); -++ -++ if (stream_data->offset < nfsfh->sr->buf_offset) { -++ free(stream_data); -++ return; -++ } -++ if (stream_data->offset >= nfsfh->sr->buf_offset + nfsfh->sr->num_blocks * NFS_STREAM_BUF_SIZE) { -++ free(stream_data); -++ return; -++ } -++ -++ i = (stream_data->offset - nfsfh->sr->buf_offset) / NFS_STREAM_BUF_SIZE; -++ nfsfh->sr->blocks[i].state = BSS_UNUSED; -++ free(stream_data); -++ -++ if (status == RPC_STATUS_ERROR) { -++ return; -++ } -++ if (status == RPC_STATUS_CANCEL) { -++ return; -++ } -++ if (status == RPC_STATUS_SUCCESS) { -++ res = command_data; -++ if (res->status != NFS3_OK) { -++ return; -++ } -++ if (res->READ3res_u.resok.count != NFS_STREAM_BUF_SIZE) { -++ return; -++ } -++ memcpy(nfsfh->sr->blocks[i].ptr, -++ res->READ3res_u.resok.data.data_val, -++ NFS_STREAM_BUF_SIZE); -++ nfsfh->sr->blocks[i].state = BSS_VALID; -++ } -++} -++ -++static void prefetch_streaming_blocks(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t next_offset, int num_blocks) -++{ -++ int i; -++ -++ for (i = 0; i < nfsfh->sr->num_blocks && num_blocks; i++) { -++ struct stream_cb_data *stream_data; -++ READ3args args; -++ -++ if (nfsfh->sr->blocks[i].state != BSS_UNUSED) { -++ continue; -++ } -++ -++ stream_data = malloc(sizeof(struct stream_cb_data)); -++ if (stream_data == NULL) { -++ return; -++ } -++ stream_data->offset = i * NFS_STREAM_BUF_SIZE + nfsfh->sr->buf_offset; -++ stream_data->nfsfh = nfsfh; -++ -++ nfs_fill_READ3args(&args, nfsfh, stream_data->offset, NFS_STREAM_BUF_SIZE); -++ if (rpc_nfs3_read_async(nfs->rpc, nfs_stream_cb, &args, stream_data) != 0) { -++ free(stream_data); -++ return; -++ } -++ -++ nfsfh->sr->blocks[i].state = BSS_PENDING; -++ num_blocks--; -++ } -++} -++ -+ static int nfs_pread_async_internal(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, nfs_cb cb, void *private_data, int update_pos) -+ { -+ struct nfs_cb_data *data; -+ -++ if (nfsfh->sr != NULL && count <= NFS_MAX_STREAMING_SIZE) { -++ int i, len, remaining, first_block, last_block; -++ unsigned char *buf, *pos; -++ -++ /* track sequential access */ -++ if (offset == nfsfh->sr->next_offset) { -++ nfsfh->sr->num_seq++; -++ } else { -++ if (nfsfh->sr->blocks[0].state != BSS_UNUSED) { -++ for (i = 0; i < nfsfh->sr->num_blocks; i++) { -++ nfsfh->sr->blocks[i].state = BSS_UNUSED; -++ } -++ } -++ nfsfh->sr->num_seq = 0; -++ } -++ nfsfh->sr->next_offset = offset + count; -++ -++ if (nfsfh->sr->num_seq < 5) { -++ goto end_of_streaming; -++ } -++ -++ /* If we do not have any cached data yet, reset buffer -++ * offset to point slightly ahead of the current read. -++ */ -++ if (nfsfh->sr->blocks[0].state == BSS_UNUSED) { -++ nfsfh->sr->buf_offset = (offset / NFS_STREAM_BUF_SIZE + 1) * NFS_STREAM_BUF_SIZE ; -++ } -++ -++ /* Prune head blocks we have read past */ -++ while (nfsfh->sr->blocks[0].state != BSS_UNUSED && -++ offset >= (nfsfh->sr->buf_offset + NFS_STREAM_BUF_SIZE)) { -++ unsigned char *ptr; -++ -++ ptr = nfsfh->sr->blocks[0].ptr; -++ memmove(&nfsfh->sr->blocks[0], &nfsfh->sr->blocks[1], -++ (nfsfh->sr->num_blocks - 1) -++ * sizeof(struct nfs_streaming_block)); -++ nfsfh->sr->buf_offset += NFS_STREAM_BUF_SIZE; -++ nfsfh->sr->blocks[nfsfh->sr->num_blocks - 1].state = BSS_UNUSED; -++ nfsfh->sr->blocks[nfsfh->sr->num_blocks - 1].ptr = ptr; -++ } -++ -++ /* try to prefetch four more blocks */ -++ prefetch_streaming_blocks(nfs, nfsfh, offset + count, 4); -++ -++ /* can we service the request straight out of cache ? */ -++ if (offset < nfsfh->sr->buf_offset) { -++ goto end_of_streaming; -++ } -++ first_block = (offset - nfsfh->sr->buf_offset) / NFS_STREAM_BUF_SIZE; -++ if (first_block >= nfsfh->sr->num_blocks) { -++ goto end_of_streaming; -++ } -++ -++ if (offset + count > nfsfh->sr->buf_offset + nfsfh->sr->num_blocks * NFS_STREAM_BUF_SIZE) { -++ goto end_of_streaming; -++ } -++ last_block = (offset + count - nfsfh->sr->buf_offset - 1) / NFS_STREAM_BUF_SIZE; -++ if (last_block >= nfsfh->sr->num_blocks) { -++ goto end_of_streaming; -++ } -++ if (last_block < first_block) { -++ goto end_of_streaming; -++ } -++ for (i = first_block; i <= last_block; i++) { -++ if (nfsfh->sr->blocks[i].state != BSS_VALID) { -++ goto end_of_streaming; -++ } -++ } -++ if (first_block == last_block) { -++ if (update_pos) { -++ nfsfh->offset += count; -++ } -++ cb(count, nfs, &nfsfh->sr->blocks[first_block].ptr[offset % NFS_STREAM_BUF_SIZE], private_data); -++ return 0; -++ } -++ -++ buf = malloc(count); -++ if (buf == NULL) { -++ goto end_of_streaming; -++ } -++ remaining = count; -++ pos = buf; -++ len = NFS_STREAM_BUF_SIZE - offset % NFS_STREAM_BUF_SIZE; -++ if (len > count) { -++ len = count; -++ } -++ memcpy(pos, &nfsfh->sr->blocks[first_block].ptr[offset % NFS_STREAM_BUF_SIZE], len); -++ remaining -= len; -++ pos += len; -++ -++ for (i = first_block + 1; remaining; i++) { -++ len = (remaining >= NFS_STREAM_BUF_SIZE) ? NFS_STREAM_BUF_SIZE : remaining; -++ memcpy(pos, &nfsfh->sr->blocks[i].ptr[0], len); -++ remaining -= len; -++ pos += len; -++ } -++ if (update_pos) { -++ nfsfh->offset += count; -++ } -++ cb(count, nfs, buf, private_data); -++ free(buf); -++ return 0; -++ } -++end_of_streaming: -++ -+ data = malloc(sizeof(struct nfs_cb_data)); -+ if (data == NULL) { -+ rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure"); -+diff --git a/lib/socket.c b/lib/socket.c -+index 3588246..41fb5b2 100644 -+--- a/lib/socket.c -++++ b/lib/socket.c -+@@ -755,7 +755,7 @@ struct sockaddr *rpc_get_recv_sockaddr(struct rpc_context *rpc) -+ return (struct sockaddr *)&rpc->udp_src; -+ } -+ -+-int rpc_queue_length(struct rpc_context *rpc) -++int rpc_outqueue_length(struct rpc_context *rpc) -+ { -+ int i=0; -+ struct rpc_pdu *pdu; -+@@ -767,6 +767,19 @@ int rpc_queue_length(struct rpc_context *rpc) -+ i++; -+ } -+ -++ return i; -++} -++ -++int rpc_queue_length(struct rpc_context *rpc) -++{ -++ int i=0; -++ struct rpc_pdu *pdu; -++ unsigned int n; -++ -++ assert(rpc->magic == RPC_CONTEXT_MAGIC); -++ -++ i = rpc_outqueue_length(rpc); -++ -+ for (n = 0; n < HASHES; n++) { -+ struct rpc_queue *q = &rpc->waitpdu[n]; -+ -+-- -+1.9.1 -+ -+ -+From 6f6832b6c19a26557883af924d7135f5ef87f45d Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Sat, 7 Feb 2015 12:43:59 -0800 -+Subject: [PATCH 2/7] nfs-stream.c: a simple test tool to check performance -+ sequential read mode -+ -+./nfs-stream -+ -+This tool is for testing sequential read mode. -+It reads 32kbyte one block at a time using the sync API. -+The idea is that when a nfs_[p]read() command is executed, we will once we -+identify a sequential scan start issuing asynchronous commands in the -+background to populate a readahead cache. -+ -+During read, we try to service the request immediately out of cache -+and return immediately to the application. During read from cache we will also -+process any to previous reads and use it to populate the cache. Also, as the -+file offset grows, we will discard the already read blocks from the cache -+and issue new asynchronous commands at the tail of the cache. -+ -+nfs_read() will when the cache is operating behave like : -+ nfs_read() { -+ ... process any previous reads and populate the cache ... -+ ... send async command to replenish the tail of the cache ... -+ return data from cache straigh back to application -+ } -+ -+The test tool will try to read 32kb chunks at a given rate. -+Once the test tool manages to service from cache the read laency should drop -+to <<1ms and the majority of the time spent will be in the sleep() between calls. -+Once the latency is steady at <<1ms this is an indication that we now -+service all reads out of cache instead of the network. -+If the read latency remains <<1ms continously, without any spikes, it means that -+we have been successfull in maintaining the asycntrhous tasks to replenish the cache. -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ nfs-stream.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -+ 1 file changed, 65 insertions(+) -+ create mode 100644 nfs-stream.c -+ -+diff --git a/nfs-stream.c b/nfs-stream.c -+new file mode 100644 -+index 0000000..5570cd6 -+--- /dev/null -++++ b/nfs-stream.c -+@@ -0,0 +1,65 @@ -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#include "nfsc/libnfs.h" -++ -++int main(int argc, char *argv[]) -++{ -++ struct nfs_context *nfs; -++ struct nfs_url *url; -++ struct nfsfh *nfsfh = NULL; -++ struct nfs_stat_64 st; -++ uint64_t offset; -++ char buf[32768]; -++ struct timeval t1, t2; -++ uint64_t delta, tpc; -++ -++ nfs = nfs_init_context(); -++ url = nfs_parse_url_full(nfs, argv[1]); -++ if (!url) { -++ fprintf(stderr, "Can not parse URL. %s\n", -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ if (nfs_mount(nfs, url->server, url->path) != 0) { -++ fprintf(stderr, "Failed to mount nfs share : %s\n", -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ if (nfs_open(nfs, url->file, O_RDONLY, &nfsfh) != 0) { -++ fprintf(stderr, "Failed to open file %s: %s\n", -++ url->file, -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ if (nfs_fstat64(nfs, nfsfh, &st)) { -++ fprintf(stderr, "Failed to stat file %s: %s\n", -++ url->file, -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ printf("File size:%lld\n", (long long)st.nfs_size); -++ tpc = 1000000 / (strtol(argv[2], NULL, 10) / 32768); -++ printf("Read one 32kb chunk every %d us\n", (int)tpc); -++ for (offset = 0; offset < st.nfs_size; offset += 32768) { -++ gettimeofday(&t1, NULL); -++ nfs_read(nfs, nfsfh, 8192, buf); -++ gettimeofday(&t2, NULL); -++ delta = t2.tv_sec * 1000000LL + t2.tv_usec - -++ t1.tv_sec * 1000000LL - t1.tv_usec; -++ printf("Read latency:%lld us\n", (long long)delta); -++ if (tpc > delta) { -++ printf("Sleep for %d us\n", (int)(tpc - delta)); -++ usleep(tpc - delta); -++ } -++ } -++ -++ nfs_close(nfs, nfsfh); -++ nfs_destroy_context(nfs); -++ nfs_destroy_url(url); -++ return 0; -++} -+-- -+1.9.1 -+ -+ -+From 225e1c47727871c6ca74d6e3fef79ee6234923a1 Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Sat, 7 Feb 2015 13:31:02 -0800 -+Subject: [PATCH 3/7] streaming: only try refilling 2 blocks at a time instead -+ of 4 -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ lib/libnfs.c | 4 ++-- -+ 1 file changed, 2 insertions(+), 2 deletions(-) -+ -+diff --git a/lib/libnfs.c b/lib/libnfs.c -+index 5fc921d..84e76b6 100644 -+--- a/lib/libnfs.c -++++ b/lib/libnfs.c -+@@ -2448,8 +2448,8 @@ static int nfs_pread_async_internal(struct nfs_context *nfs, struct nfsfh *nfsfh -+ nfsfh->sr->blocks[nfsfh->sr->num_blocks - 1].ptr = ptr; -+ } -+ -+- /* try to prefetch four more blocks */ -+- prefetch_streaming_blocks(nfs, nfsfh, offset + count, 4); -++ /* try to prefetch to more blocks */ -++ prefetch_streaming_blocks(nfs, nfsfh, offset + count, 2); -+ -+ /* can we service the request straight out of cache ? */ -+ if (offset < nfsfh->sr->buf_offset) { -+-- -+1.9.1 -+ -+ -+From ceb35bb17425dda7408ae43ae80a997f4e1c1f95 Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Sat, 7 Feb 2015 16:19:59 -0800 -+Subject: [PATCH 4/7] read 32kb at a time, not 8kb -+ -+crapadoodle, if we measure 32kb blob read speed we should actually read -+a 32kb blob too. not a 8kb one. -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ nfs-stream.c | 4 ++-- -+ 1 file changed, 2 insertions(+), 2 deletions(-) -+ -+diff --git a/nfs-stream.c b/nfs-stream.c -+index 5570cd6..dd01218 100644 -+--- a/nfs-stream.c -++++ b/nfs-stream.c -+@@ -47,13 +47,13 @@ int main(int argc, char *argv[]) -+ printf("Read one 32kb chunk every %d us\n", (int)tpc); -+ for (offset = 0; offset < st.nfs_size; offset += 32768) { -+ gettimeofday(&t1, NULL); -+- nfs_read(nfs, nfsfh, 8192, buf); -++ nfs_read(nfs, nfsfh, 32768, buf); -+ gettimeofday(&t2, NULL); -+ delta = t2.tv_sec * 1000000LL + t2.tv_usec - -+ t1.tv_sec * 1000000LL - t1.tv_usec; -+ printf("Read latency:%lld us\n", (long long)delta); -+ if (tpc > delta) { -+- printf("Sleep for %d us\n", (int)(tpc - delta)); -++ //printf("Sleep for %d us\n", (int)(tpc - delta)); -+ usleep(tpc - delta); -+ } -+ } -+-- -+1.9.1 -+ -+ -+From 5f5faa8cfb86057081ccb3e30f987ecdec40fa13 Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Mon, 9 Feb 2015 20:46:25 -0800 -+Subject: [PATCH 5/7] prefetch: limit the amount of prefetches we have in -+ flight to 2 -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ lib/libnfs.c | 16 +++++++++++++--- -+ nfs-stream.c | 7 +++++++ -+ 2 files changed, 20 insertions(+), 3 deletions(-) -+ -+diff --git a/lib/libnfs.c b/lib/libnfs.c -+index 84e76b6..929d3e0 100644 -+--- a/lib/libnfs.c -++++ b/lib/libnfs.c -+@@ -2103,8 +2103,6 @@ static void nfs_open_cb(struct rpc_context *rpc, int status, void *command_data, -+ nfsfh->fh = data->fh; -+ data->fh.data.data_val = NULL; -+ -+- nfs_set_streaming_mode(nfsfh, 200 * NFS_STREAM_BUF_SIZE); -+- -+ data->cb(0, nfs, nfsfh, data->private_data); -+ free_nfs_cb_data(data); -+ } -+@@ -2374,12 +2372,24 @@ static void nfs_stream_cb(struct rpc_context *rpc, int status, void *command_dat -+ -+ static void prefetch_streaming_blocks(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t next_offset, int num_blocks) -+ { -+- int i; -++ int i, num_pending = 0; -+ -+ for (i = 0; i < nfsfh->sr->num_blocks && num_blocks; i++) { -+ struct stream_cb_data *stream_data; -+ READ3args args; -+ -++ /* -++ * BSS_PENDING means we have a request for prefetch in flight. -++ * We don't want an unlimited amount of requests in flight -++ * since it can cause wild latency spikes while initially -++ * filling the prefetch buffer. -++ */ -++ if (nfsfh->sr->blocks[i].state == BSS_PENDING) { -++ num_pending++; -++ } -++ if (num_pending >= num_blocks) { -++ continue; -++ } -+ if (nfsfh->sr->blocks[i].state != BSS_UNUSED) { -+ continue; -+ } -+diff --git a/nfs-stream.c b/nfs-stream.c -+index dd01218..f5a1b0a 100644 -+--- a/nfs-stream.c -++++ b/nfs-stream.c -+@@ -18,6 +18,11 @@ int main(int argc, char *argv[]) -+ struct timeval t1, t2; -+ uint64_t delta, tpc; -+ -++ if (argc != 3) { -++ fprintf(stderr, "Usage: nfs-stream \n"); -++ exit(1); -++ } -++ -+ nfs = nfs_init_context(); -+ url = nfs_parse_url_full(nfs, argv[1]); -+ if (!url) { -+@@ -36,6 +41,8 @@ int main(int argc, char *argv[]) -+ nfs_get_error(nfs)); -+ exit(1); -+ } -++ nfs_set_streaming_mode(nfsfh, 5 * 1024 * 1024); -++ -+ if (nfs_fstat64(nfs, nfsfh, &st)) { -+ fprintf(stderr, "Failed to stat file %s: %s\n", -+ url->file, -+-- -+1.9.1 -+ -+ -+From 503492873f27cefc3bfb368a96c4c7e1c99b303f Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Tue, 10 Feb 2015 16:40:53 -0800 -+Subject: [PATCH 6/7] streaming mode: wait until we have 10 sequential reads -+ before we prefetch -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ lib/libnfs.c | 2 +- -+ 1 file changed, 1 insertion(+), 1 deletion(-) -+ -+diff --git a/lib/libnfs.c b/lib/libnfs.c -+index 929d3e0..53b71fd 100644 -+--- a/lib/libnfs.c -++++ b/lib/libnfs.c -+@@ -2433,7 +2433,7 @@ static int nfs_pread_async_internal(struct nfs_context *nfs, struct nfsfh *nfsfh -+ } -+ nfsfh->sr->next_offset = offset + count; -+ -+- if (nfsfh->sr->num_seq < 5) { -++ if (nfsfh->sr->num_seq < 10) { -+ goto end_of_streaming; -+ } -+ -+-- -+1.9.1 -+ -+ -+From 55a673ae81514f109553d36b71647e8c334f8d81 Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Wed, 11 Feb 2015 01:25:05 -0800 -+Subject: [PATCH 7/7] nfs-stream.c: move this tool to the examples directory -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ examples/nfs-stream.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ -+ nfs-stream.c | 72 --------------------------------------------------- -+ 2 files changed, 72 insertions(+), 72 deletions(-) -+ create mode 100644 examples/nfs-stream.c -+ delete mode 100644 nfs-stream.c -+ -+diff --git a/examples/nfs-stream.c b/examples/nfs-stream.c -+new file mode 100644 -+index 0000000..f5a1b0a -+--- /dev/null -++++ b/examples/nfs-stream.c -+@@ -0,0 +1,72 @@ -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#include "nfsc/libnfs.h" -++ -++int main(int argc, char *argv[]) -++{ -++ struct nfs_context *nfs; -++ struct nfs_url *url; -++ struct nfsfh *nfsfh = NULL; -++ struct nfs_stat_64 st; -++ uint64_t offset; -++ char buf[32768]; -++ struct timeval t1, t2; -++ uint64_t delta, tpc; -++ -++ if (argc != 3) { -++ fprintf(stderr, "Usage: nfs-stream \n"); -++ exit(1); -++ } -++ -++ nfs = nfs_init_context(); -++ url = nfs_parse_url_full(nfs, argv[1]); -++ if (!url) { -++ fprintf(stderr, "Can not parse URL. %s\n", -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ if (nfs_mount(nfs, url->server, url->path) != 0) { -++ fprintf(stderr, "Failed to mount nfs share : %s\n", -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ if (nfs_open(nfs, url->file, O_RDONLY, &nfsfh) != 0) { -++ fprintf(stderr, "Failed to open file %s: %s\n", -++ url->file, -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ nfs_set_streaming_mode(nfsfh, 5 * 1024 * 1024); -++ -++ if (nfs_fstat64(nfs, nfsfh, &st)) { -++ fprintf(stderr, "Failed to stat file %s: %s\n", -++ url->file, -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ printf("File size:%lld\n", (long long)st.nfs_size); -++ tpc = 1000000 / (strtol(argv[2], NULL, 10) / 32768); -++ printf("Read one 32kb chunk every %d us\n", (int)tpc); -++ for (offset = 0; offset < st.nfs_size; offset += 32768) { -++ gettimeofday(&t1, NULL); -++ nfs_read(nfs, nfsfh, 32768, buf); -++ gettimeofday(&t2, NULL); -++ delta = t2.tv_sec * 1000000LL + t2.tv_usec - -++ t1.tv_sec * 1000000LL - t1.tv_usec; -++ printf("Read latency:%lld us\n", (long long)delta); -++ if (tpc > delta) { -++ //printf("Sleep for %d us\n", (int)(tpc - delta)); -++ usleep(tpc - delta); -++ } -++ } -++ -++ nfs_close(nfs, nfsfh); -++ nfs_destroy_context(nfs); -++ nfs_destroy_url(url); -++ return 0; -++} -+diff --git a/nfs-stream.c b/nfs-stream.c -+deleted file mode 100644 -+index f5a1b0a..0000000 -+--- a/nfs-stream.c -++++ /dev/null -+@@ -1,72 +0,0 @@ -+-#include -+-#include -+-#include -+-#include -+-#include -+-#include -+-#include -+-#include "nfsc/libnfs.h" -+- -+-int main(int argc, char *argv[]) -+-{ -+- struct nfs_context *nfs; -+- struct nfs_url *url; -+- struct nfsfh *nfsfh = NULL; -+- struct nfs_stat_64 st; -+- uint64_t offset; -+- char buf[32768]; -+- struct timeval t1, t2; -+- uint64_t delta, tpc; -+- -+- if (argc != 3) { -+- fprintf(stderr, "Usage: nfs-stream \n"); -+- exit(1); -+- } -+- -+- nfs = nfs_init_context(); -+- url = nfs_parse_url_full(nfs, argv[1]); -+- if (!url) { -+- fprintf(stderr, "Can not parse URL. %s\n", -+- nfs_get_error(nfs)); -+- exit(1); -+- } -+- if (nfs_mount(nfs, url->server, url->path) != 0) { -+- fprintf(stderr, "Failed to mount nfs share : %s\n", -+- nfs_get_error(nfs)); -+- exit(1); -+- } -+- if (nfs_open(nfs, url->file, O_RDONLY, &nfsfh) != 0) { -+- fprintf(stderr, "Failed to open file %s: %s\n", -+- url->file, -+- nfs_get_error(nfs)); -+- exit(1); -+- } -+- nfs_set_streaming_mode(nfsfh, 5 * 1024 * 1024); -+- -+- if (nfs_fstat64(nfs, nfsfh, &st)) { -+- fprintf(stderr, "Failed to stat file %s: %s\n", -+- url->file, -+- nfs_get_error(nfs)); -+- exit(1); -+- } -+- printf("File size:%lld\n", (long long)st.nfs_size); -+- tpc = 1000000 / (strtol(argv[2], NULL, 10) / 32768); -+- printf("Read one 32kb chunk every %d us\n", (int)tpc); -+- for (offset = 0; offset < st.nfs_size; offset += 32768) { -+- gettimeofday(&t1, NULL); -+- nfs_read(nfs, nfsfh, 32768, buf); -+- gettimeofday(&t2, NULL); -+- delta = t2.tv_sec * 1000000LL + t2.tv_usec - -+- t1.tv_sec * 1000000LL - t1.tv_usec; -+- printf("Read latency:%lld us\n", (long long)delta); -+- if (tpc > delta) { -+- //printf("Sleep for %d us\n", (int)(tpc - delta)); -+- usleep(tpc - delta); -+- } -+- } -+- -+- nfs_close(nfs, nfsfh); -+- nfs_destroy_context(nfs); -+- nfs_destroy_url(url); -+- return 0; -+-} -+-- -+1.9.1 -diff --git a/tools/depends/target/libnfs/Makefile b/tools/depends/target/libnfs/Makefile -index 642fba8..aa6bde1 100644 ---- a/tools/depends/target/libnfs/Makefile -+++ b/tools/depends/target/libnfs/Makefile -@@ -25,6 +25,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); ./bootstrap - cd $(PLATFORM); patch -p0 < ../utils.patch - cd $(PLATFORM); patch -p1 < ../readahead.patch -+ cd $(PLATFORM); patch -p1 < ../0001-Sequential-Readahead-Mode.patch +diff --git a/tools/depends/target/libcec/Makefile b/tools/depends/target/libcec/Makefile +index 6c72240..4378628 100644 +--- a/tools/depends/target/libcec/Makefile ++++ b/tools/depends/target/libcec/Makefile +@@ -21,6 +21,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) + rm -rf $(PLATFORM); mkdir -p $(PLATFORM) + cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) + cd $(PLATFORM); $(AUTORECONF) -vif ++ cd $(PLATFORM); patch -p1 < ../popcornmix.patch cd $(PLATFORM); $(CONFIGURE) $(LIBDYLIB): $(PLATFORM) -diff --git a/xbmc/filesystem/DllLibNfs.h b/xbmc/filesystem/DllLibNfs.h -index 4b5ba29..9ba8ebc 100644 ---- a/xbmc/filesystem/DllLibNfs.h -+++ b/xbmc/filesystem/DllLibNfs.h -@@ -85,6 +85,7 @@ class DllLibNfsInterface - virtual int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf)=0; - virtual int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf)=0; - virtual int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, int whence, uint64_t *current_offset)=0; -+ virtual void nfs_set_streaming_mode(struct nfsfh *nfsfh, uint32_t v)=0; - }; - - class DllLibNfs : public DllDynamic, DllLibNfsInterface -@@ -131,6 +132,7 @@ class DllLibNfs : public DllDynamic, DllLibNfsInterface - DEFINE_METHOD5(int, nfs_pread, (struct nfs_context *p1, struct nfsfh *p2, uint64_t p3, uint64_t p4, char *p5)) - DEFINE_METHOD5(int, nfs_pwrite, (struct nfs_context *p1, struct nfsfh *p2, uint64_t p3, uint64_t p4, char *p5)) - DEFINE_METHOD5(int, nfs_lseek, (struct nfs_context *p1, struct nfsfh *p2, uint64_t p3, int p4, uint64_t *p5)) -+ DEFINE_METHOD2(void,nfs_set_streaming_mode, (struct nfsfh *p1, uint32_t p2)) - - - -@@ -176,6 +178,7 @@ class DllLibNfs : public DllDynamic, DllLibNfsInterface - RESOLVE_METHOD_RENAME(nfs_symlink, nfs_symlink) - RESOLVE_METHOD_RENAME(nfs_rename, nfs_rename) - RESOLVE_METHOD_RENAME(nfs_link, nfs_link) -+ RESOLVE_METHOD_RENAME(nfs_set_streaming_mode, nfs_set_streaming_mode) - END_METHOD_RESOLVE() - }; - -diff --git a/xbmc/filesystem/NFSFile.cpp b/xbmc/filesystem/NFSFile.cpp -index 9354fd5..eaa1dd7 100644 ---- a/xbmc/filesystem/NFSFile.cpp -+++ b/xbmc/filesystem/NFSFile.cpp -@@ -562,6 +562,8 @@ bool CNFSFile::Open(const CURL& url) - CLog::Log(LOGDEBUG,"CNFSFile::Open - opened %s",url.GetFileName().c_str()); - m_url=url; - -+ //gNfsConnection.GetImpl()->nfs_set_streaming_mode(m_pFileHandle, 5 * 1024 * 1024); +diff --git a/tools/depends/target/libcec/popcornmix.patch b/tools/depends/target/libcec/popcornmix.patch +new file mode 100644 +index 0000000..84adc8c +--- /dev/null ++++ b/tools/depends/target/libcec/popcornmix.patch +@@ -0,0 +1,615 @@ ++From 651fc15222923bcaea6f7925c207217a40e967ab Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Fri, 24 Oct 2014 13:45:21 +0100 ++Subject: [PATCH 1/5] Make released key polling wait for exact time until key ++ gets released + - struct __stat64 tmpBuffer; - - if( Stat(&tmpBuffer) ) ++--- ++ src/lib/CECClient.cpp | 28 ++++++++++++++++++++++++---- ++ src/lib/CECClient.h | 2 +- ++ src/lib/CECProcessor.cpp | 8 +++++--- ++ src/lib/LibCEC.cpp | 10 ++++++++-- ++ src/lib/LibCEC.h | 4 +++- ++ 5 files changed, 41 insertions(+), 11 deletions(-) ++ ++diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp ++index 0bc9705..5fb1e6a 100644 ++--- a/src/lib/CECClient.cpp +++++ b/src/lib/CECClient.cpp ++@@ -1057,10 +1057,16 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) ++ AddKey(key); ++ } ++ ++-void CCECClient::CheckKeypressTimeout(void) +++uint16_t CCECClient::CheckKeypressTimeout(void) ++ { +++ // time when we'd like to be called again +++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ cec_keypress key; +++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +++ key.duration = 0; ++ +++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) +++ return timeout; ++ { ++ CLockObject lock(m_mutex); ++ uint64_t iNow = GetTimeMs(); ++@@ -1081,12 +1087,26 @@ void CCECClient::CheckKeypressTimeout(void) ++ } ++ else ++ { ++- return; +++ // time when this keypress will be released and we'd like to be called again +++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) +++ timeout = iTimeoutMs - (iNow - m_buttontime) + 1; +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) +++ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; +++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) +++ { +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ } ++ } ++ } ++ ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); ++- CallbackAddKey(key); +++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); +++ CallbackAddKey(key); +++ } +++ return timeout; ++ } ++ ++ bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) ++diff --git a/src/lib/CECClient.h b/src/lib/CECClient.h ++index 3ef0453..88efbbb 100644 ++--- a/src/lib/CECClient.h +++++ b/src/lib/CECClient.h ++@@ -182,7 +182,7 @@ namespace CEC ++ virtual void AddKey(bool bSendComboKey = false); ++ virtual void AddKey(const cec_keypress &key); ++ virtual void SetCurrentButton(const cec_user_control_code iButtonCode); ++- virtual void CheckKeypressTimeout(void); +++ virtual uint16_t CheckKeypressTimeout(void); ++ virtual void SourceActivated(const cec_logical_address logicalAddress); ++ virtual void SourceDeactivated(const cec_logical_address logicalAddress); ++ ++diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp ++index 557b76d..ecf9244 100644 ++--- a/src/lib/CECProcessor.cpp +++++ b/src/lib/CECProcessor.cpp ++@@ -51,7 +51,6 @@ using namespace CEC; ++ using namespace std; ++ using namespace PLATFORM; ++ ++-#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 ++ #define ACTIVE_SOURCE_CHECK_INTERVAL 500 ++ #define TV_PRESENT_CHECK_INTERVAL 30000 ++ ++@@ -244,6 +243,7 @@ bool CCECProcessor::OnCommandReceived(const cec_command &command) ++ ++ void *CCECProcessor::Process(void) ++ { +++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started"); ++ ++ if (!m_connCheck) ++@@ -258,13 +258,13 @@ void *CCECProcessor::Process(void) ++ while (!IsStopped() && m_communication->IsOpen()) ++ { ++ // wait for a new incoming command, and process it ++- if (m_inBuffer.Pop(command, CEC_PROCESSOR_SIGNAL_WAIT_TIME)) +++ if (m_inBuffer.Pop(command, timeout)) ++ ProcessCommand(command); ++ ++ if (CECInitialised() && !IsStopped()) ++ { ++ // check clients for keypress timeouts ++- m_libcec->CheckKeypressTimeout(); +++ timeout = m_libcec->CheckKeypressTimeout(); ++ ++ // check if we need to replace handlers ++ ReplaceHandlers(); ++@@ -295,6 +295,8 @@ void *CCECProcessor::Process(void) ++ tvPresentCheck.Init(TV_PRESENT_CHECK_INTERVAL); ++ } ++ } +++ else +++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ ++ return NULL; ++diff --git a/src/lib/LibCEC.cpp b/src/lib/LibCEC.cpp ++index c24b4ed..046205c 100644 ++--- a/src/lib/LibCEC.cpp +++++ b/src/lib/LibCEC.cpp ++@@ -354,11 +354,17 @@ bool CLibCEC::IsValidPhysicalAddress(uint16_t iPhysicalAddress) ++ iPhysicalAddress <= CEC_MAX_PHYSICAL_ADDRESS; ++ } ++ ++-void CLibCEC::CheckKeypressTimeout(void) +++uint16_t CLibCEC::CheckKeypressTimeout(void) ++ { +++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ // check all clients ++ for (vector::iterator it = m_clients.begin(); it != m_clients.end(); it++) ++- (*it)->CheckKeypressTimeout(); +++ { +++ uint16_t t = (*it)->CheckKeypressTimeout(); +++ if (t < timeout) +++ timeout = t; +++ } +++ return timeout; ++ } ++ ++ void CLibCEC::AddLog(const cec_log_level level, const char *strFormat, ...) ++diff --git a/src/lib/LibCEC.h b/src/lib/LibCEC.h ++index 3a312c0..b7ac645 100644 ++--- a/src/lib/LibCEC.h +++++ b/src/lib/LibCEC.h ++@@ -36,6 +36,8 @@ ++ #include "platform/util/buffer.h" ++ #include "CECTypeUtils.h" ++ +++#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 +++ ++ namespace CEC ++ { ++ class CAdapterCommunication; ++@@ -121,7 +123,7 @@ namespace CEC ++ ++ void AddLog(const cec_log_level level, const char *strFormat, ...); ++ void AddCommand(const cec_command &command); ++- void CheckKeypressTimeout(void); +++ uint16_t CheckKeypressTimeout(void); ++ void Alert(const libcec_alert type, const libcec_parameter ¶m); ++ ++ static bool IsValidPhysicalAddress(uint16_t iPhysicalAddress); ++-- ++1.9.1 ++ ++ ++From d506af4cff04156391f34d07f921e02c41a563b7 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Mon, 24 Nov 2014 23:18:52 +0000 ++Subject: [PATCH 2/5] Add settings for repeat and release ++ ++--- ++ include/cectypes.h | 6 ++++++ ++ src/lib/CECClient.cpp | 6 ++++++ ++ 2 files changed, 12 insertions(+) ++ ++diff --git a/include/cectypes.h b/include/cectypes.h ++index 0a90d0e..b75b1b3 100644 ++--- a/include/cectypes.h +++++ b/include/cectypes.h ++@@ -1532,6 +1532,8 @@ struct libcec_configuration ++ XXX changed meaning in 2.2.0 to not break binary compatibility. next major (3.0) release will fix it in a nicer way */ ++ cec_user_control_code comboKey; /*!< key code that initiates combo keys. defaults to CEC_USER_CONTROL_CODE_F1_BLUE. CEC_USER_CONTROL_CODE_UNKNOWN to disable. added in 2.0.5 */ ++ uint32_t iComboKeyTimeoutMs; /*!< timeout until the combo key is sent as normal keypress */ +++ uint32_t iButtonRepeatRateMs; /*!< rate at which buttons autorepeat. 0 means rely on CEC device */ +++ uint32_t iButtonReleaseDelayMs;/*!< duration after last update until a button is considered released */ ++ ++ #ifdef __cplusplus ++ libcec_configuration(void) { Clear(); } ++@@ -1566,6 +1568,8 @@ struct libcec_configuration ++ cecVersion == other.cecVersion && ++ adapterType == other.adapterType && ++ iDoubleTapTimeout50Ms == other.iDoubleTapTimeout50Ms && +++ iButtonRepeatRateMs == other.iButtonRepeatRateMs && +++ iButtonReleaseDelayMs == other.iButtonReleaseDelayMs && ++ (other.clientVersion <= CEC_CLIENT_VERSION_2_0_4 || comboKey == other.comboKey) && ++ (other.clientVersion <= CEC_CLIENT_VERSION_2_0_4 || iComboKeyTimeoutMs == other.iComboKeyTimeoutMs) && ++ (other.clientVersion < CEC_CLIENT_VERSION_2_1_0 || bPowerOnScreensaver == other.bPowerOnScreensaver)); ++@@ -1606,6 +1610,8 @@ struct libcec_configuration ++ iDoubleTapTimeout50Ms = CEC_DOUBLE_TAP_TIMEOUT_50_MS; ++ comboKey = CEC_USER_CONTROL_CODE_STOP; ++ iComboKeyTimeoutMs = CEC_DEFAULT_COMBO_TIMEOUT_MS; +++ iButtonRepeatRateMs = 0; +++ iButtonReleaseDelayMs = CEC_BUTTON_TIMEOUT; ++ ++ memset(strDeviceName, 0, 13); ++ deviceTypes.Clear(); ++diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp ++index 5fb1e6a..02f5f4a 100644 ++--- a/src/lib/CECClient.cpp +++++ b/src/lib/CECClient.cpp ++@@ -834,6 +834,9 @@ bool CCECClient::GetCurrentConfiguration(libcec_configuration &configuration) ++ configuration.bMonitorOnly = m_configuration.bMonitorOnly; ++ configuration.cecVersion = m_configuration.cecVersion; ++ configuration.adapterType = m_configuration.adapterType; +++ configuration.iDoubleTapTimeout50Ms = m_configuration.iDoubleTapTimeout50Ms; +++ configuration.iButtonRepeatRateMs = m_configuration.iButtonRepeatRateMs; +++ configuration.iButtonReleaseDelayMs = m_configuration.iButtonReleaseDelayMs; ++ ++ return true; ++ } ++@@ -877,6 +880,9 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) ++ m_configuration.cecVersion = configuration.cecVersion; ++ m_configuration.adapterType = configuration.adapterType; ++ m_configuration.iDoubleTapTimeout50Ms = configuration.iDoubleTapTimeout50Ms; +++ m_configuration.iButtonRepeatRateMs = configuration.iButtonRepeatRateMs; +++ m_configuration.iButtonReleaseDelayMs = configuration.iButtonReleaseDelayMs; +++ ++ m_configuration.deviceTypes.Add(configuration.deviceTypes[0]); ++ ++ if (m_configuration.clientVersion >= CEC_CLIENT_VERSION_2_0_5) ++-- ++1.9.1 ++ ++ ++From b6a6cc8ad12571dff0e02bc9a38ce97a00424df0 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Mon, 24 Nov 2014 23:20:05 +0000 ++Subject: [PATCH 3/5] Distinguish explicit and implicit forms of AddKey ++ releases ++ ++--- ++ src/lib/CECClient.cpp | 2 +- ++ src/lib/CECClient.h | 2 +- ++ src/lib/implementations/CECCommandHandler.cpp | 2 +- ++ 3 files changed, 3 insertions(+), 3 deletions(-) ++ ++diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp ++index 02f5f4a..3663b24 100644 ++--- a/src/lib/CECClient.cpp +++++ b/src/lib/CECClient.cpp ++@@ -968,7 +968,7 @@ int CCECClient::MenuStateChanged(const cec_menu_state newState) ++ return CallbackMenuStateChanged(newState); ++ } ++ ++-void CCECClient::AddKey(bool bSendComboKey /* = false */) +++void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* = false */) ++ { ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++diff --git a/src/lib/CECClient.h b/src/lib/CECClient.h ++index 88efbbb..84fb909 100644 ++--- a/src/lib/CECClient.h +++++ b/src/lib/CECClient.h ++@@ -179,7 +179,7 @@ namespace CEC ++ virtual int MenuStateChanged(const cec_menu_state newState); ++ virtual void Alert(const libcec_alert type, const libcec_parameter ¶m) { CallbackAlert(type, param); } ++ virtual void AddLog(const cec_log_message &message) { CallbackAddLog(message); } ++- virtual void AddKey(bool bSendComboKey = false); +++ virtual void AddKey(bool bSendComboKey = false, bool bButtonRelease = false); ++ virtual void AddKey(const cec_keypress &key); ++ virtual void SetCurrentButton(const cec_user_control_code iButtonCode); ++ virtual uint16_t CheckKeypressTimeout(void); ++diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp ++index a89ebe6..932c54b 100644 ++--- a/src/lib/implementations/CECCommandHandler.cpp +++++ b/src/lib/implementations/CECCommandHandler.cpp ++@@ -745,7 +745,7 @@ int CCECCommandHandler::HandleUserControlRelease(const cec_command &command) ++ ++ CCECClient *client = m_processor->GetClient(command.destination); ++ if (client) ++- client->AddKey(); +++ client->AddKey(false, true); ++ ++ return COMMAND_HANDLED; ++ } ++-- ++1.9.1 ++ ++ ++From 3b7606a9e0653149ae4b6e80d0df9c53645bfac9 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Mon, 24 Nov 2014 23:20:22 +0000 ++Subject: [PATCH 4/5] Support repeating button presses with configurable repeat ++ rate Keep track of time since initial button press and last button update ++ ++--- ++ src/lib/CECClient.cpp | 119 ++++++++++++++++++++++++++++++++++++++++---------- ++ src/lib/CECClient.h | 6 ++- ++ 2 files changed, 101 insertions(+), 24 deletions(-) ++ ++diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp ++index 3663b24..68eaee9 100644 ++--- a/src/lib/CECClient.cpp +++++ b/src/lib/CECClient.cpp ++@@ -52,7 +52,11 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_bInitialised(false), ++ m_bRegistered(false), ++ m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), ++- m_buttontime(0), +++ m_initialButtontime(0), +++ m_updateButtontime(0), +++ m_repeatButtontime(0), +++ m_releaseButtontime(0), +++ m_pressedButtoncount(0), ++ m_iPreventForwardingPowerOffCommand(0), ++ m_iLastKeypressTime(0) ++ { ++@@ -939,6 +943,7 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) ++ primary->ActivateSource(); ++ } ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: %d:%d:%d", __FUNCTION__, DoubleTapTimeoutMS(), m_configuration.iButtonRepeatRateMs, m_configuration.iButtonReleaseDelayMs); ++ return true; ++ } ++ ++@@ -977,9 +982,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++- key.duration = (unsigned int) (GetTimeMs() - m_buttontime); +++ unsigned int duration = (unsigned int) (GetTimeMs() - m_updateButtontime); +++ key.duration = (unsigned int) (GetTimeMs() - m_initialButtontime); ++ ++- if (key.duration > m_configuration.iComboKeyTimeoutMs || +++ if (duration > m_configuration.iComboKeyTimeoutMs || ++ m_configuration.iComboKeyTimeoutMs == 0 || ++ m_iCurrentButton != m_configuration.comboKey || ++ bSendComboKey) ++@@ -987,14 +993,22 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* ++ key.keycode = m_iCurrentButton; ++ ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_buttontime = 0; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; ++ } ++ } ++ } ++ +++ // we don't forward releases when supporting repeating keys +++ if (bButtonRelease && m_configuration.iButtonRepeatRateMs) +++ return; +++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x)", ToString(key.keycode), key.keycode); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++ CallbackAddKey(key); ++ } ++ } ++@@ -1005,10 +1019,11 @@ void CCECClient::AddKey(const cec_keypress &key) ++ key.keycode < CEC_USER_CONTROL_CODE_SELECT) ++ { ++ // send back the previous key if there is one +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Unexpected key %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(); ++ return; ++ } ++- +++ bool isrepeat = false; ++ cec_keypress transmitKey(key); ++ cec_user_control_code comboKey(m_configuration.clientVersion >= CEC_CLIENT_VERSION_2_0_5 ? ++ m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); ++@@ -1028,27 +1043,60 @@ void CCECClient::AddKey(const cec_keypress &key) ++ transmitKey.keycode = CEC_USER_CONTROL_CODE_DOT; ++ // default, send back the previous key ++ else +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Combo key %s (%1x) D%dms:", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(true); +++ } ++ } ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); +++ ++ if (m_iCurrentButton == key.keycode) ++ { ++- m_buttontime = GetTimeMs(); +++ m_updateButtontime = GetTimeMs(); +++ m_releaseButtontime = m_updateButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); +++ // want to have seen some updated before considering a repeat +++ if (m_configuration.iButtonRepeatRateMs) +++ { +++ if (!m_repeatButtontime && m_pressedButtoncount > 1) +++ m_repeatButtontime = m_initialButtontime + DoubleTapTimeoutMS(); +++ isrepeat = true; +++ } +++ m_pressedButtoncount++; ++ } ++ else ++ { ++- AddKey(); +++ if (m_iCurrentButton != transmitKey.keycode) +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Changed key %s (%1x) D:%dms cur:%lx", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration, m_iCurrentButton); +++ AddKey(); +++ } ++ if (key.duration == 0) ++ { ++ m_iCurrentButton = transmitKey.keycode; ++- m_buttontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); +++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) +++ { +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ } +++ else +++ { +++ m_initialButtontime = GetTimeMs(); +++ m_updateButtontime = m_initialButtontime; +++ m_repeatButtontime = 0; // set this on next update +++ m_releaseButtontime = m_initialButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); +++ m_pressedButtoncount = 1; +++ } ++ } ++ } ++ } ++ ++- if (key.keycode != comboKey || key.duration > 0) +++ if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) ++ { ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x, %d)", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration); ++ CallbackAddKey(transmitKey); ++ } ++ } ++@@ -1060,6 +1108,7 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) ++ key.duration = 0; ++ key.keycode = iButtonCode; ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "SetCurrentButton %s (%1x) D:%dms cur:%lx", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(key); ++ } ++ ++@@ -1076,35 +1125,59 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ { ++ CLockObject lock(m_mutex); ++ uint64_t iNow = GetTimeMs(); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s T:%.3f", __FUNCTION__, iNow*1e-3); ++ cec_user_control_code comboKey(m_configuration.clientVersion >= CEC_CLIENT_VERSION_2_0_5 ? ++ m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); ++ uint32_t iTimeoutMs(m_configuration.clientVersion >= CEC_CLIENT_VERSION_2_0_5 ? ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_buttontime > iTimeoutMs) || ++- (m_iCurrentButton != comboKey && iNow - m_buttontime > CEC_BUTTON_TIMEOUT))) +++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) ++ { ++- key.duration = (unsigned int) (iNow - m_buttontime); +++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++ ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_buttontime = 0; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ } +++ else if (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) +++ { +++ key.duration = (unsigned int) (iNow - m_initialButtontime); +++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +++ +++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ } +++ else if (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime) +++ { +++ key.duration = (unsigned int) (iNow - m_initialButtontime); +++ key.keycode = m_iCurrentButton; +++ m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; +++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ } ++ else ++ { ++- // time when this keypress will be released and we'd like to be called again ++- unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) ++- timeout = iTimeoutMs - (iNow - m_buttontime) + 1; ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) ++- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; +++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0) +++ timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); +++ if (m_iCurrentButton != comboKey && m_releaseButtontime) +++ timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); +++ if (m_iCurrentButton != comboKey && m_repeatButtontime) +++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, m_releaseButtontime*1e-3, m_iCurrentButton); ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ } +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Key %s: %s (duration:%d) (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d)", ToString(m_iCurrentButton), key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : m_repeatButtontime ? "repeated" : "released", key.duration, +++ m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount); ++ } ++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++diff --git a/src/lib/CECClient.h b/src/lib/CECClient.h ++index 84fb909..27af3f9 100644 ++--- a/src/lib/CECClient.h +++++ b/src/lib/CECClient.h ++@@ -311,7 +311,11 @@ namespace CEC ++ PLATFORM::CMutex m_mutex; /**< mutex for changes to this instance */ ++ PLATFORM::CMutex m_cbMutex; /**< mutex that is held when doing anything with callbacks */ ++ cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ ++- int64_t m_buttontime; /**< the timestamp when the button was pressed (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_repeatButtontime; /**< the timestamp when the button will next repeat (in seconds since epoch), or 0 if repeat is disabled. */ +++ int64_t m_releaseButtontime; /**< the timestamp when the button will be released (in seconds since epoch), or 0 if none was pressed. */ +++ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++ int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++ cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++-- ++1.9.1 ++ ++ ++From 23860987ec534a4aecf93100bef3736c2620fb93 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Tue, 28 Oct 2014 01:21:35 +0000 ++Subject: [PATCH 5/5] Skip double press removal. It is handled through other ++ means. ++ ++--- ++ src/lib/CECClient.cpp | 18 +----------------- ++ src/lib/CECClient.h | 2 -- ++ 2 files changed, 1 insertion(+), 19 deletions(-) ++ ++diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp ++index 68eaee9..9b4b533 100644 ++--- a/src/lib/CECClient.cpp +++++ b/src/lib/CECClient.cpp ++@@ -57,11 +57,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_repeatButtontime(0), ++ m_releaseButtontime(0), ++ m_pressedButtoncount(0), ++- m_iPreventForwardingPowerOffCommand(0), ++- m_iLastKeypressTime(0) +++ m_iPreventForwardingPowerOffCommand(0) ++ { ++- m_lastKeypress.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_lastKeypress.duration = 0; ++ m_configuration.Clear(); ++ // set the initial configuration ++ SetConfiguration(configuration); ++@@ -1568,20 +1565,7 @@ void CCECClient::CallbackAddKey(const cec_keypress &key) ++ { ++ CLockObject lock(m_cbMutex); ++ if (m_configuration.callbacks && m_configuration.callbacks->CBCecKeyPress) ++- { ++- // prevent double taps ++- int64_t now = GetTimeMs(); ++- if (m_lastKeypress.keycode != key.keycode || ++- key.duration > 0 || ++- now - m_iLastKeypressTime >= DoubleTapTimeoutMS()) ++- { ++- // no double tap ++- if (key.duration == 0) ++- m_iLastKeypressTime = now; ++- m_lastKeypress = key; ++ m_configuration.callbacks->CBCecKeyPress(m_configuration.callbackParam, key); ++- } ++- } ++ } ++ ++ void CCECClient::CallbackAddLog(const cec_log_message &message) ++diff --git a/src/lib/CECClient.h b/src/lib/CECClient.h ++index 27af3f9..eb11d9b 100644 ++--- a/src/lib/CECClient.h +++++ b/src/lib/CECClient.h ++@@ -317,7 +317,5 @@ namespace CEC ++ int64_t m_releaseButtontime; /**< the timestamp when the button will be released (in seconds since epoch), or 0 if none was pressed. */ ++ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++- int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++- cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++ }; ++ } ++-- ++1.9.1 -From 37b404211c9d8c6e1545f2f6fd6dda25ce553ad7 Mon Sep 17 00:00:00 2001 +From 37c1e4ba09cacd1fd0bf30883606fcab6c51d71d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 15 Feb 2015 14:06:12 +0000 -Subject: [PATCH 53/89] [mmal] Allow mmal codec for dvd stills +Subject: [PATCH 29/56] [mmal] Allow mmal codec for dvd stills --- xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -index 0cd267a..9d8de2a 100644 +index 0a16b4b..b77a168 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -@@ -49,6 +49,9 @@ +@@ -50,6 +50,9 @@ #include "Video/DVDVideoCodecAndroidMediaCodec.h" #include "android/activity/AndroidFeatures.h" #endif @@ -4788,300 +2239,10 @@ index 0cd267a..9d8de2a 100644 { // If dvd is an mpeg2 and hint.stills -From 1c666d5d6570d68e1099f8961cc9f2c52d6e04e1 Mon Sep 17 00:00:00 2001 -From: Claudio-Sjo -Date: Mon, 16 Feb 2015 14:51:26 +0100 -Subject: [PATCH 54/89] - allow reads < CDIO_CD_FRAMESIZE_RAW by using a buffer - - fixes #15794 - ---- - xbmc/filesystem/CDDAFile.cpp | 120 ++++++++++++++++++++++++++++++++----------- - xbmc/filesystem/CDDAFile.h | 3 ++ - 2 files changed, 92 insertions(+), 31 deletions(-) - -diff --git a/xbmc/filesystem/CDDAFile.cpp b/xbmc/filesystem/CDDAFile.cpp -index 16796f5..066b49f 100644 ---- a/xbmc/filesystem/CDDAFile.cpp -+++ b/xbmc/filesystem/CDDAFile.cpp -@@ -43,10 +43,14 @@ CFileCDDA::CFileCDDA(void) - m_lsnEnd = CDIO_INVALID_LSN; - m_cdio = CLibcdio::GetInstance(); - m_iSectorCount = 52; -+ m_TrackBuf = (uint8_t *) malloc(CDIO_CD_FRAMESIZE_RAW); -+ p_TrackBuf = 0; -+ f_TrackBuf = 0; - } - - CFileCDDA::~CFileCDDA(void) - { -+ free(m_TrackBuf); - Close(); - } - -@@ -54,6 +58,9 @@ bool CFileCDDA::Open(const CURL& url) - { - std::string strURL = url.GetWithoutFilename(); - -+ // Flag TrackBuffer = FALSE, TrackBuffer is empty -+ f_TrackBuf = 0; -+ - if (!g_mediaManager.IsDiscInDrive(strURL) || !IsValidFile(url)) - return false; - -@@ -118,50 +125,98 @@ int CFileCDDA::Stat(const CURL& url, struct __stat64* buffer) - - ssize_t CFileCDDA::Read(void* lpBuf, size_t uiBufSize) - { -- if (!m_pCdIo || !g_mediaManager.IsDiscInDrive()) -- return -1; - -- if (uiBufSize > SSIZE_MAX) -- uiBufSize = SSIZE_MAX; -+ ssize_t returnValue; -+ int iSectorCount; -+ void *destBuf; - -- // limit number of sectors that fits in buffer by m_iSectorCount -- int iSectorCount = std::min((int)uiBufSize / CDIO_CD_FRAMESIZE_RAW, m_iSectorCount); - -- if (iSectorCount <= 0) -+ if (!m_pCdIo || !g_mediaManager.IsDiscInDrive()) -+ { -+ CLog::Log(LOGERROR, "file cdda: Aborted because no disc in drive or no m_pCdIo"); - return -1; -+ } - -- // Are there enough sectors left to read -- if (m_lsnCurrent + iSectorCount > m_lsnEnd) -- iSectorCount = m_lsnEnd - m_lsnCurrent; -+ uiBufSize = std::min( uiBufSize, (size_t)SSIZE_MAX ); - -- // The loop tries to solve read error problem by lowering number of sectors to read (iSectorCount). -- // When problem is solved the proper number of sectors is stored in m_iSectorCount -- int big_iSectorCount = iSectorCount; -- while (iSectorCount > 0) -+ // If we have data in the TrackBuffer, they must be used first -+ if (f_TrackBuf) - { -- int iret = m_cdio->cdio_read_audio_sectors(m_pCdIo, lpBuf, m_lsnCurrent, iSectorCount); -+ // Get at most the remaining data in m_TrackBuf -+ uiBufSize = std::min(uiBufSize, CDIO_CD_FRAMESIZE_RAW - p_TrackBuf); -+ memcpy(lpBuf, m_TrackBuf + p_TrackBuf, uiBufSize); -+ // Update the data offset -+ p_TrackBuf += uiBufSize; -+ // Is m_TrackBuf empty? -+ f_TrackBuf = (CDIO_CD_FRAMESIZE_RAW == p_TrackBuf); -+ // All done, return read bytes -+ return uiBufSize; -+ } -+ -+ // No data left in buffer -+ -+ // Is this a short read? -+ if (uiBufSize < CDIO_CD_FRAMESIZE_RAW) -+ { -+ // short request, buffer one full sector -+ iSectorCount = 1; -+ destBuf = m_TrackBuf; -+ } -+ else // normal request -+ { -+ // limit number of sectors that fits in buffer by m_iSectorCount -+ iSectorCount = std::min((int)uiBufSize / CDIO_CD_FRAMESIZE_RAW, m_iSectorCount); -+ destBuf = lpBuf; -+ } - -+ // Are there enough sectors left to read? -+ iSectorCount = std::min(iSectorCount, m_lsnEnd - m_lsnCurrent); -+ -+ // Have we reached EOF? -+ if (iSectorCount == 0) -+ { -+ CLog::Log(LOGNOTICE, "file cdda: Read EoF"); -+ return 0; // Success, but nothing read -+ } // Reached EoF -+ -+ // At leat one sector to read -+ int retries; -+ int iret; -+ // Try reading a decresing number of sectors, then 3 times with 1 sector -+ for (retries = 3; retries > 0; iSectorCount>1 ? iSectorCount-- : retries--) -+ { -+ iret = m_cdio->cdio_read_audio_sectors(m_pCdIo, destBuf, m_lsnCurrent, iSectorCount); - if (iret == DRIVER_OP_SUCCESS) -+ break; // Get out from the loop -+ else - { -- // If lower iSectorCount solved the problem limit it's value -- if (iSectorCount < big_iSectorCount) -- { -- m_iSectorCount = iSectorCount; -- } -- break; -- } -- -- // iSectorCount is low so it cannot solve read problem -- if (iSectorCount <= 10) -- { -- CLog::Log(LOGERROR, "file cdda: Reading %d sectors of audio data starting at lsn %d failed with error code %i", iSectorCount, m_lsnCurrent, iret); -- return -1; -- } -- -- iSectorCount = 10; -+ CLog::Log(LOGERROR, "file cdda: Read cdio error when reading track "); -+ } // Errors when reading file - } -+ // retries == 0 only if failed reading at least one sector -+ if (retries == 0) -+ { -+ CLog::Log(LOGERROR, "file cdda: Reading %d sectors of audio data starting at lsn %d failed with error code %i", iSectorCount, m_lsnCurrent, iret); -+ return -1; -+ } -+ -+ // Update position in file - m_lsnCurrent += iSectorCount; - -+ // Was it a short request? -+ if (uiBufSize < CDIO_CD_FRAMESIZE_RAW) -+ { -+ // We copy the amount if requested data into the destination buffer -+ memcpy(lpBuf, m_TrackBuf, uiBufSize); -+ // and keep track of the first available data -+ p_TrackBuf = uiBufSize; -+ // Finally, we set the buffer flag as TRUE -+ f_TrackBuf = true; -+ // We will return uiBufSize -+ return uiBufSize; -+ } -+ -+ // Otherwise, just return the size of read data - return iSectorCount*CDIO_CD_FRAMESIZE_RAW; - } - -@@ -195,6 +250,9 @@ int64_t CFileCDDA::Seek(int64_t iFilePosition, int iWhence /*=SEEK_SET*/) - - void CFileCDDA::Close() - { -+ // Flag TrackBuffer = FALSE, TrackBuffer is empty -+ f_TrackBuf = 0; -+ - if (m_pCdIo) - { - m_cdio->cdio_destroy(m_pCdIo); -diff --git a/xbmc/filesystem/CDDAFile.h b/xbmc/filesystem/CDDAFile.h -index 0427af4..e992362 100644 ---- a/xbmc/filesystem/CDDAFile.h -+++ b/xbmc/filesystem/CDDAFile.h -@@ -50,6 +50,9 @@ class CFileCDDA : public IFile - - protected: - CdIo_t* m_pCdIo; -+ uint8_t *m_TrackBuf; -+ size_t p_TrackBuf; -+ int f_TrackBuf; - lsn_t m_lsnStart; // Start of m_iTrack in logical sector number - 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 bc5577e298d7939945b5700dbbbc42b4fe196a1e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 20 Feb 2015 14:11:57 +0000 -Subject: [PATCH 55/89] libavformat: add mvcC handling in .mov/.mp4 - ---- - ...ibavformat-add-mvcC-handling-in-.mov-.mp4.patch | 57 ++++++++++++++++++++++ - tools/depends/target/ffmpeg/Makefile | 3 +- - 2 files changed, 59 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch - -diff --git a/tools/depends/target/ffmpeg/0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch b/tools/depends/target/ffmpeg/0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch -new file mode 100644 -index 0000000..72fbcb9 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch -@@ -0,0 +1,57 @@ -+From 40bca2ae81bb9cd131b90bf262e976674ca6fab8 Mon Sep 17 00:00:00 2001 -+From: Deborah Crook -+Date: Fri, 16 Jan 2015 14:24:17 +0000 -+Subject: [PATCH] libavformat: add mvcC handling in .mov/.mp4 -+ -+--- -+ libavformat/mov.c | 28 ++++++++++++++++++++++++++++ -+ 1 file changed, 28 insertions(+) -+ -+diff --git a/libavformat/mov.c b/libavformat/mov.c -+index 7455e3b..29bfec9 100644 -+--- a/libavformat/mov.c -++++ b/libavformat/mov.c -+@@ -1201,6 +1201,33 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) -+ return 0; -+ } -+ -++static int mov_read_mvcc(MOVContext *c, AVIOContext *pb, MOVAtom atom) -++{ -++ int extradata_size; -++ int ret, i; -++ uint32_t n; -++ AVStream *st; -++ -++ if (c->fc->nb_streams < 1) -++ return 0; -++ st = c->fc->streams[c->fc->nb_streams-1]; -++ extradata_size = st->codec->extradata_size; -++ -++ if ((uint64_t)atom.size > (1<<30)) -++ return AVERROR_INVALIDDATA; -++ -++ if (extradata_size == 0) -++ return 0; -++ if ((ret = mov_read_extradata(c, pb, atom, AV_CODEC_ID_H264)) < 0) -++ return ret; -++ for (i = 0, n = 0; i < 4; i++) -++ n = (n << 8) | st->codec->extradata[extradata_size+i]; -++ n -= 4; -++ for (i = 0; i < 4; i++) -++ st->codec->extradata[extradata_size+i] = (n >> ((3 - i) << 3)) & 0xff; -++ return 0; -++} -++ -+ static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom) -+ { -+ AVStream *st; -+@@ -3383,6 +3410,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { -+ { MKTAG('C','i','n', 0x8e), mov_read_targa_y216 }, -+ { MKTAG('f','r','e','e'), mov_read_free }, -+ { MKTAG('-','-','-','-'), mov_read_custom }, -++{ MKTAG('m','v','c','C'), mov_read_mvcc }, -+ { 0, NULL } -+ }; -+ -+-- -+1.7.10.4 -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 6e8364a..43dc4ff 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -1,6 +1,6 @@ - include ../../Makefile.include - include FFMPEG-VERSION --DEPS= ../../Makefile.include FFMPEG-VERSION Makefile ffmpeg_Speed_up_wtv_index_creation.patch -+DEPS= ../../Makefile.include FFMPEG-VERSION Makefile ffmpeg_Speed_up_wtv_index_creation.patch 0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -69,6 +69,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) - cd $(PLATFORM); sed -i".bak" -e "s%pkg_config_default=pkg-config%export PKG_CONFIG_LIBDIR=$(PREFIX)/lib/pkgconfig \&\& pkg_config_default=$(NATIVEPREFIX)/bin/pkg-config%" configure - cd $(PLATFORM); patch -p3 < ../ffmpeg_Speed_up_wtv_index_creation.patch -+ cd $(PLATFORM); patch -p1 < ../0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - ./configure $(ffmpg_config) - -From fccae33d78ecc18c9edcec5f6e5a36005c6b8b8c Mon Sep 17 00:00:00 2001 +From e1e93abe7d9cb7e9232c67c6d1362fa294c290cb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 24 Feb 2015 15:57:29 +0000 -Subject: [PATCH 56/89] [mmalrenderer] Fix for stereo view modes +Subject: [PATCH 30/56] [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 @@ -5106,456 +2267,10 @@ index 3329980..d53de35 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 76958643f9e7aa870f3038a960baf3f987c39be8 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 27 Feb 2015 14:37:27 +0000 -Subject: [PATCH 57/89] ffmpeg: Add some upstream HEVC optimisations - ---- - tools/depends/target/ffmpeg/Makefile | 5 +- - ...hevcdsp_ARM_NEON_optimized_epel_functions.patch | 406 +++++++++++++++++++++ - 2 files changed, 410 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch - -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 43dc4ff..757721c 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -1,6 +1,7 @@ - include ../../Makefile.include - include FFMPEG-VERSION --DEPS= ../../Makefile.include FFMPEG-VERSION Makefile ffmpeg_Speed_up_wtv_index_creation.patch 0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch -+DEPS= ../../Makefile.include FFMPEG-VERSION Makefile ffmpeg_Speed_up_wtv_index_creation.patch 0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch \ -+ hevcdsp_ARM_NEON_optimized_epel_functions.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -70,6 +71,8 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); sed -i".bak" -e "s%pkg_config_default=pkg-config%export PKG_CONFIG_LIBDIR=$(PREFIX)/lib/pkgconfig \&\& pkg_config_default=$(NATIVEPREFIX)/bin/pkg-config%" configure - cd $(PLATFORM); patch -p3 < ../ffmpeg_Speed_up_wtv_index_creation.patch - cd $(PLATFORM); patch -p1 < ../0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch -+ cd $(PLATFORM); patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch -+ - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - ./configure $(ffmpg_config) -diff --git a/tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch b/tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch -new file mode 100644 -index 0000000..de95ba6 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch -@@ -0,0 +1,406 @@ -+From 5114c6fb870fe3aea5da05ea218760a47a29ad74 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Thu, 5 Feb 2015 13:32:28 +0000 -+Subject: [PATCH] hevcdsp: ARM NEON optimized epel functions -+ -+--- -+ libavcodec/arm/Makefile | 1 + -+ libavcodec/arm/hevcdsp_epel_neon.S | 334 +++++++++++++++++++++++++++++++++++++ -+ libavcodec/arm/hevcdsp_init_neon.c | 23 +++ -+ 3 files changed, 358 insertions(+) -+ create mode 100644 libavcodec/arm/hevcdsp_epel_neon.S -+ -+diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile -+index 434a2d1..95eb814 100644 -+--- a/libavcodec/arm/Makefile -++++ b/libavcodec/arm/Makefile -+@@ -134,6 +134,7 @@ NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \ -+ arm/synth_filter_neon.o -+ NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \ -+ arm/hevcdsp_deblock_neon.o \ -++ arm/hevcdsp_epel_neon.o \ -+ arm/hevcdsp_idct_neon.o \ -+ arm/hevcdsp_qpel_neon.o -+ NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o -+diff --git a/libavcodec/arm/hevcdsp_epel_neon.S b/libavcodec/arm/hevcdsp_epel_neon.S -+new file mode 100644 -+index 0000000..424416d -+--- /dev/null -++++ b/libavcodec/arm/hevcdsp_epel_neon.S -+@@ -0,0 +1,334 @@ -++/* -++ * Copyright (c) 2014 - 2015 Seppo Tomperi -++ * -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++#include "libavutil/arm/asm.S" -++#include "neon.S" -++ -++#define MAX_PB_SIZE #64 -++ -++.macro vextin_d4 -++ vld1.8 {q10}, [r1], r2 -++ vmov d16, d20 -++ vext.8 d17, d20, d21, #1 -++ vext.8 d18, d20, d21, #2 -++ vext.8 d19, d20, d21, #3 -++.endm -++ -++.macro vextin_d4_8 -++ vld1.8 d16, [r1], r2 -++ vext.8 d17, d16, d16, #1 -++ vext.8 d18, d16, d16, #2 -++ vext.8 d19, d16, d16, #3 -++.endm -++ -++.macro load_coeffs_16b coeffs -++ ldr \coeffs, [\coeffs] -++ vdup.i8 d0, \coeffs -++ lsr \coeffs, #8 -++ vdup.i8 d1, \coeffs -++ lsr \coeffs, #8 -++ vdup.i8 d2, \coeffs -++ lsr \coeffs, #8 -++ vdup.i8 d3, \coeffs -++.endm -++ -++.macro epel_filter_16b out=q12 -++ vmull.u8 q3, d16, d0 -++ vmull.u8 q11, d19, d3 -++ vmull.u8 \out, d17, d1 -++ vmull.u8 q10, d18, d2 -++ vadd.s16 q3, q11 -++ vadd.s16 \out, q10 -++ vsub.s16 \out, q3 -++.endm -++ -++.macro load_coeffs_32b coeffs -++ ldr \coeffs, [\coeffs] -++ vmov.i64 d4, #0 -++ vmov.8 d4[0], \coeffs -++ lsr \coeffs, #8 -++ vmov.8 d4[2], \coeffs -++ lsr \coeffs, #8 -++ vmov.8 d4[4], \coeffs -++ lsr \coeffs, #8 -++ vmov.8 d4[6], \coeffs -++.endm -++ -++.macro epel_filter_32b -++ vmull.s16 q3, d24, d4[0] //q12 -++ vmull.s16 q4, d25, d4[0] -++ vmull.s16 q5, d30, d4[3] //q15 -++ vmull.s16 q6, d31, d4[3] -++ -++ vmull.s16 q7, d26, d4[1] // q13 -++ vmull.s16 q8, d27, d4[1] -++ vmull.s16 q9, d28, d4[2] // q14 -++ vmull.s16 q10, d29, d4[2] -++ vadd.s32 q3, q5 -++ vadd.s32 q4, q6 -++ vadd.s32 q7, q9 -++ vadd.s32 q8, q10 -++ vsub.s32 q7, q3 -++ vsub.s32 q8, q4 -++ vqshrn.s32 d6, q7, #6 -++ vqshrn.s32 d7, q8, #6 -++.endm -++ -++.macro epel_filter_32b_4 -++ vmull.s16 q3, d24, d4[0] //q12 -++ vmull.s16 q5, d30, d4[3] //q15 -++ vmull.s16 q7, d26, d4[1] // q13 -++ vmull.s16 q9, d28, d4[2] // q14 -++ vadd.s32 q3, q5 -++ vadd.s32 q7, q9 -++ vsub.s32 q7, q3 -++ vqshrn.s32 d6, q7, #6 -++.endm -++ -++function ff_hevc_put_epel_h_neon_8, export=1 -++ push {r4-r7} -++ mov r4, MAX_PB_SIZE -++ ldr r7, [sp, #16] // mx -++ ldr r5, [sp, #24] // width -++ sub r7, #1 -++ lsl r7, #2 -++ vpush {d8-d15} -++ adrl r12, epel_coeffs -++ add r7, r12 -++ sub r1, #1 -++ lsl r4, #1 -++ load_coeffs_16b r7 -++ mov r12, r3 -++ mov r6, r0 -++ mov r7, r1 -++ cmp r5, #6 -++ bgt 8f -++ cmp r5, #4 -++ blt 2f -++ b 4f -++8: subs r3, #1 -++ pld [r1] -++ vextin_d4 -++ epel_filter_16b -++ vst1.16 {q12}, [r0], r4 -++ bne 8b -++ subs r5, #8 -++ beq 99f -++ mov r3, r12 -++ add r6, #16 -++ mov r0, r6 -++ add r7, #8 -++ mov r1, r7 -++ cmp r5, #4 -++ bgt 8b -++4: subs r3, #1 -++ pld [r1] -++ vextin_d4_8 -++ epel_filter_16b -++ vst1.16 d24, [r0], r4 -++ bne 4b -++ subs r5, #4 -++ beq 99f -++ mov r3, r12 -++ add r6, #8 -++ mov r0, r6 -++ add r7, #4 -++ mov r1, r7 -++2: subs r3, #1 -++ pld [r1] -++ vextin_d4_8 -++ epel_filter_16b -++ vst1.32 d24[0], [r0], r4 -++ bne 2b -++99: vpop {d8-d15} -++ pop {r4-r7} -++ bx lr -++endfunc -++ -++function ff_hevc_put_epel_v_neon_8, export=1 -++ push {r4-r7} -++ mov r4, MAX_PB_SIZE -++ ldr r7, [sp, #20] // my -++ ldr r5, [sp, #24] // width -++ sub r7, #1 -++ lsl r7, #2 -++ vpush {d8-d15} -++ adrl r12, epel_coeffs -++ add r7, r12 -++ load_coeffs_16b r7 -++ sub r1, r2 -++ lsl r4, #1 -++ mov r12, r3 -++ mov r6, r0 -++ mov r7, r1 -++0: pld [r1] -++ vld1.8 {d16}, [r1], r2 -++ pld [r1] -++ vld1.8 {d17}, [r1], r2 -++ pld [r1] -++ vld1.8 {d18}, [r1], r2 -++ cmp r5, #6 -++ bgt 8f -++ cmp r5, #4 -++ blt 2f -++ b 4f -++8: pld [r1] -++ vld1.8 {d19}, [r1], r2 -++ subs r3, #1 -++ epel_filter_16b -++ vst1.16 {q12}, [r0], r4 -++ vmov d16, d17 -++ vmov d17, d18 -++ vmov d18, d19 -++ bne 8b -++ subs r5, #8 -++ beq 99f -++ mov r3, r12 -++ add r6, #16 -++ mov r0, r6 -++ add r7, #8 -++ mov r1, r7 -++ b 0b -++4: pld [r1] -++ vld1.8 {d19}, [r1], r2 -++ subs r3, #1 -++ epel_filter_16b -++ vst1.16 d24, [r0], r4 -++ vmov d16, d17 -++ vmov d17, d18 -++ vmov d18, d19 -++ bne 4b -++ subs r5, #4 -++ beq 99f -++ mov r3, r12 -++ add r6, #8 -++ mov r0, r6 -++ add r7, #4 -++ mov r1, r7 -++ b 0b -++2: pld [r1] -++ vld1.8 {d19}, [r1], r2 -++ subs r3, #1 -++ epel_filter_16b -++ vst1.32 d24[0], [r0], r4 -++ vmov d16, d17 -++ vmov d17, d18 -++ vmov d18, d19 -++ bne 2b -++99: vpop {d8-d15} -++ pop {r4-r7} -++ bx lr -++endfunc -++ -++function ff_hevc_put_epel_hv_neon_8, export=1 -++ push {r4-r7} -++ mov r4, MAX_PB_SIZE -++ ldr r6, [sp, #16] // mx -++ ldr r7, [sp, #20] // my -++ ldr r5, [sp, #24] // width -++ sub r7, #1 -++ lsl r7, #2 -++ vpush {d8-d15} -++ adrl r12, epel_coeffs -++ sub r6, #1 -++ lsl r6, #2 -++ add r6, r12 // mx epel coeff offset -++ add r7, r12 -++ sub r1, #1 -++ sub r1, r2 -++ lsl r4, #1 -++ load_coeffs_16b r6 -++ load_coeffs_32b r7 -++ mov r12, r3 -++ mov r6, r0 -++ mov r7, r1 -++0: pld [r1] -++ vextin_d4 -++ epel_filter_16b q12 -++ pld [r1] -++ vextin_d4 -++ epel_filter_16b q13 -++ pld [r1] -++ vextin_d4 -++ epel_filter_16b q14 -++ cmp r5, #6 -++ bgt 8f -++ cmp r5, #4 -++ blt 2f -++ b 4f -++8: pld [r1] -++ vextin_d4 -++ epel_filter_16b q15 -++ subs r3, #1 -++ epel_filter_32b -++ vst1.16 {q3}, [r0], r4 -++ vmov q12, q13 -++ vmov q13, q14 -++ vmov q14, q15 -++ bne 8b -++ subs r5, #8 -++ beq 99f -++ mov r3, r12 -++ add r6, #16 -++ mov r0, r6 -++ add r7, #8 -++ mov r1, r7 -++ b 0b -++4: pld [r1] -++ vextin_d4_8 -++ epel_filter_16b q15 -++ subs r3, #1 -++ epel_filter_32b_4 -++ vst1.16 d6, [r0], r4 -++ vmov q12, q13 -++ vmov q13, q14 -++ vmov q14, q15 -++ bne 4b -++ subs r5, #4 -++ beq 99f -++ mov r3, r12 -++ add r6, #8 -++ mov r0, r6 -++ add r7, #4 -++ mov r1, r7 -++ b 0b -++2: pld [r1] -++ vextin_d4_8 -++ epel_filter_16b q15 -++ subs r3, #1 -++ epel_filter_32b_4 -++ vst1.32 d6[0], [r0], r4 -++ vmov q12, q13 -++ vmov q13, q14 -++ vmov q14, q15 -++ bne 2b -++99: vpop {d8-d15} -++ pop {r4-r7} -++ bx lr -++endfunc -++ -++epel_coeffs: -++ .byte 2, 58, 10, 2 -++ .byte 4, 54, 16, 2 -++ .byte 6, 46, 28, 4 -++ .byte 4, 36, 36, 4 -++ .byte 4, 28, 46, 6 -++ .byte 2, 16, 54, 4 -++ .byte 2, 10, 58, 2 -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 61e6462..917abc4 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -57,6 +57,15 @@ PUT_PIXELS(ff_hevc_put_pixels_w32_neon_8); -+ PUT_PIXELS(ff_hevc_put_pixels_w48_neon_8); -+ PUT_PIXELS(ff_hevc_put_pixels_w64_neon_8); -+ #undef PUT_PIXELS -++void ff_hevc_put_epel_h_neon_8(int16_t *dst, uint8_t *src, -++ ptrdiff_t srcstride, int height, -++ intptr_t mx, intptr_t my, int width); -++void ff_hevc_put_epel_v_neon_8(int16_t *dst, uint8_t *src, -++ ptrdiff_t srcstride, int height, -++ intptr_t mx, intptr_t my, int width); -++void ff_hevc_put_epel_hv_neon_8(int16_t *dst, uint8_t *src, -++ ptrdiff_t srcstride, int height, -++ intptr_t mx, intptr_t my, int width); -+ -+ static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, -+ int height, int width); -+@@ -201,7 +210,21 @@ static av_cold void hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ c->put_hevc_qpel_bi[x][1][0] = ff_hevc_put_qpel_bi_neon_wrapper; -+ c->put_hevc_qpel_bi[x][0][1] = ff_hevc_put_qpel_bi_neon_wrapper; -+ c->put_hevc_qpel_bi[x][1][1] = ff_hevc_put_qpel_bi_neon_wrapper; -++ c->put_hevc_epel[x][1][0] = ff_hevc_put_epel_v_neon_8; -++ c->put_hevc_epel[x][0][1] = ff_hevc_put_epel_h_neon_8; -++ c->put_hevc_epel[x][1][1] = ff_hevc_put_epel_hv_neon_8; -+ } -++ c->put_hevc_epel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; -++ c->put_hevc_epel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; -++ c->put_hevc_epel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; -++ c->put_hevc_epel[3][0][0] = ff_hevc_put_pixels_w8_neon_8; -++ c->put_hevc_epel[4][0][0] = ff_hevc_put_pixels_w12_neon_8; -++ c->put_hevc_epel[5][0][0] = ff_hevc_put_pixels_w16_neon_8; -++ c->put_hevc_epel[6][0][0] = ff_hevc_put_pixels_w24_neon_8; -++ c->put_hevc_epel[7][0][0] = ff_hevc_put_pixels_w32_neon_8; -++ c->put_hevc_epel[8][0][0] = ff_hevc_put_pixels_w48_neon_8; -++ c->put_hevc_epel[9][0][0] = ff_hevc_put_pixels_w64_neon_8; -++ -+ c->put_hevc_qpel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; -+ 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 e885adeaa52b27c769c7c0f599e95c772f93f0fa Mon Sep 17 00:00:00 2001 +From e11c6931312b66a33fd8ddc52a1c121894c913ab Mon Sep 17 00:00:00 2001 From: anaconda Date: Wed, 25 Feb 2015 18:22:21 +0100 -Subject: [PATCH 58/89] Load OSD dialogs on startup. +Subject: [PATCH 31/56] 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. @@ -5650,120 +2365,10 @@ index 4940561..f52698c 100644 CGUIDialogVideoSettings::~CGUIDialogVideoSettings() { } -From 018f759a0be60d10f72bb35df22e074ceb88ae72 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 5 Mar 2015 20:00:59 +0000 -Subject: [PATCH 59/89] [ffmpmeg] Discard data before VO/VOL in mpeg-4 over - mpegts - ---- - ...-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch | 69 ++++++++++++++++++++++ - tools/depends/target/ffmpeg/Makefile | 4 +- - 2 files changed, 72 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/0001-Discard-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch - -diff --git a/tools/depends/target/ffmpeg/0001-Discard-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch b/tools/depends/target/ffmpeg/0001-Discard-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch -new file mode 100644 -index 0000000..eef7385 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-Discard-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch -@@ -0,0 +1,69 @@ -+From ff289b3678b3b102f76c0fc0ffc802e3c8026fdb Mon Sep 17 00:00:00 2001 -+From: Deborah Crook -+Date: Thu, 5 Mar 2015 19:48:43 +0000 -+Subject: [PATCH] Discard data before VO/VOL in mpeg-4 over mpegts -+ -+--- -+ libavcodec/mpeg4video_parser.c | 26 ++++++++++++++++++++++---- -+ 1 file changed, 22 insertions(+), 4 deletions(-) -+ -+diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c -+index aa5e87a..0d8b15a 100644 -+--- a/libavcodec/mpeg4video_parser.c -++++ b/libavcodec/mpeg4video_parser.c -+@@ -43,18 +43,32 @@ int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) -+ state = pc->state; -+ -+ i = 0; -+- if (!vop_found) { -++ if (vop_found < 0) { -++ for (i = 0; i < buf_size; i++) { -++ state = (state << 8) | buf[i]; -++ if (state >= 0x100 && state <= 0x12f) { -++ i++; -++ vop_found = 0; -++ break; -++ } -++ } -++ } -++ -++ if (vop_found == 0) -++ vop_found = 1; -++ -++ if (vop_found == 1) { -+ for (i = 0; i < buf_size; i++) { -+ state = (state << 8) | buf[i]; -+ if (state == 0x1B6) { -+ i++; -+- vop_found = 1; -++ vop_found = 2; -+ break; -+ } -+ } -+ } -+ -+- if (vop_found) { -++ if (vop_found == 2) { -+ /* EOF considered as end of frame */ -+ if (buf_size == 0) -+ return 0; -+@@ -133,12 +147,16 @@ static int mpeg4video_parse(AVCodecParserContext *s, -+ ParseContext *pc = s->priv_data; -+ int next; -+ -++ if (pc->frame_start_found == 0 && !avctx->extradata) -++ pc->frame_start_found = -1; -++ -+ if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { -+ next = buf_size; -+ } else { -+ next = ff_mpeg4_find_frame_end(pc, buf, buf_size); -+ -+- if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { -++ if (pc->frame_start_found < 0 || -++ ff_combine_frame(pc, next, &buf, &buf_size) < 0) { -+ *poutbuf = NULL; -+ *poutbuf_size = 0; -+ return buf_size; -+-- -+2.1.4 -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 757721c..fbef09a 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -1,7 +1,8 @@ - include ../../Makefile.include - include FFMPEG-VERSION - DEPS= ../../Makefile.include FFMPEG-VERSION Makefile ffmpeg_Speed_up_wtv_index_creation.patch 0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch \ -- hevcdsp_ARM_NEON_optimized_epel_functions.patch -+ hevcdsp_ARM_NEON_optimized_epel_functions.patch \ -+ 0001-Discard-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -72,6 +73,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); patch -p3 < ../ffmpeg_Speed_up_wtv_index_creation.patch - cd $(PLATFORM); patch -p1 < ../0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch - cd $(PLATFORM); patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch -+ cd $(PLATFORM); patch -p1 < ../0001-Discard-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch - - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - -From 91db23dc25c5ea12f5183dc99379ac79d9e6a1dd Mon Sep 17 00:00:00 2001 +From 71e5a4591b65a12c3621395644c2542b1216c94f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 7 Mar 2015 22:46:21 +0000 -Subject: [PATCH 60/89] configure: Add raspberry-pi2 platform +Subject: [PATCH 32/56] configure: Add raspberry-pi2 platform --- configure.ac | 14 +++++++-- @@ -5775,7 +2380,7 @@ Subject: [PATCH 60/89] configure: Add raspberry-pi2 platform 6 files changed, 44 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac -index b7b2a87..be28bf6 100644 +index ea94c1d..2a80a9d 100644 --- a/configure.ac +++ b/configure.ac @@ -746,8 +746,17 @@ case $use_platform in @@ -5937,10 +2542,10 @@ index cdc2fe4..379bd1d 100644 set(CMAKE_SYSTEM_NAME Linux) endif() -From ae3bcf13b7c5e8f372410cea93f85fc44067d402 Mon Sep 17 00:00:00 2001 +From 05272dd1d48f92910c02f134d58cad85e236b567 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 16 Apr 2014 21:18:06 +0100 -Subject: [PATCH 61/89] [omxplayer] Don't propagate 3d flags based on supported +Subject: [PATCH 33/56] [omxplayer] Don't propagate 3d flags based on supported 3d modes --- @@ -5948,10 +2553,10 @@ Subject: [PATCH 61/89] [omxplayer] Don't propagate 3d flags based on supported 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index 8becff1..86d97bd 100644 +index 5ca7665..2e077e5 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -763,40 +763,17 @@ void OMXPlayerVideo::ResolutionUpdateCallBack(uint32_t width, uint32_t height, f +@@ -762,40 +762,17 @@ void OMXPlayerVideo::ResolutionUpdateCallBack(uint32_t width, uint32_t height, f uint32_t video_width = CDisplaySettings::Get().GetResolutionInfo(res).iScreenWidth; uint32_t video_height = CDisplaySettings::Get().GetResolutionInfo(res).iScreenHeight; @@ -5996,10 +2601,10 @@ index 8becff1..86d97bd 100644 unsigned int iDisplayHeight = height; -From a969c6c631b7fbf6b9c246ed3152448df288339a Mon Sep 17 00:00:00 2001 +From f4aec8de701350aacbfbde39cef3290a03f27dcc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:01:51 +0100 -Subject: [PATCH 62/89] [graphics] Allow switching to a more suitable 3D +Subject: [PATCH 34/56] [graphics] Allow switching to a more suitable 3D resolution --- @@ -6085,10 +2690,10 @@ index 5c1501a..aba11cd 100644 void ResetOverscan(RESOLUTION_INFO &resinfo); void ResetScreenParameters(RESOLUTION res); -From eb7a1712a184b4d997998b97359d20d6a2ab95ac Mon Sep 17 00:00:00 2001 +From 78450508b10c875a8d4d48015f256a6c1d2b2c40 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:38:55 +0100 -Subject: [PATCH 63/89] [3D] Support switching to 3D resolutions +Subject: [PATCH 35/56] [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. @@ -6170,10 +2775,10 @@ index 4345c0f..cc5dc60 100644 return current; } -From 776a7d653349f024a92f4ee065527cb558ad389c Mon Sep 17 00:00:00 2001 +From cc039a1f0c00c08a795e2afb33a3c7f2f494bab2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 23 Apr 2014 00:05:07 +0100 -Subject: [PATCH 64/89] [graphics] Make pixel ratio for 3d modes consistent +Subject: [PATCH 36/56] [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. @@ -6340,10 +2945,10 @@ index aba11cd..c84aed0 100644 /*! \brief Set a region in which to clip all rendering Anything that is rendered after setting a clip region will be clipped so that no part renders diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index d388373..ba14e40 100644 +index c80114e..80c05d2 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -546,15 +546,9 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r +@@ -499,15 +499,9 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r m_desktopRes.fPixelRatio = tv_state.display.hdmi.display_options.aspect == 0 ? 1.0f : get_display_aspect_ratio((HDMI_ASPECT_T)tv_state.display.hdmi.display_options.aspect) / ((float)m_desktopRes.iScreenWidth / (float)m_desktopRes.iScreenHeight); // Also add 3D flags if (tv_state.display.hdmi.format_3d == HDMI_3D_FORMAT_SBS_HALF) @@ -6359,7 +2964,7 @@ index d388373..ba14e40 100644 HDMI_PROPERTY_PARAM_T property; property.property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE; vc_tv_hdmi_get_property(&property); -@@ -694,7 +688,6 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v +@@ -650,7 +644,6 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v RESOLUTION_INFO res2 = res; res2.dwFlags |= D3DPRESENTFLAG_MODE3DSBS; res2.fPixelRatio = get_display_aspect_ratio((HDMI_ASPECT_T)tv->aspect_ratio) / ((float)res2.iScreenWidth / (float)res2.iScreenHeight); @@ -6367,7 +2972,7 @@ index d388373..ba14e40 100644 res2.iSubtitles = (int)(0.965 * res2.iHeight); AddUniqueResolution(res2, resolutions); -@@ -710,7 +703,6 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v +@@ -666,7 +659,6 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v RESOLUTION_INFO res2 = res; res2.dwFlags |= D3DPRESENTFLAG_MODE3DTB; res2.fPixelRatio = get_display_aspect_ratio((HDMI_ASPECT_T)tv->aspect_ratio) / ((float)res2.iScreenWidth / (float)res2.iScreenHeight); @@ -6376,149 +2981,20 @@ index d388373..ba14e40 100644 AddUniqueResolution(res2, resolutions); -From d341efba61fba5ce9738b208a23fdb4cb4b95e96 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 10 Mar 2015 17:05:18 +0000 -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 ++++++++++ - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 5 +++++ - xbmc/cores/omxplayer/OMXVideo.cpp | 5 +++++ - 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 bf466b0..d45f05d 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16667,6 +16667,16 @@ msgctxt "#38102" - msgid "%i ms" - msgstr "" - -+#: system/settings/rbp.xml -+msgctxt "#38110" -+msgid "Support MVC video (full frame 3D)" -+msgstr "" -+ -+#: system/settings/rbp.xml -+msgctxt "#38111" -+msgid "This option decodes frames for both eyes of MVC video. Disabling may improve performance if you don't require 3D" -+msgstr "" -+ - #: system/settings/settings.xml - msgctxt "#38103" - msgid "Extract thumbnails from video files" -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 6e9ceaf..ed61ca6 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -30,6 +30,16 @@ - - - -+ -+ -+ -+ 1 -+ -+ 2 -+ true -+ -+ -+ - - - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index df282f3..9e0aa66 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -549,6 +549,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide - // H.264 - m_codingType = MMAL_ENCODING_H264; - m_pFormatName = "mmal-h264"; -+ if (CSettings::Get().GetBool("videoplayer.supportmvc")) -+ { -+ m_codingType = MMAL_ENCODING_MVC; -+ m_pFormatName= "mmal-mvc"; -+ } - break; - 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 ca40a37..ec8fe9c 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -430,6 +430,11 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de - break; - } - } -+ if (CSettings::Get().GetBool("videoplayer.supportmvc")) -+ { -+ m_codingType = OMX_VIDEO_CodingMVC; -+ m_video_codec_name = "omx-mvc"; -+ } - break; - case AV_CODEC_ID_MPEG4: - // (role name) video_decoder.mpeg4 - -From 6802d4a755bb5609e27a797242b7f858d722716a Mon Sep 17 00:00:00 2001 +From ceb6bdca72eebab222cea1ea26ebc853e96e6465 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Mar 2015 12:38:08 +0000 -Subject: [PATCH 66/89] [mmalrenderer] Switch to using transform flags for 3d +Subject: [PATCH 37/56] [mmalrenderer] Switch to using transform flags for 3d modes --- - .../resource.language.en_gb/resources/strings.po | 10 +++ - system/settings/rbp.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 ++- - 7 files changed, 75 insertions(+), 130 deletions(-) + 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 ++- + 5 files changed, 57 insertions(+), 130 deletions(-) -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index d45f05d..bce7527 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -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 "" - -+#: system/settings/rbp.xml -+msgctxt "#38112" -+msgid "Use Full HD HDMI modes for 3D" -+msgstr "" -+ -+#: system/settings/rbp.xml -+msgctxt "#38113" -+msgid "This option uses frame-packing to output full resolution for 3D through HDMI" -+msgstr "" -+ - #: system/settings/settings.xml - msgctxt "#38103" - msgid "Extract thumbnails from video files" -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index ed61ca6..42d4da7 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -39,6 +39,14 @@ - true - - -+ -+ -+ true -+ -+ 2 -+ true -+ -+ - - - diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp index d53de35..c30de9c 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp @@ -6658,10 +3134,10 @@ index d53de35..c30de9c 100644 + region.dest_rect.x, region.dest_rect.y, region.dest_rect.width, region.dest_rect.height, region.transform); } diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index 86d97bd..018e65f 100644 +index 2e077e5..f6c6eb0 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -660,9 +660,7 @@ int OMXPlayerVideo::GetFreeSpace() +@@ -659,9 +659,7 @@ int OMXPlayerVideo::GetFreeSpace() void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRect) { @@ -6672,7 +3148,7 @@ index 86d97bd..018e65f 100644 CRect SrcRect = InSrcRect, DestRect = InDestRect; unsigned flags = GetStereoModeFlags(GetStereoMode()); -@@ -702,42 +700,10 @@ void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRec +@@ -701,42 +699,10 @@ void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRec 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); @@ -6719,7 +3195,7 @@ index 86d97bd..018e65f 100644 if (gui != display) { -@@ -748,7 +714,7 @@ void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRec +@@ -747,7 +713,7 @@ void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRec DestRect.y1 *= yscale; DestRect.y2 *= yscale; } @@ -6729,7 +3205,7 @@ 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 ec8fe9c..3f37d44 100644 +index ca40a37..bb4d572 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp @@ -220,15 +220,6 @@ bool COMXVideo::PortSettingsChanged() @@ -6748,7 +3224,7 @@ index ec8fe9c..3f37d44 100644 if(m_hdmi_clock_sync) { OMX_CONFIG_LATENCYTARGETTYPE latencyTarget; -@@ -860,7 +851,7 @@ void COMXVideo::Reset(void) +@@ -855,7 +846,7 @@ void COMXVideo::Reset(void) } /////////////////////////////////////////////////////////////////////////////////////////// @@ -6757,7 +3233,7 @@ index ec8fe9c..3f37d44 100644 { CSingleLock lock (m_critSection); if(!m_is_open) -@@ -870,7 +861,7 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER +@@ -865,7 +856,7 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER OMX_INIT_STRUCTURE(configDisplay); configDisplay.nPortIndex = m_omx_render.GetInputPort(); @@ -6766,7 +3242,7 @@ index ec8fe9c..3f37d44 100644 configDisplay.dest_rect.x_offset = lrintf(DestRect.x1); configDisplay.dest_rect.y_offset = lrintf(DestRect.y1); configDisplay.dest_rect.width = lrintf(DestRect.Width()); -@@ -883,23 +874,24 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER +@@ -878,23 +869,24 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER configDisplay.fullscreen = OMX_FALSE; configDisplay.noaspect = OMX_TRUE; @@ -6816,10 +3292,10 @@ index 9f26427..3ea02dc 100644 bool GetPlayerInfo(double &match, double &phase, double &pll); void SubmitEOS(); diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index ba14e40..10a0409 100644 +index 80c05d2..ae85484 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -284,7 +284,9 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) +@@ -281,7 +281,9 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) /* inform TV of any 3D settings. Note this property just applies to next hdmi mode change, so no need to call for 2D modes */ HDMI_PROPERTY_PARAM_T property; property.property = HDMI_PROPERTY_3D_STRUCTURE; @@ -6830,7 +3306,7 @@ index ba14e40..10a0409 100644 property.param1 = HDMI_3D_FORMAT_SBS_HALF; else if (res.dwFlags & D3DPRESENTFLAG_MODE3DTB) property.param1 = HDMI_3D_FORMAT_TB_HALF; -@@ -384,6 +386,13 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) +@@ -354,6 +356,13 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) DISPMANX_TRANSFORM_T transform = DISPMANX_NO_ROTATE; DISPMANX_UPDATE_HANDLE_T dispman_update = m_DllBcmHost->vc_dispmanx_update_start(0); @@ -6845,10 +3321,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 3531e8d698ce4d38ce16c7697f6a5111563a9238 Mon Sep 17 00:00:00 2001 +From 978189928bf88240aa551e48921a6f74b90957f1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 17 Mar 2015 20:33:54 +0000 -Subject: [PATCH 67/89] alsa: enable-shared is required +Subject: [PATCH 38/56] alsa: enable-shared is required --- tools/depends/target/alsa-lib/Makefile | 2 +- @@ -6868,10 +3344,10 @@ index b03fc19..a04d933 100644 LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a -From 63a3a45ee208669b1b74a4f88aa9802ab5bf6c49 Mon Sep 17 00:00:00 2001 +From c906a8a2edab573281ccbd99563c7c05f644d1e2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 31 Mar 2015 17:31:47 +0100 -Subject: [PATCH 70/89] [mmalrenderer] Add SetCodecControl function and prefer +Subject: [PATCH 39/56] [mmalrenderer] Add SetCodecControl function and prefer to return pictures when renderer is low (disabled) --- @@ -6910,7 +3386,7 @@ index a768e70..aa8e87f 100644 protected: diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 9e0aa66..1e711b4 100644 +index df282f3..6eb7f7c 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -128,6 +128,7 @@ CMMALVideo::CMMALVideo() @@ -6921,7 +3397,7 @@ index 9e0aa66..1e711b4 100644 } CMMALVideo::~CMMALVideo() -@@ -944,6 +945,9 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -939,6 +940,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; @@ -6931,7 +3407,7 @@ index 9e0aa66..1e711b4 100644 } if (!ret) { -@@ -995,6 +999,7 @@ void CMMALVideo::Reset(void) +@@ -990,6 +994,7 @@ void CMMALVideo::Reset(void) m_startframe = false; m_decoderPts = DVD_NOPTS_VALUE; m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); @@ -6939,7 +3415,7 @@ index 9e0aa66..1e711b4 100644 } void CMMALVideo::SetSpeed(int iSpeed) -@@ -1128,3 +1133,10 @@ bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) +@@ -1123,3 +1128,10 @@ bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) // CLog::Log(LOGDEBUG, "%s::%s - pts:%.0f droppedPics:%d", CLASSNAME, __func__, pts, droppedPics); return true; } @@ -6971,10 +3447,10 @@ index 4c9b20f..c405aa1 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; -From be88e53ace69911dd0400e19c087f6bac7318ec9 Mon Sep 17 00:00:00 2001 +From 84bcf7c0aa9499fde22571ce993b520053a4353e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 Apr 2015 16:31:37 +0100 -Subject: [PATCH 71/89] [mmalcodec] Limit submitted video frames. Seems to +Subject: [PATCH 40/56] [mmalcodec] Limit submitted video frames. Seems to avoid stutter issues with low bitrate videos --- @@ -6982,10 +3458,10 @@ Subject: [PATCH 71/89] [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 1e711b4..77c31f2 100644 +index 6eb7f7c..24ddc3b 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -928,7 +928,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -923,7 +923,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) break; } int ret = 0; @@ -6996,10 +3472,10 @@ index 1e711b4..77c31f2 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 ae1a4baf6e3fe6ebd229a1b56d5cd6314c2390a0 Mon Sep 17 00:00:00 2001 +From 01e34be063309eb5cc05984a90be0eeb27e18f83 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 6 Apr 2015 19:06:26 +0100 -Subject: [PATCH 72/89] [mmalcodec] Remove the decoder queue and use gpu +Subject: [PATCH 41/56] [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. @@ -7014,7 +3490,7 @@ Instead remove the dts queue and use the gpu's timestamps. 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 77c31f2..d8d733e 100644 +index 24ddc3b..4bdca80 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -129,6 +129,7 @@ CMMALVideo::CMMALVideo() @@ -7069,7 +3545,7 @@ index 77c31f2..d8d733e 100644 } } else if (buffer->cmd == MMAL_EVENT_FORMAT_CHANGED) -@@ -653,6 +642,10 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -648,6 +637,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)); @@ -7080,7 +3556,7 @@ index 77c31f2..d8d733e 100644 status = mmal_port_format_commit(m_dec_input); if (status != MMAL_SUCCESS) { -@@ -721,6 +714,8 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -716,6 +709,8 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide m_startframe = false; m_preroll = !m_hints.stills; m_speed = DVD_PLAYSPEED_NORMAL; @@ -7089,7 +3565,7 @@ index 77c31f2..d8d733e 100644 return true; } -@@ -736,10 +731,9 @@ void CMMALVideo::Dispose() +@@ -731,10 +726,9 @@ void CMMALVideo::Dispose() done = true; pthread_mutex_unlock(&m_output_mutex); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -7101,7 +3577,7 @@ index 77c31f2..d8d733e 100644 m_myself.reset(); } } -@@ -772,11 +766,19 @@ void CMMALVideo::SetDropState(bool bDrop) +@@ -767,11 +761,19 @@ void CMMALVideo::SetDropState(bool bDrop) } } @@ -7123,7 +3599,7 @@ index 77c31f2..d8d733e 100644 unsigned int demuxer_bytes = 0; uint8_t *demuxer_content = NULL; -@@ -840,6 +842,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -835,6 +837,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) return VC_ERROR; } @@ -7137,7 +3613,7 @@ index 77c31f2..d8d733e 100644 mmal_buffer_header_reset(buffer); buffer->cmd = 0; if (!m_startframe && pts == DVD_NOPTS_VALUE) -@@ -862,8 +871,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -857,8 +866,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)) @@ -7148,7 +3624,7 @@ index 77c31f2..d8d733e 100644 assert((int)buffer->length > 0); status = mmal_port_send_buffer(m_dec_input, buffer); if (status != MMAL_SUCCESS) -@@ -880,12 +889,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -875,12 +884,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { m_droppedPics += m_deint ? 2:1; } @@ -7161,7 +3637,7 @@ index 77c31f2..d8d733e 100644 pthread_mutex_unlock(&m_output_mutex); if (m_changed_count_dec != m_changed_count) { -@@ -928,11 +931,11 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -923,11 +926,11 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) break; } int ret = 0; @@ -7176,7 +3652,7 @@ index 77c31f2..d8d733e 100644 ret |= VC_BUFFER; } else -@@ -953,8 +956,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -948,8 +951,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) if (!ret) { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -7187,7 +3663,7 @@ index 77c31f2..d8d733e 100644 Sleep(10); // otherwise we busy spin } return ret; -@@ -984,8 +987,6 @@ void CMMALVideo::Reset(void) +@@ -979,8 +982,6 @@ void CMMALVideo::Reset(void) bool old_drop_state = m_drop_state; SetDropState(true); pthread_mutex_lock(&m_output_mutex); @@ -7196,7 +3672,7 @@ index 77c31f2..d8d733e 100644 while (!m_demux_queue.empty()) m_demux_queue.pop(); m_demux_queue_length = 0; -@@ -1001,6 +1002,7 @@ void CMMALVideo::Reset(void) +@@ -996,6 +997,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; @@ -7204,7 +3680,7 @@ index 77c31f2..d8d733e 100644 } void CMMALVideo::SetSpeed(int iSpeed) -@@ -1020,8 +1022,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) +@@ -1015,8 +1017,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) mmal_buffer_header_reset(buffer); buffer->cmd = 0; if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -7215,7 +3691,7 @@ index 77c31f2..d8d733e 100644 status = mmal_port_send_buffer(m_dec_output, buffer); if (status != MMAL_SUCCESS) { -@@ -1048,7 +1050,7 @@ void CMMALVideo::ReleaseBuffer(CMMALVideoBuffer *buffer) +@@ -1043,7 +1045,7 @@ void CMMALVideo::ReleaseBuffer(CMMALVideoBuffer *buffer) if (done) m_myself.reset(); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -7245,10 +3721,10 @@ index c405aa1..f5f664a 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; -From 2f763b28cb818300befb9f7a4c6fd79c7ced9d7f Mon Sep 17 00:00:00 2001 +From e5cc4fea13487d975d3ff1f4223932f76445ac33 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 9 Apr 2015 18:18:09 +0100 -Subject: [PATCH 73/89] [mmalrenderer] Remove dropping logic. It only seems to +Subject: [PATCH 42/56] [mmalrenderer] Remove dropping logic. It only seems to make things worse --- @@ -7257,7 +3733,7 @@ Subject: [PATCH 73/89] [mmalrenderer] Remove dropping logic. It only seems to 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 d8d733e..cfe106a 100644 +index 4bdca80..ea93e32 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -97,7 +97,6 @@ CMMALVideo::CMMALVideo() @@ -7298,7 +3774,7 @@ index d8d733e..cfe106a 100644 } } } -@@ -710,7 +705,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -705,7 +700,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide if (!SendCodecConfigData()) return false; @@ -7306,7 +3782,7 @@ index d8d733e..cfe106a 100644 m_startframe = false; m_preroll = !m_hints.stills; m_speed = DVD_PLAYSPEED_NORMAL; -@@ -740,30 +734,8 @@ void CMMALVideo::Dispose() +@@ -735,30 +729,8 @@ void CMMALVideo::Dispose() void CMMALVideo::SetDropState(bool bDrop) { @@ -7339,7 +3815,7 @@ index d8d733e..cfe106a 100644 } static unsigned count_bits(int32_t value) -@@ -859,10 +831,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -854,10 +826,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; @@ -7350,7 +3826,7 @@ index d8d733e..cfe106a 100644 memcpy(buffer->data, demuxer_content, buffer->length); demuxer_bytes -= buffer->length; demuxer_content += buffer->length; -@@ -885,10 +853,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -880,10 +848,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { pthread_mutex_lock(&m_output_mutex); m_startframe = true; @@ -7361,7 +3837,7 @@ index d8d733e..cfe106a 100644 pthread_mutex_unlock(&m_output_mutex); if (m_changed_count_dec != m_changed_count) { -@@ -984,16 +948,28 @@ void CMMALVideo::Reset(void) +@@ -979,16 +943,28 @@ void CMMALVideo::Reset(void) mmal_port_enable(m_dec_output, dec_output_port_cb_static); } // blow all ready video frames @@ -7395,7 +3871,7 @@ index d8d733e..cfe106a 100644 if (!m_finished) SendCodecConfigData(); -@@ -1127,14 +1103,8 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) +@@ -1122,14 +1098,8 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) { @@ -7433,10 +3909,10 @@ index f5f664a..f79fed5 100644 bool m_preroll; int m_codecControlFlags; -From d0eb9742af9ecf3de62d560d0e5c57de2531486f Mon Sep 17 00:00:00 2001 +From ff4c4b5773c669e0b7eb13919e246cbc5c3328fb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 Apr 2015 12:47:04 +0100 -Subject: [PATCH 74/89] [players] Make use of new scheme to submit DTS +Subject: [PATCH 43/56] [players] Make use of new scheme to submit DTS timestamps Latest firmware supports marking timestamps as DTS, @@ -7454,7 +3930,7 @@ 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 cfe106a..237a581 100644 +index ea93e32..ea85f25 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -57,7 +57,6 @@ CMMALVideoBuffer::CMMALVideoBuffer(CMMALVideo *omv) @@ -7501,7 +3977,7 @@ index cfe106a..237a581 100644 } } } -@@ -637,7 +633,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -632,7 +628,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)); @@ -7514,7 +3990,7 @@ index cfe106a..237a581 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)); -@@ -708,8 +708,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -703,8 +703,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide m_startframe = false; m_preroll = !m_hints.stills; m_speed = DVD_PLAYSPEED_NORMAL; @@ -7523,7 +3999,7 @@ index cfe106a..237a581 100644 return true; } -@@ -738,14 +736,6 @@ void CMMALVideo::SetDropState(bool bDrop) +@@ -733,14 +731,6 @@ void CMMALVideo::SetDropState(bool bDrop) CLog::Log(LOGDEBUG, "%s::%s - bDrop(%d)", CLASSNAME, __func__, bDrop); } @@ -7538,7 +4014,7 @@ index cfe106a..237a581 100644 int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -813,14 +803,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -808,14 +798,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; } @@ -7553,7 +4029,7 @@ index cfe106a..237a581 100644 mmal_buffer_header_reset(buffer); buffer->cmd = 0; if (!m_startframe && pts == DVD_NOPTS_VALUE) -@@ -978,7 +960,6 @@ void CMMALVideo::Reset(void) +@@ -973,7 +955,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; @@ -7561,7 +4037,7 @@ index cfe106a..237a581 100644 } void CMMALVideo::SetSpeed(int iSpeed) -@@ -1064,7 +1045,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) +@@ -1059,7 +1040,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) } // timestamp is in microseconds @@ -7591,10 +4067,10 @@ index f79fed5..415f3e3 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index 018e65f..4315993 100644 +index f6c6eb0..d953b1c 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -106,7 +106,6 @@ OMXPlayerVideo::OMXPlayerVideo(OMXClock *av_clock, +@@ -105,7 +105,6 @@ OMXPlayerVideo::OMXPlayerVideo(OMXClock *av_clock, m_iCurrentPts = DVD_NOPTS_VALUE; m_nextOverlay = DVD_NOPTS_VALUE; m_flush = false; @@ -7602,7 +4078,7 @@ index 018e65f..4315993 100644 } OMXPlayerVideo::~OMXPlayerVideo() -@@ -314,14 +313,6 @@ void OMXPlayerVideo::Output(double pts, bool bDropPacket) +@@ -313,14 +312,6 @@ void OMXPlayerVideo::Output(double pts, bool bDropPacket) g_renderManager.FlipPage(CThread::m_bStop, time/DVD_TIME_BASE); } @@ -7617,7 +4093,7 @@ index 018e65f..4315993 100644 void OMXPlayerVideo::Process() { double frametime = (double)DVD_TIME_BASE / m_fFrameRate; -@@ -496,18 +487,20 @@ void OMXPlayerVideo::Process() +@@ -495,18 +486,20 @@ void OMXPlayerVideo::Process() m_stalled = false; } @@ -7645,7 +4121,7 @@ index 018e65f..4315993 100644 Output(pts, bRequestDrop); if(pts != DVD_NOPTS_VALUE) m_iCurrentPts = pts; -@@ -583,9 +576,6 @@ bool OMXPlayerVideo::OpenDecoder() +@@ -582,9 +575,6 @@ bool OMXPlayerVideo::OpenDecoder() m_codecname = m_omxVideo.GetDecoderName(); } @@ -7668,10 +4144,10 @@ index 2748a41..3bd5625 100644 CDVDOverlayContainer *m_pOverlayContainer; diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 3f37d44..832a9c9 100644 +index bb4d572..1011b5d 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -602,23 +602,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de +@@ -597,23 +597,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de return false; } @@ -7695,7 +4171,7 @@ index 3f37d44..832a9c9 100644 if(NaluFormatStartCodes(hints.codec, m_extradata, m_extrasize)) { OMX_NALSTREAMFORMATTYPE nalStreamFormat; -@@ -758,7 +741,7 @@ bool COMXVideo::GetPlayerInfo(double &match, double &phase, double &pll) +@@ -753,7 +736,7 @@ bool COMXVideo::GetPlayerInfo(double &match, double &phase, double &pll) } @@ -7704,7 +4180,7 @@ index 3f37d44..832a9c9 100644 { CSingleLock lock (m_critSection); OMX_ERRORTYPE omx_err; -@@ -783,6 +766,7 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) +@@ -778,6 +761,7 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) omx_buffer->nFlags = 0; omx_buffer->nOffset = 0; @@ -7712,7 +4188,7 @@ index 3f37d44..832a9c9 100644 if(m_setStartTime) { -@@ -790,10 +774,11 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) +@@ -785,10 +769,11 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE); m_setStartTime = false; } @@ -7740,10 +4216,10 @@ index 3ea02dc..86e94ce 100644 void SetDropState(bool bDrop); std::string GetDecoderName() { return m_video_codec_name; }; -From c5d5f34a04502ef918ad35de044862e4a6e4f843 Mon Sep 17 00:00:00 2001 +From 8806ac18c5c1d43fef3357f5a15bd960f493cd51 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 +Subject: [PATCH 44/56] [gui] Also limit GUI updates when in non full-screen video mode --- @@ -7751,10 +4227,10 @@ Subject: [PATCH 75/89] [gui] Also limit GUI updates when in non full-screen 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 5889613..9ba0d23 100644 +index 1141d7b..832b22d 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -2496,7 +2496,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) +@@ -2495,7 +2495,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 @@ -7763,7 +4239,7 @@ index 5889613..9ba0d23 100644 fps = CSettings::Get().GetInt("videoplayer.limitguiupdate"); #endif -@@ -2509,6 +2509,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) +@@ -2508,6 +2508,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) { if (!m_skipGuiRender) g_windowManager.Process(CTimeUtils::GetFrameTime()); @@ -7773,10 +4249,10 @@ index 5889613..9ba0d23 100644 g_windowManager.FrameMove(); } -From e40d733fa86aa4835daaec2484169c05fe5796c9 Mon Sep 17 00:00:00 2001 +From a9d65318b7758e3afcb8841999bc98e15117afeb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 15 Apr 2015 22:57:45 +0100 -Subject: [PATCH 76/89] [mmalcodec] Return mmal buffers explicitly +Subject: [PATCH 45/56] [mmalcodec] Return mmal buffers explicitly --- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 29 ++++++++++++++-------- @@ -7784,7 +4260,7 @@ Subject: [PATCH 76/89] [mmalcodec] Return mmal buffers explicitly 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 237a581..486dc4b 100644 +index ea85f25..5bdf145 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -133,7 +133,6 @@ CMMALVideo::~CMMALVideo() @@ -7812,7 +4288,7 @@ index 237a581..486dc4b 100644 return true; } -@@ -705,6 +705,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -700,6 +700,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide if (!SendCodecConfigData()) return false; @@ -7820,7 +4296,7 @@ index 237a581..486dc4b 100644 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) +@@ -742,8 +743,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) MMAL_BUFFER_HEADER_T *buffer; MMAL_STATUS_T status; @@ -7829,7 +4305,7 @@ index 237a581..486dc4b 100644 // 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) +@@ -770,9 +769,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) while (1) { @@ -7839,7 +4315,7 @@ index 237a581..486dc4b 100644 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) +@@ -864,8 +860,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) demuxer_content = NULL; continue; } @@ -7848,7 +4324,7 @@ index 237a581..486dc4b 100644 } } if (!demuxer_bytes) -@@ -909,6 +903,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -904,6 +898,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) return ret; } @@ -7862,7 +4338,7 @@ index 237a581..486dc4b 100644 void CMMALVideo::Reset(void) { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -954,8 +955,10 @@ void CMMALVideo::Reset(void) +@@ -949,8 +950,10 @@ void CMMALVideo::Reset(void) pthread_mutex_unlock(&m_output_mutex); if (!m_finished) @@ -7874,7 +4350,7 @@ index 237a581..486dc4b 100644 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) +@@ -970,6 +973,12 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) if (g_advancedSettings.CanLogComponent(LOGVIDEO)) CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, buffer); @@ -7900,10 +4376,10 @@ index 415f3e3..011ae04 100644 // Video format int m_decoded_width; -From 444b6fc43e09650a22ac1ef9d6fe4c62fffaff19 Mon Sep 17 00:00:00 2001 +From 990f8994f15059962b6470b9ebf6469a3698b25b 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 +Subject: [PATCH 46/56] [mmalcodec] Handle resolution change from callback --- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 26 +++++----------------- @@ -7911,7 +4387,7 @@ Subject: [PATCH 77/89] [mmalcodec] Handle resolution change from callback 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 +index 5bdf145..f20eac7 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) @@ -7976,7 +4452,7 @@ index 486dc4b..39d6e60 100644 mmal_format_copy(m_dec_output->format, m_es_format); status = mmal_port_format_commit(m_dec_output); if (status != MMAL_SUCCESS) -@@ -832,17 +829,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -827,17 +824,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); @@ -8016,57 +4492,23 @@ index 011ae04..fcc6a15 100644 protected: void QueryCodec(void); - -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 1bc141b43b3995999f59422f2fb525c794c11b29 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 +Subject: [PATCH 47/56] [mmal] Enable zero copy +This is a bit subtle, but the reference counting of pictures is only shared +between arm side and gpu side when in zero copy mode. --- 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 +index c30de9c..cfceb78 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp +++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -133,6 +133,12 @@ bool CMMALRenderer::init_vout(ERenderFormat format) +@@ -132,6 +132,12 @@ bool CMMALRenderer::init_vout(ERenderFormat format) es_format->es->video.color_space = MMAL_COLOR_SPACE_SMPTE240M; } @@ -8080,7 +4522,7 @@ index 998d3d5..3eb4060 100644 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 +index f20eac7..443e023 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() @@ -8107,7 +4549,7 @@ index 39d6e60..1ab5254 100644 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 +@@ -656,6 +666,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); @@ -8118,7 +4560,7 @@ index 39d6e60..1ab5254 100644 status = mmal_port_format_commit(m_dec_output); if (status != MMAL_SUCCESS) { -@@ -685,14 +699,14 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -680,14 +694,14 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide return false; } @@ -8136,10 +4578,10 @@ index 39d6e60..1ab5254 100644 { 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 4deb049fc48343d69f5f736967cb922800baf439 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 16 Apr 2015 19:09:31 +0100 -Subject: [PATCH 83/89] flags debug +Subject: [PATCH 48/56] [mmalcodec] flags debug --- xbmc/cores/VideoRenderers/MMALRenderer.cpp | 11 ++++++----- @@ -8147,10 +4589,10 @@ Subject: [PATCH 83/89] flags debug 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 +index cfceb78..4b09b1f 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 * +@@ -48,12 +48,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; @@ -8166,7 +4608,7 @@ index 3eb4060..fa65c2b 100644 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) +@@ -376,7 +377,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) if (omvb) { #if defined(MMAL_DEBUG_VERBOSE) @@ -8175,14 +4617,14 @@ index 3eb4060..fa65c2b 100644 #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) +@@ -390,14 +391,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) { ++ CLog::Log(LOGDEBUG, "%s::%s - %p %d f:%x", CLASSNAME, __func__, buffer->mmal_buffer, source, buffer->mmal_buffer->flags); // we only want to upload frames once if (buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) return; @@ -8193,7 +4635,7 @@ index 3eb4060..fa65c2b 100644 } else diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 1ab5254..61cf8e2 100644 +index 443e023..6c6e05e 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -83,6 +83,7 @@ long CMMALVideoBuffer::Release() @@ -8213,20 +4655,20 @@ index 1ab5254..61cf8e2 100644 { if (buffer->length > 0) -From 1757168ee2f38cb7e56b27f9d8a4a8f180ed68b1 Mon Sep 17 00:00:00 2001 +From 768fa749d337b9016a5b7b561c77701b4008998d 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 +Subject: [PATCH 49/56] [mmal] Move the image pool from decoder to renderer --- xbmc/cores/VideoRenderers/BaseRenderer.h | 5 ++ - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 77 ++++++++++++++++++---- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 78 ++++++++++++++++++---- 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(-) + 7 files changed, 92 insertions(+), 40 deletions(-) diff --git a/xbmc/cores/VideoRenderers/BaseRenderer.h b/xbmc/cores/VideoRenderers/BaseRenderer.h index 389695a..264f0ad 100644 @@ -8245,10 +4687,10 @@ index 389695a..264f0ad 100644 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 +index 4b09b1f..5a65572 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp +++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -40,6 +40,50 @@ +@@ -39,6 +39,50 @@ #define MMAL_DEBUG_VERBOSE #endif @@ -8299,7 +4741,7 @@ index fa65c2b..5fbe2d2 100644 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) +@@ -163,14 +207,11 @@ bool CMMALRenderer::init_vout(ERenderFormat format) return false; } @@ -8318,7 +4760,7 @@ index fa65c2b..5fbe2d2 100644 } return true; } -@@ -179,10 +220,17 @@ bool CMMALRenderer::init_vout(ERenderFormat format) +@@ -178,10 +219,17 @@ bool CMMALRenderer::init_vout(ERenderFormat format) void CMMALRenderer::Process() { MMAL_BUFFER_HEADER_T *buffer; @@ -8339,7 +4781,15 @@ index fa65c2b..5fbe2d2 100644 } m_sync.Set(); } -@@ -382,7 +430,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) +@@ -198,6 +246,7 @@ CMMALRenderer::CMMALRenderer() + m_release_queue = mmal_queue_create(); + m_iFlags = 0; + m_format = RENDER_FMT_NONE; ++ m_mmal_video = NULL; + m_iYV12RenderBuffer = 0; + Create(); + } +@@ -381,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) @@ -8348,8 +4798,8 @@ index fa65c2b..5fbe2d2 100644 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) - { +@@ -396,7 +445,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + CLog::Log(LOGDEBUG, "%s::%s - %p %d f:%x", CLASSNAME, __func__, buffer->mmal_buffer, source, buffer->mmal_buffer->flags); // we only want to upload frames once if (buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) - return; @@ -8357,7 +4807,7 @@ index fa65c2b..5fbe2d2 100644 // 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) +@@ -405,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); @@ -8366,7 +4816,7 @@ index fa65c2b..5fbe2d2 100644 } void CMMALRenderer::FlipPage(int source) -@@ -467,6 +517,8 @@ void CMMALRenderer::UnInitMMAL() +@@ -466,6 +517,8 @@ void CMMALRenderer::UnInitMMAL() m_vout_input = NULL; } @@ -8375,7 +4825,7 @@ index fa65c2b..5fbe2d2 100644 if (m_vout_input_pool) { mmal_pool_destroy(m_vout_input_pool); -@@ -478,7 +530,6 @@ void CMMALRenderer::UnInitMMAL() +@@ -477,7 +530,6 @@ void CMMALRenderer::UnInitMMAL() mmal_component_release(m_vout); m_vout = NULL; } @@ -8415,10 +4865,10 @@ index 17b189e..f515d7a 100644 + void Prime(); }; diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index 25d3809..89faa65 100644 +index 6de299e..dfd1072 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -949,6 +949,14 @@ unsigned int CXBMCRenderManager::GetOptimalBufferSize() +@@ -948,6 +948,14 @@ unsigned int CXBMCRenderManager::GetOptimalBufferSize() return m_pRenderer->GetMaxBufferSize(); } @@ -8434,7 +4884,7 @@ index 25d3809..89faa65 100644 std::vector CXBMCRenderManager::SupportedFormats() { diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h -index f32f4a9..1d8fe88 100644 +index 4e553cb..606cbbd 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.h +++ b/xbmc/cores/VideoRenderers/RenderManager.h @@ -195,6 +195,11 @@ class CXBMCRenderManager @@ -8450,7 +4900,7 @@ index f32f4a9..1d8fe88 100644 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 +index 6c6e05e..3fcd79b 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -111,7 +111,6 @@ CMMALVideo::CMMALVideo() @@ -8490,7 +4940,7 @@ index 61cf8e2..1fdc44c 100644 return true; } -@@ -708,21 +703,14 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -703,17 +698,9 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide return false; } @@ -8508,12 +4958,7 @@ index 61cf8e2..1fdc44c 100644 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() +@@ -725,6 +712,7 @@ void CMMALVideo::Dispose() { // we are happy to exit, but let last shared pointer being deleted trigger the destructor bool done = false; @@ -8521,7 +4966,15 @@ index 61cf8e2..1fdc44c 100644 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) +@@ -747,6 +735,7 @@ void CMMALVideo::SetDropState(bool bDrop) + + int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + { ++ g_renderManager.PassCookie(this); + //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); +@@ -900,13 +889,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) return ret; } @@ -8535,7 +4988,7 @@ index 61cf8e2..1fdc44c 100644 void CMMALVideo::Reset(void) { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -957,10 +939,8 @@ void CMMALVideo::Reset(void) +@@ -952,10 +934,8 @@ void CMMALVideo::Reset(void) pthread_mutex_unlock(&m_output_mutex); if (!m_finished) @@ -8568,10 +5021,11 @@ index fcc6a15..204f004 100644 MMAL_ES_FORMAT_T *m_es_format; MMAL_COMPONENT_T *m_deint; -From 77dd3b8de1d73d01867d190bbcd4a82e67179c44 Mon Sep 17 00:00:00 2001 +From 14e949b4786aec964686e1b14af0db1175f64bab 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 +Subject: [PATCH 50/56] [mmalrenderer] Separate mmal and renderer configured + flags --- xbmc/cores/VideoRenderers/MMALRenderer.cpp | 26 +++++++++++++++----------- @@ -8579,10 +5033,10 @@ Subject: [PATCH 85/89] Separate mmal and renderer configured flags 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 +index 5a65572..05ccbac 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp +++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -74,13 +74,12 @@ void *CMMALRenderer::PassCookie(void *cookie) +@@ -73,13 +73,12 @@ void *CMMALRenderer::PassCookie(void *cookie) CLog::Log(LOGDEBUG, "%s::%s cookie:%p", CLASSNAME, __func__, cookie); #endif @@ -8601,7 +5055,7 @@ index 5fbe2d2..fe3dce4 100644 return NULL; } -@@ -122,10 +121,10 @@ bool CMMALRenderer::init_vout(ERenderFormat format) +@@ -121,10 +120,10 @@ bool CMMALRenderer::init_vout(ERenderFormat format) CLog::Log(LOGDEBUG, "%s::%s configured:%d format:%d->%d", CLASSNAME, __func__, m_bConfigured, m_format, format); @@ -8615,9 +5069,9 @@ index 5fbe2d2..fe3dce4 100644 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_mmal_video = NULL; + m_bConfigured = false; + m_bMMALConfigured = false; m_iYV12RenderBuffer = 0; @@ -8666,11 +5120,11 @@ index f515d7a..a694182 100644 unsigned int m_destWidth; unsigned int m_destHeight; -From abe0fca00a2e5b063ff45037f543429f4c87305c Mon Sep 17 00:00:00 2001 +From 74db1bf9cffab54f174c5eddd63154228bab959f 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 +Subject: [PATCH 51/56] [mmal] Separate the buffers from the decoder so decoder + can be destroyed first --- .../DVDCodecs/Video/DVDVideoCodecMMAL.cpp | 4 +- @@ -8712,7 +5166,7 @@ index aa8e87f..6014363 100644 #endif diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 1fdc44c..7a45c25 100644 +index 3fcd79b..6110c32 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -81,7 +81,8 @@ long CMMALVideoBuffer::Release() @@ -8758,7 +5212,7 @@ index 1fdc44c..7a45c25 100644 m_decoded_width = hints.width; m_decoded_height = hints.height; -@@ -716,21 +714,9 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -710,21 +708,9 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide void CMMALVideo::Dispose() { @@ -8780,9 +5234,9 @@ index 1fdc44c..7a45c25 100644 } 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) +@@ -737,8 +723,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { + g_renderManager.PassCookie(this); //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); @@ -8791,7 +5245,7 @@ index 1fdc44c..7a45c25 100644 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) +@@ -814,8 +800,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)) @@ -8802,7 +5256,7 @@ index 1fdc44c..7a45c25 100644 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) +@@ -882,8 +868,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) if (!ret) { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8813,7 +5267,7 @@ index 1fdc44c..7a45c25 100644 Sleep(10); // otherwise we busy spin } return ret; -@@ -927,7 +913,10 @@ void CMMALVideo::Reset(void) +@@ -922,7 +908,10 @@ void CMMALVideo::Reset(void) } pthread_mutex_unlock(&m_output_mutex); if (buffer) @@ -8825,7 +5279,7 @@ index 1fdc44c..7a45c25 100644 else break; } -@@ -970,8 +959,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) +@@ -965,8 +954,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) mmal_buffer_header_reset(buffer); buffer->cmd = 0; if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8836,7 +5290,7 @@ index 1fdc44c..7a45c25 100644 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) +@@ -975,28 +964,6 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) } } @@ -8910,26 +5364,27 @@ index 204f004..ab6e958 100644 // initialize mmal and get decoder component -From d93944688cae601453f2439169cf9a5834196177 Mon Sep 17 00:00:00 2001 +From 8cf59f193e56c3e7eba46e729490f326b08659d1 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 +Subject: [PATCH 52/56] [mmalcodec] 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.cpp | 3 +- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 4 +- xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in | 1 - - 5 files changed, 4 insertions(+), 168 deletions(-) + 6 files changed, 6 insertions(+), 169 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 +index b77a168..4633c18 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -@@ -39,7 +39,7 @@ +@@ -40,7 +40,7 @@ #if defined(HAS_IMXVPU) #include "Video/DVDVideoCodecIMX.h" #endif @@ -9122,6 +5577,20 @@ index 6014363..0000000 -}; - -#endif +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 6110c32..1bf1940 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -129,7 +129,8 @@ CMMALVideo::~CMMALVideo() + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); +- assert(m_finished); ++ if (!m_finished) ++ Dispose(); + + pthread_mutex_destroy(&m_output_mutex); + 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 @@ -9157,18 +5626,18 @@ index 6f5d3e8..56ec6a3 100644 LIB=Video.a -From 6b1c7ca35ed7a890db47cf528a4a5ebbd468b852 Mon Sep 17 00:00:00 2001 +From 2ced0d8763938f359bd7920b037d7e969a3a06ed 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 +Subject: [PATCH 53/56] [mmalcodec] Add shared lock around MMAL operations --- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 17 +++++++++++++++++ + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 16 ++++++++++++++++ xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 + - 2 files changed, 18 insertions(+) + 2 files changed, 17 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 7a45c25..2a6eb78 100644 +index 1bf1940..09d15fe88 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -127,6 +127,7 @@ CMMALVideo::CMMALVideo() @@ -9178,8 +5647,8 @@ index 7a45c25..2a6eb78 100644 + 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() + if (!m_finished) +@@ -175,6 +176,7 @@ CMMALVideo::~CMMALVideo() void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) { @@ -9187,7 +5656,7 @@ index 7a45c25..2a6eb78 100644 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 +@@ -289,6 +291,7 @@ static void dec_output_port_cb_static(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *b bool CMMALVideo::change_dec_output_format() { @@ -9195,7 +5664,7 @@ index 7a45c25..2a6eb78 100644 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() +@@ -325,6 +328,7 @@ bool CMMALVideo::change_dec_output_format() bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) { @@ -9203,7 +5672,7 @@ index 7a45c25..2a6eb78 100644 MMAL_STATUS_T status; if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -421,6 +425,7 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) +@@ -422,6 +426,7 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) bool CMMALVideo::DestroyDeinterlace() { @@ -9211,7 +5680,7 @@ index 7a45c25..2a6eb78 100644 MMAL_STATUS_T status; if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -477,6 +482,7 @@ bool CMMALVideo::DestroyDeinterlace() +@@ -478,6 +483,7 @@ bool CMMALVideo::DestroyDeinterlace() bool CMMALVideo::SendCodecConfigData() { @@ -9219,7 +5688,7 @@ index 7a45c25..2a6eb78 100644 MMAL_STATUS_T status; if (!m_dec_input_pool) return true; -@@ -506,6 +512,7 @@ bool CMMALVideo::SendCodecConfigData() +@@ -507,6 +513,7 @@ bool CMMALVideo::SendCodecConfigData() bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) { @@ -9227,15 +5696,7 @@ index 7a45c25..2a6eb78 100644 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) +@@ -710,6 +717,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) void CMMALVideo::Dispose() { g_renderManager.PassCookie(NULL); @@ -9243,15 +5704,15 @@ index 7a45c25..2a6eb78 100644 m_finished = true; Reset(); } -@@ -727,6 +736,7 @@ void CMMALVideo::SetDropState(bool bDrop) - +@@ -723,6 +731,7 @@ void CMMALVideo::SetDropState(bool bDrop) int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { + g_renderManager.PassCookie(this); + 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) +@@ -871,6 +880,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); @@ -9259,7 +5720,7 @@ index 7a45c25..2a6eb78 100644 Sleep(10); // otherwise we busy spin } return ret; -@@ -882,6 +893,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -878,6 +888,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) void CMMALVideo::Reset(void) { @@ -9267,7 +5728,7 @@ index 7a45c25..2a6eb78 100644 if (g_advancedSettings.CanLogComponent(LOGVIDEO)) CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); -@@ -946,6 +958,7 @@ void CMMALVideo::SetSpeed(int iSpeed) +@@ -942,6 +953,7 @@ void CMMALVideo::SetSpeed(int iSpeed) void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) { @@ -9275,7 +5736,7 @@ index 7a45c25..2a6eb78 100644 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) +@@ -967,6 +979,7 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) { @@ -9283,7 +5744,7 @@ index 7a45c25..2a6eb78 100644 if (!m_output_ready.empty()) { CMMALVideoBuffer *buffer; -@@ -1030,6 +1044,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) +@@ -1026,6 +1039,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) { @@ -9291,7 +5752,7 @@ index 7a45c25..2a6eb78 100644 if (pDvdVideoPicture->format == RENDER_FMT_MMAL) { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -1042,12 +1057,14 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) +@@ -1038,12 +1052,14 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) { @@ -9319,21 +5780,21 @@ index 3e444f7..e686b4b 100644 MMAL_PORT_T *m_dec_input; MMAL_PORT_T *m_dec_output; -From ec9d208ad8e921eb4479279154fe4b477d1f9c71 Mon Sep 17 00:00:00 2001 +From d693f1d572b85e7c2e0c230bd518d0e3c094d938 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 +Subject: [PATCH 54/56] [mmalrenderer] Add shared lock around MMAL operations --- - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 13 +++++++++++++ + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 11 ++++++++++- xbmc/cores/VideoRenderers/MMALRenderer.h | 1 + - 2 files changed, 14 insertions(+) + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index fe3dce4..7ebc2c9 100644 +index 05ccbac..270036d 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp +++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -44,6 +44,7 @@ +@@ -43,6 +43,7 @@ void CMMALRenderer::Prime() { @@ -9341,7 +5802,7 @@ index fe3dce4..7ebc2c9 100644 #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() +@@ -68,6 +69,7 @@ void CMMALRenderer::Prime() void *CMMALRenderer::PassCookie(void *cookie) { @@ -9349,15 +5810,7 @@ index fe3dce4..7ebc2c9 100644 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 +@@ -115,6 +117,7 @@ static void vout_input_port_cb_static(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *b bool CMMALRenderer::init_vout(ERenderFormat format) { @@ -9365,7 +5818,7 @@ index fe3dce4..7ebc2c9 100644 bool formatChanged = m_format != format; MMAL_STATUS_T status; -@@ -254,6 +258,7 @@ CMMALRenderer::CMMALRenderer() +@@ -254,6 +257,7 @@ CMMALRenderer::CMMALRenderer() CMMALRenderer::~CMMALRenderer() { @@ -9373,7 +5826,7 @@ index fe3dce4..7ebc2c9 100644 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) +@@ -276,6 +280,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) { @@ -9381,15 +5834,15 @@ index fe3dce4..7ebc2c9 100644 ReleaseBuffers(); m_sourceWidth = width; -@@ -306,6 +312,7 @@ bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned +@@ -363,7 +368,6 @@ int CMMALRenderer::GetImage(YV12Image *image, int source, bool readonly) - int CMMALRenderer::GetImage(YV12Image *image, int source, bool readonly) + void CMMALRenderer::ReleaseBuffer(int idx) { -+ 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() +- CSingleLock lock(m_sharedSection); + if (!m_bMMALConfigured || m_format == RENDER_FMT_BYPASS) + return; + +@@ -403,6 +407,7 @@ void CMMALRenderer::Update() void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) { @@ -9397,7 +5850,7 @@ index fe3dce4..7ebc2c9 100644 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) +@@ -463,6 +468,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) void CMMALRenderer::FlipPage(int source) { @@ -9405,7 +5858,7 @@ index fe3dce4..7ebc2c9 100644 if (!m_bConfigured || m_format == RENDER_FMT_BYPASS) return; -@@ -475,6 +484,7 @@ void CMMALRenderer::FlipPage(int source) +@@ -475,6 +481,7 @@ void CMMALRenderer::FlipPage(int source) unsigned int CMMALRenderer::PreInit() { @@ -9413,14 +5866,7 @@ index fe3dce4..7ebc2c9 100644 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: Sun, 19 Apr 2015 16:17:25 +0100 +Subject: [PATCH 55/56] [mmalcodec] Fix initialisation of m_format in init_vout + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 270036d..e73feed 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -129,7 +129,7 @@ bool CMMALRenderer::init_vout(ERenderFormat format) + if (m_bMMALConfigured) + return true; + +- m_format = RENDER_FMT_MMAL; ++ m_format = format; + if (m_format != RENDER_FMT_MMAL && m_format != RENDER_FMT_YUV420P) + return true; + +@@ -550,6 +550,7 @@ void CMMALRenderer::UnInitMMAL() + m_video_stereo_mode = RENDER_STEREO_MODE_OFF; + m_display_stereo_mode = RENDER_STEREO_MODE_OFF; + m_StereoInvert = false; ++ m_format = RENDER_FMT_NONE; + + m_bConfigured = false; + m_bMMALConfigured = false; + +From 055a522a3a5298ad53f3d0bad491d43d7f562ac8 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 21 Apr 2015 14:32:07 +0100 +Subject: [PATCH 56/56] [mmalrenderer] Add sharpness control + +--- + addons/resource.language.en_gb/resources/strings.po | 2 +- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 13 ++++++++++++- + xbmc/cores/VideoRenderers/MMALRenderer.h | 1 + + 3 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po +index fa25d45..94679d8 100644 +--- a/addons/resource.language.en_gb/resources/strings.po ++++ b/addons/resource.language.en_gb/resources/strings.po +@@ -7492,7 +7492,7 @@ msgstr "" + + #: xbmc/video/dialogs/GUIDialogVideoSettings.cpp + msgctxt "#16313" +-msgid "(VDPAU)Sharpness" ++msgid "Sharpness" + msgstr "" + + #: xbmc/video/dialogs/GUIDialogVideoSettings.cpp +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index e73feed..30e62b9 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -252,6 +252,7 @@ CMMALRenderer::CMMALRenderer() + m_bConfigured = false; + m_bMMALConfigured = false; + m_iYV12RenderBuffer = 0; ++ m_sharpness = -2.0f; + Create(); + } + +@@ -422,6 +423,15 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + if (m_RenderUpdateCallBackFn) + (*m_RenderUpdateCallBackFn)(m_RenderUpdateCallBackCtx, m_sourceRect, m_destRect); + ++ // if sharpness setting has changed, we should update it ++ if (m_sharpness != CMediaSettings::Get().GetCurrentVideoSettings().m_Sharpness) ++ { ++ m_sharpness = CMediaSettings::Get().GetCurrentVideoSettings().m_Sharpness; ++ char command[80], response[80]; ++ sprintf(command, "scaling_sharpness %d", ((int)(50.0f * (m_sharpness + 1.0f) + 0.5f))); ++ vc_gencmd(response, sizeof response, command); ++ } ++ + if (m_format == RENDER_FMT_BYPASS) + return; + +@@ -610,7 +620,8 @@ bool CMMALRenderer::Supports(ERENDERFEATURE feature) + feature == RENDERFEATURE_ZOOM || + feature == RENDERFEATURE_ROTATION || + feature == RENDERFEATURE_VERTICAL_SHIFT || +- feature == RENDERFEATURE_PIXEL_RATIO) ++ feature == RENDERFEATURE_PIXEL_RATIO || ++ feature == RENDERFEATURE_SHARPNESS) + return true; + + return false; +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h +index 6474c1b..8a22454 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.h ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.h +@@ -111,6 +111,7 @@ class CMMALRenderer : public CBaseRenderer, public CThread + RENDER_STEREO_MODE m_video_stereo_mode; + RENDER_STEREO_MODE m_display_stereo_mode; + bool m_StereoInvert; ++ float m_sharpness; + + CCriticalSection m_sharedSection; + MMAL_COMPONENT_T *m_vout; diff --git a/projects/RPi2/patches/kodi/kodi-001-isengard-rpb-backports.patch b/projects/RPi2/patches/kodi/kodi-001-isengard-rpb-backports.patch index 521019dd08..879938df5e 100644 --- a/projects/RPi2/patches/kodi/kodi-001-isengard-rpb-backports.patch +++ b/projects/RPi2/patches/kodi/kodi-001-isengard-rpb-backports.patch @@ -1,7 +1,29 @@ -From cef01168572238112d543362f6b4a6dc65b38cf2 Mon Sep 17 00:00:00 2001 +From e7a6d463c7df5946991024540c0b9afbf48e5a0a Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 24 Apr 2015 13:49:51 +0100 +Subject: [PATCH 01/56] [dvdplayer] Add back required include + +--- + xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +index 6b24b25..a3922c0 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +@@ -33,6 +33,7 @@ + #include "DVDCodecs/Video/DVDVideoPPFFmpeg.h" + #include "DVDCodecs/Video/DVDVideoCodecFFmpeg.h" + #include "DVDDemuxers/DVDDemux.h" ++#include "DVDDemuxers/DVDDemuxUtils.h" + #include "DVDOverlayRenderer.h" + #include "guilib/GraphicContext.h" + #include + +From 29b89ed811f96193f85fd761168a9dc88270afd3 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 01/89] [rbp/omxplayer] When opening a stream don't try to +Subject: [PATCH 02/56] [rbp/omxplayer] When opening a stream don't try to update gui so often --- @@ -25,10 +47,10 @@ index 2faceea..889d7a2 100644 g_windowManager.ProcessRenderLoop(false); if (allowCancel && dialog->IsCanceled()) -From ac38c688a0443bd965bf167def9f30e105e7227c Mon Sep 17 00:00:00 2001 +From 3703b7999256e773486d09fdaae7d4345ff8e0f0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 29 Apr 2014 15:23:22 +0100 -Subject: [PATCH 02/89] [ffmpeg] Speed up wtv index creation +Subject: [PATCH 03/56] [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,32 +136,10 @@ index 0000000..4ac5636 + } + } -From 10fca829203615581df049df3ab697eb26a0df13 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 2 Aug 2014 17:48:04 +0100 -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 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 - { - ret = true; - *userdata = tex; -+ CLog::Log(LOGDEBUG, "%s: decoded %s %dx%d", __func__, file->GetFilename(), width, height); - } - else - { - -From db0a6dc35272b3b14e9c463ed357ebd9df0431be Mon Sep 17 00:00:00 2001 +From 7c3357d9c9c6456e35927814af7d54cd4b11bff9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 04/89] [hifiberry] Hack: force it to be recognised as IEC958 +Subject: [PATCH 04/56] [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 d21d0015b0df19c700e1c63d5525546cc5f71f15 Mon Sep 17 00:00:00 2001 +From 18ae905e8eb0987c35e8a10ccfbcbcbf829ba77b Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 05/89] Improved file buffering in CArchive +Subject: [PATCH 05/56] 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,20 +225,20 @@ index 6ed0f8f..8506d95 100644 } else -From 02ffcb9c5cac171a3fb3e8ace0fb24fda0dd0db0 Mon Sep 17 00:00:00 2001 +From e564fb5d4b4f0e0db220c3e9b4017beb307ba377 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 12 Aug 2014 00:31:36 +0100 -Subject: [PATCH 06/89] [omxcodec] Don't force software codec with dvds +Subject: [PATCH 06/56] [omxcodec] Don't force software codec with dvds --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 143ea06..e029c16 100644 +index 37865b5..abe9f92 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -3345,7 +3345,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) +@@ -3372,7 +3372,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) hint.aspect = aspect; hint.forced_aspect = true; } @@ -249,10 +249,10 @@ index 143ea06..e029c16 100644 else if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) { -From 965be36a5564ce176d5d9c135b313e2323395242 Mon Sep 17 00:00:00 2001 +From e4d50075650921f209af54e14e2531824e24660f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 07/89] filesystem: Make support of browsing into archives +Subject: [PATCH 07/56] 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 dedca23..629f726 100644 +index 3e39938..06d261c 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16527,6 +16527,15 @@ msgstr "" +@@ -16525,6 +16525,15 @@ msgstr "" #: system/settings/rbp.xml msgctxt "#38010" msgid "GPU accelerated" @@ -290,7 +290,7 @@ index dedca23..629f726 100644 #. Setting #38011 "Videos -> Library -> Show All Items entry" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 3940ca8..8f1bfc4 100644 +index f89c00a..5b4391f 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -304,6 +304,11 @@ @@ -335,10 +335,10 @@ index 3a5ba4e..f1f6f79 100644 { // XBMC Smart playlist - just XML renamed to XSP // read the name of the playlist in -From d1698689aedc5255eaf125d2bbf7940c6ce8b1e2 Mon Sep 17 00:00:00 2001 +From c61ee467f28a868a6788ebf63c17ad9b9b02fe0e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 13:06:57 +0000 -Subject: [PATCH 09/89] [rbp] Make cachemembuffersize default depend on memory +Subject: [PATCH 09/56] [rbp] Make cachemembuffersize default depend on memory size --- @@ -377,7 +377,7 @@ index 59dd1da..aedae18 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 fab9a82..25ef7b8 100644 +index c4fa298..2ec904c 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -352,7 +352,12 @@ void CAdvancedSettings::Initialize() @@ -394,11 +394,10 @@ index fab9a82..25ef7b8 100644 // the following setting determines the readRate of a player data // as multiply of the default data read rate - -From 1690732bafc24f041aabaccd168f35e86ebdbbd2 Mon Sep 17 00:00:00 2001 +From 8318924e413a137e3dbe33efd9af1ddad6313735 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 11/89] [settings] Experiment: Report DESKTOP resolution in +Subject: [PATCH 11/56] [settings] Experiment: Report DESKTOP resolution in video settings --- @@ -420,10 +419,10 @@ index 1fafd9a..e0288aa 100644 StringUtils::Format("%dx%d%s", resolution->width, resolution->height, ModeFlagsToString(resolution->flags, false).c_str()), -From 2e5b318953c5635129b69c01f24919392b0af5da Mon Sep 17 00:00:00 2001 +From b9b068dce6d2eb40a605a43e97633e2432c87795 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 9 Sep 2014 12:04:26 +0100 -Subject: [PATCH 12/89] egl: Treat unknown display aspect ratio as square pixel +Subject: [PATCH 12/56] egl: Treat unknown display aspect ratio as square pixel --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 ++-- @@ -452,10 +451,10 @@ index bda7430..68fc647 100644 SetResolutionString(m_desktopRes); -From f585eaf62527f49edaa92c95322968c05189ac2f Mon Sep 17 00:00:00 2001 +From b25a9d54ee084817cbf1a73925434f0213c4eb44 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 13/89] [dvdplayer/rbp] Add pi specific option to maintain +Subject: [PATCH 13/56] [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". @@ -480,7 +479,7 @@ Needed updated firmware 9 files changed, 91 insertions(+), 7 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 629f726..129f0c7 100644 +index 06d261c..11f5315 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -6336,7 +6336,22 @@ msgctxt "#13459" @@ -507,7 +506,7 @@ index 629f726..129f0c7 100644 #: system/settings/settings.xml msgctxt "#13505" -@@ -16573,3 +16588,10 @@ msgstr "" +@@ -16571,3 +16586,10 @@ msgstr "" msgctxt "#38016" msgid "%d fps" msgstr "" @@ -519,7 +518,7 @@ index 629f726..129f0c7 100644 +msgstr "" + diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 8f1bfc4..ad90e8c 100644 +index 5b4391f..27f9773 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -572,6 +572,20 @@ @@ -558,18 +557,18 @@ index 782a9ba..3e0390c 100644 struct AEDelayStatus diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -index a345a88..bd357aa 100644 +index a429e11..2871ae2 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -@@ -25,6 +25,7 @@ - #include "DVDCodecs/DVDCodecs.h" +@@ -24,6 +24,7 @@ + #include "DVDCodecs/Audio/DVDAudioCodec.h" #include "DVDCodecs/DVDFactoryCodec.h" #include "settings/Settings.h" +#include "settings/AdvancedSettings.h" #include "video/VideoReferenceClock.h" #include "utils/log.h" - #include "utils/TimeUtils.h" -@@ -113,6 +114,9 @@ CDVDPlayerAudio::CDVDPlayerAudio(CDVDClock* pClock, CDVDMessageQueue& parent) + #include "utils/MathUtils.h" +@@ -111,6 +112,9 @@ CDVDPlayerAudio::CDVDPlayerAudio(CDVDClock* pClock, CDVDMessageQueue& parent) m_started = false; m_silence = false; m_resampleratio = 1.0; @@ -579,7 +578,7 @@ index a345a88..bd357aa 100644 m_synctype = SYNC_DISCON; m_setsynctype = SYNC_DISCON; m_prevsynctype = -1; -@@ -186,11 +190,13 @@ void CDVDPlayerAudio::OpenStream( CDVDStreamInfo &hints, CDVDAudioCodec* codec ) +@@ -184,11 +188,13 @@ void CDVDPlayerAudio::OpenStream( CDVDStreamInfo &hints, CDVDAudioCodec* codec ) m_synctype = SYNC_DISCON; m_setsynctype = SYNC_DISCON; if (CSettings::Get().GetBool("videoplayer.usedisplayasclock")) @@ -594,7 +593,7 @@ index a345a88..bd357aa 100644 m_integral = 0; m_prevskipped = false; m_syncclock = true; -@@ -233,7 +239,6 @@ void CDVDPlayerAudio::CloseStream(bool bWaitForBuffers) +@@ -231,7 +237,6 @@ void CDVDPlayerAudio::CloseStream(bool bWaitForBuffers) // uninit queue m_messageQueue.End(); @@ -602,7 +601,7 @@ index a345a88..bd357aa 100644 CLog::Log(LOGNOTICE, "Deleting audio codec"); if (m_pAudioCodec) { -@@ -486,7 +491,11 @@ void CDVDPlayerAudio::UpdatePlayerInfo() +@@ -484,7 +489,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) @@ -615,7 +614,7 @@ index a345a88..bd357aa 100644 s << ", att:" << fixed << setprecision(1) << log(GetCurrentAttenuation()) * 20.0f << " dB"; -@@ -641,8 +650,8 @@ void CDVDPlayerAudio::SetSyncType(bool passthrough) +@@ -639,8 +648,8 @@ void CDVDPlayerAudio::SetSyncType(bool passthrough) if (m_synctype != m_prevsynctype) { @@ -626,7 +625,7 @@ index a345a88..bd357aa 100644 CLog::Log(LOGDEBUG, "CDVDPlayerAudio:: synctype set to %i: %s", m_synctype, synctypes[synctype]); m_prevsynctype = m_synctype; } -@@ -752,7 +761,19 @@ void CDVDPlayerAudio::HandleSyncError(double duration) +@@ -750,7 +759,19 @@ void CDVDPlayerAudio::HandleSyncError(double duration) proportional = m_error / DVD_TIME_BASE / proportionaldiv; } m_resampleratio = 1.0 / m_pClock->GetClockSpeed() + proportional + m_integral; @@ -646,7 +645,7 @@ index a345a88..bd357aa 100644 } bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) -@@ -805,6 +826,7 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) +@@ -803,6 +824,7 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) { m_dvdAudio.AddPackets(audioframe); } @@ -654,7 +653,7 @@ index a345a88..bd357aa 100644 } else if (m_synctype == SYNC_DISCON) { -@@ -839,6 +861,10 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) +@@ -837,6 +859,10 @@ bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe) m_dvdAudio.SetResampleRatio(m_resampleratio); m_dvdAudio.AddPackets(audioframe); } @@ -666,10 +665,10 @@ index a345a88..bd357aa 100644 return true; } diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.h b/xbmc/cores/dvdplayer/DVDPlayerAudio.h -index 99ce952..635c184 100644 +index 1122a1d..7389754 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerAudio.h +++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.h -@@ -232,6 +232,9 @@ class CDVDPlayerAudio : public CThread, public IDVDStreamPlayerAudio +@@ -228,6 +228,9 @@ class CDVDPlayerAudio : public CThread, public IDVDStreamPlayerAudio bool m_prevskipped; double m_maxspeedadjust; double m_resampleratio; //resample ratio when using SYNC_RESAMPLE, used for the codec info @@ -715,7 +714,7 @@ index 9559914..65492fa 100644 private: DllBcmHost *m_DllBcmHost; diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 25ef7b8..76b5ce8 100644 +index 2ec904c..fd1c7c8 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -110,6 +110,7 @@ void CAdvancedSettings::Initialize() @@ -747,10 +746,10 @@ index b0b4df1..5e0b14c 100644 float m_audioPlayCountMinimumPercent; bool m_dvdplayerIgnoreDTSinWAV; -From dfbee238810b1825c24c466b6f7c90140a6c602f Mon Sep 17 00:00:00 2001 +From 94cec59be3b05120b76016c51cb96de2960d61ad Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 27 Sep 2014 15:32:37 +0100 -Subject: [PATCH 14/89] [dvdplayer] exerimental: don't raise priority of audio +Subject: [PATCH 14/56] [dvdplayer] exerimental: don't raise priority of audio thread --- @@ -758,10 +757,10 @@ Subject: [PATCH 14/89] [dvdplayer] exerimental: don't raise priority of audio 1 file changed, 4 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index e029c16..63f4a30 100644 +index abe9f92..2f687ac 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -3330,7 +3330,11 @@ bool CDVDPlayer::OpenAudioStream(CDVDStreamInfo& hint, bool reset) +@@ -3357,7 +3357,11 @@ bool CDVDPlayer::OpenAudioStream(CDVDStreamInfo& hint, bool reset) m_dvdPlayerAudio->SendMessage(new CDVDMsg(CDVDMsg::PLAYER_STARTED), 1); /* audio normally won't consume full cpu, so let it have prio */ @@ -774,10 +773,10 @@ index e029c16..63f4a30 100644 } -From e8a3d13ea42fc7a4f654a1b1b419a5cf0e3a1edc Mon Sep 17 00:00:00 2001 +From c0642bc05d3c606cdd62d6e92ddb4684299df785 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 15/89] [audio] Add settings option to boost centre channel +Subject: [PATCH 15/56] [audio] Add settings option to boost centre channel when downmixing This allows a dB volume increase to be added to centre channel. @@ -795,10 +794,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 129f0c7..7f44813 100644 +index 11f5315..b5f4731 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16595,3 +16595,17 @@ msgctxt "#38006" +@@ -16593,3 +16593,17 @@ msgctxt "#38006" msgid "Audio has to stay in sync, this can either be done by resampling, or adjusting the PLL" msgstr "" @@ -817,7 +816,7 @@ index 129f0c7..7f44813 100644 +msgid "%i dB" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index ad90e8c..ede89e4 100644 +index 27f9773..e833d3b 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -2645,6 +2645,18 @@ @@ -899,10 +898,10 @@ index f99c0e6..1911189 100644 // stereo upmix if (upmix && m_src_channels == 2 && m_dst_channels > 2) -From 726e56391004744900c2ab04c27e58a3e21f0d44 Mon Sep 17 00:00:00 2001 +From 6be4a7b9d3912b0a01869703857a97ce2996b3a4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 3 Oct 2014 18:40:06 +0100 -Subject: [PATCH 16/89] [SinkPi] Handle multichannel layout more like OMXAudio +Subject: [PATCH 16/56] [SinkPi] Handle multichannel layout more like OMXAudio --- xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 14 +++++++------- @@ -961,10 +960,10 @@ index a7691e8..d72a97a 100644 m_format = format; m_sinkbuffer_sec_per_byte = 1.0 / (double)(m_format.m_frameSize * m_format.m_sampleRate); -From d424942bfc56c3d49521f7c6ac5410385d1147c8 Mon Sep 17 00:00:00 2001 +From 9da1504c7da584cbec8866b0ede520f9f7652adc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 15:23:51 +0000 -Subject: [PATCH 17/89] [rbp] Default extract thumbnails to false +Subject: [PATCH 17/56] [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 @@ -994,11 +993,10 @@ index cb83297..8496abf 100644
- -From bdb2bce42352230100067f6ab19ac077ab391ca9 Mon Sep 17 00:00:00 2001 +From f8853c406f9824daf3d4f22cd290be3515cf70fe Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 15 Nov 2014 12:03:34 +0000 -Subject: [PATCH 21/89] [dvdplayer] Add lock for player creation +Subject: [PATCH 21/56] [dvdplayer] Add lock for player creation --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 3 +++ @@ -1006,10 +1004,10 @@ Subject: [PATCH 21/89] [dvdplayer] Add lock for player creation 2 files changed, 4 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 63f4a30..3c313cd 100644 +index 2f687ac..5062990 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -529,6 +529,7 @@ int CSelectionStreams::CountSource(StreamType type, StreamSource source) const +@@ -517,6 +517,7 @@ int CSelectionStreams::CountSource(StreamType type, StreamSource source) const void CDVDPlayer::CreatePlayers() { @@ -1017,7 +1015,7 @@ index 63f4a30..3c313cd 100644 #ifdef HAS_OMXPLAYER if (m_omxplayer_mode && OMXPlayerUnsuitable(m_HasVideo, m_HasAudio, m_pDemuxer, m_pInputStream, m_SelectionStreams)) { -@@ -558,6 +559,7 @@ void CDVDPlayer::CreatePlayers() +@@ -546,6 +547,7 @@ void CDVDPlayer::CreatePlayers() void CDVDPlayer::DestroyPlayers() { @@ -1025,7 +1023,7 @@ index 63f4a30..3c313cd 100644 if (!m_players_created) return; delete m_dvdPlayerVideo; -@@ -4190,6 +4192,7 @@ double CDVDPlayer::GetQueueTime() +@@ -4224,6 +4226,7 @@ double CDVDPlayer::GetQueueTime() void CDVDPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info) { @@ -1034,20 +1032,20 @@ index 63f4a30..3c313cd 100644 std::string retVal; diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h -index 468239c..3b8cefb 100644 +index f9e4bf7..41b9f22 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.h +++ b/xbmc/cores/dvdplayer/DVDPlayer.h -@@ -558,4 +558,5 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer +@@ -554,4 +554,5 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer // omxplayer variables struct SOmxPlayerState m_OmxPlayerState; bool m_omxplayer_mode; // using omxplayer acceleration + CCriticalSection m_players_lock; }; -From a40900ba3edf82d8ba63eb3e5e2ffd9a9810e42e Mon Sep 17 00:00:00 2001 +From e992a3be859498cfb4831524f7e2c756a0cea155 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 24 Nov 2014 22:07:25 +0000 -Subject: [PATCH 22/89] [dvdplayervideo] Prod decoder when in stills mode +Subject: [PATCH 22/56] [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. @@ -1056,20 +1054,10 @@ In dvd stills mode give it a chance to return pictures that weren't ready when f 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 69dc501..5832c58 100644 +index a3922c0..7f0073f 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -81,6 +81,9 @@ - #endif - #include "DVDPlayerAudio.h" - -+#include "cores/dvdplayer/DVDMessage.h" -+#include "cores/dvdplayer/DVDDemuxers/DVDDemuxUtils.h" -+ - using namespace std; - using namespace PVR; - -@@ -323,7 +323,8 @@ void CDVDPlayerVideo::Process() +@@ -317,7 +317,8 @@ void CDVDPlayerVideo::Process() while (!m_bStop) { @@ -1079,7 +1067,7 @@ index 69dc501..5832c58 100644 int iPriority = (m_speed == DVD_PLAYSPEED_PAUSE && m_started) ? 1 : 0; CDVDMsg* pMsg; -@@ -340,27 +341,36 @@ void CDVDPlayerVideo::Process() +@@ -334,27 +335,36 @@ void CDVDPlayerVideo::Process() if( iPriority ) continue; @@ -1134,10 +1122,10 @@ index 69dc501..5832c58 100644 if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE)) -From 8674cc04f73067ac9b26562f5ed1bbc87b61571c Mon Sep 17 00:00:00 2001 +From f9456da2ed3d4d15d703c5f366a0c1284369b769 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 27 Nov 2014 16:31:56 +0000 -Subject: [PATCH 23/89] [languageinvoker] Reduce priority of python threads +Subject: [PATCH 23/56] [languageinvoker] Reduce priority of python threads --- xbmc/interfaces/generic/LanguageInvokerThread.cpp | 5 +++++ @@ -1160,1826 +1148,10 @@ index fcdd063..16f0c89 100644 } -From c0d94a5d0a90ac3e0c8304f551d59ae150a04ccb Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 14 Dec 2013 16:55:05 +0000 -Subject: [PATCH 24/89] logging: Add microsecond timer to log messages - ---- - xbmc/utils/log.cpp | 17 +++++++++++++++-- - 1 file changed, 15 insertions(+), 2 deletions(-) - -diff --git a/xbmc/utils/log.cpp b/xbmc/utils/log.cpp -index 3443f12..31c4a99 100644 ---- a/xbmc/utils/log.cpp -+++ b/xbmc/utils/log.cpp -@@ -24,6 +24,7 @@ - #include "threads/Thread.h" - #include "utils/StringUtils.h" - #include "CompileInfo.h" -+#include "utils/TimeUtils.cpp" - - static const char* const levelNames[] = - {"DEBUG", "INFO", "NOTICE", "WARNING", "ERROR", "SEVERE", "FATAL", "NONE"}; -@@ -198,19 +199,31 @@ void CLog::PrintDebugString(const std::string& line) - - bool CLog::WriteLogString(int logLevel, const std::string& logString) - { -+#if defined(TARGET_LINUX) -+ static const char* prefixFormat = "%02.2d:%02.2d:%02.2d %10.6f T:%" PRIu64" %7s: "; -+#else - static const char* prefixFormat = "%02.2d:%02.2d:%02.2d T:%" PRIu64" %7s: "; -- -+#endif - std::string strData(logString); - /* fixup newline alignment, number of spaces should equal prefix length */ - StringUtils::Replace(strData, "\n", "\n "); - - int hour, minute, second; - s_globals.m_platform.GetCurrentLocalTime(hour, minute, second); -- -+ -+#if defined(TARGET_LINUX) -+ struct timespec now; -+ clock_gettime(CLOCK_MONOTONIC, &now); -+ float Now = now.tv_sec + now.tv_nsec * 1e-9; -+#endif -+ - strData = StringUtils::Format(prefixFormat, - hour, - minute, - second, -+#if defined(TARGET_LINUX) -+ Now, -+#endif - (uint64_t)CThread::GetCurrentThreadId(), - levelNames[logLevel]) + strData; - - -From 9148d35d4664d75cfa38af607202cb79e535d425 Mon Sep 17 00:00:00 2001 -From: macrule -Date: Thu, 11 Apr 2013 18:24:42 +0200 -Subject: [PATCH 25/89] Added some vc_tv_* functions that were missing in - DllBCM. - ---- - xbmc/linux/DllBCM.h | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/xbmc/linux/DllBCM.h b/xbmc/linux/DllBCM.h -index b92fdb8..9c7e293 100644 ---- a/xbmc/linux/DllBCM.h -+++ b/xbmc/linux/DllBCM.h -@@ -48,6 +48,9 @@ class DllBcmHostInterface - virtual void bcm_host_init() = 0; - virtual void bcm_host_deinit() = 0; - virtual int32_t graphics_get_display_size( const uint16_t display_number, uint32_t *width, uint32_t *height) = 0; -+ virtual int vc_tv_power_off() = 0; -+ virtual int vc_tv_sdtv_power_on(SDTV_MODE_T mode, SDTV_OPTIONS_T *options) = 0; -+ virtual int vc_tv_hdmi_power_on_preferred() = 0; - virtual int vc_tv_hdmi_power_on_best(uint32_t width, uint32_t height, uint32_t frame_rate, - HDMI_INTERLACED_T scan_mode, EDID_MODE_MATCH_FLAG_T match_flags) = 0; - virtual int vc_tv_hdmi_power_on_best_3d(uint32_t width, uint32_t height, uint32_t frame_rate, -@@ -92,6 +95,12 @@ class DllBcmHost : public DllDynamic, DllBcmHostInterface - { return ::bcm_host_deinit(); }; - virtual int32_t graphics_get_display_size( const uint16_t display_number, uint32_t *width, uint32_t *height) - { return ::graphics_get_display_size(display_number, width, height); }; -+ virtual int vc_tv_power_off() -+ { return ::vc_tv_power_off(); } -+ virtual int vc_tv_sdtv_power_on(SDTV_MODE_T mode, SDTV_OPTIONS_T *options) -+ { return ::vc_tv_sdtv_power_on(mode, options); } -+ virtual int vc_tv_hdmi_power_on_preferred() -+ { return ::vc_tv_hdmi_power_on_preferred(); } - virtual int vc_tv_hdmi_power_on_best(uint32_t width, uint32_t height, uint32_t frame_rate, - 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 1c09b17c3d8d8631708d0feaa2b03ac38451d23b Mon Sep 17 00:00:00 2001 -From: macrule -Date: Thu, 11 Apr 2013 18:29:03 +0200 -Subject: [PATCH 26/89] Added private utility function to map a float display - aspect, to the respective SDTV_ASPECT_* enum value. - ---- - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -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) - res.dwFlags & D3DPRESENTFLAG_MODE3DTB ? " 3DTB" : "", - res.dwFlags & D3DPRESENTFLAG_MODE3DSBS ? " 3DSBS" : ""); - } -+ -+static SDTV_ASPECT_T get_sdtv_aspect_from_display_aspect(float display_aspect) -+{ -+ SDTV_ASPECT_T aspect; -+ const float delta = 1e-3; -+ if(fabs(get_display_aspect_ratio(SDTV_ASPECT_16_9) - display_aspect) < delta) -+ { -+ aspect = SDTV_ASPECT_16_9; -+ } -+ else if(fabs(get_display_aspect_ratio(SDTV_ASPECT_14_9) - display_aspect) < delta) -+ { -+ aspect = SDTV_ASPECT_14_9; -+ } -+ else -+ { -+ aspect = SDTV_ASPECT_4_3; -+ } -+ return aspect; -+} - #endif - - bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &resolutions) - -From d339ba599375b756dbbe5e878519b3b02f19d8bd Mon Sep 17 00:00:00 2001 -From: macrule -Date: Thu, 11 Apr 2013 19:50:58 +0200 -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. - ---- - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 36 ++++++++++++++++++++----- - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.h | 1 - - 2 files changed, 29 insertions(+), 8 deletions(-) - -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -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) - - DestroyDispmaxWindow(); - -- if(!m_fixedMode && GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) -+ if(GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) - { - sem_init(&m_tv_synced, 0, 0); - m_DllBcmHost->vc_tv_register_callback(CallbackTvServiceCallback, this); -@@ -276,6 +276,33 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) - - m_desktopRes = res; - } -+ else if(!GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) -+ { -+ sem_init(&m_tv_synced, 0, 0); -+ m_DllBcmHost->vc_tv_register_callback(CallbackTvServiceCallback, this); -+ -+ SDTV_OPTIONS_T options; -+ options.aspect = get_sdtv_aspect_from_display_aspect((float)res.iScreenWidth / (float)res.iScreenHeight); -+ -+ int success = m_DllBcmHost->vc_tv_sdtv_power_on((SDTV_MODE_T)GETFLAGS_MODE(res.dwFlags), &options); -+ -+ if (success == 0) -+ { -+ CLog::Log(LOGDEBUG, "EGL set SDTV mode (%d,%d)=%d\n", -+ GETFLAGS_GROUP(res.dwFlags), GETFLAGS_MODE(res.dwFlags), success); -+ -+ sem_wait(&m_tv_synced); -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "EGL failed to set SDTV mode (%d,%d)=%d\n", -+ GETFLAGS_GROUP(res.dwFlags), GETFLAGS_MODE(res.dwFlags), success); -+ } -+ m_DllBcmHost->vc_tv_unregister_callback(CallbackTvServiceCallback); -+ sem_destroy(&m_tv_synced); -+ -+ m_desktopRes = res; -+ } - - m_dispman_display = g_RBP.OpenDisplay(0); - -@@ -441,8 +468,6 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r - if(!m_DllBcmHost) - return false; - -- m_fixedMode = false; -- - /* read initial desktop resolution before probe resolutions. - * probing will replace the desktop resolution when it finds the same one. - * we raplace it because probing will generate more detailed -@@ -491,7 +516,7 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r - m_desktopRes.iHeight = tv_state.display.sdtv.height; - m_desktopRes.iScreenWidth = tv_state.display.sdtv.width; - m_desktopRes.iScreenHeight= tv_state.display.sdtv.height; -- m_desktopRes.dwFlags = D3DPRESENTFLAG_INTERLACED; -+ m_desktopRes.dwFlags = MAKEFLAGS(HDMI_RES_GROUP_INVALID, tv_state.display.sdtv.mode, 1); - m_desktopRes.fRefreshRate = (float)tv_state.display.sdtv.frame_rate; - m_desktopRes.fPixelRatio = tv_state.display.hdmi.display_options.aspect == 0 ? 1.0f : get_display_aspect_ratio((SDTV_ASPECT_T)tv_state.display.sdtv.display_options.aspect) / ((float)m_desktopRes.iScreenWidth / (float)m_desktopRes.iScreenHeight); - } -@@ -514,9 +539,6 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r - CLog::Log(LOGDEBUG, "EGL probe resolution %s:%x\n", m_desktopRes.strMode.c_str(), m_desktopRes.dwFlags); - } - -- if(resolutions.size() < 2) -- m_fixedMode = true; -- - DLOG("CEGLNativeTypeRaspberryPI::ProbeResolutions\n"); - return true; - #else -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.h b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.h -index 59401f5..a0acb1a 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.h -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.h -@@ -59,7 +59,6 @@ class CEGLNativeTypeRaspberryPI : public CEGLNativeType - DISPMANX_ELEMENT_HANDLE_T m_dispman_element; - TV_GET_STATE_RESP_T m_tv_state; - sem_t m_tv_synced; -- bool m_fixedMode; - RESOLUTION_INFO m_desktopRes; - int m_width; - int m_height; - -From 8ebee675392f628fd18e803d549f69fcac428f01 Mon Sep 17 00:00:00 2001 -From: macrule -Date: Thu, 11 Apr 2013 19:54:59 +0200 -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. - ---- - xbmc/linux/RBP.cpp | 13 +++++++++++++ - xbmc/linux/RBP.h | 3 +++ - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 3 +++ - 3 files changed, 19 insertions(+) - -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index a4b0c2a..160eb96 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -233,5 +233,18 @@ double CRBP::AdjustHDMIClock(double adjust) - return new_adjust; - } - -+void CRBP::SuspendVideoOutput() -+{ -+ CLog::Log(LOGDEBUG, "Raspberry PI suspending video output\n"); -+ char response[80]; -+ m_DllBcmHost->vc_gencmd(response, sizeof response, "display_power 0"); -+} -+ -+void CRBP::ResumeVideoOutput() -+{ -+ char response[80]; -+ m_DllBcmHost->vc_gencmd(response, sizeof response, "display_power 1"); -+ CLog::Log(LOGDEBUG, "Raspberry PI resuming video output\n"); -+} - - #endif -diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index 65492fa..38fb252 100644 ---- a/xbmc/linux/RBP.h -+++ b/xbmc/linux/RBP.h -@@ -65,6 +65,9 @@ class CRBP - void WaitVsync(); - double AdjustHDMIClock(double adjust); - -+ void SuspendVideoOutput(); -+ void ResumeVideoOutput(); -+ - private: - DllBcmHost *m_DllBcmHost; - bool m_initialized; -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 4826d37..7d9b0d3 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -60,7 +60,10 @@ - # define DLOG(fmt, args...) - #endif - -+#if defined(TARGET_RASPBERRY_PI) - static void SetResolutionString(RESOLUTION_INFO &res); -+static SDTV_ASPECT_T get_sdtv_aspect_from_display_aspect(float display_aspect); -+#endif - - CEGLNativeTypeRaspberryPI::CEGLNativeTypeRaspberryPI() - { - -From 0739fee7877f4856d12321465b2b9744de086b46 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 11 Aug 2013 15:03:36 +0100 -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 - - xbmc/input/InputManager.cpp | 8 ++++++++ - xbmc/powermanagement/IPowerSyscall.h | 7 +++++++ - xbmc/powermanagement/PowerManager.cpp | 6 ++++++ - xbmc/powermanagement/PowerManager.h | 3 +++ - 5 files changed, 24 insertions(+), 1 deletion(-) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 135b466..df6e8ca 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -2043,7 +2043,6 @@ void CApplication::SetStandAlone(bool value) - g_advancedSettings.m_handleMounting = m_bStandalone = value; - } - -- - // OnAppCommand is called in response to a XBMC_APPCOMMAND event. - // This needs to return true if it processed the appcommand or false if it didn't - bool CApplication::OnAppCommand(const CAction &action) -diff --git a/xbmc/input/InputManager.cpp b/xbmc/input/InputManager.cpp -index c6f62d8db0..f90fa89 100644 ---- a/xbmc/input/InputManager.cpp -+++ b/xbmc/input/InputManager.cpp -@@ -30,6 +30,7 @@ - #include "guilib/GUIWindow.h" - #include "guilib/GUIWindowManager.h" - #include "guilib/GUIMessage.h" -+#include "powermanagement/PowerManager.h" - - #ifdef HAS_EVENT_SERVER - #include "network/EventServer.h" -@@ -524,6 +525,13 @@ bool CInputManager::OnKey(const CKey& key) - // special handling if the screensaver is active - CAction action = CButtonTranslator::GetInstance().GetAction(iWin, key); - -+ // give the PowerManager a chance to process a keypress, and -+ // suppress further processing. we need this for virtual sleep. -+ if (g_powerManager.ProcessAction(action)) -+ { -+ return true; -+ } -+ - // a key has been pressed. - // reset Idle Timer - g_application.ResetSystemIdleTimer(); -diff --git a/xbmc/powermanagement/IPowerSyscall.h b/xbmc/powermanagement/IPowerSyscall.h -index 7f9e7ed..711abea 100644 ---- a/xbmc/powermanagement/IPowerSyscall.h -+++ b/xbmc/powermanagement/IPowerSyscall.h -@@ -20,6 +20,9 @@ - * - */ - -+// forward declaration -+class CAction; -+ - class IPowerEventsCallback - { - public: -@@ -60,6 +63,10 @@ class IPowerSyscall - \param callback the callback to signal to - */ - virtual bool PumpPowerEvents(IPowerEventsCallback *callback) = 0; -+ -+ // this is an optional part of the interface, so we provide a no-op implementation here. -+ // return true to suppress further processing of the CAction. -+ virtual bool ProcessAction(const CAction& action) { return false; } - }; - - class CPowerSyscallWithoutEvents : public IPowerSyscall -diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp -index 5900f98..6e819d9 100644 ---- a/xbmc/powermanagement/PowerManager.cpp -+++ b/xbmc/powermanagement/PowerManager.cpp -@@ -225,6 +225,12 @@ void CPowerManager::ProcessEvents() - nesting--; - } - -+bool CPowerManager::ProcessAction(const CAction& action) -+{ -+ return m_instance->ProcessAction(action); -+} -+ -+ - void CPowerManager::OnSleep() - { - CAnnouncementManager::Get().Announce(System, "xbmc", "OnSleep"); -diff --git a/xbmc/powermanagement/PowerManager.h b/xbmc/powermanagement/PowerManager.h -index 0b1f10a..e42b143 100644 ---- a/xbmc/powermanagement/PowerManager.h -+++ b/xbmc/powermanagement/PowerManager.h -@@ -58,6 +58,8 @@ class CNullPowerSyscall : public IPowerSyscall - - - virtual bool PumpPowerEvents(IPowerEventsCallback *callback) { return false; } -+ -+ virtual bool ProcessAction(const CAction& action) { return false; } - }; - - // This class will wrap and handle PowerSyscalls. -@@ -87,6 +89,7 @@ class CPowerManager : public IPowerEventsCallback - - static void SettingOptionsShutdownStatesFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t, void *data); - -+ bool ProcessAction(const CAction& action); - private: - void OnSleep(); - void OnWake(); - -From 94a8bac3feaeed3edd78e9e49f209b92ef5c87f9 Mon Sep 17 00:00:00 2001 -From: macrule -Date: Wed, 17 Apr 2013 13:23:01 +0200 -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 + - xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 84 +++++++++++++++++++++++ - xbmc/powermanagement/PowerSyscallVirtualSleep.h | 56 +++++++++++++++ - 3 files changed, 141 insertions(+) - create mode 100644 xbmc/powermanagement/PowerSyscallVirtualSleep.cpp - create mode 100644 xbmc/powermanagement/PowerSyscallVirtualSleep.h - -diff --git a/xbmc/powermanagement/Makefile b/xbmc/powermanagement/Makefile -index 0b4c029..16056af 100644 ---- a/xbmc/powermanagement/Makefile -+++ b/xbmc/powermanagement/Makefile -@@ -1,5 +1,6 @@ - SRCS=DPMSSupport.cpp \ - PowerManager.cpp \ -+ PowerSyscallVirtualSleep.cpp \ - - LIB=powermanagement.a - -diff --git a/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp b/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -new file mode 100644 -index 0000000..9e6c8e4 ---- /dev/null -+++ b/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -@@ -0,0 +1,84 @@ -+/* -+ * Copyright (C) 2013 Team XBMC -+ * http://www.xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#include "PowerSyscallVirtualSleep.h" -+#include "input/Key.h" -+#include "utils/log.h" -+#include "utils/StringUtils.h" -+ -+bool CPowerSyscallVirtualSleep::Suspend() -+{ -+ if (m_virtualSleepState == VIRTUAL_SLEEP_STATE_AWAKE) -+ { -+ if (VirtualSleep()) -+ { -+ m_virtualSleepState = VIRTUAL_SLEEP_STATE_WILL_SLEEP; -+ return true; -+ } -+ } -+ -+ return false; -+} -+ -+bool CPowerSyscallVirtualSleep::PumpPowerEvents(IPowerEventsCallback *callback) -+{ -+ if (m_virtualSleepState == VIRTUAL_SLEEP_STATE_WILL_WAKE) -+ { -+ callback->OnWake(); -+ m_virtualSleepState = VIRTUAL_SLEEP_STATE_AWAKE; -+ return true; -+ } -+ else if (m_virtualSleepState == VIRTUAL_SLEEP_STATE_WILL_SLEEP) -+ { -+ callback->OnSleep(); -+ m_virtualSleepState = VIRTUAL_SLEEP_STATE_ASLEEP; -+ return true; -+ } -+ -+ return false; -+} -+ -+bool CPowerSyscallVirtualSleep::ProcessAction(const CAction& action) -+{ -+ if (m_virtualSleepState != VIRTUAL_SLEEP_STATE_ASLEEP) -+ return false; -+ -+ // device is in virtual sleep, only one of the power keys will -+ // wake it up again. -+ if (action.GetID() == ACTION_BUILT_IN_FUNCTION) -+ { -+ std::string name = action.GetName(); -+ StringUtils::ToLower(name); -+ if(name.Equals("xbmc.suspend()") || -+ name.Equals("shutdown") || -+ name.Equals("suspend") || -+ name.Equals("hibernate")) -+ { -+ if(VirtualWake()) -+ { -+ m_virtualSleepState = VIRTUAL_SLEEP_STATE_WILL_WAKE; -+ return false; -+ } -+ } -+ } -+ -+ // wasn't a power key, suppress this and stay asleep -+ return true; -+} -diff --git a/xbmc/powermanagement/PowerSyscallVirtualSleep.h b/xbmc/powermanagement/PowerSyscallVirtualSleep.h -new file mode 100644 -index 0000000..ef6e682 ---- /dev/null -+++ b/xbmc/powermanagement/PowerSyscallVirtualSleep.h -@@ -0,0 +1,56 @@ -+/* -+ * Copyright (C) 2013 Team XBMC -+ * http://www.xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#ifndef _POWER_SYSCALL_VIRTUAL_SLEEP_H_ -+#define _POWER_SYSCALL_VIRTUAL_SLEEP_H_ -+#include "IPowerSyscall.h" -+ -+// Systems that have no native standby mode, can base their -+// IPowerSyscall implementation on this class, and need only -+// implement VirtualSleep()/VirtualWake(). -+class CPowerSyscallVirtualSleep : public IPowerSyscall -+{ -+public: -+ CPowerSyscallVirtualSleep() : m_virtualSleepState(VIRTUAL_SLEEP_STATE_AWAKE) {} -+ virtual ~CPowerSyscallVirtualSleep() {} -+ -+ virtual bool CanSuspend() { return true; } -+ virtual bool Suspend(); -+ -+ virtual bool PumpPowerEvents(IPowerEventsCallback *callback); -+ -+ virtual bool ProcessAction(const CAction& action); -+ -+ virtual bool VirtualSleep() = 0; -+ virtual bool VirtualWake() = 0; -+ -+protected: -+ // keep track of virtual sleep state for devices that support it -+ typedef enum { -+ VIRTUAL_SLEEP_STATE_AWAKE = 0, -+ VIRTUAL_SLEEP_STATE_ASLEEP, -+ VIRTUAL_SLEEP_STATE_WILL_WAKE, -+ VIRTUAL_SLEEP_STATE_WILL_SLEEP, -+ } VirtualSleepState; -+ -+ VirtualSleepState m_virtualSleepState; -+}; -+ -+#endif // _POWER_SYSCALL_VIRTUAL_SLEEP_H_ - -From 4e72dbc0c34cd319b3168551ee14ebc6ea78739c Mon Sep 17 00:00:00 2001 -From: macrule -Date: Wed, 17 Apr 2013 13:24:22 +0200 -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. - ---- - xbmc/powermanagement/PowerManager.cpp | 4 ++ - xbmc/powermanagement/linux/Makefile | 1 + - .../linux/RaspberryPIPowerSyscall.cpp | 38 +++++++++++++++++ - .../linux/RaspberryPIPowerSyscall.h | 49 ++++++++++++++++++++++ - 4 files changed, 92 insertions(+) - create mode 100644 xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp - create mode 100644 xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h - -diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp -index 6e819d9..2d8c750 100644 ---- a/xbmc/powermanagement/PowerManager.cpp -+++ b/xbmc/powermanagement/PowerManager.cpp -@@ -38,6 +38,8 @@ - - #if defined(TARGET_DARWIN) - #include "osx/CocoaPowerSyscall.h" -+#elif defined(TARGET_RASPBERRY_PI) -+#include "linux/RaspberryPIPowerSyscall.h" - #elif defined(TARGET_ANDROID) - #include "android/AndroidPowerSyscall.h" - #elif defined(TARGET_POSIX) -@@ -71,6 +73,8 @@ void CPowerManager::Initialize() - { - #if defined(TARGET_DARWIN) - m_instance = new CCocoaPowerSyscall(); -+#elif defined(TARGET_RASPBERRY_PI) -+ m_instance = new CRaspberryPIPowerSyscall(); - #elif defined(TARGET_ANDROID) - m_instance = new CAndroidPowerSyscall(); - #elif defined(TARGET_POSIX) -diff --git a/xbmc/powermanagement/linux/Makefile b/xbmc/powermanagement/linux/Makefile -index e9d95fb..b130812 100644 ---- a/xbmc/powermanagement/linux/Makefile -+++ b/xbmc/powermanagement/linux/Makefile -@@ -1,5 +1,6 @@ - SRCS=ConsoleDeviceKitPowerSyscall.cpp \ - ConsoleUPowerSyscall.cpp \ -+ RaspberryPIPowerSyscall.cpp \ - UPowerSyscall.cpp \ - LogindUPowerSyscall.cpp - -diff --git a/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp -new file mode 100644 -index 0000000..10deeb8 ---- /dev/null -+++ b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp -@@ -0,0 +1,38 @@ -+/* -+ * Copyright (C) 2013 Team XBMC -+ * http://www.xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#if defined(TARGET_RASPBERRY_PI) -+ -+#include "RaspberryPIPowerSyscall.h" -+#include "RBP.h" -+ -+bool CRaspberryPIPowerSyscall::VirtualSleep() -+{ -+ g_RBP.SuspendVideoOutput(); -+ return true; -+} -+ -+bool CRaspberryPIPowerSyscall::VirtualWake() -+{ -+ g_RBP.ResumeVideoOutput(); -+ return true; -+} -+ -+#endif -diff --git a/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h -new file mode 100644 -index 0000000..fd1d67c ---- /dev/null -+++ b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h -@@ -0,0 +1,49 @@ -+#pragma once -+/* -+ * Copyright (C) 2013 Team XBMC -+ * http://www.xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#ifndef _RASPBERRY_PI_POWER_SYSCALL_H_ -+#define _RASPBERRY_PI_POWER_SYSCALL_H_ -+ -+#if defined(TARGET_RASPBERRY_PI) -+#include "powermanagement/PowerSyscallVirtualSleep.h" -+ -+class CRaspberryPIPowerSyscall : public CPowerSyscallVirtualSleep -+{ -+public: -+ CRaspberryPIPowerSyscall() : CPowerSyscallVirtualSleep() {} -+ virtual ~CRaspberryPIPowerSyscall() {} -+ -+ virtual bool Powerdown() { return false; } -+ virtual bool Hibernate() { return false; } -+ virtual bool Reboot() { return false; } -+ -+ virtual bool CanPowerdown() { return false; } -+ virtual bool CanHibernate() { return false; } -+ virtual bool CanReboot() { return true; } -+ -+ virtual int BatteryLevel() { return 0; } -+ -+ virtual bool VirtualSleep(); -+ virtual bool VirtualWake(); -+}; -+#endif // TARGET_RASPBERRY_PI -+ -+#endif // _RASPBERRY_PI_POWER_SYSCALL_H_ - -From 1e00d7bc6e5e193d12b3224d6801fb1dc8bf3b61 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Mar 2014 16:16:29 +0000 -Subject: [PATCH 32/89] [power] hack - don't kill lirc or cec - ---- - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 37 +++++++++++++++++++++++ - xbmc/powermanagement/PowerManager.cpp | 4 +-- - 2 files changed, 39 insertions(+), 2 deletions(-) - -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index 3d0c07d..ae5583d 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -186,12 +186,49 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender, - } - else if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnSleep")) - { -+#if 1 -+ bool bSendStandbyCommands(false); -+ { -+ CSingleLock lock(m_critSection); -+ bSendStandbyCommands = m_iExitCode != EXITCODE_REBOOT && -+ m_iExitCode != EXITCODE_RESTARTAPP && -+ !m_bDeviceRemoved && -+ (!m_bGoingToStandby || GetSettingBool("standby_tv_on_pc_standby")) && -+ GetSettingBool("enabled"); -+ -+ if (m_bGoingToStandby) -+ m_bActiveSourceBeforeStandby = m_cecAdapter->IsLibCECActiveSource(); -+ } -+ -+ if (bSendStandbyCommands) -+ { -+ if (m_cecAdapter->IsLibCECActiveSource()) -+ { -+ if (!m_configuration.powerOffDevices.IsEmpty()) -+ { -+ CLog::Log(LOGDEBUG, "%s - sending standby commands", __FUNCTION__); -+ m_standbySent = CDateTime::GetCurrentDateTime(); -+ m_cecAdapter->StandbyDevices(); -+ } -+ else if (m_configuration.bSendInactiveSource == 1) -+ { -+ CLog::Log(LOGDEBUG, "%s - sending inactive source commands", __FUNCTION__); -+ m_cecAdapter->SetInactiveView(); -+ } -+ } -+ else -+ { -+ CLog::Log(LOGDEBUG, "%s - XBMC is not the active source, not sending any standby commands", __FUNCTION__); -+ } -+ } -+#else - // this will also power off devices when we're the active source - { - CSingleLock lock(m_critSection); - m_bGoingToStandby = true; - } - StopThread(); -+#endif - } - else if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnWake")) - { -diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp -index 2d8c750..901f449 100644 ---- a/xbmc/powermanagement/PowerManager.cpp -+++ b/xbmc/powermanagement/PowerManager.cpp -@@ -241,7 +241,7 @@ void CPowerManager::OnSleep() - CLog::Log(LOGNOTICE, "%s: Running sleep jobs", __FUNCTION__); - - // stop lirc --#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) -+#if 0 //defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - CLog::Log(LOGNOTICE, "%s: Stopping lirc", __FUNCTION__); - CBuiltins::Execute("LIRC.Stop"); - #endif -@@ -277,7 +277,7 @@ void CPowerManager::OnWake() - #endif - - // restart lirc --#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) -+#if 0 // defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - CLog::Log(LOGNOTICE, "%s: Restarting lirc", __FUNCTION__); - CBuiltins::Execute("LIRC.Start"); - #endif - -From ca8103aa0469ee82fe6da538e2d19cf33cabfc2c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Mar 2014 16:47:54 +0000 -Subject: [PATCH 33/89] [power] hack - wake on any action - ---- - xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp b/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -index 9e6c8e4..78566ec 100644 ---- a/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -+++ b/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -@@ -62,14 +62,14 @@ bool CPowerSyscallVirtualSleep::ProcessAction(const CAction& action) - - // device is in virtual sleep, only one of the power keys will - // wake it up again. -- if (action.GetID() == ACTION_BUILT_IN_FUNCTION) -+ //if (action.GetID() == ACTION_BUILT_IN_FUNCTION) - { - std::string name = action.GetName(); - StringUtils::ToLower(name); -- if(name.Equals("xbmc.suspend()") || -+ /*if(name.Equals("system.suspend") || - name.Equals("shutdown") || - name.Equals("suspend") || -- name.Equals("hibernate")) -+ name.Equals("hibernate"))*/ - { - if(VirtualWake()) - { - -From 2db6f609de8998c2db449d0471699e02c6a6f46c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Mar 2014 17:30:07 +0000 -Subject: [PATCH 34/89] [power] hack - Make suspend toggle suspend state - ---- - xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp b/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -index 78566ec..4cffcce 100644 ---- a/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -+++ b/xbmc/powermanagement/PowerSyscallVirtualSleep.cpp -@@ -33,6 +33,11 @@ bool CPowerSyscallVirtualSleep::Suspend() - return true; - } - } -+ else if (VirtualWake()) -+ { -+ m_virtualSleepState = VIRTUAL_SLEEP_STATE_WILL_WAKE; -+ return false; -+ } - - return false; - } - -From c42ebe26c18468fb40569e4f5b0eb387ac835670 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 4 Mar 2014 19:33:44 +0000 -Subject: [PATCH 35/89] [power] Add back in powerdown and reboot - ---- - .../linux/RaspberryPIPowerSyscall.cpp | 34 ++++++++++++++++++++++ - .../linux/RaspberryPIPowerSyscall.h | 6 ++-- - 2 files changed, 37 insertions(+), 3 deletions(-) - -diff --git a/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp -index 10deeb8..220bca9 100644 ---- a/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp -+++ b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp -@@ -20,7 +20,11 @@ - - #if defined(TARGET_RASPBERRY_PI) - -+#include "system.h" - #include "RaspberryPIPowerSyscall.h" -+#if defined(HAS_DBUS) -+#include "LogindUPowerSyscall.h" -+#endif - #include "RBP.h" - - bool CRaspberryPIPowerSyscall::VirtualSleep() -@@ -35,4 +39,34 @@ bool CRaspberryPIPowerSyscall::VirtualWake() - return true; - } - -+bool CRaspberryPIPowerSyscall::Powerdown() -+{ -+ int s = false; -+#if defined(HAS_DBUS) -+ if (CLogindUPowerSyscall::HasLogind()) -+ { -+ IPowerSyscall *m_instance = new CLogindUPowerSyscall; -+ if (m_instance->CanPowerdown()) -+ s = m_instance->Powerdown(); -+ delete m_instance; -+ } -+#endif -+ return s; -+} -+ -+bool CRaspberryPIPowerSyscall::Reboot() -+{ -+ int s = false; -+#if defined(HAS_DBUS) -+ if (CLogindUPowerSyscall::HasLogind()) -+ { -+ IPowerSyscall *m_instance = new CLogindUPowerSyscall; -+ if (m_instance->CanReboot()) -+ s = m_instance->Reboot(); -+ delete m_instance; -+ } -+#endif -+ return s; -+} -+ - #endif -diff --git a/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h -index fd1d67c..062132e 100644 ---- a/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h -+++ b/xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h -@@ -31,11 +31,11 @@ class CRaspberryPIPowerSyscall : public CPowerSyscallVirtualSleep - CRaspberryPIPowerSyscall() : CPowerSyscallVirtualSleep() {} - virtual ~CRaspberryPIPowerSyscall() {} - -- virtual bool Powerdown() { return false; } -+ virtual bool Powerdown(); - virtual bool Hibernate() { return false; } -- virtual bool Reboot() { return false; } -+ virtual bool Reboot(); - -- virtual bool CanPowerdown() { return false; } -+ virtual bool CanPowerdown() { return true; } - virtual bool CanHibernate() { return false; } - virtual bool CanReboot() { return true; } - - -From 21ff1d4748a4297716e53e78b347cf0f1c60ff4c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 26 Apr 2014 17:27:52 +0100 -Subject: [PATCH 36/89] [cec] Don't suspend pi on tv switch off - it can't wake - up - ---- - system/peripherals.xml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/system/peripherals.xml b/system/peripherals.xml -index 094a3c1..0b89ee8 100644 ---- a/system/peripherals.xml -+++ b/system/peripherals.xml -@@ -16,7 +16,7 @@ - - - -- -+ - - - - -From 2697d6cb2ff2bbbb7be8fd40370e654c227a1b86 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 27 Jun 2014 00:01:05 +0100 -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 160eb96..1472d10 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -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; - -+ // in case xbcm was restarted when suspended -+ ResumeVideoOutput(); -+ - g_OMXImage.Initialize(); - m_omx_image_init = true; - return true; - -From 266a5a51a12a418f95c2c366e147e0c5e9c6eaee Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 11 Apr 2014 16:12:27 +0100 -Subject: [PATCH 38/89] [omxplayer] Add ability to log more timestamp info in - extra debug settings - ---- - addons/resource.language.en_gb/resources/strings.po | 5 +++++ - xbmc/commons/ilog.h | 1 + - xbmc/cores/omxplayer/OMXHelper.cpp | 12 +++++++----- - xbmc/cores/omxplayer/OMXPlayerAudio.cpp | 8 ++++---- - xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 9 +++++---- - xbmc/settings/AdvancedSettings.cpp | 3 +++ - 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 804e295..1b70492 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2915,6 +2915,11 @@ msgctxt "#680" - msgid "Verbose logging for VIDEO component" - msgstr "" - -+#: xbmc/settings/AdvancedSettings.cpp -+msgctxt "#697" -+msgid "Verbose logging for OMXPLAYER" -+msgstr "" -+ - #empty strings from id 681 to 699 - - msgctxt "#700" -diff --git a/xbmc/commons/ilog.h b/xbmc/commons/ilog.h -index de90359..e4ffb5e 100644 ---- a/xbmc/commons/ilog.h -+++ b/xbmc/commons/ilog.h -@@ -53,6 +53,7 @@ - #define LOGUPNP (1 << (LOGMASKBIT + 8)) - #define LOGCEC (1 << (LOGMASKBIT + 9)) - #define LOGVIDEO (1 << (LOGMASKBIT + 10)) -+#define LOGOMXPLAYER (1 << (LOGMASKBIT + 16)) - - #include "utils/params_check_macros.h" - -diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp -index be54f31..9739ed0 100644 ---- a/xbmc/cores/omxplayer/OMXHelper.cpp -+++ b/xbmc/cores/omxplayer/OMXHelper.cpp -@@ -23,6 +23,7 @@ - #ifdef HAS_OMXPLAYER - - #include "DVDPlayer.h" -+#include "settings/AdvancedSettings.h" - #include "settings/Settings.h" - #include "settings/MediaSettings.h" - #include "DVDInputStreams/DVDInputStream.h" -@@ -140,7 +141,8 @@ bool OMXDoProcessing(struct SOmxPlayerState &m_OmxPlayerState, int m_playSpeed, - m_OmxPlayerState.video_fifo = (int)(100.0*(m_dvdPlayerVideo->GetDecoderBufferSize()-m_dvdPlayerVideo->GetDecoderFreeSpace())/m_dvdPlayerVideo->GetDecoderBufferSize()); - m_OmxPlayerState.audio_fifo = (int)(100.0*audio_fifo/m_dvdPlayerAudio->GetCacheTotal()); - -- #ifdef _DEBUG -+ if (g_advancedSettings.CanLogComponent(LOGOMXPLAYER)) -+ { - static unsigned count; - if ((count++ & 7) == 0) - { -@@ -160,7 +162,7 @@ bool OMXDoProcessing(struct SOmxPlayerState &m_OmxPlayerState, int m_playSpeed, - vc_gencmd(response, sizeof response, "render_bar 7 audio_queue %d %d %d %d", - m_dvdPlayerAudio->GetLevel(), 0, 0, 100); - } -- #endif -+ } - if (audio_pts != DVD_NOPTS_VALUE) - { - audio_fifo_low = m_HasAudio && audio_fifo < threshold; -@@ -176,15 +178,15 @@ bool OMXDoProcessing(struct SOmxPlayerState &m_OmxPlayerState, int m_playSpeed, - if (!m_HasVideo && m_HasAudio) - video_fifo_high = true; - -- #ifdef _DEBUG -+ if (g_advancedSettings.CanLogComponent(LOGOMXPLAYER)) -+ { - CLog::Log(LOGDEBUG, "%s::%s M:%.6f-%.6f (A:%.6f V:%.6f) PEF:%d%d%d S:%.2f A:%.2f V:%.2f/T:%.2f (A:%d%d V:%d%d) A:%d%% V:%d%% (%.2f,%.2f)", "CDVDPlayer", __FUNCTION__, - m_OmxPlayerState.stamp*1e-6, m_OmxPlayerState.av_clock.OMXClockAdjustment()*1e-6, audio_pts*1e-6, video_pts*1e-6, - m_OmxPlayerState.av_clock.OMXIsPaused(), m_OmxPlayerState.bOmxSentEOFs, not_accepts_data, m_playSpeed * (1.0f/DVD_PLAYSPEED_NORMAL), - audio_pts == DVD_NOPTS_VALUE ? 0.0:audio_fifo, video_pts == DVD_NOPTS_VALUE ? 0.0:video_fifo, m_OmxPlayerState.threshold, - audio_fifo_low, audio_fifo_high, video_fifo_low, video_fifo_high, - m_dvdPlayerAudio->GetLevel(), m_dvdPlayerVideo->GetLevel(), m_dvdPlayerAudio->GetDelay(), (float)m_dvdPlayerAudio->GetCacheTotal()); -- #endif -- -+ } - if(!m_Pause && (m_OmxPlayerState.bOmxSentEOFs || not_accepts_data || (audio_fifo_high && video_fifo_high) || m_playSpeed != DVD_PLAYSPEED_NORMAL)) - { - if (m_OmxPlayerState.av_clock.OMXIsPaused()) -diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -index c2da2d2..2f1df45 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -@@ -366,10 +366,10 @@ void OMXPlayerAudio::Process() - DemuxPacket* pPacket = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacket(); - bool bPacketDrop = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacketDrop(); - -- #ifdef _DEBUG -- CLog::Log(LOGINFO, "Audio: dts:%.0f pts:%.0f size:%d (s:%d f:%d d:%d l:%d) s:%d %d/%d late:%d,%d", pPacket->dts, pPacket->pts, -- (int)pPacket->iSize, m_started, m_flush, bPacketDrop, m_stalled, m_speed, 0, 0, (int)m_omxAudio.GetAudioRenderingLatency(), (int)m_hints_current.samplerate); -- #endif -+ if (g_advancedSettings.CanLogComponent(LOGOMXPLAYER)) -+ CLog::Log(LOGINFO, "Audio: dts:%.0f pts:%.0f size:%d (s:%d f:%d d:%d l:%d) s:%d %d/%d late:%d,%d", pPacket->dts, pPacket->pts, -+ (int)pPacket->iSize, m_started, m_flush, bPacketDrop, m_stalled, m_speed, 0, 0, (int)m_omxAudio.GetAudioRenderingLatency(), (int)m_hints_current.samplerate); -+ - if(Decode(pPacket, m_speed > DVD_PLAYSPEED_NORMAL || m_speed < 0 || bPacketDrop)) - { - // 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 5ca7665..8becff1 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -42,6 +42,7 @@ - #include "DVDOverlayRenderer.h" - #include "settings/DisplaySettings.h" - #include "settings/Settings.h" -+#include "settings/AdvancedSettings.h" - #include "settings/MediaSettings.h" - #include "cores/VideoRenderers/RenderFormats.h" - #include "cores/VideoRenderers/RenderFlags.h" -@@ -461,10 +462,10 @@ void OMXPlayerVideo::Process() - DemuxPacket* pPacket = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacket(); - bool bPacketDrop = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacketDrop(); - -- #ifdef _DEBUG -- CLog::Log(LOGINFO, "Video: dts:%.0f pts:%.0f size:%d (s:%d f:%d d:%d l:%d) s:%d %d/%d late:%d\n", pPacket->dts, pPacket->pts, -- (int)pPacket->iSize, m_started, m_flush, bPacketDrop, m_stalled, m_speed, 0, 0, 0); -- #endif -+ if (g_advancedSettings.CanLogComponent(LOGOMXPLAYER)) -+ CLog::Log(LOGINFO, "Video: dts:%.0f pts:%.0f size:%d (s:%d f:%d d:%d l:%d) s:%d %d/%d late:%d\n", pPacket->dts, pPacket->pts, -+ (int)pPacket->iSize, m_started, m_flush, bPacketDrop, m_stalled, m_speed, 0, 0, 0); -+ - if (m_messageQueue.GetDataSize() == 0 - || m_speed < 0) - { -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 76b5ce8..139e12d 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1364,6 +1364,9 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se - #ifdef HAVE_LIBCEC - list.push_back(std::make_pair(g_localizeStrings.Get(679), LOGCEC)); - #endif -+#ifdef TARGET_RASPBERRY_PI -+ list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); -+#endif - } - - void CAdvancedSettings::setExtraLogLevel(const std::vector &components) - -From ba20c596cce9f4e3e6112921182a25c899847c7d Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 39/89] [omxplayer] Add ability to dump out audio/video data - for later debugging - ---- - .../resource.language.en_gb/resources/strings.po | 10 +++++ - xbmc/commons/ilog.h | 2 + - xbmc/cores/omxplayer/OMXAudio.cpp | 49 ++++++++++++++++++++++ - xbmc/cores/omxplayer/OMXVideo.cpp | 47 +++++++++++++++++++++ - xbmc/settings/AdvancedSettings.cpp | 4 ++ - 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 1b70492..19b94b5 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2920,6 +2920,16 @@ msgctxt "#697" - msgid "Verbose logging for OMXPLAYER" - msgstr "" - -+#: xbmc/settings/AdvancedSettings.cpp -+msgctxt "#698" -+msgid "Dump video frames to debug file" -+msgstr "" -+ -+#: xbmc/settings/AdvancedSettings.cpp -+msgctxt "#699" -+msgid "Dump audio frames to debug file" -+msgstr "" -+ - #empty strings from id 681 to 699 - - msgctxt "#700" -diff --git a/xbmc/commons/ilog.h b/xbmc/commons/ilog.h -index e4ffb5e..4f8926c 100644 ---- a/xbmc/commons/ilog.h -+++ b/xbmc/commons/ilog.h -@@ -54,6 +54,8 @@ - #define LOGCEC (1 << (LOGMASKBIT + 9)) - #define LOGVIDEO (1 << (LOGMASKBIT + 10)) - #define LOGOMXPLAYER (1 << (LOGMASKBIT + 16)) -+#define LOGDUMPVIDEO (1 << (LOGMASKBIT + 17)) -+#define LOGDUMPAUDIO (1 << (LOGMASKBIT + 18)) - - #include "utils/params_check_macros.h" - -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 1911189..6dff6aa 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -56,6 +56,49 @@ using namespace std; - #define AUDIO_DECODE_OUTPUT_BUFFER (32*1024) - static const char rounded_up_channels_shift[] = {0,0,1,2,2,3,3,3,3}; - -+//#define DEBUG_PLAYBACK -+static void dump_omx_buffer(OMX_BUFFERHEADERTYPE *omx_buffer) -+{ -+ if (!(g_advancedSettings.CanLogComponent(LOGDUMPAUDIO))) -+ return; -+ static FILE *fp; -+ if (!omx_buffer) -+ { -+ if (fp) -+ { -+ fclose(fp); -+ fp = NULL; -+ } -+ return; -+ } -+ if (!fp) -+ { -+ char filename[1024]; -+ strcpy(filename, g_advancedSettings.m_logFolder.c_str()); -+ strcat(filename, "audio.dat"); -+#ifdef DEBUG_PLAYBACK -+ fp = fopen(filename, "rb"); -+#else -+ fp = fopen(filename, "wb"); -+#endif -+ } -+ if (fp) -+ { -+#ifdef DEBUG_PLAYBACK -+ OMX_BUFFERHEADERTYPE omx = {0}; -+ int s = fread(&omx, sizeof omx, 1, fp); -+ omx_buffer->nFilledLen = omx.nFilledLen; -+ omx_buffer->nFlags = omx.nFlags; -+ omx_buffer->nTimeStamp = omx.nTimeStamp; -+ if (s==1) -+ fread(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); -+#else -+ if (fwrite(omx_buffer, sizeof *omx_buffer, 1, fp) == 1) -+ fwrite(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); -+#endif -+ } -+} -+ - ////////////////////////////////////////////////////////////////////// - // Construction/Destruction - ////////////////////////////////////////////////////////////////////// -@@ -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; - -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -@@ -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; - -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -@@ -936,6 +981,8 @@ bool COMXAudio::Deinitialize() - { - CSingleLock lock (m_critSection); - -+ dump_omx_buffer(NULL); -+ - if ( m_omx_tunnel_clock_analog.IsInitialized() ) - m_omx_tunnel_clock_analog.Deestablish(); - if ( m_omx_tunnel_clock_hdmi.IsInitialized() ) -@@ -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) - { -@@ -1461,6 +1509,7 @@ void COMXAudio::SubmitEOS() - - omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; - -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index ca40a37..0fb426c 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -65,6 +65,49 @@ - - #define MAX_TEXT_LENGTH 1024 - -+//#define DEBUG_PLAYBACK -+static void dump_omx_buffer(OMX_BUFFERHEADERTYPE *omx_buffer) -+{ -+ if (!(g_advancedSettings.CanLogComponent(LOGDUMPVIDEO))) -+ return; -+ static FILE *fp; -+ if (!omx_buffer) -+ { -+ if (fp) -+ { -+ fclose(fp); -+ fp = NULL; -+ } -+ return; -+ } -+ if (!fp) -+ { -+ char filename[1024]; -+ strcpy(filename, g_advancedSettings.m_logFolder.c_str()); -+ strcat(filename, "video.dat"); -+#ifdef DEBUG_PLAYBACK -+ fp = fopen(filename, "rb"); -+#else -+ fp = fopen(filename, "wb"); -+#endif -+ } -+ if (fp) -+ { -+#ifdef DEBUG_PLAYBACK -+ OMX_BUFFERHEADERTYPE omx = {0}; -+ int s = fread(&omx, sizeof omx, 1, fp); -+ omx_buffer->nFilledLen = omx.nFilledLen; -+ omx_buffer->nFlags = omx.nFlags; -+ omx_buffer->nTimeStamp = omx.nTimeStamp; -+ if (s==1) -+ fread(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); -+#else -+ if (fwrite(omx_buffer, sizeof *omx_buffer, 1, fp) == 1) -+ fwrite(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); -+#endif -+ } -+} -+ - COMXVideo::COMXVideo() : m_video_codec_name("") - { - m_is_open = false; -@@ -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; - -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -@@ -692,6 +736,7 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de - void COMXVideo::Close() - { - CSingleLock lock (m_critSection); -+ dump_omx_buffer(NULL); - m_omx_tunnel_clock.Deestablish(); - m_omx_tunnel_decoder.Deestablish(); - if(m_deinterlace) -@@ -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) - { -@@ -928,6 +974,7 @@ void COMXVideo::SubmitEOS() - - omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; - -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 139e12d..ea45381 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1367,6 +1367,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se - #ifdef TARGET_RASPBERRY_PI - list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); - #endif -+#ifdef TARGET_RASPBERRY_PI -+ list.push_back(std::make_pair(g_localizeStrings.Get(698), LOGDUMPVIDEO)); -+ list.push_back(std::make_pair(g_localizeStrings.Get(699), LOGDUMPAUDIO)); -+#endif - } - - void CAdvancedSettings::setExtraLogLevel(const std::vector &components) - -From 4f9a70ab2488ac8b8dd154613e368a0060493d88 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Nov 2014 17:16:54 +0000 -Subject: [PATCH 40/89] Revert "[omxplayer] Add ability to dump out audio/video - data for later debugging" - -This reverts commit 417416bd29d00f1b42c77488d06e9e6840b8c4f4. ---- - .../resource.language.en_gb/resources/strings.po | 10 ----- - xbmc/commons/ilog.h | 2 - - xbmc/cores/omxplayer/OMXAudio.cpp | 49 ---------------------- - xbmc/cores/omxplayer/OMXVideo.cpp | 47 --------------------- - xbmc/settings/AdvancedSettings.cpp | 4 -- - 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 19b94b5..1b70492 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2920,16 +2920,6 @@ msgctxt "#697" - msgid "Verbose logging for OMXPLAYER" - msgstr "" - --#: xbmc/settings/AdvancedSettings.cpp --msgctxt "#698" --msgid "Dump video frames to debug file" --msgstr "" -- --#: xbmc/settings/AdvancedSettings.cpp --msgctxt "#699" --msgid "Dump audio frames to debug file" --msgstr "" -- - #empty strings from id 681 to 699 - - msgctxt "#700" -diff --git a/xbmc/commons/ilog.h b/xbmc/commons/ilog.h -index 4f8926c..e4ffb5e 100644 ---- a/xbmc/commons/ilog.h -+++ b/xbmc/commons/ilog.h -@@ -54,8 +54,6 @@ - #define LOGCEC (1 << (LOGMASKBIT + 9)) - #define LOGVIDEO (1 << (LOGMASKBIT + 10)) - #define LOGOMXPLAYER (1 << (LOGMASKBIT + 16)) --#define LOGDUMPVIDEO (1 << (LOGMASKBIT + 17)) --#define LOGDUMPAUDIO (1 << (LOGMASKBIT + 18)) - - #include "utils/params_check_macros.h" - -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 6dff6aa..1911189 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -56,49 +56,6 @@ using namespace std; - #define AUDIO_DECODE_OUTPUT_BUFFER (32*1024) - static const char rounded_up_channels_shift[] = {0,0,1,2,2,3,3,3,3}; - --//#define DEBUG_PLAYBACK --static void dump_omx_buffer(OMX_BUFFERHEADERTYPE *omx_buffer) --{ -- if (!(g_advancedSettings.CanLogComponent(LOGDUMPAUDIO))) -- return; -- static FILE *fp; -- if (!omx_buffer) -- { -- if (fp) -- { -- fclose(fp); -- fp = NULL; -- } -- return; -- } -- if (!fp) -- { -- char filename[1024]; -- strcpy(filename, g_advancedSettings.m_logFolder.c_str()); -- strcat(filename, "audio.dat"); --#ifdef DEBUG_PLAYBACK -- fp = fopen(filename, "rb"); --#else -- fp = fopen(filename, "wb"); --#endif -- } -- if (fp) -- { --#ifdef DEBUG_PLAYBACK -- OMX_BUFFERHEADERTYPE omx = {0}; -- int s = fread(&omx, sizeof omx, 1, fp); -- omx_buffer->nFilledLen = omx.nFilledLen; -- omx_buffer->nFlags = omx.nFlags; -- omx_buffer->nTimeStamp = omx.nTimeStamp; -- if (s==1) -- fread(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); --#else -- if (fwrite(omx_buffer, sizeof *omx_buffer, 1, fp) == 1) -- fwrite(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); --#endif -- } --} -- - ////////////////////////////////////////////////////////////////////// - // Construction/Destruction - ////////////////////////////////////////////////////////////////////// -@@ -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; - -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -@@ -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; - -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -@@ -981,8 +936,6 @@ bool COMXAudio::Deinitialize() - { - CSingleLock lock (m_critSection); - -- dump_omx_buffer(NULL); -- - if ( m_omx_tunnel_clock_analog.IsInitialized() ) - m_omx_tunnel_clock_analog.Deestablish(); - if ( m_omx_tunnel_clock_hdmi.IsInitialized() ) -@@ -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) - { -@@ -1509,7 +1461,6 @@ void COMXAudio::SubmitEOS() - - omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; - -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 0fb426c..ca40a37 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -65,49 +65,6 @@ - - #define MAX_TEXT_LENGTH 1024 - --//#define DEBUG_PLAYBACK --static void dump_omx_buffer(OMX_BUFFERHEADERTYPE *omx_buffer) --{ -- if (!(g_advancedSettings.CanLogComponent(LOGDUMPVIDEO))) -- return; -- static FILE *fp; -- if (!omx_buffer) -- { -- if (fp) -- { -- fclose(fp); -- fp = NULL; -- } -- return; -- } -- if (!fp) -- { -- char filename[1024]; -- strcpy(filename, g_advancedSettings.m_logFolder.c_str()); -- strcat(filename, "video.dat"); --#ifdef DEBUG_PLAYBACK -- fp = fopen(filename, "rb"); --#else -- fp = fopen(filename, "wb"); --#endif -- } -- if (fp) -- { --#ifdef DEBUG_PLAYBACK -- OMX_BUFFERHEADERTYPE omx = {0}; -- int s = fread(&omx, sizeof omx, 1, fp); -- omx_buffer->nFilledLen = omx.nFilledLen; -- omx_buffer->nFlags = omx.nFlags; -- omx_buffer->nTimeStamp = omx.nTimeStamp; -- if (s==1) -- fread(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); --#else -- if (fwrite(omx_buffer, sizeof *omx_buffer, 1, fp) == 1) -- fwrite(omx_buffer->pBuffer, omx_buffer->nFilledLen, 1, fp); --#endif -- } --} -- - COMXVideo::COMXVideo() : m_video_codec_name("") - { - m_is_open = false; -@@ -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; - -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -@@ -736,7 +692,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de - void COMXVideo::Close() - { - CSingleLock lock (m_critSection); -- dump_omx_buffer(NULL); - m_omx_tunnel_clock.Deestablish(); - m_omx_tunnel_decoder.Deestablish(); - if(m_deinterlace) -@@ -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) - { -@@ -974,7 +928,6 @@ void COMXVideo::SubmitEOS() - - omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; - -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err != OMX_ErrorNone) - { -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index ea45381..139e12d 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1367,10 +1367,6 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se - #ifdef TARGET_RASPBERRY_PI - list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); - #endif --#ifdef TARGET_RASPBERRY_PI -- list.push_back(std::make_pair(g_localizeStrings.Get(698), LOGDUMPVIDEO)); -- list.push_back(std::make_pair(g_localizeStrings.Get(699), LOGDUMPAUDIO)); --#endif - } - - void CAdvancedSettings::setExtraLogLevel(const std::vector &components) - -From 1dd87e754c11ac47b4e96eb465b5503206a04aef Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 41/89] [omxplayer] Add ability to dump out audio/video data - for later debugging - ---- - .../resource.language.en_gb/resources/strings.po | 10 ++++ - xbmc/commons/ilog.h | 2 + - xbmc/cores/dvdplayer/DVDPlayer.cpp | 63 ++++++++++++++++++++++ - xbmc/settings/AdvancedSettings.cpp | 4 ++ - 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 1b70492..19b94b5 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -2920,6 +2920,16 @@ msgctxt "#697" - msgid "Verbose logging for OMXPLAYER" - msgstr "" - -+#: xbmc/settings/AdvancedSettings.cpp -+msgctxt "#698" -+msgid "Dump video frames to debug file" -+msgstr "" -+ -+#: xbmc/settings/AdvancedSettings.cpp -+msgctxt "#699" -+msgid "Dump audio frames to debug file" -+msgstr "" -+ - #empty strings from id 681 to 699 - - msgctxt "#700" -diff --git a/xbmc/commons/ilog.h b/xbmc/commons/ilog.h -index e4ffb5e..4f8926c 100644 ---- a/xbmc/commons/ilog.h -+++ b/xbmc/commons/ilog.h -@@ -54,6 +54,8 @@ - #define LOGCEC (1 << (LOGMASKBIT + 9)) - #define LOGVIDEO (1 << (LOGMASKBIT + 10)) - #define LOGOMXPLAYER (1 << (LOGMASKBIT + 16)) -+#define LOGDUMPVIDEO (1 << (LOGMASKBIT + 17)) -+#define LOGDUMPAUDIO (1 << (LOGMASKBIT + 18)) - - #include "utils/params_check_macros.h" - -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 3c313cd..8ceb498 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -96,6 +96,61 @@ - using namespace std; - using namespace PVR; - -+//#define DEBUG_PLAYBACK -+static void dump_packet(DemuxPacket *packet, bool video, bool audio) -+{ -+ static CCriticalSection m_section; -+ static FILE *fp_video, *fp_audio; -+ if ((!video || !g_advancedSettings.CanLogComponent(LOGDUMPVIDEO)) && -+ (!audio || !g_advancedSettings.CanLogComponent(LOGDUMPAUDIO))) -+ return; -+ const char *fname = video ? "video.dat" : "audio.dat"; -+ FILE *&fp = video ? fp_video : fp_audio; -+ CSingleLock lock(m_section); -+ if (!packet) -+ { -+ if (fp) -+ { -+ CLog::Log(LOGNOTICE, "%s:: Closing file %p", __func__, fp); -+ fclose(fp); -+ fp = NULL; -+ } -+ return; -+ } -+ if (!fp) -+ { -+ char filename[1024]; -+ strcpy(filename, g_advancedSettings.m_logFolder.c_str()); -+ strcat(filename, fname); -+#ifdef DEBUG_PLAYBACK -+ fp = fopen(filename, "rb"); -+#else -+ fp = fopen(filename, "wb"); -+#endif -+ CLog::Log(LOGNOTICE, "%s:: Opening file %s = %p", __func__, filename, fp); -+ } -+ if (fp) -+ { -+#ifdef DEBUG_PLAYBACK -+ DemuxPacket p = {0}; -+ int s = fread(&p, sizeof p, 1, fp); -+ if (s==1) -+ { -+ packet->iSize = p.iSize; -+ packet->dts = p.dts; -+ packet->pts = p.pts; -+ _aligned_free(packet->pData); -+ packet->pData = (uint8_t*)_aligned_malloc(packet->iSize + FF_INPUT_BUFFER_PADDING_SIZE, 16); -+ fread(packet->pData, packet->iSize, 1, fp); -+ } -+#else -+ if (fwrite(packet, sizeof *packet, 1, fp) == 1) -+ fwrite(packet->pData, packet->iSize, 1, fp); -+#endif -+ } -+} -+ -+ - void CSelectionStreams::Clear(StreamType type, StreamSource source) - { - CSingleLock lock(m_section); -@@ -974,6 +1029,12 @@ bool CDVDPlayer::ReadPacket(DemuxPacket*& packet, CDemuxStream*& stream) - return true; - } - -+ if(m_pDemuxer) -+ { -+ stream = m_pDemuxer->GetStream(packet->iStreamId); -+ if (stream) -+ dump_packet(packet, CheckIsCurrent(m_CurrentVideo, stream, packet), CheckIsCurrent(m_CurrentAudio, stream, packet)); -+ } - UpdateCorrection(packet, m_offset_pts); - - if(packet->iStreamId < 0) -@@ -3475,6 +3536,8 @@ bool CDVDPlayer::CloseStream(CCurrentStream& current, bool bWaitForBuffers) - if(bWaitForBuffers) - SetCaching(CACHESTATE_DONE); - -+ dump_packet(NULL, current.player == DVDPLAYER_VIDEO, current.player == DVDPLAYER_AUDIO); -+ - IDVDStreamPlayer* player = GetStreamPlayer(current.player); - if(player) - player->CloseStream(bWaitForBuffers); -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 139e12d..ea45381 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1367,6 +1367,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se - #ifdef TARGET_RASPBERRY_PI - list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); - #endif -+#ifdef TARGET_RASPBERRY_PI -+ list.push_back(std::make_pair(g_localizeStrings.Get(698), LOGDUMPVIDEO)); -+ list.push_back(std::make_pair(g_localizeStrings.Get(699), LOGDUMPAUDIO)); -+#endif - } - - void CAdvancedSettings::setExtraLogLevel(const std::vector &components) - -From c5426decde782f01e418f10fa2b4221b1b8e6157 Mon Sep 17 00:00:00 2001 +From 288777dd146b627d5240bfec658d1b90424a78d0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 29 Nov 2014 15:25:16 +0000 -Subject: [PATCH 42/89] [rbp] hack: wait for splash to complete before changing +Subject: [PATCH 24/56] [rbp] hack: wait for splash to complete before changing hdmi mode --- @@ -2987,10 +1159,10 @@ Subject: [PATCH 42/89] [rbp] hack: wait for splash to complete before changing 1 file changed, 49 insertions(+) diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 7d9b0d3..d388373 100644 +index 68fc647..c80114e 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -217,12 +217,61 @@ int CEGLNativeTypeRaspberryPI::AddUniqueResolution(RESOLUTION_INFO &res, std::ve +@@ -214,12 +214,61 @@ int CEGLNativeTypeRaspberryPI::AddUniqueResolution(RESOLUTION_INFO &res, std::ve } #endif @@ -3051,143 +1223,12 @@ index 7d9b0d3..d388373 100644 + DestroyDispmaxWindow(); - if(GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) + if(!m_fixedMode && GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) -From 9ed5eff1125f8484ce829b87342fb99856ef8bea Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 5 Oct 2014 14:05:25 +0100 -Subject: [PATCH 43/89] [PiSink] Allow audio output latency to be set in - settings - ---- - addons/resource.language.en_gb/resources/strings.po | 15 +++++++++++++++ - system/settings/rbp.xml | 12 ++++++++++++ - xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 13 ++++++++----- - xbmc/cores/AudioEngine/Sinks/AESinkPi.h | 1 + - 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 19b94b5..37932be 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16639,3 +16639,18 @@ msgstr "" - msgctxt "#38052" - msgid "Remote button press release time (ms)" - msgstr "" -+ -+#: system/settings/rbp.xml -+msgctxt "#38100" -+msgid "Audio output latency" -+msgstr "" -+ -+#: system/settings/rbp.xml -+msgctxt "#38101" -+msgid "Increase this to protect against underruns, reduce to have lower latency gui sounds" -+msgstr "" -+ -+#: system/settings/rbp.xml -+msgctxt "#38102" -+msgid "%i ms" -+msgstr "" -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 8496abf..5068b20 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -89,6 +89,18 @@ - - 101 - -+ -+ 3 -+ 100 -+ -+ 50 -+ 50 -+ 300 -+ -+ -+ 38102 -+ -+ - - - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -index d72a97a..b69925a 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -@@ -35,7 +35,6 @@ - #define CLASSNAME "CAESinkPi" - - #define NUM_OMX_BUFFERS 2 --#define AUDIO_PLAYBUFFER (0.1) // 100ms - - static const unsigned int PassthroughSampleRates[] = { 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, 176400, 192000 }; - -@@ -43,6 +42,7 @@ CAEDeviceInfo CAESinkPi::m_info; - - CAESinkPi::CAESinkPi() : - m_sinkbuffer_sec_per_byte(0), -+ m_latency(0), - m_Initialized(false), - m_submitted(0), - 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); -+ - 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)); -- format.m_frames = format.m_sampleRate * AUDIO_PLAYBUFFER / NUM_OMX_BUFFERS; -+ format.m_frames = format.m_sampleRate * m_latency / NUM_OMX_BUFFERS; - format.m_frameSamples = format.m_frames * channels; - - SetAudioProps(m_passthrough, GetChannelMap(format.m_channelLayout, m_passthrough)); -@@ -427,7 +430,7 @@ void CAESinkPi::GetDelay(AEDelayStatus& status) - - double CAESinkPi::GetCacheTotal() - { -- return AUDIO_PLAYBUFFER; -+ return m_latency; - } - - unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned int offset) -@@ -478,8 +481,8 @@ unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned - m_submitted++; - GetDelay(status); - delay = status.GetDelay(); -- if (delay > AUDIO_PLAYBUFFER) -- Sleep((int)(1000.0f * (delay - AUDIO_PLAYBUFFER))); -+ if (delay > m_latency) -+ Sleep((int)(1000.0f * (delay - m_latency))); - return frames; - } - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.h b/xbmc/cores/AudioEngine/Sinks/AESinkPi.h -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 - AEAudioFormat m_initFormat; - AEAudioFormat m_format; - double m_sinkbuffer_sec_per_byte; -+ double m_latency; - static CAEDeviceInfo m_info; - bool m_Initialized; - uint32_t m_submitted; - -From 3a60bf2bb5ce7d064c719ec96d385cf8167a7b04 Mon Sep 17 00:00:00 2001 +From b5262ef9b401ffa4b6d2276e67b742a37c1df79d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 11 Dec 2014 17:00:57 +0000 -Subject: [PATCH 44/89] Fix for UI not showing both extractflags and +Subject: [PATCH 25/56] Fix for UI not showing both extractflags and extractthumb --- @@ -3197,10 +1238,10 @@ Subject: [PATCH 44/89] 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 37932be..647befc 100644 +index 601cd44..fa25d45 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -10979,7 +10979,7 @@ msgstr "" +@@ -10962,7 +10962,7 @@ msgstr "" #: system/settings/settings.xml msgctxt "#20433" @@ -3209,7 +1250,7 @@ index 37932be..647befc 100644 msgstr "" #: xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp -@@ -14509,7 +14509,7 @@ msgstr "" +@@ -14492,7 +14492,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36178" @@ -3218,7 +1259,7 @@ index 37932be..647befc 100644 msgstr "" #. Description of setting "Videos -> File lists -> Replace file names with library titles" with label #20419 -@@ -14521,7 +14521,7 @@ msgstr "" +@@ -14504,7 +14504,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36180" @@ -3227,9 +1268,9 @@ index 37932be..647befc 100644 msgstr "" #: system/settings/settings.xml -@@ -16654,3 +16654,8 @@ msgstr "" - msgctxt "#38102" - msgid "%i ms" +@@ -16622,3 +16622,8 @@ msgstr "" + msgctxt "#38052" + msgid "Remote button press release time (ms)" msgstr "" + +#: system/settings/settings.xml @@ -3237,7 +1278,7 @@ index 37932be..647befc 100644 +msgid "Extract thumbnails from video files" +msgstr "" diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 5068b20..6e9ceaf 100644 +index 8496abf..ad65ce4 100644 --- a/system/settings/rbp.xml +++ b/system/settings/rbp.xml @@ -36,10 +36,6 @@ @@ -3252,7 +1293,7 @@ index 5068b20..6e9ceaf 100644 false diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index ede89e4..f3022c3 100644 +index e833d3b..0e09d3d 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -902,23 +902,23 @@ @@ -3285,10 +1326,10 @@ index ede89e4..f3022c3 100644 -From 85c30bde9f23146c332ffeaeecf2c0de5b784900 Mon Sep 17 00:00:00 2001 +From 913713b6debe33499641ea054f789423a00d1ed9 Mon Sep 17 00:00:00 2001 From: anaconda Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 45/89] Disable autoscrolling while on screensaver and while +Subject: [PATCH 26/56] Disable autoscrolling while on screensaver and while opening streams. --- @@ -3301,10 +1342,10 @@ Subject: [PATCH 45/89] 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 df6e8ca..5889613 100644 +index 0bdaae4..1141d7b 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -4959,3 +4959,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const +@@ -4958,3 +4958,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const return false; } @@ -3419,10 +1460,10 @@ index 0d5b3f7..6d23024 100644 if (m_lastRenderTime) m_autoScrollDelayTime += currentTime - m_lastRenderTime; -From 67692cfba74ca0e49e21c805c503605501fb5de2 Mon Sep 17 00:00:00 2001 +From 9de2f40d2046fdead3be13806c7d20ff39a94dfc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 13 Dec 2014 18:35:20 +0000 -Subject: [PATCH 46/89] [demuxer] Avoid memcpy on every demuxer packet +Subject: [PATCH 27/56] [demuxer] Avoid memcpy on every demuxer packet Avoids an unnecessary memcpy on every demuxer packet which for high bitrate videos can be significant. @@ -3433,10 +1474,10 @@ high bitrate videos can be significant. 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 643c219..2f70412 100644 +index 74ff31f..f9b3232 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -742,7 +742,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() +@@ -738,7 +738,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() { if(m_pkt.pkt.stream_index == (int)m_pFormatContext->programs[m_program]->stream_index[i]) { @@ -3445,7 +1486,7 @@ index 643c219..2f70412 100644 break; } } -@@ -751,7 +751,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() +@@ -747,7 +747,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() bReturnEmpty = true; } else @@ -3454,7 +1495,7 @@ index 643c219..2f70412 100644 } else bReturnEmpty = true; -@@ -793,9 +793,13 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() +@@ -789,9 +789,13 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() // copy contents into our own packet pPacket->iSize = m_pkt.pkt.size; @@ -3470,7 +1511,7 @@ index 643c219..2f70412 100644 pPacket->pts = ConvertTimestamp(m_pkt.pkt.pts, stream->time_base.den, stream->time_base.num); pPacket->dts = ConvertTimestamp(m_pkt.pkt.dts, stream->time_base.den, stream->time_base.num); -@@ -830,7 +834,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() +@@ -826,7 +830,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() pPacket->iStreamId = m_pkt.pkt.stream_index; } m_pkt.result = -1; @@ -3517,1256 +1558,666 @@ index ab298b2..10c5ee0 100644 } catch(...) { -From 32561c3475489b45a10a23b1f00896759a4a8e35 Mon Sep 17 00:00:00 2001 -From: Memphiz -Date: Tue, 18 Nov 2014 13:27:59 +0100 -Subject: [PATCH 47/89] - added setting for allowing to hide watched - movies/episodes/musicvideos in the recently added lists of the home screen - ---- - addons/resource.language.en_gb/resources/strings.po | 16 ++++++++++++++-- - system/settings/settings.xml | 5 +++++ - 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 647befc..bf466b0 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -11148,7 +11148,13 @@ msgctxt "#20469" - msgid "Keep current set (%s)" - msgstr "" - --#empty strings from id 20470 to 21329 -+#. Label of setting "Videos -> Library -> Hide watched videos in recently added list (home screen)" -+#: system/settings/settings.xml -+msgctxt "#20470" -+msgid "Hide watched videos in recently added list (home screen)" -+msgstr "" -+ -+#empty strings from id 20471 to 21329 - #up to 21329 is reserved for the video db !! ! - - #: system/settings/settings.xml -@@ -15966,7 +15972,13 @@ msgctxt "#36435" - msgid "Use DVDPlayer for decoding of video files with MMAL acceleration." - msgstr "" - --#empty strings from id 36436 to 36499 -+#. Description of setting "Videos -> Library -> Hide watched videos in recently added list." -+#: system/settings/settings.xml -+msgctxt "#36436" -+msgid "If enabled all watched items in the recently added list on the home screen will be hidden. This includes movies, episodes and musicvideos. The effect depends on the used skin and its settings." -+msgstr "" -+ -+#empty strings from id 36437 to 36499 - #end reservation - - #. 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 f3022c3..823f181 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -468,6 +468,11 @@ - false - - -+ -+ 1 -+ true -+ -+ - - - - -From 299f258f82d0bf10105053affec0d811bfa20002 Mon Sep 17 00:00:00 2001 -From: Memphiz -Date: Tue, 18 Nov 2014 13:28:36 +0100 -Subject: [PATCH 48/89] - evaluate the setting for hiding watched - movies/episodes/musicvideos in recently added job (should influence - homescreen of skins only) - ---- - xbmc/utils/RecentlyAddedJob.cpp | 10 +++++----- - xbmc/video/VideoDatabase.cpp | 27 ++++++++++++++++++++++++--- - xbmc/video/VideoDatabase.h | 6 +++--- - 3 files changed, 32 insertions(+), 11 deletions(-) - -diff --git a/xbmc/utils/RecentlyAddedJob.cpp b/xbmc/utils/RecentlyAddedJob.cpp -index 1f8ec36..de45783 100644 ---- a/xbmc/utils/RecentlyAddedJob.cpp -+++ b/xbmc/utils/RecentlyAddedJob.cpp -@@ -31,6 +31,7 @@ - #include "utils/Variant.h" - #include "utils/StringUtils.h" - #include "settings/AdvancedSettings.h" -+#include "settings/Settings.h" - #include "music/MusicThumbLoader.h" - #include "video/VideoThumbLoader.h" - -@@ -57,8 +58,8 @@ bool CRecentlyAddedJob::UpdateVideo() - loader.OnLoaderStart(); - - videodatabase.Open(); -- -- if (videodatabase.GetRecentlyAddedMoviesNav("videodb://recentlyaddedmovies/", items, NUM_ITEMS)) -+ bool hideWatched = CSettings::Get().GetBool("videolibrary.hiderecentlywatchedvideos"); -+ if (videodatabase.GetRecentlyAddedMoviesNav("videodb://recentlyaddedmovies/", items, NUM_ITEMS, hideWatched)) - { - for (; i < items.Size(); ++i) - { -@@ -97,8 +98,7 @@ bool CRecentlyAddedJob::UpdateVideo() - - i = 0; - CFileItemList TVShowItems; -- -- if (videodatabase.GetRecentlyAddedEpisodesNav("videodb://recentlyaddedepisodes/", TVShowItems, NUM_ITEMS)) -+ if (videodatabase.GetRecentlyAddedEpisodesNav("videodb://recentlyaddedepisodes/", TVShowItems, NUM_ITEMS, hideWatched)) - { - for (; i < TVShowItems.Size(); ++i) - { -@@ -151,7 +151,7 @@ bool CRecentlyAddedJob::UpdateVideo() - i = 0; - CFileItemList MusicVideoItems; - -- if (videodatabase.GetRecentlyAddedMusicVideosNav("videodb://recentlyaddedmusicvideos/", MusicVideoItems, NUM_ITEMS)) -+ if (videodatabase.GetRecentlyAddedMusicVideosNav("videodb://recentlyaddedmusicvideos/", MusicVideoItems, NUM_ITEMS, hideWatched)) - { - for (; i < MusicVideoItems.Size(); ++i) - { -diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp -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 - return GetMusicVideosByWhere(videoUrl.ToString(), filter, items, true, sortDescription); - } - --bool CVideoDatabase::GetRecentlyAddedMoviesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit) -+bool CVideoDatabase::GetRecentlyAddedMoviesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit, bool hideWatched) - { - Filter filter; - filter.order = "dateAdded desc, idMovie desc"; - filter.limit = PrepareSQL("%u", limit ? limit : g_advancedSettings.m_iVideoLibraryRecentlyAddedItems); -+ -+ if (hideWatched) -+ { -+ filter.AppendWhere("playCount <= 0");// only query unwatched items -+ filter.AppendWhere("playCount IS NULL", false); -+ } -+ - return GetMoviesByWhere(strBaseDir, filter, items); - } - --bool CVideoDatabase::GetRecentlyAddedEpisodesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit) -+bool CVideoDatabase::GetRecentlyAddedEpisodesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit, bool hideWatched) - { - Filter filter; - filter.order = "dateAdded desc, idEpisode desc"; - filter.limit = PrepareSQL("%u", limit ? limit : g_advancedSettings.m_iVideoLibraryRecentlyAddedItems); -+ -+ if (hideWatched) -+ { -+ filter.AppendWhere("playCount <= 0");// only query unwatched items -+ filter.AppendWhere("playCount IS NULL", false); -+ } -+ - return GetEpisodesByWhere(strBaseDir, filter, items, false); - } - --bool CVideoDatabase::GetRecentlyAddedMusicVideosNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit) -+bool CVideoDatabase::GetRecentlyAddedMusicVideosNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit, bool hideWatched) - { - Filter filter; - filter.order = "dateAdded desc, idMVideo desc"; - filter.limit = PrepareSQL("%u", limit ? limit : g_advancedSettings.m_iVideoLibraryRecentlyAddedItems); -+ -+ if (hideWatched) -+ { -+ filter.AppendWhere("playCount <= 0");// only query unwatched items -+ filter.AppendWhere("playCount IS NULL", false); -+ } -+ - return GetMusicVideosByWhere(strBaseDir, filter, items); - } - -diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h -index ca62f23..b905e48 100644 ---- a/xbmc/video/VideoDatabase.h -+++ b/xbmc/video/VideoDatabase.h -@@ -683,9 +683,9 @@ class CVideoDatabase : public CDatabase - bool GetEpisodesNav(const std::string& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idActor=-1, int idDirector=-1, int idShow=-1, int idSeason=-1, const SortDescription &sortDescription = SortDescription()); - bool GetMusicVideosNav(const std::string& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idArtist=-1, int idDirector=-1, int idStudio=-1, int idAlbum=-1, int idTag=-1, const SortDescription &sortDescription = SortDescription()); - -- bool GetRecentlyAddedMoviesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0); -- bool GetRecentlyAddedEpisodesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0); -- bool GetRecentlyAddedMusicVideosNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0); -+ bool GetRecentlyAddedMoviesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0, bool hideWatched=false); -+ bool GetRecentlyAddedEpisodesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0, bool hideWatched=false); -+ bool GetRecentlyAddedMusicVideosNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0, bool hideWatched=false); - - bool HasContent(); - bool HasContent(VIDEODB_CONTENT_TYPE type); - -From 2373aa7571337304e255fe7039fbd49fcfa3a4f9 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Wed, 4 Feb 2015 22:32:03 +0100 -Subject: [PATCH 49/89] NFSFile: Chank ChunkSize to 1MB - ---- - xbmc/filesystem/NFSFile.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/filesystem/NFSFile.h b/xbmc/filesystem/NFSFile.h -index 4c01e4e..7afa6b8 100644 ---- a/xbmc/filesystem/NFSFile.h -+++ b/xbmc/filesystem/NFSFile.h -@@ -148,7 +148,7 @@ namespace XFILE - //implement iocontrol for seek_possible for preventing the stat in File class for - //getting this info ... - virtual int IoControl(EIoControl request, void* param){ if(request == IOCTRL_SEEK_POSSIBLE) return 1;return -1;}; -- virtual int GetChunkSize() {return 1;} -+ virtual int GetChunkSize() {return 1024*1024;} - - virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false); - virtual bool Delete(const CURL& url); - -From 2862d65f247cbff597c3a4f2a54342ae9e653e11 Mon Sep 17 00:00:00 2001 +From 275639e41023b0fb4fe2025379dc5b10764d21ea Mon Sep 17 00:00:00 2001 From: popcornmix -Date: Tue, 10 Feb 2015 00:19:51 +0000 -Subject: [PATCH 52/89] [libnfs] Add streaming cache +Date: Tue, 10 Feb 2015 15:29:16 +0000 +Subject: [PATCH 28/56] [libcec] Add repeating keypress patch from popcornmix' + repo --- - .../libnfs/0001-Sequential-Readahead-Mode.patch | 949 +++++++++++++++++++++ - tools/depends/target/libnfs/Makefile | 1 + - xbmc/filesystem/DllLibNfs.h | 3 + - xbmc/filesystem/NFSFile.cpp | 2 + - 4 files changed, 955 insertions(+) - create mode 100644 tools/depends/target/libnfs/0001-Sequential-Readahead-Mode.patch + tools/depends/target/libcec/Makefile | 1 + + tools/depends/target/libcec/popcornmix.patch | 615 +++++++++++++++++++++++++++ + 2 files changed, 616 insertions(+) + create mode 100644 tools/depends/target/libcec/popcornmix.patch -diff --git a/tools/depends/target/libnfs/0001-Sequential-Readahead-Mode.patch b/tools/depends/target/libnfs/0001-Sequential-Readahead-Mode.patch -new file mode 100644 -index 0000000..83b7e11 ---- /dev/null -+++ b/tools/depends/target/libnfs/0001-Sequential-Readahead-Mode.patch -@@ -0,0 +1,949 @@ -+From ae7ef01ad15ea91f669a59d4fd44aa9c03a3a6fb Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Sat, 7 Feb 2015 11:16:38 -0800 -+Subject: [PATCH 1/7] Sequential Readahead Mode -+ -+Add a new api to activate sequential reading of files. -+It is activated by calling nfs_set_streaming_mode(fs,size) -+with a filehandle and a size. -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ include/nfsc/libnfs-raw.h | 9 ++ -+ include/nfsc/libnfs.h | 14 +++ -+ lib/libnfs-sync.c | 12 ++- -+ lib/libnfs-win32.def | 5 + -+ lib/libnfs.c | 258 +++++++++++++++++++++++++++++++++++++++++++++- -+ lib/socket.c | 15 ++- -+ 6 files changed, 308 insertions(+), 5 deletions(-) -+ -+diff --git a/include/nfsc/libnfs-raw.h b/include/nfsc/libnfs-raw.h -+index 3ba9de3..4593cc6 100644 -+--- a/include/nfsc/libnfs-raw.h -++++ b/include/nfsc/libnfs-raw.h -+@@ -44,6 +44,15 @@ int rpc_get_fd(struct rpc_context *rpc); -+ int rpc_which_events(struct rpc_context *rpc); -+ int rpc_service(struct rpc_context *rpc, int revents); -+ char *rpc_get_error(struct rpc_context *rpc); -++ -++/* Return the number of PDUs in the outqueue. -++ * This is the count of PDUs not yet written to the socket. -++ */ -++int rpc_outqueue_length(struct rpc_context *rpc); -++/* Return the number all in flight PDUs. -++ * This includes both the PDUs not yet written to the socket as well as -++ * all PDUs we have sent to the server but not yet received a reply to. -++ */ -+ int rpc_queue_length(struct rpc_context *rpc); -+ -+ /* Utility function to get an RPC context from a NFS context. Useful for doing low level NFSACL -+diff --git a/include/nfsc/libnfs.h b/include/nfsc/libnfs.h -+index 2d14113..f84650b 100644 -+--- a/include/nfsc/libnfs.h -++++ b/include/nfsc/libnfs.h -+@@ -83,6 +83,15 @@ struct utimbuf { -+ EXTERN int nfs_get_fd(struct nfs_context *nfs); -+ EXTERN int nfs_which_events(struct nfs_context *nfs); -+ EXTERN int nfs_service(struct nfs_context *nfs, int revents); -++ -++/* Return the number of PDUs in the outqueue. -++ * This is the count of PDUs not yet written to the socket. -++ */ -++EXTERN int nfs_outqueue_length(struct nfs_context *nfs); -++/* Return the number all in flight PDUs. -++ * This includes both the PDUs not yet written to the socket as well as -++ * all PDUs we have sent to the server but not yet received a reply to. -++ */ -+ EXTERN int nfs_queue_length(struct nfs_context *nfs); -+ -+ /* -+@@ -191,6 +200,11 @@ EXTERN void nfs_set_uid(struct nfs_context *nfs, int uid); -+ EXTERN void nfs_set_gid(struct nfs_context *nfs, int gid); -+ EXTERN void nfs_set_readahead(struct nfs_context *nfs, uint32_t v); -+ -++/* Optimize for sequentianl streaming reads. size is the amount -++ * of buffering. -++ */ -++EXTERN int nfs_set_streaming_mode(struct nfsfh *nfsfh, uint32_t size); -++ -+ /* -+ * MOUNT THE EXPORT -+ */ -+diff --git a/lib/libnfs-sync.c b/lib/libnfs-sync.c -+index 59911fc..dc696c3 100644 -+--- a/lib/libnfs-sync.c -++++ b/lib/libnfs-sync.c -+@@ -137,9 +137,14 @@ static void wait_for_reply(struct rpc_context *rpc, struct sync_cb_data *cb_data -+ static void wait_for_nfs_reply(struct nfs_context *nfs, struct sync_cb_data *cb_data) -+ { -+ struct pollfd pfd; -+- -+- while (!cb_data->is_finished) { -+- -++ int available; -++ -++ /* loop until the command has completed, and we have written all -++ * queued PDUs to the socket, and we have read and processed all -++ * data in the socket receive buffer. -++ */ -++ ioctl(nfs_get_fd(nfs), FIONREAD, &available); -++ while (!cb_data->is_finished || nfs_outqueue_length(nfs) || available) { -+ pfd.fd = nfs_get_fd(nfs); -+ pfd.events = nfs_which_events(nfs); -+ if (poll(&pfd, 1, -1) < 0) { -+@@ -152,6 +157,7 @@ static void wait_for_nfs_reply(struct nfs_context *nfs, struct sync_cb_data *cb_ -+ cb_data->status = -EIO; -+ break; -+ } -++ ioctl(nfs_get_fd(nfs), FIONREAD, &available); -+ } -+ } -+ -+diff --git a/lib/libnfs-win32.def b/lib/libnfs-win32.def -+index 5a0df03..bdfa737 100644 -+--- a/lib/libnfs-win32.def -++++ b/lib/libnfs-win32.def -+@@ -48,6 +48,7 @@ nfs_open -+ nfs_open_async -+ nfs_opendir -+ nfs_opendir_async -++nfs_outqueue_length -+ nfs_parse_url_full -+ nfs_parse_url_dir -+ nfs_parse_url_incomplete -+@@ -56,6 +57,7 @@ nfs_pread -+ nfs_pread_async -+ nfs_pwrite -+ nfs_pwrite_async -++nfs_queue_length -+ nfs_read -+ nfs_read_async -+ nfs_readdir -+@@ -71,6 +73,7 @@ nfs_set_gid -+ nfs_set_tcp_syncnt -+ nfs_set_uid -+ nfs_set_readahead -++nfs_set_streaming_mode -+ nfs_stat -+ nfs_stat_async -+ nfs_stat64 -+@@ -205,6 +208,8 @@ rpc_nsm1_unmon_async -+ rpc_nsm1_unmonall_async -+ rpc_nsm1_simucrash_async -+ rpc_nsm1_notify_async -++rpc_outqueue_length -++rpc_queue_length -+ rpc_rquota1_null_async -+ rpc_rquota1_getquota_async -+ rpc_rquota1_getactivequota_async -+diff --git a/lib/libnfs.c b/lib/libnfs.c -+index f807822..5fc921d 100644 -+--- a/lib/libnfs.c -++++ b/lib/libnfs.c -+@@ -108,12 +108,37 @@ struct nfs_readahead { -+ uint32_t cur_ra; -+ }; -+ -++/* Store streaming cache in blocks of this size */ -++#define NFS_STREAM_BUF_SIZE (32768 * 4) -++/* Skip trying to streaming caching for reads greater than this */ -++#define NFS_MAX_STREAMING_SIZE (1024 * 1024) -++ -++#define BSS_UNUSED 0 -++#define BSS_PENDING 1 -++#define BSS_VALID 2 -++struct nfs_streaming_block { -++ int state; -++ unsigned char *ptr; -++}; -++ -++struct nfs_streaming_read { -++ uint64_t next_offset; -++ int num_seq; -++ -++ int num_blocks; /* number of buffer blocks */ -++ uint64_t buf_offset; -++ struct nfs_streaming_block *blocks; -++ unsigned char *buf; -++}; -++ -+ struct nfsfh { -+ struct nfs_fh3 fh; -+ int is_sync; -+ int is_append; -+ uint64_t offset; -+- struct nfs_readahead ra; -++ -++ struct nfs_streaming_read *sr; -++ struct nfs_readahead ra; /* broken? */ -+ }; -+ -+ struct nested_mounts { -+@@ -231,6 +256,11 @@ int nfs_get_fd(struct nfs_context *nfs) -+ return rpc_get_fd(nfs->rpc); -+ } -+ -++int nfs_outqueue_length(struct nfs_context *nfs) -++{ -++ return rpc_outqueue_length(nfs->rpc); -++} -++ -+ int nfs_queue_length(struct nfs_context *nfs) -+ { -+ return rpc_queue_length(nfs->rpc); -+@@ -730,12 +760,52 @@ static void free_nfs_cb_data(struct nfs_cb_data *data) -+ free(data); -+ } -+ -++int nfs_set_streaming_mode(struct nfsfh *nfsfh, uint32_t size) -++{ -++ struct nfs_streaming_read *sr; -++ int i; -++ -++ sr = malloc(sizeof(struct nfs_streaming_read)); -++ if (sr == NULL) { -++ return -1; -++ } -++ memset(sr, 0, sizeof(struct nfs_streaming_read)); -++ sr->num_blocks = size / NFS_STREAM_BUF_SIZE; -++ -++ sr->buf = malloc(sr->num_blocks * NFS_STREAM_BUF_SIZE); -++ if (sr->buf == NULL) { -++ free(sr); -++ return -1; -++ } -++ memset(sr->buf, 0, sr->num_blocks * NFS_STREAM_BUF_SIZE); -++ -++ sr->blocks = malloc(sr->num_blocks * sizeof(struct nfs_streaming_block)) -++; -++ if (sr->blocks == NULL) { -++ free(sr->buf); -++ free(sr); -++ return -1; -++ } -++ for (i = 0; i < sr->num_blocks; i++) { -++ sr->blocks[i].state = BSS_UNUSED; -++ sr->blocks[i].ptr = &sr->buf[i * NFS_STREAM_BUF_SIZE]; -++ } -++ nfsfh->sr = sr; -++ -++ return 0; -++} -++ -+ static void free_nfsfh(struct nfsfh *nfsfh) -+ { -+ if (nfsfh->fh.data.data_val != NULL) { -+ free(nfsfh->fh.data.data_val); -+ nfsfh->fh.data.data_val = NULL; -+ } -++ if (nfsfh->sr != NULL) { -++ free(nfsfh->sr->blocks); -++ free(nfsfh->sr->buf); -++ free(nfsfh->sr); -++ } -+ free(nfsfh->ra.buf); -+ free(nfsfh); -+ } -+@@ -2033,6 +2103,8 @@ static void nfs_open_cb(struct rpc_context *rpc, int status, void *command_data, -+ nfsfh->fh = data->fh; -+ data->fh.data.data_val = NULL; -+ -++ nfs_set_streaming_mode(nfsfh, 200 * NFS_STREAM_BUF_SIZE); -++ -+ data->cb(0, nfs, nfsfh, data->private_data); -+ free_nfs_cb_data(data); -+ } -+@@ -2252,10 +2324,194 @@ static void nfs_ra_invalidate(struct nfsfh *nfsfh) { -+ nfsfh->ra.cur_ra = NFS_BLKSIZE; -+ } -+ -++struct stream_cb_data { -++ uint64_t offset; -++ struct nfsfh *nfsfh; -++}; -++ -++static void nfs_stream_cb(struct rpc_context *rpc, int status, void *command_data, void *private_data) -++{ -++ struct stream_cb_data *stream_data = private_data; -++ struct nfsfh *nfsfh = stream_data->nfsfh; -++ READ3res *res; -++ int i; -++ -++ assert(rpc->magic == RPC_CONTEXT_MAGIC); -++ -++ if (stream_data->offset < nfsfh->sr->buf_offset) { -++ free(stream_data); -++ return; -++ } -++ if (stream_data->offset >= nfsfh->sr->buf_offset + nfsfh->sr->num_blocks * NFS_STREAM_BUF_SIZE) { -++ free(stream_data); -++ return; -++ } -++ -++ i = (stream_data->offset - nfsfh->sr->buf_offset) / NFS_STREAM_BUF_SIZE; -++ nfsfh->sr->blocks[i].state = BSS_UNUSED; -++ free(stream_data); -++ -++ if (status == RPC_STATUS_ERROR) { -++ return; -++ } -++ if (status == RPC_STATUS_CANCEL) { -++ return; -++ } -++ if (status == RPC_STATUS_SUCCESS) { -++ res = command_data; -++ if (res->status != NFS3_OK) { -++ return; -++ } -++ if (res->READ3res_u.resok.count != NFS_STREAM_BUF_SIZE) { -++ return; -++ } -++ memcpy(nfsfh->sr->blocks[i].ptr, -++ res->READ3res_u.resok.data.data_val, -++ NFS_STREAM_BUF_SIZE); -++ nfsfh->sr->blocks[i].state = BSS_VALID; -++ } -++} -++ -++static void prefetch_streaming_blocks(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t next_offset, int num_blocks) -++{ -++ int i; -++ -++ for (i = 0; i < nfsfh->sr->num_blocks && num_blocks; i++) { -++ struct stream_cb_data *stream_data; -++ READ3args args; -++ -++ if (nfsfh->sr->blocks[i].state != BSS_UNUSED) { -++ continue; -++ } -++ -++ stream_data = malloc(sizeof(struct stream_cb_data)); -++ if (stream_data == NULL) { -++ return; -++ } -++ stream_data->offset = i * NFS_STREAM_BUF_SIZE + nfsfh->sr->buf_offset; -++ stream_data->nfsfh = nfsfh; -++ -++ nfs_fill_READ3args(&args, nfsfh, stream_data->offset, NFS_STREAM_BUF_SIZE); -++ if (rpc_nfs3_read_async(nfs->rpc, nfs_stream_cb, &args, stream_data) != 0) { -++ free(stream_data); -++ return; -++ } -++ -++ nfsfh->sr->blocks[i].state = BSS_PENDING; -++ num_blocks--; -++ } -++} -++ -+ static int nfs_pread_async_internal(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, nfs_cb cb, void *private_data, int update_pos) -+ { -+ struct nfs_cb_data *data; -+ -++ if (nfsfh->sr != NULL && count <= NFS_MAX_STREAMING_SIZE) { -++ int i, len, remaining, first_block, last_block; -++ unsigned char *buf, *pos; -++ -++ /* track sequential access */ -++ if (offset == nfsfh->sr->next_offset) { -++ nfsfh->sr->num_seq++; -++ } else { -++ if (nfsfh->sr->blocks[0].state != BSS_UNUSED) { -++ for (i = 0; i < nfsfh->sr->num_blocks; i++) { -++ nfsfh->sr->blocks[i].state = BSS_UNUSED; -++ } -++ } -++ nfsfh->sr->num_seq = 0; -++ } -++ nfsfh->sr->next_offset = offset + count; -++ -++ if (nfsfh->sr->num_seq < 5) { -++ goto end_of_streaming; -++ } -++ -++ /* If we do not have any cached data yet, reset buffer -++ * offset to point slightly ahead of the current read. -++ */ -++ if (nfsfh->sr->blocks[0].state == BSS_UNUSED) { -++ nfsfh->sr->buf_offset = (offset / NFS_STREAM_BUF_SIZE + 1) * NFS_STREAM_BUF_SIZE ; -++ } -++ -++ /* Prune head blocks we have read past */ -++ while (nfsfh->sr->blocks[0].state != BSS_UNUSED && -++ offset >= (nfsfh->sr->buf_offset + NFS_STREAM_BUF_SIZE)) { -++ unsigned char *ptr; -++ -++ ptr = nfsfh->sr->blocks[0].ptr; -++ memmove(&nfsfh->sr->blocks[0], &nfsfh->sr->blocks[1], -++ (nfsfh->sr->num_blocks - 1) -++ * sizeof(struct nfs_streaming_block)); -++ nfsfh->sr->buf_offset += NFS_STREAM_BUF_SIZE; -++ nfsfh->sr->blocks[nfsfh->sr->num_blocks - 1].state = BSS_UNUSED; -++ nfsfh->sr->blocks[nfsfh->sr->num_blocks - 1].ptr = ptr; -++ } -++ -++ /* try to prefetch four more blocks */ -++ prefetch_streaming_blocks(nfs, nfsfh, offset + count, 4); -++ -++ /* can we service the request straight out of cache ? */ -++ if (offset < nfsfh->sr->buf_offset) { -++ goto end_of_streaming; -++ } -++ first_block = (offset - nfsfh->sr->buf_offset) / NFS_STREAM_BUF_SIZE; -++ if (first_block >= nfsfh->sr->num_blocks) { -++ goto end_of_streaming; -++ } -++ -++ if (offset + count > nfsfh->sr->buf_offset + nfsfh->sr->num_blocks * NFS_STREAM_BUF_SIZE) { -++ goto end_of_streaming; -++ } -++ last_block = (offset + count - nfsfh->sr->buf_offset - 1) / NFS_STREAM_BUF_SIZE; -++ if (last_block >= nfsfh->sr->num_blocks) { -++ goto end_of_streaming; -++ } -++ if (last_block < first_block) { -++ goto end_of_streaming; -++ } -++ for (i = first_block; i <= last_block; i++) { -++ if (nfsfh->sr->blocks[i].state != BSS_VALID) { -++ goto end_of_streaming; -++ } -++ } -++ if (first_block == last_block) { -++ if (update_pos) { -++ nfsfh->offset += count; -++ } -++ cb(count, nfs, &nfsfh->sr->blocks[first_block].ptr[offset % NFS_STREAM_BUF_SIZE], private_data); -++ return 0; -++ } -++ -++ buf = malloc(count); -++ if (buf == NULL) { -++ goto end_of_streaming; -++ } -++ remaining = count; -++ pos = buf; -++ len = NFS_STREAM_BUF_SIZE - offset % NFS_STREAM_BUF_SIZE; -++ if (len > count) { -++ len = count; -++ } -++ memcpy(pos, &nfsfh->sr->blocks[first_block].ptr[offset % NFS_STREAM_BUF_SIZE], len); -++ remaining -= len; -++ pos += len; -++ -++ for (i = first_block + 1; remaining; i++) { -++ len = (remaining >= NFS_STREAM_BUF_SIZE) ? NFS_STREAM_BUF_SIZE : remaining; -++ memcpy(pos, &nfsfh->sr->blocks[i].ptr[0], len); -++ remaining -= len; -++ pos += len; -++ } -++ if (update_pos) { -++ nfsfh->offset += count; -++ } -++ cb(count, nfs, buf, private_data); -++ free(buf); -++ return 0; -++ } -++end_of_streaming: -++ -+ data = malloc(sizeof(struct nfs_cb_data)); -+ if (data == NULL) { -+ rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure"); -+diff --git a/lib/socket.c b/lib/socket.c -+index 3588246..41fb5b2 100644 -+--- a/lib/socket.c -++++ b/lib/socket.c -+@@ -755,7 +755,7 @@ struct sockaddr *rpc_get_recv_sockaddr(struct rpc_context *rpc) -+ return (struct sockaddr *)&rpc->udp_src; -+ } -+ -+-int rpc_queue_length(struct rpc_context *rpc) -++int rpc_outqueue_length(struct rpc_context *rpc) -+ { -+ int i=0; -+ struct rpc_pdu *pdu; -+@@ -767,6 +767,19 @@ int rpc_queue_length(struct rpc_context *rpc) -+ i++; -+ } -+ -++ return i; -++} -++ -++int rpc_queue_length(struct rpc_context *rpc) -++{ -++ int i=0; -++ struct rpc_pdu *pdu; -++ unsigned int n; -++ -++ assert(rpc->magic == RPC_CONTEXT_MAGIC); -++ -++ i = rpc_outqueue_length(rpc); -++ -+ for (n = 0; n < HASHES; n++) { -+ struct rpc_queue *q = &rpc->waitpdu[n]; -+ -+-- -+1.9.1 -+ -+ -+From 6f6832b6c19a26557883af924d7135f5ef87f45d Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Sat, 7 Feb 2015 12:43:59 -0800 -+Subject: [PATCH 2/7] nfs-stream.c: a simple test tool to check performance -+ sequential read mode -+ -+./nfs-stream -+ -+This tool is for testing sequential read mode. -+It reads 32kbyte one block at a time using the sync API. -+The idea is that when a nfs_[p]read() command is executed, we will once we -+identify a sequential scan start issuing asynchronous commands in the -+background to populate a readahead cache. -+ -+During read, we try to service the request immediately out of cache -+and return immediately to the application. During read from cache we will also -+process any to previous reads and use it to populate the cache. Also, as the -+file offset grows, we will discard the already read blocks from the cache -+and issue new asynchronous commands at the tail of the cache. -+ -+nfs_read() will when the cache is operating behave like : -+ nfs_read() { -+ ... process any previous reads and populate the cache ... -+ ... send async command to replenish the tail of the cache ... -+ return data from cache straigh back to application -+ } -+ -+The test tool will try to read 32kb chunks at a given rate. -+Once the test tool manages to service from cache the read laency should drop -+to <<1ms and the majority of the time spent will be in the sleep() between calls. -+Once the latency is steady at <<1ms this is an indication that we now -+service all reads out of cache instead of the network. -+If the read latency remains <<1ms continously, without any spikes, it means that -+we have been successfull in maintaining the asycntrhous tasks to replenish the cache. -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ nfs-stream.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -+ 1 file changed, 65 insertions(+) -+ create mode 100644 nfs-stream.c -+ -+diff --git a/nfs-stream.c b/nfs-stream.c -+new file mode 100644 -+index 0000000..5570cd6 -+--- /dev/null -++++ b/nfs-stream.c -+@@ -0,0 +1,65 @@ -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#include "nfsc/libnfs.h" -++ -++int main(int argc, char *argv[]) -++{ -++ struct nfs_context *nfs; -++ struct nfs_url *url; -++ struct nfsfh *nfsfh = NULL; -++ struct nfs_stat_64 st; -++ uint64_t offset; -++ char buf[32768]; -++ struct timeval t1, t2; -++ uint64_t delta, tpc; -++ -++ nfs = nfs_init_context(); -++ url = nfs_parse_url_full(nfs, argv[1]); -++ if (!url) { -++ fprintf(stderr, "Can not parse URL. %s\n", -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ if (nfs_mount(nfs, url->server, url->path) != 0) { -++ fprintf(stderr, "Failed to mount nfs share : %s\n", -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ if (nfs_open(nfs, url->file, O_RDONLY, &nfsfh) != 0) { -++ fprintf(stderr, "Failed to open file %s: %s\n", -++ url->file, -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ if (nfs_fstat64(nfs, nfsfh, &st)) { -++ fprintf(stderr, "Failed to stat file %s: %s\n", -++ url->file, -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ printf("File size:%lld\n", (long long)st.nfs_size); -++ tpc = 1000000 / (strtol(argv[2], NULL, 10) / 32768); -++ printf("Read one 32kb chunk every %d us\n", (int)tpc); -++ for (offset = 0; offset < st.nfs_size; offset += 32768) { -++ gettimeofday(&t1, NULL); -++ nfs_read(nfs, nfsfh, 8192, buf); -++ gettimeofday(&t2, NULL); -++ delta = t2.tv_sec * 1000000LL + t2.tv_usec - -++ t1.tv_sec * 1000000LL - t1.tv_usec; -++ printf("Read latency:%lld us\n", (long long)delta); -++ if (tpc > delta) { -++ printf("Sleep for %d us\n", (int)(tpc - delta)); -++ usleep(tpc - delta); -++ } -++ } -++ -++ nfs_close(nfs, nfsfh); -++ nfs_destroy_context(nfs); -++ nfs_destroy_url(url); -++ return 0; -++} -+-- -+1.9.1 -+ -+ -+From 225e1c47727871c6ca74d6e3fef79ee6234923a1 Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Sat, 7 Feb 2015 13:31:02 -0800 -+Subject: [PATCH 3/7] streaming: only try refilling 2 blocks at a time instead -+ of 4 -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ lib/libnfs.c | 4 ++-- -+ 1 file changed, 2 insertions(+), 2 deletions(-) -+ -+diff --git a/lib/libnfs.c b/lib/libnfs.c -+index 5fc921d..84e76b6 100644 -+--- a/lib/libnfs.c -++++ b/lib/libnfs.c -+@@ -2448,8 +2448,8 @@ static int nfs_pread_async_internal(struct nfs_context *nfs, struct nfsfh *nfsfh -+ nfsfh->sr->blocks[nfsfh->sr->num_blocks - 1].ptr = ptr; -+ } -+ -+- /* try to prefetch four more blocks */ -+- prefetch_streaming_blocks(nfs, nfsfh, offset + count, 4); -++ /* try to prefetch to more blocks */ -++ prefetch_streaming_blocks(nfs, nfsfh, offset + count, 2); -+ -+ /* can we service the request straight out of cache ? */ -+ if (offset < nfsfh->sr->buf_offset) { -+-- -+1.9.1 -+ -+ -+From ceb35bb17425dda7408ae43ae80a997f4e1c1f95 Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Sat, 7 Feb 2015 16:19:59 -0800 -+Subject: [PATCH 4/7] read 32kb at a time, not 8kb -+ -+crapadoodle, if we measure 32kb blob read speed we should actually read -+a 32kb blob too. not a 8kb one. -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ nfs-stream.c | 4 ++-- -+ 1 file changed, 2 insertions(+), 2 deletions(-) -+ -+diff --git a/nfs-stream.c b/nfs-stream.c -+index 5570cd6..dd01218 100644 -+--- a/nfs-stream.c -++++ b/nfs-stream.c -+@@ -47,13 +47,13 @@ int main(int argc, char *argv[]) -+ printf("Read one 32kb chunk every %d us\n", (int)tpc); -+ for (offset = 0; offset < st.nfs_size; offset += 32768) { -+ gettimeofday(&t1, NULL); -+- nfs_read(nfs, nfsfh, 8192, buf); -++ nfs_read(nfs, nfsfh, 32768, buf); -+ gettimeofday(&t2, NULL); -+ delta = t2.tv_sec * 1000000LL + t2.tv_usec - -+ t1.tv_sec * 1000000LL - t1.tv_usec; -+ printf("Read latency:%lld us\n", (long long)delta); -+ if (tpc > delta) { -+- printf("Sleep for %d us\n", (int)(tpc - delta)); -++ //printf("Sleep for %d us\n", (int)(tpc - delta)); -+ usleep(tpc - delta); -+ } -+ } -+-- -+1.9.1 -+ -+ -+From 5f5faa8cfb86057081ccb3e30f987ecdec40fa13 Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Mon, 9 Feb 2015 20:46:25 -0800 -+Subject: [PATCH 5/7] prefetch: limit the amount of prefetches we have in -+ flight to 2 -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ lib/libnfs.c | 16 +++++++++++++--- -+ nfs-stream.c | 7 +++++++ -+ 2 files changed, 20 insertions(+), 3 deletions(-) -+ -+diff --git a/lib/libnfs.c b/lib/libnfs.c -+index 84e76b6..929d3e0 100644 -+--- a/lib/libnfs.c -++++ b/lib/libnfs.c -+@@ -2103,8 +2103,6 @@ static void nfs_open_cb(struct rpc_context *rpc, int status, void *command_data, -+ nfsfh->fh = data->fh; -+ data->fh.data.data_val = NULL; -+ -+- nfs_set_streaming_mode(nfsfh, 200 * NFS_STREAM_BUF_SIZE); -+- -+ data->cb(0, nfs, nfsfh, data->private_data); -+ free_nfs_cb_data(data); -+ } -+@@ -2374,12 +2372,24 @@ static void nfs_stream_cb(struct rpc_context *rpc, int status, void *command_dat -+ -+ static void prefetch_streaming_blocks(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t next_offset, int num_blocks) -+ { -+- int i; -++ int i, num_pending = 0; -+ -+ for (i = 0; i < nfsfh->sr->num_blocks && num_blocks; i++) { -+ struct stream_cb_data *stream_data; -+ READ3args args; -+ -++ /* -++ * BSS_PENDING means we have a request for prefetch in flight. -++ * We don't want an unlimited amount of requests in flight -++ * since it can cause wild latency spikes while initially -++ * filling the prefetch buffer. -++ */ -++ if (nfsfh->sr->blocks[i].state == BSS_PENDING) { -++ num_pending++; -++ } -++ if (num_pending >= num_blocks) { -++ continue; -++ } -+ if (nfsfh->sr->blocks[i].state != BSS_UNUSED) { -+ continue; -+ } -+diff --git a/nfs-stream.c b/nfs-stream.c -+index dd01218..f5a1b0a 100644 -+--- a/nfs-stream.c -++++ b/nfs-stream.c -+@@ -18,6 +18,11 @@ int main(int argc, char *argv[]) -+ struct timeval t1, t2; -+ uint64_t delta, tpc; -+ -++ if (argc != 3) { -++ fprintf(stderr, "Usage: nfs-stream \n"); -++ exit(1); -++ } -++ -+ nfs = nfs_init_context(); -+ url = nfs_parse_url_full(nfs, argv[1]); -+ if (!url) { -+@@ -36,6 +41,8 @@ int main(int argc, char *argv[]) -+ nfs_get_error(nfs)); -+ exit(1); -+ } -++ nfs_set_streaming_mode(nfsfh, 5 * 1024 * 1024); -++ -+ if (nfs_fstat64(nfs, nfsfh, &st)) { -+ fprintf(stderr, "Failed to stat file %s: %s\n", -+ url->file, -+-- -+1.9.1 -+ -+ -+From 503492873f27cefc3bfb368a96c4c7e1c99b303f Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Tue, 10 Feb 2015 16:40:53 -0800 -+Subject: [PATCH 6/7] streaming mode: wait until we have 10 sequential reads -+ before we prefetch -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ lib/libnfs.c | 2 +- -+ 1 file changed, 1 insertion(+), 1 deletion(-) -+ -+diff --git a/lib/libnfs.c b/lib/libnfs.c -+index 929d3e0..53b71fd 100644 -+--- a/lib/libnfs.c -++++ b/lib/libnfs.c -+@@ -2433,7 +2433,7 @@ static int nfs_pread_async_internal(struct nfs_context *nfs, struct nfsfh *nfsfh -+ } -+ nfsfh->sr->next_offset = offset + count; -+ -+- if (nfsfh->sr->num_seq < 5) { -++ if (nfsfh->sr->num_seq < 10) { -+ goto end_of_streaming; -+ } -+ -+-- -+1.9.1 -+ -+ -+From 55a673ae81514f109553d36b71647e8c334f8d81 Mon Sep 17 00:00:00 2001 -+From: Ronnie Sahlberg -+Date: Wed, 11 Feb 2015 01:25:05 -0800 -+Subject: [PATCH 7/7] nfs-stream.c: move this tool to the examples directory -+ -+Signed-off-by: Ronnie Sahlberg -+--- -+ examples/nfs-stream.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ -+ nfs-stream.c | 72 --------------------------------------------------- -+ 2 files changed, 72 insertions(+), 72 deletions(-) -+ create mode 100644 examples/nfs-stream.c -+ delete mode 100644 nfs-stream.c -+ -+diff --git a/examples/nfs-stream.c b/examples/nfs-stream.c -+new file mode 100644 -+index 0000000..f5a1b0a -+--- /dev/null -++++ b/examples/nfs-stream.c -+@@ -0,0 +1,72 @@ -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#include "nfsc/libnfs.h" -++ -++int main(int argc, char *argv[]) -++{ -++ struct nfs_context *nfs; -++ struct nfs_url *url; -++ struct nfsfh *nfsfh = NULL; -++ struct nfs_stat_64 st; -++ uint64_t offset; -++ char buf[32768]; -++ struct timeval t1, t2; -++ uint64_t delta, tpc; -++ -++ if (argc != 3) { -++ fprintf(stderr, "Usage: nfs-stream \n"); -++ exit(1); -++ } -++ -++ nfs = nfs_init_context(); -++ url = nfs_parse_url_full(nfs, argv[1]); -++ if (!url) { -++ fprintf(stderr, "Can not parse URL. %s\n", -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ if (nfs_mount(nfs, url->server, url->path) != 0) { -++ fprintf(stderr, "Failed to mount nfs share : %s\n", -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ if (nfs_open(nfs, url->file, O_RDONLY, &nfsfh) != 0) { -++ fprintf(stderr, "Failed to open file %s: %s\n", -++ url->file, -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ nfs_set_streaming_mode(nfsfh, 5 * 1024 * 1024); -++ -++ if (nfs_fstat64(nfs, nfsfh, &st)) { -++ fprintf(stderr, "Failed to stat file %s: %s\n", -++ url->file, -++ nfs_get_error(nfs)); -++ exit(1); -++ } -++ printf("File size:%lld\n", (long long)st.nfs_size); -++ tpc = 1000000 / (strtol(argv[2], NULL, 10) / 32768); -++ printf("Read one 32kb chunk every %d us\n", (int)tpc); -++ for (offset = 0; offset < st.nfs_size; offset += 32768) { -++ gettimeofday(&t1, NULL); -++ nfs_read(nfs, nfsfh, 32768, buf); -++ gettimeofday(&t2, NULL); -++ delta = t2.tv_sec * 1000000LL + t2.tv_usec - -++ t1.tv_sec * 1000000LL - t1.tv_usec; -++ printf("Read latency:%lld us\n", (long long)delta); -++ if (tpc > delta) { -++ //printf("Sleep for %d us\n", (int)(tpc - delta)); -++ usleep(tpc - delta); -++ } -++ } -++ -++ nfs_close(nfs, nfsfh); -++ nfs_destroy_context(nfs); -++ nfs_destroy_url(url); -++ return 0; -++} -+diff --git a/nfs-stream.c b/nfs-stream.c -+deleted file mode 100644 -+index f5a1b0a..0000000 -+--- a/nfs-stream.c -++++ /dev/null -+@@ -1,72 +0,0 @@ -+-#include -+-#include -+-#include -+-#include -+-#include -+-#include -+-#include -+-#include "nfsc/libnfs.h" -+- -+-int main(int argc, char *argv[]) -+-{ -+- struct nfs_context *nfs; -+- struct nfs_url *url; -+- struct nfsfh *nfsfh = NULL; -+- struct nfs_stat_64 st; -+- uint64_t offset; -+- char buf[32768]; -+- struct timeval t1, t2; -+- uint64_t delta, tpc; -+- -+- if (argc != 3) { -+- fprintf(stderr, "Usage: nfs-stream \n"); -+- exit(1); -+- } -+- -+- nfs = nfs_init_context(); -+- url = nfs_parse_url_full(nfs, argv[1]); -+- if (!url) { -+- fprintf(stderr, "Can not parse URL. %s\n", -+- nfs_get_error(nfs)); -+- exit(1); -+- } -+- if (nfs_mount(nfs, url->server, url->path) != 0) { -+- fprintf(stderr, "Failed to mount nfs share : %s\n", -+- nfs_get_error(nfs)); -+- exit(1); -+- } -+- if (nfs_open(nfs, url->file, O_RDONLY, &nfsfh) != 0) { -+- fprintf(stderr, "Failed to open file %s: %s\n", -+- url->file, -+- nfs_get_error(nfs)); -+- exit(1); -+- } -+- nfs_set_streaming_mode(nfsfh, 5 * 1024 * 1024); -+- -+- if (nfs_fstat64(nfs, nfsfh, &st)) { -+- fprintf(stderr, "Failed to stat file %s: %s\n", -+- url->file, -+- nfs_get_error(nfs)); -+- exit(1); -+- } -+- printf("File size:%lld\n", (long long)st.nfs_size); -+- tpc = 1000000 / (strtol(argv[2], NULL, 10) / 32768); -+- printf("Read one 32kb chunk every %d us\n", (int)tpc); -+- for (offset = 0; offset < st.nfs_size; offset += 32768) { -+- gettimeofday(&t1, NULL); -+- nfs_read(nfs, nfsfh, 32768, buf); -+- gettimeofday(&t2, NULL); -+- delta = t2.tv_sec * 1000000LL + t2.tv_usec - -+- t1.tv_sec * 1000000LL - t1.tv_usec; -+- printf("Read latency:%lld us\n", (long long)delta); -+- if (tpc > delta) { -+- //printf("Sleep for %d us\n", (int)(tpc - delta)); -+- usleep(tpc - delta); -+- } -+- } -+- -+- nfs_close(nfs, nfsfh); -+- nfs_destroy_context(nfs); -+- nfs_destroy_url(url); -+- return 0; -+-} -+-- -+1.9.1 -diff --git a/tools/depends/target/libnfs/Makefile b/tools/depends/target/libnfs/Makefile -index 642fba8..aa6bde1 100644 ---- a/tools/depends/target/libnfs/Makefile -+++ b/tools/depends/target/libnfs/Makefile -@@ -25,6 +25,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); ./bootstrap - cd $(PLATFORM); patch -p0 < ../utils.patch - cd $(PLATFORM); patch -p1 < ../readahead.patch -+ cd $(PLATFORM); patch -p1 < ../0001-Sequential-Readahead-Mode.patch +diff --git a/tools/depends/target/libcec/Makefile b/tools/depends/target/libcec/Makefile +index 6c72240..4378628 100644 +--- a/tools/depends/target/libcec/Makefile ++++ b/tools/depends/target/libcec/Makefile +@@ -21,6 +21,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) + rm -rf $(PLATFORM); mkdir -p $(PLATFORM) + cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) + cd $(PLATFORM); $(AUTORECONF) -vif ++ cd $(PLATFORM); patch -p1 < ../popcornmix.patch cd $(PLATFORM); $(CONFIGURE) $(LIBDYLIB): $(PLATFORM) -diff --git a/xbmc/filesystem/DllLibNfs.h b/xbmc/filesystem/DllLibNfs.h -index 4b5ba29..9ba8ebc 100644 ---- a/xbmc/filesystem/DllLibNfs.h -+++ b/xbmc/filesystem/DllLibNfs.h -@@ -85,6 +85,7 @@ class DllLibNfsInterface - virtual int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf)=0; - virtual int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf)=0; - virtual int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, int whence, uint64_t *current_offset)=0; -+ virtual void nfs_set_streaming_mode(struct nfsfh *nfsfh, uint32_t v)=0; - }; - - class DllLibNfs : public DllDynamic, DllLibNfsInterface -@@ -131,6 +132,7 @@ class DllLibNfs : public DllDynamic, DllLibNfsInterface - DEFINE_METHOD5(int, nfs_pread, (struct nfs_context *p1, struct nfsfh *p2, uint64_t p3, uint64_t p4, char *p5)) - DEFINE_METHOD5(int, nfs_pwrite, (struct nfs_context *p1, struct nfsfh *p2, uint64_t p3, uint64_t p4, char *p5)) - DEFINE_METHOD5(int, nfs_lseek, (struct nfs_context *p1, struct nfsfh *p2, uint64_t p3, int p4, uint64_t *p5)) -+ DEFINE_METHOD2(void,nfs_set_streaming_mode, (struct nfsfh *p1, uint32_t p2)) - - - -@@ -176,6 +178,7 @@ class DllLibNfs : public DllDynamic, DllLibNfsInterface - RESOLVE_METHOD_RENAME(nfs_symlink, nfs_symlink) - RESOLVE_METHOD_RENAME(nfs_rename, nfs_rename) - RESOLVE_METHOD_RENAME(nfs_link, nfs_link) -+ RESOLVE_METHOD_RENAME(nfs_set_streaming_mode, nfs_set_streaming_mode) - END_METHOD_RESOLVE() - }; - -diff --git a/xbmc/filesystem/NFSFile.cpp b/xbmc/filesystem/NFSFile.cpp -index 9354fd5..eaa1dd7 100644 ---- a/xbmc/filesystem/NFSFile.cpp -+++ b/xbmc/filesystem/NFSFile.cpp -@@ -562,6 +562,8 @@ bool CNFSFile::Open(const CURL& url) - CLog::Log(LOGDEBUG,"CNFSFile::Open - opened %s",url.GetFileName().c_str()); - m_url=url; - -+ //gNfsConnection.GetImpl()->nfs_set_streaming_mode(m_pFileHandle, 5 * 1024 * 1024); +diff --git a/tools/depends/target/libcec/popcornmix.patch b/tools/depends/target/libcec/popcornmix.patch +new file mode 100644 +index 0000000..84adc8c +--- /dev/null ++++ b/tools/depends/target/libcec/popcornmix.patch +@@ -0,0 +1,615 @@ ++From 651fc15222923bcaea6f7925c207217a40e967ab Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Fri, 24 Oct 2014 13:45:21 +0100 ++Subject: [PATCH 1/5] Make released key polling wait for exact time until key ++ gets released + - struct __stat64 tmpBuffer; - - if( Stat(&tmpBuffer) ) ++--- ++ src/lib/CECClient.cpp | 28 ++++++++++++++++++++++++---- ++ src/lib/CECClient.h | 2 +- ++ src/lib/CECProcessor.cpp | 8 +++++--- ++ src/lib/LibCEC.cpp | 10 ++++++++-- ++ src/lib/LibCEC.h | 4 +++- ++ 5 files changed, 41 insertions(+), 11 deletions(-) ++ ++diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp ++index 0bc9705..5fb1e6a 100644 ++--- a/src/lib/CECClient.cpp +++++ b/src/lib/CECClient.cpp ++@@ -1057,10 +1057,16 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) ++ AddKey(key); ++ } ++ ++-void CCECClient::CheckKeypressTimeout(void) +++uint16_t CCECClient::CheckKeypressTimeout(void) ++ { +++ // time when we'd like to be called again +++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ cec_keypress key; +++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +++ key.duration = 0; ++ +++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) +++ return timeout; ++ { ++ CLockObject lock(m_mutex); ++ uint64_t iNow = GetTimeMs(); ++@@ -1081,12 +1087,26 @@ void CCECClient::CheckKeypressTimeout(void) ++ } ++ else ++ { ++- return; +++ // time when this keypress will be released and we'd like to be called again +++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) +++ timeout = iTimeoutMs - (iNow - m_buttontime) + 1; +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) +++ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; +++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) +++ { +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ } ++ } ++ } ++ ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); ++- CallbackAddKey(key); +++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); +++ CallbackAddKey(key); +++ } +++ return timeout; ++ } ++ ++ bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) ++diff --git a/src/lib/CECClient.h b/src/lib/CECClient.h ++index 3ef0453..88efbbb 100644 ++--- a/src/lib/CECClient.h +++++ b/src/lib/CECClient.h ++@@ -182,7 +182,7 @@ namespace CEC ++ virtual void AddKey(bool bSendComboKey = false); ++ virtual void AddKey(const cec_keypress &key); ++ virtual void SetCurrentButton(const cec_user_control_code iButtonCode); ++- virtual void CheckKeypressTimeout(void); +++ virtual uint16_t CheckKeypressTimeout(void); ++ virtual void SourceActivated(const cec_logical_address logicalAddress); ++ virtual void SourceDeactivated(const cec_logical_address logicalAddress); ++ ++diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp ++index 557b76d..ecf9244 100644 ++--- a/src/lib/CECProcessor.cpp +++++ b/src/lib/CECProcessor.cpp ++@@ -51,7 +51,6 @@ using namespace CEC; ++ using namespace std; ++ using namespace PLATFORM; ++ ++-#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 ++ #define ACTIVE_SOURCE_CHECK_INTERVAL 500 ++ #define TV_PRESENT_CHECK_INTERVAL 30000 ++ ++@@ -244,6 +243,7 @@ bool CCECProcessor::OnCommandReceived(const cec_command &command) ++ ++ void *CCECProcessor::Process(void) ++ { +++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started"); ++ ++ if (!m_connCheck) ++@@ -258,13 +258,13 @@ void *CCECProcessor::Process(void) ++ while (!IsStopped() && m_communication->IsOpen()) ++ { ++ // wait for a new incoming command, and process it ++- if (m_inBuffer.Pop(command, CEC_PROCESSOR_SIGNAL_WAIT_TIME)) +++ if (m_inBuffer.Pop(command, timeout)) ++ ProcessCommand(command); ++ ++ if (CECInitialised() && !IsStopped()) ++ { ++ // check clients for keypress timeouts ++- m_libcec->CheckKeypressTimeout(); +++ timeout = m_libcec->CheckKeypressTimeout(); ++ ++ // check if we need to replace handlers ++ ReplaceHandlers(); ++@@ -295,6 +295,8 @@ void *CCECProcessor::Process(void) ++ tvPresentCheck.Init(TV_PRESENT_CHECK_INTERVAL); ++ } ++ } +++ else +++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ ++ return NULL; ++diff --git a/src/lib/LibCEC.cpp b/src/lib/LibCEC.cpp ++index c24b4ed..046205c 100644 ++--- a/src/lib/LibCEC.cpp +++++ b/src/lib/LibCEC.cpp ++@@ -354,11 +354,17 @@ bool CLibCEC::IsValidPhysicalAddress(uint16_t iPhysicalAddress) ++ iPhysicalAddress <= CEC_MAX_PHYSICAL_ADDRESS; ++ } ++ ++-void CLibCEC::CheckKeypressTimeout(void) +++uint16_t CLibCEC::CheckKeypressTimeout(void) ++ { +++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ // check all clients ++ for (vector::iterator it = m_clients.begin(); it != m_clients.end(); it++) ++- (*it)->CheckKeypressTimeout(); +++ { +++ uint16_t t = (*it)->CheckKeypressTimeout(); +++ if (t < timeout) +++ timeout = t; +++ } +++ return timeout; ++ } ++ ++ void CLibCEC::AddLog(const cec_log_level level, const char *strFormat, ...) ++diff --git a/src/lib/LibCEC.h b/src/lib/LibCEC.h ++index 3a312c0..b7ac645 100644 ++--- a/src/lib/LibCEC.h +++++ b/src/lib/LibCEC.h ++@@ -36,6 +36,8 @@ ++ #include "platform/util/buffer.h" ++ #include "CECTypeUtils.h" ++ +++#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 +++ ++ namespace CEC ++ { ++ class CAdapterCommunication; ++@@ -121,7 +123,7 @@ namespace CEC ++ ++ void AddLog(const cec_log_level level, const char *strFormat, ...); ++ void AddCommand(const cec_command &command); ++- void CheckKeypressTimeout(void); +++ uint16_t CheckKeypressTimeout(void); ++ void Alert(const libcec_alert type, const libcec_parameter ¶m); ++ ++ static bool IsValidPhysicalAddress(uint16_t iPhysicalAddress); ++-- ++1.9.1 ++ ++ ++From d506af4cff04156391f34d07f921e02c41a563b7 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Mon, 24 Nov 2014 23:18:52 +0000 ++Subject: [PATCH 2/5] Add settings for repeat and release ++ ++--- ++ include/cectypes.h | 6 ++++++ ++ src/lib/CECClient.cpp | 6 ++++++ ++ 2 files changed, 12 insertions(+) ++ ++diff --git a/include/cectypes.h b/include/cectypes.h ++index 0a90d0e..b75b1b3 100644 ++--- a/include/cectypes.h +++++ b/include/cectypes.h ++@@ -1532,6 +1532,8 @@ struct libcec_configuration ++ XXX changed meaning in 2.2.0 to not break binary compatibility. next major (3.0) release will fix it in a nicer way */ ++ cec_user_control_code comboKey; /*!< key code that initiates combo keys. defaults to CEC_USER_CONTROL_CODE_F1_BLUE. CEC_USER_CONTROL_CODE_UNKNOWN to disable. added in 2.0.5 */ ++ uint32_t iComboKeyTimeoutMs; /*!< timeout until the combo key is sent as normal keypress */ +++ uint32_t iButtonRepeatRateMs; /*!< rate at which buttons autorepeat. 0 means rely on CEC device */ +++ uint32_t iButtonReleaseDelayMs;/*!< duration after last update until a button is considered released */ ++ ++ #ifdef __cplusplus ++ libcec_configuration(void) { Clear(); } ++@@ -1566,6 +1568,8 @@ struct libcec_configuration ++ cecVersion == other.cecVersion && ++ adapterType == other.adapterType && ++ iDoubleTapTimeout50Ms == other.iDoubleTapTimeout50Ms && +++ iButtonRepeatRateMs == other.iButtonRepeatRateMs && +++ iButtonReleaseDelayMs == other.iButtonReleaseDelayMs && ++ (other.clientVersion <= CEC_CLIENT_VERSION_2_0_4 || comboKey == other.comboKey) && ++ (other.clientVersion <= CEC_CLIENT_VERSION_2_0_4 || iComboKeyTimeoutMs == other.iComboKeyTimeoutMs) && ++ (other.clientVersion < CEC_CLIENT_VERSION_2_1_0 || bPowerOnScreensaver == other.bPowerOnScreensaver)); ++@@ -1606,6 +1610,8 @@ struct libcec_configuration ++ iDoubleTapTimeout50Ms = CEC_DOUBLE_TAP_TIMEOUT_50_MS; ++ comboKey = CEC_USER_CONTROL_CODE_STOP; ++ iComboKeyTimeoutMs = CEC_DEFAULT_COMBO_TIMEOUT_MS; +++ iButtonRepeatRateMs = 0; +++ iButtonReleaseDelayMs = CEC_BUTTON_TIMEOUT; ++ ++ memset(strDeviceName, 0, 13); ++ deviceTypes.Clear(); ++diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp ++index 5fb1e6a..02f5f4a 100644 ++--- a/src/lib/CECClient.cpp +++++ b/src/lib/CECClient.cpp ++@@ -834,6 +834,9 @@ bool CCECClient::GetCurrentConfiguration(libcec_configuration &configuration) ++ configuration.bMonitorOnly = m_configuration.bMonitorOnly; ++ configuration.cecVersion = m_configuration.cecVersion; ++ configuration.adapterType = m_configuration.adapterType; +++ configuration.iDoubleTapTimeout50Ms = m_configuration.iDoubleTapTimeout50Ms; +++ configuration.iButtonRepeatRateMs = m_configuration.iButtonRepeatRateMs; +++ configuration.iButtonReleaseDelayMs = m_configuration.iButtonReleaseDelayMs; ++ ++ return true; ++ } ++@@ -877,6 +880,9 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) ++ m_configuration.cecVersion = configuration.cecVersion; ++ m_configuration.adapterType = configuration.adapterType; ++ m_configuration.iDoubleTapTimeout50Ms = configuration.iDoubleTapTimeout50Ms; +++ m_configuration.iButtonRepeatRateMs = configuration.iButtonRepeatRateMs; +++ m_configuration.iButtonReleaseDelayMs = configuration.iButtonReleaseDelayMs; +++ ++ m_configuration.deviceTypes.Add(configuration.deviceTypes[0]); ++ ++ if (m_configuration.clientVersion >= CEC_CLIENT_VERSION_2_0_5) ++-- ++1.9.1 ++ ++ ++From b6a6cc8ad12571dff0e02bc9a38ce97a00424df0 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Mon, 24 Nov 2014 23:20:05 +0000 ++Subject: [PATCH 3/5] Distinguish explicit and implicit forms of AddKey ++ releases ++ ++--- ++ src/lib/CECClient.cpp | 2 +- ++ src/lib/CECClient.h | 2 +- ++ src/lib/implementations/CECCommandHandler.cpp | 2 +- ++ 3 files changed, 3 insertions(+), 3 deletions(-) ++ ++diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp ++index 02f5f4a..3663b24 100644 ++--- a/src/lib/CECClient.cpp +++++ b/src/lib/CECClient.cpp ++@@ -968,7 +968,7 @@ int CCECClient::MenuStateChanged(const cec_menu_state newState) ++ return CallbackMenuStateChanged(newState); ++ } ++ ++-void CCECClient::AddKey(bool bSendComboKey /* = false */) +++void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* = false */) ++ { ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++diff --git a/src/lib/CECClient.h b/src/lib/CECClient.h ++index 88efbbb..84fb909 100644 ++--- a/src/lib/CECClient.h +++++ b/src/lib/CECClient.h ++@@ -179,7 +179,7 @@ namespace CEC ++ virtual int MenuStateChanged(const cec_menu_state newState); ++ virtual void Alert(const libcec_alert type, const libcec_parameter ¶m) { CallbackAlert(type, param); } ++ virtual void AddLog(const cec_log_message &message) { CallbackAddLog(message); } ++- virtual void AddKey(bool bSendComboKey = false); +++ virtual void AddKey(bool bSendComboKey = false, bool bButtonRelease = false); ++ virtual void AddKey(const cec_keypress &key); ++ virtual void SetCurrentButton(const cec_user_control_code iButtonCode); ++ virtual uint16_t CheckKeypressTimeout(void); ++diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp ++index a89ebe6..932c54b 100644 ++--- a/src/lib/implementations/CECCommandHandler.cpp +++++ b/src/lib/implementations/CECCommandHandler.cpp ++@@ -745,7 +745,7 @@ int CCECCommandHandler::HandleUserControlRelease(const cec_command &command) ++ ++ CCECClient *client = m_processor->GetClient(command.destination); ++ if (client) ++- client->AddKey(); +++ client->AddKey(false, true); ++ ++ return COMMAND_HANDLED; ++ } ++-- ++1.9.1 ++ ++ ++From 3b7606a9e0653149ae4b6e80d0df9c53645bfac9 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Mon, 24 Nov 2014 23:20:22 +0000 ++Subject: [PATCH 4/5] Support repeating button presses with configurable repeat ++ rate Keep track of time since initial button press and last button update ++ ++--- ++ src/lib/CECClient.cpp | 119 ++++++++++++++++++++++++++++++++++++++++---------- ++ src/lib/CECClient.h | 6 ++- ++ 2 files changed, 101 insertions(+), 24 deletions(-) ++ ++diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp ++index 3663b24..68eaee9 100644 ++--- a/src/lib/CECClient.cpp +++++ b/src/lib/CECClient.cpp ++@@ -52,7 +52,11 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_bInitialised(false), ++ m_bRegistered(false), ++ m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), ++- m_buttontime(0), +++ m_initialButtontime(0), +++ m_updateButtontime(0), +++ m_repeatButtontime(0), +++ m_releaseButtontime(0), +++ m_pressedButtoncount(0), ++ m_iPreventForwardingPowerOffCommand(0), ++ m_iLastKeypressTime(0) ++ { ++@@ -939,6 +943,7 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) ++ primary->ActivateSource(); ++ } ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: %d:%d:%d", __FUNCTION__, DoubleTapTimeoutMS(), m_configuration.iButtonRepeatRateMs, m_configuration.iButtonReleaseDelayMs); ++ return true; ++ } ++ ++@@ -977,9 +982,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++- key.duration = (unsigned int) (GetTimeMs() - m_buttontime); +++ unsigned int duration = (unsigned int) (GetTimeMs() - m_updateButtontime); +++ key.duration = (unsigned int) (GetTimeMs() - m_initialButtontime); ++ ++- if (key.duration > m_configuration.iComboKeyTimeoutMs || +++ if (duration > m_configuration.iComboKeyTimeoutMs || ++ m_configuration.iComboKeyTimeoutMs == 0 || ++ m_iCurrentButton != m_configuration.comboKey || ++ bSendComboKey) ++@@ -987,14 +993,22 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* ++ key.keycode = m_iCurrentButton; ++ ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_buttontime = 0; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; ++ } ++ } ++ } ++ +++ // we don't forward releases when supporting repeating keys +++ if (bButtonRelease && m_configuration.iButtonRepeatRateMs) +++ return; +++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x)", ToString(key.keycode), key.keycode); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++ CallbackAddKey(key); ++ } ++ } ++@@ -1005,10 +1019,11 @@ void CCECClient::AddKey(const cec_keypress &key) ++ key.keycode < CEC_USER_CONTROL_CODE_SELECT) ++ { ++ // send back the previous key if there is one +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Unexpected key %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(); ++ return; ++ } ++- +++ bool isrepeat = false; ++ cec_keypress transmitKey(key); ++ cec_user_control_code comboKey(m_configuration.clientVersion >= CEC_CLIENT_VERSION_2_0_5 ? ++ m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); ++@@ -1028,27 +1043,60 @@ void CCECClient::AddKey(const cec_keypress &key) ++ transmitKey.keycode = CEC_USER_CONTROL_CODE_DOT; ++ // default, send back the previous key ++ else +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Combo key %s (%1x) D%dms:", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(true); +++ } ++ } ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); +++ ++ if (m_iCurrentButton == key.keycode) ++ { ++- m_buttontime = GetTimeMs(); +++ m_updateButtontime = GetTimeMs(); +++ m_releaseButtontime = m_updateButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); +++ // want to have seen some updated before considering a repeat +++ if (m_configuration.iButtonRepeatRateMs) +++ { +++ if (!m_repeatButtontime && m_pressedButtoncount > 1) +++ m_repeatButtontime = m_initialButtontime + DoubleTapTimeoutMS(); +++ isrepeat = true; +++ } +++ m_pressedButtoncount++; ++ } ++ else ++ { ++- AddKey(); +++ if (m_iCurrentButton != transmitKey.keycode) +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Changed key %s (%1x) D:%dms cur:%lx", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration, m_iCurrentButton); +++ AddKey(); +++ } ++ if (key.duration == 0) ++ { ++ m_iCurrentButton = transmitKey.keycode; ++- m_buttontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); +++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) +++ { +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ } +++ else +++ { +++ m_initialButtontime = GetTimeMs(); +++ m_updateButtontime = m_initialButtontime; +++ m_repeatButtontime = 0; // set this on next update +++ m_releaseButtontime = m_initialButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); +++ m_pressedButtoncount = 1; +++ } ++ } ++ } ++ } ++ ++- if (key.keycode != comboKey || key.duration > 0) +++ if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) ++ { ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x, %d)", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration); ++ CallbackAddKey(transmitKey); ++ } ++ } ++@@ -1060,6 +1108,7 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) ++ key.duration = 0; ++ key.keycode = iButtonCode; ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "SetCurrentButton %s (%1x) D:%dms cur:%lx", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(key); ++ } ++ ++@@ -1076,35 +1125,59 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ { ++ CLockObject lock(m_mutex); ++ uint64_t iNow = GetTimeMs(); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s T:%.3f", __FUNCTION__, iNow*1e-3); ++ cec_user_control_code comboKey(m_configuration.clientVersion >= CEC_CLIENT_VERSION_2_0_5 ? ++ m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); ++ uint32_t iTimeoutMs(m_configuration.clientVersion >= CEC_CLIENT_VERSION_2_0_5 ? ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_buttontime > iTimeoutMs) || ++- (m_iCurrentButton != comboKey && iNow - m_buttontime > CEC_BUTTON_TIMEOUT))) +++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) ++ { ++- key.duration = (unsigned int) (iNow - m_buttontime); +++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++ ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_buttontime = 0; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ } +++ else if (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) +++ { +++ key.duration = (unsigned int) (iNow - m_initialButtontime); +++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +++ +++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ } +++ else if (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime) +++ { +++ key.duration = (unsigned int) (iNow - m_initialButtontime); +++ key.keycode = m_iCurrentButton; +++ m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; +++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ } ++ else ++ { ++- // time when this keypress will be released and we'd like to be called again ++- unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) ++- timeout = iTimeoutMs - (iNow - m_buttontime) + 1; ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) ++- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; +++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0) +++ timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); +++ if (m_iCurrentButton != comboKey && m_releaseButtontime) +++ timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); +++ if (m_iCurrentButton != comboKey && m_repeatButtontime) +++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, m_releaseButtontime*1e-3, m_iCurrentButton); ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ } +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Key %s: %s (duration:%d) (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d)", ToString(m_iCurrentButton), key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : m_repeatButtontime ? "repeated" : "released", key.duration, +++ m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount); ++ } ++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++diff --git a/src/lib/CECClient.h b/src/lib/CECClient.h ++index 84fb909..27af3f9 100644 ++--- a/src/lib/CECClient.h +++++ b/src/lib/CECClient.h ++@@ -311,7 +311,11 @@ namespace CEC ++ PLATFORM::CMutex m_mutex; /**< mutex for changes to this instance */ ++ PLATFORM::CMutex m_cbMutex; /**< mutex that is held when doing anything with callbacks */ ++ cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ ++- int64_t m_buttontime; /**< the timestamp when the button was pressed (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_repeatButtontime; /**< the timestamp when the button will next repeat (in seconds since epoch), or 0 if repeat is disabled. */ +++ int64_t m_releaseButtontime; /**< the timestamp when the button will be released (in seconds since epoch), or 0 if none was pressed. */ +++ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++ int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++ cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++-- ++1.9.1 ++ ++ ++From 23860987ec534a4aecf93100bef3736c2620fb93 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Tue, 28 Oct 2014 01:21:35 +0000 ++Subject: [PATCH 5/5] Skip double press removal. It is handled through other ++ means. ++ ++--- ++ src/lib/CECClient.cpp | 18 +----------------- ++ src/lib/CECClient.h | 2 -- ++ 2 files changed, 1 insertion(+), 19 deletions(-) ++ ++diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp ++index 68eaee9..9b4b533 100644 ++--- a/src/lib/CECClient.cpp +++++ b/src/lib/CECClient.cpp ++@@ -57,11 +57,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_repeatButtontime(0), ++ m_releaseButtontime(0), ++ m_pressedButtoncount(0), ++- m_iPreventForwardingPowerOffCommand(0), ++- m_iLastKeypressTime(0) +++ m_iPreventForwardingPowerOffCommand(0) ++ { ++- m_lastKeypress.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_lastKeypress.duration = 0; ++ m_configuration.Clear(); ++ // set the initial configuration ++ SetConfiguration(configuration); ++@@ -1568,20 +1565,7 @@ void CCECClient::CallbackAddKey(const cec_keypress &key) ++ { ++ CLockObject lock(m_cbMutex); ++ if (m_configuration.callbacks && m_configuration.callbacks->CBCecKeyPress) ++- { ++- // prevent double taps ++- int64_t now = GetTimeMs(); ++- if (m_lastKeypress.keycode != key.keycode || ++- key.duration > 0 || ++- now - m_iLastKeypressTime >= DoubleTapTimeoutMS()) ++- { ++- // no double tap ++- if (key.duration == 0) ++- m_iLastKeypressTime = now; ++- m_lastKeypress = key; ++ m_configuration.callbacks->CBCecKeyPress(m_configuration.callbackParam, key); ++- } ++- } ++ } ++ ++ void CCECClient::CallbackAddLog(const cec_log_message &message) ++diff --git a/src/lib/CECClient.h b/src/lib/CECClient.h ++index 27af3f9..eb11d9b 100644 ++--- a/src/lib/CECClient.h +++++ b/src/lib/CECClient.h ++@@ -317,7 +317,5 @@ namespace CEC ++ int64_t m_releaseButtontime; /**< the timestamp when the button will be released (in seconds since epoch), or 0 if none was pressed. */ ++ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++- int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++- cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++ }; ++ } ++-- ++1.9.1 -From 37b404211c9d8c6e1545f2f6fd6dda25ce553ad7 Mon Sep 17 00:00:00 2001 +From 37c1e4ba09cacd1fd0bf30883606fcab6c51d71d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 15 Feb 2015 14:06:12 +0000 -Subject: [PATCH 53/89] [mmal] Allow mmal codec for dvd stills +Subject: [PATCH 29/56] [mmal] Allow mmal codec for dvd stills --- xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -index 0cd267a..9d8de2a 100644 +index 0a16b4b..b77a168 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -@@ -49,6 +49,9 @@ +@@ -50,6 +50,9 @@ #include "Video/DVDVideoCodecAndroidMediaCodec.h" #include "android/activity/AndroidFeatures.h" #endif @@ -4788,300 +2239,10 @@ index 0cd267a..9d8de2a 100644 { // If dvd is an mpeg2 and hint.stills -From 1c666d5d6570d68e1099f8961cc9f2c52d6e04e1 Mon Sep 17 00:00:00 2001 -From: Claudio-Sjo -Date: Mon, 16 Feb 2015 14:51:26 +0100 -Subject: [PATCH 54/89] - allow reads < CDIO_CD_FRAMESIZE_RAW by using a buffer - - fixes #15794 - ---- - xbmc/filesystem/CDDAFile.cpp | 120 ++++++++++++++++++++++++++++++++----------- - xbmc/filesystem/CDDAFile.h | 3 ++ - 2 files changed, 92 insertions(+), 31 deletions(-) - -diff --git a/xbmc/filesystem/CDDAFile.cpp b/xbmc/filesystem/CDDAFile.cpp -index 16796f5..066b49f 100644 ---- a/xbmc/filesystem/CDDAFile.cpp -+++ b/xbmc/filesystem/CDDAFile.cpp -@@ -43,10 +43,14 @@ CFileCDDA::CFileCDDA(void) - m_lsnEnd = CDIO_INVALID_LSN; - m_cdio = CLibcdio::GetInstance(); - m_iSectorCount = 52; -+ m_TrackBuf = (uint8_t *) malloc(CDIO_CD_FRAMESIZE_RAW); -+ p_TrackBuf = 0; -+ f_TrackBuf = 0; - } - - CFileCDDA::~CFileCDDA(void) - { -+ free(m_TrackBuf); - Close(); - } - -@@ -54,6 +58,9 @@ bool CFileCDDA::Open(const CURL& url) - { - std::string strURL = url.GetWithoutFilename(); - -+ // Flag TrackBuffer = FALSE, TrackBuffer is empty -+ f_TrackBuf = 0; -+ - if (!g_mediaManager.IsDiscInDrive(strURL) || !IsValidFile(url)) - return false; - -@@ -118,50 +125,98 @@ int CFileCDDA::Stat(const CURL& url, struct __stat64* buffer) - - ssize_t CFileCDDA::Read(void* lpBuf, size_t uiBufSize) - { -- if (!m_pCdIo || !g_mediaManager.IsDiscInDrive()) -- return -1; - -- if (uiBufSize > SSIZE_MAX) -- uiBufSize = SSIZE_MAX; -+ ssize_t returnValue; -+ int iSectorCount; -+ void *destBuf; - -- // limit number of sectors that fits in buffer by m_iSectorCount -- int iSectorCount = std::min((int)uiBufSize / CDIO_CD_FRAMESIZE_RAW, m_iSectorCount); - -- if (iSectorCount <= 0) -+ if (!m_pCdIo || !g_mediaManager.IsDiscInDrive()) -+ { -+ CLog::Log(LOGERROR, "file cdda: Aborted because no disc in drive or no m_pCdIo"); - return -1; -+ } - -- // Are there enough sectors left to read -- if (m_lsnCurrent + iSectorCount > m_lsnEnd) -- iSectorCount = m_lsnEnd - m_lsnCurrent; -+ uiBufSize = std::min( uiBufSize, (size_t)SSIZE_MAX ); - -- // The loop tries to solve read error problem by lowering number of sectors to read (iSectorCount). -- // When problem is solved the proper number of sectors is stored in m_iSectorCount -- int big_iSectorCount = iSectorCount; -- while (iSectorCount > 0) -+ // If we have data in the TrackBuffer, they must be used first -+ if (f_TrackBuf) - { -- int iret = m_cdio->cdio_read_audio_sectors(m_pCdIo, lpBuf, m_lsnCurrent, iSectorCount); -+ // Get at most the remaining data in m_TrackBuf -+ uiBufSize = std::min(uiBufSize, CDIO_CD_FRAMESIZE_RAW - p_TrackBuf); -+ memcpy(lpBuf, m_TrackBuf + p_TrackBuf, uiBufSize); -+ // Update the data offset -+ p_TrackBuf += uiBufSize; -+ // Is m_TrackBuf empty? -+ f_TrackBuf = (CDIO_CD_FRAMESIZE_RAW == p_TrackBuf); -+ // All done, return read bytes -+ return uiBufSize; -+ } -+ -+ // No data left in buffer -+ -+ // Is this a short read? -+ if (uiBufSize < CDIO_CD_FRAMESIZE_RAW) -+ { -+ // short request, buffer one full sector -+ iSectorCount = 1; -+ destBuf = m_TrackBuf; -+ } -+ else // normal request -+ { -+ // limit number of sectors that fits in buffer by m_iSectorCount -+ iSectorCount = std::min((int)uiBufSize / CDIO_CD_FRAMESIZE_RAW, m_iSectorCount); -+ destBuf = lpBuf; -+ } - -+ // Are there enough sectors left to read? -+ iSectorCount = std::min(iSectorCount, m_lsnEnd - m_lsnCurrent); -+ -+ // Have we reached EOF? -+ if (iSectorCount == 0) -+ { -+ CLog::Log(LOGNOTICE, "file cdda: Read EoF"); -+ return 0; // Success, but nothing read -+ } // Reached EoF -+ -+ // At leat one sector to read -+ int retries; -+ int iret; -+ // Try reading a decresing number of sectors, then 3 times with 1 sector -+ for (retries = 3; retries > 0; iSectorCount>1 ? iSectorCount-- : retries--) -+ { -+ iret = m_cdio->cdio_read_audio_sectors(m_pCdIo, destBuf, m_lsnCurrent, iSectorCount); - if (iret == DRIVER_OP_SUCCESS) -+ break; // Get out from the loop -+ else - { -- // If lower iSectorCount solved the problem limit it's value -- if (iSectorCount < big_iSectorCount) -- { -- m_iSectorCount = iSectorCount; -- } -- break; -- } -- -- // iSectorCount is low so it cannot solve read problem -- if (iSectorCount <= 10) -- { -- CLog::Log(LOGERROR, "file cdda: Reading %d sectors of audio data starting at lsn %d failed with error code %i", iSectorCount, m_lsnCurrent, iret); -- return -1; -- } -- -- iSectorCount = 10; -+ CLog::Log(LOGERROR, "file cdda: Read cdio error when reading track "); -+ } // Errors when reading file - } -+ // retries == 0 only if failed reading at least one sector -+ if (retries == 0) -+ { -+ CLog::Log(LOGERROR, "file cdda: Reading %d sectors of audio data starting at lsn %d failed with error code %i", iSectorCount, m_lsnCurrent, iret); -+ return -1; -+ } -+ -+ // Update position in file - m_lsnCurrent += iSectorCount; - -+ // Was it a short request? -+ if (uiBufSize < CDIO_CD_FRAMESIZE_RAW) -+ { -+ // We copy the amount if requested data into the destination buffer -+ memcpy(lpBuf, m_TrackBuf, uiBufSize); -+ // and keep track of the first available data -+ p_TrackBuf = uiBufSize; -+ // Finally, we set the buffer flag as TRUE -+ f_TrackBuf = true; -+ // We will return uiBufSize -+ return uiBufSize; -+ } -+ -+ // Otherwise, just return the size of read data - return iSectorCount*CDIO_CD_FRAMESIZE_RAW; - } - -@@ -195,6 +250,9 @@ int64_t CFileCDDA::Seek(int64_t iFilePosition, int iWhence /*=SEEK_SET*/) - - void CFileCDDA::Close() - { -+ // Flag TrackBuffer = FALSE, TrackBuffer is empty -+ f_TrackBuf = 0; -+ - if (m_pCdIo) - { - m_cdio->cdio_destroy(m_pCdIo); -diff --git a/xbmc/filesystem/CDDAFile.h b/xbmc/filesystem/CDDAFile.h -index 0427af4..e992362 100644 ---- a/xbmc/filesystem/CDDAFile.h -+++ b/xbmc/filesystem/CDDAFile.h -@@ -50,6 +50,9 @@ class CFileCDDA : public IFile - - protected: - CdIo_t* m_pCdIo; -+ uint8_t *m_TrackBuf; -+ size_t p_TrackBuf; -+ int f_TrackBuf; - lsn_t m_lsnStart; // Start of m_iTrack in logical sector number - 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 bc5577e298d7939945b5700dbbbc42b4fe196a1e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 20 Feb 2015 14:11:57 +0000 -Subject: [PATCH 55/89] libavformat: add mvcC handling in .mov/.mp4 - ---- - ...ibavformat-add-mvcC-handling-in-.mov-.mp4.patch | 57 ++++++++++++++++++++++ - tools/depends/target/ffmpeg/Makefile | 3 +- - 2 files changed, 59 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch - -diff --git a/tools/depends/target/ffmpeg/0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch b/tools/depends/target/ffmpeg/0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch -new file mode 100644 -index 0000000..72fbcb9 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch -@@ -0,0 +1,57 @@ -+From 40bca2ae81bb9cd131b90bf262e976674ca6fab8 Mon Sep 17 00:00:00 2001 -+From: Deborah Crook -+Date: Fri, 16 Jan 2015 14:24:17 +0000 -+Subject: [PATCH] libavformat: add mvcC handling in .mov/.mp4 -+ -+--- -+ libavformat/mov.c | 28 ++++++++++++++++++++++++++++ -+ 1 file changed, 28 insertions(+) -+ -+diff --git a/libavformat/mov.c b/libavformat/mov.c -+index 7455e3b..29bfec9 100644 -+--- a/libavformat/mov.c -++++ b/libavformat/mov.c -+@@ -1201,6 +1201,33 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) -+ return 0; -+ } -+ -++static int mov_read_mvcc(MOVContext *c, AVIOContext *pb, MOVAtom atom) -++{ -++ int extradata_size; -++ int ret, i; -++ uint32_t n; -++ AVStream *st; -++ -++ if (c->fc->nb_streams < 1) -++ return 0; -++ st = c->fc->streams[c->fc->nb_streams-1]; -++ extradata_size = st->codec->extradata_size; -++ -++ if ((uint64_t)atom.size > (1<<30)) -++ return AVERROR_INVALIDDATA; -++ -++ if (extradata_size == 0) -++ return 0; -++ if ((ret = mov_read_extradata(c, pb, atom, AV_CODEC_ID_H264)) < 0) -++ return ret; -++ for (i = 0, n = 0; i < 4; i++) -++ n = (n << 8) | st->codec->extradata[extradata_size+i]; -++ n -= 4; -++ for (i = 0; i < 4; i++) -++ st->codec->extradata[extradata_size+i] = (n >> ((3 - i) << 3)) & 0xff; -++ return 0; -++} -++ -+ static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom) -+ { -+ AVStream *st; -+@@ -3383,6 +3410,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { -+ { MKTAG('C','i','n', 0x8e), mov_read_targa_y216 }, -+ { MKTAG('f','r','e','e'), mov_read_free }, -+ { MKTAG('-','-','-','-'), mov_read_custom }, -++{ MKTAG('m','v','c','C'), mov_read_mvcc }, -+ { 0, NULL } -+ }; -+ -+-- -+1.7.10.4 -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 6e8364a..43dc4ff 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -1,6 +1,6 @@ - include ../../Makefile.include - include FFMPEG-VERSION --DEPS= ../../Makefile.include FFMPEG-VERSION Makefile ffmpeg_Speed_up_wtv_index_creation.patch -+DEPS= ../../Makefile.include FFMPEG-VERSION Makefile ffmpeg_Speed_up_wtv_index_creation.patch 0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -69,6 +69,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) - cd $(PLATFORM); sed -i".bak" -e "s%pkg_config_default=pkg-config%export PKG_CONFIG_LIBDIR=$(PREFIX)/lib/pkgconfig \&\& pkg_config_default=$(NATIVEPREFIX)/bin/pkg-config%" configure - cd $(PLATFORM); patch -p3 < ../ffmpeg_Speed_up_wtv_index_creation.patch -+ cd $(PLATFORM); patch -p1 < ../0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - ./configure $(ffmpg_config) - -From fccae33d78ecc18c9edcec5f6e5a36005c6b8b8c Mon Sep 17 00:00:00 2001 +From e1e93abe7d9cb7e9232c67c6d1362fa294c290cb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 24 Feb 2015 15:57:29 +0000 -Subject: [PATCH 56/89] [mmalrenderer] Fix for stereo view modes +Subject: [PATCH 30/56] [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 @@ -5106,456 +2267,10 @@ index 3329980..d53de35 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 76958643f9e7aa870f3038a960baf3f987c39be8 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 27 Feb 2015 14:37:27 +0000 -Subject: [PATCH 57/89] ffmpeg: Add some upstream HEVC optimisations - ---- - tools/depends/target/ffmpeg/Makefile | 5 +- - ...hevcdsp_ARM_NEON_optimized_epel_functions.patch | 406 +++++++++++++++++++++ - 2 files changed, 410 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch - -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 43dc4ff..757721c 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -1,6 +1,7 @@ - include ../../Makefile.include - include FFMPEG-VERSION --DEPS= ../../Makefile.include FFMPEG-VERSION Makefile ffmpeg_Speed_up_wtv_index_creation.patch 0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch -+DEPS= ../../Makefile.include FFMPEG-VERSION Makefile ffmpeg_Speed_up_wtv_index_creation.patch 0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch \ -+ hevcdsp_ARM_NEON_optimized_epel_functions.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -70,6 +71,8 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); sed -i".bak" -e "s%pkg_config_default=pkg-config%export PKG_CONFIG_LIBDIR=$(PREFIX)/lib/pkgconfig \&\& pkg_config_default=$(NATIVEPREFIX)/bin/pkg-config%" configure - cd $(PLATFORM); patch -p3 < ../ffmpeg_Speed_up_wtv_index_creation.patch - cd $(PLATFORM); patch -p1 < ../0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch -+ cd $(PLATFORM); patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch -+ - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - ./configure $(ffmpg_config) -diff --git a/tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch b/tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch -new file mode 100644 -index 0000000..de95ba6 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch -@@ -0,0 +1,406 @@ -+From 5114c6fb870fe3aea5da05ea218760a47a29ad74 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Thu, 5 Feb 2015 13:32:28 +0000 -+Subject: [PATCH] hevcdsp: ARM NEON optimized epel functions -+ -+--- -+ libavcodec/arm/Makefile | 1 + -+ libavcodec/arm/hevcdsp_epel_neon.S | 334 +++++++++++++++++++++++++++++++++++++ -+ libavcodec/arm/hevcdsp_init_neon.c | 23 +++ -+ 3 files changed, 358 insertions(+) -+ create mode 100644 libavcodec/arm/hevcdsp_epel_neon.S -+ -+diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile -+index 434a2d1..95eb814 100644 -+--- a/libavcodec/arm/Makefile -++++ b/libavcodec/arm/Makefile -+@@ -134,6 +134,7 @@ NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \ -+ arm/synth_filter_neon.o -+ NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \ -+ arm/hevcdsp_deblock_neon.o \ -++ arm/hevcdsp_epel_neon.o \ -+ arm/hevcdsp_idct_neon.o \ -+ arm/hevcdsp_qpel_neon.o -+ NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o -+diff --git a/libavcodec/arm/hevcdsp_epel_neon.S b/libavcodec/arm/hevcdsp_epel_neon.S -+new file mode 100644 -+index 0000000..424416d -+--- /dev/null -++++ b/libavcodec/arm/hevcdsp_epel_neon.S -+@@ -0,0 +1,334 @@ -++/* -++ * Copyright (c) 2014 - 2015 Seppo Tomperi -++ * -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++#include "libavutil/arm/asm.S" -++#include "neon.S" -++ -++#define MAX_PB_SIZE #64 -++ -++.macro vextin_d4 -++ vld1.8 {q10}, [r1], r2 -++ vmov d16, d20 -++ vext.8 d17, d20, d21, #1 -++ vext.8 d18, d20, d21, #2 -++ vext.8 d19, d20, d21, #3 -++.endm -++ -++.macro vextin_d4_8 -++ vld1.8 d16, [r1], r2 -++ vext.8 d17, d16, d16, #1 -++ vext.8 d18, d16, d16, #2 -++ vext.8 d19, d16, d16, #3 -++.endm -++ -++.macro load_coeffs_16b coeffs -++ ldr \coeffs, [\coeffs] -++ vdup.i8 d0, \coeffs -++ lsr \coeffs, #8 -++ vdup.i8 d1, \coeffs -++ lsr \coeffs, #8 -++ vdup.i8 d2, \coeffs -++ lsr \coeffs, #8 -++ vdup.i8 d3, \coeffs -++.endm -++ -++.macro epel_filter_16b out=q12 -++ vmull.u8 q3, d16, d0 -++ vmull.u8 q11, d19, d3 -++ vmull.u8 \out, d17, d1 -++ vmull.u8 q10, d18, d2 -++ vadd.s16 q3, q11 -++ vadd.s16 \out, q10 -++ vsub.s16 \out, q3 -++.endm -++ -++.macro load_coeffs_32b coeffs -++ ldr \coeffs, [\coeffs] -++ vmov.i64 d4, #0 -++ vmov.8 d4[0], \coeffs -++ lsr \coeffs, #8 -++ vmov.8 d4[2], \coeffs -++ lsr \coeffs, #8 -++ vmov.8 d4[4], \coeffs -++ lsr \coeffs, #8 -++ vmov.8 d4[6], \coeffs -++.endm -++ -++.macro epel_filter_32b -++ vmull.s16 q3, d24, d4[0] //q12 -++ vmull.s16 q4, d25, d4[0] -++ vmull.s16 q5, d30, d4[3] //q15 -++ vmull.s16 q6, d31, d4[3] -++ -++ vmull.s16 q7, d26, d4[1] // q13 -++ vmull.s16 q8, d27, d4[1] -++ vmull.s16 q9, d28, d4[2] // q14 -++ vmull.s16 q10, d29, d4[2] -++ vadd.s32 q3, q5 -++ vadd.s32 q4, q6 -++ vadd.s32 q7, q9 -++ vadd.s32 q8, q10 -++ vsub.s32 q7, q3 -++ vsub.s32 q8, q4 -++ vqshrn.s32 d6, q7, #6 -++ vqshrn.s32 d7, q8, #6 -++.endm -++ -++.macro epel_filter_32b_4 -++ vmull.s16 q3, d24, d4[0] //q12 -++ vmull.s16 q5, d30, d4[3] //q15 -++ vmull.s16 q7, d26, d4[1] // q13 -++ vmull.s16 q9, d28, d4[2] // q14 -++ vadd.s32 q3, q5 -++ vadd.s32 q7, q9 -++ vsub.s32 q7, q3 -++ vqshrn.s32 d6, q7, #6 -++.endm -++ -++function ff_hevc_put_epel_h_neon_8, export=1 -++ push {r4-r7} -++ mov r4, MAX_PB_SIZE -++ ldr r7, [sp, #16] // mx -++ ldr r5, [sp, #24] // width -++ sub r7, #1 -++ lsl r7, #2 -++ vpush {d8-d15} -++ adrl r12, epel_coeffs -++ add r7, r12 -++ sub r1, #1 -++ lsl r4, #1 -++ load_coeffs_16b r7 -++ mov r12, r3 -++ mov r6, r0 -++ mov r7, r1 -++ cmp r5, #6 -++ bgt 8f -++ cmp r5, #4 -++ blt 2f -++ b 4f -++8: subs r3, #1 -++ pld [r1] -++ vextin_d4 -++ epel_filter_16b -++ vst1.16 {q12}, [r0], r4 -++ bne 8b -++ subs r5, #8 -++ beq 99f -++ mov r3, r12 -++ add r6, #16 -++ mov r0, r6 -++ add r7, #8 -++ mov r1, r7 -++ cmp r5, #4 -++ bgt 8b -++4: subs r3, #1 -++ pld [r1] -++ vextin_d4_8 -++ epel_filter_16b -++ vst1.16 d24, [r0], r4 -++ bne 4b -++ subs r5, #4 -++ beq 99f -++ mov r3, r12 -++ add r6, #8 -++ mov r0, r6 -++ add r7, #4 -++ mov r1, r7 -++2: subs r3, #1 -++ pld [r1] -++ vextin_d4_8 -++ epel_filter_16b -++ vst1.32 d24[0], [r0], r4 -++ bne 2b -++99: vpop {d8-d15} -++ pop {r4-r7} -++ bx lr -++endfunc -++ -++function ff_hevc_put_epel_v_neon_8, export=1 -++ push {r4-r7} -++ mov r4, MAX_PB_SIZE -++ ldr r7, [sp, #20] // my -++ ldr r5, [sp, #24] // width -++ sub r7, #1 -++ lsl r7, #2 -++ vpush {d8-d15} -++ adrl r12, epel_coeffs -++ add r7, r12 -++ load_coeffs_16b r7 -++ sub r1, r2 -++ lsl r4, #1 -++ mov r12, r3 -++ mov r6, r0 -++ mov r7, r1 -++0: pld [r1] -++ vld1.8 {d16}, [r1], r2 -++ pld [r1] -++ vld1.8 {d17}, [r1], r2 -++ pld [r1] -++ vld1.8 {d18}, [r1], r2 -++ cmp r5, #6 -++ bgt 8f -++ cmp r5, #4 -++ blt 2f -++ b 4f -++8: pld [r1] -++ vld1.8 {d19}, [r1], r2 -++ subs r3, #1 -++ epel_filter_16b -++ vst1.16 {q12}, [r0], r4 -++ vmov d16, d17 -++ vmov d17, d18 -++ vmov d18, d19 -++ bne 8b -++ subs r5, #8 -++ beq 99f -++ mov r3, r12 -++ add r6, #16 -++ mov r0, r6 -++ add r7, #8 -++ mov r1, r7 -++ b 0b -++4: pld [r1] -++ vld1.8 {d19}, [r1], r2 -++ subs r3, #1 -++ epel_filter_16b -++ vst1.16 d24, [r0], r4 -++ vmov d16, d17 -++ vmov d17, d18 -++ vmov d18, d19 -++ bne 4b -++ subs r5, #4 -++ beq 99f -++ mov r3, r12 -++ add r6, #8 -++ mov r0, r6 -++ add r7, #4 -++ mov r1, r7 -++ b 0b -++2: pld [r1] -++ vld1.8 {d19}, [r1], r2 -++ subs r3, #1 -++ epel_filter_16b -++ vst1.32 d24[0], [r0], r4 -++ vmov d16, d17 -++ vmov d17, d18 -++ vmov d18, d19 -++ bne 2b -++99: vpop {d8-d15} -++ pop {r4-r7} -++ bx lr -++endfunc -++ -++function ff_hevc_put_epel_hv_neon_8, export=1 -++ push {r4-r7} -++ mov r4, MAX_PB_SIZE -++ ldr r6, [sp, #16] // mx -++ ldr r7, [sp, #20] // my -++ ldr r5, [sp, #24] // width -++ sub r7, #1 -++ lsl r7, #2 -++ vpush {d8-d15} -++ adrl r12, epel_coeffs -++ sub r6, #1 -++ lsl r6, #2 -++ add r6, r12 // mx epel coeff offset -++ add r7, r12 -++ sub r1, #1 -++ sub r1, r2 -++ lsl r4, #1 -++ load_coeffs_16b r6 -++ load_coeffs_32b r7 -++ mov r12, r3 -++ mov r6, r0 -++ mov r7, r1 -++0: pld [r1] -++ vextin_d4 -++ epel_filter_16b q12 -++ pld [r1] -++ vextin_d4 -++ epel_filter_16b q13 -++ pld [r1] -++ vextin_d4 -++ epel_filter_16b q14 -++ cmp r5, #6 -++ bgt 8f -++ cmp r5, #4 -++ blt 2f -++ b 4f -++8: pld [r1] -++ vextin_d4 -++ epel_filter_16b q15 -++ subs r3, #1 -++ epel_filter_32b -++ vst1.16 {q3}, [r0], r4 -++ vmov q12, q13 -++ vmov q13, q14 -++ vmov q14, q15 -++ bne 8b -++ subs r5, #8 -++ beq 99f -++ mov r3, r12 -++ add r6, #16 -++ mov r0, r6 -++ add r7, #8 -++ mov r1, r7 -++ b 0b -++4: pld [r1] -++ vextin_d4_8 -++ epel_filter_16b q15 -++ subs r3, #1 -++ epel_filter_32b_4 -++ vst1.16 d6, [r0], r4 -++ vmov q12, q13 -++ vmov q13, q14 -++ vmov q14, q15 -++ bne 4b -++ subs r5, #4 -++ beq 99f -++ mov r3, r12 -++ add r6, #8 -++ mov r0, r6 -++ add r7, #4 -++ mov r1, r7 -++ b 0b -++2: pld [r1] -++ vextin_d4_8 -++ epel_filter_16b q15 -++ subs r3, #1 -++ epel_filter_32b_4 -++ vst1.32 d6[0], [r0], r4 -++ vmov q12, q13 -++ vmov q13, q14 -++ vmov q14, q15 -++ bne 2b -++99: vpop {d8-d15} -++ pop {r4-r7} -++ bx lr -++endfunc -++ -++epel_coeffs: -++ .byte 2, 58, 10, 2 -++ .byte 4, 54, 16, 2 -++ .byte 6, 46, 28, 4 -++ .byte 4, 36, 36, 4 -++ .byte 4, 28, 46, 6 -++ .byte 2, 16, 54, 4 -++ .byte 2, 10, 58, 2 -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 61e6462..917abc4 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -57,6 +57,15 @@ PUT_PIXELS(ff_hevc_put_pixels_w32_neon_8); -+ PUT_PIXELS(ff_hevc_put_pixels_w48_neon_8); -+ PUT_PIXELS(ff_hevc_put_pixels_w64_neon_8); -+ #undef PUT_PIXELS -++void ff_hevc_put_epel_h_neon_8(int16_t *dst, uint8_t *src, -++ ptrdiff_t srcstride, int height, -++ intptr_t mx, intptr_t my, int width); -++void ff_hevc_put_epel_v_neon_8(int16_t *dst, uint8_t *src, -++ ptrdiff_t srcstride, int height, -++ intptr_t mx, intptr_t my, int width); -++void ff_hevc_put_epel_hv_neon_8(int16_t *dst, uint8_t *src, -++ ptrdiff_t srcstride, int height, -++ intptr_t mx, intptr_t my, int width); -+ -+ static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, -+ int height, int width); -+@@ -201,7 +210,21 @@ static av_cold void hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ c->put_hevc_qpel_bi[x][1][0] = ff_hevc_put_qpel_bi_neon_wrapper; -+ c->put_hevc_qpel_bi[x][0][1] = ff_hevc_put_qpel_bi_neon_wrapper; -+ c->put_hevc_qpel_bi[x][1][1] = ff_hevc_put_qpel_bi_neon_wrapper; -++ c->put_hevc_epel[x][1][0] = ff_hevc_put_epel_v_neon_8; -++ c->put_hevc_epel[x][0][1] = ff_hevc_put_epel_h_neon_8; -++ c->put_hevc_epel[x][1][1] = ff_hevc_put_epel_hv_neon_8; -+ } -++ c->put_hevc_epel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; -++ c->put_hevc_epel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; -++ c->put_hevc_epel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; -++ c->put_hevc_epel[3][0][0] = ff_hevc_put_pixels_w8_neon_8; -++ c->put_hevc_epel[4][0][0] = ff_hevc_put_pixels_w12_neon_8; -++ c->put_hevc_epel[5][0][0] = ff_hevc_put_pixels_w16_neon_8; -++ c->put_hevc_epel[6][0][0] = ff_hevc_put_pixels_w24_neon_8; -++ c->put_hevc_epel[7][0][0] = ff_hevc_put_pixels_w32_neon_8; -++ c->put_hevc_epel[8][0][0] = ff_hevc_put_pixels_w48_neon_8; -++ c->put_hevc_epel[9][0][0] = ff_hevc_put_pixels_w64_neon_8; -++ -+ c->put_hevc_qpel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; -+ 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 e885adeaa52b27c769c7c0f599e95c772f93f0fa Mon Sep 17 00:00:00 2001 +From e11c6931312b66a33fd8ddc52a1c121894c913ab Mon Sep 17 00:00:00 2001 From: anaconda Date: Wed, 25 Feb 2015 18:22:21 +0100 -Subject: [PATCH 58/89] Load OSD dialogs on startup. +Subject: [PATCH 31/56] 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. @@ -5650,120 +2365,10 @@ index 4940561..f52698c 100644 CGUIDialogVideoSettings::~CGUIDialogVideoSettings() { } -From 018f759a0be60d10f72bb35df22e074ceb88ae72 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 5 Mar 2015 20:00:59 +0000 -Subject: [PATCH 59/89] [ffmpmeg] Discard data before VO/VOL in mpeg-4 over - mpegts - ---- - ...-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch | 69 ++++++++++++++++++++++ - tools/depends/target/ffmpeg/Makefile | 4 +- - 2 files changed, 72 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/0001-Discard-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch - -diff --git a/tools/depends/target/ffmpeg/0001-Discard-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch b/tools/depends/target/ffmpeg/0001-Discard-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch -new file mode 100644 -index 0000000..eef7385 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-Discard-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch -@@ -0,0 +1,69 @@ -+From ff289b3678b3b102f76c0fc0ffc802e3c8026fdb Mon Sep 17 00:00:00 2001 -+From: Deborah Crook -+Date: Thu, 5 Mar 2015 19:48:43 +0000 -+Subject: [PATCH] Discard data before VO/VOL in mpeg-4 over mpegts -+ -+--- -+ libavcodec/mpeg4video_parser.c | 26 ++++++++++++++++++++++---- -+ 1 file changed, 22 insertions(+), 4 deletions(-) -+ -+diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c -+index aa5e87a..0d8b15a 100644 -+--- a/libavcodec/mpeg4video_parser.c -++++ b/libavcodec/mpeg4video_parser.c -+@@ -43,18 +43,32 @@ int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) -+ state = pc->state; -+ -+ i = 0; -+- if (!vop_found) { -++ if (vop_found < 0) { -++ for (i = 0; i < buf_size; i++) { -++ state = (state << 8) | buf[i]; -++ if (state >= 0x100 && state <= 0x12f) { -++ i++; -++ vop_found = 0; -++ break; -++ } -++ } -++ } -++ -++ if (vop_found == 0) -++ vop_found = 1; -++ -++ if (vop_found == 1) { -+ for (i = 0; i < buf_size; i++) { -+ state = (state << 8) | buf[i]; -+ if (state == 0x1B6) { -+ i++; -+- vop_found = 1; -++ vop_found = 2; -+ break; -+ } -+ } -+ } -+ -+- if (vop_found) { -++ if (vop_found == 2) { -+ /* EOF considered as end of frame */ -+ if (buf_size == 0) -+ return 0; -+@@ -133,12 +147,16 @@ static int mpeg4video_parse(AVCodecParserContext *s, -+ ParseContext *pc = s->priv_data; -+ int next; -+ -++ if (pc->frame_start_found == 0 && !avctx->extradata) -++ pc->frame_start_found = -1; -++ -+ if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { -+ next = buf_size; -+ } else { -+ next = ff_mpeg4_find_frame_end(pc, buf, buf_size); -+ -+- if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { -++ if (pc->frame_start_found < 0 || -++ ff_combine_frame(pc, next, &buf, &buf_size) < 0) { -+ *poutbuf = NULL; -+ *poutbuf_size = 0; -+ return buf_size; -+-- -+2.1.4 -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 757721c..fbef09a 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -1,7 +1,8 @@ - include ../../Makefile.include - include FFMPEG-VERSION - DEPS= ../../Makefile.include FFMPEG-VERSION Makefile ffmpeg_Speed_up_wtv_index_creation.patch 0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch \ -- hevcdsp_ARM_NEON_optimized_epel_functions.patch -+ hevcdsp_ARM_NEON_optimized_epel_functions.patch \ -+ 0001-Discard-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -72,6 +73,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); patch -p3 < ../ffmpeg_Speed_up_wtv_index_creation.patch - cd $(PLATFORM); patch -p1 < ../0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch - cd $(PLATFORM); patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch -+ cd $(PLATFORM); patch -p1 < ../0001-Discard-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch - - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - -From 91db23dc25c5ea12f5183dc99379ac79d9e6a1dd Mon Sep 17 00:00:00 2001 +From 71e5a4591b65a12c3621395644c2542b1216c94f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 7 Mar 2015 22:46:21 +0000 -Subject: [PATCH 60/89] configure: Add raspberry-pi2 platform +Subject: [PATCH 32/56] configure: Add raspberry-pi2 platform --- configure.ac | 14 +++++++-- @@ -5775,7 +2380,7 @@ Subject: [PATCH 60/89] configure: Add raspberry-pi2 platform 6 files changed, 44 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac -index b7b2a87..be28bf6 100644 +index ea94c1d..2a80a9d 100644 --- a/configure.ac +++ b/configure.ac @@ -746,8 +746,17 @@ case $use_platform in @@ -5937,10 +2542,10 @@ index cdc2fe4..379bd1d 100644 set(CMAKE_SYSTEM_NAME Linux) endif() -From ae3bcf13b7c5e8f372410cea93f85fc44067d402 Mon Sep 17 00:00:00 2001 +From 05272dd1d48f92910c02f134d58cad85e236b567 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 16 Apr 2014 21:18:06 +0100 -Subject: [PATCH 61/89] [omxplayer] Don't propagate 3d flags based on supported +Subject: [PATCH 33/56] [omxplayer] Don't propagate 3d flags based on supported 3d modes --- @@ -5948,10 +2553,10 @@ Subject: [PATCH 61/89] [omxplayer] Don't propagate 3d flags based on supported 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index 8becff1..86d97bd 100644 +index 5ca7665..2e077e5 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -763,40 +763,17 @@ void OMXPlayerVideo::ResolutionUpdateCallBack(uint32_t width, uint32_t height, f +@@ -762,40 +762,17 @@ void OMXPlayerVideo::ResolutionUpdateCallBack(uint32_t width, uint32_t height, f uint32_t video_width = CDisplaySettings::Get().GetResolutionInfo(res).iScreenWidth; uint32_t video_height = CDisplaySettings::Get().GetResolutionInfo(res).iScreenHeight; @@ -5996,10 +2601,10 @@ index 8becff1..86d97bd 100644 unsigned int iDisplayHeight = height; -From a969c6c631b7fbf6b9c246ed3152448df288339a Mon Sep 17 00:00:00 2001 +From f4aec8de701350aacbfbde39cef3290a03f27dcc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:01:51 +0100 -Subject: [PATCH 62/89] [graphics] Allow switching to a more suitable 3D +Subject: [PATCH 34/56] [graphics] Allow switching to a more suitable 3D resolution --- @@ -6085,10 +2690,10 @@ index 5c1501a..aba11cd 100644 void ResetOverscan(RESOLUTION_INFO &resinfo); void ResetScreenParameters(RESOLUTION res); -From eb7a1712a184b4d997998b97359d20d6a2ab95ac Mon Sep 17 00:00:00 2001 +From 78450508b10c875a8d4d48015f256a6c1d2b2c40 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:38:55 +0100 -Subject: [PATCH 63/89] [3D] Support switching to 3D resolutions +Subject: [PATCH 35/56] [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. @@ -6170,10 +2775,10 @@ index 4345c0f..cc5dc60 100644 return current; } -From 776a7d653349f024a92f4ee065527cb558ad389c Mon Sep 17 00:00:00 2001 +From cc039a1f0c00c08a795e2afb33a3c7f2f494bab2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 23 Apr 2014 00:05:07 +0100 -Subject: [PATCH 64/89] [graphics] Make pixel ratio for 3d modes consistent +Subject: [PATCH 36/56] [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. @@ -6340,10 +2945,10 @@ index aba11cd..c84aed0 100644 /*! \brief Set a region in which to clip all rendering Anything that is rendered after setting a clip region will be clipped so that no part renders diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index d388373..ba14e40 100644 +index c80114e..80c05d2 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -546,15 +546,9 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r +@@ -499,15 +499,9 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r m_desktopRes.fPixelRatio = tv_state.display.hdmi.display_options.aspect == 0 ? 1.0f : get_display_aspect_ratio((HDMI_ASPECT_T)tv_state.display.hdmi.display_options.aspect) / ((float)m_desktopRes.iScreenWidth / (float)m_desktopRes.iScreenHeight); // Also add 3D flags if (tv_state.display.hdmi.format_3d == HDMI_3D_FORMAT_SBS_HALF) @@ -6359,7 +2964,7 @@ index d388373..ba14e40 100644 HDMI_PROPERTY_PARAM_T property; property.property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE; vc_tv_hdmi_get_property(&property); -@@ -694,7 +688,6 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v +@@ -650,7 +644,6 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v RESOLUTION_INFO res2 = res; res2.dwFlags |= D3DPRESENTFLAG_MODE3DSBS; res2.fPixelRatio = get_display_aspect_ratio((HDMI_ASPECT_T)tv->aspect_ratio) / ((float)res2.iScreenWidth / (float)res2.iScreenHeight); @@ -6367,7 +2972,7 @@ index d388373..ba14e40 100644 res2.iSubtitles = (int)(0.965 * res2.iHeight); AddUniqueResolution(res2, resolutions); -@@ -710,7 +703,6 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v +@@ -666,7 +659,6 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v RESOLUTION_INFO res2 = res; res2.dwFlags |= D3DPRESENTFLAG_MODE3DTB; res2.fPixelRatio = get_display_aspect_ratio((HDMI_ASPECT_T)tv->aspect_ratio) / ((float)res2.iScreenWidth / (float)res2.iScreenHeight); @@ -6376,149 +2981,20 @@ index d388373..ba14e40 100644 AddUniqueResolution(res2, resolutions); -From d341efba61fba5ce9738b208a23fdb4cb4b95e96 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 10 Mar 2015 17:05:18 +0000 -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 ++++++++++ - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 5 +++++ - xbmc/cores/omxplayer/OMXVideo.cpp | 5 +++++ - 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 bf466b0..d45f05d 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16667,6 +16667,16 @@ msgctxt "#38102" - msgid "%i ms" - msgstr "" - -+#: system/settings/rbp.xml -+msgctxt "#38110" -+msgid "Support MVC video (full frame 3D)" -+msgstr "" -+ -+#: system/settings/rbp.xml -+msgctxt "#38111" -+msgid "This option decodes frames for both eyes of MVC video. Disabling may improve performance if you don't require 3D" -+msgstr "" -+ - #: system/settings/settings.xml - msgctxt "#38103" - msgid "Extract thumbnails from video files" -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 6e9ceaf..ed61ca6 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -30,6 +30,16 @@ - - - -+ -+ -+ -+ 1 -+ -+ 2 -+ true -+ -+ -+ - - - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index df282f3..9e0aa66 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -549,6 +549,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide - // H.264 - m_codingType = MMAL_ENCODING_H264; - m_pFormatName = "mmal-h264"; -+ if (CSettings::Get().GetBool("videoplayer.supportmvc")) -+ { -+ m_codingType = MMAL_ENCODING_MVC; -+ m_pFormatName= "mmal-mvc"; -+ } - break; - 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 ca40a37..ec8fe9c 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -430,6 +430,11 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de - break; - } - } -+ if (CSettings::Get().GetBool("videoplayer.supportmvc")) -+ { -+ m_codingType = OMX_VIDEO_CodingMVC; -+ m_video_codec_name = "omx-mvc"; -+ } - break; - case AV_CODEC_ID_MPEG4: - // (role name) video_decoder.mpeg4 - -From 6802d4a755bb5609e27a797242b7f858d722716a Mon Sep 17 00:00:00 2001 +From ceb6bdca72eebab222cea1ea26ebc853e96e6465 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Mar 2015 12:38:08 +0000 -Subject: [PATCH 66/89] [mmalrenderer] Switch to using transform flags for 3d +Subject: [PATCH 37/56] [mmalrenderer] Switch to using transform flags for 3d modes --- - .../resource.language.en_gb/resources/strings.po | 10 +++ - system/settings/rbp.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 ++- - 7 files changed, 75 insertions(+), 130 deletions(-) + 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 ++- + 5 files changed, 57 insertions(+), 130 deletions(-) -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index d45f05d..bce7527 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -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 "" - -+#: system/settings/rbp.xml -+msgctxt "#38112" -+msgid "Use Full HD HDMI modes for 3D" -+msgstr "" -+ -+#: system/settings/rbp.xml -+msgctxt "#38113" -+msgid "This option uses frame-packing to output full resolution for 3D through HDMI" -+msgstr "" -+ - #: system/settings/settings.xml - msgctxt "#38103" - msgid "Extract thumbnails from video files" -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index ed61ca6..42d4da7 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -39,6 +39,14 @@ - true - - -+ -+ -+ true -+ -+ 2 -+ true -+ -+ - - - diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp index d53de35..c30de9c 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp @@ -6658,10 +3134,10 @@ index d53de35..c30de9c 100644 + region.dest_rect.x, region.dest_rect.y, region.dest_rect.width, region.dest_rect.height, region.transform); } diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index 86d97bd..018e65f 100644 +index 2e077e5..f6c6eb0 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -660,9 +660,7 @@ int OMXPlayerVideo::GetFreeSpace() +@@ -659,9 +659,7 @@ int OMXPlayerVideo::GetFreeSpace() void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRect) { @@ -6672,7 +3148,7 @@ index 86d97bd..018e65f 100644 CRect SrcRect = InSrcRect, DestRect = InDestRect; unsigned flags = GetStereoModeFlags(GetStereoMode()); -@@ -702,42 +700,10 @@ void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRec +@@ -701,42 +699,10 @@ void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRec 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); @@ -6719,7 +3195,7 @@ index 86d97bd..018e65f 100644 if (gui != display) { -@@ -748,7 +714,7 @@ void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRec +@@ -747,7 +713,7 @@ void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRec DestRect.y1 *= yscale; DestRect.y2 *= yscale; } @@ -6729,7 +3205,7 @@ 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 ec8fe9c..3f37d44 100644 +index ca40a37..bb4d572 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp @@ -220,15 +220,6 @@ bool COMXVideo::PortSettingsChanged() @@ -6748,7 +3224,7 @@ index ec8fe9c..3f37d44 100644 if(m_hdmi_clock_sync) { OMX_CONFIG_LATENCYTARGETTYPE latencyTarget; -@@ -860,7 +851,7 @@ void COMXVideo::Reset(void) +@@ -855,7 +846,7 @@ void COMXVideo::Reset(void) } /////////////////////////////////////////////////////////////////////////////////////////// @@ -6757,7 +3233,7 @@ index ec8fe9c..3f37d44 100644 { CSingleLock lock (m_critSection); if(!m_is_open) -@@ -870,7 +861,7 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER +@@ -865,7 +856,7 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER OMX_INIT_STRUCTURE(configDisplay); configDisplay.nPortIndex = m_omx_render.GetInputPort(); @@ -6766,7 +3242,7 @@ index ec8fe9c..3f37d44 100644 configDisplay.dest_rect.x_offset = lrintf(DestRect.x1); configDisplay.dest_rect.y_offset = lrintf(DestRect.y1); configDisplay.dest_rect.width = lrintf(DestRect.Width()); -@@ -883,23 +874,24 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER +@@ -878,23 +869,24 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect, RENDER configDisplay.fullscreen = OMX_FALSE; configDisplay.noaspect = OMX_TRUE; @@ -6816,10 +3292,10 @@ index 9f26427..3ea02dc 100644 bool GetPlayerInfo(double &match, double &phase, double &pll); void SubmitEOS(); diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index ba14e40..10a0409 100644 +index 80c05d2..ae85484 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -284,7 +284,9 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) +@@ -281,7 +281,9 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) /* inform TV of any 3D settings. Note this property just applies to next hdmi mode change, so no need to call for 2D modes */ HDMI_PROPERTY_PARAM_T property; property.property = HDMI_PROPERTY_3D_STRUCTURE; @@ -6830,7 +3306,7 @@ index ba14e40..10a0409 100644 property.param1 = HDMI_3D_FORMAT_SBS_HALF; else if (res.dwFlags & D3DPRESENTFLAG_MODE3DTB) property.param1 = HDMI_3D_FORMAT_TB_HALF; -@@ -384,6 +386,13 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) +@@ -354,6 +356,13 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) DISPMANX_TRANSFORM_T transform = DISPMANX_NO_ROTATE; DISPMANX_UPDATE_HANDLE_T dispman_update = m_DllBcmHost->vc_dispmanx_update_start(0); @@ -6845,10 +3321,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 3531e8d698ce4d38ce16c7697f6a5111563a9238 Mon Sep 17 00:00:00 2001 +From 978189928bf88240aa551e48921a6f74b90957f1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 17 Mar 2015 20:33:54 +0000 -Subject: [PATCH 67/89] alsa: enable-shared is required +Subject: [PATCH 38/56] alsa: enable-shared is required --- tools/depends/target/alsa-lib/Makefile | 2 +- @@ -6868,10 +3344,10 @@ index b03fc19..a04d933 100644 LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a -From 63a3a45ee208669b1b74a4f88aa9802ab5bf6c49 Mon Sep 17 00:00:00 2001 +From c906a8a2edab573281ccbd99563c7c05f644d1e2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 31 Mar 2015 17:31:47 +0100 -Subject: [PATCH 70/89] [mmalrenderer] Add SetCodecControl function and prefer +Subject: [PATCH 39/56] [mmalrenderer] Add SetCodecControl function and prefer to return pictures when renderer is low (disabled) --- @@ -6910,7 +3386,7 @@ index a768e70..aa8e87f 100644 protected: diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 9e0aa66..1e711b4 100644 +index df282f3..6eb7f7c 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -128,6 +128,7 @@ CMMALVideo::CMMALVideo() @@ -6921,7 +3397,7 @@ index 9e0aa66..1e711b4 100644 } CMMALVideo::~CMMALVideo() -@@ -944,6 +945,9 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -939,6 +940,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; @@ -6931,7 +3407,7 @@ index 9e0aa66..1e711b4 100644 } if (!ret) { -@@ -995,6 +999,7 @@ void CMMALVideo::Reset(void) +@@ -990,6 +994,7 @@ void CMMALVideo::Reset(void) m_startframe = false; m_decoderPts = DVD_NOPTS_VALUE; m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); @@ -6939,7 +3415,7 @@ index 9e0aa66..1e711b4 100644 } void CMMALVideo::SetSpeed(int iSpeed) -@@ -1128,3 +1133,10 @@ bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) +@@ -1123,3 +1128,10 @@ bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) // CLog::Log(LOGDEBUG, "%s::%s - pts:%.0f droppedPics:%d", CLASSNAME, __func__, pts, droppedPics); return true; } @@ -6971,10 +3447,10 @@ index 4c9b20f..c405aa1 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; -From be88e53ace69911dd0400e19c087f6bac7318ec9 Mon Sep 17 00:00:00 2001 +From 84bcf7c0aa9499fde22571ce993b520053a4353e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 Apr 2015 16:31:37 +0100 -Subject: [PATCH 71/89] [mmalcodec] Limit submitted video frames. Seems to +Subject: [PATCH 40/56] [mmalcodec] Limit submitted video frames. Seems to avoid stutter issues with low bitrate videos --- @@ -6982,10 +3458,10 @@ Subject: [PATCH 71/89] [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 1e711b4..77c31f2 100644 +index 6eb7f7c..24ddc3b 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -928,7 +928,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -923,7 +923,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) break; } int ret = 0; @@ -6996,10 +3472,10 @@ index 1e711b4..77c31f2 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 ae1a4baf6e3fe6ebd229a1b56d5cd6314c2390a0 Mon Sep 17 00:00:00 2001 +From 01e34be063309eb5cc05984a90be0eeb27e18f83 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 6 Apr 2015 19:06:26 +0100 -Subject: [PATCH 72/89] [mmalcodec] Remove the decoder queue and use gpu +Subject: [PATCH 41/56] [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. @@ -7014,7 +3490,7 @@ Instead remove the dts queue and use the gpu's timestamps. 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 77c31f2..d8d733e 100644 +index 24ddc3b..4bdca80 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -129,6 +129,7 @@ CMMALVideo::CMMALVideo() @@ -7069,7 +3545,7 @@ index 77c31f2..d8d733e 100644 } } else if (buffer->cmd == MMAL_EVENT_FORMAT_CHANGED) -@@ -653,6 +642,10 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -648,6 +637,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)); @@ -7080,7 +3556,7 @@ index 77c31f2..d8d733e 100644 status = mmal_port_format_commit(m_dec_input); if (status != MMAL_SUCCESS) { -@@ -721,6 +714,8 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -716,6 +709,8 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide m_startframe = false; m_preroll = !m_hints.stills; m_speed = DVD_PLAYSPEED_NORMAL; @@ -7089,7 +3565,7 @@ index 77c31f2..d8d733e 100644 return true; } -@@ -736,10 +731,9 @@ void CMMALVideo::Dispose() +@@ -731,10 +726,9 @@ void CMMALVideo::Dispose() done = true; pthread_mutex_unlock(&m_output_mutex); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -7101,7 +3577,7 @@ index 77c31f2..d8d733e 100644 m_myself.reset(); } } -@@ -772,11 +766,19 @@ void CMMALVideo::SetDropState(bool bDrop) +@@ -767,11 +761,19 @@ void CMMALVideo::SetDropState(bool bDrop) } } @@ -7123,7 +3599,7 @@ index 77c31f2..d8d733e 100644 unsigned int demuxer_bytes = 0; uint8_t *demuxer_content = NULL; -@@ -840,6 +842,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -835,6 +837,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) return VC_ERROR; } @@ -7137,7 +3613,7 @@ index 77c31f2..d8d733e 100644 mmal_buffer_header_reset(buffer); buffer->cmd = 0; if (!m_startframe && pts == DVD_NOPTS_VALUE) -@@ -862,8 +871,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -857,8 +866,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)) @@ -7148,7 +3624,7 @@ index 77c31f2..d8d733e 100644 assert((int)buffer->length > 0); status = mmal_port_send_buffer(m_dec_input, buffer); if (status != MMAL_SUCCESS) -@@ -880,12 +889,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -875,12 +884,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { m_droppedPics += m_deint ? 2:1; } @@ -7161,7 +3637,7 @@ index 77c31f2..d8d733e 100644 pthread_mutex_unlock(&m_output_mutex); if (m_changed_count_dec != m_changed_count) { -@@ -928,11 +931,11 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -923,11 +926,11 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) break; } int ret = 0; @@ -7176,7 +3652,7 @@ index 77c31f2..d8d733e 100644 ret |= VC_BUFFER; } else -@@ -953,8 +956,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -948,8 +951,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) if (!ret) { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -7187,7 +3663,7 @@ index 77c31f2..d8d733e 100644 Sleep(10); // otherwise we busy spin } return ret; -@@ -984,8 +987,6 @@ void CMMALVideo::Reset(void) +@@ -979,8 +982,6 @@ void CMMALVideo::Reset(void) bool old_drop_state = m_drop_state; SetDropState(true); pthread_mutex_lock(&m_output_mutex); @@ -7196,7 +3672,7 @@ index 77c31f2..d8d733e 100644 while (!m_demux_queue.empty()) m_demux_queue.pop(); m_demux_queue_length = 0; -@@ -1001,6 +1002,7 @@ void CMMALVideo::Reset(void) +@@ -996,6 +997,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; @@ -7204,7 +3680,7 @@ index 77c31f2..d8d733e 100644 } void CMMALVideo::SetSpeed(int iSpeed) -@@ -1020,8 +1022,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) +@@ -1015,8 +1017,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) mmal_buffer_header_reset(buffer); buffer->cmd = 0; if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -7215,7 +3691,7 @@ index 77c31f2..d8d733e 100644 status = mmal_port_send_buffer(m_dec_output, buffer); if (status != MMAL_SUCCESS) { -@@ -1048,7 +1050,7 @@ void CMMALVideo::ReleaseBuffer(CMMALVideoBuffer *buffer) +@@ -1043,7 +1045,7 @@ void CMMALVideo::ReleaseBuffer(CMMALVideoBuffer *buffer) if (done) m_myself.reset(); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -7245,10 +3721,10 @@ index c405aa1..f5f664a 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; -From 2f763b28cb818300befb9f7a4c6fd79c7ced9d7f Mon Sep 17 00:00:00 2001 +From e5cc4fea13487d975d3ff1f4223932f76445ac33 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 9 Apr 2015 18:18:09 +0100 -Subject: [PATCH 73/89] [mmalrenderer] Remove dropping logic. It only seems to +Subject: [PATCH 42/56] [mmalrenderer] Remove dropping logic. It only seems to make things worse --- @@ -7257,7 +3733,7 @@ Subject: [PATCH 73/89] [mmalrenderer] Remove dropping logic. It only seems to 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 d8d733e..cfe106a 100644 +index 4bdca80..ea93e32 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -97,7 +97,6 @@ CMMALVideo::CMMALVideo() @@ -7298,7 +3774,7 @@ index d8d733e..cfe106a 100644 } } } -@@ -710,7 +705,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -705,7 +700,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide if (!SendCodecConfigData()) return false; @@ -7306,7 +3782,7 @@ index d8d733e..cfe106a 100644 m_startframe = false; m_preroll = !m_hints.stills; m_speed = DVD_PLAYSPEED_NORMAL; -@@ -740,30 +734,8 @@ void CMMALVideo::Dispose() +@@ -735,30 +729,8 @@ void CMMALVideo::Dispose() void CMMALVideo::SetDropState(bool bDrop) { @@ -7339,7 +3815,7 @@ index d8d733e..cfe106a 100644 } static unsigned count_bits(int32_t value) -@@ -859,10 +831,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -854,10 +826,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; @@ -7350,7 +3826,7 @@ index d8d733e..cfe106a 100644 memcpy(buffer->data, demuxer_content, buffer->length); demuxer_bytes -= buffer->length; demuxer_content += buffer->length; -@@ -885,10 +853,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -880,10 +848,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { pthread_mutex_lock(&m_output_mutex); m_startframe = true; @@ -7361,7 +3837,7 @@ index d8d733e..cfe106a 100644 pthread_mutex_unlock(&m_output_mutex); if (m_changed_count_dec != m_changed_count) { -@@ -984,16 +948,28 @@ void CMMALVideo::Reset(void) +@@ -979,16 +943,28 @@ void CMMALVideo::Reset(void) mmal_port_enable(m_dec_output, dec_output_port_cb_static); } // blow all ready video frames @@ -7395,7 +3871,7 @@ index d8d733e..cfe106a 100644 if (!m_finished) SendCodecConfigData(); -@@ -1127,14 +1103,8 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) +@@ -1122,14 +1098,8 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) { @@ -7433,10 +3909,10 @@ index f5f664a..f79fed5 100644 bool m_preroll; int m_codecControlFlags; -From d0eb9742af9ecf3de62d560d0e5c57de2531486f Mon Sep 17 00:00:00 2001 +From ff4c4b5773c669e0b7eb13919e246cbc5c3328fb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 Apr 2015 12:47:04 +0100 -Subject: [PATCH 74/89] [players] Make use of new scheme to submit DTS +Subject: [PATCH 43/56] [players] Make use of new scheme to submit DTS timestamps Latest firmware supports marking timestamps as DTS, @@ -7454,7 +3930,7 @@ 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 cfe106a..237a581 100644 +index ea93e32..ea85f25 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -57,7 +57,6 @@ CMMALVideoBuffer::CMMALVideoBuffer(CMMALVideo *omv) @@ -7501,7 +3977,7 @@ index cfe106a..237a581 100644 } } } -@@ -637,7 +633,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -632,7 +628,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)); @@ -7514,7 +3990,7 @@ index cfe106a..237a581 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)); -@@ -708,8 +708,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -703,8 +703,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide m_startframe = false; m_preroll = !m_hints.stills; m_speed = DVD_PLAYSPEED_NORMAL; @@ -7523,7 +3999,7 @@ index cfe106a..237a581 100644 return true; } -@@ -738,14 +736,6 @@ void CMMALVideo::SetDropState(bool bDrop) +@@ -733,14 +731,6 @@ void CMMALVideo::SetDropState(bool bDrop) CLog::Log(LOGDEBUG, "%s::%s - bDrop(%d)", CLASSNAME, __func__, bDrop); } @@ -7538,7 +4014,7 @@ index cfe106a..237a581 100644 int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -813,14 +803,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -808,14 +798,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; } @@ -7553,7 +4029,7 @@ index cfe106a..237a581 100644 mmal_buffer_header_reset(buffer); buffer->cmd = 0; if (!m_startframe && pts == DVD_NOPTS_VALUE) -@@ -978,7 +960,6 @@ void CMMALVideo::Reset(void) +@@ -973,7 +955,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; @@ -7561,7 +4037,7 @@ index cfe106a..237a581 100644 } void CMMALVideo::SetSpeed(int iSpeed) -@@ -1064,7 +1045,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) +@@ -1059,7 +1040,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) } // timestamp is in microseconds @@ -7591,10 +4067,10 @@ index f79fed5..415f3e3 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index 018e65f..4315993 100644 +index f6c6eb0..d953b1c 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -106,7 +106,6 @@ OMXPlayerVideo::OMXPlayerVideo(OMXClock *av_clock, +@@ -105,7 +105,6 @@ OMXPlayerVideo::OMXPlayerVideo(OMXClock *av_clock, m_iCurrentPts = DVD_NOPTS_VALUE; m_nextOverlay = DVD_NOPTS_VALUE; m_flush = false; @@ -7602,7 +4078,7 @@ index 018e65f..4315993 100644 } OMXPlayerVideo::~OMXPlayerVideo() -@@ -314,14 +313,6 @@ void OMXPlayerVideo::Output(double pts, bool bDropPacket) +@@ -313,14 +312,6 @@ void OMXPlayerVideo::Output(double pts, bool bDropPacket) g_renderManager.FlipPage(CThread::m_bStop, time/DVD_TIME_BASE); } @@ -7617,7 +4093,7 @@ index 018e65f..4315993 100644 void OMXPlayerVideo::Process() { double frametime = (double)DVD_TIME_BASE / m_fFrameRate; -@@ -496,18 +487,20 @@ void OMXPlayerVideo::Process() +@@ -495,18 +486,20 @@ void OMXPlayerVideo::Process() m_stalled = false; } @@ -7645,7 +4121,7 @@ index 018e65f..4315993 100644 Output(pts, bRequestDrop); if(pts != DVD_NOPTS_VALUE) m_iCurrentPts = pts; -@@ -583,9 +576,6 @@ bool OMXPlayerVideo::OpenDecoder() +@@ -582,9 +575,6 @@ bool OMXPlayerVideo::OpenDecoder() m_codecname = m_omxVideo.GetDecoderName(); } @@ -7668,10 +4144,10 @@ index 2748a41..3bd5625 100644 CDVDOverlayContainer *m_pOverlayContainer; diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 3f37d44..832a9c9 100644 +index bb4d572..1011b5d 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -602,23 +602,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de +@@ -597,23 +597,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de return false; } @@ -7695,7 +4171,7 @@ index 3f37d44..832a9c9 100644 if(NaluFormatStartCodes(hints.codec, m_extradata, m_extrasize)) { OMX_NALSTREAMFORMATTYPE nalStreamFormat; -@@ -758,7 +741,7 @@ bool COMXVideo::GetPlayerInfo(double &match, double &phase, double &pll) +@@ -753,7 +736,7 @@ bool COMXVideo::GetPlayerInfo(double &match, double &phase, double &pll) } @@ -7704,7 +4180,7 @@ index 3f37d44..832a9c9 100644 { CSingleLock lock (m_critSection); OMX_ERRORTYPE omx_err; -@@ -783,6 +766,7 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) +@@ -778,6 +761,7 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) omx_buffer->nFlags = 0; omx_buffer->nOffset = 0; @@ -7712,7 +4188,7 @@ index 3f37d44..832a9c9 100644 if(m_setStartTime) { -@@ -790,10 +774,11 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) +@@ -785,10 +769,11 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE); m_setStartTime = false; } @@ -7740,10 +4216,10 @@ index 3ea02dc..86e94ce 100644 void SetDropState(bool bDrop); std::string GetDecoderName() { return m_video_codec_name; }; -From c5d5f34a04502ef918ad35de044862e4a6e4f843 Mon Sep 17 00:00:00 2001 +From 8806ac18c5c1d43fef3357f5a15bd960f493cd51 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 +Subject: [PATCH 44/56] [gui] Also limit GUI updates when in non full-screen video mode --- @@ -7751,10 +4227,10 @@ Subject: [PATCH 75/89] [gui] Also limit GUI updates when in non full-screen 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 5889613..9ba0d23 100644 +index 1141d7b..832b22d 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -2496,7 +2496,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) +@@ -2495,7 +2495,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 @@ -7763,7 +4239,7 @@ index 5889613..9ba0d23 100644 fps = CSettings::Get().GetInt("videoplayer.limitguiupdate"); #endif -@@ -2509,6 +2509,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) +@@ -2508,6 +2508,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) { if (!m_skipGuiRender) g_windowManager.Process(CTimeUtils::GetFrameTime()); @@ -7773,10 +4249,10 @@ index 5889613..9ba0d23 100644 g_windowManager.FrameMove(); } -From e40d733fa86aa4835daaec2484169c05fe5796c9 Mon Sep 17 00:00:00 2001 +From a9d65318b7758e3afcb8841999bc98e15117afeb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 15 Apr 2015 22:57:45 +0100 -Subject: [PATCH 76/89] [mmalcodec] Return mmal buffers explicitly +Subject: [PATCH 45/56] [mmalcodec] Return mmal buffers explicitly --- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 29 ++++++++++++++-------- @@ -7784,7 +4260,7 @@ Subject: [PATCH 76/89] [mmalcodec] Return mmal buffers explicitly 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 237a581..486dc4b 100644 +index ea85f25..5bdf145 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -133,7 +133,6 @@ CMMALVideo::~CMMALVideo() @@ -7812,7 +4288,7 @@ index 237a581..486dc4b 100644 return true; } -@@ -705,6 +705,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -700,6 +700,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide if (!SendCodecConfigData()) return false; @@ -7820,7 +4296,7 @@ index 237a581..486dc4b 100644 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) +@@ -742,8 +743,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) MMAL_BUFFER_HEADER_T *buffer; MMAL_STATUS_T status; @@ -7829,7 +4305,7 @@ index 237a581..486dc4b 100644 // 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) +@@ -770,9 +769,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) while (1) { @@ -7839,7 +4315,7 @@ index 237a581..486dc4b 100644 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) +@@ -864,8 +860,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) demuxer_content = NULL; continue; } @@ -7848,7 +4324,7 @@ index 237a581..486dc4b 100644 } } if (!demuxer_bytes) -@@ -909,6 +903,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -904,6 +898,13 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) return ret; } @@ -7862,7 +4338,7 @@ index 237a581..486dc4b 100644 void CMMALVideo::Reset(void) { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -954,8 +955,10 @@ void CMMALVideo::Reset(void) +@@ -949,8 +950,10 @@ void CMMALVideo::Reset(void) pthread_mutex_unlock(&m_output_mutex); if (!m_finished) @@ -7874,7 +4350,7 @@ index 237a581..486dc4b 100644 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) +@@ -970,6 +973,12 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) if (g_advancedSettings.CanLogComponent(LOGVIDEO)) CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, buffer); @@ -7900,10 +4376,10 @@ index 415f3e3..011ae04 100644 // Video format int m_decoded_width; -From 444b6fc43e09650a22ac1ef9d6fe4c62fffaff19 Mon Sep 17 00:00:00 2001 +From 990f8994f15059962b6470b9ebf6469a3698b25b 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 +Subject: [PATCH 46/56] [mmalcodec] Handle resolution change from callback --- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 26 +++++----------------- @@ -7911,7 +4387,7 @@ Subject: [PATCH 77/89] [mmalcodec] Handle resolution change from callback 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 +index 5bdf145..f20eac7 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) @@ -7976,7 +4452,7 @@ index 486dc4b..39d6e60 100644 mmal_format_copy(m_dec_output->format, m_es_format); status = mmal_port_format_commit(m_dec_output); if (status != MMAL_SUCCESS) -@@ -832,17 +829,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -827,17 +824,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); @@ -8016,57 +4492,23 @@ index 011ae04..fcc6a15 100644 protected: void QueryCodec(void); - -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 1bc141b43b3995999f59422f2fb525c794c11b29 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 +Subject: [PATCH 47/56] [mmal] Enable zero copy +This is a bit subtle, but the reference counting of pictures is only shared +between arm side and gpu side when in zero copy mode. --- 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 +index c30de9c..cfceb78 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp +++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -133,6 +133,12 @@ bool CMMALRenderer::init_vout(ERenderFormat format) +@@ -132,6 +132,12 @@ bool CMMALRenderer::init_vout(ERenderFormat format) es_format->es->video.color_space = MMAL_COLOR_SPACE_SMPTE240M; } @@ -8080,7 +4522,7 @@ index 998d3d5..3eb4060 100644 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 +index f20eac7..443e023 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() @@ -8107,7 +4549,7 @@ index 39d6e60..1ab5254 100644 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 +@@ -656,6 +666,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); @@ -8118,7 +4560,7 @@ index 39d6e60..1ab5254 100644 status = mmal_port_format_commit(m_dec_output); if (status != MMAL_SUCCESS) { -@@ -685,14 +699,14 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -680,14 +694,14 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide return false; } @@ -8136,10 +4578,10 @@ index 39d6e60..1ab5254 100644 { 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 4deb049fc48343d69f5f736967cb922800baf439 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 16 Apr 2015 19:09:31 +0100 -Subject: [PATCH 83/89] flags debug +Subject: [PATCH 48/56] [mmalcodec] flags debug --- xbmc/cores/VideoRenderers/MMALRenderer.cpp | 11 ++++++----- @@ -8147,10 +4589,10 @@ Subject: [PATCH 83/89] flags debug 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 +index cfceb78..4b09b1f 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 * +@@ -48,12 +48,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; @@ -8166,7 +4608,7 @@ index 3eb4060..fa65c2b 100644 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) +@@ -376,7 +377,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) if (omvb) { #if defined(MMAL_DEBUG_VERBOSE) @@ -8175,14 +4617,14 @@ index 3eb4060..fa65c2b 100644 #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) +@@ -390,14 +391,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) { ++ CLog::Log(LOGDEBUG, "%s::%s - %p %d f:%x", CLASSNAME, __func__, buffer->mmal_buffer, source, buffer->mmal_buffer->flags); // we only want to upload frames once if (buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) return; @@ -8193,7 +4635,7 @@ index 3eb4060..fa65c2b 100644 } else diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 1ab5254..61cf8e2 100644 +index 443e023..6c6e05e 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -83,6 +83,7 @@ long CMMALVideoBuffer::Release() @@ -8213,20 +4655,20 @@ index 1ab5254..61cf8e2 100644 { if (buffer->length > 0) -From 1757168ee2f38cb7e56b27f9d8a4a8f180ed68b1 Mon Sep 17 00:00:00 2001 +From 768fa749d337b9016a5b7b561c77701b4008998d 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 +Subject: [PATCH 49/56] [mmal] Move the image pool from decoder to renderer --- xbmc/cores/VideoRenderers/BaseRenderer.h | 5 ++ - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 77 ++++++++++++++++++---- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 78 ++++++++++++++++++---- 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(-) + 7 files changed, 92 insertions(+), 40 deletions(-) diff --git a/xbmc/cores/VideoRenderers/BaseRenderer.h b/xbmc/cores/VideoRenderers/BaseRenderer.h index 389695a..264f0ad 100644 @@ -8245,10 +4687,10 @@ index 389695a..264f0ad 100644 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 +index 4b09b1f..5a65572 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp +++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -40,6 +40,50 @@ +@@ -39,6 +39,50 @@ #define MMAL_DEBUG_VERBOSE #endif @@ -8299,7 +4741,7 @@ index fa65c2b..5fbe2d2 100644 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) +@@ -163,14 +207,11 @@ bool CMMALRenderer::init_vout(ERenderFormat format) return false; } @@ -8318,7 +4760,7 @@ index fa65c2b..5fbe2d2 100644 } return true; } -@@ -179,10 +220,17 @@ bool CMMALRenderer::init_vout(ERenderFormat format) +@@ -178,10 +219,17 @@ bool CMMALRenderer::init_vout(ERenderFormat format) void CMMALRenderer::Process() { MMAL_BUFFER_HEADER_T *buffer; @@ -8339,7 +4781,15 @@ index fa65c2b..5fbe2d2 100644 } m_sync.Set(); } -@@ -382,7 +430,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) +@@ -198,6 +246,7 @@ CMMALRenderer::CMMALRenderer() + m_release_queue = mmal_queue_create(); + m_iFlags = 0; + m_format = RENDER_FMT_NONE; ++ m_mmal_video = NULL; + m_iYV12RenderBuffer = 0; + Create(); + } +@@ -381,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) @@ -8348,8 +4798,8 @@ index fa65c2b..5fbe2d2 100644 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) - { +@@ -396,7 +445,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + CLog::Log(LOGDEBUG, "%s::%s - %p %d f:%x", CLASSNAME, __func__, buffer->mmal_buffer, source, buffer->mmal_buffer->flags); // we only want to upload frames once if (buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_USER1) - return; @@ -8357,7 +4807,7 @@ index fa65c2b..5fbe2d2 100644 // 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) +@@ -405,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); @@ -8366,7 +4816,7 @@ index fa65c2b..5fbe2d2 100644 } void CMMALRenderer::FlipPage(int source) -@@ -467,6 +517,8 @@ void CMMALRenderer::UnInitMMAL() +@@ -466,6 +517,8 @@ void CMMALRenderer::UnInitMMAL() m_vout_input = NULL; } @@ -8375,7 +4825,7 @@ index fa65c2b..5fbe2d2 100644 if (m_vout_input_pool) { mmal_pool_destroy(m_vout_input_pool); -@@ -478,7 +530,6 @@ void CMMALRenderer::UnInitMMAL() +@@ -477,7 +530,6 @@ void CMMALRenderer::UnInitMMAL() mmal_component_release(m_vout); m_vout = NULL; } @@ -8415,10 +4865,10 @@ index 17b189e..f515d7a 100644 + void Prime(); }; diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index 25d3809..89faa65 100644 +index 6de299e..dfd1072 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -949,6 +949,14 @@ unsigned int CXBMCRenderManager::GetOptimalBufferSize() +@@ -948,6 +948,14 @@ unsigned int CXBMCRenderManager::GetOptimalBufferSize() return m_pRenderer->GetMaxBufferSize(); } @@ -8434,7 +4884,7 @@ index 25d3809..89faa65 100644 std::vector CXBMCRenderManager::SupportedFormats() { diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h -index f32f4a9..1d8fe88 100644 +index 4e553cb..606cbbd 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.h +++ b/xbmc/cores/VideoRenderers/RenderManager.h @@ -195,6 +195,11 @@ class CXBMCRenderManager @@ -8450,7 +4900,7 @@ index f32f4a9..1d8fe88 100644 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 +index 6c6e05e..3fcd79b 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -111,7 +111,6 @@ CMMALVideo::CMMALVideo() @@ -8490,7 +4940,7 @@ index 61cf8e2..1fdc44c 100644 return true; } -@@ -708,21 +703,14 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -703,17 +698,9 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide return false; } @@ -8508,12 +4958,7 @@ index 61cf8e2..1fdc44c 100644 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() +@@ -725,6 +712,7 @@ void CMMALVideo::Dispose() { // we are happy to exit, but let last shared pointer being deleted trigger the destructor bool done = false; @@ -8521,7 +4966,15 @@ index 61cf8e2..1fdc44c 100644 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) +@@ -747,6 +735,7 @@ void CMMALVideo::SetDropState(bool bDrop) + + int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + { ++ g_renderManager.PassCookie(this); + //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); +@@ -900,13 +889,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) return ret; } @@ -8535,7 +4988,7 @@ index 61cf8e2..1fdc44c 100644 void CMMALVideo::Reset(void) { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -957,10 +939,8 @@ void CMMALVideo::Reset(void) +@@ -952,10 +934,8 @@ void CMMALVideo::Reset(void) pthread_mutex_unlock(&m_output_mutex); if (!m_finished) @@ -8568,10 +5021,11 @@ index fcc6a15..204f004 100644 MMAL_ES_FORMAT_T *m_es_format; MMAL_COMPONENT_T *m_deint; -From 77dd3b8de1d73d01867d190bbcd4a82e67179c44 Mon Sep 17 00:00:00 2001 +From 14e949b4786aec964686e1b14af0db1175f64bab 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 +Subject: [PATCH 50/56] [mmalrenderer] Separate mmal and renderer configured + flags --- xbmc/cores/VideoRenderers/MMALRenderer.cpp | 26 +++++++++++++++----------- @@ -8579,10 +5033,10 @@ Subject: [PATCH 85/89] Separate mmal and renderer configured flags 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 +index 5a65572..05ccbac 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp +++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -74,13 +74,12 @@ void *CMMALRenderer::PassCookie(void *cookie) +@@ -73,13 +73,12 @@ void *CMMALRenderer::PassCookie(void *cookie) CLog::Log(LOGDEBUG, "%s::%s cookie:%p", CLASSNAME, __func__, cookie); #endif @@ -8601,7 +5055,7 @@ index 5fbe2d2..fe3dce4 100644 return NULL; } -@@ -122,10 +121,10 @@ bool CMMALRenderer::init_vout(ERenderFormat format) +@@ -121,10 +120,10 @@ bool CMMALRenderer::init_vout(ERenderFormat format) CLog::Log(LOGDEBUG, "%s::%s configured:%d format:%d->%d", CLASSNAME, __func__, m_bConfigured, m_format, format); @@ -8615,9 +5069,9 @@ index 5fbe2d2..fe3dce4 100644 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_mmal_video = NULL; + m_bConfigured = false; + m_bMMALConfigured = false; m_iYV12RenderBuffer = 0; @@ -8666,11 +5120,11 @@ index f515d7a..a694182 100644 unsigned int m_destWidth; unsigned int m_destHeight; -From abe0fca00a2e5b063ff45037f543429f4c87305c Mon Sep 17 00:00:00 2001 +From 74db1bf9cffab54f174c5eddd63154228bab959f 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 +Subject: [PATCH 51/56] [mmal] Separate the buffers from the decoder so decoder + can be destroyed first --- .../DVDCodecs/Video/DVDVideoCodecMMAL.cpp | 4 +- @@ -8712,7 +5166,7 @@ index aa8e87f..6014363 100644 #endif diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 1fdc44c..7a45c25 100644 +index 3fcd79b..6110c32 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -81,7 +81,8 @@ long CMMALVideoBuffer::Release() @@ -8758,7 +5212,7 @@ index 1fdc44c..7a45c25 100644 m_decoded_width = hints.width; m_decoded_height = hints.height; -@@ -716,21 +714,9 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide +@@ -710,21 +708,9 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVide void CMMALVideo::Dispose() { @@ -8780,9 +5234,9 @@ index 1fdc44c..7a45c25 100644 } 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) +@@ -737,8 +723,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { + g_renderManager.PassCookie(this); //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); @@ -8791,7 +5245,7 @@ index 1fdc44c..7a45c25 100644 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) +@@ -814,8 +800,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)) @@ -8802,7 +5256,7 @@ index 1fdc44c..7a45c25 100644 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) +@@ -882,8 +868,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) if (!ret) { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8813,7 +5267,7 @@ index 1fdc44c..7a45c25 100644 Sleep(10); // otherwise we busy spin } return ret; -@@ -927,7 +913,10 @@ void CMMALVideo::Reset(void) +@@ -922,7 +908,10 @@ void CMMALVideo::Reset(void) } pthread_mutex_unlock(&m_output_mutex); if (buffer) @@ -8825,7 +5279,7 @@ index 1fdc44c..7a45c25 100644 else break; } -@@ -970,8 +959,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) +@@ -965,8 +954,8 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) mmal_buffer_header_reset(buffer); buffer->cmd = 0; if (g_advancedSettings.CanLogComponent(LOGVIDEO)) @@ -8836,7 +5290,7 @@ index 1fdc44c..7a45c25 100644 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) +@@ -975,28 +964,6 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) } } @@ -8910,26 +5364,27 @@ index 204f004..ab6e958 100644 // initialize mmal and get decoder component -From d93944688cae601453f2439169cf9a5834196177 Mon Sep 17 00:00:00 2001 +From 8cf59f193e56c3e7eba46e729490f326b08659d1 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 +Subject: [PATCH 52/56] [mmalcodec] 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.cpp | 3 +- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 4 +- xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in | 1 - - 5 files changed, 4 insertions(+), 168 deletions(-) + 6 files changed, 6 insertions(+), 169 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 +index b77a168..4633c18 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -@@ -39,7 +39,7 @@ +@@ -40,7 +40,7 @@ #if defined(HAS_IMXVPU) #include "Video/DVDVideoCodecIMX.h" #endif @@ -9122,6 +5577,20 @@ index 6014363..0000000 -}; - -#endif +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 6110c32..1bf1940 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -129,7 +129,8 @@ CMMALVideo::~CMMALVideo() + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); +- assert(m_finished); ++ if (!m_finished) ++ Dispose(); + + pthread_mutex_destroy(&m_output_mutex); + 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 @@ -9157,18 +5626,18 @@ index 6f5d3e8..56ec6a3 100644 LIB=Video.a -From 6b1c7ca35ed7a890db47cf528a4a5ebbd468b852 Mon Sep 17 00:00:00 2001 +From 2ced0d8763938f359bd7920b037d7e969a3a06ed 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 +Subject: [PATCH 53/56] [mmalcodec] Add shared lock around MMAL operations --- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 17 +++++++++++++++++ + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 16 ++++++++++++++++ xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 + - 2 files changed, 18 insertions(+) + 2 files changed, 17 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 7a45c25..2a6eb78 100644 +index 1bf1940..09d15fe88 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -127,6 +127,7 @@ CMMALVideo::CMMALVideo() @@ -9178,8 +5647,8 @@ index 7a45c25..2a6eb78 100644 + 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() + if (!m_finished) +@@ -175,6 +176,7 @@ CMMALVideo::~CMMALVideo() void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) { @@ -9187,7 +5656,7 @@ index 7a45c25..2a6eb78 100644 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 +@@ -289,6 +291,7 @@ static void dec_output_port_cb_static(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *b bool CMMALVideo::change_dec_output_format() { @@ -9195,7 +5664,7 @@ index 7a45c25..2a6eb78 100644 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() +@@ -325,6 +328,7 @@ bool CMMALVideo::change_dec_output_format() bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) { @@ -9203,7 +5672,7 @@ index 7a45c25..2a6eb78 100644 MMAL_STATUS_T status; if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -421,6 +425,7 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) +@@ -422,6 +426,7 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) bool CMMALVideo::DestroyDeinterlace() { @@ -9211,7 +5680,7 @@ index 7a45c25..2a6eb78 100644 MMAL_STATUS_T status; if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -477,6 +482,7 @@ bool CMMALVideo::DestroyDeinterlace() +@@ -478,6 +483,7 @@ bool CMMALVideo::DestroyDeinterlace() bool CMMALVideo::SendCodecConfigData() { @@ -9219,7 +5688,7 @@ index 7a45c25..2a6eb78 100644 MMAL_STATUS_T status; if (!m_dec_input_pool) return true; -@@ -506,6 +512,7 @@ bool CMMALVideo::SendCodecConfigData() +@@ -507,6 +513,7 @@ bool CMMALVideo::SendCodecConfigData() bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) { @@ -9227,15 +5696,7 @@ index 7a45c25..2a6eb78 100644 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) +@@ -710,6 +717,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) void CMMALVideo::Dispose() { g_renderManager.PassCookie(NULL); @@ -9243,15 +5704,15 @@ index 7a45c25..2a6eb78 100644 m_finished = true; Reset(); } -@@ -727,6 +736,7 @@ void CMMALVideo::SetDropState(bool bDrop) - +@@ -723,6 +731,7 @@ void CMMALVideo::SetDropState(bool bDrop) int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { + g_renderManager.PassCookie(this); + 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) +@@ -871,6 +880,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); @@ -9259,7 +5720,7 @@ index 7a45c25..2a6eb78 100644 Sleep(10); // otherwise we busy spin } return ret; -@@ -882,6 +893,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) +@@ -878,6 +888,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) void CMMALVideo::Reset(void) { @@ -9267,7 +5728,7 @@ index 7a45c25..2a6eb78 100644 if (g_advancedSettings.CanLogComponent(LOGVIDEO)) CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); -@@ -946,6 +958,7 @@ void CMMALVideo::SetSpeed(int iSpeed) +@@ -942,6 +953,7 @@ void CMMALVideo::SetSpeed(int iSpeed) void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) { @@ -9275,7 +5736,7 @@ index 7a45c25..2a6eb78 100644 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) +@@ -967,6 +979,7 @@ void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) { @@ -9283,7 +5744,7 @@ index 7a45c25..2a6eb78 100644 if (!m_output_ready.empty()) { CMMALVideoBuffer *buffer; -@@ -1030,6 +1044,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) +@@ -1026,6 +1039,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) { @@ -9291,7 +5752,7 @@ index 7a45c25..2a6eb78 100644 if (pDvdVideoPicture->format == RENDER_FMT_MMAL) { if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -1042,12 +1057,14 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) +@@ -1038,12 +1052,14 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) { @@ -9319,21 +5780,21 @@ index 3e444f7..e686b4b 100644 MMAL_PORT_T *m_dec_input; MMAL_PORT_T *m_dec_output; -From ec9d208ad8e921eb4479279154fe4b477d1f9c71 Mon Sep 17 00:00:00 2001 +From d693f1d572b85e7c2e0c230bd518d0e3c094d938 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 +Subject: [PATCH 54/56] [mmalrenderer] Add shared lock around MMAL operations --- - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 13 +++++++++++++ + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 11 ++++++++++- xbmc/cores/VideoRenderers/MMALRenderer.h | 1 + - 2 files changed, 14 insertions(+) + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index fe3dce4..7ebc2c9 100644 +index 05ccbac..270036d 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp +++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -44,6 +44,7 @@ +@@ -43,6 +43,7 @@ void CMMALRenderer::Prime() { @@ -9341,7 +5802,7 @@ index fe3dce4..7ebc2c9 100644 #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() +@@ -68,6 +69,7 @@ void CMMALRenderer::Prime() void *CMMALRenderer::PassCookie(void *cookie) { @@ -9349,15 +5810,7 @@ index fe3dce4..7ebc2c9 100644 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 +@@ -115,6 +117,7 @@ static void vout_input_port_cb_static(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *b bool CMMALRenderer::init_vout(ERenderFormat format) { @@ -9365,7 +5818,7 @@ index fe3dce4..7ebc2c9 100644 bool formatChanged = m_format != format; MMAL_STATUS_T status; -@@ -254,6 +258,7 @@ CMMALRenderer::CMMALRenderer() +@@ -254,6 +257,7 @@ CMMALRenderer::CMMALRenderer() CMMALRenderer::~CMMALRenderer() { @@ -9373,7 +5826,7 @@ index fe3dce4..7ebc2c9 100644 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) +@@ -276,6 +280,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) { @@ -9381,15 +5834,15 @@ index fe3dce4..7ebc2c9 100644 ReleaseBuffers(); m_sourceWidth = width; -@@ -306,6 +312,7 @@ bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned +@@ -363,7 +368,6 @@ int CMMALRenderer::GetImage(YV12Image *image, int source, bool readonly) - int CMMALRenderer::GetImage(YV12Image *image, int source, bool readonly) + void CMMALRenderer::ReleaseBuffer(int idx) { -+ 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() +- CSingleLock lock(m_sharedSection); + if (!m_bMMALConfigured || m_format == RENDER_FMT_BYPASS) + return; + +@@ -403,6 +407,7 @@ void CMMALRenderer::Update() void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) { @@ -9397,7 +5850,7 @@ index fe3dce4..7ebc2c9 100644 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) +@@ -463,6 +468,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) void CMMALRenderer::FlipPage(int source) { @@ -9405,7 +5858,7 @@ index fe3dce4..7ebc2c9 100644 if (!m_bConfigured || m_format == RENDER_FMT_BYPASS) return; -@@ -475,6 +484,7 @@ void CMMALRenderer::FlipPage(int source) +@@ -475,6 +481,7 @@ void CMMALRenderer::FlipPage(int source) unsigned int CMMALRenderer::PreInit() { @@ -9413,14 +5866,7 @@ index fe3dce4..7ebc2c9 100644 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: Sun, 19 Apr 2015 16:17:25 +0100 +Subject: [PATCH 55/56] [mmalcodec] Fix initialisation of m_format in init_vout + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 270036d..e73feed 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -129,7 +129,7 @@ bool CMMALRenderer::init_vout(ERenderFormat format) + if (m_bMMALConfigured) + return true; + +- m_format = RENDER_FMT_MMAL; ++ m_format = format; + if (m_format != RENDER_FMT_MMAL && m_format != RENDER_FMT_YUV420P) + return true; + +@@ -550,6 +550,7 @@ void CMMALRenderer::UnInitMMAL() + m_video_stereo_mode = RENDER_STEREO_MODE_OFF; + m_display_stereo_mode = RENDER_STEREO_MODE_OFF; + m_StereoInvert = false; ++ m_format = RENDER_FMT_NONE; + + m_bConfigured = false; + m_bMMALConfigured = false; + +From 055a522a3a5298ad53f3d0bad491d43d7f562ac8 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 21 Apr 2015 14:32:07 +0100 +Subject: [PATCH 56/56] [mmalrenderer] Add sharpness control + +--- + addons/resource.language.en_gb/resources/strings.po | 2 +- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 13 ++++++++++++- + xbmc/cores/VideoRenderers/MMALRenderer.h | 1 + + 3 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po +index fa25d45..94679d8 100644 +--- a/addons/resource.language.en_gb/resources/strings.po ++++ b/addons/resource.language.en_gb/resources/strings.po +@@ -7492,7 +7492,7 @@ msgstr "" + + #: xbmc/video/dialogs/GUIDialogVideoSettings.cpp + msgctxt "#16313" +-msgid "(VDPAU)Sharpness" ++msgid "Sharpness" + msgstr "" + + #: xbmc/video/dialogs/GUIDialogVideoSettings.cpp +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index e73feed..30e62b9 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -252,6 +252,7 @@ CMMALRenderer::CMMALRenderer() + m_bConfigured = false; + m_bMMALConfigured = false; + m_iYV12RenderBuffer = 0; ++ m_sharpness = -2.0f; + Create(); + } + +@@ -422,6 +423,15 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + if (m_RenderUpdateCallBackFn) + (*m_RenderUpdateCallBackFn)(m_RenderUpdateCallBackCtx, m_sourceRect, m_destRect); + ++ // if sharpness setting has changed, we should update it ++ if (m_sharpness != CMediaSettings::Get().GetCurrentVideoSettings().m_Sharpness) ++ { ++ m_sharpness = CMediaSettings::Get().GetCurrentVideoSettings().m_Sharpness; ++ char command[80], response[80]; ++ sprintf(command, "scaling_sharpness %d", ((int)(50.0f * (m_sharpness + 1.0f) + 0.5f))); ++ vc_gencmd(response, sizeof response, command); ++ } ++ + if (m_format == RENDER_FMT_BYPASS) + return; + +@@ -610,7 +620,8 @@ bool CMMALRenderer::Supports(ERENDERFEATURE feature) + feature == RENDERFEATURE_ZOOM || + feature == RENDERFEATURE_ROTATION || + feature == RENDERFEATURE_VERTICAL_SHIFT || +- feature == RENDERFEATURE_PIXEL_RATIO) ++ feature == RENDERFEATURE_PIXEL_RATIO || ++ feature == RENDERFEATURE_SHARPNESS) + return true; + + return false; +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h +index 6474c1b..8a22454 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.h ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.h +@@ -111,6 +111,7 @@ class CMMALRenderer : public CBaseRenderer, public CThread + RENDER_STEREO_MODE m_video_stereo_mode; + RENDER_STEREO_MODE m_display_stereo_mode; + bool m_StereoInvert; ++ float m_sharpness; + + CCriticalSection m_sharedSection; + MMAL_COMPONENT_T *m_vout;