diff options
author | AlwinEsch <alwin.esch@web.de> | 2015-04-12 20:42:58 +0200 |
---|---|---|
committer | AchimTuran <wisler@kodi.tv> | 2015-07-19 18:54:26 +0200 |
commit | fef7054e57e3692a25472af478c6317329fb5009 (patch) | |
tree | 86322bcc7a022788e97227b9fdddb93cc8e64499 /lib | |
parent | 24d40f8a7f921a77b6235b9759dc533b0ddf2136 (diff) |
[adsp] Add adsp addon callback helper library
Diffstat (limited to 'lib')
4 files changed, 218 insertions, 0 deletions
diff --git a/lib/addons/library.kodi.adsp/Makefile.in b/lib/addons/library.kodi.adsp/Makefile.in new file mode 100644 index 0000000000..0b9eb7703a --- /dev/null +++ b/lib/addons/library.kodi.adsp/Makefile.in @@ -0,0 +1,27 @@ +ARCH=@ARCH@ +INCLUDES=-I. -I../../../xbmc/addons/include -I../../../xbmc -I../../../xbmc/cores/dvdplayer/DVDDemuxers +DEFINES+= +CXXFLAGS=-fPIC +LIBNAME=libKODI_adsp +OBJS=$(LIBNAME).o + +LIB_SHARED=../../../addons/library.kodi.adsp/$(LIBNAME)-$(ARCH).so + +all: $(LIB_SHARED) + +$(LIB_SHARED): $(OBJS) +ifeq ($(findstring osx,$(ARCH)), osx) + $(CXX) $(LDFLAGS) -Wl,-alias_list,@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper_mach_alias \ + -bundle -undefined dynamic_lookup -o $@ \ + @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.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 new file mode 100644 index 0000000000..5034a5e7ca --- /dev/null +++ b/lib/addons/library.kodi.adsp/libKODI_adsp.cpp @@ -0,0 +1,92 @@ +/* + * 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/library.kodi.adsp/libKODI_adsp.h" +#include "addons/AddonCallbacks.h" + +#ifdef _WIN32 +#include <windows.h> +#define DLLEXPORT __declspec(dllexport) +#else +#define DLLEXPORT +#endif + +using namespace std; + +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 = ((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); +} + +}; diff --git a/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj b/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj new file mode 100644 index 0000000000..005aba0e7b --- /dev/null +++ b/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.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> + </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> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + </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\include;..\..\..\..\..\xbmc\cores\dvdplayer\DVDDemuxers;%(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\include;..\..\..\..\..\xbmc\cores\dvdplayer\DVDDemuxers;%(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> 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 new file mode 100644 index 0000000000..03be80f3ec --- /dev/null +++ b/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj.filters @@ -0,0 +1,18 @@ +<?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> |