aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/modules/FindCpluff.cmake12
-rw-r--r--lib/cpluff/libcpluff/Makefile.am2
-rw-r--r--xbmc/DllPaths_generated.h.in2
-rw-r--r--xbmc/DllPaths_generated_android.h.in2
-rw-r--r--xbmc/DllPaths_win32.h1
-rw-r--r--xbmc/addons/AddonDatabase.cpp19
-rw-r--r--xbmc/addons/AddonManager.cpp88
-rw-r--r--xbmc/addons/AddonManager.h2
-rw-r--r--xbmc/addons/CMakeLists.txt1
-rw-r--r--xbmc/addons/DllLibCPluff.h129
10 files changed, 53 insertions, 205 deletions
diff --git a/cmake/modules/FindCpluff.cmake b/cmake/modules/FindCpluff.cmake
index 913d7aef3b..3011960f6b 100644
--- a/cmake/modules/FindCpluff.cmake
+++ b/cmake/modules/FindCpluff.cmake
@@ -39,23 +39,23 @@ if(NOT WIN32)
COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif
WORKING_DIRECTORY <SOURCE_DIR>)
- set(ldflags "${ldflags};-lexpat")
- core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/lib/libcpluff.a
- system/libcpluff libcpluff extras "${ldflags}")
+ set(CPLUFF_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/lib/libcpluff.a ${EXPAT_LIBRARIES})
set(CPLUFF_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/include)
set(CPLUFF_FOUND 1)
- mark_as_advanced(CPLUFF_INCLUDE_DIRS CPLUFF_FOUND)
+ mark_as_advanced(CPLUFF_INCLUDE_DIRS CPLUFF_LIBRARIES)
else()
find_path(CPLUFF_INCLUDE_DIR cpluff.h)
+ find_library(CPLUFF_LIBRARY NAMES cpluff)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Cpluff
- REQUIRED_VARS CPLUFF_INCLUDE_DIR)
+ REQUIRED_VARS CPLUFF_INCLUDE_DIR CPLUFF_LIBRARY)
if(CPLUFF_FOUND)
+ set(CPLUFF_LIBRARIES ${CPLUFF_LIBRARY})
set(CPLUFF_INCLUDE_DIRS ${CPLUFF_INCLUDE_DIR})
endif()
- mark_as_advanced(CPLUFF_INCLUDE_DIRS CPLUFF_FOUND)
+ mark_as_advanced(CPLUFF_INCLUDE_DIRS CPLUFF_LIBRARY)
add_custom_target(libcpluff)
endif()
diff --git a/lib/cpluff/libcpluff/Makefile.am b/lib/cpluff/libcpluff/Makefile.am
index a483bfae07..0f121e012a 100644
--- a/lib/cpluff/libcpluff/Makefile.am
+++ b/lib/cpluff/libcpluff/Makefile.am
@@ -10,6 +10,8 @@ LIBS = @LIBS_LIBCPLUFF@ @LTLIBINTL@ @LIBS@
CPPFLAGS = @CPPFLAGS@
CPPFLAGS += -I. -DCP_C_API=CP_EXPORT -DCP_HOST="\"$(host)\"" -DCP_DATADIR="\"$(datadir)\""
+# the following symbols are clashing with mariadb symbols
+CPPFLAGS += -Dhash_delete=kazlib_hash_delete -Dhash_free=kazlib_hash_free -Dhash_insert=kazlib_hash_insert -Dlist_delete=kazlib_list_delete
DOXYGEN = doxygen
DOXYGEN_SOURCE = cpluffdef.h $(srcdir)/cpluff.h $(srcdir)/docsrc/*.dox
diff --git a/xbmc/DllPaths_generated.h.in b/xbmc/DllPaths_generated.h.in
index 758b182026..e2c93589e6 100644
--- a/xbmc/DllPaths_generated.h.in
+++ b/xbmc/DllPaths_generated.h.in
@@ -25,8 +25,6 @@
#define PREFIX_USR_PATH "@prefix@"
/* libraries */
-#define DLL_PATH_CPLUFF "special://xbmcbin/system/libcpluff-@ARCH@.so"
-
#define DLL_PATH_LIBNFS "@NFS_SONAME@"
#define DLL_PATH_LIBPLIST "@PLIST_SONAME@"
diff --git a/xbmc/DllPaths_generated_android.h.in b/xbmc/DllPaths_generated_android.h.in
index 04a2918d6d..90c9e707cb 100644
--- a/xbmc/DllPaths_generated_android.h.in
+++ b/xbmc/DllPaths_generated_android.h.in
@@ -27,8 +27,6 @@
// We only keep @ARCH@ here to retain the same structure as *nix.
// * foo.so will be renamed libfoo.so in the packaging stage
-#define DLL_PATH_CPLUFF "libcpluff-@ARCH@.so"
-
#define DLL_PATH_LIBNFS "@NFS_SONAME@"
#define DLL_PATH_LIBPLIST "@PLIST_SONAME@"
#define DLL_PATH_LIBSHAIRPLAY "@SHAIRPLAY_SONAME@"
diff --git a/xbmc/DllPaths_win32.h b/xbmc/DllPaths_win32.h
index 3eead88d12..3e6cc3f90b 100644
--- a/xbmc/DllPaths_win32.h
+++ b/xbmc/DllPaths_win32.h
@@ -22,7 +22,6 @@
*/
/* libraries */
-#define DLL_PATH_CPLUFF "special://xbmcbin/cpluff.dll"
#define DLL_PATH_LIBCURL "special://xbmcbin/libcurl.dll"
#define DLL_PATH_LIBNFS "special://xbmcbin/libnfs.dll"
#define DLL_PATH_LIBPLIST "special://xbmcbin/libplist.dll"
diff --git a/xbmc/addons/AddonDatabase.cpp b/xbmc/addons/AddonDatabase.cpp
index fd809a3e05..4c48cdeba6 100644
--- a/xbmc/addons/AddonDatabase.cpp
+++ b/xbmc/addons/AddonDatabase.cpp
@@ -33,7 +33,6 @@
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "utils/Variant.h"
-#include "DllLibCPluff.h"
#include "XBDateTime.h"
using namespace ADDON;
@@ -226,46 +225,44 @@ void CAddonDatabase::UpdateTables(int version)
//Ugly hack incoming! As the addon manager isnt created yet, we need to start up our own copy
//cpluff to find the currently enabled addons.
- auto cpluff = std::unique_ptr<DllLibCPluff>(new DllLibCPluff());
- cpluff->Load();
cp_status_t status;
- status = cpluff->init();
+ status = cp_init();
if (status != CP_OK)
{
CLog::Log(LOGERROR, "AddonDatabase: Upgrade failed. cp_init() returned status: %i", status);
return;
}
- cp_context_t* cp_context = cpluff->create_context(&status);
+ cp_context_t* cp_context = cp_create_context(&status);
- status = cpluff->register_pcollection(cp_context, CSpecialProtocol::TranslatePath("special://home/addons").c_str());
+ status = cp_register_pcollection(cp_context, CSpecialProtocol::TranslatePath("special://home/addons").c_str());
if (status != CP_OK)
{
CLog::Log(LOGERROR, "AddonDatabase: Upgrade failed. cp_register_pcollection() returned status: %i", status);
return;
}
- status = cpluff->register_pcollection(cp_context, CSpecialProtocol::TranslatePath("special://xbmc/addons").c_str());
+ status = cp_register_pcollection(cp_context, CSpecialProtocol::TranslatePath("special://xbmc/addons").c_str());
if (status != CP_OK)
{
CLog::Log(LOGERROR, "AddonDatabase: Upgrade failed. cp_register_pcollection() returned status: %i", status);
return;
}
- status = cpluff->register_pcollection(cp_context, CSpecialProtocol::TranslatePath("special://xbmcbin/addons").c_str());
+ status = cp_register_pcollection(cp_context, CSpecialProtocol::TranslatePath("special://xbmcbin/addons").c_str());
if (status != CP_OK)
{
CLog::Log(LOGERROR, "AddonDatabase: Upgrade failed. cp_register_pcollection() returned status: %i", status);
return;
}
- cpluff->scan_plugins(cp_context, CP_SP_UPGRADE);
+ cp_scan_plugins(cp_context, CP_SP_UPGRADE);
std::string systemPath = CSpecialProtocol::TranslatePath("special://xbmc/addons");
std::string now = CDateTime::GetCurrentDateTime().GetAsDBDateTime();
BeginTransaction();
int n;
- cp_plugin_info_t** cp_addons = cpluff->get_plugins_info(cp_context, &status, &n);
+ cp_plugin_info_t** cp_addons = cp_get_plugins_info(cp_context, &status, &n);
for (int i = 0; i < n; ++i)
{
const char* id = cp_addons[i]->identifier;
@@ -276,7 +273,7 @@ void CAddonDatabase::UpdateTables(int version)
"('%s', NOT %d AND NOT EXISTS (SELECT * FROM disabled WHERE addonID='%s'), '%s')",
id, inSystem, id, now.c_str()));
}
- cpluff->release_info(cp_context, cp_addons);
+ cp_release_info(cp_context, cp_addons);
CommitTransaction();
m_pDS->exec("DROP TABLE disabled");
diff --git a/xbmc/addons/AddonManager.cpp b/xbmc/addons/AddonManager.cpp
index e0c7e0280f..796a9239df 100644
--- a/xbmc/addons/AddonManager.cpp
+++ b/xbmc/addons/AddonManager.cpp
@@ -21,7 +21,6 @@
#include "AddonManager.h"
#include "ServiceBroker.h"
-#include "addons/DllLibCPluff.h"
#include "events/AddonManagementEvent.h"
#include "events/EventLog.h"
#include "events/NotificationEvent.h"
@@ -245,8 +244,7 @@ static bool LoadManifest(std::set<std::string>& system, std::set<std::string>& o
}
CAddonMgr::CAddonMgr()
- : m_cp_context(nullptr),
- m_cpluff(nullptr)
+ : m_cp_context(nullptr)
{ }
CAddonMgr::~CAddonMgr()
@@ -281,19 +279,11 @@ void CAddonMgr::UnregisterAddonMgrCallback(TYPE type)
bool CAddonMgr::Init()
{
CSingleLock lock(m_critSection);
- m_cpluff = std::unique_ptr<DllLibCPluff>(new DllLibCPluff);
- m_cpluff->Load();
- if (!m_cpluff->IsLoaded())
- {
- CLog::Log(LOGERROR, "ADDONS: Fatal Error, could not load libcpluff");
- return false;
- }
-
- m_cpluff->set_fatal_error_handler(cp_fatalErrorHandler);
+ cp_set_fatal_error_handler(cp_fatalErrorHandler);
cp_status_t status;
- status = m_cpluff->init();
+ status = cp_init();
if (status != CP_OK)
{
CLog::Log(LOGERROR, "ADDONS: Fatal Error, cp_init() returned status: %i", status);
@@ -301,30 +291,30 @@ bool CAddonMgr::Init()
}
//! @todo could separate addons into different contexts would allow partial unloading of addon framework
- m_cp_context = m_cpluff->create_context(&status);
+ m_cp_context = cp_create_context(&status);
assert(m_cp_context);
- status = m_cpluff->register_pcollection(m_cp_context, CSpecialProtocol::TranslatePath("special://home/addons").c_str());
+ status = cp_register_pcollection(m_cp_context, CSpecialProtocol::TranslatePath("special://home/addons").c_str());
if (status != CP_OK)
{
CLog::Log(LOGERROR, "ADDONS: Fatal Error, cp_register_pcollection() returned status: %i", status);
return false;
}
- status = m_cpluff->register_pcollection(m_cp_context, CSpecialProtocol::TranslatePath("special://xbmc/addons").c_str());
+ status = cp_register_pcollection(m_cp_context, CSpecialProtocol::TranslatePath("special://xbmc/addons").c_str());
if (status != CP_OK)
{
CLog::Log(LOGERROR, "ADDONS: Fatal Error, cp_register_pcollection() returned status: %i", status);
return false;
}
- status = m_cpluff->register_pcollection(m_cp_context, CSpecialProtocol::TranslatePath("special://xbmcbin/addons").c_str());
+ status = cp_register_pcollection(m_cp_context, CSpecialProtocol::TranslatePath("special://xbmcbin/addons").c_str());
if (status != CP_OK)
{
CLog::Log(LOGERROR, "ADDONS: Fatal Error, cp_register_pcollection() returned status: %i", status);
return false;
}
- status = m_cpluff->register_logger(m_cp_context, cp_logger, this, CP_LOG_WARNING);
+ status = cp_register_logger(m_cp_context, cp_logger, this, CP_LOG_WARNING);
if (status != CP_OK)
{
CLog::Log(LOGERROR, "ADDONS: Fatal Error, cp_register_logger() returned status: %i", status);
@@ -358,11 +348,7 @@ bool CAddonMgr::Init()
void CAddonMgr::DeInit()
{
- if (m_cpluff)
- {
- m_cpluff->destroy_context(m_cp_context);
- m_cpluff.reset();
- }
+ cp_destroy_context(m_cp_context);
m_database.Close();
}
@@ -554,7 +540,7 @@ bool CAddonMgr::GetInstalledBinaryAddon(const std::string& addonId, BINARY_ADDON
CSingleLock lock(m_critSection);
- cp_plugin_info_t *cp_addon = m_cpluff->get_plugin_info(m_cp_context, addonId.c_str(), &status);
+ cp_plugin_info_t *cp_addon = cp_get_plugin_info(m_cp_context, addonId.c_str(), &status);
if (status == CP_OK && cp_addon)
{
cp_extension_t* props = GetFirstExtPoint(cp_addon, ADDON_UNKNOWN);
@@ -571,7 +557,7 @@ bool CAddonMgr::GetInstalledBinaryAddon(const std::string& addonId, BINARY_ADDON
ret = true;
}
}
- m_cpluff->release_info(m_cp_context, cp_addon);
+ cp_release_info(m_cp_context, cp_addon);
}
return ret;
@@ -589,12 +575,12 @@ bool CAddonMgr::GetAddonsInternal(const TYPE &type, VECADDONS &addons, bool enab
for (auto& builder : builders)
{
cp_status_t status;
- cp_plugin_info_t* cp_addon = m_cpluff->get_plugin_info(m_cp_context, builder.GetId().c_str(), &status);
+ cp_plugin_info_t* cp_addon = cp_get_plugin_info(m_cp_context, builder.GetId().c_str(), &status);
if (status == CP_OK && cp_addon)
{
if (enabledOnly && IsAddonDisabled(cp_addon->identifier))
{
- m_cpluff->release_info(m_cp_context, cp_addon);
+ cp_release_info(m_cp_context, cp_addon);
continue;
}
@@ -603,14 +589,14 @@ bool CAddonMgr::GetAddonsInternal(const TYPE &type, VECADDONS &addons, bool enab
cp_extension_t *props = GetFirstExtPoint(cp_addon, type);
if (props == nullptr)
{
- m_cpluff->release_info(m_cp_context, cp_addon);
+ cp_release_info(m_cp_context, cp_addon);
continue;
}
AddonPtr addon;
if (Factory(cp_addon, type, builder))
addon = builder.Build();
- m_cpluff->release_info(m_cp_context, cp_addon);
+ cp_release_info(m_cp_context, cp_addon);
if (addon)
{
@@ -630,11 +616,11 @@ bool CAddonMgr::GetAddon(const std::string &str, AddonPtr &addon, const TYPE &ty
CSingleLock lock(m_critSection);
cp_status_t status;
- cp_plugin_info_t *cpaddon = m_cpluff->get_plugin_info(m_cp_context, str.c_str(), &status);
+ cp_plugin_info_t *cpaddon = cp_get_plugin_info(m_cp_context, str.c_str(), &status);
if (status == CP_OK && cpaddon)
{
addon = Factory(cpaddon, type);
- m_cpluff->release_info(m_cp_context, cpaddon);
+ cp_release_info(m_cp_context, cpaddon);
if (addon)
{
@@ -649,7 +635,7 @@ bool CAddonMgr::GetAddon(const std::string &str, AddonPtr &addon, const TYPE &ty
return NULL != addon.get();
}
if (cpaddon)
- m_cpluff->release_info(m_cp_context, cpaddon);
+ cp_release_info(m_cp_context, cpaddon);
return false;
}
@@ -664,23 +650,23 @@ bool CAddonMgr::FindAddons()
{
bool result = false;
CSingleLock lock(m_critSection);
- if (m_cpluff && m_cp_context)
+ if (m_cp_context)
{
result = true;
- m_cpluff->scan_plugins(m_cp_context, CP_SP_UPGRADE);
+ cp_scan_plugins(m_cp_context, CP_SP_UPGRADE);
//Sync with db
{
std::set<std::string> installed;
cp_status_t status;
int n;
- cp_plugin_info_t** cp_addons = m_cpluff->get_plugins_info(m_cp_context, &status, &n);
+ cp_plugin_info_t** cp_addons = cp_get_plugins_info(m_cp_context, &status, &n);
for (int i = 0; i < n; ++i)
{
CLog::Log(LOGNOTICE, "ADDON: %s v%s installed", cp_addons[i]->identifier, cp_addons[i]->version);
installed.insert(cp_addons[i]->identifier);
}
- m_cpluff->release_info(m_cp_context, cp_addons);
+ cp_release_info(m_cp_context, cp_addons);
m_database.SyncInstalled(installed, m_systemAddons, m_optionalAddons);
}
@@ -704,9 +690,9 @@ bool CAddonMgr::UnloadAddon(const std::string& addonId)
if (!IsAddonInstalled(addonId))
return true;
- if (m_cpluff && m_cp_context)
+ if (m_cp_context)
{
- if (m_cpluff->uninstall_plugin(m_cp_context, addonId.c_str()) == CP_OK)
+ if (cp_uninstall_plugin(m_cp_context, addonId.c_str()) == CP_OK)
{
CLog::Log(LOGDEBUG, "CAddonMgr: %s unloaded", addonId.c_str());
@@ -723,7 +709,7 @@ bool CAddonMgr::UnloadAddon(const std::string& addonId)
bool CAddonMgr::LoadAddon(const std::string& addonId)
{
CSingleLock lock(m_critSection);
- if (!m_cpluff || !m_cp_context)
+ if (!m_cp_context)
return false;
AddonPtr addon;
@@ -955,7 +941,7 @@ std::string CAddonMgr::GetTranslatedString(const cp_cfg_element_t *root, const c
if (strcmp(tag, child.name) == 0)
{
// see if we have a "lang" attribute
- const char *lang = m_cpluff->lookup_cfg_value((cp_cfg_element_t*)&child, "@lang");
+ const char *lang = cp_lookup_cfg_value((cp_cfg_element_t*)&child, "@lang");
if (lang != NULL && g_langInfo.GetLocale().Matches(lang))
translatedValues.insert(std::make_pair(lang, child.value != NULL ? child.value : ""));
else if (lang == NULL || strcmp(lang, "en") == 0 || strcmp(lang, "en_GB") == 0)
@@ -1037,7 +1023,7 @@ cp_cfg_element_t *CAddonMgr::GetExtElement(cp_cfg_element_t *base, const char *p
{
cp_cfg_element_t *element = NULL;
if (base)
- element = m_cpluff->lookup_cfg_element(base, path);
+ element = cp_lookup_cfg_element(base, path);
return element;
}
@@ -1071,7 +1057,7 @@ const cp_extension_t *CAddonMgr::GetExtension(const cp_plugin_info_t *props, con
std::string CAddonMgr::GetExtValue(cp_cfg_element_t *base, const char *path) const
{
const char *value = "";
- if (base && (value = m_cpluff->lookup_cfg_value(base, path)))
+ if (base && (value = cp_lookup_cfg_value(base, path)))
return value;
else
return "";
@@ -1082,7 +1068,7 @@ bool CAddonMgr::GetExtList(cp_cfg_element_t *base, const char *path, std::vector
result.clear();
if (!base || !path)
return false;
- const char *all = m_cpluff->lookup_cfg_value(base, path);
+ const char *all = cp_lookup_cfg_value(base, path);
if (!all || *all == 0)
return false;
StringUtils::Tokenize(all, result, ' ');
@@ -1130,11 +1116,11 @@ bool CAddonMgr::LoadAddonDescription(const std::string &directory, AddonPtr &add
}
cp_status_t status;
- cp_context_t* context = m_cpluff->create_context(&status);
+ cp_context_t* context = cp_create_context(&status);
if (!context)
return false;
- auto info = m_cpluff->load_plugin_descriptor_from_memory(context, buffer.get(), buffer.size(), &status);
+ auto info = cp_load_plugin_descriptor_from_memory(context, buffer.get(), buffer.size(), &status);
if (info)
{
// Correct the path. load_plugin_descriptor_from_memory sets it to 'memory'
@@ -1145,12 +1131,12 @@ bool CAddonMgr::LoadAddonDescription(const std::string &directory, AddonPtr &add
free(info->plugin_path);
info->plugin_path = nullptr;
- m_cpluff->release_info(context, info);
+ cp_release_info(context, info);
}
else
CLog::Log(LOGERROR, "Failed to parse '%s'", addonXmlPath.c_str());
- m_cpluff->destroy_context(context);
+ cp_destroy_context(context);
return addon != nullptr;
}
@@ -1171,7 +1157,7 @@ bool CAddonMgr::AddonsFromRepoXML(const CRepository::DirInfo& repo, const std::s
// create a context for these addons
cp_status_t status;
- cp_context_t *context = m_cpluff->create_context(&status);
+ cp_context_t *context = cp_create_context(&status);
if (!context)
return false;
@@ -1185,7 +1171,7 @@ bool CAddonMgr::AddonsFromRepoXML(const CRepository::DirInfo& repo, const std::s
xml << decl;
xml << *element;
cp_status_t status;
- cp_plugin_info_t *info = m_cpluff->load_plugin_descriptor_from_memory(context, xml.c_str(), xml.size(), &status);
+ cp_plugin_info_t *info = cp_load_plugin_descriptor_from_memory(context, xml.c_str(), xml.size(), &status);
if (info)
{
CAddonBuilder builder;
@@ -1204,11 +1190,11 @@ bool CAddonMgr::AddonsFromRepoXML(const CRepository::DirInfo& repo, const std::s
}
free(info->plugin_path);
info->plugin_path = nullptr;
- m_cpluff->release_info(context, info);
+ cp_release_info(context, info);
}
element = element->NextSiblingElement("addon");
}
- m_cpluff->destroy_context(context);
+ cp_destroy_context(context);
return true;
}
diff --git a/xbmc/addons/AddonManager.h b/xbmc/addons/AddonManager.h
index c2365ff9ba..a581f0ee87 100644
--- a/xbmc/addons/AddonManager.h
+++ b/xbmc/addons/AddonManager.h
@@ -25,7 +25,6 @@
#include "threads/CriticalSection.h"
#include "utils/EventStream.h"
-class DllLibCPluff;
extern "C"
{
#include "lib/cpluff/libcpluff/cpluff.h"
@@ -295,7 +294,6 @@ namespace ADDON
CAddonMgr& operator=(CAddonMgr const&) = delete;
/* libcpluff */
cp_context_t *m_cp_context;
- std::unique_ptr<DllLibCPluff> m_cpluff;
VECADDONS m_updateableAddons;
/*! \brief Check whether this addon is supported on the current platform
diff --git a/xbmc/addons/CMakeLists.txt b/xbmc/addons/CMakeLists.txt
index cf63b7b106..f4130e494d 100644
--- a/xbmc/addons/CMakeLists.txt
+++ b/xbmc/addons/CMakeLists.txt
@@ -50,7 +50,6 @@ set(HEADERS Addon.h
AudioEncoder.h
ContextMenuAddon.h
ContextMenus.h
- DllLibCPluff.h
FilesystemInstaller.h
FontResource.h
GameResource.h
diff --git a/xbmc/addons/DllLibCPluff.h b/xbmc/addons/DllLibCPluff.h
deleted file mode 100644
index 09c7713b55..0000000000
--- a/xbmc/addons/DllLibCPluff.h
+++ /dev/null
@@ -1,129 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2005-2013 Team XBMC
- * 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 "DynamicDll.h"
-
-extern "C" {
-#include "lib/cpluff/libcpluff/cpluff.h"
-}
-
-class DllLibCPluffInterface
-{
-public:
- virtual ~DllLibCPluffInterface() = default;
- virtual const char *get_version(void) =0;
- virtual void set_fatal_error_handler(cp_fatal_error_func_t error_handler) =0;
- virtual cp_status_t init(void) =0;
- virtual void destroy(void) =0;
- virtual cp_context_t * create_context(cp_status_t *status) =0;
- virtual void destroy_context(cp_context_t *ctx) =0;
- virtual cp_status_t register_pcollection(cp_context_t *ctx, const char *dir) =0;
- virtual void unregister_pcollection(cp_context_t *ctx, const char *dir) =0;
- virtual void unregister_pcollections(cp_context_t *ctx) =0;
- virtual cp_status_t register_logger(cp_context_t *ctx, cp_logger_func_t logger, void *user_data, cp_log_severity_t min_severity) =0;
- virtual void unregister_logger(cp_context_t *ctx, cp_logger_func_t logger) =0;
- virtual cp_status_t scan_plugins(cp_context_t *ctx, int flags) =0;
- virtual cp_plugin_info_t * get_plugin_info(cp_context_t *ctx, const char *id, cp_status_t *status) =0;
- virtual cp_plugin_info_t ** get_plugins_info(cp_context_t *ctx, cp_status_t *status, int *num) =0;
- virtual cp_extension_t ** get_extensions_info(cp_context_t *ctx, const char *extpt_id, cp_status_t *status, int *num) =0;
- virtual void release_info(cp_context_t *ctx, void *info) =0;
- virtual cp_cfg_element_t * lookup_cfg_element(cp_cfg_element_t *base, const char *path) =0;
- virtual char * lookup_cfg_value(cp_cfg_element_t *base, const char *path) =0;
- virtual cp_status_t define_symbol(cp_context_t *ctx, const char *name, void *ptr) =0;
- virtual void *resolve_symbol(cp_context_t *ctx, const char *id, const char *name, cp_status_t *status) =0;
- virtual void release_symbol(cp_context_t *ctx, const void *ptr) =0;
- virtual cp_plugin_info_t *load_plugin_descriptor(cp_context_t *ctx, const char *path, cp_status_t *status) =0;
- virtual cp_plugin_info_t *load_plugin_descriptor_from_memory(cp_context_t *ctx, const char *buffer, unsigned int buffer_len, cp_status_t *status) =0;
- virtual cp_status_t uninstall_plugin(cp_context_t *ctx, const char *id)=0;
-};
-
-class DllLibCPluff : public DllDynamic, DllLibCPluffInterface
-{
- DECLARE_DLL_WRAPPER(DllLibCPluff, DLL_PATH_CPLUFF)
-
- DllLibCPluff(const DllLibCPluff&) = delete;
- DllLibCPluff& operator=(const DllDynamic&) = delete;
-
- DllLibCPluff(DllLibCPluff&&);
- DllLibCPluff& operator=(DllLibCPluff&&);
-
- ~DllLibCPluff() override
- {
- if (IsLoaded())
- destroy();
- }
-
- DEFINE_METHOD0(const char*, get_version)
- DEFINE_METHOD1(void, set_fatal_error_handler, (cp_fatal_error_func_t p1))
- DEFINE_METHOD0(cp_status_t, init)
- DEFINE_METHOD0(void, destroy)
- DEFINE_METHOD1(cp_context_t*, create_context, (cp_status_t *p1))
- DEFINE_METHOD1(void, destroy_context, (cp_context_t *p1))
-
- DEFINE_METHOD2(cp_status_t, register_pcollection, (cp_context_t *p1, const char *p2))
- DEFINE_METHOD2(void, unregister_pcollection, (cp_context_t *p1, const char *p2))
- DEFINE_METHOD1(void, unregister_pcollections, (cp_context_t *p1))
-
- DEFINE_METHOD4(cp_status_t, register_logger, (cp_context_t *p1, cp_logger_func_t p2, void *p3, cp_log_severity_t p4))
- DEFINE_METHOD2(void, unregister_logger, (cp_context_t *p1, cp_logger_func_t p2))
- DEFINE_METHOD2(cp_status_t, scan_plugins, (cp_context_t *p1, int p2))
- DEFINE_METHOD3(cp_plugin_info_t*, get_plugin_info, (cp_context_t *p1, const char *p2, cp_status_t *p3))
- DEFINE_METHOD3(cp_plugin_info_t**, get_plugins_info, (cp_context_t *p1, cp_status_t *p2, int *p3))
- DEFINE_METHOD4(cp_extension_t**, get_extensions_info, (cp_context_t *p1, const char *p2, cp_status_t *p3, int *p4))
- DEFINE_METHOD2(void, release_info, (cp_context_t *p1, void *p2))
-
- DEFINE_METHOD2(cp_cfg_element_t*, lookup_cfg_element, (cp_cfg_element_t *p1, const char *p2))
- DEFINE_METHOD2(char*, lookup_cfg_value, (cp_cfg_element_t *p1, const char *p2))
-
- DEFINE_METHOD3(cp_status_t, define_symbol, (cp_context_t *p1, const char *p2, void *p3))
- DEFINE_METHOD4(void*, resolve_symbol, (cp_context_t *p1, const char *p2, const char *p3, cp_status_t *p4))
- DEFINE_METHOD2(void, release_symbol, (cp_context_t *p1, const void *p2))
- DEFINE_METHOD3(cp_plugin_info_t*, load_plugin_descriptor, (cp_context_t *p1, const char *p2, cp_status_t *p3))
- DEFINE_METHOD4(cp_plugin_info_t*, load_plugin_descriptor_from_memory, (cp_context_t *p1, const char *p2, unsigned int p3, cp_status_t *p4))
- DEFINE_METHOD2(cp_status_t, uninstall_plugin, (cp_context_t *p1, const char *p2))
-
- BEGIN_METHOD_RESOLVE()
- RESOLVE_METHOD_RENAME(cp_get_version, get_version)
- RESOLVE_METHOD_RENAME(cp_set_fatal_error_handler, set_fatal_error_handler)
- RESOLVE_METHOD_RENAME(cp_init, init)
- RESOLVE_METHOD_RENAME(cp_destroy, destroy)
- RESOLVE_METHOD_RENAME(cp_create_context, create_context)
- RESOLVE_METHOD_RENAME(cp_destroy_context, destroy_context)
- RESOLVE_METHOD_RENAME(cp_register_pcollection, register_pcollection)
- RESOLVE_METHOD_RENAME(cp_unregister_pcollection, unregister_pcollection)
- RESOLVE_METHOD_RENAME(cp_unregister_pcollections, unregister_pcollections)
- RESOLVE_METHOD_RENAME(cp_register_logger, register_logger)
- RESOLVE_METHOD_RENAME(cp_unregister_logger, unregister_logger)
- RESOLVE_METHOD_RENAME(cp_scan_plugins, scan_plugins)
- RESOLVE_METHOD_RENAME(cp_get_plugin_info, get_plugin_info)
- RESOLVE_METHOD_RENAME(cp_get_plugins_info, get_plugins_info)
- RESOLVE_METHOD_RENAME(cp_get_extensions_info, get_extensions_info)
- RESOLVE_METHOD_RENAME(cp_release_info, release_info)
- RESOLVE_METHOD_RENAME(cp_lookup_cfg_element, lookup_cfg_element)
- RESOLVE_METHOD_RENAME(cp_lookup_cfg_value, lookup_cfg_value)
- RESOLVE_METHOD_RENAME(cp_define_symbol, define_symbol)
- RESOLVE_METHOD_RENAME(cp_resolve_symbol, resolve_symbol)
- RESOLVE_METHOD_RENAME(cp_release_symbol, release_symbol)
- RESOLVE_METHOD_RENAME(cp_load_plugin_descriptor, load_plugin_descriptor)
- RESOLVE_METHOD_RENAME(cp_load_plugin_descriptor_from_memory, load_plugin_descriptor_from_memory)
- RESOLVE_METHOD_RENAME(cp_uninstall_plugin, uninstall_plugin)
- END_METHOD_RESOLVE()
-};