diff --git a/projects/RPi/patches/kodi/kodi-001-newclock4.patch b/projects/RPi/patches/kodi/kodi-001-helix_rpb_backports.patch similarity index 53% rename from projects/RPi/patches/kodi/kodi-001-newclock4.patch rename to projects/RPi/patches/kodi/kodi-001-helix_rpb_backports.patch index b926413a75..d71c6f84b3 100644 --- a/projects/RPi/patches/kodi/kodi-001-newclock4.patch +++ b/projects/RPi/patches/kodi/kodi-001-helix_rpb_backports.patch @@ -1,7 +1,7 @@ -From 59eaf2f7a4dffe27c05e71e2b40508eb24047afb Mon Sep 17 00:00:00 2001 +From 5ee6b15d33f18bf55553eaa5c8172e19c8698532 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 001/102] [rbp/omxplayer] When opening a stream don't try to +Subject: [PATCH 01/57] [rbp/omxplayer] When opening a stream don't try to update gui so often --- @@ -25,10 +25,10 @@ index e7cfcdd..20b99ad 100644 g_windowManager.ProcessRenderLoop(false); if (allowCancel && dialog->IsCanceled()) -From 6c6e92d2fd71f335dd92a8c58b73fa32b56eaa3b Mon Sep 17 00:00:00 2001 +From ed47072d3af200f0cceb6c794a0f1b324b914c78 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 29 Apr 2014 15:23:22 +0100 -Subject: [PATCH 002/102] [ffmpeg] Speed up wtv index creation +Subject: [PATCH 02/57] [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,10 +114,10 @@ index 0000000..4ac5636 + } + } -From 8ff91085bd5fde57e829ff33e09b7c97d1911b2f Mon Sep 17 00:00:00 2001 +From eadb7d6e3cb163c66729411d04ce1eafe8bf2b6f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 2 Aug 2014 17:48:04 +0100 -Subject: [PATCH 003/102] [omx] Report decoded image name +Subject: [PATCH 03/57] [omx] Report decoded image name --- xbmc/cores/omxplayer/OMXImage.cpp | 1 + @@ -136,10 +136,10 @@ index aa413b9..22ec3f0 100644 else { -From 2d6f53bd369d5efa4fe7b2b56add0b5b2b4bade8 Mon Sep 17 00:00:00 2001 +From 26ca8d23a27691f2fc373b995151060330f25257 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 004/102] [hifiberry] Hack: force it to be recognised as IEC958 +Subject: [PATCH 04/57] [hifiberry] Hack: force it to be recognised as IEC958 capable to enable passthrough options --- @@ -162,11 +162,11 @@ index d30cbab..b268819 100644 info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") { -From a188bbe966e8392aeace05a56c838db713d9862c Mon Sep 17 00:00:00 2001 +From 3fe07afc134b7e28c517b8ffa25e12a6d0bc6db3 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 11 Dec 2013 17:21:54 +0000 -Subject: [PATCH 005/102] Move the reference-counting of Begin and End calls - from DX and GL source files into GUIFontTTF.cpp. +Subject: [PATCH 05/57] Move the reference-counting of Begin and End calls from + DX and GL source files into GUIFontTTF.cpp. --- xbmc/guilib/GUIFontTTF.cpp | 21 ++++++ @@ -553,10 +553,10 @@ index c0bb53a..735fb3a 100644 protected: virtual CBaseTexture* ReallocTexture(unsigned int& newHeight); -From 7f1c111a03120b57d2a063d35c578eb85f0667f6 Mon Sep 17 00:00:00 2001 +From 3250be6689d225c6f19267d0294a93a10b4a26ca Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 11 Dec 2013 18:47:54 +0000 -Subject: [PATCH 006/102] Convert CGUIFontTTFBase::m_vertex to be managed as a +Subject: [PATCH 06/57] Convert CGUIFontTTFBase::m_vertex to be managed as a std::vector. Also retired CGUIFontTTFBase::m_vertex_count and @@ -736,10 +736,10 @@ index 97853fd..b76c6a5 100644 *vertices++ = m_vertex[i]; *vertices++ = m_vertex[i+1]; -From f26008b973c46960acab0a9bdb0b1fcf23602b8a Mon Sep 17 00:00:00 2001 +From ae8a089491f4e80cd268e32d4ff9cf2ab6671940 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Mon, 16 Dec 2013 18:58:12 +0000 -Subject: [PATCH 007/102] CGUIFontTTFBase::RenderCharacter can now append to +Subject: [PATCH 07/57] CGUIFontTTFBase::RenderCharacter can now append to arbitrary vectors of vertices rather than only CGUIFontTTFBase::m_vertex --- @@ -812,10 +812,10 @@ index 5675725..a5d44f4 100644 virtual CBaseTexture* ReallocTexture(unsigned int& newHeight) = 0; -From 1c5163f7494f24abe1afcd955d22e819f7ec4141 Mon Sep 17 00:00:00 2001 +From a79af20718c8ddab86ea0f01f56cf414b656af5a Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 17:18:38 +0000 -Subject: [PATCH 008/102] Add a cache of font glyph bounding box vertices. +Subject: [PATCH 08/57] Add a cache of font glyph bounding box vertices. This is implemented as a template because ultimately we will key on different parameters and store values of different types, depending upon whether we @@ -838,7 +838,7 @@ applicable transformation matrices permit the use of hardware clipping. create mode 100644 xbmc/guilib/GUIFontCache.h diff --git a/Kodi.xcodeproj/project.pbxproj b/Kodi.xcodeproj/project.pbxproj -index 6dd3cf2..1f04a0b 100644 +index 5a81f22..debdf4e 100644 --- a/Kodi.xcodeproj/project.pbxproj +++ b/Kodi.xcodeproj/project.pbxproj @@ -168,6 +168,9 @@ @@ -851,7 +851,7 @@ index 6dd3cf2..1f04a0b 100644 32C631281423A90F00F18420 /* JpegIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32C631261423A90F00F18420 /* JpegIO.cpp */; }; 36A9443D15821E2800727135 /* DatabaseUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 36A9443B15821E2800727135 /* DatabaseUtils.cpp */; }; 36A9444115821E7C00727135 /* SortUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 36A9443F15821E7C00727135 /* SortUtils.cpp */; }; -@@ -4018,6 +4021,8 @@ +@@ -4021,6 +4024,8 @@ 1DAFDB7B16DFDCA7007F8C68 /* PeripheralBusCEC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeripheralBusCEC.h; sourceTree = ""; }; 1DE0443315828F4B005DDB4D /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Exception.cpp; path = commons/Exception.cpp; sourceTree = ""; }; 1DE0443415828F4B005DDB4D /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Exception.h; path = commons/Exception.h; sourceTree = ""; }; @@ -860,7 +860,7 @@ index 6dd3cf2..1f04a0b 100644 32C631261423A90F00F18420 /* JpegIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JpegIO.cpp; sourceTree = ""; }; 32C631271423A90F00F18420 /* JpegIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JpegIO.h; sourceTree = ""; }; 36A9443B15821E2800727135 /* DatabaseUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseUtils.cpp; sourceTree = ""; }; -@@ -6532,6 +6537,8 @@ +@@ -6537,6 +6542,8 @@ 18B7C7101294222D009E7A26 /* GUIFixedListContainer.h */, 18B7C76B1294222E009E7A26 /* GUIFont.cpp */, 18B7C7111294222D009E7A26 /* GUIFont.h */, @@ -869,7 +869,7 @@ index 6dd3cf2..1f04a0b 100644 18B7C76C1294222E009E7A26 /* GUIFontManager.cpp */, 18B7C7121294222D009E7A26 /* GUIFontManager.h */, 18B7C76D1294222E009E7A26 /* GUIFontTTF.cpp */, -@@ -11038,6 +11045,7 @@ +@@ -11045,6 +11052,7 @@ 7C5608C70F1754930056433A /* ExternalPlayer.cpp in Sources */, F584E12E0F257C5100DB26A5 /* HTTPDirectory.cpp in Sources */, F54C51D20F1E783200D46E3C /* GUIDialogKaraokeSongSelector.cpp in Sources */, @@ -877,7 +877,7 @@ index 6dd3cf2..1f04a0b 100644 F54C51D50F1E784800D46E3C /* karaokelyricscdg.cpp in Sources */, F54C51D80F1E785700D46E3C /* karaokelyrics.cpp in Sources */, F54C51E50F1E787700D46E3C /* karaokelyricstextkar.cpp in Sources */, -@@ -12712,6 +12720,7 @@ +@@ -12721,6 +12729,7 @@ DFF0F45B17528350002DA3A4 /* Control.cpp in Sources */, DFF0F45C17528350002DA3A4 /* Dialog.cpp in Sources */, DFF0F45D17528350002DA3A4 /* File.cpp in Sources */, @@ -885,7 +885,7 @@ index 6dd3cf2..1f04a0b 100644 DFF0F45E17528350002DA3A4 /* InfoTagMusic.cpp in Sources */, DFF0F45F17528350002DA3A4 /* InfoTagVideo.cpp in Sources */, DFF0F46017528350002DA3A4 /* Keyboard.cpp in Sources */, -@@ -13507,6 +13516,7 @@ +@@ -13517,6 +13526,7 @@ E499131D174E5DAD00741B6D /* GUIVisualisationControl.cpp in Sources */, E499131E174E5DAD00741B6D /* GUIWindow.cpp in Sources */, E499131F174E5DAD00741B6D /* GUIWindowManager.cpp in Sources */, @@ -894,10 +894,10 @@ index 6dd3cf2..1f04a0b 100644 E4991321174E5DAD00741B6D /* imagefactory.cpp in Sources */, E4991322174E5DAD00741B6D /* IWindowManagerCallback.cpp in Sources */, diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj -index aca7b82..2b50d41 100644 +index ce1b60a..d1a3703 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj -@@ -426,6 +426,7 @@ +@@ -427,6 +427,7 @@ @@ -905,7 +905,7 @@ index aca7b82..2b50d41 100644 -@@ -1751,6 +1752,7 @@ +@@ -1753,6 +1754,7 @@ @@ -914,7 +914,7 @@ index aca7b82..2b50d41 100644 diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters -index 7603447..aa45adc 100644 +index b570d6b..499060565 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -994,6 +994,9 @@ @@ -927,7 +927,7 @@ index 7603447..aa45adc 100644 guilib -@@ -3894,6 +3897,9 @@ +@@ -3897,6 +3900,9 @@ guilib @@ -1575,10 +1575,10 @@ index f351c99..9036ba9 100644 + return !operator==(a, b); +} -From c7346c9d17417c70de8af1a3ff214f7cd3237a82 Mon Sep 17 00:00:00 2001 +From bad2c134fa8631cb612b55eabb708fd62b85b894 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 23 Jan 2014 22:24:17 +0000 -Subject: [PATCH 009/102] Lay the groundwork for hardware clipping. +Subject: [PATCH 09/57] Lay the groundwork for hardware clipping. For glScissor() to replace CGraphicContext::ClipRect, a necessary condition is that no shear or rotation is introduced between the coordinate systems @@ -1840,10 +1840,10 @@ index 98e398a..81ee49e 100644 virtual void ResetScissors(); -From 803f51880911771af5a2f6bf28630fcc62c09816 Mon Sep 17 00:00:00 2001 +From de242916d7bbd24532ca6319ec7e0343e27d3254 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 23 Jan 2014 16:42:22 +0000 -Subject: [PATCH 010/102] Increase font cache hit rate by keying on the +Subject: [PATCH 10/57] Increase font cache hit rate by keying on the fractional part of m_originX and m_originY *after* they have been through the graphics context's transformation matrix, plus the scale/rotation elements of the matrix, rather than the origin in the original frame of reference plus @@ -2044,10 +2044,10 @@ index 3b93672..258dffa 100644 private: virtual bool FirstBegin() = 0; -From 05049b298562fb7a6f48fbb8b7d4b4c6a568b3d9 Mon Sep 17 00:00:00 2001 +From 149e41979652bed87771d56750fc94b42224899d Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 8 Jan 2014 12:16:33 +0000 -Subject: [PATCH 011/102] Rewrite of scrolling text code. +Subject: [PATCH 11/57] Rewrite of scrolling text code. No longer shuffles the string round to minimise the number of characters before the clipping rectangle; this doesn't save much on rendering time but @@ -2363,10 +2363,10 @@ index 2cda726..fbc579e 100644 private: void Process(); -From a6ec97a53d2c6b57d7629b0804ac91a9d79231ce Mon Sep 17 00:00:00 2001 +From e8c2c6a32e7cef19e9f4656ddd05da678f541be9 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Mon, 27 Jan 2014 23:21:10 +0000 -Subject: [PATCH 012/102] Move the application of the translation offsets into +Subject: [PATCH 12/57] Move the application of the translation offsets into the GLES code. Still all pure software at this stage. Main change is in the data types at @@ -2560,10 +2560,10 @@ index 9935ea4..18c9358 100644 memset(newTexture->GetPixels(), 0, m_textureHeight * newTexture->GetPitch()); if (m_texture) -From 092d63f77b6a4259871cf0cd49e2242952f1d8bd Mon Sep 17 00:00:00 2001 +From 1d59b24d980fa36c28fc929942b2331765feb124 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 15:28:06 +0000 -Subject: [PATCH 013/102] Rather than applying the translation offsets to the +Subject: [PATCH 13/57] Rather than applying the translation offsets to the vertices, now applies them to the model view matrix from the top of the matrix stack and pushes it over to OpenGL. The vertices themselves are still all held client-side. @@ -2707,10 +2707,10 @@ index 81ee49e..d2f9cd1 100644 protected: virtual void SetVSyncImpl(bool enable) = 0; -From 42c1c659035186f940af17b3558f16c44e71d500 Mon Sep 17 00:00:00 2001 +From f779e77ce635b20661d8fe3cf05c8add30c4640f Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 29 Jan 2014 13:21:19 +0000 -Subject: [PATCH 014/102] Enable hardware clipping. +Subject: [PATCH 14/57] Enable hardware clipping. --- xbmc/guilib/GUIFontTTF.cpp | 4 ++-- @@ -2782,10 +2782,10 @@ index ea08bf4..b63e337 100644 glUniformMatrix4fv(modelLoc, 1, GL_FALSE, g_matrices.GetMatrix(MM_MODELVIEW)); } -From 876aa1335868b8101ec340188c881eab11d1e1b9 Mon Sep 17 00:00:00 2001 +From ab655b1a0e7088ecec0657da78af752c32bac4dc Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 15:32:51 +0000 -Subject: [PATCH 015/102] Move the vertex data across to a vertex buffer object +Subject: [PATCH 15/57] Move the vertex data across to a vertex buffer object just prior to drawing. --- @@ -2836,11 +2836,11 @@ index b63e337..b00055d 100644 // Disable the attributes used by this shader -From 4b1bd2db78d5c421251550f061c6e5a8fbd4a819 Mon Sep 17 00:00:00 2001 +From fbd317abfc7d3c7a143715e893317795283110b1 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 16:04:04 +0000 -Subject: [PATCH 016/102] Move vertex data into an OpenGL VBO when the font - cache entry is populated. +Subject: [PATCH 16/57] Move vertex data into an OpenGL VBO when the font cache + entry is populated. The font cache now stores the "name" (handle) of the VBO, rather than a vector of vertices. @@ -3112,10 +3112,10 @@ index 735fb3a..6102c90 100644 protected: virtual CBaseTexture* ReallocTexture(unsigned int& newHeight); -From 1ba608c8a4bea61a0f5a316507400b4a686058e9 Mon Sep 17 00:00:00 2001 +From ae2acc7dfe75dfbc3f70a2c1fd4b1dba559acdac Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 1 Nov 2014 22:15:13 +0000 -Subject: [PATCH 017/102] Switch from glDrawArrays() to glDrawElements(). +Subject: [PATCH 17/57] Switch from glDrawArrays() to glDrawElements(). This involves setting up a static VBO containing the indexes necessary to convert from quads to triangles on the fly in the GPU. @@ -3336,10 +3336,10 @@ index d2a94c9..7b6097a 100644 if (m_display != EGL_NO_DISPLAY) -From a22dce0d9b1859a413f2bf36b49467f3f4476575 Mon Sep 17 00:00:00 2001 +From 1c94dd70e9cb2d753e124fbefd50f0453db4e693 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 018/102] Improved file buffering in CArchive +Subject: [PATCH 18/57] 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 @@ -3399,10 +3399,10 @@ index 6ed0f8f..8506d95 100644 } else -From acec891318761ae00b0741e236f2922192550a2a Mon Sep 17 00:00:00 2001 +From fc6f030518851b4927fbf0d657f2f745e401b207 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 10 Sep 2014 22:07:21 +0100 -Subject: [PATCH 019/102] [mmal] Allow mmal codec for dvd stills +Subject: [PATCH 19/57] [mmal] Allow mmal codec for dvd stills --- xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 4 ++++ @@ -3424,20 +3424,20 @@ index 10648c5..bea5e4f 100644 { // If dvd is an mpeg2 and hint.stills -From 3570851100f111e42bc797a058d51aa52a921aec Mon Sep 17 00:00:00 2001 +From e8febe358b9453931e36548f58f938d2622234a1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 12 Aug 2014 00:31:36 +0100 -Subject: [PATCH 020/102] [omxcodec] Don't force software codec with dvds +Subject: [PATCH 20/57] [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 a9bab4c..26d3903 100644 +index abc407d..1238937 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -3219,7 +3219,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) +@@ -3216,7 +3216,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) hint.aspect = aspect; hint.forced_aspect = true; } @@ -3448,11 +3448,11 @@ index a9bab4c..26d3903 100644 CDVDInputStream::IMenus* pMenus = dynamic_cast(m_pInputStream); -From a002f79cec4242d9a86f1b2459d595824f45ab76 Mon Sep 17 00:00:00 2001 +From fb0e29c13896b4e95d21f3ee6cfbd922a3a3bc23 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 16 Apr 2014 21:18:06 +0100 -Subject: [PATCH 021/102] [omxplayer] Don't propagate 3d flags based on - supported 3d modes +Subject: [PATCH 21/57] [omxplayer] Don't propagate 3d flags based on supported + 3d modes --- xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 29 ++++------------------------- @@ -3504,10 +3504,10 @@ index ac838ce..605318c9 100644 unsigned int iDisplayWidth = width; unsigned int iDisplayHeight = height; -From 4a2099ed5c7e06b59fbd7c7502e65d3123d92a08 Mon Sep 17 00:00:00 2001 +From c236dfa9a1717c08775f923acfa1c1177d106018 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:00:52 +0100 -Subject: [PATCH 022/102] [graphics] Don't set stereo mode based on resolution +Subject: [PATCH 22/57] [graphics] Don't set stereo mode based on resolution The resolution change should follow stereo mode --- @@ -3565,10 +3565,10 @@ index 3cb5587..fe6ebf4 100644 m_iScreenWidth = info_mod.iWidth; -From 3f45ff4c9c0bbb3fd0352dc7928d66af0059012c Mon Sep 17 00:00:00 2001 +From c9130481ed8fc084c9cede6de706c3be16b76d04 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:01:51 +0100 -Subject: [PATCH 023/102] [graphics] Allow switching to a more suitable 3D +Subject: [PATCH 23/57] [graphics] Allow switching to a more suitable 3D resolution --- @@ -3654,10 +3654,10 @@ index 2904c1b..8d3774f 100644 void ResetOverscan(RESOLUTION_INFO &resinfo); void ResetScreenParameters(RESOLUTION res); -From a5fa290aca27933916a6f8e564791c2e86ad1829 Mon Sep 17 00:00:00 2001 +From 742fa68c9915e86c2ca0b8fa32b841e368926900 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:38:55 +0100 -Subject: [PATCH 024/102] [3D] Support switching to 3D resolutions +Subject: [PATCH 24/57] [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. @@ -3739,10 +3739,10 @@ index 83c3adb..8076e76 100644 return current; } -From 61fd4856d2004a5e13455d7191c2fc72ae3b33ee Mon Sep 17 00:00:00 2001 +From f2b9b06eb3ec55ab5bd21a64baa4d86ae99c7b39 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 23 Apr 2014 00:05:07 +0100 -Subject: [PATCH 025/102] [graphics] Make pixel ratio for 3d modes consistent +Subject: [PATCH 25/57] [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. @@ -3945,10 +3945,10 @@ index c58c28a..bf1e589 100644 AddUniqueResolution(res2, resolutions); -From f7acff66fe76bf5bbd7dcf21094391c76b81f275 Mon Sep 17 00:00:00 2001 +From 45754655e6dea0e390641e6ecd57c72b7dfbd03d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 026/102] filesystem: Make support of browsing into archives +Subject: [PATCH 26/57] 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. @@ -3964,7 +3964,7 @@ Add a settings option to enable this feature and default to disabled on Pi 4 files changed, 28 insertions(+) diff --git a/language/English/strings.po b/language/English/strings.po -index 15090fc..8e67be0 100755 +index 3b51f49..19b919d 100755 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -16115,4 +16115,13 @@ msgstr "" @@ -4047,11 +4047,11 @@ index 2fd8777..3b294cd 100644 { // XBMC Smart playlist - just XML renamed to XSP // read the name of the playlist in -From 0eafc695b274c4a0e526c7bc73ab8917bcf285ff Mon Sep 17 00:00:00 2001 +From dff0a8c1fb2073f55f2e7744314dc24e2e510760 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 13:06:57 +0000 -Subject: [PATCH 028/102] [rbp] Make cachemembuffersize default depend on - memory size +Subject: [PATCH 28/57] [rbp] Make cachemembuffersize default depend on memory + size --- xbmc/linux/RBP.cpp | 5 +++++ @@ -4089,10 +4089,10 @@ index ba1a3d0..5119949 100644 response[sizeof(response) - 1] = '\0'; CLog::Log(LOGNOTICE, "Config:\n%s", response); diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 478d725..69b7832 100644 +index e6d58b3..bc8598e 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp -@@ -365,7 +365,12 @@ void CAdvancedSettings::Initialize() +@@ -364,7 +364,12 @@ void CAdvancedSettings::Initialize() m_bPVRAutoScanIconsUserSet = false; m_iPVRNumericChannelSwitchTimeout = 1000; @@ -4107,10 +4107,10 @@ index 478d725..69b7832 100644 // as multiply of the default data read rate -From 2da066dff08185f2cf78940569328a5e65a0a494 Mon Sep 17 00:00:00 2001 +From a0c85d4edeae53a6bec328b56686c7d41d78a8ac Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 16 Jun 2014 19:06:00 +0100 -Subject: [PATCH 030/102] [experimental] Disable quiet-noise generation +Subject: [PATCH 30/57] [experimental] Disable quiet-noise generation --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp | 2 ++ @@ -4137,10 +4137,10 @@ index b391ff3..463a89c 100644 void CActiveAESink::SetSilenceTimer() -From b2affcd233124a4b00c289c77d39e1ab8788bf6c Mon Sep 17 00:00:00 2001 +From a132456841ebb1f2880bdf84e37c1758978f5697 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 031/102] [settings] Experiment: Report DESKTOP resolution in +Subject: [PATCH 31/57] [settings] Experiment: Report DESKTOP resolution in video settings --- @@ -4162,10 +4162,10 @@ index 6902f83..50c5f97 100644 StringUtils::Format("%dx%d%s", resolution->width, resolution->height, ModeFlagsToString(resolution->flags, false).c_str()), -From 5d1a93fe1d7325f35d3cb0cd43f6909a678b5950 Mon Sep 17 00:00:00 2001 +From 68c500d39d7b3fd039f4e95147ea4ad2c78c4dcd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 16 Aug 2014 21:01:42 +0100 -Subject: [PATCH 032/102] omxrender: Hacks to reduce GUI rendering rate when +Subject: [PATCH 32/57] omxrender: Hacks to reduce GUI rendering rate when playing video --- @@ -4175,7 +4175,7 @@ Subject: [PATCH 032/102] omxrender: Hacks to reduce GUI rendering rate when 3 files changed, 60 insertions(+) diff --git a/language/English/strings.po b/language/English/strings.po -index 8e67be0..8acc0e9 100755 +index 19b919d..9d19eac 100755 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -16125,3 +16125,30 @@ msgstr "" @@ -4237,7 +4237,7 @@ index f3c8a01..2996c29 100644 diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index d3f0fde..a34b970 100644 +index 9162708..b1e6c3c 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -2207,6 +2207,23 @@ void CApplication::Render() @@ -4265,11 +4265,10 @@ index d3f0fde..a34b970 100644 int vsync_mode = CSettings::Get().GetInt("videoscreen.vsync"); -From f6e3c3210a1f2fdce5c723b9134d65f90ebdd45b Mon Sep 17 00:00:00 2001 +From 09455a10833476983a3e682560946bb960db4fb1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 9 Sep 2014 12:04:26 +0100 -Subject: [PATCH 033/102] egl: Treat unknown display aspect ratio as square - pixel +Subject: [PATCH 33/57] egl: Treat unknown display aspect ratio as square pixel --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 ++-- @@ -4298,10 +4297,10 @@ index bf1e589..a25eb86 100644 SetResolutionString(m_desktopRes); -From dd03c26307bc504c59077eafdc4239b36399e1ac Mon Sep 17 00:00:00 2001 +From 14cc2270081fe22f50054323c247f06aadd29b43 Mon Sep 17 00:00:00 2001 From: anaconda Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 034/102] Disable textbox autoscrolling while on screensaver. +Subject: [PATCH 34/57] Disable textbox autoscrolling while on screensaver. SQUASH: only if dim or black --- @@ -4311,7 +4310,7 @@ SQUASH: only if dim or black 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index a34b970..8e0ab13 100644 +index b1e6c3c..3e5423f2 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -5873,3 +5873,10 @@ void CApplication::CloseNetworkShares() @@ -4362,10 +4361,10 @@ index b7ef051..e149418 100644 if (m_lastRenderTime) m_autoScrollDelayTime += currentTime - m_lastRenderTime; -From 4d48ee0af59436357c0309419af19edcb919217a Mon Sep 17 00:00:00 2001 +From c1bca494fe2e3d6730f06b4d79259b4ac47e36fa Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 18 Sep 2014 14:24:56 +0100 -Subject: [PATCH 035/102] [omxplayer] Only enable audio clock master when A/V +Subject: [PATCH 35/57] [omxplayer] Only enable audio clock master when A/V sync method is set to audio clock --- @@ -4396,10 +4395,10 @@ index 5475570..7c07b57 100644 OMX_CONFIG_BOOLEANTYPE configBool; OMX_INIT_STRUCTURE(configBool); -From 25bcd374ec4286b19ee326aa5a2afa5efcc8f891 Mon Sep 17 00:00:00 2001 +From c1623175fd74cffa173c2a293f291aa8035e10a5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 036/102] [dvdplayer/rbp] Add pi specific option to maintain +Subject: [PATCH 36/57] [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". @@ -4418,7 +4417,7 @@ Needed updated firmware 7 files changed, 77 insertions(+), 3 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po -index 8acc0e9..a3b71e8 100755 +index 9d19eac..009cda1 100755 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -16152,3 +16152,8 @@ msgstr "" @@ -4598,21 +4597,21 @@ index 4fd18f3..6456657 100644 private: DllBcmHost *m_DllBcmHost; -From 8ba92008485e1b9f817f1bc190d4431f1a9323da Mon Sep 17 00:00:00 2001 +From 229edf3ba2101e9eb24fa42436e937f0ab3504a1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 27 Sep 2014 15:32:37 +0100 -Subject: [PATCH 037/102] [dvdplayer] exerimental: don't raise priority of - audio thread +Subject: [PATCH 37/57] [dvdplayer] exerimental: don't raise priority of audio + thread --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 26d3903..ea4031e 100644 +index 1238937..a20b010 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -3204,7 +3204,11 @@ bool CDVDPlayer::OpenAudioStream(CDVDStreamInfo& hint, bool reset) +@@ -3201,7 +3201,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 */ @@ -4625,10 +4624,10 @@ index 26d3903..ea4031e 100644 } -From e68155164b3b5c19077fd9cdab0c32da580e2930 Mon Sep 17 00:00:00 2001 +From 4744f553960bec5901805e5c97cd4176cbf5ad3c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 28 Sep 2014 19:28:17 +0100 -Subject: [PATCH 038/102] [mmalcodec] Introduce a preroll period to buffer up +Subject: [PATCH 38/57] [mmalcodec] Introduce a preroll period to buffer up frames on startup --- @@ -4761,10 +4760,10 @@ index b4aa571..4f81bbd 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; -From 1501701411ba05a435b5927c91c038aabb707b3d Mon Sep 17 00:00:00 2001 +From dd7f094d2bc307b48d02b1b6649220229f00fd6a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 039/102] [audio] Add settings option to boost centre channel +Subject: [PATCH 39/57] [audio] Add settings option to boost centre channel when downmixing This allows a dB volume increase to be added to centre channel. @@ -4782,7 +4781,7 @@ Should work with Pi Sink (dvdplayer/paplayer) and omxplayer 5 files changed, 46 insertions(+) diff --git a/language/English/strings.po b/language/English/strings.po -index a3b71e8..24f9636 100755 +index 009cda1..0aadba9 100755 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -16157,3 +16157,18 @@ msgstr "" @@ -4887,10 +4886,10 @@ index 7c07b57..ef4c3d4 100644 // stereo upmix if (upmix && m_src_channels == 2 && m_dst_channels > 2) -From 6d7f91afce51b7f63e0f5e0467d63124a6805fff Mon Sep 17 00:00:00 2001 +From e9af8084999e5bb9b3b17d80635f8847355d94cf Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 3 Oct 2014 18:38:07 +0100 -Subject: [PATCH 040/102] [omxcore] Skip out of flush on error +Subject: [PATCH 40/57] [omxcore] Skip out of flush on error --- xbmc/linux/OMXCore.cpp | 4 ++-- @@ -4919,11 +4918,10 @@ index 4ae29ba..4caa304 100644 OMX_ERRORTYPE omx_err = OMX_ErrorNone; -From 673ca831338d680586ac24699789c4cac5509167 Mon Sep 17 00:00:00 2001 +From 50558dabb252751676e063c7d7cca847e4713643 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 3 Oct 2014 18:40:06 +0100 -Subject: [PATCH 041/102] [SinkPi] Handle multichannel layout more like - OMXAudio +Subject: [PATCH 41/57] [SinkPi] Handle multichannel layout more like OMXAudio --- xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 14 +++++++------- @@ -4982,10 +4980,10 @@ index 89684e4..fd9a03d 100644 m_format = format; m_sinkbuffer_sec_per_byte = 1.0 / (double)(m_format.m_frameSize * m_format.m_sampleRate); -From 82f9466723d59aac6f53551b9984cac6ac7c939f Mon Sep 17 00:00:00 2001 +From 0e9287a19769788dbc3477111ebda8ec6f38dd78 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 15:23:51 +0000 -Subject: [PATCH 042/102] [rbp] Default extract thumbnails to false +Subject: [PATCH 42/57] [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 @@ -5015,10 +5013,11 @@ index 79853a8..4c2ef41 100644
-From dae42b2a50ac350761332b661259f8d1ecc5f70a Mon Sep 17 00:00:00 2001 + +From ec5b5aeca2cca3ef93b8a6f7d2cd5fdf6cec5187 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 11 Nov 2014 18:14:23 +0000 -Subject: [PATCH 046/102] [resamplepi] Try to report the same numbers as ffmpeg +Subject: [PATCH 46/57] [resamplepi] Try to report the same numbers as ffmpeg --- .../cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp | 11 ++++++----- @@ -5069,10 +5068,10 @@ index 84505bf..2b5bef2 100644 CLog::Log(LOGINFO, "%s::%s = %d", CLASSNAME, __func__, ret); #endif -From afb9f86c60fa6c18f248121cf1f815a045a701cd Mon Sep 17 00:00:00 2001 +From cd058641b67ddfe52978c1721236769a1ddddba2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 11 Nov 2014 20:49:30 +0000 -Subject: [PATCH 047/102] [dvdplayer] New scheme for PLL adjustment for video +Subject: [PATCH 47/57] [dvdplayer] New scheme for PLL adjustment for video clock --- @@ -5187,10 +5186,10 @@ index 02c64a0..37bf4bd 100644 struct SInfo { -From 0a1f02e5fe1e152fa296b2f3d53761453e910b97 Mon Sep 17 00:00:00 2001 +From 10249b3abae5e5a0df2ec8b598d00ea2b75df67e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 15 Nov 2014 12:03:34 +0000 -Subject: [PATCH 048/102] [dvdplayer] Add lock for player creation +Subject: [PATCH 48/57] [dvdplayer] Add lock for player creation --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 3 +++ @@ -5198,7 +5197,7 @@ Subject: [PATCH 048/102] [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 ea4031e..67cdefc 100644 +index a20b010..60d9ed4 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -494,6 +494,7 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer, std:: @@ -5217,7 +5216,7 @@ index ea4031e..67cdefc 100644 if (!m_players_created) return; delete m_dvdPlayerVideo; -@@ -4009,6 +4011,7 @@ double CDVDPlayer::GetQueueTime() +@@ -4006,6 +4008,7 @@ double CDVDPlayer::GetQueueTime() void CDVDPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info) { @@ -5236,10 +5235,10 @@ index ef64076..7ea6ea6 100644 + CCriticalSection m_players_lock; }; -From 25986160ddd451c08bb4d5ec437db420d97c33ed Mon Sep 17 00:00:00 2001 +From 11ad828f33f251c41038f9c7f5d524abb5a3a845 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 19 Nov 2014 13:29:43 +0000 -Subject: [PATCH 049/102] [dvdplayeraudio] Add advancedsetting for configuring +Subject: [PATCH 49/57] [dvdplayeraudio] Add advancedsetting for configuring max pll adjustment --- @@ -5276,7 +5275,7 @@ index 3e6d0ee..a1b6f4d 100644 } m_last_error = m_error; diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 69b7832..5eca79a 100644 +index bc8598e..02b0a58 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -108,6 +108,7 @@ void CAdvancedSettings::Initialize() @@ -5287,7 +5286,7 @@ index 69b7832..5eca79a 100644 m_audioApplyDrc = true; m_dvdplayerIgnoreDTSinWAV = false; -@@ -481,6 +482,7 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) +@@ -480,6 +481,7 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) if (pElement) { XMLUtils::GetFloat(pElement, "ac3downmixgain", m_ac3Gain, -96.0f, 96.0f); @@ -5296,7 +5295,7 @@ index 69b7832..5eca79a 100644 XMLUtils::GetString(pElement, "defaultplayer", m_audioDefaultPlayer); // 101 on purpose - can be used to never automark as watched diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index ca995e3..99ed121 100644 +index fb5a837..0b2666f 100644 --- a/xbmc/settings/AdvancedSettings.h +++ b/xbmc/settings/AdvancedSettings.h @@ -137,6 +137,7 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler @@ -5308,10 +5307,10 @@ index ca995e3..99ed121 100644 float m_audioPlayCountMinimumPercent; bool m_dvdplayerIgnoreDTSinWAV; -From 3543dc36cd233b483cab703ff1182b291443802d Mon Sep 17 00:00:00 2001 +From ef967fec73b4c2f0420ea828f8da119a468be819 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 19 Nov 2014 17:35:44 +0000 -Subject: [PATCH 050/102] [mmalrender] Skip some log message in bypass mode +Subject: [PATCH 50/57] [mmalrender] Skip some log message in bypass mode --- xbmc/cores/VideoRenderers/MMALRenderer.cpp | 9 ++++++--- @@ -5349,10 +5348,10 @@ index 03a05de..c0ff30d 100644 // we only want to upload frames once if (buffer->flipindex++) -From b4ed1b3475d6c28d9c93798de2778a7055ab6789 Mon Sep 17 00:00:00 2001 +From a92a9f8c4fc388a652a4802b9a8d26fbc89795ab Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 24 Nov 2014 21:24:25 +0000 -Subject: [PATCH 051/102] [mmalcodec] Avoid deinterlace for dvd menus for now +Subject: [PATCH 51/57] [mmalcodec] Avoid deinterlace for dvd menus for now --- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- @@ -5372,10 +5371,10 @@ index 6742e0e..a1f11e9 100644 else if (deinterlace_request == VS_DEINTERLACEMODE_FORCE) deinterlace = true; -From a13a26898ec809d12836bc1cd9dffd01f9ea4759 Mon Sep 17 00:00:00 2001 +From bc0ea3f2daf284ac1b3fe19b7bbcf041ea8aa30e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 24 Nov 2014 22:07:25 +0000 -Subject: [PATCH 052/102] [dvdplayervideo] Prod decoder when in stills mode +Subject: [PATCH 52/57] [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. @@ -5452,10 +5451,10 @@ index f030e37..7a8fc10 100644 if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE)) -From c7378dc7c1c2dafcf92a1e91136811ceda0a582a Mon Sep 17 00:00:00 2001 +From 02bbcdca9c885e5b9ad6c1834e949b8fc378a89a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 27 Nov 2014 16:20:56 +0000 -Subject: [PATCH 053/102] [mmalcodec] Skip some setup that is not required when +Subject: [PATCH 53/57] [mmalcodec] Skip some setup that is not required when closing --- @@ -5522,10 +5521,10 @@ index a1f11e9..a11fa65 100644 m_startframe = false; m_decoderPts = DVD_NOPTS_VALUE; -From d4777be2e056afccdd0e602373bc6b4e513b2299 Mon Sep 17 00:00:00 2001 +From 998e8dfa7f249e086ac8ec0b83bf01a2054bf8d6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 27 Nov 2014 16:31:56 +0000 -Subject: [PATCH 054/102] [languageinvoker] Reduce priority of python threads +Subject: [PATCH 54/57] [languageinvoker] Reduce priority of python threads --- xbmc/interfaces/generic/LanguageInvokerThread.cpp | 5 +++++ @@ -5548,10 +5547,10 @@ index 7b0d903..f92aa3e 100644 } -From 86af6b82c9a6382e093b63720073b78c6739172e Mon Sep 17 00:00:00 2001 +From 89f7c5589e9bc00c6280fa969d51ed68ca12b98d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 27 Nov 2014 17:53:46 +0000 -Subject: [PATCH 055/102] [mmalcodec] Try reducing number of video frames +Subject: [PATCH 55/57] [mmalcodec] Try reducing number of video frames --- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- @@ -5585,11 +5584,11 @@ index 4f81bbd..79a4bfd 100644 virtual const char* GetName(void) { return (const char*)m_pFormatName; } virtual bool GetCodecStats(double &pts, int &droppedPics); -From 552d829d7fd103de9245a758ad6dc17cd258b602 Mon Sep 17 00:00:00 2001 +From 144c26854dcdd6cf8eb19bfc3f4805caed405a96 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 1 Dec 2014 17:31:00 +0000 -Subject: [PATCH 056/102] [mmalcodec] Ensure we have requested number of - buffers in non-accelerated case +Subject: [PATCH 56/57] [mmalcodec] Ensure we have requested number of buffers + in non-accelerated case --- xbmc/cores/VideoRenderers/MMALRenderer.cpp | 2 +- @@ -5609,10 +5608,10 @@ index c0ff30d..6d461bd 100644 status = mmal_port_enable(m_vout_input, vout_input_port_cb_static); -From aa6e916e07acf80afeeac38783e8adb38d27aa81 Mon Sep 17 00:00:00 2001 +From e69f683bc919f53400b07a15c3d5bcaf0cec40f7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Dec 2014 21:17:53 +0000 -Subject: [PATCH 057/102] [omxplayer] Add some info about hdmi sync to codec +Subject: [PATCH 57/57] [omxplayer] Add some info about hdmi sync to codec overlay --- @@ -5692,5225 +5691,3 @@ index c8fd5fb..9f26427 100644 void SubmitEOS(); bool IsEOS(); bool SubmittedEOS() const { return m_submitted_eos; } - -From 3c8b1966fd0c5432c187efd935609491c90e4689 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 14 Dec 2013 16:55:05 +0000 -Subject: [PATCH 063/102] 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 1e05813251c2003cabef228decd70efdbc83f1aa Mon Sep 17 00:00:00 2001 -From: da-anda -Date: Sun, 17 Aug 2014 21:09:59 +0200 -Subject: [PATCH 064/102] handle stereoscopic mode of videos in mixed playlists - ---- - language/English/strings.po | 2 +- - xbmc/guilib/StereoscopicsManager.cpp | 76 +++++++++++++++++++++++------------- - 2 files changed, 49 insertions(+), 29 deletions(-) - -diff --git a/language/English/strings.po b/language/English/strings.po -index 219db23..daa5446 100755 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -15784,7 +15784,7 @@ msgstr "" - #. Description of setting "Videos -> Playback -> Disable stereoscopic mode when playback is stopped" with label #36526 - #: system/settings/settings.xml - msgctxt "#36538" --msgid "[Enabled] Switch GUI (and some TVs) back to 2D mode when playback ended. [Disabled] GUI and TV will stay in stereoscopic 3D mode. For video playlists the stereoscopic 3D mode won't change between videos, not even for non stereoscopic ones." -+msgid "[Enabled] Switch GUI (and some TVs) back to 2D mode when playback ended - also between videos in a playlist if necessary. [Disabled] GUI and TV will stay in stereoscopic 3D mode. For video playlists the stereoscopic 3D mode won't change between videos, not even for non stereoscopic ones." - msgstr "" - - #. Description of setting "System -> Video output -> Stereoscopic mode (current)" with label #36500 -diff --git a/xbmc/guilib/StereoscopicsManager.cpp b/xbmc/guilib/StereoscopicsManager.cpp -index 35ba597..b013942 100644 ---- a/xbmc/guilib/StereoscopicsManager.cpp -+++ b/xbmc/guilib/StereoscopicsManager.cpp -@@ -123,13 +123,23 @@ RENDER_STEREO_MODE CStereoscopicsManager::GetStereoMode(void) - void CStereoscopicsManager::SetStereoMode(const RENDER_STEREO_MODE &mode) - { - RENDER_STEREO_MODE currentMode = GetStereoMode(); -- if (mode != currentMode && mode >= RENDER_STEREO_MODE_OFF) -+ RENDER_STEREO_MODE applyMode = mode; -+ -+ // resolve automatic mode before applying -+ if (mode == RENDER_STEREO_MODE_AUTO) - { -- if(!g_Windowing.SupportsStereo(mode)) -- return; -+ if (g_infoManager.EvaluateBool("videoplayer.isstereoscopic")) -+ applyMode = GetStereoModeOfPlayingVideo(); -+ else -+ applyMode = RENDER_STEREO_MODE_OFF; -+ } - -+ if (applyMode != currentMode && applyMode >= RENDER_STEREO_MODE_OFF) -+ { -+ if (!g_Windowing.SupportsStereo(applyMode)) -+ return; - m_lastStereoMode = currentMode; -- CSettings::Get().SetInt("videoscreen.stereoscopicmode", mode); -+ CSettings::Get().SetInt("videoscreen.stereoscopicmode", applyMode); - } - } - -@@ -210,6 +220,12 @@ RENDER_STEREO_MODE CStereoscopicsManager::GetStereoModeByUserChoice(const CStdSt - if (mode == selectableMode) - pDlgSelect->SetSelected( label ); - } -+ // inject AUTO pseudo mode after OFF -+ if (i == RENDER_STEREO_MODE_OFF) -+ { -+ selectableModes.push_back(RENDER_STEREO_MODE_AUTO); -+ pDlgSelect->Add(GetLabelForStereoMode(RENDER_STEREO_MODE_AUTO)); -+ } - } - - pDlgSelect->DoModal(); -@@ -248,20 +264,7 @@ CStdString CStereoscopicsManager::GetLabelForStereoMode(const RENDER_STEREO_MODE - - RENDER_STEREO_MODE CStereoscopicsManager::GetPreferredPlaybackMode(void) - { -- RENDER_STEREO_MODE playbackMode = m_lastStereoMode; -- int preferredMode = CSettings::Get().GetInt("videoscreen.preferedstereoscopicmode"); -- if (preferredMode == RENDER_STEREO_MODE_AUTO) // automatic mode, detect by movie -- { -- if (g_infoManager.EvaluateBool("videoplayer.isstereoscopic")) -- playbackMode = GetStereoModeOfPlayingVideo(); -- else if (playbackMode == RENDER_STEREO_MODE_OFF) -- playbackMode = GetNextSupportedStereoMode(RENDER_STEREO_MODE_OFF); -- } -- else // predefined mode -- { -- playbackMode = (RENDER_STEREO_MODE) preferredMode; -- } -- return playbackMode; -+ return (RENDER_STEREO_MODE) CSettings::Get().GetInt("videoscreen.preferedstereoscopicmode"); - } - - int CStereoscopicsManager::ConvertVideoToGuiStereoMode(const std::string &mode) -@@ -450,9 +453,6 @@ void CStereoscopicsManager::ApplyStereoMode(const RENDER_STEREO_MODE &mode, bool - - void CStereoscopicsManager::OnPlaybackStarted(void) - { -- if (!g_infoManager.EvaluateBool("videoplayer.isstereoscopic")) -- return; -- - STEREOSCOPIC_PLAYBACK_MODE playbackMode = (STEREOSCOPIC_PLAYBACK_MODE) CSettings::Get().GetInt("videoplayer.stereoscopicplaybackmode"); - RENDER_STEREO_MODE mode = GetStereoMode(); - -@@ -460,8 +460,31 @@ void CStereoscopicsManager::OnPlaybackStarted(void) - if (playbackMode == STEREOSCOPIC_PLAYBACK_MODE_IGNORE && mode == RENDER_STEREO_MODE_OFF) - return; - -- if (mode != RENDER_STEREO_MODE_OFF) -+ if (!g_infoManager.EvaluateBool("videoplayer.isstereoscopic")) -+ { -+ // exit stereo mode if started item is not stereoscopic -+ // and if user prefers to stop 3D playback when movie is finished -+ if (mode != RENDER_STEREO_MODE_OFF && CSettings::Get().GetBool("videoplayer.quitstereomodeonstop")) -+ SetStereoMode(RENDER_STEREO_MODE_OFF); - return; -+ } -+ -+ RENDER_STEREO_MODE preferred = GetPreferredPlaybackMode(); -+ RENDER_STEREO_MODE playing = GetStereoModeOfPlayingVideo(); -+ -+ if (mode != RENDER_STEREO_MODE_OFF) -+ { -+ // don't change mode if user selected to not exit stereomode on playback stop -+ // users selecting this option usually have to manually switch their TV into 3D mode -+ // and would be annoyed by having to switch TV modes when next movies comes up -+ // @todo probably add a new setting for just this behavior -+ if (CSettings::Get().GetBool("videoplayer.quitstereomodeonstop") == false) -+ return; -+ -+ // only change to new stereo mode if not yet in preferred stereo mode -+ if (mode == preferred || (preferred == RENDER_STEREO_MODE_AUTO && mode == playing)) -+ return; -+ } - - switch (playbackMode) - { -@@ -473,9 +496,6 @@ void CStereoscopicsManager::OnPlaybackStarted(void) - pDlgSelect->Reset(); - pDlgSelect->SetHeading(g_localizeStrings.Get(36527).c_str()); - -- RENDER_STEREO_MODE preferred = GetPreferredPlaybackMode(); -- RENDER_STEREO_MODE playing = GetStereoModeOfPlayingVideo(); -- - int idx_playing = -1 - , idx_mono = -1; - -@@ -488,7 +508,7 @@ void CStereoscopicsManager::OnPlaybackStarted(void) - - idx_mono = pDlgSelect->Add(GetLabelForStereoMode(RENDER_STEREO_MODE_MONO)); // mono / 2d - -- if(playing != RENDER_STEREO_MODE_OFF && playing != preferred && g_Windowing.SupportsStereo(playing)) -+ if (playing != RENDER_STEREO_MODE_OFF && playing != preferred && preferred != RENDER_STEREO_MODE_AUTO && g_Windowing.SupportsStereo(playing)) // same as movie - idx_playing = pDlgSelect->Add((CStdString)g_localizeStrings.Get(36532) - + " (" - + GetLabelForStereoMode(playing) -@@ -503,7 +523,7 @@ void CStereoscopicsManager::OnPlaybackStarted(void) - int iItem = pDlgSelect->GetSelectedLabel(); - if (iItem == idx_preferred) mode = preferred; - else if (iItem == idx_mono) mode = RENDER_STEREO_MODE_MONO; -- else if (iItem == idx_playing) mode = playing; -+ else if (iItem == idx_playing) mode = RENDER_STEREO_MODE_AUTO; - else if (iItem == idx_select) mode = GetStereoModeByUserChoice(); - - SetStereoMode(mode); -@@ -513,7 +533,7 @@ void CStereoscopicsManager::OnPlaybackStarted(void) - } - break; - case STEREOSCOPIC_PLAYBACK_MODE_PREFERRED: // Stereoscopic -- SetStereoMode( GetPreferredPlaybackMode() ); -+ SetStereoMode( preferred ); - break; - case 2: // Mono - SetStereoMode( RENDER_STEREO_MODE_MONO ); - -From dc34c5c38ab1983a40e1dc57799cf08962a4ee1d Mon Sep 17 00:00:00 2001 -From: da-anda -Date: Sat, 16 Aug 2014 11:20:54 +0200 -Subject: [PATCH 065/102] remember user selected 3D modes between videos until - playback ended - ---- - xbmc/guilib/StereoscopicsManager.cpp | 79 ++++++++++++++++++++++++++---------- - xbmc/guilib/StereoscopicsManager.h | 6 ++- - xbmc/rendering/RenderSystem.h | 1 + - 3 files changed, 63 insertions(+), 23 deletions(-) - -diff --git a/xbmc/guilib/StereoscopicsManager.cpp b/xbmc/guilib/StereoscopicsManager.cpp -index b013942..3db8eaa 100644 ---- a/xbmc/guilib/StereoscopicsManager.cpp -+++ b/xbmc/guilib/StereoscopicsManager.cpp -@@ -95,7 +95,8 @@ static const struct StereoModeMap StringToGuiModeMap[] = - - CStereoscopicsManager::CStereoscopicsManager(void) - { -- m_lastStereoMode = RENDER_STEREO_MODE_OFF; -+ m_stereoModeSetByUser = RENDER_STEREO_MODE_UNDEFINED; -+ m_lastStereoModeSetByUser = RENDER_STEREO_MODE_UNDEFINED; - } - - CStereoscopicsManager::~CStereoscopicsManager(void) -@@ -110,7 +111,6 @@ CStereoscopicsManager& CStereoscopicsManager::Get(void) - - void CStereoscopicsManager::Initialize(void) - { -- m_lastStereoMode = GetStereoMode(); - // turn off stereo mode on XBMC startup - SetStereoMode(RENDER_STEREO_MODE_OFF); - } -@@ -120,6 +120,16 @@ RENDER_STEREO_MODE CStereoscopicsManager::GetStereoMode(void) - return (RENDER_STEREO_MODE) CSettings::Get().GetInt("videoscreen.stereoscopicmode"); - } - -+void CStereoscopicsManager::SetStereoModeByUser(const RENDER_STEREO_MODE &mode) -+{ -+ // only update last user mode if desired mode is different from current -+ if (mode != m_stereoModeSetByUser) -+ m_lastStereoModeSetByUser = m_stereoModeSetByUser; -+ -+ m_stereoModeSetByUser = mode; -+ SetStereoMode(mode); -+} -+ - void CStereoscopicsManager::SetStereoMode(const RENDER_STEREO_MODE &mode) - { - RENDER_STEREO_MODE currentMode = GetStereoMode(); -@@ -138,7 +148,6 @@ void CStereoscopicsManager::SetStereoMode(const RENDER_STEREO_MODE &mode) - { - if (!g_Windowing.SupportsStereo(applyMode)) - return; -- m_lastStereoMode = currentMode; - CSettings::Get().SetInt("videoscreen.stereoscopicmode", applyMode); - } - } -@@ -384,46 +393,65 @@ bool CStereoscopicsManager::OnAction(const CAction &action) - - if (action.GetID() == ACTION_STEREOMODE_NEXT) - { -- SetStereoMode(GetNextSupportedStereoMode(mode)); -+ SetStereoModeByUser(GetNextSupportedStereoMode(mode)); - return true; - } - else if (action.GetID() == ACTION_STEREOMODE_PREVIOUS) - { -- SetStereoMode(GetNextSupportedStereoMode(mode, RENDER_STEREO_MODE_COUNT - 1)); -+ SetStereoModeByUser(GetNextSupportedStereoMode(mode, RENDER_STEREO_MODE_COUNT - 1)); - return true; - } - else if (action.GetID() == ACTION_STEREOMODE_TOGGLE) - { - if (mode == RENDER_STEREO_MODE_OFF) - { -- RENDER_STEREO_MODE targetMode = m_lastStereoMode; -- if (targetMode == RENDER_STEREO_MODE_OFF) -- targetMode = GetPreferredPlaybackMode(); -- SetStereoMode(targetMode); -+ RENDER_STEREO_MODE targetMode = GetPreferredPlaybackMode(); -+ -+ // if user selected a specific mode before, make sure to -+ // switch back into that mode on toggle. -+ if (m_stereoModeSetByUser != RENDER_STEREO_MODE_UNDEFINED) -+ { -+ // if user mode is set to OFF, he manually turned it off before. In this case use the last user applied mode -+ if (m_stereoModeSetByUser != RENDER_STEREO_MODE_OFF) -+ targetMode = m_stereoModeSetByUser; -+ else if (m_lastStereoModeSetByUser != RENDER_STEREO_MODE_UNDEFINED && m_lastStereoModeSetByUser != RENDER_STEREO_MODE_OFF) -+ targetMode = m_lastStereoModeSetByUser; -+ } -+ -+ SetStereoModeByUser(targetMode); - } - else - { -- SetStereoMode(RENDER_STEREO_MODE_OFF); -+ SetStereoModeByUser(RENDER_STEREO_MODE_OFF); - } - return true; - } - else if (action.GetID() == ACTION_STEREOMODE_SELECT) - { -- SetStereoMode(GetStereoModeByUserChoice()); -+ SetStereoModeByUser(GetStereoModeByUserChoice()); - return true; - } - else if (action.GetID() == ACTION_STEREOMODE_TOMONO) - { - if (mode == RENDER_STEREO_MODE_MONO) - { -- RENDER_STEREO_MODE targetMode = m_lastStereoMode; -- if (targetMode == RENDER_STEREO_MODE_OFF) -- targetMode = GetPreferredPlaybackMode(); -- SetStereoMode(targetMode); -+ RENDER_STEREO_MODE targetMode = GetPreferredPlaybackMode(); -+ -+ // if we have an old userdefined steremode, use that one as toggle target -+ if (m_stereoModeSetByUser != RENDER_STEREO_MODE_UNDEFINED) -+ { -+ // if user mode is set to OFF, he manually turned it off before. In this case use the last user applied mode -+ if (m_stereoModeSetByUser != RENDER_STEREO_MODE_OFF && m_stereoModeSetByUser != mode) -+ targetMode = m_stereoModeSetByUser; -+ else if (m_lastStereoModeSetByUser != RENDER_STEREO_MODE_UNDEFINED && m_lastStereoModeSetByUser != RENDER_STEREO_MODE_OFF && m_lastStereoModeSetByUser != mode) -+ targetMode = m_lastStereoModeSetByUser; -+ } -+ -+ SetStereoModeByUser(targetMode); - } - else - { -- SetStereoMode(RENDER_STEREO_MODE_MONO); -+ SetStereoModeByUser(RENDER_STEREO_MODE_MONO); - } - return true; - } -@@ -431,7 +459,7 @@ bool CStereoscopicsManager::OnAction(const CAction &action) - { - int stereoMode = ConvertStringToGuiStereoMode(action.GetName()); - if (stereoMode > -1) -- SetStereoMode( (RENDER_STEREO_MODE) stereoMode); -+ SetStereoModeByUser( (RENDER_STEREO_MODE) stereoMode ); - return true; - } - -@@ -469,6 +497,13 @@ void CStereoscopicsManager::OnPlaybackStarted(void) - return; - } - -+ // if we're not in stereomode yet, restore previously selected stereo mode in case it was user selected -+ if (m_stereoModeSetByUser != RENDER_STEREO_MODE_UNDEFINED) -+ { -+ SetStereoMode(m_stereoModeSetByUser); -+ return; -+ } -+ - RENDER_STEREO_MODE preferred = GetPreferredPlaybackMode(); - RENDER_STEREO_MODE playing = GetStereoModeOfPlayingVideo(); - -@@ -526,7 +561,7 @@ void CStereoscopicsManager::OnPlaybackStarted(void) - else if (iItem == idx_playing) mode = RENDER_STEREO_MODE_AUTO; - else if (iItem == idx_select) mode = GetStereoModeByUserChoice(); - -- SetStereoMode(mode); -+ SetStereoModeByUser( mode ); - } - - CApplicationMessenger::Get().MediaUnPause(); -@@ -546,8 +581,10 @@ void CStereoscopicsManager::OnPlaybackStarted(void) - void CStereoscopicsManager::OnPlaybackStopped(void) - { - RENDER_STEREO_MODE mode = GetStereoMode(); -- if (CSettings::Get().GetBool("videoplayer.quitstereomodeonstop") == true && mode != RENDER_STEREO_MODE_OFF) -- { -+ if (CSettings::Get().GetBool("videoplayer.quitstereomodeonstop") && mode != RENDER_STEREO_MODE_OFF) - SetStereoMode(RENDER_STEREO_MODE_OFF); -- } -+ // reset user modes on playback end to start over new on next playback and not end up in a probably unwanted mode -+ if (m_stereoModeSetByUser != RENDER_STEREO_MODE_OFF) -+ m_lastStereoModeSetByUser = m_stereoModeSetByUser; -+ m_stereoModeSetByUser = RENDER_STEREO_MODE_UNDEFINED; - } -diff --git a/xbmc/guilib/StereoscopicsManager.h b/xbmc/guilib/StereoscopicsManager.h -index 422cba2..6e9c36d 100644 ---- a/xbmc/guilib/StereoscopicsManager.h -+++ b/xbmc/guilib/StereoscopicsManager.h -@@ -54,8 +54,9 @@ class CStereoscopicsManager : public ISettingCallback, - static CStereoscopicsManager& Get(void); - - void Initialize(void); -- void SetStereoMode(const RENDER_STEREO_MODE &mode); - RENDER_STEREO_MODE GetStereoMode(void); -+ void SetStereoModeByUser(const RENDER_STEREO_MODE &mode); -+ void SetStereoMode(const RENDER_STEREO_MODE &mode); - RENDER_STEREO_MODE GetNextSupportedStereoMode(const RENDER_STEREO_MODE ¤tMode, int step = 1); - std::string DetectStereoModeByString(const std::string &needle); - RENDER_STEREO_MODE GetStereoModeByUserChoice(const CStdString &heading = ""); -@@ -92,5 +93,6 @@ class CStereoscopicsManager : public ISettingCallback, - void OnPlaybackStarted(void); - void OnPlaybackStopped(void); - -- RENDER_STEREO_MODE m_lastStereoMode; -+ RENDER_STEREO_MODE m_stereoModeSetByUser; -+ RENDER_STEREO_MODE m_lastStereoModeSetByUser; - }; -diff --git a/xbmc/rendering/RenderSystem.h b/xbmc/rendering/RenderSystem.h -index c1dfb93..cb54bd0 100644 ---- a/xbmc/rendering/RenderSystem.h -+++ b/xbmc/rendering/RenderSystem.h -@@ -81,6 +81,7 @@ enum RENDER_STEREO_MODE - - // psuevdo modes - RENDER_STEREO_MODE_AUTO = 100, -+ RENDER_STEREO_MODE_UNDEFINED = 999, - }; - - - -From f78e8f6d0f47d47ac76a32b1b8055cf624573425 Mon Sep 17 00:00:00 2001 -From: macrule -Date: Thu, 11 Apr 2013 18:24:42 +0200 -Subject: [PATCH 066/102] 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 0ffcfe736dc3dc0d381d9b0505aa8e0c8481d68b Mon Sep 17 00:00:00 2001 -From: macrule -Date: Thu, 11 Apr 2013 18:29:03 +0200 -Subject: [PATCH 067/102] 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 a25eb86..5fbfa6f 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -411,6 +411,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 70bf1bc05dd77f5e152c8ae7eab39e811506d48e Mon Sep 17 00:00:00 2001 -From: macrule -Date: Thu, 11 Apr 2013 19:50:58 +0200 -Subject: [PATCH 068/102] 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 5fbfa6f..a36b12c 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -221,7 +221,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); -@@ -275,6 +275,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 = m_DllBcmHost->vc_dispmanx_display_open(0); - -@@ -440,8 +467,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 -@@ -484,7 +509,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); - } -@@ -507,9 +532,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 b92488ba6456efd01517bb040eb63b0c8a70036d Mon Sep 17 00:00:00 2001 -From: macrule -Date: Thu, 11 Apr 2013 19:54:59 +0200 -Subject: [PATCH 069/102] 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 ce09fce..a18aa49 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -225,5 +225,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 6456657..606c24f 100644 ---- a/xbmc/linux/RBP.h -+++ b/xbmc/linux/RBP.h -@@ -60,6 +60,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 a36b12c..1529045 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -59,7 +59,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 1776970a4c6b35ba194fe71bbd9d6411420ae3cf Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 11 Aug 2013 15:03:36 +0100 -Subject: [PATCH 070/102] 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 | 7 +++++++ - xbmc/powermanagement/IPowerSyscall.h | 7 +++++++ - xbmc/powermanagement/PowerManager.cpp | 6 ++++++ - xbmc/powermanagement/PowerManager.h | 3 +++ - 4 files changed, 23 insertions(+) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 8e0ab13..9e4be48 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -2377,6 +2377,13 @@ bool CApplication::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 - m_idleTimer.StartZero(); -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 1419471698c6691ff9fbc59bca24ac4a41848efb Mon Sep 17 00:00:00 2001 -From: macrule -Date: Wed, 17 Apr 2013 13:23:01 +0200 -Subject: [PATCH 071/102] 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..6a1e47b ---- /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 "guilib/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) -+ { -+ CStdString 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 90a6b3b7634a8cd0681316b7fce6b3cf518b3747 Mon Sep 17 00:00:00 2001 -From: macrule -Date: Wed, 17 Apr 2013 13:24:22 +0200 -Subject: [PATCH 072/102] 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 9793e66c04489c13f0715e57ec0a88b08e10faab Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Mar 2014 16:16:29 +0000 -Subject: [PATCH 073/102] [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 da0ccb4..bfdcd06 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -183,12 +183,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 9a33bfbc331b9c5c6d9e229f82a1d7a7e7e4c18a Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Mar 2014 16:47:54 +0000 -Subject: [PATCH 074/102] [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 6a1e47b..a717a09 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) - { - CStdString 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 7d8c65d6d9da39884ed27c80862df7c5c07cad96 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Mar 2014 17:30:07 +0000 -Subject: [PATCH 075/102] [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 a717a09..d39c3ed 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 e9efddb09861be15e18121a41064654e56f5e70e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 4 Mar 2014 19:33:44 +0000 -Subject: [PATCH 076/102] [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 9c5c7ff030d22ddeb025d9b9882d79134894f207 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 26 Apr 2014 17:27:52 +0100 -Subject: [PATCH 077/102] [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 fd75f0ded14b978c508d62aab5846117a36b4ac4 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 27 Jun 2014 00:01:05 +0100 -Subject: [PATCH 078/102] [rbp] Resume video output on startup - ---- - xbmc/linux/RBP.cpp | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index a18aa49..6514c2d 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -88,6 +88,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 01365a1a153af5fd844c25156923d61845993413 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 11 Apr 2014 16:12:27 +0100 -Subject: [PATCH 079/102] [omxplayer] Add ability to log more timestamp info in - extra debug settings - ---- - language/English/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/language/English/strings.po b/language/English/strings.po -index daa5446..71b3ebf 100755 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -2892,6 +2892,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 4a69bb7..a3b6ba6 100644 ---- a/xbmc/commons/ilog.h -+++ b/xbmc/commons/ilog.h -@@ -54,6 +54,7 @@ - #define LOGUPNP (1 << (LOGMASKBIT + 9)) - #define LOGCEC (1 << (LOGMASKBIT + 10)) - #define LOGVIDEO (1 << (LOGMASKBIT + 11)) -+#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 66014d4..d305a07 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 77b9461..9336ae5 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 5eca79a..f1d4be3 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1392,6 +1392,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 74febb4684abcbe0dcb1dbd06c22db4978c4252b Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 080/102] [omxplayer] Add ability to dump out audio/video data - for later debugging - ---- - language/English/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/language/English/strings.po b/language/English/strings.po -index 71b3ebf..83179a5 100755 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -2897,6 +2897,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 a3b6ba6..f01c83b 100644 ---- a/xbmc/commons/ilog.h -+++ b/xbmc/commons/ilog.h -@@ -55,6 +55,8 @@ - #define LOGCEC (1 << (LOGMASKBIT + 10)) - #define LOGVIDEO (1 << (LOGMASKBIT + 11)) - #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 ef4c3d4..6be2b76 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -55,6 +55,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 - ////////////////////////////////////////////////////////////////////// -@@ -867,6 +910,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) - { -@@ -935,6 +980,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 - int nRetry = 0; - while(true) - { -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err == OMX_ErrorNone) - { -@@ -1470,6 +1518,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 dea0e11..b6bc525 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; -@@ -120,6 +163,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) - { -@@ -713,6 +757,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) -@@ -831,6 +876,7 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) - int nRetry = 0; - while(true) - { -+ dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err == OMX_ErrorNone) - { -@@ -961,6 +1007,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 f1d4be3..dc7835a 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1395,6 +1395,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 999cf02013dade3b8839e0f682d9329f03c137d9 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 18 Aug 2014 19:09:32 +0100 -Subject: [PATCH 081/102] rbp: Use new dispmanx function for vsync callbacks - ---- - xbmc/linux/RBP.cpp | 85 ++++++++++++++----------- - xbmc/linux/RBP.h | 5 +- - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 +- - 3 files changed, 52 insertions(+), 42 deletions(-) - -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index 6514c2d..5ce7b0d 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -33,7 +33,7 @@ CRBP::CRBP() - m_omx_initialized = false; - m_DllBcmHost = new DllBcmHost(); - m_OMX = new COMXCore(); -- m_element = 0; -+ m_display = DISPMANX_NO_HANDLE; - } - - CRBP::~CRBP() -@@ -55,8 +55,7 @@ bool CRBP::Initialize() - - m_DllBcmHost->bcm_host_init(); - -- uint32_t vc_image_ptr; -- m_resource = vc_dispmanx_resource_create( VC_IMAGE_RGB565, 1, 1, &vc_image_ptr ); -+ //OpenDisplay(0 /*screen*/); - - m_omx_initialized = m_OMX->Initialize(); - if(!m_omx_initialized) -@@ -112,13 +111,24 @@ void CRBP::LogFirmwareVerison() - CLog::Log(LOGNOTICE, "Config:\n%s", response); - } - -+DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) -+{ -+ if (m_display == DISPMANX_NO_HANDLE) -+ m_display = vc_dispmanx_display_open( 0 /*screen*/ ); -+ return m_display; -+} -+ -+void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display) -+{ -+ assert(display == m_display); -+ vc_dispmanx_display_close(m_display); -+ m_display = DISPMANX_NO_HANDLE; -+} -+ - void CRBP::GetDisplaySize(int &width, int &height) - { -- DISPMANX_DISPLAY_HANDLE_T display; - DISPMANX_MODEINFO_T info; -- -- display = vc_dispmanx_display_open( 0 /*screen*/ ); -- if (vc_dispmanx_display_get_info(display, &info) == 0) -+ if (vc_dispmanx_display_get_info(m_display, &info) == 0) - { - width = info.width; - height = info.height; -@@ -128,12 +138,10 @@ void CRBP::GetDisplaySize(int &width, int &height) - width = 0; - height = 0; - } -- vc_dispmanx_display_close(display ); - } - - unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool swap_red_blue, bool video_only) - { -- DISPMANX_DISPLAY_HANDLE_T display; - DISPMANX_RESOURCE_HANDLE_T resource; - VC_RECT_T rect; - unsigned char *image = NULL; -@@ -148,7 +156,6 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw - if (!pstride) - flags |= DISPMANX_SNAPSHOT_PACK; - -- display = vc_dispmanx_display_open( 0 /*screen*/ ); - stride = ((width + 15) & ~15) * 4; - image = new unsigned char [height * stride]; - -@@ -156,45 +163,44 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw - { - resource = vc_dispmanx_resource_create( VC_IMAGE_RGBA32, width, height, &vc_image_ptr ); - -- vc_dispmanx_snapshot(display, resource, (DISPMANX_TRANSFORM_T)flags); -+ assert(m_display != DISPMANX_NO_HANDLE); -+ vc_dispmanx_snapshot(m_display, resource, (DISPMANX_TRANSFORM_T)flags); - - vc_dispmanx_rect_set(&rect, 0, 0, width, height); - vc_dispmanx_resource_read_data(resource, &rect, image, stride); - vc_dispmanx_resource_delete( resource ); -- vc_dispmanx_display_close(display ); - } - if (pstride) - *pstride = stride; - return image; - } - --void CRBP::WaitVsync(void) -+ -+static void vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *arg) - { -- DISPMANX_DISPLAY_HANDLE_T display = vc_dispmanx_display_open( 0 /*screen*/ ); -- DISPMANX_UPDATE_HANDLE_T update = vc_dispmanx_update_start(0); -- -- VC_DISPMANX_ALPHA_T alpha = { (DISPMANX_FLAGS_ALPHA_T)(DISPMANX_FLAGS_ALPHA_FROM_SOURCE | DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS), 120, /*alpha 0->255*/ 0 }; -- VC_RECT_T src_rect; -- VC_RECT_T dst_rect; -- vc_dispmanx_rect_set( &src_rect, 0, 0, 1 << 16, 1 << 16 ); -- vc_dispmanx_rect_set( &dst_rect, 0, 0, 1, 1 ); -- -- if (m_element) -- vc_dispmanx_element_remove( update, m_element ); -- -- m_element = vc_dispmanx_element_add( update, -- display, -- 2000, // layer -- &dst_rect, -- m_resource, -- &src_rect, -- DISPMANX_PROTECTION_NONE, -- &alpha, -- NULL, // clamp -- (DISPMANX_TRANSFORM_T)0 ); -- -- vc_dispmanx_update_submit_sync(update); -- vc_dispmanx_display_close( display ); -+ CEvent *sync = (CEvent *)arg; -+ sync->Set(); -+} -+ -+void CRBP::WaitVsync() -+{ -+ int s; -+ CEvent sync; -+ DISPMANX_DISPLAY_HANDLE_T m_display = vc_dispmanx_display_open( 0 /*screen*/ ); -+ if (m_display == DISPMANX_NO_HANDLE) -+ { -+ CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); -+ return; -+ } -+ s = vc_dispmanx_vsync_callback(m_display, vsync_callback, (void *)&sync); -+ if (s == 0) -+ { -+ sync.Wait(); -+ } -+ else assert(0); -+ s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); -+ assert(s == 0); -+ vc_dispmanx_display_close( m_display ); - } - - -@@ -206,6 +212,9 @@ void CRBP::Deinitialize() - if(m_omx_initialized) - m_OMX->Deinitialize(); - -+ if (m_display) -+ CloseDisplay(m_display); -+ - m_DllBcmHost->bcm_host_deinit(); - - if(m_initialized) -diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index 606c24f..4e4156d 100644 ---- a/xbmc/linux/RBP.h -+++ b/xbmc/linux/RBP.h -@@ -53,6 +53,8 @@ class CRBP - bool GetCodecMpg2() { return m_codec_mpg2_enabled; } - bool GetCodecWvc1() { return m_codec_wvc1_enabled; } - void GetDisplaySize(int &width, int &height); -+ DISPMANX_DISPLAY_HANDLE_T OpenDisplay(uint32_t device); -+ void CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display); - int GetGUIResolutionLimit() { return m_gui_resolution_limit; } - // stride can be null for packed output - unsigned char *CaptureDisplay(int width, int height, int *stride, bool swap_red_blue, bool video_only = true); -@@ -74,10 +76,9 @@ class CRBP - bool m_codec_mpg2_enabled; - bool m_codec_wvc1_enabled; - COMXCore *m_OMX; -- DISPMANX_RESOURCE_HANDLE_T m_resource; -- DISPMANX_ELEMENT_HANDLE_T m_element; - class DllLibOMXCore; - CCriticalSection m_critSection; -+ DISPMANX_DISPLAY_HANDLE_T m_display; - }; - - extern CRBP g_RBP; -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 1529045..b6bf1fc 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -306,7 +306,7 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) - m_desktopRes = res; - } - -- m_dispman_display = m_DllBcmHost->vc_dispmanx_display_open(0); -+ m_dispman_display = g_RBP.OpenDisplay(0); - - m_width = res.iWidth; - m_height = res.iHeight; -@@ -571,7 +571,7 @@ void CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow() - - if (m_dispman_display != DISPMANX_NO_HANDLE) - { -- m_DllBcmHost->vc_dispmanx_display_close(m_dispman_display); -+ g_RBP.CloseDisplay(m_dispman_display); - m_dispman_display = DISPMANX_NO_HANDLE; - } - DLOG("CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow\n"); - -From d84f17ccadd74f3a6ba5bc9bc3edaa7967d8474f Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 19 Aug 2014 17:56:45 +0100 -Subject: [PATCH 082/102] Revert "rbp: Use new dispmanx function for vsync - callbacks" - -This reverts commit afbf8fbceaa6649fb4a6bbd9a1cee6087590412b. ---- - xbmc/linux/RBP.cpp | 85 +++++++++++-------------- - xbmc/linux/RBP.h | 5 +- - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 +- - 3 files changed, 42 insertions(+), 52 deletions(-) - -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index 5ce7b0d..602b4b1 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -33,7 +33,7 @@ CRBP::CRBP() - m_omx_initialized = false; - m_DllBcmHost = new DllBcmHost(); - m_OMX = new COMXCore(); -- m_display = DISPMANX_NO_HANDLE; -+ m_element = 0; - } - - CRBP::~CRBP() -@@ -55,7 +55,8 @@ bool CRBP::Initialize() - - m_DllBcmHost->bcm_host_init(); - -- //OpenDisplay(0 /*screen*/); -+ uint32_t vc_image_ptr; -+ m_resource = vc_dispmanx_resource_create( VC_IMAGE_RGB565, 1, 1, &vc_image_ptr ); - - m_omx_initialized = m_OMX->Initialize(); - if(!m_omx_initialized) -@@ -111,24 +112,13 @@ void CRBP::LogFirmwareVerison() - CLog::Log(LOGNOTICE, "Config:\n%s", response); - } - --DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) --{ -- if (m_display == DISPMANX_NO_HANDLE) -- m_display = vc_dispmanx_display_open( 0 /*screen*/ ); -- return m_display; --} -- --void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display) --{ -- assert(display == m_display); -- vc_dispmanx_display_close(m_display); -- m_display = DISPMANX_NO_HANDLE; --} -- - void CRBP::GetDisplaySize(int &width, int &height) - { -+ DISPMANX_DISPLAY_HANDLE_T display; - DISPMANX_MODEINFO_T info; -- if (vc_dispmanx_display_get_info(m_display, &info) == 0) -+ -+ display = vc_dispmanx_display_open( 0 /*screen*/ ); -+ if (vc_dispmanx_display_get_info(display, &info) == 0) - { - width = info.width; - height = info.height; -@@ -138,10 +128,12 @@ void CRBP::GetDisplaySize(int &width, int &height) - width = 0; - height = 0; - } -+ vc_dispmanx_display_close(display ); - } - - unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool swap_red_blue, bool video_only) - { -+ DISPMANX_DISPLAY_HANDLE_T display; - DISPMANX_RESOURCE_HANDLE_T resource; - VC_RECT_T rect; - unsigned char *image = NULL; -@@ -156,6 +148,7 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw - if (!pstride) - flags |= DISPMANX_SNAPSHOT_PACK; - -+ display = vc_dispmanx_display_open( 0 /*screen*/ ); - stride = ((width + 15) & ~15) * 4; - image = new unsigned char [height * stride]; - -@@ -163,44 +156,45 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw - { - resource = vc_dispmanx_resource_create( VC_IMAGE_RGBA32, width, height, &vc_image_ptr ); - -- assert(m_display != DISPMANX_NO_HANDLE); -- vc_dispmanx_snapshot(m_display, resource, (DISPMANX_TRANSFORM_T)flags); -+ vc_dispmanx_snapshot(display, resource, (DISPMANX_TRANSFORM_T)flags); - - vc_dispmanx_rect_set(&rect, 0, 0, width, height); - vc_dispmanx_resource_read_data(resource, &rect, image, stride); - vc_dispmanx_resource_delete( resource ); -+ vc_dispmanx_display_close(display ); - } - if (pstride) - *pstride = stride; - return image; - } - -- --static void vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *arg) --{ -- CEvent *sync = (CEvent *)arg; -- sync->Set(); --} -- --void CRBP::WaitVsync() -+void CRBP::WaitVsync(void) - { -- int s; -- CEvent sync; -- DISPMANX_DISPLAY_HANDLE_T m_display = vc_dispmanx_display_open( 0 /*screen*/ ); -- if (m_display == DISPMANX_NO_HANDLE) -- { -- CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); -- return; -- } -- s = vc_dispmanx_vsync_callback(m_display, vsync_callback, (void *)&sync); -- if (s == 0) -- { -- sync.Wait(); -- } -- else assert(0); -- s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); -- assert(s == 0); -- vc_dispmanx_display_close( m_display ); -+ DISPMANX_DISPLAY_HANDLE_T display = vc_dispmanx_display_open( 0 /*screen*/ ); -+ DISPMANX_UPDATE_HANDLE_T update = vc_dispmanx_update_start(0); -+ -+ VC_DISPMANX_ALPHA_T alpha = { (DISPMANX_FLAGS_ALPHA_T)(DISPMANX_FLAGS_ALPHA_FROM_SOURCE | DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS), 120, /*alpha 0->255*/ 0 }; -+ VC_RECT_T src_rect; -+ VC_RECT_T dst_rect; -+ vc_dispmanx_rect_set( &src_rect, 0, 0, 1 << 16, 1 << 16 ); -+ vc_dispmanx_rect_set( &dst_rect, 0, 0, 1, 1 ); -+ -+ if (m_element) -+ vc_dispmanx_element_remove( update, m_element ); -+ -+ m_element = vc_dispmanx_element_add( update, -+ display, -+ 2000, // layer -+ &dst_rect, -+ m_resource, -+ &src_rect, -+ DISPMANX_PROTECTION_NONE, -+ &alpha, -+ NULL, // clamp -+ (DISPMANX_TRANSFORM_T)0 ); -+ -+ vc_dispmanx_update_submit_sync(update); -+ vc_dispmanx_display_close( display ); - } - - -@@ -212,9 +206,6 @@ void CRBP::Deinitialize() - if(m_omx_initialized) - m_OMX->Deinitialize(); - -- if (m_display) -- CloseDisplay(m_display); -- - m_DllBcmHost->bcm_host_deinit(); - - if(m_initialized) -diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index 4e4156d..606c24f 100644 ---- a/xbmc/linux/RBP.h -+++ b/xbmc/linux/RBP.h -@@ -53,8 +53,6 @@ class CRBP - bool GetCodecMpg2() { return m_codec_mpg2_enabled; } - bool GetCodecWvc1() { return m_codec_wvc1_enabled; } - void GetDisplaySize(int &width, int &height); -- DISPMANX_DISPLAY_HANDLE_T OpenDisplay(uint32_t device); -- void CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display); - int GetGUIResolutionLimit() { return m_gui_resolution_limit; } - // stride can be null for packed output - unsigned char *CaptureDisplay(int width, int height, int *stride, bool swap_red_blue, bool video_only = true); -@@ -76,9 +74,10 @@ class CRBP - bool m_codec_mpg2_enabled; - bool m_codec_wvc1_enabled; - COMXCore *m_OMX; -+ DISPMANX_RESOURCE_HANDLE_T m_resource; -+ DISPMANX_ELEMENT_HANDLE_T m_element; - class DllLibOMXCore; - CCriticalSection m_critSection; -- DISPMANX_DISPLAY_HANDLE_T m_display; - }; - - extern CRBP g_RBP; -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index b6bf1fc..1529045 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -306,7 +306,7 @@ bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) - m_desktopRes = res; - } - -- m_dispman_display = g_RBP.OpenDisplay(0); -+ m_dispman_display = m_DllBcmHost->vc_dispmanx_display_open(0); - - m_width = res.iWidth; - m_height = res.iHeight; -@@ -571,7 +571,7 @@ void CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow() - - if (m_dispman_display != DISPMANX_NO_HANDLE) - { -- g_RBP.CloseDisplay(m_dispman_display); -+ m_DllBcmHost->vc_dispmanx_display_close(m_dispman_display); - m_dispman_display = DISPMANX_NO_HANDLE; - } - DLOG("CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow\n"); - -From 58902550684363c65d6c50b8cf958b1d19f283f8 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Nov 2014 17:16:54 +0000 -Subject: [PATCH 083/102] Revert "[omxplayer] Add ability to dump out - audio/video data for later debugging" - -This reverts commit 417416bd29d00f1b42c77488d06e9e6840b8c4f4. ---- - language/English/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/language/English/strings.po b/language/English/strings.po -index 83179a5..71b3ebf 100755 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -2897,16 +2897,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 f01c83b..a3b6ba6 100644 ---- a/xbmc/commons/ilog.h -+++ b/xbmc/commons/ilog.h -@@ -55,8 +55,6 @@ - #define LOGCEC (1 << (LOGMASKBIT + 10)) - #define LOGVIDEO (1 << (LOGMASKBIT + 11)) - #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 6be2b76..ef4c3d4 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -55,49 +55,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 - ////////////////////////////////////////////////////////////////////// -@@ -910,7 +867,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) - { -@@ -980,8 +935,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 - int nRetry = 0; - while(true) - { -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err == OMX_ErrorNone) - { -@@ -1518,7 +1470,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 b6bc525..dea0e11 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; -@@ -163,7 +120,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) - { -@@ -757,7 +713,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) -@@ -876,7 +831,6 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) - int nRetry = 0; - while(true) - { -- dump_omx_buffer(omx_buffer); - omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); - if (omx_err == OMX_ErrorNone) - { -@@ -1007,7 +961,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 dc7835a..f1d4be3 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1395,10 +1395,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 e379a7e8f08661a5a02ca1aa1af6a0128b6075e1 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 084/102] [omxplayer] Add ability to dump out audio/video data - for later debugging - ---- - language/English/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/language/English/strings.po b/language/English/strings.po -index 71b3ebf..83179a5 100755 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -2897,6 +2897,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 a3b6ba6..f01c83b 100644 ---- a/xbmc/commons/ilog.h -+++ b/xbmc/commons/ilog.h -@@ -55,6 +55,8 @@ - #define LOGCEC (1 << (LOGMASKBIT + 10)) - #define LOGVIDEO (1 << (LOGMASKBIT + 11)) - #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 67cdefc..7662730 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -95,6 +95,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); -@@ -938,6 +993,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) -@@ -3324,6 +3385,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 f1d4be3..dc7835a 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1395,6 +1395,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 5004d81176b3f5ae1d24d17bf6ab32089301883b Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Wed, 19 Nov 2014 14:22:01 +0100 -Subject: [PATCH 085/102] dvdplayer: fix audio error at beginning of playback - ---- - xbmc/cores/dvdplayer/DVDAudio.cpp | 90 ++++++--------------------------- - xbmc/cores/dvdplayer/DVDAudio.h | 18 +------ - xbmc/cores/dvdplayer/DVDPlayerAudio.cpp | 2 + - xbmc/cores/dvdplayer/DVDPlayerAudio.h | 1 - - 4 files changed, 19 insertions(+), 92 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDAudio.cpp b/xbmc/cores/dvdplayer/DVDAudio.cpp -index 6514030..e1f8474 100644 ---- a/xbmc/cores/dvdplayer/DVDAudio.cpp -+++ b/xbmc/cores/dvdplayer/DVDAudio.cpp -@@ -31,66 +31,6 @@ - using namespace std; - - --CPTSOutputQueue::CPTSOutputQueue() --{ -- Flush(); --} -- --void CPTSOutputQueue::Add(double pts, double delay, double duration, double timestamp) --{ -- CSingleLock lock(m_sync); -- -- // don't accept a re-add, since that would cause time moving back -- double last = m_queue.empty() ? m_current.pts : m_queue.back().pts; -- if(last == pts) -- return; -- -- TPTSItem item; -- item.pts = pts; -- item.timestamp = timestamp + delay; -- item.duration = duration; -- -- // first one is applied directly -- if(m_queue.empty() && m_current.pts == DVD_NOPTS_VALUE) -- m_current = item; -- else -- m_queue.push(item); -- -- // call function to make sure the queue -- // doesn't grow should nobody call it -- Current(timestamp); --} --void CPTSOutputQueue::Flush() --{ -- CSingleLock lock(m_sync); -- -- while( !m_queue.empty() ) m_queue.pop(); -- m_current.pts = DVD_NOPTS_VALUE; -- m_current.timestamp = 0.0; -- m_current.duration = 0.0; --} -- --double CPTSOutputQueue::Current(double timestamp) --{ -- CSingleLock lock(m_sync); -- -- if(!m_queue.empty() && m_current.pts == DVD_NOPTS_VALUE) -- { -- m_current = m_queue.front(); -- m_queue.pop(); -- } -- -- while( !m_queue.empty() && timestamp >= m_queue.front().timestamp ) -- { -- m_current = m_queue.front(); -- m_queue.pop(); -- } -- -- if( m_current.timestamp == 0 ) return m_current.pts; -- -- return m_current.pts + min(m_current.duration, (timestamp - m_current.timestamp)); --} -- - CDVDAudio::CDVDAudio(volatile bool &bStop) - : m_bStop(bStop) - { -@@ -160,13 +100,16 @@ void CDVDAudio::Destroy() - m_iBitsPerSample = 0; - m_bPassthrough = false; - m_bPaused = true; -- m_time.Flush(); -+ m_playingPts = DVD_NOPTS_VALUE; - } - - unsigned int CDVDAudio::AddPackets(const DVDAudioFrame &audioframe) - { - CSingleLock lock (m_critSection); - -+ m_playingPts = audioframe.pts - GetDelay(); -+ m_timeOfPts = CDVDClock::GetAbsoluteClock(); -+ - if(!m_pAudioStream) - return 0; - -@@ -198,11 +141,6 @@ unsigned int CDVDAudio::AddPackets(const DVDAudioFrame &audioframe) - lock.Enter(); - } while (!m_bStop); - -- double time_added = DVD_SEC_TO_TIME(m_SecondsPerByte * audioframe.nb_frames * audioframe.framesize); -- double delay = GetDelay(); -- double timestamp = CDVDClock::GetAbsoluteClock(); -- m_time.Add(audioframe.pts, delay - time_added, audioframe.duration, timestamp); -- - return total - frames; - } - -@@ -246,8 +184,9 @@ float CDVDAudio::GetCurrentAttenuation() - void CDVDAudio::Pause() - { - CSingleLock lock (m_critSection); -- if (m_pAudioStream) m_pAudioStream->Pause(); -- m_time.Flush(); -+ if (m_pAudioStream) -+ m_pAudioStream->Pause(); -+ m_playingPts = DVD_NOPTS_VALUE; - } - - void CDVDAudio::Resume() -@@ -275,7 +214,7 @@ void CDVDAudio::Flush() - { - m_pAudioStream->Flush(); - } -- m_time.Flush(); -+ m_playingPts = DVD_NOPTS_VALUE; - } - - bool CDVDAudio::IsValidFormat(const DVDAudioFrame &audioframe) -@@ -325,14 +264,15 @@ double CDVDAudio::GetCacheTotal() - - void CDVDAudio::SetPlayingPts(double pts) - { -- CSingleLock lock (m_critSection); -- m_time.Flush(); -- double delay = GetDelay(); -- double timestamp = CDVDClock::GetAbsoluteClock(); -- m_time.Add(pts, delay, 0, timestamp); -+ CSingleLock lock(m_critSection); -+ m_playingPts = pts - GetDelay(); -+ m_timeOfPts = CDVDClock::GetAbsoluteClock(); - } - - double CDVDAudio::GetPlayingPts() - { -- return m_time.Current(CDVDClock::GetAbsoluteClock()); -+ if (m_playingPts == DVD_NOPTS_VALUE) -+ return 0.0; -+ -+ return m_playingPts + CDVDClock::GetAbsoluteClock() - m_timeOfPts; - } -diff --git a/xbmc/cores/dvdplayer/DVDAudio.h b/xbmc/cores/dvdplayer/DVDAudio.h -index 629fb32..057a40a 100644 ---- a/xbmc/cores/dvdplayer/DVDAudio.h -+++ b/xbmc/cores/dvdplayer/DVDAudio.h -@@ -36,21 +36,6 @@ extern "C" { - - typedef struct stDVDAudioFrame DVDAudioFrame; - --class CPTSOutputQueue --{ --private: -- typedef struct {double pts; double timestamp; double duration;} TPTSItem; -- TPTSItem m_current; -- std::queue m_queue; -- CCriticalSection m_sync; -- --public: -- CPTSOutputQueue(); -- void Add(double pts, double delay, double duration, double timestamp); -- void Flush(); -- double Current(double timestamp); --}; -- - class CSingleLock; - - class CDVDAudio -@@ -82,7 +67,8 @@ class CDVDAudio - - IAEStream *m_pAudioStream; - protected: -- CPTSOutputQueue m_time; -+ double m_playingPts; -+ double m_timeOfPts; - CCriticalSection m_critSection; - - int m_iBitrate; -diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -index a1b6f4d..36f70e8 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -@@ -650,6 +650,8 @@ void CDVDPlayerAudio::HandleSyncError(double duration) - double error = m_dvdAudio.GetPlayingPts() - clock; - EMasterClock master = m_pClock->GetMaster(); - -+ CLog::Log(LOGNOTICE, "---------------- error: %f", error/1000); -+ - if( (fabs(error) > DVD_MSEC_TO_TIME(100) || m_syncclock) - && (master == MASTER_CLOCK_AUDIO - || master == MASTER_CLOCK_AUDIO_VIDEOREF) ) -diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.h b/xbmc/cores/dvdplayer/DVDPlayerAudio.h -index 37bf4bd..f9f19bc 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerAudio.h -+++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.h -@@ -134,7 +134,6 @@ class CDVDPlayerAudio : public CThread, public IDVDStreamPlayerAudio - // holds stream information for current playing stream - CDVDStreamInfo m_streaminfo; - -- CPTSOutputQueue m_ptsOutput; - CPTSInputQueue m_ptsInput; - - double GetCurrentPts() { CSingleLock lock(m_info_section); return m_info.pts; } - -From 368a98bdc365a6f805cf979bfda14ad373d378ae Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 19 Nov 2014 20:57:10 +0000 -Subject: [PATCH 086/102] [dvdplayeraudio] Remove logging message - ---- - xbmc/cores/dvdplayer/DVDPlayerAudio.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -index 36f70e8..fcd2e88 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -@@ -650,7 +650,7 @@ void CDVDPlayerAudio::HandleSyncError(double duration) - double error = m_dvdAudio.GetPlayingPts() - clock; - EMasterClock master = m_pClock->GetMaster(); - -- CLog::Log(LOGNOTICE, "---------------- error: %f", error/1000); -+ //CLog::Log(LOGNOTICE, "---------------- error: %f playingpts:%f clock:%f", error/1000, m_dvdAudio.GetPlayingPts()*1e-6, clock*1e-6); - - if( (fabs(error) > DVD_MSEC_TO_TIME(100) || m_syncclock) - && (master == MASTER_CLOCK_AUDIO - -From 8c2f3632e5f2a0fbe3670219b61f8ab342a4c0ad Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Mon, 30 Jun 2014 00:19:21 +0200 -Subject: [PATCH 087/102] gl: avoid grabbing viewport on each render - -Same as 518556b45b61de06a0bc810147cd1a6347497461 but for GL ---- - xbmc/rendering/gl/RenderSystemGL.cpp | 28 ++++++++++++---------------- - 1 file changed, 12 insertions(+), 16 deletions(-) - -diff --git a/xbmc/rendering/gl/RenderSystemGL.cpp b/xbmc/rendering/gl/RenderSystemGL.cpp -index 58840c4..c01f129 100644 ---- a/xbmc/rendering/gl/RenderSystemGL.cpp -+++ b/xbmc/rendering/gl/RenderSystemGL.cpp -@@ -182,8 +182,8 @@ bool CRenderSystemGL::ResetRenderSystem(int width, int height, bool fullScreen, - - CalculateMaxTexturesize(); - -- glViewport(0, 0, width, height); -- glScissor(0, 0, width, height); -+ CRect rect( 0, 0, width, height ); -+ SetViewPort( rect ); - - glEnable(GL_TEXTURE_2D); - glEnable(GL_SCISSOR_TEST); -@@ -393,8 +393,6 @@ void CRenderSystemGL::CaptureStateBlock() - if (!m_bRenderCreated) - return; - -- glGetIntegerv(GL_VIEWPORT, m_viewPort); -- - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glMatrixMode(GL_TEXTURE); -@@ -438,11 +436,9 @@ void CRenderSystemGL::SetCameraPosition(const CPoint &camera, int screenWidth, i - - CPoint offset = camera - CPoint(screenWidth*0.5f, screenHeight*0.5f); - -- GLint viewport[4]; -- glGetIntegerv(GL_VIEWPORT, viewport); - -- float w = (float)viewport[2]*0.5f; -- float h = (float)viewport[3]*0.5f; -+ float w = (float)m_viewPort[2]*0.5f; -+ float h = (float)m_viewPort[3]*0.5f; - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -@@ -453,7 +449,6 @@ void CRenderSystemGL::SetCameraPosition(const CPoint &camera, int screenWidth, i - glFrustum( (-w - offset.x)*0.5f, (w - offset.x)*0.5f, (-h + offset.y)*0.5f, (h + offset.y)*0.5f, h, 100*h); - glMatrixMode(GL_MODELVIEW); - -- glGetIntegerv(GL_VIEWPORT, m_viewPort); - glGetDoublev(GL_MODELVIEW_MATRIX, m_view); - glGetDoublev(GL_PROJECTION_MATRIX, m_projection); - -@@ -570,13 +565,10 @@ void CRenderSystemGL::GetViewPort(CRect& viewPort) - if (!m_bRenderCreated) - return; - -- GLint glvp[4]; -- glGetIntegerv(GL_VIEWPORT, glvp); -- -- viewPort.x1 = glvp[0]; -- viewPort.y1 = m_height - glvp[1] - glvp[3]; -- viewPort.x2 = glvp[0] + glvp[2]; -- viewPort.y2 = viewPort.y1 + glvp[3]; -+ viewPort.x1 = m_viewPort[0]; -+ viewPort.y1 = m_height - m_viewPort[1] - m_viewPort[3]; -+ viewPort.x2 = m_viewPort[0] + m_viewPort[2]; -+ viewPort.y2 = viewPort.y1 + m_viewPort[3]; - } - - void CRenderSystemGL::SetViewPort(CRect& viewPort) -@@ -586,6 +578,10 @@ void CRenderSystemGL::SetViewPort(CRect& viewPort) - - glScissor((GLint) viewPort.x1, (GLint) (m_height - viewPort.y1 - viewPort.Height()), (GLsizei) viewPort.Width(), (GLsizei) viewPort.Height()); - glViewport((GLint) viewPort.x1, (GLint) (m_height - viewPort.y1 - viewPort.Height()), (GLsizei) viewPort.Width(), (GLsizei) viewPort.Height()); -+ m_viewPort[0] = viewPort.x1; -+ m_viewPort[1] = m_height - viewPort.y1 - viewPort.Height(); -+ m_viewPort[2] = viewPort.Width(); -+ m_viewPort[3] = viewPort.Height(); - } - - void CRenderSystemGL::SetScissors(const CRect &rect) - -From bc38e82b95d88a7f84a46bdc9fe188da6068556d Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Fri, 21 Nov 2014 00:15:49 +0100 -Subject: [PATCH 088/102] GL: switch to CPU based matrix caculations to match - GLES - -This drops use of glGet which causes a performance hit on some systems since -it forces a glFinish() ---- - xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 49 ++++++++----- - xbmc/cores/VideoRenderers/OverlayRendererGL.cpp | 20 +++--- - xbmc/guilib/MatrixGLES.cpp | 2 +- - xbmc/rendering/gl/RenderSystemGL.cpp | 96 ++++++++++++++++--------- - xbmc/rendering/gl/RenderSystemGL.h | 2 - - 5 files changed, 103 insertions(+), 66 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index ae7f649..b34e8eb 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -39,6 +39,7 @@ - #include "windowing/WindowingFactory.h" - #include "guilib/Texture.h" - #include "guilib/LocalizeStrings.h" -+#include "guilib/MatrixGLES.h" - #include "threads/SingleLock.h" - #include "utils/log.h" - #include "utils/GLUtils.h" -@@ -1383,21 +1384,22 @@ void CLinuxRendererGL::RenderToFBO(int index, int field, bool weave /*= false*/) - - glPushAttrib(GL_VIEWPORT_BIT); - glPushAttrib(GL_SCISSOR_BIT); -- glMatrixMode(GL_MODELVIEW); -- glPushMatrix(); -- glLoadIdentity(); -- VerifyGLState(); -+ g_matrices.MatrixMode(MM_MODELVIEW); -+ g_matrices.PushMatrix(); -+ g_matrices.LoadIdentity(); -+ -+ g_matrices.MatrixMode(MM_PROJECTION); -+ g_matrices.PushMatrix(); -+ g_matrices.LoadIdentity(); -+ g_matrices.Ortho2D(0, m_sourceWidth, 0, m_sourceHeight); - -- glMatrixMode(GL_PROJECTION); -- glPushMatrix(); -- glLoadIdentity(); -- VerifyGLState(); -- gluOrtho2D(0, m_sourceWidth, 0, m_sourceHeight); - glViewport(0, 0, m_sourceWidth, m_sourceHeight); - glScissor (0, 0, m_sourceWidth, m_sourceHeight); -- glMatrixMode(GL_MODELVIEW); -- VerifyGLState(); - -+ glMatrixMode(GL_PROJECTION); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_PROJECTION)); -+ glMatrixMode(GL_MODELVIEW); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); - - if (!m_pYUVShader->Enable()) - { -@@ -1444,13 +1446,18 @@ void CLinuxRendererGL::RenderToFBO(int index, int field, bool weave /*= false*/) - - m_pYUVShader->Disable(); - -- glMatrixMode(GL_MODELVIEW); -- glPopMatrix(); // pop modelview -+ g_matrices.MatrixMode(MM_PROJECTION); -+ g_matrices.PopMatrix(); -+ g_matrices.MatrixMode(MM_MODELVIEW); -+ g_matrices.PopMatrix(); -+ - glMatrixMode(GL_PROJECTION); -- glPopMatrix(); // pop projection -+ glLoadMatrixf(g_matrices.GetMatrix(MM_PROJECTION)); -+ glMatrixMode(GL_MODELVIEW); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); -+ - glPopAttrib(); // pop scissor - glPopAttrib(); // pop viewport -- glMatrixMode(GL_MODELVIEW); - VerifyGLState(); - - m_fbo.fbo.EndRender(); -@@ -1684,10 +1691,12 @@ bool CLinuxRendererGL::RenderCapture(CRenderCapture* capture) - //invert Y axis to get non-inverted image - glDisable(GL_BLEND); - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); -+ g_matrices.MatrixMode(MM_MODELVIEW); -+ g_matrices.PushMatrix(); -+ g_matrices.Translatef(0, capture->GetHeight(), 0); -+ g_matrices.Scalef(1.0, -1.0f, 1.0f); - glMatrixMode(GL_MODELVIEW); -- glPushMatrix(); -- glTranslatef(0, capture->GetHeight(), 0); -- glScalef(1.0, -1.0f, 1.0f); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); - - capture->BeginRender(); - -@@ -1699,8 +1708,10 @@ bool CLinuxRendererGL::RenderCapture(CRenderCapture* capture) - capture->EndRender(); - - // revert model view matrix -+ g_matrices.MatrixMode(MM_MODELVIEW); -+ g_matrices.PopMatrix(); - glMatrixMode(GL_MODELVIEW); -- glPopMatrix(); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); - - // restore original video rect - m_destRect = saveSize; -diff --git a/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp b/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp -index 8684567..7eefea8 100644 ---- a/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp -@@ -27,8 +27,8 @@ - #include "LinuxRendererGL.h" - #elif HAS_GLES == 2 - #include "LinuxRendererGLES.h" -- #include "guilib/MatrixGLES.h" - #endif -+#include "guilib/MatrixGLES.h" - #include "RenderManager.h" - #include "cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayImage.h" - #include "cores/dvdplayer/DVDCodecs/Overlay/DVDOverlaySpu.h" -@@ -417,6 +417,11 @@ void COverlayGlyphGL::Render(SRenderState& state) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - -+ g_matrices.MatrixMode(MM_MODELVIEW); -+ g_matrices.PushMatrix(); -+ g_matrices.Translatef(state.x, state.y, 0.0f); -+ g_matrices.Scalef(state.width, state.height, 1.0f); -+ - #ifdef HAS_GL - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); -@@ -431,9 +436,7 @@ void COverlayGlyphGL::Render(SRenderState& state) - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); - - glMatrixMode(GL_MODELVIEW); -- glPushMatrix(); -- glTranslatef(state.x , state.y , 0.0f); -- glScalef (state.width, state.height, 1.0f); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); - - VerifyGLState(); - -@@ -448,14 +451,9 @@ void COverlayGlyphGL::Render(SRenderState& state) - glDrawArrays(GL_QUADS, 0, m_count * 4); - glPopClientAttrib(); - -- glPopMatrix(); -+ g_matrices.PopMatrix(); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); - #else -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PushMatrix(); -- g_matrices.Translatef(state.x, state.y, 0.0f); -- g_matrices.Scalef(state.width, state.height, 1.0f); -- VerifyGLState(); -- - g_Windowing.EnableGUIShader(SM_FONTS); - - GLint posLoc = g_Windowing.GUIShaderGetPos(); -diff --git a/xbmc/guilib/MatrixGLES.cpp b/xbmc/guilib/MatrixGLES.cpp -index af3fe47..06be95d 100644 ---- a/xbmc/guilib/MatrixGLES.cpp -+++ b/xbmc/guilib/MatrixGLES.cpp -@@ -21,7 +21,7 @@ - - #include "system.h" - --#if HAS_GLES == 2 -+#if defined(HAS_GL) || HAS_GLES == 2 - #include "system_gl.h" - - #include -diff --git a/xbmc/rendering/gl/RenderSystemGL.cpp b/xbmc/rendering/gl/RenderSystemGL.cpp -index c01f129..664aa5b 100644 ---- a/xbmc/rendering/gl/RenderSystemGL.cpp -+++ b/xbmc/rendering/gl/RenderSystemGL.cpp -@@ -26,6 +26,7 @@ - #include "RenderSystemGL.h" - #include "guilib/GraphicContext.h" - #include "settings/AdvancedSettings.h" -+#include "guilib/MatrixGLES.h" - #include "settings/DisplaySettings.h" - #include "utils/log.h" - #include "utils/GLUtils.h" -@@ -188,10 +189,22 @@ bool CRenderSystemGL::ResetRenderSystem(int width, int height, bool fullScreen, - glEnable(GL_TEXTURE_2D); - glEnable(GL_SCISSOR_TEST); - -+ g_matrices.MatrixMode(MM_PROJECTION); -+ g_matrices.LoadIdentity(); -+ -+ g_matrices.Ortho(0.0f, width-1, height-1, 0.0f, -1.0f, 1.0f); -+ -+ g_matrices.MatrixMode(MM_MODELVIEW); -+ g_matrices.LoadIdentity(); -+ -+ g_matrices.MatrixMode(MM_TEXTURE); -+ g_matrices.LoadIdentity(); -+ - //ati doesn't init the texture matrix correctly - //so we have to do it ourselves - glMatrixMode(GL_TEXTURE); -- glLoadIdentity(); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_TEXTURE)); -+ - if (glewIsSupported("GL_ARB_multitexture")) - { - //clear error flags -@@ -217,18 +230,15 @@ bool CRenderSystemGL::ResetRenderSystem(int width, int height, bool fullScreen, - for (GLint i = 0; i < maxtex; i++) - { - glActiveTextureARB(GL_TEXTURE0 + i); -- glLoadIdentity(); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_TEXTURE)); - } - glActiveTextureARB(GL_TEXTURE0); - } - - glMatrixMode(GL_PROJECTION); -- glLoadIdentity(); -- -- glOrtho(0.0f, width-1, height-1, 0.0f, -1.0f, 1.0f); -- -+ glLoadMatrixf(g_matrices.GetMatrix(MM_PROJECTION)); - glMatrixMode(GL_MODELVIEW); -- glLoadIdentity(); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); - - glBlendFunc(GL_SRC_ALPHA, GL_ONE); - glEnable(GL_BLEND); // Turn Blending On -@@ -392,13 +402,19 @@ void CRenderSystemGL::CaptureStateBlock() - { - if (!m_bRenderCreated) - return; -- -+ -+ g_matrices.MatrixMode(MM_PROJECTION); -+ g_matrices.PushMatrix(); -+ g_matrices.MatrixMode(MM_TEXTURE); -+ g_matrices.PushMatrix(); -+ g_matrices.MatrixMode(MM_MODELVIEW); -+ g_matrices.PushMatrix(); - glMatrixMode(GL_PROJECTION); -- glPushMatrix(); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_PROJECTION)); - glMatrixMode(GL_TEXTURE); -- glPushMatrix(); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_TEXTURE)); - glMatrixMode(GL_MODELVIEW); -- glPushMatrix(); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); - glDisable(GL_SCISSOR_TEST); // fixes FBO corruption on Macs - if (glActiveTextureARB) - glActiveTextureARB(GL_TEXTURE0_ARB); -@@ -413,12 +429,20 @@ void CRenderSystemGL::ApplyStateBlock() - return; - - glViewport(m_viewPort[0], m_viewPort[1], m_viewPort[2], m_viewPort[3]); -+ -+ g_matrices.MatrixMode(MM_PROJECTION); -+ g_matrices.PopMatrix(); -+ g_matrices.MatrixMode(MM_TEXTURE); -+ g_matrices.PopMatrix(); -+ g_matrices.MatrixMode(MM_MODELVIEW); -+ g_matrices.PopMatrix(); -+ - glMatrixMode(GL_PROJECTION); -- glPopMatrix(); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_PROJECTION)); - glMatrixMode(GL_TEXTURE); -- glPopMatrix(); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_TEXTURE)); - glMatrixMode(GL_MODELVIEW); -- glPopMatrix(); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); - if (glActiveTextureARB) - glActiveTextureARB(GL_TEXTURE0_ARB); - glEnable(GL_TEXTURE_2D); -@@ -440,27 +464,29 @@ void CRenderSystemGL::SetCameraPosition(const CPoint &camera, int screenWidth, i - float w = (float)m_viewPort[2]*0.5f; - float h = (float)m_viewPort[3]*0.5f; - -- glMatrixMode(GL_MODELVIEW); -- glLoadIdentity(); -- glTranslatef(-(w + offset.x), +(h + offset.y), 0); -- gluLookAt(0.0, 0.0, -2.0*h, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0); -+ g_matrices.MatrixMode(MM_MODELVIEW); -+ g_matrices.LoadIdentity(); -+ g_matrices.Translatef(-(w + offset.x), +(h + offset.y), 0); -+ g_matrices.LookAt(0.0, 0.0, -2.0*h, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0); -+ g_matrices.MatrixMode(MM_PROJECTION); -+ g_matrices.LoadIdentity(); -+ g_matrices.Frustum( (-w - offset.x)*0.5f, (w - offset.x)*0.5f, (-h + offset.y)*0.5f, (h + offset.y)*0.5f, h, 100*h); -+ g_matrices.MatrixMode(MM_MODELVIEW); -+ - glMatrixMode(GL_PROJECTION); -- glLoadIdentity(); -- glFrustum( (-w - offset.x)*0.5f, (w - offset.x)*0.5f, (-h + offset.y)*0.5f, (h + offset.y)*0.5f, h, 100*h); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_PROJECTION)); - glMatrixMode(GL_MODELVIEW); -- -- glGetDoublev(GL_MODELVIEW_MATRIX, m_view); -- glGetDoublev(GL_PROJECTION_MATRIX, m_projection); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); - - g_graphicsContext.EndPaint(); - } - - void CRenderSystemGL::Project(float &x, float &y, float &z) - { -- GLdouble coordX, coordY, coordZ; -- if (gluProject(x, y, z, m_view, m_projection, m_viewPort, &coordX, &coordY, &coordZ) == GLU_TRUE) -+ GLfloat coordX, coordY, coordZ; -+ if (g_matrices.Project(x, y, z, g_matrices.GetMatrix(MM_MODELVIEW), g_matrices.GetMatrix(MM_PROJECTION), m_viewPort, &coordX, &coordY, &coordZ)) - { -- x = (float)coordX; -+ x = coordX; - y = (float)(m_viewPort[1] + m_viewPort[3] - coordY); - z = 0; - } -@@ -489,12 +515,12 @@ void CRenderSystemGL::ApplyHardwareTransform(const TransformMatrix &finalMatrix) - if (!m_bRenderCreated) - return; - -- glMatrixMode(GL_MODELVIEW); -- glPushMatrix(); -+ g_matrices.MatrixMode(MM_MODELVIEW); -+ g_matrices.PushMatrix(); - GLfloat matrix[4][4]; - -- for(int i=0;i<3;i++) -- for(int j=0;j<4;j++) -+ for(int i = 0; i < 3; i++) -+ for(int j = 0; j < 4; j++) - matrix[j][i] = finalMatrix.m[i][j]; - - matrix[0][3] = 0.0f; -@@ -502,7 +528,10 @@ void CRenderSystemGL::ApplyHardwareTransform(const TransformMatrix &finalMatrix) - matrix[2][3] = 0.0f; - matrix[3][3] = 1.0f; - -- glMultMatrixf(&matrix[0][0]); -+ g_matrices.MultMatrixf(&matrix[0][0]); -+ -+ glMatrixMode(GL_MODELVIEW); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); - } - - void CRenderSystemGL::RestoreHardwareTransform() -@@ -510,8 +539,9 @@ void CRenderSystemGL::RestoreHardwareTransform() - if (!m_bRenderCreated) - return; - -- glMatrixMode(GL_MODELVIEW); -- glPopMatrix(); -+ g_matrices.MatrixMode(MM_MODELVIEW); -+ g_matrices.PopMatrix(); -+ glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); - } - - void CRenderSystemGL::CalculateMaxTexturesize() -diff --git a/xbmc/rendering/gl/RenderSystemGL.h b/xbmc/rendering/gl/RenderSystemGL.h -index 28d4b78..624ddef 100644 ---- a/xbmc/rendering/gl/RenderSystemGL.h -+++ b/xbmc/rendering/gl/RenderSystemGL.h -@@ -91,8 +91,6 @@ class CRenderSystemGL : public CRenderSystemBase - int m_glslMajor; - int m_glslMinor; - -- GLdouble m_view[16]; -- GLdouble m_projection[16]; - GLint m_viewPort[4]; - }; - - -From cdd93978bd6310bbd21319608b4a65bba65a3009 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Fri, 21 Nov 2014 01:47:07 +0100 -Subject: [PATCH 089/102] GL(ES): Simplify matrix stack handling - ---- - xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 47 ++++------ - xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp | 39 +++----- - xbmc/cores/VideoRenderers/OverlayRendererGL.cpp | 16 ++-- - xbmc/guilib/GUIShader.cpp | 4 +- - xbmc/guilib/MatrixGLES.cpp | 120 +++++++----------------- - xbmc/guilib/MatrixGLES.h | 95 +++++++++++-------- - xbmc/rendering/gl/RenderSystemGL.cpp | 97 ++++++------------- - xbmc/rendering/gles/RenderSystemGLES.cpp | 75 +++++++-------- - xbmc/rendering/gles/RenderSystemGLES.h | 2 - - 9 files changed, 192 insertions(+), 303 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index b34e8eb..c68c3e6 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -1384,23 +1384,19 @@ void CLinuxRendererGL::RenderToFBO(int index, int field, bool weave /*= false*/) - - glPushAttrib(GL_VIEWPORT_BIT); - glPushAttrib(GL_SCISSOR_BIT); -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PushMatrix(); -- g_matrices.LoadIdentity(); - -- g_matrices.MatrixMode(MM_PROJECTION); -- g_matrices.PushMatrix(); -- g_matrices.LoadIdentity(); -- g_matrices.Ortho2D(0, m_sourceWidth, 0, m_sourceHeight); -+ glMatrixModview.Push(); -+ glMatrixModview->LoadIdentity(); -+ glMatrixModview.Load(); -+ -+ glMatrixProject.Push(); -+ glMatrixProject->LoadIdentity(); -+ glMatrixProject->Ortho2D(0, m_sourceWidth, 0, m_sourceHeight); -+ glMatrixProject.Load(); - - glViewport(0, 0, m_sourceWidth, m_sourceHeight); - glScissor (0, 0, m_sourceWidth, m_sourceHeight); - -- glMatrixMode(GL_PROJECTION); -- glLoadMatrixf(g_matrices.GetMatrix(MM_PROJECTION)); -- glMatrixMode(GL_MODELVIEW); -- glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); -- - if (!m_pYUVShader->Enable()) - { - CLog::Log(LOGERROR, "GL: Error enabling YUV shader"); -@@ -1446,15 +1442,8 @@ void CLinuxRendererGL::RenderToFBO(int index, int field, bool weave /*= false*/) - - m_pYUVShader->Disable(); - -- g_matrices.MatrixMode(MM_PROJECTION); -- g_matrices.PopMatrix(); -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PopMatrix(); -- -- glMatrixMode(GL_PROJECTION); -- glLoadMatrixf(g_matrices.GetMatrix(MM_PROJECTION)); -- glMatrixMode(GL_MODELVIEW); -- glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); -+ glMatrixModview.PopLoad(); -+ glMatrixProject.PopLoad(); - - glPopAttrib(); // pop scissor - glPopAttrib(); // pop viewport -@@ -1691,12 +1680,11 @@ bool CLinuxRendererGL::RenderCapture(CRenderCapture* capture) - //invert Y axis to get non-inverted image - glDisable(GL_BLEND); - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PushMatrix(); -- g_matrices.Translatef(0, capture->GetHeight(), 0); -- g_matrices.Scalef(1.0, -1.0f, 1.0f); -- glMatrixMode(GL_MODELVIEW); -- glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); -+ -+ glMatrixModview.Push(); -+ glMatrixModview->Translatef(0.0f, capture->GetHeight(), 0.0f); -+ glMatrixModview->Scalef(1.0f, -1.0f, 1.0f); -+ glMatrixModview.Load(); - - capture->BeginRender(); - -@@ -1708,10 +1696,7 @@ bool CLinuxRendererGL::RenderCapture(CRenderCapture* capture) - capture->EndRender(); - - // revert model view matrix -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PopMatrix(); -- glMatrixMode(GL_MODELVIEW); -- glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); -+ glMatrixModview.PopLoad(); - - // restore original video rect - m_destRect = saveSize; -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -index 81fe19b..d1b46a3 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -@@ -1081,7 +1081,7 @@ void CLinuxRendererGLES::RenderSinglePass(int index, int field) - else if(field == FIELD_BOT) - m_pYUVShader->SetField(0); - -- m_pYUVShader->SetMatrices(g_matrices.GetMatrix(MM_PROJECTION), g_matrices.GetMatrix(MM_MODELVIEW)); -+ m_pYUVShader->SetMatrices(glMatrixProject.Get(), glMatrixModview.Get()); - m_pYUVShader->Enable(); - - GLubyte idx[4] = {0, 1, 3, 2}; //determines order of triangle strip -@@ -1141,8 +1141,6 @@ void CLinuxRendererGLES::RenderSinglePass(int index, int field) - glActiveTexture(GL_TEXTURE0); - glDisable(m_textureTarget); - -- g_matrices.MatrixMode(MM_MODELVIEW); -- - VerifyGLState(); - } - -@@ -1207,19 +1205,15 @@ void CLinuxRendererGLES::RenderMultiPass(int index, int field) - //TODO - // glPushAttrib(GL_VIEWPORT_BIT); - // glPushAttrib(GL_SCISSOR_BIT); -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PushMatrix(); -- g_matrices.LoadIdentity(); -- VerifyGLState(); -+ glMatrixModview.Push(); -+ glMatrixModview.LoadIdentity(); -+ -+ glMatrixProject.Push(); -+ glMatrixProject.LoadIdentity(); -+ glMatrixProject->Ortho2D(0, m_sourceWidth, 0, m_sourceHeight); - -- g_matrices.MatrixMode(MM_PROJECTION); -- g_matrices.PushMatrix(); -- g_matrices.LoadIdentity(); -- VerifyGLState(); -- g_matrices.Ortho2D(0, m_sourceWidth, 0, m_sourceHeight); - CRect viewport(0, 0, m_sourceWidth, m_sourceHeight); - g_Windowing.SetViewPort(viewport); -- g_matrices.MatrixMode(MM_MODELVIEW); - VerifyGLState(); - - -@@ -1265,14 +1259,12 @@ void CLinuxRendererGLES::RenderMultiPass(int index, int field) - - m_pYUVShader->Disable(); - -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PopMatrix(); // pop modelview -- g_matrices.MatrixMode(MM_PROJECTION); -- g_matrices.PopMatrix(); // pop projection -+ glMatrixModview.PopLoad(); -+ glMatrixProject.PopLoad(); -+ - //TODO - // glPopAttrib(); // pop scissor - // glPopAttrib(); // pop viewport -- g_matrices.MatrixMode(MM_MODELVIEW); - VerifyGLState(); - - m_fbo.EndRender(); -@@ -1776,17 +1768,17 @@ bool CLinuxRendererGLES::RenderCapture(CRenderCapture* capture) - // clear framebuffer and invert Y axis to get non-inverted image - glDisable(GL_BLEND); - -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PushMatrix(); -+ glMatrixModview.Push(); - // fixme - we know that cvref & eglimg are already flipped in y direction - // but somehow this also effects the rendercapture here - // therefore we have to skip the flip here or we get upside down - // images - if (m_renderMethod != RENDER_CVREF) - { -- g_matrices.Translatef(0.0f, capture->GetHeight(), 0.0f); -- g_matrices.Scalef(1.0f, -1.0f, 1.0f); -+ glMatrixModview->Translatef(0.0f, capture->GetHeight(), 0.0f); -+ glMatrixModview->Scalef(1.0f, -1.0f, 1.0f); - } -+ glMatrixModview.Load(); - - capture->BeginRender(); - -@@ -1806,8 +1798,7 @@ bool CLinuxRendererGLES::RenderCapture(CRenderCapture* capture) - capture->EndRender(); - - // revert model view matrix -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PopMatrix(); -+ glMatrixModview.PopLoad(); - - // restore original video rect - m_destRect = saveSize; -diff --git a/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp b/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp -index 7eefea8..0fe125a 100644 ---- a/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp -@@ -417,10 +417,10 @@ void COverlayGlyphGL::Render(SRenderState& state) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PushMatrix(); -- g_matrices.Translatef(state.x, state.y, 0.0f); -- g_matrices.Scalef(state.width, state.height, 1.0f); -+ glMatrixModview.Push(); -+ glMatrixModview->Translatef(state.x, state.y, 0.0f); -+ glMatrixModview->Scalef(state.width, state.height, 1.0f); -+ glMatrixModview.Load(); - - #ifdef HAS_GL - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); -@@ -435,9 +435,6 @@ void COverlayGlyphGL::Render(SRenderState& state) - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); - -- glMatrixMode(GL_MODELVIEW); -- glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); -- - VerifyGLState(); - - glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); -@@ -451,8 +448,6 @@ void COverlayGlyphGL::Render(SRenderState& state) - glDrawArrays(GL_QUADS, 0, m_count * 4); - glPopClientAttrib(); - -- g_matrices.PopMatrix(); -- glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); - #else - g_Windowing.EnableGUIShader(SM_FONTS); - -@@ -493,9 +488,10 @@ void COverlayGlyphGL::Render(SRenderState& state) - - g_Windowing.DisableGUIShader(); - -- g_matrices.PopMatrix(); - #endif - -+ glMatrixModview.PopLoad(); -+ - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - -diff --git a/xbmc/guilib/GUIShader.cpp b/xbmc/guilib/GUIShader.cpp -index 5d836cee..990f76a 100644 ---- a/xbmc/guilib/GUIShader.cpp -+++ b/xbmc/guilib/GUIShader.cpp -@@ -90,8 +90,8 @@ bool CGUIShader::OnEnabled() - { - // This is called after glUseProgram() - -- GLfloat *projMatrix = g_matrices.GetMatrix(MM_PROJECTION); -- GLfloat *modelMatrix = g_matrices.GetMatrix(MM_MODELVIEW); -+ GLfloat *projMatrix = glMatrixProject.Get(); -+ GLfloat *modelMatrix = glMatrixModview.Get(); - glUniformMatrix4fv(m_hProj, 1, GL_FALSE, projMatrix); - glUniformMatrix4fv(m_hModel, 1, GL_FALSE, modelMatrix); - -diff --git a/xbmc/guilib/MatrixGLES.cpp b/xbmc/guilib/MatrixGLES.cpp -index 06be95d..13d2774 100644 ---- a/xbmc/guilib/MatrixGLES.cpp -+++ b/xbmc/guilib/MatrixGLES.cpp -@@ -31,77 +31,18 @@ - #include "utils/CPUInfo.h" - #endif - --CMatrixGLES g_matrices; - --#define MODE_WITHIN_RANGE(m) ((m >= 0) && (m < (int)MM_MATRIXSIZE)) -- --CMatrixGLES::CMatrixGLES() --{ -- for (unsigned int i=0; i < MM_MATRIXSIZE; i++) -- { -- m_matrices[i].push_back(MatrixWrapper()); -- MatrixMode((EMATRIXMODE)i); -- LoadIdentity(); -- } -- m_matrixMode = (EMATRIXMODE)-1; -- m_pMatrix = NULL; --#if defined(__ARM_NEON__) -- m_has_neon = (g_cpuInfo.GetCPUFeatures() & CPU_FEATURE_NEON) == CPU_FEATURE_NEON; -+#ifdef HAS_GL -+CMatrixGLStack glMatrixModview(GL_MODELVIEW); -+CMatrixGLStack glMatrixProject(GL_PROJECTION); -+CMatrixGLStack glMatrixTexture(GL_TEXTURE); -+#else -+CMatrixGLStack glMatrixModview(0); -+CMatrixGLStack glMatrixProject(0); -+CMatrixGLStack glMatrixTexture(0); - #endif --} -- --CMatrixGLES::~CMatrixGLES() --{ --} -- --GLfloat* CMatrixGLES::GetMatrix(EMATRIXMODE mode) --{ -- if (MODE_WITHIN_RANGE(mode)) -- { -- if (!m_matrices[mode].empty()) -- { -- return m_matrices[mode].back(); -- } -- } -- return NULL; --} -- --void CMatrixGLES::MatrixMode(EMATRIXMODE mode) --{ -- if (MODE_WITHIN_RANGE(mode)) -- { -- m_matrixMode = mode; -- m_pMatrix = m_matrices[mode].back(); -- } -- else -- { -- m_matrixMode = (EMATRIXMODE)-1; -- m_pMatrix = NULL; -- } --} -- --void CMatrixGLES::PushMatrix() --{ -- if (m_pMatrix && MODE_WITHIN_RANGE(m_matrixMode)) -- { -- m_matrices[m_matrixMode].push_back(MatrixWrapper(m_pMatrix)); -- m_pMatrix = m_matrices[m_matrixMode].back(); -- } --} -- --void CMatrixGLES::PopMatrix() --{ -- if (MODE_WITHIN_RANGE(m_matrixMode)) -- { -- if (m_matrices[m_matrixMode].size() > 1) -- { -- m_matrices[m_matrixMode].pop_back(); -- } -- m_pMatrix = m_matrices[m_matrixMode].back(); -- } --} - --void CMatrixGLES::LoadIdentity() -+void CMatrixGL::LoadIdentity() - { - if (m_pMatrix) - { -@@ -112,7 +53,7 @@ void CMatrixGLES::LoadIdentity() - } - } - --void CMatrixGLES::Ortho(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) -+void CMatrixGL::Ortho(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) - { - GLfloat u = 2.0f / (r - l); - GLfloat v = 2.0f / (t - b); -@@ -127,7 +68,7 @@ void CMatrixGLES::Ortho(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, G - MultMatrixf(matrix); - } - --void CMatrixGLES::Ortho2D(GLfloat l, GLfloat r, GLfloat b, GLfloat t) -+void CMatrixGL::Ortho2D(GLfloat l, GLfloat r, GLfloat b, GLfloat t) - { - GLfloat u = 2.0f / (r - l); - GLfloat v = 2.0f / (t - b); -@@ -140,7 +81,7 @@ void CMatrixGLES::Ortho2D(GLfloat l, GLfloat r, GLfloat b, GLfloat t) - MultMatrixf(matrix); - } - --void CMatrixGLES::Frustum(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) -+void CMatrixGL::Frustum(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) - { - GLfloat u = (2.0f * n) / (r - l); - GLfloat v = (2.0f * n) / (t - b); -@@ -155,7 +96,7 @@ void CMatrixGLES::Frustum(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, - MultMatrixf(matrix); - } - --void CMatrixGLES::Translatef(GLfloat x, GLfloat y, GLfloat z) -+void CMatrixGL::Translatef(GLfloat x, GLfloat y, GLfloat z) - { - GLfloat matrix[16] = {1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, -@@ -164,7 +105,7 @@ void CMatrixGLES::Translatef(GLfloat x, GLfloat y, GLfloat z) - MultMatrixf(matrix); - } - --void CMatrixGLES::Scalef(GLfloat x, GLfloat y, GLfloat z) -+void CMatrixGL::Scalef(GLfloat x, GLfloat y, GLfloat z) - { - GLfloat matrix[16] = { x, 0.0f, 0.0f, 0.0f, - 0.0f, y, 0.0f, 0.0f, -@@ -173,7 +114,7 @@ void CMatrixGLES::Scalef(GLfloat x, GLfloat y, GLfloat z) - MultMatrixf(matrix); - } - --void CMatrixGLES::Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) -+void CMatrixGL::Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) - { - GLfloat modulous = sqrt((x*x)+(y*y)+(z*z)); - if (modulous != 0.0) -@@ -242,12 +183,12 @@ inline void Matrix4Mul(const float* src_mat_1, const float* src_mat_2, float* ds - ); - } - #endif --void CMatrixGLES::MultMatrixf(const GLfloat *matrix) -+void CMatrixGL::MultMatrixf(const GLfloat *matrix) - { - if (m_pMatrix) - { - #if defined(__ARM_NEON__) -- if (m_has_neon) -+ if ((g_cpuInfo.GetCPUFeatures() & CPU_FEATURE_NEON) == CPU_FEATURE_NEON) - { - GLfloat m[16]; - Matrix4Mul(m_pMatrix, matrix, m); -@@ -278,7 +219,7 @@ void CMatrixGLES::MultMatrixf(const GLfloat *matrix) - } - - // gluLookAt implementation taken from Mesa3D --void CMatrixGLES::LookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, GLfloat centerx, GLfloat centery, GLfloat centerz, GLfloat upx, GLfloat upy, GLfloat upz) -+void CMatrixGL::LookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, GLfloat centerx, GLfloat centery, GLfloat centerz, GLfloat upx, GLfloat upy, GLfloat upz) - { - GLfloat forward[3], side[3], up[3]; - GLfloat m[4][4]; -@@ -350,7 +291,7 @@ static void __gluMultMatrixVecf(const GLfloat matrix[16], const GLfloat in[4], G - } - - // gluProject implementation taken from Mesa3D --bool CMatrixGLES::Project(GLfloat objx, GLfloat objy, GLfloat objz, const GLfloat modelMatrix[16], const GLfloat projMatrix[16], const GLint viewport[4], GLfloat* winx, GLfloat* winy, GLfloat* winz) -+bool CMatrixGL::Project(GLfloat objx, GLfloat objy, GLfloat objz, const GLfloat modelMatrix[16], const GLfloat projMatrix[16], const GLint viewport[4], GLfloat* winx, GLfloat* winy, GLfloat* winz) - { - GLfloat in[4]; - GLfloat out[4]; -@@ -381,17 +322,20 @@ bool CMatrixGLES::Project(GLfloat objx, GLfloat objy, GLfloat objz, const GLfloa - return true; - } - --void CMatrixGLES::PrintMatrix(void) -+void CMatrixGL::PrintMatrix(void) - { -- for (unsigned int i=0; i < MM_MATRIXSIZE; i++) -- { -- GLfloat *m = GetMatrix((EMATRIXMODE)i); -- CLog::Log(LOGDEBUG, "MatrixGLES - Matrix:%d", i); -- CLog::Log(LOGDEBUG, "%f %f %f %f", m[0], m[4], m[8], m[12]); -- CLog::Log(LOGDEBUG, "%f %f %f %f", m[1], m[5], m[9], m[13]); -- CLog::Log(LOGDEBUG, "%f %f %f %f", m[2], m[6], m[10], m[14]); -- CLog::Log(LOGDEBUG, "%f %f %f %f", m[3], m[7], m[11], m[15]); -- } -+ CLog::Log(LOGDEBUG, "%f %f %f %f", m_pMatrix[0], m_pMatrix[4], m_pMatrix[8], m_pMatrix[12]); -+ CLog::Log(LOGDEBUG, "%f %f %f %f", m_pMatrix[1], m_pMatrix[5], m_pMatrix[9], m_pMatrix[13]); -+ CLog::Log(LOGDEBUG, "%f %f %f %f", m_pMatrix[2], m_pMatrix[6], m_pMatrix[10], m_pMatrix[14]); -+ CLog::Log(LOGDEBUG, "%f %f %f %f", m_pMatrix[3], m_pMatrix[7], m_pMatrix[11], m_pMatrix[15]); -+} -+ -+void CMatrixGLStack::Load() -+{ -+#ifdef HAS_GL -+ glMatrixMode(m_type); -+ glLoadMatrixf(m_current); -+#endif - } - - #endif -diff --git a/xbmc/guilib/MatrixGLES.h b/xbmc/guilib/MatrixGLES.h -index f4be9be..3fc7960 100644 ---- a/xbmc/guilib/MatrixGLES.h -+++ b/xbmc/guilib/MatrixGLES.h -@@ -1,6 +1,6 @@ - #pragma once - /* --* Copyright (C) 2005-2013 Team XBMC -+ * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify -@@ -19,28 +19,22 @@ - * - */ - --#include --#include - --enum EMATRIXMODE --{ -- MM_PROJECTION = 0, -- MM_MODELVIEW, -- MM_TEXTURE, -- MM_MATRIXSIZE // Must be last! used for size of matrices --}; -+#include -+#include -+#include - --class CMatrixGLES -+class CMatrixGL - { - public: -- CMatrixGLES(); -- ~CMatrixGLES(); -- -- GLfloat* GetMatrix(EMATRIXMODE mode); -- -- void MatrixMode(EMATRIXMODE mode); -- void PushMatrix(); -- void PopMatrix(); -+ -+ CMatrixGL() { memset(&m_pMatrix, 0, sizeof(m_pMatrix)); }; -+ CMatrixGL(const float matrix[16]) { memcpy(m_pMatrix, matrix, sizeof(m_pMatrix)); } -+ CMatrixGL(const CMatrixGL &rhs ) { memcpy(m_pMatrix, rhs.m_pMatrix, sizeof(m_pMatrix)); } -+ CMatrixGL &operator=( const CMatrixGL &rhs ) { memcpy(m_pMatrix, rhs.m_pMatrix, sizeof(m_pMatrix)); return *this;} -+ operator float*() { return m_pMatrix; } -+ operator const float*() const { return m_pMatrix; } -+ - void LoadIdentity(); - void Ortho(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); - void Ortho2D(GLfloat l, GLfloat r, GLfloat b, GLfloat t); -@@ -50,29 +44,52 @@ class CMatrixGLES - void Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); - void MultMatrixf(const GLfloat *matrix); - void LookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, GLfloat centerx, GLfloat centery, GLfloat centerz, GLfloat upx, GLfloat upy, GLfloat upz); -- void PrintMatrix(void); -+ - static bool Project(GLfloat objx, GLfloat objy, GLfloat objz, const GLfloat modelMatrix[16], const GLfloat projMatrix[16], const GLint viewport[4], GLfloat* winx, GLfloat* winy, GLfloat* winz); - --protected: -+ void PrintMatrix(void); - -- struct MatrixWrapper -+ GLfloat m_pMatrix[16]; -+}; -+ -+class CMatrixGLStack -+{ -+public: -+ CMatrixGLStack(GLenum type) -+ : m_type(type) -+ {} -+ -+ void Push() - { -- MatrixWrapper(){ memset(&m_values, 0, sizeof(m_values)); }; -- MatrixWrapper( const float values[16]) { memcpy(m_values,values,sizeof(m_values)); } -- MatrixWrapper( const MatrixWrapper &rhs ) { memcpy(m_values, rhs.m_values, sizeof(m_values)); } -- MatrixWrapper &operator=( const MatrixWrapper &rhs ) { memcpy(m_values, rhs.m_values, sizeof(m_values)); return *this;} -- operator float*() { return m_values; } -- operator const float*() const { return m_values; } -- -- float m_values[16]; -- }; -- -- std::vector m_matrices[(int)MM_MATRIXSIZE]; -- GLfloat *m_pMatrix; -- EMATRIXMODE m_matrixMode; --#if defined(__ARM_NEON__) -- bool m_has_neon; --#endif -+ m_stack.push(m_current); -+ } -+ -+ void Clear() -+ { -+ m_stack = std::stack(); -+ } -+ -+ void Pop() -+ { -+ if(!m_stack.empty()) -+ { -+ m_current = m_stack.top(); -+ m_stack.pop(); -+ } -+ } -+ -+ void Load(); -+ void PopLoad() { Pop(); Load(); } -+ -+ CMatrixGL& Get() { return m_current; } -+ CMatrixGL* operator->() { return &m_current; } -+ -+private: -+ GLint m_type; -+ std::stack m_stack; -+ CMatrixGL m_current; - }; - --extern CMatrixGLES g_matrices; -+extern CMatrixGLStack glMatrixModview; -+extern CMatrixGLStack glMatrixProject; -+extern CMatrixGLStack glMatrixTexture; -diff --git a/xbmc/rendering/gl/RenderSystemGL.cpp b/xbmc/rendering/gl/RenderSystemGL.cpp -index 664aa5b..ae10d3e 100644 ---- a/xbmc/rendering/gl/RenderSystemGL.cpp -+++ b/xbmc/rendering/gl/RenderSystemGL.cpp -@@ -189,21 +189,18 @@ bool CRenderSystemGL::ResetRenderSystem(int width, int height, bool fullScreen, - glEnable(GL_TEXTURE_2D); - glEnable(GL_SCISSOR_TEST); - -- g_matrices.MatrixMode(MM_PROJECTION); -- g_matrices.LoadIdentity(); -+ glMatrixProject.Clear(); -+ glMatrixModview->LoadIdentity(); -+ glMatrixProject->Ortho(0.0f, width-1, height-1, 0.0f, -1.0f, 1.0f); -+ glMatrixProject.Load(); - -- g_matrices.Ortho(0.0f, width-1, height-1, 0.0f, -1.0f, 1.0f); -+ glMatrixModview.Clear(); -+ glMatrixModview->LoadIdentity(); -+ glMatrixModview.Load(); - -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.LoadIdentity(); -- -- g_matrices.MatrixMode(MM_TEXTURE); -- g_matrices.LoadIdentity(); -- -- //ati doesn't init the texture matrix correctly -- //so we have to do it ourselves -- glMatrixMode(GL_TEXTURE); -- glLoadMatrixf(g_matrices.GetMatrix(MM_TEXTURE)); -+ glMatrixTexture.Clear(); -+ glMatrixTexture->LoadIdentity(); -+ glMatrixTexture.Load(); - - if (glewIsSupported("GL_ARB_multitexture")) - { -@@ -230,16 +227,11 @@ bool CRenderSystemGL::ResetRenderSystem(int width, int height, bool fullScreen, - for (GLint i = 0; i < maxtex; i++) - { - glActiveTextureARB(GL_TEXTURE0 + i); -- glLoadMatrixf(g_matrices.GetMatrix(MM_TEXTURE)); -+ glMatrixTexture.Load(); - } - glActiveTextureARB(GL_TEXTURE0); - } - -- glMatrixMode(GL_PROJECTION); -- glLoadMatrixf(g_matrices.GetMatrix(MM_PROJECTION)); -- glMatrixMode(GL_MODELVIEW); -- glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); -- - glBlendFunc(GL_SRC_ALPHA, GL_ONE); - glEnable(GL_BLEND); // Turn Blending On - glDisable(GL_DEPTH_TEST); -@@ -403,18 +395,10 @@ void CRenderSystemGL::CaptureStateBlock() - if (!m_bRenderCreated) - return; - -- g_matrices.MatrixMode(MM_PROJECTION); -- g_matrices.PushMatrix(); -- g_matrices.MatrixMode(MM_TEXTURE); -- g_matrices.PushMatrix(); -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PushMatrix(); -- glMatrixMode(GL_PROJECTION); -- glLoadMatrixf(g_matrices.GetMatrix(MM_PROJECTION)); -- glMatrixMode(GL_TEXTURE); -- glLoadMatrixf(g_matrices.GetMatrix(MM_TEXTURE)); -- glMatrixMode(GL_MODELVIEW); -- glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); -+ glMatrixProject.Push(); -+ glMatrixModview.Push(); -+ glMatrixTexture.Push(); -+ - glDisable(GL_SCISSOR_TEST); // fixes FBO corruption on Macs - if (glActiveTextureARB) - glActiveTextureARB(GL_TEXTURE0_ARB); -@@ -430,19 +414,10 @@ void CRenderSystemGL::ApplyStateBlock() - - glViewport(m_viewPort[0], m_viewPort[1], m_viewPort[2], m_viewPort[3]); - -- g_matrices.MatrixMode(MM_PROJECTION); -- g_matrices.PopMatrix(); -- g_matrices.MatrixMode(MM_TEXTURE); -- g_matrices.PopMatrix(); -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PopMatrix(); -- -- glMatrixMode(GL_PROJECTION); -- glLoadMatrixf(g_matrices.GetMatrix(MM_PROJECTION)); -- glMatrixMode(GL_TEXTURE); -- glLoadMatrixf(g_matrices.GetMatrix(MM_TEXTURE)); -- glMatrixMode(GL_MODELVIEW); -- glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); -+ glMatrixProject.PopLoad(); -+ glMatrixModview.PopLoad(); -+ glMatrixTexture.PopLoad(); -+ - if (glActiveTextureARB) - glActiveTextureARB(GL_TEXTURE0_ARB); - glEnable(GL_TEXTURE_2D); -@@ -464,19 +439,14 @@ void CRenderSystemGL::SetCameraPosition(const CPoint &camera, int screenWidth, i - float w = (float)m_viewPort[2]*0.5f; - float h = (float)m_viewPort[3]*0.5f; - -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.LoadIdentity(); -- g_matrices.Translatef(-(w + offset.x), +(h + offset.y), 0); -- g_matrices.LookAt(0.0, 0.0, -2.0*h, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0); -- g_matrices.MatrixMode(MM_PROJECTION); -- g_matrices.LoadIdentity(); -- g_matrices.Frustum( (-w - offset.x)*0.5f, (w - offset.x)*0.5f, (-h + offset.y)*0.5f, (h + offset.y)*0.5f, h, 100*h); -- g_matrices.MatrixMode(MM_MODELVIEW); -+ glMatrixModview->LoadIdentity(); -+ glMatrixModview->Translatef(-(w + offset.x), +(h + offset.y), 0); -+ glMatrixModview->LookAt(0.0, 0.0, -2.0*h, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0); -+ glMatrixModview.Load(); - -- glMatrixMode(GL_PROJECTION); -- glLoadMatrixf(g_matrices.GetMatrix(MM_PROJECTION)); -- glMatrixMode(GL_MODELVIEW); -- glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); -+ glMatrixProject->LoadIdentity(); -+ glMatrixProject->Frustum( (-w - offset.x)*0.5f, (w - offset.x)*0.5f, (-h + offset.y)*0.5f, (h + offset.y)*0.5f, h, 100*h); -+ glMatrixProject.Load(); - - g_graphicsContext.EndPaint(); - } -@@ -484,7 +454,7 @@ void CRenderSystemGL::SetCameraPosition(const CPoint &camera, int screenWidth, i - void CRenderSystemGL::Project(float &x, float &y, float &z) - { - GLfloat coordX, coordY, coordZ; -- if (g_matrices.Project(x, y, z, g_matrices.GetMatrix(MM_MODELVIEW), g_matrices.GetMatrix(MM_PROJECTION), m_viewPort, &coordX, &coordY, &coordZ)) -+ if (CMatrixGL::Project(x, y, z, glMatrixModview.Get(), glMatrixProject.Get(), m_viewPort, &coordX, &coordY, &coordZ)) - { - x = coordX; - y = (float)(m_viewPort[1] + m_viewPort[3] - coordY); -@@ -515,8 +485,7 @@ void CRenderSystemGL::ApplyHardwareTransform(const TransformMatrix &finalMatrix) - if (!m_bRenderCreated) - return; - -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PushMatrix(); -+ glMatrixModview.Push(); - GLfloat matrix[4][4]; - - for(int i = 0; i < 3; i++) -@@ -528,10 +497,8 @@ void CRenderSystemGL::ApplyHardwareTransform(const TransformMatrix &finalMatrix) - matrix[2][3] = 0.0f; - matrix[3][3] = 1.0f; - -- g_matrices.MultMatrixf(&matrix[0][0]); -- -- glMatrixMode(GL_MODELVIEW); -- glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); -+ glMatrixModview->MultMatrixf(&matrix[0][0]); -+ glMatrixModview.Load(); - } - - void CRenderSystemGL::RestoreHardwareTransform() -@@ -539,9 +506,7 @@ void CRenderSystemGL::RestoreHardwareTransform() - if (!m_bRenderCreated) - return; - -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PopMatrix(); -- glLoadMatrixf(g_matrices.GetMatrix(MM_MODELVIEW)); -+ glMatrixModview.PopLoad(); - } - - void CRenderSystemGL::CalculateMaxTexturesize() -diff --git a/xbmc/rendering/gles/RenderSystemGLES.cpp b/xbmc/rendering/gles/RenderSystemGLES.cpp -index 0904d1f..ea6e16d 100644 ---- a/xbmc/rendering/gles/RenderSystemGLES.cpp -+++ b/xbmc/rendering/gles/RenderSystemGLES.cpp -@@ -137,14 +137,19 @@ bool CRenderSystemGLES::ResetRenderSystem(int width, int height, bool fullScreen - - glEnable(GL_SCISSOR_TEST); - -- g_matrices.MatrixMode(MM_PROJECTION); -- g_matrices.LoadIdentity(); -+ glMatrixProject.Clear(); -+ glMatrixModview->LoadIdentity(); -+ glMatrixProject->Ortho(0.0f, width-1, height-1, 0.0f, -1.0f, 1.0f); -+ glMatrixProject.Load(); - -- g_matrices.Ortho(0.0f, width-1, height-1, 0.0f, -1.0f, 1.0f); -+ glMatrixModview.Clear(); -+ glMatrixModview->LoadIdentity(); -+ glMatrixModview.Load(); -+ -+ glMatrixTexture.Clear(); -+ glMatrixTexture->LoadIdentity(); -+ glMatrixTexture.Load(); - -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.LoadIdentity(); -- - glBlendFunc(GL_SRC_ALPHA, GL_ONE); - glEnable(GL_BLEND); // Turn Blending On - glDisable(GL_DEPTH_TEST); -@@ -357,12 +362,10 @@ void CRenderSystemGLES::CaptureStateBlock() - if (!m_bRenderCreated) - return; - -- g_matrices.MatrixMode(MM_PROJECTION); -- g_matrices.PushMatrix(); -- g_matrices.MatrixMode(MM_TEXTURE); -- g_matrices.PushMatrix(); -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PushMatrix(); -+ glMatrixProject.Push(); -+ glMatrixModview.Push(); -+ glMatrixTexture.Push(); -+ - glDisable(GL_SCISSOR_TEST); // fixes FBO corruption on Macs - glActiveTexture(GL_TEXTURE0); - //TODO - NOTE: Only for Screensavers & Visualisations -@@ -374,12 +377,9 @@ void CRenderSystemGLES::ApplyStateBlock() - if (!m_bRenderCreated) - return; - -- g_matrices.MatrixMode(MM_PROJECTION); -- g_matrices.PopMatrix(); -- g_matrices.MatrixMode(MM_TEXTURE); -- g_matrices.PopMatrix(); -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PopMatrix(); -+ glMatrixProject.PopLoad(); -+ glMatrixModview.PopLoad(); -+ glMatrixTexture.PopLoad(); - glActiveTexture(GL_TEXTURE0); - glEnable(GL_BLEND); - glEnable(GL_SCISSOR_TEST); -@@ -398,20 +398,14 @@ void CRenderSystemGLES::SetCameraPosition(const CPoint &camera, int screenWidth, - float w = (float)m_viewPort[2]*0.5f; - float h = (float)m_viewPort[3]*0.5f; - -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.LoadIdentity(); -- g_matrices.Translatef(-(w + offset.x), +(h + offset.y), 0); -- g_matrices.LookAt(0.0, 0.0, -2.0*h, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0); -- g_matrices.MatrixMode(MM_PROJECTION); -- g_matrices.LoadIdentity(); -- g_matrices.Frustum( (-w - offset.x)*0.5f, (w - offset.x)*0.5f, (-h + offset.y)*0.5f, (h + offset.y)*0.5f, h, 100*h); -- g_matrices.MatrixMode(MM_MODELVIEW); -- -- GLfloat* matx; -- matx = g_matrices.GetMatrix(MM_MODELVIEW); -- memcpy(m_view, matx, 16 * sizeof(GLfloat)); -- matx = g_matrices.GetMatrix(MM_PROJECTION); -- memcpy(m_projection, matx, 16 * sizeof(GLfloat)); -+ glMatrixModview->LoadIdentity(); -+ glMatrixModview->Translatef(-(w + offset.x), +(h + offset.y), 0); -+ glMatrixModview->LookAt(0.0, 0.0, -2.0*h, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0); -+ glMatrixModview.Load(); -+ -+ glMatrixProject->LoadIdentity(); -+ glMatrixProject->Frustum( (-w - offset.x)*0.5f, (w - offset.x)*0.5f, (-h + offset.y)*0.5f, (h + offset.y)*0.5f, h, 100*h); -+ glMatrixProject.Load(); - - g_graphicsContext.EndPaint(); - } -@@ -419,7 +413,7 @@ void CRenderSystemGLES::SetCameraPosition(const CPoint &camera, int screenWidth, - void CRenderSystemGLES::Project(float &x, float &y, float &z) - { - GLfloat coordX, coordY, coordZ; -- if (g_matrices.Project(x, y, z, m_view, m_projection, m_viewPort, &coordX, &coordY, &coordZ)) -+ if (CMatrixGL::Project(x, y, z, glMatrixModview.Get(), glMatrixProject.Get(), m_viewPort, &coordX, &coordY, &coordZ)) - { - x = coordX; - y = (float)(m_viewPort[1] + m_viewPort[3] - coordY); -@@ -434,8 +428,8 @@ bool CRenderSystemGLES::TestRender() - //RESOLUTION_INFO resInfo = CDisplaySettings::Get().GetCurrentResolutionInfo(); - //glViewport(0, 0, resInfo.iWidth, resInfo.iHeight); - -- g_matrices.PushMatrix(); -- g_matrices.Rotatef( theta, 0.0f, 0.0f, 1.0f ); -+ glMatrixModview.Push(); -+ glMatrixModview->Rotatef( theta, 0.0f, 0.0f, 1.0f ); - - EnableGUIShader(SM_DEFAULT); - -@@ -465,7 +459,7 @@ bool CRenderSystemGLES::TestRender() - - DisableGUIShader(); - -- g_matrices.PopMatrix(); -+ glMatrixModview.Pop(); - - theta += 1.0f; - -@@ -477,8 +471,7 @@ void CRenderSystemGLES::ApplyHardwareTransform(const TransformMatrix &finalMatri - if (!m_bRenderCreated) - return; - -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PushMatrix(); -+ glMatrixModview.Push(); - GLfloat matrix[4][4]; - - for(int i = 0; i < 3; i++) -@@ -490,7 +483,8 @@ void CRenderSystemGLES::ApplyHardwareTransform(const TransformMatrix &finalMatri - matrix[2][3] = 0.0f; - matrix[3][3] = 1.0f; - -- g_matrices.MultMatrixf(&matrix[0][0]); -+ glMatrixModview->MultMatrixf(&matrix[0][0]); -+ glMatrixModview.Load(); - } - - void CRenderSystemGLES::RestoreHardwareTransform() -@@ -498,8 +492,7 @@ void CRenderSystemGLES::RestoreHardwareTransform() - if (!m_bRenderCreated) - return; - -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PopMatrix(); -+ glMatrixModview.PopLoad(); - } - - void CRenderSystemGLES::CalculateMaxTexturesize() -diff --git a/xbmc/rendering/gles/RenderSystemGLES.h b/xbmc/rendering/gles/RenderSystemGLES.h -index d2f9cd1..de5ab64 100644 ---- a/xbmc/rendering/gles/RenderSystemGLES.h -+++ b/xbmc/rendering/gles/RenderSystemGLES.h -@@ -112,8 +112,6 @@ class CRenderSystemGLES : public CRenderSystemBase - CGUIShader **m_pGUIshader; // One GUI shader for each method - ESHADERMETHOD m_method; // Current GUI Shader method - -- GLfloat m_view[16]; -- GLfloat m_projection[16]; - GLint m_viewPort[4]; - }; - - -From 56cb54bce7ae1d50a107a4b8b627d7c5e375b764 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Fri, 21 Nov 2014 17:10:00 +0100 -Subject: [PATCH 090/102] fixup! GL(ES): Simplify matrix stack handling - ---- - xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -index d1b46a3..0bec937 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -@@ -1206,10 +1206,10 @@ void CLinuxRendererGLES::RenderMultiPass(int index, int field) - // glPushAttrib(GL_VIEWPORT_BIT); - // glPushAttrib(GL_SCISSOR_BIT); - glMatrixModview.Push(); -- glMatrixModview.LoadIdentity(); -+ glMatrixModview->LoadIdentity(); - - glMatrixProject.Push(); -- glMatrixProject.LoadIdentity(); -+ glMatrixProject->LoadIdentity(); - glMatrixProject->Ortho2D(0, m_sourceWidth, 0, m_sourceHeight); - - CRect viewport(0, 0, m_sourceWidth, m_sourceHeight); - -From 9bb85930187edfd949dfd7aaec35a6e089368d96 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 21 Nov 2014 19:17:25 +0000 -Subject: [PATCH 091/102] squash: Fixup build after glGet - ---- - xbmc/guilib/GUIFontTTFGL.cpp | 11 +++++------ - 1 file changed, 5 insertions(+), 6 deletions(-) - -diff --git a/xbmc/guilib/GUIFontTTFGL.cpp b/xbmc/guilib/GUIFontTTFGL.cpp -index 812662c..39c6936 100644 ---- a/xbmc/guilib/GUIFontTTFGL.cpp -+++ b/xbmc/guilib/GUIFontTTFGL.cpp -@@ -218,10 +218,9 @@ void CGUIFontTTFGL::LastEnd() - g_Windowing.SetScissors(clip); - - // Apply the translation to the currently active (top-of-stack) model view matrix -- g_matrices.MatrixMode(MM_MODELVIEW); -- g_matrices.PushMatrix(); -- g_matrices.Translatef(m_vertexTrans[i].translateX, m_vertexTrans[i].translateY, m_vertexTrans[i].translateZ); -- glUniformMatrix4fv(modelLoc, 1, GL_FALSE, g_matrices.GetMatrix(MM_MODELVIEW)); -+ glMatrixModview.Push(); -+ glMatrixModview->Translatef(m_vertexTrans[i].translateX, m_vertexTrans[i].translateY, m_vertexTrans[i].translateZ); -+ glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glMatrixModview.Get()); - - // Bind the buffer to the OpenGL context's GL_ARRAY_BUFFER binding point - glBindBuffer(GL_ARRAY_BUFFER, (GLuint) m_vertexTrans[i].vertexBuffer->bufferHandle); -@@ -242,12 +241,12 @@ void CGUIFontTTFGL::LastEnd() - glDrawElements(GL_TRIANGLES, 6 * count, GL_UNSIGNED_SHORT, 0); - } - -- g_matrices.PopMatrix(); -+ glMatrixModview.PopLoad(); - } - // Restore the original scissor rectangle - g_Windowing.ResetScissors(); - // Restore the original model view matrix -- glUniformMatrix4fv(modelLoc, 1, GL_FALSE, g_matrices.GetMatrix(MM_MODELVIEW)); -+ glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glMatrixModview.Get()); - // Unbind GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - -From afcb8601120ce5d21abbd4545a9b91a6027dfd9f Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 24 Nov 2014 16:06:54 +0000 -Subject: [PATCH 092/102] [MMALCoded] Call port settings changed from callback - to avoid thread unsafe code - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 26 +++++----------------- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 3 --- - 2 files changed, 6 insertions(+), 23 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index dd08c95..6ce648c 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) - height = 0; - index = 0; - m_aspect_ratio = 0.0f; -- m_changed_count = 0; - dts = DVD_NOPTS_VALUE; - } - -@@ -123,8 +122,6 @@ CMMALVideo::CMMALVideo() - - m_codingType = 0; - -- m_changed_count = 0; -- m_changed_count_dec = 0; - m_output_busy = 0; - m_demux_queue_length = 0; - m_es_format = mmal_format_alloc(); -@@ -188,7 +185,6 @@ void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *bu - { - MMAL_EVENT_FORMAT_CHANGED_T *fmt = mmal_event_format_changed_get(buffer); - mmal_format_copy(m_es_format, fmt->format); -- m_changed_count++; - - if (m_es_format->es->video.crop.width && m_es_format->es->video.crop.height) - { -@@ -197,10 +193,13 @@ void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *bu - m_decoded_width = m_es_format->es->video.crop.width; - m_decoded_height = m_es_format->es->video.crop.height; - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -- CLog::Log(LOGDEBUG, "%s::%s format changed: %dx%d %.2f frame:%d", CLASSNAME, __func__, m_decoded_width, m_decoded_height, m_aspect_ratio, m_changed_count); -+ CLog::Log(LOGDEBUG, "%s::%s format changed: %dx%d %.2f", CLASSNAME, __func__, m_decoded_width, m_decoded_height, m_aspect_ratio); - } - else - CLog::Log(LOGERROR, "%s::%s format changed: Unexpected %dx%d", CLASSNAME, __func__, m_es_format->es->video.crop.width, m_es_format->es->video.crop.height); -+ -+ if (!change_dec_output_format()) -+ CLog::Log(LOGERROR, "%s::%s - change_dec_output_format() failed", CLASSNAME, __func__); - } - - void CMMALVideo::dec_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) -@@ -275,11 +274,10 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); - m_output_busy++; - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -- CLog::Log(LOGDEBUG, "%s::%s - %p (%p) buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x frame:%d", -- CLASSNAME, __func__, buffer, omvb, buffer->length, dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags, omvb->m_changed_count); -+ CLog::Log(LOGDEBUG, "%s::%s - %p (%p) buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x", -+ CLASSNAME, __func__, buffer, omvb, buffer->length, dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags); - omvb->mmal_buffer = buffer; - buffer->user_data = (void *)omvb; -- omvb->m_changed_count = m_changed_count; - omvb->dts = dts; - omvb->width = m_decoded_width; - omvb->height = m_decoded_height; -@@ -326,7 +324,6 @@ bool CMMALVideo::change_dec_output_format() - else - CLog::Log(LOGERROR, "%s::%s Failed to query interlace type on %s (status=%x %s)", CLASSNAME, __func__, m_dec_output->name, status, mmal_status_to_string(status)); - -- // todo: if we don't disable/enable we can do this from callback - mmal_format_copy(m_dec_output->format, m_es_format); - status = mmal_port_format_commit(m_dec_output); - if (status != MMAL_SUCCESS) -@@ -867,17 +864,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) - assert(m_dts_queue.size() < 5000); - pthread_mutex_unlock(&m_output_mutex); - } -- if (m_changed_count_dec != m_changed_count) -- { -- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -- CLog::Log(LOGDEBUG, "%s::%s format changed frame:%d(%d)", CLASSNAME, __func__, m_changed_count_dec, m_changed_count); -- m_changed_count_dec = m_changed_count; -- if (!change_dec_output_format()) -- { -- CLog::Log(LOGERROR, "%s::%s - change_dec_output_format() failed", CLASSNAME, __func__); -- return VC_ERROR; -- } -- } - EDEINTERLACEMODE deinterlace_request = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; - EINTERLACEMETHOD interlace_method = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -index 79a4bfd..ea64276 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -@@ -57,7 +57,6 @@ class CMMALVideoBuffer - float m_aspect_ratio; - int index; - double dts; -- uint32_t m_changed_count; - // reference counting - CMMALVideoBuffer* Acquire(); - long Release(); -@@ -99,8 +98,6 @@ class CMMALVideo - // MMAL decoder callback routines. - void dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); - void dec_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); -- uint32_t m_changed_count; -- uint32_t m_changed_count_dec; - - protected: - void QueryCodec(void); - -From aeeeed2928477d6e1ad8b57d5bf5abc7302cf171 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 24 Nov 2014 21:24:25 +0000 -Subject: [PATCH 093/102] [mmalcodec] Avoid double framerate deinterlace for - dvd menus for now - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 6ce648c..995c2f8 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -361,7 +361,7 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) - MMAL_PARAMETER_IMAGEFX_PARAMETERS_T imfx_param = {{MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, sizeof(imfx_param)}, - interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED || interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF ? - MMAL_PARAM_IMAGEFX_DEINTERLACE_ADV : MMAL_PARAM_IMAGEFX_DEINTERLACE_FAST, -- 3, {3, 0, interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF || interlace_method == VS_INTERLACEMETHOD_MMAL_BOB_HALF }}; -+ 3, {3, 0, m_hints.stills || interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF || interlace_method == VS_INTERLACEMETHOD_MMAL_BOB_HALF }}; - status = mmal_port_parameter_set(m_deint->output[0], &imfx_param.hdr); - if (status != MMAL_SUCCESS) - { - -From 960c3de27fbe55e9c0ef3ea3dc2ce54a51d956d4 Mon Sep 17 00:00:00 2001 -From: Arne Morten Kvarving -Date: Tue, 25 Nov 2014 17:03:36 +0100 -Subject: [PATCH 094/102] fixed: it's stereo samples.. - ---- - xbmc/addons/Visualisation.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xbmc/addons/Visualisation.cpp b/xbmc/addons/Visualisation.cpp -index 810e5b2..7f17849 100644 ---- a/xbmc/addons/Visualisation.cpp -+++ b/xbmc/addons/Visualisation.cpp -@@ -266,7 +266,7 @@ void CVisualisation::OnAudioData(const float* pAudioData, int iAudioDataLength) - return; - - // Save our audio data in the buffers -- auto_ptr pBuffer ( new CAudioBuffer(AUDIO_BUFFER_SIZE) ); -+ auto_ptr pBuffer ( new CAudioBuffer(2*AUDIO_BUFFER_SIZE) ); - pBuffer->Set(pAudioData, iAudioDataLength); - m_vecBuffers.push_back( pBuffer.release() ); - -@@ -278,7 +278,7 @@ void CVisualisation::OnAudioData(const float* pAudioData, int iAudioDataLength) - if (m_bWantsFreq) - { - const float *psAudioData = ptrAudioBuffer->Get(); -- memcpy(m_fFreq, psAudioData, AUDIO_BUFFER_SIZE * sizeof(float)); -+ memcpy(m_fFreq, psAudioData, AUDIO_BUFFER_SIZE * 2 * sizeof(float)); - - // FFT the data - twochanwithwindow(m_fFreq, AUDIO_BUFFER_SIZE); - -From 3689ca2c13e7f79fdd5cfe9c7d427579bc298c92 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 27 Nov 2014 14:46:22 +0000 -Subject: [PATCH 095/102] [mmalcodec] squash: Avoid deinterlace for dvd menus - for now - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 995c2f8..6ce648c 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -361,7 +361,7 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) - MMAL_PARAMETER_IMAGEFX_PARAMETERS_T imfx_param = {{MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, sizeof(imfx_param)}, - interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED || interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF ? - MMAL_PARAM_IMAGEFX_DEINTERLACE_ADV : MMAL_PARAM_IMAGEFX_DEINTERLACE_FAST, -- 3, {3, 0, m_hints.stills || interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF || interlace_method == VS_INTERLACEMETHOD_MMAL_BOB_HALF }}; -+ 3, {3, 0, interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF || interlace_method == VS_INTERLACEMETHOD_MMAL_BOB_HALF }}; - status = mmal_port_parameter_set(m_deint->output[0], &imfx_param.hdr); - if (status != MMAL_SUCCESS) - { - -From 03b46b6f234c55e69f25d6b2923d308378c7f3ab Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 28 Nov 2014 13:48:22 +0000 -Subject: [PATCH 096/102] Revert "[MMALCoded] Call port settings changed from - callback to avoid thread unsafe code" - -This reverts commit 371044f39f4ccf5207146efb96ea4859b9f704f0. ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 26 +++++++++++++++++----- - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 3 +++ - 2 files changed, 23 insertions(+), 6 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 6ce648c..dd08c95 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -57,6 +57,7 @@ CMMALVideoBuffer::CMMALVideoBuffer(CMMALVideo *omv) - height = 0; - index = 0; - m_aspect_ratio = 0.0f; -+ m_changed_count = 0; - dts = DVD_NOPTS_VALUE; - } - -@@ -122,6 +123,8 @@ CMMALVideo::CMMALVideo() - - m_codingType = 0; - -+ m_changed_count = 0; -+ m_changed_count_dec = 0; - m_output_busy = 0; - m_demux_queue_length = 0; - m_es_format = mmal_format_alloc(); -@@ -185,6 +188,7 @@ void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *bu - { - MMAL_EVENT_FORMAT_CHANGED_T *fmt = mmal_event_format_changed_get(buffer); - mmal_format_copy(m_es_format, fmt->format); -+ m_changed_count++; - - if (m_es_format->es->video.crop.width && m_es_format->es->video.crop.height) - { -@@ -193,13 +197,10 @@ void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *bu - m_decoded_width = m_es_format->es->video.crop.width; - m_decoded_height = m_es_format->es->video.crop.height; - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -- CLog::Log(LOGDEBUG, "%s::%s format changed: %dx%d %.2f", CLASSNAME, __func__, m_decoded_width, m_decoded_height, m_aspect_ratio); -+ CLog::Log(LOGDEBUG, "%s::%s format changed: %dx%d %.2f frame:%d", CLASSNAME, __func__, m_decoded_width, m_decoded_height, m_aspect_ratio, m_changed_count); - } - else - CLog::Log(LOGERROR, "%s::%s format changed: Unexpected %dx%d", CLASSNAME, __func__, m_es_format->es->video.crop.width, m_es_format->es->video.crop.height); -- -- if (!change_dec_output_format()) -- CLog::Log(LOGERROR, "%s::%s - change_dec_output_format() failed", CLASSNAME, __func__); - } - - void CMMALVideo::dec_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) -@@ -274,10 +275,11 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf - CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); - m_output_busy++; - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -- CLog::Log(LOGDEBUG, "%s::%s - %p (%p) buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x", -- CLASSNAME, __func__, buffer, omvb, buffer->length, dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags); -+ CLog::Log(LOGDEBUG, "%s::%s - %p (%p) buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x frame:%d", -+ CLASSNAME, __func__, buffer, omvb, buffer->length, dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags, omvb->m_changed_count); - omvb->mmal_buffer = buffer; - buffer->user_data = (void *)omvb; -+ omvb->m_changed_count = m_changed_count; - omvb->dts = dts; - omvb->width = m_decoded_width; - omvb->height = m_decoded_height; -@@ -324,6 +326,7 @@ bool CMMALVideo::change_dec_output_format() - else - CLog::Log(LOGERROR, "%s::%s Failed to query interlace type on %s (status=%x %s)", CLASSNAME, __func__, m_dec_output->name, status, mmal_status_to_string(status)); - -+ // todo: if we don't disable/enable we can do this from callback - mmal_format_copy(m_dec_output->format, m_es_format); - status = mmal_port_format_commit(m_dec_output); - if (status != MMAL_SUCCESS) -@@ -864,6 +867,17 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) - assert(m_dts_queue.size() < 5000); - pthread_mutex_unlock(&m_output_mutex); - } -+ if (m_changed_count_dec != m_changed_count) -+ { -+ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -+ CLog::Log(LOGDEBUG, "%s::%s format changed frame:%d(%d)", CLASSNAME, __func__, m_changed_count_dec, m_changed_count); -+ m_changed_count_dec = m_changed_count; -+ if (!change_dec_output_format()) -+ { -+ CLog::Log(LOGERROR, "%s::%s - change_dec_output_format() failed", CLASSNAME, __func__); -+ return VC_ERROR; -+ } -+ } - EDEINTERLACEMODE deinterlace_request = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; - EINTERLACEMETHOD interlace_method = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -index ea64276..79a4bfd 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h -@@ -57,6 +57,7 @@ class CMMALVideoBuffer - float m_aspect_ratio; - int index; - double dts; -+ uint32_t m_changed_count; - // reference counting - CMMALVideoBuffer* Acquire(); - long Release(); -@@ -98,6 +99,8 @@ class CMMALVideo - // MMAL decoder callback routines. - void dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); - void dec_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); -+ uint32_t m_changed_count; -+ uint32_t m_changed_count_dec; - - protected: - void QueryCodec(void); - -From 4f2191434edd878a6e63f0561726201ac6d3317c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 29 Nov 2014 15:25:16 +0000 -Subject: [PATCH 097/102] [rbp] hack: wait for splash to complete before - changing hdmi mode - ---- - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 49 +++++++++++++++++++++++++ - 1 file changed, 49 insertions(+) - -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index 1529045..977ad3e 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -216,12 +216,61 @@ int CEGLNativeTypeRaspberryPI::AddUniqueResolution(RESOLUTION_INFO &res, std::ve - } - #endif - -+#include -+ -+pid_t proc_find(const char* name) -+{ -+ DIR* dir; -+ struct dirent* ent; -+ char buf[512]; -+ -+ long pid; -+ char pname[100] = {0,}; -+ char state; -+ FILE *fp=NULL; -+ -+ if (!(dir = opendir("/proc"))) { -+ perror("can't open /proc"); -+ return -1; -+ } -+ -+ while((ent = readdir(dir)) != NULL) { -+ long lpid = atol(ent->d_name); -+ if(lpid < 0) -+ continue; -+ snprintf(buf, sizeof(buf), "/proc/%ld/stat", lpid); -+ fp = fopen(buf, "r"); -+ -+ if (fp) { -+ if ( (fscanf(fp, "%ld (%[^)]) %c", &pid, pname, &state)) != 3 ){ -+ printf("fscanf failed \n"); -+ fclose(fp); -+ closedir(dir); -+ return -1; -+ } -+ if (!strcmp(pname, name)) { -+ fclose(fp); -+ closedir(dir); -+ return (pid_t)lpid; -+ } -+ fclose(fp); -+ } -+ } -+ -+ closedir(dir); -+ return -1; -+} -+ -+ - bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) - { - #if defined(TARGET_RASPBERRY_PI) - if(!m_DllBcmHost || !m_nativeWindow) - return false; - -+ while (proc_find("hello_video.bin") >= 0) -+ Sleep(100); -+ - DestroyDispmaxWindow(); - - if(GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) - -From b071b4e935f6067d1a869a9a4a7886192af6ac25 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 1 Dec 2014 16:02:49 +0000 -Subject: [PATCH 098/102] [mmalcodec] Report when support is compiled in - ---- - xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -index bea5e4f..eb73da8 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -@@ -192,6 +192,11 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne - #else - hwSupport += "iMXVPU:no "; - #endif -+#if defined(HAS_MMAL) -+ hwSupport += "MMAL:yes "; -+#else -+ hwSupport += "MMAL:no "; -+#endif - CLog::Log(LOGDEBUG, "CDVDFactoryCodec: compiled in hardware support: %s", hwSupport.c_str()); - - #if defined(HAS_MMAL) - -From 9b8e40d2afb3936870b2988d196bdb2178ca1ba2 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 5 Oct 2014 14:05:25 +0100 -Subject: [PATCH 099/102] [PiSink] Allow audio output latency to be set in - settings - ---- - language/English/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/language/English/strings.po b/language/English/strings.po -index 83179a5..e6defbe 100755 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -16202,3 +16202,18 @@ msgstr "" - msgctxt "#38052" - msgid "Remote button press release time (ms)" - msgstr "" -+ -+#: system/settings/rbp.xml -+msgctxt "#38012" -+msgid "Audio output latency" -+msgstr "" -+ -+#: system/settings/rbp.xml -+msgctxt "#38013" -+msgid "Increase this to protect against underruns, reduce to have lower latency gui sounds" -+msgstr "" -+ -+#: system/settings/rbp.xml -+msgctxt "#38014" -+msgid "%i ms" -+msgstr "" -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 4c2ef41..40be71e 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -113,6 +113,18 @@ - - 101 - -+ -+ 3 -+ 100 -+ -+ 50 -+ 50 -+ 300 -+ -+ -+ 38014 -+ -+ - - - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -index fd9a03d..484ce14 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp -@@ -34,7 +34,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 }; - -@@ -42,6 +41,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) -@@ -189,6 +189,9 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) - m_initDevice = device; - m_initFormat = format; - -+ m_latency = CSettings::Get().GetInt("audiooutput.latency") * 1e-3; -+ m_latency = std::max(m_latency, 50e-3); -+ - // analogue only supports stereo - if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue" || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") - { -@@ -205,7 +208,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)); -@@ -420,7 +423,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) -@@ -468,8 +471,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 5c57999..cac5051 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 2a9dde0697a3656aa05d4f1abb0783e41c4df1e0 Mon Sep 17 00:00:00 2001 -From: Cedric Girard -Date: Mon, 7 Jul 2014 15:37:52 +0200 -Subject: [PATCH 100/102] native resolution - -From adam-aph pull #1096 -Rebased to master with appropriate code change -Removed AdvancedSettings and move them to a struct with sensible -defaults ---- - xbmc/cores/VideoRenderers/BaseRenderer.cpp | 109 ++++++++++++++++++++++++++++- - xbmc/cores/VideoRenderers/BaseRenderer.h | 17 +++++ - 2 files changed, 125 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoRenderers/BaseRenderer.cpp b/xbmc/cores/VideoRenderers/BaseRenderer.cpp -index 9118cb0..48afcfc 100644 ---- a/xbmc/cores/VideoRenderers/BaseRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/BaseRenderer.cpp -@@ -41,12 +41,27 @@ CBaseRenderer::CBaseRenderer() - m_sourceWidth = 720; - m_sourceHeight = 480; - m_resolution = RES_DESKTOP; -+ m_bestResolution = m_resolution; - m_fps = 0.0f; - m_renderOrientation = 0; - m_oldRenderOrientation = 0; - m_oldDestRect.SetRect(0.0f, 0.0f, 0.0f, 0.0f); - m_iFlags = 0; - -+ m_nativeUpscaleSettings = -+ { -+ true, //NativeUpscaleMode -+ true, //OverrideFPS -+ false, //CorrectPixelRatio -+ 1920, //DestWidth -+ 1080, //DestHeight -+ 0, //MinWidth -+ 0, //MinHeight -+ 1920, //MaxWidth -+ 1080,//MaxHeight -+ }; -+ -+ - for(int i=0; i < 4; i++) - { - m_rotatedDestCoords[i].x = 0; -@@ -99,6 +114,72 @@ void CBaseRenderer::ChooseBestResolution(float fps) - #endif - CLog::Log(LOGNOTICE, "Display resolution %s : %s (%d)", - m_resolution == RES_DESKTOP ? "DESKTOP" : "USER", g_graphicsContext.GetResInfo(m_resolution).strMode.c_str(), m_resolution); -+ -+ m_bestResolution = m_resolution; // save it -+ int iNatW = (int)m_sourceWidth; -+ int iNatH = (int)m_sourceHeight; -+ -+ if( m_nativeUpscaleSettings.MaxWidth && iNatW > m_nativeUpscaleSettings.MaxWidth ) -+ iNatW = 0; -+ -+ if( m_nativeUpscaleSettings.MaxHeight && iNatH > m_nativeUpscaleSettings.MaxHeight ) -+ iNatH = 0; -+ -+ if( m_nativeUpscaleSettings.NativeUpscaleMode && iNatW && iNatH ) // Native Upscale Mode -+ { -+ CLog::Log(LOGNOTICE, "Searching for NATIVE resolution: %dx%d", m_sourceWidth, m_sourceHeight); -+ -+ RESOLUTION_INFO org = g_graphicsContext.GetResInfo(m_resolution); -+ -+ bool bOverrideFPS = m_nativeUpscaleSettings.OverrideFPS; -+ double nfRD, fRD, fD, fODist = 100000000.0; -+ int iWD, iHD; -+ float fOrgRefreshRate = org.fRefreshRate; -+ int iOrgScreen = org.iScreen; -+ -+ if(iNatW <= m_nativeUpscaleSettings.MinWidth && -+ iNatH <= m_nativeUpscaleSettings.MinHeight) -+ { -+ iNatW = m_nativeUpscaleSettings.MinWidth; -+ iNatH = m_nativeUpscaleSettings.MinHeight; -+ } -+ -+ // best fit -+ for (size_t i = (int)RES_DESKTOP; i < CDisplaySettings::Get().ResolutionInfoSize(); i++) -+ { -+ const RESOLUTION_INFO info = g_graphicsContext.GetResInfo((RESOLUTION)i); -+ fRD = info.fRefreshRate - fOrgRefreshRate; // refreshrate delta -+ nfRD = info.fRefreshRate / fOrgRefreshRate; // refreshrate fit -+ iWD = info.iWidth - iNatW; // width delta -+ iHD = info.iHeight - iNatH; // height delta -+ // distance function: -+ // refreshrate, witdh and height deltas are multiplied by weight factors -+ // current weights values do not prefer any parameter (well, almost...) -+ // so we will search for lowest width, height and refresh rate which fit to the source parameters -+ // however if any of these parameters need to be preferred, bump up the weight value for it -+ fD = (iWD * 1.0) + (iHD * 1.0); // default weights for width and height resolution -+ -+ if (!bOverrideFPS) -+ { // if original fps should be preserved, accept only these -+ fRD = (fRD == 0.0) ? (0.0) : (-1.0); // resolutions where refreshrate is the same -+ } -+ else -+ { // preferred multiple fps -+ fD += fRD + ( (abs(nfRD-floor(nfRD+0.5)) < 1e-6) ? 10.0 : 1000.0 ); -+ } -+ -+ if( fRD >= 0.0 && iWD >= 0 && iHD >= 0 && fD <= fODist && -+ info.iScreen == iOrgScreen ) -+ { -+ m_resolution = (RESOLUTION)i; // if we are here, then this resolution is closer to -+ fODist = fD; // the source parameters than previous one -+ } -+ } -+ -+ CLog::Log(LOGNOTICE, "Display resolution ADJUST2 : %s (%d)", -+ org.strMode.c_str(), m_resolution); -+ } -+ - } - - bool CBaseRenderer::FindResolutionFromOverride(float fps, float& weight, bool fallback) -@@ -605,10 +686,12 @@ void CBaseRenderer::ManageDisplay() - - void CBaseRenderer::SetViewMode(int viewMode) - { -+ int savedViewMode; -+ - if (viewMode < ViewModeNormal || viewMode > ViewModeCustom) - viewMode = ViewModeNormal; - -- CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = viewMode; -+ CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = savedViewMode = viewMode; - - // get our calibrated full screen resolution - RESOLUTION res = GetResolution(); -@@ -619,6 +702,27 @@ void CBaseRenderer::SetViewMode(int viewMode) - // and the source frame ratio - float sourceFrameRatio = GetAspectRatio(); - -+ // if we upscale via external AVR device, correct the pixel ratio -+ if( m_nativeUpscaleSettings.NativeUpscaleMode && m_bestResolution != m_resolution -+ && m_nativeUpscaleSettings.CorrectPixelRatio ) -+ { -+ float destWidth = (float)(m_nativeUpscaleSettings.DestWidth); -+ float destHeight = (float)(m_nativeUpscaleSettings.DestHeight); -+ float destFrameRatio = (float)destWidth / destHeight; -+ bool destScreenIs43 = (destFrameRatio < 8.f/(3.f*sqrt(3.f))); // final output -+ float outWidth = (float)(info.iWidth); -+ float outHeight = (float)(info.iHeight); -+ float outFrameRatio = (float)outWidth / outHeight; -+ bool outScreenIs43 = (outFrameRatio < 8.f/(3.f*sqrt(3.f))); // xbmc output -+ -+ if( outScreenIs43 && !destScreenIs43 ) // final output is 16x9 -+ viewMode = ViewModeStretch16x9; -+ else if( !outScreenIs43 && destScreenIs43 ) // final output is 4x3 -+ viewMode = ViewModeStretch4x3; -+ -+ CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = viewMode; -+ } -+ - bool is43 = (sourceFrameRatio < 8.f/(3.f*sqrt(3.f)) && - CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode == ViewModeNormal); - -@@ -715,6 +819,9 @@ void CBaseRenderer::SetViewMode(int viewMode) - CDisplaySettings::Get().SetZoomAmount(1.0); - } - -+ // restore original view mode -+ CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = savedViewMode; -+ - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = CDisplaySettings::Get().GetZoomAmount(); - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio = CDisplaySettings::Get().GetPixelRatio(); - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomNonLinStretch = CDisplaySettings::Get().IsNonLinearStretched(); -diff --git a/xbmc/cores/VideoRenderers/BaseRenderer.h b/xbmc/cores/VideoRenderers/BaseRenderer.h -index 850aa6f..c0645f3 100644 ---- a/xbmc/cores/VideoRenderers/BaseRenderer.h -+++ b/xbmc/cores/VideoRenderers/BaseRenderer.h -@@ -72,6 +72,20 @@ typedef void (*RenderFeaturesCallBackFn)(const void *ctx, Features &renderFeatur - - struct DVDVideoPicture; - -+typedef struct NativeUpscale -+{ -+ bool NativeUpscaleMode; -+ bool OverrideFPS; -+ bool CorrectPixelRatio; -+ int DestWidth; -+ int DestHeight; -+ int MinWidth; -+ int MinHeight; -+ int MaxWidth; -+ int MaxHeight; -+} NativeUpscale; -+ -+ - class CBaseRenderer - { - public: -@@ -122,11 +136,14 @@ class CBaseRenderer - void MarkDirty(); - - RESOLUTION m_resolution; // the resolution we're running in -+ RESOLUTION m_bestResolution; // the preferred resolution - unsigned int m_sourceWidth; - unsigned int m_sourceHeight; - float m_sourceFrameRatio; - float m_fps; - -+ NativeUpscale m_nativeUpscaleSettings; -+ - unsigned int m_renderOrientation; // orientation of the video in degress counter clockwise - unsigned int m_oldRenderOrientation; // orientation of the previous frame - // for drawing the texture with glVertex4f (holds all 4 corner points of the destination rect - -From 7b11a25255f877d101a5c27d288908dcbb576769 Mon Sep 17 00:00:00 2001 -From: Cedric Girard -Date: Mon, 25 Aug 2014 18:06:47 +0200 -Subject: [PATCH 101/102] allow to disable native resolution switching through - GUI - ---- - language/English/strings.po | 6 +++++- - system/settings/settings.xml | 8 ++++++++ - xbmc/cores/VideoRenderers/BaseRenderer.cpp | 5 ++--- - xbmc/cores/VideoRenderers/BaseRenderer.h | 1 - - 4 files changed, 15 insertions(+), 5 deletions(-) - -diff --git a/language/English/strings.po b/language/English/strings.po -index e6defbe..0d2c644 100755 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -6453,7 +6453,11 @@ msgctxt "#13555" - msgid "%d Minutes" - msgstr "" - --#empty strings from id 13556 to 13599 -+msgctxt "#13556" -+msgid "Enable native resolution switching" -+msgstr "" -+ -+#empty strings from id 13557 to 13599 - - #: system/settings/darwin.xml - msgctxt "#13600" -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index dbddcb6..d30d878 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -428,6 +428,14 @@ - - - -+ -+ 2 -+ false -+ -+ 0 -+ -+ -+ - - 2 - false -diff --git a/xbmc/cores/VideoRenderers/BaseRenderer.cpp b/xbmc/cores/VideoRenderers/BaseRenderer.cpp -index 48afcfc..fb52691 100644 ---- a/xbmc/cores/VideoRenderers/BaseRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/BaseRenderer.cpp -@@ -50,7 +50,6 @@ CBaseRenderer::CBaseRenderer() - - m_nativeUpscaleSettings = - { -- true, //NativeUpscaleMode - true, //OverrideFPS - false, //CorrectPixelRatio - 1920, //DestWidth -@@ -125,7 +124,7 @@ void CBaseRenderer::ChooseBestResolution(float fps) - if( m_nativeUpscaleSettings.MaxHeight && iNatH > m_nativeUpscaleSettings.MaxHeight ) - iNatH = 0; - -- if( m_nativeUpscaleSettings.NativeUpscaleMode && iNatW && iNatH ) // Native Upscale Mode -+ if( CSettings::Get().GetBool("videoplayer.nativeresolution") && iNatW && iNatH ) // Native Upscale Mode - { - CLog::Log(LOGNOTICE, "Searching for NATIVE resolution: %dx%d", m_sourceWidth, m_sourceHeight); - -@@ -703,7 +702,7 @@ void CBaseRenderer::SetViewMode(int viewMode) - float sourceFrameRatio = GetAspectRatio(); - - // if we upscale via external AVR device, correct the pixel ratio -- if( m_nativeUpscaleSettings.NativeUpscaleMode && m_bestResolution != m_resolution -+ if( CSettings::Get().GetBool("videoplayer.nativeresolution") && m_bestResolution != m_resolution - && m_nativeUpscaleSettings.CorrectPixelRatio ) - { - float destWidth = (float)(m_nativeUpscaleSettings.DestWidth); -diff --git a/xbmc/cores/VideoRenderers/BaseRenderer.h b/xbmc/cores/VideoRenderers/BaseRenderer.h -index c0645f3..b181454 100644 ---- a/xbmc/cores/VideoRenderers/BaseRenderer.h -+++ b/xbmc/cores/VideoRenderers/BaseRenderer.h -@@ -74,7 +74,6 @@ struct DVDVideoPicture; - - typedef struct NativeUpscale - { -- bool NativeUpscaleMode; - bool OverrideFPS; - bool CorrectPixelRatio; - int DestWidth; - -From a7c44cab2f8c563e4326cada82dd9bf912a4d972 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 7 Dec 2014 15:21:18 +0000 -Subject: [PATCH 102/102] [omxplayer] Remove test of removed setting, avoids a - log message - ---- - xbmc/cores/omxplayer/OMXPlayerAudio.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -index d305a07..2f1df45 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -@@ -525,17 +525,17 @@ AEDataFormat OMXPlayerAudio::GetDataFormat(CDVDStreamInfo hints) - /* check our audio capabilties */ - - /* pathrought is overriding hw decode*/ -- if(hints.codec == AV_CODEC_ID_AC3 && CAEFactory::SupportsRaw(AE_FMT_AC3, hints.samplerate) && !CSettings::Get().GetBool("audiooutput.dualaudio")) -+ if(hints.codec == AV_CODEC_ID_AC3 && CAEFactory::SupportsRaw(AE_FMT_AC3, hints.samplerate)) - { - dataFormat = AE_FMT_AC3; - m_passthrough = true; - } -- if(hints.codec == AV_CODEC_ID_EAC3 && CAEFactory::SupportsRaw(AE_FMT_AC3, hints.samplerate * 4) && !CSettings::Get().GetBool("audiooutput.dualaudio")) -+ if(hints.codec == AV_CODEC_ID_EAC3 && CAEFactory::SupportsRaw(AE_FMT_AC3, hints.samplerate * 4)) - { - dataFormat = AE_FMT_EAC3; - m_passthrough = true; - } -- if(hints.codec == AV_CODEC_ID_DTS && CAEFactory::SupportsRaw(AE_FMT_DTS, hints.samplerate) && !CSettings::Get().GetBool("audiooutput.dualaudio")) -+ if(hints.codec == AV_CODEC_ID_DTS && CAEFactory::SupportsRaw(AE_FMT_DTS, hints.samplerate)) - { - dataFormat = AE_FMT_DTS; - m_passthrough = true;