Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
AlwinEsch committed Oct 20, 2021
1 parent aed76db commit 917420d
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 43 deletions.
10 changes: 5 additions & 5 deletions cmake/scripts/common/AddonHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ macro (build_addon target prefix libs)
endif()
endif()
endforeach(loop_var)
add_definitions(-D${__KDK_MAJOR__})
add_definitions(-D${__KDK_MINOR__})
add_definitions(-D${__KDK_BETA__})
add_definitions(-D${__KDK_CANARY__})
add_definitions(-D${__KDK_API_OLDEST__})
add_definitions(-D__KDK_MAJOR__=${__KDK_MAJOR__})
add_definitions(-D__KDK_MINOR__=${__KDK_MINOR__})
add_definitions(-D__KDK_BETA__=${__KDK_BETA__})
add_definitions(-D__KDK_CANARY__=${__KDK_CANARY__})
add_definitions(-D__KDK_API_OLDEST__=${__KDK_API_OLDEST__})

add_library(${target} ${${prefix}_SOURCES} ${${prefix}_HEADERS})
target_link_libraries(${target} ${${libs}})
Expand Down
28 changes: 14 additions & 14 deletions xbmc/addons/AudioDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#include "AudioDecoder.h"

// Devkit API interface
#include "interface/api/addon-instance/audiodecoder.h"
#include "interface/api/audio_engine.h"

