diff --git a/projects/RPi/patches/xbmc/xbmc-001-newclock4.patch b/projects/RPi/patches/xbmc/xbmc-001-newclock4.patch index 0219638a9d..cff8e65250 100644 --- a/projects/RPi/patches/xbmc/xbmc-001-newclock4.patch +++ b/projects/RPi/patches/xbmc/xbmc-001-newclock4.patch @@ -1,31 +1,7 @@ -From cf3fb928d3e89202c8c64ace9460676d6284e561 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 18 Aug 2014 17:48:04 +0100 -Subject: [PATCH 01/99] omxplayer: Reset codec on flush to stop a stale - timestamp from being returned - ---- - xbmc/cores/omxplayer/OMXPlayerAudio.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -index f1208e6..01d2afc 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -@@ -490,6 +490,8 @@ void OMXPlayerAudio::Process() - void OMXPlayerAudio::Flush() - { - m_flush = true; -+ if(m_pAudioCodec) -+ m_pAudioCodec->Reset(); - m_messageQueue.Flush(); - m_messageQueue.Put( new CDVDMsg(CDVDMsg::GENERAL_FLUSH), 1); - } - -From dfb8943208c17327c3ef1040c6e7b018b501925d Mon Sep 17 00:00:00 2001 +From 49e50d0dff0fa782df37bdca4a614b03ed67644d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 02/99] [rbp/omxplayer] When opening a stream don't try to +Subject: [PATCH 01/96] [rbp/omxplayer] When opening a stream don't try to update gui so often --- @@ -49,10 +25,10 @@ index e7cfcdd..20b99ad 100644 g_windowManager.ProcessRenderLoop(false); if (allowCancel && dialog->IsCanceled()) -From 83739b52ad8654b3245ff41343dd5900c975b312 Mon Sep 17 00:00:00 2001 +From 8ff9303a1a3e8b8dd3b0d3f99a5650ee9bb581ef Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 29 Apr 2014 15:23:22 +0100 -Subject: [PATCH 03/99] [ffmpeg] Speed up wtv index creation +Subject: [PATCH 02/96] [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. @@ -138,10 +114,10 @@ index 0000000..4ac5636 + } + } -From d8bcb56bcfb580860e3e0dc26c94ee9c80f643e9 Mon Sep 17 00:00:00 2001 +From 033648baa9403d1449ffdad361fd19c9400c0788 Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:49:17 +1300 -Subject: [PATCH 04/99] adds GetTvShowSeasons +Subject: [PATCH 03/96] adds GetTvShowSeasons --- xbmc/video/VideoDatabase.cpp | 30 ++++++++++++++++++++++++------ @@ -149,10 +125,10 @@ Subject: [PATCH 04/99] adds GetTvShowSeasons 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp -index 769bf30..a6e9efa 100644 +index 056e9eb..c21ece2 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp -@@ -4213,7 +4213,7 @@ bool CVideoDatabase::RemoveArtForItem(int mediaId, const MediaType &mediaType, c +@@ -4211,7 +4211,7 @@ bool CVideoDatabase::RemoveArtForItem(int mediaId, const MediaType &mediaType, c return result; } @@ -161,7 +137,7 @@ index 769bf30..a6e9efa 100644 { try { -@@ -4224,19 +4224,37 @@ bool CVideoDatabase::GetTvShowSeasonArt(int showId, map +@@ -4222,19 +4222,37 @@ bool CVideoDatabase::GetTvShowSeasonArt(int showId, map CStdString sql = PrepareSQL("select idSeason,season from seasons where idShow=%i", showId); m_pDS2->query(sql.c_str()); @@ -217,10 +193,10 @@ index 78259ed..cbb26b7 100644 bool GetArtTypes(const MediaType &mediaType, std::vector &artTypes); -From 5389ca816eccfe0b3eef345d904f3e104614b8c9 Mon Sep 17 00:00:00 2001 +From ec30e3c1bc728994b7f870d7db0d4626aefcbcb6 Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:50:10 +1300 -Subject: [PATCH 05/99] move AddSeason() public. +Subject: [PATCH 04/96] move AddSeason() public. --- xbmc/video/VideoDatabase.h | 2 +- @@ -247,10 +223,10 @@ index cbb26b7..1a79c00 100644 /*! \brief Adds a path to the tvshow link table. \param idShow the id of the show. -From 96dac4a1e5c700d091fd7dba8d13dace8b914ab4 Mon Sep 17 00:00:00 2001 +From 0b5876825e9445cdbb9a9991373061458ed321a5 Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:48:24 +1300 -Subject: [PATCH 06/99] adds GetArt function to (video) scraper, allowing art +Subject: [PATCH 05/96] adds GetArt function to (video) scraper, allowing art to be fetched given the video identifier. --- @@ -365,10 +341,10 @@ index 22ac229..75bc341 100644 enum LOOKUP_STATE { DO_NOTHING = 0, FIND_MOVIE = 1, -From 9e2ba737076ae127290a5e4abc6d9599d1c2cd1c Mon Sep 17 00:00:00 2001 +From 1dae91faea1b1bac60fd238359192a228f51fc71 Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:53:14 +1300 -Subject: [PATCH 07/99] refresh season art if a new season is found that isn't +Subject: [PATCH 06/96] refresh season art if a new season is found that isn't recorded in the database yet. Fixes #14339 --- @@ -377,10 +353,10 @@ Subject: [PATCH 07/99] refresh season art if a new season is found that isn't 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp -index 04e578b..b86746a 100644 +index 9bf4349..f14b978 100644 --- a/xbmc/video/VideoInfoScanner.cpp +++ b/xbmc/video/VideoInfoScanner.cpp -@@ -1360,6 +1360,10 @@ namespace VIDEO +@@ -1372,6 +1372,10 @@ namespace VIDEO pDlgProgress->Progress(); } @@ -391,7 +367,7 @@ index 04e578b..b86746a 100644 EPISODELIST episodes; bool hasEpisodeGuide = false; -@@ -1408,6 +1412,8 @@ namespace VIDEO +@@ -1420,6 +1424,8 @@ namespace VIDEO } if (AddVideo(&item, CONTENT_TVSHOWS, file->isFolder, true, &showInfo) < 0) return INFO_ERROR; @@ -400,7 +376,7 @@ index 04e578b..b86746a 100644 continue; } -@@ -1537,6 +1543,8 @@ namespace VIDEO +@@ -1549,6 +1555,8 @@ namespace VIDEO if (AddVideo(&item, CONTENT_TVSHOWS, file->isFolder, useLocal, &showInfo) < 0) return INFO_ERROR; @@ -409,7 +385,7 @@ index 04e578b..b86746a 100644 } else { -@@ -1545,9 +1553,27 @@ namespace VIDEO +@@ -1557,9 +1565,27 @@ namespace VIDEO file->cDate.GetAsLocalizedDate().c_str(), file->strTitle.c_str()); } } @@ -437,7 +413,7 @@ index 04e578b..b86746a 100644 CStdString CVideoInfoScanner::GetnfoFile(CFileItem *item, bool bGrabAny) const { CStdString nfoFile; -@@ -1812,6 +1838,11 @@ namespace VIDEO +@@ -1824,6 +1850,11 @@ namespace VIDEO } for (int season = -1; season <= maxSeasons; season++) { @@ -449,7 +425,7 @@ index 04e578b..b86746a 100644 map art; if (useLocal) { -@@ -1865,7 +1896,7 @@ namespace VIDEO +@@ -1877,7 +1908,7 @@ namespace VIDEO art.insert(make_pair(artTypes.front(), image)); } @@ -459,10 +435,10 @@ index 04e578b..b86746a 100644 } diff --git a/xbmc/video/VideoInfoScanner.h b/xbmc/video/VideoInfoScanner.h -index 7da1bf2..c764e20 100644 +index 92883e7..47d5ed4 100644 --- a/xbmc/video/VideoInfoScanner.h +++ b/xbmc/video/VideoInfoScanner.h -@@ -230,6 +230,8 @@ namespace VIDEO +@@ -231,6 +231,8 @@ namespace VIDEO */ INFO_RET OnProcessSeriesFolder(EPISODELIST& files, const ADDON::ScraperPtr &scraper, bool useLocal, const CVideoInfoTag& showInfo, CGUIDialogProgress* pDlgProgress = NULL); @@ -472,10 +448,10 @@ index 7da1bf2..c764e20 100644 bool ProcessItemByVideoInfoTag(const CFileItem *item, EPISODELIST &episodeList); -From 3f7128d405004113fcc237427a35ae423ab89a2f Mon Sep 17 00:00:00 2001 +From 70d8e64b3871ea7f46d7ff1c49c38cf90a54848d Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:53:34 +1300 -Subject: [PATCH 08/99] REMOVEME: updated thetvdb.com scraper to support art +Subject: [PATCH 07/96] REMOVEME: updated thetvdb.com scraper to support art updates --- @@ -583,10 +559,10 @@ index f27e4fc..bdf329f 100644 -From ce3a875e3134f9a030e490f16dd59c9175b52923 Mon Sep 17 00:00:00 2001 +From 5c25d92482a853132a1a68eec2e59ec2b12d9060 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 2 Aug 2014 17:48:04 +0100 -Subject: [PATCH 09/99] [omx] Report decoded image name +Subject: [PATCH 08/96] [omx] Report decoded image name --- xbmc/cores/omxplayer/OMXImage.cpp | 1 + @@ -605,10 +581,10 @@ index 3fbea3b..57f69c5 100644 else { -From 02dda99b8168816aeea1126ca2eeeae7403395a6 Mon Sep 17 00:00:00 2001 +From e216015ef5643e0c08973834e71e9335304774a9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Dec 2013 16:55:05 +0000 -Subject: [PATCH 10/99] logging: Add microsecond timer to log messages +Subject: [PATCH 09/96] logging: Add microsecond timer to log messages --- xbmc/utils/log.cpp | 17 +++++++++++++++-- @@ -661,10 +637,10 @@ index 4e51166..3c405ab 100644 levelNames[logLevel]) + strData; -From 6c35f600273abd1b53ea06dbb950f83cedeada00 Mon Sep 17 00:00:00 2001 +From fd04ee6d0906ad50796b87863304fa6c0cb50cdc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 13/99] [hifiberry] Hack: force it to be recognised as IEC958 +Subject: [PATCH 12/96] [hifiberry] Hack: force it to be recognised as IEC958 capable to enable passthrough options --- @@ -687,10 +663,10 @@ index a464b4b..7eba389 100644 info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") { -From 44e7c31812dfaf5b38835a8fb96794efd44590ac Mon Sep 17 00:00:00 2001 +From adbafd5bf00ff778ec3690b393630583e561c4b9 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 11 Dec 2013 17:21:54 +0000 -Subject: [PATCH 14/99] Move the reference-counting of Begin and End calls from +Subject: [PATCH 13/96] Move the reference-counting of Begin and End calls from DX and GL source files into GUIFontTTF.cpp. --- @@ -703,10 +679,10 @@ Subject: [PATCH 14/99] Move the reference-counting of Begin and End calls from 6 files changed, 135 insertions(+), 133 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index 008c7ae4..e507833 100644 +index 4e6fb67..b1d7452 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -308,6 +308,27 @@ bool CGUIFontTTFBase::Load(const CStdString& strFilename, float height, float as +@@ -333,6 +333,27 @@ bool CGUIFontTTFBase::Load(const CStdString& strFilename, float height, float as return true; } @@ -735,10 +711,10 @@ index 008c7ae4..e507833 100644 { Begin(); diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index 4501dbd..df54a5d 100644 +index 1714ed7..cd35d0f 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h -@@ -77,8 +77,8 @@ class CGUIFontTTFBase +@@ -79,8 +79,8 @@ class CGUIFontTTFBase bool Load(const CStdString& strFilename, float height = 20.0f, float aspect = 1.0f, float lineSpacing = 1.0f, bool border = false); @@ -749,8 +725,8 @@ index 4501dbd..df54a5d 100644 const CStdString& GetFileName() const { return m_strFileName; }; -@@ -168,6 +168,8 @@ class CGUIFontTTFBase - CStdString m_strFileName; +@@ -171,6 +171,8 @@ class CGUIFontTTFBase + XUTILS::auto_buffer m_fontFileInMemory; // used only in some cases, see CFreeTypeLibrary::GetFont() private: + virtual bool FirstBegin() = 0; @@ -1078,10 +1054,10 @@ index c0bb53a..735fb3a 100644 protected: virtual CBaseTexture* ReallocTexture(unsigned int& newHeight); -From b0eb8735bb06d3f50b546bfc65607b841a926f5f Mon Sep 17 00:00:00 2001 +From c2f02a64f1e36d80a413dbfedf1e32f0024b3ec8 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 11 Dec 2013 18:47:54 +0000 -Subject: [PATCH 15/99] Convert CGUIFontTTFBase::m_vertex to be managed as a +Subject: [PATCH 14/96] Convert CGUIFontTTFBase::m_vertex to be managed as a std::vector. Also retired CGUIFontTTFBase::m_vertex_count and @@ -1095,10 +1071,10 @@ member functions. 4 files changed, 18 insertions(+), 39 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index e507833..0a80471 100644 +index b1d7452..686dddf 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -138,8 +138,7 @@ CGUIFontTTFBase::CGUIFontTTFBase(const CStdString& strFileName) +@@ -160,8 +160,7 @@ CGUIFontTTFBase::CGUIFontTTFBase(const CStdString& strFileName) m_maxChars = 0; m_nestedBeginCount = 0; @@ -1108,7 +1084,7 @@ index e507833..0a80471 100644 m_face = NULL; m_stroker = NULL; -@@ -154,7 +153,6 @@ CGUIFontTTFBase::CGUIFontTTFBase(const CStdString& strFileName) +@@ -176,7 +175,6 @@ CGUIFontTTFBase::CGUIFontTTFBase(const CStdString& strFileName) m_textureScaleX = m_textureScaleY = 0.0; m_ellipsesWidth = m_height = 0.0f; m_color = 0; @@ -1116,7 +1092,7 @@ index e507833..0a80471 100644 m_nTexture = 0; } -@@ -215,9 +213,7 @@ void CGUIFontTTFBase::Clear() +@@ -237,9 +235,7 @@ void CGUIFontTTFBase::Clear() g_freeTypeLibrary.ReleaseStroker(m_stroker); m_stroker = NULL; @@ -1124,10 +1100,10 @@ index e507833..0a80471 100644 - m_vertex = NULL; - m_vertex_count = 0; + m_vertex.clear(); - } - bool CGUIFontTTFBase::Load(const CStdString& strFilename, float height, float aspect, float lineSpacing, bool border) -@@ -312,7 +308,7 @@ void CGUIFontTTFBase::Begin() + m_strFileName.clear(); + m_fontFileInMemory.clear(); +@@ -337,7 +333,7 @@ void CGUIFontTTFBase::Begin() { if (m_nestedBeginCount == 0 && m_texture != NULL && FirstBegin()) { @@ -1136,7 +1112,7 @@ index e507833..0a80471 100644 } // Keep track of the nested begin/end calls. m_nestedBeginCount++; -@@ -745,22 +741,9 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c +@@ -770,22 +766,9 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c float tt = texture.y1 * m_textureScaleY; float tb = texture.y2 * m_textureScaleY; @@ -1161,7 +1137,7 @@ index e507833..0a80471 100644 unsigned char r = GET_R(color) , g = GET_G(color) -@@ -827,8 +810,6 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c +@@ -852,8 +835,6 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c v[3].y = y[2]; v[3].z = z[2]; #endif @@ -1171,10 +1147,10 @@ index e507833..0a80471 100644 // Oblique code - original taken from freetype2 (ftsynth.c) diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index df54a5d..10a7060 100644 +index cd35d0f..5675725 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h -@@ -156,9 +156,7 @@ class CGUIFontTTFBase +@@ -158,9 +158,7 @@ class CGUIFontTTFBase unsigned int m_nTexture; @@ -1261,10 +1237,10 @@ index 97853fd..b76c6a5 100644 *vertices++ = m_vertex[i]; *vertices++ = m_vertex[i+1]; -From f59702d81eba5e5de5cb856047d4821dad0d6415 Mon Sep 17 00:00:00 2001 +From 2103006f25edc1c433cf798058854cc9abb5e510 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Mon, 16 Dec 2013 18:58:12 +0000 -Subject: [PATCH 16/99] CGUIFontTTFBase::RenderCharacter can now append to +Subject: [PATCH 15/96] CGUIFontTTFBase::RenderCharacter can now append to arbitrary vectors of vertices rather than only CGUIFontTTFBase::m_vertex --- @@ -1273,10 +1249,10 @@ Subject: [PATCH 16/99] CGUIFontTTFBase::RenderCharacter can now append to 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index 0a80471..848c5c8 100644 +index 686dddf..e6eb3f2 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -329,6 +329,8 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -354,6 +354,8 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors { Begin(); @@ -1285,7 +1261,7 @@ index 0a80471..848c5c8 100644 // save the origin, which is scaled separately m_originX = x; m_originY = y; -@@ -409,7 +411,7 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -434,7 +436,7 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors for (int i = 0; i < 3; i++) { @@ -1294,7 +1270,7 @@ index 0a80471..848c5c8 100644 cursorX += period->advance; } break; -@@ -418,7 +420,7 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -443,7 +445,7 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors else if (maxPixelWidth > 0 && cursorX > maxPixelWidth) break; // exceeded max allowed width - stop rendering @@ -1303,7 +1279,7 @@ index 0a80471..848c5c8 100644 if ( alignment & XBFONT_JUSTIFIED ) { if ((*pos & 0xffff) == L' ') -@@ -675,7 +677,7 @@ bool CGUIFontTTFBase::CacheCharacter(wchar_t letter, uint32_t style, Character * +@@ -700,7 +702,7 @@ bool CGUIFontTTFBase::CacheCharacter(wchar_t letter, uint32_t style, Character * return true; } @@ -1312,7 +1288,7 @@ index 0a80471..848c5c8 100644 { // actual image width isn't same as the character width as that is // just baseline width and height should include the descent -@@ -741,8 +743,8 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c +@@ -766,8 +768,8 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c float tt = texture.y1 * m_textureScaleY; float tb = texture.y2 * m_textureScaleY; @@ -1324,10 +1300,10 @@ index 0a80471..848c5c8 100644 unsigned char r = GET_R(color) diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index 10a7060..dde0350 100644 +index 5675725..a5d44f4 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h -@@ -109,7 +109,7 @@ class CGUIFontTTFBase +@@ -111,7 +111,7 @@ class CGUIFontTTFBase // Stuff for pre-rendering for speed inline Character *GetCharacter(character_t letter); bool CacheCharacter(wchar_t letter, uint32_t style, Character *ch); @@ -1337,10 +1313,10 @@ index 10a7060..dde0350 100644 virtual CBaseTexture* ReallocTexture(unsigned int& newHeight) = 0; -From 4aa871df47379c79ff394e5aa694560f68d5c638 Mon Sep 17 00:00:00 2001 +From 279defb4e05b97d633a2a5bcb65a16a0b7b430b2 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 17:18:38 +0000 -Subject: [PATCH 17/99] Add a cache of font glyph bounding box vertices. +Subject: [PATCH 16/96] 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 @@ -1797,18 +1773,18 @@ index 0000000..ef65845 + +#endif diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index 848c5c8..0290fc4 100644 +index e6eb3f2..6a40e9c 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -27,6 +27,7 @@ - #include "utils/MathUtils.h" - #include "utils/log.h" +@@ -29,6 +29,7 @@ #include "windowing/WindowingFactory.h" + #include "URL.h" + #include "filesystem/File.h" +#include "threads/SystemClock.h" #include -@@ -131,7 +132,7 @@ class CFreeTypeLibrary +@@ -153,7 +154,7 @@ class CFreeTypeLibrary XBMC_GLOBAL_REF(CFreeTypeLibrary, g_freeTypeLibrary); // our freetype library #define g_freeTypeLibrary XBMC_GLOBAL_USE(CFreeTypeLibrary) @@ -1817,7 +1793,7 @@ index 848c5c8..0290fc4 100644 { m_texture = NULL; m_char = NULL; -@@ -329,108 +330,120 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -354,108 +355,120 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors { Begin(); @@ -2022,10 +1998,10 @@ index 848c5c8..0290fc4 100644 End(); } diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index dde0350..77111bc 100644 +index a5d44f4..3b93672 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h -@@ -64,6 +64,9 @@ struct SVertex +@@ -66,6 +66,9 @@ struct SVertex }; @@ -2035,9 +2011,9 @@ index dde0350..77111bc 100644 class CGUIFontTTFBase { friend class CGUIFont; -@@ -165,6 +168,8 @@ class CGUIFontTTFBase - +@@ -168,6 +171,8 @@ class CGUIFontTTFBase CStdString m_strFileName; + XUTILS::auto_buffer m_fontFileInMemory; // used only in some cases, see CFreeTypeLibrary::GetFont() + CGUIFontCache m_staticCache; + @@ -2100,10 +2076,10 @@ index f351c99..9036ba9 100644 + return !operator==(a, b); +} -From 4da5d7b1677f96874f09f3f1cc910651eb3460ec Mon Sep 17 00:00:00 2001 +From 0d55084579fd568f1b80ac1cacf34a0fb9bb18b0 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 23 Jan 2014 22:24:17 +0000 -Subject: [PATCH 18/99] Lay the groundwork for hardware clipping. +Subject: [PATCH 17/96] 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 @@ -2132,10 +2108,10 @@ errors. 8 files changed, 128 insertions(+), 3 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index 0290fc4..e3808d9 100644 +index 6a40e9c..a8f5e67 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -709,7 +709,8 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c +@@ -734,7 +734,8 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c (posY + ch->offsetY + height) * g_graphicsContext.GetGUIScaleY()); vertex += CPoint(m_originX, m_originY); CRect texture(ch->left, ch->top, ch->right, ch->bottom); @@ -2365,10 +2341,10 @@ index 98e398a..81ee49e 100644 virtual void ResetScissors(); -From eb9a11b15a9ea6566bc7e218efe91c3590f43d3e Mon Sep 17 00:00:00 2001 +From e37d5a887b667a2e7d24624f997613534c0e0dee Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 23 Jan 2014 16:42:22 +0000 -Subject: [PATCH 19/99] Increase font cache hit rate by keying on the +Subject: [PATCH 18/96] 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 @@ -2477,10 +2453,10 @@ index ef65845..d913dee 100644 + #endif diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index e3808d9..412f47a 100644 +index a8f5e67..91bf91b 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -132,7 +132,7 @@ class CFreeTypeLibrary +@@ -154,7 +154,7 @@ class CFreeTypeLibrary XBMC_GLOBAL_REF(CFreeTypeLibrary, g_freeTypeLibrary); // our freetype library #define g_freeTypeLibrary XBMC_GLOBAL_USE(CFreeTypeLibrary) @@ -2489,7 +2465,7 @@ index e3808d9..412f47a 100644 { m_texture = NULL; m_char = NULL; -@@ -331,13 +331,28 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -356,13 +356,28 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors Begin(); bool dirtyCache; @@ -2524,7 +2500,7 @@ index e3808d9..412f47a 100644 if (dirtyCache) { // save the origin, which is scaled separately -@@ -440,10 +455,28 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -465,10 +480,28 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors else cursorX += ch->advance; } @@ -2557,11 +2533,11 @@ index e3808d9..412f47a 100644 End(); } diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index 77111bc..39bfa52 100644 +index 3b93672..258dffa 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h -@@ -169,6 +169,7 @@ class CGUIFontTTFBase - CStdString m_strFileName; +@@ -172,6 +172,7 @@ class CGUIFontTTFBase + XUTILS::auto_buffer m_fontFileInMemory; // used only in some cases, see CFreeTypeLibrary::GetFont() CGUIFontCache m_staticCache; + CGUIFontCache m_dynamicCache; @@ -2569,10 +2545,10 @@ index 77111bc..39bfa52 100644 private: virtual bool FirstBegin() = 0; -From 0fb48b90145afac07a2dccb6d3f48b45e892e975 Mon Sep 17 00:00:00 2001 +From 8ee373e08988d25ceb21c2ae10e98b87f9d5a266 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 8 Jan 2014 12:16:33 +0000 -Subject: [PATCH 20/99] Rewrite of scrolling text code. +Subject: [PATCH 19/96] 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 @@ -2888,10 +2864,10 @@ index 2cda726..fbc579e 100644 private: void Process(); -From 2a40513f06b7c0e3eb8b23c29de7446c718a6ea5 Mon Sep 17 00:00:00 2001 +From 503fed439a9fba12313d1be8b0b7e658e88cfdbf Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Mon, 27 Jan 2014 23:21:10 +0000 -Subject: [PATCH 21/99] Move the application of the translation offsets into +Subject: [PATCH 20/96] 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 @@ -2906,18 +2882,18 @@ support where the new scheme is not (yet?) used. 3 files changed, 73 insertions(+), 35 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index 412f47a..b0e69c0 100644 +index 91bf91b..b1d00e5 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -214,6 +214,7 @@ void CGUIFontTTFBase::Clear() +@@ -236,6 +236,7 @@ void CGUIFontTTFBase::Clear() g_freeTypeLibrary.ReleaseStroker(m_stroker); m_stroker = NULL; + m_vertexTrans.clear(); m_vertex.clear(); - } -@@ -309,6 +310,7 @@ void CGUIFontTTFBase::Begin() + m_strFileName.clear(); +@@ -334,6 +335,7 @@ void CGUIFontTTFBase::Begin() { if (m_nestedBeginCount == 0 && m_texture != NULL && FirstBegin()) { @@ -2925,7 +2901,7 @@ index 412f47a..b0e69c0 100644 m_vertex.clear(); } // Keep track of the nested begin/end calls. -@@ -456,23 +458,10 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -481,23 +483,10 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors cursorX += ch->advance; } if (hardwareClipping) @@ -2952,10 +2928,10 @@ index 412f47a..b0e69c0 100644 /* Append the new vertices (from the cache or otherwise) to the set collected * since the first Begin() call */ diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index 39bfa52..e8afc1c 100644 +index 258dffa..40bf430 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h -@@ -61,6 +61,14 @@ struct SVertex +@@ -63,6 +63,14 @@ struct SVertex unsigned char r, g, b, a; #endif float u, v; @@ -2970,7 +2946,7 @@ index 39bfa52..e8afc1c 100644 }; -@@ -159,6 +167,15 @@ class CGUIFontTTFBase +@@ -161,6 +169,15 @@ class CGUIFontTTFBase unsigned int m_nTexture; @@ -3085,10 +3061,10 @@ index 9935ea4..18c9358 100644 memset(newTexture->GetPixels(), 0, m_textureHeight * newTexture->GetPitch()); if (m_texture) -From 0225bf11ee27a23f9401e6148c3760979854da2f Mon Sep 17 00:00:00 2001 +From 5b3ae61ed5098abd289b8b725535d8b9ec0d6381 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 15:28:06 +0000 -Subject: [PATCH 22/99] Rather than applying the translation offsets to the +Subject: [PATCH 21/96] 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. @@ -3102,10 +3078,10 @@ Subject: [PATCH 22/99] Rather than applying the translation offsets to the 5 files changed, 36 insertions(+), 22 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index e8afc1c..573039d 100644 +index 40bf430..49222a4 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h -@@ -61,14 +61,6 @@ struct SVertex +@@ -63,14 +63,6 @@ struct SVertex unsigned char r, g, b, a; #endif float u, v; @@ -3232,22 +3208,22 @@ index 81ee49e..d2f9cd1 100644 protected: virtual void SetVSyncImpl(bool enable) = 0; -From f0f3a7eb67396c45efa7ca3e73d8f86da7a94f4d Mon Sep 17 00:00:00 2001 +From 57b48be5b3d9eef1cc270dde69c4c1c9efdff72f Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 29 Jan 2014 13:21:19 +0000 -Subject: [PATCH 23/99] Enable hardware clipping. +Subject: [PATCH 22/96] Enable hardware clipping. --- xbmc/guilib/GUIFontTTF.cpp | 4 ++-- - xbmc/guilib/GUIFontTTF.h | 5 ++++- + xbmc/guilib/GUIFontTTF.h | 4 +++- xbmc/guilib/GUIFontTTFGL.cpp | 6 ++++++ - 3 files changed, 12 insertions(+), 3 deletions(-) + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index b0e69c0..3ea1051 100644 +index b1d00e5..ff51c89 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -458,10 +458,10 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -483,10 +483,10 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors cursorX += ch->advance; } if (hardwareClipping) @@ -3261,19 +3237,18 @@ index b0e69c0..3ea1051 100644 /* Append the new vertices (from the cache or otherwise) to the set collected * since the first Begin() call */ diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index 573039d..a6931c1 100644 +index 49222a4..77b324f 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h -@@ -27,6 +27,8 @@ - * +@@ -28,6 +28,7 @@ */ + #include "utils/auto_buffer.h" +#include "Geometry.h" -+ + // forward definition class CBaseTexture; - -@@ -165,7 +167,8 @@ class CGUIFontTTFBase +@@ -167,7 +168,8 @@ class CGUIFontTTFBase float translateY; float translateZ; const std::vector *vertexBuffer; @@ -3308,10 +3283,10 @@ index ea08bf4..b63e337 100644 glUniformMatrix4fv(modelLoc, 1, GL_FALSE, g_matrices.GetMatrix(MM_MODELVIEW)); } -From a8ce03ce098cc780bf08fd7d12680ba54382ee2b Mon Sep 17 00:00:00 2001 +From 887153a6576b1e3f95d2f153d9a6271f01e09fee Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 15:32:51 +0000 -Subject: [PATCH 24/99] Move the vertex data across to a vertex buffer object +Subject: [PATCH 23/96] Move the vertex data across to a vertex buffer object just prior to drawing. --- @@ -3362,10 +3337,10 @@ index b63e337..b00055d 100644 // Disable the attributes used by this shader -From ba5d1de62ed376b4f621b878730625558fe64eee Mon Sep 17 00:00:00 2001 +From a37bccd4d22515a4de9a61b4e33af79927ea0ac7 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 16:04:04 +0000 -Subject: [PATCH 25/99] Move vertex data into an OpenGL VBO when the font cache +Subject: [PATCH 24/96] 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 @@ -3435,10 +3410,10 @@ index d913dee..ff766bf 100644 inline bool Match(const CGUIFontCacheDynamicPosition &a, const TransformMatrix &a_m, const CGUIFontCacheDynamicPosition &b, const TransformMatrix &b_m, diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index 3ea1051..ea510f4 100644 +index ff51c89..7d4fc88 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -342,13 +342,18 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -367,13 +367,18 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors g_graphicsContext.ScaleFinalYCoord(x, y), g_graphicsContext.ScaleFinalZCoord(x, y)); } @@ -3458,7 +3433,7 @@ index 3ea1051..ea510f4 100644 m_staticCache.Lookup(staticPos, colors, text, alignment, maxPixelWidth, -@@ -458,10 +463,14 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -483,10 +488,14 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors cursorX += ch->advance; } if (hardwareClipping) @@ -3476,10 +3451,10 @@ index 3ea1051..ea510f4 100644 /* Append the new vertices (from the cache or otherwise) to the set collected * since the first Begin() call */ diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index a6931c1..9a35ac4 100644 +index 77b324f..caa1e62 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h -@@ -84,6 +84,9 @@ class CGUIFontTTFBase +@@ -85,6 +85,9 @@ class CGUIFontTTFBase void Begin(); void End(); @@ -3489,7 +3464,7 @@ index a6931c1..9a35ac4 100644 const CStdString& GetFileName() const { return m_strFileName; }; -@@ -166,9 +169,9 @@ class CGUIFontTTFBase +@@ -167,9 +170,9 @@ class CGUIFontTTFBase float translateX; float translateY; float translateZ; @@ -3638,10 +3613,10 @@ index 735fb3a..6102c90 100644 protected: virtual CBaseTexture* ReallocTexture(unsigned int& newHeight); -From 3ec6539aba4d894458e3a537632aa550a58a7a27 Mon Sep 17 00:00:00 2001 +From 0d36d495e7eb1262b0d06161a8943ed1ef643b28 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 16 Jan 2014 16:29:42 +0000 -Subject: [PATCH 26/99] Switch from glDrawArrays() to glDrawElements(). +Subject: [PATCH 25/96] 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. @@ -3862,10 +3837,10 @@ index 6de3532..258a293 100644 if (m_display != EGL_NO_DISPLAY) -From a662cca8f8e0208b92ef71c00743f31d27bb7055 Mon Sep 17 00:00:00 2001 +From c90ef21dd003a6c1196658a0d032ac198a653f7d Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 27/99] Improved file buffering in CArchive +Subject: [PATCH 26/96] 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 @@ -3925,10 +3900,10 @@ index 6ed0f8f..8506d95 100644 } else -From 551b00e9f67182d167102565ee7cbfe58619eb80 Mon Sep 17 00:00:00 2001 +From bc853d03bc8184161fea512bb452b22a6679b611 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 10 Sep 2014 22:07:21 +0100 -Subject: [PATCH 28/99] [mmal] Allow mmal codec for dvd stills +Subject: [PATCH 27/96] [mmal] Allow mmal codec for dvd stills --- xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 4 ++++ @@ -3950,11 +3925,10 @@ index f139433..4183a2b 100644 { // If dvd is an mpeg2 and hint.stills - -From 91b24766d05447e555bba1597f1c3ed5f3bc9120 Mon Sep 17 00:00:00 2001 +From eec94822c733c6edc59bd12ed378bfe2174cc89e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 2 Aug 2014 17:47:38 +0100 -Subject: [PATCH 30/99] [VideoReferenceClock] Add OMX support +Subject: [PATCH 29/96] [VideoReferenceClock] Add OMX support --- xbmc/linux/RBP.cpp | 34 ++++++++++++++++++++++++ @@ -4153,10 +4127,10 @@ index 6027031..2dabac1 100644 }; -From a0daccf59266bc73f53cd2a228ff7ee038b96ae4 Mon Sep 17 00:00:00 2001 +From b7922d2ab301304719fc7e7da242fe6b426480a0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 12 Aug 2014 00:03:18 +0100 -Subject: [PATCH 31/99] videoreferenceclock: Boost priority +Subject: [PATCH 30/96] videoreferenceclock: Boost priority --- xbmc/video/VideoReferenceClock.cpp | 3 +++ @@ -4177,10 +4151,10 @@ index 916a15c..c491d29 100644 //register callback m_D3dCallback.Reset(); -From 05f051804af616f5b49eace7bd2317a96294d10f Mon Sep 17 00:00:00 2001 +From bf635f797123da87f689d1e13eea17c777b8e3b7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 5 Feb 2014 11:46:33 +0000 -Subject: [PATCH 32/99] [rbp/settings] Allow av sync type to be enabled +Subject: [PATCH 31/96] [rbp/settings] Allow av sync type to be enabled It works for dvdplayer --- @@ -4206,11 +4180,10 @@ index 570798b..e09d974 100644 false - -From 650a56964c98baebeb2197d2fdd7402677347ef9 Mon Sep 17 00:00:00 2001 +From 09b792f712f51dfd179bbd3c6665f6935b8c7021 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 16 Apr 2014 21:18:06 +0100 -Subject: [PATCH 37/99] [omxplayer] Don't propagate 3d flags based on supported +Subject: [PATCH 33/96] [omxplayer] Don't propagate 3d flags based on supported 3d modes --- @@ -4263,10 +4236,10 @@ index 2c25fd9..c2bd788 100644 unsigned int iDisplayWidth = width; unsigned int iDisplayHeight = height; -From 44a8c528fd577b270aeb627e28d5620b514f0328 Mon Sep 17 00:00:00 2001 +From d2fd6b8c82d28686585c0f36bcef8fd7dedd7b9c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:00:52 +0100 -Subject: [PATCH 38/99] [graphics] Don't set stereo mode based on resolution +Subject: [PATCH 34/96] [graphics] Don't set stereo mode based on resolution The resolution change should follow stereo mode --- @@ -4324,10 +4297,10 @@ index 5bffdf5..4be1c8b 100644 m_iScreenWidth = info_mod.iWidth; -From 1160a07cd80a264d5ddef8b9a98199c749cf498e Mon Sep 17 00:00:00 2001 +From 411e77ffcbb519bdc84321fc78aff61636e7d48c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:01:51 +0100 -Subject: [PATCH 39/99] [graphics] Allow switching to a more suitable 3D +Subject: [PATCH 35/96] [graphics] Allow switching to a more suitable 3D resolution --- @@ -4413,10 +4386,10 @@ index 0a27643..ef5bc74 100644 void ResetOverscan(RESOLUTION_INFO &resinfo); void ResetScreenParameters(RESOLUTION res); -From 01d7fa85b9e1c7772e03c7ed43b1f02e9112da02 Mon Sep 17 00:00:00 2001 +From ce7d447288d3a71c2e77caaed1e2560c6c05dea8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:38:55 +0100 -Subject: [PATCH 40/99] [3D] Support switching to 3D resolutions +Subject: [PATCH 36/96] [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. @@ -4498,10 +4471,10 @@ index 83c3adb..8076e76 100644 return current; } -From 600c839947ddeb8328c1c21feea3794bd46b2050 Mon Sep 17 00:00:00 2001 +From 08884befedb4640d590b5899283705b02da1907a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 23 Apr 2014 00:05:07 +0100 -Subject: [PATCH 41/99] [graphics] Make pixel ratio for 3d modes consistent +Subject: [PATCH 37/96] [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. @@ -4704,10 +4677,10 @@ index c58c28a..bf1e589 100644 AddUniqueResolution(res2, resolutions); -From 3f99e3d224941891c549d9169e13d844e1bc5b66 Mon Sep 17 00:00:00 2001 +From 175602084d4800b46e530bd8c7adea8ea99d29ed Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 42/99] filesystem: Make support of browsing into archives +Subject: [PATCH 38/96] 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. @@ -4723,10 +4696,10 @@ Add a settings option to enable this feature and default to disabled on Pi 4 files changed, 29 insertions(+) diff --git a/language/English/strings.po b/language/English/strings.po -index f8e7820..260ac22 100755 +index b348206..2344e2b 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -15931,3 +15931,13 @@ msgstr "" +@@ -15941,3 +15941,13 @@ msgstr "" msgctxt "#37031" msgid "Specifies how Blu-rays should be opened/played back. Disc menus are not fully supported yet and may cause problems." msgstr "" @@ -4761,7 +4734,7 @@ index e09d974..9cc4fd2 100644 diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 304c308..ef6c141 100644 +index d8736c3..dc33d95 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -226,6 +226,11 @@ @@ -4806,10 +4779,10 @@ index 2fd8777..3b294cd 100644 { // XBMC Smart playlist - just XML renamed to XSP // read the name of the playlist in -From 7d00ed3ce60079e9309d42e753c008edb5e6458f Mon Sep 17 00:00:00 2001 +From 7dc0c1974e96d896a75dbfa31b9f2ed18a262bb3 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 11 Aug 2014 22:56:13 +0100 -Subject: [PATCH 44/99] [omxplayer] Add acceleration option to choose +Subject: [PATCH 40/96] [omxplayer] Add acceleration option to choose omxplayer/dvdplayer automatically --- @@ -4819,10 +4792,10 @@ Subject: [PATCH 44/99] [omxplayer] Add acceleration option to choose 3 files changed, 77 insertions(+) diff --git a/language/English/strings.po b/language/English/strings.po -index 260ac22..160e83c 100755 +index 2344e2b..556b6f5 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -15941,3 +15941,13 @@ msgstr "" +@@ -15951,3 +15951,13 @@ msgstr "" msgctxt "#38021" msgid "Allow viewing and playing files in archives (e.g. zip, rar)" msgstr "" @@ -4837,7 +4810,7 @@ index 260ac22..160e83c 100755 +msgid "Uses codec information and audio setting to choose dvdplayer or omxplayer as appropriate" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index ef6c141..14f18d9 100644 +index dc33d95..f4fcb7c 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -751,6 +751,15 @@ @@ -4857,7 +4830,7 @@ index ef6c141..14f18d9 100644 HAS_OMXPLAYER diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index bbcf514..c89aae2 100644 +index 21d5f7c..713739b 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -490,6 +490,62 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer, std:: @@ -4933,10 +4906,10 @@ index bbcf514..c89aae2 100644 // allow renderer to switch to fullscreen if requested m_dvdPlayerVideo->EnableFullscreen(m_PlayerOptions.fullscreen); -From 430ad54c3e2921a8e4f6d3a328a056b296b87517 Mon Sep 17 00:00:00 2001 +From be17982bcc32d0584cade6f25329249bd57d9c76 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 12 Aug 2014 16:51:18 +0100 -Subject: [PATCH 45/99] AE: Add some logging for suspend/resume +Subject: [PATCH 41/96] AE: Add some logging for suspend/resume --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 5 +++++ @@ -4944,7 +4917,7 @@ Subject: [PATCH 45/99] AE: Add some logging for suspend/resume 2 files changed, 7 insertions(+) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index 2d013c8..c825b4b 100644 +index 91da985..0eda1d2 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp @@ -347,6 +347,7 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg) @@ -4987,7 +4960,7 @@ index 2d013c8..c825b4b 100644 &reply, 5000)) diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 7e85441..a73dd0a 100644 +index 9e98207..4f85dc7 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp @@ -932,6 +932,7 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo @@ -5007,10 +4980,10 @@ index 7e85441..a73dd0a 100644 } -From 017e54e4c9aff11a199ed0a82ea8354f5aad0f7b Mon Sep 17 00:00:00 2001 +From a29695ffd849b2e33fe8822cf38ea671ac18d4e1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 9 Jul 2014 22:45:43 +0100 -Subject: [PATCH 46/99] [rbp] Make cachemembuffersize default depend on memory +Subject: [PATCH 42/96] [rbp] Make cachemembuffersize default depend on memory size --- @@ -5049,7 +5022,7 @@ index 11376fc..b67fbb1 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 888ede3..2e2854f 100644 +index ba97f5f..4463f3b 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -363,7 +363,12 @@ void CAdvancedSettings::Initialize() @@ -5066,11 +5039,10 @@ index 888ede3..2e2854f 100644 // the following setting determines the readRate of a player data // as multiply of the default data read rate - -From 3ea42987e583c6fe2867a37dea15ef8d4a45bb9b Mon Sep 17 00:00:00 2001 +From 754f643cd9189d0c4cefb5edea32f5c353a41576 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 16 Jun 2014 19:06:00 +0100 -Subject: [PATCH 48/99] [experimental] Disable quiet-noise generation +Subject: [PATCH 44/96] [experimental] Disable quiet-noise generation --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp | 2 ++ @@ -5097,10 +5069,10 @@ index 488a0df..d9f4a43 100644 void CActiveAESink::SetSilenceTimer() -From 2cd450a1ebf8fc2d20cda35b9b1e60fd1306fbe3 Mon Sep 17 00:00:00 2001 +From a0d34fc1be4923566f99b541a8039d618e04973c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 49/99] [settings] Experiment: Report DESKTOP resolution in +Subject: [PATCH 45/96] [settings] Experiment: Report DESKTOP resolution in video settings --- @@ -5122,10 +5094,10 @@ index 6902f83..50c5f97 100644 StringUtils::Format("%dx%d%s", resolution->width, resolution->height, ModeFlagsToString(resolution->flags, false).c_str()), -From e6de67283fb1e636afc9c8edd08f81831a79bc2e Mon Sep 17 00:00:00 2001 +From b10888a905308f9765fbb5613509477a89f17c2a Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:24:42 +0200 -Subject: [PATCH 50/99] Added some vc_tv_* functions that were missing in +Subject: [PATCH 46/96] Added some vc_tv_* functions that were missing in DllBCM. --- @@ -5160,10 +5132,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 15d4b97c14f412f8cc5f0315a50cfd8033009846 Mon Sep 17 00:00:00 2001 +From 23164e439c6aec03a1143352df510739d7d113c3 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:29:03 +0200 -Subject: [PATCH 51/99] Added private utility function to map a float display +Subject: [PATCH 47/96] Added private utility function to map a float display aspect, to the respective SDTV_ASPECT_* enum value. --- @@ -5201,10 +5173,10 @@ index bf1e589..518a87d 100644 bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &resolutions) -From 053a9bd554194f3e2cfcb2e453d74807bf5e2496 Mon Sep 17 00:00:00 2001 +From f55fa23bbd8bc6f02eebfcb2114c4ad7df6db443 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:50:58 +0200 -Subject: [PATCH 52/99] Changed SDTV resolutions to be treated similarly to +Subject: [PATCH 48/96] 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. @@ -5301,10 +5273,10 @@ index 59401f5..a0acb1a 100644 int m_width; int m_height; -From 3cb062892523c15718a1fb577e1928ecfa1fe4bc Mon Sep 17 00:00:00 2001 +From 1898236a5ba39eba98a28ff2d052fa2f64d73033 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:54:59 +0200 -Subject: [PATCH 53/99] Added methods SuspendVideoOutput() and +Subject: [PATCH 49/96] 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. @@ -5368,10 +5340,10 @@ index 9dc39d5..ca36082 100644 CEGLNativeTypeRaspberryPI::CEGLNativeTypeRaspberryPI() { -From 81d7fd629130f5be6562ad5ba1a28fabb3eaed3e Mon Sep 17 00:00:00 2001 +From 7f71141476bc98f1fa283885a5492591566b21f0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 11 Aug 2013 15:03:36 +0100 -Subject: [PATCH 54/99] PowerManager (and its IPowerSyscall instance) now gets +Subject: [PATCH 50/96] 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. @@ -5383,7 +5355,7 @@ Subject: [PATCH 54/99] PowerManager (and its IPowerSyscall instance) now gets 4 files changed, 23 insertions(+) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 186ea7f..0a41343 100644 +index b456d77..830cd06 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -2332,6 +2332,13 @@ bool CApplication::OnKey(const CKey& key) @@ -5464,10 +5436,10 @@ index 0b1f10a..e42b143 100644 void OnSleep(); void OnWake(); -From bf6321c429e5b929bc93fb75c64e0c855632d349 Mon Sep 17 00:00:00 2001 +From df9650c85f0dd94c2d478fafe4b48f5218f199ab Mon Sep 17 00:00:00 2001 From: macrule Date: Wed, 17 Apr 2013 13:23:01 +0200 -Subject: [PATCH 55/99] Added CPowerSyscallVirtualSleep class, which acts as a +Subject: [PATCH 51/96] 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. @@ -5643,10 +5615,10 @@ index 0000000..ef6e682 + +#endif // _POWER_SYSCALL_VIRTUAL_SLEEP_H_ -From c02b03c0fbd8b83cd71c1c32493cbf648dd1d249 Mon Sep 17 00:00:00 2001 +From a03a0f128ed9e22cdf2f9c452397b5152824fc7c Mon Sep 17 00:00:00 2001 From: macrule Date: Wed, 17 Apr 2013 13:24:22 +0200 -Subject: [PATCH 56/99] Added power management support for the Raspberry Pi. +Subject: [PATCH 52/96] 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. @@ -5792,10 +5764,10 @@ index 0000000..fd1d67c + +#endif // _RASPBERRY_PI_POWER_SYSCALL_H_ -From d4343f847b7c527598660d7bb6295f000874c939 Mon Sep 17 00:00:00 2001 +From 30f46c9e46526b600713577e35486025ed73b4de Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 16:16:29 +0000 -Subject: [PATCH 57/99] [power] hack - don't kill lirc or cec +Subject: [PATCH 53/96] [power] hack - don't kill lirc or cec --- xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 37 +++++++++++++++++++++++ @@ -5803,7 +5775,7 @@ Subject: [PATCH 57/99] [power] hack - don't kill lirc or cec 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index 6950f0c..4c8416f 100644 +index 9907ba2..dfc2b78 100644 --- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp @@ -183,12 +183,49 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender, @@ -5879,10 +5851,10 @@ index 2d8c750..901f449 100644 CBuiltins::Execute("LIRC.Start"); #endif -From e5e5fbc455a23da78bce9d1e1f218323ece08daf Mon Sep 17 00:00:00 2001 +From 3f4a95a8af22f0e969b57f8f9ae316c74ebf5a08 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 16:47:54 +0000 -Subject: [PATCH 58/99] [power] hack - wake on any action +Subject: [PATCH 54/96] [power] hack - wake on any action --- xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 6 +++--- @@ -5911,10 +5883,10 @@ index 6a1e47b..a717a09 100644 if(VirtualWake()) { -From 3aacd299ec2bd4a9640d9edff9bc4820040ae6b4 Mon Sep 17 00:00:00 2001 +From cd9e2b1d251e8f0249d1b9f94719aaa861c6aefe Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 17:30:07 +0000 -Subject: [PATCH 59/99] [power] hack - Make suspend toggle suspend state +Subject: [PATCH 55/96] [power] hack - Make suspend toggle suspend state --- xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 5 +++++ @@ -5937,10 +5909,10 @@ index a717a09..d39c3ed 100644 return false; } -From d58641d07873f7e84e8e902123a23012baf6451b Mon Sep 17 00:00:00 2001 +From c417113dbe1336bcdbf12906dd9c7cb9f326c3b1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 4 Mar 2014 19:33:44 +0000 -Subject: [PATCH 60/99] [power] Add back in powerdown and reboot +Subject: [PATCH 56/96] [power] Add back in powerdown and reboot --- .../linux/RaspberryPIPowerSyscall.cpp | 34 ++++++++++++++++++++++ @@ -6018,10 +5990,10 @@ index fd1d67c..062132e 100644 virtual bool CanReboot() { return true; } -From 1b42a074be346ac5f723b0c1931def7b3c72148b Mon Sep 17 00:00:00 2001 +From d18d1218401657ef87798429f4074b5a5150cbc0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 26 Apr 2014 17:27:52 +0100 -Subject: [PATCH 65/99] [cec] Don't suspend pi on tv switch off - it can't wake +Subject: [PATCH 57/96] [cec] Don't suspend pi on tv switch off - it can't wake up --- @@ -6042,10 +6014,10 @@ index a906628..9b5271a 100644 -From 1279d3fb5faf0fd513ff85dcd2fc76270bfb854d Mon Sep 17 00:00:00 2001 +From 9ad1caae1c30c2649ff8508a28a98f5dedad561c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 18 Aug 2014 19:09:32 +0100 -Subject: [PATCH 66/99] rbp: Use new dispmanx function for vsync callbacks +Subject: [PATCH 58/96] rbp: Use new dispmanx function for vsync callbacks --- xbmc/linux/RBP.cpp | 85 ++++++++++++++----------- @@ -6257,10 +6229,10 @@ index ca36082..4b74ea0 100644 } DLOG("CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow\n"); -From ec1bede710310c5a4e865ee0847ca33bfce568bd Mon Sep 17 00:00:00 2001 +From c2e9d60bbf3fb6c0ffc6eb1adc41c230f43c6cbc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 19 Aug 2014 17:56:45 +0100 -Subject: [PATCH 67/99] Revert "rbp: Use new dispmanx function for vsync +Subject: [PATCH 59/96] Revert "rbp: Use new dispmanx function for vsync callbacks" This reverts commit afbf8fbceaa6649fb4a6bbd9a1cee6087590412b. @@ -6474,10 +6446,10 @@ index 4b74ea0..ca36082 100644 } DLOG("CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow\n"); -From f5ca95842aa2601aec05a6bfaf316d5c394525f8 Mon Sep 17 00:00:00 2001 +From bce81e35ce82f088c667ab1c2d7115b7b992a838 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 27 Jun 2014 00:01:05 +0100 -Subject: [PATCH 68/99] [rbp] Resume video output on startup +Subject: [PATCH 60/96] [rbp] Resume video output on startup --- xbmc/linux/RBP.cpp | 3 +++ @@ -6498,10 +6470,10 @@ index 2ff6078..34e0108 100644 m_omx_image_init = true; return true; -From 5ec02d54792052a230a35645a33f88297664406e Mon Sep 17 00:00:00 2001 +From 281e4a09aa3422361a97eb47ccf20428ae30cfd0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 16 Aug 2014 21:01:42 +0100 -Subject: [PATCH 69/99] omxrender: Hacks to reduce GUI rendering rate when +Subject: [PATCH 61/96] omxrender: Hacks to reduce GUI rendering rate when playing video --- @@ -6511,10 +6483,10 @@ Subject: [PATCH 69/99] 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 160e83c..d9b4519 100755 +index 556b6f5..c92fe6f 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -15951,3 +15951,30 @@ msgstr "" +@@ -15961,3 +15961,30 @@ msgstr "" msgctxt "#37034" msgid "Uses codec information and audio setting to choose dvdplayer or omxplayer as appropriate" msgstr "" @@ -6573,7 +6545,7 @@ index 9cc4fd2..97eb3e3c 100644 diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 0a41343..34cb9db 100644 +index 830cd06..abab4cf 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -2180,6 +2180,23 @@ void CApplication::Render() @@ -6601,10 +6573,10 @@ index 0a41343..34cb9db 100644 int vsync_mode = CSettings::Get().GetInt("videoscreen.vsync"); -From b3e5eb969927b2e45b356fe70c6c94051441a53c Mon Sep 17 00:00:00 2001 +From 2f1ec7ee2fb0e1c6ac7640f7bfe9c0fd6b8374b0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 9 Sep 2014 12:04:26 +0100 -Subject: [PATCH 70/99] egl: Treat unknown display aspect ratio as square pixel +Subject: [PATCH 62/96] egl: Treat unknown display aspect ratio as square pixel --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 ++-- @@ -6633,10 +6605,10 @@ index ca36082..1529045 100644 SetResolutionString(m_desktopRes); -From 96bbf2e2b66398bcef70f48cbd62097209c0a1a7 Mon Sep 17 00:00:00 2001 +From 5af7895e5efb5566797093b6689ea295eeb2ef47 Mon Sep 17 00:00:00 2001 From: anaconda Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 71/99] Disable textbox autoscrolling while on screensaver. +Subject: [PATCH 63/96] Disable textbox autoscrolling while on screensaver. --- xbmc/guilib/GUITextBox.cpp | 3 ++- @@ -6664,10 +6636,10 @@ index b7ef051..ba68fad 100644 if (m_lastRenderTime) m_autoScrollDelayTime += currentTime - m_lastRenderTime; -From 9fb850204d9931af9c29529e64c1a9f6c309f4a9 Mon Sep 17 00:00:00 2001 +From 2380d18c82ead3a18ed30775b66c6a207797d9f4 Mon Sep 17 00:00:00 2001 From: anaconda Date: Sat, 13 Sep 2014 19:49:01 +0200 -Subject: [PATCH 72/99] SQUASH: only if dim or black +Subject: [PATCH 64/96] SQUASH: only if dim or black --- xbmc/Application.cpp | 7 +++++++ @@ -6676,10 +6648,10 @@ Subject: [PATCH 72/99] SQUASH: only if dim or black 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 34cb9db..d89a379 100644 +index abab4cf..63c525b 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -5814,3 +5814,10 @@ void CApplication::CloseNetworkShares() +@@ -5815,3 +5815,10 @@ void CApplication::CloseNetworkShares() CSFTPSessionManager::DisconnectAllSessions(); #endif } @@ -6719,10 +6691,10 @@ index ba68fad..e149418 100644 if (m_lastRenderTime) m_autoScrollDelayTime += currentTime - m_lastRenderTime; -From 36b350c61d9648a03f7c5731bb2a213c5362407a Mon Sep 17 00:00:00 2001 +From 25801ec15384f4345c12f46db10b53adc8050687 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 Sep 2014 00:52:02 +0100 -Subject: [PATCH 73/99] [PiSink] Initial dual audio support +Subject: [PATCH 65/96] [PiSink] Initial dual audio support --- system/settings/rbp.xml | 7 - @@ -7079,7 +7051,7 @@ index 8ab1d08..5c57999 100644 #endif diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index a73dd0a..13899bc 100644 +index 4f85dc7..e96713c 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp @@ -124,17 +124,17 @@ bool COMXAudio::PortSettingsChanged() @@ -7131,10 +7103,10 @@ index a73dd0a..13899bc 100644 // force out layout to stereo if input is not multichannel - it gives the receiver a chance to upmix -From 3ff4ef08779e7b03bd219b19e4cf688b1c2b015b Mon Sep 17 00:00:00 2001 +From 99f0d55934d68a07f41c1484d6803f4a77a1befd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 18 Sep 2014 14:24:56 +0100 -Subject: [PATCH 74/99] [omxplayer] Only enable audio clock master when A/V +Subject: [PATCH 66/96] [omxplayer] Only enable audio clock master when A/V sync method is set to audio clock --- @@ -7142,7 +7114,7 @@ Subject: [PATCH 74/99] [omxplayer] Only enable audio clock master when A/V 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 13899bc..3c6c73b 100644 +index e96713c..036552a 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp @@ -252,7 +252,8 @@ bool COMXAudio::PortSettingsChanged() @@ -7165,10 +7137,10 @@ index 13899bc..3c6c73b 100644 OMX_CONFIG_BOOLEANTYPE configBool; OMX_INIT_STRUCTURE(configBool); -From d9f3d0781c9978e31abda2388c43f827b981a202 Mon Sep 17 00:00:00 2001 +From c16e014f8e02ba0d3baef3af8a0085a2070a8d8a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 18 Aug 2014 19:09:32 +0100 -Subject: [PATCH 75/99] rbp: Use new dispmanx function for vsync callbacks +Subject: [PATCH 67/96] rbp: Use new dispmanx function for vsync callbacks [rbp] Enable vsync handler all the time --- @@ -7401,10 +7373,10 @@ index 1529045..b6bf1fc 100644 } DLOG("CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow\n"); -From acb93970c12591f2b3c5cc2e514a6055b1128f35 Mon Sep 17 00:00:00 2001 +From c6dd9406aca31e289b8b7ef769631c998c2783a5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 18 Sep 2014 23:14:31 +0100 -Subject: [PATCH 76/99] Revert "rbp: Use new dispmanx function for vsync +Subject: [PATCH 68/96] Revert "rbp: Use new dispmanx function for vsync callbacks" This reverts commit e56163da23b6a844e7eee076e4583bce606f788b. @@ -7638,10 +7610,10 @@ index b6bf1fc..1529045 100644 } DLOG("CEGLNativeTypeRaspberryPI::DestroyDispmaxWindow\n"); -From ae43237eccd719fd1760f7d2bfd44c4229617c9d Mon Sep 17 00:00:00 2001 +From 4c69b23df58526ca45295d5de0bf08b9749777de Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 77/99] [dvdplayer/rbp] Add pi specific option to maintain +Subject: [PATCH 69/96] [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". @@ -7660,10 +7632,10 @@ Needed updated firmware 7 files changed, 76 insertions(+), 3 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po -index d9b4519..aba172a 100755 +index c92fe6f..36adeec 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -15978,3 +15978,8 @@ msgstr "" +@@ -15988,3 +15988,8 @@ msgstr "" msgctxt "#38005" msgid "24 fps" msgstr "" @@ -7839,10 +7811,10 @@ index f947acc..606c24f 100644 void SuspendVideoOutput(); void ResumeVideoOutput(); -From af3c4e730f3dec154902fd1c1dd7ce300e839b6f Mon Sep 17 00:00:00 2001 +From 62a1fd16f5662949f084854a6f3ad17461753b22 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Sep 2014 18:31:31 +0100 -Subject: [PATCH 78/99] hack: revert squash: don't update originaldts when +Subject: [PATCH 70/96] hack: revert squash: don't update originaldts when marked as invalid --- @@ -7850,7 +7822,7 @@ Subject: [PATCH 78/99] hack: revert squash: don't update originaldts when 1 file changed, 1 insertion(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index c89aae2..c34b96f 100644 +index 713739b..b88adb4 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -2106,6 +2106,7 @@ void CDVDPlayer::CheckContinuity(CCurrentStream& current, DemuxPacket* pPacket) @@ -7862,10 +7834,10 @@ index c89aae2..c34b96f 100644 } else -From b1acf2753346ecdf070a2c3b29af797b008545e7 Mon Sep 17 00:00:00 2001 +From d21ffcd0335bd2400a1c757068340dada280c8c2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 27 Sep 2014 15:27:04 +0100 -Subject: [PATCH 79/99] [omxplayer] Don't sync up to passthrough audio packets +Subject: [PATCH 71/96] [omxplayer] Don't sync up to passthrough audio packets - let GPU handle it --- @@ -7873,7 +7845,7 @@ Subject: [PATCH 79/99] [omxplayer] Don't sync up to passthrough audio packets 1 file changed, 2 insertions(+) diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 3c6c73b..d7149d9 100644 +index 036552a..ce35b07 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp @@ -1119,6 +1119,7 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt @@ -7893,10 +7865,10 @@ index 3c6c73b..d7149d9 100644 unsigned pitch = (m_Passthrough || m_HWDecode) ? 1:(m_BitsPerSample >> 3) * m_InputChannels; unsigned int demuxer_samples = len / pitch; -From d7b9180b0396eee6fec27289de65960482032c1f Mon Sep 17 00:00:00 2001 +From b962c21460b2b86cc8542e79483c424b68cb6518 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 27 Sep 2014 15:32:37 +0100 -Subject: [PATCH 80/99] [dvdplayer] exerimental: don't raise priority of audio +Subject: [PATCH 72/96] [dvdplayer] exerimental: don't raise priority of audio thread --- @@ -7904,7 +7876,7 @@ Subject: [PATCH 80/99] [dvdplayer] exerimental: don't raise priority of audio 1 file changed, 4 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index c34b96f..c55e119 100644 +index b88adb4..31dda29 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -3320,7 +3320,11 @@ bool CDVDPlayer::OpenAudioStream(CDVDStreamInfo& hint, bool reset) @@ -7920,10 +7892,10 @@ index c34b96f..c55e119 100644 } -From f201e6105d7268d3c49fca9059621a4511db09d5 Mon Sep 17 00:00:00 2001 +From 71f2334af064f4ff334eefc6584cf6c2c3e242c8 Mon Sep 17 00:00:00 2001 From: da-anda Date: Sun, 17 Aug 2014 21:09:59 +0200 -Subject: [PATCH 81/99] handle stereoscopic mode of videos in mixed playlists +Subject: [PATCH 73/96] handle stereoscopic mode of videos in mixed playlists --- language/English/strings.po | 2 +- @@ -7931,10 +7903,10 @@ Subject: [PATCH 81/99] 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 aba172a..5143e3e 100755 +index 36adeec..5233784 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -15612,7 +15612,7 @@ msgstr "" +@@ -15616,7 +15616,7 @@ msgstr "" #. Description of setting "Videos -> Playback -> Disable stereoscopic mode when playback is stopped" with label #36526 #: system/settings/settings.xml msgctxt "#36538" @@ -8091,10 +8063,10 @@ index 35ba597..b013942 100644 case 2: // Mono SetStereoMode( RENDER_STEREO_MODE_MONO ); -From 9e888b8b6d3e4b55d57e16c443449497ac7ef520 Mon Sep 17 00:00:00 2001 +From 63deb783e93287b865d207fb2091d7378ae4dc04 Mon Sep 17 00:00:00 2001 From: da-anda Date: Sat, 16 Aug 2014 11:20:54 +0200 -Subject: [PATCH 82/99] remember user selected 3D modes between videos until +Subject: [PATCH 74/96] remember user selected 3D modes between videos until playback ended --- @@ -8311,10 +8283,10 @@ index c1dfb93..cb54bd0 100644 -From 636340c2550eb0e990b9e9a3f6f198dcbee6027e Mon Sep 17 00:00:00 2001 +From f63ab21a07a35bc5e4073558041c383a72ef1c6e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 28 Sep 2014 17:35:31 +0100 -Subject: [PATCH 83/99] [renderer] Avoid warning for too few buffers with +Subject: [PATCH 75/96] [renderer] Avoid warning for too few buffers with bypass renderer Bypass renderer doesn't use a video render queue, so shouldn't generate a warning message @@ -8337,10 +8309,10 @@ index 1ecdc16..cc3a76b 100644 m_pRenderer->SetBufferSize(m_QueueSize); -From a0b4e3298118625508321a8d132bd06b8440741d Mon Sep 17 00:00:00 2001 +From 4811fcd1dae042e484754b44a62b30fff71b3658 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 28 Sep 2014 19:28:17 +0100 -Subject: [PATCH 84/99] [mmalcodec] Introduce a preroll period to buffer up +Subject: [PATCH 76/96] [mmalcodec] Introduce a preroll period to buffer up frames on startup --- @@ -8424,10 +8396,10 @@ index b4aa571..a2da46b 100644 MMAL_COMPONENT_T *m_dec; MMAL_PORT_T *m_dec_input; -From e661aa6bc04e0848bfb1f022014a95ef69c79ecc Mon Sep 17 00:00:00 2001 +From 0ba3cad7df33ee0392772c49e2a82cab888bc431 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 11 Apr 2014 16:12:27 +0100 -Subject: [PATCH 85/99] [omxplayer] Add ability to log more timestamp info in +Subject: [PATCH 77/96] [omxplayer] Add ability to log more timestamp info in extra debug settings --- @@ -8440,7 +8412,7 @@ Subject: [PATCH 85/99] [omxplayer] Add ability to log more timestamp info in 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po -index 5143e3e..2800c80 100755 +index 5233784..8c97c0a 100755 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -2886,6 +2886,11 @@ msgctxt "#679" @@ -8468,7 +8440,7 @@ index 92e2835..ad02d95 100644 #include "utils/params_check_macros.h" diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index c55e119..6a9707b7 100644 +index 31dda29..afdf74a 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -1135,7 +1135,8 @@ void CDVDPlayer::OMXDoProcessing() @@ -8508,7 +8480,7 @@ index c55e119..6a9707b7 100644 if(!m_Pause && (m_OmxPlayerState.bOmxSentEOFs || not_accepts_data || (audio_fifo_high && video_fifo_high) || m_playSpeed != DVD_PLAYSPEED_NORMAL)) { diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -index 01d2afc..b4d8418 100644 +index f1208e6..f6ef16f 100644 --- a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp @@ -362,10 +362,10 @@ void OMXPlayerAudio::Process() @@ -8554,10 +8526,10 @@ index c2bd788..5c4a515 100644 || m_speed < 0) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 2e2854f..413c55a 100644 +index 4463f3b..a0a0205 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1389,6 +1389,9 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se +@@ -1386,6 +1386,9 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se #ifdef HAVE_LIBCEC list.push_back(std::make_pair(g_localizeStrings.Get(679), LOGCEC)); #endif @@ -8568,10 +8540,10 @@ index 2e2854f..413c55a 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From dc0d123d7e79e9c56f950ba2cb543ec1e8e624a7 Mon Sep 17 00:00:00 2001 +From 555343a47656340e2a36ae70f841ae1cad25d82a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 86/99] [omxplayer] Add ability to dump out audio/video data +Subject: [PATCH 78/96] [omxplayer] Add ability to dump out audio/video data for later debugging --- @@ -8583,7 +8555,7 @@ Subject: [PATCH 86/99] [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 2800c80..989cfcc 100755 +index 8c97c0a..6ce5175 100755 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -2891,6 +2891,16 @@ msgctxt "#697" @@ -8617,7 +8589,7 @@ index ad02d95..be40370 100644 #include "utils/params_check_macros.h" diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index d7149d9..f0ae0cc 100644 +index ce35b07..22ee423 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp @@ -60,6 +60,49 @@ static const uint16_t AC3FSCod [] = {48000, 44100, 32000, 0}; @@ -8798,10 +8770,10 @@ index 0363aaa..6cfb148 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 413c55a..0c84e99 100644 +index a0a0205..298cc5d 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp -@@ -1392,6 +1392,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se +@@ -1389,6 +1389,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se #ifdef TARGET_RASPBERRY_PI list.push_back(std::make_pair(g_localizeStrings.Get(697), LOGOMXPLAYER)); #endif @@ -8813,34 +8785,10 @@ index 413c55a..0c84e99 100644 void CAdvancedSettings::setExtraLogLevel(const std::vector &components) -From 73b1c2d5ff0942e1f873d8a219560955bae83fbb Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 30 Sep 2014 20:52:13 +0100 -Subject: [PATCH 87/99] Revert "hack: revert squash: don't update originaldts - when marked as invalid" - -This reverts commit 001dbfdefe45a3883e6f7d59525462e97bade4ee. ---- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 6a9707b7..90dd142 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -2108,7 +2108,6 @@ 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; -- current.originaldts = pPacket->dts; - } - } - else - -From 87bb444eb6b641078daee9ce43cc7a97d9b0111c Mon Sep 17 00:00:00 2001 +From a468cfb5145c41cad294f95c26078f1241528878 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 Oct 2014 16:34:51 +0100 -Subject: [PATCH 88/99] [mmalcodec] squash: Avoid preroll when using trickplay +Subject: [PATCH 79/96] [mmalcodec] squash: Avoid preroll when using trickplay --- xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecMMAL.cpp | 5 +++++ @@ -8935,188 +8883,10 @@ index a2da46b..4f81bbd 100644 MMAL_COMPONENT_T *m_dec; -From 53f4c6a2d2f39fbecd30316cdb3f99626a1b9f5c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 1 Oct 2014 22:44:22 +0100 -Subject: [PATCH 90/99] [dvdplayer] Remove omx render features from dvdplayer - and handle in mmalrenderer - ---- - xbmc/cores/VideoRenderers/MMALRenderer.cpp | 48 ------------------------------ - xbmc/cores/VideoRenderers/MMALRenderer.h | 5 ---- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 29 ------------------ - xbmc/cores/dvdplayer/DVDPlayer.h | 6 ---- - 4 files changed, 88 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -index 692379c..5fb6dce 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp -@@ -190,25 +190,6 @@ bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned - - m_RenderUpdateCallBackFn = NULL; - m_RenderUpdateCallBackCtx = NULL; -- if ((m_format == RENDER_FMT_BYPASS) && g_application.GetCurrentPlayer()) -- { -- m_renderFeatures.clear(); -- m_scalingMethods.clear(); -- m_deinterlaceModes.clear(); -- m_deinterlaceMethods.clear(); -- -- if (m_RenderFeaturesCallBackFn) -- { -- (*m_RenderFeaturesCallBackFn)(m_RenderFeaturesCallBackCtx, m_renderFeatures); -- // after setting up m_renderFeatures, we are done with the callback -- m_RenderFeaturesCallBackFn = NULL; -- m_RenderFeaturesCallBackCtx = NULL; -- } -- g_application.m_pPlayer->GetRenderFeatures(m_renderFeatures); -- g_application.m_pPlayer->GetDeinterlaceMethods(m_deinterlaceMethods); -- g_application.m_pPlayer->GetDeinterlaceModes(m_deinterlaceModes); -- g_application.m_pPlayer->GetScalingMethods(m_scalingMethods); -- } - - // calculate the input frame aspect ratio - CalculateFrameAspectRatio(d_width, d_height); -@@ -480,8 +461,6 @@ void CMMALRenderer::UnInit() - - m_RenderUpdateCallBackFn = NULL; - m_RenderUpdateCallBackCtx = NULL; -- m_RenderFeaturesCallBackFn = NULL; -- m_RenderFeaturesCallBackCtx = NULL; - - m_src_rect.SetRect(0, 0, 0, 0); - m_dst_rect.SetRect(0, 0, 0, 0); -@@ -511,13 +490,6 @@ bool CMMALRenderer::RenderCapture(CRenderCapture* capture) - - bool CMMALRenderer::Supports(EDEINTERLACEMODE mode) - { -- // Player controls render, let it dictate available deinterlace modes -- if (m_format == RENDER_FMT_BYPASS) -- { -- Features::iterator itr = std::find(m_deinterlaceModes.begin(),m_deinterlaceModes.end(), mode); -- return itr != m_deinterlaceModes.end(); -- } -- - if(mode == VS_DEINTERLACEMODE_OFF - || mode == VS_DEINTERLACEMODE_AUTO - || mode == VS_DEINTERLACEMODE_FORCE) -@@ -528,13 +500,6 @@ bool CMMALRenderer::Supports(EDEINTERLACEMODE mode) - - bool CMMALRenderer::Supports(EINTERLACEMETHOD method) - { -- // Player controls render, let it dictate available deinterlace methods -- if (m_format == RENDER_FMT_BYPASS) -- { -- Features::iterator itr = std::find(m_deinterlaceMethods.begin(),m_deinterlaceMethods.end(), method); -- return itr != m_deinterlaceMethods.end(); -- } -- - if (method == VS_INTERLACEMETHOD_DEINTERLACE) - return true; - -@@ -543,13 +508,6 @@ bool CMMALRenderer::Supports(EINTERLACEMETHOD method) - - bool CMMALRenderer::Supports(ERENDERFEATURE feature) - { -- // Player controls render, let it dictate available render features -- if (m_format == RENDER_FMT_BYPASS) -- { -- Features::iterator itr = std::find(m_renderFeatures.begin(),m_renderFeatures.end(), feature); -- return itr != m_renderFeatures.end(); -- } -- - if (feature == RENDERFEATURE_STRETCH || - feature == RENDERFEATURE_ZOOM || - feature == RENDERFEATURE_ROTATION || -@@ -562,12 +520,6 @@ bool CMMALRenderer::Supports(ERENDERFEATURE feature) - - bool CMMALRenderer::Supports(ESCALINGMETHOD method) - { -- // Player controls render, let it dictate available scaling methods -- if (m_format == RENDER_FMT_BYPASS) -- { -- Features::iterator itr = std::find(m_scalingMethods.begin(),m_scalingMethods.end(), method); -- return itr != m_scalingMethods.end(); -- } - return false; - } - -diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h -index 3488ce0..8ca0b94 100644 ---- a/xbmc/cores/VideoRenderers/MMALRenderer.h -+++ b/xbmc/cores/VideoRenderers/MMALRenderer.h -@@ -104,11 +104,6 @@ class CMMALRenderer : public CBaseRenderer, public CThread - unsigned int m_destHeight; - int m_neededBuffers; - -- Features m_renderFeatures; -- Features m_deinterlaceMethods; -- Features m_deinterlaceModes; -- Features m_scalingMethods; -- - CRect m_src_rect; - CRect m_dst_rect; - RENDER_STEREO_MODE m_video_stereo_mode; -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 90dd142..22e27ea 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -4497,32 +4497,3 @@ bool CDVDPlayer::CachePVRStream(void) const - !g_PVRManager.IsPlayingRecording() && - g_advancedSettings.m_bPVRCacheInDvdPlayer; - } -- --void CDVDPlayer::OMXGetRenderFeatures(std::vector &renderFeatures) --{ -- if (m_omxplayer_mode) -- { -- renderFeatures.push_back(RENDERFEATURE_STRETCH); -- renderFeatures.push_back(RENDERFEATURE_CROP); -- renderFeatures.push_back(RENDERFEATURE_PIXEL_RATIO); -- renderFeatures.push_back(RENDERFEATURE_ZOOM); -- } --} -- --void CDVDPlayer::OMXGetDeinterlaceMethods(std::vector &deinterlaceMethods) --{ -- if (m_omxplayer_mode) -- { -- deinterlaceMethods.push_back(VS_INTERLACEMETHOD_DEINTERLACE); -- } --} -- --void CDVDPlayer::OMXGetDeinterlaceModes(std::vector &deinterlaceModes) --{ -- if (m_omxplayer_mode) -- { -- deinterlaceModes.push_back(VS_DEINTERLACEMODE_AUTO); -- deinterlaceModes.push_back(VS_DEINTERLACEMODE_OFF); -- deinterlaceModes.push_back(VS_DEINTERLACEMODE_FORCE); -- } --} -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h -index 32f350b..dac00e9 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.h -+++ b/xbmc/cores/dvdplayer/DVDPlayer.h -@@ -286,12 +286,6 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer - - virtual int OnDVDNavResult(void* pData, int iMessage); - -- // Note: the following "OMX" methods are deprecated and will be removed in the future -- // They should be handled by the video renderer, not the player -- virtual void OMXGetRenderFeatures(std::vector &renderFeatures); -- virtual void OMXGetDeinterlaceMethods(std::vector &deinterlaceMethods); -- virtual void OMXGetDeinterlaceModes(std::vector &deinterlaceModes); -- - virtual bool ControlsVolume() {return m_omxplayer_mode;} - - protected: - -From b37024fd026e62b5357b4a663ef7af35ad175af5 Mon Sep 17 00:00:00 2001 +From b82d48580d1ad13659239787e955268be5c99ef9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 Oct 2014 22:45:09 +0100 -Subject: [PATCH 91/99] [mmalrenderer] Add choice of 3 deinterlace schemes +Subject: [PATCH 80/96] [mmalrenderer] Add choice of 3 deinterlace schemes --- xbmc/cores/VideoRenderers/MMALRenderer.cpp | 4 ++++ @@ -9157,7 +8927,7 @@ index cee1499..42c62db 100644 if (status != MMAL_SUCCESS) { diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 22e27ea..b335a83 100644 +index afdf74a..676b35270a 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -618,6 +618,7 @@ CDVDPlayer::CDVDPlayer(IPlayerCallback& callback) @@ -9235,374 +9005,23 @@ index 6cfb148..37765b1 100644 image_filter.eImageFilter = OMX_ImageFilterDeInterlaceFast; else -From 268ea34172c14df4daaab4f4533f6a45eef5c9d6 Mon Sep 17 00:00:00 2001 +From 15bcbab5207cb7321147d6e8b436ddecb08432fa Mon Sep 17 00:00:00 2001 From: popcornmix -Date: Fri, 3 Oct 2014 17:50:28 +0100 -Subject: [PATCH 93/99] [AE] Add factory for AEResampler +Date: Sat, 4 Oct 2014 22:41:42 +0100 +Subject: [PATCH 81/96] [AE] Rename ActiveAEResample to ActiveAEResampleFFMPEG --- - xbmc/cores/AudioEngine/AEResampleFactory.cpp | 149 ++++++++ - xbmc/cores/AudioEngine/AEResampleFactory.h | 43 +++ - .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 6 +- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 2 +- - .../Engines/ActiveAE/ActiveAEBuffer.cpp | 25 +- - .../AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h | 4 +- .../Engines/ActiveAE/ActiveAEResample.cpp | 388 --------------------- .../Engines/ActiveAE/ActiveAEResample.h | 65 ---- - .../Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp | 282 +++++++++++++++ - .../Engines/ActiveAE/ActiveAEResampleFFMPEG.h | 62 ++++ - .../AudioEngine/Engines/ActiveAE/ActiveAESink.cpp | 12 +- - .../AudioEngine/Engines/ActiveAE/ActiveAESink.h | 2 +- - .../AudioEngine/Engines/ActiveAE/ActiveAESound.h | 2 +- - .../Engines/ActiveAE/ActiveAEStream.cpp | 15 +- - .../AudioEngine/Engines/ActiveAE/ActiveAEStream.h | 2 +- - xbmc/cores/AudioEngine/Interfaces/AEResample.h | 53 +++ - xbmc/cores/AudioEngine/Makefile.in | 4 +- - xbmc/cores/paplayer/DVDPlayerCodec.cpp | 12 +- - xbmc/cores/paplayer/DVDPlayerCodec.h | 4 +- - 19 files changed, 637 insertions(+), 495 deletions(-) - create mode 100644 xbmc/cores/AudioEngine/AEResampleFactory.cpp - create mode 100644 xbmc/cores/AudioEngine/AEResampleFactory.h + .../Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp | 388 +++++++++++++++++++++ + .../Engines/ActiveAE/ActiveAEResampleFFMPEG.h | 65 ++++ + xbmc/cores/AudioEngine/Makefile.in | 2 +- + 5 files changed, 454 insertions(+), 454 deletions(-) delete mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp delete mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h - create mode 100644 xbmc/cores/AudioEngine/Interfaces/AEResample.h -diff --git a/xbmc/cores/AudioEngine/AEResampleFactory.cpp b/xbmc/cores/AudioEngine/AEResampleFactory.cpp -new file mode 100644 -index 0000000..a0aef34 ---- /dev/null -+++ b/xbmc/cores/AudioEngine/AEResampleFactory.cpp -@@ -0,0 +1,149 @@ -+/* -+ * Copyright (C) 2010-2013 Team XBMC -+ * http://xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#include "AEResampleFactory.h" -+#include "Engines/ActiveAE/ActiveAEResampleFFMPEG.h" -+ -+extern "C" { -+#include "libavutil/channel_layout.h" -+#include "libavutil/opt.h" -+#include "libswresample/swresample.h" -+} -+ -+namespace ActiveAE -+{ -+ -+IAEResample *CAEResampleFactory::Create() -+{ -+ return new CActiveAEResampleFFMPEG(); -+} -+ -+ -+uint64_t CAEResampleFactory::GetAVChannelLayout(CAEChannelInfo &info) -+{ -+ uint64_t channelLayout = 0; -+ if (info.HasChannel(AE_CH_FL)) channelLayout |= AV_CH_FRONT_LEFT; -+ if (info.HasChannel(AE_CH_FR)) channelLayout |= AV_CH_FRONT_RIGHT; -+ if (info.HasChannel(AE_CH_FC)) channelLayout |= AV_CH_FRONT_CENTER; -+ if (info.HasChannel(AE_CH_LFE)) channelLayout |= AV_CH_LOW_FREQUENCY; -+ if (info.HasChannel(AE_CH_BL)) channelLayout |= AV_CH_BACK_LEFT; -+ if (info.HasChannel(AE_CH_BR)) channelLayout |= AV_CH_BACK_RIGHT; -+ if (info.HasChannel(AE_CH_FLOC)) channelLayout |= AV_CH_FRONT_LEFT_OF_CENTER; -+ if (info.HasChannel(AE_CH_FROC)) channelLayout |= AV_CH_FRONT_RIGHT_OF_CENTER; -+ if (info.HasChannel(AE_CH_BC)) channelLayout |= AV_CH_BACK_CENTER; -+ if (info.HasChannel(AE_CH_SL)) channelLayout |= AV_CH_SIDE_LEFT; -+ if (info.HasChannel(AE_CH_SR)) channelLayout |= AV_CH_SIDE_RIGHT; -+ if (info.HasChannel(AE_CH_TC)) channelLayout |= AV_CH_TOP_CENTER; -+ if (info.HasChannel(AE_CH_TFL)) channelLayout |= AV_CH_TOP_FRONT_LEFT; -+ if (info.HasChannel(AE_CH_TFC)) channelLayout |= AV_CH_TOP_FRONT_CENTER; -+ if (info.HasChannel(AE_CH_TFR)) channelLayout |= AV_CH_TOP_FRONT_RIGHT; -+ if (info.HasChannel(AE_CH_TBL)) channelLayout |= AV_CH_TOP_BACK_LEFT; -+ if (info.HasChannel(AE_CH_TBC)) channelLayout |= AV_CH_TOP_BACK_CENTER; -+ if (info.HasChannel(AE_CH_TBR)) channelLayout |= AV_CH_TOP_BACK_RIGHT; -+ -+ return channelLayout; -+} -+ -+//CAEChannelInfo CActiveAEResampleFFMPEG::GetAEChannelLayout(uint64_t layout) -+//{ -+// CAEChannelInfo channelLayout; -+// channelLayout.Reset(); -+// -+// if (layout & AV_CH_FRONT_LEFT ) channelLayout += AE_CH_FL ; -+// if (layout & AV_CH_FRONT_RIGHT ) channelLayout += AE_CH_FR ; -+// if (layout & AV_CH_FRONT_CENTER ) channelLayout += AE_CH_FC ; -+// if (layout & AV_CH_LOW_FREQUENCY ) channelLayout += AE_CH_LFE ; -+// if (layout & AV_CH_BACK_LEFT ) channelLayout += AE_CH_BL ; -+// if (layout & AV_CH_BACK_RIGHT ) channelLayout += AE_CH_BR ; -+// if (layout & AV_CH_FRONT_LEFT_OF_CENTER ) channelLayout += AE_CH_FLOC; -+// if (layout & AV_CH_FRONT_RIGHT_OF_CENTER) channelLayout += AE_CH_FROC; -+// if (layout & AV_CH_BACK_CENTER ) channelLayout += AE_CH_BC ; -+// if (layout & AV_CH_SIDE_LEFT ) channelLayout += AE_CH_SL ; -+// if (layout & AV_CH_SIDE_RIGHT ) channelLayout += AE_CH_SR ; -+// if (layout & AV_CH_TOP_CENTER ) channelLayout += AE_CH_TC ; -+// if (layout & AV_CH_TOP_FRONT_LEFT ) channelLayout += AE_CH_TFL ; -+// if (layout & AV_CH_TOP_FRONT_CENTER ) channelLayout += AE_CH_TFC ; -+// if (layout & AV_CH_TOP_FRONT_RIGHT ) channelLayout += AE_CH_TFR ; -+// if (layout & AV_CH_TOP_BACK_LEFT ) channelLayout += AE_CH_BL ; -+// if (layout & AV_CH_TOP_BACK_CENTER ) channelLayout += AE_CH_BC ; -+// if (layout & AV_CH_TOP_BACK_RIGHT ) channelLayout += AE_CH_BR ; -+// -+// return channelLayout; -+//} -+ -+AVSampleFormat CAEResampleFactory::GetAVSampleFormat(AEDataFormat format) -+{ -+ if (format == AE_FMT_U8) return AV_SAMPLE_FMT_U8; -+ else if (format == AE_FMT_S16NE) return AV_SAMPLE_FMT_S16; -+ else if (format == AE_FMT_S32NE) return AV_SAMPLE_FMT_S32; -+ else if (format == AE_FMT_S24NE4) return AV_SAMPLE_FMT_S32; -+ else if (format == AE_FMT_S24NE4MSB)return AV_SAMPLE_FMT_S32; -+ else if (format == AE_FMT_S24NE3) return AV_SAMPLE_FMT_S32; -+ else if (format == AE_FMT_FLOAT) return AV_SAMPLE_FMT_FLT; -+ else if (format == AE_FMT_DOUBLE) return AV_SAMPLE_FMT_DBL; -+ -+ else if (format == AE_FMT_U8P) return AV_SAMPLE_FMT_U8P; -+ else if (format == AE_FMT_S16NEP) return AV_SAMPLE_FMT_S16P; -+ else if (format == AE_FMT_S32NEP) return AV_SAMPLE_FMT_S32P; -+ else if (format == AE_FMT_S24NE4P) return AV_SAMPLE_FMT_S32P; -+ else if (format == AE_FMT_S24NE4MSBP)return AV_SAMPLE_FMT_S32P; -+ else if (format == AE_FMT_S24NE3P) return AV_SAMPLE_FMT_S32P; -+ else if (format == AE_FMT_FLOATP) return AV_SAMPLE_FMT_FLTP; -+ else if (format == AE_FMT_DOUBLEP) return AV_SAMPLE_FMT_DBLP; -+ -+ if (AE_IS_PLANAR(format)) -+ return AV_SAMPLE_FMT_FLTP; -+ else -+ return AV_SAMPLE_FMT_FLT; -+} -+ -+uint64_t CAEResampleFactory::GetAVChannel(enum AEChannel aechannel) -+{ -+ switch (aechannel) -+ { -+ case AE_CH_FL: return AV_CH_FRONT_LEFT; -+ case AE_CH_FR: return AV_CH_FRONT_RIGHT; -+ case AE_CH_FC: return AV_CH_FRONT_CENTER; -+ case AE_CH_LFE: return AV_CH_LOW_FREQUENCY; -+ case AE_CH_BL: return AV_CH_BACK_LEFT; -+ case AE_CH_BR: return AV_CH_BACK_RIGHT; -+ case AE_CH_FLOC: return AV_CH_FRONT_LEFT_OF_CENTER; -+ case AE_CH_FROC: return AV_CH_FRONT_RIGHT_OF_CENTER; -+ case AE_CH_BC: return AV_CH_BACK_CENTER; -+ case AE_CH_SL: return AV_CH_SIDE_LEFT; -+ case AE_CH_SR: return AV_CH_SIDE_RIGHT; -+ case AE_CH_TC: return AV_CH_TOP_CENTER; -+ case AE_CH_TFL: return AV_CH_TOP_FRONT_LEFT; -+ case AE_CH_TFC: return AV_CH_TOP_FRONT_CENTER; -+ case AE_CH_TFR: return AV_CH_TOP_FRONT_RIGHT; -+ case AE_CH_TBL: return AV_CH_TOP_BACK_LEFT; -+ case AE_CH_TBC: return AV_CH_TOP_BACK_CENTER; -+ case AE_CH_TBR: return AV_CH_TOP_BACK_RIGHT; -+ default: -+ return 0; -+ } -+} -+ -+int CAEResampleFactory::GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout) -+{ -+ return av_get_channel_layout_channel_index(layout, GetAVChannel(aechannel)); -+} -+ -+} -diff --git a/xbmc/cores/AudioEngine/AEResampleFactory.h b/xbmc/cores/AudioEngine/AEResampleFactory.h -new file mode 100644 -index 0000000..21f1803 ---- /dev/null -+++ b/xbmc/cores/AudioEngine/AEResampleFactory.h -@@ -0,0 +1,43 @@ -+#pragma once -+/* -+ * Copyright (C) 2010-2013 Team XBMC -+ * http://xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#include -+#include -+#include -+ -+#include "cores/AudioEngine/Interfaces/AEResample.h" -+ -+class IAEResample; -+ -+namespace ActiveAE -+{ -+ -+class CAEResampleFactory -+{ -+public: -+ static IAEResample *Create(); -+ static uint64_t GetAVChannelLayout(CAEChannelInfo &info); -+ static AVSampleFormat GetAVSampleFormat(AEDataFormat format); -+ static uint64_t GetAVChannel(enum AEChannel aechannel); -+ static int GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout); -+}; -+ -+} -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index c825b4b..72cd8ce 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -2676,14 +2676,14 @@ bool CActiveAE::ResampleSound(CActiveAESound *sound) - - orig_config = sound->GetSound(true)->config; - -- dst_config.channel_layout = CActiveAEResample::GetAVChannelLayout(m_internalFormat.m_channelLayout); -+ dst_config.channel_layout = CAEResampleFactory::GetAVChannelLayout(m_internalFormat.m_channelLayout); - dst_config.channels = m_internalFormat.m_channelLayout.Count(); - dst_config.sample_rate = m_internalFormat.m_sampleRate; -- dst_config.fmt = CActiveAEResample::GetAVSampleFormat(m_internalFormat.m_dataFormat); -+ dst_config.fmt = CAEResampleFactory::GetAVSampleFormat(m_internalFormat.m_dataFormat); - dst_config.bits_per_sample = CAEUtil::DataFormatToUsedBits(m_internalFormat.m_dataFormat); - dst_config.dither_bits = CAEUtil::DataFormatToDitherBits(m_internalFormat.m_dataFormat); - -- CActiveAEResample *resampler = new CActiveAEResample(); -+ IAEResample *resampler = CAEResampleFactory::Create(); - resampler->Init(dst_config.channel_layout, - dst_config.channels, - dst_config.sample_rate, -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -index de94850..9ae3c40 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -@@ -23,7 +23,7 @@ - #include "threads/Thread.h" - - #include "ActiveAESink.h" --#include "ActiveAEResample.h" -+#include "cores/AudioEngine/Interfaces/AEResample.h" - #include "cores/AudioEngine/Interfaces/AEStream.h" - #include "cores/AudioEngine/Interfaces/AESound.h" - #include "cores/AudioEngine/AEFactory.h" -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -index 9e834c6..4e4ec92 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -@@ -22,6 +22,7 @@ - #include "cores/AudioEngine/AEFactory.h" - #include "cores/AudioEngine/Engines/ActiveAE/ActiveAE.h" - #include "cores/AudioEngine/Utils/AEUtil.h" -+#include "cores/AudioEngine/AEResampleFactory.h" - - using namespace ActiveAE; - -@@ -107,12 +108,12 @@ bool CActiveAEBufferPool::Create(unsigned int totaltime) - { - CSampleBuffer *buffer; - SampleConfig config; -- config.fmt = CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat); -+ config.fmt = CAEResampleFactory::GetAVSampleFormat(m_format.m_dataFormat); - config.bits_per_sample = CAEUtil::DataFormatToUsedBits(m_format.m_dataFormat); - config.dither_bits = CAEUtil::DataFormatToDitherBits(m_format.m_dataFormat); - config.channels = m_format.m_channelLayout.Count(); - config.sample_rate = m_format.m_sampleRate; -- config.channel_layout = CActiveAEResample::GetAVChannelLayout(m_format.m_channelLayout); -+ config.channel_layout = CAEResampleFactory::GetAVChannelLayout(m_format.m_channelLayout); - - unsigned int time = 0; - unsigned int buffertime = (m_format.m_frames*1000) / m_format.m_sampleRate; -@@ -171,17 +172,17 @@ bool CActiveAEBufferPoolResample::Create(unsigned int totaltime, bool remap, boo - m_inputFormat.m_dataFormat != m_format.m_dataFormat || - m_changeResampler) - { -- m_resampler = new CActiveAEResample(); -- m_resampler->Init(CActiveAEResample::GetAVChannelLayout(m_format.m_channelLayout), -+ m_resampler = CAEResampleFactory::Create(); -+ m_resampler->Init(CAEResampleFactory::GetAVChannelLayout(m_format.m_channelLayout), - m_format.m_channelLayout.Count(), - m_format.m_sampleRate, -- CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat), -+ CAEResampleFactory::GetAVSampleFormat(m_format.m_dataFormat), - CAEUtil::DataFormatToUsedBits(m_format.m_dataFormat), - CAEUtil::DataFormatToDitherBits(m_format.m_dataFormat), -- CActiveAEResample::GetAVChannelLayout(m_inputFormat.m_channelLayout), -+ CAEResampleFactory::GetAVChannelLayout(m_inputFormat.m_channelLayout), - m_inputFormat.m_channelLayout.Count(), - m_inputFormat.m_sampleRate, -- CActiveAEResample::GetAVSampleFormat(m_inputFormat.m_dataFormat), -+ CAEResampleFactory::GetAVSampleFormat(m_inputFormat.m_dataFormat), - CAEUtil::DataFormatToUsedBits(m_inputFormat.m_dataFormat), - CAEUtil::DataFormatToDitherBits(m_inputFormat.m_dataFormat), - upmix, -@@ -199,17 +200,17 @@ void CActiveAEBufferPoolResample::ChangeResampler() - { - delete m_resampler; - -- m_resampler = new CActiveAEResample(); -- m_resampler->Init(CActiveAEResample::GetAVChannelLayout(m_format.m_channelLayout), -+ m_resampler = CAEResampleFactory::Create(); -+ m_resampler->Init(CAEResampleFactory::GetAVChannelLayout(m_format.m_channelLayout), - m_format.m_channelLayout.Count(), - m_format.m_sampleRate, -- CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat), -+ CAEResampleFactory::GetAVSampleFormat(m_format.m_dataFormat), - CAEUtil::DataFormatToUsedBits(m_format.m_dataFormat), - CAEUtil::DataFormatToDitherBits(m_format.m_dataFormat), -- CActiveAEResample::GetAVChannelLayout(m_inputFormat.m_channelLayout), -+ CAEResampleFactory::GetAVChannelLayout(m_inputFormat.m_channelLayout), - m_inputFormat.m_channelLayout.Count(), - m_inputFormat.m_sampleRate, -- CActiveAEResample::GetAVSampleFormat(m_inputFormat.m_dataFormat), -+ CAEResampleFactory::GetAVSampleFormat(m_inputFormat.m_dataFormat), - CAEUtil::DataFormatToUsedBits(m_inputFormat.m_dataFormat), - CAEUtil::DataFormatToDitherBits(m_inputFormat.m_dataFormat), - m_stereoUpmix, -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h -index b0912be..961db98 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h -@@ -89,7 +89,7 @@ class CActiveAEBufferPool - std::deque m_freeSamples; - }; - --class CActiveAEResample; -+class IAEResample; - - class CActiveAEBufferPoolResample : public CActiveAEBufferPool - { -@@ -105,7 +105,7 @@ class CActiveAEBufferPoolResample : public CActiveAEBufferPool - std::deque m_inputSamples; - std::deque m_outputSamples; - CSampleBuffer *m_procSample; -- CActiveAEResample *m_resampler; -+ IAEResample *m_resampler; - uint8_t *m_planes[16]; - bool m_fillPackets; - bool m_drain; diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp deleted file mode 100644 index d7e0e0f..0000000 @@ -10070,10 +9489,10 @@ index a471e02..0000000 -} diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp new file mode 100644 -index 0000000..8107f44 +index 0000000..d7e0e0f --- /dev/null +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp -@@ -0,0 +1,282 @@ +@@ -0,0 +1,388 @@ +/* + * Copyright (C) 2010-2013 Team XBMC + * http://xbmc.org @@ -10094,11 +9513,7 @@ index 0000000..8107f44 + * + */ + -+#include "system.h" -+ -+#include "ActiveAEResampleFFMPEG.h" -+#include "cores/AudioEngine/AEResampleFactory.h" -+#include "settings/Settings.h" ++#include "ActiveAEResample.h" +#include "utils/log.h" + +extern "C" { @@ -10109,19 +9524,19 @@ index 0000000..8107f44 + +using namespace ActiveAE; + -+CActiveAEResampleFFMPEG::CActiveAEResampleFFMPEG() ++CActiveAEResample::CActiveAEResample() +{ + m_pContext = NULL; + m_loaded = true; +} + -+CActiveAEResampleFFMPEG::~CActiveAEResampleFFMPEG() ++CActiveAEResample::~CActiveAEResample() +{ + if (m_pContext) + swr_free(&m_pContext); +} + -+bool CActiveAEResampleFFMPEG::Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, int dst_dither, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, int src_dither, bool upmix, bool normalize, CAEChannelInfo *remapLayout, AEQuality quality) ++bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, int dst_dither, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, int src_dither, bool upmix, bool normalize, CAEChannelInfo *remapLayout, AEQuality quality) +{ + if (!m_loaded) + return false; @@ -10150,7 +9565,7 @@ index 0000000..8107f44 + + if(!m_pContext) + { -+ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Init - create context failed"); ++ CLog::Log(LOGERROR, "CActiveAEResample::Init - create context failed"); + return false; + } + @@ -10195,7 +9610,7 @@ index 0000000..8107f44 + for (unsigned int out=0; outCount(); out++) + { + m_dst_chan_layout += (uint64_t) (1 << out); -+ int idx = CAEResampleFactory::GetAVChannelIndex((*remapLayout)[out], m_src_chan_layout); ++ int idx = GetAVChannelIndex((*remapLayout)[out], m_src_chan_layout); + if (idx >= 0) + { + m_rematrix[out][idx] = 1.0; @@ -10207,7 +9622,7 @@ index 0000000..8107f44 + + if (swr_set_matrix(m_pContext, (const double*)m_rematrix, AE_CH_MAX) < 0) + { -+ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Init - setting channel matrix failed"); ++ CLog::Log(LOGERROR, "CActiveAEResample::Init - setting channel matrix failed"); + return false; + } + } @@ -10245,20 +9660,20 @@ index 0000000..8107f44 + + if (swr_set_matrix(m_pContext, (const double*)m_rematrix, AE_CH_MAX) < 0) + { -+ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Init - setting channel matrix failed"); ++ CLog::Log(LOGERROR, "CActiveAEResample::Init - setting channel matrix failed"); + return false; + } + } + + if(swr_init(m_pContext) < 0) + { -+ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Init - init resampler failed"); ++ CLog::Log(LOGERROR, "CActiveAEResample::Init - init resampler failed"); + return false; + } + return true; +} + -+int CActiveAEResampleFFMPEG::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, double ratio) ++int CActiveAEResample::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, double ratio) +{ + if (ratio != 1.0) + { @@ -10266,7 +9681,7 @@ index 0000000..8107f44 + (dst_samples*ratio-dst_samples)*m_dst_rate/m_src_rate, + dst_samples*m_dst_rate/m_src_rate) < 0) + { -+ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Resample - set compensation failed"); ++ CLog::Log(LOGERROR, "CActiveAEResample::Resample - set compensation failed"); + return 0; + } + } @@ -10274,7 +9689,7 @@ index 0000000..8107f44 + int ret = swr_convert(m_pContext, dst_buffer, dst_samples, (const uint8_t**)src_buffer, src_samples); + if (ret < 0) + { -+ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Resample - resample failed"); ++ CLog::Log(LOGERROR, "CActiveAEResample::Resample - resample failed"); + return 0; + } + @@ -10331,37 +9746,147 @@ index 0000000..8107f44 + return ret; +} + -+int64_t CActiveAEResampleFFMPEG::GetDelay(int64_t base) ++int64_t CActiveAEResample::GetDelay(int64_t base) +{ + return swr_get_delay(m_pContext, base); +} + -+int CActiveAEResampleFFMPEG::GetBufferedSamples() ++int CActiveAEResample::GetBufferedSamples() +{ + return av_rescale_rnd(swr_get_delay(m_pContext, m_src_rate), + m_dst_rate, m_src_rate, AV_ROUND_UP); +} + -+int CActiveAEResampleFFMPEG::CalcDstSampleCount(int src_samples, int dst_rate, int src_rate) ++int CActiveAEResample::CalcDstSampleCount(int src_samples, int dst_rate, int src_rate) +{ + return av_rescale_rnd(src_samples, dst_rate, src_rate, AV_ROUND_UP); +} + -+int CActiveAEResampleFFMPEG::GetSrcBufferSize(int samples) ++int CActiveAEResample::GetSrcBufferSize(int samples) +{ + return av_samples_get_buffer_size(NULL, m_src_channels, samples, m_src_fmt, 1); +} + -+int CActiveAEResampleFFMPEG::GetDstBufferSize(int samples) ++int CActiveAEResample::GetDstBufferSize(int samples) +{ + return av_samples_get_buffer_size(NULL, m_dst_channels, samples, m_dst_fmt, 1); +} ++ ++uint64_t CActiveAEResample::GetAVChannelLayout(CAEChannelInfo &info) ++{ ++ uint64_t channelLayout = 0; ++ if (info.HasChannel(AE_CH_FL)) channelLayout |= AV_CH_FRONT_LEFT; ++ if (info.HasChannel(AE_CH_FR)) channelLayout |= AV_CH_FRONT_RIGHT; ++ if (info.HasChannel(AE_CH_FC)) channelLayout |= AV_CH_FRONT_CENTER; ++ if (info.HasChannel(AE_CH_LFE)) channelLayout |= AV_CH_LOW_FREQUENCY; ++ if (info.HasChannel(AE_CH_BL)) channelLayout |= AV_CH_BACK_LEFT; ++ if (info.HasChannel(AE_CH_BR)) channelLayout |= AV_CH_BACK_RIGHT; ++ if (info.HasChannel(AE_CH_FLOC)) channelLayout |= AV_CH_FRONT_LEFT_OF_CENTER; ++ if (info.HasChannel(AE_CH_FROC)) channelLayout |= AV_CH_FRONT_RIGHT_OF_CENTER; ++ if (info.HasChannel(AE_CH_BC)) channelLayout |= AV_CH_BACK_CENTER; ++ if (info.HasChannel(AE_CH_SL)) channelLayout |= AV_CH_SIDE_LEFT; ++ if (info.HasChannel(AE_CH_SR)) channelLayout |= AV_CH_SIDE_RIGHT; ++ if (info.HasChannel(AE_CH_TC)) channelLayout |= AV_CH_TOP_CENTER; ++ if (info.HasChannel(AE_CH_TFL)) channelLayout |= AV_CH_TOP_FRONT_LEFT; ++ if (info.HasChannel(AE_CH_TFC)) channelLayout |= AV_CH_TOP_FRONT_CENTER; ++ if (info.HasChannel(AE_CH_TFR)) channelLayout |= AV_CH_TOP_FRONT_RIGHT; ++ if (info.HasChannel(AE_CH_TBL)) channelLayout |= AV_CH_TOP_BACK_LEFT; ++ if (info.HasChannel(AE_CH_TBC)) channelLayout |= AV_CH_TOP_BACK_CENTER; ++ if (info.HasChannel(AE_CH_TBR)) channelLayout |= AV_CH_TOP_BACK_RIGHT; ++ ++ return channelLayout; ++} ++ ++//CAEChannelInfo CActiveAEResample::GetAEChannelLayout(uint64_t layout) ++//{ ++// CAEChannelInfo channelLayout; ++// channelLayout.Reset(); ++// ++// if (layout & AV_CH_FRONT_LEFT ) channelLayout += AE_CH_FL ; ++// if (layout & AV_CH_FRONT_RIGHT ) channelLayout += AE_CH_FR ; ++// if (layout & AV_CH_FRONT_CENTER ) channelLayout += AE_CH_FC ; ++// if (layout & AV_CH_LOW_FREQUENCY ) channelLayout += AE_CH_LFE ; ++// if (layout & AV_CH_BACK_LEFT ) channelLayout += AE_CH_BL ; ++// if (layout & AV_CH_BACK_RIGHT ) channelLayout += AE_CH_BR ; ++// if (layout & AV_CH_FRONT_LEFT_OF_CENTER ) channelLayout += AE_CH_FLOC; ++// if (layout & AV_CH_FRONT_RIGHT_OF_CENTER) channelLayout += AE_CH_FROC; ++// if (layout & AV_CH_BACK_CENTER ) channelLayout += AE_CH_BC ; ++// if (layout & AV_CH_SIDE_LEFT ) channelLayout += AE_CH_SL ; ++// if (layout & AV_CH_SIDE_RIGHT ) channelLayout += AE_CH_SR ; ++// if (layout & AV_CH_TOP_CENTER ) channelLayout += AE_CH_TC ; ++// if (layout & AV_CH_TOP_FRONT_LEFT ) channelLayout += AE_CH_TFL ; ++// if (layout & AV_CH_TOP_FRONT_CENTER ) channelLayout += AE_CH_TFC ; ++// if (layout & AV_CH_TOP_FRONT_RIGHT ) channelLayout += AE_CH_TFR ; ++// if (layout & AV_CH_TOP_BACK_LEFT ) channelLayout += AE_CH_BL ; ++// if (layout & AV_CH_TOP_BACK_CENTER ) channelLayout += AE_CH_BC ; ++// if (layout & AV_CH_TOP_BACK_RIGHT ) channelLayout += AE_CH_BR ; ++// ++// return channelLayout; ++//} ++ ++AVSampleFormat CActiveAEResample::GetAVSampleFormat(AEDataFormat format) ++{ ++ if (format == AE_FMT_U8) return AV_SAMPLE_FMT_U8; ++ else if (format == AE_FMT_S16NE) return AV_SAMPLE_FMT_S16; ++ else if (format == AE_FMT_S32NE) return AV_SAMPLE_FMT_S32; ++ else if (format == AE_FMT_S24NE4) return AV_SAMPLE_FMT_S32; ++ else if (format == AE_FMT_S24NE4MSB)return AV_SAMPLE_FMT_S32; ++ else if (format == AE_FMT_S24NE3) return AV_SAMPLE_FMT_S32; ++ else if (format == AE_FMT_FLOAT) return AV_SAMPLE_FMT_FLT; ++ else if (format == AE_FMT_DOUBLE) return AV_SAMPLE_FMT_DBL; ++ ++ else if (format == AE_FMT_U8P) return AV_SAMPLE_FMT_U8P; ++ else if (format == AE_FMT_S16NEP) return AV_SAMPLE_FMT_S16P; ++ else if (format == AE_FMT_S32NEP) return AV_SAMPLE_FMT_S32P; ++ else if (format == AE_FMT_S24NE4P) return AV_SAMPLE_FMT_S32P; ++ else if (format == AE_FMT_S24NE4MSBP)return AV_SAMPLE_FMT_S32P; ++ else if (format == AE_FMT_S24NE3P) return AV_SAMPLE_FMT_S32P; ++ else if (format == AE_FMT_FLOATP) return AV_SAMPLE_FMT_FLTP; ++ else if (format == AE_FMT_DOUBLEP) return AV_SAMPLE_FMT_DBLP; ++ ++ if (AE_IS_PLANAR(format)) ++ return AV_SAMPLE_FMT_FLTP; ++ else ++ return AV_SAMPLE_FMT_FLT; ++} ++ ++uint64_t CActiveAEResample::GetAVChannel(enum AEChannel aechannel) ++{ ++ switch (aechannel) ++ { ++ case AE_CH_FL: return AV_CH_FRONT_LEFT; ++ case AE_CH_FR: return AV_CH_FRONT_RIGHT; ++ case AE_CH_FC: return AV_CH_FRONT_CENTER; ++ case AE_CH_LFE: return AV_CH_LOW_FREQUENCY; ++ case AE_CH_BL: return AV_CH_BACK_LEFT; ++ case AE_CH_BR: return AV_CH_BACK_RIGHT; ++ case AE_CH_FLOC: return AV_CH_FRONT_LEFT_OF_CENTER; ++ case AE_CH_FROC: return AV_CH_FRONT_RIGHT_OF_CENTER; ++ case AE_CH_BC: return AV_CH_BACK_CENTER; ++ case AE_CH_SL: return AV_CH_SIDE_LEFT; ++ case AE_CH_SR: return AV_CH_SIDE_RIGHT; ++ case AE_CH_TC: return AV_CH_TOP_CENTER; ++ case AE_CH_TFL: return AV_CH_TOP_FRONT_LEFT; ++ case AE_CH_TFC: return AV_CH_TOP_FRONT_CENTER; ++ case AE_CH_TFR: return AV_CH_TOP_FRONT_RIGHT; ++ case AE_CH_TBL: return AV_CH_TOP_BACK_LEFT; ++ case AE_CH_TBC: return AV_CH_TOP_BACK_CENTER; ++ case AE_CH_TBR: return AV_CH_TOP_BACK_RIGHT; ++ default: ++ return 0; ++ } ++} ++ ++int CActiveAEResample::GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout) ++{ ++ return av_get_channel_layout_channel_index(layout, GetAVChannel(aechannel)); ++} diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h new file mode 100644 -index 0000000..2f11c8e +index 0000000..a471e02 --- /dev/null +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h -@@ -0,0 +1,62 @@ +@@ -0,0 +1,65 @@ +#pragma once +/* + * Copyright (C) 2010-2013 Team XBMC @@ -10387,7 +9912,6 @@ index 0000000..2f11c8e +#include "cores/AudioEngine/Utils/AEAudioFormat.h" +#include "cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h" +#include "cores/AudioEngine/Interfaces/AE.h" -+#include "cores/AudioEngine/Interfaces/AEResample.h" + +extern "C" { +#include "libavutil/avutil.h" @@ -10397,12 +9921,11 @@ index 0000000..2f11c8e +namespace ActiveAE +{ + -+class CActiveAEResampleFFMPEG : public IAEResample ++class CActiveAEResample +{ +public: -+ const char *GetName() { return "ActiveAEResampleFFMPEG"; } -+ CActiveAEResampleFFMPEG(); -+ virtual ~CActiveAEResampleFFMPEG(); ++ CActiveAEResample(); ++ virtual ~CActiveAEResample(); + bool Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, int dst_dither, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, int src_dither, bool upmix, bool normalize, CAEChannelInfo *remapLayout, AEQuality quality); + int Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, double ratio); + int64_t GetDelay(int64_t base); @@ -10410,6 +9933,11 @@ index 0000000..2f11c8e + int CalcDstSampleCount(int src_samples, int dst_rate, int src_rate); + int GetSrcBufferSize(int samples); + int GetDstBufferSize(int samples); ++ static uint64_t GetAVChannelLayout(CAEChannelInfo &info); ++// static CAEChannelInfo GetAEChannelLayout(uint64_t layout); ++ static AVSampleFormat GetAVSampleFormat(AEDataFormat format); ++ static uint64_t GetAVChannel(enum AEChannel aechannel); ++ int GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout); + +protected: + bool m_loaded; @@ -10424,8 +9952,865 @@ index 0000000..2f11c8e +}; + +} +diff --git a/xbmc/cores/AudioEngine/Makefile.in b/xbmc/cores/AudioEngine/Makefile.in +index 581249e..7e9b415 100644 +--- a/xbmc/cores/AudioEngine/Makefile.in ++++ b/xbmc/cores/AudioEngine/Makefile.in +@@ -30,7 +30,7 @@ SRCS += Engines/ActiveAE/ActiveAE.cpp + SRCS += Engines/ActiveAE/ActiveAESink.cpp + SRCS += Engines/ActiveAE/ActiveAEStream.cpp + SRCS += Engines/ActiveAE/ActiveAESound.cpp +-SRCS += Engines/ActiveAE/ActiveAEResample.cpp ++SRCS += Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp + SRCS += Engines/ActiveAE/ActiveAEBuffer.cpp + + ifeq (@USE_ANDROID@,1) + +From bf25defc12be2108df18dea848ea316bab7d8535 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Sat, 4 Oct 2014 22:51:26 +0100 +Subject: [PATCH 82/96] [AE] Move utility functions to AEUtil + +--- + .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 4 +- + .../Engines/ActiveAE/ActiveAEBuffer.cpp | 20 ++-- + .../Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp | 114 +-------------------- + .../Engines/ActiveAE/ActiveAEResampleFFMPEG.h | 8 -- + .../AudioEngine/Engines/ActiveAE/ActiveAESink.cpp | 4 +- + .../Engines/ActiveAE/ActiveAEStream.cpp | 12 +-- + xbmc/cores/AudioEngine/Utils/AEUtil.cpp | 87 ++++++++++++++++ + xbmc/cores/AudioEngine/Utils/AEUtil.h | 9 ++ + xbmc/cores/paplayer/DVDPlayerCodec.cpp | 8 +- + 9 files changed, 122 insertions(+), 144 deletions(-) + +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +index 0eda1d2..e30f105 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +@@ -2676,10 +2676,10 @@ bool CActiveAE::ResampleSound(CActiveAESound *sound) + + orig_config = sound->GetSound(true)->config; + +- dst_config.channel_layout = CActiveAEResample::GetAVChannelLayout(m_internalFormat.m_channelLayout); ++ dst_config.channel_layout = CAEUtil::GetAVChannelLayout(m_internalFormat.m_channelLayout); + dst_config.channels = m_internalFormat.m_channelLayout.Count(); + dst_config.sample_rate = m_internalFormat.m_sampleRate; +- dst_config.fmt = CActiveAEResample::GetAVSampleFormat(m_internalFormat.m_dataFormat); ++ dst_config.fmt = CAEUtil::GetAVSampleFormat(m_internalFormat.m_dataFormat); + dst_config.bits_per_sample = CAEUtil::DataFormatToUsedBits(m_internalFormat.m_dataFormat); + dst_config.dither_bits = CAEUtil::DataFormatToDitherBits(m_internalFormat.m_dataFormat); + +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp +index 9e834c6..15bd898 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp +@@ -107,12 +107,12 @@ bool CActiveAEBufferPool::Create(unsigned int totaltime) + { + CSampleBuffer *buffer; + SampleConfig config; +- config.fmt = CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat); ++ config.fmt = CAEUtil::GetAVSampleFormat(m_format.m_dataFormat); + config.bits_per_sample = CAEUtil::DataFormatToUsedBits(m_format.m_dataFormat); + config.dither_bits = CAEUtil::DataFormatToDitherBits(m_format.m_dataFormat); + config.channels = m_format.m_channelLayout.Count(); + config.sample_rate = m_format.m_sampleRate; +- config.channel_layout = CActiveAEResample::GetAVChannelLayout(m_format.m_channelLayout); ++ config.channel_layout = CAEUtil::GetAVChannelLayout(m_format.m_channelLayout); + + unsigned int time = 0; + unsigned int buffertime = (m_format.m_frames*1000) / m_format.m_sampleRate; +@@ -172,16 +172,16 @@ bool CActiveAEBufferPoolResample::Create(unsigned int totaltime, bool remap, boo + m_changeResampler) + { + m_resampler = new CActiveAEResample(); +- m_resampler->Init(CActiveAEResample::GetAVChannelLayout(m_format.m_channelLayout), ++ m_resampler->Init(CAEUtil::GetAVChannelLayout(m_format.m_channelLayout), + m_format.m_channelLayout.Count(), + m_format.m_sampleRate, +- CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat), ++ CAEUtil::GetAVSampleFormat(m_format.m_dataFormat), + CAEUtil::DataFormatToUsedBits(m_format.m_dataFormat), + CAEUtil::DataFormatToDitherBits(m_format.m_dataFormat), +- CActiveAEResample::GetAVChannelLayout(m_inputFormat.m_channelLayout), ++ CAEUtil::GetAVChannelLayout(m_inputFormat.m_channelLayout), + m_inputFormat.m_channelLayout.Count(), + m_inputFormat.m_sampleRate, +- CActiveAEResample::GetAVSampleFormat(m_inputFormat.m_dataFormat), ++ CAEUtil::GetAVSampleFormat(m_inputFormat.m_dataFormat), + CAEUtil::DataFormatToUsedBits(m_inputFormat.m_dataFormat), + CAEUtil::DataFormatToDitherBits(m_inputFormat.m_dataFormat), + upmix, +@@ -200,16 +200,16 @@ void CActiveAEBufferPoolResample::ChangeResampler() + delete m_resampler; + + m_resampler = new CActiveAEResample(); +- m_resampler->Init(CActiveAEResample::GetAVChannelLayout(m_format.m_channelLayout), ++ m_resampler->Init(CAEUtil::GetAVChannelLayout(m_format.m_channelLayout), + m_format.m_channelLayout.Count(), + m_format.m_sampleRate, +- CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat), ++ CAEUtil::GetAVSampleFormat(m_format.m_dataFormat), + CAEUtil::DataFormatToUsedBits(m_format.m_dataFormat), + CAEUtil::DataFormatToDitherBits(m_format.m_dataFormat), +- CActiveAEResample::GetAVChannelLayout(m_inputFormat.m_channelLayout), ++ CAEUtil::GetAVChannelLayout(m_inputFormat.m_channelLayout), + m_inputFormat.m_channelLayout.Count(), + m_inputFormat.m_sampleRate, +- CActiveAEResample::GetAVSampleFormat(m_inputFormat.m_dataFormat), ++ CAEUtil::GetAVSampleFormat(m_inputFormat.m_dataFormat), + CAEUtil::DataFormatToUsedBits(m_inputFormat.m_dataFormat), + CAEUtil::DataFormatToDitherBits(m_inputFormat.m_dataFormat), + m_stereoUpmix, +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp +index d7e0e0f..de08de9 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp +@@ -18,7 +18,7 @@ + * + */ + +-#include "ActiveAEResample.h" ++#include "cores/AudioEngine/Utils/AEUtil.h" + #include "utils/log.h" + + extern "C" { +@@ -115,7 +115,7 @@ bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst + for (unsigned int out=0; outCount(); out++) + { + m_dst_chan_layout += (uint64_t) (1 << out); +- int idx = GetAVChannelIndex((*remapLayout)[out], m_src_chan_layout); ++ int idx = CAEUtil::GetAVChannelIndex((*remapLayout)[out], m_src_chan_layout); + if (idx >= 0) + { + m_rematrix[out][idx] = 1.0; +@@ -276,113 +276,3 @@ int CActiveAEResample::GetDstBufferSize(int samples) + { + return av_samples_get_buffer_size(NULL, m_dst_channels, samples, m_dst_fmt, 1); + } +- +-uint64_t CActiveAEResample::GetAVChannelLayout(CAEChannelInfo &info) +-{ +- uint64_t channelLayout = 0; +- if (info.HasChannel(AE_CH_FL)) channelLayout |= AV_CH_FRONT_LEFT; +- if (info.HasChannel(AE_CH_FR)) channelLayout |= AV_CH_FRONT_RIGHT; +- if (info.HasChannel(AE_CH_FC)) channelLayout |= AV_CH_FRONT_CENTER; +- if (info.HasChannel(AE_CH_LFE)) channelLayout |= AV_CH_LOW_FREQUENCY; +- if (info.HasChannel(AE_CH_BL)) channelLayout |= AV_CH_BACK_LEFT; +- if (info.HasChannel(AE_CH_BR)) channelLayout |= AV_CH_BACK_RIGHT; +- if (info.HasChannel(AE_CH_FLOC)) channelLayout |= AV_CH_FRONT_LEFT_OF_CENTER; +- if (info.HasChannel(AE_CH_FROC)) channelLayout |= AV_CH_FRONT_RIGHT_OF_CENTER; +- if (info.HasChannel(AE_CH_BC)) channelLayout |= AV_CH_BACK_CENTER; +- if (info.HasChannel(AE_CH_SL)) channelLayout |= AV_CH_SIDE_LEFT; +- if (info.HasChannel(AE_CH_SR)) channelLayout |= AV_CH_SIDE_RIGHT; +- if (info.HasChannel(AE_CH_TC)) channelLayout |= AV_CH_TOP_CENTER; +- if (info.HasChannel(AE_CH_TFL)) channelLayout |= AV_CH_TOP_FRONT_LEFT; +- if (info.HasChannel(AE_CH_TFC)) channelLayout |= AV_CH_TOP_FRONT_CENTER; +- if (info.HasChannel(AE_CH_TFR)) channelLayout |= AV_CH_TOP_FRONT_RIGHT; +- if (info.HasChannel(AE_CH_TBL)) channelLayout |= AV_CH_TOP_BACK_LEFT; +- if (info.HasChannel(AE_CH_TBC)) channelLayout |= AV_CH_TOP_BACK_CENTER; +- if (info.HasChannel(AE_CH_TBR)) channelLayout |= AV_CH_TOP_BACK_RIGHT; +- +- return channelLayout; +-} +- +-//CAEChannelInfo CActiveAEResample::GetAEChannelLayout(uint64_t layout) +-//{ +-// CAEChannelInfo channelLayout; +-// channelLayout.Reset(); +-// +-// if (layout & AV_CH_FRONT_LEFT ) channelLayout += AE_CH_FL ; +-// if (layout & AV_CH_FRONT_RIGHT ) channelLayout += AE_CH_FR ; +-// if (layout & AV_CH_FRONT_CENTER ) channelLayout += AE_CH_FC ; +-// if (layout & AV_CH_LOW_FREQUENCY ) channelLayout += AE_CH_LFE ; +-// if (layout & AV_CH_BACK_LEFT ) channelLayout += AE_CH_BL ; +-// if (layout & AV_CH_BACK_RIGHT ) channelLayout += AE_CH_BR ; +-// if (layout & AV_CH_FRONT_LEFT_OF_CENTER ) channelLayout += AE_CH_FLOC; +-// if (layout & AV_CH_FRONT_RIGHT_OF_CENTER) channelLayout += AE_CH_FROC; +-// if (layout & AV_CH_BACK_CENTER ) channelLayout += AE_CH_BC ; +-// if (layout & AV_CH_SIDE_LEFT ) channelLayout += AE_CH_SL ; +-// if (layout & AV_CH_SIDE_RIGHT ) channelLayout += AE_CH_SR ; +-// if (layout & AV_CH_TOP_CENTER ) channelLayout += AE_CH_TC ; +-// if (layout & AV_CH_TOP_FRONT_LEFT ) channelLayout += AE_CH_TFL ; +-// if (layout & AV_CH_TOP_FRONT_CENTER ) channelLayout += AE_CH_TFC ; +-// if (layout & AV_CH_TOP_FRONT_RIGHT ) channelLayout += AE_CH_TFR ; +-// if (layout & AV_CH_TOP_BACK_LEFT ) channelLayout += AE_CH_BL ; +-// if (layout & AV_CH_TOP_BACK_CENTER ) channelLayout += AE_CH_BC ; +-// if (layout & AV_CH_TOP_BACK_RIGHT ) channelLayout += AE_CH_BR ; +-// +-// return channelLayout; +-//} +- +-AVSampleFormat CActiveAEResample::GetAVSampleFormat(AEDataFormat format) +-{ +- if (format == AE_FMT_U8) return AV_SAMPLE_FMT_U8; +- else if (format == AE_FMT_S16NE) return AV_SAMPLE_FMT_S16; +- else if (format == AE_FMT_S32NE) return AV_SAMPLE_FMT_S32; +- else if (format == AE_FMT_S24NE4) return AV_SAMPLE_FMT_S32; +- else if (format == AE_FMT_S24NE4MSB)return AV_SAMPLE_FMT_S32; +- else if (format == AE_FMT_S24NE3) return AV_SAMPLE_FMT_S32; +- else if (format == AE_FMT_FLOAT) return AV_SAMPLE_FMT_FLT; +- else if (format == AE_FMT_DOUBLE) return AV_SAMPLE_FMT_DBL; +- +- else if (format == AE_FMT_U8P) return AV_SAMPLE_FMT_U8P; +- else if (format == AE_FMT_S16NEP) return AV_SAMPLE_FMT_S16P; +- else if (format == AE_FMT_S32NEP) return AV_SAMPLE_FMT_S32P; +- else if (format == AE_FMT_S24NE4P) return AV_SAMPLE_FMT_S32P; +- else if (format == AE_FMT_S24NE4MSBP)return AV_SAMPLE_FMT_S32P; +- else if (format == AE_FMT_S24NE3P) return AV_SAMPLE_FMT_S32P; +- else if (format == AE_FMT_FLOATP) return AV_SAMPLE_FMT_FLTP; +- else if (format == AE_FMT_DOUBLEP) return AV_SAMPLE_FMT_DBLP; +- +- if (AE_IS_PLANAR(format)) +- return AV_SAMPLE_FMT_FLTP; +- else +- return AV_SAMPLE_FMT_FLT; +-} +- +-uint64_t CActiveAEResample::GetAVChannel(enum AEChannel aechannel) +-{ +- switch (aechannel) +- { +- case AE_CH_FL: return AV_CH_FRONT_LEFT; +- case AE_CH_FR: return AV_CH_FRONT_RIGHT; +- case AE_CH_FC: return AV_CH_FRONT_CENTER; +- case AE_CH_LFE: return AV_CH_LOW_FREQUENCY; +- case AE_CH_BL: return AV_CH_BACK_LEFT; +- case AE_CH_BR: return AV_CH_BACK_RIGHT; +- case AE_CH_FLOC: return AV_CH_FRONT_LEFT_OF_CENTER; +- case AE_CH_FROC: return AV_CH_FRONT_RIGHT_OF_CENTER; +- case AE_CH_BC: return AV_CH_BACK_CENTER; +- case AE_CH_SL: return AV_CH_SIDE_LEFT; +- case AE_CH_SR: return AV_CH_SIDE_RIGHT; +- case AE_CH_TC: return AV_CH_TOP_CENTER; +- case AE_CH_TFL: return AV_CH_TOP_FRONT_LEFT; +- case AE_CH_TFC: return AV_CH_TOP_FRONT_CENTER; +- case AE_CH_TFR: return AV_CH_TOP_FRONT_RIGHT; +- case AE_CH_TBL: return AV_CH_TOP_BACK_LEFT; +- case AE_CH_TBC: return AV_CH_TOP_BACK_CENTER; +- case AE_CH_TBR: return AV_CH_TOP_BACK_RIGHT; +- default: +- return 0; +- } +-} +- +-int CActiveAEResample::GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout) +-{ +- return av_get_channel_layout_channel_index(layout, GetAVChannel(aechannel)); +-} +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h +index a471e02..f9bdfec 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h +@@ -19,9 +19,6 @@ + * + */ + +-#include "cores/AudioEngine/Utils/AEChannelInfo.h" +-#include "cores/AudioEngine/Utils/AEAudioFormat.h" +-#include "cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h" + #include "cores/AudioEngine/Interfaces/AE.h" + + extern "C" { +@@ -44,11 +41,6 @@ class CActiveAEResample + int CalcDstSampleCount(int src_samples, int dst_rate, int src_rate); + int GetSrcBufferSize(int samples); + int GetDstBufferSize(int samples); +- static uint64_t GetAVChannelLayout(CAEChannelInfo &info); +-// static CAEChannelInfo GetAEChannelLayout(uint64_t layout); +- static AVSampleFormat GetAVSampleFormat(AEDataFormat format); +- static uint64_t GetAVChannel(enum AEChannel aechannel); +- int GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout); + + protected: + bool m_loaded; diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp -index d9f4a43..52e87a0 100644 +index d9f4a43..6d4d3b1 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp +@@ -754,10 +754,10 @@ void CActiveAESink::OpenSink() + + // init sample of silence + SampleConfig config; +- config.fmt = CActiveAEResample::GetAVSampleFormat(m_sinkFormat.m_dataFormat); ++ config.fmt = CAEUtil::GetAVSampleFormat(m_sinkFormat.m_dataFormat); + config.bits_per_sample = CAEUtil::DataFormatToUsedBits(m_sinkFormat.m_dataFormat); + config.dither_bits = CAEUtil::DataFormatToDitherBits(m_sinkFormat.m_dataFormat); +- config.channel_layout = CActiveAEResample::GetAVChannelLayout(m_sinkFormat.m_channelLayout); ++ config.channel_layout = CAEUtil::GetAVChannelLayout(m_sinkFormat.m_channelLayout); + config.channels = m_sinkFormat.m_channelLayout.Count(); + config.sample_rate = m_sinkFormat.m_sampleRate; + +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp +index 7acc0d0..e9a292f 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp +@@ -94,7 +94,7 @@ void CActiveAEStream::InitRemapper() + for(unsigned int i=0; iGetAVChannelIndex(m_format.m_channelLayout[j], avLayout); ++ idx = CAEUtil::GetAVChannelIndex(m_format.m_channelLayout[j], avLayout); + if (idx == (int)i) + { + ffmpegLayout += m_format.m_channelLayout[j]; +@@ -134,7 +134,7 @@ void CActiveAEStream::InitRemapper() + { + for(unsigned int j=0; jGetAVChannelIndex(m_format.m_channelLayout[j], avLayout); ++ idx = CAEUtil::GetAVChannelIndex(m_format.m_channelLayout[j], avLayout); + if (idx == (int)i) + { + remapLayout += ffmpegLayout[j]; +@@ -147,13 +147,13 @@ void CActiveAEStream::InitRemapper() + m_remapper->Init(avLayout, + m_format.m_channelLayout.Count(), + m_format.m_sampleRate, +- CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat), ++ CAEUtil::GetAVSampleFormat(m_format.m_dataFormat), + CAEUtil::DataFormatToUsedBits(m_format.m_dataFormat), + CAEUtil::DataFormatToDitherBits(m_format.m_dataFormat), + avLayout, + m_format.m_channelLayout.Count(), + m_format.m_sampleRate, +- CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat), ++ CAEUtil::GetAVSampleFormat(m_format.m_dataFormat), + CAEUtil::DataFormatToUsedBits(m_format.m_dataFormat), + CAEUtil::DataFormatToDitherBits(m_format.m_dataFormat), + false, +diff --git a/xbmc/cores/AudioEngine/Utils/AEUtil.cpp b/xbmc/cores/AudioEngine/Utils/AEUtil.cpp +index 44cf256..f535512 100644 +--- a/xbmc/cores/AudioEngine/Utils/AEUtil.cpp ++++ b/xbmc/cores/AudioEngine/Utils/AEUtil.cpp +@@ -25,6 +25,10 @@ + #include "utils/log.h" + #include "utils/TimeUtils.h" + ++extern "C" { ++#include "libavutil/channel_layout.h" ++} ++ + using namespace std; + + /* declare the rng seed and initialize it */ +@@ -526,3 +530,86 @@ bool CAEUtil::S16NeedsByteSwap(AEDataFormat in, AEDataFormat out) + + return in != out; + } ++ ++uint64_t CAEUtil::GetAVChannelLayout(CAEChannelInfo &info) ++{ ++ uint64_t channelLayout = 0; ++ if (info.HasChannel(AE_CH_FL)) channelLayout |= AV_CH_FRONT_LEFT; ++ if (info.HasChannel(AE_CH_FR)) channelLayout |= AV_CH_FRONT_RIGHT; ++ if (info.HasChannel(AE_CH_FC)) channelLayout |= AV_CH_FRONT_CENTER; ++ if (info.HasChannel(AE_CH_LFE)) channelLayout |= AV_CH_LOW_FREQUENCY; ++ if (info.HasChannel(AE_CH_BL)) channelLayout |= AV_CH_BACK_LEFT; ++ if (info.HasChannel(AE_CH_BR)) channelLayout |= AV_CH_BACK_RIGHT; ++ if (info.HasChannel(AE_CH_FLOC)) channelLayout |= AV_CH_FRONT_LEFT_OF_CENTER; ++ if (info.HasChannel(AE_CH_FROC)) channelLayout |= AV_CH_FRONT_RIGHT_OF_CENTER; ++ if (info.HasChannel(AE_CH_BC)) channelLayout |= AV_CH_BACK_CENTER; ++ if (info.HasChannel(AE_CH_SL)) channelLayout |= AV_CH_SIDE_LEFT; ++ if (info.HasChannel(AE_CH_SR)) channelLayout |= AV_CH_SIDE_RIGHT; ++ if (info.HasChannel(AE_CH_TC)) channelLayout |= AV_CH_TOP_CENTER; ++ if (info.HasChannel(AE_CH_TFL)) channelLayout |= AV_CH_TOP_FRONT_LEFT; ++ if (info.HasChannel(AE_CH_TFC)) channelLayout |= AV_CH_TOP_FRONT_CENTER; ++ if (info.HasChannel(AE_CH_TFR)) channelLayout |= AV_CH_TOP_FRONT_RIGHT; ++ if (info.HasChannel(AE_CH_TBL)) channelLayout |= AV_CH_TOP_BACK_LEFT; ++ if (info.HasChannel(AE_CH_TBC)) channelLayout |= AV_CH_TOP_BACK_CENTER; ++ if (info.HasChannel(AE_CH_TBR)) channelLayout |= AV_CH_TOP_BACK_RIGHT; ++ ++ return channelLayout; ++} ++ ++AVSampleFormat CAEUtil::GetAVSampleFormat(AEDataFormat format) ++{ ++ if (format == AE_FMT_U8) return AV_SAMPLE_FMT_U8; ++ else if (format == AE_FMT_S16NE) return AV_SAMPLE_FMT_S16; ++ else if (format == AE_FMT_S32NE) return AV_SAMPLE_FMT_S32; ++ else if (format == AE_FMT_S24NE4) return AV_SAMPLE_FMT_S32; ++ else if (format == AE_FMT_S24NE4MSB)return AV_SAMPLE_FMT_S32; ++ else if (format == AE_FMT_S24NE3) return AV_SAMPLE_FMT_S32; ++ else if (format == AE_FMT_FLOAT) return AV_SAMPLE_FMT_FLT; ++ else if (format == AE_FMT_DOUBLE) return AV_SAMPLE_FMT_DBL; ++ ++ else if (format == AE_FMT_U8P) return AV_SAMPLE_FMT_U8P; ++ else if (format == AE_FMT_S16NEP) return AV_SAMPLE_FMT_S16P; ++ else if (format == AE_FMT_S32NEP) return AV_SAMPLE_FMT_S32P; ++ else if (format == AE_FMT_S24NE4P) return AV_SAMPLE_FMT_S32P; ++ else if (format == AE_FMT_S24NE4MSBP)return AV_SAMPLE_FMT_S32P; ++ else if (format == AE_FMT_S24NE3P) return AV_SAMPLE_FMT_S32P; ++ else if (format == AE_FMT_FLOATP) return AV_SAMPLE_FMT_FLTP; ++ else if (format == AE_FMT_DOUBLEP) return AV_SAMPLE_FMT_DBLP; ++ ++ if (AE_IS_PLANAR(format)) ++ return AV_SAMPLE_FMT_FLTP; ++ else ++ return AV_SAMPLE_FMT_FLT; ++} ++ ++uint64_t CAEUtil::GetAVChannel(enum AEChannel aechannel) ++{ ++ switch (aechannel) ++ { ++ case AE_CH_FL: return AV_CH_FRONT_LEFT; ++ case AE_CH_FR: return AV_CH_FRONT_RIGHT; ++ case AE_CH_FC: return AV_CH_FRONT_CENTER; ++ case AE_CH_LFE: return AV_CH_LOW_FREQUENCY; ++ case AE_CH_BL: return AV_CH_BACK_LEFT; ++ case AE_CH_BR: return AV_CH_BACK_RIGHT; ++ case AE_CH_FLOC: return AV_CH_FRONT_LEFT_OF_CENTER; ++ case AE_CH_FROC: return AV_CH_FRONT_RIGHT_OF_CENTER; ++ case AE_CH_BC: return AV_CH_BACK_CENTER; ++ case AE_CH_SL: return AV_CH_SIDE_LEFT; ++ case AE_CH_SR: return AV_CH_SIDE_RIGHT; ++ case AE_CH_TC: return AV_CH_TOP_CENTER; ++ case AE_CH_TFL: return AV_CH_TOP_FRONT_LEFT; ++ case AE_CH_TFC: return AV_CH_TOP_FRONT_CENTER; ++ case AE_CH_TFR: return AV_CH_TOP_FRONT_RIGHT; ++ case AE_CH_TBL: return AV_CH_TOP_BACK_LEFT; ++ case AE_CH_TBC: return AV_CH_TOP_BACK_CENTER; ++ case AE_CH_TBR: return AV_CH_TOP_BACK_RIGHT; ++ default: ++ return 0; ++ } ++} ++ ++int CAEUtil::GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout) ++{ ++ return av_get_channel_layout_channel_index(layout, GetAVChannel(aechannel)); ++} +diff --git a/xbmc/cores/AudioEngine/Utils/AEUtil.h b/xbmc/cores/AudioEngine/Utils/AEUtil.h +index 039cd69..3e0390c 100644 +--- a/xbmc/cores/AudioEngine/Utils/AEUtil.h ++++ b/xbmc/cores/AudioEngine/Utils/AEUtil.h +@@ -23,6 +23,10 @@ + #include "PlatformDefs.h" + #include + ++extern "C" { ++#include "libavutil/samplefmt.h" ++} ++ + #ifdef TARGET_WINDOWS + #if _M_IX86_FP>0 && !defined(__SSE__) + #define __SSE__ +@@ -221,4 +225,9 @@ class CAEUtil + static void FloatRand4(const float min, const float max, float result[4], __m128 *sseresult = NULL); + + static bool S16NeedsByteSwap(AEDataFormat in, AEDataFormat out); ++ ++ static uint64_t GetAVChannelLayout(CAEChannelInfo &info); ++ static AVSampleFormat GetAVSampleFormat(AEDataFormat format); ++ static uint64_t GetAVChannel(enum AEChannel aechannel); ++ static int GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout); + }; +diff --git a/xbmc/cores/paplayer/DVDPlayerCodec.cpp b/xbmc/cores/paplayer/DVDPlayerCodec.cpp +index c619b32..a85a7bc 100644 +--- a/xbmc/cores/paplayer/DVDPlayerCodec.cpp ++++ b/xbmc/cores/paplayer/DVDPlayerCodec.cpp +@@ -235,16 +235,16 @@ bool DVDPlayerCodec::Init(const std::string &strFile, unsigned int filecache) + { + m_needConvert = true; + m_pResampler = new ActiveAE::CActiveAEResample(); +- m_pResampler->Init(ActiveAE::CActiveAEResample::GetAVChannelLayout(m_ChannelInfo), ++ m_pResampler->Init(CAEUtil::GetAVChannelLayout(m_ChannelInfo), + m_ChannelInfo.Count(), + m_SampleRate, +- ActiveAE::CActiveAEResample::GetAVSampleFormat(AE_FMT_FLOAT), ++ CAEUtil::GetAVSampleFormat(AE_FMT_FLOAT), + CAEUtil::DataFormatToUsedBits(AE_FMT_FLOAT), + CAEUtil::DataFormatToDitherBits(AE_FMT_FLOAT), +- ActiveAE::CActiveAEResample::GetAVChannelLayout(m_ChannelInfo), ++ CAEUtil::GetAVChannelLayout(m_ChannelInfo), + m_ChannelInfo.Count(), + m_SampleRate, +- ActiveAE::CActiveAEResample::GetAVSampleFormat(m_DataFormat), ++ CAEUtil::GetAVSampleFormat(m_DataFormat), + CAEUtil::DataFormatToUsedBits(m_DataFormat), + CAEUtil::DataFormatToDitherBits(m_DataFormat), + false, + +From 91916182e9ea47016b5e4e2828abb14b4d14b505 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Sat, 4 Oct 2014 22:52:07 +0100 +Subject: [PATCH 83/96] [AE] Add factory for AEResampler + +--- + xbmc/cores/AudioEngine/AEResampleFactory.cpp | 32 +++++++++++++++ + xbmc/cores/AudioEngine/AEResampleFactory.h | 35 ++++++++++++++++ + .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 3 +- + xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 4 +- + .../Engines/ActiveAE/ActiveAEBuffer.cpp | 5 ++- + .../AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h | 4 +- + .../Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp | 31 +++++++------- + .../Engines/ActiveAE/ActiveAEResampleFFMPEG.h | 13 +++--- + .../AudioEngine/Engines/ActiveAE/ActiveAESink.cpp | 8 ++-- + .../AudioEngine/Engines/ActiveAE/ActiveAESink.h | 3 +- + .../AudioEngine/Engines/ActiveAE/ActiveAESound.h | 1 - + .../Engines/ActiveAE/ActiveAEStream.cpp | 3 +- + .../AudioEngine/Engines/ActiveAE/ActiveAEStream.h | 2 +- + xbmc/cores/AudioEngine/Interfaces/AEResample.h | 47 ++++++++++++++++++++++ + xbmc/cores/AudioEngine/Makefile.in | 2 + + xbmc/cores/paplayer/DVDPlayerCodec.cpp | 4 +- + xbmc/cores/paplayer/DVDPlayerCodec.h | 4 +- + 17 files changed, 164 insertions(+), 37 deletions(-) + create mode 100644 xbmc/cores/AudioEngine/AEResampleFactory.cpp + create mode 100644 xbmc/cores/AudioEngine/AEResampleFactory.h + create mode 100644 xbmc/cores/AudioEngine/Interfaces/AEResample.h + +diff --git a/xbmc/cores/AudioEngine/AEResampleFactory.cpp b/xbmc/cores/AudioEngine/AEResampleFactory.cpp +new file mode 100644 +index 0000000..d135054 +--- /dev/null ++++ b/xbmc/cores/AudioEngine/AEResampleFactory.cpp +@@ -0,0 +1,32 @@ ++/* ++ * Copyright (C) 2010-2013 Team XBMC ++ * http://xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * . ++ * ++ */ ++ ++#include "AEResampleFactory.h" ++#include "cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h" ++ ++namespace ActiveAE ++{ ++ ++IAEResample *CAEResampleFactory::Create() ++{ ++ return new CActiveAEResampleFFMPEG(); ++} ++ ++} +diff --git a/xbmc/cores/AudioEngine/AEResampleFactory.h b/xbmc/cores/AudioEngine/AEResampleFactory.h +new file mode 100644 +index 0000000..10b551e +--- /dev/null ++++ b/xbmc/cores/AudioEngine/AEResampleFactory.h +@@ -0,0 +1,35 @@ ++#pragma once ++/* ++ * Copyright (C) 2010-2013 Team XBMC ++ * http://xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * . ++ * ++ */ ++ ++#include "cores/AudioEngine/Interfaces/AEResample.h" ++ ++class IAEResample; ++ ++namespace ActiveAE ++{ ++ ++class CAEResampleFactory ++{ ++public: ++ static IAEResample *Create(); ++}; ++ ++} +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +index e30f105..a854ab3 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +@@ -24,6 +24,7 @@ using namespace ActiveAE; + #include "ActiveAESound.h" + #include "ActiveAEStream.h" + #include "cores/AudioEngine/Utils/AEUtil.h" ++#include "cores/AudioEngine/AEResampleFactory.h" + #include "cores/AudioEngine/Encoders/AEEncoderFFmpeg.h" + + #include "settings/Settings.h" +@@ -2683,7 +2684,7 @@ bool CActiveAE::ResampleSound(CActiveAESound *sound) + dst_config.bits_per_sample = CAEUtil::DataFormatToUsedBits(m_internalFormat.m_dataFormat); + dst_config.dither_bits = CAEUtil::DataFormatToDitherBits(m_internalFormat.m_dataFormat); + +- CActiveAEResample *resampler = new CActiveAEResample(); ++ IAEResample *resampler = CAEResampleFactory::Create(); + resampler->Init(dst_config.channel_layout, + dst_config.channels, + dst_config.sample_rate, +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h +index de94850..1d12c1b 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h +@@ -23,10 +23,12 @@ + #include "threads/Thread.h" + + #include "ActiveAESink.h" +-#include "ActiveAEResample.h" ++#include "cores/AudioEngine/Interfaces/AEResample.h" + #include "cores/AudioEngine/Interfaces/AEStream.h" + #include "cores/AudioEngine/Interfaces/AESound.h" + #include "cores/AudioEngine/AEFactory.h" ++#include "cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h" ++ + #include "guilib/DispResource.h" + #include + +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp +index 15bd898..e40ac2e 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp +@@ -22,6 +22,7 @@ + #include "cores/AudioEngine/AEFactory.h" + #include "cores/AudioEngine/Engines/ActiveAE/ActiveAE.h" + #include "cores/AudioEngine/Utils/AEUtil.h" ++#include "cores/AudioEngine/AEResampleFactory.h" + + using namespace ActiveAE; + +@@ -171,7 +172,7 @@ bool CActiveAEBufferPoolResample::Create(unsigned int totaltime, bool remap, boo + m_inputFormat.m_dataFormat != m_format.m_dataFormat || + m_changeResampler) + { +- m_resampler = new CActiveAEResample(); ++ m_resampler = CAEResampleFactory::Create(); + m_resampler->Init(CAEUtil::GetAVChannelLayout(m_format.m_channelLayout), + m_format.m_channelLayout.Count(), + m_format.m_sampleRate, +@@ -199,7 +200,7 @@ void CActiveAEBufferPoolResample::ChangeResampler() + { + delete m_resampler; + +- m_resampler = new CActiveAEResample(); ++ m_resampler = CAEResampleFactory::Create(); + m_resampler->Init(CAEUtil::GetAVChannelLayout(m_format.m_channelLayout), + m_format.m_channelLayout.Count(), + m_format.m_sampleRate, +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h +index b0912be..961db98 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h +@@ -89,7 +89,7 @@ class CActiveAEBufferPool + std::deque m_freeSamples; + }; + +-class CActiveAEResample; ++class IAEResample; + + class CActiveAEBufferPoolResample : public CActiveAEBufferPool + { +@@ -105,7 +105,7 @@ class CActiveAEBufferPoolResample : public CActiveAEBufferPool + std::deque m_inputSamples; + std::deque m_outputSamples; + CSampleBuffer *m_procSample; +- CActiveAEResample *m_resampler; ++ IAEResample *m_resampler; + uint8_t *m_planes[16]; + bool m_fillPackets; + bool m_drain; +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp +index de08de9..26f0140 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp +@@ -19,6 +19,7 @@ + */ + + #include "cores/AudioEngine/Utils/AEUtil.h" ++#include "ActiveAEResampleFFMPEG.h" + #include "utils/log.h" + + extern "C" { +@@ -29,19 +30,19 @@ extern "C" { + + using namespace ActiveAE; + +-CActiveAEResample::CActiveAEResample() ++CActiveAEResampleFFMPEG::CActiveAEResampleFFMPEG() + { + m_pContext = NULL; + m_loaded = true; + } + +-CActiveAEResample::~CActiveAEResample() ++CActiveAEResampleFFMPEG::~CActiveAEResampleFFMPEG() + { + if (m_pContext) + swr_free(&m_pContext); + } + +-bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, int dst_dither, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, int src_dither, bool upmix, bool normalize, CAEChannelInfo *remapLayout, AEQuality quality) ++bool CActiveAEResampleFFMPEG::Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, int dst_dither, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, int src_dither, bool upmix, bool normalize, CAEChannelInfo *remapLayout, AEQuality quality) + { + if (!m_loaded) + return false; +@@ -70,7 +71,7 @@ bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst + + if(!m_pContext) + { +- CLog::Log(LOGERROR, "CActiveAEResample::Init - create context failed"); ++ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Init - create context failed"); + return false; + } + +@@ -127,7 +128,7 @@ bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst + + if (swr_set_matrix(m_pContext, (const double*)m_rematrix, AE_CH_MAX) < 0) + { +- CLog::Log(LOGERROR, "CActiveAEResample::Init - setting channel matrix failed"); ++ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Init - setting channel matrix failed"); + return false; + } + } +@@ -165,20 +166,20 @@ bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst + + if (swr_set_matrix(m_pContext, (const double*)m_rematrix, AE_CH_MAX) < 0) + { +- CLog::Log(LOGERROR, "CActiveAEResample::Init - setting channel matrix failed"); ++ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Init - setting channel matrix failed"); + return false; + } + } + + if(swr_init(m_pContext) < 0) + { +- CLog::Log(LOGERROR, "CActiveAEResample::Init - init resampler failed"); ++ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Init - init resampler failed"); + return false; + } + return true; + } + +-int CActiveAEResample::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, double ratio) ++int CActiveAEResampleFFMPEG::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, double ratio) + { + if (ratio != 1.0) + { +@@ -186,7 +187,7 @@ int CActiveAEResample::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t * + (dst_samples*ratio-dst_samples)*m_dst_rate/m_src_rate, + dst_samples*m_dst_rate/m_src_rate) < 0) + { +- CLog::Log(LOGERROR, "CActiveAEResample::Resample - set compensation failed"); ++ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Resample - set compensation failed"); + return 0; + } + } +@@ -194,7 +195,7 @@ int CActiveAEResample::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t * + int ret = swr_convert(m_pContext, dst_buffer, dst_samples, (const uint8_t**)src_buffer, src_samples); + if (ret < 0) + { +- CLog::Log(LOGERROR, "CActiveAEResample::Resample - resample failed"); ++ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Resample - resample failed"); + return 0; + } + +@@ -251,28 +252,28 @@ int CActiveAEResample::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t * + return ret; + } + +-int64_t CActiveAEResample::GetDelay(int64_t base) ++int64_t CActiveAEResampleFFMPEG::GetDelay(int64_t base) + { + return swr_get_delay(m_pContext, base); + } + +-int CActiveAEResample::GetBufferedSamples() ++int CActiveAEResampleFFMPEG::GetBufferedSamples() + { + return av_rescale_rnd(swr_get_delay(m_pContext, m_src_rate), + m_dst_rate, m_src_rate, AV_ROUND_UP); + } + +-int CActiveAEResample::CalcDstSampleCount(int src_samples, int dst_rate, int src_rate) ++int CActiveAEResampleFFMPEG::CalcDstSampleCount(int src_samples, int dst_rate, int src_rate) + { + return av_rescale_rnd(src_samples, dst_rate, src_rate, AV_ROUND_UP); + } + +-int CActiveAEResample::GetSrcBufferSize(int samples) ++int CActiveAEResampleFFMPEG::GetSrcBufferSize(int samples) + { + return av_samples_get_buffer_size(NULL, m_src_channels, samples, m_src_fmt, 1); + } + +-int CActiveAEResample::GetDstBufferSize(int samples) ++int CActiveAEResampleFFMPEG::GetDstBufferSize(int samples) + { + return av_samples_get_buffer_size(NULL, m_dst_channels, samples, m_dst_fmt, 1); + } +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h +index f9bdfec..1b35f59 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h +@@ -20,20 +20,23 @@ + */ + + #include "cores/AudioEngine/Interfaces/AE.h" ++#include "cores/AudioEngine/Interfaces/AEResample.h" + + extern "C" { +-#include "libavutil/avutil.h" +-#include "libswresample/swresample.h" ++#include "libavutil/samplefmt.h" + } + ++struct SwrContext; ++ + namespace ActiveAE + { + +-class CActiveAEResample ++class CActiveAEResampleFFMPEG : public IAEResample + { + public: +- CActiveAEResample(); +- virtual ~CActiveAEResample(); ++ const char *GetName() { return "ActiveAEResampleFFMPEG"; } ++ CActiveAEResampleFFMPEG(); ++ virtual ~CActiveAEResampleFFMPEG(); + bool Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, int dst_dither, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, int src_dither, bool upmix, bool normalize, CAEChannelInfo *remapLayout, AEQuality quality); + int Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, double ratio); + int64_t GetDelay(int64_t base); +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp +index 6d4d3b1..9111593 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp @@ -24,6 +24,7 @@ @@ -10436,19 +10821,6 @@ index d9f4a43..52e87a0 100644 #include "settings/Settings.h" -@@ -754,10 +755,10 @@ void CActiveAESink::OpenSink() - - // init sample of silence - SampleConfig config; -- config.fmt = CActiveAEResample::GetAVSampleFormat(m_sinkFormat.m_dataFormat); -+ config.fmt = CAEResampleFactory::GetAVSampleFormat(m_sinkFormat.m_dataFormat); - config.bits_per_sample = CAEUtil::DataFormatToUsedBits(m_sinkFormat.m_dataFormat); - config.dither_bits = CAEUtil::DataFormatToDitherBits(m_sinkFormat.m_dataFormat); -- config.channel_layout = CActiveAEResample::GetAVChannelLayout(m_sinkFormat.m_channelLayout); -+ config.channel_layout = CAEResampleFactory::GetAVChannelLayout(m_sinkFormat.m_channelLayout); - config.channels = m_sinkFormat.m_channelLayout.Count(); - config.sample_rate = m_sinkFormat.m_sampleRate; - @@ -890,8 +891,8 @@ void CActiveAESink::GenerateNoise() } @@ -10474,33 +10846,33 @@ index d9f4a43..52e87a0 100644 } diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h -index 0650a70..cf137b6 100644 +index 0650a70..6edfe11 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h -@@ -25,7 +25,7 @@ +@@ -25,7 +25,8 @@ #include "cores/AudioEngine/Interfaces/AE.h" #include "cores/AudioEngine/Interfaces/AESink.h" #include "cores/AudioEngine/AESinkFactory.h" -#include "cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h" +#include "cores/AudioEngine/Interfaces/AEResample.h" ++#include "cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h" namespace ActiveAE { diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h -index 01aafe3..fbee6b2 100644 +index 01aafe3..53823fe 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h -@@ -20,7 +20,7 @@ +@@ -20,7 +20,6 @@ */ #include "cores/AudioEngine/Interfaces/AESound.h" -#include "cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h" -+#include "cores/AudioEngine/AEResampleFactory.h" #include "filesystem/File.h" class DllAvUtil; diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp -index 7acc0d0..09d430c 100644 +index e9a292f..96bce12 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp @@ -25,6 +25,7 @@ @@ -10511,60 +10883,15 @@ index 7acc0d0..09d430c 100644 #include "ActiveAE.h" #include "ActiveAEStream.h" -@@ -94,7 +95,7 @@ void CActiveAEStream::InitRemapper() - for(unsigned int i=0; iGetAVChannelIndex(m_format.m_channelLayout[j], avLayout); -+ idx = CAEResampleFactory::GetAVChannelIndex(m_format.m_channelLayout[j], avLayout); - if (idx == (int)i) - { - ffmpegLayout += m_format.m_channelLayout[j]; -@@ -134,7 +135,7 @@ void CActiveAEStream::InitRemapper() - { - for(unsigned int j=0; jGetAVChannelIndex(m_format.m_channelLayout[j], avLayout); -+ idx = CAEResampleFactory::GetAVChannelIndex(m_format.m_channelLayout[j], avLayout); - if (idx == (int)i) - { - remapLayout += ffmpegLayout[j]; -@@ -147,13 +148,13 @@ void CActiveAEStream::InitRemapper() - m_remapper->Init(avLayout, - m_format.m_channelLayout.Count(), - m_format.m_sampleRate, -- CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat), -+ CAEResampleFactory::GetAVSampleFormat(m_format.m_dataFormat), - CAEUtil::DataFormatToUsedBits(m_format.m_dataFormat), - CAEUtil::DataFormatToDitherBits(m_format.m_dataFormat), - avLayout, - m_format.m_channelLayout.Count(), - m_format.m_sampleRate, -- CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat), -+ CAEResampleFactory::GetAVSampleFormat(m_format.m_dataFormat), - CAEUtil::DataFormatToUsedBits(m_format.m_dataFormat), - CAEUtil::DataFormatToDitherBits(m_format.m_dataFormat), - false, diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h index 70e8107..09fda0f 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h @@ -10580,10 +10907,10 @@ index 70e8107..09fda0f 100644 // only accessed by engine diff --git a/xbmc/cores/AudioEngine/Interfaces/AEResample.h b/xbmc/cores/AudioEngine/Interfaces/AEResample.h new file mode 100644 -index 0000000..dbe39bf +index 0000000..cef43de --- /dev/null +++ b/xbmc/cores/AudioEngine/Interfaces/AEResample.h -@@ -0,0 +1,53 @@ +@@ -0,0 +1,47 @@ +#pragma once +/* + * Copyright (C) 2010-2013 Team XBMC @@ -10605,16 +10932,10 @@ index 0000000..dbe39bf + * + */ + -+#include "system.h" -+ -+#include "cores/AudioEngine/Utils/AEChannelInfo.h" -+#include "cores/AudioEngine/Utils/AEAudioFormat.h" -+#include "cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h" +#include "cores/AudioEngine/Interfaces/AE.h" + +extern "C" { -+#include "libavutil/avutil.h" -+#include "libswresample/swresample.h" ++#include "libavutil/samplefmt.h" +} + +namespace ActiveAE @@ -10638,10 +10959,10 @@ index 0000000..dbe39bf + +} diff --git a/xbmc/cores/AudioEngine/Makefile.in b/xbmc/cores/AudioEngine/Makefile.in -index 581249e..b58db3e 100644 +index 7e9b415..b58db3e 100644 --- a/xbmc/cores/AudioEngine/Makefile.in +++ b/xbmc/cores/AudioEngine/Makefile.in -@@ -26,11 +26,13 @@ SRCS += Sinks/AESinkProfiler.cpp +@@ -26,6 +26,8 @@ SRCS += Sinks/AESinkProfiler.cpp SRCS += Sinks/AESinkPi.cpp @@ -10650,14 +10971,8 @@ index 581249e..b58db3e 100644 SRCS += Engines/ActiveAE/ActiveAE.cpp SRCS += Engines/ActiveAE/ActiveAESink.cpp SRCS += Engines/ActiveAE/ActiveAEStream.cpp - SRCS += Engines/ActiveAE/ActiveAESound.cpp --SRCS += Engines/ActiveAE/ActiveAEResample.cpp -+SRCS += Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp - SRCS += Engines/ActiveAE/ActiveAEBuffer.cpp - - ifeq (@USE_ANDROID@,1) diff --git a/xbmc/cores/paplayer/DVDPlayerCodec.cpp b/xbmc/cores/paplayer/DVDPlayerCodec.cpp -index c619b32..130d4f95 100644 +index a85a7bc..fd7716b 100644 --- a/xbmc/cores/paplayer/DVDPlayerCodec.cpp +++ b/xbmc/cores/paplayer/DVDPlayerCodec.cpp @@ -20,7 +20,7 @@ @@ -10669,29 +10984,15 @@ index c619b32..130d4f95 100644 #include "cores/dvdplayer/DVDInputStreams/DVDFactoryInputStream.h" #include "cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.h" -@@ -234,17 +234,17 @@ bool DVDPlayerCodec::Init(const std::string &strFile, unsigned int filecache) +@@ -234,7 +234,7 @@ bool DVDPlayerCodec::Init(const std::string &strFile, unsigned int filecache) if (NeedConvert(m_DataFormat)) { m_needConvert = true; - m_pResampler = new ActiveAE::CActiveAEResample(); -- m_pResampler->Init(ActiveAE::CActiveAEResample::GetAVChannelLayout(m_ChannelInfo), + m_pResampler = ActiveAE::CAEResampleFactory::Create(); -+ m_pResampler->Init(ActiveAE::CAEResampleFactory::GetAVChannelLayout(m_ChannelInfo), + m_pResampler->Init(CAEUtil::GetAVChannelLayout(m_ChannelInfo), m_ChannelInfo.Count(), m_SampleRate, -- ActiveAE::CActiveAEResample::GetAVSampleFormat(AE_FMT_FLOAT), -+ ActiveAE::CAEResampleFactory::GetAVSampleFormat(AE_FMT_FLOAT), - CAEUtil::DataFormatToUsedBits(AE_FMT_FLOAT), - CAEUtil::DataFormatToDitherBits(AE_FMT_FLOAT), -- ActiveAE::CActiveAEResample::GetAVChannelLayout(m_ChannelInfo), -+ ActiveAE::CAEResampleFactory::GetAVChannelLayout(m_ChannelInfo), - m_ChannelInfo.Count(), - m_SampleRate, -- ActiveAE::CActiveAEResample::GetAVSampleFormat(m_DataFormat), -+ ActiveAE::CAEResampleFactory::GetAVSampleFormat(m_DataFormat), - CAEUtil::DataFormatToUsedBits(m_DataFormat), - CAEUtil::DataFormatToDitherBits(m_DataFormat), - false, diff --git a/xbmc/cores/paplayer/DVDPlayerCodec.h b/xbmc/cores/paplayer/DVDPlayerCodec.h index 469e2ff..576fb97 100644 --- a/xbmc/cores/paplayer/DVDPlayerCodec.h @@ -10715,26 +11016,41 @@ index 469e2ff..576fb97 100644 int m_planes; bool m_needConvert; -From d574a64ad703984f46204bac05d05ce361415aed Mon Sep 17 00:00:00 2001 +From 7b81a7be2947eefbac1d285fe2b360658dfd08f0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 30 Dec 2013 12:02:14 +0000 -Subject: [PATCH 94/99] [rbp] Hardware accelerated resampling +Subject: [PATCH 84/96] [rbp] Hardware accelerated resampling This replaces the format conversion, up/down mixing and resampling code from ActiveAE with a GPU accelerated version. Should significantly reduce CPU when using paplayer or dvdplayer. Requires updated firmware --- + xbmc/cores/AudioEngine/AEResampleFactory.cpp | 3 + .../Engines/ActiveAE/ActiveAEResamplePi.cpp | 563 +++++++++++++++++++++ - .../Engines/ActiveAE/ActiveAEResamplePi.h | 71 +++ + .../Engines/ActiveAE/ActiveAEResamplePi.h | 59 +++ xbmc/cores/AudioEngine/Makefile.in | 1 + - 3 files changed, 635 insertions(+) + 4 files changed, 626 insertions(+) create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h +diff --git a/xbmc/cores/AudioEngine/AEResampleFactory.cpp b/xbmc/cores/AudioEngine/AEResampleFactory.cpp +index d135054..fee947c 100644 +--- a/xbmc/cores/AudioEngine/AEResampleFactory.cpp ++++ b/xbmc/cores/AudioEngine/AEResampleFactory.cpp +@@ -20,6 +20,9 @@ + + #include "AEResampleFactory.h" + #include "cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h" ++#if defined(TARGET_RASPBERRY_PI) ++ #include "cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h" ++#endif + + namespace ActiveAE + { diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp new file mode 100644 -index 0000000..77ed266 +index 0000000..a50b5ad --- /dev/null +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp @@ -0,0 +1,563 @@ @@ -10762,11 +11078,11 @@ index 0000000..77ed266 + +#if defined(TARGET_RASPBERRY_PI) + ++#include "cores/AudioEngine/Utils/AEUtil.h" +#include "ActiveAEResamplePi.h" -+#include "cores/AudioEngine/AEResampleFactory.h" -+#include "linux/RBP.h" +#include "settings/Settings.h" +#include "utils/log.h" ++#include "linux/RBP.h" + +extern "C" { +#include "libavutil/channel_layout.h" @@ -10911,7 +11227,7 @@ index 0000000..77ed266 + for (unsigned int out=0; outCount(); out++) + { + m_dst_chan_layout += (uint64_t) (1 << out); -+ int idx = CAEResampleFactory::GetAVChannelIndex((*remapLayout)[out], m_src_chan_layout); ++ int idx = CAEUtil::GetAVChannelIndex((*remapLayout)[out], m_src_chan_layout); + if (idx >= 0) + { + m_rematrix[out][idx] = 1.0; @@ -11303,10 +11619,10 @@ index 0000000..77ed266 +#endif diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h new file mode 100644 -index 0000000..9e61f37 +index 0000000..643ca6f --- /dev/null +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h -@@ -0,0 +1,71 @@ +@@ -0,0 +1,59 @@ +#pragma once +/* + * Copyright (C) 2010-2013 Team XBMC @@ -11328,19 +11644,7 @@ index 0000000..9e61f37 + * + */ + -+#include "system.h" -+ -+#include "cores/AudioEngine/Utils/AEChannelInfo.h" -+#include "cores/AudioEngine/Utils/AEAudioFormat.h" -+#include "cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h" -+#include "cores/AudioEngine/Interfaces/AE.h" +#include "cores/AudioEngine/Interfaces/AEResample.h" -+ -+extern "C" { -+#include "libavutil/avutil.h" -+#include "libswresample/swresample.h" -+} -+ +#include "linux/OMXCore.h" + +namespace ActiveAE @@ -11391,22 +11695,22 @@ index b58db3e..efb44cc 100644 ifeq (@USE_ANDROID@,1) -From f2874956b54c197cbe22292d62bfcf6e6ac39e04 Mon Sep 17 00:00:00 2001 +From f22ac0bf6cc8b0c7b424559acefa1f2597fef47d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 3 Oct 2014 18:14:04 +0100 -Subject: [PATCH 95/99] settings: Add acceleration option for resampling +Subject: [PATCH 85/96] settings: Add acceleration option for resampling --- language/English/strings.po | 10 ++++++++++ system/settings/rbp.xml | 7 +++++++ - xbmc/cores/AudioEngine/AEResampleFactory.cpp | 8 ++++++++ - 3 files changed, 25 insertions(+) + xbmc/cores/AudioEngine/AEResampleFactory.cpp | 5 +++++ + 3 files changed, 22 insertions(+) diff --git a/language/English/strings.po b/language/English/strings.po -index 989cfcc..58ee88f 100755 +index 6ce5175..d37e835 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -15998,3 +15998,13 @@ msgstr "" +@@ -16008,3 +16008,13 @@ msgstr "" msgctxt "#38006" msgid "Adjust PLL" msgstr "" @@ -11439,23 +11743,18 @@ index 9ecae65..a7a0e50 100644 diff --git a/xbmc/cores/AudioEngine/AEResampleFactory.cpp b/xbmc/cores/AudioEngine/AEResampleFactory.cpp -index a0aef34..03e3ddb 100644 +index fee947c..65afa6a 100644 --- a/xbmc/cores/AudioEngine/AEResampleFactory.cpp +++ b/xbmc/cores/AudioEngine/AEResampleFactory.cpp -@@ -18,8 +18,12 @@ +@@ -18,6 +18,7 @@ * */ +#include "settings/Settings.h" #include "AEResampleFactory.h" - #include "Engines/ActiveAE/ActiveAEResampleFFMPEG.h" -+#if defined(TARGET_RASPBERRY_PI) -+ #include "Engines/ActiveAE/ActiveAEResamplePi.h" -+#endif - - extern "C" { - #include "libavutil/channel_layout.h" -@@ -32,6 +36,10 @@ namespace ActiveAE + #include "cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.h" + #if defined(TARGET_RASPBERRY_PI) +@@ -29,6 +30,10 @@ namespace ActiveAE IAEResample *CAEResampleFactory::Create() { @@ -11467,10 +11766,10 @@ index a0aef34..03e3ddb 100644 } -From 52f41c5bf98b71418a754a0d1a41c6d7371fde0b Mon Sep 17 00:00:00 2001 +From b2455ddd489e52c9801ea51198a86dd6bdba3d99 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 96/99] [audio] Add settings option to boost centre channel +Subject: [PATCH 86/96] [audio] Add settings option to boost centre channel when downmixing This allows a dB volume increase to be added to centre channel. @@ -11482,16 +11781,16 @@ Should work with Pi Sink (dvdplayer/paplayer) and omxplayer --- language/English/strings.po | 14 ++++++++++++++ system/settings/settings.xml | 12 ++++++++++++ - .../Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp | 6 ++++++ + .../Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp | 7 +++++++ .../AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp | 6 ++++++ xbmc/cores/omxplayer/OMXAudio.cpp | 6 ++++++ - 5 files changed, 44 insertions(+) + 5 files changed, 45 insertions(+) diff --git a/language/English/strings.po b/language/English/strings.po -index 58ee88f..6cb308c 100755 +index d37e835..4ba7fc6 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -15999,6 +15999,20 @@ msgctxt "#38006" +@@ -16009,6 +16009,20 @@ msgctxt "#38006" msgid "Adjust PLL" msgstr "" @@ -11513,10 +11812,10 @@ index 58ee88f..6cb308c 100755 msgctxt "#38010" msgid "Use accelerated resampling" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 14f18d9..c8a7d3b 100644 +index f4fcb7c..cd2bea6 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml -@@ -2449,6 +2449,18 @@ +@@ -2457,6 +2457,18 @@ true @@ -11536,10 +11835,18 @@ index 14f18d9..c8a7d3b 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 8107f44..79f2a0f 100644 +index 26f0140..2e3ef91 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp -@@ -108,6 +108,12 @@ bool CActiveAEResampleFFMPEG::Init(uint64_t dst_chan_layout, int dst_channels, i +@@ -20,6 +20,7 @@ + + #include "cores/AudioEngine/Utils/AEUtil.h" + #include "ActiveAEResampleFFMPEG.h" ++#include "settings/Settings.h" + #include "utils/log.h" + + extern "C" { +@@ -105,6 +106,12 @@ bool CActiveAEResampleFFMPEG::Init(uint64_t dst_chan_layout, int dst_channels, i { av_opt_set_double(m_pContext, "rematrix_maxval", 1.0, 0); } @@ -11553,7 +11860,7 @@ index 8107f44..79f2a0f 100644 if (remapLayout) { diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -index 77ed266..7a25964 100644 +index a50b5ad..afb46ec 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp @@ -159,6 +159,12 @@ bool CActiveAEResamplePi::Init(uint64_t dst_chan_layout, int dst_channels, int d @@ -11570,7 +11877,7 @@ index 77ed266..7a25964 100644 if (remapLayout) { diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index f0ae0cc..c0931b0 100644 +index 22ee423..db2968f 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp @@ -682,6 +682,12 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo @@ -11587,10 +11894,10 @@ index f0ae0cc..c0931b0 100644 // stereo upmix if (upmix && m_src_channels == 2 && m_dst_channels > 2) -From d2cc69cecc28c00513a1eb5497ebc97d9344a670 Mon Sep 17 00:00:00 2001 +From 4a567ffd89765fe5c65b84b2bc6c869460da67d6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 3 Oct 2014 18:38:07 +0100 -Subject: [PATCH 97/99] [omxcore] Skip out of flush on error +Subject: [PATCH 87/96] [omxcore] Skip out of flush on error --- xbmc/linux/OMXCore.cpp | 4 ++-- @@ -11619,10 +11926,10 @@ index 4ae29ba..4caa304 100644 OMX_ERRORTYPE omx_err = OMX_ErrorNone; -From 702755b0ba747a1c5a33f3c5a52997c4d9f25381 Mon Sep 17 00:00:00 2001 +From 7ef49044e6da8f68978ca746c25b591996be08b1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 3 Oct 2014 18:40:06 +0100 -Subject: [PATCH 98/99] [SinkPi] Handle multichannel layout more like OMXAudio +Subject: [PATCH 88/96] [SinkPi] Handle multichannel layout more like OMXAudio --- xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 14 +++++++------- @@ -11681,60 +11988,991 @@ index 89684e4..fd9a03d 100644 m_format = format; m_sinkbuffer_sec_per_byte = 1.0 / (double)(m_format.m_frameSize * m_format.m_sampleRate); -From b5a13e0d867266a424c28b04c48df46f8b83b985 Mon Sep 17 00:00:00 2001 +From b1fb8bf8548d647c66500dd314ccfb8adc708b3c Mon Sep 17 00:00:00 2001 From: popcornmix -Date: Sat, 4 Oct 2014 14:20:59 +0100 -Subject: [PATCH 99/99] [vobsub] Fix for incorrect colours with vobsubs and - GLES +Date: Sun, 5 Oct 2014 14:05:25 +0100 +Subject: [PATCH 89/96] [PiSink] Allow audio output latency to be set in + settings -Fixes #15146 - -The code provides the overlay texture in BGRA format, which it informs GL about. -However GLES does not support BGRA, and just claims it is RGBA which results in a red/blue swap. - -So this code path needs a red/blue swap. --- - xbmc/cores/VideoRenderers/OverlayRendererGL.cpp | 29 ++++++++++++++++++++++++- - 1 file changed, 28 insertions(+), 1 deletion(-) + language/English/strings.po | 15 +++++++++++++++ + system/settings/rbp.xml | 14 ++++++++++++++ + xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 13 ++++++++----- + xbmc/cores/AudioEngine/Sinks/AESinkPi.h | 1 + + 4 files changed, 38 insertions(+), 5 deletions(-) -diff --git a/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp b/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp -index a7a2552..ba60958 100644 ---- a/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp -@@ -70,8 +70,35 @@ static void LoadTexture(GLenum target +diff --git a/language/English/strings.po b/language/English/strings.po +index 4ba7fc6..91765f2 100755 +--- a/language/English/strings.po ++++ b/language/English/strings.po +@@ -16032,3 +16032,18 @@ msgstr "" + msgctxt "#38011" + msgid "This setting reduces CPU by handling audio resampling on the GPU" + msgstr "" ++ ++#: system/settings/rbp.xml ++msgctxt "#38012" ++msgid "Audio output latency" ++msgstr "" ++ ++#: system/settings/rbp.xml ++msgctxt "#38013" ++msgid "Increase this to protect against underruns, reduce to have lower latency gui sounds" ++msgstr "" ++ ++#: system/settings/rbp.xml ++msgctxt "#38014" ++msgid "%i ms" ++msgstr "" +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index a7a0e50..b83f8a8 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -106,6 +106,20 @@ + + + ++ ++ ++ 3 ++ 100 ++ ++ 50 ++ 50 ++ 300 ++ ++ ++ 38014 ++ ++ ++ + + + +diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp +index fd9a03d..484ce14 100644 +--- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp ++++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp +@@ -34,7 +34,6 @@ + #define CLASSNAME "CAESinkPi" + + #define NUM_OMX_BUFFERS 2 +-#define AUDIO_PLAYBUFFER (0.1) // 100ms + + static const unsigned int PassthroughSampleRates[] = { 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, 176400, 192000 }; + +@@ -42,6 +41,7 @@ CAEDeviceInfo CAESinkPi::m_info; + + CAESinkPi::CAESinkPi() : + m_sinkbuffer_sec_per_byte(0), ++ m_latency(0), + m_Initialized(false), + m_submitted(0), + m_omx_output(NULL) +@@ -189,6 +189,9 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) + m_initDevice = device; + m_initFormat = format; + ++ m_latency = CSettings::Get().GetInt("audiooutput.latency") * 1e-3; ++ m_latency = std::max(m_latency, 50e-3); ++ + // analogue only supports stereo + if (CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Analogue" || CSettings::Get().GetString("audiooutput.audiodevice") == "PI:Both") + { +@@ -205,7 +208,7 @@ bool CAESinkPi::Initialize(AEAudioFormat &format, std::string &device) + unsigned int sample_size = CAEUtil::DataFormatToBits(format.m_dataFormat) >> 3; + format.m_frameSize = sample_size * channels; + format.m_sampleRate = std::max(8000U, std::min(192000U, format.m_sampleRate)); +- format.m_frames = format.m_sampleRate * AUDIO_PLAYBUFFER / NUM_OMX_BUFFERS; ++ format.m_frames = format.m_sampleRate * m_latency / NUM_OMX_BUFFERS; + format.m_frameSamples = format.m_frames * channels; + + SetAudioProps(m_passthrough, GetChannelMap(format.m_channelLayout, m_passthrough)); +@@ -420,7 +423,7 @@ void CAESinkPi::GetDelay(AEDelayStatus& status) + + double CAESinkPi::GetCacheTotal() + { +- return AUDIO_PLAYBUFFER; ++ return m_latency; + } + + unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned int offset) +@@ -468,8 +471,8 @@ unsigned int CAESinkPi::AddPackets(uint8_t **data, unsigned int frames, unsigned + m_submitted++; + GetDelay(status); + delay = status.GetDelay(); +- if (delay > AUDIO_PLAYBUFFER) +- Sleep((int)(1000.0f * (delay - AUDIO_PLAYBUFFER))); ++ if (delay > m_latency) ++ Sleep((int)(1000.0f * (delay - m_latency))); + return frames; + } + +diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPi.h b/xbmc/cores/AudioEngine/Sinks/AESinkPi.h +index 5c57999..cac5051 100644 +--- a/xbmc/cores/AudioEngine/Sinks/AESinkPi.h ++++ b/xbmc/cores/AudioEngine/Sinks/AESinkPi.h +@@ -53,6 +53,7 @@ class CAESinkPi : public IAESink + AEAudioFormat m_initFormat; + AEAudioFormat m_format; + double m_sinkbuffer_sec_per_byte; ++ double m_latency; + static CAEDeviceInfo m_info; + bool m_Initialized; + uint32_t m_submitted; + +From 94a8749996583b8d7582e5ab141723f833745cb3 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Sun, 5 Oct 2014 14:24:49 +0100 +Subject: [PATCH 90/96] [resamplepi] Move gpu accleration into resample quality + setting + +--- + language/English/strings.po | 7 +------ + system/settings/rbp.xml | 10 +++------- + xbmc/cores/AudioEngine/AEFactory.cpp | 2 ++ + xbmc/cores/AudioEngine/AEResampleFactory.cpp | 2 +- + xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 4 ++++ + xbmc/cores/AudioEngine/Interfaces/AE.h | 3 ++- + 6 files changed, 13 insertions(+), 15 deletions(-) + +diff --git a/language/English/strings.po b/language/English/strings.po +index 91765f2..b2461f7 100755 +--- a/language/English/strings.po ++++ b/language/English/strings.po +@@ -16025,12 +16025,7 @@ msgid "%i dB" + + #: system/settings/rbp.xml + msgctxt "#38010" +-msgid "Use accelerated resampling" +-msgstr "" +- +-#: system/settings/rbp.xml +-msgctxt "#38011" +-msgid "This setting reduces CPU by handling audio resampling on the GPU" ++msgid "GPU accelerated" + msgstr "" + + #: system/settings/rbp.xml +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index b83f8a8..b8e6e59 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -61,13 +61,6 @@ + + + +- +- +- 2 +- true +- +- +- + + + +@@ -107,6 +100,9 @@ + + + ++ ++ 101 ++ + + 3 + 100 +diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp +index ebc9c6e..1ce8434 100644 +--- a/xbmc/cores/AudioEngine/AEFactory.cpp ++++ b/xbmc/cores/AudioEngine/AEFactory.cpp +@@ -328,6 +328,8 @@ void CAEFactory::SettingOptionsAudioQualityLevelsFiller(const CSetting *setting, + list.push_back(std::make_pair(g_localizeStrings.Get(13508), AE_QUALITY_HIGH)); + if(AE->SupportsQualityLevel(AE_QUALITY_REALLYHIGH)) + list.push_back(std::make_pair(g_localizeStrings.Get(13509), AE_QUALITY_REALLYHIGH)); ++ if(AE->SupportsQualityLevel(AE_QUALITY_GPU)) ++ list.push_back(std::make_pair(g_localizeStrings.Get(38010), AE_QUALITY_GPU)); + } + + void CAEFactory::SettingOptionsAudioStreamsilenceFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t, void *data) +diff --git a/xbmc/cores/AudioEngine/AEResampleFactory.cpp b/xbmc/cores/AudioEngine/AEResampleFactory.cpp +index 65afa6a..c24d9b0 100644 +--- a/xbmc/cores/AudioEngine/AEResampleFactory.cpp ++++ b/xbmc/cores/AudioEngine/AEResampleFactory.cpp +@@ -31,7 +31,7 @@ namespace ActiveAE + IAEResample *CAEResampleFactory::Create() + { + #if defined(TARGET_RASPBERRY_PI) +- if (CSettings::Get().GetBool("videoplayer.resamplepi")) ++ if (CSettings::Get().GetInt("audiooutput.processquality") == AE_QUALITY_GPU) + return new CActiveAEResamplePi(); + #endif + return new CActiveAEResampleFFMPEG(); +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +index a854ab3..64775c0 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +@@ -2273,6 +2273,10 @@ bool CActiveAE::SupportsQualityLevel(enum AEQuality level) + { + if (level == AE_QUALITY_LOW || level == AE_QUALITY_MID || level == AE_QUALITY_HIGH) + return true; ++#if defined(TARGET_RASPBERRY_PI) ++ if (level == AE_QUALITY_GPU) ++ return true; ++#endif + + return false; + } +diff --git a/xbmc/cores/AudioEngine/Interfaces/AE.h b/xbmc/cores/AudioEngine/Interfaces/AE.h +index 353fcaa..c66fa61 100644 +--- a/xbmc/cores/AudioEngine/Interfaces/AE.h ++++ b/xbmc/cores/AudioEngine/Interfaces/AE.h +@@ -58,8 +58,9 @@ enum AEQuality + AE_QUALITY_HIGH = 50, /* Best sound processing quality */ + + /* Optional quality levels */ +- AE_QUALITY_REALLYHIGH = 100 /* Uncompromised optional quality level, ++ AE_QUALITY_REALLYHIGH = 100, /* Uncompromised optional quality level, + usually with unmeasurable and unnoticeable improvement */ ++ AE_QUALITY_GPU = 101, /* GPU acceleration */ + }; + + /** + +From 21c95205d184639dff460ac4c79f45d8a8c1baa7 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 6 Oct 2014 21:27:02 +0100 +Subject: [PATCH 91/96] [resamplepi] Remove unused variabled + +--- + xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp | 4 ---- + xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h | 2 -- + 2 files changed, 6 deletions(-) + +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp +index afb46ec..a4bb15e 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp +@@ -66,10 +66,6 @@ CActiveAEResamplePi::CActiveAEResamplePi() + CLog::Log(LOGINFO, "%s::%s", CLASSNAME, __func__); + + m_Initialized = false; +- m_last_src_fmt = AV_SAMPLE_FMT_NONE; +- m_last_dst_fmt = AV_SAMPLE_FMT_NONE; +- m_last_src_channels = 0; +- m_last_dst_channels = 0; + m_encoded_buffer = NULL; + } + +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h +index 643ca6f..b6fc644 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h +@@ -51,8 +51,6 @@ class CActiveAEResamplePi : public IAEResample + OMX_AUDIO_PARAM_PCMMODETYPE m_pcm_output; + COMXCoreComponent m_omx_mixer; + bool m_Initialized; +- AVSampleFormat m_last_src_fmt, m_last_dst_fmt; +- int m_last_src_channels, m_last_dst_channels; + OMX_BUFFERHEADERTYPE *m_encoded_buffer; + }; + + +From 1c678794f22e28636fecff58d3b34abf61b1dd3b Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 6 Oct 2014 21:29:41 +0100 +Subject: [PATCH 92/96] [AE] Don't submit data to resampler when more than one + frame is buffered + +--- + xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp +index e40ac2e..9e42385 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp +@@ -258,7 +258,7 @@ bool CActiveAEBufferPoolResample::ResampleBuffers(int64_t timestamp) + + bool skipInput = false; + // avoid that ffmpeg resample buffer grows too large +- if (out_samples > free_samples * 2 && !m_empty) ++ if (out_samples > free_samples && !m_empty) + skipInput = true; + + bool hasInput = !m_inputSamples.empty(); + +From e63c5067550dbf80313ed177317c074cab9529cf Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 6 Oct 2014 21:31:55 +0100 +Subject: [PATCH 93/96] [ResamplePi] Allow resample ratio to vary continuously + +We weren't respecting the ratio paramater to resampler which is used when in video clock with audio resample as the sync method. +This means the resample method was behaving like drop/dupe. + +Requires updated firmware +--- + .../Engines/ActiveAE/ActiveAEResamplePi.cpp | 92 ++++++++++++++-------- + .../Engines/ActiveAE/ActiveAEResamplePi.h | 2 + + 2 files changed, 59 insertions(+), 35 deletions(-) + +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp +index a4bb15e..77abb61 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp +@@ -67,6 +67,8 @@ CActiveAEResamplePi::CActiveAEResamplePi() + + m_Initialized = false; + m_encoded_buffer = NULL; ++ m_offset = 0; ++ m_ratio = 0.0; + } + + CActiveAEResamplePi::~CActiveAEResamplePi() +@@ -127,6 +129,7 @@ bool CActiveAEResamplePi::Init(uint64_t dst_chan_layout, int dst_channels, int d + m_src_rate = src_rate; + m_src_fmt = src_fmt; + m_src_bits = src_bits; ++ m_offset = 0; + + if (m_dst_chan_layout == 0) + m_dst_chan_layout = av_get_default_channel_layout(m_dst_channels); +@@ -278,6 +281,18 @@ bool CActiveAEResamplePi::Init(uint64_t dst_chan_layout, int dst_channels, int d + + LOGTIME(3); + ++ if (CSettings::Get().GetBool("videoplayer.usedisplayasclock") && CSettings::Get().GetInt("videoplayer.synctype") == SYNC_RESAMPLE) ++ { ++ OMX_PARAM_U32TYPE scaleType; ++ OMX_INIT_STRUCTURE(scaleType); ++ ++ scaleType.nPortIndex = m_omx_mixer.GetInputPort(); ++ scaleType.nU32 = (1 << 16); ++ omx_err = m_omx_mixer.SetConfig(OMX_IndexParamBrcmTimeScale, &scaleType); ++ if (omx_err != OMX_ErrorNone) ++ CLog::Log(LOGERROR, "%s::%s - error m_omx_mixer Failed to set OMX_IndexParamBrcmTimeScale omx_err(0x%08x)", CLASSNAME, __func__, omx_err); ++ m_ratio = 1.0; ++ } + // audio_mixer only supports up to 192kHz, however as long as ratio of samplerates remains the same we can lie + while (src_rate > 192000 || dst_rate > 192000) + src_rate >>= 1, dst_rate >>= 1; +@@ -391,11 +406,10 @@ bool CActiveAEResamplePi::Init(uint64_t dst_chan_layout, int dst_channels, int d + } + + +-static void copy_planes(uint8_t **dst_buffer, int d_pitch, int d_planes, int d_samplesize, int offset, uint8_t *src_buffer, int src_samples) ++static void copy_planes(uint8_t **dst_buffer, int d_pitch, int d_planes, int d_samplesize, int offset, uint8_t *src_buffer, int src_samples, int planesize) + { +- int planesize = src_samples * d_samplesize / d_planes; + for (int i=0; i < d_planes; i++) +- memcpy(dst_buffer[i] + offset * d_pitch, src_buffer + i * planesize, planesize); ++ memcpy(dst_buffer[i] + offset * d_pitch, src_buffer + i * planesize, src_samples * d_samplesize / d_planes); + } + + int CActiveAEResamplePi::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, double ratio) +@@ -407,6 +421,19 @@ int CActiveAEResamplePi::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t + return 0; + OMX_ERRORTYPE omx_err = OMX_ErrorNone; + ++ if (m_ratio != 0.0 && ratio != m_ratio) ++ { ++ OMX_PARAM_U32TYPE scaleType; ++ OMX_INIT_STRUCTURE(scaleType); ++ ++ scaleType.nPortIndex = m_omx_mixer.GetInputPort(); ++ scaleType.nU32 = (1 << 16) / ratio; ++ omx_err = m_omx_mixer.SetConfig(OMX_IndexParamBrcmTimeScale, &scaleType); ++ if (omx_err != OMX_ErrorNone) ++ CLog::Log(LOGERROR, "%s::%s - error m_omx_mixer Failed to set OMX_IndexParamBrcmTimeScale omx_err(0x%08x)", CLASSNAME, __func__, omx_err); ++ m_ratio = ratio; ++ } ++ + const int s_planes = m_src_fmt >= AV_SAMPLE_FMT_U8P ? m_src_channels : 1; + const int d_planes = m_dst_fmt >= AV_SAMPLE_FMT_U8P ? m_dst_channels : 1; + const int s_chans = m_src_fmt >= AV_SAMPLE_FMT_U8P ? 1 : m_src_channels; +@@ -422,27 +449,33 @@ int CActiveAEResamplePi::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t + int sent = 0; + int received = 0; + +- if (m_encoded_buffer && m_encoded_buffer->nFilledLen) +- { +- int samples_available = m_encoded_buffer->nFilledLen / d_samplesize - m_encoded_buffer->nOffset; +- int samples = std::min(samples_available, dst_samples - received); +- copy_planes(dst_buffer, d_pitch, d_planes, d_samplesize, received, (uint8_t *)m_encoded_buffer->pBuffer + m_encoded_buffer->nOffset * d_pitch, samples); +- received += samples; +- samples_available -= samples; +- if (samples_available > 0) +- m_encoded_buffer->nOffset += samples; +- else +- m_encoded_buffer = NULL; +- } +- assert(!m_encoded_buffer); +- while (sent < src_samples) ++ while (1) + { +- OMX_BUFFERHEADERTYPE *omx_buffer = NULL; ++ if (m_encoded_buffer && m_encoded_buffer->nFilledLen) ++ { ++ int samples_available = m_encoded_buffer->nFilledLen / d_samplesize - m_offset; ++ int samples = std::min(samples_available, dst_samples - received); ++ copy_planes(dst_buffer, d_pitch, d_planes, d_samplesize, received, (uint8_t *)m_encoded_buffer->pBuffer + m_offset * d_pitch, samples, m_encoded_buffer->nFilledLen / d_planes); ++ received += samples; ++ m_offset += samples; ++ if (m_offset == m_encoded_buffer->nFilledLen / d_samplesize) ++ { ++ m_offset = 0; ++ m_encoded_buffer = NULL; ++ } ++ else if (m_offset > m_encoded_buffer->nFilledLen / d_samplesize) assert(0); ++ else assert(sent == src_samples); ++ } + +- omx_buffer = m_omx_mixer.GetInputBuffer(1000); ++ if (sent >= src_samples) ++ break; ++ ++ OMX_BUFFERHEADERTYPE *omx_buffer = m_omx_mixer.GetInputBuffer(1000); + if (omx_buffer == NULL) ++ { ++ CLog::Log(LOGERROR, "%s::%s m_omx_mixer.GetInputBuffer failed to get buffer", CLASSNAME, __func__); + return false; +- ++ } + int send = std::min(std::min(max_dst_samples, max_src_samples), src_samples - sent); + + omx_buffer->nOffset = 0; +@@ -490,22 +523,11 @@ int CActiveAEResamplePi::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t + CLog::Log(LOGERROR, "%s::%s m_omx_mixer.BadState", CLASSNAME, __func__); + return false; + } +- +- if (m_encoded_buffer->nFilledLen) +- { +- int samples_available = m_encoded_buffer->nFilledLen / d_samplesize; +- int samples = std::min(samples_available, dst_samples - received); +- copy_planes(dst_buffer, d_pitch, d_planes, d_samplesize, received, (uint8_t *)m_encoded_buffer->pBuffer, samples); +- received += samples; +- samples_available -= samples; +- if (samples_available > 0) +- m_encoded_buffer->nOffset += samples; +- else +- m_encoded_buffer = NULL; +- } ++ if (sent < src_samples) ++ CLog::Log(LOGERROR, "%s::%s More data to send %d/%d", CLASSNAME, __func__, sent, src_samples); + } + #ifdef DEBUG_VERBOSE +- CLog::Log(LOGINFO, "%s::%s format:%d->%d rate:%d->%d chan:%d->%d samples %d->%d (%f) %d =%d", CLASSNAME, __func__, ++ CLog::Log(LOGINFO, "%s::%s format:%d->%d rate:%d->%d chan:%d->%d samples %d->%d (%f) %d", CLASSNAME, __func__, + (int)m_src_fmt, (int)m_dst_fmt, m_src_rate, m_dst_rate, m_src_channels, m_dst_channels, src_samples, dst_samples, ratio, m_Initialized, received); + #endif + assert(received <= dst_samples); +@@ -527,7 +549,7 @@ int CActiveAEResamplePi::GetBufferedSamples() + if (m_encoded_buffer) + { + const int d_samplesize = m_dst_channels * m_dst_bits >> 3; +- samples = m_encoded_buffer->nFilledLen / d_samplesize - m_encoded_buffer->nOffset; ++ samples = m_encoded_buffer->nFilledLen / d_samplesize - m_offset; + } + #ifdef DEBUG_VERBOSE + CLog::Log(LOGINFO, "%s::%s = %d", CLASSNAME, __func__, samples); +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h +index b6fc644..b3b1f9b 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h +@@ -52,6 +52,8 @@ class CActiveAEResamplePi : public IAEResample + COMXCoreComponent m_omx_mixer; + bool m_Initialized; + OMX_BUFFERHEADERTYPE *m_encoded_buffer; ++ unsigned int m_offset; ++ double m_ratio; + }; + + } + +From 24c7e439a826ad0883dd5e9e07d469e2129c2368 Mon Sep 17 00:00:00 2001 +From: Karlson2k +Date: Thu, 9 Oct 2014 19:34:43 +0400 +Subject: [PATCH 94/96] CacheStrategy: remove usage of emulated win32 + functions, switch to internal VFS + +--- + xbmc/filesystem/CacheStrategy.cpp | 129 +++++++++++++++++++------------------- + xbmc/filesystem/CacheStrategy.h | 13 ++-- + 2 files changed, 69 insertions(+), 73 deletions(-) + +diff --git a/xbmc/filesystem/CacheStrategy.cpp b/xbmc/filesystem/CacheStrategy.cpp +index 095d3fb..acc86af 100644 +--- a/xbmc/filesystem/CacheStrategy.cpp ++++ b/xbmc/filesystem/CacheStrategy.cpp +@@ -20,17 +20,21 @@ + + #include "threads/SystemClock.h" + #include "CacheStrategy.h" +-#ifdef TARGET_POSIX +-#include "PlatformInclude.h" +-#endif ++#include "IFile.h" + #include "Util.h" + #include "utils/log.h" + #include "threads/SingleLock.h" + #include "utils/TimeUtils.h" + #include "SpecialProtocol.h" +-#ifdef TARGET_WINDOWS + #include "PlatformDefs.h" //for PRIdS, PRId64 +-#endif ++#include "URL.h" ++#if defined(TARGET_POSIX) ++#include "posix/PosixFile.h" ++#define CacheLocalFile CPosixFile ++#elif defined(TARGET_WINDOWS) ++#include "win32/Win32File.h" ++#define CacheLocalFile CWin32File ++#endif // TARGET_WINDOWS + + using namespace XFILE; + +@@ -58,8 +62,8 @@ void CCacheStrategy::ClearEndOfInput() + } + + CSimpleFileCache::CSimpleFileCache() +- : m_hCacheFileRead(NULL) +- , m_hCacheFileWrite(NULL) ++ : m_cacheFileRead(new CacheLocalFile()) ++ , m_cacheFileWrite(new CacheLocalFile()) + , m_hDataAvailEvent(NULL) + , m_nStartPosition(0) + , m_nWritePosition(0) +@@ -69,6 +73,8 @@ CSimpleFileCache::CSimpleFileCache() + CSimpleFileCache::~CSimpleFileCache() + { + Close(); ++ delete m_cacheFileRead; ++ delete m_cacheFileWrite; + } + + int CSimpleFileCache::Open() +@@ -77,38 +83,26 @@ int CSimpleFileCache::Open() + + m_hDataAvailEvent = new CEvent; + +- std::string fileName = CSpecialProtocol::TranslatePath(CUtil::GetNextFilename("special://temp/filecache%03d.cache", 999)); +- if(fileName.empty()) ++ m_filename = CSpecialProtocol::TranslatePath(CUtil::GetNextFilename("special://temp/filecache%03d.cache", 999)); ++ if (m_filename.empty()) + { + CLog::Log(LOGERROR, "%s - Unable to generate a new filename", __FUNCTION__); + Close(); + return CACHE_RC_ERROR; } - #ifdef HAS_GLES -+ -+ /** OpenGL ES does not support BGR **/ -+ if (externalFormat == GL_RGBA) -+ { -+ int bytesPerLine = bytesPerPixel * width; -+ -+ pixelVector = (char *)malloc(bytesPerLine * height); -+ -+ const char *src = (const char*)pixels; -+ char *dst = pixelVector; -+ for (int y = 0;y < height;++y) -+ { -+ src = (const char*)pixels + y * stride; -+ dst = pixelVector + y * bytesPerLine; -+ -+ for (unsigned int i = 0; i < width; i++, src+=4, dst+=4) -+ { -+ dst[0] = src[2]; -+ dst[1] = src[1]; -+ dst[2] = src[0]; -+ dst[3] = src[3]; -+ } -+ } -+ -+ pixelData = pixelVector; -+ stride = width; -+ } - /** OpenGL ES does not support strided texture input. Make a copy without stride **/ -- if (stride != width) -+ else if (stride != width) - { - int bytesPerLine = bytesPerPixel * width; +- m_hCacheFileWrite = CreateFile(fileName.c_str() +- , GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_DELETE +- , NULL +- , CREATE_ALWAYS +- , FILE_ATTRIBUTE_NORMAL +- , NULL); ++ CURL fileURL(m_filename); +- if(m_hCacheFileWrite == INVALID_HANDLE_VALUE) ++ if (!m_cacheFileWrite->OpenForWrite(fileURL, false)) + { +- CLog::Log(LOGERROR, "%s - failed to create file %s with error code %d", __FUNCTION__, fileName.c_str(), GetLastError()); ++ CLog::LogF(LOGERROR, "failed to create file \"%s\" for writing", m_filename.c_str()); + Close(); + return CACHE_RC_ERROR; + } + +- m_hCacheFileRead = CreateFile(fileName.c_str() +- , GENERIC_READ, FILE_SHARE_WRITE +- , NULL +- , OPEN_EXISTING +- , FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE +- , NULL); +- +- if(m_hCacheFileRead == INVALID_HANDLE_VALUE) ++ if (!m_cacheFileRead->Open(fileURL)) + { +- CLog::Log(LOGERROR, "%s - failed to open file %s with error code %d", __FUNCTION__, fileName.c_str(), GetLastError()); ++ CLog::LogF(LOGERROR, "failed to open file \"%s\" for reading", m_filename.c_str()); + Close(); + return CACHE_RC_ERROR; + } +@@ -123,33 +117,35 @@ void CSimpleFileCache::Close() + + m_hDataAvailEvent = NULL; + +- if (m_hCacheFileWrite) +- CloseHandle(m_hCacheFileWrite); +- +- m_hCacheFileWrite = NULL; ++ m_cacheFileWrite->Close(); ++ m_cacheFileRead->Close(); + +- if (m_hCacheFileRead) +- CloseHandle(m_hCacheFileRead); ++ if (!m_cacheFileRead->Delete(CURL(m_filename))) ++ CLog::LogF(LOGWARNING, "failed to delete temporary file \"%s\"", m_filename.c_str()); + +- m_hCacheFileRead = NULL; ++ m_filename.clear(); + } + + int CSimpleFileCache::WriteToCache(const char *pBuffer, size_t iSize) + { +- DWORD iWritten=0; +- if (!WriteFile(m_hCacheFileWrite, pBuffer, iSize, &iWritten, NULL)) ++ size_t written = 0; ++ while (iSize > 0) + { +- CLog::Log(LOGERROR, "%s - failed to write to file. err: %u", +- __FUNCTION__, GetLastError()); +- return CACHE_RC_ERROR; ++ const ssize_t lastWritten = m_cacheFileWrite->Write(pBuffer, (iSize > SSIZE_MAX) ? SSIZE_MAX : iSize); ++ if (lastWritten <= 0) ++ { ++ CLog::LogF(LOGERROR, "failed to write to file"); ++ return CACHE_RC_ERROR; ++ } ++ m_nWritePosition += lastWritten; ++ iSize -= lastWritten; ++ written += lastWritten; + } + +- m_nWritePosition += iWritten; +- + // when reader waits for data it will wait on the event. + m_hDataAvailEvent->Set(); + +- return iWritten; ++ return written; + } + + int64_t CSimpleFileCache::GetAvailableRead() +@@ -160,24 +156,31 @@ int64_t CSimpleFileCache::GetAvailableRead() + int CSimpleFileCache::ReadFromCache(char *pBuffer, size_t iMaxSize) + { + int64_t iAvailable = GetAvailableRead(); +- if ( iAvailable <= 0 ) { ++ if ( iAvailable <= 0 ) + return m_bEndOfInput? 0 : CACHE_RC_WOULD_BLOCK; +- } + +- if (iMaxSize > (size_t)iAvailable) +- iMaxSize = (size_t)iAvailable; ++ size_t toRead = ((int64_t)iMaxSize > iAvailable) ? (size_t)iAvailable : iMaxSize; + +- DWORD iRead = 0; +- if (!ReadFile(m_hCacheFileRead, pBuffer, iMaxSize, &iRead, NULL)) { +- CLog::Log(LOGERROR,"CSimpleFileCache::ReadFromCache - failed to read %" PRIdS" bytes.", iMaxSize); +- return CACHE_RC_ERROR; ++ size_t readBytes = 0; ++ while (toRead > 0) ++ { ++ const ssize_t lastRead = m_cacheFileRead->Read(pBuffer, (toRead > SSIZE_MAX) ? SSIZE_MAX : toRead); ++ if (lastRead == 0) ++ break; ++ if (lastRead < 0) ++ { ++ CLog::LogF(LOGERROR, "failed to read from file"); ++ return CACHE_RC_ERROR; ++ } ++ m_nReadPosition += lastRead; ++ toRead -= lastRead; ++ readBytes += lastRead; + } +- m_nReadPosition += iRead; + +- if (iRead > 0) ++ if (readBytes > 0) + m_space.Set(); + +- return iRead; ++ return readBytes; + } + + int64_t CSimpleFileCache::WaitForData(unsigned int iMinAvail, unsigned int iMillis) +@@ -215,13 +218,13 @@ int64_t CSimpleFileCache::Seek(int64_t iFilePosition) + return CACHE_RC_ERROR; + } + +- LARGE_INTEGER pos; +- pos.QuadPart = iTarget; +- +- if(!SetFilePointerEx(m_hCacheFileRead, pos, NULL, FILE_BEGIN)) ++ m_nReadPosition = m_cacheFileRead->Seek(iTarget, SEEK_SET); ++ if (m_nReadPosition != iTarget) ++ { ++ CLog::LogF(LOGERROR, "can't seek file"); + return CACHE_RC_ERROR; ++ } + +- m_nReadPosition = iTarget; + m_space.Set(); + + return iFilePosition; +@@ -229,21 +232,15 @@ int64_t CSimpleFileCache::Seek(int64_t iFilePosition) + + void CSimpleFileCache::Reset(int64_t iSourcePosition, bool clearAnyway) + { +- LARGE_INTEGER pos; + if (!clearAnyway && IsCachedPosition(iSourcePosition)) + { +- pos.QuadPart = m_nReadPosition = iSourcePosition - m_nStartPosition; +- SetFilePointerEx(m_hCacheFileRead, pos, NULL, FILE_BEGIN); ++ m_nReadPosition = m_cacheFileRead->Seek(iSourcePosition - m_nStartPosition, SEEK_SET); + return; + } + +- pos.QuadPart = 0; +- +- SetFilePointerEx(m_hCacheFileWrite, pos, NULL, FILE_BEGIN); +- SetFilePointerEx(m_hCacheFileRead, pos, NULL, FILE_BEGIN); + m_nStartPosition = iSourcePosition; +- m_nReadPosition = 0; +- m_nWritePosition = 0; ++ m_nWritePosition = m_cacheFileWrite->Seek(0, SEEK_SET); ++ m_nReadPosition = m_cacheFileRead->Seek(0, SEEK_SET); + } + + void CSimpleFileCache::EndOfInput() +diff --git a/xbmc/filesystem/CacheStrategy.h b/xbmc/filesystem/CacheStrategy.h +index 9c2c28b..9ea7274 100644 +--- a/xbmc/filesystem/CacheStrategy.h ++++ b/xbmc/filesystem/CacheStrategy.h +@@ -23,11 +23,7 @@ + #define XFILECACHESTRATEGY_H + + #include +-#ifdef TARGET_POSIX +-#include "PlatformDefs.h" +-#include "XHandlePublic.h" +-#include "XFileUtils.h" +-#endif ++#include + #include "threads/CriticalSection.h" + #include "threads/Event.h" + +@@ -38,6 +34,8 @@ namespace XFILE { + #define CACHE_RC_WOULD_BLOCK -2 + #define CACHE_RC_TIMEOUT -3 + ++class IFile; // forward declaration ++ + class CCacheStrategy{ + public: + CCacheStrategy(); +@@ -95,8 +93,9 @@ class CSimpleFileCache : public CCacheStrategy { + int64_t GetAvailableRead(); + + protected: +- HANDLE m_hCacheFileRead; +- HANDLE m_hCacheFileWrite; ++ std::string m_filename; ++ IFile* m_cacheFileRead; ++ IFile* m_cacheFileWrite; + CEvent* m_hDataAvailEvent; + volatile int64_t m_nStartPosition; + volatile int64_t m_nWritePosition; + +From 1e29484fe28738a61ec1fd5098287cd90c66a467 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Sat, 11 Oct 2014 22:45:15 +0100 +Subject: [PATCH 95/96] [ResamplePi] Fix for 24bit audio + +--- + .../AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp | 12 +++++++----- + xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h | 1 + + 2 files changed, 8 insertions(+), 5 deletions(-) + +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp +index 77abb61..a50cd70 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp +@@ -113,22 +113,24 @@ bool CActiveAEResamplePi::Init(uint64_t dst_chan_layout, int dst_channels, int d + { + LOGTIMEINIT("x"); + +- CLog::Log(LOGINFO, "%s::%s remap:%p chan:%d->%d rate:%d->%d format:%d->%d bits:%d->%d norm:%d upmix:%d", CLASSNAME, __func__, remapLayout, src_channels, dst_channels, src_rate, dst_rate, src_fmt, dst_fmt, src_bits, dst_bits, normalize, upmix); +- +- // replace passed in number of bits with correct ones +- src_bits = format_to_bits(src_fmt); +- dst_bits = format_to_bits(dst_fmt); ++ CLog::Log(LOGINFO, "%s::%s remap:%p chan:%d->%d rate:%d->%d format:%d->%d bits:%d->%d dither:%d->%d norm:%d upmix:%d", CLASSNAME, __func__, remapLayout, src_channels, dst_channels, src_rate, dst_rate, src_fmt, dst_fmt, src_bits, dst_bits, src_dither, dst_dither, normalize, upmix); + ++ if (!src_bits) ++ src_bits = format_to_bits(src_fmt); ++ if (!dst_bits) ++ dst_bits = format_to_bits(dst_fmt); + m_dst_chan_layout = dst_chan_layout; + m_dst_channels = dst_channels; + m_dst_rate = dst_rate; + m_dst_fmt = dst_fmt; + m_dst_bits = dst_bits; ++ m_dst_dither_bits = dst_dither; + m_src_chan_layout = src_chan_layout; + m_src_channels = src_channels; + m_src_rate = src_rate; + m_src_fmt = src_fmt; + m_src_bits = src_bits; ++ m_src_dither_bits = src_dither; + m_offset = 0; + + if (m_dst_chan_layout == 0) +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h +index b3b1f9b..5c5f9ce 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h +@@ -46,6 +46,7 @@ class CActiveAEResamplePi : public IAEResample + int m_src_channels, m_dst_channels; + AVSampleFormat m_src_fmt, m_dst_fmt; + int m_src_bits, m_dst_bits; ++ int m_src_dither_bits, m_dst_dither_bits; + + OMX_AUDIO_PARAM_PCMMODETYPE m_pcm_input; + OMX_AUDIO_PARAM_PCMMODETYPE m_pcm_output; + +From 4ca242401cb559f0ba3e8b6d3bd87f460e887101 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 13 Oct 2014 22:37:52 +0100 +Subject: [PATCH 96/96] [rbp] Fix for orientation handling of Pi textures + +There were a number of "off by one" errors in the orientations when using accelerated jpeg<->textures on the Pi. +This mostly worked out, but was the root cause of this issue: +http://forum.xbmc.org/showthread.php?tid=192380&pid=1805144#pid1805144 +--- + xbmc/TextureCacheJob.cpp | 2 +- + xbmc/cores/omxplayer/OMXImage.cpp | 19 +++++++++++-------- + xbmc/cores/omxplayer/OMXImage.h | 4 ++-- + xbmc/guilib/TexturePi.cpp | 4 ++-- + 4 files changed, 16 insertions(+), 13 deletions(-) + +diff --git a/xbmc/TextureCacheJob.cpp b/xbmc/TextureCacheJob.cpp +index 2fdeef7..fe0904d 100644 +--- a/xbmc/TextureCacheJob.cpp ++++ b/xbmc/TextureCacheJob.cpp +@@ -97,7 +97,7 @@ bool CTextureCacheJob::CacheTexture(CBaseTexture **out_texture) + m_details.height = height; + m_details.file = m_cachePath + ".jpg"; + if (out_texture) +- *out_texture = LoadImage(CTextureCache::GetCachedPath(m_details.file), width, height, additional_info); ++ *out_texture = LoadImage(CTextureCache::GetCachedPath(m_details.file), width, height, "" /* already flipped */); + CLog::Log(LOGDEBUG, "Fast %s image '%s' to '%s': %p", m_oldHash.empty() ? "Caching" : "Recaching", image.c_str(), m_details.file.c_str(), out_texture); + return true; + } +diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp +index 57f69c5..22ec3f0 100644 +--- a/xbmc/cores/omxplayer/OMXImage.cpp ++++ b/xbmc/cores/omxplayer/OMXImage.cpp +@@ -206,7 +206,8 @@ bool COMXImage::CreateThumb(const std::string& srcFile, unsigned int maxHeight, + COMXImageReEnc reenc; + void *pDestBuffer; + unsigned int nDestSize; +- if (URIUtils::HasExtension(srcFile, ".jpg|.tbn") && file.ReadFile(srcFile) && reenc.ReEncode(file, maxWidth, maxHeight, pDestBuffer, nDestSize)) ++ int orientation = additional_info == "flipped" ? 1:0; ++ if (URIUtils::HasExtension(srcFile, ".jpg|.tbn") && file.ReadFile(srcFile, orientation) && reenc.ReEncode(file, maxWidth, maxHeight, pDestBuffer, nDestSize)) + { + XFILE::CFile outfile; + if (outfile.OpenForWrite(destFile, true)) +@@ -592,7 +593,7 @@ static void inline SKIPN(uint8_t * &p, unsigned int n) + p += n; + } + +-OMX_IMAGE_CODINGTYPE COMXImageFile::GetCodingType(unsigned int &width, unsigned int &height) ++OMX_IMAGE_CODINGTYPE COMXImageFile::GetCodingType(unsigned int &width, unsigned int &height, int orientation) + { + OMX_IMAGE_CODINGTYPE eCompressionFormat = OMX_IMAGE_CodingMax; + bool progressive = false; +@@ -809,7 +810,7 @@ OMX_IMAGE_CODINGTYPE COMXImageFile::GetCodingType(unsigned int &width, unsigned + { + SKIPN(p, 1 * 7); + readBits += 7; +- m_orientation = READ8(p); ++ m_orientation = READ8(p)-1; + readBits += 1; + SKIPN(p, 1 * 2); + readBits += 2; +@@ -818,7 +819,7 @@ OMX_IMAGE_CODINGTYPE COMXImageFile::GetCodingType(unsigned int &width, unsigned + { + SKIPN(p, 1 * 6); + readBits += 6; +- m_orientation = READ8(p); ++ m_orientation = READ8(p)-1; + readBits += 1; + SKIPN(p, 1 * 3); + readBits += 3; +@@ -848,7 +849,9 @@ OMX_IMAGE_CODINGTYPE COMXImageFile::GetCodingType(unsigned int &width, unsigned + } + } + +- if(m_orientation > 8) ++ // apply input orientation ++ m_orientation = m_orientation ^ orientation; ++ if(m_orientation < 0 || m_orientation >= 8) + m_orientation = 0; + + if(eCompressionFormat == OMX_IMAGE_CodingMax) +@@ -872,7 +875,7 @@ OMX_IMAGE_CODINGTYPE COMXImageFile::GetCodingType(unsigned int &width, unsigned + } + + +-bool COMXImageFile::ReadFile(const std::string& inputFile) ++bool COMXImageFile::ReadFile(const std::string& inputFile, int orientation) + { + XFILE::CFile m_pFile; + m_filename = inputFile.c_str(); +@@ -903,7 +906,7 @@ bool COMXImageFile::ReadFile(const std::string& inputFile) + m_pFile.Read(m_image_buffer, m_image_size); + m_pFile.Close(); + +- OMX_IMAGE_CODINGTYPE eCompressionFormat = GetCodingType(m_width, m_height); ++ OMX_IMAGE_CODINGTYPE eCompressionFormat = GetCodingType(m_width, m_height, orientation); + if(eCompressionFormat != OMX_IMAGE_CodingJPEG) + { + CLog::Log(LOGERROR, "%s::%s %s GetCodingType=0x%x\n", CLASSNAME, __func__, inputFile.c_str(), eCompressionFormat); +@@ -1659,7 +1662,7 @@ bool COMXImageReEnc::HandlePortSettingChange(unsigned int resize_width, unsigned + item.metadata.eValueCharset = OMX_MetadataCharsetASCII; + item.metadata.sLanguageCountry = 0; + item.metadata.nValueMaxSize = sizeof(item.metadata_space); +- sprintf((char *)item.metadata.nValue, "%d", orientation); ++ sprintf((char *)item.metadata.nValue, "%d", orientation + 1); + item.metadata.nValueSizeUsed = strlen((char *)item.metadata.nValue); + + omx_err = m_omx_encoder.SetParameter(OMX_IndexConfigMetadataItem, &item); +diff --git a/xbmc/cores/omxplayer/OMXImage.h b/xbmc/cores/omxplayer/OMXImage.h +index 90e513a..a93aa82 100644 +--- a/xbmc/cores/omxplayer/OMXImage.h ++++ b/xbmc/cores/omxplayer/OMXImage.h +@@ -94,7 +94,7 @@ class COMXImageFile + public: + COMXImageFile(); + virtual ~COMXImageFile(); +- bool ReadFile(const std::string& inputFile); ++ bool ReadFile(const std::string& inputFile, int orientation = 0); + int GetOrientation() { return m_orientation; }; + unsigned int GetWidth() { return m_width; }; + unsigned int GetHeight() { return m_height; }; +@@ -102,7 +102,7 @@ class COMXImageFile + const uint8_t *GetImageBuffer() { return (const uint8_t *)m_image_buffer; }; + const char *GetFilename() { return m_filename; }; + protected: +- OMX_IMAGE_CODINGTYPE GetCodingType(unsigned int &width, unsigned int &height); ++ OMX_IMAGE_CODINGTYPE GetCodingType(unsigned int &width, unsigned int &height, int orientation); + uint8_t *m_image_buffer; + unsigned long m_image_size; + unsigned int m_width; +diff --git a/xbmc/guilib/TexturePi.cpp b/xbmc/guilib/TexturePi.cpp +index 3950b3f..a17bfba 100644 +--- a/xbmc/guilib/TexturePi.cpp ++++ b/xbmc/guilib/TexturePi.cpp +@@ -142,8 +142,8 @@ bool CPiTexture::LoadFromFileInternal(const CStdString& texturePath, unsigned in + if (okay) + { + m_hasAlpha = false; +- if (autoRotate && orientation) +- m_orientation = orientation - 1; ++ if (autoRotate) ++ m_orientation = orientation; + return true; + } + }