Skip to content

Commit

Permalink
Merge pull request #634 from matthuisman/backport_fixes
Browse files Browse the repository at this point in the history
[Leia] Backport Matrix bug fixes
  • Loading branch information
phunkyfish authored Apr 10, 2021
2 parents 09ec268 + ca6dc60 commit 345c4e7
Show file tree
Hide file tree
Showing 12 changed files with 290 additions and 80 deletions.
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ else()
add_subdirectory(lib/libbento4)
endif()

if(CORE_SYSTEM_NAME STREQUAL android)
set(DECRYPTERPATH "special://xbmcbinaddons")
else()
set(DECRYPTERPATH "special://home/cdm")
endif()
set(DECRYPTERPATH "special://home/cdm")

list(APPEND DEPLIBS bento4)
list(APPEND DEPLIBS mpegts)
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
buildPlugin(version: "Leia", deploy: ['osx-x86_64', 'windows-i686', 'windows-x86_64', 'ubuntu-ppa'])
buildPlugin(version: "Leia")
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# inputstream.adaptive (2.4.6)
# inputstream.adaptive (2.4.7)

This is an adaptive file addon for kodi's new InputStream Interface.

Expand Down
6 changes: 3 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Source: kodi-inputstream-adaptive
Priority: extra
Maintainer: peak3d <[email protected]>
Maintainer: Team Kodi <[email protected]>
Build-Depends: debhelper (>= 9.0.0), cmake, libkodiplatform-dev (>= 17.0.0),
kodi-addon-dev, pkg-config, libexpat1-dev
Standards-Version: 3.9.7
Standards-Version: 3.9.8
Section: libs
Homepage: http://www.peak3d.de
Homepage: https://kodi.tv

Package: kodi-inputstream-adaptive
Section: libs
Expand Down
13 changes: 12 additions & 1 deletion inputstream.adaptive/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="inputstream.adaptive"
version="2.4.6"
version="2.4.7"
name="InputStream Adaptive"
provider-name="peak3d">
<requires>@ADDON_DEPENDS@</requires>
Expand All @@ -19,6 +19,17 @@
<description lang="es">Cliente InputStream para flujo de datos adaptativos</description>
<platform>@PLATFORM@</platform>
<news>
v2.4.7 (2021-04-10)
- [Dash] Fix missing audio languages
- [Dash] Correctly set timeshift_buffer (live)
- [Dash] Fix Timing (remove publishTime and presentationTimeOffset)
- [Dash] Append / to baseurl if required
- [Dash] Support fpsScale in AdaptationSets
- [Dash] Use full BaseUrl if real url inside an AdaptationSet
- Fix for URLs starting with /
- Use CDllHelper for opening ssd_wv
- Move Android addon to binary addons repo

