diff options
216 files changed, 10274 insertions, 253 deletions
diff --git a/project/cmake/CMakeLists.txt b/project/cmake/CMakeLists.txt new file mode 100644 index 0000000..03b3752 --- /dev/null +++ b/project/cmake/CMakeLists.txt | |||
| @@ -0,0 +1,367 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.1) | ||
| 2 | project(kodi) | ||
| 3 | |||
| 4 | list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/modules) | ||
| 5 | if(DEPENDS_DIR) | ||
| 6 | list(APPEND CMAKE_PREFIX_PATH ${DEPENDS_DIR}) | ||
| 7 | endif() | ||
| 8 | |||
| 9 | set(CMAKE_CXX_STANDARD 11) | ||
| 10 | set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| 11 | set(CMAKE_CXX_EXTENSIONS OFF) | ||
| 12 | |||
| 13 | # general | ||
| 14 | option(VERBOSE "Enable verbose output?" OFF) | ||
| 15 | option(ENABLE_DVDCSS "Enable libdvdcss support?" ON) | ||
| 16 | option(ENABLE_UPNP "Enable UPnP support?" ON) | ||
| 17 | option(ENABLE_NONFREE "Enable non-free components?" ON) | ||
| 18 | option(ENABLE_MICROHTTPD "Enable MicroHttpd webserver?" ON) | ||
| 19 | option(ENABLE_MYSQLCLIENT "Enable MySql support?" ON) | ||
| 20 | option(ENABLE_AVAHI "Enable Avahi support?" ON) | ||
| 21 | option(ENABLE_RTMP "Enable RTMP support?" ON) | ||
| 22 | option(ENABLE_BLURAY "Enable BluRay support?" ON) | ||
| 23 | option(ENABLE_PLIST "Enable AirPlay support?" ON) | ||
| 24 | option(ENABLE_NFS "Enable NFS support?" ON) | ||
| 25 | option(ENABLE_AIRTUNES "Enable AirTunes support?" ON) | ||
| 26 | option(ENABLE_CEC "Enable CEC support?" ON) | ||
| 27 | if(UNIX) | ||
| 28 | if(NOT APPLE) | ||
| 29 | option(ENABLE_INTERNAL_FFMPEG "Enable internal ffmpeg?" ON) | ||
| 30 | else() | ||
| 31 | option(ENABLE_VTB "Enable VTB support?" OFF) | ||
| 32 | endif() | ||
| 33 | option(FFMPEG_PATH "Path to external ffmpeg?" "") | ||
| 34 | option(ENABLE_INTERNAL_CROSSGUID "Enable internal crossguid?" ON) | ||
| 35 | option(ENABLE_ALSA "Enable ALSA support?" ON) | ||
| 36 | option(ENABLE_PULSEAUDIO "Enable PulseAudio support?" ON) | ||
| 37 | option(ENABLE_DBUS "Enable dbus support?" ON) | ||
| 38 | option(ENABLE_LIBUSB "Enable libusb support?" ON) | ||
| 39 | option(ENABLE_UDEV "Enable UDev support?" ON) | ||
| 40 | option(ENABLE_OPENGL "Enable OpenGL?" ON) | ||
| 41 | option(ENABLE_OPENGLES "Enable OpenGLES?" ON) | ||
| 42 | option(ENABLE_OPENSSL "Enable OpenSSL?" ON) | ||
| 43 | option(ENABLE_SDL "Enable SDL?" OFF) | ||
| 44 | option(ENABLE_X11 "Enable X11 support?" ON) | ||
| 45 | option(ENABLE_EGL "Enable EGL?" OFF) | ||
| 46 | option(ENABLE_VAAPI "Enable VAAPI support?" ON) | ||
| 47 | option(ENABLE_VDPAU "Enable VDPAU support?" ON) | ||
| 48 | option(ENABLE_OPTICAL "Enable optical support?" ON) | ||
| 49 | endif() | ||
| 50 | # System options | ||
| 51 | if(NOT WIN32) | ||
| 52 | option(WITH_ARCH "build with given arch" OFF) | ||
| 53 | option(WITH_CPU "build with given cpu" OFF) | ||
| 54 | option(ENABLE_CCACHE "Enable Ccache support" ON) | ||
| 55 | endif() | ||
| 56 | |||
| 57 | get_filename_component(CORE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../.. ABSOLUTE) | ||
| 58 | set(CORE_BUILD_DIR build) | ||
| 59 | |||
| 60 | include(scripts/common/generatorsetup.cmake) | ||
| 61 | include(scripts/common/addoptions.cmake) | ||
| 62 | include(scripts/common/archsetup.cmake) | ||
| 63 | include(scripts/common/macros.cmake) | ||
| 64 | include(scripts/common/managestring.cmake) | ||
| 65 | include(scripts/common/projectmacros.cmake) | ||
| 66 | include(scripts/common/pathsetup.cmake) | ||
| 67 | include(ExternalProject) | ||
| 68 | |||
| 69 | core_find_git_rev() | ||
| 70 | core_find_versions() | ||
| 71 | |||
| 72 | set(INCLUDES ${CORE_SOURCE_DIR} | ||
| 73 | ${CORE_SOURCE_DIR}/addons/library.xbmc.addon | ||
| 74 | ${CORE_SOURCE_DIR}/lib | ||
| 75 | ${CORE_SOURCE_DIR}/lib/gtest/include | ||
| 76 | ${CORE_SOURCE_DIR}/xbmc | ||
| 77 | ${CORE_SOURCE_DIR}/xbmc/${PLATFORM_DIR} | ||
| 78 | ${CORE_SOURCE_DIR}/xbmc/cores/VideoPlayer | ||
| 79 | ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}) | ||
| 80 | |||
| 81 | find_package(PkgConfig) | ||
| 82 | if(CMAKE_CROSSCOMPILING) | ||
| 83 | if(PKG_CONFIG_EXECUTABLE) | ||
| 84 | message(STATUS "CMAKE_CROSSCOMPILING: ${CMAKE_CROSSCOMPILING}") | ||
| 85 | set(PKG_CONFIG_FOUND TRUE) | ||
| 86 | endif() | ||
| 87 | endif() | ||
| 88 | |||
| 89 | find_package(Threads REQUIRED) | ||
| 90 | list(APPEND DEPLIBS ${CMAKE_THREAD_LIBS_INIT}) | ||
| 91 | |||
| 92 | # Required dependencies | ||
| 93 | set(required_deps Sqlite3 FreeType PCRE Cpluff LibDvd | ||
| 94 | TinyXML Python Yajl Xslt | ||
| 95 | JPEG Lzo2 Fribidi TagLib FFMPEG CrossGUID) | ||
| 96 | if(NOT WIN32) | ||
| 97 | list(APPEND required_deps LibSmbClient ZLIB) | ||
| 98 | else() | ||
| 99 | list(APPEND required_deps D3DX11Effects) | ||
| 100 | endif() | ||
| 101 | if(CORE_SYSTEM_NAME STREQUAL android) | ||
| 102 | list(APPEND required_deps Zip) | ||
| 103 | endif() | ||
| 104 | |||
| 105 | # Optional dependencies | ||
| 106 | set(optional_deps MicroHttpd MySqlClient SSH | ||
| 107 | Alsa UDev Dbus Avahi | ||
| 108 | PulseAudio VDPAU VAAPI) | ||
| 109 | |||
| 110 | # Required, dyloaded deps | ||
| 111 | set(required_dyload Curl ASS) | ||
| 112 | |||
| 113 | # Optional, dyloaded deps | ||
| 114 | set(dyload_optional RTMP CEC Bluray Plist NFS) | ||
| 115 | |||
| 116 | # Required by shared objects we link | ||
| 117 | set(required_dep_libs PNG EXPAT) | ||
| 118 | |||
| 119 | # Required tools | ||
| 120 | find_package(TexturePacker REQUIRED) | ||
| 121 | find_package(JsonSchemaBuilder REQUIRED) | ||
| 122 | |||
| 123 | foreach(dep ${required_dep_libs}) | ||
| 124 | find_package(${dep} REQUIRED) | ||
| 125 | endforeach() | ||
| 126 | |||
| 127 | foreach(dep ${required_deps}) | ||
| 128 | core_require_dep(${dep}) | ||
| 129 | endforeach() | ||
| 130 | |||
| 131 | foreach(dep ${optional_deps}) | ||
| 132 | core_optional_dep(${dep}) | ||
| 133 | endforeach() | ||
| 134 | |||
| 135 | if(NOT UDEV_FOUND) | ||
| 136 | core_optional_dep(LibUSB) | ||
| 137 | endif() | ||
| 138 | |||
| 139 | foreach(dep ${required_dyload}) | ||
| 140 | core_require_dyload_dep(${dep}) | ||
| 141 | endforeach() | ||
| 142 | |||
| 143 | foreach(dep ${dyload_optional}) | ||
| 144 | core_optional_dyload_dep(${dep}) | ||
| 145 | endforeach() | ||
| 146 | |||
| 147 | if(ENABLE_OPENSSL) | ||
| 148 | core_require_dep(OpenSSL) | ||
| 149 | list(APPEND DEP_DEFINES "-DHAVE_OPENSSL=1") | ||
| 150 | endif() | ||
| 151 | |||
| 152 | if(ENABLE_UPNP) | ||
| 153 | list(APPEND DEP_DEFINES "-DUSE_UPNP=1") | ||
| 154 | endif() | ||
| 155 | |||
| 156 | if(ENABLE_NONFREE) | ||
| 157 | list(APPEND DEP_DEFINES "-DHAVE_XBMC_NONFREE=1") | ||
| 158 | endif() | ||
| 159 | |||
| 160 | if(ENABLE_OPTICAL) | ||
| 161 | list(APPEND DEP_DEFINES -DHAS_DVD_DRIVE) | ||
| 162 | core_require_dep(Cdio) | ||
| 163 | endif() | ||
| 164 | |||
| 165 | if(ENABLE_AIRTUNES) | ||
| 166 | find_package(Shairplay) | ||
| 167 | if(SHAIRPLAY_FOUND) | ||
| 168 | core_require_dyload_dep(Shairplay) | ||
| 169 | endif() | ||
| 170 | endif() | ||
| 171 | |||
| 172 | if(ENABLE_VTB) | ||
| 173 | list(APPEND DEP_DEFINES -DHAVE_VIDEOTOOLBOXDECODER=1) | ||
| 174 | endif() | ||
| 175 | |||
| 176 | if(NOT WIN32) | ||
| 177 | core_optional_dep(OpenGl) | ||
| 178 | if(OPENGL_FOUND) | ||
| 179 | if(NOT APPLE) | ||
| 180 | core_optional_dep(Sdl) | ||
| 181 | else() | ||
| 182 | core_require_dep(Sdl) | ||
| 183 | endif() | ||
| 184 | core_optional_dep(X ENABLE_X11) | ||
| 185 | core_optional_dep(XRandR ENABLE_X11) | ||
| 186 | else() | ||
| 187 | core_optional_dep(OpenGLES ENABLE_OPENGLES) | ||
| 188 | if(OPENGLES_FOUND) | ||
| 189 | core_optional_dep(EGL ENABLE_EGL) | ||
| 190 | core_optional_dep(OMX ENABLE_OMX) | ||
| 191 | core_optional_dep(AML ENABLE_AML) | ||
| 192 | core_optional_dep(X ENABLE_X11) | ||
| 193 | core_optional_dep(Sdl) | ||
| 194 | endif() | ||
| 195 | endif() | ||
| 196 | |||
| 197 | if(CORE_SYSTEM_NAME STREQUAL rbpi) | ||
| 198 | core_require_dep(MMAL) | ||
| 199 | endif() | ||
| 200 | endif() | ||
| 201 | |||
| 202 | if(ENABLE_CCACHE) | ||
| 203 | core_optional_dep(CCache) | ||
| 204 | endif() | ||
| 205 | |||
| 206 | # Compile Info | ||
| 207 | add_custom_command(OUTPUT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp | ||
| 208 | COMMAND ${CMAKE_COMMAND} -DCORE_SOURCE_DIR=${CORE_SOURCE_DIR} | ||
| 209 | -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} | ||
| 210 | -DCORE_BUILD_DIR=${CORE_BUILD_DIR} | ||
| 211 | -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR} | ||
| 212 | -DARCH_DEFINES="${ARCH_DEFINES}" | ||
| 213 | -DAPP_SCMID=${APP_SCMID} | ||
| 214 | -Dprefix=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} | ||
| 215 | -P ${PROJECT_SOURCE_DIR}/scripts/common/generateversionedfiles.cmake | ||
| 216 | DEPENDS ${CORE_SOURCE_DIR}/version.txt | ||
| 217 | ${CORE_SOURCE_DIR}/addons/xbmc.addon/addon.xml.in | ||
| 218 | ${CORE_SOURCE_DIR}/addons/kodi.guilib/addon.xml.in | ||
| 219 | ${CORE_SOURCE_DIR}/xbmc/CompileInfo.cpp.in) | ||
| 220 | list(APPEND install_data addons/xbmc.addon/addon.xml) | ||
| 221 | add_library(compileinfo OBJECT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp) | ||
| 222 | target_compile_options(compileinfo PRIVATE "${SYSTEM_DEFINES}") | ||
| 223 | |||
| 224 | # RC File | ||
| 225 | if(WIN32) | ||
| 226 | configure_file(${CORE_SOURCE_DIR}/xbmc/win32/XBMC_PC.rc.in | ||
| 227 | ${CORE_BUILD_DIR}/xbmc/win32/XBMC_PC.rc @ONLY) | ||
| 228 | add_library(resources OBJECT ${CORE_BUILD_DIR}/xbmc/win32/XBMC_PC.rc) | ||
| 229 | target_include_directories(resources PRIVATE ${CORE_SOURCE_DIR}/tools/windows/packaging/media) | ||
| 230 | set(RESOURCES $<TARGET_OBJECTS:resources>) | ||
| 231 | endif() | ||
| 232 | |||
| 233 | include_directories(${INCLUDES} ${SYSTEM_INCLUDES}) | ||
| 234 | add_compile_options(${ARCH_DEFINES} "${SYSTEM_DEFINES}" ${DEP_DEFINES} ${PATH_DEFINES}) | ||
| 235 | |||
| 236 | set(core_DEPENDS "" CACHE STRING "" FORCE) | ||
| 237 | set(test_archives "" CACHE STRING "" FORCE) | ||
| 238 | set(test_sources "" CACHE STRING "" FORCE) | ||
| 239 | mark_as_advanced(core_DEPENDS) | ||
| 240 | mark_as_advanced(test_archives) | ||
| 241 | mark_as_advanced(test_sources) | ||
| 242 | |||
| 243 | file(STRINGS ${PROJECT_SOURCE_DIR}/installdata/addon-bindings.txt bindings) | ||
| 244 | foreach(binding ${bindings}) | ||
| 245 | list(APPEND addon_bindings ${CORE_SOURCE_DIR}/${binding}) | ||
| 246 | endforeach() | ||
| 247 | |||
| 248 | add_subdirectory(${CORE_SOURCE_DIR}/lib/gtest ${CORE_BUILD_DIR}/gtest EXCLUDE_FROM_ALL) | ||
| 249 | |||
| 250 | # Subdirs | ||
| 251 | core_add_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/common/*.txt | ||
| 252 | ${PROJECT_SOURCE_DIR}/treedata/${CORE_SYSTEM_NAME}/*.txt) | ||
| 253 | core_add_optional_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/optional/common/*.txt | ||
| 254 | ${PROJECT_SOURCE_DIR}/treedata/optional/${CORE_SYSTEM_NAME}/*.txt) | ||
| 255 | |||
| 256 | # copy files to build tree | ||
| 257 | copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/common/*.txt | ||
| 258 | ${PROJECT_SOURCE_DIR}/installdata/${CORE_SYSTEM_NAME}/*.txt) | ||
| 259 | |||
| 260 | list(APPEND SKINS "${CORE_SOURCE_DIR}/addons/skin.estuary\;${CORE_SOURCE_DIR}") | ||
| 261 | list(APPEND SKINS "${CORE_SOURCE_DIR}/addons/skin.estouchy\;${CORE_SOURCE_DIR}") | ||
| 262 | |||
| 263 | # These are skins that are copied into place from the source tree | ||
| 264 | foreach(skin ${SKINS}) | ||
| 265 | list(GET skin 0 dir) | ||
| 266 | list(GET skin 1 relative) | ||
| 267 | copy_skin_to_buildtree(${dir} ${relative}) | ||
| 268 | endforeach() | ||
| 269 | |||
| 270 | add_custom_target(pack-skins ALL | ||
| 271 | DEPENDS TexturePacker::TexturePacker export-files ${XBT_FILES}) | ||
| 272 | |||
| 273 | core_link_library(exif system/libexif) | ||
| 274 | if(CORE_SYSTEM_NAME STREQUAL linux) | ||
| 275 | core_link_library(sse4 system/libsse4) | ||
| 276 | endif() | ||
| 277 | |||
| 278 | core_link_library(XBMC_addon addons/library.xbmc.addon/libXBMC_addon) | ||
| 279 | core_link_library(XBMC_codec addons/library.xbmc.codec/libXBMC_codec) | ||
| 280 | core_link_library(KODI_guilib addons/library.kodi.guilib/libKODI_guilib) | ||
| 281 | core_link_library(KODI_adsp addons/library.kodi.adsp/libKODI_adsp) | ||
| 282 | core_link_library(XBMC_pvr addons/library.xbmc.pvr/libXBMC_pvr) | ||
| 283 | |||
| 284 | file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/system/players/VideoPlayer) | ||
| 285 | add_custom_target(wrap-libraries ALL DEPENDS ${WRAP_FILES}) | ||
| 286 | |||
| 287 | set(LIBCEC_SONAME "${CEC_SONAME}") | ||
| 288 | if(NOT CORE_SYSTEM_NAME STREQUAL windows AND NOT CORE_SYSTEM_NAME STREQUAL android) | ||
| 289 | configure_file(${CORE_SOURCE_DIR}/xbmc/DllPaths_generated.h.in | ||
| 290 | ${CORE_BUILD_DIR}/DllPaths_generated.h @ONLY) | ||
| 291 | elseif(CORE_SYSTEM_NAME STREQUAL android) | ||
| 292 | configure_file(${CORE_SOURCE_DIR}/xbmc/DllPaths_generated_android.h.in | ||
| 293 | ${CORE_BUILD_DIR}/DllPaths_generated_android.h @ONLY) | ||
| 294 | endif() | ||
| 295 | |||
| 296 | # Codegen | ||
| 297 | add_subdirectory(${CORE_SOURCE_DIR}/xbmc/interfaces/swig build/swig) | ||
| 298 | |||
| 299 | # Other files (IDE) | ||
| 300 | set(OTHER_FILES README.md) | ||
| 301 | |||
| 302 | # main binary | ||
| 303 | add_executable(${APP_NAME_LC} ${CORE_MAIN_SOURCE} $<TARGET_OBJECTS:compileinfo> "${RESOURCES}" ${OTHER_FILES}) | ||
| 304 | whole_archive(_MAIN_LIBRARIES ${core_DEPENDS}) | ||
| 305 | target_link_libraries(${APP_NAME_LC} ${SYSTEM_LDFLAGS} ${_MAIN_LIBRARIES} ${DEPLIBS} ${CMAKE_DL_LIBS}) | ||
| 306 | unset(_MAIN_LIBRARIES) | ||
| 307 | add_dependencies(${APP_NAME_LC} export-files) | ||
| 308 | if(NOT WIN32) | ||
| 309 | set_target_properties(${APP_NAME_LC} PROPERTIES SUFFIX ".bin") | ||
| 310 | else() | ||
| 311 | set_target_properties(${APP_NAME_LC} PROPERTIES WIN32_EXECUTABLE ON) | ||
| 312 | copy_main_dlls_to_buildtree() | ||
| 313 | endif() | ||
| 314 | |||
| 315 | # testing | ||
| 316 | copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/test-reference-data.txt 1) | ||
| 317 | add_executable(${APP_NAME_LC}-test EXCLUDE_FROM_ALL ${CORE_SOURCE_DIR}/xbmc/test/xbmc-test.cpp $<TARGET_OBJECTS:compileinfo>) | ||
| 318 | whole_archive(_TEST_LIBRARIES ${core_DEPENDS} gtest ${test_archives}) | ||
| 319 | target_link_libraries(${APP_NAME_LC}-test ${SYSTEM_LDFLAGS} ${_TEST_LIBRARIES} ${DEPLIBS} ${CMAKE_DL_LIBS}) | ||
| 320 | unset(_TEST_LIBRARIES) | ||
| 321 | add_dependencies(${APP_NAME_LC}-test export-files) | ||
| 322 | |||
| 323 | # make test and make check (cannot be executed when cross compiling) | ||
| 324 | if(NOT CMAKE_CROSSCOMPILING) | ||
| 325 | enable_testing() | ||
| 326 | gtest_add_tests(${APP_NAME_LC}-test "" ${test_sources}) | ||
| 327 | add_custom_target(check ${CMAKE_CTEST_COMMAND} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) | ||
| 328 | add_dependencies(check ${APP_NAME_LC}-test) | ||
| 329 | |||
| 330 | # For testing commit series | ||
| 331 | add_custom_target(check-commits ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/scripts/common/checkcommits.cmake | ||
| 332 | -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}) | ||
| 333 | endif() | ||
| 334 | |||
| 335 | # link wrapper | ||
| 336 | if(FFMPEG_LINK_EXECUTABLE) | ||
| 337 | set(CMAKE_CXX_LINK_EXECUTABLE "${FFMPEG_LINK_EXECUTABLE}") | ||
| 338 | endif() | ||
| 339 | |||
| 340 | # randr | ||
| 341 | if(ENABLE_X11 AND XRANDR_FOUND) | ||
| 342 | add_executable(kodi-xrandr ${CORE_SOURCE_DIR}/xbmc-xrandr.c) | ||
| 343 | target_link_libraries(kodi-xrandr ${SYSTEM_LDFLAGS} ${X_LIBRARIES} m ${XRANDR_LIBRARIES}) | ||
| 344 | endif() | ||
| 345 | |||
| 346 | # XBMCHelper | ||
| 347 | if(CORE_SYSTEM_TYPE STREQUAL darwin) | ||
| 348 | add_subdirectory(${CORE_SOURCE_DIR}/tools/EventClients/Clients/OSXRemote build/XBMCHelper) | ||
| 349 | endif() | ||
| 350 | |||
| 351 | include(scripts/${CORE_SYSTEM_NAME}/install.cmake) | ||
| 352 | |||
| 353 | # Status | ||
| 354 | message(STATUS "#---- CONFIGURATION ----#") | ||
| 355 | foreach(msg ${final_message}) | ||
| 356 | message(STATUS ${msg}) | ||
| 357 | endforeach() | ||
| 358 | |||
| 359 | if(VERBOSE) | ||
| 360 | message(STATUS "\n#---- Internal Variables ----# ") | ||
| 361 | message(STATUS "DEPLIBS: ${DEPLIBS}") | ||
| 362 | message(STATUS "SYSTEM_LDFLAGS: ${SYSTEM_LDFLAGS}") | ||
| 363 | message(STATUS "core_DEPENDS: ${core_DEPENDS}") | ||
| 364 | message(STATUS "CMAKE_DL_LIBS: ${CMAKE_DL_LIBS}") | ||
| 365 | endif() | ||
| 366 | message(STATUS "#-----------------------#") | ||
| 367 | |||
diff --git a/project/cmake/README.md b/project/cmake/README.md new file mode 100644 index 0000000..c0f94d8 --- /dev/null +++ b/project/cmake/README.md | |||
| @@ -0,0 +1,166 @@ | |||
| 1 | # Kodi CMake based buildsystem | ||
| 2 | |||
| 3 | This files describes Kodi's CMake based buildsystem. CMake is a cross-platform | ||
| 4 | tool for generating makefiles as well as project files used by IDEs. | ||
| 5 | |||
| 6 | The current version of the buildsystem is capable of building the main Kodi | ||
| 7 | executable (but no packaging or dependency management yet) for the following | ||
| 8 | platforms: | ||
| 9 | |||
| 10 | - Linux (GNU Makefiles) | ||
| 11 | - Windows (NMake Makefiles, Visual Studio 12 (2013)) | ||
| 12 | - OSX (GNU Makefiles, Xcode) | ||
| 13 | - Android (GNU Makefiles) | ||
| 14 | |||
| 15 | Before building Kodi with CMake, please ensure that you have the platform | ||
| 16 | specific dependencies installed. | ||
| 17 | |||
| 18 | While the legacy build systems typically used in-source builds it's recommended | ||
| 19 | to use out-of-source builds with CMake. The necessary runtime dependencies such | ||
| 20 | as dlls, skins and configuration files are copied over to the build directory | ||
| 21 | automatically. | ||
| 22 | |||
| 23 | ## Dependency installation | ||
| 24 | |||
| 25 | ### Linux | ||
| 26 | |||
| 27 | The dependencies required to build on Linux can be found in | ||
| 28 | [docs/README.xxx](https://github.com/xbmc/xbmc/tree/master/docs). | ||
| 29 | |||
| 30 | ### Raspberry Pi | ||
| 31 | |||
| 32 | The cross compilation environment for the Raspberry Pi as well as the | ||
| 33 | dependencies have to be installed as explained in | ||
| 34 | [docs/README.raspberrypi](https://github.com/xbmc/xbmc/tree/master/docs/README.raspberrypi). | ||
| 35 | |||
| 36 | ### Windows | ||
| 37 | |||
| 38 | For Windows the dependencies can be found in the | ||
| 39 | [Wiki](http://kodi.wiki/view/HOW-TO:Compile_Kodi_for_Windows) (Step 1-4). If not already available on your pc, you should | ||
| 40 | 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). | ||
| 41 | |||
| 42 | On Windows, the CMake based buildsystem requires that the binary dependencies | ||
| 43 | are downloaded using `DownloadBuildDeps.bat` and `DownloadMingwBuildEnv.bat` | ||
| 44 | and that the mingw libs (ffmpeg, libdvd and others) are built using | ||
| 45 | `make-mingwlibs.bat`. | ||
| 46 | |||
| 47 | ### OSX | ||
| 48 | |||
| 49 | For OSX the required dependencies can be found in | ||
| 50 | [docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.osx). | ||
| 51 | |||
| 52 | On OSX it is necessary to build the dependencies in `tools/depends` using | ||
| 53 | `./bootstrap && ./configure --host=<PLATFORM> && make`. The other steps such | ||
| 54 | as `make -C tools/depends/target/xbmc` and `make xcode_depends` are not needed | ||
| 55 | as these steps are covered already by the CMake project. | ||
| 56 | |||
| 57 | ### Android | ||
| 58 | |||
| 59 | The dependencies needed to compile for Android can be found in | ||
| 60 | [docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.android) | ||
| 61 | . All described steps have to be executed (except 5.2 which is replaced by the | ||
| 62 | respective CMake command below). | ||
| 63 | |||
| 64 | ## Building Kodi | ||
| 65 | |||
| 66 | This section lists the necessary commands for building Kodi with CMake. | ||
| 67 | CMake supports different generators that can be classified into two categories: | ||
| 68 | single- and multiconfiguration generators. | ||
| 69 | |||
| 70 | A single configuration generator (GNU/NMake Makefiles) generates project files | ||
| 71 | for a single build type (e.g. Debug, Release) specified at configure time. | ||
| 72 | Multi configuration generators (Visual Studio, Xcode) allow to specify the | ||
| 73 | build type at compile time. | ||
| 74 | |||
| 75 | All examples below are for out-of-source builds with Kodi checked out to | ||
| 76 | `<KODI_SRC>`: | ||
| 77 | |||
| 78 | ``` | ||
| 79 | mkdir kodi-build && cd kodi-build | ||
| 80 | ``` | ||
| 81 | |||
| 82 | ### Linux with GNU Makefiles | ||
| 83 | |||
| 84 | ``` | ||
| 85 | cmake <KODI_SRC>/project/cmake/ | ||
| 86 | cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) | ||
| 87 | ./kodi.bin | ||
| 88 | ``` | ||
| 89 | |||
| 90 | `CMAKE_BUILD_TYPE` defaults to `Release`. | ||
| 91 | |||
| 92 | ### Raspberry Pi with GNU Makefiles | ||
| 93 | |||
| 94 | ``` | ||
| 95 | cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/ | ||
| 96 | cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) | ||
| 97 | ``` | ||
| 98 | |||
| 99 | ### Windows with NMake Makefiles | ||
| 100 | |||
| 101 | ``` | ||
| 102 | cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release <KODI_SRC>/project/cmake/ | ||
| 103 | cmake --build . # or: nmake | ||
| 104 | kodi.exe | ||
| 105 | ``` | ||
| 106 | |||
| 107 | ### Windows with Visual Studio project files | ||
| 108 | |||
| 109 | ``` | ||
| 110 | cmake -G "Visual Studio 12" <KODI_SRC>/project/cmake/ | ||
| 111 | cmake --build . --config "Debug" # or: Build solution with Visual Studio | ||
| 112 | set KODI_HOME="%CD%" && Debug\kodi.exe | ||
| 113 | ``` | ||
| 114 | |||
| 115 | ### OSX with GNU Makefiles | ||
| 116 | |||
| 117 | ``` | ||
| 118 | cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/ | ||
| 119 | cmake --build . -- VERBOSE=1 -j$(sysctl -n hw.ncpu) # or: make VERBOSE=1 -j$(sysctl -n hw.ncpu) | ||
| 120 | ./kodi.bin | ||
| 121 | ``` | ||
| 122 | |||
| 123 | ### OSX with Xcode project files | ||
| 124 | |||
| 125 | ``` | ||
| 126 | cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake -G "Xcode" <KODI_SRC>/project/cmake/ | ||
| 127 | cmake --build . --config "Release" -- -verbose -jobs $(sysctl -n hw.ncpu) # or: Build solution with Xcode | ||
| 128 | KODI_HOME=$(pwd) ./Release/kodi.bin | ||
| 129 | ``` | ||
| 130 | |||
| 131 | ### Android with GNU Makefiles | ||
| 132 | |||
| 133 | ``` | ||
| 134 | cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/ | ||
| 135 | cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) | ||
| 136 | ``` | ||
| 137 | |||
| 138 | ## Extra targets | ||
| 139 | |||
| 140 | When using the makefile builds a few extra targets are defined: | ||
| 141 | |||
| 142 | - `make check` builds and executes the test suite. | ||
| 143 | |||
| 144 | ## Debugging the build | ||
| 145 | |||
| 146 | This section covers some tips that can be useful for debugging a CMake | ||
| 147 | based build. | ||
| 148 | |||
| 149 | ### Verbosity (show compiler and linker parameters) | ||
| 150 | |||
| 151 | In order to see the exact compiler commands `make` and `nmake` can be | ||
| 152 | executed with a `VERBOSE=1` parameter. | ||
| 153 | |||
| 154 | On Windows, this is unfortunately not enough because `nmake` uses | ||
| 155 | temporary files to workaround `nmake`'s command string length limitations. | ||
| 156 | In order to see verbose output the file | ||
| 157 | [Modules/Platform/Windows.cmake](https://github.com/Kitware/CMake/blob/master/Modules/Platform/Windows.cmake#L40) | ||
| 158 | in the local CMake installation has to be adapted by uncommenting these | ||
| 159 | lines: | ||
| 160 | |||
| 161 | ``` | ||
| 162 | # uncomment these out to debug nmake and borland makefiles | ||
| 163 | #set(CMAKE_START_TEMP_FILE "") | ||
| 164 | #set(CMAKE_END_TEMP_FILE "") | ||
| 165 | #set(CMAKE_VERBOSE_MAKEFILE 1) | ||
| 166 | ``` | ||
diff --git a/project/cmake/addons/CMakeLists.txt b/project/cmake/addons/CMakeLists.txt index 0773713..8fc1a23 100644 --- a/project/cmake/addons/CMakeLists.txt +++ b/project/cmake/addons/CMakeLists.txt | |||
| @@ -1,15 +1,31 @@ | |||
| 1 | project(kodi-addons) | 1 | project(kodi-addons) |
| 2 | 2 | ||
| 3 | cmake_minimum_required(VERSION 2.8) | 3 | if(WIN32) |
| 4 | # there seems to be a bug in the CMake generator implementation in CMake 2.8.x releases for WIN32 | ||
| 5 | cmake_minimum_required(VERSION 3.0) | ||
| 6 | else() | ||
| 7 | cmake_minimum_required(VERSION 2.8) | ||
| 8 | endif() | ||
| 4 | 9 | ||
| 5 | list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) | 10 | list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) |
| 6 | 11 | ||
| 12 | option(ADDON_TARBALL_CACHING "Cache downloaded addon source tarballs?" ON) | ||
| 13 | if(ADDON_TARBALL_CACHING) | ||
| 14 | message(STATUS "Addon source tarball caching is enabled") | ||
| 15 | else() | ||
| 16 | message(STATUS "Addon source tarball caching is disabled") | ||
| 17 | endif() | ||
| 18 | |||
| 7 | if(NOT CMAKE_BUILD_TYPE) | 19 | if(NOT CMAKE_BUILD_TYPE) |
| 8 | set(CMAKE_BUILD_TYPE Release) | 20 | set(CMAKE_BUILD_TYPE Release) |
| 9 | endif() | 21 | endif() |
| 10 | 22 | ||
| 11 | if(NOT CORE_SYSTEM_NAME) | 23 | if(NOT CORE_SYSTEM_NAME) |
| 12 | string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) | 24 | if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") |
| 25 | set(CORE_SYSTEM_NAME "osx") | ||
| 26 | else() | ||
| 27 | string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) | ||
| 28 | endif() | ||
| 13 | endif() | 29 | endif() |
| 14 | 30 | ||
| 15 | include(ExternalProject) | 31 | include(ExternalProject) |
| @@ -65,6 +81,7 @@ list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) | |||
| 65 | set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} | 81 | set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} |
| 66 | -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> | 82 | -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> |
| 67 | -DPACKAGE_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig | 83 | -DPACKAGE_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig |
| 84 | -DDEPENDS_PATH=${DEPENDS_PATH} | ||
| 68 | -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | 85 | -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} |
| 69 | -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE} | 86 | -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE} |
| 70 | -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX} | 87 | -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX} |
| @@ -78,16 +95,26 @@ if(MSVC) | |||
| 78 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) | 95 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) |
| 79 | endif() | 96 | endif() |
| 80 | 97 | ||
| 98 | option(PACKAGE_ZIP "Prepare built addons for packaging" OFF) | ||
| 81 | if(PACKAGE_ZIP) | 99 | if(PACKAGE_ZIP) |
| 82 | # needed for project installing | 100 | # needed for project installing |
| 83 | list(APPEND BUILD_ARGS -DPACKAGE_ZIP=1) | 101 | list(APPEND BUILD_ARGS -DPACKAGE_ZIP=ON) |
| 84 | MESSAGE("package zip specified") | 102 | |
| 103 | # figure out where to store the packaged ZIP archives | ||
| 104 | if(NOT PACKAGE_DIR) | ||
| 105 | set(PACKAGE_DIR "${BUILD_DIR}/zips") | ||
| 106 | else() | ||
| 107 | file(TO_CMAKE_PATH "${PACKAGE_DIR}" PACKAGE_DIR) | ||
| 108 | endif() | ||
| 109 | list(APPEND BUILD_ARGS -DPACKAGE_DIR=${PACKAGE_DIR}) | ||
| 110 | |||
| 111 | MESSAGE(STATUS "ZIP packaging enabled (destination: ${PACKAGE_DIR})") | ||
| 85 | endif() | 112 | endif() |
| 86 | 113 | ||
| 87 | if(CMAKE_TOOLCHAIN_FILE) | 114 | if(CMAKE_TOOLCHAIN_FILE) |
| 88 | list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) | 115 | list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) |
| 89 | MESSAGE("toolchain specified") | 116 | MESSAGE(STATUS "Toolchain specified") |
| 90 | MESSAGE(${BUILD_ARGS}) | 117 | MESSAGE(STATUS ${BUILD_ARGS}) |
| 91 | endif() | 118 | endif() |
| 92 | 119 | ||
| 93 | if(NOT ADDONS_TO_BUILD) | 120 | if(NOT ADDONS_TO_BUILD) |
| @@ -97,16 +124,25 @@ else() | |||
| 97 | separate_arguments(ADDONS_TO_BUILD) | 124 | separate_arguments(ADDONS_TO_BUILD) |
| 98 | endif() | 125 | endif() |
| 99 | 126 | ||
| 127 | if(NOT ADDONS_DEFINITION_DIR) | ||
| 128 | set(ADDONS_DEFINITION_DIR ${PROJECT_SOURCE_DIR}/addons) | ||
| 129 | else() | ||
| 130 | file(TO_CMAKE_PATH "${ADDONS_DEFINITION_DIR}" ADDONS_DEFINITION_DIR) | ||
| 131 | endif() | ||
| 132 | get_filename_component(ADDONS_DEFINITION_DIR "${ADDONS_DEFINITION_DIR}" ABSOLUTE) | ||
| 133 | |||
| 100 | if(ADDON_SRC_PREFIX) | 134 | if(ADDON_SRC_PREFIX) |
| 101 | message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}") | 135 | message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}") |
| 102 | endif() | 136 | endif() |
| 103 | 137 | ||
| 104 | if(NOT KODI_LIB_DIR) | 138 | if(NOT APP_LIB_DIR) |
| 105 | set(KODI_LIB_DIR "${DEPENDS_PATH}/lib/kodi") | 139 | set(APP_LIB_DIR "${DEPENDS_PATH}/lib/kodi") |
| 106 | else() | 140 | else() |
| 107 | file(TO_CMAKE_PATH "${KODI_LIB_DIR}" KODI_LIB_DIR) | 141 | file(TO_CMAKE_PATH "${APP_LIB_DIR}" APP_LIB_DIR) |
| 108 | endif() | 142 | endif() |
| 109 | 143 | ||
| 144 | set(APP_PREFIX "${CMAKE_INSTALL_PREFIX}") | ||
| 145 | |||
| 110 | # check for platform specific stuff | 146 | # check for platform specific stuff |
| 111 | if(EXISTS ${PLATFORM_DIR}/defines.txt) | 147 | if(EXISTS ${PLATFORM_DIR}/defines.txt) |
| 112 | file(STRINGS ${PLATFORM_DIR}/defines.txt platformdefines) | 148 | file(STRINGS ${PLATFORM_DIR}/defines.txt platformdefines) |
| @@ -119,21 +155,23 @@ endif() | |||
| 119 | # include check_target_platform() function | 155 | # include check_target_platform() function |
| 120 | include(${APP_ROOT}/project/cmake/scripts/common/check_target_platform.cmake) | 156 | include(${APP_ROOT}/project/cmake/scripts/common/check_target_platform.cmake) |
| 121 | 157 | ||
| 122 | # check install permissions | ||
| 123 | set(ADDON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) | 158 | set(ADDON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) |
| 124 | check_install_permissions(${CMAKE_INSTALL_PREFIX} can_write) | 159 | if(NOT WIN32) |
| 125 | if(NOT ${can_write} AND NOT WIN32) | 160 | # check install permissions |
| 126 | set(NEED_SUDO TRUE) | 161 | check_install_permissions(${CMAKE_INSTALL_PREFIX} can_write) |
| 127 | set(ADDON_INSTALL_DIR ${CMAKE_BINARY_DIR}/.install) | 162 | if(NOT ${can_write} AND CMAKE_SYSTEM_NAME STREQUAL "Linux") |
| 128 | message(STATUS "NEED_SUDO: ${NEED_SUDO}") | 163 | set(NEED_SUDO TRUE) |
| 164 | set(ADDON_INSTALL_DIR ${CMAKE_BINARY_DIR}/.install) | ||
| 165 | message(STATUS "NEED_SUDO: ${NEED_SUDO}") | ||
| 166 | endif() | ||
| 129 | endif() | 167 | endif() |
| 130 | 168 | ||
| 131 | ### prepare the build environment for the binary addons | 169 | ### prepare the build environment for the binary addons |
| 132 | # copy the prepare-env.cmake script to the depends path so that we can include it | 170 | # copy the prepare-env.cmake script to the depends path so that we can include it |
| 133 | file(COPY ${APP_ROOT}/project/cmake/scripts/common/prepare-env.cmake DESTINATION ${KODI_LIB_DIR}) | 171 | file(COPY ${APP_ROOT}/project/cmake/scripts/common/prepare-env.cmake DESTINATION ${APP_LIB_DIR}) |
| 134 | 172 | ||
| 135 | # add the location of prepare-env.cmake to CMAKE_MODULE_PATH so that it is found | 173 | # add the location of prepare-env.cmake to CMAKE_MODULE_PATH so that it is found |
| 136 | list(APPEND CMAKE_MODULE_PATH ${KODI_LIB_DIR}) | 174 | list(APPEND CMAKE_MODULE_PATH ${APP_LIB_DIR}) |
| 137 | 175 | ||
| 138 | # include prepare-env.cmake which contains the logic to install the addon header bindings etc | 176 | # include prepare-env.cmake which contains the logic to install the addon header bindings etc |
| 139 | include(prepare-env) | 177 | include(prepare-env) |
| @@ -141,17 +179,61 @@ include(prepare-env) | |||
| 141 | ### add the depends subdirectory for any general dependencies | 179 | ### add the depends subdirectory for any general dependencies |
| 142 | add_subdirectory(depends) | 180 | add_subdirectory(depends) |
| 143 | 181 | ||
| 182 | # add a custom target "package-addons" which will package and install all addons | ||
| 183 | add_custom_target(package-addons) | ||
| 184 | |||
| 144 | ### get and build all the binary addons | 185 | ### get and build all the binary addons |
| 145 | # look for all the addons to be built | 186 | # look for all the addons to be built |
| 146 | file(GLOB_RECURSE addons ${PROJECT_SOURCE_DIR}/addons/*.txt) | 187 | file(GLOB_RECURSE addons ${ADDONS_DEFINITION_DIR}/*.txt) |
| 188 | |||
| 189 | #if there are no addons assume that bootstrapping hasn't happened yet | ||
| 190 | if(NOT addons) | ||
| 191 | message(STATUS "Bootstrapping all default repositories as no addons were found...") | ||
| 192 | set(BOOTSTRAP_BUILD_DIR "${BUILD_DIR}/bootstrap") | ||
| 193 | |||
| 194 | # make sure that the bootstraps build addon exists | ||
| 195 | if(NOT EXISTS ${BOOTSTRAP_BUILD_DIR}) | ||
| 196 | file(MAKE_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) | ||
| 197 | endif() | ||
| 198 | |||
| 199 | # generate the bootstrap buildsystem | ||
| 200 | execute_process(COMMAND ${CMAKE_COMMAND} ${PROJECT_SOURCE_DIR}/bootstrap | ||
| 201 | -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
| 202 | -DCMAKE_INSTALL_PREFIX:PATH=${ADDONS_DEFINITION_DIR} | ||
| 203 | -DBUILD_DIR:PATH=${BOOTSTRAP_BUILD_DIR} | ||
| 204 | -DADDONS_TO_BUILD=${ADDONS_TO_BUILD} | ||
| 205 | WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) | ||
| 206 | |||
| 207 | # execute the generated bootstrap buildsystem | ||
| 208 | execute_process(COMMAND ${CMAKE_COMMAND} --build ${BOOTSTRAP_BUILD_DIR} | ||
| 209 | WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) | ||
| 210 | |||
| 211 | # now look for all the addons to be built again | ||
| 212 | file(GLOB_RECURSE addons ${ADDONS_DEFINITION_DIR}/*.txt) | ||
| 213 | |||
| 214 | if(NOT addons) | ||
| 215 | message(FATAL_ERROR "No addons available to be built") | ||
| 216 | endif() | ||
| 217 | endif() | ||
| 218 | |||
| 147 | foreach(addon ${addons}) | 219 | foreach(addon ${addons}) |
| 148 | if(NOT (addon MATCHES platforms.txt)) | 220 | if(NOT (addon MATCHES platforms.txt)) |
| 149 | file(STRINGS ${addon} def) | 221 | file(STRINGS ${addon} def) |
| 150 | separate_arguments(def) | 222 | separate_arguments(def) |
| 151 | list(GET def 0 id) | 223 | list(GET def 0 id) |
| 152 | 224 | ||
| 225 | set(ADDON_FOUND FALSE) | ||
| 226 | # try to find a perfect match | ||
| 153 | list(FIND ADDONS_TO_BUILD ${id} idx) | 227 | list(FIND ADDONS_TO_BUILD ${id} idx) |
| 154 | if(idx GREATER -1 OR ADDONS_TO_BUILD STREQUAL "all") | 228 | if(idx GREATER -1 OR "${ADDONS_TO_BUILD}" STREQUAL "all") |
| 229 | set(ADDON_FOUND TRUE) | ||
| 230 | # Maybe we have a regex | ||
| 231 | elseif(id MATCHES "${ADDONS_TO_BUILD}") | ||
| 232 | message(STATUS "Pattern ${ADDONS_TO_BUILD} matches ${id}, building addon") | ||
| 233 | set(ADDON_FOUND TRUE) | ||
| 234 | endif() | ||
| 235 | |||
| 236 | if(ADDON_FOUND) | ||
| 155 | get_filename_component(dir ${addon} PATH) | 237 | get_filename_component(dir ${addon} PATH) |
| 156 | 238 | ||
| 157 | # check if the addon has a platforms.txt | 239 | # check if the addon has a platforms.txt |
| @@ -180,6 +262,19 @@ foreach(addon ${addons}) | |||
| 180 | if(deflength GREATER 2 AND "${SOURCE_DIR}" STREQUAL "") | 262 | if(deflength GREATER 2 AND "${SOURCE_DIR}" STREQUAL "") |
| 181 | list(GET def 2 revision) | 263 | list(GET def 2 revision) |
| 182 | 264 | ||
| 265 | # we need access to a git executable | ||
| 266 | find_package(Git REQUIRED) | ||
| 267 | |||
| 268 | # resolve revision to git hash | ||
| 269 | execute_process(COMMAND ${GIT_EXECUTABLE} ls-remote ${url} ${revision} OUTPUT_VARIABLE revision_hash) | ||
| 270 | # git ls-remote only works on branches and tag names but not on revisions | ||
| 271 | if(NOT "${revision_hash}" STREQUAL "") | ||
| 272 | string(REPLACE "\t" ";" revision_list ${revision_hash}) | ||
| 273 | list(GET revision_list 0 revision_hash) | ||
| 274 | message(STATUS "${id}: git branch/tag ${revision} resolved to hash: ${revision_hash}") | ||
| 275 | set(revision ${revision_hash}) | ||
| 276 | endif() | ||
| 277 | |||
| 183 | # Note: downloading specific revisions via http in the format below is probably github specific | 278 | # Note: downloading specific revisions via http in the format below is probably github specific |
| 184 | # if we ever use other repositories, this might need adapting | 279 | # if we ever use other repositories, this might need adapting |
| 185 | set(url ${url}/archive/${revision}.tar.gz) | 280 | set(url ${url}/archive/${revision}.tar.gz) |
| @@ -210,7 +305,7 @@ foreach(addon ${addons}) | |||
| 210 | # download the addon if necessary | 305 | # download the addon if necessary |
| 211 | if(NOT "${archive_name}" STREQUAL "") | 306 | if(NOT "${archive_name}" STREQUAL "") |
| 212 | # download and extract the addon | 307 | # download and extract the addon |
| 213 | if(NOT EXISTS ${BUILD_DIR}/download/${archive_name}.tar.gz) | 308 | if(NOT ADDON_TARBALL_CACHING OR NOT EXISTS ${BUILD_DIR}/download/${archive_name}.tar.gz) |
| 214 | # cleanup any of the previously downloaded archives of this addon | 309 | # cleanup any of the previously downloaded archives of this addon |
| 215 | file(GLOB archives "${BUILD_DIR}/download/${id}*.tar.gz") | 310 | file(GLOB archives "${BUILD_DIR}/download/${id}*.tar.gz") |
| 216 | if(archives) | 311 | if(archives) |
| @@ -275,6 +370,25 @@ foreach(addon ${addons}) | |||
| 275 | add_dependencies(${id} ${${id}_DEPS}) | 370 | add_dependencies(${id} ${${id}_DEPS}) |
| 276 | endif() | 371 | endif() |
| 277 | endif() | 372 | endif() |
| 373 | |||
| 374 | if(CROSS_AUTOCONF AND AUTOCONF_FILES) | ||
| 375 | if(EXISTS ${SOURCE_DIR}/bootstrap/autoreconf.txt) | ||
| 376 | file(STRINGS ${SOURCE_DIR}/bootstrap/autoreconf.txt conf_dirs) | ||
| 377 | foreach(conf_dir ${conf_dirs}) | ||
| 378 | foreach(afile ${AUTOCONF_FILES}) | ||
| 379 | message(STATUS "copying ${afile} to ${SOURCE_DIR}/${conf_dir}") | ||
| 380 | file(COPY ${afile} DESTINATION ${SOURCE_DIR}/${conf_dir}) | ||
| 381 | endforeach() | ||
| 382 | endforeach() | ||
| 383 | endif() | ||
| 384 | endif() | ||
| 385 | |||
| 386 | # create a forwarding target to the addon-package target | ||
| 387 | add_custom_target(package-${id} | ||
| 388 | COMMAND ${CMAKE_COMMAND} --build ${id}-prefix/src/${id}-build --target addon-package | ||
| 389 | DEPENDS ${id}) | ||
| 390 | add_dependencies(package-addons package-${id}) | ||
| 391 | |||
| 278 | else() | 392 | else() |
| 279 | message(FATAL_ERROR "${id}: invalid or missing addon source directory at ${SOURCE_DIR}") | 393 | message(FATAL_ERROR "${id}: invalid or missing addon source directory at ${SOURCE_DIR}") |
| 280 | endif() | 394 | endif() |
| @@ -297,4 +411,4 @@ endif() | |||
| 297 | 411 | ||
| 298 | # add custom target "supported_addons" that returns all addons that are supported on this platform | 412 | # add custom target "supported_addons" that returns all addons that are supported on this platform |
| 299 | string(REPLACE ";" " " ALL_ADDONS_BUILDING "${ALL_ADDONS_BUILDING}") | 413 | string(REPLACE ";" " " ALL_ADDONS_BUILDING "${ALL_ADDONS_BUILDING}") |
| 300 | add_custom_target(supported_addons COMMAND ${CMAKE_COMMAND} -E echo "ALL_ADDONS_BUILDING: ${ALL_ADDONS_BUILDING}" VERBATIM) | 414 | add_custom_target(supported_addons COMMAND ${CMAKE_COMMAND} -E echo "ALL_ADDONS_BUILDING: ${ALL_ADDONS_BUILDING}" VERBATIM) \ No newline at end of file |
diff --git a/project/cmake/addons/README b/project/cmake/addons/README index b901bb7..a0f2c32 100644 --- a/project/cmake/addons/README +++ b/project/cmake/addons/README | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | KODI ADDONS | 1 | KODI ADDONS |
| 2 | =========== | 2 | =========== |
| 3 | This directory contains the cmake-based buildsystem for addons. It looks into | 3 | This directory contains the cmake-based buildsystem for addons. It looks into |
| 4 | the "addons" sub-directory and parses all *.txt files recursively. Each addon | 4 | the directory pointed to by the ADDONS_DEFINITION_DIR option (which defaults to |
| 5 | the "addons" sub-directory) and parses all *.txt files recursively. Each addon | ||
| 5 | must have its own <addon-id>.txt file in a separate sub-directory which must | 6 | must have its own <addon-id>.txt file in a separate sub-directory which must |
| 6 | follow one of the defined format: | 7 | follow one of the defined format: |
| 7 | <addon-id> <git-url> <git-revision> | 8 | <addon-id> <git-url> <git-revision> |
| @@ -22,13 +23,26 @@ are: | |||
| 22 | * platforms.txt: List of platforms to build an addon for (or "all"). It is | 23 | * platforms.txt: List of platforms to build an addon for (or "all"). It is |
| 23 | also supported to specify negated platforms with a leading exclamation mark | 24 | also supported to specify negated platforms with a leading exclamation mark |
| 24 | (i), e.g. "!windows". | 25 | (i), e.g. "!windows". |
| 25 | Available platforms are: linux, windows, darwin, ios, android, rbpi | 26 | Available platforms are: linux, windows, osx, ios, android, rbpi, freebsd |
| 27 | |||
| 28 | ATTENTION: If no addon definitions could be found the buildsystem assumes that | ||
| 29 | the bootstrapping of the addon definition repositories hasn't been | ||
| 30 | performed yet and automatically executes the addon bootstrapping | ||
| 31 | buildsystem located in the "bootstrap" sub-directory with the default | ||
| 32 | settings (i.e. all addons from all pre-defined addon definition | ||
| 33 | repositories are bootstrapped into the directory pointed to by the | ||
| 34 | ADDONS_DEFINITION_DIR option). | ||
| 26 | 35 | ||
| 27 | The buildsystem uses the following variables (which can be passed into it when | 36 | The buildsystem uses the following variables (which can be passed into it when |
| 28 | executing cmake with the -D<variable-name>=<value> option) to e.g. access | 37 | executing cmake with the -D<variable-name>=<value> option) to e.g. access |
| 29 | specific paths: | 38 | specific paths: |
| 30 | * ADDONS_TO_BUILD is a quoted, space delimited list of <addon-id>s that | 39 | * ADDONS_TO_BUILD has two variations, which are tested in order: |
| 31 | you want to build (default is "all"). | 40 | - a quoted, space delimited list of <addon-id>s that |
| 41 | you want to build (default is "all"). | ||
| 42 | - a regular expression that every <addon-id> is matched against | ||
| 43 | e.g.: ADDONS_TO_BUILD=pvr.* to build all pvr addons | ||
| 44 | * ADDONS_DEFINITION_DIR points to the directory containing the definitions | ||
| 45 | for the addons to be built. | ||
| 32 | * ADDON_SRC_PREFIX can be used to override the addon repository location. | 46 | * ADDON_SRC_PREFIX can be used to override the addon repository location. |
| 33 | It must point to the locally available parent directory of the addon(s) to build | 47 | It must point to the locally available parent directory of the addon(s) to build |
| 34 | <addon-id> will be appended to this path automatically | 48 | <addon-id> will be appended to this path automatically |
| @@ -45,11 +59,15 @@ specific paths: | |||
| 45 | absolute representation of ../../.. starting from this directory). | 59 | absolute representation of ../../.. starting from this directory). |
| 46 | * BUILD_DIR points to the directory where the addons and their dependencies | 60 | * BUILD_DIR points to the directory where the addons and their dependencies |
| 47 | will be downloaded and built. | 61 | will be downloaded and built. |
| 48 | * PACKAGE_ZIP=1 will mean the add-ons will be 'packaged' into a common folder, | 62 | * PACKAGE_ZIP=ON means that the add-ons will be 'packaged' into a common folder, |
| 49 | rather than being placed in <CMAKE_INSTALL_PREFIX>/lib/kodi/addons and | 63 | rather than being placed in <CMAKE_INSTALL_PREFIX>/lib/kodi/addons and |
| 50 | <CMAKE_INSTALL_PREFIX>/share/kodi/addons. | 64 | <CMAKE_INSTALL_PREFIX>/share/kodi/addons. |
| 65 | * PACKAGE_DIR points to the directory where the ZIP archived addons will be | ||
| 66 | stored after they have been packaged (defaults to <BUILD_DIR>/zips) | ||
| 51 | * ARCH_DEFINES specifies the platform-specific C/C++ preprocessor defines | 67 | * ARCH_DEFINES specifies the platform-specific C/C++ preprocessor defines |
| 52 | (defaults to empty). | 68 | (defaults to empty). |
| 69 | * ADDON_TARBALL_CACHING specifies whether downloaded addon source tarballs | ||
| 70 | should be cached or not (defaults to ON). | ||
| 53 | 71 | ||
| 54 | The buildsystem makes some assumptions about the environment which must be met | 72 | The buildsystem makes some assumptions about the environment which must be met |
| 55 | by whoever uses it: | 73 | by whoever uses it: |
diff --git a/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt b/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt deleted file mode 100644 index 5886cfa..0000000 --- a/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | audioencoder.flac https://github.com/xbmc/audioencoder.flac 84acb14 | ||
diff --git a/project/cmake/addons/addons/audioencoder.flac/platforms.txt b/project/cmake/addons/addons/audioencoder.flac/platforms.txt deleted file mode 100644 index 174a52e..0000000 --- a/project/cmake/addons/addons/audioencoder.flac/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | !ios \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt b/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt deleted file mode 100644 index a55dc44..0000000 --- a/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | audioencoder.lame https://github.com/xbmc/audioencoder.lame 3eb59de | ||
diff --git a/project/cmake/addons/addons/audioencoder.lame/platforms.txt b/project/cmake/addons/addons/audioencoder.lame/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/audioencoder.lame/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt b/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt deleted file mode 100644 index 8decf52..0000000 --- a/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | audioencoder.vorbis https://github.com/xbmc/audioencoder.vorbis d556a68 | ||
diff --git a/project/cmake/addons/addons/audioencoder.vorbis/platforms.txt b/project/cmake/addons/addons/audioencoder.vorbis/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/audioencoder.vorbis/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt b/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt deleted file mode 100644 index b3209f6..0000000 --- a/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | audioencoder.wav https://github.com/xbmc/audioencoder.wav 40aaedf | ||
diff --git a/project/cmake/addons/addons/audioencoder.wav/platforms.txt b/project/cmake/addons/addons/audioencoder.wav/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/audioencoder.wav/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.argustv/platforms.txt b/project/cmake/addons/addons/pvr.argustv/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.argustv/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt b/project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt deleted file mode 100644 index 88ccde4..0000000 --- a/project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.argustv https://github.com/kodi-pvr/pvr.argustv 96ee875 | ||
diff --git a/project/cmake/addons/addons/pvr.demo/platforms.txt b/project/cmake/addons/addons/pvr.demo/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.demo/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.demo/pvr.demo.txt b/project/cmake/addons/addons/pvr.demo/pvr.demo.txt deleted file mode 100644 index 1307381..0000000 --- a/project/cmake/addons/addons/pvr.demo/pvr.demo.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.demo https://github.com/kodi-pvr/pvr.demo b4b7de1 | ||
diff --git a/project/cmake/addons/addons/pvr.dvblink/platforms.txt b/project/cmake/addons/addons/pvr.dvblink/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.dvblink/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt b/project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt deleted file mode 100644 index 1aa96d8..0000000 --- a/project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.dvblink https://github.com/kodi-pvr/pvr.dvblink 5d505b8 | ||
diff --git a/project/cmake/addons/addons/pvr.dvbviewer/platforms.txt b/project/cmake/addons/addons/pvr.dvbviewer/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.dvbviewer/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt b/project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt deleted file mode 100644 index db25aa2..0000000 --- a/project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.dvbviewer https://github.com/manuelm/pvr.dvbviewer master \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.filmon/platforms.txt b/project/cmake/addons/addons/pvr.filmon/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.filmon/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.filmon/pvr.filmon.txt b/project/cmake/addons/addons/pvr.filmon/pvr.filmon.txt deleted file mode 100644 index 2e7142c..0000000 --- a/project/cmake/addons/addons/pvr.filmon/pvr.filmon.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.filmon https://github.com/kodi-pvr/pvr.filmon 413fe9e | ||
diff --git a/project/cmake/addons/addons/pvr.hts/platforms.txt b/project/cmake/addons/addons/pvr.hts/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.hts/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.hts/pvr.hts.txt b/project/cmake/addons/addons/pvr.hts/pvr.hts.txt deleted file mode 100644 index 5f913f8..0000000 --- a/project/cmake/addons/addons/pvr.hts/pvr.hts.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.hts https://github.com/kodi-pvr/pvr.hts 4bf1a97 | ||
diff --git a/project/cmake/addons/addons/pvr.iptvsimple/platforms.txt b/project/cmake/addons/addons/pvr.iptvsimple/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.iptvsimple/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt b/project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt deleted file mode 100644 index d1d4d3c..0000000 --- a/project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.iptvsimple https://github.com/kodi-pvr/pvr.iptvsimple a2e6c6f | ||
diff --git a/project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt b/project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt b/project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt deleted file mode 100644 index 665dfff..0000000 --- a/project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.mediaportal.tvserver https://github.com/kodi-pvr/pvr.mediaportal.tvserver 6f8ca82 | ||
diff --git a/project/cmake/addons/addons/pvr.mythtv/platforms.txt b/project/cmake/addons/addons/pvr.mythtv/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.mythtv/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt b/project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt deleted file mode 100644 index de930ab..0000000 --- a/project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.mythtv https://github.com/kodi-pvr/pvr.mythtv ef9cf41 | ||
diff --git a/project/cmake/addons/addons/pvr.nextpvr/platforms.txt b/project/cmake/addons/addons/pvr.nextpvr/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.nextpvr/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt b/project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt deleted file mode 100644 index ecb73d2..0000000 --- a/project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.nextpvr https://github.com/kodi-pvr/pvr.nextpvr 1ecbf87 | ||
diff --git a/project/cmake/addons/addons/pvr.njoy/platforms.txt b/project/cmake/addons/addons/pvr.njoy/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.njoy/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt b/project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt deleted file mode 100644 index fec1b59..0000000 --- a/project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.njoy https://github.com/kodi-pvr/pvr.njoy fcd6294 | ||
diff --git a/project/cmake/addons/addons/pvr.pctv/platforms.txt b/project/cmake/addons/addons/pvr.pctv/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.pctv/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt b/project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt deleted file mode 100644 index b17bdc7..0000000 --- a/project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.pctv https://github.com/kodi-pvr/pvr.pctv 0a0924e | ||
diff --git a/project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt b/project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt b/project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt deleted file mode 100644 index 72b4954..0000000 --- a/project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.vdr.vnsi https://github.com/kodi-pvr/pvr.vdr.vnsi 3a28e39 | ||
diff --git a/project/cmake/addons/addons/pvr.vuplus/platforms.txt b/project/cmake/addons/addons/pvr.vuplus/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.vuplus/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt b/project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt deleted file mode 100644 index 36d60af..0000000 --- a/project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.vuplus https://github.com/kodi-pvr/pvr.vuplus d6abad3 | ||
diff --git a/project/cmake/addons/addons/pvr.wmc/platforms.txt b/project/cmake/addons/addons/pvr.wmc/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.wmc/platforms.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | all \ No newline at end of file | ||
diff --git a/project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt b/project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt deleted file mode 100644 index 1455925..0000000 --- a/project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | pvr.wmc https://github.com/kodi-pvr/pvr.wmc cf28e4c | ||
diff --git a/project/cmake/addons/bootstrap/CMakeLists.txt b/project/cmake/addons/bootstrap/CMakeLists.txt new file mode 100644 index 0000000..86950b8 --- /dev/null +++ b/project/cmake/addons/bootstrap/CMakeLists.txt | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | project(kodi-addons-bootstrap) | ||
| 2 | |||
| 3 | cmake_minimum_required(VERSION 2.8) | ||
| 4 | |||
| 5 | list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) | ||
| 6 | |||
| 7 | # make sure CMAKE_INSTALL_PREFIX is properly set | ||
| 8 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX) | ||
| 9 | set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/../addons") | ||
| 10 | endif() | ||
| 11 | list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) | ||
| 12 | |||
| 13 | # figure out where the build directory is located | ||
| 14 | if(NOT BUILD_DIR) | ||
| 15 | set(BUILD_DIR "${CMAKE_BINARY_DIR}/build") | ||
| 16 | else() | ||
| 17 | file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR) | ||
| 18 | endif() | ||
| 19 | get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE) | ||
| 20 | |||
| 21 | # make sure that the repositories to build have been specified | ||
| 22 | if(NOT REPOSITORY_TO_BUILD) | ||
| 23 | set(REPOSITORY_TO_BUILD_DEFAULT ON) | ||
| 24 | set(REPOSITORY_TO_BUILD "all") | ||
| 25 | set(REPOSITORY_REVISION "") | ||
| 26 | message(STATUS "Bootstrapping all repositories") | ||
| 27 | else() | ||
| 28 | set(REPOSITORY_TO_BUILD_DEFAULT OFF) | ||
| 29 | message(STATUS "Bootstrapping following repository: ${REPOSITORY_TO_BUILD}") | ||
| 30 | endif() | ||
| 31 | |||
| 32 | # figure out which addons to bootstrap (defaults to all) | ||
| 33 | if(NOT ADDONS_TO_BUILD) | ||
| 34 | set(ADDONS_TO_BUILD "all") | ||
| 35 | message(STATUS "Bootstrapping all addons") | ||
| 36 | else() | ||
| 37 | message(STATUS "Bootstrapping following addons: ${ADDONS_TO_BUILD}") | ||
| 38 | endif() | ||
| 39 | |||
| 40 | include(ExternalProject) | ||
| 41 | |||
| 42 | function(bootstrap_repo repo_id repo_url repo_revision) | ||
| 43 | message(STATUS "Bootstrapping addons from ${repo_id} (${repo_url} ${repo_revision})...") | ||
| 44 | externalproject_add(${repo_id} | ||
| 45 | GIT_REPOSITORY ${repo_url} | ||
| 46 | GIT_TAG ${repo_revision} | ||
| 47 | PREFIX ${BUILD_DIR}/${repo_id} | ||
| 48 | CONFIGURE_COMMAND "" | ||
| 49 | BUILD_COMMAND "" | ||
| 50 | INSTALL_COMMAND ${CMAKE_COMMAND} | ||
| 51 | -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} | ||
| 52 | -DPROJECT_SOURCE_DIR=<SOURCE_DIR> | ||
| 53 | -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} | ||
| 54 | -DADDONS_TO_BUILD=${ADDONS_TO_BUILD} | ||
| 55 | -P ${PROJECT_SOURCE_DIR}/bootstrap.cmake | ||
| 56 | ) | ||
| 57 | endfunction() | ||
| 58 | |||
| 59 | # look for all addons repository definitions | ||
| 60 | set(REPOSITORY_TO_BUILD_FOUND OFF) | ||
| 61 | file(GLOB repos repositories/*.txt) | ||
| 62 | foreach(repo ${repos}) | ||
| 63 | file(STRINGS ${repo} repo_definition) | ||
| 64 | separate_arguments(repo_definition) | ||
| 65 | list(GET repo_definition 0 repo_id) | ||
| 66 | |||
| 67 | list(FIND REPOSITORY_TO_BUILD ${repo_id} idx) | ||
| 68 | if(idx GREATER -1 OR REPOSITORY_TO_BUILD STREQUAL "all") | ||
| 69 | set(REPOSITORY_TO_BUILD_FOUND ON) | ||
| 70 | |||
| 71 | # get the URL of the repository | ||
| 72 | list(GET repo_definition 1 repo_url) | ||
| 73 | |||
| 74 | # get the revision of the repository if not provided as an argument | ||
| 75 | if(NOT REPOSITORY_REVISION) | ||
| 76 | list(GET repo_definition 2 repo_revision) | ||
| 77 | else() | ||
| 78 | set(repo_revision "${REPOSITORY_REVISION}") | ||
| 79 | endif() | ||
| 80 | |||
| 81 | bootstrap_repo(${repo_id} ${repo_url} ${repo_revision}) | ||
| 82 | endif() | ||
| 83 | endforeach() | ||
| 84 | |||
| 85 | # if we have been asked to bootstrap a specific repository (not the default one) and | ||
| 86 | # it couldn't be found in the predefined repository definitions we assume that it's a | ||
| 87 | # URL to a specific repository | ||
| 88 | if(NOT REPOSITORY_TO_BUILD_DEFAULT AND NOT REPOSITORY_TO_BUILD_FOUND) | ||
| 89 | # default to the master branch if no revision has been provided | ||
| 90 | if(NOT REPOSITORY_REVISION) | ||
| 91 | set(REPOSITORY_REVISION "master") | ||
| 92 | endif() | ||
| 93 | |||
| 94 | bootstrap_repo(binary-addons-custom ${REPOSITORY_TO_BUILD} ${REPOSITORY_REVISION}) | ||
| 95 | endif() | ||
diff --git a/project/cmake/addons/bootstrap/README.md b/project/cmake/addons/bootstrap/README.md new file mode 100644 index 0000000..b886b5b --- /dev/null +++ b/project/cmake/addons/bootstrap/README.md | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | # KODI ADDON DEFINITIONS BOOTSTRAPPING | ||
| 2 | This directory contains the cmake-based buildsystem for addon definitions | ||
| 3 | bootstrapping which downloads the addon definitions from one or more addon | ||
| 4 | definitions repositories. These addon definitions are then used by the addon | ||
| 5 | buildsystem to figure out which addons and which versions to build. It looks | ||
| 6 | into the "repositories" sub-directory and parses all *.txt files recursively. | ||
| 7 | Each addon definitions repository must have its own <repository>.txt file which | ||
| 8 | must follow the following defined format: | ||
| 9 | ``` | ||
| 10 | <repository> <git-url> <git-revision> | ||
| 11 | ``` | ||
| 12 | where | ||
| 13 | * `<repository>` is the identification of the repository. | ||
| 14 | * `<git-url>` must be the URL of the git repository containing the addon | ||
| 15 | definitions | ||
| 16 | * `<git-revision>` must be a valid git tag/branch/commit in the addon | ||
| 17 | definitions repository's git repository which will be used for the build | ||
| 18 | |||
| 19 | The buildsystem uses the following variables (which can be passed into it when | ||
| 20 | executing cmake with the `-D<variable-name>=<value>` option): | ||
| 21 | * `CMAKE_INSTALL_PREFIX` points to the directory where the downloaded addon | ||
| 22 | definitions will be installed to (defaults to `../addons`). | ||
| 23 | * `BUILD_DIR` points to the directory where the addon definitions repositories | ||
| 24 | will be downloaded to. | ||
| 25 | * `REPOSITORY_TO_BUILD` specifies a single addon definitions repository to be | ||
| 26 | downloaded and processed (defaults to `"all"`). | ||
| 27 | * `REPOSITORY_REVISION` specifies the git revision in the addon definitions | ||
| 28 | repository which will be used for the build. This option is only valid in | ||
| 29 | combination with the `REPOSITORY_TO_BUILD` option (defaults to the git | ||
| 30 | revision specified in the repository's definition file). | ||
| 31 | * `ADDONS_TO_BUILD` is a quoted, space delimited list of `<addon-id>`s that | ||
| 32 | should be bootstrapped (default is `"all"`). | ||
| 33 | |||
| 34 | To trigger the cmake-based buildsystem the following command must be executed | ||
| 35 | with <path> being the path to this directory (absolute or relative, allowing for | ||
| 36 | in-source and out-of-source builds). | ||
| 37 | ``` | ||
| 38 | cmake <path> -G <generator> | ||
| 39 | ``` | ||
| 40 | |||
| 41 | cmake supports multiple generators, see | ||
| 42 | http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list. | ||
| 43 | |||
| 44 | In case of additional options the call might look like this | ||
| 45 | ``` | ||
| 46 | cmake <path> [-G <generator>] \ | ||
| 47 | -DCMAKE_INSTALL_PREFIX="<path-to-install-directory>" | ||
| 48 | ``` \ No newline at end of file | ||
diff --git a/project/cmake/addons/bootstrap/bootstrap.cmake b/project/cmake/addons/bootstrap/bootstrap.cmake new file mode 100644 index 0000000..c78910c --- /dev/null +++ b/project/cmake/addons/bootstrap/bootstrap.cmake | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) | ||
| 2 | |||
| 3 | # make sure that the installation location has been specified | ||
| 4 | if(NOT CMAKE_INSTALL_PREFIX) | ||
| 5 | message(FATAL_ERROR "CMAKE_INSTALL_PREFIX has not been specified") | ||
| 6 | endif() | ||
| 7 | |||
| 8 | # figure out which addons to bootstrap (defaults to all) | ||
| 9 | if(NOT ADDONS_TO_BUILD) | ||
| 10 | set(ADDONS_TO_BUILD "all") | ||
| 11 | else() | ||
| 12 | separate_arguments(ADDONS_TO_BUILD) | ||
| 13 | endif() | ||
| 14 | |||
| 15 | # find all addon definitions and go through them | ||
| 16 | file(GLOB_RECURSE ADDON_DEFINITIONS ${PROJECT_SOURCE_DIR}/*.txt) | ||
| 17 | foreach(ADDON_DEFINITION_FILE ${ADDON_DEFINITIONS}) | ||
| 18 | # ignore platforms.txt | ||
| 19 | if(NOT (ADDON_DEFINITION_FILE MATCHES platforms.txt)) | ||
| 20 | # read the addon definition file | ||
| 21 | file(STRINGS ${ADDON_DEFINITION_FILE} ADDON_DEFINITION) | ||
| 22 | separate_arguments(ADDON_DEFINITION) | ||
| 23 | |||
| 24 | # extract the addon definition's identifier | ||
| 25 | list(GET ADDON_DEFINITION 0 ADDON_ID) | ||
| 26 | |||
| 27 | # check if the addon definition should be built | ||
| 28 | list(FIND ADDONS_TO_BUILD ${ADDON_ID} ADDONS_TO_BUILD_IDX) | ||
| 29 | if(ADDONS_TO_BUILD_IDX GREATER -1 OR "${ADDONS_TO_BUILD}" STREQUAL "all") | ||
| 30 | # get the path to the addon definition directory | ||
| 31 | get_filename_component(ADDON_DEFINITION_DIR ${ADDON_DEFINITION_FILE} PATH) | ||
| 32 | |||
| 33 | # install the addon definition | ||
| 34 | message(STATUS "Bootstrapping ${ADDON_ID} addon...") | ||
| 35 | file(INSTALL ${ADDON_DEFINITION_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}) | ||
| 36 | endif() | ||
| 37 | endif() | ||
| 38 | endforeach() | ||
diff --git a/project/cmake/addons/bootstrap/repositories/binary-addons.txt b/project/cmake/addons/bootstrap/repositories/binary-addons.txt new file mode 100644 index 0000000..8674f06 --- /dev/null +++ b/project/cmake/addons/bootstrap/repositories/binary-addons.txt | |||
| @@ -0,0 +1 @@ | |||
| binary-addons https://github.com/xbmc/repo-binary-addons.git master \ No newline at end of file | |||
diff --git a/project/cmake/addons/depends/common/kodi-platform/deps.txt b/project/cmake/addons/depends/common/kodi-platform/deps.txt index f0e8246..b953815 100644 --- a/project/cmake/addons/depends/common/kodi-platform/deps.txt +++ b/project/cmake/addons/depends/common/kodi-platform/deps.txt | |||
| @@ -1,2 +1,2 @@ | |||
| 1 | kodi | 1 | tinyxml |
| 2 | tinyxml \ No newline at end of file | 2 | p8-platform |
diff --git a/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt b/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt index 009c72b..de42267 100644 --- a/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt +++ b/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt | |||
| @@ -1 +1 @@ | |||
| kodi-platform https://github.com/xbmc/kodi-platform 48bdd985 | kodi-platform https://github.com/xbmc/kodi-platform fed924e764b4c9c722f7f5d825ce70d4b61ae54f | ||
diff --git a/project/cmake/addons/depends/common/p8-platform/p8-platform.txt b/project/cmake/addons/depends/common/p8-platform/p8-platform.txt new file mode 100644 index 0000000..7db4e36 --- /dev/null +++ b/project/cmake/addons/depends/common/p8-platform/p8-platform.txt | |||
| @@ -0,0 +1 @@ | |||
| p8-platform https://github.com/Pulse-Eight/platform.git 38343e0acd6a636ac46139aa666aee4a8d1f13db | |||
diff --git a/project/cmake/addons/depends/common/tinyxml/tinyxml.txt b/project/cmake/addons/depends/common/tinyxml/tinyxml.txt index 456b0c5..f8e05e8 100644 --- a/project/cmake/addons/depends/common/tinyxml/tinyxml.txt +++ b/project/cmake/addons/depends/common/tinyxml/tinyxml.txt | |||
| @@ -1 +1 @@ | |||
| tinyxml http://mirrors.xbmc.org/build-deps/sources/tinyxml-2.6.2_2.tar.gz | tinyxml http://mirrors.kodi.tv/build-deps/sources/tinyxml-2.6.2_2.tar.gz | ||
diff --git a/project/cmake/installdata/addon-bindings.txt b/project/cmake/installdata/addon-bindings.txt new file mode 100644 index 0000000..fbcdf99 --- /dev/null +++ b/project/cmake/installdata/addon-bindings.txt | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h | ||
| 2 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h | ||
| 3 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h | ||
| 4 | xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h | ||
| 5 | xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h | ||
| 6 | xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h | ||
| 7 | xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h | ||
| 8 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h | ||
| 9 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h | ||
| 10 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h | ||
| 11 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h | ||
| 12 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h | ||
| 13 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h | ||
| 14 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h | ||
| 15 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h | ||
| 16 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h | ||
| 17 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h | ||
| 18 | xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp | ||
| 19 | xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h | ||
| 20 | xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h | ||
| 21 | xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h | ||
| 22 | xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h | ||
| 23 | xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h | ||
| 24 | xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h | ||
| 25 | xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h | ||
| 26 | xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h | ||
| 27 | xbmc/cores/AudioEngine/Utils/AEChannelData.h | ||
| 28 | xbmc/filesystem/IFileTypes.h | ||
diff --git a/project/cmake/installdata/common/addons.txt b/project/cmake/installdata/common/addons.txt new file mode 100644 index 0000000..7d406ad --- /dev/null +++ b/project/cmake/installdata/common/addons.txt | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | addons/kodi.adsp/* | ||
| 2 | addons/kodi.audiodecoder/* | ||
| 3 | addons/kodi.resource/* | ||
| 4 | addons/kodi.vfs/* | ||
| 5 | addons/xbmc.audioencoder/* | ||
| 6 | addons/xbmc.codec/* | ||
| 7 | addons/xbmc.core/* | ||
| 8 | addons/xbmc.gui/* | ||
| 9 | addons/xbmc.metadata/* | ||
| 10 | addons/xbmc.pvr/* | ||
| 11 | addons/xbmc.python/* | ||
| 12 | addons/xbmc.webinterface/* | ||
| 13 | addons/library.xbmc.addon/* | ||
| 14 | addons/library.xbmc.codec/* | ||
| 15 | addons/library.xbmc.gui/* | ||
| 16 | addons/library.xbmc.pvr/* | ||
| 17 | addons/repository.xbmc.org/* | ||
| 18 | addons/webinterface.default/* | ||
| 19 | addons/screensaver.xbmc.builtin.dim/* | ||
| 20 | addons/screensaver.xbmc.builtin.black/* | ||
| 21 | addons/script.module.pil/* | ||
| 22 | addons/script.module.pysqlite/* | ||
| 23 | addons/audioencoder.xbmc.builtin.aac/* | ||
| 24 | addons/audioencoder.xbmc.builtin.wav/* | ||
| 25 | addons/audioencoder.xbmc.builtin.wma/* | ||
| 26 | addons/resource.language.en_gb/* | ||
| 27 | addons/resource.uisounds.confluence/* | ||
| 28 | addons/resource.images.weathericons.default/* | ||
| 29 | addons/metadata.local/* | ||
| 30 | addons/metadata.album.universal/* | ||
| 31 | addons/metadata.artists.universal/* | ||
| 32 | addons/metadata.common.allmusic.com/* | ||
| 33 | addons/metadata.common.fanart.tv/* | ||
| 34 | addons/metadata.common.htbackdrops.com/* | ||
| 35 | addons/metadata.common.imdb.com/* | ||
| 36 | addons/metadata.common.musicbrainz.org/* | ||
| 37 | addons/metadata.common.theaudiodb.com/* | ||
| 38 | addons/metadata.common.themoviedb.org/* | ||
| 39 | addons/metadata.themoviedb.org/* | ||
| 40 | addons/metadata.tvdb.com/* | ||
diff --git a/project/cmake/installdata/common/common.txt b/project/cmake/installdata/common/common.txt new file mode 100644 index 0000000..c1e52f0 --- /dev/null +++ b/project/cmake/installdata/common/common.txt | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | media/* | ||
| 2 | sounds/* | ||
| 3 | system/keymaps/* | ||
| 4 | system/library/* | ||
| 5 | system/players/VideoPlayer/etc/* | ||
| 6 | system/shaders/* | ||
| 7 | system/settings/* | ||
| 8 | userdata/* | ||
| 9 | system/addon-manifest.xml | ||
| 10 | system/colors.xml | ||
| 11 | system/peripherals.xml | ||
| 12 | system/playercorefactory.xml | ||
| 13 | system/keyboardlayouts/* | ||
diff --git a/project/cmake/installdata/darwin/runtime.txt b/project/cmake/installdata/darwin/runtime.txt new file mode 100644 index 0000000..e1bb711 --- /dev/null +++ b/project/cmake/installdata/darwin/runtime.txt | |||
| @@ -0,0 +1 @@ | |||
| tools/darwin/runtime/preflight | |||
diff --git a/project/cmake/installdata/linux/lirc.txt b/project/cmake/installdata/linux/lirc.txt new file mode 100644 index 0000000..1b48478 --- /dev/null +++ b/project/cmake/installdata/linux/lirc.txt | |||
| @@ -0,0 +1 @@ | |||
| system/Lircmap.xml | |||
diff --git a/project/cmake/installdata/test-reference-data.txt b/project/cmake/installdata/test-reference-data.txt new file mode 100644 index 0000000..895079a --- /dev/null +++ b/project/cmake/installdata/test-reference-data.txt | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | xbmc/utils/test/CXBMCTinyXML-test.xml | ||
| 2 | xbmc/utils/test/data/language/Spanish/strings.po | ||
| 3 | xbmc/filesystem/test/reffile.txt | ||
| 4 | xbmc/filesystem/test/reffile.txt.rar | ||
| 5 | xbmc/filesystem/test/reffile.txt.zip | ||
| 6 | xbmc/filesystem/test/refRARnormal.rar | ||
| 7 | xbmc/filesystem/test/refRARstored.rar | ||
| 8 | xbmc/network/test/data/test.html | ||
| 9 | xbmc/network/test/data/test.png | ||
| 10 | xbmc/network/test/data/test-ranges.txt | ||
diff --git a/project/cmake/installdata/windows/addons.txt b/project/cmake/installdata/windows/addons.txt new file mode 100644 index 0000000..92bf9b3 --- /dev/null +++ b/project/cmake/installdata/windows/addons.txt | |||
| @@ -0,0 +1 @@ | |||
| addons/repository.pvr-win32.xbmc.org/* | |||
diff --git a/project/cmake/installdata/windows/dlls.txt b/project/cmake/installdata/windows/dlls.txt new file mode 100644 index 0000000..72cca7d --- /dev/null +++ b/project/cmake/installdata/windows/dlls.txt | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | system/*.dll | ||
| 2 | system/airplay/*.dll | ||
| 3 | system/cdrip/*.dll | ||
| 4 | system/players/dvdplayer/*.dll | ||
| 5 | system/players/paplayer/*.dll | ||
| 6 | system/players/VideoPlayer/*.dll | ||
diff --git a/project/cmake/installdata/windows/irss.txt b/project/cmake/installdata/windows/irss.txt new file mode 100644 index 0000000..6fd8d48 --- /dev/null +++ b/project/cmake/installdata/windows/irss.txt | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | system/IRSSmap.xml | ||
| 2 | system/X10-Lola-IRSSmap.xml | ||
diff --git a/project/cmake/kodi-config.cmake.in b/project/cmake/kodi-config.cmake.in index 118d723..84b2563 100644 --- a/project/cmake/kodi-config.cmake.in +++ b/project/cmake/kodi-config.cmake.in | |||
| @@ -1,11 +1,29 @@ | |||
| 1 | SET(KODI_INCLUDE_DIR @prefix@/include) | ||
| 2 | SET(APP_NAME @APP_NAME@) | 1 | SET(APP_NAME @APP_NAME@) |
| 2 | SET(APP_NAME_LC @APP_NAME_LC@) | ||
| 3 | SET(APP_NAME_UC @APP_NAME_UC@) | ||
| 3 | SET(APP_VERSION_MAJOR @APP_VERSION_MAJOR@) | 4 | SET(APP_VERSION_MAJOR @APP_VERSION_MAJOR@) |
| 4 | SET(APP_VERSION_MINOR @APP_VERSION_MINOR@) | 5 | SET(APP_VERSION_MINOR @APP_VERSION_MINOR@) |
| 6 | IF(NOT @APP_NAME_UC@_PREFIX) | ||
| 7 | SET(@APP_NAME_UC@_PREFIX @APP_PREFIX@) | ||
| 8 | ENDIF() | ||
| 9 | IF(NOT @APP_NAME_UC@_INCLUDE_DIR) | ||
| 10 | SET(@APP_NAME_UC@_INCLUDE_DIR @APP_INCLUDE_DIR@) | ||
| 11 | ENDIF() | ||
| 12 | IF(NOT @APP_NAME_UC@_LIB_DIR) | ||
| 13 | SET(@APP_NAME_UC@_LIB_DIR @APP_LIB_DIR@) | ||
| 14 | ENDIF() | ||
| 5 | IF(NOT WIN32) | 15 | IF(NOT WIN32) |
| 6 | SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@") | 16 | SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@") |
| 7 | ENDIF() | 17 | ENDIF() |
| 8 | LIST(APPEND CMAKE_MODULE_PATH @prefix@/lib/kodi) | 18 | LIST(APPEND CMAKE_MODULE_PATH @APP_LIB_DIR@) |
| 9 | ADD_DEFINITIONS(@ARCH_DEFINES@ -DBUILD_KODI_ADDON) | 19 | ADD_DEFINITIONS(@ARCH_DEFINES@ -DBUILD_KODI_ADDON) |
| 10 | 20 | ||
| 21 | if(NOT CORE_SYSTEM_NAME) | ||
| 22 | if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") | ||
| 23 | set(CORE_SYSTEM_NAME "osx") | ||
| 24 | else() | ||
| 25 | string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) | ||
| 26 | endif() | ||
| 27 | endif() | ||
| 28 | |||
| 11 | include(addon-helpers) | 29 | include(addon-helpers) |
diff --git a/project/cmake/modules/FindAML.cmake b/project/cmake/modules/FindAML.cmake new file mode 100644 index 0000000..5b9a859 --- /dev/null +++ b/project/cmake/modules/FindAML.cmake | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindAML | ||
| 3 | # ------- | ||
| 4 | # Finds the AML codec | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # AML_FOUND - system has AML | ||
| 9 | # AML_INCLUDE_DIRS - the AML include directory | ||
| 10 | # AML_DEFINITIONS - the AML definitions | ||
| 11 | # | ||
| 12 | # and the following imported targets:: | ||
| 13 | # | ||
| 14 | # AML::AML - The AML codec | ||
| 15 | |||
| 16 | find_path(AML_INCLUDE_DIR codec_error.h | ||
| 17 | PATH_SUFFIXES amcodec) | ||
| 18 | |||
| 19 | include(FindPackageHandleStandardArgs) | ||
| 20 | find_package_handle_standard_args(AML | ||
| 21 | REQUIRED_VARS AML_INCLUDE_DIR) | ||
| 22 | |||
| 23 | if(AML_FOUND) | ||
| 24 | set(AML_INCLUDE_DIRS ${AML_INCLUDE_DIR}) | ||
| 25 | set(AML_DEFINITIONS -DHAS_LIBAMCODEC=1) | ||
| 26 | |||
| 27 | if(NOT TARGET AML::AML) | ||
| 28 | add_library(AML::AML UNKNOWN IMPORTED) | ||
| 29 | set_target_properties(AML::AML PROPERTIES | ||
| 30 | INTERFACE_INCLUDE_DIRECTORIES "${AML_INCLUDE_DIR}" | ||
| 31 | INTERFACE_COMPILE_DEFINITIONS HAS_LIBAMCODEC=1) | ||
| 32 | endif() | ||
| 33 | endif() | ||
| 34 | |||
| 35 | mark_as_advanced(AMLCODEC_INCLUDE_DIR) | ||
diff --git a/project/cmake/modules/FindASS.cmake b/project/cmake/modules/FindASS.cmake new file mode 100644 index 0000000..5f4b0c7 --- /dev/null +++ b/project/cmake/modules/FindASS.cmake | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | # - Try to find ASS | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # ASS_FOUND - system has libass | ||
| 5 | # ASS_INCLUDE_DIRS - the libass include directory | ||
| 6 | # ASS_LIBRARIES - The libass libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (ASS libass) | ||
| 10 | else() | ||
| 11 | find_path(ASS_INCLUDE_DIRS ass/ass.h) | ||
| 12 | find_library(ASS_LIBRARIES NAMES ass libass) | ||
| 13 | endif() | ||
| 14 | |||
| 15 | include(FindPackageHandleStandardArgs) | ||
| 16 | find_package_handle_standard_args(ASS DEFAULT_MSG ASS_INCLUDE_DIRS ASS_LIBRARIES) | ||
| 17 | |||
| 18 | mark_as_advanced(ASS_INCLUDE_DIRS ASS_LIBRARIES) | ||
diff --git a/project/cmake/modules/FindAlsa.cmake b/project/cmake/modules/FindAlsa.cmake new file mode 100644 index 0000000..b15a0cf --- /dev/null +++ b/project/cmake/modules/FindAlsa.cmake | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | # - Try to find ALSA | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # ALSA_FOUND - system has libALSA | ||
| 5 | # ALSA_INCLUDE_DIRS - the libALSA include directory | ||
| 6 | # ALSA_LIBRARIES - The libALSA libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (ALSA alsa) | ||
| 10 | else() | ||
| 11 | find_path(ALSA_INCLUDE_DIRS asoundlib.h PATH_SUFFIXES alsa) | ||
| 12 | find_library(ALSA_LIBRARIES asound) | ||
| 13 | endif() | ||
| 14 | |||
| 15 | include(FindPackageHandleStandardArgs) | ||
| 16 | find_package_handle_standard_args(Alsa DEFAULT_MSG ALSA_INCLUDE_DIRS ALSA_LIBRARIES) | ||
| 17 | |||
| 18 | set(ALSA_INCLUDE_DIRS "") # Dont want these added as 'timer.h' is a dangerous file | ||
| 19 | mark_as_advanced(ALSA_INCLUDE_DIRS ALSA_LIBRARIES) | ||
| 20 | list(APPEND ALSA_DEFINITIONS -DHAVE_ALSA=1 -DUSE_ALSA=1) | ||
diff --git a/project/cmake/modules/FindAvahi.cmake b/project/cmake/modules/FindAvahi.cmake new file mode 100644 index 0000000..24bf15c --- /dev/null +++ b/project/cmake/modules/FindAvahi.cmake | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | # - Try to find avahi | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # AVAHI_FOUND - system has avahi | ||
| 5 | # AVAHI_INCLUDE_DIRS - the avahi include directory | ||
| 6 | # AVAHI_LIBRARIES - The avahi libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (AVAHI avahi-client) | ||
| 10 | list(APPEND AVAHI_INCLUDE_DIRS ${AVAHI_INCLUDEDIR}) | ||
| 11 | else() | ||
| 12 | find_path(AVAHI_CLIENT_INCLUDE_DIRS avahi-client/client.h) | ||
| 13 | find_path(AVAHI_COMMON_INCLUDE_DIRS avahi-common/defs.h) | ||
| 14 | find_library(AVAHI_COMMON_LIBRARIES avahi-common) | ||
| 15 | find_library(AVAHI_CLIENT_LIBRARIES avahi-common) | ||
| 16 | set(AVAHI_INCLUDE_DIRS ${AVAHI_CLIENT_INCLUDE_DIRS} | ||
| 17 | ${AVAHI_COMMON_INCLUDE_DIRS}) | ||
| 18 | set(AVAHI_LIBRARIES ${AVAHI_CLIENT_LIBRARIES} | ||
| 19 | ${AVAHI_COMMON_LIBRARIES}) | ||
| 20 | endif() | ||
| 21 | |||
| 22 | include(FindPackageHandleStandardArgs) | ||
| 23 | find_package_handle_standard_args(Avahi DEFAULT_MSG AVAHI_INCLUDE_DIRS AVAHI_LIBRARIES) | ||
| 24 | |||
| 25 | mark_as_advanced(AVAHI_INCLUDE_DIRS AVAHI_LIBRARIES) | ||
| 26 | list(APPEND AVAHI_DEFINITIONS -DHAVE_LIBAVAHI_COMMON=1 -DHAVE_LIBAVAHI_CLIENT=1) | ||
diff --git a/project/cmake/modules/FindBluray.cmake b/project/cmake/modules/FindBluray.cmake new file mode 100644 index 0000000..2b0a449 --- /dev/null +++ b/project/cmake/modules/FindBluray.cmake | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindBluray | ||
| 3 | # ---------- | ||
| 4 | # Finds the libbluray library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # BLURAY_FOUND - system has libbluray | ||
| 9 | # BLURAY_INCLUDE_DIRS - the libbluray include directory | ||
| 10 | # BLURAY_LIBRARIES - the libbluray libraries | ||
| 11 | # BLURAY_DEFINITIONS - the libbluray compile definitions | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # Bluray::Bluray - The libblueray library | ||
| 16 | |||
| 17 | if(PKG_CONFIG_FOUND) | ||
| 18 | pkg_check_modules(BLURAY libbluray>=0.7.0) | ||
| 19 | set(BLURAY_VERSION ${PC_BLURAY_VERSION}) | ||
| 20 | else() | ||
| 21 | find_path(BLURAY_INCLUDE_DIR libbluray/bluray.h | ||
| 22 | PATHS ${PC_BLURAY_INCLUDEDIR}) | ||
| 23 | |||
| 24 | include(FindPackageHandleStandardArgs) | ||
| 25 | if(NOT WIN32) | ||
| 26 | find_library(BLURAY_LIBRARY NAMES bluray | ||
| 27 | PATHS ${PC_BLURAY_LIBDIR}) | ||
| 28 | |||
| 29 | find_package_handle_standard_args(BLURAY | ||
| 30 | REQUIRED_VARS BLURAY_LIBRARY BLURAY_INCLUDE_DIR | ||
| 31 | VERSION_VAR BLURAY_VERSION) | ||
| 32 | else() | ||
| 33 | # Dynamically loaded DLL | ||
| 34 | find_package_handle_standard_args(BLURAY | ||
| 35 | REQUIRED_VARS BLURAY_INCLUDE_DIR | ||
| 36 | VERSION_VAR BLURAY_VERSION) | ||
| 37 | endif() | ||
| 38 | endif() | ||
| 39 | |||
| 40 | if(BLURAY_FOUND) | ||
| 41 | set(BLURAY_LIBRARIES ${BLURAY_LIBRARY}) | ||
| 42 | set(BLURAY_INCLUDE_DIRS ${BLURAY_INCLUDE_DIR}) | ||
| 43 | set(BLURAY_DEFINITIONS -DHAVE_LIBBLURAY=1) | ||
| 44 | |||
| 45 | if(NOT TARGET Bluray::Bluray) | ||
| 46 | add_library(Bluray::Bluray UNKNOWN IMPORTED) | ||
| 47 | if(BLURAY_LIBRARY) | ||
| 48 | set_target_properties(Bluray::Bluray PROPERTIES | ||
| 49 | IMPORTED_LOCATION "${BLURAY_LIBRARY}") | ||
| 50 | endif() | ||
| 51 | set_target_properties(Bluray::Bluray PROPERTIES | ||
| 52 | INTERFACE_INCLUDE_DIRECTORIES "${BLURAY_INCLUDE_DIR}" | ||
| 53 | INTERFACE_COMPILE_DEFINITIONS HAVE_LIBBLURAY=1) | ||
| 54 | endif() | ||
| 55 | endif() | ||
| 56 | |||
| 57 | mark_as_advanced(BLURAY_INCLUDE_DIR BLURAY_LIBRARY) | ||
diff --git a/project/cmake/modules/FindCCache.cmake b/project/cmake/modules/FindCCache.cmake new file mode 100644 index 0000000..4ad7d07 --- /dev/null +++ b/project/cmake/modules/FindCCache.cmake | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | find_program(CCACHE_FOUND ccache) | ||
| 2 | if(CCACHE_FOUND) | ||
| 3 | set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) | ||
| 4 | set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) | ||
| 5 | endif(CCACHE_FOUND) | ||
| 6 | |||
diff --git a/project/cmake/modules/FindCEC.cmake b/project/cmake/modules/FindCEC.cmake new file mode 100644 index 0000000..98e900d --- /dev/null +++ b/project/cmake/modules/FindCEC.cmake | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindCEC | ||
| 3 | # ------- | ||
| 4 | # Finds the libCEC library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # CEC_FOUND - system has libCEC | ||
| 9 | # CEC_INCLUDE_DIRS - the libCEC include directory | ||
| 10 | # CEC_LIBRARIES - the libCEC libraries | ||
| 11 | # CEC_DEFINITIONS - the libCEC compile definitions | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # CEC::CEC - The libCEC library | ||
| 16 | |||
| 17 | if(PKG_CONFIG_FOUND) | ||
| 18 | pkg_check_modules(PC_CEC libCEC>=3.0.0 QUIET) | ||
| 19 | endif() | ||
| 20 | |||
| 21 | find_path(CEC_INCLUDE_DIR libCEC/CEC.h | ||
| 22 | PATHS ${PC_CEC_INCLUDEDIR}) | ||
| 23 | |||
| 24 | set(CEC_VERSION ${PC_CEC_VERSION}) | ||
| 25 | |||
| 26 | include(FindPackageHandleStandardArgs) | ||
| 27 | if(NOT WIN32) | ||
| 28 | find_library(CEC_LIBRARY NAMES cec | ||
| 29 | PATHS ${PC_CEC_LIBDIR}) | ||
| 30 | |||
| 31 | find_package_handle_standard_args(CEC | ||
| 32 | REQUIRED_VARS CEC_LIBRARY CEC_INCLUDE_DIR | ||
| 33 | VERSION_VAR CEC_VERSION) | ||
| 34 | else() | ||
| 35 | # Dynamically loaded DLL | ||
| 36 | find_package_handle_standard_args(CEC | ||
| 37 | REQUIRED_VARS CEC_INCLUDE_DIR | ||
| 38 | VERSION_VAR CEC_VERSION) | ||
| 39 | endif() | ||
| 40 | |||
| 41 | if(CEC_FOUND) | ||
| 42 | set(CEC_LIBRARIES ${CEC_LIBRARY}) | ||
| 43 | set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIR}) | ||
| 44 | set(CEC_DEFINITIONS -DHAVE_LIBCEC=1) | ||
| 45 | |||
| 46 | if(NOT TARGET CEC::CEC) | ||
| 47 | add_library(CEC::CEC UNKNOWN IMPORTED) | ||
| 48 | if(CEC_LIBRARY) | ||
| 49 | set_target_properties(CEC::CEC PROPERTIES | ||
| 50 | IMPORTED_LOCATION "${CEC_LIBRARY}") | ||
| 51 | endif() | ||
| 52 | set_target_properties(CEC::CEC PROPERTIES | ||
| 53 | INTERFACE_INCLUDE_DIRECTORIES "${CEC_INCLUDE_DIR}" | ||
| 54 | INTERFACE_COMPILE_DEFINITIONS HAVE_LIBCEC=1) | ||
| 55 | endif() | ||
| 56 | endif() | ||
| 57 | |||
| 58 | mark_as_advanced(CEC_INCLUDE_DIR CEC_LIBRARY) | ||
diff --git a/project/cmake/modules/FindCXX11.cmake b/project/cmake/modules/FindCXX11.cmake new file mode 100644 index 0000000..f1b7346 --- /dev/null +++ b/project/cmake/modules/FindCXX11.cmake | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | include(TestCXXAcceptsFlag) | ||
| 2 | |||
| 3 | # try to use compiler flag -std=c++11 | ||
| 4 | check_cxx_accepts_flag("-std=c++11" CXX_FLAG_CXX11) | ||
| 5 | if(CXX_FLAG_CXX11) | ||
| 6 | add_options (CXX ALL_BUILDS "-std=c++11") | ||
| 7 | set(CXX_STD11_FLAGS "-std=c++11") | ||
| 8 | else() | ||
| 9 | # try to use compiler flag -std=c++0x for older compilers | ||
| 10 | check_cxx_accepts_flag("-std=c++0x" CXX_FLAG_CXX0X) | ||
| 11 | if(CXX_FLAG_CXX0X) | ||
| 12 | add_options (CXX ALL_BUILDS "-std=c++0x") | ||
| 13 | set(CXX_STD11_FLAGS "-std=c++0x") | ||
| 14 | endif(CXX_FLAG_CXX0X) | ||
| 15 | endif(CXX_FLAG_CXX11) | ||
| 16 | |||
| 17 | include(FindPackageHandleStandardArgs) | ||
| 18 | find_package_handle_standard_args(CXX11 DEFAULT_MSG CXX_STD11_FLAGS) | ||
diff --git a/project/cmake/modules/FindCdio.cmake b/project/cmake/modules/FindCdio.cmake new file mode 100644 index 0000000..1b6b8cd --- /dev/null +++ b/project/cmake/modules/FindCdio.cmake | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | # - Try to find cdio | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # CDIO_FOUND - system has libcdio | ||
| 5 | # CDIO_INCLUDE_DIRS - the libcdio include directory | ||
| 6 | # CDIO_LIBRARIES - The libcdio libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (CDIO libcdio libiso9660) | ||
| 10 | list(APPEND CDIO_INCLUDE_DIRS ${CDIO_libcdio_INCLUDEDIR} ${CDIO_libiso9660_INCLUDEDIR}) | ||
| 11 | endif() | ||
| 12 | if(NOT CDIO_FOUND) | ||
| 13 | find_path(CDIO_INCLUDE_DIRS cdio/cdio.h) | ||
| 14 | find_library(MODPLUG_LIBRARIES NAMES cdio) | ||
| 15 | endif() | ||
| 16 | |||
| 17 | include(FindPackageHandleStandardArgs) | ||
| 18 | find_package_handle_standard_args(Cdio DEFAULT_MSG CDIO_INCLUDE_DIRS CDIO_LIBRARIES) | ||
| 19 | |||
| 20 | mark_as_advanced(CDIO_INCLUDE_DIRS CDIO_LIBRARIES) | ||
diff --git a/project/cmake/modules/FindCpluff.cmake b/project/cmake/modules/FindCpluff.cmake new file mode 100644 index 0000000..b8fa22d --- /dev/null +++ b/project/cmake/modules/FindCpluff.cmake | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | # - Builds Cpluff as external project | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # CPLUFF_FOUND - system has cpluff | ||
| 5 | # CPLUFF_INCLUDE_DIRS - the cpluff include directories | ||
| 6 | # | ||
| 7 | # and link Kodi against the cpluff libraries. | ||
| 8 | |||
| 9 | if(NOT WIN32) | ||
| 10 | string(REPLACE ";" " " defines "${CMAKE_C_FLAGS} ${SYSTEM_DEFINES} -I${EXPAT_INCLUDE_DIR}") | ||
| 11 | get_filename_component(expat_dir ${EXPAT_LIBRARY} PATH) | ||
| 12 | set(ldflags "-L${expat_dir}") | ||
| 13 | ExternalProject_Add(libcpluff SOURCE_DIR ${CORE_SOURCE_DIR}/lib/cpluff | ||
| 14 | PREFIX ${CORE_BUILD_DIR}/cpluff | ||
| 15 | PATCH_COMMAND rm -f config.status | ||
| 16 | UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif | ||
| 17 | CONFIGURE_COMMAND CC=${CMAKE_C_COMPILER} ${CORE_SOURCE_DIR}/lib/cpluff/configure | ||
| 18 | --disable-nls | ||
| 19 | --enable-static | ||
| 20 | --disable-shared | ||
| 21 | --with-pic | ||
| 22 | --prefix=<INSTALL_DIR> | ||
| 23 | --host=${ARCH} | ||
| 24 | CFLAGS=${defines} | ||
| 25 | LDFLAGS=${ldflags} | ||
| 26 | BUILD_COMMAND make V=1) | ||
| 27 | set(ldflags "${ldflags};-lexpat") | ||
| 28 | core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/lib/libcpluff.a | ||
| 29 | system/libcpluff libcpluff extras "${ldflags}") | ||
| 30 | set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE) | ||
| 31 | else() | ||
| 32 | ExternalProject_Add(libcpluff SOURCE_DIR ${CORE_SOURCE_DIR}/lib/cpluff | ||
| 33 | PREFIX ${CORE_BUILD_DIR}/cpluff | ||
| 34 | CONFIGURE_COMMAND "" | ||
| 35 | # TODO: Building the project directly from lib/cpluff/libcpluff/win32/cpluff.vcxproj | ||
| 36 | # fails becaue it imports XBMC.defaults.props | ||
| 37 | BUILD_COMMAND devenv /build ${CORE_BUILD_CONFIG} | ||
| 38 | ${CORE_SOURCE_DIR}/project/VS2010Express/XBMC\ for\ Windows.sln | ||
| 39 | /project cpluff | ||
| 40 | INSTALL_COMMAND "") | ||
| 41 | # TODO: core_link_library | ||
| 42 | endif() | ||
| 43 | |||
| 44 | set(CPLUFF_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/include) | ||
| 45 | set(CPLUFF_FOUND 1) | ||
| 46 | mark_as_advanced(CPLUFF_INCLUDE_DIRS CPLUFF_FOUND) | ||
diff --git a/project/cmake/modules/FindCrossGUID.cmake b/project/cmake/modules/FindCrossGUID.cmake new file mode 100644 index 0000000..0d4a915 --- /dev/null +++ b/project/cmake/modules/FindCrossGUID.cmake | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | if(ENABLE_INTERNAL_CROSSGUID) | ||
| 2 | include(ExternalProject) | ||
| 3 | file(STRINGS ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/Makefile VER) | ||
| 4 | string(REGEX MATCH "VERSION=[^ ]*" CGUID_VER "${VER}") | ||
| 5 | list(GET CGUID_VER 0 CGUID_VER) | ||
| 6 | string(SUBSTRING "${CGUID_VER}" 8 -1 CGUID_VER) | ||
| 7 | |||
| 8 | externalproject_add(crossguid | ||
| 9 | URL http://mirrors.kodi.tv/build-deps/sources/crossguid-${CGUID_VER}.tar.gz | ||
| 10 | PREFIX ${CORE_BUILD_DIR}/crossguid | ||
| 11 | CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} | ||
| 12 | -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} | ||
| 13 | PATCH_COMMAND ${CMAKE_COMMAND} -E copy | ||
| 14 | ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/CMakeLists.txt | ||
| 15 | <SOURCE_DIR> && | ||
| 16 | ${CMAKE_COMMAND} -E copy | ||
| 17 | ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/FindUUID.cmake | ||
| 18 | <SOURCE_DIR> && | ||
| 19 | ${CMAKE_COMMAND} -E copy | ||
| 20 | ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/FindCXX11.cmake | ||
| 21 | <SOURCE_DIR>) | ||
| 22 | |||
| 23 | set(CROSSGUID_FOUND 1) | ||
| 24 | set(CROSSGUID_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/libcrossguid.a) | ||
| 25 | set(CROSSGUID_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include) | ||
| 26 | |||
| 27 | include(FindPackageHandleStandardArgs) | ||
| 28 | find_package_handle_standard_args(CROSSGUID DEFAULT_MSG CROSSGUID_INCLUDE_DIRS CROSSGUID_LIBRARIES) | ||
| 29 | mark_as_advanced(CROSSGUID_INCLUDE_DIRS CROSSGUID_LIBRARIES CROSSGUID_DEFINITIONS CROSSGUID_FOUND) | ||
| 30 | else() | ||
| 31 | find_path(CROSSGUID_INCLUDE_DIR guid.h) | ||
| 32 | |||
| 33 | find_library(CROSSGUID_LIBRARY_RELEASE NAMES crossguid | ||
| 34 | ${CONFIGURATION_LIBDIR_RELEASE}) | ||
| 35 | find_library(CROSSGUID_LIBRARY_DEBUG NAMES crossguidd | ||
| 36 | ${CONFIGURATION_LIBDIR_DEBUG}) | ||
| 37 | |||
| 38 | include(SelectLibraryConfigurations) | ||
| 39 | select_library_configurations(CROSSGUID) | ||
| 40 | |||
| 41 | include(FindPackageHandleStandardArgs) | ||
| 42 | find_package_handle_standard_args(CROSSGUID | ||
| 43 | REQUIRED_VARS CROSSGUID_LIBRARY CROSSGUID_INCLUDE_DIR) | ||
| 44 | |||
| 45 | if(CROSSGUID_FOUND) | ||
| 46 | set(CROSSGUID_LIBRARIES ${CROSSGUID_LIBRARY}) | ||
| 47 | set(CROSSGUID_INCLUDE_DIRS ${CROSSGUID_INCLUDE_DIR}) | ||
| 48 | endif() | ||
| 49 | mark_as_advanced(CROSSGUID_INCLUDE_DIR CROSSGUID_LIBRARY) | ||
| 50 | endif() | ||
| 51 | |||
| 52 | if(NOT WIN32 AND NOT APPLE) | ||
| 53 | find_package(UUID REQUIRED) | ||
| 54 | list(APPEND CROSSGUID_INCLUDE_DIRS ${UUID_INCLUDE_DIRS}) | ||
| 55 | list(APPEND CROSSGUID_LIBRARIES ${UUID_LIBRARIES}) | ||
| 56 | endif() | ||
diff --git a/project/cmake/modules/FindCurl.cmake b/project/cmake/modules/FindCurl.cmake new file mode 100644 index 0000000..a2e8862 --- /dev/null +++ b/project/cmake/modules/FindCurl.cmake | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | # - Try to find CURL | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # CURL_FOUND - system has libcurl | ||
| 5 | # CURL_INCLUDE_DIRS - the libcurl include directory | ||
| 6 | # CURL_LIBRARIES - The libcurl libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (CURL libcurl) | ||
| 10 | list(APPEND CURL_INCLUDE_DIRS ${CURL_INCLUDEDIR}) | ||
| 11 | else() | ||
| 12 | find_path(CURL_INCLUDE_DIRS curl/curl.h) | ||
| 13 | find_library(CURL_LIBRARIES NAMES curl libcurl) | ||
| 14 | endif() | ||
| 15 | include(FindPackageHandleStandardArgs) | ||
| 16 | find_package_handle_standard_args(Curl DEFAULT_MSG CURL_INCLUDE_DIRS CURL_LIBRARIES) | ||
| 17 | |||
| 18 | mark_as_advanced(CURL_INCLUDE_DIRS CURL_LIBRARIES) | ||
| 19 | |||
| 20 | if(CURL_FOUND) | ||
| 21 | if(NOT CURL_LIBRARY_DIRS AND CURL_LIBDIR) | ||
| 22 | set(CURL_LIBRARY_DIRS ${CURL_LIBDIR}) | ||
| 23 | endif() | ||
| 24 | |||
| 25 | find_soname(CURL) | ||
| 26 | |||
| 27 | if(EXISTS "${CURL_LIBRARY_DIRS}/${CURL_SONAME}") | ||
| 28 | execute_process(COMMAND readelf -s ${CURL_LIBRARY_DIRS}/${CURL_SONAME} COMMAND grep CRYPTO_set_locking_call OUTPUT_VARIABLE HAS_CURL_STATIC) | ||
| 29 | else() | ||
| 30 | message(FATAL_ERROR "curl library not found") | ||
| 31 | endif() | ||
| 32 | endif() | ||
| 33 | |||
| 34 | if(HAS_CURL_STATIC) | ||
| 35 | mark_as_advanced(HAS_CURL_STATIC) | ||
| 36 | list(APPEND CURL_DEFINITIONS -DHAS_CURL_STATIC=1) | ||
| 37 | endif() | ||
diff --git a/project/cmake/modules/FindD3DX11Effects.cmake b/project/cmake/modules/FindD3DX11Effects.cmake new file mode 100644 index 0000000..2b2de85 --- /dev/null +++ b/project/cmake/modules/FindD3DX11Effects.cmake | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | # - Builds D3DX11Effects as external project | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # D3DX11EFFECTS_FOUND - system has D3DX11Effects | ||
| 5 | # D3DX11EFFECTS_INCLUDE_DIRS - the D3DX11Effects include directories | ||
| 6 | # D3DCOMPILER_DLL - Path to the Direct3D Compiler | ||
| 7 | |||
| 8 | include(ExternalProject) | ||
| 9 | ExternalProject_Add(d3dx11effects | ||
| 10 | SOURCE_DIR ${CORE_SOURCE_DIR}/lib/win32/Effects11 | ||
| 11 | PREFIX ${CORE_BUILD_DIR}/Effects11 | ||
| 12 | CONFIGURE_COMMAND "" | ||
| 13 | BUILD_COMMAND devenv /build ${CORE_BUILD_CONFIG} | ||
| 14 | ${CORE_SOURCE_DIR}/lib/win32/Effects11/Effects11_2013.sln | ||
| 15 | INSTALL_COMMAND "") | ||
| 16 | |||
| 17 | set(D3DX11EFFECTS_FOUND 1) | ||
| 18 | set(D3DX11EFFECTS_INCLUDE_DIRS ${CORE_SOURCE_DIR}/lib/win32/Effects11/inc) | ||
| 19 | |||
| 20 | set(D3DX11EFFECTS_LIBRARY_RELEASE ${CORE_SOURCE_DIR}/lib/win32/Effects11/libs/Effects11/Release/Effects11.lib) | ||
| 21 | set(D3DX11EFFECTS_LIBRARY_DEBUG ${CORE_SOURCE_DIR}/lib/win32/Effects11/libs/Effects11/Debug/Effects11.lib) | ||
| 22 | include(SelectLibraryConfigurations) | ||
| 23 | select_library_configurations(D3DX11EFFECTS) | ||
| 24 | |||
| 25 | mark_as_advanced(D3DX11EFFECTS_FOUND) | ||
| 26 | |||
| 27 | find_file(D3DCOMPILER_DLL | ||
| 28 | NAMES d3dcompiler_47.dll d3dcompiler_46.dll | ||
| 29 | PATHS | ||
| 30 | "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/Redist/D3D/x86" | ||
| 31 | "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/Redist/D3D/x86" | ||
| 32 | "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/Redist/D3D/x86" | ||
| 33 | "$ENV{WindowsSdkDir}Redist/d3d/x86" | ||
| 34 | NO_DEFAULT_PATH) | ||
| 35 | if(NOT D3DCOMPILER_DLL) | ||
| 36 | message(WARNING "Could NOT find Direct3D Compiler") | ||
| 37 | endif() | ||
| 38 | mark_as_advanced(D3DCOMPILER_DLL) | ||
| 39 | |||
| 40 | find_program(FXC fxc | ||
| 41 | PATHS | ||
| 42 | "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/bin/x86" | ||
| 43 | "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/bin/x86" | ||
| 44 | "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/bin/x86" | ||
| 45 | "$ENV{WindowsSdkDir}bin/x86") | ||
| 46 | if(NOT FXC) | ||
| 47 | message(WARNING "Could NOT find DirectX Effects Compiler (FXC)") | ||
| 48 | endif() | ||
| 49 | mark_as_advanced(FXC) | ||
diff --git a/project/cmake/modules/FindDbus.cmake b/project/cmake/modules/FindDbus.cmake new file mode 100644 index 0000000..cdc3f52 --- /dev/null +++ b/project/cmake/modules/FindDbus.cmake | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | # - Try to find dbus | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # DBUS_FOUND - system has libdbus | ||
| 5 | # DBUS_INCLUDE_DIRS - the libdbus include directory | ||
| 6 | # DBUS_LIBRARIES - The libdbus libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (DBUS dbus-1) | ||
| 10 | endif() | ||
| 11 | |||
| 12 | if(DBUS_FOUND) | ||
| 13 | find_path(DBUS_INCLUDE_DIRS dbus/dbus.h PATH_SUFFIXES dbus-1.0) | ||
| 14 | find_library(DBUS_LIBRARIES dbus-1.0) | ||
| 15 | endif() | ||
| 16 | |||
| 17 | include(FindPackageHandleStandardArgs) | ||
| 18 | find_package_handle_standard_args(Dbus DEFAULT_MSG DBUS_INCLUDE_DIRS DBUS_LIBRARIES) | ||
| 19 | |||
| 20 | list(APPEND DBUS_DEFINITIONS -DHAVE_DBUS=1) | ||
| 21 | mark_as_advanced(DBUS_INCLUDE_DIRS DBUS_LIBRARIES DBUS_DEFINITIONS) | ||
diff --git a/project/cmake/modules/FindEGL.cmake b/project/cmake/modules/FindEGL.cmake new file mode 100644 index 0000000..79bb176 --- /dev/null +++ b/project/cmake/modules/FindEGL.cmake | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindEGL | ||
| 3 | # ------- | ||
| 4 | # Finds the EGL library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # EGL_FOUND - system has EGL | ||
| 9 | # EGL_INCLUDE_DIRS - the EGL include directory | ||
| 10 | # EGL_LIBRARIES - the EGL libraries | ||
| 11 | # EGL_DEFINITIONS - the EGL definitions | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # EGL::EGL - The EGL library | ||
| 16 | |||
| 17 | if(PKG_CONFIG_FOUND) | ||
| 18 | pkg_check_modules(PC_EGL egl QUIET) | ||
| 19 | endif() | ||
| 20 | |||
| 21 | find_path(EGL_INCLUDE_DIR EGL/egl.h | ||
| 22 | PATHS ${PC_EGL_INCLUDEDIR}) | ||
| 23 | |||
| 24 | find_library(EGL_LIBRARY NAMES EGL egl | ||
| 25 | PATHS ${PC_EGL_LIBDIR}) | ||
| 26 | |||
| 27 | set(EGL_VERSION ${PC_EGL_VERSION}) | ||
| 28 | |||
| 29 | include(FindPackageHandleStandardArgs) | ||
| 30 | find_package_handle_standard_args(EGL | ||
| 31 | REQUIRED_VARS EGL_LIBRARY EGL_INCLUDE_DIR | ||
| 32 | VERSION_VAR EGL_VERSION) | ||
| 33 | |||
| 34 | if(EGL_FOUND) | ||
| 35 | set(EGL_LIBRARIES ${EGL_LIBRARY}) | ||
| 36 | set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR}) | ||
| 37 | set(EGL_DEFINITIONS -DHAVE_LIBEGL=1) | ||
| 38 | |||
| 39 | if(NOT TARGET EGL::EGL) | ||
| 40 | add_library(EGL::EGL UNKNOWN IMPORTED) | ||
| 41 | set_target_properties(EGL::EGL PROPERTIES | ||
| 42 | IMPORTED_LOCATION "${EGL_LIBRARY}" | ||
| 43 | INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}" | ||
| 44 | INTERFACE_COMPILE_DEFINITIONS HAVE_LIBEGL=1) | ||
| 45 | endif() | ||
| 46 | endif() | ||
| 47 | |||
| 48 | mark_as_advanced(EGL_INCLUDE_DIR EGL_LIBRARY) | ||
diff --git a/project/cmake/modules/FindEMBEDDED.cmake b/project/cmake/modules/FindEMBEDDED.cmake new file mode 100644 index 0000000..bc1b456 --- /dev/null +++ b/project/cmake/modules/FindEMBEDDED.cmake | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | # - Try to find embedded platforms (RPI/IMX6) | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # EMBEDDED_FOUND - system is RPI / IMX6 and we most probably want to compile for GLES2 support | ||
| 5 | # (don't configure for OpenGL) | ||
| 6 | |||
| 7 | if(NOT CMAKE_SYSTEM_PROCESSOR) | ||
| 8 | set(CMAKE_SYSTEM_PROCESSOR ${CPU}) | ||
| 9 | endif() | ||
| 10 | |||
| 11 | string(REGEX MATCH "^arm" TARGET_ARCH_ARM "${CMAKE_SYSTEM_PROCESSOR}") | ||
| 12 | if(NOT CMAKE_CROSSCOMPILING AND NOT TARGET_ARCH_ARM) | ||
| 13 | return() | ||
| 14 | endif(NOT CMAKE_CROSSCOMPILING AND NOT TARGET_ARCH_ARM) | ||
| 15 | |||
| 16 | find_path(EMBEDDED_FOUND NAMES include/linux/imxfb.h include/bcm_host.h PATHS /opt/vc) | ||
| 17 | |||
diff --git a/project/cmake/modules/FindFFMPEG.cmake b/project/cmake/modules/FindFFMPEG.cmake new file mode 100644 index 0000000..711845a --- /dev/null +++ b/project/cmake/modules/FindFFMPEG.cmake | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | include(ExternalProject) | ||
| 2 | file(STRINGS ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/FFMPEG-VERSION VER) | ||
| 3 | string(REGEX MATCH "VERSION=[^ ]*$.*" FFMPEG_VER "${VER}") | ||
| 4 | list(GET FFMPEG_VER 0 FFMPEG_VER) | ||
| 5 | string(SUBSTRING "${FFMPEG_VER}" 8 -1 FFMPEG_VER) | ||
| 6 | string(REGEX MATCH "BASE_URL=([^ ]*)" FFMPEG_BASE_URL "${VER}") | ||
| 7 | list(GET FFMPEG_BASE_URL 0 FFMPEG_BASE_URL) | ||
| 8 | string(SUBSTRING "${FFMPEG_BASE_URL}" 9 -1 FFMPEG_BASE_URL) | ||
| 9 | |||
| 10 | |||
| 11 | if(ENABLE_INTERNAL_FFMPEG) | ||
| 12 | if(FFMPEG_PATH) | ||
| 13 | message(WARNING "Internal FFmpeg enabled, but FFMPEG_PATH given, ignoring") | ||
| 14 | endif() | ||
| 15 | if(CMAKE_CROSSCOMPILING) | ||
| 16 | set(CROSS_ARGS -DDEPENDS_PATH=${DEPENDS_PATH} | ||
| 17 | -DPKG_CONFIG_EXECUTABLE=${PKG_CONFIG_EXECUTABLE} | ||
| 18 | -DCROSSCOMPILING=${CMAKE_CROSSCOMPILING} | ||
| 19 | -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} | ||
| 20 | -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} | ||
| 21 | -DCPU=${WITH_CPU} | ||
| 22 | -DOS=${OS} | ||
| 23 | -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | ||
| 24 | -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | ||
| 25 | -DCMAKE_AR=${CMAKE_AR} | ||
| 26 | -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} | ||
| 27 | -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}) | ||
| 28 | endif() | ||
| 29 | |||
| 30 | externalproject_add(ffmpeg | ||
| 31 | URL ${FFMPEG_BASE_URL}/${FFMPEG_VER}.tar.gz | ||
| 32 | PREFIX ${CORE_BUILD_DIR}/ffmpeg | ||
| 33 | CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} | ||
| 34 | -DCMAKE_BUILD_TYPE=${DCMAKE_BUILD_TYPE} | ||
| 35 | -DFFMPEG_VER=${FFMPEG_VER} | ||
| 36 | -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} | ||
| 37 | ${CROSS_ARGS} | ||
| 38 | PATCH_COMMAND ${CMAKE_COMMAND} -E copy | ||
| 39 | ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/CMakeLists.txt | ||
| 40 | <SOURCE_DIR> && | ||
| 41 | ${CMAKE_COMMAND} -E copy | ||
| 42 | ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/FindGnuTls.cmake | ||
| 43 | <SOURCE_DIR>) | ||
| 44 | |||
| 45 | file(WRITE ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg/ffmpeg-link-wrapper | ||
| 46 | "#!/bin/bash | ||
| 47 | if [[ $@ == *${APP_NAME_LC}.bin* || $@ == *${APP_NAME_LC}-test* ]] | ||
| 48 | then | ||
| 49 | avformat=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavcodec` | ||
| 50 | avcodec=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavformat` | ||
| 51 | avfilter=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavfilter` | ||
| 52 | avutil=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavutil` | ||
| 53 | swscale=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswscale` | ||
| 54 | swresample=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswresample` | ||
| 55 | gnutls=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors gnutls` | ||
| 56 | vorbisenc=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors vorbisenc` | ||
| 57 | dcadec=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors dcadec` | ||
| 58 | $@ $avcodec $avformat $avcodec $avfilter $swscale $swresample -lpostproc $gnutls $vorbisenc $dcadec | ||
| 59 | else | ||
| 60 | $@ | ||
| 61 | fi") | ||
| 62 | file(COPY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg/ffmpeg-link-wrapper | ||
| 63 | DESTINATION ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} | ||
| 64 | FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) | ||
| 65 | set(FFMPEG_LINK_EXECUTABLE "${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg-link-wrapper <CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" PARENT_SCOPE) | ||
| 66 | set(FFMPEG_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include) | ||
| 67 | list(APPEND FFMPEG_DEFINITIONS -DFFMPEG_VER_SHA=\"${FFMPEG_VER}\" | ||
| 68 | -DUSE_STATIC_FFMPEG=1) | ||
| 69 | set(FFMPEG_FOUND 1) | ||
| 70 | else() | ||
| 71 | if(FFMPEG_PATH) | ||
| 72 | set(ENV{PKG_CONFIG_PATH} "${FFMPEG_PATH}/lib/pkgconfig") | ||
| 73 | endif() | ||
| 74 | set(FFMPEG_PKGS libavcodec>=56.26.100 libavfilter>=5.11.100 libavformat>=56.25.101 | ||
| 75 | libavutil>=54.20.100 libswscale>=3.1.101 libswresample>=1.1.100 libpostproc>=53.3.100) | ||
| 76 | if(PKG_CONFIG_FOUND) | ||
| 77 | pkg_check_modules (FFMPEG ${FFMPEG_PKGS}) | ||
| 78 | string(REGEX REPLACE "framework;" "framework " FFMPEG_LDFLAGS "${FFMPEG_LDFLAGS}") | ||
| 79 | set(FFMPEG_LIBRARIES ${FFMPEG_LDFLAGS}) | ||
| 80 | else() | ||
| 81 | find_path(FFMPEG_INCLUDE_DIRS libavcodec/avcodec.h PATH_SUFFIXES ffmpeg) | ||
| 82 | find_library(FFMPEG_LIBAVCODEC NAMES avcodec libavcodec PATH_SUFFIXES ffmpeg/libavcodec) | ||
| 83 | find_library(FFMPEG_LIBAVFILTER NAMES avfilter libavfilter PATH_SUFFIXES ffmpeg/libavfilter) | ||
| 84 | find_library(FFMPEG_LIBAVFORMAT NAMES avformat libavformat PATH_SUFFIXES ffmpeg/libavformat) | ||
| 85 | find_library(FFMPEG_LIBAVUTIL NAMES avutil libavutil PATH_SUFFIXES ffmpeg/libavutil) | ||
| 86 | find_library(FFMPEG_LIBSWSCALE NAMES swscale libswscale PATH_SUFFIXES ffmpeg/libswscale) | ||
| 87 | find_library(FFMPEG_LIBPOSTPROC NAMES postproc libpostproc PATH_SUFFIXES ffmpeg/libpostproc) | ||
| 88 | set(FFMPEG_LIBRARIES ${FFMPEG_LIBAVCODEC} ${FFMPEG_LIBAVFILTER} ${FFMPEG_LIBAVFORMAT} | ||
| 89 | ${FFMPEG_LIBAVUTIL} ${FFMPEG_LIBSWSCALE} ${FFMPEG_LIBPOSTPROC}) | ||
| 90 | add_custom_target(ffmpeg DEPENDS ${FFMPEG_LIBRARIES}) | ||
| 91 | endif() | ||
| 92 | |||
| 93 | include(FindPackageHandleStandardArgs) | ||
| 94 | find_package_handle_standard_args(FFMPEG DEFAULT_MSG FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES) | ||
| 95 | set(FFMPEG_FOUND 1) | ||
| 96 | list(APPEND FFMPEG_DEFINITIONS -DFFMPEG_VER_SHA=\"${FFMPEG_VER}\") | ||
| 97 | endif() | ||
| 98 | |||
| 99 | mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_DEFINITIONS FFMPEG_FOUND) | ||
diff --git a/project/cmake/modules/FindFreeType.cmake b/project/cmake/modules/FindFreeType.cmake new file mode 100644 index 0000000..a1e69ab --- /dev/null +++ b/project/cmake/modules/FindFreeType.cmake | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | # - Try to find freetype | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # FREETYPE_FOUND - system has freetype | ||
| 5 | # FREETYPE_INCLUDE_DIRS - the freetype include directory | ||
| 6 | # FREETYPE_LIBRARIES - The freetype libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (FREETYPE freetype2) | ||
| 10 | else() | ||
| 11 | find_path(FREETYPE_INCLUDE_DIRS freetype/freetype.h) | ||
| 12 | find_library(FREETYPE_LIBRARIES NAMES freetype freetype246MT) | ||
| 13 | endif() | ||
| 14 | |||
| 15 | include(FindPackageHandleStandardArgs) | ||
| 16 | find_package_handle_standard_args(FreeType DEFAULT_MSG FREETYPE_INCLUDE_DIRS FREETYPE_LIBRARIES) | ||
| 17 | |||
| 18 | mark_as_advanced(FREETYPE_INCLUDE_DIRS FREETYPE_LIBRARIES) | ||
diff --git a/project/cmake/modules/FindFribidi.cmake b/project/cmake/modules/FindFribidi.cmake new file mode 100644 index 0000000..65a8d8b --- /dev/null +++ b/project/cmake/modules/FindFribidi.cmake | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | # - Try to find Fribidi | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # FRIBIDI_FOUND - system has fribidi | ||
| 5 | # FRIBIDI_INCLUDE_DIRS - the fribidi include directory | ||
| 6 | # FRIBIDI_LIBRARIES - The fribidi libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (FRIBIDI fribidi) | ||
| 10 | else() | ||
| 11 | find_path(FRIBIDI_INCLUDE_DIRS fribidi/fribidi.h) | ||
| 12 | find_library(FRIBIDI_LIBRARIES NAMES fribidi libfribidi) | ||
| 13 | endif() | ||
| 14 | |||
| 15 | include(FindPackageHandleStandardArgs) | ||
| 16 | find_package_handle_standard_args(Fribidi DEFAULT_MSG FRIBIDI_INCLUDE_DIRS FRIBIDI_LIBRARIES) | ||
| 17 | |||
| 18 | mark_as_advanced(FRIBIDI_INCLUDE_DIRS FRIBIDI_LIBRARIES) | ||
diff --git a/project/cmake/modules/FindGIF.cmake b/project/cmake/modules/FindGIF.cmake new file mode 100644 index 0000000..8649bd4 --- /dev/null +++ b/project/cmake/modules/FindGIF.cmake | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindGIF | ||
| 3 | # ------- | ||
| 4 | # Finds the libgif library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # GIF_FOUND - system has libgif | ||
| 9 | # GIF_INCLUDE_DIRS - the libgif include directory | ||
| 10 | # GIF_LIBRARIES - the libgif libraries | ||
| 11 | # | ||
| 12 | # and the following imported targets:: | ||
| 13 | # | ||
| 14 | # GIF::GIF - The libgif library | ||
| 15 | |||
| 16 | find_path(GIF_INCLUDE_DIR gif_lib.h) | ||
| 17 | |||
| 18 | include(FindPackageHandleStandardArgs) | ||
| 19 | if(NOT WIN32) | ||
| 20 | find_library(GIF_LIBRARY NAMES gif) | ||
| 21 | find_package_handle_standard_args(GIF | ||
| 22 | REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR) | ||
| 23 | else() | ||
| 24 | # Dynamically loaded DLL | ||
| 25 | find_package_handle_standard_args(GIF | ||
| 26 | REQUIRED_VARS GIF_INCLUDE_DIR) | ||
| 27 | endif() | ||
| 28 | |||
| 29 | if(GIF_FOUND) | ||
| 30 | set(GIF_LIBRARIES ${GIF_LIBRARY}) | ||
| 31 | set(GIF_INCLUDE_DIRS ${GIF_INCLUDE_DIR}) | ||
| 32 | set(GIF_DEFINITIONS -DHAVE_LIBGIF=1) | ||
| 33 | |||
| 34 | if(NOT TARGET GIF::GIF) | ||
| 35 | add_library(GIF::GIF UNKNOWN IMPORTED) | ||
| 36 | if(GIF_LIBRARY) | ||
| 37 | set_target_properties(GIF::GIF PROPERTIES | ||
| 38 | IMPORTED_LOCATION "${GIF_LIBRARY}") | ||
| 39 | endif() | ||
| 40 | set_target_properties(GIF::GIF PROPERTIES | ||
| 41 | INTERFACE_INCLUDE_DIRECTORIES "${GIF_INCLUDE_DIR}" | ||
| 42 | INTERFACE_COMPILE_DEFINITIONS HAVE_LIBGIF=1) | ||
| 43 | endif() | ||
| 44 | endif() | ||
| 45 | |||
| 46 | mark_as_advanced(GIF_INCLUDE_DIR GIF_LIBRARY) | ||
diff --git a/project/cmake/modules/FindJsonSchemaBuilder.cmake b/project/cmake/modules/FindJsonSchemaBuilder.cmake new file mode 100644 index 0000000..78e8d0a --- /dev/null +++ b/project/cmake/modules/FindJsonSchemaBuilder.cmake | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindJsonSchemaBuilder | ||
| 3 | # --------------------- | ||
| 4 | # Finds the JsonSchemaBuilder | ||
| 5 | # | ||
| 6 | # This will define the following (imported) targets:: | ||
| 7 | # | ||
| 8 | # JsonSchemaBuilder::JsonSchemaBuilder - The JsonSchemaBuilder executable | ||
| 9 | |||
| 10 | if(NOT TARGET JsonSchemaBuilder::JsonSchemaBuilder) | ||
| 11 | if(CMAKE_CROSSCOMPILING) | ||
| 12 | add_executable(JsonSchemaBuilder::JsonSchemaBuilder IMPORTED GLOBAL) | ||
| 13 | set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES | ||
| 14 | IMPORTED_LOCATION "${NATIVEPREFIX}/bin/JsonSchemaBuilder") | ||
| 15 | else() | ||
| 16 | add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/JsonSchemaBuilder build/jsonschemabuilder) | ||
| 17 | add_executable(JsonSchemaBuilder::JsonSchemaBuilder ALIAS JsonSchemaBuilder) | ||
| 18 | endif() | ||
| 19 | endif() | ||
diff --git a/project/cmake/modules/FindLibDvd.cmake b/project/cmake/modules/FindLibDvd.cmake new file mode 100644 index 0000000..f281773 --- /dev/null +++ b/project/cmake/modules/FindLibDvd.cmake | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | set(dvdlibs libdvdread libdvdnav) | ||
| 2 | if(ENABLE_DVDCSS) | ||
| 3 | list(APPEND dvdlibs libdvdcss) | ||
| 4 | endif() | ||
| 5 | |||
| 6 | if(NOT WIN32) | ||
| 7 | foreach(dvdlib ${dvdlibs}) | ||
| 8 | file(GLOB VERSION_FILE ${CORE_SOURCE_DIR}/tools/depends/target/${dvdlib}/DVD*-VERSION) | ||
| 9 | file(STRINGS ${VERSION_FILE} VER) | ||
| 10 | string(REGEX MATCH "VERSION=[^ ]*$.*" ${dvdlib}_VER "${VER}") | ||
| 11 | list(GET ${dvdlib}_VER 0 ${dvdlib}_VER) | ||
| 12 | string(SUBSTRING "${${dvdlib}_VER}" 8 -1 ${dvdlib}_VER) | ||
| 13 | string(REGEX MATCH "BASE_URL=([^ ]*)" ${dvdlib}_BASE_URL "${VER}") | ||
| 14 | list(GET ${dvdlib}_BASE_URL 0 ${dvdlib}_BASE_URL) | ||
| 15 | string(SUBSTRING "${${dvdlib}_BASE_URL}" 9 -1 ${dvdlib}_BASE_URL) | ||
| 16 | endforeach() | ||
| 17 | |||
| 18 | set(DVDREAD_CFLAGS "${DVDREAD_CFLAGS} -I${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include") | ||
| 19 | if(CMAKE_CROSSCOMPILING) | ||
| 20 | set(EXTRA_FLAGS "CC=${CMAKE_C_COMPILER}") | ||
| 21 | endif() | ||
| 22 | |||
| 23 | if(APPLE) | ||
| 24 | set(CMAKE_LD_FLAGS "-framework IOKit -framework CoreFoundation") | ||
| 25 | endif() | ||
| 26 | |||
| 27 | if(ENABLE_DVDCSS) | ||
| 28 | ExternalProject_ADD(dvdcss URL ${libdvdcss_BASE_URL}/archive/${libdvdcss_VER}.tar.gz | ||
| 29 | PREFIX ${CORE_BUILD_DIR}/libdvd | ||
| 30 | UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif | ||
| 31 | CONFIGURE_COMMAND ac_cv_path_GIT= <SOURCE_DIR>/configure | ||
| 32 | --target=${ARCH} | ||
| 33 | --host=${ARCH} | ||
| 34 | --disable-doc | ||
| 35 | --enable-static | ||
| 36 | --disable-shared | ||
| 37 | --with-pic | ||
| 38 | --prefix=<INSTALL_DIR> | ||
| 39 | "${EXTRA_FLAGS}" | ||
| 40 | "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}" | ||
| 41 | "LDFLAGS=${CMAKE_LD_FLAGS}") | ||
| 42 | |||
| 43 | core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdcss.a | ||
| 44 | system/players/VideoPlayer/libdvdcss dvdcss) | ||
| 45 | endif() | ||
| 46 | |||
| 47 | set(DVDREAD_CFLAGS "-D_XBMC") | ||
| 48 | if(ENABLE_DVDCSS) | ||
| 49 | set(DVDREAD_CFLAGS "${DVDREAD_CFLAGS} -DHAVE_DVDCSS_DVDCSS_H -I${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include") | ||
| 50 | endif(ENABLE_DVDCSS) | ||
| 51 | |||
| 52 | ExternalProject_ADD(dvdread URL ${libdvdread_BASE_URL}/archive/${libdvdread_VER}.tar.gz | ||
| 53 | PREFIX ${CORE_BUILD_DIR}/libdvd | ||
| 54 | UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif | ||
| 55 | CONFIGURE_COMMAND ac_cv_path_GIT= <SOURCE_DIR>/configure | ||
| 56 | --target=${ARCH} | ||
| 57 | --host=${ARCH} | ||
| 58 | --enable-static | ||
| 59 | --disable-shared | ||
| 60 | --with-pic | ||
| 61 | --prefix=<INSTALL_DIR> | ||
| 62 | "${EXTRA_FLAGS}" | ||
| 63 | "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}" | ||
| 64 | "LDFLAGS=${CMAKE_LD_FLAGS}") | ||
| 65 | if(ENABLE_DVDCSS) | ||
| 66 | add_dependencies(dvdread dvdcss) | ||
| 67 | endif() | ||
| 68 | |||
| 69 | core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.a | ||
| 70 | system/players/VideoPlayer/libdvdread dvdread) | ||
| 71 | |||
| 72 | if(ENABLE_DVDCSS) | ||
| 73 | set(DVDNAV_LIBS -ldvdcss) | ||
| 74 | endif(ENABLE_DVDCSS) | ||
| 75 | |||
| 76 | ExternalProject_ADD(dvdnav URL ${libdvdnav_BASE_URL}/archive/${libdvdnav_VER}.tar.gz | ||
| 77 | PREFIX ${CORE_BUILD_DIR}/libdvd | ||
| 78 | UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif | ||
| 79 | CONFIGURE_COMMAND ac_cv_path_GIT= <SOURCE_DIR>/configure | ||
| 80 | --target=${ARCH} | ||
| 81 | --host=${ARCH} | ||
| 82 | --enable-static | ||
| 83 | --disable-shared | ||
| 84 | --with-pic | ||
| 85 | --prefix=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd | ||
| 86 | "${EXTRA_FLAGS}" | ||
| 87 | "LDFLAGS=${CMAKE_LD_FLAGS} -L${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib" | ||
| 88 | "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}" | ||
| 89 | "DVDREAD_CFLAGS=${DVDREAD_CFLAGS}" | ||
| 90 | "DVDREAD_LIBS=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.la" | ||
| 91 | "LIBS=${DVDNAV_LIBS}") | ||
| 92 | add_dependencies(dvdnav dvdread) | ||
| 93 | core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdnav.a | ||
| 94 | system/players/VideoPlayer/libdvdnav dvdnav) | ||
| 95 | |||
| 96 | set(LIBDVD_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include) | ||
| 97 | set(LIBDVD_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdnav.a | ||
| 98 | ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.a) | ||
| 99 | if(ENABLE_DVDCSS) | ||
| 100 | list(APPEND LIBDVD_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdcss.a) | ||
| 101 | endif() | ||
| 102 | set(LIBDVD_LIBRARIES ${LIBDVD_LIBRARIES} CACHE STRING "libdvd libraries" FORCE) | ||
| 103 | set(LIBDVD_FOUND 1 CACHE BOOL "libdvd found" FORCE) | ||
| 104 | else() | ||
| 105 | # Dynamically loaded on Windows | ||
| 106 | find_path(LIBDVD_INCLUDE_DIR dvdcss/dvdcss.h PATHS ${CORE_SOURCE_DIR}/lib/libdvd/include) | ||
| 107 | |||
| 108 | include(FindPackageHandleStandardArgs) | ||
| 109 | find_package_handle_standard_args(LIBDVD REQUIRED_VARS LIBDVD_INCLUDE_DIR) | ||
| 110 | |||
| 111 | if(LIBDVD_FOUND) | ||
| 112 | set(LIBDVD_INCLUDE_DIRS ${LIBDVD_INCLUDE_DIR}) | ||
| 113 | endif() | ||
| 114 | |||
| 115 | mark_as_advanced(LIBDVD_INCLUDE_DIR) | ||
| 116 | endif() | ||
diff --git a/project/cmake/modules/FindLibSmbClient.cmake b/project/cmake/modules/FindLibSmbClient.cmake new file mode 100644 index 0000000..897fa7b --- /dev/null +++ b/project/cmake/modules/FindLibSmbClient.cmake | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | # - Try to find Libsmbclient | ||
| 2 | |||
| 3 | if(PKGCONFIG_FOUND) | ||
| 4 | pkg_check_modules(LIBSMBCLIENT smbclient) | ||
| 5 | set(LIBSMBCLIENT_DEFINITIONS -DHAVE_LIBSMBCLIENT=1) | ||
| 6 | endif() | ||
| 7 | |||
| 8 | if (LIBSMBCLIENT_LIBRARIES AND LIBSMBCLIENT_INCLUDE_DIRS) | ||
| 9 | # in cache already | ||
| 10 | set(LIBSMBCLIENT_FOUND TRUE) | ||
| 11 | else (LIBSMBCLIENT_LIBRARIES AND LIBSMBCLIENT_INCLUDE_DIRS) | ||
| 12 | find_path(LIBSMBCLIENT_INCLUDE_DIR | ||
| 13 | NAMES | ||
| 14 | libsmbclient.h | ||
| 15 | PATHS | ||
| 16 | /usr/include | ||
| 17 | /usr/local/include | ||
| 18 | /opt/local/include | ||
| 19 | /sw/include | ||
| 20 | ) | ||
| 21 | |||
| 22 | find_library(SMBCLIENT_LIBRARY | ||
| 23 | NAMES | ||
| 24 | smbclient | ||
| 25 | PATHS | ||
| 26 | /usr/lib | ||
| 27 | /usr/local/lib | ||
| 28 | /opt/local/lib | ||
| 29 | /sw/lib | ||
| 30 | ) | ||
| 31 | |||
| 32 | if (SMBCLIENT_LIBRARY) | ||
| 33 | set(SMBCLIENT_FOUND TRUE) | ||
| 34 | endif (SMBCLIENT_LIBRARY) | ||
| 35 | |||
| 36 | set(LIBSMBCLIENT_INCLUDE_DIRS | ||
| 37 | ${LIBSMBCLIENT_INCLUDE_DIR} | ||
| 38 | ) | ||
| 39 | |||
| 40 | if (SMBCLIENT_FOUND) | ||
| 41 | set(LIBSMBCLIENT_LIBRARIES | ||
| 42 | ${LIBSMBCLIENT_LIBRARIES} | ||
| 43 | ${SMBCLIENT_LIBRARY} | ||
| 44 | ) | ||
| 45 | endif (SMBCLIENT_FOUND) | ||
| 46 | |||
| 47 | if (LIBSMBCLIENT_INCLUDE_DIRS AND LIBSMBCLIENT_LIBRARIES) | ||
| 48 | set(LIBSMBCLIENT_FOUND TRUE) | ||
| 49 | endif (LIBSMBCLIENT_INCLUDE_DIRS AND LIBSMBCLIENT_LIBRARIES) | ||
| 50 | |||
| 51 | if (LIBSMBCLIENT_FOUND) | ||
| 52 | if (NOT Libsmbclient_FIND_QUIETLY) | ||
| 53 | message(STATUS "Found Libsmbclient: ${LIBSMBCLIENT_LIBRARIES}") | ||
| 54 | endif (NOT Libsmbclient_FIND_QUIETLY) | ||
| 55 | else (LIBSMBCLIENT_FOUND) | ||
| 56 | if (Libsmbclient_FIND_REQUIRED) | ||
| 57 | message(FATAL_ERROR "Could not find Libsmbclient") | ||
| 58 | endif (Libsmbclient_FIND_REQUIRED) | ||
| 59 | endif (LIBSMBCLIENT_FOUND) | ||
| 60 | set(LIBSMBCLIENT_DEFINITIONS -DHAVE_LIBSMBCLIENT=1) | ||
| 61 | |||
| 62 | # show the LIBSMBCLIENT_INCLUDE_DIRS and LIBSMBCLIENT_LIBRARIES variables only in the advanced view | ||
| 63 | mark_as_advanced(LIBSMBCLIENT_INCLUDE_DIRS LIBSMBCLIENT_LIBRARIES LIBSMBCLIENT_DEFINITIONS) | ||
| 64 | |||
| 65 | endif (LIBSMBCLIENT_LIBRARIES AND LIBSMBCLIENT_INCLUDE_DIRS) | ||
diff --git a/project/cmake/modules/FindLibUSB.cmake b/project/cmake/modules/FindLibUSB.cmake new file mode 100644 index 0000000..e976bf4 --- /dev/null +++ b/project/cmake/modules/FindLibUSB.cmake | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindLibUSB | ||
| 3 | # ---------- | ||
| 4 | # Finds the USB library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # LIBUSB_FOUND - system has LibUSB | ||
| 9 | # LIBUSB_INCLUDE_DIRS - the USB include directory | ||
| 10 | # LIBUSB_LIBRARIES - the USB libraries | ||
| 11 | # | ||
| 12 | # and the following imported targets:: | ||
| 13 | # | ||
| 14 | # LibUSB::LibUSB - The USB library | ||
| 15 | |||
| 16 | if(PKG_CONFIG_FOUND) | ||
| 17 | pkg_check_modules(PC_LIBUSB libusb QUIET) | ||
| 18 | endif() | ||
| 19 | |||
| 20 | find_path(LIBUSB_INCLUDE_DIR usb.h | ||
| 21 | PATHS ${PC_LIBUSB_INCLUDEDIR}) | ||
| 22 | find_library(LIBUSB_LIBRARY NAMES usb | ||
| 23 | PATHS ${PC_LIBUSB_INCLUDEDIR}) | ||
| 24 | set(LIBUSB_VERSION ${PC_LIBUSB_VERSION}) | ||
| 25 | |||
| 26 | include(FindPackageHandleStandardArgs) | ||
| 27 | find_package_handle_standard_args(LIBUSB | ||
| 28 | REQUIRED_VARS LIBUSB_LIBRARY LIBUSB_INCLUDE_DIR | ||
| 29 | VERSION_VAR LIBUSB_VERSION) | ||
| 30 | |||
| 31 | if(LIBUSB_FOUND) | ||
| 32 | set(LIBUSB_INCLUDE_DIRS ${LIBUSB_INCLUDE_DIR}) | ||
| 33 | set(LIBUSB_LIBRARIES ${LIBUSB_LIBRARY}) | ||
| 34 | set(LIBUSB_DEFINITIONS -DUSE_LIBUSB=1) | ||
| 35 | |||
| 36 | if(NOT TARGET LibUSB::LibUSB) | ||
| 37 | add_library(LibUSB::LibUSB UNKNOWN IMPORTED) | ||
| 38 | set_target_properties(LibUSB::LibUSB PROPERTIES | ||
| 39 | IMPORTED_LOCATION "${LIBUSB_LIBRARY}" | ||
| 40 | INTERFACE_INCLUDE_DIRECTORIES "${LIBUSB_INCLUDE_DIR}" | ||
| 41 | INTERFACE_COMPILE_DEFINITIONS USE_LIBUSB=1) | ||
| 42 | endif() | ||
| 43 | endif() | ||
| 44 | |||
| 45 | mark_as_advanced(USB_INCLUDE_DIR USB_LIBRARY) | ||
diff --git a/project/cmake/modules/FindLzo2.cmake b/project/cmake/modules/FindLzo2.cmake new file mode 100644 index 0000000..33eee10 --- /dev/null +++ b/project/cmake/modules/FindLzo2.cmake | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | # - Try to find Lzo2 | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # Lzo2_FOUND - system has Lzo2 | ||
| 5 | # Lzo2_INCLUDE_DIR - the Lzo2 include directory | ||
| 6 | # Lzo2_LIBRARIES - Link these to use Lzo2 | ||
| 7 | # Lzo2_NEED_PREFIX - this is set if the functions are prefixed with BZ2_ | ||
| 8 | |||
| 9 | # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> | ||
| 10 | # | ||
| 11 | # Redistribution and use is allowed according to the terms of the BSD license. | ||
| 12 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
| 13 | |||
| 14 | |||
| 15 | FIND_PATH(LZO2_INCLUDE_DIRS lzo1x.h PATH_SUFFIXES lzo) | ||
| 16 | |||
| 17 | FIND_LIBRARY(LZO2_LIBRARIES NAMES lzo2 liblzo2) | ||
| 18 | |||
| 19 | include(FindPackageHandleStandardArgs) | ||
| 20 | find_package_handle_standard_args(Lzo2 DEFAULT_MSG LZO2_INCLUDE_DIRS LZO2_LIBRARIES) | ||
| 21 | |||
| 22 | MARK_AS_ADVANCED(LZO2_INCLUDE_DIRS LZO2_LIBRARIES) | ||
diff --git a/project/cmake/modules/FindMMAL.cmake b/project/cmake/modules/FindMMAL.cmake new file mode 100644 index 0000000..8843983 --- /dev/null +++ b/project/cmake/modules/FindMMAL.cmake | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | # - Try to find MMAL | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # MMAL_FOUND - system has MMAL | ||
| 5 | # MMAL_INCLUDE_DIRS - the MMAL include directory | ||
| 6 | # MMAL_LIBRARIES - The MMAL libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules(MMAL mmal QUIET) | ||
| 10 | endif() | ||
| 11 | |||
| 12 | if(NOT MMAL_FOUND) | ||
| 13 | find_path(MMAL_INCLUDE_DIRS interface/mmal/mmal.h) | ||
| 14 | find_library(MMAL_LIBRARY mmal) | ||
| 15 | find_library(MMALCORE_LIBRARY mmal_core) | ||
| 16 | find_library(MMALUTIL_LIBRARY mmal_util) | ||
| 17 | find_library(MMALCLIENT_LIBRARY mmal_vc_client) | ||
| 18 | find_library(MMALCOMPONENT_LIBRARY mmal_components) | ||
| 19 | find_library(BCM_LIBRARY bcm_host) | ||
| 20 | find_library(VCHIQ_LIBRARY vchiq_arm) | ||
| 21 | find_library(VCOS_LIBRARY vcos) | ||
| 22 | find_library(VCSM_LIBRARY vcsm) | ||
| 23 | find_library(CONTAINER_LIBRARY containers) | ||
| 24 | |||
| 25 | set(MMAL_LIBRARIES ${MMAL_LIBRARY} ${MMALCORE_LIBRARY} ${MMALUTIL_LIBRARY} | ||
| 26 | ${MMALCLIENT_LIBRARY} ${MMALCOMPONENT_LIBRARY} | ||
| 27 | ${BCM_LIBRARY} ${VCHIQ_LIBRARY} ${VCOS_LIBRARY} ${VCSM_LIBRARY} ${CONTAINER_LIBRARY} | ||
| 28 | CACHE STRING "mmal libraries" FORCE) | ||
| 29 | endif() | ||
| 30 | |||
| 31 | include(FindPackageHandleStandardArgs) | ||
| 32 | find_package_handle_standard_args(MMAL DEFAULT_MSG MMAL_LIBRARIES MMAL_INCLUDE_DIRS) | ||
| 33 | |||
| 34 | list(APPEND MMAL_DEFINITIONS -DHAVE_MMAL=1 -DHAS_MMAL=1) | ||
| 35 | |||
| 36 | mark_as_advanced(MMAL_INCLUDE_DIRS MMAL_LIBRARIES MMAL_DEFINITIONS) | ||
diff --git a/project/cmake/modules/FindMicroHttpd.cmake b/project/cmake/modules/FindMicroHttpd.cmake new file mode 100644 index 0000000..f73dc77 --- /dev/null +++ b/project/cmake/modules/FindMicroHttpd.cmake | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | IF (NOT WIN32) | ||
| 2 | include(FindPkgConfig) | ||
| 3 | if ( PKG_CONFIG_FOUND ) | ||
| 4 | |||
| 5 | pkg_check_modules (MICROHTTPD libmicrohttpd>=0.4) | ||
| 6 | |||
| 7 | set(MICROHTTPD_DEFINITIONS ${MICROHTTPD_CFLAGS_OTHER}) | ||
| 8 | endif(PKG_CONFIG_FOUND) | ||
| 9 | endif (NOT WIN32) | ||
| 10 | |||
| 11 | # | ||
| 12 | # set defaults | ||
| 13 | if(NOT MICROHTTPD_FOUND) | ||
| 14 | SET(_microhttpd_HOME "/usr/local") | ||
| 15 | SET(_microhttpd_INCLUDE_SEARCH_DIRS | ||
| 16 | ${CMAKE_INCLUDE_PATH} | ||
| 17 | /usr/local/include | ||
| 18 | /usr/include | ||
| 19 | ) | ||
| 20 | |||
| 21 | SET(_microhttpd_LIBRARIES_SEARCH_DIRS | ||
| 22 | ${CMAKE_LIBRARY_PATH} | ||
| 23 | /usr/local/lib | ||
| 24 | /usr/lib | ||
| 25 | ) | ||
| 26 | |||
| 27 | ## | ||
| 28 | if( "${MICROHTTPD_HOME}" STREQUAL "") | ||
| 29 | if("" MATCHES "$ENV{MICROHTTPD_HOME}") | ||
| 30 | message(STATUS "MICROHTTPD_HOME env is not set, setting it to /usr/local") | ||
| 31 | set (MICROHTTPD_HOME ${_microhttpd_HOME}) | ||
| 32 | else("" MATCHES "$ENV{MICROHTTPD_HOME}") | ||
| 33 | set (MICROHTTPD_HOME "$ENV{MICROHTTPD_HOME}") | ||
| 34 | endif("" MATCHES "$ENV{MICROHTTPD_HOME}") | ||
| 35 | else( "${MICROHTTPD_HOME}" STREQUAL "") | ||
| 36 | message(STATUS "MICROHTTPD_HOME is not empty: \"${MICROHTTPD_HOME}\"") | ||
| 37 | endif( "${MICROHTTPD_HOME}" STREQUAL "") | ||
| 38 | ## | ||
| 39 | |||
| 40 | message(STATUS "Looking for microhttpd in ${MICROHTTPD_HOME}") | ||
| 41 | |||
| 42 | IF( NOT ${MICROHTTPD_HOME} STREQUAL "" ) | ||
| 43 | SET(_microhttpd_INCLUDE_SEARCH_DIRS ${MICROHTTPD_HOME}/include ${_microhttpd_INCLUDE_SEARCH_DIRS}) | ||
| 44 | SET(_microhttpd_LIBRARIES_SEARCH_DIRS ${MICROHTTPD_HOME}/lib ${_microhttpd_LIBRARIES_SEARCH_DIRS}) | ||
| 45 | SET(_microhttpd_HOME ${MICROHTTPD_HOME}) | ||
| 46 | ENDIF( NOT ${MICROHTTPD_HOME} STREQUAL "" ) | ||
| 47 | |||
| 48 | IF( NOT $ENV{MICROHTTPD_INCLUDEDIR} STREQUAL "" ) | ||
| 49 | SET(_microhttpd_INCLUDE_SEARCH_DIRS $ENV{MICROHTTPD_INCLUDEDIR} ${_microhttpd_INCLUDE_SEARCH_DIRS}) | ||
| 50 | ENDIF( NOT $ENV{MICROHTTPD_INCLUDEDIR} STREQUAL "" ) | ||
| 51 | |||
| 52 | IF( NOT $ENV{MICROHTTPD_LIBRARYDIR} STREQUAL "" ) | ||
| 53 | SET(_microhttpd_LIBRARIES_SEARCH_DIRS $ENV{MICROHTTPD_LIBRARYDIR} ${_microhttpd_LIBRARIES_SEARCH_DIRS}) | ||
| 54 | ENDIF( NOT $ENV{MICROHTTPD_LIBRARYDIR} STREQUAL "" ) | ||
| 55 | |||
| 56 | IF( MICROHTTPD_HOME ) | ||
| 57 | SET(_microhttpd_INCLUDE_SEARCH_DIRS ${MICROHTTPD_HOME}/include ${_microhttpd_INCLUDE_SEARCH_DIRS}) | ||
| 58 | SET(_microhttpd_LIBRARIES_SEARCH_DIRS ${MICROHTTPD_HOME}/lib ${_microhttpd_LIBRARIES_SEARCH_DIRS}) | ||
| 59 | SET(_microhttpd_HOME ${MICROHTTPD_HOME}) | ||
| 60 | ENDIF( MICROHTTPD_HOME ) | ||
| 61 | |||
| 62 | # find the include files | ||
| 63 | FIND_PATH(MICROHTTPD_INCLUDE_DIRS microhttpd.h | ||
| 64 | HINTS | ||
| 65 | ${_microhttpd_INCLUDE_SEARCH_DIRS} | ||
| 66 | ${PC_MICROHTTPD_INCLUDEDIR} | ||
| 67 | ${PC_MICROHTTPD_INCLUDE_DIRS} | ||
| 68 | ${CMAKE_INCLUDE_PATH} | ||
| 69 | ) | ||
| 70 | |||
| 71 | # locate the library | ||
| 72 | IF(WIN32) | ||
| 73 | SET(MICROHTTPD_LIBRARY_NAMES ${MICROHTTPD_LIBRARY_NAMES} libmicrohttpd.lib) | ||
| 74 | ELSE(WIN32) | ||
| 75 | SET(MICROHTTPD_LIBRARY_NAMES ${MICROHTTPD_LIBRARY_NAMES} libmicrohttpd.a) | ||
| 76 | ENDIF(WIN32) | ||
| 77 | FIND_LIBRARY(MICROHTTPD_LIBRARIES NAMES ${MICROHTTPD_LIBRARY_NAMES} | ||
| 78 | HINTS | ||
| 79 | ${_microhttpd_LIBRARIES_SEARCH_DIRS} | ||
| 80 | ${PC_MICROHTTPD_LIBDIR} | ||
| 81 | ${PC_MICROHTTPD_LIBRARY_DIRS} | ||
| 82 | ) | ||
| 83 | |||
| 84 | # if the include and the program are found then we have it | ||
| 85 | IF(MICROHTTPD_INCLUDE_DIRS AND MICROHTTPD_LIBRARIES) | ||
| 86 | SET(MICROHTTPD_FOUND "YES") | ||
| 87 | ENDIF(MICROHTTPD_INCLUDE_DIRS AND MICROHTTPD_LIBRARIES) | ||
| 88 | |||
| 89 | if( NOT WIN32) | ||
| 90 | find_library(GCRYPT_LIBRARY gcrypt) | ||
| 91 | find_library(GPGERROR_LIBRARY gpg-error) | ||
| 92 | list(APPEND MICROHTTPD_LIBRARIES ${GCRYPT_LIBRARY} ${GPGERROR_LIBRARY}) | ||
| 93 | if(NOT APPLE AND NOT CORE_SYSTEM_NAME STREQUAL android) | ||
| 94 | list(APPEND MICROHTTPD_LIBRARIES "-lrt") | ||
| 95 | endif() | ||
| 96 | endif( NOT WIN32) | ||
| 97 | endif() | ||
| 98 | |||
| 99 | list(APPEND MICROHTTPD_DEFINITIONS -DHAVE_LIBMICROHTTPD=1) | ||
| 100 | |||
| 101 | MARK_AS_ADVANCED( | ||
| 102 | MICROHTTPD_FOUND | ||
| 103 | MICROHTTPD_LIBRARIES | ||
| 104 | MICROHTTPD_DEFINITIONS | ||
| 105 | MICROHTTPD_INCLUDE_DIRS | ||
| 106 | ) | ||
diff --git a/project/cmake/modules/FindMySqlClient.cmake b/project/cmake/modules/FindMySqlClient.cmake new file mode 100644 index 0000000..12fee5c --- /dev/null +++ b/project/cmake/modules/FindMySqlClient.cmake | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindMySqlClient | ||
| 3 | # --------------- | ||
| 4 | # Finds the MySqlClient library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # MYSQLCLIENT_FOUND - system has MySqlClient | ||
| 9 | # MYSQLCLIENT_INCLUDE_DIRS - the MySqlClient include directory | ||
| 10 | # MYSQLCLIENT_LIBRARIES - the MySqlClient libraries | ||
| 11 | # MYSQLCLIENT_DEFINITIONS - the MySqlClient compile definitions | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # MySqlClient::MySqlClient - The MySqlClient library | ||
| 16 | |||
| 17 | find_path(MYSQLCLIENT_INCLUDE_DIR mysql/mysql_time.h) | ||
| 18 | find_library(MYSQLCLIENT_LIBRARY_RELEASE NAMES mysqlclient mysqlclient_r | ||
| 19 | PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} mysql) | ||
| 20 | find_library(MYSQLCLIENT_LIBRARY_DEBUG NAMES mysqlclient | ||
| 21 | PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} mysql) | ||
| 22 | |||
| 23 | include(SelectLibraryConfigurations) | ||
| 24 | select_library_configurations(MYSQLCLIENT) | ||
| 25 | |||
| 26 | include(FindPackageHandleStandardArgs) | ||
| 27 | find_package_handle_standard_args(MYSQLCLIENT | ||
| 28 | REQUIRED_VARS MYSQLCLIENT_LIBRARY MYSQLCLIENT_INCLUDE_DIR) | ||
| 29 | |||
| 30 | if(MYSQLCLIENT_FOUND) | ||
| 31 | set(MYSQLCLIENT_LIBRARIES ${MYSQLCLIENT_LIBRARY}) | ||
| 32 | set(MYSQLCLIENT_INCLUDE_DIRS ${MYSQLCLIENT_INCLUDE_DIR}) | ||
| 33 | set(MYSQLCLIENT_DEFINITIONS -DHAVE_MYSQL=1) | ||
| 34 | |||
| 35 | if(NOT TARGET MySqlClient::MySqlClient) | ||
| 36 | add_library(MySqlClient::MySqlClient UNKNOWN IMPORTED) | ||
| 37 | if(MYSQLCLIENT_LIBRARY_RELEASE) | ||
| 38 | set_target_properties(MySqlClient::MySqlClient PROPERTIES | ||
| 39 | IMPORTED_CONFIGURATIONS RELEASE | ||
| 40 | IMPORTED_LOCATION "${MYSQLCLIENT_LIBRARY_RELEASE}") | ||
| 41 | endif() | ||
| 42 | if(MYSQLCLIENT_LIBRARY_DEBUG) | ||
| 43 | set_target_properties(MySqlClient::MySqlClient PROPERTIES | ||
| 44 | IMPORTED_CONFIGURATIONS DEBUG | ||
| 45 | IMPORTED_LOCATION "${MYSQLCLIENT_LIBRARY_DEBUG}") | ||
| 46 | endif() | ||
| 47 | set_target_properties(MySqlClient::MySqlClient PROPERTIES | ||
| 48 | INTERFACE_INCLUDE_DIRECTORIES "${MYSQLCLIENT_INCLUDE_DIR}" | ||
| 49 | INTERFACE_COMPILE_DEFINITIONS HAVE_MYSQL=1) | ||
| 50 | endif() | ||
| 51 | endif() | ||
| 52 | |||
| 53 | mark_as_advanced(MYSQLCLIENT_INCLUDE_DIR MYSQLCLIENT_LIBRARY) | ||
diff --git a/project/cmake/modules/FindNFS.cmake b/project/cmake/modules/FindNFS.cmake new file mode 100644 index 0000000..3fd9d61 --- /dev/null +++ b/project/cmake/modules/FindNFS.cmake | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindNFS | ||
| 3 | # ------- | ||
| 4 | # Finds the libnfs library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # NFS_FOUND - system has libnfs | ||
| 9 | # NFS_INCLUDE_DIRS - the libnfs include directory | ||
| 10 | # NFS_LIBRARIES - the libnfs libraries | ||
| 11 | # NFS_DEFINITIONS - the libnfs compile definitions | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # NFS::NFS - The libnfs library | ||
| 16 | |||
| 17 | if(PKG_CONFIG_FOUND) | ||
| 18 | pkg_check_modules(NFS libnfs QUIET) | ||
| 19 | endif() | ||
| 20 | |||
| 21 | find_path(NFS_INCLUDE_DIR nfsc/libnfs.h | ||
| 22 | PATHS ${PC_NFS_INCLUDEDIR}) | ||
| 23 | |||
| 24 | set(NFS_VERSION ${PC_NFS_VERSION}) | ||
| 25 | |||
| 26 | include(FindPackageHandleStandardArgs) | ||
| 27 | if(NOT WIN32) | ||
| 28 | find_library(NFS_LIBRARY NAMES nfs | ||
| 29 | PATHS ${PC_NFS_LIBDIR}) | ||
| 30 | |||
| 31 | find_package_handle_standard_args(NFS | ||
| 32 | REQUIRED_VARS NFS_LIBRARY NFS_INCLUDE_DIR | ||
| 33 | VERSION_VAR NFS_VERSION) | ||
| 34 | else() | ||
| 35 | # Dynamically loaded DLL | ||
| 36 | find_package_handle_standard_args(NFS | ||
| 37 | REQUIRED_VARS NFS_INCLUDE_DIR | ||
| 38 | VERSION_VAR NFS_VERSION) | ||
| 39 | endif() | ||
| 40 | |||
| 41 | if(NFS_FOUND) | ||
| 42 | set(NFS_LIBRARIES ${NFS_LIBRARY}) | ||
| 43 | set(NFS_INCLUDE_DIRS ${NFS_INCLUDE_DIR}) | ||
| 44 | set(NFS_DEFINITIONS -DHAVE_LIBNFS=1) | ||
| 45 | |||
| 46 | if(NOT TARGET NFS::NFS) | ||
| 47 | add_library(NFS::NFS UNKNOWN IMPORTED) | ||
| 48 | if(NFS_LIBRARY) | ||
| 49 | set_target_properties(NFS::NFS PROPERTIES | ||
| 50 | IMPORTED_LOCATION "${NFS_LIBRARY_RELEASE}") | ||
| 51 | endif() | ||
| 52 | set_target_properties(NFS::NFS PROPERTIES | ||
| 53 | INTERFACE_INCLUDE_DIRECTORIES "${NFS_INCLUDE_DIR}" | ||
| 54 | INTERFACE_COMPILE_DEFINITIONS HAVE_LIBNFS=1) | ||
| 55 | endif() | ||
| 56 | endif() | ||
| 57 | |||
| 58 | mark_as_advanced(NFS_INCLUDE_DIR NFS_LIBRARY) | ||
diff --git a/project/cmake/modules/FindOpenGLES.cmake b/project/cmake/modules/FindOpenGLES.cmake new file mode 100644 index 0000000..5d71dd4 --- /dev/null +++ b/project/cmake/modules/FindOpenGLES.cmake | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindOpenGLES | ||
| 3 | # ------------ | ||
| 4 | # Finds the OpenGLES2 library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # OPENGLES_FOUND - system has OpenGLES | ||
| 9 | # OPENGLES_INCLUDE_DIRS - the OpenGLES include directory | ||
| 10 | # OPENGLES_LIBRARIES - the OpenGLES libraries | ||
| 11 | # OPENGLES_DEFINITIONS - the OpenGLES definitions | ||
| 12 | |||
| 13 | find_package(EMBEDDED) | ||
| 14 | |||
| 15 | if(PKG_CONFIG_FOUND AND NOT PLATFORM STREQUAL "raspberry-pi") | ||
| 16 | pkg_check_modules(PC_OPENGLES glesv2) | ||
| 17 | if(NOT OPENGLES_FOUND AND EMBEDDED_FOUND) | ||
| 18 | set(CMAKE_PREFIX_PATH ${EMBEDDED_FOUND} ${CMAKE_PREFIX_PATH}) | ||
| 19 | endif() | ||
| 20 | endif() | ||
| 21 | |||
| 22 | if(NOT CORE_SYSTEM_NAME STREQUAL ios) | ||
| 23 | find_path(OPENGLES_INCLUDE_DIR GLES2/gl2.h | ||
| 24 | PATHS ${PC_OPENGLES_INCLUDEDIR}) | ||
| 25 | find_library(OPENGLES_gl_LIBRARY NAMES GLESv2 | ||
| 26 | PATHS ${PC_OPENGLES_LIBDIR}) | ||
| 27 | find_library(OPENGLES_egl_LIBRARY NAMES EGL | ||
| 28 | PATHS ${PC_OPENGLES_LIBDIR}) | ||
| 29 | else() | ||
| 30 | find_library(OPENGLES_gl_LIBRARY NAMES OpenGLES | ||
| 31 | PATHS ${CMAKE_OSX_SYSROOT}/System/Library | ||
| 32 | PATH_SUFFIXES Frameworks | ||
| 33 | NO_DEFAULT_PATH) | ||
| 34 | set(OPENGLES_INCLUDE_DIR ${OPENGLES_gl_LIBRARY}/Headers) | ||
| 35 | set(OPENGLES_egl_LIBRARY ${OPENGLES_gl_LIBRARY}) | ||
| 36 | endif() | ||
| 37 | |||
| 38 | include(FindPackageHandleStandardArgs) | ||
| 39 | find_package_handle_standard_args(OpenGLES | ||
| 40 | REQUIRED_VARS OPENGLES_gl_LIBRARY OPENGLES_egl_LIBRARY OPENGLES_INCLUDE_DIR) | ||
| 41 | |||
| 42 | if(OPENGLES_FOUND) | ||
| 43 | set(OPENGLES_INCLUDE_DIRS ${OPENGLES_INCLUDE_DIR}) | ||
| 44 | set(OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY} ${OPENGLES_egl_LIBRARY}) | ||
| 45 | set(OPENGLES_DEFINITIONS -DHAVE_LIBGLESV2 -DHAVE_LIBEGL=1) | ||
| 46 | endif() | ||
| 47 | |||
| 48 | mark_as_advanced(OPENGLES_INCLUDE_DIR OPENGLES_gl_LIBRARY OPENGLES_egl_LIBRARY) | ||
diff --git a/project/cmake/modules/FindOpenGl.cmake b/project/cmake/modules/FindOpenGl.cmake new file mode 100644 index 0000000..9d6ec01 --- /dev/null +++ b/project/cmake/modules/FindOpenGl.cmake | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindOpenGl | ||
| 3 | # ---------- | ||
| 4 | # Finds the FindOpenGl library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # OPENGL_FOUND - system has OpenGl | ||
| 9 | # OPENGL_INCLUDE_DIRS - the OpenGl include directory | ||
| 10 | # OPENGL_LIBRARIES - the OpenGl libraries | ||
| 11 | # OPENGL_DEFINITIONS - the OpenGl definitions | ||
| 12 | |||
| 13 | if(PKG_CONFIG_FOUND) | ||
| 14 | pkg_check_modules(PC_OPENGL gl glu) | ||
| 15 | endif() | ||
| 16 | |||
| 17 | if(NOT CORE_SYSTEM_NAME STREQUAL darwin) | ||
| 18 | find_path(OPENGL_INCLUDE_DIR GL/gl.h | ||
| 19 | PATHS ${PC_OPENGL_gl_INCLUDEDIR}) | ||
| 20 | find_library(OPENGL_gl_LIBRARY NAMES GL | ||
| 21 | PATHS ${PC_OPENGL_gl_LIBDIR}) | ||
| 22 | find_library(OPENGL_glu_LIBRARY NAMES GLU | ||
| 23 | PATHS ${PC_OPENGL_glu_LIBDIR}) | ||
| 24 | else() | ||
| 25 | find_library(OPENGL_gl_LIBRARY NAMES OpenGL | ||
| 26 | PATHS ${CMAKE_OSX_SYSROOT}/System/Library | ||
| 27 | PATH_SUFFIXES Frameworks | ||
| 28 | NO_DEFAULT_PATH) | ||
| 29 | set(OPENGL_INCLUDE_DIR ${OPENGL_gl_LIBRARY}/Headers) | ||
| 30 | set(OPENGL_glu_LIBRARY ${OPENGL_gl_LIBRARY}) | ||
| 31 | endif() | ||
| 32 | |||
| 33 | include(FindPackageHandleStandardArgs) | ||
| 34 | find_package_handle_standard_args(OpenGl | ||
| 35 | REQUIRED_VARS OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY OPENGL_INCLUDE_DIR) | ||
| 36 | |||
| 37 | if(OPENGL_FOUND) | ||
| 38 | set(OPENGL_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) | ||
| 39 | set(OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) | ||
| 40 | set(OPENGL_DEFINITIONS -DHAVE_LIBGL=1) | ||
| 41 | endif() | ||
| 42 | |||
| 43 | mark_as_advanced(OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY) | ||
diff --git a/project/cmake/modules/FindPCRE.cmake b/project/cmake/modules/FindPCRE.cmake new file mode 100644 index 0000000..54c4ab4 --- /dev/null +++ b/project/cmake/modules/FindPCRE.cmake | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindPCRE | ||
| 3 | # -------- | ||
| 4 | # Finds the PCRECPP library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # PCRE_FOUND - system has libpcrecpp | ||
| 9 | # PCRE_INCLUDE_DIRS - the libpcrecpp include directory | ||
| 10 | # PCRE_LIBRARIES - the libpcrecpp libraries | ||
| 11 | # PCRE_DEFINITIONS - the libpcrecpp definitions | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # PCRE::PCRECPP - The PCRECPP library | ||
| 16 | # PCRE::PCRE - The PCRE library | ||
| 17 | |||
| 18 | if(PKG_CONFIG_FOUND) | ||
| 19 | pkg_check_modules(PC_PCRE libpcrecpp QUIET) | ||
| 20 | endif() | ||
| 21 | |||
| 22 | find_path(PCRE_INCLUDE_DIR pcrecpp.h | ||
| 23 | PATHS ${PC_PCRE_INCLUDEDIR}) | ||
| 24 | find_library(PCRECPP_LIBRARY_RELEASE NAMES pcrecpp | ||
| 25 | PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} | ||
| 26 | PATHS ${PC_PCRE_LIBDIR}) | ||
| 27 | find_library(PCRE_LIBRARY_RELEASE NAMES pcre | ||
| 28 | PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} | ||
| 29 | PATHS ${PC_PCRE_LIBDIR}) | ||
| 30 | find_library(PCRECPP_LIBRARY_DEBUG NAMES pcrecppd | ||
| 31 | PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} | ||
| 32 | PATHS ${PC_PCRE_LIBDIR}) | ||
| 33 | find_library(PCRE_LIBRARY_DEBUG NAMES pcred | ||
| 34 | PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} | ||
| 35 | PATHS ${PC_PCRE_LIBDIR}) | ||
| 36 | set(PCRE_VERSION ${PC_PCRE_VERSION}) | ||
| 37 | |||
| 38 | include(SelectLibraryConfigurations) | ||
| 39 | select_library_configurations(PCRECPP) | ||
| 40 | select_library_configurations(PCRE) | ||
| 41 | |||
| 42 | include(FindPackageHandleStandardArgs) | ||
| 43 | find_package_handle_standard_args(PCRE | ||
| 44 | REQUIRED_VARS PCRECPP_LIBRARY PCRE_LIBRARY PCRE_INCLUDE_DIR | ||
| 45 | VERSION_VAR PCRE_VERSION) | ||
| 46 | |||
| 47 | if(PCRE_FOUND) | ||
| 48 | set(PCRE_LIBRARIES ${PCRECPP_LIBRARY} ${PCRE_LIBRARY}) | ||
| 49 | set(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR}) | ||
| 50 | if(WIN32) | ||
| 51 | set(PCRE_DEFINITIONS -DPCRE_STATIC=1) | ||
| 52 | endif() | ||
| 53 | |||
| 54 | if(NOT TARGET PCRE::PCRE) | ||
| 55 | add_library(PCRE::PCRE UNKNOWN IMPORTED) | ||
| 56 | if(PCRE_LIBRARY_RELEASE) | ||
| 57 | set_target_properties(PCRE::PCRE PROPERTIES | ||
| 58 | IMPORTED_CONFIGURATIONS RELEASE | ||
| 59 | IMPORTED_LOCATION "${PCRE_LIBRARY_RELEASE}") | ||
| 60 | endif() | ||
| 61 | if(PCRE_LIBRARY_DEBUG) | ||
| 62 | set_target_properties(PCRE::PCRE PROPERTIES | ||
| 63 | IMPORTED_CONFIGURATIONS DEBUG | ||
| 64 | IMPORTED_LOCATION "${PCRE_LIBRARY_DEBUG}") | ||
| 65 | endif() | ||
| 66 | set_target_properties(PCRE::PCRE PROPERTIES | ||
| 67 | INTERFACE_INCLUDE_DIRECTORIES "${PCRE_INCLUDE_DIR}") | ||
| 68 | if(WIN32) | ||
| 69 | set_target_properties(PCRE::PCRE PROPERTIES | ||
| 70 | INTERFACE_COMPILE_DEFINITIONS PCRE_STATIC=1) | ||
| 71 | endif() | ||
| 72 | |||
| 73 | endif() | ||
| 74 | if(NOT TARGET PCRE::PCRECPP) | ||
| 75 | add_library(PCRE::PCRECPP UNKNOWN IMPORTED) | ||
| 76 | if(PCRE_LIBRARY_RELEASE) | ||
| 77 | set_target_properties(PCRE::PCRECPP PROPERTIES | ||
| 78 | IMPORTED_CONFIGURATIONS RELEASE | ||
| 79 | IMPORTED_LOCATION "${PCRECPP_LIBRARY_RELEASE}") | ||
| 80 | endif() | ||
| 81 | if(PCRE_LIBRARY_DEBUG) | ||
| 82 | set_target_properties(PCRE::PCRECPP PROPERTIES | ||
| 83 | IMPORTED_CONFIGURATIONS DEBUG | ||
| 84 | IMPORTED_LOCATION "${PCRECPP_LIBRARY_DEBUG}") | ||
| 85 | endif() | ||
| 86 | set_target_properties(PCRE::PCRECPP PROPERTIES | ||
| 87 | INTERFACE_LINK_LIBRARIES PCRE::PCRE) | ||
| 88 | endif() | ||
| 89 | endif() | ||
| 90 | |||
| 91 | mark_as_advanced(PCRE_INCLUDE_DIR PCRECPP_LIBRARY PCRE_LIBRARY) | ||
diff --git a/project/cmake/modules/FindPlist.cmake b/project/cmake/modules/FindPlist.cmake new file mode 100644 index 0000000..d7a6c48 --- /dev/null +++ b/project/cmake/modules/FindPlist.cmake | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindPlist | ||
| 3 | # --------- | ||
| 4 | # Finds the Plist library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # PLIST_FOUND - system has Plist library | ||
| 9 | # PLIST_INCLUDE_DIRS - the Plist library include directory | ||
| 10 | # PLIST_LIBRARIES - the Plist libraries | ||
| 11 | # PLIST_DEFINITIONS - the Plist compile definitions | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # Plist::Plist - The Plist library | ||
| 16 | |||
| 17 | if(PKG_CONFIG_FOUND) | ||
| 18 | pkg_check_modules(PC_PLIST libplist QUIET) | ||
| 19 | endif() | ||
| 20 | |||
| 21 | find_path(PLIST_INCLUDE_DIR plist/plist.h | ||
| 22 | PATHS ${PC_PLIST_INCLUDEDIR}) | ||
| 23 | |||
| 24 | set(PLIST_VERSION ${PC_PLIST_VERSION}) | ||
| 25 | |||
| 26 | include(FindPackageHandleStandardArgs) | ||
| 27 | if(NOT WIN32) | ||
| 28 | find_library(PLIST_LIBRARY NAMES plist | ||
| 29 | PATHS ${PC_PLIST_LIBDIR}) | ||
| 30 | |||
| 31 | find_package_handle_standard_args(PLIST | ||
| 32 | REQUIRED_VARS PLIST_LIBRARY PLIST_INCLUDE_DIR | ||
| 33 | VERSION_VAR PLIST_VERSION) | ||
| 34 | else() | ||
| 35 | # Dynamically loaded DLL | ||
| 36 | find_package_handle_standard_args(PLIST | ||
| 37 | REQUIRED_VARS PLIST_INCLUDE_DIR | ||
| 38 | VERSION_VAR PLIST_VERSION) | ||
| 39 | endif() | ||
| 40 | |||
| 41 | if(PLIST_FOUND) | ||
| 42 | set(PLIST_LIBRARIES ${PLIST_LIBRARY}) | ||
| 43 | set(PLIST_INCLUDE_DIRS ${PLIST_INCLUDE_DIR}) | ||
| 44 | set(PLIST_DEFINITIONS -DHAVE_LIBPLIST=1) | ||
| 45 | |||
| 46 | if(NOT TARGET Plist::Plist) | ||
| 47 | add_library(Plist::Plist UNKNOWN IMPORTED) | ||
| 48 | if(PLIST_LIBRARY) | ||
| 49 | set_target_properties(Plist::Plist PROPERTIES | ||
| 50 | IMPORTED_LOCATION "${PLIST_LIBRARY}") | ||
| 51 | endif() | ||
| 52 | set_target_properties(Plist::Plist PROPERTIES | ||
| 53 | INTERFACE_INCLUDE_DIRECTORIES "${PLIST_INCLUDE_DIR}" | ||
| 54 | INTERFACE_COMPILE_DEFINITIONS HAVE_LIBPLIST=1) | ||
| 55 | endif() | ||
| 56 | endif() | ||
| 57 | |||
| 58 | mark_as_advanced(PLIST_INCLUDE_DIR PLIST_LIBRARY) | ||
diff --git a/project/cmake/modules/FindPulseAudio.cmake b/project/cmake/modules/FindPulseAudio.cmake new file mode 100644 index 0000000..5b57364 --- /dev/null +++ b/project/cmake/modules/FindPulseAudio.cmake | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | # Try to find the PulseAudio library | ||
| 2 | # | ||
| 3 | # Once done this will define: | ||
| 4 | # | ||
| 5 | # PULSEAUDIO_FOUND - system has the PulseAudio library | ||
| 6 | # PULSEAUDIO_INCLUDE_DIR - the PulseAudio include directory | ||
| 7 | # PULSEAUDIO_LIBRARY - the libraries needed to use PulseAudio | ||
| 8 | # PULSEAUDIO_MAINLOOP_LIBRARY - the libraries needed to use PulsAudio Mailoop | ||
| 9 | # | ||
| 10 | # Copyright (c) 2008, Matthias Kretz, <kretz@kde.org> | ||
| 11 | # Copyright (c) 2009, Marcus Hufgard, <Marcus.Hufgard@hufgard.de> | ||
| 12 | # | ||
| 13 | # Redistribution and use is allowed according to the terms of the BSD license. | ||
| 14 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
| 15 | |||
| 16 | if (NOT PULSEAUDIO_MINIMUM_VERSION) | ||
| 17 | set(PULSEAUDIO_MINIMUM_VERSION "1.0.0") | ||
| 18 | endif (NOT PULSEAUDIO_MINIMUM_VERSION) | ||
| 19 | |||
| 20 | if (PULSEAUDIO_INCLUDE_DIRS AND PULSEAUDIO_LIBRARY AND PULSEAUDIO_MAINLOOP_LIBRARY) | ||
| 21 | # Already in cache, be silent | ||
| 22 | set(PULSEAUDIO_FIND_QUIETLY TRUE) | ||
| 23 | endif (PULSEAUDIO_INCLUDE_DIRS AND PULSEAUDIO_LIBRARY AND PULSEAUDIO_MAINLOOP_LIBRARY) | ||
| 24 | |||
| 25 | if (NOT WIN32) | ||
| 26 | include(FindPkgConfig) | ||
| 27 | pkg_check_modules(PC_PULSEAUDIO libpulse>=${PULSEAUDIO_MINIMUM_VERSION}) | ||
| 28 | pkg_check_modules(PC_PULSEAUDIO_MAINLOOP libpulse-mainloop-glib) | ||
| 29 | endif (NOT WIN32) | ||
| 30 | |||
| 31 | FIND_PATH(PULSEAUDIO_INCLUDE_DIRS pulse/pulseaudio.h | ||
| 32 | HINTS | ||
| 33 | ${PC_PULSEAUDIO_INCLUDEDIR} | ||
| 34 | ${PC_PULSEAUDIO_INCLUDE_DIRS} | ||
| 35 | ) | ||
| 36 | |||
| 37 | FIND_LIBRARY(PULSEAUDIO_LIBRARY NAMES pulse libpulse | ||
| 38 | HINTS | ||
| 39 | ${PC_PULSEAUDIO_LIBDIR} | ||
| 40 | ${PC_PULSEAUDIO_LIBRARY_DIRS} | ||
| 41 | ) | ||
| 42 | |||
| 43 | FIND_LIBRARY(PULSEAUDIO_MAINLOOP_LIBRARY NAMES pulse-mainloop pulse-mainloop-glib libpulse-mainloop-glib | ||
| 44 | HINTS | ||
| 45 | ${PC_PULSEAUDIO_LIBDIR} | ||
| 46 | ${PC_PULSEAUDIO_LIBRARY_DIRS} | ||
| 47 | ) | ||
| 48 | |||
| 49 | if (NOT PULSEAUDIO_INCLUDE_DIRS OR NOT PULSEAUDIO_LIBRARY) | ||
| 50 | set(PULSEAUDIO_FOUND FALSE) | ||
| 51 | else() | ||
| 52 | set(PULSEAUDIO_FOUND TRUE) | ||
| 53 | endif() | ||
| 54 | |||
| 55 | if (PULSEAUDIO_FOUND) | ||
| 56 | if (NOT PULSEAUDIO_FIND_QUIETLY) | ||
| 57 | message(STATUS "Found PulseAudio: ${PULSEAUDIO_LIBRARY}") | ||
| 58 | if (PULSEAUDIO_MAINLOOP_LIBRARY) | ||
| 59 | message(STATUS "Found PulseAudio Mainloop: ${PULSEAUDIO_MAINLOOP_LIBRARY}") | ||
| 60 | else (PULSAUDIO_MAINLOOP_LIBRARY) | ||
| 61 | message(STATUS "Could NOT find PulseAudio Mainloop Library") | ||
| 62 | endif (PULSEAUDIO_MAINLOOP_LIBRARY) | ||
| 63 | endif (NOT PULSEAUDIO_FIND_QUIETLY) | ||
| 64 | else (PULSEAUDIO_FOUND) | ||
| 65 | message(STATUS "Could NOT find PulseAudio") | ||
| 66 | endif (PULSEAUDIO_FOUND) | ||
| 67 | |||
| 68 | set(PULSEAUDIO_LIBRARIES ${PULSEAUDIO_LIBRARY}) | ||
| 69 | |||
| 70 | list(APPEND PULSEAUDIO_DEFINITIONS -DHAVE_LIBPULSE=1) | ||
| 71 | |||
| 72 | mark_as_advanced(PULSEAUDIO_INCLUDE_DIRS PULSEAUDIO_LIBRARIES PULSEAUDIO_LIBRARY PULSEAUDIO_MAINLOOP_LIBRARY) | ||
diff --git a/project/cmake/modules/FindPython.cmake b/project/cmake/modules/FindPython.cmake new file mode 100644 index 0000000..6f9f236 --- /dev/null +++ b/project/cmake/modules/FindPython.cmake | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | # - Try to find python | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # PYTHON_FOUND - system has PYTHON | ||
| 5 | # PYTHON_INCLUDE_DIRS - the python include directory | ||
| 6 | # PYTHON_LIBRARIES - The python libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND AND NOT CMAKE_CROSSCOMPILING) | ||
| 9 | pkg_check_modules (PYTHON python) | ||
| 10 | endif() | ||
| 11 | |||
| 12 | if(NOT PYTHON_FOUND) | ||
| 13 | if(CMAKE_CROSSCOMPILING) | ||
| 14 | find_program(PYTHON_EXECUTABLE python ONLY_CMAKE_FIND_ROOT_PATH) | ||
| 15 | find_library(PYTHON_LIBRARY NAMES python2.6 python2.7) | ||
| 16 | find_path(PYTHON_INCLUDE_DIRS NAMES Python.h PATHS ${DEPENDS_PATH}/include/python2.6 ${DEPENDS_PATH}/include/python2.7) | ||
| 17 | set(PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIRS} CACHE PATH "python include dir" FORCE) | ||
| 18 | |||
| 19 | find_library(FFI_LIBRARY ffi) | ||
| 20 | find_library(EXPAT_LIBRARY expat) | ||
| 21 | find_library(INTL_LIBRARY intl) | ||
| 22 | |||
| 23 | if(NOT CORE_SYSTEM_NAME STREQUAL android) | ||
| 24 | set(PYTHON_DEP_LIBRARIES -lpthread -ldl -lutil) | ||
| 25 | endif() | ||
| 26 | |||
| 27 | set(PYTHON_LIBRARIES ${PYTHON_LIBRARY} ${FFI_LIBRARY} ${EXPAT_LIBRARY} ${INTL_LIBRARY} ${PYTHON_DEP_LIBRARIES} | ||
| 28 | CACHE INTERNAL "python libraries" FORCE) | ||
| 29 | else() | ||
| 30 | find_package(PythonLibs) | ||
| 31 | endif() | ||
| 32 | endif() | ||
| 33 | |||
| 34 | include(FindPackageHandleStandardArgs) | ||
| 35 | find_package_handle_standard_args(Python DEFAULT_MSG PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES) | ||
| 36 | |||
| 37 | if(CMAKE_SYSTEM_NAME STREQUAL Darwin) | ||
| 38 | find_library(FFI_LIBRARY ffi REQUIRED) | ||
| 39 | find_library(INTL_LIBRARY intl) | ||
| 40 | list(APPEND PYTHON_LIBRARIES ${FFI_LIBRARY} ${INTL_LIBRARY}) | ||
| 41 | endif() | ||
| 42 | |||
| 43 | mark_as_advanced(PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES PYTHON_LDFLAGS) | ||
diff --git a/project/cmake/modules/FindRTMP.cmake b/project/cmake/modules/FindRTMP.cmake new file mode 100644 index 0000000..432b77d --- /dev/null +++ b/project/cmake/modules/FindRTMP.cmake | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | # - Try to find rtmp | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # RTMP_FOUND - system has librtmp | ||
| 5 | # RTMP_INCLUDE_DIRS - the librtmp include directory | ||
| 6 | # RTMP_LIBRARIES - The librtmp libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (RTMP librtmp) | ||
| 10 | list(APPEND RTMP_INCLUDE_DIRS ${RTMP_INCLUDEDIR}) | ||
| 11 | else() | ||
| 12 | find_path(RTMP_INCLUDE_DIRS librtmp/rtmp.h) | ||
| 13 | find_library(RTMP_LIBRARIES rtmp) | ||
| 14 | endif() | ||
| 15 | |||
| 16 | include(FindPackageHandleStandardArgs) | ||
| 17 | find_package_handle_standard_args(RTMP DEFAULT_MSG RTMP_INCLUDE_DIRS RTMP_LIBRARIES) | ||
| 18 | |||
| 19 | list(APPEND RTMP_DEFINITIONS -DHAS_LIBRTMP=1) | ||
| 20 | |||
| 21 | mark_as_advanced(RTMP_INCLUDE_DIRS RTMP_LIBRARIES RTMP_DEFINITIONS) | ||
diff --git a/project/cmake/modules/FindSSE.cmake b/project/cmake/modules/FindSSE.cmake new file mode 100644 index 0000000..c76b811 --- /dev/null +++ b/project/cmake/modules/FindSSE.cmake | |||
| @@ -0,0 +1,105 @@ | |||
| 1 | # Check if SSE instructions are available on the machine where | ||
| 2 | # the project is compiled. | ||
| 3 | |||
| 4 | IF(CMAKE_SYSTEM_NAME MATCHES "Linux") | ||
| 5 | EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO) | ||
| 6 | |||
| 7 | STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE ${CPUINFO}) | ||
| 8 | STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE) | ||
| 9 | IF (SSE2_TRUE) | ||
| 10 | set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") | ||
| 11 | ELSE (SSE2_TRUE) | ||
| 12 | set(SSE2_FOUND false CACHE BOOL "SSE2 available on host") | ||
| 13 | ENDIF (SSE2_TRUE) | ||
| 14 | |||
| 15 | # /proc/cpuinfo apparently omits sse3 :( | ||
| 16 | STRING(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" SSE_THERE ${CPUINFO}) | ||
| 17 | STRING(COMPARE EQUAL "sse3" "${SSE_THERE}" SSE3_TRUE) | ||
| 18 | IF (NOT SSE3_TRUE) | ||
| 19 | STRING(REGEX REPLACE "^.*(T2300).*$" "\\1" SSE_THERE ${CPUINFO}) | ||
| 20 | STRING(COMPARE EQUAL "T2300" "${SSE_THERE}" SSE3_TRUE) | ||
| 21 | ENDIF (NOT SSE3_TRUE) | ||
| 22 | |||
| 23 | STRING(REGEX REPLACE "^.*(ssse3).*$" "\\1" SSE_THERE ${CPUINFO}) | ||
| 24 | STRING(COMPARE EQUAL "ssse3" "${SSE_THERE}" SSSE3_TRUE) | ||
| 25 | IF (SSE3_TRUE OR SSSE3_TRUE) | ||
| 26 | set(SSE3_FOUND true CACHE BOOL "SSE3 available on host") | ||
| 27 | ELSE (SSE3_TRUE OR SSSE3_TRUE) | ||
| 28 | set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") | ||
| 29 | ENDIF (SSE3_TRUE OR SSSE3_TRUE) | ||
| 30 | IF (SSSE3_TRUE) | ||
| 31 | set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host") | ||
| 32 | ELSE (SSSE3_TRUE) | ||
| 33 | set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") | ||
| 34 | ENDIF (SSSE3_TRUE) | ||
| 35 | |||
| 36 | STRING(REGEX REPLACE "^.*(sse4_1).*$" "\\1" SSE_THERE ${CPUINFO}) | ||
| 37 | STRING(COMPARE EQUAL "sse4_1" "${SSE_THERE}" SSE41_TRUE) | ||
| 38 | IF (SSE41_TRUE) | ||
| 39 | set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host") | ||
| 40 | ELSE (SSE41_TRUE) | ||
| 41 | set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") | ||
| 42 | ENDIF (SSE41_TRUE) | ||
| 43 | ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") | ||
| 44 | EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE | ||
| 45 | CPUINFO) | ||
| 46 | |||
| 47 | STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE ${CPUINFO}) | ||
| 48 | STRING(COMPARE EQUAL "SSE2" "${SSE_THERE}" SSE2_TRUE) | ||
| 49 | IF (SSE2_TRUE) | ||
| 50 | set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") | ||
| 51 | ELSE (SSE2_TRUE) | ||
| 52 | set(SSE2_FOUND false CACHE BOOL "SSE2 available on host") | ||
| 53 | ENDIF (SSE2_TRUE) | ||
| 54 | |||
| 55 | STRING(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" SSE_THERE ${CPUINFO}) | ||
| 56 | STRING(COMPARE EQUAL "SSE3" "${SSE_THERE}" SSE3_TRUE) | ||
| 57 | IF (SSE3_TRUE) | ||
| 58 | set(SSE3_FOUND true CACHE BOOL "SSE3 available on host") | ||
| 59 | ELSE (SSE3_TRUE) | ||
| 60 | set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") | ||
| 61 | ENDIF (SSE3_TRUE) | ||
| 62 | |||
| 63 | STRING(REGEX REPLACE "^.*(SSSE3).*$" "\\1" SSE_THERE ${CPUINFO}) | ||
| 64 | STRING(COMPARE EQUAL "SSSE3" "${SSE_THERE}" SSSE3_TRUE) | ||
| 65 | IF (SSSE3_TRUE) | ||
| 66 | set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host") | ||
| 67 | ELSE (SSSE3_TRUE) | ||
| 68 | set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") | ||
| 69 | ENDIF (SSSE3_TRUE) | ||
| 70 | |||
| 71 | STRING(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" SSE_THERE ${CPUINFO}) | ||
| 72 | STRING(COMPARE EQUAL "SSE4.1" "${SSE_THERE}" SSE41_TRUE) | ||
| 73 | IF (SSE41_TRUE) | ||
| 74 | set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host") | ||
| 75 | ELSE (SSE41_TRUE) | ||
| 76 | set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") | ||
| 77 | ENDIF (SSE41_TRUE) | ||
| 78 | ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows") | ||
| 79 | # TODO | ||
| 80 | set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") | ||
| 81 | set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") | ||
| 82 | set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") | ||
| 83 | set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") | ||
| 84 | ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux") | ||
| 85 | set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") | ||
| 86 | set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") | ||
| 87 | set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") | ||
| 88 | set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") | ||
| 89 | ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") | ||
| 90 | |||
| 91 | if(NOT SSE2_FOUND) | ||
| 92 | MESSAGE(STATUS "Could not find hardware support for SSE2 on this machine.") | ||
| 93 | endif(NOT SSE2_FOUND) | ||
| 94 | if(NOT SSE3_FOUND) | ||
| 95 | MESSAGE(STATUS "Could not find hardware support for SSE3 on this machine.") | ||
| 96 | endif(NOT SSE3_FOUND) | ||
| 97 | if(NOT SSSE3_FOUND) | ||
| 98 | MESSAGE(STATUS "Could not find hardware support for SSSE3 on this machine.") | ||
| 99 | endif(NOT SSSE3_FOUND) | ||
| 100 | if(NOT SSE4_1_FOUND) | ||
| 101 | MESSAGE(STATUS "Could not find hardware support for SSE4.1 on this machine.") | ||
| 102 | endif(NOT SSE4_1_FOUND) | ||
| 103 | |||
| 104 | mark_as_advanced(SSE2_FOUND SSE3_FOUND SSSE3_FOUND SSE4_1_FOUND) | ||
| 105 | |||
diff --git a/project/cmake/modules/FindSSH.cmake b/project/cmake/modules/FindSSH.cmake new file mode 100644 index 0000000..60c3537 --- /dev/null +++ b/project/cmake/modules/FindSSH.cmake | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | # - Try to find libssh | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # SSH_FOUND - system has libssh | ||
| 5 | # SSH_INCLUDE_DIRS - the libssh include directory | ||
| 6 | # SSH_LIBRARIES - The libssh libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (SSH libssh) | ||
| 10 | list(APPEND SSH_INCLUDE_DIRS /usr/include) | ||
| 11 | else() | ||
| 12 | find_path(SSH_INCLUDE_DIRS libssh/libssh.h) | ||
| 13 | find_library(SSH_LIBRARIES ssh) | ||
| 14 | endif() | ||
| 15 | |||
| 16 | include(FindPackageHandleStandardArgs) | ||
| 17 | find_package_handle_standard_args(SSH DEFAULT_MSG SSH_INCLUDE_DIRS SSH_LIBRARIES) | ||
| 18 | |||
| 19 | list(APPEND SSH_DEFINITIONS -DHAVE_LIBSSH=1) | ||
| 20 | |||
| 21 | mark_as_advanced(SSH_INCLUDE_DIRS SSH_LIBRARIES SSH_DEFINITIONS) | ||
diff --git a/project/cmake/modules/FindSWIG.cmake b/project/cmake/modules/FindSWIG.cmake new file mode 100644 index 0000000..84c7a51 --- /dev/null +++ b/project/cmake/modules/FindSWIG.cmake | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | if(NOT SWIG_EXECUTABLE) | ||
| 2 | find_program(SWIG_EXECUTABLE NAMES swig2.0 swig PATH_SUFFIXES swig) | ||
| 3 | endif() | ||
| 4 | if(SWIG_EXECUTABLE) | ||
| 5 | execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib | ||
| 6 | OUTPUT_VARIABLE SWIG_DIR | ||
| 7 | ERROR_VARIABLE SWIG_swiglib_error | ||
| 8 | RESULT_VARIABLE SWIG_swiglib_result) | ||
| 9 | endif() | ||
| 10 | |||
| 11 | |||
| 12 | include(FindPackageHandleStandardArgs) | ||
| 13 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWIG REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR | ||
| 14 | VERSION_VAR SWIG_VERSION ) | ||
diff --git a/project/cmake/modules/FindSdl.cmake b/project/cmake/modules/FindSdl.cmake new file mode 100644 index 0000000..91bcac5 --- /dev/null +++ b/project/cmake/modules/FindSdl.cmake | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindSDL | ||
| 3 | # ------- | ||
| 4 | # Finds the SDL library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # SDL_FOUND - system has SDL | ||
| 9 | # SDL_INCLUDE_DIRS - the SDL include directory | ||
| 10 | # SDL_LIBRARIES - the SDL libraries | ||
| 11 | # SDL_DEFINITIONS - the SDL compile definitions | ||
| 12 | |||
| 13 | if(PKG_CONFIG_FOUND) | ||
| 14 | pkg_check_modules(PC_SDL2 sdl2 QUIET) | ||
| 15 | if(PC_SDL2_FOUND) | ||
| 16 | set(SDL_VERSION ${PC_SDL2_VERSION}) | ||
| 17 | else() | ||
| 18 | pkg_check_modules(PC_SDL1 sdl QUIET) | ||
| 19 | if(PC_SDL1_FOUND) | ||
| 20 | set(SDL_VERSION ${PC_SDL1_VERSION}) | ||
| 21 | endif() | ||
| 22 | endif() | ||
| 23 | endif() | ||
| 24 | |||
| 25 | find_path(SDL_INCLUDE_DIR SDL/SDL.h | ||
| 26 | PATHS ${PC_SDL2_INCLUDE_DIR} ${PC_SDL1_INCLUDE_DIR}) | ||
| 27 | find_library(SDL_LIBRARY NAMES SDL2 SDL | ||
| 28 | PATHS ${PC_SDL2_LIBDIR} ${PC_SDL1_LIBDIR}) | ||
| 29 | |||
| 30 | include(FindPackageHandleStandardArgs) | ||
| 31 | find_package_handle_standard_args(Sdl REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR | ||
| 32 | VERSION_VAR SDL_VERSION) | ||
| 33 | |||
| 34 | if(SDL_FOUND) | ||
| 35 | set(SDL_LIBRARIES ${SDL_LIBRARY}) | ||
| 36 | set(SDL_INCLUDE_DIRS ${SDL_INCLUDE_DIR}) | ||
| 37 | set(SDL_DEFINITIONS -DHAVE_SDL=1) | ||
| 38 | |||
| 39 | if(SDL_VERSION VERSION_GREATER 2) | ||
| 40 | list(APPEND SDL_DEFINITIONS -DHAVE_SDL_VERSION=2) | ||
| 41 | elseif(SDL_VERSION VERSION_GREATER 1) | ||
| 42 | list(APPEND SDL_DEFINITIONS -DHAVE_SDL_VERSION=1) | ||
| 43 | endif() | ||
| 44 | endif() | ||
| 45 | |||
| 46 | mark_as_advanced(SDL_LIBRARY SDL_INCLUDE_DIR) | ||
diff --git a/project/cmake/modules/FindShairplay.cmake b/project/cmake/modules/FindShairplay.cmake new file mode 100644 index 0000000..4804686 --- /dev/null +++ b/project/cmake/modules/FindShairplay.cmake | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindShairplay | ||
| 3 | # ------------- | ||
| 4 | # Finds the Shairplay library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # SHAIRPLAY_FOUND - system has Shairplay | ||
| 9 | # SHAIRPLAY_INCLUDE_DIRS - the Shairplay include directory | ||
| 10 | # SHAIRPLAY_LIBRARIES - the Shairplay libraries | ||
| 11 | # SHAIRPLAY_DEFINITIONS - the Shairplay compile definitions | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # Shairplay::Shairplay - The Shairplay library | ||
| 16 | |||
| 17 | find_path(SHAIRPLAY_INCLUDE_DIR shairplay/raop.h) | ||
| 18 | |||
| 19 | include(FindPackageHandleStandardArgs) | ||
| 20 | if(NOT WIN32) | ||
| 21 | find_library(SHAIRPLAY_LIBRARY NAMES shairplay) | ||
| 22 | |||
| 23 | if(SHAIRPLAY_INCLUDE_DIR AND SHAIRPLAY_LIBRARY) | ||
| 24 | include(CheckCSourceCompiles) | ||
| 25 | set(CMAKE_REQUIRED_INCLUDES ${SHAIRPLAY_INCLUDE_DIRS}) | ||
| 26 | set(CMAKE_REQUIRED_LIBRARIES ${SHAIRPLAY_LIBRARIES}) | ||
| 27 | check_c_source_compiles("#include <shairplay/raop.h> | ||
| 28 | |||
| 29 | int main() | ||
| 30 | { | ||
| 31 | struct raop_callbacks_s foo; | ||
| 32 | foo.cls; | ||
| 33 | return 0; | ||
| 34 | } | ||
| 35 | " HAVE_SHAIRPLAY_CALLBACK_CLS) | ||
| 36 | endif() | ||
| 37 | |||
| 38 | find_package_handle_standard_args(SHAIRPLAY | ||
| 39 | REQUIRED_VARS SHAIRPLAY_LIBRARY SHAIRPLAY_INCLUDE_DIR HAVE_SHAIRPLAY_CALLBACK_CLS) | ||
| 40 | else() | ||
| 41 | # Dynamically loaded DLL | ||
| 42 | find_package_handle_standard_args(SHAIRPLAY | ||
| 43 | REQUIRED_VARS SHAIRPLAY_INCLUDE_DIR) | ||
| 44 | endif() | ||
| 45 | |||
| 46 | if(SHAIRPLAY_FOUND) | ||
| 47 | set(SHAIRPLAY_LIBRARIES ${SHAIRPLAY_LIBRARY}) | ||
| 48 | set(SHAIRPLAY_INCLUDE_DIRS ${SHAIRPLAY_INCLUDE_DIR}) | ||
| 49 | set(SHAIRPLAY_DEFINITIONS -DHAVE_LIBSHAIRPLAY=1) | ||
| 50 | |||
| 51 | if(NOT TARGET Shairplay::Shairplay) | ||
| 52 | add_library(Shairplay::Shairplay UNKNOWN IMPORTED) | ||
| 53 | if(SHAIRPLAY_LIBRARY) | ||
| 54 | set_target_properties(Shairplay::Shairplay PROPERTIES | ||
| 55 | IMPORTED_LOCATION "${SHAIRPLAY_LIBRARY}") | ||
| 56 | endif() | ||
| 57 | set_target_properties(Shairplay::Shairplay PROPERTIES | ||
| 58 | INTERFACE_INCLUDE_DIRECTORIES "${SHAIRPLAY_INCLUDE_DIR}" | ||
| 59 | INTERFACE_COMPILE_DEFINITIONS HAVE_LIBSHAIRPLAY=1) | ||
| 60 | endif() | ||
| 61 | endif() | ||
| 62 | |||
| 63 | mark_as_advanced(SHAIRPLAY_INCLUDE_DIR SHAIRPLAY_LIBRARY) | ||
diff --git a/project/cmake/modules/FindSqlite3.cmake b/project/cmake/modules/FindSqlite3.cmake new file mode 100644 index 0000000..a47944e --- /dev/null +++ b/project/cmake/modules/FindSqlite3.cmake | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | # - Try to find SQLITE3 | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # SQLITE3_FOUND - system has sqlite3 | ||
| 5 | # SQLITE3_INCLUDE_DIRS - the sqlite3 include directory | ||
| 6 | # SQLITE3_LIBRARIES - The sqlite3 libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (SQLITE3 sqlite3) | ||
| 10 | list(APPEND SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDEDIR}) | ||
| 11 | else() | ||
| 12 | find_path(SQLITE3_INCLUDE_DIRS sqlite3.h) | ||
| 13 | find_library(SQLITE3_LIBRARIES sqlite3) | ||
| 14 | endif() | ||
| 15 | |||
| 16 | include(FindPackageHandleStandardArgs) | ||
| 17 | find_package_handle_standard_args(Sqlite3 DEFAULT_MSG SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES) | ||
| 18 | |||
| 19 | mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES) | ||
diff --git a/project/cmake/modules/FindTagLib.cmake b/project/cmake/modules/FindTagLib.cmake new file mode 100644 index 0000000..b515e81 --- /dev/null +++ b/project/cmake/modules/FindTagLib.cmake | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindTagLib | ||
| 3 | # ---------- | ||
| 4 | # Finds the TagLib library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # TAGLIB_FOUND - system has TagLib | ||
| 9 | # TAGLIB_INCLUDE_DIRS - the TagLib include directory | ||
| 10 | # TAGLIB_LIBRARIES - the TagLib libraries | ||
| 11 | # | ||
| 12 | # and the following imported targets:: | ||
| 13 | # | ||
| 14 | # TagLib::TagLib - The TagLib library | ||
| 15 | |||
| 16 | if(PKG_CONFIG_FOUND) | ||
| 17 | pkg_check_modules(PC_TAGLIB taglib>=1.8.0 QUIET) | ||
| 18 | endif() | ||
| 19 | |||
| 20 | find_path(TAGLIB_INCLUDE_DIR taglib/tag.h | ||
| 21 | PATHS ${PC_TAGLIB_INCLUDEDIR}) | ||
| 22 | find_library(TAGLIB_LIBRARY_RELEASE NAMES tag | ||
| 23 | PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} | ||
| 24 | PATHS ${PC_TAGLIB_LIBDIR}) | ||
| 25 | find_library(TAGLIB_LIBRARY_DEBUG NAMES tag | ||
| 26 | PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} | ||
| 27 | PATHS ${PC_TAGLIB_LIBDIR}) | ||
| 28 | set(TAGLIB_VERSION ${PC_TAGLIB_VERSION}) | ||
| 29 | |||
| 30 | include(SelectLibraryConfigurations) | ||
| 31 | select_library_configurations(TAGLIB) | ||
| 32 | |||
| 33 | include(FindPackageHandleStandardArgs) | ||
| 34 | find_package_handle_standard_args(TAGLIB | ||
| 35 | REQUIRED_VARS TAGLIB_LIBRARY TAGLIB_INCLUDE_DIR | ||
| 36 | VERSION_VAR TAGLIB_VERSION) | ||
| 37 | |||
| 38 | if(TAGLIB_FOUND) | ||
| 39 | set(TAGLIB_LIBRARIES ${TAGLIB_LIBRARY}) | ||
| 40 | |||
| 41 | # Workaround broken .pc file | ||
| 42 | list(APPEND TAGLIB_LIBRARIES ${PC_TAGLIB_ZLIB_LIBRARIES}) | ||
| 43 | |||
| 44 | set(TAGLIB_INCLUDE_DIRS ${TAGLIB_INCLUDE_DIR}) | ||
| 45 | if(NOT TARGET TagLib::TagLib) | ||
| 46 | add_library(TagLib::TagLib UNKNOWN IMPORTED) | ||
| 47 | if(TAGLIB_LIBRARY_RELEASE) | ||
| 48 | set_target_properties(TagLib::TagLib PROPERTIES | ||
| 49 | IMPORTED_CONFIGURATIONS RELEASE | ||
| 50 | IMPORTED_LOCATION "${TAGLIB_LIBRARY_RELEASE}") | ||
| 51 | endif() | ||
| 52 | if(TAGLIB_LIBRARY_DEBUG) | ||
| 53 | set_target_properties(TagLib::TagLib PROPERTIES | ||
| 54 | IMPORTED_CONFIGURATIONS DEBUG | ||
| 55 | IMPORTED_LOCATION "${TAGLIB_LIBRARY_DEBUG}") | ||
| 56 | endif() | ||
| 57 | set_target_properties(TagLib::TagLib PROPERTIES | ||
| 58 | INTERFACE_INCLUDE_DIRECTORIES "${TAGLIB_INCLUDE_DIR}") | ||
| 59 | endif() | ||
| 60 | endif() | ||
| 61 | |||
| 62 | mark_as_advanced(TAGLIB_INCLUDE_DIR TAGLIB_LIBRARY) | ||
diff --git a/project/cmake/modules/FindTexturePacker.cmake b/project/cmake/modules/FindTexturePacker.cmake new file mode 100644 index 0000000..2229ff7 --- /dev/null +++ b/project/cmake/modules/FindTexturePacker.cmake | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindTexturePacker | ||
| 3 | # ----------------- | ||
| 4 | # Finds the TexturePacker | ||
| 5 | # | ||
| 6 | # This will define the following (imported) targets:: | ||
| 7 | # | ||
| 8 | # TexturePacker::TexturePacker - The TexturePacker executable | ||
| 9 | |||
| 10 | if(NOT TARGET TexturePacker::TexturePacker) | ||
| 11 | if(CMAKE_CROSSCOMPILING) | ||
| 12 | add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL) | ||
| 13 | set_target_properties(TexturePacker::TexturePacker PROPERTIES | ||
| 14 | IMPORTED_LOCATION "${NATIVEPREFIX}/bin/TexturePacker") | ||
| 15 | elseif(WIN32) | ||
| 16 | add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL) | ||
| 17 | set_target_properties(TexturePacker::TexturePacker PROPERTIES | ||
| 18 | IMPORTED_LOCATION "${CORE_SOURCE_DIR}/tools/TexturePacker/TexturePacker.exe") | ||
| 19 | else() | ||
| 20 | add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/TexturePacker build/texturepacker) | ||
| 21 | add_executable(TexturePacker::TexturePacker ALIAS TexturePacker) | ||
| 22 | endif() | ||
| 23 | endif() | ||
diff --git a/project/cmake/modules/FindTinyXML.cmake b/project/cmake/modules/FindTinyXML.cmake new file mode 100644 index 0000000..0168f40 --- /dev/null +++ b/project/cmake/modules/FindTinyXML.cmake | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindTinyXML | ||
| 3 | # ----------- | ||
| 4 | # Finds the TinyXML library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # TINYXML_FOUND - system has TinyXML | ||
| 9 | # TINYXML_INCLUDE_DIRS - the TinyXML include directory | ||
| 10 | # TINYXML_LIBRARIES - the TinyXML libraries | ||
| 11 | # TINYXML_DEFINITIONS - the TinyXML definitions | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # TinyXML::TinyXML - The TinyXML library | ||
| 16 | |||
| 17 | if(PKG_CONFIG_FOUND) | ||
| 18 | pkg_check_modules(PC_TINYXML tinyxml QUIET) | ||
| 19 | endif() | ||
| 20 | |||
| 21 | find_path(TINYXML_INCLUDE_DIR tinyxml.h | ||
| 22 | PATH_SUFFIXES tinyxml | ||
| 23 | PATHS ${PC_TINYXML_INCLUDEDIR}) | ||
| 24 | find_library(TINYXML_LIBRARY_RELEASE NAMES tinyxml tinyxmlSTL | ||
| 25 | PATH_SUFFIXES tinyxml ${CONFIGURATION_LIBDIR_RELEASE} | ||
| 26 | PATHS ${PC_TINYXML_LIBDIR}) | ||
| 27 | find_library(TINYXML_LIBRARY_DEBUG NAMES tinyxml tinyxmlSTL | ||
| 28 | PATH_SUFFIXES tinyxml ${CONFIGURATION_LIBDIR_DEBUG} | ||
| 29 | PATHS ${PC_TINYXML_LIBDIR}) | ||
| 30 | set(TINYXML_VERSION ${PC_TINYXML_VERSION}) | ||
| 31 | |||
| 32 | include(SelectLibraryConfigurations) | ||
| 33 | select_library_configurations(TINYXML) | ||
| 34 | |||
| 35 | include(FindPackageHandleStandardArgs) | ||
| 36 | find_package_handle_standard_args(TINYXML | ||
| 37 | REQUIRED_VARS TINYXML_LIBRARY TINYXML_INCLUDE_DIR | ||
| 38 | VERSION_VAR TINYXML_VERSION) | ||
| 39 | |||
| 40 | if(TINYXML_FOUND) | ||
| 41 | set(TINYXML_LIBRARIES ${TINYXML_LIBRARY}) | ||
| 42 | set(TINYXML_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR}) | ||
| 43 | if(WIN32) | ||
| 44 | set(TINYXML_DEFINITIONS -DTIXML_USE_STL=1) | ||
| 45 | endif() | ||
| 46 | |||
| 47 | if(NOT TARGET TinyXML::TinyXML) | ||
| 48 | add_library(TinyXML::TinyXML UNKNOWN IMPORTED) | ||
| 49 | if(TINYXML_LIBRARY_RELEASE) | ||
| 50 | set_target_properties(TinyXML::TinyXML PROPERTIES | ||
| 51 | IMPORTED_CONFIGURATIONS RELEASE | ||
| 52 | IMPORTED_LOCATION "${TINYXML_LIBRARY_RELEASE}") | ||
| 53 | endif() | ||
| 54 | if(TINYXML_LIBRARY_DEBUG) | ||
| 55 | set_target_properties(TinyXML::TinyXML PROPERTIES | ||
| 56 | IMPORTED_CONFIGURATIONS DEBUG | ||
| 57 | IMPORTED_LOCATION "${TINYXML_LIBRARY_DEBUG}") | ||
| 58 | endif() | ||
| 59 | set_target_properties(TinyXML::TinyXML PROPERTIES | ||
| 60 | INTERFACE_INCLUDE_DIRECTORIES "${TINYXML_INCLUDE_DIR}") | ||
| 61 | if(WIN32) | ||
| 62 | set_target_properties(TinyXML::TinyXML PROPERTIES | ||
| 63 | INTERFACE_COMPILE_DEFINITIONS TIXML_USE_STL=1) | ||
| 64 | endif() | ||
| 65 | endif() | ||
| 66 | endif() | ||
| 67 | |||
| 68 | mark_as_advanced(TINYXML_INCLUDE_DIR TINYXML_LIBRARY) | ||
diff --git a/project/cmake/modules/FindUDev.cmake b/project/cmake/modules/FindUDev.cmake new file mode 100644 index 0000000..97fa956 --- /dev/null +++ b/project/cmake/modules/FindUDev.cmake | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | # - Try to find udev | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # UDEV_FOUND - system has libudev | ||
| 5 | # UDEV_INCLUDE_DIRS - the libudev include directory | ||
| 6 | # UDEV_LIBRARIES - The libudev libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (UDEV libudev) | ||
| 10 | list(APPEND UDEV_INCLUDE_DIRS ${UDEV_INCLUDEDIR}) | ||
| 11 | endif() | ||
| 12 | |||
| 13 | if(NOT UDEV_FOUND) | ||
| 14 | find_path(UDEV_INCLUDE_DIRS libudev.h) | ||
| 15 | find_library(UDEV_LIBRARIES udev) | ||
| 16 | endif() | ||
| 17 | |||
| 18 | include(FindPackageHandleStandardArgs) | ||
| 19 | find_package_handle_standard_args(UDev DEFAULT_MSG UDEV_INCLUDE_DIRS UDEV_LIBRARIES) | ||
| 20 | |||
| 21 | mark_as_advanced(UDEV_INCLUDE_DIRS UDEV_LIBRARIES) | ||
| 22 | list(APPEND UDEV_DEFINITIONS -DHAVE_LIBUDEV=1) | ||
diff --git a/project/cmake/modules/FindUUID.cmake b/project/cmake/modules/FindUUID.cmake new file mode 100644 index 0000000..173fac2 --- /dev/null +++ b/project/cmake/modules/FindUUID.cmake | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindUUID | ||
| 3 | # -------- | ||
| 4 | # Finds the libuuid library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # UUID_FOUND - system has libuuid | ||
| 9 | # UUID_INCLUDE_DIRS - the libuuid include directory | ||
| 10 | # UUID_LIBRARIES - the libuuid libraries | ||
| 11 | # | ||
| 12 | # and the following imported targets:: | ||
| 13 | # | ||
| 14 | # UUID::UUID - The libuuid library | ||
| 15 | |||
| 16 | if(PKG_CONFIG_FOUND) | ||
| 17 | pkg_check_modules(PC_UUID uuid QUIET) | ||
| 18 | endif() | ||
| 19 | |||
| 20 | find_path(UUID_INCLUDE_DIR uuid/uuid.h | ||
| 21 | PATHS ${PC_UUID_INCLUDEDIR}) | ||
| 22 | find_library(UUID_LIBRARY uuid | ||
| 23 | PATHS ${PC_UUID_LIBRARY}) | ||
| 24 | set(UUID_VERSION ${PC_UUID_VERSION}) | ||
| 25 | |||
| 26 | include(FindPackageHandleStandardArgs) | ||
| 27 | find_package_handle_standard_args(UUID | ||
| 28 | REQUIRED_VARS UUID_LIBRARY UUID_INCLUDE_DIR | ||
| 29 | VERSION_VAR UUID_VERSION) | ||
| 30 | |||
| 31 | if(UUID_FOUND) | ||
| 32 | set(UUID_LIBRARIES ${UUID_LIBRARY}) | ||
| 33 | set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR}) | ||
| 34 | |||
| 35 | if(NOT TARGET UUID::UUID) | ||
| 36 | add_library(UUID::UUID UNKNOWN IMPORTED) | ||
| 37 | set_target_properties(UUID::UUID PROPERTIES | ||
| 38 | IMPORTED_LOCATION "${UUID_LIBRARY}" | ||
| 39 | INTERFACE_INCLUDE_DIRECTORIES "${UUID_INCLUDE_DIR}") | ||
| 40 | endif() | ||
| 41 | endif() | ||
| 42 | |||
| 43 | mark_as_advanced(UUID_INCLUDE_DIR UUID_LIBRARY) | ||
diff --git a/project/cmake/modules/FindVAAPI.cmake b/project/cmake/modules/FindVAAPI.cmake new file mode 100644 index 0000000..08e821f --- /dev/null +++ b/project/cmake/modules/FindVAAPI.cmake | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindVAAPI | ||
| 3 | # --------- | ||
| 4 | # Finds the VAAPI library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # VAAPI_FOUND - system has VAAPI | ||
| 9 | # VAAPI_INCLUDE_DIRS - the VAAPI include directory | ||
| 10 | # VAAPI_LIBRARIES - the VAAPI libraries | ||
| 11 | # VAAPI_DEFINITIONS - the VAAPI definitions | ||
| 12 | |||
| 13 | if(PKG_CONFIG_FOUND) | ||
| 14 | pkg_check_modules(PC_VAAPI libva libva-x11 QUIET) | ||
| 15 | endif() | ||
| 16 | |||
| 17 | find_path(VAAPI_INCLUDE_DIR va/va.h | ||
| 18 | PATHS ${PC_VAAPI_libva_INCLUDEDIR}) | ||
| 19 | find_library(VAAPI_libva_LIBRARY NAMES va | ||
| 20 | PATHS ${PC_VAAPI_libva_LIBDIR}) | ||
| 21 | find_library(VAAPI_libva-x11_LIBRARY NAMES va-x11 | ||
| 22 | PATHS ${PC_VAAPI_libva_LIBDIR}) | ||
| 23 | |||
| 24 | if(PC_VAAPI_libva_VERSION) | ||
| 25 | set(VAAPI_VERSION_STRING ${PC_VAAPI_libva_VERSION}) | ||
| 26 | elseif(VAAPI_INCLUDE_DIR AND EXISTS "${VAAPI_INCLUDE_DIR}/va/va_version.h") | ||
| 27 | file(STRINGS "${VAAPI_INCLUDE_DIR}/va/va_version.h" vaapi_version_str REGEX "^#define[\t ]+VA_VERSION_S[\t ]+\".*\".*") | ||
| 28 | string(REGEX REPLACE "^#define[\t ]+VA_VERSION_S[\t ]+\"([^\"]+)\".*" "\\1" VAAPI_VERSION_STRING "${vaapi_version_str}") | ||
| 29 | unset(vaapi_version_str) | ||
| 30 | endif() | ||
| 31 | |||
| 32 | if(NOT VAAPI_FIND_VERSION) | ||
| 33 | set(VAAPI_FIND_VERSION 0.38.0) | ||
| 34 | endif() | ||
| 35 | |||
| 36 | include(FindPackageHandleStandardArgs) | ||
| 37 | find_package_handle_standard_args(VAAPI | ||
| 38 | REQUIRED_VARS VAAPI_libva_LIBRARY VAAPI_libva-x11_LIBRARY VAAPI_INCLUDE_DIR | ||
| 39 | VERSION_VAR VAAPI_VERSION_STRING) | ||
| 40 | |||
| 41 | if(VAAPI_FOUND) | ||
| 42 | set(VAAPI_INCLUDE_DIRS ${VAAPI_INCLUDE_DIR}) | ||
| 43 | set(VAAPI_LIBRARIES ${VAAPI_libva_LIBRARY} ${VAAPI_libva-x11_LIBRARY}) | ||
| 44 | set(VAAPI_DEFINITIONS -DHAVE_LIBVA=1) | ||
| 45 | endif() | ||
| 46 | |||
| 47 | mark_as_advanced(VAAPI_INCLUDE_DIR VAAPI_libva_LIBRARY VAAPI_libva-x11_LIBRARY) | ||
diff --git a/project/cmake/modules/FindVDPAU.cmake b/project/cmake/modules/FindVDPAU.cmake new file mode 100644 index 0000000..680b45f --- /dev/null +++ b/project/cmake/modules/FindVDPAU.cmake | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindVDPAU | ||
| 3 | # --------- | ||
| 4 | # Finds the VDPAU library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # VDPAU_FOUND - system has VDPAU | ||
| 9 | # VDPAU_INCLUDE_DIRS - the VDPAU include directory | ||
| 10 | # VDPAU_LIBRARIES - the VDPAU libraries | ||
| 11 | # VDPAU_DEFINITIONS - the VDPAU definitions | ||
| 12 | |||
| 13 | if(PKG_CONFIG_FOUND) | ||
| 14 | pkg_check_modules(PC_VDPAU vdpau QUIET) | ||
| 15 | endif() | ||
| 16 | |||
| 17 | find_path(VDPAU_INCLUDE_DIR NAMES vdpau/vdpau.h vdpau/vdpau_x11.h | ||
| 18 | PATHS ${PC_VDPAU_INCLUDEDIR}) | ||
| 19 | find_library(VDPAU_LIBRARY NAMES vdpau | ||
| 20 | PATHS ${PC_VDPAU_LIBDIR}) | ||
| 21 | |||
| 22 | include(FindPackageHandleStandardArgs) | ||
| 23 | find_package_handle_standard_args(VDPAU | ||
| 24 | REQUIRED_VARS VDPAU_LIBRARY VDPAU_INCLUDE_DIR) | ||
| 25 | |||
| 26 | if(VDPAU_FOUND) | ||
| 27 | set(VDPAU_INCLUDE_DIRS ${VDPAU_INCLUDE_DIR}) | ||
| 28 | set(VDPAU_LIBRARIES ${VDPAU_LIBRARY}) | ||
| 29 | set(VDPAU_DEFINITIONS -DHAVE_LIBVDPAU=1) | ||
| 30 | endif() | ||
| 31 | |||
| 32 | mark_as_advanced(VDPAU_INCLUDE_DIR VDPAU_LIBRARY) | ||
diff --git a/project/cmake/modules/FindX.cmake b/project/cmake/modules/FindX.cmake new file mode 100644 index 0000000..d9ab5bc --- /dev/null +++ b/project/cmake/modules/FindX.cmake | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | # - Try to find X11 | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # X11_FOUND - system has X11 | ||
| 5 | # X11_INCLUDE_DIRS - the X11 include directory | ||
| 6 | # X11_LIBRARIES - The X11 libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (X x11 xext libdrm egl) | ||
| 10 | list(APPEND X_INCLUDE_DIRS /usr/include) | ||
| 11 | else() | ||
| 12 | find_path(X_INCLUDE_DIRS X11/Xlib.h) | ||
| 13 | find_library(X_LIBRARIES X11) | ||
| 14 | endif() | ||
| 15 | |||
| 16 | include(FindPackageHandleStandardArgs) | ||
| 17 | find_package_handle_standard_args(X DEFAULT_MSG X_INCLUDE_DIRS X_LIBRARIES) | ||
| 18 | |||
| 19 | list(APPEND X_DEFINITIONS -DHAVE_X11=1) | ||
| 20 | |||
| 21 | mark_as_advanced(X_INCLUDE_DIRS X_LIBRARIES X_DEFINITIONS) | ||
diff --git a/project/cmake/modules/FindXRandR.cmake b/project/cmake/modules/FindXRandR.cmake new file mode 100644 index 0000000..57ff750 --- /dev/null +++ b/project/cmake/modules/FindXRandR.cmake | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | # - Try to find xrandr | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # XRANDR_FOUND - system has lixrandr | ||
| 5 | # XRANDR_INCLUDE_DIRS - the libxrandr include directory | ||
| 6 | # XRANDR_LIBRARIES - The libxrandr libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (XRANDR xrandr) | ||
| 10 | list(APPEND XRANDR_INCLUDE_DIRS ${XRANDR_INCLUDEDIR}) | ||
| 11 | else() | ||
| 12 | find_library(XRANDR_LIBRARIES Xrandr) | ||
| 13 | endif() | ||
| 14 | |||
| 15 | if(XRANDR_FOUND) | ||
| 16 | include(FindPackageHandleStandardArgs) | ||
| 17 | find_package_handle_standard_args(XRandR DEFAULT_MSG XRANDR_INCLUDE_DIRS XRANDR_LIBRARIES) | ||
| 18 | |||
| 19 | list(APPEND XRANDR_DEFINITIONS -DHAVE_LIBXRANDR=1) | ||
| 20 | |||
| 21 | mark_as_advanced(XRANDR_INCLUDE_DIRS XRANDR_LIBRARIES XRANDR_DEFINITIONS) | ||
| 22 | endif() | ||
diff --git a/project/cmake/modules/FindXslt.cmake b/project/cmake/modules/FindXslt.cmake new file mode 100644 index 0000000..442ba43 --- /dev/null +++ b/project/cmake/modules/FindXslt.cmake | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | # - Try to find XSLT | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # XSLT_FOUND - system has libxslt | ||
| 5 | # XSLT_INCLUDE_DIRS - the libxslt include directory | ||
| 6 | # XSLT_LIBRARIES - The libxslt libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules (XSLT libxslt) | ||
| 10 | else() | ||
| 11 | find_path(XSLT_INCLUDE_DIRS libxslt/xslt.h) | ||
| 12 | find_library(XSLT_LIBRARIES NAMES xslt libxslt) | ||
| 13 | endif() | ||
| 14 | |||
| 15 | include(FindPackageHandleStandardArgs) | ||
| 16 | find_package_handle_standard_args(Xslt DEFAULT_MSG XSLT_INCLUDE_DIRS XSLT_LIBRARIES) | ||
| 17 | |||
| 18 | mark_as_advanced(XSLT_INCLUDE_DIRS XSLT_LIBRARIES) | ||
diff --git a/project/cmake/modules/FindYajl.cmake b/project/cmake/modules/FindYajl.cmake new file mode 100644 index 0000000..c27b03a --- /dev/null +++ b/project/cmake/modules/FindYajl.cmake | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | # Base Io build system | ||
| 2 | # Written by Jeremy Tregunna <jeremy.tregunna@me.com> | ||
| 3 | # | ||
| 4 | # Find libyajl | ||
| 5 | pkg_check_modules(YAJL yajl>=2.0) | ||
| 6 | if(YAJL_FOUND) | ||
| 7 | list(APPEND YAJL_DEFINITIONS -DYAJL_MAJOR=2) | ||
| 8 | endif() | ||
| 9 | |||
| 10 | if(NOT YAJL_FOUND) | ||
| 11 | find_path(YAJL_INCLUDE_DIRS yajl/yajl_common.h) | ||
| 12 | find_library(YAJL_LIBRARIES NAMES yajl) | ||
| 13 | |||
| 14 | file(STRINGS ${YAJL_INCLUDE_DIRS}/yajl/yajl_version.h version_header) | ||
| 15 | string(REGEX MATCH "YAJL_MAJOR ([0-9]+)" YAJL_VERSION_MAJOR ${version_header}) | ||
| 16 | string(REGEX REPLACE "YAJL_MAJOR ([0-9]+)" "\\1" YAJL_VERSION_MAJOR "${YAJL_VERSION_MAJOR}") | ||
| 17 | if (YAJL_VERSION_MINOR LESS 2) | ||
| 18 | set(YAJL_INCLUDE_DIRS) | ||
| 19 | set(YALJ_LIBRARIES) | ||
| 20 | endif() | ||
| 21 | list(APPEND YAJL_DEFINITIONS -DYAJL_MAJOR=${YAJL_VERSION_MAJOR}) | ||
| 22 | endif() | ||
| 23 | |||
| 24 | include(FindPackageHandleStandardArgs) | ||
| 25 | find_package_handle_standard_args(Yajl DEFAULT_MSG YAJL_INCLUDE_DIRS YAJL_LIBRARIES) | ||
| 26 | |||
| 27 | mark_as_advanced(YAJL_INCLUDE_DIRS YAJL_LIBRARIES YAJL_DEFINITIONS) | ||
diff --git a/project/cmake/modules/FindZip.cmake b/project/cmake/modules/FindZip.cmake new file mode 100644 index 0000000..e0a38c1 --- /dev/null +++ b/project/cmake/modules/FindZip.cmake | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindZip | ||
| 3 | # ----------- | ||
| 4 | # Finds the Zip library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # ZIP_FOUND - system has Zip | ||
| 9 | # ZIP_INCLUDE_DIRS - the Zip include directory | ||
| 10 | # ZIP_LIBRARIES - the Zip libraries | ||
| 11 | # ZIP_DEFINITIONS - the Zip libraries | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # ZIP::ZIP - The Zip library | ||
| 16 | |||
| 17 | if(PKG_CONFIG_FOUND) | ||
| 18 | pkg_check_modules(PC_ZIP libzip QUIET) | ||
| 19 | endif() | ||
| 20 | |||
| 21 | find_path(ZIP_INCLUDE_DIR zip.h | ||
| 22 | PATHS ${PC_ZIP_INCLUDEDIR}) | ||
| 23 | find_library(ZIP_LIBRARY NAMES zip | ||
| 24 | PATHS ${PC_ZIP_LIBDIR}) | ||
| 25 | set(ZIP_VERSION ${PC_ZIP_VERSION}) | ||
| 26 | |||
| 27 | include(FindPackageHandleStandardArgs) | ||
| 28 | find_package_handle_standard_args(ZIP | ||
| 29 | REQUIRED_VARS ZIP_LIBRARY ZIP_INCLUDE_DIR | ||
| 30 | VERSION_VAR ZIP_VERSION) | ||
| 31 | |||
| 32 | if(ZIP_FOUND) | ||
| 33 | set(ZIP_LIBRARIES ${ZIP_LIBRARY}) | ||
| 34 | set(ZIP_INCLUDE_DIRS ${ZIP_INCLUDE_DIR}) | ||
| 35 | set(ZIP_DEFINITIONS "${PC_ZIP_CFLAGS}") | ||
| 36 | |||
| 37 | if(NOT TARGET ZIP::ZIP) | ||
| 38 | add_library(ZIP::ZIP UNKNOWN IMPORTED) | ||
| 39 | set_target_properties(ZIP::ZIP PROPERTIES | ||
| 40 | IMPORTED_LOCATION "${ZIP_LIBRARY}" | ||
| 41 | INTERFACE_INCLUDE_DIRECTORIES "${ZIP_INCLUDE_DIR}" | ||
| 42 | INTERFACE_COMPILE_DEFINITIONS "${PC_ZIP_CFLAGS}") | ||
| 43 | endif() | ||
| 44 | endif() | ||
| 45 | |||
| 46 | mark_as_advanced(ZIP_INCLUDE_DIR ZIP_LIBRARY) | ||
diff --git a/project/cmake/platform/darwin/defines.txt b/project/cmake/platform/osx/defines.txt index 33b009e..33b009e 100644 --- a/project/cmake/platform/darwin/defines.txt +++ b/project/cmake/platform/osx/defines.txt | |||
diff --git a/project/cmake/scripts/android/archsetup.cmake b/project/cmake/scripts/android/archsetup.cmake new file mode 100644 index 0000000..86c0f6a --- /dev/null +++ b/project/cmake/scripts/android/archsetup.cmake | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | if(NOT CMAKE_TOOLCHAIN_FILE) | ||
| 2 | message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for android. See ${PROJECT_SOURCE_DIR}/README.md") | ||
| 3 | endif() | ||
| 4 | |||
| 5 | set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_ANDROID) | ||
| 6 | set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED | ||
| 7 | -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) | ||
| 8 | set(PLATFORM_DIR linux) | ||
| 9 | if(WITH_ARCH) | ||
| 10 | set(ARCH ${WITH_ARCH}) | ||
| 11 | else() | ||
| 12 | if(CPU STREQUAL armeabi-v7a) | ||
| 13 | set(ARCH arm-linux-androideabi) | ||
| 14 | elseif(CPU STREQUAL i686) | ||
| 15 | set(ARCH i686-linux-android) | ||
| 16 | else() | ||
| 17 | message(SEND_ERROR "Unknown CPU: ${CPU}") | ||
| 18 | endif() | ||
| 19 | endif() | ||
| 20 | |||
| 21 | set(FFMPEG_OPTS --enable-cross-compile --cpu=cortex-a9 --arch=arm --target-os=linux --enable-neon | ||
| 22 | --disable-vdpau --cc=${CMAKE_C_COMPILER} --host-cc=${CMAKE_C_COMPILER} | ||
| 23 | --strip=${CMAKE_STRIP}) | ||
| 24 | set(ENABLE_SDL OFF) | ||
| 25 | set(ENABLE_X11 OFF) | ||
| 26 | set(ENABLE_EGL ON) | ||
| 27 | set(ENABLE_AML ON) | ||
| 28 | set(ENABLE_OPTICAL OFF) | ||
| 29 | |||
| 30 | list(APPEND DEPLIBS android log jnigraphics) | ||
diff --git a/project/cmake/scripts/android/install.cmake b/project/cmake/scripts/android/install.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/project/cmake/scripts/android/install.cmake | |||
diff --git a/project/cmake/scripts/android/macros.cmake b/project/cmake/scripts/android/macros.cmake new file mode 120000 index 0000000..28c77ca --- /dev/null +++ b/project/cmake/scripts/android/macros.cmake | |||
| @@ -0,0 +1 @@ | |||
| ../linux/macros.cmake \ No newline at end of file | |||
diff --git a/project/cmake/scripts/android/pathsetup.cmake b/project/cmake/scripts/android/pathsetup.cmake new file mode 120000 index 0000000..26d7f17 --- /dev/null +++ b/project/cmake/scripts/android/pathsetup.cmake | |||
| @@ -0,0 +1 @@ | |||
| ../linux/pathsetup.cmake \ No newline at end of file | |||
diff --git a/project/cmake/scripts/common/addon-helpers.cmake b/project/cmake/scripts/common/addon-helpers.cmake index b94df2a..9541df4 100644 --- a/project/cmake/scripts/common/addon-helpers.cmake +++ b/project/cmake/scripts/common/addon-helpers.cmake | |||
| @@ -10,13 +10,23 @@ add_custom_target(addon-package | |||
| 10 | COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target package) | 10 | COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target package) |
| 11 | 11 | ||
| 12 | macro(add_cpack_workaround target version ext) | 12 | macro(add_cpack_workaround target version ext) |
| 13 | if(NOT PACKAGE_DIR) | ||
| 14 | set(PACKAGE_DIR "${CMAKE_INSTALL_PREFIX}/zips") | ||
| 15 | endif() | ||
| 16 | |||
| 13 | add_custom_command(TARGET addon-package PRE_BUILD | 17 | add_custom_command(TARGET addon-package PRE_BUILD |
| 14 | COMMAND ${CMAKE_COMMAND} -E rename addon-${target}-${version}.${ext} ${target}-${version}.${ext}) | 18 | COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIR} |
| 19 | COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_PACKAGE_DIRECTORY}/addon-${target}-${version}.${ext} ${PACKAGE_DIR}/${target}-${version}.${ext}) | ||
| 15 | endmacro() | 20 | endmacro() |
| 16 | 21 | ||
| 17 | # Grab the version from a given add-on's addon.xml | 22 | # Grab the version from a given add-on's addon.xml |
| 18 | macro (addon_version dir prefix) | 23 | macro (addon_version dir prefix) |
| 19 | FILE(READ ${dir}/addon.xml ADDONXML) | 24 | IF(EXISTS ${PROJECT_SOURCE_DIR}/${dir}/addon.xml.in) |
| 25 | FILE(READ ${PROJECT_SOURCE_DIR}/${dir}/addon.xml.in ADDONXML) | ||
| 26 | ELSE() | ||
| 27 | FILE(READ ${dir}/addon.xml ADDONXML) | ||
| 28 | ENDIF() | ||
| 29 | |||
| 20 | STRING(REGEX MATCH "<addon[^>]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML}) | 30 | STRING(REGEX MATCH "<addon[^>]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML}) |
| 21 | STRING(REGEX REPLACE ".*version=.([0-9\\.]+).*" "\\1" ${prefix}_VERSION ${VERSION_STRING}) | 31 | STRING(REGEX REPLACE ".*version=.([0-9\\.]+).*" "\\1" ${prefix}_VERSION ${VERSION_STRING}) |
| 22 | message(STATUS ${prefix}_VERSION=${${prefix}_VERSION}) | 32 | message(STATUS ${prefix}_VERSION=${${prefix}_VERSION}) |
| @@ -34,6 +44,25 @@ macro (build_addon target prefix libs) | |||
| 34 | SET_TARGET_PROPERTIES(${target} PROPERTIES PREFIX "lib") | 44 | SET_TARGET_PROPERTIES(${target} PROPERTIES PREFIX "lib") |
| 35 | ENDIF(OS STREQUAL "android") | 45 | ENDIF(OS STREQUAL "android") |
| 36 | 46 | ||
| 47 | # get the library's location | ||
| 48 | SET(LIBRARY_LOCATION $<TARGET_FILE:${target}>) | ||
| 49 | # get the library's filename | ||
| 50 | if("${CORE_SYSTEM_NAME}" STREQUAL "android") | ||
| 51 | # for android we need the filename without any version numbers | ||
| 52 | set(LIBRARY_FILENAME $<TARGET_LINKER_FILE_NAME:${target}>) | ||
| 53 | else() | ||
| 54 | SET(LIBRARY_FILENAME $<TARGET_FILE_NAME:${target}>) | ||
| 55 | endif() | ||
| 56 | |||
| 57 | # if there's an addon.xml.in we need to generate the addon.xml | ||
| 58 | IF(EXISTS ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in) | ||
| 59 | SET(PLATFORM ${CORE_SYSTEM_NAME}) | ||
| 60 | |||
| 61 | FILE(READ ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in addon_file) | ||
| 62 | STRING(CONFIGURE "${addon_file}" addon_file_conf @ONLY) | ||
| 63 | FILE(GENERATE OUTPUT ${PROJECT_SOURCE_DIR}/${target}/addon.xml CONTENT "${addon_file_conf}") | ||
| 64 | ENDIF() | ||
| 65 | |||
| 37 | # set zip as default if addon-package is called without PACKAGE_XXX | 66 | # set zip as default if addon-package is called without PACKAGE_XXX |
| 38 | SET(CPACK_GENERATOR "ZIP") | 67 | SET(CPACK_GENERATOR "ZIP") |
| 39 | SET(ext "zip") | 68 | SET(ext "zip") |
| @@ -51,33 +80,62 @@ macro (build_addon target prefix libs) | |||
| 51 | set(CPACK_COMPONENTS_IGNORE_GROUPS 1) | 80 | set(CPACK_COMPONENTS_IGNORE_GROUPS 1) |
| 52 | list(APPEND CPACK_COMPONENTS_ALL ${target}-${${prefix}_VERSION}) | 81 | list(APPEND CPACK_COMPONENTS_ALL ${target}-${${prefix}_VERSION}) |
| 53 | # Pack files together to create an archive | 82 | # Pack files together to create an archive |
| 54 | INSTALL(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION}) | 83 | INSTALL(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION} PATTERN "addon.xml.in" EXCLUDE) |
| 55 | IF(WIN32) | 84 | IF(WIN32) |
| 56 | # get the installation location for the addon's target | 85 | if(NOT CPACK_PACKAGE_DIRECTORY) |
| 57 | get_property(dll_location TARGET ${target} PROPERTY LOCATION) | 86 | # determine the temporary path |
| 87 | file(TO_CMAKE_PATH "$ENV{TEMP}" WIN32_TEMP_PATH) | ||
| 88 | string(LENGTH "${WIN32_TEMP_PATH}" WIN32_TEMP_PATH_LENGTH) | ||
| 89 | string(LENGTH "${PROJECT_BINARY_DIR}" PROJECT_BINARY_DIR_LENGTH) | ||
| 90 | |||
| 91 | # check if the temporary path is shorter than the default packaging directory path | ||
| 92 | if(WIN32_TEMP_PATH_LENGTH GREATER 0 AND WIN32_TEMP_PATH_LENGTH LESS PROJECT_BINARY_DIR_LENGTH) | ||
| 93 | # set the directory used by CPack for packaging to the temp directory | ||
| 94 | set(CPACK_PACKAGE_DIRECTORY ${WIN32_TEMP_PATH}) | ||
| 95 | endif() | ||
| 96 | endif() | ||
| 97 | |||
| 58 | # in case of a VC++ project the installation location contains a $(Configuration) VS variable | 98 | # in case of a VC++ project the installation location contains a $(Configuration) VS variable |
| 59 | # we replace it with ${CMAKE_BUILD_TYPE} (which doesn't cover the case when the build configuration | 99 | # we replace it with ${CMAKE_BUILD_TYPE} (which doesn't cover the case when the build configuration |
| 60 | # is changed within Visual Studio) | 100 | # is changed within Visual Studio) |
| 61 | string(REPLACE "$(Configuration)" "${CMAKE_BUILD_TYPE}" dll_location "${dll_location}") | 101 | string(REPLACE "$(Configuration)" "${CMAKE_BUILD_TYPE}" LIBRARY_LOCATION "${LIBRARY_LOCATION}") |
| 62 | 102 | ||
| 63 | # install the generated DLL file | 103 | # install the generated DLL file |
| 64 | INSTALL(PROGRAMS ${dll_location} DESTINATION ${target} | 104 | INSTALL(PROGRAMS ${LIBRARY_LOCATION} DESTINATION ${target} |
| 65 | COMPONENT ${target}-${${prefix}_VERSION}) | 105 | COMPONENT ${target}-${${prefix}_VERSION}) |
| 66 | 106 | ||
| 67 | IF(CMAKE_BUILD_TYPE MATCHES Debug) | 107 | IF(CMAKE_BUILD_TYPE MATCHES Debug) |
| 68 | # for debug builds also install the PDB file | 108 | # for debug builds also install the PDB file |
| 69 | get_filename_component(dll_directory ${dll_location} DIRECTORY) | 109 | get_filename_component(LIBRARY_DIR ${LIBRARY_LOCATION} DIRECTORY) |
| 70 | INSTALL(FILES ${dll_directory}/${target}.pdb DESTINATION ${target} | 110 | INSTALL(FILES ${LIBRARY_DIR}/${target}.pdb DESTINATION ${target} |
| 71 | COMPONENT ${target}-${${prefix}_VERSION}) | 111 | COMPONENT ${target}-${${prefix}_VERSION}) |
| 72 | ENDIF() | 112 | ENDIF() |
| 73 | ELSE(WIN32) | 113 | ELSE(WIN32) |
| 114 | if(NOT CPACK_PACKAGE_DIRECTORY) | ||
| 115 | set(CPACK_PACKAGE_DIRECTORY ${CMAKE_BINARY_DIR}) | ||
| 116 | endif() | ||
| 74 | INSTALL(TARGETS ${target} DESTINATION ${target} | 117 | INSTALL(TARGETS ${target} DESTINATION ${target} |
| 75 | COMPONENT ${target}-${${prefix}_VERSION}) | 118 | COMPONENT ${target}-${${prefix}_VERSION}) |
| 76 | ENDIF(WIN32) | 119 | ENDIF(WIN32) |
| 77 | add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext}) | 120 | add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext}) |
| 78 | ELSE(PACKAGE_ZIP OR PACKAGE_TGZ) | 121 | ELSE(PACKAGE_ZIP OR PACKAGE_TGZ) |
| 79 | INSTALL(TARGETS ${target} DESTINATION lib/kodi/addons/${target}) | 122 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") |
| 80 | INSTALL(DIRECTORY ${target} DESTINATION share/kodi/addons) | 123 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX) |
| 124 | message(STATUS "setting install paths to match ${APP_NAME}: CMAKE_INSTALL_PREFIX: ${${APP_NAME_UC}_PREFIX}") | ||
| 125 | set(CMAKE_INSTALL_PREFIX "${${APP_NAME_UC}_PREFIX}" CACHE PATH "${APP_NAME} install prefix" FORCE) | ||
| 126 | set(CMAKE_INSTALL_LIBDIR "${${APP_NAME_UC}_LIB_DIR}" CACHE PATH "${APP_NAME} install libdir" FORCE) | ||
| 127 | elseif(NOT CMAKE_INSTALL_PREFIX STREQUAL "${${APP_NAME_UC}_PREFIX}" AND NOT OVERRIDE_PATHS) | ||
| 128 | message(FATAL_ERROR "CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} differs from ${APP_NAME} prefix ${${APP_NAME_UC}_PREFIX}. Please pass -DOVERRIDE_PATHS=1 to skip this check") | ||
| 129 | else() | ||
| 130 | if(NOT CMAKE_INSTALL_LIBDIR) | ||
| 131 | set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib/${APP_NAME_LC}") | ||
| 132 | endif() | ||
| 133 | endif() | ||
| 134 | else() | ||
| 135 | set(CMAKE_INSTALL_LIBDIR "lib/${APP_NAME_LC}") | ||
| 136 | endif() | ||
| 137 | INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target}) | ||
| 138 | INSTALL(DIRECTORY ${target} DESTINATION share/${APP_NAME_LC}/addons PATTERN "addon.xml.in" EXCLUDE) | ||
| 81 | ENDIF(PACKAGE_ZIP OR PACKAGE_TGZ) | 139 | ENDIF(PACKAGE_ZIP OR PACKAGE_TGZ) |
| 82 | endmacro() | 140 | endmacro() |
| 83 | 141 | ||
diff --git a/project/cmake/scripts/common/archsetup.cmake b/project/cmake/scripts/common/archsetup.cmake new file mode 100644 index 0000000..dff5558 --- /dev/null +++ b/project/cmake/scripts/common/archsetup.cmake | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | # This script configures the build for a given architecture. | ||
| 2 | # Flags and stringified arch is set up. | ||
| 3 | # General compiler tests belongs here. | ||
| 4 | # | ||
| 5 | # On return, the following variables are set: | ||
| 6 | # CMAKE_SYSTEM_NAME - a lowercased system name | ||
| 7 | # CPU - the CPU on the target | ||
| 8 | # ARCH - the system architecture | ||
| 9 | # ARCH_DEFINES - list of compiler definitions for this architecture | ||
| 10 | # SYSTEM_DEFINES - list of compiler definitions for this system | ||
| 11 | # DEP_DEFINES - compiler definitions for system dependencies (e.g. LIRC) | ||
| 12 | # + the results of compiler tests etc. | ||
| 13 | |||
| 14 | include(CheckCXXSourceCompiles) | ||
| 15 | include(CheckSymbolExists) | ||
| 16 | include(CheckFunctionExists) | ||
| 17 | |||
| 18 | # Macro to check if a given type exists in a given header | ||
| 19 | # Arguments: | ||
| 20 | # header the header to check | ||
| 21 | # type the type to check for existence | ||
| 22 | # var the compiler definition to set if type exists | ||
| 23 | # On return: | ||
| 24 | # If type was found, the definition is added to SYSTEM_DEFINES | ||
| 25 | macro(check_type header type var) | ||
| 26 | check_cxx_source_compiles("#include <${header}> | ||
| 27 | int main() | ||
| 28 | { | ||
| 29 | ${type} s; | ||
| 30 | }" ${var}) | ||
| 31 | if(${var}) | ||
| 32 | list(APPEND SYSTEM_DEFINES -D${var}=1) | ||
| 33 | endif() | ||
| 34 | endmacro() | ||
| 35 | |||
| 36 | # Macro to check if a given builtin function exists | ||
| 37 | # Arguments: | ||
| 38 | # func the function to check | ||
| 39 | # var the compiler definition to set if type exists | ||
| 40 | # On return: | ||
| 41 | # If type was found, the definition is added to SYSTEM_DEFINES | ||
| 42 | macro(check_builtin func var) | ||
| 43 | check_cxx_source_compiles(" | ||
| 44 | int main() | ||
| 45 | { | ||
| 46 | ${func}; | ||
| 47 | }" ${var}) | ||
| 48 | if(${var}) | ||
| 49 | list(APPEND SYSTEM_DEFINES -D${var}=1) | ||
| 50 | endif() | ||
| 51 | endmacro() | ||
| 52 | |||
| 53 | |||
| 54 | # -------- Main script --------- | ||
| 55 | message(STATUS "System type: ${CMAKE_SYSTEM_NAME}") | ||
| 56 | if(NOT CORE_SYSTEM_NAME) | ||
| 57 | string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) | ||
| 58 | endif() | ||
| 59 | |||
| 60 | if(WITH_CPU) | ||
| 61 | set(CPU ${WITH_CPU}) | ||
| 62 | elseif(NOT CMAKE_TOOLCHAIN_FILE) | ||
| 63 | set(CPU ${CMAKE_SYSTEM_PROCESSOR}) | ||
| 64 | endif() | ||
| 65 | |||
| 66 | if(CMAKE_TOOLCHAIN_FILE) | ||
| 67 | if(NOT EXISTS "${CMAKE_TOOLCHAIN_FILE}") | ||
| 68 | message(FATAL_ERROR "Toolchain file ${CMAKE_TOOLCHAIN_FILE} does not exist.") | ||
| 69 | elseif(NOT DEPENDS_PATH OR NOT NATIVEPREFIX) | ||
| 70 | message(FATAL_ERROR "Toolchain did not define DEPENDS_PATH or NATIVEPREFIX. Possibly outdated depends.") | ||
| 71 | endif() | ||
| 72 | endif() | ||
| 73 | |||
| 74 | # Main cpp | ||
| 75 | set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/posix/main.cpp) | ||
| 76 | |||
| 77 | # system specific arch setup | ||
| 78 | include(${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/archsetup.cmake) | ||
| 79 | |||
| 80 | message(STATUS "Core system type: ${CORE_SYSTEM_NAME}") | ||
| 81 | message(STATUS "Platform: ${PLATFORM}") | ||
| 82 | message(STATUS "CPU: ${CPU}, ARCH: ${ARCH}") | ||
| 83 | |||
| 84 | check_type(string std::u16string HAVE_STD__U16_STRING) | ||
| 85 | check_type(string std::u32string HAVE_STD__U32_STRING) | ||
| 86 | check_type(string char16_t HAVE_CHAR16_T) | ||
| 87 | check_type(string char32_t HAVE_CHAR32_T) | ||
| 88 | check_type(stdint.h uint_least16_t HAVE_STDINT_H) | ||
| 89 | check_symbol_exists(posix_fadvise fcntl.h HAVE_POSIX_FADVISE) | ||
| 90 | check_builtin("long* temp=0; long ret=__sync_add_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_ADD_AND_FETCH) | ||
| 91 | check_builtin("long* temp=0; long ret=__sync_sub_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_SUB_AND_FETCH) | ||
| 92 | check_builtin("long* temp=0; long ret=__sync_val_compare_and_swap(temp, 1, 1)" HAS_BUILTIN_SYNC_VAL_COMPARE_AND_SWAP) | ||
| 93 | if(HAVE_POSIX_FADVISE) | ||
| 94 | list(APPEND SYSTEM_DEFINES -DHAVE_POSIX_FADVISE=1) | ||
| 95 | endif() | ||
| 96 | check_function_exists(localtime_r HAVE_LOCALTIME_R) | ||
| 97 | if(HAVE_LOCALTIME_R) | ||
| 98 | list(APPEND SYSTEM_DEFINES -DHAVE_LOCALTIME_R=1) | ||
| 99 | endif() | ||
diff --git a/project/cmake/scripts/common/checkcommits.cmake b/project/cmake/scripts/common/checkcommits.cmake new file mode 100644 index 0000000..304e623 --- /dev/null +++ b/project/cmake/scripts/common/checkcommits.cmake | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | find_package(Git REQUIRED) | ||
| 2 | |||
| 3 | macro(sanity_check message) | ||
| 4 | if(status_code) | ||
| 5 | message(FATAL_ERROR "${message}") | ||
| 6 | endif() | ||
| 7 | endmacro() | ||
| 8 | |||
| 9 | # Check that there are no changes in working-tree | ||
| 10 | execute_process(COMMAND ${GIT_EXECUTABLE} diff --quiet | ||
| 11 | RESULT_VARIABLE status_code) | ||
| 12 | sanity_check("Cannot run with working tree changes. Commit, stash or drop them.") | ||
| 13 | |||
| 14 | # Setup base of tests | ||
| 15 | set(check_base $ENV{CHECK_BASE}) | ||
| 16 | if(NOT check_base) | ||
| 17 | set(check_base origin/master) | ||
| 18 | endif() | ||
| 19 | |||
| 20 | # Setup end of tests | ||
| 21 | set(check_head $ENV{CHECK_HEAD}) | ||
| 22 | if(NOT check_head) | ||
| 23 | set(check_head HEAD) | ||
| 24 | endif() | ||
| 25 | |||
| 26 | # Setup target to build | ||
| 27 | set(check_target $ENV{CHECK_TARGET}) | ||
| 28 | if(NOT check_target) | ||
| 29 | set(check_target check) | ||
| 30 | endif() | ||
| 31 | |||
| 32 | # Build threads | ||
| 33 | set(build_threads $ENV{CHECK_THREADS}) | ||
| 34 | if(NOT build_threads) | ||
| 35 | if(UNIX) | ||
| 36 | execute_process(COMMAND nproc | ||
| 37 | OUTPUT_VARIABLE build_threads) | ||
| 38 | string(REGEX REPLACE "(\r?\n)+$" "" build_threads "${build_threads}") | ||
| 39 | endif() | ||
| 40 | endif() | ||
| 41 | |||
| 42 | # Record current HEAD | ||
| 43 | execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD | ||
| 44 | OUTPUT_VARIABLE current_branch) | ||
| 45 | |||
| 46 | string(REGEX REPLACE "(\r?\n)+$" "" current_branch "${current_branch}") | ||
| 47 | |||
| 48 | # Grab revision list | ||
| 49 | execute_process(COMMAND ${GIT_EXECUTABLE} rev-list ${check_base}..${check_head} --reverse | ||
| 50 | OUTPUT_VARIABLE rev_list) | ||
| 51 | |||
| 52 | string(REPLACE "\n" ";" rev_list ${rev_list}) | ||
| 53 | foreach(rev ${rev_list}) | ||
| 54 | # Checkout | ||
| 55 | message("Testing revision ${rev}") | ||
| 56 | execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${rev} | ||
| 57 | RESULT_VARIABLE status_code) | ||
| 58 | sanity_check("Failed to checkout ${rev}") | ||
| 59 | |||
| 60 | # Build | ||
| 61 | if(build_threads GREATER 2) | ||
| 62 | execute_process(COMMAND ${CMAKE_COMMAND} "--build" "${CMAKE_BINARY_DIR}" "--target" "${check_target}" "--use-stderr" "--" "-j${build_threads}" | ||
| 63 | RESULT_VARIABLE status_code) | ||
| 64 | else() | ||
| 65 | execute_process(COMMAND ${CMAKE_COMMAND} "--build" "${CMAKE_BINARY_DIR}" "--target" "${check_target}" "--use-stderr" | ||
| 66 | RESULT_VARIABLE status_code) | ||
| 67 | endif() | ||
| 68 | if(status_code) | ||
| 69 | execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${current_branch}) | ||
| 70 | endif() | ||
| 71 | sanity_check("Failed to build target for revision ${rev}") | ||
| 72 | endforeach() | ||
| 73 | |||
| 74 | message("Everything checks out fine") | ||
| 75 | execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${current_branch}) | ||
diff --git a/project/cmake/scripts/common/generateversionedfiles.cmake b/project/cmake/scripts/common/generateversionedfiles.cmake new file mode 100644 index 0000000..9a4080a --- /dev/null +++ b/project/cmake/scripts/common/generateversionedfiles.cmake | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/macros.cmake) | ||
| 2 | |||
| 3 | core_find_versions() | ||
| 4 | file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/addons/xbmc.addon) | ||
| 5 | file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/addons/kodi.guilib) | ||
| 6 | configure_file(${CORE_SOURCE_DIR}/addons/xbmc.addon/addon.xml.in | ||
| 7 | ${CMAKE_BINARY_DIR}/addons/xbmc.addon/addon.xml @ONLY) | ||
| 8 | configure_file(${CORE_SOURCE_DIR}/addons/kodi.guilib/addon.xml.in | ||
| 9 | ${CMAKE_BINARY_DIR}/addons/kodi.guilib/addon.xml @ONLY) | ||
| 10 | configure_file(${CORE_SOURCE_DIR}/xbmc/CompileInfo.cpp.in | ||
| 11 | ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp @ONLY) | ||
| 12 | set(prefix ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}) | ||
| 13 | set(APP_LIBDIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/kodi) | ||
diff --git a/project/cmake/scripts/common/generatorsetup.cmake b/project/cmake/scripts/common/generatorsetup.cmake new file mode 100644 index 0000000..75083ca --- /dev/null +++ b/project/cmake/scripts/common/generatorsetup.cmake | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | # Configure single-/multiconfiguration generators and variables | ||
| 2 | # | ||
| 3 | # CORE_BUILD_CONFIG that is set to | ||
| 4 | # - CMAKE_BUILD_TYPE for single configuration generators such as make, nmake | ||
| 5 | # - a variable that expands on build time to the current configuration for | ||
| 6 | # multi configuration generators such as VS or Xcode | ||
| 7 | if(CMAKE_CONFIGURATION_TYPES) | ||
| 8 | if(CMAKE_BUILD_TYPE) | ||
| 9 | message(FATAL_ERROR "CMAKE_BUILD_TYPE must not be defined for multi-configuration generators") | ||
| 10 | endif() | ||
| 11 | set(CORE_BUILD_CONFIG ${CMAKE_CFG_INTDIR}) | ||
| 12 | message(STATUS "Generator: Multi-configuration (${CMAKE_GENERATOR})") | ||
| 13 | else() | ||
| 14 | if(CMAKE_BUILD_TYPE) | ||
| 15 | set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} | ||
| 16 | CACHE STRING "Choose build type (${CMAKE_BUILD_TYPES})" FORCE) | ||
| 17 | else() | ||
| 18 | # Set default | ||
| 19 | set(CMAKE_BUILD_TYPE Release | ||
| 20 | CACHE STRING "Choose build type (${CMAKE_BUILD_TYPES})" FORCE) | ||
| 21 | endif() | ||
| 22 | set(CORE_BUILD_CONFIG ${CMAKE_BUILD_TYPE}) | ||
| 23 | message(STATUS "Generator: Single-configuration: ${CMAKE_BUILD_TYPE} (${CMAKE_GENERATOR})") | ||
| 24 | endif() | ||
diff --git a/project/cmake/scripts/common/macros.cmake b/project/cmake/scripts/common/macros.cmake new file mode 100644 index 0000000..dd2233b --- /dev/null +++ b/project/cmake/scripts/common/macros.cmake | |||
| @@ -0,0 +1,373 @@ | |||
| 1 | # This script holds the main functions used to construct the build system | ||
| 2 | |||
| 3 | # include system specific macros | ||
| 4 | include(${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/macros.cmake) | ||
| 5 | |||
| 6 | # Add a library, optionally as a dependency of the main application | ||
| 7 | # Arguments: | ||
| 8 | # name name of the library to add | ||
| 9 | # Optional Arguments: | ||
| 10 | # NO_MAIN_DEPENDS if specified, the library is not added to main depends | ||
| 11 | # Implicit arguments: | ||
| 12 | # SOURCES the sources of the library | ||
| 13 | # HEADERS the headers of the library (only for IDE support) | ||
| 14 | # OTHERS other library related files (only for IDE support) | ||
| 15 | # On return: | ||
| 16 | # Library will be built, optionally added to ${core_DEPENDS} | ||
| 17 | function(core_add_library name) | ||
| 18 | cmake_parse_arguments(arg "NO_MAIN_DEPENDS" "" "" ${ARGN}) | ||
| 19 | add_library(${name} STATIC ${SOURCES} ${HEADERS} ${OTHERS}) | ||
| 20 | set_target_properties(${name} PROPERTIES PREFIX "") | ||
| 21 | if(NOT arg_NO_MAIN_DEPENDS) | ||
| 22 | set(core_DEPENDS ${name} ${core_DEPENDS} CACHE STRING "" FORCE) | ||
| 23 | endif() | ||
| 24 | |||
| 25 | # Add precompiled headers to Kodi main libraries | ||
| 26 | if(WIN32 AND "${CMAKE_CURRENT_LIST_DIR}" MATCHES "^${CORE_SOURCE_DIR}/xbmc") | ||
| 27 | add_precompiled_header(${name} pch.h ${CORE_SOURCE_DIR}/xbmc/win32/pch.cpp | ||
| 28 | PCH_TARGET kodi) | ||
| 29 | endif() | ||
| 30 | |||
| 31 | # IDE support | ||
| 32 | if(CMAKE_GENERATOR MATCHES "Xcode") | ||
| 33 | file(RELATIVE_PATH parentfolder ${CORE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..) | ||
| 34 | set_target_properties(${name} PROPERTIES FOLDER "${parentfolder}") | ||
| 35 | elseif(CMAKE_GENERATOR MATCHES "Visual Studio") | ||
| 36 | file(RELATIVE_PATH foldername ${CORE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) | ||
| 37 | set_target_properties(${name} PROPERTIES FOLDER "${foldername}") | ||
| 38 | source_group(" " REGULAR_EXPRESSION ".*") | ||
| 39 | endif() | ||
| 40 | endfunction() | ||
| 41 | |||
| 42 | # Add a test library, and add sources to list for gtest integration macros | ||
| 43 | function(core_add_test_library name) | ||
| 44 | core_add_library(${name} NO_MAIN_DEPENDS) | ||
| 45 | set_target_properties(${name} PROPERTIES EXCLUDE_FROM_ALL 1) | ||
| 46 | foreach(src ${SOURCES}) | ||
| 47 | set(test_sources ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${test_sources} CACHE STRING "" FORCE) | ||
| 48 | endforeach() | ||
| 49 | set(test_archives ${test_archives} ${name} CACHE STRING "" FORCE) | ||
| 50 | endfunction() | ||
| 51 | |||
| 52 | # Add a data file to installation list with a mirror in build tree | ||
| 53 | # Arguments: | ||
| 54 | # file full path to file to mirror | ||
| 55 | # relative the relative base of file path in the build/install tree | ||
| 56 | # give another parameter to exclude from install target | ||
| 57 | # Implicit arguments: | ||
| 58 | # CORE_SOURCE_DIR - root of source tree | ||
| 59 | # On return: | ||
| 60 | # file is added to ${install_data} and mirrored in build tree | ||
| 61 | function(copy_file_to_buildtree file relative) | ||
| 62 | if(NOT WIN32) | ||
| 63 | string(REPLACE "\(" "\\(" file ${file}) | ||
| 64 | string(REPLACE "\)" "\\)" file ${file}) | ||
| 65 | endif() | ||
| 66 | string(REPLACE "${relative}/" "" outfile ${file}) | ||
| 67 | |||
| 68 | if(NOT TARGET export-files) | ||
| 69 | add_custom_target(export-files ALL COMMENT "Copying files into build tree") | ||
| 70 | endif() | ||
| 71 | if(NOT ${CORE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR}) | ||
| 72 | if(VERBOSE) | ||
| 73 | message(STATUS "copy_file_to_buildtree - copying file: ${file} -> ${CMAKE_CURRENT_BINARY_DIR}/${outfile}") | ||
| 74 | endif() | ||
| 75 | add_custom_command(TARGET export-files COMMAND ${CMAKE_COMMAND} -E copy_if_different "${file}" "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") | ||
| 76 | endif() | ||
| 77 | if(NOT ARGN) | ||
| 78 | list(APPEND install_data ${outfile}) | ||
| 79 | set(install_data ${install_data} PARENT_SCOPE) | ||
| 80 | endif() | ||
| 81 | endfunction() | ||
| 82 | |||
| 83 | # add data files to installation list with a mirror in build tree. | ||
| 84 | # reads list of files to install from a given list of text files. | ||
| 85 | # Arguments: | ||
| 86 | # pattern globbing pattern for text files to read | ||
| 87 | # give another parameter to exclude from installation target | ||
| 88 | # Implicit arguments: | ||
| 89 | # CORE_SOURCE_DIR - root of source tree | ||
| 90 | # On return: | ||
| 91 | # files are added to ${install_data} and mirrored in build tree | ||
| 92 | function(copy_files_from_filelist_to_buildtree pattern) | ||
| 93 | foreach(arg ${ARGN}) | ||
| 94 | list(APPEND pattern ${arg}) | ||
| 95 | endforeach() | ||
| 96 | # copies files listed in text files to the buildtree | ||
| 97 | # Input: [glob pattern: filepattern] | ||
| 98 | list(SORT pattern) | ||
| 99 | if(VERBOSE) | ||
| 100 | message(STATUS "copy_files_from_filelist_to_buildtree - got pattern: ${pattern}") | ||
| 101 | endif() | ||
| 102 | foreach(pat ${pattern}) | ||
| 103 | file(GLOB filenames ${pat}) | ||
| 104 | foreach(filename ${filenames}) | ||
| 105 | string(STRIP ${filename} filename) | ||
| 106 | core_file_read_filtered(fstrings ${filename}) | ||
| 107 | foreach(dir ${fstrings}) | ||
| 108 | file(GLOB_RECURSE files RELATIVE ${CORE_SOURCE_DIR} ${CORE_SOURCE_DIR}/${dir}) | ||
| 109 | foreach(file ${files}) | ||
| 110 | if(ARGN) | ||
| 111 | copy_file_to_buildtree(${CORE_SOURCE_DIR}/${file} ${CORE_SOURCE_DIR} 1) | ||
| 112 | else() | ||
| 113 | copy_file_to_buildtree(${CORE_SOURCE_DIR}/${file} ${CORE_SOURCE_DIR}) | ||
| 114 | endif() | ||
| 115 | endforeach() | ||
| 116 | endforeach() | ||
| 117 | endforeach() | ||
| 118 | endforeach() | ||
| 119 | set(install_data ${install_data} PARENT_SCOPE) | ||
| 120 | endfunction() | ||
| 121 | |||
| 122 | # helper macro to set modified variables in parent scope | ||
| 123 | macro(export_dep) | ||
| 124 | set(SYSTEM_INCLUDES ${SYSTEM_INCLUDES} PARENT_SCOPE) | ||
| 125 | set(DEPLIBS ${DEPLIBS} PARENT_SCOPE) | ||
| 126 | set(DEP_DEFINES ${DEP_DEFINES} PARENT_SCOPE) | ||
| 127 | set(${depup}_FOUND ${${depup}_FOUND} PARENT_SCOPE) | ||
| 128 | mark_as_advanced(${depup}_LIBRARIES) | ||
| 129 | endmacro() | ||
| 130 | |||
| 131 | # add a required dependency of main application | ||
| 132 | # Arguments: | ||
| 133 | # dep name of find rule for dependency, used uppercased for variable prefix | ||
| 134 | # On return: | ||
| 135 | # dependency added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES} | ||
| 136 | function(core_require_dep dep) | ||
| 137 | find_package(${dep} REQUIRED) | ||
| 138 | string(TOUPPER ${dep} depup) | ||
| 139 | list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) | ||
| 140 | list(APPEND DEPLIBS ${${depup}_LIBRARIES}) | ||
| 141 | list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) | ||
| 142 | export_dep() | ||
| 143 | endfunction() | ||
| 144 | |||
| 145 | # add a required dyloaded dependency of main application | ||
| 146 | # Arguments: | ||
| 147 | # dep name of find rule for dependency, used uppercased for variable prefix | ||
| 148 | # On return: | ||
| 149 | # dependency added to ${SYSTEM_INCLUDES}, ${dep}_SONAME is set up | ||
| 150 | function(core_require_dyload_dep dep) | ||
| 151 | find_package(${dep} REQUIRED) | ||
| 152 | string(TOUPPER ${dep} depup) | ||
| 153 | list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) | ||
| 154 | list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) | ||
| 155 | find_soname(${depup} REQUIRED) | ||
| 156 | export_dep() | ||
| 157 | set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE) | ||
| 158 | endfunction() | ||
| 159 | |||
| 160 | # helper macro for optional deps | ||
| 161 | macro(setup_enable_switch) | ||
| 162 | string(TOUPPER ${dep} depup) | ||
| 163 | if (ARGV1) | ||
| 164 | set(enable_switch ${ARGV1}) | ||
| 165 | else() | ||
| 166 | set(enable_switch ENABLE_${depup}) | ||
| 167 | endif() | ||
| 168 | endmacro() | ||
| 169 | |||
| 170 | # add an optional dependency of main application | ||
| 171 | # Arguments: | ||
| 172 | # dep name of find rule for dependency, used uppercased for variable prefix | ||
| 173 | # On return: | ||
| 174 | # dependency optionally added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES} | ||
| 175 | function(core_optional_dep dep) | ||
| 176 | setup_enable_switch() | ||
| 177 | if(${enable_switch}) | ||
| 178 | find_package(${dep}) | ||
| 179 | if(${depup}_FOUND) | ||
| 180 | list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) | ||
| 181 | list(APPEND DEPLIBS ${${depup}_LIBRARIES}) | ||
| 182 | list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) | ||
| 183 | set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE) | ||
| 184 | export_dep() | ||
| 185 | else() | ||
| 186 | set(final_message ${final_message} "${depup} enabled: No" PARENT_SCOPE) | ||
| 187 | endif() | ||
| 188 | endif() | ||
| 189 | endfunction() | ||
| 190 | |||
| 191 | # add an optional dyloaded dependency of main application | ||
| 192 | # Arguments: | ||
| 193 | # dep name of find rule for dependency, used uppercased for variable prefix | ||
| 194 | # On return: | ||
| 195 | # dependency optionally added to ${SYSTEM_INCLUDES}, ${DEP_DEFINES}, ${dep}_SONAME is set up | ||
| 196 | function(core_optional_dyload_dep dep) | ||
| 197 | setup_enable_switch() | ||
| 198 | if(${enable_switch}) | ||
| 199 | find_package(${dep}) | ||
| 200 | if(${depup}_FOUND) | ||
| 201 | list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) | ||
| 202 | find_soname(${depup} REQUIRED) | ||
| 203 | list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) | ||
| 204 | set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE) | ||
| 205 | export_dep() | ||
| 206 | set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE) | ||
| 207 | endif() | ||
| 208 | endif() | ||
| 209 | endfunction() | ||
| 210 | |||
| 211 | function(core_file_read_filtered result filepattern) | ||
| 212 | # Reads STRINGS from text files | ||
| 213 | # with comments filtered out | ||
| 214 | # Result: [list: result] | ||
| 215 | # Input: [glob pattern: filepattern] | ||
| 216 | file(GLOB filenames ${filepattern}) | ||
| 217 | list(SORT filenames) | ||
| 218 | foreach(filename ${filenames}) | ||
| 219 | if(VERBOSE) | ||
| 220 | message(STATUS "core_file_read_filtered - filename: ${filename}") | ||
| 221 | endif() | ||
| 222 | file(STRINGS ${filename} fstrings REGEX "^[^#//]") | ||
| 223 | foreach(fstring ${fstrings}) | ||
| 224 | string(REGEX REPLACE "^(.*)#(.*)" "\\1" fstring ${fstring}) | ||
| 225 | string(REGEX REPLACE "//.*" "" fstring ${fstring}) | ||
| 226 | string(STRIP ${fstring} fstring) | ||
| 227 | list(APPEND filename_strings ${fstring}) | ||
| 228 | endforeach() | ||
| 229 | endforeach() | ||
| 230 | set(${result} ${filename_strings} PARENT_SCOPE) | ||
| 231 | endfunction() | ||
| 232 | |||
| 233 | function(core_add_subdirs_from_filelist files) | ||
| 234 | # Adds subdirectories from a sorted list of files | ||
| 235 | # Input: [list: filenames] [bool: sort] | ||
| 236 | foreach(arg ${ARGN}) | ||
| 237 | list(APPEND files ${arg}) | ||
| 238 | endforeach() | ||
| 239 | list(SORT files) | ||
| 240 | if(VERBOSE) | ||
| 241 | message(STATUS "core_add_subdirs_from_filelist - got pattern: ${files}") | ||
| 242 | endif() | ||
| 243 | foreach(filename ${files}) | ||
| 244 | string(STRIP ${filename} filename) | ||
| 245 | core_file_read_filtered(fstrings ${filename}) | ||
| 246 | foreach(subdir ${fstrings}) | ||
| 247 | STRING_SPLIT(subdir " " ${subdir}) | ||
| 248 | list(GET subdir 0 subdir_src) | ||
| 249 | list(GET subdir -1 subdir_dest) | ||
| 250 | if(VERBOSE) | ||
| 251 | message(STATUS " core_add_subdirs_from_filelist - adding subdir: ${CORE_SOURCE_DIR}${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}") | ||
| 252 | endif() | ||
| 253 | add_subdirectory(${CORE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest}) | ||
| 254 | endforeach() | ||
| 255 | endforeach() | ||
| 256 | endfunction() | ||
| 257 | |||
| 258 | macro(core_add_optional_subdirs_from_filelist pattern) | ||
| 259 | # Adds subdirectories from text files | ||
| 260 | # if the option(s) in the 3rd field are enabled | ||
| 261 | # Input: [glob pattern: filepattern] | ||
| 262 | foreach(arg ${ARGN}) | ||
| 263 | list(APPEND pattern ${arg}) | ||
| 264 | endforeach() | ||
| 265 | foreach(elem ${pattern}) | ||
| 266 | string(STRIP ${elem} elem) | ||
| 267 | list(APPEND filepattern ${elem}) | ||
| 268 | endforeach() | ||
| 269 | |||
| 270 | file(GLOB filenames ${filepattern}) | ||
| 271 | list(SORT filenames) | ||
| 272 | if(VERBOSE) | ||
| 273 | message(STATUS "core_add_optional_subdirs_from_filelist - got pattern: ${filenames}") | ||
| 274 | endif() | ||
| 275 | |||
| 276 | foreach(filename ${filenames}) | ||
| 277 | if(VERBOSE) | ||
| 278 | message(STATUS "core_add_optional_subdirs_from_filelist - reading file: ${filename}") | ||
| 279 | endif() | ||
| 280 | file(STRINGS ${filename} fstrings REGEX "^[^#//]") | ||
| 281 | foreach(line ${fstrings}) | ||
| 282 | string(REPLACE " " ";" line "${line}") | ||
| 283 | list(GET line 0 subdir_src) | ||
| 284 | list(GET line 1 subdir_dest) | ||
| 285 | list(GET line 3 opts) | ||
| 286 | foreach(opt ${opts}) | ||
| 287 | if(ENABLE_${opt}) | ||
| 288 | if(VERBOSE) | ||
| 289 | message(STATUS " core_add_optional_subdirs_from_filelist - adding subdir: ${CORE_SOURCE_DIR}${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}") | ||
| 290 | endif() | ||
| 291 | add_subdirectory(${CORE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest}) | ||
| 292 | else() | ||
| 293 | if(VERBOSE) | ||
| 294 | message(STATUS " core_add_optional_subdirs_from_filelist: OPTION ${opt} not enabled for ${subdir_src}, skipping subdir") | ||
| 295 | endif() | ||
| 296 | endif() | ||
| 297 | endforeach() | ||
| 298 | endforeach() | ||
| 299 | endforeach() | ||
| 300 | endmacro() | ||
| 301 | |||
| 302 | macro(today RESULT) | ||
| 303 | if (WIN32) | ||
| 304 | execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT}) | ||
| 305 | string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}}) | ||
| 306 | elseif(UNIX) | ||
| 307 | execute_process(COMMAND date -u +%F | ||
| 308 | OUTPUT_VARIABLE ${RESULT}) | ||
| 309 | string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}}) | ||
| 310 | else() | ||
| 311 | message(SEND_ERROR "date not implemented") | ||
| 312 | set(${RESULT} 000000) | ||
| 313 | endif() | ||
| 314 | string(REGEX REPLACE "(\r?\n)+$" "" ${RESULT} "${${RESULT}}") | ||
| 315 | endmacro() | ||
| 316 | |||
| 317 | function(core_find_git_rev) | ||
| 318 | if(EXISTS ${CORE_SOURCE_DIR}/VERSION) | ||
| 319 | file(STRINGS ${CORE_SOURCE_DIR}/VERSION VERSION_FILE) | ||
| 320 | string(SUBSTRING "${VERSION_FILE}" 1 16 GIT_REV) | ||
| 321 | else() | ||
| 322 | find_package(Git) | ||
| 323 | if(GIT_FOUND AND EXISTS ${CORE_SOURCE_DIR}/.git) | ||
| 324 | execute_process(COMMAND ${GIT_EXECUTABLE} diff-files --ignore-submodules --quiet -- | ||
| 325 | RESULT_VARIABLE status_code | ||
| 326 | WORKING_DIRECTORY ${CORE_SOURCE_DIR}) | ||
| 327 | if (NOT status_code) | ||
| 328 | execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --cached --ignore-submodules --quiet HEAD -- | ||
| 329 | RESULT_VARIABLE status_code | ||
| 330 | WORKING_DIRECTORY ${CORE_SOURCE_DIR}) | ||
| 331 | endif() | ||
| 332 | today(DATE) | ||
| 333 | execute_process(COMMAND ${GIT_EXECUTABLE} --no-pager log --abbrev=7 -n 1 | ||
| 334 | --pretty=format:"%h-dirty" HEAD | ||
| 335 | OUTPUT_VARIABLE LOG_UNFORMATTED | ||
| 336 | WORKING_DIRECTORY ${CORE_SOURCE_DIR}) | ||
| 337 | string(SUBSTRING ${LOG_UNFORMATTED} 1 7 HASH) | ||
| 338 | else() | ||
| 339 | execute_process(COMMAND ${GIT_EXECUTABLE} --no-pager log --abbrev=7 -n 1 | ||
| 340 | --pretty=format:"%h %cd" HEAD | ||
| 341 | OUTPUT_VARIABLE LOG_UNFORMATTED | ||
| 342 | WORKING_DIRECTORY ${CORE_SOURCE_DIR}) | ||
| 343 | string(SUBSTRING ${LOG_UNFORMATTED} 1 7 HASH) | ||
| 344 | string(SUBSTRING ${LOG_UNFORMATTED} 9 10 DATE) | ||
| 345 | string(REPLACE "-" "" DATE ${DATE}) | ||
| 346 | endif() | ||
| 347 | set(GIT_REV "${DATE}-${HASH}") | ||
| 348 | endif() | ||
| 349 | if(GIT_REV) | ||
| 350 | set(APP_SCMID ${GIT_REV} PARENT_SCOPE) | ||
| 351 | endif() | ||
| 352 | endfunction() | ||
| 353 | |||
| 354 | macro(core_find_versions) | ||
| 355 | include(CMakeParseArguments) | ||
| 356 | core_file_read_filtered(version_list ${CORE_SOURCE_DIR}/version.txt) | ||
| 357 | string(REPLACE " " ";" version_list "${version_list}") | ||
| 358 | cmake_parse_arguments(APP "" "VERSION_MAJOR;VERSION_MINOR;VERSION_TAG;VERSION_CODE;ADDON_API;APP_NAME;COMPANY_NAME" "" ${version_list}) | ||
| 359 | |||
| 360 | set(APP_NAME ${APP_APP_NAME}) # inconsistency in upstream | ||
| 361 | string(TOLOWER ${APP_APP_NAME} APP_NAME_LC) | ||
| 362 | set(COMPANY_NAME ${APP_COMPANY_NAME}) | ||
| 363 | set(APP_VERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}) | ||
| 364 | if(APP_VERSION_TAG) | ||
| 365 | set(APP_VERSION ${APP_VERSION}-${APP_VERSION_TAG}) | ||
| 366 | endif() | ||
| 367 | string(REPLACE "." "," FILE_VERSION ${APP_ADDON_API}.0) | ||
| 368 | string(TOLOWER ${APP_VERSION_TAG} APP_VERSION_TAG_LC) | ||
| 369 | file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version REGEX "^.*GUILIB_API_VERSION (.*)$") | ||
| 370 | string(REGEX REPLACE ".*\"(.*)\"" "\\1" guilib_version ${guilib_version}) | ||
| 371 | file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version_min REGEX "^.*GUILIB_MIN_API_VERSION (.*)$") | ||
| 372 | string(REGEX REPLACE ".*\"(.*)\"" "\\1" guilib_version_min ${guilib_version_min}) | ||
| 373 | endmacro() | ||
diff --git a/project/cmake/scripts/common/managestring.cmake b/project/cmake/scripts/common/managestring.cmake new file mode 100644 index 0000000..7321f4c --- /dev/null +++ b/project/cmake/scripts/common/managestring.cmake | |||
| @@ -0,0 +1,235 @@ | |||
| 1 | # - Collection of String utility macros. | ||
| 2 | # Defines the following macros: | ||
| 3 | # STRING_TRIM(var str [NOUNQUOTE]) | ||
| 4 | # - Trim a string by removing the leading and trailing spaces, | ||
| 5 | # just like STRING(STRIP ...) in CMake 2.6 and later. | ||
| 6 | # This macro is needed as CMake 2.4 does not support STRING(STRIP ..) | ||
| 7 | # This macro also remove quote and double quote marks around the string, | ||
| 8 | # unless NOUNQUOTE is defined. | ||
| 9 | # * Parameters: | ||
| 10 | # + var: A variable that stores the result. | ||
| 11 | # + str: A string. | ||
| 12 | # + NOUNQUOTE: (Optional) do not remove the double quote mark around the string. | ||
| 13 | # | ||
| 14 | # STRING_UNQUOTE(var str) | ||
| 15 | # - Remove double quote marks and quote marks around a string. | ||
| 16 | # If the string is not quoted, then it returns an empty string. | ||
| 17 | # * Parameters: | ||
| 18 | # + var: A variable that stores the result. | ||
| 19 | # + str: A string. | ||
| 20 | # | ||
| 21 | # STRING_JOIN(var delimiter str_list [str...]) | ||
| 22 | # - Concatenate strings, with delimiter inserted between strings. | ||
| 23 | # * Parameters: | ||
| 24 | # + var: A variable that stores the result. | ||
| 25 | # + str_list: A list of string. | ||
| 26 | # + str: (Optional) more string to be join. | ||
| 27 | # | ||
| 28 | # STRING_SPLIT(var delimiter str [NOESCAPE_SEMICOLON]) | ||
| 29 | # - Split a string into a list using a delimiter, which can be in 1 or more | ||
| 30 | # characters long. | ||
| 31 | # * Parameters: | ||
| 32 | # + var: A variable that stores the result. | ||
| 33 | # + delimiter: To separate a string. | ||
| 34 | # + str: A string. | ||
| 35 | # + NOESCAPE_SEMICOLON: (Optional) Do not escape semicolons. | ||
| 36 | # | ||
| 37 | |||
| 38 | IF(NOT DEFINED _MANAGE_STRING_CMAKE_) | ||
| 39 | SET(_MANAGE_STRING_CMAKE_ "DEFINED") | ||
| 40 | |||
| 41 | MACRO(STRING_TRIM var str) | ||
| 42 | SET(${var} "") | ||
| 43 | IF (NOT "${ARGN}" STREQUAL "NOUNQUOTE") | ||
| 44 | # Need not trim a quoted string. | ||
| 45 | STRING_UNQUOTE(_var "${str}") | ||
| 46 | IF(NOT _var STREQUAL "") | ||
| 47 | # String is quoted | ||
| 48 | SET(${var} "${_var}") | ||
| 49 | ENDIF(NOT _var STREQUAL "") | ||
| 50 | ENDIF(NOT "${ARGN}" STREQUAL "NOUNQUOTE") | ||
| 51 | |||
| 52 | IF(${var} STREQUAL "") | ||
| 53 | SET(_var_1 "${str}") | ||
| 54 | STRING(REGEX REPLACE "^[ \t\r\n]+" "" _var_2 "${str}" ) | ||
| 55 | STRING(REGEX REPLACE "[ \t\r\n]+$" "" _var_3 "${_var_2}" ) | ||
| 56 | SET(${var} "${_var_3}") | ||
| 57 | ENDIF(${var} STREQUAL "") | ||
| 58 | ENDMACRO(STRING_TRIM var str) | ||
| 59 | |||
| 60 | # Internal macro | ||
| 61 | # Variable cannot be escaped here, as variable is already substituted | ||
| 62 | # at the time it passes to this macro. | ||
| 63 | MACRO(STRING_ESCAPE var str) | ||
| 64 | # ';' and '\' are tricky, need to be encoded. | ||
| 65 | # '#' => '#H' | ||
| 66 | # '\' => '#B' | ||
| 67 | # ';' => '#S' | ||
| 68 | SET(_NOESCAPE_SEMICOLON "") | ||
| 69 | SET(_NOESCAPE_HASH "") | ||
| 70 | |||
| 71 | FOREACH(_arg ${ARGN}) | ||
| 72 | IF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") | ||
| 73 | SET(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON") | ||
| 74 | ELSEIF(${_arg} STREQUAL "NOESCAPE_HASH") | ||
| 75 | SET(_NOESCAPE_HASH "NOESCAPE_HASH") | ||
| 76 | ENDIF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") | ||
| 77 | ENDFOREACH(_arg) | ||
| 78 | |||
| 79 | IF(_NOESCAPE_HASH STREQUAL "") | ||
| 80 | STRING(REGEX REPLACE "#" "#H" _ret "${str}") | ||
| 81 | ELSE(_NOESCAPE_HASH STREQUAL "") | ||
| 82 | SET(_ret "${str}") | ||
| 83 | ENDIF(_NOESCAPE_HASH STREQUAL "") | ||
| 84 | |||
| 85 | STRING(REGEX REPLACE "\\\\" "#B" _ret "${_ret}") | ||
| 86 | IF(_NOESCAPE_SEMICOLON STREQUAL "") | ||
| 87 | STRING(REGEX REPLACE ";" "#S" _ret "${_ret}") | ||
| 88 | ENDIF(_NOESCAPE_SEMICOLON STREQUAL "") | ||
| 89 | SET(${var} "${_ret}") | ||
| 90 | ENDMACRO(STRING_ESCAPE var str) | ||
| 91 | |||
| 92 | MACRO(STRING_UNESCAPE var str) | ||
| 93 | # '#B' => '\' | ||
| 94 | # '#H' => '#' | ||
| 95 | # '#D' => '$' | ||
| 96 | # '#S' => ';' | ||
| 97 | SET(_ESCAPE_VARIABLE "") | ||
| 98 | SET(_NOESCAPE_SEMICOLON "") | ||
| 99 | SET(_ret "${str}") | ||
| 100 | FOREACH(_arg ${ARGN}) | ||
| 101 | IF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") | ||
| 102 | SET(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON") | ||
| 103 | ELSEIF(${_arg} STREQUAL "ESCAPE_VARIABLE") | ||
| 104 | SET(_ESCAPE_VARIABLE "ESCAPE_VARIABLE") | ||
| 105 | STRING(REGEX REPLACE "#D" "$" _ret "${_ret}") | ||
| 106 | ENDIF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") | ||
| 107 | ENDFOREACH(_arg) | ||
| 108 | |||
| 109 | STRING(REGEX REPLACE "#B" "\\\\" _ret "${_ret}") | ||
| 110 | IF(_NOESCAPE_SEMICOLON STREQUAL "") | ||
| 111 | # ';' => '#S' | ||
| 112 | STRING(REGEX REPLACE "#S" "\\\\;" _ret "${_ret}") | ||
| 113 | ELSE(_NOESCAPE_SEMICOLON STREQUAL "") | ||
| 114 | STRING(REGEX REPLACE "#S" ";" _ret "${_ret}") | ||
| 115 | ENDIF(_NOESCAPE_SEMICOLON STREQUAL "") | ||
| 116 | |||
| 117 | IF(NOT _ESCAPE_VARIABLE STREQUAL "") | ||
| 118 | # '#D' => '$' | ||
| 119 | STRING(REGEX REPLACE "#D" "$" _ret "${_ret}") | ||
| 120 | ENDIF(NOT _ESCAPE_VARIABLE STREQUAL "") | ||
| 121 | STRING(REGEX REPLACE "#H" "#" _ret "${_ret}") | ||
| 122 | SET(${var} "${_ret}") | ||
| 123 | ENDMACRO(STRING_UNESCAPE var str) | ||
| 124 | |||
| 125 | |||
| 126 | MACRO(STRING_UNQUOTE var str) | ||
| 127 | STRING_ESCAPE(_ret "${str}" ${ARGN}) | ||
| 128 | IF(_ret MATCHES "^[ \t\r\n]+") | ||
| 129 | STRING(REGEX REPLACE "^[ \t\r\n]+" "" _ret "${_ret}") | ||
| 130 | ENDIF(_ret MATCHES "^[ \t\r\n]+") | ||
| 131 | IF(_ret MATCHES "^\"") | ||
| 132 | # Double quote | ||
| 133 | STRING(REGEX REPLACE "\"\(.*\)\"[ \t\r\n]*$" "\\1" _ret "${_ret}") | ||
| 134 | ELSEIF(_ret MATCHES "^'") | ||
| 135 | # Single quote | ||
| 136 | STRING(REGEX REPLACE "'\(.*\)'[ \t\r\n]*$" "\\1" _ret "${_ret}") | ||
| 137 | ELSE(_ret MATCHES "^\"") | ||
| 138 | SET(_ret "") | ||
| 139 | ENDIF(_ret MATCHES "^\"") | ||
| 140 | |||
| 141 | # Unencoding | ||
| 142 | STRING_UNESCAPE(${var} "${_ret}" ${ARGN}) | ||
| 143 | ENDMACRO(STRING_UNQUOTE var str) | ||
| 144 | |||
| 145 | MACRO(STRING_JOIN var delimiter str_list) | ||
| 146 | SET(_ret "") | ||
| 147 | FOREACH(_str ${str_list}) | ||
| 148 | IF(_ret STREQUAL "") | ||
| 149 | SET(_ret "${_str}") | ||
| 150 | ELSE(_ret STREQUAL "") | ||
| 151 | SET(_ret "${_ret}${delimiter}${_str}") | ||
| 152 | ENDIF(_ret STREQUAL "") | ||
| 153 | ENDFOREACH(_str ${str_list}) | ||
| 154 | |||
| 155 | FOREACH(_str ${ARGN}) | ||
| 156 | IF(_ret STREQUAL "") | ||
| 157 | SET(_ret "${_str}") | ||
| 158 | ELSE(_ret STREQUAL "") | ||
| 159 | SET(_ret "${_ret}${delimiter}${_str}") | ||
| 160 | ENDIF(_ret STREQUAL "") | ||
| 161 | ENDFOREACH(_str ${str_list}) | ||
| 162 | SET(${var} "${_ret}") | ||
| 163 | ENDMACRO(STRING_JOIN var delimiter str_list) | ||
| 164 | |||
| 165 | MACRO(STRING_SPLIT var delimiter str) | ||
| 166 | SET(_max_tokens "") | ||
| 167 | SET(_NOESCAPE_SEMICOLON "") | ||
| 168 | SET(_ESCAPE_VARIABLE "") | ||
| 169 | FOREACH(_arg ${ARGN}) | ||
| 170 | IF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") | ||
| 171 | SET(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON") | ||
| 172 | ELSEIF(${_arg} STREQUAL "ESCAPE_VARIABLE") | ||
| 173 | SET(_ESCAPE_VARIABLE "ESCAPE_VARIABLE") | ||
| 174 | ELSE(${_arg} STREQUAL "NOESCAPE_SEMICOLON") | ||
| 175 | SET(_max_tokens ${_arg}) | ||
| 176 | ENDIF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") | ||
| 177 | ENDFOREACH(_arg) | ||
| 178 | |||
| 179 | IF(NOT _max_tokens) | ||
| 180 | SET(_max_tokens -1) | ||
| 181 | ENDIF(NOT _max_tokens) | ||
| 182 | |||
| 183 | STRING_ESCAPE(_str "${str}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE}) | ||
| 184 | STRING_ESCAPE(_delimiter "${delimiter}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE}) | ||
| 185 | |||
| 186 | SET(_str_list "") | ||
| 187 | SET(_token_count 0) | ||
| 188 | STRING(LENGTH "${_delimiter}" _de_len) | ||
| 189 | |||
| 190 | WHILE(NOT _token_count EQUAL _max_tokens) | ||
| 191 | MATH(EXPR _token_count ${_token_count}+1) | ||
| 192 | IF(_token_count EQUAL _max_tokens) | ||
| 193 | # Last token, no need splitting | ||
| 194 | SET(_str_list ${_str_list} "${_str}") | ||
| 195 | ELSE(_token_count EQUAL _max_tokens) | ||
| 196 | # in case encoded characters are delimiters | ||
| 197 | STRING(LENGTH "${_str}" _str_len) | ||
| 198 | SET(_index 0) | ||
| 199 | SET(_token "") | ||
| 200 | SET(_str_remain "") | ||
| 201 | MATH(EXPR _str_end ${_str_len}-${_de_len}+1) | ||
| 202 | SET(_bound "k") | ||
| 203 | WHILE(_index LESS _str_end) | ||
| 204 | STRING(SUBSTRING "${_str}" ${_index} ${_de_len} _str_cursor) | ||
| 205 | IF(_str_cursor STREQUAL _delimiter) | ||
| 206 | # Get the token | ||
| 207 | STRING(SUBSTRING "${_str}" 0 ${_index} _token) | ||
| 208 | # Get the rest | ||
| 209 | MATH(EXPR _rest_index ${_index}+${_de_len}) | ||
| 210 | MATH(EXPR _rest_len ${_str_len}-${_index}-${_de_len}) | ||
| 211 | STRING(SUBSTRING "${_str}" ${_rest_index} ${_rest_len} _str_remain) | ||
| 212 | SET(_index ${_str_end}) | ||
| 213 | ELSE(_str_cursor STREQUAL _delimiter) | ||
| 214 | MATH(EXPR _index ${_index}+1) | ||
| 215 | ENDIF(_str_cursor STREQUAL _delimiter) | ||
| 216 | ENDWHILE(_index LESS _str_end) | ||
| 217 | |||
| 218 | IF(_str_remain STREQUAL "") | ||
| 219 | # Meaning: end of string | ||
| 220 | LIST(APPEND _str_list "${_str}") | ||
| 221 | SET(_max_tokens ${_token_count}) | ||
| 222 | ELSE(_str_remain STREQUAL "") | ||
| 223 | LIST(APPEND _str_list "${_token}") | ||
| 224 | SET(_str "${_str_remain}") | ||
| 225 | ENDIF(_str_remain STREQUAL "") | ||
| 226 | ENDIF(_token_count EQUAL _max_tokens) | ||
| 227 | ENDWHILE(NOT _token_count EQUAL _max_tokens) | ||
| 228 | |||
| 229 | |||
| 230 | # Unencoding | ||
| 231 | STRING_UNESCAPE(${var} "${_str_list}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE}) | ||
| 232 | ENDMACRO(STRING_SPLIT var delimiter str) | ||
| 233 | |||
| 234 | ENDIF(NOT DEFINED _MANAGE_STRING_CMAKE_) | ||
| 235 | |||
diff --git a/project/cmake/scripts/common/pathsetup.cmake b/project/cmake/scripts/common/pathsetup.cmake new file mode 100644 index 0000000..54b352d --- /dev/null +++ b/project/cmake/scripts/common/pathsetup.cmake | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | # This script configures installation paths | ||
| 2 | |||
| 3 | include(${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/pathsetup.cmake) | ||
diff --git a/project/cmake/scripts/common/prepare-env.cmake b/project/cmake/scripts/common/prepare-env.cmake index 3413c45..b9a39e7 100644 --- a/project/cmake/scripts/common/prepare-env.cmake +++ b/project/cmake/scripts/common/prepare-env.cmake | |||
| @@ -12,6 +12,8 @@ if(EXISTS "${APP_ROOT}/version.txt") | |||
| 12 | set(${name} "${value}") | 12 | set(${name} "${value}") |
| 13 | endif() | 13 | endif() |
| 14 | endforeach() | 14 | endforeach() |
| 15 | string(TOLOWER ${APP_NAME} APP_NAME_LC) | ||
| 16 | string(TOUPPER ${APP_NAME} APP_NAME_UC) | ||
| 15 | endif() | 17 | endif() |
| 16 | 18 | ||
| 17 | # bail if we can't parse versions | 19 | # bail if we can't parse versions |
| @@ -19,16 +21,21 @@ if(NOT DEFINED APP_VERSION_MAJOR OR NOT DEFINED APP_VERSION_MINOR) | |||
| 19 | message(FATAL_ERROR "Could not determine app version! make sure that ${APP_ROOT}/version.txt exists") | 21 | message(FATAL_ERROR "Could not determine app version! make sure that ${APP_ROOT}/version.txt exists") |
| 20 | endif() | 22 | endif() |
| 21 | 23 | ||
| 24 | # in case we need to download something, set KODI_MIRROR to the default if not alread set | ||
| 25 | if(NOT DEFINED KODI_MIRROR) | ||
| 26 | set(KODI_MIRROR "http://mirrors.kodi.tv") | ||
| 27 | endif() | ||
| 28 | |||
| 22 | ### copy all the addon binding header files to include/kodi | 29 | ### copy all the addon binding header files to include/kodi |
| 23 | # make sure include/kodi exists and is empty | 30 | # make sure include/kodi exists and is empty |
| 24 | set(KODI_LIB_DIR ${DEPENDS_PATH}/lib/kodi) | 31 | set(APP_LIB_DIR ${DEPENDS_PATH}/lib/${APP_NAME_LC}) |
| 25 | if(NOT EXISTS "${KODI_LIB_DIR}/") | 32 | if(NOT EXISTS "${APP_LIB_DIR}/") |
| 26 | file(MAKE_DIRECTORY ${KODI_LIB_DIR}) | 33 | file(MAKE_DIRECTORY ${APP_LIB_DIR}) |
| 27 | endif() | 34 | endif() |
| 28 | 35 | ||
| 29 | set(KODI_INCLUDE_DIR ${DEPENDS_PATH}/include/kodi) | 36 | set(APP_INCLUDE_DIR ${DEPENDS_PATH}/include/${APP_NAME_LC}) |
| 30 | if(NOT EXISTS "${KODI_INCLUDE_DIR}/") | 37 | if(NOT EXISTS "${APP_INCLUDE_DIR}/") |
| 31 | file(MAKE_DIRECTORY ${KODI_INCLUDE_DIR}) | 38 | file(MAKE_DIRECTORY ${APP_INCLUDE_DIR}) |
| 32 | endif() | 39 | endif() |
| 33 | 40 | ||
| 34 | # we still need XBMC_INCLUDE_DIR and XBMC_LIB_DIR for backwards compatibility to xbmc | 41 | # we still need XBMC_INCLUDE_DIR and XBMC_LIB_DIR for backwards compatibility to xbmc |
| @@ -49,13 +56,13 @@ if(NOT WIN32) | |||
| 49 | endif() | 56 | endif() |
| 50 | endif() | 57 | endif() |
| 51 | 58 | ||
| 52 | # kodi-config.cmake.in (further down) expects a "prefix" variable | ||
| 53 | get_filename_component(prefix "${DEPENDS_PATH}" ABSOLUTE) | ||
| 54 | |||
| 55 | # generate the proper kodi-config.cmake file | 59 | # generate the proper kodi-config.cmake file |
| 56 | configure_file(${APP_ROOT}/project/cmake/kodi-config.cmake.in ${KODI_LIB_DIR}/kodi-config.cmake @ONLY) | 60 | configure_file(${APP_ROOT}/project/cmake/kodi-config.cmake.in ${APP_LIB_DIR}/kodi-config.cmake @ONLY) |
| 61 | |||
| 57 | # copy cmake helpers to lib/kodi | 62 | # copy cmake helpers to lib/kodi |
| 58 | file(COPY ${APP_ROOT}/project/cmake/scripts/common/addon-helpers.cmake ${APP_ROOT}/project/cmake/scripts/common/addoptions.cmake DESTINATION ${KODI_LIB_DIR}) | 63 | file(COPY ${APP_ROOT}/project/cmake/scripts/common/addon-helpers.cmake |
| 64 | ${APP_ROOT}/project/cmake/scripts/common/addoptions.cmake | ||
| 65 | DESTINATION ${APP_LIB_DIR}) | ||
| 59 | 66 | ||
| 60 | # generate xbmc-config.cmake for backwards compatibility to xbmc | 67 | # generate xbmc-config.cmake for backwards compatibility to xbmc |
| 61 | configure_file(${APP_ROOT}/project/cmake/xbmc-config.cmake.in ${XBMC_LIB_DIR}/xbmc-config.cmake @ONLY) | 68 | configure_file(${APP_ROOT}/project/cmake/xbmc-config.cmake.in ${XBMC_LIB_DIR}/xbmc-config.cmake @ONLY) |
| @@ -69,7 +76,7 @@ foreach(binding ${bindings}) | |||
| 69 | string(REPLACE "+=" ";" binding "${binding}") | 76 | string(REPLACE "+=" ";" binding "${binding}") |
| 70 | list(GET binding 1 header) | 77 | list(GET binding 1 header) |
| 71 | # copy the header file to include/kodi | 78 | # copy the header file to include/kodi |
| 72 | file(COPY ${APP_ROOT}/${header} DESTINATION ${KODI_INCLUDE_DIR}) | 79 | file(COPY ${APP_ROOT}/${header} DESTINATION ${APP_INCLUDE_DIR}) |
| 73 | 80 | ||
| 74 | # auto-generate header files for backwards compatibility to xbmc with deprecation warning | 81 | # auto-generate header files for backwards compatibility to xbmc with deprecation warning |
| 75 | # but only do it if the file doesn't already exist | 82 | # but only do it if the file doesn't already exist |
| @@ -95,7 +102,7 @@ if(WIN32) | |||
| 95 | else() | 102 | else() |
| 96 | set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-1") | 103 | set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-1") |
| 97 | set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip") | 104 | set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip") |
| 98 | set(PATCH_URL "http://mirrors.xbmc.org/build-deps/win32/${PATCH_ARCHIVE}") | 105 | set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}") |
| 99 | set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE}) | 106 | set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE}) |
| 100 | 107 | ||
| 101 | # download the archive containing patch.exe | 108 | # download the archive containing patch.exe |
diff --git a/project/cmake/scripts/common/projectmacros.cmake b/project/cmake/scripts/common/projectmacros.cmake new file mode 100644 index 0000000..d0739c4 --- /dev/null +++ b/project/cmake/scripts/common/projectmacros.cmake | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | # This script holds macros which are project specific | ||
| 2 | |||
| 3 | # Pack a skin xbt file | ||
| 4 | # Arguments: | ||
| 5 | # input input directory to pack | ||
| 6 | # output ouput xbt file | ||
| 7 | # On return: | ||
| 8 | # xbt is added to ${XBT_FILES} | ||
| 9 | function(pack_xbt input output) | ||
| 10 | file(GLOB_RECURSE MEDIA_FILES ${input}/*) | ||
| 11 | get_filename_component(dir ${output} PATH) | ||
| 12 | add_custom_command(OUTPUT ${output} | ||
| 13 | COMMAND ${CMAKE_COMMAND} -E make_directory ${dir} | ||
| 14 | COMMAND TexturePacker::TexturePacker | ||
| 15 | ARGS -input ${input} | ||
| 16 | -output ${output} | ||
| 17 | -dupecheck | ||
| 18 | DEPENDS ${MEDIA_FILES}) | ||
| 19 | list(APPEND XBT_FILES ${output}) | ||
| 20 | set(XBT_FILES ${XBT_FILES} PARENT_SCOPE) | ||
| 21 | endfunction() | ||
| 22 | |||
| 23 | # Add a skin to installation list, mirroring it in build tree, packing textures | ||
| 24 | # Arguments: | ||
| 25 | # skin skin directory | ||
| 26 | # relative relative base path in build tree | ||
| 27 | # On return: | ||
| 28 | # xbt is added to ${XBT_FILES}, data added to ${install_data}, mirror in build tree | ||
| 29 | function(copy_skin_to_buildtree skin relative) | ||
| 30 | file(GLOB_RECURSE FILES ${skin}/*) | ||
| 31 | file(GLOB_RECURSE MEDIA_FILES ${skin}/media/*) | ||
| 32 | list(REMOVE_ITEM FILES ${MEDIA_FILES}) | ||
| 33 | foreach(file ${FILES}) | ||
| 34 | copy_file_to_buildtree(${file} ${relative}) | ||
| 35 | endforeach() | ||
| 36 | file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${dest}/media) | ||
| 37 | string(REPLACE "${relative}/" "" dest ${skin}) | ||
| 38 | pack_xbt(${skin}/media | ||
| 39 | ${CMAKE_BINARY_DIR}/${dest}/media/Textures.xbt | ||
| 40 | ${CMAKE_BINARY_DIR}) | ||
| 41 | |||
| 42 | set(XBT_FILES ${XBT_FILES} PARENT_SCOPE) | ||
| 43 | set(install_data ${install_data} PARENT_SCOPE) | ||
| 44 | endfunction() | ||
| 45 | |||
| 46 | # Get GTest tests as CMake tests. | ||
| 47 | # Copied from FindGTest.cmake | ||
| 48 | # Thanks to Daniel Blezek <blezek@gmail.com> for the GTEST_ADD_TESTS code | ||
| 49 | function(GTEST_ADD_TESTS executable extra_args) | ||
| 50 | if(NOT ARGN) | ||
| 51 | message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS") | ||
| 52 | endif() | ||
| 53 | foreach(source ${ARGN}) | ||
| 54 | file(READ "${source}" contents) | ||
| 55 | string(REGEX MATCHALL "TEST_?[F]?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) | ||
| 56 | foreach(hit ${found_tests}) | ||
| 57 | string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit}) | ||
| 58 | add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args}) | ||
| 59 | endforeach() | ||
| 60 | # Groups parametrized tests under a single ctest entry | ||
| 61 | string(REGEX MATCHALL "INSTANTIATE_TEST_CASE_P\\(([^,]+), *([^,]+)" found_tests2 ${contents}) | ||
| 62 | foreach(hit ${found_tests2}) | ||
| 63 | string(SUBSTRING ${hit} 24 -1 test_name) | ||
| 64 | string(REPLACE "," ";" test_name "${test_name}") | ||
| 65 | list(GET test_name 0 filter_name) | ||
| 66 | list(GET test_name 1 test_prefix) | ||
| 67 | string(STRIP ${test_prefix} test_prefix) | ||
| 68 | add_test(${test_prefix}.${filter_name} ${executable} --gtest_filter=${filter_name}* ${extra_args}) | ||
| 69 | endforeach() | ||
| 70 | endforeach() | ||
| 71 | endfunction() | ||
| 72 | |||
| 73 | function(whole_archive output) | ||
| 74 | if(CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) | ||
| 75 | set(${output} -Wl,--whole-archive ${ARGN} -Wl,--no-whole-archive PARENT_SCOPE) | ||
| 76 | elseif(CMAKE_CXX_COMPILER_ID STREQUAL AppleClang) | ||
| 77 | foreach(library ${ARGN}) | ||
| 78 | list(APPEND ${output} -Wl,-force_load ${library}) | ||
| 79 | set(${output} ${${output}} PARENT_SCOPE) | ||
| 80 | endforeach() | ||
| 81 | else() | ||
| 82 | set(${output} ${ARGN} PARENT_SCOPE) | ||
| 83 | endif() | ||
| 84 | endfunction() | ||
diff --git a/project/cmake/scripts/darwin/archsetup.cmake b/project/cmake/scripts/darwin/archsetup.cmake new file mode 100644 index 0000000..accb8ab --- /dev/null +++ b/project/cmake/scripts/darwin/archsetup.cmake | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | if(NOT CMAKE_TOOLCHAIN_FILE) | ||
| 2 | message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for darwin. See ${PROJECT_SOURCE_DIR}/README.md") | ||
| 3 | endif() | ||
| 4 | |||
| 5 | set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/posix/main.cpp | ||
| 6 | ${CORE_SOURCE_DIR}/xbmc/platform/darwin/osx/SDLMain.mm | ||
| 7 | ${CORE_SOURCE_DIR}/xbmc/platform/darwin/osx/SDLMain.h) | ||
| 8 | |||
| 9 | set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX) | ||
| 10 | set(SYSTEM_DEFINES -D_REENTRANT -D_FILE_DEFINED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE | ||
| 11 | -D__STDC_CONSTANT_MACROS) | ||
| 12 | set(PLATFORM_DIR linux) | ||
| 13 | set(CMAKE_SYSTEM_NAME Darwin) | ||
| 14 | if(WITH_ARCH) | ||
| 15 | set(ARCH ${WITH_ARCH}) | ||
| 16 | else() | ||
| 17 | if(CPU STREQUAL x86_64) | ||
| 18 | set(ARCH x86_64-apple-darwin) | ||
| 19 | elseif(CPU STREQUAL i386) | ||
| 20 | set(ARCH i386-apple-darwin) | ||
| 21 | else() | ||
| 22 | message(SEND_ERROR "Unknown CPU: ${CPU}") | ||
| 23 | endif() | ||
| 24 | endif() | ||
| 25 | |||
| 26 | find_package(CXX11 REQUIRED) | ||
| 27 | |||
| 28 | list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${NATIVEPREFIX}) | ||
| 29 | |||
| 30 | list(APPEND DEPLIBS "-framework DiskArbitration" "-framework IOKit" | ||
| 31 | "-framework IOSurface" "-framework SystemConfiguration" | ||
| 32 | "-framework ApplicationServices" "-framework AppKit" | ||
| 33 | "-framework CoreAudio" "-framework AudioToolbox" | ||
| 34 | "-framework CoreGraphics") | ||
diff --git a/project/cmake/scripts/darwin/install.cmake b/project/cmake/scripts/darwin/install.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/project/cmake/scripts/darwin/install.cmake | |||
diff --git a/project/cmake/scripts/darwin/macros.cmake b/project/cmake/scripts/darwin/macros.cmake new file mode 100644 index 0000000..4ee17c2 --- /dev/null +++ b/project/cmake/scripts/darwin/macros.cmake | |||
| @@ -0,0 +1,108 @@ | |||
| 1 | function(core_link_library lib wraplib) | ||
| 2 | if(CMAKE_GENERATOR MATCHES "Unix Makefiles") | ||
| 3 | set(wrapper_obj cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o) | ||
| 4 | elseif(CMAKE_GENERATOR MATCHES "Xcode") | ||
| 5 | set(wrapper_obj cores/dll-loader/exports/kodi.build/$(CONFIGURATION)/wrapper.build/Objects-$(CURRENT_VARIANT)/$(CURRENT_ARCH)/wrapper.o) | ||
| 6 | else() | ||
| 7 | message(FATAL_ERROR "Unsupported generator in core_link_library") | ||
| 8 | endif() | ||
| 9 | |||
| 10 | set(export -bundle -undefined dynamic_lookup -read_only_relocs suppress | ||
| 11 | -Wl,-alias_list,${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def | ||
| 12 | ${CORE_BUILD_DIR}/${wrapper_obj}) | ||
| 13 | set(check_arg "") | ||
| 14 | if(TARGET ${lib}) | ||
| 15 | set(target ${lib}) | ||
| 16 | set(link_lib $<TARGET_FILE:${lib}>) | ||
| 17 | set(check_arg ${ARGV2}) | ||
| 18 | set(data_arg ${ARGV3}) | ||
| 19 | else() | ||
| 20 | set(target ${ARGV2}) | ||
| 21 | set(link_lib ${lib}) | ||
| 22 | set(check_arg ${ARGV3}) | ||
| 23 | set(data_arg ${ARGV4}) | ||
| 24 | endif() | ||
| 25 | if(check_arg STREQUAL export) | ||
| 26 | set(export ${export} | ||
| 27 | -Wl,--version-script=${ARGV3}) | ||
| 28 | elseif(check_arg STREQUAL nowrap) | ||
| 29 | set(export ${data_arg}) | ||
| 30 | elseif(check_arg STREQUAL extras) | ||
| 31 | foreach(arg ${data_arg}) | ||
| 32 | list(APPEND export ${arg}) | ||
| 33 | endforeach() | ||
| 34 | endif() | ||
| 35 | get_filename_component(dir ${wraplib} PATH) | ||
| 36 | |||
| 37 | # We can't simply pass the linker flags to the args section of the custom command | ||
| 38 | # because cmake will add quotes around it (and the linker will fail due to those). | ||
| 39 | # We need to do this handstand first ... | ||
| 40 | separate_arguments(CUSTOM_COMMAND_ARGS_LDFLAGS UNIX_COMMAND "${CMAKE_SHARED_LINKER_FLAGS}") | ||
| 41 | |||
| 42 | add_custom_command(OUTPUT ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} | ||
| 43 | COMMAND ${CMAKE_COMMAND} -E make_directory ${dir} | ||
| 44 | COMMAND ${CMAKE_C_COMPILER} | ||
| 45 | ARGS ${CUSTOM_COMMAND_ARGS_LDFLAGS} ${export} -Wl,-force_load ${link_lib} | ||
| 46 | -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} | ||
| 47 | DEPENDS ${target} wrapper.def wrapper | ||
| 48 | VERBATIM) | ||
| 49 | |||
| 50 | # Uncomment to create wrap_<lib> targets for debugging | ||
| 51 | #get_filename_component(libname ${wraplib} NAME_WE) | ||
| 52 | #add_custom_target(wrap_${libname} ALL DEPENDS ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}) | ||
| 53 | |||
| 54 | list(APPEND WRAP_FILES ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}) | ||
| 55 | set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE) | ||
| 56 | endfunction() | ||
| 57 | |||
| 58 | function(find_soname lib) | ||
| 59 | cmake_parse_arguments(arg "REQUIRED" "" "" ${ARGN}) | ||
| 60 | |||
| 61 | string(TOLOWER ${lib} liblow) | ||
| 62 | if(${lib}_LDFLAGS) | ||
| 63 | set(link_lib "${${lib}_LDFLAGS}") | ||
| 64 | else() | ||
| 65 | set(link_lib "${${lib}_LIBRARIES}") | ||
| 66 | endif() | ||
| 67 | |||
| 68 | execute_process(COMMAND ${CMAKE_C_COMPILER} -print-search-dirs | ||
| 69 | COMMAND fgrep libraries: | ||
| 70 | COMMAND sed "s/[^=]*=\\(.*\\)/\\1/" | ||
| 71 | COMMAND sed "s/:/ /g" | ||
| 72 | ERROR_QUIET | ||
| 73 | OUTPUT_VARIABLE cc_lib_path | ||
| 74 | OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
| 75 | execute_process(COMMAND echo ${link_lib} | ||
| 76 | COMMAND sed "s/-L[ ]*//g" | ||
| 77 | COMMAND sed "s/-l[^ ]*//g" | ||
| 78 | ERROR_QUIET | ||
| 79 | OUTPUT_VARIABLE env_lib_path | ||
| 80 | OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
| 81 | |||
| 82 | foreach(path ${cc_lib_path} ${env_lib_path}) | ||
| 83 | if(IS_DIRECTORY ${path}) | ||
| 84 | execute_process(COMMAND ls -- ${path}/lib${liblow}.dylib | ||
| 85 | ERROR_QUIET | ||
| 86 | OUTPUT_VARIABLE lib_file | ||
| 87 | OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
| 88 | else() | ||
| 89 | set(lib_file ${path}) | ||
| 90 | endif() | ||
| 91 | if(lib_file) | ||
| 92 | # we want the path/name that is embedded in the dylib | ||
| 93 | execute_process(COMMAND otool -L ${lib_file} | ||
| 94 | COMMAND grep -v lib${liblow}.dylib | ||
| 95 | COMMAND grep ${liblow} | ||
| 96 | COMMAND awk "{V=1; print $V}" | ||
| 97 | ERROR_QUIET | ||
| 98 | OUTPUT_VARIABLE filename | ||
| 99 | OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
| 100 | get_filename_component(${lib}_SONAME "${filename}" NAME) | ||
| 101 | message(STATUS "${lib} soname: ${${lib}_SONAME}") | ||
| 102 | endif() | ||
| 103 | endforeach() | ||
| 104 | if(arg_REQUIRED AND NOT ${lib}_SONAME) | ||
| 105 | message(FATAL_ERROR "Could not find dynamically loadable library ${lib}") | ||
| 106 | endif() | ||
| 107 | set(${lib}_SONAME ${${lib}_SONAME} PARENT_SCOPE) | ||
| 108 | endfunction() | ||
diff --git a/project/cmake/scripts/darwin/pathsetup.cmake b/project/cmake/scripts/darwin/pathsetup.cmake new file mode 100644 index 0000000..e31f66e --- /dev/null +++ b/project/cmake/scripts/darwin/pathsetup.cmake | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | if(NOT prefix) | ||
| 2 | set(prefix ${DEPENDS_PATH}) | ||
| 3 | endif() | ||
| 4 | if(NOT exec_prefix) | ||
| 5 | set(exec_prefix \${prefix}) | ||
| 6 | endif() | ||
| 7 | if(NOT libdir) | ||
| 8 | set(libdir ${prefix}/lib) | ||
| 9 | endif() | ||
| 10 | if(NOT bindir) | ||
| 11 | set(bindir ${prefix}/bin) | ||
| 12 | endif() | ||
| 13 | if(NOT includedir) | ||
| 14 | set(includedir ${prefix}/include) | ||
| 15 | endif() | ||
| 16 | if(NOT datarootdir) | ||
| 17 | set(datarootdir ${prefix}/share) | ||
| 18 | endif() | ||
| 19 | if(NOT datadir) | ||
| 20 | set(datadir \${datarootdir}) | ||
| 21 | endif() | ||
| 22 | |||
| 23 | list(APPEND final_message "-- PATH config --") | ||
| 24 | list(APPEND final_message "Prefix: ${prefix}") | ||
| 25 | list(APPEND final_message "Libdir: ${libdir}") | ||
| 26 | list(APPEND final_message "Bindir: ${bindir}") | ||
| 27 | list(APPEND final_message "Includedir: ${includedir}") | ||
| 28 | list(APPEND final_message "Datarootdir: ${datarootdir}") | ||
| 29 | list(APPEND final_message "Datadir: ${datadir}") | ||
| 30 | |||
| 31 | set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/xbmc\" | ||
| 32 | -DINSTALL_PATH=\"${datarootdir}/xbmc\") | ||
diff --git a/project/cmake/scripts/freebsd/archsetup.cmake b/project/cmake/scripts/freebsd/archsetup.cmake new file mode 100644 index 0000000..edc77f1 --- /dev/null +++ b/project/cmake/scripts/freebsd/archsetup.cmake | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_FREEBSD) | ||
| 2 | set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED | ||
| 3 | -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) | ||
| 4 | set(PLATFORM_DIR linux) | ||
| 5 | set(SYSTEM_LDFLAGS -L/usr/local/lib) | ||
| 6 | if(WITH_ARCH) | ||
| 7 | set(ARCH ${WITH_ARCH}) | ||
| 8 | else() | ||
| 9 | if(CMAKE_SYSTEM_PROCESSOR STREQUAL amd64) | ||
| 10 | set(ARCH x86_64-freebsd) | ||
| 11 | elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i.86") | ||
| 12 | set(ARCH x86-freebsd) | ||
| 13 | else() | ||
| 14 | message(WARNING "unknown CPU: ${CPU}") | ||
| 15 | endif() | ||
| 16 | endif() | ||
| 17 | |||
| 18 | set(LIRC_DEVICE "\"/dev/lircd\"" CACHE STRING "LIRC device to use") | ||
| 19 | set(DEP_DEFINES -DLIRC_DEVICE=${LIRC_DEVICE}) | ||
diff --git a/project/cmake/scripts/freebsd/install.cmake b/project/cmake/scripts/freebsd/install.cmake new file mode 100644 index 0000000..0c8939e --- /dev/null +++ b/project/cmake/scripts/freebsd/install.cmake | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | set(libdir ${CMAKE_INSTALL_PREFIX}/lib) | ||
| 2 | set(bindir ${CMAKE_INSTALL_PREFIX}/bin) | ||
| 3 | |||
| 4 | configure_file(${CORE_SOURCE_DIR}/tools/Linux/xbmc.sh.in | ||
| 5 | ${CORE_BUILD_DIR}/scripts/xbmc @ONLY) | ||
| 6 | configure_file(${CORE_SOURCE_DIR}/tools/Linux/xbmc-standalone.sh.in | ||
| 7 | ${CORE_BUILD_DIR}/scripts/xbmc-standalone @ONLY) | ||
| 8 | |||
| 9 | install(TARGETS xbmc-xrandr DESTINATION lib/xbmc) | ||
| 10 | install(FILES ${addon_bindings} DESTINATION include/xbmc) | ||
| 11 | install(FILES ${cmake_files} ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/modules/xbmc-config.cmake | ||
| 12 | DESTINATION lib/xbmc) | ||
| 13 | install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/xbmc | ||
| 14 | ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/xbmc-standalone | ||
| 15 | DESTINATION bin) | ||
| 16 | install(FILES ${CORE_SOURCE_DIR}/tools/Linux/FEH.py | ||
| 17 | DESTINATION share/xbmc) | ||
| 18 | |||
| 19 | install(FILES ${CORE_SOURCE_DIR}/tools/Linux/xbmc-xsession.desktop | ||
| 20 | RENAME XBMC.desktop | ||
| 21 | DESTINATION share/xsessions) | ||
| 22 | |||
| 23 | install(FILES ${CORE_SOURCE_DIR}/LICENSE.GPL | ||
| 24 | ${CORE_SOURCE_DIR}/docs/README.freebsd | ||
| 25 | DESTINATION share/doc/xbmc) | ||
| 26 | |||
| 27 | foreach(texture ${XBT_FILES}) | ||
| 28 | string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${texture}) | ||
| 29 | get_filename_component(dir ${dir} PATH) | ||
| 30 | install(FILES ${texture} | ||
| 31 | DESTINATION share/xbmc/${dir}) | ||
| 32 | endforeach() | ||
| 33 | |||
| 34 | foreach(wraplib ${WRAP_FILES}) | ||
| 35 | get_filename_component(dir ${wraplib} PATH) | ||
| 36 | install(PROGRAMS ${CMAKE_BINARY_DIR}/${wraplib} | ||
| 37 | DESTINATION lib/xbmc/${dir}) | ||
| 38 | endforeach() | ||
| 39 | |||
| 40 | foreach(file ${install_data}) | ||
| 41 | get_filename_component(dir ${file} PATH) | ||
| 42 | install(FILES ${CMAKE_BINARY_DIR}/${file} | ||
| 43 | DESTINATION share/xbmc/${dir}) | ||
| 44 | endforeach() | ||
| 45 | |||
| 46 | install(CODE "file(STRINGS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs dirs) | ||
| 47 | foreach(dir \${dirs}) | ||
| 48 | file(GLOB_RECURSE FILES RELATIVE ${CMAKE_BINARY_DIR} \${dir}/*) | ||
| 49 | foreach(file \${FILES}) | ||
| 50 | get_filename_component(dir \${file} PATH) | ||
| 51 | file(INSTALL \${file} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/xbmc/\${dir}) | ||
| 52 | endforeach() | ||
| 53 | endforeach()") | ||
| 54 | foreach(subdir ${build_dirs}) | ||
| 55 | string(REPLACE " " ";" subdir ${subdir}) | ||
| 56 | list(GET subdir 0 id) | ||
| 57 | install(CODE "execute_process(COMMAND make -C ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${id}/src/${id}-build install)") | ||
| 58 | endforeach() | ||
diff --git a/project/cmake/scripts/freebsd/macros.cmake b/project/cmake/scripts/freebsd/macros.cmake new file mode 100644 index 0000000..f0bf7ba --- /dev/null +++ b/project/cmake/scripts/freebsd/macros.cmake | |||
| @@ -0,0 +1 @@ | |||
| include(../linux/macros.cmake) | |||
diff --git a/project/cmake/scripts/freebsd/pathsetup.cmake b/project/cmake/scripts/freebsd/pathsetup.cmake new file mode 100644 index 0000000..1fb45b6 --- /dev/null +++ b/project/cmake/scripts/freebsd/pathsetup.cmake | |||
| @@ -0,0 +1 @@ | |||
| include(${PROJECT_SOURCE_DIR}/scripts/linux/pathsetup.cmake) | |||
diff --git a/project/cmake/scripts/ios/archsetup.cmake b/project/cmake/scripts/ios/archsetup.cmake new file mode 100644 index 0000000..e6639f7 --- /dev/null +++ b/project/cmake/scripts/ios/archsetup.cmake | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | if(NOT CMAKE_TOOLCHAIN_FILE) | ||
| 2 | message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for ios. See ${PROJECT_SOURCE_DIR}/README.md") | ||
| 3 | endif() | ||
| 4 | |||
| 5 | set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/XBMCApplication.m) | ||
| 6 | |||
| 7 | set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_IOS) | ||
| 8 | set(SYSTEM_DEFINES -D_REENTRANT -D_FILE_DEFINED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE | ||
| 9 | -D__STDC_CONSTANT_MACROS) | ||
| 10 | set(PLATFORM_DIR linux) | ||
| 11 | set(CMAKE_SYSTEM_NAME Darwin) | ||
| 12 | if(WITH_ARCH) | ||
| 13 | set(ARCH ${WITH_ARCH}) | ||
| 14 | else() | ||
| 15 | if(CPU STREQUAL armv7) | ||
| 16 | set(ARCH arm-apple-darwin) | ||
| 17 | elseif(CPU STREQUAL arm64) | ||
| 18 | set(ARCH arm-apple-darwin) | ||
| 19 | else() | ||
| 20 | message(SEND_ERROR "Unknown CPU: ${CPU}") | ||
| 21 | endif() | ||
| 22 | endif() | ||
| 23 | |||
| 24 | find_package(CXX11 REQUIRED) | ||
| 25 | |||
| 26 | list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${NATIVEPREFIX}) | ||
| 27 | |||
| 28 | list(APPEND DEPLIBS "-framework CoreFoundation" "-framework CoreVideo" | ||
| 29 | "-framework CoreAudio" "-framework AudioToolbox" | ||
| 30 | "-framework QuartzCore" "-framework MediaPlayer" | ||
| 31 | "-framework CFNetwork" "-framework CoreGraphics" | ||
| 32 | "-framework Foundation" "-framework UIKit" | ||
| 33 | "-framework CoreMedia" "-framework AVFoundation") | ||
| 34 | |||
| 35 | set(ENABLE_DVDCSS OFF) | ||
| 36 | set(ENABLE_OPTICAL OFF) | ||
| 37 | set(ENABLE_VTB ON) | ||
| 38 | set(VTB_FOUND 1 CACHE INTERNAL "VTB") | ||
diff --git a/project/cmake/scripts/ios/install.cmake b/project/cmake/scripts/ios/install.cmake new file mode 120000 index 0000000..0ea6586 --- /dev/null +++ b/project/cmake/scripts/ios/install.cmake | |||
| @@ -0,0 +1 @@ | |||
| ../darwin/install.cmake \ No newline at end of file | |||
diff --git a/project/cmake/scripts/ios/macros.cmake b/project/cmake/scripts/ios/macros.cmake new file mode 120000 index 0000000..45c7ad1 --- /dev/null +++ b/project/cmake/scripts/ios/macros.cmake | |||
| @@ -0,0 +1 @@ | |||
| ../darwin/macros.cmake \ No newline at end of file | |||
diff --git a/project/cmake/scripts/ios/pathsetup.cmake b/project/cmake/scripts/ios/pathsetup.cmake new file mode 120000 index 0000000..f8e1248 --- /dev/null +++ b/project/cmake/scripts/ios/pathsetup.cmake | |||
| @@ -0,0 +1 @@ | |||
| ../darwin/pathsetup.cmake \ No newline at end of file | |||
diff --git a/project/cmake/scripts/linux/archsetup.cmake b/project/cmake/scripts/linux/archsetup.cmake new file mode 100644 index 0000000..d0e149e --- /dev/null +++ b/project/cmake/scripts/linux/archsetup.cmake | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_LINUX) | ||
| 2 | set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED | ||
| 3 | -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) | ||
| 4 | set(PLATFORM_DIR linux) | ||
| 5 | set(CMAKE_SYSTEM_NAME Linux) | ||
| 6 | if(WITH_ARCH) | ||
| 7 | set(ARCH ${WITH_ARCH}) | ||
| 8 | else() | ||
| 9 | if(CPU STREQUAL x86_64) | ||
| 10 | set(ARCH x86_64-linux) | ||
| 11 | elseif(CPU MATCHES "i.86") | ||
| 12 | set(ARCH i486-linux) | ||
| 13 | else() | ||
| 14 | message(SEND_ERROR "Unknown CPU: ${CPU}") | ||
| 15 | endif() | ||
| 16 | endif() | ||
| 17 | |||
| 18 | find_package(CXX11 REQUIRED) | ||
| 19 | |||
| 20 | set(LIRC_DEVICE "\"/dev/lircd\"" CACHE STRING "LIRC device to use") | ||
| 21 | set(DEP_DEFINES -DLIRC_DEVICE=${LIRC_DEVICE}) | ||
diff --git a/project/cmake/scripts/linux/install.cmake b/project/cmake/scripts/linux/install.cmake new file mode 100644 index 0000000..b887610 --- /dev/null +++ b/project/cmake/scripts/linux/install.cmake | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | if(X_FOUND) | ||
| 2 | set(USE_X11 1) | ||
| 3 | else() | ||
| 4 | set(USE_X11 0) | ||
| 5 | endif() | ||
| 6 | if(OPENGL_FOUND) | ||
| 7 | set(USE_OPENGL 1) | ||
| 8 | else() | ||
| 9 | set(USE_OPENGL 0) | ||
| 10 | endif() | ||
| 11 | if(OPENGLES_FOUND) | ||
| 12 | set(USE_OPENGLES 1) | ||
| 13 | else() | ||
| 14 | set(USE_OPENGLES 0) | ||
| 15 | endif() | ||
| 16 | |||
| 17 | configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi.sh.in | ||
| 18 | ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC} @ONLY) | ||
| 19 | configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.in | ||
| 20 | ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone @ONLY) | ||
| 21 | |||
| 22 | install(TARGETS ${APP_NAME_LC} DESTINATION ${libdir}/kodi) | ||
| 23 | if(ENABLE_X11 AND XRANDR_FOUND) | ||
| 24 | install(TARGETS ${APP_NAME_LC}-xrandr DESTINATION ${libdir}/${APP_NAME_LC}) | ||
| 25 | endif() | ||
| 26 | install(FILES ${addon_bindings} DESTINATION ${includedir}/kodi) | ||
| 27 | install(FILES ${cmake-files} | ||
| 28 | DESTINATION ${libdir}/kodi) | ||
| 29 | install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC} | ||
| 30 | ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone | ||
| 31 | DESTINATION ${bindir}) | ||
| 32 | |||
| 33 | configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi-xsession.desktop.in | ||
| 34 | ${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop) | ||
| 35 | install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop | ||
| 36 | DESTINATION ${datarootdir}/xsessions) | ||
| 37 | |||
| 38 | install(FILES ${CORE_SOURCE_DIR}/LICENSE.GPL | ||
| 39 | ${CORE_SOURCE_DIR}/docs/README.linux | ||
| 40 | DESTINATION ${datarootdir}/doc/kodi) | ||
| 41 | |||
| 42 | install(FILES ${CORE_SOURCE_DIR}/tools/Linux/kodi.desktop | ||
| 43 | DESTINATION ${datarootdir}/applications) | ||
| 44 | |||
| 45 | foreach(texture ${XBT_FILES}) | ||
| 46 | string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${texture}) | ||
| 47 | get_filename_component(dir ${dir} PATH) | ||
| 48 | install(FILES ${texture} | ||
| 49 | DESTINATION ${datarootdir}/kodi/${dir}) | ||
| 50 | endforeach() | ||
| 51 | |||
| 52 | foreach(wraplib ${WRAP_FILES}) | ||
| 53 | get_filename_component(dir ${wraplib} PATH) | ||
| 54 | install(PROGRAMS ${CMAKE_BINARY_DIR}/${wraplib} | ||
| 55 | DESTINATION ${libdir}/kodi/${dir}) | ||
| 56 | endforeach() | ||
| 57 | |||
| 58 | foreach(file ${install_data}) | ||
| 59 | get_filename_component(dir ${file} PATH) | ||
| 60 | install(FILES ${CMAKE_BINARY_DIR}/${file} | ||
| 61 | DESTINATION ${datarootdir}/kodi/${dir}) | ||
| 62 | endforeach() | ||
| 63 | |||
| 64 | if(EXISTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs) | ||
| 65 | install(CODE "file(STRINGS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs dirs) | ||
| 66 | foreach(dir \${dirs}) | ||
| 67 | file(GLOB_RECURSE FILES RELATIVE ${CMAKE_BINARY_DIR} \${dir}/*) | ||
| 68 | foreach(file \${FILES}) | ||
| 69 | get_filename_component(dir \${file} PATH) | ||
| 70 | file(INSTALL \${file} DESTINATION ${datarootdir}/kodi/\${dir}) | ||
| 71 | endforeach() | ||
| 72 | endforeach()") | ||
| 73 | endif() | ||
| 74 | |||
| 75 | if(NOT "$ENV{DESTDIR}" STREQUAL "") | ||
| 76 | set(DESTDIR ${CMAKE_BINARY_DIR}/$ENV{DESTDIR}) | ||
| 77 | endif() | ||
| 78 | foreach(subdir ${build_dirs}) | ||
| 79 | if(NOT subdir MATCHES kodi-platform) | ||
| 80 | string(REPLACE " " ";" subdir ${subdir}) | ||
| 81 | list(GET subdir 0 id) | ||
| 82 | install(CODE "execute_process(COMMAND make -C ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${id}/src/${id}-build install DESTDIR=${DESTDIR})") | ||
| 83 | endif() | ||
| 84 | endforeach() | ||
| 85 | |||
| 86 | install(FILES ${CORE_SOURCE_DIR}/media/icon48x48.png | ||
| 87 | RENAME ${APP_NAME_LC}.png | ||
| 88 | DESTINATION ${datarootdir}/icons/hicolor/48x48/apps) | ||
| 89 | install(FILES ${CORE_SOURCE_DIR}/media/icon256x256.png | ||
| 90 | RENAME ${APP_NAME_LC}.png | ||
| 91 | DESTINATION ${datarootdir}/icons/hicolor/256x256/apps) | ||
| 92 | |||
| 93 | install(CODE "execute_process(COMMAND gtk-update-icon-cache -f -q -t $ENV{DESTDIR}${datarootdir}/icons/hicolor ERROR_QUIET)") | ||
diff --git a/project/cmake/scripts/linux/macros.cmake b/project/cmake/scripts/linux/macros.cmake new file mode 100644 index 0000000..7453a1c --- /dev/null +++ b/project/cmake/scripts/linux/macros.cmake | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | function(core_link_library lib wraplib) | ||
| 2 | set(export -Wl,--unresolved-symbols=ignore-all | ||
| 3 | `cat ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def` | ||
| 4 | ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o) | ||
| 5 | set(check_arg "") | ||
| 6 | if(TARGET ${lib}) | ||
| 7 | set(target ${lib}) | ||
| 8 | set(link_lib ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${lib}/${lib}.a) | ||
| 9 | set(check_arg ${ARGV2}) | ||
| 10 | set(data_arg ${ARGV3}) | ||
| 11 | else() | ||
| 12 | set(target ${ARGV2}) | ||
| 13 | set(link_lib ${lib}) | ||
| 14 | set(check_arg ${ARGV3}) | ||
| 15 | set(data_arg ${ARGV4}) | ||
| 16 | endif() | ||
| 17 | if(check_arg STREQUAL export) | ||
| 18 | set(export ${export} | ||
| 19 | -Wl,--version-script=${ARGV3}) | ||
| 20 | elseif(check_arg STREQUAL nowrap) | ||
| 21 | set(export ${data_arg}) | ||
| 22 | elseif(check_arg STREQUAL extras) | ||
| 23 | foreach(arg ${data_arg}) | ||
| 24 | list(APPEND export ${arg}) | ||
| 25 | endforeach() | ||
| 26 | endif() | ||
| 27 | get_filename_component(dir ${wraplib} PATH) | ||
| 28 | add_custom_command(OUTPUT ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} | ||
| 29 | COMMAND cmake -E make_directory ${dir} | ||
| 30 | COMMAND ${CMAKE_C_COMPILER} | ||
| 31 | ARGS -Wl,--whole-archive | ||
| 32 | ${link_lib} | ||
| 33 | -Wl,--no-whole-archive -lm | ||
| 34 | -shared -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} | ||
| 35 | ${export} | ||
| 36 | DEPENDS ${target} wrapper.def wrapper) | ||
| 37 | list(APPEND WRAP_FILES ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}) | ||
| 38 | set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE) | ||
| 39 | endfunction() | ||
| 40 | |||
| 41 | function(find_soname lib) | ||
| 42 | cmake_parse_arguments(arg "REQUIRED" "" "" ${ARGN}) | ||
| 43 | |||
| 44 | string(TOLOWER ${lib} liblow) | ||
| 45 | if(${lib}_LDFLAGS) | ||
| 46 | set(link_lib "${${lib}_LDFLAGS}") | ||
| 47 | else() | ||
| 48 | if(IS_ABSOLUTE "${${lib}_LIBRARIES}") | ||
| 49 | set(link_lib "${${lib}_LIBRARIES}") | ||
| 50 | else() | ||
| 51 | set(link_lib -l${${lib}_LIBRARIES}) | ||
| 52 | endif() | ||
| 53 | endif() | ||
| 54 | execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-M ${link_lib} | ||
| 55 | COMMAND grep LOAD.*${liblow} | ||
| 56 | ERROR_QUIET | ||
| 57 | OUTPUT_VARIABLE ${lib}_FILENAME) | ||
| 58 | string(REPLACE "LOAD " "" ${lib}_FILENAME "${${lib}_FILENAME}") | ||
| 59 | string(STRIP "${${lib}_FILENAME}" ${lib}_FILENAME) | ||
| 60 | if(NOT ${lib}_FILENAME) | ||
| 61 | execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-t ${link_lib} | ||
| 62 | OUTPUT_QUIET | ||
| 63 | ERROR_VARIABLE _TMP_FILENAME) | ||
| 64 | string(REGEX MATCH ".*lib${liblow}.so" ${lib}_FILENAME ${_TMP_FILENAME}) | ||
| 65 | endif() | ||
| 66 | if(${lib}_FILENAME) | ||
| 67 | execute_process(COMMAND objdump -p ${${lib}_FILENAME} | ||
| 68 | COMMAND grep SONAME.*${liblow} | ||
| 69 | ERROR_QUIET | ||
| 70 | OUTPUT_VARIABLE ${lib}_SONAME) | ||
| 71 | string(REPLACE "SONAME " "" ${lib}_SONAME ${${lib}_SONAME}) | ||
| 72 | string(STRIP ${${lib}_SONAME} ${lib}_SONAME) | ||
| 73 | message(STATUS "${lib} soname: ${${lib}_SONAME}") | ||
| 74 | set(${lib}_SONAME ${${lib}_SONAME} PARENT_SCOPE) | ||
| 75 | endif() | ||
| 76 | if(arg_REQUIRED AND NOT ${lib}_SONAME) | ||
| 77 | message(FATAL_ERROR "Could not find dynamically loadable library ${lib}") | ||
| 78 | endif() | ||
| 79 | endfunction() | ||
diff --git a/project/cmake/scripts/linux/pathsetup.cmake b/project/cmake/scripts/linux/pathsetup.cmake new file mode 100644 index 0000000..940fb62 --- /dev/null +++ b/project/cmake/scripts/linux/pathsetup.cmake | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | if(NOT prefix) | ||
| 2 | set(prefix ${CMAKE_INSTALL_PREFIX}) | ||
| 3 | else() | ||
| 4 | set(CMAKE_INSTALL_PREFIX ${prefix}) | ||
| 5 | endif() | ||
| 6 | if(NOT exec_prefix) | ||
| 7 | set(exec_prefix \${prefix}) | ||
| 8 | endif() | ||
| 9 | if(NOT libdir) | ||
| 10 | set(libdir ${prefix}/lib) | ||
| 11 | endif() | ||
| 12 | if(NOT bindir) | ||
| 13 | set(bindir ${prefix}/bin) | ||
| 14 | endif() | ||
| 15 | if(NOT includedir) | ||
| 16 | set(includedir ${prefix}/include) | ||
| 17 | endif() | ||
| 18 | if(NOT datarootdir) | ||
| 19 | set(datarootdir ${prefix}/share) | ||
| 20 | endif() | ||
| 21 | if(NOT datadir) | ||
| 22 | set(datadir \${datarootdir}) | ||
| 23 | endif() | ||
| 24 | |||
| 25 | list(APPEND final_message "-- PATH config --") | ||
| 26 | list(APPEND final_message "Prefix: ${prefix}") | ||
| 27 | list(APPEND final_message "Libdir: ${libdir}") | ||
| 28 | list(APPEND final_message "Bindir: ${bindir}") | ||
| 29 | list(APPEND final_message "Includedir: ${includedir}") | ||
| 30 | list(APPEND final_message "Datarootdir: ${datarootdir}") | ||
| 31 | list(APPEND final_message "Datadir: ${datadir}") | ||
| 32 | |||
| 33 | set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/xbmc\" | ||
| 34 | -DINSTALL_PATH=\"${datarootdir}/xbmc\") | ||
diff --git a/project/cmake/scripts/rbpi/archsetup.cmake b/project/cmake/scripts/rbpi/archsetup.cmake new file mode 100644 index 0000000..84f1dad --- /dev/null +++ b/project/cmake/scripts/rbpi/archsetup.cmake | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | if(NOT CMAKE_TOOLCHAIN_FILE) | ||
| 2 | message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for rbpi. See ${PROJECT_SOURCE_DIR}/README.md") | ||
| 3 | endif() | ||
| 4 | |||
| 5 | set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_RASPBERRY_PI | ||
| 6 | -DHAS_OMXPLAYER -DHAVE_OMXLIB) | ||
| 7 | set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED | ||
| 8 | -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) | ||
| 9 | set(PLATFORM_DIR linux) | ||
| 10 | |||
| 11 | string(REGEX REPLACE "[ ]+" ";" SYSTEM_LDFLAGS $ENV{LDFLAGS}) | ||
| 12 | set(CMAKE_SYSTEM_NAME Linux) | ||
| 13 | |||
| 14 | if(WITH_ARCH) | ||
| 15 | set(ARCH ${WITH_ARCH}) | ||
| 16 | else() | ||
| 17 | if(CPU STREQUAL arm1176jzf-s) | ||
| 18 | set(ARCH arm-linux-gnueabihf) | ||
| 19 | elseif(CPU MATCHES "cortex-a7") | ||
| 20 | set(ARCH arm-linux-gnueabihf) | ||
| 21 | else() | ||
| 22 | message(SEND_ERROR "Unknown CPU: ${CPU}") | ||
| 23 | endif() | ||
| 24 | endif() | ||
| 25 | |||
| 26 | find_package(CXX11 REQUIRED) | ||
| 27 | |||
| 28 | set(LIRC_DEVICE "\"/dev/lircd\"" CACHE STRING "LIRC device to use") | ||
| 29 | set(DEP_DEFINES -DLIRC_DEVICE=${LIRC_DEVICE}) | ||
| 30 | set(MMAL_FOUND 1 CACHE INTERNAL "MMAL") | ||
| 31 | set(OMX_FOUND 1 CACHE INTERNAL "OMX") | ||
| 32 | set(OMXLIB_FOUND 1 CACHE INTERNAL "OMX") | ||
diff --git a/project/cmake/scripts/rbpi/install.cmake b/project/cmake/scripts/rbpi/install.cmake new file mode 120000 index 0000000..0409981 --- /dev/null +++ b/project/cmake/scripts/rbpi/install.cmake | |||
| @@ -0,0 +1 @@ | |||
| ../linux/install.cmake \ No newline at end of file | |||
diff --git a/project/cmake/scripts/rbpi/macros.cmake b/project/cmake/scripts/rbpi/macros.cmake new file mode 120000 index 0000000..28c77ca --- /dev/null +++ b/project/cmake/scripts/rbpi/macros.cmake | |||
| @@ -0,0 +1 @@ | |||
| ../linux/macros.cmake \ No newline at end of file | |||
diff --git a/project/cmake/scripts/rbpi/pathsetup.cmake b/project/cmake/scripts/rbpi/pathsetup.cmake new file mode 120000 index 0000000..26d7f17 --- /dev/null +++ b/project/cmake/scripts/rbpi/pathsetup.cmake | |||
| @@ -0,0 +1 @@ | |||
| ../linux/pathsetup.cmake \ No newline at end of file | |||
diff --git a/project/cmake/scripts/windows/archsetup.cmake b/project/cmake/scripts/windows/archsetup.cmake new file mode 100644 index 0000000..baa3624 --- /dev/null +++ b/project/cmake/scripts/windows/archsetup.cmake | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | # -------- Architecture settings --------- | ||
| 2 | |||
| 3 | set(ARCH win32) | ||
| 4 | |||
| 5 | |||
| 6 | # -------- Paths (mainly for find_package) --------- | ||
| 7 | |||
| 8 | set(PLATFORM_DIR win32) | ||
| 9 | |||
| 10 | # Precompiled headers fail with per target output directory. (needs CMake 3.1) | ||
| 11 | set(PRECOMPILEDHEADER_DIR ${PROJECT_BINARY_DIR}/${CORE_BUILD_CONFIG}/objs) | ||
| 12 | |||
| 13 | set(CMAKE_SYSTEM_NAME Windows) | ||
| 14 | list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32) | ||
| 15 | list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg) | ||
| 16 | list(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg/bin) | ||
| 17 | list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../BuildDependencies) | ||
| 18 | set(CONFIGURATION_LIBDIR lib/${CORE_BUILD_CONFIG}-vc120) | ||
| 19 | set(CONFIGURATION_LIBDIR_RELEASE lib/Release-vc120) | ||
| 20 | set(CONFIGURATION_LIBDIR_DEBUG lib/Debug-vc120) | ||
| 21 | |||
| 22 | set(JPEG_NAMES ${JPEG_NAMES} jpeg-static) | ||
| 23 | set(PYTHON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/../BuildDependencies/include/python) | ||
| 24 | |||
| 25 | |||
| 26 | # -------- Compiler options --------- | ||
| 27 | |||
| 28 | add_options(CXX ALL_BUILDS "/wd\"4996\"") | ||
| 29 | set(ARCH_DEFINES -D_WINDOWS -DTARGET_WINDOWS) | ||
| 30 | set(SYSTEM_DEFINES -DNOMINMAX -D_USE_32BIT_TIME_T -DHAS_DX -D__STDC_CONSTANT_MACROS | ||
| 31 | -DTAGLIB_STATIC -DNPT_CONFIG_ENABLE_LOGGING | ||
| 32 | -DPLT_HTTP_DEFAULT_USER_AGENT="UPnP/1.0 DLNADOC/1.50 Kodi" | ||
| 33 | -DPLT_HTTP_DEFAULT_SERVER="UPnP/1.0 DLNADOC/1.50 Kodi" | ||
| 34 | -DBUILDING_WITH_CMAKE | ||
| 35 | $<$<CONFIG:Debug>:-DD3D_DEBUG_INFO -D_SECURE_SCL=0 -D_HAS_ITERATOR_DEBUGGING=0>) | ||
| 36 | |||
| 37 | # Compile with /MT (to be compatible with the dependent libraries) | ||
| 38 | foreach(CompilerFlag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE | ||
| 39 | CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) | ||
| 40 | string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") | ||
| 41 | endforeach() | ||
| 42 | |||
| 43 | # Make sure /FS is set for Visual Studio in order to prevent simultanious access to pdb files. | ||
| 44 | if(CMAKE_GENERATOR MATCHES "Visual Studio") | ||
| 45 | set(CMAKE_CXX_FLAGS "/MP /FS ${CMAKE_CXX_FLAGS}") | ||
| 46 | endif() | ||
| 47 | |||
| 48 | |||
| 49 | # -------- Linker options --------- | ||
| 50 | |||
| 51 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") | ||
| 52 | |||
| 53 | # For #pragma comment(lib X) | ||
| 54 | # TODO: It would certainly be better to handle these libraries via CMake modules. | ||
| 55 | link_directories(${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg/bin | ||
| 56 | ${PROJECT_SOURCE_DIR}/../BuildDependencies/lib | ||
| 57 | ${PROJECT_SOURCE_DIR}/../BuildDependencies/${CONFIGURATION_LIBDIR}) | ||
| 58 | |||
| 59 | # Additional libraries | ||
| 60 | list(APPEND DEPLIBS d3d11.lib DInput8.lib DSound.lib winmm.lib Mpr.lib Iphlpapi.lib | ||
| 61 | PowrProf.lib setupapi.lib dwmapi.lib yajl.lib dxguid.lib DelayImp.lib) | ||
| 62 | |||
| 63 | # NODEFAULTLIB option | ||
| 64 | set(_nodefaultlibs_RELEASE libc msvcrt libci msvcprt) | ||
| 65 | set(_nodefaultlibs_DEBUG libcpmt libc msvcrt libcmt msvcrtd msvcprtd) | ||
| 66 | foreach(_lib ${_nodefaultlibs_RELEASE}) | ||
| 67 | set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:\"${_lib}\"") | ||
| 68 | endforeach() | ||
| 69 | foreach(_lib ${_nodefaultlibs_DEBUG}) | ||
| 70 | set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:\"${_lib}\"") | ||
| 71 | endforeach() | ||
| 72 | |||
| 73 | # DELAYLOAD option | ||
| 74 | set(_delayloadlibs libxslt.dll dnssd.dll dwmapi.dll ssh.dll sqlite3.dll | ||
| 75 | avcodec-56.dll avfilter-5.dll avformat-56.dll avutil-54.dll | ||
| 76 | postproc-53.dll swresample-1.dll swscale-3.dll d3dcompiler_47.dll) | ||
| 77 | foreach(_lib ${_delayloadlibs}) | ||
| 78 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:\"${_lib}\"") | ||
| 79 | endforeach() | ||
| 80 | |||
| 81 | # Make the Release version create a PDB | ||
| 82 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") | ||
| 83 | # Minimize the size or the resulting DLLs | ||
| 84 | set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF") | ||
| 85 | |||
| 86 | |||
| 87 | # -------- Visual Studio options --------- | ||
| 88 | |||
| 89 | if(CMAKE_GENERATOR MATCHES "Visual Studio") | ||
| 90 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
| 91 | endif() | ||
diff --git a/project/cmake/scripts/windows/install.cmake b/project/cmake/scripts/windows/install.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/project/cmake/scripts/windows/install.cmake | |||
diff --git a/project/cmake/scripts/windows/macros.cmake b/project/cmake/scripts/windows/macros.cmake new file mode 100644 index 0000000..6aabf7d --- /dev/null +++ b/project/cmake/scripts/windows/macros.cmake | |||
| @@ -0,0 +1,143 @@ | |||
| 1 | function(core_link_library lib wraplib) | ||
| 2 | # set(export -Wl,--unresolved-symbols=ignore-all | ||
| 3 | # `cat ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def` | ||
| 4 | # ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o) | ||
| 5 | # set(check_arg "") | ||
| 6 | # if(TARGET ${lib}) | ||
| 7 | # set(target ${lib}) | ||
| 8 | # set(link_lib ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${lib}/${lib}.a) | ||
| 9 | # set(check_arg ${ARGV2}) | ||
| 10 | # set(data_arg ${ARGV3}) | ||
| 11 | # else() | ||
| 12 | # set(target ${ARGV2}) | ||
| 13 | # set(link_lib ${lib}) | ||
| 14 | # set(check_arg ${ARGV3}) | ||
| 15 | # set(data_arg ${ARGV4}) | ||
| 16 | # endif() | ||
| 17 | # if(check_arg STREQUAL "export") | ||
| 18 | # set(export ${export} | ||
| 19 | # -Wl,--version-script=${ARGV3}) | ||
| 20 | # elseif(check_arg STREQUAL "nowrap") | ||
| 21 | # set(export ${data_arg}) | ||
| 22 | # elseif(check_arg STREQUAL "extras") | ||
| 23 | # foreach(arg ${data_arg}) | ||
| 24 | # list(APPEND export ${arg}) | ||
| 25 | # endforeach() | ||
| 26 | # endif() | ||
| 27 | # get_filename_component(dir ${wraplib} PATH) | ||
| 28 | # add_custom_command(OUTPUT ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} | ||
| 29 | # COMMAND cmake -E make_directory ${dir} | ||
| 30 | # COMMAND ${CMAKE_C_COMPILER} | ||
| 31 | # ARGS -Wl,--whole-archive | ||
| 32 | # ${link_lib} | ||
| 33 | # -Wl,--no-whole-archive -lm | ||
| 34 | # -shared -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} | ||
| 35 | # ${export} | ||
| 36 | # DEPENDS ${target} wrapper.def wrapper) | ||
| 37 | # list(APPEND WRAP_FILES ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}) | ||
| 38 | # set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE) | ||
| 39 | endfunction() | ||
| 40 | |||
| 41 | function(find_soname lib) | ||
| 42 | # Windows uses hardcoded dlls in xbmc/DllPaths_win32.h. | ||
| 43 | # Therefore the output of this function is unused. | ||
| 44 | endfunction() | ||
| 45 | |||
| 46 | # Add precompiled header to target | ||
| 47 | # Arguments: | ||
| 48 | # target existing target that will be set up to compile with a precompiled header | ||
| 49 | # pch_header the precompiled header file | ||
| 50 | # pch_source the precompiled header source file | ||
| 51 | # Optional Arguments: | ||
| 52 | # PCH_TARGET build precompiled header as separate target with the given name | ||
| 53 | # so that the same precompiled header can be used for multiple libraries | ||
| 54 | # EXCLUDE_SOURCES if not all target sources shall use the precompiled header, | ||
| 55 | # the relevant files can be listed here | ||
| 56 | # On return: | ||
| 57 | # Compiles the pch_source into a precompiled header and adds the header to | ||
| 58 | # the given target | ||
| 59 | function(add_precompiled_header target pch_header pch_source) | ||
| 60 | cmake_parse_arguments(PCH "" "PCH_TARGET" "EXCLUDE_SOURCES" ${ARGN}) | ||
| 61 | |||
| 62 | if(PCH_PCH_TARGET) | ||
| 63 | set(pch_binary ${PRECOMPILEDHEADER_DIR}/${PCH_PCH_TARGET}.pch) | ||
| 64 | else() | ||
| 65 | set(pch_binary ${PRECOMPILEDHEADER_DIR}/${target}.pch) | ||
| 66 | endif() | ||
| 67 | |||
| 68 | # Set compile options and dependency for sources | ||
| 69 | get_target_property(sources ${target} SOURCES) | ||
| 70 | list(REMOVE_ITEM sources ${pch_source}) | ||
| 71 | foreach(exclude_source IN LISTS PCH_EXCLUDE_SOURCES) | ||
| 72 | list(REMOVE_ITEM sources ${exclude_source}) | ||
| 73 | endforeach() | ||
| 74 | set_source_files_properties(${sources} | ||
| 75 | PROPERTIES COMPILE_FLAGS "/Yu\"${pch_header}\" /Fp\"${pch_binary}\" /FI\"${pch_header}\"" | ||
| 76 | OBJECT_DEPENDS "${pch_binary}") | ||
| 77 | |||
| 78 | # Set compile options for precompiled header | ||
| 79 | if(NOT PCH_PCH_TARGET OR NOT TARGET ${PCH_PCH_TARGET}_pch) | ||
| 80 | set_source_files_properties(${pch_source} | ||
| 81 | PROPERTIES COMPILE_FLAGS "/Yc\"${pch_header}\" /Fp\"${pch_binary}\"" | ||
| 82 | OBJECT_OUTPUTS "${pch_binary}") | ||
| 83 | endif() | ||
| 84 | |||
| 85 | # Compile precompiled header | ||
| 86 | if(PCH_PCH_TARGET) | ||
| 87 | # As own target for usage in multiple libraries | ||
| 88 | if(NOT TARGET ${PCH_PCH_TARGET}_pch) | ||
| 89 | add_library(${PCH_PCH_TARGET}_pch STATIC ${pch_source}) | ||
| 90 | set_target_properties(${PCH_PCH_TARGET}_pch PROPERTIES COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR}) | ||
| 91 | endif() | ||
| 92 | # From VS2012 onwards, precompiled headers have to be linked against (LNK2011). | ||
| 93 | target_link_libraries(${target} PUBLIC ${PCH_PCH_TARGET}_pch) | ||
| 94 | set_target_properties(${target} PROPERTIES COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR}) | ||
| 95 | else() | ||
| 96 | # As part of the target | ||
| 97 | target_sources(${target} PRIVATE ${pch_source}) | ||
| 98 | endif() | ||
| 99 | endfunction() | ||
| 100 | |||
| 101 | # Adds an FX-compiled shader to a target | ||
| 102 | # Creates a custom command that FX-compiles the given shader and adds the | ||
| 103 | # generated header file to the given target. | ||
| 104 | # Arguments: | ||
| 105 | # target Target to add the FX-compiled shader to | ||
| 106 | # hlsl HLSL shader input file | ||
| 107 | # profile HLSL profile that specifies the shader model | ||
| 108 | # entrypoint Shader entry point | ||
| 109 | # On return: | ||
| 110 | # FXC_FILE is set to the name of the generated header file. | ||
| 111 | function(add_shader_dx target hlsl profile entrypoint) | ||
| 112 | get_filename_component(file ${hlsl} NAME_WE) | ||
| 113 | add_custom_command(OUTPUT ${file}.h | ||
| 114 | COMMAND ${FXC} /Fh ${file}.h | ||
| 115 | /E ${entrypoint} | ||
| 116 | /T ${profile} | ||
| 117 | /Vn ${file} | ||
| 118 | /Qstrip_reflect | ||
| 119 | ${hlsl} | ||
| 120 | DEPENDS ${hlsl} | ||
| 121 | COMMENT "FX compile ${hlsl}" | ||
| 122 | VERBATIM) | ||
| 123 | target_sources(${target} PRIVATE ${file}.h) | ||
| 124 | target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) | ||
| 125 | endfunction() | ||
| 126 | |||
| 127 | # Copies the main dlls to the root of the buildtree | ||
| 128 | # On return: | ||
| 129 | # files added to ${install_data}, mirror in build tree | ||
| 130 | function(copy_main_dlls_to_buildtree) | ||
| 131 | set(dir ${PROJECT_SOURCE_DIR}/../Win32BuildSetup/dependencies) | ||
| 132 | file(GLOB_RECURSE files ${dir}/*) | ||
| 133 | foreach(file ${files}) | ||
| 134 | copy_file_to_buildtree(${file} ${dir}) | ||
| 135 | endforeach() | ||
| 136 | |||
| 137 | if(D3DCOMPILER_DLL) | ||
| 138 | get_filename_component(d3dcompiler_dir ${D3DCOMPILER_DLL} DIRECTORY) | ||
| 139 | copy_file_to_buildtree(${D3DCOMPILER_DLL} ${d3dcompiler_dir}) | ||
| 140 | endif() | ||
| 141 | |||
| 142 | set(install_data ${install_data} PARENT_SCOPE) | ||
| 143 | endfunction() | ||
diff --git a/project/cmake/scripts/windows/pathsetup.cmake b/project/cmake/scripts/windows/pathsetup.cmake new file mode 100644 index 0000000..940fb62 --- /dev/null +++ b/project/cmake/scripts/windows/pathsetup.cmake | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | if(NOT prefix) | ||
| 2 | set(prefix ${CMAKE_INSTALL_PREFIX}) | ||
| 3 | else() | ||
| 4 | set(CMAKE_INSTALL_PREFIX ${prefix}) | ||
| 5 | endif() | ||
| 6 | if(NOT exec_prefix) | ||
| 7 | set(exec_prefix \${prefix}) | ||
| 8 | endif() | ||
| 9 | if(NOT libdir) | ||
| 10 | set(libdir ${prefix}/lib) | ||
| 11 | endif() | ||
| 12 | if(NOT bindir) | ||
| 13 | set(bindir ${prefix}/bin) | ||
| 14 | endif() | ||
| 15 | if(NOT includedir) | ||
| 16 | set(includedir ${prefix}/include) | ||
| 17 | endif() | ||
| 18 | if(NOT datarootdir) | ||
| 19 | set(datarootdir ${prefix}/share) | ||
| 20 | endif() | ||
| 21 | if(NOT datadir) | ||
| 22 | set(datadir \${datarootdir}) | ||
| 23 | endif() | ||
| 24 | |||
| 25 | list(APPEND final_message "-- PATH config --") | ||
| 26 | list(APPEND final_message "Prefix: ${prefix}") | ||
| 27 | list(APPEND final_message "Libdir: ${libdir}") | ||
| 28 | list(APPEND final_message "Bindir: ${bindir}") | ||
| 29 | list(APPEND final_message "Includedir: ${includedir}") | ||
| 30 | list(APPEND final_message "Datarootdir: ${datarootdir}") | ||
| 31 | list(APPEND final_message "Datadir: ${datadir}") | ||
| 32 | |||
| 33 | set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/xbmc\" | ||
| 34 | -DINSTALL_PATH=\"${datarootdir}/xbmc\") | ||
diff --git a/project/cmake/treedata/android/subdirs.txt b/project/cmake/treedata/android/subdirs.txt new file mode 100644 index 0000000..1c75fa6 --- /dev/null +++ b/project/cmake/treedata/android/subdirs.txt | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | xbmc/linux linuxsupport | ||
| 2 | xbmc/input/touch input/touch | ||
| 3 | xbmc/input/touch/generic input/touch/generic | ||
| 4 | xbmc/network/linux network/linux | ||
| 5 | xbmc/peripherals/bus/linux peripherals/bus/linux | ||
| 6 | xbmc/powermanagement/android powermanagement/android | ||
| 7 | xbmc/storage/android storage/android | ||
| 8 | xbmc/filesystem/posix filesystem/posix | ||
| 9 | xbmc/utils/posix utils_posix | ||
| 10 | xbmc/windowing/android windowing/android | ||
| 11 | xbmc/windowing/egl windowing/egl | ||
| 12 | xbmc/platform/posix posix | ||
| 13 | xbmc/platform/android/activity android_activity | ||
| 14 | xbmc/platform/android/bionic_supplement android_bionicsupplement | ||
| 15 | xbmc/platform/android/jni android_jni | ||
| 16 | xbmc/platform/android/loader android_loader | ||
diff --git a/project/cmake/treedata/common/addons.txt b/project/cmake/treedata/common/addons.txt new file mode 100644 index 0000000..29b7990 --- /dev/null +++ b/project/cmake/treedata/common/addons.txt | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | lib/addons/library.kodi.adsp KODI_adsp | ||
| 2 | lib/addons/library.kodi.audioengine KODI_audioengine | ||
| 3 | lib/addons/library.kodi.guilib KODI_guilib | ||
| 4 | lib/addons/library.kodi.inputstream KODI_inputstream | ||
| 5 | lib/addons/library.xbmc.addon XBMC_addon | ||
| 6 | lib/addons/library.xbmc.codec XBMC_codec | ||
| 7 | lib/addons/library.xbmc.pvr XBMC_pvr | ||
diff --git a/project/cmake/treedata/common/cores.txt b/project/cmake/treedata/common/cores.txt new file mode 100644 index 0000000..d23939d --- /dev/null +++ b/project/cmake/treedata/common/cores.txt | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | xbmc/cores cores | ||
| 2 | xbmc/cores/AudioEngine cores/audioengine | ||
| 3 | xbmc/cores/DllLoader cores/dll-loader | ||
| 4 | xbmc/cores/DllLoader/exports cores/dll-loader/exports | ||
| 5 | xbmc/cores/DllLoader/exports/util cores/dll-loader/exports/util | ||
| 6 | xbmc/cores/ExternalPlayer cores/externalplayer | ||
| 7 | xbmc/cores/paplayer cores/paplayer | ||
| 8 | xbmc/cores/playercorefactory cores/playercorefactory | ||
diff --git a/project/cmake/treedata/common/events.txt b/project/cmake/treedata/common/events.txt new file mode 100644 index 0000000..0adeb08 --- /dev/null +++ b/project/cmake/treedata/common/events.txt | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | xbmc/events events | ||
| 2 | xbmc/events/windows events/windows | ||
diff --git a/project/cmake/treedata/common/externals.txt b/project/cmake/treedata/common/externals.txt new file mode 100644 index 0000000..632b354 --- /dev/null +++ b/project/cmake/treedata/common/externals.txt | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | xbmc/contrib/kissfft kissfft | ||
| 2 | lib/libUPnP upnp | ||
| 3 | lib/libexif exif | ||
diff --git a/project/cmake/treedata/common/filesystem.txt b/project/cmake/treedata/common/filesystem.txt new file mode 100644 index 0000000..1c49a74 --- /dev/null +++ b/project/cmake/treedata/common/filesystem.txt | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | xbmc/filesystem filesystem | ||
| 2 | xbmc/filesystem/VideoDatabaseDirectory filesystem/videodatabase | ||
| 3 | xbmc/filesystem/MusicDatabaseDirectory filesystem/musicdatabase | ||
diff --git a/project/cmake/treedata/common/interfaces.txt b/project/cmake/treedata/common/interfaces.txt new file mode 100644 index 0000000..ffd3570 --- /dev/null +++ b/project/cmake/treedata/common/interfaces.txt | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | xbmc/interfaces interfaces | ||
| 2 | xbmc/interfaces/builtins interfaces/builtins | ||
| 3 | xbmc/interfaces/generic interfaces/generic | ||
| 4 | xbmc/interfaces/info interfaces/info | ||
| 5 | xbmc/interfaces/json-rpc interfaces/json-rpc | ||
| 6 | xbmc/interfaces/json-rpc/schema interfaces/json-rpc/schema | ||
| 7 | xbmc/interfaces/legacy interfaces/legacy | ||
| 8 | xbmc/interfaces/legacy/wsgi interfaces/legacy/wsgi | ||
| 9 | xbmc/interfaces/python interfaces/python | ||
diff --git a/project/cmake/treedata/common/music.txt b/project/cmake/treedata/common/music.txt new file mode 100644 index 0000000..71f30e1 --- /dev/null +++ b/project/cmake/treedata/common/music.txt | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | xbmc/music music | ||
| 2 | xbmc/music/dialogs music/dialogs | ||
| 3 | xbmc/music/infoscanner music/infoscanner | ||
| 4 | xbmc/music/tags music/tags | ||
| 5 | xbmc/music/windows music/windows | ||
diff --git a/project/cmake/treedata/common/network.txt b/project/cmake/treedata/common/network.txt new file mode 100644 index 0000000..c0ec4a3 --- /dev/null +++ b/project/cmake/treedata/common/network.txt | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | xbmc/network network | ||
| 2 | xbmc/network/dacp network/dacp | ||
| 3 | xbmc/network/httprequesthandler network/httprequesthandler | ||
| 4 | xbmc/network/httprequesthandler/python network/httprequesthandler/python | ||
| 5 | xbmc/network/upnp network/upnp | ||
| 6 | xbmc/network/websocket network/websocket | ||
diff --git a/project/cmake/treedata/common/peripherals.txt b/project/cmake/treedata/common/peripherals.txt new file mode 100644 index 0000000..e6d9283 --- /dev/null +++ b/project/cmake/treedata/common/peripherals.txt | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | xbmc/peripherals peripherals | ||
| 2 | xbmc/peripherals/bus peripherals/bus | ||
| 3 | xbmc/peripherals/devices peripherals/devices | ||
| 4 | xbmc/peripherals/dialogs peripherals/dialogs | ||
diff --git a/project/cmake/treedata/common/profiles.txt b/project/cmake/treedata/common/profiles.txt new file mode 100644 index 0000000..fae570b --- /dev/null +++ b/project/cmake/treedata/common/profiles.txt | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | xbmc/profiles profiles | ||
| 2 | xbmc/profiles/dialogs profiles/dialogs | ||
| 3 | xbmc/profiles/windows profiles/windows | ||
diff --git a/project/cmake/treedata/common/pvr.txt b/project/cmake/treedata/common/pvr.txt new file mode 100644 index 0000000..6797677 --- /dev/null +++ b/project/cmake/treedata/common/pvr.txt | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | xbmc/pvr pvr | ||
| 2 | xbmc/pvr/addons pvr/addons | ||
| 3 | xbmc/pvr/channels pvr/channels | ||
| 4 | xbmc/pvr/dialogs pvr/dialogs | ||
| 5 | xbmc/pvr/recordings pvr/recordings | ||
| 6 | xbmc/pvr/timers pvr/timers | ||
| 7 | xbmc/pvr/windows pvr/windows | ||
diff --git a/project/cmake/treedata/common/settings.txt b/project/cmake/treedata/common/settings.txt new file mode 100644 index 0000000..c5aa2ae --- /dev/null +++ b/project/cmake/treedata/common/settings.txt | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | xbmc/settings settings | ||
| 2 | xbmc/settings/dialogs settings/dialogs | ||
| 3 | xbmc/settings/lib settings/lib | ||
| 4 | xbmc/settings/windows settings/windows | ||
diff --git a/project/cmake/treedata/common/subdirs.txt b/project/cmake/treedata/common/subdirs.txt new file mode 100644 index 0000000..762547e --- /dev/null +++ b/project/cmake/treedata/common/subdirs.txt | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | xbmc xbmc | ||
| 2 | xbmc/addons addons | ||
| 3 | xbmc/commons commons | ||
| 4 | xbmc/cdrip cdrip | ||
| 5 | xbmc/dbwrappers dbwrappers | ||
| 6 | xbmc/dialogs dialogs | ||
| 7 | xbmc/epg epg | ||
| 8 | xbmc/guilib guilib | ||
| 9 | xbmc/input input | ||
| 10 | xbmc/listproviders listproviders | ||
| 11 | xbmc/media media | ||
| 12 | xbmc/messaging messaging | ||
| 13 | xbmc/messaging/helpers messagingHelpers | ||
| 14 | xbmc/pictures pictures | ||
| 15 | xbmc/platform platform | ||
| 16 | xbmc/playlists playlists | ||
| 17 | xbmc/powermanagement powermanagement | ||
| 18 | xbmc/programs programs | ||
| 19 | xbmc/rendering rendering | ||
| 20 | xbmc/storage storage | ||
| 21 | xbmc/threads threads | ||
| 22 | xbmc/utils utils | ||
| 23 | xbmc/view view | ||
| 24 | xbmc/windowing windowing | ||
| 25 | xbmc/windows windows | ||
diff --git a/project/cmake/treedata/common/tests.txt b/project/cmake/treedata/common/tests.txt new file mode 100644 index 0000000..358bc4d --- /dev/null +++ b/project/cmake/treedata/common/tests.txt | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | xbmc/test test | ||
| 2 | xbmc/addons/test test/addons | ||
| 3 | xbmc/filesystem/test test/filesystem | ||
| 4 | xbmc/interfaces/python/test test/python | ||
| 5 | xbmc/music/tags/test test/music_tags | ||
| 6 | xbmc/network/test test/network | ||
| 7 | xbmc/threads/test test/threads | ||
| 8 | xbmc/utils/test test/utils | ||
| 9 | xbmc/video/test test/video | ||
| 10 | xbmc/cores/AudioEngine/Sinks/test test/audioengine_sinks | ||
diff --git a/project/cmake/treedata/common/video.txt b/project/cmake/treedata/common/video.txt new file mode 100644 index 0000000..e7855a0 --- /dev/null +++ b/project/cmake/treedata/common/video.txt | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | xbmc/video video | ||
| 2 | xbmc/video/dialogs video/dialogs | ||
| 3 | xbmc/video/jobs video/jobs | ||
| 4 | xbmc/video/videosync video/sync | ||
| 5 | xbmc/video/windows video/windows | ||
diff --git a/project/cmake/treedata/common/videoplayer.txt b/project/cmake/treedata/common/videoplayer.txt new file mode 100644 index 0000000..8c8d45d --- /dev/null +++ b/project/cmake/treedata/common/videoplayer.txt | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | xbmc/cores/VideoPlayer cores/VideoPlayer | ||
| 2 | xbmc/cores/VideoPlayer/DVDCodecs cores/VideoPlayer/codecs | ||
| 3 | xbmc/cores/VideoPlayer/DVDCodecs/Audio cores/VideoPlayer/codecs/audio | ||
| 4 | xbmc/cores/VideoPlayer/DVDCodecs/Overlay cores/VideoPlayer/codecs/overlay | ||
| 5 | xbmc/cores/VideoPlayer/DVDCodecs/Video cores/VideoPlayer/codecs/video | ||
| 6 | xbmc/cores/VideoPlayer/DVDDemuxers cores/VideoPlayer/demuxers | ||
| 7 | xbmc/cores/VideoPlayer/DVDInputStreams cores/VideoPlayer/inputstreams | ||
| 8 | xbmc/cores/VideoPlayer/DVDSubtitles cores/VideoPlayer/subtitles | ||
| 9 | xbmc/cores/VideoPlayer/Process cores/VideoPlayer/process | ||
| 10 | xbmc/cores/VideoPlayer/VideoRenderers cores/VideoPlayer/videorenderers | ||
| 11 | xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders cores/VideoPlayer/videorenderers/shaders | ||
| 12 | xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender cores/VideoPlayer/videorenderers/hwdec | ||
diff --git a/project/cmake/treedata/darwin/subdirs.txt b/project/cmake/treedata/darwin/subdirs.txt new file mode 100644 index 0000000..f0fc5c5 --- /dev/null +++ b/project/cmake/treedata/darwin/subdirs.txt | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | xbmc/linux linuxsupport | ||
| 2 | xbmc/network/linux network/linux | ||
| 3 | xbmc/network/osx network/osx | ||
| 4 | xbmc/peripherals/bus/osx peripherals/bus/osx | ||
| 5 | xbmc/powermanagement/osx powermanagement/osx | ||
| 6 | xbmc/storage/osx storage/osx | ||
| 7 | xbmc/platform/posix posix | ||
| 8 | xbmc/platform/darwin platform_darwin | ||
| 9 | xbmc/platform/darwin/osx platform_osx | ||
| 10 | xbmc/filesystem/posix filesystem/posix | ||
| 11 | xbmc/utils/posix utils_posix | ||
| 12 | xbmc/windowing/osx windowing/osx | ||
diff --git a/project/cmake/treedata/freebsd/subdirs.txt b/project/cmake/treedata/freebsd/subdirs.txt new file mode 100644 index 0000000..faff03c --- /dev/null +++ b/project/cmake/treedata/freebsd/subdirs.txt | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | xbmc/linux linuxsupport | ||
| 2 | xbmc/input/linux input/linux | ||
| 3 | xbmc/network/linux network/linux | ||
| 4 | xbmc/freebsd freebsdsupport | ||
diff --git a/project/cmake/treedata/ios/subdirs.txt b/project/cmake/treedata/ios/subdirs.txt new file mode 100644 index 0000000..b681ed5 --- /dev/null +++ b/project/cmake/treedata/ios/subdirs.txt | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | xbmc/linux linuxsupport | ||
| 2 | xbmc/input/touch input/touch | ||
| 3 | xbmc/input/touch/generic input/touch/generic | ||
| 4 | xbmc/network/linux network/linux | ||
| 5 | xbmc/network/osx network/osx | ||
| 6 | xbmc/peripherals/bus/osx peripherals/bus/osx | ||
| 7 | xbmc/powermanagement/osx powermanagement/osx | ||
| 8 | xbmc/storage/osx storage/osx | ||
| 9 | xbmc/platform/posix posix | ||
| 10 | xbmc/platform/darwin platform_darwin | ||
| 11 | xbmc/platform/darwin/ios platform_ios | ||
| 12 | xbmc/platform/darwin/ios-common platform_ios-common | ||
| 13 | xbmc/filesystem/posix filesystem/posix | ||
| 14 | xbmc/utils/posix utils_posix | ||
| 15 | xbmc/windowing/osx windowing/osx | ||
diff --git a/project/cmake/treedata/linux/subdirs.txt b/project/cmake/treedata/linux/subdirs.txt new file mode 100644 index 0000000..81a48e3 --- /dev/null +++ b/project/cmake/treedata/linux/subdirs.txt | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | xbmc/linux linuxsupport | ||
| 2 | xbmc/linux/sse4 sse4 | ||
| 3 | xbmc/input/linux input/linux | ||
| 4 | xbmc/input/touch input/touch | ||
| 5 | xbmc/input/touch/generic input/touch/generic | ||
| 6 | xbmc/network/linux network/linux | ||
| 7 | xbmc/peripherals/bus/linux peripherals/bus/linux | ||
| 8 | xbmc/powermanagement/linux powermanagement/linux | ||
| 9 | xbmc/storage/linux storage/linux | ||
| 10 | xbmc/filesystem/posix filesystem/posix | ||
| 11 | xbmc/utils/posix utils_posix | ||
| 12 | xbmc/platform/posix posix | ||
diff --git a/project/cmake/treedata/optional/common/X11.txt b/project/cmake/treedata/optional/common/X11.txt new file mode 100644 index 0000000..f4afa57 --- /dev/null +++ b/project/cmake/treedata/optional/common/X11.txt | |||
| @@ -0,0 +1 @@ | |||
| xbmc/windowing/X11 windowing/X11 # X11 | |||
diff --git a/project/cmake/treedata/optional/common/cec.txt b/project/cmake/treedata/optional/common/cec.txt new file mode 100644 index 0000000..19cd7f7 --- /dev/null +++ b/project/cmake/treedata/optional/common/cec.txt | |||
| @@ -0,0 +1 @@ | |||
| xbmc/peripherals/bus/virtual peripherals/bus/virtual # CEC | |||
diff --git a/project/cmake/treedata/optional/common/nonfree.txt b/project/cmake/treedata/optional/common/nonfree.txt new file mode 100644 index 0000000..470ed59 --- /dev/null +++ b/project/cmake/treedata/optional/common/nonfree.txt | |||
| @@ -0,0 +1 @@ | |||
| lib/UnrarXLib unrarxlib # NONFREE | |||
diff --git a/project/cmake/treedata/optional/common/opengl.txt b/project/cmake/treedata/optional/common/opengl.txt new file mode 100644 index 0000000..b88ad7a --- /dev/null +++ b/project/cmake/treedata/optional/common/opengl.txt | |||
| @@ -0,0 +1 @@ | |||
| xbmc/rendering/gl rendering/gl # OPENGL | |||
diff --git a/project/cmake/treedata/optional/common/opengles.txt b/project/cmake/treedata/optional/common/opengles.txt new file mode 100644 index 0000000..6a223a1 --- /dev/null +++ b/project/cmake/treedata/optional/common/opengles.txt | |||
| @@ -0,0 +1 @@ | |||
| xbmc/rendering/gles rendering/gles # OPENGLES | |||
diff --git a/project/cmake/treedata/rbpi/omxplayer.txt b/project/cmake/treedata/rbpi/omxplayer.txt new file mode 100644 index 0000000..d56f1df --- /dev/null +++ b/project/cmake/treedata/rbpi/omxplayer.txt | |||
| @@ -0,0 +1 @@ | |||
| xbmc/cores/omxplayer cores/omxplayer | |||
diff --git a/project/cmake/treedata/rbpi/subdirs.txt b/project/cmake/treedata/rbpi/subdirs.txt new file mode 100644 index 0000000..866ec00 --- /dev/null +++ b/project/cmake/treedata/rbpi/subdirs.txt | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | xbmc/linux linuxsupport | ||
| 2 | xbmc/input/linux input/linux | ||
| 3 | xbmc/input/touch input/touch | ||
| 4 | xbmc/input/touch/generic input/touch/generic | ||
| 5 | xbmc/network/linux network/linux | ||
| 6 | xbmc/peripherals/bus/linux peripherals/bus/linux | ||
| 7 | xbmc/powermanagement/linux powermanagement/linux | ||
| 8 | xbmc/storage/linux storage/linux | ||
| 9 | xbmc/filesystem/posix filesystem/posix | ||
| 10 | xbmc/utils/posix utils_posix | ||
| 11 | xbmc/platform/posix posix | ||
| 12 | xbmc/windowing/egl windowing/egl # EGL | ||
diff --git a/project/cmake/treedata/windows/subdirs.txt b/project/cmake/treedata/windows/subdirs.txt new file mode 100644 index 0000000..60c0095 --- /dev/null +++ b/project/cmake/treedata/windows/subdirs.txt | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | xbmc/win32 win32support | ||
| 2 | xbmc/input/windows input/windows | ||
| 3 | xbmc/input/touch input/touch | ||
| 4 | xbmc/input/touch/generic input/touch/generic | ||
| 5 | xbmc/network/windows network/windows | ||
| 6 | xbmc/network/mdns network/mdns | ||
| 7 | xbmc/peripherals/bus/win32 peripherals/bus/win32 | ||
| 8 | xbmc/powermanagement/windows powermanagement/windows | ||
| 9 | xbmc/storage/windows storage/windows | ||
| 10 | xbmc/filesystem/win32 filesystem/win32 | ||
| 11 | xbmc/utils/win32 utils_win32 | ||
| 12 | xbmc/platform/win32 platform_win32 | ||
| 13 | xbmc/rendering/dx rendering_dx | ||
| 14 | xbmc/threads/platform/win threads_win | ||
| 15 | xbmc/windowing/windows windowing/windows | ||
diff --git a/scripts/sync_buildenv.sh b/scripts/sync_buildenv.sh index f5f3a42..4224e6b 100755 --- a/scripts/sync_buildenv.sh +++ b/scripts/sync_buildenv.sh | |||
| @@ -25,6 +25,6 @@ do | |||
| 25 | git add $d | 25 | git add $d |
| 26 | done | 26 | done |
| 27 | 27 | ||
| 28 | branch=$(git rev-parse --abbrev-ref HEAD) | 28 | #branch=$(git rev-parse --abbrev-ref HEAD) |
| 29 | echo -n "pvr.dvbviewer https://github.com/manuelm/pvr.dvbviewer $branch" > project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt | 29 | #echo -n "pvr.dvbviewer https://github.com/manuelm/pvr.dvbviewer $branch" > project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt |
| 30 | git add project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt | 30 | #git add project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt |
diff --git a/version.txt b/version.txt index 09644f6..e817103 100644 --- a/version.txt +++ b/version.txt | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | APP_NAME Kodi | 1 | APP_NAME Kodi |
| 2 | COMPANY_NAME XBMC-Foundation | 2 | COMPANY_NAME XBMC-Foundation |
| 3 | WEBSITE http://kodi.tv | 3 | WEBSITE http://kodi.tv |
| 4 | VERSION_MAJOR 15 | 4 | VERSION_MAJOR 17 |
| 5 | VERSION_MINOR 0 | 5 | VERSION_MINOR 0 |
| 6 | VERSION_TAG BETA1 | 6 | VERSION_TAG ALPHA1 |
| 7 | VERSION_CODE 149801 | 7 | VERSION_CODE 169701 |
| 8 | ADDON_API 14.9.801 | 8 | ADDON_API 16.9.701 |
| 9 | 9 | ||
| 10 | # Notes: | 10 | # Notes: |
| 11 | # Change AC_INIT in configure.in | 11 | # Change AC_INIT in configure.ac |
diff --git a/xbmc/addons/addon-bindings.mk b/xbmc/addons/addon-bindings.mk index e7185a7..49978b7 100644 --- a/xbmc/addons/addon-bindings.mk +++ b/xbmc/addons/addon-bindings.mk | |||
| @@ -1,22 +1,31 @@ | |||
| 1 | BINDINGS =xbmc/addons/include/xbmc_addon_cpp_dll.h | 1 | BINDINGS =xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h |
| 2 | BINDINGS+=xbmc/addons/include/xbmc_addon_dll.h | 2 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h |
| 3 | BINDINGS+=xbmc/addons/include/xbmc_addon_types.h | 3 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h |
| 4 | BINDINGS+=xbmc/addons/include/xbmc_audioenc_dll.h | 4 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h |
| 5 | BINDINGS+=xbmc/addons/include/xbmc_audioenc_types.h | 5 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h |
| 6 | BINDINGS+=xbmc/addons/include/kodi_audiodec_dll.h | 6 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h |
| 7 | BINDINGS+=xbmc/addons/include/kodi_audiodec_types.h | 7 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h |
| 8 | BINDINGS+=xbmc/addons/include/xbmc_codec_types.h | 8 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h |
| 9 | BINDINGS+=xbmc/addons/include/xbmc_epg_types.h | 9 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h |
| 10 | BINDINGS+=xbmc/addons/include/xbmc_pvr_dll.h | 10 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h |
| 11 | BINDINGS+=xbmc/addons/include/xbmc_pvr_types.h | 11 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h |
| 12 | BINDINGS+=xbmc/addons/include/xbmc_scr_dll.h | 12 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h |
| 13 | BINDINGS+=xbmc/addons/include/xbmc_scr_types.h | 13 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h |
| 14 | BINDINGS+=xbmc/addons/include/xbmc_vis_dll.h | 14 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h |
| 15 | BINDINGS+=xbmc/addons/include/xbmc_vis_types.h | 15 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h |
| 16 | BINDINGS+=xbmc/addons/include/xbmc_stream_utils.hpp | 16 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h |
| 17 | BINDINGS+=addons/library.xbmc.addon/libXBMC_addon.h | 17 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h |
| 18 | BINDINGS+=addons/library.kodi.guilib/libKODI_guilib.h | 18 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h |
| 19 | BINDINGS+=addons/library.xbmc.pvr/libXBMC_pvr.h | 19 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h |
| 20 | BINDINGS+=addons/library.xbmc.codec/libXBMC_codec.h | 20 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h |
| 21 | BINDINGS+=xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPacket.h | 21 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp |
| 22 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h | ||
| 23 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h | ||
| 24 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h | ||
| 25 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h | ||
| 26 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h | ||
| 27 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h | ||
| 28 | BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h | ||
| 29 | BINDINGS+=xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h | ||
| 22 | BINDINGS+=xbmc/cores/AudioEngine/Utils/AEChannelData.h | 30 | BINDINGS+=xbmc/cores/AudioEngine/Utils/AEChannelData.h |
| 31 | BINDINGS+=xbmc/filesystem/IFileTypes.h | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h new file mode 100644 index 0000000..c1d8238 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h | |||
| @@ -0,0 +1,564 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | /*! | ||
| 24 | * @file kodi_adsp_dll.h | ||
| 25 | * @section sec1 Basic audio dsp addon interface description | ||
| 26 | * @author Team Kodi | ||
| 27 | * @date 10. May 2014 | ||
| 28 | * @version 0.1.5 | ||
| 29 | * | ||
| 30 | * @subsection sec1_1 General | ||
| 31 | * @li The basic support on the addon is supplied with the | ||
| 32 | * AE_DSP_ADDON_CAPABILITIES data which becomes asked over | ||
| 33 | * GetAddonCapabilities(...), further the addon must register his available | ||
| 34 | * modes on startup with the RegisterMode(...) callback function (see | ||
| 35 | * libKODI_adsp.h). If one of this two points is not set the addon becomes | ||
| 36 | * ignored for the chain step. | ||
| 37 | * | ||
| 38 | * @subsection sec1_2 Processing | ||
| 39 | * @li On start of new stream the addon becomes called with StreamCreate(...) | ||
| 40 | * to check about given values that it support it basically and can create | ||
| 41 | * his structure, if nothing is supported it can return AE_DSP_ERROR_IGNORE_ME. | ||
| 42 | * | ||
| 43 | * @li As next step StreamIsModeSupported(...) becomes called for every | ||
| 44 | * available and enabled modes, is separated due to more as one available mode | ||
| 45 | * on the addon is possible, if the mode is not supported it can also be return | ||
| 46 | * AE_DSP_ERROR_IGNORE_ME. | ||
| 47 | * - If mode is a resample mode and returns no error it becomes asked with | ||
| 48 | * InputResampleSampleRate(...) or OutputResampleSampleRate(...) (relevant | ||
| 49 | * to his type) about his given sample rate. | ||
| 50 | * - About the from user selected master processing mode the related addon | ||
| 51 | * becomes called now with MasterProcessSetMode(...) to handle it's | ||
| 52 | * selectionon the addon given by the own addon type identifier or by | ||
| 53 | * KODI's useddatabase id, also the currently used stream type (e.g. | ||
| 54 | * Music or Video) is send. | ||
| 55 | * - If the addon supports only one master mode it can ignore this function | ||
| 56 | * and return always AE_DSP_ERROR_NO_ERROR. | ||
| 57 | * - If the master mode is set the addon becomes asked about the from him | ||
| 58 | * given output channel layout related to up- or downmix modes, if | ||
| 59 | * nothing becomes changed on the layout it can return -1. | ||
| 60 | * - The MasterProcessSetMode(...) is also called if from user a another | ||
| 61 | * mode becomes selected. | ||
| 62 | * | ||
| 63 | * @li Then as last step shortly before the first process call becomes executed | ||
| 64 | * the addon is called one time with StreamInitialize(...) to inform that | ||
| 65 | * processing is started on the given settings. | ||
| 66 | * - This function becomes also called on all add-ons if the master process | ||
| 67 | * becomes changed. | ||
| 68 | * - Also every process after StreamInitialize on the addon mode becomes asked | ||
| 69 | * with _..._ProcessNeededSamplesize(...) about required memory size for the | ||
| 70 | * output of his data, if no other size is required it can return 0. | ||
| 71 | * | ||
| 72 | * @li From now the processing becomes handled for the different steps with | ||
| 73 | * _..._Process(...). | ||
| 74 | * - Further it becomes asked with _..._GetDelay(...) about his processing | ||
| 75 | * time as float value in seconds, needed for video and audio alignment. | ||
| 76 | * | ||
| 77 | * @li On the end of the processing if the source becomes stopped the | ||
| 78 | * StreamDestroy(...) function becomes called on all active processing add-ons. | ||
| 79 | * | ||
| 80 | * @note | ||
| 81 | * The StreamCreate(...) can be becomes called for a new stream before the | ||
| 82 | * previous was closed with StreamDestroy(...) ! To have a speed improve. | ||
| 83 | */ | ||
| 84 | |||
| 85 | #include "xbmc_addon_dll.h" | ||
| 86 | #include "kodi_adsp_types.h" | ||
| 87 | |||
| 88 | /*! | ||
| 89 | * Functions that the Audio DSP add-on must implement, but some can be empty. | ||
| 90 | * | ||
| 91 | * The 'remarks' field indicates which methods should be implemented, and which | ||
| 92 | * ones are optional. | ||
| 93 | */ | ||
| 94 | |||
| 95 | extern "C" | ||
| 96 | { | ||
| 97 | /*! @name Audio DSP add-on methods */ | ||
| 98 | //@{ | ||
| 99 | /*! | ||
| 100 | * Get the KODI_AE_DSP_API_VERSION that was used to compile this add-on. | ||
| 101 | * Used to check if this add-on is compatible with KODI. | ||
| 102 | * @return The KODI_AE_DSP_API_VERSION that was used to compile this add-on. | ||
| 103 | * @remarks Valid implementation required. | ||
| 104 | */ | ||
| 105 | const char* GetAudioDSPAPIVersion(void); | ||
| 106 | |||
| 107 | /*! | ||
| 108 | * Get the KODI_AE_DSP_MIN_API_VERSION that was used to compile this add-on. | ||
| 109 | * Used to check if this add-on is compatible with KODI. | ||
| 110 | * @return The KODI_AE_DSP_MIN_API_VERSION that was used to compile this add-on. | ||
| 111 | * @remarks Valid implementation required. | ||
| 112 | */ | ||
| 113 | const char* GetMinimumAudioDSPAPIVersion(void); | ||
| 114 | |||
| 115 | /*! | ||
| 116 | * @brief Get the KODI_GUI_API_VERSION that was used to compile this add-on. | ||
| 117 | * Used to check if this add-on is compatible with KODI. | ||
| 118 | * @return The KODI_GUI_API_VERSION that was used to compile this add-on. | ||
| 119 | * @remarks Valid implementation required. | ||
| 120 | */ | ||
| 121 | const char* GetGUIAPIVersion(void); | ||
| 122 | |||
| 123 | /*! | ||
| 124 | * @brief Get the KODI_GUI_MIN_API_VERSION that was used to compile this | ||
| 125 | * add-on. | ||
| 126 | * Used to check if this add-on is compatible with KODI. | ||
| 127 | * @return The KODI_GUI_MIN_API_VERSION that was used to compile this add-on. | ||
| 128 | * @remarks Valid implementation required. | ||
| 129 | */ | ||
| 130 | const char* GetMinimumGUIAPIVersion(void); | ||
| 131 | |||
| 132 | /*! | ||
| 133 | * @brief Get the list of features that this add-on provides. | ||
| 134 | * Called by KODI to query the add-ons capabilities. | ||
| 135 | * Used to check which options should be presented in the DSP, which methods | ||
| 136 | * to call, etc. | ||
| 137 | * All capabilities that the add-on supports should be set to true. | ||
| 138 | * @param pCapabilities The add-ons capabilities. | ||
| 139 | * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully. | ||
| 140 | * @remarks Valid implementation required. | ||
| 141 | */ | ||
| 142 | AE_DSP_ERROR GetAddonCapabilities(AE_DSP_ADDON_CAPABILITIES *pCapabilities); | ||
| 143 | |||
| 144 | /*! | ||
| 145 | * @return The name reported by the back end that will be displayed in the | ||
| 146 | * UI. | ||
| 147 | * @remarks Valid implementation required. | ||
| 148 | */ | ||
| 149 | const char* GetDSPName(void); | ||
| 150 | |||
| 151 | /*! | ||
| 152 | * @return The version string reported by the back end that will be displayed | ||
| 153 | * in the UI. | ||
| 154 | * @remarks Valid implementation required. | ||
| 155 | */ | ||
| 156 | const char* GetDSPVersion(void); | ||
| 157 | |||
| 158 | /*! | ||
| 159 | * @brief Call one of the menu hooks (if supported). | ||
| 160 | * Supported AE_DSP_MENUHOOK instances have to be added in ADDON_Create(), | ||
| 161 | * by calling AddMenuHook() on the callback. | ||
| 162 | * @param menuhook The hook to call. | ||
| 163 | * @param item The selected item for which the hook was called. | ||
| 164 | * @return AE_DSP_ERROR_NO_ERROR if the hook was called successfully. | ||
| 165 | * @remarks Optional. Return AE_DSP_ERROR_NOT_IMPLEMENTED if this add-on | ||
| 166 | * won't provide this function. | ||
| 167 | */ | ||
| 168 | AE_DSP_ERROR CallMenuHook(const AE_DSP_MENUHOOK& menuhook, const AE_DSP_MENUHOOK_DATA &item); | ||
| 169 | //@} | ||
| 170 | |||
| 171 | /** @name DSP processing control, used to open and close a stream | ||
| 172 | * @remarks Valid implementation required. | ||
| 173 | */ | ||
| 174 | //@{ | ||
| 175 | /*! | ||
| 176 | * @brief Set up Audio DSP with selected audio settings (use the basic | ||
| 177 | * present audio stream data format). | ||
| 178 | * Used to detect available add-ons for present stream, as example stereo | ||
| 179 | * surround upmix not needed on 5.1 audio stream. | ||
| 180 | * @param addonSettings The add-ons audio settings. | ||
| 181 | * @param pProperties The properties of the currently playing stream. | ||
| 182 | * @param handle On this becomes addon informated about stream id and can set function addresses which need on calls | ||
| 183 | * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully | ||
| 184 | * and data can be performed. AE_DSP_ERROR_IGNORE_ME if format is not | ||
| 185 | * supported, but without fault. | ||
| 186 | * @remarks Valid implementation required. | ||
| 187 | */ | ||
| 188 | AE_DSP_ERROR StreamCreate(const AE_DSP_SETTINGS *addonSettings, const AE_DSP_STREAM_PROPERTIES* pProperties, ADDON_HANDLE handle); | ||
| 189 | |||
| 190 | /*! | ||
| 191 | * Remove the selected id from currently used DSP processes | ||
| 192 | * @param handle identification data for stream | ||
| 193 | * @return AE_DSP_ERROR_NO_ERROR if the becomes found and removed | ||
| 194 | * @remarks Valid implementation required. | ||
| 195 | */ | ||
| 196 | AE_DSP_ERROR StreamDestroy(const ADDON_HANDLE handle); | ||
| 197 | |||
| 198 | /*! | ||
| 199 | * @brief Ask the add-on about a requested processing mode that it is | ||
| 200 | * supported on the current stream. Is called about every add-on mode after | ||
| 201 | * successed StreamCreate. | ||
| 202 | * @param handle identification data for stream | ||
| 203 | * @param type The processing mode type, see AE_DSP_MODE_TYPE for definitions | ||
| 204 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 205 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 206 | * RegisterMode callback, | ||
| 207 | * @param unique_db_mode_id The Mode unique id generated from dsp database. | ||
| 208 | * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully | ||
| 209 | * or if the stream is not supported the add-on must return | ||
| 210 | * AE_DSP_ERROR_IGNORE_ME. | ||
| 211 | * @remarks Valid implementation required. | ||
| 212 | */ | ||
| 213 | AE_DSP_ERROR StreamIsModeSupported(const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int mode_id, int unique_db_mode_id); | ||
| 214 | |||
| 215 | /*! | ||
| 216 | * @brief Set up Audio DSP with selected audio settings (detected on data of | ||
| 217 | * first present audio packet) | ||
| 218 | * @param addonSettings The add-ons audio settings. | ||
| 219 | * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully. | ||
| 220 | * @remarks Valid implementation required. | ||
| 221 | */ | ||
| 222 | AE_DSP_ERROR StreamInitialize(const ADDON_HANDLE handle, const AE_DSP_SETTINGS *addonSettings); | ||
| 223 | //@} | ||
| 224 | |||
| 225 | /** @name DSP input processing | ||
| 226 | * @remarks Only used by KODI if bSupportsInputProcess is set to true. | ||
| 227 | */ | ||
| 228 | //@{ | ||
| 229 | /*! | ||
| 230 | * @brief DSP input processing | ||
| 231 | * Can be used to have unchanged stream.. | ||
| 232 | * All DSP add-ons allowed to-do this. | ||
| 233 | * @param handle identification data for stream | ||
| 234 | * @param array_in Pointer to data memory | ||
| 235 | * @param samples Amount of samples inside array_in | ||
| 236 | * @return true if work was OK | ||
| 237 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 238 | * GetAddonCapabilities | ||
| 239 | */ | ||
| 240 | bool InputProcess(const ADDON_HANDLE handle, const float **array_in, unsigned int samples); | ||
| 241 | //@} | ||
| 242 | |||
| 243 | /** @name DSP pre-resampling | ||
| 244 | * @remarks Only used by KODI if bSupportsInputResample is set to true. | ||
| 245 | */ | ||
| 246 | //@{ | ||
| 247 | /*! | ||
| 248 | * @brief If the add-on operate with buffered arrays and the output size can | ||
| 249 | * be higher as the input it becomes asked about needed size before any | ||
| 250 | * InputResampleProcess call. | ||
| 251 | * @param handle identification data for stream | ||
| 252 | * @return The needed size of output array or 0 if no changes within it | ||
| 253 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 254 | * GetAddonCapabilities | ||
| 255 | */ | ||
| 256 | unsigned int InputResampleProcessNeededSamplesize(const ADDON_HANDLE handle); | ||
| 257 | |||
| 258 | /*! | ||
| 259 | * @brief DSP re sample processing before master. | ||
| 260 | * Here a high quality resample can be performed. | ||
| 261 | * Only one DSP add-on is allowed to-do this! | ||
| 262 | * @param handle identification data for stream | ||
| 263 | * @param array_in Pointer to input data memory | ||
| 264 | * @param array_out Pointer to output data memory | ||
| 265 | * @param samples Amount of samples inside array_in | ||
| 266 | * @return Amount of samples processed | ||
| 267 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 268 | * GetAddonCapabilities | ||
| 269 | */ | ||
| 270 | unsigned int InputResampleProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples); | ||
| 271 | |||
| 272 | /*! | ||
| 273 | * @brief Returns the re-sampling generated new sample rate used before the | ||
| 274 | * master process | ||
| 275 | * @param handle identification data for stream | ||
| 276 | * @return The new sample rate | ||
| 277 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 278 | * GetAddonCapabilities | ||
| 279 | */ | ||
| 280 | int InputResampleSampleRate(const ADDON_HANDLE handle); | ||
| 281 | |||
| 282 | /*! | ||
| 283 | * @brief Returns the time in seconds that it will take | ||
| 284 | * for the next added packet to be returned to KODI. | ||
| 285 | * @param handle identification data for stream | ||
| 286 | * @return the delay in seconds | ||
| 287 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 288 | * GetAddonCapabilities | ||
| 289 | */ | ||
| 290 | float InputResampleGetDelay(const ADDON_HANDLE handle); | ||
| 291 | //@} | ||
| 292 | |||
| 293 | /** @name DSP Pre processing | ||
| 294 | * @remarks Only used by KODI if bSupportsPreProcess is set to true. | ||
| 295 | */ | ||
| 296 | //@{ | ||
| 297 | /*! | ||
| 298 | * @brief If the addon operate with buffered arrays and the output size can | ||
| 299 | * be higher as the input it becomes asked about needed size before any | ||
| 300 | * PreProcess call. | ||
| 301 | * @param handle identification data for stream | ||
| 302 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 303 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 304 | * RegisterMode callback and can be defined from add-on as a structure | ||
| 305 | * pointer or anything else what is needed to find it. | ||
| 306 | * @return The needed size of output array or 0 if no changes within it | ||
| 307 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 308 | * GetAddonCapabilities | ||
| 309 | */ | ||
| 310 | unsigned int PreProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id); | ||
| 311 | |||
| 312 | /*! | ||
| 313 | * @brief Returns the time in seconds that it will take | ||
| 314 | * for the next added packet to be returned to KODI. | ||
| 315 | * @param handle identification data for stream | ||
| 316 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 317 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 318 | * RegisterMode callback and can be defined from add-on as a structure | ||
| 319 | * pointer or anything else what is needed to find it. | ||
| 320 | * @return the delay in seconds | ||
| 321 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 322 | * GetAddonCapabilities | ||
| 323 | */ | ||
| 324 | float PreProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id); | ||
| 325 | |||
| 326 | /*! | ||
| 327 | * @brief DSP preprocessing | ||
| 328 | * All DSP add-ons allowed to-do this. | ||
| 329 | * @param handle identification data for stream | ||
| 330 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 331 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 332 | * RegisterMode callback and can be defined from add-on as a structure | ||
| 333 | * pointer or anything else what is needed to find it. | ||
| 334 | * @param array_in Pointer to input data memory | ||
| 335 | * @param array_out Pointer to output data memory | ||
| 336 | * @param samples Amount of samples inside array_in | ||
| 337 | * @return Amount of samples processed | ||
| 338 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 339 | * GetAddonCapabilities | ||
| 340 | */ | ||
| 341 | unsigned int PreProcess(const ADDON_HANDLE handle, unsigned int mode_id, float **array_in, float **array_out, unsigned int samples); | ||
| 342 | //@} | ||
| 343 | |||
| 344 | /** @name DSP Master processing | ||
| 345 | * @remarks Only used by KODI if bSupportsMasterProcess is set to true. | ||
| 346 | */ | ||
| 347 | //@{ | ||
| 348 | /*! | ||
| 349 | * @brief Set the active master process mode | ||
| 350 | * @param handle identification data for stream | ||
| 351 | * @param type Requested stream type for the selected master mode | ||
| 352 | * @param mode_id The Mode identifier. | ||
| 353 | * @param unique_db_mode_id The Mode unique id generated from DSP database. | ||
| 354 | * @return AE_DSP_ERROR_NO_ERROR if the setup was successful | ||
| 355 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 356 | * GetAddonCapabilities | ||
| 357 | */ | ||
| 358 | AE_DSP_ERROR MasterProcessSetMode(const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id); | ||
| 359 | |||
| 360 | /*! | ||
| 361 | * @brief If the add-on operate with buffered arrays and the output size can | ||
| 362 | * be higher as the input it becomes asked about needed size before any | ||
| 363 | * MasterProcess call. | ||
| 364 | * @param handle identification data for stream | ||
| 365 | * @return The needed size of output array or 0 if no changes within it | ||
| 366 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 367 | * GetAddonCapabilities | ||
| 368 | */ | ||
| 369 | unsigned int MasterProcessNeededSamplesize(const ADDON_HANDLE handle); | ||
| 370 | |||
| 371 | /*! | ||
| 372 | * @brief Returns the time in seconds that it will take | ||
| 373 | * for the next added packet to be returned to KODI. | ||
| 374 | * @param handle identification data for stream | ||
| 375 | * @return the delay in seconds | ||
| 376 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 377 | * GetAddonCapabilities | ||
| 378 | */ | ||
| 379 | float MasterProcessGetDelay(const ADDON_HANDLE handle); | ||
| 380 | |||
| 381 | /*! | ||
| 382 | * @brief Returns the from selected master mode performed channel alignment | ||
| 383 | * @param handle identification data for stream | ||
| 384 | * @retval out_channel_present_flags the exact channel present flags after | ||
| 385 | * performed up-/downmix | ||
| 386 | * @return the amount channels | ||
| 387 | * @remarks Optional. Must be used and set if a channel up- or downmix is | ||
| 388 | * processed from the active master mode | ||
| 389 | */ | ||
| 390 | int MasterProcessGetOutChannels(const ADDON_HANDLE handle, unsigned long &out_channel_present_flags); | ||
| 391 | |||
| 392 | /*! | ||
| 393 | * @brief Master processing becomes performed with it | ||
| 394 | * Here a channel up-mix/down-mix for stereo surround sound can be performed | ||
| 395 | * Only one DSP add-on is allowed to-do this! | ||
| 396 | * @param handle identification data for stream | ||
| 397 | * @param array_in Pointer to input data memory | ||
| 398 | * @param array_out Pointer to output data memory | ||
| 399 | * @param samples Amount of samples inside array_in | ||
| 400 | * @return Amount of samples processed | ||
| 401 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 402 | * GetAddonCapabilities | ||
| 403 | */ | ||
| 404 | unsigned int MasterProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples); | ||
| 405 | |||
| 406 | /*! | ||
| 407 | * Used to get a information string about the processed work to show on skin | ||
| 408 | * @return A string to show | ||
| 409 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 410 | * GetAddonCapabilities | ||
| 411 | */ | ||
| 412 | const char *MasterProcessGetStreamInfoString(const ADDON_HANDLE handle); | ||
| 413 | //@} | ||
| 414 | |||
| 415 | /** @name DSP Post processing | ||
| 416 | * @remarks Only used by KODI if bSupportsPostProcess is set to true. | ||
| 417 | */ | ||
| 418 | //@{ | ||
| 419 | /*! | ||
| 420 | * If the add-on operate with buffered arrays and the output size can be | ||
| 421 | * higher as the input it becomes asked about needed size before any | ||
| 422 | * PostProcess call. | ||
| 423 | * @param handle identification data for stream | ||
| 424 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 425 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 426 | * RegisterMode callback, and can be defined from add-on as a structure | ||
| 427 | * pointer or anything else what is needed to find it. | ||
| 428 | * @return The needed size of output array or 0 if no changes within it | ||
| 429 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 430 | * GetAddonCapabilities | ||
| 431 | */ | ||
| 432 | unsigned int PostProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id); | ||
| 433 | |||
| 434 | /*! | ||
| 435 | * Returns the time in seconds that it will take | ||
| 436 | * for the next added packet to be returned to KODI. | ||
| 437 | * @param handle identification data for stream | ||
| 438 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 439 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 440 | * RegisterMode callback, and can be defined from add-on as a structure | ||
| 441 | * pointer or anything else what is needed to find it. | ||
| 442 | * @return the delay in seconds | ||
| 443 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 444 | * GetAddonCapabilities | ||
| 445 | */ | ||
| 446 | float PostProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id); | ||
| 447 | |||
| 448 | /*! | ||
| 449 | * @brief DSP post processing | ||
| 450 | * On the post processing can be things performed with additional channel | ||
| 451 | * upmix like 6.1 to 7.1 | ||
| 452 | * or frequency/volume corrections, speaker distance handling, equalizer... . | ||
| 453 | * All DSP add-ons allowed to-do this. | ||
| 454 | * @param handle identification data for stream | ||
| 455 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 456 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 457 | * RegisterMode callback, and can be defined from add-on as a structure | ||
| 458 | * pointer or anything else what is needed to find it. | ||
| 459 | * @param array_in Pointer to input data memory | ||
| 460 | * @param array_out Pointer to output data memory | ||
| 461 | * @param samples Amount of samples inside array_in | ||
| 462 | * @return Amount of samples processed | ||
| 463 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 464 | * GetAddonCapabilities | ||
| 465 | */ | ||
| 466 | unsigned int PostProcess(const ADDON_HANDLE handle, unsigned int mode_id, float **array_in, float **array_out, unsigned int samples); | ||
| 467 | //@} | ||
| 468 | |||
| 469 | /** @name DSP Post re-sampling | ||
| 470 | * @remarks Only used by KODI if bSupportsOutputResample is set to true. | ||
| 471 | */ | ||
| 472 | //@{ | ||
| 473 | /*! | ||
| 474 | * @brief If the add-on operate with buffered arrays and the output size | ||
| 475 | * can be higher as the input | ||
| 476 | * it becomes asked about needed size before any OutputResampleProcess call. | ||
| 477 | * @param handle identification data for stream | ||
| 478 | * @return The needed size of output array or 0 if no changes within it | ||
| 479 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 480 | * GetAddonCapabilities | ||
| 481 | */ | ||
| 482 | unsigned int OutputResampleProcessNeededSamplesize(const ADDON_HANDLE handle); | ||
| 483 | |||
| 484 | /*! | ||
| 485 | * @brief Re-sampling after master processing becomes performed with it if | ||
| 486 | * needed, only | ||
| 487 | * one add-on can perform it. | ||
| 488 | * @param handle identification data for stream | ||
| 489 | * @param array_in Pointer to input data memory | ||
| 490 | * @param array_out Pointer to output data memory | ||
| 491 | * @param samples Amount of samples inside array_in | ||
| 492 | * @return Amount of samples processed | ||
| 493 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 494 | * GetAddonCapabilities | ||
| 495 | */ | ||
| 496 | unsigned int OutputResampleProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples); | ||
| 497 | |||
| 498 | /*! | ||
| 499 | * @brief Returns the re-sampling generated new sample rate used after the | ||
| 500 | * master process. | ||
| 501 | * @param handle identification data for stream | ||
| 502 | * @return The new sample rate | ||
| 503 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 504 | * GetAddonCapabilities | ||
| 505 | */ | ||
| 506 | int OutputResampleSampleRate(const ADDON_HANDLE handle); | ||
| 507 | |||
| 508 | /*! | ||
| 509 | * @brief Returns the time in seconds that it will take for the next added | ||
| 510 | * packet to be returned to KODI. | ||
| 511 | * @param handle identification data for stream | ||
| 512 | * @return the delay in seconds | ||
| 513 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 514 | * GetAddonCapabilities | ||
| 515 | */ | ||
| 516 | float OutputResampleGetDelay(const ADDON_HANDLE handle); | ||
| 517 | //@} | ||
| 518 | |||
| 519 | // function to export the above structure to KODI | ||
| 520 | void __declspec(dllexport) get_addon(struct AudioDSP* pDSP) | ||
| 521 | { | ||
| 522 | pDSP->GetAudioDSPAPIVersion = GetAudioDSPAPIVersion; | ||
| 523 | pDSP->GetMinimumAudioDSPAPIVersion = GetMinimumAudioDSPAPIVersion; | ||
| 524 | pDSP->GetGUIAPIVersion = GetGUIAPIVersion; | ||
| 525 | pDSP->GetMinimumGUIAPIVersion = GetMinimumGUIAPIVersion; | ||
| 526 | pDSP->GetAddonCapabilities = GetAddonCapabilities; | ||
| 527 | pDSP->GetDSPName = GetDSPName; | ||
| 528 | pDSP->GetDSPVersion = GetDSPVersion; | ||
| 529 | pDSP->MenuHook = CallMenuHook; | ||
| 530 | |||
| 531 | pDSP->StreamCreate = StreamCreate; | ||
| 532 | pDSP->StreamDestroy = StreamDestroy; | ||
| 533 | pDSP->StreamIsModeSupported = StreamIsModeSupported; | ||
| 534 | pDSP->StreamInitialize = StreamInitialize; | ||
| 535 | |||
| 536 | pDSP->InputProcess = InputProcess; | ||
| 537 | |||
| 538 | pDSP->InputResampleProcessNeededSamplesize = InputResampleProcessNeededSamplesize; | ||
| 539 | pDSP->InputResampleProcess = InputResampleProcess; | ||
| 540 | pDSP->InputResampleGetDelay = InputResampleGetDelay; | ||
| 541 | pDSP->InputResampleSampleRate = InputResampleSampleRate; | ||
| 542 | |||
| 543 | pDSP->PreProcessNeededSamplesize = PreProcessNeededSamplesize; | ||
| 544 | pDSP->PreProcessGetDelay = PreProcessGetDelay; | ||
| 545 | pDSP->PreProcess = PreProcess; | ||
| 546 | |||
| 547 | pDSP->MasterProcessSetMode = MasterProcessSetMode; | ||
| 548 | pDSP->MasterProcessNeededSamplesize = MasterProcessNeededSamplesize; | ||
| 549 | pDSP->MasterProcessGetDelay = MasterProcessGetDelay; | ||
| 550 | pDSP->MasterProcessGetOutChannels = MasterProcessGetOutChannels; | ||
| 551 | pDSP->MasterProcess = MasterProcess; | ||
| 552 | pDSP->MasterProcessGetStreamInfoString = MasterProcessGetStreamInfoString; | ||
| 553 | |||
| 554 | pDSP->PostProcessNeededSamplesize = PostProcessNeededSamplesize; | ||
| 555 | pDSP->PostProcessGetDelay = PostProcessGetDelay; | ||
| 556 | pDSP->PostProcess = PostProcess; | ||
| 557 | |||
| 558 | pDSP->OutputResampleProcessNeededSamplesize = OutputResampleProcessNeededSamplesize; | ||
| 559 | pDSP->OutputResampleProcess = OutputResampleProcess; | ||
| 560 | pDSP->OutputResampleSampleRate = OutputResampleSampleRate; | ||
| 561 | pDSP->OutputResampleGetDelay = OutputResampleGetDelay; | ||
| 562 | }; | ||
| 563 | }; | ||
| 564 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h new file mode 100644 index 0000000..6e492c8 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h | |||
| @@ -0,0 +1,524 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | /*! | ||
| 24 | * Common data structures shared between KODI and KODI's audio DSP add-ons | ||
| 25 | */ | ||
| 26 | |||
| 27 | #ifdef TARGET_WINDOWS | ||
| 28 | #include <windows.h> | ||
| 29 | #else | ||
| 30 | #ifndef __cdecl | ||
| 31 | #define __cdecl | ||
| 32 | #endif | ||
| 33 | #ifndef __declspec | ||
| 34 | #define __declspec(X) | ||
| 35 | #endif | ||
| 36 | #endif | ||
| 37 | |||
| 38 | #include <cstddef> | ||
| 39 | |||
| 40 | #include "xbmc_addon_types.h" | ||
| 41 | #include "xbmc_codec_types.h" | ||
| 42 | |||
| 43 | #undef ATTRIBUTE_PACKED | ||
| 44 | #undef PRAGMA_PACK_BEGIN | ||
| 45 | #undef PRAGMA_PACK_END | ||
| 46 | |||
| 47 | #if defined(__GNUC__) | ||
| 48 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | ||
| 49 | #define ATTRIBUTE_PACKED __attribute__ ((packed)) | ||
| 50 | #define PRAGMA_PACK 0 | ||
| 51 | #endif | ||
| 52 | #endif | ||
| 53 | |||
| 54 | #if !defined(ATTRIBUTE_PACKED) | ||
| 55 | #define ATTRIBUTE_PACKED | ||
| 56 | #define PRAGMA_PACK 1 | ||
| 57 | #endif | ||
| 58 | |||
| 59 | #define AE_DSP_ADDON_STRING_LENGTH 1024 | ||
| 60 | |||
| 61 | #define AE_DSP_STREAM_MAX_STREAMS 8 | ||
| 62 | #define AE_DSP_STREAM_MAX_MODES 32 | ||
| 63 | |||
| 64 | /* current Audio DSP API version */ | ||
| 65 | #define KODI_AE_DSP_API_VERSION "0.1.8" | ||
| 66 | |||
| 67 | /* min. Audio DSP API version */ | ||
| 68 | #define KODI_AE_DSP_MIN_API_VERSION "0.1.8" | ||
| 69 | |||
| 70 | #ifdef __cplusplus | ||
| 71 | extern "C" { | ||
| 72 | #endif | ||
| 73 | |||
| 74 | typedef unsigned int AE_DSP_STREAM_ID; | ||
| 75 | |||
| 76 | /*! | ||
| 77 | * @brief Audio DSP add-on error codes | ||
| 78 | */ | ||
| 79 | typedef enum | ||
| 80 | { | ||
| 81 | AE_DSP_ERROR_NO_ERROR = 0, /*!< @brief no error occurred */ | ||
| 82 | AE_DSP_ERROR_UNKNOWN = -1, /*!< @brief an unknown error occurred */ | ||
| 83 | AE_DSP_ERROR_IGNORE_ME = -2, /*!< @brief the used input stream can not processed and add-on want to ignore */ | ||
| 84 | AE_DSP_ERROR_NOT_IMPLEMENTED = -3, /*!< @brief the method that KODI called is not implemented by the add-on */ | ||
| 85 | AE_DSP_ERROR_REJECTED = -4, /*!< @brief the command was rejected by the DSP */ | ||
| 86 | AE_DSP_ERROR_INVALID_PARAMETERS = -5, /*!< @brief the parameters of the method that was called are invalid for this operation */ | ||
| 87 | AE_DSP_ERROR_INVALID_SAMPLERATE = -6, /*!< @brief the processed samplerate is not supported */ | ||
| 88 | AE_DSP_ERROR_INVALID_IN_CHANNELS = -7, /*!< @brief the processed input channel format is not supported */ | ||
| 89 | AE_DSP_ERROR_INVALID_OUT_CHANNELS = -8, /*!< @brief the processed output channel format is not supported */ | ||
| 90 | AE_DSP_ERROR_FAILED = -9, /*!< @brief the command failed */ | ||
| 91 | } AE_DSP_ERROR; | ||
| 92 | |||
| 93 | /*! | ||
| 94 | * @brief The possible DSP channels (used as pointer inside arrays) | ||
| 95 | */ | ||
| 96 | typedef enum | ||
| 97 | { | ||
| 98 | AE_DSP_CH_INVALID = -1, | ||
| 99 | AE_DSP_CH_FL = 0, | ||
| 100 | AE_DSP_CH_FR, | ||
| 101 | AE_DSP_CH_FC, | ||
| 102 | AE_DSP_CH_LFE, | ||
| 103 | AE_DSP_CH_BL, | ||
| 104 | AE_DSP_CH_BR, | ||
| 105 | AE_DSP_CH_FLOC, | ||
| 106 | AE_DSP_CH_FROC, | ||
| 107 | AE_DSP_CH_BC, | ||
| 108 | AE_DSP_CH_SL, | ||
| 109 | AE_DSP_CH_SR, | ||
| 110 | AE_DSP_CH_TFL, | ||
| 111 | AE_DSP_CH_TFR, | ||
| 112 | AE_DSP_CH_TFC, | ||
| 113 | AE_DSP_CH_TC, | ||
| 114 | AE_DSP_CH_TBL, | ||
| 115 | AE_DSP_CH_TBR, | ||
| 116 | AE_DSP_CH_TBC, | ||
| 117 | AE_DSP_CH_BLOC, | ||
| 118 | AE_DSP_CH_BROC, | ||
| 119 | |||
| 120 | AE_DSP_CH_MAX | ||
| 121 | } AE_DSP_CHANNEL; | ||
| 122 | |||
| 123 | /*! | ||
| 124 | * @brief Present channel flags | ||
| 125 | */ | ||
| 126 | typedef enum | ||
| 127 | { | ||
| 128 | AE_DSP_PRSNT_CH_UNDEFINED = 0, | ||
| 129 | AE_DSP_PRSNT_CH_FL = 1<<0, | ||
| 130 | AE_DSP_PRSNT_CH_FR = 1<<1, | ||
| 131 | AE_DSP_PRSNT_CH_FC = 1<<2, | ||
| 132 | AE_DSP_PRSNT_CH_LFE = 1<<3, | ||
| 133 | AE_DSP_PRSNT_CH_BL = 1<<4, | ||
| 134 | AE_DSP_PRSNT_CH_BR = 1<<5, | ||
| 135 | AE_DSP_PRSNT_CH_FLOC = 1<<6, | ||
| 136 | AE_DSP_PRSNT_CH_FROC = 1<<7, | ||
| 137 | AE_DSP_PRSNT_CH_BC = 1<<8, | ||
| 138 | AE_DSP_PRSNT_CH_SL = 1<<9, | ||
| 139 | AE_DSP_PRSNT_CH_SR = 1<<10, | ||
| 140 | AE_DSP_PRSNT_CH_TFL = 1<<11, | ||
| 141 | AE_DSP_PRSNT_CH_TFR = 1<<12, | ||
| 142 | AE_DSP_PRSNT_CH_TFC = 1<<13, | ||
| 143 | AE_DSP_PRSNT_CH_TC = 1<<14, | ||
| 144 | AE_DSP_PRSNT_CH_TBL = 1<<15, | ||
| 145 | AE_DSP_PRSNT_CH_TBR = 1<<16, | ||
| 146 | AE_DSP_PRSNT_CH_TBC = 1<<17, | ||
| 147 | AE_DSP_PRSNT_CH_BLOC = 1<<18, | ||
| 148 | AE_DSP_PRSNT_CH_BROC = 1<<19 | ||
| 149 | } AE_DSP_CHANNEL_PRESENT; | ||
| 150 | |||
| 151 | /** | ||
| 152 | * @brief The various stream type formats | ||
| 153 | * Used for audio DSP processing to know input audio type | ||
| 154 | */ | ||
| 155 | typedef enum | ||
| 156 | { | ||
| 157 | AE_DSP_ASTREAM_INVALID = -1, | ||
| 158 | AE_DSP_ASTREAM_BASIC = 0, | ||
| 159 | AE_DSP_ASTREAM_MUSIC, | ||
| 160 | AE_DSP_ASTREAM_MOVIE, | ||
| 161 | AE_DSP_ASTREAM_GAME, | ||
| 162 | AE_DSP_ASTREAM_APP, | ||
| 163 | AE_DSP_ASTREAM_PHONE, | ||
| 164 | AE_DSP_ASTREAM_MESSAGE, | ||
| 165 | |||
| 166 | AE_DSP_ASTREAM_AUTO, | ||
| 167 | AE_DSP_ASTREAM_MAX | ||
| 168 | } AE_DSP_STREAMTYPE; | ||
| 169 | |||
| 170 | /*! | ||
| 171 | * @brief Add-ons supported audio stream type flags | ||
| 172 | * used on master mode information on AE_DSP_MODES to know | ||
| 173 | * on which audio stream the master mode is supported | ||
| 174 | */ | ||
| 175 | typedef enum | ||
| 176 | { | ||
| 177 | AE_DSP_PRSNT_ASTREAM_BASIC = 1<<0, | ||
| 178 | AE_DSP_PRSNT_ASTREAM_MUSIC = 1<<1, | ||
| 179 | AE_DSP_PRSNT_ASTREAM_MOVIE = 1<<2, | ||
| 180 | AE_DSP_PRSNT_ASTREAM_GAME = 1<<3, | ||
| 181 | AE_DSP_PRSNT_ASTREAM_APP = 1<<4, | ||
| 182 | AE_DSP_PRSNT_ASTREAM_MESSAGE = 1<<5, | ||
| 183 | AE_DSP_PRSNT_ASTREAM_PHONE = 1<<6, | ||
| 184 | } AE_DSP_ASTREAM_PRESENT; | ||
| 185 | |||
| 186 | /** | ||
| 187 | * @brief The various base type formats | ||
| 188 | * Used for audio DSP processing to know input audio source | ||
| 189 | */ | ||
| 190 | typedef enum | ||
| 191 | { | ||
| 192 | AE_DSP_ABASE_INVALID = -1, | ||
| 193 | AE_DSP_ABASE_STEREO = 0, | ||
| 194 | AE_DSP_ABASE_MONO, | ||
| 195 | AE_DSP_ABASE_MULTICHANNEL, | ||
| 196 | AE_DSP_ABASE_AC3, | ||
| 197 | AE_DSP_ABASE_EAC3, | ||
| 198 | AE_DSP_ABASE_DTS, | ||
| 199 | AE_DSP_ABASE_DTSHD_MA, | ||
| 200 | AE_DSP_ABASE_DTSHD_HRA, | ||
| 201 | AE_DSP_ABASE_TRUEHD, | ||
| 202 | AE_DSP_ABASE_MLP, | ||
| 203 | AE_DSP_ABASE_FLAC, | ||
| 204 | |||
| 205 | AE_DSP_ABASE_MAX | ||
| 206 | } AE_DSP_BASETYPE; | ||
| 207 | |||
| 208 | |||
| 209 | /** | ||
| 210 | * @brief The from KODI in settings requested audio process quality. | ||
| 211 | * The KODI internal used quality levels is translated to this values | ||
| 212 | * for usage on DSP processing add-ons. Is present on iQualityLevel | ||
| 213 | * inside AE_DSP_SETTINGS. | ||
| 214 | */ | ||
| 215 | typedef enum | ||
| 216 | { | ||
| 217 | AE_DSP_QUALITY_UNKNOWN = -1, /*!< @brief Unset, unknown or incorrect quality level */ | ||
| 218 | AE_DSP_QUALITY_DEFAULT = 0, /*!< @brief Engine's default quality level */ | ||
| 219 | |||
| 220 | /* Basic quality levels */ | ||
| 221 | AE_DSP_QUALITY_LOW = 20, /*!< @brief Low quality level */ | ||
| 222 | AE_DSP_QUALITY_MID = 30, /*!< @brief Standard quality level */ | ||
| 223 | AE_DSP_QUALITY_HIGH = 50, /*!< @brief Best sound processing quality */ | ||
| 224 | |||
| 225 | /* Optional quality levels */ | ||
| 226 | AE_DSP_QUALITY_REALLYHIGH = 100 /*!< @brief Uncompromising optional quality level, usually with unmeasurable and unnoticeable improvement */ | ||
| 227 | } AE_DSP_QUALITY; | ||
| 228 | |||
| 229 | /*! | ||
| 230 | * @brief Audio DSP menu hook categories. | ||
| 231 | * Used to identify on AE_DSP_MENUHOOK given add-on related skin dialog/windows. | ||
| 232 | * Except AE_DSP_MENUHOOK_ALL and AE_DSP_MENUHOOK_SETTING are the menus available | ||
| 233 | * from DSP playback dialogue which can be opened over KODI file context menu and over | ||
| 234 | * button on full screen OSD window. | ||
| 235 | * | ||
| 236 | * Menu hook AE_DSP_MENUHOOK_SETTING is available from DSP processing setup dialogue. | ||
| 237 | */ | ||
| 238 | typedef enum | ||
| 239 | { | ||
| 240 | AE_DSP_MENUHOOK_UNKNOWN =-1, /*!< @brief unknown menu hook */ | ||
| 241 | AE_DSP_MENUHOOK_ALL = 0, /*!< @brief all categories */ | ||
| 242 | AE_DSP_MENUHOOK_PRE_PROCESS = 1, /*!< @brief for pre processing */ | ||
| 243 | AE_DSP_MENUHOOK_MASTER_PROCESS = 2, /*!< @brief for master processing */ | ||
| 244 | AE_DSP_MENUHOOK_POST_PROCESS = 3, /*!< @brief for post processing */ | ||
| 245 | AE_DSP_MENUHOOK_RESAMPLE = 4, /*!< @brief for re sample */ | ||
| 246 | AE_DSP_MENUHOOK_MISCELLANEOUS = 5, /*!< @brief for miscellaneous dialogues */ | ||
| 247 | AE_DSP_MENUHOOK_INFORMATION = 6, /*!< @brief dialogue to show processing information */ | ||
| 248 | AE_DSP_MENUHOOK_SETTING = 7, /*!< @brief for settings */ | ||
| 249 | } AE_DSP_MENUHOOK_CAT; | ||
| 250 | |||
| 251 | /*! | ||
| 252 | * @brief Menu hooks that are available in the menus while playing a stream via this add-on. | ||
| 253 | */ | ||
| 254 | typedef struct AE_DSP_MENUHOOK | ||
| 255 | { | ||
| 256 | unsigned int iHookId; /*!< @brief (required) this hook's identifier */ | ||
| 257 | unsigned int iLocalizedStringId; /*!< @brief (required) the id of the label for this hook in g_localizeStrings */ | ||
| 258 | AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) category of menu hook */ | ||
| 259 | unsigned int iRelevantModeId; /*!< @brief (required) except category AE_DSP_MENUHOOK_SETTING and AE_DSP_MENUHOOK_ALL must be the related mode id present here */ | ||
| 260 | bool bNeedPlayback; /*!< @brief (required) set to true if menu hook need playback and active processing */ | ||
| 261 | } ATTRIBUTE_PACKED AE_DSP_MENUHOOK; | ||
| 262 | |||
| 263 | /*! | ||
| 264 | * @brief Properties passed to the Create() method of an add-on. | ||
| 265 | */ | ||
| 266 | typedef struct AE_DSP_PROPERTIES | ||
| 267 | { | ||
| 268 | const char* strUserPath; /*!< @brief path to the user profile */ | ||
| 269 | const char* strAddonPath; /*!< @brief path to this add-on */ | ||
| 270 | } AE_DSP_PROPERTIES; | ||
| 271 | |||
| 272 | /*! | ||
| 273 | * @brief Audio DSP add-on capabilities. All capabilities are set to "false" as default. | ||
| 274 | * If a capability is set to true, then the corresponding methods from kodi_audiodsp_dll.h need to be implemented. | ||
| 275 | */ | ||
| 276 | typedef struct AE_DSP_ADDON_CAPABILITIES | ||
| 277 | { | ||
| 278 | bool bSupportsInputProcess; /*!< @brief true if this add-on provides audio input processing */ | ||
| 279 | bool bSupportsInputResample; /*!< @brief true if this add-on provides audio resample before master handling */ | ||
| 280 | bool bSupportsPreProcess; /*!< @brief true if this add-on provides audio pre processing */ | ||
| 281 | bool bSupportsMasterProcess; /*!< @brief true if this add-on provides audio master processing */ | ||
| 282 | bool bSupportsPostProcess; /*!< @brief true if this add-on provides audio post processing */ | ||
| 283 | bool bSupportsOutputResample; /*!< @brief true if this add-on provides audio re sample after master handling */ | ||
| 284 | } ATTRIBUTE_PACKED AE_DSP_ADDON_CAPABILITIES; | ||
| 285 | |||
| 286 | /*! | ||
| 287 | * @brief Audio processing settings for in and out arrays | ||
| 288 | * Send on creation and before first processed audio packet to add-on | ||
| 289 | */ | ||
| 290 | typedef struct AE_DSP_SETTINGS | ||
| 291 | { | ||
| 292 | AE_DSP_STREAM_ID iStreamID; /*!< @brief id of the audio stream packets */ | ||
| 293 | AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */ | ||
| 294 | int iInChannels; /*!< @brief the amount of input channels */ | ||
| 295 | unsigned long lInChannelPresentFlags; /*!< @brief the exact channel mapping flags of input */ | ||
| 296 | int iInFrames; /*!< @brief the input frame size from KODI */ | ||
| 297 | unsigned int iInSamplerate; /*!< @brief the basic sample rate of the audio packet */ | ||
| 298 | int iProcessFrames; /*!< @brief the processing frame size inside add-on's */ | ||
| 299 | unsigned int iProcessSamplerate; /*!< @brief the sample rate after input resample present in master processing */ | ||
| 300 | int iOutChannels; /*!< @brief the amount of output channels */ | ||
| 301 | unsigned long lOutChannelPresentFlags; /*!< @brief the exact channel mapping flags for output */ | ||
| 302 | int iOutFrames; /*!< @brief the final out frame size for KODI */ | ||
| 303 | unsigned int iOutSamplerate; /*!< @brief the final sample rate of the audio packet */ | ||
| 304 | bool bInputResamplingActive; /*!< @brief if a re-sampling is performed before master processing this flag is set to true */ | ||
| 305 | bool bStereoUpmix; /*!< @brief true if the stereo upmix setting on kodi is set */ | ||
| 306 | int iQualityLevel; /*!< @brief the from KODI selected quality level for signal processing */ | ||
| 307 | /*! | ||
| 308 | * @note about "iProcessSamplerate" and "iProcessFrames" is set from KODI after call of StreamCreate on input re sample add-on, if re-sampling | ||
| 309 | * and processing is handled inside the same add-on, this value must be ignored! | ||
| 310 | */ | ||
| 311 | } ATTRIBUTE_PACKED AE_DSP_SETTINGS; | ||
| 312 | |||
| 313 | /*! | ||
| 314 | * @brief Stream profile properties | ||
| 315 | * Can be used to detect best master processing mode and for post processing methods. | ||
| 316 | */ | ||
| 317 | //@{ | ||
| 318 | |||
| 319 | /*! | ||
| 320 | * @brief Dolby profile types. Given from several formats, e.g. Dolby Digital or TrueHD | ||
| 321 | * Used on AE_DSP_PROFILE_AC3_EAC3 and AE_DSP_PROFILE_MLP_TRUEHD | ||
| 322 | */ | ||
| 323 | #define AE_DSP_PROFILE_DOLBY_NONE 0 | ||
| 324 | #define AE_DSP_PROFILE_DOLBY_SURROUND 1 | ||
| 325 | #define AE_DSP_PROFILE_DOLBY_PLII 2 | ||
| 326 | #define AE_DSP_PROFILE_DOLBY_PLIIX 3 | ||
| 327 | #define AE_DSP_PROFILE_DOLBY_PLIIZ 4 | ||
| 328 | #define AE_DSP_PROFILE_DOLBY_EX 5 | ||
| 329 | #define AE_DSP_PROFILE_DOLBY_HEADPHONE 6 | ||
| 330 | |||
| 331 | /*! | ||
| 332 | * @brief DTS/DTS HD profile types | ||
| 333 | * Used on AE_DSP_PROFILE_DTS_DTSHD | ||
| 334 | */ | ||
| 335 | #define AE_DSP_PROFILE_DTS 0 | ||
| 336 | #define AE_DSP_PROFILE_DTS_ES 1 | ||
| 337 | #define AE_DSP_PROFILE_DTS_96_24 2 | ||
| 338 | #define AE_DSP_PROFILE_DTS_HD_HRA 3 | ||
| 339 | #define AE_DSP_PROFILE_DTS_HD_MA 4 | ||
| 340 | |||
| 341 | /*! | ||
| 342 | * @brief AC3/EAC3 based service types | ||
| 343 | * Used on AE_DSP_PROFILE_AC3_EAC3 | ||
| 344 | */ | ||
| 345 | #define AE_DSP_SERVICE_TYPE_MAIN 0 | ||
| 346 | #define AE_DSP_SERVICE_TYPE_EFFECTS 1 | ||
| 347 | #define AE_DSP_SERVICE_TYPE_VISUALLY_IMPAIRED 2 | ||
| 348 | #define AE_DSP_SERVICE_TYPE_HEARING_IMPAIRED 3 | ||
| 349 | #define AE_DSP_SERVICE_TYPE_DIALOGUE 4 | ||
| 350 | #define AE_DSP_SERVICE_TYPE_COMMENTARY 5 | ||
| 351 | #define AE_DSP_SERVICE_TYPE_EMERGENCY 6 | ||
| 352 | #define AE_DSP_SERVICE_TYPE_VOICE_OVER 7 | ||
| 353 | #define AE_DSP_SERVICE_TYPE_KARAOKE 8 | ||
| 354 | |||
| 355 | /*! | ||
| 356 | * @brief AC3/EAC3 based room types | ||
| 357 | * Present on AE_DSP_PROFILE_AC3_EAC3 and can be used for frequency corrections | ||
| 358 | * at post processing, e.g. THX Re-Equalization | ||
| 359 | */ | ||
| 360 | #define AE_DSP_ROOM_TYPE_UNDEFINED 0 | ||
| 361 | #define AE_DSP_ROOM_TYPE_SMALL 1 | ||
| 362 | #define AE_DSP_ROOM_TYPE_LARGE 2 | ||
| 363 | |||
| 364 | /*! | ||
| 365 | * @brief AC3/EAC3 stream profile properties | ||
| 366 | */ | ||
| 367 | //! @todo add handling for it (currently never becomes set) | ||
| 368 | typedef struct AE_DSP_PROFILE_AC3_EAC3 | ||
| 369 | { | ||
| 370 | unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */ | ||
| 371 | unsigned int iServiceType; /*!< defined by AE_DSP_SERVICE_TYPE_* */ | ||
| 372 | unsigned int iRoomType; /*!< defined by AE_DSP_ROOM_TYPE_* (NOTICE: Information about it currently not supported from ffmpeg and must be implemented) */ | ||
| 373 | } ATTRIBUTE_PACKED AE_DSP_PROFILE_AC3_EAC3; | ||
| 374 | |||
| 375 | /*! | ||
| 376 | * @brief MLP/Dolby TrueHD stream profile properties | ||
| 377 | */ | ||
| 378 | //! @todo add handling for it (currently never becomes set) | ||
| 379 | typedef struct AE_DSP_PROFILE_MLP_TRUEHD | ||
| 380 | { | ||
| 381 | unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */ | ||
| 382 | } ATTRIBUTE_PACKED AE_DSP_PROFILE_MLP_TRUEHD; | ||
| 383 | |||
| 384 | /*! | ||
| 385 | * @brief DTS/DTS HD stream profile properties | ||
| 386 | */ | ||
| 387 | //! @todo add handling for it (currently never becomes set) | ||
| 388 | typedef struct AE_DSP_PROFILE_DTS_DTSHD | ||
| 389 | { | ||
| 390 | unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DTS* */ | ||
| 391 | bool bSurroundMatrix; /*!< if set to true given 2.0 stream is surround encoded */ | ||
| 392 | } ATTRIBUTE_PACKED AE_DSP_PROFILE_DTS_DTSHD; | ||
| 393 | |||
| 394 | union AE_DSP_PROFILE | ||
| 395 | { | ||
| 396 | AE_DSP_PROFILE_AC3_EAC3 ac3_eac3; /*!< Dolby Digital/Digital+ profile data */ | ||
| 397 | AE_DSP_PROFILE_MLP_TRUEHD mlp_truehd; /*!< MLP or Dolby TrueHD profile data */ | ||
| 398 | AE_DSP_PROFILE_DTS_DTSHD dts_dtshd; /*!< DTS/DTS-HD profile data */ | ||
| 399 | }; | ||
| 400 | //@} | ||
| 401 | |||
| 402 | /*! | ||
| 403 | * @brief Audio DSP stream properties | ||
| 404 | * Used to check for the DSP add-on that the stream is supported, | ||
| 405 | * as example Dolby Digital Ex processing is only required on Dolby Digital with 5.1 layout | ||
| 406 | */ | ||
| 407 | typedef struct AE_DSP_STREAM_PROPERTIES | ||
| 408 | { | ||
| 409 | AE_DSP_STREAM_ID iStreamID; /*!< @brief stream id of the audio stream packets */ | ||
| 410 | AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */ | ||
| 411 | int iBaseType; /*!< @brief the input stream base type source eg, Dolby Digital */ | ||
| 412 | const char* strName; /*!< @brief the audio stream name */ | ||
| 413 | const char* strCodecId; /*!< @brief codec id string of the audio stream */ | ||
| 414 | const char* strLanguage; /*!< @brief language id of the audio stream */ | ||
| 415 | int iIdentifier; /*!< @brief audio stream id inside player */ | ||
| 416 | int iChannels; /*!< @brief amount of basic channels */ | ||
| 417 | int iSampleRate; /*!< @brief sample rate */ | ||
| 418 | AE_DSP_PROFILE Profile; /*!< @brief current running stream profile data */ | ||
| 419 | } ATTRIBUTE_PACKED AE_DSP_STREAM_PROPERTIES; | ||
| 420 | |||
| 421 | /*! | ||
| 422 | * @brief Audio DSP mode categories | ||
| 423 | */ | ||
| 424 | typedef enum | ||
| 425 | { | ||
| 426 | AE_DSP_MODE_TYPE_UNDEFINED = -1, /*!< @brief undefined type, never be used from add-on! */ | ||
| 427 | AE_DSP_MODE_TYPE_INPUT_RESAMPLE = 0, /*!< @brief for input re sample */ | ||
| 428 | AE_DSP_MODE_TYPE_PRE_PROCESS = 1, /*!< @brief for preprocessing */ | ||
| 429 | AE_DSP_MODE_TYPE_MASTER_PROCESS = 2, /*!< @brief for master processing */ | ||
| 430 | AE_DSP_MODE_TYPE_POST_PROCESS = 3, /*!< @brief for post processing */ | ||
| 431 | AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE = 4, /*!< @brief for output re sample */ | ||
| 432 | AE_DSP_MODE_TYPE_MAX = 5 | ||
| 433 | } AE_DSP_MODE_TYPE; | ||
| 434 | |||
| 435 | /*! | ||
| 436 | * @brief Audio DSP master mode information | ||
| 437 | * Used to get all available modes for current input stream | ||
| 438 | */ | ||
| 439 | typedef struct AE_DSP_MODES | ||
| 440 | { | ||
| 441 | unsigned int iModesCount; /*!< @brief (required) count of how much modes are in AE_DSP_MODES */ | ||
| 442 | struct AE_DSP_MODE | ||
| 443 | { | ||
| 444 | int iUniqueDBModeId; /*!< @brief (required) the inside add-on used identifier for the mode, set by KODI's audio DSP database */ | ||
| 445 | AE_DSP_MODE_TYPE iModeType; /*!< @brief (required) the processong mode type, see AE_DSP_MODE_TYPE */ | ||
| 446 | char strModeName[AE_DSP_ADDON_STRING_LENGTH]; /*!< @brief (required) the addon name of the mode, used on KODI's logs */ | ||
| 447 | |||
| 448 | unsigned int iModeNumber; /*!< @brief (required) number of this mode on the add-on, is used on process functions with value "mode_id" */ | ||
| 449 | unsigned int iModeSupportTypeFlags; /*!< @brief (required) flags about supported input types for this mode, see AE_DSP_ASTREAM_PRESENT */ | ||
| 450 | bool bHasSettingsDialog; /*!< @brief (required) if setting dialog(s) are available it must be set to true */ | ||
| 451 | bool bIsDisabled; /*!< @brief (optional) true if this mode is marked as disabled and not enabled default, only relevant for master processes, all other types always disabled as default */ | ||
| 452 | |||
| 453 | unsigned int iModeName; /*!< @brief (required) the name id of the mode for this hook in g_localizeStrings */ | ||
| 454 | unsigned int iModeSetupName; /*!< @brief (optional) the name id of the mode inside settings for this hook in g_localizeStrings */ | ||
| 455 | unsigned int iModeDescription; /*!< @brief (optional) the description id of the mode for this hook in g_localizeStrings */ | ||
| 456 | unsigned int iModeHelp; /*!< @brief (optional) help string id for inside DSP settings dialog of the mode for this hook in g_localizeStrings */ | ||
| 457 | |||
| 458 | char strOwnModeImage[AE_DSP_ADDON_STRING_LENGTH]; /*!< @brief (optional) flag image for the mode */ | ||
| 459 | char strOverrideModeImage[AE_DSP_ADDON_STRING_LENGTH]; /*!< @brief (optional) image to override KODI Image for the mode, eg. Dolby Digital with Dolby Digital Ex (only used on master modes) */ | ||
| 460 | } mode[AE_DSP_STREAM_MAX_MODES]; /*!< @brief Modes array storage */ | ||
| 461 | } ATTRIBUTE_PACKED AE_DSP_MODES; | ||
| 462 | |||
| 463 | /*! | ||
| 464 | * @brief Audio DSP menu hook data | ||
| 465 | */ | ||
| 466 | typedef struct AE_DSP_MENUHOOK_DATA | ||
| 467 | { | ||
| 468 | AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) related menuhook data category */ | ||
| 469 | union data { | ||
| 470 | AE_DSP_STREAM_ID iStreamId; /*!< @brief currently only stream id is used, is used as union to have extension possibility */ | ||
| 471 | } data; /*!< @brief related category related data */ | ||
| 472 | } ATTRIBUTE_PACKED AE_DSP_MENUHOOK_DATA; | ||
| 473 | |||
| 474 | /*! | ||
| 475 | * @brief Structure to transfer the methods from kodi_audiodsp_dll.h to KODI | ||
| 476 | */ | ||
| 477 | struct AudioDSP | ||
| 478 | { | ||
| 479 | const char* (__cdecl* GetAudioDSPAPIVersion) (void); | ||
| 480 | const char* (__cdecl* GetMinimumAudioDSPAPIVersion) (void); | ||
| 481 | const char* (__cdecl* GetGUIAPIVersion) (void); | ||
| 482 | const char* (__cdecl* GetMinimumGUIAPIVersion) (void); | ||
| 483 | AE_DSP_ERROR (__cdecl* GetAddonCapabilities) (AE_DSP_ADDON_CAPABILITIES*); | ||
| 484 | const char* (__cdecl* GetDSPName) (void); | ||
| 485 | const char* (__cdecl* GetDSPVersion) (void); | ||
| 486 | AE_DSP_ERROR (__cdecl* MenuHook) (const AE_DSP_MENUHOOK&, const AE_DSP_MENUHOOK_DATA&); | ||
| 487 | |||
| 488 | AE_DSP_ERROR (__cdecl* StreamCreate) (const AE_DSP_SETTINGS*, const AE_DSP_STREAM_PROPERTIES*, ADDON_HANDLE); | ||
| 489 | AE_DSP_ERROR (__cdecl* StreamDestroy) (const ADDON_HANDLE); | ||
| 490 | AE_DSP_ERROR (__cdecl* StreamIsModeSupported) (const ADDON_HANDLE, AE_DSP_MODE_TYPE, unsigned int, int); | ||
| 491 | AE_DSP_ERROR (__cdecl* StreamInitialize) (const ADDON_HANDLE, const AE_DSP_SETTINGS*); | ||
| 492 | |||
| 493 | bool (__cdecl* InputProcess) (const ADDON_HANDLE, const float**, unsigned int); | ||
| 494 | |||
| 495 | unsigned int (__cdecl* InputResampleProcessNeededSamplesize) (const ADDON_HANDLE); | ||
| 496 | unsigned int (__cdecl* InputResampleProcess) (const ADDON_HANDLE, float**, float**, unsigned int); | ||
| 497 | float (__cdecl* InputResampleGetDelay) (const ADDON_HANDLE); | ||
| 498 | int (__cdecl* InputResampleSampleRate) (const ADDON_HANDLE); | ||
| 499 | |||
| 500 | unsigned int (__cdecl* PreProcessNeededSamplesize) (const ADDON_HANDLE, unsigned int); | ||
| 501 | float (__cdecl* PreProcessGetDelay) (const ADDON_HANDLE, unsigned int); | ||
| 502 | unsigned int (__cdecl* PreProcess) (const ADDON_HANDLE, unsigned int, float**, float**, unsigned int); | ||
| 503 | |||
| 504 | AE_DSP_ERROR (__cdecl* MasterProcessSetMode) (const ADDON_HANDLE, AE_DSP_STREAMTYPE, unsigned int, int); | ||
| 505 | unsigned int (__cdecl* MasterProcessNeededSamplesize) (const ADDON_HANDLE); | ||
| 506 | float (__cdecl* MasterProcessGetDelay) (const ADDON_HANDLE); | ||
| 507 | int (__cdecl* MasterProcessGetOutChannels) (const ADDON_HANDLE, unsigned long&); | ||
| 508 | unsigned int (__cdecl* MasterProcess) (const ADDON_HANDLE, float**, float**, unsigned int); | ||
| 509 | const char* (__cdecl* MasterProcessGetStreamInfoString) (const ADDON_HANDLE); | ||
| 510 | |||
| 511 | unsigned int (__cdecl* PostProcessNeededSamplesize) (const ADDON_HANDLE, unsigned int); | ||
| 512 | float (__cdecl* PostProcessGetDelay) (const ADDON_HANDLE, unsigned int); | ||
| 513 | unsigned int (__cdecl* PostProcess) (const ADDON_HANDLE, unsigned int, float**, float**, unsigned int); | ||
| 514 | |||
| 515 | unsigned int (__cdecl* OutputResampleProcessNeededSamplesize)(const ADDON_HANDLE); | ||
| 516 | unsigned int (__cdecl* OutputResampleProcess) (const ADDON_HANDLE, float**, float**, unsigned int); | ||
| 517 | float (__cdecl* OutputResampleGetDelay) (const ADDON_HANDLE); | ||
| 518 | int (__cdecl* OutputResampleSampleRate) (const ADDON_HANDLE); | ||
| 519 | }; | ||
| 520 | |||
| 521 | #ifdef __cplusplus | ||
| 522 | } | ||
| 523 | #endif | ||
| 524 | |||
diff --git a/xbmc/addons/include/kodi_audiodec_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h index 78bc3cc..78bc3cc 100644 --- a/xbmc/addons/include/kodi_audiodec_dll.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h | |||
diff --git a/xbmc/addons/include/kodi_audiodec_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h index 50c4cc4..82d71e5 100644 --- a/xbmc/addons/include/kodi_audiodec_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | #include <stdint.h> | 23 | #include <stdint.h> |
| 24 | #ifdef BUILD_KODI_ADDON | 24 | #ifdef BUILD_KODI_ADDON |
| 25 | #include "kodi/AEChannelData.h" | 25 | #include "AEChannelData.h" |
| 26 | #else | 26 | #else |
| 27 | #include "cores/AudioEngine/Utils/AEChannelData.h" | 27 | #include "cores/AudioEngine/Utils/AEChannelData.h" |
| 28 | #endif | 28 | #endif |
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h new file mode 100644 index 0000000..0402ace --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h | |||
| @@ -0,0 +1,165 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | /*! | ||
| 24 | * Common data structures shared between KODI and KODI's binary add-ons | ||
| 25 | */ | ||
| 26 | |||
| 27 | #ifdef BUILD_KODI_ADDON | ||
| 28 | #include "kodi/AudioEngine/AEChannelInfo.h" | ||
| 29 | #else | ||
| 30 | #include "cores/AudioEngine/Utils/AEChannelInfo.h" | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #ifdef TARGET_WINDOWS | ||
| 34 | #include <windows.h> | ||
| 35 | #else | ||
| 36 | #ifndef __cdecl | ||
| 37 | #define __cdecl | ||
| 38 | #endif | ||
| 39 | #ifndef __declspec | ||
| 40 | #define __declspec(X) | ||
| 41 | #endif | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #include <cstddef> | ||
| 45 | |||
| 46 | #undef ATTRIBUTE_PACKED | ||
| 47 | #undef PRAGMA_PACK_BEGIN | ||
| 48 | #undef PRAGMA_PACK_END | ||
| 49 | |||
| 50 | #if defined(__GNUC__) | ||
| 51 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | ||
| 52 | #define ATTRIBUTE_PACKED __attribute__ ((packed)) | ||
| 53 | #define PRAGMA_PACK 0 | ||
| 54 | #endif | ||
| 55 | #endif | ||
| 56 | |||
| 57 | #if !defined(ATTRIBUTE_PACKED) | ||
| 58 | #define ATTRIBUTE_PACKED | ||
| 59 | #define PRAGMA_PACK 1 | ||
| 60 | #endif | ||
| 61 | |||
| 62 | /* current Audio DSP API version */ | ||
| 63 | #define KODI_AUDIOENGINE_API_VERSION "0.0.1" | ||
| 64 | |||
| 65 | /* min. Audio DSP API version */ | ||
| 66 | #define KODI_AUDIOENGINE_MIN_API_VERSION "0.0.1" | ||
| 67 | |||
| 68 | |||
| 69 | #ifdef __cplusplus | ||
| 70 | extern "C" { | ||
| 71 | #endif | ||
| 72 | |||
| 73 | /** | ||
| 74 | * A stream handle pointer, which is only used internally by the addon stream handle | ||
| 75 | */ | ||
| 76 | typedef void AEStreamHandle; | ||
| 77 | |||
| 78 | /** | ||
| 79 | * The audio format structure that fully defines a stream's audio information | ||
| 80 | */ | ||
| 81 | typedef struct AudioEngineFormat | ||
| 82 | { | ||
| 83 | /** | ||
| 84 | * The stream's data format (eg, AE_FMT_S16LE) | ||
| 85 | */ | ||
| 86 | enum AEDataFormat m_dataFormat; | ||
| 87 | |||
| 88 | /** | ||
| 89 | * The stream's sample rate (eg, 48000) | ||
| 90 | */ | ||
| 91 | unsigned int m_sampleRate; | ||
| 92 | |||
| 93 | /** | ||
| 94 | * The encoded streams sample rate if a bitstream, otherwise undefined | ||
| 95 | */ | ||
| 96 | unsigned int m_encodedRate; | ||
| 97 | |||
| 98 | /** | ||
| 99 | * The amount of used speaker channels | ||
| 100 | */ | ||
| 101 | unsigned int m_channelCount; | ||
| 102 | |||
| 103 | /** | ||
| 104 | * The stream's channel layout | ||
| 105 | */ | ||
| 106 | enum AEChannel m_channels[AE_CH_MAX]; | ||
| 107 | |||
| 108 | /** | ||
| 109 | * The number of frames per period | ||
| 110 | */ | ||
| 111 | unsigned int m_frames; | ||
| 112 | |||
| 113 | /** | ||
| 114 | * The size of one frame in bytes | ||
| 115 | */ | ||
| 116 | unsigned int m_frameSize; | ||
| 117 | |||
| 118 | AudioEngineFormat() | ||
| 119 | { | ||
| 120 | m_dataFormat = AE_FMT_INVALID; | ||
| 121 | m_sampleRate = 0; | ||
| 122 | m_encodedRate = 0; | ||
| 123 | m_frames = 0; | ||
| 124 | m_frameSize = 0; | ||
| 125 | m_channelCount = 0; | ||
| 126 | |||
| 127 | for (unsigned int ch = 0; ch < AE_CH_MAX; ch++) | ||
| 128 | { | ||
| 129 | m_channels[ch] = AE_CH_NULL; | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 133 | bool compareFormat(const AudioEngineFormat *fmt) | ||
| 134 | { | ||
| 135 | if (!fmt) | ||
| 136 | { | ||
| 137 | return false; | ||
| 138 | } | ||
| 139 | |||
| 140 | if (m_dataFormat != fmt->m_dataFormat || | ||
| 141 | m_sampleRate != fmt->m_sampleRate || | ||
| 142 | m_encodedRate != fmt->m_encodedRate || | ||
| 143 | m_frames != fmt->m_frames || | ||
| 144 | m_frameSize != fmt->m_frameSize || | ||
| 145 | m_channelCount != fmt->m_channelCount) | ||
| 146 | { | ||
| 147 | return false; | ||
| 148 | } | ||
| 149 | |||
| 150 | for (unsigned int ch = 0; ch < AE_CH_MAX; ch++) | ||
| 151 | { | ||
| 152 | if (fmt->m_channels[ch] != m_channels[ch]) | ||
| 153 | { | ||
| 154 | return false; | ||
| 155 | } | ||
| 156 | } | ||
| 157 | |||
| 158 | return true; | ||
| 159 | } | ||
| 160 | } AudioEngineFormat; | ||
| 161 | |||
| 162 | #ifdef __cplusplus | ||
| 163 | } | ||
| 164 | #endif | ||
| 165 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h new file mode 100644 index 0000000..6ecf566 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h | |||
| @@ -0,0 +1,257 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2016 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include "kodi_inputstream_types.h" | ||
| 24 | #include "xbmc_addon_dll.h" | ||
| 25 | |||
| 26 | /*! | ||
| 27 | * Functions that the InputStream client add-on must implement, but some can be empty. | ||
| 28 | * | ||
| 29 | * The 'remarks' field indicates which methods should be implemented, and which ones are optional. | ||
| 30 | */ | ||
| 31 | |||
| 32 | extern "C" | ||
| 33 | { | ||
| 34 | /*! | ||
| 35 | * Open a stream. | ||
| 36 | * @param props | ||
| 37 | * @return True if the stream has been opened successfully, false otherwise. | ||
| 38 | * @remarks | ||
| 39 | */ | ||
| 40 | bool Open(INPUTSTREAM& props); | ||
| 41 | |||
| 42 | /*! | ||
| 43 | * Close an open stream. | ||
| 44 | * @remarks | ||
| 45 | */ | ||
| 46 | void Close(void); | ||
| 47 | |||
| 48 | /*! | ||
| 49 | * Get path/url for this addon. | ||
| 50 | * @remarks | ||
| 51 | */ | ||
| 52 | const char* GetPathList(void); | ||
| 53 | |||
| 54 | /*! | ||
| 55 | * Get Capabilities of this addon. | ||
| 56 | * @remarks | ||
| 57 | */ | ||
| 58 | struct INPUTSTREAM_CAPABILITIES GetCapabilities(); | ||
| 59 | |||
| 60 | |||
| 61 | /*! | ||
| 62 | * Get IDs of available streams | ||
| 63 | * @remarks | ||
| 64 | */ | ||
| 65 | INPUTSTREAM_IDS GetStreamIds(); | ||
| 66 | |||
| 67 | /*! | ||
| 68 | * Get stream properties of a stream. | ||
| 69 | * @param streamId unique id of stream | ||
| 70 | * @return struc of stream properties | ||
| 71 | * @remarks | ||
| 72 | */ | ||
| 73 | INPUTSTREAM_INFO GetStream(int streamid); | ||
| 74 | |||
| 75 | /*! | ||
| 76 | * Enable or disable a stream. | ||
| 77 | * A disabled stream does not send demux packets | ||
| 78 | * @param streamId unique id of stream | ||
| 79 | * @param enable true for enable, false for disable | ||
| 80 | * @remarks | ||
| 81 | */ | ||
| 82 | void EnableStream(int streamid, bool enable); | ||
| 83 | |||
| 84 | /*! | ||
| 85 | * Enables a stream at the given PTS. | ||
| 86 | * @param streamId unique id of stream | ||
| 87 | * @param pts position in stream in microseconds | ||
| 88 | * @remarks will only be called if CAPABILITIES::m_supportsEnableAtPTS is set to true | ||
| 89 | */ | ||
| 90 | void EnableStreamAtPTS(int streamid, uint64_t pts); | ||
| 91 | |||
| 92 | /*! | ||
| 93 | * Reset the demultiplexer in the add-on. | ||
| 94 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 95 | */ | ||
| 96 | void DemuxReset(void); | ||
| 97 | |||
| 98 | /*! | ||
| 99 | * Abort the demultiplexer thread in the add-on. | ||
| 100 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 101 | */ | ||
| 102 | void DemuxAbort(void); | ||
| 103 | |||
| 104 | /*! | ||
| 105 | * Flush all data that's currently in the demultiplexer buffer in the add-on. | ||
| 106 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 107 | */ | ||
| 108 | void DemuxFlush(void); | ||
| 109 | |||
| 110 | /*! | ||
| 111 | * Read the next packet from the demultiplexer, if there is one. | ||
| 112 | * @return The next packet. | ||
| 113 | * If there is no next packet, then the add-on should return the | ||
| 114 | * packet created by calling AllocateDemuxPacket(0) on the callback. | ||
| 115 | * If the stream changed and XBMC's player needs to be reinitialised, | ||
| 116 | * then, the add-on should call AllocateDemuxPacket(0) on the | ||
| 117 | * callback, and set the streamid to DMX_SPECIALID_STREAMCHANGE and | ||
| 118 | * return the value. | ||
| 119 | * The add-on should return NULL if an error occured. | ||
| 120 | * @remarks Return NULL if this add-on won't provide this function. | ||
| 121 | */ | ||
| 122 | DemuxPacket* DemuxRead(void); | ||
| 123 | |||
| 124 | /*! | ||
| 125 | * Notify the InputStream addon/demuxer that XBMC wishes to seek the stream by time | ||
| 126 | * Demuxer is required to set stream to an IDR frame | ||
| 127 | * @param time The absolute time since stream start | ||
| 128 | * @param backwards True to seek to keyframe BEFORE time, else AFTER | ||
| 129 | * @param startpts can be updated to point to where display should start | ||
| 130 | * @return True if the seek operation was possible | ||
| 131 | * @remarks Optional, and only used if addon has its own demuxer. | ||
| 132 | */ | ||
| 133 | bool DemuxSeekTime(int time, bool backwards, double *startpts); | ||
| 134 | |||
| 135 | /*! | ||
| 136 | * Notify the InputStream addon/demuxer that XBMC wishes to change playback speed | ||
| 137 | * @param speed The requested playback speed | ||
| 138 | * @remarks Optional, and only used if addon has its own demuxer. | ||
| 139 | */ | ||
| 140 | void DemuxSetSpeed(int speed); | ||
| 141 | |||
| 142 | |||
| 143 | /*! | ||
| 144 | * Totel time in ms | ||
| 145 | * @remarks | ||
| 146 | */ | ||
| 147 | int GetTotalTime(); | ||
| 148 | |||
| 149 | /*! | ||
| 150 | * Playing time in ms | ||
| 151 | * @remarks | ||
| 152 | */ | ||
| 153 | int GetTime(); | ||
| 154 | |||
| 155 | /*! | ||
| 156 | * Positions inputstream to playing time given in ms | ||
| 157 | * @remarks | ||
| 158 | */ | ||
| 159 | bool PosTime(int ms); | ||
| 160 | |||
| 161 | |||
| 162 | /*! | ||
| 163 | * Check if the backend support pausing the currently playing stream | ||
| 164 | * This will enable/disable the pause button in XBMC based on the return value | ||
| 165 | * @return false if the InputStream addon/backend does not support pausing, true if possible | ||
| 166 | */ | ||
| 167 | bool CanPauseStream(); | ||
| 168 | |||
| 169 | /*! | ||
| 170 | * Check if the backend supports seeking for the currently playing stream | ||
| 171 | * This will enable/disable the rewind/forward buttons in XBMC based on the return value | ||
| 172 | * @return false if the InputStream addon/backend does not support seeking, true if possible | ||
| 173 | */ | ||
| 174 | bool CanSeekStream(); | ||
| 175 | |||
| 176 | |||
| 177 | /*! | ||
| 178 | * Read from an open stream. | ||
| 179 | * @param pBuffer The buffer to store the data in. | ||
| 180 | * @param iBufferSize The amount of bytes to read. | ||
| 181 | * @return The amount of bytes that were actually read from the stream. | ||
| 182 | * @remarks Return -1 if this add-on won't provide this function. | ||
| 183 | */ | ||
| 184 | int ReadStream(uint8_t* pBuffer, unsigned int iBufferSize); | ||
| 185 | |||
| 186 | /*! | ||
| 187 | * Seek in a stream. | ||
| 188 | * @param iPosition The position to seek to. | ||
| 189 | * @param iWhence ? | ||
| 190 | * @return The new position. | ||
| 191 | * @remarks Return -1 if this add-on won't provide this function. | ||
| 192 | */ | ||
| 193 | int64_t SeekStream(int64_t iPosition, int iWhence = SEEK_SET); | ||
| 194 | |||
| 195 | /*! | ||
| 196 | * @return The position in the stream that's currently being read. | ||
| 197 | * @remarks Return -1 if this add-on won't provide this function. | ||
| 198 | */ | ||
| 199 | int64_t PositionStream(void); | ||
| 200 | |||
| 201 | /*! | ||
| 202 | * @return The total length of the stream that's currently being read. | ||
| 203 | * @remarks Return -1 if this add-on won't provide this function. | ||
| 204 | */ | ||
| 205 | int64_t LengthStream(void); | ||
| 206 | |||
| 207 | |||
| 208 | /*! | ||
| 209 | * @brief Notify the InputStream addon that XBMC (un)paused the currently playing stream | ||
| 210 | */ | ||
| 211 | void PauseStream(double time); | ||
| 212 | |||
| 213 | |||
| 214 | /*! | ||
| 215 | * Check for real-time streaming | ||
| 216 | * @return true if current stream is real-time | ||
| 217 | */ | ||
| 218 | bool IsRealTimeStream(); | ||
| 219 | |||
| 220 | /*! | ||
| 221 | * Called by XBMC to assign the function pointers of this add-on to pClient. | ||
| 222 | * @param pClient The struct to assign the function pointers to. | ||
| 223 | */ | ||
| 224 | void __declspec(dllexport) get_addon(struct InputStreamAddonFunctions* pClient) | ||
| 225 | { | ||
| 226 | pClient->Open = Open; | ||
| 227 | pClient->Close = Close; | ||
| 228 | pClient->GetPathList = GetPathList; | ||
| 229 | pClient->GetCapabilities = GetCapabilities; | ||
| 230 | |||
| 231 | pClient->GetStreamIds = GetStreamIds; | ||
| 232 | pClient->GetStream = GetStream; | ||
| 233 | pClient->EnableStream = EnableStream; | ||
| 234 | pClient->EnableStreamAtPTS = EnableStreamAtPTS; | ||
| 235 | pClient->DemuxReset = DemuxReset; | ||
| 236 | pClient->DemuxAbort = DemuxAbort; | ||
| 237 | pClient->DemuxFlush = DemuxFlush; | ||
| 238 | pClient->DemuxRead = DemuxRead; | ||
| 239 | pClient->DemuxSeekTime = DemuxSeekTime; | ||
| 240 | pClient->DemuxSetSpeed = DemuxSetSpeed; | ||
| 241 | |||
| 242 | pClient->GetTotalTime = GetTotalTime; | ||
| 243 | pClient->GetTime = GetTime; | ||
| 244 | |||
| 245 | pClient->PosTime = PosTime; | ||
| 246 | |||
| 247 | pClient->CanPauseStream = CanPauseStream; | ||
| 248 | pClient->CanSeekStream = CanSeekStream; | ||
| 249 | |||
| 250 | pClient->ReadStream = ReadStream; | ||
| 251 | pClient->SeekStream = SeekStream; | ||
| 252 | pClient->PositionStream = PositionStream; | ||
| 253 | pClient->LengthStream = LengthStream; | ||
| 254 | pClient->PauseStream = PauseStream; | ||
| 255 | pClient->IsRealTimeStream = IsRealTimeStream; | ||
| 256 | }; | ||
| 257 | }; | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h new file mode 100644 index 0000000..33741d8 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h | |||
| @@ -0,0 +1,161 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2016 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifndef __cdecl | ||
| 24 | #define __cdecl | ||
| 25 | #endif | ||
| 26 | |||
| 27 | #ifdef BUILD_KODI_ADDON | ||
| 28 | #include "DVDDemuxPacket.h" | ||
| 29 | #else | ||
| 30 | #include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h" | ||
| 31 | #endif | ||
| 32 | |||
| 33 | extern "C" { | ||
| 34 | |||
| 35 | // this are properties given to the addon on create | ||
| 36 | // at this time we have no parameters for the addon | ||
| 37 | typedef struct INPUTSTREAM_PROPS | ||
| 38 | { | ||
| 39 | int dummy; | ||
| 40 | } INPUTSTREAM_PROPS; | ||
| 41 | |||
| 42 | /*! | ||
| 43 | * @brief InputStream add-on capabilities. All capabilities are set to "false" as default. | ||
| 44 | */ | ||
| 45 | typedef struct INPUTSTREAM_CAPABILITIES | ||
| 46 | { | ||
| 47 | bool m_supportsIDemux; /*!< @brief supports interface IDemux */ | ||
| 48 | bool m_supportsIPosTime; /*!< @brief supports interface IPosTime */ | ||
| 49 | bool m_supportsIDisplayTime; /*!< @brief supports interface IDisplayTime */ | ||
| 50 | bool m_supportsSeek; /*!< @brief supports seek */ | ||
| 51 | bool m_supportsPause; /*!< @brief supports pause */ | ||
| 52 | bool m_supportsEnableAtPTS; /*!< @brief supports enabling streams at a given PTS time */ | ||
| 53 | } INPUTSTREAM_CAPABILITIES; | ||
| 54 | |||
| 55 | /*! | ||
| 56 | * @brief structure of key/value pairs passed to addon on Open() | ||
| 57 | */ | ||
| 58 | typedef struct INPUTSTREAM | ||
| 59 | { | ||
| 60 | static const unsigned int MAX_INFO_COUNT = 8; | ||
| 61 | |||
| 62 | const char *m_strURL; | ||
| 63 | |||
| 64 | unsigned int m_nCountInfoValues; | ||
| 65 | struct LISTITEMPROPERTY | ||
| 66 | { | ||
| 67 | const char *m_strKey; | ||
| 68 | const char *m_strValue; | ||
| 69 | } m_ListItemProperties[MAX_INFO_COUNT]; | ||
| 70 | } INPUTSTREAM; | ||
| 71 | |||
| 72 | /*! | ||
| 73 | * @brief Array of stream IDs | ||
| 74 | */ | ||
| 75 | typedef struct INPUTSTREAM_IDS | ||
| 76 | { | ||
| 77 | static const unsigned int MAX_STREAM_COUNT = 32; | ||
| 78 | unsigned int m_streamCount; | ||
| 79 | unsigned int m_streamIds[MAX_STREAM_COUNT]; | ||
| 80 | } INPUTSTREAM_IDS; | ||
| 81 | |||
| 82 | /*! | ||
| 83 | * @brief stream properties | ||
| 84 | */ | ||
| 85 | typedef struct INPUTSTREAM_INFO | ||
| 86 | { | ||
| 87 | enum STREAM_TYPE | ||
| 88 | { | ||
| 89 | TYPE_NONE, | ||
| 90 | TYPE_VIDEO, | ||
| 91 | TYPE_AUDIO, | ||
| 92 | TYPE_SUBTITLE, | ||
| 93 | TYPE_TELETEXT | ||
| 94 | } m_streamType; | ||
| 95 | |||
| 96 | char m_codecName[32]; /*!< @brief (required) name of codec according to ffmpeg */ | ||
| 97 | char m_codecInternalName[32]; /*!< @brief (optional) internal name of codec (selectionstream info) */ | ||
| 98 | unsigned int m_pID; /*!< @brief (required) physical index */ | ||
| 99 | unsigned int m_Bandwidth; /*!< @brief (optional) bandwidth of the stream (selectionstream info) */ | ||
| 100 | |||
| 101 | const uint8_t *m_ExtraData; | ||
| 102 | unsigned int m_ExtraSize; | ||
| 103 | |||
| 104 | char m_language[4]; /*!< @brief ISO 639 3-letter language code (empty string if undefined) */ | ||
| 105 | |||
| 106 | unsigned int m_FpsScale; /*!< @brief Scale of 1000 and a rate of 29970 will result in 29.97 fps */ | ||
| 107 | unsigned int m_FpsRate; | ||
| 108 | unsigned int m_Height; /*!< @brief height of the stream reported by the demuxer */ | ||
| 109 | unsigned int m_Width; /*!< @brief width of the stream reported by the demuxer */ | ||
| 110 | float m_Aspect; /*!< @brief display aspect of stream */ | ||
| 111 | |||
| 112 | unsigned int m_Channels; /*!< @brief (required) amount of channels */ | ||
| 113 | unsigned int m_SampleRate; /*!< @brief (required) sample rate */ | ||
| 114 | unsigned int m_BitRate; /*!< @brief (required) bit rate */ | ||
| 115 | unsigned int m_BitsPerSample; /*!< @brief (required) bits per sample */ | ||
| 116 | unsigned int m_BlockAlign; | ||
| 117 | } INPUTSTREAM_INFO; | ||
| 118 | |||
| 119 | /*! | ||
| 120 | * @brief Structure to transfer the methods from xbmc_inputstream_dll.h to XBMC | ||
| 121 | */ | ||
| 122 | typedef struct InputStreamAddonFunctions | ||
| 123 | { | ||
| 124 | bool (__cdecl* Open)(INPUTSTREAM&); | ||
| 125 | void (__cdecl* Close)(void); | ||
| 126 | const char* (__cdecl* GetPathList)(void); | ||
| 127 | struct INPUTSTREAM_CAPABILITIES (__cdecl* GetCapabilities)(void); | ||
| 128 | |||
| 129 | // IDemux | ||
| 130 | struct INPUTSTREAM_IDS (__cdecl* GetStreamIds)(); | ||
| 131 | struct INPUTSTREAM_INFO (__cdecl* GetStream)(int); | ||
| 132 | void (__cdecl* EnableStream)(int, bool); | ||
| 133 | void (__cdecl* EnableStreamAtPTS)(int, uint64_t); | ||
| 134 | void (__cdecl* DemuxReset)(void); | ||
| 135 | void (__cdecl* DemuxAbort)(void); | ||
| 136 | void (__cdecl* DemuxFlush)(void); | ||
| 137 | DemuxPacket* (__cdecl* DemuxRead)(void); | ||
| 138 | bool (__cdecl* DemuxSeekTime)(int, bool, double*); | ||
| 139 | void (__cdecl* DemuxSetSpeed)(int); | ||
| 140 | |||
| 141 | // IDisplayTime | ||
| 142 | int (__cdecl* GetTotalTime)(void); | ||
| 143 | int (__cdecl* GetTime)(void); | ||
| 144 | |||
| 145 | // IPosTime | ||
| 146 | bool (__cdecl* PosTime)(int); | ||
| 147 | |||
| 148 | // Seekable (mandatory) | ||
| 149 | bool (__cdecl* CanPauseStream)(void); | ||
| 150 | bool (__cdecl* CanSeekStream)(void); | ||
| 151 | |||
| 152 | int (__cdecl* ReadStream)(uint8_t*, unsigned int); | ||
| 153 | int64_t(__cdecl* SeekStream)(int64_t, int); | ||
| 154 | int64_t (__cdecl* PositionStream)(void); | ||
| 155 | int64_t (__cdecl* LengthStream)(void); | ||
| 156 | void (__cdecl* PauseStream)(double); | ||
| 157 | bool (__cdecl* IsRealTimeStream)(void); | ||
| 158 | } InputStreamAddonFunctions; | ||
| 159 | } | ||
| 160 | |||
| 161 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h new file mode 100644 index 0000000..46e34a6 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h | |||
| @@ -0,0 +1,232 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2014 Team KODI | ||
| 4 | * http://kodi.tv | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with KODI; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string> | ||
| 23 | #include <vector> | ||
| 24 | #include <string.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | #include <stdio.h> | ||
| 27 | #include "kodi_adsp_types.h" | ||
| 28 | #include "libXBMC_addon.h" | ||
| 29 | |||
| 30 | typedef void* ADSPHANDLE; | ||
| 31 | |||
| 32 | #ifdef _WIN32 | ||
| 33 | #define ADSP_HELPER_DLL "\\library.kodi.adsp\\libKODI_adsp" ADDON_HELPER_EXT | ||
| 34 | #else | ||
| 35 | #define ADSP_HELPER_DLL_NAME "libKODI_adsp-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 36 | #define ADSP_HELPER_DLL "/library.kodi.adsp/" ADSP_HELPER_DLL_NAME | ||
| 37 | #endif | ||
| 38 | |||
| 39 | class CAddonSoundPlay; | ||
| 40 | |||
| 41 | class CHelper_libKODI_adsp | ||
| 42 | { | ||
| 43 | public: | ||
| 44 | CHelper_libKODI_adsp(void) | ||
| 45 | { | ||
| 46 | m_libKODI_adsp = NULL; | ||
| 47 | m_Handle = NULL; | ||
| 48 | } | ||
| 49 | |||
| 50 | ~CHelper_libKODI_adsp(void) | ||
| 51 | { | ||
| 52 | if (m_libKODI_adsp) | ||
| 53 | { | ||
| 54 | ADSP_unregister_me(m_Handle, m_Callbacks); | ||
| 55 | dlclose(m_libKODI_adsp); | ||
| 56 | } | ||
| 57 | } | ||
| 58 | |||
| 59 | /*! | ||
| 60 | * @brief Resolve all callback methods | ||
| 61 | * @param handle Pointer to the add-on | ||
| 62 | * @return True when all methods were resolved, false otherwise. | ||
| 63 | */ | ||
| 64 | bool RegisterMe(void* handle) | ||
| 65 | { | ||
| 66 | m_Handle = handle; | ||
| 67 | |||
| 68 | std::string libBasePath; | ||
| 69 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 70 | libBasePath += ADSP_HELPER_DLL; | ||
| 71 | |||
| 72 | #if defined(ANDROID) | ||
| 73 | struct stat st; | ||
| 74 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 75 | { | ||
| 76 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 77 | libBasePath = tempbin + "/" + ADSP_HELPER_DLL_NAME; | ||
| 78 | } | ||
| 79 | #endif | ||
| 80 | |||
| 81 | m_libKODI_adsp = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 82 | if (m_libKODI_adsp == NULL) | ||
| 83 | { | ||
| 84 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 85 | return false; | ||
| 86 | } | ||
| 87 | |||
| 88 | ADSP_register_me = (void* (*)(void *HANDLE)) | ||
| 89 | dlsym(m_libKODI_adsp, "ADSP_register_me"); | ||
| 90 | if (ADSP_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 91 | |||
| 92 | ADSP_unregister_me = (void (*)(void* HANDLE, void* CB)) | ||
| 93 | dlsym(m_libKODI_adsp, "ADSP_unregister_me"); | ||
| 94 | if (ADSP_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 95 | |||
| 96 | ADSP_add_menu_hook = (void (*)(void* HANDLE, void* CB, AE_DSP_MENUHOOK *hook)) | ||
| 97 | dlsym(m_libKODI_adsp, "ADSP_add_menu_hook"); | ||
| 98 | if (ADSP_add_menu_hook == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 99 | |||
| 100 | ADSP_remove_menu_hook = (void (*)(void* HANDLE, void* CB, AE_DSP_MENUHOOK *hook)) | ||
| 101 | dlsym(m_libKODI_adsp, "ADSP_remove_menu_hook"); | ||
| 102 | if (ADSP_remove_menu_hook == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 103 | |||
| 104 | ADSP_register_mode = (void (*)(void *HANDLE, void* CB, AE_DSP_MODES::AE_DSP_MODE *modes)) | ||
| 105 | dlsym(m_libKODI_adsp, "ADSP_register_mode"); | ||
| 106 | if (ADSP_register_mode == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 107 | |||
| 108 | ADSP_unregister_mode = (void (*)(void* HANDLE, void* CB, AE_DSP_MODES::AE_DSP_MODE *modes)) | ||
| 109 | dlsym(m_libKODI_adsp, "ADSP_unregister_mode"); | ||
| 110 | if (ADSP_unregister_mode == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 111 | |||
| 112 | ADSP_get_sound_play = (CAddonSoundPlay* (*)(void *HANDLE, void *CB, const char *filename)) | ||
| 113 | dlsym(m_libKODI_adsp, "ADSP_get_sound_play"); | ||
| 114 | if (ADSP_get_sound_play == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 115 | |||
| 116 | ADSP_release_sound_play = (void (*)(CAddonSoundPlay* p)) | ||
| 117 | dlsym(m_libKODI_adsp, "ADSP_release_sound_play"); | ||
| 118 | if (ADSP_release_sound_play == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 119 | |||
| 120 | m_Callbacks = ADSP_register_me(m_Handle); | ||
| 121 | return m_Callbacks != NULL; | ||
| 122 | } | ||
| 123 | |||
| 124 | /*! | ||
| 125 | * @brief Add or replace a menu hook for the context menu for this add-on | ||
| 126 | * @param hook The hook to add | ||
| 127 | */ | ||
| 128 | void AddMenuHook(AE_DSP_MENUHOOK* hook) | ||
| 129 | { | ||
| 130 | return ADSP_add_menu_hook(m_Handle, m_Callbacks, hook); | ||
| 131 | } | ||
| 132 | |||
| 133 | /*! | ||
| 134 | * @brief Remove a menu hook for the context menu for this add-on | ||
| 135 | * @param hook The hook to remove | ||
| 136 | */ | ||
| 137 | void RemoveMenuHook(AE_DSP_MENUHOOK* hook) | ||
| 138 | { | ||
| 139 | return ADSP_remove_menu_hook(m_Handle, m_Callbacks, hook); | ||
| 140 | } | ||
| 141 | |||
| 142 | /*! | ||
| 143 | * @brief Add or replace master mode information inside audio dsp database. | ||
| 144 | * Becomes identifier written inside mode to iModeID if it was 0 (undefined) | ||
| 145 | * @param mode The master mode to add or update inside database | ||
| 146 | */ | ||
| 147 | void RegisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) | ||
| 148 | { | ||
| 149 | return ADSP_register_mode(m_Handle, m_Callbacks, mode); | ||
| 150 | } | ||
| 151 | |||
| 152 | /*! | ||
| 153 | * @brief Remove a master mode from audio dsp database | ||
| 154 | * @param mode The Mode to remove | ||
| 155 | */ | ||
| 156 | void UnregisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) | ||
| 157 | { | ||
| 158 | return ADSP_unregister_mode(m_Handle, m_Callbacks, mode); | ||
| 159 | } | ||
| 160 | |||
| 161 | /*! | ||
| 162 | * @brief Open a sound playing class | ||
| 163 | * @param filename The wav filename to open | ||
| 164 | */ | ||
| 165 | CAddonSoundPlay* GetSoundPlay(const char *filename) | ||
| 166 | { | ||
| 167 | return ADSP_get_sound_play(m_Handle, m_Callbacks, filename); | ||
| 168 | } | ||
| 169 | |||
| 170 | /*! | ||
| 171 | * @brief Remove a played file class | ||
| 172 | * @param p The playback to remove | ||
| 173 | */ | ||
| 174 | void ReleaseSoundPlay(CAddonSoundPlay* p) | ||
| 175 | { | ||
| 176 | return ADSP_release_sound_play(p); | ||
| 177 | } | ||
| 178 | |||
| 179 | protected: | ||
| 180 | void* (*ADSP_register_me)(void*); | ||
| 181 | |||
| 182 | void (*ADSP_unregister_me)(void*, void*); | ||
| 183 | void (*ADSP_add_menu_hook)(void*, void*, AE_DSP_MENUHOOK*); | ||
| 184 | void (*ADSP_remove_menu_hook)(void*, void*, AE_DSP_MENUHOOK*); | ||
| 185 | void (*ADSP_register_mode)(void*, void*, AE_DSP_MODES::AE_DSP_MODE*); | ||
| 186 | void (*ADSP_unregister_mode)(void*, void*, AE_DSP_MODES::AE_DSP_MODE*); | ||
| 187 | CAddonSoundPlay* (*ADSP_get_sound_play)(void*, void*, const char *); | ||
| 188 | void (*ADSP_release_sound_play)(CAddonSoundPlay*); | ||
| 189 | |||
| 190 | private: | ||
| 191 | void* m_libKODI_adsp; | ||
| 192 | void* m_Handle; | ||
| 193 | void* m_Callbacks; | ||
| 194 | struct cb_array | ||
| 195 | { | ||
| 196 | const char* libPath; | ||
| 197 | }; | ||
| 198 | }; | ||
| 199 | |||
| 200 | class CAddonSoundPlay | ||
| 201 | { | ||
| 202 | public: | ||
| 203 | CAddonSoundPlay(void *hdl, void *cb, const char *filename); | ||
| 204 | virtual ~CAddonSoundPlay(); | ||
| 205 | |||
| 206 | /*! play the sound this object represents */ | ||
| 207 | virtual void Play(); | ||
| 208 | |||
| 209 | /*! stop playing the sound this object represents */ | ||
| 210 | virtual void Stop(); | ||
| 211 | |||
| 212 | /*! return true if the sound is currently playing */ | ||
| 213 | virtual bool IsPlaying(); | ||
| 214 | |||
| 215 | /*! set the playback channel position of this sound, AE_DSP_CH_INVALID for all */ | ||
| 216 | virtual void SetChannel(AE_DSP_CHANNEL channel); | ||
| 217 | |||
| 218 | /*! get the current playback volume of this sound, AE_DSP_CH_INVALID for all */ | ||
| 219 | virtual AE_DSP_CHANNEL GetChannel(); | ||
| 220 | |||
| 221 | /*! set the playback volume of this sound */ | ||
| 222 | virtual void SetVolume(float volume); | ||
| 223 | |||
| 224 | /*! get the current playback volume of this sound */ | ||
| 225 | virtual float GetVolume(); | ||
| 226 | |||
| 227 | private: | ||
| 228 | std::string m_Filename; | ||
| 229 | void *m_Handle; | ||
| 230 | void *m_cb; | ||
| 231 | ADSPHANDLE m_PlayHandle; | ||
| 232 | }; | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h new file mode 100644 index 0000000..f541637 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h | |||
| @@ -0,0 +1,324 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2014 Team KODI | ||
| 4 | * http://kodi.tv | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with KODI; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <stdio.h> | ||
| 23 | #include <stdlib.h> | ||
| 24 | #include <string> | ||
| 25 | #include <string.h> | ||
| 26 | #include <vector> | ||
| 27 | |||
| 28 | #include "kodi_audioengine_types.h" | ||
| 29 | #ifdef BUILD_KODI_ADDON | ||
| 30 | #include "kodi/AudioEngine/AEChannelData.h" | ||
| 31 | #include "kodi/AudioEngine/AEChannelInfo.h" | ||
| 32 | #include "kodi/AudioEngine/AEStreamData.h" | ||
| 33 | #else | ||
| 34 | #include "cores/AudioEngine/Utils/AEChannelData.h" | ||
| 35 | #include "cores/AudioEngine/Utils/AEChannelInfo.h" | ||
| 36 | #include "cores/AudioEngine/Utils/AEStreamData.h" | ||
| 37 | #endif | ||
| 38 | |||
| 39 | #include "libXBMC_addon.h" | ||
| 40 | |||
| 41 | #ifdef _WIN32 | ||
| 42 | #define AUDIOENGINE_HELPER_DLL "\\library.kodi.audioengine\\libKODI_audioengine" ADDON_HELPER_EXT | ||
| 43 | #else | ||
| 44 | #define AUDIOENGINE_HELPER_DLL_NAME "libKODI_audioengine-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 45 | #define AUDIOENGINE_HELPER_DLL "/library.kodi.audioengine/" AUDIOENGINE_HELPER_DLL_NAME | ||
| 46 | #endif | ||
| 47 | |||
| 48 | class CAddonAEStream; | ||
| 49 | |||
| 50 | class CHelper_libKODI_audioengine | ||
| 51 | { | ||
| 52 | public: | ||
| 53 | CHelper_libKODI_audioengine(void) | ||
| 54 | { | ||
| 55 | m_libKODI_audioengine = NULL; | ||
| 56 | m_Handle = NULL; | ||
| 57 | } | ||
| 58 | |||
| 59 | ~CHelper_libKODI_audioengine(void) | ||
| 60 | { | ||
| 61 | if (m_libKODI_audioengine) | ||
| 62 | { | ||
| 63 | AudioEngine_unregister_me(m_Handle, m_Callbacks); | ||
| 64 | dlclose(m_libKODI_audioengine); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| 68 | /*! | ||
| 69 | * @brief Resolve all callback methods | ||
| 70 | * @param handle Pointer to the add-on | ||
| 71 | * @return True when all methods were resolved, false otherwise. | ||
| 72 | */ | ||
| 73 | bool RegisterMe(void* handle) | ||
| 74 | { | ||
| 75 | m_Handle = handle; | ||
| 76 | |||
| 77 | std::string libBasePath; | ||
| 78 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 79 | libBasePath += AUDIOENGINE_HELPER_DLL; | ||
| 80 | |||
| 81 | #if defined(ANDROID) | ||
| 82 | struct stat st; | ||
| 83 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 84 | { | ||
| 85 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 86 | libBasePath = tempbin + "/" + AUDIOENGINE_HELPER_DLL; | ||
| 87 | } | ||
| 88 | #endif | ||
| 89 | |||
| 90 | m_libKODI_audioengine = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 91 | if (m_libKODI_audioengine == NULL) | ||
| 92 | { | ||
| 93 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 94 | return false; | ||
| 95 | } | ||
| 96 | |||
| 97 | AudioEngine_register_me = (void* (*)(void *HANDLE)) | ||
| 98 | dlsym(m_libKODI_audioengine, "AudioEngine_register_me"); | ||
| 99 | if (AudioEngine_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 100 | |||
| 101 | AudioEngine_unregister_me = (void(*)(void* HANDLE, void* CB)) | ||
| 102 | dlsym(m_libKODI_audioengine, "AudioEngine_unregister_me"); | ||
| 103 | if (AudioEngine_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 104 | |||
| 105 | AudioEngine_MakeStream = (CAddonAEStream* (*)(void*, void*, AudioEngineFormat, unsigned int)) | ||
| 106 | dlsym(m_libKODI_audioengine, "AudioEngine_make_stream"); | ||
| 107 | if (AudioEngine_MakeStream == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 108 | |||
| 109 | AudioEngine_FreeStream = (void(*)(CAddonAEStream*)) | ||
| 110 | dlsym(m_libKODI_audioengine, "AudioEngine_free_stream"); | ||
| 111 | if (AudioEngine_FreeStream == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 112 | |||
| 113 | AudioEngine_GetCurrentSinkFormat = (bool(*)(void*, void*, AudioEngineFormat*)) | ||
| 114 | dlsym(m_libKODI_audioengine, "AudioEngine_get_current_sink_Format"); | ||
| 115 | if (AudioEngine_GetCurrentSinkFormat == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 116 | |||
| 117 | m_Callbacks = AudioEngine_register_me(m_Handle); | ||
| 118 | return m_Callbacks != NULL; | ||
| 119 | } | ||
| 120 | |||
| 121 | /** | ||
| 122 | * Creates and returns a new handle to an IAEStream in the format specified, this function should never fail | ||
| 123 | * @param DataFormat The data format the incoming audio will be in (eg, AE_FMT_S16LE) | ||
| 124 | * @param SampleRate The sample rate of the audio data (eg, 48000) | ||
| 125 | * @param ChannelLayout The order of the channels in the audio data | ||
| 126 | * @param Options A bit field of stream options (see: enum AEStreamOptions) | ||
| 127 | * @return a new Handle to an IAEStream that will accept data in the requested format | ||
| 128 | */ | ||
| 129 | CAddonAEStream* MakeStream(AudioEngineFormat Format, unsigned int Options = 0) | ||
| 130 | { | ||
| 131 | return AudioEngine_MakeStream(m_Handle, m_Callbacks, Format, Options); | ||
| 132 | } | ||
| 133 | |||
| 134 | /** | ||
| 135 | * This method will remove the specifyed stream from the engine. | ||
| 136 | * For OSX/IOS this is essential to reconfigure the audio output. | ||
| 137 | * @param stream The stream to be altered | ||
| 138 | * @return NULL | ||
| 139 | */ | ||
| 140 | void FreeStream(CAddonAEStream **Stream) | ||
| 141 | { | ||
| 142 | AudioEngine_FreeStream(*Stream); | ||
| 143 | *Stream = NULL; | ||
| 144 | } | ||
| 145 | |||
| 146 | /** | ||
| 147 | * Get the current sink data format | ||
| 148 | * | ||
| 149 | * @param Current sink data format. For more details see AudioEngineFormat. | ||
| 150 | * @return Returns true on success, else false. | ||
| 151 | */ | ||
| 152 | bool GetCurrentSinkFormat(AudioEngineFormat &SinkFormat) | ||
| 153 | { | ||
| 154 | return AudioEngine_GetCurrentSinkFormat(m_Handle, m_Callbacks, &SinkFormat); | ||
| 155 | } | ||
| 156 | |||
| 157 | protected: | ||
| 158 | void* (*AudioEngine_register_me)(void*); | ||
| 159 | void (*AudioEngine_unregister_me)(void*, void*); | ||
| 160 | CAddonAEStream* (*AudioEngine_MakeStream)(void*, void*, AudioEngineFormat, unsigned int); | ||
| 161 | bool (*AudioEngine_GetCurrentSinkFormat)(void*, void*, AudioEngineFormat *SinkFormat); | ||
| 162 | void (*AudioEngine_FreeStream)(CAddonAEStream*); | ||
| 163 | |||
| 164 | private: | ||
| 165 | void* m_libKODI_audioengine; | ||
| 166 | void* m_Handle; | ||
| 167 | void* m_Callbacks; | ||
| 168 | struct cb_array | ||
| 169 | { | ||
| 170 | const char* libPath; | ||
| 171 | }; | ||
| 172 | }; | ||
| 173 | |||
| 174 | // Audio Engine Stream Class | ||
| 175 | class CAddonAEStream | ||
| 176 | { | ||
| 177 | public: | ||
| 178 | CAddonAEStream(void *Addon, void *Callbacks, AEStreamHandle *StreamHandle); | ||
| 179 | virtual ~CAddonAEStream(); | ||
| 180 | |||
| 181 | /** | ||
| 182 | * Returns the amount of space available in the stream | ||
| 183 | * @return The number of bytes AddData will consume | ||
| 184 | */ | ||
| 185 | virtual unsigned int GetSpace(); | ||
| 186 | |||
| 187 | /** | ||
| 188 | * Add planar or interleaved PCM data to the stream | ||
| 189 | * @param Data array of pointers to the planes | ||
| 190 | * @param Offset to frame in frames | ||
| 191 | * @param Frames number of frames | ||
| 192 | * @return The number of frames consumed | ||
| 193 | */ | ||
| 194 | virtual unsigned int AddData(uint8_t* const *Data, unsigned int Offset, unsigned int Frames); | ||
| 195 | |||
| 196 | /** | ||
| 197 | * Returns the time in seconds that it will take | ||
| 198 | * for the next added packet to be heard from the speakers. | ||
| 199 | * @return seconds | ||
| 200 | */ | ||
| 201 | virtual double GetDelay(); | ||
| 202 | |||
| 203 | /** | ||
| 204 | * Returns if the stream is buffering | ||
| 205 | * @return True if the stream is buffering | ||
| 206 | */ | ||
| 207 | virtual bool IsBuffering(); | ||
| 208 | |||
| 209 | /** | ||
| 210 | * Returns the time in seconds that it will take | ||
| 211 | * to underrun the cache if no sample is added. | ||
| 212 | * @return seconds | ||
| 213 | */ | ||
| 214 | virtual double GetCacheTime(); | ||
| 215 | |||
| 216 | /** | ||
| 217 | * Returns the total time in seconds of the cache | ||
| 218 | * @return seconds | ||
| 219 | */ | ||
| 220 | virtual double GetCacheTotal(); | ||
| 221 | |||
| 222 | /** | ||
| 223 | * Pauses the stream playback | ||
| 224 | */ | ||
| 225 | virtual void Pause(); | ||
| 226 | |||
| 227 | /** | ||
| 228 | * Resumes the stream after pausing | ||
| 229 | */ | ||
| 230 | virtual void Resume(); | ||
| 231 | |||
| 232 | /** | ||
| 233 | * Start draining the stream | ||
| 234 | * @note Once called AddData will not consume more data. | ||
| 235 | */ | ||
| 236 | virtual void Drain(bool Wait); | ||
| 237 | |||
| 238 | /** | ||
| 239 | * Returns true if the is stream draining | ||
| 240 | */ | ||
| 241 | virtual bool IsDraining(); | ||
| 242 | |||
| 243 | /** | ||
| 244 | * Returns true if the is stream has finished draining | ||
| 245 | */ | ||
| 246 | virtual bool IsDrained(); | ||
| 247 | |||
| 248 | /** | ||
| 249 | * Flush all buffers dropping the audio data | ||
| 250 | */ | ||
| 251 | virtual void Flush(); | ||
| 252 | |||
| 253 | /** | ||
| 254 | * Return the stream's current volume level | ||
| 255 | * @return The volume level between 0.0 and 1.0 | ||
| 256 | */ | ||
| 257 | virtual float GetVolume(); | ||
| 258 | |||
| 259 | /** | ||
| 260 | * Set the stream's volume level | ||
| 261 | * @param volume The new volume level between 0.0 and 1.0 | ||
| 262 | */ | ||
| 263 | virtual void SetVolume(float Volume); | ||
| 264 | |||
| 265 | /** | ||
| 266 | * Gets the stream's volume amplification in linear units. | ||
| 267 | * @return The volume amplification factor between 1.0 and 1000.0 | ||
| 268 | */ | ||
| 269 | virtual float GetAmplification(); | ||
| 270 | |||
| 271 | /** | ||
| 272 | * Sets the stream's volume amplification in linear units. | ||
| 273 | * @param The volume amplification factor between 1.0 and 1000.0 | ||
| 274 | */ | ||
| 275 | virtual void SetAmplification(float Amplify); | ||
| 276 | |||
| 277 | /** | ||
| 278 | * Returns the size of one audio frame in bytes (channelCount * resolution) | ||
| 279 | * @return The size in bytes of one frame | ||
| 280 | */ | ||
| 281 | virtual const unsigned int GetFrameSize() const; | ||
| 282 | |||
| 283 | /** | ||
| 284 | * Returns the number of channels the stream is configured to accept | ||
| 285 | * @return The channel count | ||
| 286 | */ | ||
| 287 | virtual const unsigned int GetChannelCount() const; | ||
| 288 | |||
| 289 | /** | ||
| 290 | * 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() | ||
| 291 | * @return The stream's sample rate (eg, 48000) | ||
| 292 | */ | ||
| 293 | virtual const unsigned int GetSampleRate() const; | ||
| 294 | |||
| 295 | /** | ||
| 296 | * Return the data format the stream has been configured with | ||
| 297 | * @return The stream's data format (eg, AE_FMT_S16LE) | ||
| 298 | */ | ||
| 299 | virtual const AEDataFormat GetDataFormat() const; | ||
| 300 | |||
| 301 | /** | ||
| 302 | * Return the resample ratio | ||
| 303 | * @note This will return an undefined value if the stream is not resampling | ||
| 304 | * @return the current resample ratio or undefined if the stream is not resampling | ||
| 305 | */ | ||
| 306 | virtual double GetResampleRatio(); | ||
| 307 | |||
| 308 | /** | ||
| 309 | * Sets the resample ratio | ||
| 310 | * @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 | ||
| 311 | * @param ratio the new sample rate ratio, calculated by ((double)desiredRate / (double)GetSampleRate()) | ||
| 312 | */ | ||
| 313 | virtual void SetResampleRatio(double Ratio); | ||
| 314 | |||
| 315 | /** | ||
| 316 | * Sginal a clock change | ||
| 317 | */ | ||
| 318 | virtual void Discontinuity(); | ||
| 319 | |||
| 320 | private: | ||
| 321 | AEStreamHandle *m_StreamHandle; | ||
| 322 | void *m_Callbacks; | ||
| 323 | void *m_AddonHandle; | ||
| 324 | }; | ||
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 new file mode 100644 index 0000000..bdaeb4c --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h | |||
| @@ -0,0 +1,845 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string> | ||
| 23 | #include <vector> | ||
| 24 | #include <string.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | #include <stdio.h> | ||
| 27 | #include "libXBMC_addon.h" | ||
| 28 | |||
| 29 | typedef void* GUIHANDLE; | ||
| 30 | |||
| 31 | #ifdef _WIN32 | ||
| 32 | #define GUI_HELPER_DLL "\\library.kodi.guilib\\libKODI_guilib" ADDON_HELPER_EXT | ||
| 33 | #else | ||
| 34 | #define GUI_HELPER_DLL_NAME "libKODI_guilib-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 35 | #define GUI_HELPER_DLL "/library.kodi.guilib/" GUI_HELPER_DLL_NAME | ||
| 36 | #endif | ||
| 37 | |||
| 38 | /* current ADDONGUI API version */ | ||
| 39 | #define KODI_GUILIB_API_VERSION "5.11.0" | ||
| 40 | |||
| 41 | /* min. ADDONGUI API version */ | ||
| 42 | #define KODI_GUILIB_MIN_API_VERSION "5.10.0" | ||
| 43 | |||
| 44 | #define ADDON_ACTION_PREVIOUS_MENU 10 | ||
| 45 | #define ADDON_ACTION_CLOSE_DIALOG 51 | ||
| 46 | #define ADDON_ACTION_NAV_BACK 92 | ||
| 47 | |||
| 48 | class CAddonGUIWindow; | ||
| 49 | class CAddonGUISpinControl; | ||
| 50 | class CAddonGUIRadioButton; | ||
| 51 | class CAddonGUIProgressControl; | ||
| 52 | class CAddonListItem; | ||
| 53 | class CAddonGUIRenderingControl; | ||
| 54 | class CAddonGUISliderControl; | ||
| 55 | class CAddonGUISettingsSliderControl; | ||
| 56 | |||
| 57 | class CHelper_libKODI_guilib | ||
| 58 | { | ||
| 59 | public: | ||
| 60 | CHelper_libKODI_guilib() | ||
| 61 | { | ||
| 62 | m_libKODI_guilib = NULL; | ||
| 63 | m_Handle = NULL; | ||
| 64 | } | ||
| 65 | |||
| 66 | ~CHelper_libKODI_guilib() | ||
| 67 | { | ||
| 68 | if (m_libKODI_guilib) | ||
| 69 | { | ||
| 70 | GUI_unregister_me(m_Handle, m_Callbacks); | ||
| 71 | dlclose(m_libKODI_guilib); | ||
| 72 | } | ||
| 73 | } | ||
| 74 | |||
| 75 | bool RegisterMe(void *Handle) | ||
| 76 | { | ||
| 77 | m_Handle = Handle; | ||
| 78 | |||
| 79 | std::string libBasePath; | ||
| 80 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 81 | libBasePath += GUI_HELPER_DLL; | ||
| 82 | |||
| 83 | #if defined(ANDROID) | ||
| 84 | struct stat st; | ||
| 85 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 86 | { | ||
| 87 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 88 | libBasePath = tempbin + "/" + GUI_HELPER_DLL_NAME; | ||
| 89 | } | ||
| 90 | #endif | ||
| 91 | |||
| 92 | m_libKODI_guilib = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 93 | if (m_libKODI_guilib == NULL) | ||
| 94 | { | ||
| 95 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 96 | return false; | ||
| 97 | } | ||
| 98 | |||
| 99 | GUI_register_me = (void* (*)(void *HANDLE)) | ||
| 100 | dlsym(m_libKODI_guilib, "GUI_register_me"); | ||
| 101 | if (GUI_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 102 | |||
| 103 | GUI_unregister_me = (void (*)(void *HANDLE, void *CB)) | ||
| 104 | dlsym(m_libKODI_guilib, "GUI_unregister_me"); | ||
| 105 | if (GUI_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 106 | |||
| 107 | GUI_lock = (void (*)(void *HANDLE, void *CB)) | ||
| 108 | dlsym(m_libKODI_guilib, "GUI_lock"); | ||
| 109 | if (GUI_lock == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 110 | |||
| 111 | GUI_unlock = (void (*)(void *HANDLE, void *CB)) | ||
| 112 | dlsym(m_libKODI_guilib, "GUI_unlock"); | ||
| 113 | if (GUI_unlock == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 114 | |||
| 115 | GUI_get_screen_height = (int (*)(void *HANDLE, void *CB)) | ||
| 116 | dlsym(m_libKODI_guilib, "GUI_get_screen_height"); | ||
| 117 | if (GUI_get_screen_height == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 118 | |||
| 119 | GUI_get_screen_width = (int (*)(void *HANDLE, void *CB)) | ||
| 120 | dlsym(m_libKODI_guilib, "GUI_get_screen_width"); | ||
| 121 | if (GUI_get_screen_width == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 122 | |||
| 123 | GUI_get_video_resolution = (int (*)(void *HANDLE, void *CB)) | ||
| 124 | dlsym(m_libKODI_guilib, "GUI_get_video_resolution"); | ||
| 125 | if (GUI_get_video_resolution == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 126 | |||
| 127 | GUI_Window_create = (CAddonGUIWindow* (*)(void *HANDLE, void *CB, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog)) | ||
| 128 | dlsym(m_libKODI_guilib, "GUI_Window_create"); | ||
| 129 | if (GUI_Window_create == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 130 | |||
| 131 | GUI_Window_destroy = (void (*)(CAddonGUIWindow* p)) | ||
| 132 | dlsym(m_libKODI_guilib, "GUI_Window_destroy"); | ||
| 133 | if (GUI_Window_destroy == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 134 | |||
| 135 | GUI_control_get_spin = (CAddonGUISpinControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) | ||
| 136 | dlsym(m_libKODI_guilib, "GUI_control_get_spin"); | ||
| 137 | if (GUI_control_get_spin == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 138 | |||
| 139 | GUI_control_release_spin = (void (*)(CAddonGUISpinControl* p)) | ||
| 140 | dlsym(m_libKODI_guilib, "GUI_control_release_spin"); | ||
| 141 | if (GUI_control_release_spin == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 142 | |||
| 143 | GUI_control_get_radiobutton = (CAddonGUIRadioButton* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) | ||
| 144 | dlsym(m_libKODI_guilib, "GUI_control_get_radiobutton"); | ||
| 145 | if (GUI_control_get_radiobutton == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 146 | |||
| 147 | GUI_control_release_radiobutton = (void (*)(CAddonGUIRadioButton* p)) | ||
| 148 | dlsym(m_libKODI_guilib, "GUI_control_release_radiobutton"); | ||
| 149 | if (GUI_control_release_radiobutton == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 150 | |||
| 151 | GUI_control_get_progress = (CAddonGUIProgressControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) | ||
| 152 | dlsym(m_libKODI_guilib, "GUI_control_get_progress"); | ||
| 153 | if (GUI_control_get_progress == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 154 | |||
| 155 | GUI_control_release_progress = (void (*)(CAddonGUIProgressControl* p)) | ||
| 156 | dlsym(m_libKODI_guilib, "GUI_control_release_progress"); | ||
| 157 | if (GUI_control_release_progress == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 158 | |||
| 159 | GUI_ListItem_create = (CAddonListItem* (*)(void *HANDLE, void *CB, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path)) | ||
| 160 | dlsym(m_libKODI_guilib, "GUI_ListItem_create"); | ||
| 161 | if (GUI_ListItem_create == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 162 | |||
| 163 | GUI_ListItem_destroy = (void (*)(CAddonListItem* p)) | ||
| 164 | dlsym(m_libKODI_guilib, "GUI_ListItem_destroy"); | ||
| 165 | if (GUI_ListItem_destroy == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 166 | |||
| 167 | GUI_control_get_rendering = (CAddonGUIRenderingControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) | ||
| 168 | dlsym(m_libKODI_guilib, "GUI_control_get_rendering"); | ||
| 169 | if (GUI_control_get_rendering == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 170 | |||
| 171 | GUI_control_release_rendering = (void (*)(CAddonGUIRenderingControl* p)) | ||
| 172 | dlsym(m_libKODI_guilib, "GUI_control_release_rendering"); | ||
| 173 | if (GUI_control_release_rendering == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 174 | |||
| 175 | GUI_control_get_slider = (CAddonGUISliderControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) | ||
| 176 | dlsym(m_libKODI_guilib, "GUI_control_get_slider"); | ||
| 177 | if (GUI_control_get_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 178 | |||
| 179 | GUI_control_release_slider = (void (*)(CAddonGUISliderControl* p)) | ||
| 180 | dlsym(m_libKODI_guilib, "GUI_control_release_slider"); | ||
| 181 | if (GUI_control_release_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 182 | |||
| 183 | GUI_control_get_settings_slider = (CAddonGUISettingsSliderControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) | ||
| 184 | dlsym(m_libKODI_guilib, "GUI_control_get_settings_slider"); | ||
| 185 | if (GUI_control_get_settings_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 186 | |||
| 187 | GUI_control_release_settings_slider = (void (*)(CAddonGUISettingsSliderControl* p)) | ||
| 188 | dlsym(m_libKODI_guilib, "GUI_control_release_settings_slider"); | ||
| 189 | if (GUI_control_release_settings_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 190 | |||
| 191 | GUI_dialog_keyboard_show_and_get_input_with_head = (bool (*)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs)) | ||
| 192 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_input_with_head"); | ||
| 193 | if (GUI_dialog_keyboard_show_and_get_input_with_head == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 194 | |||
| 195 | GUI_dialog_keyboard_show_and_get_input = (bool (*)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs)) | ||
| 196 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_input"); | ||
| 197 | if (GUI_dialog_keyboard_show_and_get_input == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 198 | |||
| 199 | GUI_dialog_keyboard_show_and_get_new_password_with_head = (bool (*)(void *HANDLE, void *CB, char &newPassword, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, unsigned int autoCloseMs)) | ||
| 200 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_new_password_with_head"); | ||
| 201 | if (GUI_dialog_keyboard_show_and_get_new_password_with_head == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 202 | |||
| 203 | GUI_dialog_keyboard_show_and_get_new_password = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs)) | ||
| 204 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_new_password"); | ||
| 205 | if (GUI_dialog_keyboard_show_and_get_new_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 206 | |||
| 207 | GUI_dialog_keyboard_show_and_verify_new_password_with_head = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, unsigned int autoCloseMs)) | ||
| 208 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_verify_new_password_with_head"); | ||
| 209 | if (GUI_dialog_keyboard_show_and_verify_new_password_with_head == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 210 | |||
| 211 | GUI_dialog_keyboard_show_and_verify_new_password = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs)) | ||
| 212 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_verify_new_password"); | ||
| 213 | if (GUI_dialog_keyboard_show_and_verify_new_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 214 | |||
| 215 | GUI_dialog_keyboard_show_and_verify_password = (int (*)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs)) | ||
| 216 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_verify_password"); | ||
| 217 | if (GUI_dialog_keyboard_show_and_verify_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 218 | |||
| 219 | GUI_dialog_keyboard_show_and_get_filter = (bool (*)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs)) | ||
| 220 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_filter"); | ||
| 221 | if (GUI_dialog_keyboard_show_and_get_filter == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 222 | |||
| 223 | GUI_dialog_keyboard_send_text_to_active_keyboard = (bool (*)(void *HANDLE, void *CB, const char *aTextString, bool closeKeyboard)) | ||
| 224 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_send_text_to_active_keyboard"); | ||
| 225 | if (GUI_dialog_keyboard_send_text_to_active_keyboard == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 226 | |||
| 227 | GUI_dialog_keyboard_is_activated = (bool (*)(void *HANDLE, void *CB)) | ||
| 228 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_is_activated"); | ||
| 229 | if (GUI_dialog_keyboard_is_activated == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 230 | |||
| 231 | GUI_dialog_numeric_show_and_verify_new_password = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize)) | ||
| 232 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_verify_new_password"); | ||
| 233 | if (GUI_dialog_numeric_show_and_verify_new_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 234 | |||
| 235 | GUI_dialog_numeric_show_and_verify_password = (int (*)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries)) | ||
| 236 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_verify_password"); | ||
| 237 | if (GUI_dialog_numeric_show_and_verify_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 238 | |||
| 239 | GUI_dialog_numeric_show_and_verify_input = (bool (*)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput)) | ||
| 240 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_verify_input"); | ||
| 241 | if (GUI_dialog_numeric_show_and_verify_input == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 242 | |||
| 243 | GUI_dialog_numeric_show_and_get_time = (bool (*)(void *HANDLE, void *CB, tm &time, const char *strHeading)) | ||
| 244 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_time"); | ||
| 245 | if (GUI_dialog_numeric_show_and_get_time == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 246 | |||
| 247 | GUI_dialog_numeric_show_and_get_date = (bool (*)(void *HANDLE, void *CB, tm &date, const char *strHeading)) | ||
| 248 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_date"); | ||
| 249 | if (GUI_dialog_numeric_show_and_get_date == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 250 | |||
| 251 | GUI_dialog_numeric_show_and_get_ipaddress = (bool (*)(void *HANDLE, void *CB, char &IPAddress, unsigned int iMaxStringSize, const char *strHeading)) | ||
| 252 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_ipaddress"); | ||
| 253 | if (GUI_dialog_numeric_show_and_get_ipaddress == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 254 | |||
| 255 | GUI_dialog_numeric_show_and_get_number = (bool (*)(void *HANDLE, void *CB, char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs)) | ||
| 256 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_number"); | ||
| 257 | if (GUI_dialog_numeric_show_and_get_number == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 258 | |||
| 259 | GUI_dialog_numeric_show_and_get_seconds = (bool (*)(void *HANDLE, void *CB, char &strTime, unsigned int iMaxStringSize, const char *strHeading)) | ||
| 260 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_seconds"); | ||
| 261 | if (GUI_dialog_numeric_show_and_get_seconds == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 262 | |||
| 263 | GUI_dialog_filebrowser_show_and_get_file = (bool (*)(void *HANDLE, void *CB, const char *directory, const char *mask, const char *heading, char &path, unsigned int iMaxStringSize, bool useThumbs, bool useFileDirectories, bool singleList)) | ||
| 264 | dlsym(m_libKODI_guilib, "GUI_dialog_filebrowser_show_and_get_file"); | ||
| 265 | if (GUI_dialog_filebrowser_show_and_get_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 266 | |||
| 267 | GUI_dialog_ok_show_and_get_input_single_text = (void (*)(void *HANDLE, void *CB, const char *heading, const char *text)) | ||
| 268 | dlsym(m_libKODI_guilib, "GUI_dialog_ok_show_and_get_input_single_text"); | ||
| 269 | if (GUI_dialog_ok_show_and_get_input_single_text == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 270 | |||
| 271 | GUI_dialog_ok_show_and_get_input_line_text = (void (*)(void *HANDLE, void *CB, const char *heading, const char *line0, const char *line1, const char *line2)) | ||
| 272 | dlsym(m_libKODI_guilib, "GUI_dialog_ok_show_and_get_input_line_text"); | ||
| 273 | if (GUI_dialog_ok_show_and_get_input_line_text == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 274 | |||
| 275 | GUI_dialog_yesno_show_and_get_input_singletext = (bool (*)(void *HANDLE, void *CB, const char *heading, const char *text, bool& bCanceled, const char *noLabel, const char *yesLabel)) | ||
| 276 | dlsym(m_libKODI_guilib, "GUI_dialog_yesno_show_and_get_input_singletext"); | ||
| 277 | if (GUI_dialog_yesno_show_and_get_input_singletext == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 278 | |||
| 279 | GUI_dialog_yesno_show_and_get_input_linetext = (bool (*)(void *HANDLE, void *CB, const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel, const char *yesLabel)) | ||
| 280 | dlsym(m_libKODI_guilib, "GUI_dialog_yesno_show_and_get_input_linetext"); | ||
| 281 | if (GUI_dialog_yesno_show_and_get_input_linetext == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 282 | |||
| 283 | GUI_dialog_yesno_show_and_get_input_linebuttontext = (bool (*)(void *HANDLE, void *CB, const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel, const char *yesLabel)) | ||
| 284 | dlsym(m_libKODI_guilib, "GUI_dialog_yesno_show_and_get_input_linebuttontext"); | ||
| 285 | if (GUI_dialog_yesno_show_and_get_input_linebuttontext == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 286 | |||
| 287 | GUI_dialog_text_viewer = (void (*)(void *hdl, void *cb, const char *heading, const char *text)) | ||
| 288 | dlsym(m_libKODI_guilib, "GUI_dialog_text_viewer"); | ||
| 289 | if (GUI_dialog_text_viewer == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 290 | |||
| 291 | GUI_dialog_select = (int (*)(void *hdl, void *cb, const char *heading, const char *entries[], unsigned int size, int selected)) | ||
| 292 | dlsym(m_libKODI_guilib, "GUI_dialog_select"); | ||
| 293 | if (GUI_dialog_select == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 294 | |||
| 295 | m_Callbacks = GUI_register_me(m_Handle); | ||
| 296 | return m_Callbacks != NULL; | ||
| 297 | } | ||
| 298 | |||
| 299 | void Lock() | ||
| 300 | { | ||
| 301 | return GUI_lock(m_Handle, m_Callbacks); | ||
| 302 | } | ||
| 303 | |||
| 304 | void Unlock() | ||
| 305 | { | ||
| 306 | return GUI_unlock(m_Handle, m_Callbacks); | ||
| 307 | } | ||
| 308 | |||
| 309 | int GetScreenHeight() | ||
| 310 | { | ||
| 311 | return GUI_get_screen_height(m_Handle, m_Callbacks); | ||
| 312 | } | ||
| 313 | |||
| 314 | int GetScreenWidth() | ||
| 315 | { | ||
| 316 | return GUI_get_screen_width(m_Handle, m_Callbacks); | ||
| 317 | } | ||
| 318 | |||
| 319 | int GetVideoResolution() | ||
| 320 | { | ||
| 321 | return GUI_get_video_resolution(m_Handle, m_Callbacks); | ||
| 322 | } | ||
| 323 | |||
| 324 | CAddonGUIWindow* Window_create(const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog) | ||
| 325 | { | ||
| 326 | return GUI_Window_create(m_Handle, m_Callbacks, xmlFilename, defaultSkin, forceFallback, asDialog); | ||
| 327 | } | ||
| 328 | |||
| 329 | void Window_destroy(CAddonGUIWindow* p) | ||
| 330 | { | ||
| 331 | return GUI_Window_destroy(p); | ||
| 332 | } | ||
| 333 | |||
| 334 | CAddonGUISpinControl* Control_getSpin(CAddonGUIWindow *window, int controlId) | ||
| 335 | { | ||
| 336 | return GUI_control_get_spin(m_Handle, m_Callbacks, window, controlId); | ||
| 337 | } | ||
| 338 | |||
| 339 | void Control_releaseSpin(CAddonGUISpinControl* p) | ||
| 340 | { | ||
| 341 | return GUI_control_release_spin(p); | ||
| 342 | } | ||
| 343 | |||
| 344 | CAddonGUIRadioButton* Control_getRadioButton(CAddonGUIWindow *window, int controlId) | ||
| 345 | { | ||
| 346 | return GUI_control_get_radiobutton(m_Handle, m_Callbacks, window, controlId); | ||
| 347 | } | ||
| 348 | |||
| 349 | void Control_releaseRadioButton(CAddonGUIRadioButton* p) | ||
| 350 | { | ||
| 351 | return GUI_control_release_radiobutton(p); | ||
| 352 | } | ||
| 353 | |||
| 354 | CAddonGUIProgressControl* Control_getProgress(CAddonGUIWindow *window, int controlId) | ||
| 355 | { | ||
| 356 | return GUI_control_get_progress(m_Handle, m_Callbacks, window, controlId); | ||
| 357 | } | ||
| 358 | |||
| 359 | void Control_releaseProgress(CAddonGUIProgressControl* p) | ||
| 360 | { | ||
| 361 | return GUI_control_release_progress(p); | ||
| 362 | } | ||
| 363 | |||
| 364 | CAddonListItem* ListItem_create(const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path) | ||
| 365 | { | ||
| 366 | return GUI_ListItem_create(m_Handle, m_Callbacks, label, label2, iconImage, thumbnailImage, path); | ||
| 367 | } | ||
| 368 | |||
| 369 | void ListItem_destroy(CAddonListItem* p) | ||
| 370 | { | ||
| 371 | return GUI_ListItem_destroy(p); | ||
| 372 | } | ||
| 373 | |||
| 374 | CAddonGUIRenderingControl* Control_getRendering(CAddonGUIWindow *window, int controlId) | ||
| 375 | { | ||
| 376 | return GUI_control_get_rendering(m_Handle, m_Callbacks, window, controlId); | ||
| 377 | } | ||
| 378 | |||
| 379 | void Control_releaseRendering(CAddonGUIRenderingControl* p) | ||
| 380 | { | ||
| 381 | return GUI_control_release_rendering(p); | ||
| 382 | } | ||
| 383 | |||
| 384 | CAddonGUISliderControl* Control_getSlider(CAddonGUIWindow *window, int controlId) | ||
| 385 | { | ||
| 386 | return GUI_control_get_slider(m_Handle, m_Callbacks, window, controlId); | ||
| 387 | } | ||
| 388 | |||
| 389 | void Control_releaseSlider(CAddonGUISliderControl* p) | ||
| 390 | { | ||
| 391 | return GUI_control_release_slider(p); | ||
| 392 | } | ||
| 393 | |||
| 394 | CAddonGUISettingsSliderControl* Control_getSettingsSlider(CAddonGUIWindow *window, int controlId) | ||
| 395 | { | ||
| 396 | return GUI_control_get_settings_slider(m_Handle, m_Callbacks, window, controlId); | ||
| 397 | } | ||
| 398 | |||
| 399 | void Control_releaseSettingsSlider(CAddonGUISettingsSliderControl* p) | ||
| 400 | { | ||
| 401 | return GUI_control_release_settings_slider(p); | ||
| 402 | } | ||
| 403 | |||
| 404 | /*! @name GUI Keyboard functions */ | ||
| 405 | //@{ | ||
| 406 | bool Dialog_Keyboard_ShowAndGetInput(char &strText, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs = 0) | ||
| 407 | { | ||
| 408 | return GUI_dialog_keyboard_show_and_get_input_with_head(m_Handle, m_Callbacks, strText, iMaxStringSize, strHeading, allowEmptyResult, hiddenInput, autoCloseMs); | ||
| 409 | } | ||
| 410 | |||
| 411 | bool Dialog_Keyboard_ShowAndGetInput(char &strText, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs = 0) | ||
| 412 | { | ||
| 413 | return GUI_dialog_keyboard_show_and_get_input(m_Handle, m_Callbacks, strText, iMaxStringSize, allowEmptyResult, autoCloseMs); | ||
| 414 | } | ||
| 415 | |||
| 416 | bool Dialog_Keyboard_ShowAndGetNewPassword(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs = 0) | ||
| 417 | { | ||
| 418 | return GUI_dialog_keyboard_show_and_get_new_password_with_head(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs); | ||
| 419 | } | ||
| 420 | |||
| 421 | bool Dialog_Keyboard_ShowAndGetNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs = 0) | ||
| 422 | { | ||
| 423 | return GUI_dialog_keyboard_show_and_get_new_password(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, autoCloseMs); | ||
| 424 | } | ||
| 425 | |||
| 426 | bool Dialog_Keyboard_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs = 0) | ||
| 427 | { | ||
| 428 | return GUI_dialog_keyboard_show_and_verify_new_password_with_head(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs); | ||
| 429 | } | ||
| 430 | |||
| 431 | bool Dialog_Keyboard_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs = 0) | ||
| 432 | { | ||
| 433 | return GUI_dialog_keyboard_show_and_verify_new_password(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, autoCloseMs); | ||
| 434 | } | ||
| 435 | |||
| 436 | int Dialog_Keyboard_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs = 0) | ||
| 437 | { | ||
| 438 | return GUI_dialog_keyboard_show_and_verify_password(m_Handle, m_Callbacks, strPassword, iMaxStringSize, strHeading, iRetries, autoCloseMs); | ||
| 439 | } | ||
| 440 | |||
| 441 | bool Dialog_Keyboard_ShowAndGetFilter(char &strText, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs = 0) | ||
| 442 | { | ||
| 443 | return GUI_dialog_keyboard_show_and_get_filter(m_Handle, m_Callbacks, strText, iMaxStringSize, searching, autoCloseMs); | ||
| 444 | } | ||
| 445 | |||
| 446 | bool Dialog_Keyboard_SendTextToActiveKeyboard(const char *aTextString, bool closeKeyboard = false) | ||
| 447 | { | ||
| 448 | return GUI_dialog_keyboard_send_text_to_active_keyboard(m_Handle, m_Callbacks, aTextString, closeKeyboard); | ||
| 449 | } | ||
| 450 | |||
| 451 | bool Dialog_Keyboard_isKeyboardActivated() | ||
| 452 | { | ||
| 453 | return GUI_dialog_keyboard_is_activated(m_Handle, m_Callbacks); | ||
| 454 | } | ||
| 455 | //@} | ||
| 456 | |||
| 457 | /*! @name GUI Numeric functions */ | ||
| 458 | //@{ | ||
| 459 | bool Dialog_Numeric_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize) | ||
| 460 | { | ||
| 461 | return GUI_dialog_numeric_show_and_verify_new_password(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize); | ||
| 462 | } | ||
| 463 | |||
| 464 | int Dialog_Numeric_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries) | ||
| 465 | { | ||
| 466 | return GUI_dialog_numeric_show_and_verify_password(m_Handle, m_Callbacks, strPassword, iMaxStringSize, strHeading, iRetries); | ||
| 467 | } | ||
| 468 | |||
| 469 | bool Dialog_Numeric_ShowAndVerifyInput(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput) | ||
| 470 | { | ||
| 471 | return GUI_dialog_numeric_show_and_verify_input(m_Handle, m_Callbacks, strPassword, iMaxStringSize, strHeading, bGetUserInput); | ||
| 472 | } | ||
| 473 | |||
| 474 | bool Dialog_Numeric_ShowAndGetTime(tm &time, const char *strHeading) | ||
| 475 | { | ||
| 476 | return GUI_dialog_numeric_show_and_get_time(m_Handle, m_Callbacks, time, strHeading); | ||
| 477 | } | ||
| 478 | |||
| 479 | bool Dialog_Numeric_ShowAndGetDate(tm &date, const char *strHeading) | ||
| 480 | { | ||
| 481 | return GUI_dialog_numeric_show_and_get_date(m_Handle, m_Callbacks, date, strHeading); | ||
| 482 | } | ||
| 483 | |||
| 484 | bool Dialog_Numeric_ShowAndGetIPAddress(char &strIPAddress, unsigned int iMaxStringSize, const char *strHeading) | ||
| 485 | { | ||
| 486 | return GUI_dialog_numeric_show_and_get_ipaddress(m_Handle, m_Callbacks, strIPAddress, iMaxStringSize, strHeading); | ||
| 487 | } | ||
| 488 | |||
| 489 | bool Dialog_Numeric_ShowAndGetNumber(char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs = 0) | ||
| 490 | { | ||
| 491 | return GUI_dialog_numeric_show_and_get_number(m_Handle, m_Callbacks, strInput, iMaxStringSize, strHeading, iAutoCloseTimeoutMs); | ||
| 492 | } | ||
| 493 | |||
| 494 | bool Dialog_Numeric_ShowAndGetSeconds(char &strTime, unsigned int iMaxStringSize, const char *strHeading) | ||
| 495 | { | ||
| 496 | return GUI_dialog_numeric_show_and_get_seconds(m_Handle, m_Callbacks, strTime, iMaxStringSize, strHeading); | ||
| 497 | } | ||
| 498 | //@} | ||
| 499 | |||
| 500 | /*! @name GUI File browser functions */ | ||
| 501 | //@{ | ||
| 502 | bool Dialog_FileBrowser_ShowAndGetFile(const char *directory, const char *mask, const char *heading, char &strPath, unsigned int iMaxStringSize, bool useThumbs = false, bool useFileDirectories = false, bool singleList = false) | ||
| 503 | { | ||
| 504 | return GUI_dialog_filebrowser_show_and_get_file(m_Handle, m_Callbacks, directory, mask, heading, strPath, iMaxStringSize, useThumbs, useFileDirectories, singleList); | ||
| 505 | } | ||
| 506 | //@} | ||
| 507 | |||
| 508 | /*! @name GUI OK Dialog functions */ | ||
| 509 | //@{ | ||
| 510 | void Dialog_OK_ShowAndGetInput(const char *heading, const char *text) | ||
| 511 | { | ||
| 512 | GUI_dialog_ok_show_and_get_input_single_text(m_Handle, m_Callbacks, heading, text); | ||
| 513 | } | ||
| 514 | |||
| 515 | void Dialog_OK_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2) | ||
| 516 | { | ||
| 517 | GUI_dialog_ok_show_and_get_input_line_text(m_Handle, m_Callbacks, heading, line0, line1, line2); | ||
| 518 | } | ||
| 519 | //@} | ||
| 520 | |||
| 521 | /*! @name GUI Yes No Dialog functions */ | ||
| 522 | //@{ | ||
| 523 | bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *text, bool& bCanceled, const char *noLabel = "", const char *yesLabel = "") | ||
| 524 | { | ||
| 525 | return GUI_dialog_yesno_show_and_get_input_singletext(m_Handle, m_Callbacks, heading, text, bCanceled, noLabel, yesLabel); | ||
| 526 | } | ||
| 527 | |||
| 528 | bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel = "", const char *yesLabel = "") | ||
| 529 | { | ||
| 530 | return GUI_dialog_yesno_show_and_get_input_linetext(m_Handle, m_Callbacks, heading, line0, line1, line2, noLabel, yesLabel); | ||
| 531 | } | ||
| 532 | |||
| 533 | bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel = "", const char *yesLabel = "") | ||
| 534 | { | ||
| 535 | return GUI_dialog_yesno_show_and_get_input_linebuttontext(m_Handle, m_Callbacks, heading, line0, line1, line2, bCanceled, noLabel, yesLabel); | ||
| 536 | } | ||
| 537 | //@} | ||
| 538 | |||
| 539 | /*! @name GUI Text viewer Dialog */ | ||
| 540 | //@{ | ||
| 541 | void Dialog_TextViewer(const char *heading, const char *text) | ||
| 542 | { | ||
| 543 | return GUI_dialog_text_viewer(m_Handle, m_Callbacks, heading, text); | ||
| 544 | } | ||
| 545 | //@} | ||
| 546 | |||
| 547 | /*! @name GUI select Dialog */ | ||
| 548 | //@{ | ||
| 549 | int Dialog_Select(const char *heading, const char *entries[], unsigned int size, int selected = -1) | ||
| 550 | { | ||
| 551 | return GUI_dialog_select(m_Handle, m_Callbacks, heading, entries, size, selected); | ||
| 552 | } | ||
| 553 | //@} | ||
| 554 | |||
| 555 | protected: | ||
| 556 | void* (*GUI_register_me)(void *HANDLE); | ||
| 557 | void (*GUI_unregister_me)(void *HANDLE, void* CB); | ||
| 558 | void (*GUI_lock)(void *HANDLE, void* CB); | ||
| 559 | void (*GUI_unlock)(void *HANDLE, void* CB); | ||
| 560 | int (*GUI_get_screen_height)(void *HANDLE, void* CB); | ||
| 561 | int (*GUI_get_screen_width)(void *HANDLE, void* CB); | ||
| 562 | int (*GUI_get_video_resolution)(void *HANDLE, void* CB); | ||
| 563 | CAddonGUIWindow* (*GUI_Window_create)(void *HANDLE, void* CB, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog); | ||
| 564 | void (*GUI_Window_destroy)(CAddonGUIWindow* p); | ||
| 565 | CAddonGUISpinControl* (*GUI_control_get_spin)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); | ||
| 566 | void (*GUI_control_release_spin)(CAddonGUISpinControl* p); | ||
| 567 | CAddonGUIRadioButton* (*GUI_control_get_radiobutton)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); | ||
| 568 | void (*GUI_control_release_radiobutton)(CAddonGUIRadioButton* p); | ||
| 569 | CAddonGUIProgressControl* (*GUI_control_get_progress)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); | ||
| 570 | void (*GUI_control_release_progress)(CAddonGUIProgressControl* p); | ||
| 571 | CAddonListItem* (*GUI_ListItem_create)(void *HANDLE, void* CB, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path); | ||
| 572 | void (*GUI_ListItem_destroy)(CAddonListItem* p); | ||
| 573 | CAddonGUIRenderingControl* (*GUI_control_get_rendering)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); | ||
| 574 | void (*GUI_control_release_rendering)(CAddonGUIRenderingControl* p); | ||
| 575 | CAddonGUISliderControl* (*GUI_control_get_slider)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); | ||
| 576 | void (*GUI_control_release_slider)(CAddonGUISliderControl* p); | ||
| 577 | CAddonGUISettingsSliderControl* (*GUI_control_get_settings_slider)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); | ||
| 578 | void (*GUI_control_release_settings_slider)(CAddonGUISettingsSliderControl* p); | ||
| 579 | bool (*GUI_dialog_keyboard_show_and_get_input_with_head)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs); | ||
| 580 | bool (*GUI_dialog_keyboard_show_and_get_input)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs); | ||
| 581 | bool (*GUI_dialog_keyboard_show_and_get_new_password_with_head)(void *HANDLE, void *CB, char &newPassword, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, unsigned int autoCloseMs); | ||
| 582 | bool (*GUI_dialog_keyboard_show_and_get_new_password)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs); | ||
| 583 | bool (*GUI_dialog_keyboard_show_and_verify_new_password_with_head)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, unsigned int autoCloseMs); | ||
| 584 | bool (*GUI_dialog_keyboard_show_and_verify_new_password)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs); | ||
| 585 | int (*GUI_dialog_keyboard_show_and_verify_password)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs); | ||
| 586 | bool (*GUI_dialog_keyboard_show_and_get_filter)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs); | ||
| 587 | bool (*GUI_dialog_keyboard_send_text_to_active_keyboard)(void *HANDLE, void *CB, const char *aTextString, bool closeKeyboard); | ||
| 588 | bool (*GUI_dialog_keyboard_is_activated)(void *HANDLE, void *CB); | ||
| 589 | bool (*GUI_dialog_numeric_show_and_verify_new_password)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize); | ||
| 590 | int (*GUI_dialog_numeric_show_and_verify_password)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries); | ||
| 591 | bool (*GUI_dialog_numeric_show_and_verify_input)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput); | ||
| 592 | bool (*GUI_dialog_numeric_show_and_get_time)(void *HANDLE, void *CB, tm &time, const char *strHeading); | ||
| 593 | bool (*GUI_dialog_numeric_show_and_get_date)(void *HANDLE, void *CB, tm &date, const char *strHeading); | ||
| 594 | bool (*GUI_dialog_numeric_show_and_get_ipaddress)(void *HANDLE, void *CB, char &IPAddress, unsigned int iMaxStringSize, const char *strHeading); | ||
| 595 | bool (*GUI_dialog_numeric_show_and_get_number)(void *HANDLE, void *CB, char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs); | ||
| 596 | bool (*GUI_dialog_numeric_show_and_get_seconds)(void *HANDLE, void *CB, char &strTime, unsigned int iMaxStringSize, const char *strHeading); | ||
| 597 | bool (*GUI_dialog_filebrowser_show_and_get_file)(void *HANDLE, void *CB, const char *directory, const char *mask, const char *heading, char &path, unsigned int iMaxStringSize, bool useThumbs, bool useFileDirectories, bool singleList); | ||
| 598 | void (*GUI_dialog_ok_show_and_get_input_single_text)(void *HANDLE, void *CB, const char *heading, const char *text); | ||
| 599 | void (*GUI_dialog_ok_show_and_get_input_line_text)(void *HANDLE, void *CB, const char *heading, const char *line0, const char *line1, const char *line2); | ||
| 600 | bool (*GUI_dialog_yesno_show_and_get_input_singletext)(void *HANDLE, void *CB, const char *heading, const char *text, bool& bCanceled, const char *noLabel, const char *yesLabel); | ||
| 601 | bool (*GUI_dialog_yesno_show_and_get_input_linetext)(void *HANDLE, void *CB, const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel, const char *yesLabel); | ||
| 602 | bool (*GUI_dialog_yesno_show_and_get_input_linebuttontext)(void *HANDLE, void *CB, const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel, const char *yesLabel); | ||
| 603 | void (*GUI_dialog_text_viewer)(void *hdl, void *cb, const char *heading, const char *text); | ||
| 604 | int (*GUI_dialog_select)(void *hdl, void *cb, const char *heading, const char *entries[], unsigned int size, int selected); | ||
| 605 | |||
| 606 | private: | ||
| 607 | void *m_libKODI_guilib; | ||
| 608 | void *m_Handle; | ||
| 609 | void *m_Callbacks; | ||
| 610 | struct cb_array | ||
| 611 | { | ||
| 612 | const char* libPath; | ||
| 613 | }; | ||
| 614 | }; | ||
| 615 | |||
| 616 | class CAddonGUISpinControl | ||
| 617 | { | ||
| 618 | public: | ||
| 619 | CAddonGUISpinControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); | ||
| 620 | virtual ~CAddonGUISpinControl(void) {} | ||
| 621 | |||
| 622 | virtual void SetVisible(bool yesNo); | ||
| 623 | virtual void SetText(const char *label); | ||
| 624 | virtual void Clear(); | ||
| 625 | virtual void AddLabel(const char *label, int iValue); | ||
| 626 | virtual int GetValue(); | ||
| 627 | virtual void SetValue(int iValue); | ||
| 628 | |||
| 629 | private: | ||
| 630 | CAddonGUIWindow *m_Window; | ||
| 631 | int m_ControlId; | ||
| 632 | GUIHANDLE m_SpinHandle; | ||
| 633 | void *m_Handle; | ||
| 634 | void *m_cb; | ||
| 635 | }; | ||
| 636 | |||
| 637 | class CAddonGUIRadioButton | ||
| 638 | { | ||
| 639 | public: | ||
| 640 | CAddonGUIRadioButton(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); | ||
| 641 | virtual ~CAddonGUIRadioButton() {} | ||
| 642 | |||
| 643 | virtual void SetVisible(bool yesNo); | ||
| 644 | virtual void SetText(const char *label); | ||
| 645 | virtual void SetSelected(bool yesNo); | ||
| 646 | virtual bool IsSelected(); | ||
| 647 | |||
| 648 | private: | ||
| 649 | CAddonGUIWindow *m_Window; | ||
| 650 | int m_ControlId; | ||
| 651 | GUIHANDLE m_ButtonHandle; | ||
| 652 | void *m_Handle; | ||
| 653 | void *m_cb; | ||
| 654 | }; | ||
| 655 | |||
| 656 | class CAddonGUIProgressControl | ||
| 657 | { | ||
| 658 | public: | ||
| 659 | CAddonGUIProgressControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); | ||
| 660 | virtual ~CAddonGUIProgressControl(void) {} | ||
| 661 | |||
| 662 | virtual void SetPercentage(float fPercent); | ||
| 663 | virtual float GetPercentage() const; | ||
| 664 | virtual void SetInfo(int iInfo); | ||
| 665 | virtual int GetInfo() const; | ||
| 666 | virtual std::string GetDescription() const; | ||
| 667 | |||
| 668 | private: | ||
| 669 | CAddonGUIWindow *m_Window; | ||
| 670 | int m_ControlId; | ||
| 671 | GUIHANDLE m_ProgressHandle; | ||
| 672 | void *m_Handle; | ||
| 673 | void *m_cb; | ||
| 674 | }; | ||
| 675 | |||
| 676 | class CAddonGUISliderControl | ||
| 677 | { | ||
| 678 | public: | ||
| 679 | CAddonGUISliderControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); | ||
| 680 | virtual ~CAddonGUISliderControl(void) {} | ||
| 681 | |||
| 682 | virtual void SetVisible(bool yesNo); | ||
| 683 | virtual std::string GetDescription() const; | ||
| 684 | |||
| 685 | virtual void SetIntRange(int iStart, int iEnd); | ||
| 686 | virtual void SetIntValue(int iValue); | ||
| 687 | virtual int GetIntValue() const; | ||
| 688 | virtual void SetIntInterval(int iInterval); | ||
| 689 | |||
| 690 | virtual void SetPercentage(float fPercent); | ||
| 691 | virtual float GetPercentage() const; | ||
| 692 | |||
| 693 | virtual void SetFloatRange(float fStart, float fEnd); | ||
| 694 | virtual void SetFloatValue(float fValue); | ||
| 695 | virtual float GetFloatValue() const; | ||
| 696 | virtual void SetFloatInterval(float fInterval); | ||
| 697 | |||
| 698 | private: | ||
| 699 | CAddonGUIWindow *m_Window; | ||
| 700 | int m_ControlId; | ||
| 701 | GUIHANDLE m_SliderHandle; | ||
| 702 | void *m_Handle; | ||
| 703 | void *m_cb; | ||
| 704 | }; | ||
| 705 | |||
| 706 | class CAddonGUISettingsSliderControl | ||
| 707 | { | ||
| 708 | public: | ||
| 709 | CAddonGUISettingsSliderControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); | ||
| 710 | virtual ~CAddonGUISettingsSliderControl(void) {} | ||
| 711 | |||
| 712 | virtual void SetVisible(bool yesNo); | ||
| 713 | virtual void SetText(const char *label); | ||
| 714 | virtual std::string GetDescription() const; | ||
| 715 | |||
| 716 | virtual void SetIntRange(int iStart, int iEnd); | ||
| 717 | virtual void SetIntValue(int iValue); | ||
| 718 | virtual int GetIntValue() const; | ||
| 719 | virtual void SetIntInterval(int iInterval); | ||
| 720 | |||
| 721 | virtual void SetPercentage(float fPercent); | ||
| 722 | virtual float GetPercentage() const; | ||
| 723 | |||
| 724 | virtual void SetFloatRange(float fStart, float fEnd); | ||
| 725 | virtual void SetFloatValue(float fValue); | ||
| 726 | virtual float GetFloatValue() const; | ||
| 727 | virtual void SetFloatInterval(float fInterval); | ||
| 728 | |||
| 729 | private: | ||
| 730 | CAddonGUIWindow *m_Window; | ||
| 731 | int m_ControlId; | ||
| 732 | GUIHANDLE m_SettingsSliderHandle; | ||
| 733 | void *m_Handle; | ||
| 734 | void *m_cb; | ||
| 735 | }; | ||
| 736 | |||
| 737 | class CAddonListItem | ||
| 738 | { | ||
| 739 | friend class CAddonGUIWindow; | ||
| 740 | |||
| 741 | public: | ||
| 742 | CAddonListItem(void *hdl, void *cb, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path); | ||
| 743 | virtual ~CAddonListItem(void) {} | ||
| 744 | |||
| 745 | virtual const char *GetLabel(); | ||
| 746 | virtual void SetLabel(const char *label); | ||
| 747 | virtual const char *GetLabel2(); | ||
| 748 | virtual void SetLabel2(const char *label); | ||
| 749 | virtual void SetIconImage(const char *image); | ||
| 750 | virtual void SetThumbnailImage(const char *image); | ||
| 751 | virtual void SetInfo(const char *Info); | ||
| 752 | virtual void SetProperty(const char *key, const char *value); | ||
| 753 | virtual const char *GetProperty(const char *key) const; | ||
| 754 | virtual void SetPath(const char *Path); | ||
| 755 | |||
| 756 | // {(char*)"select(); | ||
| 757 | // {(char*)"isSelected(); | ||
| 758 | protected: | ||
| 759 | GUIHANDLE m_ListItemHandle; | ||
| 760 | void *m_Handle; | ||
| 761 | void *m_cb; | ||
| 762 | }; | ||
| 763 | |||
| 764 | class CAddonGUIWindow | ||
| 765 | { | ||
| 766 | friend class CAddonGUISpinControl; | ||
| 767 | friend class CAddonGUIRadioButton; | ||
| 768 | friend class CAddonGUIProgressControl; | ||
| 769 | friend class CAddonGUIRenderingControl; | ||
| 770 | friend class CAddonGUISliderControl; | ||
| 771 | friend class CAddonGUISettingsSliderControl; | ||
| 772 | |||
| 773 | public: | ||
| 774 | CAddonGUIWindow(void *hdl, void *cb, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog); | ||
| 775 | virtual ~CAddonGUIWindow(); | ||
| 776 | |||
| 777 | virtual bool Show(); | ||
| 778 | virtual void Close(); | ||
| 779 | virtual void DoModal(); | ||
| 780 | virtual bool SetFocusId(int iControlId); | ||
| 781 | virtual int GetFocusId(); | ||
| 782 | virtual bool SetCoordinateResolution(int res); | ||
| 783 | virtual void SetProperty(const char *key, const char *value); | ||
| 784 | virtual void SetPropertyInt(const char *key, int value); | ||
| 785 | virtual void SetPropertyBool(const char *key, bool value); | ||
| 786 | virtual void SetPropertyDouble(const char *key, double value); | ||
| 787 | virtual const char *GetProperty(const char *key) const; | ||
| 788 | virtual int GetPropertyInt(const char *key) const; | ||
| 789 | virtual bool GetPropertyBool(const char *key) const; | ||
| 790 | virtual double GetPropertyDouble(const char *key) const; | ||
| 791 | virtual void ClearProperties(); | ||
| 792 | virtual int GetListSize(); | ||
| 793 | virtual void ClearList(); | ||
| 794 | virtual GUIHANDLE AddStringItem(const char *name, int itemPosition = -1); | ||
| 795 | virtual void AddItem(GUIHANDLE item, int itemPosition = -1); | ||
| 796 | virtual void AddItem(CAddonListItem *item, int itemPosition = -1); | ||
| 797 | virtual void RemoveItem(int itemPosition); | ||
| 798 | virtual GUIHANDLE GetListItem(int listPos); | ||
| 799 | virtual void SetCurrentListPosition(int listPos); | ||
| 800 | virtual int GetCurrentListPosition(); | ||
| 801 | virtual void SetControlLabel(int controlId, const char *label); | ||
| 802 | virtual void MarkDirtyRegion(); | ||
| 803 | |||
| 804 | virtual bool OnClick(int controlId); | ||
| 805 | virtual bool OnFocus(int controlId); | ||
| 806 | virtual bool OnInit(); | ||
| 807 | virtual bool OnAction(int actionId); | ||
| 808 | |||
| 809 | GUIHANDLE m_cbhdl; | ||
| 810 | bool (*CBOnInit)(GUIHANDLE cbhdl); | ||
| 811 | bool (*CBOnFocus)(GUIHANDLE cbhdl, int controlId); | ||
| 812 | bool (*CBOnClick)(GUIHANDLE cbhdl, int controlId); | ||
| 813 | bool (*CBOnAction)(GUIHANDLE cbhdl, int actionId); | ||
| 814 | |||
| 815 | protected: | ||
| 816 | GUIHANDLE m_WindowHandle; | ||
| 817 | void *m_Handle; | ||
| 818 | void *m_cb; | ||
| 819 | }; | ||
| 820 | |||
| 821 | class CAddonGUIRenderingControl | ||
| 822 | { | ||
| 823 | public: | ||
| 824 | CAddonGUIRenderingControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); | ||
| 825 | virtual ~CAddonGUIRenderingControl(); | ||
| 826 | virtual void Init(); | ||
| 827 | |||
| 828 | virtual bool Create(int x, int y, int w, int h, void *device); | ||
| 829 | virtual void Render(); | ||
| 830 | virtual void Stop(); | ||
| 831 | virtual bool Dirty(); | ||
| 832 | |||
| 833 | GUIHANDLE m_cbhdl; | ||
| 834 | bool (*CBCreate)(GUIHANDLE cbhdl, int x, int y, int w, int h, void *device); | ||
| 835 | void (*CBRender)(GUIHANDLE cbhdl); | ||
| 836 | void (*CBStop)(GUIHANDLE cbhdl); | ||
| 837 | bool (*CBDirty)(GUIHANDLE cbhdl); | ||
| 838 | |||
| 839 | private: | ||
| 840 | CAddonGUIWindow *m_Window; | ||
| 841 | int m_ControlId; | ||
| 842 | GUIHANDLE m_RenderingHandle; | ||
| 843 | void *m_Handle; | ||
| 844 | void *m_cb; | ||
| 845 | }; | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h new file mode 100644 index 0000000..e0dc881 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h | |||
| @@ -0,0 +1,150 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2016 Team XBMC | ||
| 3 | * http://www.xbmc.org | ||
| 4 | * | ||
| 5 | * This Program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This Program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with XBMC; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | #pragma once | ||
| 22 | |||
| 23 | #include <string> | ||
| 24 | #include <vector> | ||
| 25 | #include <string.h> | ||
| 26 | #include <stdlib.h> | ||
| 27 | #include <stdio.h> | ||
| 28 | #include "libXBMC_addon.h" | ||
| 29 | |||
| 30 | #ifdef BUILD_KODI_ADDON | ||
| 31 | #include "DVDDemuxPacket.h" | ||
| 32 | #else | ||
| 33 | #include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h" | ||
| 34 | #endif | ||
| 35 | |||
| 36 | #ifdef _WIN32 | ||
| 37 | #define INPUTSTREAM_HELPER_DLL "\\library.kodi.inputstream\\libKODI_inputstream" ADDON_HELPER_EXT | ||
| 38 | #else | ||
| 39 | #define INPUTSTREAM_HELPER_DLL_NAME "libKODI_inputstream-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 40 | #define INPUTSTREAM_HELPER_DLL "/library.kodi.inputstream/" INPUTSTREAM_HELPER_DLL_NAME | ||
| 41 | #endif | ||
| 42 | |||
| 43 | class CHelper_libKODI_inputstream | ||
| 44 | { | ||
| 45 | public: | ||
| 46 | CHelper_libKODI_inputstream(void) | ||
| 47 | { | ||
| 48 | m_libKODI_inputstream = nullptr; | ||
| 49 | m_Handle = nullptr; | ||
| 50 | } | ||
| 51 | |||
| 52 | ~CHelper_libKODI_inputstream(void) | ||
| 53 | { | ||
| 54 | if (m_libKODI_inputstream) | ||
| 55 | { | ||
| 56 | INPUTSTREAM_unregister_me(m_Handle, m_Callbacks); | ||
| 57 | dlclose(m_libKODI_inputstream); | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | /*! | ||
| 62 | * @brief Resolve all callback methods | ||
| 63 | * @param handle Pointer to the add-on | ||
| 64 | * @return True when all methods were resolved, false otherwise. | ||
| 65 | */ | ||
| 66 | bool RegisterMe(void* handle) | ||
| 67 | { | ||
| 68 | m_Handle = handle; | ||
| 69 | |||
| 70 | std::string libBasePath; | ||
| 71 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 72 | libBasePath += INPUTSTREAM_HELPER_DLL; | ||
| 73 | |||
| 74 | m_libKODI_inputstream = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 75 | if (m_libKODI_inputstream == nullptr) | ||
| 76 | { | ||
| 77 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 78 | return false; | ||
| 79 | } | ||
| 80 | |||
| 81 | INPUTSTREAM_register_me = (void* (*)(void *HANDLE)) | ||
| 82 | dlsym(m_libKODI_inputstream, "INPUTSTREAM_register_me"); | ||
| 83 | if (INPUTSTREAM_register_me == nullptr) | ||
| 84 | { | ||
| 85 | fprintf(stderr, "Unable to assign function %s\n", dlerror()); | ||
| 86 | return false; | ||
| 87 | } | ||
| 88 | |||
| 89 | INPUTSTREAM_unregister_me = (void (*)(void* HANDLE, void* CB)) | ||
| 90 | dlsym(m_libKODI_inputstream, "INPUTSTREAM_unregister_me"); | ||
| 91 | if (INPUTSTREAM_unregister_me == nullptr) | ||
| 92 | { | ||
| 93 | fprintf(stderr, "Unable to assign function %s\n", dlerror()); | ||
| 94 | return false; | ||
| 95 | } | ||
| 96 | |||
| 97 | INPUTSTREAM_free_demux_packet = (void (*)(void* HANDLE, void* CB, DemuxPacket* pPacket)) | ||
| 98 | dlsym(m_libKODI_inputstream, "INPUTSTREAM_free_demux_packet"); | ||
| 99 | if (INPUTSTREAM_free_demux_packet == NULL) | ||
| 100 | { | ||
| 101 | fprintf(stderr, "Unable to assign function %s\n", dlerror()); | ||
| 102 | return false; | ||
| 103 | } | ||
| 104 | |||
| 105 | INPUTSTREAM_allocate_demux_packet = (DemuxPacket* (*)(void* HANDLE, void* CB, int iDataSize)) | ||
| 106 | dlsym(m_libKODI_inputstream, "INPUTSTREAM_allocate_demux_packet"); | ||
| 107 | if (INPUTSTREAM_allocate_demux_packet == NULL) | ||
| 108 | { | ||
| 109 | fprintf(stderr, "Unable to assign function %s\n", dlerror()); | ||
| 110 | return false; | ||
| 111 | } | ||
| 112 | |||
| 113 | m_Callbacks = INPUTSTREAM_register_me(m_Handle); | ||
| 114 | return m_Callbacks != nullptr; | ||
| 115 | } | ||
| 116 | |||
| 117 | /*! | ||
| 118 | * @brief Allocate a demux packet. Free with FreeDemuxPacket | ||
| 119 | * @param iDataSize The size of the data that will go into the packet | ||
| 120 | * @return The allocated packet | ||
| 121 | */ | ||
| 122 | DemuxPacket* AllocateDemuxPacket(int iDataSize) | ||
| 123 | { | ||
| 124 | return INPUTSTREAM_allocate_demux_packet(m_Handle, m_Callbacks, iDataSize); | ||
| 125 | } | ||
| 126 | |||
| 127 | /*! | ||
| 128 | * @brief Free a packet that was allocated with AllocateDemuxPacket | ||
| 129 | * @param pPacket The packet to free | ||
| 130 | */ | ||
| 131 | void FreeDemuxPacket(DemuxPacket* pPacket) | ||
| 132 | { | ||
| 133 | return INPUTSTREAM_free_demux_packet(m_Handle, m_Callbacks, pPacket); | ||
| 134 | } | ||
| 135 | |||
| 136 | protected: | ||
| 137 | void* (*INPUTSTREAM_register_me)(void*); | ||
| 138 | void (*INPUTSTREAM_unregister_me)(void*, void*); | ||
| 139 | void (*INPUTSTREAM_free_demux_packet)(void*, void*, DemuxPacket*); | ||
| 140 | DemuxPacket* (*INPUTSTREAM_allocate_demux_packet)(void*, void*, int); | ||
| 141 | |||
| 142 | private: | ||
| 143 | void* m_libKODI_inputstream; | ||
| 144 | void* m_Handle; | ||
| 145 | void* m_Callbacks; | ||
| 146 | struct cb_array | ||
| 147 | { | ||
| 148 | const char* libPath; | ||
| 149 | }; | ||
| 150 | }; | ||
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 new file mode 100644 index 0000000..e8d5ec7 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h | |||
| @@ -0,0 +1,710 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string> | ||
| 23 | #include <vector> | ||
| 24 | #include <string.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | #include <stdio.h> | ||
| 27 | #include <stdint.h> | ||
| 28 | #include <stdarg.h> | ||
| 29 | |||
| 30 | #if defined(BUILD_KODI_ADDON) | ||
| 31 | #include "IFileTypes.h" | ||
| 32 | #else | ||
| 33 | #include "filesystem/IFileTypes.h" | ||
| 34 | #endif | ||
| 35 | |||
| 36 | struct VFSDirEntry; | ||
| 37 | |||
| 38 | #ifdef _WIN32 // windows | ||
| 39 | #ifndef _SSIZE_T_DEFINED | ||
| 40 | typedef intptr_t ssize_t; | ||
| 41 | #define _SSIZE_T_DEFINED | ||
| 42 | #endif // !_SSIZE_T_DEFINED | ||
| 43 | |||
| 44 | #if defined(BUILD_KODI_ADDON) | ||
| 45 | #include "p8-platform/windows/dlfcn-win32.h" | ||
| 46 | #else | ||
| 47 | #include "dlfcn-win32.h" | ||
| 48 | #endif | ||
| 49 | |||
| 50 | #define ADDON_DLL "\\library.xbmc.addon\\libXBMC_addon" ADDON_HELPER_EXT | ||
| 51 | #define ADDON_HELPER_EXT ".dll" | ||
| 52 | #else // windows | ||
| 53 | // the ADDON_HELPER_ARCH is the platform dependend name which is used | ||
| 54 | // as part of the name of dynamic addon libraries. It has to match the | ||
| 55 | // strings which are set in configure.ac for the "ARCH" variable. | ||
| 56 | #if defined(__APPLE__) // osx | ||
| 57 | #if defined(__arm__) || defined(__aarch64__) | ||
| 58 | #define ADDON_HELPER_ARCH "arm-osx" | ||
| 59 | #else | ||
| 60 | #define ADDON_HELPER_ARCH "x86-osx" | ||
| 61 | #endif | ||
| 62 | #define ADDON_HELPER_EXT ".dylib" | ||
| 63 | #else // linux | ||
| 64 | #if defined(__x86_64__) | ||
| 65 | #define ADDON_HELPER_ARCH "x86_64-linux" | ||
| 66 | #elif defined(_POWERPC) | ||
| 67 | #define ADDON_HELPER_ARCH "powerpc-linux" | ||
| 68 | #elif defined(_POWERPC64) | ||
| 69 | #define ADDON_HELPER_ARCH "powerpc64-linux" | ||
| 70 | #elif defined(__ARMEL__) | ||
| 71 | #define ADDON_HELPER_ARCH "arm" | ||
| 72 | #elif defined(__aarch64__) | ||
| 73 | #define ADDON_HELPER_ARCH "aarch64" | ||
| 74 | #elif defined(__mips__) | ||
| 75 | #define ADDON_HELPER_ARCH "mips" | ||
| 76 | #else | ||
| 77 | #define ADDON_HELPER_ARCH "i486-linux" | ||
| 78 | #endif | ||
| 79 | #define ADDON_HELPER_EXT ".so" | ||
| 80 | #endif | ||
| 81 | #include <dlfcn.h> // linux+osx | ||
| 82 | #define ADDON_DLL_NAME "libXBMC_addon-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 83 | #define ADDON_DLL "/library.xbmc.addon/" ADDON_DLL_NAME | ||
| 84 | #endif | ||
| 85 | #if defined(ANDROID) | ||
| 86 | #include <sys/stat.h> | ||
| 87 | #endif | ||
| 88 | |||
| 89 | #ifdef LOG_DEBUG | ||
| 90 | #undef LOG_DEBUG | ||
| 91 | #endif | ||
| 92 | #ifdef LOG_INFO | ||
| 93 | #undef LOG_INFO | ||
| 94 | #endif | ||
| 95 | #ifdef LOG_NOTICE | ||
| 96 | #undef LOG_NOTICE | ||
| 97 | #endif | ||
| 98 | #ifdef LOG_ERROR | ||
| 99 | #undef LOG_ERROR | ||
| 100 | #endif | ||
| 101 | |||
| 102 | namespace ADDON | ||
| 103 | { | ||
| 104 | typedef enum addon_log | ||
| 105 | { | ||
| 106 | LOG_DEBUG, | ||
| 107 | LOG_INFO, | ||
| 108 | LOG_NOTICE, | ||
| 109 | LOG_ERROR | ||
| 110 | } addon_log_t; | ||
| 111 | |||
| 112 | typedef enum queue_msg | ||
| 113 | { | ||
| 114 | QUEUE_INFO, | ||
| 115 | QUEUE_WARNING, | ||
| 116 | QUEUE_ERROR | ||
| 117 | } queue_msg_t; | ||
| 118 | |||
| 119 | class CHelper_libXBMC_addon | ||
| 120 | { | ||
| 121 | public: | ||
| 122 | CHelper_libXBMC_addon() | ||
| 123 | { | ||
| 124 | m_libXBMC_addon = NULL; | ||
| 125 | m_Handle = NULL; | ||
| 126 | } | ||
| 127 | |||
| 128 | ~CHelper_libXBMC_addon() | ||
| 129 | { | ||
| 130 | if (m_libXBMC_addon) | ||
| 131 | { | ||
| 132 | XBMC_unregister_me(m_Handle, m_Callbacks); | ||
| 133 | dlclose(m_libXBMC_addon); | ||
| 134 | } | ||
| 135 | } | ||
| 136 | |||
| 137 | bool RegisterMe(void *Handle) | ||
| 138 | { | ||
| 139 | m_Handle = Handle; | ||
| 140 | |||
| 141 | std::string libBasePath; | ||
| 142 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 143 | libBasePath += ADDON_DLL; | ||
| 144 | |||
| 145 | #if defined(ANDROID) | ||
| 146 | struct stat st; | ||
| 147 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 148 | { | ||
| 149 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 150 | libBasePath = tempbin + "/" + ADDON_DLL_NAME; | ||
| 151 | } | ||
| 152 | #endif | ||
| 153 | |||
| 154 | m_libXBMC_addon = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 155 | if (m_libXBMC_addon == NULL) | ||
| 156 | { | ||
| 157 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 158 | return false; | ||
| 159 | } | ||
| 160 | |||
| 161 | XBMC_register_me = (void* (*)(void *HANDLE)) | ||
| 162 | dlsym(m_libXBMC_addon, "XBMC_register_me"); | ||
| 163 | if (XBMC_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 164 | |||
| 165 | XBMC_unregister_me = (void (*)(void* HANDLE, void* CB)) | ||
| 166 | dlsym(m_libXBMC_addon, "XBMC_unregister_me"); | ||
| 167 | if (XBMC_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 168 | |||
| 169 | XBMC_log = (void (*)(void* HANDLE, void* CB, const addon_log_t loglevel, const char *msg)) | ||
| 170 | dlsym(m_libXBMC_addon, "XBMC_log"); | ||
| 171 | if (XBMC_log == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 172 | |||
| 173 | XBMC_get_setting = (bool (*)(void* HANDLE, void* CB, const char* settingName, void *settingValue)) | ||
| 174 | dlsym(m_libXBMC_addon, "XBMC_get_setting"); | ||
| 175 | if (XBMC_get_setting == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 176 | |||
| 177 | XBMC_queue_notification = (void (*)(void* HANDLE, void* CB, const queue_msg_t loglevel, const char *msg)) | ||
| 178 | dlsym(m_libXBMC_addon, "XBMC_queue_notification"); | ||
| 179 | if (XBMC_queue_notification == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 180 | |||
| 181 | XBMC_wake_on_lan = (bool (*)(void* HANDLE, void *CB, const char *mac)) | ||
| 182 | dlsym(m_libXBMC_addon, "XBMC_wake_on_lan"); | ||
| 183 | if (XBMC_wake_on_lan == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 184 | |||
| 185 | XBMC_unknown_to_utf8 = (char* (*)(void* HANDLE, void* CB, const char* str)) | ||
| 186 | dlsym(m_libXBMC_addon, "XBMC_unknown_to_utf8"); | ||
| 187 | if (XBMC_unknown_to_utf8 == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 188 | |||
| 189 | XBMC_get_localized_string = (char* (*)(void* HANDLE, void* CB, int dwCode)) | ||
| 190 | dlsym(m_libXBMC_addon, "XBMC_get_localized_string"); | ||
| 191 | if (XBMC_get_localized_string == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 192 | |||
| 193 | XBMC_free_string = (void (*)(void* HANDLE, void* CB, char* str)) | ||
| 194 | dlsym(m_libXBMC_addon, "XBMC_free_string"); | ||
| 195 | if (XBMC_free_string == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 196 | |||
| 197 | XBMC_get_dvd_menu_language = (char* (*)(void* HANDLE, void* CB)) | ||
| 198 | dlsym(m_libXBMC_addon, "XBMC_get_dvd_menu_language"); | ||
| 199 | if (XBMC_get_dvd_menu_language == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 200 | |||
| 201 | XBMC_open_file = (void* (*)(void* HANDLE, void* CB, const char* strFileName, unsigned int flags)) | ||
| 202 | dlsym(m_libXBMC_addon, "XBMC_open_file"); | ||
| 203 | if (XBMC_open_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 204 | |||
| 205 | XBMC_open_file_for_write = (void* (*)(void* HANDLE, void* CB, const char* strFileName, bool bOverWrite)) | ||
| 206 | dlsym(m_libXBMC_addon, "XBMC_open_file_for_write"); | ||
| 207 | if (XBMC_open_file_for_write == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 208 | |||
| 209 | XBMC_read_file = (ssize_t (*)(void* HANDLE, void* CB, void* file, void* lpBuf, size_t uiBufSize)) | ||
| 210 | dlsym(m_libXBMC_addon, "XBMC_read_file"); | ||
| 211 | if (XBMC_read_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 212 | |||
| 213 | XBMC_read_file_string = (bool (*)(void* HANDLE, void* CB, void* file, char *szLine, int iLineLength)) | ||
| 214 | dlsym(m_libXBMC_addon, "XBMC_read_file_string"); | ||
| 215 | if (XBMC_read_file_string == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 216 | |||
| 217 | XBMC_write_file = (ssize_t (*)(void* HANDLE, void* CB, void* file, const void* lpBuf, size_t uiBufSize)) | ||
| 218 | dlsym(m_libXBMC_addon, "XBMC_write_file"); | ||
| 219 | if (XBMC_write_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 220 | |||
| 221 | XBMC_flush_file = (void (*)(void* HANDLE, void* CB, void* file)) | ||
| 222 | dlsym(m_libXBMC_addon, "XBMC_flush_file"); | ||
| 223 | if (XBMC_flush_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 224 | |||
| 225 | XBMC_seek_file = (int64_t (*)(void* HANDLE, void* CB, void* file, int64_t iFilePosition, int iWhence)) | ||
| 226 | dlsym(m_libXBMC_addon, "XBMC_seek_file"); | ||
| 227 | if (XBMC_seek_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 228 | |||
| 229 | XBMC_truncate_file = (int (*)(void* HANDLE, void* CB, void* file, int64_t iSize)) | ||
| 230 | dlsym(m_libXBMC_addon, "XBMC_truncate_file"); | ||
| 231 | if (XBMC_truncate_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 232 | |||
| 233 | XBMC_get_file_position = (int64_t (*)(void* HANDLE, void* CB, void* file)) | ||
| 234 | dlsym(m_libXBMC_addon, "XBMC_get_file_position"); | ||
| 235 | if (XBMC_get_file_position == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 236 | |||
| 237 | XBMC_get_file_length = (int64_t (*)(void* HANDLE, void* CB, void* file)) | ||
| 238 | dlsym(m_libXBMC_addon, "XBMC_get_file_length"); | ||
| 239 | if (XBMC_get_file_length == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 240 | |||
| 241 | XBMC_get_file_download_speed = (double(*)(void* HANDLE, void* CB, void* file)) | ||
| 242 | dlsym(m_libXBMC_addon, "XBMC_get_file_download_speed"); | ||
| 243 | if (XBMC_get_file_download_speed == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 244 | |||
| 245 | XBMC_close_file = (void (*)(void* HANDLE, void* CB, void* file)) | ||
| 246 | dlsym(m_libXBMC_addon, "XBMC_close_file"); | ||
| 247 | if (XBMC_close_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 248 | |||
| 249 | XBMC_get_file_chunk_size = (int (*)(void* HANDLE, void* CB, void* file)) | ||
| 250 | dlsym(m_libXBMC_addon, "XBMC_get_file_chunk_size"); | ||
| 251 | if (XBMC_get_file_chunk_size == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 252 | |||
| 253 | XBMC_file_exists = (bool (*)(void* HANDLE, void* CB, const char *strFileName, bool bUseCache)) | ||
| 254 | dlsym(m_libXBMC_addon, "XBMC_file_exists"); | ||
| 255 | if (XBMC_file_exists == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 256 | |||
| 257 | XBMC_stat_file = (int (*)(void* HANDLE, void* CB, const char *strFileName, struct __stat64* buffer)) | ||
| 258 | dlsym(m_libXBMC_addon, "XBMC_stat_file"); | ||
| 259 | if (XBMC_stat_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 260 | |||
| 261 | XBMC_delete_file = (bool (*)(void* HANDLE, void* CB, const char *strFileName)) | ||
| 262 | dlsym(m_libXBMC_addon, "XBMC_delete_file"); | ||
| 263 | if (XBMC_delete_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 264 | |||
| 265 | XBMC_can_open_directory = (bool (*)(void* HANDLE, void* CB, const char* strURL)) | ||
| 266 | dlsym(m_libXBMC_addon, "XBMC_can_open_directory"); | ||
| 267 | if (XBMC_can_open_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 268 | |||
| 269 | XBMC_create_directory = (bool (*)(void* HANDLE, void* CB, const char* strPath)) | ||
| 270 | dlsym(m_libXBMC_addon, "XBMC_create_directory"); | ||
| 271 | if (XBMC_create_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 272 | |||
| 273 | XBMC_directory_exists = (bool (*)(void* HANDLE, void* CB, const char* strPath)) | ||
| 274 | dlsym(m_libXBMC_addon, "XBMC_directory_exists"); | ||
| 275 | if (XBMC_directory_exists == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 276 | |||
| 277 | XBMC_remove_directory = (bool (*)(void* HANDLE, void* CB, const char* strPath)) | ||
| 278 | dlsym(m_libXBMC_addon, "XBMC_remove_directory"); | ||
| 279 | if (XBMC_remove_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 280 | |||
| 281 | XBMC_get_directory = (bool (*)(void* HANDLE, void* CB, const char* strPath, const char* mask, VFSDirEntry** items, unsigned int* num_items)) | ||
| 282 | dlsym(m_libXBMC_addon, "XBMC_get_directory"); | ||
| 283 | if (XBMC_get_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 284 | |||
| 285 | XBMC_free_directory = (void (*)(void* HANDLE, void* CB, VFSDirEntry* items, unsigned int num_items)) | ||
| 286 | dlsym(m_libXBMC_addon, "XBMC_free_directory"); | ||
| 287 | if (XBMC_free_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 288 | |||
| 289 | XBMC_curl_create = (void* (*)(void *HANDLE, void* CB, const char* strURL)) | ||
| 290 | dlsym(m_libXBMC_addon, "XBMC_curl_create"); | ||
| 291 | if (XBMC_curl_create == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 292 | |||
| 293 | XBMC_curl_add_option = (bool (*)(void *HANDLE, void* CB, void *file, XFILE::CURLOPTIONTYPE type, const char* name, const char *value)) | ||
| 294 | dlsym(m_libXBMC_addon, "XBMC_curl_add_option"); | ||
| 295 | if (XBMC_curl_add_option == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 296 | |||
| 297 | XBMC_curl_open = (bool (*)(void *HANDLE, void* CB, void *file, unsigned int flags)) | ||
| 298 | dlsym(m_libXBMC_addon, "XBMC_curl_open"); | ||
| 299 | if (XBMC_curl_open == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 300 | |||
| 301 | m_Callbacks = XBMC_register_me(m_Handle); | ||
| 302 | return m_Callbacks != NULL; | ||
| 303 | } | ||
| 304 | |||
| 305 | /*! | ||
| 306 | * @brief Add a message to XBMC's log. | ||
| 307 | * @param loglevel The log level of the message. | ||
| 308 | * @param format The format of the message to pass to XBMC. | ||
| 309 | */ | ||
| 310 | void Log(const addon_log_t loglevel, const char *format, ... ) | ||
| 311 | { | ||
| 312 | char buffer[16384]; | ||
| 313 | va_list args; | ||
| 314 | va_start (args, format); | ||
| 315 | vsprintf (buffer, format, args); | ||
| 316 | va_end (args); | ||
| 317 | return XBMC_log(m_Handle, m_Callbacks, loglevel, buffer); | ||
| 318 | } | ||
| 319 | |||
| 320 | /*! | ||
| 321 | * @brief Get a settings value for this add-on. | ||
| 322 | * @param settingName The name of the setting to get. | ||
| 323 | * @param settingValue The value. | ||
| 324 | * @return True if the settings was fetched successfully, false otherwise. | ||
| 325 | */ | ||
| 326 | bool GetSetting(const char* settingName, void *settingValue) | ||
| 327 | { | ||
| 328 | return XBMC_get_setting(m_Handle, m_Callbacks, settingName, settingValue); | ||
| 329 | } | ||
| 330 | |||
| 331 | /*! | ||
| 332 | * @brief Queue a notification in the GUI. | ||
| 333 | * @param type The message type. | ||
| 334 | * @param format The format of the message to pass to display in XBMC. | ||
| 335 | */ | ||
| 336 | void QueueNotification(const queue_msg_t type, const char *format, ... ) | ||
| 337 | { | ||
| 338 | char buffer[16384]; | ||
| 339 | va_list args; | ||
| 340 | va_start (args, format); | ||
| 341 | vsprintf (buffer, format, args); | ||
| 342 | va_end (args); | ||
| 343 | return XBMC_queue_notification(m_Handle, m_Callbacks, type, buffer); | ||
| 344 | } | ||
| 345 | |||
| 346 | /*! | ||
| 347 | * @brief Send WakeOnLan magic packet. | ||
| 348 | * @param mac Network address of the host to wake. | ||
| 349 | * @return True if the magic packet was successfully sent, false otherwise. | ||
| 350 | */ | ||
| 351 | bool WakeOnLan(const char* mac) | ||
| 352 | { | ||
| 353 | return XBMC_wake_on_lan(m_Handle, m_Callbacks, mac); | ||
| 354 | } | ||
| 355 | |||
| 356 | /*! | ||
| 357 | * @brief Translate a string with an unknown encoding to UTF8. | ||
| 358 | * @param str The string to translate. | ||
| 359 | * @return The string translated to UTF8. Must be freed by calling FreeString() when done. | ||
| 360 | */ | ||
| 361 | char* UnknownToUTF8(const char* str) | ||
| 362 | { | ||
| 363 | return XBMC_unknown_to_utf8(m_Handle, m_Callbacks, str); | ||
| 364 | } | ||
| 365 | |||
| 366 | /*! | ||
| 367 | * @brief Get a localised message. | ||
| 368 | * @param dwCode The code of the message to get. | ||
| 369 | * @return The message. Must be freed by calling FreeString() when done. | ||
| 370 | */ | ||
| 371 | char* GetLocalizedString(int dwCode) | ||
| 372 | { | ||
| 373 | return XBMC_get_localized_string(m_Handle, m_Callbacks, dwCode); | ||
| 374 | } | ||
| 375 | |||
| 376 | |||
| 377 | /*! | ||
| 378 | * @brief Get the DVD menu language. | ||
| 379 | * @return The language. Must be freed by calling FreeString() when done. | ||
| 380 | */ | ||
| 381 | char* GetDVDMenuLanguage() | ||
| 382 | { | ||
| 383 | return XBMC_get_dvd_menu_language(m_Handle, m_Callbacks); | ||
| 384 | } | ||
| 385 | |||
| 386 | /*! | ||
| 387 | * @brief Free the memory used by str | ||
| 388 | * @param str The string to free | ||
| 389 | */ | ||
| 390 | void FreeString(char* str) | ||
| 391 | { | ||
| 392 | return XBMC_free_string(m_Handle, m_Callbacks, str); | ||
| 393 | } | ||
| 394 | |||
| 395 | /*! | ||
| 396 | * @brief Open the file with filename via XBMC's CFile. Needs to be closed by calling CloseFile() when done. | ||
| 397 | * @param strFileName The filename to open. | ||
| 398 | * @param flags The flags to pass. Documented in XBMC's File.h | ||
| 399 | * @return A handle for the file, or NULL if it couldn't be opened. | ||
| 400 | */ | ||
| 401 | void* OpenFile(const char* strFileName, unsigned int flags) | ||
| 402 | { | ||
| 403 | return XBMC_open_file(m_Handle, m_Callbacks, strFileName, flags); | ||
| 404 | } | ||
| 405 | |||
| 406 | /*! | ||
| 407 | * @brief Open the file with filename via XBMC's CFile in write mode. Needs to be closed by calling CloseFile() when done. | ||
| 408 | * @param strFileName The filename to open. | ||
| 409 | * @param bOverWrite True to overwrite, false otherwise. | ||
| 410 | * @return A handle for the file, or NULL if it couldn't be opened. | ||
| 411 | */ | ||
| 412 | void* OpenFileForWrite(const char* strFileName, bool bOverWrite) | ||
| 413 | { | ||
| 414 | return XBMC_open_file_for_write(m_Handle, m_Callbacks, strFileName, bOverWrite); | ||
| 415 | } | ||
| 416 | |||
| 417 | /*! | ||
| 418 | * @brief Read from an open file. | ||
| 419 | * @param file The file handle to read from. | ||
| 420 | * @param lpBuf The buffer to store the data in. | ||
| 421 | * @param uiBufSize The size of the buffer. | ||
| 422 | * @return number of successfully read bytes if any bytes were read and stored in | ||
| 423 | * buffer, zero if no bytes are available to read (end of file was reached) | ||
| 424 | * or undetectable error occur, -1 in case of any explicit error | ||
| 425 | */ | ||
| 426 | ssize_t ReadFile(void* file, void* lpBuf, size_t uiBufSize) | ||
| 427 | { | ||
| 428 | return XBMC_read_file(m_Handle, m_Callbacks, file, lpBuf, uiBufSize); | ||
| 429 | } | ||
| 430 | |||
| 431 | /*! | ||
| 432 | * @brief Read a string from an open file. | ||
| 433 | * @param file The file handle to read from. | ||
| 434 | * @param szLine The buffer to store the data in. | ||
| 435 | * @param iLineLength The size of the buffer. | ||
| 436 | * @return True when a line was read, false otherwise. | ||
| 437 | */ | ||
| 438 | bool ReadFileString(void* file, char *szLine, int iLineLength) | ||
| 439 | { | ||
| 440 | return XBMC_read_file_string(m_Handle, m_Callbacks, file, szLine, iLineLength); | ||
| 441 | } | ||
| 442 | |||
| 443 | /*! | ||
| 444 | * @brief Write to a file opened in write mode. | ||
| 445 | * @param file The file handle to write to. | ||
| 446 | * @param lpBuf The data to write. | ||
| 447 | * @param uiBufSize Size of the data to write. | ||
| 448 | * @return number of successfully written bytes if any bytes were written, | ||
| 449 | * zero if no bytes were written and no detectable error occur, | ||
| 450 | * -1 in case of any explicit error | ||
| 451 | */ | ||
| 452 | ssize_t WriteFile(void* file, const void* lpBuf, size_t uiBufSize) | ||
| 453 | { | ||
| 454 | return XBMC_write_file(m_Handle, m_Callbacks, file, lpBuf, uiBufSize); | ||
| 455 | } | ||
| 456 | |||
| 457 | /*! | ||
| 458 | * @brief Flush buffered data. | ||
| 459 | * @param file The file handle to flush the data for. | ||
| 460 | */ | ||
| 461 | void FlushFile(void* file) | ||
| 462 | { | ||
| 463 | return XBMC_flush_file(m_Handle, m_Callbacks, file); | ||
| 464 | } | ||
| 465 | |||
| 466 | /*! | ||
| 467 | * @brief Seek in an open file. | ||
| 468 | * @param file The file handle to see in. | ||
| 469 | * @param iFilePosition The new position. | ||
| 470 | * @param iWhence Seek argument. See stdio.h for possible values. | ||
| 471 | * @return The new position. | ||
| 472 | */ | ||
| 473 | int64_t SeekFile(void* file, int64_t iFilePosition, int iWhence) | ||
| 474 | { | ||
| 475 | return XBMC_seek_file(m_Handle, m_Callbacks, file, iFilePosition, iWhence); | ||
| 476 | } | ||
| 477 | |||
| 478 | /*! | ||
| 479 | * @brief Truncate a file to the requested size. | ||
| 480 | * @param file The file handle to truncate. | ||
| 481 | * @param iSize The new max size. | ||
| 482 | * @return New size? | ||
| 483 | */ | ||
| 484 | int TruncateFile(void* file, int64_t iSize) | ||
| 485 | { | ||
| 486 | return XBMC_truncate_file(m_Handle, m_Callbacks, file, iSize); | ||
| 487 | } | ||
| 488 | |||
| 489 | /*! | ||
| 490 | * @brief The current position in an open file. | ||
| 491 | * @param file The file handle to get the position for. | ||
| 492 | * @return The requested position. | ||
| 493 | */ | ||
| 494 | int64_t GetFilePosition(void* file) | ||
| 495 | { | ||
| 496 | return XBMC_get_file_position(m_Handle, m_Callbacks, file); | ||
| 497 | } | ||
| 498 | |||
| 499 | /*! | ||
| 500 | * @brief Get the file size of an open file. | ||
| 501 | * @param file The file to get the size for. | ||
| 502 | * @return The requested size. | ||
| 503 | */ | ||
| 504 | int64_t GetFileLength(void* file) | ||
| 505 | { | ||
| 506 | return XBMC_get_file_length(m_Handle, m_Callbacks, file); | ||
| 507 | } | ||
| 508 | |||
| 509 | /*! | ||
| 510 | * @brief Get the download speed of an open file if available. | ||
| 511 | * @param file The file to get the size for. | ||
| 512 | * @return The download speed in seconds. | ||
| 513 | */ | ||
| 514 | double GetFileDownloadSpeed(void* file) | ||
| 515 | { | ||
| 516 | return XBMC_get_file_download_speed(m_Handle, m_Callbacks, file); | ||
| 517 | } | ||
| 518 | |||
| 519 | /*! | ||
| 520 | * @brief Close an open file. | ||
| 521 | * @param file The file handle to close. | ||
| 522 | */ | ||
| 523 | void CloseFile(void* file) | ||
| 524 | { | ||
| 525 | return XBMC_close_file(m_Handle, m_Callbacks, file); | ||
| 526 | } | ||
| 527 | |||
| 528 | /*! | ||
| 529 | * @brief Get the chunk size for an open file. | ||
| 530 | * @param file the file handle to get the size for. | ||
| 531 | * @return The requested size. | ||
| 532 | */ | ||
| 533 | int GetFileChunkSize(void* file) | ||
| 534 | { | ||
| 535 | return XBMC_get_file_chunk_size(m_Handle, m_Callbacks, file); | ||
| 536 | } | ||
| 537 | |||
| 538 | /*! | ||
| 539 | * @brief Check if a file exists. | ||
| 540 | * @param strFileName The filename to check. | ||
| 541 | * @param bUseCache Check in file cache. | ||
| 542 | * @return true if the file exists false otherwise. | ||
| 543 | */ | ||
| 544 | bool FileExists(const char *strFileName, bool bUseCache) | ||
| 545 | { | ||
| 546 | return XBMC_file_exists(m_Handle, m_Callbacks, strFileName, bUseCache); | ||
| 547 | } | ||
| 548 | |||
| 549 | /*! | ||
| 550 | * @brief Reads file status. | ||
| 551 | * @param strFileName The filename to read the status from. | ||
| 552 | * @param buffer The file status is written into this buffer. | ||
| 553 | * @return The file status was successfully read. | ||
| 554 | */ | ||
| 555 | int StatFile(const char *strFileName, struct __stat64* buffer) | ||
| 556 | { | ||
| 557 | return XBMC_stat_file(m_Handle, m_Callbacks, strFileName, buffer); | ||
| 558 | } | ||
| 559 | |||
| 560 | /*! | ||
| 561 | * @brief Deletes a file. | ||
| 562 | * @param strFileName The filename to delete. | ||
| 563 | * @return The file was successfully deleted. | ||
| 564 | */ | ||
| 565 | bool DeleteFile(const char *strFileName) | ||
| 566 | { | ||
| 567 | return XBMC_delete_file(m_Handle, m_Callbacks, strFileName); | ||
| 568 | } | ||
| 569 | |||
| 570 | /*! | ||
| 571 | * @brief Checks whether a directory can be opened. | ||
| 572 | * @param strUrl The URL of the directory to check. | ||
| 573 | * @return True when it can be opened, false otherwise. | ||
| 574 | */ | ||
| 575 | bool CanOpenDirectory(const char* strUrl) | ||
| 576 | { | ||
| 577 | return XBMC_can_open_directory(m_Handle, m_Callbacks, strUrl); | ||
| 578 | } | ||
| 579 | |||
| 580 | /*! | ||
| 581 | * @brief Creates a directory. | ||
| 582 | * @param strPath Path to the directory. | ||
| 583 | * @return True when it was created, false otherwise. | ||
| 584 | */ | ||
| 585 | bool CreateDirectory(const char *strPath) | ||
| 586 | { | ||
| 587 | return XBMC_create_directory(m_Handle, m_Callbacks, strPath); | ||
| 588 | } | ||
| 589 | |||
| 590 | /*! | ||
| 591 | * @brief Checks if a directory exists. | ||
| 592 | * @param strPath Path to the directory. | ||
| 593 | * @return True when it exists, false otherwise. | ||
| 594 | */ | ||
| 595 | bool DirectoryExists(const char *strPath) | ||
| 596 | { | ||
| 597 | return XBMC_directory_exists(m_Handle, m_Callbacks, strPath); | ||
| 598 | } | ||
| 599 | |||
| 600 | /*! | ||
| 601 | * @brief Removes a directory. | ||
| 602 | * @param strPath Path to the directory. | ||
| 603 | * @return True when it was removed, false otherwise. | ||
| 604 | */ | ||
| 605 | bool RemoveDirectory(const char *strPath) | ||
| 606 | { | ||
| 607 | return XBMC_remove_directory(m_Handle, m_Callbacks, strPath); | ||
| 608 | } | ||
| 609 | |||
| 610 | /*! | ||
| 611 | * @brief Lists a directory. | ||
| 612 | * @param strPath Path to the directory. | ||
| 613 | * @param mask File mask | ||
| 614 | * @param items The directory entries | ||
| 615 | * @param num_items Number of entries in directory | ||
| 616 | * @return True if listing was successful, false otherwise. | ||
| 617 | */ | ||
| 618 | bool GetDirectory(const char *strPath, const char* mask, VFSDirEntry** items, unsigned int* num_items) | ||
| 619 | { | ||
| 620 | return XBMC_get_directory(m_Handle, m_Callbacks, strPath, mask, items, num_items); | ||
| 621 | } | ||
| 622 | |||
| 623 | /*! | ||
| 624 | * @brief Free a directory list | ||
| 625 | * @param items The directory entries | ||
| 626 | * @param num_items Number of entries in directory | ||
| 627 | */ | ||
| 628 | void FreeDirectory(VFSDirEntry* items, unsigned int num_items) | ||
| 629 | { | ||
| 630 | return XBMC_free_directory(m_Handle, m_Callbacks, items, num_items); | ||
| 631 | } | ||
| 632 | |||
| 633 | /*! | ||
| 634 | * @brief Create a Curl representation | ||
| 635 | * @param strURL the URL of the Type. | ||
| 636 | */ | ||
| 637 | void* CURLCreate(const char* strURL) | ||
| 638 | { | ||
| 639 | return XBMC_curl_create(m_Handle, m_Callbacks, strURL); | ||
| 640 | } | ||
| 641 | |||
| 642 | /*! | ||
| 643 | * @brief Adds options to the curl file created with CURLCeate | ||
| 644 | * @param file file pointer to the file returned by CURLCeate | ||
| 645 | * @param type option type to set | ||
| 646 | * @param name name of the option | ||
| 647 | * @param value value of the option | ||
| 648 | */ | ||
| 649 | bool CURLAddOption(void* file, XFILE::CURLOPTIONTYPE type, const char* name, const char * value) | ||
| 650 | { | ||
| 651 | return XBMC_curl_add_option(m_Handle, m_Callbacks, file, type, name, value); | ||
| 652 | } | ||
| 653 | |||
| 654 | /*! | ||
| 655 | * @brief Opens the curl file created with CURLCeate | ||
| 656 | * @param file file pointer to the file returned by CURLCeate | ||
| 657 | * @param flags one or more bitwise or combinded flags form XFILE | ||
| 658 | */ | ||
| 659 | bool CURLOpen(void* file, unsigned int flags) | ||
| 660 | { | ||
| 661 | return XBMC_curl_open(m_Handle, m_Callbacks, file, flags); | ||
| 662 | } | ||
| 663 | |||
| 664 | protected: | ||
| 665 | void* (*XBMC_register_me)(void *HANDLE); | ||
| 666 | void (*XBMC_unregister_me)(void *HANDLE, void* CB); | ||
| 667 | void (*XBMC_log)(void *HANDLE, void* CB, const addon_log_t loglevel, const char *msg); | ||
| 668 | bool (*XBMC_get_setting)(void *HANDLE, void* CB, const char* settingName, void *settingValue); | ||
| 669 | void (*XBMC_queue_notification)(void *HANDLE, void* CB, const queue_msg_t type, const char *msg); | ||
| 670 | bool (*XBMC_wake_on_lan)(void *HANDLE, void* CB, const char* mac); | ||
| 671 | char* (*XBMC_unknown_to_utf8)(void *HANDLE, void* CB, const char* str); | ||
| 672 | char* (*XBMC_get_localized_string)(void *HANDLE, void* CB, int dwCode); | ||
| 673 | char* (*XBMC_get_dvd_menu_language)(void *HANDLE, void* CB); | ||
| 674 | void (*XBMC_free_string)(void *HANDLE, void* CB, char* str); | ||
| 675 | void* (*XBMC_open_file)(void *HANDLE, void* CB, const char* strFileName, unsigned int flags); | ||
| 676 | void* (*XBMC_open_file_for_write)(void *HANDLE, void* CB, const char* strFileName, bool bOverWrite); | ||
| 677 | ssize_t (*XBMC_read_file)(void *HANDLE, void* CB, void* file, void* lpBuf, size_t uiBufSize); | ||
| 678 | bool (*XBMC_read_file_string)(void *HANDLE, void* CB, void* file, char *szLine, int iLineLength); | ||
| 679 | ssize_t(*XBMC_write_file)(void *HANDLE, void* CB, void* file, const void* lpBuf, size_t uiBufSize); | ||
| 680 | void (*XBMC_flush_file)(void *HANDLE, void* CB, void* file); | ||
| 681 | int64_t (*XBMC_seek_file)(void *HANDLE, void* CB, void* file, int64_t iFilePosition, int iWhence); | ||
| 682 | int (*XBMC_truncate_file)(void *HANDLE, void* CB, void* file, int64_t iSize); | ||
| 683 | int64_t (*XBMC_get_file_position)(void *HANDLE, void* CB, void* file); | ||
| 684 | int64_t (*XBMC_get_file_length)(void *HANDLE, void* CB, void* file); | ||
| 685 | double(*XBMC_get_file_download_speed)(void *HANDLE, void* CB, void* file); | ||
| 686 | void (*XBMC_close_file)(void *HANDLE, void* CB, void* file); | ||
| 687 | int (*XBMC_get_file_chunk_size)(void *HANDLE, void* CB, void* file); | ||
| 688 | bool (*XBMC_file_exists)(void *HANDLE, void* CB, const char *strFileName, bool bUseCache); | ||
| 689 | int (*XBMC_stat_file)(void *HANDLE, void* CB, const char *strFileName, struct __stat64* buffer); | ||
| 690 | bool (*XBMC_delete_file)(void *HANDLE, void* CB, const char *strFileName); | ||
| 691 | bool (*XBMC_can_open_directory)(void *HANDLE, void* CB, const char* strURL); | ||
| 692 | bool (*XBMC_create_directory)(void *HANDLE, void* CB, const char* strPath); | ||
| 693 | bool (*XBMC_directory_exists)(void *HANDLE, void* CB, const char* strPath); | ||
| 694 | bool (*XBMC_remove_directory)(void *HANDLE, void* CB, const char* strPath); | ||
| 695 | bool (*XBMC_get_directory)(void *HANDLE, void* CB, const char* strPath, const char* mask, VFSDirEntry** items, unsigned int* num_items); | ||
| 696 | void (*XBMC_free_directory)(void *HANDLE, void* CB, VFSDirEntry* items, unsigned int num_items); | ||
| 697 | void* (*XBMC_curl_create)(void *HANDLE, void* CB, const char* strURL); | ||
| 698 | bool (*XBMC_curl_add_option)(void *HANDLE, void* CB, void *file, XFILE::CURLOPTIONTYPE type, const char* name, const char *value); | ||
| 699 | bool (*XBMC_curl_open)(void *m_Handle, void *m_Callbacks, void *file, unsigned int flags); | ||
| 700 | |||
| 701 | private: | ||
| 702 | void *m_libXBMC_addon; | ||
| 703 | void *m_Handle; | ||
| 704 | void *m_Callbacks; | ||
| 705 | struct cb_array | ||
| 706 | { | ||
| 707 | const char* libPath; | ||
| 708 | }; | ||
| 709 | }; | ||
| 710 | }; | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h new file mode 100644 index 0000000..3853f08 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string> | ||
| 23 | #include <vector> | ||
| 24 | #include <string.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | #include <stdio.h> | ||
| 27 | #include "xbmc_codec_types.h" | ||
| 28 | #include "libXBMC_addon.h" | ||
| 29 | |||
| 30 | #ifdef _WIN32 | ||
| 31 | #define CODEC_HELPER_DLL "\\library.xbmc.codec\\libXBMC_codec" ADDON_HELPER_EXT | ||
| 32 | #else | ||
| 33 | #define CODEC_HELPER_DLL_NAME "libXBMC_codec-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 34 | #define CODEC_HELPER_DLL "/library.xbmc.codec/" CODEC_HELPER_DLL_NAME | ||
| 35 | #endif | ||
| 36 | |||
| 37 | class CHelper_libXBMC_codec | ||
| 38 | { | ||
| 39 | public: | ||
| 40 | CHelper_libXBMC_codec(void) | ||
| 41 | { | ||
| 42 | m_libXBMC_codec = NULL; | ||
| 43 | m_Handle = NULL; | ||
| 44 | } | ||
| 45 | |||
| 46 | ~CHelper_libXBMC_codec(void) | ||
| 47 | { | ||
| 48 | if (m_libXBMC_codec) | ||
| 49 | { | ||
| 50 | CODEC_unregister_me(m_Handle, m_Callbacks); | ||
| 51 | dlclose(m_libXBMC_codec); | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | /*! | ||
| 56 | * @brief Resolve all callback methods | ||
| 57 | * @param handle Pointer to the add-on | ||
| 58 | * @return True when all methods were resolved, false otherwise. | ||
| 59 | */ | ||
| 60 | bool RegisterMe(void* handle) | ||
| 61 | { | ||
| 62 | m_Handle = handle; | ||
| 63 | |||
| 64 | std::string libBasePath; | ||
| 65 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 66 | libBasePath += CODEC_HELPER_DLL; | ||
| 67 | |||
| 68 | #if defined(ANDROID) | ||
| 69 | struct stat st; | ||
| 70 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 71 | { | ||
| 72 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 73 | libBasePath = tempbin + "/" + CODEC_HELPER_DLL_NAME; | ||
| 74 | } | ||
| 75 | #endif | ||
| 76 | |||
| 77 | m_libXBMC_codec = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 78 | if (m_libXBMC_codec == NULL) | ||
| 79 | { | ||
| 80 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 81 | return false; | ||
| 82 | } | ||
| 83 | |||
| 84 | CODEC_register_me = (void* (*)(void *HANDLE)) | ||
| 85 | dlsym(m_libXBMC_codec, "CODEC_register_me"); | ||
| 86 | if (CODEC_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 87 | |||
| 88 | CODEC_unregister_me = (void (*)(void* HANDLE, void* CB)) | ||
| 89 | dlsym(m_libXBMC_codec, "CODEC_unregister_me"); | ||
| 90 | if (CODEC_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 91 | |||
| 92 | CODEC_get_codec_by_name = (xbmc_codec_t (*)(void* HANDLE, void* CB, const char* strCodecName)) | ||
| 93 | dlsym(m_libXBMC_codec, "CODEC_get_codec_by_name"); | ||
| 94 | if (CODEC_get_codec_by_name == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 95 | |||
| 96 | m_Callbacks = CODEC_register_me(m_Handle); | ||
| 97 | return m_Callbacks != NULL; | ||
| 98 | } | ||
| 99 | |||
| 100 | /*! | ||
| 101 | * @brief Get the codec id used by XBMC | ||
| 102 | * @param strCodecName The name of the codec | ||
| 103 | * @return The codec_id, or a codec_id with 0 values when not supported | ||
| 104 | */ | ||
| 105 | xbmc_codec_t GetCodecByName(const char* strCodecName) | ||
| 106 | { | ||
| 107 | return CODEC_get_codec_by_name(m_Handle, m_Callbacks, strCodecName); | ||
| 108 | } | ||
| 109 | |||
| 110 | protected: | ||
| 111 | void* (*CODEC_register_me)(void*); | ||
| 112 | void (*CODEC_unregister_me)(void*, void*); | ||
| 113 | xbmc_codec_t (*CODEC_get_codec_by_name)(void *HANDLE, void* CB, const char* strCodecName); | ||
| 114 | |||
| 115 | private: | ||
| 116 | void* m_libXBMC_codec; | ||
| 117 | void* m_Handle; | ||
| 118 | void* m_Callbacks; | ||
| 119 | struct cb_array | ||
| 120 | { | ||
| 121 | const char* libPath; | ||
| 122 | }; | ||
| 123 | }; | ||
| 124 | |||
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 new file mode 100644 index 0000000..3e3d479 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h | |||
| @@ -0,0 +1,366 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string> | ||
| 23 | #include <vector> | ||
| 24 | #include <string.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | #include <stdio.h> | ||
| 27 | #include "xbmc_pvr_types.h" | ||
| 28 | #include "libXBMC_addon.h" | ||
| 29 | |||
| 30 | #ifdef _WIN32 | ||
| 31 | #define PVR_HELPER_DLL "\\library.xbmc.pvr\\libXBMC_pvr" ADDON_HELPER_EXT | ||
| 32 | #else | ||
| 33 | #define PVR_HELPER_DLL_NAME "libXBMC_pvr-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 34 | #define PVR_HELPER_DLL "/library.xbmc.pvr/" PVR_HELPER_DLL_NAME | ||
| 35 | #endif | ||
| 36 | |||
| 37 | #define DVD_TIME_BASE 1000000 | ||
| 38 | #define DVD_NOPTS_VALUE (-1LL<<52) // should be possible to represent in both double and __int64 | ||
| 39 | |||
| 40 | class CHelper_libXBMC_pvr | ||
| 41 | { | ||
| 42 | public: | ||
| 43 | CHelper_libXBMC_pvr(void) | ||
| 44 | { | ||
| 45 | m_libXBMC_pvr = NULL; | ||
| 46 | m_Handle = NULL; | ||
| 47 | } | ||
| 48 | |||
| 49 | ~CHelper_libXBMC_pvr(void) | ||
| 50 | { | ||
| 51 | if (m_libXBMC_pvr) | ||
| 52 | { | ||
| 53 | PVR_unregister_me(m_Handle, m_Callbacks); | ||
| 54 | dlclose(m_libXBMC_pvr); | ||
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | /*! | ||
| 59 | * @brief Resolve all callback methods | ||
| 60 | * @param handle Pointer to the add-on | ||
| 61 | * @return True when all methods were resolved, false otherwise. | ||
| 62 | */ | ||
| 63 | bool RegisterMe(void* handle) | ||
| 64 | { | ||
| 65 | m_Handle = handle; | ||
| 66 | |||
| 67 | std::string libBasePath; | ||
| 68 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 69 | libBasePath += PVR_HELPER_DLL; | ||
| 70 | |||
| 71 | #if defined(ANDROID) | ||
| 72 | struct stat st; | ||
| 73 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 74 | { | ||
| 75 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 76 | libBasePath = tempbin + "/" + PVR_HELPER_DLL_NAME; | ||
| 77 | } | ||
| 78 | #endif | ||
| 79 | |||
| 80 | m_libXBMC_pvr = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 81 | if (m_libXBMC_pvr == NULL) | ||
| 82 | { | ||
| 83 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 84 | return false; | ||
| 85 | } | ||
| 86 | |||
| 87 | PVR_register_me = (void* (*)(void *HANDLE)) | ||
| 88 | dlsym(m_libXBMC_pvr, "PVR_register_me"); | ||
| 89 | if (PVR_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 90 | |||
| 91 | PVR_unregister_me = (void (*)(void* HANDLE, void* CB)) | ||
| 92 | dlsym(m_libXBMC_pvr, "PVR_unregister_me"); | ||
| 93 | if (PVR_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 94 | |||
| 95 | PVR_transfer_epg_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const EPG_TAG *epgentry)) | ||
| 96 | dlsym(m_libXBMC_pvr, "PVR_transfer_epg_entry"); | ||
| 97 | if (PVR_transfer_epg_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 98 | |||
| 99 | PVR_transfer_channel_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL *chan)) | ||
| 100 | dlsym(m_libXBMC_pvr, "PVR_transfer_channel_entry"); | ||
| 101 | if (PVR_transfer_channel_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 102 | |||
| 103 | PVR_transfer_timer_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_TIMER *timer)) | ||
| 104 | dlsym(m_libXBMC_pvr, "PVR_transfer_timer_entry"); | ||
| 105 | if (PVR_transfer_timer_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 106 | |||
| 107 | PVR_transfer_recording_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_RECORDING *recording)) | ||
| 108 | dlsym(m_libXBMC_pvr, "PVR_transfer_recording_entry"); | ||
| 109 | if (PVR_transfer_recording_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 110 | |||
| 111 | PVR_add_menu_hook = (void (*)(void* HANDLE, void* CB, PVR_MENUHOOK *hook)) | ||
| 112 | dlsym(m_libXBMC_pvr, "PVR_add_menu_hook"); | ||
| 113 | if (PVR_add_menu_hook == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 114 | |||
| 115 | PVR_recording = (void (*)(void* HANDLE, void* CB, const char *Name, const char *FileName, bool On)) | ||
| 116 | dlsym(m_libXBMC_pvr, "PVR_recording"); | ||
| 117 | if (PVR_recording == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 118 | |||
| 119 | PVR_trigger_timer_update = (void (*)(void* HANDLE, void* CB)) | ||
| 120 | dlsym(m_libXBMC_pvr, "PVR_trigger_timer_update"); | ||
| 121 | if (PVR_trigger_timer_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 122 | |||
| 123 | PVR_trigger_recording_update = (void (*)(void* HANDLE, void* CB)) | ||
| 124 | dlsym(m_libXBMC_pvr, "PVR_trigger_recording_update"); | ||
| 125 | if (PVR_trigger_recording_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 126 | |||
| 127 | PVR_trigger_channel_update = (void (*)(void* HANDLE, void* CB)) | ||
| 128 | dlsym(m_libXBMC_pvr, "PVR_trigger_channel_update"); | ||
| 129 | if (PVR_trigger_channel_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 130 | |||
| 131 | PVR_trigger_channel_groups_update = (void (*)(void* HANDLE, void* CB)) | ||
| 132 | dlsym(m_libXBMC_pvr, "PVR_trigger_channel_groups_update"); | ||
| 133 | if (PVR_trigger_channel_groups_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 134 | |||
| 135 | PVR_trigger_epg_update = (void (*)(void* HANDLE, void* CB, unsigned int iChannelUid)) | ||
| 136 | dlsym(m_libXBMC_pvr, "PVR_trigger_epg_update"); | ||
| 137 | if (PVR_trigger_epg_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 138 | |||
| 139 | PVR_transfer_channel_group = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP *group)) | ||
| 140 | dlsym(m_libXBMC_pvr, "PVR_transfer_channel_group"); | ||
| 141 | if (PVR_transfer_channel_group == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 142 | |||
| 143 | PVR_transfer_channel_group_member = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER *member)) | ||
| 144 | dlsym(m_libXBMC_pvr, "PVR_transfer_channel_group_member"); | ||
| 145 | if (PVR_transfer_channel_group_member == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 146 | |||
| 147 | #ifdef USE_DEMUX | ||
| 148 | PVR_free_demux_packet = (void (*)(void* HANDLE, void* CB, DemuxPacket* pPacket)) | ||
| 149 | dlsym(m_libXBMC_pvr, "PVR_free_demux_packet"); | ||
| 150 | if (PVR_free_demux_packet == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 151 | |||
| 152 | PVR_allocate_demux_packet = (DemuxPacket* (*)(void* HANDLE, void* CB, int iDataSize)) | ||
| 153 | dlsym(m_libXBMC_pvr, "PVR_allocate_demux_packet"); | ||
| 154 | if (PVR_allocate_demux_packet == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 155 | #endif | ||
| 156 | |||
| 157 | PVR_connection_state_change = (void (*)(void* HANDLE, void* CB, const char *strConnectionString, PVR_CONNECTION_STATE newState, const char *strMessage)) | ||
| 158 | dlsym(m_libXBMC_pvr, "PVR_connection_state_change"); | ||
| 159 | if (PVR_connection_state_change == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 160 | |||
| 161 | PVR_epg_event_state_change = (void (*)(void* HANDLE, void* CB, EPG_TAG* tag, unsigned int iUniqueChannelId, EPG_EVENT_STATE newState)) | ||
| 162 | dlsym(m_libXBMC_pvr, "PVR_epg_event_state_change"); | ||
| 163 | if (PVR_epg_event_state_change == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 164 | |||
| 165 | m_Callbacks = PVR_register_me(m_Handle); | ||
| 166 | return m_Callbacks != NULL; | ||
| 167 | } | ||
| 168 | |||
| 169 | /*! | ||
| 170 | * @brief Transfer an EPG tag from the add-on to XBMC | ||
| 171 | * @param handle The handle parameter that XBMC used when requesting the EPG data | ||
| 172 | * @param entry The entry to transfer to XBMC | ||
| 173 | */ | ||
| 174 | void TransferEpgEntry(const ADDON_HANDLE handle, const EPG_TAG* entry) | ||
| 175 | { | ||
| 176 | return PVR_transfer_epg_entry(m_Handle, m_Callbacks, handle, entry); | ||
| 177 | } | ||
| 178 | |||
| 179 | /*! | ||
| 180 | * @brief Transfer a channel entry from the add-on to XBMC | ||
| 181 | * @param handle The handle parameter that XBMC used when requesting the channel list | ||
| 182 | * @param entry The entry to transfer to XBMC | ||
| 183 | */ | ||
| 184 | void TransferChannelEntry(const ADDON_HANDLE handle, const PVR_CHANNEL* entry) | ||
| 185 | { | ||
| 186 | return PVR_transfer_channel_entry(m_Handle, m_Callbacks, handle, entry); | ||
| 187 | } | ||
| 188 | |||
| 189 | /*! | ||
| 190 | * @brief Transfer a timer entry from the add-on to XBMC | ||
| 191 | * @param handle The handle parameter that XBMC used when requesting the timers list | ||
| 192 | * @param entry The entry to transfer to XBMC | ||
| 193 | */ | ||
| 194 | void TransferTimerEntry(const ADDON_HANDLE handle, const PVR_TIMER* entry) | ||
| 195 | { | ||
| 196 | return PVR_transfer_timer_entry(m_Handle, m_Callbacks, handle, entry); | ||
| 197 | } | ||
| 198 | |||
| 199 | /*! | ||
| 200 | * @brief Transfer a recording entry from the add-on to XBMC | ||
| 201 | * @param handle The handle parameter that XBMC used when requesting the recordings list | ||
| 202 | * @param entry The entry to transfer to XBMC | ||
| 203 | */ | ||
| 204 | void TransferRecordingEntry(const ADDON_HANDLE handle, const PVR_RECORDING* entry) | ||
| 205 | { | ||
| 206 | return PVR_transfer_recording_entry(m_Handle, m_Callbacks, handle, entry); | ||
| 207 | } | ||
| 208 | |||
| 209 | /*! | ||
| 210 | * @brief Transfer a channel group from the add-on to XBMC. The group will be created if it doesn't exist. | ||
| 211 | * @param handle The handle parameter that XBMC used when requesting the channel groups list | ||
| 212 | * @param entry The entry to transfer to XBMC | ||
| 213 | */ | ||
| 214 | void TransferChannelGroup(const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP* entry) | ||
| 215 | { | ||
| 216 | return PVR_transfer_channel_group(m_Handle, m_Callbacks, handle, entry); | ||
| 217 | } | ||
| 218 | |||
| 219 | /*! | ||
| 220 | * @brief Transfer a channel group member entry from the add-on to XBMC. The channel will be added to the group if the group can be found. | ||
| 221 | * @param handle The handle parameter that XBMC used when requesting the channel group members list | ||
| 222 | * @param entry The entry to transfer to XBMC | ||
| 223 | */ | ||
| 224 | void TransferChannelGroupMember(const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER* entry) | ||
| 225 | { | ||
| 226 | return PVR_transfer_channel_group_member(m_Handle, m_Callbacks, handle, entry); | ||
| 227 | } | ||
| 228 | |||
| 229 | /*! | ||
| 230 | * @brief Add or replace a menu hook for the context menu for this add-on | ||
| 231 | * @param hook The hook to add | ||
| 232 | */ | ||
| 233 | void AddMenuHook(PVR_MENUHOOK* hook) | ||
| 234 | { | ||
| 235 | return PVR_add_menu_hook(m_Handle, m_Callbacks, hook); | ||
| 236 | } | ||
| 237 | |||
| 238 | /*! | ||
| 239 | * @brief Display a notification in XBMC that a recording started or stopped on the server | ||
| 240 | * @param strRecordingName The name of the recording to display | ||
| 241 | * @param strFileName The filename of the recording | ||
| 242 | * @param bOn True when recording started, false when it stopped | ||
| 243 | */ | ||
| 244 | void Recording(const char* strRecordingName, const char* strFileName, bool bOn) | ||
| 245 | { | ||
| 246 | return PVR_recording(m_Handle, m_Callbacks, strRecordingName, strFileName, bOn); | ||
| 247 | } | ||
| 248 | |||
| 249 | /*! | ||
| 250 | * @brief Request XBMC to update it's list of timers | ||
| 251 | */ | ||
| 252 | void TriggerTimerUpdate(void) | ||
| 253 | { | ||
| 254 | return PVR_trigger_timer_update(m_Handle, m_Callbacks); | ||
| 255 | } | ||
| 256 | |||
| 257 | /*! | ||
| 258 | * @brief Request XBMC to update it's list of recordings | ||
| 259 | */ | ||
| 260 | void TriggerRecordingUpdate(void) | ||
| 261 | { | ||
| 262 | return PVR_trigger_recording_update(m_Handle, m_Callbacks); | ||
| 263 | } | ||
| 264 | |||
| 265 | /*! | ||
| 266 | * @brief Request XBMC to update it's list of channels | ||
| 267 | */ | ||
| 268 | void TriggerChannelUpdate(void) | ||
| 269 | { | ||
| 270 | return PVR_trigger_channel_update(m_Handle, m_Callbacks); | ||
| 271 | } | ||
| 272 | |||
| 273 | /*! | ||
| 274 | * @brief Schedule an EPG update for the given channel channel | ||
| 275 | * @param iChannelUid The unique id of the channel for this add-on | ||
| 276 | */ | ||
| 277 | void TriggerEpgUpdate(unsigned int iChannelUid) | ||
| 278 | { | ||
| 279 | return PVR_trigger_epg_update(m_Handle, m_Callbacks, iChannelUid); | ||
| 280 | } | ||
| 281 | |||
| 282 | /*! | ||
| 283 | * @brief Request XBMC to update it's list of channel groups | ||
| 284 | */ | ||
| 285 | void TriggerChannelGroupsUpdate(void) | ||
| 286 | { | ||
| 287 | return PVR_trigger_channel_groups_update(m_Handle, m_Callbacks); | ||
| 288 | } | ||
| 289 | |||
| 290 | #ifdef USE_DEMUX | ||
| 291 | /*! | ||
| 292 | * @brief Free a packet that was allocated with AllocateDemuxPacket | ||
| 293 | * @param pPacket The packet to free | ||
| 294 | */ | ||
| 295 | void FreeDemuxPacket(DemuxPacket* pPacket) | ||
| 296 | { | ||
| 297 | return PVR_free_demux_packet(m_Handle, m_Callbacks, pPacket); | ||
| 298 | } | ||
| 299 | |||
| 300 | /*! | ||
| 301 | * @brief Allocate a demux packet. Free with FreeDemuxPacket | ||
| 302 | * @param iDataSize The size of the data that will go into the packet | ||
| 303 | * @return The allocated packet | ||
| 304 | */ | ||
| 305 | DemuxPacket* AllocateDemuxPacket(int iDataSize) | ||
| 306 | { | ||
| 307 | return PVR_allocate_demux_packet(m_Handle, m_Callbacks, iDataSize); | ||
| 308 | } | ||
| 309 | #endif | ||
| 310 | |||
| 311 | /*! | ||
| 312 | * @brief Notify a state change for a PVR backend connection | ||
| 313 | * @param strConnectionString The connection string reported by the backend that can be displayed in the UI. | ||
| 314 | * @param newState The new state. | ||
| 315 | * @param strMessage A localized addon-defined string representing the new state, that can be displayed | ||
| 316 | * in the UI or NULL if the Kodi-defined default string for the new state shall be displayed. | ||
| 317 | */ | ||
| 318 | void ConnectionStateChange(const char *strConnectionString, PVR_CONNECTION_STATE newState, const char *strMessage) | ||
| 319 | { | ||
| 320 | return PVR_connection_state_change(m_Handle, m_Callbacks, strConnectionString, newState, strMessage); | ||
| 321 | } | ||
| 322 | |||
| 323 | /*! | ||
| 324 | * @brief Notify a state change for an EPG event | ||
| 325 | * @param tag The EPG event. | ||
| 326 | * @param iUniqueChannelId The unique id of the channel for the EPG event | ||
| 327 | * @param newState The new state. For EPG_EVENT_CREATED and EPG_EVENT_UPDATED, tag must be filled with all available | ||
| 328 | * event data, not just a delta. For EPG_EVENT_DELETED, it is sufficient to fill EPG_TAG.iUniqueBroadcastId | ||
| 329 | */ | ||
| 330 | void EpgEventStateChange(EPG_TAG *tag, unsigned int iUniqueChannelId, EPG_EVENT_STATE newState) | ||
| 331 | { | ||
| 332 | return PVR_epg_event_state_change(m_Handle, m_Callbacks, tag, iUniqueChannelId, newState); | ||
| 333 | } | ||
| 334 | |||
| 335 | protected: | ||
| 336 | void* (*PVR_register_me)(void*); | ||
| 337 | void (*PVR_unregister_me)(void*, void*); | ||
| 338 | void (*PVR_transfer_epg_entry)(void*, void*, const ADDON_HANDLE, const EPG_TAG*); | ||
| 339 | void (*PVR_transfer_channel_entry)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL*); | ||
| 340 | void (*PVR_transfer_timer_entry)(void*, void*, const ADDON_HANDLE, const PVR_TIMER*); | ||
| 341 | void (*PVR_transfer_recording_entry)(void*, void*, const ADDON_HANDLE, const PVR_RECORDING*); | ||
| 342 | void (*PVR_add_menu_hook)(void*, void*, PVR_MENUHOOK*); | ||
| 343 | void (*PVR_recording)(void*, void*, const char*, const char*, bool); | ||
| 344 | void (*PVR_trigger_channel_update)(void*, void*); | ||
| 345 | void (*PVR_trigger_channel_groups_update)(void*, void*); | ||
| 346 | void (*PVR_trigger_timer_update)(void*, void*); | ||
| 347 | void (*PVR_trigger_recording_update)(void* , void*); | ||
| 348 | void (*PVR_trigger_epg_update)(void*, void*, unsigned int); | ||
| 349 | void (*PVR_transfer_channel_group)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL_GROUP*); | ||
| 350 | void (*PVR_transfer_channel_group_member)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL_GROUP_MEMBER*); | ||
| 351 | #ifdef USE_DEMUX | ||
| 352 | void (*PVR_free_demux_packet)(void*, void*, DemuxPacket*); | ||
| 353 | DemuxPacket* (*PVR_allocate_demux_packet)(void*, void*, int); | ||
| 354 | #endif | ||
| 355 | void (*PVR_connection_state_change)(void*, void*, const char*, PVR_CONNECTION_STATE, const char*); | ||
| 356 | void (*PVR_epg_event_state_change)(void*, void*, EPG_TAG*, unsigned int, EPG_EVENT_STATE); | ||
| 357 | |||
| 358 | private: | ||
| 359 | void* m_libXBMC_pvr; | ||
| 360 | void* m_Handle; | ||
| 361 | void* m_Callbacks; | ||
| 362 | struct cb_array | ||
| 363 | { | ||
| 364 | const char* libPath; | ||
| 365 | }; | ||
| 366 | }; | ||
diff --git a/xbmc/addons/include/xbmc_addon_cpp_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h index 3944525..2eb972e 100644 --- a/xbmc/addons/include/xbmc_addon_cpp_dll.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h | |||
| @@ -1,9 +1,8 @@ | |||
| 1 | #ifndef __XBMC_ADDON_CPP_H__ | 1 | #pragma once |
| 2 | #define __XBMC_ADDON_CPP_H__ | ||
| 3 | 2 | ||
| 4 | /* | 3 | /* |
| 5 | * Copyright (C) 2005-2013 Team XBMC | 4 | * Copyright (C) 2005-2015 Team Kodi |
| 6 | * http://xbmc.org | 5 | * http://kodi.tv |
| 7 | * | 6 | * |
| 8 | * This Program is free software; you can redistribute it and/or modify | 7 | * This Program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
| @@ -16,7 +15,7 @@ | |||
| 16 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
| 17 | * | 16 | * |
| 18 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License |
| 19 | * along with XBMC; see the file COPYING. If not, see | 18 | * along with Kodi; see the file COPYING. If not, see |
| 20 | * <http://www.gnu.org/licenses/>. | 19 | * <http://www.gnu.org/licenses/>. |
| 21 | * | 20 | * |
| 22 | */ | 21 | */ |
| @@ -105,7 +104,7 @@ public: | |||
| 105 | static unsigned int VecToStruct(std::vector<DllSetting> &vecSet, ADDON_StructSetting*** sSet) | 104 | static unsigned int VecToStruct(std::vector<DllSetting> &vecSet, ADDON_StructSetting*** sSet) |
| 106 | { | 105 | { |
| 107 | *sSet = NULL; | 106 | *sSet = NULL; |
| 108 | if(vecSet.size() == 0) | 107 | if (vecSet.empty()) |
| 109 | return 0; | 108 | return 0; |
| 110 | 109 | ||
| 111 | unsigned int uiElements=0; | 110 | unsigned int uiElements=0; |
| @@ -127,7 +126,7 @@ public: | |||
| 127 | (*sSet)[i]->current = vecSet[i].current; | 126 | (*sSet)[i]->current = vecSet[i].current; |
| 128 | (*sSet)[i]->entry_elements = 0; | 127 | (*sSet)[i]->entry_elements = 0; |
| 129 | (*sSet)[i]->entry = NULL; | 128 | (*sSet)[i]->entry = NULL; |
| 130 | if(vecSet[i].type == DllSetting::SPIN && vecSet[i].entry.size() > 0) | 129 | if(vecSet[i].type == DllSetting::SPIN && !vecSet[i].entry.empty()) |
| 131 | { | 130 | { |
| 132 | (*sSet)[i]->entry = (char**)malloc(vecSet[i].entry.size()*sizeof(char**)); | 131 | (*sSet)[i]->entry = (char**)malloc(vecSet[i].entry.size()*sizeof(char**)); |
| 133 | for(unsigned int j=0;j<vecSet[i].entry.size();j++) | 132 | for(unsigned int j=0;j<vecSet[i].entry.size();j++) |
| @@ -188,4 +187,3 @@ public: | |||
| 188 | } | 187 | } |
| 189 | }; | 188 | }; |
| 190 | 189 | ||
| 191 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_addon_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h index fa6415f..ff7194f 100644 --- a/xbmc/addons/include/xbmc_addon_dll.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h | |||
| @@ -1,9 +1,8 @@ | |||
| 1 | #ifndef __XBMC_ADDON_DLL_H__ | 1 | #pragma once |
| 2 | #define __XBMC_ADDON_DLL_H__ | ||
| 3 | 2 | ||
| 4 | /* | 3 | /* |
| 5 | * Copyright (C) 2005-2013 Team XBMC | 4 | * Copyright (C) 2005-2015 Team Kodi |
| 6 | * http://xbmc.org | 5 | * http://kodi.tv |
| 7 | * | 6 | * |
| 8 | * This Program is free software; you can redistribute it and/or modify | 7 | * This Program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
| @@ -16,7 +15,7 @@ | |||
| 16 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
| 17 | * | 16 | * |
| 18 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License |
| 19 | * along with XBMC; see the file COPYING. If not, see | 18 | * along with Kodi; see the file COPYING. If not, see |
| 20 | * <http://www.gnu.org/licenses/>. | 19 | * <http://www.gnu.org/licenses/>. |
| 21 | * | 20 | * |
| 22 | */ | 21 | */ |
| @@ -51,5 +50,3 @@ extern "C" { | |||
| 51 | #ifdef __cplusplus | 50 | #ifdef __cplusplus |
| 52 | }; | 51 | }; |
| 53 | #endif | 52 | #endif |
| 54 | |||
| 55 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_addon_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h index bd6cbe8..2ceb5c5 100644 --- a/xbmc/addons/include/xbmc_addon_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h | |||
| @@ -1,9 +1,8 @@ | |||
| 1 | #ifndef __XBMC_ADDON_TYPES_H__ | 1 | #pragma once |
| 2 | #define __XBMC_ADDON_TYPES_H__ | ||
| 3 | 2 | ||
| 4 | /* | 3 | /* |
| 5 | * Copyright (C) 2005-2013 Team XBMC | 4 | * Copyright (C) 2005-2015 Team Kodi |
| 6 | * http://xbmc.org | 5 | * http://kodi.tv |
| 7 | * | 6 | * |
| 8 | * This Program is free software; you can redistribute it and/or modify | 7 | * This Program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
| @@ -16,7 +15,7 @@ | |||
| 16 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
| 17 | * | 16 | * |
| 18 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License |
| 19 | * along with XBMC; see the file COPYING. If not, see | 18 | * along with Kodi; see the file COPYING. If not, see |
| 20 | * <http://www.gnu.org/licenses/>. | 19 | * <http://www.gnu.org/licenses/>. |
| 21 | * | 20 | * |
| 22 | */ | 21 | */ |
| @@ -61,4 +60,3 @@ typedef ADDON_HANDLE_STRUCT *ADDON_HANDLE; | |||
| 61 | }; | 60 | }; |
| 62 | #endif | 61 | #endif |
| 63 | 62 | ||
| 64 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_audioenc_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h index 01e8d12..932d34f 100644 --- a/xbmc/addons/include/xbmc_audioenc_dll.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | |||
| 2 | /* | 3 | /* |
| 3 | * Copyright (C) 2005-2013 Team XBMC | 4 | * Copyright (C) 2005-2015 Team Kodi |
| 4 | * http://xbmc.org | 5 | * http://kodi.tv |
| 5 | * | 6 | * |
| 6 | * This Program is free software; you can redistribute it and/or modify | 7 | * This Program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
| @@ -14,14 +15,11 @@ | |||
| 14 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
| 15 | * | 16 | * |
| 16 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License |
| 17 | * along with XBMC; see the file COPYING. If not, see | 18 | * along with Kodi; see the file COPYING. If not, see |
| 18 | * <http://www.gnu.org/licenses/>. | 19 | * <http://www.gnu.org/licenses/>. |
| 19 | * | 20 | * |
| 20 | */ | 21 | */ |
| 21 | 22 | ||
| 22 | #ifndef __XBMC_AUDIOENC_H__ | ||
| 23 | #define __XBMC_AUDIOENC_H__ | ||
| 24 | |||
| 25 | #include <stdint.h> | 23 | #include <stdint.h> |
| 26 | #include "xbmc_addon_dll.h" | 24 | #include "xbmc_addon_dll.h" |
| 27 | #include "xbmc_audioenc_types.h" | 25 | #include "xbmc_audioenc_types.h" |
| @@ -58,4 +56,3 @@ extern "C" | |||
| 58 | }; | 56 | }; |
| 59 | }; | 57 | }; |
| 60 | 58 | ||
| 61 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_audioenc_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h index aa527db..df5164e 100644 --- a/xbmc/addons/include/xbmc_audioenc_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | |||
| 2 | /* | 3 | /* |
| 3 | * Copyright (C) 2005-2013 Team XBMC | 4 | * Copyright (C) 2005-2015 Team Kodi |
| 4 | * http://xbmc.org | 5 | * http://kodi.tv |
| 5 | * | 6 | * |
| 6 | * This Program is free software; you can redistribute it and/or modify | 7 | * This Program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
| @@ -14,14 +15,11 @@ | |||
| 14 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
| 15 | * | 16 | * |
| 16 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License |
| 17 | * along with XBMC; see the file COPYING. If not, see | 18 | * along with Kodi; see the file COPYING. If not, see |
| 18 | * <http://www.gnu.org/licenses/>. | 19 | * <http://www.gnu.org/licenses/>. |
| 19 | * | 20 | * |
| 20 | */ | 21 | */ |
| 21 | 22 | ||
| 22 | #ifndef __AUDIOENC_TYPES_H__ | ||
| 23 | #define __AUDIOENC_TYPES_H__ | ||
| 24 | |||
| 25 | #ifdef TARGET_WINDOWS | 23 | #ifdef TARGET_WINDOWS |
| 26 | #include <windows.h> | 24 | #include <windows.h> |
| 27 | #else | 25 | #else |
| @@ -110,4 +108,3 @@ extern "C" | |||
| 110 | }; | 108 | }; |
| 111 | } | 109 | } |
| 112 | 110 | ||
| 113 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_codec_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h index 98003e0..01e7548 100644 --- a/xbmc/addons/include/xbmc_codec_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h | |||
| @@ -1,9 +1,8 @@ | |||
| 1 | #ifndef __XBMC_CODEC_TYPES_H__ | 1 | #pragma once |
| 2 | #define __XBMC_CODEC_TYPES_H__ | ||
| 3 | 2 | ||
| 4 | /* | 3 | /* |
| 5 | * Copyright (C) 2005-2013 Team XBMC | 4 | * Copyright (C) 2005-2015 Team Kodi |
| 6 | * http://xbmc.org | 5 | * http://kodi.tv |
| 7 | * | 6 | * |
| 8 | * This Program is free software; you can redistribute it and/or modify | 7 | * This Program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
| @@ -16,7 +15,7 @@ | |||
| 16 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
| 17 | * | 16 | * |
| 18 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License |
| 19 | * along with XBMC; see the file COPYING. If not, see | 18 | * along with Kodi; see the file COPYING. If not, see |
| 20 | * <http://www.gnu.org/licenses/>. | 19 | * <http://www.gnu.org/licenses/>. |
| 21 | * | 20 | * |
| 22 | */ | 21 | */ |
| @@ -51,5 +50,3 @@ typedef struct | |||
| 51 | }; | 50 | }; |
| 52 | #endif | 51 | #endif |
| 53 | 52 | ||
| 54 | #endif | ||
| 55 | |||
diff --git a/xbmc/addons/include/xbmc_epg_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h index efd7d13..9460952 100644 --- a/xbmc/addons/include/xbmc_epg_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h | |||
| @@ -59,17 +59,38 @@ | |||
| 59 | //@} | 59 | //@} |
| 60 | 60 | ||
| 61 | /* Set EPGTAG.iGenreType to EPG_GENRE_USE_STRING to transfer genre strings to XBMC */ | 61 | /* Set EPGTAG.iGenreType to EPG_GENRE_USE_STRING to transfer genre strings to XBMC */ |
| 62 | #define EPG_GENRE_USE_STRING 0x100 | 62 | #define EPG_GENRE_USE_STRING 0x100 |
| 63 | 63 | ||
| 64 | #ifdef __cplusplus | 64 | #ifdef __cplusplus |
| 65 | extern "C" { | 65 | extern "C" { |
| 66 | #endif | 66 | #endif |
| 67 | 67 | ||
| 68 | /* EPG_TAG.iFlags values */ | ||
| 69 | const unsigned int EPG_TAG_FLAG_UNDEFINED = 0x00000000; /*!< @brief nothing special to say about this entry */ | ||
| 70 | const unsigned int EPG_TAG_FLAG_IS_SERIES = 0x00000001; /*!< @brief this EPG entry is part of a series */ | ||
| 71 | |||
| 72 | /* Special EPG_TAG.iUniqueBroadcastId value */ | ||
| 73 | |||
| 74 | /*! | ||
| 75 | * @brief special EPG_TAG.iUniqueBroadcastId value to indicate that a tag has not a valid EPG event uid. | ||
| 76 | */ | ||
| 77 | const unsigned int EPG_TAG_INVALID_UID = 0; | ||
| 78 | |||
| 79 | /*! | ||
| 80 | * @brief EPG event states. Used with EpgEventStateChange callback. | ||
| 81 | */ | ||
| 82 | typedef enum | ||
| 83 | { | ||
| 84 | EPG_EVENT_CREATED = 0, /*!< @brief event created */ | ||
| 85 | EPG_EVENT_UPDATED = 1, /*!< @brief event updated */ | ||
| 86 | EPG_EVENT_DELETED = 2, /*!< @brief event deleted */ | ||
| 87 | } EPG_EVENT_STATE; | ||
| 88 | |||
| 68 | /*! | 89 | /*! |
| 69 | * @brief Representation of an EPG event. | 90 | * @brief Representation of an EPG event. |
| 70 | */ | 91 | */ |
| 71 | typedef struct EPG_TAG { | 92 | typedef struct EPG_TAG { |
| 72 | unsigned int iUniqueBroadcastId; /*!< @brief (required) identifier for this event */ | 93 | unsigned int iUniqueBroadcastId; /*!< @brief (required) identifier for this event. Valid uids must be greater than EPG_TAG_INVALID_UID. */ |
| 73 | const char * strTitle; /*!< @brief (required) this event's title */ | 94 | const char * strTitle; /*!< @brief (required) this event's title */ |
| 74 | unsigned int iChannelNumber; /*!< @brief (required) the number of the channel this event occurs on */ | 95 | unsigned int iChannelNumber; /*!< @brief (required) the number of the channel this event occurs on */ |
| 75 | time_t startTime; /*!< @brief (required) start time in UTC */ | 96 | time_t startTime; /*!< @brief (required) start time in UTC */ |
| @@ -94,6 +115,7 @@ extern "C" { | |||
| 94 | int iEpisodeNumber; /*!< @brief (optional) episode number */ | 115 | int iEpisodeNumber; /*!< @brief (optional) episode number */ |
| 95 | int iEpisodePartNumber; /*!< @brief (optional) episode part number */ | 116 | int iEpisodePartNumber; /*!< @brief (optional) episode part number */ |
| 96 | const char * strEpisodeName; /*!< @brief (optional) episode name */ | 117 | const char * strEpisodeName; /*!< @brief (optional) episode name */ |
| 118 | unsigned int iFlags; /*!< @brief (optional) bit field of independent flags associated with the EPG entry */ | ||
| 97 | } ATTRIBUTE_PACKED EPG_TAG; | 119 | } ATTRIBUTE_PACKED EPG_TAG; |
| 98 | 120 | ||
| 99 | #ifdef __cplusplus | 121 | #ifdef __cplusplus |
diff --git a/xbmc/addons/include/xbmc_pvr_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h index 5280399..8b54ea6 100644 --- a/xbmc/addons/include/xbmc_pvr_dll.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 1 | /* | 3 | /* |
| 2 | * Copyright (C) 2005-2013 Team XBMC | 4 | * Copyright (C) 2005-2015 Team Kodi |
| 3 | * http://xbmc.org | 5 | * http://kodi.tv |
| 4 | * | 6 | * |
| 5 | * This Program is free software; you can redistribute it and/or modify | 7 | * This Program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
| @@ -13,14 +15,11 @@ | |||
| 13 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
| 14 | * | 16 | * |
| 15 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License |
| 16 | * along with XBMC; see the file COPYING. If not, see | 18 | * along with Kodi; see the file COPYING. If not, see |
| 17 | * <http://www.gnu.org/licenses/>. | 19 | * <http://www.gnu.org/licenses/>. |
| 18 | * | 20 | * |
| 19 | */ | 21 | */ |
| 20 | 22 | ||
| 21 | #ifndef __XBMC_PVR_H__ | ||
| 22 | #define __XBMC_PVR_H__ | ||
| 23 | |||
| 24 | #include "xbmc_addon_dll.h" | 23 | #include "xbmc_addon_dll.h" |
| 25 | #include "xbmc_pvr_types.h" | 24 | #include "xbmc_pvr_types.h" |
| 26 | 25 | ||
| @@ -53,16 +52,18 @@ extern "C" | |||
| 53 | /*! | 52 | /*! |
| 54 | * Get the XBMC_GUI_API_VERSION that was used to compile this add-on. | 53 | * Get the XBMC_GUI_API_VERSION that was used to compile this add-on. |
| 55 | * Used to check if this add-on is compatible with XBMC. | 54 | * Used to check if this add-on is compatible with XBMC. |
| 56 | * @return The XBMC_GUI_API_VERSION that was used to compile this add-on. | 55 | * @return The XBMC_GUI_API_VERSION that was used to compile this add-on or empty string if this add-on does not depend on Kodi GUI API. |
| 57 | * @remarks Valid implementation required. | 56 | * @remarks Valid implementation required. |
| 57 | * @note see libKODI_guilib.h about related parts | ||
| 58 | */ | 58 | */ |
| 59 | const char* GetGUIAPIVersion(void); | 59 | const char* GetGUIAPIVersion(void); |
| 60 | 60 | ||
| 61 | /*! | 61 | /*! |
| 62 | * Get the XBMC_GUI_MIN_API_VERSION that was used to compile this add-on. | 62 | * Get the XBMC_GUI_MIN_API_VERSION that was used to compile this add-on. |
| 63 | * Used to check if this add-on is compatible with XBMC. | 63 | * Used to check if this add-on is compatible with XBMC. |
| 64 | * @return The XBMC_GUI_MIN_API_VERSION that was used to compile this add-on. | 64 | * @return The XBMC_GUI_MIN_API_VERSION that was used to compile this add-on or empty string if this add-on does not depend on Kodi GUI API. |
| 65 | * @remarks Valid implementation required. | 65 | * @remarks Valid implementation required. |
| 66 | * @note see libKODI_guilib.h about related parts | ||
| 66 | */ | 67 | */ |
| 67 | const char* GetMininumGUIAPIVersion(void); | 68 | const char* GetMininumGUIAPIVersion(void); |
| 68 | 69 | ||
| @@ -330,6 +331,15 @@ extern "C" | |||
| 330 | */ | 331 | */ |
| 331 | PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY edl[], int *size); | 332 | PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY edl[], int *size); |
| 332 | 333 | ||
| 334 | /*! | ||
| 335 | * Retrieve the timer types supported by the backend. | ||
| 336 | * @param types out: The function has to write the definition of the supported timer types into this array. | ||
| 337 | * @param typesCount in: The maximum size of the list, out: the actual size of the list. default: PVR_ADDON_TIMERTYPE_ARRAY_SIZE | ||
| 338 | * @return PVR_ERROR_NO_ERROR if the types were successfully written to the array. | ||
| 339 | * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 340 | */ | ||
| 341 | PVR_ERROR GetTimerTypes(PVR_TIMER_TYPE types[], int *typesCount); | ||
| 342 | |||
| 333 | //@} | 343 | //@} |
| 334 | /** @name PVR timer methods | 344 | /** @name PVR timer methods |
| 335 | * @remarks Only used by XBMC is bSupportsTimers is set to true. | 345 | * @remarks Only used by XBMC is bSupportsTimers is set to true. |
| @@ -426,12 +436,6 @@ extern "C" | |||
| 426 | long long LengthLiveStream(void); | 436 | long long LengthLiveStream(void); |
| 427 | 437 | ||
| 428 | /*! | 438 | /*! |
| 429 | * @return The channel number on the backend of the live stream that's currently being read. | ||
| 430 | * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return -1 if this add-on won't provide this function. | ||
| 431 | */ | ||
| 432 | int GetCurrentClientChannel(void); | ||
| 433 | |||
| 434 | /*! | ||
| 435 | * Switch to another channel. Only to be called when a live stream has already been opened. | 439 | * Switch to another channel. Only to be called when a live stream has already been opened. |
| 436 | * @param channel The channel to switch to. | 440 | * @param channel The channel to switch to. |
| 437 | * @return True if the switch was successful, false otherwise. | 441 | * @return True if the switch was successful, false otherwise. |
| @@ -621,6 +625,29 @@ extern "C" | |||
| 621 | const char* GetBackendHostname(); | 625 | const char* GetBackendHostname(); |
| 622 | 626 | ||
| 623 | /*! | 627 | /*! |
| 628 | * Check if timeshift is active | ||
| 629 | * @return true if timeshift is active | ||
| 630 | */ | ||
| 631 | bool IsTimeshifting(); | ||
| 632 | |||
| 633 | /*! | ||
| 634 | * Check for real-time streaming | ||
| 635 | * @return true if current stream is real-time | ||
| 636 | */ | ||
| 637 | bool IsRealTimeStream(); | ||
| 638 | |||
| 639 | /*! | ||
| 640 | * Tell the client the time frame to use when notifying epg events back to Kodi. The client might push epg events asynchronously | ||
| 641 | * to Kodi using the callback function EpgEventStateChange. To be able to only push events that are actually of interest for Kodi, | ||
| 642 | * client needs to know about the epg time frame Kodi uses. Kodi calls this function once after the client add-on has been sucessfully | ||
| 643 | * initialized and then everytime the time frame value changes. | ||
| 644 | * @param iDays number of days from "now". EPG_TIMEFRAME_UNLIMITED means that Kodi is interested in all epg events, regardless of event times. | ||
| 645 | * @return PVR_ERROR_NO_ERROR if new value was successfully set. | ||
| 646 | * @remarks Required if bSupportsEPG is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 647 | */ | ||
| 648 | PVR_ERROR SetEPGTimeFrame(int iDays); | ||
| 649 | |||
| 650 | /*! | ||
| 624 | * Called by XBMC to assign the function pointers of this add-on to pClient. | 651 | * Called by XBMC to assign the function pointers of this add-on to pClient. |
| 625 | * @param pClient The struct to assign the function pointers to. | 652 | * @param pClient The struct to assign the function pointers to. |
| 626 | */ | 653 | */ |
| @@ -664,6 +691,7 @@ extern "C" | |||
| 664 | pClient->GetRecordingLastPlayedPosition = GetRecordingLastPlayedPosition; | 691 | pClient->GetRecordingLastPlayedPosition = GetRecordingLastPlayedPosition; |
| 665 | pClient->GetRecordingEdl = GetRecordingEdl; | 692 | pClient->GetRecordingEdl = GetRecordingEdl; |
| 666 | 693 | ||
| 694 | pClient->GetTimerTypes = GetTimerTypes; | ||
| 667 | pClient->GetTimersAmount = GetTimersAmount; | 695 | pClient->GetTimersAmount = GetTimersAmount; |
| 668 | pClient->GetTimers = GetTimers; | 696 | pClient->GetTimers = GetTimers; |
| 669 | pClient->AddTimer = AddTimer; | 697 | pClient->AddTimer = AddTimer; |
| @@ -676,7 +704,6 @@ extern "C" | |||
| 676 | pClient->SeekLiveStream = SeekLiveStream; | 704 | pClient->SeekLiveStream = SeekLiveStream; |
| 677 | pClient->PositionLiveStream = PositionLiveStream; | 705 | pClient->PositionLiveStream = PositionLiveStream; |
| 678 | pClient->LengthLiveStream = LengthLiveStream; | 706 | pClient->LengthLiveStream = LengthLiveStream; |
| 679 | pClient->GetCurrentClientChannel = GetCurrentClientChannel; | ||
| 680 | pClient->SwitchChannel = SwitchChannel; | 707 | pClient->SwitchChannel = SwitchChannel; |
| 681 | pClient->SignalStatus = SignalStatus; | 708 | pClient->SignalStatus = SignalStatus; |
| 682 | pClient->GetLiveStreamURL = GetLiveStreamURL; | 709 | pClient->GetLiveStreamURL = GetLiveStreamURL; |
| @@ -704,7 +731,11 @@ extern "C" | |||
| 704 | pClient->GetBufferTimeEnd = GetBufferTimeEnd; | 731 | pClient->GetBufferTimeEnd = GetBufferTimeEnd; |
| 705 | 732 | ||
| 706 | pClient->GetBackendHostname = GetBackendHostname; | 733 | pClient->GetBackendHostname = GetBackendHostname; |
| 734 | |||
| 735 | pClient->IsTimeshifting = IsTimeshifting; | ||
| 736 | pClient->IsRealTimeStream = IsRealTimeStream; | ||
| 737 | |||
| 738 | pClient->SetEPGTimeFrame = SetEPGTimeFrame; | ||
| 707 | }; | 739 | }; |
| 708 | }; | 740 | }; |
| 709 | 741 | ||
| 710 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_pvr_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h index a2e4882..83bb13a 100644 --- a/xbmc/addons/include/xbmc_pvr_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | |||
| 2 | /* | 3 | /* |
| 3 | * Copyright (C) 2005-2013 Team XBMC | 4 | * Copyright (C) 2005-2015 Team Kodi |
| 4 | * http://xbmc.org | 5 | * http://kodi.tv |
| 5 | * | 6 | * |
| 6 | * This Program is free software; you can redistribute it and/or modify | 7 | * This Program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
| @@ -14,14 +15,11 @@ | |||
| 14 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
| 15 | * | 16 | * |
| 16 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License |
| 17 | * along with XBMC; see the file COPYING. If not, see | 18 | * along with Kodi; see the file COPYING. If not, see |
| 18 | * <http://www.gnu.org/licenses/>. | 19 | * <http://www.gnu.org/licenses/>. |
| 19 | * | 20 | * |
| 20 | */ | 21 | */ |
| 21 | 22 | ||
| 22 | #ifndef __PVRCLIENT_TYPES_H__ | ||
| 23 | #define __PVRCLIENT_TYPES_H__ | ||
| 24 | |||
| 25 | #ifdef TARGET_WINDOWS | 23 | #ifdef TARGET_WINDOWS |
| 26 | #include <windows.h> | 24 | #include <windows.h> |
| 27 | #else | 25 | #else |
| @@ -65,26 +63,111 @@ struct DemuxPacket; | |||
| 65 | #define PRAGMA_PACK 1 | 63 | #define PRAGMA_PACK 1 |
| 66 | #endif | 64 | #endif |
| 67 | 65 | ||
| 68 | #define PVR_ADDON_NAME_STRING_LENGTH 1024 | 66 | #define PVR_ADDON_NAME_STRING_LENGTH 1024 |
| 69 | #define PVR_ADDON_URL_STRING_LENGTH 1024 | 67 | #define PVR_ADDON_URL_STRING_LENGTH 1024 |
| 70 | #define PVR_ADDON_DESC_STRING_LENGTH 1024 | 68 | #define PVR_ADDON_DESC_STRING_LENGTH 1024 |
| 71 | #define PVR_ADDON_INPUT_FORMAT_STRING_LENGTH 32 | 69 | #define PVR_ADDON_INPUT_FORMAT_STRING_LENGTH 32 |
| 72 | #define PVR_ADDON_EDL_LENGTH 32 | 70 | #define PVR_ADDON_EDL_LENGTH 32 |
| 71 | #define PVR_ADDON_TIMERTYPE_ARRAY_SIZE 32 | ||
| 72 | #define PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE 512 | ||
| 73 | #define PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE_SMALL 128 | ||
| 74 | #define PVR_ADDON_TIMERTYPE_STRING_LENGTH 64 | ||
| 73 | 75 | ||
| 74 | /* using the default avformat's MAX_STREAMS value to be safe */ | 76 | /* using the default avformat's MAX_STREAMS value to be safe */ |
| 75 | #define PVR_STREAM_MAX_STREAMS 20 | 77 | #define PVR_STREAM_MAX_STREAMS 20 |
| 76 | 78 | ||
| 77 | /* current PVR API version */ | 79 | /* current PVR API version */ |
| 78 | #define XBMC_PVR_API_VERSION "1.9.6" | 80 | #define XBMC_PVR_API_VERSION "5.0.0" |
| 79 | 81 | ||
| 80 | /* min. PVR API version */ | 82 | /* min. PVR API version */ |
| 81 | #define XBMC_PVR_MIN_API_VERSION "1.9.6" | 83 | #define XBMC_PVR_MIN_API_VERSION "5.0.0" |
| 82 | 84 | ||
| 83 | #ifdef __cplusplus | 85 | #ifdef __cplusplus |
| 84 | extern "C" { | 86 | extern "C" { |
| 85 | #endif | 87 | #endif |
| 86 | 88 | ||
| 87 | /*! | 89 | /*! |
| 90 | * @brief numeric PVR timer type definitions (PVR_TIMER.iTimerType values) | ||
| 91 | */ | ||
| 92 | const unsigned int PVR_TIMER_TYPE_NONE = 0; /*!< @brief "Null" value for a numeric timer type. */ | ||
| 93 | |||
| 94 | /*! | ||
| 95 | * @brief special PVR_TIMER.iClientIndex value to indicate that a timer has not (yet) a valid client index. | ||
| 96 | */ | ||
| 97 | const unsigned int PVR_TIMER_NO_CLIENT_INDEX = 0; /*!< @brief timer has not (yet) a valid client index. */ | ||
| 98 | |||
| 99 | /*! | ||
| 100 | * @brief special PVR_TIMER.iParentClientIndex value to indicate that a timer has no parent. | ||
| 101 | */ | ||
| 102 | const unsigned int PVR_TIMER_NO_PARENT = PVR_TIMER_NO_CLIENT_INDEX; /*!< @brief timer has no parent; it was not scheduled by a repeating timer. */ | ||
| 103 | |||
| 104 | /*! | ||
| 105 | * @brief special PVR_TIMER.iEpgUid value to indicate that a timer has no EPG event uid. | ||
| 106 | */ | ||
| 107 | const unsigned int PVR_TIMER_NO_EPG_UID = EPG_TAG_INVALID_UID; /*!< @brief timer has no EPG event uid. */ | ||
| 108 | |||
| 109 | /*! | ||
| 110 | * @brief special PVR_TIMER.iClientChannelUid value to indicate "any channel". Useful for some repeating timer types. | ||
| 111 | */ | ||
| 112 | const int PVR_TIMER_ANY_CHANNEL = -1; /*!< @brief denotes "any channel", not a specific one. */ | ||
| 113 | |||
| 114 | /*! | ||
| 115 | * @brief PVR timer type attributes (PVR_TIMER_TYPE.iAttributes values) | ||
| 116 | */ | ||
| 117 | const unsigned int PVR_TIMER_TYPE_ATTRIBUTE_NONE = 0x00000000; | ||
| 118 | |||
| 119 | const unsigned int PVR_TIMER_TYPE_IS_MANUAL = 0x00000001; /*!< @brief defines whether this is a type for manual (time-based) or epg-based timers */ | ||
| 120 | const unsigned int PVR_TIMER_TYPE_IS_REPEATING = 0x00000002; /*!< @brief defines whether this is a type for repeating or one-shot timers */ | ||
| 121 | const unsigned int PVR_TIMER_TYPE_IS_READONLY = 0x00000004; /*!< @brief timers of this type must not be edited by Kodi */ | ||
| 122 | const unsigned int PVR_TIMER_TYPE_FORBIDS_NEW_INSTANCES = 0x00000008; /*!< @brief timers of this type must not be created by Kodi. All other operations are allowed, though */ | ||
| 123 | |||
| 124 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE = 0x00000010; /*!< @brief this type supports enabling/disabling of the timer (PVR_TIMER.state SCHEDULED|DISBALED) */ | ||
| 125 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_CHANNELS = 0x00000020; /*!< @brief this type supports channels (PVR_TIMER.iClientChannelUid) */ | ||
| 126 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_START_TIME = 0x00000040; /*!< @brief this type supports a recording start time (PVR_TIMER.startTime) */ | ||
| 127 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_TITLE_EPG_MATCH = 0x00000080; /*!< @brief this type supports matching epg episode title using PVR_TIMER.strEpgSearchString */ | ||
| 128 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_FULLTEXT_EPG_MATCH = 0x00000100; /*!< @brief this type supports matching "more" epg data (not just episode title) using PVR_TIMER.strEpgSearchString. Setting FULLTEXT_EPG_MATCH implies TITLE_EPG_MATCH */ | ||
| 129 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_FIRST_DAY = 0x00000200; /*!< @brief this type supports a first day the timer gets active (PVR_TIMER.firstday) */ | ||
| 130 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_WEEKDAYS = 0x00000400; /*!< @brief this type supports weekdays for defining the recording schedule (PVR_TIMER.iWeekdays) */ | ||
| 131 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_RECORD_ONLY_NEW_EPISODES = 0x00000800; /*!< @brief this type supports the "record only new episodes" feature (PVR_TIMER.iPreventDuplicateEpisodes) */ | ||
| 132 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_START_END_MARGIN = 0x00001000; /*!< @brief this type supports pre and post record time (PVR_TIMER.iMarginStart, PVR_TIMER.iMarginEnd) */ | ||
| 133 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_PRIORITY = 0x00002000; /*!< @brief this type supports recording priority (PVR_TIMER.iPriority) */ | ||
| 134 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_LIFETIME = 0x00004000; /*!< @brief this type supports recording lifetime (PVR_TIMER.iLifetime) */ | ||
| 135 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_RECORDING_FOLDERS = 0x00008000; /*!< @brief this type supports placing recordings in user defined folders (PVR_TIMER.strDirectory) */ | ||
| 136 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_RECORDING_GROUP = 0x00010000; /*!< @brief this type supports a list of recording groups (PVR_TIMER.iRecordingGroup) */ | ||
| 137 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_END_TIME = 0x00020000; /*!< @brief this type supports a recording end time (PVR_TIMER.endTime) */ | ||
| 138 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_START_ANYTIME = 0x00040000; /*!< @brief enables an 'Any Time' over-ride option for startTime (using PVR_TIMER.bStartAnyTime) */ | ||
| 139 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_END_ANYTIME = 0x00080000; /*!< @brief enables a separate 'Any Time' over-ride for endTime (using PVR_TIMER.bEndAnyTime) */ | ||
| 140 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_MAX_RECORDINGS = 0x00100000; /*!< @brief this type supports specifying a maximum recordings setting' (PVR_TIMER.iMaxRecordings) */ | ||
| 141 | const unsigned int PVR_TIMER_TYPE_REQUIRES_EPG_TAG_ON_CREATE = 0x00200000; /*!< @brief this type shold not appear on any create menus which don't provide an associated EPG tag */ | ||
| 142 | const unsigned int PVR_TIMER_TYPE_FORBIDS_EPG_TAG_ON_CREATE = 0x00400000; /*!< @brief this type should not appear on any create menus which provide an associated EPG tag */ | ||
| 143 | const unsigned int PVR_TIMER_TYPE_REQUIRES_EPG_SERIES_ON_CREATE = 0x00800000; /*!< @brief this type should not appear on any create menus unless associated with an EPG tag with 'series' attributes (EPG_TAG.iFlags & EPG_TAG_FLAG_IS_SERIES || EPG_TAG.iSeriesNumber > 0 || EPG_TAG.iEpisodeNumber > 0 || EPG_TAG.iEpisodePartNumber > 0). Implies PVR_TIMER_TYPE_REQUIRES_EPG_TAG_ON_CREATE */ | ||
| 144 | |||
| 145 | /*! | ||
| 146 | * @brief PVR timer weekdays (PVR_TIMER.iWeekdays values) | ||
| 147 | */ | ||
| 148 | const unsigned int PVR_WEEKDAY_NONE = 0x00; | ||
| 149 | const unsigned int PVR_WEEKDAY_MONDAY = 0x01; | ||
| 150 | const unsigned int PVR_WEEKDAY_TUESDAY = 0x02; | ||
| 151 | const unsigned int PVR_WEEKDAY_WEDNESDAY = 0x04; | ||
| 152 | const unsigned int PVR_WEEKDAY_THURSDAY = 0x08; | ||
| 153 | const unsigned int PVR_WEEKDAY_FRIDAY = 0x10; | ||
| 154 | const unsigned int PVR_WEEKDAY_SATURDAY = 0x20; | ||
| 155 | const unsigned int PVR_WEEKDAY_SUNDAY = 0x40; | ||
| 156 | const unsigned int PVR_WEEKDAY_ALLDAYS = PVR_WEEKDAY_MONDAY | PVR_WEEKDAY_TUESDAY | PVR_WEEKDAY_WEDNESDAY | | ||
| 157 | PVR_WEEKDAY_THURSDAY | PVR_WEEKDAY_FRIDAY | PVR_WEEKDAY_SATURDAY | | ||
| 158 | PVR_WEEKDAY_SUNDAY; | ||
| 159 | |||
| 160 | /*! | ||
| 161 | * @brief timeframe value for use with SetEPGTimeFrame function to indicate "no timeframe". | ||
| 162 | */ | ||
| 163 | const int EPG_TIMEFRAME_UNLIMITED = -1; | ||
| 164 | |||
| 165 | /*! | ||
| 166 | * @brief special PVR_TIMER.iClientChannelUid and PVR_RECORDING.iChannelUid value to indicate that no channel uid is available. | ||
| 167 | */ | ||
| 168 | const int PVR_CHANNEL_INVALID_UID = -1; /*!< @brief denotes that no channel uid is avaliable. */ | ||
| 169 | |||
| 170 | /*! | ||
| 88 | * @brief PVR add-on error codes | 171 | * @brief PVR add-on error codes |
| 89 | */ | 172 | */ |
| 90 | typedef enum | 173 | typedef enum |
| @@ -106,7 +189,7 @@ extern "C" { | |||
| 106 | */ | 189 | */ |
| 107 | typedef enum | 190 | typedef enum |
| 108 | { | 191 | { |
| 109 | PVR_TIMER_STATE_NEW = 0, /*!< @brief a new, unsaved timer */ | 192 | PVR_TIMER_STATE_NEW = 0, /*!< @brief the timer was just created on the backend and is not yet active. This state must not be used for timers just created on the client side. */ |
| 110 | PVR_TIMER_STATE_SCHEDULED = 1, /*!< @brief the timer is scheduled for recording */ | 193 | PVR_TIMER_STATE_SCHEDULED = 1, /*!< @brief the timer is scheduled for recording */ |
| 111 | PVR_TIMER_STATE_RECORDING = 2, /*!< @brief the timer is currently recordings */ | 194 | PVR_TIMER_STATE_RECORDING = 2, /*!< @brief the timer is currently recordings */ |
| 112 | PVR_TIMER_STATE_COMPLETED = 3, /*!< @brief the recording completed successfully */ | 195 | PVR_TIMER_STATE_COMPLETED = 3, /*!< @brief the recording completed successfully */ |
| @@ -114,7 +197,8 @@ extern "C" { | |||
| 114 | PVR_TIMER_STATE_CANCELLED = 5, /*!< @brief the timer was scheduled, but was canceled */ | 197 | PVR_TIMER_STATE_CANCELLED = 5, /*!< @brief the timer was scheduled, but was canceled */ |
| 115 | PVR_TIMER_STATE_CONFLICT_OK = 6, /*!< @brief the scheduled timer conflicts with another one, but will be recorded */ | 198 | PVR_TIMER_STATE_CONFLICT_OK = 6, /*!< @brief the scheduled timer conflicts with another one, but will be recorded */ |
| 116 | PVR_TIMER_STATE_CONFLICT_NOK = 7, /*!< @brief the scheduled timer conflicts with another one and won't be recorded */ | 199 | PVR_TIMER_STATE_CONFLICT_NOK = 7, /*!< @brief the scheduled timer conflicts with another one and won't be recorded */ |
| 117 | PVR_TIMER_STATE_ERROR = 8 /*!< @brief the timer is scheduled, but can't be recorded for some reason */ | 200 | PVR_TIMER_STATE_ERROR = 8, /*!< @brief the timer is scheduled, but can't be recorded for some reason */ |
| 201 | PVR_TIMER_STATE_DISABLED = 9, /*!< @brief the timer was disabled by the user, can be enabled via setting the state to PVR_TIMER_STATE_SCHEDULED */ | ||
| 118 | } PVR_TIMER_STATE; | 202 | } PVR_TIMER_STATE; |
| 119 | 203 | ||
| 120 | /*! | 204 | /*! |
| @@ -133,6 +217,20 @@ extern "C" { | |||
| 133 | } PVR_MENUHOOK_CAT; | 217 | } PVR_MENUHOOK_CAT; |
| 134 | 218 | ||
| 135 | /*! | 219 | /*! |
| 220 | * @brief PVR backend connection states. Used with ConnectionStateChange callback. | ||
| 221 | */ | ||
| 222 | typedef enum | ||
| 223 | { | ||
| 224 | PVR_CONNECTION_STATE_UNKNOWN = 0, /*!< @brief unknown state (e.g. not yet tried to connect) */ | ||
| 225 | PVR_CONNECTION_STATE_SERVER_UNREACHABLE = 1, /*!< @brief backend server is not reachable (e.g. server not existing or network down)*/ | ||
| 226 | PVR_CONNECTION_STATE_SERVER_MISMATCH = 2, /*!< @brief backend server is reachable, but there is not the expected type of server running (e.g. HTSP required, but FTP running at given server:port) */ | ||
| 227 | PVR_CONNECTION_STATE_VERSION_MISMATCH = 3, /*!< @brief backend server is reachable, but server version does not match client requirements */ | ||
| 228 | PVR_CONNECTION_STATE_ACCESS_DENIED = 4, /*!< @brief backend server is reachable, but denies client access (e.g. due to wrong credentials) */ | ||
| 229 | PVR_CONNECTION_STATE_CONNECTED = 5, /*!< @brief connection to backend server is established */ | ||
| 230 | PVR_CONNECTION_STATE_DISCONNECTED = 6, /*!< @brief no connection to backend server (e.g. due to network errors or client initiated disconnect)*/ | ||
| 231 | } PVR_CONNECTION_STATE; | ||
| 232 | |||
| 233 | /*! | ||
| 136 | * @brief Properties passed to the Create() method of an add-on. | 234 | * @brief Properties passed to the Create() method of an add-on. |
| 137 | */ | 235 | */ |
| 138 | typedef struct PVR_PROPERTIES | 236 | typedef struct PVR_PROPERTIES |
| @@ -158,7 +256,6 @@ extern "C" { | |||
| 158 | bool bSupportsChannelSettings; /*!< @brief true if this add-on supports the following functions: DeleteChannel, RenameChannel, MoveChannel, DialogChannelSettings and DialogAddChannel */ | 256 | bool bSupportsChannelSettings; /*!< @brief true if this add-on supports the following functions: DeleteChannel, RenameChannel, MoveChannel, DialogChannelSettings and DialogAddChannel */ |
| 159 | bool bHandlesInputStream; /*!< @brief true if this add-on provides an input stream. false if XBMC handles the stream. */ | 257 | bool bHandlesInputStream; /*!< @brief true if this add-on provides an input stream. false if XBMC handles the stream. */ |
| 160 | bool bHandlesDemuxing; /*!< @brief true if this add-on demultiplexes packets. */ | 258 | bool bHandlesDemuxing; /*!< @brief true if this add-on demultiplexes packets. */ |
| 161 | bool bSupportsRecordingFolders; /*!< @brief true if the backend supports timers / recordings in folders. */ | ||
| 162 | bool bSupportsRecordingPlayCount; /*!< @brief true if the backend supports play count for recordings. */ | 259 | bool bSupportsRecordingPlayCount; /*!< @brief true if the backend supports play count for recordings. */ |
| 163 | bool bSupportsLastPlayedPosition; /*!< @brief true if the backend supports store/retrieve of last played position for recordings. */ | 260 | bool bSupportsLastPlayedPosition; /*!< @brief true if the backend supports store/retrieve of last played position for recordings. */ |
| 164 | bool bSupportsRecordingEdl; /*!< @brief true if the backend supports retrieving an edit decision list for recordings. */ | 261 | bool bSupportsRecordingEdl; /*!< @brief true if the backend supports retrieving an edit decision list for recordings. */ |
| @@ -204,9 +301,6 @@ extern "C" { | |||
| 204 | int iSignal; /*!< @brief (optional) signal strength */ | 301 | int iSignal; /*!< @brief (optional) signal strength */ |
| 205 | long iBER; /*!< @brief (optional) bit error rate */ | 302 | long iBER; /*!< @brief (optional) bit error rate */ |
| 206 | long iUNC; /*!< @brief (optional) uncorrected blocks */ | 303 | long iUNC; /*!< @brief (optional) uncorrected blocks */ |
| 207 | double dVideoBitrate; /*!< @brief (optional) video bitrate */ | ||
| 208 | double dAudioBitrate; /*!< @brief (optional) audio bitrate */ | ||
| 209 | double dDolbyBitrate; /*!< @brief (optional) dolby bitrate */ | ||
| 210 | } ATTRIBUTE_PACKED PVR_SIGNAL_STATUS; | 304 | } ATTRIBUTE_PACKED PVR_SIGNAL_STATUS; |
| 211 | 305 | ||
| 212 | /*! | 306 | /*! |
| @@ -255,34 +349,117 @@ extern "C" { | |||
| 255 | } ATTRIBUTE_PACKED PVR_CHANNEL_GROUP_MEMBER; | 349 | } ATTRIBUTE_PACKED PVR_CHANNEL_GROUP_MEMBER; |
| 256 | 350 | ||
| 257 | /*! | 351 | /*! |
| 352 | * @brief Representation of a timer's attribute integer value. | ||
| 353 | */ | ||
| 354 | typedef struct PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE | ||
| 355 | { | ||
| 356 | int iValue; /*!< @brief (required) an integer value for a certain timer attribute */ | ||
| 357 | char strDescription[PVR_ADDON_TIMERTYPE_STRING_LENGTH]; /*!< @brief (optional) a localized string describing the value. If left blank, Kodi will | ||
| 358 | generate a suitable representation (like the integer value as string) */ | ||
| 359 | } ATTRIBUTE_PACKED PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE; | ||
| 360 | |||
| 361 | /*! | ||
| 362 | * @brief Representation of a timer type. | ||
| 363 | */ | ||
| 364 | typedef struct PVR_TIMER_TYPE | ||
| 365 | { | ||
| 366 | unsigned int iId; /*!< @brief (required) this type's identifier. Ids must be > PVR_TIMER_TYPE_NONE. */ | ||
| 367 | unsigned int iAttributes; /*!< @brief (required) defines the attributes for this type (PVR_TIMER_TYPE_* constants). */ | ||
| 368 | char strDescription[PVR_ADDON_TIMERTYPE_STRING_LENGTH]; /*!< @brief (optional) a short localized string describing the purpose of the type. (e.g. | ||
| 369 | "Any time at this channel if title matches"). If left blank, Kodi will generate a | ||
| 370 | description based on the attributes REPEATING and MANUAL. (e.g. "Repeating EPG-based." */ | ||
| 371 | /* priority value definitions */ | ||
| 372 | unsigned int iPrioritiesSize; /*!< @brief (required) Count of possible values for PVR_TMER.iPriority. 0 means priority | ||
| 373 | is not supported by this timer type or no own value definition wanted, but to use Kodi defaults | ||
| 374 | of 1..100. */ | ||
| 375 | PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE | ||
| 376 | priorities[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; /*!< @brief (optional) Array containing the possible values for PVR_TMER.iPriority. Must be | ||
| 377 | filled if iPrioritiesSize > 0 */ | ||
| 378 | int iPrioritiesDefault; /*!< @brief (optional) The default value for PVR_TMER.iPriority. Must be filled if iPrioritiesSize > 0 */ | ||
| 379 | |||
| 380 | /* lifetime value definitions */ | ||
| 381 | unsigned int iLifetimesSize; /*!< @brief (required) Count of possible values for PVR_TMER.iLifetime. 0 means lifetime | ||
| 382 | is not supported by this timer type or no own value definition wanted, but to use Kodi defaults | ||
| 383 | of 1..365. */ | ||
| 384 | PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE | ||
| 385 | lifetimes[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; /*!< @brief (optional) Array containing the possible values for PVR_TMER.iLifetime. Must be | ||
| 386 | filled if iLifetimesSize > 0 */ | ||
| 387 | int iLifetimesDefault; /*!< @brief (optional) The default value for PVR_TMER.iLifetime. Must be filled if iLifetimesSize > 0 */ | ||
| 388 | |||
| 389 | /* prevent duplicate episodes value definitions */ | ||
| 390 | unsigned int iPreventDuplicateEpisodesSize; /*!< @brief (required) Count of possible values for PVR_TMER.iPreventDuplicateEpisodes. 0 means duplicate | ||
| 391 | episodes prevention is not supported by this timer type or no own value definition wanted, but to use | ||
| 392 | Kodi defaults. */ | ||
| 393 | PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE | ||
| 394 | preventDuplicateEpisodes[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; | ||
| 395 | /*!< @brief (optional) Array containing the possible values for PVR_TMER.iPreventDuplicateEpisodes.. Must | ||
| 396 | be filled if iPreventDuplicateEpisodesSize > 0 */ | ||
| 397 | unsigned int iPreventDuplicateEpisodesDefault; /*!< @brief (optional) The default value for PVR_TMER.iPreventDuplicateEpisodesSize. Must be filled if iPreventDuplicateEpisodesSize > 0 */ | ||
| 398 | |||
| 399 | /* recording folder list value definitions */ | ||
| 400 | unsigned int iRecordingGroupSize; /*!< @brief (required) Count of possible values of PVR_TIMER.iRecordingGroup. 0 means folder lists are not supported by this timer type */ | ||
| 401 | PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE | ||
| 402 | recordingGroup[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; | ||
| 403 | /*!< @brief (optional) Array containing the possible values of PVR_TMER.iRecordingGroup. Must be filled if iRecordingGroupSize > 0 */ | ||
| 404 | unsigned int iRecordingGroupDefault; /*!< @brief (optional) The default value for PVR_TIMER.iRecordingGroup. Must be filled in if PVR_TIMER.iRecordingGroupSize > 0 */ | ||
| 405 | |||
| 406 | /* max recordings value definitions */ | ||
| 407 | unsigned int iMaxRecordingsSize; /*!< @brief (required) Count of possible values of PVR_TIMER.iMaxRecordings. 0 means max recordings are not supported by this timer type */ | ||
| 408 | PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE | ||
| 409 | maxRecordings[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE_SMALL]; | ||
| 410 | /*!< @brief (optional) Array containing the possible values of PVR_TMER.iMaxRecordings. */ | ||
| 411 | int iMaxRecordingsDefault; /*!< @brief (optional) The default value for PVR_TIMER.iMaxRecordings. Must be filled in if PVR_TIMER.iMaxRecordingsSize > 0 */ | ||
| 412 | |||
| 413 | } ATTRIBUTE_PACKED PVR_TIMER_TYPE; | ||
| 414 | |||
| 415 | /*! | ||
| 258 | * @brief Representation of a timer event. | 416 | * @brief Representation of a timer event. |
| 259 | */ | 417 | */ |
| 260 | typedef struct PVR_TIMER { | 418 | typedef struct PVR_TIMER { |
| 261 | unsigned int iClientIndex; /*!< @brief (required) the index of this timer given by the client */ | 419 | unsigned int iClientIndex; /*!< @brief (required) the index of this timer given by the client. PVR_TIMER_NO_CLIENT_INDEX indicates that the index was not yet set by the client, for example for new timers created by |
| 262 | int iClientChannelUid; /*!< @brief (required) unique identifier of the channel to record on */ | 420 | Kodi and passed the first time to the client. A valid index must be greater than PVR_TIMER_NO_CLIENT_INDEX. */ |
| 263 | time_t startTime; /*!< @brief (required) start time of the recording in UTC. instant timers that are sent to the add-on by xbmc will have this value set to 0 */ | 421 | unsigned int iParentClientIndex; /*!< @brief (optional) for timers scheduled by a repeating timer, the index of the repeating timer that scheduled this timer (it's PVR_TIMER.iClientIndex value). Use PVR_TIMER_NO_PARENT |
| 264 | time_t endTime; /*!< @brief (required) end time of the recording in UTC */ | 422 | to indicate that this timer was no scheduled by a repeating timer. */ |
| 423 | int iClientChannelUid; /*!< @brief (optional) unique identifier of the channel to record on. PVR_TIMER_ANY_CHANNEL will denote "any channel", not a specific one. PVR_CHANNEL_INVALID_UID denotes that channel uid is not available.*/ | ||
| 424 | time_t startTime; /*!< @brief (optional) start time of the recording in UTC. Instant timers that are sent to the add-on by Kodi will have this value set to 0.*/ | ||
| 425 | time_t endTime; /*!< @brief (optional) end time of the recording in UTC. */ | ||
| 426 | bool bStartAnyTime; /*!< @brief (optional) for EPG based (not Manual) timers indicates startTime does not apply. Default = false */ | ||
| 427 | bool bEndAnyTime; /*!< @brief (optional) for EPG based (not Manual) timers indicates endTime does not apply. Default = false */ | ||
| 265 | PVR_TIMER_STATE state; /*!< @brief (required) the state of this timer */ | 428 | PVR_TIMER_STATE state; /*!< @brief (required) the state of this timer */ |
| 266 | char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) title of this timer */ | 429 | unsigned int iTimerType; /*!< @brief (required) the type of this timer. It is private to the addon and can be freely defined by the addon. The value must be greater than PVR_TIMER_TYPE_NONE. |
| 267 | char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) the directory where the recording will be stored in */ | 430 | Kodi does not interpret this value (except for checking for PVR_TIMER_TYPE_NONE), but will pass the right id to the addon with every PVR_TIMER instance, thus the addon easily can determine |
| 431 | the timer type. */ | ||
| 432 | char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) a title for this timer */ | ||
| 433 | char strEpgSearchString[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) a string used to search epg data for repeating epg-based timers. Format is backend-dependent, for example regexp */ | ||
| 434 | bool bFullTextEpgSearch; /*!< @brief (optional) indicates, whether strEpgSearchString is to match against the epg episode title only or also against "other" epg data (backend-dependent) */ | ||
| 435 | char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) the (relative) directory where the recording will be stored in */ | ||
| 268 | char strSummary[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) the summary for this timer */ | 436 | char strSummary[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) the summary for this timer */ |
| 269 | int iPriority; /*!< @brief (optional) the priority of this timer */ | 437 | int iPriority; /*!< @brief (optional) the priority of this timer */ |
| 270 | int iLifetime; /*!< @brief (optional) lifetimer of this timer in days */ | 438 | int iLifetime; /*!< @brief (optional) lifetime of recordings created by this timer. > 0 days after which recordings will be deleted by the backend, < 0 addon defined integer list reference, == 0 disabled */ |
| 271 | bool bIsRepeating; /*!< @brief (optional) true if this is a recurring timer */ | 439 | int iMaxRecordings; /*!< @brief (optional) maximum number of recordings this timer shall create. > 0 number of recordings, < 0 addon defined integer list reference, == 0 disabled */ |
| 272 | time_t firstDay; /*!< @brief (optional) the first day this recording is active in case of a repeating event */ | 440 | unsigned int iRecordingGroup; /*!< @brief (optional) integer ref to addon/backend defined list of recording groups*/ |
| 273 | int iWeekdays; /*!< @brief (optional) weekday mask */ | 441 | time_t firstDay; /*!< @brief (optional) the first day this timer is active, for repeating timers */ |
| 274 | int iEpgUid; /*!< @brief (optional) epg event id */ | 442 | unsigned int iWeekdays; /*!< @brief (optional) week days, for repeating timers */ |
| 443 | unsigned int iPreventDuplicateEpisodes; /*!< @brief (optional) 1 if backend should only record new episodes in case of a repeating epg-based timer, 0 if all episodes shall be recorded (no duplicate detection). Actual algorithm for | ||
| 444 | duplicate detection is defined by the backend. Addons may define own values for different duplicate detection algorithms, thus this is not just a bool.*/ | ||
| 445 | unsigned int iEpgUid; /*!< @brief (optional) EPG event id associated with this timer. Valid ids must be greater than EPG_TAG_INVALID_UID. */ | ||
| 275 | unsigned int iMarginStart; /*!< @brief (optional) if set, the backend starts the recording iMarginStart minutes before startTime. */ | 446 | unsigned int iMarginStart; /*!< @brief (optional) if set, the backend starts the recording iMarginStart minutes before startTime. */ |
| 276 | unsigned int iMarginEnd; /*!< @brief (optional) if set, the backend ends the recording iMarginEnd minutes after endTime. */ | 447 | unsigned int iMarginEnd; /*!< @brief (optional) if set, the backend ends the recording iMarginEnd minutes after endTime. */ |
| 277 | int iGenreType; /*!< @brief (optional) genre type */ | 448 | int iGenreType; /*!< @brief (optional) genre type */ |
| 278 | int iGenreSubType; /*!< @brief (optional) genre sub type */ | 449 | int iGenreSubType; /*!< @brief (optional) genre sub type */ |
| 279 | } ATTRIBUTE_PACKED PVR_TIMER; | 450 | } ATTRIBUTE_PACKED PVR_TIMER; |
| 451 | |||
| 280 | /*! | 452 | /*! |
| 281 | * @brief Representation of a recording. | 453 | * @brief Representation of a recording. |
| 282 | */ | 454 | */ |
| 283 | typedef struct PVR_RECORDING { | 455 | typedef struct PVR_RECORDING { |
| 284 | char strRecordingId[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) unique id of the recording on the client. */ | 456 | char strRecordingId[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) unique id of the recording on the client. */ |
| 285 | char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) the title of this recording */ | 457 | char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) the title of this recording */ |
| 458 | char strEpisodeName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) episode name (also known as subtitle) */ | ||
| 459 | int iSeriesNumber; /*!< @brief (optional) series number (usually called season). Set to "0" for specials/pilot. For 'invalid' see iEpisodeNumber or set to -1 */ | ||
| 460 | int iEpisodeNumber; /*!< @brief (optional) episode number within the "iSeriesNumber" season. For 'invalid' set to -1 or iSeriesNumber=iEpisodeNumber=0 to show both are invalid */ | ||
| 461 | int iYear; /*!< @brief (optional) year of first release (use to identify a specific movie re-make) / first airing for TV shows. Set to '0' for invalid. */ | ||
| 462 | |||
| 286 | char strStreamURL[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (required) stream URL to access this recording */ | 463 | char strStreamURL[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (required) stream URL to access this recording */ |
| 287 | char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) directory of this recording on the client */ | 464 | char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) directory of this recording on the client */ |
| 288 | char strPlotOutline[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot outline */ | 465 | char strPlotOutline[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot outline */ |
| @@ -300,7 +477,8 @@ extern "C" { | |||
| 300 | int iPlayCount; /*!< @brief (optional) play count of this recording on the client */ | 477 | int iPlayCount; /*!< @brief (optional) play count of this recording on the client */ |
| 301 | int iLastPlayedPosition; /*!< @brief (optional) last played position of this recording on the client */ | 478 | int iLastPlayedPosition; /*!< @brief (optional) last played position of this recording on the client */ |
| 302 | bool bIsDeleted; /*!< @brief (optional) shows this recording is deleted and can be undelete */ | 479 | bool bIsDeleted; /*!< @brief (optional) shows this recording is deleted and can be undelete */ |
| 303 | unsigned int iEpgEventId; /*!< @brief (optional) EPG event id associated with this recording */ | 480 | unsigned int iEpgEventId; /*!< @brief (optional) EPG event id associated with this recording. Valid ids must be greater than EPG_TAG_INVALID_UID. */ |
| 481 | int iChannelUid; /*!< @brief (optional) unique identifier of the channel for this recording. PVR_CHANNEL_INVALID_UID denotes that channel uid is not available. */ | ||
| 304 | } ATTRIBUTE_PACKED PVR_RECORDING; | 482 | } ATTRIBUTE_PACKED PVR_RECORDING; |
| 305 | 483 | ||
| 306 | /*! | 484 | /*! |
| @@ -373,6 +551,7 @@ extern "C" { | |||
| 373 | PVR_ERROR (__cdecl* SetRecordingLastPlayedPosition)(const PVR_RECORDING&, int); | 551 | PVR_ERROR (__cdecl* SetRecordingLastPlayedPosition)(const PVR_RECORDING&, int); |
| 374 | int (__cdecl* GetRecordingLastPlayedPosition)(const PVR_RECORDING&); | 552 | int (__cdecl* GetRecordingLastPlayedPosition)(const PVR_RECORDING&); |
| 375 | PVR_ERROR (__cdecl* GetRecordingEdl)(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*); | 553 | PVR_ERROR (__cdecl* GetRecordingEdl)(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*); |
| 554 | PVR_ERROR (__cdecl* GetTimerTypes)(PVR_TIMER_TYPE[], int*); | ||
| 376 | int (__cdecl* GetTimersAmount)(void); | 555 | int (__cdecl* GetTimersAmount)(void); |
| 377 | PVR_ERROR (__cdecl* GetTimers)(ADDON_HANDLE); | 556 | PVR_ERROR (__cdecl* GetTimers)(ADDON_HANDLE); |
| 378 | PVR_ERROR (__cdecl* AddTimer)(const PVR_TIMER&); | 557 | PVR_ERROR (__cdecl* AddTimer)(const PVR_TIMER&); |
| @@ -384,7 +563,6 @@ extern "C" { | |||
| 384 | long long (__cdecl* SeekLiveStream)(long long, int); | 563 | long long (__cdecl* SeekLiveStream)(long long, int); |
| 385 | long long (__cdecl* PositionLiveStream)(void); | 564 | long long (__cdecl* PositionLiveStream)(void); |
| 386 | long long (__cdecl* LengthLiveStream)(void); | 565 | long long (__cdecl* LengthLiveStream)(void); |
| 387 | int (__cdecl* GetCurrentClientChannel)(void); | ||
| 388 | bool (__cdecl* SwitchChannel)(const PVR_CHANNEL&); | 566 | bool (__cdecl* SwitchChannel)(const PVR_CHANNEL&); |
| 389 | PVR_ERROR (__cdecl* SignalStatus)(PVR_SIGNAL_STATUS&); | 567 | PVR_ERROR (__cdecl* SignalStatus)(PVR_SIGNAL_STATUS&); |
| 390 | const char* (__cdecl* GetLiveStreamURL)(const PVR_CHANNEL&); | 568 | const char* (__cdecl* GetLiveStreamURL)(const PVR_CHANNEL&); |
| @@ -408,10 +586,12 @@ extern "C" { | |||
| 408 | time_t (__cdecl* GetBufferTimeStart)(void); | 586 | time_t (__cdecl* GetBufferTimeStart)(void); |
| 409 | time_t (__cdecl* GetBufferTimeEnd)(void); | 587 | time_t (__cdecl* GetBufferTimeEnd)(void); |
| 410 | const char* (__cdecl* GetBackendHostname)(void); | 588 | const char* (__cdecl* GetBackendHostname)(void); |
| 589 | bool (__cdecl* IsTimeshifting)(void); | ||
| 590 | bool (__cdecl* IsRealTimeStream)(void); | ||
| 591 | PVR_ERROR (__cdecl* SetEPGTimeFrame)(int); | ||
| 411 | } PVRClient; | 592 | } PVRClient; |
| 412 | 593 | ||
| 413 | #ifdef __cplusplus | 594 | #ifdef __cplusplus |
| 414 | } | 595 | } |
| 415 | #endif | 596 | #endif |
| 416 | 597 | ||
| 417 | #endif //__PVRCLIENT_TYPES_H__ | ||
diff --git a/xbmc/addons/include/xbmc_scr_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h index c4257b4..8652a0a 100644 --- a/xbmc/addons/include/xbmc_scr_dll.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | |||
| 2 | /* | 3 | /* |
| 3 | * Copyright (C) 2005-2013 Team XBMC | 4 | * Copyright (C) 2005-2015 Team Kodi |
| 4 | * http://xbmc.org | 5 | * http://kodi.tv |
| 5 | * | 6 | * |
| 6 | * This Program is free software; you can redistribute it and/or modify | 7 | * This Program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
| @@ -14,14 +15,11 @@ | |||
| 14 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
| 15 | * | 16 | * |
| 16 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License |
| 17 | * along with XBMC; see the file COPYING. If not, see | 18 | * along with Kodi; see the file COPYING. If not, see |
| 18 | * <http://www.gnu.org/licenses/>. | 19 | * <http://www.gnu.org/licenses/>. |
| 19 | * | 20 | * |
| 20 | */ | 21 | */ |
| 21 | 22 | ||
| 22 | #ifndef __XBMC_SCR_H__ | ||
| 23 | #define __XBMC_SCR_H__ | ||
| 24 | |||
| 25 | #include "xbmc_addon_dll.h" | 23 | #include "xbmc_addon_dll.h" |
| 26 | #include "xbmc_scr_types.h" | 24 | #include "xbmc_scr_types.h" |
| 27 | 25 | ||
| @@ -42,4 +40,3 @@ extern "C" | |||
| 42 | }; | 40 | }; |
| 43 | }; | 41 | }; |
| 44 | 42 | ||
| 45 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_scr_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h index fec3040..5785b25 100644 --- a/xbmc/addons/include/xbmc_scr_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | |||
| 2 | /* | 3 | /* |
| 3 | * Copyright (C) 2005-2013 Team XBMC | 4 | * Copyright (C) 2005-2015 Team Kodi |
| 4 | * http://xbmc.org | 5 | * http://kodi.tv |
| 5 | * | 6 | * |
| 6 | * This Program is free software; you can redistribute it and/or modify | 7 | * This Program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
| @@ -14,14 +15,11 @@ | |||
| 14 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
| 15 | * | 16 | * |
| 16 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License |
| 17 | * along with XBMC; see the file COPYING. If not, see | 18 | * along with Kodi; see the file COPYING. If not, see |
| 18 | * <http://www.gnu.org/licenses/>. | 19 | * <http://www.gnu.org/licenses/>. |
| 19 | * | 20 | * |
| 20 | */ | 21 | */ |
| 21 | 22 | ||
| 22 | #ifndef __SCREENSAVER_TYPES_H__ | ||
| 23 | #define __SCREENSAVER_TYPES_H__ | ||
| 24 | |||
| 25 | extern "C" | 23 | extern "C" |
| 26 | { | 24 | { |
| 27 | struct SCR_INFO | 25 | struct SCR_INFO |
| @@ -50,4 +48,3 @@ extern "C" | |||
| 50 | }; | 48 | }; |
| 51 | } | 49 | } |
| 52 | 50 | ||
| 53 | #endif // __SCREENSAVER_TYPES_H__ | ||
diff --git a/xbmc/addons/include/xbmc_stream_utils.hpp b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp index 927fe33..099776a 100644 --- a/xbmc/addons/include/xbmc_stream_utils.hpp +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp | |||
| @@ -160,7 +160,7 @@ namespace ADDON | |||
| 160 | { | 160 | { |
| 161 | XbmcPvrStream *foundStream = GetStreamById(iPhysicalId); | 161 | XbmcPvrStream *foundStream = GetStreamById(iPhysicalId); |
| 162 | if (foundStream) | 162 | if (foundStream) |
| 163 | stream = foundStream; | 163 | *stream = *foundStream; |
| 164 | else | 164 | else |
| 165 | { | 165 | { |
| 166 | stream->iIdentifier = -1; | 166 | stream->iIdentifier = -1; |
diff --git a/xbmc/addons/include/xbmc_vis_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h index c65f844..50452c2 100644 --- a/xbmc/addons/include/xbmc_vis_dll.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h | |||
| @@ -1,9 +1,8 @@ | |||
| 1 | #ifndef __XBMC_VIS_H__ | 1 | #pragma once |
| 2 | #define __XBMC_VIS_H__ | ||
| 3 | 2 | ||
| 4 | /* | 3 | /* |
| 5 | * Copyright (C) 2005-2013 Team XBMC | 4 | * Copyright (C) 2005-2015 Team Kodi |
| 6 | * http://xbmc.org | 5 | * http://kodi.tv |
| 7 | * | 6 | * |
| 8 | * This Program is free software; you can redistribute it and/or modify | 7 | * This Program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
| @@ -16,7 +15,7 @@ | |||
| 16 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
| 17 | * | 16 | * |
| 18 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License |
| 19 | * along with XBMC; see the file COPYING. If not, see | 18 | * along with Kodi; see the file COPYING. If not, see |
| 20 | * <http://www.gnu.org/licenses/>. | 19 | * <http://www.gnu.org/licenses/>. |
| 21 | * | 20 | * |
| 22 | */ | 21 | */ |
| @@ -52,4 +51,3 @@ extern "C" | |||
| 52 | }; | 51 | }; |
| 53 | }; | 52 | }; |
| 54 | 53 | ||
| 55 | #endif | ||
diff --git a/xbmc/addons/include/xbmc_vis_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h index e6b0ccd..708ffef 100644 --- a/xbmc/addons/include/xbmc_vis_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 1 | /* | 3 | /* |
| 2 | * Copyright (C) 2005-2013 Team XBMC | 4 | * Copyright (C) 2005-2015 Team Kodi |
| 3 | * http://xbmc.org | 5 | * http://kodi.tv |
| 4 | * | 6 | * |
| 5 | * This Program is free software; you can redistribute it and/or modify | 7 | * This Program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
| @@ -13,17 +15,15 @@ | |||
| 13 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
| 14 | * | 16 | * |
| 15 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License |
| 16 | * along with XBMC; see the file COPYING. If not, see | 18 | * along with Kodi; see the file COPYING. If not, see |
| 17 | * <http://www.gnu.org/licenses/>. | 19 | * <http://www.gnu.org/licenses/>. |
| 18 | * | 20 | * |
| 19 | */ | 21 | */ |
| 20 | 22 | ||
| 21 | /* | 23 | /* |
| 22 | Common data structures shared between XBMC and XBMC's visualisations | 24 | Common data structures shared between Kodi and Kodi's visualisations |
| 23 | */ | 25 | */ |
| 24 | 26 | ||
| 25 | #ifndef __VISUALISATION_TYPES_H__ | ||
| 26 | #define __VISUALISATION_TYPES_H__ | ||
| 27 | #include <cstddef> | 27 | #include <cstddef> |
| 28 | 28 | ||
| 29 | extern "C" | 29 | extern "C" |
| @@ -108,4 +108,3 @@ extern "C" | |||
| 108 | }; | 108 | }; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | #endif //__VISUALISATION_TYPES_H__ | ||
diff --git a/xbmc/cores/AudioEngine/Utils/AEChannelData.h b/xbmc/cores/AudioEngine/Utils/AEChannelData.h index 9993c84..c74aabb 100644 --- a/xbmc/cores/AudioEngine/Utils/AEChannelData.h +++ b/xbmc/cores/AudioEngine/Utils/AEChannelData.h | |||
| @@ -105,14 +105,8 @@ enum AEDataFormat | |||
| 105 | AE_FMT_DOUBLE, | 105 | AE_FMT_DOUBLE, |
| 106 | AE_FMT_FLOAT, | 106 | AE_FMT_FLOAT, |
| 107 | 107 | ||
| 108 | /* Bitstream formats */ | 108 | // Bitstream |
| 109 | AE_FMT_AAC, | 109 | AE_FMT_RAW, |
| 110 | AE_FMT_AC3, | ||
| 111 | AE_FMT_DTS, | ||
| 112 | AE_FMT_EAC3, | ||
| 113 | AE_FMT_TRUEHD, | ||
| 114 | AE_FMT_DTSHD, | ||
| 115 | AE_FMT_LPCM, | ||
| 116 | 110 | ||
| 117 | /* planar formats */ | 111 | /* planar formats */ |
| 118 | AE_FMT_U8P, | 112 | AE_FMT_U8P, |
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h new file mode 100644 index 0000000..d64fbb3 --- /dev/null +++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2012-2013 Team XBMC | ||
| 5 | * http://xbmc.org | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with XBMC; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #define DMX_SPECIALID_STREAMINFO -10 | ||
| 24 | #define DMX_SPECIALID_STREAMCHANGE -11 | ||
| 25 | |||
| 26 | typedef struct DemuxPacket | ||
| 27 | { | ||
| 28 | unsigned char* pData; // data | ||
| 29 | int iSize; // data size | ||
| 30 | int iStreamId; // integer representing the stream index | ||
| 31 | int iGroupId; // the group this data belongs to, used to group data from different streams together | ||
| 32 | |||
| 33 | double pts; // pts in DVD_TIME_BASE | ||
| 34 | double dts; // dts in DVD_TIME_BASE | ||
| 35 | double duration; // duration in DVD_TIME_BASE if available | ||
| 36 | } DemuxPacket; | ||
diff --git a/xbmc/filesystem/IFileTypes.h b/xbmc/filesystem/IFileTypes.h new file mode 100644 index 0000000..d2d77eb --- /dev/null +++ b/xbmc/filesystem/IFileTypes.h | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2013 Team XBMC | ||
| 3 | * http://xbmc.org | ||
| 4 | * | ||
| 5 | * This Program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This Program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with XBMC; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | #pragma once | ||
| 22 | |||
| 23 | #include <stdint.h> | ||
| 24 | |||
| 25 | namespace XFILE | ||
| 26 | { | ||
| 27 | |||
| 28 | /* indicate that caller can handle truncated reads, where function returns before entire buffer has been filled */ | ||
| 29 | static const unsigned int READ_TRUNCATED = 0x01; | ||
| 30 | |||
| 31 | /* indicate that that caller support read in the minimum defined chunk size, this disables internal cache then */ | ||
| 32 | static const unsigned int READ_CHUNKED = 0x02; | ||
| 33 | |||
| 34 | /* use cache to access this file */ | ||
| 35 | static const unsigned int READ_CACHED = 0x04; | ||
| 36 | |||
| 37 | /* open without caching. regardless to file type. */ | ||
| 38 | static const unsigned int READ_NO_CACHE = 0x08; | ||
| 39 | |||
| 40 | /* calcuate bitrate for file while reading */ | ||
| 41 | static const unsigned int READ_BITRATE = 0x10; | ||
| 42 | |||
| 43 | /* indicate to the caller we will seek between multiple streams in the file frequently */ | ||
| 44 | static const unsigned int READ_MULTI_STREAM = 0x20; | ||
| 45 | |||
| 46 | /* indicate to the caller file is audio and/or video (and e.g. may grow) */ | ||
| 47 | static const unsigned int READ_AUDIO_VIDEO = 0x40; | ||
| 48 | |||
| 49 | /* indicate that caller will do write operations before reading */ | ||
| 50 | static const unsigned int READ_AFTER_WRITE = 0x80; | ||
| 51 | |||
| 52 | struct SNativeIoControl | ||
| 53 | { | ||
| 54 | unsigned long int request; | ||
| 55 | void* param; | ||
| 56 | }; | ||
| 57 | |||
| 58 | struct SCacheStatus | ||
| 59 | { | ||
| 60 | uint64_t forward; /**< number of bytes cached forward of current position */ | ||
| 61 | unsigned maxrate; /**< maximum number of bytes per second cache is allowed to fill */ | ||
| 62 | unsigned currate; /**< average read rate from source file since last position change */ | ||
| 63 | bool full; /**< is the cache full */ | ||
| 64 | }; | ||
| 65 | |||
| 66 | typedef enum { | ||
| 67 | IOCTRL_NATIVE = 1, /**< SNativeIoControl structure, containing what should be passed to native ioctrl */ | ||
| 68 | IOCTRL_SEEK_POSSIBLE = 2, /**< return 0 if known not to work, 1 if it should work */ | ||
| 69 | IOCTRL_CACHE_STATUS = 3, /**< SCacheStatus structure */ | ||
| 70 | IOCTRL_CACHE_SETRATE = 4, /**< unsigned int with speed limit for caching in bytes per second */ | ||
| 71 | IOCTRL_SET_CACHE = 8, /** <CFileCache */ | ||
| 72 | } EIoControl; | ||
| 73 | |||
| 74 | enum CURLOPTIONTYPE | ||
| 75 | { | ||
| 76 | CURL_OPTION_OPTION, /**< Set a general option */ | ||
| 77 | CURL_OPTION_PROTOCOL, /**< Set a protocol option */ | ||
| 78 | CURL_OPTION_CREDENTIALS,/**< Set User and password */ | ||
| 79 | CURL_OPTION_HEADER /**< Add a Header */ | ||
| 80 | }; | ||
| 81 | |||
| 82 | } | ||
