aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlwin Esch <alwin.esch@web.de>2020-06-16 22:35:43 +0200
committerAlwin Esch <alwin.esch@web.de>2020-06-16 22:35:43 +0200
commit19cd8b623b6c43962a4cd3037af72427b2ac2c97 (patch)
tree471f219f67cffae20f353d7329413b434bba1038
parentb638101b0e1aa7c3f275f8766134914ba1954c4f (diff)
[addons] use CAddonInfo everywhere and prevent CBinaryAddonBase
Majorly is the handling changed, as CBinaryAddonBase becomes created on background and register his now in binary addon manager. On last destruct it becomes removed from there. This thought to fix problems with to late or missing report on binary addon manager and remove obsolete parts (them was mostly thought before with cpluff).
-rw-r--r--xbmc/addons/AddonManager.cpp17
-rw-r--r--xbmc/addons/AddonManager.h14
-rw-r--r--xbmc/addons/AddonProvider.h28
-rw-r--r--xbmc/addons/AudioDecoder.cpp2
-rw-r--r--xbmc/addons/AudioDecoder.h11
-rw-r--r--xbmc/addons/AudioEncoder.cpp2
-rw-r--r--xbmc/addons/AudioEncoder.h2
-rw-r--r--xbmc/addons/ImageDecoder.cpp4
-rw-r--r--xbmc/addons/ImageDecoder.h2
-rw-r--r--xbmc/addons/ScreenSaver.cpp4
-rw-r--r--xbmc/addons/ScreenSaver.h2
-rw-r--r--xbmc/addons/VFSEntry.cpp10
-rw-r--r--xbmc/addons/VFSEntry.h5
-rw-r--r--xbmc/addons/Visualization.cpp4
-rw-r--r--xbmc/addons/Visualization.h2
-rw-r--r--xbmc/addons/binary-addons/AddonInstanceHandler.cpp19
-rw-r--r--xbmc/addons/binary-addons/AddonInstanceHandler.h8
-rw-r--r--xbmc/addons/binary-addons/BinaryAddonBase.cpp6
-rw-r--r--xbmc/addons/binary-addons/BinaryAddonBase.h3
-rw-r--r--xbmc/addons/binary-addons/BinaryAddonManager.cpp52
-rw-r--r--xbmc/addons/binary-addons/BinaryAddonManager.h6
-rw-r--r--xbmc/addons/interfaces/General.cpp1
-rw-r--r--xbmc/cdrip/CDDARipJob.cpp3
-rw-r--r--xbmc/cdrip/CDDARipper.cpp2
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp2
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/Video/AddonVideoCodec.cpp3
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/Video/AddonVideoCodec.h2
-rw-r--r--xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp5
-rw-r--r--xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp33
-rw-r--r--xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.h10
-rw-r--r--xbmc/cores/paplayer/CodecFactory.cpp9
-rw-r--r--xbmc/filesystem/FileDirectoryFactory.cpp5
-rw-r--r--xbmc/guilib/GUIVisualisationControl.cpp5
-rw-r--r--xbmc/guilib/imagefactory.cpp6
-rw-r--r--xbmc/music/tags/MusicInfoTagLoaderFactory.cpp5
-rw-r--r--xbmc/network/GUIDialogNetworkSetup.cpp1
-rw-r--r--xbmc/peripherals/addons/PeripheralAddon.cpp3
-rw-r--r--xbmc/peripherals/addons/PeripheralAddon.h7
-rw-r--r--xbmc/peripherals/bus/virtual/PeripheralBusAddon.cpp26
-rw-r--r--xbmc/peripherals/bus/virtual/PeripheralBusAddon.h3
-rw-r--r--xbmc/pvr/addons/PVRClient.cpp4
-rw-r--r--xbmc/pvr/addons/PVRClient.h2
-rw-r--r--xbmc/pvr/addons/PVRClients.cpp14
-rw-r--r--xbmc/settings/SettingConditions.cpp1
-rw-r--r--xbmc/windows/GUIWindowScreensaver.cpp5
-rw-r--r--xbmc/windows/GUIWindowScreensaverDim.cpp2
46 files changed, 221 insertions, 141 deletions
diff --git a/xbmc/addons/AddonManager.cpp b/xbmc/addons/AddonManager.cpp
index 09fca28ed8..007205d52e 100644
--- a/xbmc/addons/AddonManager.cpp
+++ b/xbmc/addons/AddonManager.cpp
@@ -929,6 +929,23 @@ bool CAddonMgr::GetAddonInfos(AddonInfos& addonInfos, bool enabledOnly, TYPE typ
return !addonInfos.empty();
}
+bool CAddonMgr::GetDisabledAddonInfos(std::vector<AddonInfoPtr>& addonInfos, TYPE type)
+{
+ CSingleLock lock(m_critSection);
+
+ bool forUnknown = type == ADDON_UNKNOWN;
+ for (const auto& info : m_installedAddons)
+ {
+ if (m_disabled.find(info.first) == m_disabled.end())
+ continue;
+
+ if (info.second->MainType() != ADDON_UNKNOWN && (forUnknown || info.second->HasType(type)))
+ addonInfos.emplace_back(info.second);
+ }
+
+ return !addonInfos.empty();
+}
+
const AddonInfoPtr CAddonMgr::GetAddonInfo(const std::string& id,
TYPE type /*= ADDON_UNKNOWN*/) const
{
diff --git a/xbmc/addons/AddonManager.h b/xbmc/addons/AddonManager.h
index 93d0452533..a97956d6a7 100644
--- a/xbmc/addons/AddonManager.h
+++ b/xbmc/addons/AddonManager.h
@@ -276,6 +276,20 @@ namespace ADDON
*/
bool GetAddonInfos(AddonInfos& addonInfos, bool enabledOnly, TYPE type) const;
+ /*!
+ * @brief Get a list of disabled add-on's with info's for the on system
+ * available ones.
+ *
+ * @param[out] addonInfos list where finded addon information becomes stored
+ * @param[in] type The requested type, with "ADDON_UNKNOWN"
+ * are all add-on types given back who match the case
+ * with value before.
+ * If a type id becomes added are only add-ons
+ * returned who match them. Default is for all types.
+ * @return true if the list contains entries
+ */
+ bool GetDisabledAddonInfos(std::vector<AddonInfoPtr>& addonInfos, TYPE type);
+
const AddonInfoPtr GetAddonInfo(const std::string& id, TYPE type = ADDON_UNKNOWN) const;
/*!
diff --git a/xbmc/addons/AddonProvider.h b/xbmc/addons/AddonProvider.h
index c80cc3c562..16ba23d0e1 100644
--- a/xbmc/addons/AddonProvider.h
+++ b/xbmc/addons/AddonProvider.h
@@ -20,21 +20,21 @@
namespace ADDON
{
- class CBinaryAddonBase;
- typedef std::shared_ptr<CBinaryAddonBase> BinaryAddonBasePtr;
+class CAddonInfo;
+typedef std::shared_ptr<CAddonInfo> AddonInfoPtr;
- class IAddonProvider
+class IAddonProvider
+{
+public:
+ virtual ~IAddonProvider() = default;
+ enum INSTANCE_TYPE
{
- public:
- virtual ~IAddonProvider() = default;
- enum INSTANCE_TYPE
- {
- INSTANCE_INPUTSTREAM,
- INSTANCE_VIDEOCODEC
- };
- virtual void getAddonInstance(INSTANCE_TYPE instance_type,
- ADDON::BinaryAddonBasePtr& addonBase,
- KODI_HANDLE& parentInstance) = 0;
+ INSTANCE_INPUTSTREAM,
+ INSTANCE_VIDEOCODEC
};
+ virtual void getAddonInstance(INSTANCE_TYPE instance_type,
+ ADDON::AddonInfoPtr& addonInfo,
+ KODI_HANDLE& parentInstance) = 0;
+};
- } //Namespace
+} // namespace ADDON
diff --git a/xbmc/addons/AudioDecoder.cpp b/xbmc/addons/AudioDecoder.cpp
index 8a3f953dd4..900b9259be 100644
--- a/xbmc/addons/AudioDecoder.cpp
+++ b/xbmc/addons/AudioDecoder.cpp
@@ -14,7 +14,7 @@
namespace ADDON
{
-CAudioDecoder::CAudioDecoder(const BinaryAddonBasePtr& addonInfo)
+CAudioDecoder::CAudioDecoder(const AddonInfoPtr& addonInfo)
: IAddonInstanceHandler(ADDON_INSTANCE_AUDIODECODER, addonInfo)
{
m_CodecName = addonInfo->Type(ADDON_AUDIODECODER)->GetValue("@name").asString();
diff --git a/xbmc/addons/AudioDecoder.h b/xbmc/addons/AudioDecoder.h
index 5ae964c09b..a561aeb0d7 100644
--- a/xbmc/addons/AudioDecoder.h
+++ b/xbmc/addons/AudioDecoder.h
@@ -8,7 +8,6 @@
#pragma once
#include "addons/binary-addons/AddonInstanceHandler.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
#include "addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDecoder.h"
#include "cores/paplayer/ICodec.h"
#include "filesystem/MusicFileDirectory.h"
@@ -29,7 +28,7 @@ namespace ADDON
public XFILE::CMusicFileDirectory
{
public:
- explicit CAudioDecoder(const BinaryAddonBasePtr& addonInfo);
+ explicit CAudioDecoder(const AddonInfoPtr& addonInfo);
~CAudioDecoder() override;
// Things that MUST be supplied by the child classes
@@ -43,22 +42,22 @@ namespace ADDON
EmbeddedArt *art = nullptr) override;
int GetTrackCount(const std::string& strPath) override;
- static inline std::string GetExtensions(const BinaryAddonBasePtr& addonInfo)
+ static inline std::string GetExtensions(const AddonInfoPtr& addonInfo)
{
return addonInfo->Type(ADDON_AUDIODECODER)->GetValue("@extension").asString();
}
- static inline std::string GetMimetypes(const BinaryAddonBasePtr& addonInfo)
+ static inline std::string GetMimetypes(const AddonInfoPtr& addonInfo)
{
return addonInfo->Type(ADDON_AUDIODECODER)->GetValue("@mimetype").asString();
}
- static inline bool HasTags(const BinaryAddonBasePtr& addonInfo)
+ static inline bool HasTags(const AddonInfoPtr& addonInfo)
{
return addonInfo->Type(ADDON_AUDIODECODER)->GetValue("@tags").asBoolean();
}
- static inline bool HasTracks(const BinaryAddonBasePtr& addonInfo)
+ static inline bool HasTracks(const AddonInfoPtr& addonInfo)
{
return addonInfo->Type(ADDON_AUDIODECODER)->GetValue("@tracks").asBoolean();
}
diff --git a/xbmc/addons/AudioEncoder.cpp b/xbmc/addons/AudioEncoder.cpp
index 6eff6fb972..8d0f263ece 100644
--- a/xbmc/addons/AudioEncoder.cpp
+++ b/xbmc/addons/AudioEncoder.cpp
@@ -10,7 +10,7 @@
namespace ADDON
{
-CAudioEncoder::CAudioEncoder(BinaryAddonBasePtr addonInfo)
+CAudioEncoder::CAudioEncoder(const AddonInfoPtr& addonInfo)
: IAddonInstanceHandler(ADDON_INSTANCE_AUDIOENCODER, addonInfo)
{
m_struct = {{ 0 }};
diff --git a/xbmc/addons/AudioEncoder.h b/xbmc/addons/AudioEncoder.h
index b25397fab6..caae93597b 100644
--- a/xbmc/addons/AudioEncoder.h
+++ b/xbmc/addons/AudioEncoder.h
@@ -16,7 +16,7 @@ namespace ADDON
class CAudioEncoder : public IEncoder, public IAddonInstanceHandler
{
public:
- explicit CAudioEncoder(BinaryAddonBasePtr addonBase);
+ explicit CAudioEncoder(const AddonInfoPtr& addonInfo);
// Child functions related to IEncoder
bool Init(AddonToKodiFuncTable_AudioEncoder& callbacks) override;
diff --git a/xbmc/addons/ImageDecoder.cpp b/xbmc/addons/ImageDecoder.cpp
index 64968e2c9d..770b7a5345 100644
--- a/xbmc/addons/ImageDecoder.cpp
+++ b/xbmc/addons/ImageDecoder.cpp
@@ -18,8 +18,8 @@ static const std::map<int, ImageFormat> KodiToAddonFormat = {
namespace ADDON
{
-CImageDecoder::CImageDecoder(BinaryAddonBasePtr addonBase)
- : IAddonInstanceHandler(ADDON_INSTANCE_IMAGEDECODER, addonBase)
+CImageDecoder::CImageDecoder(const AddonInfoPtr& addonInfo)
+ : IAddonInstanceHandler(ADDON_INSTANCE_IMAGEDECODER, addonInfo)
{
// Create all interface parts independent to make API changes easier if
// something is added
diff --git a/xbmc/addons/ImageDecoder.h b/xbmc/addons/ImageDecoder.h
index 650dc38195..22a1271b6f 100644
--- a/xbmc/addons/ImageDecoder.h
+++ b/xbmc/addons/ImageDecoder.h
@@ -17,7 +17,7 @@ namespace ADDON
public IImage
{
public:
- explicit CImageDecoder(ADDON::BinaryAddonBasePtr addonBase);
+ explicit CImageDecoder(const AddonInfoPtr& addonInfo);
~CImageDecoder() override;
bool Create(const std::string& mimetype);
diff --git a/xbmc/addons/ScreenSaver.cpp b/xbmc/addons/ScreenSaver.cpp
index 5530b870f1..6d00b97f3e 100644
--- a/xbmc/addons/ScreenSaver.cpp
+++ b/xbmc/addons/ScreenSaver.cpp
@@ -16,8 +16,8 @@
namespace ADDON
{
-CScreenSaver::CScreenSaver(BinaryAddonBasePtr addonBase)
- : IAddonInstanceHandler(ADDON_INSTANCE_SCREENSAVER, addonBase)
+CScreenSaver::CScreenSaver(const AddonInfoPtr& addonInfo)
+ : IAddonInstanceHandler(ADDON_INSTANCE_SCREENSAVER, addonInfo)
{
m_name = Name();
m_presets = CSpecialProtocol::TranslatePath(Path());
diff --git a/xbmc/addons/ScreenSaver.h b/xbmc/addons/ScreenSaver.h
index 729180523f..c137685633 100644
--- a/xbmc/addons/ScreenSaver.h
+++ b/xbmc/addons/ScreenSaver.h
@@ -17,7 +17,7 @@ namespace ADDON
class CScreenSaver : public IAddonInstanceHandler
{
public:
- explicit CScreenSaver(BinaryAddonBasePtr addonBase);
+ explicit CScreenSaver(const AddonInfoPtr& addonInfo);
~CScreenSaver() override;
bool Start();
diff --git a/xbmc/addons/VFSEntry.cpp b/xbmc/addons/VFSEntry.cpp
index 590bfe80d3..25692d3ae0 100644
--- a/xbmc/addons/VFSEntry.cpp
+++ b/xbmc/addons/VFSEntry.cpp
@@ -9,8 +9,6 @@
#include "ServiceBroker.h"
#include "URL.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
-#include "addons/binary-addons/BinaryAddonManager.h"
#include "addons/interfaces/Filesystem.h"
#include "network/ZeroconfBrowser.h"
#include "utils/StringUtils.h"
@@ -87,8 +85,8 @@ void CVFSAddonCache::Update()
{
std::vector<VFSEntryPtr> addonmap;
- BinaryAddonBaseList addonInfos;
- CServiceBroker::GetBinaryAddonManager().GetAddonInfos(addonInfos, true, ADDON_VFS);
+ std::vector<AddonInfoPtr> addonInfos;
+ CServiceBroker::GetAddonMgr().GetAddonInfos(addonInfos, true, ADDON_VFS);
for (const auto& addonInfo : addonInfos)
{
VFSEntryPtr vfs = std::make_shared<CVFSEntry>(addonInfo);
@@ -137,7 +135,7 @@ class CVFSURLWrapper
std::vector<std::string> m_strings;
};
-CVFSEntry::ProtocolInfo::ProtocolInfo(BinaryAddonBasePtr addonInfo)
+CVFSEntry::ProtocolInfo::ProtocolInfo(const AddonInfoPtr& addonInfo)
: supportPath(addonInfo->Type(ADDON_VFS)->GetValue("@supportPath").asBoolean()),
supportUsername(addonInfo->Type(ADDON_VFS)->GetValue("@supportUsername").asBoolean()),
supportPassword(addonInfo->Type(ADDON_VFS)->GetValue("@supportPassword").asBoolean()),
@@ -150,7 +148,7 @@ CVFSEntry::ProtocolInfo::ProtocolInfo(BinaryAddonBasePtr addonInfo)
{
}
-CVFSEntry::CVFSEntry(BinaryAddonBasePtr addonInfo)
+CVFSEntry::CVFSEntry(const AddonInfoPtr& addonInfo)
: IAddonInstanceHandler(ADDON_INSTANCE_VFS, addonInfo),
m_protocols(addonInfo->Type(ADDON_VFS)->GetValue("@protocols").asString()),
m_extensions(addonInfo->Type(ADDON_VFS)->GetValue("@extensions").asString()),
diff --git a/xbmc/addons/VFSEntry.h b/xbmc/addons/VFSEntry.h
index 9b2f7359f8..5651f0aa2e 100644
--- a/xbmc/addons/VFSEntry.h
+++ b/xbmc/addons/VFSEntry.h
@@ -7,7 +7,6 @@
#pragma once
-#include "addons/binary-addons/AddonDll.h"
#include "addons/binary-addons/AddonInstanceHandler.h"
#include "addons/kodi-addon-dev-kit/include/kodi/addon-instance/VFS.h"
#include "filesystem/IDirectory.h"
@@ -55,12 +54,12 @@ namespace ADDON
int label; //!< String ID to use as label in dialog
//! \brief The constructor reads the info from an add-on info structure.
- ProtocolInfo(BinaryAddonBasePtr addonInfo);
+ ProtocolInfo(const AddonInfoPtr& addonInfo);
};
//! \brief Construct from add-on properties.
//! \param addonInfo General addon properties
- explicit CVFSEntry(BinaryAddonBasePtr addonInfo);
+ explicit CVFSEntry(const AddonInfoPtr& addonInfo);
~CVFSEntry() override;
// Things that MUST be supplied by the child classes
diff --git a/xbmc/addons/Visualization.cpp b/xbmc/addons/Visualization.cpp
index 4b76848b19..d2a251ff8d 100644
--- a/xbmc/addons/Visualization.cpp
+++ b/xbmc/addons/Visualization.cpp
@@ -15,8 +15,8 @@
namespace ADDON
{
-CVisualization::CVisualization(ADDON::BinaryAddonBasePtr addonBase, float x, float y, float w, float h)
- : IAddonInstanceHandler(ADDON_INSTANCE_VISUALIZATION, addonBase)
+CVisualization::CVisualization(const AddonInfoPtr& addonInfo, float x, float y, float w, float h)
+ : IAddonInstanceHandler(ADDON_INSTANCE_VISUALIZATION, addonInfo)
{
// Setup new Visualization instance
m_name = Name();
diff --git a/xbmc/addons/Visualization.h b/xbmc/addons/Visualization.h
index e0ded9274b..7661335df3 100644
--- a/xbmc/addons/Visualization.h
+++ b/xbmc/addons/Visualization.h
@@ -17,7 +17,7 @@ namespace ADDON
class CVisualization : public IAddonInstanceHandler
{
public:
- CVisualization(ADDON::BinaryAddonBasePtr addonBase, float x, float y, float w, float h);
+ CVisualization(const AddonInfoPtr& addonInfo, float x, float y, float w, float h);
~CVisualization() override;
bool Start(int channels, int samplesPerSec, int bitsPerSample, const std::string& songName);
diff --git a/xbmc/addons/binary-addons/AddonInstanceHandler.cpp b/xbmc/addons/binary-addons/AddonInstanceHandler.cpp
index f2ef6d15d6..7f6945b9de 100644
--- a/xbmc/addons/binary-addons/AddonInstanceHandler.cpp
+++ b/xbmc/addons/binary-addons/AddonInstanceHandler.cpp
@@ -9,6 +9,7 @@
#include "AddonInstanceHandler.h"
#include "BinaryAddonBase.h"
+#include "ServiceBroker.h"
#include "utils/StringUtils.h"
#include "utils/log.h"
@@ -17,25 +18,21 @@ namespace ADDON
CCriticalSection IAddonInstanceHandler::m_cdSec;
-IAddonInstanceHandler::IAddonInstanceHandler(ADDON_TYPE type, const BinaryAddonBasePtr& addonBase, KODI_HANDLE parentInstance/* = nullptr*/, const std::string& instanceID/* = ""*/)
- : m_type(type),
- m_parentInstance(parentInstance),
- m_addonBase(addonBase)
+IAddonInstanceHandler::IAddonInstanceHandler(ADDON_TYPE type,
+ const AddonInfoPtr& addonInfo,
+ KODI_HANDLE parentInstance /* = nullptr*/,
+ const std::string& instanceID /* = ""*/)
+ : m_type(type), m_parentInstance(parentInstance), m_addonInfo(addonInfo)
{
// if no special instance ID is given generate one from class pointer (is
// faster as unique id and also safe enough for them).
m_instanceId = !instanceID.empty() ? instanceID : StringUtils::Format("%p", static_cast<void*>(this));
-
- m_addon = m_addonBase->GetAddon(this);
- if (!m_addon)
- CLog::Log(LOGFATAL, "IAddonInstanceHandler::%s: Tried to get add-on '%s' who not available!",
- __FUNCTION__,
- m_addonBase->ID().c_str());
+ m_addonBase = CServiceBroker::GetBinaryAddonManager().GetAddonBase(addonInfo, this, m_addon);
}
IAddonInstanceHandler::~IAddonInstanceHandler()
{
- m_addonBase->ReleaseAddon(this);
+ CServiceBroker::GetBinaryAddonManager().ReleaseAddonBase(m_addonBase, this);
}
std::string IAddonInstanceHandler::ID() const
diff --git a/xbmc/addons/binary-addons/AddonInstanceHandler.h b/xbmc/addons/binary-addons/AddonInstanceHandler.h
index 561ed22a17..1cd1ec0d7f 100644
--- a/xbmc/addons/binary-addons/AddonInstanceHandler.h
+++ b/xbmc/addons/binary-addons/AddonInstanceHandler.h
@@ -20,7 +20,10 @@ namespace ADDON
class IAddonInstanceHandler
{
public:
- IAddonInstanceHandler(ADDON_TYPE type, const BinaryAddonBasePtr& addonBase, KODI_HANDLE parentInstance = nullptr, const std::string& instanceID = "");
+ IAddonInstanceHandler(ADDON_TYPE type,
+ const AddonInfoPtr& addonInfo,
+ KODI_HANDLE parentInstance = nullptr,
+ const std::string& instanceID = "");
virtual ~IAddonInstanceHandler();
ADDON_TYPE UsedType() const { return m_type; }
@@ -37,7 +40,7 @@ namespace ADDON
ADDON_STATUS CreateInstance(KODI_HANDLE instance);
void DestroyInstance();
const AddonDllPtr& Addon() const { return m_addon; }
- BinaryAddonBasePtr GetAddonBase() const { return m_addonBase; };
+ AddonInfoPtr GetAddonInfo() const { return m_addonInfo; };
virtual void OnPreInstall() {}
virtual void OnPostInstall(bool update, bool modal) {}
@@ -48,6 +51,7 @@ namespace ADDON
ADDON_TYPE m_type;
std::string m_instanceId;
KODI_HANDLE m_parentInstance;
+ AddonInfoPtr m_addonInfo;
BinaryAddonBasePtr m_addonBase;
AddonDllPtr m_addon;
static CCriticalSection m_cdSec;
diff --git a/xbmc/addons/binary-addons/BinaryAddonBase.cpp b/xbmc/addons/binary-addons/BinaryAddonBase.cpp
index b34ecac5de..e166545176 100644
--- a/xbmc/addons/binary-addons/BinaryAddonBase.cpp
+++ b/xbmc/addons/binary-addons/BinaryAddonBase.cpp
@@ -156,6 +156,12 @@ void CBinaryAddonBase::ReleaseAddon(IAddonInstanceHandler* handler)
}
}
+size_t CBinaryAddonBase::UsedInstanceCount() const
+{
+ CSingleLock lock(m_critSection);
+ return m_activeAddonHandlers.size();
+}
+
AddonDllPtr CBinaryAddonBase::GetActiveAddon()
{
CSingleLock lock(m_critSection);
diff --git a/xbmc/addons/binary-addons/BinaryAddonBase.h b/xbmc/addons/binary-addons/BinaryAddonBase.h
index e86d43c2ee..cce27c56ed 100644
--- a/xbmc/addons/binary-addons/BinaryAddonBase.h
+++ b/xbmc/addons/binary-addons/BinaryAddonBase.h
@@ -55,6 +55,7 @@ namespace ADDON
AddonDllPtr GetAddon(IAddonInstanceHandler* handler);
void ReleaseAddon(IAddonInstanceHandler* handler);
+ size_t UsedInstanceCount() const;
AddonDllPtr GetActiveAddon();
@@ -66,7 +67,7 @@ namespace ADDON
private:
AddonInfoPtr m_addonInfo;
- CCriticalSection m_critSection;
+ mutable CCriticalSection m_critSection;
AddonDllPtr m_activeAddon;
std::unordered_set<IAddonInstanceHandler*> m_activeAddonHandlers;
};
diff --git a/xbmc/addons/binary-addons/BinaryAddonManager.cpp b/xbmc/addons/binary-addons/BinaryAddonManager.cpp
index 8672c3ff6c..2c6bea4884 100644
--- a/xbmc/addons/binary-addons/BinaryAddonManager.cpp
+++ b/xbmc/addons/binary-addons/BinaryAddonManager.cpp
@@ -95,12 +95,60 @@ const BinaryAddonBasePtr CBinaryAddonManager::GetInstalledAddonInfo(const std::s
return nullptr;
}
+BinaryAddonBasePtr CBinaryAddonManager::GetAddonBase(const AddonInfoPtr& addonInfo,
+ IAddonInstanceHandler* handler,
+ AddonDllPtr& addon)
+{
+ CSingleLock lock(m_critSection);
+
+ BinaryAddonBasePtr addonBase;
+
+ const auto& addonInstances = m_runningAddons.find(addonInfo->ID());
+ if (addonInstances != m_runningAddons.end())
+ {
+ addonBase = addonInstances->second;
+ }
+ else
+ {
+ addonBase = std::make_shared<CBinaryAddonBase>(addonInfo);
+
+ m_runningAddons.emplace(addonInfo->ID(), addonBase);
+ }
+
+ if (addonBase)
+ {
+ addon = addonBase->GetAddon(handler);
+ }
+ if (!addon)
+ {
+ CLog::Log(LOGFATAL, "CBinaryAddonManager::%s: Tried to get add-on '%s' who not available!",
+ __func__, addonInfo->ID().c_str());
+ }
+
+ return addonBase;
+}
+
+void CBinaryAddonManager::ReleaseAddonBase(const BinaryAddonBasePtr& addonBase,
+ IAddonInstanceHandler* handler)
+{
+ const auto& addon = m_runningAddons.find(addonBase->ID());
+ if (addon == m_runningAddons.end())
+ return;
+
+ addonBase->ReleaseAddon(handler);
+
+ if (addonBase->UsedInstanceCount() > 0)
+ return;
+
+ m_runningAddons.erase(addon);
+}
+
AddonPtr CBinaryAddonManager::GetRunningAddon(const std::string& addonId) const
{
CSingleLock lock(m_critSection);
- auto addon = m_installedAddons.find(addonId);
- if (addon != m_installedAddons.end())
+ auto addon = m_runningAddons.find(addonId);
+ if (addon != m_runningAddons.end())
return addon->second->GetActiveAddon();
return nullptr;
diff --git a/xbmc/addons/binary-addons/BinaryAddonManager.h b/xbmc/addons/binary-addons/BinaryAddonManager.h
index 178a1d5837..b876b13d15 100644
--- a/xbmc/addons/binary-addons/BinaryAddonManager.h
+++ b/xbmc/addons/binary-addons/BinaryAddonManager.h
@@ -78,6 +78,11 @@ namespace ADDON
*/
const BinaryAddonBasePtr GetInstalledAddonInfo(const std::string& addonId, const TYPE &type = ADDON_UNKNOWN) const;
+ BinaryAddonBasePtr GetAddonBase(const AddonInfoPtr& addonInfo,
+ IAddonInstanceHandler* handler,
+ AddonDllPtr& addon);
+ void ReleaseAddonBase(const BinaryAddonBasePtr& addonBase, IAddonInstanceHandler* handler);
+
/*!
* @brief Used from other addon manager to get active addon over a from him
* created CAddonDll.
@@ -101,6 +106,7 @@ namespace ADDON
typedef std::map<std::string, BinaryAddonBasePtr> BinaryAddonMgrBaseList;
BinaryAddonMgrBaseList m_installedAddons;
BinaryAddonMgrBaseList m_enabledAddons;
+ std::map<std::string, BinaryAddonBasePtr> m_runningAddons;
};
} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/General.cpp b/xbmc/addons/interfaces/General.cpp
index 6f83093afa..b82d68e1b1 100644
--- a/xbmc/addons/interfaces/General.cpp
+++ b/xbmc/addons/interfaces/General.cpp
@@ -13,7 +13,6 @@
#include "LangInfo.h"
#include "ServiceBroker.h"
#include "addons/binary-addons/AddonDll.h"
-#include "addons/binary-addons/BinaryAddonManager.h"
#include "addons/kodi-addon-dev-kit/include/kodi/General.h"
#include "addons/settings/GUIDialogAddonSettings.h"
#include "dialogs/GUIDialogKaiToast.h"
diff --git a/xbmc/cdrip/CDDARipJob.cpp b/xbmc/cdrip/CDDARipJob.cpp
index 6c915dba4c..f221e6881d 100644
--- a/xbmc/cdrip/CDDARipJob.cpp
+++ b/xbmc/cdrip/CDDARipJob.cpp
@@ -181,7 +181,8 @@ CEncoder* CCDDARipJob::SetupEncoder(CFile& reader)
}
else
{
- const BinaryAddonBasePtr addonInfo = CServiceBroker::GetBinaryAddonManager().GetInstalledAddonInfo(audioEncoder, ADDON_AUDIOENCODER);
+ const AddonInfoPtr addonInfo =
+ CServiceBroker::GetAddonMgr().GetAddonInfo(audioEncoder, ADDON_AUDIOENCODER);
if (addonInfo)
{
std::shared_ptr<IEncoder> enc = std::make_shared<CAudioEncoder>(addonInfo);
diff --git a/xbmc/cdrip/CDDARipper.cpp b/xbmc/cdrip/CDDARipper.cpp
index 7574016266..8141a02404 100644
--- a/xbmc/cdrip/CDDARipper.cpp
+++ b/xbmc/cdrip/CDDARipper.cpp
@@ -13,7 +13,7 @@
#include "FileItem.h"
#include "ServiceBroker.h"
#include "Util.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
+#include "addons/AddonManager.h"
#include "filesystem/CDDADirectory.h"
#include "guilib/GUIWindowManager.h"
#include "guilib/LocalizeStrings.h"
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp
index 3a93ddb76c..b952d51710 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp
@@ -49,7 +49,7 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, CProces
if (hint.externalInterfaces)
{
- ADDON::BinaryAddonBasePtr addonInfo;
+ ADDON::AddonInfoPtr addonInfo;
KODI_HANDLE parentInstance;
hint.externalInterfaces->getAddonInstance(ADDON::IAddonProvider::INSTANCE_VIDEOCODEC, addonInfo, parentInstance);
if (addonInfo && parentInstance)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AddonVideoCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AddonVideoCodec.cpp
index c062daeb78..e1b0862ece 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AddonVideoCodec.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AddonVideoCodec.cpp
@@ -8,7 +8,6 @@
#include "AddonVideoCodec.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
#include "cores/VideoPlayer/Buffers/VideoBuffer.h"
#include "cores/VideoPlayer/DVDCodecs/DVDCodecs.h"
#include "cores/VideoPlayer/DVDStreamInfo.h"
@@ -19,7 +18,7 @@
using namespace kodi::addon;
CAddonVideoCodec::CAddonVideoCodec(CProcessInfo& processInfo,
- ADDON::BinaryAddonBasePtr& addonInfo,
+ ADDON::AddonInfoPtr& addonInfo,
KODI_HANDLE parentInstance)
: CDVDVideoCodec(processInfo),
IAddonInstanceHandler(ADDON_INSTANCE_VIDEOCODEC, addonInfo, parentInstance),
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AddonVideoCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AddonVideoCodec.h
index a4349855ea..77e51e20d7 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AddonVideoCodec.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AddonVideoCodec.h
@@ -21,7 +21,7 @@ class CAddonVideoCodec
{
public:
CAddonVideoCodec(CProcessInfo& processInfo,
- ADDON::BinaryAddonBasePtr& addonInfo,
+ ADDON::AddonInfoPtr& addonInfo,
KODI_HANDLE parentInstance);
~CAddonVideoCodec() override;
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
index 2c3fdb8942..c94a615051 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
@@ -24,7 +24,6 @@
#include "ServiceBroker.h"
#include "URL.h"
#include "Util.h"
-#include "addons/binary-addons/BinaryAddonManager.h"
#include "cores/VideoPlayer/Interface/Addon/InputStreamConstants.h"
#include "filesystem/CurlFile.h"
#include "filesystem/File.h"
@@ -51,8 +50,8 @@ std::shared_ptr<CDVDInputStream> CDVDFactoryInputStream::CreateInputStream(IVide
}
}
- BinaryAddonBaseList addonInfos;
- CServiceBroker::GetBinaryAddonManager().GetAddonInfos(addonInfos, true /*enabled only*/, ADDON_INPUTSTREAM);
+ std::vector<AddonInfoPtr> addonInfos;
+ CServiceBroker::GetAddonMgr().GetAddonInfos(addonInfos, true /*enabled only*/, ADDON_INPUTSTREAM);
for (auto addonInfo : addonInfos)
{
if (CInputStreamAddon::Supports(addonInfo, fileitem))
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp
index 0f3d3d267e..473ca47a8e 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp
@@ -8,8 +8,6 @@
#include "InputStreamAddon.h"
-#include "addons/binary-addons/AddonDll.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
#include "addons/kodi-addon-dev-kit/include/kodi/addon-instance/VideoCodec.h"
#include "cores/VideoPlayer/DVDDemuxers/DVDDemux.h"
#include "cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.h"
@@ -21,19 +19,19 @@
#include "utils/URIUtils.h"
#include "utils/log.h"
-CInputStreamProvider::CInputStreamProvider(ADDON::BinaryAddonBasePtr addonBase,
+CInputStreamProvider::CInputStreamProvider(const ADDON::AddonInfoPtr& addonInfo,
KODI_HANDLE parentInstance)
- : m_addonBase(addonBase), m_parentInstance(parentInstance)
+ : m_addonInfo(addonInfo), m_parentInstance(parentInstance)
{
}
void CInputStreamProvider::getAddonInstance(INSTANCE_TYPE instance_type,
- ADDON::BinaryAddonBasePtr& addonBase,
+ ADDON::AddonInfoPtr& addonInfo,
KODI_HANDLE& parentInstance)
{
if (instance_type == ADDON::IAddonProvider::INSTANCE_VIDEOCODEC)
{
- addonBase = m_addonBase;
+ addonInfo = m_addonInfo;
parentInstance = m_parentInstance;
}
}
@@ -43,16 +41,17 @@ void CInputStreamProvider::getAddonInstance(INSTANCE_TYPE instance_type,
using namespace ADDON;
using namespace kodi::addon;
-CInputStreamAddon::CInputStreamAddon(BinaryAddonBasePtr& addonBase,
+CInputStreamAddon::CInputStreamAddon(const AddonInfoPtr& addonInfo,
IVideoPlayer* player,
const CFileItem& fileitem,
const std::string& instanceId)
- : IAddonInstanceHandler(ADDON_INSTANCE_INPUTSTREAM, addonBase, nullptr, instanceId),
+ : IAddonInstanceHandler(ADDON_INSTANCE_INPUTSTREAM, addonInfo, nullptr, instanceId),
CDVDInputStream(DVDSTREAM_TYPE_ADDON, fileitem),
m_player(player)
{
- std::string listitemprops = addonBase->Type(ADDON_INPUTSTREAM)->GetValue("@listitemprops").asString();
- std::string name(addonBase->ID());
+ std::string listitemprops =
+ addonInfo->Type(ADDON_INPUTSTREAM)->GetValue("@listitemprops").asString();
+ std::string name(addonInfo->ID());
m_fileItemProps = StringUtils::Tokenize(listitemprops, "|");
for (auto &key : m_fileItemProps)
@@ -69,7 +68,7 @@ CInputStreamAddon::~CInputStreamAddon()
Close();
}
-bool CInputStreamAddon::Supports(BinaryAddonBasePtr& addonBase, const CFileItem &fileitem)
+bool CInputStreamAddon::Supports(const AddonInfoPtr& addonInfo, const CFileItem& fileitem)
{
/// @todo Error for users to show deprecation, can be removed in Kodi 20
CVariant oldAddonProp = fileitem.GetProperty("inputstreamaddon");
@@ -83,13 +82,13 @@ bool CInputStreamAddon::Supports(BinaryAddonBasePtr& addonBase, const CFileItem
// check if a specific inputstream addon is requested
CVariant addon = fileitem.GetProperty(STREAM_PROPERTY_INPUTSTREAM);
if (!addon.isNull())
- return (addon.asString() == addonBase->ID());
+ return (addon.asString() == addonInfo->ID());
// check protocols
std::string protocol = CURL(fileitem.GetDynPath()).GetProtocol();
if (!protocol.empty())
{
- std::string protocols = addonBase->Type(ADDON_INPUTSTREAM)->GetValue("@protocols").asString();
+ std::string protocols = addonInfo->Type(ADDON_INPUTSTREAM)->GetValue("@protocols").asString();
if (!protocols.empty())
{
std::vector<std::string> protocolsList = StringUtils::Tokenize(protocols, "|");
@@ -105,7 +104,7 @@ bool CInputStreamAddon::Supports(BinaryAddonBasePtr& addonBase, const CFileItem
std::string filetype = fileitem.GetURL().GetFileType();
if (!filetype.empty())
{
- std::string extensions = addonBase->Type(ADDON_INPUTSTREAM)->GetValue("@extension").asString();
+ std::string extensions = addonInfo->Type(ADDON_INPUTSTREAM)->GetValue("@extension").asString();
if (!extensions.empty())
{
std::vector<std::string> extensionsList = StringUtils::Tokenize(extensions, "|");
@@ -178,7 +177,8 @@ bool CInputStreamAddon::Open()
m_caps = { 0 };
m_struct.toAddon.get_capabilities(&m_struct, &m_caps);
- m_subAddonProvider = std::shared_ptr<CInputStreamProvider>(new CInputStreamProvider(GetAddonBase(), m_struct.toAddon.addonInstance));
+ m_subAddonProvider = std::shared_ptr<CInputStreamProvider>(
+ new CInputStreamProvider(GetAddonInfo(), m_struct.toAddon.addonInstance));
}
return ret;
}
@@ -453,7 +453,8 @@ CDemuxStream* CInputStreamAddon::GetStream(int streamId) const
demuxStream->flags = static_cast<StreamFlags>(stream.m_flags);
demuxStream->language = stream.m_language;
- if (GetAddonBase()->DependencyVersion(ADDON_INSTANCE_VERSION_INPUTSTREAM_XML_ID) >= AddonVersion("2.0.8"))
+ if (GetAddonInfo()->DependencyVersion(ADDON_INSTANCE_VERSION_INPUTSTREAM_XML_ID) >=
+ AddonVersion("2.0.8"))
{
demuxStream->codec_fourcc = stream.m_codecFourCC;
}
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.h b/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.h
index 4bf9d53fd5..b7aca348ed 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.h
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.h
@@ -21,14 +21,14 @@ class CInputStreamProvider
: public ADDON::IAddonProvider
{
public:
- CInputStreamProvider(ADDON::BinaryAddonBasePtr addonBase, KODI_HANDLE parentInstance);
+ CInputStreamProvider(const ADDON::AddonInfoPtr& addonInfo, KODI_HANDLE parentInstance);
void getAddonInstance(INSTANCE_TYPE instance_type,
- ADDON::BinaryAddonBasePtr& addonBase,
+ ADDON::AddonInfoPtr& addonInfo,
KODI_HANDLE& parentInstance) override;
private:
- ADDON::BinaryAddonBasePtr m_addonBase;
+ ADDON::AddonInfoPtr m_addonInfo;
KODI_HANDLE m_parentInstance;
};
@@ -43,13 +43,13 @@ class CInputStreamAddon
, public CDVDInputStream::IChapter
{
public:
- CInputStreamAddon(ADDON::BinaryAddonBasePtr& addonBase,
+ CInputStreamAddon(const ADDON::AddonInfoPtr& addonInfo,
IVideoPlayer* player,
const CFileItem& fileitem,
const std::string& instanceId);
~CInputStreamAddon() override;
- static bool Supports(ADDON::BinaryAddonBasePtr& addonBase, const CFileItem& fileitem);
+ static bool Supports(const ADDON::AddonInfoPtr& addonInfo, const CFileItem& fileitem);
// CDVDInputStream
bool Open() override;
diff --git a/xbmc/cores/paplayer/CodecFactory.cpp b/xbmc/cores/paplayer/CodecFactory.cpp
index 15a1b20a9e..5f4f3d5eed 100644
--- a/xbmc/cores/paplayer/CodecFactory.cpp
+++ b/xbmc/cores/paplayer/CodecFactory.cpp
@@ -12,7 +12,6 @@
#include "URL.h"
#include "VideoPlayerCodec.h"
#include "addons/AudioDecoder.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
#include "utils/StringUtils.h"
using namespace ADDON;
@@ -22,8 +21,8 @@ ICodec* CodecFactory::CreateCodec(const std::string &strFileType)
std::string fileType = strFileType;
StringUtils::ToLower(fileType);
- BinaryAddonBaseList addonInfos;
- CServiceBroker::GetBinaryAddonManager().GetAddonInfos(addonInfos, true, ADDON_AUDIODECODER);
+ std::vector<AddonInfoPtr> addonInfos;
+ CServiceBroker::GetAddonMgr().GetAddonInfos(addonInfos, true, ADDON_AUDIODECODER);
for (const auto& addonInfo : addonInfos)
{
auto exts = StringUtils::Split(CAudioDecoder::GetExtensions(addonInfo), "|");
@@ -50,8 +49,8 @@ ICodec* CodecFactory::CreateCodecDemux(const CFileItem& file, unsigned int filec
StringUtils::ToLower(content);
if (!content.empty())
{
- BinaryAddonBaseList addonInfos;
- CServiceBroker::GetBinaryAddonManager().GetAddonInfos(addonInfos, true, ADDON_AUDIODECODER);
+ std::vector<AddonInfoPtr> addonInfos;
+ CServiceBroker::GetAddonMgr().GetAddonInfos(addonInfos, true, ADDON_AUDIODECODER);
for (const auto& addonInfo : addonInfos)
{
auto types = StringUtils::Split(CAudioDecoder::GetMimetypes(addonInfo), "|");
diff --git a/xbmc/filesystem/FileDirectoryFactory.cpp b/xbmc/filesystem/FileDirectoryFactory.cpp
index 4a6e17ad9c..7c7996fa2b 100644
--- a/xbmc/filesystem/FileDirectoryFactory.cpp
+++ b/xbmc/filesystem/FileDirectoryFactory.cpp
@@ -33,7 +33,6 @@
#include "ServiceBroker.h"
#include "addons/AudioDecoder.h"
#include "addons/VFSEntry.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
#include "AudioBookFileDirectory.h"
using namespace ADDON;
@@ -54,8 +53,8 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem,
StringUtils::ToLower(strExtension);
if (!strExtension.empty() && CServiceBroker::IsBinaryAddonCacheUp())
{
- BinaryAddonBaseList addonInfos;
- CServiceBroker::GetBinaryAddonManager().GetAddonInfos(addonInfos, true, ADDON_AUDIODECODER);
+ std::vector<AddonInfoPtr> addonInfos;
+ CServiceBroker::GetAddonMgr().GetAddonInfos(addonInfos, true, ADDON_AUDIODECODER);
for (const auto& addonInfo : addonInfos)
{
if (CAudioDecoder::HasTracks(addonInfo))
diff --git a/xbmc/guilib/GUIVisualisationControl.cpp b/xbmc/guilib/GUIVisualisationControl.cpp
index 3a4bddf946..6c58ac8371 100644
--- a/xbmc/guilib/GUIVisualisationControl.cpp
+++ b/xbmc/guilib/GUIVisualisationControl.cpp
@@ -363,7 +363,10 @@ bool CGUIVisualisationControl::GetPresetList(std::vector<std::string> &vecpreset
bool CGUIVisualisationControl::InitVisualization()
{
- const ADDON::BinaryAddonBasePtr addonBase = CServiceBroker::GetBinaryAddonManager().GetInstalledAddonInfo(CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_MUSICPLAYER_VISUALISATION), ADDON::ADDON_VIZ);
+ const std::string addon = CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(
+ CSettings::SETTING_MUSICPLAYER_VISUALISATION);
+ const ADDON::AddonInfoPtr addonBase =
+ CServiceBroker::GetAddonMgr().GetAddonInfo(addon, ADDON::ADDON_VIZ);
if (!addonBase)
return false;
diff --git a/xbmc/guilib/imagefactory.cpp b/xbmc/guilib/imagefactory.cpp
index b17af7d97c..1234369b3c 100644
--- a/xbmc/guilib/imagefactory.cpp
+++ b/xbmc/guilib/imagefactory.cpp
@@ -10,7 +10,6 @@
#include "ServiceBroker.h"
#include "addons/ImageDecoder.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
#include "guilib/FFmpegImage.h"
#include "utils/Mime.h"
#include "utils/StringUtils.h"
@@ -37,9 +36,8 @@ IImage* ImageFactory::CreateLoader(const CURL& url)
IImage* ImageFactory::CreateLoaderFromMimeType(const std::string& strMimeType)
{
- BinaryAddonBaseList addonInfos;
-
- CServiceBroker::GetBinaryAddonManager().GetAddonInfos(addonInfos, true, ADDON_IMAGEDECODER);
+ std::vector<AddonInfoPtr> addonInfos;
+ CServiceBroker::GetAddonMgr().GetAddonInfos(addonInfos, true, ADDON_IMAGEDECODER);
for (auto addonInfo : addonInfos)
{
std::vector<std::string> mime = StringUtils::Split(addonInfo->Type(ADDON_IMAGEDECODER)->GetValue("@mimetype").asString(), "|");
diff --git a/xbmc/music/tags/MusicInfoTagLoaderFactory.cpp b/xbmc/music/tags/MusicInfoTagLoaderFactory.cpp
index e117ce8ce8..b5d8a0ce5f 100644
--- a/xbmc/music/tags/MusicInfoTagLoaderFactory.cpp
+++ b/xbmc/music/tags/MusicInfoTagLoaderFactory.cpp
@@ -16,7 +16,6 @@
#include "ServiceBroker.h"
#include "TagLoaderTagLib.h"
#include "addons/AudioDecoder.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
@@ -44,8 +43,8 @@ IMusicInfoTagLoader* CMusicInfoTagLoaderFactory::CreateLoader(const CFileItem& i
if (strExtension.empty())
return NULL;
- BinaryAddonBaseList addonInfos;
- CServiceBroker::GetBinaryAddonManager().GetAddonInfos(addonInfos, true, ADDON_AUDIODECODER);
+ std::vector<AddonInfoPtr> addonInfos;
+ CServiceBroker::GetAddonMgr().GetAddonInfos(addonInfos, true, ADDON_AUDIODECODER);
for (const auto& addonInfo : addonInfos)
{
if (CAudioDecoder::HasTags(addonInfo))
diff --git a/xbmc/network/GUIDialogNetworkSetup.cpp b/xbmc/network/GUIDialogNetworkSetup.cpp
index febed6fa34..768caf7de9 100644
--- a/xbmc/network/GUIDialogNetworkSetup.cpp
+++ b/xbmc/network/GUIDialogNetworkSetup.cpp
@@ -12,7 +12,6 @@
#include "URL.h"
#include "addons/AddonManager.h"
#include "addons/VFSEntry.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
#include "dialogs/GUIDialogFileBrowser.h"
#include "guilib/GUIComponent.h"
#include "guilib/GUIEditControl.h"
diff --git a/xbmc/peripherals/addons/PeripheralAddon.cpp b/xbmc/peripherals/addons/PeripheralAddon.cpp
index 3e43b17433..9a4a33aca3 100644
--- a/xbmc/peripherals/addons/PeripheralAddon.cpp
+++ b/xbmc/peripherals/addons/PeripheralAddon.cpp
@@ -47,8 +47,7 @@ using namespace XFILE;
} while (0)
#endif
-CPeripheralAddon::CPeripheralAddon(const ADDON::BinaryAddonBasePtr& addonInfo,
- CPeripherals& manager)
+CPeripheralAddon::CPeripheralAddon(const ADDON::AddonInfoPtr& addonInfo, CPeripherals& manager)
: IAddonInstanceHandler(ADDON_INSTANCE_PERIPHERAL, addonInfo),
m_manager(manager),
m_bSupportsJoystickRumble(false),
diff --git a/xbmc/peripherals/addons/PeripheralAddon.h b/xbmc/peripherals/addons/PeripheralAddon.h
index 4eaafcfb9b..5468bac330 100644
--- a/xbmc/peripherals/addons/PeripheralAddon.h
+++ b/xbmc/peripherals/addons/PeripheralAddon.h
@@ -9,7 +9,6 @@
#pragma once
#include "addons/binary-addons/AddonInstanceHandler.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
#include "addons/kodi-addon-dev-kit/include/kodi/addon-instance/Peripheral.h"
#include "addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h"
#include "input/joysticks/JoystickTypes.h"
@@ -42,7 +41,7 @@ typedef std::map<KODI::JOYSTICK::FeatureName, kodi::addon::JoystickFeature> Feat
class CPeripheralAddon : public ADDON::IAddonInstanceHandler
{
public:
- explicit CPeripheralAddon(const ADDON::BinaryAddonBasePtr& addonInfo, CPeripherals& manager);
+ explicit CPeripheralAddon(const ADDON::AddonInfoPtr& addonInfo, CPeripherals& manager);
~CPeripheralAddon(void) override;
/*!
@@ -97,12 +96,12 @@ public:
void RegisterButtonMap(CPeripheral* device, KODI::JOYSTICK::IButtonMap* buttonMap);
void UnregisterButtonMap(KODI::JOYSTICK::IButtonMap* buttonMap);
- static inline bool ProvidesJoysticks(const ADDON::BinaryAddonBasePtr& addonInfo)
+ static inline bool ProvidesJoysticks(const ADDON::AddonInfoPtr& addonInfo)
{
return addonInfo->Type(ADDON::ADDON_PERIPHERALDLL)->GetValue("@provides_joysticks").asBoolean();
}
- static inline bool ProvidesButtonMaps(const ADDON::BinaryAddonBasePtr& addonInfo)
+ static inline bool ProvidesButtonMaps(const ADDON::AddonInfoPtr& addonInfo)
{
return addonInfo->Type(ADDON::ADDON_PERIPHERALDLL)
->GetValue("@provides_buttonmaps")
diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusAddon.cpp b/xbmc/peripherals/bus/virtual/PeripheralBusAddon.cpp
index 1353602324..77c526f840 100644
--- a/xbmc/peripherals/bus/virtual/PeripheralBusAddon.cpp
+++ b/xbmc/peripherals/bus/virtual/PeripheralBusAddon.cpp
@@ -10,7 +10,6 @@
#include "ServiceBroker.h"
#include "addons/AddonManager.h"
-#include "addons/binary-addons/BinaryAddonManager.h"
#include "messaging/helpers/DialogHelper.h"
#include "peripherals/Peripherals.h"
#include "peripherals/addons/PeripheralAddon.h"
@@ -178,9 +177,8 @@ void CPeripheralBusAddon::EnableButtonMapping()
if (!GetAddonWithButtonMap(dummy))
{
- BinaryAddonBaseList disabledAddons;
- CServiceBroker::GetBinaryAddonManager().GetDisabledAddonInfos(disabledAddons,
- ADDON_PERIPHERALDLL);
+ std::vector<AddonInfoPtr> disabledAddons;
+ CServiceBroker::GetAddonMgr().GetDisabledAddonInfos(disabledAddons, ADDON_PERIPHERALDLL);
if (!disabledAddons.empty())
PromptEnableAddons(disabledAddons);
}
@@ -377,7 +375,7 @@ void CPeripheralBusAddon::UpdateAddons(void)
using namespace ADDON;
auto GetPeripheralAddonID = [](const PeripheralAddonPtr& addon) { return addon->ID(); };
- auto GetAddonID = [](const BinaryAddonBasePtr& addon) { return addon->ID(); };
+ auto GetAddonID = [](const AddonInfoPtr& addon) { return addon->ID(); };
std::set<std::string> currentIds;
std::set<std::string> newIds;
@@ -386,8 +384,8 @@ void CPeripheralBusAddon::UpdateAddons(void)
std::set<std::string> removed;
// Get new add-ons
- BinaryAddonBaseList newAddons;
- CServiceBroker::GetBinaryAddonManager().GetAddonInfos(newAddons, true, ADDON_PERIPHERALDLL);
+ std::vector<AddonInfoPtr> newAddons;
+ CServiceBroker::GetAddonMgr().GetAddonInfos(newAddons, true, ADDON_PERIPHERALDLL);
std::transform(newAddons.begin(), newAddons.end(), std::inserter(newIds, newIds.end()),
GetAddonID);
@@ -410,9 +408,9 @@ void CPeripheralBusAddon::UpdateAddons(void)
{
CLog::Log(LOGDEBUG, "Add-on bus: Registering add-on %s", addonId.c_str());
- auto GetAddon = [&addonId](const BinaryAddonBasePtr& addon) { return addon->ID() == addonId; };
+ auto GetAddon = [&addonId](const AddonInfoPtr& addon) { return addon->ID() == addonId; };
- BinaryAddonBaseList::iterator it = std::find_if(newAddons.begin(), newAddons.end(), GetAddon);
+ auto it = std::find_if(newAddons.begin(), newAddons.end(), GetAddon);
if (it != newAddons.end())
{
PeripheralAddonPtr newAddon = std::make_shared<CPeripheralAddon>(*it, m_manager);
@@ -467,7 +465,7 @@ void CPeripheralBusAddon::UnRegisterAddon(const std::string& addonId)
}
}
-void CPeripheralBusAddon::PromptEnableAddons(const ADDON::BinaryAddonBaseList& disabledAddons)
+void CPeripheralBusAddon::PromptEnableAddons(const std::vector<ADDON::AddonInfoPtr>& disabledAddons)
{
using namespace ADDON;
using namespace MESSAGING::HELPERS;
@@ -475,10 +473,10 @@ void CPeripheralBusAddon::PromptEnableAddons(const ADDON::BinaryAddonBaseList& d
// True if the user confirms enabling the disabled peripheral add-on
bool bAccepted = false;
- auto itAddon = std::find_if(disabledAddons.begin(), disabledAddons.end(),
- [](const BinaryAddonBasePtr& addonInfo) {
- return CPeripheralAddon::ProvidesJoysticks(addonInfo);
- });
+ auto itAddon =
+ std::find_if(disabledAddons.begin(), disabledAddons.end(), [](const AddonInfoPtr& addonInfo) {
+ return CPeripheralAddon::ProvidesJoysticks(addonInfo);
+ });
if (itAddon != disabledAddons.end())
{
diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusAddon.h b/xbmc/peripherals/bus/virtual/PeripheralBusAddon.h
index a01b4c9ae3..0d5d1ee53a 100644
--- a/xbmc/peripherals/bus/virtual/PeripheralBusAddon.h
+++ b/xbmc/peripherals/bus/virtual/PeripheralBusAddon.h
@@ -9,7 +9,6 @@
#pragma once
#include "addons/AddonManager.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
#include "peripherals/PeripheralTypes.h"
#include "peripherals/bus/PeripheralBus.h"
@@ -81,7 +80,7 @@ private:
void OnEvent(const ADDON::AddonEvent& event);
void UnRegisterAddon(const std::string& addonId);
- void PromptEnableAddons(const ADDON::BinaryAddonBaseList& disabledAddons);
+ void PromptEnableAddons(const std::vector<ADDON::AddonInfoPtr>& disabledAddons);
PeripheralAddonVector m_addons;
PeripheralAddonVector m_failedAddons;
diff --git a/xbmc/pvr/addons/PVRClient.cpp b/xbmc/pvr/addons/PVRClient.cpp
index 16ee83d287..af149a5b1f 100644
--- a/xbmc/pvr/addons/PVRClient.cpp
+++ b/xbmc/pvr/addons/PVRClient.cpp
@@ -57,8 +57,8 @@ namespace PVR
#define DEFAULT_INFO_STRING_VALUE "unknown"
-CPVRClient::CPVRClient(ADDON::BinaryAddonBasePtr addonBase)
- : IAddonInstanceHandler(ADDON_INSTANCE_PVR, addonBase)
+CPVRClient::CPVRClient(const ADDON::AddonInfoPtr& addonInfo)
+ : IAddonInstanceHandler(ADDON_INSTANCE_PVR, addonInfo)
{
// Create all interface parts independent to make API changes easier if
// something is added
diff --git a/xbmc/pvr/addons/PVRClient.h b/xbmc/pvr/addons/PVRClient.h
index a7f844b478..733c9f014a 100644
--- a/xbmc/pvr/addons/PVRClient.h
+++ b/xbmc/pvr/addons/PVRClient.h
@@ -281,7 +281,7 @@ private:
class CPVRClient : public ADDON::IAddonInstanceHandler
{
public:
- explicit CPVRClient(ADDON::BinaryAddonBasePtr addonBase);
+ explicit CPVRClient(const ADDON::AddonInfoPtr& addonInfo);
~CPVRClient() override;
void OnPreInstall() override;
diff --git a/xbmc/pvr/addons/PVRClients.cpp b/xbmc/pvr/addons/PVRClients.cpp
index 9f2f3faa81..ceebbf8ec9 100644
--- a/xbmc/pvr/addons/PVRClients.cpp
+++ b/xbmc/pvr/addons/PVRClients.cpp
@@ -9,8 +9,6 @@
#include "PVRClients.h"
#include "ServiceBroker.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
-#include "addons/binary-addons/BinaryAddonManager.h"
#include "guilib/LocalizeStrings.h"
#include "messaging/ApplicationMessenger.h"
#include "pvr/PVREventLogJob.h"
@@ -86,14 +84,14 @@ void CPVRClients::Continue()
void CPVRClients::UpdateAddons(const std::string& changedAddonId /*= ""*/)
{
- BinaryAddonBaseList addons;
- CServiceBroker::GetBinaryAddonManager().GetAddonInfos(addons, false, ADDON_PVRDLL);
+ std::vector<AddonInfoPtr> addons;
+ CServiceBroker::GetAddonMgr().GetAddonInfos(addons, false, ADDON_PVRDLL);
if (addons.empty())
return;
bool bFoundChangedAddon = changedAddonId.empty();
- std::vector<std::pair<BinaryAddonBasePtr, bool>> addonsWithStatus;
+ std::vector<std::pair<AddonInfoPtr, bool>> addonsWithStatus;
for (const auto& addon : addons)
{
bool bEnabled = !CServiceBroker::GetAddonMgr().IsAddonDisabled(addon->ID());
@@ -109,14 +107,14 @@ void CPVRClients::UpdateAddons(const std::string& changedAddonId /*= ""*/)
addons.clear();
std::vector<std::pair<std::shared_ptr<CPVRClient>, int>> addonsToCreate;
- std::vector<BinaryAddonBasePtr> addonsToReCreate;
- std::vector<BinaryAddonBasePtr> addonsToDestroy;
+ std::vector<AddonInfoPtr> addonsToReCreate;
+ std::vector<AddonInfoPtr> addonsToDestroy;
{
CSingleLock lock(m_critSection);
for (const auto& addonWithStatus : addonsWithStatus)
{
- BinaryAddonBasePtr addon = addonWithStatus.first;
+ AddonInfoPtr addon = addonWithStatus.first;
bool bEnabled = addonWithStatus.second;
if (bEnabled && (!IsKnownClient(addon->ID()) || !IsCreatedClient(addon->ID())))
diff --git a/xbmc/settings/SettingConditions.cpp b/xbmc/settings/SettingConditions.cpp
index 73817ec9d3..ebf3318107 100644
--- a/xbmc/settings/SettingConditions.cpp
+++ b/xbmc/settings/SettingConditions.cpp
@@ -11,7 +11,6 @@
#include "LockType.h"
#include "Util.h"
#include "addons/AddonManager.h"
-#include "addons/binary-addons/BinaryAddonManager.h"
#include "addons/Skin.h"
#if defined(TARGET_ANDROID)
#include "platform/android/activity/AndroidFeatures.h"
diff --git a/xbmc/windows/GUIWindowScreensaver.cpp b/xbmc/windows/GUIWindowScreensaver.cpp
index 2cacf1d8c9..ed383e03f2 100644
--- a/xbmc/windows/GUIWindowScreensaver.cpp
+++ b/xbmc/windows/GUIWindowScreensaver.cpp
@@ -73,7 +73,10 @@ bool CGUIWindowScreensaver::OnMessage(CGUIMessage& message)
CServiceBroker::GetWinSystem()->GetGfxContext().CaptureStateBlock();
- const ADDON::BinaryAddonBasePtr addonBase = CServiceBroker::GetBinaryAddonManager().GetInstalledAddonInfo(CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_SCREENSAVER_MODE), ADDON::ADDON_SCREENSAVER);
+ const std::string addon = CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(
+ CSettings::SETTING_SCREENSAVER_MODE);
+ const ADDON::AddonInfoPtr addonBase =
+ CServiceBroker::GetAddonMgr().GetAddonInfo(addon, ADDON::ADDON_SCREENSAVER);
if (!addonBase)
return false;
m_addon = new ADDON::CScreenSaver(addonBase);
diff --git a/xbmc/windows/GUIWindowScreensaverDim.cpp b/xbmc/windows/GUIWindowScreensaverDim.cpp
index dad22d8aad..fb357a24e4 100644
--- a/xbmc/windows/GUIWindowScreensaverDim.cpp
+++ b/xbmc/windows/GUIWindowScreensaverDim.cpp
@@ -10,7 +10,7 @@
#include "Application.h"
#include "ServiceBroker.h"
-#include "addons/binary-addons/AddonDll.h"
+#include "addons/AddonManager.h"
#include "guilib/GUITexture.h"
#include "utils/Color.h"
#include "windowing/GraphicContext.h"