diff options
author | Alwin Esch <alwin.esch@web.de> | 2017-05-28 04:14:36 +0200 |
---|---|---|
committer | Alwin Esch <alwin.esch@web.de> | 2017-05-28 19:11:53 +0200 |
commit | c975cccac9814fc50722ac252d32eb22d7a1c27d (patch) | |
tree | ea6f66949455b443ad603cfaa865a985b2245afc | |
parent | 8bca4a3bda5450e0506662ba66c14ea83ecb31c4 (diff) |
[addons] remove libKODI_audioengine.h and his parts
This remove the libKODI_audioengine.h who becomes now done by the new
way (commit before).
8 files changed, 0 insertions, 1199 deletions
diff --git a/cmake/treedata/common/subdirs.txt b/cmake/treedata/common/subdirs.txt index e13529f12c..ac5bf3d3e3 100644 --- a/cmake/treedata/common/subdirs.txt +++ b/cmake/treedata/common/subdirs.txt @@ -2,7 +2,6 @@ xbmc xbmc xbmc/addons addons xbmc/addons/interfaces addonsBinaryInterfaces xbmc/addons/interfaces/Addon addonCallbacks_Addon -xbmc/addons/interfaces/AudioEngine addonCallbacks_AudioEngine xbmc/addons/interfaces/GUI addonCallbacks_GUI xbmc/commons commons xbmc/dbwrappers dbwrappers diff --git a/xbmc/addons/interfaces/AddonInterfaces.cpp b/xbmc/addons/interfaces/AddonInterfaces.cpp index 2f9acefe97..72357c73fd 100644 --- a/xbmc/addons/interfaces/AddonInterfaces.cpp +++ b/xbmc/addons/interfaces/AddonInterfaces.cpp @@ -28,7 +28,6 @@ #include "games/addons/GameClient.h" #include "addons/interfaces/Addon/AddonCallbacksAddon.h" -#include "addons/interfaces/AudioEngine/AddonCallbacksAudioEngine.h" #include "addons/interfaces/GUI/AddonCallbacksGUI.h" #include "addons/interfaces/GUI/AddonGUIWindow.h" #include "filesystem/SpecialProtocol.h" @@ -45,7 +44,6 @@ CAddonInterfaces::CAddonInterfaces(CAddon* addon) : m_callbacks(new AddonCB), m_addon(addon), m_helperAddOn(nullptr), - m_helperAudioEngine(nullptr), m_helperGUI(nullptr) { m_callbacks->libBasePath = strdup(CSpecialProtocol::TranslatePath("special://xbmcbinaddons").c_str()); @@ -53,8 +51,6 @@ CAddonInterfaces::CAddonInterfaces(CAddon* addon) m_callbacks->AddOnLib_RegisterMe = CAddonInterfaces::AddOnLib_RegisterMe; m_callbacks->AddOnLib_UnRegisterMe = CAddonInterfaces::AddOnLib_UnRegisterMe; - m_callbacks->AudioEngineLib_RegisterMe = CAddonInterfaces::AudioEngineLib_RegisterMe; - m_callbacks->AudioEngineLib_UnRegisterMe = CAddonInterfaces::AudioEngineLib_UnRegisterMe; m_callbacks->GUILib_RegisterMe = CAddonInterfaces::GUILib_RegisterMe; m_callbacks->GUILib_UnRegisterMe = CAddonInterfaces::GUILib_UnRegisterMe; m_callbacks->PVRLib_RegisterMe = CAddonInterfaces::PVRLib_RegisterMe; @@ -72,7 +68,6 @@ CAddonInterfaces::CAddonInterfaces(CAddon* addon) CAddonInterfaces::~CAddonInterfaces() { delete static_cast<KodiAPI::AddOn::CAddonCallbacksAddon*>(m_helperAddOn); - delete static_cast<KodiAPI::AudioEngine::CAddonCallbacksAudioEngine*>(m_helperAudioEngine); delete static_cast<KodiAPI::GUI::CAddonCallbacksGUI*>(m_helperGUI); free((char*)m_callbacks->libBasePath); @@ -107,34 +102,6 @@ void CAddonInterfaces::AddOnLib_UnRegisterMe(void *addonData, void *cbTable) delete static_cast<KodiAPI::AddOn::CAddonCallbacksAddon*>(addon->m_helperAddOn); addon->m_helperAddOn = nullptr; } - -/*\_____________________________________________________________________________ -\*/ -void* CAddonInterfaces::AudioEngineLib_RegisterMe(void *addonData) -{ - CAddonInterfaces* addon = static_cast<CAddonInterfaces*>(addonData); - if (addon == nullptr) - { - CLog::Log(LOGERROR, "CAddonInterfaces - %s - called with a null pointer", __FUNCTION__); - return nullptr; - } - - addon->m_helperAudioEngine = new KodiAPI::AudioEngine::CAddonCallbacksAudioEngine(addon->m_addon); - return static_cast<KodiAPI::AudioEngine::CAddonCallbacksAudioEngine*>(addon->m_helperAudioEngine)->GetCallbacks(); -} - -void CAddonInterfaces::AudioEngineLib_UnRegisterMe(void *addonData, void *cbTable) -{ - CAddonInterfaces* addon = static_cast<CAddonInterfaces*>(addonData); - if (addon == nullptr) - { - CLog::Log(LOGERROR, "CAddonInterfaces - %s - called with a null pointer", __FUNCTION__); - return; - } - - delete static_cast<KodiAPI::AudioEngine::CAddonCallbacksAudioEngine*>(addon->m_helperAudioEngine); - addon->m_helperAudioEngine = nullptr; -} /*\_____________________________________________________________________________ \*/ void* CAddonInterfaces::GUILib_RegisterMe(void *addonData) diff --git a/xbmc/addons/interfaces/AddonInterfaces.h b/xbmc/addons/interfaces/AddonInterfaces.h index 503838c08b..edc8b2230b 100644 --- a/xbmc/addons/interfaces/AddonInterfaces.h +++ b/xbmc/addons/interfaces/AddonInterfaces.h @@ -53,11 +53,6 @@ namespace ADDON void* AddOnLib_GetHelper() { return m_helperAddOn; } /*\_________________________________________________________________________ \*/ - static void* AudioEngineLib_RegisterMe (void* addonData); - static void AudioEngineLib_UnRegisterMe (void* addonData, void* cbTable); - void* AudioEngineLib_GetHelper() { return m_helperAudioEngine; } - /*\__________________________________________________________________________________________ - \*/ static void* GUILib_RegisterMe (void* addonData); static void GUILib_UnRegisterMe (void* addonData, void* cbTable); void* GUILib_GetHelper() { return m_helperGUI; } @@ -91,7 +86,6 @@ namespace ADDON CAddon* m_addon; void* m_helperAddOn; - void* m_helperAudioEngine; void* m_helperGUI; }; diff --git a/xbmc/addons/interfaces/AudioEngine/AddonCallbacksAudioEngine.cpp b/xbmc/addons/interfaces/AudioEngine/AddonCallbacksAudioEngine.cpp deleted file mode 100644 index 09124a12e5..0000000000 --- a/xbmc/addons/interfaces/AudioEngine/AddonCallbacksAudioEngine.cpp +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Copyright (C) 2014 Team KODI - * 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 KODI; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "system.h" -#include "AddonCallbacksAudioEngine.h" -#include "addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h" -#include "ServiceBroker.h" -#include "cores/AudioEngine/Engines/ActiveAE/ActiveAE.h" -#include "cores/AudioEngine/Interfaces/AEStream.h" -#include "cores/AudioEngine/Utils/AEChannelData.h" -#include "utils/log.h" - -using namespace ADDON; - -namespace KodiAPI -{ -namespace AudioEngine -{ - -CAddonCallbacksAudioEngine::CAddonCallbacksAudioEngine(CAddon* addon) - : m_callbacks(new CB_AudioEngineLib) -{ - // write KODI audio DSP specific add-on function addresses to callback table - m_callbacks->MakeStream = AudioEngine_MakeStream; - m_callbacks->FreeStream = AudioEngine_FreeStream; - m_callbacks->GetCurrentSinkFormat = AudioEngine_GetCurrentSinkFormat; - - // AEStream add-on function callback table - m_callbacks->AEStream_GetSpace = AEStream_GetSpace; - m_callbacks->AEStream_AddData = AEStream_AddData; - m_callbacks->AEStream_GetDelay = AEStream_GetDelay; - m_callbacks->AEStream_IsBuffering = AEStream_IsBuffering; - m_callbacks->AEStream_GetCacheTime = AEStream_GetCacheTime; - m_callbacks->AEStream_GetCacheTotal = AEStream_GetCacheTotal; - m_callbacks->AEStream_Pause = AEStream_Pause; - m_callbacks->AEStream_Resume = AEStream_Resume; - m_callbacks->AEStream_Drain = AEStream_Drain; - m_callbacks->AEStream_IsDraining = AEStream_IsDraining; - m_callbacks->AEStream_IsDrained = AEStream_IsDrained; - m_callbacks->AEStream_Flush = AEStream_Flush; - m_callbacks->AEStream_GetVolume = AEStream_GetVolume; - m_callbacks->AEStream_SetVolume = AEStream_SetVolume; - m_callbacks->AEStream_GetAmplification = AEStream_GetAmplification; - m_callbacks->AEStream_SetAmplification = AEStream_SetAmplification; - m_callbacks->AEStream_GetFrameSize = AEStream_GetFrameSize; - m_callbacks->AEStream_GetChannelCount = AEStream_GetChannelCount; - m_callbacks->AEStream_GetSampleRate = AEStream_GetSampleRate; - m_callbacks->AEStream_GetDataFormat = AEStream_GetDataFormat; - m_callbacks->AEStream_GetResampleRatio = AEStream_GetResampleRatio; - m_callbacks->AEStream_SetResampleRatio = AEStream_SetResampleRatio; -} - -AEStreamHandle* CAddonCallbacksAudioEngine::AudioEngine_MakeStream(AudioEngineFormat StreamFormat, unsigned int Options) -{ - AEAudioFormat format; - format.m_dataFormat = StreamFormat.m_dataFormat; - format.m_sampleRate = StreamFormat.m_sampleRate; - format.m_channelLayout = StreamFormat.m_channels; - return CServiceBroker::GetActiveAE().MakeStream(format, Options); -} - -void CAddonCallbacksAudioEngine::AudioEngine_FreeStream(AEStreamHandle *StreamHandle) -{ - if (!StreamHandle) - { - CLog::Log(LOGERROR, "CAddonCallbacksAudioEngine - %s - invalid stream data", __FUNCTION__); - return; - } - - CServiceBroker::GetActiveAE().FreeStream(reinterpret_cast<IAEStream*>(StreamHandle)); -} - -bool CAddonCallbacksAudioEngine::AudioEngine_GetCurrentSinkFormat(void *AddonData, AudioEngineFormat *SinkFormat) -{ - if (!AddonData || !SinkFormat) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid input data!", __FUNCTION__); - return false; - } - - AEAudioFormat AESinkFormat; - if (!CServiceBroker::GetActiveAE().GetCurrentSinkFormat(AESinkFormat)) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - failed to get current sink format from AE!", __FUNCTION__); - return false; - } - - SinkFormat->m_channelCount = AESinkFormat.m_channelLayout.Count(); - for (unsigned int ch = 0; ch < SinkFormat->m_channelCount; ch++) - { - SinkFormat->m_channels[ch] = AESinkFormat.m_channelLayout[ch]; - } - - SinkFormat->m_dataFormat = AESinkFormat.m_dataFormat; - SinkFormat->m_sampleRate = AESinkFormat.m_sampleRate; - SinkFormat->m_frames = AESinkFormat.m_frames; - SinkFormat->m_frameSize = AESinkFormat.m_frameSize; - - return true; -} - -CAddonCallbacksAudioEngine::~CAddonCallbacksAudioEngine() -{ - /* delete the callback table */ - delete m_callbacks; -} - -unsigned int CAddonCallbacksAudioEngine::AEStream_GetSpace(void *AddonData, AEStreamHandle *StreamHandle) -{ - if (!AddonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return 0; - } - - return ((IAEStream*)StreamHandle)->GetSpace(); -} - -unsigned int CAddonCallbacksAudioEngine::AEStream_AddData(void *AddonData, AEStreamHandle *StreamHandle, uint8_t* const *Data, unsigned int Offset, unsigned int Frames) -{ - if (!AddonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return 0; - } - - return ((IAEStream*)StreamHandle)->AddData(Data, Offset, Frames); -} - -double CAddonCallbacksAudioEngine::AEStream_GetDelay(void *AddonData, AEStreamHandle *StreamHandle) -{ - if (!AddonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return -1.0; - } - - return ((IAEStream*)StreamHandle)->GetDelay(); -} - -bool CAddonCallbacksAudioEngine::AEStream_IsBuffering(void *AddonData, AEStreamHandle *StreamHandle) -{ - if (!AddonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return false; - } - - return ((IAEStream*)StreamHandle)->IsBuffering(); -} - -double CAddonCallbacksAudioEngine::AEStream_GetCacheTime(void *AddonData, AEStreamHandle *StreamHandle) -{ - if (!AddonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return -1.0; - } - - return ((IAEStream*)StreamHandle)->GetCacheTime(); -} - -double CAddonCallbacksAudioEngine::AEStream_GetCacheTotal(void *AddonData, AEStreamHandle *StreamHandle) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return -1.0; - } - - return ((IAEStream*)StreamHandle)->GetCacheTotal(); -} - -void CAddonCallbacksAudioEngine::AEStream_Pause(void *AddonData, AEStreamHandle *StreamHandle) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return; - } - - ((IAEStream*)StreamHandle)->Pause(); -} - -void CAddonCallbacksAudioEngine::AEStream_Resume(void *AddonData, AEStreamHandle *StreamHandle) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return; - } - - ((IAEStream*)StreamHandle)->Resume(); -} - -void CAddonCallbacksAudioEngine::AEStream_Drain(void *AddonData, AEStreamHandle *StreamHandle, bool Wait) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return; - } - - ((IAEStream*)StreamHandle)->Drain(Wait); -} - -bool CAddonCallbacksAudioEngine::AEStream_IsDraining(void *AddonData, AEStreamHandle *StreamHandle) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return false; - } - - return ((IAEStream*)StreamHandle)->IsDraining(); -} - -bool CAddonCallbacksAudioEngine::AEStream_IsDrained(void *AddonData, AEStreamHandle *StreamHandle) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return false; - } - - return ((IAEStream*)StreamHandle)->IsDrained(); -} - -void CAddonCallbacksAudioEngine::AEStream_Flush(void *AddonData, AEStreamHandle *StreamHandle) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return; - } - - ((IAEStream*)StreamHandle)->Flush(); -} - -float CAddonCallbacksAudioEngine::AEStream_GetVolume(void *AddonData, AEStreamHandle *StreamHandle) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return -1.0f; - } - - return ((IAEStream*)StreamHandle)->GetVolume(); -} - -void CAddonCallbacksAudioEngine::AEStream_SetVolume(void *AddonData, AEStreamHandle *StreamHandle, float Volume) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return; - } - - ((IAEStream*)StreamHandle)->SetVolume(Volume); -} - -float CAddonCallbacksAudioEngine::AEStream_GetAmplification(void *AddonData, AEStreamHandle *StreamHandle) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return -1.0f; - } - - return ((IAEStream*)StreamHandle)->GetAmplification(); -} - -void CAddonCallbacksAudioEngine::AEStream_SetAmplification(void *AddonData, AEStreamHandle *StreamHandle, float Amplify) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return; - } - - ((IAEStream*)StreamHandle)->SetAmplification(Amplify); -} - -const unsigned int CAddonCallbacksAudioEngine::AEStream_GetFrameSize(void *AddonData, AEStreamHandle *StreamHandle) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return 0; - } - - return ((IAEStream*)StreamHandle)->GetFrameSize(); -} - -const unsigned int CAddonCallbacksAudioEngine::AEStream_GetChannelCount(void *AddonData, AEStreamHandle *StreamHandle) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return 0; - } - - return ((IAEStream*)StreamHandle)->GetChannelCount(); -} - -const unsigned int CAddonCallbacksAudioEngine::AEStream_GetSampleRate(void *AddonData, AEStreamHandle *StreamHandle) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return 0; - } - - return ((IAEStream*)StreamHandle)->GetSampleRate(); -} - -const AEDataFormat CAddonCallbacksAudioEngine::AEStream_GetDataFormat(void *AddonData, AEStreamHandle *StreamHandle) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return AE_FMT_INVALID; - } - - return ((IAEStream*)StreamHandle)->GetDataFormat(); -} - -double CAddonCallbacksAudioEngine::AEStream_GetResampleRatio(void *AddonData, AEStreamHandle *StreamHandle) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return -1.0f; - } - - return ((IAEStream*)StreamHandle)->GetResampleRatio(); -} - -void CAddonCallbacksAudioEngine::AEStream_SetResampleRatio(void *AddonData, AEStreamHandle *StreamHandle, double Ratio) -{ - // prevent compiler warnings - void *addonData = AddonData; - if (!addonData || !StreamHandle) - { - CLog::Log(LOGERROR, "libKODI_audioengine - %s - invalid stream data", __FUNCTION__); - return; - } - - ((IAEStream*)StreamHandle)->SetResampleRatio(Ratio); -} - -} /* namespace AudioEngine */ -} /* namespace KodiAPI */ diff --git a/xbmc/addons/interfaces/AudioEngine/AddonCallbacksAudioEngine.h b/xbmc/addons/interfaces/AudioEngine/AddonCallbacksAudioEngine.h deleted file mode 100644 index f0820d3f89..0000000000 --- a/xbmc/addons/interfaces/AudioEngine/AddonCallbacksAudioEngine.h +++ /dev/null @@ -1,209 +0,0 @@ -#pragma once -/* - * Copyright (C) 2014-2016 Team KODI - * 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 KODI; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "addons/interfaces/AddonInterfaces.h" -#include "addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h" -#include "addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h" - -namespace KodiAPI -{ -namespace AudioEngine -{ - -/*! - * Callbacks for Kodi's AudioEngine. - */ -class CAddonCallbacksAudioEngine -{ -public: - CAddonCallbacksAudioEngine(ADDON::CAddon* Addon); - virtual ~CAddonCallbacksAudioEngine(); - - /*! - * @return The callback table. - */ - CB_AudioEngineLib *GetCallbacks() { return m_callbacks; } - - /** - * Creates and returns a new handle to an IAEStream in the format specified, this function should never fail - * @param audioFormat - * @param options A bit field of stream options (see: enum AEStreamOptions) - * @return a new Handle to an IAEStream that will accept data in the requested format - */ - static AEStreamHandle* AudioEngine_MakeStream(AudioEngineFormat StreamFormat, unsigned int Options); - - /** - * This method will remove the specifyed stream from the engine. - * For OSX/IOS this is essential to reconfigure the audio output. - * @param stream The stream to be altered - * @return NULL - */ - static void AudioEngine_FreeStream(AEStreamHandle *StreamHandle); - - /** - * Get the current sink data format - * - * @param Current sink data format. For more details see AudioEngineFormat. - * @return Returns true on success, else false. - */ - static bool AudioEngine_GetCurrentSinkFormat(void *AddonData, AudioEngineFormat *SinkFormat); - - /** - * Returns the amount of space available in the stream - * @return The number of bytes AddData will consume - */ - static unsigned int AEStream_GetSpace(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Add planar or interleaved PCM data to the stream - * @param data array of pointers to the planes - * @param offset to frame in frames - * @param frames number of frames - * @param pts timestamp - * @return The number of frames consumed - */ - static unsigned int AEStream_AddData(void *AddonData, AEStreamHandle *StreamHandle, uint8_t* const *Data, unsigned int Offset, unsigned int Frames); - - /** - * Returns the time in seconds that it will take - * for the next added packet to be heard from the speakers. - * @return seconds - */ - static double AEStream_GetDelay(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Returns if the stream is buffering - * @return True if the stream is buffering - */ - static bool AEStream_IsBuffering(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Returns the time in seconds that it will take - * to underrun the cache if no sample is added. - * @return seconds - */ - static double AEStream_GetCacheTime(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Returns the total time in seconds of the cache - * @return seconds - */ - static double AEStream_GetCacheTotal(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Pauses the stream playback - */ - static void AEStream_Pause(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Resumes the stream after pausing - */ - static void AEStream_Resume(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Start draining the stream - * @note Once called AddData will not consume more data. - */ - static void AEStream_Drain(void *AddonData, AEStreamHandle *StreamHandle, bool Wait); - - /** - * Returns true if the is stream draining - */ - static bool AEStream_IsDraining(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Returns true if the is stream has finished draining - */ - static bool AEStream_IsDrained(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Flush all buffers dropping the audio data - */ - static void AEStream_Flush(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Return the stream's current volume level - * @return The volume level between 0.0 and 1.0 - */ - static float AEStream_GetVolume(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Set the stream's volume level - * @param volume The new volume level between 0.0 and 1.0 - */ - static void AEStream_SetVolume(void *AddonData, AEStreamHandle *StreamHandle, float Volume); - - /** - * Gets the stream's volume amplification in linear units. - * @return The volume amplification factor between 1.0 and 1000.0 - */ - static float AEStream_GetAmplification(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Sets the stream's volume amplification in linear units. - * @param The volume amplification factor between 1.0 and 1000.0 - */ - static void AEStream_SetAmplification(void *AddonData, AEStreamHandle *StreamHandle, float Amplify); - - /** - * Returns the size of one audio frame in bytes (channelCount * resolution) - * @return The size in bytes of one frame - */ - static const unsigned int AEStream_GetFrameSize(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Returns the number of channels the stream is configured to accept - * @return The channel count - */ - static const unsigned int AEStream_GetChannelCount(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Returns the stream's sample rate, if the stream is using a dynamic sample rate, this value will NOT reflect any changes made by calls to SetResampleRatio() - * @return The stream's sample rate (eg, 48000) - */ - static const unsigned int AEStream_GetSampleRate(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Return the data format the stream has been configured with - * @return The stream's data format (eg, AE_FMT_S16LE) - */ - static const AEDataFormat AEStream_GetDataFormat(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Return the resample ratio - * @note This will return an undefined value if the stream is not resampling - * @return the current resample ratio or undefined if the stream is not resampling - */ - static double AEStream_GetResampleRatio(void *AddonData, AEStreamHandle *StreamHandle); - - /** - * Sets the resample ratio - * @note This function may return false if the stream is not resampling, if you wish to use this be sure to set the AESTREAM_FORCE_RESAMPLE option - * @param ratio the new sample rate ratio, calculated by ((double)desiredRate / (double)GetSampleRate()) - */ - static void AEStream_SetResampleRatio(void *AddonData, AEStreamHandle *StreamHandle, double Ratio); - -private: - CB_AudioEngineLib *m_callbacks; /*!< callback addresses */ -}; - -} /* namespace AudioEngine */ -} /* namespace KodiAPI */ diff --git a/xbmc/addons/interfaces/AudioEngine/CMakeLists.txt b/xbmc/addons/interfaces/AudioEngine/CMakeLists.txt deleted file mode 100644 index 0c42add3df..0000000000 --- a/xbmc/addons/interfaces/AudioEngine/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(SOURCES AddonCallbacksAudioEngine.cpp) - -set(HEADERS AddonCallbacksAudioEngine.h) - -core_add_library(addonInterface_AudioEngine) diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h deleted file mode 100644 index db99e6857b..0000000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h +++ /dev/null @@ -1,156 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2015 Team Kodi - * 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 Kodi; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -/*! - * Common data structures shared between KODI and KODI's binary add-ons - */ - -#ifdef BUILD_KODI_ADDON - #include "kodi/AudioEngine/AEChannelInfo.h" -#else - #include "cores/AudioEngine/Utils/AEChannelInfo.h" -#endif - -#ifndef TARGET_WINDOWS -#ifndef __cdecl -#define __cdecl -#endif -#ifndef __declspec -#define __declspec(X) -#endif -#endif - -#include <cstddef> - -#undef ATTRIBUTE_PACKED -#undef PRAGMA_PACK_BEGIN -#undef PRAGMA_PACK_END - -#if defined(__GNUC__) -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -#define ATTRIBUTE_PACKED __attribute__ ((packed)) -#define PRAGMA_PACK 0 -#endif -#endif - -#if !defined(ATTRIBUTE_PACKED) -#define ATTRIBUTE_PACKED -#define PRAGMA_PACK 1 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - /** - * A stream handle pointer, which is only used internally by the addon stream handle - */ - typedef void AEStreamHandle; - - /** - * The audio format structure that fully defines a stream's audio information - */ - typedef struct AudioEngineFormat - { - /** - * The stream's data format (eg, AE_FMT_S16LE) - */ - enum AEDataFormat m_dataFormat; - - /** - * The stream's sample rate (eg, 48000) - */ - unsigned int m_sampleRate; - - /** - * The encoded streams sample rate if a bitstream, otherwise undefined - */ - unsigned int m_encodedRate; - - /** - * The amount of used speaker channels - */ - unsigned int m_channelCount; - - /** - * The stream's channel layout - */ - enum AEChannel m_channels[AE_CH_MAX]; - - /** - * The number of frames per period - */ - unsigned int m_frames; - - /** - * The size of one frame in bytes - */ - unsigned int m_frameSize; - - AudioEngineFormat() - { - m_dataFormat = AE_FMT_INVALID; - m_sampleRate = 0; - m_encodedRate = 0; - m_frames = 0; - m_frameSize = 0; - m_channelCount = 0; - - for (unsigned int ch = 0; ch < AE_CH_MAX; ch++) - { - m_channels[ch] = AE_CH_NULL; - } - } - - bool compareFormat(const AudioEngineFormat *fmt) - { - if (!fmt) - { - return false; - } - - if (m_dataFormat != fmt->m_dataFormat || - m_sampleRate != fmt->m_sampleRate || - m_encodedRate != fmt->m_encodedRate || - m_frames != fmt->m_frames || - m_frameSize != fmt->m_frameSize || - m_channelCount != fmt->m_channelCount) - { - return false; - } - - for (unsigned int ch = 0; ch < AE_CH_MAX; ch++) - { - if (fmt->m_channels[ch] != m_channels[ch]) - { - return false; - } - } - - return true; - } - } AudioEngineFormat; - -#ifdef __cplusplus -} -#endif - diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h deleted file mode 100644 index 1269398a5a..0000000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h +++ /dev/null @@ -1,387 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2014 Team KODI - * 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 KODI; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string> -#include <string.h> -#include <vector> - -#include "kodi_audioengine_types.h" -#ifdef BUILD_KODI_ADDON - #include "kodi/AudioEngine/AEChannelData.h" - #include "kodi/AudioEngine/AEChannelInfo.h" - #include "kodi/AudioEngine/AEStreamData.h" -#else - #include "cores/AudioEngine/Utils/AEChannelData.h" - #include "cores/AudioEngine/Utils/AEChannelInfo.h" - #include "cores/AudioEngine/Utils/AEStreamData.h" -#endif - -#include "libXBMC_addon.h" - -extern "C" -{ -namespace KodiAPI -{ -namespace AudioEngine -{ - -typedef struct CB_AudioEngineLib -{ - AEStreamHandle* (*MakeStream) (AudioEngineFormat Format, unsigned int Options); - void (*FreeStream) (AEStreamHandle *stream); - bool (*GetCurrentSinkFormat) (void *addonData, AudioEngineFormat *SinkFormat); - - // Audio Engine Stream definitions - unsigned int (*AEStream_GetSpace) (void *addonData, AEStreamHandle *handle); - unsigned int (*AEStream_AddData) (void *addonData, AEStreamHandle *handle, uint8_t* const *Data, unsigned int Offset, unsigned int Frames); - double (*AEStream_GetDelay)(void *addonData, AEStreamHandle *handle); - bool (*AEStream_IsBuffering)(void *addonData, AEStreamHandle *handle); - double (*AEStream_GetCacheTime)(void *addonData, AEStreamHandle *handle); - double (*AEStream_GetCacheTotal)(void *addonData, AEStreamHandle *handle); - void (*AEStream_Pause)(void *addonData, AEStreamHandle *handle); - void (*AEStream_Resume)(void *addonData, AEStreamHandle *handle); - void (*AEStream_Drain)(void *addonData, AEStreamHandle *handle, bool Wait); - bool (*AEStream_IsDraining)(void *addonData, AEStreamHandle *handle); - bool (*AEStream_IsDrained)(void *addonData, AEStreamHandle *handle); - void (*AEStream_Flush)(void *addonData, AEStreamHandle *handle); - float (*AEStream_GetVolume)(void *addonData, AEStreamHandle *handle); - void (*AEStream_SetVolume)(void *addonData, AEStreamHandle *handle, float Volume); - float (*AEStream_GetAmplification)(void *addonData, AEStreamHandle *handle); - void (*AEStream_SetAmplification)(void *addonData, AEStreamHandle *handle, float Amplify); - const unsigned int (*AEStream_GetFrameSize)(void *addonData, AEStreamHandle *handle); - const unsigned int (*AEStream_GetChannelCount)(void *addonData, AEStreamHandle *handle); - const unsigned int (*AEStream_GetSampleRate)(void *addonData, AEStreamHandle *handle); - const AEDataFormat (*AEStream_GetDataFormat)(void *addonData, AEStreamHandle *handle); - double (*AEStream_GetResampleRatio)(void *addonData, AEStreamHandle *handle); - void (*AEStream_SetResampleRatio)(void *addonData, AEStreamHandle *handle, double Ratio); -} CB_AudioEngineLib; - -} /* namespace AudioEngine */ -} /* namespace KodiAPI */ -} /* extern "C" */ - - -// Audio Engine Stream Class -class CAddonAEStream -{ -public: - CAddonAEStream(AddonCB* addon, KodiAPI::AudioEngine::CB_AudioEngineLib* callbacks, AEStreamHandle* streamHandle) - : m_Handle(addon), - m_cb(callbacks), - m_StreamHandle(streamHandle) {} - - ~CAddonAEStream() - { - if (m_StreamHandle) - { - m_cb->FreeStream(m_StreamHandle); - m_StreamHandle = nullptr; - } - } - - /** - * Returns the amount of space available in the stream - * @return The number of bytes AddData will consume - */ - unsigned int GetSpace() - { - return m_cb->AEStream_GetSpace(m_Handle->addonData, m_StreamHandle); - } - - /** - * Add planar or interleaved PCM data to the stream - * @param Data array of pointers to the planes - * @param Offset to frame in frames - * @param Frames number of frames - * @return The number of frames consumed - */ - unsigned int AddData(uint8_t* const *Data, unsigned int Offset, unsigned int Frames) - { - return m_cb->AEStream_AddData(m_Handle->addonData, m_StreamHandle, Data, Offset, Frames); - } - - /** - * Returns the time in seconds that it will take - * for the next added packet to be heard from the speakers. - * @return seconds - */ - double GetDelay() - { - return m_cb->AEStream_GetDelay(m_Handle->addonData, m_StreamHandle); - } - - /** - * Returns if the stream is buffering - * @return True if the stream is buffering - */ - bool IsBuffering() - { - return m_cb->AEStream_IsBuffering(m_Handle->addonData, m_StreamHandle); - } - - /** - * Returns the time in seconds of the stream's - * cached audio samples. Engine buffers excluded. - * @return seconds - */ - double GetCacheTime() - { - return m_cb->AEStream_GetCacheTime(m_Handle->addonData, m_StreamHandle); - } - - /** - * Returns the total time in seconds of the cache - * @return seconds - */ - double GetCacheTotal() - { - return m_cb->AEStream_GetCacheTotal(m_Handle->addonData, m_StreamHandle); - } - - /** - * Pauses the stream playback - */ - void Pause() - { - return m_cb->AEStream_Pause(m_Handle->addonData, m_StreamHandle); - } - - /** - * Resumes the stream after pausing - */ - void Resume() - { - return m_cb->AEStream_Resume(m_Handle->addonData, m_StreamHandle); - } - - /** - * Start draining the stream - * @note Once called AddData will not consume more data. - */ - void Drain(bool Wait) - { - return m_cb->AEStream_Drain(m_Handle->addonData, m_StreamHandle, Wait); - } - - /** - * Returns true if the is stream draining - */ - bool IsDraining() - { - return m_cb->AEStream_IsDraining(m_Handle->addonData, m_StreamHandle); - } - - /** - * Returns true if the is stream has finished draining - */ - bool IsDrained() - { - return m_cb->AEStream_IsDrained(m_Handle->addonData, m_StreamHandle); - } - - /** - * Flush all buffers dropping the audio data - */ - void Flush() - { - return m_cb->AEStream_Flush(m_Handle->addonData, m_StreamHandle); - } - - /** - * Return the stream's current volume level - * @return The volume level between 0.0 and 1.0 - */ - float GetVolume() - { - return m_cb->AEStream_GetVolume(m_Handle->addonData, m_StreamHandle); - } - - /** - * Set the stream's volume level - * @param volume The new volume level between 0.0 and 1.0 - */ - void SetVolume(float Volume) - { - return m_cb->AEStream_SetVolume(m_Handle->addonData, m_StreamHandle, Volume); - } - - /** - * Gets the stream's volume amplification in linear units. - * @return The volume amplification factor between 1.0 and 1000.0 - */ - float GetAmplification() - { - return m_cb->AEStream_GetAmplification(m_Handle->addonData, m_StreamHandle); - } - - /** - * Sets the stream's volume amplification in linear units. - * @param The volume amplification factor between 1.0 and 1000.0 - */ - void SetAmplification(float Amplify) - { - return m_cb->AEStream_SetAmplification(m_Handle->addonData, m_StreamHandle, Amplify); - } - - /** - * Returns the size of one audio frame in bytes (channelCount * resolution) - * @return The size in bytes of one frame - */ - const unsigned int GetFrameSize() const - { - return m_cb->AEStream_GetFrameSize(m_Handle->addonData, m_StreamHandle); - } - - /** - * Returns the number of channels the stream is configured to accept - * @return The channel count - */ - const unsigned int GetChannelCount() const - { - return m_cb->AEStream_GetChannelCount(m_Handle->addonData, m_StreamHandle); - } - - /** - * Returns the stream's sample rate, if the stream is using a dynamic sample rate, this value will NOT reflect any changes made by calls to SetResampleRatio() - * @return The stream's sample rate (eg, 48000) - */ - const unsigned int GetSampleRate() const - { - return m_cb->AEStream_GetSampleRate(m_Handle->addonData, m_StreamHandle); - } - - /** - * Return the data format the stream has been configured with - * @return The stream's data format (eg, AE_FMT_S16LE) - */ - const AEDataFormat GetDataFormat() const - { - return m_cb->AEStream_GetDataFormat(m_Handle->addonData, m_StreamHandle); - } - - /** - * Return the resample ratio - * @note This will return an undefined value if the stream is not resampling - * @return the current resample ratio or undefined if the stream is not resampling - */ - double GetResampleRatio() - { - return m_cb->AEStream_GetResampleRatio(m_Handle->addonData, m_StreamHandle); - } - - /** - * Sets the resample ratio - * @note This function may return false if the stream is not resampling, if you wish to use this be sure to set the AESTREAM_FORCE_RESAMPLE option - * @param ratio the new sample rate ratio, calculated by ((double)desiredRate / (double)GetSampleRate()) - */ - void SetResampleRatio(double Ratio) - { - m_cb->AEStream_SetResampleRatio(m_Handle->addonData, m_StreamHandle, Ratio); - } - -private: - AddonCB* m_Handle; - KodiAPI::AudioEngine::CB_AudioEngineLib *m_cb; - AEStreamHandle *m_StreamHandle; -}; - -class CHelper_libKODI_audioengine -{ -public: - CHelper_libKODI_audioengine(void) - { - m_Handle = nullptr; - m_Callbacks = nullptr; - } - - ~CHelper_libKODI_audioengine(void) - { - if (m_Handle && m_Callbacks) - { - m_Handle->AudioEngineLib_UnRegisterMe(m_Handle->addonData, m_Callbacks); - } - } - - /*! - * @brief Resolve all callback methods - * @param handle Pointer to the add-on - * @return True when all methods were resolved, false otherwise. - */ - bool RegisterMe(void* handle) - { - m_Handle = static_cast<AddonCB*>(handle); - if (m_Handle) - m_Callbacks = (KodiAPI::AudioEngine::CB_AudioEngineLib*)m_Handle->AudioEngineLib_RegisterMe(m_Handle->addonData); - if (!m_Callbacks) - fprintf(stderr, "libKODI_audioengine-ERROR: AudioEngineLib_RegisterMe can't get callback table from Kodi !!!\n"); - - return m_Callbacks != nullptr; - } - - /** - * Creates and returns a new handle to an IAEStream in the format specified, this function should never fail - * @param DataFormat The data format the incoming audio will be in (eg, AE_FMT_S16LE) - * @param SampleRate The sample rate of the audio data (eg, 48000) - * @param ChannelLayout The order of the channels in the audio data - * @param Options A bit field of stream options (see: enum AEStreamOptions) - * @return a new Handle to an IAEStream that will accept data in the requested format - */ - CAddonAEStream* MakeStream(AudioEngineFormat Format, unsigned int Options = 0) - { - AEStreamHandle *streamHandle = m_Callbacks->MakeStream(Format, Options); - if (!streamHandle) - { - fprintf(stderr, "libKODI_audioengine-ERROR: AudioEngine_make_stream MakeStream failed!\n"); - return nullptr; - } - - return new CAddonAEStream(m_Handle, m_Callbacks, streamHandle); - } - - /** - * This method will remove the specifyed stream from the engine. - * For OSX/IOS this is essential to reconfigure the audio output. - * @param stream The stream to be altered - * @return NULL - */ - void FreeStream(CAddonAEStream **Stream) - { - delete *Stream; - *Stream = nullptr; - } - - /** - * Get the current sink data format - * - * @param Current sink data format. For more details see AudioEngineFormat. - * @return Returns true on success, else false. - */ - bool GetCurrentSinkFormat(AudioEngineFormat &SinkFormat) - { - return m_Callbacks->GetCurrentSinkFormat(m_Handle->addonData, &SinkFormat); - } - -private: - AddonCB* m_Handle; - KodiAPI::AudioEngine::CB_AudioEngineLib *m_Callbacks; -}; |