From b3d195f0188758a14875a5a2f270e4fd190a679f Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 17 Apr 2018 00:15:38 +0200 Subject: sync with upstream --- cmake/KodiConfig.cmake.in | 1 + cmake/README.md | 4 +- cmake/addons/CMakeLists.txt | 8 +- .../depends/common/kodi-platform/kodi-platform.txt | 2 +- .../depends/windows/cmake/mingw/CMakeLists.txt | 37 - .../windows/cmake/mingw/MinGWConfig.cmake.in | 3 - .../windows/cmake/mingw/Toolchain_mingw32.cmake.in | 17 - cmake/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 - cmake/addons/depends/windows/cmake/msys/msys.txt | 1 - .../depends/windows/cmake/msys/noinstall.txt | 0 cmake/cpack/deb/packages/kodi.txt.in | 2 +- cmake/installdata/common/addons.txt | 1 - cmake/installdata/windowsstore/certificates.txt | 1 + cmake/modules/FindAML.cmake | 14 + cmake/modules/FindAlsa.cmake | 2 +- cmake/modules/FindCdio.cmake | 2 +- cmake/modules/FindCpluff.cmake | 33 +- cmake/modules/FindCurl.cmake | 34 - cmake/modules/FindFFMPEG.cmake | 12 +- cmake/modules/FindLircClient.cmake | 36 + cmake/modules/FindMariaDBClient.cmake | 69 ++ cmake/modules/FindMicroHttpd.cmake | 2 +- cmake/modules/FindMir.cmake | 2 +- cmake/modules/FindSSH.cmake | 2 +- cmake/modules/FindWaylandProtocols.cmake | 24 + cmake/modules/FindWaylandpp.cmake | 73 +- cmake/modules/FindXkbcommon.cmake | 26 +- cmake/platform/freebsd/wayland.cmake | 18 +- cmake/platform/linux/aml.cmake | 2 + cmake/platform/linux/gbm.cmake | 2 + cmake/platform/linux/mir.cmake | 1 + cmake/platform/linux/rbpi.cmake | 2 + cmake/platform/linux/wayland.cmake | 6 +- cmake/platform/linux/x11.cmake | 1 + cmake/scripts/android/ArchSetup.cmake | 4 +- cmake/scripts/android/Install.cmake | 31 +- cmake/scripts/common/AddonHelpers.cmake | 33 +- cmake/scripts/common/ArchSetup.cmake | 4 + cmake/scripts/common/HandleDepends.cmake | 3 - cmake/scripts/common/Macros.cmake | 111 +- cmake/scripts/common/Uninstall.cmake | 36 + cmake/scripts/freebsd/ArchSetup.cmake | 5 + cmake/scripts/ios/ArchSetup.cmake | 2 +- cmake/scripts/linux/ArchSetup.cmake | 28 +- cmake/scripts/linux/ExtraTargets.cmake | 6 +- cmake/scripts/windows/ArchSetup.cmake | 14 +- cmake/scripts/windows/tools/patch.cmake | 7 +- cmake/scripts/windowsstore/ArchSetup.cmake | 14 +- cmake/scripts/windowsstore/Macros.cmake | 3 +- cmake/scripts/windowsstore/tools/patch.cmake | 7 +- cmake/treedata/android/subdirs.txt | 25 +- cmake/treedata/common/games.txt | 2 + cmake/treedata/common/retroplayer.txt | 3 +- cmake/treedata/common/subdirs.txt | 2 +- cmake/treedata/freebsd/subdirs.txt | 23 +- cmake/treedata/ios/subdirs.txt | 34 +- cmake/treedata/linux/subdirs.txt | 24 +- cmake/treedata/osx/subdirs.txt | 28 +- cmake/treedata/windows/subdirs.txt | 28 +- cmake/treedata/windowsstore/subdirs.txt | 29 +- version.txt | 6 +- .../kodi-addon-dev-kit/include/kodi/AddonBase.h | 39 +- .../kodi-addon-dev-kit/include/kodi/AudioEngine.h | 597 --------- .../kodi-addon-dev-kit/include/kodi/CMakeLists.txt | 5 +- .../include/kodi/addon-instance/AudioDSP.h | 1288 -------------------- .../include/kodi/addon-instance/CMakeLists.txt | 3 +- .../include/kodi/addon-instance/Peripheral.h | 162 ++- .../include/kodi/addon-instance/PeripheralUtils.h | 220 +++- .../include/kodi/addon-instance/VFS.h | 6 +- .../include/kodi/addon-instance/VideoCodec.h | 2 +- .../include/kodi/addon-instance/Visualization.h | 2 +- .../include/kodi/kodi_game_dll.h | 99 +- .../include/kodi/kodi_game_types.h | 116 +- .../kodi-addon-dev-kit/include/kodi/libKODI_game.h | 22 - .../include/kodi/libKODI_guilib.h | 2 +- .../include/kodi/libXBMC_addon.h | 6 +- .../kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h | 2 +- .../include/kodi/platform/android/System.h | 107 ++ .../kodi-addon-dev-kit/include/kodi/versions.h | 28 +- .../include/kodi/xbmc_epg_types.h | 4 +- .../kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h | 13 +- .../include/kodi/xbmc_pvr_types.h | 4 +- xbmc/cores/AudioEngine/Utils/AEChannelData.h | 2 +- .../VideoPlayer/Interface/Addon/DemuxCrypto.h | 2 +- .../VideoPlayer/Interface/Addon/DemuxPacket.h | 2 +- .../VideoPlayer/Interface/Addon/TimingConstants.h | 2 +- xbmc/filesystem/IFileTypes.h | 2 +- xbmc/interfaces/json-rpc/schema/version.txt | 2 +- 91 files changed, 1228 insertions(+), 2475 deletions(-) delete mode 100644 cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt delete mode 100644 cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in delete mode 100644 cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in delete mode 100644 cmake/addons/depends/windows/cmake/mingw/mingw.txt delete mode 100644 cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in delete mode 100644 cmake/addons/depends/windows/cmake/mingw/noinstall.txt delete mode 100644 cmake/addons/depends/windows/cmake/msys/CMakeLists.txt delete mode 100644 cmake/addons/depends/windows/cmake/msys/msys.txt delete mode 100644 cmake/addons/depends/windows/cmake/msys/noinstall.txt create mode 100644 cmake/installdata/windowsstore/certificates.txt create mode 100644 cmake/modules/FindLircClient.cmake create mode 100644 cmake/modules/FindMariaDBClient.cmake create mode 100644 cmake/modules/FindWaylandProtocols.cmake delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/platform/android/System.h diff --git a/cmake/KodiConfig.cmake.in b/cmake/KodiConfig.cmake.in index 58dfc40..2a572e7 100644 --- a/cmake/KodiConfig.cmake.in +++ b/cmake/KodiConfig.cmake.in @@ -16,6 +16,7 @@ endif() if(NOT @APP_NAME_UC@_DATA_DIR) set(@APP_NAME_UC@_DATA_DIR @APP_DATA_DIR@) endif() +set(APP_RENDER_SYSTEM @APP_RENDER_SYSTEM@) if(NOT WIN32) set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@") endif() diff --git a/cmake/README.md b/cmake/README.md index 0848f2d..c1b953f 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -36,7 +36,7 @@ dependencies have to be installed as explained in ### Windows For Windows the dependencies can be found in the -[Wiki](http://kodi.wiki/view/HOW-TO:Compile_Kodi_for_Windows) (Step 1-4). If not already available on your pc, you should +[Wiki](https://kodi.wiki/view/HOW-TO:Compile_Kodi_for_Windows#Setting_up_the_build_Environment) (Step 1-4). If not already available on your pc, you should install the [Windows Software Development Kit (SDK)](https://dev.windows.com/en-us/downloads/sdk-archive) for your Windows version. This is required for HLSL shader offline compiling with the [Effect-Compiler Tool](https://msdn.microsoft.com/de-de/library/windows/desktop/bb232919(v=vs.85).aspx) (fxc.exe). On Windows, the CMake based buildsystem requires that the binary dependencies @@ -113,6 +113,8 @@ cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) ``` ### Windows with Visual Studio project files +These instructions are for Visual Studio 2015. If you want to build for Visal Studio 2017, you need to target `Visual Studio 15` instead of `Visual Studio 14`. + #### Build for win32 ``` cmake -G "Visual Studio 14" diff --git a/cmake/addons/CMakeLists.txt b/cmake/addons/CMakeLists.txt index fd1d448..5db5dba 100644 --- a/cmake/addons/CMakeLists.txt +++ b/cmake/addons/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.3) project(kodi-addons) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) @@ -403,8 +403,12 @@ foreach(addon ${addons}) endif() # create a forwarding target to the addon-package target + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(_isMultiConfig) + set(config --config $) + endif() add_custom_target(package-${id} - COMMAND ${CMAKE_COMMAND} --build ${id}-prefix/src/${id}-build --target addon-package + COMMAND ${CMAKE_COMMAND} --build ${id}-prefix/src/${id}-build ${config} --target addon-package DEPENDS ${id}) add_dependencies(package-addons package-${id}) diff --git a/cmake/addons/depends/common/kodi-platform/kodi-platform.txt b/cmake/addons/depends/common/kodi-platform/kodi-platform.txt index 1b5c8bf..c553769 100644 --- a/cmake/addons/depends/common/kodi-platform/kodi-platform.txt +++ b/cmake/addons/depends/common/kodi-platform/kodi-platform.txt @@ -1 +1 @@ -kodi-platform https://github.com/xbmc/kodi-platform 36fb49371dbce49bf470a5bb1fc51b74b4a3612d +kodi-platform https://github.com/xbmc/kodi-platform e8574b883ffa2131f2eeb96ff3724d60b21130f7 diff --git a/cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt b/cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt deleted file mode 100644 index 02d9724..0000000 --- a/cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -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") -if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(MINGW_PATH "${MSYS_PATH}/mingw32") -elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(MINGW_PATH "${MSYS_PATH}/mingw64") -endif() - -# 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/cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in b/cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in deleted file mode 100644 index 2d6baa7..0000000 --- a/cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in +++ /dev/null @@ -1,3 +0,0 @@ -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/cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in b/cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in deleted file mode 100644 index 01d281d..0000000 --- a/cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in +++ /dev/null @@ -1,17 +0,0 @@ -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/cmake/addons/depends/windows/cmake/mingw/mingw.txt b/cmake/addons/depends/windows/cmake/mingw/mingw.txt deleted file mode 100644 index 90aa6ae..0000000 --- a/cmake/addons/depends/windows/cmake/mingw/mingw.txt +++ /dev/null @@ -1 +0,0 @@ -mingw diff --git a/cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in b/cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in deleted file mode 100644 index 44a0ea2..0000000 --- a/cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in +++ /dev/null @@ -1,6 +0,0 @@ -@ECHO OFF -SETLOCAL - -SET PATH=@MINGW_PATH@/bin;@MSYS_PATH@/usr/bin;%PATH% -@CMD@.exe %* - diff --git a/cmake/addons/depends/windows/cmake/mingw/noinstall.txt b/cmake/addons/depends/windows/cmake/mingw/noinstall.txt deleted file mode 100644 index e69de29..0000000 diff --git a/cmake/addons/depends/windows/cmake/msys/CMakeLists.txt b/cmake/addons/depends/windows/cmake/msys/CMakeLists.txt deleted file mode 100644 index 1c0536e..0000000 --- a/cmake/addons/depends/windows/cmake/msys/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -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/cmake/addons/depends/windows/cmake/msys/msys.txt b/cmake/addons/depends/windows/cmake/msys/msys.txt deleted file mode 100644 index 00de9c2..0000000 --- a/cmake/addons/depends/windows/cmake/msys/msys.txt +++ /dev/null @@ -1 +0,0 @@ -msys diff --git a/cmake/addons/depends/windows/cmake/msys/noinstall.txt b/cmake/addons/depends/windows/cmake/msys/noinstall.txt deleted file mode 100644 index e69de29..0000000 diff --git a/cmake/cpack/deb/packages/kodi.txt.in b/cmake/cpack/deb/packages/kodi.txt.in index 376fe80..90ae9ea 100644 --- a/cmake/cpack/deb/packages/kodi.txt.in +++ b/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, libass5 | libass4, libgif5 | libgif7, libssh-4 | libssh2-1, libnfs8 | libnfs4 | libnfs1, libbluray1 | libbluray2, libshairplay0, libvorbisfile3, libaacs0, libcec4, 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, libcurl4 | libcurl3, mesa-utils, x11-utils, fonts-liberation | ttf-liberation, fonts-dejavu-core | ttf-dejavu-core, python-bluez | python-lightblue, python-imaging | python-pil, python-simplejson, libass9 | libass5 | libass4, libgif5 | libgif7, libssh-4 | libssh2-1, libnfs8 | libnfs4 | libnfs1, libbluray1 | libbluray2, 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/cmake/installdata/common/addons.txt b/cmake/installdata/common/addons.txt index 9efba38..b8f763c 100644 --- a/cmake/installdata/common/addons.txt +++ b/cmake/installdata/common/addons.txt @@ -1,7 +1,6 @@ addons/audioencoder.kodi.builtin.aac/* addons/audioencoder.kodi.builtin.wma/* addons/game.controller.default/* -addons/kodi.adsp/* addons/kodi.audiodecoder/* addons/kodi.game/* addons/kodi.imagedecoder/* diff --git a/cmake/installdata/windowsstore/certificates.txt b/cmake/installdata/windowsstore/certificates.txt new file mode 100644 index 0000000..14e74a7 --- /dev/null +++ b/cmake/installdata/windowsstore/certificates.txt @@ -0,0 +1 @@ +tools/depends/target/openssl/cacert.pem system/certs \ No newline at end of file diff --git a/cmake/modules/FindAML.cmake b/cmake/modules/FindAML.cmake index 5b9a859..602f5d9 100644 --- a/cmake/modules/FindAML.cmake +++ b/cmake/modules/FindAML.cmake @@ -20,9 +20,23 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(AML REQUIRED_VARS AML_INCLUDE_DIR) +include(CheckCSourceCompiles) +set(CMAKE_REQUIRED_INCLUDES ${AML_INCLUDE_DIR}) +check_c_source_compiles("#include + + int main() + { + int i = VIDEO_DEC_FORMAT_VP9; + return 0; + } + " AML_HAS_VP9) + if(AML_FOUND) set(AML_INCLUDE_DIRS ${AML_INCLUDE_DIR}) set(AML_DEFINITIONS -DHAS_LIBAMCODEC=1) + if(AML_HAS_VP9) + list(APPEND AML_DEFINITIONS -DHAS_LIBAMCODEC_VP9=1) + endif() if(NOT TARGET AML::AML) add_library(AML::AML UNKNOWN IMPORTED) diff --git a/cmake/modules/FindAlsa.cmake b/cmake/modules/FindAlsa.cmake index bed4faa..ae05817 100644 --- a/cmake/modules/FindAlsa.cmake +++ b/cmake/modules/FindAlsa.cmake @@ -15,7 +15,7 @@ # ALSA::ALSA - The Alsa library if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_ALSA alsa QUIET) + pkg_check_modules(PC_ALSA alsa>=1.0.27 QUIET) endif() find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h diff --git a/cmake/modules/FindCdio.cmake b/cmake/modules/FindCdio.cmake index 64f4bb8..cce7f2a 100644 --- a/cmake/modules/FindCdio.cmake +++ b/cmake/modules/FindCdio.cmake @@ -14,7 +14,7 @@ # CDIO::CDIO - The cdio library if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_CDIO libcdio libiso9660 QUIET) + pkg_check_modules(PC_CDIO libcdio>=0.78 libiso9660 QUIET) endif() find_path(CDIO_INCLUDE_DIR NAMES cdio/cdio.h diff --git a/cmake/modules/FindCpluff.cmake b/cmake/modules/FindCpluff.cmake index 913d7ae..9e29e17 100644 --- a/cmake/modules/FindCpluff.cmake +++ b/cmake/modules/FindCpluff.cmake @@ -6,8 +6,11 @@ # # and link Kodi against the cpluff libraries. -if(NOT WIN32) - find_package(EXPAT REQUIRED) +find_package(EXPAT REQUIRED) +if(CORE_SYSTEM_NAME MATCHES windows) + add_subdirectory(${CMAKE_SOURCE_DIR}/lib/cpluff) + set(CPLUFF_LIBRARIES $ ${EXPAT_LIBRARIES}) +else() 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}") @@ -31,7 +34,8 @@ if(NOT WIN32) --host=${ARCH} CFLAGS=${defines} CPPFLAGS=${cppflags} - LDFLAGS=${ldflags}) + LDFLAGS=${ldflags} + BUILD_BYPRODUCTS /lib/libcpluff.a) ExternalProject_Add_Step(libcpluff autoreconf DEPENDEES download update patch DEPENDERS configure @@ -39,24 +43,9 @@ if(NOT WIN32) COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif WORKING_DIRECTORY ) - set(ldflags "${ldflags};-lexpat") - core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/lib/libcpluff.a - system/libcpluff libcpluff extras "${ldflags}") - set(CPLUFF_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/include) - set(CPLUFF_FOUND 1) - mark_as_advanced(CPLUFF_INCLUDE_DIRS CPLUFF_FOUND) -else() - find_path(CPLUFF_INCLUDE_DIR cpluff.h) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Cpluff - REQUIRED_VARS CPLUFF_INCLUDE_DIR) - - if(CPLUFF_FOUND) - set(CPLUFF_INCLUDE_DIRS ${CPLUFF_INCLUDE_DIR}) - endif() - mark_as_advanced(CPLUFF_INCLUDE_DIRS CPLUFF_FOUND) - - add_custom_target(libcpluff) + set(CPLUFF_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/lib/libcpluff.a ${EXPAT_LIBRARIES}) endif() +set(CPLUFF_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/include) +set(CPLUFF_FOUND 1) +mark_as_advanced(CPLUFF_INCLUDE_DIRS CPLUFF_LIBRARIES) set_target_properties(libcpluff PROPERTIES FOLDER "External Projects") diff --git a/cmake/modules/FindCurl.cmake b/cmake/modules/FindCurl.cmake index d0759a6..17c1f01 100644 --- a/cmake/modules/FindCurl.cmake +++ b/cmake/modules/FindCurl.cmake @@ -34,40 +34,6 @@ if(CURL_FOUND) set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) set(CURL_LIBRARIES ${CURL_LIBRARY}) - # Check whether OpenSSL inside libcurl is static. - if(UNIX) - if(NOT DEFINED HAS_CURL_STATIC) - get_filename_component(CURL_LIBRARY_DIR ${CURL_LIBRARY} DIRECTORY) - find_soname(CURL REQUIRED) - - if(APPLE) - set(libchecker nm) - set(searchpattern "T [_]?CRYPTO_set_locking_call") - else() - set(libchecker readelf -s) - set(searchpattern "CRYPTO_set_locking_call") - endif() - execute_process( - COMMAND ${libchecker} ${CURL_LIBRARY_DIR}/${CURL_SONAME} - COMMAND grep -Eq ${searchpattern} - RESULT_VARIABLE HAS_CURL_STATIC) - unset(libchecker) - unset(searchpattern) - if(HAS_CURL_STATIC EQUAL 0) - set(HAS_CURL_STATIC TRUE) - else() - set(HAS_CURL_STATIC FALSE) - endif() - set(HAS_CURL_STATIC ${HAS_CURL_STATIC} CACHE INTERNAL - "OpenSSL is statically linked into Curl") - message(STATUS "OpenSSL is statically linked into Curl: ${HAS_CURL_STATIC}") - endif() - endif() - - if(HAS_CURL_STATIC) - set(CURL_DEFINITIONS -DHAS_CURL_STATIC=1) - endif() - if(NOT TARGET Curl::Curl) add_library(Curl::Curl UNKNOWN IMPORTED) set_target_properties(Curl::Curl PROPERTIES diff --git a/cmake/modules/FindFFMPEG.cmake b/cmake/modules/FindFFMPEG.cmake index 689cf28..e2fbe8d 100644 --- a/cmake/modules/FindFFMPEG.cmake +++ b/cmake/modules/FindFFMPEG.cmake @@ -67,7 +67,6 @@ endif() # external FFMPEG if(NOT ENABLE_INTERNAL_FFMPEG OR KODI_DEPENDSBUILD) if(FFMPEG_PATH) - set(ENV{PKG_CONFIG_PATH} "${FFMPEG_PATH}/lib/pkgconfig") list(APPEND CMAKE_PREFIX_PATH ${FFMPEG_PATH}) endif() @@ -236,8 +235,6 @@ if(NOT FFMPEG_FOUND) -DCROSSCOMPILING=${CMAKE_CROSSCOMPILING} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DOS=${OS} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_AR=${CMAKE_AR}) endif() @@ -253,6 +250,9 @@ if(NOT FFMPEG_FOUND) -DCORE_PLATFORM_NAME=${CORE_PLATFORM_NAME_LC} -DCPU=${CPU} -DENABLE_NEON=${ENABLE_NEON} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DENABLE_CCACHE=${ENABLE_CCACHE} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS} @@ -264,8 +264,12 @@ if(NOT FFMPEG_FOUND) ${CMAKE_SOURCE_DIR}/tools/depends/target/ffmpeg/FindGnuTls.cmake ) + find_program(BASH_COMMAND bash) + if(NOT BASH_COMMAND) + message(FATAL_ERROR "Internal FFmpeg requires bash.") + endif() file(WRITE ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg/ffmpeg-link-wrapper -"#!/bin/bash +"#!${BASH_COMMAND} if [[ $@ == *${APP_NAME_LC}.bin* || $@ == *${APP_NAME_LC}${APP_BINARY_SUFFIX}* || $@ == *${APP_NAME_LC}.so* || $@ == *${APP_NAME_LC}-test* ]] then avformat=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavcodec` diff --git a/cmake/modules/FindLircClient.cmake b/cmake/modules/FindLircClient.cmake new file mode 100644 index 0000000..528c38e --- /dev/null +++ b/cmake/modules/FindLircClient.cmake @@ -0,0 +1,36 @@ +# FindLircClient +# ----------- +# Finds the liblirc_client library +# +# This will will define the following variables:: +# +# LIRCCLIENT_FOUND - if false, do not try to link to lirc_client +# LIRCCLIENT_INCLUDE_DIRS - where to find lirc/lirc_client.h +# LIRCCLIENT_LIBRARYS - the library to link against +# LIRCCLIENT_DEFINITIONS - the lirc definitions + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIRC lirc QUIET) +endif() + +find_path(LIRCCLIENT_INCLUDE_DIR lirc/lirc_client.h PATHS ${PC_LIRC_INCLUDEDIR}) +find_library(LIRCCLIENT_LIBRARY lirc_client PATHS ${PC_LIRC_LIBDIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LircClient + REQUIRED_VARS LIRCCLIENT_LIBRARY LIRCCLIENT_INCLUDE_DIR) + +if(LIRCCLIENT_FOUND) + set(LIRCCLIENT_LIBRARIES ${LIRCCLIENT_LIBRARY}) + set(LIRCCLIENT_INCLUDE_DIRS ${LIRCCLIENT_INCLUDE_DIR}) + set(LIRCCLIENT_DEFINITIONS -DHAS_LIRC=1) + + if(NOT TARGET LIRCCLIENT::LIRCCLIENT) + add_library(LIRCCLIENT::LIRCCLIENT UNKNOWN IMPORTED) + set_target_properties(LIRCCLIENT::LIRCCLIENT PROPERTIES + IMPORTED_LOCATION "${LIRCCLIENT_LIBRARYS}" + INTERFACE_INCLUDE_DIRECTORIES "${LIRCCLIENT_INCLUDE_DIRS}") + endif() +endif() + +mark_as_advanced(LIRCCLIENT_LIBRARY LIRCCLIENT_INCLUDE_DIR) \ No newline at end of file diff --git a/cmake/modules/FindMariaDBClient.cmake b/cmake/modules/FindMariaDBClient.cmake new file mode 100644 index 0000000..1e5e736 --- /dev/null +++ b/cmake/modules/FindMariaDBClient.cmake @@ -0,0 +1,69 @@ +#.rst: +# FindMariaDBClient +# --------------- +# Finds the MariaDBClient library +# +# This will will define the following variables:: +# +# MARIADBCLIENT_FOUND - system has MariaDBClient +# MARIADBCLIENT_INCLUDE_DIRS - the MariaDBClient include directory +# MARIADBCLIENT_LIBRARIES - the MariaDBClient libraries +# MARIADBCLIENT_DEFINITIONS - the MariaDBClient compile definitions +# +# and the following imported targets:: +# +# MariaDBClient::MariaDBClient - The MariaDBClient library + +# Don't find system wide installed version on Windows +if(WIN32) + set(EXTRA_FIND_ARGS NO_SYSTEM_ENVIRONMENT_PATH) +else() + set(EXTRA_FIND_ARGS) +endif() + +find_path(MARIADBCLIENT_INCLUDE_DIR NAMES mariadb/mysql.h mariadb/server/mysql.h) +find_library(MARIADBCLIENT_LIBRARY_RELEASE NAMES mariadbclient libmariadb + PATH_SUFFIXES mariadb + ${EXTRA_FIND_ARGS}) +find_library(MARIADBCLIENT_LIBRARY_DEBUG NAMES mariadbclient libmariadb + PATH_SUFFIXES mariadb + ${EXTRA_FIND_ARGS}) + +if(MARIADBCLIENT_INCLUDE_DIR AND EXISTS "${MARIADBCLIENT_INCLUDE_DIR}/mariadb/mariadb_version.h") + file(STRINGS "${MARIADBCLIENT_INCLUDE_DIR}/mariadb/mariadb_version.h" mariadb_version_str REGEX "^#define[\t ]+MARIADB_CLIENT_VERSION_STR[\t ]+\".*\".*") + string(REGEX REPLACE "^#define[\t ]+MARIADB_CLIENT_VERSION_STR[\t ]+\"([^\"]+)\".*" "\\1" MARIADBCLIENT_VERSION_STRING "${mariadb_version_str}") + unset(mariadb_version_str) +endif() + +include(SelectLibraryConfigurations) +select_library_configurations(MARIADBCLIENT) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MariaDBClient + REQUIRED_VARS MARIADBCLIENT_LIBRARY MARIADBCLIENT_INCLUDE_DIR + VERSION_VAR MARIADBCLIENT_VERSION_STRING) + +if(MARIADBCLIENT_FOUND) + set(MARIADBCLIENT_LIBRARIES ${MARIADBCLIENT_LIBRARY}) + set(MARIADBCLIENT_INCLUDE_DIRS ${MARIADBCLIENT_INCLUDE_DIR}) + set(MARIADBCLIENT_DEFINITIONS -DHAS_MARIADB=1) + + if(NOT TARGET MariaDBClient::MariaDBClient) + add_library(MariaDBClient::MariaDBClient UNKNOWN IMPORTED) + if(MARIADBCLIENT_LIBRARY_RELEASE) + set_target_properties(MariaDBClient::MariaDBClient PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${MARIADBCLIENT_LIBRARY_RELEASE}") + endif() + if(MARIADBCLIENT_LIBRARY_DEBUG) + set_target_properties(MariaDBClient::MariaDBClient PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${MARIADBCLIENT_LIBRARY_DEBUG}") + endif() + set_target_properties(MariaDBClient::MariaDBClient PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${MARIADBCLIENT_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAS_MARIADB=1) + endif() +endif() + +mark_as_advanced(MARIADBCLIENT_INCLUDE_DIR MARIADBCLIENT_LIBRARY) diff --git a/cmake/modules/FindMicroHttpd.cmake b/cmake/modules/FindMicroHttpd.cmake index 232f8e5..d04878c 100644 --- a/cmake/modules/FindMicroHttpd.cmake +++ b/cmake/modules/FindMicroHttpd.cmake @@ -15,7 +15,7 @@ # MicroHttpd::MicroHttpd - The MicroHttpd library if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_MICROHTTPD libmicrohttpd>=0.4 QUIET) + pkg_check_modules(PC_MICROHTTPD libmicrohttpd>=0.9.40 QUIET) endif() find_path(MICROHTTPD_INCLUDE_DIR NAMES microhttpd.h diff --git a/cmake/modules/FindMir.cmake b/cmake/modules/FindMir.cmake index 47a441c..e66ff02 100644 --- a/cmake/modules/FindMir.cmake +++ b/cmake/modules/FindMir.cmake @@ -21,7 +21,7 @@ find_library(MIR_LIBRARY NAMES mirclient PATHS ${PC_MIR_LIBRARIES} ${PC_MIR_LIBRARY_DIRS}) include (FindPackageHandleStandardArgs) -find_package_handle_standard_args (MIR +find_package_handle_standard_args (Mir REQUIRED_VARS MIR_LIBRARY MIR_INCLUDE_DIR) if (MIR_FOUND) diff --git a/cmake/modules/FindSSH.cmake b/cmake/modules/FindSSH.cmake index ee65210..bf3837e 100644 --- a/cmake/modules/FindSSH.cmake +++ b/cmake/modules/FindSSH.cmake @@ -15,7 +15,7 @@ # SSH::SSH - The SSH library if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_SSH libssh QUIET) + pkg_check_modules(PC_SSH libssh>=0.6 QUIET) endif() find_path(SSH_INCLUDE_DIR NAMES libssh/libssh.h diff --git a/cmake/modules/FindWaylandProtocols.cmake b/cmake/modules/FindWaylandProtocols.cmake new file mode 100644 index 0000000..0b96ff0 --- /dev/null +++ b/cmake/modules/FindWaylandProtocols.cmake @@ -0,0 +1,24 @@ +# FindWaylandProtocols +# -------------------- +# Find wayland-protocols +# +# This will will define the following variables:: +# +# WAYLAND_PROTOCOLS_DIR - directory containing the additional Wayland protocols +# from the wayland-protocols package + +pkg_check_modules(PC_WAYLAND_PROTOCOLS wayland-protocols) +if(PC_WAYLAND_PROTOCOLS_FOUND) + pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir) +endif() + +# Promote to cache variables so all code can access it +set(WAYLAND_PROTOCOLS_DIR ${WAYLAND_PROTOCOLS_DIR} CACHE INTERNAL "") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WaylandProtocols + REQUIRED_VARS + PC_WAYLAND_PROTOCOLS_FOUND + WAYLAND_PROTOCOLS_DIR + VERSION_VAR + PC_WAYLAND_PROTOCOLS_VERSION) diff --git a/cmake/modules/FindWaylandpp.cmake b/cmake/modules/FindWaylandpp.cmake index 8a1cd74..336e613 100644 --- a/cmake/modules/FindWaylandpp.cmake +++ b/cmake/modules/FindWaylandpp.cmake @@ -1,64 +1,39 @@ # FindWaylandpp -# ----------- +# ------------- # Finds the waylandpp library # # This will will define the following variables:: # -# WAYLANDPP_FOUND - the system has Wayland -# WAYLANDPP_INCLUDE_DIRS - the Wayland include directory -# WAYLANDPP_LIBRARIES - the Wayland libraries -# WAYLANDPP_DEFINITIONS - the Wayland definitions - - -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_WAYLANDPP wayland-client++>=0.1 wayland-egl++ wayland-cursor++ wayland-scanner++ QUIET) - pkg_check_modules(PC_WAYLAND_PROTOCOLS wayland-protocols>=1.7 QUIET) - # TODO: Remove check when CMake minimum version is bumped globally - if(CMAKE_VERSION VERSION_EQUAL 3.4.0 OR CMAKE_VERSION VERSION_GREATER 3.4.0) - if(PC_WAYLANDPP_FOUND) - pkg_get_variable(PC_WAYLANDPP_SCANNER wayland-scanner++ wayland_scannerpp) - endif() - if(PC_WAYLAND_PROTOCOLS_FOUND) - pkg_get_variable(PC_WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir) - endif() - endif() +# WAYLANDPP_FOUND - the system has waylandpp +# WAYLANDPP_INCLUDE_DIRS - the waylandpp include directory +# WAYLANDPP_LIBRARIES - the waylandpp libraries +# WAYLANDPP_DEFINITIONS - the waylandpp definitions +# WAYLANDPP_SCANNER - path to wayland-scanner++ + +pkg_check_modules(WAYLANDPP wayland-client++ wayland-egl++ wayland-cursor++) +pkg_check_modules(PC_WAYLANDPP_SCANNER wayland-scanner++) +if(WAYLANDPP_FOUND) + pkg_get_variable(PC_WAYLANDPP_PKGDATADIR wayland-client++ pkgdatadir) +endif() +if(PC_WAYLANDPP_SCANNER_FOUND) + pkg_get_variable(PC_WAYLANDPP_SCANNER wayland-scanner++ wayland_scannerpp) endif() -find_path(WAYLANDPP_INCLUDE_DIR NAMES wayland-client.hpp - PATHS ${PC_WAYLANDPP_INCLUDE_DIRS}) - -find_library(WAYLANDPP_CLIENT_LIBRARY NAMES wayland-client++ - PATHS ${PC_WAYLANDPP_LIBRARIES} ${PC_WAYLANDPP_LIBRARY_DIRS}) - -find_library(WAYLANDPP_CURSOR_LIBRARY NAMES wayland-cursor++ - PATHS ${PC_WAYLANDPP_LIBRARIES} ${PC_WAYLANDPP_LIBRARY_DIRS}) - -find_library(WAYLANDPP_EGL_LIBRARY NAMES wayland-egl++ - PATHS ${PC_WAYLANDPP_LIBRARIES} ${PC_WAYLANDPP_LIBRARY_DIRS}) - -find_program(WAYLANDPP_SCANNER NAMES wayland-scanner++ - PATHS ${PC_WAYLANDPP_SCANNER}) +# Promote to cache variables so all code can access it +set(WAYLANDPP_PROTOCOLS_DIR "${PC_WAYLANDPP_PKGDATADIR}/protocols" CACHE INTERNAL "") -find_path(WAYLAND_PROTOCOLS_DIR NAMES unstable/xdg-shell/xdg-shell-unstable-v6.xml - PATHS ${PC_WAYLAND_PROTOCOLS_DIR} - DOC "Directory containing additional Wayland protocols") +# wayland-scanner++ is from native/host system in case of cross-compilation, so +# it's ok if we don't find it with pkgconfig +find_program(WAYLANDPP_SCANNER wayland-scanner++ PATHS ${PC_WAYLANDPP_SCANNER}) include (FindPackageHandleStandardArgs) find_package_handle_standard_args (Waylandpp REQUIRED_VARS - WAYLANDPP_INCLUDE_DIR - WAYLANDPP_CLIENT_LIBRARY - WAYLANDPP_CURSOR_LIBRARY - WAYLANDPP_EGL_LIBRARY + WAYLANDPP_FOUND WAYLANDPP_SCANNER - WAYLAND_PROTOCOLS_DIR VERSION_VAR - PC_WAYLANDPP_wayland-client++_VERSION) - -if (WAYLANDPP_FOUND) - set(WAYLANDPP_LIBRARIES ${WAYLANDPP_CLIENT_LIBRARY} ${WAYLANDPP_CURSOR_LIBRARY} ${WAYLANDPP_EGL_LIBRARY}) - set(WAYLANDPP_INCLUDE_DIRS ${PC_WAYLANDPP_INCLUDE_DIRS}) - set(WAYLANDPP_DEFINITIONS -DHAVE_WAYLAND=1) -endif() + WAYLANDPP_wayland-client++_VERSION) -mark_as_advanced (WAYLANDPP_CLIENT_LIBRARY WAYLANDPP_CURSOR_LIBRARY WAYLANDPP_EGL_LIBRARY WAYLANDPP_INCLUDE_DIR) +set(WAYLANDPP_DEFINITIONS -DHAVE_WAYLAND=1) +# Also pass on library directories +set(WAYLANDPP_LIBRARIES ${WAYLANDPP_LDFLAGS}) diff --git a/cmake/modules/FindXkbcommon.cmake b/cmake/modules/FindXkbcommon.cmake index 88c6121..2a84fe5 100644 --- a/cmake/modules/FindXkbcommon.cmake +++ b/cmake/modules/FindXkbcommon.cmake @@ -9,27 +9,13 @@ # XKBCOMMON_LIBRARIES - the libxkbcommon libraries # XKBCOMMON_DEFINITIONS - the libxkbcommon definitions - -if(PKG_CONFIG_FOUND) - pkg_check_modules (PC_XKBCOMMON xkbcommon QUIET) -endif() - -find_path(XKBCOMMON_INCLUDE_DIR NAMES xkbcommon/xkbcommon.h - PATHS ${PC_XKBCOMMON_INCLUDE_DIRS}) - -find_library(XKBCOMMON_LIBRARY NAMES xkbcommon - PATHS ${PC_XKBCOMMON_LIBRARIES} ${PC_XKBCOMMON_LIBRARY_DIRS}) +pkg_check_modules (XKBCOMMON xkbcommon) include (FindPackageHandleStandardArgs) -find_package_handle_standard_args (XKBCOMMON +find_package_handle_standard_args (Xkbcommon REQUIRED_VARS - XKBCOMMON_INCLUDE_DIR - XKBCOMMON_LIBRARY) - -if (XKBCOMMON_FOUND) - set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY}) - set(XKBCOMMON_INCLUDE_DIRS ${PC_XKBCOMMON_INCLUDE_DIRS}) - set(XKBCOMMON_DEFINITIONS -DHAVE_XKBCOMMON=1) -endif() + XKBCOMMON_FOUND) -mark_as_advanced (XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR) \ No newline at end of file +set(XKBCOMMON_DEFINITIONS -DHAVE_XKBCOMMON=1) +set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LDFLAGS}) +set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDEDIR}) diff --git a/cmake/platform/freebsd/wayland.cmake b/cmake/platform/freebsd/wayland.cmake index 55fbd8a..c9c1d00 100644 --- a/cmake/platform/freebsd/wayland.cmake +++ b/cmake/platform/freebsd/wayland.cmake @@ -1,17 +1 @@ -set(PLATFORM_REQUIRED_DEPS EGL Waylandpp LibDRM Xkbcommon) -set(PLATFORM_OPTIONAL_DEPS VAAPI) - -set(WAYLAND_RENDER_SYSTEM "" CACHE STRING "Render system to use with Wayland: \"gl\" or \"gles\"") - -if(WAYLAND_RENDER_SYSTEM STREQUAL "gl") - list(APPEND PLATFORM_REQUIRED_DEPS OpenGl) -elseif(WAYLAND_RENDER_SYSTEM STREQUAL "gles") - list(APPEND PLATFORM_REQUIRED_DEPS OpenGLES) -else() - message(SEND_ERROR "You need to decide whether you want to use GL- or GLES-based rendering in combination with the Wayland windowing system. Please set WAYLAND_RENDER_SYSTEM to either \"gl\" or \"gles\". For normal desktop systems, you will usually want to use \"gl\".") -endif() - -set(PLATFORM_GLOBAL_TARGET_DEPS generate-wayland-extra-protocols) -set(WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}") -# for wayland-extra-protocols.hpp -include_directories("${WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR}") +include(cmake/platform/linux/wayland.cmake) diff --git a/cmake/platform/linux/aml.cmake b/cmake/platform/linux/aml.cmake index c1d464d..82e242b 100644 --- a/cmake/platform/linux/aml.cmake +++ b/cmake/platform/linux/aml.cmake @@ -1 +1,3 @@ set(PLATFORM_REQUIRED_DEPS OpenGLES AML EGL) +set(APP_RENDER_SYSTEM gles) +list(APPEND PLATFORM_DEFINES -DMESA_EGL_NO_X11_HEADERS) diff --git a/cmake/platform/linux/gbm.cmake b/cmake/platform/linux/gbm.cmake index 6a9165a..d8e73d0 100644 --- a/cmake/platform/linux/gbm.cmake +++ b/cmake/platform/linux/gbm.cmake @@ -1,2 +1,4 @@ set(PLATFORM_REQUIRED_DEPS OpenGLES EGL GBM LibDRM) set(PLATFORM_OPTIONAL_DEPS VAAPI) +set(APP_RENDER_SYSTEM gles) +list(APPEND PLATFORM_DEFINES -DMESA_EGL_NO_X11_HEADERS -DPLATFORM_SETTINGS_FILE=gbm.xml) diff --git a/cmake/platform/linux/mir.cmake b/cmake/platform/linux/mir.cmake index 7f20da8..0e672a9 100644 --- a/cmake/platform/linux/mir.cmake +++ b/cmake/platform/linux/mir.cmake @@ -1,2 +1,3 @@ set(PLATFORM_REQUIRED_DEPS OpenGl EGL Mir LibDRM) set(PLATFORM_OPTIONAL_DEPS VAAPI OpenGLES) +set(APP_RENDER_SYSTEM gl) diff --git a/cmake/platform/linux/rbpi.cmake b/cmake/platform/linux/rbpi.cmake index 4899857..fa9a1dc 100644 --- a/cmake/platform/linux/rbpi.cmake +++ b/cmake/platform/linux/rbpi.cmake @@ -1 +1,3 @@ set(PLATFORM_REQUIRED_DEPS OpenGLES EGL MMAL) +set(APP_RENDER_SYSTEM gles) +list(APPEND PLATFORM_DEFINES -D_ARMEL -DTARGET_RASPBERRY_PI) diff --git a/cmake/platform/linux/wayland.cmake b/cmake/platform/linux/wayland.cmake index 3934834..f42dbf5 100644 --- a/cmake/platform/linux/wayland.cmake +++ b/cmake/platform/linux/wayland.cmake @@ -1,12 +1,14 @@ -set(PLATFORM_REQUIRED_DEPS EGL Waylandpp LibDRM Xkbcommon) +set(PLATFORM_REQUIRED_DEPS EGL WaylandProtocols>=1.7 Waylandpp>=0.2.2 LibDRM Xkbcommon>=0.4.1) set(PLATFORM_OPTIONAL_DEPS VAAPI) set(WAYLAND_RENDER_SYSTEM "" CACHE STRING "Render system to use with Wayland: \"gl\" or \"gles\"") if(WAYLAND_RENDER_SYSTEM STREQUAL "gl") list(APPEND PLATFORM_REQUIRED_DEPS OpenGl) + set(APP_RENDER_SYSTEM gl) elseif(WAYLAND_RENDER_SYSTEM STREQUAL "gles") list(APPEND PLATFORM_REQUIRED_DEPS OpenGLES) + set(APP_RENDER_SYSTEM gles) else() message(SEND_ERROR "You need to decide whether you want to use GL- or GLES-based rendering in combination with the Wayland windowing system. Please set WAYLAND_RENDER_SYSTEM to either \"gl\" or \"gles\". For normal desktop systems, you will usually want to use \"gl\".") endif() @@ -14,4 +16,4 @@ endif() set(PLATFORM_GLOBAL_TARGET_DEPS generate-wayland-extra-protocols) set(WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}") # for wayland-extra-protocols.hpp -include_directories("${WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR}") \ No newline at end of file +include_directories("${WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR}") diff --git a/cmake/platform/linux/x11.cmake b/cmake/platform/linux/x11.cmake index 656fd66..09cebde 100644 --- a/cmake/platform/linux/x11.cmake +++ b/cmake/platform/linux/x11.cmake @@ -1,2 +1,3 @@ set(PLATFORM_REQUIRED_DEPS OpenGl EGL X XRandR LibDRM) set(PLATFORM_OPTIONAL_DEPS VAAPI VDPAU GLX) +set(APP_RENDER_SYSTEM gl) diff --git a/cmake/scripts/android/ArchSetup.cmake b/cmake/scripts/android/ArchSetup.cmake index 03056fa..69bb88d 100644 --- a/cmake/scripts/android/ArchSetup.cmake +++ b/cmake/scripts/android/ArchSetup.cmake @@ -1,7 +1,5 @@ if(NOT CMAKE_TOOLCHAIN_FILE) message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for android. See ${CMAKE_SOURCE_DIR}/cmake/README.md") -elseif(NOT SDK_PLATFORM) - message(FATAL_ERROR "Toolchain did not define SDK_PLATFORM. Possibly outdated depends.") endif() set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_ANDROID) @@ -34,7 +32,7 @@ else() endif() # Additional SYSTEM_DEFINES -list(APPEND SYSTEM_DEFINES -DHAS_ZEROCONF) +list(APPEND SYSTEM_DEFINES -DHAS_ZEROCONF -DHAS_LINUX_NETWORK) set(ENABLE_X11 OFF CACHE BOOL "" FORCE) set(ENABLE_AML OFF CACHE BOOL "" FORCE) diff --git a/cmake/scripts/android/Install.cmake b/cmake/scripts/android/Install.cmake index cc52d51..cc53607 100644 --- a/cmake/scripts/android/Install.cmake +++ b/cmake/scripts/android/Install.cmake @@ -53,29 +53,47 @@ endif() unset(patch) set(package_files strings.xml - activity_main.xml colors.xml searchable.xml AndroidManifest.xml build.gradle - src/Main.java src/Splash.java + src/Main.java src/XBMCBroadcastReceiver.java - src/XBMCImageContentProvider.java src/XBMCInputDeviceListener.java src/XBMCJsonRPC.java - src/XBMCMediaContentProvider.java + src/XBMCMainView.java src/XBMCMediaSession.java src/XBMCRecommendationBuilder.java src/XBMCSearchableActivity.java src/XBMCSettingsContentObserver.java src/XBMCProperties.java src/XBMCVideoView.java + src/XBMCFile.java + src/channels/SyncChannelJobService.java + src/channels/SyncProgramsJobService.java + src/channels/model/XBMCDatabase.java + src/channels/model/Subscription.java + src/channels/util/SharedPreferencesHelper.java + src/channels/util/TvUtil.java src/interfaces/XBMCAudioManagerOnAudioFocusChangeListener.java src/interfaces/XBMCSurfaceTextureOnFrameAvailableListener.java - src/interfaces/XBMCNsdManagerDiscoveryListener.java - src/interfaces/XBMCNsdManagerRegistrationListener.java src/interfaces/XBMCNsdManagerResolveListener.java + src/interfaces/XBMCNsdManagerRegistrationListener.java + src/interfaces/XBMCNsdManagerDiscoveryListener.java + src/interfaces/XBMCMediaDrmOnEventListener.java + src/model/TVEpisode.java + src/model/Movie.java + src/model/TVShow.java + src/model/File.java + src/model/Album.java + src/model/Song.java + src/model/MusicVideo.java + src/model/Media.java + src/content/XBMCFileContentProvider.java + src/content/XBMCMediaContentProvider.java + src/content/XBMCContentProvider.java + src/content/XBMCYTDLContentProvider.java ) foreach(file IN LISTS package_files) configure_file(${CMAKE_SOURCE_DIR}/tools/android/packaging/xbmc/${file}.in @@ -154,7 +172,6 @@ foreach(target apk obb apk-unsigned apk-obb apk-obb-unsigned apk-noobb apk-clean DEPENDS_PATH=${DEPENDS_PATH} NDKROOT=${NDKROOT} SDKROOT=${SDKROOT} - SDK_PLATFORM=${SDK_PLATFORM} STRIP=${CMAKE_STRIP} AAPT=${AAPT_EXECUTABLE} DX=${DX_EXECUTABLE} diff --git a/cmake/scripts/common/AddonHelpers.cmake b/cmake/scripts/common/AddonHelpers.cmake index c11923e..5470940 100644 --- a/cmake/scripts/common/AddonHelpers.cmake +++ b/cmake/scripts/common/AddonHelpers.cmake @@ -6,15 +6,20 @@ # Sadly we cannot extend the 'package' target, as it is a builtin target, see # http://public.kitware.com/Bug/view.php?id=8438 # Thus, we have to add an 'addon-package' target. -add_custom_target(addon-package - COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target package) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + add_custom_target(addon-package DEPENDS PACKAGE) +else() + add_custom_target(addon-package + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target package) +endif() macro(add_cpack_workaround target version ext) if(NOT PACKAGE_DIR) set(PACKAGE_DIR "${CMAKE_INSTALL_PREFIX}/zips") endif() - add_custom_command(TARGET addon-package PRE_BUILD + add_custom_command(TARGET addon-package POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIR} COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_PACKAGE_DIRECTORY}/addon-${target}-${version}.${ext} ${PACKAGE_DIR}/${target}-${version}.${ext}) endmacro() @@ -194,7 +199,7 @@ macro (build_addon target prefix libs) endif() string(CONFIGURE "${addon_file}" addon_file_conf @ONLY) - file(GENERATE OUTPUT ${PROJECT_SOURCE_DIR}/${target}/addon.xml CONTENT "${addon_file_conf}") + file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}/addon.xml CONTENT "${addon_file_conf}") if(${APP_NAME_UC}_BUILD_DIR) file(GENERATE OUTPUT ${${APP_NAME_UC}_BUILD_DIR}/addons/${target}/addon.xml CONTENT "${addon_file_conf}") endif() @@ -207,7 +212,7 @@ macro (build_addon target prefix libs) file(READ ${PROJECT_SOURCE_DIR}/${target}/resources/settings.xml.in settings_file) string(CONFIGURE "${settings_file}" settings_file_conf @ONLY) - file(GENERATE OUTPUT ${PROJECT_SOURCE_DIR}/${target}/resources/settings.xml CONTENT "${settings_file_conf}") + file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}/resources/settings.xml CONTENT "${settings_file_conf}") if(${APP_NAME_UC}_BUILD_DIR) file(GENERATE OUTPUT ${${APP_NAME_UC}_BUILD_DIR}/addons/${target}/resources/settings.xml CONTENT "${settings_file_conf}") endif() @@ -230,7 +235,7 @@ macro (build_addon target prefix libs) set(CPACK_COMPONENTS_IGNORE_GROUPS 1) list(APPEND CPACK_COMPONENTS_ALL ${target}-${${prefix}_VERSION}) # Pack files together to create an archive - install(DIRECTORY ${target} DESTINATION ./ + install(DIRECTORY ${target} ${CMAKE_CURRENT_BINARY_DIR}/${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION} REGEX ".+\\.xml\\.in(clude)?$" EXCLUDE) if(WIN32) @@ -247,21 +252,15 @@ macro (build_addon target prefix libs) endif() endif() - # in case of a VC++ project the installation location contains a $(Configuration) VS variable - # we replace it with ${CMAKE_BUILD_TYPE} (which doesn't cover the case when the build configuration - # is changed within Visual Studio) - string(REPLACE "$(Configuration)" "${CMAKE_BUILD_TYPE}" LIBRARY_LOCATION "${LIBRARY_LOCATION}") - if(${prefix}_SOURCES) # install the generated DLL file install(PROGRAMS ${LIBRARY_LOCATION} DESTINATION ${target} COMPONENT ${target}-${${prefix}_VERSION}) - if(CMAKE_BUILD_TYPE MATCHES Debug) - # for debug builds also install the PDB file - install(FILES $ DESTINATION ${target} - COMPONENT ${target}-${${prefix}_VERSION}) - endif() + # for debug builds also install the PDB file + install(FILES $ DESTINATION ${target} + CONFIGURATIONS Debug RelWithDebInfo + COMPONENT ${target}-${${prefix}_VERSION}) endif() if(${prefix}_CUSTOM_BINARY) install(FILES ${LIBRARY_LOCATION} DESTINATION ${target} RENAME ${LIBRARY_FILENAME}) @@ -325,7 +324,7 @@ macro (build_addon target prefix libs) if (${prefix}_CUSTOM_BINARY) install(FILES ${LIBRARY_LOCATION} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target} RENAME ${LIBRARY_FILENAME}) endif() - install(DIRECTORY ${target} DESTINATION ${CMAKE_INSTALL_DATADIR}/addons + install(DIRECTORY ${target} ${CMAKE_CURRENT_BINARY_DIR}/${target} DESTINATION ${CMAKE_INSTALL_DATADIR}/addons REGEX ".+\\.xml\\.in(clude)?$" EXCLUDE) if(${prefix}_CUSTOM_DATA) install(DIRECTORY ${${prefix}_CUSTOM_DATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/addons/${target}/resources) diff --git a/cmake/scripts/common/ArchSetup.cmake b/cmake/scripts/common/ArchSetup.cmake index 3b81533..c97929e 100644 --- a/cmake/scripts/common/ArchSetup.cmake +++ b/cmake/scripts/common/ArchSetup.cmake @@ -153,6 +153,10 @@ if(NOT DEFINED NEON OR NEON) endif() endif() +if(PLATFORM_DEFINES) + add_options(ALL_LANGUAGES ALL_BUILDS ${PLATFORM_DEFINES}) +endif() + if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_options (ALL_LANGUAGES DEBUG "-g" "-D_DEBUG" "-Wall") endif() diff --git a/cmake/scripts/common/HandleDepends.cmake b/cmake/scripts/common/HandleDepends.cmake index 49e5ac8..fb110d6 100644 --- a/cmake/scripts/common/HandleDepends.cmake +++ b/cmake/scripts/common/HandleDepends.cmake @@ -54,9 +54,6 @@ 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}") diff --git a/cmake/scripts/common/Macros.cmake b/cmake/scripts/common/Macros.cmake index d508f87..c21069d 100644 --- a/cmake/scripts/common/Macros.cmake +++ b/cmake/scripts/common/Macros.cmake @@ -338,15 +338,54 @@ macro(export_dep) mark_as_advanced(${depup}_LIBRARIES) endmacro() -# add a required dependency of main application +# split dependency specification to name and version # Arguments: -# dep_list name of find rule for dependency, used uppercased for variable prefix -# also accepts a list of multiple dependencies +# depspec dependency specification that can optionally include a required +# package version +# syntax: [package name], [package name]>=[version] (minimum version), +# or [package name]=[version] (exact version) +# name_outvar variable that should receive the package name +# version_outvar variable that should receive the package version part (>=[version]) # On return: -# dependency added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES} +# ${name_outvar} and ${version_outvar} in caller scope are set to respective values. +# ${version_outvar} may be unset if there is no specific version requested. +function(split_dependency_specification depspec name_outvar version_outvar) + if(${depspec} MATCHES "^([^>]*)(>?=[0-9.]+)$") + set(${name_outvar} ${CMAKE_MATCH_1} PARENT_SCOPE) + set(${version_outvar} ${CMAKE_MATCH_2} PARENT_SCOPE) + else() + set(${name_outvar} ${depspec} PARENT_SCOPE) + unset(${version_outvar} PARENT_SCOPE) + endif() +endfunction() + +# helper macro to split version info from req and call find_package +macro(find_package_with_ver package) + set(_find_arguments "${ARGN}") + if("${ARGV1}" MATCHES "^(>)?=([0-9.]+)$") + # We have a version spec, parse it + list(REMOVE_AT _find_arguments 0) + # ">" not present? -> exact match + if(NOT CMAKE_MATCH_1) + list(INSERT _find_arguments 0 "EXACT") + endif() + find_package(${package} ${CMAKE_MATCH_2} ${_find_arguments}) + else() + find_package(${package} ${_find_arguments}) + endif() + unset(_find_arguments) +endmacro() + +# add required dependencies of main application +# Arguments: +# dep_list One or many dependency specifications (see split_dependency_specification) +# for syntax). The dependency name is used uppercased as variable prefix. +# On return: +# dependencies added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES} function(core_require_dep) - foreach(dep ${ARGN}) - find_package(${dep} REQUIRED) + foreach(depspec ${ARGN}) + split_dependency_specification(${depspec} dep version) + find_package_with_ver(${dep} ${version} REQUIRED) string(TOUPPER ${dep} depup) list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) list(APPEND DEPLIBS ${${depup}_LIBRARIES}) @@ -355,15 +394,16 @@ function(core_require_dep) endforeach() endfunction() -# add a required dyloaded dependency of main application +# add required dyloaded dependencies of main application # Arguments: -# dep_list name of find rule for dependency, used uppercased for variable prefix -# also accepts a list of multiple dependencies +# dep_list One or many dependency specifications (see split_dependency_specification) +# for syntax). The dependency name is used uppercased as variable prefix. # On return: # dependency added to ${SYSTEM_INCLUDES}, ${dep}_SONAME is set up function(core_require_dyload_dep) - foreach(dep ${ARGN}) - find_package(${dep} REQUIRED) + foreach(depspec ${ARGN}) + split_dependency_specification(${depspec} dep version) + find_package_with_ver(${dep} ${version} REQUIRED) string(TOUPPER ${dep} depup) list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) @@ -385,20 +425,21 @@ macro(setup_enable_switch) set(${enable_switch} "AUTO" CACHE STRING "Enable ${depup} support?") endmacro() -# add an optional dependency of main application +# add optional dependencies of main application # Arguments: -# dep_list name of find rule for dependency, used uppercased for variable prefix -# also accepts a list of multiple dependencies +# dep_list One or many dependency specifications (see split_dependency_specification) +# for syntax). The dependency name is used uppercased as variable prefix. # On return: # dependency optionally added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES} function(core_optional_dep) - foreach(dep ${ARGN}) + foreach(depspec ${ARGN}) set(_required False) + split_dependency_specification(${depspec} dep version) setup_enable_switch() if(${enable_switch} STREQUAL AUTO) - find_package(${dep}) + find_package_with_ver(${dep} ${version}) elseif(${${enable_switch}}) - find_package(${dep} REQUIRED) + find_package_with_ver(${dep} ${version} REQUIRED) set(_required True) endif() @@ -417,20 +458,21 @@ function(core_optional_dep) set(final_message ${final_message} PARENT_SCOPE) endfunction() -# add an optional dyloaded dependency of main application +# add optional dyloaded dependencies of main application # Arguments: -# dep_list name of find rule for dependency, used uppercased for variable prefix -# also accepts a list of multiple dependencies +# dep_list One or many dependency specifications (see split_dependency_specification) +# for syntax). The dependency name is used uppercased as variable prefix. # On return: # dependency optionally added to ${SYSTEM_INCLUDES}, ${DEP_DEFINES}, ${dep}_SONAME is set up function(core_optional_dyload_dep) - foreach(dep ${ARGN}) + foreach(depspec ${ARGN}) set(_required False) - setup_enable_switch() + split_dependency_specification(${depspec} dep version) + setup_enable_switch() if(${enable_switch} STREQUAL AUTO) - find_package(${dep}) + find_package_with_ver(${dep} ${version}) elseif(${${enable_switch}}) - find_package(${dep} REQUIRED) + find_package_with_ver(${dep} ${version} REQUIRED) set(_required True) endif() @@ -592,6 +634,7 @@ function(core_find_git_rev stamp) else() find_package(Git) if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git) + # get tree status i.e. clean working tree vs dirty (uncommited or unstashed changes, etc.) execute_process(COMMAND ${GIT_EXECUTABLE} update-index --ignore-submodules -q --refresh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) execute_process(COMMAND ${GIT_EXECUTABLE} diff-files --ignore-submodules --quiet -- @@ -602,21 +645,21 @@ function(core_find_git_rev stamp) RESULT_VARIABLE status_code WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) endif() + # get HEAD commit SHA-1 + execute_process(COMMAND ${GIT_EXECUTABLE} log -n 1 --pretty=format:"%h" HEAD + OUTPUT_VARIABLE HASH + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + string(REPLACE "\"" "" HASH ${HASH}) + if(status_code) - execute_process(COMMAND ${GIT_EXECUTABLE} log -n 1 --pretty=format:"%h-dirty" HEAD - OUTPUT_VARIABLE HASH - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - string(SUBSTRING ${HASH} 1 13 HASH) - else() - execute_process(COMMAND ${GIT_EXECUTABLE} log -n 1 --pretty=format:"%h" HEAD - OUTPUT_VARIABLE HASH - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - string(SUBSTRING ${HASH} 1 7 HASH) + string(CONCAT HASH ${HASH} "-dirty") endif() + + # get HEAD commit date execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:"%cd" --date=short HEAD OUTPUT_VARIABLE DATE WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - string(SUBSTRING ${DATE} 1 10 DATE) + string(REPLACE "\"" "" DATE ${DATE}) string(REPLACE "-" "" DATE ${DATE}) else() string(TIMESTAMP DATE "%Y%m%d" UTC) diff --git a/cmake/scripts/common/Uninstall.cmake b/cmake/scripts/common/Uninstall.cmake index 5660e19..5753857 100644 --- a/cmake/scripts/common/Uninstall.cmake +++ b/cmake/scripts/common/Uninstall.cmake @@ -1,9 +1,40 @@ +macro(remove_empty_dirs) + list(REMOVE_DUPLICATES DIRECTORIES) + unset(PDIRECTORIES) + foreach(dir IN LISTS DIRECTORIES) + if(EXISTS $ENV{DESTDIR}${dir}) + file(GLOB _res $ENV{DESTDIR}${dir}/*) + list(LENGTH _res _len) + if(_len EQUAL 0 AND EXISTS $ENV{DESTDIR}${dir}) + message(STATUS "Removing empty dir: ${dir}") + execute_process( + COMMAND ${CMAKE_COMMAND} -E remove_directory $ENV{DESTDIR}${dir} + OUTPUT_VARIABLE rm_out + RESULT_VARIABLE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Failed to remove directory: $ENV{DESTDIR}${dir}") + endif() + get_filename_component(_pdir $ENV{DESTDIR}${dir} DIRECTORY) + list(APPEND PDIRECTORIES ${_pdir}) + endif() + endif() + endforeach() + list(LENGTH PDIRECTORIES _plen) + if(_plen GREATER 0) + set(DIRECTORIES ${PDIRECTORIES}) + remove_empty_dirs() + endif() +endmacro() + # Uninstall target set(MANIFEST ${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt) if(EXISTS ${MANIFEST}) file(STRINGS ${MANIFEST} files) foreach(file IN LISTS files) if(EXISTS $ENV{DESTDIR}${file}) + get_filename_component(_dir $ENV{DESTDIR}${file} DIRECTORY) + list(APPEND DIRECTORIES $ENV{DESTDIR}${_dir}) message(STATUS "Uninstalling: ${file}") execute_process( COMMAND ${CMAKE_COMMAND} -E remove $ENV{DESTDIR}${file} @@ -17,6 +48,11 @@ if(EXISTS ${MANIFEST}) message(STATUS "File does not exist: $ENV{DESTDIR}${file}") endif() endforeach(file) + + # delete empty dirs + if(DIRECTORIES) + remove_empty_dirs() + endif() else() message(STATUS "Cannot find install manifest: '${MANIFEST}'") endif() diff --git a/cmake/scripts/freebsd/ArchSetup.cmake b/cmake/scripts/freebsd/ArchSetup.cmake index 8ee78fc..db11bf8 100644 --- a/cmake/scripts/freebsd/ArchSetup.cmake +++ b/cmake/scripts/freebsd/ArchSetup.cmake @@ -15,5 +15,10 @@ else() endif() endif() +# Disable ALSA by default +if(NOT ENABLE_ALSA) + option(ENABLE_ALSA "Enable alsa support?" OFF) +endif() + # Additional SYSTEM_DEFINES list(APPEND SYSTEM_DEFINES -DHAS_LINUX_NETWORK) diff --git a/cmake/scripts/ios/ArchSetup.cmake b/cmake/scripts/ios/ArchSetup.cmake index 0808eb2..bec8a7c 100644 --- a/cmake/scripts/ios/ArchSetup.cmake +++ b/cmake/scripts/ios/ArchSetup.cmake @@ -39,7 +39,7 @@ 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 "6.0") +set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "9.0") set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2") set(CMAKE_XCODE_ATTRIBUTE_INLINES_ARE_PRIVATE_EXTERN OFF) diff --git a/cmake/scripts/linux/ArchSetup.cmake b/cmake/scripts/linux/ArchSetup.cmake index ee69c09..fcee675 100644 --- a/cmake/scripts/linux/ArchSetup.cmake +++ b/cmake/scripts/linux/ArchSetup.cmake @@ -1,8 +1,5 @@ -set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_LINUX) -# temp until further cleanup is done -if(CORE_PLATFORM_NAME_LC STREQUAL rbpi) - list(APPEND ARCH_DEFINES -D_ARMEL -DTARGET_RASPBERRY_PI) -endif() +# we always want to use GNU features if available, so set _GNU_SOURCE +set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_LINUX -D_GNU_SOURCE) set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) set(PLATFORM_DIR platform/linux) @@ -21,14 +18,17 @@ else() set(ARCH arm) set(NEON False) set(NEON_FLAGS "-mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp") - elseif(CPU MATCHES "cortex-a7" OR CPU MATCHES "cortex-a53") + elseif(CPU MATCHES "cortex-a7") set(ARCH arm) set(NEON True) - set(NEON_FLAGS "-fPIC -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 -mvectorize-with-neon-quad") + set(NEON_FLAGS "-fPIC -mcpu=cortex-a7") + elseif(CPU MATCHES "cortex-a53") + set(ARCH arm) + set(NEON True) + set(NEON_FLAGS "-fPIC -mcpu=cortex-a53") elseif(CPU MATCHES arm) set(ARCH arm) set(NEON True) - set(NEON_FLAGS "-mfpu=neon -mvectorize-with-neon-quad") elseif(CPU MATCHES aarch64 OR CPU MATCHES arm64) set(ARCH aarch64) set(NEON True) @@ -37,6 +37,16 @@ else() endif() endif() +# temp until further cleanup is done +# add Raspberry Pi 2 and 3 specific flags +if(CORE_PLATFORM_NAME_LC STREQUAL rbpi) + if(CPU MATCHES "cortex-a7") + set(NEON_FLAGS "-fPIC -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 -mvectorize-with-neon-quad") + elseif(CPU MATCHES "cortex-a53") + set(NEON_FLAGS "-fPIC -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad") + endif() +endif() + if((CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_BUILD_TYPE STREQUAL MinSizeRel) AND CMAKE_COMPILER_IS_GNUCXX) # Make sure we strip binaries in Release build @@ -84,7 +94,7 @@ set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") check_symbol_exists("mkostemp" "stdlib.h" HAVE_MKOSTEMP) set(CMAKE_REQUIRED_DEFINITIONS "") if(HAVE_MKOSTEMP) - list(APPEND ARCH_DEFINES "-DHAVE_MKOSTEMP=1" "-D_GNU_SOURCE") + list(APPEND ARCH_DEFINES "-DHAVE_MKOSTEMP=1") endif() # Additional SYSTEM_DEFINES diff --git a/cmake/scripts/linux/ExtraTargets.cmake b/cmake/scripts/linux/ExtraTargets.cmake index 4753f73..37d196a 100644 --- a/cmake/scripts/linux/ExtraTargets.cmake +++ b/cmake/scripts/linux/ExtraTargets.cmake @@ -17,7 +17,9 @@ endif() if(CORE_PLATFORM_NAME_LC STREQUAL "wayland") # This cannot go into wayland.cmake since it requires the Wayland dependencies # to already be resolved - set(PROTOCOL_XMLS "${WAYLAND_PROTOCOLS_DIR}/unstable/xdg-shell/xdg-shell-unstable-v6.xml" + set(PROTOCOL_XMLS "${WAYLANDPP_PROTOCOLS_DIR}/presentation-time.xml" + "${WAYLANDPP_PROTOCOLS_DIR}/xdg-shell.xml" + "${WAYLAND_PROTOCOLS_DIR}/unstable/xdg-shell/xdg-shell-unstable-v6.xml" "${WAYLAND_PROTOCOLS_DIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml") add_custom_command(OUTPUT "${WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR}/wayland-extra-protocols.hpp" "${WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR}/wayland-extra-protocols.cpp" COMMAND "${WAYLANDPP_SCANNER}" ${PROTOCOL_XMLS} "${WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR}/wayland-extra-protocols.hpp" "${WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR}/wayland-extra-protocols.cpp" @@ -26,4 +28,4 @@ if(CORE_PLATFORM_NAME_LC STREQUAL "wayland") # Dummy target for dependencies add_custom_target(generate-wayland-extra-protocols DEPENDS wayland-extra-protocols.hpp) -endif() \ No newline at end of file +endif() diff --git a/cmake/scripts/windows/ArchSetup.cmake b/cmake/scripts/windows/ArchSetup.cmake index 8e4f61d..b3963a6 100644 --- a/cmake/scripts/windows/ArchSetup.cmake +++ b/cmake/scripts/windows/ArchSetup.cmake @@ -1,3 +1,12 @@ +# Minimum SDK version we support +set(VS_MINIMUM_SDK_VERSION 10.0.14393.0) + +if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION VERSION_LESS VS_MINIMUM_SDK_VERSION) + message(FATAL_ERROR "Detected Windows SDK version is ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}.\n" + "Windows SDK ${VS_MINIMUM_SDK_VERSION} or higher is required.\n" + "INFO: Windows SDKs can be installed from the Visual Studio installer.") +endif() + # -------- Architecture settings --------- if(CMAKE_SIZEOF_VOID_P EQUAL 4) @@ -12,6 +21,7 @@ endif() # -------- Paths (mainly for find_package) --------- set(PLATFORM_DIR platform/win32) +set(APP_RENDER_SYSTEM dx11) set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/win32/WinMain.cpp) @@ -31,7 +41,7 @@ set(PYTHON_INCLUDE_DIR ${DEPENDENCIES_DIR}/include/python) add_options(CXX ALL_BUILDS "/wd\"4996\"") set(ARCH_DEFINES -D_WINDOWS -DTARGET_WINDOWS -DTARGET_WINDOWS_DESKTOP -D__SSE__ -D__SSE2__) -set(SYSTEM_DEFINES -DNOMINMAX -DHAS_DX -D__STDC_CONSTANT_MACROS +set(SYSTEM_DEFINES -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DHAS_DX -D__STDC_CONSTANT_MACROS -DTAGLIB_STATIC -DNPT_CONFIG_ENABLE_LOGGING -DPLT_HTTP_DEFAULT_USER_AGENT="UPnP/1.0 DLNADOC/1.50 Kodi" -DPLT_HTTP_DEFAULT_SERVER="UPnP/1.0 DLNADOC/1.50 Kodi" @@ -43,7 +53,7 @@ if(${ARCH} STREQUAL win32) endif() # Additional SYSTEM_DEFINES -list(APPEND SYSTEM_DEFINES -DHAS_IRSERVERSUITE -DHAS_WIN32_NETWORK -DHAS_FILESYSTEM_SMB) +list(APPEND SYSTEM_DEFINES -DHAS_WIN32_NETWORK -DHAS_FILESYSTEM_SMB) # Make sure /FS is set for Visual Studio in order to prevent simultaneous access to pdb files. if(CMAKE_GENERATOR MATCHES "Visual Studio") diff --git a/cmake/scripts/windows/tools/patch.cmake b/cmake/scripts/windows/tools/patch.cmake index 0a342fa..b955b4c 100644 --- a/cmake/scripts/windows/tools/patch.cmake +++ b/cmake/scripts/windows/tools/patch.cmake @@ -2,7 +2,7 @@ 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_NAME "patch-2.7.6-bin") 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}) @@ -28,6 +28,11 @@ else() # copy patch.exe into the output directory file(INSTALL ${PATCH_BINARY_PATH} DESTINATION ${ADDON_DEPENDS_PATH}/bin) + # copy patch depends + file(GLOB PATCH_BINARIES ${PATCH_PATH}/bin/*.dll) + if(NOT "${PATCH_BINARIES}" STREQUAL "") + file(INSTALL ${PATCH_BINARIES} DESTINATION ${ADDON_DEPENDS_PATH}/bin) + endif() # make sure that cmake can find the copied patch.exe find_program(PATCH_FOUND NAMES patch patch.exe) diff --git a/cmake/scripts/windowsstore/ArchSetup.cmake b/cmake/scripts/windowsstore/ArchSetup.cmake index 6c6622c..a663bb9 100644 --- a/cmake/scripts/windowsstore/ArchSetup.cmake +++ b/cmake/scripts/windowsstore/ArchSetup.cmake @@ -1,3 +1,12 @@ +# Minimum SDK version we support +set(VS_MINIMUM_SDK_VERSION 10.0.14393.0) + +if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION VERSION_LESS VS_MINIMUM_SDK_VERSION) + message(FATAL_ERROR "Detected Windows SDK version is ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}.\n" + "Windows SDK ${VS_MINIMUM_SDK_VERSION} or higher is required.\n" + "INFO: Windows SDKs can be installed from the Visual Studio installer.") +endif() + # -------- Architecture settings --------- check_symbol_exists(_X86_ "Windows.h" _X86_) @@ -24,6 +33,7 @@ unset(_ARM_) # -------- Paths (mainly for find_package) --------- set(PLATFORM_DIR platform/win32) +set(APP_RENDER_SYSTEM dx11) set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/win10/main.cpp) # Precompiled headers fail with per target output directory. (needs CMake 3.1) @@ -57,7 +67,7 @@ set(ARCH_DEFINES -D_WINDOWS -DTARGET_WINDOWS -DTARGET_WINDOWS_STORE -DXBMC_EXPOR if(NOT SDK_TARGET_ARCH STREQUAL arm) list(APPEND ARCH_DEFINES -D__SSE__ -D__SSE2__) endif() -set(SYSTEM_DEFINES -DNOMINMAX -DHAS_DX -D__STDC_CONSTANT_MACROS +set(SYSTEM_DEFINES -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DHAS_DX -D__STDC_CONSTANT_MACROS -DFMT_HEADER_ONLY -DTAGLIB_STATIC -DNPT_CONFIG_ENABLE_LOGGING -DPLT_HTTP_DEFAULT_USER_AGENT="UPnP/1.0 DLNADOC/1.50 Kodi" -DPLT_HTTP_DEFAULT_SERVER="UPnP/1.0 DLNADOC/1.50 Kodi" @@ -65,7 +75,7 @@ set(SYSTEM_DEFINES -DNOMINMAX -DHAS_DX -D__STDC_CONSTANT_MACROS $<$:-DD3D_DEBUG_INFO>) # Additional SYSTEM_DEFINES -list(APPEND SYSTEM_DEFINES -DHAS_IRSERVERSUITE -DHAS_WIN10_NETWORK) +list(APPEND SYSTEM_DEFINES -DHAS_WIN10_NETWORK) # The /MP option enables /FS by default. set(CMAKE_CXX_FLAGS "/MP ${CMAKE_CXX_FLAGS} /ZW /EHsc /await") diff --git a/cmake/scripts/windowsstore/Macros.cmake b/cmake/scripts/windowsstore/Macros.cmake index 6e7d1d0..7240138 100644 --- a/cmake/scripts/windowsstore/Macros.cmake +++ b/cmake/scripts/windowsstore/Macros.cmake @@ -128,7 +128,8 @@ macro(winstore_append_props target) endforeach(_dll DEBUG_DLLS) add_deployment_content_group($(BuildRootPath)/dlls "" *.dll "${DEBUG_DLLS_EXCLUDE}") - add_deployment_content_group($(BuildRootPath)/system system **/* "$(BuildRootPath)/**/*.glsl") + add_deployment_content_group($(BuildRootPath)/system system **/* "$(BuildRootPath)/**/shaders/**") + add_deployment_content_group($(BuildRootPath)/system/shaders system/shaders **/*.fx "") add_deployment_content_group($(BuildRootPath)/media media **/* "") add_deployment_content_group($(BuildRootPath)/userdata userdata **/* "") add_deployment_content_group($(BuildRootPath)/addons addons **/* "") diff --git a/cmake/scripts/windowsstore/tools/patch.cmake b/cmake/scripts/windowsstore/tools/patch.cmake index 0a342fa..b955b4c 100644 --- a/cmake/scripts/windowsstore/tools/patch.cmake +++ b/cmake/scripts/windowsstore/tools/patch.cmake @@ -2,7 +2,7 @@ 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_NAME "patch-2.7.6-bin") 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}) @@ -28,6 +28,11 @@ else() # copy patch.exe into the output directory file(INSTALL ${PATCH_BINARY_PATH} DESTINATION ${ADDON_DEPENDS_PATH}/bin) + # copy patch depends + file(GLOB PATCH_BINARIES ${PATCH_PATH}/bin/*.dll) + if(NOT "${PATCH_BINARIES}" STREQUAL "") + file(INSTALL ${PATCH_BINARIES} DESTINATION ${ADDON_DEPENDS_PATH}/bin) + endif() # make sure that cmake can find the copied patch.exe find_program(PATCH_FOUND NAMES patch patch.exe) diff --git a/cmake/treedata/android/subdirs.txt b/cmake/treedata/android/subdirs.txt index b56618a..7f7fef5 100644 --- a/cmake/treedata/android/subdirs.txt +++ b/cmake/treedata/android/subdirs.txt @@ -1,16 +1,17 @@ xbmc/cores/RetroPlayer/process/android cores/RetroPlayer/process/android -xbmc/platform/linux platform/linux xbmc/input/touch input/touch xbmc/input/touch/generic input/touch/generic -xbmc/network/linux network/linux -xbmc/network/android network/android -xbmc/peripherals/bus/linux peripherals/bus/linux -xbmc/peripherals/bus/android peripherals/bus/android -xbmc/powermanagement/android powermanagement/android -xbmc/storage/android storage/android -xbmc/filesystem/posix filesystem/posix -xbmc/utils/posix utils_posix xbmc/windowing/android windowing/android -xbmc/platform/posix posix -xbmc/platform/android/activity android_activity -xbmc/platform/android/bionic_supplement android_bionicsupplement +xbmc/platform/posix platform/posix +xbmc/platform/posix/filesystem platform/posix/filesystem +xbmc/platform/posix/utils platform/posix/utils +xbmc/platform/linux platform/linux +xbmc/platform/linux/network platform/linux/network +xbmc/platform/linux/peripherals platform/linux/peripherals +xbmc/platform/android/activity platform/android/activity +xbmc/platform/android/bionic_supplement platform/android/bionicsupplement +xbmc/platform/android/filesystem platform/android/filesystem +xbmc/platform/android/network platform/android/network +xbmc/platform/android/peripherals platform/android/peripherals +xbmc/platform/android/powermanagement platform/android/powermanagement +xbmc/platform/android/storage platform/android/storage diff --git a/cmake/treedata/common/games.txt b/cmake/treedata/common/games.txt index b2faead..7b63f6a 100644 --- a/cmake/treedata/common/games.txt +++ b/cmake/treedata/common/games.txt @@ -1,10 +1,12 @@ xbmc/games games xbmc/games/addons games/addons +xbmc/games/addons/input games/addons/input 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/types games/controllers/types xbmc/games/controllers/windows games/controllers/windows xbmc/games/dialogs games/dialogs xbmc/games/dialogs/osd games/dialogs/osd diff --git a/cmake/treedata/common/retroplayer.txt b/cmake/treedata/common/retroplayer.txt index 97e27b3..0239801 100644 --- a/cmake/treedata/common/retroplayer.txt +++ b/cmake/treedata/common/retroplayer.txt @@ -1,7 +1,8 @@ xbmc/cores/RetroPlayer cores/RetroPlayer +xbmc/cores/RetroPlayer/guibridge cores/RetroPlayer/guibridge xbmc/cores/RetroPlayer/guicontrols cores/RetroPlayer/guicontrols +xbmc/cores/RetroPlayer/guiwindows cores/RetroPlayer/guiwindows xbmc/cores/RetroPlayer/process cores/RetroPlayer/process xbmc/cores/RetroPlayer/rendering cores/RetroPlayer/rendering xbmc/cores/RetroPlayer/rendering/VideoRenderers cores/RetroPlayer/rendering/VideoRenderers xbmc/cores/RetroPlayer/rendering/VideoShaders cores/RetroPlayer/rendering/VideoShaders -xbmc/cores/RetroPlayer/windows cores/RetroPlayer/windows diff --git a/cmake/treedata/common/subdirs.txt b/cmake/treedata/common/subdirs.txt index d5412b5..368f473 100644 --- a/cmake/treedata/common/subdirs.txt +++ b/cmake/treedata/common/subdirs.txt @@ -17,8 +17,8 @@ xbmc/commons commons xbmc/dbwrappers dbwrappers xbmc/dialogs dialogs xbmc/favourites favourites -xbmc/guiinfo guiinfo xbmc/guilib guilib +xbmc/guilib/guiinfo guilib_guiinfo xbmc/input input xbmc/input/joysticks input/joysticks xbmc/input/joysticks/dialogs input/joysticks/dialogs diff --git a/cmake/treedata/freebsd/subdirs.txt b/cmake/treedata/freebsd/subdirs.txt index f7651ee..fe0725c 100644 --- a/cmake/treedata/freebsd/subdirs.txt +++ b/cmake/treedata/freebsd/subdirs.txt @@ -1,12 +1,11 @@ -xbmc/platform/linux platform/linux -xbmc/platform/linux/input platform/linux/input -xbmc/input/touch input/touch -xbmc/input/touch/generic input/touch/generic -xbmc/network/linux network/linux -xbmc/peripherals/bus/linux peripherals/bus/linux -xbmc/powermanagement/linux powermanagement/linux -xbmc/storage/linux storage/linux -xbmc/filesystem/posix filesystem/posix -xbmc/utils/posix utils_posix -xbmc/platform/posix posix -xbmc/freebsd freebsdsupport +xbmc/platform/posix platform/posix +xbmc/platform/posix/filesystem platform/posix/filesystem +xbmc/platform/posix/utils platform/posix/utils +xbmc/platform/linux platform/linux +xbmc/platform/linux/input platform/linux/input +xbmc/platform/linux/network platform/linux/network +xbmc/platform/linux/peripherals platform/linux/peripherals +xbmc/platform/linux/powermanagement platform/linux/powermanagement +xbmc/platform/linux/storage platform/linux/storage +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic diff --git a/cmake/treedata/ios/subdirs.txt b/cmake/treedata/ios/subdirs.txt index 00f5cf1..a287418 100644 --- a/cmake/treedata/ios/subdirs.txt +++ b/cmake/treedata/ios/subdirs.txt @@ -1,17 +1,17 @@ -xbmc/platform/linux platform/linux -xbmc/input/touch input/touch -xbmc/input/touch/generic input/touch/generic -xbmc/network/linux network/linux -xbmc/network/osx network/osx -xbmc/peripherals/bus/osx peripherals/bus/osx -xbmc/powermanagement/osx powermanagement/osx -xbmc/storage/osx storage/osx -xbmc/platform/posix posix -xbmc/platform/darwin platform_darwin -xbmc/platform/darwin/ios platform_ios -xbmc/platform/darwin/ios-common platform_ios-common -xbmc/filesystem/posix filesystem/posix -xbmc/utils/posix utils_posix -xbmc/windowing/osx windowing/osx -xbmc/cores/RetroPlayer/process/ios cores/RetroPlayer/process/ios -xbmc/cores/VideoPlayer/Process/ios cores/VideoPlayer/Process/ios +xbmc/platform/linux platform/linux +xbmc/platform/linux/network platform/linux/network +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic +xbmc/platform/posix posix +xbmc/platform/posix/filesystem platform/posix/filesystem +xbmc/platform/posix/utils platform/posix/utils +xbmc/platform/darwin platform/darwin +xbmc/platform/darwin/ios platform/ios +xbmc/platform/darwin/ios-common platform/ios-common +xbmc/platform/darwin/osx/network platform/osx/network +xbmc/platform/darwin/osx/peripherals platform/osx/peripherals +xbmc/platform/darwin/osx/powermanagement platform/darwin/osx/powermanagement +xbmc/platform/darwin/osx/storage platform/osx/storage +xbmc/windowing/osx windowing/osx +xbmc/cores/RetroPlayer/process/ios cores/RetroPlayer/process/ios +xbmc/cores/VideoPlayer/Process/ios cores/VideoPlayer/Process/ios diff --git a/cmake/treedata/linux/subdirs.txt b/cmake/treedata/linux/subdirs.txt index b310b53..6e1d013 100644 --- a/cmake/treedata/linux/subdirs.txt +++ b/cmake/treedata/linux/subdirs.txt @@ -1,14 +1,14 @@ -xbmc/platform/linux platform/linux -xbmc/platform/linux/input platform/linux/input -xbmc/input/touch input/touch -xbmc/input/touch/generic input/touch/generic -xbmc/network/linux network/linux -xbmc/peripherals/bus/linux peripherals/bus/linux -xbmc/powermanagement/linux powermanagement/linux -xbmc/storage/linux storage/linux -xbmc/filesystem/posix filesystem/posix -xbmc/utils/posix utils_posix -xbmc/platform/posix posix +xbmc/platform/posix platform/posix +xbmc/platform/posix/filesystem platform/posix/filesystem +xbmc/platform/posix/utils platform/posix/utils +xbmc/platform/linux platform/linux +xbmc/platform/linux/input platform/linux/input +xbmc/platform/linux/network platform/linux/network +xbmc/platform/linux/peripherals platform/linux/peripherals +xbmc/platform/linux/powermanagement platform/linux/powermanagement +xbmc/platform/linux/storage platform/linux/storage +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic xbmc/cores/RetroPlayer/process/rbpi cores/RetroPlayer/process/rbpi xbmc/cores/VideoPlayer/Process/rbpi cores/VideoPlayer/Process/rbpi -xbmc/windowing/linux windowing/linux +xbmc/windowing/linux windowing/linux diff --git a/cmake/treedata/osx/subdirs.txt b/cmake/treedata/osx/subdirs.txt index 5b1b302..166a966 100644 --- a/cmake/treedata/osx/subdirs.txt +++ b/cmake/treedata/osx/subdirs.txt @@ -1,14 +1,14 @@ -xbmc/platform/linux platform/linux -xbmc/network/linux network/linux -xbmc/network/osx network/osx -xbmc/peripherals/bus/osx peripherals/bus/osx -xbmc/powermanagement/osx powermanagement/osx -xbmc/storage/osx storage/osx -xbmc/platform/posix posix -xbmc/platform/darwin platform_darwin -xbmc/platform/darwin/osx platform_osx -xbmc/filesystem/posix filesystem/posix -xbmc/utils/posix utils_posix -xbmc/windowing/osx windowing/osx -xbmc/cores/RetroPlayer/process/osx cores/RetroPlayer/process/osx -xbmc/cores/VideoPlayer/Process/osx cores/VideoPlayer/Process/osx +xbmc/platform/posix posix +xbmc/platform/posix/filesystem platform/posix/filesystem +xbmc/platform/posix/utils platform/posix/utils +xbmc/platform/linux platform/linux +xbmc/platform/linux/network platform/linux/network +xbmc/platform/darwin platform/darwin +xbmc/platform/darwin/osx platform/osx +xbmc/platform/darwin/osx/network platform/osx/network +xbmc/platform/darwin/osx/peripherals platform/osx/peripherals +xbmc/platform/darwin/osx/powermanagement platform/darwin/osx/powermanagement +xbmc/platform/darwin/osx/storage platform/osx/storage +xbmc/windowing/osx windowing/osx +xbmc/cores/RetroPlayer/process/osx cores/RetroPlayer/process/osx +xbmc/cores/VideoPlayer/Process/osx cores/VideoPlayer/Process/osx diff --git a/cmake/treedata/windows/subdirs.txt b/cmake/treedata/windows/subdirs.txt index 8344320..a2c8c29 100644 --- a/cmake/treedata/windows/subdirs.txt +++ b/cmake/treedata/windows/subdirs.txt @@ -1,17 +1,17 @@ -xbmc/platform/win32 platform_win32 -xbmc/input/windows input/windows -xbmc/input/touch input/touch -xbmc/input/touch/generic input/touch/generic -xbmc/network/windows network/windows -xbmc/network/mdns network/mdns -xbmc/peripherals/bus/win32 peripherals/bus/win32 -xbmc/powermanagement/windows powermanagement/windows -xbmc/storage/windows storage/windows -xbmc/filesystem/win32 filesystem/win32 -xbmc/utils/win32 utils_win32 -xbmc/rendering/dx rendering_dx -xbmc/threads/platform/win threads_win -xbmc/windowing/windows windowing/windows +xbmc/platform/win32 platform/win32 +xbmc/platform/win32/input platform/win32/input +xbmc/platform/win32/filesystem platform/win32/filesystem +xbmc/platform/win32/network platform/win32/network +xbmc/platform/win32/peripherals platform/win32/peripherals +xbmc/platform/win32/powermanagement platform/win32/powermanagement +xbmc/platform/win32/storage platform/win32/storage +xbmc/platform/win32/utils platform/win32/utils +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic +xbmc/network/mdns network/mdns +xbmc/rendering/dx rendering/dx +xbmc/threads/platform/win threads/win +xbmc/windowing/windows windowing/windows xbmc/cores/RetroPlayer/process/windows cores/RetroPlayer/process/windows xbmc/cores/RetroPlayer/rendering/VideoShaders/windows cores/RetroPlayer/rendering/VideoShaders/windows xbmc/cores/VideoPlayer/Process/windows cores/VideoPlayer/Process/windows diff --git a/cmake/treedata/windowsstore/subdirs.txt b/cmake/treedata/windowsstore/subdirs.txt index 84150d5..604be08 100644 --- a/cmake/treedata/windowsstore/subdirs.txt +++ b/cmake/treedata/windowsstore/subdirs.txt @@ -1,16 +1,15 @@ -xbmc/platform/win10 platform_win10 -xbmc/input/windows input/windows -xbmc/input/touch input/touch -xbmc/input/touch/generic input/touch/generic -xbmc/network/win10 network/win10 -xbmc/network/mdns network/mdns -xbmc/peripherals/bus/win10 peripherals/bus/win10 -xbmc/powermanagement/win10 powermanagement/win10 -xbmc/storage/win10 storage/win10 -xbmc/filesystem/win32 filesystem/win32 -xbmc/filesystem/win10 filesystem/win10 -xbmc/utils/win32 utils_win32 -xbmc/rendering/dx rendering_dx -xbmc/threads/platform/win threads_win -xbmc/windowing/win10 windowing/win10 +xbmc/platform/win10 platform/win10 +xbmc/platform/win10/filesystem platform/win10/filesystem +xbmc/platform/win10/network platform/win10/network +xbmc/platform/win10/peripherals platform/win10/peripherals +xbmc/platform/win10/powermanagement platfrom/win10/powermanagement +xbmc/platform/win10/storage platfrom/win10/storage +xbmc/platform/win32/filesystem platform/win32/filesystem +xbmc/platform/win32/utils platform/win32/utils +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic +xbmc/network/mdns network/mdns +xbmc/rendering/dx rendering/dx +xbmc/threads/platform/win threads/win +xbmc/windowing/win10 windowing/win10 xbmc/cores/VideoPlayer/Process/windows cores/VideoPlayer/Process/windows diff --git a/version.txt b/version.txt index 545f436..a9598ee 100644 --- a/version.txt +++ b/version.txt @@ -3,9 +3,9 @@ COMPANY_NAME XBMC Foundation WEBSITE http://kodi.tv VERSION_MAJOR 18 VERSION_MINOR 0 -VERSION_TAG ALPHA1 -VERSION_CODE 17.99.701 -ADDON_API 17.9.701 +VERSION_TAG ALPHA2 +VERSION_CODE 17.99.702 +ADDON_API 17.9.702 APP_PACKAGE org.xbmc.kodi PACKAGE_IDENTITY XBMCFoundation.Kodi PACKAGE_PUBLISHER C62BD90A-CDD8-477F-96C3-B25992247B97 diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h index 432a1c3..7abd8e1 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h @@ -40,13 +40,9 @@ #undef PRAGMA_PACK_END #if defined(__GNUC__) - #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) - #define ATTRIBUTE_PACKED __attribute__ ((packed)) - #define PRAGMA_PACK 0 - #if __GNUC__ >= 4 - #define ATTRIBUTE_HIDDEN __attribute__ ((visibility ("hidden"))) - #endif - #endif + #define ATTRIBUTE_PACKED __attribute__ ((packed)) + #define PRAGMA_PACK 0 + #define ATTRIBUTE_HIDDEN __attribute__ ((visibility ("hidden"))) #endif #if !defined(ATTRIBUTE_PACKED) @@ -180,6 +176,8 @@ typedef struct AddonToKodiFuncTable_Addon AddonToKodiFuncTable_kodi_filesystem* kodi_filesystem; AddonToKodiFuncTable_kodi_gui* kodi_gui; AddonToKodiFuncTable_kodi_network *kodi_network; + + void* (*get_interface)(void* kodiBase, const char *name, const char *version); } AddonToKodiFuncTable_Addon; /* @@ -605,6 +603,33 @@ inline std::string TranslateAddonStatus(ADDON_STATUS status) } /* namespace kodi */ //---------------------------------------------------------------------------- +//============================================================================== +namespace kodi { +/// +/// \ingroup cpp_kodi +/// @brief Returns a function table to a named interface +/// +/// @return pointer to struct containing interface functions +/// +/// +/// ------------------------------------------------------------------------ +/// +/// **Example:** +/// ~~~~~~~~~~~~~{.cpp} +/// #include +/// #include +/// ... +/// FuncTable_foo *table = kodi::GetPlatformInfo(foo_name, foo_version); +/// ... +/// ~~~~~~~~~~~~~ +/// +inline void* GetInterface(const std::string &name, const std::string &version) +{ + AddonToKodiFuncTable_Addon* toKodi = ::kodi::addon::CAddonBase::m_interface->toKodi; + + return toKodi->get_interface(toKodi->kodiBase, name.c_str(), version.c_str()); +} +} /* namespace kodi */ /*! addon creation macro * @todo cleanup this stupid big macro diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h deleted file mode 100644 index 02faf86..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h +++ /dev/null @@ -1,597 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2017 Team KODI - * http://kodi.tv - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kodi; see the file COPYING. If not, see - * . - * - */ - -#include "AddonBase.h" - -#ifdef BUILD_KODI_ADDON -#include "AEChannelData.h" -#else -#include "cores/AudioEngine/Utils/AEChannelData.h" -#endif - -//============================================================================== -/// -/// \defgroup cpp_kodi_audioengine Interface - kodi::audioengine -/// \ingroup cpp -/// @brief **Audio engine functions** -/// -/// -/// It has the header \ref AudioEngine.h "#include " be included -/// to enjoy it. -/// -//------------------------------------------------------------------------------ - -//============================================================================== -/// -/// \defgroup cpp_kodi_audioengine_Defs Definitions, structures and enumerators -/// \ingroup cpp_kodi_audioengine -/// @brief **Library definition values** -/// -//------------------------------------------------------------------------------ - -extern "C" -{ - - //============================================================================ - /// \ingroup cpp_kodi_audioengine_Defs - /// @brief Bit options to pass to CAddonAEStream - /// - typedef enum AudioEngineStreamOptions - { - /// force resample even if rates match - AUDIO_STREAM_FORCE_RESAMPLE = 1 << 0, - /// create the stream paused - AUDIO_STREAM_PAUSED = 1 << 1, - /// autostart the stream when enough data is buffered - AUDIO_STREAM_AUTOSTART = 1 << 2, - /// if this option is set the ADSP-System is bypassed and the raw stream - /// will be passed through IAESink - AUDIO_STREAM_BYPASS_ADSP = 1 << 3 - } AudioEngineStreamOptions; - //---------------------------------------------------------------------------- - - //============================================================================ - /// \defgroup cpp_kodi_audioengine_Defs_AudioEngineFormat struct AudioEngineFormat - /// \ingroup cpp_kodi_audioengine_Defs - /// @brief The audio format structure that fully defines a stream's audio - /// information - /// - //@{ - struct AudioEngineFormat - { - /// The stream's data format (eg, AE_FMT_S16LE) - enum AEDataFormat m_dataFormat; - - /// The stream's sample rate (eg, 48000) - unsigned int m_sampleRate; - - /// The encoded streams sample rate if a bitstream, otherwise undefined - unsigned int m_encodedRate; - - /// The amount of used speaker channels - unsigned int m_channelCount; - - /// The stream's channel layout - enum AEChannel m_channels[AE_CH_MAX]; - - /// The number of frames per period - unsigned int m_frames; - - /// The size of one frame in bytes - unsigned int m_frameSize; - - AudioEngineFormat() - { - m_dataFormat = AE_FMT_INVALID; - m_sampleRate = 0; - m_encodedRate = 0; - m_frames = 0; - m_frameSize = 0; - m_channelCount = 0; - - for (unsigned int ch = 0; ch < AE_CH_MAX; ++ch) - { - m_channels[ch] = AE_CH_MAX; - } - } - - /// Function to compare the format structure with another - bool compareFormat(const AudioEngineFormat *fmt) - { - if (!fmt) - { - return false; - } - - if (m_dataFormat != fmt->m_dataFormat || - m_sampleRate != fmt->m_sampleRate || - m_encodedRate != fmt->m_encodedRate || - m_frames != fmt->m_frames || - m_frameSize != fmt->m_frameSize || - m_channelCount != fmt->m_channelCount) - { - return false; - } - - for (unsigned int ch = 0; ch < AE_CH_MAX; ++ch) - { - if (fmt->m_channels[ch] != m_channels[ch]) - { - return false; - } - } - - return true; - } - }; - //@} - //---------------------------------------------------------------------------- - - /* A stream handle pointer, which is only used internally by the addon stream handle */ - typedef void AEStreamHandle; - - /* - * Function address structure, not need to visible on dev kit doxygen - * documentation - */ - typedef struct AddonToKodiFuncTable_kodi_audioengine - { - AEStreamHandle* (*make_stream)(void *kodiBase, AudioEngineFormat* format, unsigned int options); - void (*free_stream)(void *kodiBase, AEStreamHandle *stream); - bool (*get_current_sink_format)(void *kodiBase, AudioEngineFormat* sink_format); - - // Audio Engine Stream definitions - unsigned int (*aestream_get_space)(void *kodiBase, AEStreamHandle *handle); - unsigned int (*aestream_add_data)(void *kodiBase, AEStreamHandle *handle, uint8_t* const *data, - unsigned int offset, unsigned int frames, double pts); - double (*aestream_get_delay)(void *kodiBase, AEStreamHandle *handle); - bool (*aestream_is_buffering)(void *kodiBase, AEStreamHandle *handle); - double (*aestream_get_cache_time)(void *kodiBase, AEStreamHandle *handle); - double (*aestream_get_cache_total)(void *kodiBase, AEStreamHandle *handle); - void (*aestream_pause)(void *kodiBase, AEStreamHandle *handle); - void (*aestream_resume)(void *kodiBase, AEStreamHandle *handle); - void (*aestream_drain)(void *kodiBase, AEStreamHandle *handle, bool wait); - bool (*aestream_is_draining)(void *kodiBase, AEStreamHandle *handle); - bool (*aestream_is_drained)(void *kodiBase, AEStreamHandle *handle); - void (*aestream_flush)(void *kodiBase, AEStreamHandle *handle); - float (*aestream_get_volume)(void *kodiBase, AEStreamHandle *handle); - void (*aestream_set_volume)(void *kodiBase, AEStreamHandle *handle, float volume); - float (*aestream_get_amplification)(void *kodiBase, AEStreamHandle *handle); - void (*aestream_set_amplification)(void *kodiBase, AEStreamHandle *handle, float amplify); - unsigned int (*aestream_get_frame_size)(void *kodiBase, AEStreamHandle *handle); - unsigned int (*aestream_get_channel_count)(void *kodiBase, AEStreamHandle *handle); - unsigned int (*aestream_get_sample_rate)(void *kodiBase, AEStreamHandle *handle); - AEDataFormat (*aestream_get_data_format)(void *kodiBase, AEStreamHandle *handle); - double (*aestream_get_resample_ratio)(void *kodiBase, AEStreamHandle *handle); - void (*aestream_set_resample_ratio)(void *kodiBase, AEStreamHandle *handle, double ratio); - } AddonToKodiFuncTable_kodi_audioengine; - -} /* extern "C" */ - -namespace kodi -{ -namespace audioengine -{ - - //============================================================================ - /// - /// \defgroup cpp_kodi_audioengine_CAddonAEStream class CAddonAEStream - /// \ingroup cpp_kodi_audioengine - /// @brief **Audio Engine Stream Class** - /// - /// - /// It has the header \ref AudioEngine.h "#include " be - /// included to enjoy it. - /// - //---------------------------------------------------------------------------- - class CAddonAEStream - { - public: - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Contructs new class to an Kodi IAEStream in the format specified. - /// - /// @param[in] format The data format the incoming audio will be in - /// (e.g. \ref AE_FMT_S16LE) - /// @param[in] options [opt] A bit field of stream options (see: enum \ref AudioEngineStreamOptions) - /// - /// - /// ------------------------------------------------------------------------ - /// - /// **Audio engine format information:** - /// @code - /// /* - /// * Audio engine format information - /// * - /// * Only as example shown here! See always the original structure on related header. - /// */ - /// typedef struct AudioEngineFormat - /// { - /// enum AEDataFormat m_dataFormat; /* The stream's data format (eg, AE_FMT_S16LE) */ - /// unsigned int m_sampleRate; /* The stream's sample rate (eg, 48000) */ - /// unsigned int m_encodedRate; /* The encoded streams sample rate if a bitstream, otherwise undefined */ - /// unsigned int m_channelCount; /* The amount of used speaker channels */ - /// enum AEChannel m_channels[AE_CH_MAX]; /* The stream's channel layout */ - /// unsigned int m_frames; /* The number of frames per period */ - /// unsigned int m_frameSamples; /* The number of samples in one frame */ - /// unsigned int m_frameSize; /* The size of one frame in bytes */ - /// - /// /* Function to compare the format structure with another */ - /// bool compareFormat(const AudioEngineFormat *fmt); - /// } AudioEngineFormat; - /// @endcode - /// - /// ------------------------------------------------------------------------ - /// - /// **Bit options to pass to CAELib_Stream (on Kodi by IAE::MakeStream)** - /// - /// | enum AEStreamOptions | Value: | Description: - /// |----------------------------:|:------:|:----------------------------------- - /// | AUDIO_STREAM_FORCE_RESAMPLE | 1 << 0 | Force resample even if rates match - /// | AUDIO_STREAM_PAUSED | 1 << 1 | Create the stream paused - /// | AUDIO_STREAM_AUTOSTART | 1 << 2 | Autostart the stream when enough data is buffered - /// | AUDIO_STREAM_BYPASS_ADSP | 1 << 3 | if this option is set the ADSP-System is bypassed and the raw stream will be passed through IAESink. - /// - /// - /// ------------------------------------------------------------------------ - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// - /// #include - /// - /// using namespace kodi::audioengine; - /// - /// ... - /// - /// AudioEngineFormat format; - /// format.m_dataFormat = AE_FMT_FLOAT; - /// format.m_channelCount = 2; - /// format.m_channels[0] = AE_CH_FL; - /// format.m_channels[1] = AE_CH_FR; - /// format.m_channels[2] = AE_CH_NULL; - /// format.m_sampleRate = 48000; - /// format.m_frameSize = sizeof(float)*format.m_channelCount; - /// format.m_frames = 512; - /// CAddonAEStream* stream = new CAddonAEStream(format, AE_STREAM_AUTOSTART | AE_STREAM_BYPASS_ADSP); - /// - /// ~~~~~~~~~~~~~ - /// - CAddonAEStream(AudioEngineFormat format, unsigned int options = 0) - : m_kodiBase(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase), - m_cb(::kodi::addon::CAddonBase::m_interface->toKodi->kodi_audioengine) - { - m_StreamHandle = m_cb->make_stream(m_kodiBase, &format, options); - if (m_StreamHandle == nullptr) - { - kodi::Log(ADDON_LOG_FATAL, "CAddonAEStream: make_stream failed!"); - } - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Class destructor - /// - ~CAddonAEStream() - { - if (m_StreamHandle) - { - m_cb->free_stream(m_kodiBase, m_StreamHandle); - m_StreamHandle = nullptr; - } - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Returns the amount of space available in the stream - /// - /// @return The number of bytes AddData will consume - /// - unsigned int GetSpace() - { - return m_cb->aestream_get_space(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Add planar or interleaved PCM data to the stream - /// - /// @param[in] data array of pointers to the planes - /// @param[in] offset to frame in frames - /// @param[in] frames number of frames - /// @param[in] pts presentation timestamp - /// @return The number of frames consumed - /// - unsigned int AddData(uint8_t* const *data, unsigned int offset, unsigned int frames, double pts = 0.0) - { - return m_cb->aestream_add_data(m_kodiBase, m_StreamHandle, data, offset, frames, pts); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Returns the time in seconds that it will take for the next added - /// packet to be heard from the speakers. - /// - /// @return seconds - /// - double GetDelay() - { - return m_cb->aestream_get_delay(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Returns if the stream is buffering - /// - /// @return True if the stream is buffering - /// - bool IsBuffering() - { - return m_cb->aestream_is_buffering(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Returns the time in seconds of the stream's cached audio samples. - /// Engine buffers excluded. - /// - /// @return seconds - /// - double GetCacheTime() - { - return m_cb->aestream_get_cache_time(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Returns the total time in seconds of the cache - /// - /// @return seconds - /// - double GetCacheTotal() - { - return m_cb->aestream_get_cache_total(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Pauses the stream playback - /// - void Pause() - { - return m_cb->aestream_pause(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Resumes the stream after pausing - /// - void Resume() - { - return m_cb->aestream_resume(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Start draining the stream - /// - /// @param[in] wait [opt] Wait until drain is finished if set to - /// true, otherwise it returns direct - /// - /// @note Once called AddData will not consume more data. - /// - void Drain(bool wait = true) - { - return m_cb->aestream_drain(m_kodiBase, m_StreamHandle, wait); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Returns true if the is stream draining - /// - bool IsDraining() - { - return m_cb->aestream_is_draining(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Returns true if the is stream has finished draining - /// - bool IsDrained() - { - return m_cb->aestream_is_drained(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Flush all buffers dropping the audio data - /// - void Flush() - { - return m_cb->aestream_flush(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Return the stream's current volume level - /// - /// @return The volume level between 0.0 and 1.0 - /// - float GetVolume() - { - return m_cb->aestream_get_volume(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Set the stream's volume level - /// - /// @param[in] volume The new volume level between 0.0 and 1.0 - /// - void SetVolume(float volume) - { - return m_cb->aestream_set_volume(m_kodiBase, m_StreamHandle, volume); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Gets the stream's volume amplification in linear units. - /// - /// @return The volume amplification factor between 1.0 and 1000.0 - /// - float GetAmplification() - { - return m_cb->aestream_get_amplification(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Sets the stream's volume amplification in linear units. - /// - /// @param[in] amplify The volume amplification factor between - /// 1.0 and 1000.0 - /// - void SetAmplification(float amplify) - { - return m_cb->aestream_set_amplification(m_kodiBase, m_StreamHandle, amplify); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Returns the size of one audio frame in bytes (channelCount * resolution) - /// - /// @return The size in bytes of one frame - /// - unsigned int GetFrameSize() const - { - return m_cb->aestream_get_frame_size(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Returns the number of channels the stream is configured to accept - /// - /// @return The channel count - /// - unsigned int GetChannelCount() const - { - return m_cb->aestream_get_channel_count(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Returns the stream's sample rate, if the stream is using a dynamic - /// sample rate, this value will NOT reflect any changes made by calls to - /// SetResampleRatio() - /// - /// @return The stream's sample rate (eg, 48000) - /// - unsigned int GetSampleRate() const - { - return m_cb->aestream_get_sample_rate(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Return the data format the stream has been configured with - /// - /// @return The stream's data format (eg, AUDIOENGINE_FMT_S16LE) - /// - AEDataFormat GetDataFormat() const - { - return m_cb->aestream_get_data_format(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Return the resample ratio - /// - /// @note This will return an undefined value if the stream is not resampling - /// - /// @return the current resample ratio or undefined if the stream is not resampling - /// - double GetResampleRatio() - { - return m_cb->aestream_get_resample_ratio(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAddonAEStream - /// @brief Sets the resample ratio - /// - /// @note This function may return false if the stream is not resampling, if - /// you wish to use this be sure to set the AESTREAM_FORCE_RESAMPLE option - /// - /// @param[in] ratio the new sample rate ratio, calculated by - /// ((double)desiredRate / (double)GetSampleRate()) - /// - void SetResampleRatio(double ratio) - { - m_cb->aestream_set_resample_ratio(m_kodiBase, m_StreamHandle, ratio); - } - //-------------------------------------------------------------------------- - - private: - void* m_kodiBase; - AddonToKodiFuncTable_kodi_audioengine* m_cb; - AEStreamHandle *m_StreamHandle; - }; - - //============================================================================ - /// @ingroup cpp_kodi_audioengine - /// @brief Get the current sink data format - /// - /// @param[in] format Current sink data format. For more details see AudioEngineFormat. - /// @return Returns true on success, else false. - /// - inline bool GetCurrentSinkFormat(AudioEngineFormat &format) - { - using namespace kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_audioengine->get_current_sink_format(CAddonBase::m_interface->toKodi->kodiBase, &format); - } - //---------------------------------------------------------------------------- - -} /* audioengine */ -} /* kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt index 80e9275..2b98154 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt @@ -1,5 +1,4 @@ set(HEADERS AddonBase.h - AudioEngine.h Filesystem.h General.h Network.h @@ -19,6 +18,10 @@ set(HEADERS AddonBase.h xbmc_pvr_dll.h xbmc_pvr_types.h) +if(CORE_SYSTEM_NAME STREQUAL android) + list(APPEND SOURCES platform/android/System.h) +endif() + if(NOT ENABLE_STATIC_LIBS) core_add_library(addons_kodi-addon-dev-kit_include_kodi) endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h deleted file mode 100644 index 3587a33..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h +++ /dev/null @@ -1,1288 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2015 Team Kodi - * http://kodi.tv - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kodi; see the file COPYING. If not, see - * . - * - */ - -#include "../AddonBase.h" - -#define AE_DSP_STREAM_MAX_STREAMS 8 -#define AE_DSP_STREAM_MAX_MODES 32 - -/*! - * @file Addon.h - * @section sec1 Basic audio dsp addon interface description - * @author Team Kodi - * @date 10. May 2014 - * @version 0.1.5 - * - * @subsection sec1_1 General - * @li The basic support on the addon is supplied with the - * AE_DSP_ADDON_CAPABILITIES data which becomes asked over - * GetCapabilities(...), further the addon must register his available - * modes on startup with the RegisterMode(...) callback function. - * If one of this two points is not set the addon becomes - * ignored for the chain step. - * - * @subsection sec1_2 Processing - * @li On start of new stream the addon becomes called with StreamCreate(...) - * to check about given values that it support it basically and can create - * his structure, if nothing is supported it can return AE_DSP_ERROR_IGNORE_ME. - * - * @li As next step StreamIsModeSupported(...) becomes called for every - * available and enabled modes, is separated due to more as one available mode - * on the addon is possible, if the mode is not supported it can also be return - * AE_DSP_ERROR_IGNORE_ME. - * - If mode is a resample mode and returns no error it becomes asked with - * InputResampleSampleRate(...) or OutputResampleSampleRate(...) (relevant - * to his type) about his given sample rate. - * - About the from user selected master processing mode the related addon - * becomes called now with MasterProcessSetMode(...) to handle it's - * selectionon the addon given by the own addon type identifier or by - * KODI's useddatabase id, also the currently used stream type (e.g. - * Music or Video) is send. - * - If the addon supports only one master mode it can ignore this function - * and return always AE_DSP_ERROR_NO_ERROR. - * - If the master mode is set the addon becomes asked about the from him - * given output channel layout related to up- or downmix modes, if - * nothing becomes changed on the layout it can return -1. - * - The MasterProcessSetMode(...) is also called if from user a another - * mode becomes selected. - * - * @li Then as last step shortly before the first process call becomes executed - * the addon is called one time with StreamInitialize(...) to inform that - * processing is started on the given settings. - * - This function becomes also called on all add-ons if the master process - * becomes changed. - * - Also every process after StreamInitialize on the addon mode becomes asked - * with _..._ProcessNeededSamplesize(...) about required memory size for the - * output of his data, if no other size is required it can return 0. - * - * @li From now the processing becomes handled for the different steps with - * _..._Process(...). - * - Further it becomes asked with _..._GetDelay(...) about his processing - * time as float value in seconds, needed for video and audio alignment. - * - * @li On the end of the processing if the source becomes stopped the - * StreamDestroy(...) function becomes called on all active processing add-ons. - * - * @note - * The StreamCreate(...) can be becomes called for a new stream before the - * previous was closed with StreamDestroy(...) ! To have a speed improve. - */ - -namespace kodi { namespace addon { class CInstanceAudioDSP; }} - -extern "C" { - - typedef void* ADSPHANDLE; - - typedef unsigned int AE_DSP_STREAM_ID; - - /*! - * @brief Audio DSP add-on error codes - */ - typedef enum - { - AE_DSP_ERROR_NO_ERROR = 0, /*!< @brief no error occurred */ - AE_DSP_ERROR_UNKNOWN = -1, /*!< @brief an unknown error occurred */ - AE_DSP_ERROR_IGNORE_ME = -2, /*!< @brief the used input stream can not processed and add-on want to ignore */ - AE_DSP_ERROR_NOT_IMPLEMENTED = -3, /*!< @brief the method that KODI called is not implemented by the add-on */ - AE_DSP_ERROR_REJECTED = -4, /*!< @brief the command was rejected by the DSP */ - AE_DSP_ERROR_INVALID_PARAMETERS = -5, /*!< @brief the parameters of the method that was called are invalid for this operation */ - AE_DSP_ERROR_INVALID_SAMPLERATE = -6, /*!< @brief the processed samplerate is not supported */ - AE_DSP_ERROR_INVALID_IN_CHANNELS = -7, /*!< @brief the processed input channel format is not supported */ - AE_DSP_ERROR_INVALID_OUT_CHANNELS = -8, /*!< @brief the processed output channel format is not supported */ - AE_DSP_ERROR_FAILED = -9, /*!< @brief the command failed */ - } AE_DSP_ERROR; - - /*! - * @brief The possible DSP channels (used as pointer inside arrays) - */ - typedef enum - { - AE_DSP_CH_INVALID = -1, - AE_DSP_CH_FL = 0, - AE_DSP_CH_FR, - AE_DSP_CH_FC, - AE_DSP_CH_LFE, - AE_DSP_CH_BL, - AE_DSP_CH_BR, - AE_DSP_CH_FLOC, - AE_DSP_CH_FROC, - AE_DSP_CH_BC, - AE_DSP_CH_SL, - AE_DSP_CH_SR, - AE_DSP_CH_TFL, - AE_DSP_CH_TFR, - AE_DSP_CH_TFC, - AE_DSP_CH_TC, - AE_DSP_CH_TBL, - AE_DSP_CH_TBR, - AE_DSP_CH_TBC, - AE_DSP_CH_BLOC, - AE_DSP_CH_BROC, - - AE_DSP_CH_MAX - } AE_DSP_CHANNEL; - - /*! - * @brief Present channel flags - */ - typedef enum - { - AE_DSP_PRSNT_CH_UNDEFINED = 0, - AE_DSP_PRSNT_CH_FL = 1<globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstanceAudioDSP: Creation of more as one in single instance way is not allowed!"); - - SetAddonStruct(CAddonBase::m_interface->firstKodiInstance); - CAddonBase::m_interface->globalSingleInstance = this; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @brief Class constructor - /// - /// @param[in] instance The from Kodi given instance given be - /// add-on CreateInstance call with instance - /// id ADDON_INSTANCE_ADSP. - /// - explicit CInstanceAudioDSP(KODI_HANDLE instance) - : IAddonInstance(ADDON_INSTANCE_ADSP) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstanceAudioDSP: Creation of multiple together with single instance way is not allowed!"); - - SetAddonStruct(instance); - } - //-------------------------------------------------------------------------- - - /*! @name Audio DSP add-on methods */ - //@{ - //========================================================================== - /// - /// @brief Get the list of features that this add-on provides. - /// Called by KODI to query the add-ons capabilities. - /// Used to check which options should be presented in the DSP, which methods - /// to call, etc. - /// All capabilities that the add-on supports should be set to true. - /// @param capabilities The add-ons capabilities. - /// @remarks Valid implementation required. - /// - virtual void GetCapabilities(AE_DSP_ADDON_CAPABILITIES& capabilities) = 0; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @return The name reported by the back end that will be displayed in the - /// UI. - /// @remarks Valid implementation required. - /// - virtual std::string GetDSPName() = 0; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @return The version string reported by the back end that will be displayed - /// in the UI. - /// @remarks Valid implementation required. - /// - virtual std::string GetDSPVersion() = 0; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Call one of the menu hooks (if supported). - /// Supported AE_DSP_MENUHOOK instances have to be added in ADDON_Create(), - /// by calling AddMenuHook() on the callback. - /// @param menuhook The hook to call. - /// @param item The selected item for which the hook was called. - /// @return AE_DSP_ERROR_NO_ERROR if the hook was called successfully. - /// @remarks Optional. Return AE_DSP_ERROR_NOT_IMPLEMENTED if this add-on - /// won't provide this function. - /// - virtual AE_DSP_ERROR MenuHook(const AE_DSP_MENUHOOK& menuhook, const AE_DSP_MENUHOOK_DATA& item) { return AE_DSP_ERROR_NOT_IMPLEMENTED; } - //-------------------------------------------------------------------------- - //@} - - //========================================================================== - /// @name DSP processing control, used to open and close a stream - /// @remarks Valid implementation required. - /// - //@{ - /// - /// @brief Set up Audio DSP with selected audio settings (use the basic - /// present audio stream data format). - /// Used to detect available add-ons for present stream, as example stereo - /// surround upmix not needed on 5.1 audio stream. - /// @param addonSettings The add-ons audio settings. - /// @param properties The properties of the currently playing stream. - /// @param handle On this becomes addon informated about stream id and can set function addresses which need on calls - /// @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully - /// and data can be performed. AE_DSP_ERROR_IGNORE_ME if format is not - /// supported, but without fault. - /// @remarks Valid implementation required. - /// - virtual AE_DSP_ERROR StreamCreate(const AE_DSP_SETTINGS& addonSettings, const AE_DSP_STREAM_PROPERTIES& properties, ADDON_HANDLE handle) = 0; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// Remove the selected id from currently used DSP processes - /// @param handle identification data for stream - /// @return AE_DSP_ERROR_NO_ERROR if the becomes found and removed - /// @remarks Valid implementation required. - /// - virtual AE_DSP_ERROR StreamDestroy(const ADDON_HANDLE handle) = 0; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Ask the add-on about a requested processing mode that it is - /// supported on the current stream. Is called about every add-on mode after - /// successed StreamCreate. - /// @param handle identification data for stream - /// @param type The processing mode type, see AE_DSP_MODE_TYPE for definitions - /// @param mode_id The mode inside add-on which must be performed on call. Id - /// is set from add-on by iModeNumber on AE_DSP_MODE structure during - /// RegisterMode callback, - /// @param unique_db_mode_id The Mode unique id generated from dsp database. - /// @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully - /// or if the stream is not supported the add-on must return - /// AE_DSP_ERROR_IGNORE_ME. - /// @remarks Valid implementation required. - /// - virtual AE_DSP_ERROR StreamIsModeSupported(const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int mode_id, int unique_db_mode_id) = 0; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Set up Audio DSP with selected audio settings (detected on data of - /// first present audio packet) - /// @param addonSettings The add-ons audio settings. - /// @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully. - /// @remarks Valid implementation required. - /// - virtual AE_DSP_ERROR StreamInitialize(const ADDON_HANDLE handle, const AE_DSP_SETTINGS& addonSettings) = 0; - //-------------------------------------------------------------------------- - - //@} - - /// @name DSP input processing - /// @remarks Only used by KODI if bSupportsInputProcess is set to true. - /// - //@{ - //========================================================================== - /// - /// @brief DSP input processing - /// Can be used to have unchanged stream.. - /// All DSP add-ons allowed to-do this. - /// @param handle identification data for stream - /// @param array_in Pointer to data memory - /// @param samples Amount of samples inside array_in - /// @return true if work was OK - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual bool InputProcess(const ADDON_HANDLE handle, const float** array_in, unsigned int samples) { return true; } - //-------------------------------------------------------------------------- - //@} - - /// @name DSP pre-resampling - /// @remarks Only used by KODI if bSupportsInputResample is set to true. - /// - //@{ - //========================================================================== - /// - /// @brief If the add-on operate with buffered arrays and the output size can - /// be higher as the input it becomes asked about needed size before any - /// InputResampleProcess call. - /// @param handle identification data for stream - /// @return The needed size of output array or 0 if no changes within it - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual unsigned int InputResampleProcessNeededSamplesize(const ADDON_HANDLE handle) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief DSP re sample processing before master. - /// Here a high quality resample can be performed. - /// Only one DSP add-on is allowed to-do this! - /// @param handle identification data for stream - /// @param array_in Pointer to input data memory - /// @param array_out Pointer to output data memory - /// @param samples Amount of samples inside array_in - /// @return Amount of samples processed - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual unsigned int InputResampleProcess(const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Returns the re-sampling generated new sample rate used before the - /// master process - /// @param handle identification data for stream - /// @return The new sample rate - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual int InputResampleSampleRate(const ADDON_HANDLE handle) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Returns the time in seconds that it will take - /// for the next added packet to be returned to KODI. - /// @param handle identification data for stream - /// @return the delay in seconds - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual float InputResampleGetDelay(const ADDON_HANDLE handle) { return 0.0f; } - //-------------------------------------------------------------------------- - //@} - - /** @name DSP Pre processing - * @remarks Only used by KODI if bSupportsPreProcess is set to true. - */ - //@{ - //========================================================================== - /// - /// @brief If the addon operate with buffered arrays and the output size can - /// be higher as the input it becomes asked about needed size before any - /// PreProcess call. - /// @param handle identification data for stream - /// @param mode_id The mode inside add-on which must be performed on call. Id - /// is set from add-on by iModeNumber on AE_DSP_MODE structure during - /// RegisterMode callback and can be defined from add-on as a structure - /// pointer or anything else what is needed to find it. - /// @return The needed size of output array or 0 if no changes within it - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual unsigned int PreProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Returns the time in seconds that it will take - /// for the next added packet to be returned to KODI. - /// @param handle identification data for stream - /// @param mode_id The mode inside add-on which must be performed on call. Id - /// is set from add-on by iModeNumber on AE_DSP_MODE structure during - /// RegisterMode callback and can be defined from add-on as a structure - /// pointer or anything else what is needed to find it. - /// @return the delay in seconds - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual float PreProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id) { return 0.0f; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief DSP preprocessing - /// All DSP add-ons allowed to-do this. - /// @param handle identification data for stream - /// @param mode_id The mode inside add-on which must be performed on call. Id - /// is set from add-on by iModeNumber on AE_DSP_MODE structure during - /// RegisterMode callback and can be defined from add-on as a structure - /// pointer or anything else what is needed to find it. - /// @param array_in Pointer to input data memory - /// @param array_out Pointer to output data memory - /// @param samples Amount of samples inside array_in - /// @return Amount of samples processed - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual unsigned int PreProcess(const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples) { return 0; } - //-------------------------------------------------------------------------- - //@} - - /** @name DSP Master processing - * @remarks Only used by KODI if bSupportsMasterProcess is set to true. - */ - //@{ - //========================================================================== - /// - /// @brief Set the active master process mode - /// @param handle identification data for stream - /// @param type Requested stream type for the selected master mode - /// @param mode_id The Mode identifier. - /// @param unique_db_mode_id The Mode unique id generated from DSP database. - /// @return AE_DSP_ERROR_NO_ERROR if the setup was successful - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual AE_DSP_ERROR MasterProcessSetMode(const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id) { return AE_DSP_ERROR_NOT_IMPLEMENTED; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief If the add-on operate with buffered arrays and the output size can - /// be higher as the input it becomes asked about needed size before any - /// MasterProcess call. - /// @param handle identification data for stream - /// @return The needed size of output array or 0 if no changes within it - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual unsigned int MasterProcessNeededSamplesize(const ADDON_HANDLE handle) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Returns the time in seconds that it will take - /// for the next added packet to be returned to KODI. - /// @param handle identification data for stream - /// @return the delay in seconds - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual float MasterProcessGetDelay(const ADDON_HANDLE handle) { return 0.0f; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Returns the from selected master mode performed channel alignment - /// @param handle identification data for stream - /// @retval out_channel_present_flags the exact channel present flags after - /// performed up-/downmix - /// @return the amount channels - /// @remarks Optional. Must be used and set if a channel up- or downmix is - /// processed from the active master mode - /// - virtual int MasterProcessGetOutChannels(const ADDON_HANDLE handle, unsigned long& out_channel_present_flags) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Master processing becomes performed with it - /// Here a channel up-mix/down-mix for stereo surround sound can be performed - /// Only one DSP add-on is allowed to-do this! - /// @param handle identification data for stream - /// @param array_in Pointer to input data memory - /// @param array_out Pointer to output data memory - /// @param samples Amount of samples inside array_in - /// @return Amount of samples processed - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual unsigned int MasterProcess(const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// Used to get a information string about the processed work to show on skin - /// @return A string to show - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual std::string MasterProcessGetStreamInfoString(const ADDON_HANDLE handle) { return ""; } - //-------------------------------------------------------------------------- - //@} - - /** @name DSP Post processing - * @remarks Only used by KODI if bSupportsPostProcess is set to true. - */ - //@{ - //========================================================================== - /// - /// If the add-on operate with buffered arrays and the output size can be - /// higher as the input it becomes asked about needed size before any - /// PostProcess call. - /// @param handle identification data for stream - /// @param mode_id The mode inside add-on which must be performed on call. Id - /// is set from add-on by iModeNumber on AE_DSP_MODE structure during - /// RegisterMode callback, and can be defined from add-on as a structure - /// pointer or anything else what is needed to find it. - /// @return The needed size of output array or 0 if no changes within it - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual unsigned int PostProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// Returns the time in seconds that it will take - /// for the next added packet to be returned to KODI. - /// @param handle identification data for stream - /// @param mode_id The mode inside add-on which must be performed on call. Id - /// is set from add-on by iModeNumber on AE_DSP_MODE structure during - /// RegisterMode callback, and can be defined from add-on as a structure - /// pointer or anything else what is needed to find it. - /// @return the delay in seconds - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual float PostProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id) { return 0.0f; } - //-------------------------------------------------------------------------- - - //========================================================================== - - /// - /// @brief DSP post processing - /// On the post processing can be things performed with additional channel - /// upmix like 6.1 to 7.1 - /// or frequency/volume corrections, speaker distance handling, equalizer... . - /// All DSP add-ons allowed to-do this. - /// @param handle identification data for stream - /// @param mode_id The mode inside add-on which must be performed on call. Id - /// is set from add-on by iModeNumber on AE_DSP_MODE structure during - /// RegisterMode callback, and can be defined from add-on as a structure - /// pointer or anything else what is needed to find it. - /// @param array_in Pointer to input data memory - /// @param array_out Pointer to output data memory - /// @param samples Amount of samples inside array_in - /// @return Amount of samples processed - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual unsigned int PostProcess(const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples) { return 0; } - - //-------------------------------------------------------------------------- - //@} - - /** @name DSP Post re-sampling - * @remarks Only used by KODI if bSupportsOutputResample is set to true. - */ - //@{ - //========================================================================== - /// - /// @brief If the add-on operate with buffered arrays and the output size - /// can be higher as the input - /// it becomes asked about needed size before any OutputResampleProcess call. - /// @param handle identification data for stream - /// @return The needed size of output array or 0 if no changes within it - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual unsigned int OutputResampleProcessNeededSamplesize(const ADDON_HANDLE handle) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Re-sampling after master processing becomes performed with it if - /// needed, only - /// one add-on can perform it. - /// @param handle identification data for stream - /// @param array_in Pointer to input data memory - /// @param array_out Pointer to output data memory - /// @param samples Amount of samples inside array_in - /// @return Amount of samples processed - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual unsigned int OutputResampleProcess(const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Returns the re-sampling generated new sample rate used after the - /// master process. - /// @param handle identification data for stream - /// @return The new sample rate - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual int OutputResampleSampleRate(const ADDON_HANDLE handle) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Returns the time in seconds that it will take for the next added - /// packet to be returned to KODI. - /// @param handle identification data for stream - /// @return the delay in seconds - /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with - /// GetCapabilities - /// - virtual float OutputResampleGetDelay(const ADDON_HANDLE handle) { return 0.0f; } - //-------------------------------------------------------------------------- - //@} - - //========================================================================== - /// - /// @brief Add or replace a menu hook for the context menu for this add-on - /// @param hook The hook to add - /// - void AddMenuHook(AE_DSP_MENUHOOK* hook) - { - return m_instanceData->toKodi.add_menu_hook(m_instanceData->toKodi.kodiInstance, hook); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Remove a menu hook for the context menu for this add-on - /// @param hook The hook to remove - /// - void RemoveMenuHook(AE_DSP_MENUHOOK* hook) - { - return m_instanceData->toKodi.remove_menu_hook(m_instanceData->toKodi.kodiInstance, hook); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Add or replace master mode information inside audio dsp database. - /// Becomes identifier written inside mode to iModeID if it was 0 (undefined) - /// @param mode The master mode to add or update inside database - /// - void RegisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) - { - return m_instanceData->toKodi.register_mode(m_instanceData->toKodi.kodiInstance, mode); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Remove a master mode from audio dsp database - /// @param mode The Mode to remove - /// - void UnregisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) - { - return m_instanceData->toKodi.unregister_mode(m_instanceData->toKodi.kodiInstance, mode); - } - //-------------------------------------------------------------------------- - - private: - void SetAddonStruct(KODI_HANDLE instance) - { - if (instance == nullptr) - throw std::logic_error("kodi::addon::CInstanceAudioDSP: Null pointer instance passed."); - - m_instanceData = static_cast(instance); - - m_instanceData->toAddon.get_capabilities = ADDON_GetCapabilities; - m_instanceData->toAddon.get_dsp_name = ADDON_GetDSPName; - m_instanceData->toAddon.get_dsp_version = ADDON_GetDSPVersion; - m_instanceData->toAddon.menu_hook = ADDON_MenuHook; - - m_instanceData->toAddon.stream_create = ADDON_StreamCreate; - m_instanceData->toAddon.stream_destroy = ADDON_StreamDestroy; - m_instanceData->toAddon.stream_is_mode_supported = ADDON_StreamIsModeSupported; - m_instanceData->toAddon.stream_initialize = ADDON_StreamInitialize; - - m_instanceData->toAddon.input_process = ADDON_InputProcess; - - m_instanceData->toAddon.input_resample_process_needed_samplesize = ADDON_InputResampleProcessNeededSamplesize; - m_instanceData->toAddon.input_resample_process = ADDON_InputResampleProcess; - m_instanceData->toAddon.input_resample_get_delay = ADDON_InputResampleGetDelay; - m_instanceData->toAddon.input_resample_samplerate = ADDON_InputResampleSampleRate; - - m_instanceData->toAddon.pre_process_needed_samplesize = ADDON_PreProcessNeededSamplesize; - m_instanceData->toAddon.pre_process_get_delay = ADDON_PreProcessGetDelay; - m_instanceData->toAddon.pre_process = ADDON_PreProcess; - - m_instanceData->toAddon.master_process_set_mode = ADDON_MasterProcessSetMode; - m_instanceData->toAddon.master_process_needed_samplesize = ADDON_MasterProcessNeededSamplesize; - m_instanceData->toAddon.master_process_get_delay = ADDON_MasterProcessGetDelay; - m_instanceData->toAddon.master_process_get_out_channels = ADDON_MasterProcessGetOutChannels; - m_instanceData->toAddon.master_process = ADDON_MasterProcess; - m_instanceData->toAddon.master_process_get_stream_info_string = ADDON_MasterProcessGetStreamInfoString; - - m_instanceData->toAddon.post_process_needed_samplesize = ADDON_PostProcessNeededSamplesize; - m_instanceData->toAddon.post_process_get_delay = ADDON_PostProcessGetDelay; - m_instanceData->toAddon.post_process = ADDON_PostProcess; - - m_instanceData->toAddon.output_resample_process_needed_samplesize = ADDON_OutputResampleProcessNeededSamplesize; - m_instanceData->toAddon.output_resample_process = ADDON_OutputResampleProcess; - m_instanceData->toAddon.output_resample_get_delay = ADDON_OutputResampleGetDelay; - m_instanceData->toAddon.output_resample_samplerate = ADDON_OutputResampleSampleRate; - } - - static inline void ADDON_GetCapabilities(AddonInstance_AudioDSP const* instance, AE_DSP_ADDON_CAPABILITIES *capabilities) - { - instance->toAddon.addonInstance->GetCapabilities(*capabilities); - } - - static inline const char* ADDON_GetDSPName(AddonInstance_AudioDSP const* instance) - { - instance->toAddon.addonInstance->m_dspName = instance->toAddon.addonInstance->GetDSPName(); - return instance->toAddon.addonInstance->m_dspName.c_str(); - } - - static inline const char* ADDON_GetDSPVersion(AddonInstance_AudioDSP const* instance) - { - instance->toAddon.addonInstance->m_dspVersion = instance->toAddon.addonInstance->GetDSPVersion(); - return instance->toAddon.addonInstance->m_dspVersion.c_str(); - } - - static inline AE_DSP_ERROR ADDON_MenuHook(AddonInstance_AudioDSP const* instance, const AE_DSP_MENUHOOK* menuhook, const AE_DSP_MENUHOOK_DATA* item) - { - return instance->toAddon.addonInstance->MenuHook(*menuhook, *item); - } - - static inline AE_DSP_ERROR ADDON_StreamCreate(AddonInstance_AudioDSP const* instance, const AE_DSP_SETTINGS *addonSettings, const AE_DSP_STREAM_PROPERTIES* properties, ADDON_HANDLE handle) - { - return instance->toAddon.addonInstance->StreamCreate(*addonSettings, *properties, handle); - } - - static inline AE_DSP_ERROR ADDON_StreamDestroy(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) - { - return instance->toAddon.addonInstance->StreamDestroy(handle); - } - - static inline AE_DSP_ERROR ADDON_StreamIsModeSupported(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int mode_id, int unique_db_mode_id) - { - return instance->toAddon.addonInstance->StreamIsModeSupported(handle, type, mode_id, unique_db_mode_id); - } - - static inline AE_DSP_ERROR ADDON_StreamInitialize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const AE_DSP_SETTINGS *addonSettings) - { - return instance->toAddon.addonInstance->StreamInitialize(handle, *addonSettings); - } - - static inline bool ADDON_InputProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, unsigned int samples) - { - return instance->toAddon.addonInstance->InputProcess(handle, array_in, samples); - } - - static inline unsigned int ADDON_InputResampleProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) - { - return instance->toAddon.addonInstance->InputResampleProcessNeededSamplesize(handle); - } - - static inline unsigned int ADDON_InputResampleProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) - { - return instance->toAddon.addonInstance->InputResampleProcess(handle, array_in, array_out, samples); - } - - static inline int ADDON_InputResampleSampleRate(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) - { - return instance->toAddon.addonInstance->InputResampleSampleRate(handle); - } - - static inline float ADDON_InputResampleGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) - { - return instance->toAddon.addonInstance->InputResampleGetDelay(handle); - } - - static inline unsigned int ADDON_PreProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id) - { - return instance->toAddon.addonInstance->PreProcessNeededSamplesize(handle, mode_id); - } - - static inline float ADDON_PreProcessGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id) - { - return instance->toAddon.addonInstance->PreProcessGetDelay(handle, mode_id); - } - - static inline unsigned int ADDON_PreProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples) - { - return instance->toAddon.addonInstance->PreProcess(handle, mode_id, array_in, array_out, samples); - } - - static inline AE_DSP_ERROR ADDON_MasterProcessSetMode(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id) - { - return instance->toAddon.addonInstance->MasterProcessSetMode(handle, type, mode_id, unique_db_mode_id); - } - - static inline unsigned int ADDON_MasterProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) - { - return instance->toAddon.addonInstance->MasterProcessNeededSamplesize(handle); - } - - static inline float ADDON_MasterProcessGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) - { - return instance->toAddon.addonInstance->MasterProcessGetDelay(handle); - } - - static inline int ADDON_MasterProcessGetOutChannels(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned long* out_channel_present_flags) - { - return instance->toAddon.addonInstance->MasterProcessGetOutChannels(handle, *out_channel_present_flags); - } - - static inline unsigned int ADDON_MasterProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) - { - return instance->toAddon.addonInstance->MasterProcess(handle, array_in, array_out, samples); - } - - static inline const char* ADDON_MasterProcessGetStreamInfoString(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) - { - instance->toAddon.addonInstance->m_streamInfoString = instance->toAddon.addonInstance->MasterProcessGetStreamInfoString(handle); - return instance->toAddon.addonInstance->m_streamInfoString.c_str(); - } - - static inline unsigned int ADDON_PostProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id) - { - return instance->toAddon.addonInstance->PostProcessNeededSamplesize(handle, mode_id); - } - - static inline float ADDON_PostProcessGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id) - { - return instance->toAddon.addonInstance->PostProcessGetDelay(handle, mode_id); - } - - static inline unsigned int ADDON_PostProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples) - { - return instance->toAddon.addonInstance->PostProcess(handle, mode_id, array_in, array_out, samples); - } - - static inline unsigned int ADDON_OutputResampleProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) - { - return instance->toAddon.addonInstance->OutputResampleProcessNeededSamplesize(handle); - } - - static inline unsigned int ADDON_OutputResampleProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) - { - return instance->toAddon.addonInstance->OutputResampleProcess(handle, array_in, array_out, samples); - } - - static inline int ADDON_OutputResampleSampleRate(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) - { - return instance->toAddon.addonInstance->OutputResampleSampleRate(handle); - } - - static inline float ADDON_OutputResampleGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) - { - return instance->toAddon.addonInstance->OutputResampleGetDelay(handle); - } - - std::string m_dspName; - std::string m_dspVersion; - std::string m_streamInfoString; - AddonInstance_AudioDSP* m_instanceData; - }; - -} /* namespace addon */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt index ba4f889..44aaf05 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt @@ -1,5 +1,4 @@ -set(HEADERS AudioDSP.h - AudioDecoder.h +set(HEADERS AudioDecoder.h AudioEncoder.h ImageDecoder.h Inputstream.h diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Peripheral.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Peripheral.h index 0dae06c..75be27e 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Peripheral.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Peripheral.h @@ -34,6 +34,10 @@ extern "C" /// @name Peripheral types ///{ + + /*! + * @brief API error codes + */ typedef enum PERIPHERAL_ERROR { PERIPHERAL_NO_ERROR = 0, // no error occurred @@ -45,6 +49,9 @@ extern "C" PERIPHERAL_ERROR_CONNECTION_FAILED = -6, // peripherals are connected, but command was interrupted } PERIPHERAL_ERROR; + /*! + * @brief Peripheral types + */ typedef enum PERIPHERAL_TYPE { PERIPHERAL_TYPE_UNKNOWN, @@ -52,6 +59,9 @@ extern "C" PERIPHERAL_TYPE_KEYBOARD, } PERIPHERAL_TYPE; + /*! + * @brief Information shared between peripherals + */ typedef struct PERIPHERAL_INFO { PERIPHERAL_TYPE type; /*!< @brief type of peripheral */ @@ -63,8 +73,6 @@ extern "C" /*! * @brief Peripheral add-on capabilities. - * If a capability is set to true, then the corresponding methods from - * kodi_peripheral_dll.h need to be implemented. */ typedef struct PERIPHERAL_CAPABILITIES { @@ -77,6 +85,10 @@ extern "C" /// @name Event types ///{ + + /*! + * @brief Types of events that can be sent and received + */ typedef enum PERIPHERAL_EVENT_TYPE { PERIPHERAL_EVENT_TYPE_NONE, /*!< @brief unknown event */ @@ -86,12 +98,18 @@ extern "C" PERIPHERAL_EVENT_TYPE_SET_MOTOR, /*!< @brief set the state for joystick rumble motor */ } PERIPHERAL_EVENT_TYPE; + /*! + * @brief States a button can have + */ typedef enum JOYSTICK_STATE_BUTTON { JOYSTICK_STATE_BUTTON_UNPRESSED = 0x0, /*!< @brief button is released */ JOYSTICK_STATE_BUTTON_PRESSED = 0x1, /*!< @brief button is pressed */ } JOYSTICK_STATE_BUTTON; + /*! + * @brief States a D-pad (also called a hat) can have + */ typedef enum JOYSTICK_STATE_HAT { JOYSTICK_STATE_HAT_UNPRESSED = 0x0, /*!< @brief no directions are pressed */ @@ -106,7 +124,7 @@ extern "C" } JOYSTICK_STATE_HAT; /*! - * @brief value in the closed interval [-1.0, 1.0] + * @brief Axis value in the closed interval [-1.0, 1.0] * * The axis state uses the XInput coordinate system: * - Negative values signify down or to the left @@ -114,13 +132,25 @@ extern "C" */ typedef float JOYSTICK_STATE_AXIS; + /*! + * @brief Motor value in the closed interval [0.0, 1.0] + */ typedef float JOYSTICK_STATE_MOTOR; + /*! + * @brief Event information + */ typedef struct PERIPHERAL_EVENT { - unsigned int peripheral_index; - PERIPHERAL_EVENT_TYPE type; - unsigned int driver_index; + /*! @brief Index of the peripheral handling/receiving the event */ + unsigned int peripheral_index; + + /*! @brief Type of the event used to determine which enum field to access below */ + PERIPHERAL_EVENT_TYPE type; + + /*! @brief The index of the event source */ + unsigned int driver_index; + JOYSTICK_STATE_BUTTON driver_button_state; JOYSTICK_STATE_HAT driver_hat_state; JOYSTICK_STATE_AXIS driver_axis_state; @@ -130,6 +160,10 @@ extern "C" /// @name Joystick types ///{ + + /*! + * @brief Info specific to joystick peripherals + */ typedef struct JOYSTICK_INFO { PERIPHERAL_INFO peripheral; /*!< @brief peripheral info for this joystick */ @@ -142,6 +176,15 @@ extern "C" bool supports_poweroff; /*!< @brief whether the joystick supports being powered off */ } ATTRIBUTE_PACKED JOYSTICK_INFO; + /*! + * @brief Driver input primitives + * + * Mapping lower-level driver values to higher-level controller features is + * non-injective; two triggers can share a single axis. + * + * To handle this, driver values are subdivided into "primitives" that map + * injectively to higher-level features. + */ typedef enum JOYSTICK_DRIVER_PRIMITIVE_TYPE { JOYSTICK_DRIVER_PRIMITIVE_TYPE_UNKNOWN, @@ -149,13 +192,22 @@ extern "C" JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION, JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS, JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR, + JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY, + JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOUSE_BUTTON, + JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION, } JOYSTICK_DRIVER_PRIMITIVE_TYPE; + /*! + * @brief Button primitive + */ typedef struct JOYSTICK_DRIVER_BUTTON { int index; } ATTRIBUTE_PACKED JOYSTICK_DRIVER_BUTTON; + /*! + * @brief Hat direction + */ typedef enum JOYSTICK_DRIVER_HAT_DIRECTION { JOYSTICK_DRIVER_HAT_UNKNOWN, @@ -165,12 +217,18 @@ extern "C" JOYSTICK_DRIVER_HAT_DOWN, } JOYSTICK_DRIVER_HAT_DIRECTION; + /*! + * @brief Hat direction primitive + */ typedef struct JOYSTICK_DRIVER_HAT { int index; JOYSTICK_DRIVER_HAT_DIRECTION direction; } ATTRIBUTE_PACKED JOYSTICK_DRIVER_HAT; + /*! + * @brief Semiaxis direction + */ typedef enum JOYSTICK_DRIVER_SEMIAXIS_DIRECTION { JOYSTICK_DRIVER_SEMIAXIS_NEGATIVE = -1, /*!< @brief negative half of the axis */ @@ -178,6 +236,9 @@ extern "C" JOYSTICK_DRIVER_SEMIAXIS_POSITIVE = 1, /*!< @brief positive half of the axis */ } JOYSTICK_DRIVER_SEMIAXIS_DIRECTION; + /*! + * @brief Semiaxis primitive + */ typedef struct JOYSTICK_DRIVER_SEMIAXIS { int index; @@ -186,11 +247,70 @@ extern "C" unsigned int range; } ATTRIBUTE_PACKED JOYSTICK_DRIVER_SEMIAXIS; + /*! + * @brief Motor primitive + */ typedef struct JOYSTICK_DRIVER_MOTOR { int index; } ATTRIBUTE_PACKED JOYSTICK_DRIVER_MOTOR; + /*! + * @brief Keyboard key primitive + */ + typedef struct JOYSTICK_DRIVER_KEY + { + char keycode[16]; + } ATTRIBUTE_PACKED JOYSTICK_DRIVER_KEY; + + /*! + * @brief Mouse buttons + */ + typedef enum JOYSTICK_DRIVER_MOUSE_INDEX + { + JOYSTICK_DRIVER_MOUSE_INDEX_UNKNOWN, + JOYSTICK_DRIVER_MOUSE_INDEX_LEFT, + JOYSTICK_DRIVER_MOUSE_INDEX_RIGHT, + JOYSTICK_DRIVER_MOUSE_INDEX_MIDDLE, + JOYSTICK_DRIVER_MOUSE_INDEX_BUTTON4, + JOYSTICK_DRIVER_MOUSE_INDEX_BUTTON5, + JOYSTICK_DRIVER_MOUSE_INDEX_WHEEL_UP, + JOYSTICK_DRIVER_MOUSE_INDEX_WHEEL_DOWN, + JOYSTICK_DRIVER_MOUSE_INDEX_HORIZ_WHEEL_LEFT, + JOYSTICK_DRIVER_MOUSE_INDEX_HORIZ_WHEEL_RIGHT, + } JOYSTICK_DRIVER_MOUSE_INDEX; + + /*! + * @brief Mouse button primitive + */ + typedef struct JOYSTICK_DRIVER_MOUSE_BUTTON + { + JOYSTICK_DRIVER_MOUSE_INDEX button; + } ATTRIBUTE_PACKED JOYSTICK_DRIVER_MOUSE_BUTTON; + + /*! + * @brief Relative pointer direction + */ + typedef enum JOYSTICK_DRIVER_RELPOINTER_DIRECTION + { + JOYSTICK_DRIVER_RELPOINTER_UNKNOWN, + JOYSTICK_DRIVER_RELPOINTER_LEFT, + JOYSTICK_DRIVER_RELPOINTER_RIGHT, + JOYSTICK_DRIVER_RELPOINTER_UP, + JOYSTICK_DRIVER_RELPOINTER_DOWN, + } JOYSTICK_DRIVER_RELPOINTER_DIRECTION; + + /*! + * @brief Relative pointer direction primitive + */ + typedef struct JOYSTICK_DRIVER_RELPOINTER + { + JOYSTICK_DRIVER_RELPOINTER_DIRECTION direction; + } ATTRIBUTE_PACKED JOYSTICK_DRIVER_RELPOINTER; + + /*! + * @brief Driver primitive struct + */ typedef struct JOYSTICK_DRIVER_PRIMITIVE { JOYSTICK_DRIVER_PRIMITIVE_TYPE type; @@ -200,9 +320,18 @@ extern "C" struct JOYSTICK_DRIVER_HAT hat; struct JOYSTICK_DRIVER_SEMIAXIS semiaxis; struct JOYSTICK_DRIVER_MOTOR motor; + struct JOYSTICK_DRIVER_KEY key; + struct JOYSTICK_DRIVER_MOUSE_BUTTON mouse; + struct JOYSTICK_DRIVER_RELPOINTER relpointer; }; } ATTRIBUTE_PACKED JOYSTICK_DRIVER_PRIMITIVE; + /*! + * @brief Controller feature + * + * Controller features are an abstraction over driver values. Each feature + * maps to one or more driver primitives. + */ typedef enum JOYSTICK_FEATURE_TYPE { JOYSTICK_FEATURE_TYPE_UNKNOWN, @@ -214,11 +343,15 @@ extern "C" JOYSTICK_FEATURE_TYPE_ABSPOINTER, JOYSTICK_FEATURE_TYPE_WHEEL, JOYSTICK_FEATURE_TYPE_THROTTLE, + JOYSTICK_FEATURE_TYPE_KEY, } JOYSTICK_FEATURE_TYPE; + /*! + * @brief Indices used to access a feature's driver primitives + */ typedef enum JOYSTICK_FEATURE_PRIMITIVE { - // Scalar feature + // Scalar feature (a button, hat direction or semiaxis) JOYSTICK_SCALAR_PRIMITIVE = 0, // Analog stick @@ -243,10 +376,25 @@ extern "C" JOYSTICK_THROTTLE_UP = 0, JOYSTICK_THROTTLE_DOWN = 1, + // Key + JOYSTICK_KEY_PRIMITIVE = 0, + + // Mouse button + JOYSTICK_MOUSE_BUTTON = 0, + + // Relative pointer direction + JOYSTICK_RELPOINTER_UP = 0, + JOYSTICK_RELPOINTER_DOWN = 1, + JOYSTICK_RELPOINTER_RIGHT = 2, + JOYSTICK_RELPOINTER_LEFT = 3, + // Maximum number of primitives JOYSTICK_PRIMITIVE_MAX = 4, } JOYSTICK_FEATURE_PRIMITIVE; + /*! + * @brief Mapping between higher-level controller feature and its driver primitives + */ typedef struct JOYSTICK_FEATURE { char* name; diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h index 3c4cab3..c2efc05 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h @@ -23,8 +23,8 @@ #include // Requires c++11 #include -#include #include +#include #include #define PERIPHERAL_SAFE_DELETE(x) do { delete (x); (x) = NULL; } while (0) @@ -164,62 +164,70 @@ namespace addon class PeripheralEvent { public: - PeripheralEvent(void) : - m_event() + PeripheralEvent(void) { } PeripheralEvent(unsigned int peripheralIndex, unsigned int buttonIndex, JOYSTICK_STATE_BUTTON state) : - m_event() + m_type(PERIPHERAL_EVENT_TYPE_DRIVER_BUTTON), + m_peripheralIndex(peripheralIndex), + m_driverIndex(buttonIndex), + m_buttonState(state) { - SetType(PERIPHERAL_EVENT_TYPE_DRIVER_BUTTON); - SetPeripheralIndex(peripheralIndex); - SetDriverIndex(buttonIndex); - SetButtonState(state); } PeripheralEvent(unsigned int peripheralIndex, unsigned int hatIndex, JOYSTICK_STATE_HAT state) : - m_event() + m_type(PERIPHERAL_EVENT_TYPE_DRIVER_HAT), + m_peripheralIndex(peripheralIndex), + m_driverIndex(hatIndex), + m_hatState(state) { - SetType(PERIPHERAL_EVENT_TYPE_DRIVER_HAT); - SetPeripheralIndex(peripheralIndex); - SetDriverIndex(hatIndex); - SetHatState(state); } PeripheralEvent(unsigned int peripheralIndex, unsigned int axisIndex, JOYSTICK_STATE_AXIS state) : - m_event() + m_type(PERIPHERAL_EVENT_TYPE_DRIVER_AXIS), + m_peripheralIndex(peripheralIndex), + m_driverIndex(axisIndex), + m_axisState(state) { - SetType(PERIPHERAL_EVENT_TYPE_DRIVER_AXIS); - SetPeripheralIndex(peripheralIndex); - SetDriverIndex(axisIndex); - SetAxisState(state); } explicit PeripheralEvent(const PERIPHERAL_EVENT& event) : - m_event(event) - { - } - - PERIPHERAL_EVENT_TYPE Type(void) const { return m_event.type; } - unsigned int PeripheralIndex(void) const { return m_event.peripheral_index; } - unsigned int DriverIndex(void) const { return m_event.driver_index; } - JOYSTICK_STATE_BUTTON ButtonState(void) const { return m_event.driver_button_state; } - JOYSTICK_STATE_HAT HatState(void) const { return m_event.driver_hat_state; } - JOYSTICK_STATE_AXIS AxisState(void) const { return m_event.driver_axis_state; } - JOYSTICK_STATE_MOTOR MotorState(void) const { return m_event.motor_state; } - - void SetType(PERIPHERAL_EVENT_TYPE type) { m_event.type = type; } - void SetPeripheralIndex(unsigned int index) { m_event.peripheral_index = index; } - void SetDriverIndex(unsigned int index) { m_event.driver_index = index; } - void SetButtonState(JOYSTICK_STATE_BUTTON state) { m_event.driver_button_state = state; } - void SetHatState(JOYSTICK_STATE_HAT state) { m_event.driver_hat_state = state; } - void SetAxisState(JOYSTICK_STATE_AXIS state) { m_event.driver_axis_state = state; } - void SetMotorState(JOYSTICK_STATE_MOTOR state) { m_event.motor_state = state; } + m_type(event.type), + m_peripheralIndex(event.peripheral_index), + m_driverIndex(event.driver_index), + m_buttonState(event.driver_button_state), + m_hatState(event.driver_hat_state), + m_axisState(event.driver_axis_state), + m_motorState(event.motor_state) + { + } + + PERIPHERAL_EVENT_TYPE Type(void) const { return m_type; } + unsigned int PeripheralIndex(void) const { return m_peripheralIndex; } + unsigned int DriverIndex(void) const { return m_driverIndex; } + JOYSTICK_STATE_BUTTON ButtonState(void) const { return m_buttonState; } + JOYSTICK_STATE_HAT HatState(void) const { return m_hatState; } + JOYSTICK_STATE_AXIS AxisState(void) const { return m_axisState; } + JOYSTICK_STATE_MOTOR MotorState(void) const { return m_motorState; } + + void SetType(PERIPHERAL_EVENT_TYPE type) { m_type = type; } + void SetPeripheralIndex(unsigned int index) { m_peripheralIndex = index; } + void SetDriverIndex(unsigned int index) { m_driverIndex = index; } + void SetButtonState(JOYSTICK_STATE_BUTTON state) { m_buttonState = state; } + void SetHatState(JOYSTICK_STATE_HAT state) { m_hatState = state; } + void SetAxisState(JOYSTICK_STATE_AXIS state) { m_axisState = state; } + void SetMotorState(JOYSTICK_STATE_MOTOR state) { m_motorState = state; } void ToStruct(PERIPHERAL_EVENT& event) const { - event = m_event; + event.type = m_type; + event.peripheral_index = m_peripheralIndex; + event.driver_index = m_driverIndex; + event.driver_button_state = m_buttonState; + event.driver_hat_state = m_hatState; + event.driver_axis_state = m_axisState; + event.motor_state = m_motorState; } static void FreeStruct(PERIPHERAL_EVENT& event) @@ -228,7 +236,13 @@ namespace addon } private: - PERIPHERAL_EVENT m_event; + PERIPHERAL_EVENT_TYPE m_type = PERIPHERAL_EVENT_TYPE_NONE; + unsigned int m_peripheralIndex = 0; + unsigned int m_driverIndex = 0; + JOYSTICK_STATE_BUTTON m_buttonState = JOYSTICK_STATE_BUTTON_UNPRESSED; + JOYSTICK_STATE_HAT m_hatState = JOYSTICK_STATE_HAT_UNPRESSED; + JOYSTICK_STATE_AXIS m_axisState = 0.0f; + JOYSTICK_STATE_MOTOR m_motorState = 0.0f; }; typedef PeripheralVector PeripheralEvents; @@ -298,9 +312,6 @@ namespace addon unsigned int MotorCount(void) const { return m_motorCount; } bool SupportsPowerOff(void) const { return m_supportsPowerOff; } - // Derived property: Counts are unknown if all are zero - bool AreElementCountsKnown(void) const { return m_buttonCount != 0 || m_hatCount != 0 || m_axisCount != 0; } - void SetProvider(const std::string& provider) { m_provider = provider; } void SetRequestedPort(int requestedPort) { m_requestedPort = requestedPort; } void SetButtonCount(unsigned int buttonCount) { m_buttonCount = buttonCount; } @@ -352,6 +363,9 @@ namespace addon * 2) a hat direction * 3) a semiaxis (either the positive or negative half of an axis) * 4) a motor + * 5) a keyboard key + * 6) a mouse button + * 7) a relative pointer direction * * The type determines the fields in use: * @@ -370,6 +384,15 @@ namespace addon * * Motor: * - driver index + * + * Key: + * - key code + * + * Mouse button: + * - driver index + * + * Relative pointer direction: + * - relative pointer direction */ struct DriverPrimitive { @@ -383,7 +406,8 @@ namespace addon m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), m_center(0), m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN), - m_range(1) + m_range(1), + m_relPointerDirection(JOYSTICK_DRIVER_RELPOINTER_UNKNOWN) { } @@ -397,12 +421,13 @@ namespace addon m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), m_center(0), m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN), - m_range(1) + m_range(1), + m_relPointerDirection(JOYSTICK_DRIVER_RELPOINTER_UNKNOWN) { } /*! - * \brief Construct a driver primitive representing a button + * \brief Construct a driver primitive representing a joystick button */ static DriverPrimitive CreateButton(unsigned int buttonIndex) { @@ -419,7 +444,8 @@ namespace addon m_hatDirection(direction), m_center(0), m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN), - m_range(1) + m_range(1), + m_relPointerDirection(JOYSTICK_DRIVER_RELPOINTER_UNKNOWN) { } @@ -433,7 +459,8 @@ namespace addon m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), m_center(center), m_semiAxisDirection(direction), - m_range(range) + m_range(range), + m_relPointerDirection(JOYSTICK_DRIVER_RELPOINTER_UNKNOWN) { } @@ -445,13 +472,52 @@ namespace addon return DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR, motorIndex); } + /*! + * \brief Construct a driver primitive representing a key on a keyboard + */ + DriverPrimitive(std::string keycode) : + m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY), + m_driverIndex(0), + m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), + m_center(0), + m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN), + m_range(1), + m_keycode(std::move(keycode)), + m_relPointerDirection(JOYSTICK_DRIVER_RELPOINTER_UNKNOWN) + { + } + + /*! + * \brief Construct a driver primitive representing a mouse button + */ + static DriverPrimitive CreateMouseButton(JOYSTICK_DRIVER_MOUSE_INDEX buttonIndex) + { + return DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOUSE_BUTTON, static_cast(buttonIndex)); + } + + /*! + * \brief Construct a driver primitive representing one of the four + * direction in which a relative pointer can move + */ + DriverPrimitive(JOYSTICK_DRIVER_RELPOINTER_DIRECTION direction) : + m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION), + m_driverIndex(0), + m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), + m_center(0), + m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN), + m_range(1), + m_relPointerDirection(direction) + { + } + explicit DriverPrimitive(const JOYSTICK_DRIVER_PRIMITIVE& primitive) : m_type(primitive.type), m_driverIndex(0), m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), m_center(0), m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN), - m_range(1) + m_range(1), + m_relPointerDirection(JOYSTICK_DRIVER_RELPOINTER_UNKNOWN) { switch (m_type) { @@ -479,6 +545,21 @@ namespace addon m_driverIndex = primitive.motor.index; break; } + case JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY: + { + m_keycode = primitive.key.keycode; + break; + } + case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOUSE_BUTTON: + { + m_driverIndex = primitive.mouse.button; + break; + } + case JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION: + { + m_relPointerDirection = primitive.relpointer.direction; + break; + } default: break; } @@ -490,6 +571,9 @@ namespace addon int Center(void) const { return m_center; } JOYSTICK_DRIVER_SEMIAXIS_DIRECTION SemiAxisDirection(void) const { return m_semiAxisDirection; } unsigned int Range(void) const { return m_range; } + const std::string& Keycode(void) const { return m_keycode; } + JOYSTICK_DRIVER_MOUSE_INDEX MouseIndex(void) const { return static_cast(m_driverIndex); } + JOYSTICK_DRIVER_RELPOINTER_DIRECTION RelPointerDirection(void) const { return m_relPointerDirection; } bool operator==(const DriverPrimitive& other) const { @@ -498,7 +582,6 @@ namespace addon switch (m_type) { case JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON: - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR: { return m_driverIndex == other.m_driverIndex; } @@ -514,6 +597,22 @@ namespace addon m_semiAxisDirection == other.m_semiAxisDirection && m_range == other.m_range; } + case JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY: + { + return m_keycode == other.m_keycode; + } + case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR: + { + return m_driverIndex == other.m_driverIndex; + } + case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOUSE_BUTTON: + { + return m_driverIndex == other.m_driverIndex; + } + case JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION: + { + return m_relPointerDirection == other.m_relPointerDirection; + } default: break; } @@ -550,6 +649,23 @@ namespace addon driver_primitive.motor.index = m_driverIndex; break; } + case JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY: + { + const size_t size = sizeof(driver_primitive.key.keycode); + std::strncpy(driver_primitive.key.keycode, m_keycode.c_str(), size - 1); + driver_primitive.key.keycode[size - 1] = '\0'; + break; + } + case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOUSE_BUTTON: + { + driver_primitive.mouse.button = static_cast(m_driverIndex); + break; + } + case JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION: + { + driver_primitive.relpointer.direction = m_relPointerDirection; + break; + } default: break; } @@ -567,6 +683,8 @@ namespace addon int m_center; JOYSTICK_DRIVER_SEMIAXIS_DIRECTION m_semiAxisDirection; unsigned int m_range; + std::string m_keycode; + JOYSTICK_DRIVER_RELPOINTER_DIRECTION m_relPointerDirection; }; typedef PeripheralVector DriverPrimitives; @@ -584,6 +702,7 @@ namespace addon * 6) absolute pointer * 7) wheel * 8) throttle + * 9) keyboard key * * [1] All three driver primitives (buttons, hats and axes) have a state that * can be represented using a single scalar value. For this reason, @@ -598,7 +717,7 @@ namespace addon JoystickFeature(const std::string& name = "", JOYSTICK_FEATURE_TYPE type = JOYSTICK_FEATURE_TYPE_UNKNOWN) : m_name(name), m_type(type), - m_primitives() + m_primitives{} { } @@ -672,4 +791,3 @@ namespace addon } /* namespace addon */ } /* namespace kodi */ - diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VFS.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VFS.h index 8e688d7..637a991 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VFS.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VFS.h @@ -547,7 +547,7 @@ namespace addon entries[i].properties = nullptr; } *retEntries = entries; - *num_entries = addonEntries.size(); + *num_entries = static_cast(addonEntries.size()); } return ret; } @@ -586,7 +586,7 @@ namespace addon strncpy(rootpath, cppRootPath.c_str(), ADDON_STANDARD_STRING_LENGTH); VFSDirEntry* entries = static_cast(malloc(sizeof(VFSDirEntry) * addonEntries.size())); - for (unsigned int i = 0; i < addonEntries.size(); ++i) + for (size_t i = 0; i < addonEntries.size(); ++i) { entries[i].label = strdup(addonEntries[i].Label().c_str()); entries[i].title = strdup(addonEntries[i].Title().c_str()); @@ -610,7 +610,7 @@ namespace addon entries[i].properties = nullptr; } *retEntries = entries; - *num_entries = addonEntries.size(); + *num_entries = static_cast(addonEntries.size()); } return ret; } diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VideoCodec.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VideoCodec.h index eb4351e..8a8779a 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VideoCodec.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VideoCodec.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2017 Team XBMC - * http://xbmc.org + * 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 diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Visualization.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Visualization.h index 452085a..a2bef15 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Visualization.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Visualization.h @@ -745,7 +745,7 @@ namespace addon addon->toAddon.addonInstance->m_instanceData->toKodi.transfer_preset(addon->toKodi.kodiInstance, it.c_str()); } - return presets.size(); + return static_cast(presets.size()); } inline static int ADDON_GetActivePreset(const AddonInstance_Visualization* addon) 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 index 4ce5bbc..79ca778 100644 --- 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 @@ -130,17 +130,6 @@ 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 * @@ -155,6 +144,88 @@ void UpdatePort(int port, bool connected, const game_controller* controller); */ bool HasFeature(const char* controller_id, const char* feature_name); +/*! + * \brief Get the input topolgy that specifies which controllers can be connected + * + * \return The input topology, or null to use the default + * + * If this returns non-null, topology must be freed using FreeTopology(). + * + * If this returns null, the topology will default to a single port that can + * accept all controllers imported by addon.xml. The port ID is set to + * the DEFAULT_PORT_ID constant. + */ +game_input_topology* GetTopology(); + +/*! + * \brief Free the topology's resources + * + * \param topology The topology returned by GetTopology() + */ +void FreeTopology(game_input_topology* topology); + +/*! + * \brief Enable/disable keyboard input using the specified controller + * + * \param enable True to enable input, false otherwise + * \param controller The controller info if enabling, or unused if disabling + * + * \return True if keyboard input was enabled, false otherwise + */ +bool EnableKeyboard(bool enable, const game_controller* controller); + +/*! + * \brief Enable/disable mouse input using the specified controller + * + * \param enable True to enable input, false otherwise + * \param controller The controller info if enabling, or unused if disabling + * + * \return True if mouse input was enabled, false otherwise + */ +bool EnableMouse(bool enable, const game_controller* controller); + +/*! + * \brief Connect/disconnect a controller to a port on the virtual game console + * + * \param connect True to connect a controller, false to disconnect + * \param address The address of the port + * \param controller The controller info if connecting, or unused if disconnecting + * + * The address is a string that allows traversal of the controller topology. + * It is formed by alternating port IDs and controller IDs separated by "/". + * + * For example, assume that the topology represented in XML for Snes9x is: + * + * + * + * + * + * + * + * + * + * + * + * ... + * + * + * + * + * To connect a multitap to the console's first port, the multitap's controller + * info is set using the port address: + * + * 1 + * + * To connect a SNES controller to the second port of the multitap, the + * controller info is next set using the address: + * + * 1/game.controller.multitap/2 + * + * Any attempts to connect a controller to a port on a disconnected multitap + * will return false. + */ +bool ConnectController(bool connect, const char* port_address, const game_controller* controller); + /*! * \brief Notify the add-on of an input event * @@ -247,8 +318,12 @@ void __declspec(dllexport) get_addon(void* ptr) pClient->toAddon.Reset = Reset; pClient->toAddon.HwContextReset = HwContextReset; pClient->toAddon.HwContextDestroy = HwContextDestroy; - pClient->toAddon.UpdatePort = UpdatePort; pClient->toAddon.HasFeature = HasFeature; + pClient->toAddon.GetTopology = GetTopology; + pClient->toAddon.FreeTopology = FreeTopology; + pClient->toAddon.EnableKeyboard = EnableKeyboard; + pClient->toAddon.EnableMouse = EnableMouse; + pClient->toAddon.ConnectController = ConnectController; pClient->toAddon.InputEvent = InputEvent; pClient->toAddon.SerializeSize = SerializeSize; pClient->toAddon.Serialize = Serialize; 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 index d4568e7..758b0fa 100644 --- 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 @@ -40,10 +40,8 @@ #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 + #define ATTRIBUTE_PACKED __attribute__ ((packed)) + #define PRAGMA_PACK 0 #endif #if !defined(ATTRIBUTE_PACKED) @@ -57,6 +55,9 @@ #include "input/XBMC_vkeys.h" #endif +/*! Port ID used when topology is unknown */ +#define DEFAULT_PORT_ID "1" + #ifdef __cplusplus extern "C" { #endif @@ -159,13 +160,6 @@ typedef enum GAME_HW_CONTEXT_TYPE 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, @@ -181,17 +175,17 @@ typedef enum GAME_INPUT_EVENT_SOURCE typedef enum GAME_KEY_MOD { - GAME_KEY_MOD_NONE = 0x00, + GAME_KEY_MOD_NONE = 0x0000, - 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_SHIFT = 0x0001, + GAME_KEY_MOD_CTRL = 0x0002, + GAME_KEY_MOD_ALT = 0x0004, + GAME_KEY_MOD_META = 0x0008, + GAME_KEY_MOD_SUPER = 0x0010, - GAME_KEY_MOD_NUMLOCK = 0x20, - GAME_KEY_MOD_CAPSLOCK = 0x40, - GAME_KEY_MOD_SCROLLOCK = 0x80, + GAME_KEY_MOD_NUMLOCK = 0x0100, + GAME_KEY_MOD_CAPSLOCK = 0x0200, + GAME_KEY_MOD_SCROLLOCK = 0x0400, } GAME_KEY_MOD; /*! Returned from game_get_region() */ @@ -203,9 +197,9 @@ typedef enum GAME_REGION } GAME_REGION; /*! -* Special game types passed into game_load_game_special(). Only used when -* multiple ROMs are required. -*/ + * 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, @@ -277,9 +271,21 @@ typedef enum GAME_ROTATION GAME_ROTATION_270_CW, } GAME_ROTATION; +/*! + * \brief Type of port on the virtual game console + */ +typedef enum GAME_PORT_TYPE +{ + GAME_PORT_UNKNOWN, + GAME_PORT_KEYBOARD, + GAME_PORT_MOUSE, + GAME_PORT_CONTROLLER, +} GAME_PORT_TYPE; + typedef struct game_controller { const char* controller_id; + bool provides_input; // False for multitaps unsigned int digital_button_count; unsigned int analog_button_count; unsigned int analog_stick_count; @@ -290,6 +296,48 @@ typedef struct game_controller unsigned int motor_count; } ATTRIBUTE_PACKED game_controller; +struct game_input_port; + +/*! + * \brief Device that can provide input + */ +typedef struct game_input_device +{ + const char* controller_id; // ID used in the Kodi controller API + const char* port_address; + game_input_port* available_ports; + unsigned int port_count; +} ATTRIBUTE_PACKED game_input_device; + +/*! + * \brief Port that can provide input + * + * Ports can accept multiple devices and devices can have multiple ports, so + * the topology of possible configurations is a tree structure of alternating + * port and device nodes. + */ +typedef struct game_input_port +{ + GAME_PORT_TYPE type; + const char* port_id; // Required for GAME_PORT_CONTROLLER type + game_input_device* accepted_devices; + unsigned int device_count; +} ATTRIBUTE_PACKED game_input_port; + +/*! + * \brief The input topology is the possible ways to connect input devices + * + * This represents the logical topology, which is the possible connections that + * the game client's logic can handle. It is strictly a subset of the physical + * topology. Loops are not allowed. + */ +typedef struct game_input_topology +{ + game_input_port *ports; //! The list of ports on the virtual game console + unsigned int port_count; //! The number of ports + int player_limit; //! A limit on the number of input-providing devices, or -1 for no limit +} ATTRIBUTE_PACKED game_input_topology; + typedef struct game_digital_button_event { bool pressed; @@ -321,7 +369,14 @@ typedef struct game_accelerometer_event typedef struct game_key_event { bool pressed; - XBMCVKey character; + + /*! + * If the keypress generates a printing character, the unicode value + * contains the character generated. If the key is a non-printing character, + * e.g. a function or arrow key, the unicode value is zero. + */ + uint32_t unicode; + GAME_KEY_MOD modifiers; } ATTRIBUTE_PACKED game_key_event; @@ -346,8 +401,9 @@ typedef struct game_motor_event typedef struct game_input_event { GAME_INPUT_EVENT_SOURCE type; - int port; const char* controller_id; + GAME_PORT_TYPE port_type; + const char* port_address; const char* feature_name; union { @@ -474,8 +530,6 @@ typedef struct AddonToKodiFuncTable_Game uintptr_t (*HwGetCurrentFramebuffer)(void* kodiInstance); game_proc_address_t (*HwGetProcAddress)(void* kodiInstance, const char* symbol); void (*RenderFrame)(void* kodiInstance); - bool (*OpenPort)(void* kodiInstance, unsigned int port); - void (*ClosePort)(void* kodiInstance, unsigned int port); bool (*InputEvent)(void* kodiInstance, const game_input_event* event); } AddonToKodiFuncTable_Game; @@ -493,8 +547,12 @@ typedef struct KodiToAddonFuncTable_Game 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* HasFeature)(const char*, const char*); + game_input_topology* (__cdecl* GetTopology)(); + void (__cdecl* FreeTopology)(game_input_topology*); + bool (__cdecl* EnableKeyboard)(bool, const game_controller*); + bool (__cdecl* EnableMouse)(bool, const game_controller*); + bool (__cdecl* ConnectController)(bool, const char*, const game_controller*); bool (__cdecl* InputEvent)(const game_input_event*); size_t (__cdecl* SerializeSize)(void); GAME_ERROR (__cdecl* Serialize)(uint8_t*, size_t); 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 index 1ca91a4..2774afd 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h @@ -187,28 +187,6 @@ public: // --- 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(unsigned int port) - { - return m_callbacks->toKodi.OpenPort(m_callbacks->toKodi.kodiInstance, port); - } - - /*! - * \brief End reporting events for the specified port - * - * \param port The port number passed to OpenPort() - */ - void ClosePort(unsigned int port) - { - return m_callbacks->toKodi.ClosePort(m_callbacks->toKodi.kodiInstance, port); - } - /*! * \brief Notify the port of an input event * 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 c844c73..045d5fe 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 @@ -1,7 +1,7 @@ #pragma once /* * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org + * 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 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 5ef6bdc..271df98 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 @@ -1,7 +1,7 @@ #pragma once /* * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org + * 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 @@ -71,8 +71,6 @@ 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); @@ -96,8 +94,6 @@ typedef struct AddonCB 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; 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 f470566..11ea50c 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 @@ -1,7 +1,7 @@ #pragma once /* * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org + * 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 diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/platform/android/System.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/platform/android/System.h new file mode 100644 index 0000000..bee00ef --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/platform/android/System.h @@ -0,0 +1,107 @@ +#pragma once +/* + * Copyright (C) 2005-2018 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KODI; see the file COPYING. If not, see + * . + * + */ + +#include "../../AddonBase.h" + +/* + * For interface between add-on and kodi. + * + * This structure defines the addresses of functions stored inside Kodi which + * are then available for the add-on to call + * + * All function pointers there are used by the C++ interface functions below. + * You find the set of them on xbmc/addons/interfaces/General.cpp + * + * Note: For add-on development itself this is not needed + */ + +static const char* INTERFACE_ANDROID_SYSTEM_NAME = "ANDROID_SYSTEM"; +static const char* INTERFACE_ANDROID_SYSTEM_VERSION = "1.0.0"; +static const char* INTERFACE_ANDROID_SYSTEM_VERSION_MIN = "1.0.0"; + +struct AddonToKodiFuncTable_android_system +{ + void* (*get_jni_env)(); + int (*get_sdk_version)(); +}; + +//============================================================================== +/// +/// \defgroup cpp_kodi_platform Interface - kodi::platform +/// \ingroup cpp +/// @brief **Android platform specific functions** +/// +/// #include " +/// +//------------------------------------------------------------------------------ + +namespace kodi +{ +namespace platform +{ + class CInterfaceAndroidSystem + { + public: + CInterfaceAndroidSystem() + : m_interface(static_cast(GetInterface(INTERFACE_ANDROID_SYSTEM_NAME, INTERFACE_ANDROID_SYSTEM_VERSION))) + {}; + + //============================================================================ + /// + /// \ingroup cpp_kodi_platform + /// @brief request an JNI env pointer for the calling thread. + /// JNI env has to be controlled by kodi because of the underlying + /// threading concep. + /// + /// @param[in]: + /// @return JNI env pointer for the calling thread + /// + inline void * GetJNIEnv() + { + if (m_interface) + return m_interface->get_jni_env(); + + return nullptr; + } + //---------------------------------------------------------------------------- + + //============================================================================ + /// + /// \ingroup cpp_kodi_platform + /// @brief request the android sdk version to e.g. initialize JNIBase. + /// + /// @param[in]: + /// @return Android SDK version + /// + inline int GetSDKVersion() + { + if (m_interface) + return m_interface->get_sdk_version(); + + return 0; + } + + private: + AddonToKodiFuncTable_android_system *m_interface; + }; + //---------------------------------------------------------------------------- +} /* namespace platform */ +} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h index db8508e..b61cb35 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h @@ -41,7 +41,7 @@ * overview. */ -#define ADDON_GLOBAL_VERSION_MAIN "1.0.12" +#define ADDON_GLOBAL_VERSION_MAIN "1.0.13" #define ADDON_GLOBAL_VERSION_MAIN_MIN "1.0.12" #define ADDON_GLOBAL_VERSION_MAIN_XML_ID "kodi.binary.global.main" #define ADDON_GLOBAL_VERSION_MAIN_DEPENDS "AddonBase.h" \ @@ -76,11 +76,6 @@ #define ADDON_GLOBAL_VERSION_NETWORK_XML_ID "kodi.binary.global.network" #define ADDON_GLOBAL_VERSION_NETWORK_DEPENDS "Network.h" -#define ADDON_INSTANCE_VERSION_ADSP "0.2.0" -#define ADDON_INSTANCE_VERSION_ADSP_MIN "0.2.0" -#define ADDON_INSTANCE_VERSION_ADSP_XML_ID "kodi.binary.instance.adsp" -#define ADDON_INSTANCE_VERSION_ADSP_DEPENDS "addon-instance/AudioDSP.h" - #define ADDON_INSTANCE_VERSION_AUDIODECODER "2.0.0" #define ADDON_INSTANCE_VERSION_AUDIODECODER_MIN "2.0.0" #define ADDON_INSTANCE_VERSION_AUDIODECODER_XML_ID "kodi.binary.instance.audiodecoder" @@ -91,8 +86,8 @@ #define ADDON_INSTANCE_VERSION_AUDIOENCODER_XML_ID "kodi.binary.instance.audioencoder" #define ADDON_INSTANCE_VERSION_AUDIOENCODER_DEPENDS "addon-instance/AudioEncoder.h" -#define ADDON_INSTANCE_VERSION_GAME "1.0.33" -#define ADDON_INSTANCE_VERSION_GAME_MIN "1.0.33" +#define ADDON_INSTANCE_VERSION_GAME "1.0.36" +#define ADDON_INSTANCE_VERSION_GAME_MIN "1.0.36" #define ADDON_INSTANCE_VERSION_GAME_XML_ID "kodi.binary.instance.game" #define ADDON_INSTANCE_VERSION_GAME_DEPENDS "kodi_game_dll.h" \ "kodi_game_types.h" \ @@ -108,14 +103,14 @@ #define ADDON_INSTANCE_VERSION_INPUTSTREAM_XML_ID "kodi.binary.instance.inputstream" #define ADDON_INSTANCE_VERSION_INPUTSTREAM_DEPENDS "addon-instance/Inputstream.h" -#define ADDON_INSTANCE_VERSION_PERIPHERAL "1.3.5" +#define ADDON_INSTANCE_VERSION_PERIPHERAL "1.3.7" #define ADDON_INSTANCE_VERSION_PERIPHERAL_MIN "1.3.4" #define ADDON_INSTANCE_VERSION_PERIPHERAL_XML_ID "kodi.binary.instance.peripheral" #define ADDON_INSTANCE_VERSION_PERIPHERAL_DEPENDS "addon-instance/Peripheral.h" \ "addon-instance/PeripheralUtils.h" -#define ADDON_INSTANCE_VERSION_PVR "5.8.0" -#define ADDON_INSTANCE_VERSION_PVR_MIN "5.8.0" +#define ADDON_INSTANCE_VERSION_PVR "5.9.0" +#define ADDON_INSTANCE_VERSION_PVR_MIN "5.9.0" #define ADDON_INSTANCE_VERSION_PVR_XML_ID "kodi.binary.instance.pvr" #define ADDON_INSTANCE_VERSION_PVR_DEPENDS "xbmc_pvr_dll.h" \ "xbmc_pvr_types.h" \ @@ -164,7 +159,6 @@ typedef enum ADDON_TYPE ADDON_GLOBAL_MAX = 5, // Last used global id, used in loops to check versions. Need to change if new global type becomes added. /* addon type instances */ - ADDON_INSTANCE_ADSP = 101, ADDON_INSTANCE_AUDIODECODER = 102, ADDON_INSTANCE_AUDIOENCODER = 103, ADDON_INSTANCE_GAME = 104, @@ -224,10 +218,6 @@ inline const char* GetTypeVersion(int type) #endif /* addon type instances */ -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_ADSP_USED) - case ADDON_INSTANCE_ADSP: - return ADDON_INSTANCE_VERSION_ADSP; -#endif #if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_AUDIODECODER_USED) case ADDON_INSTANCE_AUDIODECODER: return ADDON_INSTANCE_VERSION_AUDIODECODER; @@ -303,8 +293,6 @@ inline const char* GetTypeMinVersion(int type) return ADDON_GLOBAL_VERSION_NETWORK_MIN; /* addon type instances */ - case ADDON_INSTANCE_ADSP: - return ADDON_INSTANCE_VERSION_ADSP_MIN; case ADDON_INSTANCE_AUDIODECODER: return ADDON_INSTANCE_VERSION_AUDIODECODER_MIN; case ADDON_INSTANCE_AUDIOENCODER: @@ -357,8 +345,6 @@ inline const char* GetTypeName(int type) return "Network"; /* addon type instances */ - case ADDON_INSTANCE_ADSP: - return "ADSP"; case ADDON_INSTANCE_AUDIODECODER: return "AudioDecoder"; case ADDON_INSTANCE_AUDIOENCODER: @@ -408,8 +394,6 @@ inline int GetTypeId(const char* name) return ADDON_GLOBAL_FILESYSTEM; else if (strcmp(name, "network") == 0) return ADDON_GLOBAL_NETWORK; - else if (strcmp(name, "adsp") == 0) - return ADDON_INSTANCE_ADSP; else if (strcmp(name, "audiodecoder") == 0) return ADDON_INSTANCE_AUDIODECODER; else if (strcmp(name, "audioencoder") == 0) diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h index 1ba12bd..c0a900b 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h @@ -1,7 +1,7 @@ #pragma once /* * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org + * 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 @@ -27,11 +27,9 @@ #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 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 25cacb4..d36effa 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 @@ -115,6 +115,16 @@ extern "C" * @remarks Required if add-on supports playing epg tags. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. */ PVR_ERROR IsEPGTagPlayable(const EPG_TAG* tag, bool* bIsPlayable); + + /*! + * Retrieve the edit decision list (EDL) of an EPG tag on the backend. + * @param epgTag The EPG tag. + * @param edl out: The function has to write the EDL list into this array. + * @param size in: The maximum size of the EDL, out: the actual size of the EDL. + * @return PVR_ERROR_NO_ERROR if the EDL was successfully read. + * @remarks Required if bSupportsEpgEdl is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR GetEPGTagEdl(const EPG_TAG* epgTag, PVR_EDL_ENTRY edl[], int *size); /*! * Get the stream properties for an epg tag from the backend. @@ -324,7 +334,7 @@ extern "C" * @return PVR_ERROR_NO_ERROR if the EDL was successfully read. * @remarks Required if bSupportsRecordingEdl is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. */ - PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY edl[], int *size); + PVR_ERROR GetRecordingEdl(const PVR_RECORDING& recording, PVR_EDL_ENTRY edl[], int *size); /*! * Retrieve the timer types supported by the backend. @@ -650,6 +660,7 @@ extern "C" pClient->toAddon.GetEPGForChannel = GetEPGForChannel; pClient->toAddon.IsEPGTagRecordable = IsEPGTagRecordable; pClient->toAddon.IsEPGTagPlayable = IsEPGTagPlayable; + pClient->toAddon.GetEPGTagEdl = GetEPGTagEdl; pClient->toAddon.GetEPGTagStreamProperties = GetEPGTagStreamProperties; pClient->toAddon.GetChannelGroupsAmount = GetChannelGroupsAmount; 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 623cb03..32303d4 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 @@ -50,11 +50,9 @@ struct DemuxPacket; #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 @@ -305,6 +303,7 @@ extern "C" { typedef struct PVR_ADDON_CAPABILITIES { bool bSupportsEPG; /*!< @brief true if the add-on provides EPG information */ + bool bSupportsEPGEdl; /*!< @brief true if the backend supports retrieving an edit decision list for an EPG tag. */ bool bSupportsTV; /*!< @brief true if this add-on provides TV channels */ bool bSupportsRadio; /*!< @brief true if this add-on supports radio channels */ bool bSupportsRecordings; /*!< @brief true if this add-on supports playback of recordings stored on the backend */ @@ -645,6 +644,7 @@ extern "C" { PVR_ERROR (__cdecl* GetEPGForChannel)(ADDON_HANDLE, const PVR_CHANNEL&, time_t, time_t); PVR_ERROR (__cdecl* IsEPGTagRecordable)(const EPG_TAG*, bool*); PVR_ERROR (__cdecl* IsEPGTagPlayable)(const EPG_TAG*, bool*); + PVR_ERROR (__cdecl* GetEPGTagEdl)(const EPG_TAG*, PVR_EDL_ENTRY[], int*); PVR_ERROR (__cdecl* GetEPGTagStreamProperties)(const EPG_TAG*, PVR_NAMED_VALUE*, unsigned int*); int (__cdecl* GetChannelGroupsAmount)(void); PVR_ERROR (__cdecl* GetChannelGroups)(ADDON_HANDLE, bool); diff --git a/xbmc/cores/AudioEngine/Utils/AEChannelData.h b/xbmc/cores/AudioEngine/Utils/AEChannelData.h index c74aabb..6b64f0d 100644 --- a/xbmc/cores/AudioEngine/Utils/AEChannelData.h +++ b/xbmc/cores/AudioEngine/Utils/AEChannelData.h @@ -1,7 +1,7 @@ #pragma once /* * Copyright (C) 2010-2013 Team XBMC - * http://xbmc.org + * 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 diff --git a/xbmc/cores/VideoPlayer/Interface/Addon/DemuxCrypto.h b/xbmc/cores/VideoPlayer/Interface/Addon/DemuxCrypto.h index c77d000..e38e247 100644 --- a/xbmc/cores/VideoPlayer/Interface/Addon/DemuxCrypto.h +++ b/xbmc/cores/VideoPlayer/Interface/Addon/DemuxCrypto.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2005-2016 Team XBMC -* http://xbmc.org +* 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 diff --git a/xbmc/cores/VideoPlayer/Interface/Addon/DemuxPacket.h b/xbmc/cores/VideoPlayer/Interface/Addon/DemuxPacket.h index 2d85ed9..b7404a3 100644 --- a/xbmc/cores/VideoPlayer/Interface/Addon/DemuxPacket.h +++ b/xbmc/cores/VideoPlayer/Interface/Addon/DemuxPacket.h @@ -2,7 +2,7 @@ /* * Copyright (C) 2012-2013 Team XBMC - * http://xbmc.org + * 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 diff --git a/xbmc/cores/VideoPlayer/Interface/Addon/TimingConstants.h b/xbmc/cores/VideoPlayer/Interface/Addon/TimingConstants.h index b70128e..209897e 100644 --- a/xbmc/cores/VideoPlayer/Interface/Addon/TimingConstants.h +++ b/xbmc/cores/VideoPlayer/Interface/Addon/TimingConstants.h @@ -2,7 +2,7 @@ /* * Copyright (C) 2017 Team XBMC -* http://xbmc.org +* 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 diff --git a/xbmc/filesystem/IFileTypes.h b/xbmc/filesystem/IFileTypes.h index a65a178..3962c0c 100644 --- a/xbmc/filesystem/IFileTypes.h +++ b/xbmc/filesystem/IFileTypes.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org + * 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 diff --git a/xbmc/interfaces/json-rpc/schema/version.txt b/xbmc/interfaces/json-rpc/schema/version.txt index 3ab7cb3..35bc503 100644 --- a/xbmc/interfaces/json-rpc/schema/version.txt +++ b/xbmc/interfaces/json-rpc/schema/version.txt @@ -1 +1 @@ -JSONRPC_VERSION 9.1.0 +JSONRPC_VERSION 9.2.0 -- cgit v1.2.3