From 9fc8b732737f139d3e466510d75668ab45578960 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 8 Mar 2016 21:02:53 +0100 Subject: sync with upstream --- project/cmake/CMakeLists.txt | 367 +++++++++ project/cmake/README.md | 166 ++++ project/cmake/addons/CMakeLists.txt | 156 +++- project/cmake/addons/README | 28 +- .../addons/audioencoder.flac/audioencoder.flac.txt | 1 - .../addons/addons/audioencoder.flac/platforms.txt | 1 - .../addons/audioencoder.lame/audioencoder.lame.txt | 1 - .../addons/addons/audioencoder.lame/platforms.txt | 1 - .../audioencoder.vorbis/audioencoder.vorbis.txt | 1 - .../addons/audioencoder.vorbis/platforms.txt | 1 - .../addons/audioencoder.wav/audioencoder.wav.txt | 1 - .../addons/addons/audioencoder.wav/platforms.txt | 1 - .../cmake/addons/addons/pvr.argustv/platforms.txt | 1 - .../addons/addons/pvr.argustv/pvr.argustv.txt | 1 - project/cmake/addons/addons/pvr.demo/platforms.txt | 1 - project/cmake/addons/addons/pvr.demo/pvr.demo.txt | 1 - .../cmake/addons/addons/pvr.dvblink/platforms.txt | 1 - .../addons/addons/pvr.dvblink/pvr.dvblink.txt | 1 - .../addons/addons/pvr.dvbviewer/platforms.txt | 1 - .../addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt | 1 - .../cmake/addons/addons/pvr.filmon/platforms.txt | 1 - .../cmake/addons/addons/pvr.filmon/pvr.filmon.txt | 1 - project/cmake/addons/addons/pvr.hts/platforms.txt | 1 - project/cmake/addons/addons/pvr.hts/pvr.hts.txt | 1 - .../addons/addons/pvr.iptvsimple/platforms.txt | 1 - .../addons/pvr.iptvsimple/pvr.iptvsimple.txt | 1 - .../addons/pvr.mediaportal.tvserver/platforms.txt | 1 - .../pvr.mediaportal.tvserver.txt | 1 - .../cmake/addons/addons/pvr.mythtv/platforms.txt | 1 - .../cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt | 1 - .../cmake/addons/addons/pvr.nextpvr/platforms.txt | 1 - .../addons/addons/pvr.nextpvr/pvr.nextpvr.txt | 1 - project/cmake/addons/addons/pvr.njoy/platforms.txt | 1 - project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt | 1 - project/cmake/addons/addons/pvr.pctv/platforms.txt | 1 - project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt | 1 - .../cmake/addons/addons/pvr.vdr.vnsi/platforms.txt | 1 - .../addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt | 1 - .../cmake/addons/addons/pvr.vuplus/platforms.txt | 1 - .../cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt | 1 - project/cmake/addons/addons/pvr.wmc/platforms.txt | 1 - project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt | 1 - project/cmake/addons/bootstrap/CMakeLists.txt | 95 +++ project/cmake/addons/bootstrap/README.md | 48 ++ project/cmake/addons/bootstrap/bootstrap.cmake | 38 + .../bootstrap/repositories/binary-addons.txt | 1 + .../addons/depends/common/kodi-platform/deps.txt | 4 +- .../depends/common/kodi-platform/kodi-platform.txt | 2 +- .../depends/common/p8-platform/p8-platform.txt | 1 + .../addons/depends/common/tinyxml/tinyxml.txt | 2 +- project/cmake/installdata/addon-bindings.txt | 28 + project/cmake/installdata/common/addons.txt | 40 + project/cmake/installdata/common/common.txt | 13 + project/cmake/installdata/darwin/runtime.txt | 1 + project/cmake/installdata/linux/lirc.txt | 1 + project/cmake/installdata/test-reference-data.txt | 10 + project/cmake/installdata/windows/addons.txt | 1 + project/cmake/installdata/windows/dlls.txt | 6 + project/cmake/installdata/windows/irss.txt | 2 + project/cmake/kodi-config.cmake.in | 22 +- project/cmake/modules/FindAML.cmake | 35 + project/cmake/modules/FindASS.cmake | 18 + project/cmake/modules/FindAlsa.cmake | 20 + project/cmake/modules/FindAvahi.cmake | 26 + project/cmake/modules/FindBluray.cmake | 57 ++ project/cmake/modules/FindCCache.cmake | 6 + project/cmake/modules/FindCEC.cmake | 58 ++ project/cmake/modules/FindCXX11.cmake | 18 + project/cmake/modules/FindCdio.cmake | 20 + project/cmake/modules/FindCpluff.cmake | 46 ++ project/cmake/modules/FindCrossGUID.cmake | 56 ++ project/cmake/modules/FindCurl.cmake | 37 + project/cmake/modules/FindD3DX11Effects.cmake | 49 ++ project/cmake/modules/FindDbus.cmake | 21 + project/cmake/modules/FindEGL.cmake | 48 ++ project/cmake/modules/FindEMBEDDED.cmake | 17 + project/cmake/modules/FindFFMPEG.cmake | 99 +++ project/cmake/modules/FindFreeType.cmake | 18 + project/cmake/modules/FindFribidi.cmake | 18 + project/cmake/modules/FindGIF.cmake | 46 ++ project/cmake/modules/FindJsonSchemaBuilder.cmake | 19 + project/cmake/modules/FindLibDvd.cmake | 116 +++ project/cmake/modules/FindLibSmbClient.cmake | 65 ++ project/cmake/modules/FindLibUSB.cmake | 45 ++ project/cmake/modules/FindLzo2.cmake | 22 + project/cmake/modules/FindMMAL.cmake | 36 + project/cmake/modules/FindMicroHttpd.cmake | 106 +++ project/cmake/modules/FindMySqlClient.cmake | 53 ++ project/cmake/modules/FindNFS.cmake | 58 ++ project/cmake/modules/FindOpenGLES.cmake | 48 ++ project/cmake/modules/FindOpenGl.cmake | 43 ++ project/cmake/modules/FindPCRE.cmake | 91 +++ project/cmake/modules/FindPlist.cmake | 58 ++ project/cmake/modules/FindPulseAudio.cmake | 72 ++ project/cmake/modules/FindPython.cmake | 43 ++ project/cmake/modules/FindRTMP.cmake | 21 + project/cmake/modules/FindSSE.cmake | 105 +++ project/cmake/modules/FindSSH.cmake | 21 + project/cmake/modules/FindSWIG.cmake | 14 + project/cmake/modules/FindSdl.cmake | 46 ++ project/cmake/modules/FindShairplay.cmake | 63 ++ project/cmake/modules/FindSqlite3.cmake | 19 + project/cmake/modules/FindTagLib.cmake | 62 ++ project/cmake/modules/FindTexturePacker.cmake | 23 + project/cmake/modules/FindTinyXML.cmake | 68 ++ project/cmake/modules/FindUDev.cmake | 22 + project/cmake/modules/FindUUID.cmake | 43 ++ project/cmake/modules/FindVAAPI.cmake | 47 ++ project/cmake/modules/FindVDPAU.cmake | 32 + project/cmake/modules/FindX.cmake | 21 + project/cmake/modules/FindXRandR.cmake | 22 + project/cmake/modules/FindXslt.cmake | 18 + project/cmake/modules/FindYajl.cmake | 27 + project/cmake/modules/FindZip.cmake | 46 ++ project/cmake/platform/darwin/defines.txt | 1 - project/cmake/platform/osx/defines.txt | 1 + project/cmake/scripts/android/archsetup.cmake | 30 + project/cmake/scripts/android/install.cmake | 0 project/cmake/scripts/android/macros.cmake | 1 + project/cmake/scripts/android/pathsetup.cmake | 1 + project/cmake/scripts/common/addon-helpers.cmake | 80 +- project/cmake/scripts/common/archsetup.cmake | 99 +++ project/cmake/scripts/common/checkcommits.cmake | 75 ++ .../scripts/common/generateversionedfiles.cmake | 13 + project/cmake/scripts/common/generatorsetup.cmake | 24 + project/cmake/scripts/common/macros.cmake | 373 +++++++++ project/cmake/scripts/common/managestring.cmake | 235 ++++++ project/cmake/scripts/common/pathsetup.cmake | 3 + project/cmake/scripts/common/prepare-env.cmake | 33 +- project/cmake/scripts/common/projectmacros.cmake | 84 ++ project/cmake/scripts/darwin/archsetup.cmake | 34 + project/cmake/scripts/darwin/install.cmake | 0 project/cmake/scripts/darwin/macros.cmake | 108 +++ project/cmake/scripts/darwin/pathsetup.cmake | 32 + project/cmake/scripts/freebsd/archsetup.cmake | 19 + project/cmake/scripts/freebsd/install.cmake | 58 ++ project/cmake/scripts/freebsd/macros.cmake | 1 + project/cmake/scripts/freebsd/pathsetup.cmake | 1 + project/cmake/scripts/ios/archsetup.cmake | 38 + project/cmake/scripts/ios/install.cmake | 1 + project/cmake/scripts/ios/macros.cmake | 1 + project/cmake/scripts/ios/pathsetup.cmake | 1 + project/cmake/scripts/linux/archsetup.cmake | 21 + project/cmake/scripts/linux/install.cmake | 93 +++ project/cmake/scripts/linux/macros.cmake | 79 ++ project/cmake/scripts/linux/pathsetup.cmake | 34 + project/cmake/scripts/rbpi/archsetup.cmake | 32 + project/cmake/scripts/rbpi/install.cmake | 1 + project/cmake/scripts/rbpi/macros.cmake | 1 + project/cmake/scripts/rbpi/pathsetup.cmake | 1 + project/cmake/scripts/windows/archsetup.cmake | 91 +++ project/cmake/scripts/windows/install.cmake | 0 project/cmake/scripts/windows/macros.cmake | 143 ++++ project/cmake/scripts/windows/pathsetup.cmake | 34 + project/cmake/treedata/android/subdirs.txt | 16 + project/cmake/treedata/common/addons.txt | 7 + project/cmake/treedata/common/cores.txt | 8 + project/cmake/treedata/common/events.txt | 2 + project/cmake/treedata/common/externals.txt | 3 + project/cmake/treedata/common/filesystem.txt | 3 + project/cmake/treedata/common/interfaces.txt | 9 + project/cmake/treedata/common/music.txt | 5 + project/cmake/treedata/common/network.txt | 6 + project/cmake/treedata/common/peripherals.txt | 4 + project/cmake/treedata/common/profiles.txt | 3 + project/cmake/treedata/common/pvr.txt | 7 + project/cmake/treedata/common/settings.txt | 4 + project/cmake/treedata/common/subdirs.txt | 25 + project/cmake/treedata/common/tests.txt | 10 + project/cmake/treedata/common/video.txt | 5 + project/cmake/treedata/common/videoplayer.txt | 12 + project/cmake/treedata/darwin/subdirs.txt | 12 + project/cmake/treedata/freebsd/subdirs.txt | 4 + project/cmake/treedata/ios/subdirs.txt | 15 + project/cmake/treedata/linux/subdirs.txt | 12 + project/cmake/treedata/optional/common/X11.txt | 1 + project/cmake/treedata/optional/common/cec.txt | 1 + project/cmake/treedata/optional/common/nonfree.txt | 1 + project/cmake/treedata/optional/common/opengl.txt | 1 + .../cmake/treedata/optional/common/opengles.txt | 1 + project/cmake/treedata/rbpi/omxplayer.txt | 1 + project/cmake/treedata/rbpi/subdirs.txt | 12 + project/cmake/treedata/windows/subdirs.txt | 15 + scripts/sync_buildenv.sh | 6 +- version.txt | 10 +- xbmc/addons/addon-bindings.mk | 51 +- xbmc/addons/include/kodi_audiodec_dll.h | 60 -- xbmc/addons/include/kodi_audiodec_types.h | 101 --- xbmc/addons/include/xbmc_addon_cpp_dll.h | 191 ----- xbmc/addons/include/xbmc_addon_dll.h | 55 -- xbmc/addons/include/xbmc_addon_types.h | 64 -- xbmc/addons/include/xbmc_audioenc_dll.h | 61 -- xbmc/addons/include/xbmc_audioenc_types.h | 113 --- xbmc/addons/include/xbmc_codec_types.h | 55 -- xbmc/addons/include/xbmc_epg_types.h | 101 --- xbmc/addons/include/xbmc_pvr_dll.h | 710 ----------------- xbmc/addons/include/xbmc_pvr_types.h | 417 ---------- xbmc/addons/include/xbmc_scr_dll.h | 45 -- xbmc/addons/include/xbmc_scr_types.h | 53 -- xbmc/addons/include/xbmc_stream_utils.hpp | 264 ------- xbmc/addons/include/xbmc_vis_dll.h | 55 -- xbmc/addons/include/xbmc_vis_types.h | 111 --- .../include/kodi/kodi_adsp_dll.h | 564 ++++++++++++++ .../include/kodi/kodi_adsp_types.h | 524 +++++++++++++ .../include/kodi/kodi_audiodec_dll.h | 60 ++ .../include/kodi/kodi_audiodec_types.h | 101 +++ .../include/kodi/kodi_audioengine_types.h | 165 ++++ .../include/kodi/kodi_inputstream_dll.h | 257 +++++++ .../include/kodi/kodi_inputstream_types.h | 161 ++++ .../kodi-addon-dev-kit/include/kodi/libKODI_adsp.h | 232 ++++++ .../include/kodi/libKODI_audioengine.h | 324 ++++++++ .../include/kodi/libKODI_guilib.h | 845 +++++++++++++++++++++ .../include/kodi/libKODI_inputstream.h | 150 ++++ .../include/kodi/libXBMC_addon.h | 710 +++++++++++++++++ .../include/kodi/libXBMC_codec.h | 124 +++ .../kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h | 366 +++++++++ .../include/kodi/xbmc_addon_cpp_dll.h | 189 +++++ .../include/kodi/xbmc_addon_dll.h | 52 ++ .../include/kodi/xbmc_addon_types.h | 62 ++ .../include/kodi/xbmc_audioenc_dll.h | 58 ++ .../include/kodi/xbmc_audioenc_types.h | 110 +++ .../include/kodi/xbmc_codec_types.h | 52 ++ .../include/kodi/xbmc_epg_types.h | 123 +++ .../kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h | 741 ++++++++++++++++++ .../include/kodi/xbmc_pvr_types.h | 597 +++++++++++++++ .../kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h | 42 + .../include/kodi/xbmc_scr_types.h | 50 ++ .../include/kodi/xbmc_stream_utils.hpp | 264 +++++++ .../kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h | 53 ++ .../include/kodi/xbmc_vis_types.h | 110 +++ xbmc/cores/AudioEngine/Utils/AEChannelData.h | 10 +- .../cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h | 36 + xbmc/filesystem/IFileTypes.h | 82 ++ 233 files changed, 12609 insertions(+), 2588 deletions(-) create mode 100644 project/cmake/CMakeLists.txt create mode 100644 project/cmake/README.md delete mode 100644 project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt delete mode 100644 project/cmake/addons/addons/audioencoder.flac/platforms.txt delete mode 100644 project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt delete mode 100644 project/cmake/addons/addons/audioencoder.lame/platforms.txt delete mode 100644 project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt delete mode 100644 project/cmake/addons/addons/audioencoder.vorbis/platforms.txt delete mode 100644 project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt delete mode 100644 project/cmake/addons/addons/audioencoder.wav/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.argustv/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt delete mode 100644 project/cmake/addons/addons/pvr.demo/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.demo/pvr.demo.txt delete mode 100644 project/cmake/addons/addons/pvr.dvblink/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt delete mode 100644 project/cmake/addons/addons/pvr.dvbviewer/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt delete mode 100644 project/cmake/addons/addons/pvr.filmon/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.filmon/pvr.filmon.txt delete mode 100644 project/cmake/addons/addons/pvr.hts/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.hts/pvr.hts.txt delete mode 100644 project/cmake/addons/addons/pvr.iptvsimple/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt delete mode 100644 project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt delete mode 100644 project/cmake/addons/addons/pvr.mythtv/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt delete mode 100644 project/cmake/addons/addons/pvr.nextpvr/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt delete mode 100644 project/cmake/addons/addons/pvr.njoy/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt delete mode 100644 project/cmake/addons/addons/pvr.pctv/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt delete mode 100644 project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt delete mode 100644 project/cmake/addons/addons/pvr.vuplus/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt delete mode 100644 project/cmake/addons/addons/pvr.wmc/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt create mode 100644 project/cmake/addons/bootstrap/CMakeLists.txt create mode 100644 project/cmake/addons/bootstrap/README.md create mode 100644 project/cmake/addons/bootstrap/bootstrap.cmake create mode 100644 project/cmake/addons/bootstrap/repositories/binary-addons.txt create mode 100644 project/cmake/addons/depends/common/p8-platform/p8-platform.txt create mode 100644 project/cmake/installdata/addon-bindings.txt create mode 100644 project/cmake/installdata/common/addons.txt create mode 100644 project/cmake/installdata/common/common.txt create mode 100644 project/cmake/installdata/darwin/runtime.txt create mode 100644 project/cmake/installdata/linux/lirc.txt create mode 100644 project/cmake/installdata/test-reference-data.txt create mode 100644 project/cmake/installdata/windows/addons.txt create mode 100644 project/cmake/installdata/windows/dlls.txt create mode 100644 project/cmake/installdata/windows/irss.txt create mode 100644 project/cmake/modules/FindAML.cmake create mode 100644 project/cmake/modules/FindASS.cmake create mode 100644 project/cmake/modules/FindAlsa.cmake create mode 100644 project/cmake/modules/FindAvahi.cmake create mode 100644 project/cmake/modules/FindBluray.cmake create mode 100644 project/cmake/modules/FindCCache.cmake create mode 100644 project/cmake/modules/FindCEC.cmake create mode 100644 project/cmake/modules/FindCXX11.cmake create mode 100644 project/cmake/modules/FindCdio.cmake create mode 100644 project/cmake/modules/FindCpluff.cmake create mode 100644 project/cmake/modules/FindCrossGUID.cmake create mode 100644 project/cmake/modules/FindCurl.cmake create mode 100644 project/cmake/modules/FindD3DX11Effects.cmake create mode 100644 project/cmake/modules/FindDbus.cmake create mode 100644 project/cmake/modules/FindEGL.cmake create mode 100644 project/cmake/modules/FindEMBEDDED.cmake create mode 100644 project/cmake/modules/FindFFMPEG.cmake create mode 100644 project/cmake/modules/FindFreeType.cmake create mode 100644 project/cmake/modules/FindFribidi.cmake create mode 100644 project/cmake/modules/FindGIF.cmake create mode 100644 project/cmake/modules/FindJsonSchemaBuilder.cmake create mode 100644 project/cmake/modules/FindLibDvd.cmake create mode 100644 project/cmake/modules/FindLibSmbClient.cmake create mode 100644 project/cmake/modules/FindLibUSB.cmake create mode 100644 project/cmake/modules/FindLzo2.cmake create mode 100644 project/cmake/modules/FindMMAL.cmake create mode 100644 project/cmake/modules/FindMicroHttpd.cmake create mode 100644 project/cmake/modules/FindMySqlClient.cmake create mode 100644 project/cmake/modules/FindNFS.cmake create mode 100644 project/cmake/modules/FindOpenGLES.cmake create mode 100644 project/cmake/modules/FindOpenGl.cmake create mode 100644 project/cmake/modules/FindPCRE.cmake create mode 100644 project/cmake/modules/FindPlist.cmake create mode 100644 project/cmake/modules/FindPulseAudio.cmake create mode 100644 project/cmake/modules/FindPython.cmake create mode 100644 project/cmake/modules/FindRTMP.cmake create mode 100644 project/cmake/modules/FindSSE.cmake create mode 100644 project/cmake/modules/FindSSH.cmake create mode 100644 project/cmake/modules/FindSWIG.cmake create mode 100644 project/cmake/modules/FindSdl.cmake create mode 100644 project/cmake/modules/FindShairplay.cmake create mode 100644 project/cmake/modules/FindSqlite3.cmake create mode 100644 project/cmake/modules/FindTagLib.cmake create mode 100644 project/cmake/modules/FindTexturePacker.cmake create mode 100644 project/cmake/modules/FindTinyXML.cmake create mode 100644 project/cmake/modules/FindUDev.cmake create mode 100644 project/cmake/modules/FindUUID.cmake create mode 100644 project/cmake/modules/FindVAAPI.cmake create mode 100644 project/cmake/modules/FindVDPAU.cmake create mode 100644 project/cmake/modules/FindX.cmake create mode 100644 project/cmake/modules/FindXRandR.cmake create mode 100644 project/cmake/modules/FindXslt.cmake create mode 100644 project/cmake/modules/FindYajl.cmake create mode 100644 project/cmake/modules/FindZip.cmake delete mode 100644 project/cmake/platform/darwin/defines.txt create mode 100644 project/cmake/platform/osx/defines.txt create mode 100644 project/cmake/scripts/android/archsetup.cmake create mode 100644 project/cmake/scripts/android/install.cmake create mode 120000 project/cmake/scripts/android/macros.cmake create mode 120000 project/cmake/scripts/android/pathsetup.cmake create mode 100644 project/cmake/scripts/common/archsetup.cmake create mode 100644 project/cmake/scripts/common/checkcommits.cmake create mode 100644 project/cmake/scripts/common/generateversionedfiles.cmake create mode 100644 project/cmake/scripts/common/generatorsetup.cmake create mode 100644 project/cmake/scripts/common/macros.cmake create mode 100644 project/cmake/scripts/common/managestring.cmake create mode 100644 project/cmake/scripts/common/pathsetup.cmake create mode 100644 project/cmake/scripts/common/projectmacros.cmake create mode 100644 project/cmake/scripts/darwin/archsetup.cmake create mode 100644 project/cmake/scripts/darwin/install.cmake create mode 100644 project/cmake/scripts/darwin/macros.cmake create mode 100644 project/cmake/scripts/darwin/pathsetup.cmake create mode 100644 project/cmake/scripts/freebsd/archsetup.cmake create mode 100644 project/cmake/scripts/freebsd/install.cmake create mode 100644 project/cmake/scripts/freebsd/macros.cmake create mode 100644 project/cmake/scripts/freebsd/pathsetup.cmake create mode 100644 project/cmake/scripts/ios/archsetup.cmake create mode 120000 project/cmake/scripts/ios/install.cmake create mode 120000 project/cmake/scripts/ios/macros.cmake create mode 120000 project/cmake/scripts/ios/pathsetup.cmake create mode 100644 project/cmake/scripts/linux/archsetup.cmake create mode 100644 project/cmake/scripts/linux/install.cmake create mode 100644 project/cmake/scripts/linux/macros.cmake create mode 100644 project/cmake/scripts/linux/pathsetup.cmake create mode 100644 project/cmake/scripts/rbpi/archsetup.cmake create mode 120000 project/cmake/scripts/rbpi/install.cmake create mode 120000 project/cmake/scripts/rbpi/macros.cmake create mode 120000 project/cmake/scripts/rbpi/pathsetup.cmake create mode 100644 project/cmake/scripts/windows/archsetup.cmake create mode 100644 project/cmake/scripts/windows/install.cmake create mode 100644 project/cmake/scripts/windows/macros.cmake create mode 100644 project/cmake/scripts/windows/pathsetup.cmake create mode 100644 project/cmake/treedata/android/subdirs.txt create mode 100644 project/cmake/treedata/common/addons.txt create mode 100644 project/cmake/treedata/common/cores.txt create mode 100644 project/cmake/treedata/common/events.txt create mode 100644 project/cmake/treedata/common/externals.txt create mode 100644 project/cmake/treedata/common/filesystem.txt create mode 100644 project/cmake/treedata/common/interfaces.txt create mode 100644 project/cmake/treedata/common/music.txt create mode 100644 project/cmake/treedata/common/network.txt create mode 100644 project/cmake/treedata/common/peripherals.txt create mode 100644 project/cmake/treedata/common/profiles.txt create mode 100644 project/cmake/treedata/common/pvr.txt create mode 100644 project/cmake/treedata/common/settings.txt create mode 100644 project/cmake/treedata/common/subdirs.txt create mode 100644 project/cmake/treedata/common/tests.txt create mode 100644 project/cmake/treedata/common/video.txt create mode 100644 project/cmake/treedata/common/videoplayer.txt create mode 100644 project/cmake/treedata/darwin/subdirs.txt create mode 100644 project/cmake/treedata/freebsd/subdirs.txt create mode 100644 project/cmake/treedata/ios/subdirs.txt create mode 100644 project/cmake/treedata/linux/subdirs.txt create mode 100644 project/cmake/treedata/optional/common/X11.txt create mode 100644 project/cmake/treedata/optional/common/cec.txt create mode 100644 project/cmake/treedata/optional/common/nonfree.txt create mode 100644 project/cmake/treedata/optional/common/opengl.txt create mode 100644 project/cmake/treedata/optional/common/opengles.txt create mode 100644 project/cmake/treedata/rbpi/omxplayer.txt create mode 100644 project/cmake/treedata/rbpi/subdirs.txt create mode 100644 project/cmake/treedata/windows/subdirs.txt delete mode 100644 xbmc/addons/include/kodi_audiodec_dll.h delete mode 100644 xbmc/addons/include/kodi_audiodec_types.h delete mode 100644 xbmc/addons/include/xbmc_addon_cpp_dll.h delete mode 100644 xbmc/addons/include/xbmc_addon_dll.h delete mode 100644 xbmc/addons/include/xbmc_addon_types.h delete mode 100644 xbmc/addons/include/xbmc_audioenc_dll.h delete mode 100644 xbmc/addons/include/xbmc_audioenc_types.h delete mode 100644 xbmc/addons/include/xbmc_codec_types.h delete mode 100644 xbmc/addons/include/xbmc_epg_types.h delete mode 100644 xbmc/addons/include/xbmc_pvr_dll.h delete mode 100644 xbmc/addons/include/xbmc_pvr_types.h delete mode 100644 xbmc/addons/include/xbmc_scr_dll.h delete mode 100644 xbmc/addons/include/xbmc_scr_types.h delete mode 100644 xbmc/addons/include/xbmc_stream_utils.hpp delete mode 100644 xbmc/addons/include/xbmc_vis_dll.h delete mode 100644 xbmc/addons/include/xbmc_vis_types.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h create mode 100644 xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h create mode 100644 xbmc/filesystem/IFileTypes.h 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 @@ +cmake_minimum_required(VERSION 3.1) +project(kodi) + +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/modules) +if(DEPENDS_DIR) + list(APPEND CMAKE_PREFIX_PATH ${DEPENDS_DIR}) +endif() + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# general +option(VERBOSE "Enable verbose output?" OFF) +option(ENABLE_DVDCSS "Enable libdvdcss support?" ON) +option(ENABLE_UPNP "Enable UPnP support?" ON) +option(ENABLE_NONFREE "Enable non-free components?" ON) +option(ENABLE_MICROHTTPD "Enable MicroHttpd webserver?" ON) +option(ENABLE_MYSQLCLIENT "Enable MySql support?" ON) +option(ENABLE_AVAHI "Enable Avahi support?" ON) +option(ENABLE_RTMP "Enable RTMP support?" ON) +option(ENABLE_BLURAY "Enable BluRay support?" ON) +option(ENABLE_PLIST "Enable AirPlay support?" ON) +option(ENABLE_NFS "Enable NFS support?" ON) +option(ENABLE_AIRTUNES "Enable AirTunes support?" ON) +option(ENABLE_CEC "Enable CEC support?" ON) +if(UNIX) + if(NOT APPLE) + option(ENABLE_INTERNAL_FFMPEG "Enable internal ffmpeg?" ON) + else() + option(ENABLE_VTB "Enable VTB support?" OFF) + endif() + option(FFMPEG_PATH "Path to external ffmpeg?" "") + option(ENABLE_INTERNAL_CROSSGUID "Enable internal crossguid?" ON) + option(ENABLE_ALSA "Enable ALSA support?" ON) + option(ENABLE_PULSEAUDIO "Enable PulseAudio support?" ON) + option(ENABLE_DBUS "Enable dbus support?" ON) + option(ENABLE_LIBUSB "Enable libusb support?" ON) + option(ENABLE_UDEV "Enable UDev support?" ON) + option(ENABLE_OPENGL "Enable OpenGL?" ON) + option(ENABLE_OPENGLES "Enable OpenGLES?" ON) + option(ENABLE_OPENSSL "Enable OpenSSL?" ON) + option(ENABLE_SDL "Enable SDL?" OFF) + option(ENABLE_X11 "Enable X11 support?" ON) + option(ENABLE_EGL "Enable EGL?" OFF) + option(ENABLE_VAAPI "Enable VAAPI support?" ON) + option(ENABLE_VDPAU "Enable VDPAU support?" ON) + option(ENABLE_OPTICAL "Enable optical support?" ON) +endif() +# System options +if(NOT WIN32) + option(WITH_ARCH "build with given arch" OFF) + option(WITH_CPU "build with given cpu" OFF) + option(ENABLE_CCACHE "Enable Ccache support" ON) +endif() + +get_filename_component(CORE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../.. ABSOLUTE) +set(CORE_BUILD_DIR build) + +include(scripts/common/generatorsetup.cmake) +include(scripts/common/addoptions.cmake) +include(scripts/common/archsetup.cmake) +include(scripts/common/macros.cmake) +include(scripts/common/managestring.cmake) +include(scripts/common/projectmacros.cmake) +include(scripts/common/pathsetup.cmake) +include(ExternalProject) + +core_find_git_rev() +core_find_versions() + +set(INCLUDES ${CORE_SOURCE_DIR} + ${CORE_SOURCE_DIR}/addons/library.xbmc.addon + ${CORE_SOURCE_DIR}/lib + ${CORE_SOURCE_DIR}/lib/gtest/include + ${CORE_SOURCE_DIR}/xbmc + ${CORE_SOURCE_DIR}/xbmc/${PLATFORM_DIR} + ${CORE_SOURCE_DIR}/xbmc/cores/VideoPlayer + ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}) + +find_package(PkgConfig) +if(CMAKE_CROSSCOMPILING) + if(PKG_CONFIG_EXECUTABLE) + message(STATUS "CMAKE_CROSSCOMPILING: ${CMAKE_CROSSCOMPILING}") + set(PKG_CONFIG_FOUND TRUE) + endif() +endif() + +find_package(Threads REQUIRED) +list(APPEND DEPLIBS ${CMAKE_THREAD_LIBS_INIT}) + +# Required dependencies +set(required_deps Sqlite3 FreeType PCRE Cpluff LibDvd + TinyXML Python Yajl Xslt + JPEG Lzo2 Fribidi TagLib FFMPEG CrossGUID) +if(NOT WIN32) + list(APPEND required_deps LibSmbClient ZLIB) +else() + list(APPEND required_deps D3DX11Effects) +endif() +if(CORE_SYSTEM_NAME STREQUAL android) + list(APPEND required_deps Zip) +endif() + +# Optional dependencies +set(optional_deps MicroHttpd MySqlClient SSH + Alsa UDev Dbus Avahi + PulseAudio VDPAU VAAPI) + +# Required, dyloaded deps +set(required_dyload Curl ASS) + +# Optional, dyloaded deps +set(dyload_optional RTMP CEC Bluray Plist NFS) + +# Required by shared objects we link +set(required_dep_libs PNG EXPAT) + +# Required tools +find_package(TexturePacker REQUIRED) +find_package(JsonSchemaBuilder REQUIRED) + +foreach(dep ${required_dep_libs}) + find_package(${dep} REQUIRED) +endforeach() + +foreach(dep ${required_deps}) + core_require_dep(${dep}) +endforeach() + +foreach(dep ${optional_deps}) + core_optional_dep(${dep}) +endforeach() + +if(NOT UDEV_FOUND) + core_optional_dep(LibUSB) +endif() + +foreach(dep ${required_dyload}) + core_require_dyload_dep(${dep}) +endforeach() + +foreach(dep ${dyload_optional}) + core_optional_dyload_dep(${dep}) +endforeach() + +if(ENABLE_OPENSSL) + core_require_dep(OpenSSL) + list(APPEND DEP_DEFINES "-DHAVE_OPENSSL=1") +endif() + +if(ENABLE_UPNP) + list(APPEND DEP_DEFINES "-DUSE_UPNP=1") +endif() + +if(ENABLE_NONFREE) + list(APPEND DEP_DEFINES "-DHAVE_XBMC_NONFREE=1") +endif() + +if(ENABLE_OPTICAL) + list(APPEND DEP_DEFINES -DHAS_DVD_DRIVE) + core_require_dep(Cdio) +endif() + +if(ENABLE_AIRTUNES) + find_package(Shairplay) + if(SHAIRPLAY_FOUND) + core_require_dyload_dep(Shairplay) + endif() +endif() + +if(ENABLE_VTB) + list(APPEND DEP_DEFINES -DHAVE_VIDEOTOOLBOXDECODER=1) +endif() + +if(NOT WIN32) + core_optional_dep(OpenGl) + if(OPENGL_FOUND) + if(NOT APPLE) + core_optional_dep(Sdl) + else() + core_require_dep(Sdl) + endif() + core_optional_dep(X ENABLE_X11) + core_optional_dep(XRandR ENABLE_X11) + else() + core_optional_dep(OpenGLES ENABLE_OPENGLES) + if(OPENGLES_FOUND) + core_optional_dep(EGL ENABLE_EGL) + core_optional_dep(OMX ENABLE_OMX) + core_optional_dep(AML ENABLE_AML) + core_optional_dep(X ENABLE_X11) + core_optional_dep(Sdl) + endif() + endif() + + if(CORE_SYSTEM_NAME STREQUAL rbpi) + core_require_dep(MMAL) + endif() +endif() + +if(ENABLE_CCACHE) + core_optional_dep(CCache) +endif() + +# Compile Info +add_custom_command(OUTPUT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp + COMMAND ${CMAKE_COMMAND} -DCORE_SOURCE_DIR=${CORE_SOURCE_DIR} + -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} + -DCORE_BUILD_DIR=${CORE_BUILD_DIR} + -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR} + -DARCH_DEFINES="${ARCH_DEFINES}" + -DAPP_SCMID=${APP_SCMID} + -Dprefix=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} + -P ${PROJECT_SOURCE_DIR}/scripts/common/generateversionedfiles.cmake + DEPENDS ${CORE_SOURCE_DIR}/version.txt + ${CORE_SOURCE_DIR}/addons/xbmc.addon/addon.xml.in + ${CORE_SOURCE_DIR}/addons/kodi.guilib/addon.xml.in + ${CORE_SOURCE_DIR}/xbmc/CompileInfo.cpp.in) +list(APPEND install_data addons/xbmc.addon/addon.xml) +add_library(compileinfo OBJECT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp) +target_compile_options(compileinfo PRIVATE "${SYSTEM_DEFINES}") + +# RC File +if(WIN32) + configure_file(${CORE_SOURCE_DIR}/xbmc/win32/XBMC_PC.rc.in + ${CORE_BUILD_DIR}/xbmc/win32/XBMC_PC.rc @ONLY) + add_library(resources OBJECT ${CORE_BUILD_DIR}/xbmc/win32/XBMC_PC.rc) + target_include_directories(resources PRIVATE ${CORE_SOURCE_DIR}/tools/windows/packaging/media) + set(RESOURCES $) +endif() + +include_directories(${INCLUDES} ${SYSTEM_INCLUDES}) +add_compile_options(${ARCH_DEFINES} "${SYSTEM_DEFINES}" ${DEP_DEFINES} ${PATH_DEFINES}) + +set(core_DEPENDS "" CACHE STRING "" FORCE) +set(test_archives "" CACHE STRING "" FORCE) +set(test_sources "" CACHE STRING "" FORCE) +mark_as_advanced(core_DEPENDS) +mark_as_advanced(test_archives) +mark_as_advanced(test_sources) + +file(STRINGS ${PROJECT_SOURCE_DIR}/installdata/addon-bindings.txt bindings) +foreach(binding ${bindings}) + list(APPEND addon_bindings ${CORE_SOURCE_DIR}/${binding}) +endforeach() + +add_subdirectory(${CORE_SOURCE_DIR}/lib/gtest ${CORE_BUILD_DIR}/gtest EXCLUDE_FROM_ALL) + +# Subdirs +core_add_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/common/*.txt + ${PROJECT_SOURCE_DIR}/treedata/${CORE_SYSTEM_NAME}/*.txt) +core_add_optional_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/optional/common/*.txt + ${PROJECT_SOURCE_DIR}/treedata/optional/${CORE_SYSTEM_NAME}/*.txt) + +# copy files to build tree +copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/common/*.txt + ${PROJECT_SOURCE_DIR}/installdata/${CORE_SYSTEM_NAME}/*.txt) + +list(APPEND SKINS "${CORE_SOURCE_DIR}/addons/skin.estuary\;${CORE_SOURCE_DIR}") +list(APPEND SKINS "${CORE_SOURCE_DIR}/addons/skin.estouchy\;${CORE_SOURCE_DIR}") + +# These are skins that are copied into place from the source tree +foreach(skin ${SKINS}) + list(GET skin 0 dir) + list(GET skin 1 relative) + copy_skin_to_buildtree(${dir} ${relative}) +endforeach() + +add_custom_target(pack-skins ALL + DEPENDS TexturePacker::TexturePacker export-files ${XBT_FILES}) + +core_link_library(exif system/libexif) +if(CORE_SYSTEM_NAME STREQUAL linux) + core_link_library(sse4 system/libsse4) +endif() + +core_link_library(XBMC_addon addons/library.xbmc.addon/libXBMC_addon) +core_link_library(XBMC_codec addons/library.xbmc.codec/libXBMC_codec) +core_link_library(KODI_guilib addons/library.kodi.guilib/libKODI_guilib) +core_link_library(KODI_adsp addons/library.kodi.adsp/libKODI_adsp) +core_link_library(XBMC_pvr addons/library.xbmc.pvr/libXBMC_pvr) + +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/system/players/VideoPlayer) +add_custom_target(wrap-libraries ALL DEPENDS ${WRAP_FILES}) + +set(LIBCEC_SONAME "${CEC_SONAME}") +if(NOT CORE_SYSTEM_NAME STREQUAL windows AND NOT CORE_SYSTEM_NAME STREQUAL android) + configure_file(${CORE_SOURCE_DIR}/xbmc/DllPaths_generated.h.in + ${CORE_BUILD_DIR}/DllPaths_generated.h @ONLY) +elseif(CORE_SYSTEM_NAME STREQUAL android) + configure_file(${CORE_SOURCE_DIR}/xbmc/DllPaths_generated_android.h.in + ${CORE_BUILD_DIR}/DllPaths_generated_android.h @ONLY) +endif() + +# Codegen +add_subdirectory(${CORE_SOURCE_DIR}/xbmc/interfaces/swig build/swig) + +# Other files (IDE) +set(OTHER_FILES README.md) + +# main binary +add_executable(${APP_NAME_LC} ${CORE_MAIN_SOURCE} $ "${RESOURCES}" ${OTHER_FILES}) +whole_archive(_MAIN_LIBRARIES ${core_DEPENDS}) +target_link_libraries(${APP_NAME_LC} ${SYSTEM_LDFLAGS} ${_MAIN_LIBRARIES} ${DEPLIBS} ${CMAKE_DL_LIBS}) +unset(_MAIN_LIBRARIES) +add_dependencies(${APP_NAME_LC} export-files) +if(NOT WIN32) + set_target_properties(${APP_NAME_LC} PROPERTIES SUFFIX ".bin") +else() + set_target_properties(${APP_NAME_LC} PROPERTIES WIN32_EXECUTABLE ON) + copy_main_dlls_to_buildtree() +endif() + +# testing +copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/test-reference-data.txt 1) +add_executable(${APP_NAME_LC}-test EXCLUDE_FROM_ALL ${CORE_SOURCE_DIR}/xbmc/test/xbmc-test.cpp $) +whole_archive(_TEST_LIBRARIES ${core_DEPENDS} gtest ${test_archives}) +target_link_libraries(${APP_NAME_LC}-test ${SYSTEM_LDFLAGS} ${_TEST_LIBRARIES} ${DEPLIBS} ${CMAKE_DL_LIBS}) +unset(_TEST_LIBRARIES) +add_dependencies(${APP_NAME_LC}-test export-files) + +# make test and make check (cannot be executed when cross compiling) +if(NOT CMAKE_CROSSCOMPILING) + enable_testing() + gtest_add_tests(${APP_NAME_LC}-test "" ${test_sources}) + add_custom_target(check ${CMAKE_CTEST_COMMAND} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + add_dependencies(check ${APP_NAME_LC}-test) + + # For testing commit series + add_custom_target(check-commits ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/scripts/common/checkcommits.cmake + -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}) +endif() + +# link wrapper +if(FFMPEG_LINK_EXECUTABLE) + set(CMAKE_CXX_LINK_EXECUTABLE "${FFMPEG_LINK_EXECUTABLE}") +endif() + +# randr +if(ENABLE_X11 AND XRANDR_FOUND) + add_executable(kodi-xrandr ${CORE_SOURCE_DIR}/xbmc-xrandr.c) + target_link_libraries(kodi-xrandr ${SYSTEM_LDFLAGS} ${X_LIBRARIES} m ${XRANDR_LIBRARIES}) +endif() + +# XBMCHelper +if(CORE_SYSTEM_TYPE STREQUAL darwin) + add_subdirectory(${CORE_SOURCE_DIR}/tools/EventClients/Clients/OSXRemote build/XBMCHelper) +endif() + +include(scripts/${CORE_SYSTEM_NAME}/install.cmake) + +# Status +message(STATUS "#---- CONFIGURATION ----#") +foreach(msg ${final_message}) + message(STATUS ${msg}) +endforeach() + +if(VERBOSE) + message(STATUS "\n#---- Internal Variables ----# ") + message(STATUS "DEPLIBS: ${DEPLIBS}") + message(STATUS "SYSTEM_LDFLAGS: ${SYSTEM_LDFLAGS}") + message(STATUS "core_DEPENDS: ${core_DEPENDS}") + message(STATUS "CMAKE_DL_LIBS: ${CMAKE_DL_LIBS}") +endif() +message(STATUS "#-----------------------#") + 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 @@ +# Kodi CMake based buildsystem + +This files describes Kodi's CMake based buildsystem. CMake is a cross-platform +tool for generating makefiles as well as project files used by IDEs. + +The current version of the buildsystem is capable of building the main Kodi +executable (but no packaging or dependency management yet) for the following +platforms: + +- Linux (GNU Makefiles) +- Windows (NMake Makefiles, Visual Studio 12 (2013)) +- OSX (GNU Makefiles, Xcode) +- Android (GNU Makefiles) + +Before building Kodi with CMake, please ensure that you have the platform +specific dependencies installed. + +While the legacy build systems typically used in-source builds it's recommended +to use out-of-source builds with CMake. The necessary runtime dependencies such +as dlls, skins and configuration files are copied over to the build directory +automatically. + +## Dependency installation + +### Linux + +The dependencies required to build on Linux can be found in +[docs/README.xxx](https://github.com/xbmc/xbmc/tree/master/docs). + +### Raspberry Pi + +The cross compilation environment for the Raspberry Pi as well as the +dependencies have to be installed as explained in +[docs/README.raspberrypi](https://github.com/xbmc/xbmc/tree/master/docs/README.raspberrypi). + +### Windows + +For Windows the dependencies can be found in the +[Wiki](http://kodi.wiki/view/HOW-TO:Compile_Kodi_for_Windows) (Step 1-4). If not already available on your pc, you should +install the [Windows Software Development Kit (SDK)](https://dev.windows.com/en-us/downloads/sdk-archive) for your Windows version. This is required for HLSL shader offline compiling with the [Effect-Compiler Tool](https://msdn.microsoft.com/de-de/library/windows/desktop/bb232919(v=vs.85).aspx) (fxc.exe). + +On Windows, the CMake based buildsystem requires that the binary dependencies +are downloaded using `DownloadBuildDeps.bat` and `DownloadMingwBuildEnv.bat` +and that the mingw libs (ffmpeg, libdvd and others) are built using +`make-mingwlibs.bat`. + +### OSX + +For OSX the required dependencies can be found in +[docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.osx). + +On OSX it is necessary to build the dependencies in `tools/depends` using +`./bootstrap && ./configure --host= && make`. The other steps such +as `make -C tools/depends/target/xbmc` and `make xcode_depends` are not needed +as these steps are covered already by the CMake project. + +### Android + +The dependencies needed to compile for Android can be found in +[docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.android) +. All described steps have to be executed (except 5.2 which is replaced by the +respective CMake command below). + +## Building Kodi + +This section lists the necessary commands for building Kodi with CMake. +CMake supports different generators that can be classified into two categories: +single- and multiconfiguration generators. + +A single configuration generator (GNU/NMake Makefiles) generates project files +for a single build type (e.g. Debug, Release) specified at configure time. +Multi configuration generators (Visual Studio, Xcode) allow to specify the +build type at compile time. + +All examples below are for out-of-source builds with Kodi checked out to +``: + +``` +mkdir kodi-build && cd kodi-build +``` + +### Linux with GNU Makefiles + +``` +cmake /project/cmake/ +cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) +./kodi.bin +``` + +`CMAKE_BUILD_TYPE` defaults to `Release`. + +### Raspberry Pi with GNU Makefiles + +``` +cmake -DCMAKE_TOOLCHAIN_FILE=/tools/depends/target/Toolchain.cmake /project/cmake/ +cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) +``` + +### Windows with NMake Makefiles + +``` +cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release /project/cmake/ +cmake --build . # or: nmake +kodi.exe +``` + +### Windows with Visual Studio project files + +``` +cmake -G "Visual Studio 12" /project/cmake/ +cmake --build . --config "Debug" # or: Build solution with Visual Studio +set KODI_HOME="%CD%" && Debug\kodi.exe +``` + +### OSX with GNU Makefiles + +``` +cmake -DCMAKE_TOOLCHAIN_FILE=/tools/depends/target/Toolchain.cmake /project/cmake/ +cmake --build . -- VERBOSE=1 -j$(sysctl -n hw.ncpu) # or: make VERBOSE=1 -j$(sysctl -n hw.ncpu) +./kodi.bin +``` + +### OSX with Xcode project files + +``` +cmake -DCMAKE_TOOLCHAIN_FILE=/tools/depends/target/Toolchain.cmake -G "Xcode" /project/cmake/ +cmake --build . --config "Release" -- -verbose -jobs $(sysctl -n hw.ncpu) # or: Build solution with Xcode +KODI_HOME=$(pwd) ./Release/kodi.bin +``` + +### Android with GNU Makefiles + +``` +cmake -DCMAKE_TOOLCHAIN_FILE=/tools/depends/target/Toolchain.cmake /project/cmake/ +cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) +``` + +## Extra targets + +When using the makefile builds a few extra targets are defined: + +- `make check` builds and executes the test suite. + +## Debugging the build + +This section covers some tips that can be useful for debugging a CMake +based build. + +### Verbosity (show compiler and linker parameters) + +In order to see the exact compiler commands `make` and `nmake` can be +executed with a `VERBOSE=1` parameter. + +On Windows, this is unfortunately not enough because `nmake` uses +temporary files to workaround `nmake`'s command string length limitations. +In order to see verbose output the file +[Modules/Platform/Windows.cmake](https://github.com/Kitware/CMake/blob/master/Modules/Platform/Windows.cmake#L40) +in the local CMake installation has to be adapted by uncommenting these +lines: + +``` +# uncomment these out to debug nmake and borland makefiles +#set(CMAKE_START_TEMP_FILE "") +#set(CMAKE_END_TEMP_FILE "") +#set(CMAKE_VERBOSE_MAKEFILE 1) +``` 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 @@ project(kodi-addons) -cmake_minimum_required(VERSION 2.8) +if(WIN32) + # there seems to be a bug in the CMake generator implementation in CMake 2.8.x releases for WIN32 + cmake_minimum_required(VERSION 3.0) +else() + cmake_minimum_required(VERSION 2.8) +endif() list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) +option(ADDON_TARBALL_CACHING "Cache downloaded addon source tarballs?" ON) +if(ADDON_TARBALL_CACHING) + message(STATUS "Addon source tarball caching is enabled") +else() + message(STATUS "Addon source tarball caching is disabled") +endif() + if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() if(NOT CORE_SYSTEM_NAME) - string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(CORE_SYSTEM_NAME "osx") + else() + string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) + endif() endif() include(ExternalProject) @@ -65,6 +81,7 @@ list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_INSTALL_PREFIX:PATH= -DPACKAGE_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig + -DDEPENDS_PATH=${DEPENDS_PATH} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE} -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX} @@ -78,16 +95,26 @@ if(MSVC) set_property(GLOBAL PROPERTY USE_FOLDERS ON) endif() +option(PACKAGE_ZIP "Prepare built addons for packaging" OFF) if(PACKAGE_ZIP) # needed for project installing - list(APPEND BUILD_ARGS -DPACKAGE_ZIP=1) - MESSAGE("package zip specified") + list(APPEND BUILD_ARGS -DPACKAGE_ZIP=ON) + + # figure out where to store the packaged ZIP archives + if(NOT PACKAGE_DIR) + set(PACKAGE_DIR "${BUILD_DIR}/zips") + else() + file(TO_CMAKE_PATH "${PACKAGE_DIR}" PACKAGE_DIR) + endif() + list(APPEND BUILD_ARGS -DPACKAGE_DIR=${PACKAGE_DIR}) + + MESSAGE(STATUS "ZIP packaging enabled (destination: ${PACKAGE_DIR})") endif() if(CMAKE_TOOLCHAIN_FILE) list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) - MESSAGE("toolchain specified") - MESSAGE(${BUILD_ARGS}) + MESSAGE(STATUS "Toolchain specified") + MESSAGE(STATUS ${BUILD_ARGS}) endif() if(NOT ADDONS_TO_BUILD) @@ -97,16 +124,25 @@ else() separate_arguments(ADDONS_TO_BUILD) endif() +if(NOT ADDONS_DEFINITION_DIR) + set(ADDONS_DEFINITION_DIR ${PROJECT_SOURCE_DIR}/addons) +else() + file(TO_CMAKE_PATH "${ADDONS_DEFINITION_DIR}" ADDONS_DEFINITION_DIR) +endif() +get_filename_component(ADDONS_DEFINITION_DIR "${ADDONS_DEFINITION_DIR}" ABSOLUTE) + if(ADDON_SRC_PREFIX) message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}") endif() -if(NOT KODI_LIB_DIR) - set(KODI_LIB_DIR "${DEPENDS_PATH}/lib/kodi") +if(NOT APP_LIB_DIR) + set(APP_LIB_DIR "${DEPENDS_PATH}/lib/kodi") else() - file(TO_CMAKE_PATH "${KODI_LIB_DIR}" KODI_LIB_DIR) + file(TO_CMAKE_PATH "${APP_LIB_DIR}" APP_LIB_DIR) endif() +set(APP_PREFIX "${CMAKE_INSTALL_PREFIX}") + # check for platform specific stuff if(EXISTS ${PLATFORM_DIR}/defines.txt) file(STRINGS ${PLATFORM_DIR}/defines.txt platformdefines) @@ -119,21 +155,23 @@ endif() # include check_target_platform() function include(${APP_ROOT}/project/cmake/scripts/common/check_target_platform.cmake) -# check install permissions set(ADDON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) -check_install_permissions(${CMAKE_INSTALL_PREFIX} can_write) -if(NOT ${can_write} AND NOT WIN32) - set(NEED_SUDO TRUE) - set(ADDON_INSTALL_DIR ${CMAKE_BINARY_DIR}/.install) - message(STATUS "NEED_SUDO: ${NEED_SUDO}") +if(NOT WIN32) + # check install permissions + check_install_permissions(${CMAKE_INSTALL_PREFIX} can_write) + if(NOT ${can_write} AND CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(NEED_SUDO TRUE) + set(ADDON_INSTALL_DIR ${CMAKE_BINARY_DIR}/.install) + message(STATUS "NEED_SUDO: ${NEED_SUDO}") + endif() endif() ### prepare the build environment for the binary addons # copy the prepare-env.cmake script to the depends path so that we can include it -file(COPY ${APP_ROOT}/project/cmake/scripts/common/prepare-env.cmake DESTINATION ${KODI_LIB_DIR}) +file(COPY ${APP_ROOT}/project/cmake/scripts/common/prepare-env.cmake DESTINATION ${APP_LIB_DIR}) # add the location of prepare-env.cmake to CMAKE_MODULE_PATH so that it is found -list(APPEND CMAKE_MODULE_PATH ${KODI_LIB_DIR}) +list(APPEND CMAKE_MODULE_PATH ${APP_LIB_DIR}) # include prepare-env.cmake which contains the logic to install the addon header bindings etc include(prepare-env) @@ -141,17 +179,61 @@ include(prepare-env) ### add the depends subdirectory for any general dependencies add_subdirectory(depends) +# add a custom target "package-addons" which will package and install all addons +add_custom_target(package-addons) + ### get and build all the binary addons # look for all the addons to be built -file(GLOB_RECURSE addons ${PROJECT_SOURCE_DIR}/addons/*.txt) +file(GLOB_RECURSE addons ${ADDONS_DEFINITION_DIR}/*.txt) + +#if there are no addons assume that bootstrapping hasn't happened yet +if(NOT addons) + message(STATUS "Bootstrapping all default repositories as no addons were found...") + set(BOOTSTRAP_BUILD_DIR "${BUILD_DIR}/bootstrap") + + # make sure that the bootstraps build addon exists + if(NOT EXISTS ${BOOTSTRAP_BUILD_DIR}) + file(MAKE_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) + endif() + + # generate the bootstrap buildsystem + execute_process(COMMAND ${CMAKE_COMMAND} ${PROJECT_SOURCE_DIR}/bootstrap + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_INSTALL_PREFIX:PATH=${ADDONS_DEFINITION_DIR} + -DBUILD_DIR:PATH=${BOOTSTRAP_BUILD_DIR} + -DADDONS_TO_BUILD=${ADDONS_TO_BUILD} + WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) + + # execute the generated bootstrap buildsystem + execute_process(COMMAND ${CMAKE_COMMAND} --build ${BOOTSTRAP_BUILD_DIR} + WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) + + # now look for all the addons to be built again + file(GLOB_RECURSE addons ${ADDONS_DEFINITION_DIR}/*.txt) + + if(NOT addons) + message(FATAL_ERROR "No addons available to be built") + endif() +endif() + foreach(addon ${addons}) if(NOT (addon MATCHES platforms.txt)) file(STRINGS ${addon} def) separate_arguments(def) list(GET def 0 id) + set(ADDON_FOUND FALSE) + # try to find a perfect match list(FIND ADDONS_TO_BUILD ${id} idx) - if(idx GREATER -1 OR ADDONS_TO_BUILD STREQUAL "all") + if(idx GREATER -1 OR "${ADDONS_TO_BUILD}" STREQUAL "all") + set(ADDON_FOUND TRUE) + # Maybe we have a regex + elseif(id MATCHES "${ADDONS_TO_BUILD}") + message(STATUS "Pattern ${ADDONS_TO_BUILD} matches ${id}, building addon") + set(ADDON_FOUND TRUE) + endif() + + if(ADDON_FOUND) get_filename_component(dir ${addon} PATH) # check if the addon has a platforms.txt @@ -180,6 +262,19 @@ foreach(addon ${addons}) if(deflength GREATER 2 AND "${SOURCE_DIR}" STREQUAL "") list(GET def 2 revision) + # we need access to a git executable + find_package(Git REQUIRED) + + # resolve revision to git hash + execute_process(COMMAND ${GIT_EXECUTABLE} ls-remote ${url} ${revision} OUTPUT_VARIABLE revision_hash) + # git ls-remote only works on branches and tag names but not on revisions + if(NOT "${revision_hash}" STREQUAL "") + string(REPLACE "\t" ";" revision_list ${revision_hash}) + list(GET revision_list 0 revision_hash) + message(STATUS "${id}: git branch/tag ${revision} resolved to hash: ${revision_hash}") + set(revision ${revision_hash}) + endif() + # Note: downloading specific revisions via http in the format below is probably github specific # if we ever use other repositories, this might need adapting set(url ${url}/archive/${revision}.tar.gz) @@ -210,7 +305,7 @@ foreach(addon ${addons}) # download the addon if necessary if(NOT "${archive_name}" STREQUAL "") # download and extract the addon - if(NOT EXISTS ${BUILD_DIR}/download/${archive_name}.tar.gz) + if(NOT ADDON_TARBALL_CACHING OR NOT EXISTS ${BUILD_DIR}/download/${archive_name}.tar.gz) # cleanup any of the previously downloaded archives of this addon file(GLOB archives "${BUILD_DIR}/download/${id}*.tar.gz") if(archives) @@ -275,6 +370,25 @@ foreach(addon ${addons}) add_dependencies(${id} ${${id}_DEPS}) endif() endif() + + if(CROSS_AUTOCONF AND AUTOCONF_FILES) + if(EXISTS ${SOURCE_DIR}/bootstrap/autoreconf.txt) + file(STRINGS ${SOURCE_DIR}/bootstrap/autoreconf.txt conf_dirs) + foreach(conf_dir ${conf_dirs}) + foreach(afile ${AUTOCONF_FILES}) + message(STATUS "copying ${afile} to ${SOURCE_DIR}/${conf_dir}") + file(COPY ${afile} DESTINATION ${SOURCE_DIR}/${conf_dir}) + endforeach() + endforeach() + endif() + endif() + + # create a forwarding target to the addon-package target + add_custom_target(package-${id} + COMMAND ${CMAKE_COMMAND} --build ${id}-prefix/src/${id}-build --target addon-package + DEPENDS ${id}) + add_dependencies(package-addons package-${id}) + else() message(FATAL_ERROR "${id}: invalid or missing addon source directory at ${SOURCE_DIR}") endif() @@ -297,4 +411,4 @@ endif() # add custom target "supported_addons" that returns all addons that are supported on this platform string(REPLACE ";" " " ALL_ADDONS_BUILDING "${ALL_ADDONS_BUILDING}") -add_custom_target(supported_addons COMMAND ${CMAKE_COMMAND} -E echo "ALL_ADDONS_BUILDING: ${ALL_ADDONS_BUILDING}" VERBATIM) +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 @@ KODI ADDONS =========== This directory contains the cmake-based buildsystem for addons. It looks into -the "addons" sub-directory and parses all *.txt files recursively. Each addon +the directory pointed to by the ADDONS_DEFINITION_DIR option (which defaults to +the "addons" sub-directory) and parses all *.txt files recursively. Each addon must have its own .txt file in a separate sub-directory which must follow one of the defined format: @@ -22,13 +23,26 @@ are: * platforms.txt: List of platforms to build an addon for (or "all"). It is also supported to specify negated platforms with a leading exclamation mark (i), e.g. "!windows". - Available platforms are: linux, windows, darwin, ios, android, rbpi + Available platforms are: linux, windows, osx, ios, android, rbpi, freebsd + +ATTENTION: If no addon definitions could be found the buildsystem assumes that + the bootstrapping of the addon definition repositories hasn't been + performed yet and automatically executes the addon bootstrapping + buildsystem located in the "bootstrap" sub-directory with the default + settings (i.e. all addons from all pre-defined addon definition + repositories are bootstrapped into the directory pointed to by the + ADDONS_DEFINITION_DIR option). The buildsystem uses the following variables (which can be passed into it when executing cmake with the -D= option) to e.g. access specific paths: - * ADDONS_TO_BUILD is a quoted, space delimited list of s that - you want to build (default is "all"). + * ADDONS_TO_BUILD has two variations, which are tested in order: + - a quoted, space delimited list of s that + you want to build (default is "all"). + - a regular expression that every is matched against + e.g.: ADDONS_TO_BUILD=pvr.* to build all pvr addons + * ADDONS_DEFINITION_DIR points to the directory containing the definitions + for the addons to be built. * ADDON_SRC_PREFIX can be used to override the addon repository location. It must point to the locally available parent directory of the addon(s) to build will be appended to this path automatically @@ -45,11 +59,15 @@ specific paths: absolute representation of ../../.. starting from this directory). * BUILD_DIR points to the directory where the addons and their dependencies will be downloaded and built. - * PACKAGE_ZIP=1 will mean the add-ons will be 'packaged' into a common folder, + * PACKAGE_ZIP=ON means that the add-ons will be 'packaged' into a common folder, rather than being placed in /lib/kodi/addons and /share/kodi/addons. + * PACKAGE_DIR points to the directory where the ZIP archived addons will be + stored after they have been packaged (defaults to /zips) * ARCH_DEFINES specifies the platform-specific C/C++ preprocessor defines (defaults to empty). + * ADDON_TARBALL_CACHING specifies whether downloaded addon source tarballs + should be cached or not (defaults to ON). The buildsystem makes some assumptions about the environment which must be met 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 @@ -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 @@ -!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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ +project(kodi-addons-bootstrap) + +cmake_minimum_required(VERSION 2.8) + +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) + +# make sure CMAKE_INSTALL_PREFIX is properly set +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/../addons") +endif() +list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) + +# figure out where the build directory is located +if(NOT BUILD_DIR) + set(BUILD_DIR "${CMAKE_BINARY_DIR}/build") +else() + file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR) +endif() +get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE) + +# make sure that the repositories to build have been specified +if(NOT REPOSITORY_TO_BUILD) + set(REPOSITORY_TO_BUILD_DEFAULT ON) + set(REPOSITORY_TO_BUILD "all") + set(REPOSITORY_REVISION "") + message(STATUS "Bootstrapping all repositories") +else() + set(REPOSITORY_TO_BUILD_DEFAULT OFF) + message(STATUS "Bootstrapping following repository: ${REPOSITORY_TO_BUILD}") +endif() + +# figure out which addons to bootstrap (defaults to all) +if(NOT ADDONS_TO_BUILD) + set(ADDONS_TO_BUILD "all") + message(STATUS "Bootstrapping all addons") +else() + message(STATUS "Bootstrapping following addons: ${ADDONS_TO_BUILD}") +endif() + +include(ExternalProject) + +function(bootstrap_repo repo_id repo_url repo_revision) + message(STATUS "Bootstrapping addons from ${repo_id} (${repo_url} ${repo_revision})...") + externalproject_add(${repo_id} + GIT_REPOSITORY ${repo_url} + GIT_TAG ${repo_revision} + PREFIX ${BUILD_DIR}/${repo_id} + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND ${CMAKE_COMMAND} + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + -DPROJECT_SOURCE_DIR= + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DADDONS_TO_BUILD=${ADDONS_TO_BUILD} + -P ${PROJECT_SOURCE_DIR}/bootstrap.cmake + ) +endfunction() + +# look for all addons repository definitions +set(REPOSITORY_TO_BUILD_FOUND OFF) +file(GLOB repos repositories/*.txt) +foreach(repo ${repos}) + file(STRINGS ${repo} repo_definition) + separate_arguments(repo_definition) + list(GET repo_definition 0 repo_id) + + list(FIND REPOSITORY_TO_BUILD ${repo_id} idx) + if(idx GREATER -1 OR REPOSITORY_TO_BUILD STREQUAL "all") + set(REPOSITORY_TO_BUILD_FOUND ON) + + # get the URL of the repository + list(GET repo_definition 1 repo_url) + + # get the revision of the repository if not provided as an argument + if(NOT REPOSITORY_REVISION) + list(GET repo_definition 2 repo_revision) + else() + set(repo_revision "${REPOSITORY_REVISION}") + endif() + + bootstrap_repo(${repo_id} ${repo_url} ${repo_revision}) + endif() +endforeach() + +# if we have been asked to bootstrap a specific repository (not the default one) and +# it couldn't be found in the predefined repository definitions we assume that it's a +# URL to a specific repository +if(NOT REPOSITORY_TO_BUILD_DEFAULT AND NOT REPOSITORY_TO_BUILD_FOUND) + # default to the master branch if no revision has been provided + if(NOT REPOSITORY_REVISION) + set(REPOSITORY_REVISION "master") + endif() + + bootstrap_repo(binary-addons-custom ${REPOSITORY_TO_BUILD} ${REPOSITORY_REVISION}) +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 @@ +# KODI ADDON DEFINITIONS BOOTSTRAPPING +This directory contains the cmake-based buildsystem for addon definitions +bootstrapping which downloads the addon definitions from one or more addon +definitions repositories. These addon definitions are then used by the addon +buildsystem to figure out which addons and which versions to build. It looks +into the "repositories" sub-directory and parses all *.txt files recursively. +Each addon definitions repository must have its own .txt file which +must follow the following defined format: +``` + +``` +where +* `` is the identification of the repository. +* `` must be the URL of the git repository containing the addon + definitions +* `` must be a valid git tag/branch/commit in the addon + definitions repository's git repository which will be used for the build + +The buildsystem uses the following variables (which can be passed into it when +executing cmake with the `-D=` option): +* `CMAKE_INSTALL_PREFIX` points to the directory where the downloaded addon +definitions will be installed to (defaults to `../addons`). +* `BUILD_DIR` points to the directory where the addon definitions repositories +will be downloaded to. +* `REPOSITORY_TO_BUILD` specifies a single addon definitions repository to be +downloaded and processed (defaults to `"all"`). +* `REPOSITORY_REVISION` specifies the git revision in the addon definitions +repository which will be used for the build. This option is only valid in +combination with the `REPOSITORY_TO_BUILD` option (defaults to the git +revision specified in the repository's definition file). +* `ADDONS_TO_BUILD` is a quoted, space delimited list of ``s that +should be bootstrapped (default is `"all"`). + +To trigger the cmake-based buildsystem the following command must be executed +with being the path to this directory (absolute or relative, allowing for +in-source and out-of-source builds). +``` +cmake -G +``` + +cmake supports multiple generators, see +http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list. + +In case of additional options the call might look like this +``` +cmake [-G ] \ + -DCMAKE_INSTALL_PREFIX="" +``` \ 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 @@ +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) + +# make sure that the installation location has been specified +if(NOT CMAKE_INSTALL_PREFIX) + message(FATAL_ERROR "CMAKE_INSTALL_PREFIX has not been specified") +endif() + +# figure out which addons to bootstrap (defaults to all) +if(NOT ADDONS_TO_BUILD) + set(ADDONS_TO_BUILD "all") +else() + separate_arguments(ADDONS_TO_BUILD) +endif() + +# find all addon definitions and go through them +file(GLOB_RECURSE ADDON_DEFINITIONS ${PROJECT_SOURCE_DIR}/*.txt) +foreach(ADDON_DEFINITION_FILE ${ADDON_DEFINITIONS}) + # ignore platforms.txt + if(NOT (ADDON_DEFINITION_FILE MATCHES platforms.txt)) + # read the addon definition file + file(STRINGS ${ADDON_DEFINITION_FILE} ADDON_DEFINITION) + separate_arguments(ADDON_DEFINITION) + + # extract the addon definition's identifier + list(GET ADDON_DEFINITION 0 ADDON_ID) + + # check if the addon definition should be built + list(FIND ADDONS_TO_BUILD ${ADDON_ID} ADDONS_TO_BUILD_IDX) + if(ADDONS_TO_BUILD_IDX GREATER -1 OR "${ADDONS_TO_BUILD}" STREQUAL "all") + # get the path to the addon definition directory + get_filename_component(ADDON_DEFINITION_DIR ${ADDON_DEFINITION_FILE} PATH) + + # install the addon definition + message(STATUS "Bootstrapping ${ADDON_ID} addon...") + file(INSTALL ${ADDON_DEFINITION_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}) + endif() + endif() +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 @@ -kodi -tinyxml \ No newline at end of file +tinyxml +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 @@ +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp +xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h +xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h +xbmc/cores/AudioEngine/Utils/AEChannelData.h +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 @@ +addons/kodi.adsp/* +addons/kodi.audiodecoder/* +addons/kodi.resource/* +addons/kodi.vfs/* +addons/xbmc.audioencoder/* +addons/xbmc.codec/* +addons/xbmc.core/* +addons/xbmc.gui/* +addons/xbmc.metadata/* +addons/xbmc.pvr/* +addons/xbmc.python/* +addons/xbmc.webinterface/* +addons/library.xbmc.addon/* +addons/library.xbmc.codec/* +addons/library.xbmc.gui/* +addons/library.xbmc.pvr/* +addons/repository.xbmc.org/* +addons/webinterface.default/* +addons/screensaver.xbmc.builtin.dim/* +addons/screensaver.xbmc.builtin.black/* +addons/script.module.pil/* +addons/script.module.pysqlite/* +addons/audioencoder.xbmc.builtin.aac/* +addons/audioencoder.xbmc.builtin.wav/* +addons/audioencoder.xbmc.builtin.wma/* +addons/resource.language.en_gb/* +addons/resource.uisounds.confluence/* +addons/resource.images.weathericons.default/* +addons/metadata.local/* +addons/metadata.album.universal/* +addons/metadata.artists.universal/* +addons/metadata.common.allmusic.com/* +addons/metadata.common.fanart.tv/* +addons/metadata.common.htbackdrops.com/* +addons/metadata.common.imdb.com/* +addons/metadata.common.musicbrainz.org/* +addons/metadata.common.theaudiodb.com/* +addons/metadata.common.themoviedb.org/* +addons/metadata.themoviedb.org/* +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 @@ +media/* +sounds/* +system/keymaps/* +system/library/* +system/players/VideoPlayer/etc/* +system/shaders/* +system/settings/* +userdata/* +system/addon-manifest.xml +system/colors.xml +system/peripherals.xml +system/playercorefactory.xml +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 @@ +xbmc/utils/test/CXBMCTinyXML-test.xml +xbmc/utils/test/data/language/Spanish/strings.po +xbmc/filesystem/test/reffile.txt +xbmc/filesystem/test/reffile.txt.rar +xbmc/filesystem/test/reffile.txt.zip +xbmc/filesystem/test/refRARnormal.rar +xbmc/filesystem/test/refRARstored.rar +xbmc/network/test/data/test.html +xbmc/network/test/data/test.png +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 @@ +system/*.dll +system/airplay/*.dll +system/cdrip/*.dll +system/players/dvdplayer/*.dll +system/players/paplayer/*.dll +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 @@ +system/IRSSmap.xml +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 @@ -SET(KODI_INCLUDE_DIR @prefix@/include) SET(APP_NAME @APP_NAME@) +SET(APP_NAME_LC @APP_NAME_LC@) +SET(APP_NAME_UC @APP_NAME_UC@) SET(APP_VERSION_MAJOR @APP_VERSION_MAJOR@) SET(APP_VERSION_MINOR @APP_VERSION_MINOR@) +IF(NOT @APP_NAME_UC@_PREFIX) + SET(@APP_NAME_UC@_PREFIX @APP_PREFIX@) +ENDIF() +IF(NOT @APP_NAME_UC@_INCLUDE_DIR) + SET(@APP_NAME_UC@_INCLUDE_DIR @APP_INCLUDE_DIR@) +ENDIF() +IF(NOT @APP_NAME_UC@_LIB_DIR) + SET(@APP_NAME_UC@_LIB_DIR @APP_LIB_DIR@) +ENDIF() IF(NOT WIN32) SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@") ENDIF() -LIST(APPEND CMAKE_MODULE_PATH @prefix@/lib/kodi) +LIST(APPEND CMAKE_MODULE_PATH @APP_LIB_DIR@) ADD_DEFINITIONS(@ARCH_DEFINES@ -DBUILD_KODI_ADDON) +if(NOT CORE_SYSTEM_NAME) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(CORE_SYSTEM_NAME "osx") + else() + string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) + endif() +endif() + 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 @@ +#.rst: +# FindAML +# ------- +# Finds the AML codec +# +# This will will define the following variables:: +# +# AML_FOUND - system has AML +# AML_INCLUDE_DIRS - the AML include directory +# AML_DEFINITIONS - the AML definitions +# +# and the following imported targets:: +# +# AML::AML - The AML codec + +find_path(AML_INCLUDE_DIR codec_error.h + PATH_SUFFIXES amcodec) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(AML + REQUIRED_VARS AML_INCLUDE_DIR) + +if(AML_FOUND) + set(AML_INCLUDE_DIRS ${AML_INCLUDE_DIR}) + set(AML_DEFINITIONS -DHAS_LIBAMCODEC=1) + + if(NOT TARGET AML::AML) + add_library(AML::AML UNKNOWN IMPORTED) + set_target_properties(AML::AML PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${AML_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAS_LIBAMCODEC=1) + endif() +endif() + +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 @@ +# - Try to find ASS +# Once done this will define +# +# ASS_FOUND - system has libass +# ASS_INCLUDE_DIRS - the libass include directory +# ASS_LIBRARIES - The libass libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (ASS libass) +else() + find_path(ASS_INCLUDE_DIRS ass/ass.h) + find_library(ASS_LIBRARIES NAMES ass libass) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ASS DEFAULT_MSG ASS_INCLUDE_DIRS ASS_LIBRARIES) + +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 @@ +# - Try to find ALSA +# Once done this will define +# +# ALSA_FOUND - system has libALSA +# ALSA_INCLUDE_DIRS - the libALSA include directory +# ALSA_LIBRARIES - The libALSA libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (ALSA alsa) +else() + find_path(ALSA_INCLUDE_DIRS asoundlib.h PATH_SUFFIXES alsa) + find_library(ALSA_LIBRARIES asound) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Alsa DEFAULT_MSG ALSA_INCLUDE_DIRS ALSA_LIBRARIES) + +set(ALSA_INCLUDE_DIRS "") # Dont want these added as 'timer.h' is a dangerous file +mark_as_advanced(ALSA_INCLUDE_DIRS ALSA_LIBRARIES) +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 @@ +# - Try to find avahi +# Once done this will define +# +# AVAHI_FOUND - system has avahi +# AVAHI_INCLUDE_DIRS - the avahi include directory +# AVAHI_LIBRARIES - The avahi libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (AVAHI avahi-client) + list(APPEND AVAHI_INCLUDE_DIRS ${AVAHI_INCLUDEDIR}) +else() + find_path(AVAHI_CLIENT_INCLUDE_DIRS avahi-client/client.h) + find_path(AVAHI_COMMON_INCLUDE_DIRS avahi-common/defs.h) + find_library(AVAHI_COMMON_LIBRARIES avahi-common) + find_library(AVAHI_CLIENT_LIBRARIES avahi-common) + set(AVAHI_INCLUDE_DIRS ${AVAHI_CLIENT_INCLUDE_DIRS} + ${AVAHI_COMMON_INCLUDE_DIRS}) + set(AVAHI_LIBRARIES ${AVAHI_CLIENT_LIBRARIES} + ${AVAHI_COMMON_LIBRARIES}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Avahi DEFAULT_MSG AVAHI_INCLUDE_DIRS AVAHI_LIBRARIES) + +mark_as_advanced(AVAHI_INCLUDE_DIRS AVAHI_LIBRARIES) +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 @@ +#.rst: +# FindBluray +# ---------- +# Finds the libbluray library +# +# This will will define the following variables:: +# +# BLURAY_FOUND - system has libbluray +# BLURAY_INCLUDE_DIRS - the libbluray include directory +# BLURAY_LIBRARIES - the libbluray libraries +# BLURAY_DEFINITIONS - the libbluray compile definitions +# +# and the following imported targets:: +# +# Bluray::Bluray - The libblueray library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(BLURAY libbluray>=0.7.0) + set(BLURAY_VERSION ${PC_BLURAY_VERSION}) +else() + find_path(BLURAY_INCLUDE_DIR libbluray/bluray.h + PATHS ${PC_BLURAY_INCLUDEDIR}) + + include(FindPackageHandleStandardArgs) + if(NOT WIN32) + find_library(BLURAY_LIBRARY NAMES bluray + PATHS ${PC_BLURAY_LIBDIR}) + + find_package_handle_standard_args(BLURAY + REQUIRED_VARS BLURAY_LIBRARY BLURAY_INCLUDE_DIR + VERSION_VAR BLURAY_VERSION) + else() + # Dynamically loaded DLL + find_package_handle_standard_args(BLURAY + REQUIRED_VARS BLURAY_INCLUDE_DIR + VERSION_VAR BLURAY_VERSION) + endif() +endif() + +if(BLURAY_FOUND) + set(BLURAY_LIBRARIES ${BLURAY_LIBRARY}) + set(BLURAY_INCLUDE_DIRS ${BLURAY_INCLUDE_DIR}) + set(BLURAY_DEFINITIONS -DHAVE_LIBBLURAY=1) + + if(NOT TARGET Bluray::Bluray) + add_library(Bluray::Bluray UNKNOWN IMPORTED) + if(BLURAY_LIBRARY) + set_target_properties(Bluray::Bluray PROPERTIES + IMPORTED_LOCATION "${BLURAY_LIBRARY}") + endif() + set_target_properties(Bluray::Bluray PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${BLURAY_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBBLURAY=1) + endif() +endif() + +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 @@ +find_program(CCACHE_FOUND ccache) +if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) +endif(CCACHE_FOUND) + 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 @@ +#.rst: +# FindCEC +# ------- +# Finds the libCEC library +# +# This will will define the following variables:: +# +# CEC_FOUND - system has libCEC +# CEC_INCLUDE_DIRS - the libCEC include directory +# CEC_LIBRARIES - the libCEC libraries +# CEC_DEFINITIONS - the libCEC compile definitions +# +# and the following imported targets:: +# +# CEC::CEC - The libCEC library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_CEC libCEC>=3.0.0 QUIET) +endif() + +find_path(CEC_INCLUDE_DIR libCEC/CEC.h + PATHS ${PC_CEC_INCLUDEDIR}) + +set(CEC_VERSION ${PC_CEC_VERSION}) + +include(FindPackageHandleStandardArgs) +if(NOT WIN32) + find_library(CEC_LIBRARY NAMES cec + PATHS ${PC_CEC_LIBDIR}) + + find_package_handle_standard_args(CEC + REQUIRED_VARS CEC_LIBRARY CEC_INCLUDE_DIR + VERSION_VAR CEC_VERSION) +else() + # Dynamically loaded DLL + find_package_handle_standard_args(CEC + REQUIRED_VARS CEC_INCLUDE_DIR + VERSION_VAR CEC_VERSION) +endif() + +if(CEC_FOUND) + set(CEC_LIBRARIES ${CEC_LIBRARY}) + set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIR}) + set(CEC_DEFINITIONS -DHAVE_LIBCEC=1) + + if(NOT TARGET CEC::CEC) + add_library(CEC::CEC UNKNOWN IMPORTED) + if(CEC_LIBRARY) + set_target_properties(CEC::CEC PROPERTIES + IMPORTED_LOCATION "${CEC_LIBRARY}") + endif() + set_target_properties(CEC::CEC PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CEC_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBCEC=1) + endif() +endif() + +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 @@ +include(TestCXXAcceptsFlag) + +# try to use compiler flag -std=c++11 +check_cxx_accepts_flag("-std=c++11" CXX_FLAG_CXX11) +if(CXX_FLAG_CXX11) + add_options (CXX ALL_BUILDS "-std=c++11") + set(CXX_STD11_FLAGS "-std=c++11") +else() + # try to use compiler flag -std=c++0x for older compilers + check_cxx_accepts_flag("-std=c++0x" CXX_FLAG_CXX0X) + if(CXX_FLAG_CXX0X) + add_options (CXX ALL_BUILDS "-std=c++0x") + set(CXX_STD11_FLAGS "-std=c++0x") + endif(CXX_FLAG_CXX0X) +endif(CXX_FLAG_CXX11) + +include(FindPackageHandleStandardArgs) +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 @@ +# - Try to find cdio +# Once done this will define +# +# CDIO_FOUND - system has libcdio +# CDIO_INCLUDE_DIRS - the libcdio include directory +# CDIO_LIBRARIES - The libcdio libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (CDIO libcdio libiso9660) + list(APPEND CDIO_INCLUDE_DIRS ${CDIO_libcdio_INCLUDEDIR} ${CDIO_libiso9660_INCLUDEDIR}) +endif() +if(NOT CDIO_FOUND) + find_path(CDIO_INCLUDE_DIRS cdio/cdio.h) + find_library(MODPLUG_LIBRARIES NAMES cdio) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Cdio DEFAULT_MSG CDIO_INCLUDE_DIRS CDIO_LIBRARIES) + +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 @@ +# - Builds Cpluff as external project +# Once done this will define +# +# CPLUFF_FOUND - system has cpluff +# CPLUFF_INCLUDE_DIRS - the cpluff include directories +# +# and link Kodi against the cpluff libraries. + +if(NOT WIN32) + string(REPLACE ";" " " defines "${CMAKE_C_FLAGS} ${SYSTEM_DEFINES} -I${EXPAT_INCLUDE_DIR}") + get_filename_component(expat_dir ${EXPAT_LIBRARY} PATH) + set(ldflags "-L${expat_dir}") + ExternalProject_Add(libcpluff SOURCE_DIR ${CORE_SOURCE_DIR}/lib/cpluff + PREFIX ${CORE_BUILD_DIR}/cpluff + PATCH_COMMAND rm -f config.status + UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif + CONFIGURE_COMMAND CC=${CMAKE_C_COMPILER} ${CORE_SOURCE_DIR}/lib/cpluff/configure + --disable-nls + --enable-static + --disable-shared + --with-pic + --prefix= + --host=${ARCH} + CFLAGS=${defines} + LDFLAGS=${ldflags} + BUILD_COMMAND make V=1) + set(ldflags "${ldflags};-lexpat") + core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/lib/libcpluff.a + system/libcpluff libcpluff extras "${ldflags}") + set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE) +else() + ExternalProject_Add(libcpluff SOURCE_DIR ${CORE_SOURCE_DIR}/lib/cpluff + PREFIX ${CORE_BUILD_DIR}/cpluff + CONFIGURE_COMMAND "" + # TODO: Building the project directly from lib/cpluff/libcpluff/win32/cpluff.vcxproj + # fails becaue it imports XBMC.defaults.props + BUILD_COMMAND devenv /build ${CORE_BUILD_CONFIG} + ${CORE_SOURCE_DIR}/project/VS2010Express/XBMC\ for\ Windows.sln + /project cpluff + INSTALL_COMMAND "") + # TODO: core_link_library +endif() + +set(CPLUFF_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/include) +set(CPLUFF_FOUND 1) +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 @@ +if(ENABLE_INTERNAL_CROSSGUID) + include(ExternalProject) + file(STRINGS ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/Makefile VER) + string(REGEX MATCH "VERSION=[^ ]*" CGUID_VER "${VER}") + list(GET CGUID_VER 0 CGUID_VER) + string(SUBSTRING "${CGUID_VER}" 8 -1 CGUID_VER) + + externalproject_add(crossguid + URL http://mirrors.kodi.tv/build-deps/sources/crossguid-${CGUID_VER}.tar.gz + PREFIX ${CORE_BUILD_DIR}/crossguid + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/CMakeLists.txt + && + ${CMAKE_COMMAND} -E copy + ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/FindUUID.cmake + && + ${CMAKE_COMMAND} -E copy + ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/FindCXX11.cmake + ) + + set(CROSSGUID_FOUND 1) + set(CROSSGUID_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/libcrossguid.a) + set(CROSSGUID_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(CROSSGUID DEFAULT_MSG CROSSGUID_INCLUDE_DIRS CROSSGUID_LIBRARIES) + mark_as_advanced(CROSSGUID_INCLUDE_DIRS CROSSGUID_LIBRARIES CROSSGUID_DEFINITIONS CROSSGUID_FOUND) +else() + find_path(CROSSGUID_INCLUDE_DIR guid.h) + + find_library(CROSSGUID_LIBRARY_RELEASE NAMES crossguid + ${CONFIGURATION_LIBDIR_RELEASE}) + find_library(CROSSGUID_LIBRARY_DEBUG NAMES crossguidd + ${CONFIGURATION_LIBDIR_DEBUG}) + + include(SelectLibraryConfigurations) + select_library_configurations(CROSSGUID) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(CROSSGUID + REQUIRED_VARS CROSSGUID_LIBRARY CROSSGUID_INCLUDE_DIR) + + if(CROSSGUID_FOUND) + set(CROSSGUID_LIBRARIES ${CROSSGUID_LIBRARY}) + set(CROSSGUID_INCLUDE_DIRS ${CROSSGUID_INCLUDE_DIR}) + endif() + mark_as_advanced(CROSSGUID_INCLUDE_DIR CROSSGUID_LIBRARY) +endif() + +if(NOT WIN32 AND NOT APPLE) + find_package(UUID REQUIRED) + list(APPEND CROSSGUID_INCLUDE_DIRS ${UUID_INCLUDE_DIRS}) + list(APPEND CROSSGUID_LIBRARIES ${UUID_LIBRARIES}) +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 @@ +# - Try to find CURL +# Once done this will define +# +# CURL_FOUND - system has libcurl +# CURL_INCLUDE_DIRS - the libcurl include directory +# CURL_LIBRARIES - The libcurl libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (CURL libcurl) + list(APPEND CURL_INCLUDE_DIRS ${CURL_INCLUDEDIR}) +else() + find_path(CURL_INCLUDE_DIRS curl/curl.h) + find_library(CURL_LIBRARIES NAMES curl libcurl) +endif() +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Curl DEFAULT_MSG CURL_INCLUDE_DIRS CURL_LIBRARIES) + +mark_as_advanced(CURL_INCLUDE_DIRS CURL_LIBRARIES) + +if(CURL_FOUND) + if(NOT CURL_LIBRARY_DIRS AND CURL_LIBDIR) + set(CURL_LIBRARY_DIRS ${CURL_LIBDIR}) + endif() + + find_soname(CURL) + + if(EXISTS "${CURL_LIBRARY_DIRS}/${CURL_SONAME}") + execute_process(COMMAND readelf -s ${CURL_LIBRARY_DIRS}/${CURL_SONAME} COMMAND grep CRYPTO_set_locking_call OUTPUT_VARIABLE HAS_CURL_STATIC) + else() + message(FATAL_ERROR "curl library not found") + endif() +endif() + +if(HAS_CURL_STATIC) + mark_as_advanced(HAS_CURL_STATIC) + list(APPEND CURL_DEFINITIONS -DHAS_CURL_STATIC=1) +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 @@ +# - Builds D3DX11Effects as external project +# Once done this will define +# +# D3DX11EFFECTS_FOUND - system has D3DX11Effects +# D3DX11EFFECTS_INCLUDE_DIRS - the D3DX11Effects include directories +# D3DCOMPILER_DLL - Path to the Direct3D Compiler + +include(ExternalProject) +ExternalProject_Add(d3dx11effects + SOURCE_DIR ${CORE_SOURCE_DIR}/lib/win32/Effects11 + PREFIX ${CORE_BUILD_DIR}/Effects11 + CONFIGURE_COMMAND "" + BUILD_COMMAND devenv /build ${CORE_BUILD_CONFIG} + ${CORE_SOURCE_DIR}/lib/win32/Effects11/Effects11_2013.sln + INSTALL_COMMAND "") + +set(D3DX11EFFECTS_FOUND 1) +set(D3DX11EFFECTS_INCLUDE_DIRS ${CORE_SOURCE_DIR}/lib/win32/Effects11/inc) + +set(D3DX11EFFECTS_LIBRARY_RELEASE ${CORE_SOURCE_DIR}/lib/win32/Effects11/libs/Effects11/Release/Effects11.lib) +set(D3DX11EFFECTS_LIBRARY_DEBUG ${CORE_SOURCE_DIR}/lib/win32/Effects11/libs/Effects11/Debug/Effects11.lib) +include(SelectLibraryConfigurations) +select_library_configurations(D3DX11EFFECTS) + +mark_as_advanced(D3DX11EFFECTS_FOUND) + +find_file(D3DCOMPILER_DLL + NAMES d3dcompiler_47.dll d3dcompiler_46.dll + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/Redist/D3D/x86" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/Redist/D3D/x86" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/Redist/D3D/x86" + "$ENV{WindowsSdkDir}Redist/d3d/x86" + NO_DEFAULT_PATH) +if(NOT D3DCOMPILER_DLL) + message(WARNING "Could NOT find Direct3D Compiler") +endif() +mark_as_advanced(D3DCOMPILER_DLL) + +find_program(FXC fxc + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/bin/x86" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/bin/x86" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/bin/x86" + "$ENV{WindowsSdkDir}bin/x86") +if(NOT FXC) + message(WARNING "Could NOT find DirectX Effects Compiler (FXC)") +endif() +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 @@ +# - Try to find dbus +# Once done this will define +# +# DBUS_FOUND - system has libdbus +# DBUS_INCLUDE_DIRS - the libdbus include directory +# DBUS_LIBRARIES - The libdbus libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (DBUS dbus-1) +endif() + +if(DBUS_FOUND) + find_path(DBUS_INCLUDE_DIRS dbus/dbus.h PATH_SUFFIXES dbus-1.0) + find_library(DBUS_LIBRARIES dbus-1.0) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Dbus DEFAULT_MSG DBUS_INCLUDE_DIRS DBUS_LIBRARIES) + +list(APPEND DBUS_DEFINITIONS -DHAVE_DBUS=1) +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 @@ +#.rst: +# FindEGL +# ------- +# Finds the EGL library +# +# This will will define the following variables:: +# +# EGL_FOUND - system has EGL +# EGL_INCLUDE_DIRS - the EGL include directory +# EGL_LIBRARIES - the EGL libraries +# EGL_DEFINITIONS - the EGL definitions +# +# and the following imported targets:: +# +# EGL::EGL - The EGL library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_EGL egl QUIET) +endif() + +find_path(EGL_INCLUDE_DIR EGL/egl.h + PATHS ${PC_EGL_INCLUDEDIR}) + +find_library(EGL_LIBRARY NAMES EGL egl + PATHS ${PC_EGL_LIBDIR}) + +set(EGL_VERSION ${PC_EGL_VERSION}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(EGL + REQUIRED_VARS EGL_LIBRARY EGL_INCLUDE_DIR + VERSION_VAR EGL_VERSION) + +if(EGL_FOUND) + set(EGL_LIBRARIES ${EGL_LIBRARY}) + set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR}) + set(EGL_DEFINITIONS -DHAVE_LIBEGL=1) + + if(NOT TARGET EGL::EGL) + add_library(EGL::EGL UNKNOWN IMPORTED) + set_target_properties(EGL::EGL PROPERTIES + IMPORTED_LOCATION "${EGL_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBEGL=1) + endif() +endif() + +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 @@ +# - Try to find embedded platforms (RPI/IMX6) +# Once done this will define +# +# EMBEDDED_FOUND - system is RPI / IMX6 and we most probably want to compile for GLES2 support +# (don't configure for OpenGL) + +if(NOT CMAKE_SYSTEM_PROCESSOR) + set(CMAKE_SYSTEM_PROCESSOR ${CPU}) +endif() + +string(REGEX MATCH "^arm" TARGET_ARCH_ARM "${CMAKE_SYSTEM_PROCESSOR}") +if(NOT CMAKE_CROSSCOMPILING AND NOT TARGET_ARCH_ARM) + return() +endif(NOT CMAKE_CROSSCOMPILING AND NOT TARGET_ARCH_ARM) + +find_path(EMBEDDED_FOUND NAMES include/linux/imxfb.h include/bcm_host.h PATHS /opt/vc) + 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 @@ +include(ExternalProject) +file(STRINGS ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/FFMPEG-VERSION VER) +string(REGEX MATCH "VERSION=[^ ]*$.*" FFMPEG_VER "${VER}") +list(GET FFMPEG_VER 0 FFMPEG_VER) +string(SUBSTRING "${FFMPEG_VER}" 8 -1 FFMPEG_VER) +string(REGEX MATCH "BASE_URL=([^ ]*)" FFMPEG_BASE_URL "${VER}") +list(GET FFMPEG_BASE_URL 0 FFMPEG_BASE_URL) +string(SUBSTRING "${FFMPEG_BASE_URL}" 9 -1 FFMPEG_BASE_URL) + + +if(ENABLE_INTERNAL_FFMPEG) + if(FFMPEG_PATH) + message(WARNING "Internal FFmpeg enabled, but FFMPEG_PATH given, ignoring") + endif() + if(CMAKE_CROSSCOMPILING) + set(CROSS_ARGS -DDEPENDS_PATH=${DEPENDS_PATH} + -DPKG_CONFIG_EXECUTABLE=${PKG_CONFIG_EXECUTABLE} + -DCROSSCOMPILING=${CMAKE_CROSSCOMPILING} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} + -DCPU=${WITH_CPU} + -DOS=${OS} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_AR=${CMAKE_AR} + -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} + -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}) + endif() + + externalproject_add(ffmpeg + URL ${FFMPEG_BASE_URL}/${FFMPEG_VER}.tar.gz + PREFIX ${CORE_BUILD_DIR}/ffmpeg + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} + -DCMAKE_BUILD_TYPE=${DCMAKE_BUILD_TYPE} + -DFFMPEG_VER=${FFMPEG_VER} + -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} + ${CROSS_ARGS} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/CMakeLists.txt + && + ${CMAKE_COMMAND} -E copy + ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/FindGnuTls.cmake + ) + + file(WRITE ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg/ffmpeg-link-wrapper +"#!/bin/bash +if [[ $@ == *${APP_NAME_LC}.bin* || $@ == *${APP_NAME_LC}-test* ]] +then + avformat=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavcodec` + avcodec=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavformat` + avfilter=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavfilter` + avutil=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavutil` + swscale=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswscale` + swresample=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswresample` + gnutls=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors gnutls` + vorbisenc=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors vorbisenc` + dcadec=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors dcadec` + $@ $avcodec $avformat $avcodec $avfilter $swscale $swresample -lpostproc $gnutls $vorbisenc $dcadec +else + $@ +fi") + file(COPY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg/ffmpeg-link-wrapper + DESTINATION ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) + set(FFMPEG_LINK_EXECUTABLE "${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg-link-wrapper -o " PARENT_SCOPE) + set(FFMPEG_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include) + list(APPEND FFMPEG_DEFINITIONS -DFFMPEG_VER_SHA=\"${FFMPEG_VER}\" + -DUSE_STATIC_FFMPEG=1) + set(FFMPEG_FOUND 1) +else() + if(FFMPEG_PATH) + set(ENV{PKG_CONFIG_PATH} "${FFMPEG_PATH}/lib/pkgconfig") + endif() + set(FFMPEG_PKGS libavcodec>=56.26.100 libavfilter>=5.11.100 libavformat>=56.25.101 + libavutil>=54.20.100 libswscale>=3.1.101 libswresample>=1.1.100 libpostproc>=53.3.100) + if(PKG_CONFIG_FOUND) + pkg_check_modules (FFMPEG ${FFMPEG_PKGS}) + string(REGEX REPLACE "framework;" "framework " FFMPEG_LDFLAGS "${FFMPEG_LDFLAGS}") + set(FFMPEG_LIBRARIES ${FFMPEG_LDFLAGS}) + else() + find_path(FFMPEG_INCLUDE_DIRS libavcodec/avcodec.h PATH_SUFFIXES ffmpeg) + find_library(FFMPEG_LIBAVCODEC NAMES avcodec libavcodec PATH_SUFFIXES ffmpeg/libavcodec) + find_library(FFMPEG_LIBAVFILTER NAMES avfilter libavfilter PATH_SUFFIXES ffmpeg/libavfilter) + find_library(FFMPEG_LIBAVFORMAT NAMES avformat libavformat PATH_SUFFIXES ffmpeg/libavformat) + find_library(FFMPEG_LIBAVUTIL NAMES avutil libavutil PATH_SUFFIXES ffmpeg/libavutil) + find_library(FFMPEG_LIBSWSCALE NAMES swscale libswscale PATH_SUFFIXES ffmpeg/libswscale) + find_library(FFMPEG_LIBPOSTPROC NAMES postproc libpostproc PATH_SUFFIXES ffmpeg/libpostproc) + set(FFMPEG_LIBRARIES ${FFMPEG_LIBAVCODEC} ${FFMPEG_LIBAVFILTER} ${FFMPEG_LIBAVFORMAT} + ${FFMPEG_LIBAVUTIL} ${FFMPEG_LIBSWSCALE} ${FFMPEG_LIBPOSTPROC}) + add_custom_target(ffmpeg DEPENDS ${FFMPEG_LIBRARIES}) + endif() + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(FFMPEG DEFAULT_MSG FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES) + set(FFMPEG_FOUND 1) + list(APPEND FFMPEG_DEFINITIONS -DFFMPEG_VER_SHA=\"${FFMPEG_VER}\") +endif() + +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 @@ +# - Try to find freetype +# Once done this will define +# +# FREETYPE_FOUND - system has freetype +# FREETYPE_INCLUDE_DIRS - the freetype include directory +# FREETYPE_LIBRARIES - The freetype libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (FREETYPE freetype2) +else() + find_path(FREETYPE_INCLUDE_DIRS freetype/freetype.h) + find_library(FREETYPE_LIBRARIES NAMES freetype freetype246MT) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FreeType DEFAULT_MSG FREETYPE_INCLUDE_DIRS FREETYPE_LIBRARIES) + +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 @@ +# - Try to find Fribidi +# Once done this will define +# +# FRIBIDI_FOUND - system has fribidi +# FRIBIDI_INCLUDE_DIRS - the fribidi include directory +# FRIBIDI_LIBRARIES - The fribidi libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (FRIBIDI fribidi) +else() + find_path(FRIBIDI_INCLUDE_DIRS fribidi/fribidi.h) + find_library(FRIBIDI_LIBRARIES NAMES fribidi libfribidi) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Fribidi DEFAULT_MSG FRIBIDI_INCLUDE_DIRS FRIBIDI_LIBRARIES) + +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 @@ +#.rst: +# FindGIF +# ------- +# Finds the libgif library +# +# This will will define the following variables:: +# +# GIF_FOUND - system has libgif +# GIF_INCLUDE_DIRS - the libgif include directory +# GIF_LIBRARIES - the libgif libraries +# +# and the following imported targets:: +# +# GIF::GIF - The libgif library + +find_path(GIF_INCLUDE_DIR gif_lib.h) + +include(FindPackageHandleStandardArgs) +if(NOT WIN32) + find_library(GIF_LIBRARY NAMES gif) + find_package_handle_standard_args(GIF + REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR) +else() + # Dynamically loaded DLL + find_package_handle_standard_args(GIF + REQUIRED_VARS GIF_INCLUDE_DIR) +endif() + +if(GIF_FOUND) + set(GIF_LIBRARIES ${GIF_LIBRARY}) + set(GIF_INCLUDE_DIRS ${GIF_INCLUDE_DIR}) + set(GIF_DEFINITIONS -DHAVE_LIBGIF=1) + + if(NOT TARGET GIF::GIF) + add_library(GIF::GIF UNKNOWN IMPORTED) + if(GIF_LIBRARY) + set_target_properties(GIF::GIF PROPERTIES + IMPORTED_LOCATION "${GIF_LIBRARY}") + endif() + set_target_properties(GIF::GIF PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GIF_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBGIF=1) + endif() +endif() + +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 @@ +#.rst: +# FindJsonSchemaBuilder +# --------------------- +# Finds the JsonSchemaBuilder +# +# This will define the following (imported) targets:: +# +# JsonSchemaBuilder::JsonSchemaBuilder - The JsonSchemaBuilder executable + +if(NOT TARGET JsonSchemaBuilder::JsonSchemaBuilder) + if(CMAKE_CROSSCOMPILING) + add_executable(JsonSchemaBuilder::JsonSchemaBuilder IMPORTED GLOBAL) + set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES + IMPORTED_LOCATION "${NATIVEPREFIX}/bin/JsonSchemaBuilder") + else() + add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/JsonSchemaBuilder build/jsonschemabuilder) + add_executable(JsonSchemaBuilder::JsonSchemaBuilder ALIAS JsonSchemaBuilder) + endif() +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 @@ +set(dvdlibs libdvdread libdvdnav) +if(ENABLE_DVDCSS) + list(APPEND dvdlibs libdvdcss) +endif() + +if(NOT WIN32) + foreach(dvdlib ${dvdlibs}) + file(GLOB VERSION_FILE ${CORE_SOURCE_DIR}/tools/depends/target/${dvdlib}/DVD*-VERSION) + file(STRINGS ${VERSION_FILE} VER) + string(REGEX MATCH "VERSION=[^ ]*$.*" ${dvdlib}_VER "${VER}") + list(GET ${dvdlib}_VER 0 ${dvdlib}_VER) + string(SUBSTRING "${${dvdlib}_VER}" 8 -1 ${dvdlib}_VER) + string(REGEX MATCH "BASE_URL=([^ ]*)" ${dvdlib}_BASE_URL "${VER}") + list(GET ${dvdlib}_BASE_URL 0 ${dvdlib}_BASE_URL) + string(SUBSTRING "${${dvdlib}_BASE_URL}" 9 -1 ${dvdlib}_BASE_URL) + endforeach() + + set(DVDREAD_CFLAGS "${DVDREAD_CFLAGS} -I${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include") + if(CMAKE_CROSSCOMPILING) + set(EXTRA_FLAGS "CC=${CMAKE_C_COMPILER}") + endif() + + if(APPLE) + set(CMAKE_LD_FLAGS "-framework IOKit -framework CoreFoundation") + endif() + + if(ENABLE_DVDCSS) + ExternalProject_ADD(dvdcss URL ${libdvdcss_BASE_URL}/archive/${libdvdcss_VER}.tar.gz + PREFIX ${CORE_BUILD_DIR}/libdvd + UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif + CONFIGURE_COMMAND ac_cv_path_GIT= /configure + --target=${ARCH} + --host=${ARCH} + --disable-doc + --enable-static + --disable-shared + --with-pic + --prefix= + "${EXTRA_FLAGS}" + "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}" + "LDFLAGS=${CMAKE_LD_FLAGS}") + + core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdcss.a + system/players/VideoPlayer/libdvdcss dvdcss) + endif() + + set(DVDREAD_CFLAGS "-D_XBMC") + if(ENABLE_DVDCSS) + set(DVDREAD_CFLAGS "${DVDREAD_CFLAGS} -DHAVE_DVDCSS_DVDCSS_H -I${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include") + endif(ENABLE_DVDCSS) + + ExternalProject_ADD(dvdread URL ${libdvdread_BASE_URL}/archive/${libdvdread_VER}.tar.gz + PREFIX ${CORE_BUILD_DIR}/libdvd + UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif + CONFIGURE_COMMAND ac_cv_path_GIT= /configure + --target=${ARCH} + --host=${ARCH} + --enable-static + --disable-shared + --with-pic + --prefix= + "${EXTRA_FLAGS}" + "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}" + "LDFLAGS=${CMAKE_LD_FLAGS}") + if(ENABLE_DVDCSS) + add_dependencies(dvdread dvdcss) + endif() + + core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.a + system/players/VideoPlayer/libdvdread dvdread) + + if(ENABLE_DVDCSS) + set(DVDNAV_LIBS -ldvdcss) + endif(ENABLE_DVDCSS) + + ExternalProject_ADD(dvdnav URL ${libdvdnav_BASE_URL}/archive/${libdvdnav_VER}.tar.gz + PREFIX ${CORE_BUILD_DIR}/libdvd + UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif + CONFIGURE_COMMAND ac_cv_path_GIT= /configure + --target=${ARCH} + --host=${ARCH} + --enable-static + --disable-shared + --with-pic + --prefix=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd + "${EXTRA_FLAGS}" + "LDFLAGS=${CMAKE_LD_FLAGS} -L${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib" + "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}" + "DVDREAD_CFLAGS=${DVDREAD_CFLAGS}" + "DVDREAD_LIBS=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.la" + "LIBS=${DVDNAV_LIBS}") + add_dependencies(dvdnav dvdread) + core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdnav.a + system/players/VideoPlayer/libdvdnav dvdnav) + + set(LIBDVD_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include) + set(LIBDVD_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdnav.a + ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.a) + if(ENABLE_DVDCSS) + list(APPEND LIBDVD_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdcss.a) + endif() + set(LIBDVD_LIBRARIES ${LIBDVD_LIBRARIES} CACHE STRING "libdvd libraries" FORCE) + set(LIBDVD_FOUND 1 CACHE BOOL "libdvd found" FORCE) +else() + # Dynamically loaded on Windows + find_path(LIBDVD_INCLUDE_DIR dvdcss/dvdcss.h PATHS ${CORE_SOURCE_DIR}/lib/libdvd/include) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(LIBDVD REQUIRED_VARS LIBDVD_INCLUDE_DIR) + + if(LIBDVD_FOUND) + set(LIBDVD_INCLUDE_DIRS ${LIBDVD_INCLUDE_DIR}) + endif() + + mark_as_advanced(LIBDVD_INCLUDE_DIR) +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 @@ +# - Try to find Libsmbclient + +if(PKGCONFIG_FOUND) + pkg_check_modules(LIBSMBCLIENT smbclient) + set(LIBSMBCLIENT_DEFINITIONS -DHAVE_LIBSMBCLIENT=1) +endif() + +if (LIBSMBCLIENT_LIBRARIES AND LIBSMBCLIENT_INCLUDE_DIRS) + # in cache already + set(LIBSMBCLIENT_FOUND TRUE) +else (LIBSMBCLIENT_LIBRARIES AND LIBSMBCLIENT_INCLUDE_DIRS) + find_path(LIBSMBCLIENT_INCLUDE_DIR + NAMES + libsmbclient.h + PATHS + /usr/include + /usr/local/include + /opt/local/include + /sw/include + ) + + find_library(SMBCLIENT_LIBRARY + NAMES + smbclient + PATHS + /usr/lib + /usr/local/lib + /opt/local/lib + /sw/lib + ) + + if (SMBCLIENT_LIBRARY) + set(SMBCLIENT_FOUND TRUE) + endif (SMBCLIENT_LIBRARY) + + set(LIBSMBCLIENT_INCLUDE_DIRS + ${LIBSMBCLIENT_INCLUDE_DIR} + ) + + if (SMBCLIENT_FOUND) + set(LIBSMBCLIENT_LIBRARIES + ${LIBSMBCLIENT_LIBRARIES} + ${SMBCLIENT_LIBRARY} + ) + endif (SMBCLIENT_FOUND) + + if (LIBSMBCLIENT_INCLUDE_DIRS AND LIBSMBCLIENT_LIBRARIES) + set(LIBSMBCLIENT_FOUND TRUE) + endif (LIBSMBCLIENT_INCLUDE_DIRS AND LIBSMBCLIENT_LIBRARIES) + + if (LIBSMBCLIENT_FOUND) + if (NOT Libsmbclient_FIND_QUIETLY) + message(STATUS "Found Libsmbclient: ${LIBSMBCLIENT_LIBRARIES}") + endif (NOT Libsmbclient_FIND_QUIETLY) + else (LIBSMBCLIENT_FOUND) + if (Libsmbclient_FIND_REQUIRED) + message(FATAL_ERROR "Could not find Libsmbclient") + endif (Libsmbclient_FIND_REQUIRED) + endif (LIBSMBCLIENT_FOUND) + set(LIBSMBCLIENT_DEFINITIONS -DHAVE_LIBSMBCLIENT=1) + + # show the LIBSMBCLIENT_INCLUDE_DIRS and LIBSMBCLIENT_LIBRARIES variables only in the advanced view + mark_as_advanced(LIBSMBCLIENT_INCLUDE_DIRS LIBSMBCLIENT_LIBRARIES LIBSMBCLIENT_DEFINITIONS) + +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 @@ +#.rst: +# FindLibUSB +# ---------- +# Finds the USB library +# +# This will will define the following variables:: +# +# LIBUSB_FOUND - system has LibUSB +# LIBUSB_INCLUDE_DIRS - the USB include directory +# LIBUSB_LIBRARIES - the USB libraries +# +# and the following imported targets:: +# +# LibUSB::LibUSB - The USB library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIBUSB libusb QUIET) +endif() + +find_path(LIBUSB_INCLUDE_DIR usb.h + PATHS ${PC_LIBUSB_INCLUDEDIR}) +find_library(LIBUSB_LIBRARY NAMES usb + PATHS ${PC_LIBUSB_INCLUDEDIR}) +set(LIBUSB_VERSION ${PC_LIBUSB_VERSION}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LIBUSB + REQUIRED_VARS LIBUSB_LIBRARY LIBUSB_INCLUDE_DIR + VERSION_VAR LIBUSB_VERSION) + +if(LIBUSB_FOUND) + set(LIBUSB_INCLUDE_DIRS ${LIBUSB_INCLUDE_DIR}) + set(LIBUSB_LIBRARIES ${LIBUSB_LIBRARY}) + set(LIBUSB_DEFINITIONS -DUSE_LIBUSB=1) + + if(NOT TARGET LibUSB::LibUSB) + add_library(LibUSB::LibUSB UNKNOWN IMPORTED) + set_target_properties(LibUSB::LibUSB PROPERTIES + IMPORTED_LOCATION "${LIBUSB_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${LIBUSB_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS USE_LIBUSB=1) + endif() +endif() + +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 @@ +# - Try to find Lzo2 +# Once done this will define +# +# Lzo2_FOUND - system has Lzo2 +# Lzo2_INCLUDE_DIR - the Lzo2 include directory +# Lzo2_LIBRARIES - Link these to use Lzo2 +# Lzo2_NEED_PREFIX - this is set if the functions are prefixed with BZ2_ + +# Copyright (c) 2006, Alexander Neundorf, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +FIND_PATH(LZO2_INCLUDE_DIRS lzo1x.h PATH_SUFFIXES lzo) + +FIND_LIBRARY(LZO2_LIBRARIES NAMES lzo2 liblzo2) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Lzo2 DEFAULT_MSG LZO2_INCLUDE_DIRS LZO2_LIBRARIES) + +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 @@ +# - Try to find MMAL +# Once done this will define +# +# MMAL_FOUND - system has MMAL +# MMAL_INCLUDE_DIRS - the MMAL include directory +# MMAL_LIBRARIES - The MMAL libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules(MMAL mmal QUIET) +endif() + +if(NOT MMAL_FOUND) + find_path(MMAL_INCLUDE_DIRS interface/mmal/mmal.h) + find_library(MMAL_LIBRARY mmal) + find_library(MMALCORE_LIBRARY mmal_core) + find_library(MMALUTIL_LIBRARY mmal_util) + find_library(MMALCLIENT_LIBRARY mmal_vc_client) + find_library(MMALCOMPONENT_LIBRARY mmal_components) + find_library(BCM_LIBRARY bcm_host) + find_library(VCHIQ_LIBRARY vchiq_arm) + find_library(VCOS_LIBRARY vcos) + find_library(VCSM_LIBRARY vcsm) + find_library(CONTAINER_LIBRARY containers) + + set(MMAL_LIBRARIES ${MMAL_LIBRARY} ${MMALCORE_LIBRARY} ${MMALUTIL_LIBRARY} + ${MMALCLIENT_LIBRARY} ${MMALCOMPONENT_LIBRARY} + ${BCM_LIBRARY} ${VCHIQ_LIBRARY} ${VCOS_LIBRARY} ${VCSM_LIBRARY} ${CONTAINER_LIBRARY} + CACHE STRING "mmal libraries" FORCE) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MMAL DEFAULT_MSG MMAL_LIBRARIES MMAL_INCLUDE_DIRS) + +list(APPEND MMAL_DEFINITIONS -DHAVE_MMAL=1 -DHAS_MMAL=1) + +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 @@ +IF (NOT WIN32) + include(FindPkgConfig) + if ( PKG_CONFIG_FOUND ) + + pkg_check_modules (MICROHTTPD libmicrohttpd>=0.4) + + set(MICROHTTPD_DEFINITIONS ${MICROHTTPD_CFLAGS_OTHER}) + endif(PKG_CONFIG_FOUND) +endif (NOT WIN32) + +# +# set defaults +if(NOT MICROHTTPD_FOUND) + SET(_microhttpd_HOME "/usr/local") + SET(_microhttpd_INCLUDE_SEARCH_DIRS + ${CMAKE_INCLUDE_PATH} + /usr/local/include + /usr/include + ) + + SET(_microhttpd_LIBRARIES_SEARCH_DIRS + ${CMAKE_LIBRARY_PATH} + /usr/local/lib + /usr/lib + ) + + ## + if( "${MICROHTTPD_HOME}" STREQUAL "") + if("" MATCHES "$ENV{MICROHTTPD_HOME}") + message(STATUS "MICROHTTPD_HOME env is not set, setting it to /usr/local") + set (MICROHTTPD_HOME ${_microhttpd_HOME}) + else("" MATCHES "$ENV{MICROHTTPD_HOME}") + set (MICROHTTPD_HOME "$ENV{MICROHTTPD_HOME}") + endif("" MATCHES "$ENV{MICROHTTPD_HOME}") + else( "${MICROHTTPD_HOME}" STREQUAL "") + message(STATUS "MICROHTTPD_HOME is not empty: \"${MICROHTTPD_HOME}\"") + endif( "${MICROHTTPD_HOME}" STREQUAL "") + ## + + message(STATUS "Looking for microhttpd in ${MICROHTTPD_HOME}") + + IF( NOT ${MICROHTTPD_HOME} STREQUAL "" ) + SET(_microhttpd_INCLUDE_SEARCH_DIRS ${MICROHTTPD_HOME}/include ${_microhttpd_INCLUDE_SEARCH_DIRS}) + SET(_microhttpd_LIBRARIES_SEARCH_DIRS ${MICROHTTPD_HOME}/lib ${_microhttpd_LIBRARIES_SEARCH_DIRS}) + SET(_microhttpd_HOME ${MICROHTTPD_HOME}) + ENDIF( NOT ${MICROHTTPD_HOME} STREQUAL "" ) + + IF( NOT $ENV{MICROHTTPD_INCLUDEDIR} STREQUAL "" ) + SET(_microhttpd_INCLUDE_SEARCH_DIRS $ENV{MICROHTTPD_INCLUDEDIR} ${_microhttpd_INCLUDE_SEARCH_DIRS}) + ENDIF( NOT $ENV{MICROHTTPD_INCLUDEDIR} STREQUAL "" ) + + IF( NOT $ENV{MICROHTTPD_LIBRARYDIR} STREQUAL "" ) + SET(_microhttpd_LIBRARIES_SEARCH_DIRS $ENV{MICROHTTPD_LIBRARYDIR} ${_microhttpd_LIBRARIES_SEARCH_DIRS}) + ENDIF( NOT $ENV{MICROHTTPD_LIBRARYDIR} STREQUAL "" ) + + IF( MICROHTTPD_HOME ) + SET(_microhttpd_INCLUDE_SEARCH_DIRS ${MICROHTTPD_HOME}/include ${_microhttpd_INCLUDE_SEARCH_DIRS}) + SET(_microhttpd_LIBRARIES_SEARCH_DIRS ${MICROHTTPD_HOME}/lib ${_microhttpd_LIBRARIES_SEARCH_DIRS}) + SET(_microhttpd_HOME ${MICROHTTPD_HOME}) + ENDIF( MICROHTTPD_HOME ) + + # find the include files + FIND_PATH(MICROHTTPD_INCLUDE_DIRS microhttpd.h + HINTS + ${_microhttpd_INCLUDE_SEARCH_DIRS} + ${PC_MICROHTTPD_INCLUDEDIR} + ${PC_MICROHTTPD_INCLUDE_DIRS} + ${CMAKE_INCLUDE_PATH} + ) + + # locate the library + IF(WIN32) + SET(MICROHTTPD_LIBRARY_NAMES ${MICROHTTPD_LIBRARY_NAMES} libmicrohttpd.lib) + ELSE(WIN32) + SET(MICROHTTPD_LIBRARY_NAMES ${MICROHTTPD_LIBRARY_NAMES} libmicrohttpd.a) + ENDIF(WIN32) + FIND_LIBRARY(MICROHTTPD_LIBRARIES NAMES ${MICROHTTPD_LIBRARY_NAMES} + HINTS + ${_microhttpd_LIBRARIES_SEARCH_DIRS} + ${PC_MICROHTTPD_LIBDIR} + ${PC_MICROHTTPD_LIBRARY_DIRS} + ) + + # if the include and the program are found then we have it + IF(MICROHTTPD_INCLUDE_DIRS AND MICROHTTPD_LIBRARIES) + SET(MICROHTTPD_FOUND "YES") + ENDIF(MICROHTTPD_INCLUDE_DIRS AND MICROHTTPD_LIBRARIES) + + if( NOT WIN32) + find_library(GCRYPT_LIBRARY gcrypt) + find_library(GPGERROR_LIBRARY gpg-error) + list(APPEND MICROHTTPD_LIBRARIES ${GCRYPT_LIBRARY} ${GPGERROR_LIBRARY}) + if(NOT APPLE AND NOT CORE_SYSTEM_NAME STREQUAL android) + list(APPEND MICROHTTPD_LIBRARIES "-lrt") + endif() + endif( NOT WIN32) +endif() + +list(APPEND MICROHTTPD_DEFINITIONS -DHAVE_LIBMICROHTTPD=1) + +MARK_AS_ADVANCED( + MICROHTTPD_FOUND + MICROHTTPD_LIBRARIES + MICROHTTPD_DEFINITIONS + MICROHTTPD_INCLUDE_DIRS +) 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 @@ +#.rst: +# FindMySqlClient +# --------------- +# Finds the MySqlClient library +# +# This will will define the following variables:: +# +# MYSQLCLIENT_FOUND - system has MySqlClient +# MYSQLCLIENT_INCLUDE_DIRS - the MySqlClient include directory +# MYSQLCLIENT_LIBRARIES - the MySqlClient libraries +# MYSQLCLIENT_DEFINITIONS - the MySqlClient compile definitions +# +# and the following imported targets:: +# +# MySqlClient::MySqlClient - The MySqlClient library + +find_path(MYSQLCLIENT_INCLUDE_DIR mysql/mysql_time.h) +find_library(MYSQLCLIENT_LIBRARY_RELEASE NAMES mysqlclient mysqlclient_r + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} mysql) +find_library(MYSQLCLIENT_LIBRARY_DEBUG NAMES mysqlclient + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} mysql) + +include(SelectLibraryConfigurations) +select_library_configurations(MYSQLCLIENT) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MYSQLCLIENT + REQUIRED_VARS MYSQLCLIENT_LIBRARY MYSQLCLIENT_INCLUDE_DIR) + +if(MYSQLCLIENT_FOUND) + set(MYSQLCLIENT_LIBRARIES ${MYSQLCLIENT_LIBRARY}) + set(MYSQLCLIENT_INCLUDE_DIRS ${MYSQLCLIENT_INCLUDE_DIR}) + set(MYSQLCLIENT_DEFINITIONS -DHAVE_MYSQL=1) + + if(NOT TARGET MySqlClient::MySqlClient) + add_library(MySqlClient::MySqlClient UNKNOWN IMPORTED) + if(MYSQLCLIENT_LIBRARY_RELEASE) + set_target_properties(MySqlClient::MySqlClient PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${MYSQLCLIENT_LIBRARY_RELEASE}") + endif() + if(MYSQLCLIENT_LIBRARY_DEBUG) + set_target_properties(MySqlClient::MySqlClient PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${MYSQLCLIENT_LIBRARY_DEBUG}") + endif() + set_target_properties(MySqlClient::MySqlClient PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${MYSQLCLIENT_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_MYSQL=1) + endif() +endif() + +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 @@ +#.rst: +# FindNFS +# ------- +# Finds the libnfs library +# +# This will will define the following variables:: +# +# NFS_FOUND - system has libnfs +# NFS_INCLUDE_DIRS - the libnfs include directory +# NFS_LIBRARIES - the libnfs libraries +# NFS_DEFINITIONS - the libnfs compile definitions +# +# and the following imported targets:: +# +# NFS::NFS - The libnfs library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(NFS libnfs QUIET) +endif() + +find_path(NFS_INCLUDE_DIR nfsc/libnfs.h + PATHS ${PC_NFS_INCLUDEDIR}) + +set(NFS_VERSION ${PC_NFS_VERSION}) + +include(FindPackageHandleStandardArgs) +if(NOT WIN32) + find_library(NFS_LIBRARY NAMES nfs + PATHS ${PC_NFS_LIBDIR}) + + find_package_handle_standard_args(NFS + REQUIRED_VARS NFS_LIBRARY NFS_INCLUDE_DIR + VERSION_VAR NFS_VERSION) +else() + # Dynamically loaded DLL + find_package_handle_standard_args(NFS + REQUIRED_VARS NFS_INCLUDE_DIR + VERSION_VAR NFS_VERSION) +endif() + +if(NFS_FOUND) + set(NFS_LIBRARIES ${NFS_LIBRARY}) + set(NFS_INCLUDE_DIRS ${NFS_INCLUDE_DIR}) + set(NFS_DEFINITIONS -DHAVE_LIBNFS=1) + + if(NOT TARGET NFS::NFS) + add_library(NFS::NFS UNKNOWN IMPORTED) + if(NFS_LIBRARY) + set_target_properties(NFS::NFS PROPERTIES + IMPORTED_LOCATION "${NFS_LIBRARY_RELEASE}") + endif() + set_target_properties(NFS::NFS PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${NFS_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBNFS=1) + endif() +endif() + +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 @@ +#.rst: +# FindOpenGLES +# ------------ +# Finds the OpenGLES2 library +# +# This will will define the following variables:: +# +# OPENGLES_FOUND - system has OpenGLES +# OPENGLES_INCLUDE_DIRS - the OpenGLES include directory +# OPENGLES_LIBRARIES - the OpenGLES libraries +# OPENGLES_DEFINITIONS - the OpenGLES definitions + +find_package(EMBEDDED) + +if(PKG_CONFIG_FOUND AND NOT PLATFORM STREQUAL "raspberry-pi") + pkg_check_modules(PC_OPENGLES glesv2) + if(NOT OPENGLES_FOUND AND EMBEDDED_FOUND) + set(CMAKE_PREFIX_PATH ${EMBEDDED_FOUND} ${CMAKE_PREFIX_PATH}) + endif() +endif() + +if(NOT CORE_SYSTEM_NAME STREQUAL ios) + find_path(OPENGLES_INCLUDE_DIR GLES2/gl2.h + PATHS ${PC_OPENGLES_INCLUDEDIR}) + find_library(OPENGLES_gl_LIBRARY NAMES GLESv2 + PATHS ${PC_OPENGLES_LIBDIR}) + find_library(OPENGLES_egl_LIBRARY NAMES EGL + PATHS ${PC_OPENGLES_LIBDIR}) +else() + find_library(OPENGLES_gl_LIBRARY NAMES OpenGLES + PATHS ${CMAKE_OSX_SYSROOT}/System/Library + PATH_SUFFIXES Frameworks + NO_DEFAULT_PATH) + set(OPENGLES_INCLUDE_DIR ${OPENGLES_gl_LIBRARY}/Headers) + set(OPENGLES_egl_LIBRARY ${OPENGLES_gl_LIBRARY}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OpenGLES + REQUIRED_VARS OPENGLES_gl_LIBRARY OPENGLES_egl_LIBRARY OPENGLES_INCLUDE_DIR) + +if(OPENGLES_FOUND) + set(OPENGLES_INCLUDE_DIRS ${OPENGLES_INCLUDE_DIR}) + set(OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY} ${OPENGLES_egl_LIBRARY}) + set(OPENGLES_DEFINITIONS -DHAVE_LIBGLESV2 -DHAVE_LIBEGL=1) +endif() + +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 @@ +#.rst: +# FindOpenGl +# ---------- +# Finds the FindOpenGl library +# +# This will will define the following variables:: +# +# OPENGL_FOUND - system has OpenGl +# OPENGL_INCLUDE_DIRS - the OpenGl include directory +# OPENGL_LIBRARIES - the OpenGl libraries +# OPENGL_DEFINITIONS - the OpenGl definitions + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_OPENGL gl glu) +endif() + +if(NOT CORE_SYSTEM_NAME STREQUAL darwin) + find_path(OPENGL_INCLUDE_DIR GL/gl.h + PATHS ${PC_OPENGL_gl_INCLUDEDIR}) + find_library(OPENGL_gl_LIBRARY NAMES GL + PATHS ${PC_OPENGL_gl_LIBDIR}) + find_library(OPENGL_glu_LIBRARY NAMES GLU + PATHS ${PC_OPENGL_glu_LIBDIR}) +else() + find_library(OPENGL_gl_LIBRARY NAMES OpenGL + PATHS ${CMAKE_OSX_SYSROOT}/System/Library + PATH_SUFFIXES Frameworks + NO_DEFAULT_PATH) + set(OPENGL_INCLUDE_DIR ${OPENGL_gl_LIBRARY}/Headers) + set(OPENGL_glu_LIBRARY ${OPENGL_gl_LIBRARY}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OpenGl + REQUIRED_VARS OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY OPENGL_INCLUDE_DIR) + +if(OPENGL_FOUND) + set(OPENGL_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) + set(OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) + set(OPENGL_DEFINITIONS -DHAVE_LIBGL=1) +endif() + +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 @@ +#.rst: +# FindPCRE +# -------- +# Finds the PCRECPP library +# +# This will will define the following variables:: +# +# PCRE_FOUND - system has libpcrecpp +# PCRE_INCLUDE_DIRS - the libpcrecpp include directory +# PCRE_LIBRARIES - the libpcrecpp libraries +# PCRE_DEFINITIONS - the libpcrecpp definitions +# +# and the following imported targets:: +# +# PCRE::PCRECPP - The PCRECPP library +# PCRE::PCRE - The PCRE library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_PCRE libpcrecpp QUIET) +endif() + +find_path(PCRE_INCLUDE_DIR pcrecpp.h + PATHS ${PC_PCRE_INCLUDEDIR}) +find_library(PCRECPP_LIBRARY_RELEASE NAMES pcrecpp + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} + PATHS ${PC_PCRE_LIBDIR}) +find_library(PCRE_LIBRARY_RELEASE NAMES pcre + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} + PATHS ${PC_PCRE_LIBDIR}) +find_library(PCRECPP_LIBRARY_DEBUG NAMES pcrecppd + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} + PATHS ${PC_PCRE_LIBDIR}) +find_library(PCRE_LIBRARY_DEBUG NAMES pcred + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} + PATHS ${PC_PCRE_LIBDIR}) +set(PCRE_VERSION ${PC_PCRE_VERSION}) + +include(SelectLibraryConfigurations) +select_library_configurations(PCRECPP) +select_library_configurations(PCRE) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PCRE + REQUIRED_VARS PCRECPP_LIBRARY PCRE_LIBRARY PCRE_INCLUDE_DIR + VERSION_VAR PCRE_VERSION) + +if(PCRE_FOUND) + set(PCRE_LIBRARIES ${PCRECPP_LIBRARY} ${PCRE_LIBRARY}) + set(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR}) + if(WIN32) + set(PCRE_DEFINITIONS -DPCRE_STATIC=1) + endif() + + if(NOT TARGET PCRE::PCRE) + add_library(PCRE::PCRE UNKNOWN IMPORTED) + if(PCRE_LIBRARY_RELEASE) + set_target_properties(PCRE::PCRE PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${PCRE_LIBRARY_RELEASE}") + endif() + if(PCRE_LIBRARY_DEBUG) + set_target_properties(PCRE::PCRE PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${PCRE_LIBRARY_DEBUG}") + endif() + set_target_properties(PCRE::PCRE PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${PCRE_INCLUDE_DIR}") + if(WIN32) + set_target_properties(PCRE::PCRE PROPERTIES + INTERFACE_COMPILE_DEFINITIONS PCRE_STATIC=1) + endif() + + endif() + if(NOT TARGET PCRE::PCRECPP) + add_library(PCRE::PCRECPP UNKNOWN IMPORTED) + if(PCRE_LIBRARY_RELEASE) + set_target_properties(PCRE::PCRECPP PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${PCRECPP_LIBRARY_RELEASE}") + endif() + if(PCRE_LIBRARY_DEBUG) + set_target_properties(PCRE::PCRECPP PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${PCRECPP_LIBRARY_DEBUG}") + endif() + set_target_properties(PCRE::PCRECPP PROPERTIES + INTERFACE_LINK_LIBRARIES PCRE::PCRE) + endif() +endif() + +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 @@ +#.rst: +# FindPlist +# --------- +# Finds the Plist library +# +# This will will define the following variables:: +# +# PLIST_FOUND - system has Plist library +# PLIST_INCLUDE_DIRS - the Plist library include directory +# PLIST_LIBRARIES - the Plist libraries +# PLIST_DEFINITIONS - the Plist compile definitions +# +# and the following imported targets:: +# +# Plist::Plist - The Plist library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_PLIST libplist QUIET) +endif() + +find_path(PLIST_INCLUDE_DIR plist/plist.h + PATHS ${PC_PLIST_INCLUDEDIR}) + +set(PLIST_VERSION ${PC_PLIST_VERSION}) + +include(FindPackageHandleStandardArgs) +if(NOT WIN32) + find_library(PLIST_LIBRARY NAMES plist + PATHS ${PC_PLIST_LIBDIR}) + + find_package_handle_standard_args(PLIST + REQUIRED_VARS PLIST_LIBRARY PLIST_INCLUDE_DIR + VERSION_VAR PLIST_VERSION) +else() + # Dynamically loaded DLL + find_package_handle_standard_args(PLIST + REQUIRED_VARS PLIST_INCLUDE_DIR + VERSION_VAR PLIST_VERSION) +endif() + +if(PLIST_FOUND) + set(PLIST_LIBRARIES ${PLIST_LIBRARY}) + set(PLIST_INCLUDE_DIRS ${PLIST_INCLUDE_DIR}) + set(PLIST_DEFINITIONS -DHAVE_LIBPLIST=1) + + if(NOT TARGET Plist::Plist) + add_library(Plist::Plist UNKNOWN IMPORTED) + if(PLIST_LIBRARY) + set_target_properties(Plist::Plist PROPERTIES + IMPORTED_LOCATION "${PLIST_LIBRARY}") + endif() + set_target_properties(Plist::Plist PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${PLIST_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBPLIST=1) + endif() +endif() + +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 @@ +# Try to find the PulseAudio library +# +# Once done this will define: +# +# PULSEAUDIO_FOUND - system has the PulseAudio library +# PULSEAUDIO_INCLUDE_DIR - the PulseAudio include directory +# PULSEAUDIO_LIBRARY - the libraries needed to use PulseAudio +# PULSEAUDIO_MAINLOOP_LIBRARY - the libraries needed to use PulsAudio Mailoop +# +# Copyright (c) 2008, Matthias Kretz, +# Copyright (c) 2009, Marcus Hufgard, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (NOT PULSEAUDIO_MINIMUM_VERSION) + set(PULSEAUDIO_MINIMUM_VERSION "1.0.0") +endif (NOT PULSEAUDIO_MINIMUM_VERSION) + +if (PULSEAUDIO_INCLUDE_DIRS AND PULSEAUDIO_LIBRARY AND PULSEAUDIO_MAINLOOP_LIBRARY) + # Already in cache, be silent + set(PULSEAUDIO_FIND_QUIETLY TRUE) +endif (PULSEAUDIO_INCLUDE_DIRS AND PULSEAUDIO_LIBRARY AND PULSEAUDIO_MAINLOOP_LIBRARY) + +if (NOT WIN32) + include(FindPkgConfig) + pkg_check_modules(PC_PULSEAUDIO libpulse>=${PULSEAUDIO_MINIMUM_VERSION}) + pkg_check_modules(PC_PULSEAUDIO_MAINLOOP libpulse-mainloop-glib) +endif (NOT WIN32) + +FIND_PATH(PULSEAUDIO_INCLUDE_DIRS pulse/pulseaudio.h + HINTS + ${PC_PULSEAUDIO_INCLUDEDIR} + ${PC_PULSEAUDIO_INCLUDE_DIRS} + ) + +FIND_LIBRARY(PULSEAUDIO_LIBRARY NAMES pulse libpulse + HINTS + ${PC_PULSEAUDIO_LIBDIR} + ${PC_PULSEAUDIO_LIBRARY_DIRS} + ) + +FIND_LIBRARY(PULSEAUDIO_MAINLOOP_LIBRARY NAMES pulse-mainloop pulse-mainloop-glib libpulse-mainloop-glib + HINTS + ${PC_PULSEAUDIO_LIBDIR} + ${PC_PULSEAUDIO_LIBRARY_DIRS} + ) + +if (NOT PULSEAUDIO_INCLUDE_DIRS OR NOT PULSEAUDIO_LIBRARY) + set(PULSEAUDIO_FOUND FALSE) +else() + set(PULSEAUDIO_FOUND TRUE) +endif() + +if (PULSEAUDIO_FOUND) + if (NOT PULSEAUDIO_FIND_QUIETLY) + message(STATUS "Found PulseAudio: ${PULSEAUDIO_LIBRARY}") + if (PULSEAUDIO_MAINLOOP_LIBRARY) + message(STATUS "Found PulseAudio Mainloop: ${PULSEAUDIO_MAINLOOP_LIBRARY}") + else (PULSAUDIO_MAINLOOP_LIBRARY) + message(STATUS "Could NOT find PulseAudio Mainloop Library") + endif (PULSEAUDIO_MAINLOOP_LIBRARY) + endif (NOT PULSEAUDIO_FIND_QUIETLY) +else (PULSEAUDIO_FOUND) + message(STATUS "Could NOT find PulseAudio") +endif (PULSEAUDIO_FOUND) + +set(PULSEAUDIO_LIBRARIES ${PULSEAUDIO_LIBRARY}) + +list(APPEND PULSEAUDIO_DEFINITIONS -DHAVE_LIBPULSE=1) + +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 @@ +# - Try to find python +# Once done this will define +# +# PYTHON_FOUND - system has PYTHON +# PYTHON_INCLUDE_DIRS - the python include directory +# PYTHON_LIBRARIES - The python libraries + +if(PKG_CONFIG_FOUND AND NOT CMAKE_CROSSCOMPILING) + pkg_check_modules (PYTHON python) +endif() + +if(NOT PYTHON_FOUND) + if(CMAKE_CROSSCOMPILING) + find_program(PYTHON_EXECUTABLE python ONLY_CMAKE_FIND_ROOT_PATH) + find_library(PYTHON_LIBRARY NAMES python2.6 python2.7) + find_path(PYTHON_INCLUDE_DIRS NAMES Python.h PATHS ${DEPENDS_PATH}/include/python2.6 ${DEPENDS_PATH}/include/python2.7) + set(PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIRS} CACHE PATH "python include dir" FORCE) + + find_library(FFI_LIBRARY ffi) + find_library(EXPAT_LIBRARY expat) + find_library(INTL_LIBRARY intl) + + if(NOT CORE_SYSTEM_NAME STREQUAL android) + set(PYTHON_DEP_LIBRARIES -lpthread -ldl -lutil) + endif() + + set(PYTHON_LIBRARIES ${PYTHON_LIBRARY} ${FFI_LIBRARY} ${EXPAT_LIBRARY} ${INTL_LIBRARY} ${PYTHON_DEP_LIBRARIES} + CACHE INTERNAL "python libraries" FORCE) + else() + find_package(PythonLibs) + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Python DEFAULT_MSG PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES) + +if(CMAKE_SYSTEM_NAME STREQUAL Darwin) + find_library(FFI_LIBRARY ffi REQUIRED) + find_library(INTL_LIBRARY intl) + list(APPEND PYTHON_LIBRARIES ${FFI_LIBRARY} ${INTL_LIBRARY}) +endif() + +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 @@ +# - Try to find rtmp +# Once done this will define +# +# RTMP_FOUND - system has librtmp +# RTMP_INCLUDE_DIRS - the librtmp include directory +# RTMP_LIBRARIES - The librtmp libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (RTMP librtmp) + list(APPEND RTMP_INCLUDE_DIRS ${RTMP_INCLUDEDIR}) +else() + find_path(RTMP_INCLUDE_DIRS librtmp/rtmp.h) + find_library(RTMP_LIBRARIES rtmp) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(RTMP DEFAULT_MSG RTMP_INCLUDE_DIRS RTMP_LIBRARIES) + +list(APPEND RTMP_DEFINITIONS -DHAS_LIBRTMP=1) + +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 @@ +# Check if SSE instructions are available on the machine where +# the project is compiled. + +IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO) + + STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE) + IF (SSE2_TRUE) + set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") + ELSE (SSE2_TRUE) + set(SSE2_FOUND false CACHE BOOL "SSE2 available on host") + ENDIF (SSE2_TRUE) + + # /proc/cpuinfo apparently omits sse3 :( + STRING(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "sse3" "${SSE_THERE}" SSE3_TRUE) + IF (NOT SSE3_TRUE) + STRING(REGEX REPLACE "^.*(T2300).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "T2300" "${SSE_THERE}" SSE3_TRUE) + ENDIF (NOT SSE3_TRUE) + + STRING(REGEX REPLACE "^.*(ssse3).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "ssse3" "${SSE_THERE}" SSSE3_TRUE) + IF (SSE3_TRUE OR SSSE3_TRUE) + set(SSE3_FOUND true CACHE BOOL "SSE3 available on host") + ELSE (SSE3_TRUE OR SSSE3_TRUE) + set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") + ENDIF (SSE3_TRUE OR SSSE3_TRUE) + IF (SSSE3_TRUE) + set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host") + ELSE (SSSE3_TRUE) + set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") + ENDIF (SSSE3_TRUE) + + STRING(REGEX REPLACE "^.*(sse4_1).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "sse4_1" "${SSE_THERE}" SSE41_TRUE) + IF (SSE41_TRUE) + set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host") + ELSE (SSE41_TRUE) + set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") + ENDIF (SSE41_TRUE) +ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") + EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE + CPUINFO) + + STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "SSE2" "${SSE_THERE}" SSE2_TRUE) + IF (SSE2_TRUE) + set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") + ELSE (SSE2_TRUE) + set(SSE2_FOUND false CACHE BOOL "SSE2 available on host") + ENDIF (SSE2_TRUE) + + STRING(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "SSE3" "${SSE_THERE}" SSE3_TRUE) + IF (SSE3_TRUE) + set(SSE3_FOUND true CACHE BOOL "SSE3 available on host") + ELSE (SSE3_TRUE) + set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") + ENDIF (SSE3_TRUE) + + STRING(REGEX REPLACE "^.*(SSSE3).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "SSSE3" "${SSE_THERE}" SSSE3_TRUE) + IF (SSSE3_TRUE) + set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host") + ELSE (SSSE3_TRUE) + set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") + ENDIF (SSSE3_TRUE) + + STRING(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "SSE4.1" "${SSE_THERE}" SSE41_TRUE) + IF (SSE41_TRUE) + set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host") + ELSE (SSE41_TRUE) + set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") + ENDIF (SSE41_TRUE) +ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows") + # TODO + set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") + set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") + set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") + set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") +ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux") + set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") + set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") + set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") + set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") +ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") + +if(NOT SSE2_FOUND) + MESSAGE(STATUS "Could not find hardware support for SSE2 on this machine.") +endif(NOT SSE2_FOUND) +if(NOT SSE3_FOUND) + MESSAGE(STATUS "Could not find hardware support for SSE3 on this machine.") +endif(NOT SSE3_FOUND) +if(NOT SSSE3_FOUND) + MESSAGE(STATUS "Could not find hardware support for SSSE3 on this machine.") +endif(NOT SSSE3_FOUND) +if(NOT SSE4_1_FOUND) + MESSAGE(STATUS "Could not find hardware support for SSE4.1 on this machine.") +endif(NOT SSE4_1_FOUND) + +mark_as_advanced(SSE2_FOUND SSE3_FOUND SSSE3_FOUND SSE4_1_FOUND) + 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 @@ +# - Try to find libssh +# Once done this will define +# +# SSH_FOUND - system has libssh +# SSH_INCLUDE_DIRS - the libssh include directory +# SSH_LIBRARIES - The libssh libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (SSH libssh) + list(APPEND SSH_INCLUDE_DIRS /usr/include) +else() + find_path(SSH_INCLUDE_DIRS libssh/libssh.h) + find_library(SSH_LIBRARIES ssh) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(SSH DEFAULT_MSG SSH_INCLUDE_DIRS SSH_LIBRARIES) + +list(APPEND SSH_DEFINITIONS -DHAVE_LIBSSH=1) + +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 @@ +if(NOT SWIG_EXECUTABLE) + find_program(SWIG_EXECUTABLE NAMES swig2.0 swig PATH_SUFFIXES swig) +endif() +if(SWIG_EXECUTABLE) + execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib + OUTPUT_VARIABLE SWIG_DIR + ERROR_VARIABLE SWIG_swiglib_error + RESULT_VARIABLE SWIG_swiglib_result) +endif() + + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWIG REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR + 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 @@ +#.rst: +# FindSDL +# ------- +# Finds the SDL library +# +# This will will define the following variables:: +# +# SDL_FOUND - system has SDL +# SDL_INCLUDE_DIRS - the SDL include directory +# SDL_LIBRARIES - the SDL libraries +# SDL_DEFINITIONS - the SDL compile definitions + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_SDL2 sdl2 QUIET) + if(PC_SDL2_FOUND) + set(SDL_VERSION ${PC_SDL2_VERSION}) + else() + pkg_check_modules(PC_SDL1 sdl QUIET) + if(PC_SDL1_FOUND) + set(SDL_VERSION ${PC_SDL1_VERSION}) + endif() + endif() +endif() + +find_path(SDL_INCLUDE_DIR SDL/SDL.h + PATHS ${PC_SDL2_INCLUDE_DIR} ${PC_SDL1_INCLUDE_DIR}) +find_library(SDL_LIBRARY NAMES SDL2 SDL + PATHS ${PC_SDL2_LIBDIR} ${PC_SDL1_LIBDIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Sdl REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR + VERSION_VAR SDL_VERSION) + +if(SDL_FOUND) + set(SDL_LIBRARIES ${SDL_LIBRARY}) + set(SDL_INCLUDE_DIRS ${SDL_INCLUDE_DIR}) + set(SDL_DEFINITIONS -DHAVE_SDL=1) + + if(SDL_VERSION VERSION_GREATER 2) + list(APPEND SDL_DEFINITIONS -DHAVE_SDL_VERSION=2) + elseif(SDL_VERSION VERSION_GREATER 1) + list(APPEND SDL_DEFINITIONS -DHAVE_SDL_VERSION=1) + endif() +endif() + +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 @@ +#.rst: +# FindShairplay +# ------------- +# Finds the Shairplay library +# +# This will will define the following variables:: +# +# SHAIRPLAY_FOUND - system has Shairplay +# SHAIRPLAY_INCLUDE_DIRS - the Shairplay include directory +# SHAIRPLAY_LIBRARIES - the Shairplay libraries +# SHAIRPLAY_DEFINITIONS - the Shairplay compile definitions +# +# and the following imported targets:: +# +# Shairplay::Shairplay - The Shairplay library + +find_path(SHAIRPLAY_INCLUDE_DIR shairplay/raop.h) + +include(FindPackageHandleStandardArgs) +if(NOT WIN32) + find_library(SHAIRPLAY_LIBRARY NAMES shairplay) + + if(SHAIRPLAY_INCLUDE_DIR AND SHAIRPLAY_LIBRARY) + include(CheckCSourceCompiles) + set(CMAKE_REQUIRED_INCLUDES ${SHAIRPLAY_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${SHAIRPLAY_LIBRARIES}) + check_c_source_compiles("#include + + int main() + { + struct raop_callbacks_s foo; + foo.cls; + return 0; + } + " HAVE_SHAIRPLAY_CALLBACK_CLS) + endif() + + find_package_handle_standard_args(SHAIRPLAY + REQUIRED_VARS SHAIRPLAY_LIBRARY SHAIRPLAY_INCLUDE_DIR HAVE_SHAIRPLAY_CALLBACK_CLS) +else() + # Dynamically loaded DLL + find_package_handle_standard_args(SHAIRPLAY + REQUIRED_VARS SHAIRPLAY_INCLUDE_DIR) +endif() + +if(SHAIRPLAY_FOUND) + set(SHAIRPLAY_LIBRARIES ${SHAIRPLAY_LIBRARY}) + set(SHAIRPLAY_INCLUDE_DIRS ${SHAIRPLAY_INCLUDE_DIR}) + set(SHAIRPLAY_DEFINITIONS -DHAVE_LIBSHAIRPLAY=1) + + if(NOT TARGET Shairplay::Shairplay) + add_library(Shairplay::Shairplay UNKNOWN IMPORTED) + if(SHAIRPLAY_LIBRARY) + set_target_properties(Shairplay::Shairplay PROPERTIES + IMPORTED_LOCATION "${SHAIRPLAY_LIBRARY}") + endif() + set_target_properties(Shairplay::Shairplay PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SHAIRPLAY_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBSHAIRPLAY=1) + endif() +endif() + +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 @@ +# - Try to find SQLITE3 +# Once done this will define +# +# SQLITE3_FOUND - system has sqlite3 +# SQLITE3_INCLUDE_DIRS - the sqlite3 include directory +# SQLITE3_LIBRARIES - The sqlite3 libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (SQLITE3 sqlite3) + list(APPEND SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDEDIR}) +else() + find_path(SQLITE3_INCLUDE_DIRS sqlite3.h) + find_library(SQLITE3_LIBRARIES sqlite3) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Sqlite3 DEFAULT_MSG SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES) + +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 @@ +#.rst: +# FindTagLib +# ---------- +# Finds the TagLib library +# +# This will will define the following variables:: +# +# TAGLIB_FOUND - system has TagLib +# TAGLIB_INCLUDE_DIRS - the TagLib include directory +# TAGLIB_LIBRARIES - the TagLib libraries +# +# and the following imported targets:: +# +# TagLib::TagLib - The TagLib library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_TAGLIB taglib>=1.8.0 QUIET) +endif() + +find_path(TAGLIB_INCLUDE_DIR taglib/tag.h + PATHS ${PC_TAGLIB_INCLUDEDIR}) +find_library(TAGLIB_LIBRARY_RELEASE NAMES tag + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} + PATHS ${PC_TAGLIB_LIBDIR}) +find_library(TAGLIB_LIBRARY_DEBUG NAMES tag + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} + PATHS ${PC_TAGLIB_LIBDIR}) +set(TAGLIB_VERSION ${PC_TAGLIB_VERSION}) + +include(SelectLibraryConfigurations) +select_library_configurations(TAGLIB) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(TAGLIB + REQUIRED_VARS TAGLIB_LIBRARY TAGLIB_INCLUDE_DIR + VERSION_VAR TAGLIB_VERSION) + +if(TAGLIB_FOUND) + set(TAGLIB_LIBRARIES ${TAGLIB_LIBRARY}) + + # Workaround broken .pc file + list(APPEND TAGLIB_LIBRARIES ${PC_TAGLIB_ZLIB_LIBRARIES}) + + set(TAGLIB_INCLUDE_DIRS ${TAGLIB_INCLUDE_DIR}) + if(NOT TARGET TagLib::TagLib) + add_library(TagLib::TagLib UNKNOWN IMPORTED) + if(TAGLIB_LIBRARY_RELEASE) + set_target_properties(TagLib::TagLib PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${TAGLIB_LIBRARY_RELEASE}") + endif() + if(TAGLIB_LIBRARY_DEBUG) + set_target_properties(TagLib::TagLib PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${TAGLIB_LIBRARY_DEBUG}") + endif() + set_target_properties(TagLib::TagLib PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${TAGLIB_INCLUDE_DIR}") + endif() +endif() + +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 @@ +#.rst: +# FindTexturePacker +# ----------------- +# Finds the TexturePacker +# +# This will define the following (imported) targets:: +# +# TexturePacker::TexturePacker - The TexturePacker executable + +if(NOT TARGET TexturePacker::TexturePacker) + if(CMAKE_CROSSCOMPILING) + add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL) + set_target_properties(TexturePacker::TexturePacker PROPERTIES + IMPORTED_LOCATION "${NATIVEPREFIX}/bin/TexturePacker") + elseif(WIN32) + add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL) + set_target_properties(TexturePacker::TexturePacker PROPERTIES + IMPORTED_LOCATION "${CORE_SOURCE_DIR}/tools/TexturePacker/TexturePacker.exe") + else() + add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/TexturePacker build/texturepacker) + add_executable(TexturePacker::TexturePacker ALIAS TexturePacker) + endif() +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 @@ +#.rst: +# FindTinyXML +# ----------- +# Finds the TinyXML library +# +# This will will define the following variables:: +# +# TINYXML_FOUND - system has TinyXML +# TINYXML_INCLUDE_DIRS - the TinyXML include directory +# TINYXML_LIBRARIES - the TinyXML libraries +# TINYXML_DEFINITIONS - the TinyXML definitions +# +# and the following imported targets:: +# +# TinyXML::TinyXML - The TinyXML library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_TINYXML tinyxml QUIET) +endif() + +find_path(TINYXML_INCLUDE_DIR tinyxml.h + PATH_SUFFIXES tinyxml + PATHS ${PC_TINYXML_INCLUDEDIR}) +find_library(TINYXML_LIBRARY_RELEASE NAMES tinyxml tinyxmlSTL + PATH_SUFFIXES tinyxml ${CONFIGURATION_LIBDIR_RELEASE} + PATHS ${PC_TINYXML_LIBDIR}) +find_library(TINYXML_LIBRARY_DEBUG NAMES tinyxml tinyxmlSTL + PATH_SUFFIXES tinyxml ${CONFIGURATION_LIBDIR_DEBUG} + PATHS ${PC_TINYXML_LIBDIR}) +set(TINYXML_VERSION ${PC_TINYXML_VERSION}) + +include(SelectLibraryConfigurations) +select_library_configurations(TINYXML) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(TINYXML + REQUIRED_VARS TINYXML_LIBRARY TINYXML_INCLUDE_DIR + VERSION_VAR TINYXML_VERSION) + +if(TINYXML_FOUND) + set(TINYXML_LIBRARIES ${TINYXML_LIBRARY}) + set(TINYXML_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR}) + if(WIN32) + set(TINYXML_DEFINITIONS -DTIXML_USE_STL=1) + endif() + + if(NOT TARGET TinyXML::TinyXML) + add_library(TinyXML::TinyXML UNKNOWN IMPORTED) + if(TINYXML_LIBRARY_RELEASE) + set_target_properties(TinyXML::TinyXML PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${TINYXML_LIBRARY_RELEASE}") + endif() + if(TINYXML_LIBRARY_DEBUG) + set_target_properties(TinyXML::TinyXML PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${TINYXML_LIBRARY_DEBUG}") + endif() + set_target_properties(TinyXML::TinyXML PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${TINYXML_INCLUDE_DIR}") + if(WIN32) + set_target_properties(TinyXML::TinyXML PROPERTIES + INTERFACE_COMPILE_DEFINITIONS TIXML_USE_STL=1) + endif() + endif() +endif() + +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 @@ +# - Try to find udev +# Once done this will define +# +# UDEV_FOUND - system has libudev +# UDEV_INCLUDE_DIRS - the libudev include directory +# UDEV_LIBRARIES - The libudev libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (UDEV libudev) + list(APPEND UDEV_INCLUDE_DIRS ${UDEV_INCLUDEDIR}) +endif() + +if(NOT UDEV_FOUND) + find_path(UDEV_INCLUDE_DIRS libudev.h) + find_library(UDEV_LIBRARIES udev) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(UDev DEFAULT_MSG UDEV_INCLUDE_DIRS UDEV_LIBRARIES) + +mark_as_advanced(UDEV_INCLUDE_DIRS UDEV_LIBRARIES) +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 @@ +#.rst: +# FindUUID +# -------- +# Finds the libuuid library +# +# This will will define the following variables:: +# +# UUID_FOUND - system has libuuid +# UUID_INCLUDE_DIRS - the libuuid include directory +# UUID_LIBRARIES - the libuuid libraries +# +# and the following imported targets:: +# +# UUID::UUID - The libuuid library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_UUID uuid QUIET) +endif() + +find_path(UUID_INCLUDE_DIR uuid/uuid.h + PATHS ${PC_UUID_INCLUDEDIR}) +find_library(UUID_LIBRARY uuid + PATHS ${PC_UUID_LIBRARY}) +set(UUID_VERSION ${PC_UUID_VERSION}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(UUID + REQUIRED_VARS UUID_LIBRARY UUID_INCLUDE_DIR + VERSION_VAR UUID_VERSION) + +if(UUID_FOUND) + set(UUID_LIBRARIES ${UUID_LIBRARY}) + set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR}) + + if(NOT TARGET UUID::UUID) + add_library(UUID::UUID UNKNOWN IMPORTED) + set_target_properties(UUID::UUID PROPERTIES + IMPORTED_LOCATION "${UUID_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${UUID_INCLUDE_DIR}") + endif() +endif() + +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 @@ +#.rst: +# FindVAAPI +# --------- +# Finds the VAAPI library +# +# This will will define the following variables:: +# +# VAAPI_FOUND - system has VAAPI +# VAAPI_INCLUDE_DIRS - the VAAPI include directory +# VAAPI_LIBRARIES - the VAAPI libraries +# VAAPI_DEFINITIONS - the VAAPI definitions + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_VAAPI libva libva-x11 QUIET) +endif() + +find_path(VAAPI_INCLUDE_DIR va/va.h + PATHS ${PC_VAAPI_libva_INCLUDEDIR}) +find_library(VAAPI_libva_LIBRARY NAMES va + PATHS ${PC_VAAPI_libva_LIBDIR}) +find_library(VAAPI_libva-x11_LIBRARY NAMES va-x11 + PATHS ${PC_VAAPI_libva_LIBDIR}) + +if(PC_VAAPI_libva_VERSION) + set(VAAPI_VERSION_STRING ${PC_VAAPI_libva_VERSION}) +elseif(VAAPI_INCLUDE_DIR AND EXISTS "${VAAPI_INCLUDE_DIR}/va/va_version.h") + file(STRINGS "${VAAPI_INCLUDE_DIR}/va/va_version.h" vaapi_version_str REGEX "^#define[\t ]+VA_VERSION_S[\t ]+\".*\".*") + string(REGEX REPLACE "^#define[\t ]+VA_VERSION_S[\t ]+\"([^\"]+)\".*" "\\1" VAAPI_VERSION_STRING "${vaapi_version_str}") + unset(vaapi_version_str) +endif() + +if(NOT VAAPI_FIND_VERSION) + set(VAAPI_FIND_VERSION 0.38.0) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VAAPI + REQUIRED_VARS VAAPI_libva_LIBRARY VAAPI_libva-x11_LIBRARY VAAPI_INCLUDE_DIR + VERSION_VAR VAAPI_VERSION_STRING) + +if(VAAPI_FOUND) + set(VAAPI_INCLUDE_DIRS ${VAAPI_INCLUDE_DIR}) + set(VAAPI_LIBRARIES ${VAAPI_libva_LIBRARY} ${VAAPI_libva-x11_LIBRARY}) + set(VAAPI_DEFINITIONS -DHAVE_LIBVA=1) +endif() + +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 @@ +#.rst: +# FindVDPAU +# --------- +# Finds the VDPAU library +# +# This will will define the following variables:: +# +# VDPAU_FOUND - system has VDPAU +# VDPAU_INCLUDE_DIRS - the VDPAU include directory +# VDPAU_LIBRARIES - the VDPAU libraries +# VDPAU_DEFINITIONS - the VDPAU definitions + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_VDPAU vdpau QUIET) +endif() + +find_path(VDPAU_INCLUDE_DIR NAMES vdpau/vdpau.h vdpau/vdpau_x11.h + PATHS ${PC_VDPAU_INCLUDEDIR}) +find_library(VDPAU_LIBRARY NAMES vdpau + PATHS ${PC_VDPAU_LIBDIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VDPAU + REQUIRED_VARS VDPAU_LIBRARY VDPAU_INCLUDE_DIR) + +if(VDPAU_FOUND) + set(VDPAU_INCLUDE_DIRS ${VDPAU_INCLUDE_DIR}) + set(VDPAU_LIBRARIES ${VDPAU_LIBRARY}) + set(VDPAU_DEFINITIONS -DHAVE_LIBVDPAU=1) +endif() + +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 @@ +# - Try to find X11 +# Once done this will define +# +# X11_FOUND - system has X11 +# X11_INCLUDE_DIRS - the X11 include directory +# X11_LIBRARIES - The X11 libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (X x11 xext libdrm egl) + list(APPEND X_INCLUDE_DIRS /usr/include) +else() + find_path(X_INCLUDE_DIRS X11/Xlib.h) + find_library(X_LIBRARIES X11) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(X DEFAULT_MSG X_INCLUDE_DIRS X_LIBRARIES) + +list(APPEND X_DEFINITIONS -DHAVE_X11=1) + +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 @@ +# - Try to find xrandr +# Once done this will define +# +# XRANDR_FOUND - system has lixrandr +# XRANDR_INCLUDE_DIRS - the libxrandr include directory +# XRANDR_LIBRARIES - The libxrandr libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (XRANDR xrandr) + list(APPEND XRANDR_INCLUDE_DIRS ${XRANDR_INCLUDEDIR}) +else() + find_library(XRANDR_LIBRARIES Xrandr) +endif() + +if(XRANDR_FOUND) +include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(XRandR DEFAULT_MSG XRANDR_INCLUDE_DIRS XRANDR_LIBRARIES) + + list(APPEND XRANDR_DEFINITIONS -DHAVE_LIBXRANDR=1) + + mark_as_advanced(XRANDR_INCLUDE_DIRS XRANDR_LIBRARIES XRANDR_DEFINITIONS) +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 @@ +# - Try to find XSLT +# Once done this will define +# +# XSLT_FOUND - system has libxslt +# XSLT_INCLUDE_DIRS - the libxslt include directory +# XSLT_LIBRARIES - The libxslt libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (XSLT libxslt) +else() + find_path(XSLT_INCLUDE_DIRS libxslt/xslt.h) + find_library(XSLT_LIBRARIES NAMES xslt libxslt) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Xslt DEFAULT_MSG XSLT_INCLUDE_DIRS XSLT_LIBRARIES) + +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 @@ +# Base Io build system +# Written by Jeremy Tregunna +# +# Find libyajl +pkg_check_modules(YAJL yajl>=2.0) +if(YAJL_FOUND) + list(APPEND YAJL_DEFINITIONS -DYAJL_MAJOR=2) +endif() + +if(NOT YAJL_FOUND) + find_path(YAJL_INCLUDE_DIRS yajl/yajl_common.h) + find_library(YAJL_LIBRARIES NAMES yajl) + + file(STRINGS ${YAJL_INCLUDE_DIRS}/yajl/yajl_version.h version_header) + string(REGEX MATCH "YAJL_MAJOR ([0-9]+)" YAJL_VERSION_MAJOR ${version_header}) + string(REGEX REPLACE "YAJL_MAJOR ([0-9]+)" "\\1" YAJL_VERSION_MAJOR "${YAJL_VERSION_MAJOR}") + if (YAJL_VERSION_MINOR LESS 2) + set(YAJL_INCLUDE_DIRS) + set(YALJ_LIBRARIES) + endif() + list(APPEND YAJL_DEFINITIONS -DYAJL_MAJOR=${YAJL_VERSION_MAJOR}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Yajl DEFAULT_MSG YAJL_INCLUDE_DIRS YAJL_LIBRARIES) + +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 @@ +#.rst: +# FindZip +# ----------- +# Finds the Zip library +# +# This will will define the following variables:: +# +# ZIP_FOUND - system has Zip +# ZIP_INCLUDE_DIRS - the Zip include directory +# ZIP_LIBRARIES - the Zip libraries +# ZIP_DEFINITIONS - the Zip libraries +# +# and the following imported targets:: +# +# ZIP::ZIP - The Zip library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_ZIP libzip QUIET) +endif() + +find_path(ZIP_INCLUDE_DIR zip.h + PATHS ${PC_ZIP_INCLUDEDIR}) +find_library(ZIP_LIBRARY NAMES zip + PATHS ${PC_ZIP_LIBDIR}) +set(ZIP_VERSION ${PC_ZIP_VERSION}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ZIP + REQUIRED_VARS ZIP_LIBRARY ZIP_INCLUDE_DIR + VERSION_VAR ZIP_VERSION) + +if(ZIP_FOUND) + set(ZIP_LIBRARIES ${ZIP_LIBRARY}) + set(ZIP_INCLUDE_DIRS ${ZIP_INCLUDE_DIR}) + set(ZIP_DEFINITIONS "${PC_ZIP_CFLAGS}") + + if(NOT TARGET ZIP::ZIP) + add_library(ZIP::ZIP UNKNOWN IMPORTED) + set_target_properties(ZIP::ZIP PROPERTIES + IMPORTED_LOCATION "${ZIP_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${ZIP_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS "${PC_ZIP_CFLAGS}") + endif() +endif() + +mark_as_advanced(ZIP_INCLUDE_DIR ZIP_LIBRARY) diff --git a/project/cmake/platform/darwin/defines.txt b/project/cmake/platform/darwin/defines.txt deleted file mode 100644 index 33b009e..0000000 --- a/project/cmake/platform/darwin/defines.txt +++ /dev/null @@ -1 +0,0 @@ --DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX diff --git a/project/cmake/platform/osx/defines.txt b/project/cmake/platform/osx/defines.txt new file mode 100644 index 0000000..33b009e --- /dev/null +++ b/project/cmake/platform/osx/defines.txt @@ -0,0 +1 @@ +-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX 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 @@ +if(NOT CMAKE_TOOLCHAIN_FILE) + message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for android. See ${PROJECT_SOURCE_DIR}/README.md") +endif() + +set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_ANDROID) +set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED + -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) +set(PLATFORM_DIR linux) +if(WITH_ARCH) + set(ARCH ${WITH_ARCH}) +else() + if(CPU STREQUAL armeabi-v7a) + set(ARCH arm-linux-androideabi) + elseif(CPU STREQUAL i686) + set(ARCH i686-linux-android) + else() + message(SEND_ERROR "Unknown CPU: ${CPU}") + endif() +endif() + +set(FFMPEG_OPTS --enable-cross-compile --cpu=cortex-a9 --arch=arm --target-os=linux --enable-neon + --disable-vdpau --cc=${CMAKE_C_COMPILER} --host-cc=${CMAKE_C_COMPILER} + --strip=${CMAKE_STRIP}) +set(ENABLE_SDL OFF) +set(ENABLE_X11 OFF) +set(ENABLE_EGL ON) +set(ENABLE_AML ON) +set(ENABLE_OPTICAL OFF) + +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 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 COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target package) macro(add_cpack_workaround target version ext) + if(NOT PACKAGE_DIR) + set(PACKAGE_DIR "${CMAKE_INSTALL_PREFIX}/zips") + endif() + add_custom_command(TARGET addon-package PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E rename addon-${target}-${version}.${ext} ${target}-${version}.${ext}) + COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_PACKAGE_DIRECTORY}/addon-${target}-${version}.${ext} ${PACKAGE_DIR}/${target}-${version}.${ext}) endmacro() # Grab the version from a given add-on's addon.xml macro (addon_version dir prefix) - FILE(READ ${dir}/addon.xml ADDONXML) + IF(EXISTS ${PROJECT_SOURCE_DIR}/${dir}/addon.xml.in) + FILE(READ ${PROJECT_SOURCE_DIR}/${dir}/addon.xml.in ADDONXML) + ELSE() + FILE(READ ${dir}/addon.xml ADDONXML) + ENDIF() + STRING(REGEX MATCH "]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML}) STRING(REGEX REPLACE ".*version=.([0-9\\.]+).*" "\\1" ${prefix}_VERSION ${VERSION_STRING}) message(STATUS ${prefix}_VERSION=${${prefix}_VERSION}) @@ -34,6 +44,25 @@ macro (build_addon target prefix libs) SET_TARGET_PROPERTIES(${target} PROPERTIES PREFIX "lib") ENDIF(OS STREQUAL "android") + # get the library's location + SET(LIBRARY_LOCATION $) + # get the library's filename + if("${CORE_SYSTEM_NAME}" STREQUAL "android") + # for android we need the filename without any version numbers + set(LIBRARY_FILENAME $) + else() + SET(LIBRARY_FILENAME $) + endif() + + # if there's an addon.xml.in we need to generate the addon.xml + IF(EXISTS ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in) + SET(PLATFORM ${CORE_SYSTEM_NAME}) + + FILE(READ ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in addon_file) + STRING(CONFIGURE "${addon_file}" addon_file_conf @ONLY) + FILE(GENERATE OUTPUT ${PROJECT_SOURCE_DIR}/${target}/addon.xml CONTENT "${addon_file_conf}") + ENDIF() + # set zip as default if addon-package is called without PACKAGE_XXX SET(CPACK_GENERATOR "ZIP") SET(ext "zip") @@ -51,33 +80,62 @@ macro (build_addon target prefix libs) set(CPACK_COMPONENTS_IGNORE_GROUPS 1) list(APPEND CPACK_COMPONENTS_ALL ${target}-${${prefix}_VERSION}) # Pack files together to create an archive - INSTALL(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION}) + INSTALL(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION} PATTERN "addon.xml.in" EXCLUDE) IF(WIN32) - # get the installation location for the addon's target - get_property(dll_location TARGET ${target} PROPERTY LOCATION) + if(NOT CPACK_PACKAGE_DIRECTORY) + # determine the temporary path + file(TO_CMAKE_PATH "$ENV{TEMP}" WIN32_TEMP_PATH) + string(LENGTH "${WIN32_TEMP_PATH}" WIN32_TEMP_PATH_LENGTH) + string(LENGTH "${PROJECT_BINARY_DIR}" PROJECT_BINARY_DIR_LENGTH) + + # check if the temporary path is shorter than the default packaging directory path + if(WIN32_TEMP_PATH_LENGTH GREATER 0 AND WIN32_TEMP_PATH_LENGTH LESS PROJECT_BINARY_DIR_LENGTH) + # set the directory used by CPack for packaging to the temp directory + set(CPACK_PACKAGE_DIRECTORY ${WIN32_TEMP_PATH}) + endif() + endif() + # in case of a VC++ project the installation location contains a $(Configuration) VS variable # we replace it with ${CMAKE_BUILD_TYPE} (which doesn't cover the case when the build configuration # is changed within Visual Studio) - string(REPLACE "$(Configuration)" "${CMAKE_BUILD_TYPE}" dll_location "${dll_location}") + string(REPLACE "$(Configuration)" "${CMAKE_BUILD_TYPE}" LIBRARY_LOCATION "${LIBRARY_LOCATION}") # install the generated DLL file - INSTALL(PROGRAMS ${dll_location} DESTINATION ${target} + INSTALL(PROGRAMS ${LIBRARY_LOCATION} DESTINATION ${target} COMPONENT ${target}-${${prefix}_VERSION}) IF(CMAKE_BUILD_TYPE MATCHES Debug) # for debug builds also install the PDB file - get_filename_component(dll_directory ${dll_location} DIRECTORY) - INSTALL(FILES ${dll_directory}/${target}.pdb DESTINATION ${target} + get_filename_component(LIBRARY_DIR ${LIBRARY_LOCATION} DIRECTORY) + INSTALL(FILES ${LIBRARY_DIR}/${target}.pdb DESTINATION ${target} COMPONENT ${target}-${${prefix}_VERSION}) ENDIF() ELSE(WIN32) + if(NOT CPACK_PACKAGE_DIRECTORY) + set(CPACK_PACKAGE_DIRECTORY ${CMAKE_BINARY_DIR}) + endif() INSTALL(TARGETS ${target} DESTINATION ${target} COMPONENT ${target}-${${prefix}_VERSION}) ENDIF(WIN32) add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext}) ELSE(PACKAGE_ZIP OR PACKAGE_TGZ) - INSTALL(TARGETS ${target} DESTINATION lib/kodi/addons/${target}) - INSTALL(DIRECTORY ${target} DESTINATION share/kodi/addons) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX) + message(STATUS "setting install paths to match ${APP_NAME}: CMAKE_INSTALL_PREFIX: ${${APP_NAME_UC}_PREFIX}") + set(CMAKE_INSTALL_PREFIX "${${APP_NAME_UC}_PREFIX}" CACHE PATH "${APP_NAME} install prefix" FORCE) + set(CMAKE_INSTALL_LIBDIR "${${APP_NAME_UC}_LIB_DIR}" CACHE PATH "${APP_NAME} install libdir" FORCE) + elseif(NOT CMAKE_INSTALL_PREFIX STREQUAL "${${APP_NAME_UC}_PREFIX}" AND NOT OVERRIDE_PATHS) + 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") + else() + if(NOT CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib/${APP_NAME_LC}") + endif() + endif() + else() + set(CMAKE_INSTALL_LIBDIR "lib/${APP_NAME_LC}") + endif() + INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target}) + INSTALL(DIRECTORY ${target} DESTINATION share/${APP_NAME_LC}/addons PATTERN "addon.xml.in" EXCLUDE) ENDIF(PACKAGE_ZIP OR PACKAGE_TGZ) endmacro() 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 @@ +# This script configures the build for a given architecture. +# Flags and stringified arch is set up. +# General compiler tests belongs here. +# +# On return, the following variables are set: +# CMAKE_SYSTEM_NAME - a lowercased system name +# CPU - the CPU on the target +# ARCH - the system architecture +# ARCH_DEFINES - list of compiler definitions for this architecture +# SYSTEM_DEFINES - list of compiler definitions for this system +# DEP_DEFINES - compiler definitions for system dependencies (e.g. LIRC) +# + the results of compiler tests etc. + +include(CheckCXXSourceCompiles) +include(CheckSymbolExists) +include(CheckFunctionExists) + +# Macro to check if a given type exists in a given header +# Arguments: +# header the header to check +# type the type to check for existence +# var the compiler definition to set if type exists +# On return: +# If type was found, the definition is added to SYSTEM_DEFINES +macro(check_type header type var) + check_cxx_source_compiles("#include <${header}> + int main() + { + ${type} s; + }" ${var}) + if(${var}) + list(APPEND SYSTEM_DEFINES -D${var}=1) + endif() +endmacro() + +# Macro to check if a given builtin function exists +# Arguments: +# func the function to check +# var the compiler definition to set if type exists +# On return: +# If type was found, the definition is added to SYSTEM_DEFINES +macro(check_builtin func var) + check_cxx_source_compiles(" + int main() + { + ${func}; + }" ${var}) + if(${var}) + list(APPEND SYSTEM_DEFINES -D${var}=1) + endif() +endmacro() + + +# -------- Main script --------- +message(STATUS "System type: ${CMAKE_SYSTEM_NAME}") +if(NOT CORE_SYSTEM_NAME) + string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) +endif() + +if(WITH_CPU) + set(CPU ${WITH_CPU}) +elseif(NOT CMAKE_TOOLCHAIN_FILE) + set(CPU ${CMAKE_SYSTEM_PROCESSOR}) +endif() + +if(CMAKE_TOOLCHAIN_FILE) + if(NOT EXISTS "${CMAKE_TOOLCHAIN_FILE}") + message(FATAL_ERROR "Toolchain file ${CMAKE_TOOLCHAIN_FILE} does not exist.") + elseif(NOT DEPENDS_PATH OR NOT NATIVEPREFIX) + message(FATAL_ERROR "Toolchain did not define DEPENDS_PATH or NATIVEPREFIX. Possibly outdated depends.") + endif() +endif() + +# Main cpp +set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/posix/main.cpp) + +# system specific arch setup +include(${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/archsetup.cmake) + +message(STATUS "Core system type: ${CORE_SYSTEM_NAME}") +message(STATUS "Platform: ${PLATFORM}") +message(STATUS "CPU: ${CPU}, ARCH: ${ARCH}") + +check_type(string std::u16string HAVE_STD__U16_STRING) +check_type(string std::u32string HAVE_STD__U32_STRING) +check_type(string char16_t HAVE_CHAR16_T) +check_type(string char32_t HAVE_CHAR32_T) +check_type(stdint.h uint_least16_t HAVE_STDINT_H) +check_symbol_exists(posix_fadvise fcntl.h HAVE_POSIX_FADVISE) +check_builtin("long* temp=0; long ret=__sync_add_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_ADD_AND_FETCH) +check_builtin("long* temp=0; long ret=__sync_sub_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_SUB_AND_FETCH) +check_builtin("long* temp=0; long ret=__sync_val_compare_and_swap(temp, 1, 1)" HAS_BUILTIN_SYNC_VAL_COMPARE_AND_SWAP) +if(HAVE_POSIX_FADVISE) + list(APPEND SYSTEM_DEFINES -DHAVE_POSIX_FADVISE=1) +endif() +check_function_exists(localtime_r HAVE_LOCALTIME_R) +if(HAVE_LOCALTIME_R) + list(APPEND SYSTEM_DEFINES -DHAVE_LOCALTIME_R=1) +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 @@ +find_package(Git REQUIRED) + +macro(sanity_check message) + if(status_code) + message(FATAL_ERROR "${message}") + endif() +endmacro() + +# Check that there are no changes in working-tree +execute_process(COMMAND ${GIT_EXECUTABLE} diff --quiet + RESULT_VARIABLE status_code) +sanity_check("Cannot run with working tree changes. Commit, stash or drop them.") + +# Setup base of tests +set(check_base $ENV{CHECK_BASE}) +if(NOT check_base) + set(check_base origin/master) +endif() + +# Setup end of tests +set(check_head $ENV{CHECK_HEAD}) +if(NOT check_head) + set(check_head HEAD) +endif() + +# Setup target to build +set(check_target $ENV{CHECK_TARGET}) +if(NOT check_target) + set(check_target check) +endif() + +# Build threads +set(build_threads $ENV{CHECK_THREADS}) +if(NOT build_threads) + if(UNIX) + execute_process(COMMAND nproc + OUTPUT_VARIABLE build_threads) + string(REGEX REPLACE "(\r?\n)+$" "" build_threads "${build_threads}") + endif() +endif() + +# Record current HEAD +execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD + OUTPUT_VARIABLE current_branch) + +string(REGEX REPLACE "(\r?\n)+$" "" current_branch "${current_branch}") + +# Grab revision list +execute_process(COMMAND ${GIT_EXECUTABLE} rev-list ${check_base}..${check_head} --reverse + OUTPUT_VARIABLE rev_list) + +string(REPLACE "\n" ";" rev_list ${rev_list}) +foreach(rev ${rev_list}) + # Checkout + message("Testing revision ${rev}") + execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${rev} + RESULT_VARIABLE status_code) + sanity_check("Failed to checkout ${rev}") + + # Build + if(build_threads GREATER 2) + execute_process(COMMAND ${CMAKE_COMMAND} "--build" "${CMAKE_BINARY_DIR}" "--target" "${check_target}" "--use-stderr" "--" "-j${build_threads}" + RESULT_VARIABLE status_code) + else() + execute_process(COMMAND ${CMAKE_COMMAND} "--build" "${CMAKE_BINARY_DIR}" "--target" "${check_target}" "--use-stderr" + RESULT_VARIABLE status_code) + endif() + if(status_code) + execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${current_branch}) + endif() + sanity_check("Failed to build target for revision ${rev}") +endforeach() + +message("Everything checks out fine") +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 @@ +include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/macros.cmake) + +core_find_versions() +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/addons/xbmc.addon) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/addons/kodi.guilib) +configure_file(${CORE_SOURCE_DIR}/addons/xbmc.addon/addon.xml.in + ${CMAKE_BINARY_DIR}/addons/xbmc.addon/addon.xml @ONLY) +configure_file(${CORE_SOURCE_DIR}/addons/kodi.guilib/addon.xml.in + ${CMAKE_BINARY_DIR}/addons/kodi.guilib/addon.xml @ONLY) +configure_file(${CORE_SOURCE_DIR}/xbmc/CompileInfo.cpp.in + ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp @ONLY) +set(prefix ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}) +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 @@ +# Configure single-/multiconfiguration generators and variables +# +# CORE_BUILD_CONFIG that is set to +# - CMAKE_BUILD_TYPE for single configuration generators such as make, nmake +# - a variable that expands on build time to the current configuration for +# multi configuration generators such as VS or Xcode +if(CMAKE_CONFIGURATION_TYPES) + if(CMAKE_BUILD_TYPE) + message(FATAL_ERROR "CMAKE_BUILD_TYPE must not be defined for multi-configuration generators") + endif() + set(CORE_BUILD_CONFIG ${CMAKE_CFG_INTDIR}) + message(STATUS "Generator: Multi-configuration (${CMAKE_GENERATOR})") +else() + if(CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} + CACHE STRING "Choose build type (${CMAKE_BUILD_TYPES})" FORCE) + else() + # Set default + set(CMAKE_BUILD_TYPE Release + CACHE STRING "Choose build type (${CMAKE_BUILD_TYPES})" FORCE) + endif() + set(CORE_BUILD_CONFIG ${CMAKE_BUILD_TYPE}) + message(STATUS "Generator: Single-configuration: ${CMAKE_BUILD_TYPE} (${CMAKE_GENERATOR})") +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 @@ +# This script holds the main functions used to construct the build system + +# include system specific macros +include(${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/macros.cmake) + +# Add a library, optionally as a dependency of the main application +# Arguments: +# name name of the library to add +# Optional Arguments: +# NO_MAIN_DEPENDS if specified, the library is not added to main depends +# Implicit arguments: +# SOURCES the sources of the library +# HEADERS the headers of the library (only for IDE support) +# OTHERS other library related files (only for IDE support) +# On return: +# Library will be built, optionally added to ${core_DEPENDS} +function(core_add_library name) + cmake_parse_arguments(arg "NO_MAIN_DEPENDS" "" "" ${ARGN}) + add_library(${name} STATIC ${SOURCES} ${HEADERS} ${OTHERS}) + set_target_properties(${name} PROPERTIES PREFIX "") + if(NOT arg_NO_MAIN_DEPENDS) + set(core_DEPENDS ${name} ${core_DEPENDS} CACHE STRING "" FORCE) + endif() + + # Add precompiled headers to Kodi main libraries + if(WIN32 AND "${CMAKE_CURRENT_LIST_DIR}" MATCHES "^${CORE_SOURCE_DIR}/xbmc") + add_precompiled_header(${name} pch.h ${CORE_SOURCE_DIR}/xbmc/win32/pch.cpp + PCH_TARGET kodi) + endif() + + # IDE support + if(CMAKE_GENERATOR MATCHES "Xcode") + file(RELATIVE_PATH parentfolder ${CORE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..) + set_target_properties(${name} PROPERTIES FOLDER "${parentfolder}") + elseif(CMAKE_GENERATOR MATCHES "Visual Studio") + file(RELATIVE_PATH foldername ${CORE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + set_target_properties(${name} PROPERTIES FOLDER "${foldername}") + source_group(" " REGULAR_EXPRESSION ".*") + endif() +endfunction() + +# Add a test library, and add sources to list for gtest integration macros +function(core_add_test_library name) + core_add_library(${name} NO_MAIN_DEPENDS) + set_target_properties(${name} PROPERTIES EXCLUDE_FROM_ALL 1) + foreach(src ${SOURCES}) + set(test_sources ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${test_sources} CACHE STRING "" FORCE) + endforeach() + set(test_archives ${test_archives} ${name} CACHE STRING "" FORCE) +endfunction() + +# Add a data file to installation list with a mirror in build tree +# Arguments: +# file full path to file to mirror +# relative the relative base of file path in the build/install tree +# give another parameter to exclude from install target +# Implicit arguments: +# CORE_SOURCE_DIR - root of source tree +# On return: +# file is added to ${install_data} and mirrored in build tree +function(copy_file_to_buildtree file relative) + if(NOT WIN32) + string(REPLACE "\(" "\\(" file ${file}) + string(REPLACE "\)" "\\)" file ${file}) + endif() + string(REPLACE "${relative}/" "" outfile ${file}) + + if(NOT TARGET export-files) + add_custom_target(export-files ALL COMMENT "Copying files into build tree") + endif() + if(NOT ${CORE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR}) + if(VERBOSE) + message(STATUS "copy_file_to_buildtree - copying file: ${file} -> ${CMAKE_CURRENT_BINARY_DIR}/${outfile}") + endif() + add_custom_command(TARGET export-files COMMAND ${CMAKE_COMMAND} -E copy_if_different "${file}" "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") + endif() + if(NOT ARGN) + list(APPEND install_data ${outfile}) + set(install_data ${install_data} PARENT_SCOPE) + endif() +endfunction() + +# add data files to installation list with a mirror in build tree. +# reads list of files to install from a given list of text files. +# Arguments: +# pattern globbing pattern for text files to read +# give another parameter to exclude from installation target +# Implicit arguments: +# CORE_SOURCE_DIR - root of source tree +# On return: +# files are added to ${install_data} and mirrored in build tree +function(copy_files_from_filelist_to_buildtree pattern) + foreach(arg ${ARGN}) + list(APPEND pattern ${arg}) + endforeach() + # copies files listed in text files to the buildtree + # Input: [glob pattern: filepattern] + list(SORT pattern) + if(VERBOSE) + message(STATUS "copy_files_from_filelist_to_buildtree - got pattern: ${pattern}") + endif() + foreach(pat ${pattern}) + file(GLOB filenames ${pat}) + foreach(filename ${filenames}) + string(STRIP ${filename} filename) + core_file_read_filtered(fstrings ${filename}) + foreach(dir ${fstrings}) + file(GLOB_RECURSE files RELATIVE ${CORE_SOURCE_DIR} ${CORE_SOURCE_DIR}/${dir}) + foreach(file ${files}) + if(ARGN) + copy_file_to_buildtree(${CORE_SOURCE_DIR}/${file} ${CORE_SOURCE_DIR} 1) + else() + copy_file_to_buildtree(${CORE_SOURCE_DIR}/${file} ${CORE_SOURCE_DIR}) + endif() + endforeach() + endforeach() + endforeach() + endforeach() + set(install_data ${install_data} PARENT_SCOPE) +endfunction() + +# helper macro to set modified variables in parent scope +macro(export_dep) + set(SYSTEM_INCLUDES ${SYSTEM_INCLUDES} PARENT_SCOPE) + set(DEPLIBS ${DEPLIBS} PARENT_SCOPE) + set(DEP_DEFINES ${DEP_DEFINES} PARENT_SCOPE) + set(${depup}_FOUND ${${depup}_FOUND} PARENT_SCOPE) + mark_as_advanced(${depup}_LIBRARIES) +endmacro() + +# add a required dependency of main application +# Arguments: +# dep name of find rule for dependency, used uppercased for variable prefix +# On return: +# dependency added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES} +function(core_require_dep dep) + find_package(${dep} REQUIRED) + string(TOUPPER ${dep} depup) + list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) + list(APPEND DEPLIBS ${${depup}_LIBRARIES}) + list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) + export_dep() +endfunction() + +# add a required dyloaded dependency of main application +# Arguments: +# dep name of find rule for dependency, used uppercased for variable prefix +# On return: +# dependency added to ${SYSTEM_INCLUDES}, ${dep}_SONAME is set up +function(core_require_dyload_dep dep) + find_package(${dep} REQUIRED) + string(TOUPPER ${dep} depup) + list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) + list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) + find_soname(${depup} REQUIRED) + export_dep() + set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE) +endfunction() + +# helper macro for optional deps +macro(setup_enable_switch) + string(TOUPPER ${dep} depup) + if (ARGV1) + set(enable_switch ${ARGV1}) + else() + set(enable_switch ENABLE_${depup}) + endif() +endmacro() + +# add an optional dependency of main application +# Arguments: +# dep name of find rule for dependency, used uppercased for variable prefix +# On return: +# dependency optionally added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES} +function(core_optional_dep dep) + setup_enable_switch() + if(${enable_switch}) + find_package(${dep}) + if(${depup}_FOUND) + list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) + list(APPEND DEPLIBS ${${depup}_LIBRARIES}) + list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) + set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE) + export_dep() + else() + set(final_message ${final_message} "${depup} enabled: No" PARENT_SCOPE) + endif() + endif() +endfunction() + +# add an optional dyloaded dependency of main application +# Arguments: +# dep name of find rule for dependency, used uppercased for variable prefix +# On return: +# dependency optionally added to ${SYSTEM_INCLUDES}, ${DEP_DEFINES}, ${dep}_SONAME is set up +function(core_optional_dyload_dep dep) + setup_enable_switch() + if(${enable_switch}) + find_package(${dep}) + if(${depup}_FOUND) + list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) + find_soname(${depup} REQUIRED) + list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) + set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE) + export_dep() + set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE) + endif() + endif() +endfunction() + +function(core_file_read_filtered result filepattern) + # Reads STRINGS from text files + # with comments filtered out + # Result: [list: result] + # Input: [glob pattern: filepattern] + file(GLOB filenames ${filepattern}) + list(SORT filenames) + foreach(filename ${filenames}) + if(VERBOSE) + message(STATUS "core_file_read_filtered - filename: ${filename}") + endif() + file(STRINGS ${filename} fstrings REGEX "^[^#//]") + foreach(fstring ${fstrings}) + string(REGEX REPLACE "^(.*)#(.*)" "\\1" fstring ${fstring}) + string(REGEX REPLACE "//.*" "" fstring ${fstring}) + string(STRIP ${fstring} fstring) + list(APPEND filename_strings ${fstring}) + endforeach() + endforeach() + set(${result} ${filename_strings} PARENT_SCOPE) +endfunction() + +function(core_add_subdirs_from_filelist files) + # Adds subdirectories from a sorted list of files + # Input: [list: filenames] [bool: sort] + foreach(arg ${ARGN}) + list(APPEND files ${arg}) + endforeach() + list(SORT files) + if(VERBOSE) + message(STATUS "core_add_subdirs_from_filelist - got pattern: ${files}") + endif() + foreach(filename ${files}) + string(STRIP ${filename} filename) + core_file_read_filtered(fstrings ${filename}) + foreach(subdir ${fstrings}) + STRING_SPLIT(subdir " " ${subdir}) + list(GET subdir 0 subdir_src) + list(GET subdir -1 subdir_dest) + if(VERBOSE) + message(STATUS " core_add_subdirs_from_filelist - adding subdir: ${CORE_SOURCE_DIR}${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}") + endif() + add_subdirectory(${CORE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest}) + endforeach() + endforeach() +endfunction() + +macro(core_add_optional_subdirs_from_filelist pattern) + # Adds subdirectories from text files + # if the option(s) in the 3rd field are enabled + # Input: [glob pattern: filepattern] + foreach(arg ${ARGN}) + list(APPEND pattern ${arg}) + endforeach() + foreach(elem ${pattern}) + string(STRIP ${elem} elem) + list(APPEND filepattern ${elem}) + endforeach() + + file(GLOB filenames ${filepattern}) + list(SORT filenames) + if(VERBOSE) + message(STATUS "core_add_optional_subdirs_from_filelist - got pattern: ${filenames}") + endif() + + foreach(filename ${filenames}) + if(VERBOSE) + message(STATUS "core_add_optional_subdirs_from_filelist - reading file: ${filename}") + endif() + file(STRINGS ${filename} fstrings REGEX "^[^#//]") + foreach(line ${fstrings}) + string(REPLACE " " ";" line "${line}") + list(GET line 0 subdir_src) + list(GET line 1 subdir_dest) + list(GET line 3 opts) + foreach(opt ${opts}) + if(ENABLE_${opt}) + if(VERBOSE) + message(STATUS " core_add_optional_subdirs_from_filelist - adding subdir: ${CORE_SOURCE_DIR}${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}") + endif() + add_subdirectory(${CORE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest}) + else() + if(VERBOSE) + message(STATUS " core_add_optional_subdirs_from_filelist: OPTION ${opt} not enabled for ${subdir_src}, skipping subdir") + endif() + endif() + endforeach() + endforeach() + endforeach() +endmacro() + +macro(today RESULT) + if (WIN32) + execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT}) + string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}}) + elseif(UNIX) + execute_process(COMMAND date -u +%F + OUTPUT_VARIABLE ${RESULT}) + string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}}) + else() + message(SEND_ERROR "date not implemented") + set(${RESULT} 000000) + endif() + string(REGEX REPLACE "(\r?\n)+$" "" ${RESULT} "${${RESULT}}") +endmacro() + +function(core_find_git_rev) + if(EXISTS ${CORE_SOURCE_DIR}/VERSION) + file(STRINGS ${CORE_SOURCE_DIR}/VERSION VERSION_FILE) + string(SUBSTRING "${VERSION_FILE}" 1 16 GIT_REV) + else() + find_package(Git) + if(GIT_FOUND AND EXISTS ${CORE_SOURCE_DIR}/.git) + execute_process(COMMAND ${GIT_EXECUTABLE} diff-files --ignore-submodules --quiet -- + RESULT_VARIABLE status_code + WORKING_DIRECTORY ${CORE_SOURCE_DIR}) + if (NOT status_code) + execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --cached --ignore-submodules --quiet HEAD -- + RESULT_VARIABLE status_code + WORKING_DIRECTORY ${CORE_SOURCE_DIR}) + endif() + today(DATE) + execute_process(COMMAND ${GIT_EXECUTABLE} --no-pager log --abbrev=7 -n 1 + --pretty=format:"%h-dirty" HEAD + OUTPUT_VARIABLE LOG_UNFORMATTED + WORKING_DIRECTORY ${CORE_SOURCE_DIR}) + string(SUBSTRING ${LOG_UNFORMATTED} 1 7 HASH) + else() + execute_process(COMMAND ${GIT_EXECUTABLE} --no-pager log --abbrev=7 -n 1 + --pretty=format:"%h %cd" HEAD + OUTPUT_VARIABLE LOG_UNFORMATTED + WORKING_DIRECTORY ${CORE_SOURCE_DIR}) + string(SUBSTRING ${LOG_UNFORMATTED} 1 7 HASH) + string(SUBSTRING ${LOG_UNFORMATTED} 9 10 DATE) + string(REPLACE "-" "" DATE ${DATE}) + endif() + set(GIT_REV "${DATE}-${HASH}") + endif() + if(GIT_REV) + set(APP_SCMID ${GIT_REV} PARENT_SCOPE) + endif() +endfunction() + +macro(core_find_versions) + include(CMakeParseArguments) + core_file_read_filtered(version_list ${CORE_SOURCE_DIR}/version.txt) + string(REPLACE " " ";" version_list "${version_list}") + cmake_parse_arguments(APP "" "VERSION_MAJOR;VERSION_MINOR;VERSION_TAG;VERSION_CODE;ADDON_API;APP_NAME;COMPANY_NAME" "" ${version_list}) + + set(APP_NAME ${APP_APP_NAME}) # inconsistency in upstream + string(TOLOWER ${APP_APP_NAME} APP_NAME_LC) + set(COMPANY_NAME ${APP_COMPANY_NAME}) + set(APP_VERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}) + if(APP_VERSION_TAG) + set(APP_VERSION ${APP_VERSION}-${APP_VERSION_TAG}) + endif() + string(REPLACE "." "," FILE_VERSION ${APP_ADDON_API}.0) + string(TOLOWER ${APP_VERSION_TAG} APP_VERSION_TAG_LC) + file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version REGEX "^.*GUILIB_API_VERSION (.*)$") + string(REGEX REPLACE ".*\"(.*)\"" "\\1" guilib_version ${guilib_version}) + file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version_min REGEX "^.*GUILIB_MIN_API_VERSION (.*)$") + string(REGEX REPLACE ".*\"(.*)\"" "\\1" guilib_version_min ${guilib_version_min}) +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 @@ +# - Collection of String utility macros. +# Defines the following macros: +# STRING_TRIM(var str [NOUNQUOTE]) +# - Trim a string by removing the leading and trailing spaces, +# just like STRING(STRIP ...) in CMake 2.6 and later. +# This macro is needed as CMake 2.4 does not support STRING(STRIP ..) +# This macro also remove quote and double quote marks around the string, +# unless NOUNQUOTE is defined. +# * Parameters: +# + var: A variable that stores the result. +# + str: A string. +# + NOUNQUOTE: (Optional) do not remove the double quote mark around the string. +# +# STRING_UNQUOTE(var str) +# - Remove double quote marks and quote marks around a string. +# If the string is not quoted, then it returns an empty string. +# * Parameters: +# + var: A variable that stores the result. +# + str: A string. +# +# STRING_JOIN(var delimiter str_list [str...]) +# - Concatenate strings, with delimiter inserted between strings. +# * Parameters: +# + var: A variable that stores the result. +# + str_list: A list of string. +# + str: (Optional) more string to be join. +# +# STRING_SPLIT(var delimiter str [NOESCAPE_SEMICOLON]) +# - Split a string into a list using a delimiter, which can be in 1 or more +# characters long. +# * Parameters: +# + var: A variable that stores the result. +# + delimiter: To separate a string. +# + str: A string. +# + NOESCAPE_SEMICOLON: (Optional) Do not escape semicolons. +# + +IF(NOT DEFINED _MANAGE_STRING_CMAKE_) + SET(_MANAGE_STRING_CMAKE_ "DEFINED") + + MACRO(STRING_TRIM var str) + SET(${var} "") + IF (NOT "${ARGN}" STREQUAL "NOUNQUOTE") + # Need not trim a quoted string. + STRING_UNQUOTE(_var "${str}") + IF(NOT _var STREQUAL "") + # String is quoted + SET(${var} "${_var}") + ENDIF(NOT _var STREQUAL "") + ENDIF(NOT "${ARGN}" STREQUAL "NOUNQUOTE") + + IF(${var} STREQUAL "") + SET(_var_1 "${str}") + STRING(REGEX REPLACE "^[ \t\r\n]+" "" _var_2 "${str}" ) + STRING(REGEX REPLACE "[ \t\r\n]+$" "" _var_3 "${_var_2}" ) + SET(${var} "${_var_3}") + ENDIF(${var} STREQUAL "") + ENDMACRO(STRING_TRIM var str) + + # Internal macro + # Variable cannot be escaped here, as variable is already substituted + # at the time it passes to this macro. + MACRO(STRING_ESCAPE var str) + # ';' and '\' are tricky, need to be encoded. + # '#' => '#H' + # '\' => '#B' + # ';' => '#S' + SET(_NOESCAPE_SEMICOLON "") + SET(_NOESCAPE_HASH "") + + FOREACH(_arg ${ARGN}) + IF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + SET(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON") + ELSEIF(${_arg} STREQUAL "NOESCAPE_HASH") + SET(_NOESCAPE_HASH "NOESCAPE_HASH") + ENDIF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + ENDFOREACH(_arg) + + IF(_NOESCAPE_HASH STREQUAL "") + STRING(REGEX REPLACE "#" "#H" _ret "${str}") + ELSE(_NOESCAPE_HASH STREQUAL "") + SET(_ret "${str}") + ENDIF(_NOESCAPE_HASH STREQUAL "") + + STRING(REGEX REPLACE "\\\\" "#B" _ret "${_ret}") + IF(_NOESCAPE_SEMICOLON STREQUAL "") + STRING(REGEX REPLACE ";" "#S" _ret "${_ret}") + ENDIF(_NOESCAPE_SEMICOLON STREQUAL "") + SET(${var} "${_ret}") + ENDMACRO(STRING_ESCAPE var str) + + MACRO(STRING_UNESCAPE var str) + # '#B' => '\' + # '#H' => '#' + # '#D' => '$' + # '#S' => ';' + SET(_ESCAPE_VARIABLE "") + SET(_NOESCAPE_SEMICOLON "") + SET(_ret "${str}") + FOREACH(_arg ${ARGN}) + IF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + SET(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON") + ELSEIF(${_arg} STREQUAL "ESCAPE_VARIABLE") + SET(_ESCAPE_VARIABLE "ESCAPE_VARIABLE") + STRING(REGEX REPLACE "#D" "$" _ret "${_ret}") + ENDIF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + ENDFOREACH(_arg) + + STRING(REGEX REPLACE "#B" "\\\\" _ret "${_ret}") + IF(_NOESCAPE_SEMICOLON STREQUAL "") + # ';' => '#S' + STRING(REGEX REPLACE "#S" "\\\\;" _ret "${_ret}") + ELSE(_NOESCAPE_SEMICOLON STREQUAL "") + STRING(REGEX REPLACE "#S" ";" _ret "${_ret}") + ENDIF(_NOESCAPE_SEMICOLON STREQUAL "") + + IF(NOT _ESCAPE_VARIABLE STREQUAL "") + # '#D' => '$' + STRING(REGEX REPLACE "#D" "$" _ret "${_ret}") + ENDIF(NOT _ESCAPE_VARIABLE STREQUAL "") + STRING(REGEX REPLACE "#H" "#" _ret "${_ret}") + SET(${var} "${_ret}") + ENDMACRO(STRING_UNESCAPE var str) + + + MACRO(STRING_UNQUOTE var str) + STRING_ESCAPE(_ret "${str}" ${ARGN}) + IF(_ret MATCHES "^[ \t\r\n]+") + STRING(REGEX REPLACE "^[ \t\r\n]+" "" _ret "${_ret}") + ENDIF(_ret MATCHES "^[ \t\r\n]+") + IF(_ret MATCHES "^\"") + # Double quote + STRING(REGEX REPLACE "\"\(.*\)\"[ \t\r\n]*$" "\\1" _ret "${_ret}") + ELSEIF(_ret MATCHES "^'") + # Single quote + STRING(REGEX REPLACE "'\(.*\)'[ \t\r\n]*$" "\\1" _ret "${_ret}") + ELSE(_ret MATCHES "^\"") + SET(_ret "") + ENDIF(_ret MATCHES "^\"") + + # Unencoding + STRING_UNESCAPE(${var} "${_ret}" ${ARGN}) + ENDMACRO(STRING_UNQUOTE var str) + + MACRO(STRING_JOIN var delimiter str_list) + SET(_ret "") + FOREACH(_str ${str_list}) + IF(_ret STREQUAL "") + SET(_ret "${_str}") + ELSE(_ret STREQUAL "") + SET(_ret "${_ret}${delimiter}${_str}") + ENDIF(_ret STREQUAL "") + ENDFOREACH(_str ${str_list}) + + FOREACH(_str ${ARGN}) + IF(_ret STREQUAL "") + SET(_ret "${_str}") + ELSE(_ret STREQUAL "") + SET(_ret "${_ret}${delimiter}${_str}") + ENDIF(_ret STREQUAL "") + ENDFOREACH(_str ${str_list}) + SET(${var} "${_ret}") + ENDMACRO(STRING_JOIN var delimiter str_list) + + MACRO(STRING_SPLIT var delimiter str) + SET(_max_tokens "") + SET(_NOESCAPE_SEMICOLON "") + SET(_ESCAPE_VARIABLE "") + FOREACH(_arg ${ARGN}) + IF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + SET(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON") + ELSEIF(${_arg} STREQUAL "ESCAPE_VARIABLE") + SET(_ESCAPE_VARIABLE "ESCAPE_VARIABLE") + ELSE(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + SET(_max_tokens ${_arg}) + ENDIF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + ENDFOREACH(_arg) + + IF(NOT _max_tokens) + SET(_max_tokens -1) + ENDIF(NOT _max_tokens) + + STRING_ESCAPE(_str "${str}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE}) + STRING_ESCAPE(_delimiter "${delimiter}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE}) + + SET(_str_list "") + SET(_token_count 0) + STRING(LENGTH "${_delimiter}" _de_len) + + WHILE(NOT _token_count EQUAL _max_tokens) + MATH(EXPR _token_count ${_token_count}+1) + IF(_token_count EQUAL _max_tokens) + # Last token, no need splitting + SET(_str_list ${_str_list} "${_str}") + ELSE(_token_count EQUAL _max_tokens) + # in case encoded characters are delimiters + STRING(LENGTH "${_str}" _str_len) + SET(_index 0) + SET(_token "") + SET(_str_remain "") + MATH(EXPR _str_end ${_str_len}-${_de_len}+1) + SET(_bound "k") + WHILE(_index LESS _str_end) + STRING(SUBSTRING "${_str}" ${_index} ${_de_len} _str_cursor) + IF(_str_cursor STREQUAL _delimiter) + # Get the token + STRING(SUBSTRING "${_str}" 0 ${_index} _token) + # Get the rest + MATH(EXPR _rest_index ${_index}+${_de_len}) + MATH(EXPR _rest_len ${_str_len}-${_index}-${_de_len}) + STRING(SUBSTRING "${_str}" ${_rest_index} ${_rest_len} _str_remain) + SET(_index ${_str_end}) + ELSE(_str_cursor STREQUAL _delimiter) + MATH(EXPR _index ${_index}+1) + ENDIF(_str_cursor STREQUAL _delimiter) + ENDWHILE(_index LESS _str_end) + + IF(_str_remain STREQUAL "") + # Meaning: end of string + LIST(APPEND _str_list "${_str}") + SET(_max_tokens ${_token_count}) + ELSE(_str_remain STREQUAL "") + LIST(APPEND _str_list "${_token}") + SET(_str "${_str_remain}") + ENDIF(_str_remain STREQUAL "") + ENDIF(_token_count EQUAL _max_tokens) + ENDWHILE(NOT _token_count EQUAL _max_tokens) + + + # Unencoding + STRING_UNESCAPE(${var} "${_str_list}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE}) + ENDMACRO(STRING_SPLIT var delimiter str) + +ENDIF(NOT DEFINED _MANAGE_STRING_CMAKE_) + 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 @@ +# This script configures installation paths + +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") set(${name} "${value}") endif() endforeach() + string(TOLOWER ${APP_NAME} APP_NAME_LC) + string(TOUPPER ${APP_NAME} APP_NAME_UC) endif() # bail if we can't parse versions @@ -19,16 +21,21 @@ if(NOT DEFINED APP_VERSION_MAJOR OR NOT DEFINED APP_VERSION_MINOR) message(FATAL_ERROR "Could not determine app version! make sure that ${APP_ROOT}/version.txt exists") endif() +# in case we need to download something, set KODI_MIRROR to the default if not alread set +if(NOT DEFINED KODI_MIRROR) + set(KODI_MIRROR "http://mirrors.kodi.tv") +endif() + ### copy all the addon binding header files to include/kodi # make sure include/kodi exists and is empty -set(KODI_LIB_DIR ${DEPENDS_PATH}/lib/kodi) -if(NOT EXISTS "${KODI_LIB_DIR}/") - file(MAKE_DIRECTORY ${KODI_LIB_DIR}) +set(APP_LIB_DIR ${DEPENDS_PATH}/lib/${APP_NAME_LC}) +if(NOT EXISTS "${APP_LIB_DIR}/") + file(MAKE_DIRECTORY ${APP_LIB_DIR}) endif() -set(KODI_INCLUDE_DIR ${DEPENDS_PATH}/include/kodi) -if(NOT EXISTS "${KODI_INCLUDE_DIR}/") - file(MAKE_DIRECTORY ${KODI_INCLUDE_DIR}) +set(APP_INCLUDE_DIR ${DEPENDS_PATH}/include/${APP_NAME_LC}) +if(NOT EXISTS "${APP_INCLUDE_DIR}/") + file(MAKE_DIRECTORY ${APP_INCLUDE_DIR}) endif() # we still need XBMC_INCLUDE_DIR and XBMC_LIB_DIR for backwards compatibility to xbmc @@ -49,13 +56,13 @@ if(NOT WIN32) endif() endif() -# kodi-config.cmake.in (further down) expects a "prefix" variable -get_filename_component(prefix "${DEPENDS_PATH}" ABSOLUTE) - # generate the proper kodi-config.cmake file -configure_file(${APP_ROOT}/project/cmake/kodi-config.cmake.in ${KODI_LIB_DIR}/kodi-config.cmake @ONLY) +configure_file(${APP_ROOT}/project/cmake/kodi-config.cmake.in ${APP_LIB_DIR}/kodi-config.cmake @ONLY) + # copy cmake helpers to lib/kodi -file(COPY ${APP_ROOT}/project/cmake/scripts/common/addon-helpers.cmake ${APP_ROOT}/project/cmake/scripts/common/addoptions.cmake DESTINATION ${KODI_LIB_DIR}) +file(COPY ${APP_ROOT}/project/cmake/scripts/common/addon-helpers.cmake + ${APP_ROOT}/project/cmake/scripts/common/addoptions.cmake + DESTINATION ${APP_LIB_DIR}) # generate xbmc-config.cmake for backwards compatibility to xbmc configure_file(${APP_ROOT}/project/cmake/xbmc-config.cmake.in ${XBMC_LIB_DIR}/xbmc-config.cmake @ONLY) @@ -69,7 +76,7 @@ foreach(binding ${bindings}) string(REPLACE "+=" ";" binding "${binding}") list(GET binding 1 header) # copy the header file to include/kodi - file(COPY ${APP_ROOT}/${header} DESTINATION ${KODI_INCLUDE_DIR}) + file(COPY ${APP_ROOT}/${header} DESTINATION ${APP_INCLUDE_DIR}) # auto-generate header files for backwards compatibility to xbmc with deprecation warning # but only do it if the file doesn't already exist @@ -95,7 +102,7 @@ if(WIN32) else() set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-1") set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip") - set(PATCH_URL "http://mirrors.xbmc.org/build-deps/win32/${PATCH_ARCHIVE}") + set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}") set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE}) # 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 @@ +# This script holds macros which are project specific + +# Pack a skin xbt file +# Arguments: +# input input directory to pack +# output ouput xbt file +# On return: +# xbt is added to ${XBT_FILES} +function(pack_xbt input output) + file(GLOB_RECURSE MEDIA_FILES ${input}/*) + get_filename_component(dir ${output} PATH) + add_custom_command(OUTPUT ${output} + COMMAND ${CMAKE_COMMAND} -E make_directory ${dir} + COMMAND TexturePacker::TexturePacker + ARGS -input ${input} + -output ${output} + -dupecheck + DEPENDS ${MEDIA_FILES}) + list(APPEND XBT_FILES ${output}) + set(XBT_FILES ${XBT_FILES} PARENT_SCOPE) +endfunction() + +# Add a skin to installation list, mirroring it in build tree, packing textures +# Arguments: +# skin skin directory +# relative relative base path in build tree +# On return: +# xbt is added to ${XBT_FILES}, data added to ${install_data}, mirror in build tree +function(copy_skin_to_buildtree skin relative) + file(GLOB_RECURSE FILES ${skin}/*) + file(GLOB_RECURSE MEDIA_FILES ${skin}/media/*) + list(REMOVE_ITEM FILES ${MEDIA_FILES}) + foreach(file ${FILES}) + copy_file_to_buildtree(${file} ${relative}) + endforeach() + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${dest}/media) + string(REPLACE "${relative}/" "" dest ${skin}) + pack_xbt(${skin}/media + ${CMAKE_BINARY_DIR}/${dest}/media/Textures.xbt + ${CMAKE_BINARY_DIR}) + + set(XBT_FILES ${XBT_FILES} PARENT_SCOPE) + set(install_data ${install_data} PARENT_SCOPE) +endfunction() + +# Get GTest tests as CMake tests. +# Copied from FindGTest.cmake +# Thanks to Daniel Blezek for the GTEST_ADD_TESTS code +function(GTEST_ADD_TESTS executable extra_args) + if(NOT ARGN) + message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS") + endif() + foreach(source ${ARGN}) + file(READ "${source}" contents) + string(REGEX MATCHALL "TEST_?[F]?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) + foreach(hit ${found_tests}) + string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit}) + add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args}) + endforeach() + # Groups parametrized tests under a single ctest entry + string(REGEX MATCHALL "INSTANTIATE_TEST_CASE_P\\(([^,]+), *([^,]+)" found_tests2 ${contents}) + foreach(hit ${found_tests2}) + string(SUBSTRING ${hit} 24 -1 test_name) + string(REPLACE "," ";" test_name "${test_name}") + list(GET test_name 0 filter_name) + list(GET test_name 1 test_prefix) + string(STRIP ${test_prefix} test_prefix) + add_test(${test_prefix}.${filter_name} ${executable} --gtest_filter=${filter_name}* ${extra_args}) + endforeach() + endforeach() +endfunction() + +function(whole_archive output) + if(CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) + set(${output} -Wl,--whole-archive ${ARGN} -Wl,--no-whole-archive PARENT_SCOPE) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL AppleClang) + foreach(library ${ARGN}) + list(APPEND ${output} -Wl,-force_load ${library}) + set(${output} ${${output}} PARENT_SCOPE) + endforeach() + else() + set(${output} ${ARGN} PARENT_SCOPE) + endif() +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 @@ +if(NOT CMAKE_TOOLCHAIN_FILE) + message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for darwin. See ${PROJECT_SOURCE_DIR}/README.md") +endif() + +set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/posix/main.cpp + ${CORE_SOURCE_DIR}/xbmc/platform/darwin/osx/SDLMain.mm + ${CORE_SOURCE_DIR}/xbmc/platform/darwin/osx/SDLMain.h) + +set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX) +set(SYSTEM_DEFINES -D_REENTRANT -D_FILE_DEFINED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE + -D__STDC_CONSTANT_MACROS) +set(PLATFORM_DIR linux) +set(CMAKE_SYSTEM_NAME Darwin) +if(WITH_ARCH) + set(ARCH ${WITH_ARCH}) +else() + if(CPU STREQUAL x86_64) + set(ARCH x86_64-apple-darwin) + elseif(CPU STREQUAL i386) + set(ARCH i386-apple-darwin) + else() + message(SEND_ERROR "Unknown CPU: ${CPU}") + endif() +endif() + +find_package(CXX11 REQUIRED) + +list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${NATIVEPREFIX}) + +list(APPEND DEPLIBS "-framework DiskArbitration" "-framework IOKit" + "-framework IOSurface" "-framework SystemConfiguration" + "-framework ApplicationServices" "-framework AppKit" + "-framework CoreAudio" "-framework AudioToolbox" + "-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 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 @@ +function(core_link_library lib wraplib) + if(CMAKE_GENERATOR MATCHES "Unix Makefiles") + set(wrapper_obj cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o) + elseif(CMAKE_GENERATOR MATCHES "Xcode") + set(wrapper_obj cores/dll-loader/exports/kodi.build/$(CONFIGURATION)/wrapper.build/Objects-$(CURRENT_VARIANT)/$(CURRENT_ARCH)/wrapper.o) + else() + message(FATAL_ERROR "Unsupported generator in core_link_library") + endif() + + set(export -bundle -undefined dynamic_lookup -read_only_relocs suppress + -Wl,-alias_list,${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def + ${CORE_BUILD_DIR}/${wrapper_obj}) + set(check_arg "") + if(TARGET ${lib}) + set(target ${lib}) + set(link_lib $) + set(check_arg ${ARGV2}) + set(data_arg ${ARGV3}) + else() + set(target ${ARGV2}) + set(link_lib ${lib}) + set(check_arg ${ARGV3}) + set(data_arg ${ARGV4}) + endif() + if(check_arg STREQUAL export) + set(export ${export} + -Wl,--version-script=${ARGV3}) + elseif(check_arg STREQUAL nowrap) + set(export ${data_arg}) + elseif(check_arg STREQUAL extras) + foreach(arg ${data_arg}) + list(APPEND export ${arg}) + endforeach() + endif() + get_filename_component(dir ${wraplib} PATH) + + # We can't simply pass the linker flags to the args section of the custom command + # because cmake will add quotes around it (and the linker will fail due to those). + # We need to do this handstand first ... + separate_arguments(CUSTOM_COMMAND_ARGS_LDFLAGS UNIX_COMMAND "${CMAKE_SHARED_LINKER_FLAGS}") + + add_custom_command(OUTPUT ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} + COMMAND ${CMAKE_COMMAND} -E make_directory ${dir} + COMMAND ${CMAKE_C_COMPILER} + ARGS ${CUSTOM_COMMAND_ARGS_LDFLAGS} ${export} -Wl,-force_load ${link_lib} + -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} + DEPENDS ${target} wrapper.def wrapper + VERBATIM) + + # Uncomment to create wrap_ targets for debugging + #get_filename_component(libname ${wraplib} NAME_WE) + #add_custom_target(wrap_${libname} ALL DEPENDS ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}) + + list(APPEND WRAP_FILES ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}) + set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE) +endfunction() + +function(find_soname lib) + cmake_parse_arguments(arg "REQUIRED" "" "" ${ARGN}) + + string(TOLOWER ${lib} liblow) + if(${lib}_LDFLAGS) + set(link_lib "${${lib}_LDFLAGS}") + else() + set(link_lib "${${lib}_LIBRARIES}") + endif() + + execute_process(COMMAND ${CMAKE_C_COMPILER} -print-search-dirs + COMMAND fgrep libraries: + COMMAND sed "s/[^=]*=\\(.*\\)/\\1/" + COMMAND sed "s/:/ /g" + ERROR_QUIET + OUTPUT_VARIABLE cc_lib_path + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND echo ${link_lib} + COMMAND sed "s/-L[ ]*//g" + COMMAND sed "s/-l[^ ]*//g" + ERROR_QUIET + OUTPUT_VARIABLE env_lib_path + OUTPUT_STRIP_TRAILING_WHITESPACE) + + foreach(path ${cc_lib_path} ${env_lib_path}) + if(IS_DIRECTORY ${path}) + execute_process(COMMAND ls -- ${path}/lib${liblow}.dylib + ERROR_QUIET + OUTPUT_VARIABLE lib_file + OUTPUT_STRIP_TRAILING_WHITESPACE) + else() + set(lib_file ${path}) + endif() + if(lib_file) + # we want the path/name that is embedded in the dylib + execute_process(COMMAND otool -L ${lib_file} + COMMAND grep -v lib${liblow}.dylib + COMMAND grep ${liblow} + COMMAND awk "{V=1; print $V}" + ERROR_QUIET + OUTPUT_VARIABLE filename + OUTPUT_STRIP_TRAILING_WHITESPACE) + get_filename_component(${lib}_SONAME "${filename}" NAME) + message(STATUS "${lib} soname: ${${lib}_SONAME}") + endif() + endforeach() + if(arg_REQUIRED AND NOT ${lib}_SONAME) + message(FATAL_ERROR "Could not find dynamically loadable library ${lib}") + endif() + set(${lib}_SONAME ${${lib}_SONAME} PARENT_SCOPE) +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 @@ +if(NOT prefix) + set(prefix ${DEPENDS_PATH}) +endif() +if(NOT exec_prefix) + set(exec_prefix \${prefix}) +endif() +if(NOT libdir) + set(libdir ${prefix}/lib) +endif() +if(NOT bindir) + set(bindir ${prefix}/bin) +endif() +if(NOT includedir) + set(includedir ${prefix}/include) +endif() +if(NOT datarootdir) + set(datarootdir ${prefix}/share) +endif() +if(NOT datadir) + set(datadir \${datarootdir}) +endif() + +list(APPEND final_message "-- PATH config --") +list(APPEND final_message "Prefix: ${prefix}") +list(APPEND final_message "Libdir: ${libdir}") +list(APPEND final_message "Bindir: ${bindir}") +list(APPEND final_message "Includedir: ${includedir}") +list(APPEND final_message "Datarootdir: ${datarootdir}") +list(APPEND final_message "Datadir: ${datadir}") + +set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/xbmc\" + -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 @@ +set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_FREEBSD) +set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED + -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) +set(PLATFORM_DIR linux) +set(SYSTEM_LDFLAGS -L/usr/local/lib) +if(WITH_ARCH) + set(ARCH ${WITH_ARCH}) +else() + if(CMAKE_SYSTEM_PROCESSOR STREQUAL amd64) + set(ARCH x86_64-freebsd) + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i.86") + set(ARCH x86-freebsd) + else() + message(WARNING "unknown CPU: ${CPU}") + endif() +endif() + +set(LIRC_DEVICE "\"/dev/lircd\"" CACHE STRING "LIRC device to use") +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 @@ +set(libdir ${CMAKE_INSTALL_PREFIX}/lib) +set(bindir ${CMAKE_INSTALL_PREFIX}/bin) + +configure_file(${CORE_SOURCE_DIR}/tools/Linux/xbmc.sh.in + ${CORE_BUILD_DIR}/scripts/xbmc @ONLY) +configure_file(${CORE_SOURCE_DIR}/tools/Linux/xbmc-standalone.sh.in + ${CORE_BUILD_DIR}/scripts/xbmc-standalone @ONLY) + +install(TARGETS xbmc-xrandr DESTINATION lib/xbmc) +install(FILES ${addon_bindings} DESTINATION include/xbmc) +install(FILES ${cmake_files} ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/modules/xbmc-config.cmake + DESTINATION lib/xbmc) +install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/xbmc + ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/xbmc-standalone + DESTINATION bin) +install(FILES ${CORE_SOURCE_DIR}/tools/Linux/FEH.py + DESTINATION share/xbmc) + +install(FILES ${CORE_SOURCE_DIR}/tools/Linux/xbmc-xsession.desktop + RENAME XBMC.desktop + DESTINATION share/xsessions) + +install(FILES ${CORE_SOURCE_DIR}/LICENSE.GPL + ${CORE_SOURCE_DIR}/docs/README.freebsd + DESTINATION share/doc/xbmc) + +foreach(texture ${XBT_FILES}) + string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${texture}) + get_filename_component(dir ${dir} PATH) + install(FILES ${texture} + DESTINATION share/xbmc/${dir}) +endforeach() + +foreach(wraplib ${WRAP_FILES}) + get_filename_component(dir ${wraplib} PATH) + install(PROGRAMS ${CMAKE_BINARY_DIR}/${wraplib} + DESTINATION lib/xbmc/${dir}) +endforeach() + +foreach(file ${install_data}) + get_filename_component(dir ${file} PATH) + install(FILES ${CMAKE_BINARY_DIR}/${file} + DESTINATION share/xbmc/${dir}) +endforeach() + +install(CODE "file(STRINGS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs dirs) + foreach(dir \${dirs}) + file(GLOB_RECURSE FILES RELATIVE ${CMAKE_BINARY_DIR} \${dir}/*) + foreach(file \${FILES}) + get_filename_component(dir \${file} PATH) + file(INSTALL \${file} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/xbmc/\${dir}) + endforeach() + endforeach()") +foreach(subdir ${build_dirs}) + string(REPLACE " " ";" subdir ${subdir}) + list(GET subdir 0 id) + install(CODE "execute_process(COMMAND make -C ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${id}/src/${id}-build install)") +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 @@ +if(NOT CMAKE_TOOLCHAIN_FILE) + message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for ios. See ${PROJECT_SOURCE_DIR}/README.md") +endif() + +set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/XBMCApplication.m) + +set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_IOS) +set(SYSTEM_DEFINES -D_REENTRANT -D_FILE_DEFINED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE + -D__STDC_CONSTANT_MACROS) +set(PLATFORM_DIR linux) +set(CMAKE_SYSTEM_NAME Darwin) +if(WITH_ARCH) + set(ARCH ${WITH_ARCH}) +else() + if(CPU STREQUAL armv7) + set(ARCH arm-apple-darwin) + elseif(CPU STREQUAL arm64) + set(ARCH arm-apple-darwin) + else() + message(SEND_ERROR "Unknown CPU: ${CPU}") + endif() +endif() + +find_package(CXX11 REQUIRED) + +list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${NATIVEPREFIX}) + +list(APPEND DEPLIBS "-framework CoreFoundation" "-framework CoreVideo" + "-framework CoreAudio" "-framework AudioToolbox" + "-framework QuartzCore" "-framework MediaPlayer" + "-framework CFNetwork" "-framework CoreGraphics" + "-framework Foundation" "-framework UIKit" + "-framework CoreMedia" "-framework AVFoundation") + +set(ENABLE_DVDCSS OFF) +set(ENABLE_OPTICAL OFF) +set(ENABLE_VTB ON) +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 @@ +set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_LINUX) +set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED + -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) +set(PLATFORM_DIR linux) +set(CMAKE_SYSTEM_NAME Linux) +if(WITH_ARCH) + set(ARCH ${WITH_ARCH}) +else() + if(CPU STREQUAL x86_64) + set(ARCH x86_64-linux) + elseif(CPU MATCHES "i.86") + set(ARCH i486-linux) + else() + message(SEND_ERROR "Unknown CPU: ${CPU}") + endif() +endif() + +find_package(CXX11 REQUIRED) + +set(LIRC_DEVICE "\"/dev/lircd\"" CACHE STRING "LIRC device to use") +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 @@ +if(X_FOUND) + set(USE_X11 1) +else() + set(USE_X11 0) +endif() +if(OPENGL_FOUND) + set(USE_OPENGL 1) +else() + set(USE_OPENGL 0) +endif() +if(OPENGLES_FOUND) + set(USE_OPENGLES 1) +else() + set(USE_OPENGLES 0) +endif() + +configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi.sh.in + ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC} @ONLY) +configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.in + ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone @ONLY) + +install(TARGETS ${APP_NAME_LC} DESTINATION ${libdir}/kodi) +if(ENABLE_X11 AND XRANDR_FOUND) + install(TARGETS ${APP_NAME_LC}-xrandr DESTINATION ${libdir}/${APP_NAME_LC}) +endif() +install(FILES ${addon_bindings} DESTINATION ${includedir}/kodi) +install(FILES ${cmake-files} + DESTINATION ${libdir}/kodi) +install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC} + ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone + DESTINATION ${bindir}) + +configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi-xsession.desktop.in + ${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop) +install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop + DESTINATION ${datarootdir}/xsessions) + +install(FILES ${CORE_SOURCE_DIR}/LICENSE.GPL + ${CORE_SOURCE_DIR}/docs/README.linux + DESTINATION ${datarootdir}/doc/kodi) + +install(FILES ${CORE_SOURCE_DIR}/tools/Linux/kodi.desktop + DESTINATION ${datarootdir}/applications) + +foreach(texture ${XBT_FILES}) + string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${texture}) + get_filename_component(dir ${dir} PATH) + install(FILES ${texture} + DESTINATION ${datarootdir}/kodi/${dir}) +endforeach() + +foreach(wraplib ${WRAP_FILES}) + get_filename_component(dir ${wraplib} PATH) + install(PROGRAMS ${CMAKE_BINARY_DIR}/${wraplib} + DESTINATION ${libdir}/kodi/${dir}) +endforeach() + +foreach(file ${install_data}) + get_filename_component(dir ${file} PATH) + install(FILES ${CMAKE_BINARY_DIR}/${file} + DESTINATION ${datarootdir}/kodi/${dir}) +endforeach() + +if(EXISTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs) + install(CODE "file(STRINGS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs dirs) + foreach(dir \${dirs}) + file(GLOB_RECURSE FILES RELATIVE ${CMAKE_BINARY_DIR} \${dir}/*) + foreach(file \${FILES}) + get_filename_component(dir \${file} PATH) + file(INSTALL \${file} DESTINATION ${datarootdir}/kodi/\${dir}) + endforeach() + endforeach()") +endif() + +if(NOT "$ENV{DESTDIR}" STREQUAL "") + set(DESTDIR ${CMAKE_BINARY_DIR}/$ENV{DESTDIR}) +endif() +foreach(subdir ${build_dirs}) + if(NOT subdir MATCHES kodi-platform) + string(REPLACE " " ";" subdir ${subdir}) + list(GET subdir 0 id) + install(CODE "execute_process(COMMAND make -C ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${id}/src/${id}-build install DESTDIR=${DESTDIR})") + endif() +endforeach() + +install(FILES ${CORE_SOURCE_DIR}/media/icon48x48.png + RENAME ${APP_NAME_LC}.png + DESTINATION ${datarootdir}/icons/hicolor/48x48/apps) +install(FILES ${CORE_SOURCE_DIR}/media/icon256x256.png + RENAME ${APP_NAME_LC}.png + DESTINATION ${datarootdir}/icons/hicolor/256x256/apps) + +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 @@ +function(core_link_library lib wraplib) + set(export -Wl,--unresolved-symbols=ignore-all + `cat ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def` + ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o) + set(check_arg "") + if(TARGET ${lib}) + set(target ${lib}) + set(link_lib ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${lib}/${lib}.a) + set(check_arg ${ARGV2}) + set(data_arg ${ARGV3}) + else() + set(target ${ARGV2}) + set(link_lib ${lib}) + set(check_arg ${ARGV3}) + set(data_arg ${ARGV4}) + endif() + if(check_arg STREQUAL export) + set(export ${export} + -Wl,--version-script=${ARGV3}) + elseif(check_arg STREQUAL nowrap) + set(export ${data_arg}) + elseif(check_arg STREQUAL extras) + foreach(arg ${data_arg}) + list(APPEND export ${arg}) + endforeach() + endif() + get_filename_component(dir ${wraplib} PATH) + add_custom_command(OUTPUT ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} + COMMAND cmake -E make_directory ${dir} + COMMAND ${CMAKE_C_COMPILER} + ARGS -Wl,--whole-archive + ${link_lib} + -Wl,--no-whole-archive -lm + -shared -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} + ${export} + DEPENDS ${target} wrapper.def wrapper) + list(APPEND WRAP_FILES ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}) + set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE) +endfunction() + +function(find_soname lib) + cmake_parse_arguments(arg "REQUIRED" "" "" ${ARGN}) + + string(TOLOWER ${lib} liblow) + if(${lib}_LDFLAGS) + set(link_lib "${${lib}_LDFLAGS}") + else() + if(IS_ABSOLUTE "${${lib}_LIBRARIES}") + set(link_lib "${${lib}_LIBRARIES}") + else() + set(link_lib -l${${lib}_LIBRARIES}) + endif() + endif() + execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-M ${link_lib} + COMMAND grep LOAD.*${liblow} + ERROR_QUIET + OUTPUT_VARIABLE ${lib}_FILENAME) + string(REPLACE "LOAD " "" ${lib}_FILENAME "${${lib}_FILENAME}") + string(STRIP "${${lib}_FILENAME}" ${lib}_FILENAME) + if(NOT ${lib}_FILENAME) + execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-t ${link_lib} + OUTPUT_QUIET + ERROR_VARIABLE _TMP_FILENAME) + string(REGEX MATCH ".*lib${liblow}.so" ${lib}_FILENAME ${_TMP_FILENAME}) + endif() + if(${lib}_FILENAME) + execute_process(COMMAND objdump -p ${${lib}_FILENAME} + COMMAND grep SONAME.*${liblow} + ERROR_QUIET + OUTPUT_VARIABLE ${lib}_SONAME) + string(REPLACE "SONAME " "" ${lib}_SONAME ${${lib}_SONAME}) + string(STRIP ${${lib}_SONAME} ${lib}_SONAME) + message(STATUS "${lib} soname: ${${lib}_SONAME}") + set(${lib}_SONAME ${${lib}_SONAME} PARENT_SCOPE) + endif() + if(arg_REQUIRED AND NOT ${lib}_SONAME) + message(FATAL_ERROR "Could not find dynamically loadable library ${lib}") + endif() +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 @@ +if(NOT prefix) + set(prefix ${CMAKE_INSTALL_PREFIX}) +else() + set(CMAKE_INSTALL_PREFIX ${prefix}) +endif() +if(NOT exec_prefix) + set(exec_prefix \${prefix}) +endif() +if(NOT libdir) + set(libdir ${prefix}/lib) +endif() +if(NOT bindir) + set(bindir ${prefix}/bin) +endif() +if(NOT includedir) + set(includedir ${prefix}/include) +endif() +if(NOT datarootdir) + set(datarootdir ${prefix}/share) +endif() +if(NOT datadir) + set(datadir \${datarootdir}) +endif() + +list(APPEND final_message "-- PATH config --") +list(APPEND final_message "Prefix: ${prefix}") +list(APPEND final_message "Libdir: ${libdir}") +list(APPEND final_message "Bindir: ${bindir}") +list(APPEND final_message "Includedir: ${includedir}") +list(APPEND final_message "Datarootdir: ${datarootdir}") +list(APPEND final_message "Datadir: ${datadir}") + +set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/xbmc\" + -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 @@ +if(NOT CMAKE_TOOLCHAIN_FILE) + message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for rbpi. See ${PROJECT_SOURCE_DIR}/README.md") +endif() + +set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_RASPBERRY_PI + -DHAS_OMXPLAYER -DHAVE_OMXLIB) +set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED + -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) +set(PLATFORM_DIR linux) + +string(REGEX REPLACE "[ ]+" ";" SYSTEM_LDFLAGS $ENV{LDFLAGS}) +set(CMAKE_SYSTEM_NAME Linux) + +if(WITH_ARCH) + set(ARCH ${WITH_ARCH}) +else() + if(CPU STREQUAL arm1176jzf-s) + set(ARCH arm-linux-gnueabihf) + elseif(CPU MATCHES "cortex-a7") + set(ARCH arm-linux-gnueabihf) + else() + message(SEND_ERROR "Unknown CPU: ${CPU}") + endif() +endif() + +find_package(CXX11 REQUIRED) + +set(LIRC_DEVICE "\"/dev/lircd\"" CACHE STRING "LIRC device to use") +set(DEP_DEFINES -DLIRC_DEVICE=${LIRC_DEVICE}) +set(MMAL_FOUND 1 CACHE INTERNAL "MMAL") +set(OMX_FOUND 1 CACHE INTERNAL "OMX") +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 @@ +# -------- Architecture settings --------- + +set(ARCH win32) + + +# -------- Paths (mainly for find_package) --------- + +set(PLATFORM_DIR win32) + +# Precompiled headers fail with per target output directory. (needs CMake 3.1) +set(PRECOMPILEDHEADER_DIR ${PROJECT_BINARY_DIR}/${CORE_BUILD_CONFIG}/objs) + +set(CMAKE_SYSTEM_NAME Windows) +list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32) +list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg) +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg/bin) +list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../BuildDependencies) +set(CONFIGURATION_LIBDIR lib/${CORE_BUILD_CONFIG}-vc120) +set(CONFIGURATION_LIBDIR_RELEASE lib/Release-vc120) +set(CONFIGURATION_LIBDIR_DEBUG lib/Debug-vc120) + +set(JPEG_NAMES ${JPEG_NAMES} jpeg-static) +set(PYTHON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/../BuildDependencies/include/python) + + +# -------- Compiler options --------- + +add_options(CXX ALL_BUILDS "/wd\"4996\"") +set(ARCH_DEFINES -D_WINDOWS -DTARGET_WINDOWS) +set(SYSTEM_DEFINES -DNOMINMAX -D_USE_32BIT_TIME_T -DHAS_DX -D__STDC_CONSTANT_MACROS + -DTAGLIB_STATIC -DNPT_CONFIG_ENABLE_LOGGING + -DPLT_HTTP_DEFAULT_USER_AGENT="UPnP/1.0 DLNADOC/1.50 Kodi" + -DPLT_HTTP_DEFAULT_SERVER="UPnP/1.0 DLNADOC/1.50 Kodi" + -DBUILDING_WITH_CMAKE + $<$:-DD3D_DEBUG_INFO -D_SECURE_SCL=0 -D_HAS_ITERATOR_DEBUGGING=0>) + +# Compile with /MT (to be compatible with the dependent libraries) +foreach(CompilerFlag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") +endforeach() + +# Make sure /FS is set for Visual Studio in order to prevent simultanious access to pdb files. +if(CMAKE_GENERATOR MATCHES "Visual Studio") + set(CMAKE_CXX_FLAGS "/MP /FS ${CMAKE_CXX_FLAGS}") +endif() + + +# -------- Linker options --------- + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") + +# For #pragma comment(lib X) +# TODO: It would certainly be better to handle these libraries via CMake modules. +link_directories(${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg/bin + ${PROJECT_SOURCE_DIR}/../BuildDependencies/lib + ${PROJECT_SOURCE_DIR}/../BuildDependencies/${CONFIGURATION_LIBDIR}) + +# Additional libraries +list(APPEND DEPLIBS d3d11.lib DInput8.lib DSound.lib winmm.lib Mpr.lib Iphlpapi.lib + PowrProf.lib setupapi.lib dwmapi.lib yajl.lib dxguid.lib DelayImp.lib) + +# NODEFAULTLIB option +set(_nodefaultlibs_RELEASE libc msvcrt libci msvcprt) +set(_nodefaultlibs_DEBUG libcpmt libc msvcrt libcmt msvcrtd msvcprtd) +foreach(_lib ${_nodefaultlibs_RELEASE}) + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:\"${_lib}\"") +endforeach() +foreach(_lib ${_nodefaultlibs_DEBUG}) + set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:\"${_lib}\"") +endforeach() + +# DELAYLOAD option +set(_delayloadlibs libxslt.dll dnssd.dll dwmapi.dll ssh.dll sqlite3.dll + avcodec-56.dll avfilter-5.dll avformat-56.dll avutil-54.dll + postproc-53.dll swresample-1.dll swscale-3.dll d3dcompiler_47.dll) +foreach(_lib ${_delayloadlibs}) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:\"${_lib}\"") +endforeach() + +# Make the Release version create a PDB +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") +# Minimize the size or the resulting DLLs +set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF") + + +# -------- Visual Studio options --------- + +if(CMAKE_GENERATOR MATCHES "Visual Studio") + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +endif() diff --git a/project/cmake/scripts/windows/install.cmake b/project/cmake/scripts/windows/install.cmake new file mode 100644 index 0000000..e69de29 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 @@ +function(core_link_library lib wraplib) +# set(export -Wl,--unresolved-symbols=ignore-all +# `cat ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def` +# ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o) +# set(check_arg "") +# if(TARGET ${lib}) +# set(target ${lib}) +# set(link_lib ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${lib}/${lib}.a) +# set(check_arg ${ARGV2}) +# set(data_arg ${ARGV3}) +# else() +# set(target ${ARGV2}) +# set(link_lib ${lib}) +# set(check_arg ${ARGV3}) +# set(data_arg ${ARGV4}) +# endif() +# if(check_arg STREQUAL "export") +# set(export ${export} +# -Wl,--version-script=${ARGV3}) +# elseif(check_arg STREQUAL "nowrap") +# set(export ${data_arg}) +# elseif(check_arg STREQUAL "extras") +# foreach(arg ${data_arg}) +# list(APPEND export ${arg}) +# endforeach() +# endif() +# get_filename_component(dir ${wraplib} PATH) +# add_custom_command(OUTPUT ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} +# COMMAND cmake -E make_directory ${dir} +# COMMAND ${CMAKE_C_COMPILER} +# ARGS -Wl,--whole-archive +# ${link_lib} +# -Wl,--no-whole-archive -lm +# -shared -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} +# ${export} +# DEPENDS ${target} wrapper.def wrapper) +# list(APPEND WRAP_FILES ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}) +# set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE) +endfunction() + +function(find_soname lib) + # Windows uses hardcoded dlls in xbmc/DllPaths_win32.h. + # Therefore the output of this function is unused. +endfunction() + +# Add precompiled header to target +# Arguments: +# target existing target that will be set up to compile with a precompiled header +# pch_header the precompiled header file +# pch_source the precompiled header source file +# Optional Arguments: +# PCH_TARGET build precompiled header as separate target with the given name +# so that the same precompiled header can be used for multiple libraries +# EXCLUDE_SOURCES if not all target sources shall use the precompiled header, +# the relevant files can be listed here +# On return: +# Compiles the pch_source into a precompiled header and adds the header to +# the given target +function(add_precompiled_header target pch_header pch_source) + cmake_parse_arguments(PCH "" "PCH_TARGET" "EXCLUDE_SOURCES" ${ARGN}) + + if(PCH_PCH_TARGET) + set(pch_binary ${PRECOMPILEDHEADER_DIR}/${PCH_PCH_TARGET}.pch) + else() + set(pch_binary ${PRECOMPILEDHEADER_DIR}/${target}.pch) + endif() + + # Set compile options and dependency for sources + get_target_property(sources ${target} SOURCES) + list(REMOVE_ITEM sources ${pch_source}) + foreach(exclude_source IN LISTS PCH_EXCLUDE_SOURCES) + list(REMOVE_ITEM sources ${exclude_source}) + endforeach() + set_source_files_properties(${sources} + PROPERTIES COMPILE_FLAGS "/Yu\"${pch_header}\" /Fp\"${pch_binary}\" /FI\"${pch_header}\"" + OBJECT_DEPENDS "${pch_binary}") + + # Set compile options for precompiled header + if(NOT PCH_PCH_TARGET OR NOT TARGET ${PCH_PCH_TARGET}_pch) + set_source_files_properties(${pch_source} + PROPERTIES COMPILE_FLAGS "/Yc\"${pch_header}\" /Fp\"${pch_binary}\"" + OBJECT_OUTPUTS "${pch_binary}") + endif() + + # Compile precompiled header + if(PCH_PCH_TARGET) + # As own target for usage in multiple libraries + if(NOT TARGET ${PCH_PCH_TARGET}_pch) + add_library(${PCH_PCH_TARGET}_pch STATIC ${pch_source}) + set_target_properties(${PCH_PCH_TARGET}_pch PROPERTIES COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR}) + endif() + # From VS2012 onwards, precompiled headers have to be linked against (LNK2011). + target_link_libraries(${target} PUBLIC ${PCH_PCH_TARGET}_pch) + set_target_properties(${target} PROPERTIES COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR}) + else() + # As part of the target + target_sources(${target} PRIVATE ${pch_source}) + endif() +endfunction() + +# Adds an FX-compiled shader to a target +# Creates a custom command that FX-compiles the given shader and adds the +# generated header file to the given target. +# Arguments: +# target Target to add the FX-compiled shader to +# hlsl HLSL shader input file +# profile HLSL profile that specifies the shader model +# entrypoint Shader entry point +# On return: +# FXC_FILE is set to the name of the generated header file. +function(add_shader_dx target hlsl profile entrypoint) + get_filename_component(file ${hlsl} NAME_WE) + add_custom_command(OUTPUT ${file}.h + COMMAND ${FXC} /Fh ${file}.h + /E ${entrypoint} + /T ${profile} + /Vn ${file} + /Qstrip_reflect + ${hlsl} + DEPENDS ${hlsl} + COMMENT "FX compile ${hlsl}" + VERBATIM) + target_sources(${target} PRIVATE ${file}.h) + target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +endfunction() + +# Copies the main dlls to the root of the buildtree +# On return: +# files added to ${install_data}, mirror in build tree +function(copy_main_dlls_to_buildtree) + set(dir ${PROJECT_SOURCE_DIR}/../Win32BuildSetup/dependencies) + file(GLOB_RECURSE files ${dir}/*) + foreach(file ${files}) + copy_file_to_buildtree(${file} ${dir}) + endforeach() + + if(D3DCOMPILER_DLL) + get_filename_component(d3dcompiler_dir ${D3DCOMPILER_DLL} DIRECTORY) + copy_file_to_buildtree(${D3DCOMPILER_DLL} ${d3dcompiler_dir}) + endif() + + set(install_data ${install_data} PARENT_SCOPE) +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 @@ +if(NOT prefix) + set(prefix ${CMAKE_INSTALL_PREFIX}) +else() + set(CMAKE_INSTALL_PREFIX ${prefix}) +endif() +if(NOT exec_prefix) + set(exec_prefix \${prefix}) +endif() +if(NOT libdir) + set(libdir ${prefix}/lib) +endif() +if(NOT bindir) + set(bindir ${prefix}/bin) +endif() +if(NOT includedir) + set(includedir ${prefix}/include) +endif() +if(NOT datarootdir) + set(datarootdir ${prefix}/share) +endif() +if(NOT datadir) + set(datadir \${datarootdir}) +endif() + +list(APPEND final_message "-- PATH config --") +list(APPEND final_message "Prefix: ${prefix}") +list(APPEND final_message "Libdir: ${libdir}") +list(APPEND final_message "Bindir: ${bindir}") +list(APPEND final_message "Includedir: ${includedir}") +list(APPEND final_message "Datarootdir: ${datarootdir}") +list(APPEND final_message "Datadir: ${datadir}") + +set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/xbmc\" + -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 @@ +xbmc/linux linuxsupport +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic +xbmc/network/linux network/linux +xbmc/peripherals/bus/linux peripherals/bus/linux +xbmc/powermanagement/android powermanagement/android +xbmc/storage/android storage/android +xbmc/filesystem/posix filesystem/posix +xbmc/utils/posix utils_posix +xbmc/windowing/android windowing/android +xbmc/windowing/egl windowing/egl +xbmc/platform/posix posix +xbmc/platform/android/activity android_activity +xbmc/platform/android/bionic_supplement android_bionicsupplement +xbmc/platform/android/jni android_jni +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 @@ +lib/addons/library.kodi.adsp KODI_adsp +lib/addons/library.kodi.audioengine KODI_audioengine +lib/addons/library.kodi.guilib KODI_guilib +lib/addons/library.kodi.inputstream KODI_inputstream +lib/addons/library.xbmc.addon XBMC_addon +lib/addons/library.xbmc.codec XBMC_codec +lib/addons/library.xbmc.pvr XBMC_pvr diff --git a/project/cmake/treedata/common/cores.txt b/project/cmake/treedata/common/cores.txt new file mode 100644 index 0000000..d23939d --- /dev/null +++ b/project/cmake/treedata/common/cores.txt @@ -0,0 +1,8 @@ +xbmc/cores cores +xbmc/cores/AudioEngine cores/audioengine +xbmc/cores/DllLoader cores/dll-loader +xbmc/cores/DllLoader/exports cores/dll-loader/exports +xbmc/cores/DllLoader/exports/util cores/dll-loader/exports/util +xbmc/cores/ExternalPlayer cores/externalplayer +xbmc/cores/paplayer cores/paplayer +xbmc/cores/playercorefactory cores/playercorefactory 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 @@ +xbmc/events events +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 @@ +xbmc/contrib/kissfft kissfft +lib/libUPnP upnp +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 @@ +xbmc/filesystem filesystem +xbmc/filesystem/VideoDatabaseDirectory filesystem/videodatabase +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 @@ +xbmc/interfaces interfaces +xbmc/interfaces/builtins interfaces/builtins +xbmc/interfaces/generic interfaces/generic +xbmc/interfaces/info interfaces/info +xbmc/interfaces/json-rpc interfaces/json-rpc +xbmc/interfaces/json-rpc/schema interfaces/json-rpc/schema +xbmc/interfaces/legacy interfaces/legacy +xbmc/interfaces/legacy/wsgi interfaces/legacy/wsgi +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 @@ +xbmc/music music +xbmc/music/dialogs music/dialogs +xbmc/music/infoscanner music/infoscanner +xbmc/music/tags music/tags +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 @@ +xbmc/network network +xbmc/network/dacp network/dacp +xbmc/network/httprequesthandler network/httprequesthandler +xbmc/network/httprequesthandler/python network/httprequesthandler/python +xbmc/network/upnp network/upnp +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 @@ +xbmc/peripherals peripherals +xbmc/peripherals/bus peripherals/bus +xbmc/peripherals/devices peripherals/devices +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 @@ +xbmc/profiles profiles +xbmc/profiles/dialogs profiles/dialogs +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 @@ +xbmc/pvr pvr +xbmc/pvr/addons pvr/addons +xbmc/pvr/channels pvr/channels +xbmc/pvr/dialogs pvr/dialogs +xbmc/pvr/recordings pvr/recordings +xbmc/pvr/timers pvr/timers +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 @@ +xbmc/settings settings +xbmc/settings/dialogs settings/dialogs +xbmc/settings/lib settings/lib +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 @@ +xbmc xbmc +xbmc/addons addons +xbmc/commons commons +xbmc/cdrip cdrip +xbmc/dbwrappers dbwrappers +xbmc/dialogs dialogs +xbmc/epg epg +xbmc/guilib guilib +xbmc/input input +xbmc/listproviders listproviders +xbmc/media media +xbmc/messaging messaging +xbmc/messaging/helpers messagingHelpers +xbmc/pictures pictures +xbmc/platform platform +xbmc/playlists playlists +xbmc/powermanagement powermanagement +xbmc/programs programs +xbmc/rendering rendering +xbmc/storage storage +xbmc/threads threads +xbmc/utils utils +xbmc/view view +xbmc/windowing windowing +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 @@ +xbmc/test test +xbmc/addons/test test/addons +xbmc/filesystem/test test/filesystem +xbmc/interfaces/python/test test/python +xbmc/music/tags/test test/music_tags +xbmc/network/test test/network +xbmc/threads/test test/threads +xbmc/utils/test test/utils +xbmc/video/test test/video +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 @@ +xbmc/video video +xbmc/video/dialogs video/dialogs +xbmc/video/jobs video/jobs +xbmc/video/videosync video/sync +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 @@ +xbmc/cores/VideoPlayer cores/VideoPlayer +xbmc/cores/VideoPlayer/DVDCodecs cores/VideoPlayer/codecs +xbmc/cores/VideoPlayer/DVDCodecs/Audio cores/VideoPlayer/codecs/audio +xbmc/cores/VideoPlayer/DVDCodecs/Overlay cores/VideoPlayer/codecs/overlay +xbmc/cores/VideoPlayer/DVDCodecs/Video cores/VideoPlayer/codecs/video +xbmc/cores/VideoPlayer/DVDDemuxers cores/VideoPlayer/demuxers +xbmc/cores/VideoPlayer/DVDInputStreams cores/VideoPlayer/inputstreams +xbmc/cores/VideoPlayer/DVDSubtitles cores/VideoPlayer/subtitles +xbmc/cores/VideoPlayer/Process cores/VideoPlayer/process +xbmc/cores/VideoPlayer/VideoRenderers cores/VideoPlayer/videorenderers +xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders cores/VideoPlayer/videorenderers/shaders +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 @@ +xbmc/linux linuxsupport +xbmc/network/linux network/linux +xbmc/network/osx network/osx +xbmc/peripherals/bus/osx peripherals/bus/osx +xbmc/powermanagement/osx powermanagement/osx +xbmc/storage/osx storage/osx +xbmc/platform/posix posix +xbmc/platform/darwin platform_darwin +xbmc/platform/darwin/osx platform_osx +xbmc/filesystem/posix filesystem/posix +xbmc/utils/posix utils_posix +xbmc/windowing/osx windowing/osx 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 @@ +xbmc/linux linuxsupport +xbmc/input/linux input/linux +xbmc/network/linux network/linux +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 @@ +xbmc/linux linuxsupport +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic +xbmc/network/linux network/linux +xbmc/network/osx network/osx +xbmc/peripherals/bus/osx peripherals/bus/osx +xbmc/powermanagement/osx powermanagement/osx +xbmc/storage/osx storage/osx +xbmc/platform/posix posix +xbmc/platform/darwin platform_darwin +xbmc/platform/darwin/ios platform_ios +xbmc/platform/darwin/ios-common platform_ios-common +xbmc/filesystem/posix filesystem/posix +xbmc/utils/posix utils_posix +xbmc/windowing/osx windowing/osx 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 @@ +xbmc/linux linuxsupport +xbmc/linux/sse4 sse4 +xbmc/input/linux input/linux +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic +xbmc/network/linux network/linux +xbmc/peripherals/bus/linux peripherals/bus/linux +xbmc/powermanagement/linux powermanagement/linux +xbmc/storage/linux storage/linux +xbmc/filesystem/posix filesystem/posix +xbmc/utils/posix utils_posix +xbmc/platform/posix posix 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 @@ +xbmc/linux linuxsupport +xbmc/input/linux input/linux +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic +xbmc/network/linux network/linux +xbmc/peripherals/bus/linux peripherals/bus/linux +xbmc/powermanagement/linux powermanagement/linux +xbmc/storage/linux storage/linux +xbmc/filesystem/posix filesystem/posix +xbmc/utils/posix utils_posix +xbmc/platform/posix posix +xbmc/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 @@ +xbmc/win32 win32support +xbmc/input/windows input/windows +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic +xbmc/network/windows network/windows +xbmc/network/mdns network/mdns +xbmc/peripherals/bus/win32 peripherals/bus/win32 +xbmc/powermanagement/windows powermanagement/windows +xbmc/storage/windows storage/windows +xbmc/filesystem/win32 filesystem/win32 +xbmc/utils/win32 utils_win32 +xbmc/platform/win32 platform_win32 +xbmc/rendering/dx rendering_dx +xbmc/threads/platform/win threads_win +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 git add $d done -branch=$(git rev-parse --abbrev-ref HEAD) -echo -n "pvr.dvbviewer https://github.com/manuelm/pvr.dvbviewer $branch" > project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt -git add project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt +#branch=$(git rev-parse --abbrev-ref HEAD) +#echo -n "pvr.dvbviewer https://github.com/manuelm/pvr.dvbviewer $branch" > project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt +#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 @@ APP_NAME Kodi COMPANY_NAME XBMC-Foundation WEBSITE http://kodi.tv -VERSION_MAJOR 15 +VERSION_MAJOR 17 VERSION_MINOR 0 -VERSION_TAG BETA1 -VERSION_CODE 149801 -ADDON_API 14.9.801 +VERSION_TAG ALPHA1 +VERSION_CODE 169701 +ADDON_API 16.9.701 # Notes: -# Change AC_INIT in configure.in +# 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 @@ -BINDINGS =xbmc/addons/include/xbmc_addon_cpp_dll.h -BINDINGS+=xbmc/addons/include/xbmc_addon_dll.h -BINDINGS+=xbmc/addons/include/xbmc_addon_types.h -BINDINGS+=xbmc/addons/include/xbmc_audioenc_dll.h -BINDINGS+=xbmc/addons/include/xbmc_audioenc_types.h -BINDINGS+=xbmc/addons/include/kodi_audiodec_dll.h -BINDINGS+=xbmc/addons/include/kodi_audiodec_types.h -BINDINGS+=xbmc/addons/include/xbmc_codec_types.h -BINDINGS+=xbmc/addons/include/xbmc_epg_types.h -BINDINGS+=xbmc/addons/include/xbmc_pvr_dll.h -BINDINGS+=xbmc/addons/include/xbmc_pvr_types.h -BINDINGS+=xbmc/addons/include/xbmc_scr_dll.h -BINDINGS+=xbmc/addons/include/xbmc_scr_types.h -BINDINGS+=xbmc/addons/include/xbmc_vis_dll.h -BINDINGS+=xbmc/addons/include/xbmc_vis_types.h -BINDINGS+=xbmc/addons/include/xbmc_stream_utils.hpp -BINDINGS+=addons/library.xbmc.addon/libXBMC_addon.h -BINDINGS+=addons/library.kodi.guilib/libKODI_guilib.h -BINDINGS+=addons/library.xbmc.pvr/libXBMC_pvr.h -BINDINGS+=addons/library.xbmc.codec/libXBMC_codec.h -BINDINGS+=xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPacket.h +BINDINGS =xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h +BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h +BINDINGS+=xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h BINDINGS+=xbmc/cores/AudioEngine/Utils/AEChannelData.h +BINDINGS+=xbmc/filesystem/IFileTypes.h diff --git a/xbmc/addons/include/kodi_audiodec_dll.h b/xbmc/addons/include/kodi_audiodec_dll.h deleted file mode 100644 index 78bc3cc..0000000 --- a/xbmc/addons/include/kodi_audiodec_dll.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#pragma once - -#include -#include "xbmc_addon_dll.h" -#include "kodi_audiodec_types.h" - -extern "C" -{ - //! \copydoc AudioDecoder::Init - void* Init(const char* file, unsigned int filecache, int* channels, - int* samplerate, int* bitspersample, int64_t* totaltime, - int* bitrate, AEDataFormat* format, const AEChannel** channelinfo); - - //! \copydoc AudioDecoder::ReadPCM - int ReadPCM(void* context, uint8_t* buffer, int size, int* actualsize); - - //! \copydoc AudioDecoder::Seek - int64_t Seek(void* context, int64_t time); - - //! \copydoc AudioDecoder::ReadTag - bool ReadTag(const char* file, char* title, - char* artist, int* length); - - //! \copydoc AudioDecoder::TrackCount - int TrackCount(const char* file); - - //! \copydoc AudioDecoder::DeInit - bool DeInit(void* context); - - // function to export the above structure to XBMC - void __declspec(dllexport) get_addon(struct AudioDecoder* pScr) - { - pScr->Init = Init; - pScr->ReadPCM = ReadPCM; - pScr->Seek = Seek; - pScr->ReadTag = ReadTag; - pScr->TrackCount = TrackCount; - pScr->DeInit = DeInit; - }; -}; diff --git a/xbmc/addons/include/kodi_audiodec_types.h b/xbmc/addons/include/kodi_audiodec_types.h deleted file mode 100644 index 50c4cc4..0000000 --- a/xbmc/addons/include/kodi_audiodec_types.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#pragma once - -#include -#ifdef BUILD_KODI_ADDON -#include "kodi/AEChannelData.h" -#else -#include "cores/AudioEngine/Utils/AEChannelData.h" -#endif - -extern "C" -{ - struct AUDIODEC_INFO - { - int dummy; - }; - - struct AUDIODEC_PROPS - { - int dummy; - }; - - struct AudioDecoder - { - //! \brief Initialize a decoder - //! \param file The file to read - //! \param filecache The file cache size - //! \param channels Number of channels in output stream - //! \param samplerate Samplerate of output stream - //! \param bitspersample Bits per sample in output stream - //! \param totaltime Total time for stream - //! \param bitrate Average bitrate of input stream - //! \param format Data format for output stream - //! \param info Channel mapping for output stream - //! \return Context of output stream - //! \sa ICodec::Init - void* (__cdecl* Init) (const char* file, unsigned int filecache, - int* channels, int* samplerate, - int* bitspersample, int64_t* totaltime, - int* bitrate, AEDataFormat* format, - const AEChannel** info); - - //! \brief Produce some noise - //! \param context Context of output stream - //! \param buffer Output buffer - //! \param size Size of output buffer - //! \param actualsize Actual number of bytes written to output buffer - //! \return 0 on success, -1 on end of stream, 1 on failure - //! \sa ICodec::ReadPCM - int (__cdecl* ReadPCM) (void* context, uint8_t* buffer, int size, int* actualsize); - - - //! \brief Seek in output stream - //! \param context Context of output stream - //! \param time Time position to seek to in milliseconds - //! \return Time position seek ended up on - //! \sa ICodec::Seek - int64_t (__cdecl* Seek) (void* context, int64_t time); - - //! \brief Read tag of a file - //! \param file File to read tag for - //! \param title Title of file - //! \param artist Artist of file - //! \param length Length of file - //! \return True on success, false on failure - //! \sa IMusicInfoTagLoader::ReadTag - bool (__cdecl* ReadTag)(const char* file, char* title, - char* artist, int* length); - - //! \brief Get number of tracks in a file - //! \param file File to read tag for - //! \return Number of tracks in file - //! \sa CMusicFileDirectory - int (__cdecl* TrackCount) (const char* file); - - //! \brief Close down an output stream - //! \param context Context of stream - //! \return True on success, false on failure - //! \sa ICodec::DeInit - bool (__cdecl* DeInit)(void* context); - }; -} diff --git a/xbmc/addons/include/xbmc_addon_cpp_dll.h b/xbmc/addons/include/xbmc_addon_cpp_dll.h deleted file mode 100644 index 3944525..0000000 --- a/xbmc/addons/include/xbmc_addon_cpp_dll.h +++ /dev/null @@ -1,191 +0,0 @@ -#ifndef __XBMC_ADDON_CPP_H__ -#define __XBMC_ADDON_CPP_H__ - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#include "xbmc_addon_types.h" - -#include -#include -#include - -class DllSetting -{ -public: - enum SETTING_TYPE { NONE=0, CHECK, SPIN }; - - DllSetting(SETTING_TYPE t, const char *n, const char *l) - { - id = NULL; - label = NULL; - if (n) - { - id = new char[strlen(n)+1]; - strcpy(id, n); - } - if (l) - { - label = new char[strlen(l)+1]; - strcpy(label, l); - } - current = 0; - type = t; - } - - DllSetting(const DllSetting &rhs) // copy constructor - { - id = NULL; - label = NULL; - if (rhs.id) - { - id = new char[strlen(rhs.id)+1]; - strcpy(id, rhs.id); - } - if (rhs.label) - { - label = new char[strlen(rhs.label)+1]; - strcpy(label, rhs.label); - } - current = rhs.current; - type = rhs.type; - for (unsigned int i = 0; i < rhs.entry.size(); i++) - { - char *lab = new char[strlen(rhs.entry[i]) + 1]; - strcpy(lab, rhs.entry[i]); - entry.push_back(lab); - } - } - - ~DllSetting() - { - delete[] id; - delete[] label; - for (unsigned int i=0; i < entry.size(); i++) - delete[] entry[i]; - } - - void AddEntry(const char *label) - { - if (!label || type != SPIN) return; - char *lab = new char[strlen(label) + 1]; - strcpy(lab, label); - entry.push_back(lab); - } - - // data members - SETTING_TYPE type; - char* id; - char* label; - int current; - std::vector entry; -}; - -class DllUtils -{ -public: - - static unsigned int VecToStruct(std::vector &vecSet, ADDON_StructSetting*** sSet) - { - *sSet = NULL; - if(vecSet.size() == 0) - return 0; - - unsigned int uiElements=0; - - *sSet = (ADDON_StructSetting**)malloc(vecSet.size()*sizeof(ADDON_StructSetting*)); - for(unsigned int i=0;iid = NULL; - (*sSet)[i]->label = NULL; - uiElements++; - - if (vecSet[i].id && vecSet[i].label) - { - (*sSet)[i]->id = strdup(vecSet[i].id); - (*sSet)[i]->label = strdup(vecSet[i].label); - (*sSet)[i]->type = vecSet[i].type; - (*sSet)[i]->current = vecSet[i].current; - (*sSet)[i]->entry_elements = 0; - (*sSet)[i]->entry = NULL; - if(vecSet[i].type == DllSetting::SPIN && vecSet[i].entry.size() > 0) - { - (*sSet)[i]->entry = (char**)malloc(vecSet[i].entry.size()*sizeof(char**)); - for(unsigned int j=0;j 0) - { - (*sSet)[i]->entry[j] = strdup(vecSet[i].entry[j]); - (*sSet)[i]->entry_elements++; - } - } - } - } - } - return uiElements; - } - - static void StructToVec(unsigned int iElements, ADDON_StructSetting*** sSet, std::vector *vecSet) - { - if(iElements == 0) - return; - - vecSet->clear(); - for(unsigned int i=0;itype, (*sSet)[i]->id, (*sSet)[i]->label); - if((*sSet)[i]->type == DllSetting::SPIN) - { - for(unsigned int j=0;j<(*sSet)[i]->entry_elements;j++) - { - vSet.AddEntry((*sSet)[i]->entry[j]); - } - } - vSet.current = (*sSet)[i]->current; - vecSet->push_back(vSet); - } - } - - static void FreeStruct(unsigned int iElements, ADDON_StructSetting*** sSet) - { - if(iElements == 0) - return; - - for(unsigned int i=0;itype == DllSetting::SPIN) - { - for(unsigned int j=0;j<(*sSet)[i]->entry_elements;j++) - { - free((*sSet)[i]->entry[j]); - } - free((*sSet)[i]->entry); - } - free((*sSet)[i]->id); - free((*sSet)[i]->label); - free((*sSet)[i]); - } - free(*sSet); - } -}; - -#endif diff --git a/xbmc/addons/include/xbmc_addon_dll.h b/xbmc/addons/include/xbmc_addon_dll.h deleted file mode 100644 index fa6415f..0000000 --- a/xbmc/addons/include/xbmc_addon_dll.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __XBMC_ADDON_DLL_H__ -#define __XBMC_ADDON_DLL_H__ - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#ifdef TARGET_WINDOWS -#include -#else -#ifndef __cdecl -#define __cdecl -#endif -#ifndef __declspec -#define __declspec(X) -#endif -#endif - -#include "xbmc_addon_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - - ADDON_STATUS __declspec(dllexport) ADDON_Create(void *callbacks, void* props); - void __declspec(dllexport) ADDON_Stop(); - void __declspec(dllexport) ADDON_Destroy(); - ADDON_STATUS __declspec(dllexport) ADDON_GetStatus(); - bool __declspec(dllexport) ADDON_HasSettings(); - unsigned int __declspec(dllexport) ADDON_GetSettings(ADDON_StructSetting ***sSet); - ADDON_STATUS __declspec(dllexport) ADDON_SetSetting(const char *settingName, const void *settingValue); - void __declspec(dllexport) ADDON_FreeSettings(); - void __declspec(dllexport) ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data); - -#ifdef __cplusplus -}; -#endif - -#endif diff --git a/xbmc/addons/include/xbmc_addon_types.h b/xbmc/addons/include/xbmc_addon_types.h deleted file mode 100644 index bd6cbe8..0000000 --- a/xbmc/addons/include/xbmc_addon_types.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef __XBMC_ADDON_TYPES_H__ -#define __XBMC_ADDON_TYPES_H__ - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#ifdef __cplusplus -extern "C" { -#endif - -enum ADDON_STATUS -{ - ADDON_STATUS_OK, - ADDON_STATUS_LOST_CONNECTION, - ADDON_STATUS_NEED_RESTART, - ADDON_STATUS_NEED_SETTINGS, - ADDON_STATUS_UNKNOWN, - ADDON_STATUS_NEED_SAVEDSETTINGS, - ADDON_STATUS_PERMANENT_FAILURE /**< permanent failure, like failing to resolve methods */ -}; - -typedef struct -{ - int type; - char* id; - char* label; - int current; - char** entry; - unsigned int entry_elements; -} ADDON_StructSetting; - -/*! - * @brief Handle used to return data from the PVR add-on to CPVRClient - */ -struct ADDON_HANDLE_STRUCT -{ - void *callerAddress; /*!< address of the caller */ - void *dataAddress; /*!< address to store data in */ - int dataIdentifier; /*!< parameter to pass back when calling the callback */ -}; -typedef ADDON_HANDLE_STRUCT *ADDON_HANDLE; - -#ifdef __cplusplus -}; -#endif - -#endif diff --git a/xbmc/addons/include/xbmc_audioenc_dll.h b/xbmc/addons/include/xbmc_audioenc_dll.h deleted file mode 100644 index 01e8d12..0000000 --- a/xbmc/addons/include/xbmc_audioenc_dll.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#ifndef __XBMC_AUDIOENC_H__ -#define __XBMC_AUDIOENC_H__ - -#include -#include "xbmc_addon_dll.h" -#include "xbmc_audioenc_types.h" - -extern "C" -{ - //! \copydoc AudioEncoder::Create - void* Create(audioenc_callbacks *callbacks); - - //! \copydoc AudioEncoder::Start - bool Start(void* context, int iInChannels, int iInRate, int iInBits, - const char* title, const char* artist, - const char* albumartist, const char* album, - const char* year, const char* track, - const char* genre, const char* comment, int iTrackLength); - - //! \copydoc AudioEncoder::Encode - int Encode(void* context, int nNumBytesRead, uint8_t* pbtStream); - - //! \copydoc AudioEncoder::Finish - bool Finish(void* context); - - //! \copydoc AudioEncoder::Free - void Free(void* context); - - // function to export the above structure to XBMC - void __declspec(dllexport) get_addon(struct AudioEncoder* pScr) - { - pScr->Create = Create; - pScr->Start = Start; - pScr->Encode = Encode; - pScr->Finish = Finish; - pScr->Free = Free; - }; -}; - -#endif diff --git a/xbmc/addons/include/xbmc_audioenc_types.h b/xbmc/addons/include/xbmc_audioenc_types.h deleted file mode 100644 index aa527db..0000000 --- a/xbmc/addons/include/xbmc_audioenc_types.h +++ /dev/null @@ -1,113 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#ifndef __AUDIOENC_TYPES_H__ -#define __AUDIOENC_TYPES_H__ - -#ifdef TARGET_WINDOWS -#include -#else -#ifndef __cdecl -#define __cdecl -#endif -#ifndef __declspec -#define __declspec(X) -#endif -#endif - -#include - -extern "C" -{ - struct AUDIOENC_INFO - { - int dummy; - }; - - struct AUDIOENC_PROPS - { - int dummy; - }; - - typedef int (*audioenc_write_callback)(void* opaque, uint8_t* data, int len); - typedef int64_t (*audioenc_seek_callback)(void* opaque, int64_t pos, int whence); - - typedef struct - { - void* opaque; - audioenc_write_callback write; - audioenc_seek_callback seek; - } audioenc_callbacks; - - struct AudioEncoder - { - /*! \brief Create encoder context - \param callbacks Pointer to audioenc_callbacks structure. - \return opaque pointer to encoder context, to be passed to other methods. - \sa IEncoder::Init - */ - void (*(__cdecl *Create) (audioenc_callbacks* callbacks)); - - /*! \brief Start encoder - \param context Encoder context from Create. - \param iInChannels Number of channels - \param iInRate Sample rate of input data - \param iInBits Bits per sample in input data - \param title The title of the song - \param artist The artist of the song - \param albumartist The albumartist of the song - \param year The year of the song - \param track The track number of the song - \param genre The genre of the song - \param comment A comment to attach to the song - \param iTrackLength Total track length in seconds - \sa IEncoder::Init - */ - bool (__cdecl* Start) (void* context, int iInChannels, int iInRate, int iInBits, - const char* title, const char* artist, - const char* albumartist, const char* album, - const char* year, const char* track, - const char* genre, const char* comment, - int iTrackLength); - - /*! \brief Encode a chunk of audio - \param context Encoder context from Create. - \param nNumBytesRead Number of bytes in input buffer - \param pbtStream the input buffer - \return Number of bytes consumed - \sa IEncoder::Encode - */ - int (__cdecl* Encode) (void* context, int nNumBytesRead, uint8_t* pbtStream); - - /*! \brief Finalize encoding - \param context Encoder context from Create. - \return True on success, false on failure. - */ - bool (__cdecl* Finish) (void* context); - - /*! \brief Free encoder context - \param context Encoder context to free. - */ - void (__cdecl* Free)(void* context); - }; -} - -#endif diff --git a/xbmc/addons/include/xbmc_codec_types.h b/xbmc/addons/include/xbmc_codec_types.h deleted file mode 100644 index 98003e0..0000000 --- a/xbmc/addons/include/xbmc_codec_types.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __XBMC_CODEC_TYPES_H__ -#define __XBMC_CODEC_TYPES_H__ - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef unsigned int xbmc_codec_id_t; - -typedef enum -{ - XBMC_CODEC_TYPE_UNKNOWN = -1, - XBMC_CODEC_TYPE_VIDEO, - XBMC_CODEC_TYPE_AUDIO, - XBMC_CODEC_TYPE_DATA, - XBMC_CODEC_TYPE_SUBTITLE, - XBMC_CODEC_TYPE_RDS, - XBMC_CODEC_TYPE_NB -} xbmc_codec_type_t; - -typedef struct -{ - xbmc_codec_type_t codec_type; - xbmc_codec_id_t codec_id; -} xbmc_codec_t; - -#define XBMC_INVALID_CODEC_ID 0 -#define XBMC_INVALID_CODEC { XBMC_CODEC_TYPE_UNKNOWN, XBMC_INVALID_CODEC_ID } - -#ifdef __cplusplus -}; -#endif - -#endif - diff --git a/xbmc/addons/include/xbmc_epg_types.h b/xbmc/addons/include/xbmc_epg_types.h deleted file mode 100644 index efd7d13..0000000 --- a/xbmc/addons/include/xbmc_epg_types.h +++ /dev/null @@ -1,101 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#include -#include - -#undef ATTRIBUTE_PACKED -#undef PRAGMA_PACK_BEGIN -#undef PRAGMA_PACK_END - -#if defined(__GNUC__) -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -#define ATTRIBUTE_PACKED __attribute__ ((packed)) -#define PRAGMA_PACK 0 -#endif -#endif - -#if !defined(ATTRIBUTE_PACKED) -#define ATTRIBUTE_PACKED -#define PRAGMA_PACK 1 -#endif - -/*! @name EPG entry content event types */ -//@{ -/* These IDs come from the DVB-SI EIT table "content descriptor" - * Also known under the name "E-book genre assignments" - */ -#define EPG_EVENT_CONTENTMASK_UNDEFINED 0x00 -#define EPG_EVENT_CONTENTMASK_MOVIEDRAMA 0x10 -#define EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS 0x20 -#define EPG_EVENT_CONTENTMASK_SHOW 0x30 -#define EPG_EVENT_CONTENTMASK_SPORTS 0x40 -#define EPG_EVENT_CONTENTMASK_CHILDRENYOUTH 0x50 -#define EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE 0x60 -#define EPG_EVENT_CONTENTMASK_ARTSCULTURE 0x70 -#define EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS 0x80 -#define EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE 0x90 -#define EPG_EVENT_CONTENTMASK_LEISUREHOBBIES 0xA0 -#define EPG_EVENT_CONTENTMASK_SPECIAL 0xB0 -#define EPG_EVENT_CONTENTMASK_USERDEFINED 0xF0 -//@} - -/* Set EPGTAG.iGenreType to EPG_GENRE_USE_STRING to transfer genre strings to XBMC */ -#define EPG_GENRE_USE_STRING 0x100 - -#ifdef __cplusplus -extern "C" { -#endif - - /*! - * @brief Representation of an EPG event. - */ - typedef struct EPG_TAG { - unsigned int iUniqueBroadcastId; /*!< @brief (required) identifier for this event */ - const char * strTitle; /*!< @brief (required) this event's title */ - unsigned int iChannelNumber; /*!< @brief (required) the number of the channel this event occurs on */ - time_t startTime; /*!< @brief (required) start time in UTC */ - time_t endTime; /*!< @brief (required) end time in UTC */ - const char * strPlotOutline; /*!< @brief (optional) plot outline */ - const char * strPlot; /*!< @brief (optional) plot */ - const char * strOriginalTitle; /*!< @brief (optional) originaltitle */ - const char * strCast; /*!< @brief (optional) cast */ - const char * strDirector; /*!< @brief (optional) director */ - const char * strWriter; /*!< @brief (optional) writer */ - int iYear; /*!< @brief (optional) year */ - const char * strIMDBNumber; /*!< @brief (optional) IMDBNumber */ - const char * strIconPath; /*!< @brief (optional) icon path */ - int iGenreType; /*!< @brief (optional) genre type */ - int iGenreSubType; /*!< @brief (optional) genre sub type */ - const char * strGenreDescription; /*!< @brief (optional) genre. Will be used only when iGenreType = EPG_GENRE_USE_STRING */ - time_t firstAired; /*!< @brief (optional) first aired in UTC */ - int iParentalRating; /*!< @brief (optional) parental rating */ - int iStarRating; /*!< @brief (optional) star rating */ - bool bNotify; /*!< @brief (optional) notify the user when this event starts */ - int iSeriesNumber; /*!< @brief (optional) series number */ - int iEpisodeNumber; /*!< @brief (optional) episode number */ - int iEpisodePartNumber; /*!< @brief (optional) episode part number */ - const char * strEpisodeName; /*!< @brief (optional) episode name */ - } ATTRIBUTE_PACKED EPG_TAG; - -#ifdef __cplusplus -} -#endif diff --git a/xbmc/addons/include/xbmc_pvr_dll.h b/xbmc/addons/include/xbmc_pvr_dll.h deleted file mode 100644 index 5280399..0000000 --- a/xbmc/addons/include/xbmc_pvr_dll.h +++ /dev/null @@ -1,710 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#ifndef __XBMC_PVR_H__ -#define __XBMC_PVR_H__ - -#include "xbmc_addon_dll.h" -#include "xbmc_pvr_types.h" - -/*! - * Functions that the PVR client add-on must implement, but some can be empty. - * - * The 'remarks' field indicates which methods should be implemented, and which ones are optional. - */ - -extern "C" -{ - /*! @name PVR add-on methods */ - //@{ - /*! - * Get the XBMC_PVR_API_VERSION that was used to compile this add-on. - * Used to check if this add-on is compatible with XBMC. - * @return The XBMC_PVR_API_VERSION that was used to compile this add-on. - * @remarks Valid implementation required. - */ - const char* GetPVRAPIVersion(void); - - /*! - * Get the XBMC_PVR_MIN_API_VERSION that was used to compile this add-on. - * Used to check if this add-on is compatible with XBMC. - * @return The XBMC_PVR_MIN_API_VERSION that was used to compile this add-on. - * @remarks Valid implementation required. - */ - const char* GetMininumPVRAPIVersion(void); - - /*! - * Get the XBMC_GUI_API_VERSION that was used to compile this add-on. - * Used to check if this add-on is compatible with XBMC. - * @return The XBMC_GUI_API_VERSION that was used to compile this add-on. - * @remarks Valid implementation required. - */ - const char* GetGUIAPIVersion(void); - - /*! - * Get the XBMC_GUI_MIN_API_VERSION that was used to compile this add-on. - * Used to check if this add-on is compatible with XBMC. - * @return The XBMC_GUI_MIN_API_VERSION that was used to compile this add-on. - * @remarks Valid implementation required. - */ - const char* GetMininumGUIAPIVersion(void); - - /*! - * Get the list of features that this add-on provides. - * Called by XBMC to query the add-on's capabilities. - * Used to check which options should be presented in the UI, which methods to call, etc. - * All capabilities that the add-on supports should be set to true. - * @param pCapabilities The add-on's capabilities. - * @return PVR_ERROR_NO_ERROR if the properties were fetched successfully. - * @remarks Valid implementation required. - */ - PVR_ERROR GetAddonCapabilities(PVR_ADDON_CAPABILITIES *pCapabilities); - - /*! - * @return The name reported by the backend that will be displayed in the UI. - * @remarks Valid implementation required. - */ - const char* GetBackendName(void); - - /*! - * @return The version string reported by the backend that will be displayed in the UI. - * @remarks Valid implementation required. - */ - const char* GetBackendVersion(void); - - /*! - * @return The connection string reported by the backend that will be displayed in the UI. - * @remarks Valid implementation required. - */ - const char* GetConnectionString(void); - - /*! - * Get the disk space reported by the backend (if supported). - * @param iTotal The total disk space in bytes. - * @param iUsed The used disk space in bytes. - * @return PVR_ERROR_NO_ERROR if the drive space has been fetched successfully. - * @remarks Optional. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR GetDriveSpace(long long* iTotal, long long* iUsed); - - /*! - * Call one of the menu hooks (if supported). - * Supported PVR_MENUHOOK instances have to be added in ADDON_Create(), by calling AddMenuHook() on the callback. - * @param menuhook The hook to call. - * @param item The selected item for which the hook was called. - * @return PVR_ERROR_NO_ERROR if the hook was called successfully. - * @remarks Optional. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR CallMenuHook(const PVR_MENUHOOK& menuhook, const PVR_MENUHOOK_DATA &item); - //@} - - /*! @name PVR EPG methods - * @remarks Only used by XBMC if bSupportsEPG is set to true. - */ - //@{ - /*! - * Request the EPG for a channel from the backend. - * EPG entries are added to XBMC by calling TransferEpgEntry() on the callback. - * @param handle Handle to pass to the callback method. - * @param channel The channel to get the EPG table for. - * @param iStart Get events after this time (UTC). - * @param iEnd Get events before this time (UTC). - * @return PVR_ERROR_NO_ERROR if the table has been fetched successfully. - * @remarks Required if bSupportsEPG is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR GetEPGForChannel(ADDON_HANDLE handle, const PVR_CHANNEL& channel, time_t iStart, time_t iEnd); - //@} - - /*! @name PVR channel group methods - * @remarks Only used by XBMC is bSupportsChannelGroups is set to true. - * If a group or one of the group members changes after the initial import, or if a new one was added, then the add-on - * should call TriggerChannelGroupsUpdate() - */ - //@{ - /*! - * Get the total amount of channel groups on the backend if it supports channel groups. - * @return The amount of channels, or -1 on error. - * @remarks Required if bSupportsChannelGroups is set to true. Return -1 if this add-on won't provide this function. - */ - int GetChannelGroupsAmount(void); - - /*! - * Request the list of all channel groups from the backend if it supports channel groups. - * Channel group entries are added to XBMC by calling TransferChannelGroup() on the callback. - * @param handle Handle to pass to the callback method. - * @param bRadio True to get the radio channel groups, false to get the TV channel groups. - * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. - * @remarks Required if bSupportsChannelGroups is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR GetChannelGroups(ADDON_HANDLE handle, bool bRadio); - - /*! - * Request the list of all group members of a group from the backend if it supports channel groups. - * Member entries are added to XBMC by calling TransferChannelGroupMember() on the callback. - * @param handle Handle to pass to the callback method. - * @param group The group to get the members for. - * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. - * @remarks Required if bSupportsChannelGroups is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR GetChannelGroupMembers(ADDON_HANDLE handle, const PVR_CHANNEL_GROUP& group); - //@} - - /** @name PVR channel methods - * @remarks Either bSupportsTV or bSupportsRadio is required to be set to true. - * If a channel changes after the initial import, or if a new one was added, then the add-on - * should call TriggerChannelUpdate() - */ - //@{ - /*! - * Show the channel scan dialog if this backend supports it. - * @return PVR_ERROR_NO_ERROR if the dialog was displayed successfully. - * @remarks Required if bSupportsChannelScan is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - * @note see libKODI_guilib.h about related parts - */ - PVR_ERROR OpenDialogChannelScan(void); - - /*! - * @return The total amount of channels on the backend, or -1 on error. - * @remarks Valid implementation required. - */ - int GetChannelsAmount(void); - - /*! - * Request the list of all channels from the backend. - * Channel entries are added to XBMC by calling TransferChannelEntry() on the callback. - * @param handle Handle to pass to the callback method. - * @param bRadio True to get the radio channels, false to get the TV channels. - * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. - * @remarks If bSupportsTV is set to true, a valid result set needs to be provided for bRadio = false. - * If bSupportsRadio is set to true, a valid result set needs to be provided for bRadio = true. - * At least one of these two must provide a valid result set. - */ - PVR_ERROR GetChannels(ADDON_HANDLE handle, bool bRadio); - - /*! - * Delete a channel from the backend. - * @param channel The channel to delete. - * @return PVR_ERROR_NO_ERROR if the channel has been deleted successfully. - * @remarks Required if bSupportsChannelSettings is set to true. - */ - PVR_ERROR DeleteChannel(const PVR_CHANNEL& channel); - - /*! - * Rename a channel on the backend. - * @param channel The channel to rename, containing the new channel name. - * @return PVR_ERROR_NO_ERROR if the channel has been renamed successfully. - * @remarks Optional, and only used if bSupportsChannelSettings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR RenameChannel(const PVR_CHANNEL& channel); - - /*! - * Move a channel to another channel number on the backend. - * @param channel The channel to move, containing the new channel number. - * @return PVR_ERROR_NO_ERROR if the channel has been moved successfully. - * @remarks Optional, and only used if bSupportsChannelSettings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR MoveChannel(const PVR_CHANNEL& channel); - - /*! - * Show the channel settings dialog, if supported by the backend. - * @param channel The channel to show the dialog for. - * @return PVR_ERROR_NO_ERROR if the dialog has been displayed successfully. - * @remarks Required if bSupportsChannelSettings is set to true. - * @note see libKODI_guilib.h about related parts - */ - PVR_ERROR OpenDialogChannelSettings(const PVR_CHANNEL& channel); - - /*! - * Show the dialog to add a channel on the backend, if supported by the backend. - * @param channel The channel to add. - * @return PVR_ERROR_NO_ERROR if the channel has been added successfully. - * @remarks Required if bSupportsChannelSettings is set to true. - * @note see libKODI_guilib.h about related parts - */ - PVR_ERROR OpenDialogChannelAdd(const PVR_CHANNEL& channel); - //@} - - /** @name PVR recording methods - * @remarks Only used by XBMC is bSupportsRecordings is set to true. - * If a recording changes after the initial import, or if a new one was added, - * then the add-on should call TriggerRecordingUpdate() - */ - //@{ - /*! - * @return The total amount of recordings on the backend or -1 on error. - * @param deleted if set return deleted recording (called if bSupportsRecordingsUndelete set to true) - * @remarks Required if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - int GetRecordingsAmount(bool deleted); - - /*! - * Request the list of all recordings from the backend, if supported. - * Recording entries are added to XBMC by calling TransferRecordingEntry() on the callback. - * @param handle Handle to pass to the callback method. - * @param deleted if set return deleted recording (called if bSupportsRecordingsUndelete set to true) - * @return PVR_ERROR_NO_ERROR if the recordings have been fetched successfully. - * @remarks Required if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR GetRecordings(ADDON_HANDLE handle, bool deleted); - - /*! - * Delete a recording on the backend. - * @param recording The recording to delete. - * @return PVR_ERROR_NO_ERROR if the recording has been deleted successfully. - * @remarks Optional, and only used if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR DeleteRecording(const PVR_RECORDING& recording); - - /*! - * Undelete a recording on the backend. - * @param recording The recording to undelete. - * @return PVR_ERROR_NO_ERROR if the recording has been undeleted successfully. - * @remarks Optional, and only used if bSupportsRecordingsUndelete is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR UndeleteRecording(const PVR_RECORDING& recording); - - /*! - * @brief Delete all recordings permanent which in the deleted folder on the backend. - * @return PVR_ERROR_NO_ERROR if the recordings has been deleted successfully. - */ - PVR_ERROR DeleteAllRecordingsFromTrash(); - - /*! - * Rename a recording on the backend. - * @param recording The recording to rename, containing the new name. - * @return PVR_ERROR_NO_ERROR if the recording has been renamed successfully. - * @remarks Optional, and only used if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR RenameRecording(const PVR_RECORDING& recording); - - /*! - * Set the play count of a recording on the backend. - * @param recording The recording to change the play count. - * @param count Play count. - * @return PVR_ERROR_NO_ERROR if the recording's play count has been set successfully. - * @remarks Required if bSupportsRecordingPlayCount is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING& recording, int count); - - /*! - * Set the last watched position of a recording on the backend. - * @param recording The recording. - * @param position The last watched position in seconds - * @return PVR_ERROR_NO_ERROR if the position has been stored successfully. - * @remarks Required if bSupportsLastPlayedPosition is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING& recording, int lastplayedposition); - - /*! - * Retrieve the last watched position of a recording on the backend. - * @param recording The recording. - * @return The last watched position in seconds or -1 on error - * @remarks Required if bSupportsRecordingPlayCount is set to true. Return -1 if this add-on won't provide this function. - */ - int GetRecordingLastPlayedPosition(const PVR_RECORDING& recording); - - /*! - * Retrieve the edit decision list (EDL) of a recording on the backend. - * @param recording The recording. - * @param edl out: The function has to write the EDL list into this array. - * @param size in: The maximum size of the EDL, out: the actual size of the EDL. - * @return PVR_ERROR_NO_ERROR if the EDL was successfully read. - * @remarks Required if bSupportsRecordingEdl is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY edl[], int *size); - - //@} - /** @name PVR timer methods - * @remarks Only used by XBMC is bSupportsTimers is set to true. - * If a timer changes after the initial import, or if a new one was added, - * then the add-on should call TriggerTimerUpdate() - */ - //@{ - /*! - * @return The total amount of timers on the backend or -1 on error. - * @remarks Required if bSupportsTimers is set to true. Return -1 if this add-on won't provide this function. - */ - int GetTimersAmount(void); - - /*! - * Request the list of all timers from the backend if supported. - * Timer entries are added to XBMC by calling TransferTimerEntry() on the callback. - * @param handle Handle to pass to the callback method. - * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. - * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR GetTimers(ADDON_HANDLE handle); - - /*! - * Add a timer on the backend. - * @param timer The timer to add. - * @return PVR_ERROR_NO_ERROR if the timer has been added successfully. - * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR AddTimer(const PVR_TIMER& timer); - - /*! - * Delete a timer on the backend. - * @param timer The timer to delete. - * @param bForceDelete Set to true to delete a timer that is currently recording a program. - * @return PVR_ERROR_NO_ERROR if the timer has been deleted successfully. - * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR DeleteTimer(const PVR_TIMER& timer, bool bForceDelete); - - /*! - * Update the timer information on the backend. - * @param timer The timer to update. - * @return PVR_ERROR_NO_ERROR if the timer has been updated successfully. - * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR UpdateTimer(const PVR_TIMER& timer); - - //@} - - /** @name PVR live stream methods, used to open and close a stream to a channel, and optionally perform read operations on the stream */ - //@{ - /*! - * Open a live stream on the backend. - * @param channel The channel to stream. - * @return True if the stream has been opened successfully, false otherwise. - * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return false if this add-on won't provide this function. - */ - bool OpenLiveStream(const PVR_CHANNEL& channel); - - /*! - * Close an open live stream. - * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. - */ - void CloseLiveStream(void); - - /*! - * Read from an open live stream. - * @param pBuffer The buffer to store the data in. - * @param iBufferSize The amount of bytes to read. - * @return The amount of bytes that were actually read from the stream. - * @remarks Required if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. - */ - int ReadLiveStream(unsigned char* pBuffer, unsigned int iBufferSize); - - /*! - * Seek in a live stream on a backend that supports timeshifting. - * @param iPosition The position to seek to. - * @param iWhence ? - * @return The new position. - * @remarks Optional, and only used if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. - */ - long long SeekLiveStream(long long iPosition, int iWhence = SEEK_SET); - - /*! - * @return The position in the stream that's currently being read. - * @remarks Optional, and only used if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. - */ - long long PositionLiveStream(void); - - /*! - * @return The total length of the stream that's currently being read. - * @remarks Optional, and only used if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. - */ - long long LengthLiveStream(void); - - /*! - * @return The channel number on the backend of the live stream that's currently being read. - * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return -1 if this add-on won't provide this function. - */ - int GetCurrentClientChannel(void); - - /*! - * Switch to another channel. Only to be called when a live stream has already been opened. - * @param channel The channel to switch to. - * @return True if the switch was successful, false otherwise. - * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return false if this add-on won't provide this function. - */ - bool SwitchChannel(const PVR_CHANNEL& channel); - - /*! - * Get the signal status of the stream that's currently open. - * @param signalStatus The signal status. - * @return True if the signal status has been read successfully, false otherwise. - * @remarks Optional, and only used if bHandlesInputStream or bHandlesDemuxing is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR SignalStatus(PVR_SIGNAL_STATUS& signalStatus); - - /*! - * Get the stream URL for a channel from the backend. Used by the MediaPortal add-on. - * @param channel The channel to get the stream URL for. - * @return The requested URL. - * @remarks Optional, and only used if bHandlesInputStream is set to true. Return NULL if this add-on won't provide this function. - */ - const char* GetLiveStreamURL(const PVR_CHANNEL& channel); - - /*! - * Get the stream properties of the stream that's currently being read. - * @param pProperties The properties of the currently playing stream. - * @return PVR_ERROR_NO_ERROR if the properties have been fetched successfully. - * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. - */ - PVR_ERROR GetStreamProperties(PVR_STREAM_PROPERTIES* pProperties); - //@} - - /** @name PVR recording stream methods, used to open and close a stream to a recording, and perform read operations on the stream. - * @remarks This will only be used if the backend doesn't provide a direct URL in the recording tag. - */ - //@{ - /*! - * Open a stream to a recording on the backend. - * @param recording The recording to open. - * @return True if the stream has been opened successfully, false otherwise. - * @remarks Optional, and only used if bSupportsRecordings is set to true. Return false if this add-on won't provide this function. - */ - bool OpenRecordedStream(const PVR_RECORDING& recording); - - /*! - * Close an open stream from a recording. - * @remarks Optional, and only used if bSupportsRecordings is set to true. - */ - void CloseRecordedStream(void); - - /*! - * Read from a recording. - * @param pBuffer The buffer to store the data in. - * @param iBufferSize The amount of bytes to read. - * @return The amount of bytes that were actually read from the stream. - * @remarks Optional, and only used if bSupportsRecordings is set to true, but required if OpenRecordedStream() is implemented. Return -1 if this add-on won't provide this function. - */ - int ReadRecordedStream(unsigned char* pBuffer, unsigned int iBufferSize); - - /*! - * Seek in a recorded stream. - * @param iPosition The position to seek to. - * @param iWhence ? - * @return The new position. - * @remarks Optional, and only used if bSupportsRecordings is set to true. Return -1 if this add-on won't provide this function. - */ - long long SeekRecordedStream(long long iPosition, int iWhence = SEEK_SET); - - /*! - * @return The position in the stream that's currently being read. - * @remarks Optional, and only used if bSupportsRecordings is set to true. Return -1 if this add-on won't provide this function. - */ - long long PositionRecordedStream(void); - - /*! - * @return The total length of the stream that's currently being read. - * @remarks Optional, and only used if bSupportsRecordings is set to true. Return -1 if this add-on won't provide this function. - */ - long long LengthRecordedStream(void); - //@} - - /** @name PVR demultiplexer methods - * @remarks Only used by XBMC is bHandlesDemuxing is set to true. - */ - //@{ - /*! - * Reset the demultiplexer in the add-on. - * @remarks Required if bHandlesDemuxing is set to true. - */ - void DemuxReset(void); - - /*! - * Abort the demultiplexer thread in the add-on. - * @remarks Required if bHandlesDemuxing is set to true. - */ - void DemuxAbort(void); - - /*! - * Flush all data that's currently in the demultiplexer buffer in the add-on. - * @remarks Required if bHandlesDemuxing is set to true. - */ - void DemuxFlush(void); - - /*! - * Read the next packet from the demultiplexer, if there is one. - * @return The next packet. - * If there is no next packet, then the add-on should return the - * packet created by calling AllocateDemuxPacket(0) on the callback. - * If the stream changed and XBMC's player needs to be reinitialised, - * then, the add-on should call AllocateDemuxPacket(0) on the - * callback, and set the streamid to DMX_SPECIALID_STREAMCHANGE and - * return the value. - * The add-on should return NULL if an error occured. - * @remarks Required if bHandlesDemuxing is set to true. Return NULL if this add-on won't provide this function. - */ - DemuxPacket* DemuxRead(void); - //@} - - /*! - * Delay to use when using switching channels for add-ons not providing an input stream. - * If the add-on does provide an input stream, then this method will not be called. - * Those add-ons can do that in OpenLiveStream() if needed. - * @return The delay in milliseconds. - */ - unsigned int GetChannelSwitchDelay(void); - - /*! - * Check if the backend support pausing the currently playing stream - * This will enable/disable the pause button in XBMC based on the return value - * @return false if the PVR addon/backend does not support pausing, true if possible - */ - bool CanPauseStream(); - - /*! - * Check if the backend supports seeking for the currently playing stream - * This will enable/disable the rewind/forward buttons in XBMC based on the return value - * @return false if the PVR addon/backend does not support seeking, true if possible - */ - bool CanSeekStream(); - - /*! - * @brief Notify the pvr addon that XBMC (un)paused the currently playing stream - */ - void PauseStream(bool bPaused); - - /*! - * Notify the pvr addon/demuxer that XBMC wishes to seek the stream by time - * @param time The absolute time since stream start - * @param backwards True to seek to keyframe BEFORE time, else AFTER - * @param startpts can be updated to point to where display should start - * @return True if the seek operation was possible - * @remarks Optional, and only used if addon has its own demuxer. Return False if this add-on won't provide this function. - */ - bool SeekTime(int time, bool backwards, double *startpts); - - /*! - * Notify the pvr addon/demuxer that XBMC wishes to change playback speed - * @param speed The requested playback speed - * @remarks Optional, and only used if addon has its own demuxer. - */ - void SetSpeed(int speed); - - /*! - * Get actual playing time from addon. With timeshift enabled this is - * different to live. - * @return time as UTC - */ - time_t GetPlayingTime(); - - /*! - * Get time of oldest packet in timeshift buffer - * @return time as UTC - */ - time_t GetBufferTimeStart(); - - /*! - * Get time of latest packet in timeshift buffer - * @return time as UTC - */ - time_t GetBufferTimeEnd(); - - /*! - * Get the hostname of the pvr backend server - * @return hostname as ip address or alias. If backend does not - * utilize a server, return empty string. - */ - const char* GetBackendHostname(); - - /*! - * Called by XBMC to assign the function pointers of this add-on to pClient. - * @param pClient The struct to assign the function pointers to. - */ - void __declspec(dllexport) get_addon(struct PVRClient* pClient) - { - pClient->GetPVRAPIVersion = GetPVRAPIVersion; - pClient->GetMininumPVRAPIVersion = GetMininumPVRAPIVersion; - pClient->GetGUIAPIVersion = GetGUIAPIVersion; - pClient->GetMininumGUIAPIVersion = GetMininumGUIAPIVersion; - pClient->GetAddonCapabilities = GetAddonCapabilities; - pClient->GetStreamProperties = GetStreamProperties; - pClient->GetConnectionString = GetConnectionString; - pClient->GetBackendName = GetBackendName; - pClient->GetBackendVersion = GetBackendVersion; - pClient->GetDriveSpace = GetDriveSpace; - pClient->OpenDialogChannelScan = OpenDialogChannelScan; - pClient->MenuHook = CallMenuHook; - - pClient->GetEpg = GetEPGForChannel; - - pClient->GetChannelGroupsAmount = GetChannelGroupsAmount; - pClient->GetChannelGroups = GetChannelGroups; - pClient->GetChannelGroupMembers = GetChannelGroupMembers; - - pClient->GetChannelsAmount = GetChannelsAmount; - pClient->GetChannels = GetChannels; - pClient->DeleteChannel = DeleteChannel; - pClient->RenameChannel = RenameChannel; - pClient->MoveChannel = MoveChannel; - pClient->OpenDialogChannelSettings = OpenDialogChannelSettings; - pClient->OpenDialogChannelAdd = OpenDialogChannelAdd; - - pClient->GetRecordingsAmount = GetRecordingsAmount; - pClient->GetRecordings = GetRecordings; - pClient->DeleteRecording = DeleteRecording; - pClient->UndeleteRecording = UndeleteRecording; - pClient->DeleteAllRecordingsFromTrash = DeleteAllRecordingsFromTrash; - pClient->RenameRecording = RenameRecording; - pClient->SetRecordingPlayCount = SetRecordingPlayCount; - pClient->SetRecordingLastPlayedPosition = SetRecordingLastPlayedPosition; - pClient->GetRecordingLastPlayedPosition = GetRecordingLastPlayedPosition; - pClient->GetRecordingEdl = GetRecordingEdl; - - pClient->GetTimersAmount = GetTimersAmount; - pClient->GetTimers = GetTimers; - pClient->AddTimer = AddTimer; - pClient->DeleteTimer = DeleteTimer; - pClient->UpdateTimer = UpdateTimer; - - pClient->OpenLiveStream = OpenLiveStream; - pClient->CloseLiveStream = CloseLiveStream; - pClient->ReadLiveStream = ReadLiveStream; - pClient->SeekLiveStream = SeekLiveStream; - pClient->PositionLiveStream = PositionLiveStream; - pClient->LengthLiveStream = LengthLiveStream; - pClient->GetCurrentClientChannel = GetCurrentClientChannel; - pClient->SwitchChannel = SwitchChannel; - pClient->SignalStatus = SignalStatus; - pClient->GetLiveStreamURL = GetLiveStreamURL; - pClient->GetChannelSwitchDelay = GetChannelSwitchDelay; - pClient->CanPauseStream = CanPauseStream; - pClient->PauseStream = PauseStream; - pClient->CanSeekStream = CanSeekStream; - pClient->SeekTime = SeekTime; - pClient->SetSpeed = SetSpeed; - - pClient->OpenRecordedStream = OpenRecordedStream; - pClient->CloseRecordedStream = CloseRecordedStream; - pClient->ReadRecordedStream = ReadRecordedStream; - pClient->SeekRecordedStream = SeekRecordedStream; - pClient->PositionRecordedStream = PositionRecordedStream; - pClient->LengthRecordedStream = LengthRecordedStream; - - pClient->DemuxReset = DemuxReset; - pClient->DemuxAbort = DemuxAbort; - pClient->DemuxFlush = DemuxFlush; - pClient->DemuxRead = DemuxRead; - - pClient->GetPlayingTime = GetPlayingTime; - pClient->GetBufferTimeStart = GetBufferTimeStart; - pClient->GetBufferTimeEnd = GetBufferTimeEnd; - - pClient->GetBackendHostname = GetBackendHostname; - }; -}; - -#endif diff --git a/xbmc/addons/include/xbmc_pvr_types.h b/xbmc/addons/include/xbmc_pvr_types.h deleted file mode 100644 index a2e4882..0000000 --- a/xbmc/addons/include/xbmc_pvr_types.h +++ /dev/null @@ -1,417 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#ifndef __PVRCLIENT_TYPES_H__ -#define __PVRCLIENT_TYPES_H__ - -#ifdef TARGET_WINDOWS -#include -#else -#ifndef __cdecl -#define __cdecl -#endif -#ifndef __declspec -#define __declspec(X) -#endif -#endif -#include -#include - -#include "xbmc_addon_types.h" -#include "xbmc_epg_types.h" -#include "xbmc_codec_types.h" - -/*! @note Define "USE_DEMUX" at compile time if demuxing in the PVR add-on is used. - * Also XBMC's "DVDDemuxPacket.h" file must be in the include path of the add-on, - * and the add-on should set bHandlesDemuxing to true. - */ -#ifdef USE_DEMUX -#include "DVDDemuxPacket.h" -#else -struct DemuxPacket; -#endif - -#undef ATTRIBUTE_PACKED -#undef PRAGMA_PACK_BEGIN -#undef PRAGMA_PACK_END - -#if defined(__GNUC__) -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -#define ATTRIBUTE_PACKED __attribute__ ((packed)) -#define PRAGMA_PACK 0 -#endif -#endif - -#if !defined(ATTRIBUTE_PACKED) -#define ATTRIBUTE_PACKED -#define PRAGMA_PACK 1 -#endif - -#define PVR_ADDON_NAME_STRING_LENGTH 1024 -#define PVR_ADDON_URL_STRING_LENGTH 1024 -#define PVR_ADDON_DESC_STRING_LENGTH 1024 -#define PVR_ADDON_INPUT_FORMAT_STRING_LENGTH 32 -#define PVR_ADDON_EDL_LENGTH 32 - -/* using the default avformat's MAX_STREAMS value to be safe */ -#define PVR_STREAM_MAX_STREAMS 20 - -/* current PVR API version */ -#define XBMC_PVR_API_VERSION "1.9.6" - -/* min. PVR API version */ -#define XBMC_PVR_MIN_API_VERSION "1.9.6" - -#ifdef __cplusplus -extern "C" { -#endif - - /*! - * @brief PVR add-on error codes - */ - typedef enum - { - PVR_ERROR_NO_ERROR = 0, /*!< @brief no error occurred */ - PVR_ERROR_UNKNOWN = -1, /*!< @brief an unknown error occurred */ - PVR_ERROR_NOT_IMPLEMENTED = -2, /*!< @brief the method that XBMC called is not implemented by the add-on */ - PVR_ERROR_SERVER_ERROR = -3, /*!< @brief the backend reported an error, or the add-on isn't connected */ - PVR_ERROR_SERVER_TIMEOUT = -4, /*!< @brief the command was sent to the backend, but the response timed out */ - PVR_ERROR_REJECTED = -5, /*!< @brief the command was rejected by the backend */ - PVR_ERROR_ALREADY_PRESENT = -6, /*!< @brief the requested item can not be added, because it's already present */ - PVR_ERROR_INVALID_PARAMETERS = -7, /*!< @brief the parameters of the method that was called are invalid for this operation */ - PVR_ERROR_RECORDING_RUNNING = -8, /*!< @brief a recording is running, so the timer can't be deleted without doing a forced delete */ - PVR_ERROR_FAILED = -9, /*!< @brief the command failed */ - } PVR_ERROR; - - /*! - * @brief PVR timer states - */ - typedef enum - { - PVR_TIMER_STATE_NEW = 0, /*!< @brief a new, unsaved timer */ - PVR_TIMER_STATE_SCHEDULED = 1, /*!< @brief the timer is scheduled for recording */ - PVR_TIMER_STATE_RECORDING = 2, /*!< @brief the timer is currently recordings */ - PVR_TIMER_STATE_COMPLETED = 3, /*!< @brief the recording completed successfully */ - PVR_TIMER_STATE_ABORTED = 4, /*!< @brief recording started, but was aborted */ - PVR_TIMER_STATE_CANCELLED = 5, /*!< @brief the timer was scheduled, but was canceled */ - PVR_TIMER_STATE_CONFLICT_OK = 6, /*!< @brief the scheduled timer conflicts with another one, but will be recorded */ - PVR_TIMER_STATE_CONFLICT_NOK = 7, /*!< @brief the scheduled timer conflicts with another one and won't be recorded */ - PVR_TIMER_STATE_ERROR = 8 /*!< @brief the timer is scheduled, but can't be recorded for some reason */ - } PVR_TIMER_STATE; - - /*! - * @brief PVR menu hook categories - */ - typedef enum - { - PVR_MENUHOOK_UNKNOWN =-1, /*!< @brief unknown menu hook */ - PVR_MENUHOOK_ALL = 0, /*!< @brief all categories */ - PVR_MENUHOOK_CHANNEL = 1, /*!< @brief for channels */ - PVR_MENUHOOK_TIMER = 2, /*!< @brief for timers */ - PVR_MENUHOOK_EPG = 3, /*!< @brief for EPG */ - PVR_MENUHOOK_RECORDING = 4, /*!< @brief for recordings */ - PVR_MENUHOOK_DELETED_RECORDING = 5, /*!< @brief for deleted recordings */ - PVR_MENUHOOK_SETTING = 6, /*!< @brief for settings */ - } PVR_MENUHOOK_CAT; - - /*! - * @brief Properties passed to the Create() method of an add-on. - */ - typedef struct PVR_PROPERTIES - { - const char* strUserPath; /*!< @brief path to the user profile */ - const char* strClientPath; /*!< @brief path to this add-on */ - } PVR_PROPERTIES; - - /*! - * @brief PVR add-on capabilities. All capabilities are set to "false" as default. - * If a capabilty is set to true, then the corresponding methods from xbmc_pvr_dll.h need to be implemented. - */ - typedef struct PVR_ADDON_CAPABILITIES - { - bool bSupportsEPG; /*!< @brief true if the add-on provides EPG information */ - bool bSupportsTV; /*!< @brief true if this add-on provides TV channels */ - bool bSupportsRadio; /*!< @brief true if this add-on supports radio channels */ - bool bSupportsRecordings; /*!< @brief true if this add-on supports playback of recordings stored on the backend */ - bool bSupportsRecordingsUndelete; /*!< @brief true if this add-on supports undelete of recordings stored on the backend */ - bool bSupportsTimers; /*!< @brief true if this add-on supports the creation and editing of timers */ - bool bSupportsChannelGroups; /*!< @brief true if this add-on supports channel groups */ - bool bSupportsChannelScan; /*!< @brief true if this add-on support scanning for new channels on the backend */ - bool bSupportsChannelSettings; /*!< @brief true if this add-on supports the following functions: DeleteChannel, RenameChannel, MoveChannel, DialogChannelSettings and DialogAddChannel */ - bool bHandlesInputStream; /*!< @brief true if this add-on provides an input stream. false if XBMC handles the stream. */ - bool bHandlesDemuxing; /*!< @brief true if this add-on demultiplexes packets. */ - bool bSupportsRecordingFolders; /*!< @brief true if the backend supports timers / recordings in folders. */ - bool bSupportsRecordingPlayCount; /*!< @brief true if the backend supports play count for recordings. */ - bool bSupportsLastPlayedPosition; /*!< @brief true if the backend supports store/retrieve of last played position for recordings. */ - bool bSupportsRecordingEdl; /*!< @brief true if the backend supports retrieving an edit decision list for recordings. */ - } ATTRIBUTE_PACKED PVR_ADDON_CAPABILITIES; - - /*! - * @brief PVR stream properties - */ - typedef struct PVR_STREAM_PROPERTIES - { - unsigned int iStreamCount; - struct PVR_STREAM - { - unsigned int iPhysicalId; /*!< @brief (required) physical index */ - xbmc_codec_type_t iCodecType; /*!< @brief (required) codec type this stream */ - xbmc_codec_id_t iCodecId; /*!< @brief (required) codec id of this stream */ - char strLanguage[4]; /*!< @brief (required) language id */ - int iIdentifier; /*!< @brief (required) stream id */ - int iFPSScale; /*!< @brief (required) scale of 1000 and a rate of 29970 will result in 29.97 fps */ - int iFPSRate; /*!< @brief (required) FPS rate */ - int iHeight; /*!< @brief (required) height of the stream reported by the demuxer */ - int iWidth; /*!< @brief (required) width of the stream reported by the demuxer */ - float fAspect; /*!< @brief (required) display aspect ratio of the stream */ - int iChannels; /*!< @brief (required) amount of channels */ - int iSampleRate; /*!< @brief (required) sample rate */ - int iBlockAlign; /*!< @brief (required) block alignment */ - int iBitRate; /*!< @brief (required) bit rate */ - int iBitsPerSample; /*!< @brief (required) bits per sample */ - } stream[PVR_STREAM_MAX_STREAMS]; /*!< @brief (required) the streams */ - } ATTRIBUTE_PACKED PVR_STREAM_PROPERTIES; - - /*! - * @brief Signal status information - */ - typedef struct PVR_SIGNAL_STATUS - { - char strAdapterName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the adapter that's being used */ - char strAdapterStatus[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) status of the adapter that's being used */ - char strServiceName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the current service */ - char strProviderName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the current service's provider */ - char strMuxName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the current mux */ - int iSNR; /*!< @brief (optional) signal/noise ratio */ - int iSignal; /*!< @brief (optional) signal strength */ - long iBER; /*!< @brief (optional) bit error rate */ - long iUNC; /*!< @brief (optional) uncorrected blocks */ - double dVideoBitrate; /*!< @brief (optional) video bitrate */ - double dAudioBitrate; /*!< @brief (optional) audio bitrate */ - double dDolbyBitrate; /*!< @brief (optional) dolby bitrate */ - } ATTRIBUTE_PACKED PVR_SIGNAL_STATUS; - - /*! - * @brief Menu hooks that are available in the context menus while playing a stream via this add-on. - * And in the Live TV settings dialog - */ - typedef struct PVR_MENUHOOK - { - unsigned int iHookId; /*!< @brief (required) this hook's identifier */ - unsigned int iLocalizedStringId; /*!< @brief (required) the id of the label for this hook in g_localizeStrings */ - PVR_MENUHOOK_CAT category; /*!< @brief (required) category of menu hook */ - } ATTRIBUTE_PACKED PVR_MENUHOOK; - - /*! - * @brief Representation of a TV or radio channel. - */ - typedef struct PVR_CHANNEL - { - unsigned int iUniqueId; /*!< @brief (required) unique identifier for this channel */ - bool bIsRadio; /*!< @brief (required) true if this is a radio channel, false if it's a TV channel */ - unsigned int iChannelNumber; /*!< @brief (optional) channel number of this channel on the backend */ - unsigned int iSubChannelNumber; /*!< @brief (optional) sub channel number of this channel on the backend (ATSC) */ - char strChannelName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) channel name given to this channel */ - char strInputFormat[PVR_ADDON_INPUT_FORMAT_STRING_LENGTH]; /*!< @brief (optional) input format type. types can be found in ffmpeg/libavformat/allformats.c - leave empty if unknown */ - char strStreamURL[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) the URL to use to access this channel. - leave empty to use this add-on to access the stream. - set to a path that's supported by XBMC otherwise. */ - unsigned int iEncryptionSystem; /*!< @brief (optional) the encryption ID or CaID of this channel */ - char strIconPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) path to the channel icon (if present) */ - bool bIsHidden; /*!< @brief (optional) true if this channel is marked as hidden */ - } ATTRIBUTE_PACKED PVR_CHANNEL; - - typedef struct PVR_CHANNEL_GROUP - { - char strGroupName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) name of this channel group */ - bool bIsRadio; /*!< @brief (required) true if this is a radio channel group, false otherwise. */ - unsigned int iPosition; /*!< @brief (optional) sort position of the group (0 indicates that the backend doesn't support sorting of groups) */ - } ATTRIBUTE_PACKED PVR_CHANNEL_GROUP; - - typedef struct PVR_CHANNEL_GROUP_MEMBER - { - char strGroupName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) name of the channel group to add the channel to */ - unsigned int iChannelUniqueId; /*!< @brief (required) unique id of the member */ - unsigned int iChannelNumber; /*!< @brief (optional) channel number within the group */ - } ATTRIBUTE_PACKED PVR_CHANNEL_GROUP_MEMBER; - - /*! - * @brief Representation of a timer event. - */ - typedef struct PVR_TIMER { - unsigned int iClientIndex; /*!< @brief (required) the index of this timer given by the client */ - int iClientChannelUid; /*!< @brief (required) unique identifier of the channel to record on */ - 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 */ - time_t endTime; /*!< @brief (required) end time of the recording in UTC */ - PVR_TIMER_STATE state; /*!< @brief (required) the state of this timer */ - char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) title of this timer */ - char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) the directory where the recording will be stored in */ - char strSummary[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) the summary for this timer */ - int iPriority; /*!< @brief (optional) the priority of this timer */ - int iLifetime; /*!< @brief (optional) lifetimer of this timer in days */ - bool bIsRepeating; /*!< @brief (optional) true if this is a recurring timer */ - time_t firstDay; /*!< @brief (optional) the first day this recording is active in case of a repeating event */ - int iWeekdays; /*!< @brief (optional) weekday mask */ - int iEpgUid; /*!< @brief (optional) epg event id */ - unsigned int iMarginStart; /*!< @brief (optional) if set, the backend starts the recording iMarginStart minutes before startTime. */ - unsigned int iMarginEnd; /*!< @brief (optional) if set, the backend ends the recording iMarginEnd minutes after endTime. */ - int iGenreType; /*!< @brief (optional) genre type */ - int iGenreSubType; /*!< @brief (optional) genre sub type */ - } ATTRIBUTE_PACKED PVR_TIMER; - /*! - * @brief Representation of a recording. - */ - typedef struct PVR_RECORDING { - char strRecordingId[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) unique id of the recording on the client. */ - char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) the title of this recording */ - char strStreamURL[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (required) stream URL to access this recording */ - char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) directory of this recording on the client */ - char strPlotOutline[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot outline */ - char strPlot[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot */ - char strChannelName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) channel name */ - char strIconPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) icon path */ - char strThumbnailPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) thumbnail path */ - char strFanartPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) fanart path */ - time_t recordingTime; /*!< @brief (optional) start time of the recording */ - int iDuration; /*!< @brief (optional) duration of the recording in seconds */ - int iPriority; /*!< @brief (optional) priority of this recording (from 0 - 100) */ - int iLifetime; /*!< @brief (optional) life time in days of this recording */ - int iGenreType; /*!< @brief (optional) genre type */ - int iGenreSubType; /*!< @brief (optional) genre sub type */ - int iPlayCount; /*!< @brief (optional) play count of this recording on the client */ - int iLastPlayedPosition; /*!< @brief (optional) last played position of this recording on the client */ - bool bIsDeleted; /*!< @brief (optional) shows this recording is deleted and can be undelete */ - unsigned int iEpgEventId; /*!< @brief (optional) EPG event id associated with this recording */ - } ATTRIBUTE_PACKED PVR_RECORDING; - - /*! - * @brief Edit definition list (EDL) - */ - typedef enum - { - PVR_EDL_TYPE_CUT = 0, /*!< @brief cut (completly remove content) */ - PVR_EDL_TYPE_MUTE = 1, /*!< @brief mute audio */ - PVR_EDL_TYPE_SCENE = 2, /*!< @brief scene markers (chapter seeking) */ - PVR_EDL_TYPE_COMBREAK = 3 /*!< @brief commercial breaks */ - } PVR_EDL_TYPE; - - typedef struct PVR_EDL_ENTRY - { - int64_t start; // ms - int64_t end; // ms - PVR_EDL_TYPE type; - } ATTRIBUTE_PACKED PVR_EDL_ENTRY; - - /*! - * @brief PVR menu hook data - */ - typedef struct PVR_MENUHOOK_DATA - { - PVR_MENUHOOK_CAT cat; - union data { - int iEpgUid; - PVR_CHANNEL channel; - PVR_TIMER timer; - PVR_RECORDING recording; - } data; - } ATTRIBUTE_PACKED PVR_MENUHOOK_DATA; - - /*! - * @brief Structure to transfer the methods from xbmc_pvr_dll.h to XBMC - */ - typedef struct PVRClient - { - const char* (__cdecl* GetPVRAPIVersion)(void); - const char* (__cdecl* GetMininumPVRAPIVersion)(void); - const char* (__cdecl* GetGUIAPIVersion)(void); - const char* (__cdecl* GetMininumGUIAPIVersion)(void); - PVR_ERROR (__cdecl* GetAddonCapabilities)(PVR_ADDON_CAPABILITIES*); - PVR_ERROR (__cdecl* GetStreamProperties)(PVR_STREAM_PROPERTIES*); - const char* (__cdecl* GetBackendName)(void); - const char* (__cdecl* GetBackendVersion)(void); - const char* (__cdecl* GetConnectionString)(void); - PVR_ERROR (__cdecl* GetDriveSpace)(long long*, long long*); - PVR_ERROR (__cdecl* MenuHook)(const PVR_MENUHOOK&, const PVR_MENUHOOK_DATA&); - PVR_ERROR (__cdecl* GetEpg)(ADDON_HANDLE, const PVR_CHANNEL&, time_t, time_t); - int (__cdecl* GetChannelGroupsAmount)(void); - PVR_ERROR (__cdecl* GetChannelGroups)(ADDON_HANDLE, bool); - PVR_ERROR (__cdecl* GetChannelGroupMembers)(ADDON_HANDLE, const PVR_CHANNEL_GROUP&); - PVR_ERROR (__cdecl* OpenDialogChannelScan)(void); - int (__cdecl* GetChannelsAmount)(void); - PVR_ERROR (__cdecl* GetChannels)(ADDON_HANDLE, bool); - PVR_ERROR (__cdecl* DeleteChannel)(const PVR_CHANNEL&); - PVR_ERROR (__cdecl* RenameChannel)(const PVR_CHANNEL&); - PVR_ERROR (__cdecl* MoveChannel)(const PVR_CHANNEL&); - PVR_ERROR (__cdecl* OpenDialogChannelSettings)(const PVR_CHANNEL&); - PVR_ERROR (__cdecl* OpenDialogChannelAdd)(const PVR_CHANNEL&); - int (__cdecl* GetRecordingsAmount)(bool); - PVR_ERROR (__cdecl* GetRecordings)(ADDON_HANDLE, bool); - PVR_ERROR (__cdecl* DeleteRecording)(const PVR_RECORDING&); - PVR_ERROR (__cdecl* UndeleteRecording)(const PVR_RECORDING&); - PVR_ERROR (__cdecl* DeleteAllRecordingsFromTrash)(void); - PVR_ERROR (__cdecl* RenameRecording)(const PVR_RECORDING&); - PVR_ERROR (__cdecl* SetRecordingPlayCount)(const PVR_RECORDING&, int); - PVR_ERROR (__cdecl* SetRecordingLastPlayedPosition)(const PVR_RECORDING&, int); - int (__cdecl* GetRecordingLastPlayedPosition)(const PVR_RECORDING&); - PVR_ERROR (__cdecl* GetRecordingEdl)(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*); - int (__cdecl* GetTimersAmount)(void); - PVR_ERROR (__cdecl* GetTimers)(ADDON_HANDLE); - PVR_ERROR (__cdecl* AddTimer)(const PVR_TIMER&); - PVR_ERROR (__cdecl* DeleteTimer)(const PVR_TIMER&, bool); - PVR_ERROR (__cdecl* UpdateTimer)(const PVR_TIMER&); - bool (__cdecl* OpenLiveStream)(const PVR_CHANNEL&); - void (__cdecl* CloseLiveStream)(void); - int (__cdecl* ReadLiveStream)(unsigned char*, unsigned int); - long long (__cdecl* SeekLiveStream)(long long, int); - long long (__cdecl* PositionLiveStream)(void); - long long (__cdecl* LengthLiveStream)(void); - int (__cdecl* GetCurrentClientChannel)(void); - bool (__cdecl* SwitchChannel)(const PVR_CHANNEL&); - PVR_ERROR (__cdecl* SignalStatus)(PVR_SIGNAL_STATUS&); - const char* (__cdecl* GetLiveStreamURL)(const PVR_CHANNEL&); - bool (__cdecl* OpenRecordedStream)(const PVR_RECORDING&); - void (__cdecl* CloseRecordedStream)(void); - int (__cdecl* ReadRecordedStream)(unsigned char*, unsigned int); - long long (__cdecl* SeekRecordedStream)(long long, int); - long long (__cdecl* PositionRecordedStream)(void); - long long (__cdecl* LengthRecordedStream)(void); - void (__cdecl* DemuxReset)(void); - void (__cdecl* DemuxAbort)(void); - void (__cdecl* DemuxFlush)(void); - DemuxPacket* (__cdecl* DemuxRead)(void); - unsigned int (__cdecl* GetChannelSwitchDelay)(void); - bool (__cdecl* CanPauseStream)(void); - void (__cdecl* PauseStream)(bool); - bool (__cdecl* CanSeekStream)(void); - bool (__cdecl* SeekTime)(int, bool, double*); - void (__cdecl* SetSpeed)(int); - time_t (__cdecl* GetPlayingTime)(void); - time_t (__cdecl* GetBufferTimeStart)(void); - time_t (__cdecl* GetBufferTimeEnd)(void); - const char* (__cdecl* GetBackendHostname)(void); - } PVRClient; - -#ifdef __cplusplus -} -#endif - -#endif //__PVRCLIENT_TYPES_H__ diff --git a/xbmc/addons/include/xbmc_scr_dll.h b/xbmc/addons/include/xbmc_scr_dll.h deleted file mode 100644 index c4257b4..0000000 --- a/xbmc/addons/include/xbmc_scr_dll.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#ifndef __XBMC_SCR_H__ -#define __XBMC_SCR_H__ - -#include "xbmc_addon_dll.h" -#include "xbmc_scr_types.h" - -extern "C" -{ - - // Functions that your visualisation must implement - void Start(); - void Render(); - void GetInfo(SCR_INFO* pInfo); - - // function to export the above structure to XBMC - void __declspec(dllexport) get_addon(struct ScreenSaver* pScr) - { - pScr->Start = Start; - pScr->Render = Render; - pScr->GetInfo = GetInfo; - }; -}; - -#endif diff --git a/xbmc/addons/include/xbmc_scr_types.h b/xbmc/addons/include/xbmc_scr_types.h deleted file mode 100644 index fec3040..0000000 --- a/xbmc/addons/include/xbmc_scr_types.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#ifndef __SCREENSAVER_TYPES_H__ -#define __SCREENSAVER_TYPES_H__ - -extern "C" -{ - struct SCR_INFO - { - int dummy; - }; - - struct SCR_PROPS - { - void *device; - int x; - int y; - int width; - int height; - float pixelRatio; - const char *name; - const char *presets; - const char *profile; - }; - - struct ScreenSaver - { - void (__cdecl* Start) (); - void (__cdecl* Render) (); - void (__cdecl* GetInfo)(SCR_INFO *info); - }; -} - -#endif // __SCREENSAVER_TYPES_H__ diff --git a/xbmc/addons/include/xbmc_stream_utils.hpp b/xbmc/addons/include/xbmc_stream_utils.hpp deleted file mode 100644 index 927fe33..0000000 --- a/xbmc/addons/include/xbmc_stream_utils.hpp +++ /dev/null @@ -1,264 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#include "xbmc_pvr_types.h" -#include -#include - -namespace ADDON -{ - /** - * Represents a single stream. It extends the PODS to provide some operators - * overloads. - */ - class XbmcPvrStream : public PVR_STREAM_PROPERTIES::PVR_STREAM - { - public: - XbmcPvrStream() - { - Clear(); - } - - XbmcPvrStream(const XbmcPvrStream &other) - { - memcpy(this, &other, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); - } - - XbmcPvrStream& operator=(const XbmcPvrStream &other) - { - memcpy(this, &other, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); - return *this; - } - - /** - * Compares this stream based on another stream - * @param other - * @return - */ - inline bool operator==(const XbmcPvrStream &other) const - { - return iPhysicalId == other.iPhysicalId && iCodecId == other.iCodecId; - } - - /** - * Compares this stream with another one so that video streams are sorted - * before any other streams and the others are sorted by the physical ID - * @param other - * @return - */ - bool operator<(const XbmcPvrStream &other) const - { - if (iCodecType == XBMC_CODEC_TYPE_VIDEO) - return true; - else if (other.iCodecType != XBMC_CODEC_TYPE_VIDEO) - return iPhysicalId < other.iPhysicalId; - else - return false; - } - - /** - * Clears the stream - */ - void Clear() - { - memset(this, 0, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); - iCodecId = XBMC_INVALID_CODEC_ID; - iCodecType = XBMC_CODEC_TYPE_UNKNOWN; - } - - /** - * Checks whether the stream has been cleared - * @return - */ - inline bool IsCleared() const - { - return iCodecId == XBMC_INVALID_CODEC_ID && - iCodecType == XBMC_CODEC_TYPE_UNKNOWN; - } - }; - - class XbmcStreamProperties - { - public: - typedef std::vector stream_vector; - - XbmcStreamProperties(void) - { - // make sure the vector won't have to resize itself later - m_streamVector = new stream_vector(); - m_streamVector->reserve(PVR_STREAM_MAX_STREAMS); - } - - virtual ~XbmcStreamProperties(void) - { - delete m_streamVector; - } - - /** - * Resets the streams - */ - void Clear(void) - { - m_streamVector->clear(); - m_streamIndex.clear(); - } - - /** - * Returns the index of the stream with the specified physical ID, or -1 if - * there no stream is found. This method is called very often which is why - * we keep a separate map for this. - * @param iPhysicalId - * @return - */ - int GetStreamId(unsigned int iPhysicalId) const - { - std::map::const_iterator it = m_streamIndex.find(iPhysicalId); - if (it != m_streamIndex.end()) - return it->second; - - return -1; - } - - /** - * Returns the stream with the specified physical ID, or null if no such - * stream exists - * @param iPhysicalId - * @return - */ - XbmcPvrStream* GetStreamById(unsigned int iPhysicalId) const - { - int position = GetStreamId(iPhysicalId); - return position != -1 ? &m_streamVector->at(position) : NULL; - } - - /** - * Populates the specified stream with the stream having the specified - * physical ID. If the stream is not found only target stream's physical ID - * will be populated. - * @param iPhysicalId - * @param stream - */ - void GetStreamData(unsigned int iPhysicalId, XbmcPvrStream* stream) - { - XbmcPvrStream *foundStream = GetStreamById(iPhysicalId); - if (foundStream) - stream = foundStream; - else - { - stream->iIdentifier = -1; - stream->iPhysicalId = iPhysicalId; - } - } - - /** - * Populates props with the current streams and returns whether there are - * any streams at the moment or not. - * @param props - * @return - */ - bool GetProperties(PVR_STREAM_PROPERTIES* props) - { - unsigned int i = 0; - for (stream_vector::const_iterator it = m_streamVector->begin(); - it != m_streamVector->end(); ++it, ++i) - { - memcpy(&props->stream[i], &(*it), sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); - } - - props->iStreamCount = m_streamVector->size(); - return (props->iStreamCount > 0); - } - - /** - * Merges new streams into the current list of streams. Identical streams - * will retain their respective indexes and new streams will replace unused - * indexes or be appended. - * @param newStreams - */ - void UpdateStreams(stream_vector &newStreams) - { - // sort the new streams - std::sort(newStreams.begin(), newStreams.end()); - - // ensure we never have more than PVR_STREAMS_MAX_STREAMS streams - if (newStreams.size() > PVR_STREAM_MAX_STREAMS) - { - while (newStreams.size() > PVR_STREAM_MAX_STREAMS) - newStreams.pop_back(); - - XBMC->Log(LOG_ERROR, "%s - max amount of streams reached", __FUNCTION__); - } - - stream_vector::iterator newStreamPosition; - for (stream_vector::iterator it = m_streamVector->begin(); it != m_streamVector->end(); ++it) - { - newStreamPosition = std::find(newStreams.begin(), newStreams.end(), *it); - - // if the current stream no longer exists we clear it, otherwise we - // copy it and remove it from newStreams - if (newStreamPosition == newStreams.end()) - it->Clear(); - else - { - *it = *newStreamPosition; - newStreams.erase(newStreamPosition); - } - } - - // replace cleared streams with new streams - for (stream_vector::iterator it = m_streamVector->begin(); - it != m_streamVector->end() && !newStreams.empty(); ++it) - { - if (it->IsCleared()) - { - *it = newStreams.front(); - newStreams.erase(newStreams.begin()); - } - } - - // append any remaining new streams - m_streamVector->insert(m_streamVector->end(), newStreams.begin(), newStreams.end()); - - // remove trailing cleared streams - while (m_streamVector->back().IsCleared()) - m_streamVector->pop_back(); - - // update the index - UpdateIndex(); - } - - private: - stream_vector *m_streamVector; - std::map m_streamIndex; - - /** - * Updates the stream index - */ - void UpdateIndex() - { - m_streamIndex.clear(); - - int i = 0; - for (stream_vector::const_iterator it = m_streamVector->begin(); it != m_streamVector->end(); ++it, ++i) - m_streamIndex[it->iPhysicalId] = i; - } - }; -} diff --git a/xbmc/addons/include/xbmc_vis_dll.h b/xbmc/addons/include/xbmc_vis_dll.h deleted file mode 100644 index c65f844..0000000 --- a/xbmc/addons/include/xbmc_vis_dll.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __XBMC_VIS_H__ -#define __XBMC_VIS_H__ - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#include "xbmc_addon_dll.h" -#include "xbmc_vis_types.h" - -extern "C" -{ - // Functions that your visualisation must implement - void Start(int iChannels, int iSamplesPerSec, int iBitsPerSample, const char* szSongName); - void AudioData(const float* pAudioData, int iAudioDataLength, float *pFreqData, int iFreqDataLength); - void Render(); - bool OnAction(long action, const void *param); - void GetInfo(VIS_INFO* pInfo); - unsigned int GetPresets(char ***presets); - unsigned GetPreset(); - unsigned int GetSubModules(char ***presets); - bool IsLocked(); - - // function to export the above structure to XBMC - void __declspec(dllexport) get_addon(struct Visualisation* pVisz) - { - pVisz->Start = Start; - pVisz->AudioData = AudioData; - pVisz->Render = Render; - pVisz->OnAction = OnAction; - pVisz->GetInfo = GetInfo; - pVisz->GetPresets = GetPresets; - pVisz->GetPreset = GetPreset; - pVisz->GetSubModules = GetSubModules; - pVisz->IsLocked = IsLocked; - }; -}; - -#endif diff --git a/xbmc/addons/include/xbmc_vis_types.h b/xbmc/addons/include/xbmc_vis_types.h deleted file mode 100644 index e6b0ccd..0000000 --- a/xbmc/addons/include/xbmc_vis_types.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -/* - Common data structures shared between XBMC and XBMC's visualisations - */ - -#ifndef __VISUALISATION_TYPES_H__ -#define __VISUALISATION_TYPES_H__ -#include - -extern "C" -{ - struct VIS_INFO - { - int bWantsFreq; - int iSyncDelay; - }; - - struct VIS_PROPS - { - void *device; - int x; - int y; - int width; - int height; - float pixelRatio; - const char *name; - const char *presets; - const char *profile; - const char *submodule; - }; - - enum VIS_ACTION - { - VIS_ACTION_NONE = 0, - VIS_ACTION_NEXT_PRESET, - VIS_ACTION_PREV_PRESET, - VIS_ACTION_LOAD_PRESET, - VIS_ACTION_RANDOM_PRESET, - VIS_ACTION_LOCK_PRESET, - VIS_ACTION_RATE_PRESET_PLUS, - VIS_ACTION_RATE_PRESET_MINUS, - VIS_ACTION_UPDATE_ALBUMART, - VIS_ACTION_UPDATE_TRACK - }; - - class VisTrack - { - public: - VisTrack() - { - title = artist = album = albumArtist = NULL; - genre = comment = lyrics = reserved1 = reserved2 = NULL; - trackNumber = discNumber = duration = year = 0; - rating = 0; - reserved3 = reserved4 = 0; - } - - const char *title; - const char *artist; - const char *album; - const char *albumArtist; - const char *genre; - const char *comment; - const char *lyrics; - const char *reserved1; - const char *reserved2; - - int trackNumber; - int discNumber; - int duration; - int year; - char rating; - int reserved3; - int reserved4; - }; - - struct Visualisation - { - void (__cdecl* Start)(int iChannels, int iSamplesPerSec, int iBitsPerSample, const char* szSongName); - void (__cdecl* AudioData)(const float* pAudioData, int iAudioDataLength, float *pFreqData, int iFreqDataLength); - void (__cdecl* Render) (); - void (__cdecl* GetInfo)(VIS_INFO *info); - bool (__cdecl* OnAction)(long flags, const void *param); - int (__cdecl* HasPresets)(); - unsigned int (__cdecl *GetPresets)(char ***presets); - unsigned int (__cdecl *GetPreset)(); - unsigned int (__cdecl *GetSubModules)(char ***modules); - bool (__cdecl* IsLocked)(); - }; -} - -#endif //__VISUALISATION_TYPES_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 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +/*! + * @file kodi_adsp_dll.h + * @section sec1 Basic audio dsp addon interface description + * @author Team Kodi + * @date 10. May 2014 + * @version 0.1.5 + * + * @subsection sec1_1 General + * @li The basic support on the addon is supplied with the + * AE_DSP_ADDON_CAPABILITIES data which becomes asked over + * GetAddonCapabilities(...), further the addon must register his available + * modes on startup with the RegisterMode(...) callback function (see + * libKODI_adsp.h). If one of this two points is not set the addon becomes + * ignored for the chain step. + * + * @subsection sec1_2 Processing + * @li On start of new stream the addon becomes called with StreamCreate(...) + * to check about given values that it support it basically and can create + * his structure, if nothing is supported it can return AE_DSP_ERROR_IGNORE_ME. + * + * @li As next step StreamIsModeSupported(...) becomes called for every + * available and enabled modes, is separated due to more as one available mode + * on the addon is possible, if the mode is not supported it can also be return + * AE_DSP_ERROR_IGNORE_ME. + * - If mode is a resample mode and returns no error it becomes asked with + * InputResampleSampleRate(...) or OutputResampleSampleRate(...) (relevant + * to his type) about his given sample rate. + * - About the from user selected master processing mode the related addon + * becomes called now with MasterProcessSetMode(...) to handle it's + * selectionon the addon given by the own addon type identifier or by + * KODI's useddatabase id, also the currently used stream type (e.g. + * Music or Video) is send. + * - If the addon supports only one master mode it can ignore this function + * and return always AE_DSP_ERROR_NO_ERROR. + * - If the master mode is set the addon becomes asked about the from him + * given output channel layout related to up- or downmix modes, if + * nothing becomes changed on the layout it can return -1. + * - The MasterProcessSetMode(...) is also called if from user a another + * mode becomes selected. + * + * @li Then as last step shortly before the first process call becomes executed + * the addon is called one time with StreamInitialize(...) to inform that + * processing is started on the given settings. + * - This function becomes also called on all add-ons if the master process + * becomes changed. + * - Also every process after StreamInitialize on the addon mode becomes asked + * with _..._ProcessNeededSamplesize(...) about required memory size for the + * output of his data, if no other size is required it can return 0. + * + * @li From now the processing becomes handled for the different steps with + * _..._Process(...). + * - Further it becomes asked with _..._GetDelay(...) about his processing + * time as float value in seconds, needed for video and audio alignment. + * + * @li On the end of the processing if the source becomes stopped the + * StreamDestroy(...) function becomes called on all active processing add-ons. + * + * @note + * The StreamCreate(...) can be becomes called for a new stream before the + * previous was closed with StreamDestroy(...) ! To have a speed improve. + */ + +#include "xbmc_addon_dll.h" +#include "kodi_adsp_types.h" + +/*! + * Functions that the Audio DSP add-on must implement, but some can be empty. + * + * The 'remarks' field indicates which methods should be implemented, and which + * ones are optional. + */ + +extern "C" +{ + /*! @name Audio DSP add-on methods */ + //@{ + /*! + * Get the KODI_AE_DSP_API_VERSION that was used to compile this add-on. + * Used to check if this add-on is compatible with KODI. + * @return The KODI_AE_DSP_API_VERSION that was used to compile this add-on. + * @remarks Valid implementation required. + */ + const char* GetAudioDSPAPIVersion(void); + + /*! + * Get the KODI_AE_DSP_MIN_API_VERSION that was used to compile this add-on. + * Used to check if this add-on is compatible with KODI. + * @return The KODI_AE_DSP_MIN_API_VERSION that was used to compile this add-on. + * @remarks Valid implementation required. + */ + const char* GetMinimumAudioDSPAPIVersion(void); + + /*! + * @brief Get the KODI_GUI_API_VERSION that was used to compile this add-on. + * Used to check if this add-on is compatible with KODI. + * @return The KODI_GUI_API_VERSION that was used to compile this add-on. + * @remarks Valid implementation required. + */ + const char* GetGUIAPIVersion(void); + + /*! + * @brief Get the KODI_GUI_MIN_API_VERSION that was used to compile this + * add-on. + * Used to check if this add-on is compatible with KODI. + * @return The KODI_GUI_MIN_API_VERSION that was used to compile this add-on. + * @remarks Valid implementation required. + */ + const char* GetMinimumGUIAPIVersion(void); + + /*! + * @brief Get the list of features that this add-on provides. + * Called by KODI to query the add-ons capabilities. + * Used to check which options should be presented in the DSP, which methods + * to call, etc. + * All capabilities that the add-on supports should be set to true. + * @param pCapabilities The add-ons capabilities. + * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully. + * @remarks Valid implementation required. + */ + AE_DSP_ERROR GetAddonCapabilities(AE_DSP_ADDON_CAPABILITIES *pCapabilities); + + /*! + * @return The name reported by the back end that will be displayed in the + * UI. + * @remarks Valid implementation required. + */ + const char* GetDSPName(void); + + /*! + * @return The version string reported by the back end that will be displayed + * in the UI. + * @remarks Valid implementation required. + */ + const char* GetDSPVersion(void); + + /*! + * @brief Call one of the menu hooks (if supported). + * Supported AE_DSP_MENUHOOK instances have to be added in ADDON_Create(), + * by calling AddMenuHook() on the callback. + * @param menuhook The hook to call. + * @param item The selected item for which the hook was called. + * @return AE_DSP_ERROR_NO_ERROR if the hook was called successfully. + * @remarks Optional. Return AE_DSP_ERROR_NOT_IMPLEMENTED if this add-on + * won't provide this function. + */ + AE_DSP_ERROR CallMenuHook(const AE_DSP_MENUHOOK& menuhook, const AE_DSP_MENUHOOK_DATA &item); + //@} + + /** @name DSP processing control, used to open and close a stream + * @remarks Valid implementation required. + */ + //@{ + /*! + * @brief Set up Audio DSP with selected audio settings (use the basic + * present audio stream data format). + * Used to detect available add-ons for present stream, as example stereo + * surround upmix not needed on 5.1 audio stream. + * @param addonSettings The add-ons audio settings. + * @param pProperties The properties of the currently playing stream. + * @param handle On this becomes addon informated about stream id and can set function addresses which need on calls + * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully + * and data can be performed. AE_DSP_ERROR_IGNORE_ME if format is not + * supported, but without fault. + * @remarks Valid implementation required. + */ + AE_DSP_ERROR StreamCreate(const AE_DSP_SETTINGS *addonSettings, const AE_DSP_STREAM_PROPERTIES* pProperties, ADDON_HANDLE handle); + + /*! + * Remove the selected id from currently used DSP processes + * @param handle identification data for stream + * @return AE_DSP_ERROR_NO_ERROR if the becomes found and removed + * @remarks Valid implementation required. + */ + AE_DSP_ERROR StreamDestroy(const ADDON_HANDLE handle); + + /*! + * @brief Ask the add-on about a requested processing mode that it is + * supported on the current stream. Is called about every add-on mode after + * successed StreamCreate. + * @param handle identification data for stream + * @param type The processing mode type, see AE_DSP_MODE_TYPE for definitions + * @param mode_id The mode inside add-on which must be performed on call. Id + * is set from add-on by iModeNumber on AE_DSP_MODE structure during + * RegisterMode callback, + * @param unique_db_mode_id The Mode unique id generated from dsp database. + * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully + * or if the stream is not supported the add-on must return + * AE_DSP_ERROR_IGNORE_ME. + * @remarks Valid implementation required. + */ + AE_DSP_ERROR StreamIsModeSupported(const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int mode_id, int unique_db_mode_id); + + /*! + * @brief Set up Audio DSP with selected audio settings (detected on data of + * first present audio packet) + * @param addonSettings The add-ons audio settings. + * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully. + * @remarks Valid implementation required. + */ + AE_DSP_ERROR StreamInitialize(const ADDON_HANDLE handle, const AE_DSP_SETTINGS *addonSettings); + //@} + + /** @name DSP input processing + * @remarks Only used by KODI if bSupportsInputProcess is set to true. + */ + //@{ + /*! + * @brief DSP input processing + * Can be used to have unchanged stream.. + * All DSP add-ons allowed to-do this. + * @param handle identification data for stream + * @param array_in Pointer to data memory + * @param samples Amount of samples inside array_in + * @return true if work was OK + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + bool InputProcess(const ADDON_HANDLE handle, const float **array_in, unsigned int samples); + //@} + + /** @name DSP pre-resampling + * @remarks Only used by KODI if bSupportsInputResample is set to true. + */ + //@{ + /*! + * @brief If the add-on operate with buffered arrays and the output size can + * be higher as the input it becomes asked about needed size before any + * InputResampleProcess call. + * @param handle identification data for stream + * @return The needed size of output array or 0 if no changes within it + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + unsigned int InputResampleProcessNeededSamplesize(const ADDON_HANDLE handle); + + /*! + * @brief DSP re sample processing before master. + * Here a high quality resample can be performed. + * Only one DSP add-on is allowed to-do this! + * @param handle identification data for stream + * @param array_in Pointer to input data memory + * @param array_out Pointer to output data memory + * @param samples Amount of samples inside array_in + * @return Amount of samples processed + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + unsigned int InputResampleProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples); + + /*! + * @brief Returns the re-sampling generated new sample rate used before the + * master process + * @param handle identification data for stream + * @return The new sample rate + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + int InputResampleSampleRate(const ADDON_HANDLE handle); + + /*! + * @brief Returns the time in seconds that it will take + * for the next added packet to be returned to KODI. + * @param handle identification data for stream + * @return the delay in seconds + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + float InputResampleGetDelay(const ADDON_HANDLE handle); + //@} + + /** @name DSP Pre processing + * @remarks Only used by KODI if bSupportsPreProcess is set to true. + */ + //@{ + /*! + * @brief If the addon operate with buffered arrays and the output size can + * be higher as the input it becomes asked about needed size before any + * PreProcess call. + * @param handle identification data for stream + * @param mode_id The mode inside add-on which must be performed on call. Id + * is set from add-on by iModeNumber on AE_DSP_MODE structure during + * RegisterMode callback and can be defined from add-on as a structure + * pointer or anything else what is needed to find it. + * @return The needed size of output array or 0 if no changes within it + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + unsigned int PreProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id); + + /*! + * @brief Returns the time in seconds that it will take + * for the next added packet to be returned to KODI. + * @param handle identification data for stream + * @param mode_id The mode inside add-on which must be performed on call. Id + * is set from add-on by iModeNumber on AE_DSP_MODE structure during + * RegisterMode callback and can be defined from add-on as a structure + * pointer or anything else what is needed to find it. + * @return the delay in seconds + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + float PreProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id); + + /*! + * @brief DSP preprocessing + * All DSP add-ons allowed to-do this. + * @param handle identification data for stream + * @param mode_id The mode inside add-on which must be performed on call. Id + * is set from add-on by iModeNumber on AE_DSP_MODE structure during + * RegisterMode callback and can be defined from add-on as a structure + * pointer or anything else what is needed to find it. + * @param array_in Pointer to input data memory + * @param array_out Pointer to output data memory + * @param samples Amount of samples inside array_in + * @return Amount of samples processed + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + unsigned int PreProcess(const ADDON_HANDLE handle, unsigned int mode_id, float **array_in, float **array_out, unsigned int samples); + //@} + + /** @name DSP Master processing + * @remarks Only used by KODI if bSupportsMasterProcess is set to true. + */ + //@{ + /*! + * @brief Set the active master process mode + * @param handle identification data for stream + * @param type Requested stream type for the selected master mode + * @param mode_id The Mode identifier. + * @param unique_db_mode_id The Mode unique id generated from DSP database. + * @return AE_DSP_ERROR_NO_ERROR if the setup was successful + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + AE_DSP_ERROR MasterProcessSetMode(const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id); + + /*! + * @brief If the add-on operate with buffered arrays and the output size can + * be higher as the input it becomes asked about needed size before any + * MasterProcess call. + * @param handle identification data for stream + * @return The needed size of output array or 0 if no changes within it + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + unsigned int MasterProcessNeededSamplesize(const ADDON_HANDLE handle); + + /*! + * @brief Returns the time in seconds that it will take + * for the next added packet to be returned to KODI. + * @param handle identification data for stream + * @return the delay in seconds + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + float MasterProcessGetDelay(const ADDON_HANDLE handle); + + /*! + * @brief Returns the from selected master mode performed channel alignment + * @param handle identification data for stream + * @retval out_channel_present_flags the exact channel present flags after + * performed up-/downmix + * @return the amount channels + * @remarks Optional. Must be used and set if a channel up- or downmix is + * processed from the active master mode + */ + int MasterProcessGetOutChannels(const ADDON_HANDLE handle, unsigned long &out_channel_present_flags); + + /*! + * @brief Master processing becomes performed with it + * Here a channel up-mix/down-mix for stereo surround sound can be performed + * Only one DSP add-on is allowed to-do this! + * @param handle identification data for stream + * @param array_in Pointer to input data memory + * @param array_out Pointer to output data memory + * @param samples Amount of samples inside array_in + * @return Amount of samples processed + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + unsigned int MasterProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples); + + /*! + * Used to get a information string about the processed work to show on skin + * @return A string to show + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + const char *MasterProcessGetStreamInfoString(const ADDON_HANDLE handle); + //@} + + /** @name DSP Post processing + * @remarks Only used by KODI if bSupportsPostProcess is set to true. + */ + //@{ + /*! + * If the add-on operate with buffered arrays and the output size can be + * higher as the input it becomes asked about needed size before any + * PostProcess call. + * @param handle identification data for stream + * @param mode_id The mode inside add-on which must be performed on call. Id + * is set from add-on by iModeNumber on AE_DSP_MODE structure during + * RegisterMode callback, and can be defined from add-on as a structure + * pointer or anything else what is needed to find it. + * @return The needed size of output array or 0 if no changes within it + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + unsigned int PostProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id); + + /*! + * Returns the time in seconds that it will take + * for the next added packet to be returned to KODI. + * @param handle identification data for stream + * @param mode_id The mode inside add-on which must be performed on call. Id + * is set from add-on by iModeNumber on AE_DSP_MODE structure during + * RegisterMode callback, and can be defined from add-on as a structure + * pointer or anything else what is needed to find it. + * @return the delay in seconds + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + float PostProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id); + + /*! + * @brief DSP post processing + * On the post processing can be things performed with additional channel + * upmix like 6.1 to 7.1 + * or frequency/volume corrections, speaker distance handling, equalizer... . + * All DSP add-ons allowed to-do this. + * @param handle identification data for stream + * @param mode_id The mode inside add-on which must be performed on call. Id + * is set from add-on by iModeNumber on AE_DSP_MODE structure during + * RegisterMode callback, and can be defined from add-on as a structure + * pointer or anything else what is needed to find it. + * @param array_in Pointer to input data memory + * @param array_out Pointer to output data memory + * @param samples Amount of samples inside array_in + * @return Amount of samples processed + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + unsigned int PostProcess(const ADDON_HANDLE handle, unsigned int mode_id, float **array_in, float **array_out, unsigned int samples); + //@} + + /** @name DSP Post re-sampling + * @remarks Only used by KODI if bSupportsOutputResample is set to true. + */ + //@{ + /*! + * @brief If the add-on operate with buffered arrays and the output size + * can be higher as the input + * it becomes asked about needed size before any OutputResampleProcess call. + * @param handle identification data for stream + * @return The needed size of output array or 0 if no changes within it + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + unsigned int OutputResampleProcessNeededSamplesize(const ADDON_HANDLE handle); + + /*! + * @brief Re-sampling after master processing becomes performed with it if + * needed, only + * one add-on can perform it. + * @param handle identification data for stream + * @param array_in Pointer to input data memory + * @param array_out Pointer to output data memory + * @param samples Amount of samples inside array_in + * @return Amount of samples processed + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + unsigned int OutputResampleProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples); + + /*! + * @brief Returns the re-sampling generated new sample rate used after the + * master process. + * @param handle identification data for stream + * @return The new sample rate + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + int OutputResampleSampleRate(const ADDON_HANDLE handle); + + /*! + * @brief Returns the time in seconds that it will take for the next added + * packet to be returned to KODI. + * @param handle identification data for stream + * @return the delay in seconds + * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with + * GetAddonCapabilities + */ + float OutputResampleGetDelay(const ADDON_HANDLE handle); + //@} + + // function to export the above structure to KODI + void __declspec(dllexport) get_addon(struct AudioDSP* pDSP) + { + pDSP->GetAudioDSPAPIVersion = GetAudioDSPAPIVersion; + pDSP->GetMinimumAudioDSPAPIVersion = GetMinimumAudioDSPAPIVersion; + pDSP->GetGUIAPIVersion = GetGUIAPIVersion; + pDSP->GetMinimumGUIAPIVersion = GetMinimumGUIAPIVersion; + pDSP->GetAddonCapabilities = GetAddonCapabilities; + pDSP->GetDSPName = GetDSPName; + pDSP->GetDSPVersion = GetDSPVersion; + pDSP->MenuHook = CallMenuHook; + + pDSP->StreamCreate = StreamCreate; + pDSP->StreamDestroy = StreamDestroy; + pDSP->StreamIsModeSupported = StreamIsModeSupported; + pDSP->StreamInitialize = StreamInitialize; + + pDSP->InputProcess = InputProcess; + + pDSP->InputResampleProcessNeededSamplesize = InputResampleProcessNeededSamplesize; + pDSP->InputResampleProcess = InputResampleProcess; + pDSP->InputResampleGetDelay = InputResampleGetDelay; + pDSP->InputResampleSampleRate = InputResampleSampleRate; + + pDSP->PreProcessNeededSamplesize = PreProcessNeededSamplesize; + pDSP->PreProcessGetDelay = PreProcessGetDelay; + pDSP->PreProcess = PreProcess; + + pDSP->MasterProcessSetMode = MasterProcessSetMode; + pDSP->MasterProcessNeededSamplesize = MasterProcessNeededSamplesize; + pDSP->MasterProcessGetDelay = MasterProcessGetDelay; + pDSP->MasterProcessGetOutChannels = MasterProcessGetOutChannels; + pDSP->MasterProcess = MasterProcess; + pDSP->MasterProcessGetStreamInfoString = MasterProcessGetStreamInfoString; + + pDSP->PostProcessNeededSamplesize = PostProcessNeededSamplesize; + pDSP->PostProcessGetDelay = PostProcessGetDelay; + pDSP->PostProcess = PostProcess; + + pDSP->OutputResampleProcessNeededSamplesize = OutputResampleProcessNeededSamplesize; + pDSP->OutputResampleProcess = OutputResampleProcess; + pDSP->OutputResampleSampleRate = OutputResampleSampleRate; + pDSP->OutputResampleGetDelay = OutputResampleGetDelay; + }; +}; + 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 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +/*! + * Common data structures shared between KODI and KODI's audio DSP add-ons + */ + +#ifdef TARGET_WINDOWS +#include +#else +#ifndef __cdecl +#define __cdecl +#endif +#ifndef __declspec +#define __declspec(X) +#endif +#endif + +#include + +#include "xbmc_addon_types.h" +#include "xbmc_codec_types.h" + +#undef ATTRIBUTE_PACKED +#undef PRAGMA_PACK_BEGIN +#undef PRAGMA_PACK_END + +#if defined(__GNUC__) +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define ATTRIBUTE_PACKED __attribute__ ((packed)) +#define PRAGMA_PACK 0 +#endif +#endif + +#if !defined(ATTRIBUTE_PACKED) +#define ATTRIBUTE_PACKED +#define PRAGMA_PACK 1 +#endif + +#define AE_DSP_ADDON_STRING_LENGTH 1024 + +#define AE_DSP_STREAM_MAX_STREAMS 8 +#define AE_DSP_STREAM_MAX_MODES 32 + +/* current Audio DSP API version */ +#define KODI_AE_DSP_API_VERSION "0.1.8" + +/* min. Audio DSP API version */ +#define KODI_AE_DSP_MIN_API_VERSION "0.1.8" + +#ifdef __cplusplus +extern "C" { +#endif + + typedef unsigned int AE_DSP_STREAM_ID; + + /*! + * @brief Audio DSP add-on error codes + */ + typedef enum + { + AE_DSP_ERROR_NO_ERROR = 0, /*!< @brief no error occurred */ + AE_DSP_ERROR_UNKNOWN = -1, /*!< @brief an unknown error occurred */ + AE_DSP_ERROR_IGNORE_ME = -2, /*!< @brief the used input stream can not processed and add-on want to ignore */ + AE_DSP_ERROR_NOT_IMPLEMENTED = -3, /*!< @brief the method that KODI called is not implemented by the add-on */ + AE_DSP_ERROR_REJECTED = -4, /*!< @brief the command was rejected by the DSP */ + AE_DSP_ERROR_INVALID_PARAMETERS = -5, /*!< @brief the parameters of the method that was called are invalid for this operation */ + AE_DSP_ERROR_INVALID_SAMPLERATE = -6, /*!< @brief the processed samplerate is not supported */ + AE_DSP_ERROR_INVALID_IN_CHANNELS = -7, /*!< @brief the processed input channel format is not supported */ + AE_DSP_ERROR_INVALID_OUT_CHANNELS = -8, /*!< @brief the processed output channel format is not supported */ + AE_DSP_ERROR_FAILED = -9, /*!< @brief the command failed */ + } AE_DSP_ERROR; + + /*! + * @brief The possible DSP channels (used as pointer inside arrays) + */ + typedef enum + { + AE_DSP_CH_INVALID = -1, + AE_DSP_CH_FL = 0, + AE_DSP_CH_FR, + AE_DSP_CH_FC, + AE_DSP_CH_LFE, + AE_DSP_CH_BL, + AE_DSP_CH_BR, + AE_DSP_CH_FLOC, + AE_DSP_CH_FROC, + AE_DSP_CH_BC, + AE_DSP_CH_SL, + AE_DSP_CH_SR, + AE_DSP_CH_TFL, + AE_DSP_CH_TFR, + AE_DSP_CH_TFC, + AE_DSP_CH_TC, + AE_DSP_CH_TBL, + AE_DSP_CH_TBR, + AE_DSP_CH_TBC, + AE_DSP_CH_BLOC, + AE_DSP_CH_BROC, + + AE_DSP_CH_MAX + } AE_DSP_CHANNEL; + + /*! + * @brief Present channel flags + */ + typedef enum + { + AE_DSP_PRSNT_CH_UNDEFINED = 0, + AE_DSP_PRSNT_CH_FL = 1<<0, + AE_DSP_PRSNT_CH_FR = 1<<1, + AE_DSP_PRSNT_CH_FC = 1<<2, + AE_DSP_PRSNT_CH_LFE = 1<<3, + AE_DSP_PRSNT_CH_BL = 1<<4, + AE_DSP_PRSNT_CH_BR = 1<<5, + AE_DSP_PRSNT_CH_FLOC = 1<<6, + AE_DSP_PRSNT_CH_FROC = 1<<7, + AE_DSP_PRSNT_CH_BC = 1<<8, + AE_DSP_PRSNT_CH_SL = 1<<9, + AE_DSP_PRSNT_CH_SR = 1<<10, + AE_DSP_PRSNT_CH_TFL = 1<<11, + AE_DSP_PRSNT_CH_TFR = 1<<12, + AE_DSP_PRSNT_CH_TFC = 1<<13, + AE_DSP_PRSNT_CH_TC = 1<<14, + AE_DSP_PRSNT_CH_TBL = 1<<15, + AE_DSP_PRSNT_CH_TBR = 1<<16, + AE_DSP_PRSNT_CH_TBC = 1<<17, + AE_DSP_PRSNT_CH_BLOC = 1<<18, + AE_DSP_PRSNT_CH_BROC = 1<<19 + } AE_DSP_CHANNEL_PRESENT; + + /** + * @brief The various stream type formats + * Used for audio DSP processing to know input audio type + */ + typedef enum + { + AE_DSP_ASTREAM_INVALID = -1, + AE_DSP_ASTREAM_BASIC = 0, + AE_DSP_ASTREAM_MUSIC, + AE_DSP_ASTREAM_MOVIE, + AE_DSP_ASTREAM_GAME, + AE_DSP_ASTREAM_APP, + AE_DSP_ASTREAM_PHONE, + AE_DSP_ASTREAM_MESSAGE, + + AE_DSP_ASTREAM_AUTO, + AE_DSP_ASTREAM_MAX + } AE_DSP_STREAMTYPE; + + /*! + * @brief Add-ons supported audio stream type flags + * used on master mode information on AE_DSP_MODES to know + * on which audio stream the master mode is supported + */ + typedef enum + { + AE_DSP_PRSNT_ASTREAM_BASIC = 1<<0, + AE_DSP_PRSNT_ASTREAM_MUSIC = 1<<1, + AE_DSP_PRSNT_ASTREAM_MOVIE = 1<<2, + AE_DSP_PRSNT_ASTREAM_GAME = 1<<3, + AE_DSP_PRSNT_ASTREAM_APP = 1<<4, + AE_DSP_PRSNT_ASTREAM_MESSAGE = 1<<5, + AE_DSP_PRSNT_ASTREAM_PHONE = 1<<6, + } AE_DSP_ASTREAM_PRESENT; + + /** + * @brief The various base type formats + * Used for audio DSP processing to know input audio source + */ + typedef enum + { + AE_DSP_ABASE_INVALID = -1, + AE_DSP_ABASE_STEREO = 0, + AE_DSP_ABASE_MONO, + AE_DSP_ABASE_MULTICHANNEL, + AE_DSP_ABASE_AC3, + AE_DSP_ABASE_EAC3, + AE_DSP_ABASE_DTS, + AE_DSP_ABASE_DTSHD_MA, + AE_DSP_ABASE_DTSHD_HRA, + AE_DSP_ABASE_TRUEHD, + AE_DSP_ABASE_MLP, + AE_DSP_ABASE_FLAC, + + AE_DSP_ABASE_MAX + } AE_DSP_BASETYPE; + + + /** + * @brief The from KODI in settings requested audio process quality. + * The KODI internal used quality levels is translated to this values + * for usage on DSP processing add-ons. Is present on iQualityLevel + * inside AE_DSP_SETTINGS. + */ + typedef enum + { + AE_DSP_QUALITY_UNKNOWN = -1, /*!< @brief Unset, unknown or incorrect quality level */ + AE_DSP_QUALITY_DEFAULT = 0, /*!< @brief Engine's default quality level */ + + /* Basic quality levels */ + AE_DSP_QUALITY_LOW = 20, /*!< @brief Low quality level */ + AE_DSP_QUALITY_MID = 30, /*!< @brief Standard quality level */ + AE_DSP_QUALITY_HIGH = 50, /*!< @brief Best sound processing quality */ + + /* Optional quality levels */ + AE_DSP_QUALITY_REALLYHIGH = 100 /*!< @brief Uncompromising optional quality level, usually with unmeasurable and unnoticeable improvement */ + } AE_DSP_QUALITY; + + /*! + * @brief Audio DSP menu hook categories. + * Used to identify on AE_DSP_MENUHOOK given add-on related skin dialog/windows. + * Except AE_DSP_MENUHOOK_ALL and AE_DSP_MENUHOOK_SETTING are the menus available + * from DSP playback dialogue which can be opened over KODI file context menu and over + * button on full screen OSD window. + * + * Menu hook AE_DSP_MENUHOOK_SETTING is available from DSP processing setup dialogue. + */ + typedef enum + { + AE_DSP_MENUHOOK_UNKNOWN =-1, /*!< @brief unknown menu hook */ + AE_DSP_MENUHOOK_ALL = 0, /*!< @brief all categories */ + AE_DSP_MENUHOOK_PRE_PROCESS = 1, /*!< @brief for pre processing */ + AE_DSP_MENUHOOK_MASTER_PROCESS = 2, /*!< @brief for master processing */ + AE_DSP_MENUHOOK_POST_PROCESS = 3, /*!< @brief for post processing */ + AE_DSP_MENUHOOK_RESAMPLE = 4, /*!< @brief for re sample */ + AE_DSP_MENUHOOK_MISCELLANEOUS = 5, /*!< @brief for miscellaneous dialogues */ + AE_DSP_MENUHOOK_INFORMATION = 6, /*!< @brief dialogue to show processing information */ + AE_DSP_MENUHOOK_SETTING = 7, /*!< @brief for settings */ + } AE_DSP_MENUHOOK_CAT; + + /*! + * @brief Menu hooks that are available in the menus while playing a stream via this add-on. + */ + typedef struct AE_DSP_MENUHOOK + { + unsigned int iHookId; /*!< @brief (required) this hook's identifier */ + unsigned int iLocalizedStringId; /*!< @brief (required) the id of the label for this hook in g_localizeStrings */ + AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) category of menu hook */ + unsigned int iRelevantModeId; /*!< @brief (required) except category AE_DSP_MENUHOOK_SETTING and AE_DSP_MENUHOOK_ALL must be the related mode id present here */ + bool bNeedPlayback; /*!< @brief (required) set to true if menu hook need playback and active processing */ + } ATTRIBUTE_PACKED AE_DSP_MENUHOOK; + + /*! + * @brief Properties passed to the Create() method of an add-on. + */ + typedef struct AE_DSP_PROPERTIES + { + const char* strUserPath; /*!< @brief path to the user profile */ + const char* strAddonPath; /*!< @brief path to this add-on */ + } AE_DSP_PROPERTIES; + + /*! + * @brief Audio DSP add-on capabilities. All capabilities are set to "false" as default. + * If a capability is set to true, then the corresponding methods from kodi_audiodsp_dll.h need to be implemented. + */ + typedef struct AE_DSP_ADDON_CAPABILITIES + { + bool bSupportsInputProcess; /*!< @brief true if this add-on provides audio input processing */ + bool bSupportsInputResample; /*!< @brief true if this add-on provides audio resample before master handling */ + bool bSupportsPreProcess; /*!< @brief true if this add-on provides audio pre processing */ + bool bSupportsMasterProcess; /*!< @brief true if this add-on provides audio master processing */ + bool bSupportsPostProcess; /*!< @brief true if this add-on provides audio post processing */ + bool bSupportsOutputResample; /*!< @brief true if this add-on provides audio re sample after master handling */ + } ATTRIBUTE_PACKED AE_DSP_ADDON_CAPABILITIES; + + /*! + * @brief Audio processing settings for in and out arrays + * Send on creation and before first processed audio packet to add-on + */ + typedef struct AE_DSP_SETTINGS + { + AE_DSP_STREAM_ID iStreamID; /*!< @brief id of the audio stream packets */ + AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */ + int iInChannels; /*!< @brief the amount of input channels */ + unsigned long lInChannelPresentFlags; /*!< @brief the exact channel mapping flags of input */ + int iInFrames; /*!< @brief the input frame size from KODI */ + unsigned int iInSamplerate; /*!< @brief the basic sample rate of the audio packet */ + int iProcessFrames; /*!< @brief the processing frame size inside add-on's */ + unsigned int iProcessSamplerate; /*!< @brief the sample rate after input resample present in master processing */ + int iOutChannels; /*!< @brief the amount of output channels */ + unsigned long lOutChannelPresentFlags; /*!< @brief the exact channel mapping flags for output */ + int iOutFrames; /*!< @brief the final out frame size for KODI */ + unsigned int iOutSamplerate; /*!< @brief the final sample rate of the audio packet */ + bool bInputResamplingActive; /*!< @brief if a re-sampling is performed before master processing this flag is set to true */ + bool bStereoUpmix; /*!< @brief true if the stereo upmix setting on kodi is set */ + int iQualityLevel; /*!< @brief the from KODI selected quality level for signal processing */ + /*! + * @note about "iProcessSamplerate" and "iProcessFrames" is set from KODI after call of StreamCreate on input re sample add-on, if re-sampling + * and processing is handled inside the same add-on, this value must be ignored! + */ + } ATTRIBUTE_PACKED AE_DSP_SETTINGS; + + /*! + * @brief Stream profile properties + * Can be used to detect best master processing mode and for post processing methods. + */ +//@{ + + /*! + * @brief Dolby profile types. Given from several formats, e.g. Dolby Digital or TrueHD + * Used on AE_DSP_PROFILE_AC3_EAC3 and AE_DSP_PROFILE_MLP_TRUEHD + */ + #define AE_DSP_PROFILE_DOLBY_NONE 0 + #define AE_DSP_PROFILE_DOLBY_SURROUND 1 + #define AE_DSP_PROFILE_DOLBY_PLII 2 + #define AE_DSP_PROFILE_DOLBY_PLIIX 3 + #define AE_DSP_PROFILE_DOLBY_PLIIZ 4 + #define AE_DSP_PROFILE_DOLBY_EX 5 + #define AE_DSP_PROFILE_DOLBY_HEADPHONE 6 + + /*! + * @brief DTS/DTS HD profile types + * Used on AE_DSP_PROFILE_DTS_DTSHD + */ + #define AE_DSP_PROFILE_DTS 0 + #define AE_DSP_PROFILE_DTS_ES 1 + #define AE_DSP_PROFILE_DTS_96_24 2 + #define AE_DSP_PROFILE_DTS_HD_HRA 3 + #define AE_DSP_PROFILE_DTS_HD_MA 4 + + /*! + * @brief AC3/EAC3 based service types + * Used on AE_DSP_PROFILE_AC3_EAC3 + */ + #define AE_DSP_SERVICE_TYPE_MAIN 0 + #define AE_DSP_SERVICE_TYPE_EFFECTS 1 + #define AE_DSP_SERVICE_TYPE_VISUALLY_IMPAIRED 2 + #define AE_DSP_SERVICE_TYPE_HEARING_IMPAIRED 3 + #define AE_DSP_SERVICE_TYPE_DIALOGUE 4 + #define AE_DSP_SERVICE_TYPE_COMMENTARY 5 + #define AE_DSP_SERVICE_TYPE_EMERGENCY 6 + #define AE_DSP_SERVICE_TYPE_VOICE_OVER 7 + #define AE_DSP_SERVICE_TYPE_KARAOKE 8 + + /*! + * @brief AC3/EAC3 based room types + * Present on AE_DSP_PROFILE_AC3_EAC3 and can be used for frequency corrections + * at post processing, e.g. THX Re-Equalization + */ + #define AE_DSP_ROOM_TYPE_UNDEFINED 0 + #define AE_DSP_ROOM_TYPE_SMALL 1 + #define AE_DSP_ROOM_TYPE_LARGE 2 + + /*! + * @brief AC3/EAC3 stream profile properties + */ + //! @todo add handling for it (currently never becomes set) + typedef struct AE_DSP_PROFILE_AC3_EAC3 + { + unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */ + unsigned int iServiceType; /*!< defined by AE_DSP_SERVICE_TYPE_* */ + unsigned int iRoomType; /*!< defined by AE_DSP_ROOM_TYPE_* (NOTICE: Information about it currently not supported from ffmpeg and must be implemented) */ + } ATTRIBUTE_PACKED AE_DSP_PROFILE_AC3_EAC3; + + /*! + * @brief MLP/Dolby TrueHD stream profile properties + */ + //! @todo add handling for it (currently never becomes set) + typedef struct AE_DSP_PROFILE_MLP_TRUEHD + { + unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */ + } ATTRIBUTE_PACKED AE_DSP_PROFILE_MLP_TRUEHD; + + /*! + * @brief DTS/DTS HD stream profile properties + */ + //! @todo add handling for it (currently never becomes set) + typedef struct AE_DSP_PROFILE_DTS_DTSHD + { + unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DTS* */ + bool bSurroundMatrix; /*!< if set to true given 2.0 stream is surround encoded */ + } ATTRIBUTE_PACKED AE_DSP_PROFILE_DTS_DTSHD; + + union AE_DSP_PROFILE + { + AE_DSP_PROFILE_AC3_EAC3 ac3_eac3; /*!< Dolby Digital/Digital+ profile data */ + AE_DSP_PROFILE_MLP_TRUEHD mlp_truehd; /*!< MLP or Dolby TrueHD profile data */ + AE_DSP_PROFILE_DTS_DTSHD dts_dtshd; /*!< DTS/DTS-HD profile data */ + }; + //@} + + /*! + * @brief Audio DSP stream properties + * Used to check for the DSP add-on that the stream is supported, + * as example Dolby Digital Ex processing is only required on Dolby Digital with 5.1 layout + */ + typedef struct AE_DSP_STREAM_PROPERTIES + { + AE_DSP_STREAM_ID iStreamID; /*!< @brief stream id of the audio stream packets */ + AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */ + int iBaseType; /*!< @brief the input stream base type source eg, Dolby Digital */ + const char* strName; /*!< @brief the audio stream name */ + const char* strCodecId; /*!< @brief codec id string of the audio stream */ + const char* strLanguage; /*!< @brief language id of the audio stream */ + int iIdentifier; /*!< @brief audio stream id inside player */ + int iChannels; /*!< @brief amount of basic channels */ + int iSampleRate; /*!< @brief sample rate */ + AE_DSP_PROFILE Profile; /*!< @brief current running stream profile data */ + } ATTRIBUTE_PACKED AE_DSP_STREAM_PROPERTIES; + + /*! + * @brief Audio DSP mode categories + */ + typedef enum + { + AE_DSP_MODE_TYPE_UNDEFINED = -1, /*!< @brief undefined type, never be used from add-on! */ + AE_DSP_MODE_TYPE_INPUT_RESAMPLE = 0, /*!< @brief for input re sample */ + AE_DSP_MODE_TYPE_PRE_PROCESS = 1, /*!< @brief for preprocessing */ + AE_DSP_MODE_TYPE_MASTER_PROCESS = 2, /*!< @brief for master processing */ + AE_DSP_MODE_TYPE_POST_PROCESS = 3, /*!< @brief for post processing */ + AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE = 4, /*!< @brief for output re sample */ + AE_DSP_MODE_TYPE_MAX = 5 + } AE_DSP_MODE_TYPE; + + /*! + * @brief Audio DSP master mode information + * Used to get all available modes for current input stream + */ + typedef struct AE_DSP_MODES + { + unsigned int iModesCount; /*!< @brief (required) count of how much modes are in AE_DSP_MODES */ + struct AE_DSP_MODE + { + int iUniqueDBModeId; /*!< @brief (required) the inside add-on used identifier for the mode, set by KODI's audio DSP database */ + AE_DSP_MODE_TYPE iModeType; /*!< @brief (required) the processong mode type, see AE_DSP_MODE_TYPE */ + char strModeName[AE_DSP_ADDON_STRING_LENGTH]; /*!< @brief (required) the addon name of the mode, used on KODI's logs */ + + unsigned int iModeNumber; /*!< @brief (required) number of this mode on the add-on, is used on process functions with value "mode_id" */ + unsigned int iModeSupportTypeFlags; /*!< @brief (required) flags about supported input types for this mode, see AE_DSP_ASTREAM_PRESENT */ + bool bHasSettingsDialog; /*!< @brief (required) if setting dialog(s) are available it must be set to true */ + 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 */ + + unsigned int iModeName; /*!< @brief (required) the name id of the mode for this hook in g_localizeStrings */ + unsigned int iModeSetupName; /*!< @brief (optional) the name id of the mode inside settings for this hook in g_localizeStrings */ + unsigned int iModeDescription; /*!< @brief (optional) the description id of the mode for this hook in g_localizeStrings */ + unsigned int iModeHelp; /*!< @brief (optional) help string id for inside DSP settings dialog of the mode for this hook in g_localizeStrings */ + + char strOwnModeImage[AE_DSP_ADDON_STRING_LENGTH]; /*!< @brief (optional) flag image for the mode */ + 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) */ + } mode[AE_DSP_STREAM_MAX_MODES]; /*!< @brief Modes array storage */ + } ATTRIBUTE_PACKED AE_DSP_MODES; + + /*! + * @brief Audio DSP menu hook data + */ + typedef struct AE_DSP_MENUHOOK_DATA + { + AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) related menuhook data category */ + union data { + AE_DSP_STREAM_ID iStreamId; /*!< @brief currently only stream id is used, is used as union to have extension possibility */ + } data; /*!< @brief related category related data */ + } ATTRIBUTE_PACKED AE_DSP_MENUHOOK_DATA; + + /*! + * @brief Structure to transfer the methods from kodi_audiodsp_dll.h to KODI + */ + struct AudioDSP + { + const char* (__cdecl* GetAudioDSPAPIVersion) (void); + const char* (__cdecl* GetMinimumAudioDSPAPIVersion) (void); + const char* (__cdecl* GetGUIAPIVersion) (void); + const char* (__cdecl* GetMinimumGUIAPIVersion) (void); + AE_DSP_ERROR (__cdecl* GetAddonCapabilities) (AE_DSP_ADDON_CAPABILITIES*); + const char* (__cdecl* GetDSPName) (void); + const char* (__cdecl* GetDSPVersion) (void); + AE_DSP_ERROR (__cdecl* MenuHook) (const AE_DSP_MENUHOOK&, const AE_DSP_MENUHOOK_DATA&); + + AE_DSP_ERROR (__cdecl* StreamCreate) (const AE_DSP_SETTINGS*, const AE_DSP_STREAM_PROPERTIES*, ADDON_HANDLE); + AE_DSP_ERROR (__cdecl* StreamDestroy) (const ADDON_HANDLE); + AE_DSP_ERROR (__cdecl* StreamIsModeSupported) (const ADDON_HANDLE, AE_DSP_MODE_TYPE, unsigned int, int); + AE_DSP_ERROR (__cdecl* StreamInitialize) (const ADDON_HANDLE, const AE_DSP_SETTINGS*); + + bool (__cdecl* InputProcess) (const ADDON_HANDLE, const float**, unsigned int); + + unsigned int (__cdecl* InputResampleProcessNeededSamplesize) (const ADDON_HANDLE); + unsigned int (__cdecl* InputResampleProcess) (const ADDON_HANDLE, float**, float**, unsigned int); + float (__cdecl* InputResampleGetDelay) (const ADDON_HANDLE); + int (__cdecl* InputResampleSampleRate) (const ADDON_HANDLE); + + unsigned int (__cdecl* PreProcessNeededSamplesize) (const ADDON_HANDLE, unsigned int); + float (__cdecl* PreProcessGetDelay) (const ADDON_HANDLE, unsigned int); + unsigned int (__cdecl* PreProcess) (const ADDON_HANDLE, unsigned int, float**, float**, unsigned int); + + AE_DSP_ERROR (__cdecl* MasterProcessSetMode) (const ADDON_HANDLE, AE_DSP_STREAMTYPE, unsigned int, int); + unsigned int (__cdecl* MasterProcessNeededSamplesize) (const ADDON_HANDLE); + float (__cdecl* MasterProcessGetDelay) (const ADDON_HANDLE); + int (__cdecl* MasterProcessGetOutChannels) (const ADDON_HANDLE, unsigned long&); + unsigned int (__cdecl* MasterProcess) (const ADDON_HANDLE, float**, float**, unsigned int); + const char* (__cdecl* MasterProcessGetStreamInfoString) (const ADDON_HANDLE); + + unsigned int (__cdecl* PostProcessNeededSamplesize) (const ADDON_HANDLE, unsigned int); + float (__cdecl* PostProcessGetDelay) (const ADDON_HANDLE, unsigned int); + unsigned int (__cdecl* PostProcess) (const ADDON_HANDLE, unsigned int, float**, float**, unsigned int); + + unsigned int (__cdecl* OutputResampleProcessNeededSamplesize)(const ADDON_HANDLE); + unsigned int (__cdecl* OutputResampleProcess) (const ADDON_HANDLE, float**, float**, unsigned int); + float (__cdecl* OutputResampleGetDelay) (const ADDON_HANDLE); + int (__cdecl* OutputResampleSampleRate) (const ADDON_HANDLE); + }; + +#ifdef __cplusplus +} +#endif + diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h new file mode 100644 index 0000000..78bc3cc --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2005-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#pragma once + +#include +#include "xbmc_addon_dll.h" +#include "kodi_audiodec_types.h" + +extern "C" +{ + //! \copydoc AudioDecoder::Init + void* Init(const char* file, unsigned int filecache, int* channels, + int* samplerate, int* bitspersample, int64_t* totaltime, + int* bitrate, AEDataFormat* format, const AEChannel** channelinfo); + + //! \copydoc AudioDecoder::ReadPCM + int ReadPCM(void* context, uint8_t* buffer, int size, int* actualsize); + + //! \copydoc AudioDecoder::Seek + int64_t Seek(void* context, int64_t time); + + //! \copydoc AudioDecoder::ReadTag + bool ReadTag(const char* file, char* title, + char* artist, int* length); + + //! \copydoc AudioDecoder::TrackCount + int TrackCount(const char* file); + + //! \copydoc AudioDecoder::DeInit + bool DeInit(void* context); + + // function to export the above structure to XBMC + void __declspec(dllexport) get_addon(struct AudioDecoder* pScr) + { + pScr->Init = Init; + pScr->ReadPCM = ReadPCM; + pScr->Seek = Seek; + pScr->ReadTag = ReadTag; + pScr->TrackCount = TrackCount; + pScr->DeInit = DeInit; + }; +}; diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h new file mode 100644 index 0000000..82d71e5 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2005-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#pragma once + +#include +#ifdef BUILD_KODI_ADDON +#include "AEChannelData.h" +#else +#include "cores/AudioEngine/Utils/AEChannelData.h" +#endif + +extern "C" +{ + struct AUDIODEC_INFO + { + int dummy; + }; + + struct AUDIODEC_PROPS + { + int dummy; + }; + + struct AudioDecoder + { + //! \brief Initialize a decoder + //! \param file The file to read + //! \param filecache The file cache size + //! \param channels Number of channels in output stream + //! \param samplerate Samplerate of output stream + //! \param bitspersample Bits per sample in output stream + //! \param totaltime Total time for stream + //! \param bitrate Average bitrate of input stream + //! \param format Data format for output stream + //! \param info Channel mapping for output stream + //! \return Context of output stream + //! \sa ICodec::Init + void* (__cdecl* Init) (const char* file, unsigned int filecache, + int* channels, int* samplerate, + int* bitspersample, int64_t* totaltime, + int* bitrate, AEDataFormat* format, + const AEChannel** info); + + //! \brief Produce some noise + //! \param context Context of output stream + //! \param buffer Output buffer + //! \param size Size of output buffer + //! \param actualsize Actual number of bytes written to output buffer + //! \return 0 on success, -1 on end of stream, 1 on failure + //! \sa ICodec::ReadPCM + int (__cdecl* ReadPCM) (void* context, uint8_t* buffer, int size, int* actualsize); + + + //! \brief Seek in output stream + //! \param context Context of output stream + //! \param time Time position to seek to in milliseconds + //! \return Time position seek ended up on + //! \sa ICodec::Seek + int64_t (__cdecl* Seek) (void* context, int64_t time); + + //! \brief Read tag of a file + //! \param file File to read tag for + //! \param title Title of file + //! \param artist Artist of file + //! \param length Length of file + //! \return True on success, false on failure + //! \sa IMusicInfoTagLoader::ReadTag + bool (__cdecl* ReadTag)(const char* file, char* title, + char* artist, int* length); + + //! \brief Get number of tracks in a file + //! \param file File to read tag for + //! \return Number of tracks in file + //! \sa CMusicFileDirectory + int (__cdecl* TrackCount) (const char* file); + + //! \brief Close down an output stream + //! \param context Context of stream + //! \return True on success, false on failure + //! \sa ICodec::DeInit + bool (__cdecl* DeInit)(void* context); + }; +} 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 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +/*! + * Common data structures shared between KODI and KODI's binary add-ons + */ + +#ifdef BUILD_KODI_ADDON + #include "kodi/AudioEngine/AEChannelInfo.h" +#else + #include "cores/AudioEngine/Utils/AEChannelInfo.h" +#endif + +#ifdef TARGET_WINDOWS +#include +#else +#ifndef __cdecl +#define __cdecl +#endif +#ifndef __declspec +#define __declspec(X) +#endif +#endif + +#include + +#undef ATTRIBUTE_PACKED +#undef PRAGMA_PACK_BEGIN +#undef PRAGMA_PACK_END + +#if defined(__GNUC__) +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define ATTRIBUTE_PACKED __attribute__ ((packed)) +#define PRAGMA_PACK 0 +#endif +#endif + +#if !defined(ATTRIBUTE_PACKED) +#define ATTRIBUTE_PACKED +#define PRAGMA_PACK 1 +#endif + +/* current Audio DSP API version */ +#define KODI_AUDIOENGINE_API_VERSION "0.0.1" + +/* min. Audio DSP API version */ +#define KODI_AUDIOENGINE_MIN_API_VERSION "0.0.1" + + +#ifdef __cplusplus +extern "C" { +#endif + + /** + * A stream handle pointer, which is only used internally by the addon stream handle + */ + typedef void AEStreamHandle; + + /** + * The audio format structure that fully defines a stream's audio information + */ + typedef struct AudioEngineFormat + { + /** + * The stream's data format (eg, AE_FMT_S16LE) + */ + enum AEDataFormat m_dataFormat; + + /** + * The stream's sample rate (eg, 48000) + */ + unsigned int m_sampleRate; + + /** + * The encoded streams sample rate if a bitstream, otherwise undefined + */ + unsigned int m_encodedRate; + + /** + * The amount of used speaker channels + */ + unsigned int m_channelCount; + + /** + * The stream's channel layout + */ + enum AEChannel m_channels[AE_CH_MAX]; + + /** + * The number of frames per period + */ + unsigned int m_frames; + + /** + * The size of one frame in bytes + */ + unsigned int m_frameSize; + + AudioEngineFormat() + { + m_dataFormat = AE_FMT_INVALID; + m_sampleRate = 0; + m_encodedRate = 0; + m_frames = 0; + m_frameSize = 0; + m_channelCount = 0; + + for (unsigned int ch = 0; ch < AE_CH_MAX; ch++) + { + m_channels[ch] = AE_CH_NULL; + } + } + + bool compareFormat(const AudioEngineFormat *fmt) + { + if (!fmt) + { + return false; + } + + if (m_dataFormat != fmt->m_dataFormat || + m_sampleRate != fmt->m_sampleRate || + m_encodedRate != fmt->m_encodedRate || + m_frames != fmt->m_frames || + m_frameSize != fmt->m_frameSize || + m_channelCount != fmt->m_channelCount) + { + return false; + } + + for (unsigned int ch = 0; ch < AE_CH_MAX; ch++) + { + if (fmt->m_channels[ch] != m_channels[ch]) + { + return false; + } + } + + return true; + } + } AudioEngineFormat; + +#ifdef __cplusplus +} +#endif + 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 @@ +#pragma once + +/* +* Copyright (C) 2005-2016 Team Kodi +* http://kodi.tv +* +* This Program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2, or (at your option) +* any later version. +* +* This Program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Kodi; see the file COPYING. If not, see +* . +* +*/ + +#include "kodi_inputstream_types.h" +#include "xbmc_addon_dll.h" + +/*! +* Functions that the InputStream client add-on must implement, but some can be empty. +* +* The 'remarks' field indicates which methods should be implemented, and which ones are optional. +*/ + +extern "C" +{ + /*! + * Open a stream. + * @param props + * @return True if the stream has been opened successfully, false otherwise. + * @remarks + */ + bool Open(INPUTSTREAM& props); + + /*! + * Close an open stream. + * @remarks + */ + void Close(void); + + /*! + * Get path/url for this addon. + * @remarks + */ + const char* GetPathList(void); + + /*! + * Get Capabilities of this addon. + * @remarks + */ + struct INPUTSTREAM_CAPABILITIES GetCapabilities(); + + + /*! + * Get IDs of available streams + * @remarks + */ + INPUTSTREAM_IDS GetStreamIds(); + + /*! + * Get stream properties of a stream. + * @param streamId unique id of stream + * @return struc of stream properties + * @remarks + */ + INPUTSTREAM_INFO GetStream(int streamid); + + /*! + * Enable or disable a stream. + * A disabled stream does not send demux packets + * @param streamId unique id of stream + * @param enable true for enable, false for disable + * @remarks + */ + void EnableStream(int streamid, bool enable); + + /*! + * Enables a stream at the given PTS. + * @param streamId unique id of stream + * @param pts position in stream in microseconds + * @remarks will only be called if CAPABILITIES::m_supportsEnableAtPTS is set to true + */ + void EnableStreamAtPTS(int streamid, uint64_t pts); + + /*! + * Reset the demultiplexer in the add-on. + * @remarks Required if bHandlesDemuxing is set to true. + */ + void DemuxReset(void); + + /*! + * Abort the demultiplexer thread in the add-on. + * @remarks Required if bHandlesDemuxing is set to true. + */ + void DemuxAbort(void); + + /*! + * Flush all data that's currently in the demultiplexer buffer in the add-on. + * @remarks Required if bHandlesDemuxing is set to true. + */ + void DemuxFlush(void); + + /*! + * Read the next packet from the demultiplexer, if there is one. + * @return The next packet. + * If there is no next packet, then the add-on should return the + * packet created by calling AllocateDemuxPacket(0) on the callback. + * If the stream changed and XBMC's player needs to be reinitialised, + * then, the add-on should call AllocateDemuxPacket(0) on the + * callback, and set the streamid to DMX_SPECIALID_STREAMCHANGE and + * return the value. + * The add-on should return NULL if an error occured. + * @remarks Return NULL if this add-on won't provide this function. + */ + DemuxPacket* DemuxRead(void); + + /*! + * Notify the InputStream addon/demuxer that XBMC wishes to seek the stream by time + * Demuxer is required to set stream to an IDR frame + * @param time The absolute time since stream start + * @param backwards True to seek to keyframe BEFORE time, else AFTER + * @param startpts can be updated to point to where display should start + * @return True if the seek operation was possible + * @remarks Optional, and only used if addon has its own demuxer. + */ + bool DemuxSeekTime(int time, bool backwards, double *startpts); + + /*! + * Notify the InputStream addon/demuxer that XBMC wishes to change playback speed + * @param speed The requested playback speed + * @remarks Optional, and only used if addon has its own demuxer. + */ + void DemuxSetSpeed(int speed); + + + /*! + * Totel time in ms + * @remarks + */ + int GetTotalTime(); + + /*! + * Playing time in ms + * @remarks + */ + int GetTime(); + + /*! + * Positions inputstream to playing time given in ms + * @remarks + */ + bool PosTime(int ms); + + + /*! + * Check if the backend support pausing the currently playing stream + * This will enable/disable the pause button in XBMC based on the return value + * @return false if the InputStream addon/backend does not support pausing, true if possible + */ + bool CanPauseStream(); + + /*! + * Check if the backend supports seeking for the currently playing stream + * This will enable/disable the rewind/forward buttons in XBMC based on the return value + * @return false if the InputStream addon/backend does not support seeking, true if possible + */ + bool CanSeekStream(); + + + /*! + * Read from an open stream. + * @param pBuffer The buffer to store the data in. + * @param iBufferSize The amount of bytes to read. + * @return The amount of bytes that were actually read from the stream. + * @remarks Return -1 if this add-on won't provide this function. + */ + int ReadStream(uint8_t* pBuffer, unsigned int iBufferSize); + + /*! + * Seek in a stream. + * @param iPosition The position to seek to. + * @param iWhence ? + * @return The new position. + * @remarks Return -1 if this add-on won't provide this function. + */ + int64_t SeekStream(int64_t iPosition, int iWhence = SEEK_SET); + + /*! + * @return The position in the stream that's currently being read. + * @remarks Return -1 if this add-on won't provide this function. + */ + int64_t PositionStream(void); + + /*! + * @return The total length of the stream that's currently being read. + * @remarks Return -1 if this add-on won't provide this function. + */ + int64_t LengthStream(void); + + + /*! + * @brief Notify the InputStream addon that XBMC (un)paused the currently playing stream + */ + void PauseStream(double time); + + + /*! + * Check for real-time streaming + * @return true if current stream is real-time + */ + bool IsRealTimeStream(); + + /*! + * Called by XBMC to assign the function pointers of this add-on to pClient. + * @param pClient The struct to assign the function pointers to. + */ + void __declspec(dllexport) get_addon(struct InputStreamAddonFunctions* pClient) + { + pClient->Open = Open; + pClient->Close = Close; + pClient->GetPathList = GetPathList; + pClient->GetCapabilities = GetCapabilities; + + pClient->GetStreamIds = GetStreamIds; + pClient->GetStream = GetStream; + pClient->EnableStream = EnableStream; + pClient->EnableStreamAtPTS = EnableStreamAtPTS; + pClient->DemuxReset = DemuxReset; + pClient->DemuxAbort = DemuxAbort; + pClient->DemuxFlush = DemuxFlush; + pClient->DemuxRead = DemuxRead; + pClient->DemuxSeekTime = DemuxSeekTime; + pClient->DemuxSetSpeed = DemuxSetSpeed; + + pClient->GetTotalTime = GetTotalTime; + pClient->GetTime = GetTime; + + pClient->PosTime = PosTime; + + pClient->CanPauseStream = CanPauseStream; + pClient->CanSeekStream = CanSeekStream; + + pClient->ReadStream = ReadStream; + pClient->SeekStream = SeekStream; + pClient->PositionStream = PositionStream; + pClient->LengthStream = LengthStream; + pClient->PauseStream = PauseStream; + pClient->IsRealTimeStream = IsRealTimeStream; + }; +}; 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 @@ +#pragma once + +/* + * Copyright (C) 2005-2016 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +#ifndef __cdecl +#define __cdecl +#endif + +#ifdef BUILD_KODI_ADDON +#include "DVDDemuxPacket.h" +#else +#include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h" +#endif + +extern "C" { + + // this are properties given to the addon on create + // at this time we have no parameters for the addon + typedef struct INPUTSTREAM_PROPS + { + int dummy; + } INPUTSTREAM_PROPS; + + /*! + * @brief InputStream add-on capabilities. All capabilities are set to "false" as default. + */ + typedef struct INPUTSTREAM_CAPABILITIES + { + bool m_supportsIDemux; /*!< @brief supports interface IDemux */ + bool m_supportsIPosTime; /*!< @brief supports interface IPosTime */ + bool m_supportsIDisplayTime; /*!< @brief supports interface IDisplayTime */ + bool m_supportsSeek; /*!< @brief supports seek */ + bool m_supportsPause; /*!< @brief supports pause */ + bool m_supportsEnableAtPTS; /*!< @brief supports enabling streams at a given PTS time */ + } INPUTSTREAM_CAPABILITIES; + + /*! + * @brief structure of key/value pairs passed to addon on Open() + */ + typedef struct INPUTSTREAM + { + static const unsigned int MAX_INFO_COUNT = 8; + + const char *m_strURL; + + unsigned int m_nCountInfoValues; + struct LISTITEMPROPERTY + { + const char *m_strKey; + const char *m_strValue; + } m_ListItemProperties[MAX_INFO_COUNT]; + } INPUTSTREAM; + + /*! + * @brief Array of stream IDs + */ + typedef struct INPUTSTREAM_IDS + { + static const unsigned int MAX_STREAM_COUNT = 32; + unsigned int m_streamCount; + unsigned int m_streamIds[MAX_STREAM_COUNT]; + } INPUTSTREAM_IDS; + + /*! + * @brief stream properties + */ + typedef struct INPUTSTREAM_INFO + { + enum STREAM_TYPE + { + TYPE_NONE, + TYPE_VIDEO, + TYPE_AUDIO, + TYPE_SUBTITLE, + TYPE_TELETEXT + } m_streamType; + + char m_codecName[32]; /*!< @brief (required) name of codec according to ffmpeg */ + char m_codecInternalName[32]; /*!< @brief (optional) internal name of codec (selectionstream info) */ + unsigned int m_pID; /*!< @brief (required) physical index */ + unsigned int m_Bandwidth; /*!< @brief (optional) bandwidth of the stream (selectionstream info) */ + + const uint8_t *m_ExtraData; + unsigned int m_ExtraSize; + + char m_language[4]; /*!< @brief ISO 639 3-letter language code (empty string if undefined) */ + + unsigned int m_FpsScale; /*!< @brief Scale of 1000 and a rate of 29970 will result in 29.97 fps */ + unsigned int m_FpsRate; + unsigned int m_Height; /*!< @brief height of the stream reported by the demuxer */ + unsigned int m_Width; /*!< @brief width of the stream reported by the demuxer */ + float m_Aspect; /*!< @brief display aspect of stream */ + + unsigned int m_Channels; /*!< @brief (required) amount of channels */ + unsigned int m_SampleRate; /*!< @brief (required) sample rate */ + unsigned int m_BitRate; /*!< @brief (required) bit rate */ + unsigned int m_BitsPerSample; /*!< @brief (required) bits per sample */ + unsigned int m_BlockAlign; + } INPUTSTREAM_INFO; + + /*! + * @brief Structure to transfer the methods from xbmc_inputstream_dll.h to XBMC + */ + typedef struct InputStreamAddonFunctions + { + bool (__cdecl* Open)(INPUTSTREAM&); + void (__cdecl* Close)(void); + const char* (__cdecl* GetPathList)(void); + struct INPUTSTREAM_CAPABILITIES (__cdecl* GetCapabilities)(void); + + // IDemux + struct INPUTSTREAM_IDS (__cdecl* GetStreamIds)(); + struct INPUTSTREAM_INFO (__cdecl* GetStream)(int); + void (__cdecl* EnableStream)(int, bool); + void (__cdecl* EnableStreamAtPTS)(int, uint64_t); + void (__cdecl* DemuxReset)(void); + void (__cdecl* DemuxAbort)(void); + void (__cdecl* DemuxFlush)(void); + DemuxPacket* (__cdecl* DemuxRead)(void); + bool (__cdecl* DemuxSeekTime)(int, bool, double*); + void (__cdecl* DemuxSetSpeed)(int); + + // IDisplayTime + int (__cdecl* GetTotalTime)(void); + int (__cdecl* GetTime)(void); + + // IPosTime + bool (__cdecl* PosTime)(int); + + // Seekable (mandatory) + bool (__cdecl* CanPauseStream)(void); + bool (__cdecl* CanSeekStream)(void); + + int (__cdecl* ReadStream)(uint8_t*, unsigned int); + int64_t(__cdecl* SeekStream)(int64_t, int); + int64_t (__cdecl* PositionStream)(void); + int64_t (__cdecl* LengthStream)(void); + void (__cdecl* PauseStream)(double); + bool (__cdecl* IsRealTimeStream)(void); + } InputStreamAddonFunctions; +} + + 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 @@ +#pragma once +/* + * Copyright (C) 2005-2014 Team KODI + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KODI; see the file COPYING. If not, see + * . + * + */ + +#include +#include +#include +#include +#include +#include "kodi_adsp_types.h" +#include "libXBMC_addon.h" + +typedef void* ADSPHANDLE; + +#ifdef _WIN32 +#define ADSP_HELPER_DLL "\\library.kodi.adsp\\libKODI_adsp" ADDON_HELPER_EXT +#else +#define ADSP_HELPER_DLL_NAME "libKODI_adsp-" ADDON_HELPER_ARCH ADDON_HELPER_EXT +#define ADSP_HELPER_DLL "/library.kodi.adsp/" ADSP_HELPER_DLL_NAME +#endif + +class CAddonSoundPlay; + +class CHelper_libKODI_adsp +{ +public: + CHelper_libKODI_adsp(void) + { + m_libKODI_adsp = NULL; + m_Handle = NULL; + } + + ~CHelper_libKODI_adsp(void) + { + if (m_libKODI_adsp) + { + ADSP_unregister_me(m_Handle, m_Callbacks); + dlclose(m_libKODI_adsp); + } + } + + /*! + * @brief Resolve all callback methods + * @param handle Pointer to the add-on + * @return True when all methods were resolved, false otherwise. + */ + bool RegisterMe(void* handle) + { + m_Handle = handle; + + std::string libBasePath; + libBasePath = ((cb_array*)m_Handle)->libPath; + libBasePath += ADSP_HELPER_DLL; + +#if defined(ANDROID) + struct stat st; + if(stat(libBasePath.c_str(),&st) != 0) + { + std::string tempbin = getenv("XBMC_ANDROID_LIBS"); + libBasePath = tempbin + "/" + ADSP_HELPER_DLL_NAME; + } +#endif + + m_libKODI_adsp = dlopen(libBasePath.c_str(), RTLD_LAZY); + if (m_libKODI_adsp == NULL) + { + fprintf(stderr, "Unable to load %s\n", dlerror()); + return false; + } + + ADSP_register_me = (void* (*)(void *HANDLE)) + dlsym(m_libKODI_adsp, "ADSP_register_me"); + if (ADSP_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + ADSP_unregister_me = (void (*)(void* HANDLE, void* CB)) + dlsym(m_libKODI_adsp, "ADSP_unregister_me"); + if (ADSP_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + ADSP_add_menu_hook = (void (*)(void* HANDLE, void* CB, AE_DSP_MENUHOOK *hook)) + dlsym(m_libKODI_adsp, "ADSP_add_menu_hook"); + if (ADSP_add_menu_hook == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + ADSP_remove_menu_hook = (void (*)(void* HANDLE, void* CB, AE_DSP_MENUHOOK *hook)) + dlsym(m_libKODI_adsp, "ADSP_remove_menu_hook"); + if (ADSP_remove_menu_hook == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + ADSP_register_mode = (void (*)(void *HANDLE, void* CB, AE_DSP_MODES::AE_DSP_MODE *modes)) + dlsym(m_libKODI_adsp, "ADSP_register_mode"); + if (ADSP_register_mode == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + ADSP_unregister_mode = (void (*)(void* HANDLE, void* CB, AE_DSP_MODES::AE_DSP_MODE *modes)) + dlsym(m_libKODI_adsp, "ADSP_unregister_mode"); + if (ADSP_unregister_mode == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + ADSP_get_sound_play = (CAddonSoundPlay* (*)(void *HANDLE, void *CB, const char *filename)) + dlsym(m_libKODI_adsp, "ADSP_get_sound_play"); + if (ADSP_get_sound_play == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + ADSP_release_sound_play = (void (*)(CAddonSoundPlay* p)) + dlsym(m_libKODI_adsp, "ADSP_release_sound_play"); + if (ADSP_release_sound_play == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + m_Callbacks = ADSP_register_me(m_Handle); + return m_Callbacks != NULL; + } + + /*! + * @brief Add or replace a menu hook for the context menu for this add-on + * @param hook The hook to add + */ + void AddMenuHook(AE_DSP_MENUHOOK* hook) + { + return ADSP_add_menu_hook(m_Handle, m_Callbacks, hook); + } + + /*! + * @brief Remove a menu hook for the context menu for this add-on + * @param hook The hook to remove + */ + void RemoveMenuHook(AE_DSP_MENUHOOK* hook) + { + return ADSP_remove_menu_hook(m_Handle, m_Callbacks, hook); + } + + /*! + * @brief Add or replace master mode information inside audio dsp database. + * Becomes identifier written inside mode to iModeID if it was 0 (undefined) + * @param mode The master mode to add or update inside database + */ + void RegisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) + { + return ADSP_register_mode(m_Handle, m_Callbacks, mode); + } + + /*! + * @brief Remove a master mode from audio dsp database + * @param mode The Mode to remove + */ + void UnregisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) + { + return ADSP_unregister_mode(m_Handle, m_Callbacks, mode); + } + + /*! + * @brief Open a sound playing class + * @param filename The wav filename to open + */ + CAddonSoundPlay* GetSoundPlay(const char *filename) + { + return ADSP_get_sound_play(m_Handle, m_Callbacks, filename); + } + + /*! + * @brief Remove a played file class + * @param p The playback to remove + */ + void ReleaseSoundPlay(CAddonSoundPlay* p) + { + return ADSP_release_sound_play(p); + } + +protected: + void* (*ADSP_register_me)(void*); + + void (*ADSP_unregister_me)(void*, void*); + void (*ADSP_add_menu_hook)(void*, void*, AE_DSP_MENUHOOK*); + void (*ADSP_remove_menu_hook)(void*, void*, AE_DSP_MENUHOOK*); + void (*ADSP_register_mode)(void*, void*, AE_DSP_MODES::AE_DSP_MODE*); + void (*ADSP_unregister_mode)(void*, void*, AE_DSP_MODES::AE_DSP_MODE*); + CAddonSoundPlay* (*ADSP_get_sound_play)(void*, void*, const char *); + void (*ADSP_release_sound_play)(CAddonSoundPlay*); + +private: + void* m_libKODI_adsp; + void* m_Handle; + void* m_Callbacks; + struct cb_array + { + const char* libPath; + }; +}; + +class CAddonSoundPlay +{ +public: + CAddonSoundPlay(void *hdl, void *cb, const char *filename); + virtual ~CAddonSoundPlay(); + + /*! play the sound this object represents */ + virtual void Play(); + + /*! stop playing the sound this object represents */ + virtual void Stop(); + + /*! return true if the sound is currently playing */ + virtual bool IsPlaying(); + + /*! set the playback channel position of this sound, AE_DSP_CH_INVALID for all */ + virtual void SetChannel(AE_DSP_CHANNEL channel); + + /*! get the current playback volume of this sound, AE_DSP_CH_INVALID for all */ + virtual AE_DSP_CHANNEL GetChannel(); + + /*! set the playback volume of this sound */ + virtual void SetVolume(float volume); + + /*! get the current playback volume of this sound */ + virtual float GetVolume(); + +private: + std::string m_Filename; + void *m_Handle; + void *m_cb; + ADSPHANDLE m_PlayHandle; +}; 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 @@ +#pragma once +/* + * Copyright (C) 2005-2014 Team KODI + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KODI; see the file COPYING. If not, see + * . + * + */ + +#include +#include +#include +#include +#include + +#include "kodi_audioengine_types.h" +#ifdef BUILD_KODI_ADDON + #include "kodi/AudioEngine/AEChannelData.h" + #include "kodi/AudioEngine/AEChannelInfo.h" + #include "kodi/AudioEngine/AEStreamData.h" +#else + #include "cores/AudioEngine/Utils/AEChannelData.h" + #include "cores/AudioEngine/Utils/AEChannelInfo.h" + #include "cores/AudioEngine/Utils/AEStreamData.h" +#endif + +#include "libXBMC_addon.h" + +#ifdef _WIN32 +#define AUDIOENGINE_HELPER_DLL "\\library.kodi.audioengine\\libKODI_audioengine" ADDON_HELPER_EXT +#else +#define AUDIOENGINE_HELPER_DLL_NAME "libKODI_audioengine-" ADDON_HELPER_ARCH ADDON_HELPER_EXT +#define AUDIOENGINE_HELPER_DLL "/library.kodi.audioengine/" AUDIOENGINE_HELPER_DLL_NAME +#endif + +class CAddonAEStream; + +class CHelper_libKODI_audioengine +{ +public: + CHelper_libKODI_audioengine(void) + { + m_libKODI_audioengine = NULL; + m_Handle = NULL; + } + + ~CHelper_libKODI_audioengine(void) + { + if (m_libKODI_audioengine) + { + AudioEngine_unregister_me(m_Handle, m_Callbacks); + dlclose(m_libKODI_audioengine); + } + } + + /*! + * @brief Resolve all callback methods + * @param handle Pointer to the add-on + * @return True when all methods were resolved, false otherwise. + */ + bool RegisterMe(void* handle) + { + m_Handle = handle; + + std::string libBasePath; + libBasePath = ((cb_array*)m_Handle)->libPath; + libBasePath += AUDIOENGINE_HELPER_DLL; + +#if defined(ANDROID) + struct stat st; + if(stat(libBasePath.c_str(),&st) != 0) + { + std::string tempbin = getenv("XBMC_ANDROID_LIBS"); + libBasePath = tempbin + "/" + AUDIOENGINE_HELPER_DLL; + } +#endif + + m_libKODI_audioengine = dlopen(libBasePath.c_str(), RTLD_LAZY); + if (m_libKODI_audioengine == NULL) + { + fprintf(stderr, "Unable to load %s\n", dlerror()); + return false; + } + + AudioEngine_register_me = (void* (*)(void *HANDLE)) + dlsym(m_libKODI_audioengine, "AudioEngine_register_me"); + if (AudioEngine_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + AudioEngine_unregister_me = (void(*)(void* HANDLE, void* CB)) + dlsym(m_libKODI_audioengine, "AudioEngine_unregister_me"); + if (AudioEngine_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + AudioEngine_MakeStream = (CAddonAEStream* (*)(void*, void*, AudioEngineFormat, unsigned int)) + dlsym(m_libKODI_audioengine, "AudioEngine_make_stream"); + if (AudioEngine_MakeStream == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + AudioEngine_FreeStream = (void(*)(CAddonAEStream*)) + dlsym(m_libKODI_audioengine, "AudioEngine_free_stream"); + if (AudioEngine_FreeStream == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + AudioEngine_GetCurrentSinkFormat = (bool(*)(void*, void*, AudioEngineFormat*)) + dlsym(m_libKODI_audioengine, "AudioEngine_get_current_sink_Format"); + if (AudioEngine_GetCurrentSinkFormat == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + m_Callbacks = AudioEngine_register_me(m_Handle); + return m_Callbacks != NULL; + } + + /** + * Creates and returns a new handle to an IAEStream in the format specified, this function should never fail + * @param DataFormat The data format the incoming audio will be in (eg, AE_FMT_S16LE) + * @param SampleRate The sample rate of the audio data (eg, 48000) + * @param ChannelLayout The order of the channels in the audio data + * @param Options A bit field of stream options (see: enum AEStreamOptions) + * @return a new Handle to an IAEStream that will accept data in the requested format + */ + CAddonAEStream* MakeStream(AudioEngineFormat Format, unsigned int Options = 0) + { + return AudioEngine_MakeStream(m_Handle, m_Callbacks, Format, Options); + } + + /** + * This method will remove the specifyed stream from the engine. + * For OSX/IOS this is essential to reconfigure the audio output. + * @param stream The stream to be altered + * @return NULL + */ + void FreeStream(CAddonAEStream **Stream) + { + AudioEngine_FreeStream(*Stream); + *Stream = NULL; + } + + /** + * Get the current sink data format + * + * @param Current sink data format. For more details see AudioEngineFormat. + * @return Returns true on success, else false. + */ + bool GetCurrentSinkFormat(AudioEngineFormat &SinkFormat) + { + return AudioEngine_GetCurrentSinkFormat(m_Handle, m_Callbacks, &SinkFormat); + } + +protected: + void* (*AudioEngine_register_me)(void*); + void (*AudioEngine_unregister_me)(void*, void*); + CAddonAEStream* (*AudioEngine_MakeStream)(void*, void*, AudioEngineFormat, unsigned int); + bool (*AudioEngine_GetCurrentSinkFormat)(void*, void*, AudioEngineFormat *SinkFormat); + void (*AudioEngine_FreeStream)(CAddonAEStream*); + +private: + void* m_libKODI_audioengine; + void* m_Handle; + void* m_Callbacks; + struct cb_array + { + const char* libPath; + }; +}; + +// Audio Engine Stream Class +class CAddonAEStream +{ +public: + CAddonAEStream(void *Addon, void *Callbacks, AEStreamHandle *StreamHandle); + virtual ~CAddonAEStream(); + + /** + * Returns the amount of space available in the stream + * @return The number of bytes AddData will consume + */ + virtual unsigned int GetSpace(); + + /** + * Add planar or interleaved PCM data to the stream + * @param Data array of pointers to the planes + * @param Offset to frame in frames + * @param Frames number of frames + * @return The number of frames consumed + */ + virtual unsigned int AddData(uint8_t* const *Data, unsigned int Offset, unsigned int Frames); + + /** + * Returns the time in seconds that it will take + * for the next added packet to be heard from the speakers. + * @return seconds + */ + virtual double GetDelay(); + + /** + * Returns if the stream is buffering + * @return True if the stream is buffering + */ + virtual bool IsBuffering(); + + /** + * Returns the time in seconds that it will take + * to underrun the cache if no sample is added. + * @return seconds + */ + virtual double GetCacheTime(); + + /** + * Returns the total time in seconds of the cache + * @return seconds + */ + virtual double GetCacheTotal(); + + /** + * Pauses the stream playback + */ + virtual void Pause(); + + /** + * Resumes the stream after pausing + */ + virtual void Resume(); + + /** + * Start draining the stream + * @note Once called AddData will not consume more data. + */ + virtual void Drain(bool Wait); + + /** + * Returns true if the is stream draining + */ + virtual bool IsDraining(); + + /** + * Returns true if the is stream has finished draining + */ + virtual bool IsDrained(); + + /** + * Flush all buffers dropping the audio data + */ + virtual void Flush(); + + /** + * Return the stream's current volume level + * @return The volume level between 0.0 and 1.0 + */ + virtual float GetVolume(); + + /** + * Set the stream's volume level + * @param volume The new volume level between 0.0 and 1.0 + */ + virtual void SetVolume(float Volume); + + /** + * Gets the stream's volume amplification in linear units. + * @return The volume amplification factor between 1.0 and 1000.0 + */ + virtual float GetAmplification(); + + /** + * Sets the stream's volume amplification in linear units. + * @param The volume amplification factor between 1.0 and 1000.0 + */ + virtual void SetAmplification(float Amplify); + + /** + * Returns the size of one audio frame in bytes (channelCount * resolution) + * @return The size in bytes of one frame + */ + virtual const unsigned int GetFrameSize() const; + + /** + * Returns the number of channels the stream is configured to accept + * @return The channel count + */ + virtual const unsigned int GetChannelCount() const; + + /** + * Returns the stream's sample rate, if the stream is using a dynamic sample rate, this value will NOT reflect any changes made by calls to SetResampleRatio() + * @return The stream's sample rate (eg, 48000) + */ + virtual const unsigned int GetSampleRate() const; + + /** + * Return the data format the stream has been configured with + * @return The stream's data format (eg, AE_FMT_S16LE) + */ + virtual const AEDataFormat GetDataFormat() const; + + /** + * Return the resample ratio + * @note This will return an undefined value if the stream is not resampling + * @return the current resample ratio or undefined if the stream is not resampling + */ + virtual double GetResampleRatio(); + + /** + * Sets the resample ratio + * @note This function may return false if the stream is not resampling, if you wish to use this be sure to set the AESTREAM_FORCE_RESAMPLE option + * @param ratio the new sample rate ratio, calculated by ((double)desiredRate / (double)GetSampleRate()) + */ + virtual void SetResampleRatio(double Ratio); + + /** + * Sginal a clock change + */ + virtual void Discontinuity(); + + private: + AEStreamHandle *m_StreamHandle; + void *m_Callbacks; + void *m_AddonHandle; +}; 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 @@ +#pragma once +/* + * Copyright (C) 2005-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include +#include +#include +#include +#include +#include "libXBMC_addon.h" + +typedef void* GUIHANDLE; + +#ifdef _WIN32 +#define GUI_HELPER_DLL "\\library.kodi.guilib\\libKODI_guilib" ADDON_HELPER_EXT +#else +#define GUI_HELPER_DLL_NAME "libKODI_guilib-" ADDON_HELPER_ARCH ADDON_HELPER_EXT +#define GUI_HELPER_DLL "/library.kodi.guilib/" GUI_HELPER_DLL_NAME +#endif + +/* current ADDONGUI API version */ +#define KODI_GUILIB_API_VERSION "5.11.0" + +/* min. ADDONGUI API version */ +#define KODI_GUILIB_MIN_API_VERSION "5.10.0" + +#define ADDON_ACTION_PREVIOUS_MENU 10 +#define ADDON_ACTION_CLOSE_DIALOG 51 +#define ADDON_ACTION_NAV_BACK 92 + +class CAddonGUIWindow; +class CAddonGUISpinControl; +class CAddonGUIRadioButton; +class CAddonGUIProgressControl; +class CAddonListItem; +class CAddonGUIRenderingControl; +class CAddonGUISliderControl; +class CAddonGUISettingsSliderControl; + +class CHelper_libKODI_guilib +{ +public: + CHelper_libKODI_guilib() + { + m_libKODI_guilib = NULL; + m_Handle = NULL; + } + + ~CHelper_libKODI_guilib() + { + if (m_libKODI_guilib) + { + GUI_unregister_me(m_Handle, m_Callbacks); + dlclose(m_libKODI_guilib); + } + } + + bool RegisterMe(void *Handle) + { + m_Handle = Handle; + + std::string libBasePath; + libBasePath = ((cb_array*)m_Handle)->libPath; + libBasePath += GUI_HELPER_DLL; + +#if defined(ANDROID) + struct stat st; + if(stat(libBasePath.c_str(),&st) != 0) + { + std::string tempbin = getenv("XBMC_ANDROID_LIBS"); + libBasePath = tempbin + "/" + GUI_HELPER_DLL_NAME; + } +#endif + + m_libKODI_guilib = dlopen(libBasePath.c_str(), RTLD_LAZY); + if (m_libKODI_guilib == NULL) + { + fprintf(stderr, "Unable to load %s\n", dlerror()); + return false; + } + + GUI_register_me = (void* (*)(void *HANDLE)) + dlsym(m_libKODI_guilib, "GUI_register_me"); + if (GUI_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_unregister_me = (void (*)(void *HANDLE, void *CB)) + dlsym(m_libKODI_guilib, "GUI_unregister_me"); + if (GUI_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_lock = (void (*)(void *HANDLE, void *CB)) + dlsym(m_libKODI_guilib, "GUI_lock"); + if (GUI_lock == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_unlock = (void (*)(void *HANDLE, void *CB)) + dlsym(m_libKODI_guilib, "GUI_unlock"); + if (GUI_unlock == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_get_screen_height = (int (*)(void *HANDLE, void *CB)) + dlsym(m_libKODI_guilib, "GUI_get_screen_height"); + if (GUI_get_screen_height == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_get_screen_width = (int (*)(void *HANDLE, void *CB)) + dlsym(m_libKODI_guilib, "GUI_get_screen_width"); + if (GUI_get_screen_width == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_get_video_resolution = (int (*)(void *HANDLE, void *CB)) + dlsym(m_libKODI_guilib, "GUI_get_video_resolution"); + if (GUI_get_video_resolution == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_Window_create = (CAddonGUIWindow* (*)(void *HANDLE, void *CB, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog)) + dlsym(m_libKODI_guilib, "GUI_Window_create"); + if (GUI_Window_create == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_Window_destroy = (void (*)(CAddonGUIWindow* p)) + dlsym(m_libKODI_guilib, "GUI_Window_destroy"); + if (GUI_Window_destroy == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_control_get_spin = (CAddonGUISpinControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) + dlsym(m_libKODI_guilib, "GUI_control_get_spin"); + if (GUI_control_get_spin == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_control_release_spin = (void (*)(CAddonGUISpinControl* p)) + dlsym(m_libKODI_guilib, "GUI_control_release_spin"); + if (GUI_control_release_spin == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_control_get_radiobutton = (CAddonGUIRadioButton* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) + dlsym(m_libKODI_guilib, "GUI_control_get_radiobutton"); + if (GUI_control_get_radiobutton == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_control_release_radiobutton = (void (*)(CAddonGUIRadioButton* p)) + dlsym(m_libKODI_guilib, "GUI_control_release_radiobutton"); + if (GUI_control_release_radiobutton == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_control_get_progress = (CAddonGUIProgressControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) + dlsym(m_libKODI_guilib, "GUI_control_get_progress"); + if (GUI_control_get_progress == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_control_release_progress = (void (*)(CAddonGUIProgressControl* p)) + dlsym(m_libKODI_guilib, "GUI_control_release_progress"); + if (GUI_control_release_progress == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_ListItem_create = (CAddonListItem* (*)(void *HANDLE, void *CB, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path)) + dlsym(m_libKODI_guilib, "GUI_ListItem_create"); + if (GUI_ListItem_create == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_ListItem_destroy = (void (*)(CAddonListItem* p)) + dlsym(m_libKODI_guilib, "GUI_ListItem_destroy"); + if (GUI_ListItem_destroy == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_control_get_rendering = (CAddonGUIRenderingControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) + dlsym(m_libKODI_guilib, "GUI_control_get_rendering"); + if (GUI_control_get_rendering == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_control_release_rendering = (void (*)(CAddonGUIRenderingControl* p)) + dlsym(m_libKODI_guilib, "GUI_control_release_rendering"); + if (GUI_control_release_rendering == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_control_get_slider = (CAddonGUISliderControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) + dlsym(m_libKODI_guilib, "GUI_control_get_slider"); + if (GUI_control_get_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_control_release_slider = (void (*)(CAddonGUISliderControl* p)) + dlsym(m_libKODI_guilib, "GUI_control_release_slider"); + if (GUI_control_release_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_control_get_settings_slider = (CAddonGUISettingsSliderControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) + dlsym(m_libKODI_guilib, "GUI_control_get_settings_slider"); + if (GUI_control_get_settings_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_control_release_settings_slider = (void (*)(CAddonGUISettingsSliderControl* p)) + dlsym(m_libKODI_guilib, "GUI_control_release_settings_slider"); + if (GUI_control_release_settings_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + 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)) + dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_input_with_head"); + if (GUI_dialog_keyboard_show_and_get_input_with_head == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_keyboard_show_and_get_input = (bool (*)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs)) + dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_input"); + if (GUI_dialog_keyboard_show_and_get_input == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + 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)) + dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_new_password_with_head"); + if (GUI_dialog_keyboard_show_and_get_new_password_with_head == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_keyboard_show_and_get_new_password = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs)) + dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_new_password"); + if (GUI_dialog_keyboard_show_and_get_new_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + 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)) + dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_verify_new_password_with_head"); + if (GUI_dialog_keyboard_show_and_verify_new_password_with_head == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_keyboard_show_and_verify_new_password = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs)) + dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_verify_new_password"); + if (GUI_dialog_keyboard_show_and_verify_new_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + 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)) + dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_verify_password"); + if (GUI_dialog_keyboard_show_and_verify_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_keyboard_show_and_get_filter = (bool (*)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs)) + dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_filter"); + if (GUI_dialog_keyboard_show_and_get_filter == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_keyboard_send_text_to_active_keyboard = (bool (*)(void *HANDLE, void *CB, const char *aTextString, bool closeKeyboard)) + dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_send_text_to_active_keyboard"); + if (GUI_dialog_keyboard_send_text_to_active_keyboard == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_keyboard_is_activated = (bool (*)(void *HANDLE, void *CB)) + dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_is_activated"); + if (GUI_dialog_keyboard_is_activated == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_numeric_show_and_verify_new_password = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize)) + dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_verify_new_password"); + if (GUI_dialog_numeric_show_and_verify_new_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_numeric_show_and_verify_password = (int (*)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries)) + dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_verify_password"); + if (GUI_dialog_numeric_show_and_verify_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_numeric_show_and_verify_input = (bool (*)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput)) + dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_verify_input"); + if (GUI_dialog_numeric_show_and_verify_input == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_numeric_show_and_get_time = (bool (*)(void *HANDLE, void *CB, tm &time, const char *strHeading)) + dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_time"); + if (GUI_dialog_numeric_show_and_get_time == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_numeric_show_and_get_date = (bool (*)(void *HANDLE, void *CB, tm &date, const char *strHeading)) + dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_date"); + if (GUI_dialog_numeric_show_and_get_date == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_numeric_show_and_get_ipaddress = (bool (*)(void *HANDLE, void *CB, char &IPAddress, unsigned int iMaxStringSize, const char *strHeading)) + dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_ipaddress"); + if (GUI_dialog_numeric_show_and_get_ipaddress == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_numeric_show_and_get_number = (bool (*)(void *HANDLE, void *CB, char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs)) + dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_number"); + if (GUI_dialog_numeric_show_and_get_number == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_numeric_show_and_get_seconds = (bool (*)(void *HANDLE, void *CB, char &strTime, unsigned int iMaxStringSize, const char *strHeading)) + dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_seconds"); + if (GUI_dialog_numeric_show_and_get_seconds == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + 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)) + dlsym(m_libKODI_guilib, "GUI_dialog_filebrowser_show_and_get_file"); + if (GUI_dialog_filebrowser_show_and_get_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_ok_show_and_get_input_single_text = (void (*)(void *HANDLE, void *CB, const char *heading, const char *text)) + dlsym(m_libKODI_guilib, "GUI_dialog_ok_show_and_get_input_single_text"); + if (GUI_dialog_ok_show_and_get_input_single_text == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + 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)) + dlsym(m_libKODI_guilib, "GUI_dialog_ok_show_and_get_input_line_text"); + if (GUI_dialog_ok_show_and_get_input_line_text == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + 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)) + dlsym(m_libKODI_guilib, "GUI_dialog_yesno_show_and_get_input_singletext"); + if (GUI_dialog_yesno_show_and_get_input_singletext == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + 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)) + dlsym(m_libKODI_guilib, "GUI_dialog_yesno_show_and_get_input_linetext"); + if (GUI_dialog_yesno_show_and_get_input_linetext == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + 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)) + dlsym(m_libKODI_guilib, "GUI_dialog_yesno_show_and_get_input_linebuttontext"); + if (GUI_dialog_yesno_show_and_get_input_linebuttontext == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_text_viewer = (void (*)(void *hdl, void *cb, const char *heading, const char *text)) + dlsym(m_libKODI_guilib, "GUI_dialog_text_viewer"); + if (GUI_dialog_text_viewer == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + GUI_dialog_select = (int (*)(void *hdl, void *cb, const char *heading, const char *entries[], unsigned int size, int selected)) + dlsym(m_libKODI_guilib, "GUI_dialog_select"); + if (GUI_dialog_select == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + m_Callbacks = GUI_register_me(m_Handle); + return m_Callbacks != NULL; + } + + void Lock() + { + return GUI_lock(m_Handle, m_Callbacks); + } + + void Unlock() + { + return GUI_unlock(m_Handle, m_Callbacks); + } + + int GetScreenHeight() + { + return GUI_get_screen_height(m_Handle, m_Callbacks); + } + + int GetScreenWidth() + { + return GUI_get_screen_width(m_Handle, m_Callbacks); + } + + int GetVideoResolution() + { + return GUI_get_video_resolution(m_Handle, m_Callbacks); + } + + CAddonGUIWindow* Window_create(const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog) + { + return GUI_Window_create(m_Handle, m_Callbacks, xmlFilename, defaultSkin, forceFallback, asDialog); + } + + void Window_destroy(CAddonGUIWindow* p) + { + return GUI_Window_destroy(p); + } + + CAddonGUISpinControl* Control_getSpin(CAddonGUIWindow *window, int controlId) + { + return GUI_control_get_spin(m_Handle, m_Callbacks, window, controlId); + } + + void Control_releaseSpin(CAddonGUISpinControl* p) + { + return GUI_control_release_spin(p); + } + + CAddonGUIRadioButton* Control_getRadioButton(CAddonGUIWindow *window, int controlId) + { + return GUI_control_get_radiobutton(m_Handle, m_Callbacks, window, controlId); + } + + void Control_releaseRadioButton(CAddonGUIRadioButton* p) + { + return GUI_control_release_radiobutton(p); + } + + CAddonGUIProgressControl* Control_getProgress(CAddonGUIWindow *window, int controlId) + { + return GUI_control_get_progress(m_Handle, m_Callbacks, window, controlId); + } + + void Control_releaseProgress(CAddonGUIProgressControl* p) + { + return GUI_control_release_progress(p); + } + + CAddonListItem* ListItem_create(const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path) + { + return GUI_ListItem_create(m_Handle, m_Callbacks, label, label2, iconImage, thumbnailImage, path); + } + + void ListItem_destroy(CAddonListItem* p) + { + return GUI_ListItem_destroy(p); + } + + CAddonGUIRenderingControl* Control_getRendering(CAddonGUIWindow *window, int controlId) + { + return GUI_control_get_rendering(m_Handle, m_Callbacks, window, controlId); + } + + void Control_releaseRendering(CAddonGUIRenderingControl* p) + { + return GUI_control_release_rendering(p); + } + + CAddonGUISliderControl* Control_getSlider(CAddonGUIWindow *window, int controlId) + { + return GUI_control_get_slider(m_Handle, m_Callbacks, window, controlId); + } + + void Control_releaseSlider(CAddonGUISliderControl* p) + { + return GUI_control_release_slider(p); + } + + CAddonGUISettingsSliderControl* Control_getSettingsSlider(CAddonGUIWindow *window, int controlId) + { + return GUI_control_get_settings_slider(m_Handle, m_Callbacks, window, controlId); + } + + void Control_releaseSettingsSlider(CAddonGUISettingsSliderControl* p) + { + return GUI_control_release_settings_slider(p); + } + + /*! @name GUI Keyboard functions */ + //@{ + bool Dialog_Keyboard_ShowAndGetInput(char &strText, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs = 0) + { + return GUI_dialog_keyboard_show_and_get_input_with_head(m_Handle, m_Callbacks, strText, iMaxStringSize, strHeading, allowEmptyResult, hiddenInput, autoCloseMs); + } + + bool Dialog_Keyboard_ShowAndGetInput(char &strText, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs = 0) + { + return GUI_dialog_keyboard_show_and_get_input(m_Handle, m_Callbacks, strText, iMaxStringSize, allowEmptyResult, autoCloseMs); + } + + bool Dialog_Keyboard_ShowAndGetNewPassword(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs = 0) + { + return GUI_dialog_keyboard_show_and_get_new_password_with_head(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs); + } + + bool Dialog_Keyboard_ShowAndGetNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs = 0) + { + return GUI_dialog_keyboard_show_and_get_new_password(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, autoCloseMs); + } + + bool Dialog_Keyboard_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs = 0) + { + return GUI_dialog_keyboard_show_and_verify_new_password_with_head(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs); + } + + bool Dialog_Keyboard_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs = 0) + { + return GUI_dialog_keyboard_show_and_verify_new_password(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, autoCloseMs); + } + + int Dialog_Keyboard_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs = 0) + { + return GUI_dialog_keyboard_show_and_verify_password(m_Handle, m_Callbacks, strPassword, iMaxStringSize, strHeading, iRetries, autoCloseMs); + } + + bool Dialog_Keyboard_ShowAndGetFilter(char &strText, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs = 0) + { + return GUI_dialog_keyboard_show_and_get_filter(m_Handle, m_Callbacks, strText, iMaxStringSize, searching, autoCloseMs); + } + + bool Dialog_Keyboard_SendTextToActiveKeyboard(const char *aTextString, bool closeKeyboard = false) + { + return GUI_dialog_keyboard_send_text_to_active_keyboard(m_Handle, m_Callbacks, aTextString, closeKeyboard); + } + + bool Dialog_Keyboard_isKeyboardActivated() + { + return GUI_dialog_keyboard_is_activated(m_Handle, m_Callbacks); + } + //@} + + /*! @name GUI Numeric functions */ + //@{ + bool Dialog_Numeric_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize) + { + return GUI_dialog_numeric_show_and_verify_new_password(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize); + } + + int Dialog_Numeric_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries) + { + return GUI_dialog_numeric_show_and_verify_password(m_Handle, m_Callbacks, strPassword, iMaxStringSize, strHeading, iRetries); + } + + bool Dialog_Numeric_ShowAndVerifyInput(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput) + { + return GUI_dialog_numeric_show_and_verify_input(m_Handle, m_Callbacks, strPassword, iMaxStringSize, strHeading, bGetUserInput); + } + + bool Dialog_Numeric_ShowAndGetTime(tm &time, const char *strHeading) + { + return GUI_dialog_numeric_show_and_get_time(m_Handle, m_Callbacks, time, strHeading); + } + + bool Dialog_Numeric_ShowAndGetDate(tm &date, const char *strHeading) + { + return GUI_dialog_numeric_show_and_get_date(m_Handle, m_Callbacks, date, strHeading); + } + + bool Dialog_Numeric_ShowAndGetIPAddress(char &strIPAddress, unsigned int iMaxStringSize, const char *strHeading) + { + return GUI_dialog_numeric_show_and_get_ipaddress(m_Handle, m_Callbacks, strIPAddress, iMaxStringSize, strHeading); + } + + bool Dialog_Numeric_ShowAndGetNumber(char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs = 0) + { + return GUI_dialog_numeric_show_and_get_number(m_Handle, m_Callbacks, strInput, iMaxStringSize, strHeading, iAutoCloseTimeoutMs); + } + + bool Dialog_Numeric_ShowAndGetSeconds(char &strTime, unsigned int iMaxStringSize, const char *strHeading) + { + return GUI_dialog_numeric_show_and_get_seconds(m_Handle, m_Callbacks, strTime, iMaxStringSize, strHeading); + } + //@} + + /*! @name GUI File browser functions */ + //@{ + 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) + { + return GUI_dialog_filebrowser_show_and_get_file(m_Handle, m_Callbacks, directory, mask, heading, strPath, iMaxStringSize, useThumbs, useFileDirectories, singleList); + } + //@} + + /*! @name GUI OK Dialog functions */ + //@{ + void Dialog_OK_ShowAndGetInput(const char *heading, const char *text) + { + GUI_dialog_ok_show_and_get_input_single_text(m_Handle, m_Callbacks, heading, text); + } + + void Dialog_OK_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2) + { + GUI_dialog_ok_show_and_get_input_line_text(m_Handle, m_Callbacks, heading, line0, line1, line2); + } + //@} + + /*! @name GUI Yes No Dialog functions */ + //@{ + bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *text, bool& bCanceled, const char *noLabel = "", const char *yesLabel = "") + { + return GUI_dialog_yesno_show_and_get_input_singletext(m_Handle, m_Callbacks, heading, text, bCanceled, noLabel, yesLabel); + } + + bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel = "", const char *yesLabel = "") + { + return GUI_dialog_yesno_show_and_get_input_linetext(m_Handle, m_Callbacks, heading, line0, line1, line2, noLabel, yesLabel); + } + + bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel = "", const char *yesLabel = "") + { + return GUI_dialog_yesno_show_and_get_input_linebuttontext(m_Handle, m_Callbacks, heading, line0, line1, line2, bCanceled, noLabel, yesLabel); + } + //@} + + /*! @name GUI Text viewer Dialog */ + //@{ + void Dialog_TextViewer(const char *heading, const char *text) + { + return GUI_dialog_text_viewer(m_Handle, m_Callbacks, heading, text); + } + //@} + + /*! @name GUI select Dialog */ + //@{ + int Dialog_Select(const char *heading, const char *entries[], unsigned int size, int selected = -1) + { + return GUI_dialog_select(m_Handle, m_Callbacks, heading, entries, size, selected); + } + //@} + +protected: + void* (*GUI_register_me)(void *HANDLE); + void (*GUI_unregister_me)(void *HANDLE, void* CB); + void (*GUI_lock)(void *HANDLE, void* CB); + void (*GUI_unlock)(void *HANDLE, void* CB); + int (*GUI_get_screen_height)(void *HANDLE, void* CB); + int (*GUI_get_screen_width)(void *HANDLE, void* CB); + int (*GUI_get_video_resolution)(void *HANDLE, void* CB); + CAddonGUIWindow* (*GUI_Window_create)(void *HANDLE, void* CB, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog); + void (*GUI_Window_destroy)(CAddonGUIWindow* p); + CAddonGUISpinControl* (*GUI_control_get_spin)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); + void (*GUI_control_release_spin)(CAddonGUISpinControl* p); + CAddonGUIRadioButton* (*GUI_control_get_radiobutton)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); + void (*GUI_control_release_radiobutton)(CAddonGUIRadioButton* p); + CAddonGUIProgressControl* (*GUI_control_get_progress)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); + void (*GUI_control_release_progress)(CAddonGUIProgressControl* p); + CAddonListItem* (*GUI_ListItem_create)(void *HANDLE, void* CB, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path); + void (*GUI_ListItem_destroy)(CAddonListItem* p); + CAddonGUIRenderingControl* (*GUI_control_get_rendering)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); + void (*GUI_control_release_rendering)(CAddonGUIRenderingControl* p); + CAddonGUISliderControl* (*GUI_control_get_slider)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); + void (*GUI_control_release_slider)(CAddonGUISliderControl* p); + CAddonGUISettingsSliderControl* (*GUI_control_get_settings_slider)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); + void (*GUI_control_release_settings_slider)(CAddonGUISettingsSliderControl* p); + 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); + bool (*GUI_dialog_keyboard_show_and_get_input)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs); + 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); + bool (*GUI_dialog_keyboard_show_and_get_new_password)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs); + 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); + bool (*GUI_dialog_keyboard_show_and_verify_new_password)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs); + 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); + bool (*GUI_dialog_keyboard_show_and_get_filter)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs); + bool (*GUI_dialog_keyboard_send_text_to_active_keyboard)(void *HANDLE, void *CB, const char *aTextString, bool closeKeyboard); + bool (*GUI_dialog_keyboard_is_activated)(void *HANDLE, void *CB); + bool (*GUI_dialog_numeric_show_and_verify_new_password)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize); + int (*GUI_dialog_numeric_show_and_verify_password)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries); + bool (*GUI_dialog_numeric_show_and_verify_input)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput); + bool (*GUI_dialog_numeric_show_and_get_time)(void *HANDLE, void *CB, tm &time, const char *strHeading); + bool (*GUI_dialog_numeric_show_and_get_date)(void *HANDLE, void *CB, tm &date, const char *strHeading); + bool (*GUI_dialog_numeric_show_and_get_ipaddress)(void *HANDLE, void *CB, char &IPAddress, unsigned int iMaxStringSize, const char *strHeading); + bool (*GUI_dialog_numeric_show_and_get_number)(void *HANDLE, void *CB, char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs); + bool (*GUI_dialog_numeric_show_and_get_seconds)(void *HANDLE, void *CB, char &strTime, unsigned int iMaxStringSize, const char *strHeading); + 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); + void (*GUI_dialog_ok_show_and_get_input_single_text)(void *HANDLE, void *CB, const char *heading, const char *text); + 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); + 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); + 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); + 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); + void (*GUI_dialog_text_viewer)(void *hdl, void *cb, const char *heading, const char *text); + int (*GUI_dialog_select)(void *hdl, void *cb, const char *heading, const char *entries[], unsigned int size, int selected); + +private: + void *m_libKODI_guilib; + void *m_Handle; + void *m_Callbacks; + struct cb_array + { + const char* libPath; + }; +}; + +class CAddonGUISpinControl +{ +public: + CAddonGUISpinControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); + virtual ~CAddonGUISpinControl(void) {} + + virtual void SetVisible(bool yesNo); + virtual void SetText(const char *label); + virtual void Clear(); + virtual void AddLabel(const char *label, int iValue); + virtual int GetValue(); + virtual void SetValue(int iValue); + +private: + CAddonGUIWindow *m_Window; + int m_ControlId; + GUIHANDLE m_SpinHandle; + void *m_Handle; + void *m_cb; +}; + +class CAddonGUIRadioButton +{ +public: + CAddonGUIRadioButton(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); + virtual ~CAddonGUIRadioButton() {} + + virtual void SetVisible(bool yesNo); + virtual void SetText(const char *label); + virtual void SetSelected(bool yesNo); + virtual bool IsSelected(); + +private: + CAddonGUIWindow *m_Window; + int m_ControlId; + GUIHANDLE m_ButtonHandle; + void *m_Handle; + void *m_cb; +}; + +class CAddonGUIProgressControl +{ +public: + CAddonGUIProgressControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); + virtual ~CAddonGUIProgressControl(void) {} + + virtual void SetPercentage(float fPercent); + virtual float GetPercentage() const; + virtual void SetInfo(int iInfo); + virtual int GetInfo() const; + virtual std::string GetDescription() const; + +private: + CAddonGUIWindow *m_Window; + int m_ControlId; + GUIHANDLE m_ProgressHandle; + void *m_Handle; + void *m_cb; +}; + +class CAddonGUISliderControl +{ +public: + CAddonGUISliderControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); + virtual ~CAddonGUISliderControl(void) {} + + virtual void SetVisible(bool yesNo); + virtual std::string GetDescription() const; + + virtual void SetIntRange(int iStart, int iEnd); + virtual void SetIntValue(int iValue); + virtual int GetIntValue() const; + virtual void SetIntInterval(int iInterval); + + virtual void SetPercentage(float fPercent); + virtual float GetPercentage() const; + + virtual void SetFloatRange(float fStart, float fEnd); + virtual void SetFloatValue(float fValue); + virtual float GetFloatValue() const; + virtual void SetFloatInterval(float fInterval); + +private: + CAddonGUIWindow *m_Window; + int m_ControlId; + GUIHANDLE m_SliderHandle; + void *m_Handle; + void *m_cb; +}; + +class CAddonGUISettingsSliderControl +{ +public: + CAddonGUISettingsSliderControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); + virtual ~CAddonGUISettingsSliderControl(void) {} + + virtual void SetVisible(bool yesNo); + virtual void SetText(const char *label); + virtual std::string GetDescription() const; + + virtual void SetIntRange(int iStart, int iEnd); + virtual void SetIntValue(int iValue); + virtual int GetIntValue() const; + virtual void SetIntInterval(int iInterval); + + virtual void SetPercentage(float fPercent); + virtual float GetPercentage() const; + + virtual void SetFloatRange(float fStart, float fEnd); + virtual void SetFloatValue(float fValue); + virtual float GetFloatValue() const; + virtual void SetFloatInterval(float fInterval); + +private: + CAddonGUIWindow *m_Window; + int m_ControlId; + GUIHANDLE m_SettingsSliderHandle; + void *m_Handle; + void *m_cb; +}; + +class CAddonListItem +{ +friend class CAddonGUIWindow; + +public: + CAddonListItem(void *hdl, void *cb, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path); + virtual ~CAddonListItem(void) {} + + virtual const char *GetLabel(); + virtual void SetLabel(const char *label); + virtual const char *GetLabel2(); + virtual void SetLabel2(const char *label); + virtual void SetIconImage(const char *image); + virtual void SetThumbnailImage(const char *image); + virtual void SetInfo(const char *Info); + virtual void SetProperty(const char *key, const char *value); + virtual const char *GetProperty(const char *key) const; + virtual void SetPath(const char *Path); + +// {(char*)"select(); +// {(char*)"isSelected(); +protected: + GUIHANDLE m_ListItemHandle; + void *m_Handle; + void *m_cb; +}; + +class CAddonGUIWindow +{ +friend class CAddonGUISpinControl; +friend class CAddonGUIRadioButton; +friend class CAddonGUIProgressControl; +friend class CAddonGUIRenderingControl; +friend class CAddonGUISliderControl; +friend class CAddonGUISettingsSliderControl; + +public: + CAddonGUIWindow(void *hdl, void *cb, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog); + virtual ~CAddonGUIWindow(); + + virtual bool Show(); + virtual void Close(); + virtual void DoModal(); + virtual bool SetFocusId(int iControlId); + virtual int GetFocusId(); + virtual bool SetCoordinateResolution(int res); + virtual void SetProperty(const char *key, const char *value); + virtual void SetPropertyInt(const char *key, int value); + virtual void SetPropertyBool(const char *key, bool value); + virtual void SetPropertyDouble(const char *key, double value); + virtual const char *GetProperty(const char *key) const; + virtual int GetPropertyInt(const char *key) const; + virtual bool GetPropertyBool(const char *key) const; + virtual double GetPropertyDouble(const char *key) const; + virtual void ClearProperties(); + virtual int GetListSize(); + virtual void ClearList(); + virtual GUIHANDLE AddStringItem(const char *name, int itemPosition = -1); + virtual void AddItem(GUIHANDLE item, int itemPosition = -1); + virtual void AddItem(CAddonListItem *item, int itemPosition = -1); + virtual void RemoveItem(int itemPosition); + virtual GUIHANDLE GetListItem(int listPos); + virtual void SetCurrentListPosition(int listPos); + virtual int GetCurrentListPosition(); + virtual void SetControlLabel(int controlId, const char *label); + virtual void MarkDirtyRegion(); + + virtual bool OnClick(int controlId); + virtual bool OnFocus(int controlId); + virtual bool OnInit(); + virtual bool OnAction(int actionId); + + GUIHANDLE m_cbhdl; + bool (*CBOnInit)(GUIHANDLE cbhdl); + bool (*CBOnFocus)(GUIHANDLE cbhdl, int controlId); + bool (*CBOnClick)(GUIHANDLE cbhdl, int controlId); + bool (*CBOnAction)(GUIHANDLE cbhdl, int actionId); + +protected: + GUIHANDLE m_WindowHandle; + void *m_Handle; + void *m_cb; +}; + +class CAddonGUIRenderingControl +{ +public: + CAddonGUIRenderingControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); + virtual ~CAddonGUIRenderingControl(); + virtual void Init(); + + virtual bool Create(int x, int y, int w, int h, void *device); + virtual void Render(); + virtual void Stop(); + virtual bool Dirty(); + + GUIHANDLE m_cbhdl; + bool (*CBCreate)(GUIHANDLE cbhdl, int x, int y, int w, int h, void *device); + void (*CBRender)(GUIHANDLE cbhdl); + void (*CBStop)(GUIHANDLE cbhdl); + bool (*CBDirty)(GUIHANDLE cbhdl); + +private: + CAddonGUIWindow *m_Window; + int m_ControlId; + GUIHANDLE m_RenderingHandle; + void *m_Handle; + void *m_cb; +}; diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h 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 @@ +/* + * Copyright (C) 2005-2016 Team XBMC + * http://www.xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#pragma once + +#include +#include +#include +#include +#include +#include "libXBMC_addon.h" + +#ifdef BUILD_KODI_ADDON +#include "DVDDemuxPacket.h" +#else +#include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h" +#endif + +#ifdef _WIN32 +#define INPUTSTREAM_HELPER_DLL "\\library.kodi.inputstream\\libKODI_inputstream" ADDON_HELPER_EXT +#else +#define INPUTSTREAM_HELPER_DLL_NAME "libKODI_inputstream-" ADDON_HELPER_ARCH ADDON_HELPER_EXT +#define INPUTSTREAM_HELPER_DLL "/library.kodi.inputstream/" INPUTSTREAM_HELPER_DLL_NAME +#endif + +class CHelper_libKODI_inputstream +{ +public: + CHelper_libKODI_inputstream(void) + { + m_libKODI_inputstream = nullptr; + m_Handle = nullptr; + } + + ~CHelper_libKODI_inputstream(void) + { + if (m_libKODI_inputstream) + { + INPUTSTREAM_unregister_me(m_Handle, m_Callbacks); + dlclose(m_libKODI_inputstream); + } + } + + /*! + * @brief Resolve all callback methods + * @param handle Pointer to the add-on + * @return True when all methods were resolved, false otherwise. + */ + bool RegisterMe(void* handle) + { + m_Handle = handle; + + std::string libBasePath; + libBasePath = ((cb_array*)m_Handle)->libPath; + libBasePath += INPUTSTREAM_HELPER_DLL; + + m_libKODI_inputstream = dlopen(libBasePath.c_str(), RTLD_LAZY); + if (m_libKODI_inputstream == nullptr) + { + fprintf(stderr, "Unable to load %s\n", dlerror()); + return false; + } + + INPUTSTREAM_register_me = (void* (*)(void *HANDLE)) + dlsym(m_libKODI_inputstream, "INPUTSTREAM_register_me"); + if (INPUTSTREAM_register_me == nullptr) + { + fprintf(stderr, "Unable to assign function %s\n", dlerror()); + return false; + } + + INPUTSTREAM_unregister_me = (void (*)(void* HANDLE, void* CB)) + dlsym(m_libKODI_inputstream, "INPUTSTREAM_unregister_me"); + if (INPUTSTREAM_unregister_me == nullptr) + { + fprintf(stderr, "Unable to assign function %s\n", dlerror()); + return false; + } + + INPUTSTREAM_free_demux_packet = (void (*)(void* HANDLE, void* CB, DemuxPacket* pPacket)) + dlsym(m_libKODI_inputstream, "INPUTSTREAM_free_demux_packet"); + if (INPUTSTREAM_free_demux_packet == NULL) + { + fprintf(stderr, "Unable to assign function %s\n", dlerror()); + return false; + } + + INPUTSTREAM_allocate_demux_packet = (DemuxPacket* (*)(void* HANDLE, void* CB, int iDataSize)) + dlsym(m_libKODI_inputstream, "INPUTSTREAM_allocate_demux_packet"); + if (INPUTSTREAM_allocate_demux_packet == NULL) + { + fprintf(stderr, "Unable to assign function %s\n", dlerror()); + return false; + } + + m_Callbacks = INPUTSTREAM_register_me(m_Handle); + return m_Callbacks != nullptr; + } + + /*! + * @brief Allocate a demux packet. Free with FreeDemuxPacket + * @param iDataSize The size of the data that will go into the packet + * @return The allocated packet + */ + DemuxPacket* AllocateDemuxPacket(int iDataSize) + { + return INPUTSTREAM_allocate_demux_packet(m_Handle, m_Callbacks, iDataSize); + } + + /*! + * @brief Free a packet that was allocated with AllocateDemuxPacket + * @param pPacket The packet to free + */ + void FreeDemuxPacket(DemuxPacket* pPacket) + { + return INPUTSTREAM_free_demux_packet(m_Handle, m_Callbacks, pPacket); + } + +protected: + void* (*INPUTSTREAM_register_me)(void*); + void (*INPUTSTREAM_unregister_me)(void*, void*); + void (*INPUTSTREAM_free_demux_packet)(void*, void*, DemuxPacket*); + DemuxPacket* (*INPUTSTREAM_allocate_demux_packet)(void*, void*, int); + +private: + void* m_libKODI_inputstream; + void* m_Handle; + void* m_Callbacks; + struct cb_array + { + const char* libPath; + }; +}; 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 @@ +#pragma once +/* + * Copyright (C) 2005-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#if defined(BUILD_KODI_ADDON) +#include "IFileTypes.h" +#else +#include "filesystem/IFileTypes.h" +#endif + +struct VFSDirEntry; + +#ifdef _WIN32 // windows +#ifndef _SSIZE_T_DEFINED +typedef intptr_t ssize_t; +#define _SSIZE_T_DEFINED +#endif // !_SSIZE_T_DEFINED + +#if defined(BUILD_KODI_ADDON) +#include "p8-platform/windows/dlfcn-win32.h" +#else +#include "dlfcn-win32.h" +#endif + +#define ADDON_DLL "\\library.xbmc.addon\\libXBMC_addon" ADDON_HELPER_EXT +#define ADDON_HELPER_EXT ".dll" +#else // windows +// the ADDON_HELPER_ARCH is the platform dependend name which is used +// as part of the name of dynamic addon libraries. It has to match the +// strings which are set in configure.ac for the "ARCH" variable. +#if defined(__APPLE__) // osx +#if defined(__arm__) || defined(__aarch64__) +#define ADDON_HELPER_ARCH "arm-osx" +#else +#define ADDON_HELPER_ARCH "x86-osx" +#endif +#define ADDON_HELPER_EXT ".dylib" +#else // linux +#if defined(__x86_64__) +#define ADDON_HELPER_ARCH "x86_64-linux" +#elif defined(_POWERPC) +#define ADDON_HELPER_ARCH "powerpc-linux" +#elif defined(_POWERPC64) +#define ADDON_HELPER_ARCH "powerpc64-linux" +#elif defined(__ARMEL__) +#define ADDON_HELPER_ARCH "arm" +#elif defined(__aarch64__) +#define ADDON_HELPER_ARCH "aarch64" +#elif defined(__mips__) +#define ADDON_HELPER_ARCH "mips" +#else +#define ADDON_HELPER_ARCH "i486-linux" +#endif +#define ADDON_HELPER_EXT ".so" +#endif +#include // linux+osx +#define ADDON_DLL_NAME "libXBMC_addon-" ADDON_HELPER_ARCH ADDON_HELPER_EXT +#define ADDON_DLL "/library.xbmc.addon/" ADDON_DLL_NAME +#endif +#if defined(ANDROID) +#include +#endif + +#ifdef LOG_DEBUG +#undef LOG_DEBUG +#endif +#ifdef LOG_INFO +#undef LOG_INFO +#endif +#ifdef LOG_NOTICE +#undef LOG_NOTICE +#endif +#ifdef LOG_ERROR +#undef LOG_ERROR +#endif + +namespace ADDON +{ + typedef enum addon_log + { + LOG_DEBUG, + LOG_INFO, + LOG_NOTICE, + LOG_ERROR + } addon_log_t; + + typedef enum queue_msg + { + QUEUE_INFO, + QUEUE_WARNING, + QUEUE_ERROR + } queue_msg_t; + + class CHelper_libXBMC_addon + { + public: + CHelper_libXBMC_addon() + { + m_libXBMC_addon = NULL; + m_Handle = NULL; + } + + ~CHelper_libXBMC_addon() + { + if (m_libXBMC_addon) + { + XBMC_unregister_me(m_Handle, m_Callbacks); + dlclose(m_libXBMC_addon); + } + } + + bool RegisterMe(void *Handle) + { + m_Handle = Handle; + + std::string libBasePath; + libBasePath = ((cb_array*)m_Handle)->libPath; + libBasePath += ADDON_DLL; + +#if defined(ANDROID) + struct stat st; + if(stat(libBasePath.c_str(),&st) != 0) + { + std::string tempbin = getenv("XBMC_ANDROID_LIBS"); + libBasePath = tempbin + "/" + ADDON_DLL_NAME; + } +#endif + + m_libXBMC_addon = dlopen(libBasePath.c_str(), RTLD_LAZY); + if (m_libXBMC_addon == NULL) + { + fprintf(stderr, "Unable to load %s\n", dlerror()); + return false; + } + + XBMC_register_me = (void* (*)(void *HANDLE)) + dlsym(m_libXBMC_addon, "XBMC_register_me"); + if (XBMC_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_unregister_me = (void (*)(void* HANDLE, void* CB)) + dlsym(m_libXBMC_addon, "XBMC_unregister_me"); + if (XBMC_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_log = (void (*)(void* HANDLE, void* CB, const addon_log_t loglevel, const char *msg)) + dlsym(m_libXBMC_addon, "XBMC_log"); + if (XBMC_log == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_get_setting = (bool (*)(void* HANDLE, void* CB, const char* settingName, void *settingValue)) + dlsym(m_libXBMC_addon, "XBMC_get_setting"); + if (XBMC_get_setting == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_queue_notification = (void (*)(void* HANDLE, void* CB, const queue_msg_t loglevel, const char *msg)) + dlsym(m_libXBMC_addon, "XBMC_queue_notification"); + if (XBMC_queue_notification == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_wake_on_lan = (bool (*)(void* HANDLE, void *CB, const char *mac)) + dlsym(m_libXBMC_addon, "XBMC_wake_on_lan"); + if (XBMC_wake_on_lan == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_unknown_to_utf8 = (char* (*)(void* HANDLE, void* CB, const char* str)) + dlsym(m_libXBMC_addon, "XBMC_unknown_to_utf8"); + if (XBMC_unknown_to_utf8 == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_get_localized_string = (char* (*)(void* HANDLE, void* CB, int dwCode)) + dlsym(m_libXBMC_addon, "XBMC_get_localized_string"); + if (XBMC_get_localized_string == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_free_string = (void (*)(void* HANDLE, void* CB, char* str)) + dlsym(m_libXBMC_addon, "XBMC_free_string"); + if (XBMC_free_string == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_get_dvd_menu_language = (char* (*)(void* HANDLE, void* CB)) + dlsym(m_libXBMC_addon, "XBMC_get_dvd_menu_language"); + if (XBMC_get_dvd_menu_language == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_open_file = (void* (*)(void* HANDLE, void* CB, const char* strFileName, unsigned int flags)) + dlsym(m_libXBMC_addon, "XBMC_open_file"); + if (XBMC_open_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_open_file_for_write = (void* (*)(void* HANDLE, void* CB, const char* strFileName, bool bOverWrite)) + dlsym(m_libXBMC_addon, "XBMC_open_file_for_write"); + if (XBMC_open_file_for_write == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_read_file = (ssize_t (*)(void* HANDLE, void* CB, void* file, void* lpBuf, size_t uiBufSize)) + dlsym(m_libXBMC_addon, "XBMC_read_file"); + if (XBMC_read_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_read_file_string = (bool (*)(void* HANDLE, void* CB, void* file, char *szLine, int iLineLength)) + dlsym(m_libXBMC_addon, "XBMC_read_file_string"); + if (XBMC_read_file_string == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_write_file = (ssize_t (*)(void* HANDLE, void* CB, void* file, const void* lpBuf, size_t uiBufSize)) + dlsym(m_libXBMC_addon, "XBMC_write_file"); + if (XBMC_write_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_flush_file = (void (*)(void* HANDLE, void* CB, void* file)) + dlsym(m_libXBMC_addon, "XBMC_flush_file"); + if (XBMC_flush_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_seek_file = (int64_t (*)(void* HANDLE, void* CB, void* file, int64_t iFilePosition, int iWhence)) + dlsym(m_libXBMC_addon, "XBMC_seek_file"); + if (XBMC_seek_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_truncate_file = (int (*)(void* HANDLE, void* CB, void* file, int64_t iSize)) + dlsym(m_libXBMC_addon, "XBMC_truncate_file"); + if (XBMC_truncate_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_get_file_position = (int64_t (*)(void* HANDLE, void* CB, void* file)) + dlsym(m_libXBMC_addon, "XBMC_get_file_position"); + if (XBMC_get_file_position == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_get_file_length = (int64_t (*)(void* HANDLE, void* CB, void* file)) + dlsym(m_libXBMC_addon, "XBMC_get_file_length"); + if (XBMC_get_file_length == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_get_file_download_speed = (double(*)(void* HANDLE, void* CB, void* file)) + dlsym(m_libXBMC_addon, "XBMC_get_file_download_speed"); + if (XBMC_get_file_download_speed == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_close_file = (void (*)(void* HANDLE, void* CB, void* file)) + dlsym(m_libXBMC_addon, "XBMC_close_file"); + if (XBMC_close_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_get_file_chunk_size = (int (*)(void* HANDLE, void* CB, void* file)) + dlsym(m_libXBMC_addon, "XBMC_get_file_chunk_size"); + if (XBMC_get_file_chunk_size == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_file_exists = (bool (*)(void* HANDLE, void* CB, const char *strFileName, bool bUseCache)) + dlsym(m_libXBMC_addon, "XBMC_file_exists"); + if (XBMC_file_exists == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_stat_file = (int (*)(void* HANDLE, void* CB, const char *strFileName, struct __stat64* buffer)) + dlsym(m_libXBMC_addon, "XBMC_stat_file"); + if (XBMC_stat_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_delete_file = (bool (*)(void* HANDLE, void* CB, const char *strFileName)) + dlsym(m_libXBMC_addon, "XBMC_delete_file"); + if (XBMC_delete_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_can_open_directory = (bool (*)(void* HANDLE, void* CB, const char* strURL)) + dlsym(m_libXBMC_addon, "XBMC_can_open_directory"); + if (XBMC_can_open_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_create_directory = (bool (*)(void* HANDLE, void* CB, const char* strPath)) + dlsym(m_libXBMC_addon, "XBMC_create_directory"); + if (XBMC_create_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_directory_exists = (bool (*)(void* HANDLE, void* CB, const char* strPath)) + dlsym(m_libXBMC_addon, "XBMC_directory_exists"); + if (XBMC_directory_exists == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_remove_directory = (bool (*)(void* HANDLE, void* CB, const char* strPath)) + dlsym(m_libXBMC_addon, "XBMC_remove_directory"); + if (XBMC_remove_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_get_directory = (bool (*)(void* HANDLE, void* CB, const char* strPath, const char* mask, VFSDirEntry** items, unsigned int* num_items)) + dlsym(m_libXBMC_addon, "XBMC_get_directory"); + if (XBMC_get_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_free_directory = (void (*)(void* HANDLE, void* CB, VFSDirEntry* items, unsigned int num_items)) + dlsym(m_libXBMC_addon, "XBMC_free_directory"); + if (XBMC_free_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_curl_create = (void* (*)(void *HANDLE, void* CB, const char* strURL)) + dlsym(m_libXBMC_addon, "XBMC_curl_create"); + if (XBMC_curl_create == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_curl_add_option = (bool (*)(void *HANDLE, void* CB, void *file, XFILE::CURLOPTIONTYPE type, const char* name, const char *value)) + dlsym(m_libXBMC_addon, "XBMC_curl_add_option"); + if (XBMC_curl_add_option == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_curl_open = (bool (*)(void *HANDLE, void* CB, void *file, unsigned int flags)) + dlsym(m_libXBMC_addon, "XBMC_curl_open"); + if (XBMC_curl_open == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + m_Callbacks = XBMC_register_me(m_Handle); + return m_Callbacks != NULL; + } + + /*! + * @brief Add a message to XBMC's log. + * @param loglevel The log level of the message. + * @param format The format of the message to pass to XBMC. + */ + void Log(const addon_log_t loglevel, const char *format, ... ) + { + char buffer[16384]; + va_list args; + va_start (args, format); + vsprintf (buffer, format, args); + va_end (args); + return XBMC_log(m_Handle, m_Callbacks, loglevel, buffer); + } + + /*! + * @brief Get a settings value for this add-on. + * @param settingName The name of the setting to get. + * @param settingValue The value. + * @return True if the settings was fetched successfully, false otherwise. + */ + bool GetSetting(const char* settingName, void *settingValue) + { + return XBMC_get_setting(m_Handle, m_Callbacks, settingName, settingValue); + } + + /*! + * @brief Queue a notification in the GUI. + * @param type The message type. + * @param format The format of the message to pass to display in XBMC. + */ + void QueueNotification(const queue_msg_t type, const char *format, ... ) + { + char buffer[16384]; + va_list args; + va_start (args, format); + vsprintf (buffer, format, args); + va_end (args); + return XBMC_queue_notification(m_Handle, m_Callbacks, type, buffer); + } + + /*! + * @brief Send WakeOnLan magic packet. + * @param mac Network address of the host to wake. + * @return True if the magic packet was successfully sent, false otherwise. + */ + bool WakeOnLan(const char* mac) + { + return XBMC_wake_on_lan(m_Handle, m_Callbacks, mac); + } + + /*! + * @brief Translate a string with an unknown encoding to UTF8. + * @param str The string to translate. + * @return The string translated to UTF8. Must be freed by calling FreeString() when done. + */ + char* UnknownToUTF8(const char* str) + { + return XBMC_unknown_to_utf8(m_Handle, m_Callbacks, str); + } + + /*! + * @brief Get a localised message. + * @param dwCode The code of the message to get. + * @return The message. Must be freed by calling FreeString() when done. + */ + char* GetLocalizedString(int dwCode) + { + return XBMC_get_localized_string(m_Handle, m_Callbacks, dwCode); + } + + + /*! + * @brief Get the DVD menu language. + * @return The language. Must be freed by calling FreeString() when done. + */ + char* GetDVDMenuLanguage() + { + return XBMC_get_dvd_menu_language(m_Handle, m_Callbacks); + } + + /*! + * @brief Free the memory used by str + * @param str The string to free + */ + void FreeString(char* str) + { + return XBMC_free_string(m_Handle, m_Callbacks, str); + } + + /*! + * @brief Open the file with filename via XBMC's CFile. Needs to be closed by calling CloseFile() when done. + * @param strFileName The filename to open. + * @param flags The flags to pass. Documented in XBMC's File.h + * @return A handle for the file, or NULL if it couldn't be opened. + */ + void* OpenFile(const char* strFileName, unsigned int flags) + { + return XBMC_open_file(m_Handle, m_Callbacks, strFileName, flags); + } + + /*! + * @brief Open the file with filename via XBMC's CFile in write mode. Needs to be closed by calling CloseFile() when done. + * @param strFileName The filename to open. + * @param bOverWrite True to overwrite, false otherwise. + * @return A handle for the file, or NULL if it couldn't be opened. + */ + void* OpenFileForWrite(const char* strFileName, bool bOverWrite) + { + return XBMC_open_file_for_write(m_Handle, m_Callbacks, strFileName, bOverWrite); + } + + /*! + * @brief Read from an open file. + * @param file The file handle to read from. + * @param lpBuf The buffer to store the data in. + * @param uiBufSize The size of the buffer. + * @return number of successfully read bytes if any bytes were read and stored in + * buffer, zero if no bytes are available to read (end of file was reached) + * or undetectable error occur, -1 in case of any explicit error + */ + ssize_t ReadFile(void* file, void* lpBuf, size_t uiBufSize) + { + return XBMC_read_file(m_Handle, m_Callbacks, file, lpBuf, uiBufSize); + } + + /*! + * @brief Read a string from an open file. + * @param file The file handle to read from. + * @param szLine The buffer to store the data in. + * @param iLineLength The size of the buffer. + * @return True when a line was read, false otherwise. + */ + bool ReadFileString(void* file, char *szLine, int iLineLength) + { + return XBMC_read_file_string(m_Handle, m_Callbacks, file, szLine, iLineLength); + } + + /*! + * @brief Write to a file opened in write mode. + * @param file The file handle to write to. + * @param lpBuf The data to write. + * @param uiBufSize Size of the data to write. + * @return number of successfully written bytes if any bytes were written, + * zero if no bytes were written and no detectable error occur, + * -1 in case of any explicit error + */ + ssize_t WriteFile(void* file, const void* lpBuf, size_t uiBufSize) + { + return XBMC_write_file(m_Handle, m_Callbacks, file, lpBuf, uiBufSize); + } + + /*! + * @brief Flush buffered data. + * @param file The file handle to flush the data for. + */ + void FlushFile(void* file) + { + return XBMC_flush_file(m_Handle, m_Callbacks, file); + } + + /*! + * @brief Seek in an open file. + * @param file The file handle to see in. + * @param iFilePosition The new position. + * @param iWhence Seek argument. See stdio.h for possible values. + * @return The new position. + */ + int64_t SeekFile(void* file, int64_t iFilePosition, int iWhence) + { + return XBMC_seek_file(m_Handle, m_Callbacks, file, iFilePosition, iWhence); + } + + /*! + * @brief Truncate a file to the requested size. + * @param file The file handle to truncate. + * @param iSize The new max size. + * @return New size? + */ + int TruncateFile(void* file, int64_t iSize) + { + return XBMC_truncate_file(m_Handle, m_Callbacks, file, iSize); + } + + /*! + * @brief The current position in an open file. + * @param file The file handle to get the position for. + * @return The requested position. + */ + int64_t GetFilePosition(void* file) + { + return XBMC_get_file_position(m_Handle, m_Callbacks, file); + } + + /*! + * @brief Get the file size of an open file. + * @param file The file to get the size for. + * @return The requested size. + */ + int64_t GetFileLength(void* file) + { + return XBMC_get_file_length(m_Handle, m_Callbacks, file); + } + + /*! + * @brief Get the download speed of an open file if available. + * @param file The file to get the size for. + * @return The download speed in seconds. + */ + double GetFileDownloadSpeed(void* file) + { + return XBMC_get_file_download_speed(m_Handle, m_Callbacks, file); + } + + /*! + * @brief Close an open file. + * @param file The file handle to close. + */ + void CloseFile(void* file) + { + return XBMC_close_file(m_Handle, m_Callbacks, file); + } + + /*! + * @brief Get the chunk size for an open file. + * @param file the file handle to get the size for. + * @return The requested size. + */ + int GetFileChunkSize(void* file) + { + return XBMC_get_file_chunk_size(m_Handle, m_Callbacks, file); + } + + /*! + * @brief Check if a file exists. + * @param strFileName The filename to check. + * @param bUseCache Check in file cache. + * @return true if the file exists false otherwise. + */ + bool FileExists(const char *strFileName, bool bUseCache) + { + return XBMC_file_exists(m_Handle, m_Callbacks, strFileName, bUseCache); + } + + /*! + * @brief Reads file status. + * @param strFileName The filename to read the status from. + * @param buffer The file status is written into this buffer. + * @return The file status was successfully read. + */ + int StatFile(const char *strFileName, struct __stat64* buffer) + { + return XBMC_stat_file(m_Handle, m_Callbacks, strFileName, buffer); + } + + /*! + * @brief Deletes a file. + * @param strFileName The filename to delete. + * @return The file was successfully deleted. + */ + bool DeleteFile(const char *strFileName) + { + return XBMC_delete_file(m_Handle, m_Callbacks, strFileName); + } + + /*! + * @brief Checks whether a directory can be opened. + * @param strUrl The URL of the directory to check. + * @return True when it can be opened, false otherwise. + */ + bool CanOpenDirectory(const char* strUrl) + { + return XBMC_can_open_directory(m_Handle, m_Callbacks, strUrl); + } + + /*! + * @brief Creates a directory. + * @param strPath Path to the directory. + * @return True when it was created, false otherwise. + */ + bool CreateDirectory(const char *strPath) + { + return XBMC_create_directory(m_Handle, m_Callbacks, strPath); + } + + /*! + * @brief Checks if a directory exists. + * @param strPath Path to the directory. + * @return True when it exists, false otherwise. + */ + bool DirectoryExists(const char *strPath) + { + return XBMC_directory_exists(m_Handle, m_Callbacks, strPath); + } + + /*! + * @brief Removes a directory. + * @param strPath Path to the directory. + * @return True when it was removed, false otherwise. + */ + bool RemoveDirectory(const char *strPath) + { + return XBMC_remove_directory(m_Handle, m_Callbacks, strPath); + } + + /*! + * @brief Lists a directory. + * @param strPath Path to the directory. + * @param mask File mask + * @param items The directory entries + * @param num_items Number of entries in directory + * @return True if listing was successful, false otherwise. + */ + bool GetDirectory(const char *strPath, const char* mask, VFSDirEntry** items, unsigned int* num_items) + { + return XBMC_get_directory(m_Handle, m_Callbacks, strPath, mask, items, num_items); + } + + /*! + * @brief Free a directory list + * @param items The directory entries + * @param num_items Number of entries in directory + */ + void FreeDirectory(VFSDirEntry* items, unsigned int num_items) + { + return XBMC_free_directory(m_Handle, m_Callbacks, items, num_items); + } + + /*! + * @brief Create a Curl representation + * @param strURL the URL of the Type. + */ + void* CURLCreate(const char* strURL) + { + return XBMC_curl_create(m_Handle, m_Callbacks, strURL); + } + + /*! + * @brief Adds options to the curl file created with CURLCeate + * @param file file pointer to the file returned by CURLCeate + * @param type option type to set + * @param name name of the option + * @param value value of the option + */ + bool CURLAddOption(void* file, XFILE::CURLOPTIONTYPE type, const char* name, const char * value) + { + return XBMC_curl_add_option(m_Handle, m_Callbacks, file, type, name, value); + } + + /*! + * @brief Opens the curl file created with CURLCeate + * @param file file pointer to the file returned by CURLCeate + * @param flags one or more bitwise or combinded flags form XFILE + */ + bool CURLOpen(void* file, unsigned int flags) + { + return XBMC_curl_open(m_Handle, m_Callbacks, file, flags); + } + + protected: + void* (*XBMC_register_me)(void *HANDLE); + void (*XBMC_unregister_me)(void *HANDLE, void* CB); + void (*XBMC_log)(void *HANDLE, void* CB, const addon_log_t loglevel, const char *msg); + bool (*XBMC_get_setting)(void *HANDLE, void* CB, const char* settingName, void *settingValue); + void (*XBMC_queue_notification)(void *HANDLE, void* CB, const queue_msg_t type, const char *msg); + bool (*XBMC_wake_on_lan)(void *HANDLE, void* CB, const char* mac); + char* (*XBMC_unknown_to_utf8)(void *HANDLE, void* CB, const char* str); + char* (*XBMC_get_localized_string)(void *HANDLE, void* CB, int dwCode); + char* (*XBMC_get_dvd_menu_language)(void *HANDLE, void* CB); + void (*XBMC_free_string)(void *HANDLE, void* CB, char* str); + void* (*XBMC_open_file)(void *HANDLE, void* CB, const char* strFileName, unsigned int flags); + void* (*XBMC_open_file_for_write)(void *HANDLE, void* CB, const char* strFileName, bool bOverWrite); + ssize_t (*XBMC_read_file)(void *HANDLE, void* CB, void* file, void* lpBuf, size_t uiBufSize); + bool (*XBMC_read_file_string)(void *HANDLE, void* CB, void* file, char *szLine, int iLineLength); + ssize_t(*XBMC_write_file)(void *HANDLE, void* CB, void* file, const void* lpBuf, size_t uiBufSize); + void (*XBMC_flush_file)(void *HANDLE, void* CB, void* file); + int64_t (*XBMC_seek_file)(void *HANDLE, void* CB, void* file, int64_t iFilePosition, int iWhence); + int (*XBMC_truncate_file)(void *HANDLE, void* CB, void* file, int64_t iSize); + int64_t (*XBMC_get_file_position)(void *HANDLE, void* CB, void* file); + int64_t (*XBMC_get_file_length)(void *HANDLE, void* CB, void* file); + double(*XBMC_get_file_download_speed)(void *HANDLE, void* CB, void* file); + void (*XBMC_close_file)(void *HANDLE, void* CB, void* file); + int (*XBMC_get_file_chunk_size)(void *HANDLE, void* CB, void* file); + bool (*XBMC_file_exists)(void *HANDLE, void* CB, const char *strFileName, bool bUseCache); + int (*XBMC_stat_file)(void *HANDLE, void* CB, const char *strFileName, struct __stat64* buffer); + bool (*XBMC_delete_file)(void *HANDLE, void* CB, const char *strFileName); + bool (*XBMC_can_open_directory)(void *HANDLE, void* CB, const char* strURL); + bool (*XBMC_create_directory)(void *HANDLE, void* CB, const char* strPath); + bool (*XBMC_directory_exists)(void *HANDLE, void* CB, const char* strPath); + bool (*XBMC_remove_directory)(void *HANDLE, void* CB, const char* strPath); + bool (*XBMC_get_directory)(void *HANDLE, void* CB, const char* strPath, const char* mask, VFSDirEntry** items, unsigned int* num_items); + void (*XBMC_free_directory)(void *HANDLE, void* CB, VFSDirEntry* items, unsigned int num_items); + void* (*XBMC_curl_create)(void *HANDLE, void* CB, const char* strURL); + bool (*XBMC_curl_add_option)(void *HANDLE, void* CB, void *file, XFILE::CURLOPTIONTYPE type, const char* name, const char *value); + bool (*XBMC_curl_open)(void *m_Handle, void *m_Callbacks, void *file, unsigned int flags); + + private: + void *m_libXBMC_addon; + void *m_Handle; + void *m_Callbacks; + struct cb_array + { + const char* libPath; + }; + }; +}; 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 @@ +#pragma once +/* + * Copyright (C) 2005-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include +#include +#include +#include +#include +#include "xbmc_codec_types.h" +#include "libXBMC_addon.h" + +#ifdef _WIN32 +#define CODEC_HELPER_DLL "\\library.xbmc.codec\\libXBMC_codec" ADDON_HELPER_EXT +#else +#define CODEC_HELPER_DLL_NAME "libXBMC_codec-" ADDON_HELPER_ARCH ADDON_HELPER_EXT +#define CODEC_HELPER_DLL "/library.xbmc.codec/" CODEC_HELPER_DLL_NAME +#endif + +class CHelper_libXBMC_codec +{ +public: + CHelper_libXBMC_codec(void) + { + m_libXBMC_codec = NULL; + m_Handle = NULL; + } + + ~CHelper_libXBMC_codec(void) + { + if (m_libXBMC_codec) + { + CODEC_unregister_me(m_Handle, m_Callbacks); + dlclose(m_libXBMC_codec); + } + } + + /*! + * @brief Resolve all callback methods + * @param handle Pointer to the add-on + * @return True when all methods were resolved, false otherwise. + */ + bool RegisterMe(void* handle) + { + m_Handle = handle; + + std::string libBasePath; + libBasePath = ((cb_array*)m_Handle)->libPath; + libBasePath += CODEC_HELPER_DLL; + +#if defined(ANDROID) + struct stat st; + if(stat(libBasePath.c_str(),&st) != 0) + { + std::string tempbin = getenv("XBMC_ANDROID_LIBS"); + libBasePath = tempbin + "/" + CODEC_HELPER_DLL_NAME; + } +#endif + + m_libXBMC_codec = dlopen(libBasePath.c_str(), RTLD_LAZY); + if (m_libXBMC_codec == NULL) + { + fprintf(stderr, "Unable to load %s\n", dlerror()); + return false; + } + + CODEC_register_me = (void* (*)(void *HANDLE)) + dlsym(m_libXBMC_codec, "CODEC_register_me"); + if (CODEC_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + CODEC_unregister_me = (void (*)(void* HANDLE, void* CB)) + dlsym(m_libXBMC_codec, "CODEC_unregister_me"); + if (CODEC_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + CODEC_get_codec_by_name = (xbmc_codec_t (*)(void* HANDLE, void* CB, const char* strCodecName)) + dlsym(m_libXBMC_codec, "CODEC_get_codec_by_name"); + if (CODEC_get_codec_by_name == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + m_Callbacks = CODEC_register_me(m_Handle); + return m_Callbacks != NULL; + } + + /*! + * @brief Get the codec id used by XBMC + * @param strCodecName The name of the codec + * @return The codec_id, or a codec_id with 0 values when not supported + */ + xbmc_codec_t GetCodecByName(const char* strCodecName) + { + return CODEC_get_codec_by_name(m_Handle, m_Callbacks, strCodecName); + } + +protected: + void* (*CODEC_register_me)(void*); + void (*CODEC_unregister_me)(void*, void*); + xbmc_codec_t (*CODEC_get_codec_by_name)(void *HANDLE, void* CB, const char* strCodecName); + +private: + void* m_libXBMC_codec; + void* m_Handle; + void* m_Callbacks; + struct cb_array + { + const char* libPath; + }; +}; + 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 @@ +#pragma once +/* + * Copyright (C) 2005-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include +#include +#include +#include +#include +#include "xbmc_pvr_types.h" +#include "libXBMC_addon.h" + +#ifdef _WIN32 +#define PVR_HELPER_DLL "\\library.xbmc.pvr\\libXBMC_pvr" ADDON_HELPER_EXT +#else +#define PVR_HELPER_DLL_NAME "libXBMC_pvr-" ADDON_HELPER_ARCH ADDON_HELPER_EXT +#define PVR_HELPER_DLL "/library.xbmc.pvr/" PVR_HELPER_DLL_NAME +#endif + +#define DVD_TIME_BASE 1000000 +#define DVD_NOPTS_VALUE (-1LL<<52) // should be possible to represent in both double and __int64 + +class CHelper_libXBMC_pvr +{ +public: + CHelper_libXBMC_pvr(void) + { + m_libXBMC_pvr = NULL; + m_Handle = NULL; + } + + ~CHelper_libXBMC_pvr(void) + { + if (m_libXBMC_pvr) + { + PVR_unregister_me(m_Handle, m_Callbacks); + dlclose(m_libXBMC_pvr); + } + } + + /*! + * @brief Resolve all callback methods + * @param handle Pointer to the add-on + * @return True when all methods were resolved, false otherwise. + */ + bool RegisterMe(void* handle) + { + m_Handle = handle; + + std::string libBasePath; + libBasePath = ((cb_array*)m_Handle)->libPath; + libBasePath += PVR_HELPER_DLL; + +#if defined(ANDROID) + struct stat st; + if(stat(libBasePath.c_str(),&st) != 0) + { + std::string tempbin = getenv("XBMC_ANDROID_LIBS"); + libBasePath = tempbin + "/" + PVR_HELPER_DLL_NAME; + } +#endif + + m_libXBMC_pvr = dlopen(libBasePath.c_str(), RTLD_LAZY); + if (m_libXBMC_pvr == NULL) + { + fprintf(stderr, "Unable to load %s\n", dlerror()); + return false; + } + + PVR_register_me = (void* (*)(void *HANDLE)) + dlsym(m_libXBMC_pvr, "PVR_register_me"); + if (PVR_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_unregister_me = (void (*)(void* HANDLE, void* CB)) + dlsym(m_libXBMC_pvr, "PVR_unregister_me"); + if (PVR_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_transfer_epg_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const EPG_TAG *epgentry)) + dlsym(m_libXBMC_pvr, "PVR_transfer_epg_entry"); + if (PVR_transfer_epg_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_transfer_channel_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL *chan)) + dlsym(m_libXBMC_pvr, "PVR_transfer_channel_entry"); + if (PVR_transfer_channel_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_transfer_timer_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_TIMER *timer)) + dlsym(m_libXBMC_pvr, "PVR_transfer_timer_entry"); + if (PVR_transfer_timer_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_transfer_recording_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_RECORDING *recording)) + dlsym(m_libXBMC_pvr, "PVR_transfer_recording_entry"); + if (PVR_transfer_recording_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_add_menu_hook = (void (*)(void* HANDLE, void* CB, PVR_MENUHOOK *hook)) + dlsym(m_libXBMC_pvr, "PVR_add_menu_hook"); + if (PVR_add_menu_hook == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_recording = (void (*)(void* HANDLE, void* CB, const char *Name, const char *FileName, bool On)) + dlsym(m_libXBMC_pvr, "PVR_recording"); + if (PVR_recording == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_trigger_timer_update = (void (*)(void* HANDLE, void* CB)) + dlsym(m_libXBMC_pvr, "PVR_trigger_timer_update"); + if (PVR_trigger_timer_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_trigger_recording_update = (void (*)(void* HANDLE, void* CB)) + dlsym(m_libXBMC_pvr, "PVR_trigger_recording_update"); + if (PVR_trigger_recording_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_trigger_channel_update = (void (*)(void* HANDLE, void* CB)) + dlsym(m_libXBMC_pvr, "PVR_trigger_channel_update"); + if (PVR_trigger_channel_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_trigger_channel_groups_update = (void (*)(void* HANDLE, void* CB)) + dlsym(m_libXBMC_pvr, "PVR_trigger_channel_groups_update"); + if (PVR_trigger_channel_groups_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_trigger_epg_update = (void (*)(void* HANDLE, void* CB, unsigned int iChannelUid)) + dlsym(m_libXBMC_pvr, "PVR_trigger_epg_update"); + if (PVR_trigger_epg_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_transfer_channel_group = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP *group)) + dlsym(m_libXBMC_pvr, "PVR_transfer_channel_group"); + if (PVR_transfer_channel_group == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_transfer_channel_group_member = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER *member)) + dlsym(m_libXBMC_pvr, "PVR_transfer_channel_group_member"); + if (PVR_transfer_channel_group_member == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + +#ifdef USE_DEMUX + PVR_free_demux_packet = (void (*)(void* HANDLE, void* CB, DemuxPacket* pPacket)) + dlsym(m_libXBMC_pvr, "PVR_free_demux_packet"); + if (PVR_free_demux_packet == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_allocate_demux_packet = (DemuxPacket* (*)(void* HANDLE, void* CB, int iDataSize)) + dlsym(m_libXBMC_pvr, "PVR_allocate_demux_packet"); + if (PVR_allocate_demux_packet == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } +#endif + + PVR_connection_state_change = (void (*)(void* HANDLE, void* CB, const char *strConnectionString, PVR_CONNECTION_STATE newState, const char *strMessage)) + dlsym(m_libXBMC_pvr, "PVR_connection_state_change"); + if (PVR_connection_state_change == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + PVR_epg_event_state_change = (void (*)(void* HANDLE, void* CB, EPG_TAG* tag, unsigned int iUniqueChannelId, EPG_EVENT_STATE newState)) + dlsym(m_libXBMC_pvr, "PVR_epg_event_state_change"); + if (PVR_epg_event_state_change == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + m_Callbacks = PVR_register_me(m_Handle); + return m_Callbacks != NULL; + } + + /*! + * @brief Transfer an EPG tag from the add-on to XBMC + * @param handle The handle parameter that XBMC used when requesting the EPG data + * @param entry The entry to transfer to XBMC + */ + void TransferEpgEntry(const ADDON_HANDLE handle, const EPG_TAG* entry) + { + return PVR_transfer_epg_entry(m_Handle, m_Callbacks, handle, entry); + } + + /*! + * @brief Transfer a channel entry from the add-on to XBMC + * @param handle The handle parameter that XBMC used when requesting the channel list + * @param entry The entry to transfer to XBMC + */ + void TransferChannelEntry(const ADDON_HANDLE handle, const PVR_CHANNEL* entry) + { + return PVR_transfer_channel_entry(m_Handle, m_Callbacks, handle, entry); + } + + /*! + * @brief Transfer a timer entry from the add-on to XBMC + * @param handle The handle parameter that XBMC used when requesting the timers list + * @param entry The entry to transfer to XBMC + */ + void TransferTimerEntry(const ADDON_HANDLE handle, const PVR_TIMER* entry) + { + return PVR_transfer_timer_entry(m_Handle, m_Callbacks, handle, entry); + } + + /*! + * @brief Transfer a recording entry from the add-on to XBMC + * @param handle The handle parameter that XBMC used when requesting the recordings list + * @param entry The entry to transfer to XBMC + */ + void TransferRecordingEntry(const ADDON_HANDLE handle, const PVR_RECORDING* entry) + { + return PVR_transfer_recording_entry(m_Handle, m_Callbacks, handle, entry); + } + + /*! + * @brief Transfer a channel group from the add-on to XBMC. The group will be created if it doesn't exist. + * @param handle The handle parameter that XBMC used when requesting the channel groups list + * @param entry The entry to transfer to XBMC + */ + void TransferChannelGroup(const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP* entry) + { + return PVR_transfer_channel_group(m_Handle, m_Callbacks, handle, entry); + } + + /*! + * @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. + * @param handle The handle parameter that XBMC used when requesting the channel group members list + * @param entry The entry to transfer to XBMC + */ + void TransferChannelGroupMember(const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER* entry) + { + return PVR_transfer_channel_group_member(m_Handle, m_Callbacks, handle, entry); + } + + /*! + * @brief Add or replace a menu hook for the context menu for this add-on + * @param hook The hook to add + */ + void AddMenuHook(PVR_MENUHOOK* hook) + { + return PVR_add_menu_hook(m_Handle, m_Callbacks, hook); + } + + /*! + * @brief Display a notification in XBMC that a recording started or stopped on the server + * @param strRecordingName The name of the recording to display + * @param strFileName The filename of the recording + * @param bOn True when recording started, false when it stopped + */ + void Recording(const char* strRecordingName, const char* strFileName, bool bOn) + { + return PVR_recording(m_Handle, m_Callbacks, strRecordingName, strFileName, bOn); + } + + /*! + * @brief Request XBMC to update it's list of timers + */ + void TriggerTimerUpdate(void) + { + return PVR_trigger_timer_update(m_Handle, m_Callbacks); + } + + /*! + * @brief Request XBMC to update it's list of recordings + */ + void TriggerRecordingUpdate(void) + { + return PVR_trigger_recording_update(m_Handle, m_Callbacks); + } + + /*! + * @brief Request XBMC to update it's list of channels + */ + void TriggerChannelUpdate(void) + { + return PVR_trigger_channel_update(m_Handle, m_Callbacks); + } + + /*! + * @brief Schedule an EPG update for the given channel channel + * @param iChannelUid The unique id of the channel for this add-on + */ + void TriggerEpgUpdate(unsigned int iChannelUid) + { + return PVR_trigger_epg_update(m_Handle, m_Callbacks, iChannelUid); + } + + /*! + * @brief Request XBMC to update it's list of channel groups + */ + void TriggerChannelGroupsUpdate(void) + { + return PVR_trigger_channel_groups_update(m_Handle, m_Callbacks); + } + +#ifdef USE_DEMUX + /*! + * @brief Free a packet that was allocated with AllocateDemuxPacket + * @param pPacket The packet to free + */ + void FreeDemuxPacket(DemuxPacket* pPacket) + { + return PVR_free_demux_packet(m_Handle, m_Callbacks, pPacket); + } + + /*! + * @brief Allocate a demux packet. Free with FreeDemuxPacket + * @param iDataSize The size of the data that will go into the packet + * @return The allocated packet + */ + DemuxPacket* AllocateDemuxPacket(int iDataSize) + { + return PVR_allocate_demux_packet(m_Handle, m_Callbacks, iDataSize); + } +#endif + + /*! + * @brief Notify a state change for a PVR backend connection + * @param strConnectionString The connection string reported by the backend that can be displayed in the UI. + * @param newState The new state. + * @param strMessage A localized addon-defined string representing the new state, that can be displayed + * in the UI or NULL if the Kodi-defined default string for the new state shall be displayed. + */ + void ConnectionStateChange(const char *strConnectionString, PVR_CONNECTION_STATE newState, const char *strMessage) + { + return PVR_connection_state_change(m_Handle, m_Callbacks, strConnectionString, newState, strMessage); + } + + /*! + * @brief Notify a state change for an EPG event + * @param tag The EPG event. + * @param iUniqueChannelId The unique id of the channel for the EPG event + * @param newState The new state. For EPG_EVENT_CREATED and EPG_EVENT_UPDATED, tag must be filled with all available + * event data, not just a delta. For EPG_EVENT_DELETED, it is sufficient to fill EPG_TAG.iUniqueBroadcastId + */ + void EpgEventStateChange(EPG_TAG *tag, unsigned int iUniqueChannelId, EPG_EVENT_STATE newState) + { + return PVR_epg_event_state_change(m_Handle, m_Callbacks, tag, iUniqueChannelId, newState); + } + +protected: + void* (*PVR_register_me)(void*); + void (*PVR_unregister_me)(void*, void*); + void (*PVR_transfer_epg_entry)(void*, void*, const ADDON_HANDLE, const EPG_TAG*); + void (*PVR_transfer_channel_entry)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL*); + void (*PVR_transfer_timer_entry)(void*, void*, const ADDON_HANDLE, const PVR_TIMER*); + void (*PVR_transfer_recording_entry)(void*, void*, const ADDON_HANDLE, const PVR_RECORDING*); + void (*PVR_add_menu_hook)(void*, void*, PVR_MENUHOOK*); + void (*PVR_recording)(void*, void*, const char*, const char*, bool); + void (*PVR_trigger_channel_update)(void*, void*); + void (*PVR_trigger_channel_groups_update)(void*, void*); + void (*PVR_trigger_timer_update)(void*, void*); + void (*PVR_trigger_recording_update)(void* , void*); + void (*PVR_trigger_epg_update)(void*, void*, unsigned int); + void (*PVR_transfer_channel_group)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL_GROUP*); + void (*PVR_transfer_channel_group_member)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL_GROUP_MEMBER*); +#ifdef USE_DEMUX + void (*PVR_free_demux_packet)(void*, void*, DemuxPacket*); + DemuxPacket* (*PVR_allocate_demux_packet)(void*, void*, int); +#endif + void (*PVR_connection_state_change)(void*, void*, const char*, PVR_CONNECTION_STATE, const char*); + void (*PVR_epg_event_state_change)(void*, void*, EPG_TAG*, unsigned int, EPG_EVENT_STATE); + +private: + void* m_libXBMC_pvr; + void* m_Handle; + void* m_Callbacks; + struct cb_array + { + const char* libPath; + }; +}; diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h new file mode 100644 index 0000000..2eb972e --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h @@ -0,0 +1,189 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +#include "xbmc_addon_types.h" + +#include +#include +#include + +class DllSetting +{ +public: + enum SETTING_TYPE { NONE=0, CHECK, SPIN }; + + DllSetting(SETTING_TYPE t, const char *n, const char *l) + { + id = NULL; + label = NULL; + if (n) + { + id = new char[strlen(n)+1]; + strcpy(id, n); + } + if (l) + { + label = new char[strlen(l)+1]; + strcpy(label, l); + } + current = 0; + type = t; + } + + DllSetting(const DllSetting &rhs) // copy constructor + { + id = NULL; + label = NULL; + if (rhs.id) + { + id = new char[strlen(rhs.id)+1]; + strcpy(id, rhs.id); + } + if (rhs.label) + { + label = new char[strlen(rhs.label)+1]; + strcpy(label, rhs.label); + } + current = rhs.current; + type = rhs.type; + for (unsigned int i = 0; i < rhs.entry.size(); i++) + { + char *lab = new char[strlen(rhs.entry[i]) + 1]; + strcpy(lab, rhs.entry[i]); + entry.push_back(lab); + } + } + + ~DllSetting() + { + delete[] id; + delete[] label; + for (unsigned int i=0; i < entry.size(); i++) + delete[] entry[i]; + } + + void AddEntry(const char *label) + { + if (!label || type != SPIN) return; + char *lab = new char[strlen(label) + 1]; + strcpy(lab, label); + entry.push_back(lab); + } + + // data members + SETTING_TYPE type; + char* id; + char* label; + int current; + std::vector entry; +}; + +class DllUtils +{ +public: + + static unsigned int VecToStruct(std::vector &vecSet, ADDON_StructSetting*** sSet) + { + *sSet = NULL; + if (vecSet.empty()) + return 0; + + unsigned int uiElements=0; + + *sSet = (ADDON_StructSetting**)malloc(vecSet.size()*sizeof(ADDON_StructSetting*)); + for(unsigned int i=0;iid = NULL; + (*sSet)[i]->label = NULL; + uiElements++; + + if (vecSet[i].id && vecSet[i].label) + { + (*sSet)[i]->id = strdup(vecSet[i].id); + (*sSet)[i]->label = strdup(vecSet[i].label); + (*sSet)[i]->type = vecSet[i].type; + (*sSet)[i]->current = vecSet[i].current; + (*sSet)[i]->entry_elements = 0; + (*sSet)[i]->entry = NULL; + if(vecSet[i].type == DllSetting::SPIN && !vecSet[i].entry.empty()) + { + (*sSet)[i]->entry = (char**)malloc(vecSet[i].entry.size()*sizeof(char**)); + for(unsigned int j=0;j 0) + { + (*sSet)[i]->entry[j] = strdup(vecSet[i].entry[j]); + (*sSet)[i]->entry_elements++; + } + } + } + } + } + return uiElements; + } + + static void StructToVec(unsigned int iElements, ADDON_StructSetting*** sSet, std::vector *vecSet) + { + if(iElements == 0) + return; + + vecSet->clear(); + for(unsigned int i=0;itype, (*sSet)[i]->id, (*sSet)[i]->label); + if((*sSet)[i]->type == DllSetting::SPIN) + { + for(unsigned int j=0;j<(*sSet)[i]->entry_elements;j++) + { + vSet.AddEntry((*sSet)[i]->entry[j]); + } + } + vSet.current = (*sSet)[i]->current; + vecSet->push_back(vSet); + } + } + + static void FreeStruct(unsigned int iElements, ADDON_StructSetting*** sSet) + { + if(iElements == 0) + return; + + for(unsigned int i=0;itype == DllSetting::SPIN) + { + for(unsigned int j=0;j<(*sSet)[i]->entry_elements;j++) + { + free((*sSet)[i]->entry[j]); + } + free((*sSet)[i]->entry); + } + free((*sSet)[i]->id); + free((*sSet)[i]->label); + free((*sSet)[i]); + } + free(*sSet); + } +}; + diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h new file mode 100644 index 0000000..ff7194f --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h @@ -0,0 +1,52 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +#ifdef TARGET_WINDOWS +#include +#else +#ifndef __cdecl +#define __cdecl +#endif +#ifndef __declspec +#define __declspec(X) +#endif +#endif + +#include "xbmc_addon_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + ADDON_STATUS __declspec(dllexport) ADDON_Create(void *callbacks, void* props); + void __declspec(dllexport) ADDON_Stop(); + void __declspec(dllexport) ADDON_Destroy(); + ADDON_STATUS __declspec(dllexport) ADDON_GetStatus(); + bool __declspec(dllexport) ADDON_HasSettings(); + unsigned int __declspec(dllexport) ADDON_GetSettings(ADDON_StructSetting ***sSet); + ADDON_STATUS __declspec(dllexport) ADDON_SetSetting(const char *settingName, const void *settingValue); + void __declspec(dllexport) ADDON_FreeSettings(); + void __declspec(dllexport) ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data); + +#ifdef __cplusplus +}; +#endif diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h new file mode 100644 index 0000000..2ceb5c5 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h @@ -0,0 +1,62 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +enum ADDON_STATUS +{ + ADDON_STATUS_OK, + ADDON_STATUS_LOST_CONNECTION, + ADDON_STATUS_NEED_RESTART, + ADDON_STATUS_NEED_SETTINGS, + ADDON_STATUS_UNKNOWN, + ADDON_STATUS_NEED_SAVEDSETTINGS, + ADDON_STATUS_PERMANENT_FAILURE /**< permanent failure, like failing to resolve methods */ +}; + +typedef struct +{ + int type; + char* id; + char* label; + int current; + char** entry; + unsigned int entry_elements; +} ADDON_StructSetting; + +/*! + * @brief Handle used to return data from the PVR add-on to CPVRClient + */ +struct ADDON_HANDLE_STRUCT +{ + void *callerAddress; /*!< address of the caller */ + void *dataAddress; /*!< address to store data in */ + int dataIdentifier; /*!< parameter to pass back when calling the callback */ +}; +typedef ADDON_HANDLE_STRUCT *ADDON_HANDLE; + +#ifdef __cplusplus +}; +#endif + diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h new file mode 100644 index 0000000..932d34f --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h @@ -0,0 +1,58 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +#include +#include "xbmc_addon_dll.h" +#include "xbmc_audioenc_types.h" + +extern "C" +{ + //! \copydoc AudioEncoder::Create + void* Create(audioenc_callbacks *callbacks); + + //! \copydoc AudioEncoder::Start + bool Start(void* context, int iInChannels, int iInRate, int iInBits, + const char* title, const char* artist, + const char* albumartist, const char* album, + const char* year, const char* track, + const char* genre, const char* comment, int iTrackLength); + + //! \copydoc AudioEncoder::Encode + int Encode(void* context, int nNumBytesRead, uint8_t* pbtStream); + + //! \copydoc AudioEncoder::Finish + bool Finish(void* context); + + //! \copydoc AudioEncoder::Free + void Free(void* context); + + // function to export the above structure to XBMC + void __declspec(dllexport) get_addon(struct AudioEncoder* pScr) + { + pScr->Create = Create; + pScr->Start = Start; + pScr->Encode = Encode; + pScr->Finish = Finish; + pScr->Free = Free; + }; +}; + diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h new file mode 100644 index 0000000..df5164e --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h @@ -0,0 +1,110 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +#ifdef TARGET_WINDOWS +#include +#else +#ifndef __cdecl +#define __cdecl +#endif +#ifndef __declspec +#define __declspec(X) +#endif +#endif + +#include + +extern "C" +{ + struct AUDIOENC_INFO + { + int dummy; + }; + + struct AUDIOENC_PROPS + { + int dummy; + }; + + typedef int (*audioenc_write_callback)(void* opaque, uint8_t* data, int len); + typedef int64_t (*audioenc_seek_callback)(void* opaque, int64_t pos, int whence); + + typedef struct + { + void* opaque; + audioenc_write_callback write; + audioenc_seek_callback seek; + } audioenc_callbacks; + + struct AudioEncoder + { + /*! \brief Create encoder context + \param callbacks Pointer to audioenc_callbacks structure. + \return opaque pointer to encoder context, to be passed to other methods. + \sa IEncoder::Init + */ + void (*(__cdecl *Create) (audioenc_callbacks* callbacks)); + + /*! \brief Start encoder + \param context Encoder context from Create. + \param iInChannels Number of channels + \param iInRate Sample rate of input data + \param iInBits Bits per sample in input data + \param title The title of the song + \param artist The artist of the song + \param albumartist The albumartist of the song + \param year The year of the song + \param track The track number of the song + \param genre The genre of the song + \param comment A comment to attach to the song + \param iTrackLength Total track length in seconds + \sa IEncoder::Init + */ + bool (__cdecl* Start) (void* context, int iInChannels, int iInRate, int iInBits, + const char* title, const char* artist, + const char* albumartist, const char* album, + const char* year, const char* track, + const char* genre, const char* comment, + int iTrackLength); + + /*! \brief Encode a chunk of audio + \param context Encoder context from Create. + \param nNumBytesRead Number of bytes in input buffer + \param pbtStream the input buffer + \return Number of bytes consumed + \sa IEncoder::Encode + */ + int (__cdecl* Encode) (void* context, int nNumBytesRead, uint8_t* pbtStream); + + /*! \brief Finalize encoding + \param context Encoder context from Create. + \return True on success, false on failure. + */ + bool (__cdecl* Finish) (void* context); + + /*! \brief Free encoder context + \param context Encoder context to free. + */ + void (__cdecl* Free)(void* context); + }; +} + diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h new file mode 100644 index 0000000..01e7548 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h @@ -0,0 +1,52 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef unsigned int xbmc_codec_id_t; + +typedef enum +{ + XBMC_CODEC_TYPE_UNKNOWN = -1, + XBMC_CODEC_TYPE_VIDEO, + XBMC_CODEC_TYPE_AUDIO, + XBMC_CODEC_TYPE_DATA, + XBMC_CODEC_TYPE_SUBTITLE, + XBMC_CODEC_TYPE_RDS, + XBMC_CODEC_TYPE_NB +} xbmc_codec_type_t; + +typedef struct +{ + xbmc_codec_type_t codec_type; + xbmc_codec_id_t codec_id; +} xbmc_codec_t; + +#define XBMC_INVALID_CODEC_ID 0 +#define XBMC_INVALID_CODEC { XBMC_CODEC_TYPE_UNKNOWN, XBMC_INVALID_CODEC_ID } + +#ifdef __cplusplus +}; +#endif + diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h new file mode 100644 index 0000000..9460952 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h @@ -0,0 +1,123 @@ +#pragma once +/* + * Copyright (C) 2005-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include +#include + +#undef ATTRIBUTE_PACKED +#undef PRAGMA_PACK_BEGIN +#undef PRAGMA_PACK_END + +#if defined(__GNUC__) +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define ATTRIBUTE_PACKED __attribute__ ((packed)) +#define PRAGMA_PACK 0 +#endif +#endif + +#if !defined(ATTRIBUTE_PACKED) +#define ATTRIBUTE_PACKED +#define PRAGMA_PACK 1 +#endif + +/*! @name EPG entry content event types */ +//@{ +/* These IDs come from the DVB-SI EIT table "content descriptor" + * Also known under the name "E-book genre assignments" + */ +#define EPG_EVENT_CONTENTMASK_UNDEFINED 0x00 +#define EPG_EVENT_CONTENTMASK_MOVIEDRAMA 0x10 +#define EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS 0x20 +#define EPG_EVENT_CONTENTMASK_SHOW 0x30 +#define EPG_EVENT_CONTENTMASK_SPORTS 0x40 +#define EPG_EVENT_CONTENTMASK_CHILDRENYOUTH 0x50 +#define EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE 0x60 +#define EPG_EVENT_CONTENTMASK_ARTSCULTURE 0x70 +#define EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS 0x80 +#define EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE 0x90 +#define EPG_EVENT_CONTENTMASK_LEISUREHOBBIES 0xA0 +#define EPG_EVENT_CONTENTMASK_SPECIAL 0xB0 +#define EPG_EVENT_CONTENTMASK_USERDEFINED 0xF0 +//@} + +/* Set EPGTAG.iGenreType to EPG_GENRE_USE_STRING to transfer genre strings to XBMC */ +#define EPG_GENRE_USE_STRING 0x100 + +#ifdef __cplusplus +extern "C" { +#endif + + /* EPG_TAG.iFlags values */ + const unsigned int EPG_TAG_FLAG_UNDEFINED = 0x00000000; /*!< @brief nothing special to say about this entry */ + const unsigned int EPG_TAG_FLAG_IS_SERIES = 0x00000001; /*!< @brief this EPG entry is part of a series */ + + /* Special EPG_TAG.iUniqueBroadcastId value */ + + /*! + * @brief special EPG_TAG.iUniqueBroadcastId value to indicate that a tag has not a valid EPG event uid. + */ + const unsigned int EPG_TAG_INVALID_UID = 0; + + /*! + * @brief EPG event states. Used with EpgEventStateChange callback. + */ + typedef enum + { + EPG_EVENT_CREATED = 0, /*!< @brief event created */ + EPG_EVENT_UPDATED = 1, /*!< @brief event updated */ + EPG_EVENT_DELETED = 2, /*!< @brief event deleted */ + } EPG_EVENT_STATE; + + /*! + * @brief Representation of an EPG event. + */ + typedef struct EPG_TAG { + unsigned int iUniqueBroadcastId; /*!< @brief (required) identifier for this event. Valid uids must be greater than EPG_TAG_INVALID_UID. */ + const char * strTitle; /*!< @brief (required) this event's title */ + unsigned int iChannelNumber; /*!< @brief (required) the number of the channel this event occurs on */ + time_t startTime; /*!< @brief (required) start time in UTC */ + time_t endTime; /*!< @brief (required) end time in UTC */ + const char * strPlotOutline; /*!< @brief (optional) plot outline */ + const char * strPlot; /*!< @brief (optional) plot */ + const char * strOriginalTitle; /*!< @brief (optional) originaltitle */ + const char * strCast; /*!< @brief (optional) cast */ + const char * strDirector; /*!< @brief (optional) director */ + const char * strWriter; /*!< @brief (optional) writer */ + int iYear; /*!< @brief (optional) year */ + const char * strIMDBNumber; /*!< @brief (optional) IMDBNumber */ + const char * strIconPath; /*!< @brief (optional) icon path */ + int iGenreType; /*!< @brief (optional) genre type */ + int iGenreSubType; /*!< @brief (optional) genre sub type */ + const char * strGenreDescription; /*!< @brief (optional) genre. Will be used only when iGenreType = EPG_GENRE_USE_STRING */ + time_t firstAired; /*!< @brief (optional) first aired in UTC */ + int iParentalRating; /*!< @brief (optional) parental rating */ + int iStarRating; /*!< @brief (optional) star rating */ + bool bNotify; /*!< @brief (optional) notify the user when this event starts */ + int iSeriesNumber; /*!< @brief (optional) series number */ + int iEpisodeNumber; /*!< @brief (optional) episode number */ + int iEpisodePartNumber; /*!< @brief (optional) episode part number */ + const char * strEpisodeName; /*!< @brief (optional) episode name */ + unsigned int iFlags; /*!< @brief (optional) bit field of independent flags associated with the EPG entry */ + } ATTRIBUTE_PACKED EPG_TAG; + +#ifdef __cplusplus +} +#endif diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h new file mode 100644 index 0000000..8b54ea6 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h @@ -0,0 +1,741 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +#include "xbmc_addon_dll.h" +#include "xbmc_pvr_types.h" + +/*! + * Functions that the PVR client add-on must implement, but some can be empty. + * + * The 'remarks' field indicates which methods should be implemented, and which ones are optional. + */ + +extern "C" +{ + /*! @name PVR add-on methods */ + //@{ + /*! + * Get the XBMC_PVR_API_VERSION that was used to compile this add-on. + * Used to check if this add-on is compatible with XBMC. + * @return The XBMC_PVR_API_VERSION that was used to compile this add-on. + * @remarks Valid implementation required. + */ + const char* GetPVRAPIVersion(void); + + /*! + * Get the XBMC_PVR_MIN_API_VERSION that was used to compile this add-on. + * Used to check if this add-on is compatible with XBMC. + * @return The XBMC_PVR_MIN_API_VERSION that was used to compile this add-on. + * @remarks Valid implementation required. + */ + const char* GetMininumPVRAPIVersion(void); + + /*! + * Get the XBMC_GUI_API_VERSION that was used to compile this add-on. + * Used to check if this add-on is compatible with XBMC. + * @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. + * @remarks Valid implementation required. + * @note see libKODI_guilib.h about related parts + */ + const char* GetGUIAPIVersion(void); + + /*! + * Get the XBMC_GUI_MIN_API_VERSION that was used to compile this add-on. + * Used to check if this add-on is compatible with XBMC. + * @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. + * @remarks Valid implementation required. + * @note see libKODI_guilib.h about related parts + */ + const char* GetMininumGUIAPIVersion(void); + + /*! + * Get the list of features that this add-on provides. + * Called by XBMC to query the add-on's capabilities. + * Used to check which options should be presented in the UI, which methods to call, etc. + * All capabilities that the add-on supports should be set to true. + * @param pCapabilities The add-on's capabilities. + * @return PVR_ERROR_NO_ERROR if the properties were fetched successfully. + * @remarks Valid implementation required. + */ + PVR_ERROR GetAddonCapabilities(PVR_ADDON_CAPABILITIES *pCapabilities); + + /*! + * @return The name reported by the backend that will be displayed in the UI. + * @remarks Valid implementation required. + */ + const char* GetBackendName(void); + + /*! + * @return The version string reported by the backend that will be displayed in the UI. + * @remarks Valid implementation required. + */ + const char* GetBackendVersion(void); + + /*! + * @return The connection string reported by the backend that will be displayed in the UI. + * @remarks Valid implementation required. + */ + const char* GetConnectionString(void); + + /*! + * Get the disk space reported by the backend (if supported). + * @param iTotal The total disk space in bytes. + * @param iUsed The used disk space in bytes. + * @return PVR_ERROR_NO_ERROR if the drive space has been fetched successfully. + * @remarks Optional. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR GetDriveSpace(long long* iTotal, long long* iUsed); + + /*! + * Call one of the menu hooks (if supported). + * Supported PVR_MENUHOOK instances have to be added in ADDON_Create(), by calling AddMenuHook() on the callback. + * @param menuhook The hook to call. + * @param item The selected item for which the hook was called. + * @return PVR_ERROR_NO_ERROR if the hook was called successfully. + * @remarks Optional. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR CallMenuHook(const PVR_MENUHOOK& menuhook, const PVR_MENUHOOK_DATA &item); + //@} + + /*! @name PVR EPG methods + * @remarks Only used by XBMC if bSupportsEPG is set to true. + */ + //@{ + /*! + * Request the EPG for a channel from the backend. + * EPG entries are added to XBMC by calling TransferEpgEntry() on the callback. + * @param handle Handle to pass to the callback method. + * @param channel The channel to get the EPG table for. + * @param iStart Get events after this time (UTC). + * @param iEnd Get events before this time (UTC). + * @return PVR_ERROR_NO_ERROR if the table has been fetched successfully. + * @remarks Required if bSupportsEPG is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR GetEPGForChannel(ADDON_HANDLE handle, const PVR_CHANNEL& channel, time_t iStart, time_t iEnd); + //@} + + /*! @name PVR channel group methods + * @remarks Only used by XBMC is bSupportsChannelGroups is set to true. + * If a group or one of the group members changes after the initial import, or if a new one was added, then the add-on + * should call TriggerChannelGroupsUpdate() + */ + //@{ + /*! + * Get the total amount of channel groups on the backend if it supports channel groups. + * @return The amount of channels, or -1 on error. + * @remarks Required if bSupportsChannelGroups is set to true. Return -1 if this add-on won't provide this function. + */ + int GetChannelGroupsAmount(void); + + /*! + * Request the list of all channel groups from the backend if it supports channel groups. + * Channel group entries are added to XBMC by calling TransferChannelGroup() on the callback. + * @param handle Handle to pass to the callback method. + * @param bRadio True to get the radio channel groups, false to get the TV channel groups. + * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. + * @remarks Required if bSupportsChannelGroups is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR GetChannelGroups(ADDON_HANDLE handle, bool bRadio); + + /*! + * Request the list of all group members of a group from the backend if it supports channel groups. + * Member entries are added to XBMC by calling TransferChannelGroupMember() on the callback. + * @param handle Handle to pass to the callback method. + * @param group The group to get the members for. + * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. + * @remarks Required if bSupportsChannelGroups is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR GetChannelGroupMembers(ADDON_HANDLE handle, const PVR_CHANNEL_GROUP& group); + //@} + + /** @name PVR channel methods + * @remarks Either bSupportsTV or bSupportsRadio is required to be set to true. + * If a channel changes after the initial import, or if a new one was added, then the add-on + * should call TriggerChannelUpdate() + */ + //@{ + /*! + * Show the channel scan dialog if this backend supports it. + * @return PVR_ERROR_NO_ERROR if the dialog was displayed successfully. + * @remarks Required if bSupportsChannelScan is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + * @note see libKODI_guilib.h about related parts + */ + PVR_ERROR OpenDialogChannelScan(void); + + /*! + * @return The total amount of channels on the backend, or -1 on error. + * @remarks Valid implementation required. + */ + int GetChannelsAmount(void); + + /*! + * Request the list of all channels from the backend. + * Channel entries are added to XBMC by calling TransferChannelEntry() on the callback. + * @param handle Handle to pass to the callback method. + * @param bRadio True to get the radio channels, false to get the TV channels. + * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. + * @remarks If bSupportsTV is set to true, a valid result set needs to be provided for bRadio = false. + * If bSupportsRadio is set to true, a valid result set needs to be provided for bRadio = true. + * At least one of these two must provide a valid result set. + */ + PVR_ERROR GetChannels(ADDON_HANDLE handle, bool bRadio); + + /*! + * Delete a channel from the backend. + * @param channel The channel to delete. + * @return PVR_ERROR_NO_ERROR if the channel has been deleted successfully. + * @remarks Required if bSupportsChannelSettings is set to true. + */ + PVR_ERROR DeleteChannel(const PVR_CHANNEL& channel); + + /*! + * Rename a channel on the backend. + * @param channel The channel to rename, containing the new channel name. + * @return PVR_ERROR_NO_ERROR if the channel has been renamed successfully. + * @remarks Optional, and only used if bSupportsChannelSettings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR RenameChannel(const PVR_CHANNEL& channel); + + /*! + * Move a channel to another channel number on the backend. + * @param channel The channel to move, containing the new channel number. + * @return PVR_ERROR_NO_ERROR if the channel has been moved successfully. + * @remarks Optional, and only used if bSupportsChannelSettings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR MoveChannel(const PVR_CHANNEL& channel); + + /*! + * Show the channel settings dialog, if supported by the backend. + * @param channel The channel to show the dialog for. + * @return PVR_ERROR_NO_ERROR if the dialog has been displayed successfully. + * @remarks Required if bSupportsChannelSettings is set to true. + * @note see libKODI_guilib.h about related parts + */ + PVR_ERROR OpenDialogChannelSettings(const PVR_CHANNEL& channel); + + /*! + * Show the dialog to add a channel on the backend, if supported by the backend. + * @param channel The channel to add. + * @return PVR_ERROR_NO_ERROR if the channel has been added successfully. + * @remarks Required if bSupportsChannelSettings is set to true. + * @note see libKODI_guilib.h about related parts + */ + PVR_ERROR OpenDialogChannelAdd(const PVR_CHANNEL& channel); + //@} + + /** @name PVR recording methods + * @remarks Only used by XBMC is bSupportsRecordings is set to true. + * If a recording changes after the initial import, or if a new one was added, + * then the add-on should call TriggerRecordingUpdate() + */ + //@{ + /*! + * @return The total amount of recordings on the backend or -1 on error. + * @param deleted if set return deleted recording (called if bSupportsRecordingsUndelete set to true) + * @remarks Required if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + int GetRecordingsAmount(bool deleted); + + /*! + * Request the list of all recordings from the backend, if supported. + * Recording entries are added to XBMC by calling TransferRecordingEntry() on the callback. + * @param handle Handle to pass to the callback method. + * @param deleted if set return deleted recording (called if bSupportsRecordingsUndelete set to true) + * @return PVR_ERROR_NO_ERROR if the recordings have been fetched successfully. + * @remarks Required if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR GetRecordings(ADDON_HANDLE handle, bool deleted); + + /*! + * Delete a recording on the backend. + * @param recording The recording to delete. + * @return PVR_ERROR_NO_ERROR if the recording has been deleted successfully. + * @remarks Optional, and only used if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR DeleteRecording(const PVR_RECORDING& recording); + + /*! + * Undelete a recording on the backend. + * @param recording The recording to undelete. + * @return PVR_ERROR_NO_ERROR if the recording has been undeleted successfully. + * @remarks Optional, and only used if bSupportsRecordingsUndelete is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR UndeleteRecording(const PVR_RECORDING& recording); + + /*! + * @brief Delete all recordings permanent which in the deleted folder on the backend. + * @return PVR_ERROR_NO_ERROR if the recordings has been deleted successfully. + */ + PVR_ERROR DeleteAllRecordingsFromTrash(); + + /*! + * Rename a recording on the backend. + * @param recording The recording to rename, containing the new name. + * @return PVR_ERROR_NO_ERROR if the recording has been renamed successfully. + * @remarks Optional, and only used if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR RenameRecording(const PVR_RECORDING& recording); + + /*! + * Set the play count of a recording on the backend. + * @param recording The recording to change the play count. + * @param count Play count. + * @return PVR_ERROR_NO_ERROR if the recording's play count has been set successfully. + * @remarks Required if bSupportsRecordingPlayCount is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING& recording, int count); + + /*! + * Set the last watched position of a recording on the backend. + * @param recording The recording. + * @param position The last watched position in seconds + * @return PVR_ERROR_NO_ERROR if the position has been stored successfully. + * @remarks Required if bSupportsLastPlayedPosition is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING& recording, int lastplayedposition); + + /*! + * Retrieve the last watched position of a recording on the backend. + * @param recording The recording. + * @return The last watched position in seconds or -1 on error + * @remarks Required if bSupportsRecordingPlayCount is set to true. Return -1 if this add-on won't provide this function. + */ + int GetRecordingLastPlayedPosition(const PVR_RECORDING& recording); + + /*! + * Retrieve the edit decision list (EDL) of a recording on the backend. + * @param recording The recording. + * @param edl out: The function has to write the EDL list into this array. + * @param size in: The maximum size of the EDL, out: the actual size of the EDL. + * @return PVR_ERROR_NO_ERROR if the EDL was successfully read. + * @remarks Required if bSupportsRecordingEdl is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY edl[], int *size); + + /*! + * Retrieve the timer types supported by the backend. + * @param types out: The function has to write the definition of the supported timer types into this array. + * @param typesCount in: The maximum size of the list, out: the actual size of the list. default: PVR_ADDON_TIMERTYPE_ARRAY_SIZE + * @return PVR_ERROR_NO_ERROR if the types were successfully written to the array. + * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR GetTimerTypes(PVR_TIMER_TYPE types[], int *typesCount); + + //@} + /** @name PVR timer methods + * @remarks Only used by XBMC is bSupportsTimers is set to true. + * If a timer changes after the initial import, or if a new one was added, + * then the add-on should call TriggerTimerUpdate() + */ + //@{ + /*! + * @return The total amount of timers on the backend or -1 on error. + * @remarks Required if bSupportsTimers is set to true. Return -1 if this add-on won't provide this function. + */ + int GetTimersAmount(void); + + /*! + * Request the list of all timers from the backend if supported. + * Timer entries are added to XBMC by calling TransferTimerEntry() on the callback. + * @param handle Handle to pass to the callback method. + * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. + * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR GetTimers(ADDON_HANDLE handle); + + /*! + * Add a timer on the backend. + * @param timer The timer to add. + * @return PVR_ERROR_NO_ERROR if the timer has been added successfully. + * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR AddTimer(const PVR_TIMER& timer); + + /*! + * Delete a timer on the backend. + * @param timer The timer to delete. + * @param bForceDelete Set to true to delete a timer that is currently recording a program. + * @return PVR_ERROR_NO_ERROR if the timer has been deleted successfully. + * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR DeleteTimer(const PVR_TIMER& timer, bool bForceDelete); + + /*! + * Update the timer information on the backend. + * @param timer The timer to update. + * @return PVR_ERROR_NO_ERROR if the timer has been updated successfully. + * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR UpdateTimer(const PVR_TIMER& timer); + + //@} + + /** @name PVR live stream methods, used to open and close a stream to a channel, and optionally perform read operations on the stream */ + //@{ + /*! + * Open a live stream on the backend. + * @param channel The channel to stream. + * @return True if the stream has been opened successfully, false otherwise. + * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return false if this add-on won't provide this function. + */ + bool OpenLiveStream(const PVR_CHANNEL& channel); + + /*! + * Close an open live stream. + * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. + */ + void CloseLiveStream(void); + + /*! + * Read from an open live stream. + * @param pBuffer The buffer to store the data in. + * @param iBufferSize The amount of bytes to read. + * @return The amount of bytes that were actually read from the stream. + * @remarks Required if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. + */ + int ReadLiveStream(unsigned char* pBuffer, unsigned int iBufferSize); + + /*! + * Seek in a live stream on a backend that supports timeshifting. + * @param iPosition The position to seek to. + * @param iWhence ? + * @return The new position. + * @remarks Optional, and only used if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. + */ + long long SeekLiveStream(long long iPosition, int iWhence = SEEK_SET); + + /*! + * @return The position in the stream that's currently being read. + * @remarks Optional, and only used if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. + */ + long long PositionLiveStream(void); + + /*! + * @return The total length of the stream that's currently being read. + * @remarks Optional, and only used if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. + */ + long long LengthLiveStream(void); + + /*! + * Switch to another channel. Only to be called when a live stream has already been opened. + * @param channel The channel to switch to. + * @return True if the switch was successful, false otherwise. + * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return false if this add-on won't provide this function. + */ + bool SwitchChannel(const PVR_CHANNEL& channel); + + /*! + * Get the signal status of the stream that's currently open. + * @param signalStatus The signal status. + * @return True if the signal status has been read successfully, false otherwise. + * @remarks Optional, and only used if bHandlesInputStream or bHandlesDemuxing is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR SignalStatus(PVR_SIGNAL_STATUS& signalStatus); + + /*! + * Get the stream URL for a channel from the backend. Used by the MediaPortal add-on. + * @param channel The channel to get the stream URL for. + * @return The requested URL. + * @remarks Optional, and only used if bHandlesInputStream is set to true. Return NULL if this add-on won't provide this function. + */ + const char* GetLiveStreamURL(const PVR_CHANNEL& channel); + + /*! + * Get the stream properties of the stream that's currently being read. + * @param pProperties The properties of the currently playing stream. + * @return PVR_ERROR_NO_ERROR if the properties have been fetched successfully. + * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR GetStreamProperties(PVR_STREAM_PROPERTIES* pProperties); + //@} + + /** @name PVR recording stream methods, used to open and close a stream to a recording, and perform read operations on the stream. + * @remarks This will only be used if the backend doesn't provide a direct URL in the recording tag. + */ + //@{ + /*! + * Open a stream to a recording on the backend. + * @param recording The recording to open. + * @return True if the stream has been opened successfully, false otherwise. + * @remarks Optional, and only used if bSupportsRecordings is set to true. Return false if this add-on won't provide this function. + */ + bool OpenRecordedStream(const PVR_RECORDING& recording); + + /*! + * Close an open stream from a recording. + * @remarks Optional, and only used if bSupportsRecordings is set to true. + */ + void CloseRecordedStream(void); + + /*! + * Read from a recording. + * @param pBuffer The buffer to store the data in. + * @param iBufferSize The amount of bytes to read. + * @return The amount of bytes that were actually read from the stream. + * @remarks Optional, and only used if bSupportsRecordings is set to true, but required if OpenRecordedStream() is implemented. Return -1 if this add-on won't provide this function. + */ + int ReadRecordedStream(unsigned char* pBuffer, unsigned int iBufferSize); + + /*! + * Seek in a recorded stream. + * @param iPosition The position to seek to. + * @param iWhence ? + * @return The new position. + * @remarks Optional, and only used if bSupportsRecordings is set to true. Return -1 if this add-on won't provide this function. + */ + long long SeekRecordedStream(long long iPosition, int iWhence = SEEK_SET); + + /*! + * @return The position in the stream that's currently being read. + * @remarks Optional, and only used if bSupportsRecordings is set to true. Return -1 if this add-on won't provide this function. + */ + long long PositionRecordedStream(void); + + /*! + * @return The total length of the stream that's currently being read. + * @remarks Optional, and only used if bSupportsRecordings is set to true. Return -1 if this add-on won't provide this function. + */ + long long LengthRecordedStream(void); + //@} + + /** @name PVR demultiplexer methods + * @remarks Only used by XBMC is bHandlesDemuxing is set to true. + */ + //@{ + /*! + * Reset the demultiplexer in the add-on. + * @remarks Required if bHandlesDemuxing is set to true. + */ + void DemuxReset(void); + + /*! + * Abort the demultiplexer thread in the add-on. + * @remarks Required if bHandlesDemuxing is set to true. + */ + void DemuxAbort(void); + + /*! + * Flush all data that's currently in the demultiplexer buffer in the add-on. + * @remarks Required if bHandlesDemuxing is set to true. + */ + void DemuxFlush(void); + + /*! + * Read the next packet from the demultiplexer, if there is one. + * @return The next packet. + * If there is no next packet, then the add-on should return the + * packet created by calling AllocateDemuxPacket(0) on the callback. + * If the stream changed and XBMC's player needs to be reinitialised, + * then, the add-on should call AllocateDemuxPacket(0) on the + * callback, and set the streamid to DMX_SPECIALID_STREAMCHANGE and + * return the value. + * The add-on should return NULL if an error occured. + * @remarks Required if bHandlesDemuxing is set to true. Return NULL if this add-on won't provide this function. + */ + DemuxPacket* DemuxRead(void); + //@} + + /*! + * Delay to use when using switching channels for add-ons not providing an input stream. + * If the add-on does provide an input stream, then this method will not be called. + * Those add-ons can do that in OpenLiveStream() if needed. + * @return The delay in milliseconds. + */ + unsigned int GetChannelSwitchDelay(void); + + /*! + * Check if the backend support pausing the currently playing stream + * This will enable/disable the pause button in XBMC based on the return value + * @return false if the PVR addon/backend does not support pausing, true if possible + */ + bool CanPauseStream(); + + /*! + * Check if the backend supports seeking for the currently playing stream + * This will enable/disable the rewind/forward buttons in XBMC based on the return value + * @return false if the PVR addon/backend does not support seeking, true if possible + */ + bool CanSeekStream(); + + /*! + * @brief Notify the pvr addon that XBMC (un)paused the currently playing stream + */ + void PauseStream(bool bPaused); + + /*! + * Notify the pvr addon/demuxer that XBMC wishes to seek the stream by time + * @param time The absolute time since stream start + * @param backwards True to seek to keyframe BEFORE time, else AFTER + * @param startpts can be updated to point to where display should start + * @return True if the seek operation was possible + * @remarks Optional, and only used if addon has its own demuxer. Return False if this add-on won't provide this function. + */ + bool SeekTime(int time, bool backwards, double *startpts); + + /*! + * Notify the pvr addon/demuxer that XBMC wishes to change playback speed + * @param speed The requested playback speed + * @remarks Optional, and only used if addon has its own demuxer. + */ + void SetSpeed(int speed); + + /*! + * Get actual playing time from addon. With timeshift enabled this is + * different to live. + * @return time as UTC + */ + time_t GetPlayingTime(); + + /*! + * Get time of oldest packet in timeshift buffer + * @return time as UTC + */ + time_t GetBufferTimeStart(); + + /*! + * Get time of latest packet in timeshift buffer + * @return time as UTC + */ + time_t GetBufferTimeEnd(); + + /*! + * Get the hostname of the pvr backend server + * @return hostname as ip address or alias. If backend does not + * utilize a server, return empty string. + */ + const char* GetBackendHostname(); + + /*! + * Check if timeshift is active + * @return true if timeshift is active + */ + bool IsTimeshifting(); + + /*! + * Check for real-time streaming + * @return true if current stream is real-time + */ + bool IsRealTimeStream(); + + /*! + * Tell the client the time frame to use when notifying epg events back to Kodi. The client might push epg events asynchronously + * to Kodi using the callback function EpgEventStateChange. To be able to only push events that are actually of interest for Kodi, + * client needs to know about the epg time frame Kodi uses. Kodi calls this function once after the client add-on has been sucessfully + * initialized and then everytime the time frame value changes. + * @param iDays number of days from "now". EPG_TIMEFRAME_UNLIMITED means that Kodi is interested in all epg events, regardless of event times. + * @return PVR_ERROR_NO_ERROR if new value was successfully set. + * @remarks Required if bSupportsEPG is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. + */ + PVR_ERROR SetEPGTimeFrame(int iDays); + + /*! + * Called by XBMC to assign the function pointers of this add-on to pClient. + * @param pClient The struct to assign the function pointers to. + */ + void __declspec(dllexport) get_addon(struct PVRClient* pClient) + { + pClient->GetPVRAPIVersion = GetPVRAPIVersion; + pClient->GetMininumPVRAPIVersion = GetMininumPVRAPIVersion; + pClient->GetGUIAPIVersion = GetGUIAPIVersion; + pClient->GetMininumGUIAPIVersion = GetMininumGUIAPIVersion; + pClient->GetAddonCapabilities = GetAddonCapabilities; + pClient->GetStreamProperties = GetStreamProperties; + pClient->GetConnectionString = GetConnectionString; + pClient->GetBackendName = GetBackendName; + pClient->GetBackendVersion = GetBackendVersion; + pClient->GetDriveSpace = GetDriveSpace; + pClient->OpenDialogChannelScan = OpenDialogChannelScan; + pClient->MenuHook = CallMenuHook; + + pClient->GetEpg = GetEPGForChannel; + + pClient->GetChannelGroupsAmount = GetChannelGroupsAmount; + pClient->GetChannelGroups = GetChannelGroups; + pClient->GetChannelGroupMembers = GetChannelGroupMembers; + + pClient->GetChannelsAmount = GetChannelsAmount; + pClient->GetChannels = GetChannels; + pClient->DeleteChannel = DeleteChannel; + pClient->RenameChannel = RenameChannel; + pClient->MoveChannel = MoveChannel; + pClient->OpenDialogChannelSettings = OpenDialogChannelSettings; + pClient->OpenDialogChannelAdd = OpenDialogChannelAdd; + + pClient->GetRecordingsAmount = GetRecordingsAmount; + pClient->GetRecordings = GetRecordings; + pClient->DeleteRecording = DeleteRecording; + pClient->UndeleteRecording = UndeleteRecording; + pClient->DeleteAllRecordingsFromTrash = DeleteAllRecordingsFromTrash; + pClient->RenameRecording = RenameRecording; + pClient->SetRecordingPlayCount = SetRecordingPlayCount; + pClient->SetRecordingLastPlayedPosition = SetRecordingLastPlayedPosition; + pClient->GetRecordingLastPlayedPosition = GetRecordingLastPlayedPosition; + pClient->GetRecordingEdl = GetRecordingEdl; + + pClient->GetTimerTypes = GetTimerTypes; + pClient->GetTimersAmount = GetTimersAmount; + pClient->GetTimers = GetTimers; + pClient->AddTimer = AddTimer; + pClient->DeleteTimer = DeleteTimer; + pClient->UpdateTimer = UpdateTimer; + + pClient->OpenLiveStream = OpenLiveStream; + pClient->CloseLiveStream = CloseLiveStream; + pClient->ReadLiveStream = ReadLiveStream; + pClient->SeekLiveStream = SeekLiveStream; + pClient->PositionLiveStream = PositionLiveStream; + pClient->LengthLiveStream = LengthLiveStream; + pClient->SwitchChannel = SwitchChannel; + pClient->SignalStatus = SignalStatus; + pClient->GetLiveStreamURL = GetLiveStreamURL; + pClient->GetChannelSwitchDelay = GetChannelSwitchDelay; + pClient->CanPauseStream = CanPauseStream; + pClient->PauseStream = PauseStream; + pClient->CanSeekStream = CanSeekStream; + pClient->SeekTime = SeekTime; + pClient->SetSpeed = SetSpeed; + + pClient->OpenRecordedStream = OpenRecordedStream; + pClient->CloseRecordedStream = CloseRecordedStream; + pClient->ReadRecordedStream = ReadRecordedStream; + pClient->SeekRecordedStream = SeekRecordedStream; + pClient->PositionRecordedStream = PositionRecordedStream; + pClient->LengthRecordedStream = LengthRecordedStream; + + pClient->DemuxReset = DemuxReset; + pClient->DemuxAbort = DemuxAbort; + pClient->DemuxFlush = DemuxFlush; + pClient->DemuxRead = DemuxRead; + + pClient->GetPlayingTime = GetPlayingTime; + pClient->GetBufferTimeStart = GetBufferTimeStart; + pClient->GetBufferTimeEnd = GetBufferTimeEnd; + + pClient->GetBackendHostname = GetBackendHostname; + + pClient->IsTimeshifting = IsTimeshifting; + pClient->IsRealTimeStream = IsRealTimeStream; + + pClient->SetEPGTimeFrame = SetEPGTimeFrame; + }; +}; + diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h new file mode 100644 index 0000000..83bb13a --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h @@ -0,0 +1,597 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +#ifdef TARGET_WINDOWS +#include +#else +#ifndef __cdecl +#define __cdecl +#endif +#ifndef __declspec +#define __declspec(X) +#endif +#endif +#include +#include + +#include "xbmc_addon_types.h" +#include "xbmc_epg_types.h" +#include "xbmc_codec_types.h" + +/*! @note Define "USE_DEMUX" at compile time if demuxing in the PVR add-on is used. + * Also XBMC's "DVDDemuxPacket.h" file must be in the include path of the add-on, + * and the add-on should set bHandlesDemuxing to true. + */ +#ifdef USE_DEMUX +#include "DVDDemuxPacket.h" +#else +struct DemuxPacket; +#endif + +#undef ATTRIBUTE_PACKED +#undef PRAGMA_PACK_BEGIN +#undef PRAGMA_PACK_END + +#if defined(__GNUC__) +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define ATTRIBUTE_PACKED __attribute__ ((packed)) +#define PRAGMA_PACK 0 +#endif +#endif + +#if !defined(ATTRIBUTE_PACKED) +#define ATTRIBUTE_PACKED +#define PRAGMA_PACK 1 +#endif + +#define PVR_ADDON_NAME_STRING_LENGTH 1024 +#define PVR_ADDON_URL_STRING_LENGTH 1024 +#define PVR_ADDON_DESC_STRING_LENGTH 1024 +#define PVR_ADDON_INPUT_FORMAT_STRING_LENGTH 32 +#define PVR_ADDON_EDL_LENGTH 32 +#define PVR_ADDON_TIMERTYPE_ARRAY_SIZE 32 +#define PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE 512 +#define PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE_SMALL 128 +#define PVR_ADDON_TIMERTYPE_STRING_LENGTH 64 + +/* using the default avformat's MAX_STREAMS value to be safe */ +#define PVR_STREAM_MAX_STREAMS 20 + +/* current PVR API version */ +#define XBMC_PVR_API_VERSION "5.0.0" + +/* min. PVR API version */ +#define XBMC_PVR_MIN_API_VERSION "5.0.0" + +#ifdef __cplusplus +extern "C" { +#endif + + /*! + * @brief numeric PVR timer type definitions (PVR_TIMER.iTimerType values) + */ + const unsigned int PVR_TIMER_TYPE_NONE = 0; /*!< @brief "Null" value for a numeric timer type. */ + + /*! + * @brief special PVR_TIMER.iClientIndex value to indicate that a timer has not (yet) a valid client index. + */ + const unsigned int PVR_TIMER_NO_CLIENT_INDEX = 0; /*!< @brief timer has not (yet) a valid client index. */ + + /*! + * @brief special PVR_TIMER.iParentClientIndex value to indicate that a timer has no parent. + */ + 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. */ + + /*! + * @brief special PVR_TIMER.iEpgUid value to indicate that a timer has no EPG event uid. + */ + const unsigned int PVR_TIMER_NO_EPG_UID = EPG_TAG_INVALID_UID; /*!< @brief timer has no EPG event uid. */ + + /*! + * @brief special PVR_TIMER.iClientChannelUid value to indicate "any channel". Useful for some repeating timer types. + */ + const int PVR_TIMER_ANY_CHANNEL = -1; /*!< @brief denotes "any channel", not a specific one. */ + + /*! + * @brief PVR timer type attributes (PVR_TIMER_TYPE.iAttributes values) + */ + const unsigned int PVR_TIMER_TYPE_ATTRIBUTE_NONE = 0x00000000; + + const unsigned int PVR_TIMER_TYPE_IS_MANUAL = 0x00000001; /*!< @brief defines whether this is a type for manual (time-based) or epg-based timers */ + const unsigned int PVR_TIMER_TYPE_IS_REPEATING = 0x00000002; /*!< @brief defines whether this is a type for repeating or one-shot timers */ + const unsigned int PVR_TIMER_TYPE_IS_READONLY = 0x00000004; /*!< @brief timers of this type must not be edited by Kodi */ + 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 */ + + const unsigned int PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE = 0x00000010; /*!< @brief this type supports enabling/disabling of the timer (PVR_TIMER.state SCHEDULED|DISBALED) */ + const unsigned int PVR_TIMER_TYPE_SUPPORTS_CHANNELS = 0x00000020; /*!< @brief this type supports channels (PVR_TIMER.iClientChannelUid) */ + const unsigned int PVR_TIMER_TYPE_SUPPORTS_START_TIME = 0x00000040; /*!< @brief this type supports a recording start time (PVR_TIMER.startTime) */ + const unsigned int PVR_TIMER_TYPE_SUPPORTS_TITLE_EPG_MATCH = 0x00000080; /*!< @brief this type supports matching epg episode title using PVR_TIMER.strEpgSearchString */ + 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 */ + const unsigned int PVR_TIMER_TYPE_SUPPORTS_FIRST_DAY = 0x00000200; /*!< @brief this type supports a first day the timer gets active (PVR_TIMER.firstday) */ + const unsigned int PVR_TIMER_TYPE_SUPPORTS_WEEKDAYS = 0x00000400; /*!< @brief this type supports weekdays for defining the recording schedule (PVR_TIMER.iWeekdays) */ + 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) */ + 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) */ + const unsigned int PVR_TIMER_TYPE_SUPPORTS_PRIORITY = 0x00002000; /*!< @brief this type supports recording priority (PVR_TIMER.iPriority) */ + const unsigned int PVR_TIMER_TYPE_SUPPORTS_LIFETIME = 0x00004000; /*!< @brief this type supports recording lifetime (PVR_TIMER.iLifetime) */ + const unsigned int PVR_TIMER_TYPE_SUPPORTS_RECORDING_FOLDERS = 0x00008000; /*!< @brief this type supports placing recordings in user defined folders (PVR_TIMER.strDirectory) */ + const unsigned int PVR_TIMER_TYPE_SUPPORTS_RECORDING_GROUP = 0x00010000; /*!< @brief this type supports a list of recording groups (PVR_TIMER.iRecordingGroup) */ + const unsigned int PVR_TIMER_TYPE_SUPPORTS_END_TIME = 0x00020000; /*!< @brief this type supports a recording end time (PVR_TIMER.endTime) */ + const unsigned int PVR_TIMER_TYPE_SUPPORTS_START_ANYTIME = 0x00040000; /*!< @brief enables an 'Any Time' over-ride option for startTime (using PVR_TIMER.bStartAnyTime) */ + const unsigned int PVR_TIMER_TYPE_SUPPORTS_END_ANYTIME = 0x00080000; /*!< @brief enables a separate 'Any Time' over-ride for endTime (using PVR_TIMER.bEndAnyTime) */ + const unsigned int PVR_TIMER_TYPE_SUPPORTS_MAX_RECORDINGS = 0x00100000; /*!< @brief this type supports specifying a maximum recordings setting' (PVR_TIMER.iMaxRecordings) */ + 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 */ + 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 */ + 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 */ + + /*! + * @brief PVR timer weekdays (PVR_TIMER.iWeekdays values) + */ + const unsigned int PVR_WEEKDAY_NONE = 0x00; + const unsigned int PVR_WEEKDAY_MONDAY = 0x01; + const unsigned int PVR_WEEKDAY_TUESDAY = 0x02; + const unsigned int PVR_WEEKDAY_WEDNESDAY = 0x04; + const unsigned int PVR_WEEKDAY_THURSDAY = 0x08; + const unsigned int PVR_WEEKDAY_FRIDAY = 0x10; + const unsigned int PVR_WEEKDAY_SATURDAY = 0x20; + const unsigned int PVR_WEEKDAY_SUNDAY = 0x40; + const unsigned int PVR_WEEKDAY_ALLDAYS = PVR_WEEKDAY_MONDAY | PVR_WEEKDAY_TUESDAY | PVR_WEEKDAY_WEDNESDAY | + PVR_WEEKDAY_THURSDAY | PVR_WEEKDAY_FRIDAY | PVR_WEEKDAY_SATURDAY | + PVR_WEEKDAY_SUNDAY; + + /*! + * @brief timeframe value for use with SetEPGTimeFrame function to indicate "no timeframe". + */ + const int EPG_TIMEFRAME_UNLIMITED = -1; + + /*! + * @brief special PVR_TIMER.iClientChannelUid and PVR_RECORDING.iChannelUid value to indicate that no channel uid is available. + */ + const int PVR_CHANNEL_INVALID_UID = -1; /*!< @brief denotes that no channel uid is avaliable. */ + + /*! + * @brief PVR add-on error codes + */ + typedef enum + { + PVR_ERROR_NO_ERROR = 0, /*!< @brief no error occurred */ + PVR_ERROR_UNKNOWN = -1, /*!< @brief an unknown error occurred */ + PVR_ERROR_NOT_IMPLEMENTED = -2, /*!< @brief the method that XBMC called is not implemented by the add-on */ + PVR_ERROR_SERVER_ERROR = -3, /*!< @brief the backend reported an error, or the add-on isn't connected */ + PVR_ERROR_SERVER_TIMEOUT = -4, /*!< @brief the command was sent to the backend, but the response timed out */ + PVR_ERROR_REJECTED = -5, /*!< @brief the command was rejected by the backend */ + PVR_ERROR_ALREADY_PRESENT = -6, /*!< @brief the requested item can not be added, because it's already present */ + PVR_ERROR_INVALID_PARAMETERS = -7, /*!< @brief the parameters of the method that was called are invalid for this operation */ + PVR_ERROR_RECORDING_RUNNING = -8, /*!< @brief a recording is running, so the timer can't be deleted without doing a forced delete */ + PVR_ERROR_FAILED = -9, /*!< @brief the command failed */ + } PVR_ERROR; + + /*! + * @brief PVR timer states + */ + typedef enum + { + 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. */ + PVR_TIMER_STATE_SCHEDULED = 1, /*!< @brief the timer is scheduled for recording */ + PVR_TIMER_STATE_RECORDING = 2, /*!< @brief the timer is currently recordings */ + PVR_TIMER_STATE_COMPLETED = 3, /*!< @brief the recording completed successfully */ + PVR_TIMER_STATE_ABORTED = 4, /*!< @brief recording started, but was aborted */ + PVR_TIMER_STATE_CANCELLED = 5, /*!< @brief the timer was scheduled, but was canceled */ + PVR_TIMER_STATE_CONFLICT_OK = 6, /*!< @brief the scheduled timer conflicts with another one, but will be recorded */ + PVR_TIMER_STATE_CONFLICT_NOK = 7, /*!< @brief the scheduled timer conflicts with another one and won't be recorded */ + PVR_TIMER_STATE_ERROR = 8, /*!< @brief the timer is scheduled, but can't be recorded for some reason */ + 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 */ + } PVR_TIMER_STATE; + + /*! + * @brief PVR menu hook categories + */ + typedef enum + { + PVR_MENUHOOK_UNKNOWN =-1, /*!< @brief unknown menu hook */ + PVR_MENUHOOK_ALL = 0, /*!< @brief all categories */ + PVR_MENUHOOK_CHANNEL = 1, /*!< @brief for channels */ + PVR_MENUHOOK_TIMER = 2, /*!< @brief for timers */ + PVR_MENUHOOK_EPG = 3, /*!< @brief for EPG */ + PVR_MENUHOOK_RECORDING = 4, /*!< @brief for recordings */ + PVR_MENUHOOK_DELETED_RECORDING = 5, /*!< @brief for deleted recordings */ + PVR_MENUHOOK_SETTING = 6, /*!< @brief for settings */ + } PVR_MENUHOOK_CAT; + + /*! + * @brief PVR backend connection states. Used with ConnectionStateChange callback. + */ + typedef enum + { + PVR_CONNECTION_STATE_UNKNOWN = 0, /*!< @brief unknown state (e.g. not yet tried to connect) */ + PVR_CONNECTION_STATE_SERVER_UNREACHABLE = 1, /*!< @brief backend server is not reachable (e.g. server not existing or network down)*/ + 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) */ + PVR_CONNECTION_STATE_VERSION_MISMATCH = 3, /*!< @brief backend server is reachable, but server version does not match client requirements */ + PVR_CONNECTION_STATE_ACCESS_DENIED = 4, /*!< @brief backend server is reachable, but denies client access (e.g. due to wrong credentials) */ + PVR_CONNECTION_STATE_CONNECTED = 5, /*!< @brief connection to backend server is established */ + PVR_CONNECTION_STATE_DISCONNECTED = 6, /*!< @brief no connection to backend server (e.g. due to network errors or client initiated disconnect)*/ + } PVR_CONNECTION_STATE; + + /*! + * @brief Properties passed to the Create() method of an add-on. + */ + typedef struct PVR_PROPERTIES + { + const char* strUserPath; /*!< @brief path to the user profile */ + const char* strClientPath; /*!< @brief path to this add-on */ + } PVR_PROPERTIES; + + /*! + * @brief PVR add-on capabilities. All capabilities are set to "false" as default. + * If a capabilty is set to true, then the corresponding methods from xbmc_pvr_dll.h need to be implemented. + */ + typedef struct PVR_ADDON_CAPABILITIES + { + bool bSupportsEPG; /*!< @brief true if the add-on provides EPG information */ + bool bSupportsTV; /*!< @brief true if this add-on provides TV channels */ + bool bSupportsRadio; /*!< @brief true if this add-on supports radio channels */ + bool bSupportsRecordings; /*!< @brief true if this add-on supports playback of recordings stored on the backend */ + bool bSupportsRecordingsUndelete; /*!< @brief true if this add-on supports undelete of recordings stored on the backend */ + bool bSupportsTimers; /*!< @brief true if this add-on supports the creation and editing of timers */ + bool bSupportsChannelGroups; /*!< @brief true if this add-on supports channel groups */ + bool bSupportsChannelScan; /*!< @brief true if this add-on support scanning for new channels on the backend */ + bool bSupportsChannelSettings; /*!< @brief true if this add-on supports the following functions: DeleteChannel, RenameChannel, MoveChannel, DialogChannelSettings and DialogAddChannel */ + bool bHandlesInputStream; /*!< @brief true if this add-on provides an input stream. false if XBMC handles the stream. */ + bool bHandlesDemuxing; /*!< @brief true if this add-on demultiplexes packets. */ + bool bSupportsRecordingPlayCount; /*!< @brief true if the backend supports play count for recordings. */ + bool bSupportsLastPlayedPosition; /*!< @brief true if the backend supports store/retrieve of last played position for recordings. */ + bool bSupportsRecordingEdl; /*!< @brief true if the backend supports retrieving an edit decision list for recordings. */ + } ATTRIBUTE_PACKED PVR_ADDON_CAPABILITIES; + + /*! + * @brief PVR stream properties + */ + typedef struct PVR_STREAM_PROPERTIES + { + unsigned int iStreamCount; + struct PVR_STREAM + { + unsigned int iPhysicalId; /*!< @brief (required) physical index */ + xbmc_codec_type_t iCodecType; /*!< @brief (required) codec type this stream */ + xbmc_codec_id_t iCodecId; /*!< @brief (required) codec id of this stream */ + char strLanguage[4]; /*!< @brief (required) language id */ + int iIdentifier; /*!< @brief (required) stream id */ + int iFPSScale; /*!< @brief (required) scale of 1000 and a rate of 29970 will result in 29.97 fps */ + int iFPSRate; /*!< @brief (required) FPS rate */ + int iHeight; /*!< @brief (required) height of the stream reported by the demuxer */ + int iWidth; /*!< @brief (required) width of the stream reported by the demuxer */ + float fAspect; /*!< @brief (required) display aspect ratio of the stream */ + int iChannels; /*!< @brief (required) amount of channels */ + int iSampleRate; /*!< @brief (required) sample rate */ + int iBlockAlign; /*!< @brief (required) block alignment */ + int iBitRate; /*!< @brief (required) bit rate */ + int iBitsPerSample; /*!< @brief (required) bits per sample */ + } stream[PVR_STREAM_MAX_STREAMS]; /*!< @brief (required) the streams */ + } ATTRIBUTE_PACKED PVR_STREAM_PROPERTIES; + + /*! + * @brief Signal status information + */ + typedef struct PVR_SIGNAL_STATUS + { + char strAdapterName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the adapter that's being used */ + char strAdapterStatus[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) status of the adapter that's being used */ + char strServiceName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the current service */ + char strProviderName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the current service's provider */ + char strMuxName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the current mux */ + int iSNR; /*!< @brief (optional) signal/noise ratio */ + int iSignal; /*!< @brief (optional) signal strength */ + long iBER; /*!< @brief (optional) bit error rate */ + long iUNC; /*!< @brief (optional) uncorrected blocks */ + } ATTRIBUTE_PACKED PVR_SIGNAL_STATUS; + + /*! + * @brief Menu hooks that are available in the context menus while playing a stream via this add-on. + * And in the Live TV settings dialog + */ + typedef struct PVR_MENUHOOK + { + unsigned int iHookId; /*!< @brief (required) this hook's identifier */ + unsigned int iLocalizedStringId; /*!< @brief (required) the id of the label for this hook in g_localizeStrings */ + PVR_MENUHOOK_CAT category; /*!< @brief (required) category of menu hook */ + } ATTRIBUTE_PACKED PVR_MENUHOOK; + + /*! + * @brief Representation of a TV or radio channel. + */ + typedef struct PVR_CHANNEL + { + unsigned int iUniqueId; /*!< @brief (required) unique identifier for this channel */ + bool bIsRadio; /*!< @brief (required) true if this is a radio channel, false if it's a TV channel */ + unsigned int iChannelNumber; /*!< @brief (optional) channel number of this channel on the backend */ + unsigned int iSubChannelNumber; /*!< @brief (optional) sub channel number of this channel on the backend (ATSC) */ + char strChannelName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) channel name given to this channel */ + char strInputFormat[PVR_ADDON_INPUT_FORMAT_STRING_LENGTH]; /*!< @brief (optional) input format type. types can be found in ffmpeg/libavformat/allformats.c + leave empty if unknown */ + char strStreamURL[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) the URL to use to access this channel. + leave empty to use this add-on to access the stream. + set to a path that's supported by XBMC otherwise. */ + unsigned int iEncryptionSystem; /*!< @brief (optional) the encryption ID or CaID of this channel */ + char strIconPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) path to the channel icon (if present) */ + bool bIsHidden; /*!< @brief (optional) true if this channel is marked as hidden */ + } ATTRIBUTE_PACKED PVR_CHANNEL; + + typedef struct PVR_CHANNEL_GROUP + { + char strGroupName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) name of this channel group */ + bool bIsRadio; /*!< @brief (required) true if this is a radio channel group, false otherwise. */ + unsigned int iPosition; /*!< @brief (optional) sort position of the group (0 indicates that the backend doesn't support sorting of groups) */ + } ATTRIBUTE_PACKED PVR_CHANNEL_GROUP; + + typedef struct PVR_CHANNEL_GROUP_MEMBER + { + char strGroupName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) name of the channel group to add the channel to */ + unsigned int iChannelUniqueId; /*!< @brief (required) unique id of the member */ + unsigned int iChannelNumber; /*!< @brief (optional) channel number within the group */ + } ATTRIBUTE_PACKED PVR_CHANNEL_GROUP_MEMBER; + + /*! + * @brief Representation of a timer's attribute integer value. + */ + typedef struct PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE + { + int iValue; /*!< @brief (required) an integer value for a certain timer attribute */ + char strDescription[PVR_ADDON_TIMERTYPE_STRING_LENGTH]; /*!< @brief (optional) a localized string describing the value. If left blank, Kodi will + generate a suitable representation (like the integer value as string) */ + } ATTRIBUTE_PACKED PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE; + + /*! + * @brief Representation of a timer type. + */ + typedef struct PVR_TIMER_TYPE + { + unsigned int iId; /*!< @brief (required) this type's identifier. Ids must be > PVR_TIMER_TYPE_NONE. */ + unsigned int iAttributes; /*!< @brief (required) defines the attributes for this type (PVR_TIMER_TYPE_* constants). */ + char strDescription[PVR_ADDON_TIMERTYPE_STRING_LENGTH]; /*!< @brief (optional) a short localized string describing the purpose of the type. (e.g. + "Any time at this channel if title matches"). If left blank, Kodi will generate a + description based on the attributes REPEATING and MANUAL. (e.g. "Repeating EPG-based." */ + /* priority value definitions */ + unsigned int iPrioritiesSize; /*!< @brief (required) Count of possible values for PVR_TMER.iPriority. 0 means priority + is not supported by this timer type or no own value definition wanted, but to use Kodi defaults + of 1..100. */ + PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE + priorities[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; /*!< @brief (optional) Array containing the possible values for PVR_TMER.iPriority. Must be + filled if iPrioritiesSize > 0 */ + int iPrioritiesDefault; /*!< @brief (optional) The default value for PVR_TMER.iPriority. Must be filled if iPrioritiesSize > 0 */ + + /* lifetime value definitions */ + unsigned int iLifetimesSize; /*!< @brief (required) Count of possible values for PVR_TMER.iLifetime. 0 means lifetime + is not supported by this timer type or no own value definition wanted, but to use Kodi defaults + of 1..365. */ + PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE + lifetimes[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; /*!< @brief (optional) Array containing the possible values for PVR_TMER.iLifetime. Must be + filled if iLifetimesSize > 0 */ + int iLifetimesDefault; /*!< @brief (optional) The default value for PVR_TMER.iLifetime. Must be filled if iLifetimesSize > 0 */ + + /* prevent duplicate episodes value definitions */ + unsigned int iPreventDuplicateEpisodesSize; /*!< @brief (required) Count of possible values for PVR_TMER.iPreventDuplicateEpisodes. 0 means duplicate + episodes prevention is not supported by this timer type or no own value definition wanted, but to use + Kodi defaults. */ + PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE + preventDuplicateEpisodes[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; + /*!< @brief (optional) Array containing the possible values for PVR_TMER.iPreventDuplicateEpisodes.. Must + be filled if iPreventDuplicateEpisodesSize > 0 */ + unsigned int iPreventDuplicateEpisodesDefault; /*!< @brief (optional) The default value for PVR_TMER.iPreventDuplicateEpisodesSize. Must be filled if iPreventDuplicateEpisodesSize > 0 */ + + /* recording folder list value definitions */ + unsigned int iRecordingGroupSize; /*!< @brief (required) Count of possible values of PVR_TIMER.iRecordingGroup. 0 means folder lists are not supported by this timer type */ + PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE + recordingGroup[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; + /*!< @brief (optional) Array containing the possible values of PVR_TMER.iRecordingGroup. Must be filled if iRecordingGroupSize > 0 */ + unsigned int iRecordingGroupDefault; /*!< @brief (optional) The default value for PVR_TIMER.iRecordingGroup. Must be filled in if PVR_TIMER.iRecordingGroupSize > 0 */ + + /* max recordings value definitions */ + unsigned int iMaxRecordingsSize; /*!< @brief (required) Count of possible values of PVR_TIMER.iMaxRecordings. 0 means max recordings are not supported by this timer type */ + PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE + maxRecordings[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE_SMALL]; + /*!< @brief (optional) Array containing the possible values of PVR_TMER.iMaxRecordings. */ + int iMaxRecordingsDefault; /*!< @brief (optional) The default value for PVR_TIMER.iMaxRecordings. Must be filled in if PVR_TIMER.iMaxRecordingsSize > 0 */ + + } ATTRIBUTE_PACKED PVR_TIMER_TYPE; + + /*! + * @brief Representation of a timer event. + */ + typedef struct PVR_TIMER { + 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 + Kodi and passed the first time to the client. A valid index must be greater than PVR_TIMER_NO_CLIENT_INDEX. */ + 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 + to indicate that this timer was no scheduled by a repeating timer. */ + 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.*/ + 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.*/ + time_t endTime; /*!< @brief (optional) end time of the recording in UTC. */ + bool bStartAnyTime; /*!< @brief (optional) for EPG based (not Manual) timers indicates startTime does not apply. Default = false */ + bool bEndAnyTime; /*!< @brief (optional) for EPG based (not Manual) timers indicates endTime does not apply. Default = false */ + PVR_TIMER_STATE state; /*!< @brief (required) the state of this timer */ + 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. + 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 + the timer type. */ + char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) a title for this timer */ + 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 */ + bool bFullTextEpgSearch; /*!< @brief (optional) indicates, whether strEpgSearchString is to match against the epg episode title only or also against "other" epg data (backend-dependent) */ + char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) the (relative) directory where the recording will be stored in */ + char strSummary[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) the summary for this timer */ + int iPriority; /*!< @brief (optional) the priority of this timer */ + 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 */ + int iMaxRecordings; /*!< @brief (optional) maximum number of recordings this timer shall create. > 0 number of recordings, < 0 addon defined integer list reference, == 0 disabled */ + unsigned int iRecordingGroup; /*!< @brief (optional) integer ref to addon/backend defined list of recording groups*/ + time_t firstDay; /*!< @brief (optional) the first day this timer is active, for repeating timers */ + unsigned int iWeekdays; /*!< @brief (optional) week days, for repeating timers */ + 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 + duplicate detection is defined by the backend. Addons may define own values for different duplicate detection algorithms, thus this is not just a bool.*/ + unsigned int iEpgUid; /*!< @brief (optional) EPG event id associated with this timer. Valid ids must be greater than EPG_TAG_INVALID_UID. */ + unsigned int iMarginStart; /*!< @brief (optional) if set, the backend starts the recording iMarginStart minutes before startTime. */ + unsigned int iMarginEnd; /*!< @brief (optional) if set, the backend ends the recording iMarginEnd minutes after endTime. */ + int iGenreType; /*!< @brief (optional) genre type */ + int iGenreSubType; /*!< @brief (optional) genre sub type */ + } ATTRIBUTE_PACKED PVR_TIMER; + + /*! + * @brief Representation of a recording. + */ + typedef struct PVR_RECORDING { + char strRecordingId[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) unique id of the recording on the client. */ + char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) the title of this recording */ + char strEpisodeName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) episode name (also known as subtitle) */ + int iSeriesNumber; /*!< @brief (optional) series number (usually called season). Set to "0" for specials/pilot. For 'invalid' see iEpisodeNumber or set to -1 */ + int iEpisodeNumber; /*!< @brief (optional) episode number within the "iSeriesNumber" season. For 'invalid' set to -1 or iSeriesNumber=iEpisodeNumber=0 to show both are invalid */ + 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. */ + + char strStreamURL[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (required) stream URL to access this recording */ + char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) directory of this recording on the client */ + char strPlotOutline[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot outline */ + char strPlot[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot */ + char strChannelName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) channel name */ + char strIconPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) icon path */ + char strThumbnailPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) thumbnail path */ + char strFanartPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) fanart path */ + time_t recordingTime; /*!< @brief (optional) start time of the recording */ + int iDuration; /*!< @brief (optional) duration of the recording in seconds */ + int iPriority; /*!< @brief (optional) priority of this recording (from 0 - 100) */ + int iLifetime; /*!< @brief (optional) life time in days of this recording */ + int iGenreType; /*!< @brief (optional) genre type */ + int iGenreSubType; /*!< @brief (optional) genre sub type */ + int iPlayCount; /*!< @brief (optional) play count of this recording on the client */ + int iLastPlayedPosition; /*!< @brief (optional) last played position of this recording on the client */ + bool bIsDeleted; /*!< @brief (optional) shows this recording is deleted and can be undelete */ + unsigned int iEpgEventId; /*!< @brief (optional) EPG event id associated with this recording. Valid ids must be greater than EPG_TAG_INVALID_UID. */ + int iChannelUid; /*!< @brief (optional) unique identifier of the channel for this recording. PVR_CHANNEL_INVALID_UID denotes that channel uid is not available. */ + } ATTRIBUTE_PACKED PVR_RECORDING; + + /*! + * @brief Edit definition list (EDL) + */ + typedef enum + { + PVR_EDL_TYPE_CUT = 0, /*!< @brief cut (completly remove content) */ + PVR_EDL_TYPE_MUTE = 1, /*!< @brief mute audio */ + PVR_EDL_TYPE_SCENE = 2, /*!< @brief scene markers (chapter seeking) */ + PVR_EDL_TYPE_COMBREAK = 3 /*!< @brief commercial breaks */ + } PVR_EDL_TYPE; + + typedef struct PVR_EDL_ENTRY + { + int64_t start; // ms + int64_t end; // ms + PVR_EDL_TYPE type; + } ATTRIBUTE_PACKED PVR_EDL_ENTRY; + + /*! + * @brief PVR menu hook data + */ + typedef struct PVR_MENUHOOK_DATA + { + PVR_MENUHOOK_CAT cat; + union data { + int iEpgUid; + PVR_CHANNEL channel; + PVR_TIMER timer; + PVR_RECORDING recording; + } data; + } ATTRIBUTE_PACKED PVR_MENUHOOK_DATA; + + /*! + * @brief Structure to transfer the methods from xbmc_pvr_dll.h to XBMC + */ + typedef struct PVRClient + { + const char* (__cdecl* GetPVRAPIVersion)(void); + const char* (__cdecl* GetMininumPVRAPIVersion)(void); + const char* (__cdecl* GetGUIAPIVersion)(void); + const char* (__cdecl* GetMininumGUIAPIVersion)(void); + PVR_ERROR (__cdecl* GetAddonCapabilities)(PVR_ADDON_CAPABILITIES*); + PVR_ERROR (__cdecl* GetStreamProperties)(PVR_STREAM_PROPERTIES*); + const char* (__cdecl* GetBackendName)(void); + const char* (__cdecl* GetBackendVersion)(void); + const char* (__cdecl* GetConnectionString)(void); + PVR_ERROR (__cdecl* GetDriveSpace)(long long*, long long*); + PVR_ERROR (__cdecl* MenuHook)(const PVR_MENUHOOK&, const PVR_MENUHOOK_DATA&); + PVR_ERROR (__cdecl* GetEpg)(ADDON_HANDLE, const PVR_CHANNEL&, time_t, time_t); + int (__cdecl* GetChannelGroupsAmount)(void); + PVR_ERROR (__cdecl* GetChannelGroups)(ADDON_HANDLE, bool); + PVR_ERROR (__cdecl* GetChannelGroupMembers)(ADDON_HANDLE, const PVR_CHANNEL_GROUP&); + PVR_ERROR (__cdecl* OpenDialogChannelScan)(void); + int (__cdecl* GetChannelsAmount)(void); + PVR_ERROR (__cdecl* GetChannels)(ADDON_HANDLE, bool); + PVR_ERROR (__cdecl* DeleteChannel)(const PVR_CHANNEL&); + PVR_ERROR (__cdecl* RenameChannel)(const PVR_CHANNEL&); + PVR_ERROR (__cdecl* MoveChannel)(const PVR_CHANNEL&); + PVR_ERROR (__cdecl* OpenDialogChannelSettings)(const PVR_CHANNEL&); + PVR_ERROR (__cdecl* OpenDialogChannelAdd)(const PVR_CHANNEL&); + int (__cdecl* GetRecordingsAmount)(bool); + PVR_ERROR (__cdecl* GetRecordings)(ADDON_HANDLE, bool); + PVR_ERROR (__cdecl* DeleteRecording)(const PVR_RECORDING&); + PVR_ERROR (__cdecl* UndeleteRecording)(const PVR_RECORDING&); + PVR_ERROR (__cdecl* DeleteAllRecordingsFromTrash)(void); + PVR_ERROR (__cdecl* RenameRecording)(const PVR_RECORDING&); + PVR_ERROR (__cdecl* SetRecordingPlayCount)(const PVR_RECORDING&, int); + PVR_ERROR (__cdecl* SetRecordingLastPlayedPosition)(const PVR_RECORDING&, int); + int (__cdecl* GetRecordingLastPlayedPosition)(const PVR_RECORDING&); + PVR_ERROR (__cdecl* GetRecordingEdl)(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*); + PVR_ERROR (__cdecl* GetTimerTypes)(PVR_TIMER_TYPE[], int*); + int (__cdecl* GetTimersAmount)(void); + PVR_ERROR (__cdecl* GetTimers)(ADDON_HANDLE); + PVR_ERROR (__cdecl* AddTimer)(const PVR_TIMER&); + PVR_ERROR (__cdecl* DeleteTimer)(const PVR_TIMER&, bool); + PVR_ERROR (__cdecl* UpdateTimer)(const PVR_TIMER&); + bool (__cdecl* OpenLiveStream)(const PVR_CHANNEL&); + void (__cdecl* CloseLiveStream)(void); + int (__cdecl* ReadLiveStream)(unsigned char*, unsigned int); + long long (__cdecl* SeekLiveStream)(long long, int); + long long (__cdecl* PositionLiveStream)(void); + long long (__cdecl* LengthLiveStream)(void); + bool (__cdecl* SwitchChannel)(const PVR_CHANNEL&); + PVR_ERROR (__cdecl* SignalStatus)(PVR_SIGNAL_STATUS&); + const char* (__cdecl* GetLiveStreamURL)(const PVR_CHANNEL&); + bool (__cdecl* OpenRecordedStream)(const PVR_RECORDING&); + void (__cdecl* CloseRecordedStream)(void); + int (__cdecl* ReadRecordedStream)(unsigned char*, unsigned int); + long long (__cdecl* SeekRecordedStream)(long long, int); + long long (__cdecl* PositionRecordedStream)(void); + long long (__cdecl* LengthRecordedStream)(void); + void (__cdecl* DemuxReset)(void); + void (__cdecl* DemuxAbort)(void); + void (__cdecl* DemuxFlush)(void); + DemuxPacket* (__cdecl* DemuxRead)(void); + unsigned int (__cdecl* GetChannelSwitchDelay)(void); + bool (__cdecl* CanPauseStream)(void); + void (__cdecl* PauseStream)(bool); + bool (__cdecl* CanSeekStream)(void); + bool (__cdecl* SeekTime)(int, bool, double*); + void (__cdecl* SetSpeed)(int); + time_t (__cdecl* GetPlayingTime)(void); + time_t (__cdecl* GetBufferTimeStart)(void); + time_t (__cdecl* GetBufferTimeEnd)(void); + const char* (__cdecl* GetBackendHostname)(void); + bool (__cdecl* IsTimeshifting)(void); + bool (__cdecl* IsRealTimeStream)(void); + PVR_ERROR (__cdecl* SetEPGTimeFrame)(int); + } PVRClient; + +#ifdef __cplusplus +} +#endif + diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h new file mode 100644 index 0000000..8652a0a --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h @@ -0,0 +1,42 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +#include "xbmc_addon_dll.h" +#include "xbmc_scr_types.h" + +extern "C" +{ + + // Functions that your visualisation must implement + void Start(); + void Render(); + void GetInfo(SCR_INFO* pInfo); + + // function to export the above structure to XBMC + void __declspec(dllexport) get_addon(struct ScreenSaver* pScr) + { + pScr->Start = Start; + pScr->Render = Render; + pScr->GetInfo = GetInfo; + }; +}; + diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h new file mode 100644 index 0000000..5785b25 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h @@ -0,0 +1,50 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +extern "C" +{ + struct SCR_INFO + { + int dummy; + }; + + struct SCR_PROPS + { + void *device; + int x; + int y; + int width; + int height; + float pixelRatio; + const char *name; + const char *presets; + const char *profile; + }; + + struct ScreenSaver + { + void (__cdecl* Start) (); + void (__cdecl* Render) (); + void (__cdecl* GetInfo)(SCR_INFO *info); + }; +} + diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp new file mode 100644 index 0000000..099776a --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp @@ -0,0 +1,264 @@ +#pragma once +/* + * Copyright (C) 2005-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include "xbmc_pvr_types.h" +#include +#include + +namespace ADDON +{ + /** + * Represents a single stream. It extends the PODS to provide some operators + * overloads. + */ + class XbmcPvrStream : public PVR_STREAM_PROPERTIES::PVR_STREAM + { + public: + XbmcPvrStream() + { + Clear(); + } + + XbmcPvrStream(const XbmcPvrStream &other) + { + memcpy(this, &other, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); + } + + XbmcPvrStream& operator=(const XbmcPvrStream &other) + { + memcpy(this, &other, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); + return *this; + } + + /** + * Compares this stream based on another stream + * @param other + * @return + */ + inline bool operator==(const XbmcPvrStream &other) const + { + return iPhysicalId == other.iPhysicalId && iCodecId == other.iCodecId; + } + + /** + * Compares this stream with another one so that video streams are sorted + * before any other streams and the others are sorted by the physical ID + * @param other + * @return + */ + bool operator<(const XbmcPvrStream &other) const + { + if (iCodecType == XBMC_CODEC_TYPE_VIDEO) + return true; + else if (other.iCodecType != XBMC_CODEC_TYPE_VIDEO) + return iPhysicalId < other.iPhysicalId; + else + return false; + } + + /** + * Clears the stream + */ + void Clear() + { + memset(this, 0, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); + iCodecId = XBMC_INVALID_CODEC_ID; + iCodecType = XBMC_CODEC_TYPE_UNKNOWN; + } + + /** + * Checks whether the stream has been cleared + * @return + */ + inline bool IsCleared() const + { + return iCodecId == XBMC_INVALID_CODEC_ID && + iCodecType == XBMC_CODEC_TYPE_UNKNOWN; + } + }; + + class XbmcStreamProperties + { + public: + typedef std::vector stream_vector; + + XbmcStreamProperties(void) + { + // make sure the vector won't have to resize itself later + m_streamVector = new stream_vector(); + m_streamVector->reserve(PVR_STREAM_MAX_STREAMS); + } + + virtual ~XbmcStreamProperties(void) + { + delete m_streamVector; + } + + /** + * Resets the streams + */ + void Clear(void) + { + m_streamVector->clear(); + m_streamIndex.clear(); + } + + /** + * Returns the index of the stream with the specified physical ID, or -1 if + * there no stream is found. This method is called very often which is why + * we keep a separate map for this. + * @param iPhysicalId + * @return + */ + int GetStreamId(unsigned int iPhysicalId) const + { + std::map::const_iterator it = m_streamIndex.find(iPhysicalId); + if (it != m_streamIndex.end()) + return it->second; + + return -1; + } + + /** + * Returns the stream with the specified physical ID, or null if no such + * stream exists + * @param iPhysicalId + * @return + */ + XbmcPvrStream* GetStreamById(unsigned int iPhysicalId) const + { + int position = GetStreamId(iPhysicalId); + return position != -1 ? &m_streamVector->at(position) : NULL; + } + + /** + * Populates the specified stream with the stream having the specified + * physical ID. If the stream is not found only target stream's physical ID + * will be populated. + * @param iPhysicalId + * @param stream + */ + void GetStreamData(unsigned int iPhysicalId, XbmcPvrStream* stream) + { + XbmcPvrStream *foundStream = GetStreamById(iPhysicalId); + if (foundStream) + *stream = *foundStream; + else + { + stream->iIdentifier = -1; + stream->iPhysicalId = iPhysicalId; + } + } + + /** + * Populates props with the current streams and returns whether there are + * any streams at the moment or not. + * @param props + * @return + */ + bool GetProperties(PVR_STREAM_PROPERTIES* props) + { + unsigned int i = 0; + for (stream_vector::const_iterator it = m_streamVector->begin(); + it != m_streamVector->end(); ++it, ++i) + { + memcpy(&props->stream[i], &(*it), sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); + } + + props->iStreamCount = m_streamVector->size(); + return (props->iStreamCount > 0); + } + + /** + * Merges new streams into the current list of streams. Identical streams + * will retain their respective indexes and new streams will replace unused + * indexes or be appended. + * @param newStreams + */ + void UpdateStreams(stream_vector &newStreams) + { + // sort the new streams + std::sort(newStreams.begin(), newStreams.end()); + + // ensure we never have more than PVR_STREAMS_MAX_STREAMS streams + if (newStreams.size() > PVR_STREAM_MAX_STREAMS) + { + while (newStreams.size() > PVR_STREAM_MAX_STREAMS) + newStreams.pop_back(); + + XBMC->Log(LOG_ERROR, "%s - max amount of streams reached", __FUNCTION__); + } + + stream_vector::iterator newStreamPosition; + for (stream_vector::iterator it = m_streamVector->begin(); it != m_streamVector->end(); ++it) + { + newStreamPosition = std::find(newStreams.begin(), newStreams.end(), *it); + + // if the current stream no longer exists we clear it, otherwise we + // copy it and remove it from newStreams + if (newStreamPosition == newStreams.end()) + it->Clear(); + else + { + *it = *newStreamPosition; + newStreams.erase(newStreamPosition); + } + } + + // replace cleared streams with new streams + for (stream_vector::iterator it = m_streamVector->begin(); + it != m_streamVector->end() && !newStreams.empty(); ++it) + { + if (it->IsCleared()) + { + *it = newStreams.front(); + newStreams.erase(newStreams.begin()); + } + } + + // append any remaining new streams + m_streamVector->insert(m_streamVector->end(), newStreams.begin(), newStreams.end()); + + // remove trailing cleared streams + while (m_streamVector->back().IsCleared()) + m_streamVector->pop_back(); + + // update the index + UpdateIndex(); + } + + private: + stream_vector *m_streamVector; + std::map m_streamIndex; + + /** + * Updates the stream index + */ + void UpdateIndex() + { + m_streamIndex.clear(); + + int i = 0; + for (stream_vector::const_iterator it = m_streamVector->begin(); it != m_streamVector->end(); ++it, ++i) + m_streamIndex[it->iPhysicalId] = i; + } + }; +} diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h new file mode 100644 index 0000000..50452c2 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h @@ -0,0 +1,53 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +#include "xbmc_addon_dll.h" +#include "xbmc_vis_types.h" + +extern "C" +{ + // Functions that your visualisation must implement + void Start(int iChannels, int iSamplesPerSec, int iBitsPerSample, const char* szSongName); + void AudioData(const float* pAudioData, int iAudioDataLength, float *pFreqData, int iFreqDataLength); + void Render(); + bool OnAction(long action, const void *param); + void GetInfo(VIS_INFO* pInfo); + unsigned int GetPresets(char ***presets); + unsigned GetPreset(); + unsigned int GetSubModules(char ***presets); + bool IsLocked(); + + // function to export the above structure to XBMC + void __declspec(dllexport) get_addon(struct Visualisation* pVisz) + { + pVisz->Start = Start; + pVisz->AudioData = AudioData; + pVisz->Render = Render; + pVisz->OnAction = OnAction; + pVisz->GetInfo = GetInfo; + pVisz->GetPresets = GetPresets; + pVisz->GetPreset = GetPreset; + pVisz->GetSubModules = GetSubModules; + pVisz->IsLocked = IsLocked; + }; +}; + diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h new file mode 100644 index 0000000..708ffef --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h @@ -0,0 +1,110 @@ +#pragma once + +/* + * Copyright (C) 2005-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +/* + Common data structures shared between Kodi and Kodi's visualisations + */ + +#include + +extern "C" +{ + struct VIS_INFO + { + int bWantsFreq; + int iSyncDelay; + }; + + struct VIS_PROPS + { + void *device; + int x; + int y; + int width; + int height; + float pixelRatio; + const char *name; + const char *presets; + const char *profile; + const char *submodule; + }; + + enum VIS_ACTION + { + VIS_ACTION_NONE = 0, + VIS_ACTION_NEXT_PRESET, + VIS_ACTION_PREV_PRESET, + VIS_ACTION_LOAD_PRESET, + VIS_ACTION_RANDOM_PRESET, + VIS_ACTION_LOCK_PRESET, + VIS_ACTION_RATE_PRESET_PLUS, + VIS_ACTION_RATE_PRESET_MINUS, + VIS_ACTION_UPDATE_ALBUMART, + VIS_ACTION_UPDATE_TRACK + }; + + class VisTrack + { + public: + VisTrack() + { + title = artist = album = albumArtist = NULL; + genre = comment = lyrics = reserved1 = reserved2 = NULL; + trackNumber = discNumber = duration = year = 0; + rating = 0; + reserved3 = reserved4 = 0; + } + + const char *title; + const char *artist; + const char *album; + const char *albumArtist; + const char *genre; + const char *comment; + const char *lyrics; + const char *reserved1; + const char *reserved2; + + int trackNumber; + int discNumber; + int duration; + int year; + char rating; + int reserved3; + int reserved4; + }; + + struct Visualisation + { + void (__cdecl* Start)(int iChannels, int iSamplesPerSec, int iBitsPerSample, const char* szSongName); + void (__cdecl* AudioData)(const float* pAudioData, int iAudioDataLength, float *pFreqData, int iFreqDataLength); + void (__cdecl* Render) (); + void (__cdecl* GetInfo)(VIS_INFO *info); + bool (__cdecl* OnAction)(long flags, const void *param); + int (__cdecl* HasPresets)(); + unsigned int (__cdecl *GetPresets)(char ***presets); + unsigned int (__cdecl *GetPreset)(); + unsigned int (__cdecl *GetSubModules)(char ***modules); + bool (__cdecl* IsLocked)(); + }; +} + 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 AE_FMT_DOUBLE, AE_FMT_FLOAT, - /* Bitstream formats */ - AE_FMT_AAC, - AE_FMT_AC3, - AE_FMT_DTS, - AE_FMT_EAC3, - AE_FMT_TRUEHD, - AE_FMT_DTSHD, - AE_FMT_LPCM, + // Bitstream + AE_FMT_RAW, /* planar formats */ 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 @@ +#pragma once + +/* + * Copyright (C) 2012-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#define DMX_SPECIALID_STREAMINFO -10 +#define DMX_SPECIALID_STREAMCHANGE -11 + + typedef struct DemuxPacket +{ + unsigned char* pData; // data + int iSize; // data size + int iStreamId; // integer representing the stream index + int iGroupId; // the group this data belongs to, used to group data from different streams together + + double pts; // pts in DVD_TIME_BASE + double dts; // dts in DVD_TIME_BASE + double duration; // duration in DVD_TIME_BASE if available +} 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 @@ +/* + * Copyright (C) 2005-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#pragma once + +#include + +namespace XFILE +{ + +/* indicate that caller can handle truncated reads, where function returns before entire buffer has been filled */ + static const unsigned int READ_TRUNCATED = 0x01; + +/* indicate that that caller support read in the minimum defined chunk size, this disables internal cache then */ + static const unsigned int READ_CHUNKED = 0x02; + +/* use cache to access this file */ + static const unsigned int READ_CACHED = 0x04; + +/* open without caching. regardless to file type. */ + static const unsigned int READ_NO_CACHE = 0x08; + +/* calcuate bitrate for file while reading */ + static const unsigned int READ_BITRATE = 0x10; + +/* indicate to the caller we will seek between multiple streams in the file frequently */ + static const unsigned int READ_MULTI_STREAM = 0x20; + +/* indicate to the caller file is audio and/or video (and e.g. may grow) */ + static const unsigned int READ_AUDIO_VIDEO = 0x40; + +/* indicate that caller will do write operations before reading */ + static const unsigned int READ_AFTER_WRITE = 0x80; + +struct SNativeIoControl +{ + unsigned long int request; + void* param; +}; + +struct SCacheStatus +{ + uint64_t forward; /**< number of bytes cached forward of current position */ + unsigned maxrate; /**< maximum number of bytes per second cache is allowed to fill */ + unsigned currate; /**< average read rate from source file since last position change */ + bool full; /**< is the cache full */ +}; + +typedef enum { + IOCTRL_NATIVE = 1, /**< SNativeIoControl structure, containing what should be passed to native ioctrl */ + IOCTRL_SEEK_POSSIBLE = 2, /**< return 0 if known not to work, 1 if it should work */ + IOCTRL_CACHE_STATUS = 3, /**< SCacheStatus structure */ + IOCTRL_CACHE_SETRATE = 4, /**< unsigned int with speed limit for caching in bytes per second */ + IOCTRL_SET_CACHE = 8, /**