aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Kodi.xcodeproj/project.pbxproj8
-rw-r--r--project/VS2010Express/XBMC.vcxproj2
-rw-r--r--project/VS2010Express/XBMC.vcxproj.filters8
-rw-r--r--xbmc/Application.cpp1
-rw-r--r--xbmc/Application.h3
-rw-r--r--xbmc/addons/BinaryAddonCache.cpp78
-rw-r--r--xbmc/addons/BinaryAddonCache.h47
-rw-r--r--xbmc/addons/CMakeLists.txt2
-rw-r--r--xbmc/addons/Makefile1
-rw-r--r--xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp4
-rw-r--r--xbmc/cores/paplayer/CodecFactory.cpp6
-rw-r--r--xbmc/filesystem/FileDirectoryFactory.cpp4
-rw-r--r--xbmc/settings/AdvancedSettings.cpp3
13 files changed, 157 insertions, 10 deletions
diff --git a/Kodi.xcodeproj/project.pbxproj b/Kodi.xcodeproj/project.pbxproj
index 04058c7021..93e4302c0f 100644
--- a/Kodi.xcodeproj/project.pbxproj
+++ b/Kodi.xcodeproj/project.pbxproj
@@ -695,6 +695,8 @@
7CF80DCA19710DC2003B2B34 /* KeyboardLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CF80DC719710DC2003B2B34 /* KeyboardLayout.cpp */; };
7CFC08381C5BA7D0000E5E73 /* DVDDemuxClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFC08361C5BA7D0000E5E73 /* DVDDemuxClient.cpp */; };
7CFC08391C5BA7D0000E5E73 /* DVDDemuxClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFC08361C5BA7D0000E5E73 /* DVDDemuxClient.cpp */; };
+ 7CFEA2B21C98618400A0B60B /* BinaryAddonCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFEA2B01C98618400A0B60B /* BinaryAddonCache.cpp */; };
+ 7CFEA2B31C98618400A0B60B /* BinaryAddonCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFEA2B01C98618400A0B60B /* BinaryAddonCache.cpp */; };
80204F121C91CD3600E8C88B /* InputStreamMultiSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 80204F0F1C91CD3600E8C88B /* InputStreamMultiSource.cpp */; };
80204F131C91CD3600E8C88B /* InputStreamMultiSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 80204F0F1C91CD3600E8C88B /* InputStreamMultiSource.cpp */; };
815EE6350E17F1DC009FBE3C /* DVDInputStreamRTMP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 815EE6330E17F1DC009FBE3C /* DVDInputStreamRTMP.cpp */; };
@@ -3403,6 +3405,8 @@
7CF80DC819710DC2003B2B34 /* KeyboardLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyboardLayout.h; sourceTree = "<group>"; };
7CFC08361C5BA7D0000E5E73 /* DVDDemuxClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDDemuxClient.cpp; sourceTree = "<group>"; };
7CFC08371C5BA7D0000E5E73 /* DVDDemuxClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVDDemuxClient.h; sourceTree = "<group>"; };
+ 7CFEA2B01C98618400A0B60B /* BinaryAddonCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BinaryAddonCache.cpp; sourceTree = "<group>"; };
+ 7CFEA2B11C98618400A0B60B /* BinaryAddonCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BinaryAddonCache.h; sourceTree = "<group>"; };
80204F0F1C91CD3600E8C88B /* InputStreamMultiSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InputStreamMultiSource.cpp; sourceTree = "<group>"; };
80204F101C91CD3600E8C88B /* InputStreamMultiSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputStreamMultiSource.h; sourceTree = "<group>"; };
80204F111C91CD3600E8C88B /* InputStreamMultiStreams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputStreamMultiStreams.h; sourceTree = "<group>"; };
@@ -5110,6 +5114,8 @@
395C2A231AA4C32100EBC7AD /* AudioDecoder.h */,
7CF34D9D1930264A00D543C5 /* AudioEncoder.cpp */,
7CF34D9E1930264A00D543C5 /* AudioEncoder.h */,
+ 7CFEA2B01C98618400A0B60B /* BinaryAddonCache.cpp */,
+ 7CFEA2B11C98618400A0B60B /* BinaryAddonCache.h */,
DF54F8011B6580C8000FCBA4 /* ContextMenuAddon.cpp */,
DF54F8021B6580C8000FCBA4 /* ContextMenuAddon.h */,
18B49FF61152BFA5001AF8A6 /* DllAddon.h */,
@@ -10383,6 +10389,7 @@
7C1A492315A962EE004AF4A4 /* SeekHandler.cpp in Sources */,
DF830D0C15BB260C00602BE6 /* GUIDialogKeyboardGeneric.cpp in Sources */,
DF830D1215BB262700602BE6 /* GUIKeyboardFactory.cpp in Sources */,
+ 7CFEA2B21C98618400A0B60B /* BinaryAddonCache.cpp in Sources */,
36A9466315CF1FA600727135 /* DbUrl.cpp in Sources */,
3994427F1A8DD96F006C39E9 /* VideoLibraryQueue.cpp in Sources */,
36A9466715CF1FD200727135 /* MusicDbUrl.cpp in Sources */,
@@ -11541,6 +11548,7 @@
E49914A9174E607200741B6D /* GUIWindowScreensaverDim.cpp in Sources */,
E49914AA174E607200741B6D /* GUIWindowStartup.cpp in Sources */,
E49914AB174E607200741B6D /* GUIWindowSystemInfo.cpp in Sources */,
+ 7CFEA2B31C98618400A0B60B /* BinaryAddonCache.cpp in Sources */,
7C8E022F1BA35D0B0072E8B2 /* GUIControlBuiltins.cpp in Sources */,
E49914AC174E607200741B6D /* GUIWindowWeather.cpp in Sources */,
DF91E93B1C0A21D60011084D /* xbmc.cpp in Sources */,
diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj
index 44b26e1025..8a4389eb89 100644
--- a/project/VS2010Express/XBMC.vcxproj
+++ b/project/VS2010Express/XBMC.vcxproj
@@ -186,6 +186,7 @@
<ClCompile Include="..\..\xbmc\addons\AddonInstaller.cpp" />
<ClCompile Include="..\..\xbmc\addons\AddonSystemSettings.cpp" />
<ClCompile Include="..\..\xbmc\addons\AddonVersion.cpp" />
+ <ClCompile Include="..\..\xbmc\addons\BinaryAddonCache.cpp" />
<ClCompile Include="..\..\xbmc\addons\binary\interfaces\AddonInterfaces.cpp" />
<ClCompile Include="..\..\xbmc\addons\binary\interfaces\api1\Addon\AddonCallbacksAddon.cpp" />
<ClCompile Include="..\..\xbmc\addons\binary\interfaces\api1\AudioDSP\AddonCallbacksAudioDSP.cpp" />
@@ -957,6 +958,7 @@
<ClCompile Include="..\..\xbmc\DatabaseManager.cpp" />
<ClInclude Include="..\..\xbmc\addons\AddonBuilder.h" />
<ClInclude Include="..\..\xbmc\addons\AudioDecoder.h" />
+ <ClInclude Include="..\..\xbmc\addons\BinaryAddonCache.h" />
<ClInclude Include="..\..\xbmc\addons\binary\interfaces\AddonInterfaces.h" />
<ClInclude Include="..\..\xbmc\addons\binary\interfaces\api1\Addon\AddonCallbacksAddon.h" />
<ClInclude Include="..\..\xbmc\addons\binary\interfaces\api1\AudioDSP\AddonCallbacksAudioDSP.h" />
diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters
index 8e463dc291..23e0c76888 100644
--- a/project/VS2010Express/XBMC.vcxproj.filters
+++ b/project/VS2010Express/XBMC.vcxproj.filters
@@ -3454,6 +3454,9 @@
<ClCompile Include="..\..\xbmc\peripherals\addons\AddonButtonMap.cpp">
<Filter>peripherals\addons</Filter>
</ClCompile>
+ <ClCompile Include="..\..\xbmc\addons\BinaryAddonCache.cpp">
+ <Filter>addons</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\xbmc\win32\pch.h">
@@ -6713,6 +6716,9 @@
<ClInclude Include="..\..\xbmc\peripherals\addons\AddonButtonMap.h">
<Filter>peripherals\addons</Filter>
</ClInclude>
+ <ClInclude Include="..\..\xbmc\addons\BinaryAddonCache.h">
+ <Filter>addons</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc">
@@ -6799,4 +6805,4 @@
<Filter>shaders</Filter>
</FxCompile>
</ItemGroup>
-</Project>
+</Project> \ No newline at end of file
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index 72e4e61385..d74106742d 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -664,6 +664,7 @@ bool CApplication::Create()
CLog::Log(LOGFATAL, "CApplication::Create: Unable to start CAddonMgr");
return false;
}
+ m_binaryAddonCache.Init();
// Create the Mouse, Keyboard, Remote, and Joystick devices
// Initialize after loading settings to get joystick deadzone setting
diff --git a/xbmc/Application.h b/xbmc/Application.h
index b3af0b0512..80a3d5e577 100644
--- a/xbmc/Application.h
+++ b/xbmc/Application.h
@@ -27,6 +27,7 @@
#include "guilib/Resolution.h"
#include "utils/GlobalsHandling.h"
#include "messaging/IMessageTarget.h"
+#include "addons/BinaryAddonCache.h"
#include <map>
#include <memory>
@@ -389,6 +390,8 @@ public:
*/
void UnregisterActionListener(IActionListener *listener);
+ ADDON::CBinaryAddonCache m_binaryAddonCache;
+
protected:
virtual bool OnSettingsSaving() const override;
diff --git a/xbmc/addons/BinaryAddonCache.cpp b/xbmc/addons/BinaryAddonCache.cpp
new file mode 100644
index 0000000000..ddf0f4106b
--- /dev/null
+++ b/xbmc/addons/BinaryAddonCache.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2016 Team Kodi
+ * http://kodi.tv
+ *
+ * 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
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "BinaryAddonCache.h"
+#include "AddonManager.h"
+#include "threads/SingleLock.h"
+
+namespace ADDON
+{
+
+CBinaryAddonCache::~CBinaryAddonCache()
+{
+ CAddonMgr::GetInstance().UnregisterObserver(this);
+}
+
+void CBinaryAddonCache::Init()
+{
+ m_addonsToCache = {ADDON_AUDIODECODER, ADDON_INPUTSTREAM};
+ CAddonMgr::GetInstance().RegisterObserver(this);
+ Update();
+}
+
+void CBinaryAddonCache::GetAddons(VECADDONS& addons, const TYPE& type)
+{
+ CSingleLock lock(m_critSection);
+ auto it = m_addons.find(type);
+
+ if (it != m_addons.end())
+ {
+ for (auto &addon : it->second)
+ {
+ addons.push_back(addon);
+ }
+ }
+}
+
+void CBinaryAddonCache::Notify(const Observable &obs, const ObservableMessage msg)
+{
+ Update();
+}
+
+void CBinaryAddonCache::Update()
+{
+ using AddonMap = std::multimap<TYPE, VECADDONS>;
+ AddonMap addonmap;
+ addonmap.clear();
+
+ for (auto &addonType : m_addonsToCache)
+ {
+ VECADDONS addons;
+ CAddonMgr::GetInstance().GetAddons(addons, addonType);
+ addonmap.insert(AddonMap::value_type(addonType, addons));
+ }
+
+ {
+ CSingleLock lock(m_critSection);
+ m_addons = addonmap;
+ }
+}
+
+} \ No newline at end of file
diff --git a/xbmc/addons/BinaryAddonCache.h b/xbmc/addons/BinaryAddonCache.h
new file mode 100644
index 0000000000..0be094fbcf
--- /dev/null
+++ b/xbmc/addons/BinaryAddonCache.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2016 Team Kodi
+ * http://kodi.tv
+ *
+ * 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
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+#include "utils/Observer.h"
+#include "Addon.h"
+#include "threads/CriticalSection.h"
+#include <map>
+#include <vector>
+
+namespace ADDON {
+
+class CBinaryAddonCache : public Observer
+{
+public:
+ virtual ~CBinaryAddonCache();
+ void Init();
+ void GetAddons(VECADDONS& addons, const TYPE& type);
+ virtual void Notify(const Observable &obs, const ObservableMessage msg) override;
+
+protected:
+ void Update();
+
+ CCriticalSection m_critSection;
+ std::multimap<TYPE, VECADDONS> m_addons;
+ std::vector<TYPE> m_addonsToCache;
+};
+
+} \ No newline at end of file
diff --git a/xbmc/addons/CMakeLists.txt b/xbmc/addons/CMakeLists.txt
index e0c6fc0726..8d923d92aa 100644
--- a/xbmc/addons/CMakeLists.txt
+++ b/xbmc/addons/CMakeLists.txt
@@ -1,5 +1,6 @@
set(SOURCES Addon.cpp
AddonBuilder.cpp
+ BinaryAddonCache.cpp
AddonDatabase.cpp
AddonInstaller.cpp
AddonManager.cpp
@@ -29,6 +30,7 @@ set(SOURCES Addon.cpp
set(HEADERS Addon.h
AddonBuilder.h
+ BinaryAddonCache.h
AddonDatabase.h
AddonDll.h
AddonInstaller.h
diff --git a/xbmc/addons/Makefile b/xbmc/addons/Makefile
index 88ea7874bb..5e42f303cd 100644
--- a/xbmc/addons/Makefile
+++ b/xbmc/addons/Makefile
@@ -1,5 +1,6 @@
SRCS=Addon.cpp \
AddonBuilder.cpp \
+ BinaryAddonCache.cpp \
AddonDatabase.cpp \
AddonInstaller.cpp \
AddonManager.cpp \
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
index d92211e163..79221abeb3 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
@@ -39,7 +39,7 @@
#include "URL.h"
#include "filesystem/File.h"
#include "utils/URIUtils.h"
-#include "addons/AddonManager.h"
+#include "Application.h"
#include "addons/InputStream.h"
#include "Util.h"
@@ -60,7 +60,7 @@ CDVDInputStream* CDVDFactoryInputStream::CreateInputStream(IVideoPlayer* pPlayer
}
ADDON::VECADDONS addons;
- ADDON::CAddonMgr::GetInstance().GetAddons(addons, ADDON::ADDON_INPUTSTREAM);
+ g_application.m_binaryAddonCache.GetAddons(addons, ADDON::ADDON_INPUTSTREAM);
for (size_t i=0; i<addons.size(); ++i)
{
std::shared_ptr<ADDON::CInputStream> input(std::static_pointer_cast<ADDON::CInputStream>(addons[i]));
diff --git a/xbmc/cores/paplayer/CodecFactory.cpp b/xbmc/cores/paplayer/CodecFactory.cpp
index b994255e9b..b947616a98 100644
--- a/xbmc/cores/paplayer/CodecFactory.cpp
+++ b/xbmc/cores/paplayer/CodecFactory.cpp
@@ -23,8 +23,8 @@
#include "URL.h"
#include "VideoPlayerCodec.h"
#include "utils/StringUtils.h"
-#include "addons/AddonManager.h"
#include "addons/AudioDecoder.h"
+#include "Application.h"
using namespace ADDON;
@@ -33,7 +33,7 @@ ICodec* CodecFactory::CreateCodec(const std::string &strFileType)
std::string fileType = strFileType;
StringUtils::ToLower(fileType);
VECADDONS codecs;
- CAddonMgr::GetInstance().GetAddons(codecs, ADDON_AUDIODECODER);
+ g_application.m_binaryAddonCache.GetAddons(codecs, ADDON_AUDIODECODER);
for (size_t i=0;i<codecs.size();++i)
{
std::shared_ptr<CAudioDecoder> dec(std::static_pointer_cast<CAudioDecoder>(codecs[i]));
@@ -58,7 +58,7 @@ ICodec* CodecFactory::CreateCodecDemux(const std::string& strFile, const std::st
if (!content.empty())
{
VECADDONS codecs;
- CAddonMgr::GetInstance().GetAddons(codecs, ADDON_AUDIODECODER);
+ g_application.m_binaryAddonCache.GetAddons(codecs, ADDON_AUDIODECODER);
for (size_t i=0;i<codecs.size();++i)
{
std::shared_ptr<CAudioDecoder> dec(std::static_pointer_cast<CAudioDecoder>(codecs[i]));
diff --git a/xbmc/filesystem/FileDirectoryFactory.cpp b/xbmc/filesystem/FileDirectoryFactory.cpp
index 228f400a06..109defc336 100644
--- a/xbmc/filesystem/FileDirectoryFactory.cpp
+++ b/xbmc/filesystem/FileDirectoryFactory.cpp
@@ -43,7 +43,7 @@
#include "FileItem.h"
#include "utils/StringUtils.h"
#include "URL.h"
-#include "addons/AddonManager.h"
+#include "Application.h"
#include "addons/AudioDecoder.h"
using namespace ADDON;
@@ -67,7 +67,7 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem,
if (!strExtension.empty())
{
VECADDONS codecs;
- CAddonMgr::GetInstance().GetAddons(codecs, ADDON_AUDIODECODER);
+ g_application.m_binaryAddonCache.GetAddons(codecs, ADDON_AUDIODECODER);
for (size_t i=0;i<codecs.size();++i)
{
std::shared_ptr<CAudioDecoder> dec(std::static_pointer_cast<CAudioDecoder>(codecs[i]));
diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp
index 4c29b5daaf..f79b33bbed 100644
--- a/xbmc/settings/AdvancedSettings.cpp
+++ b/xbmc/settings/AdvancedSettings.cpp
@@ -25,7 +25,6 @@
#include <string>
#include <vector>
-#include "addons/AddonManager.h"
#include "addons/AudioDecoder.h"
#include "addons/IAddon.h"
#include "Application.h"
@@ -1356,7 +1355,7 @@ std::string CAdvancedSettings::GetMusicExtensions() const
std::string result(m_musicExtensions);
VECADDONS codecs;
- CAddonMgr::GetInstance().GetAddons(codecs, ADDON_AUDIODECODER);
+ g_application.m_binaryAddonCache.GetAddons(codecs, ADDON_AUDIODECODER);
for (size_t i=0;i<codecs.size();++i)
{
std::shared_ptr<CAudioDecoder> dec(std::static_pointer_cast<CAudioDecoder>(codecs[i]));