diff --git a/projects/RPi/patches/kodi/kodi-001-newclock4.patch b/projects/RPi/patches/kodi/kodi-001-newclock4.patch index 2fc7fcacb5..db3dfe1b23 100644 --- a/projects/RPi/patches/kodi/kodi-001-newclock4.patch +++ b/projects/RPi/patches/kodi/kodi-001-newclock4.patch @@ -1,7 +1,7 @@ -From 2e21c89b6f31b48488708896151ddd58b234027c Mon Sep 17 00:00:00 2001 +From db43b90d932355a33f96d1a72fe453b2be7aa515 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 01/88] [rbp/omxplayer] When opening a stream don't try to +Subject: [PATCH 01/97] [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 7ee57ebabbe4387cf90770d14eae1ebb129cf95d Mon Sep 17 00:00:00 2001 +From f20a96ee9b19c9e14b5d66a331feed74db39145a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 29 Apr 2014 15:23:22 +0100 -Subject: [PATCH 02/88] [ffmpeg] Speed up wtv index creation +Subject: [PATCH 02/97] [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 2d1634a4a4732e94fe0688278d48d6deee6d540e Mon Sep 17 00:00:00 2001 +From df98d8034fad30e5995f3c45b12f27027ba421ea Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:49:17 +1300 -Subject: [PATCH 03/88] adds GetTvShowSeasons +Subject: [PATCH 03/97] adds GetTvShowSeasons --- xbmc/video/VideoDatabase.cpp | 30 ++++++++++++++++++++++++------ @@ -193,10 +193,10 @@ index 78259ed..cbb26b7 100644 bool GetArtTypes(const MediaType &mediaType, std::vector &artTypes); -From 9a74fd25bec68610f5d78a557c38f754f6d14c87 Mon Sep 17 00:00:00 2001 +From e88b6dcf0b5cfd5a4e57071100fc973ff886df76 Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:50:10 +1300 -Subject: [PATCH 04/88] move AddSeason() public. +Subject: [PATCH 04/97] move AddSeason() public. --- xbmc/video/VideoDatabase.h | 2 +- @@ -223,10 +223,10 @@ index cbb26b7..1a79c00 100644 /*! \brief Adds a path to the tvshow link table. \param idShow the id of the show. -From 438061d812494b1539eb38b32bba97cc8c0187be Mon Sep 17 00:00:00 2001 +From fa469ae1473966b1ebd79d00fe2c942232f15add Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:48:24 +1300 -Subject: [PATCH 05/88] adds GetArt function to (video) scraper, allowing art +Subject: [PATCH 05/97] adds GetArt function to (video) scraper, allowing art to be fetched given the video identifier. --- @@ -341,10 +341,10 @@ index 22ac229..75bc341 100644 enum LOOKUP_STATE { DO_NOTHING = 0, FIND_MOVIE = 1, -From 30b71249fe3fd2b58d4e8f36679958e4c56a94ad Mon Sep 17 00:00:00 2001 +From 81a93e90587fcea04ead2d41fa92612da9b110cb Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:53:14 +1300 -Subject: [PATCH 06/88] refresh season art if a new season is found that isn't +Subject: [PATCH 06/97] refresh season art if a new season is found that isn't recorded in the database yet. Fixes #14339 --- @@ -448,10 +448,10 @@ index 92883e7..47d5ed4 100644 bool ProcessItemByVideoInfoTag(const CFileItem *item, EPISODELIST &episodeList); -From 9d5cd1a0c4f1110bc834503224088e5d5bc8c247 Mon Sep 17 00:00:00 2001 +From da76402a3bb4e1ea0be4fa1d08a5a8570c13f8ba Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:53:34 +1300 -Subject: [PATCH 07/88] REMOVEME: updated thetvdb.com scraper to support art +Subject: [PATCH 07/97] REMOVEME: updated thetvdb.com scraper to support art updates --- @@ -559,10 +559,10 @@ index f27e4fc..bdf329f 100644 -From 9e7734d143948b115fbc820a8496dcb70c9dfa47 Mon Sep 17 00:00:00 2001 +From d86ee1de0277fcf87ed9a59a6361cd5b3b829f89 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 2 Aug 2014 17:48:04 +0100 -Subject: [PATCH 08/88] [omx] Report decoded image name +Subject: [PATCH 08/97] [omx] Report decoded image name --- xbmc/cores/omxplayer/OMXImage.cpp | 1 + @@ -581,10 +581,10 @@ index aa413b9..22ec3f0 100644 else { -From bff39e76d586c56551a52c9bcfe7bf9269084c01 Mon Sep 17 00:00:00 2001 +From 15733ea7d73ef9d09c526aff3b77d0612cf71837 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Dec 2013 16:55:05 +0000 -Subject: [PATCH 09/88] logging: Add microsecond timer to log messages +Subject: [PATCH 09/97] logging: Add microsecond timer to log messages --- xbmc/utils/log.cpp | 17 +++++++++++++++-- @@ -637,10 +637,10 @@ index 3443f12..31c4a99 100644 levelNames[logLevel]) + strData; -From 4171b4bf42df150a597979f15c336cd8016c4d42 Mon Sep 17 00:00:00 2001 +From 7b84ea0c30c95bce668fb349963f89180fe86c6c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 10/88] [hifiberry] Hack: force it to be recognised as IEC958 +Subject: [PATCH 10/97] [hifiberry] Hack: force it to be recognised as IEC958 capable to enable passthrough options --- @@ -663,10 +663,10 @@ index d30cbab..b268819 100644 info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") { -From 45a217afdf09296b30d3c3ca407e5b19c2767e50 Mon Sep 17 00:00:00 2001 +From 7a7e6b52a2465c34611b6248f306250bad36cdd5 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 11 Dec 2013 17:21:54 +0000 -Subject: [PATCH 11/88] Move the reference-counting of Begin and End calls from +Subject: [PATCH 11/97] Move the reference-counting of Begin and End calls from DX and GL source files into GUIFontTTF.cpp. --- @@ -1054,10 +1054,10 @@ index c0bb53a..735fb3a 100644 protected: virtual CBaseTexture* ReallocTexture(unsigned int& newHeight); -From 547b2b8f3b0c0b645aa68662663ce7e091c770cd Mon Sep 17 00:00:00 2001 +From 82990b71445c43f371c5e8a923c2bd89c649a1b5 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 11 Dec 2013 18:47:54 +0000 -Subject: [PATCH 12/88] Convert CGUIFontTTFBase::m_vertex to be managed as a +Subject: [PATCH 12/97] Convert CGUIFontTTFBase::m_vertex to be managed as a std::vector. Also retired CGUIFontTTFBase::m_vertex_count and @@ -1237,10 +1237,10 @@ index 97853fd..b76c6a5 100644 *vertices++ = m_vertex[i]; *vertices++ = m_vertex[i+1]; -From 371723178008ae3ef8cac140b3bec0b063cb1e66 Mon Sep 17 00:00:00 2001 +From c8a8f05d19ce2027e60feb434644b6b803dbbf71 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Mon, 16 Dec 2013 18:58:12 +0000 -Subject: [PATCH 13/88] CGUIFontTTFBase::RenderCharacter can now append to +Subject: [PATCH 13/97] CGUIFontTTFBase::RenderCharacter can now append to arbitrary vectors of vertices rather than only CGUIFontTTFBase::m_vertex --- @@ -1313,10 +1313,10 @@ index 5675725..a5d44f4 100644 virtual CBaseTexture* ReallocTexture(unsigned int& newHeight) = 0; -From aad9ee727fde44ffdbc74e76f645c902b5d60afb Mon Sep 17 00:00:00 2001 +From 2135d9fb5e89833a729418e96266623cf41f0d0a Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 17:18:38 +0000 -Subject: [PATCH 14/88] Add a cache of font glyph bounding box vertices. +Subject: [PATCH 14/97] 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 @@ -2076,10 +2076,10 @@ index f351c99..9036ba9 100644 + return !operator==(a, b); +} -From 8c949e7c50b3cfb5fce3778e561a91642414a64a Mon Sep 17 00:00:00 2001 +From b4803102fbd67bc28867e5a1e1198b043cbfcb6d Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 23 Jan 2014 22:24:17 +0000 -Subject: [PATCH 15/88] Lay the groundwork for hardware clipping. +Subject: [PATCH 15/97] 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 @@ -2341,10 +2341,10 @@ index 98e398a..81ee49e 100644 virtual void ResetScissors(); -From be50a74d88cec088a99c7cb6f2b881e6777bf953 Mon Sep 17 00:00:00 2001 +From eabb40c7324e43aeaffb044023499d247025ec1e Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 23 Jan 2014 16:42:22 +0000 -Subject: [PATCH 16/88] Increase font cache hit rate by keying on the +Subject: [PATCH 16/97] 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 @@ -2545,10 +2545,10 @@ index 3b93672..258dffa 100644 private: virtual bool FirstBegin() = 0; -From e3976911fadc4d63d2d4920a3940828ad94fcf92 Mon Sep 17 00:00:00 2001 +From e8ebfc6d1f1313edaf507c3f23865e88a28fa55b Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 8 Jan 2014 12:16:33 +0000 -Subject: [PATCH 17/88] Rewrite of scrolling text code. +Subject: [PATCH 17/97] 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 @@ -2864,10 +2864,10 @@ index 2cda726..fbc579e 100644 private: void Process(); -From 180e1e5b718152abd8ffec89cb76b6107b43fb3a Mon Sep 17 00:00:00 2001 +From 5517f1f78848b1ee013c788283ad2e34e5649fd9 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Mon, 27 Jan 2014 23:21:10 +0000 -Subject: [PATCH 18/88] Move the application of the translation offsets into +Subject: [PATCH 18/97] 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 @@ -3061,10 +3061,10 @@ index 9935ea4..18c9358 100644 memset(newTexture->GetPixels(), 0, m_textureHeight * newTexture->GetPitch()); if (m_texture) -From 3feb094818290687469c2afda70a44a9ac315717 Mon Sep 17 00:00:00 2001 +From af0b6fb0fc83e4e616880aa50c487fb9ef41977d Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 15:28:06 +0000 -Subject: [PATCH 19/88] Rather than applying the translation offsets to the +Subject: [PATCH 19/97] 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. @@ -3208,10 +3208,10 @@ index 81ee49e..d2f9cd1 100644 protected: virtual void SetVSyncImpl(bool enable) = 0; -From 9f737cabdc74f3237d487e64216aae902e289dd3 Mon Sep 17 00:00:00 2001 +From 8d032c71701ebcab83662bc9eb09c03e787817f7 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 29 Jan 2014 13:21:19 +0000 -Subject: [PATCH 20/88] Enable hardware clipping. +Subject: [PATCH 20/97] Enable hardware clipping. --- xbmc/guilib/GUIFontTTF.cpp | 4 ++-- @@ -3283,10 +3283,10 @@ index ea08bf4..b63e337 100644 glUniformMatrix4fv(modelLoc, 1, GL_FALSE, g_matrices.GetMatrix(MM_MODELVIEW)); } -From 71d43c1cf5feaa28bece6efff447c6098174476b Mon Sep 17 00:00:00 2001 +From 46dd8722df5f5d122909ed1524890ff687a870f3 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 15:32:51 +0000 -Subject: [PATCH 21/88] Move the vertex data across to a vertex buffer object +Subject: [PATCH 21/97] Move the vertex data across to a vertex buffer object just prior to drawing. --- @@ -3337,10 +3337,10 @@ index b63e337..b00055d 100644 // Disable the attributes used by this shader -From c4e540af56ee44416d0b6c13976875a5fa29c600 Mon Sep 17 00:00:00 2001 +From 3f6090f37f07436896eafad815b178d3e4ec5d71 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 16:04:04 +0000 -Subject: [PATCH 22/88] Move vertex data into an OpenGL VBO when the font cache +Subject: [PATCH 22/97] 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 @@ -3613,10 +3613,10 @@ index 735fb3a..6102c90 100644 protected: virtual CBaseTexture* ReallocTexture(unsigned int& newHeight); -From b6a55c4b2a82743d3c1044cadafe5dc7b4c0a721 Mon Sep 17 00:00:00 2001 +From 20335c7814616395986e82dcfc4fe39b85632b7e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 1 Nov 2014 22:15:13 +0000 -Subject: [PATCH 23/88] Switch from glDrawArrays() to glDrawElements(). +Subject: [PATCH 23/97] 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. @@ -3837,10 +3837,10 @@ index d2a94c9..7b6097a 100644 if (m_display != EGL_NO_DISPLAY) -From 6e49b6a04b4682eebb2e94c94cc7362b84fa3e59 Mon Sep 17 00:00:00 2001 +From 29fea8db3a318cc0d95e37a1f755c5f9ba1cf301 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 24/88] Improved file buffering in CArchive +Subject: [PATCH 24/97] 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 @@ -3900,10 +3900,10 @@ index 6ed0f8f..8506d95 100644 } else -From 90b1d957c71900aa8e227d94903fd57ae95be091 Mon Sep 17 00:00:00 2001 +From 9ebf3ad56008927947c08fc44f5c4a4280883ec6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 10 Sep 2014 22:07:21 +0100 -Subject: [PATCH 25/88] [mmal] Allow mmal codec for dvd stills +Subject: [PATCH 25/97] [mmal] Allow mmal codec for dvd stills --- xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 4 ++++ @@ -3925,10 +3925,10 @@ index f139433..4183a2b 100644 { // If dvd is an mpeg2 and hint.stills -From 48e43e8adc8730edf3c77f1661f64a0f740ee56a Mon Sep 17 00:00:00 2001 +From 072bc273a95b87b8187ffc86c39a90aa3d0d0d0d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 12 Aug 2014 00:31:36 +0100 -Subject: [PATCH 26/88] [omxcodec] Fix for stills with hardware codec +Subject: [PATCH 26/97] [omxcodec] Fix for stills with hardware codec Hardware codecs typically run asynchronously to the decoded frames. The reason that hardware codecs don't work when hint.stills is true @@ -3945,10 +3945,10 @@ when hint.stills is true. 3 files changed, 292 insertions(+), 279 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index e647078..b6963ca 100644 +index f586933..2a2202f 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -3282,7 +3282,7 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) +@@ -3190,7 +3190,7 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) hint.aspect = aspect; hint.forced_aspect = true; } @@ -3958,7 +3958,7 @@ index e647078..b6963ca 100644 CDVDInputStream::IMenus* pMenus = dynamic_cast(m_pInputStream); diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 4f35e3a..d2db7bc 100644 +index 9eacad2..ccf307e 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -300,15 +300,298 @@ void CDVDPlayerVideo::OnStartup() @@ -4575,11 +4575,10 @@ index a38a9c3..70b86e6 100644 CDVDMessageQueue m_messageQueue; CDVDMessageQueue& m_messageParent; - -From ec298e42b3bdfe8e246518dfd6479452a480b288 Mon Sep 17 00:00:00 2001 +From cbc634d65498419ce67d02d2866d4d0160b16923 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 16 Apr 2014 21:18:06 +0100 -Subject: [PATCH 28/88] [omxplayer] Don't propagate 3d flags based on supported +Subject: [PATCH 27/97] [omxplayer] Don't propagate 3d flags based on supported 3d modes --- @@ -4632,10 +4631,10 @@ index ac838ce..605318c9 100644 unsigned int iDisplayWidth = width; unsigned int iDisplayHeight = height; -From f9ed79d711fd28be22f2682f2d4e8686c0dcbbf4 Mon Sep 17 00:00:00 2001 +From 4f9be3b67d09d0931da50661bd6df739162906bc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:00:52 +0100 -Subject: [PATCH 29/88] [graphics] Don't set stereo mode based on resolution +Subject: [PATCH 28/97] [graphics] Don't set stereo mode based on resolution The resolution change should follow stereo mode --- @@ -4693,10 +4692,10 @@ index 3cb5587..fe6ebf4 100644 m_iScreenWidth = info_mod.iWidth; -From fc38f9f499a1da6ab405994a3152e9ac67d8f5fe Mon Sep 17 00:00:00 2001 +From 771bd680b42a97581e8c60128e03fd04d3048a8b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:01:51 +0100 -Subject: [PATCH 30/88] [graphics] Allow switching to a more suitable 3D +Subject: [PATCH 29/97] [graphics] Allow switching to a more suitable 3D resolution --- @@ -4782,10 +4781,10 @@ index 2904c1b..8d3774f 100644 void ResetOverscan(RESOLUTION_INFO &resinfo); void ResetScreenParameters(RESOLUTION res); -From 5f10a87afee8e27877bd227dce8e3eb3cf434d23 Mon Sep 17 00:00:00 2001 +From 3fe528280ece69edc36e9706b4c7baa9cb92210a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:38:55 +0100 -Subject: [PATCH 31/88] [3D] Support switching to 3D resolutions +Subject: [PATCH 30/97] [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. @@ -4867,10 +4866,10 @@ index 83c3adb..8076e76 100644 return current; } -From 5ad43039dfa3b10b6e3201f93af519a107d2512f Mon Sep 17 00:00:00 2001 +From cb207aa215bf8aa5698c6118efd3b1d1db615ec4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 23 Apr 2014 00:05:07 +0100 -Subject: [PATCH 32/88] [graphics] Make pixel ratio for 3d modes consistent +Subject: [PATCH 31/97] [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. @@ -5073,10 +5072,10 @@ index c58c28a..bf1e589 100644 AddUniqueResolution(res2, resolutions); -From b3a2287d1acd4cbdb6618d85862b7af18151a449 Mon Sep 17 00:00:00 2001 +From 2b59f6bec07a067b3e949d5e84f474fa27e6cc34 Mon Sep 17 00:00:00 2001 From: da-anda Date: Sun, 17 Aug 2014 21:09:59 +0200 -Subject: [PATCH 33/88] handle stereoscopic mode of videos in mixed playlists +Subject: [PATCH 32/97] handle stereoscopic mode of videos in mixed playlists --- language/English/strings.po | 2 +- @@ -5084,10 +5083,10 @@ Subject: [PATCH 33/88] handle stereoscopic mode of videos in mixed playlists 2 files changed, 49 insertions(+), 29 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po -index 770586a..55ff13d 100755 +index 8d8f4a1..132a2ce 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -15751,7 +15751,7 @@ msgstr "" +@@ -15756,7 +15756,7 @@ msgstr "" #. Description of setting "Videos -> Playback -> Disable stereoscopic mode when playback is stopped" with label #36526 #: system/settings/settings.xml msgctxt "#36538" @@ -5244,10 +5243,10 @@ index 35ba597..b013942 100644 case 2: // Mono SetStereoMode( RENDER_STEREO_MODE_MONO ); -From e9d284a353a8d2bfd6480610fd0d682bd9234ef0 Mon Sep 17 00:00:00 2001 +From f5d2fbc6423c688dc1263e1365eb8d9d138efbba Mon Sep 17 00:00:00 2001 From: da-anda Date: Sat, 16 Aug 2014 11:20:54 +0200 -Subject: [PATCH 34/88] remember user selected 3D modes between videos until +Subject: [PATCH 33/97] remember user selected 3D modes between videos until playback ended --- @@ -5464,10 +5463,10 @@ index c1dfb93..cb54bd0 100644 -From 1d96714758e0a36cacaa309aaf038444656894bf Mon Sep 17 00:00:00 2001 +From 99535729730a3dc6ae8a2aca45cff439c342fbed Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 35/88] filesystem: Make support of browsing into archives +Subject: [PATCH 34/97] 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. @@ -5483,10 +5482,10 @@ Add a settings option to enable this feature and default to disabled on Pi 4 files changed, 28 insertions(+) diff --git a/language/English/strings.po b/language/English/strings.po -index 55ff13d..9aa583b 100755 +index 132a2ce..c31a07c 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -16082,4 +16082,13 @@ msgstr "" +@@ -16087,4 +16087,13 @@ msgstr "" #: system/settings/rbp.xml msgctxt "#38010" msgid "GPU accelerated" @@ -5566,550 +5565,11 @@ index 2fd8777..3b294cd 100644 { // XBMC Smart playlist - just XML renamed to XSP // read the name of the playlist in -From e9f80dea7cd86caf75b5ace125b8fcbd51bd03fb Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 11 Aug 2014 22:56:13 +0100 -Subject: [PATCH 37/88] [omxplayer] Add option to choose omxplayer/dvdplayer - automatically -On Helix dvdplayer is pretty usable on the Pi, and is the only option -in some use cases: - -omxplayer does not support external sound cards (USB or I2S) -omxplayer does not support dvd menus -omxplayer does not support software codecs - -Expecting the user to choose the right player is not ideal, -so make the switch automatically for these three cases. ---- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 146 +++++-------------------- - xbmc/cores/dvdplayer/DVDPlayer.h | 30 +++--- - xbmc/cores/omxplayer/Makefile.in | 3 +- - xbmc/cores/omxplayer/OMXHelper.cpp | 211 +++++++++++++++++++++++++++++++++++++ - xbmc/cores/omxplayer/OMXHelper.h | 28 +++++ - 5 files changed, 283 insertions(+), 135 deletions(-) - create mode 100644 xbmc/cores/omxplayer/OMXHelper.cpp - create mode 100644 xbmc/cores/omxplayer/OMXHelper.h - -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index b6963ca..2a2202f 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -89,6 +89,7 @@ - #ifdef HAS_OMXPLAYER - #include "cores/omxplayer/OMXPlayerAudio.h" - #include "cores/omxplayer/OMXPlayerVideo.h" -+#include "cores/omxplayer/OMXHelper.h" - #endif - - using namespace std; -@@ -493,6 +494,13 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer, std:: - - void CDVDPlayer::CreatePlayers() - { -+#ifdef HAS_OMXPLAYER -+ if (m_omxplayer_mode && OMXPlayerUnsuitable(m_HasVideo, m_HasAudio, m_pDemuxer, m_pInputStream, m_SelectionStreams)) -+ { -+ DestroyPlayers(); -+ m_omxplayer_mode = false; -+ } -+#endif - if (m_players_created) - return; - -@@ -1049,120 +1057,6 @@ void CDVDPlayer::CheckBetterStream(CCurrentStream& current, CDemuxStream* stream - OpenStream(current, stream->iId, stream->source); - } - --void CDVDPlayer::OMXDoProcessing() --{ --#ifdef HAS_OMXPLAYER -- double now = CDVDClock::GetAbsoluteClock(); -- if (m_OmxPlayerState.last_check_time == 0.0 || m_OmxPlayerState.last_check_time + DVD_MSEC_TO_TIME(20) <= now) -- { -- m_OmxPlayerState.last_check_time = now; -- m_OmxPlayerState.stamp = m_OmxPlayerState.av_clock.OMXMediaTime(); -- const bool m_Pause = m_playSpeed == DVD_PLAYSPEED_PAUSE; -- const bool not_accepts_data = (!m_dvdPlayerAudio->AcceptsData() && m_CurrentAudio.id >= 0) || -- (!m_dvdPlayerVideo->AcceptsData() && m_CurrentVideo.id >= 0); -- /* when the video/audio fifos are low, we pause clock, when high we resume */ -- double audio_pts = floor(m_dvdPlayerAudio->GetCurrentPts()); -- double video_pts = floor(m_dvdPlayerVideo->GetCurrentPts()); -- -- float audio_fifo = audio_pts / DVD_TIME_BASE - m_OmxPlayerState.stamp * 1e-6; -- float video_fifo = video_pts / DVD_TIME_BASE - m_OmxPlayerState.stamp * 1e-6; -- float threshold = 0.1f; -- bool audio_fifo_low = false, video_fifo_low = false, audio_fifo_high = false, video_fifo_high = false; -- -- // if deinterlace setting has changed, we should close and open video -- if (m_OmxPlayerState.current_deinterlace != CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode) -- { -- CloseStream(m_CurrentVideo, false); -- OpenStream(m_CurrentVideo, m_CurrentVideo.id, m_CurrentVideo.source); -- if (m_State.canseek) -- m_messenger.Put(new CDVDMsgPlayerSeek(GetTime(), true, true, true, true, true)); -- m_OmxPlayerState.current_deinterlace = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; -- } -- -- m_OmxPlayerState.video_fifo = (int)(100.0*(m_dvdPlayerVideo->GetDecoderBufferSize()-m_dvdPlayerVideo->GetDecoderFreeSpace())/m_dvdPlayerVideo->GetDecoderBufferSize()); -- m_OmxPlayerState.audio_fifo = (int)(100.0*audio_fifo/m_dvdPlayerAudio->GetCacheTotal()); -- -- #ifdef _DEBUG -- static unsigned count; -- if ((count++ & 7) == 0) -- { -- char response[80]; -- if (m_dvdPlayerVideo->GetDecoderBufferSize() && m_dvdPlayerAudio->GetCacheTotal()) -- vc_gencmd(response, sizeof response, "render_bar 4 video_fifo %d %d %d %d", -- m_OmxPlayerState.video_fifo, -- (int)(100.0*video_fifo/m_dvdPlayerAudio->GetCacheTotal()), -- 0, 100); -- if (m_dvdPlayerAudio->GetCacheTotal()) -- vc_gencmd(response, sizeof response, "render_bar 5 audio_fifo %d %d %d %d", -- m_OmxPlayerState.audio_fifo, -- (int)(100.0*m_dvdPlayerAudio->GetDelay()/m_dvdPlayerAudio->GetCacheTotal()), -- 0, 100); -- vc_gencmd(response, sizeof response, "render_bar 6 video_queue %d %d %d %d", -- m_dvdPlayerVideo->GetLevel(), 0, 0, 100); -- vc_gencmd(response, sizeof response, "render_bar 7 audio_queue %d %d %d %d", -- m_dvdPlayerAudio->GetLevel(), 0, 0, 100); -- } -- #endif -- if (audio_pts != DVD_NOPTS_VALUE) -- { -- audio_fifo_low = m_HasAudio && audio_fifo < threshold; -- audio_fifo_high = audio_pts != DVD_NOPTS_VALUE && audio_fifo >= m_OmxPlayerState.threshold; -- } -- if (video_pts != DVD_NOPTS_VALUE) -- { -- video_fifo_low = m_HasVideo && video_fifo < threshold; -- video_fifo_high = video_pts != DVD_NOPTS_VALUE && video_fifo >= m_OmxPlayerState.threshold; -- } -- if (!m_HasAudio && m_HasVideo) -- audio_fifo_high = true; -- if (!m_HasVideo && m_HasAudio) -- video_fifo_high = true; -- -- #ifdef _DEBUG -- CLog::Log(LOGDEBUG, "%s::%s M:%.6f-%.6f (A:%.6f V:%.6f) PEF:%d%d%d S:%.2f A:%.2f V:%.2f/T:%.2f (A:%d%d V:%d%d) A:%d%% V:%d%% (%.2f,%.2f)", "CDVDPlayer", __FUNCTION__, -- m_OmxPlayerState.stamp*1e-6, m_OmxPlayerState.av_clock.OMXClockAdjustment()*1e-6, audio_pts*1e-6, video_pts*1e-6, m_OmxPlayerState.av_clock.OMXIsPaused(), m_OmxPlayerState.bOmxSentEOFs, not_accepts_data, m_playSpeed * (1.0f/DVD_PLAYSPEED_NORMAL), -- audio_pts == DVD_NOPTS_VALUE ? 0.0:audio_fifo, video_pts == DVD_NOPTS_VALUE ? 0.0:video_fifo, m_OmxPlayerState.threshold, -- audio_fifo_low, audio_fifo_high, video_fifo_low, video_fifo_high, -- m_dvdPlayerAudio->GetLevel(), m_dvdPlayerVideo->GetLevel(), m_dvdPlayerAudio->GetDelay(), (float)m_dvdPlayerAudio->GetCacheTotal()); -- #endif -- -- if(!m_Pause && (m_OmxPlayerState.bOmxSentEOFs || not_accepts_data || (audio_fifo_high && video_fifo_high) || m_playSpeed != DVD_PLAYSPEED_NORMAL)) -- { -- if (m_OmxPlayerState.av_clock.OMXIsPaused()) -- { -- CLog::Log(LOGDEBUG, "%s::%s Resume %.2f,%.2f (A:%d%d V:%d%d) EOF:%d FULL:%d T:%.2f", "CDVDPlayer", __FUNCTION__, audio_fifo, video_fifo, -- audio_fifo_low, audio_fifo_high, video_fifo_low, video_fifo_high, m_OmxPlayerState.bOmxSentEOFs, not_accepts_data, m_OmxPlayerState.threshold); -- m_OmxPlayerState.av_clock.OMXResume(); -- } -- } -- else if ((m_Pause || audio_fifo_low || video_fifo_low) && m_playSpeed == DVD_PLAYSPEED_NORMAL) -- { -- if (!m_OmxPlayerState.av_clock.OMXIsPaused()) -- { -- if (!m_Pause) -- m_OmxPlayerState.threshold = std::min(2.0f*m_OmxPlayerState.threshold, 16.0f); -- CLog::Log(LOGDEBUG, "%s::%s Pause %.2f,%.2f (A:%d%d V:%d%d) EOF:%d FULL:%d T:%.2f", "CDVDPlayer", __FUNCTION__, audio_fifo, video_fifo, -- audio_fifo_low, audio_fifo_high, video_fifo_low, video_fifo_high, m_OmxPlayerState.bOmxSentEOFs, not_accepts_data, m_OmxPlayerState.threshold); -- m_OmxPlayerState.av_clock.OMXPause(); -- } -- } -- } --#endif --} -- --bool CDVDPlayer::OMXStillPlaying() --{ -- if (m_omxplayer_mode) -- { -- // wait for omx components to finish -- if(m_OmxPlayerState.bOmxWaitVideo && !m_dvdPlayerVideo->IsEOS()) -- return true; -- if(m_OmxPlayerState.bOmxWaitAudio && !m_dvdPlayerAudio->IsEOS()) -- return true; -- } -- return false; --} -- - void CDVDPlayer::Process() - { - if (!OpenInputStream()) -@@ -1190,6 +1084,8 @@ void CDVDPlayer::Process() - m_bAbortRequest = true; - return; - } -+ // give players a chance to reconsider now codecs are known -+ CreatePlayers(); - - // allow renderer to switch to fullscreen if requested - m_dvdPlayerVideo->EnableFullscreen(m_PlayerOptions.fullscreen); -@@ -1292,9 +1188,15 @@ void CDVDPlayer::Process() - - while (!m_bAbortRequest) - { -- if (m_omxplayer_mode) -- OMXDoProcessing(); -- -+#ifdef HAS_OMXPLAYER -+ if (m_omxplayer_mode && OMXDoProcessing(m_OmxPlayerState, m_playSpeed, m_dvdPlayerVideo, m_dvdPlayerAudio, m_CurrentAudio, m_CurrentVideo, m_HasVideo, m_HasAudio)) -+ { -+ CloseStream(m_CurrentVideo, false); -+ OpenStream(m_CurrentVideo, m_CurrentVideo.id, m_CurrentVideo.source); -+ if (m_State.canseek) -+ m_messenger.Put(new CDVDMsgPlayerSeek(GetTime(), true, true, true, true, true)); -+ } -+#endif - // handle messages send to this thread, like seek or demuxer reset requests - HandleMessages(); - -@@ -1460,12 +1362,18 @@ void CDVDPlayer::Process() - - // while players are still playing, keep going to allow seekbacks - if(m_dvdPlayerAudio->HasData() -- || m_dvdPlayerVideo->HasData() -- || OMXStillPlaying()) -+ || m_dvdPlayerVideo->HasData()) - { - Sleep(100); - continue; - } -+#ifdef HAS_OMXPLAYER -+ if (m_omxplayer_mode && OMXStillPlaying(m_OmxPlayerState.bOmxWaitVideo, m_OmxPlayerState.bOmxWaitAudio, m_dvdPlayerVideo->IsEOS(), m_dvdPlayerAudio->IsEOS())) -+ { -+ Sleep(100); -+ continue; -+ } -+#endif - - if (!m_pInputStream->IsEOF()) - CLog::Log(LOGINFO, "%s - eof reading from demuxer", __FUNCTION__); -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h -index dac00e9..9f75ccf 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.h -+++ b/xbmc/cores/dvdplayer/DVDPlayer.h -@@ -71,6 +71,20 @@ class OMXClock - }; - #endif - -+struct SOmxPlayerState -+{ -+ OMXClock av_clock; // openmax clock component -+ EDEINTERLACEMODE current_deinterlace; // whether deinterlace is currently enabled -+ bool bOmxWaitVideo; // whether we need to wait for video to play out on EOS -+ bool bOmxWaitAudio; // whether we need to wait for audio to play out on EOS -+ bool bOmxSentEOFs; // flag if we've send EOFs to audio/video players -+ float threshold; // current fifo threshold required to come out of buffering -+ int video_fifo; // video fifo to gpu level -+ int audio_fifo; // audio fifo to gpu level -+ double last_check_time; // we periodically check for gpu underrun -+ double stamp; // last media timestamp -+}; -+ - class CDVDInputStream; - - class CDVDDemux; -@@ -297,8 +311,6 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer - - void CreatePlayers(); - void DestroyPlayers(); -- void OMXDoProcessing(); -- bool OMXStillPlaying(); - - bool OpenStream(CCurrentStream& current, int iStream, int source, bool reset = true); - bool OpenStreamPlayer(CCurrentStream& current, CDVDStreamInfo& hint, bool reset); -@@ -537,18 +549,6 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer - bool m_DemuxerPausePending; - - // omxplayer variables -- struct SOmxPlayerState -- { -- OMXClock av_clock; // openmax clock component -- EDEINTERLACEMODE current_deinterlace; // whether deinterlace is currently enabled -- bool bOmxWaitVideo; // whether we need to wait for video to play out on EOS -- bool bOmxWaitAudio; // whether we need to wait for audio to play out on EOS -- bool bOmxSentEOFs; // flag if we've send EOFs to audio/video players -- float threshold; // current fifo threshold required to come out of buffering -- int video_fifo; // video fifo to gpu level -- int audio_fifo; // audio fifo to gpu level -- double last_check_time; // we periodically check for gpu underrun -- double stamp; // last media timestamp -- } m_OmxPlayerState; -+ struct SOmxPlayerState m_OmxPlayerState; - bool m_omxplayer_mode; // using omxplayer acceleration - }; -diff --git a/xbmc/cores/omxplayer/Makefile.in b/xbmc/cores/omxplayer/Makefile.in -index 77c25aa..5852cba 100644 ---- a/xbmc/cores/omxplayer/Makefile.in -+++ b/xbmc/cores/omxplayer/Makefile.in -@@ -1,6 +1,7 @@ - CXXFLAGS += -D__STDC_FORMAT_MACROS - --SRCS = OMXAudio.cpp -+SRCS = OMXHelper.cpp -+SRCS += OMXAudio.cpp - SRCS += OMXVideo.cpp - SRCS += OMXAudioCodecOMX.cpp - SRCS += OMXPlayerAudio.cpp -diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp -new file mode 100644 -index 0000000..cd383be ---- /dev/null -+++ b/xbmc/cores/omxplayer/OMXHelper.cpp -@@ -0,0 +1,211 @@ -+/* -+ * Copyright (C) 2014 Team XBMC -+ * http://xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#include "system.h" -+ -+#ifdef HAS_OMXPLAYER -+ -+#include "DVDPlayer.h" -+#include "settings/Settings.h" -+#include "settings/MediaSettings.h" -+#include "DVDInputStreams/DVDInputStream.h" -+#include "cores/omxplayer/OMXPlayerAudio.h" -+#include "cores/omxplayer/OMXPlayerVideo.h" -+ -+#define PREDICATE_RETURN(lh, rh) \ -+ do { \ -+ if((lh) != (rh)) \ -+ return (lh) > (rh); \ -+ } while(0) -+ -+static bool PredicateVideoPriority(const SelectionStream& lh, const SelectionStream& rh) -+{ -+ PREDICATE_RETURN(lh.flags & CDemuxStream::FLAG_DEFAULT -+ , rh.flags & CDemuxStream::FLAG_DEFAULT); -+ return false; -+} -+ -+bool OMXPlayerUnsuitable(bool m_HasVideo, bool m_HasAudio, CDVDDemux* m_pDemuxer, CDVDInputStream* m_pInputStream, CSelectionStreams &m_SelectionStreams) -+{ -+ // if no MMAL acceleration stick with omxplayer regardless -+ if (!CSettings::Get().GetBool("videoplayer.usemmal")) -+ return false; -+ -+ // omxplayer only handles Pi sink -+ if (CSettings::Get().GetString("audiooutput.audiodevice") != "PI:Analogue" && -+ CSettings::Get().GetString("audiooutput.audiodevice") != "PI:HDMI" && -+ CSettings::Get().GetString("audiooutput.audiodevice") != "PI:Both") -+ { -+ CLog::Log(LOGNOTICE, "%s OMXPlayer unsuitable due to audio sink", __func__); -+ return true; -+ } -+ if (m_pDemuxer) -+ { -+ // find video stream -+ int num_supported = 0, num_unsupported = 0; -+ AVCodecID codec = AV_CODEC_ID_NONE; -+ SelectionStreams streams = m_SelectionStreams.Get(STREAM_VIDEO, PredicateVideoPriority); -+ for(SelectionStreams::iterator it = streams.begin(); it != streams.end(); ++it) -+ { -+ int iStream = it->id; -+ CDemuxStream *stream = m_pDemuxer->GetStream(iStream); -+ if(!stream || stream->disabled) -+ continue; -+ CDVDStreamInfo hint(*stream, true); -+ -+ bool supported = false; -+ if ((hint.codec == AV_CODEC_ID_MPEG1VIDEO || hint.codec == AV_CODEC_ID_MPEG2VIDEO) && g_RBP.GetCodecMpg2()) -+ supported = true; -+ else if ((hint.codec == AV_CODEC_ID_VC1 || hint.codec == AV_CODEC_ID_WMV3) && g_RBP.GetCodecWvc1()) -+ supported = true; -+ else if (hint.codec == AV_CODEC_ID_H264 || hint.codec == AV_CODEC_ID_MPEG4 || hint.codec == AV_CODEC_ID_H263 || -+ hint.codec == AV_CODEC_ID_VP6 || hint.codec == AV_CODEC_ID_VP6F || hint.codec == AV_CODEC_ID_VP6A || hint.codec == AV_CODEC_ID_VP8 || -+ hint.codec == AV_CODEC_ID_THEORA || hint.codec == AV_CODEC_ID_MJPEG || hint.codec == AV_CODEC_ID_MJPEGB) -+ supported = true; -+ codec = hint.codec; -+ if (supported) -+ num_supported++; -+ else -+ num_unsupported++; -+ } -+ if (num_unsupported > 0 && num_supported == 0) -+ { -+ CLog::Log(LOGNOTICE, "%s OMXPlayer unsuitable due to video codec (%x:%d/%d)", __func__, codec, num_supported, num_unsupported); -+ return true; -+ } -+ } -+ if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_DVD)) -+ { -+ CLog::Log(LOGNOTICE, "%s OMXPlayer unsuitable due to dvd menus", __func__); -+ return true; -+ } -+ return false; -+} -+ -+bool OMXDoProcessing(struct SOmxPlayerState &m_OmxPlayerState, int m_playSpeed, IDVDStreamPlayerVideo *m_dvdPlayerVideo, IDVDStreamPlayerAudio *m_dvdPlayerAudio, -+ CCurrentStream m_CurrentAudio, CCurrentStream m_CurrentVideo, bool m_HasVideo, bool m_HasAudio) -+{ -+ bool reopen_stream = false; -+ double now = CDVDClock::GetAbsoluteClock(); -+ if (m_OmxPlayerState.last_check_time == 0.0 || m_OmxPlayerState.last_check_time + DVD_MSEC_TO_TIME(20) <= now) -+ { -+ m_OmxPlayerState.last_check_time = now; -+ m_OmxPlayerState.stamp = m_OmxPlayerState.av_clock.OMXMediaTime(); -+ const bool m_Pause = m_playSpeed == DVD_PLAYSPEED_PAUSE; -+ const bool not_accepts_data = (!m_dvdPlayerAudio->AcceptsData() && m_HasAudio) || -+ (!m_dvdPlayerVideo->AcceptsData() && m_HasVideo >= 0); -+ /* when the video/audio fifos are low, we pause clock, when high we resume */ -+ double audio_pts = floor(m_dvdPlayerAudio->GetCurrentPts()); -+ double video_pts = floor(m_dvdPlayerVideo->GetCurrentPts()); -+ -+ float audio_fifo = audio_pts / DVD_TIME_BASE - m_OmxPlayerState.stamp * 1e-6; -+ float video_fifo = video_pts / DVD_TIME_BASE - m_OmxPlayerState.stamp * 1e-6; -+ float threshold = 0.1f; -+ bool audio_fifo_low = false, video_fifo_low = false, audio_fifo_high = false, video_fifo_high = false; -+ -+ // if deinterlace setting has changed, we should close and open video -+ if (m_OmxPlayerState.current_deinterlace != CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode) -+ { -+ m_OmxPlayerState.current_deinterlace = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; -+ reopen_stream = true; -+ } -+ -+ m_OmxPlayerState.video_fifo = (int)(100.0*(m_dvdPlayerVideo->GetDecoderBufferSize()-m_dvdPlayerVideo->GetDecoderFreeSpace())/m_dvdPlayerVideo->GetDecoderBufferSize()); -+ m_OmxPlayerState.audio_fifo = (int)(100.0*audio_fifo/m_dvdPlayerAudio->GetCacheTotal()); -+ -+ #ifdef _DEBUG -+ static unsigned count; -+ if ((count++ & 7) == 0) -+ { -+ char response[80]; -+ if (m_dvdPlayerVideo->GetDecoderBufferSize() && m_dvdPlayerAudio->GetCacheTotal()) -+ vc_gencmd(response, sizeof response, "render_bar 4 video_fifo %d %d %d %d", -+ m_OmxPlayerState.video_fifo, -+ (int)(100.0*video_fifo/m_dvdPlayerAudio->GetCacheTotal()), -+ 0, 100); -+ if (m_dvdPlayerAudio->GetCacheTotal()) -+ vc_gencmd(response, sizeof response, "render_bar 5 audio_fifo %d %d %d %d", -+ m_OmxPlayerState.audio_fifo, -+ (int)(100.0*m_dvdPlayerAudio->GetDelay()/m_dvdPlayerAudio->GetCacheTotal()), -+ 0, 100); -+ vc_gencmd(response, sizeof response, "render_bar 6 video_queue %d %d %d %d", -+ m_dvdPlayerVideo->GetLevel(), 0, 0, 100); -+ vc_gencmd(response, sizeof response, "render_bar 7 audio_queue %d %d %d %d", -+ m_dvdPlayerAudio->GetLevel(), 0, 0, 100); -+ } -+ #endif -+ if (audio_pts != DVD_NOPTS_VALUE) -+ { -+ audio_fifo_low = m_HasAudio && audio_fifo < threshold; -+ audio_fifo_high = audio_pts != DVD_NOPTS_VALUE && audio_fifo >= m_OmxPlayerState.threshold; -+ } -+ if (video_pts != DVD_NOPTS_VALUE) -+ { -+ video_fifo_low = m_HasVideo && video_fifo < threshold; -+ video_fifo_high = video_pts != DVD_NOPTS_VALUE && video_fifo >= m_OmxPlayerState.threshold; -+ } -+ if (!m_HasAudio && m_HasVideo) -+ audio_fifo_high = true; -+ if (!m_HasVideo && m_HasAudio) -+ video_fifo_high = true; -+ -+ #ifdef _DEBUG -+ CLog::Log(LOGDEBUG, "%s::%s M:%.6f-%.6f (A:%.6f V:%.6f) PEF:%d%d%d S:%.2f A:%.2f V:%.2f/T:%.2f (A:%d%d V:%d%d) A:%d%% V:%d%% (%.2f,%.2f)", "CDVDPlayer", __FUNCTION__, -+ m_OmxPlayerState.stamp*1e-6, m_OmxPlayerState.av_clock.OMXClockAdjustment()*1e-6, audio_pts*1e-6, video_pts*1e-6, -+ m_OmxPlayerState.av_clock.OMXIsPaused(), m_OmxPlayerState.bOmxSentEOFs, not_accepts_data, m_playSpeed * (1.0f/DVD_PLAYSPEED_NORMAL), -+ audio_pts == DVD_NOPTS_VALUE ? 0.0:audio_fifo, video_pts == DVD_NOPTS_VALUE ? 0.0:video_fifo, m_OmxPlayerState.threshold, -+ audio_fifo_low, audio_fifo_high, video_fifo_low, video_fifo_high, -+ m_dvdPlayerAudio->GetLevel(), m_dvdPlayerVideo->GetLevel(), m_dvdPlayerAudio->GetDelay(), (float)m_dvdPlayerAudio->GetCacheTotal()); -+ #endif -+ -+ if(!m_Pause && (m_OmxPlayerState.bOmxSentEOFs || not_accepts_data || (audio_fifo_high && video_fifo_high) || m_playSpeed != DVD_PLAYSPEED_NORMAL)) -+ { -+ if (m_OmxPlayerState.av_clock.OMXIsPaused()) -+ { -+ CLog::Log(LOGDEBUG, "%s::%s Resume %.2f,%.2f (A:%d%d V:%d%d) EOF:%d FULL:%d T:%.2f", "CDVDPlayer", __FUNCTION__, audio_fifo, video_fifo, -+ audio_fifo_low, audio_fifo_high, video_fifo_low, video_fifo_high, m_OmxPlayerState.bOmxSentEOFs, not_accepts_data, m_OmxPlayerState.threshold); -+ m_OmxPlayerState.av_clock.OMXResume(); -+ } -+ } -+ else if ((m_Pause || audio_fifo_low || video_fifo_low) && m_playSpeed == DVD_PLAYSPEED_NORMAL) -+ { -+ if (!m_OmxPlayerState.av_clock.OMXIsPaused()) -+ { -+ if (!m_Pause) -+ m_OmxPlayerState.threshold = std::min(2.0f*m_OmxPlayerState.threshold, 16.0f); -+ CLog::Log(LOGDEBUG, "%s::%s Pause %.2f,%.2f (A:%d%d V:%d%d) EOF:%d FULL:%d T:%.2f", "CDVDPlayer", __FUNCTION__, audio_fifo, video_fifo, -+ audio_fifo_low, audio_fifo_high, video_fifo_low, video_fifo_high, m_OmxPlayerState.bOmxSentEOFs, not_accepts_data, m_OmxPlayerState.threshold); -+ m_OmxPlayerState.av_clock.OMXPause(); -+ } -+ } -+ } -+ return reopen_stream; -+} -+ -+bool OMXStillPlaying(bool waitVideo, bool waitAudio, bool eosVideo, bool eosAudio) -+{ -+ // wait for omx components to finish -+ if (waitVideo && !eosVideo) -+ return true; -+ if (waitAudio && !eosAudio) -+ return true; -+} -+ -+#endif -diff --git a/xbmc/cores/omxplayer/OMXHelper.h b/xbmc/cores/omxplayer/OMXHelper.h -new file mode 100644 -index 0000000..ef12051 ---- /dev/null -+++ b/xbmc/cores/omxplayer/OMXHelper.h -@@ -0,0 +1,28 @@ -+/* -+ * Copyright (C) 2014 Team XBMC -+ * http://xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#pragma once -+ -+#include "system.h" -+ -+bool OMXPlayerUnsuitable(bool m_HasVideo, bool m_HasAudio, CDVDDemux* m_pDemuxer, CDVDInputStream* m_pInputStream, CSelectionStreams &m_SelectionStreams); -+bool OMXDoProcessing(struct SOmxPlayerState &m_OmxPlayerState, int m_playSpeed, IDVDStreamPlayerVideo *m_dvdPlayerVideo, IDVDStreamPlayerAudio *m_dvdPlayerAudio, -+ CCurrentStream m_CurrentAudio, CCurrentStream m_CurrentVideo, bool m_HasVideo, bool m_HasAudio); -+bool OMXStillPlaying(bool waitVideo, bool waitAudio, bool eosVideo, bool eosAudio); - -From 17ee98a879d8929d9c5cf4ade5b568653f2e0fc6 Mon Sep 17 00:00:00 2001 +From a107e9e081a26ec4d69a2f6dc0a817575b5b3d96 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 13:06:57 +0000 -Subject: [PATCH 38/88] [rbp] Make cachemembuffersize default depend on memory +Subject: [PATCH 36/97] [rbp] Make cachemembuffersize default depend on memory size --- @@ -6148,7 +5608,7 @@ index ba1a3d0..5119949 100644 response[sizeof(response) - 1] = '\0'; CLog::Log(LOGNOTICE, "Config:\n%s", response); diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 7d04872..ca2d33c 100644 +index f4c309b..bf78194 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -363,7 +363,12 @@ void CAdvancedSettings::Initialize() @@ -6166,20 +5626,20 @@ index 7d04872..ca2d33c 100644 // as multiply of the default data read rate -From 91a06aa3d399a72bf31ffdcccd3a2d5d381bcef3 Mon Sep 17 00:00:00 2001 +From 8dbe33baf117ec2512bfb7f790ef3d7780c9d822 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 16 Jun 2014 19:06:00 +0100 -Subject: [PATCH 40/88] [experimental] Disable quiet-noise generation +Subject: [PATCH 38/97] [experimental] Disable quiet-noise generation --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp -index c6272cc..9111593 100644 +index b391ff3..463a89c 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp -@@ -871,6 +871,7 @@ void CActiveAESink::SwapInit(CSampleBuffer* samples) +@@ -873,6 +873,7 @@ void CActiveAESink::SwapInit(CSampleBuffer* samples) void CActiveAESink::GenerateNoise() { @@ -6187,7 +5647,7 @@ index c6272cc..9111593 100644 int nb_floats = m_sampleOfSilence.pkt->max_nb_samples; nb_floats *= m_sampleOfSilence.pkt->config.channels; -@@ -909,6 +910,7 @@ void CActiveAESink::GenerateNoise() +@@ -913,6 +914,7 @@ void CActiveAESink::GenerateNoise() _aligned_free(noise); delete resampler; @@ -6196,10 +5656,10 @@ index c6272cc..9111593 100644 void CActiveAESink::SetSilenceTimer() -From 50350740bab517dbe5a1ce19bbebae3c43f0f587 Mon Sep 17 00:00:00 2001 +From 6afc25970719769c1fad8364b70fb509cc67f235 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 41/88] [settings] Experiment: Report DESKTOP resolution in +Subject: [PATCH 39/97] [settings] Experiment: Report DESKTOP resolution in video settings --- @@ -6221,10 +5681,10 @@ index 6902f83..50c5f97 100644 StringUtils::Format("%dx%d%s", resolution->width, resolution->height, ModeFlagsToString(resolution->flags, false).c_str()), -From 09169ff5a2794e4456b606f55f5e37410392ccae Mon Sep 17 00:00:00 2001 +From b49767fd92a6d0fb19a12836b97b06cc08afd240 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:24:42 +0200 -Subject: [PATCH 42/88] Added some vc_tv_* functions that were missing in +Subject: [PATCH 40/97] Added some vc_tv_* functions that were missing in DllBCM. --- @@ -6259,10 +5719,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 18647b15e92e3e41c09e67d8dd2b02d8f739ac1e Mon Sep 17 00:00:00 2001 +From 65c3f187853790f701016263a6ac8c404949df11 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:29:03 +0200 -Subject: [PATCH 43/88] Added private utility function to map a float display +Subject: [PATCH 41/97] Added private utility function to map a float display aspect, to the respective SDTV_ASPECT_* enum value. --- @@ -6300,10 +5760,10 @@ index bf1e589..518a87d 100644 bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &resolutions) -From e18ffe3825f9e188b7cf12a50f0b94ebacc181fb Mon Sep 17 00:00:00 2001 +From 7da42db7608a24a5fb60b4c8042ea27ceb08e506 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:50:58 +0200 -Subject: [PATCH 44/88] Changed SDTV resolutions to be treated similarly to +Subject: [PATCH 42/97] 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. @@ -6400,10 +5860,10 @@ index 59401f5..a0acb1a 100644 int m_width; int m_height; -From e35fa3ed5e20e15b190f91ca80fc0b5ac27f68f9 Mon Sep 17 00:00:00 2001 +From ab28e4eaefbdf6efaa73afd8a147d4e82ab5cf93 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:54:59 +0200 -Subject: [PATCH 45/88] Added methods SuspendVideoOutput() and +Subject: [PATCH 43/97] 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. @@ -6467,10 +5927,10 @@ index 9dc39d5..ca36082 100644 CEGLNativeTypeRaspberryPI::CEGLNativeTypeRaspberryPI() { -From 3a2ef0a5d9d77cab51e708e4a53283fc095bb199 Mon Sep 17 00:00:00 2001 +From 3b04cefa9ef6051aa3e9385f2778f932895ed886 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 11 Aug 2013 15:03:36 +0100 -Subject: [PATCH 46/88] PowerManager (and its IPowerSyscall instance) now gets +Subject: [PATCH 44/97] 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. @@ -6482,7 +5942,7 @@ Subject: [PATCH 46/88] PowerManager (and its IPowerSyscall instance) now gets 4 files changed, 23 insertions(+) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index ee59549..77fce2e 100644 +index 48fa09b..d1b304b 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -2359,6 +2359,13 @@ bool CApplication::OnKey(const CKey& key) @@ -6563,10 +6023,10 @@ index 0b1f10a..e42b143 100644 void OnSleep(); void OnWake(); -From 6117b40fc764890ee3cbfa39fe2aa35221dc074d Mon Sep 17 00:00:00 2001 +From 09f07b374f36e6ada72b5bff2ae5bf7974a73ac2 Mon Sep 17 00:00:00 2001 From: macrule Date: Wed, 17 Apr 2013 13:23:01 +0200 -Subject: [PATCH 47/88] Added CPowerSyscallVirtualSleep class, which acts as a +Subject: [PATCH 45/97] 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. @@ -6742,10 +6202,10 @@ index 0000000..ef6e682 + +#endif // _POWER_SYSCALL_VIRTUAL_SLEEP_H_ -From f93c56c38837df334babbb86a85704147d7c2747 Mon Sep 17 00:00:00 2001 +From 59ff43eac68010ee149d5eb72737ce2f855015cf Mon Sep 17 00:00:00 2001 From: macrule Date: Wed, 17 Apr 2013 13:24:22 +0200 -Subject: [PATCH 48/88] Added power management support for the Raspberry Pi. +Subject: [PATCH 46/97] 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. @@ -6891,10 +6351,10 @@ index 0000000..fd1d67c + +#endif // _RASPBERRY_PI_POWER_SYSCALL_H_ -From 5d57c79efc6dbd4e53e443d00cd311db36ee4c00 Mon Sep 17 00:00:00 2001 +From dd500f8f7be62fc0fe5e871c31235101e4cb9568 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 16:16:29 +0000 -Subject: [PATCH 49/88] [power] hack - don't kill lirc or cec +Subject: [PATCH 47/97] [power] hack - don't kill lirc or cec --- xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 37 +++++++++++++++++++++++ @@ -6978,10 +6438,10 @@ index 2d8c750..901f449 100644 CBuiltins::Execute("LIRC.Start"); #endif -From 0f345d5255c0ba3eaa3de4d5e3edafa8b9ee1353 Mon Sep 17 00:00:00 2001 +From 7b20a7bfadd6eaf3aa91ab2540a8b9197c91a9ed Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 16:47:54 +0000 -Subject: [PATCH 50/88] [power] hack - wake on any action +Subject: [PATCH 48/97] [power] hack - wake on any action --- xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 6 +++--- @@ -7010,10 +6470,10 @@ index 6a1e47b..a717a09 100644 if(VirtualWake()) { -From 7eda27088504039e1aa86dc73ed5303e84cad7ca Mon Sep 17 00:00:00 2001 +From c8dc689f3bebf5afd761827efc337023439450c6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 17:30:07 +0000 -Subject: [PATCH 51/88] [power] hack - Make suspend toggle suspend state +Subject: [PATCH 49/97] [power] hack - Make suspend toggle suspend state --- xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 5 +++++ @@ -7036,10 +6496,10 @@ index a717a09..d39c3ed 100644 return false; } -From f74a34032d6a15d74d357a2da9df26c82fb18c14 Mon Sep 17 00:00:00 2001 +From 02af21c2fae2006f4cf3a4cc579027a87029ff2d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 4 Mar 2014 19:33:44 +0000 -Subject: [PATCH 52/88] [power] Add back in powerdown and reboot +Subject: [PATCH 50/97] [power] Add back in powerdown and reboot --- .../linux/RaspberryPIPowerSyscall.cpp | 34 ++++++++++++++++++++++ @@ -7117,34 +6577,11 @@ index fd1d67c..062132e 100644 virtual bool CanReboot() { return true; } -From 49c8eeecb99941aa2ba5b14f45e6ebcdc324ac9a Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 26 Apr 2014 17:27:52 +0100 -Subject: [PATCH 53/88] [cec] Don't suspend pi on tv switch off - it can't wake - up ---- - system/peripherals.xml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/system/peripherals.xml b/system/peripherals.xml -index a67dc2f..680863e 100644 ---- a/system/peripherals.xml -+++ b/system/peripherals.xml -@@ -16,7 +16,7 @@ - - - -- -+ - - - - -From 70db53f6198e3c33692992e81c808e24e0c515d6 Mon Sep 17 00:00:00 2001 +From aa44888a3d20db36c0b12f57bc07c8d1bd6d1ae6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 27 Jun 2014 00:01:05 +0100 -Subject: [PATCH 54/88] [rbp] Resume video output on startup +Subject: [PATCH 52/97] [rbp] Resume video output on startup --- xbmc/linux/RBP.cpp | 3 +++ @@ -7165,10 +6602,10 @@ index cb87b77..34866f6 100644 m_omx_image_init = true; return true; -From 738d2617a7e78b92cccf72da2a5057e2ee4eb90d Mon Sep 17 00:00:00 2001 +From 90c162c4fcf3df7ea3313d17bd1bfdb96271d118 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 16 Aug 2014 21:01:42 +0100 -Subject: [PATCH 55/88] omxrender: Hacks to reduce GUI rendering rate when +Subject: [PATCH 53/97] omxrender: Hacks to reduce GUI rendering rate when playing video --- @@ -7178,10 +6615,10 @@ Subject: [PATCH 55/88] omxrender: Hacks to reduce GUI rendering rate when 3 files changed, 60 insertions(+) diff --git a/language/English/strings.po b/language/English/strings.po -index 9aa583b..6f6c761 100755 +index c31a07c..7f1f001 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -16092,3 +16092,30 @@ msgstr "" +@@ -16097,3 +16097,30 @@ msgstr "" msgctxt "#38021" msgid "Allow viewing and playing files in archives (e.g. zip, rar)" msgstr "" @@ -7240,7 +6677,7 @@ index f3c8a01..2996c29 100644 diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 77fce2e..3c7b202 100644 +index d1b304b..3a5e045 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -2207,6 +2207,23 @@ void CApplication::Render() @@ -7268,10 +6705,10 @@ index 77fce2e..3c7b202 100644 int vsync_mode = CSettings::Get().GetInt("videoscreen.vsync"); -From 4b3ba7e45469e0ff462602bd5038355a314216e9 Mon Sep 17 00:00:00 2001 +From 55ac0ff8865c9720e541c98e800626d848e983cf Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 9 Sep 2014 12:04:26 +0100 -Subject: [PATCH 56/88] egl: Treat unknown display aspect ratio as square pixel +Subject: [PATCH 54/97] egl: Treat unknown display aspect ratio as square pixel --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 ++-- @@ -7300,10 +6737,10 @@ index ca36082..1529045 100644 SetResolutionString(m_desktopRes); -From 75ec9b8b5952b8f209a26b033fbffcc22a59f8b2 Mon Sep 17 00:00:00 2001 +From 6bc47b56b259a3e122607d5f6269711dc7a6a187 Mon Sep 17 00:00:00 2001 From: anaconda Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 57/88] Disable textbox autoscrolling while on screensaver. +Subject: [PATCH 55/97] Disable textbox autoscrolling while on screensaver. SQUASH: only if dim or black --- @@ -7313,7 +6750,7 @@ SQUASH: only if dim or black 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 3c7b202..2cf9d11 100644 +index 3a5e045..009d425 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -5853,3 +5853,10 @@ void CApplication::CloseNetworkShares() @@ -7364,10 +6801,10 @@ index b7ef051..e149418 100644 if (m_lastRenderTime) m_autoScrollDelayTime += currentTime - m_lastRenderTime; -From c2fd03068cd4a7dcd669a2297f3c89ff379840b7 Mon Sep 17 00:00:00 2001 +From 722fcb8e4c357d641bd084b6059dfc41dd389d0b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 18 Sep 2014 14:24:56 +0100 -Subject: [PATCH 58/88] [omxplayer] Only enable audio clock master when A/V +Subject: [PATCH 56/97] [omxplayer] Only enable audio clock master when A/V sync method is set to audio clock --- @@ -7398,10 +6835,10 @@ index 549700c..db0886e 100644 OMX_CONFIG_BOOLEANTYPE configBool; OMX_INIT_STRUCTURE(configBool); -From 0d76f7659bf9785028263ccb17ab800bcbfcbfdd Mon Sep 17 00:00:00 2001 +From eaa3083364c697af2acf6f1c53a12e946c674f5d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 59/88] [dvdplayer/rbp] Add pi specific option to maintain +Subject: [PATCH 57/97] [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". @@ -7420,10 +6857,10 @@ Needed updated firmware 7 files changed, 76 insertions(+), 3 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po -index 6f6c761..725205a 100755 +index 7f1f001..194b22f 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -16119,3 +16119,8 @@ msgstr "" +@@ -16124,3 +16124,8 @@ msgstr "" msgctxt "#38005" msgid "24 fps" msgstr "" @@ -7599,10 +7036,10 @@ index f947acc..606c24f 100644 void SuspendVideoOutput(); void ResumeVideoOutput(); -From c4e58556721b7a82e2ef1f7939d5f4932bf8febb Mon Sep 17 00:00:00 2001 +From 0d39b1280cb607bb5cf0ae0749628d6fb2968123 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Sep 2014 18:31:31 +0100 -Subject: [PATCH 60/88] hack: revert squash: don't update originaldts when +Subject: [PATCH 58/97] hack: revert squash: don't update originaldts when marked as invalid --- @@ -7622,10 +7059,10 @@ index 2a2202f..3ab62c2 100644 } else -From 2dd0aab99a4b25807d04823f23b7e16ba04b7eec Mon Sep 17 00:00:00 2001 +From 3d3cbcf03b3a846ebcfd34be339d847d9328e239 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 27 Sep 2014 15:27:04 +0100 -Subject: [PATCH 61/88] [omxplayer] Don't sync up to passthrough audio packets +Subject: [PATCH 59/97] [omxplayer] Don't sync up to passthrough audio packets - let GPU handle it This code was just broken. @@ -7883,10 +7320,10 @@ index 7cf10ad..f014364 100644 OMX_AUDIO_CODINGTYPE m_eEncoding; uint8_t *m_extradata; -From 4769ff56b3626216eb3afe23a27777210d39acf6 Mon Sep 17 00:00:00 2001 +From e9a054e544da279aeaf103840f573044fe407aee Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 27 Sep 2014 15:32:37 +0100 -Subject: [PATCH 62/88] [dvdplayer] exerimental: don't raise priority of audio +Subject: [PATCH 60/97] [dvdplayer] exerimental: don't raise priority of audio thread --- @@ -7910,10 +7347,10 @@ index 3ab62c2..6bb9ede 100644 } -From 2b54d8b0578c8f9419fc10be88ef56b589615539 Mon Sep 17 00:00:00 2001 +From f7657c8f64a8b5153ed6b5488b1796face750a71 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 28 Sep 2014 19:28:17 +0100 -Subject: [PATCH 63/88] [mmalcodec] Introduce a preroll period to buffer up +Subject: [PATCH 61/97] [mmalcodec] Introduce a preroll period to buffer up frames on startup --- @@ -8050,10 +7487,10 @@ index b4aa571..4f81bbd 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; -From 0b7ee27d74501abb8e6f62a97fb53c6d5cbb6d5d Mon Sep 17 00:00:00 2001 +From 7b56f4c3aa0162f9fa6ba0213f662e19fb245757 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 11 Apr 2014 16:12:27 +0100 -Subject: [PATCH 64/88] [omxplayer] Add ability to log more timestamp info in +Subject: [PATCH 62/97] [omxplayer] Add ability to log more timestamp info in extra debug settings --- @@ -8066,11 +7503,11 @@ Subject: [PATCH 64/88] [omxplayer] Add ability to log more timestamp info in 6 files changed, 25 insertions(+), 13 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po -index 725205a..56cdcb4 100755 +index 194b22f..87a9170 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -2887,6 +2887,11 @@ msgctxt "#679" - msgid "Verbose logging for CEC library" +@@ -2892,6 +2892,11 @@ msgctxt "#680" + msgid "Verbose logging for VIDEO component" msgstr "" +#: xbmc/settings/AdvancedSettings.cpp @@ -8078,23 +7515,23 @@ index 725205a..56cdcb4 100755 +msgid "Verbose logging for OMXPLAYER" +msgstr "" + - #empty strings from id 680 to 699 + #empty strings from id 681 to 699 msgctxt "#700" diff --git a/xbmc/commons/ilog.h b/xbmc/commons/ilog.h -index 92e2835..ad02d95 100644 +index 4a69bb7..a3b6ba6 100644 --- a/xbmc/commons/ilog.h +++ b/xbmc/commons/ilog.h -@@ -53,6 +53,7 @@ - #define LOGAIRTUNES (1 << (LOGMASKBIT + 8)) +@@ -54,6 +54,7 @@ #define LOGUPNP (1 << (LOGMASKBIT + 9)) #define LOGCEC (1 << (LOGMASKBIT + 10)) -+#define LOGOMXPLAYER (1 << (LOGMASKBIT+11)) + #define LOGVIDEO (1 << (LOGMASKBIT + 11)) ++#define LOGOMXPLAYER (1 << (LOGMASKBIT + 16)) #include "utils/params_check_macros.h" diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp -index cd383be..575c709 100644 +index c094650..08a3a11 100644 --- a/xbmc/cores/omxplayer/OMXHelper.cpp +++ b/xbmc/cores/omxplayer/OMXHelper.cpp @@ -23,6 +23,7 @@ @@ -8190,10 +7627,10 @@ index 605318c9..783ac20 100644 || m_speed < 0) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index ca2d33c..997ed38 100644 +index bf78194..c68ac95 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1385,6 +1385,9 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se +@@ -1384,6 +1384,9 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se #ifdef HAVE_LIBCEC list.push_back(std::make_pair(g_localizeStrings.Get(679), LOGCEC)); #endif @@ -8204,10 +7641,10 @@ index ca2d33c..997ed38 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From bb9411f2fc37ecfac5babc2244a6ef36339df487 Mon Sep 17 00:00:00 2001 +From be92ee3262597fce684d42f95bbe5d490639a5d7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 65/88] [omxplayer] Add ability to dump out audio/video data +Subject: [PATCH 63/97] [omxplayer] Add ability to dump out audio/video data for later debugging --- @@ -8219,10 +7656,10 @@ Subject: [PATCH 65/88] [omxplayer] Add ability to dump out audio/video data 5 files changed, 112 insertions(+) diff --git a/language/English/strings.po b/language/English/strings.po -index 56cdcb4..3ce3fb6 100755 +index 87a9170..bb444ec 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -2892,6 +2892,16 @@ msgctxt "#697" +@@ -2897,6 +2897,16 @@ msgctxt "#697" msgid "Verbose logging for OMXPLAYER" msgstr "" @@ -8236,19 +7673,19 @@ index 56cdcb4..3ce3fb6 100755 +msgid "Dump audio frames to debug file" +msgstr "" + - #empty strings from id 680 to 699 + #empty strings from id 681 to 699 msgctxt "#700" diff --git a/xbmc/commons/ilog.h b/xbmc/commons/ilog.h -index ad02d95..be40370 100644 +index a3b6ba6..f01c83b 100644 --- a/xbmc/commons/ilog.h +++ b/xbmc/commons/ilog.h -@@ -54,6 +54,8 @@ - #define LOGUPNP (1 << (LOGMASKBIT + 9)) +@@ -55,6 +55,8 @@ #define LOGCEC (1 << (LOGMASKBIT + 10)) - #define LOGOMXPLAYER (1 << (LOGMASKBIT+11)) -+#define LOGDUMPVIDEO (1 << (LOGMASKBIT+12)) -+#define LOGDUMPAUDIO (1 << (LOGMASKBIT+13)) + #define LOGVIDEO (1 << (LOGMASKBIT + 11)) + #define LOGOMXPLAYER (1 << (LOGMASKBIT + 16)) ++#define LOGDUMPVIDEO (1 << (LOGMASKBIT + 17)) ++#define LOGDUMPAUDIO (1 << (LOGMASKBIT + 18)) #include "utils/params_check_macros.h" @@ -8434,10 +7871,10 @@ index 0363aaa..6cfb148 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 997ed38..7d2aa35 100644 +index c68ac95..852c70d 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1388,6 +1388,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se +@@ -1387,6 +1387,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se #ifdef TARGET_RASPBERRY_PI list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); #endif @@ -8449,47 +7886,93 @@ index 997ed38..7d2aa35 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From 10d222a97792d727f74287316adc40148f9ec4b9 Mon Sep 17 00:00:00 2001 +From eae1fe09d652c99b7a2ee0143b5c7e90d41ae97f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 Oct 2014 22:45:09 +0100 -Subject: [PATCH 66/88] [mmalrenderer] Add choice of 3 deinterlace schemes +Subject: [PATCH 64/97] [mmalrenderer] Add choice of 4 deinterlace schemes --- - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 4 ++++ - xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 4 +++- + language/English/strings.po | 18 ++++++++++++++++++ + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 10 ++++++++-- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 5 ++++- xbmc/cores/dvdplayer/DVDPlayer.cpp | 1 + xbmc/cores/dvdplayer/DVDPlayer.h | 1 + - xbmc/cores/omxplayer/OMXHelper.cpp | 10 +++++++++- - xbmc/cores/omxplayer/OMXVideo.cpp | 11 ++++++++--- - 6 files changed, 26 insertions(+), 5 deletions(-) + xbmc/cores/omxplayer/OMXHelper.cpp | 12 +++++++++++- + xbmc/cores/omxplayer/OMXVideo.cpp | 12 +++++++++--- + xbmc/settings/VideoSettings.h | 5 +++++ + xbmc/video/dialogs/GUIDialogVideoSettings.cpp | 4 ++++ + 9 files changed, 61 insertions(+), 7 deletions(-) +diff --git a/language/English/strings.po b/language/English/strings.po +index bb444ec..d6a87fd 100755 +--- a/language/English/strings.po ++++ b/language/English/strings.po +@@ -7539,6 +7539,24 @@ msgctxt "#16329" + msgid "VAAPI Motion Compensated" + msgstr "" + ++#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp ++msgctxt "#16330" ++msgid "MMAL - Advanced" ++msgstr "" ++ ++msgctxt "#16331" ++msgid "MMAL - Advanced (Half)" ++msgstr "" ++ ++msgctxt "#16332" ++msgid "MMAL - Bob" ++msgstr "" ++ ++msgctxt "#16333" ++msgid "MMAL - Bob (Half)" ++msgstr "" ++ ++ + #empty strings from id 16330 to 16399 + + #: xbmc/video/dialogs/GUIDialogVideoSettings.cpp diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index 5fb6dce..9cb4d60 100644 +index 5fb6dce..03a05de 100644 --- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp +++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -502,6 +502,10 @@ bool CMMALRenderer::Supports(EINTERLACEMETHOD method) +@@ -500,7 +500,13 @@ bool CMMALRenderer::Supports(EDEINTERLACEMODE mode) + + bool CMMALRenderer::Supports(EINTERLACEMETHOD method) { - if (method == VS_INTERLACEMETHOD_DEINTERLACE) +- if (method == VS_INTERLACEMETHOD_DEINTERLACE) ++ if (method == VS_INTERLACEMETHOD_MMAL_ADVANCED) ++ return true; ++ if (method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF) ++ return true; ++ if (method == VS_INTERLACEMETHOD_MMAL_BOB) ++ return true; ++ if (method == VS_INTERLACEMETHOD_MMAL_BOB_HALF) return true; -+ if (method == VS_INTERLACEMETHOD_DEINTERLACE_HALF) -+ return true; -+ if (method == VS_INTERLACEMETHOD_RENDER_BOB) -+ return true; return false; +@@ -525,7 +531,7 @@ bool CMMALRenderer::Supports(ESCALINGMETHOD method) + + EINTERLACEMETHOD CMMALRenderer::AutoInterlaceMethod() + { +- return VS_INTERLACEMETHOD_DEINTERLACE; ++ return VS_INTERLACEMETHOD_MMAL_ADVANCED; } + + void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -index 42886b3..0498ec7 100644 +index 42886b3..c9c3839 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp -@@ -366,7 +366,9 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) +@@ -366,7 +366,10 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) CLog::Log(LOGERROR, "%s::%s Failed to create deinterlace component (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status)); return false; } - MMAL_PARAMETER_IMAGEFX_PARAMETERS_T imfx_param = {{MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, sizeof(imfx_param)}, MMAL_PARAM_IMAGEFX_DEINTERLACE_FAST, 1, {3}}; + MMAL_PARAMETER_IMAGEFX_PARAMETERS_T imfx_param = {{MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, sizeof(imfx_param)}, -+ interlace_method == VS_INTERLACEMETHOD_DEINTERLACE ? MMAL_PARAM_IMAGEFX_DEINTERLACE_ADV : MMAL_PARAM_IMAGEFX_DEINTERLACE_FAST, -+ 3, {3, 0, interlace_method == VS_INTERLACEMETHOD_DEINTERLACE_HALF }}; ++ 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 }}; status = mmal_port_parameter_set(m_deint->output[0], &imfx_param.hdr); if (status != MMAL_SUCCESS) { @@ -8518,10 +8001,10 @@ index 9f75ccf..5fc3d01 100644 bool bOmxWaitAudio; // whether we need to wait for audio to play out on EOS bool bOmxSentEOFs; // flag if we've send EOFs to audio/video players diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp -index 575c709..3ae612a 100644 +index 08a3a11..9739ed0 100644 --- a/xbmc/cores/omxplayer/OMXHelper.cpp +++ b/xbmc/cores/omxplayer/OMXHelper.cpp -@@ -121,10 +121,18 @@ bool OMXDoProcessing(struct SOmxPlayerState &m_OmxPlayerState, int m_playSpeed, +@@ -121,10 +121,20 @@ bool OMXDoProcessing(struct SOmxPlayerState &m_OmxPlayerState, int m_playSpeed, float threshold = 0.1f; bool audio_fifo_low = false, video_fifo_low = false, audio_fifo_high = false, video_fifo_high = false; @@ -8531,10 +8014,12 @@ index 575c709..3ae612a 100644 // if deinterlace setting has changed, we should close and open video - if (m_OmxPlayerState.current_deinterlace != CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode) + if (m_OmxPlayerState.current_deinterlace != CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode || -+ (m_OmxPlayerState.current_deinterlace != VS_DEINTERLACEMODE_OFF && m_OmxPlayerState.interlace_method != g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod))) ++ (m_OmxPlayerState.current_deinterlace != VS_DEINTERLACEMODE_OFF && ++ m_OmxPlayerState.interlace_method != g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod))) { -+ CLog::Log(LOGERROR, "%s - Reopen stream due to interlace change (%d,%d,%d,%d)", __FUNCTION__, m_OmxPlayerState.current_deinterlace, CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode, -+ m_OmxPlayerState.interlace_method, g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod)); ++ CLog::Log(LOGERROR, "%s - Reopen stream due to interlace change (%d,%d,%d,%d)", __FUNCTION__, ++ m_OmxPlayerState.current_deinterlace, CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode, ++ m_OmxPlayerState.interlace_method, g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod)); + m_OmxPlayerState.current_deinterlace = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; + m_OmxPlayerState.interlace_method = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); @@ -8542,7 +8027,7 @@ index 575c709..3ae612a 100644 } diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 6cfb148..37765b1 100644 +index 6cfb148..b483829 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp @@ -30,6 +30,8 @@ @@ -8554,19 +8039,20 @@ index 6cfb148..37765b1 100644 #include "xbmc/guilib/GraphicContext.h" #include "settings/Settings.h" #include "utils/BitstreamConverter.h" -@@ -298,8 +300,9 @@ bool COMXVideo::PortSettingsChanged() +@@ -298,8 +300,10 @@ bool COMXVideo::PortSettingsChanged() if(m_deinterlace) { - bool advanced_deinterlace = port_image.format.video.nFrameWidth * port_image.format.video.nFrameHeight <= 576 * 720; - + EINTERLACEMETHOD interlace_method = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); -+ bool advanced_deinterlace = interlace_method == VS_INTERLACEMETHOD_DEINTERLACE && port_image.format.video.nFrameWidth * port_image.format.video.nFrameHeight <= 576 * 720; -+ bool half_framerate = interlace_method == VS_INTERLACEMETHOD_DEINTERLACE_HALF; ++ bool advanced_deinterlace = interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED || interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF && ++ port_image.format.video.nFrameWidth * port_image.format.video.nFrameHeight <= 576 * 720; ++ bool half_framerate = interlace_method == VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF || interlace_method == VS_INTERLACEMETHOD_MMAL_BOB_HALF; if (!advanced_deinterlace) { // Image_fx assumed 3 frames of context. simple deinterlace doesn't require this -@@ -319,8 +322,10 @@ bool COMXVideo::PortSettingsChanged() +@@ -319,8 +323,10 @@ bool COMXVideo::PortSettingsChanged() OMX_INIT_STRUCTURE(image_filter); image_filter.nPortIndex = m_omx_image_fx.GetOutputPort(); @@ -8578,11 +8064,42 @@ index 6cfb148..37765b1 100644 if (!advanced_deinterlace) image_filter.eImageFilter = OMX_ImageFilterDeInterlaceFast; else +diff --git a/xbmc/settings/VideoSettings.h b/xbmc/settings/VideoSettings.h +index 88434a4..6eaef1d 100644 +--- a/xbmc/settings/VideoSettings.h ++++ b/xbmc/settings/VideoSettings.h +@@ -67,6 +67,11 @@ enum EINTERLACEMETHOD + VS_INTERLACEMETHOD_VAAPI_MADI = 23, + VS_INTERLACEMETHOD_VAAPI_MACI = 24, + ++ VS_INTERLACEMETHOD_MMAL_ADVANCED = 25, ++ VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF = 26, ++ VS_INTERLACEMETHOD_MMAL_BOB = 27, ++ VS_INTERLACEMETHOD_MMAL_BOB_HALF = 28, ++ + VS_INTERLACEMETHOD_MAX // do not use and keep as last enum value. + }; + +diff --git a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp +index cffd5a4..ca65fdc 100644 +--- a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp ++++ b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp +@@ -262,6 +262,10 @@ void CGUIDialogVideoSettings::InitializeSettings() + entries.push_back(make_pair(16327, VS_INTERLACEMETHOD_VAAPI_BOB)); + entries.push_back(make_pair(16328, VS_INTERLACEMETHOD_VAAPI_MADI)); + entries.push_back(make_pair(16329, VS_INTERLACEMETHOD_VAAPI_MACI)); ++ entries.push_back(make_pair(16330, VS_INTERLACEMETHOD_MMAL_ADVANCED)); ++ entries.push_back(make_pair(16331, VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF)); ++ entries.push_back(make_pair(16332, VS_INTERLACEMETHOD_MMAL_BOB)); ++ entries.push_back(make_pair(16333, VS_INTERLACEMETHOD_MMAL_BOB_HALF)); + + /* remove unsupported methods */ + for (StaticIntegerSettingOptions::iterator it = entries.begin(); it != entries.end(); ) -From c281ce7162c96c9bee36315fc27c884b74819ccc Mon Sep 17 00:00:00 2001 +From 7ded7074e10fc57d8aac1f02ac64f6114095f277 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 67/88] [audio] Add settings option to boost centre channel +Subject: [PATCH 65/97] [audio] Add settings option to boost centre channel when downmixing This allows a dB volume increase to be added to centre channel. @@ -8600,10 +8117,10 @@ Should work with Pi Sink (dvdplayer/paplayer) and omxplayer 5 files changed, 45 insertions(+) diff --git a/language/English/strings.po b/language/English/strings.po -index 3ce3fb6..bb5dd3b 100755 +index d6a87fd..6d0ac82 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -16139,3 +16139,17 @@ msgstr "" +@@ -16162,3 +16162,17 @@ msgstr "" msgctxt "#38006" msgid "Adjust PLL" msgstr "" @@ -8645,7 +8162,7 @@ index a18d889..e5f08c7 100644 HAS_AE_QUALITY_LEVELS 2 diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp -index f856fd5..40e8c8b 100644 +index de188e7..449a500 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp @@ -20,6 +20,7 @@ @@ -8704,10 +8221,10 @@ index b5e86ae..00bae83 100644 // stereo upmix if (upmix && m_src_channels == 2 && m_dst_channels > 2) -From d5bd989d0f7094fe45bd7c228af7797e229a8ecf Mon Sep 17 00:00:00 2001 +From 5dcf5b9b73e2a621aed8de3f0ffbccaad07312ff Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 3 Oct 2014 18:38:07 +0100 -Subject: [PATCH 68/88] [omxcore] Skip out of flush on error +Subject: [PATCH 66/97] [omxcore] Skip out of flush on error --- xbmc/linux/OMXCore.cpp | 4 ++-- @@ -8736,10 +8253,10 @@ index 4ae29ba..4caa304 100644 OMX_ERRORTYPE omx_err = OMX_ErrorNone; -From 39b1d20267d6409046d340ca85cefdf64ed25ab7 Mon Sep 17 00:00:00 2001 +From 6c8e95fbd64a5c2ee204931f2949bbd1f0e8bd66 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 3 Oct 2014 18:40:06 +0100 -Subject: [PATCH 69/88] [SinkPi] Handle multichannel layout more like OMXAudio +Subject: [PATCH 67/97] [SinkPi] Handle multichannel layout more like OMXAudio --- xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 14 +++++++------- @@ -8798,10 +8315,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 496f37420fffe365663d22f86f4b656160c606fb Mon Sep 17 00:00:00 2001 +From 53b4968f1204fcec85d5bb0c60fe96b35a021306 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 5 Oct 2014 14:05:25 +0100 -Subject: [PATCH 70/88] [PiSink] Allow audio output latency to be set in +Subject: [PATCH 68/97] [PiSink] Allow audio output latency to be set in settings --- @@ -8812,10 +8329,10 @@ Subject: [PATCH 70/88] [PiSink] Allow audio output latency to be set in 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po -index bb5dd3b..a6fb044 100755 +index 6d0ac82..c69e7a5 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -16153,3 +16153,18 @@ msgstr "" +@@ -16176,3 +16176,18 @@ msgstr "" #: system/settings/settings.xml msgctxt "#38009" msgid "%i dB" @@ -8929,10 +8446,10 @@ index 5c57999..cac5051 100644 bool m_Initialized; uint32_t m_submitted; -From 041f198591bf07421fcbf1ccd5e5605e75446d04 Mon Sep 17 00:00:00 2001 +From c341c9d644515dfb718480e7e1e8b2f4a96ed2d9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 19 Oct 2014 13:43:46 +0100 -Subject: [PATCH 71/88] Revert "hack: revert squash: don't update originaldts +Subject: [PATCH 69/97] Revert "hack: revert squash: don't update originaldts when marked as invalid" This reverts commit 4085c67b535627e1723ca8d7f82f3cdeaa67f54e. @@ -8953,10 +8470,10 @@ index 8a31513..83b92e0 100644 } else -From b4a2047041bddf552152fc325b5eac8d4508fbe3 Mon Sep 17 00:00:00 2001 +From e19c45b1e14750e8d0c02cfdcecbf034502da6d6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 18 Aug 2014 19:09:32 +0100 -Subject: [PATCH 72/88] rbp: Use new dispmanx function for vsync callbacks +Subject: [PATCH 70/97] rbp: Use new dispmanx function for vsync callbacks --- xbmc/linux/RBP.cpp | 85 ++++++++++++++----------- @@ -9168,10 +8685,10 @@ index 1529045..b6bf1fc 100644 } DLOG("CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow\n"); -From 825f7d09c08f895e1da047d630daaef75612457f Mon Sep 17 00:00:00 2001 +From 0b84e5ba0029132ebeabab2e0f10b060532a0007 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 19 Aug 2014 17:56:45 +0100 -Subject: [PATCH 73/88] Revert "rbp: Use new dispmanx function for vsync +Subject: [PATCH 71/97] Revert "rbp: Use new dispmanx function for vsync callbacks" This reverts commit afbf8fbceaa6649fb4a6bbd9a1cee6087590412b. @@ -9385,10 +8902,10 @@ index b6bf1fc..1529045 100644 } DLOG("CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow\n"); -From e11908616435899712dc9748650c184bd97e58df Mon Sep 17 00:00:00 2001 +From 2fb3ede039019d8b52d6bb014fdb098288a41553 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 15:23:51 +0000 -Subject: [PATCH 74/88] [rbp] Default extract thumbnails to false +Subject: [PATCH 72/97] [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 @@ -9419,10 +8936,10 @@ index b8e6e59..40be71e 100644
-From 1a54fc03e9922b9bff13b7c9253fd708497159e3 Mon Sep 17 00:00:00 2001 +From 7610854329fe94c30f3e1167b2bebbc01df71519 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Nov 2014 17:16:54 +0000 -Subject: [PATCH 76/88] Revert "[omxplayer] Add ability to dump out audio/video +Subject: [PATCH 74/97] Revert "[omxplayer] Add ability to dump out audio/video data for later debugging" This reverts commit 417416bd29d00f1b42c77488d06e9e6840b8c4f4. @@ -9435,10 +8952,10 @@ This reverts commit 417416bd29d00f1b42c77488d06e9e6840b8c4f4. 5 files changed, 112 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po -index 4c33d22..348a746 100755 +index 93f8398..b5602c9 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -2892,16 +2892,6 @@ msgctxt "#697" +@@ -2897,16 +2897,6 @@ msgctxt "#697" msgid "Verbose logging for OMXPLAYER" msgstr "" @@ -9452,19 +8969,19 @@ index 4c33d22..348a746 100755 -msgid "Dump audio frames to debug file" -msgstr "" - - #empty strings from id 680 to 699 + #empty strings from id 681 to 699 msgctxt "#700" diff --git a/xbmc/commons/ilog.h b/xbmc/commons/ilog.h -index be40370..ad02d95 100644 +index f01c83b..a3b6ba6 100644 --- a/xbmc/commons/ilog.h +++ b/xbmc/commons/ilog.h -@@ -54,8 +54,6 @@ - #define LOGUPNP (1 << (LOGMASKBIT + 9)) +@@ -55,8 +55,6 @@ #define LOGCEC (1 << (LOGMASKBIT + 10)) - #define LOGOMXPLAYER (1 << (LOGMASKBIT+11)) --#define LOGDUMPVIDEO (1 << (LOGMASKBIT+12)) --#define LOGDUMPAUDIO (1 << (LOGMASKBIT+13)) + #define LOGVIDEO (1 << (LOGMASKBIT + 11)) + #define LOGOMXPLAYER (1 << (LOGMASKBIT + 16)) +-#define LOGDUMPVIDEO (1 << (LOGMASKBIT + 17)) +-#define LOGDUMPAUDIO (1 << (LOGMASKBIT + 18)) #include "utils/params_check_macros.h" @@ -9564,7 +9081,7 @@ index 00bae83..f17df87 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 37765b1..6e07e0a 100644 +index b483829..45e942f 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp @@ -65,49 +65,6 @@ @@ -9625,7 +9142,7 @@ index 37765b1..6e07e0a 100644 omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); if (omx_err != OMX_ErrorNone) { -@@ -756,7 +712,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de +@@ -757,7 +713,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, EDEINTERLACEMODE de void COMXVideo::Close() { CSingleLock lock (m_critSection); @@ -9633,7 +9150,7 @@ index 37765b1..6e07e0a 100644 m_omx_tunnel_clock.Deestablish(); m_omx_tunnel_decoder.Deestablish(); if(m_deinterlace) -@@ -851,7 +806,6 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) +@@ -852,7 +807,6 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double pts) int nRetry = 0; while(true) { @@ -9641,7 +9158,7 @@ index 37765b1..6e07e0a 100644 omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer); if (omx_err == OMX_ErrorNone) { -@@ -982,7 +936,6 @@ void COMXVideo::SubmitEOS() +@@ -983,7 +937,6 @@ void COMXVideo::SubmitEOS() omx_buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_EOS | OMX_BUFFERFLAG_TIME_UNKNOWN; @@ -9650,10 +9167,10 @@ index 37765b1..6e07e0a 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 7d2aa35..997ed38 100644 +index 852c70d..c68ac95 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1388,10 +1388,6 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se +@@ -1387,10 +1387,6 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se #ifdef TARGET_RASPBERRY_PI list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); #endif @@ -9665,10 +9182,10 @@ index 7d2aa35..997ed38 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From b79ffd4c0bd7a900dbad7aa6742c419cbc17c0ba Mon Sep 17 00:00:00 2001 +From 2afa229e47ef1e04cec417cbde1de9649ec9c5aa Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 77/88] [omxplayer] Add ability to dump out audio/video data +Subject: [PATCH 75/97] [omxplayer] Add ability to dump out audio/video data for later debugging --- @@ -9679,10 +9196,10 @@ Subject: [PATCH 77/88] [omxplayer] Add ability to dump out audio/video data 4 files changed, 79 insertions(+) diff --git a/language/English/strings.po b/language/English/strings.po -index 348a746..4c33d22 100755 +index b5602c9..93f8398 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -2892,6 +2892,16 @@ msgctxt "#697" +@@ -2897,6 +2897,16 @@ msgctxt "#697" msgid "Verbose logging for OMXPLAYER" msgstr "" @@ -9696,19 +9213,19 @@ index 348a746..4c33d22 100755 +msgid "Dump audio frames to debug file" +msgstr "" + - #empty strings from id 680 to 699 + #empty strings from id 681 to 699 msgctxt "#700" diff --git a/xbmc/commons/ilog.h b/xbmc/commons/ilog.h -index ad02d95..be40370 100644 +index a3b6ba6..f01c83b 100644 --- a/xbmc/commons/ilog.h +++ b/xbmc/commons/ilog.h -@@ -54,6 +54,8 @@ - #define LOGUPNP (1 << (LOGMASKBIT + 9)) +@@ -55,6 +55,8 @@ #define LOGCEC (1 << (LOGMASKBIT + 10)) - #define LOGOMXPLAYER (1 << (LOGMASKBIT+11)) -+#define LOGDUMPVIDEO (1 << (LOGMASKBIT+12)) -+#define LOGDUMPAUDIO (1 << (LOGMASKBIT+13)) + #define LOGVIDEO (1 << (LOGMASKBIT + 11)) + #define LOGOMXPLAYER (1 << (LOGMASKBIT + 16)) ++#define LOGDUMPVIDEO (1 << (LOGMASKBIT + 17)) ++#define LOGDUMPAUDIO (1 << (LOGMASKBIT + 18)) #include "utils/params_check_macros.h" @@ -9801,10 +9318,10 @@ index 83b92e0..3036eb9 100644 if(player) player->CloseStream(bWaitForBuffers); diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 997ed38..7d2aa35 100644 +index c68ac95..852c70d 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1388,6 +1388,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se +@@ -1387,6 +1387,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se #ifdef TARGET_RASPBERRY_PI list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); #endif @@ -9817,10 +9334,10 @@ index 997ed38..7d2aa35 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From 3628b9e2e1b81b6aedf05491c0c49bf446b2404b Mon Sep 17 00:00:00 2001 +From e40512bd94b6b85a56fd17ec789720fb1cc1f89b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 5 Nov 2014 14:51:16 +0000 -Subject: [PATCH 80/88] [DVDMessageQueue] Remove pi specific logging ifdef +Subject: [PATCH 78/97] [DVDMessageQueue] Remove pi specific logging ifdef --- xbmc/cores/dvdplayer/DVDMessageQueue.cpp | 2 -- @@ -9841,10 +9358,10 @@ index 92fa67a..f6ad8d0 100644 } -From 7d4a9702644a6467a1380c07edb4d7c5b6cf2c09 Mon Sep 17 00:00:00 2001 +From 69a818a9888e2d262755bae0befa511bc6279278 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 6 Nov 2014 16:20:30 +0000 -Subject: [PATCH 81/88] [ResamplePi] Add support for formats that need shifting +Subject: [PATCH 79/97] [ResamplePi] Add support for formats that need shifting This case is triggered by HiFiBerry's 24-bit format. Requires updated firmware @@ -9946,311 +9463,10 @@ index dfa3e4a..25588d4 100644 OMX_AUDIO_PARAM_PCMMODETYPE m_pcm_input; -From 98d8078b67423741b9d3c448e9ac8aaf2d5e4969 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 9 Nov 2014 13:53:34 +0000 -Subject: [PATCH 82/88] [curl] Avoid busy spinning when socket timeout is too - low - -This is an RFC as I don't know this code well, but my investigation may provoke a better fix. -See: http://forum.kodi.tv/showthread.php?tid=201797&pid=1771808#pid1771808 - -Summary: when streaming audio through http the cpu usage starts low and creeps higher and higher. - -For first minute, the CPU usage of FileCache thread is a few percent. -As time goes by the cpu usage for this thread increases until it hits about 60% and we start stuttering. - -Disabling the filecache (buffermode=3) avoids the high cpu issue. - -I've tracked down where the cpu is occurring. -CCurlFile::CReadState::FillBuffer is called with want=1. -After a while, g_curlInterface.multi_timeout returns smaller and smaller timeouts, -until it it just returning 0 and 1 for timeout. This results in busy spinning in this function. -The small timeouts mean small amounts of data are read and so FillBuffer gets called more often. - -My fix just ensures the timeout is never less than 200ms. -Now stream plays for a long time without stuttering and FileCache task remains at about 1% CPU. ---- - xbmc/filesystem/CurlFile.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/filesystem/CurlFile.cpp b/xbmc/filesystem/CurlFile.cpp -index 8408762..7a83564 100644 ---- a/xbmc/filesystem/CurlFile.cpp -+++ b/xbmc/filesystem/CurlFile.cpp -@@ -1549,7 +1549,7 @@ bool CCurlFile::CReadState::FillBuffer(unsigned int want) - g_curlInterface.multi_fdset(m_multiHandle, &fdread, &fdwrite, &fdexcep, &maxfd); - - long timeout = 0; -- if (CURLM_OK != g_curlInterface.multi_timeout(m_multiHandle, &timeout) || timeout == -1) -+ if (CURLM_OK != g_curlInterface.multi_timeout(m_multiHandle, &timeout) || timeout == -1 || timeout < 200) - timeout = 200; - - XbmcThreads::EndTime endTime(timeout); - -From 79c68b0d2bfeee8469f94809221dba16f13d4aa5 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 9 Nov 2014 14:41:48 +0000 -Subject: [PATCH 83/88] [dvdplayer] Allow new timestamp correction code to be - disabled with an advancedsetting - -In video section of advancedsettings.xml add reverttimestampchange=1 for old behaviour ---- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 2 ++ - xbmc/settings/AdvancedSettings.cpp | 3 +++ - xbmc/settings/AdvancedSettings.h | 1 + - 3 files changed, 6 insertions(+) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 3036eb9..48c2024 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -2021,6 +2021,8 @@ void CDVDPlayer::CheckContinuity(CCurrentStream& current, DemuxPacket* pPacket) - // not sure yet - flags the packets as unknown until we get confirmation on another audio/video packet - pPacket->dts = DVD_NOPTS_VALUE; - pPacket->pts = DVD_NOPTS_VALUE; -+ if (g_advancedSettings.m_revertTimestampChange) -+ current.originaldts = pPacket->dts; - } - } - else -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 7d2aa35..65ed7ad 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -117,6 +117,7 @@ void CAdvancedSettings::Initialize() - - m_omxHWAudioDecode = false; - m_omxDecodeStartWithValidFrame = false; -+ m_revertTimestampChange = false; - - m_karaokeSyncDelayCDG = 0.0f; - m_karaokeSyncDelayLRC = 0.0f; -@@ -568,6 +569,8 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) - XMLUtils::GetInt(pElement, "percentseekforwardbig", m_videoPercentSeekForwardBig, 0, 100); - XMLUtils::GetInt(pElement, "percentseekbackwardbig", m_videoPercentSeekBackwardBig, -100, 0); - -+ XMLUtils::GetBoolean(pElement, "reverttimestampchange", m_revertTimestampChange); -+ - TiXmlElement* pVideoExcludes = pElement->FirstChildElement("excludefromlisting"); - if (pVideoExcludes) - GetCustomRegexps(pVideoExcludes, m_videoExcludeFromListingRegExps); -diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index 7df586e..07434347 100644 ---- a/xbmc/settings/AdvancedSettings.h -+++ b/xbmc/settings/AdvancedSettings.h -@@ -145,6 +145,7 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler - - bool m_omxHWAudioDecode; - bool m_omxDecodeStartWithValidFrame; -+ bool m_revertTimestampChange; - - float m_videoSubsDelayRange; - float m_videoAudioDelayRange; - -From d56620f59f78adc10384464b5a5cc95b84b4ff95 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 9 Nov 2014 15:58:24 +0000 -Subject: [PATCH 84/88] [dvdplayer] Try resetting the demuxer if audio and - video remain out of sync - ---- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 12 ++++++++++++ - xbmc/cores/dvdplayer/DVDPlayer.h | 1 + - 2 files changed, 13 insertions(+) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 48c2024..52eec33 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -615,6 +615,7 @@ CDVDPlayer::CDVDPlayer(IPlayerCallback& callback) - m_caching = CACHESTATE_DONE; - m_HasVideo = false; - m_HasAudio = false; -+ m_discontinuity_start.SetInfinite(); - - memset(&m_SpeedState, 0, sizeof(m_SpeedState)); - -@@ -2015,10 +2016,21 @@ void CDVDPlayer::CheckContinuity(CCurrentStream& current, DemuxPacket* pPacket) - m_offset_pts += correction; - UpdateCorrection(pPacket, correction); - current.originaldts = pPacket->dts; -+ m_discontinuity_start.SetInfinite(); - } - else - { - // not sure yet - flags the packets as unknown until we get confirmation on another audio/video packet -+ if (m_discontinuity_start.IsInfinite()) -+ m_discontinuity_start.Set(2000); -+ else if (m_discontinuity_start.IsTimePast()) -+ { -+ CLog::Log(LOGNOTICE, "CDVDPlayer::CheckContinuity - Audio and Video out of sync - resetting demuxer (this:%f that:%f)", this_dts, that_dts); -+ if (m_pDemuxer) -+ m_pDemuxer->Reset(); -+ // avoid resetting demuxer every iteration, hopefully it will be resolved before next iteration -+ m_discontinuity_start.Set(2000); -+ } - pPacket->dts = DVD_NOPTS_VALUE; - pPacket->pts = DVD_NOPTS_VALUE; - if (g_advancedSettings.m_revertTimestampChange) -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h -index 5fc3d01..24bf89f 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.h -+++ b/xbmc/cores/dvdplayer/DVDPlayer.h -@@ -548,6 +548,7 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer - bool m_HasAudio; - - bool m_DemuxerPausePending; -+ XbmcThreads::EndTime m_discontinuity_start; - - // omxplayer variables - struct SOmxPlayerState m_OmxPlayerState; - -From c4e6c0de7948bc4cbd72196edd73481619d23326 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 11 Nov 2014 11:56:36 +0000 -Subject: [PATCH 85/88] squash: try with 1 second threshold for resetting - demuxer when audio/video out of sync - ---- - 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 52eec33..157ae88 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -2022,7 +2022,7 @@ void CDVDPlayer::CheckContinuity(CCurrentStream& current, DemuxPacket* pPacket) - { - // not sure yet - flags the packets as unknown until we get confirmation on another audio/video packet - if (m_discontinuity_start.IsInfinite()) -- m_discontinuity_start.Set(2000); -+ m_discontinuity_start.Set(1000); - else if (m_discontinuity_start.IsTimePast()) - { - CLog::Log(LOGNOTICE, "CDVDPlayer::CheckContinuity - Audio and Video out of sync - resetting demuxer (this:%f that:%f)", this_dts, that_dts); - -From 2e0fc979b374857397016626173150b152a63e33 Mon Sep 17 00:00:00 2001 -From: wsnipex -Date: Sat, 8 Nov 2014 10:36:20 +0100 -Subject: [PATCH 86/88] add canseek and drop unused rtmp options - ---- - .../DVDInputStreams/DVDInputStreamRTMP.cpp | 39 +++++----------------- - .../dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h | 7 +++- - 2 files changed, 15 insertions(+), 31 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp -index 62ddd3d..f49bc25 100644 ---- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp -+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp -@@ -63,7 +63,10 @@ extern "C" - } - } - --CDVDInputStreamRTMP::CDVDInputStreamRTMP() : CDVDInputStream(DVDSTREAM_TYPE_RTMP) -+CDVDInputStreamRTMP::CDVDInputStreamRTMP() -+ : CDVDInputStream(DVDSTREAM_TYPE_RTMP) -+ , m_can_seek(true) -+ , m_can_pause(true) - { - if (m_libRTMP.Load()) - { -@@ -119,19 +122,6 @@ bool CDVDInputStreamRTMP::IsEOF() - #undef AVC - #define AVC(str) {(char *)str,sizeof(str)-1} - --/* librtmp option names are slightly different */ --static const struct { -- const char *name; -- AVal key; --} options[] = { -- { "SWFPlayer", AVC("swfUrl") }, -- { "PageURL", AVC("pageUrl") }, -- { "PlayPath", AVC("playpath") }, -- { "TcUrl", AVC("tcUrl") }, -- { "IsLive", AVC("live") }, -- { NULL } --}; -- - bool CDVDInputStreamRTMP::Open(const char* strFile, const std::string& content) - { - if (m_sStreamPlaying) -@@ -152,21 +142,11 @@ bool CDVDInputStreamRTMP::Open(const char* strFile, const std::string& content) - if (!m_libRTMP.SetupURL(m_rtmp, m_sStreamPlaying)) - return false; - -- // SetOpt and SetAVal copy pointers to the value. librtmp doesn't use the values until the Connect() call, -- // so value objects must stay allocated until then. To be extra safe, keep the values around until Close(), -- // in case librtmp needs them again. -- m_optionvalues.clear(); -- for (int i=0; options[i].name; i++) -- { -- std::string tmp = m_item.GetProperty(options[i].name).asString(); -- if (!tmp.empty()) -- { -- m_optionvalues.push_back(tmp); -- AVal av_tmp; -- SetAVal(av_tmp, m_optionvalues.back()); -- m_libRTMP.SetOpt(m_rtmp, &options[i].key, &av_tmp); -- } -- } -+ std::string url = strFile; -+ size_t iPosBlank = url.find(' '); -+ if (iPosBlank != string::npos && (url.find("live=true") != string::npos || url.find("live=1") != string::npos)) -+ m_can_seek=false; -+ CLog::Log(LOGDEBUG, "RTMP canseek: %s", m_can_seek ? "true" : "false"); - - if (!m_libRTMP.Connect(m_rtmp, NULL) || !m_libRTMP.ConnectStream(m_rtmp, 0)) - return false; -@@ -185,7 +165,6 @@ void CDVDInputStreamRTMP::Close() - if (m_rtmp) - m_libRTMP.Close(m_rtmp); - -- m_optionvalues.clear(); - m_eof = true; - m_bPaused = false; - } -diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h -index b013f33..46f9513 100644 ---- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h -+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h -@@ -27,6 +27,7 @@ - class CDVDInputStreamRTMP - : public CDVDInputStream - , public CDVDInputStream::ISeekTime -+ , public CDVDInputStream::ISeekable - { - public: - CDVDInputStreamRTMP(); -@@ -36,17 +37,21 @@ class CDVDInputStreamRTMP - virtual int Read(uint8_t* buf, int buf_size); - virtual int64_t Seek(int64_t offset, int whence); - bool SeekTime(int iTimeInMsec); -+ bool CanSeek() { return m_can_seek; } -+ bool CanPause() { return m_can_pause; } - virtual bool Pause(double dTime); - virtual bool IsEOF(); - virtual int64_t GetLength(); - -+ - CCriticalSection m_RTMPSection; - - protected: - bool m_eof; - bool m_bPaused; -+ bool m_can_seek; -+ bool m_can_pause; - char* m_sStreamPlaying; -- std::vector m_optionvalues; - - RTMP *m_rtmp; - DllLibRTMP m_libRTMP; - -From 41d018ec14487b84c2ba035e70b60dd29da95392 Mon Sep 17 00:00:00 2001 +From 2352298cd69067c20cf165bb25a01bd19f6e214f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 11 Nov 2014 18:14:23 +0000 -Subject: [PATCH 87/88] [resamplepi] Try to report the same numbers as ffmpeg +Subject: [PATCH 80/97] [resamplepi] Try to report the same numbers as ffmpeg --- .../cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp | 11 ++++++----- @@ -10301,21 +9517,80 @@ index 84505bf..2b5bef2 100644 CLog::Log(LOGINFO, "%s::%s = %d", CLASSNAME, __func__, ret); #endif -From 312dad9044e873653c0755b515a32d2f4040aca6 Mon Sep 17 00:00:00 2001 +From de94bc24368fa9a412bff2024804ebe0ac9ec3c3 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 11 Nov 2014 20:49:30 +0000 -Subject: [PATCH 88/88] [dvdplayer] New scheme for PLL adjustment for video +Subject: [PATCH 81/97] [dvdplayer] New scheme for PLL adjustment for video clock --- - xbmc/cores/dvdplayer/DVDPlayerAudio.cpp | 30 +++++++++++------------------- - 1 file changed, 11 insertions(+), 19 deletions(-) + xbmc/cores/dvdplayer/DVDPlayerAudio.cpp | 50 ++++++++++++++++++--------------- + xbmc/cores/dvdplayer/DVDPlayerAudio.h | 2 ++ + 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -index 5e9a6d3..6ec3439 100644 +index 5e9a6d3..34207b2 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -@@ -708,26 +708,18 @@ void CDVDPlayerAudio::HandleSyncError(double duration) +@@ -113,7 +113,9 @@ CDVDPlayerAudio::CDVDPlayerAudio(CDVDClock* pClock, CDVDMessageQueue& parent) + m_started = false; + m_silence = false; + m_resampleratio = 1.0; +- m_plladjust = 1.0f; ++ m_plladjust = 1.0; ++ m_last_plladjust = 1.0; ++ m_last_error = 0.0; + m_synctype = SYNC_DISCON; + m_setsynctype = SYNC_DISCON; + m_prevsynctype = -1; +@@ -192,6 +194,10 @@ void CDVDPlayerAudio::OpenStream( CDVDStreamInfo &hints, CDVDAudioCodec* codec ) + + m_error = 0; + m_errors.Flush(); ++ m_plladjust = 1.0; ++#if defined(TARGET_RASPBERRY_PI) ++ m_last_plladjust = g_RBP.AdjustHDMIClock(m_plladjust); ++#endif + m_integral = 0; + m_prevskipped = false; + m_syncclock = true; +@@ -234,7 +240,9 @@ void CDVDPlayerAudio::CloseStream(bool bWaitForBuffers) + + // uninit queue + m_messageQueue.End(); +- ++#if defined(TARGET_RASPBERRY_PI) ++ g_RBP.AdjustHDMIClock(1.0); ++#endif + CLog::Log(LOGNOTICE, "Deleting audio codec"); + if (m_pAudioCodec) + { +@@ -475,9 +483,9 @@ void CDVDPlayerAudio::UpdatePlayerInfo() + //print the inverse of the resample ratio, since that makes more sense + //if the resample ratio is 0.5, then we're playing twice as fast + if (m_synctype == SYNC_RESAMPLE) +- s << ", rr:" << fixed << setprecision(5) << 1.0 / m_resampleratio; ++ s << ", rr:" << fixed << setprecision(5) << 1.0 / m_resampleratio << ", err:" << fixed << setprecision(1) << m_last_error * 1e-3 << "ms"; + if (m_synctype == SYNC_PLLADJUST) +- s << ", pll:" << fixed << setprecision(5) << 1.0 / m_plladjust; ++ s << ", pll:" << fixed << setprecision(5) << m_last_plladjust << ", err:" << fixed << setprecision(1) << m_last_error * 1e-3 << "ms"; + + s << ", att:" << fixed << setprecision(1) << log(GetCurrentAttenuation()) * 20.0f << " dB"; + +@@ -651,6 +659,7 @@ void CDVDPlayerAudio::HandleSyncError(double duration) + m_pClock->Update(clock+error, absolute, 0.0, "CDVDPlayerAudio::HandleSyncError1"); + m_errors.Flush(); + m_error = 0; ++ m_plladjust = 1.0; + m_syncclock = false; + + return; +@@ -704,30 +713,27 @@ void CDVDPlayerAudio::HandleSyncError(double duration) + proportional = m_error / DVD_TIME_BASE / proportionaldiv; + } + m_resampleratio = 1.0 / m_pClock->GetClockSpeed() + proportional + m_integral; ++ m_last_error = m_error; + } else if (m_synctype == SYNC_PLLADJUST) { #if defined(TARGET_RASPBERRY_PI) @@ -10329,27 +9604,1621 @@ index 5e9a6d3..6ec3439 100644 - - //on big errors use more proportional - if (fabs(m_error / DVD_TIME_BASE) > 0.0) -- { ++ // PID control loop to reduce error through pll adjustment ++ double dt = 2.0; ++ double Kp = 1*1e-4; ++ double Ki = 1*1e-5; ++ double Kd = 1*1e-2; ++ m_integral += m_error*1e-6*dt; ++ double derivative = (m_error - m_last_error) * 1e-6 / dt; ++ double output = Kp * m_error * 1e-6 + Ki * m_integral + Kd * derivative; ++ m_plladjust = 1.0f + output; ++ // skip updating pll if difference is unexpectedly high - probably a glitch after seek/pause/loss ++ if (m_error - m_last_error < DVD_MSEC_TO_TIME(2)) + { - double proportionaldiv = PROPORTIONAL * (PROPREF / fabs(m_error / DVD_TIME_BASE)); - if (proportionaldiv < PROPDIVMIN) proportionaldiv = PROPDIVMIN; - else if (proportionaldiv > PROPDIVMAX) proportionaldiv = PROPDIVMAX; - - proportional = m_error / DVD_TIME_BASE / proportionaldiv; -- } ++ m_last_plladjust = g_RBP.AdjustHDMIClock(m_plladjust); ++ CLog::Log(LOGDEBUG, "CDVDPlayerAudio::%s pll:%.5f (%.5f) error:%.3fms prop:%.6f int:%.6f der:%.6f", __FUNCTION__, m_plladjust, m_last_plladjust, m_error * 1e-3, Kp * m_error * 1e-6, Ki * m_integral, Kd * derivative); + } - m_plladjust = 1.0 / m_pClock->GetClockSpeed() + proportional + m_integral; -+ if (m_error < -DVD_MSEC_TO_TIME(50)) -+ m_plladjust = 1.0/1.001; -+ else if (m_error < -DVD_MSEC_TO_TIME(10)) -+ m_plladjust = 1.0/1.0001; -+ else if (m_error > DVD_MSEC_TO_TIME(50)) -+ m_plladjust = 1.001; -+ else if (m_error > DVD_MSEC_TO_TIME(10)) -+ m_plladjust = 1.0001; -+ else -+ m_plladjust = 1.000; - double new_adjust = g_RBP.AdjustHDMIClock(m_plladjust); +- double new_adjust = g_RBP.AdjustHDMIClock(m_plladjust); - CLog::Log(LOGDEBUG, "CDVDPlayerAudio::%s pll:%.4f (%.4f) proportional:%.4f integral:%.4f", __FUNCTION__, m_plladjust, new_adjust, proportional, m_integral); -+ CLog::Log(LOGDEBUG, "CDVDPlayerAudio::%s pll:%.4f (%.4f) error:%.6f", __FUNCTION__, m_plladjust, new_adjust, m_error); ++ m_last_error = m_error; #endif } } +diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.h b/xbmc/cores/dvdplayer/DVDPlayerAudio.h +index 02c64a0..37bf4bd 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayerAudio.h ++++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.h +@@ -233,6 +233,8 @@ class CDVDPlayerAudio : public CThread, public IDVDStreamPlayerAudio + double m_maxspeedadjust; + double m_resampleratio; //resample ratio when using SYNC_RESAMPLE, used for the codec info + double m_plladjust; // for display using SYNC_PLLADJUST ++ double m_last_error; // for display using SYNC_PLLADJUST ++ double m_last_plladjust; // for display using SYNC_PLLADJUST + + struct SInfo + { + +From d0aec4e57e29c65233b7fd1f85c5046879e698a3 Mon Sep 17 00:00:00 2001 +From: wsnipex +Date: Sat, 8 Nov 2014 10:36:20 +0100 +Subject: [PATCH 82/97] add canseek and drop unused rtmp options + +--- + .../DVDInputStreams/DVDInputStreamRTMP.cpp | 47 +++++++++------------- + .../dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h | 8 +++- + 2 files changed, 25 insertions(+), 30 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp +index 62ddd3d..324eadb 100644 +--- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp ++++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp +@@ -63,7 +63,10 @@ extern "C" + } + } + +-CDVDInputStreamRTMP::CDVDInputStreamRTMP() : CDVDInputStream(DVDSTREAM_TYPE_RTMP) ++CDVDInputStreamRTMP::CDVDInputStreamRTMP() ++ : CDVDInputStream(DVDSTREAM_TYPE_RTMP) ++ , m_canSeek(true) ++ , m_canPause(true) + { + if (m_libRTMP.Load()) + { +@@ -119,19 +122,6 @@ bool CDVDInputStreamRTMP::IsEOF() + #undef AVC + #define AVC(str) {(char *)str,sizeof(str)-1} + +-/* librtmp option names are slightly different */ +-static const struct { +- const char *name; +- AVal key; +-} options[] = { +- { "SWFPlayer", AVC("swfUrl") }, +- { "PageURL", AVC("pageUrl") }, +- { "PlayPath", AVC("playpath") }, +- { "TcUrl", AVC("tcUrl") }, +- { "IsLive", AVC("live") }, +- { NULL } +-}; +- + bool CDVDInputStreamRTMP::Open(const char* strFile, const std::string& content) + { + if (m_sStreamPlaying) +@@ -152,21 +142,23 @@ bool CDVDInputStreamRTMP::Open(const char* strFile, const std::string& content) + if (!m_libRTMP.SetupURL(m_rtmp, m_sStreamPlaying)) + return false; + +- // SetOpt and SetAVal copy pointers to the value. librtmp doesn't use the values until the Connect() call, +- // so value objects must stay allocated until then. To be extra safe, keep the values around until Close(), +- // in case librtmp needs them again. +- m_optionvalues.clear(); +- for (int i=0; options[i].name; i++) ++ /* Look for protocol options in the URL. ++ * Options are added to the URL in space separated key=value pairs. ++ * We are only interested in the "live" option to disable seeking, ++ * the rest is handled by librtmp internally ++ * ++ * example URL suitable for use with RTMP_SetupURL(): ++ * "rtmp://flashserver:1935/ondemand/thefile swfUrl=http://flashserver/player.swf swfVfy=1 live=1" ++ * details: https://rtmpdump.mplayerhq.hu/librtmp.3.html ++ */ ++ std::string url = strFile; ++ size_t iPosBlank = url.find(' '); ++ if (iPosBlank != string::npos && (url.find("live=true") != string::npos || url.find("live=1") != string::npos)) + { +- std::string tmp = m_item.GetProperty(options[i].name).asString(); +- if (!tmp.empty()) +- { +- m_optionvalues.push_back(tmp); +- AVal av_tmp; +- SetAVal(av_tmp, m_optionvalues.back()); +- m_libRTMP.SetOpt(m_rtmp, &options[i].key, &av_tmp); +- } ++ m_canSeek = false; ++ m_canPause = false; + } ++ CLog::Log(LOGDEBUG, "RTMP canseek: %s", m_canSeek ? "true" : "false"); + + if (!m_libRTMP.Connect(m_rtmp, NULL) || !m_libRTMP.ConnectStream(m_rtmp, 0)) + return false; +@@ -185,7 +177,6 @@ void CDVDInputStreamRTMP::Close() + if (m_rtmp) + m_libRTMP.Close(m_rtmp); + +- m_optionvalues.clear(); + m_eof = true; + m_bPaused = false; + } +diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h +index b013f33..5568c14 100644 +--- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h ++++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h +@@ -27,6 +27,7 @@ + class CDVDInputStreamRTMP + : public CDVDInputStream + , public CDVDInputStream::ISeekTime ++ , public CDVDInputStream::ISeekable + { + public: + CDVDInputStreamRTMP(); +@@ -36,7 +37,9 @@ class CDVDInputStreamRTMP + virtual int Read(uint8_t* buf, int buf_size); + virtual int64_t Seek(int64_t offset, int whence); + bool SeekTime(int iTimeInMsec); +- virtual bool Pause(double dTime); ++ bool CanSeek() { return m_canSeek; } ++ bool CanPause() { return m_canPause; } ++ virtual bool Pause(double dTime); + virtual bool IsEOF(); + virtual int64_t GetLength(); + +@@ -45,8 +48,9 @@ class CDVDInputStreamRTMP + protected: + bool m_eof; + bool m_bPaused; ++ bool m_canSeek; ++ bool m_canPause; + char* m_sStreamPlaying; +- std::vector m_optionvalues; + + RTMP *m_rtmp; + DllLibRTMP m_libRTMP; + + +From 2ec242be97b36d14e1c4f93764656ce8158b2089 Mon Sep 17 00:00:00 2001 +From: Thomas Amland +Date: Wed, 12 Nov 2014 13:20:55 +0100 +Subject: [PATCH 85/97] do database clean on thread + +--- + xbmc/Application.cpp | 6 ++---- + xbmc/video/VideoInfoScanner.cpp | 20 +++++++++++++++++++- + xbmc/video/VideoInfoScanner.h | 3 ++- + 3 files changed, 23 insertions(+), 6 deletions(-) + +diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp +index 009d425..4bba14d 100644 +--- a/xbmc/Application.cpp ++++ b/xbmc/Application.cpp +@@ -5646,17 +5646,15 @@ void CApplication::StartVideoCleanup(bool userInitiated /* = true */) + { + if (m_videoInfoScanner->IsScanning()) + return; +- +- m_videoInfoScanner->CleanDatabase(NULL, NULL, userInitiated); ++ m_videoInfoScanner->ShowDialog(userInitiated); ++ m_videoInfoScanner->StartLibraryClean(); + } + + void CApplication::StartVideoScan(const CStdString &strDirectory, bool userInitiated /* = true */, bool scanAll /* = false */) + { + if (m_videoInfoScanner->IsScanning()) + return; +- + m_videoInfoScanner->ShowDialog(userInitiated); +- + m_videoInfoScanner->Start(strDirectory,scanAll); + } + +diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp +index 0d0ad66..cce627a 100644 +--- a/xbmc/video/VideoInfoScanner.cpp ++++ b/xbmc/video/VideoInfoScanner.cpp +@@ -76,10 +76,19 @@ namespace VIDEO + + void CVideoInfoScanner::Process() + { ++ if (m_bClean) ++ { ++ //Only clean, no scanning. ++ CleanDatabase(NULL, NULL, m_showDialog); ++ return; ++ } ++ + try + { + unsigned int tick = XbmcThreads::SystemClockMillis(); + ++ m_bClean = g_advancedSettings.m_bVideoLibraryCleanOnUpdate; ++ + m_database.Open(); + + if (m_showDialog && !CSettings::Get().GetBool("videolibrary.backgroundupdate")) +@@ -186,9 +195,18 @@ namespace VIDEO + m_pathsToScan.insert(it->second); + } + m_database.Close(); +- m_bClean = g_advancedSettings.m_bVideoLibraryCleanOnUpdate; ++ StopThread(); ++ m_bClean = false; ++ Create(); ++ m_bRunning = true; ++ } + ++ void CVideoInfoScanner::StartLibraryClean() ++ { ++ m_pathsToScan.clear(); ++ m_pathsToClean.clear(); + StopThread(); ++ m_bClean = true; + Create(); + m_bRunning = true; + } +diff --git a/xbmc/video/VideoInfoScanner.h b/xbmc/video/VideoInfoScanner.h +index 47d5ed4..68b90fa 100644 +--- a/xbmc/video/VideoInfoScanner.h ++++ b/xbmc/video/VideoInfoScanner.h +@@ -60,8 +60,8 @@ namespace VIDEO + */ + void Start(const CStdString& strDirectory, bool scanAll = false); + bool IsScanning(); +- void CleanDatabase(CGUIDialogProgressBarHandle* handle=NULL, const std::set* paths=NULL, bool showProgress=true); + void Stop(); ++ void StartLibraryClean(); + + //! \brief Set whether or not to show a progress dialog + void ShowDialog(bool show) { m_showDialog = show; } +@@ -126,6 +126,7 @@ namespace VIDEO + virtual void Process(); + bool DoScan(const CStdString& strDirectory); + bool IsExcluded(const CStdString& strDirectory) const; ++ void CleanDatabase(CGUIDialogProgressBarHandle* handle=NULL, const std::set* paths=NULL, bool showProgress=true); + + INFO_RET RetrieveInfoForTvShow(CFileItem *pItem, bool bDirNames, ADDON::ScraperPtr &scraper, bool useLocal, CScraperUrl* pURL, bool fetchEpisodes, CGUIDialogProgress* pDlgProgress); + INFO_RET RetrieveInfoForMovie(CFileItem *pItem, bool bDirNames, ADDON::ScraperPtr &scraper, bool useLocal, CScraperUrl* pURL, CGUIDialogProgress* pDlgProgress); + +From df579e1bd8e53096065251d663ca184f05fef524 Mon Sep 17 00:00:00 2001 +From: Thomas Amland +Date: Wed, 12 Nov 2014 14:36:52 +0100 +Subject: [PATCH 86/97] use extended progress bar for library clean + +--- + xbmc/video/VideoDatabase.cpp | 50 +++++++---------------------------------- + xbmc/video/VideoDatabase.h | 2 +- + xbmc/video/VideoInfoScanner.cpp | 28 +++++++++++------------ + 3 files changed, 23 insertions(+), 57 deletions(-) + +diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp +index 9e54a34..4c41ab0 100644 +--- a/xbmc/video/VideoDatabase.cpp ++++ b/xbmc/video/VideoDatabase.cpp +@@ -7923,9 +7923,8 @@ void CVideoDatabase::GetMusicVideoDirectorsByName(const CStdString& strSearch, C + } + } + +-void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const set* paths, bool showProgress) ++void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const set* paths, bool silent) + { +- CGUIDialogProgress *progress=NULL; + try + { + if (NULL == m_pDB.get()) return; +@@ -7960,21 +7959,7 @@ void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const se + if (handle) + { + handle->SetTitle(g_localizeStrings.Get(700)); +- handle->SetText(""); +- } +- else if (showProgress) +- { +- progress = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); +- if (progress) +- { +- progress->SetHeading(700); +- progress->SetLine(0, ""); +- progress->SetLine(1, 313); +- progress->SetLine(2, 330); +- progress->SetPercentage(0); +- progress->StartModal(); +- progress->ShowProgressBar(true); +- } ++ handle->SetText(g_localizeStrings.Get(313)); + } + + std::string filesToTestForDelete; +@@ -8001,23 +7986,7 @@ void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const se + if (URIUtils::IsOnDVD(fullPath) || !CFile::Exists(fullPath, false)) + filesToTestForDelete += m_pDS->fv("files.idFile").get_asString() + ","; + +- if (handle == NULL && progress != NULL) +- { +- int percentage = current * 100 / total; +- if (percentage > progress->GetPercentage()) +- { +- progress->SetPercentage(percentage); +- progress->Progress(); +- } +- if (progress->IsCanceled()) +- { +- progress->Close(); +- m_pDS->close(); +- ANNOUNCEMENT::CAnnouncementManager::Get().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnCleanFinished"); +- return; +- } +- } +- else if (handle != NULL) ++ if (handle != NULL) + handle->SetPercentage(current * 100 / (float)total); + + m_pDS->next(); +@@ -8049,15 +8018,14 @@ void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const se + { + StringUtils::TrimRight(filesToTestForDelete, ","); + +- movieIDs = CleanMediaType(MediaTypeMovie, filesToTestForDelete, pathsDeleteDecisions, filesToDelete, !showProgress); +- episodeIDs = CleanMediaType(MediaTypeEpisode, filesToTestForDelete, pathsDeleteDecisions, filesToDelete, !showProgress); +- musicVideoIDs = CleanMediaType(MediaTypeMusicVideo, filesToTestForDelete, pathsDeleteDecisions, filesToDelete, !showProgress); ++ movieIDs = CleanMediaType(MediaTypeMovie, filesToTestForDelete, pathsDeleteDecisions, filesToDelete, silent); ++ episodeIDs = CleanMediaType(MediaTypeEpisode, filesToTestForDelete, pathsDeleteDecisions, filesToDelete, silent); ++ musicVideoIDs = CleanMediaType(MediaTypeMusicVideo, filesToTestForDelete, pathsDeleteDecisions, filesToDelete, silent); + } + +- if (progress != NULL) ++ if (handle != NULL) + { +- progress->SetPercentage(100); +- progress->Progress(); ++ handle->SetPercentage(100); + } + + if (!filesToDelete.empty()) +@@ -8274,8 +8242,6 @@ void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const se + CLog::Log(LOGERROR, "%s failed", __FUNCTION__); + RollbackTransaction(); + } +- if (progress) +- progress->Close(); + + ANNOUNCEMENT::CAnnouncementManager::Get().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnCleanFinished"); + } +diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h +index 1a79c00..352a2e8 100644 +--- a/xbmc/video/VideoDatabase.h ++++ b/xbmc/video/VideoDatabase.h +@@ -658,7 +658,7 @@ class CVideoDatabase : public CDatabase + bool HasContent(VIDEODB_CONTENT_TYPE type); + bool HasSets() const; + +- void CleanDatabase(CGUIDialogProgressBarHandle* handle=NULL, const std::set* paths=NULL, bool showProgress=true); ++ void CleanDatabase(CGUIDialogProgressBarHandle* handle=NULL, const std::set* paths=NULL, bool silent=false); + + /*! \brief Add a file to the database, if necessary + If the file is already in the database, we simply return its id. +diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp +index cce627a..9e42a8f 100644 +--- a/xbmc/video/VideoInfoScanner.cpp ++++ b/xbmc/video/VideoInfoScanner.cpp +@@ -76,30 +76,30 @@ namespace VIDEO + + void CVideoInfoScanner::Process() + { ++ if (m_showDialog && !CSettings::Get().GetBool("videolibrary.backgroundupdate")) ++ { ++ CGUIDialogExtendedProgressBar* dialog = ++ (CGUIDialogExtendedProgressBar*)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS); ++ if (dialog) ++ m_handle = dialog->GetHandle(g_localizeStrings.Get(314)); ++ } ++ + if (m_bClean) + { + //Only clean, no scanning. +- CleanDatabase(NULL, NULL, m_showDialog); ++ CleanDatabase(m_handle, NULL, m_showDialog); ++ if (m_handle) ++ m_handle->MarkFinished(); ++ m_handle = NULL; + return; + } + + try + { + unsigned int tick = XbmcThreads::SystemClockMillis(); +- + m_bClean = g_advancedSettings.m_bVideoLibraryCleanOnUpdate; +- +- m_database.Open(); +- +- if (m_showDialog && !CSettings::Get().GetBool("videolibrary.backgroundupdate")) +- { +- CGUIDialogExtendedProgressBar* dialog = +- (CGUIDialogExtendedProgressBar*)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS); +- if (dialog) +- m_handle = dialog->GetHandle(g_localizeStrings.Get(314)); +- } +- + m_bCanInterrupt = true; ++ m_database.Open(); + + CLog::Log(LOGNOTICE, "VideoInfoScanner: Starting scan .."); + ANNOUNCEMENT::CAnnouncementManager::Get().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnScanStarted"); +@@ -228,7 +228,7 @@ namespace VIDEO + { + m_bRunning = true; + m_database.Open(); +- m_database.CleanDatabase(handle, paths, showProgress); ++ m_database.CleanDatabase(handle, paths, !showProgress); + m_database.Close(); + m_bRunning = false; + } + +From 4511bce45ef0adaf304acc7027f3951265063370 Mon Sep 17 00:00:00 2001 +From: fritsch +Date: Tue, 11 Nov 2014 21:34:44 +0100 +Subject: [PATCH 87/97] VAAPI: Use Component Logging + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 55 ++++++++++++++++---------- + 1 file changed, 35 insertions(+), 20 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp +index 0d6477a..709d808 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp +@@ -30,6 +30,7 @@ + #include "settings/Settings.h" + #include "guilib/GraphicContext.h" + #include "settings/MediaSettings.h" ++#include "settings/AdvancedSettings.h" + #include + + extern "C" { +@@ -142,7 +143,8 @@ bool CVAAPIContext::CreateContext() + return false; + } + +- CLog::Log(LOGDEBUG, "VAAPI - initialize version %d.%d", major_version, minor_version); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "VAAPI - initialize version %d.%d", major_version, minor_version); + + + QueryCaps(); +@@ -174,13 +176,16 @@ void CVAAPIContext::QueryCaps() + for(int i = 0; i < m_attributeCount; i++) + { + VADisplayAttribute * const display_attr = &m_attributes[i]; +- CLog::Log(LOGDEBUG, "VAAPI - attrib %d (%s/%s) min %d max %d value 0x%x\n" +- , display_attr->type +- ,(display_attr->flags & VA_DISPLAY_ATTRIB_GETTABLE) ? "get" : "---" +- ,(display_attr->flags & VA_DISPLAY_ATTRIB_SETTABLE) ? "set" : "---" +- , display_attr->min_value +- , display_attr->max_value +- , display_attr->value); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ { ++ CLog::Log(LOGDEBUG, "VAAPI - attrib %d (%s/%s) min %d max %d value 0x%x\n" ++ , display_attr->type ++ ,(display_attr->flags & VA_DISPLAY_ATTRIB_GETTABLE) ? "get" : "---" ++ ,(display_attr->flags & VA_DISPLAY_ATTRIB_SETTABLE) ? "set" : "---" ++ , display_attr->min_value ++ , display_attr->max_value ++ , display_attr->value); ++ } + } + + int max_profiles = vaMaxNumProfiles(m_display); +@@ -190,7 +195,10 @@ void CVAAPIContext::QueryCaps() + return; + + for(int i = 0; i < m_profileCount; i++) +- CLog::Log(LOGDEBUG, "VAAPI - profile %d", m_profiles[i]); ++ { ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "VAAPI - profile %d", m_profiles[i]); ++ } + } + + VAConfigAttrib CVAAPIContext::GetAttrib(VAProfile profile) +@@ -482,7 +490,8 @@ bool CDecoder::Open(AVCodecContext* avctx, const enum PixelFormat fmt, unsigned + if (CDVDVideoCodec::IsCodecDisabled(g_vaapi_available, settings_count, avctx->codec_id)) + return false; + +- CLog::Log(LOGDEBUG,"VAAPI - open decoder"); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG,"VAAPI - open decoder"); + + if (!CVAAPIContext::EnsureContext(&m_vaapiConfig.context, this)) + return false; +@@ -616,7 +625,8 @@ long CDecoder::Release() + if (m_vaapiConfigured == true) + { + CSingleLock lock(m_DecoderSection); +- CLog::Log(LOGDEBUG,"VAAPI::Release pre-cleanup"); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG,"VAAPI::Release pre-cleanup"); + + Message *reply; + if (m_vaapiOutput.m_controlPort.SendOutMessageSync(COutputControlProtocol::PRECLEANUP, +@@ -832,7 +842,8 @@ int CDecoder::Check(AVCodecContext* avctx) + + if (state == VAAPI_LOST) + { +- CLog::Log(LOGDEBUG,"VAAPI::Check waiting for display reset event"); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG,"VAAPI::Check waiting for display reset event"); + if (!m_DisplayEvent.WaitMSec(4000)) + { + CLog::Log(LOGERROR, "VAAPI::Check - device didn't reset in reasonable time"); +@@ -1069,7 +1080,8 @@ void CDecoder::FiniVAAPIOutput() + m_vaapiConfig.contextId = VA_INVALID_ID; + + // detroy surfaces +- CLog::Log(LOGDEBUG, "VAAPI::FiniVAAPIOutput destroying %d video surfaces", m_videoSurfaces.Size()); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "VAAPI::FiniVAAPIOutput destroying %d video surfaces", m_videoSurfaces.Size()); + VASurfaceID surf; + while((surf = m_videoSurfaces.RemoveNext()) != VA_INVALID_SURFACE) + { +@@ -1824,7 +1836,8 @@ void COutput::InitCycle() + } + else + { +- CLog::Log(LOGDEBUG,"VAAPI - deinterlace method not supported, falling back to BOB"); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG,"VAAPI - deinterlace method not supported, falling back to BOB"); + method = VS_INTERLACEMETHOD_RENDER_BOB; + } + +@@ -2070,7 +2083,8 @@ bool COutput::ProcessSyncPicture() + } + else + { +- CLog::Log(LOGDEBUG, "COutput::%s - return of invalid render pic", __FUNCTION__); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "COutput::%s - return of invalid render pic", __FUNCTION__); + } + } + return busy; +@@ -2174,8 +2188,8 @@ bool COutput::EnsureBufferPool() + } + + m_bufferPool.procPicId = 0; +- +- CLog::Log(LOGDEBUG, "VAAPI::COutput::InitBufferPool - Surfaces created"); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "VAAPI::COutput::InitBufferPool - Surfaces created"); + return true; + } + +@@ -2339,8 +2353,8 @@ bool COutput::CreateGlxContext() + CLog::Log(LOGERROR, "VAAPI::COutput::CreateGlxContext - Could not make Pixmap current"); + return false; + } +- +- CLog::Log(LOGDEBUG, "VAAPI::COutput::CreateGlxContext - created context"); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "VAAPI::COutput::CreateGlxContext - created context"); + return true; + } + +@@ -3036,7 +3050,8 @@ bool CFFmpegPostproc::Init(EINTERLACEMETHOD method) + else if (method == VS_INTERLACEMETHOD_RENDER_BOB || + method == VS_INTERLACEMETHOD_NONE) + { +- CLog::Log(LOGDEBUG, "CFFmpegPostproc::Init - skip deinterlacing"); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "CFFmpegPostproc::Init - skip deinterlacing"); + avfilter_inout_free(&outputs); + avfilter_inout_free(&inputs); + } + +From 492e1820ab6da9d15323336f7928f068b32fc3ea Mon Sep 17 00:00:00 2001 +From: fritsch +Date: Tue, 11 Nov 2014 21:37:16 +0100 +Subject: [PATCH 88/97] VDPAU: Component Logging + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 35 ++++++++++++++++++-------- + 1 file changed, 25 insertions(+), 10 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp +index e5e7970..391fab1 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp +@@ -667,7 +667,8 @@ void CDecoder::SetWidthHeight(int width, int height) + m_vdpauConfig.outWidth = width; + m_vdpauConfig.outHeight = height; + } +- CLog::Log(LOGDEBUG, "CVDPAU::SetWidthHeight Setting OutWidth: %i OutHeight: %i", m_vdpauConfig.outWidth, m_vdpauConfig.outHeight); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "CVDPAU::SetWidthHeight Setting OutWidth: %i OutHeight: %i", m_vdpauConfig.outWidth, m_vdpauConfig.outHeight); + } + + void CDecoder::OnLostDevice() +@@ -807,7 +808,8 @@ void CDecoder::FiniVDPAUOutput() + return; + m_vdpauConfig.vdpDecoder = VDP_INVALID_HANDLE; + +- CLog::Log(LOGDEBUG, "CVDPAU::FiniVDPAUOutput destroying %d video surfaces", m_videoSurfaces.Size()); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "CVDPAU::FiniVDPAUOutput destroying %d video surfaces", m_videoSurfaces.Size()); + + VdpVideoSurface surf; + while((surf = m_videoSurfaces.RemoveNext()) != VDP_INVALID_HANDLE) +@@ -1047,7 +1049,10 @@ int CDecoder::Render(struct AVCodecContext *s, struct AVFrame *src, + + uint64_t diff = CurrentHostCounter() - startTime; + if (diff*1000/CurrentHostFrequency() > 30) +- CLog::Log(LOGDEBUG, "CVDPAU::DrawSlice - VdpDecoderRender long decoding: %d ms, dec: %d, proc: %d, rend: %d", (int)((diff*1000)/CurrentHostFrequency()), decoded, processed, rend); ++ { ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "CVDPAU::DrawSlice - VdpDecoderRender long decoding: %d ms, dec: %d, proc: %d, rend: %d", (int)((diff*1000)/CurrentHostFrequency()), decoded, processed, rend); ++ } + + return 0; + } +@@ -1162,7 +1167,10 @@ int CDecoder::Decode(AVCodecContext *avctx, AVFrame *pFrame) + m_bufferStats.SetParams(diff, m_codecControl); + } + if (diff*1000/CurrentHostFrequency() > 50) +- CLog::Log(LOGDEBUG,"CVDPAU::Decode long wait: %d", (int)((diff*1000)/CurrentHostFrequency())); ++ { ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG,"CVDPAU::Decode long wait: %d", (int)((diff*1000)/CurrentHostFrequency())); ++ } + + if (!retval) + { +@@ -3000,7 +3008,9 @@ void COutput::Flush() + it2 = m_bufferPool.glVideoSurfaceMap.find(pic->sourceIdx); + if (it2 == m_bufferPool.glVideoSurfaceMap.end()) + { +- CLog::Log(LOGDEBUG, "COutput::Flush - gl surface not found"); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "COutput::Flush - gl surface not found"); ++ + continue; + } + m_config.videoSurfaces->MarkRender(it2->second.sourceVuv); +@@ -3161,7 +3171,8 @@ bool COutput::ProcessSyncPicture() + } + else + { +- CLog::Log(LOGDEBUG, "COutput::%s - return of invalid render pic", __FUNCTION__); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "COutput::%s - return of invalid render pic", __FUNCTION__); + } + } + return busy; +@@ -3175,7 +3186,9 @@ void COutput::ProcessReturnPicture(CVdpauRenderPicture *pic) + it = m_bufferPool.glVideoSurfaceMap.find(pic->sourceIdx); + if (it == m_bufferPool.glVideoSurfaceMap.end()) + { +- CLog::Log(LOGDEBUG, "COutput::ProcessReturnPicture - gl surface not found"); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "COutput::ProcessReturnPicture - gl surface not found"); ++ + return; + } + #ifdef GL_NV_vdpau_interop +@@ -3190,7 +3203,9 @@ void COutput::ProcessReturnPicture(CVdpauRenderPicture *pic) + it = m_bufferPool.glOutputSurfaceMap.find(pic->sourceIdx); + if (it == m_bufferPool.glOutputSurfaceMap.end()) + { +- CLog::Log(LOGDEBUG, "COutput::ProcessReturnPicture - gl surface not found"); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "COutput::ProcessReturnPicture - gl surface not found"); ++ + return; + } + #ifdef GL_NV_vdpau_interop +@@ -3330,8 +3345,8 @@ void COutput::PreCleanup() + CheckStatus(vdp_st, __LINE__); + + m_bufferPool.outputSurfaces[i] = VDP_INVALID_HANDLE; +- +- CLog::Log(LOGDEBUG, "VDPAU::PreCleanup - released output surface"); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "VDPAU::PreCleanup - released output surface"); + } + + } + +From 33a720fa45a6eeb286787a532418f559c98139eb Mon Sep 17 00:00:00 2001 +From: fritsch +Date: Tue, 11 Nov 2014 21:49:45 +0100 +Subject: [PATCH 89/97] IMX: Use Component Logging + +--- + .../dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 64 ++++++++++++++-------- + 1 file changed, 41 insertions(+), 23 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp +index adbb27e..e8ccc67 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp +@@ -29,6 +29,7 @@ + #include "threads/SingleLock.h" + #include "utils/log.h" + #include "DVDClock.h" ++#include "settings/AdvancedSettings.h" + #include "threads/Atomics.h" + + #define FRAME_ALIGN 16 +@@ -171,7 +172,8 @@ bool CDVDVideoCodecIMX::VpuOpen(void) + } + else + { +- CLog::Log(LOGDEBUG, "VPU Lib version : major.minor.rel=%d.%d.%d.\n", vpuVersion.nLibMajor, vpuVersion.nLibMinor, vpuVersion.nLibRelease); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "VPU Lib version : major.minor.rel=%d.%d.%d.\n", vpuVersion.nLibMajor, vpuVersion.nLibMinor, vpuVersion.nLibRelease); + } + + ret = VPU_DecQueryMem(&memInfo); +@@ -363,19 +365,23 @@ bool CDVDVideoCodecIMX::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + } + + m_hints = hints; +- CLog::Log(LOGDEBUG, "Let's decode with iMX VPU\n"); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "Let's decode with iMX VPU\n"); + + #ifdef MEDIAINFO +- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: fpsrate %d / fpsscale %d\n", m_hints.fpsrate, m_hints.fpsscale); +- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: CodecID %d \n", m_hints.codec); +- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: StreamType %d \n", m_hints.type); +- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Level %d \n", m_hints.level); +- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Profile %d \n", m_hints.profile); +- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: PTS_invalid %d \n", m_hints.ptsinvalid); +- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Tag %d \n", m_hints.codec_tag); +- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %dx%d \n", m_hints.width, m_hints.height); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ { ++ CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: fpsrate %d / fpsscale %d\n", m_hints.fpsrate, m_hints.fpsscale); ++ CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: CodecID %d \n", m_hints.codec); ++ CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: StreamType %d \n", m_hints.type); ++ CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Level %d \n", m_hints.level); ++ CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Profile %d \n", m_hints.profile); ++ CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: PTS_invalid %d \n", m_hints.ptsinvalid); ++ CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Tag %d \n", m_hints.codec_tag); ++ CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %dx%d \n", m_hints.width, m_hints.height); ++ } + { uint8_t *pb = (uint8_t*)&m_hints.codec_tag; +- if (isalnum(pb[0]) && isalnum(pb[1]) && isalnum(pb[2]) && isalnum(pb[3])) ++ if ((isalnum(pb[0]) && isalnum(pb[1]) && isalnum(pb[2]) && isalnum(pb[3])) && g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Tag fourcc %c%c%c%c\n", pb[0], pb[1], pb[2], pb[3]); + } + if (m_hints.extrasize) +@@ -384,10 +390,15 @@ bool CDVDVideoCodecIMX::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + + for (unsigned int i=0; i < m_hints.extrasize; i++) + sprintf(buf+i*2, "%02x", ((uint8_t*)m_hints.extradata)[i]); +- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: extradata %d %s\n", m_hints.extrasize, buf); ++ ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: extradata %d %s\n", m_hints.extrasize, buf); ++ } ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ { ++ CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %d / %d \n", m_hints.width, m_hints.height); ++ CLog::Log(LOGDEBUG, "Decode: aspect %f - forced aspect %d\n", m_hints.aspect, m_hints.forced_aspect); + } +- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %d / %d \n", m_hints.width, m_hints.height); +- CLog::Log(LOGDEBUG, "Decode: aspect %f - forced aspect %d\n", m_hints.aspect, m_hints.forced_aspect); + #endif + + m_convert_bitstream = false; +@@ -647,11 +658,14 @@ int CDVDVideoCodecIMX::Decode(BYTE *pData, int iSize, double dts, double pts) + ret = VPU_DecGetInitialInfo(m_vpuHandle, &m_initInfo); + if (ret == VPU_DEC_RET_SUCCESS) + { +- CLog::Log(LOGDEBUG, "%s - VPU Init Stream Info : %dx%d (interlaced : %d - Minframe : %d)"\ +- " - Align : %d bytes - crop : %d %d %d %d - Q16Ratio : %x\n", __FUNCTION__, +- m_initInfo.nPicWidth, m_initInfo.nPicHeight, m_initInfo.nInterlace, m_initInfo.nMinFrameBufferCount, +- m_initInfo.nAddressAlignment, m_initInfo.PicCropRect.nLeft, m_initInfo.PicCropRect.nTop, +- m_initInfo.PicCropRect.nRight, m_initInfo.PicCropRect.nBottom, m_initInfo.nQ16ShiftWidthDivHeightRatio); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ { ++ CLog::Log(LOGDEBUG, "%s - VPU Init Stream Info : %dx%d (interlaced : %d - Minframe : %d)"\ ++ " - Align : %d bytes - crop : %d %d %d %d - Q16Ratio : %x\n", __FUNCTION__, ++ m_initInfo.nPicWidth, m_initInfo.nPicHeight, m_initInfo.nInterlace, m_initInfo.nMinFrameBufferCount, ++ m_initInfo.nAddressAlignment, m_initInfo.PicCropRect.nLeft, m_initInfo.PicCropRect.nTop, ++ m_initInfo.PicCropRect.nRight, m_initInfo.PicCropRect.nBottom, m_initInfo.nQ16ShiftWidthDivHeightRatio); ++ } + if (VpuAllocFrameBuffers()) + { + ret = VPU_DecRegisterFrameBuffer(m_vpuHandle, m_vpuFrameBuffers, m_vpuFrameBufferNum); +@@ -744,11 +758,13 @@ int CDVDVideoCodecIMX::Decode(BYTE *pData, int iSize, double dts, double pts) + + if (decRet & VPU_DEC_OUTPUT_REPEAT) + { +- CLog::Log(LOGDEBUG, "%s - Frame repeat.\n", __FUNCTION__); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s - Frame repeat.\n", __FUNCTION__); + } + if (decRet & VPU_DEC_OUTPUT_DROPPED) + { +- CLog::Log(LOGDEBUG, "%s - Frame dropped.\n", __FUNCTION__); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s - Frame dropped.\n", __FUNCTION__); + } + if (decRet & VPU_DEC_NO_ENOUGH_BUF) + { +@@ -756,7 +772,8 @@ int CDVDVideoCodecIMX::Decode(BYTE *pData, int iSize, double dts, double pts) + } + if (decRet & VPU_DEC_SKIP) + { +- CLog::Log(LOGDEBUG, "%s - Frame skipped.\n", __FUNCTION__); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s - Frame skipped.\n", __FUNCTION__); + } + if (decRet & VPU_DEC_FLUSH) + { +@@ -823,7 +840,8 @@ void CDVDVideoCodecIMX::Reset() + { + int ret; + +- CLog::Log(LOGDEBUG, "%s - called\n", __FUNCTION__); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s - called\n", __FUNCTION__); + + // Release last buffer + if(m_lastBuffer) + +From 1027870d10afca43a8bc1f1b5d544af20282e206 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 12 Nov 2014 16:52:15 +0000 +Subject: [PATCH 90/97] MMAL: Use Component Logging + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 175 +++++++++------------ + 1 file changed, 78 insertions(+), 97 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index c9c3839..6742e0e 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -41,21 +41,17 @@ + #include "cores/VideoRenderers/RenderFlags.h" + #include "settings/DisplaySettings.h" + #include "cores/VideoRenderers/RenderManager.h" ++#include "settings/AdvancedSettings.h" + + #include "linux/RBP.h" + +-#ifdef _DEBUG +-#define MMAL_DEBUG_VERBOSE +-#endif +- + #define CLASSNAME "CMMALVideoBuffer" + + CMMALVideoBuffer::CMMALVideoBuffer(CMMALVideo *omv) + : m_omv(omv), m_refs(0) + { +-#if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); +-#endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); + mmal_buffer = NULL; + width = 0; + height = 0; +@@ -67,18 +63,16 @@ CMMALVideoBuffer::CMMALVideoBuffer(CMMALVideo *omv) + + CMMALVideoBuffer::~CMMALVideoBuffer() + { +-#if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); +-#endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); + } + + + CMMALVideoBuffer* CMMALVideoBuffer::Acquire() + { + long count = AtomicIncrement(&m_refs); +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s %p (%p) ref:%ld", CLASSNAME, __func__, this, mmal_buffer, count); +- #endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s %p (%p) ref:%ld", CLASSNAME, __func__, this, mmal_buffer, count); + (void)count; + return this; + } +@@ -86,9 +80,8 @@ CMMALVideoBuffer* CMMALVideoBuffer::Acquire() + long CMMALVideoBuffer::Release() + { + long count = AtomicDecrement(&m_refs); +-#if defined(MMAL_DEBUG_VERBOSE) +-CLog::Log(LOGDEBUG, "%s::%s %p (%p) ref:%ld", CLASSNAME, __func__, this, mmal_buffer, count); +-#endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s %p (%p) ref:%ld", CLASSNAME, __func__, this, mmal_buffer, count); + if (count == 0) + { + m_omv->ReleaseBuffer(this); +@@ -101,9 +94,8 @@ CLog::Log(LOGDEBUG, "%s::%s %p (%p) ref:%ld", CLASSNAME, __func__, this, mmal_bu + + CMMALVideo::CMMALVideo() + { +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); +- #endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); + pthread_mutex_init(&m_output_mutex, NULL); + + m_drop_state = false; +@@ -142,9 +134,8 @@ CMMALVideo::CMMALVideo() + + CMMALVideo::~CMMALVideo() + { +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); +- #endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); + assert(m_finished); + Reset(); + +@@ -205,7 +196,8 @@ void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *bu + m_aspect_ratio = (float)(m_es_format->es->video.par.num * m_es_format->es->video.crop.width) / (m_es_format->es->video.par.den * m_es_format->es->video.crop.height); + m_decoded_width = m_es_format->es->video.crop.width; + m_decoded_height = m_es_format->es->video.crop.height; +- 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); ++ 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); + } + 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); +@@ -222,7 +214,8 @@ void CMMALVideo::dec_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *bu + } + else if (buffer->cmd == MMAL_EVENT_FORMAT_CHANGED) + { +- CLog::Log(LOGDEBUG, "%s::%s format changed", CLASSNAME, __func__); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s format changed", CLASSNAME, __func__); + PortSettingsChanged(port, buffer); + } + else +@@ -240,19 +233,18 @@ static void dec_control_port_cb_static(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T * + + static void dec_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) + { +-#if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p, len %d cmd:%x", CLASSNAME, __func__, port, buffer, buffer->length, buffer->cmd); +-#endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p, len %d cmd:%x", CLASSNAME, __func__, port, buffer, buffer->length, buffer->cmd); + mmal_buffer_header_release(buffer); + } + + + void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) + { +-#if defined(MMAL_DEBUG_VERBOSE) + if (!(buffer->cmd == 0 && buffer->length > 0)) +- CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p, len %d cmd:%x", CLASSNAME, __func__, port, buffer, buffer->length, buffer->cmd); +-#endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p, len %d cmd:%x", CLASSNAME, __func__, port, buffer, buffer->length, buffer->cmd); ++ + bool kept = false; + + if (buffer->cmd == 0) +@@ -275,16 +267,16 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf + + if (m_drop_state) + { +- CLog::Log(LOGDEBUG, "%s::%s - dropping %p (drop:%d)", CLASSNAME, __func__, buffer, m_drop_state); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s - dropping %p (drop:%d)", CLASSNAME, __func__, buffer, m_drop_state); + } + else + { + CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); + m_output_busy++; +-#if defined(MMAL_DEBUG_VERBOSE) +- 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); +-#endif ++ 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); + omvb->mmal_buffer = buffer; + buffer->user_data = (void *)omvb; + omvb->m_changed_count = m_changed_count; +@@ -316,7 +308,8 @@ static void dec_output_port_cb_static(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *b + bool CMMALVideo::change_dec_output_format() + { + MMAL_STATUS_T status; +- CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); + + MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T interlace_type = {{ MMAL_PARAMETER_VIDEO_INTERLACE_TYPE, sizeof( interlace_type )}}; + status = mmal_port_parameter_get( m_dec_output, &interlace_type.hdr ); +@@ -325,7 +318,8 @@ bool CMMALVideo::change_dec_output_format() + { + if (m_interlace_mode != interlace_type.eMode) + { +- CLog::Log(LOGDEBUG, "%s::%s Interlace mode %d->%d", CLASSNAME, __func__, m_interlace_mode, interlace_type.eMode); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s Interlace mode %d->%d", CLASSNAME, __func__, m_interlace_mode, interlace_type.eMode); + m_interlace_mode = interlace_type.eMode; + } + } +@@ -347,7 +341,8 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) + { + MMAL_STATUS_T status; + +- CLog::Log(LOGDEBUG, "%s::%s method:%d", CLASSNAME, __func__, interlace_method); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s method:%d", CLASSNAME, __func__, interlace_method); + + assert(!m_deint); + assert(m_dec_output == m_dec->output[0]); +@@ -430,7 +425,8 @@ bool CMMALVideo::DestroyDeinterlace() + { + MMAL_STATUS_T status; + +- CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); + + assert(m_deint); + assert(m_dec_output == m_deint->output[0]); +@@ -498,9 +494,8 @@ bool CMMALVideo::SendCodecConfigData() + buffer->length = std::min(m_hints.extrasize, buffer->alloc_size); + memcpy(buffer->data, m_hints.extradata, buffer->length); + buffer->flags |= MMAL_BUFFER_HEADER_FLAG_FRAME_END | MMAL_BUFFER_HEADER_FLAG_CONFIG; +-#if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d flags:%x", CLASSNAME, __func__, buffer, buffer->length, buffer->flags); +-#endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d flags:%x", CLASSNAME, __func__, buffer, buffer->length, buffer->flags); + status = mmal_port_send_buffer(m_dec_input, buffer); + if (status != MMAL_SUCCESS) + { +@@ -512,9 +507,8 @@ bool CMMALVideo::SendCodecConfigData() + + bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVideoPtr myself) + { +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s usemmal:%d software:%d %dx%d", CLASSNAME, __func__, CSettings::Get().GetBool("videoplayer.usemmal"), hints.software, hints.width, hints.height); +- #endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s usemmal:%d software:%d %dx%d", CLASSNAME, __func__, CSettings::Get().GetBool("videoplayer.usemmal"), hints.software, hints.width, hints.height); + + // we always qualify even if DVDFactoryCodec does this too. + if (!CSettings::Get().GetBool("videoplayer.usemmal") || hints.software) +@@ -720,9 +714,8 @@ void CMMALVideo::Dispose() + done = true; + m_finished = true; + pthread_mutex_unlock(&m_output_mutex); +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s dts_queue(%d) ready_queue(%d) busy_queue(%d) done:%d", CLASSNAME, __func__, m_dts_queue.size(), m_output_ready.size(), m_output_busy, done); +- #endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s dts_queue(%d) ready_queue(%d) busy_queue(%d) done:%d", CLASSNAME, __func__, m_dts_queue.size(), m_output_ready.size(), m_output_busy, done); + if (done) + { + assert(m_dts_queue.empty()); +@@ -732,10 +725,9 @@ void CMMALVideo::Dispose() + + void CMMALVideo::SetDropState(bool bDrop) + { +-#if defined(MMAL_DEBUG_VERBOSE) + if (m_drop_state != bDrop) +- CLog::Log(LOGDEBUG, "%s::%s - m_drop_state(%d)", CLASSNAME, __func__, bDrop); +-#endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s - m_drop_state(%d)", CLASSNAME, __func__, bDrop); + m_drop_state = bDrop; + if (m_drop_state) + { +@@ -760,10 +752,9 @@ void CMMALVideo::SetDropState(bool bDrop) + + int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + { +- #if defined(MMAL_DEBUG_VERBOSE) +- //CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d dts:%.3f pts:%.3f dts_queue(%d) ready_queue(%d) busy_queue(%d)", +- // CLASSNAME, __func__, pData, iSize, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, m_dts_queue.size(), m_output_ready.size(), m_output_busy); +- #endif ++ //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ // CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d dts:%.3f pts:%.3f dts_queue(%d) ready_queue(%d) busy_queue(%d)", ++ // CLASSNAME, __func__, pData, iSize, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, m_dts_queue.size(), m_output_ready.size(), m_output_busy); + + unsigned int demuxer_bytes = 0; + uint8_t *demuxer_content = NULL; +@@ -849,10 +840,9 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + if (demuxer_bytes == 0) + buffer->flags |= MMAL_BUFFER_HEADER_FLAG_FRAME_END; + +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d/%-6d dts:%.3f pts:%.3f flags:%x dts_queue(%d) ready_queue(%d) busy_queue(%d) demux_queue(%d) space(%d)", +- CLASSNAME, __func__, buffer, buffer->length, demuxer_bytes, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, buffer->flags, m_dts_queue.size(), m_output_ready.size(), m_output_busy, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); +- #endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d/%-6d dts:%.3f pts:%.3f flags:%x dts_queue(%d) ready_queue(%d) busy_queue(%d) demux_queue(%d) space(%d)", ++ CLASSNAME, __func__, buffer, buffer->length, demuxer_bytes, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, buffer->flags, m_dts_queue.size(), m_output_ready.size(), m_output_busy, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); + assert((int)buffer->length > 0); + status = mmal_port_send_buffer(m_dec_input, buffer); + if (status != MMAL_SUCCESS) +@@ -879,7 +869,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + } + if (m_changed_count_dec != m_changed_count) + { +- CLog::Log(LOGDEBUG, "%s::%s format changed frame:%d(%d)", CLASSNAME, __func__, 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()) + { +@@ -919,9 +910,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + int ret = 0; + if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !m_demux_queue_length) + { +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s - got space for output: demux_queue(%d) space(%d)", CLASSNAME, __func__, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); +- #endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s - got space for output: demux_queue(%d) space(%d)", CLASSNAME, __func__, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); + ret |= VC_BUFFER; + } + else +@@ -932,14 +922,14 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + if (!m_output_ready.empty() && !m_preroll) + { +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s - got output picture:%d", CLASSNAME, __func__, m_output_ready.size()); +- #endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s - got output picture:%d", CLASSNAME, __func__, m_output_ready.size()); + ret |= VC_PICTURE; + } + if (!ret) + { +- CLog::Log(LOGDEBUG, "%s::%s - Nothing to do: dts_queue(%d) ready_queue(%d) busy_queue(%d) demux_queue(%d) space(%d) preroll(%d)", ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s - Nothing to do: dts_queue(%d) ready_queue(%d) busy_queue(%d) demux_queue(%d) space(%d) preroll(%d)", + CLASSNAME, __func__, m_dts_queue.size(), m_output_ready.size(), m_output_busy, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, m_preroll); + Sleep(10); // otherwise we busy spin + } +@@ -948,9 +938,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + void CMMALVideo::Reset(void) + { +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); +- #endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); + + if (m_dec_input) + mmal_port_disable(m_dec_input); +@@ -989,35 +978,31 @@ void CMMALVideo::Reset(void) + + void CMMALVideo::SetSpeed(int iSpeed) + { +-#if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s %d->%d", CLASSNAME, __func__, m_speed, iSpeed); +-#endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s %d->%d", CLASSNAME, __func__, m_speed, iSpeed); + + m_speed = iSpeed; + } + + void CMMALVideo::ReturnBuffer(CMMALVideoBuffer *buffer) + { +-#if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s %p (%d)", CLASSNAME, __func__, buffer, m_output_busy); +-#endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s %p (%d)", CLASSNAME, __func__, buffer, m_output_busy); + + mmal_buffer_header_release(buffer->mmal_buffer); + } + + void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) + { +-#if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, buffer); +-#endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, buffer); + + MMAL_STATUS_T status; + mmal_buffer_header_reset(buffer); + buffer->cmd = 0; +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s Send buffer %p from pool to decoder output port %p dts_queue(%d) ready_queue(%d) busy_queue(%d)", CLASSNAME, __func__, buffer, m_dec_output, +- m_dts_queue.size(), m_output_ready.size(), m_output_busy); +- #endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s Send buffer %p from pool to decoder output port %p dts_queue(%d) ready_queue(%d) busy_queue(%d)", CLASSNAME, __func__, buffer, m_dec_output, ++ m_dts_queue.size(), m_output_ready.size(), m_output_busy); + status = mmal_port_send_buffer(m_dec_output, buffer); + if (status != MMAL_SUCCESS) + { +@@ -1041,9 +1026,8 @@ void CMMALVideo::ReleaseBuffer(CMMALVideoBuffer *buffer) + pthread_mutex_unlock(&m_output_mutex); + if (done) + m_myself.reset(); +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s %p (%p) dts_queue(%d) ready_queue(%d) busy_queue(%d) done:%d", CLASSNAME, __func__, buffer, buffer->mmal_buffer, m_dts_queue.size(), m_output_ready.size(), m_output_busy, done); +- #endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s %p (%p) dts_queue(%d) ready_queue(%d) busy_queue(%d) done:%d", CLASSNAME, __func__, buffer, buffer->mmal_buffer, m_dts_queue.size(), m_output_ready.size(), m_output_busy, done); + delete buffer; + } + +@@ -1086,11 +1070,10 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) + + pDvdVideoPicture->MMALBuffer->Acquire(); + pDvdVideoPicture->iFlags = DVP_FLAG_ALLOCATED; +-#if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGINFO, "%s::%s dts:%.3f pts:%.3f flags:%x:%x MMALBuffer:%p mmal_buffer:%p", CLASSNAME, __func__, +- pDvdVideoPicture->dts == DVD_NOPTS_VALUE ? 0.0 : pDvdVideoPicture->dts*1e-6, pDvdVideoPicture->pts == DVD_NOPTS_VALUE ? 0.0 : pDvdVideoPicture->pts*1e-6, +- pDvdVideoPicture->iFlags, buffer->mmal_buffer->flags, pDvdVideoPicture->MMALBuffer, pDvdVideoPicture->MMALBuffer->mmal_buffer); +-#endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGINFO, "%s::%s dts:%.3f pts:%.3f flags:%x:%x MMALBuffer:%p mmal_buffer:%p", CLASSNAME, __func__, ++ pDvdVideoPicture->dts == DVD_NOPTS_VALUE ? 0.0 : pDvdVideoPicture->dts*1e-6, pDvdVideoPicture->pts == DVD_NOPTS_VALUE ? 0.0 : pDvdVideoPicture->pts*1e-6, ++ pDvdVideoPicture->iFlags, buffer->mmal_buffer->flags, pDvdVideoPicture->MMALBuffer, pDvdVideoPicture->MMALBuffer->mmal_buffer); + assert(!(buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_DECODEONLY)); + } + else +@@ -1111,9 +1094,8 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) + { + if (pDvdVideoPicture->format == RENDER_FMT_MMAL) + { +-#if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s - %p (%p)", CLASSNAME, __func__, pDvdVideoPicture->MMALBuffer, pDvdVideoPicture->MMALBuffer->mmal_buffer); +-#endif ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s - %p (%p)", CLASSNAME, __func__, pDvdVideoPicture->MMALBuffer, pDvdVideoPicture->MMALBuffer->mmal_buffer); + pDvdVideoPicture->MMALBuffer->Release(); + } + memset(pDvdVideoPicture, 0, sizeof *pDvdVideoPicture); +@@ -1125,8 +1107,7 @@ bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) + pts = m_decoderPts; + droppedPics = m_droppedPics; + m_droppedPics = 0; +-#if defined(MMAL_DEBUG_VERBOSE) +- //CLog::Log(LOGDEBUG, "%s::%s - pts:%.0f droppedPics:%d", CLASSNAME, __func__, pts, droppedPics); +-#endif ++ //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ // CLog::Log(LOGDEBUG, "%s::%s - pts:%.0f droppedPics:%d", CLASSNAME, __func__, pts, droppedPics); + return true; + } + + +From 2f0574a22d618a446f99f1a83be304e6d1acbfc3 Mon Sep 17 00:00:00 2001 +From: arnova +Date: Wed, 12 Nov 2014 18:30:54 +0100 +Subject: [PATCH 93/97] changed: Have CurlFile return m_bufferSize as chunksize + +--- + xbmc/filesystem/CurlFile.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/xbmc/filesystem/CurlFile.h b/xbmc/filesystem/CurlFile.h +index 1cc7bc3..2e32367 100644 +--- a/xbmc/filesystem/CurlFile.h ++++ b/xbmc/filesystem/CurlFile.h +@@ -63,6 +63,7 @@ namespace XFILE + virtual std::string GetContent() { return GetMimeType(); } + virtual int IoControl(EIoControl request, void* param); + virtual std::string GetContentCharset(void) { return GetServerReportedCharset(); } ++ virtual int GetChunkSize(void) { return m_bufferSize; } + + bool Post(const std::string& strURL, const std::string& strPostData, std::string& strHTML); + bool Get(const std::string& strURL, std::string& strHTML); + +From 281d0e40f5da011345c332807157f1d31c75ad38 Mon Sep 17 00:00:00 2001 +From: arnova +Date: Tue, 11 Nov 2014 13:31:42 +0100 +Subject: [PATCH 94/97] fixed: FileCache-full logic was wrong + create seperate + IsCacheFull() functions + +--- + xbmc/filesystem/CacheStrategy.cpp | 10 ++++++++++ + xbmc/filesystem/CacheStrategy.h | 3 +++ + xbmc/filesystem/CircularCache.cpp | 12 ++++++++++++ + xbmc/filesystem/CircularCache.h | 1 + + xbmc/filesystem/FileCache.cpp | 10 ++-------- + xbmc/filesystem/FileCache.h | 1 - + xbmc/filesystem/MemBufferCache.cpp | 9 +++++++++ + xbmc/filesystem/MemBufferCache.h | 1 + + 8 files changed, 38 insertions(+), 9 deletions(-) + +diff --git a/xbmc/filesystem/CacheStrategy.cpp b/xbmc/filesystem/CacheStrategy.cpp +index acc86af..29d31e9 100644 +--- a/xbmc/filesystem/CacheStrategy.cpp ++++ b/xbmc/filesystem/CacheStrategy.cpp +@@ -126,6 +126,11 @@ void CSimpleFileCache::Close() + m_filename.clear(); + } + ++bool CSimpleFileCache::IsCacheFull(size_t iSize) ++{ ++ return m_bEndOfInput; // Never full, except when we hit eof ++} ++ + int CSimpleFileCache::WriteToCache(const char *pBuffer, size_t iSize) + { + size_t written = 0; +@@ -300,6 +305,11 @@ void CSimpleDoubleCache::Close() + } + } + ++bool CSimpleDoubleCache::IsCacheFull(size_t iSize) ++{ ++ return m_pCache->IsCacheFull(iSize); // NOTE: Check the active cache only ++} ++ + int CSimpleDoubleCache::WriteToCache(const char *pBuffer, size_t iSize) + { + return m_pCache->WriteToCache(pBuffer, iSize); +diff --git a/xbmc/filesystem/CacheStrategy.h b/xbmc/filesystem/CacheStrategy.h +index 9ea7274..69b9b38 100644 +--- a/xbmc/filesystem/CacheStrategy.h ++++ b/xbmc/filesystem/CacheStrategy.h +@@ -44,6 +44,7 @@ class CCacheStrategy{ + virtual int Open() = 0; + virtual void Close() = 0; + ++ virtual bool IsCacheFull(size_t iSize) = 0; + virtual int WriteToCache(const char *pBuffer, size_t iSize) = 0; + virtual int ReadFromCache(char *pBuffer, size_t iMaxSize) = 0; + virtual int64_t WaitForData(unsigned int iMinAvail, unsigned int iMillis) = 0; +@@ -76,6 +77,7 @@ class CSimpleFileCache : public CCacheStrategy { + virtual int Open() ; + virtual void Close() ; + ++ virtual bool IsCacheFull(size_t iSize); + virtual int WriteToCache(const char *pBuffer, size_t iSize) ; + virtual int ReadFromCache(char *pBuffer, size_t iMaxSize) ; + virtual int64_t WaitForData(unsigned int iMinAvail, unsigned int iMillis) ; +@@ -110,6 +112,7 @@ class CSimpleDoubleCache : public CCacheStrategy{ + virtual int Open() ; + virtual void Close() ; + ++ virtual bool IsCacheFull(size_t iSize); + virtual int WriteToCache(const char *pBuffer, size_t iSize) ; + virtual int ReadFromCache(char *pBuffer, size_t iMaxSize) ; + virtual int64_t WaitForData(unsigned int iMinAvail, unsigned int iMillis) ; +diff --git a/xbmc/filesystem/CircularCache.cpp b/xbmc/filesystem/CircularCache.cpp +index b9ae641..eb15306 100644 +--- a/xbmc/filesystem/CircularCache.cpp ++++ b/xbmc/filesystem/CircularCache.cpp +@@ -76,6 +76,18 @@ void CCircularCache::Close() + m_buf = NULL; + } + ++bool CCircularCache::IsCacheFull(size_t iSize) ++{ ++ CSingleLock lock(m_sync); ++ ++ size_t back = (size_t)(m_cur - m_beg); // Backbuffer size ++ size_t front = (size_t)(m_end - m_cur); // Frontbuffer size ++ size_t limit = m_size - std::min(back, m_size_back) - front; ++ ++ // Check if iSize (normally m_chunkSize) would fit in the cache ++ return (iSize > limit); ++} ++ + /** + * Function will write to m_buf at m_end % m_size location + * it will write at maximum m_size, but it will only write +diff --git a/xbmc/filesystem/CircularCache.h b/xbmc/filesystem/CircularCache.h +index ae9e9b9..8dd873d 100644 +--- a/xbmc/filesystem/CircularCache.h ++++ b/xbmc/filesystem/CircularCache.h +@@ -36,6 +36,7 @@ class CCircularCache : public CCacheStrategy + virtual int Open() ; + virtual void Close(); + ++ virtual bool IsCacheFull(size_t iSize); + virtual int WriteToCache(const char *buf, size_t len) ; + virtual int ReadFromCache(char *buf, size_t len) ; + virtual int64_t WaitForData(unsigned int minimum, unsigned int iMillis) ; +diff --git a/xbmc/filesystem/FileCache.cpp b/xbmc/filesystem/FileCache.cpp +index 50fe9b4..4e95d77 100644 +--- a/xbmc/filesystem/FileCache.cpp ++++ b/xbmc/filesystem/FileCache.cpp +@@ -103,7 +103,6 @@ CFileCache::CFileCache(bool useDoubleCache) : CThread("FileCache") + m_pCache = new CSimpleDoubleCache(m_pCache); + } + m_seekPossible = 0; +- m_cacheFull = false; + } + + CFileCache::CFileCache(CCacheStrategy *pCache, bool bDeleteCache) : CThread("FileCacheStrategy") +@@ -183,7 +182,6 @@ bool CFileCache::Open(const CURL& url) + m_writePos = 0; + m_writeRate = 1024 * 1024; + m_writeRateActual = 0; +- m_cacheFull = false; + m_seekEvent.Reset(); + m_seekEnded.Reset(); + +@@ -219,7 +217,7 @@ void CFileCache::Process() + { + m_seekEvent.Reset(); + int64_t cacheMaxPos = m_pCache->CachedDataEndPosIfSeekTo(m_seekPos); +- cacheReachEOF = cacheMaxPos == m_source.GetLength(); ++ cacheReachEOF = (cacheMaxPos == m_source.GetLength()); + bool sourceSeekFailed = false; + if (!cacheReachEOF) + { +@@ -239,7 +237,6 @@ void CFileCache::Process() + assert(m_writePos == cacheMaxPos); + average.Reset(m_writePos); + limiter.Reset(m_writePos); +- m_cacheFull = false; + m_nSeekResult = m_seekPos; + } + +@@ -300,13 +297,10 @@ void CFileCache::Process() + } + else if (iWrite == 0) + { +- m_cacheFull = true; + average.Pause(); + m_pCache->m_space.WaitMSec(5); + average.Resume(); + } +- else +- m_cacheFull = false; + + iTotalWrite += iWrite; + +@@ -503,7 +497,7 @@ int CFileCache::IoControl(EIoControl request, void* param) + status->forward = m_pCache->WaitForData(0, 0); + status->maxrate = m_writeRate; + status->currate = m_writeRateActual; +- status->full = m_cacheFull; ++ status->full = m_pCache->IsCacheFull(m_chunkSize); + return 0; + } + +diff --git a/xbmc/filesystem/FileCache.h b/xbmc/filesystem/FileCache.h +index a144cc1..a9177c0 100644 +--- a/xbmc/filesystem/FileCache.h ++++ b/xbmc/filesystem/FileCache.h +@@ -76,7 +76,6 @@ namespace XFILE + unsigned m_chunkSize; + unsigned m_writeRate; + unsigned m_writeRateActual; +- bool m_cacheFull; + CCriticalSection m_sync; + }; + +diff --git a/xbmc/filesystem/MemBufferCache.cpp b/xbmc/filesystem/MemBufferCache.cpp +index c430ce8..6414df1 100644 +--- a/xbmc/filesystem/MemBufferCache.cpp ++++ b/xbmc/filesystem/MemBufferCache.cpp +@@ -67,6 +67,15 @@ void MemBufferCache::Close() + m_forwardBuffer.Clear(); + } + ++bool MemBufferCache::IsCacheFull(size_t iSize) ++{ ++ CSingleLock lock(m_sync); ++ ++ // must also check the forward buffer. ++ // if we have leftovers from the previous seek - we need not read anymore until they are utilized ++ return !(m_buffer.getMaxWriteSize() < iSize || m_forwardBuffer.getMaxReadSize() > 0); ++} ++ + int MemBufferCache::WriteToCache(const char *pBuffer, size_t iSize) + { + CSingleLock lock(m_sync); +diff --git a/xbmc/filesystem/MemBufferCache.h b/xbmc/filesystem/MemBufferCache.h +index 5574a5b..6325e9b 100644 +--- a/xbmc/filesystem/MemBufferCache.h ++++ b/xbmc/filesystem/MemBufferCache.h +@@ -40,6 +40,7 @@ class MemBufferCache : public CCacheStrategy + virtual int Open() ; + virtual void Close(); + ++ virtual bool IsCacheFull(size_t iSize) ; + virtual int WriteToCache(const char *pBuffer, size_t iSize) ; + virtual int ReadFromCache(char *pBuffer, size_t iMaxSize) ; + virtual int64_t WaitForData(unsigned int iMinAvail, unsigned int iMillis) ; + +From d37c21643852ef95ae4828819ce3c21427634ecb Mon Sep 17 00:00:00 2001 +From: arnova +Date: Wed, 12 Nov 2014 19:26:29 +0100 +Subject: [PATCH 95/97] fixed: Don't keep reading source when cache is full + (fixes #15500) + +--- + xbmc/filesystem/FileCache.cpp | 34 ++++++++++++++++++++-------------- + 1 file changed, 20 insertions(+), 14 deletions(-) + +diff --git a/xbmc/filesystem/FileCache.cpp b/xbmc/filesystem/FileCache.cpp +index 4e95d77..96b8d79 100644 +--- a/xbmc/filesystem/FileCache.cpp ++++ b/xbmc/filesystem/FileCache.cpp +@@ -262,24 +262,30 @@ void CFileCache::Process() + } + + ssize_t iRead = 0; +- if (!cacheReachEOF) +- iRead = m_source.Read(buffer.get(), m_chunkSize); +- if (iRead == 0) ++ /* Only read from source if there's enough write space in the cache ++ else we may keep disposing data and seeking back on (slow) source ++ */ ++ if (!m_pCache->IsCacheFull(m_chunkSize)) + { +- CLog::Log(LOGINFO, "CFileCache::Process - Hit eof."); +- m_pCache->EndOfInput(); +- +- // The thread event will now also cause the wait of an event to return a false. +- if (AbortableWait(m_seekEvent) == WAIT_SIGNALED) ++ if (!cacheReachEOF) ++ iRead = m_source.Read(buffer.get(), m_chunkSize); ++ if (iRead == 0) + { +- m_pCache->ClearEndOfInput(); +- m_seekEvent.Set(); // hack so that later we realize seek is needed ++ CLog::Log(LOGINFO, "CFileCache::Process - Hit eof."); ++ m_pCache->EndOfInput(); ++ ++ // The thread event will now also cause the wait of an event to return a false. ++ if (AbortableWait(m_seekEvent) == WAIT_SIGNALED) ++ { ++ m_pCache->ClearEndOfInput(); ++ m_seekEvent.Set(); // hack so that later we realize seek is needed ++ } ++ else ++ break; + } +- else +- break; ++ else if (iRead < 0) ++ m_bStop = true; + } +- else if (iRead < 0) +- m_bStop = true; + + int iTotalWrite=0; + while (!m_bStop && (iTotalWrite < iRead)) + +From 4c8659bafe999f2f7b0a6506f09f5d6852650cb6 Mon Sep 17 00:00:00 2001 +From: arnova +Date: Wed, 12 Nov 2014 21:22:40 +0100 +Subject: [PATCH 96/97] changed: Show cachebytes from input in dvdplayer info + as it's more intuitive + +--- + xbmc/cores/dvdplayer/DVDPlayer.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp +index cf870ad..e6e2e11 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp +@@ -2880,7 +2880,7 @@ void CDVDPlayer::GetGeneralInfo(std::string& strGeneralInfo) + if(m_StateInput.cache_bytes >= 0) + { + strBuf += StringUtils::Format(" cache:%s %2.0f%%" +- , StringUtils::SizeToString(m_State.cache_bytes).c_str() ++ , StringUtils::SizeToString(m_StateInput.cache_bytes).c_str() + , m_State.cache_level * 100); + if(m_playSpeed == 0 || m_caching == CACHESTATE_FULL) + strBuf += StringUtils::Format(" %d sec", DVD_TIME_TO_SEC(m_State.cache_delay)); +@@ -2916,7 +2916,7 @@ void CDVDPlayer::GetGeneralInfo(std::string& strGeneralInfo) + if(m_StateInput.cache_bytes >= 0) + { + strBuf += StringUtils::Format(" cache:%s %2.0f%%" +- , StringUtils::SizeToString(m_State.cache_bytes).c_str() ++ , StringUtils::SizeToString(m_StateInput.cache_bytes).c_str() + , m_State.cache_level * 100); + if(m_playSpeed == 0 || m_caching == CACHESTATE_FULL) + strBuf += StringUtils::Format(" %d sec", DVD_TIME_TO_SEC(m_State.cache_delay)); +