From 37d3bde303d20eda8378c69f169a0e2e9ed85382 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Wed, 26 Nov 2014 20:18:26 +0100 Subject: [PATCH] projects/RPi/patches/kodi: update RPi support patch Signed-off-by: Stephan Raue --- .../RPi/patches/kodi/kodi-001-newclock4.patch | 3078 ++++++++++++----- 1 file changed, 2186 insertions(+), 892 deletions(-) diff --git a/projects/RPi/patches/kodi/kodi-001-newclock4.patch b/projects/RPi/patches/kodi/kodi-001-newclock4.patch index ba5f34363a..04a9ce05ff 100644 --- a/projects/RPi/patches/kodi/kodi-001-newclock4.patch +++ b/projects/RPi/patches/kodi/kodi-001-newclock4.patch @@ -1,7 +1,7 @@ -From 1dcd04b174f31a8163ff66a648014a4e721af793 Mon Sep 17 00:00:00 2001 +From db6c4f2941023453ff8269f93f578ac08dcc2c82 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 01/96] [rbp/omxplayer] When opening a stream don't try to +Subject: [PATCH 01/94] [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 7488227c3099e0bc646a63ed370e3bd72a7c40df Mon Sep 17 00:00:00 2001 +From fda46bc1a4ff23967837db9e1e84088700be1d2f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 29 Apr 2014 15:23:22 +0100 -Subject: [PATCH 02/96] [ffmpeg] Speed up wtv index creation +Subject: [PATCH 02/94] [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 93085d1cd4ca39f8be362d187a289dcfdbb259e2 Mon Sep 17 00:00:00 2001 +From 984e194a9224f70a302e563cca411d3688c09426 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 2 Aug 2014 17:48:04 +0100 -Subject: [PATCH 08/96] [omx] Report decoded image name +Subject: [PATCH 08/94] [omx] Report decoded image name --- xbmc/cores/omxplayer/OMXImage.cpp | 1 + @@ -136,10 +136,10 @@ index aa413b9..22ec3f0 100644 else { -From f89c0a65973a566e379dabcac04762832892fade Mon Sep 17 00:00:00 2001 +From 1e2b37f26d4d7e0c183f9ea40141afdfd90efd46 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Dec 2013 16:55:05 +0000 -Subject: [PATCH 09/96] logging: Add microsecond timer to log messages +Subject: [PATCH 09/94] logging: Add microsecond timer to log messages --- xbmc/utils/log.cpp | 17 +++++++++++++++-- @@ -192,10 +192,10 @@ index 3443f12..31c4a99 100644 levelNames[logLevel]) + strData; -From 4ff7155455ee7a1cf9275bd3d27a284fa234e45f Mon Sep 17 00:00:00 2001 +From 3bb9dc1a63b6d50646ccaa7e5081996406a92241 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 10/96] [hifiberry] Hack: force it to be recognised as IEC958 +Subject: [PATCH 10/94] [hifiberry] Hack: force it to be recognised as IEC958 capable to enable passthrough options --- @@ -218,10 +218,10 @@ index d30cbab..b268819 100644 info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") { -From 5fd202bab729d160ab5779c2eb200ea67ad075c4 Mon Sep 17 00:00:00 2001 +From c029c4b977b3ab2ed6e6b536dd801277aee6ca38 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 11 Dec 2013 17:21:54 +0000 -Subject: [PATCH 11/96] Move the reference-counting of Begin and End calls from +Subject: [PATCH 11/94] Move the reference-counting of Begin and End calls from DX and GL source files into GUIFontTTF.cpp. --- @@ -609,10 +609,10 @@ index c0bb53a..735fb3a 100644 protected: virtual CBaseTexture* ReallocTexture(unsigned int& newHeight); -From ca22488f5a32a225db672440d82893bb088be3ee Mon Sep 17 00:00:00 2001 +From fc9f443592fe9ea2f642f8977d1d56f1be6c91a2 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 11 Dec 2013 18:47:54 +0000 -Subject: [PATCH 12/96] Convert CGUIFontTTFBase::m_vertex to be managed as a +Subject: [PATCH 12/94] Convert CGUIFontTTFBase::m_vertex to be managed as a std::vector. Also retired CGUIFontTTFBase::m_vertex_count and @@ -792,10 +792,10 @@ index 97853fd..b76c6a5 100644 *vertices++ = m_vertex[i]; *vertices++ = m_vertex[i+1]; -From 12198bab6856d78b607f82b19937eac181b57bf5 Mon Sep 17 00:00:00 2001 +From 366a96b8cb1731d1dcac35a308daf740bfb0c97c Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Mon, 16 Dec 2013 18:58:12 +0000 -Subject: [PATCH 13/96] CGUIFontTTFBase::RenderCharacter can now append to +Subject: [PATCH 13/94] CGUIFontTTFBase::RenderCharacter can now append to arbitrary vectors of vertices rather than only CGUIFontTTFBase::m_vertex --- @@ -868,10 +868,10 @@ index 5675725..a5d44f4 100644 virtual CBaseTexture* ReallocTexture(unsigned int& newHeight) = 0; -From 65fb71707aa53ca65b292bf0b1eec353aea9fdf2 Mon Sep 17 00:00:00 2001 +From 36f29ea2cd28132a8ea39af65557ac0057395ca4 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 17:18:38 +0000 -Subject: [PATCH 14/96] Add a cache of font glyph bounding box vertices. +Subject: [PATCH 14/94] 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 @@ -1631,10 +1631,10 @@ index f351c99..9036ba9 100644 + return !operator==(a, b); +} -From ea7126fb078553f5b59fcea3852a92bb80172aa1 Mon Sep 17 00:00:00 2001 +From 2b8e7c7469380dbf0f881e9986a69130a56b71cc Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 23 Jan 2014 22:24:17 +0000 -Subject: [PATCH 15/96] Lay the groundwork for hardware clipping. +Subject: [PATCH 15/94] 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 @@ -1896,10 +1896,10 @@ index 98e398a..81ee49e 100644 virtual void ResetScissors(); -From 08f270e8885178bbae7bc9846e3829aa2cc70c97 Mon Sep 17 00:00:00 2001 +From cbffceaa81fec314a3137bd405b7bb974f7dc20b Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 23 Jan 2014 16:42:22 +0000 -Subject: [PATCH 16/96] Increase font cache hit rate by keying on the +Subject: [PATCH 16/94] 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 @@ -2100,10 +2100,10 @@ index 3b93672..258dffa 100644 private: virtual bool FirstBegin() = 0; -From d9433a16456d61e0bc23ff0a81d87c498f2b32af Mon Sep 17 00:00:00 2001 +From 5c2fca4ac8613f7791bd9171b52af2cffce46cd8 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 8 Jan 2014 12:16:33 +0000 -Subject: [PATCH 17/96] Rewrite of scrolling text code. +Subject: [PATCH 17/94] 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 @@ -2419,10 +2419,10 @@ index 2cda726..fbc579e 100644 private: void Process(); -From fc0c3a461137da8bd1d923d4dfbcab2843ad1975 Mon Sep 17 00:00:00 2001 +From 4ec3b5a0d0629a566b2031e2b6d28fecd5b78768 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Mon, 27 Jan 2014 23:21:10 +0000 -Subject: [PATCH 18/96] Move the application of the translation offsets into +Subject: [PATCH 18/94] 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 @@ -2616,10 +2616,10 @@ index 9935ea4..18c9358 100644 memset(newTexture->GetPixels(), 0, m_textureHeight * newTexture->GetPitch()); if (m_texture) -From d98cfe3761c73b677f6bdb59313cead3063f67a9 Mon Sep 17 00:00:00 2001 +From 7fa47d99872218dac2bdb17140722d328902d004 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 15:28:06 +0000 -Subject: [PATCH 19/96] Rather than applying the translation offsets to the +Subject: [PATCH 19/94] 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. @@ -2763,10 +2763,10 @@ index 81ee49e..d2f9cd1 100644 protected: virtual void SetVSyncImpl(bool enable) = 0; -From 615511a2410d0f386601c7d2f975f9afd676b418 Mon Sep 17 00:00:00 2001 +From ff7ba06f2e37e351734b6380efb73ef44914f2f1 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 29 Jan 2014 13:21:19 +0000 -Subject: [PATCH 20/96] Enable hardware clipping. +Subject: [PATCH 20/94] Enable hardware clipping. --- xbmc/guilib/GUIFontTTF.cpp | 4 ++-- @@ -2838,10 +2838,10 @@ index ea08bf4..b63e337 100644 glUniformMatrix4fv(modelLoc, 1, GL_FALSE, g_matrices.GetMatrix(MM_MODELVIEW)); } -From 4c00aacaa47c62887fa7d89eb009e1cc5f9df9e5 Mon Sep 17 00:00:00 2001 +From 3dc6d8254e363ca5a7ff4e4c5a0ecbf0181b05d9 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 15:32:51 +0000 -Subject: [PATCH 21/96] Move the vertex data across to a vertex buffer object +Subject: [PATCH 21/94] Move the vertex data across to a vertex buffer object just prior to drawing. --- @@ -2892,10 +2892,10 @@ index b63e337..b00055d 100644 // Disable the attributes used by this shader -From f20be94d26de731653a6a582623e6eacc9794460 Mon Sep 17 00:00:00 2001 +From 8eafc910a153c7022cfaab1e35efbc07e9be8dcb Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 16:04:04 +0000 -Subject: [PATCH 22/96] Move vertex data into an OpenGL VBO when the font cache +Subject: [PATCH 22/94] 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 @@ -3168,10 +3168,10 @@ index 735fb3a..6102c90 100644 protected: virtual CBaseTexture* ReallocTexture(unsigned int& newHeight); -From 87cb51e81e740f8aceb4560ede19c2d042552175 Mon Sep 17 00:00:00 2001 +From 2f01454df0cf8990a4782db057f0e4cce408dc33 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 1 Nov 2014 22:15:13 +0000 -Subject: [PATCH 23/96] Switch from glDrawArrays() to glDrawElements(). +Subject: [PATCH 23/94] 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. @@ -3392,10 +3392,10 @@ index d2a94c9..7b6097a 100644 if (m_display != EGL_NO_DISPLAY) -From 51b6785e45e6cab22f356a810492955aec36fde8 Mon Sep 17 00:00:00 2001 +From 4b04173a679281175151ed2da0e432f3f188dc5c Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 24/96] Improved file buffering in CArchive +Subject: [PATCH 24/94] 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 @@ -3455,20 +3455,20 @@ index 6ed0f8f..8506d95 100644 } else -From 590c47eb844a19c8ce68cf22d41415f870b0a6fa Mon Sep 17 00:00:00 2001 +From 32c021b951ac83f52a60e9aa2930bcd27ac8de15 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 10 Sep 2014 22:07:21 +0100 -Subject: [PATCH 25/96] [mmal] Allow mmal codec for dvd stills +Subject: [PATCH 25/94] [mmal] Allow mmal codec for dvd stills --- xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -index f139433..4183a2b 100644 +index 3cbb9f2..6a608cd 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -@@ -192,6 +192,10 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne +@@ -193,6 +193,10 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne #endif CLog::Log(LOGDEBUG, "CDVDFactoryCodec: compiled in hardware support: %s", hwSupport.c_str()); @@ -3480,17 +3480,17 @@ index f139433..4183a2b 100644 { // If dvd is an mpeg2 and hint.stills -From f98edd332fe330c185d9a49bcd2c0ca0680128a0 Mon Sep 17 00:00:00 2001 +From defa847036451d863a81be3335c5c04ed88d343b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 12 Aug 2014 00:31:36 +0100 -Subject: [PATCH 26/96] [omxcodec] Don't force software codec with dvds +Subject: [PATCH 26/94] [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 c5309fe..ee63a70 100644 +index 7d6e696..056eb13 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -3209,7 +3209,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) @@ -3504,663 +3504,10 @@ index c5309fe..ee63a70 100644 CDVDInputStream::IMenus* pMenus = dynamic_cast(m_pInputStream); -From 1b1ef70c09dea2b56fb6c7d54b98ea2ce06954aa Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 2 Nov 2014 20:10:08 +0000 -Subject: [PATCH 27/96] [dvdplayervideo] Make variables more local - ---- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index e47f85c..e42f8ff 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -305,10 +305,6 @@ void CDVDPlayerVideo::Process() - CLog::Log(LOGNOTICE, "running thread: video_thread"); - - DVDVideoPicture picture; -- CPulldownCorrection pulldown; -- CDVDVideoPPFFmpeg mPostProcess(""); -- std::string sPostProcessType; -- bool bPostProcessDeint = false; - - memset(&picture, 0, sizeof(DVDVideoPicture)); - -@@ -316,8 +312,6 @@ void CDVDPlayerVideo::Process() - double frametime = (double)DVD_TIME_BASE / m_fFrameRate; - - int iDropped = 0; //frames dropped in a row -- bool bRequestDrop = false; -- int iDropDirective; - - m_videoStats.Start(); - m_droppingStats.Reset(); -@@ -496,6 +490,12 @@ void CDVDPlayerVideo::Process() - DemuxPacket* pPacket = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacket(); - bool bPacketDrop = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacketDrop(); - -+ CPulldownCorrection pulldown; -+ CDVDVideoPPFFmpeg mPostProcess(""); -+ std::string sPostProcessType; -+ bool bPostProcessDeint = false; -+ bool bRequestDrop = false; -+ - if (m_stalled) - { - CLog::Log(LOGINFO, "CDVDPlayerVideo - Stillframe left, switching to normal playback"); -@@ -512,7 +512,7 @@ void CDVDPlayerVideo::Process() - } - - bRequestDrop = false; -- iDropDirective = CalcDropRequirement(pts); -+ int iDropDirective = CalcDropRequirement(pts); - if (iDropDirective & EOS_VERYLATE) - { - if (m_bAllowDrop) - -From 2aa771478a55b22cc80baf8cd20916da30fb6fb4 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Nov 2014 16:44:52 +0000 -Subject: [PATCH 28/96] [dvdplayervideo] Move packet handling into separate - function - ---- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 530 ++++++++++++++++---------------- - xbmc/cores/dvdplayer/DVDPlayerVideo.h | 1 + - 2 files changed, 269 insertions(+), 262 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index e42f8ff..7ee8638 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -300,6 +300,273 @@ void CDVDPlayerVideo::OnStartup() - m_FlipTimePts = 0.0; - } - -+void CDVDPlayerVideo::HandleDemuxerPacket(DemuxPacket* pPacket, bool bPacketDrop, int &iDropped, double &pts, CDVDMsg* pMsg, DVDVideoPicture &picture) -+{ -+ double frametime = (double)DVD_TIME_BASE / m_fFrameRate; -+ int iPriority = (m_speed == DVD_PLAYSPEED_PAUSE && m_started) ? 1 : 0; -+ CPulldownCorrection pulldown; -+ CDVDVideoPPFFmpeg mPostProcess(""); -+ std::string sPostProcessType; -+ bool bPostProcessDeint = false; -+ bool bRequestDrop = false; -+ -+ if (m_stalled) -+ { -+ CLog::Log(LOGINFO, "CDVDPlayerVideo - Stillframe left, switching to normal playback"); -+ m_stalled = false; -+ -+ //don't allow the first frames after a still to be dropped -+ //sometimes we get multiple stills (long duration frames) after each other -+ //in normal mpegs -+ m_iNrOfPicturesNotToSkip = 5; -+ } -+ else if( iDropped*frametime > DVD_MSEC_TO_TIME(100) && m_iNrOfPicturesNotToSkip == 0 ) -+ { // if we dropped too many pictures in a row, insert a forced picture -+ m_iNrOfPicturesNotToSkip = 1; -+ } -+ -+ bRequestDrop = false; -+ int iDropDirective = CalcDropRequirement(pts); -+ if (iDropDirective & EOS_VERYLATE) -+ { -+ if (m_bAllowDrop) -+ { -+ m_pullupCorrection.Flush(); -+ bRequestDrop = true; -+ } -+ } -+ int codecControl = 0; -+ if (iDropDirective & EOS_BUFFER_LEVEL) -+ codecControl |= DVD_CODEC_CTRL_DRAIN; -+ if (m_speed > DVD_PLAYSPEED_NORMAL) -+ codecControl |= DVD_CODEC_CTRL_NO_POSTPROC; -+ m_pVideoCodec->SetCodecControl(codecControl); -+ if (iDropDirective & EOS_DROPPED) -+ { -+ m_iDroppedFrames++; -+ iDropped++; -+ } -+ -+ if (m_messageQueue.GetDataSize() == 0 -+ || m_speed < 0) -+ { -+ bRequestDrop = false; -+ m_iDroppedRequest = 0; -+ m_iLateFrames = 0; -+ } -+ -+ // if player want's us to drop this packet, do so nomatter what -+ if(bPacketDrop) -+ bRequestDrop = true; -+ -+ // tell codec if next frame should be dropped -+ // problem here, if one packet contains more than one frame -+ // both frames will be dropped in that case instead of just the first -+ // decoder still needs to provide an empty image structure, with correct flags -+ m_pVideoCodec->SetDropState(bRequestDrop); -+ -+ // ask codec to do deinterlacing if possible -+ EDEINTERLACEMODE mDeintMode = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; -+ EINTERLACEMETHOD mInt = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); -+ -+ unsigned int mFilters = 0; -+ -+ if (mDeintMode != VS_DEINTERLACEMODE_OFF) -+ { -+ if (mInt == VS_INTERLACEMETHOD_DEINTERLACE) -+ mFilters = CDVDVideoCodec::FILTER_DEINTERLACE_ANY; -+ else if(mInt == VS_INTERLACEMETHOD_DEINTERLACE_HALF) -+ mFilters = CDVDVideoCodec::FILTER_DEINTERLACE_ANY | CDVDVideoCodec::FILTER_DEINTERLACE_HALFED; -+ -+ if (mDeintMode == VS_DEINTERLACEMODE_AUTO && mFilters) -+ mFilters |= CDVDVideoCodec::FILTER_DEINTERLACE_FLAGGED; -+ } -+ -+ if (!g_renderManager.Supports(RENDERFEATURE_ROTATION)) -+ mFilters |= CDVDVideoCodec::FILTER_ROTATE; -+ -+ mFilters = m_pVideoCodec->SetFilters(mFilters); -+ -+ int iDecoderState = m_pVideoCodec->Decode(pPacket->pData, pPacket->iSize, pPacket->dts, pPacket->pts); -+ -+ // buffer packets so we can recover should decoder flush for some reason -+ if(m_pVideoCodec->GetConvergeCount() > 0) -+ { -+ m_packets.push_back(DVDMessageListItem(pMsg, 0)); -+ if(m_packets.size() > m_pVideoCodec->GetConvergeCount() -+ || m_packets.size() * frametime > DVD_SEC_TO_TIME(10)) -+ m_packets.pop_front(); -+ } -+ -+ m_videoStats.AddSampleBytes(pPacket->iSize); -+ -+ // reset the request, the following while loop may break before -+ // setting the flag to a new value -+ bRequestDrop = false; -+ -+ // loop while no error -+ while (!m_bStop) -+ { -+ -+ // if decoder was flushed, we need to seek back again to resume rendering -+ if (iDecoderState & VC_FLUSHED) -+ { -+ CLog::Log(LOGDEBUG, "CDVDPlayerVideo - video decoder was flushed"); -+ while(!m_packets.empty()) -+ { -+ CDVDMsgDemuxerPacket* msg = (CDVDMsgDemuxerPacket*)m_packets.front().message->Acquire(); -+ m_packets.pop_front(); -+ -+ // all packets except the last one should be dropped -+ // if prio packets and current packet should be dropped, this is likely a new reset -+ msg->m_drop = !m_packets.empty() || (iPriority > 0 && bPacketDrop); -+ m_messageQueue.Put(msg, iPriority + 10); -+ } -+ -+ m_pVideoCodec->Reset(); -+ m_packets.clear(); -+ picture.iFlags &= ~DVP_FLAG_ALLOCATED; -+ g_renderManager.DiscardBuffer(); -+ break; -+ } -+ -+ // if decoder had an error, tell it to reset to avoid more problems -+ if (iDecoderState & VC_ERROR) -+ { -+ CLog::Log(LOGDEBUG, "CDVDPlayerVideo - video decoder returned error"); -+ break; -+ } -+ -+ // check for a new picture -+ if (iDecoderState & VC_PICTURE) -+ { -+ -+ // try to retrieve the picture (should never fail!), unless there is a demuxer bug ofcours -+ m_pVideoCodec->ClearPicture(&picture); -+ if (m_pVideoCodec->GetPicture(&picture)) -+ { -+ sPostProcessType.clear(); -+ -+ if(picture.iDuration == 0.0) -+ picture.iDuration = frametime; -+ -+ if(bPacketDrop) -+ picture.iFlags |= DVP_FLAG_DROPPED; -+ -+ if (m_iNrOfPicturesNotToSkip > 0) -+ { -+ picture.iFlags |= DVP_FLAG_NOSKIP; -+ m_iNrOfPicturesNotToSkip--; -+ } -+ -+ // validate picture timing, -+ // if both dts/pts invalid, use pts calulated from picture.iDuration -+ // if pts invalid use dts, else use picture.pts as passed -+ if (picture.dts == DVD_NOPTS_VALUE && picture.pts == DVD_NOPTS_VALUE) -+ picture.pts = pts; -+ else if (picture.pts == DVD_NOPTS_VALUE) -+ picture.pts = picture.dts; -+ -+ /* use forced aspect if any */ -+ if( m_fForcedAspectRatio != 0.0f ) -+ picture.iDisplayWidth = (int) (picture.iDisplayHeight * m_fForcedAspectRatio); -+ -+ //Deinterlace if codec said format was interlaced or if we have selected we want to deinterlace -+ //this video -+ if ((mDeintMode == VS_DEINTERLACEMODE_AUTO && (picture.iFlags & DVP_FLAG_INTERLACED)) || mDeintMode == VS_DEINTERLACEMODE_FORCE) -+ { -+ if(mInt == VS_INTERLACEMETHOD_SW_BLEND) -+ { -+ if (!sPostProcessType.empty()) -+ sPostProcessType += ","; -+ sPostProcessType += g_advancedSettings.m_videoPPFFmpegDeint; -+ bPostProcessDeint = true; -+ } -+ } -+ -+ if (CMediaSettings::Get().GetCurrentVideoSettings().m_PostProcess) -+ { -+ if (!sPostProcessType.empty()) -+ sPostProcessType += ","; -+ // This is what mplayer uses for its "high-quality filter combination" -+ sPostProcessType += g_advancedSettings.m_videoPPFFmpegPostProc; -+ } -+ -+ if (!sPostProcessType.empty()) -+ { -+ mPostProcess.SetType(sPostProcessType, bPostProcessDeint); -+ if (mPostProcess.Process(&picture)) -+ mPostProcess.GetPicture(&picture); -+ } -+ -+ /* if frame has a pts (usually originiating from demux packet), use that */ -+ if(picture.pts != DVD_NOPTS_VALUE) -+ { -+ if(pulldown.enabled()) -+ picture.pts += pulldown.pts(); -+ -+ pts = picture.pts; -+ } -+ -+ if(pulldown.enabled()) -+ { -+ picture.iDuration = pulldown.dur(); -+ pulldown.next(); -+ } -+ -+ if (picture.iRepeatPicture) -+ picture.iDuration *= picture.iRepeatPicture + 1; -+ -+ int iResult = OutputPicture(&picture, pts); -+ -+ frametime = (double)DVD_TIME_BASE/m_fFrameRate; -+ -+ if(m_started == false) -+ { -+ m_codecname = m_pVideoCodec->GetName(); -+ m_started = true; -+ m_messageParent.Put(new CDVDMsgInt(CDVDMsg::PLAYER_STARTED, DVDPLAYER_VIDEO)); -+ } -+ -+ // guess next frame pts. iDuration is always valid -+ if (m_speed != 0) -+ pts += picture.iDuration * m_speed / abs(m_speed); -+ -+ if( iResult & EOS_ABORT ) -+ { -+ //if we break here and we directly try to decode again wihout -+ //flushing the video codec things break for some reason -+ //i think the decoder (libmpeg2 atleast) still has a pointer -+ //to the data, and when the packet is freed that will fail. -+ iDecoderState = m_pVideoCodec->Decode(NULL, 0, DVD_NOPTS_VALUE, DVD_NOPTS_VALUE); -+ break; -+ } -+ -+ if( (iResult & EOS_DROPPED) && !bPacketDrop ) -+ { -+ m_iDroppedFrames++; -+ iDropped++; -+ } -+ else -+ iDropped = 0; -+ } -+ else -+ { -+ CLog::Log(LOGWARNING, "Decoder Error getting videoPicture."); -+ m_pVideoCodec->Reset(); -+ } -+ } -+ -+ // if the decoder needs more data, we just break this loop -+ // and try to get more data from the videoQueue -+ if (iDecoderState & VC_BUFFER) -+ break; -+ -+ // the decoder didn't need more data, flush the remaning buffer -+ iDecoderState = m_pVideoCodec->Decode(NULL, 0, DVD_NOPTS_VALUE, DVD_NOPTS_VALUE); -+ } -+} -+ - void CDVDPlayerVideo::Process() - { - CLog::Log(LOGNOTICE, "running thread: video_thread"); -@@ -489,268 +756,7 @@ void CDVDPlayerVideo::Process() - { - DemuxPacket* pPacket = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacket(); - bool bPacketDrop = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacketDrop(); -- -- CPulldownCorrection pulldown; -- CDVDVideoPPFFmpeg mPostProcess(""); -- std::string sPostProcessType; -- bool bPostProcessDeint = false; -- bool bRequestDrop = false; -- -- if (m_stalled) -- { -- CLog::Log(LOGINFO, "CDVDPlayerVideo - Stillframe left, switching to normal playback"); -- m_stalled = false; -- -- //don't allow the first frames after a still to be dropped -- //sometimes we get multiple stills (long duration frames) after each other -- //in normal mpegs -- m_iNrOfPicturesNotToSkip = 5; -- } -- else if( iDropped*frametime > DVD_MSEC_TO_TIME(100) && m_iNrOfPicturesNotToSkip == 0 ) -- { // if we dropped too many pictures in a row, insert a forced picture -- m_iNrOfPicturesNotToSkip = 1; -- } -- -- bRequestDrop = false; -- int iDropDirective = CalcDropRequirement(pts); -- if (iDropDirective & EOS_VERYLATE) -- { -- if (m_bAllowDrop) -- { -- m_pullupCorrection.Flush(); -- bRequestDrop = true; -- } -- } -- int codecControl = 0; -- if (iDropDirective & EOS_BUFFER_LEVEL) -- codecControl |= DVD_CODEC_CTRL_DRAIN; -- if (m_speed > DVD_PLAYSPEED_NORMAL) -- codecControl |= DVD_CODEC_CTRL_NO_POSTPROC; -- m_pVideoCodec->SetCodecControl(codecControl); -- if (iDropDirective & EOS_DROPPED) -- { -- m_iDroppedFrames++; -- iDropped++; -- } -- -- if (m_messageQueue.GetDataSize() == 0 -- || m_speed < 0) -- { -- bRequestDrop = false; -- m_iDroppedRequest = 0; -- m_iLateFrames = 0; -- } -- -- // if player want's us to drop this packet, do so nomatter what -- if(bPacketDrop) -- bRequestDrop = true; -- -- // tell codec if next frame should be dropped -- // problem here, if one packet contains more than one frame -- // both frames will be dropped in that case instead of just the first -- // decoder still needs to provide an empty image structure, with correct flags -- m_pVideoCodec->SetDropState(bRequestDrop); -- -- // ask codec to do deinterlacing if possible -- EDEINTERLACEMODE mDeintMode = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; -- EINTERLACEMETHOD mInt = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); -- -- unsigned int mFilters = 0; -- -- if (mDeintMode != VS_DEINTERLACEMODE_OFF) -- { -- if (mInt == VS_INTERLACEMETHOD_DEINTERLACE) -- mFilters = CDVDVideoCodec::FILTER_DEINTERLACE_ANY; -- else if(mInt == VS_INTERLACEMETHOD_DEINTERLACE_HALF) -- mFilters = CDVDVideoCodec::FILTER_DEINTERLACE_ANY | CDVDVideoCodec::FILTER_DEINTERLACE_HALFED; -- -- if (mDeintMode == VS_DEINTERLACEMODE_AUTO && mFilters) -- mFilters |= CDVDVideoCodec::FILTER_DEINTERLACE_FLAGGED; -- } -- -- if (!g_renderManager.Supports(RENDERFEATURE_ROTATION)) -- mFilters |= CDVDVideoCodec::FILTER_ROTATE; -- -- mFilters = m_pVideoCodec->SetFilters(mFilters); -- -- int iDecoderState = m_pVideoCodec->Decode(pPacket->pData, pPacket->iSize, pPacket->dts, pPacket->pts); -- -- // buffer packets so we can recover should decoder flush for some reason -- if(m_pVideoCodec->GetConvergeCount() > 0) -- { -- m_packets.push_back(DVDMessageListItem(pMsg, 0)); -- if(m_packets.size() > m_pVideoCodec->GetConvergeCount() -- || m_packets.size() * frametime > DVD_SEC_TO_TIME(10)) -- m_packets.pop_front(); -- } -- -- m_videoStats.AddSampleBytes(pPacket->iSize); -- -- // reset the request, the following while loop may break before -- // setting the flag to a new value -- bRequestDrop = false; -- -- // loop while no error -- while (!m_bStop) -- { -- -- // if decoder was flushed, we need to seek back again to resume rendering -- if (iDecoderState & VC_FLUSHED) -- { -- CLog::Log(LOGDEBUG, "CDVDPlayerVideo - video decoder was flushed"); -- while(!m_packets.empty()) -- { -- CDVDMsgDemuxerPacket* msg = (CDVDMsgDemuxerPacket*)m_packets.front().message->Acquire(); -- m_packets.pop_front(); -- -- // all packets except the last one should be dropped -- // if prio packets and current packet should be dropped, this is likely a new reset -- msg->m_drop = !m_packets.empty() || (iPriority > 0 && bPacketDrop); -- m_messageQueue.Put(msg, iPriority + 10); -- } -- -- m_pVideoCodec->Reset(); -- m_packets.clear(); -- picture.iFlags &= ~DVP_FLAG_ALLOCATED; -- g_renderManager.DiscardBuffer(); -- break; -- } -- -- // if decoder had an error, tell it to reset to avoid more problems -- if (iDecoderState & VC_ERROR) -- { -- CLog::Log(LOGDEBUG, "CDVDPlayerVideo - video decoder returned error"); -- break; -- } -- -- // check for a new picture -- if (iDecoderState & VC_PICTURE) -- { -- -- // try to retrieve the picture (should never fail!), unless there is a demuxer bug ofcours -- m_pVideoCodec->ClearPicture(&picture); -- if (m_pVideoCodec->GetPicture(&picture)) -- { -- sPostProcessType.clear(); -- -- if(picture.iDuration == 0.0) -- picture.iDuration = frametime; -- -- if(bPacketDrop) -- picture.iFlags |= DVP_FLAG_DROPPED; -- -- if (m_iNrOfPicturesNotToSkip > 0) -- { -- picture.iFlags |= DVP_FLAG_NOSKIP; -- m_iNrOfPicturesNotToSkip--; -- } -- -- // validate picture timing, -- // if both dts/pts invalid, use pts calulated from picture.iDuration -- // if pts invalid use dts, else use picture.pts as passed -- if (picture.dts == DVD_NOPTS_VALUE && picture.pts == DVD_NOPTS_VALUE) -- picture.pts = pts; -- else if (picture.pts == DVD_NOPTS_VALUE) -- picture.pts = picture.dts; -- -- /* use forced aspect if any */ -- if( m_fForcedAspectRatio != 0.0f ) -- picture.iDisplayWidth = (int) (picture.iDisplayHeight * m_fForcedAspectRatio); -- -- //Deinterlace if codec said format was interlaced or if we have selected we want to deinterlace -- //this video -- if ((mDeintMode == VS_DEINTERLACEMODE_AUTO && (picture.iFlags & DVP_FLAG_INTERLACED)) || mDeintMode == VS_DEINTERLACEMODE_FORCE) -- { -- if(mInt == VS_INTERLACEMETHOD_SW_BLEND) -- { -- if (!sPostProcessType.empty()) -- sPostProcessType += ","; -- sPostProcessType += g_advancedSettings.m_videoPPFFmpegDeint; -- bPostProcessDeint = true; -- } -- } -- -- if (CMediaSettings::Get().GetCurrentVideoSettings().m_PostProcess) -- { -- if (!sPostProcessType.empty()) -- sPostProcessType += ","; -- // This is what mplayer uses for its "high-quality filter combination" -- sPostProcessType += g_advancedSettings.m_videoPPFFmpegPostProc; -- } -- -- if (!sPostProcessType.empty()) -- { -- mPostProcess.SetType(sPostProcessType, bPostProcessDeint); -- if (mPostProcess.Process(&picture)) -- mPostProcess.GetPicture(&picture); -- } -- -- /* if frame has a pts (usually originiating from demux packet), use that */ -- if(picture.pts != DVD_NOPTS_VALUE) -- { -- if(pulldown.enabled()) -- picture.pts += pulldown.pts(); -- -- pts = picture.pts; -- } -- -- if(pulldown.enabled()) -- { -- picture.iDuration = pulldown.dur(); -- pulldown.next(); -- } -- -- if (picture.iRepeatPicture) -- picture.iDuration *= picture.iRepeatPicture + 1; -- -- int iResult = OutputPicture(&picture, pts); -- -- frametime = (double)DVD_TIME_BASE/m_fFrameRate; -- -- if(m_started == false) -- { -- m_codecname = m_pVideoCodec->GetName(); -- m_started = true; -- m_messageParent.Put(new CDVDMsgInt(CDVDMsg::PLAYER_STARTED, DVDPLAYER_VIDEO)); -- } -- -- // guess next frame pts. iDuration is always valid -- if (m_speed != 0) -- pts += picture.iDuration * m_speed / abs(m_speed); -- -- if( iResult & EOS_ABORT ) -- { -- //if we break here and we directly try to decode again wihout -- //flushing the video codec things break for some reason -- //i think the decoder (libmpeg2 atleast) still has a pointer -- //to the data, and when the packet is freed that will fail. -- iDecoderState = m_pVideoCodec->Decode(NULL, 0, DVD_NOPTS_VALUE, DVD_NOPTS_VALUE); -- break; -- } -- -- if( (iResult & EOS_DROPPED) && !bPacketDrop ) -- { -- m_iDroppedFrames++; -- iDropped++; -- } -- else -- iDropped = 0; -- } -- else -- { -- CLog::Log(LOGWARNING, "Decoder Error getting videoPicture."); -- m_pVideoCodec->Reset(); -- } -- } -- -- // if the decoder needs more data, we just break this loop -- // and try to get more data from the videoQueue -- if (iDecoderState & VC_BUFFER) -- break; -- -- // the decoder didn't need more data, flush the remaning buffer -- iDecoderState = m_pVideoCodec->Decode(NULL, 0, DVD_NOPTS_VALUE, DVD_NOPTS_VALUE); -- } -+ HandleDemuxerPacket(pPacket, bPacketDrop, iDropped, pts, pMsg, picture); - } - - // all data is used by the decoder, we can safely free it now -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.h b/xbmc/cores/dvdplayer/DVDPlayerVideo.h -index 4e1b3d6..a1606f7 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.h -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.h -@@ -134,6 +134,7 @@ class CDVDPlayerVideo : public CThread, public IDVDStreamPlayerVideo - #endif - void ProcessVideoUserData(DVDVideoUserData* pVideoUserData, double pts); - void OpenStream(CDVDStreamInfo &hint, CDVDVideoCodec* codec); -+ void HandleDemuxerPacket(DemuxPacket* pPacket, bool bPacketDrop, int &iDropped, double &pts, CDVDMsg* pMsg, DVDVideoPicture &picture); - - CDVDMessageQueue m_messageQueue; - CDVDMessageQueue& m_messageParent; - -From 34b1dbc41a3892b8915225d5dac79eb2c64a38bd Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Nov 2014 16:49:48 +0000 -Subject: [PATCH 29/96] [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. ---- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 7ee8638..c22ea9f 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -621,6 +621,8 @@ void CDVDPlayerVideo::Process() - OutputPicture(&picture, pts); - pts+= frametime; - } -+ if (m_hints.stills) -+ HandleDemuxerPacket(NULL, 0, iDropped, pts, pMsg, picture); - - continue; - } - -From 23fb5512d6e14e331ba07460f882c1a6cde62777 Mon Sep 17 00:00:00 2001 +From f85e52b866c6999ec0a541be580c679235feb60f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 16 Apr 2014 21:18:06 +0100 -Subject: [PATCH 30/96] [omxplayer] Don't propagate 3d flags based on supported +Subject: [PATCH 27/94] [omxplayer] Don't propagate 3d flags based on supported 3d modes --- @@ -4213,10 +3560,10 @@ index ac838ce..605318c9 100644 unsigned int iDisplayWidth = width; unsigned int iDisplayHeight = height; -From d1c9ca9931e4b3eab3797f4c29ff6dc5debae4c0 Mon Sep 17 00:00:00 2001 +From c93d2c6939a6785c7c07c55e45f676541d31f0f8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:00:52 +0100 -Subject: [PATCH 31/96] [graphics] Don't set stereo mode based on resolution +Subject: [PATCH 28/94] [graphics] Don't set stereo mode based on resolution The resolution change should follow stereo mode --- @@ -4274,10 +3621,10 @@ index 3cb5587..fe6ebf4 100644 m_iScreenWidth = info_mod.iWidth; -From db73e060d84417d8d185da37e6fc812b1400909c Mon Sep 17 00:00:00 2001 +From 4ea1e0c440b772a69efd9e143402d969800856e3 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:01:51 +0100 -Subject: [PATCH 32/96] [graphics] Allow switching to a more suitable 3D +Subject: [PATCH 29/94] [graphics] Allow switching to a more suitable 3D resolution --- @@ -4363,10 +3710,10 @@ index 2904c1b..8d3774f 100644 void ResetOverscan(RESOLUTION_INFO &resinfo); void ResetScreenParameters(RESOLUTION res); -From 348aafe315666d38081bc9031e85db8cec09def1 Mon Sep 17 00:00:00 2001 +From 2788746319bb06b7fc6c23085cf04d2f7e6dc2df Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:38:55 +0100 -Subject: [PATCH 33/96] [3D] Support switching to 3D resolutions +Subject: [PATCH 30/94] [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. @@ -4448,10 +3795,10 @@ index 83c3adb..8076e76 100644 return current; } -From 2db406a38711131fe9d5bdfc7ba558b7acde8267 Mon Sep 17 00:00:00 2001 +From 6fd9e15754fcbb22c824a59b121c6cc93883f679 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 23 Apr 2014 00:05:07 +0100 -Subject: [PATCH 34/96] [graphics] Make pixel ratio for 3d modes consistent +Subject: [PATCH 31/94] [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. @@ -4654,10 +4001,10 @@ index c58c28a..bf1e589 100644 AddUniqueResolution(res2, resolutions); -From f0ed72517d83dbdeb82b63ac4092ca0ea1608420 Mon Sep 17 00:00:00 2001 +From d654aa2b435f3173c091bb2fff44651da9255f80 Mon Sep 17 00:00:00 2001 From: da-anda Date: Sun, 17 Aug 2014 21:09:59 +0200 -Subject: [PATCH 35/96] handle stereoscopic mode of videos in mixed playlists +Subject: [PATCH 32/94] handle stereoscopic mode of videos in mixed playlists --- language/English/strings.po | 2 +- @@ -4825,10 +4172,10 @@ index 35ba597..b013942 100644 case 2: // Mono SetStereoMode( RENDER_STEREO_MODE_MONO ); -From 0add99cbc1180cb9a7c8b78d28c305061c52e2ce Mon Sep 17 00:00:00 2001 +From 1bb17fa5e7acf432dbd72e8687e0389e3f5990d9 Mon Sep 17 00:00:00 2001 From: da-anda Date: Sat, 16 Aug 2014 11:20:54 +0200 -Subject: [PATCH 36/96] remember user selected 3D modes between videos until +Subject: [PATCH 33/94] remember user selected 3D modes between videos until playback ended --- @@ -5045,10 +4392,10 @@ index c1dfb93..cb54bd0 100644 -From 70a5778c0ea356b53491d4a910299705b945157d Mon Sep 17 00:00:00 2001 +From b3a8c4a0e78e79efa07eb82ea282bfd3e32db1de Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 37/96] filesystem: Make support of browsing into archives +Subject: [PATCH 34/94] 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. @@ -5148,10 +4495,10 @@ index 2fd8777..3b294cd 100644 // read the name of the playlist in -From 89fac6b9755fa8bde9f7957463f4a54753ef3ed9 Mon Sep 17 00:00:00 2001 +From 7cfa65293f184ab5797d0e6087068d3452bd2f6c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 13:06:57 +0000 -Subject: [PATCH 39/96] [rbp] Make cachemembuffersize default depend on memory +Subject: [PATCH 36/94] [rbp] Make cachemembuffersize default depend on memory size --- @@ -5190,10 +4537,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 f4c309b..bf78194 100644 +index e6d58b3..bc8598e 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp -@@ -363,7 +363,12 @@ void CAdvancedSettings::Initialize() +@@ -364,7 +364,12 @@ void CAdvancedSettings::Initialize() m_bPVRAutoScanIconsUserSet = false; m_iPVRNumericChannelSwitchTimeout = 1000; @@ -5208,10 +4555,10 @@ index f4c309b..bf78194 100644 // as multiply of the default data read rate -From 3d1b963b43eeca8e6b80d56cd547d50c1a8f1f71 Mon Sep 17 00:00:00 2001 +From 5340ada148cb45b8e5b846568b1e5b46ff41e91c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 16 Jun 2014 19:06:00 +0100 -Subject: [PATCH 41/96] [experimental] Disable quiet-noise generation +Subject: [PATCH 38/94] [experimental] Disable quiet-noise generation --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp | 2 ++ @@ -5238,10 +4585,10 @@ index b391ff3..463a89c 100644 void CActiveAESink::SetSilenceTimer() -From 483f260c5f09f787662a7033bf87127c14402213 Mon Sep 17 00:00:00 2001 +From 40622814c08b1afb3320c22a15303ca9f9940971 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 42/96] [settings] Experiment: Report DESKTOP resolution in +Subject: [PATCH 39/94] [settings] Experiment: Report DESKTOP resolution in video settings --- @@ -5263,10 +4610,10 @@ index 6902f83..50c5f97 100644 StringUtils::Format("%dx%d%s", resolution->width, resolution->height, ModeFlagsToString(resolution->flags, false).c_str()), -From 4e58aa0ae923a9ca27519fb4d072b760d960d559 Mon Sep 17 00:00:00 2001 +From af6b1f42253889a2ec4091951cee27e6ffafb617 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:24:42 +0200 -Subject: [PATCH 43/96] Added some vc_tv_* functions that were missing in +Subject: [PATCH 40/94] Added some vc_tv_* functions that were missing in DllBCM. --- @@ -5301,10 +4648,10 @@ index b92fdb8..9c7e293 100644 HDMI_INTERLACED_T scan_mode, EDID_MODE_MATCH_FLAG_T match_flags) { return ::vc_tv_hdmi_power_on_best(width, height, frame_rate, scan_mode, match_flags); }; -From f5bb1ce961c940809f7626de770920b80271ef5e Mon Sep 17 00:00:00 2001 +From 6765701c5da57873e8da85e5e9d54921c6be8a3a Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:29:03 +0200 -Subject: [PATCH 44/96] Added private utility function to map a float display +Subject: [PATCH 41/94] Added private utility function to map a float display aspect, to the respective SDTV_ASPECT_* enum value. --- @@ -5342,10 +4689,10 @@ index bf1e589..518a87d 100644 bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &resolutions) -From 7345f954582dcb3391b218191f66f931e32e5a78 Mon Sep 17 00:00:00 2001 +From 015ec4484585ac8df8a1b685e51ad0567be64118 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:50:58 +0200 -Subject: [PATCH 45/96] Changed SDTV resolutions to be treated similarly to +Subject: [PATCH 42/94] 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. @@ -5442,10 +4789,10 @@ index 59401f5..a0acb1a 100644 int m_width; int m_height; -From eccd1201a03d8a65859877cb6d421f5de6b96b33 Mon Sep 17 00:00:00 2001 +From 6db94f0bc095142043393d0efb218241d7904ecb Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:54:59 +0200 -Subject: [PATCH 46/96] Added methods SuspendVideoOutput() and +Subject: [PATCH 43/94] 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. @@ -5509,10 +4856,10 @@ index 9dc39d5..ca36082 100644 CEGLNativeTypeRaspberryPI::CEGLNativeTypeRaspberryPI() { -From fb7d81685bfb5517dc1474409847f712615a15a0 Mon Sep 17 00:00:00 2001 +From cb4c3324f85d2140fd40fbf54195d2fe15a43dc2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 11 Aug 2013 15:03:36 +0100 -Subject: [PATCH 47/96] PowerManager (and its IPowerSyscall instance) now gets +Subject: [PATCH 44/94] 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. @@ -5524,7 +4871,7 @@ Subject: [PATCH 47/96] PowerManager (and its IPowerSyscall instance) now gets 4 files changed, 23 insertions(+) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index e0d40c9..e9ac3b4 100644 +index 875ca39..217d4a9 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -2360,6 +2360,13 @@ bool CApplication::OnKey(const CKey& key) @@ -5605,10 +4952,10 @@ index 0b1f10a..e42b143 100644 void OnSleep(); void OnWake(); -From edbe819e292a53ae64c5265b6810bf95ea3282e6 Mon Sep 17 00:00:00 2001 +From 530c785cc49210fb2041d4b7160ea56f0a2118b6 Mon Sep 17 00:00:00 2001 From: macrule Date: Wed, 17 Apr 2013 13:23:01 +0200 -Subject: [PATCH 48/96] Added CPowerSyscallVirtualSleep class, which acts as a +Subject: [PATCH 45/94] 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. @@ -5784,10 +5131,10 @@ index 0000000..ef6e682 + +#endif // _POWER_SYSCALL_VIRTUAL_SLEEP_H_ -From 1bdfd1945cbc8a0fb6ad09cfafbcb6ed8487167b Mon Sep 17 00:00:00 2001 +From 22081dc4a303e572abfaa2e74c754d4a16f98620 Mon Sep 17 00:00:00 2001 From: macrule Date: Wed, 17 Apr 2013 13:24:22 +0200 -Subject: [PATCH 49/96] Added power management support for the Raspberry Pi. +Subject: [PATCH 46/94] 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. @@ -5933,10 +5280,10 @@ index 0000000..fd1d67c + +#endif // _RASPBERRY_PI_POWER_SYSCALL_H_ -From 4ed5d263b8e1d331aeef1dadfcf8688dde31fadf Mon Sep 17 00:00:00 2001 +From 3dc101d654b96199e2d111f917a6e85b67f2663f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 16:16:29 +0000 -Subject: [PATCH 50/96] [power] hack - don't kill lirc or cec +Subject: [PATCH 47/94] [power] hack - don't kill lirc or cec --- xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 37 +++++++++++++++++++++++ @@ -5944,7 +5291,7 @@ Subject: [PATCH 50/96] [power] hack - don't kill lirc or cec 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index 1a8fd59..495d58a 100644 +index e80feb1..b0058ce 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, @@ -6020,10 +5367,10 @@ index df8ba06..b99eb44 100644 CBuiltins::Execute("LIRC.Start"); #endif -From 494f44c44310c2f783f16323b3f01070f4cb5849 Mon Sep 17 00:00:00 2001 +From bab21a145068810c84d2116b90586102532baef7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 16:47:54 +0000 -Subject: [PATCH 51/96] [power] hack - wake on any action +Subject: [PATCH 48/94] [power] hack - wake on any action --- xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 6 +++--- @@ -6052,10 +5399,10 @@ index 6a1e47b..a717a09 100644 if(VirtualWake()) { -From 247cd1701a37fd76ecab4d2c11a29a942dec80ff Mon Sep 17 00:00:00 2001 +From 4a8f1e3a02a7c31878c0e586db7f1a2b1e0b7736 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 17:30:07 +0000 -Subject: [PATCH 52/96] [power] hack - Make suspend toggle suspend state +Subject: [PATCH 49/94] [power] hack - Make suspend toggle suspend state --- xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 5 +++++ @@ -6078,10 +5425,10 @@ index a717a09..d39c3ed 100644 return false; } -From 8aae78a30fee45f1675b9d6899f1b1834f8d2acd Mon Sep 17 00:00:00 2001 +From ca3b7a3924759de3c619084976008a4a9a3bfb50 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 4 Mar 2014 19:33:44 +0000 -Subject: [PATCH 53/96] [power] Add back in powerdown and reboot +Subject: [PATCH 50/94] [power] Add back in powerdown and reboot --- .../linux/RaspberryPIPowerSyscall.cpp | 34 ++++++++++++++++++++++ @@ -6159,10 +5506,10 @@ index fd1d67c..062132e 100644 virtual bool CanReboot() { return true; } -From 6a8f0127487ed53330baa321e6a54d251117b2cc Mon Sep 17 00:00:00 2001 +From e08d4c1e37b11ac46cc58810b1295049e5b66bdc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 26 Apr 2014 17:27:52 +0100 -Subject: [PATCH 54/96] [cec] Don't suspend pi on tv switch off - it can't wake +Subject: [PATCH 51/94] [cec] Don't suspend pi on tv switch off - it can't wake up --- @@ -6183,10 +5530,10 @@ index a67dc2f..680863e 100644 -From 2a0f32c16713d730ef906851b4aa00f97a1494cc Mon Sep 17 00:00:00 2001 +From 4c2a313bb7077965dd2b34d9152d0737a67ac1f8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 27 Jun 2014 00:01:05 +0100 -Subject: [PATCH 55/96] [rbp] Resume video output on startup +Subject: [PATCH 52/94] [rbp] Resume video output on startup --- xbmc/linux/RBP.cpp | 3 +++ @@ -6207,10 +5554,10 @@ index cb87b77..34866f6 100644 m_omx_image_init = true; return true; -From b77755c72dfba5fa80bff5ba4a794063928ebfca Mon Sep 17 00:00:00 2001 +From c8e7d0ce2515559d8532576f1b6e6e767b9641da Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 16 Aug 2014 21:01:42 +0100 -Subject: [PATCH 56/96] omxrender: Hacks to reduce GUI rendering rate when +Subject: [PATCH 53/94] omxrender: Hacks to reduce GUI rendering rate when playing video --- @@ -6282,7 +5629,7 @@ index f3c8a01..2996c29 100644 diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index e9ac3b4..6cb07d4 100644 +index 217d4a9..e34add2 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -2207,6 +2207,23 @@ void CApplication::Render() @@ -6310,10 +5657,10 @@ index e9ac3b4..6cb07d4 100644 int vsync_mode = CSettings::Get().GetInt("videoscreen.vsync"); -From 8c4e3bea088b7d761f29684f574886dad7b513db Mon Sep 17 00:00:00 2001 +From 7ed1b825649a974db0f68dc73edd7141f2e8cc40 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 9 Sep 2014 12:04:26 +0100 -Subject: [PATCH 57/96] egl: Treat unknown display aspect ratio as square pixel +Subject: [PATCH 54/94] egl: Treat unknown display aspect ratio as square pixel --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 ++-- @@ -6342,10 +5689,10 @@ index ca36082..1529045 100644 SetResolutionString(m_desktopRes); -From c90e973785a015e544549a3fef0283d9409e6bff Mon Sep 17 00:00:00 2001 +From 9dd5231021e4aed2d1e901e25a5e2b10c13a80b0 Mon Sep 17 00:00:00 2001 From: anaconda Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 58/96] Disable textbox autoscrolling while on screensaver. +Subject: [PATCH 55/94] Disable textbox autoscrolling while on screensaver. SQUASH: only if dim or black --- @@ -6355,10 +5702,10 @@ SQUASH: only if dim or black 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 6cb07d4..9ccdbbc 100644 +index e34add2..4d68726 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -5878,3 +5878,10 @@ void CApplication::CloseNetworkShares() +@@ -5879,3 +5879,10 @@ void CApplication::CloseNetworkShares() CSFTPSessionManager::DisconnectAllSessions(); #endif } @@ -6406,10 +5753,10 @@ index b7ef051..e149418 100644 if (m_lastRenderTime) m_autoScrollDelayTime += currentTime - m_lastRenderTime; -From 3a822606cbfa74e51a2362bf56386d211d4dbe4a Mon Sep 17 00:00:00 2001 +From 7ca9a217200e9a646c178c95ec9cd410916865ca Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 18 Sep 2014 14:24:56 +0100 -Subject: [PATCH 59/96] [omxplayer] Only enable audio clock master when A/V +Subject: [PATCH 56/94] [omxplayer] Only enable audio clock master when A/V sync method is set to audio clock --- @@ -6417,10 +5764,10 @@ Subject: [PATCH 59/96] [omxplayer] Only enable audio clock master when A/V 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 549700c..db0886e 100644 +index 5475570..7c07b57 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -252,7 +252,8 @@ bool COMXAudio::PortSettingsChanged() +@@ -246,7 +246,8 @@ bool COMXAudio::PortSettingsChanged() { // By default audio_render is the clock master, and if output samples don't fit the timestamps, it will speed up/slow down the clock. // This tends to be better for maintaining audio sync and avoiding audio glitches, but can affect video/display sync @@ -6430,7 +5777,7 @@ index 549700c..db0886e 100644 { OMX_CONFIG_BOOLEANTYPE configBool; OMX_INIT_STRUCTURE(configBool); -@@ -278,7 +279,7 @@ bool COMXAudio::PortSettingsChanged() +@@ -272,7 +273,7 @@ bool COMXAudio::PortSettingsChanged() { // By default audio_render is the clock master, and if output samples don't fit the timestamps, it will speed up/slow down the clock. // This tends to be better for maintaining audio sync and avoiding audio glitches, but can affect video/display sync @@ -6440,10 +5787,10 @@ index 549700c..db0886e 100644 OMX_CONFIG_BOOLEANTYPE configBool; OMX_INIT_STRUCTURE(configBool); -From ef38257ea07b2de6ceb3b15ba04f3a6b01885206 Mon Sep 17 00:00:00 2001 +From 8087fa77cf74293f09d77a91515f700cf8dc1b49 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 60/96] [dvdplayer/rbp] Add pi specific option to maintain +Subject: [PATCH 57/94] [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". @@ -6641,11 +5988,10 @@ index f947acc..606c24f 100644 void SuspendVideoOutput(); void ResumeVideoOutput(); - -From e291eaf1767734a93db4fd768a98d137e6e79428 Mon Sep 17 00:00:00 2001 +From a47ab25501433491cfc105e09d68c9b674d6e121 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 27 Sep 2014 15:32:37 +0100 -Subject: [PATCH 62/96] [dvdplayer] exerimental: don't raise priority of audio +Subject: [PATCH 58/94] [dvdplayer] exerimental: don't raise priority of audio thread --- @@ -6653,7 +5999,7 @@ Subject: [PATCH 62/96] [dvdplayer] exerimental: don't raise priority of audio 1 file changed, 4 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index ee63a70..de859e0 100644 +index 056eb13..7a4211c 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -3194,7 +3194,11 @@ bool CDVDPlayer::OpenAudioStream(CDVDStreamInfo& hint, bool reset) @@ -6669,10 +6015,10 @@ index ee63a70..de859e0 100644 } -From 5c8937a3a907bfbd15af502215f9eb6f4d89863a Mon Sep 17 00:00:00 2001 +From 645cd78fbe4a6c4a883d53505b142e8c3686e604 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 28 Sep 2014 19:28:17 +0100 -Subject: [PATCH 63/96] [mmalcodec] Introduce a preroll period to buffer up +Subject: [PATCH 59/94] [mmalcodec] Introduce a preroll period to buffer up frames on startup --- @@ -6806,10 +6152,10 @@ index b4aa571..4f81bbd 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; -From d051a66742a60572acae0f74e63ddf7ce17da765 Mon Sep 17 00:00:00 2001 +From 199e9cf2a6d2574ea397ecf8bd04f97f2aeb56ab Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 11 Apr 2014 16:12:27 +0100 -Subject: [PATCH 64/96] [omxplayer] Add ability to log more timestamp info in +Subject: [PATCH 60/94] [omxplayer] Add ability to log more timestamp info in extra debug settings --- @@ -6900,7 +6246,7 @@ index be54f31..9739ed0 100644 { if (m_OmxPlayerState.av_clock.OMXIsPaused()) diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -index a83fda8..f2bb9a2 100644 +index 66014d4..d305a07 100644 --- a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp @@ -366,10 +366,10 @@ void OMXPlayerAudio::Process() @@ -6946,10 +6292,10 @@ index 605318c9..783ac20 100644 || m_speed < 0) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index bf78194..c68ac95 100644 +index bc8598e..bd90dfe 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1384,6 +1384,9 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se +@@ -1386,6 +1386,9 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se #ifdef HAVE_LIBCEC list.push_back(std::make_pair(g_localizeStrings.Get(679), LOGCEC)); #endif @@ -6960,10 +6306,10 @@ index bf78194..c68ac95 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From e8f86be6623ee23071b9f324154c98db2b8ca6ab Mon Sep 17 00:00:00 2001 +From a42f9c3b18e92935966bf54b31e7b80668687f5a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 65/96] [omxplayer] Add ability to dump out audio/video data +Subject: [PATCH 61/94] [omxplayer] Add ability to dump out audio/video data for later debugging --- @@ -7190,10 +6536,10 @@ index 45e942f..b483829 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index c68ac95..852c70d 100644 +index bd90dfe..23e1df8 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1387,6 +1387,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se +@@ -1389,6 +1389,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se #ifdef TARGET_RASPBERRY_PI list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); #endif @@ -7205,10 +6551,10 @@ index c68ac95..852c70d 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From 2966410c4842e5f261f85665b5f1d516389875b6 Mon Sep 17 00:00:00 2001 +From 2c86221303979c602ed6a0b47c6b202fa8d63179 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 66/96] [audio] Add settings option to boost centre channel +Subject: [PATCH 62/94] [audio] Add settings option to boost centre channel when downmixing This allows a dB volume increase to be added to centre channel. @@ -7330,10 +6676,10 @@ index db03668..6be2b76 100644 // stereo upmix if (upmix && m_src_channels == 2 && m_dst_channels > 2) -From 837b70ed442c257381dfc13ea1b76b72448894db Mon Sep 17 00:00:00 2001 +From a39fedd0438201d0377620bc2f234ecc860aa5fa Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 3 Oct 2014 18:38:07 +0100 -Subject: [PATCH 67/96] [omxcore] Skip out of flush on error +Subject: [PATCH 63/94] [omxcore] Skip out of flush on error --- xbmc/linux/OMXCore.cpp | 4 ++-- @@ -7362,10 +6708,10 @@ index 4ae29ba..4caa304 100644 OMX_ERRORTYPE omx_err = OMX_ErrorNone; -From f324a56e90af8ba33ecb245136d6b074d060d60c Mon Sep 17 00:00:00 2001 +From d00bb171659b249911e681d087e45d40683317b7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 3 Oct 2014 18:40:06 +0100 -Subject: [PATCH 68/96] [SinkPi] Handle multichannel layout more like OMXAudio +Subject: [PATCH 64/94] [SinkPi] Handle multichannel layout more like OMXAudio --- xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 14 +++++++------- @@ -7424,10 +6770,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 719c9193b2b8077d6803275c7d3c1cc97125da57 Mon Sep 17 00:00:00 2001 +From 70cce8a17841968cce93e40e06cf36606e3ed692 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 5 Oct 2014 14:05:25 +0100 -Subject: [PATCH 69/96] [PiSink] Allow audio output latency to be set in +Subject: [PATCH 65/94] [PiSink] Allow audio output latency to be set in settings --- @@ -7555,10 +6901,10 @@ index 5c57999..cac5051 100644 bool m_Initialized; uint32_t m_submitted; -From f2ab85ab33018fcbc391115abeb37541cc4e11eb Mon Sep 17 00:00:00 2001 +From 423a526dfa883e30ba85364c17318654b0463a21 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 18 Aug 2014 19:09:32 +0100 -Subject: [PATCH 70/96] rbp: Use new dispmanx function for vsync callbacks +Subject: [PATCH 66/94] rbp: Use new dispmanx function for vsync callbacks --- xbmc/linux/RBP.cpp | 85 ++++++++++++++----------- @@ -7770,10 +7116,10 @@ index 1529045..b6bf1fc 100644 } DLOG("CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow\n"); -From e141008d3da2117da5261b1a97bdda0ed55df9b7 Mon Sep 17 00:00:00 2001 +From 6e9d00f101d39d7d993b0e5212b8329cf0a78238 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 19 Aug 2014 17:56:45 +0100 -Subject: [PATCH 71/96] Revert "rbp: Use new dispmanx function for vsync +Subject: [PATCH 67/94] Revert "rbp: Use new dispmanx function for vsync callbacks" This reverts commit afbf8fbceaa6649fb4a6bbd9a1cee6087590412b. @@ -7987,10 +7333,10 @@ index b6bf1fc..1529045 100644 } DLOG("CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow\n"); -From 51f1cc6adcb1b4b4082c6a43374796a231eaeb99 Mon Sep 17 00:00:00 2001 +From ad36a7a29f11c07b51e5129c46a14700876df00b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 15:23:51 +0000 -Subject: [PATCH 72/96] [rbp] Default extract thumbnails to false +Subject: [PATCH 68/94] [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 @@ -8020,11 +7366,10 @@ index b8e6e59..40be71e 100644
- -From 0dec1f3df677a61b55961ed7850030813b6352af Mon Sep 17 00:00:00 2001 +From 0cde928a4d1ac1bf77a104b115deef121c45aeb7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Nov 2014 17:16:54 +0000 -Subject: [PATCH 74/96] Revert "[omxplayer] Add ability to dump out audio/video +Subject: [PATCH 70/94] Revert "[omxplayer] Add ability to dump out audio/video data for later debugging" This reverts commit 417416bd29d00f1b42c77488d06e9e6840b8c4f4. @@ -8252,10 +7597,10 @@ index b483829..45e942f 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 852c70d..c68ac95 100644 +index 23e1df8..bd90dfe 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1387,10 +1387,6 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se +@@ -1389,10 +1389,6 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se #ifdef TARGET_RASPBERRY_PI list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); #endif @@ -8267,10 +7612,10 @@ index 852c70d..c68ac95 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From 6dcbf24482fe425caa850bb8f95ca317efd5ebd2 Mon Sep 17 00:00:00 2001 +From c0ad4f8f02cae821b707dd745f82f46de2501eea Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 75/96] [omxplayer] Add ability to dump out audio/video data +Subject: [PATCH 71/94] [omxplayer] Add ability to dump out audio/video data for later debugging --- @@ -8315,7 +7660,7 @@ index a3b6ba6..f01c83b 100644 #include "utils/params_check_macros.h" diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index de859e0..edd12ce 100644 +index 7a4211c..dfc6dd2 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -95,6 +95,61 @@ @@ -8403,10 +7748,10 @@ index de859e0..edd12ce 100644 if(player) player->CloseStream(bWaitForBuffers); diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index c68ac95..852c70d 100644 +index bd90dfe..23e1df8 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1387,6 +1387,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se +@@ -1389,6 +1389,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se #ifdef TARGET_RASPBERRY_PI list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); #endif @@ -8418,11 +7763,10 @@ index c68ac95..852c70d 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) - -From bf0242c861e97a2305732797ab5e1e17f8025aa9 Mon Sep 17 00:00:00 2001 +From f17b26dd827971273d86ea690d90666fab8db7a4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 11 Nov 2014 18:14:23 +0000 -Subject: [PATCH 78/96] [resamplepi] Try to report the same numbers as ffmpeg +Subject: [PATCH 74/94] [resamplepi] Try to report the same numbers as ffmpeg --- .../cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp | 11 ++++++----- @@ -8473,10 +7817,10 @@ index 84505bf..2b5bef2 100644 CLog::Log(LOGINFO, "%s::%s = %d", CLASSNAME, __func__, ret); #endif -From 53c0e5beca8d8d6d7cb8d7db6a962548f18d32f1 Mon Sep 17 00:00:00 2001 +From ca818a1f447666e021fbce2ae75591ce5795989c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 11 Nov 2014 20:49:30 +0000 -Subject: [PATCH 79/96] [dvdplayer] New scheme for PLL adjustment for video +Subject: [PATCH 75/94] [dvdplayer] New scheme for PLL adjustment for video clock --- @@ -8591,10 +7935,10 @@ index 02c64a0..37bf4bd 100644 struct SInfo { -From 1eb3ba3c3ee3c6f6d920ecc68e8e168a85f9c196 Mon Sep 17 00:00:00 2001 +From dd7d149e393fee21a2ad7e1b0285fcf72c127613 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 12 Nov 2014 16:52:15 +0000 -Subject: [PATCH 80/96] MMAL: Use Component Logging +Subject: [PATCH 76/94] MMAL: Use Component Logging --- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 5 ++--- @@ -8617,47 +7961,10 @@ index 5d65f4e..6742e0e 100644 m_speed = iSpeed; } -From ed488363b57222a9bfece7c3375f3d043c097972 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 15 Nov 2014 12:01:26 +0000 -Subject: [PATCH 81/96] squash: stills: avoid deferencing null packet - ---- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index c22ea9f..af369c0 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -387,7 +387,11 @@ void CDVDPlayerVideo::HandleDemuxerPacket(DemuxPacket* pPacket, bool bPacketDrop - - mFilters = m_pVideoCodec->SetFilters(mFilters); - -- int iDecoderState = m_pVideoCodec->Decode(pPacket->pData, pPacket->iSize, pPacket->dts, pPacket->pts); -+ int iDecoderState; -+ if (pPacket) -+ iDecoderState = m_pVideoCodec->Decode(pPacket->pData, pPacket->iSize, pPacket->dts, pPacket->pts); -+ else -+ iDecoderState = m_pVideoCodec->Decode(NULL, 0, DVD_NOPTS_VALUE, DVD_NOPTS_VALUE); - - // buffer packets so we can recover should decoder flush for some reason - if(m_pVideoCodec->GetConvergeCount() > 0) -@@ -398,7 +402,8 @@ void CDVDPlayerVideo::HandleDemuxerPacket(DemuxPacket* pPacket, bool bPacketDrop - m_packets.pop_front(); - } - -- m_videoStats.AddSampleBytes(pPacket->iSize); -+ if (pPacket) -+ m_videoStats.AddSampleBytes(pPacket->iSize); - - // reset the request, the following while loop may break before - // setting the flag to a new value - -From 3dec8a0a0b2a3ad1c458068b58c2470cec3f14e1 Mon Sep 17 00:00:00 2001 +From 7bd93d46ea217ad4b0a9a7049ada0773ac05eef4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 15 Nov 2014 12:03:34 +0000 -Subject: [PATCH 82/96] [dvdplayer] Add lock for player creation +Subject: [PATCH 77/94] [dvdplayer] Add lock for player creation --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 3 +++ @@ -8665,7 +7972,7 @@ Subject: [PATCH 82/96] [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 edd12ce..a102012 100644 +index dfc6dd2..a3afed3 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -549,6 +549,7 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer, std:: @@ -8703,11 +8010,10 @@ index ef64076..7ea6ea6 100644 + CCriticalSection m_players_lock; }; - -From b14c066dcbd7da98f0ac6b56418d80d4d98e5fea Mon Sep 17 00:00:00 2001 +From 88e6ab2efd1fd50ae2fd1e989e625655c8ebc3ee Mon Sep 17 00:00:00 2001 From: arnova Date: Wed, 12 Nov 2014 18:30:54 +0100 -Subject: [PATCH 84/96] changed: Have CurlFile return m_bufferSize as chunksize +Subject: [PATCH 78/94] changed: Have CurlFile return m_bufferSize as chunksize --- xbmc/filesystem/CurlFile.h | 1 + @@ -8726,10 +8032,10 @@ index 1cc7bc3..2e32367 100644 bool Post(const std::string& strURL, const std::string& strPostData, std::string& strHTML); bool Get(const std::string& strURL, std::string& strHTML); -From a46ca6afdb5d9220bc1836a0e313c747040b3ebb Mon Sep 17 00:00:00 2001 +From 586efdad49cbb4d03b735c3a3c112eab8ff6e400 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 19 Nov 2014 13:29:43 +0000 -Subject: [PATCH 91/96] [dvdplayeraudio] Add advancedsetting for configuring +Subject: [PATCH 79/94] [dvdplayeraudio] Add advancedsetting for configuring max pll adjustment --- @@ -8766,7 +8072,7 @@ index 3e6d0ee..a1b6f4d 100644 } m_last_error = m_error; diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 852c70d..4c29c57 100644 +index 23e1df8..f7668e3 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -108,6 +108,7 @@ void CAdvancedSettings::Initialize() @@ -8777,7 +8083,7 @@ index 852c70d..4c29c57 100644 m_audioApplyDrc = true; m_dvdplayerIgnoreDTSinWAV = false; -@@ -479,6 +480,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); @@ -8786,7 +8092,7 @@ index 852c70d..4c29c57 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 7df586e..6d25b81 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 @@ -8798,10 +8104,10 @@ index 7df586e..6d25b81 100644 float m_audioPlayCountMinimumPercent; bool m_dvdplayerIgnoreDTSinWAV; -From e8b7dfc741095035b0b32b51a0aa6f595df24fcf Mon Sep 17 00:00:00 2001 +From 15488ffd61c44e7cff0ac6e191ed210a9245578f Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Wed, 19 Nov 2014 14:22:01 +0100 -Subject: [PATCH 92/96] dvdplayer: fix audio error at beginning of playback +Subject: [PATCH 80/94] dvdplayer: fix audio error at beginning of playback --- xbmc/cores/dvdplayer/DVDAudio.cpp | 90 ++++++--------------------------- @@ -9016,36 +8322,10 @@ index 37bf4bd..f9f19bc 100644 double GetCurrentPts() { CSingleLock lock(m_info_section); return m_info.pts; } -From 4441290e4181111b8eb37938dae87cd36cf6c0dc Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 19 Nov 2014 16:00:24 +0000 -Subject: [PATCH 93/96] [dvdplayer] Fix for video ref clock not being enabled - when requested - -The point in the code where g_VideoReferenceClock.GetRefreshRate() is read may return -1 when HDMI refresh is changing, -resulting in video ref clock being disabled. Use videoplayer.usedisplayasclock instead ---- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 4f15056..dbc97b3 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -3391,7 +3391,7 @@ void CDVDPlayer::UpdateClockMaster() - EMasterClock clock; - if(m_CurrentAudio.id >= 0) - { -- if(m_CurrentVideo.id >= 0 && g_VideoReferenceClock.GetRefreshRate() > 0) -+ if(m_CurrentVideo.id >= 0 && CSettings::Get().GetBool("videoplayer.usedisplayasclock")) - clock = MASTER_CLOCK_AUDIO_VIDEOREF; - else - clock = MASTER_CLOCK_AUDIO; - -From 90841f742586c83834ecde613c5df800e816c682 Mon Sep 17 00:00:00 2001 +From a5ac7a3a9b303abeb72704cb2ba67ec5e9db554a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 19 Nov 2014 17:35:44 +0000 -Subject: [PATCH 94/96] [mmalrender] Skip some log message in bypass mode +Subject: [PATCH 81/94] [mmalrender] Skip some log message in bypass mode --- xbmc/cores/VideoRenderers/MMALRenderer.cpp | 9 ++++++--- @@ -9083,10 +8363,10 @@ index 03a05de..c0ff30d 100644 // we only want to upload frames once if (buffer->flipindex++) -From a815b2f685515f3669f33d842421dbaad278def8 Mon Sep 17 00:00:00 2001 +From 423f39853fef55c1364751b1d76811b0ce8f5d54 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 19 Nov 2014 20:57:10 +0000 -Subject: [PATCH 96/96] [dvdplayeraudio] Remove logging message +Subject: [PATCH 83/94] [dvdplayeraudio] Remove logging message --- xbmc/cores/dvdplayer/DVDPlayerAudio.cpp | 2 +- @@ -9105,3 +8385,2017 @@ index 36f70e8..fcd2e88 100644 if( (fabs(error) > DVD_MSEC_TO_TIME(100) || m_syncclock) && (master == MASTER_CLOCK_AUDIO + +From 9de7dc7d8220858c8f43f5541ef656c0beaef87b Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Mon, 30 Jun 2014 00:19:21 +0200 +Subject: [PATCH 84/94] 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 d426f6222b30ab10c734833f1906f0839fd049ca Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Fri, 21 Nov 2014 00:15:49 +0100 +Subject: [PATCH 85/94] 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 468c51b..43c40c1 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 f91c0ab6aa8e1c8ac909ee4f4fd479445fea40f9 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Fri, 21 Nov 2014 01:47:07 +0100 +Subject: [PATCH 86/94] 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 43c40c1..2a69c7f 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 ff8c7febd104f0f3fd43c9d78d49572338f53274 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Fri, 21 Nov 2014 17:10:00 +0100 +Subject: [PATCH 87/94] 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 d66cf9ebec8bc57ba579f324da41575ae56a7329 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 21 Nov 2014 19:17:25 +0000 +Subject: [PATCH 88/94] 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 c860d4b60414c2875ec963dbce2a4e5160117a06 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 24 Nov 2014 16:06:54 +0000 +Subject: [PATCH 89/94] [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 6742e0e..ac7a263 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 4f81bbd..2eaea95 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 7ffc7e16d2e98bc06eb6f29b71dcffaec42ed3e6 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 24 Nov 2014 21:24:25 +0000 +Subject: [PATCH 90/94] [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 ac7a263..1894782 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 7855346855b9c4d81a4682d69562a37491314ac2 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 24 Nov 2014 22:07:25 +0000 +Subject: [PATCH 91/94] [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. +--- + xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 46 ++++++++++++++++++++------------- + 1 file changed, 28 insertions(+), 18 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +index f030e37..7a8fc10 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +@@ -324,7 +324,8 @@ void CDVDPlayerVideo::Process() + + while (!m_bStop) + { +- int iQueueTimeOut = (int)(m_stalled ? frametime / 4 : frametime * 10) / 1000; ++ bool bPictureWaiting = m_hints.stills && (m_pVideoCodec->Decode(NULL, 0, DVD_NOPTS_VALUE, DVD_NOPTS_VALUE) & VC_PICTURE); ++ int iQueueTimeOut = (int)(bPictureWaiting ? 0 : (m_hints.stills || m_stalled) ? frametime / 4 : frametime * 10) / 1000; + int iPriority = (m_speed == DVD_PLAYSPEED_PAUSE && m_started) ? 1 : 0; + + CDVDMsg* pMsg; +@@ -341,27 +342,36 @@ void CDVDPlayerVideo::Process() + if( iPriority ) + continue; + +- //Okey, start rendering at stream fps now instead, we are likely in a stillframe +- if( !m_stalled ) ++ // check for picture waiting ++ if (bPictureWaiting) + { +- if(m_started) +- CLog::Log(LOGINFO, "CDVDPlayerVideo - Stillframe detected, switching to forced %f fps", m_fFrameRate); +- m_stalled = true; +- pts+= frametime*4; ++ // create a dummy demuxer packet to prod the decode logic ++ pMsg = new CDVDMsgDemuxerPacket(CDVDDemuxUtils::AllocateDemuxPacket(0), false); + } +- +- //Waiting timed out, output last picture +- if( picture.iFlags & DVP_FLAG_ALLOCATED ) ++ else + { +- //Remove interlaced flag before outputting +- //no need to output this as if it was interlaced +- picture.iFlags &= ~DVP_FLAG_INTERLACED; +- picture.iFlags |= DVP_FLAG_NOSKIP; +- OutputPicture(&picture, pts); +- pts+= frametime; +- } ++ //Okey, start rendering at stream fps now instead, we are likely in a stillframe ++ if( !m_stalled ) ++ { ++ if(m_started) ++ CLog::Log(LOGINFO, "CDVDPlayerVideo - Stillframe detected, switching to forced %f fps", m_fFrameRate); ++ m_stalled = true; ++ pts+= frametime*4; ++ } + +- continue; ++ //Waiting timed out, output last picture ++ if( picture.iFlags & DVP_FLAG_ALLOCATED ) ++ { ++ //Remove interlaced flag before outputting ++ //no need to output this as if it was interlaced ++ picture.iFlags &= ~DVP_FLAG_INTERLACED; ++ picture.iFlags |= DVP_FLAG_NOSKIP; ++ OutputPicture(&picture, pts); ++ pts+= frametime; ++ } ++ ++ continue; ++ } + } + + if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE)) + +From 4076f6c27bc3ae13a27ca65bafe51bf5a24b711f Mon Sep 17 00:00:00 2001 +From: arnova +Date: Sun, 23 Nov 2014 11:14:53 +0100 +Subject: [PATCH 92/94] changed: Modify rate calculation to obtain a proper + average with heavy seeking/cache swapping + +--- + xbmc/filesystem/CacheStrategy.cpp | 20 ++++++++++---------- + xbmc/filesystem/CacheStrategy.h | 6 +++--- + xbmc/filesystem/CircularCache.cpp | 6 ++++-- + xbmc/filesystem/CircularCache.h | 2 +- + xbmc/filesystem/FileCache.cpp | 29 +++++++++++++++++++++++------ + xbmc/filesystem/MemBufferCache.cpp | 3 ++- + xbmc/filesystem/MemBufferCache.h | 2 +- + 7 files changed, 44 insertions(+), 24 deletions(-) + +diff --git a/xbmc/filesystem/CacheStrategy.cpp b/xbmc/filesystem/CacheStrategy.cpp +index c1d1409..3cee421 100644 +--- a/xbmc/filesystem/CacheStrategy.cpp ++++ b/xbmc/filesystem/CacheStrategy.cpp +@@ -235,17 +235,18 @@ int64_t CSimpleFileCache::Seek(int64_t iFilePosition) + return iFilePosition; + } + +-void CSimpleFileCache::Reset(int64_t iSourcePosition, bool clearAnyway) ++bool CSimpleFileCache::Reset(int64_t iSourcePosition, bool clearAnyway) + { + if (!clearAnyway && IsCachedPosition(iSourcePosition)) + { + m_nReadPosition = m_cacheFileRead->Seek(iSourcePosition - m_nStartPosition, SEEK_SET); +- return; ++ return false; + } + + m_nStartPosition = iSourcePosition; + m_nWritePosition = m_cacheFileWrite->Seek(0, SEEK_SET); + m_nReadPosition = m_cacheFileRead->Seek(0, SEEK_SET); ++ return true; + } + + void CSimpleFileCache::EndOfInput() +@@ -330,14 +331,13 @@ int64_t CDoubleCache::Seek(int64_t iFilePosition) + return m_pCache->Seek(iFilePosition); + } + +-void CDoubleCache::Reset(int64_t iSourcePosition, bool clearAnyway) ++bool CDoubleCache::Reset(int64_t iSourcePosition, bool clearAnyway) + { + if (!clearAnyway && m_pCache->IsCachedPosition(iSourcePosition) + && (!m_pCacheOld || !m_pCacheOld->IsCachedPosition(iSourcePosition) + || m_pCache->CachedDataEndPos() >= m_pCacheOld->CachedDataEndPos())) + { +- m_pCache->Reset(iSourcePosition, clearAnyway); +- return; ++ return m_pCache->Reset(iSourcePosition, clearAnyway); + } + if (!m_pCacheOld) + { +@@ -345,18 +345,18 @@ void CDoubleCache::Reset(int64_t iSourcePosition, bool clearAnyway) + if (pCacheNew->Open() != CACHE_RC_OK) + { + delete pCacheNew; +- m_pCache->Reset(iSourcePosition, clearAnyway); +- return; ++ return m_pCache->Reset(iSourcePosition, clearAnyway); + } +- pCacheNew->Reset(iSourcePosition, clearAnyway); ++ bool bRes = pCacheNew->Reset(iSourcePosition, clearAnyway); + m_pCacheOld = m_pCache; + m_pCache = pCacheNew; +- return; ++ return bRes; + } +- m_pCacheOld->Reset(iSourcePosition, clearAnyway); ++ bool bRes = m_pCacheOld->Reset(iSourcePosition, clearAnyway); + CCacheStrategy *tmp = m_pCacheOld; + m_pCacheOld = m_pCache; + m_pCache = tmp; ++ return bRes; + } + + void CDoubleCache::EndOfInput() +diff --git a/xbmc/filesystem/CacheStrategy.h b/xbmc/filesystem/CacheStrategy.h +index 5067d01..aa624d2 100644 +--- a/xbmc/filesystem/CacheStrategy.h ++++ b/xbmc/filesystem/CacheStrategy.h +@@ -50,7 +50,7 @@ class CCacheStrategy{ + virtual int64_t WaitForData(unsigned int iMinAvail, unsigned int iMillis) = 0; + + virtual int64_t Seek(int64_t iFilePosition) = 0; +- virtual void Reset(int64_t iSourcePosition, bool clearAnyway=true) = 0; ++ virtual bool Reset(int64_t iSourcePosition, bool clearAnyway=true) = 0; + + virtual void EndOfInput(); // mark the end of the input stream so that Read will know when to return EOF + virtual bool IsEndOfInput(); +@@ -83,7 +83,7 @@ class CSimpleFileCache : public CCacheStrategy { + virtual int64_t WaitForData(unsigned int iMinAvail, unsigned int iMillis) ; + + virtual int64_t Seek(int64_t iFilePosition); +- virtual void Reset(int64_t iSourcePosition, bool clearAnyway=true); ++ virtual bool Reset(int64_t iSourcePosition, bool clearAnyway=true); + virtual void EndOfInput(); + + virtual int64_t CachedDataEndPosIfSeekTo(int64_t iFilePosition); +@@ -118,7 +118,7 @@ class CDoubleCache : public CCacheStrategy{ + virtual int64_t WaitForData(unsigned int iMinAvail, unsigned int iMillis) ; + + virtual int64_t Seek(int64_t iFilePosition); +- virtual void Reset(int64_t iSourcePosition, bool clearAnyway=true); ++ virtual bool Reset(int64_t iSourcePosition, bool clearAnyway=true); + virtual void EndOfInput(); + virtual bool IsEndOfInput(); + virtual void ClearEndOfInput(); +diff --git a/xbmc/filesystem/CircularCache.cpp b/xbmc/filesystem/CircularCache.cpp +index 746a64a..eb8c044 100644 +--- a/xbmc/filesystem/CircularCache.cpp ++++ b/xbmc/filesystem/CircularCache.cpp +@@ -232,17 +232,19 @@ int64_t CCircularCache::Seek(int64_t pos) + return CACHE_RC_ERROR; + } + +-void CCircularCache::Reset(int64_t pos, bool clearAnyway) ++bool CCircularCache::Reset(int64_t pos, bool clearAnyway) + { + CSingleLock lock(m_sync); + if (!clearAnyway && IsCachedPosition(pos)) + { + m_cur = pos; +- return; ++ return false; + } + m_end = pos; + m_beg = pos; + m_cur = pos; ++ ++ return true; + } + + int64_t CCircularCache::CachedDataEndPosIfSeekTo(int64_t iFilePosition) +diff --git a/xbmc/filesystem/CircularCache.h b/xbmc/filesystem/CircularCache.h +index f6aa6a7..3954eae 100644 +--- a/xbmc/filesystem/CircularCache.h ++++ b/xbmc/filesystem/CircularCache.h +@@ -42,7 +42,7 @@ class CCircularCache : public CCacheStrategy + virtual int64_t WaitForData(unsigned int minimum, unsigned int iMillis) ; + + virtual int64_t Seek(int64_t pos) ; +- virtual void Reset(int64_t pos, bool clearAnyway=true) ; ++ virtual bool Reset(int64_t pos, bool clearAnyway=true) ; + + virtual int64_t CachedDataEndPosIfSeekTo(int64_t iFilePosition); + virtual int64_t CachedDataEndPos(); +diff --git a/xbmc/filesystem/FileCache.cpp b/xbmc/filesystem/FileCache.cpp +index 1ac2848..b65c3df 100644 +--- a/xbmc/filesystem/FileCache.cpp ++++ b/xbmc/filesystem/FileCache.cpp +@@ -44,20 +44,35 @@ class CWriteRate + m_stamp = XbmcThreads::SystemClockMillis(); + m_pos = 0; + m_pause = 0; ++ m_size = 0; ++ m_time = 0; + } + +- void Reset(int64_t pos) ++ void Reset(int64_t pos, bool bResetAll = true) + { + m_stamp = XbmcThreads::SystemClockMillis(); + m_pos = pos; ++ ++ if (bResetAll) ++ { ++ m_size = 0; ++ m_time = 0; ++ } + } + + unsigned Rate(int64_t pos, unsigned int time_bias = 0) + { +- const unsigned ts = XbmcThreads::SystemClockMillis() + time_bias; +- if (ts == m_stamp) ++ const unsigned ts = XbmcThreads::SystemClockMillis(); ++ ++ m_size += (pos - m_pos); ++ m_time += (ts - m_stamp); ++ m_pos = pos; ++ m_stamp = ts; ++ ++ if (m_time == 0) + return 0; +- return (unsigned)(1000 * (pos - m_pos) / (ts - m_stamp)); ++ ++ return (unsigned)(1000 * (m_size / (m_time + time_bias))); + } + + void Pause() +@@ -75,6 +90,8 @@ class CWriteRate + unsigned m_stamp; + int64_t m_pos; + unsigned m_pause; ++ int64_t m_size; ++ int64_t m_time; + }; + + +@@ -233,11 +250,11 @@ void CFileCache::Process() + } + if (!sourceSeekFailed) + { +- m_pCache->Reset(m_seekPos, false); ++ const bool bCompleteReset = m_pCache->Reset(m_seekPos, false); + m_readPos = m_seekPos; + m_writePos = m_pCache->CachedDataEndPos(); + assert(m_writePos == cacheMaxPos); +- average.Reset(m_writePos); ++ average.Reset(m_writePos, bCompleteReset); // Can only recalculate new average from scratch after a full reset (empty cache) + limiter.Reset(m_writePos); + m_cacheFull = (m_pCache->GetMaxWriteSize(m_chunkSize) == 0); + m_nSeekResult = m_seekPos; +diff --git a/xbmc/filesystem/MemBufferCache.cpp b/xbmc/filesystem/MemBufferCache.cpp +index 7c1c61d..01583f6 100644 +--- a/xbmc/filesystem/MemBufferCache.cpp ++++ b/xbmc/filesystem/MemBufferCache.cpp +@@ -215,13 +215,14 @@ int64_t MemBufferCache::Seek(int64_t iFilePosition) + return CACHE_RC_ERROR; + } + +-void MemBufferCache::Reset(int64_t iSourcePosition) ++bool MemBufferCache::Reset(int64_t iSourcePosition, bool clearAnyway) + { + CSingleLock lock(m_sync); + m_nStartPosition = iSourcePosition; + m_buffer.Clear(); + m_HistoryBuffer.Clear(); + m_forwardBuffer.Clear(); ++ return true; + } + + +diff --git a/xbmc/filesystem/MemBufferCache.h b/xbmc/filesystem/MemBufferCache.h +index 56b8d9c..7083b2d 100644 +--- a/xbmc/filesystem/MemBufferCache.h ++++ b/xbmc/filesystem/MemBufferCache.h +@@ -46,7 +46,7 @@ class MemBufferCache : public CCacheStrategy + virtual int64_t WaitForData(unsigned int iMinAvail, unsigned int iMillis) ; + + virtual int64_t Seek(int64_t iFilePosition) ; +- virtual void Reset(int64_t iSourcePosition) ; ++ virtual bool Reset(int64_t iSourcePosition, bool clearAnyway) ; + + protected: + int64_t m_nStartPosition; + +From 35bea50d22dbee5af6765cbe852ff351f481b29d Mon Sep 17 00:00:00 2001 +From: arnova +Date: Mon, 24 Nov 2014 07:29:26 +0100 +Subject: [PATCH 93/94] changed: Don't perform wait-on-data if position is in + our old cache + +--- + xbmc/filesystem/CacheStrategy.cpp | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/xbmc/filesystem/CacheStrategy.cpp b/xbmc/filesystem/CacheStrategy.cpp +index 3cee421..f7b4f0a 100644 +--- a/xbmc/filesystem/CacheStrategy.cpp ++++ b/xbmc/filesystem/CacheStrategy.cpp +@@ -328,7 +328,17 @@ int64_t CDoubleCache::WaitForData(unsigned int iMinAvail, unsigned int iMillis) + + int64_t CDoubleCache::Seek(int64_t iFilePosition) + { +- return m_pCache->Seek(iFilePosition); ++ /* Check whether position is NOT in our current cache but IS in our old cache. ++ * This is faster/more efficient than having to possibly wait for data in the ++ * Seek() call below ++ */ ++ if (!m_pCache->IsCachedPosition(iFilePosition) && ++ m_pCacheOld && m_pCacheOld->IsCachedPosition(iFilePosition)) ++ { ++ return CACHE_RC_ERROR; // Request seek event, so caches are swapped ++ } ++ ++ return m_pCache->Seek(iFilePosition); // Normal seek + } + + bool CDoubleCache::Reset(int64_t iSourcePosition, bool clearAnyway) + +From 69f17df3156d7057c56fb2cc26c817ce5dbdf79b Mon Sep 17 00:00:00 2001 +From: Arne Morten Kvarving +Date: Tue, 25 Nov 2014 17:03:36 +0100 +Subject: [PATCH 94/94] 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);