mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
kodi: Add PR10345 to avoid kodi crashing when loading old inputstream addons
This commit is contained in:
parent
b7128c6b01
commit
2b5149c6c2
82
packages/mediacenter/kodi/patches/kodi-999.99-PR10345.patch
Normal file
82
packages/mediacenter/kodi/patches/kodi-999.99-PR10345.patch
Normal file
@ -0,0 +1,82 @@
|
||||
From 11c81dbb3d0ccfbe3a4197890dea09801617eae2 Mon Sep 17 00:00:00 2001
|
||||
From: mapfau <pfau@peakwork.de>
|
||||
Date: Sun, 28 Aug 2016 23:15:34 +0200
|
||||
Subject: [PATCH] check for kodi.inputstream version
|
||||
|
||||
---
|
||||
xbmc/addons/InputStream.cpp | 23 +++++++++++++++++++++--
|
||||
xbmc/addons/InputStream.h | 4 +++-
|
||||
2 files changed, 24 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/xbmc/addons/InputStream.cpp b/xbmc/addons/InputStream.cpp
|
||||
index 9d6aee2..5d09a4c 100644
|
||||
--- a/xbmc/addons/InputStream.cpp
|
||||
+++ b/xbmc/addons/InputStream.cpp
|
||||
@@ -36,8 +36,22 @@ std::unique_ptr<CInputStream> CInputStream::FromExtension(AddonProps props, cons
|
||||
std::string extensions = CAddonMgr::GetInstance().GetExtValue(ext->configuration, "@extension");
|
||||
std::string protocols = CAddonMgr::GetInstance().GetExtValue(ext->configuration, "@protocols");
|
||||
std::string name(ext->plugin->identifier);
|
||||
+
|
||||
+ bool matchAPIVersion(true);
|
||||
+ for (unsigned int i(0); i < ext->plugin->num_imports; ++i)
|
||||
+ if (strcmp(ext->plugin->imports[i].plugin_id, "kodi.inputstream") == 0 && strcmp(ext->plugin->imports[i].version, INPUTSTREAM_API_VERSION) != 0)
|
||||
+ {
|
||||
+ matchAPIVersion = false;
|
||||
+ CLog::Log(LOGNOTICE, "CInputStream::FromExtension - %s (%s) not loaded due to API mismatch, has %s, wanted %s",
|
||||
+ props.id.c_str(),
|
||||
+ props.version.Upstream().c_str(),
|
||||
+ ext->plugin->imports[i].version,
|
||||
+ INPUTSTREAM_API_VERSION);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
std::unique_ptr<CInputStream> istr(new CInputStream(props, name, listitemprops,
|
||||
- extensions, protocols));
|
||||
+ extensions, protocols, matchAPIVersion));
|
||||
istr->CheckConfig();
|
||||
return istr;
|
||||
}
|
||||
@@ -46,8 +60,10 @@ CInputStream::CInputStream(const AddonProps& props,
|
||||
const std::string& name,
|
||||
const std::string& listitemprops,
|
||||
const std::string& extensions,
|
||||
- const std::string& protocols)
|
||||
+ const std::string& protocols,
|
||||
+ bool matchAPIVersion)
|
||||
: InputStreamDll(std::move(props))
|
||||
+, m_matchAPIVersion(matchAPIVersion)
|
||||
{
|
||||
m_fileItemProps = StringUtils::Tokenize(listitemprops, "|");
|
||||
for (auto &key : m_fileItemProps)
|
||||
@@ -71,6 +87,9 @@ CInputStream::CInputStream(const AddonProps& props,
|
||||
|
||||
bool CInputStream::CheckAPIVersion()
|
||||
{
|
||||
+ if (!m_matchAPIVersion)
|
||||
+ return false;
|
||||
+
|
||||
std::string dllVersion = m_pStruct->GetApiVersion();
|
||||
if (dllVersion.compare(INPUTSTREAM_API_VERSION) != 0)
|
||||
{
|
||||
diff --git a/xbmc/addons/InputStream.h b/xbmc/addons/InputStream.h
|
||||
index c081472..328e036 100644
|
||||
--- a/xbmc/addons/InputStream.h
|
||||
+++ b/xbmc/addons/InputStream.h
|
||||
@@ -46,7 +46,8 @@ namespace ADDON
|
||||
const std::string& name,
|
||||
const std::string& listitemprops,
|
||||
const std::string& extensions,
|
||||
- const std::string& protocols);
|
||||
+ const std::string& protocols,
|
||||
+ bool hasAPIVersion);
|
||||
virtual ~CInputStream() {}
|
||||
|
||||
virtual void SaveSettings() override;
|
||||
@@ -100,6 +101,7 @@ namespace ADDON
|
||||
std::vector<std::string> m_extensionsList;
|
||||
std::vector<std::string> m_protocolsList;
|
||||
INPUTSTREAM_CAPABILITIES m_caps;
|
||||
+ bool m_matchAPIVersion;
|
||||
std::map<int, CDemuxStream*> m_streams;
|
||||
|
||||
static CCriticalSection m_parentSection;
|
Loading…
x
Reference in New Issue
Block a user