diff options
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | Makefile.include.in | 1 | ||||
-rw-r--r-- | addons/library.kodi.adsp/.gitignore | 4 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | lib/addons/library.kodi.adsp/CMakeLists.txt | 2 | ||||
-rw-r--r-- | lib/addons/library.kodi.adsp/Makefile.in | 29 | ||||
-rw-r--r-- | lib/addons/library.kodi.adsp/libKODI_adsp.cpp | 175 | ||||
-rw-r--r-- | lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj | 84 | ||||
-rw-r--r-- | lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj.filters | 18 | ||||
-rw-r--r-- | project/cmake/installdata/common/addons.txt | 1 | ||||
-rw-r--r-- | project/cmake/treedata/common/addons.txt | 1 | ||||
-rw-r--r-- | xbmc/addons/binary/interfaces/api1/AudioDSP/AddonCallbacksAudioDSP.h | 33 | ||||
-rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h | 259 |
14 files changed, 147 insertions, 468 deletions
diff --git a/.gitignore b/.gitignore index 913628d4b4..79df3bdeda 100644 --- a/.gitignore +++ b/.gitignore @@ -148,14 +148,11 @@ cmake_install.cmake /lib/addons/library.kodi.guilib/project/VS2010Express/Release /lib/addons/library.kodi.guilib/project/VS2010Express/Debug /lib/addons/library.xbmc.addon/Makefile -/lib/addons/library.kodi.adsp/Makefile /lib/addons/library.xbmc.codec/Makefile /lib/addons/library.kodi.peripheral/Makefile /lib/addons/library.kodi.game/Makefile /lib/addons/library.xbmc.addon/project/VS2010Express/Release /lib/addons/library.xbmc.addon/project/VS2010Express/Debug -/lib/addons/library.kodi.adsp/project/VS2010Express/Release -/lib/addons/library.kodi.adsp/project/VS2010Express/Debug /lib/addons/library.xbmc.codec/project/VS2010Express/Release /lib/addons/library.xbmc.codec/project/VS2010Express/Debug /lib/addons/library.kodi.audioengine/Makefile @@ -540,8 +537,6 @@ lib/cpluff/stamp-h1 /addons/library.xbmc.addon/libXBMC_addon.dll /addons/library.xbmc.addon/libXBMC_addon.lib -/addons/library.kodi.adsp/libKODI_adsp.dll -/addons/library.kodi.adsp/libKODI_adsp.lib /addons/library.xbmc.codec/libXBMC_codec.dll /addons/library.xbmc.codec/libXBMC_codec.lib /addons/library.kodi.guilib/libKODI_guilib.dll diff --git a/Makefile.in b/Makefile.in index 819e70d919..ccb89f6842 100644 --- a/Makefile.in +++ b/Makefile.in @@ -237,7 +237,6 @@ LIB_DIRS=\ LIBADDON_DIRS=\ lib/addons/library.xbmc.addon \ - lib/addons/library.kodi.adsp \ lib/addons/library.kodi.audioengine \ lib/addons/library.xbmc.codec \ lib/addons/library.kodi.guilib \ @@ -360,7 +359,6 @@ dllloader: exports xbmc/cores/DllLoader/dllloader.a libaddon: exports $(MAKE) -C lib/addons/library.xbmc.addon - $(MAKE) -C lib/addons/library.kodi.adsp $(MAKE) -C lib/addons/library.kodi.audioengine $(MAKE) -C lib/addons/library.xbmc.codec $(MAKE) -C lib/addons/library.kodi.game diff --git a/Makefile.include.in b/Makefile.include.in index f686f903ad..6c6a184929 100644 --- a/Makefile.include.in +++ b/Makefile.include.in @@ -43,7 +43,6 @@ INCLUDES+=-I@abs_top_srcdir@/xbmc INCLUDES+=-I@abs_top_srcdir@/xbmc/addons/kodi-addon-dev-kit/include INCLUDES+=-I@abs_top_srcdir@/addons/library.kodi.guilib INCLUDES+=-I@abs_top_srcdir@/addons/library.xbmc.addon -INCLUDES+=-I@abs_top_srcdir@/addons/library.kodi.adsp INCLUDES+=-I@abs_top_srcdir@/addons/library.kodi.audioengine INCLUDES+=-I@abs_top_srcdir@/addons/library.xbmc.codec INCLUDES+=$(sort @INCLUDES@) diff --git a/addons/library.kodi.adsp/.gitignore b/addons/library.kodi.adsp/.gitignore deleted file mode 100644 index 5e7d2734cf..0000000000 --- a/addons/library.kodi.adsp/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore diff --git a/configure.ac b/configure.ac index e15090e39b..24e3ecb300 100644 --- a/configure.ac +++ b/configure.ac @@ -2192,7 +2192,6 @@ OUTPUT_FILES="Makefile \ xbmc/windowing/Makefile \ xbmc/windowing/egl/Makefile \ lib/addons/library.xbmc.addon/Makefile \ - lib/addons/library.kodi.adsp/Makefile \ lib/addons/library.kodi.audioengine/Makefile \ lib/addons/library.xbmc.codec/Makefile \ lib/addons/library.kodi.game/Makefile \ diff --git a/lib/addons/library.kodi.adsp/CMakeLists.txt b/lib/addons/library.kodi.adsp/CMakeLists.txt deleted file mode 100644 index b3fc142a73..0000000000 --- a/lib/addons/library.kodi.adsp/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(KODI_adsp) -core_add_addon_library(${PROJECT_NAME}) diff --git a/lib/addons/library.kodi.adsp/Makefile.in b/lib/addons/library.kodi.adsp/Makefile.in deleted file mode 100644 index 77b880b7b7..0000000000 --- a/lib/addons/library.kodi.adsp/Makefile.in +++ /dev/null @@ -1,29 +0,0 @@ -ARCH=@ARCH@ -INCLUDES=-I. -I../../../xbmc/addons/kodi-addon-dev-kit/include/kodi -I../../../xbmc/addons/kodi-addon-dev-kit/include -I../../../xbmc -I../../../xbmc/cores/VideoPlayer/DVDDemuxers -DEFINES+= -CXXFLAGS=-fPIC -LIBNAME=libKODI_adsp -OBJS=$(LIBNAME).o - -ifeq ($(findstring osx,$(ARCH)), osx) -LIB_SHARED=../../../addons/library.kodi.adsp/$(LIBNAME)-$(ARCH).dylib -else -LIB_SHARED=../../../addons/library.kodi.adsp/$(LIBNAME)-$(ARCH).so -endif - -all: $(LIB_SHARED) - -$(LIB_SHARED): $(OBJS) -ifeq ($(findstring osx,$(ARCH)), osx) - $(CXX) $(CXXFLAGS) $(LDFLAGS) -dynamiclib -o $@ $(OBJS) -else - $(CXX) $(CFLAGS) $(LDFLAGS) -shared -g -o $(LIB_SHARED) $(OBJS) -endif - -CLEAN_FILES = \ - $(LIB_SHARED) \ - -DISTCLEAN_FILES= \ - Makefile \ - -include ../../../Makefile.include diff --git a/lib/addons/library.kodi.adsp/libKODI_adsp.cpp b/lib/addons/library.kodi.adsp/libKODI_adsp.cpp deleted file mode 100644 index e7cbd2ea81..0000000000 --- a/lib/addons/library.kodi.adsp/libKODI_adsp.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2013-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 <stdarg.h> -#include <string> -#include "addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h" -#include "addons/binary/interfaces/api1/AudioDSP/AddonCallbacksAudioDSP.h" - -#ifdef _WIN32 -#include <windows.h> -#define DLLEXPORT __declspec(dllexport) -#else -#define DLLEXPORT -#endif - -using namespace std; -using namespace KodiAPI::V1::AudioDSP; - -extern "C" -{ - -DLLEXPORT void* ADSP_register_me(void *hdl) -{ - CB_ADSPLib *cb = NULL; - if (!hdl) - fprintf(stderr, "libKODI_adsp-ERROR: ADSPLib_register_me is called with NULL handle !!!\n"); - else - { - cb = (CB_ADSPLib*)((AddonCB*)hdl)->ADSPLib_RegisterMe(((AddonCB*)hdl)->addonData); - if (!cb) - fprintf(stderr, "libKODI_adsp-ERROR: ADSPLib_register_me can't get callback table from KODI !!!\n"); - } - return cb; -} - -DLLEXPORT void ADSP_unregister_me(void *hdl, void* cb) -{ - if (hdl && cb) - ((AddonCB*)hdl)->ADSPLib_UnRegisterMe(((AddonCB*)hdl)->addonData, (CB_ADSPLib*)cb); -} - -DLLEXPORT void ADSP_add_menu_hook(void *hdl, void* cb, AE_DSP_MENUHOOK *hook) -{ - if (cb == NULL) - return; - - ((CB_ADSPLib*)cb)->AddMenuHook(((AddonCB*)hdl)->addonData, hook); -} - -DLLEXPORT void ADSP_remove_menu_hook(void *hdl, void* cb, AE_DSP_MENUHOOK *hook) -{ - if (cb == NULL) - return; - - ((CB_ADSPLib*)cb)->RemoveMenuHook(((AddonCB*)hdl)->addonData, hook); -} - -DLLEXPORT void ADSP_register_mode(void *hdl, void* cb, AE_DSP_MODES::AE_DSP_MODE *mode) -{ - if (cb == NULL) - return; - - ((CB_ADSPLib*)cb)->RegisterMode(((AddonCB*)hdl)->addonData, mode); -} - -DLLEXPORT void ADSP_unregister_mode(void *hdl, void* cb, AE_DSP_MODES::AE_DSP_MODE *mode) -{ - if (cb == NULL) - return; - - ((CB_ADSPLib*)cb)->UnregisterMode(((AddonCB*)hdl)->addonData, mode); -} - -///------------------------------------- -/// CAddonSoundPlay - -DLLEXPORT CAddonSoundPlay* ADSP_get_sound_play(void *hdl, void *cb, const char *filename) -{ - return new CAddonSoundPlay(hdl, cb, filename); -} - -DLLEXPORT void ADSP_release_sound_play(CAddonSoundPlay* p) -{ - delete p; -} - -CAddonSoundPlay::CAddonSoundPlay(void *hdl, void *cb, const char *filename) - : m_Filename(filename), - m_Handle(hdl), - m_cb(cb) -{ - m_PlayHandle = NULL; - if (!hdl || !cb) - fprintf(stderr, "libKODI_adsp-ERROR: ADSP_get_sound_play is called with NULL handle !!!\n"); - else - { - m_PlayHandle = ((CB_ADSPLib*)m_cb)->SoundPlay_GetHandle(((AddonCB*)m_Handle)->addonData, m_Filename.c_str()); - if (!m_PlayHandle) - fprintf(stderr, "libKODI_adsp-ERROR: ADSP_get_sound_play can't get callback table from KODI !!!\n"); - } -} - -CAddonSoundPlay::~CAddonSoundPlay() -{ - if (m_PlayHandle) - ((CB_ADSPLib*)m_cb)->SoundPlay_ReleaseHandle(((AddonCB*)m_Handle)->addonData, m_PlayHandle); -} - -void CAddonSoundPlay::Play() -{ - if (m_PlayHandle) - ((CB_ADSPLib*)m_cb)->SoundPlay_Play(((AddonCB*)m_Handle)->addonData, m_PlayHandle); -} - -void CAddonSoundPlay::Stop() -{ - if (m_PlayHandle) - ((CB_ADSPLib*)m_cb)->SoundPlay_Stop(((AddonCB*)m_Handle)->addonData, m_PlayHandle); -} - -bool CAddonSoundPlay::IsPlaying() -{ - if (!m_PlayHandle) - return false; - - return ((CB_ADSPLib*)m_cb)->SoundPlay_IsPlaying(((AddonCB*)m_Handle)->addonData, m_PlayHandle); -} - -void CAddonSoundPlay::SetChannel(AE_DSP_CHANNEL channel) -{ - if (m_PlayHandle) - ((CB_ADSPLib*)m_cb)->SoundPlay_SetChannel(((AddonCB*)m_Handle)->addonData, m_PlayHandle, channel); -} - -AE_DSP_CHANNEL CAddonSoundPlay::GetChannel() -{ - if (!m_PlayHandle) - return AE_DSP_CH_INVALID; - return ((CB_ADSPLib*)m_cb)->SoundPlay_GetChannel(((AddonCB*)m_Handle)->addonData, m_PlayHandle); -} - -void CAddonSoundPlay::SetVolume(float volume) -{ - if (m_PlayHandle) - ((CB_ADSPLib*)m_cb)->SoundPlay_SetVolume(((AddonCB*)m_Handle)->addonData, m_PlayHandle, volume); -} - -float CAddonSoundPlay::GetVolume() -{ - if (!m_PlayHandle) - return 0.0f; - - return ((CB_ADSPLib*)m_cb)->SoundPlay_GetVolume(((AddonCB*)m_Handle)->addonData, m_PlayHandle); -} - -}; diff --git a/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj b/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj deleted file mode 100644 index 12e716d968..0000000000 --- a/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj +++ /dev/null @@ -1,84 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{44F93C4D-85DD-4452-99BB-F1D196174024}</ProjectGuid> - <RootNamespace>KODI_ADSP</RootNamespace> - <Keyword>Win32Proj</Keyword> - <WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion> - </PropertyGroup> - <Import Project="$(SolutionDir)\XBMC.core-defaults.props" /> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets"> - <Import Project="$(SolutionDir)\XBMC.defaults.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\..\addons\library.kodi.adsp\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\..\addons\library.kodi.adsp\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir> - <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\..\addons\library.xbmc.addon\;$(IncludePath)</IncludePath> - <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\..\addons\library.xbmc.addon\;$(IncludePath)</IncludePath> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>..\..\..\..\..\xbmc;..\..\..\..\..\xbmc\addons\kodi-addon-dev-kit\include\kodi;..\..\..\..\..\xbmc\cores\VideoPlayer\DVDDemuxers;..\..\..\..\..\addons\library.xbmc.addon;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>VDR_EXPORTS;_WIN32PC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExceptionHandling>Sync</ExceptionHandling> - <PrecompiledHeader> - </PrecompiledHeader> - </ClCompile> - <Link> - <OutputFile>..\..\..\..\..\addons\library.kodi.adsp\$(ProjectName).dll</OutputFile> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>..\..\..\..\..\xbmc;..\..\..\..\..\xbmc\addons\kodi-addon-dev-kit\include\kodi;..\..\..\..\..\xbmc\cores\VideoPlayer\DVDDemuxers;..\..\..\..\..\addons\library.xbmc.addon;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>HAS_SDL_OPENGL;HAS_SDL;_USRDLL;XBMC_VDR_EXPORTS;_WIN32PC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExceptionHandling>Sync</ExceptionHandling> - <PrecompiledHeader> - </PrecompiledHeader> - </ClCompile> - <Link> - <OutputFile>..\..\..\..\..\addons\library.kodi.adsp\$(ProjectName).dll</OutputFile> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="..\..\libKODI_adsp.cpp" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project>
\ No newline at end of file diff --git a/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj.filters b/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj.filters deleted file mode 100644 index 03be80f3ec..0000000000 --- a/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{A463B136-5D8C-4995-A8D5-67FA2B90B6A8}</UniqueIdentifier> - <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{EAFF7342-E9A9-4164-A40A-639A72C620DA}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\libKODI_adsp.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> -</Project> diff --git a/project/cmake/installdata/common/addons.txt b/project/cmake/installdata/common/addons.txt index 5613ba7984..c6db9c131f 100644 --- a/project/cmake/installdata/common/addons.txt +++ b/project/cmake/installdata/common/addons.txt @@ -18,7 +18,6 @@ addons/xbmc.metadata/* addons/xbmc.pvr/* addons/xbmc.python/* addons/xbmc.webinterface/* -addons/library.kodi.adsp/* addons/library.kodi.audioengine/* addons/library.kodi.game/* addons/library.kodi.guilib/* diff --git a/project/cmake/treedata/common/addons.txt b/project/cmake/treedata/common/addons.txt index f29e086ebe..41167d8d20 100644 --- a/project/cmake/treedata/common/addons.txt +++ b/project/cmake/treedata/common/addons.txt @@ -1,4 +1,3 @@ -lib/addons/library.kodi.adsp KODI_adsp lib/addons/library.kodi.audioengine KODI_audioengine lib/addons/library.kodi.game KODI_game lib/addons/library.kodi.guilib KODI_guilib diff --git a/xbmc/addons/binary/interfaces/api1/AudioDSP/AddonCallbacksAudioDSP.h b/xbmc/addons/binary/interfaces/api1/AudioDSP/AddonCallbacksAudioDSP.h index ff2eabc275..525ce82168 100644 --- a/xbmc/addons/binary/interfaces/api1/AudioDSP/AddonCallbacksAudioDSP.h +++ b/xbmc/addons/binary/interfaces/api1/AudioDSP/AddonCallbacksAudioDSP.h @@ -39,39 +39,6 @@ namespace V1 namespace AudioDSP { -typedef void (*ADSPAddMenuHook)(void *addonData, AE_DSP_MENUHOOK *hook); -typedef void (*ADSPRemoveMenuHook)(void *addonData, AE_DSP_MENUHOOK *hook); -typedef void (*ADSPRegisterMode)(void *addonData, AE_DSP_MODES::AE_DSP_MODE *mode); -typedef void (*ADSPUnregisterMode)(void *addonData, AE_DSP_MODES::AE_DSP_MODE *mode); - -typedef ADSPHANDLE (*ADSPSoundPlay_GetHandle)(void *addonData, const char *filename); -typedef void (*ADSPSoundPlay_ReleaseHandle)(void *addonData, ADSPHANDLE handle); -typedef void (*ADSPSoundPlay_Play)(void *addonData, ADSPHANDLE handle); -typedef void (*ADSPSoundPlay_Stop)(void *addonData, ADSPHANDLE handle); -typedef bool (*ADSPSoundPlay_IsPlaying)(void *addonData, ADSPHANDLE handle); -typedef void (*ADSPSoundPlay_SetChannel)(void *addonData, ADSPHANDLE handle, AE_DSP_CHANNEL channel); -typedef AE_DSP_CHANNEL (*ADSPSoundPlay_GetChannel)(void *addonData, ADSPHANDLE handle); -typedef void (*ADSPSoundPlay_SetVolume)(void *addonData, ADSPHANDLE handle, float volume); -typedef float (*ADSPSoundPlay_GetVolume)(void *addonData, ADSPHANDLE handle); - -typedef struct CB_ADSPLib -{ - ADSPAddMenuHook AddMenuHook; - ADSPRemoveMenuHook RemoveMenuHook; - ADSPRegisterMode RegisterMode; - ADSPUnregisterMode UnregisterMode; - - ADSPSoundPlay_GetHandle SoundPlay_GetHandle; - ADSPSoundPlay_ReleaseHandle SoundPlay_ReleaseHandle; - ADSPSoundPlay_Play SoundPlay_Play; - ADSPSoundPlay_Stop SoundPlay_Stop; - ADSPSoundPlay_IsPlaying SoundPlay_IsPlaying; - ADSPSoundPlay_SetChannel SoundPlay_SetChannel; - ADSPSoundPlay_GetChannel SoundPlay_GetChannel; - ADSPSoundPlay_SetVolume SoundPlay_SetVolume; - ADSPSoundPlay_GetVolume SoundPlay_GetVolume; -} CB_ADSPLib; - /*! * Callbacks for a audio DSP add-on to KODI. * diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h index fb0c15f846..08aa050633 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h @@ -29,83 +29,168 @@ typedef void* ADSPHANDLE; -#define ADSP_HELPER_DLL KODI_DLL("adsp") -#define ADSP_HELPER_DLL_NAME KODI_DLL_NAME("adsp") +namespace KodiAPI +{ +namespace V1 +{ +namespace AudioDSP +{ -class CAddonSoundPlay; +typedef void (*ADSPAddMenuHook)(void *addonData, AE_DSP_MENUHOOK *hook); +typedef void (*ADSPRemoveMenuHook)(void *addonData, AE_DSP_MENUHOOK *hook); +typedef void (*ADSPRegisterMode)(void *addonData, AE_DSP_MODES::AE_DSP_MODE *mode); +typedef void (*ADSPUnregisterMode)(void *addonData, AE_DSP_MODES::AE_DSP_MODE *mode); + +typedef ADSPHANDLE (*ADSPSoundPlay_GetHandle)(void *addonData, const char *filename); +typedef void (*ADSPSoundPlay_ReleaseHandle)(void *addonData, ADSPHANDLE handle); +typedef void (*ADSPSoundPlay_Play)(void *addonData, ADSPHANDLE handle); +typedef void (*ADSPSoundPlay_Stop)(void *addonData, ADSPHANDLE handle); +typedef bool (*ADSPSoundPlay_IsPlaying)(void *addonData, ADSPHANDLE handle); +typedef void (*ADSPSoundPlay_SetChannel)(void *addonData, ADSPHANDLE handle, AE_DSP_CHANNEL channel); +typedef AE_DSP_CHANNEL (*ADSPSoundPlay_GetChannel)(void *addonData, ADSPHANDLE handle); +typedef void (*ADSPSoundPlay_SetVolume)(void *addonData, ADSPHANDLE handle, float volume); +typedef float (*ADSPSoundPlay_GetVolume)(void *addonData, ADSPHANDLE handle); + +typedef struct CB_ADSPLib +{ + ADSPAddMenuHook AddMenuHook; + ADSPRemoveMenuHook RemoveMenuHook; + ADSPRegisterMode RegisterMode; + ADSPUnregisterMode UnregisterMode; + + ADSPSoundPlay_GetHandle SoundPlay_GetHandle; + ADSPSoundPlay_ReleaseHandle SoundPlay_ReleaseHandle; + ADSPSoundPlay_Play SoundPlay_Play; + ADSPSoundPlay_Stop SoundPlay_Stop; + ADSPSoundPlay_IsPlaying SoundPlay_IsPlaying; + ADSPSoundPlay_SetChannel SoundPlay_SetChannel; + ADSPSoundPlay_GetChannel SoundPlay_GetChannel; + ADSPSoundPlay_SetVolume SoundPlay_SetVolume; + ADSPSoundPlay_GetVolume SoundPlay_GetVolume; +} CB_ADSPLib; + +} /* namespace AudioDSP */ +} /* namespace V1 */ +} /* namespace KodiAPI */ -class CHelper_libKODI_adsp +class CAddonSoundPlay { public: - CHelper_libKODI_adsp(void) + CAddonSoundPlay(AddonCB* hdl, KodiAPI::V1::AudioDSP::CB_ADSPLib* cb, const char* filename) + : m_Filename(filename), + m_Handle(hdl), + m_cb(cb) { - m_libKODI_adsp = NULL; - m_Handle = NULL; + m_PlayHandle = nullptr; + if (!hdl || !cb) + fprintf(stderr, "libKODI_adsp-ERROR: ADSP_get_sound_play is called with NULL handle !!!\n"); + else + { + m_PlayHandle = m_cb->SoundPlay_GetHandle(m_Handle->addonData, m_Filename.c_str()); + if (!m_PlayHandle) + fprintf(stderr, "libKODI_adsp-ERROR: ADSP_get_sound_play can't get callback table from KODI !!!\n"); + } } - ~CHelper_libKODI_adsp(void) + ~CAddonSoundPlay() { - if (m_libKODI_adsp) - { - ADSP_unregister_me(m_Handle, m_Callbacks); - dlclose(m_libKODI_adsp); - } + if (m_PlayHandle) + m_cb->SoundPlay_ReleaseHandle(m_Handle->addonData, m_PlayHandle); } - /*! - * @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) + /*! play the sound this object represents */ + void Play() { - m_Handle = handle; + if (m_PlayHandle) + m_cb->SoundPlay_Play(m_Handle->addonData, m_PlayHandle); + } - std::string libBasePath; - libBasePath = ((cb_array*)m_Handle)->libPath; - libBasePath += ADSP_HELPER_DLL; - m_libKODI_adsp = dlopen(libBasePath.c_str(), RTLD_LAZY); - if (m_libKODI_adsp == NULL) - { - fprintf(stderr, "Unable to load %s\n", dlerror()); + /*! stop playing the sound this object represents */ + void Stop() + { + if (m_PlayHandle) + m_cb->SoundPlay_Stop(m_Handle->addonData, m_PlayHandle); + } + + /*! return true if the sound is currently playing */ + bool IsPlaying() + { + if (!m_PlayHandle) return false; - } - ADSP_register_me = (void* (*)(void *HANDLE)) - dlsym(m_libKODI_adsp, "ADSP_register_me"); - if (ADSP_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + return m_cb->SoundPlay_IsPlaying(m_Handle->addonData, m_PlayHandle); + } - ADSP_unregister_me = (void (*)(void* HANDLE, void* CB)) - dlsym(m_libKODI_adsp, "ADSP_unregister_me"); - if (ADSP_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + /*! set the playback channel position of this sound, AE_DSP_CH_INVALID for all */ + void SetChannel(AE_DSP_CHANNEL channel) + { + if (m_PlayHandle) + m_cb->SoundPlay_SetChannel(m_Handle->addonData, m_PlayHandle, channel); + } - ADSP_add_menu_hook = (void (*)(void* HANDLE, void* CB, AE_DSP_MENUHOOK *hook)) - dlsym(m_libKODI_adsp, "ADSP_add_menu_hook"); - if (ADSP_add_menu_hook == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + /*! get the current playback volume of this sound, AE_DSP_CH_INVALID for all */ + AE_DSP_CHANNEL GetChannel() + { + if (!m_PlayHandle) + return AE_DSP_CH_INVALID; + return m_cb->SoundPlay_GetChannel(m_Handle->addonData, m_PlayHandle); + } - ADSP_remove_menu_hook = (void (*)(void* HANDLE, void* CB, AE_DSP_MENUHOOK *hook)) - dlsym(m_libKODI_adsp, "ADSP_remove_menu_hook"); - if (ADSP_remove_menu_hook == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + /*! set the playback volume of this sound */ + void SetVolume(float volume) + { + if (m_PlayHandle) + m_cb->SoundPlay_SetVolume(m_Handle->addonData, m_PlayHandle, volume); + } - ADSP_register_mode = (void (*)(void *HANDLE, void* CB, AE_DSP_MODES::AE_DSP_MODE *modes)) - dlsym(m_libKODI_adsp, "ADSP_register_mode"); - if (ADSP_register_mode == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + /*! get the current playback volume of this sound */ + float GetVolume() + { + if (!m_PlayHandle) + return 0.0f; - ADSP_unregister_mode = (void (*)(void* HANDLE, void* CB, AE_DSP_MODES::AE_DSP_MODE *modes)) - dlsym(m_libKODI_adsp, "ADSP_unregister_mode"); - if (ADSP_unregister_mode == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + return m_cb->SoundPlay_GetVolume(m_Handle->addonData, m_PlayHandle); + } - ADSP_get_sound_play = (CAddonSoundPlay* (*)(void *HANDLE, void *CB, const char *filename)) - dlsym(m_libKODI_adsp, "ADSP_get_sound_play"); - if (ADSP_get_sound_play == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } +private: + std::string m_Filename; + AddonCB* m_Handle; + KodiAPI::V1::AudioDSP::CB_ADSPLib *m_cb; + ADSPHANDLE m_PlayHandle; +}; - ADSP_release_sound_play = (void (*)(CAddonSoundPlay* p)) - dlsym(m_libKODI_adsp, "ADSP_release_sound_play"); - if (ADSP_release_sound_play == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } +class CHelper_libKODI_adsp +{ +public: + CHelper_libKODI_adsp(void) + { + m_Handle = nullptr; + m_Callbacks = nullptr; + } - m_Callbacks = ADSP_register_me(m_Handle); - return m_Callbacks != NULL; + ~CHelper_libKODI_adsp(void) + { + if (m_Handle && m_Callbacks) + { + m_Handle->ADSPLib_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::V1::AudioDSP::CB_ADSPLib*)m_Handle->ADSPLib_RegisterMe(m_Handle->addonData); + if (!m_Callbacks) + fprintf(stderr, "libKODI_adsp-ERROR: ADSLib_RegisterMe can't get callback table from Kodi !!!\n"); + + return m_Callbacks != nullptr; } /*! @@ -114,7 +199,7 @@ public: */ void AddMenuHook(AE_DSP_MENUHOOK* hook) { - return ADSP_add_menu_hook(m_Handle, m_Callbacks, hook); + return m_Callbacks->AddMenuHook(m_Handle->addonData, hook); } /*! @@ -123,7 +208,7 @@ public: */ void RemoveMenuHook(AE_DSP_MENUHOOK* hook) { - return ADSP_remove_menu_hook(m_Handle, m_Callbacks, hook); + return m_Callbacks->RemoveMenuHook(m_Handle->addonData, hook); } /*! @@ -133,7 +218,7 @@ public: */ void RegisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) { - return ADSP_register_mode(m_Handle, m_Callbacks, mode); + return m_Callbacks->RegisterMode(m_Handle->addonData, mode); } /*! @@ -142,7 +227,7 @@ public: */ void UnregisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) { - return ADSP_unregister_mode(m_Handle, m_Callbacks, mode); + return m_Callbacks->UnregisterMode(m_Handle->addonData, mode); } /*! @@ -151,7 +236,7 @@ public: */ CAddonSoundPlay* GetSoundPlay(const char *filename) { - return ADSP_get_sound_play(m_Handle, m_Callbacks, filename); + return new CAddonSoundPlay(m_Handle, m_Callbacks, filename); } /*! @@ -160,60 +245,10 @@ public: */ void ReleaseSoundPlay(CAddonSoundPlay* p) { - return ADSP_release_sound_play(p); + delete p; } -protected: - void* (*ADSP_register_me)(void*); - - void (*ADSP_unregister_me)(void*, void*); - void (*ADSP_add_menu_hook)(void*, void*, AE_DSP_MENUHOOK*); - void (*ADSP_remove_menu_hook)(void*, void*, AE_DSP_MENUHOOK*); - void (*ADSP_register_mode)(void*, void*, AE_DSP_MODES::AE_DSP_MODE*); - void (*ADSP_unregister_mode)(void*, void*, AE_DSP_MODES::AE_DSP_MODE*); - CAddonSoundPlay* (*ADSP_get_sound_play)(void*, void*, const char *); - void (*ADSP_release_sound_play)(CAddonSoundPlay*); - private: - void* m_libKODI_adsp; - void* m_Handle; - void* m_Callbacks; - struct cb_array - { - const char* libPath; - }; -}; - -class CAddonSoundPlay -{ -public: - CAddonSoundPlay(void *hdl, void *cb, const char *filename); - virtual ~CAddonSoundPlay(); - - /*! play the sound this object represents */ - virtual void Play(); - - /*! stop playing the sound this object represents */ - virtual void Stop(); - - /*! return true if the sound is currently playing */ - virtual bool IsPlaying(); - - /*! set the playback channel position of this sound, AE_DSP_CH_INVALID for all */ - virtual void SetChannel(AE_DSP_CHANNEL channel); - - /*! get the current playback volume of this sound, AE_DSP_CH_INVALID for all */ - virtual AE_DSP_CHANNEL GetChannel(); - - /*! set the playback volume of this sound */ - virtual void SetVolume(float volume); - - /*! get the current playback volume of this sound */ - virtual float GetVolume(); - -private: - std::string m_Filename; - void *m_Handle; - void *m_cb; - ADSPHANDLE m_PlayHandle; + AddonCB* m_Handle; + KodiAPI::V1::AudioDSP::CB_ADSPLib *m_Callbacks; }; |