v2.4.6 (2020-05-18)
- Fix effective url if paths beginning with / provided
- Several translations added / fixed
Expand Down
211 changes: 211 additions & 0 deletions src/DllHelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
/*
* Copyright (C) 2005-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/

#pragma once

#ifdef __cplusplus

#include <string>

#include <dlfcn.h>
#include <kodi/AddonBase.h>
#include <kodi/Filesystem.h>

//==============================================================================
/// @ingroup cpp_kodi_tools_CDllHelper
/// @brief Macro to translate the given pointer value name of functions to
/// requested function name.
///
/// @note This should always be used and does the work of
/// @ref kodi::tools::CDllHelper::RegisterSymbol().
///
#define REGISTER_DLL_SYMBOL(functionPtr) \
kodi::tools::CDllHelper::RegisterSymbol(functionPtr, #functionPtr)
//------------------------------------------------------------------------------

namespace kodi
{
namespace tools
{

//==============================================================================
/// @defgroup cpp_kodi_tools_CDllHelper class CDllHelper
/// @ingroup cpp_kodi_tools
/// @brief **Class to help with load of shared library functions**\n
/// You can add them as parent to your class and to help with load of shared
/// library functions.
///
/// @note To use on Windows must you also include [dlfcn-win32](https:/dlfcn-win32/dlfcn-win32)
/// on your addon!\n\n
/// Furthermore, this allows the use of Android where the required library is
/// copied to an EXE useable folder.
///
///
/// ----------------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.cpp}
///
/// #include <kodi/tools/DllHelper.h>
///
/// ...
/// class CMyInstance : public kodi::addon::CInstanceAudioDecoder,
/// private kodi::tools::CDllHelper
/// {
/// public:
/// CMyInstance(KODI_HANDLE instance, const std::string& kodiVersion);
/// bool Start();
///
/// ...
///
/// // The pointers for on shared library exported functions
/// int (*Init)();
/// void (*Cleanup)();
/// int (*GetLength)();
/// };
///
/// CMyInstance::CMyInstance(KODI_HANDLE instance, const std::string& kodiVersion)
/// : CInstanceAudioDecoder(instance, kodiVersion)
/// {
/// }
///
/// bool CMyInstance::Start()
/// {
/// std::string lib = kodi::GetAddonPath("myLib.so");
/// if (!LoadDll(lib)) return false;
/// if (!REGISTER_DLL_SYMBOL(Init)) return false;
/// if (!REGISTER_DLL_SYMBOL(Cleanup)) return false;
/// if (!REGISTER_DLL_SYMBOL(GetLength)) return false;
///
/// Init();
/// return true;
/// }
/// ...
/// ~~~~~~~~~~~~~
///
///@{
class ATTRIBUTE_HIDDEN CDllHelper
{
public:
//============================================================================
/// @ingroup cpp_kodi_tools_CDllHelper
/// @brief Class constructor.
///
CDllHelper() = default;
//----------------------------------------------------------------------------

//============================================================================
/// @ingroup cpp_kodi_tools_CDllHelper
/// @brief Class destructor.
///
virtual ~CDllHelper()
{
if (m_dll)
dlclose(m_dll);
}
//----------------------------------------------------------------------------

//============================================================================
/// @ingroup cpp_kodi_tools_CDllHelper
/// @brief Function to load requested library.
///
/// @param[in] path The path with filename of shared library to load
/// @return true if load was successful done
///
bool LoadDll(std::string path)
{
#if defined(TARGET_ANDROID)
if (kodi::vfs::FileExists(path))
{
// Check already defined for "xbmcaltbinaddons", if yes no copy necassary.
std::string xbmcaltbinaddons =
kodi::vfs::TranslateSpecialProtocol("special://xbmcaltbinaddons/");
if (path.compare(0, xbmcaltbinaddons.length(), xbmcaltbinaddons) != 0)
{
bool doCopy = true;
std::string dstfile = xbmcaltbinaddons + kodi::vfs::GetFileName(path);

STAT_STRUCTURE dstFileStat;
if (kodi::vfs::StatFile(dstfile, dstFileStat))
{
STAT_STRUCTURE srcFileStat;
if (kodi::vfs::StatFile(path, srcFileStat))
{
if (dstFileStat.size == srcFileStat.size &&
dstFileStat.modificationTime.tv_sec > srcFileStat.modificationTime.tv_sec)
doCopy = false;
}
}

if (doCopy)
{
kodi::Log(ADDON_LOG_DEBUG, "Caching '%s' to '%s'", path.c_str(), dstfile.c_str());
if (!kodi::vfs::CopyFile(path, dstfile))
{
kodi::Log(ADDON_LOG_ERROR, "Failed to cache '%s' to '%s'", path.c_str(),
dstfile.c_str());
return false;
}
}

path = dstfile;
}
}
else
{
return false;
}
#endif

m_dll = dlopen(path.c_str(), RTLD_LAZY);
if (m_dll == nullptr)
{
kodi::Log(ADDON_LOG_ERROR, "Unable to load %s", dlerror());
return false;
}
return true;
}
//----------------------------------------------------------------------------

//============================================================================
/// @ingroup cpp_kodi_tools_CDllHelper
/// @brief Function to register requested library symbol.
///
/// @warning This function should not be used, use instead the macro
/// @ref REGISTER_DLL_SYMBOL to register the symbol pointer.
///
///
/// Use this always via Macro, e.g.:
/// ~~~~~~~~~~~~~{.cpp}
/// if (!REGISTER_DLL_SYMBOL(Init))
/// return false;
/// ~~~~~~~~~~~~~
///
template <typename T>
bool RegisterSymbol(T& functionPtr, const char* strFunctionPtr)
{
functionPtr = reinterpret_cast<T>(dlsym(m_dll, strFunctionPtr));
if (functionPtr == nullptr)
{
kodi::Log(ADDON_LOG_ERROR, "Unable to assign function %s", dlerror());
return false;
}
return true;
}
//----------------------------------------------------------------------------

private:
void* m_dll = nullptr;
};
///@}
//------------------------------------------------------------------------------

} /* namespace tools */
} /* namespace kodi */

#endif /* __cplusplus */
5 changes: 2 additions & 3 deletions src/common/AdaptiveTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ namespace adaptive
, overallSeconds_(0)
, stream_start_(0)
, available_time_(0)
, publish_time_(0)
, base_time_(0)
, minPresentationOffset(0)
, has_timeshift_buffer_(false)
Expand Down Expand Up @@ -172,7 +171,7 @@ namespace adaptive
}

void AdaptiveTree::OnDataArrived(unsigned int segNum, uint16_t psshSet, uint8_t iv[16], const uint8_t *src, uint8_t *dst, size_t dstOffset, size_t dataSize)
{
{
memcpy(dst + dstOffset, src, dataSize);
}

Expand Down Expand Up @@ -331,7 +330,7 @@ namespace adaptive
}
base_url_.resize(paramPos + 1);

paramPos = base_url_.find("://", 0, 8);
paramPos = base_url_.find("://");
if (paramPos != std::string::npos)
{
base_domain_ = base_url_;
Expand Down
6 changes: 3 additions & 3 deletions src/common/AdaptiveTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class AdaptiveTree

struct SegmentTemplate
{
SegmentTemplate() : timescale(0), duration(0), presentationTimeOffset(0){};
SegmentTemplate() : timescale(0), duration(0) {};
std::string initialization;
std::string media;
unsigned int timescale, duration;
Expand Down Expand Up @@ -422,7 +422,7 @@ class AdaptiveTree
XML_Parser parser_;
uint32_t currentNode_;
uint32_t segcount_;
uint64_t overallSeconds_, stream_start_, available_time_, publish_time_, base_time_;
uint64_t overallSeconds_, stream_start_, available_time_, base_time_;
uint64_t minPresentationOffset;
bool has_timeshift_buffer_, has_overall_seconds_;

Expand All @@ -435,7 +435,7 @@ class AdaptiveTree

uint8_t adpChannelCount_, adp_pssh_set_;
uint16_t adpwidth_, adpheight_;
uint32_t adpfpsRate_;
uint32_t adpfpsRate_, adpfpsScale_;
float adpaspect_;
ContainerType adpContainerType_;
bool adp_timelined_, period_timelined_;
Expand Down
Loading

0 comments on commit 345c4e7

Please sign in to comment.