// Kodi
#include "FileItem.h"
#include "ServiceBroker.h"
#include "addons/AddonManager.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
#include "filesystem/File.h"
#include "guilib/LocalizeStrings.h"
Expand Down Expand Up @@ -308,7 +308,7 @@ bool CAudioDecoder::CreateDecoder()
bool CAudioDecoder::CanOperateFile(const std::string& filename)
{
// Create in case not available, possible as this done by IAddonSupportCheck
if ((!m_addonInstance && !CreateDecoder()) || !m_struct.toAddon->can_operate_file)
if ((!m_addonInstance && !CreateDecoder()))
return false;

return m_ifc->kodi_addoninstance_audiodecoder_h->kodi_addon_audiodecoder_can_operate_file_v1(m_addonInstance, filename.c_str());
Expand Down Expand Up @@ -375,7 +375,7 @@ bool CAudioDecoder::Load(const std::string& fileName,
MUSIC_INFO::CMusicInfoTag& tag,
EmbeddedArt* art)
{
AUDIODECODER_INFO_TAG ifcTag = {0};
KODI_ADDON_AUDIODECODER_INFO_TAG ifcTag = {};
bool ret = m_ifc->kodi_addoninstance_audiodecoder_h->kodi_addon_audiodecoder_read_tag_v1(m_addonInstance, fileName.c_str(), &ifcTag);
if (ret)
{
Expand Down Expand Up @@ -464,17 +464,17 @@ bool CAudioDecoder::Load(const std::string& fileName,
}
free(ifcTag.cover_art_path);
}
else if (ifcTag.cover_art_mem_mimetype && ifcTag.cover_art_mem && ifcTag.cover_art_mem_size > 0)
{
tag.SetCoverArtInfo(ifcTag.cover_art_mem_size, ifcTag.cover_art_mem_mimetype);
if (art)
art->Set(ifcTag.cover_art_mem, ifcTag.cover_art_mem_size, ifcTag.cover_art_mem_mimetype);
}

if (ifcTag.cover_art_mem_mimetype)
free(ifcTag.cover_art_mem_mimetype);
if (ifcTag.cover_art_mem)
free(ifcTag.cover_art_mem);
// else if (ifcTag.cover_art_mem_mimetype && ifcTag.cover_art_mem && ifcTag.cover_art_mem_size > 0)
// {
// tag.SetCoverArtInfo(ifcTag.cover_art_mem_size, ifcTag.cover_art_mem_mimetype);
// if (art)
// art->Set(ifcTag.cover_art_mem, ifcTag.cover_art_mem_size, ifcTag.cover_art_mem_mimetype);
// }
//
// if (ifcTag.cover_art_mem_mimetype)
// free(ifcTag.cover_art_mem_mimetype);
// if (ifcTag.cover_art_mem)
// free(ifcTag.cover_art_mem);

tag.SetLoaded(true);
}
Expand Down
6 changes: 5 additions & 1 deletion xbmc/addons/AudioDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@

#pragma once

// Devkit API interface
#include "interface/api/addon-instance/audiodecoder.h"

#include "addons/AddonEvents.h"
#include "addons/IAddonSupportCheck.h"
#include "addons/IAddonSupportList.h"
#include "addons/interface/InstanceHandler.h"
#include "cores/paplayer/ICodec.h"
#include "filesystem/MusicFileDirectory.h"
#include "interface/InstanceHandler.h"
#include "music/tags/ImusicInfoTagLoader.h"

namespace MUSIC_INFO
Expand Down
2 changes: 1 addition & 1 deletion xbmc/addons/interface/RunningThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace INTERFACE
CRunningThread::CRunningThread(int64_t identifier, CRunningProcess* const process)
: m_mainThread(identifier == 0),
m_identifier(identifier),
m_id(StringUtils::Format("%s-ifc-%05i", process->GetUUID().c_str(), m_identifier)),
m_id(StringUtils::Format("{}-ifc-{:05}", process->GetUUID().c_str(), m_identifier)),
m_process(process)
{
m_shareProcessReceiver = new CShareProcessReceiver(m_id + "-chlsrv", m_mainThread);
Expand Down
5 changes: 5 additions & 0 deletions xbmc/addons/kodi-dev-kit/include/kodi/AddonBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,8 @@ void Log(const ADDON_LOG loglevel, const std::string& fmt, Args&&... args)
} \
extern "C" ATTR_DLL_EXPORT int main(int argc, char** argv) \
{ \
fprintf(stderr, "TEMP DEBUG: Addon main started, PID %i\n", getpid()); \
/* sleep(5); */ \
static KODI_ADDON_FUNC func = {ADDON_Create, \
kodi::addon::CAddonBase::ADDONBASE_Destroy, \
kodi::addon::CAddonBase::ADDONBASE_CreateInstance, \
Expand All @@ -655,7 +657,10 @@ void Log(const ADDON_LOG loglevel, const std::string& fmt, Args&&... args)
kodi::addon::CAddonBase::ADDONBASE_SetSettingInteger, \
kodi::addon::CAddonBase::ADDONBASE_SetSettingFloat}; \
if (!kodi::Init(__KODI_API__, argc, argv, &func, true, false)) \
{ \
fprintf(stderr, "TEMP DEBUG: Addon main start failed!!! PID %i\n", getpid()); \
return -1; \
} \
while (1) \
{ \
if (!kodi::dl::api.kodi_process(kodi::dl::hdl)) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ class ATTR_DLL_LOCAL CInstanceAudioDecoder : public IAddonInstance
struct KODI_ADDON_AUDIODECODER_INFO_TAG* tag)
{
kodi::addon::AudioDecoderInfoTag cppTag;
memset(tag, 0, sizeof(KODI_ADDON_AUDIODECODER_INFO_TAG));
bool ret = static_cast<CInstanceAudioDecoder*>(hdl)->ReadTag(file, cppTag);
if (ret)
{
Expand All @@ -715,9 +716,9 @@ class ATTR_DLL_LOCAL CInstanceAudioDecoder : public IAddonInstance
const uint8_t* mem = cppTag.GetCoverArtByMem(size, mimetype);
if (mem)
{
tag->cover_art_mem_mimetype = strdup(mimetype.c_str());
tag->cover_art_mem_size = size;
tag->cover_art_mem = static_cast<uint8_t*>(malloc(size));
// tag->cover_art_mem_mimetype = strdup(mimetype.c_str());
// tag->cover_art_mem_size = size;
// tag->cover_art_mem = static_cast<uint8_t*>(malloc(size));
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ extern "C"
char* comment;
char* cover_art_path;
char* cover_art_mem_mimetype;
uint8_t* cover_art_mem;
// uint8_t* cover_art_mem;
size_t cover_art_mem_size;
};

Expand Down
4 changes: 2 additions & 2 deletions xbmc/addons/kodi-dev-kit/src/addon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ elseif(CORE_SYSTEM_NAME STREQUAL darwin_embedded)
elseif(CORE_SYSTEM_NAME STREQUAL freebsd)
message(FATAL_ERROR "OS currently not supported and in TODO!!!")
elseif(CORE_SYSTEM_NAME STREQUAL linux)
target_link_libraries(${PROJECT_NAME} PRIVATE -static-libgcc -static-libstdc++ m c rt pthread)
#target_link_libraries(${PROJECT_NAME} PUBLIC stdc++ gcc pthread m c rt )
#target_link_libraries(${PROJECT_NAME} PRIVATE -static-libgcc -static-libstdc++ m c rt pthread)
target_link_libraries(${PROJECT_NAME} PUBLIC stdc++ gcc pthread m c rt )
elseif(CORE_SYSTEM_NAME STREQUAL osx)
message(FATAL_ERROR "OS currently not supported and in TODO!!!")
elseif(CORE_SYSTEM_NAME STREQUAL windows)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ bool CSharedMemControlPosix::Create(bool initial)
{
m_creator = initial;

fprintf(stderr, "<<<<<<<<<<<<<<<<<<<<<<< %s\n", GetIdentifier().c_str());
int fd = shm_open(GetIdentifier().c_str(), initial ? O_CREAT | O_TRUNC | O_RDWR : O_RDWR, 0666);
if (fd == -1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ struct IFC_KODI_ADDON_AUDIODECODER_INFO_TAG
cover_art_path = c_data->cover_art_path;
if (c_data->cover_art_mem_mimetype)
cover_art_mem_mimetype = c_data->cover_art_mem_mimetype;
cover_art_mem = c_data->cover_art_mem;
cover_art_mem_size = c_data->cover_art_mem_size;
}

Expand Down Expand Up @@ -269,7 +268,6 @@ struct IFC_KODI_ADDON_AUDIODECODER_INFO_TAG
c_data->cover_art_path = strdup(cover_art_path.c_str());
if (!cover_art_mem_mimetype.empty())
c_data->cover_art_mem_mimetype = strdup(cover_art_mem_mimetype.c_str());
c_data->cover_art_mem = cover_art_mem;
c_data->cover_art_mem_size = cover_art_mem_size;
}

Expand All @@ -292,7 +290,6 @@ struct IFC_KODI_ADDON_AUDIODECODER_INFO_TAG
std::string comment;
std::string cover_art_path;
std::string cover_art_mem_mimetype;
uint8_t* cover_art_mem;
size_t cover_art_mem_size;

MSGPACK_DEFINE(title,
Expand All @@ -314,7 +311,6 @@ struct IFC_KODI_ADDON_AUDIODECODER_INFO_TAG
comment,
cover_art_path,
cover_art_mem_mimetype,
cover_art_mem,
cover_art_mem_size);
};
/*---AUTO_GEN_PARSE<DATA_STRUCTURES_END>---*/
Expand Down
1 change: 1 addition & 0 deletions xbmc/filesystem/FileDirectoryFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "addons/AddonManager.h"
#include "addons/AudioDecoder.h"
#include "addons/VFSEntry.h"
#include "addons/interface/api/addon-instance/audiodecoder.h"
#include "playlists/PlayListFactory.h"
#include "playlists/SmartPlayList.h"
#include "utils/StringUtils.h"
Expand Down
1 change: 1 addition & 0 deletions xbmc/games/addons/input/GameClientController.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "addons/kodi-dev-kit/include/kodi/c-api/addon-instance/game.h"
#include "games/controllers/ControllerTypes.h"

#include <string>
#include <vector>

namespace KODI
Expand Down
14 changes: 5 additions & 9 deletions xbmc/pvr/addons/PVRClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,20 +875,15 @@ PVR_ERROR CPVRClient::GetChannelGroupMembers(
PVR_ERROR CPVRClient::GetProvidersAmount(int& iProviders)
{
iProviders = -1;
return DoAddonCall(__func__, [&iProviders](const AddonInstance* addon) {
return addon->toAddon->GetProvidersAmount(addon, &iProviders);
return DoAddonCall(__func__, [this, &iProviders](KODI_ADDON_PVR_HDL addon) {
return m_ifc->kodi_addoninstance_pvr_h->kodi_addon_pvr_get_providers_amount_v1(addon, &iProviders);
});
}

PVR_ERROR CPVRClient::GetProviders(CPVRProvidersContainer& providers)
{
return DoAddonCall(
__func__,
[this, &providers](const AddonInstance* addon) {
ADDON_HANDLE_STRUCT handle = {};
handle.callerAddress = this;
handle.dataAddress = &providers;
return addon->toAddon->GetProviders(addon, &handle);
return DoAddonCall(__func__, [this, &providers](KODI_ADDON_PVR_HDL addon) {
return m_ifc->kodi_addoninstance_pvr_h->kodi_addon_pvr_get_providers_v1(addon, &providers);
},
m_clientCapabilities.SupportsProviders());
}
Expand Down Expand Up @@ -1514,6 +1509,7 @@ void CPVRClient::cb_transfer_provider_entry(const KODI_ADDON_PVR_TRANSFER_HDL ha
/* transfer this entry to the internal channels group */
std::shared_ptr<CPVRProvider> transferProvider(
std::make_shared<CPVRProvider>(*provider, GetID()));
CPVRProvidersContainer* kodiProviders = static_cast<CPVRProvidersContainer*>(handle);
kodiProviders->UpdateFromClient(transferProvider);
});
}
Expand Down
5 changes: 2 additions & 3 deletions xbmc/pvr/addons/PVRClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,7 @@ class CPVRClient : public KODI::ADDONS::INTERFACE::IAddonInstanceHandler
* @param handle The handle parameter that Kodi used when requesting the channel list
* @param entry The entry to transfer to Kodi
*/
void cb_transfer_provider_entry(void* kodiInstance,
const ADDON_HANDLE handle,
void cb_transfer_provider_entry(const KODI_ADDON_PVR_TRANSFER_HDL handle,
const PVR_PROVIDER* entry);
/*---AUTO_GEN_PARSE<CB:kodi_addon_pvr_transfer_provider_entry>---*/

Expand Down Expand Up @@ -980,7 +979,7 @@ class CPVRClient : public KODI::ADDONS::INTERFACE::IAddonInstanceHandler
* @brief Request Kodi to update it's list of providers
* @param kodiInstance Pointer to Kodi's CPVRClient class
*/
void cb_trigger_provider_update(void* kodiInstance);
void cb_trigger_provider_update();
/*---AUTO_GEN_PARSE<CB:kodi_addon_pvr_trigger_provider_update>---*/

/*!
Expand Down

0 comments on commit 917420d

Please sign in to comment.