From 1e5bdca69f7676b2dbcd64f0f44f31b12b337b7c Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 13 Dec 2016 13:45:04 +0100 Subject: sync with upstream --- project/cmake/CMakeLists.txt | 33 +- .../depends/windows/cmake/mingw/CMakeLists.txt | 33 ++ .../windows/cmake/mingw/MinGWConfig.cmake.in | 3 + .../windows/cmake/mingw/Toolchain_mingw32.cmake.in | 17 + .../addons/depends/windows/cmake/mingw/mingw.txt | 1 + .../depends/windows/cmake/mingw/mingw32-cmd.bat.in | 6 + .../depends/windows/cmake/mingw/noinstall.txt | 0 .../depends/windows/cmake/msys/CMakeLists.txt | 5 + .../addons/depends/windows/cmake/msys/msys.txt | 1 + .../depends/windows/cmake/msys/noinstall.txt | 0 project/cmake/cpack/deb/copyright | 118 ----- project/cmake/cpack/deb/packages/kodi.txt.in | 2 +- project/cmake/installdata/common/addons.txt | 3 +- project/cmake/modules/FindBluetooth.cmake | 6 +- project/cmake/modules/FindCAP.cmake | 44 ++ project/cmake/modules/FindCpluff.cmake | 8 + project/cmake/modules/FindCrossGUID.cmake | 5 + project/cmake/modules/FindFFMPEG.cmake | 258 +++++++++-- project/cmake/modules/FindFribidi.cmake | 6 +- project/cmake/modules/FindMir.cmake | 33 ++ project/cmake/modules/FindTexturePacker.cmake | 22 +- project/cmake/modules/FindVAAPI.cmake | 15 +- project/cmake/modules/FindXSLT.cmake | 2 +- project/cmake/scripts/android/Install.cmake | 1 - project/cmake/scripts/common/ArchSetup.cmake | 5 + .../cmake/scripts/common/CheckTargetPlatform.cmake | 6 +- project/cmake/scripts/common/HandleDepends.cmake | 43 +- project/cmake/scripts/common/Macros.cmake | 9 +- project/cmake/scripts/common/PrepareEnv.cmake | 47 +- project/cmake/scripts/ios/ArchSetup.cmake | 21 + project/cmake/scripts/ios/Install.cmake | 93 ++-- project/cmake/scripts/linux/ArchSetup.cmake | 4 + project/cmake/scripts/linux/Install.cmake | 18 +- project/cmake/scripts/osx/Macros.cmake | 9 +- project/cmake/scripts/windows/tools/patch.cmake | 37 ++ project/cmake/treedata/common/addons.txt | 3 +- project/cmake/treedata/common/cores.txt | 1 + project/cmake/treedata/common/games.txt | 8 + project/cmake/treedata/common/network.txt | 2 - project/cmake/treedata/common/subdirs.txt | 5 + project/cmake/treedata/optional/common/mir.txt | 1 + .../cmake/treedata/optional/common/webserver.txt | 2 + version.txt | 8 +- xbmc/addons/addon-bindings.mk | 5 + .../include/kodi/kodi_game_callbacks.h | 161 +++++++ .../include/kodi/kodi_game_dll.h | 287 ++++++++++++ .../include/kodi/kodi_game_types.h | 487 +++++++++++++++++++++ .../include/kodi/kodi_inputstream_dll.h | 2 +- .../include/kodi/kodi_inputstream_types.h | 11 +- .../include/kodi/kodi_peripheral_types.h | 3 +- .../kodi-addon-dev-kit/include/kodi/libKODI_game.h | 238 ++++++++++ .../include/kodi/libKODI_guilib.h | 6 - .../include/kodi/libKODI_inputstream.h | 96 ++-- .../include/kodi/libXBMC_addon.h | 43 ++ .../kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h | 211 +++------ .../kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h | 2 +- .../include/kodi/xbmc_pvr_types.h | 6 +- xbmc/input/XBMC_vkeys.h | 286 ++++++++++++ 58 files changed, 2277 insertions(+), 511 deletions(-) create mode 100644 project/cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt create mode 100644 project/cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in create mode 100644 project/cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in create mode 100644 project/cmake/addons/depends/windows/cmake/mingw/mingw.txt create mode 100644 project/cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in create mode 100644 project/cmake/addons/depends/windows/cmake/mingw/noinstall.txt create mode 100644 project/cmake/addons/depends/windows/cmake/msys/CMakeLists.txt create mode 100644 project/cmake/addons/depends/windows/cmake/msys/msys.txt create mode 100644 project/cmake/addons/depends/windows/cmake/msys/noinstall.txt create mode 100644 project/cmake/modules/FindCAP.cmake create mode 100644 project/cmake/modules/FindMir.cmake create mode 100644 project/cmake/scripts/windows/tools/patch.cmake create mode 100644 project/cmake/treedata/optional/common/mir.txt create mode 100644 project/cmake/treedata/optional/common/webserver.txt create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_types.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h create mode 100644 xbmc/input/XBMC_vkeys.h diff --git a/project/cmake/CMakeLists.txt b/project/cmake/CMakeLists.txt index fa1156d..c70b18d 100644 --- a/project/cmake/CMakeLists.txt +++ b/project/cmake/CMakeLists.txt @@ -45,14 +45,14 @@ option(ENABLE_NONFREE "Enable non-free components?" ON) option(ENABLE_AIRTUNES "Enable AirTunes support?" ON) option(ENABLE_CEC "Enable CEC support?" ON) option(ENABLE_OPTICAL "Enable optical support?" ON) +# use ffmpeg from depends or system +option(ENABLE_INTERNAL_FFMPEG "Enable internal ffmpeg?" OFF) if(UNIX) - if(NOT APPLE) - option(ENABLE_INTERNAL_FFMPEG "Enable internal ffmpeg?" ON) - endif() option(FFMPEG_PATH "Path to external ffmpeg?" "") option(ENABLE_INTERNAL_CROSSGUID "Enable internal crossguid?" ON) option(ENABLE_OPENSSL "Enable OpenSSL?" ON) option(ENABLE_SDL "Enable SDL?" OFF) + option(ENABLE_MIR "Enable MIR?" OFF) if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd) option(ENABLE_X11 "Enable X11 support?" ON) option(ENABLE_AML "Enable AML?" OFF) @@ -119,7 +119,7 @@ endif() # Optional dependencies set(optional_deps MicroHttpd MySqlClient SSH XSLT Alsa UDEV DBus Avahi SmbClient - PulseAudio VDPAU VAAPI) + PulseAudio VDPAU VAAPI Bluetooth CAP) # Required, dyloaded deps set(required_dyload Curl ASS) @@ -197,14 +197,24 @@ endif() if(NOT WIN32) core_optional_dep(OpenGl) if(OPENGL_FOUND) - core_optional_dep(X ENABLE_X11) - core_optional_dep(LibDRM ENABLE_X11) - core_optional_dep(XRandR ENABLE_X11) + if(ENABLE_MIR) + core_require_dep(Mir ENABLE_MIR) + core_optional_dep(LibDRM ENABLE_MIR) + else() + core_optional_dep(X ENABLE_X11) + core_optional_dep(XRandR ENABLE_X11) + core_optional_dep(LibDRM ENABLE_X11) + endif() else() core_optional_dep(OpenGLES) if(OPENGLES_FOUND) - core_optional_dep(X ENABLE_X11) - core_optional_dep(LibDRM ENABLE_X11) + if(ENABLE_MIR) + core_require_dep(Mir ENABLE_MIR) + core_optional_dep(LibDRM ENABLE_MIR) + else() + core_optional_dep(X ENABLE_X11) + core_optional_dep(LibDRM ENABLE_X11) + endif() endif() endif() if(NOT APPLE) @@ -337,9 +347,12 @@ unset(_MAIN_LIBRARIES) if(WIN32) set_target_properties(${APP_NAME_LC} PROPERTIES WIN32_EXECUTABLE ON) set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${APP_NAME_LC}) - target_sources(kodi PRIVATE ${CORE_SOURCE_DIR}/xbmc/platform/win32/app.manifest) + target_sources(${APP_NAME_LC} PRIVATE ${CORE_SOURCE_DIR}/xbmc/platform/win32/app.manifest) elseif(CORE_SYSTEM_NAME STREQUAL android) # Nothing +elseif(CORE_SYSTEM_NAME STREQUAL ios) + set_target_properties(${APP_NAME_LC} PROPERTIES OUTPUT_NAME ${APP_NAME} + MACOSX_BUNDLE_INFO_PLIST ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/Info.plist.in) else() set_target_properties(${APP_NAME_LC} PROPERTIES SUFFIX ".bin") endif() diff --git a/project/cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt b/project/cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt new file mode 100644 index 0000000..2c2c4b8 --- /dev/null +++ b/project/cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.1) +project(mingw) + +function(generate_mingw32_wrapper cmd) + set(CMD ${cmd}) + configure_file(${PROJECT_SOURCE_DIR}/mingw32-cmd.bat.in ${MINGW_PATH}/bin/${CMD}.bat @ONLY) +endfunction() + +get_filename_component(CORE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../../../.. REALPATH) + +set(MSYS_PATH "${CORE_SOURCE_DIR}/project/BuildDependencies/msys64") +set(MINGW_PATH "${MSYS_PATH}/mingw32") + +# configure the MinGW toolchain file +configure_file(${PROJECT_SOURCE_DIR}/Toolchain_mingw32.cmake.in ${CMAKE_INSTALL_PREFIX}/Toolchain_mingw32.cmake @ONLY) + +# configure MinGWConfig.cmake +configure_file(${PROJECT_SOURCE_DIR}/MinGWConfig.cmake.in ${CMAKE_INSTALL_PREFIX}/MinGWConfig.cmake) + +# TODO: MinGW GCC 5.3.0-1 comes without cc.exe, Remove this once package is bumped to 5.3.0-p2 +# See https://github.com/Alexpux/MINGW-packages/pull/1034 +if(NOT EXISTS ${MINGW_PATH}/bin/cc.exe) + execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${MINGW_PATH}/bin/gcc.exe ${MINGW_PATH}/bin/cc.exe) +endif() + +# configure the MinGW wrapper batch scripts +generate_mingw32_wrapper("make") +generate_mingw32_wrapper("gcc") +generate_mingw32_wrapper("cc") +generate_mingw32_wrapper("g++") +generate_mingw32_wrapper("ar") +generate_mingw32_wrapper("ld") +generate_mingw32_wrapper("windres") diff --git a/project/cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in b/project/cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in new file mode 100644 index 0000000..2d6baa7 --- /dev/null +++ b/project/cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in @@ -0,0 +1,3 @@ +set(MINGW_INCLUDE_DIRS @MINGW_PATH@/include) +set(MINGW_MAKE @MINGW_PATH@/bin/make.bat -j$ENV{NUMBER_OF_PROCESSORS}) +set(MINGW_FOUND 1) diff --git a/project/cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in b/project/cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in new file mode 100644 index 0000000..01d281d --- /dev/null +++ b/project/cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in @@ -0,0 +1,17 @@ +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_NAME Windows) + +set(CMAKE_FIND_ROOT_PATH @CMAKE_FIND_ROOT_PATH@ @CMAKE_INSTALL_PREFIX@ @MSYS_PATH@ @MINGW_PATH@) + +# specify the cross compiler +set(CMAKE_C_COMPILER @MINGW_PATH@/bin/gcc.bat) +set(CMAKE_CXX_COMPILER @MINGW_PATH@/bin/g++.bat) +set(CMAKE_AR @MINGW_PATH@/bin/ar.bat CACHE FILEPATH "Archiver") +set(CMAKE_LINKER @MINGW_PATH@/bin/ld.bat CACHE FILEPATH "Linker") +SET(CMAKE_RC_COMPILER @MINGW_PATH@/bin/windres.bat) + +# search for programs in the build host directories +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/project/cmake/addons/depends/windows/cmake/mingw/mingw.txt b/project/cmake/addons/depends/windows/cmake/mingw/mingw.txt new file mode 100644 index 0000000..90aa6ae --- /dev/null +++ b/project/cmake/addons/depends/windows/cmake/mingw/mingw.txt @@ -0,0 +1 @@ +mingw diff --git a/project/cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in b/project/cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in new file mode 100644 index 0000000..44a0ea2 --- /dev/null +++ b/project/cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in @@ -0,0 +1,6 @@ +@ECHO OFF +SETLOCAL + +SET PATH=@MINGW_PATH@/bin;@MSYS_PATH@/usr/bin;%PATH% +@CMD@.exe %* + diff --git a/project/cmake/addons/depends/windows/cmake/mingw/noinstall.txt b/project/cmake/addons/depends/windows/cmake/mingw/noinstall.txt new file mode 100644 index 0000000..e69de29 diff --git a/project/cmake/addons/depends/windows/cmake/msys/CMakeLists.txt b/project/cmake/addons/depends/windows/cmake/msys/CMakeLists.txt new file mode 100644 index 0000000..1c0536e --- /dev/null +++ b/project/cmake/addons/depends/windows/cmake/msys/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.1) +project(msys LANGUAGES NONE) + +# This is an empty dummy dependency because a lot of game addons depend on it. +# After they got fixed, this can be removed. diff --git a/project/cmake/addons/depends/windows/cmake/msys/msys.txt b/project/cmake/addons/depends/windows/cmake/msys/msys.txt new file mode 100644 index 0000000..00de9c2 --- /dev/null +++ b/project/cmake/addons/depends/windows/cmake/msys/msys.txt @@ -0,0 +1 @@ +msys diff --git a/project/cmake/addons/depends/windows/cmake/msys/noinstall.txt b/project/cmake/addons/depends/windows/cmake/msys/noinstall.txt new file mode 100644 index 0000000..e69de29 diff --git a/project/cmake/cpack/deb/copyright b/project/cmake/cpack/deb/copyright index 5616264..a79cf54 100644 --- a/project/cmake/cpack/deb/copyright +++ b/project/cmake/cpack/deb/copyright @@ -529,84 +529,6 @@ projectM - OpenGL based advanced music visualization program You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . -GLEW - The OpenGL Extension Wrangler Library - - - Copyright © 2002-2008, Milan Ikits - Copyright © 2002-2008, Marcelo E. Magallon - Copyright © 2002, Lev Povalahev - Copyright © 1999-2007 Brian Paul - Copyright © 2007 The Khronos Group Inc. - All Rights Reserved. - - Falls under three licenses, which are the Modified BSD License, the Mesa 3-D - License (MIT License), and the Khronos License (MIT License). - - Modified BSD License - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * The name of the author may be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - THE POSSIBILITY OF SUCH DAMAGE. - - Mesa 3-D License (MIT License) - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - Khronos License (MIT License) - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and/or associated documentation files (the - "Materials"), to deal in the Materials without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Materials, and to - permit persons to whom the Materials are furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Materials. - - THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - OpenDAAP @@ -809,28 +731,6 @@ GNU libmicrohttpd You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . -libmodplug - - - Copyright 2002-2003 Kenton Varda , - Olivier Lapicque , - Colin DeVilbiss , - Markus Fick , - Adam Goode - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . - Python Programming Language @@ -2430,24 +2330,6 @@ libnfs - NFS client library You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . -librtmp - toolkit for RTMP streams - - Copyright (C) 2009 Andrej Stepanchuk - Copyright (C) 2009-2010 Howard Chu - - 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 of the License, 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 this program. If not, see . - libsquish - Open source DXT compression library Copyright (C) 2006 Simon Brown diff --git a/project/cmake/cpack/deb/packages/kodi.txt.in b/project/cmake/cpack/deb/packages/kodi.txt.in index 3a5cde1..4ca417b 100644 --- a/project/cmake/cpack/deb/packages/kodi.txt.in +++ b/project/cmake/cpack/deb/packages/kodi.txt.in @@ -15,7 +15,7 @@ PACKAGE_ARCHITECTURE all PACKAGE_SECTION video PACKAGE_PRIORITY optional PACKAGE_SHLIBDEPS -PACKAGE_DEPENDS @APP_NAME_LC@-bin (>= @CPACK_DEBIAN_PACKAGE_VERSION@), @APP_NAME_LC@-bin (<< @CPACK_DEBIAN_PACKAGE_VERSION@.1~), curl, libcurl3, mesa-utils, x11-utils, fonts-liberation | ttf-liberation, fonts-dejavu-core | ttf-dejavu-core, python-bluez | python-lightblue, python-imaging, python-simplejson, libmad0, libass5 | libass4, libgif5 | libgif7, libssh-4 | libssh2-1, libnfs8 | libnfs4 | libnfs1, libbluray1, libshairplay0, libvorbisfile3, libaacs0, libcec3, librtmp1 | librtmp0, libgnutls30 | libgnutls-deb0-28 | libgnutls28 | libgnutls26, libxslt1.1, libyajl2 +PACKAGE_DEPENDS @APP_NAME_LC@-bin (>= @CPACK_DEBIAN_PACKAGE_VERSION@), @APP_NAME_LC@-bin (<< @CPACK_DEBIAN_PACKAGE_VERSION@.1~), curl, libcurl3, mesa-utils, x11-utils, fonts-liberation | ttf-liberation, fonts-dejavu-core | ttf-dejavu-core, python-bluez | python-lightblue, python-imaging, python-simplejson, libass5 | libass4, libgif5 | libgif7, libssh-4 | libssh2-1, libnfs8 | libnfs4 | libnfs1, libbluray1, libshairplay0, libvorbisfile3, libaacs0, libcec4, libgnutls30 | libgnutls-deb0-28 | libgnutls28 | libgnutls26, libxslt1.1, libyajl2 PACKAGE_RECOMMENDS libvdpau1, libva-intel-vaapi-driver, libva1 PACKAGE_SUGGESTS @APP_NAME_LC@-pvr-mythtv, @APP_NAME_LC@-pvr-vuplus, @APP_NAME_LC@-pvr-vdr-vnsi, @APP_NAME_LC@-pvr-njoy, @APP_NAME_LC@-pvr-nextpvr, @APP_NAME_LC@-pvr-mediaportal-tvserver, @APP_NAME_LC@-pvr-tvheadend-hts, @APP_NAME_LC@-pvr-dvbviewer, @APP_NAME_LC@-pvr-argustv, @APP_NAME_LC@-pvr-iptvsimple, @APP_NAME_LC@-audioencoder-vorbis, @APP_NAME_LC@-audioencoder-flac, @APP_NAME_LC@-audioencoder-lame PACKAGE_BREAKS xbmc (<< 2:14.0~git20141019), xbmc-data, xbmc-standalone diff --git a/project/cmake/installdata/common/addons.txt b/project/cmake/installdata/common/addons.txt index 1cbe4d6..5613ba7 100644 --- a/project/cmake/installdata/common/addons.txt +++ b/project/cmake/installdata/common/addons.txt @@ -20,12 +20,11 @@ addons/xbmc.python/* addons/xbmc.webinterface/* addons/library.kodi.adsp/* addons/library.kodi.audioengine/* +addons/library.kodi.game/* addons/library.kodi.guilib/* -addons/library.kodi.inputstream/* addons/library.kodi.peripheral/* addons/library.xbmc.addon/* addons/library.xbmc.codec/* -addons/library.xbmc.pvr/* addons/repository.xbmc.org/* addons/webinterface.default/* addons/screensaver.xbmc.builtin.dim/* diff --git a/project/cmake/modules/FindBluetooth.cmake b/project/cmake/modules/FindBluetooth.cmake index 538e89c..a69980d 100644 --- a/project/cmake/modules/FindBluetooth.cmake +++ b/project/cmake/modules/FindBluetooth.cmake @@ -14,12 +14,12 @@ # Bluetooth::Bluetooth - The Bluetooth library if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_BLUETOOTH bluetooth QUIET) + pkg_check_modules(PC_BLUETOOTH bluez bluetooth QUIET) endif() find_path(BLUETOOTH_INCLUDE_DIR NAMES bluetooth/bluetooth.h PATHS ${PC_BLUETOOTH_INCLUDEDIR}) -find_library(BLUETOOTH_LIBRARY NAMES bluetooth +find_library(BLUETOOTH_LIBRARY NAMES bluetooth libbluetooth PATHS ${PC_BLUETOOTH_LIBDIR}) set(BLUETOOTH_VERSION ${PC_BLUETOOTH_VERSION}) @@ -27,7 +27,7 @@ set(BLUETOOTH_VERSION ${PC_BLUETOOTH_VERSION}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Bluetooth REQUIRED_VARS BLUETOOTH_LIBRARY BLUETOOTH_INCLUDE_DIR - VERSION_VAR ${BLUETOOTH_VERSION}) + VERSION_VAR BLUETOOTH_VERSION) if(BLUETOOTH_FOUND) set(BLUETOOTH_INCLUDE_DIRS ${BLUETOOTH_INCLUDE_DIR}) diff --git a/project/cmake/modules/FindCAP.cmake b/project/cmake/modules/FindCAP.cmake new file mode 100644 index 0000000..04e8378 --- /dev/null +++ b/project/cmake/modules/FindCAP.cmake @@ -0,0 +1,44 @@ +#.rst: +# FindCAP +# ----------- +# Finds the POSIX 1003.1e capabilities library +# +# This will define the following variables:: +# +# CAP_FOUND - system has LibCap +# CAP_INCLUDE_DIRS - the LibCap include directory +# CAP_LIBRARIES - the LibCap libraries +# +# and the following imported targets:: +# +# CAP::CAP - The LibCap library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_CAP libcap QUIET) +endif() + +find_path(CAP_INCLUDE_DIR NAMES sys/capability.h + PATHS ${PC_CAP_INCLUDEDIR}) +find_library(CAP_LIBRARY NAMES cap libcap + PATHS ${PC_CAP_LIBDIR}) + +set(CAP_VERSION ${PC_CAP_VERSION}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CAP + REQUIRED_VARS CAP_LIBRARY CAP_INCLUDE_DIR + VERSION_VAR CAP_VERSION) + +if(CAP_FOUND) + set(CAP_LIBRARIES ${CAP_LIBRARY}) + set(CAP_INCLUDE_DIRS ${CAP_INCLUDE_DIR}) + + if(NOT TARGET CAP::CAP) + add_library(CAP::CAP UNKNOWN IMPORTED) + set_target_properties(CAP::CAP PROPERTIES + IMPORTED_LOCATION "${CAP_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${CAP_INCLUDE_DIR}") + endif() +endif() + +mark_as_advanced(CAP_INCLUDE_DIR CAP_LIBRARY) diff --git a/project/cmake/modules/FindCpluff.cmake b/project/cmake/modules/FindCpluff.cmake index fb2bb25..ce6c127 100644 --- a/project/cmake/modules/FindCpluff.cmake +++ b/project/cmake/modules/FindCpluff.cmake @@ -10,6 +10,13 @@ if(NOT WIN32) string(REPLACE ";" " " defines "${CMAKE_C_FLAGS} ${SYSTEM_DEFINES} -I${EXPAT_INCLUDE_DIR}") get_filename_component(expat_dir ${EXPAT_LIBRARY} DIRECTORY) set(ldflags "-L${expat_dir}") + + # iOS: Without specifying -arch, configure tries to use /bin/cpp as C-preprocessor + # http://stackoverflow.com/questions/38836754/cant-cross-compile-c-library-for-arm-ios + if(CORE_SYSTEM_NAME STREQUAL ios) + set(cppflags "-arch ${CPU}") + endif() + ExternalProject_Add(libcpluff SOURCE_DIR ${CORE_SOURCE_DIR}/lib/cpluff BUILD_IN_SOURCE 1 PREFIX ${CORE_BUILD_DIR}/cpluff @@ -22,6 +29,7 @@ if(NOT WIN32) --libdir=/lib --host=${ARCH} CFLAGS=${defines} + CPPFLAGS=${cppflags} LDFLAGS=${ldflags}) ExternalProject_Add_Step(libcpluff autoreconf DEPENDEES download update patch diff --git a/project/cmake/modules/FindCrossGUID.cmake b/project/cmake/modules/FindCrossGUID.cmake index bcae3d3..ba2823a 100644 --- a/project/cmake/modules/FindCrossGUID.cmake +++ b/project/cmake/modules/FindCrossGUID.cmake @@ -16,6 +16,10 @@ if(ENABLE_INTERNAL_CROSSGUID) message(STATUS "CROSSGUID_URL: ${CROSSGUID_URL}") endif() + if(APPLE) + set(EXTRA_ARGS "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}") + endif() + set(CROSSGUID_LIBRARY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/libcrossguid.a) set(CROSSGUID_INCLUDE_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include) externalproject_add(crossguid @@ -24,6 +28,7 @@ if(ENABLE_INTERNAL_CROSSGUID) PREFIX ${CORE_BUILD_DIR}/crossguid CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + "${EXTRA_ARGS}" PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/CMakeLists.txt && diff --git a/project/cmake/modules/FindFFMPEG.cmake b/project/cmake/modules/FindFFMPEG.cmake index a9f88fb..2b3f47b 100644 --- a/project/cmake/modules/FindFFMPEG.cmake +++ b/project/cmake/modules/FindFFMPEG.cmake @@ -1,18 +1,224 @@ -include(ExternalProject) -file(STRINGS ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/FFMPEG-VERSION VER) -string(REGEX MATCH "VERSION=[^ ]*$.*" FFMPEG_VER "${VER}") -list(GET FFMPEG_VER 0 FFMPEG_VER) -string(SUBSTRING "${FFMPEG_VER}" 8 -1 FFMPEG_VER) -string(REGEX MATCH "BASE_URL=([^ ]*)" FFMPEG_BASE_URL "${VER}") -list(GET FFMPEG_BASE_URL 0 FFMPEG_BASE_URL) -string(SUBSTRING "${FFMPEG_BASE_URL}" 9 -1 FFMPEG_BASE_URL) +# FindFFMPEG +# -------- +# Finds FFmpeg libraries +# +# This module will first look for the required library versions on the system. +# If they are not found, it will fall back to downloading and building kodi's own version +# +# -------- +# the following variables influence behaviour: +# ENABLE_INTERNAL_FFMPEG - if enabled, kodi's own version will always be built +# +# FFMPEG_PATH - use external ffmpeg not found in system paths +# usage: -DFFMPEG_PATH=/path/to/ffmpeg_install_prefix +# +# WITH_FFMPEG - use external ffmpeg not found in system paths +# WARNING: this option is for developers as it will _disable ffmpeg version checks_! +# Consider using FFMPEG_PATH instead, which _does_ check library versions +# usage: -DWITH_FFMPEG=/path/to/ffmpeg_install_prefix +# +# -------- +# This module will will define the following variables: +# +# FFMPEG_FOUND - system has FFmpeg +# FFMPEG_INCLUDE_DIRS - FFmpeg include directory +# FFMPEG_LIBRARIES - FFmpeg libraries +# FFMPEG_DEFINITIONS - pre-processor definitions +# FFMPEG_LDFLAGS - linker flags +# +# and the following imported targets:: +# +# ffmpeg - The FFmpeg libraries +# -------- +# +# required ffmpeg library versions +set(REQUIRED_FFMPEG_VERSION 3.1) +set(_avcodec_ver ">=57.48.101") +set(_avfilter_ver ">=6.47.100") +set(_avformat_ver ">=57.41.100") +set(_avutil_ver ">=55.28.100") +set(_swscale_ver ">=4.1.100") +set(_swresample_ver ">=2.1.100") +set(_postproc_ver ">=54.0.100") -if(ENABLE_INTERNAL_FFMPEG) + +# Allows building with external ffmpeg not found in system paths, +# without library version checks +if(WITH_FFMPEG) + set(FFMPEG_PATH ${WITH_FFMPEG}) + message(STATUS "Warning: FFmpeg version checking disabled") + set(REQUIRED_FFMPEG_VERSION undef) + unset(_avcodec_ver) + unset(_avfilter_ver) + unset(_avformat_ver) + unset(_avutil_ver) + unset(_swscale_ver) + unset(_swresample_ver) + unset(_postproc_ver) +endif() + +# Allows building with external ffmpeg not found in system paths, +# with library version checks +if(FFMPEG_PATH) + set(ENABLE_INTERNAL_FFMPEG OFF) +endif() + +# external FFMPEG +if(NOT ENABLE_INTERNAL_FFMPEG OR CMAKE_CROSSCOMPILING) if(FFMPEG_PATH) - message(WARNING "Internal FFmpeg enabled, but FFMPEG_PATH given, ignoring") + set(ENV{PKG_CONFIG_PATH} "${FFMPEG_PATH}/lib/pkgconfig") + list(APPEND CMAKE_PREFIX_PATH ${FFMPEG_PATH}) endif() + set(FFMPEG_PKGS libavcodec${_avcodec_ver} + libavfilter${_avfilter_ver} + libavformat${_avformat_ver} + libavutil${_avutil_ver} + libswscale${_swscale_ver} + libswresample${_swresample_ver} + libpostproc${_postproc_ver}) + + if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_FFMPEG ${FFMPEG_PKGS} QUIET) + string(REGEX REPLACE "framework;" "framework " PC_FFMPEG_LDFLAGS "${PC_FFMPEG_LDFLAGS}") + endif() + + find_path(FFMPEG_INCLUDE_DIRS libavcodec/avcodec.h libavfilter/avfilter.h libavformat/avformat.h + libavutil/avutil.h libswscale/swscale.h libpostproc/postprocess.h + PATH_SUFFIXES ffmpeg + PATHS ${PC_FFMPEG_INCLUDE_DIRS} + NO_DEFAULT_PATH) + find_path(FFMPEG_INCLUDE_DIRS libavcodec/avcodec.h libavfilter/avfilter.h libavformat/avformat.h + libavutil/avutil.h libswscale/swscale.h libpostproc/postprocess.h) + + find_library(FFMPEG_LIBAVCODEC + NAMES avcodec libavcodec + PATH_SUFFIXES ffmpeg/libavcodec + PATHS ${PC_FFMPEG_libavcodec_LIBDIR} + NO_DEFAULT_PATH) + find_library(FFMPEG_LIBAVCODEC NAMES avcodec libavcodec PATH_SUFFIXES ffmpeg/libavcodec) + + find_library(FFMPEG_LIBAVFILTER + NAMES avfilter libavfilter + PATH_SUFFIXES ffmpeg/libavfilter + PATHS ${PC_FFMPEG_libavfilter_LIBDIR} + NO_DEFAULT_PATH) + find_library(FFMPEG_LIBAVFILTER NAMES avfilter libavfilter PATH_SUFFIXES ffmpeg/libavfilter) + + find_library(FFMPEG_LIBAVFORMAT + NAMES avformat libavformat + PATH_SUFFIXES ffmpeg/libavformat + PATHS ${PC_FFMPEG_libavformat_LIBDIR} + NO_DEFAULT_PATH) + find_library(FFMPEG_LIBAVFORMAT NAMES avformat libavformat PATH_SUFFIXES ffmpeg/libavformat) + + find_library(FFMPEG_LIBAVUTIL + NAMES avutil libavutil + PATH_SUFFIXES ffmpeg/libavutil + PATHS ${PC_FFMPEG_libavutil_LIBDIR} + NO_DEFAULT_PATH) + find_library(FFMPEG_LIBAVUTIL NAMES avutil libavutil PATH_SUFFIXES ffmpeg/libavutil) + + find_library(FFMPEG_LIBSWSCALE + NAMES swscale libswscale + PATH_SUFFIXES ffmpeg/libswscale + PATHS ${PC_FFMPEG_libswscale_LIBDIR} + NO_DEFAULT_PATH) + find_library(FFMPEG_LIBSWSCALE NAMES swscale libswscale PATH_SUFFIXES ffmpeg/libswscale) + + find_library(FFMPEG_LIBSWRESAMPLE + NAMES swresample libswresample + PATH_SUFFIXES ffmpeg/libswresample + PATHS ${PC_FFMPEG_libswresample_LIBDIR} + NO_DEFAULT_PATH) + find_library(FFMPEG_LIBSWRESAMPLE NAMES NAMES swresample libswresample PATH_SUFFIXES ffmpeg/libswresample) + + find_library(FFMPEG_LIBPOSTPROC + NAMES postproc libpostproc + PATH_SUFFIXES ffmpeg/libpostproc + PATHS ${PC_FFMPEG_libpostproc_LIBDIR} + NO_DEFAULT_PATH) + find_library(FFMPEG_LIBPOSTPROC NAMES postproc libpostproc PATH_SUFFIXES ffmpeg/libpostproc) + + if((PC_FFMPEG_FOUND + AND PC_FFMPEG_libavcodec_VERSION + AND PC_FFMPEG_libavfilter_VERSION + AND PC_FFMPEG_libavformat_VERSION + AND PC_FFMPEG_libavutil_VERSION + AND PC_FFMPEG_libswscale_VERSION + AND PC_FFMPEG_libswresample_VERSION + AND PC_FFMPEG_libpostproc_VERSION) + OR WIN32) + set(FFMPEG_VERSION ${REQUIRED_FFMPEG_VERSION}) + + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(FFMPEG + VERSION_VAR FFMPEG_VERSION + REQUIRED_VARS FFMPEG_INCLUDE_DIRS + FFMPEG_LIBAVCODEC + FFMPEG_LIBAVFILTER + FFMPEG_LIBAVFORMAT + FFMPEG_LIBAVUTIL + FFMPEG_LIBSWSCALE + FFMPEG_LIBSWRESAMPLE + FFMPEG_LIBPOSTPROC + FFMPEG_VERSION + FAIL_MESSAGE "FFmpeg ${REQUIRED_FFMPEG_VERSION} not found, please consider using -DENABLE_INTERNAL_FFMPEG=ON") + + else() + message(STATUS "FFmpeg ${REQUIRED_FFMPEG_VERSION} not found, falling back to internal build") + unset(FFMPEG_INCLUDE_DIRS) + unset(FFMPEG_INCLUDE_DIRS CACHE) + unset(FFMPEG_LIBRARIES) + unset(FFMPEG_LIBRARIES CACHE) + unset(FFMPEG_DEFINITIONS) + unset(FFMPEG_DEFINITIONS CACHE) + endif() + + if(FFMPEG_FOUND) + set(FFMPEG_LDFLAGS ${PC_FFMPEG_LDFLAGS} CACHE STRING "ffmpeg linker flags") + + # check if ffmpeg libs are statically linked + set(FFMPEG_LIB_TYPE SHARED) + foreach(_fflib IN LISTS FFMPEG_LIBRARIES) + if(${_fflib} MATCHES ".+\.a$" AND PC_FFMPEG_STATIC_LDFLAGS) + set(FFMPEG_LDFLAGS ${PC_FFMPEG_STATIC_LDFLAGS} CACHE STRING "ffmpeg linker flags" FORCE) + set(FFMPEG_LIB_TYPE STATIC) + break() + endif() + endforeach() + + set(FFMPEG_LIBRARIES ${FFMPEG_LIBAVCODEC} ${FFMPEG_LIBAVFILTER} + ${FFMPEG_LIBAVFORMAT} ${FFMPEG_LIBAVUTIL} + ${FFMPEG_LIBSWSCALE} ${FFMPEG_LIBSWRESAMPLE} + ${FFMPEG_LIBPOSTPROC} ${FFMPEG_LDFLAGS}) + list(APPEND FFMPEG_DEFINITIONS -DFFMPEG_VER_SHA=\"${FFMPEG_VERSION}\") + + if(NOT TARGET ffmpeg) + add_library(ffmpeg ${FFMPEG_LIB_TYPE} IMPORTED) + set_target_properties(ffmpeg PROPERTIES + FOLDER "External Projects" + IMPORTED_LOCATION "${FFMPEG_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${FFMPEG_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFMPEG_LDFLAGS}" + INTERFACE_COMPILE_DEFINITIONS "${FFMPEG_DEFINITIONS}") + endif() + endif() +endif() + +# Internal FFMPEG +if(NOT FFMPEG_FOUND) + include(ExternalProject) + file(STRINGS ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/FFMPEG-VERSION VER) + string(REGEX MATCH "VERSION=[^ ]*$.*" FFMPEG_VER "${VER}") + list(GET FFMPEG_VER 0 FFMPEG_VER) + string(SUBSTRING "${FFMPEG_VER}" 8 -1 FFMPEG_VER) + string(REGEX MATCH "BASE_URL=([^ ]*)" FFMPEG_BASE_URL "${VER}") + list(GET FFMPEG_BASE_URL 0 FFMPEG_BASE_URL) + string(SUBSTRING "${FFMPEG_BASE_URL}" 9 -1 FFMPEG_BASE_URL) + # allow user to override the download URL with a local tarball # needed for offline build envs if(FFMPEG_URL) @@ -80,35 +286,7 @@ fi") list(APPEND FFMPEG_DEFINITIONS -DFFMPEG_VER_SHA=\"${FFMPEG_VER}\" -DUSE_STATIC_FFMPEG=1) set(FFMPEG_FOUND 1) -else() - if(FFMPEG_PATH) - set(ENV{PKG_CONFIG_PATH} "${FFMPEG_PATH}/lib/pkgconfig") - endif() - set(FFMPEG_PKGS libavcodec>=56.26.100 libavfilter>=5.11.100 libavformat>=56.25.101 - libavutil>=54.20.100 libswscale>=3.1.101 libswresample>=1.1.100 libpostproc>=53.3.100) - if(PKG_CONFIG_FOUND AND NOT WIN32) - pkg_check_modules (FFMPEG ${FFMPEG_PKGS}) - string(REGEX REPLACE "framework;" "framework " FFMPEG_LDFLAGS "${FFMPEG_LDFLAGS}") - set(FFMPEG_LIBRARIES ${FFMPEG_LDFLAGS}) - add_custom_target(ffmpeg) - else() - find_path(FFMPEG_INCLUDE_DIRS libavcodec/avcodec.h PATH_SUFFIXES ffmpeg) - find_library(FFMPEG_LIBAVCODEC NAMES avcodec libavcodec PATH_SUFFIXES ffmpeg/libavcodec) - find_library(FFMPEG_LIBAVFILTER NAMES avfilter libavfilter PATH_SUFFIXES ffmpeg/libavfilter) - find_library(FFMPEG_LIBAVFORMAT NAMES avformat libavformat PATH_SUFFIXES ffmpeg/libavformat) - find_library(FFMPEG_LIBAVUTIL NAMES avutil libavutil PATH_SUFFIXES ffmpeg/libavutil) - find_library(FFMPEG_LIBSWSCALE NAMES swscale libswscale PATH_SUFFIXES ffmpeg/libswscale) - find_library(FFMPEG_LIBPOSTPROC NAMES postproc libpostproc PATH_SUFFIXES ffmpeg/libpostproc) - set(FFMPEG_LIBRARIES ${FFMPEG_LIBAVCODEC} ${FFMPEG_LIBAVFILTER} ${FFMPEG_LIBAVFORMAT} - ${FFMPEG_LIBAVUTIL} ${FFMPEG_LIBSWSCALE} ${FFMPEG_LIBPOSTPROC}) - add_custom_target(ffmpeg DEPENDS ${FFMPEG_LIBRARIES}) - endif() - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(FFMPEG DEFAULT_MSG FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES) - set(FFMPEG_FOUND 1) - list(APPEND FFMPEG_DEFINITIONS -DFFMPEG_VER_SHA=\"${FFMPEG_VER}\") + set_target_properties(ffmpeg PROPERTIES FOLDER "External Projects") endif() -set_target_properties(ffmpeg PROPERTIES FOLDER "External Projects") -mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_DEFINITIONS FFMPEG_FOUND) +mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_LDFLAGS FFMPEG_DEFINITIONS FFMPEG_FOUND) diff --git a/project/cmake/modules/FindFribidi.cmake b/project/cmake/modules/FindFribidi.cmake index 03c2f53..dcaeb48 100644 --- a/project/cmake/modules/FindFribidi.cmake +++ b/project/cmake/modules/FindFribidi.cmake @@ -32,12 +32,16 @@ find_package_handle_standard_args(FriBidi if(FRIBIDI_FOUND) set(FRIBIDI_LIBRARIES ${FRIBIDI_LIBRARY}) set(FRIBIDI_INCLUDE_DIRS ${FRIBIDI_INCLUDE_DIR}) + if(PC_FRIBIDI_CFLAGS) + set(FRIBIDI_DEFINITIONS ${PC_FRIBIDI_CFLAGS}) + endif() if(NOT TARGET FriBidi::FriBidi) add_library(FriBidi::FriBidi UNKNOWN IMPORTED) set_target_properties(FriBidi::FriBidi PROPERTIES IMPORTED_LOCATION "${FRIBIDI_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${FRIBIDI_INCLUDE_DIR}") + INTERFACE_INCLUDE_DIRECTORIES "${FRIBIDI_INCLUDE_DIR}" + INTERFACE_COMPILE_OPTIONS "${FRIBIDI_DEFINITIONS}") endif() endif() diff --git a/project/cmake/modules/FindMir.cmake b/project/cmake/modules/FindMir.cmake new file mode 100644 index 0000000..8847a61 --- /dev/null +++ b/project/cmake/modules/FindMir.cmake @@ -0,0 +1,33 @@ +# FindMir +# ------- +# Finds the Mir library +# +# This will will define the following variables:: +# +# MIR_FOUND - the system has Mir +# MIR_INCLUDE_DIRS - the Mir include directory +# MIR_LIBRARIES - the Mir libraries +# MIR_DEFINITIONS - the Mir definitions + + +if(PKG_CONFIG_FOUND) + pkg_check_modules (PC_MIR mirclient QUIET) +endif() + +find_path(MIR_INCLUDE_DIR NAMES mir_toolkit/mir_client_library.h + PATHS ${PC_MIR_INCLUDE_DIRS}) + +find_library(MIR_LIBRARY NAMES mirclient + PATHS ${PC_MIR_LIBRARIES} ${PC_MIR_LIBRARY_DIRS}) + +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (MIR + REQUIRED_VARS MIR_LIBRARY MIR_INCLUDE_DIR) + +if (MIR_FOUND) + set(MIR_LIBRARIES ${MIR_LIBRARY}) + set(MIR_INCLUDE_DIRS ${PC_MIR_INCLUDE_DIRS}) + set(MIR_DEFINITIONS -DHAVE_MIR=1) +endif() + +mark_as_advanced (MIR_LIBRARY MIR_INCLUDE_DIR) diff --git a/project/cmake/modules/FindTexturePacker.cmake b/project/cmake/modules/FindTexturePacker.cmake index 2229ff7..f9e4c75 100644 --- a/project/cmake/modules/FindTexturePacker.cmake +++ b/project/cmake/modules/FindTexturePacker.cmake @@ -3,6 +3,10 @@ # ----------------- # Finds the TexturePacker # +# If WITH_TEXTUREPACKER is defined and points to a directory, +# this path will be used to search for the Texturepacker binary +# +# # This will define the following (imported) targets:: # # TexturePacker::TexturePacker - The TexturePacker executable @@ -17,7 +21,21 @@ if(NOT TARGET TexturePacker::TexturePacker) set_target_properties(TexturePacker::TexturePacker PROPERTIES IMPORTED_LOCATION "${CORE_SOURCE_DIR}/tools/TexturePacker/TexturePacker.exe") else() - add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/TexturePacker build/texturepacker) - add_executable(TexturePacker::TexturePacker ALIAS TexturePacker) + if(WITH_TEXTUREPACKER) + get_filename_component(_tppath ${WITH_TEXTUREPACKER} ABSOLUTE) + find_program(TEXTUREPACKER_EXECUTABLE TexturePacker PATHS ${_tppath}) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(TexturePacker DEFAULT_MSG TEXTUREPACKER_EXECUTABLE) + if(TEXTUREPACKER_FOUND) + add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL) + set_target_properties(TexturePacker::TexturePacker PROPERTIES + IMPORTED_LOCATION "${TEXTUREPACKER_EXECUTABLE}") + endif() + mark_as_advanced(TEXTUREPACKER) + else() + add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/TexturePacker build/texturepacker) + add_executable(TexturePacker::TexturePacker ALIAS TexturePacker) + endif() endif() endif() diff --git a/project/cmake/modules/FindVAAPI.cmake b/project/cmake/modules/FindVAAPI.cmake index ce3fe1a..ea9a3c9 100644 --- a/project/cmake/modules/FindVAAPI.cmake +++ b/project/cmake/modules/FindVAAPI.cmake @@ -24,6 +24,8 @@ find_library(VAAPI_libva_LIBRARY NAMES va PATHS ${PC_VAAPI_libva_LIBDIR}) find_library(VAAPI_libva-x11_LIBRARY NAMES va-x11 PATHS ${PC_VAAPI_libva_LIBDIR}) +find_library(VAAPI_libva-drm_LIBRARY NAMES va-drm + PATHS ${PC_VAAPI_libva_LIBDIR}) if(PC_VAAPI_libva_VERSION) set(VAAPI_VERSION_STRING ${PC_VAAPI_libva_VERSION}) @@ -39,12 +41,12 @@ endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(VAAPI - REQUIRED_VARS VAAPI_libva_LIBRARY VAAPI_libva-x11_LIBRARY VAAPI_INCLUDE_DIR + REQUIRED_VARS VAAPI_libva_LIBRARY VAAPI_libva-x11_LIBRARY VAAPI_libva-drm_LIBRARY VAAPI_INCLUDE_DIR VERSION_VAR VAAPI_VERSION_STRING) if(VAAPI_FOUND) set(VAAPI_INCLUDE_DIRS ${VAAPI_INCLUDE_DIR}) - set(VAAPI_LIBRARIES ${VAAPI_libva_LIBRARY} ${VAAPI_libva-x11_LIBRARY}) + set(VAAPI_LIBRARIES ${VAAPI_libva_LIBRARY} ${VAAPI_libva-x11_LIBRARY} ${VAAPI_libva-drm_LIBRARY}) set(VAAPI_DEFINITIONS -DHAVE_LIBVA=1) if(NOT TARGET VAAPI::VAAPI_X11) @@ -52,14 +54,19 @@ if(VAAPI_FOUND) set_target_properties(VAAPI::VAAPI_X11 PROPERTIES IMPORTED_LOCATION "${VAAPI_libva-x11_LIBRARY}") endif() + if (NOT TARGET VAAPI::VAAPI_DRM) + add_library(VAAPI::VAAPI_DRM UNKNOWN IMPORTED) + set_target_properties(VAAPI::VAAPI_DRM PROPERTIES + IMPORTED_LOCATION "${VAAPI_libva-drm_LIBRARY}") + endif() if(NOT TARGET VAAPI::VAAPI) add_library(VAAPI::VAAPI UNKNOWN IMPORTED) set_target_properties(VAAPI::VAAPI PROPERTIES IMPORTED_LOCATION "${VAAPI_libva_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${VAAPI_INCLUDE_DIR}" INTERFACE_COMPILE_DEFINITIONS HAVE_LIBVA=1 - INTERFACE_LINK_LIBRARIES VAAPI::VAAPI_X11) + INTERFACE_LINK_LIBRARIES "VAAPI::VAAPI_X11 VAAPI::VAAPI_DRM") endif() endif() -mark_as_advanced(VAAPI_INCLUDE_DIR VAAPI_libva_LIBRARY VAAPI_libva-x11_LIBRARY) +mark_as_advanced(VAAPI_INCLUDE_DIR VAAPI_libva_LIBRARY VAAPI_libva-x11_LIBRARY VAAPI_libva-drm_LIBRARY) diff --git a/project/cmake/modules/FindXSLT.cmake b/project/cmake/modules/FindXSLT.cmake index 9be51d3..f7fea9e 100644 --- a/project/cmake/modules/FindXSLT.cmake +++ b/project/cmake/modules/FindXSLT.cmake @@ -43,7 +43,7 @@ if(XSLT_FOUND) IMPORTED_LOCATION "${XSLT_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${XSLT_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR}" INTERFACE_COMPILE_DEFINITIONS HAVE_LIBXSLT=1 - ITERFACE_LINK_LIBRARIES "${LIBXML2_LIBRARIES}") + INTERFACE_LINK_LIBRARIES "${LIBXML2_LIBRARIES}") endif() endif() diff --git a/project/cmake/scripts/android/Install.cmake b/project/cmake/scripts/android/Install.cmake index 5c66f41..025f194 100644 --- a/project/cmake/scripts/android/Install.cmake +++ b/project/cmake/scripts/android/Install.cmake @@ -91,7 +91,6 @@ foreach(lib IN LISTS required_dyload dyload_optional ITEMS Shairplay) endif() endforeach() add_bundle_file(${SMBCLIENT_LIBRARY} ${libdir} "") -add_bundle_file(${DEPENDS_PATH}/lib/librtmp.so ${libdir} "") # Main targets from Makefile.in if(CPU MATCHES i686) diff --git a/project/cmake/scripts/common/ArchSetup.cmake b/project/cmake/scripts/common/ArchSetup.cmake index 438e3bd..538fcaf 100644 --- a/project/cmake/scripts/common/ArchSetup.cmake +++ b/project/cmake/scripts/common/ArchSetup.cmake @@ -14,6 +14,7 @@ include(CheckCXXSourceCompiles) include(CheckSymbolExists) include(CheckFunctionExists) +include(CheckIncludeFile) # Macro to check if a given type exists in a given header # Arguments: @@ -109,6 +110,10 @@ check_symbol_exists(PRIdMAX inttypes.h HAVE_INTTYPES_H) check_builtin("long* temp=0; long ret=__sync_add_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_ADD_AND_FETCH) check_builtin("long* temp=0; long ret=__sync_sub_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_SUB_AND_FETCH) check_builtin("long* temp=0; long ret=__sync_val_compare_and_swap(temp, 1, 1)" HAS_BUILTIN_SYNC_VAL_COMPARE_AND_SWAP) +check_include_file(sys/inotify.h HAVE_INOTIFY) +if(HAVE_INOTIFY) + list(APPEND SYSTEM_DEFINES -DHAVE_INOTIFY=1) +endif() if(HAVE_POSIX_FADVISE) list(APPEND SYSTEM_DEFINES -DHAVE_POSIX_FADVISE=1) endif() diff --git a/project/cmake/scripts/common/CheckTargetPlatform.cmake b/project/cmake/scripts/common/CheckTargetPlatform.cmake index 5b5d9a1..82ee668 100644 --- a/project/cmake/scripts/common/CheckTargetPlatform.cmake +++ b/project/cmake/scripts/common/CheckTargetPlatform.cmake @@ -9,7 +9,11 @@ function(check_target_platform dir target_platform build) if(EXISTS ${dir} AND EXISTS ${dir}/platforms.txt) # get all the specified platforms file(STRINGS ${dir}/platforms.txt platforms) - string(REPLACE " " ";" platforms ${platforms}) + + list( LENGTH platforms listlen ) + if(${listlen} EQUAL 1) + string(REPLACE " " ";" platforms ${platforms}) + endif() # check if the addon/dependency should be built for the current platform foreach(platform ${platforms}) diff --git a/project/cmake/scripts/common/HandleDepends.cmake b/project/cmake/scripts/common/HandleDepends.cmake index 880ccdf..adc105b 100644 --- a/project/cmake/scripts/common/HandleDepends.cmake +++ b/project/cmake/scripts/common/HandleDepends.cmake @@ -17,6 +17,7 @@ function(add_addon_depends addon searchpath) file MATCHES noinstall.txt OR file MATCHES flags.txt OR file MATCHES deps.txt OR + file MATCHES "[a-z]+-deps[.]txt" OR file MATCHES platforms.txt)) message(STATUS "Processing ${file}") file(STRINGS ${file} def) @@ -49,7 +50,11 @@ function(add_addon_depends addon searchpath) if(EXISTS ${dir}/flags.txt) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/flags.txt) file(STRINGS ${dir}/flags.txt extraflags) + + # replace some custom placeholders + string(REPLACE "@MINGW_TOOLCHAIN_FILE@" "${OUTPUT_DIR}/Toolchain_mingw32.cmake" extraflags "${extraflags}") string(REPLACE " " ";" extraflags ${extraflags}) + message(STATUS "${id} extraflags: ${extraflags}") endif() @@ -103,11 +108,18 @@ function(add_addon_depends addon searchpath) endif() endif() - # on windows "patch.exe" can only handle CR-LF line-endings so we - # need to force it to also handle LF-only line endings set(PATCH_PROGRAM ${PATCH_EXECUTABLE}) + + # On Windows "patch.exe" can only handle CR-LF line-endings. + # Our patches have LF-only line endings - except when they + # have been checked out as part of a dependency hosted on Git + # and core.autocrlf=true. if(WIN32) - set(PATCH_PROGRAM "\"${PATCH_PROGRAM}\" --binary") + file(READ ${patch} patch_content_hex HEX) + # Force handle LF-only line endings + if(NOT patch_content_hex MATCHES "0d0a") + set(PATCH_PROGRAM "\"${PATCH_PROGRAM}\" --binary") + endif() endif() endif() @@ -131,8 +143,11 @@ function(add_addon_depends addon searchpath) set(INSTALL_COMMAND INSTALL_COMMAND "") endif() - # check if there's a deps.txt containing dependencies on other libraries - if(EXISTS ${dir}/deps.txt) + # check if there's a platform-specific or generic deps.txt containing dependencies on other libraries + if(EXISTS ${dir}/${CORE_SYSTEM_NAME}-deps.txt) + file(STRINGS ${dir}/${CORE_SYSTEM_NAME}-deps.txt deps) + message(STATUS "${id} depends: ${deps}") + elseif(EXISTS ${dir}/deps.txt) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/deps.txt) file(STRINGS ${dir}/deps.txt deps) message(STATUS "${id} depends: ${deps}") @@ -161,6 +176,10 @@ function(add_addon_depends addon searchpath) PATCH_COMMAND ${PATCH_COMMAND} "${INSTALL_COMMAND}") + if(CMAKE_VERSION VERSION_GREATER 3.5.9) + list(APPEND EXTERNALPROJECT_SETUP GIT_SHALLOW 1) + endif() + # if there's an url defined we need to pass that to externalproject_add() if(DEFINED url AND NOT "${url}" STREQUAL "") # check if there's a third parameter in the file @@ -172,6 +191,20 @@ function(add_addon_depends addon searchpath) GIT_REPOSITORY ${url} GIT_TAG ${revision} "${EXTERNALPROJECT_SETUP}") + + # For patchfiles to work, disable (users globally set) autocrlf=true + if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_GREATER 3.7) + message(AUTHOR_WARNING "Make use of GIT_CONFIG") + endif() + if(WIN32 AND patches) + externalproject_add_step(${id} gitconfig + COMMAND git config core.autocrlf false + COMMAND git rm -rf --cached . + COMMAND git reset --hard HEAD + COMMENT "Performing gitconfig step: Disabling autocrlf to enable patching for '${id}'" + DEPENDERS patch + WORKING_DIRECTORY ) + endif() else() set(CONFIGURE_COMMAND "") if(NOT WIN32) diff --git a/project/cmake/scripts/common/Macros.cmake b/project/cmake/scripts/common/Macros.cmake index 71c39ef..cce3245 100644 --- a/project/cmake/scripts/common/Macros.cmake +++ b/project/cmake/scripts/common/Macros.cmake @@ -155,9 +155,12 @@ function(core_add_shared_library name) add_library(${name} SHARED ${SOURCES} ${HEADERS} ${OTHERS}) set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY} RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY} - RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY} - RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY} OUTPUT_NAME ${OUTPUT_NAME} PREFIX "") + foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG) + set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY} + RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY}) + endforeach() set(LIBRARY_FILES ${LIBRARY_FILES} ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY}/${OUTPUT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} CACHE STRING "" FORCE) add_dependencies(${APP_NAME_LC}-libraries ${name}) @@ -595,9 +598,9 @@ macro(core_find_versions) set(APP_VERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}) if(APP_VERSION_TAG) set(APP_VERSION ${APP_VERSION}-${APP_VERSION_TAG}) + string(TOLOWER ${APP_VERSION_TAG} APP_VERSION_TAG_LC) endif() string(REPLACE "." "," FILE_VERSION ${APP_ADDON_API}.0) - string(TOLOWER ${APP_VERSION_TAG} APP_VERSION_TAG_LC) file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version REGEX "^.*GUILIB_API_VERSION (.*)$") string(REGEX REPLACE ".*\"(.*)\"" "\\1" guilib_version ${guilib_version}) file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version_min REGEX "^.*GUILIB_MIN_API_VERSION (.*)$") diff --git a/project/cmake/scripts/common/PrepareEnv.cmake b/project/cmake/scripts/common/PrepareEnv.cmake index 8e02382..51be739 100644 --- a/project/cmake/scripts/common/PrepareEnv.cmake +++ b/project/cmake/scripts/common/PrepareEnv.cmake @@ -51,43 +51,14 @@ foreach(binding ${bindings}) configure_file(${CORE_SOURCE_DIR}/${header} ${APP_INCLUDE_DIR} COPYONLY) endforeach() -### on windows we need a "patch" binary to be able to patch 3rd party sources -if(WIN32) - find_program(PATCH_FOUND NAMES patch patch.exe) - if(PATCH_FOUND) - message(STATUS "patch utility found at ${PATCH_FOUND}") - else() - set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-3") - set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip") - set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}") - set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE}) +### processing additional tools required by the platform +if(EXISTS ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/) + file(GLOB platform_tools ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/*.cmake) + foreach(platform_tool ${platform_tools}) + get_filename_component(platform_tool_name ${platform_tool} NAME_WE) + message(STATUS "Processing ${CORE_SYSTEM_NAME} specific tool: ${platform_tool_name}") - # download the archive containing patch.exe - message(STATUS "Downloading patch utility from ${PATCH_URL}...") - file(DOWNLOAD "${PATCH_URL}" "${PATCH_DOWNLOAD}" STATUS PATCH_DL_STATUS LOG PATCH_LOG SHOW_PROGRESS) - list(GET PATCH_DL_STATUS 0 PATCH_RETCODE) - if(NOT ${PATCH_RETCODE} EQUAL 0) - message(FATAL_ERROR "ERROR downloading ${PATCH_URL} - status: ${PATCH_DL_STATUS} log: ${PATCH_LOG}") - endif() - - # extract the archive containing patch.exe - execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${PATCH_DOWNLOAD} - WORKING_DIRECTORY ${BUILD_DIR}) - - # make sure the extraction worked and that patch.exe is there - set(PATCH_PATH ${BUILD_DIR}/${PATCH_ARCHIVE_NAME}) - set(PATCH_BINARY_PATH ${PATCH_PATH}/bin/patch.exe) - if(NOT EXISTS ${PATCH_PATH} OR NOT EXISTS ${PATCH_BINARY_PATH}) - message(FATAL_ERROR "ERROR extracting patch utility from ${PATCH_DOWNLOAD_DIR}") - endif() - - # copy patch.exe into the output directory - file(INSTALL ${PATCH_BINARY_PATH} DESTINATION ${ADDON_DEPENDS_PATH}/bin) - - # make sure that cmake can find the copied patch.exe - find_program(PATCH_FOUND NAMES patch patch.exe) - if(NOT PATCH_FOUND) - message(FATAL_ERROR "ERROR installing patch utility from ${PATCH_BINARY_PATH} to ${ADDON_DEPENDS_PATH}/bin") - endif() - endif() + # include the file + include(${platform_tool}) + endforeach() endif() diff --git a/project/cmake/scripts/ios/ArchSetup.cmake b/project/cmake/scripts/ios/ArchSetup.cmake index 56661e2..f3e8590 100644 --- a/project/cmake/scripts/ios/ArchSetup.cmake +++ b/project/cmake/scripts/ios/ArchSetup.cmake @@ -13,6 +13,7 @@ if(WITH_ARCH) set(ARCH ${WITH_ARCH}) else() if(CPU STREQUAL armv7 OR CPU STREQUAL arm64) + set(CMAKE_OSX_ARCHITECTURES ${CPU}) set(ARCH arm-osx) set(NEON False) else() @@ -34,3 +35,23 @@ list(APPEND DEPLIBS "-framework CoreFoundation" "-framework CoreVideo" set(ENABLE_DVDCSS OFF CACHE BOOL "" FORCE) set(ENABLE_OPTICAL OFF CACHE BOOL "" FORCE) + +set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "5.1") +set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2") + +set(CMAKE_XCODE_ATTRIBUTE_INLINES_ARE_PRIVATE_EXTERN OFF) +set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN OFF) +set(CMAKE_XCODE_ATTRIBUTE_COPY_PHASE_STRIP OFF) + +# Xcode strips dead code by default which breaks wrapping +set(CMAKE_XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING OFF) + +# Unify output directories for iOS packaging scripts +if(NOT CMAKE_GENERATOR MATCHES Xcode) + set(CORE_BUILD_CONFIG "${CORE_BUILD_CONFIG}-iphoneos") +endif() +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CORE_BUILD_DIR}/${CORE_BUILD_CONFIG}) +foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CORE_BUILD_DIR}/${CORE_BUILD_CONFIG}) +endforeach() diff --git a/project/cmake/scripts/ios/Install.cmake b/project/cmake/scripts/ios/Install.cmake index 052565f..c49fcd5 100644 --- a/project/cmake/scripts/ios/Install.cmake +++ b/project/cmake/scripts/ios/Install.cmake @@ -1,42 +1,54 @@ # IOS packaging -set(PACKAGE_OUTPUT_DIR ${CMAKE_BINARY_DIR}/build/${CORE_BUILD_CONFIG}-iphoneos) +set(BUNDLE_RESOURCES ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/Default-568h@2x.png + ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/Default-667h@2x.png + ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/Default-736h@3x.png + ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/Default-Landscape-736h@3x.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon29x29.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon29x29@2x.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon40x40.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon40x40@2x.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon50x50.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon50x50@2x.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon57x57.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon57x57@2x.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon60x60.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon60x60@2x.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon72x72.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon72x72@2x.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon76x76.png + ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon76x76@2x.png) -file(MAKE_DIRECTORY ${PACKAGE_OUTPUT_DIR}/${APP_NAME}.app) -set(BUNDLE_RESOURCES xbmc/platform/darwin/ios/Default-568h@2x.png - xbmc/platform/darwin/ios/Default-667h@2x.png - xbmc/platform/darwin/ios/Default-736h@3x.png - xbmc/platform/darwin/ios/Default-Landscape-736h@3x.png - tools/darwin/packaging/media/ios/rounded/AppIcon29x29.png - tools/darwin/packaging/media/ios/rounded/AppIcon29x29@2x.png - tools/darwin/packaging/media/ios/rounded/AppIcon40x40.png - tools/darwin/packaging/media/ios/rounded/AppIcon40x40@2x.png - tools/darwin/packaging/media/ios/rounded/AppIcon50x50.png - tools/darwin/packaging/media/ios/rounded/AppIcon50x50@2x.png - tools/darwin/packaging/media/ios/rounded/AppIcon57x57.png - tools/darwin/packaging/media/ios/rounded/AppIcon57x57@2x.png - tools/darwin/packaging/media/ios/rounded/AppIcon60x60.png - tools/darwin/packaging/media/ios/rounded/AppIcon60x60@2x.png - tools/darwin/packaging/media/ios/rounded/AppIcon72x72.png - tools/darwin/packaging/media/ios/rounded/AppIcon72x72@2x.png - tools/darwin/packaging/media/ios/rounded/AppIcon76x76.png - tools/darwin/packaging/media/ios/rounded/AppIcon76x76@2x.png) +if(CMAKE_GENERATOR STREQUAL Xcode) + set(RESOURCE_LOCATION ${APP_NAME}.app) +else() + set(RESOURCE_LOCATION ".") +endif() -foreach(resource IN LISTS BUNDLE_RESOURCES) - configure_file(${CORE_SOURCE_DIR}/${resource} ${PACKAGE_OUTPUT_DIR}/${APP_NAME}.app COPYONLY) +target_sources(${APP_NAME_LC} PRIVATE ${BUNDLE_RESOURCES}) +foreach(file IN LISTS BUNDLE_RESOURCES) + set_source_files_properties(${file} PROPERTIES MACOSX_PACKAGE_LOCATION ${RESOURCE_LOCATION}) endforeach() -configure_file(${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/English.lproj/InfoPlist.strings - ${PACKAGE_OUTPUT_DIR}/${APP_NAME}.app/English.lproj/InfoPlist.strings COPYONLY) -configure_file(${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/Info.plist.in - ${PACKAGE_OUTPUT_DIR}/${APP_NAME}.app/Info.plist @ONLY) +target_sources(${APP_NAME_LC} PRIVATE ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/English.lproj/InfoPlist.strings) +set_source_files_properties(${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/English.lproj/InfoPlist.strings PROPERTIES MACOSX_PACKAGE_LOCATION "${RESOURCE_LOCATION}/English.lproj") + +# Options for code signing propagated as env vars to Codesign.command via Xcode +set(IOS_CODE_SIGN_IDENTITY "" CACHE STRING "Code Sign Identity") +if(IOS_CODE_SIGN_IDENTITY) + set_target_properties(${APP_NAME_LC} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED TRUE + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ${IOS_CODE_SIGN_IDENTITY}) +endif() + +add_custom_command(TARGET ${APP_NAME_LC} POST_BUILD + # TODO: Remove in sync with CopyRootFiles-ios expecting the ".bin" file + COMMAND ${CMAKE_COMMAND} -E copy $ + $/${APP_NAME}.bin -add_custom_target(bundle - COMMAND ${CMAKE_COMMAND} -E copy $ ${PACKAGE_OUTPUT_DIR}/${APP_NAME}.app/${APP_NAME}.bin COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/DllPaths_generated.h ${CMAKE_BINARY_DIR}/xbmc/DllPaths_generated.h COMMAND "ACTION=build" - "TARGET_BUILD_DIR=${PACKAGE_OUTPUT_DIR}" + "TARGET_BUILD_DIR=$/.." "TARGET_NAME=${APP_NAME}.app" "APP_NAME=${APP_NAME}" "PRODUCT_NAME=${APP_NAME}" @@ -44,15 +56,22 @@ add_custom_target(bundle "SRCROOT=${CMAKE_BINARY_DIR}" ${CORE_SOURCE_DIR}/tools/darwin/Support/CopyRootFiles-ios.command COMMAND "XBMC_DEPENDS=${DEPENDS_PATH}" - "TARGET_BUILD_DIR=${PACKAGE_OUTPUT_DIR}" + "TARGET_BUILD_DIR=$/.." "TARGET_NAME=${APP_NAME}.app" "APP_NAME=${APP_NAME}" "PRODUCT_NAME=${APP_NAME}" "FULL_PRODUCT_NAME=${APP_NAME}.app" "WRAPPER_EXTENSION=app" "SRCROOT=${CMAKE_BINARY_DIR}" - ${CORE_SOURCE_DIR}/tools/darwin/Support/copyframeworks-ios.command) -add_dependencies(bundle ${APP_NAME_LC}) + ${CORE_SOURCE_DIR}/tools/darwin/Support/copyframeworks-ios.command + COMMAND "XBMC_DEPENDS_ROOT=${NATIVEPREFIX}/.." + "PLATFORM_NAME=${PLATFORM}" + "CODESIGNING_FOLDER_PATH=$" + "BUILT_PRODUCTS_DIR=$/.." + "WRAPPER_NAME=${APP_NAME}.app" + "APP_NAME=${APP_NAME}" + ${CORE_SOURCE_DIR}/tools/darwin/Support/Codesign.command +) set(DEPENDS_ROOT_FOR_XCODE ${NATIVEPREFIX}/..) configure_file(${CORE_SOURCE_DIR}/tools/darwin/packaging/ios/mkdeb-ios.sh.in @@ -61,14 +80,6 @@ configure_file(${CORE_SOURCE_DIR}/tools/darwin/packaging/migrate_to_kodi_ios.sh. ${CMAKE_BINARY_DIR}/tools/darwin/packaging/migrate_to_kodi_ios.sh @ONLY) add_custom_target(deb - COMMAND "XBMC_DEPENDS_ROOT=${NATIVEPREFIX}/.." - "PLATFORM_NAME=${PLATFORM}" - "CODESIGNING_FOLDER_PATH=${PACKAGE_OUTPUT_DIR}/${APP_NAME}.app" - "BUILT_PRODUCTS_DIR=${PACKAGE_OUTPUT_DIR}" - "WRAPPER_NAME=${APP_NAME}.app" - "APP_NAME=${APP_NAME}" - "CODE_SIGN_IDENTITY=\"\"" - ${CORE_SOURCE_DIR}/tools/darwin/Support/Codesign.command COMMAND sh ./mkdeb-ios.sh ${CORE_BUILD_CONFIG} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tools/darwin/packaging/ios) -add_dependencies(deb bundle) +add_dependencies(deb ${APP_NAME_LC}) diff --git a/project/cmake/scripts/linux/ArchSetup.cmake b/project/cmake/scripts/linux/ArchSetup.cmake index cae0bb8..bcd70df 100644 --- a/project/cmake/scripts/linux/ArchSetup.cmake +++ b/project/cmake/scripts/linux/ArchSetup.cmake @@ -39,3 +39,7 @@ if(CMAKE_BUILD_TYPE STREQUAL Coverage) set(COVERAGE_DEPENDS "\${APP_NAME_LC}" "\${APP_NAME_LC}-test") set(COVERAGE_EXCLUDES */test/* lib/* */lib/*) endif() + +if(ENABLE_MIR) + set(ENABLE_VDPAU OFF CACHE BOOL "Disabling VDPAU since no Mir support" FORCE) +endif() diff --git a/project/cmake/scripts/linux/Install.cmake b/project/cmake/scripts/linux/Install.cmake index 5458707..43e2e5e 100644 --- a/project/cmake/scripts/linux/Install.cmake +++ b/project/cmake/scripts/linux/Install.cmake @@ -137,9 +137,11 @@ install(FILES ${CORE_SOURCE_DIR}/privacy-policy.txt COMPONENT kodi) # Install kodi-tools-texturepacker -install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/texturepacker/TexturePacker - DESTINATION ${bindir} - COMPONENT kodi-tools-texturepacker) +if(NOT WITH_TEXTUREPACKER) + install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/texturepacker/TexturePacker + DESTINATION ${bindir} + COMPONENT kodi-tools-texturepacker) +endif() # Install kodi-addon-dev headers install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_types.h @@ -152,12 +154,14 @@ install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kod ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h + ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h ${CORE_SOURCE_DIR}/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h ${CORE_SOURCE_DIR}/xbmc/filesystem/IFileTypes.h + ${CORE_SOURCE_DIR}/xbmc/input/XBMC_vkeys.h DESTINATION ${includedir}/${APP_NAME_LC} COMPONENT kodi-addon-dev) @@ -310,6 +314,14 @@ install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kod DESTINATION ${includedir}/${APP_NAME_LC} COMPONENT kodi-peripheral-dev) +# Install kodi-game-dev +install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h + ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h + ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_types.h + DESTINATION ${includedir}/${APP_NAME_LC} + COMPONENT kodi-game-dev) + + # Install XBT skin files foreach(texture ${XBT_FILES}) string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${texture}) diff --git a/project/cmake/scripts/osx/Macros.cmake b/project/cmake/scripts/osx/Macros.cmake index 0d04439..52f87d1 100644 --- a/project/cmake/scripts/osx/Macros.cmake +++ b/project/cmake/scripts/osx/Macros.cmake @@ -2,7 +2,7 @@ function(core_link_library lib wraplib) if(CMAKE_GENERATOR MATCHES "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL Ninja) set(wrapper_obj cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o) elseif(CMAKE_GENERATOR MATCHES "Xcode") - set(wrapper_obj cores/dll-loader/exports/kodi.build/$(CONFIGURATION)/wrapper.build/Objects-$(CURRENT_VARIANT)/$(CURRENT_ARCH)/wrapper.o) + set(wrapper_obj cores/dll-loader/exports/kodi.build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/wrapper.build/Objects-$(CURRENT_VARIANT)/$(CURRENT_ARCH)/wrapper.o) else() message(FATAL_ERROR "Unsupported generator in core_link_library") endif() @@ -17,6 +17,13 @@ function(core_link_library lib wraplib) set(link_lib $) set(check_arg ${ARGV2}) set(data_arg ${ARGV3}) + + # iOS: EFFECTIVE_PLATFORM_NAME is not resolved + # http://public.kitware.com/pipermail/cmake/2016-March/063049.html + if(CORE_SYSTEM_NAME STREQUAL ios AND CMAKE_GENERATOR STREQUAL Xcode) + get_target_property(dir ${lib} BINARY_DIR) + set(link_lib ${dir}/${CORE_BUILD_CONFIG}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}) + endif() else() set(target ${ARGV2}) set(link_lib ${lib}) diff --git a/project/cmake/scripts/windows/tools/patch.cmake b/project/cmake/scripts/windows/tools/patch.cmake new file mode 100644 index 0000000..0ef2952 --- /dev/null +++ b/project/cmake/scripts/windows/tools/patch.cmake @@ -0,0 +1,37 @@ +find_program(PATCH_FOUND NAMES patch patch.exe) +if(PATCH_FOUND) + message(STATUS "patch utility found at ${PATCH_FOUND}") +else() + set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-1") + set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip") + set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}") + set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE}) + + # download the archive containing patch.exe + message(STATUS "Downloading patch utility from ${PATCH_URL}...") + file(DOWNLOAD "${PATCH_URL}" "${PATCH_DOWNLOAD}" STATUS PATCH_DL_STATUS LOG PATCH_LOG SHOW_PROGRESS) + list(GET PATCH_DL_STATUS 0 PATCH_RETCODE) + if(NOT PATCH_RETCODE EQUAL 0) + message(FATAL_ERROR "ERROR downloading ${PATCH_URL} - status: ${PATCH_DL_STATUS} log: ${PATCH_LOG}") + endif() + + # extract the archive containing patch.exe + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${PATCH_DOWNLOAD} + WORKING_DIRECTORY ${BUILD_DIR}) + + # make sure the extraction worked and that patch.exe is there + set(PATCH_PATH ${BUILD_DIR}/${PATCH_ARCHIVE_NAME}) + set(PATCH_BINARY_PATH ${PATCH_PATH}/bin/patch.exe) + if(NOT EXISTS ${PATCH_PATH} OR NOT EXISTS ${PATCH_BINARY_PATH}) + message(FATAL_ERROR "ERROR extracting patch utility from ${PATCH_PATH}") + endif() + + # copy patch.exe into the output directory + file(INSTALL ${PATCH_BINARY_PATH} DESTINATION ${ADDON_DEPENDS_PATH}/bin) + + # make sure that cmake can find the copied patch.exe + find_program(PATCH_FOUND NAMES patch patch.exe) + if(NOT PATCH_FOUND) + message(FATAL_ERROR "ERROR installing patch utility from ${PATCH_BINARY_PATH} to ${ADDON_DEPENDS_PATH}/bin") + endif() +endif() diff --git a/project/cmake/treedata/common/addons.txt b/project/cmake/treedata/common/addons.txt index 76410b7..f29e086 100644 --- a/project/cmake/treedata/common/addons.txt +++ b/project/cmake/treedata/common/addons.txt @@ -1,8 +1,7 @@ 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 -lib/addons/library.kodi.inputstream KODI_inputstream lib/addons/library.kodi.peripheral KODI_peripheral lib/addons/library.xbmc.addon XBMC_addon lib/addons/library.xbmc.codec XBMC_codec -lib/addons/library.xbmc.pvr XBMC_pvr diff --git a/project/cmake/treedata/common/cores.txt b/project/cmake/treedata/common/cores.txt index d23939d..8d79dd1 100644 --- a/project/cmake/treedata/common/cores.txt +++ b/project/cmake/treedata/common/cores.txt @@ -6,3 +6,4 @@ xbmc/cores/DllLoader/exports/util cores/dll-loader/exports/util xbmc/cores/ExternalPlayer cores/externalplayer xbmc/cores/paplayer cores/paplayer xbmc/cores/playercorefactory cores/playercorefactory +xbmc/cores/RetroPlayer cores/RetroPlayer diff --git a/project/cmake/treedata/common/games.txt b/project/cmake/treedata/common/games.txt index b622f5a..03d42bc 100644 --- a/project/cmake/treedata/common/games.txt +++ b/project/cmake/treedata/common/games.txt @@ -1,4 +1,12 @@ +xbmc/games games +xbmc/games/addons games/addons +xbmc/games/addons/playback games/addons/playback +xbmc/games/addons/savestates games/addons/savestates xbmc/games/controllers games/controllers xbmc/games/controllers/dialogs games/controllers/dialogs xbmc/games/controllers/guicontrols games/controllers/guicontrols xbmc/games/controllers/windows games/controllers/windows +xbmc/games/dialogs games/dialogs +xbmc/games/ports games/ports +xbmc/games/tags games/tags +xbmc/games/windows games/windows diff --git a/project/cmake/treedata/common/network.txt b/project/cmake/treedata/common/network.txt index 6331b2d..46da314 100644 --- a/project/cmake/treedata/common/network.txt +++ b/project/cmake/treedata/common/network.txt @@ -1,4 +1,2 @@ xbmc/network network -xbmc/network/httprequesthandler network/httprequesthandler -xbmc/network/httprequesthandler/python network/httprequesthandler/python xbmc/network/websocket network/websocket diff --git a/project/cmake/treedata/common/subdirs.txt b/project/cmake/treedata/common/subdirs.txt index e2bca7e..af91611 100644 --- a/project/cmake/treedata/common/subdirs.txt +++ b/project/cmake/treedata/common/subdirs.txt @@ -5,6 +5,7 @@ xbmc/addons/binary/interfaces/api1/Addon api1AddonCallbacks_Addon xbmc/addons/binary/interfaces/api1/AudioDSP api1AddonCallbacks_AudioDSP xbmc/addons/binary/interfaces/api1/AudioEngine api1AddonCallbacks_AudioEngine xbmc/addons/binary/interfaces/api1/Codec api1AddonCallbacks_Codec +xbmc/addons/binary/interfaces/api1/Game api1AddonCallbacks_Game xbmc/addons/binary/interfaces/api1/GUI api1AddonCallbacks_GUI xbmc/addons/binary/interfaces/api1/InputStream api1AddonCallbacks_InputStream xbmc/addons/binary/interfaces/api1/Peripheral api1AddonCallbacks_Peripheral @@ -18,6 +19,10 @@ xbmc/input input xbmc/input/joysticks input/joysticks xbmc/input/joysticks/dialogs input/joysticks/dialogs xbmc/input/joysticks/generic input/joysticks/generic +xbmc/input/keyboard input/keyboard +xbmc/input/keyboard/generic input/keyboard/generic +xbmc/input/mouse input/mouse +xbmc/input/mouse/generic input/mouse/generic xbmc/listproviders listproviders xbmc/media media xbmc/messaging messaging diff --git a/project/cmake/treedata/optional/common/mir.txt b/project/cmake/treedata/optional/common/mir.txt new file mode 100644 index 0000000..d681e8b --- /dev/null +++ b/project/cmake/treedata/optional/common/mir.txt @@ -0,0 +1 @@ +xbmc/windowing/mir windowing/mir # MIR diff --git a/project/cmake/treedata/optional/common/webserver.txt b/project/cmake/treedata/optional/common/webserver.txt new file mode 100644 index 0000000..b492006 --- /dev/null +++ b/project/cmake/treedata/optional/common/webserver.txt @@ -0,0 +1,2 @@ +xbmc/network/httprequesthandler network/httprequesthandler # MICROHTTPD +xbmc/network/httprequesthandler/python network/httprequesthandler/python # MICROHTTPD diff --git a/version.txt b/version.txt index c1b802c..a27c1bd 100644 --- a/version.txt +++ b/version.txt @@ -1,11 +1,11 @@ APP_NAME Kodi COMPANY_NAME XBMC-Foundation WEBSITE http://kodi.tv -VERSION_MAJOR 17 +VERSION_MAJOR 18 VERSION_MINOR 0 -VERSION_TAG BETA6 -VERSION_CODE 169806 -ADDON_API 16.9.806 +VERSION_TAG ALPHA1 +VERSION_CODE 179701 +ADDON_API 17.9.701 # Notes: # Change AC_INIT in configure.ac diff --git a/xbmc/addons/addon-bindings.mk b/xbmc/addons/addon-bindings.mk index 6bfed36..788b50e 100644 --- a/xbmc/addons/addon-bindings.mk +++ b/xbmc/addons/addon-bindings.mk @@ -13,6 +13,9 @@ BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_types.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h @@ -30,6 +33,7 @@ BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h @@ -38,3 +42,4 @@ BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h BINDINGS+=xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h BINDINGS+=xbmc/cores/AudioEngine/Utils/AEChannelData.h BINDINGS+=xbmc/filesystem/IFileTypes.h +BINDINGS+=xbmc/input/XBMC_vkeys.h diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h new file mode 100644 index 0000000..6057f46 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h @@ -0,0 +1,161 @@ +/* + * 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 this Program; see the file COPYING. If not, see + * . + * + */ +#ifndef KODI_GAME_CALLBACKS_H_ +#define KODI_GAME_CALLBACKS_H_ + +#include "kodi_game_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct CB_GameLib +{ + // --- Game callbacks -------------------------------------------------------- + + /*! + * \brief Requests the frontend to stop the current game + */ + void (*CloseGame)(void* addonData); + + /*! + * \brief Create a video stream for pixel data + * + * \param format The type of pixel data accepted by this stream + * \param width The frame width + * \param height The frame height + * \param rotation The rotation (counter-clockwise) of the video frames + * + * \return 0 on success or -1 if a video stream is already created + */ + int (*OpenPixelStream)(void* addonData, GAME_PIXEL_FORMAT format, unsigned int width, unsigned int height, GAME_VIDEO_ROTATION rotation); + + /*! + * \brief Create a video stream for encoded video data + * + * \param codec The video format accepted by this stream + * + * \return 0 on success or -1 if a video stream is already created + */ + int (*OpenVideoStream)(void* addonData, GAME_VIDEO_CODEC codec); + + /*! + * \brief Create an audio stream for PCM audio data + * + * \param format The type of audio data accepted by this stream + * \param channel_map The channel layout terminated by GAME_CH_NULL + * + * \return 0 on success or -1 if an audio stream is already created + */ + int (*OpenPCMStream)(void* addonData, GAME_PCM_FORMAT format, const GAME_AUDIO_CHANNEL* channel_map); + + /*! + * \brief Create an audio stream for encoded audio data + * + * \param codec The audio format accepted by this stream + * \param channel_map The channel layout terminated by GAME_CH_NULL + * + * \return 0 on success or -1 if an audio stream is already created + */ + int(*OpenAudioStream)(void* addonData, GAME_AUDIO_CODEC codec, const GAME_AUDIO_CHANNEL* channel_map); + + /*! + * \brief Add a data packet to an audio or video stream + * + * \param stream The target stream + * \param data The data packet + * \param size The size of the data + */ + void (*AddStreamData)(void* addonData, GAME_STREAM_TYPE stream, const uint8_t* data, unsigned int size); + + /*! + * \brief Free the specified stream + * + * \param stream The stream to close + */ + void (*CloseStream)(void* addonData, GAME_STREAM_TYPE stream); + + // -- Hardware rendering callbacks ------------------------------------------- + + /*! + * \brief Enable hardware rendering + * + * \param hw_info A struct of properties for the hardware rendering system + */ + void (*EnableHardwareRendering)(void* addonData, const game_hw_info* hw_info); + + /*! + * \brief Get the framebuffer for rendering + * + * \return The framebuffer + */ + uintptr_t (*HwGetCurrentFramebuffer)(void* addonData); + + /*! + * \brief Get a symbol from the hardware context + * + * \param symbol The symbol's name + * + * \return A function pointer for the specified symbol + */ + game_proc_address_t (*HwGetProcAddress)(void* addonData, const char* symbol); + + /*! + * \brief Called when a frame is being rendered + */ + void (*RenderFrame)(void* addonData); + + // --- Input callbacks ------------------------------------------------------- + + /*! + * \brief Begin reporting events for the specified joystick port + * + * \param port The zero-indexed port number + * + * \return true if the port was opened, false otherwise + */ + bool (*OpenPort)(void* addonData, unsigned int port); + + /*! + * \brief End reporting events for the specified port + * + * \param port The port number passed to OpenPort() + */ + void (*ClosePort)(void* addonData, unsigned int port); + + /*! + * \brief Notify the port of an input event + * + * \param event The input event + * + * Input events can arrive for the following sources: + * - GAME_INPUT_EVENT_MOTOR + * + * \return true if the event was handled, false otherwise + */ + bool (*InputEvent)(void* addonData, const game_input_event* event); + +} CB_GameLib; + +#ifdef __cplusplus +} +#endif + +#endif // KODI_GAME_CALLBACKS_H_ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h new file mode 100644 index 0000000..247f24b --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h @@ -0,0 +1,287 @@ +/* + * 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 this Program; see the file COPYING. If not, see + * . + * + */ +#ifndef KODI_GAME_DLL_H_ +#define KODI_GAME_DLL_H_ + +#include "kodi_game_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// --- Game API operations ----------------------------------------------------- + +/*! + * \brief Return GAME_API_VERSION_STRING + * + * The add-on is backwards compatible with the frontend if this API version is + * is at least the frontend's minimum API version. + * + * \return Must be GAME_API_VERSION_STRING + */ +const char* GetGameAPIVersion(void); + +/*! + * \brief Return GAME_MIN_API_VERSION_STRING + * + * The add-on is forwards compatible with the frontend if this minimum version + * is no more than the frontend's API version. + * + * \return Must be GAME_MIN_API_VERSION_STRING + */ +const char* GetMininumGameAPIVersion(void); + +// --- Game operations --------------------------------------------------------- + +/*! + * \brief Load a game + * + * \param url The URL to load + * + * return the error, or GAME_ERROR_NO_ERROR if the game was loaded + */ +GAME_ERROR LoadGame(const char* url); + +/*! + * \brief Load a game that requires multiple files + * + * \param type The game stype + * \param urls An array of urls + * \param urlCount The number of urls in the array + * + * \return the error, or GAME_ERROR_NO_ERROR if the game was loaded + */ +GAME_ERROR LoadGameSpecial(SPECIAL_GAME_TYPE type, const char** urls, size_t urlCount); + +/*! + * \brief Begin playing without a game file + * + * If the add-on supports standalone mode, it must add the + * tag to the extension point in addon.xml: + * + * false + * + * \return the error, or GAME_ERROR_NO_ERROR if the game add-on was loaded + */ +GAME_ERROR LoadStandalone(void); + +/*! + * \brief Unload the current game + * + * \return the error, or GAME_ERROR_NO_ERROR if the game was unloaded + */ +/*! Unloads a currently loaded game */ +GAME_ERROR UnloadGame(void); + +/*! + * \brief Get information about the loaded game + * + * \param info The info structure to fill + * + * \return the error, or GAME_ERROR_NO_ERROR if info was filled + */ +GAME_ERROR GetGameInfo(game_system_av_info* info); + +/*! + * \brief Get region of the loaded game + * + * \return the region, or GAME_REGION_UNKNOWN if unknown or no game is loaded + */ +GAME_REGION GetRegion(void); + +/*! + * \brief Return true if the client requires the frontend to provide a game loop + * + * The game loop is a thread that calls RunFrame() in a loop at a rate + * determined by the playback speed and the client's FPS. + * + * \return true if the frontend should provide a game loop, false otherwise + */ +bool RequiresGameLoop(void); + +/*! + * \brief Run a single frame for add-ons that use a game loop + * + * \return the error, or GAME_ERROR_NO_ERROR if there was no error + */ +GAME_ERROR RunFrame(void); + +/*! + * \brief Reset the current game + * + * \return the error, or GAME_ERROR_NO_ERROR if the game was reset + */ +GAME_ERROR Reset(void); + +// --- Hardware rendering operations ------------------------------------------- + +/*! + * \brief Invalidates the current HW context and reinitializes GPU resources + * + * Any GL state is lost, and must not be deinitialized explicitly. + * + * \return the error, or GAME_ERROR_NO_ERROR if the HW context was reset + */ +GAME_ERROR HwContextReset(void); + +/*! + * \brief Called before the context is destroyed + * + * Resources can be deinitialized at this step. + * + * \return the error, or GAME_ERROR_NO_ERROR if the HW context was destroyed + */ +GAME_ERROR HwContextDestroy(void); + +// --- Input operations -------------------------------------------------------- + +/*! + * \brief Notify the add-on of a status change on an open port + * + * Ports can be opened using the OpenPort() callback + * + * \param port Non-negative for a joystick port, or GAME_INPUT_PORT value otherwise + * \param collected True if a controller was connected, false if disconnected + * \param controller The connected controller + */ +void UpdatePort(int port, bool connected, const game_controller* controller); + +/*! + * \brief Check if input is accepted for a feature on the controller + * + * If only a subset of the controller profile is used, this can return false + * for unsupported features to not absorb their input. + * + * If the entire controller profile is used, this should always return true. + * + * \param controller_id The ID of the controller profile + * \param feature_name The name of a feature in that profile + * \return true if input is accepted for the feature, false otherwise + */ +bool HasFeature(const char* controller_id, const char* feature_name); + +/*! + * \brief Notify the add-on of an input event + * + * \param event The input event + * + * \return true if the event was handled, false otherwise + */ +bool InputEvent(const game_input_event* event); + +// --- Serialization operations ------------------------------------------------ + +/*! + * \brief Get the number of bytes required to serialize the game + * + * \return the number of bytes, or 0 if serialization is not supported + */ +size_t SerializeSize(void); + +/*! + * \brief Serialize the state of the game + * + * \param data The buffer receiving the serialized game data + * \param size The size of the buffer + * + * \return the error, or GAME_ERROR_NO_ERROR if the game was serialized into the buffer + */ +GAME_ERROR Serialize(uint8_t* data, size_t size); + +/*! + * \brief Deserialize the game from the given state + * + * \param data A buffer containing the game's new state + * \param size The size of the buffer + * + * \return the error, or GAME_ERROR_NO_ERROR if the game deserialized + */ +GAME_ERROR Deserialize(const uint8_t* data, size_t size); + +// --- Cheat operations -------------------------------------------------------- + +/*! + * \brief Reset the cheat system + * + * \return the error, or GAME_ERROR_NO_ERROR if the cheat system was reset + */ +GAME_ERROR CheatReset(void); + +/*! + * \brief Get a region of memory + * + * \param type The type of memory to retrieve + * \param data Set to the region of memory; must remain valid until UnloadGame() is called + * \param size Set to the size of the region of memory + * + * \return the error, or GAME_ERROR_NO_ERROR if data was set to a valid buffer + */ +GAME_ERROR GetMemory(GAME_MEMORY type, const uint8_t** data, size_t* size); + +/*! + * \brief Set a cheat code + * + * \param index + * \param enabled + * \param code + * + * \return the error, or GAME_ERROR_NO_ERROR if the cheat was set + */ +GAME_ERROR SetCheat(unsigned int index, bool enabled, const char* code); + +// --- Add-on helper implementation -------------------------------------------- + +/*! + * \brief Called by Kodi to assign the function pointers of this add-on to pClient + * + * Note that get_addon() is defined here, so it will be available in all + * compiled game clients. + */ +void __declspec(dllexport) get_addon(GameClient* pClient) +{ + pClient->GetGameAPIVersion = GetGameAPIVersion; + pClient->GetMininumGameAPIVersion = GetMininumGameAPIVersion; + pClient->LoadGame = LoadGame; + pClient->LoadGameSpecial = LoadGameSpecial; + pClient->LoadStandalone = LoadStandalone; + pClient->UnloadGame = UnloadGame; + pClient->GetGameInfo = GetGameInfo; + pClient->GetRegion = GetRegion; + pClient->RequiresGameLoop = RequiresGameLoop; + pClient->RunFrame = RunFrame; + pClient->Reset = Reset; + pClient->HwContextReset = HwContextReset; + pClient->HwContextDestroy = HwContextDestroy; + pClient->UpdatePort = UpdatePort; + pClient->HasFeature = HasFeature; + pClient->InputEvent = InputEvent; + pClient->SerializeSize = SerializeSize; + pClient->Serialize = Serialize; + pClient->Deserialize = Deserialize; + pClient->CheatReset = CheatReset; + pClient->GetMemory = GetMemory; + pClient->SetCheat = SetCheat; +} + +#ifdef __cplusplus +} +#endif + +#endif // KODI_GAME_DLL_H_ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_types.h new file mode 100644 index 0000000..fa2762d --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_types.h @@ -0,0 +1,487 @@ +/* + * 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 this Program; see the file COPYING. If not, see + * . + * + */ +#ifndef KODI_GAME_TYPES_H_ +#define KODI_GAME_TYPES_H_ + +/* current game API version */ +#define GAME_API_VERSION "1.0.28" + +/* min. game API version */ +#define GAME_MIN_API_VERSION "1.0.28" + +#include +#include + +#ifdef TARGET_WINDOWS + #include +#else + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __declspec + #define __declspec(X) + #endif +#endif + +#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 BUILD_KODI_ADDON +#include "XBMC_vkeys.h" +#else +#include "input/XBMC_vkeys.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*! Game add-on error codes */ +typedef enum GAME_ERROR +{ + GAME_ERROR_NO_ERROR, // no error occurred + GAME_ERROR_UNKNOWN, // an unknown error occurred + GAME_ERROR_NOT_IMPLEMENTED, // the method that the frontend called is not implemented + GAME_ERROR_REJECTED, // the command was rejected by the game client + GAME_ERROR_INVALID_PARAMETERS, // the parameters of the method that was called are invalid for this operation + GAME_ERROR_FAILED, // the command failed + GAME_ERROR_NOT_LOADED, // no game is loaded + GAME_ERROR_RESTRICTED, // game requires restricted resources +} GAME_ERROR; + +typedef enum GAME_STREAM_TYPE +{ + GAME_STREAM_UNKNOWN, + GAME_STREAM_AUDIO, + GAME_STREAM_VIDEO, +} GAME_STREAM_TYPE; + +typedef enum GAME_PIXEL_FORMAT +{ + GAME_PIXEL_FORMAT_UNKNOWN, + GAME_PIXEL_FORMAT_YUV420P, + GAME_PIXEL_FORMAT_0RGB8888, + GAME_PIXEL_FORMAT_RGB565, + GAME_PIXEL_FORMAT_0RGB1555, +} GAME_PIXEL_FORMAT; + +typedef enum GAME_VIDEO_CODEC +{ + GAME_VIDEO_CODEC_UNKNOWN, + GAME_VIDEO_CODEC_H264, + GAME_VIDEO_CODEC_THEORA, +} GAME_VIDEO_CODEC; + +typedef enum GAME_VIDEO_ROTATION // Counter-clockwise +{ + GAME_VIDEO_ROTATION_0, + GAME_VIDEO_ROTATION_90, + GAME_VIDEO_ROTATION_180, + GAME_VIDEO_ROTATION_270, +} GAME_VIDEO_ROTATION; + +typedef enum GAME_PCM_FORMAT +{ + GAME_PCM_FORMAT_UNKNOWN, + GAME_PCM_FORMAT_S16NE, +} GAME_PCM_FORMAT; + +typedef enum GAME_AUDIO_CODEC +{ + GAME_AUDIO_CODEC_UNKNOWN, + GAME_AUDIO_CODEC_OPUS, +} GAME_AUDIO_CODEC; + +typedef enum GAME_AUDIO_CHANNEL +{ + GAME_CH_NULL, // Channel list terminator + GAME_CH_FL, + GAME_CH_FR, + GAME_CH_FC, + GAME_CH_LFE, + GAME_CH_BL, + GAME_CH_BR, + GAME_CH_FLOC, + GAME_CH_FROC, + GAME_CH_BC, + GAME_CH_SL, + GAME_CH_SR, + GAME_CH_TFL, + GAME_CH_TFR, + GAME_CH_TFC, + GAME_CH_TC, + GAME_CH_TBL, + GAME_CH_TBR, + GAME_CH_TBC, + GAME_CH_BLOC, + GAME_CH_BROC, +} GAME_AUDIO_CHANNEL; + +// TODO +typedef enum GAME_HW_FRAME_BUFFER +{ + GAME_HW_FRAME_BUFFER_VALID, // Pass this to game_video_refresh if rendering to hardware + GAME_HW_FRAME_BUFFER_DUPLICATE, // Passing NULL to game_video_refresh is still a frame dupe as normal + GAME_HW_FRAME_BUFFER_RENDER, +} GAME_HW_FRAME_BUFFER; + +typedef enum GAME_HW_CONTEXT_TYPE +{ + GAME_HW_CONTEXT_NONE, + GAME_HW_CONTEXT_OPENGL, // OpenGL 2.x. Latest version available before 3.x+. Driver can choose to use latest compatibility context + GAME_HW_CONTEXT_OPENGLES2, // GLES 2.0 + GAME_HW_CONTEXT_OPENGL_CORE, // Modern desktop core GL context. Use major/minor fields to set GL version + GAME_HW_CONTEXT_OPENGLES3, // GLES 3.0 +} GAME_HW_CONTEXT_TYPE; + +typedef enum GAME_INPUT_PORT +{ + GAME_INPUT_PORT_JOYSTICK_START = 0, // Non-negative values are for joystick ports + GAME_INPUT_PORT_KEYBOARD = -1, + GAME_INPUT_PORT_MOUSE = -2, +} GAME_INPUT_PORT; + +typedef enum GAME_INPUT_EVENT_SOURCE +{ + GAME_INPUT_EVENT_DIGITAL_BUTTON, + GAME_INPUT_EVENT_ANALOG_BUTTON, + GAME_INPUT_EVENT_ANALOG_STICK, + GAME_INPUT_EVENT_ACCELEROMETER, + GAME_INPUT_EVENT_KEY, + GAME_INPUT_EVENT_RELATIVE_POINTER, + GAME_INPUT_EVENT_ABSOLUTE_POINTER, + GAME_INPUT_EVENT_MOTOR, +} GAME_INPUT_EVENT_SOURCE; + +typedef enum GAME_KEY_MOD +{ + GAME_KEY_MOD_NONE = 0x00, + + GAME_KEY_MOD_SHIFT = 0x01, + GAME_KEY_MOD_CTRL = 0x02, + GAME_KEY_MOD_ALT = 0x04, + GAME_KEY_MOD_RALT = 0x08, + GAME_KEY_MOD_META = 0x10, + + GAME_KEY_MOD_NUMLOCK = 0x20, + GAME_KEY_MOD_CAPSLOCK = 0x40, + GAME_KEY_MOD_SCROLLOCK = 0x80, +} GAME_KEY_MOD; + +/*! Returned from game_get_region() */ +typedef enum GAME_REGION +{ + GAME_REGION_UNKNOWN, + GAME_REGION_NTSC, + GAME_REGION_PAL, +} GAME_REGION; + +/*! +* Special game types passed into game_load_game_special(). Only used when +* multiple ROMs are required. +*/ +typedef enum SPECIAL_GAME_TYPE +{ + SPECIAL_GAME_TYPE_BSX, + SPECIAL_GAME_TYPE_BSX_SLOTTED, + SPECIAL_GAME_TYPE_SUFAMI_TURBO, + SPECIAL_GAME_TYPE_SUPER_GAME_BOY, +} SPECIAL_GAME_TYPE; + +typedef enum GAME_MEMORY +{ + /*! + * Passed to game_get_memory_data/size(). If the memory type doesn't apply + * to the implementation NULL/0 can be returned. + */ + GAME_MEMORY_MASK = 0xff, + + /*! + * Regular save ram. This ram is usually found on a game cartridge, backed + * up by a battery. If save game data is too complex for a single memory + * buffer, the SYSTEM_DIRECTORY environment callback can be used. + */ + GAME_MEMORY_SAVE_RAM = 0, + + /*! + * Some games have a built-in clock to keep track of time. This memory is + * usually just a couple of bytes to keep track of time. + */ + GAME_MEMORY_RTC = 1, + + /*! System ram lets a frontend peek into a game systems main RAM */ + GAME_MEMORY_SYSTEM_RAM = 2, + + /*! Video ram lets a frontend peek into a game systems video RAM (VRAM) */ + GAME_MEMORY_VIDEO_RAM = 3, + + /*! Special memory types */ + GAME_MEMORY_SNES_BSX_RAM = ((1 << 8) | GAME_MEMORY_SAVE_RAM), + GAME_MEMORY_SNES_BSX_PRAM = ((2 << 8) | GAME_MEMORY_SAVE_RAM), + GAME_MEMORY_SNES_SUFAMI_TURBO_A_RAM= ((3 << 8) | GAME_MEMORY_SAVE_RAM), + GAME_MEMORY_SNES_SUFAMI_TURBO_B_RAM= ((4 << 8) | GAME_MEMORY_SAVE_RAM), + GAME_MEMORY_SNES_GAME_BOY_RAM = ((5 << 8) | GAME_MEMORY_SAVE_RAM), + GAME_MEMORY_SNES_GAME_BOY_RTC = ((6 << 8) | GAME_MEMORY_RTC), +} GAME_MEMORY; + +/*! ID values for SIMD CPU features */ +typedef enum GAME_SIMD +{ + GAME_SIMD_SSE = (1 << 0), + GAME_SIMD_SSE2 = (1 << 1), + GAME_SIMD_VMX = (1 << 2), + GAME_SIMD_VMX128 = (1 << 3), + GAME_SIMD_AVX = (1 << 4), + GAME_SIMD_NEON = (1 << 5), + GAME_SIMD_SSE3 = (1 << 6), + GAME_SIMD_SSSE3 = (1 << 7), + GAME_SIMD_MMX = (1 << 8), + GAME_SIMD_MMXEXT = (1 << 9), + GAME_SIMD_SSE4 = (1 << 10), + GAME_SIMD_SSE42 = (1 << 11), + GAME_SIMD_AVX2 = (1 << 12), + GAME_SIMD_VFPU = (1 << 13), +} GAME_SIMD; + +typedef enum GAME_ROTATION +{ + GAME_ROTATION_0_CW, + GAME_ROTATION_90_CW, + GAME_ROTATION_180_CW, + GAME_ROTATION_270_CW, +} GAME_ROTATION; + +typedef struct game_controller +{ + const char* controller_id; + unsigned int digital_button_count; + unsigned int analog_button_count; + unsigned int analog_stick_count; + unsigned int accelerometer_count; + unsigned int key_count; + unsigned int rel_pointer_count; + unsigned int abs_pointer_count; + unsigned int motor_count; +} ATTRIBUTE_PACKED game_controller; + +typedef struct game_digital_button_event +{ + bool pressed; +} ATTRIBUTE_PACKED game_digital_button_event; + +typedef struct game_analog_button_event +{ + float magnitude; +} ATTRIBUTE_PACKED game_analog_button_event; + +typedef struct game_analog_stick_event +{ + float x; + float y; +} ATTRIBUTE_PACKED game_analog_stick_event; + +typedef struct game_accelerometer_event +{ + float x; + float y; + float z; +} ATTRIBUTE_PACKED game_accelerometer_event; + +typedef struct game_key_event +{ + bool pressed; + XBMCVKey character; + GAME_KEY_MOD modifiers; +} ATTRIBUTE_PACKED game_key_event; + +typedef struct game_rel_pointer_event +{ + int x; + int y; +} ATTRIBUTE_PACKED game_rel_pointer_event; + +typedef struct game_abs_pointer_event +{ + bool pressed; + float x; + float y; +} ATTRIBUTE_PACKED game_abs_pointer_event; + +typedef struct game_motor_event +{ + float magnitude; +} ATTRIBUTE_PACKED game_motor_event; + +typedef struct game_input_event +{ + GAME_INPUT_EVENT_SOURCE type; + int port; + const char* controller_id; + const char* feature_name; + union + { + struct game_digital_button_event digital_button; + struct game_analog_button_event analog_button; + struct game_analog_stick_event analog_stick; + struct game_accelerometer_event accelerometer; + struct game_key_event key; + struct game_rel_pointer_event rel_pointer; + struct game_abs_pointer_event abs_pointer; + struct game_motor_event motor; + }; +} ATTRIBUTE_PACKED game_input_event; + +struct game_geometry +{ + unsigned base_width; // Nominal video width of game + unsigned base_height; // Nominal video height of game + unsigned max_width; // Maximum possible width of game + unsigned max_height; // Maximum possible height of game + float aspect_ratio; // Nominal aspect ratio of game. If aspect_ratio is <= 0.0, + // an aspect ratio of base_width / base_height is assumed. + // A frontend could override this setting if desired. +}; + +struct game_system_timing +{ + double fps; // FPS of video content. + double sample_rate; // Sampling rate of audio. +}; + +struct game_system_av_info +{ + struct game_geometry geometry; + struct game_system_timing timing; +}; + +typedef void (*game_proc_address_t)(void); + +struct game_hw_info +{ + GAME_HW_CONTEXT_TYPE context_type; // Which API to use. Set by game client + bool depth; // Set if render buffers should have depth component attached + bool stencil; // Set if stencil buffers should be attached + // If depth and stencil are true, a packed 24/8 buffer will be added. Only attaching stencil is invalid and will be ignored + bool bottom_left_origin; // Use conventional bottom-left origin convention. Is false, standard top-left origin semantics are used + unsigned version_major; // Major version number for core GL context + unsigned version_minor; // Minor version number for core GL context + bool cache_context; // If this is true, the frontend will go very far to avoid resetting context in scenarios like toggling fullscreen, etc. + // The reset callback might still be called in extreme situations such as if the context is lost beyond recovery + // For optimal stability, set this to false, and allow context to be reset at any time + bool debug_context; // Creates a debug context +}; + +/*! Properties passed to the ADDON_Create() method of a game client */ +typedef struct game_client_properties +{ + /*! + * The path of the game client being loaded. + */ + const char* game_client_dll_path; + + /*! + * Paths to proxy DLLs used to load the game client. + */ + const char** proxy_dll_paths; + + /*! + * Number of proxy DLL paths provided. + */ + unsigned int proxy_dll_count; + + /*! + * The "system" directories of the frontend. These directories can be used to + * store system-specific ROMs such as BIOSes, configuration data, etc. + */ + const char** resource_directories; + + /*! + * Number of resource directories provided + */ + unsigned int resource_directory_count; + + /*! + * The writable directory of the frontend. This directory can be used to store + * SRAM, memory cards, high scores, etc, if the game client cannot use the + * regular memory interface, GetMemoryData(). + */ + const char* profile_directory; + + /*! + * The value of the property from addon.xml + */ + bool supports_vfs; + + /*! + * The extensions in the property from addon.xml + */ + const char** extensions; + + /*! + * Number of extensions provided + */ + unsigned int extension_count; +} game_client_properties; + +/*! Structure to transfer the methods from kodi_game_dll.h to Kodi */ +typedef struct GameClient +{ + const char* (__cdecl* GetGameAPIVersion)(void); + const char* (__cdecl* GetMininumGameAPIVersion)(void); + GAME_ERROR (__cdecl* LoadGame)(const char*); + GAME_ERROR (__cdecl* LoadGameSpecial)(SPECIAL_GAME_TYPE, const char**, size_t); + GAME_ERROR (__cdecl* LoadStandalone)(void); + GAME_ERROR (__cdecl* UnloadGame)(void); + GAME_ERROR (__cdecl* GetGameInfo)(game_system_av_info*); + GAME_REGION (__cdecl* GetRegion)(void); + bool (__cdecl* RequiresGameLoop)(void); + GAME_ERROR (__cdecl* RunFrame)(void); + GAME_ERROR (__cdecl* Reset)(void); + GAME_ERROR (__cdecl* HwContextReset)(void); + GAME_ERROR (__cdecl* HwContextDestroy)(void); + void (__cdecl* UpdatePort)(int, bool, const game_controller*); + bool (__cdecl* HasFeature)(const char* controller_id, const char* feature_name); + bool (__cdecl* InputEvent)(const game_input_event*); + size_t (__cdecl* SerializeSize)(void); + GAME_ERROR (__cdecl* Serialize)(uint8_t*, size_t); + GAME_ERROR (__cdecl* Deserialize)(const uint8_t*, size_t); + GAME_ERROR (__cdecl* CheatReset)(void); + GAME_ERROR (__cdecl* GetMemory)(GAME_MEMORY, const uint8_t**, size_t*); + GAME_ERROR (__cdecl* SetCheat)(unsigned int, bool, const char*); +} GameClient; + +#ifdef __cplusplus +} +#endif + +#endif // KODI_GAME_TYPES_H_ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h index 3721971..8dc49c0 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h @@ -122,7 +122,7 @@ extern "C" * @return True if the seek operation was possible * @remarks Optional, and only used if addon has its own demuxer. */ - bool DemuxSeekTime(int time, bool backwards, double *startpts); + bool DemuxSeekTime(double time, bool backwards, double *startpts); /*! * Notify the InputStream addon/demuxer that XBMC wishes to change playback speed diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h index ad47bb5..46e9d03 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h @@ -20,9 +20,16 @@ * */ +#ifdef TARGET_WINDOWS +#include +#else #ifndef __cdecl #define __cdecl #endif +#ifndef __declspec +#define __declspec(X) +#endif +#endif #ifdef BUILD_KODI_ADDON #include "DVDDemuxPacket.h" @@ -31,7 +38,7 @@ #endif /* current API version */ -#define INPUTSTREAM_API_VERSION "1.0.5" +#define INPUTSTREAM_API_VERSION "1.0.6" extern "C" { @@ -140,7 +147,7 @@ extern "C" { void (__cdecl* DemuxAbort)(void); void (__cdecl* DemuxFlush)(void); DemuxPacket* (__cdecl* DemuxRead)(void); - bool (__cdecl* DemuxSeekTime)(int, bool, double*); + bool (__cdecl* DemuxSeekTime)(double, bool, double*); void (__cdecl* DemuxSetSpeed)(int); void (__cdecl* SetVideoResolution)(int, int); diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h index 2df5622..d7c4282 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h @@ -51,7 +51,7 @@ #endif /* current Peripheral API version */ -#define PERIPHERAL_API_VERSION "1.2.0" +#define PERIPHERAL_API_VERSION "1.2.1" /* min. Peripheral API version */ #define PERIPHERAL_MIN_API_VERSION "1.2.0" @@ -84,6 +84,7 @@ extern "C" { PERIPHERAL_TYPE_UNKNOWN, PERIPHERAL_TYPE_JOYSTICK, + PERIPHERAL_TYPE_KEYBOARD, } PERIPHERAL_TYPE; typedef struct PERIPHERAL_INFO diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h new file mode 100644 index 0000000..b5a46dd --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h @@ -0,0 +1,238 @@ +/* + * 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 this Program; see the file COPYING. If not, see + * . + * + */ +#pragma once + +#include "libXBMC_addon.h" +#include "kodi_game_callbacks.h" + +#include +#include + +#if defined(ANDROID) + #include +#endif + +#ifdef _WIN32 + #define GAME_HELPER_DLL "\\library.kodi.game\\libKODI_game" ADDON_HELPER_EXT +#else + #define GAME_HELPER_DLL_NAME "libKODI_game-" ADDON_HELPER_ARCH ADDON_HELPER_EXT + #define GAME_HELPER_DLL "/library.kodi.game/" GAME_HELPER_DLL_NAME +#endif + +#define GAME_REGISTER_SYMBOL(dll, functionPtr) \ + CHelper_libKODI_game::RegisterSymbol(dll, functionPtr, #functionPtr) + +class CHelper_libKODI_game +{ +public: + CHelper_libKODI_game(void) : + GAME_register_me(nullptr), + GAME_unregister_me(nullptr), + GAME_close_game(nullptr), + GAME_open_pixel_stream(nullptr), + GAME_open_video_stream(nullptr), + GAME_open_pcm_stream(nullptr), + GAME_open_audio_stream(nullptr), + GAME_add_stream_data(nullptr), + GAME_close_stream(nullptr), + GAME_enable_hardware_rendering(nullptr), + GAME_hw_get_current_framebuffer(nullptr), + GAME_hw_get_proc_address(nullptr), + GAME_render_frame(nullptr), + GAME_open_port(nullptr), + GAME_close_port(nullptr), + GAME_input_event(nullptr), + m_handle(nullptr), + m_callbacks(nullptr), + m_libKODI_game(nullptr) + { + } + + ~CHelper_libKODI_game(void) + { + if (m_libKODI_game) + { + GAME_unregister_me(m_handle, m_callbacks); + dlclose(m_libKODI_game); + } + } + + template + static bool RegisterSymbol(void* dll, T& functionPtr, const char* strFunctionPtr) + { + return (functionPtr = (T)dlsym(dll, strFunctionPtr)) != NULL; + } + + /*! + * @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 = handle; + + std::string libBasePath; + libBasePath = ((cb_array*)m_handle)->libBasePath; + libBasePath += GAME_HELPER_DLL; + +#if defined(ANDROID) + struct stat st; + if (stat(libBasePath.c_str(),&st) != 0) + { + std::string tempbin = getenv("XBMC_ANDROID_LIBS"); + libBasePath = tempbin + "/" + GAME_HELPER_DLL_NAME; + } +#endif + + m_libKODI_game = dlopen(libBasePath.c_str(), RTLD_LAZY); + if (m_libKODI_game == NULL) + { + fprintf(stderr, "Unable to load %s\n", dlerror()); + return false; + } + + try + { + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_register_me)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_unregister_me)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_close_game)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_open_pixel_stream)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_open_video_stream)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_open_pcm_stream)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_open_audio_stream)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_add_stream_data)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_close_stream)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_enable_hardware_rendering)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_hw_get_current_framebuffer)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_hw_get_proc_address)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_render_frame)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_open_port)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_close_port)) throw false; + if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_input_event)) throw false; + } + catch (const bool& bSuccess) + { + fprintf(stderr, "ERROR: Unable to assign function %s\n", dlerror()); + return bSuccess; + } + + m_callbacks = GAME_register_me(m_handle); + return m_callbacks != NULL; + } + + void CloseGame(void) + { + return GAME_close_game(m_handle, m_callbacks); + } + + bool OpenPixelStream(GAME_PIXEL_FORMAT format, unsigned int width, unsigned int height, GAME_VIDEO_ROTATION rotation) + { + return GAME_open_pixel_stream(m_handle, m_callbacks, format, width, height, rotation) == 0; + } + + bool OpenVideoStream(GAME_VIDEO_CODEC codec) + { + return GAME_open_video_stream(m_handle, m_callbacks, codec) == 0; + } + + bool OpenPCMStream(GAME_PCM_FORMAT format, const GAME_AUDIO_CHANNEL* channel_map) + { + return GAME_open_pcm_stream(m_handle, m_callbacks, format, channel_map) == 0; + } + + bool OpenAudioStream(GAME_AUDIO_CODEC codec, const GAME_AUDIO_CHANNEL* channel_map) + { + return GAME_open_audio_stream(m_handle, m_callbacks, codec, channel_map) == 0; + } + + void AddStreamData(GAME_STREAM_TYPE stream, const uint8_t* data, unsigned int size) + { + GAME_add_stream_data(m_handle, m_callbacks, stream, data, size); + } + + void CloseStream(GAME_STREAM_TYPE stream) + { + GAME_close_stream(m_handle, m_callbacks, stream); + } + + void EnableHardwareRendering(const struct game_hw_info* hw_info) + { + return GAME_enable_hardware_rendering(m_handle, m_callbacks, hw_info); + } + + uintptr_t HwGetCurrentFramebuffer(void) + { + return GAME_hw_get_current_framebuffer(m_handle, m_callbacks); + } + + game_proc_address_t HwGetProcAddress(const char* sym) + { + return GAME_hw_get_proc_address(m_handle, m_callbacks, sym); + } + + void RenderFrame() + { + return GAME_render_frame(m_handle, m_callbacks); + } + + bool OpenPort(unsigned int port) + { + return GAME_open_port(m_handle, m_callbacks, port); + } + + void ClosePort(unsigned int port) + { + return GAME_close_port(m_handle, m_callbacks, port); + } + + bool InputEvent(const game_input_event& event) + { + return GAME_input_event(m_handle, m_callbacks, &event); + } + +protected: + CB_GameLib* (*GAME_register_me)(void* handle); + void (*GAME_unregister_me)(void* handle, CB_GameLib* cb); + void (*GAME_close_game)(void* handle, CB_GameLib* cb); + int (*GAME_open_pixel_stream)(void* handle, CB_GameLib* cb, GAME_PIXEL_FORMAT, unsigned int, unsigned int, GAME_VIDEO_ROTATION); + int (*GAME_open_video_stream)(void* handle, CB_GameLib* cb, GAME_VIDEO_CODEC); + int (*GAME_open_pcm_stream)(void* handle, CB_GameLib* cb, GAME_PCM_FORMAT, const GAME_AUDIO_CHANNEL*); + int (*GAME_open_audio_stream)(void* handle, CB_GameLib* cb, GAME_AUDIO_CODEC, const GAME_AUDIO_CHANNEL*); + int (*GAME_add_stream_data)(void* handle, CB_GameLib* cb, GAME_STREAM_TYPE, const uint8_t*, unsigned int); + int (*GAME_close_stream)(void* handle, CB_GameLib* cb, GAME_STREAM_TYPE); + void (*GAME_enable_hardware_rendering)(void* handle, CB_GameLib* cb, const struct game_hw_info*); + uintptr_t (*GAME_hw_get_current_framebuffer)(void* handle, CB_GameLib* cb); + game_proc_address_t (*GAME_hw_get_proc_address)(void* handle, CB_GameLib* cb, const char*); + void (*GAME_render_frame)(void* handle, CB_GameLib* cb); + bool (*GAME_open_port)(void* handle, CB_GameLib* cb, unsigned int); + void (*GAME_close_port)(void* handle, CB_GameLib* cb, unsigned int); + bool (*GAME_input_event)(void* handle, CB_GameLib* cb, const game_input_event* event); + +private: + void* m_handle; + CB_GameLib* m_callbacks; + void* m_libKODI_game; + + struct cb_array + { + const char* libBasePath; + }; +}; diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h index 3fe12c9..b699fa0 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h @@ -615,7 +615,6 @@ public: private: CAddonGUIWindow *m_Window; - int m_ControlId; GUIHANDLE m_SpinHandle; void *m_Handle; void *m_cb; @@ -634,7 +633,6 @@ public: private: CAddonGUIWindow *m_Window; - int m_ControlId; GUIHANDLE m_ButtonHandle; void *m_Handle; void *m_cb; @@ -654,7 +652,6 @@ public: private: CAddonGUIWindow *m_Window; - int m_ControlId; GUIHANDLE m_ProgressHandle; void *m_Handle; void *m_cb; @@ -684,7 +681,6 @@ public: private: CAddonGUIWindow *m_Window; - int m_ControlId; GUIHANDLE m_SliderHandle; void *m_Handle; void *m_cb; @@ -715,7 +711,6 @@ public: private: CAddonGUIWindow *m_Window; - int m_ControlId; GUIHANDLE m_SettingsSliderHandle; void *m_Handle; void *m_cb; @@ -825,7 +820,6 @@ public: private: CAddonGUIWindow *m_Window; - int m_ControlId; GUIHANDLE m_RenderingHandle; void *m_Handle; void *m_cb; diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h index a6e83cb..c55a42b 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h @@ -33,27 +33,40 @@ #include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h" #endif -#define INPUTSTREAM_HELPER_DLL KODI_DLL("inputstream") -#define INPUTSTREAM_HELPER_DLL_NAME KODI_DLL_NAME("inputstream") - /* current input stream API version */ #define KODI_INPUTSTREAM_API_VERSION "1.0.0" +namespace KodiAPI +{ +namespace V1 +{ +namespace InputStream +{ + +typedef struct CB_INPUTSTREAMLib +{ + void (*FreeDemuxPacket)(void *addonData, DemuxPacket* pPacket); + DemuxPacket* (*AllocateDemuxPacket)(void *addonData, int iDataSize); +} CB_INPUTSTREAMLib; + +} /* namespace InputStream */ +} /* namespace V1 */ +} /* namespace KodiAPI */ + class CHelper_libKODI_inputstream { public: CHelper_libKODI_inputstream(void) { - m_libKODI_inputstream = nullptr; m_Handle = nullptr; + m_Callbacks = nullptr; } ~CHelper_libKODI_inputstream(void) { - if (m_libKODI_inputstream) + if (m_Handle && m_Callbacks) { - INPUTSTREAM_unregister_me(m_Handle, m_Callbacks); - dlclose(m_libKODI_inputstream); + m_Handle->INPUTSTREAMLib_UnRegisterMe(m_Handle->addonData, m_Callbacks); } } @@ -64,52 +77,12 @@ public: */ bool RegisterMe(void* handle) { - m_Handle = handle; - - std::string libBasePath; - libBasePath = ((cb_array*)m_Handle)->libPath; - libBasePath += INPUTSTREAM_HELPER_DLL; - - m_libKODI_inputstream = dlopen(libBasePath.c_str(), RTLD_LAZY); - if (m_libKODI_inputstream == nullptr) - { - fprintf(stderr, "Unable to load %s\n", dlerror()); - return false; - } - - INPUTSTREAM_register_me = (void* (*)(void *HANDLE)) - dlsym(m_libKODI_inputstream, "INPUTSTREAM_register_me"); - if (INPUTSTREAM_register_me == nullptr) - { - fprintf(stderr, "Unable to assign function %s\n", dlerror()); - return false; - } + m_Handle = static_cast(handle); + if (m_Handle) + m_Callbacks = (KodiAPI::V1::InputStream::CB_INPUTSTREAMLib*)m_Handle->INPUTSTREAMLib_RegisterMe(m_Handle->addonData); + if (!m_Callbacks) + fprintf(stderr, "libKODI_inputstream-ERROR: InputStream_RegisterMe can't get callback table from Kodi !!!\n"); - INPUTSTREAM_unregister_me = (void (*)(void* HANDLE, void* CB)) - dlsym(m_libKODI_inputstream, "INPUTSTREAM_unregister_me"); - if (INPUTSTREAM_unregister_me == nullptr) - { - fprintf(stderr, "Unable to assign function %s\n", dlerror()); - return false; - } - - INPUTSTREAM_free_demux_packet = (void (*)(void* HANDLE, void* CB, DemuxPacket* pPacket)) - dlsym(m_libKODI_inputstream, "INPUTSTREAM_free_demux_packet"); - if (INPUTSTREAM_free_demux_packet == NULL) - { - fprintf(stderr, "Unable to assign function %s\n", dlerror()); - return false; - } - - INPUTSTREAM_allocate_demux_packet = (DemuxPacket* (*)(void* HANDLE, void* CB, int iDataSize)) - dlsym(m_libKODI_inputstream, "INPUTSTREAM_allocate_demux_packet"); - if (INPUTSTREAM_allocate_demux_packet == NULL) - { - fprintf(stderr, "Unable to assign function %s\n", dlerror()); - return false; - } - - m_Callbacks = INPUTSTREAM_register_me(m_Handle); return m_Callbacks != nullptr; } @@ -120,7 +93,7 @@ public: */ DemuxPacket* AllocateDemuxPacket(int iDataSize) { - return INPUTSTREAM_allocate_demux_packet(m_Handle, m_Callbacks, iDataSize); + return m_Callbacks->AllocateDemuxPacket(m_Handle->addonData, iDataSize); } /*! @@ -129,21 +102,10 @@ public: */ void FreeDemuxPacket(DemuxPacket* pPacket) { - return INPUTSTREAM_free_demux_packet(m_Handle, m_Callbacks, pPacket); + return m_Callbacks->FreeDemuxPacket(m_Handle->addonData, pPacket); } -protected: - void* (*INPUTSTREAM_register_me)(void*); - void (*INPUTSTREAM_unregister_me)(void*, void*); - void (*INPUTSTREAM_free_demux_packet)(void*, void*, DemuxPacket*); - DemuxPacket* (*INPUTSTREAM_allocate_demux_packet)(void*, void*, int); - private: - void* m_libKODI_inputstream; - void* m_Handle; - void* m_Callbacks; - struct cb_array - { - const char* libPath; - }; + AddonCB* m_Handle; + KodiAPI::V1::InputStream::CB_INPUTSTREAMLib* m_Callbacks; }; diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h index 70bd19b..d9f72c1 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h @@ -116,6 +116,49 @@ typedef intptr_t ssize_t; /* current addon API version */ #define KODI_ADDON_API_VERSION "1.0.0" +typedef void* (*KODIAddOnLib_RegisterMe)(void *addonData); +typedef void (*KODIAddOnLib_UnRegisterMe)(void *addonData, void *cbTable); +typedef void* (*KODIAudioEngineLib_RegisterMe)(void *addonData); +typedef void (*KODIAudioEngineLib_UnRegisterMe)(void *addonData, void *cbTable); +typedef void* (*KODIGUILib_RegisterMe)(void *addonData); +typedef void (*KODIGUILib_UnRegisterMe)(void *addonData, void *cbTable); +typedef void* (*KODIPVRLib_RegisterMe)(void *addonData); +typedef void (*KODIPVRLib_UnRegisterMe)(void *addonData, void *cbTable); +typedef void* (*KODIADSPLib_RegisterMe)(void *addonData); +typedef void (*KODIADSPLib_UnRegisterMe)(void *addonData, void *cbTable); +typedef void* (*KODICodecLib_RegisterMe)(void *addonData); +typedef void (*KODICodecLib_UnRegisterMe)(void *addonData, void *cbTable); +typedef void* (*KODIINPUTSTREAMLib_RegisterMe)(void *addonData); +typedef void (*KODIINPUTSTREAMLib_UnRegisterMe)(void *addonData, void *cbTable); +typedef void* (*KODIPeripheralLib_RegisterMe)(void *addonData); +typedef void (*KODIPeripheralLib_UnRegisterMe)(void *addonData, void *cbTable); +typedef void* (*KODIGameLib_RegisterMe)(void *addonData); +typedef void (*KODIGameLib_UnRegisterMe)(void *addonData, void *cbTable); + +typedef struct AddonCB +{ + const char* libBasePath; ///< Never, never change this!!! + void* addonData; + KODIAddOnLib_RegisterMe AddOnLib_RegisterMe; + KODIAddOnLib_UnRegisterMe AddOnLib_UnRegisterMe; + KODIAudioEngineLib_RegisterMe AudioEngineLib_RegisterMe; + KODIAudioEngineLib_UnRegisterMe AudioEngineLib_UnRegisterMe; + KODICodecLib_RegisterMe CodecLib_RegisterMe; + KODICodecLib_UnRegisterMe CodecLib_UnRegisterMe; + KODIGUILib_RegisterMe GUILib_RegisterMe; + KODIGUILib_UnRegisterMe GUILib_UnRegisterMe; + KODIPVRLib_RegisterMe PVRLib_RegisterMe; + KODIPVRLib_UnRegisterMe PVRLib_UnRegisterMe; + KODIADSPLib_RegisterMe ADSPLib_RegisterMe; + KODIADSPLib_UnRegisterMe ADSPLib_UnRegisterMe; + KODIINPUTSTREAMLib_RegisterMe INPUTSTREAMLib_RegisterMe; + KODIINPUTSTREAMLib_UnRegisterMe INPUTSTREAMLib_UnRegisterMe; + KODIPeripheralLib_RegisterMe PeripheralLib_RegisterMe; + KODIPeripheralLib_UnRegisterMe PeripheralLib_UnRegisterMe; + KODIGameLib_RegisterMe GameLib_RegisterMe; + KODIGameLib_UnRegisterMe GameLib_UnRegisterMe; +} AddonCB; + namespace ADDON { typedef enum addon_log diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h index a769328..3ae30a7 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h @@ -27,29 +27,60 @@ #include "xbmc_pvr_types.h" #include "libXBMC_addon.h" -#define PVR_HELPER_DLL_NAME XBMC_DLL_NAME("pvr") -#define PVR_HELPER_DLL XBMC_DLL("pvr") - #define DVD_TIME_BASE 1000000 //! @todo original definition is in DVDClock.h #define DVD_NOPTS_VALUE 0xFFF0000000000000 +namespace KodiAPI +{ +namespace V1 +{ +namespace PVR +{ + +typedef struct CB_PVRLib +{ + void (*TransferEpgEntry)(void *userData, const ADDON_HANDLE handle, const EPG_TAG *epgentry); + void (*TransferChannelEntry)(void *userData, const ADDON_HANDLE handle, const PVR_CHANNEL *chan); + void (*TransferTimerEntry)(void *userData, const ADDON_HANDLE handle, const PVR_TIMER *timer); + void (*TransferRecordingEntry)(void *userData, const ADDON_HANDLE handle, const PVR_RECORDING *recording); + void (*AddMenuHook)(void *addonData, PVR_MENUHOOK *hook); + void (*Recording)(void *addonData, const char *Name, const char *FileName, bool On); + void (*TriggerChannelUpdate)(void *addonData); + void (*TriggerTimerUpdate)(void *addonData); + void (*TriggerRecordingUpdate)(void *addonData); + void (*TriggerChannelGroupsUpdate)(void *addonData); + void (*TriggerEpgUpdate)(void *addonData, unsigned int iChannelUid); + + void (*TransferChannelGroup)(void *addonData, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP *group); + void (*TransferChannelGroupMember)(void *addonData, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER *member); + + void (*FreeDemuxPacket)(void *addonData, DemuxPacket* pPacket); + DemuxPacket* (*AllocateDemuxPacket)(void *addonData, int iDataSize); + + void (*ConnectionStateChange)(void* addonData, const char* strConnectionString, PVR_CONNECTION_STATE newState, const char *strMessage); + void (*EpgEventStateChange)(void* addonData, EPG_TAG* tag, unsigned int iUniqueChannelId, EPG_EVENT_STATE newState); +} CB_PVRLib; + +} /* namespace PVR */ +} /* namespace V1 */ +} /* namespace KodiAPI */ + class CHelper_libXBMC_pvr { public: CHelper_libXBMC_pvr(void) { - m_libXBMC_pvr = NULL; - m_Handle = NULL; + m_Handle = nullptr; + m_Callbacks = nullptr; } ~CHelper_libXBMC_pvr(void) { - if (m_libXBMC_pvr) + if (m_Handle && m_Callbacks) { - PVR_unregister_me(m_Handle, m_Callbacks); - dlclose(m_libXBMC_pvr); + m_Handle->PVRLib_UnRegisterMe(m_Handle->addonData, m_Callbacks); } } @@ -60,98 +91,12 @@ public: */ bool RegisterMe(void* handle) { - m_Handle = handle; - - std::string libBasePath; - libBasePath = ((cb_array*)m_Handle)->libPath; - libBasePath += PVR_HELPER_DLL; - - m_libXBMC_pvr = dlopen(libBasePath.c_str(), RTLD_LAZY); - if (m_libXBMC_pvr == NULL) - { - fprintf(stderr, "Unable to load %s\n", dlerror()); - return false; - } - - PVR_register_me = (void* (*)(void *HANDLE)) - dlsym(m_libXBMC_pvr, "PVR_register_me"); - if (PVR_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_unregister_me = (void (*)(void* HANDLE, void* CB)) - dlsym(m_libXBMC_pvr, "PVR_unregister_me"); - if (PVR_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_transfer_epg_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const EPG_TAG *epgentry)) - dlsym(m_libXBMC_pvr, "PVR_transfer_epg_entry"); - if (PVR_transfer_epg_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_transfer_channel_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL *chan)) - dlsym(m_libXBMC_pvr, "PVR_transfer_channel_entry"); - if (PVR_transfer_channel_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_transfer_timer_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_TIMER *timer)) - dlsym(m_libXBMC_pvr, "PVR_transfer_timer_entry"); - if (PVR_transfer_timer_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_transfer_recording_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_RECORDING *recording)) - dlsym(m_libXBMC_pvr, "PVR_transfer_recording_entry"); - if (PVR_transfer_recording_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_add_menu_hook = (void (*)(void* HANDLE, void* CB, PVR_MENUHOOK *hook)) - dlsym(m_libXBMC_pvr, "PVR_add_menu_hook"); - if (PVR_add_menu_hook == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_recording = (void (*)(void* HANDLE, void* CB, const char *Name, const char *FileName, bool On)) - dlsym(m_libXBMC_pvr, "PVR_recording"); - if (PVR_recording == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_trigger_timer_update = (void (*)(void* HANDLE, void* CB)) - dlsym(m_libXBMC_pvr, "PVR_trigger_timer_update"); - if (PVR_trigger_timer_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_trigger_recording_update = (void (*)(void* HANDLE, void* CB)) - dlsym(m_libXBMC_pvr, "PVR_trigger_recording_update"); - if (PVR_trigger_recording_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_trigger_channel_update = (void (*)(void* HANDLE, void* CB)) - dlsym(m_libXBMC_pvr, "PVR_trigger_channel_update"); - if (PVR_trigger_channel_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_trigger_channel_groups_update = (void (*)(void* HANDLE, void* CB)) - dlsym(m_libXBMC_pvr, "PVR_trigger_channel_groups_update"); - if (PVR_trigger_channel_groups_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_trigger_epg_update = (void (*)(void* HANDLE, void* CB, unsigned int iChannelUid)) - dlsym(m_libXBMC_pvr, "PVR_trigger_epg_update"); - if (PVR_trigger_epg_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_transfer_channel_group = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP *group)) - dlsym(m_libXBMC_pvr, "PVR_transfer_channel_group"); - if (PVR_transfer_channel_group == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_transfer_channel_group_member = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER *member)) - dlsym(m_libXBMC_pvr, "PVR_transfer_channel_group_member"); - if (PVR_transfer_channel_group_member == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - -#ifdef USE_DEMUX - PVR_free_demux_packet = (void (*)(void* HANDLE, void* CB, DemuxPacket* pPacket)) - dlsym(m_libXBMC_pvr, "PVR_free_demux_packet"); - if (PVR_free_demux_packet == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_allocate_demux_packet = (DemuxPacket* (*)(void* HANDLE, void* CB, int iDataSize)) - dlsym(m_libXBMC_pvr, "PVR_allocate_demux_packet"); - if (PVR_allocate_demux_packet == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } -#endif - - PVR_connection_state_change = (void (*)(void* HANDLE, void* CB, const char *strConnectionString, PVR_CONNECTION_STATE newState, const char *strMessage)) - dlsym(m_libXBMC_pvr, "PVR_connection_state_change"); - if (PVR_connection_state_change == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - PVR_epg_event_state_change = (void (*)(void* HANDLE, void* CB, EPG_TAG* tag, unsigned int iUniqueChannelId, EPG_EVENT_STATE newState)) - dlsym(m_libXBMC_pvr, "PVR_epg_event_state_change"); - if (PVR_epg_event_state_change == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } - - m_Callbacks = PVR_register_me(m_Handle); + m_Handle = static_cast(handle); + if (m_Handle) + m_Callbacks = (KodiAPI::V1::PVR::CB_PVRLib*)m_Handle->PVRLib_RegisterMe(m_Handle->addonData); + if (!m_Callbacks) + fprintf(stderr, "libXBMC_pvr-ERROR: PVRLib_register_me can't get callback table from Kodi !!!\n"); + return m_Callbacks != NULL; } @@ -162,7 +107,7 @@ public: */ void TransferEpgEntry(const ADDON_HANDLE handle, const EPG_TAG* entry) { - return PVR_transfer_epg_entry(m_Handle, m_Callbacks, handle, entry); + return m_Callbacks->TransferEpgEntry(m_Handle->addonData, handle, entry); } /*! @@ -172,7 +117,7 @@ public: */ void TransferChannelEntry(const ADDON_HANDLE handle, const PVR_CHANNEL* entry) { - return PVR_transfer_channel_entry(m_Handle, m_Callbacks, handle, entry); + return m_Callbacks->TransferChannelEntry(m_Handle->addonData, handle, entry); } /*! @@ -182,7 +127,7 @@ public: */ void TransferTimerEntry(const ADDON_HANDLE handle, const PVR_TIMER* entry) { - return PVR_transfer_timer_entry(m_Handle, m_Callbacks, handle, entry); + return m_Callbacks->TransferTimerEntry(m_Handle->addonData, handle, entry); } /*! @@ -192,7 +137,7 @@ public: */ void TransferRecordingEntry(const ADDON_HANDLE handle, const PVR_RECORDING* entry) { - return PVR_transfer_recording_entry(m_Handle, m_Callbacks, handle, entry); + return m_Callbacks->TransferRecordingEntry(m_Handle->addonData, handle, entry); } /*! @@ -202,7 +147,7 @@ public: */ void TransferChannelGroup(const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP* entry) { - return PVR_transfer_channel_group(m_Handle, m_Callbacks, handle, entry); + return m_Callbacks->TransferChannelGroup(m_Handle->addonData, handle, entry); } /*! @@ -212,7 +157,7 @@ public: */ void TransferChannelGroupMember(const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER* entry) { - return PVR_transfer_channel_group_member(m_Handle, m_Callbacks, handle, entry); + return m_Callbacks->TransferChannelGroupMember(m_Handle->addonData, handle, entry); } /*! @@ -221,7 +166,7 @@ public: */ void AddMenuHook(PVR_MENUHOOK* hook) { - return PVR_add_menu_hook(m_Handle, m_Callbacks, hook); + return m_Callbacks->AddMenuHook(m_Handle->addonData, hook); } /*! @@ -232,7 +177,7 @@ public: */ void Recording(const char* strRecordingName, const char* strFileName, bool bOn) { - return PVR_recording(m_Handle, m_Callbacks, strRecordingName, strFileName, bOn); + return m_Callbacks->Recording(m_Handle->addonData, strRecordingName, strFileName, bOn); } /*! @@ -240,7 +185,7 @@ public: */ void TriggerTimerUpdate(void) { - return PVR_trigger_timer_update(m_Handle, m_Callbacks); + return m_Callbacks->TriggerTimerUpdate(m_Handle->addonData); } /*! @@ -248,7 +193,7 @@ public: */ void TriggerRecordingUpdate(void) { - return PVR_trigger_recording_update(m_Handle, m_Callbacks); + return m_Callbacks->TriggerRecordingUpdate(m_Handle->addonData); } /*! @@ -256,7 +201,7 @@ public: */ void TriggerChannelUpdate(void) { - return PVR_trigger_channel_update(m_Handle, m_Callbacks); + return m_Callbacks->TriggerChannelUpdate(m_Handle->addonData); } /*! @@ -265,7 +210,7 @@ public: */ void TriggerEpgUpdate(unsigned int iChannelUid) { - return PVR_trigger_epg_update(m_Handle, m_Callbacks, iChannelUid); + return m_Callbacks->TriggerEpgUpdate(m_Handle->addonData, iChannelUid); } /*! @@ -273,7 +218,7 @@ public: */ void TriggerChannelGroupsUpdate(void) { - return PVR_trigger_channel_groups_update(m_Handle, m_Callbacks); + return m_Callbacks->TriggerChannelGroupsUpdate(m_Handle->addonData); } #ifdef USE_DEMUX @@ -283,7 +228,7 @@ public: */ void FreeDemuxPacket(DemuxPacket* pPacket) { - return PVR_free_demux_packet(m_Handle, m_Callbacks, pPacket); + return m_Callbacks->FreeDemuxPacket(m_Handle->addonData, pPacket); } /*! @@ -293,7 +238,7 @@ public: */ DemuxPacket* AllocateDemuxPacket(int iDataSize) { - return PVR_allocate_demux_packet(m_Handle, m_Callbacks, iDataSize); + return m_Callbacks->AllocateDemuxPacket(m_Handle->addonData, iDataSize); } #endif @@ -306,7 +251,7 @@ public: */ void ConnectionStateChange(const char *strConnectionString, PVR_CONNECTION_STATE newState, const char *strMessage) { - return PVR_connection_state_change(m_Handle, m_Callbacks, strConnectionString, newState, strMessage); + return m_Callbacks->ConnectionStateChange(m_Handle->addonData, strConnectionString, newState, strMessage); } /*! @@ -318,38 +263,10 @@ public: */ void EpgEventStateChange(EPG_TAG *tag, unsigned int iUniqueChannelId, EPG_EVENT_STATE newState) { - return PVR_epg_event_state_change(m_Handle, m_Callbacks, tag, iUniqueChannelId, newState); + return m_Callbacks->EpgEventStateChange(m_Handle->addonData, tag, iUniqueChannelId, newState); } -protected: - void* (*PVR_register_me)(void*); - void (*PVR_unregister_me)(void*, void*); - void (*PVR_transfer_epg_entry)(void*, void*, const ADDON_HANDLE, const EPG_TAG*); - void (*PVR_transfer_channel_entry)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL*); - void (*PVR_transfer_timer_entry)(void*, void*, const ADDON_HANDLE, const PVR_TIMER*); - void (*PVR_transfer_recording_entry)(void*, void*, const ADDON_HANDLE, const PVR_RECORDING*); - void (*PVR_add_menu_hook)(void*, void*, PVR_MENUHOOK*); - void (*PVR_recording)(void*, void*, const char*, const char*, bool); - void (*PVR_trigger_channel_update)(void*, void*); - void (*PVR_trigger_channel_groups_update)(void*, void*); - void (*PVR_trigger_timer_update)(void*, void*); - void (*PVR_trigger_recording_update)(void* , void*); - void (*PVR_trigger_epg_update)(void*, void*, unsigned int); - void (*PVR_transfer_channel_group)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL_GROUP*); - void (*PVR_transfer_channel_group_member)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL_GROUP_MEMBER*); -#ifdef USE_DEMUX - void (*PVR_free_demux_packet)(void*, void*, DemuxPacket*); - DemuxPacket* (*PVR_allocate_demux_packet)(void*, void*, int); -#endif - void (*PVR_connection_state_change)(void*, void*, const char*, PVR_CONNECTION_STATE, const char*); - void (*PVR_epg_event_state_change)(void*, void*, EPG_TAG*, unsigned int, EPG_EVENT_STATE); - private: - void* m_libXBMC_pvr; - void* m_Handle; - void* m_Callbacks; - struct cb_array - { - const char* libPath; - }; + AddonCB* m_Handle; + KodiAPI::V1::PVR::CB_PVRLib *m_Callbacks; }; diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h index 2cf558a..57bb129 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h @@ -589,7 +589,7 @@ extern "C" * @return True if the seek operation was possible * @remarks Optional, and only used if addon has its own demuxer. Return False if this add-on won't provide this function. */ - bool SeekTime(int time, bool backwards, double *startpts); + bool SeekTime(double time, bool backwards, double *startpts); /*! * Notify the pvr addon/demuxer that XBMC wishes to change playback speed diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h index 08ae183..dbc7217 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h @@ -78,10 +78,10 @@ struct DemuxPacket; #define PVR_STREAM_MAX_STREAMS 20 /* current PVR API version */ -#define XBMC_PVR_API_VERSION "5.2.0" +#define XBMC_PVR_API_VERSION "5.2.1" /* min. PVR API version */ -#define XBMC_PVR_MIN_API_VERSION "5.2.0" +#define XBMC_PVR_MIN_API_VERSION "5.2.1" #ifdef __cplusplus extern "C" { @@ -594,7 +594,7 @@ extern "C" { bool (__cdecl* CanPauseStream)(void); void (__cdecl* PauseStream)(bool); bool (__cdecl* CanSeekStream)(void); - bool (__cdecl* SeekTime)(int, bool, double*); + bool (__cdecl* SeekTime)(double, bool, double*); void (__cdecl* SetSpeed)(int); time_t (__cdecl* GetPlayingTime)(void); time_t (__cdecl* GetBufferTimeStart)(void); diff --git a/xbmc/input/XBMC_vkeys.h b/xbmc/input/XBMC_vkeys.h new file mode 100644 index 0000000..4e3787c --- /dev/null +++ b/xbmc/input/XBMC_vkeys.h @@ -0,0 +1,286 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU General Public License + along with XBMC; see the file COPYING. If not, see + . + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifndef XBMC_vkeys_h +#define XBMC_vkeys_h + +// The XBMC_vkey identifies a key that is mapped to an action or function. +// The keysym.sym generated by SDL_KEYDOWN is mapped to a vkey and the vkey +// is used to lookup an action in the global mapping table. +// The vkey values are the ASCII code of the character where this is possible. +// Non-printing keypresses get a value in the range 0x80 - 0xFF. +// Note that the vkey is a byte value so it cannot be greater than 0xFF. + +typedef enum { + XBMCVK_BACK = 0x08, + XBMCVK_TAB = 0x09, + XBMCVK_RETURN = 0x0D, + XBMCVK_ESCAPE = 0x1B, + + XBMCVK_SPACE = 0x20, + XBMCVK_EXCLAIM = 0x21, + XBMCVK_QUOTEDBL = 0x22, + XBMCVK_HASH = 0x23, + XBMCVK_DOLLAR = 0x24, + XBMCVK_PERCENT = 0x25, + XBMCVK_AMPERSAND = 0x26, + XBMCVK_QUOTE = 0x27, + XBMCVK_LEFTPAREN = 0x28, + XBMCVK_RIGHTPAREN = 0x29, + XBMCVK_ASTERISK = 0x2A, + XBMCVK_PLUS = 0x2B, + XBMCVK_COMMA = 0x2C, + XBMCVK_MINUS = 0x2D, + XBMCVK_PERIOD = 0x2E, + XBMCVK_SLASH = 0x2F, + + XBMCVK_0 = 0x30, + XBMCVK_1 = 0x31, + XBMCVK_2 = 0x32, + XBMCVK_3 = 0x33, + XBMCVK_4 = 0x34, + XBMCVK_5 = 0x35, + XBMCVK_6 = 0x36, + XBMCVK_7 = 0x37, + XBMCVK_8 = 0x38, + XBMCVK_9 = 0x39, + + XBMCVK_COLON = 0x3A, + XBMCVK_SEMICOLON = 0x3B, + XBMCVK_LESS = 0x3C, + XBMCVK_EQUALS = 0x3D, + XBMCVK_GREATER = 0x3E, + XBMCVK_QUESTION = 0x3F, + XBMCVK_AT = 0x40, + + XBMCVK_A = 0x41, + XBMCVK_B = 0x42, + XBMCVK_C = 0x43, + XBMCVK_D = 0x44, + XBMCVK_E = 0x45, + XBMCVK_F = 0x46, + XBMCVK_G = 0x47, + XBMCVK_H = 0x48, + XBMCVK_I = 0x49, + XBMCVK_J = 0x4A, + XBMCVK_K = 0x4B, + XBMCVK_L = 0x4C, + XBMCVK_M = 0x4D, + XBMCVK_N = 0x4E, + XBMCVK_O = 0x4F, + XBMCVK_P = 0x50, + XBMCVK_Q = 0x51, + XBMCVK_R = 0x52, + XBMCVK_S = 0x53, + XBMCVK_T = 0x54, + XBMCVK_U = 0x55, + XBMCVK_V = 0x56, + XBMCVK_W = 0x57, + XBMCVK_X = 0x58, + XBMCVK_Y = 0x59, + XBMCVK_Z = 0x5A, + + XBMCVK_LEFTBRACKET = 0x5B, + XBMCVK_BACKSLASH = 0x5C, + XBMCVK_RIGHTBRACKET = 0x5D, + XBMCVK_CARET = 0x5E, + XBMCVK_UNDERSCORE = 0x5F, + XBMCVK_BACKQUOTE = 0x60, + +// Lowercase letters 0x61 - 0x7a have the same vkey as uppercase, so +// use this block for the numpad keys + XBMCVK_NUMPADDIVIDE = 0x61, + XBMCVK_NUMPADTIMES = 0x62, + XBMCVK_NUMPADMINUS = 0x63, + XBMCVK_NUMPADPLUS = 0x64, + XBMCVK_NUMPADENTER = 0x65, + XBMCVK_NUMPADPERIOD = 0x66, + XBMCVK_NUMPAD0 = 0x70, + XBMCVK_NUMPAD1 = 0x71, + XBMCVK_NUMPAD2 = 0x72, + XBMCVK_NUMPAD3 = 0x73, + XBMCVK_NUMPAD4 = 0x74, + XBMCVK_NUMPAD5 = 0x75, + XBMCVK_NUMPAD6 = 0x76, + XBMCVK_NUMPAD7 = 0x77, + XBMCVK_NUMPAD8 = 0x78, + XBMCVK_NUMPAD9 = 0x79, + + XBMCVK_LEFTBRACE = 0x7B, + XBMCVK_PIPE = 0x7C, + XBMCVK_RIGHTBRACE = 0x7D, + XBMCVK_TILDE = 0x7E, + +// Non-printing characters + + XBMCVK_UP = 0x80, + XBMCVK_DOWN = 0x81, + XBMCVK_LEFT = 0x82, + XBMCVK_RIGHT = 0x83, + XBMCVK_PAGEUP = 0x84, + XBMCVK_PAGEDOWN = 0x85, + XBMCVK_INSERT = 0x86, + XBMCVK_DELETE = 0x87, + XBMCVK_HOME = 0x88, + XBMCVK_END = 0x89, + + XBMCVK_F1 = 0x90, + XBMCVK_F2 = 0x91, + XBMCVK_F3 = 0x92, + XBMCVK_F4 = 0x93, + XBMCVK_F5 = 0x94, + XBMCVK_F6 = 0x95, + XBMCVK_F7 = 0x96, + XBMCVK_F8 = 0x97, + XBMCVK_F9 = 0x98, + XBMCVK_F10 = 0x99, + XBMCVK_F11 = 0x9A, + XBMCVK_F12 = 0x9B, + XBMCVK_F13 = 0x9C, + XBMCVK_F14 = 0x9D, + XBMCVK_F15 = 0x9E, + XBMCVK_F16 = 0x9F, + XBMCVK_F17 = 0xA0, + XBMCVK_F18 = 0xA1, + XBMCVK_F19 = 0xA2, + XBMCVK_F20 = 0xA3, + XBMCVK_F21 = 0xA4, + XBMCVK_F22 = 0xA5, + XBMCVK_F23 = 0xA6, + XBMCVK_F24 = 0xA7, + + XBMCVK_BROWSER_BACK = 0xB0, + XBMCVK_BROWSER_FORWARD = 0xB1, + XBMCVK_BROWSER_REFRESH = 0xB2, + XBMCVK_BROWSER_STOP = 0xB3, + XBMCVK_BROWSER_SEARCH = 0xB4, + XBMCVK_BROWSER_FAVORITES = 0xB5, + XBMCVK_BROWSER_HOME = 0xB6, + XBMCVK_VOLUME_MUTE = 0xB7, + XBMCVK_VOLUME_DOWN = 0xB8, + XBMCVK_VOLUME_UP = 0xB9, + XBMCVK_MEDIA_NEXT_TRACK = 0xBA, + XBMCVK_MEDIA_PREV_TRACK = 0xBB, + XBMCVK_MEDIA_STOP = 0xBC, + XBMCVK_MEDIA_PLAY_PAUSE = 0xBD, + XBMCVK_LAUNCH_MAIL = 0xBE, + XBMCVK_LAUNCH_MEDIA_SELECT = 0xBF, + XBMCVK_LAUNCH_APP1 = 0xC0, + XBMCVK_LAUNCH_APP2 = 0xC1, + XBMCVK_LAUNCH_FILE_BROWSER = 0xC2, + XBMCVK_LAUNCH_MEDIA_CENTER = 0xC3, + XBMCVK_MEDIA_REWIND = 0xC4, + XBMCVK_MEDIA_FASTFORWARD = 0xC5, + XBMCVK_MEDIA_RECORD = 0xC6, + + XBMCVK_LCONTROL = 0xD0, + XBMCVK_RCONTROL = 0xD1, + XBMCVK_LSHIFT = 0xD2, + XBMCVK_RSHIFT = 0xD3, + XBMCVK_LMENU = 0xD4, + XBMCVK_RMENU = 0xD5, + XBMCVK_LWIN = 0xD6, + XBMCVK_RWIN = 0xD7, + XBMCVK_MENU = 0xD8, + XBMCVK_CAPSLOCK = 0xD9, + XBMCVK_NUMLOCK = 0xDA, + + XBMCVK_PRINTSCREEN = 0xDB, + XBMCVK_SCROLLLOCK = 0xDC, + XBMCVK_PAUSE = 0XDD, + XBMCVK_POWER = 0XDE, + XBMCVK_SLEEP = 0XDF, + XBMCVK_GUIDE = 0xE0, + XBMCVK_SETTINGS = 0xE1, + XBMCVK_INFO = 0xE2, + XBMCVK_RED = 0xE3, + XBMCVK_GREEN = 0xE4, + XBMCVK_YELLOW = 0xE5, + XBMCVK_BLUE = 0xE6, + XBMCVK_ZOOM = 0xE7, + XBMCVK_TEXT = 0xE8, + XBMCVK_FAVORITES = 0xE9, + XBMCVK_HOMEPAGE = 0xEA, + XBMCVK_CONFIG = 0xEB, + XBMCVK_EPG = 0xEC, + + XBMCVK_LAST = 0xFF +} XBMCVKey; + +// These should be in winuser.h. Not sure why they have been defined here +#ifndef VK_0 +#define VK_0 '0' +#define VK_1 '1' +#define VK_2 '2' +#define VK_3 '3' +#define VK_4 '4' +#define VK_5 '5' +#define VK_6 '6' +#define VK_7 '7' +#define VK_8 '8' +#define VK_9 '9' +#define VK_A 'A' +#define VK_B 'B' +#define VK_C 'C' +#define VK_D 'D' +#define VK_E 'E' +#define VK_F 'F' +#define VK_G 'G' +#define VK_H 'H' +#define VK_I 'I' +#define VK_J 'J' +#define VK_K 'K' +#define VK_L 'L' +#define VK_M 'M' +#define VK_N 'N' +#define VK_O 'O' +#define VK_P 'P' +#define VK_Q 'Q' +#define VK_R 'R' +#define VK_S 'S' +#define VK_T 'T' +#define VK_U 'U' +#define VK_V 'V' +#define VK_W 'W' +#define VK_X 'X' +#define VK_Y 'Y' +#define VK_Z 'Z' +#endif /* VK_0 */ + +/* These keys haven't been defined, but were experimentally determined */ +#ifndef VK_SEMICOLON +#define VK_SEMICOLON 0xBA +#define VK_EQUALS 0xBB +#define VK_COMMA 0xBC +#define VK_MINUS 0xBD +#define VK_PERIOD 0xBE +#define VK_SLASH 0xBF +#define VK_GRAVE 0xC0 +#define VK_LBRACKET 0xDB +#define VK_BACKSLASH 0xDC +#define VK_RBRACKET 0xDD +#define VK_APOSTROPHE 0xDE +#define VK_BACKTICK 0xDF +#define VK_OEM_102 0xE2 +#endif + +#endif // XBMC_vkeys_h -- cgit v1.2.3