From be933ef2241d79558f91796cc5b3a161f72ebf9c Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 19 Oct 2020 00:52:24 +0200 Subject: sync with upstream --- .../kodi-addon-dev-kit/include/kodi/AddonBase.h | 1288 -------- .../kodi-addon-dev-kit/include/kodi/AudioEngine.h | 618 ---- .../kodi-addon-dev-kit/include/kodi/CMakeLists.txt | 16 - .../kodi-addon-dev-kit/include/kodi/Filesystem.h | 2321 ------------- .../kodi-addon-dev-kit/include/kodi/General.h | 834 ----- .../kodi-addon-dev-kit/include/kodi/Network.h | 282 -- .../kodi-addon-dev-kit/include/kodi/StreamCodec.h | 126 - .../kodi-addon-dev-kit/include/kodi/StreamCrypto.h | 42 - .../include/kodi/addon-instance/AudioDecoder.h | 363 --- .../include/kodi/addon-instance/AudioEncoder.h | 218 -- .../include/kodi/addon-instance/CMakeLists.txt | 16 - .../include/kodi/addon-instance/Game.h | 2360 -------------- .../include/kodi/addon-instance/ImageDecoder.h | 315 -- .../include/kodi/addon-instance/Inputstream.h | 881 ----- .../include/kodi/addon-instance/PVR.h | 3423 -------------------- .../include/kodi/addon-instance/Peripheral.h | 847 ----- .../include/kodi/addon-instance/PeripheralUtils.h | 735 ----- .../include/kodi/addon-instance/Screensaver.h | 460 --- .../include/kodi/addon-instance/VFS.h | 1265 -------- .../include/kodi/addon-instance/VideoCodec.h | 246 -- .../include/kodi/addon-instance/Visualization.h | 789 ----- .../include/kodi/addon-instance/pvr/CMakeLists.txt | 13 - .../kodi/addon-instance/pvr/ChannelGroups.h | 271 -- .../include/kodi/addon-instance/pvr/Channels.h | 518 --- .../include/kodi/addon-instance/pvr/EDL.h | 90 - .../include/kodi/addon-instance/pvr/EPG.h | 500 --- .../include/kodi/addon-instance/pvr/General.h | 511 --- .../include/kodi/addon-instance/pvr/MenuHook.h | 130 - .../include/kodi/addon-instance/pvr/Recordings.h | 520 --- .../include/kodi/addon-instance/pvr/Stream.h | 330 -- .../include/kodi/addon-instance/pvr/Timers.h | 896 ----- .../include/kodi/c-api/CMakeLists.txt | 9 - .../kodi/c-api/addon-instance/CMakeLists.txt | 6 - .../kodi/c-api/addon-instance/image_decoder.h | 78 - .../include/kodi/c-api/addon-instance/pvr.h | 327 -- .../kodi/c-api/addon-instance/pvr/CMakeLists.txt | 14 - .../c-api/addon-instance/pvr/pvr_channel_groups.h | 54 - .../kodi/c-api/addon-instance/pvr/pvr_channels.h | 104 - .../kodi/c-api/addon-instance/pvr/pvr_defines.h | 61 - .../kodi/c-api/addon-instance/pvr/pvr_edl.h | 62 - .../kodi/c-api/addon-instance/pvr/pvr_epg.h | 653 ---- .../kodi/c-api/addon-instance/pvr/pvr_general.h | 288 -- .../kodi/c-api/addon-instance/pvr/pvr_menu_hook.h | 72 - .../kodi/c-api/addon-instance/pvr/pvr_recordings.h | 143 - .../kodi/c-api/addon-instance/pvr/pvr_stream.h | 155 - .../kodi/c-api/addon-instance/pvr/pvr_timers.h | 407 --- .../include/kodi/c-api/addon_base.h | 252 -- .../include/kodi/c-api/audio_engine.h | 308 -- .../include/kodi/c-api/filesystem.h | 299 -- .../include/kodi/c-api/general.h | 123 - .../include/kodi/c-api/network.h | 43 - .../include/kodi/gui/CMakeLists.txt | 9 - .../kodi-addon-dev-kit/include/kodi/gui/General.h | 175 - .../kodi-addon-dev-kit/include/kodi/gui/ListItem.h | 366 --- .../kodi-addon-dev-kit/include/kodi/gui/Window.h | 909 ------ .../include/kodi/gui/controls/Button.h | 171 - .../include/kodi/gui/controls/CMakeLists.txt | 16 - .../include/kodi/gui/controls/Edit.h | 275 -- .../include/kodi/gui/controls/FadeLabel.h | 153 - .../include/kodi/gui/controls/Image.h | 116 - .../include/kodi/gui/controls/Label.h | 121 - .../include/kodi/gui/controls/Progress.h | 114 - .../include/kodi/gui/controls/RadioButton.h | 167 - .../include/kodi/gui/controls/Rendering.h | 205 -- .../include/kodi/gui/controls/SettingsSlider.h | 326 -- .../include/kodi/gui/controls/Slider.h | 339 -- .../include/kodi/gui/controls/Spin.h | 365 --- .../include/kodi/gui/controls/TextBox.h | 168 - .../include/kodi/gui/definitions.h | 433 --- .../include/kodi/gui/dialogs/CMakeLists.txt | 14 - .../include/kodi/gui/dialogs/ContextMenu.h | 185 -- .../include/kodi/gui/dialogs/ExtendedProgress.h | 250 -- .../include/kodi/gui/dialogs/FileBrowser.h | 310 -- .../include/kodi/gui/dialogs/Keyboard.h | 422 --- .../include/kodi/gui/dialogs/Numeric.h | 362 --- .../include/kodi/gui/dialogs/OK.h | 99 - .../include/kodi/gui/dialogs/Progress.h | 255 -- .../include/kodi/gui/dialogs/Select.h | 269 -- .../include/kodi/gui/dialogs/TextViewer.h | 108 - .../include/kodi/gui/dialogs/YesNo.h | 188 -- .../include/kodi/gui/gl/CMakeLists.txt | 7 - .../kodi-addon-dev-kit/include/kodi/gui/gl/GL.h | 111 - .../include/kodi/gui/gl/GLonDX.h | 369 --- .../include/kodi/gui/gl/Shader.h | 594 ---- .../include/kodi/gui/renderHelper.h | 78 - .../include/kodi/platform/android/System.h | 114 - .../include/kodi/tools/CMakeLists.txt | 5 - .../include/kodi/tools/DllHelper.h | 211 -- .../kodi-addon-dev-kit/include/kodi/versions.h | 482 --- 89 files changed, 33543 deletions(-) delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/Network.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCodec.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCrypto.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDecoder.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioEncoder.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Game.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/ImageDecoder.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Inputstream.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PVR.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Peripheral.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VFS.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VideoCodec.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Visualization.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/CMakeLists.txt delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/ChannelGroups.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Channels.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/EDL.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/EPG.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/General.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/MenuHook.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Recordings.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Stream.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Timers.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/CMakeLists.txt delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/CMakeLists.txt delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/image_decoder.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/CMakeLists.txt delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_channel_groups.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_channels.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_defines.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_edl.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_epg.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_general.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_menu_hook.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_recordings.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_stream.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_timers.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon_base.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/audio_engine.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/filesystem.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/general.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/network.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/CMakeLists.txt delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/General.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/CMakeLists.txt delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/CMakeLists.txt delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GL.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GLonDX.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/Shader.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/renderHelper.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/platform/android/System.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/CMakeLists.txt delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/DllHelper.h delete mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h (limited to 'xbmc/addons/kodi-addon-dev-kit/include') diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h deleted file mode 100644 index b0fddda..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h +++ /dev/null @@ -1,1288 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "c-api/addon_base.h" -#include "versions.h" - -#include /* assert */ -#include -#include -#include -#include -#include /* va_list, va_start, va_arg, va_end */ -#include -#include -#include - -namespace kodi -{ - -namespace gui -{ -struct IRenderHelper; -} // namespace gui - -//============================================================================== -/// @ingroup cpp_kodi_addon_addonbase_Defs -/// @defgroup cpp_kodi_addon_addonbase_Defs_CSettingValue class CSettingValue -/// @brief Inside addon main instance used helper class to give settings value. -/// -/// This is used on @ref addon::CAddonBase::SetSetting() to inform addon about -/// settings change by used. This becomes then used to give the related value -/// name. -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_addonbase_Defs_CSettingValue_Help -/// -/// ---------------------------------------------------------------------------- -/// -/// **Here is a code example how this is used:** -/// -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// enum myEnumValue -/// { -/// valueA, -/// valueB, -/// valueC -/// }; -/// -/// std::string m_myStringValue; -/// int m_myIntegerValue; -/// bool m_myBooleanValue; -/// float m_myFloatingPointValue; -/// myEnumValue m_myEnumValue; -/// -/// -/// ADDON_STATUS CMyAddon::SetSetting(const std::string& settingName, const kodi::CSettingValue& settingValue) -/// { -/// if (settingName == "my_string_value") -/// m_myStringValue = settingValue.GetString(); -/// else if (settingName == "my_integer_value") -/// m_myIntegerValue = settingValue.GetInt(); -/// else if (settingName == "my_boolean_value") -/// m_myBooleanValue = settingValue.GetBoolean(); -/// else if (settingName == "my_float_value") -/// m_myFloatingPointValue = settingValue.GetFloat(); -/// else if (settingName == "my_enum_value") -/// m_myEnumValue = settingValue.GetEnum(); -/// } -/// ~~~~~~~~~~~~~ -/// -/// @note The asked type should match the type used on settings.xml. -/// -///@{ -class ATTRIBUTE_HIDDEN CSettingValue -{ -public: - explicit CSettingValue(const void* settingValue) : m_settingValue(settingValue) {} - - bool empty() const { return (m_settingValue == nullptr) ? true : false; } - - /// @defgroup cpp_kodi_addon_addonbase_Defs_CSettingValue_Help Value Help - /// @ingroup cpp_kodi_addon_addonbase_Defs_CSettingValue - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_addonbase_Defs_CSettingValue : - /// | Name | Type | Get call - /// |------|------|---------- - /// | **Settings value as string** | `std::string` | @ref CSettingValue::GetString "GetString" - /// | **Settings value as integer** | `int` | @ref CSettingValue::GetInt "GetInt" - /// | **Settings value as unsigned integer** | `unsigned int` | @ref CSettingValue::GetUInt "GetUInt" - /// | **Settings value as boolean** | `bool` | @ref CSettingValue::GetBoolean "GetBoolean" - /// | **Settings value as floating point** | `float` | @ref CSettingValue::GetFloat "GetFloat" - /// | **Settings value as enum** | `enum` | @ref CSettingValue::GetEnum "GetEnum" - - /// @addtogroup cpp_kodi_addon_addonbase_Defs_CSettingValue - ///@{ - - /// @brief To get settings value as string. - std::string GetString() const { return (const char*)m_settingValue; } - - /// @brief To get settings value as integer. - int GetInt() const { return *(const int*)m_settingValue; } - - /// @brief To get settings value as unsigned integer. - unsigned int GetUInt() const { return *(const unsigned int*)m_settingValue; } - - /// @brief To get settings value as boolean. - bool GetBoolean() const { return *(const bool*)m_settingValue; } - - /// @brief To get settings value as floating point. - float GetFloat() const { return *(const float*)m_settingValue; } - - /// @brief To get settings value as enum. - /// @note Inside settings.xml them stored as integer. - template - enumType GetEnum() const - { - return static_cast(*(const int*)m_settingValue); - } - - ///@} - -private: - const void* m_settingValue; -}; -///@} -//------------------------------------------------------------------------------ - -namespace addon -{ - -//============================================================================== -/* - * Internal class to control various instance types with general parts defined - * here. - * - * Mainly is this currently used to identify requested instance types. - * - * @note This class is not need to know during add-on development thats why - * commented with "*". - */ -class ATTRIBUTE_HIDDEN IAddonInstance -{ -public: - explicit IAddonInstance(ADDON_TYPE type, const std::string& version) - : m_type(type), m_kodiVersion(version) - { - } - virtual ~IAddonInstance() = default; - - virtual ADDON_STATUS CreateInstance(int instanceType, - const std::string& instanceID, - KODI_HANDLE instance, - const std::string& version, - KODI_HANDLE& addonInstance) - { - return ADDON_STATUS_NOT_IMPLEMENTED; - } - - const ADDON_TYPE m_type; - const std::string m_kodiVersion; - std::string m_id; -}; - -/* - * Internally used helper class to manage processing of a "C" structure in "CPP" - * class. - * - * At constant, the "C" structure is copied, otherwise the given pointer is - * superseded and is changeable. - * - * ----------------------------------------------------------------------------- - * - * Example: - * - * ~~~~~~~~~~~~~{.cpp} - * extern "C" typedef struct C_SAMPLE_DATA - * { - * unsigned int iUniqueId; - * } C_SAMPLE_DATA; - * - * class CPPSampleData : public CStructHdl - * { - * public: - * CPPSampleData() = default; - * CPPSampleData(const CPPSampleData& sample) : CStructHdl(sample) { } - * CPPSampleData(const C_SAMPLE_DATA* sample) : CStructHdl(sample) { } - * CPPSampleData(C_SAMPLE_DATA* sample) : CStructHdl(sample) { } - * - * void SetUniqueId(unsigned int uniqueId) { m_cStructure->iUniqueId = uniqueId; } - * unsigned int GetUniqueId() const { return m_cStructure->iUniqueId; } - * }; - * - * ~~~~~~~~~~~~~ - * - * It also works with the following example: - * - * ~~~~~~~~~~~~~{.cpp} - * CPPSampleData test; - * // Some work - * C_SAMPLE_DATA* data = test; - * // Give "data" to Kodi - * ~~~~~~~~~~~~~ - */ -template -class CStructHdl -{ -public: - CStructHdl() : m_cStructure(new C_STRUCT()), m_owner(true) {} - - CStructHdl(const CPP_CLASS& cppClass) - : m_cStructure(new C_STRUCT(*cppClass.m_cStructure)), m_owner(true) - { - } - - CStructHdl(const C_STRUCT* cStructure) : m_cStructure(new C_STRUCT(*cStructure)), m_owner(true) {} - - CStructHdl(C_STRUCT* cStructure) : m_cStructure(cStructure) { assert(cStructure); } - - const CStructHdl& operator=(const CStructHdl& right) - { - assert(&right.m_cStructure); - if (m_cStructure && !m_owner) - { - memcpy(m_cStructure, right.m_cStructure, sizeof(C_STRUCT)); - } - else - { - if (m_owner) - delete m_cStructure; - m_owner = true; - m_cStructure = new C_STRUCT(*right.m_cStructure); - } - return *this; - } - - const CStructHdl& operator=(const C_STRUCT& right) - { - assert(&right); - if (m_cStructure && !m_owner) - { - memcpy(m_cStructure, &right, sizeof(C_STRUCT)); - } - else - { - if (m_owner) - delete m_cStructure; - m_owner = true; - m_cStructure = new C_STRUCT(*right); - } - return *this; - } - - virtual ~CStructHdl() - { - if (m_owner) - delete m_cStructure; - } - - operator C_STRUCT*() { return m_cStructure; } - operator const C_STRUCT*() const { return m_cStructure; } - - const C_STRUCT* GetCStructure() const { return m_cStructure; } - -protected: - C_STRUCT* m_cStructure = nullptr; - -private: - bool m_owner = false; -}; - -/// Add-on main instance class. -class ATTRIBUTE_HIDDEN CAddonBase -{ -public: - CAddonBase() - { - m_interface->toAddon->destroy = ADDONBASE_Destroy; - m_interface->toAddon->get_status = ADDONBASE_GetStatus; - m_interface->toAddon->create_instance = ADDONBASE_CreateInstance; - m_interface->toAddon->destroy_instance = ADDONBASE_DestroyInstance; - m_interface->toAddon->set_setting = ADDONBASE_SetSetting; - } - - virtual ~CAddonBase() = default; - - virtual ADDON_STATUS Create() { return ADDON_STATUS_OK; } - - virtual ADDON_STATUS GetStatus() { return ADDON_STATUS_OK; } - - //============================================================================ - /// @ingroup cpp_kodi_addon_addonbase - /// @brief To inform addon about changed settings values. - /// - /// This becomes called for every entry defined inside his settings.xml and - /// as **last** call the one where last in xml (to identify end of calls). - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_addonbase_Defs_CSettingValue_Help - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Here is a code example how this is used:** - /// - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// enum myEnumValue - /// { - /// valueA, - /// valueB, - /// valueC - /// }; - /// - /// std::string m_myStringValue; - /// int m_myIntegerValue; - /// bool m_myBooleanValue; - /// float m_myFloatingPointValue; - /// myEnumValue m_myEnumValue; - /// - /// - /// ADDON_STATUS CMyAddon::SetSetting(const std::string& settingName, const kodi::CSettingValue& settingValue) - /// { - /// if (settingName == "my_string_value") - /// m_myStringValue = settingValue.GetString(); - /// else if (settingName == "my_integer_value") - /// m_myIntegerValue = settingValue.GetInt(); - /// else if (settingName == "my_boolean_value") - /// m_myBooleanValue = settingValue.GetBoolean(); - /// else if (settingName == "my_float_value") - /// m_myFloatingPointValue = settingValue.GetFloat(); - /// else if (settingName == "my_enum_value") - /// m_myEnumValue = settingValue.GetEnum(); - /// } - /// ~~~~~~~~~~~~~ - /// - /// @note The asked type should match the type used on settings.xml. - /// - virtual ADDON_STATUS SetSetting(const std::string& settingName, - const kodi::CSettingValue& settingValue) - { - return ADDON_STATUS_UNKNOWN; - } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_addon_addonbase - /// @brief Instance created - /// - /// @param[in] instanceType The requested type of required instance, see \ref ADDON_TYPE. - /// @param[in] instanceID An individual identification key string given by Kodi. - /// @param[in] instance The instance handler used by Kodi must be passed to - /// the classes created here. See in the example. - /// @param[in] version The from Kodi used version of instance. This can be - /// used to allow compatibility to older versions of - /// them. Further is this given to the parent instance - /// that it can handle differences. - /// @param[out] addonInstance The pointer to instance class created in addon. - /// Needed to be able to identify them on calls. - /// @return \ref ADDON_STATUS_OK if correct, for possible errors - /// see \ref ADDON_STATUS - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Here is a code example how this is used:** - /// - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// ... - /// - /// /* If you use only one instance in your add-on, can be instanceType and - /// * instanceID ignored */ - /// ADDON_STATUS CMyAddon::CreateInstance(int instanceType, - /// const std::string& instanceID, - /// KODI_HANDLE instance, - /// const std::string& version, - /// KODI_HANDLE& addonInstance) - /// { - /// if (instanceType == ADDON_INSTANCE_SCREENSAVER) - /// { - /// kodi::Log(ADDON_LOG_NOTICE, "Creating my Screensaver"); - /// addonInstance = new CMyScreensaver(instance); - /// return ADDON_STATUS_OK; - /// } - /// else if (instanceType == ADDON_INSTANCE_VISUALIZATION) - /// { - /// kodi::Log(ADDON_LOG_NOTICE, "Creating my Visualization"); - /// addonInstance = new CMyVisualization(instance); - /// return ADDON_STATUS_OK; - /// } - /// else if (...) - /// { - /// ... - /// } - /// return ADDON_STATUS_UNKNOWN; - /// } - /// - /// ... - /// - /// ~~~~~~~~~~~~~ - /// - virtual ADDON_STATUS CreateInstance(int instanceType, - const std::string& instanceID, - KODI_HANDLE instance, - const std::string& version, - KODI_HANDLE& addonInstance) - { - return ADDON_STATUS_NOT_IMPLEMENTED; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_addon_addonbase - /// @brief Instance destroy - /// - /// This function is optional and intended to notify addon that the instance - /// is terminating. - /// - /// @param[in] instanceType The requested type of required instance, see \ref ADDON_TYPE. - /// @param[in] instanceID An individual identification key string given by Kodi. - /// @param[in] addonInstance The pointer to instance class created in addon. - /// - /// @warning This call is only used to inform that the associated instance - /// is terminated. The deletion is carried out in the background. - /// - virtual void DestroyInstance(int instanceType, - const std::string& instanceID, - KODI_HANDLE addonInstance) - { - } - //-------------------------------------------------------------------------- - - /* Background helper for GUI render systems, e.g. Screensaver or Visualization */ - std::shared_ptr m_renderHelper; - - /* Global variables of class */ - static AddonGlobalInterface* - m_interface; // Interface function table to hold addresses on add-on and from kodi - - /*private:*/ /* Needed public as long the old call functions becomes used! */ - static inline void ADDONBASE_Destroy() - { - delete static_cast(m_interface->addonBase); - m_interface->addonBase = nullptr; - } - - static inline ADDON_STATUS ADDONBASE_GetStatus() - { - return static_cast(m_interface->addonBase)->GetStatus(); - } - - static inline ADDON_STATUS ADDONBASE_SetSetting(const char* settingName, const void* settingValue) - { - return static_cast(m_interface->addonBase) - ->SetSetting(settingName, CSettingValue(settingValue)); - } - -private: - static inline ADDON_STATUS ADDONBASE_CreateInstance(int instanceType, - const char* instanceID, - KODI_HANDLE instance, - const char* version, - KODI_HANDLE* addonInstance, - KODI_HANDLE parent) - { - CAddonBase* base = static_cast(m_interface->addonBase); - - ADDON_STATUS status = ADDON_STATUS_NOT_IMPLEMENTED; - - /* Check about single instance usage: - * 1. The kodi side instance pointer must be equal to first one - * 2. The addon side instance pointer must be set - * 3. And the requested type must be equal with used add-on class - */ - if (m_interface->firstKodiInstance == instance && m_interface->globalSingleInstance && - static_cast(m_interface->globalSingleInstance)->m_type == instanceType) - { - /* The handling here is intended for the case of the add-on only one - * instance and this is integrated in the add-on base class. - */ - *addonInstance = m_interface->globalSingleInstance; - status = ADDON_STATUS_OK; - } - else - { - /* Here it should use the CreateInstance instance function to allow - * creation of several on one addon. - */ - - /* Check first a parent is defined about (e.g. Codec within inputstream) */ - if (parent != nullptr) - status = static_cast(parent)->CreateInstance( - instanceType, instanceID, instance, version, *addonInstance); - - /* if no parent call the main instance creation function to get it */ - if (status == ADDON_STATUS_NOT_IMPLEMENTED) - { - status = base->CreateInstance(instanceType, instanceID, instance, version, *addonInstance); - } - } - - if (*addonInstance == nullptr) - { - if (status == ADDON_STATUS_OK) - { - m_interface->toKodi->addon_log_msg(m_interface->toKodi->kodiBase, ADDON_LOG_FATAL, - "kodi::addon::CAddonBase CreateInstance returned an " - "empty instance pointer, but reported OK!"); - return ADDON_STATUS_PERMANENT_FAILURE; - } - else - { - return status; - } - } - - if (static_cast(*addonInstance)->m_type != instanceType) - { - m_interface->toKodi->addon_log_msg( - m_interface->toKodi->kodiBase, ADDON_LOG_FATAL, - "kodi::addon::CAddonBase CreateInstance difference between given and returned"); - delete static_cast(*addonInstance); - *addonInstance = nullptr; - return ADDON_STATUS_PERMANENT_FAILURE; - } - - // Store the used ID inside instance, to have on destroy calls by addon to identify - static_cast(*addonInstance)->m_id = instanceID; - - return status; - } - - static inline void ADDONBASE_DestroyInstance(int instanceType, KODI_HANDLE instance) - { - CAddonBase* base = static_cast(m_interface->addonBase); - - if (m_interface->globalSingleInstance == nullptr && instance != base) - { - base->DestroyInstance(instanceType, static_cast(instance)->m_id, instance); - delete static_cast(instance); - } - } -}; - -} /* namespace addon */ - -//============================================================================== -/// @ingroup cpp_kodi_addon -/// @brief To get used version inside Kodi itself about asked type. -/// -/// This thought to allow a addon a handling of newer addon versions within -/// older Kodi until the type min version not changed. -/// -/// @param[in] type The wanted type of @ref ADDON_TYPE to ask -/// @return The version string about type in MAJOR.MINOR.PATCH style. -/// -inline std::string ATTRIBUTE_HIDDEN GetKodiTypeVersion(int type) -{ - using namespace kodi::addon; - - char* str = CAddonBase::m_interface->toKodi->get_type_version( - CAddonBase::m_interface->toKodi->kodiBase, type); - std::string ret = str; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, str); - return ret; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// -inline std::string ATTRIBUTE_HIDDEN GetAddonPath(const std::string& append = "") -{ - using namespace kodi::addon; - - char* str = - CAddonBase::m_interface->toKodi->get_addon_path(CAddonBase::m_interface->toKodi->kodiBase); - std::string ret = str; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, str); - if (!append.empty()) - { - if (append.at(0) != '\\' && append.at(0) != '/') -#ifdef TARGET_WINDOWS - ret.append("\\"); -#else - ret.append("/"); -#endif - ret.append(append); - } - return ret; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// -inline std::string ATTRIBUTE_HIDDEN GetBaseUserPath(const std::string& append = "") -{ - using namespace kodi::addon; - - char* str = CAddonBase::m_interface->toKodi->get_base_user_path( - CAddonBase::m_interface->toKodi->kodiBase); - std::string ret = str; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, str); - if (!append.empty()) - { - if (append.at(0) != '\\' && append.at(0) != '/') -#ifdef TARGET_WINDOWS - ret.append("\\"); -#else - ret.append("/"); -#endif - ret.append(append); - } - return ret; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// -inline std::string ATTRIBUTE_HIDDEN GetLibPath() -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->libBasePath; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi -/// @brief Add a message to Kodi's log. -/// -/// @param[in] loglevel The log level of the message. -/// @param[in] format The format of the message to pass to Kodi. -/// @param[in] ... Additional text to insert in format text -/// -/// -/// @note This method uses limited buffer (16k) for the formatted output. -/// So data, which will not fit into it, will be silently discarded. -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// kodi::Log(ADDON_LOG_ERROR, "%s: There is an error occurred!", __func__); -/// -/// ~~~~~~~~~~~~~ -/// -inline void ATTRIBUTE_HIDDEN Log(const AddonLog loglevel, const char* format, ...) -{ - using namespace kodi::addon; - - char buffer[16384]; - va_list args; - va_start(args, format); - vsnprintf(buffer, sizeof(buffer), format, args); - va_end(args); - CAddonBase::m_interface->toKodi->addon_log_msg(CAddonBase::m_interface->toKodi->kodiBase, - loglevel, buffer); -} -//------------------------------------------------------------------------------ - -//############################################################################## -/// @ingroup cpp_kodi -/// @defgroup cpp_kodi_settings 1. Setting control -/// @brief **Functions to handle settings access**\n -/// This can be used to get and set the addon related values inside his -/// settings.xml. -/// -/// The settings style is given with installed part on e.g. -/// `$HOME/.kodi/addons/myspecial.addon/resources/settings.xml`. The -/// related edit becomes then stored inside -/// `$HOME/.kodi/userdata/addon_data/myspecial.addon/settings.xml`. -/// -/*!@{*/ - -//============================================================================== -/// @brief Check the given setting name is set to default value. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of asked setting -/// @return true if setting is the default -/// -inline bool ATTRIBUTE_HIDDEN IsSettingUsingDefault(const std::string& settingName) -{ - using namespace kodi::addon; - return CAddonBase::m_interface->toKodi->is_setting_using_default( - CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str()); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Check and get a string setting value. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of asked setting -/// @param[out] settingValue The given setting value -/// @return true if setting was successfully found and "settingValue" is set -/// -/// @note If returns false, the "settingValue" is not changed. -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// std::string value; -/// if (!kodi::CheckSettingString("my_string_value", value)) -/// value = "my_default_if_setting_not_work"; -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN CheckSettingString(const std::string& settingName, - std::string& settingValue) -{ - using namespace kodi::addon; - - char* buffer = nullptr; - bool ret = CAddonBase::m_interface->toKodi->get_setting_string( - CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), &buffer); - if (buffer) - { - if (ret) - settingValue = buffer; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, buffer); - } - return ret; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Get string setting value. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of asked setting -/// @param[in] defaultValue [opt] Default value if not found -/// @return The value of setting, empty if not found; -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// std::string value = kodi::GetSettingString("my_string_value"); -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN GetSettingString(const std::string& settingName, - const std::string& defaultValue = "") -{ - std::string settingValue = defaultValue; - CheckSettingString(settingName, settingValue); - return settingValue; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Set string setting of addon. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of setting -/// @param[in] settingValue The setting value to write -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// std::string value = "my_new_name for"; -/// kodi::SetSettingString("my_string_value", value); -/// ~~~~~~~~~~~~~ -/// -inline void ATTRIBUTE_HIDDEN SetSettingString(const std::string& settingName, - const std::string& settingValue) -{ - using namespace kodi::addon; - - CAddonBase::m_interface->toKodi->set_setting_string(CAddonBase::m_interface->toKodi->kodiBase, - settingName.c_str(), settingValue.c_str()); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Check and get a integer setting value. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of asked setting -/// @param[out] settingValue The given setting value -/// @return true if setting was successfully found and "settingValue" is set -/// -/// @note If returns false, the "settingValue" is not changed. -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// int value = 0; -/// if (!kodi::CheckSettingInt("my_integer_value", value)) -/// value = 123; // My default of them -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN CheckSettingInt(const std::string& settingName, int& settingValue) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->get_setting_int(CAddonBase::m_interface->toKodi->kodiBase, - settingName.c_str(), &settingValue); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Get integer setting value. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of asked setting -/// @param[in] defaultValue [opt] Default value if not found -/// @return The value of setting, `0` or defaultValue if not found -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// int value = kodi::GetSettingInt("my_integer_value"); -/// ~~~~~~~~~~~~~ -/// -inline int ATTRIBUTE_HIDDEN GetSettingInt(const std::string& settingName, int defaultValue = 0) -{ - int settingValue = defaultValue; - CheckSettingInt(settingName, settingValue); - return settingValue; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Set integer setting of addon. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of setting -/// @param[in] settingValue The setting value to write -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// int value = 123; -/// kodi::SetSettingInt("my_integer_value", value); -/// ~~~~~~~~~~~~~ -/// -inline void ATTRIBUTE_HIDDEN SetSettingInt(const std::string& settingName, int settingValue) -{ - using namespace kodi::addon; - - CAddonBase::m_interface->toKodi->set_setting_int(CAddonBase::m_interface->toKodi->kodiBase, - settingName.c_str(), settingValue); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Check and get a boolean setting value. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of asked setting -/// @param[out] settingValue The given setting value -/// @return true if setting was successfully found and "settingValue" is set -/// -/// @note If returns false, the "settingValue" is not changed. -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// bool value = false; -/// if (!kodi::CheckSettingBoolean("my_boolean_value", value)) -/// value = true; // My default of them -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN CheckSettingBoolean(const std::string& settingName, bool& settingValue) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->get_setting_bool( - CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), &settingValue); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Get boolean setting value. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of asked setting -/// @param[in] defaultValue [opt] Default value if not found -/// @return The value of setting, `false` or defaultValue if not found -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// bool value = kodi::GetSettingBoolean("my_boolean_value"); -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN GetSettingBoolean(const std::string& settingName, - bool defaultValue = false) -{ - bool settingValue = defaultValue; - CheckSettingBoolean(settingName, settingValue); - return settingValue; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Set boolean setting of addon. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of setting -/// @param[in] settingValue The setting value to write -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// bool value = true; -/// kodi::SetSettingBoolean("my_boolean_value", value); -/// ~~~~~~~~~~~~~ -/// -inline void ATTRIBUTE_HIDDEN SetSettingBoolean(const std::string& settingName, bool settingValue) -{ - using namespace kodi::addon; - - CAddonBase::m_interface->toKodi->set_setting_bool(CAddonBase::m_interface->toKodi->kodiBase, - settingName.c_str(), settingValue); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Check and get a floating point setting value. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of asked setting -/// @param[out] settingValue The given setting value -/// @return true if setting was successfully found and "settingValue" is set -/// -/// @note If returns false, the "settingValue" is not changed. -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// float value = 0.0f; -/// if (!kodi::CheckSettingBoolean("my_float_value", value)) -/// value = 1.0f; // My default of them -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN CheckSettingFloat(const std::string& settingName, float& settingValue) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->get_setting_float( - CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), &settingValue); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Get floating point setting value. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of asked setting -/// @param[in] defaultValue [opt] Default value if not found -/// @return The value of setting, `0.0` or defaultValue if not found -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// float value = kodi::GetSettingFloat("my_float_value"); -/// ~~~~~~~~~~~~~ -/// -inline float ATTRIBUTE_HIDDEN GetSettingFloat(const std::string& settingName, - float defaultValue = 0.0f) -{ - float settingValue = defaultValue; - CheckSettingFloat(settingName, settingValue); - return settingValue; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Set floating point setting of addon. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of setting -/// @param[in] settingValue The setting value to write -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// float value = 1.0f; -/// kodi::SetSettingFloat("my_float_value", value); -/// ~~~~~~~~~~~~~ -/// -inline void ATTRIBUTE_HIDDEN SetSettingFloat(const std::string& settingName, float settingValue) -{ - using namespace kodi::addon; - - CAddonBase::m_interface->toKodi->set_setting_float(CAddonBase::m_interface->toKodi->kodiBase, - settingName.c_str(), settingValue); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Check and get a enum setting value. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of asked setting -/// @param[out] settingValue The given setting value -/// @return true if setting was successfully found and "settingValue" is set -/// -/// @remark The enums are used as integer inside settings.xml. -/// @note If returns false, the "settingValue" is not changed. -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// enum myEnumValue -/// { -/// valueA, -/// valueB, -/// valueC -/// }; -/// -/// myEnumValue value; -/// if (!kodi::CheckSettingEnum("my_enum_value", value)) -/// value = valueA; // My default of them -/// ~~~~~~~~~~~~~ -/// -template -inline bool ATTRIBUTE_HIDDEN CheckSettingEnum(const std::string& settingName, - enumType& settingValue) -{ - using namespace kodi::addon; - - int settingValueInt = static_cast(settingValue); - bool ret = CAddonBase::m_interface->toKodi->get_setting_int( - CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), &settingValueInt); - if (ret) - settingValue = static_cast(settingValueInt); - return ret; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Get enum setting value. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of asked setting -/// @param[in] defaultValue [opt] Default value if not found -/// @return The value of setting, forced to `0` or defaultValue if not found -/// -/// @remark The enums are used as integer inside settings.xml. -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// enum myEnumValue -/// { -/// valueA, -/// valueB, -/// valueC -/// }; -/// -/// myEnumValue value = kodi::GetSettingEnum("my_enum_value"); -/// ~~~~~~~~~~~~~ -/// -template -inline enumType ATTRIBUTE_HIDDEN GetSettingEnum(const std::string& settingName, - enumType defaultValue = static_cast(0)) -{ - enumType settingValue = defaultValue; - CheckSettingEnum(settingName, settingValue); - return settingValue; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Set enum setting of addon. -/// -/// The setting name relate to names used in his settings.xml file. -/// -/// @param[in] settingName The name of setting -/// @param[in] settingValue The setting value to write -/// -/// @remark The enums are used as integer inside settings.xml. -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// enum myEnumValue -/// { -/// valueA, -/// valueB, -/// valueC -/// }; -/// -/// myEnumValue value = valueA; -/// kodi::SetSettingEnum("my_enum_value", value); -/// ~~~~~~~~~~~~~ -/// -template -inline void ATTRIBUTE_HIDDEN SetSettingEnum(const std::string& settingName, enumType settingValue) -{ - using namespace kodi::addon; - - CAddonBase::m_interface->toKodi->set_setting_int(CAddonBase::m_interface->toKodi->kodiBase, - settingName.c_str(), - static_cast(settingValue)); -} -//------------------------------------------------------------------------------ - -/*!@}*/ - -//============================================================================ -/// -inline std::string ATTRIBUTE_HIDDEN TranslateAddonStatus(ADDON_STATUS status) -{ - switch (status) - { - case ADDON_STATUS_OK: - return "OK"; - case ADDON_STATUS_LOST_CONNECTION: - return "Lost Connection"; - case ADDON_STATUS_NEED_RESTART: - return "Need Restart"; - case ADDON_STATUS_NEED_SETTINGS: - return "Need Settings"; - case ADDON_STATUS_UNKNOWN: - return "Unknown error"; - case ADDON_STATUS_PERMANENT_FAILURE: - return "Permanent failure"; - case ADDON_STATUS_NOT_IMPLEMENTED: - return "Not implemented"; - default: - break; - } - return "Unknown"; -} -//---------------------------------------------------------------------------- - -//============================================================================== -/// @ingroup cpp_kodi -/// @brief Returns a function table to a named interface -/// -/// @return pointer to struct containing interface functions -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// #include -/// ... -/// FuncTable_foo *table = kodi::GetPlatformInfo(foo_name, foo_version); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline void* GetInterface(const std::string& name, const std::string& version) -{ - using namespace kodi::addon; - - AddonToKodiFuncTable_Addon* toKodi = CAddonBase::m_interface->toKodi; - - return toKodi->get_interface(toKodi->kodiBase, name.c_str(), version.c_str()); -} -//---------------------------------------------------------------------------- - -} /* namespace kodi */ - -/*! addon creation macro - * @todo cleanup this stupid big macro - * This macro includes now all for add-on's needed functions. This becomes a bigger - * rework after everything is done on Kodi itself, currently is this way needed - * to have compatibility with not reworked interfaces. - * - * Becomes really cleaned up soon :D - */ -#define ADDONCREATOR(AddonClass) \ - extern "C" __declspec(dllexport) ADDON_STATUS ADDON_Create( \ - KODI_HANDLE addonInterface, const char* /*globalApiVersion*/, void* /*unused*/) \ - { \ - kodi::addon::CAddonBase::m_interface = static_cast(addonInterface); \ - kodi::addon::CAddonBase::m_interface->addonBase = new AddonClass; \ - return static_cast(kodi::addon::CAddonBase::m_interface->addonBase) \ - ->Create(); \ - } \ - extern "C" __declspec(dllexport) void ADDON_Destroy() \ - { \ - kodi::addon::CAddonBase::ADDONBASE_Destroy(); \ - } \ - extern "C" __declspec(dllexport) ADDON_STATUS ADDON_GetStatus() \ - { \ - return kodi::addon::CAddonBase::ADDONBASE_GetStatus(); \ - } \ - extern "C" __declspec(dllexport) ADDON_STATUS ADDON_SetSetting(const char* settingName, \ - const void* settingValue) \ - { \ - return kodi::addon::CAddonBase::ADDONBASE_SetSetting(settingName, settingValue); \ - } \ - extern "C" __declspec(dllexport) const char* ADDON_GetTypeVersion(int type) \ - { \ - return kodi::addon::GetTypeVersion(type); \ - } \ - extern "C" __declspec(dllexport) const char* ADDON_GetTypeMinVersion(int type) \ - { \ - return kodi::addon::GetTypeMinVersion(type); \ - } \ - AddonGlobalInterface* kodi::addon::CAddonBase::m_interface = nullptr; diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h deleted file mode 100644 index 0cfefac..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h +++ /dev/null @@ -1,618 +0,0 @@ -/* - * Copyright (C) 2005-2019 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "AddonBase.h" -#include "c-api/audio_engine.h" - -#ifdef __cplusplus - -namespace kodi -{ -namespace audioengine -{ - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// Main page text for audio engine group by Doxygen. -//{{{ - -//============================================================================== -/// -/// @defgroup cpp_kodi_audioengine Interface - kodi::audioengine -/// @ingroup cpp -/// @brief **Audio engine functions**\n -/// This interface contains auxiliary functions and classes which allow an addon -/// to play their own individual audio stream in Kodi. -/// -/// Using @ref cpp_kodi_audioengine_CAEStream "kodi::audioengine::CAEStream", -/// a class can be created in this regard, about which the necessary stream data and -/// information are given to Kodi. -/// -/// Via @ref kodi::audioengine::GetCurrentSinkFormat(), the audio formats currently -/// processed in Kodi can be called up beforehand in order to adapt your own stream -/// to them. -/// -/// However, the created stream can also differ from this because Kodi changes -/// it to suit it. -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// -/// #include -/// -/// ... -/// -/// kodi::audioengine::AudioEngineFormat format; -/// if (!kodi::audioengine::GetCurrentSinkFormat(format)) -/// return false; -/// -/// format.SetDataFormat(AUDIOENGINE_FMT_FLOATP); -/// format.SetChannelLayout(std::vector(AUDIOENGINE_CH_FL, AUDIOENGINE_CH_FR)); -/// -/// unsigned int myUsedSampleRate = format.GetSampleRate(); -/// -/// ... -/// -/// kodi::audioengine::CAEStream* stream = new kodi::audioengine::CAEStream(format, AUDIO_STREAM_AUTOSTART); -/// -/// ~~~~~~~~~~~~~ -/// -/// ------------------------------------------------------------------------ -/// -/// It has the header \ref AudioEngine.h "#include " be included -/// to enjoy it. -/// -//------------------------------------------------------------------------------ - -//============================================================================== -/// -/// @defgroup cpp_kodi_audioengine_Defs Definitions, structures and enumerators -/// @ingroup cpp_kodi_audioengine -/// @brief **Library definition values**\n -/// All audio engine functions associated data structures. -/// -//------------------------------------------------------------------------------ - -//}}} - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" related audio engine definitions -//{{{ - -//============================================================================== -/// @defgroup cpp_kodi_audioengine_Defs_AudioEngineFormat class AudioEngineFormat -/// @ingroup cpp_kodi_audioengine_Defs -/// @brief **Audio format structure**\n -/// The audio format structure that fully defines a stream's audio -/// information. -/// -/// With the help of this format information, Kodi adjusts its processing -/// accordingly. -/// -//@{ -class ATTRIBUTE_HIDDEN AudioEngineFormat - : public addon::CStructHdl -{ -public: - /*! \cond PRIVATE */ - AudioEngineFormat() - { - m_cStructure->m_dataFormat = AUDIOENGINE_FMT_INVALID; - m_cStructure->m_sampleRate = 0; - m_cStructure->m_encodedRate = 0; - m_cStructure->m_frames = 0; - m_cStructure->m_frameSize = 0; - m_cStructure->m_channelCount = 0; - - for (size_t ch = 0; ch < AUDIOENGINE_CH_MAX; ++ch) - m_cStructure->m_channels[ch] = AUDIOENGINE_CH_NULL; - } - AudioEngineFormat(const AudioEngineFormat& channel) : CStructHdl(channel) {} - AudioEngineFormat(const AUDIO_ENGINE_FORMAT* channel) : CStructHdl(channel) {} - AudioEngineFormat(AUDIO_ENGINE_FORMAT* channel) : CStructHdl(channel) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_audioengine_Defs_AudioEngineFormat_Help *Value Help* - /// @ingroup cpp_kodi_audioengine_Defs_AudioEngineFormat - /// - /// The following table contains values that can be set with @ref cpp_kodi_audioengine_Defs_AudioEngineFormat : - /// | Name | Type | Set call | Get call - /// |------|------|----------|---------- - /// | **Data format**, see @ref AudioEngineDataFormat for available types | enum | @ref AudioEngineFormat::SetDataFormat "SetDataFormat" | @ref AudioEngineFormat::GetDataFormat "GetDataFormat" - /// | **Sample rate** | unsigned int | @ref AudioEngineFormat::SetSampleRate "SetSampleRate" | @ref AudioEngineFormat::GetSampleRate "GetSampleRate" - /// | **Encoded rate** | unsigned int | @ref AudioEngineFormat::SetEncodedRate "SetEncodedRate" | @ref AudioEngineFormat::GetEncodedRate "GetEncodedRate" - /// | **Channel layout**, see @ref AudioEngineChannel for available types | std::vector | @ref AudioEngineFormat::SetChannelLayout "SetChannelLayout" | @ref AudioEngineFormat::GetChannelLayout "GetChannelLayout" - /// | **Frames amount** | unsigned int | @ref AudioEngineFormat::SetFramesAmount "SetFramesAmount" | @ref AudioEngineFormat::GetFramesAmount "GetFramesAmount" - /// | **Frame size** | unsigned int | @ref AudioEngineFormat::SetFrameSize "SetFrameSize" | @ref AudioEngineFormat::GetFrameSize "GetFrameSize" - /// - /// Further is @ref AudioEngineFormat::CompareFormat "CompareFormat" included to compare this class with another. - /// - - /// @addtogroup cpp_kodi_audioengine_Defs_AudioEngineFormat - /// @copydetails cpp_kodi_audioengine_Defs_AudioEngineFormat_Help - //@{ - - /// @brief The stream's data format (eg, AUDIOENGINE_FMT_S16LE) - void SetDataFormat(enum AudioEngineDataFormat format) { m_cStructure->m_dataFormat = format; } - - /// @brief To get with @ref SetDataFormat changed values. - enum AudioEngineDataFormat GetDataFormat() const { return m_cStructure->m_dataFormat; } - - /// @brief The stream's sample rate (eg, 48000) - void SetSampleRate(unsigned int rate) { m_cStructure->m_sampleRate = rate; } - - /// @brief To get with @ref SetSampleRate changed values. - unsigned int GetSampleRate() const { return m_cStructure->m_sampleRate; } - - /// @brief The encoded streams sample rate if a bitstream, otherwise undefined - void SetEncodedRate(unsigned int rate) { m_cStructure->m_encodedRate = rate; } - - /// @brief To get with @ref SetEncodedRate changed values. - unsigned int GetEncodedRate() const { return m_cStructure->m_encodedRate; } - - /// @brief The stream's channel layout - void SetChannelLayout(const std::vector& layout) - { - // Reset first all to empty values to AUDIOENGINE_CH_NULL, in case given list is empty - m_cStructure->m_channelCount = 0; - for (size_t ch = 0; ch < AUDIOENGINE_CH_MAX; ++ch) - m_cStructure->m_channels[ch] = AUDIOENGINE_CH_NULL; - - for (size_t ch = 0; ch < layout.size() && ch < AUDIOENGINE_CH_MAX; ++ch) - { - m_cStructure->m_channels[ch] = layout[ch]; - m_cStructure->m_channelCount++; - } - } - - /// @brief To get with @ref SetChannelLayout changed values. - std::vector GetChannelLayout() const - { - std::vector channels; - for (size_t ch = 0; ch < AUDIOENGINE_CH_MAX; ++ch) - { - if (m_cStructure->m_channels[ch] == AUDIOENGINE_CH_NULL) - break; - - channels.push_back(m_cStructure->m_channels[ch]); - } - return channels; - } - - /// @brief The number of frames per period - void SetFramesAmount(unsigned int frames) { m_cStructure->m_frames = frames; } - - /// @brief To get with @ref SetFramesAmount changed values. - unsigned int GetFramesAmount() const { return m_cStructure->m_frames; } - - /// @brief The size of one frame in bytes - void SetFrameSize(unsigned int frameSize) { m_cStructure->m_frameSize = frameSize; } - - /// @brief To get with @ref SetFrameSize changed values. - unsigned int GetFrameSize() const { return m_cStructure->m_frameSize; } - - /// @brief Function to compare the format structure with another - bool CompareFormat(const AudioEngineFormat* fmt) - { - if (!fmt) - { - return false; - } - - if (m_cStructure->m_dataFormat != fmt->m_cStructure->m_dataFormat || - m_cStructure->m_sampleRate != fmt->m_cStructure->m_sampleRate || - m_cStructure->m_encodedRate != fmt->m_cStructure->m_encodedRate || - m_cStructure->m_frames != fmt->m_cStructure->m_frames || - m_cStructure->m_frameSize != fmt->m_cStructure->m_frameSize || - m_cStructure->m_channelCount != fmt->m_cStructure->m_channelCount) - { - return false; - } - - for (unsigned int ch = 0; ch < AUDIOENGINE_CH_MAX; ++ch) - { - if (fmt->m_cStructure->m_channels[ch] != m_cStructure->m_channels[ch]) - { - return false; - } - } - - return true; - } -}; -//@} -//---------------------------------------------------------------------------- - -//}}} - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" AudioEngine addon interface -//{{{ - -//============================================================================ -/// -/// @defgroup cpp_kodi_audioengine_CAEStream class CAEStream -/// @ingroup cpp_kodi_audioengine -/// @brief **Audio Engine Stream Class**\n -/// Class that can be created by the addon in order to be able to transfer -/// audiostream data processed on the addon to Kodi and output it audibly. -/// -/// This can create individually several times and performed in different -/// processes simultaneously. -/// -/// It has the header @ref AudioEngine.h "#include " be -/// included to enjoy it. -/// -//---------------------------------------------------------------------------- -class ATTRIBUTE_HIDDEN CAEStream -{ -public: - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Contructs new class to an Kodi IAEStream in the format specified. - /// - /// @param[in] format The data format the incoming audio will be in - /// (e.g. \ref AUDIOENGINE_FMT_S16LE) - /// @param[in] options [opt] A bit field of stream options (see: enum \ref AudioEngineStreamOptions) - /// - /// - /// ------------------------------------------------------------------------ - /// - /// @copydetails cpp_kodi_audioengine_Defs_AudioEngineFormat_Help - /// - /// ------------------------------------------------------------------------ - /// - /// **Bit options to pass (on Kodi by IAE::MakeStream)** - /// - /// | enum AEStreamOptions | Value: | Description: - /// |----------------------------:|:------:|:----------------------------------- - /// | AUDIO_STREAM_FORCE_RESAMPLE | 1 << 0 | Force resample even if rates match - /// | AUDIO_STREAM_PAUSED | 1 << 1 | Create the stream paused - /// | AUDIO_STREAM_AUTOSTART | 1 << 2 | Autostart the stream when enough data is buffered - /// - /// - /// ------------------------------------------------------------------------ - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// - /// #include - /// - /// ... - /// - /// kodi::audioengine::AudioEngineFormat format; - /// - /// format.SetDataFormat(AUDIOENGINE_FMT_FLOATP); /* The stream's data format (eg, AUDIOENGINE_FMT_S16LE) */ - /// format.SetChannelLayout(std::vector(AUDIOENGINE_CH_FL, AUDIOENGINE_CH_FR)); /* The stream's channel layout */ - /// format.SetSampleRate(48000); /* The stream's sample rate (eg, 48000) */ - /// format.SetFrameSize(sizeof(float)*2); /* The size of one frame in bytes */ - /// format.SetFramesAmount(882); /* The number of samples in one frame */ - /// - /// kodi::audioengine::CAEStream* stream = new kodi::audioengine::CAEStream(format, AUDIO_STREAM_AUTOSTART); - /// - /// ~~~~~~~~~~~~~ - /// - CAEStream(AudioEngineFormat& format, unsigned int options = 0) - : m_kodiBase(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase), - m_cb(::kodi::addon::CAddonBase::m_interface->toKodi->kodi_audioengine) - { - m_StreamHandle = m_cb->make_stream(m_kodiBase, format, options); - if (m_StreamHandle == nullptr) - { - kodi::Log(ADDON_LOG_FATAL, "CAEStream: make_stream failed!"); - } - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Class destructor. - /// - ~CAEStream() - { - if (m_StreamHandle) - { - m_cb->free_stream(m_kodiBase, m_StreamHandle); - m_StreamHandle = nullptr; - } - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Returns the amount of space available in the stream. - /// - /// @return The number of bytes AddData will consume - /// - unsigned int GetSpace() { return m_cb->aestream_get_space(m_kodiBase, m_StreamHandle); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Add planar or interleaved PCM data to the stream. - /// - /// @param[in] data array of pointers to the planes - /// @param[in] offset to frame in frames - /// @param[in] frames number of frames - /// @param[in] pts [opt] presentation timestamp, default is 0 - /// @param[in] hasDownmix [opt] set true if downmix is present, default is false - /// @param[in] centerMixLevel [opt] level to mix left and right to center default is 1.0 - /// @return The number of frames consumed - /// - unsigned int AddData(uint8_t* const* data, - unsigned int offset, - unsigned int frames, - double pts = 0, - bool hasDownmix = false, - double centerMixLevel = 1.0) - { - return m_cb->aestream_add_data(m_kodiBase, m_StreamHandle, data, offset, frames, pts, - hasDownmix, centerMixLevel); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Returns the time in seconds that it will take for the next added - /// packet to be heard from the speakers. - /// - /// @return seconds - /// - double GetDelay() { return m_cb->aestream_get_delay(m_kodiBase, m_StreamHandle); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Returns if the stream is buffering. - /// - /// @return True if the stream is buffering - /// - bool IsBuffering() { return m_cb->aestream_is_buffering(m_kodiBase, m_StreamHandle); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Returns the time in seconds of the stream's cached audio samples. - /// Engine buffers excluded. - /// - /// @return seconds - /// - double GetCacheTime() { return m_cb->aestream_get_cache_time(m_kodiBase, m_StreamHandle); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Returns the total time in seconds of the cache. - /// - /// @return seconds - /// - double GetCacheTotal() { return m_cb->aestream_get_cache_total(m_kodiBase, m_StreamHandle); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Pauses the stream playback. - /// - void Pause() { return m_cb->aestream_pause(m_kodiBase, m_StreamHandle); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Resumes the stream after pausing - /// - void Resume() { return m_cb->aestream_resume(m_kodiBase, m_StreamHandle); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Start draining the stream. - /// - /// @param[in] wait [opt] Wait until drain is finished if set to true, - /// otherwise it returns direct - /// - /// @note Once called AddData will not consume more data. - /// - void Drain(bool wait = true) { return m_cb->aestream_drain(m_kodiBase, m_StreamHandle, wait); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Returns true if the is stream draining. - /// - bool IsDraining() { return m_cb->aestream_is_draining(m_kodiBase, m_StreamHandle); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Returns true if the is stream has finished draining. - /// - bool IsDrained() { return m_cb->aestream_is_drained(m_kodiBase, m_StreamHandle); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Flush all buffers dropping the audio data. - /// - void Flush() { return m_cb->aestream_flush(m_kodiBase, m_StreamHandle); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Return the stream's current volume level. - /// - /// @return The volume level between 0.0 and 1.0 - /// - float GetVolume() { return m_cb->aestream_get_volume(m_kodiBase, m_StreamHandle); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Set the stream's volume level. - /// - /// @param[in] volume The new volume level between 0.0 and 1.0 - /// - void SetVolume(float volume) - { - return m_cb->aestream_set_volume(m_kodiBase, m_StreamHandle, volume); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Gets the stream's volume amplification in linear units. - /// - /// @return The volume amplification factor between 1.0 and 1000.0 - /// - float GetAmplification() { return m_cb->aestream_get_amplification(m_kodiBase, m_StreamHandle); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Sets the stream's volume amplification in linear units. - /// - /// @param[in] amplify The volume amplification factor between 1.0 and 1000.0 - /// - void SetAmplification(float amplify) - { - return m_cb->aestream_set_amplification(m_kodiBase, m_StreamHandle, amplify); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Returns the size of one audio frame in bytes (channelCount * resolution). - /// - /// @return The size in bytes of one frame - /// - unsigned int GetFrameSize() const - { - return m_cb->aestream_get_frame_size(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Returns the number of channels the stream is configured to accept. - /// - /// @return The channel count - /// - unsigned int GetChannelCount() const - { - return m_cb->aestream_get_channel_count(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Returns the stream's sample rate, if the stream is using a dynamic - /// sample rate, this value will NOT reflect any changes made by calls to - /// SetResampleRatio(). - /// - /// @return The stream's sample rate (eg, 48000) - /// - unsigned int GetSampleRate() const - { - return m_cb->aestream_get_sample_rate(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Return the data format the stream has been configured with. - /// - /// @return The stream's data format (eg, AUDIOENGINE_FMT_S16LE) - /// - AudioEngineDataFormat GetDataFormat() const - { - return m_cb->aestream_get_data_format(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Return the resample ratio. - /// - /// @note This will return an undefined value if the stream is not resampling. - /// - /// @return the current resample ratio or undefined if the stream is not resampling - /// - double GetResampleRatio() - { - return m_cb->aestream_get_resample_ratio(m_kodiBase, m_StreamHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_audioengine_CAEStream - /// @brief Sets the resample ratio. - /// - /// @note This function may return false if the stream is not resampling, if - /// you wish to use this be sure to set the AESTREAM_FORCE_RESAMPLE option. - /// - /// @param[in] ratio the new sample rate ratio, calculated by - /// ((double)desiredRate / (double)GetSampleRate()) - /// - void SetResampleRatio(double ratio) - { - m_cb->aestream_set_resample_ratio(m_kodiBase, m_StreamHandle, ratio); - } - //-------------------------------------------------------------------------- - -private: - void* m_kodiBase; - AddonToKodiFuncTable_kodi_audioengine* m_cb; - AEStreamHandle* m_StreamHandle; -}; -//---------------------------------------------------------------------------- - -//============================================================================ -/// @ingroup cpp_kodi_audioengine -/// @brief Get the current sink data format. -/// -/// @param[in] format Current sink data format. For more details see AudioEngineFormat. -/// @return Returns true on success, else false. -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// -/// #include -/// -/// ... -/// -/// kodi::audioengine::AudioEngineFormat format; -/// if (!kodi::audioengine::GetCurrentSinkFormat(format)) -/// return false; -/// -/// std::vector layout = format.GetChannelLayout(); -/// -/// ... -/// return true; -/// -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN GetCurrentSinkFormat(AudioEngineFormat& format) -{ - using namespace kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_audioengine->get_current_sink_format( - CAddonBase::m_interface->toKodi->kodiBase, format); -} -//---------------------------------------------------------------------------- - -//}}} - -} // namespace audioengine -} // namespace kodi - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt deleted file mode 100644 index de7cb3e..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -set(HEADERS AddonBase.h - AudioEngine.h - Filesystem.h - General.h - Network.h - StreamCodec.h - StreamCrypto.h - versions.h) - -if(CORE_SYSTEM_NAME STREQUAL android) - list(APPEND SOURCES platform/android/System.h) -endif() - -if(NOT ENABLE_STATIC_LIBS) - core_add_library(addons_kodi-addon-dev-kit_include_kodi) -endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h deleted file mode 100644 index 2054ce6..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h +++ /dev/null @@ -1,2321 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "AddonBase.h" -#include "c-api/filesystem.h" - -#ifdef __cplusplus - -#include -#include -#include - -namespace kodi -{ -namespace vfs -{ - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// Main page text for filesystem group by Doxygen. -//{{{ - -//============================================================================== -/// -/// @defgroup cpp_kodi_vfs Interface - kodi::vfs -/// @ingroup cpp -/// @brief **Virtual filesystem functions**\n -/// Offers classes and functions for access to the Virtual File Server (VFS) -/// which you can use to manipulate files and folders. -/// -/// This system allow the use of ["Special Protocol"](https://kodi.wiki/view/Special_protocol) -/// where is Kodi's solution to platform dependent directories. Common directory -/// names are assigned a `special://[name]` path which is passed around -/// inside Kodi and then translated to the platform specific path before the -/// operating system sees it. This helps keep most of the platform mess -/// centralized in the code.\n -/// To become a correct path back can be @ref TranslateSpecialProtocol() used. -/// -/// It has the header @ref Filesystem.h "#include " be -/// included to enjoy it. -/// -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_vfs_Defs Definitions, structures and enumerators -/// @ingroup cpp_kodi_vfs -/// @brief **Virtual file Server definition values**\n -/// All to VFS system functions associated data structures. -/// -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_vfs_Directory 1. Directory functions -/// @ingroup cpp_kodi_vfs -/// @brief **Globally available directories related functions**\n -/// Used to perform typical operations with it. -/// -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_vfs_File 2. File functions -/// @ingroup cpp_kodi_vfs -/// @brief **Globally available file related functions**\n -/// Used to perform typical operations with it. -/// -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_vfs_General 3. General functions -/// @ingroup cpp_kodi_vfs -/// @brief **Other globally available functions**\n -/// Used to perform typical operations with it. -/// -//------------------------------------------------------------------------------ - -//}}} - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" related filesystem definitions -//{{{ - -//============================================================================== -/// @defgroup cpp_kodi_vfs_Defs_FileStatus class FileStatus -/// @ingroup cpp_kodi_vfs_Defs -/// @brief **File information status**\n -/// Used on kodi::vfs::StatFile() to get detailed information about a file. -/// -//@{ -class ATTRIBUTE_HIDDEN FileStatus : public kodi::addon::CStructHdl -{ -public: - /*! \cond PRIVATE */ - FileStatus() { memset(m_cStructure, 0, sizeof(STAT_STRUCTURE)); } - FileStatus(const FileStatus& channel) : CStructHdl(channel) {} - FileStatus(const STAT_STRUCTURE* channel) : CStructHdl(channel) {} - FileStatus(STAT_STRUCTURE* channel) : CStructHdl(channel) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_vfs_Defs_FileStatus_Help *Value Help* - /// @ingroup cpp_kodi_vfs_Defs_FileStatus - /// ---------------------------------------------------------------------------- - /// - /// The following table contains values that can be set with @ref cpp_kodi_vfs_Defs_FileStatus : - /// | Name | Type | Set call | Get call - /// |------|------|----------|---------- - /// | **ID of device containing file** | `uint32_t` | @ref FileStatus::SetDeviceId "SetDeviceId" | @ref FileStatus::GetDeviceId "GetDeviceId" - /// | **Total size, in bytes** | `uint64_t` | @ref FileStatus::SetSize "SetSize" | @ref FileStatus::GetSize "GetSize" - /// | **Time of last access** | `time_t` | @ref FileStatus::SetAccessTime "SetAccessTime" | @ref FileStatus::GetAccessTime "GetAccessTime" - /// | **Time of last modification** | `time_t` | @ref FileStatus::SetModificationTime "SetModificationTime" | @ref FileStatus::GetModificationTime "GetModificationTime" - /// | **Time of last status change** | `time_t` | @ref FileStatus::SetStatusTime "SetStatusTime" | @ref FileStatus::GetStatusTime "GetStatusTime" - /// | **Stat url is a directory** | `bool` | @ref FileStatus::SetIsDirectory "SetIsDirectory" | @ref FileStatus::GetIsDirectory "GetIsDirectory" - /// | **Stat url as a symbolic link** | `bool` | @ref FileStatus::SetIsSymLink "SetIsSymLink" | @ref FileStatus::GetIsSymLink "GetIsSymLink" - /// - - /// @addtogroup cpp_kodi_vfs_Defs_FileStatus - /// @copydetails cpp_kodi_vfs_Defs_FileStatus_Help - //@{ - - /// @brief Set ID of device containing file. - void SetDeviceId(uint32_t deviceId) { m_cStructure->deviceId = deviceId; } - - /// @brief Get ID of device containing file. - uint32_t GetDeviceId() const { return m_cStructure->deviceId; } - - /// @brief Set total size, in bytes. - void SetSize(uint64_t size) { m_cStructure->size = size; } - - /// @brief Get total size, in bytes. - uint64_t GetSize() const { return m_cStructure->size; } - - /// @brief Set time of last access. - void SetAccessTime(time_t accessTime) { m_cStructure->accessTime = accessTime; } - - /// @brief Get time of last access. - time_t GetAccessTime() const { return m_cStructure->accessTime; } - - /// @brief Set time of last modification. - void SetModificationTime(time_t modificationTime) - { - m_cStructure->modificationTime = modificationTime; - } - - /// @brief Get time of last modification. - time_t GetModificationTime() const { return m_cStructure->modificationTime; } - - /// @brief Set time of last status change. - void SetStatusTime(time_t statusTime) { m_cStructure->statusTime = statusTime; } - - /// @brief Get time of last status change. - time_t GetStatusTime() const { return m_cStructure->statusTime; } - - /// @brief Set the stat url is a directory. - void SetIsDirectory(bool isDirectory) { m_cStructure->isDirectory = isDirectory; } - - /// @brief The stat url is a directory if returns true. - bool GetIsDirectory() const { return m_cStructure->isDirectory; } - - /// @brief Set stat url as a symbolic link. - void SetIsSymLink(bool isSymLink) { m_cStructure->isSymLink = isSymLink; } - - /// @brief Get stat url is a symbolic link. - bool GetIsSymLink() const { return m_cStructure->isSymLink; } - - //@} -}; -//@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_vfs_Defs_CacheStatus class CacheStatus -/// @ingroup cpp_kodi_vfs_Defs -/// @brief **Cache information status**\n -/// Used on kodi::vfs::CFile::IoControlGetCacheStatus() to get running cache -/// status of proccessed stream. -/// -//@{ -class ATTRIBUTE_HIDDEN CacheStatus - : public kodi::addon::CStructHdl -{ -public: - /*! \cond PRIVATE */ - CacheStatus() { memset(m_cStructure, 0, sizeof(VFS_CACHE_STATUS_DATA)); } - CacheStatus(const CacheStatus& channel) : CStructHdl(channel) {} - CacheStatus(const VFS_CACHE_STATUS_DATA* channel) : CStructHdl(channel) {} - CacheStatus(VFS_CACHE_STATUS_DATA* channel) : CStructHdl(channel) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_vfs_Defs_CacheStatus_Help *Value Help* - /// @ingroup cpp_kodi_vfs_Defs_CacheStatus - /// ---------------------------------------------------------------------------- - /// - /// The following table contains values that can be set with @ref cpp_kodi_vfs_Defs_CacheStatus : - /// | Name | Type | Set call | Get call - /// |------|------|----------|---------- - /// | **Number of bytes cached** | `uint64_t` | @ref CacheStatus::SetForward "SetForward" | @ref CacheStatus::GetForward "GetForward" - /// | **Maximum number of bytes per second** | `unsigned int` | @ref CacheStatus::SetMaxRate "SetMaxRate" | @ref CacheStatus::GetMaxRate "GetMaxRate" - /// | **Average read rate from source file** | `unsigned int` | @ref CacheStatus::SetCurrentRate "SetCurrentRate" | @ref CacheStatus::GetCurrentRate "GetCurrentRate" - /// | **Cache low speed condition detected** | `bool` | @ref CacheStatus::SetLowspeed "SetLowspeed" | @ref CacheStatus::GetLowspeed "GetLowspeed" - /// - - /// @addtogroup cpp_kodi_vfs_Defs_CacheStatus - /// @copydetails cpp_kodi_vfs_Defs_CacheStatus_Help - //@{ - - /// @brief Set number of bytes cached forward of current position. - void SetForward(uint64_t forward) { m_cStructure->forward = forward; } - - /// @brief Get number of bytes cached forward of current position. - uint64_t GetForward() { return m_cStructure->forward; } - - /// @brief Set maximum number of bytes per second cache is allowed to fill. - void SetMaxRate(unsigned int maxrate) { m_cStructure->maxrate = maxrate; } - - /// @brief Set maximum number of bytes per second cache is allowed to fill. - unsigned int GetMaxRate() { return m_cStructure->maxrate; } - - /// @brief Set average read rate from source file since last position change. - void SetCurrentRate(unsigned int currate) { m_cStructure->currate = currate; } - - /// @brief Get average read rate from source file since last position change. - unsigned int GetCurrentRate() { return m_cStructure->currate; } - - /// @brief Set cache low speed condition detected. - void SetLowspeed(bool lowspeed) { m_cStructure->lowspeed = lowspeed; } - - /// @brief Get cache low speed condition detected. - bool GetLowspeed() { return m_cStructure->lowspeed; } - - //@} -}; -//@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_vfs_Defs_HttpHeader class HttpHeader -/// @ingroup cpp_kodi_vfs_Defs -/// @brief **HTTP header information**\n -/// The class used to access HTTP header information and get his information. -/// -/// Used on @ref kodi::vfs::GetHttpHeader(). -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_vfs_Defs_HttpHeader_Help -/// -///@{ -class ATTRIBUTE_HIDDEN HttpHeader -{ -public: - //========================================================================== - /// @brief Http header parser class constructor. - /// - HttpHeader() - { - using namespace ::kodi::addon; - - CAddonBase::m_interface->toKodi->kodi_filesystem->http_header_create( - CAddonBase::m_interface->toKodi->kodiBase, &m_handle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @brief Class destructor. - /// - ~HttpHeader() - { - using namespace ::kodi::addon; - - CAddonBase::m_interface->toKodi->kodi_filesystem->http_header_free( - CAddonBase::m_interface->toKodi->kodiBase, &m_handle); - } - //-------------------------------------------------------------------------- - - /// @defgroup cpp_kodi_vfs_Defs_HttpHeader_Help *Value Help* - /// @ingroup cpp_kodi_vfs_Defs_HttpHeader - /// - /// The following table contains values that can be get with @ref cpp_kodi_vfs_Defs_HttpHeader : - /// | Description | Type | Get call - /// |-------------|------|------------ - /// | **Get the value associated with this parameter of these HTTP headers** | `std::string` | @ref HttpHeader::GetValue "GetValue" - /// | **Get the values as list associated with this parameter of these HTTP headers** | `std::vector` | @ref HttpHeader::GetValues "GetValues" - /// | **Get the full header string associated with these HTTP headers** | `std::string` | @ref HttpHeader::GetHeader "GetHeader" - /// | **Get the mime type associated with these HTTP headers** | `std::string` | @ref HttpHeader::GetMimeType "GetMimeType" - /// | **Get the charset associated with these HTTP headers** | `std::string` | @ref HttpHeader::GetCharset "GetCharset" - /// | **The protocol line associated with these HTTP headers** | `std::string` | @ref HttpHeader::GetProtoLine "GetProtoLine" - /// - - /// @addtogroup cpp_kodi_vfs_Defs_HttpHeader - ///@{ - - //========================================================================== - /// @brief Get the value associated with this parameter of these HTTP - /// headers. - /// - /// @param[in] param The name of the parameter a value is required for - /// @return The value found - /// - std::string GetValue(const std::string& param) const - { - using namespace ::kodi::addon; - - if (!m_handle.handle) - return ""; - - std::string protoLine; - char* string = m_handle.get_value(CAddonBase::m_interface->toKodi->kodiBase, m_handle.handle, - param.c_str()); - if (string != nullptr) - { - protoLine = string; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - string); - } - return protoLine; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @brief Get the values as list associated with this parameter of these - /// HTTP headers. - /// - /// @param[in] param The name of the parameter values are required for - /// @return The values found - /// - std::vector GetValues(const std::string& param) const - { - using namespace kodi::addon; - - if (!m_handle.handle) - return std::vector(); - - int numValues = 0; - char** res(m_handle.get_values(CAddonBase::m_interface->toKodi->kodiBase, m_handle.handle, - param.c_str(), &numValues)); - if (res) - { - std::vector vecReturn; - for (int i = 0; i < numValues; ++i) - { - vecReturn.emplace_back(res[i]); - } - CAddonBase::m_interface->toKodi->free_string_array(CAddonBase::m_interface->toKodi->kodiBase, - res, numValues); - return vecReturn; - } - return std::vector(); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @brief Get the full header string associated with these HTTP headers. - /// - /// @return The header as a string - /// - std::string GetHeader() const - { - using namespace ::kodi::addon; - - if (!m_handle.handle) - return ""; - - std::string header; - char* string = m_handle.get_header(CAddonBase::m_interface->toKodi->kodiBase, m_handle.handle); - if (string != nullptr) - { - header = string; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - string); - } - return header; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @brief Get the mime type associated with these HTTP headers. - /// - /// @return The mime type - /// - std::string GetMimeType() const - { - using namespace ::kodi::addon; - - if (!m_handle.handle) - return ""; - - std::string protoLine; - char* string = - m_handle.get_mime_type(CAddonBase::m_interface->toKodi->kodiBase, m_handle.handle); - if (string != nullptr) - { - protoLine = string; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - string); - } - return protoLine; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @brief Get the charset associated with these HTTP headers. - /// - /// @return The charset - /// - std::string GetCharset() const - { - using namespace ::kodi::addon; - - if (!m_handle.handle) - return ""; - - std::string protoLine; - char* string = m_handle.get_charset(CAddonBase::m_interface->toKodi->kodiBase, m_handle.handle); - if (string != nullptr) - { - protoLine = string; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - string); - } - return protoLine; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @brief The protocol line associated with these HTTP headers. - /// - /// @return The protocol line - /// - std::string GetProtoLine() const - { - using namespace ::kodi::addon; - - if (!m_handle.handle) - return ""; - - std::string protoLine; - char* string = - m_handle.get_proto_line(CAddonBase::m_interface->toKodi->kodiBase, m_handle.handle); - if (string != nullptr) - { - protoLine = string; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - string); - } - return protoLine; - } - //-------------------------------------------------------------------------- - - ///@} - - KODI_HTTP_HEADER m_handle; -}; -///@} -//---------------------------------------------------------------------------- - -//============================================================================== -/// @defgroup cpp_kodi_vfs_CDirEntry class CDirEntry -/// @ingroup cpp_kodi_vfs_Defs -/// -/// @brief **Virtual file server directory entry**\n -/// This class is used as an entry for files and folders in -/// kodi::vfs::GetDirectory(). -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// ... -/// -/// std::vector items; -/// kodi::vfs::GetDirectory("special://temp", "", items); -/// -/// fprintf(stderr, "Directory have %lu entries\n", items.size()); -/// for (unsigned long i = 0; i < items.size(); i++) -/// { -/// char buff[20]; -/// time_t now = items[i].DateTime(); -/// strftime(buff, 20, "%Y-%m-%d %H:%M:%S", gmtime(&now)); -/// fprintf(stderr, " - %04lu -- Folder: %s -- Name: %s -- Path: %s -- Time: %s\n", -/// i+1, -/// items[i].IsFolder() ? "yes" : "no ", -/// items[i].Label().c_str(), -/// items[i].Path().c_str(), -/// buff); -/// } -/// ~~~~~~~~~~~~~ -/// -/// It has the header @ref Filesystem.h "#include " be included -/// to enjoy it. -/// -//@{ -class ATTRIBUTE_HIDDEN CDirEntry -{ -public: - //============================================================================ - /// @ingroup cpp_kodi_vfs_CDirEntry - /// @brief Constructor for VFS directory entry - /// - /// @param[in] label [opt] Name to use for entry - /// @param[in] path [opt] Used path of the entry - /// @param[in] folder [opt] If set entry used as folder - /// @param[in] size [opt] If used as file, his size defined there - /// @param[in] dateTime [opt] Date time of the entry - /// - CDirEntry(const std::string& label = "", - const std::string& path = "", - bool folder = false, - int64_t size = -1, - time_t dateTime = 0) - : m_label(label), m_path(path), m_folder(folder), m_size(size), m_dateTime(dateTime) - { - } - //---------------------------------------------------------------------------- - - //============================================================================ - // @note Not for addon development itself needed, thats why below is - // disabled for doxygen! - // - // @ingroup cpp_kodi_vfs_CDirEntry - // @brief Constructor to create own copy - // - // @param[in] dirEntry pointer to own class type - // - explicit CDirEntry(const VFSDirEntry& dirEntry) - : m_label(dirEntry.label ? dirEntry.label : ""), - m_path(dirEntry.path ? dirEntry.path : ""), - m_folder(dirEntry.folder), - m_size(dirEntry.size), - m_dateTime(dirEntry.date_time) - { - } - //---------------------------------------------------------------------------- - - /// @defgroup cpp_kodi_vfs_CDirEntry_Help *Value Help* - /// @ingroup cpp_kodi_vfs_CDirEntry - /// -------------------------------------------------------------------------- - /// - /// The following table contains values that can be set with @ref cpp_kodi_vfs_CDirEntry : - /// | Name | Type | Set call | Get call | Clear call | - /// |------|------|----------|----------|------------| - /// | **Directory entry name** | `std::string` | @ref CDirEntry::SetLabel "SetLabel" | @ref CDirEntry::Label "Label" | | - /// | **Title of entry** | `std::string` | @ref CDirEntry::SetTitle "SetTitle" | @ref CDirEntry::Title "Title" | | - /// | **Path of the entry** | `std::string` | @ref CDirEntry::SetPath "SetPath" | @ref CDirEntry::Path "Path" | | - /// | **Entry is folder** | `bool` | @ref CDirEntry::SetFolder "SetFolder" | @ref CDirEntry::IsFolder "IsFolder" | | - /// | **The size of the file** | `int64_t` | @ref CDirEntry::SetSize "SetSize" | @ref CDirEntry::Size "Size" | | - /// | **File time and date** | `time_t` | @ref CDirEntry::SetDateTime "SetDateTime" | @ref CDirEntry::DateTime "DateTime" | | - /// | **Property entries** | `std::string, std::string` | @ref CDirEntry::AddProperty "AddProperty" | @ref CDirEntry::GetProperties "GetProperties" | @ref CDirEntry::ClearProperties "ClearProperties" - /// - - /// @addtogroup cpp_kodi_vfs_CDirEntry - /// @copydetails cpp_kodi_vfs_CDirEntry_Help - //@{ - - //============================================================================ - /// @brief Get the directory entry name. - /// - /// @return Name of the entry - /// - const std::string& Label(void) const { return m_label; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get the optional title of entry. - /// - /// @return Title of the entry, if exists - /// - const std::string& Title(void) const { return m_title; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get the path of the entry. - /// - /// @return File system path of the entry - /// - const std::string& Path(void) const { return m_path; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Used to check entry is folder. - /// - /// @return true if entry is a folder - /// - bool IsFolder(void) const { return m_folder; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief If file, the size of the file. - /// - /// @return Defined file size - /// - int64_t Size(void) const { return m_size; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get file time and date for a new entry. - /// - /// @return The with time_t defined date and time of file - /// - time_t DateTime() { return m_dateTime; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Set the label name. - /// - /// @param[in] label name of entry - /// - void SetLabel(const std::string& label) { m_label = label; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Set the title name. - /// - /// @param[in] title title name of entry - /// - void SetTitle(const std::string& title) { m_title = title; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Set the path of the entry. - /// - /// @param[in] path path of entry - /// - void SetPath(const std::string& path) { m_path = path; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Set the entry defined as folder. - /// - /// @param[in] folder If true becomes entry defined as folder - /// - void SetFolder(bool folder) { m_folder = folder; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Set a file size for a new entry. - /// - /// @param[in] size Size to set for dir entry - /// - void SetSize(int64_t size) { m_size = size; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Set file time and date for a new entry. - /// - /// @param[in] dateTime The with time_t defined date and time of file - /// - void SetDateTime(time_t dateTime) { m_dateTime = dateTime; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Add a by string defined property entry to directory entry. - /// - /// @note A property can be used to add some special information about a file - /// or directory entry, this can be used on other places to do the right work - /// of them. - /// - /// @param[in] id Identification name of property - /// @param[in] value The property value to add by given id - /// - void AddProperty(const std::string& id, const std::string& value) { m_properties[id] = value; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Clear all present properties. - /// - void ClearProperties() { m_properties.clear(); } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get the present properties list on directory entry. - /// - /// @return map with all present properties - /// - const std::map& GetProperties() const { return m_properties; } - //---------------------------------------------------------------------------- - - //@} - -private: - std::string m_label; - std::string m_title; - std::string m_path; - std::map m_properties; - bool m_folder; - int64_t m_size; - time_t m_dateTime; -}; -//@} -//------------------------------------------------------------------------------ - -//}}} - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" Directory related functions -//{{{ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_Directory -/// @brief Make a directory. -/// -/// The kodi::vfs::CreateDirectory() function shall create a -/// new directory with name path. -/// -/// The newly created directory shall be an empty directory. -/// -/// @param[in] path Path to the directory. -/// @return Upon successful completion, CreateDirectory() shall return true. -/// Otherwise false shall be returned, no directory shall be created. -/// -/// -/// ------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string directory = "C:\\my_dir"; -/// bool ret = kodi::vfs::CreateDirectory(directory); -/// fprintf(stderr, "Directory '%s' successfull created: %s\n", directory.c_str(), ret ? "yes" : "no"); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN CreateDirectory(const std::string& path) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->create_directory( - CAddonBase::m_interface->toKodi->kodiBase, path.c_str()); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_Directory -/// @brief Verifying the Existence of a Directory. -/// -/// The kodi::vfs::DirectoryExists() method determines whether -/// a specified folder exists. -/// -/// @param[in] path Path to the directory. -/// @return True when it exists, false otherwise. -/// -/// -/// ------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string directory = "C:\\my_dir"; -/// bool ret = kodi::vfs::DirectoryExists(directory); -/// fprintf(stderr, "Directory '%s' present: %s\n", directory.c_str(), ret ? "yes" : "no"); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN DirectoryExists(const std::string& path) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->directory_exists( - CAddonBase::m_interface->toKodi->kodiBase, path.c_str()); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_Directory -/// @brief Removes a directory. -/// -/// The kodi::vfs::RemoveDirectory() function shall remove a -/// directory whose name is given by path. -/// -/// @param[in] path Path to the directory. -/// @return Upon successful completion, the function RemoveDirectory() shall -/// return true. Otherwise, false shall be returned, and errno set -/// to indicate the error. If false is returned, the named directory -/// shall not be changed. -/// -/// -/// ------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// bool ret = kodi::vfs::RemoveDirectory("C:\\my_dir"); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN RemoveDirectory(const std::string& path) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->remove_directory( - CAddonBase::m_interface->toKodi->kodiBase, path.c_str()); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_Directory -/// @brief Lists a directory. -/// -/// Return the list of files and directories which have been found in the -/// specified directory and which respect the given constraint. -/// -/// It can handle the normal OS dependent paths and also the special virtual -/// filesystem from Kodi what starts with \b special://. -/// -/// @param[in] path The path in which the files and directories are located. -/// @param[in] mask Mask to filter out requested files, e.g. "*.avi|*.mpg" to -/// files with this ending. -/// @param[out] items The returned list directory entries. -/// @return True if listing was successful, false otherwise. -/// -/// -/// ------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// std::vector items; -/// kodi::vfs::GetDirectory("special://temp", "", items); -/// -/// fprintf(stderr, "Directory have %lu entries\n", items.size()); -/// for (unsigned long i = 0; i < items.size(); i++) -/// { -/// fprintf(stderr, " - %04lu -- Folder: %s -- Name: %s -- Path: %s\n", -/// i+1, -/// items[i].IsFolder() ? "yes" : "no ", -/// items[i].Label().c_str(), -/// items[i].Path().c_str()); -/// } -/// ~~~~~~~~~~~~~ -inline bool ATTRIBUTE_HIDDEN GetDirectory(const std::string& path, - const std::string& mask, - std::vector& items) -{ - using namespace kodi::addon; - - VFSDirEntry* dir_list = nullptr; - unsigned int num_items = 0; - if (CAddonBase::m_interface->toKodi->kodi_filesystem->get_directory( - CAddonBase::m_interface->toKodi->kodiBase, path.c_str(), mask.c_str(), &dir_list, - &num_items)) - { - if (dir_list) - { - for (unsigned int i = 0; i < num_items; ++i) - items.emplace_back(dir_list[i]); - - CAddonBase::m_interface->toKodi->kodi_filesystem->free_directory( - CAddonBase::m_interface->toKodi->kodiBase, dir_list, num_items); - } - - return true; - } - return false; -} -//------------------------------------------------------------------------------ - -//}}} - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" File related functions -//{{{ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_File -/// @brief Check if a file exists. -/// -/// @param[in] filename The filename to check. -/// @param[in] usecache Check in file cache. -/// @return true if the file exists false otherwise. -/// -/// -/// ------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// bool exists = kodi::vfs::FileExists("special://temp/kodi.log"); -/// fprintf(stderr, "Log file should be always present, is it present? %s\n", exists ? "yes" : "no"); -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN FileExists(const std::string& filename, bool usecache = false) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->file_exists( - CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), usecache); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_File -/// @brief Get file status. -/// -/// These function return information about a file. Execute (search) -/// permission is required on all of the directories in path that -/// lead to the file. -/// -/// The call return a stat structure, which contains the on -/// @ref cpp_kodi_vfs_Defs_FileStatus defined values. -/// -/// @warning Not all of the OS file systems implement all of the time fields. -/// -/// @param[in] filename The filename to read the status from. -/// @param[out] buffer The file status is written into this buffer. -/// @return On success, trur is returned. On error, false is returned -/// -/// -/// @copydetails cpp_kodi_vfs_Defs_FileStatus_Help -/// -/// ------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// kodi::vfs::FileStatus statFile; -/// int ret = kodi::vfs::StatFile("special://temp/kodi.log", statFile); -/// fprintf(stderr, "deviceId (ID of device containing file) = %u\n" -/// "size (total size, in bytes) = %lu\n" -/// "accessTime (time of last access) = %lu\n" -/// "modificationTime (time of last modification) = %lu\n" -/// "statusTime (time of last status change) = %lu\n" -/// "isDirectory (The stat url is a directory) = %s\n" -/// "isSymLink (The stat url is a symbolic link) = %s\n" -/// "Return value = %i\n", -/// statFile.GetDeviceId(), -/// statFile.GetSize(), -/// statFile.GetAccessTime(), -/// statFile.GetModificationTime(), -/// statFile.GetStatusTime(), -/// statFile.GetIsDirectory() ? "true" : "false", -/// statFile.GetIsSymLink() ? "true" : "false", -/// ret); -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN StatFile(const std::string& filename, kodi::vfs::FileStatus& buffer) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->stat_file( - CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), buffer); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_File -/// @brief Deletes a file. -/// -/// @param[in] filename The filename to delete. -/// @return The file was successfully deleted. -/// -/// -/// ------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// #include -/// #include -/// ... -/// std::string filename; -/// if (kodi::gui::DialogFileBrowser::ShowAndGetFile("local", "", -/// "Test File selection and delete of them!", -/// filename)) -/// { -/// bool successed = kodi::vfs::DeleteFile(filename); -/// if (!successed) -/// kodi::gui::DialogOK::ShowAndGetInput("Error", "Delete of File", filename, "failed!"); -/// else -/// kodi::gui::DialogOK::ShowAndGetInput("Information", "Delete of File", filename, "successfull done."); -/// } -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN DeleteFile(const std::string& filename) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->delete_file( - CAddonBase::m_interface->toKodi->kodiBase, filename.c_str()); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_File -/// @brief Rename a file name. -/// -/// @param[in] filename The filename to copy. -/// @param[in] newFileName The new filename -/// @return true if successfully renamed -/// -/// -inline bool ATTRIBUTE_HIDDEN RenameFile(const std::string& filename, const std::string& newFileName) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->rename_file( - CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), newFileName.c_str()); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_File -/// @brief Copy a file from source to destination. -/// -/// @param[in] filename The filename to copy. -/// @param[in] destination The destination to copy file to -/// @return true if successfully copied -/// -/// -inline bool ATTRIBUTE_HIDDEN CopyFile(const std::string& filename, const std::string& destination) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->copy_file( - CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), destination.c_str()); -} -//------------------------------------------------------------------------------ - -//}}} - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" General filesystem functions -//{{{ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Retrieve MD5sum of a file. -/// -/// @param[in] path Path to the file to MD5sum -/// @return MD5 sum of the file -/// -/// -/// ------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// #include -/// ... -/// std::string md5; -/// std::string filename; -/// if (kodi::gui::DialogFileBrowser::ShowAndGetFile("local", "*.avi|*.mpg|*.mp4", -/// "Test File selection to get MD5", -/// filename)) -/// { -/// md5 = kodi::vfs::GetFileMD5(filename); -/// fprintf(stderr, "MD5 of file '%s' is %s\n", md5.c_str(), filename.c_str()); -/// } -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN GetFileMD5(const std::string& path) -{ - using namespace kodi::addon; - - std::string strReturn; - char* strMd5 = CAddonBase::m_interface->toKodi->kodi_filesystem->get_file_md5( - CAddonBase::m_interface->toKodi->kodiBase, path.c_str()); - if (strMd5 != nullptr) - { - if (std::strlen(strMd5)) - strReturn = strMd5; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, strMd5); - } - return strReturn; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Returns a thumb cache filename. -/// -/// @param[in] filename Path to file -/// @return Cache filename -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// #include -/// ... -/// std::string thumb; -/// std::string filename; -/// if (kodi::gui::DialogFileBrowser::ShowAndGetFile("local", "*.avi|*.mpg|*.mp4", -/// "Test File selection to get Thumnail", -/// filename)) -/// { -/// thumb = kodi::vfs::GetCacheThumbName(filename); -/// fprintf(stderr, "Thumb name of file '%s' is %s\n", thumb.c_str(), filename.c_str()); -/// } -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN GetCacheThumbName(const std::string& filename) -{ - using namespace kodi::addon; - - std::string strReturn; - char* strThumbName = CAddonBase::m_interface->toKodi->kodi_filesystem->get_cache_thumb_name( - CAddonBase::m_interface->toKodi->kodiBase, filename.c_str()); - if (strThumbName != nullptr) - { - if (std::strlen(strThumbName)) - strReturn = strThumbName; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - strThumbName); - } - return strReturn; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Make filename valid. -/// -/// Function to replace not valid characters with '_'. It can be also -/// compared with original before in a own loop until it is equal -/// (no invalid characters). -/// -/// @param[in] filename Filename to check and fix -/// @return The legal filename -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string fileName = "///\\jk???lj????.mpg"; -/// std::string legalName = kodi::vfs::MakeLegalFileName(fileName); -/// fprintf(stderr, "Legal name of '%s' is '%s'\n", fileName.c_str(), legalName.c_str()); -/// -/// /* Returns as legal: 'jk___lj____.mpg' */ -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN MakeLegalFileName(const std::string& filename) -{ - using namespace kodi::addon; - - std::string strReturn; - char* strLegalFileName = CAddonBase::m_interface->toKodi->kodi_filesystem->make_legal_filename( - CAddonBase::m_interface->toKodi->kodiBase, filename.c_str()); - if (strLegalFileName != nullptr) - { - if (std::strlen(strLegalFileName)) - strReturn = strLegalFileName; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - strLegalFileName); - } - return strReturn; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Make directory name valid. -/// -/// Function to replace not valid characters with '_'. It can be also -/// compared with original before in a own loop until it is equal -/// (no invalid characters). -/// -/// @param[in] path Directory name to check and fix -/// @return The legal directory name -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string path = "///\\jk???lj????\\hgjkg"; -/// std::string legalPath = kodi::vfs::MakeLegalPath(path); -/// fprintf(stderr, "Legal name of '%s' is '%s'\n", path.c_str(), legalPath.c_str()); -/// -/// /* Returns as legal: '/jk___lj____/hgjkg' */ -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN MakeLegalPath(const std::string& path) -{ - using namespace kodi::addon; - - std::string strReturn; - char* strLegalPath = CAddonBase::m_interface->toKodi->kodi_filesystem->make_legal_path( - CAddonBase::m_interface->toKodi->kodiBase, path.c_str()); - if (strLegalPath != nullptr) - { - if (std::strlen(strLegalPath)) - strReturn = strLegalPath; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - strLegalPath); - } - return strReturn; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Returns the translated path. -/// -/// @param[in] source String or unicode - Path to format -/// @return A human-readable string suitable for logging -/// -/// @note Only useful if you are coding for both Linux and Windows. e.g. -/// Converts 'special://masterprofile/script_data' -> -/// '/home/user/.kodi/UserData/script_data' on Linux. -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string path = kodi::vfs::TranslateSpecialProtocol("special://masterprofile/script_data"); -/// fprintf(stderr, "Translated path is: %s\n", path.c_str()); -/// ... -/// ~~~~~~~~~~~~~ -/// or -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// fprintf(stderr, "Directory 'special://temp' is '%s'\n", kodi::vfs::TranslateSpecialProtocol("special://temp").c_str()); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN TranslateSpecialProtocol(const std::string& source) -{ - using namespace kodi::addon; - - std::string strReturn; - char* protocol = CAddonBase::m_interface->toKodi->kodi_filesystem->translate_special_protocol( - CAddonBase::m_interface->toKodi->kodiBase, source.c_str()); - if (protocol != nullptr) - { - if (std::strlen(protocol)) - strReturn = protocol; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - protocol); - } - return strReturn; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Retrieves information about the amount of space that is available on -/// a disk volume. -/// -/// Path can be also with Kodi's special protocol. -/// -/// @param[in] path Path for where to check -/// @param[out] capacity The total number of bytes in the file system -/// @param[out] free The total number of free bytes in the file system -/// @param[out] available The total number of free bytes available to a -/// non-privileged process -/// @return true if successfully done and set -/// -/// @warning This only works with paths belonging to OS. If "special://" -/// is used, it must point to a place on your own OS. -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include // for ULLONG_MAX -/// #include -/// ... -/// std::string path = "special://temp"; -/// uint64_t capacity = ULLONG_MAX; -/// uint64_t free = ULLONG_MAX; -/// uint64_t available = ULLONG_MAX; -/// kodi::vfs::GetDiskSpace(path, capacity, free, available); -/// fprintf(stderr, "Path '%s' sizes:\n", path.c_str()); -/// fprintf(stderr, " - capacity: %lu MByte\n", capacity / 1024 / 1024); -/// fprintf(stderr, " - free: %lu MByte\n", free / 1024 / 1024); -/// fprintf(stderr, " - available: %lu MByte\n", available / 1024 / 1024); -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN GetDiskSpace(const std::string& path, - uint64_t& capacity, - uint64_t& free, - uint64_t& available) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->get_disk_space( - CAddonBase::m_interface->toKodi->kodiBase, path.c_str(), &capacity, &free, &available); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Return the file name from given complate path string. -/// -/// @param[in] path The complete path include file and directory -/// @return Filename from path -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string fileName = kodi::vfs::GetFileName("special://temp/kodi.log"); -/// fprintf(stderr, "File name is '%s'\n", fileName.c_str()); -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN GetFileName(const std::string& path) -{ - /* find the last slash */ - const size_t slash = path.find_last_of("/\\"); - return path.substr(slash + 1); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Return the directory name from given complate path string. -/// -/// @param[in] path The complete path include file and directory -/// @return Directory name from path -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string dirName = kodi::vfs::GetDirectoryName("special://temp/kodi.log"); -/// fprintf(stderr, "Directory name is '%s'\n", dirName.c_str()); -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN GetDirectoryName(const std::string& path) -{ - // Will from a full filename return the directory the file resides in. - // Keeps the final slash at end and possible |option=foo options. - - size_t iPosSlash = path.find_last_of("/\\"); - if (iPosSlash == std::string::npos) - return ""; // No slash, so no path (ignore any options) - - size_t iPosBar = path.rfind('|'); - if (iPosBar == std::string::npos) - return path.substr(0, iPosSlash + 1); // Only path - - return path.substr(0, iPosSlash + 1) + path.substr(iPosBar); // Path + options -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Remove the slash on given path name. -/// -/// @param[in,out] path The complete path -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string dirName = "special://temp/"; -/// kodi::vfs::RemoveSlashAtEnd(dirName); -/// fprintf(stderr, "Directory name is '%s'\n", dirName.c_str()); -/// ~~~~~~~~~~~~~ -/// -inline void ATTRIBUTE_HIDDEN RemoveSlashAtEnd(std::string& path) -{ - if (!path.empty()) - { - char last = path[path.size() - 1]; - if (last == '/' || last == '\\') - path.erase(path.size() - 1); - } -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Return a size aligned to the chunk size at least as large as the -/// chunk size. -/// -/// @param[in] chunk The chunk size -/// @param[in] minimum The minimum size (or maybe the minimum number of chunks?) -/// @return The aligned size -/// -inline unsigned int ATTRIBUTE_HIDDEN GetChunkSize(unsigned int chunk, unsigned int minimum) -{ - if (chunk) - return chunk * ((minimum + chunk - 1) / chunk); - else - return minimum; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Checks the given path contains a known internet protocol. -/// -/// About following protocols are the path checked: -/// | Protocol | Return true condition | Protocol | Return true condition -/// |----------|-----------------------|----------|----------------------- -/// | **dav** | strictCheck = true | **rtmps** | always -/// | **davs** | strictCheck = true | **rtmpt** | always -/// | **ftp** | strictCheck = true | **rtmpte** | always -/// | **ftps** | strictCheck = true | **rtp** | always -/// | **http** | always | **rtsp** | always -/// | **https**| always | **sdp** | always -/// | **mms** | always | **sftp** | strictCheck = true -/// | **mmsh** | always | **stack** | always -/// | **mmst** | always | **tcp** | always -/// | **rtmp** | always | **udp** | always -/// | **rtmpe**| always | | | -/// -/// @param[in] path To checked path/URL -/// @param[in] strictCheck [opt] If True the set of protocols used will be -/// extended to include ftp, ftps, dav, davs and sftp. -/// @return True if path is to a internet stream, false otherwise -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// // Check should return false -/// fprintf(stderr, "File name 1 is internet stream '%s' (should no)\n", -/// kodi::vfs::IsInternetStream("D:/my-file.mkv") ? "yes" : "no"); -/// -/// // Check should return true -/// fprintf(stderr, "File name 2 is internet stream '%s' (should yes)\n", -/// kodi::vfs::IsInternetStream("http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4") ? "yes" : "no"); -/// -/// // Check should return false -/// fprintf(stderr, "File name 1 is internet stream '%s' (should no)\n", -/// kodi::vfs::IsInternetStream("ftp://do-somewhere.com/the-file.mkv") ? "yes" : "no", false); -/// -/// // Check should return true -/// fprintf(stderr, "File name 1 is internet stream '%s' (should yes)\n", -/// kodi::vfs::IsInternetStream("ftp://do-somewhere.com/the-file.mkv") ? "yes" : "no", true); -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN IsInternetStream(const std::string& path, bool strictCheck = false) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->is_internet_stream( - CAddonBase::m_interface->toKodi->kodiBase, path.c_str(), strictCheck); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Checks whether the specified path refers to a local network. -/// -/// In difference to @ref IsHostOnLAN() include this more deeper checks where -/// also handle Kodi's special protocol and stacks. -/// -/// @param[in] path To checked path -/// @return True if path is on LAN, false otherwise -/// -/// @note Check includes @ref IsHostOnLAN() too. -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// // Check should return true -/// bool lan = kodi::vfs::IsOnLAN("smb://path/to/file"); -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN IsOnLAN(const std::string& path) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->is_on_lan( - CAddonBase::m_interface->toKodi->kodiBase, path.c_str()); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Checks specified path for external network. -/// -/// @param[in] path To checked path -/// @return True if path is remote, false otherwise -/// -/// @note This does not apply to the local network. -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// // Check should return true -/// bool remote = kodi::vfs::IsRemote("http://path/to/file"); -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN IsRemote(const std::string& path) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->is_remote( - CAddonBase::m_interface->toKodi->kodiBase, path.c_str()); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Checks whether the given path refers to the own system. -/// -/// @param[in] path To checked path -/// @return True if path is local, false otherwise -/// -inline bool ATTRIBUTE_HIDDEN IsLocal(const std::string& path) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->is_local( - CAddonBase::m_interface->toKodi->kodiBase, path.c_str()); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @ingroup cpp_kodi_vfs_General -/// @brief Checks specified path is a regular URL, e.g. "someprotocol://path/to/file" -/// -/// @return True if file item is URL, false otherwise -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// -/// bool isURL; -/// // Check should return true -/// isURL = kodi::vfs::IsURL("someprotocol://path/to/file"); -/// -/// // Check should return false -/// isURL = kodi::vfs::IsURL("/path/to/file"); -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN IsURL(const std::string& path) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->is_url( - CAddonBase::m_interface->toKodi->kodiBase, path.c_str()); -} -//-------------------------------------------------------------------------- - -//============================================================================ -/// @ingroup cpp_kodi_vfs_General -/// @brief To get HTTP header information. -/// -/// @param[in] url URL source of the data -/// @param[out] header The @ref cpp_kodi_vfs_Defs_HttpHeader -/// @return true if successfully done, otherwise false -/// -/// -/// ------------------------------------------------------------------------ -/// -/// @copydetails cpp_kodi_vfs_Defs_HttpHeader_Help -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// kodi::vfs::HttpHeader header; -/// bool ret = kodi::vfs::GetHttpHeader(url, header); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN GetHttpHeader(const std::string& url, HttpHeader& header) -{ - using namespace ::kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_filesystem->get_http_header( - CAddonBase::m_interface->toKodi->kodiBase, url.c_str(), &header.m_handle); -} -//---------------------------------------------------------------------------- - -//============================================================================ -/// @ingroup cpp_kodi_vfs_General -/// @brief Get file mime type. -/// -/// @param[in] url URL source of the data -/// @param[out] mimeType the mime type of the URL -/// @param[in] useragent to be used when retrieving the MimeType [opt] -/// @return true if successfully done, otherwise false -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string mimeType;. -/// if (kodi::vfs::GetMimeType(url, mimeType)) -/// fprintf(stderr, "The mime type is '%s'\n", mimeType.c_str()); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN GetMimeType(const std::string& url, - std::string& mimeType, - const std::string& useragent = "") -{ - using namespace ::kodi::addon; - - char* cMimeType = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_filesystem->get_mime_type( - CAddonBase::m_interface->toKodi->kodiBase, url.c_str(), &cMimeType, useragent.c_str()); - if (cMimeType != nullptr) - { - mimeType = cMimeType; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - cMimeType); - } - return ret; -} -//---------------------------------------------------------------------------- - -//============================================================================ -/// @ingroup cpp_kodi_vfs_General -/// @brief Get file content-type. -/// -/// @param[in] url URL source of the data -/// @param[out] content The returned type -/// @param[in] useragent to be used when retrieving the MimeType [opt] -/// @return true if successfully done, otherwise false -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string content;. -/// if (kodi::vfs::GetContentType(url, content)) -/// fprintf(stderr, "The content type is '%s'\n", content.c_str()); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN GetContentType(const std::string& url, - std::string& content, - const std::string& useragent = "") -{ - using namespace ::kodi::addon; - - char* cContent = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_filesystem->get_content_type( - CAddonBase::m_interface->toKodi->kodiBase, url.c_str(), &cContent, useragent.c_str()); - if (cContent != nullptr) - { - content = cContent; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - cContent); - } - return ret; -} -//---------------------------------------------------------------------------- - -//============================================================================ -/// @ingroup cpp_kodi_vfs_General -/// @brief Get cookies stored by CURL in RFC 2109 format. -/// -/// @param[in] url URL source of the data -/// @param[out] cookies The text list of available cookies -/// @return true if successfully done, otherwise false -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string url = ""; -/// std::string cookies; -/// bool ret = kodi::vfs::GetCookies(url, cookies); -/// fprintf(stderr, "Cookies from URL '%s' are '%s' (return was %s)\n", -/// url.c_str(), cookies.c_str(), ret ? "true" : "false"); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN GetCookies(const std::string& url, std::string& cookies) -{ - using namespace ::kodi::addon; - - char* cCookies = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_filesystem->get_cookies( - CAddonBase::m_interface->toKodi->kodiBase, url.c_str(), &cCookies); - if (cCookies != nullptr) - { - cookies = cCookies; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - cCookies); - } - return ret; -} -//---------------------------------------------------------------------------- - -//}}} - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" CFile class -//{{{ - -//============================================================================== -/// @defgroup cpp_kodi_vfs_CFile 4. class CFile -/// @ingroup cpp_kodi_vfs -/// -/// @brief **Creatable class for virtual file server control**\n -/// To perform file read/write with Kodi's filesystem parts. -/// -/// CFile is the class used for handling Files in Kodi. This class can be used -/// for creating, reading, writing and modifying files. It directly provides unbuffered, binary disk input/output services -/// -/// It has the header @ref Filesystem.h "#include " be included -/// to enjoy it. -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// ... -/// -/// /* Create the needed file handle class */ -/// kodi::vfs::CFile myFile(); -/// -/// /* In this example we use the user path for the add-on */ -/// std::string file = kodi::GetUserPath() + "/myFile.txt"; -/// -/// /* Now create and open the file or overwrite if present */ -/// myFile.OpenFileForWrite(file, true); -/// -/// const char* str = "I love Kodi!"; -/// -/// /* write string */ -/// myFile.Write(str, sizeof(str)); -/// -/// /* On this way the Close() is not needed to call, becomes done from destructor */ -/// -/// ~~~~~~~~~~~~~ -/// -//@{ -class ATTRIBUTE_HIDDEN CFile -{ -public: - //============================================================================ - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Construct a new, unopened file. - /// - CFile() = default; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_vfs_CFile - /// @brief `Close()` is called from the destructor, so explicitly - /// closing the file isn't required. - /// - virtual ~CFile() { Close(); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Open the file with filename via Kodi's @ref cpp_kodi_vfs_CFile - /// "CFile". Needs to be closed by calling Close() when done. - /// - /// @param[in] filename The filename to open. - /// @param[in] flags [opt] The flags to pass, see @ref OpenFileFlags - /// @return True on success or false on failure - /// - bool OpenFile(const std::string& filename, unsigned int flags = 0) - { - using namespace kodi::addon; - - Close(); - m_file = CAddonBase::m_interface->toKodi->kodi_filesystem->open_file( - CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), flags); - return m_file != nullptr; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Open the file with filename via Kodi's @ref cpp_kodi_vfs_CFile - /// "CFile" in write mode. Needs to be closed by calling Close() when - /// done. - /// - /// @note Related folders becomes created if not present. - /// - /// @param[in] filename The filename to open. - /// @param[in] overwrite True to overwrite, false otherwise. - /// @return True on success or false on failure - /// - bool OpenFileForWrite(const std::string& filename, bool overwrite = false) - { - using namespace kodi::addon; - - Close(); - - // Try to open the file. If it fails, check if we need to create the directory first - // This way we avoid checking if the directory exists every time - m_file = CAddonBase::m_interface->toKodi->kodi_filesystem->open_file_for_write( - CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), overwrite); - if (!m_file) - { - std::string cacheDirectory = kodi::vfs::GetDirectoryName(filename); - if (CAddonBase::m_interface->toKodi->kodi_filesystem->directory_exists( - CAddonBase::m_interface->toKodi->kodiBase, cacheDirectory.c_str()) || - CAddonBase::m_interface->toKodi->kodi_filesystem->create_directory( - CAddonBase::m_interface->toKodi->kodiBase, cacheDirectory.c_str())) - m_file = CAddonBase::m_interface->toKodi->kodi_filesystem->open_file_for_write( - CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), overwrite); - } - return m_file != nullptr; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Check file is opened. - /// - /// @return True on open or false on closed or failure - /// - bool IsOpen() const { return m_file != nullptr; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Close an open file. - /// - void Close() - { - using namespace kodi::addon; - - if (!m_file) - return; - CAddonBase::m_interface->toKodi->kodi_filesystem->close_file( - CAddonBase::m_interface->toKodi->kodiBase, m_file); - m_file = nullptr; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Create a Curl representation - /// - /// @param[in] url The URL of the Type. - /// @return True on success or false on failure - /// - bool CURLCreate(const std::string& url) - { - using namespace kodi::addon; - - m_file = CAddonBase::m_interface->toKodi->kodi_filesystem->curl_create( - CAddonBase::m_interface->toKodi->kodiBase, url.c_str()); - return m_file != nullptr; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Add options to the curl file created with CURLCreate. - /// - /// @param[in] type Option type to set, see @ref CURLOptiontype - /// @param[in] name Name of the option - /// @param[in] value Value of the option - /// @return True on success or false on failure - /// - bool CURLAddOption(CURLOptiontype type, const std::string& name, const std::string& value) - { - using namespace kodi::addon; - - if (!m_file) - { - kodi::Log(ADDON_LOG_ERROR, "kodi::vfs::CURLCreate(...) needed to call before!"); - return false; - } - return CAddonBase::m_interface->toKodi->kodi_filesystem->curl_add_option( - CAddonBase::m_interface->toKodi->kodiBase, m_file, type, name.c_str(), value.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Open the curl file created with CURLCreate. - /// - /// @param[in] flags [opt] The flags to pass, see @ref OpenFileFlags - /// @return True on success or false on failure - /// - bool CURLOpen(unsigned int flags = 0) - { - using namespace kodi::addon; - - if (!m_file) - { - kodi::Log(ADDON_LOG_ERROR, "kodi::vfs::CURLCreate(...) needed to call before!"); - return false; - } - return CAddonBase::m_interface->toKodi->kodi_filesystem->curl_open( - CAddonBase::m_interface->toKodi->kodiBase, m_file, flags); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Read from an open file. - /// - /// @param[in] ptr The buffer to store the data in. - /// @param[in] size 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 Read(void* ptr, size_t size) - { - using namespace kodi::addon; - - if (!m_file) - return -1; - return CAddonBase::m_interface->toKodi->kodi_filesystem->read_file( - CAddonBase::m_interface->toKodi->kodiBase, m_file, ptr, size); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Read a string from an open file. - /// - /// @param[out] line The buffer to store the data in. - /// @return True when a line was read, false otherwise. - /// - bool ReadLine(std::string& line) - { - using namespace kodi::addon; - - line.clear(); - if (!m_file) - return false; - // TODO: Read 1024 chars into buffer. If file position advanced that many - // chars, we didn't hit a newline. Otherwise, if file position is 1 or 2 - // past the number of bytes read, we read (and skipped) a newline sequence. - char buffer[1025]; - if (CAddonBase::m_interface->toKodi->kodi_filesystem->read_file_string( - CAddonBase::m_interface->toKodi->kodiBase, m_file, buffer, sizeof(buffer))) - { - line = buffer; - return !line.empty(); - } - return false; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Write to a file opened in write mode. - /// - /// @param[in] ptr Pointer to the data to write, converted to a `const void*`. - /// @param[in] size 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 Write(const void* ptr, size_t size) - { - using namespace kodi::addon; - - if (!m_file) - return -1; - return CAddonBase::m_interface->toKodi->kodi_filesystem->write_file( - CAddonBase::m_interface->toKodi->kodiBase, m_file, ptr, size); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Flush buffered data. - /// - /// If the given stream was open for writing (or if it was open for updating - /// and the last i/o operation was an output operation) any unwritten data - /// in its output buffer is written to the file. - /// - /// The stream remains open after this call. - /// - /// When a file is closed, either because of a call to close or because the - /// class is destructed, all the buffers associated with it are - /// automatically flushed. - /// - void Flush() - { - using namespace kodi::addon; - - if (!m_file) - return; - CAddonBase::m_interface->toKodi->kodi_filesystem->flush_file( - CAddonBase::m_interface->toKodi->kodiBase, m_file); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Set the file's current position. - /// - /// The whence argument is optional and defaults to SEEK_SET (0) - /// - /// @param[in] position the position that you want to seek to - /// @param[in] whence [optional] offset relative to You can set the value of - /// whence to one of three things: - /// | Value | int | Description | - /// |:--------:|:---:|:----------------------------------------------------| - /// | SEEK_SET | 0 | position is relative to the beginning of the file. This is probably what you had in mind anyway, and is the most commonly used value for whence. - /// | SEEK_CUR | 1 | position is relative to the current file pointer position. So, in effect, you can say, "Move to my current position plus 30 bytes," or, "move to my current position minus 20 bytes." - /// | SEEK_END | 2 | position is relative to the end of the file. Just like SEEK_SET except from the other end of the file. Be sure to use negative values for offset if you want to back up from the end of the file, instead of going past the end into oblivion. - /// - /// @return Returns the resulting offset location as measured in bytes from - /// the beginning of the file. On error, the value -1 is returned. - /// - int64_t Seek(int64_t position, int whence = SEEK_SET) - { - using namespace kodi::addon; - - if (!m_file) - return -1; - return CAddonBase::m_interface->toKodi->kodi_filesystem->seek_file( - CAddonBase::m_interface->toKodi->kodiBase, m_file, position, whence); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Truncate a file to the requested size. - /// - /// @param[in] size The new max size. - /// @return New size? On error, the value -1 is returned. - /// - int Truncate(int64_t size) - { - using namespace kodi::addon; - - if (!m_file) - return -1; - return CAddonBase::m_interface->toKodi->kodi_filesystem->truncate_file( - CAddonBase::m_interface->toKodi->kodiBase, m_file, size); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief The current offset in an open file. - /// - /// @return The requested offset. On error, the value -1 is returned. - /// - int64_t GetPosition() const - { - using namespace kodi::addon; - - if (!m_file) - return -1; - return CAddonBase::m_interface->toKodi->kodi_filesystem->get_file_position( - CAddonBase::m_interface->toKodi->kodiBase, m_file); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Get the file size of an open file. - /// - /// @return The requested size. On error, the value -1 is returned. - /// - int64_t GetLength() const - { - using namespace kodi::addon; - - if (!m_file) - return -1; - return CAddonBase::m_interface->toKodi->kodi_filesystem->get_file_length( - CAddonBase::m_interface->toKodi->kodiBase, m_file); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Checks the file access is on end position. - /// - /// @return If you've reached the end of the file, AtEnd() returns true. - /// - bool AtEnd() const - { - using namespace kodi::addon; - - if (!m_file) - return true; - int64_t length = CAddonBase::m_interface->toKodi->kodi_filesystem->get_file_length( - CAddonBase::m_interface->toKodi->kodiBase, m_file); - int64_t position = CAddonBase::m_interface->toKodi->kodi_filesystem->get_file_position( - CAddonBase::m_interface->toKodi->kodiBase, m_file); - return position >= length; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Get the chunk size for an open file. - /// - /// @return The requested size. On error, the value -1 is returned. - /// - int GetChunkSize() const - { - using namespace kodi::addon; - - if (!m_file) - return -1; - return CAddonBase::m_interface->toKodi->kodi_filesystem->get_file_chunk_size( - CAddonBase::m_interface->toKodi->kodiBase, m_file); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief To check seek possible on current stream by file. - /// - /// @return true if seek possible, false if not - /// - bool IoControlGetSeekPossible() const - { - using namespace kodi::addon; - - if (!m_file) - return false; - return CAddonBase::m_interface->toKodi->kodi_filesystem->io_control_get_seek_possible( - CAddonBase::m_interface->toKodi->kodiBase, m_file); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief To check a running stream on file for state of his cache. - /// - /// @param[in] status Information about current cache status - /// @return true if successfull done, false otherwise - /// - /// - /// @copydetails cpp_kodi_vfs_Defs_CacheStatus_Help - /// - bool IoControlGetCacheStatus(CacheStatus& status) const - { - using namespace kodi::addon; - - if (!m_file) - return false; - return CAddonBase::m_interface->toKodi->kodi_filesystem->io_control_get_cache_status( - CAddonBase::m_interface->toKodi->kodiBase, m_file, status); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Unsigned int with speed limit for caching in bytes per second. - /// - /// @param[in] rate Cache rate size to use - /// @return true if successfull done, false otherwise - /// - bool IoControlSetCacheRate(unsigned int rate) - { - using namespace kodi::addon; - - if (!m_file) - return false; - return CAddonBase::m_interface->toKodi->kodi_filesystem->io_control_set_cache_rate( - CAddonBase::m_interface->toKodi->kodiBase, m_file, rate); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Enable/disable retry within the protocol handler (if supported). - /// - /// @param[in] retry To set the retry, true for use, false for not - /// @return true if successfull done, false otherwise - /// - bool IoControlSetRetry(bool retry) - { - using namespace kodi::addon; - - if (!m_file) - return false; - return CAddonBase::m_interface->toKodi->kodi_filesystem->io_control_set_retry( - CAddonBase::m_interface->toKodi->kodiBase, m_file, retry); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Retrieve a file property. - /// - /// @param[in] type The type of the file property to retrieve the value for - /// @param[in] name The name of a named property value (e.g. Header) - /// @return value of requested property, empty on failure / non-existance - /// - const std::string GetPropertyValue(FilePropertyTypes type, const std::string& name) const - { - using namespace kodi::addon; - - if (!m_file) - { - kodi::Log(ADDON_LOG_ERROR, - "kodi::vfs::CURLCreate(...) needed to call before GetPropertyValue!"); - return ""; - } - std::vector values = GetPropertyValues(type, name); - if (values.empty()) - { - return ""; - } - return values[0]; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Retrieve file property values. - /// - /// @param[in] type The type of the file property values to retrieve the value for - /// @param[in] name The name of the named property (e.g. Header) - /// @return values of requested property, empty vector on failure / non-existance - /// - const std::vector GetPropertyValues(FilePropertyTypes type, - const std::string& name) const - { - using namespace kodi::addon; - - if (!m_file) - { - kodi::Log(ADDON_LOG_ERROR, - "kodi::vfs::CURLCreate(...) needed to call before GetPropertyValues!"); - return std::vector(); - } - int numValues = 0; - char** res(CAddonBase::m_interface->toKodi->kodi_filesystem->get_property_values( - CAddonBase::m_interface->toKodi->kodiBase, m_file, type, name.c_str(), &numValues)); - if (res) - { - std::vector vecReturn; - for (int i = 0; i < numValues; ++i) - { - vecReturn.emplace_back(res[i]); - } - CAddonBase::m_interface->toKodi->free_string_array(CAddonBase::m_interface->toKodi->kodiBase, - res, numValues); - return vecReturn; - } - return std::vector(); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_vfs_CFile - /// @brief Get the current download speed of file if loaded from web. - /// - /// @return The current download speed. - /// - double GetFileDownloadSpeed() const - { - using namespace kodi::addon; - - if (!m_file) - return 0.0; - return CAddonBase::m_interface->toKodi->kodi_filesystem->get_file_download_speed( - CAddonBase::m_interface->toKodi->kodiBase, m_file); - } - //-------------------------------------------------------------------------- - -private: - void* m_file = nullptr; -}; -//@} -//------------------------------------------------------------------------------ - -//}}} - -} /* namespace vfs */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h deleted file mode 100644 index 878eaa4..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h +++ /dev/null @@ -1,834 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "AddonBase.h" -#include "c-api/general.h" - -#ifdef __cplusplus - -//============================================================================== -/// \ingroup cpp_kodi_Defs -/// @brief For kodi::Version used structure -/// -typedef struct kodi_version_t -{ - /// Application name, normally 'Kodi' - std::string compile_name; - /// Major code version of Kodi - int major; - /// Minor code version of Kodi - int minor; - /// The Revision contains a id and the build date, e.g. 20170706-c6b22fe217-dirty - std::string revision; - /// The version canditate e.g. alpha, beta or release - std::string tag; - /// The revision of tag before - std::string tag_revision; -} kodi_version_t; -//------------------------------------------------------------------------------ - -namespace kodi -{ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief Returns the value of an addon property as a string -/// -/// @param[in] id id of the property that the module needs to access -/// | | Choices are | | -/// |:------------:|:------------:|:------------:| -/// | author | icon | stars | -/// | changelog | id | summary | -/// | description | name | type | -/// | disclaimer | path | version | -/// | fanart | profile | | -/// -/// @return AddOn property as a string -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string addonName = kodi::GetAddonInfo("name"); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN GetAddonInfo(const std::string& id) -{ - using namespace kodi::addon; - - AddonToKodiFuncTable_Addon* toKodi = CAddonBase::m_interface->toKodi; - - std::string strReturn; - char* strMsg = toKodi->kodi->get_addon_info(toKodi->kodiBase, id.c_str()); - if (strMsg != nullptr) - { - if (std::strlen(strMsg)) - strReturn = strMsg; - toKodi->free_string(toKodi->kodiBase, strMsg); - } - return strReturn; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief Opens this Add-Ons settings dialog. -/// -/// @return true if settings were changed and the dialog confirmed, false otherwise. -/// -/// -/// -------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// .. -/// kodi::OpenSettings(); -/// .. -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN OpenSettings() -{ - using namespace kodi::addon; - return CAddonBase::m_interface->toKodi->kodi->open_settings_dialog( - CAddonBase::m_interface->toKodi->kodiBase); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief Returns an addon's localized 'unicode string'. -/// -/// @param[in] labelId string you want to localize -/// @param[in] defaultStr [opt] The default message, also helps to identify -/// the code that is used (default is -/// empty) -/// @return The localized message, or default if the add-on -/// helper fails to return a message -/// -/// @note Label id's \b 30000 to \b 30999 and \b 32000 to \b 32999 are related -/// to the add-on's own included strings from -/// ./resources/language/resource.language.??_??/strings.po -/// All other strings are from Kodi core language files. -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string str = kodi::GetLocalizedString(30005, "Use me as default"); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN GetLocalizedString(uint32_t labelId, - const std::string& defaultStr = "") -{ - using namespace kodi::addon; - - std::string retString = defaultStr; - char* strMsg = CAddonBase::m_interface->toKodi->kodi->get_localized_string( - CAddonBase::m_interface->toKodi->kodiBase, labelId); - if (strMsg != nullptr) - { - if (std::strlen(strMsg)) - retString = strMsg; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, strMsg); - } - return retString; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief Translate a string with an unknown encoding to UTF8. -/// -/// @param[in] stringSrc The string to translate. -/// @param[out] utf8StringDst The translated string. -/// @param[in] failOnBadChar [opt] returns failed if bad character is inside (default is false) -/// @return true if OK -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string ret; -/// if (!kodi::UnknownToUTF8("test string", ret, true)) -/// fprintf(stderr, "Translation to UTF8 failed!\n"); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN UnknownToUTF8(const std::string& stringSrc, - std::string& utf8StringDst, - bool failOnBadChar = false) -{ - using namespace kodi::addon; - - bool ret = false; - char* retString = CAddonBase::m_interface->toKodi->kodi->unknown_to_utf8( - CAddonBase::m_interface->toKodi->kodiBase, stringSrc.c_str(), &ret, failOnBadChar); - if (retString != nullptr) - { - if (ret) - utf8StringDst = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - retString); - } - return ret; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief Returns the active language as a string. -/// -/// @param[in] format Used format of the returned language string -/// | enum code: | Description: | -/// |----------------------:|------------------------------------------------------------| -/// | LANG_FMT_ENGLISH_NAME | full language name in English (Default) | -/// | LANG_FMT_ISO_639_1 | two letter code as defined in ISO 639-1 | -/// | LANG_FMT_ISO_639_2 | three letter code as defined in ISO 639-2/T or ISO 639-2/B | -/// @param[in] region [opt] append the region delimited by "-" of the language (setting) to the returned language string (default is false) -/// @return active language -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string language = kodi::GetLanguage(LANG_FMT_ISO_639_1, false); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN GetLanguage(LangFormats format = LANG_FMT_ENGLISH_NAME, - bool region = false) -{ - using namespace kodi::addon; - - std::string language; - char* retString = CAddonBase::m_interface->toKodi->kodi->get_language( - CAddonBase::m_interface->toKodi->kodiBase, format, region); - if (retString != nullptr) - { - if (std::strlen(retString)) - language = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - retString); - } - return language; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief Writes the C string pointed by format in the GUI. If format includes -/// format specifiers (subsequences beginning with %), the additional arguments -/// following format are formatted and inserted in the resulting string replacing -/// their respective specifiers. -/// -/// After the format parameter, the function expects at least as many additional -/// arguments as specified by format. -/// -/// @param[in] type The message type. -/// | enum code: | Description: | -/// |---------------:|-----------------------------------| -/// | QUEUE_INFO | Show info notification message | -/// | QUEUE_WARNING | Show warning notification message | -/// | QUEUE_ERROR | Show error notification message | -/// @param[in] format The format of the message to pass to display in Kodi. -/// C string that contains the text to be written to the stream. -/// It can optionally contain embedded format specifiers that are -/// replaced by the values specified in subsequent additional -/// arguments and formatted as requested. -/// | specifier | Output | Example -/// |------------|----------------------------------------------------|------------ -/// | d or i | Signed decimal integer | 392 -/// | u | Unsigned decimal integer | 7235 -/// | o | Unsigned octal | 610 -/// | x | Unsigned hexadecimal integer | 7fa -/// | X | Unsigned hexadecimal integer (uppercase) | 7FA -/// | f | Decimal floating point, lowercase | 392.65 -/// | F | Decimal floating point, uppercase | 392.65 -/// | e | Scientific notation (mantissa/exponent), lowercase | 3.9265e+2 -/// | E | Scientific notation (mantissa/exponent), uppercase | 3.9265E+2 -/// | g | Use the shortest representation: %e or %f | 392.65 -/// | G | Use the shortest representation: %E or %F | 392.65 -/// | a | Hexadecimal floating point, lowercase | -0xc.90fep-2 -/// | A | Hexadecimal floating point, uppercase | -0XC.90FEP-2 -/// | c | Character | a -/// | s | String of characters | sample -/// | p | Pointer address | b8000000 -/// | % | A % followed by another % character will write a single % to the stream. | % -/// -/// The length sub-specifier modifies the length of the data type. This is a chart -/// showing the types used to interpret the corresponding arguments with and without -/// length specifier (if a different type is used, the proper type promotion or -/// conversion is performed, if allowed): -/// | length| d i | u o x X | f F e E g G a A | c | s | p | n | -/// |-------|---------------|-----------------------|-----------------|-------|---------|---------|-----------------| -/// | (none)| int | unsigned int | double | int | char* | void* | int* | -/// | hh | signed char | unsigned char | | | | | signed char* | -/// | h | short int | unsigned short int | | | | | short int* | -/// | l | long int | unsigned long int | | wint_t| wchar_t*| | long int* | -/// | ll | long long int | unsigned long long int| | | | | long long int* | -/// | j | intmax_t | uintmax_t | | | | | intmax_t* | -/// | z | size_t | size_t | | | | | size_t* | -/// | t | ptrdiff_t | ptrdiff_t | | | | | ptrdiff_t* | -/// | L | | | long double | | | | | -/// Note: that the c specifier takes an int (or wint_t) as argument, but performs the proper conversion to a char value -/// (or a wchar_t) before formatting it for output. -/// @param[in] ... (additional arguments) Depending on the format string, the function -/// may expect a sequence of additional arguments, each containing a value -/// to be used to replace a format specifier in the format string (or a pointer -/// to a storage location, for n). -/// There should be at least as many of these arguments as the number of values specified -/// in the format specifiers. Additional arguments are ignored by the function. -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// kodi::QueueFormattedNotification(QUEUE_WARNING, "I'm want to inform you, here with a test call to show '%s'", "this"); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline void ATTRIBUTE_HIDDEN QueueFormattedNotification(QueueMsg type, const char* format, ...) -{ - using namespace kodi::addon; - - va_list args; - char buffer[16384]; - va_start(args, format); - vsprintf(buffer, format, args); - va_end(args); - CAddonBase::m_interface->toKodi->kodi->queue_notification( - CAddonBase::m_interface->toKodi->kodiBase, type, "", buffer, "", 5000, false, 1000); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief Queue a notification in the GUI. -/// -/// @param[in] type The message type. -/// | enum code: | Description: -/// |----------------------:|----------------------------------- -/// | QUEUE_INFO | Show info notification message -/// | QUEUE_WARNING | Show warning notification message -/// | QUEUE_ERROR | Show error notification message -/// | QUEUE_OWN_STYLE | If used can be with imageFile the wanted image set or if leaved empty shown as info, also are the other optional values available then -/// @param[in] header Header Name (if leaved empty becomes addon name used) -/// @param[in] message Message to display on Kodi -/// @param[in] imageFile [opt] The image file to show on message (to use must be type set to QUEUE_OWN_STYLE) -/// @param[in] displayTime [opt] The time how long message is displayed (default 5 sec) (to use must be type set to QUEUE_OWN_STYLE) -/// @param[in] withSound [opt] if true also warning sound becomes played (default with sound) (to use must be type set to QUEUE_OWN_STYLE) -/// @param[in] messageTime [opt] how many milli seconds start show of notification (default 1 sec) (to use must be type set to QUEUE_OWN_STYLE) -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// kodi::QueueNotification(QUEUE_OWN_STYLE, "I'm want to inform you", "Here with a test call", "", 3000, false, 1000); -/// ... -/// ~~~~~~~~~~~~~ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// kodi::QueueNotification(QUEUE_WARNING, "I'm want to inform you", "Here with a test call"); -/// ... -/// ~~~~~~~~~~~~~ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// kodi::QueueNotification(QUEUE_OWN_STYLE, "", "Here with a test call", "./myImage.png"); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline void ATTRIBUTE_HIDDEN QueueNotification(QueueMsg type, - const std::string& header, - const std::string& message, - const std::string& imageFile = "", - unsigned int displayTime = 5000, - bool withSound = true, - unsigned int messageTime = 1000) -{ - using namespace kodi::addon; - - CAddonBase::m_interface->toKodi->kodi->queue_notification( - CAddonBase::m_interface->toKodi->kodiBase, type, header.c_str(), message.c_str(), - imageFile.c_str(), displayTime, withSound, messageTime); -} -//------------------------------------------------------------------------------ - -//============================================================================ -/// \ingroup cpp_kodi -/// @brief Get the MD5 digest of the given text -/// -/// @param[in] text text to compute the MD5 for -/// @return Returned MD5 digest -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string md5 = kodi::GetMD5("Make me as md5"); -/// fprintf(stderr, "My md5 digest is: '%s'\n", md5.c_str()); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN GetMD5(const std::string& text) -{ - using namespace kodi::addon; - - char* md5ret = static_cast(malloc(40 * sizeof(char))); // md5 size normally 32 bytes - CAddonBase::m_interface->toKodi->kodi->get_md5(CAddonBase::m_interface->toKodi->kodiBase, - text.c_str(), md5ret); - std::string md5 = md5ret; - free(md5ret); - return md5; -} -//---------------------------------------------------------------------------- - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief To get a temporary path for the addon -/// -/// This gives a temporary path which the addon can use individually for its things. -/// -/// The content of this folder will be deleted when Kodi is finished! -/// -/// @param[in] append A string to append to returned temporary path -/// @return Individual path for the addon -/// -inline std::string ATTRIBUTE_HIDDEN GetTempAddonPath(const std::string& append = "") -{ - using namespace kodi::addon; - - char* str = CAddonBase::m_interface->toKodi->kodi->get_temp_path( - CAddonBase::m_interface->toKodi->kodiBase); - std::string ret = str; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, str); - if (!append.empty()) - { - if (append.at(0) != '\\' && append.at(0) != '/') -#ifdef TARGET_WINDOWS - ret.append("\\"); -#else - ret.append("/"); -#endif - ret.append(append); - } - return ret; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief Returns your regions setting as a string for the specified id -/// -/// @param[in] id id of setting to return -/// | | Choices are | | -/// |:------------:|:------------:|:------------:| -/// | dateshort | time | tempunit | -/// | datelong | meridiem | speedunit | -/// -/// @return settings string -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string timeFormat = kodi::GetRegion("time"); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN GetRegion(const std::string& id) -{ - using namespace kodi::addon; - - AddonToKodiFuncTable_Addon* toKodi = CAddonBase::m_interface->toKodi; - - std::string strReturn; - char* strMsg = toKodi->kodi->get_region(toKodi->kodiBase, id.c_str()); - if (strMsg != nullptr) - { - if (std::strlen(strMsg)) - strReturn = strMsg; - toKodi->free_string(toKodi->kodiBase, strMsg); - } - return strReturn; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief Returns the amount of free memory in MByte (or as bytes) as an long -/// integer -/// -/// @param[out] free free memory -/// @param[out] total total memory -/// @param[in] asBytes [opt] if set to true becomes returned as bytes, otherwise -/// as mega bytes -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// long freeMem; -/// long totalMem; -/// kodi::GetFreeMem(freeMem, totalMem); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline void ATTRIBUTE_HIDDEN GetFreeMem(long& free, long& total, bool asBytes = false) -{ - using namespace kodi::addon; - - free = -1; - total = -1; - AddonToKodiFuncTable_Addon* toKodi = CAddonBase::m_interface->toKodi; - toKodi->kodi->get_free_mem(toKodi->kodiBase, &free, &total, asBytes); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief Returns the elapsed idle time in seconds as an integer -/// -/// @return idle time -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// int time = kodi::GetGlobalIdleTime(); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline int ATTRIBUTE_HIDDEN GetGlobalIdleTime() -{ - using namespace kodi::addon; - - AddonToKodiFuncTable_Addon* toKodi = CAddonBase::m_interface->toKodi; - return toKodi->kodi->get_global_idle_time(toKodi->kodiBase); -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief Get the currently used skin identification name from Kodi -/// -/// @return The active skin id name as a string -/// -/// -/// @note This is not the full path like 'special://home/addons/MediaCenter', -/// but only 'MediaCenter'. -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// .. -/// std::string skinid = kodi::GetCurrentSkinId(); -/// .. -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN GetCurrentSkinId() -{ - using namespace kodi::addon; - - AddonToKodiFuncTable_Addon* toKodi = CAddonBase::m_interface->toKodi; - - std::string strReturn; - char* strMsg = toKodi->kodi->get_current_skin_id(toKodi->kodiBase); - if (strMsg != nullptr) - { - if (std::strlen(strMsg)) - strReturn = strMsg; - toKodi->free_string(toKodi->kodiBase, strMsg); - } - return strReturn; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief To check another addon is available and usable inside Kodi. -/// -/// @param[in] id The wanted addon identification string to check -/// @param[out] version Version string of addon if **installed** inside Kodi -/// @param[out] enabled Set to true `true* if addon is enabled -/// @return Returns `true* if addon is installed -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// bool enabled = false; -/// std::string version; -/// bool ret = kodi::IsAddonAvailable("inputstream.adaptive", version, enabled); -/// fprintf(stderr, "Available inputstream.adaptive version '%s' and enabled '%s'\n", -/// ret ? version.c_str() : "not installed", enabled ? "yes" : "no"); -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN IsAddonAvailable(const std::string& id, - std::string& version, - bool& enabled) -{ - using namespace kodi::addon; - - AddonToKodiFuncTable_Addon* toKodi = CAddonBase::m_interface->toKodi; - - char* cVersion = nullptr; - bool ret = toKodi->kodi->is_addon_avilable(toKodi->kodiBase, id.c_str(), &cVersion, &enabled); - if (cVersion) - { - version = cVersion; - toKodi->free_string(toKodi->kodiBase, cVersion); - } - return ret; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief Get current Kodi informations and versions, returned data from the following -/// kodi_version_t version; kodi::KodiVersion(version); -/// is e.g.: -/// ~~~~~~~~~~~~~{.cpp} -/// version.compile_name = Kodi -/// version.major = 18 -/// version.minor = 0 -/// version.revision = 20170706-c6b22fe217-di -/// version.tag = alpha -/// version.tag_revision = 1 -/// ~~~~~~~~~~~~~ -/// -/// @param[out] version structure to store data from kodi -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// kodi_version_t version; -/// kodi::KodiVersion(version); -/// fprintf(stderr, -/// "kodi_version_t version;\n" -/// "kodi::KodiVersion(version);\n" -/// " - version.compile_name = %s\n" -/// " - version.major = %i\n" -/// " - version.minor = %i\n" -/// " - version.revision = %s\n" -/// " - version.tag = %s\n" -/// " - version.tag_revision = %s\n", -/// version.compile_name.c_str(), version.major, version.minor, -/// version.revision.c_str(), version.tag.c_str(), version.tag_revision.c_str()); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline void ATTRIBUTE_HIDDEN KodiVersion(kodi_version_t& version) -{ - using namespace kodi::addon; - - char* compile_name = nullptr; - char* revision = nullptr; - char* tag = nullptr; - char* tag_revision = nullptr; - - AddonToKodiFuncTable_Addon* toKodi = CAddonBase::m_interface->toKodi; - toKodi->kodi->kodi_version(toKodi->kodiBase, &compile_name, &version.major, &version.minor, - &revision, &tag, &tag_revision); - if (compile_name != nullptr) - { - version.compile_name = compile_name; - toKodi->free_string(toKodi->kodiBase, compile_name); - } - if (revision != nullptr) - { - version.revision = revision; - toKodi->free_string(toKodi->kodiBase, revision); - } - if (tag != nullptr) - { - version.tag = tag; - toKodi->free_string(toKodi->kodiBase, tag); - } - if (tag_revision != nullptr) - { - version.tag_revision = tag_revision; - toKodi->free_string(toKodi->kodiBase, tag_revision); - } -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief To get keyboard layout characters -/// -/// This is used to get the keyboard layout currently used from Kodi by the -/// there set language. -/// -/// @param[in] modifierKey the key to define the needed layout (uppercase, symbols...) -/// @param[out] layout_name name of used layout -/// @param[out] layout list of selected keyboard layout -/// @return true if request successed -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string layout_name; -/// std::vector> layout; -/// kodi::GetKeyboardLayout(STD_KB_MODIFIER_KEY_SHIFT | STD_KB_MODIFIER_KEY_SYMBOL, layout_name, layout); -/// fprintf(stderr, "Layout: '%s'\n", layout_name.c_str()); -/// for (unsigned int row = 0; row < STD_KB_BUTTONS_MAX_ROWS; row++) -/// { -/// for (unsigned int column = 0; column < STD_KB_BUTTONS_PER_ROW; column++) -/// { -/// fprintf(stderr, " - Row: '%02i'; Column: '%02i'; Text: '%s'\n", row, column, layout[row][column].c_str()); -/// } -/// } -/// ... -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN GetKeyboardLayout(int modifierKey, - std::string& layout_name, - std::vector>& layout) -{ - using namespace kodi::addon; - - AddonToKodiFuncTable_Addon* toKodi = CAddonBase::m_interface->toKodi; - AddonKeyboardKeyTable c_layout; - char* c_layout_name = nullptr; - bool ret = - toKodi->kodi->get_keyboard_layout(toKodi->kodiBase, &c_layout_name, modifierKey, &c_layout); - if (ret) - { - if (c_layout_name) - { - layout_name = c_layout_name; - toKodi->free_string(toKodi->kodiBase, c_layout_name); - } - - layout.resize(STD_KB_BUTTONS_MAX_ROWS); - for (unsigned int row = 0; row < STD_KB_BUTTONS_MAX_ROWS; row++) - { - layout[row].resize(STD_KB_BUTTONS_PER_ROW); - for (unsigned int column = 0; column < STD_KB_BUTTONS_PER_ROW; column++) - { - char* button = c_layout.keys[row][column]; - if (button) - { - layout[row][column] = button; - toKodi->free_string(toKodi->kodiBase, button); - } - } - } - } - return ret; -} -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi -/// @brief To change keyboard layout characters -/// -/// This is used to change the keyboard layout currently used from Kodi -/// -/// @param[out] layout_name new name of used layout (input string not used!) -/// @return true if request successed -/// -/// @note \ref GetKeyboardLayout must be called afterwards. -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string layout_name; -/// kodi::ChangeKeyboardLayout(layout_name); -/// -/// std::vector> layout; -/// kodi::GetKeyboardLayout(STD_KB_MODIFIER_KEY_SHIFT | STD_KB_MODIFIER_KEY_SYMBOL, layout_name, layout); -/// fprintf(stderr, "Layout: '%s'\n", layout_name.c_str()); -/// for (unsigned int row = 0; row < STD_KB_BUTTONS_MAX_ROWS; row++) -/// { -/// for (unsigned int column = 0; column < STD_KB_BUTTONS_PER_ROW; column++) -/// { -/// fprintf(stderr, " - Row: '%02i'; Column: '%02i'; Text: '%s'\n", row, column, layout[row][column].c_str()); -/// } -/// } -/// ... -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN ChangeKeyboardLayout(std::string& layout_name) -{ - using namespace kodi::addon; - - AddonToKodiFuncTable_Addon* toKodi = CAddonBase::m_interface->toKodi; - char* c_layout_name = nullptr; - bool ret = toKodi->kodi->change_keyboard_layout(toKodi->kodiBase, &c_layout_name); - if (c_layout_name) - { - layout_name = c_layout_name; - toKodi->free_string(toKodi->kodiBase, c_layout_name); - } - - return ret; -} -//------------------------------------------------------------------------------ - -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/Network.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/Network.h deleted file mode 100644 index 910385f..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/Network.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "AddonBase.h" -#include "c-api/network.h" - -#ifdef __cplusplus - -//============================================================================== -/// @defgroup cpp_kodi_network Interface - kodi::network -/// @ingroup cpp -/// @brief **Network functions**\n -/// The network module offers functions that allow you to control it. -/// -/// It has the header @ref Network.h "#include " be included -/// to enjoy it. -/// -//------------------------------------------------------------------------------ - -namespace kodi -{ -namespace network -{ - -//============================================================================ -/// @ingroup cpp_kodi_network -/// @brief Send WakeOnLan magic packet. -/// -/// @param[in] mac Network address of the host to wake. -/// @return True if the magic packet was successfully sent, false otherwise. -/// -inline bool ATTRIBUTE_HIDDEN WakeOnLan(const std::string& mac) -{ - using namespace ::kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_network->wake_on_lan( - CAddonBase::m_interface->toKodi->kodiBase, mac.c_str()); -} -//---------------------------------------------------------------------------- - -//============================================================================ -/// @ingroup cpp_kodi_network -/// @brief To the current own ip address as a string. -/// -/// @return Own system ip. -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string ipAddress = kodi::network::GetIPAddress(); -/// fprintf(stderr, "My IP is '%s'\n", ipAddress.c_str()); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN GetIPAddress() -{ - using namespace ::kodi::addon; - - std::string ip; - char* string = CAddonBase::m_interface->toKodi->kodi_network->get_ip_address( - CAddonBase::m_interface->toKodi->kodiBase); - if (string != nullptr) - { - ip = string; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, string); - } - return ip; -} -//---------------------------------------------------------------------------- - -//============================================================================ -/// @ingroup cpp_kodi_network -/// @brief Return our hostname. -/// -/// @return String about hostname, empty in case of error -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string hostname = kodi::network::GetHostname(); -/// fprintf(stderr, "My hostname is '%s'\n", hostname.c_str()); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline std::string ATTRIBUTE_HIDDEN GetHostname() -{ - using namespace ::kodi::addon; - - std::string ip; - char* string = CAddonBase::m_interface->toKodi->kodi_network->get_hostname( - CAddonBase::m_interface->toKodi->kodiBase); - if (string != nullptr) - { - ip = string; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, string); - } - return ip; -} -//---------------------------------------------------------------------------- - -//============================================================================ -/// @ingroup cpp_kodi_network -/// @brief Returns Kodi's HTTP UserAgent string. -/// -/// @return HTTP user agent -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.py} -/// .. -/// std::string agent = kodi::network::GetUserAgent() -/// .. -/// ~~~~~~~~~~~~~ -/// -/// example output: -/// Kodi/19.0-ALPHA1 (X11; Linux x86_64) Ubuntu/20.04 App_Bitness/64 Version/19.0-ALPHA1-Git:20200522-0076d136d3-dirty -/// -inline std::string ATTRIBUTE_HIDDEN GetUserAgent() -{ - using namespace ::kodi::addon; - - std::string agent; - char* string = CAddonBase::m_interface->toKodi->kodi_network->get_user_agent( - CAddonBase::m_interface->toKodi->kodiBase); - if (string != nullptr) - { - agent = string; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, string); - } - return agent; -} -//---------------------------------------------------------------------------- - -//============================================================================ -/// @ingroup cpp_kodi_network -/// @brief Check given name or ip address corresponds to localhost. -/// -/// @param[in] hostname Hostname to check -/// @return Return true if given name or ip address corresponds to localhost -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// if (kodi::network::IsLocalHost("127.0.0.1")) -/// fprintf(stderr, "Is localhost\n"); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN IsLocalHost(const std::string& hostname) -{ - using namespace ::kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_network->is_local_host( - CAddonBase::m_interface->toKodi->kodiBase, hostname.c_str()); -} -//---------------------------------------------------------------------------- - -//============================================================================== -/// @ingroup cpp_kodi_network -/// @brief Checks whether the specified path refers to a local network. -/// -/// @param[in] hostname Hostname to check -/// @param[in] offLineCheck Check if in private range, see https://en.wikipedia.org/wiki/Private_network -/// @return True if host is on a LAN, false otherwise -/// -inline bool ATTRIBUTE_HIDDEN IsHostOnLAN(const std::string& hostname, bool offLineCheck = false) -{ - using namespace kodi::addon; - - return CAddonBase::m_interface->toKodi->kodi_network->is_host_on_lan( - CAddonBase::m_interface->toKodi->kodiBase, hostname.c_str(), offLineCheck); -} -//------------------------------------------------------------------------------ - -//============================================================================ -/// @ingroup cpp_kodi_network -/// @brief URL encodes the given string -/// -/// This function converts the given input string to a URL encoded string and -/// returns that as a new allocated string. All input characters that are -/// not a-z, A-Z, 0-9, '-', '.', '_' or '~' are converted to their "URL escaped" -/// version (%NN where NN is a two-digit hexadecimal number). -/// -/// @param[in] url The code of the message to get. -/// @return Encoded URL string -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string encodedUrl = kodi::network::URLEncode("François"); -/// fprintf(stderr, "Encoded URL is '%s'\n", encodedUrl.c_str()); -/// ... -/// ~~~~~~~~~~~~~ -/// For example, the string: François ,would be encoded as: Fran%C3%A7ois -/// -inline std::string ATTRIBUTE_HIDDEN URLEncode(const std::string& url) -{ - using namespace ::kodi::addon; - - std::string retString; - char* string = CAddonBase::m_interface->toKodi->kodi_network->url_encode( - CAddonBase::m_interface->toKodi->kodiBase, url.c_str()); - if (string != nullptr) - { - retString = string; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, string); - } - return retString; -} -//---------------------------------------------------------------------------- - -//============================================================================ -/// @ingroup cpp_kodi_network -/// @brief Lookup URL in DNS cache -/// -/// This test will get DNS record for a domain. The DNS lookup is done directly -/// against the domain's authoritative name server, so changes to DNS Records -/// should show up instantly. By default, the DNS lookup tool will return an -/// IP address if you give it a name (e.g. www.example.com) -/// -/// @param[in] hostName The code of the message to get. -/// @param[out] ipAddress Returned address -/// @return true if successfull -/// -/// -/// ------------------------------------------------------------------------ -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// ... -/// std::string ipAddress; -/// bool ret = kodi::network::DNSLookup("www.google.com", ipAddress); -/// fprintf(stderr, "DNSLookup returned for www.google.com the IP '%s', call was %s\n", ipAddress.c_str(), ret ? "ok" : "failed"); -/// ... -/// ~~~~~~~~~~~~~ -/// -inline bool ATTRIBUTE_HIDDEN DNSLookup(const std::string& hostName, std::string& ipAddress) -{ - using namespace ::kodi::addon; - - bool ret = false; - char* string = CAddonBase::m_interface->toKodi->kodi_network->dns_lookup( - CAddonBase::m_interface->toKodi->kodiBase, hostName.c_str(), &ret); - if (string != nullptr) - { - ipAddress = string; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, string); - } - return ret; -} -//---------------------------------------------------------------------------- - -} /* namespace network */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCodec.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCodec.h deleted file mode 100644 index e030371..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCodec.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2017-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //============================================================================== - /// @ingroup cpp_kodi_addon_videocodec_Defs_VIDEOCODEC_INITDATA - /// @brief The standard defines several sets of capabilities, which are referred - /// to as profiles, targeting specific classes of applications. - //@{ - enum STREAMCODEC_PROFILE - { - /// @brief Unknown codec profile - CodecProfileUnknown = 0, - - /// @brief If a codec profile is not required - CodecProfileNotNeeded, - - /// @brief **H264** Baseline Profile (BP, 66) - /// - /// Primarily for low-cost applications that require additional data loss - /// robustness, this profile is used in some videoconferencing and mobile - /// applications. This profile includes all features that are supported - /// in the Constrained Baseline Profile, plus three additional features - /// that can be used for loss robustness (or for other purposes such as - /// low-delay multi-point video stream compositing). The importance of - /// this profile has faded somewhat since the definition of the Constrained - /// Baseline Profile in 2009. All Constrained Baseline Profile bitstreams - /// are also considered to be Baseline Profile bitstreams, as these two - /// profiles share the same profile identifier code value. - H264CodecProfileBaseline, - - /// @brief **H264** Main Profile (MP, 77) - /// - /// This profile is used for standard-definition digital TV broadcasts that - /// use the MPEG-4 format as defined in the - /// [DVB standard](http://www.etsi.org/deliver/etsi_ts/101100_101199/101154/01.09.01_60/ts_101154v010901p.pdf). - /// It is not, however, used for high-definition television broadcasts, as the - /// importance of this profile faded when the High Profile was developed - /// in 2004 for that application. - H264CodecProfileMain, - - /// @brief **H264** Extended Profile (XP, 88) - /// - /// Intended as the streaming video profile, this profile has relatively high - /// compression capability and some extra tricks for robustness to data losses - /// and server stream switching. - H264CodecProfileExtended, - - /// @brief **H264** High Profile (HiP, 100) - /// - /// The primary profile for broadcast and disc storage applications, - /// particularly for high-definition television applications (for example, - /// this is the profile adopted by the [Blu-ray Disc](https://en.wikipedia.org/wiki/Blu-ray_Disc) - /// storage format and the [DVB](https://en.wikipedia.org/wiki/Digital_Video_Broadcasting) - /// HDTV broadcast service). - H264CodecProfileHigh, - - /// @brief **H264** High 10 Profile (Hi10P, 110) - /// - /// Going beyond typical mainstream consumer product capabilities, this - /// profile builds on top of the High Profile, adding support for up to 10 - /// bits per sample of decoded picture precision. - H264CodecProfileHigh10, - - /// @brief **H264** High 4:2:2 Profile (Hi422P, 122) - /// - /// Primarily targeting professional applications that use interlaced video, - /// this profile builds on top of the High 10 Profile, adding support for the - /// 4:2:2 chroma sampling format while using up to 10 bits per sample of - /// decoded picture precision. - H264CodecProfileHigh422, - - /// @brief **H264** High 4:4:4 Predictive Profile (Hi444PP, 244) - /// - /// This profile builds on top of the High 4:2:2 Profile, supporting up to - /// 4:4:4 chroma sampling, up to 14 bits per sample, and additionally - /// supporting efficient lossless region coding and the coding of each - /// picture as three separate color planes. - H264CodecProfileHigh444Predictive, - - /// @brief **VP9** profile 0 - /// - /// There are several variants of the VP9 format (known as "coding profiles"), - /// which successively allow more features; profile 0 is the basic variant, - /// requiring the least from a hardware implementation. - /// - /// [Color depth](https://en.wikipedia.org/wiki/Color_depth): 8 bit/sample, - /// [chroma subsampling](https://en.wikipedia.org/wiki/Chroma_subsampling): 4:2:0 - VP9CodecProfile0 = 20, - - /// @brief **VP9** profile 1 - /// - /// [Color depth](https://en.wikipedia.org/wiki/Color_depth): 8 bit, - /// [chroma subsampling](https://en.wikipedia.org/wiki/Chroma_subsampling): 4:2:0, 4:2:2, 4:4:4 - VP9CodecProfile1, - - /// @brief **VP9** profile 2 - /// - /// [Color depth](https://en.wikipedia.org/wiki/Color_depth): 10–12 bit, - /// [chroma subsampling](https://en.wikipedia.org/wiki/Chroma_subsampling): 4:2:0 - VP9CodecProfile2, - - /// @brief **VP9** profile 3 - /// - /// [Color depth](https://en.wikipedia.org/wiki/Color_depth): 10–12 bit, - /// [chroma subsampling](https://en.wikipedia.org/wiki/Chroma_subsampling): 4:2:0, 4:2:2, 4:4:4, - /// see [VP9 Bitstream & Decoding Process Specification](https://storage.googleapis.com/downloads.webmproject.org/docs/vp9/vp9-bitstream-specification-v0.6-20160331-draft.pdf) - VP9CodecProfile3, - }; - //@} - //------------------------------------------------------------------------------ - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCrypto.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCrypto.h deleted file mode 100644 index 8008aa1..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCrypto.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2017-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include -#include - -#define STREAMCRYPTO_VERSION_LEVEL 1 - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - typedef struct CRYPTO_INFO - { - enum CRYPTO_KEY_SYSTEM : uint8_t - { - CRYPTO_KEY_SYSTEM_NONE = 0, - CRYPTO_KEY_SYSTEM_WIDEVINE, - CRYPTO_KEY_SYSTEM_PLAYREADY, - CRYPTO_KEY_SYSTEM_WISEPLAY, - CRYPTO_KEY_SYSTEM_COUNT - } m_CryptoKeySystem; /*!< @brief keysystem for encrypted media, KEY_SYSTEM_NONE for unencrypted media */ - - static const uint8_t FLAG_SECURE_DECODER = - 1; /*!< @brief is set in flags if decoding has to be done in TEE environment */ - - uint8_t flags; - uint16_t m_CryptoSessionIdSize; /*!< @brief The size of the crypto session key id */ - const char* m_CryptoSessionId; /*!< @brief The crypto session key id */ - } CRYPTO_INFO; - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDecoder.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDecoder.h deleted file mode 100644 index 25e39e2..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDecoder.h +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../AddonBase.h" -#ifdef BUILD_KODI_ADDON -#include "../AEChannelData.h" -#else -#include "cores/AudioEngine/Utils/AEChannelData.h" -#endif -#include - -namespace kodi -{ -namespace addon -{ - class CInstanceAudioDecoder; -} /* namespace addon */ -} /* namespace kodi */ - -extern "C" -{ - -typedef struct AddonProps_AudioDecoder -{ - int dummy; -} AddonProps_AudioDecoder; - -typedef struct AddonToKodiFuncTable_AudioDecoder -{ - void* kodiInstance; -} AddonToKodiFuncTable_AudioDecoder; - -struct AddonInstance_AudioDecoder; -typedef struct KodiToAddonFuncTable_AudioDecoder -{ - kodi::addon::CInstanceAudioDecoder* addonInstance; - bool (__cdecl* init)(const AddonInstance_AudioDecoder* instance, - const char* file, unsigned int filecache, - int* channels, int* samplerate, - int* bitspersample, int64_t* totaltime, - int* bitrate, AEDataFormat* format, - const AEChannel** info); - int (__cdecl* read_pcm)(const AddonInstance_AudioDecoder* instance, uint8_t* buffer, int size, int* actualsize); - int64_t (__cdecl* seek)(const AddonInstance_AudioDecoder* instance, int64_t time); - bool (__cdecl* read_tag)(const AddonInstance_AudioDecoder* instance, - const char* file, char* title, - char* artist, int* length); - int (__cdecl* track_count)(const AddonInstance_AudioDecoder* instance, const char* file); -} KodiToAddonFuncTable_AudioDecoder; - -typedef struct AddonInstance_AudioDecoder -{ - AddonProps_AudioDecoder props; - AddonToKodiFuncTable_AudioDecoder toKodi; - KodiToAddonFuncTable_AudioDecoder toAddon; -} AddonInstance_AudioDecoder; - -} /* extern "C" */ - -namespace kodi -{ -namespace addon -{ - -//============================================================================== -/// -/// \addtogroup cpp_kodi_addon_audiodecoder -/// @brief \cpp_class{ kodi::addon::CInstanceAudioDecoder } -/// **Audio decoder add-on instance** -/// -/// For audio decoders as binary add-ons. This class implements a way to handle -/// special types of audio files. -/// -/// The add-on handles loading of the source file and outputting the audio stream -/// for consumption by the player. -/// -/// The addon.xml defines the capabilities of this add-on. -/// -/// @note The option to have multiple instances is possible with audio-decoder -/// add-ons. This is useful, since some playback engines are riddled by global -/// variables, making decoding of multiple streams using the same instance -/// impossible. -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Here's an example on addon.xml:** -/// ~~~~~~~~~~~~~{.xml} -/// -/// ~~~~~~~~~~~~~ -/// -/// Description to audio decoder related addon.xml values: -/// | Name | Description -/// |:------------------------------|---------------------------------------- -/// | `point` | Addon type specification
At all addon types and for this kind always "kodi.audiodecoder". -/// | `library_@PLATFORM@` | Sets the used library name, which is automatically set by cmake at addon build. -/// | `name` | The name of the decoder used in Kodi for display. -/// | `extension` | The file extensions / styles supported by this addon. -/// | `tags` | Boolean to point out that addon can bring own information to replayed file, if `false` only the file name is used as info.
If `true`, \ref CInstanceAudioDecoder::ReadTag is used and must be implemented. -/// -/// -------------------------------------------------------------------------- -/// -/// **Here is a code example how this addon is used:** -/// -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// class CMyAudioDecoder : public ::kodi::addon::CInstanceAudioDecoder -/// { -/// public: -/// CMyAudioDecoder(KODI_HANDLE instance); -/// -/// bool Init(const std::string& filename, unsigned int filecache, -/// int& channels, int& samplerate, -/// int& bitspersample, int64_t& totaltime, -/// int& bitrate, AEDataFormat& format, -/// std::vector& channellist) override; -/// int ReadPCM(uint8_t* buffer, int size, int& actualsize) override; -/// }; -/// -/// CMyAudioDecoder::CMyAudioDecoder(KODI_HANDLE instance) -/// : CInstanceAudioDecoder(instance) -/// { -/// ... -/// } -/// -/// bool CMyAudioDecoder::Init(const std::string& filename, unsigned int filecache, -/// int& channels, int& samplerate, -/// int& bitspersample, int64_t& totaltime, -/// int& bitrate, AEDataFormat& format, -/// std::vector& channellist) -/// { -/// ... -/// return true; -/// } -/// -/// int CMyAudioDecoder::ReadPCM(uint8_t* buffer, int size, int& actualsize) -/// { -/// ... -/// return 0; -/// } -/// -/// -/// /*----------------------------------------------------------------------*/ -/// -/// class CMyAddon : public ::kodi::addon::CAddonBase -/// { -/// public: -/// CMyAddon() { } -/// ADDON_STATUS CreateInstance(int instanceType, -/// std::string instanceID, -/// KODI_HANDLE instance, -/// KODI_HANDLE& addonInstance) override; -/// }; -/// -/// /* If you use only one instance in your add-on, can be instanceType and -/// * instanceID ignored */ -/// ADDON_STATUS CMyAddon::CreateInstance(int instanceType, -/// std::string instanceID, -/// KODI_HANDLE instance, -/// KODI_HANDLE& addonInstance) -/// { -/// if (instanceType == ADDON_INSTANCE_AUDIODECODER) -/// { -/// kodi::Log(ADDON_LOG_NOTICE, "Creating my audio decoder"); -/// addonInstance = new CMyAudioDecoder(instance); -/// return ADDON_STATUS_OK; -/// } -/// else if (...) -/// { -/// ... -/// } -/// return ADDON_STATUS_UNKNOWN; -/// } -/// -/// ADDONCREATOR(CMyAddon) -/// ~~~~~~~~~~~~~ -/// -/// The destruction of the example class `CMyAudioDecoder` is called from -/// Kodi's header. Manually deleting the add-on instance is not required. -/// -class ATTRIBUTE_HIDDEN CInstanceAudioDecoder : public IAddonInstance -{ -public: - //========================================================================== - /// @ingroup cpp_kodi_addon_audiodecoder - /// @brief Class constructor - /// - /// @param[in] instance The addon instance class handler given by Kodi - /// at \ref kodi::addon::CAddonBase::CreateInstance(...) - /// @param[in] kodiVersion [opt] Version used in Kodi for this instance, to - /// allow compatibility to older Kodi versions. - /// @note Recommended to set. - /// - explicit CInstanceAudioDecoder(KODI_HANDLE instance, const std::string& kodiVersion = "") - : IAddonInstance(ADDON_INSTANCE_AUDIODECODER, - !kodiVersion.empty() ? kodiVersion - : GetKodiTypeVersion(ADDON_INSTANCE_AUDIODECODER)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstanceAudioDecoder: Creation of multiple together with single instance way is not allowed!"); - - SetAddonStruct(instance); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_addon_audiodecoder - /// @brief Initialize a decoder - /// - /// @param[in] filename The file to read - /// @param[in] filecache The file cache size - /// @param[out] channels Number of channels in output stream - /// @param[out] samplerate Samplerate of output stream - /// @param[out] bitspersample Bits per sample in output stream - /// @param[out] totaltime Total time for stream - /// @param[out] bitrate Average bitrate of input stream - /// @param[out] format Data format for output stream - /// @param[out] channellist Channel mapping for output stream - /// @return true if successfully done, otherwise - /// false - /// - virtual bool Init(const std::string& filename, unsigned int filecache, - int& channels, int& samplerate, - int& bitspersample, int64_t& totaltime, - int& bitrate, AEDataFormat& format, - std::vector& channellist) = 0; - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_addon_audiodecoder - /// @brief Produce some noise - /// - /// @param[in] buffer Output buffer - /// @param[in] size Size of output buffer - /// @param[out] actualsize Actual number of bytes written to output buffer - /// @return Return with following possible values: - /// | Value | Description | - /// |:-----:|:-----------------------------| - /// | 0 | on success - /// | -1 | on end of stream - /// | 1 | on failure - /// - virtual int ReadPCM(uint8_t* buffer, int size, int& actualsize) = 0; - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_addon_audiodecoder - /// @brief Seek in output stream - /// - /// @param[in] time Time position to seek to in milliseconds - /// @return Time position seek ended up on - /// - virtual int64_t Seek(int64_t time) { return time; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_addon_audiodecoder - /// @brief Read tag of a file - /// - /// @param[in] file File to read tag for - /// @param[out] title Title of file - /// @param[out] artist Artist of file - /// @param[out] length Length of file - /// @return True on success, false on failure - /// - virtual bool ReadTag(const std::string& file, std::string& title, std::string& artist, int& length) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// @ingroup cpp_kodi_addon_audiodecoder - /// @brief Get number of tracks in a file - /// - /// @param[in] file File to read tag for - /// @return Number of tracks in file - /// - virtual int TrackCount(const std::string& file) { return 1; } - //-------------------------------------------------------------------------- - -private: - void SetAddonStruct(KODI_HANDLE instance) - { - if (instance == nullptr) - throw std::logic_error("kodi::addon::CInstanceAudioDecoder: Creation with empty addon structure not allowed, table must be given from Kodi!"); - - m_instanceData = static_cast(instance); - - m_instanceData->toAddon.addonInstance = this; - m_instanceData->toAddon.init = ADDON_Init; - m_instanceData->toAddon.read_pcm = ADDON_ReadPCM; - m_instanceData->toAddon.seek = ADDON_Seek; - m_instanceData->toAddon.read_tag = ADDON_ReadTag; - m_instanceData->toAddon.track_count = ADDON_TrackCount; - } - - inline static bool ADDON_Init(const AddonInstance_AudioDecoder* instance, const char* file, unsigned int filecache, - int* channels, int* samplerate, - int* bitspersample, int64_t* totaltime, - int* bitrate, AEDataFormat* format, - const AEChannel** info) - { - instance->toAddon.addonInstance->m_channelList.clear(); - bool ret = instance->toAddon.addonInstance->Init(file, filecache, *channels, - *samplerate, *bitspersample, - *totaltime, *bitrate, *format, - instance->toAddon.addonInstance->m_channelList); - if (!instance->toAddon.addonInstance->m_channelList.empty()) - { - if (instance->toAddon.addonInstance->m_channelList.back() != AE_CH_NULL) - instance->toAddon.addonInstance->m_channelList.push_back(AE_CH_NULL); - *info = instance->toAddon.addonInstance->m_channelList.data(); - } - else - *info = nullptr; - return ret; - } - - inline static int ADDON_ReadPCM(const AddonInstance_AudioDecoder* instance, uint8_t* buffer, int size, int* actualsize) - { - return instance->toAddon.addonInstance->ReadPCM(buffer, size, *actualsize); - } - - inline static int64_t ADDON_Seek(const AddonInstance_AudioDecoder* instance, int64_t time) - { - return instance->toAddon.addonInstance->Seek(time); - } - - inline static bool ADDON_ReadTag(const AddonInstance_AudioDecoder* instance, const char* file, char* title, char* artist, int* length) - { - std::string intTitle; - std::string intArtist; - bool ret = instance->toAddon.addonInstance->ReadTag(file, intTitle, intArtist, *length); - if (ret) - { - strncpy(title, intTitle.c_str(), ADDON_STANDARD_STRING_LENGTH_SMALL-1); - strncpy(artist, intArtist.c_str(), ADDON_STANDARD_STRING_LENGTH_SMALL-1); - } - return ret; - } - - inline static int ADDON_TrackCount(const AddonInstance_AudioDecoder* instance, const char* file) - { - return instance->toAddon.addonInstance->TrackCount(file); - } - - std::vector m_channelList; - AddonInstance_AudioDecoder* m_instanceData; -}; - -} /* namespace addon */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioEncoder.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioEncoder.h deleted file mode 100644 index 36257e1..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioEncoder.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../AddonBase.h" - -namespace kodi { namespace addon { class CInstanceAudioEncoder; }} - -extern "C" -{ - - typedef struct AddonProps_AudioEncoder - { - int dummy; - } AddonProps_AudioEncoder; - - typedef struct AddonToKodiFuncTable_AudioEncoder - { - void* kodiInstance; - int (*write) (void* kodiInstance, const uint8_t* data, int len); - int64_t (*seek)(void* kodiInstance, int64_t pos, int whence); - } AddonToKodiFuncTable_AudioEncoder; - - struct AddonInstance_AudioEncoder; - typedef struct KodiToAddonFuncTable_AudioEncoder - { - kodi::addon::CInstanceAudioEncoder* addonInstance; - bool (__cdecl* start) (const AddonInstance_AudioEncoder* instance, int in_channels, int in_rate, int in_bits, - 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 track_length); - int (__cdecl* encode) (const AddonInstance_AudioEncoder* instance, int num_bytes_read, const uint8_t* pbt_stream); - bool (__cdecl* finish) (const AddonInstance_AudioEncoder* instance); - } KodiToAddonFuncTable_AudioEncoder; - - typedef struct AddonInstance_AudioEncoder - { - AddonProps_AudioEncoder props; - AddonToKodiFuncTable_AudioEncoder toKodi; - KodiToAddonFuncTable_AudioEncoder toAddon; - } AddonInstance_AudioEncoder; - -} /* extern "C" */ - -namespace kodi -{ -namespace addon -{ - - class ATTRIBUTE_HIDDEN CInstanceAudioEncoder : public IAddonInstance - { - public: - //========================================================================== - /// @brief Class constructor - /// - /// @param[in] instance The from Kodi given instance given be - /// add-on CreateInstance call with instance - /// id ADDON_INSTANCE_AUDIOENCODER. - /// @param[in] kodiVersion [opt] Version used in Kodi for this instance, to - /// allow compatibility to older Kodi versions. - /// @note Recommended to set. - /// - explicit CInstanceAudioEncoder(KODI_HANDLE instance, const std::string& kodiVersion = "") - : IAddonInstance(ADDON_INSTANCE_AUDIOENCODER, - !kodiVersion.empty() ? kodiVersion - : GetKodiTypeVersion(ADDON_INSTANCE_AUDIOENCODER)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstanceAudioEncoder: Creation of multiple together with single instance way is not allowed!"); - - SetAddonStruct(instance); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// \brief Start encoder (**required**) - /// - /// \param[in] inChannels Number of channels - /// \param[in] inRate Sample rate of input data - /// \param[in] inBits Bits per sample in input data - /// \param[in] title The title of the song - /// \param[in] artist The artist of the song - /// \param[in] albumartist The albumartist of the song - /// \param[in] year The year of the song - /// \param[in] track The track number of the song - /// \param[in] genre The genre of the song - /// \param[in] comment A comment to attach to the song - /// \param[in] trackLength Total track length in seconds - /// \return True on success, false on failure. - /// - virtual bool Start(int inChannels, - int inRate, - int inBits, - const std::string& title, - const std::string& artist, - const std::string& albumartist, - const std::string& album, - const std::string& year, - const std::string& track, - const std::string& genre, - const std::string& comment, - int trackLength) = 0; - //-------------------------------------------------------------------------- - - //========================================================================== - /// \brief Encode a chunk of audio (**required**) - /// - /// \param[in] numBytesRead Number of bytes in input buffer - /// \param[in] pbtStream the input buffer - /// \return Number of bytes consumed - /// - virtual int Encode(int numBytesRead, const uint8_t* pbtStream) = 0; - //-------------------------------------------------------------------------- - - //========================================================================== - /// \brief Finalize encoding (**optional**) - /// - /// \return True on success, false on failure. - /// - virtual bool Finish() { return true; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// \brief Write block of data - /// - /// \param[in] data Pointer to the array of elements to be - /// written - /// \param[in] length Size in bytes to be written. - /// \return The total number of bytes - /// successfully written is returned. - int Write(const uint8_t* data, int length) - { - return m_instanceData->toKodi.write(m_instanceData->toKodi.kodiInstance, data, length); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// \brief Set the file's current position. - /// - /// The whence argument is optional and defaults to SEEK_SET (0) - /// - /// \param[in] position the position that you want to seek to - /// \param[in] whence [optional] offset relative to - /// You can set the value of whence to one - /// of three things: - /// | Value | int | Description | - /// |:--------:|:---:|:---------------------------------------------------| - /// | SEEK_SET | 0 | position is relative to the beginning of the file. This is probably what you had in mind anyway, and is the most commonly used value for whence. - /// | SEEK_CUR | 1 | position is relative to the current file pointer position. So, in effect, you can say, "Move to my current position plus 30 bytes," or, "move to my current position minus 20 bytes." - /// | SEEK_END | 2 | position is relative to the end of the file. Just like SEEK_SET except from the other end of the file. Be sure to use negative values for offset if you want to back up from the end of the file, instead of going past the end into oblivion. - /// - /// \return Returns the resulting offset location as - /// measured in bytes from the beginning of - /// the file. On error, the value -1 is - /// returned. - int64_t Seek(int64_t position, int whence = SEEK_SET) - { - return m_instanceData->toKodi.seek(m_instanceData->toKodi.kodiInstance, position, whence); - } - //-------------------------------------------------------------------------- - - private: - void SetAddonStruct(KODI_HANDLE instance) - { - if (instance == nullptr) - throw std::logic_error("kodi::addon::CInstanceAudioEncoder: Creation with empty addon structure not allowed, table must be given from Kodi!"); - - m_instanceData = static_cast(instance); - m_instanceData->toAddon.addonInstance = this; - m_instanceData->toAddon.start = ADDON_Start; - m_instanceData->toAddon.encode = ADDON_Encode; - m_instanceData->toAddon.finish = ADDON_Finish; - } - - inline static bool ADDON_Start(const AddonInstance_AudioEncoder* instance, int inChannels, int inRate, int inBits, - 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 trackLength) - { - return instance->toAddon.addonInstance->Start(inChannels, - inRate, - inBits, - title, - artist, - albumartist, - album, - year, - track, - genre, - comment, - trackLength); - } - - inline static int ADDON_Encode(const AddonInstance_AudioEncoder* instance, int numBytesRead, const uint8_t* pbtStream) - { - return instance->toAddon.addonInstance->Encode(numBytesRead, pbtStream); - } - - inline static bool ADDON_Finish(const AddonInstance_AudioEncoder* instance) - { - return instance->toAddon.addonInstance->Finish(); - } - - AddonInstance_AudioEncoder* m_instanceData; - }; - -} /* namespace addon */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt deleted file mode 100644 index 8fa6e05..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -set(HEADERS AudioDecoder.h - AudioEncoder.h - Game.h - ImageDecoder.h - Inputstream.h - Peripheral.h - PeripheralUtils.h - PVR.h - Screensaver.h - VFS.h - VideoCodec.h - Visualization.h) - -if(NOT ENABLE_STATIC_LIBS) - core_add_library(addons_kodi-addon-dev-kit_include_kodi_addon-instance) -endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Game.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Game.h deleted file mode 100644 index a53f1e7..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Game.h +++ /dev/null @@ -1,2360 +0,0 @@ -/* - * Copyright (C) 2014-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../AddonBase.h" - -#ifdef BUILD_KODI_ADDON -#include "XBMC_vkeys.h" -#else -#include "input/XBMC_vkeys.h" -#endif - -//============================================================================== -/// @addtogroup cpp_kodi_addon_game -/// -/// To use on Libretro and for stand-alone games or emulators that does not use -/// the Libretro API. -/// -/// Possible examples could be, Nvidia GameStream via Limelight or WINE capture -/// could possible through the Game API. -/// - -namespace kodi -{ -namespace addon -{ -class CInstanceGame; -} -} // namespace kodi - -extern "C" -{ - -//============================================================================== -/// \defgroup cpp_kodi_addon_game_Defs Definitions, structures and enumerators -/// \ingroup cpp_kodi_addon_game -/// @brief **Game add-on instance definition values** -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi_addon_game_Defs -/// @brief **Port ID used when topology is unknown** -#define DEFAULT_PORT_ID "1" -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi_addon_game_Defs -/// @brief **Game add-on error codes** -/// -/// Used as return values on most Game related functions. -/// -typedef enum GAME_ERROR -{ - /// @brief no error occurred - GAME_ERROR_NO_ERROR, - - /// @brief an unknown error occurred - GAME_ERROR_UNKNOWN, - - /// @brief the method that the frontend called is not implemented - GAME_ERROR_NOT_IMPLEMENTED, - - /// @brief the command was rejected by the game client - GAME_ERROR_REJECTED, - - /// @brief the parameters of the method that was called are invalid for this operation - GAME_ERROR_INVALID_PARAMETERS, - - /// @brief the command failed - GAME_ERROR_FAILED, - - /// @brief no game is loaded - GAME_ERROR_NOT_LOADED, - - /// @brief game requires restricted resources - GAME_ERROR_RESTRICTED, -} GAME_ERROR; -//------------------------------------------------------------------------------ - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- -/// \defgroup cpp_kodi_addon_game_Defs_AudioStream 1. Audio stream -/// \ingroup cpp_kodi_addon_game_Defs -/// @brief **The for Audio stream used data system** -/// -/// Used to give Addon currently used audio stream configuration on Kodi and -/// arrays to give related data to Kodi on callbacks. -/// -//@{ - -//============================================================================== -/// @brief **Stream Format** -/// -/// From Kodi requested specified audio sample format. -/// -typedef enum GAME_PCM_FORMAT -{ - GAME_PCM_FORMAT_UNKNOWN, - - /// @brief S16NE sample format - GAME_PCM_FORMAT_S16NE, -} GAME_PCM_FORMAT; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Audio channel** -/// -/// Channel identification flags. -/// -typedef enum GAME_AUDIO_CHANNEL -{ - /// @brief Channel list terminator - GAME_CH_NULL, - - /// @brief Channel front left - GAME_CH_FL, - - /// @brief Channel front right - GAME_CH_FR, - - /// @brief Channel front center - GAME_CH_FC, - - /// @brief Channel Low Frequency Effects / Subwoofer - GAME_CH_LFE, - - /// @brief Channel back left - GAME_CH_BL, - - /// @brief Channel back right - GAME_CH_BR, - - /// @brief Channel front left over center - GAME_CH_FLOC, - - /// @brief Channel front right over center - GAME_CH_FROC, - - /// @brief Channel back center - GAME_CH_BC, - - /// @brief Channel surround/side left - GAME_CH_SL, - - /// @brief Channel surround/side right - GAME_CH_SR, - - /// @brief Channel top front left - GAME_CH_TFL, - - /// @brief Channel top front right - GAME_CH_TFR, - - /// @brief Channel top front center - GAME_CH_TFC, - - /// @brief Channel top center - GAME_CH_TC, - - /// @brief Channel top back left - GAME_CH_TBL, - - /// @brief Channel top back right - GAME_CH_TBR, - - /// @brief Channel top back center - GAME_CH_TBC, - - /// @brief Channel bacl left over center - GAME_CH_BLOC, - - /// @brief Channel back right over center - GAME_CH_BROC, -} GAME_AUDIO_CHANNEL; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Game audio stream properties** -/// -/// Used by Kodi to pass the currently required audio stream settings to the addon -/// -typedef struct game_stream_audio_properties -{ - GAME_PCM_FORMAT format; - const GAME_AUDIO_CHANNEL* channel_map; -} ATTRIBUTE_PACKED game_stream_audio_properties; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Audio stream packet** -/// -/// This packet contains audio stream data passed to Kodi. -/// -typedef struct game_stream_audio_packet -{ - /// @brief Pointer for audio stream data given to Kodi - const uint8_t *data; - - /// @brief Size of data array - size_t size; -} ATTRIBUTE_PACKED game_stream_audio_packet; -//------------------------------------------------------------------------------ - -//@} - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- -/// \defgroup cpp_kodi_addon_game_Defs_VideoStream 2. Video stream -/// \ingroup cpp_kodi_addon_game_Defs -/// @brief **The for Video stream used data system** -/// -/// Used to give Addon currently used video stream configuration on Kodi and -/// arrays to give related data to Kodi on callbacks. -/// -//@{ - -//============================================================================== -/// @brief **Pixel format** -/// -/// From Kodi requested specified video RGB color model format. -/// -typedef enum GAME_PIXEL_FORMAT -{ - GAME_PIXEL_FORMAT_UNKNOWN, - - /// @brief 0RGB8888 Format - GAME_PIXEL_FORMAT_0RGB8888, - - /// @brief RGB565 Format - GAME_PIXEL_FORMAT_RGB565, - - /// @brief 0RGB1555 Format - GAME_PIXEL_FORMAT_0RGB1555, -} GAME_PIXEL_FORMAT; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Video rotation position** -/// -/// To define position how video becomes shown. -/// -typedef enum GAME_VIDEO_ROTATION -{ - /// @brief 0° and Without rotation - GAME_VIDEO_ROTATION_0, - - /// @brief rotate 90° counterclockwise - GAME_VIDEO_ROTATION_90_CCW, - - /// @brief rotate 180° counterclockwise - GAME_VIDEO_ROTATION_180_CCW, - - /// @brief rotate 270° counterclockwise - GAME_VIDEO_ROTATION_270_CCW, -} GAME_VIDEO_ROTATION; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Game video stream properties** -/// -/// Used by Kodi to pass the currently required video stream settings to the addon -/// -typedef struct game_stream_video_properties -{ - /// @brief The to used pixel format - GAME_PIXEL_FORMAT format; - - /// @brief The nominal used width - unsigned int nominal_width; - - /// @brief The nominal used height - unsigned int nominal_height; - - /// @brief The maximal used width - unsigned int max_width; - - /// @brief The maximal used height - unsigned int max_height; - - /// @brief On video stream used aspect ration - /// - /// @note If aspect_ratio is <= 0.0, an aspect ratio of nominal_width / nominal_height is assumed - float aspect_ratio; -} ATTRIBUTE_PACKED game_stream_video_properties; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Video stream packet** -/// -/// This packet contains video stream data passed to Kodi. -/// -typedef struct game_stream_video_packet -{ - /// @brief Video height - unsigned int width; - - /// @brief Video width - unsigned int height; - - /// @brief Width @ref GAME_VIDEO_ROTATION defined rotation angle. - GAME_VIDEO_ROTATION rotation; - - /// @brief Pointer for video stream data given to Kodi - const uint8_t *data; - - /// @brief Size of data array - size_t size; -} ATTRIBUTE_PACKED game_stream_video_packet; -//------------------------------------------------------------------------------ - -//@} - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- -/// \defgroup cpp_kodi_addon_game_Defs_HardwareFramebuffer 3. Hardware framebuffer stream -/// \ingroup cpp_kodi_addon_game_Defs -/// @brief **Hardware framebuffer stream data** -/// -//@{ - -//============================================================================== -/// @brief **Hardware framebuffer type** -/// -typedef enum GAME_HW_CONTEXT_TYPE -{ - /// @brief None context - GAME_HW_CONTEXT_NONE, - - /// @brief OpenGL 2.x. Driver can choose to use latest compatibility context - GAME_HW_CONTEXT_OPENGL, - - /// @brief OpenGL ES 2.0 - GAME_HW_CONTEXT_OPENGLES2, - - /// @brief Modern desktop core GL context. Use major/minor fields to set GL version - GAME_HW_CONTEXT_OPENGL_CORE, - - /// @brief OpenGL ES 3.0 - GAME_HW_CONTEXT_OPENGLES3, - - /// @brief OpenGL ES 3.1+. Set major/minor fields. - GAME_HW_CONTEXT_OPENGLES_VERSION, - - /// @brief Vulkan - GAME_HW_CONTEXT_VULKAN -} GAME_HW_CONTEXT_TYPE; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Hardware framebuffer properties** -/// -typedef struct game_stream_hw_framebuffer_properties -{ - /// @brief The API to use. - /// - GAME_HW_CONTEXT_TYPE context_type; - - /// @brief Set if render buffers should have depth component attached. - /// - /// @todo: Obsolete - /// - bool depth; - - /// @brief Set if stencil buffers should be attached. - /// - /// If depth and stencil are true, a packed 24/8 buffer will be added. - /// Only attaching stencil is invalid and will be ignored. - /// - /// @todo: Obsolete. - /// - bool stencil; - - /// @brief Use conventional bottom-left origin convention. - /// - /// If false, standard top-left origin semantics are used. - /// - /// @todo: Move to GL specific interface - /// - bool bottom_left_origin; - - /// @brief Major version number for core GL context or GLES 3.1+. - unsigned int version_major; - - /// @brief Minor version number for core GL context or GLES 3.1+. - unsigned int version_minor; - - /// @brief If this is true, the frontend will go very far to avoid resetting context - /// in scenarios like toggling fullscreen, etc. - /// - /// @todo: Obsolete? Maybe frontend should just always assume this... - /// - /// The reset callback might still be called in extreme situations such as if - /// the context is lost beyond recovery. - /// - /// For optimal stability, set this to false, and allow context to be reset at - /// any time. - /// - bool cache_context; - - /// @brief Creates a debug context. - bool debug_context; -} ATTRIBUTE_PACKED game_stream_hw_framebuffer_properties; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Hardware framebuffer buffer** -/// -typedef struct game_stream_hw_framebuffer_buffer -{ - /// @brief - uintptr_t framebuffer; -} ATTRIBUTE_PACKED game_stream_hw_framebuffer_buffer; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Hardware framebuffer packet** -/// -typedef struct game_stream_hw_framebuffer_packet -{ - /// @brief - uintptr_t framebuffer; -} ATTRIBUTE_PACKED game_stream_hw_framebuffer_packet; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Hardware framebuffer process function address** -/// -typedef void (*game_proc_address_t)(void); -//------------------------------------------------------------------------------ - -//@} - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- -/// \defgroup cpp_kodi_addon_game_Defs_SoftwareFramebuffer 4. Software framebuffer stream -/// \ingroup cpp_kodi_addon_game_Defs -/// @brief **Software framebuffer stream data** -/// -//@{ - -//============================================================================== -/// @brief **Game video stream properties** -/// -/// Used by Kodi to pass the currently required video stream settings to the addon -/// -typedef game_stream_video_properties game_stream_sw_framebuffer_properties; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Hardware framebuffer type** -/// -typedef struct game_stream_sw_framebuffer_buffer -{ - GAME_PIXEL_FORMAT format; - uint8_t *data; - size_t size; -} ATTRIBUTE_PACKED game_stream_sw_framebuffer_buffer; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Video stream packet** -/// -/// This packet contains video stream data passed to Kodi. -/// -typedef game_stream_video_packet game_stream_sw_framebuffer_packet; -//------------------------------------------------------------------------------ - -//@} - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- -/// \defgroup cpp_kodi_addon_game_Defs_StreamTypes 5. Stream types -/// \ingroup cpp_kodi_addon_game_Defs -/// @brief **Stream types data** -/// -//@{ - -//============================================================================== -/// @brief **Game stream types** -/// -typedef enum GAME_STREAM_TYPE -{ - /// @brief Unknown - GAME_STREAM_UNKNOWN, - - /// @brief Audio stream - GAME_STREAM_AUDIO, - - /// @brief Video stream - GAME_STREAM_VIDEO, - - /// @brief Hardware framebuffer - GAME_STREAM_HW_FRAMEBUFFER, - - /// @brief Software framebuffer - GAME_STREAM_SW_FRAMEBUFFER, -} GAME_STREAM_TYPE; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Immutable stream metadata** -/// -/// This metadata is provided when the stream is opened. If any stream -/// properties change, a new stream must be opened. -/// -typedef struct game_stream_properties -{ - /// @brief - GAME_STREAM_TYPE type; - union - { - /// @brief - game_stream_audio_properties audio; - - /// @brief - game_stream_video_properties video; - - /// @brief - game_stream_hw_framebuffer_properties hw_framebuffer; - - /// @brief - game_stream_sw_framebuffer_properties sw_framebuffer; - }; -} ATTRIBUTE_PACKED game_stream_properties; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Stream buffers for hardware rendering and zero-copy support** -/// -typedef struct game_stream_buffer -{ - /// @brief - GAME_STREAM_TYPE type; - union - { - /// @brief - game_stream_hw_framebuffer_buffer hw_framebuffer; - - /// @brief - game_stream_sw_framebuffer_buffer sw_framebuffer; - }; -} ATTRIBUTE_PACKED game_stream_buffer; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Stream packet and ephemeral metadata** -/// -/// This packet contains stream data and accompanying metadata. The metadata -/// is ephemeral, meaning it only applies to the current packet and can change -/// from packet to packet in the same stream. -/// -typedef struct game_stream_packet -{ - /// @brief - GAME_STREAM_TYPE type; - union - { - /// @brief - game_stream_audio_packet audio; - - /// @brief - game_stream_video_packet video; - - /// @brief - game_stream_hw_framebuffer_packet hw_framebuffer; - - /// @brief - game_stream_sw_framebuffer_packet sw_framebuffer; - }; -} ATTRIBUTE_PACKED game_stream_packet; -//------------------------------------------------------------------------------ - -//@} - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- -/// \defgroup cpp_kodi_addon_game_Defs_GameTypes 6. Game types -/// \ingroup cpp_kodi_addon_game_Defs -/// @brief **Game types data** -/// -//@{ - -//============================================================================== -/// @brief **Game reguin definition** -/// -/// Returned from game_get_region() -typedef enum GAME_REGION -{ - /// @brief Game region unknown - GAME_REGION_UNKNOWN, - - /// @brief Game region NTSC - GAME_REGION_NTSC, - - /// @brief Game region PAL - GAME_REGION_PAL, -} GAME_REGION; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Special game types passed into game_load_game_special().** -/// -/// @remark Only used when multiple ROMs are required. -/// -typedef enum SPECIAL_GAME_TYPE -{ - /// @brief Game Type BSX - SPECIAL_GAME_TYPE_BSX, - - /// @brief Game Type BSX slotted - SPECIAL_GAME_TYPE_BSX_SLOTTED, - - /// @brief Game Type sufami turbo - SPECIAL_GAME_TYPE_SUFAMI_TURBO, - - /// @brief Game Type super game boy - SPECIAL_GAME_TYPE_SUPER_GAME_BOY, -} SPECIAL_GAME_TYPE; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **Game Memory** -/// -typedef enum GAME_MEMORY -{ - /// @brief Passed to game_get_memory_data/size(). If the memory type doesn't apply - /// to the implementation NULL/0 can be returned. - GAME_MEMORY_MASK = 0xff, - - /// @brief Regular save ram. - /// - /// This ram is usually found on a game cartridge, backed - /// up by a battery. If save game data is too complex for a single memory - /// buffer, the SYSTEM_DIRECTORY environment callback can be used. - GAME_MEMORY_SAVE_RAM = 0, - - /// @brief Some games have a built-in clock to keep track of time. - /// - /// This memory is usually just a couple of bytes to keep track of time. - GAME_MEMORY_RTC = 1, - - /// @brief System ram lets a frontend peek into a game systems main RAM - GAME_MEMORY_SYSTEM_RAM = 2, - - /// @brief Video ram lets a frontend peek into a game systems video RAM (VRAM) - GAME_MEMORY_VIDEO_RAM = 3, - - /// @brief Special memory type - GAME_MEMORY_SNES_BSX_RAM = ((1 << 8) | GAME_MEMORY_SAVE_RAM), - - /// @brief Special memory type - GAME_MEMORY_SNES_BSX_PRAM = ((2 << 8) | GAME_MEMORY_SAVE_RAM), - - /// @brief Special memory type - GAME_MEMORY_SNES_SUFAMI_TURBO_A_RAM = ((3 << 8) | GAME_MEMORY_SAVE_RAM), - - /// @brief Special memory type - GAME_MEMORY_SNES_SUFAMI_TURBO_B_RAM = ((4 << 8) | GAME_MEMORY_SAVE_RAM), - - /// @brief Special memory type - GAME_MEMORY_SNES_GAME_BOY_RAM = ((5 << 8) | GAME_MEMORY_SAVE_RAM), - - /// @brief Special memory type - GAME_MEMORY_SNES_GAME_BOY_RTC = ((6 << 8) | GAME_MEMORY_RTC), -} GAME_MEMORY; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief **ID values for SIMD CPU features** -typedef enum GAME_SIMD -{ - /// @brief SIMD CPU SSE - GAME_SIMD_SSE = (1 << 0), - - /// @brief SIMD CPU SSE2 - GAME_SIMD_SSE2 = (1 << 1), - - /// @brief SIMD CPU VMX - GAME_SIMD_VMX = (1 << 2), - - /// @brief SIMD CPU VMX128 - GAME_SIMD_VMX128 = (1 << 3), - - /// @brief SIMD CPU AVX - GAME_SIMD_AVX = (1 << 4), - - /// @brief SIMD CPU NEON - GAME_SIMD_NEON = (1 << 5), - - /// @brief SIMD CPU SSE3 - GAME_SIMD_SSE3 = (1 << 6), - - /// @brief SIMD CPU SSSE3 - GAME_SIMD_SSSE3 = (1 << 7), - - /// @brief SIMD CPU MMX - GAME_SIMD_MMX = (1 << 8), - - /// @brief SIMD CPU MMXEXT - GAME_SIMD_MMXEXT = (1 << 9), - - /// @brief SIMD CPU SSE4 - GAME_SIMD_SSE4 = (1 << 10), - - /// @brief SIMD CPU SSE42 - GAME_SIMD_SSE42 = (1 << 11), - - /// @brief SIMD CPU AVX2 - GAME_SIMD_AVX2 = (1 << 12), - - /// @brief SIMD CPU VFPU - GAME_SIMD_VFPU = (1 << 13), -} GAME_SIMD; -//------------------------------------------------------------------------------ - -//@} - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- -/// \defgroup cpp_kodi_addon_game_Defs_InputTypes 7. Input types -/// \ingroup cpp_kodi_addon_game_Defs -/// @brief **Input types** -/// -//@{ - -//============================================================================== -/// @brief -typedef enum GAME_INPUT_EVENT_SOURCE -{ - /// @brief - GAME_INPUT_EVENT_DIGITAL_BUTTON, - - /// @brief - GAME_INPUT_EVENT_ANALOG_BUTTON, - - /// @brief - GAME_INPUT_EVENT_AXIS, - - /// @brief - GAME_INPUT_EVENT_ANALOG_STICK, - - /// @brief - GAME_INPUT_EVENT_ACCELEROMETER, - - /// @brief - GAME_INPUT_EVENT_KEY, - - /// @brief - GAME_INPUT_EVENT_RELATIVE_POINTER, - - /// @brief - GAME_INPUT_EVENT_ABSOLUTE_POINTER, - - /// @brief - GAME_INPUT_EVENT_MOTOR, -} GAME_INPUT_EVENT_SOURCE; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief -typedef enum GAME_KEY_MOD -{ - /// @brief - GAME_KEY_MOD_NONE = 0x0000, - - /// @brief - GAME_KEY_MOD_SHIFT = 0x0001, - - /// @brief - GAME_KEY_MOD_CTRL = 0x0002, - - /// @brief - GAME_KEY_MOD_ALT = 0x0004, - - /// @brief - GAME_KEY_MOD_META = 0x0008, - - /// @brief - GAME_KEY_MOD_SUPER = 0x0010, - - /// @brief - GAME_KEY_MOD_NUMLOCK = 0x0100, - - /// @brief - GAME_KEY_MOD_CAPSLOCK = 0x0200, - - /// @brief - GAME_KEY_MOD_SCROLLOCK = 0x0400, -} GAME_KEY_MOD; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Type of port on the virtual game console -typedef enum GAME_PORT_TYPE -{ - /// @brief Game port unknown - GAME_PORT_UNKNOWN, - - /// @brief Game port Keyboard - GAME_PORT_KEYBOARD, - - /// @brief Game port mouse - GAME_PORT_MOUSE, - - /// @brief Game port controller - GAME_PORT_CONTROLLER, -} GAME_PORT_TYPE; -//------------------------------------------------------------------------------ - -/*! \cond PRIVATE */ -/*! - * @brief "C" Game add-on controller layout. - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref AddonGameControllerLayout for description of values. - */ -typedef struct game_controller_layout -{ - char* controller_id; - bool provides_input; // False for multitaps - char** digital_buttons; - unsigned int digital_button_count; - char** analog_buttons; - unsigned int analog_button_count; - char** analog_sticks; - unsigned int analog_stick_count; - char** accelerometers; - unsigned int accelerometer_count; - char** keys; - unsigned int key_count; - char** rel_pointers; - unsigned int rel_pointer_count; - char** abs_pointers; - unsigned int abs_pointer_count; - char** motors; - unsigned int motor_count; -} ATTRIBUTE_PACKED game_controller_layout; - /*! \endcond */ - -//============================================================================== -/// @brief -struct AddonGameControllerLayout -{ - /*! \cond PRIVATE */ - explicit AddonGameControllerLayout() = default; - AddonGameControllerLayout(const game_controller_layout& layout) - { - controller_id = layout.controller_id; - provides_input = layout.provides_input; - for (unsigned int i = 0; i < layout.digital_button_count; ++i) - digital_buttons.push_back(layout.digital_buttons[i]); - for (unsigned int i = 0; i < layout.analog_button_count; ++i) - analog_buttons.push_back(layout.analog_buttons[i]); - for (unsigned int i = 0; i < layout.analog_stick_count; ++i) - analog_sticks.push_back(layout.analog_sticks[i]); - for (unsigned int i = 0; i < layout.accelerometer_count; ++i) - accelerometers.push_back(layout.accelerometers[i]); - for (unsigned int i = 0; i < layout.key_count; ++i) - keys.push_back(layout.keys[i]); - for (unsigned int i = 0; i < layout.rel_pointer_count; ++i) - rel_pointers.push_back(layout.rel_pointers[i]); - for (unsigned int i = 0; i < layout.abs_pointer_count; ++i) - abs_pointers.push_back(layout.abs_pointers[i]); - for (unsigned int i = 0; i < layout.motor_count; ++i) - motors.push_back(layout.motors[i]); - } - /*! \endcond */ - - /// @brief - std::string controller_id; - - /// @brief False for multitaps - bool provides_input; - - /// @brief - std::vector digital_buttons; - - /// @brief - std::vector analog_buttons; - - /// @brief - std::vector analog_sticks; - - /// @brief - std::vector accelerometers; - - /// @brief - std::vector keys; - - /// @brief - std::vector rel_pointers; - - /// @brief - std::vector abs_pointers; - - /// @brief - std::vector motors; -}; -//------------------------------------------------------------------------------ - -struct game_input_port; - -//============================================================================== -/// @brief Device that can provide input -typedef struct game_input_device -{ - /// @brief ID used in the Kodi controller API - const char* controller_id; - - /// @brief - const char* port_address; - - /// @brief - game_input_port* available_ports; - - /// @brief - unsigned int port_count; -} ATTRIBUTE_PACKED game_input_device; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief Port that can provide input -/// -/// Ports can accept multiple devices and devices can have multiple ports, so -/// the topology of possible configurations is a tree structure of alternating -/// port and device nodes. -/// -typedef struct game_input_port -{ - /// @brief - GAME_PORT_TYPE type; - - /// @brief Required for GAME_PORT_CONTROLLER type - const char* port_id; - - /// @brief - game_input_device* accepted_devices; - - /// @brief - unsigned int device_count; -} ATTRIBUTE_PACKED game_input_port; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief The input topology is the possible ways to connect input devices -/// -/// This represents the logical topology, which is the possible connections that -/// the game client's logic can handle. It is strictly a subset of the physical -/// topology. Loops are not allowed. -/// -typedef struct game_input_topology -{ - /// @brief The list of ports on the virtual game console - game_input_port *ports; - - /// @brief The number of ports - unsigned int port_count; - - /// @brief A limit on the number of input-providing devices, or -1 for no limit - int player_limit; -} ATTRIBUTE_PACKED game_input_topology; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief -typedef struct game_digital_button_event -{ - /// @brief - bool pressed; -} ATTRIBUTE_PACKED game_digital_button_event; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief -typedef struct game_analog_button_event -{ - /// @brief - float magnitude; -} ATTRIBUTE_PACKED game_analog_button_event; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief -typedef struct game_axis_event -{ - /// @brief - float position; -} ATTRIBUTE_PACKED game_axis_event; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief -typedef struct game_analog_stick_event -{ - /// @brief - float x; - - /// @brief - float y; -} ATTRIBUTE_PACKED game_analog_stick_event; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief -typedef struct game_accelerometer_event -{ - /// @brief - float x; - - /// @brief - float y; - - /// @brief - float z; -} ATTRIBUTE_PACKED game_accelerometer_event; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief -typedef struct game_key_event -{ - /// @brief - bool pressed; - - /// @brief If the keypress generates a printing character - /// - /// The unicode value contains the character generated. If the key is a - /// non-printing character, e.g. a function or arrow key, the unicode value - /// is zero. - uint32_t unicode; - - /// @brief - GAME_KEY_MOD modifiers; -} ATTRIBUTE_PACKED game_key_event; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief -typedef struct game_rel_pointer_event -{ - /// @brief - int x; - - /// @brief - int y; -} ATTRIBUTE_PACKED game_rel_pointer_event; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief -typedef struct game_abs_pointer_event -{ - /// @brief - bool pressed; - - /// @brief - float x; - - /// @brief - float y; -} ATTRIBUTE_PACKED game_abs_pointer_event; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief -typedef struct game_motor_event -{ - /// @brief - float magnitude; -} ATTRIBUTE_PACKED game_motor_event; -//------------------------------------------------------------------------------ - -//============================================================================== -/// @brief -typedef struct game_input_event -{ - /// @brief - GAME_INPUT_EVENT_SOURCE type; - - /// @brief - const char* controller_id; - - /// @brief - GAME_PORT_TYPE port_type; - - /// @brief - const char* port_address; - - /// @brief - const char* feature_name; - union { - /// @brief - struct game_digital_button_event digital_button; - - /// @brief - struct game_analog_button_event analog_button; - - /// @brief - struct game_axis_event axis; - - /// @brief - struct game_analog_stick_event analog_stick; - - /// @brief - struct game_accelerometer_event accelerometer; - - /// @brief - struct game_key_event key; - - /// @brief - struct game_rel_pointer_event rel_pointer; - - /// @brief - struct game_abs_pointer_event abs_pointer; - - /// @brief - struct game_motor_event motor; - }; -} ATTRIBUTE_PACKED game_input_event; -//------------------------------------------------------------------------------ - -//@} - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- -/// \defgroup cpp_kodi_addon_game_Defs_EnvironmentTypes 8. Environment types -/// \ingroup cpp_kodi_addon_game_Defs -/// @brief **Environment types** -/// -//@{ - -//============================================================================== -/// @brief Game system timing -/// -struct game_system_timing -{ - /// @brief FPS of video content. - double fps; - - /// @brief Sampling rate of audio. - double sample_rate; -}; -//------------------------------------------------------------------------------ - -//@} - - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- - -/*! - * @brief Game properties - * - * Not to be used outside this header. - */ -typedef struct AddonProps_Game -{ - /*! - * The path of the game client being loaded. - */ - const char* game_client_dll_path; - - /*! - * Paths to proxy DLLs used to load the game client. - */ - const char** proxy_dll_paths; - - /*! - * Number of proxy DLL paths provided. - */ - unsigned int proxy_dll_count; - - /*! - * The "system" directories of the frontend. These directories can be used to - * store system-specific ROMs such as BIOSes, configuration data, etc. - */ - const char** resource_directories; - - /*! - * Number of resource directories provided - */ - unsigned int resource_directory_count; - - /*! - * The writable directory of the frontend. This directory can be used to store - * SRAM, memory cards, high scores, etc, if the game client cannot use the - * regular memory interface, GetMemoryData(). - */ - const char* profile_directory; - - /*! - * The value of the property from addon.xml - */ - bool supports_vfs; - - /*! - * The extensions in the property from addon.xml - */ - const char** extensions; - - /*! - * Number of extensions provided - */ - unsigned int extension_count; -} AddonProps_Game; - -typedef AddonProps_Game game_client_properties; - -/*! Structure to transfer the methods from kodi_game_dll.h to Kodi */ - -struct AddonInstance_Game; - -/*! - * @brief Game callbacks - * - * Not to be used outside this header. - */ -typedef struct AddonToKodiFuncTable_Game -{ - KODI_HANDLE kodiInstance; - - void (*CloseGame)(void* kodiInstance); - void* (*OpenStream)(void*, const game_stream_properties*); - bool (*GetStreamBuffer)(void*, void*, unsigned int, unsigned int, game_stream_buffer*); - void (*AddStreamData)(void*, void*, const game_stream_packet*); - void (*ReleaseStreamBuffer)(void*, void*, game_stream_buffer*); - void (*CloseStream)(void*, void*); - game_proc_address_t (*HwGetProcAddress)(void* kodiInstance, const char* symbol); - bool (*InputEvent)(void* kodiInstance, const game_input_event* event); -} AddonToKodiFuncTable_Game; - -/*! - * @brief Game function hooks - * - * Not to be used outside this header. - */ -typedef struct KodiToAddonFuncTable_Game -{ - kodi::addon::CInstanceGame* addonInstance; - - GAME_ERROR(__cdecl* LoadGame)(const AddonInstance_Game*, const char*); - GAME_ERROR(__cdecl* LoadGameSpecial) - (const AddonInstance_Game*, SPECIAL_GAME_TYPE, const char**, size_t); - GAME_ERROR(__cdecl* LoadStandalone)(const AddonInstance_Game*); - GAME_ERROR(__cdecl* UnloadGame)(const AddonInstance_Game*); - GAME_ERROR(__cdecl* GetGameTiming)(const AddonInstance_Game*, game_system_timing*); - GAME_REGION(__cdecl* GetRegion)(const AddonInstance_Game*); - bool(__cdecl* RequiresGameLoop)(const AddonInstance_Game*); - GAME_ERROR(__cdecl* RunFrame)(const AddonInstance_Game*); - GAME_ERROR(__cdecl* Reset)(const AddonInstance_Game*); - GAME_ERROR(__cdecl* HwContextReset)(const AddonInstance_Game*); - GAME_ERROR(__cdecl* HwContextDestroy)(const AddonInstance_Game*); - bool(__cdecl* HasFeature)(const AddonInstance_Game*, const char*, const char*); - game_input_topology*(__cdecl* GetTopology)(const AddonInstance_Game*); - void(__cdecl* FreeTopology)(const AddonInstance_Game*, game_input_topology*); - void(__cdecl* SetControllerLayouts)(const AddonInstance_Game*, - const game_controller_layout*, - unsigned int); - bool(__cdecl* EnableKeyboard)(const AddonInstance_Game*, bool, const char*); - bool(__cdecl* EnableMouse)(const AddonInstance_Game*, bool, const char*); - bool(__cdecl* ConnectController)(const AddonInstance_Game*, bool, const char*, const char*); - bool(__cdecl* InputEvent)(const AddonInstance_Game*, const game_input_event*); - size_t(__cdecl* SerializeSize)(const AddonInstance_Game*); - GAME_ERROR(__cdecl* Serialize)(const AddonInstance_Game*, uint8_t*, size_t); - GAME_ERROR(__cdecl* Deserialize)(const AddonInstance_Game*, const uint8_t*, size_t); - GAME_ERROR(__cdecl* CheatReset)(const AddonInstance_Game*); - GAME_ERROR(__cdecl* GetMemory)(const AddonInstance_Game*, GAME_MEMORY, uint8_t**, size_t*); - GAME_ERROR(__cdecl* SetCheat)(const AddonInstance_Game*, unsigned int, bool, const char*); -} KodiToAddonFuncTable_Game; - -/*! - * @brief Game instance - * - * Not to be used outside this header. - */ -typedef struct AddonInstance_Game -{ - AddonProps_Game props; - AddonToKodiFuncTable_Game toKodi; - KodiToAddonFuncTable_Game toAddon; -} AddonInstance_Game; - -} /* extern "C" */ - -namespace kodi -{ -namespace addon -{ - -//============================================================================== -/// -/// \addtogroup cpp_kodi_addon_game -/// @brief \cpp_class{ kodi::addon::CInstanceGame } -/// **Game add-on instance** -/// -/// This class is created at addon by Kodi. -/// -//------------------------------------------------------------------------------ -class ATTRIBUTE_HIDDEN CInstanceGame : public IAddonInstance -{ -public: - //============================================================================ - /// - /// @defgroup cpp_kodi_addon_game_Base 1. Basic functions - /// @ingroup cpp_kodi_addon_game - /// @brief **Functions to manage the addon and get basic information about it** - /// - /// - //@{ - - //============================================================================ - /// - /// @brief Game class constructor - /// - /// Used by an add-on that only supports only Game and only in one instance. - /// - /// This class is created at addon by Kodi. - /// - /// - /// -------------------------------------------------------------------------- - /// - /// - /// **Here's example about the use of this:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// ... - /// - /// class ATTRIBUTE_HIDDEN CGameExample - /// : public kodi::addon::CAddonBase, - /// public kodi::addon::CInstanceGame - /// { - /// public: - /// CGameExample() - /// { - /// } - /// - /// virtual ~CGameExample(); - /// { - /// } - /// - /// ... - /// }; - /// - /// ADDONCREATOR(CGameExample) - /// ~~~~~~~~~~~~~ - /// - CInstanceGame() : IAddonInstance(ADDON_INSTANCE_GAME, GetKodiTypeVersion(ADDON_INSTANCE_GAME)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstanceGame: Creation of more as one in single " - "instance way is not allowed!"); - - SetAddonStruct(CAddonBase::m_interface->firstKodiInstance); - CAddonBase::m_interface->globalSingleInstance = this; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Destructor - /// - ~CInstanceGame() override = default; - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief **Callback to Kodi Function**
The path of the game client being loaded. - /// - /// @return the used game client Dll path - /// - /// @remarks Only called from addon itself - /// - std::string GameClientDllPath() const - { - return m_instanceData->props.game_client_dll_path; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief **Callback to Kodi Function**
Paths to proxy DLLs used to load the game client. - /// - /// @param[out] paths vector list to store available dll paths - /// @return true if success and dll paths present - /// - /// @remarks Only called from addon itself - /// - bool ProxyDllPaths(std::vector& paths) - { - for (unsigned int i = 0; i < m_instanceData->props.proxy_dll_count; ++i) - { - if (m_instanceData->props.proxy_dll_paths[i] != nullptr) - paths.push_back(m_instanceData->props.proxy_dll_paths[i]); - } - return !paths.empty(); - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief **Callback to Kodi Function**
The "system" directories of the frontend - /// - /// These directories can be used to store system-specific ROMs such as - /// BIOSes, configuration data, etc. - /// - /// @return the used resource directory - /// - /// @remarks Only called from addon itself - /// - bool ResourceDirectories(std::vector& dirs) - { - for (unsigned int i = 0; i < m_instanceData->props.resource_directory_count; ++i) - { - if (m_instanceData->props.resource_directories[i] != nullptr) - dirs.push_back(m_instanceData->props.resource_directories[i]); - } - return !dirs.empty(); - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief **Callback to Kodi Function**
The writable directory of the frontend - /// - /// This directory can be used to store SRAM, memory cards, high scores, - /// etc, if the game client cannot use the regular memory interface, - /// GetMemoryData(). - /// - /// @return the used profile directory - /// - /// @remarks Only called from addon itself - /// - std::string ProfileDirectory() const - { - return m_instanceData->props.profile_directory; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief **Callback to Kodi Function**
The value of the property from addon.xml - /// - /// @return true if VFS is supported - /// - /// @remarks Only called from addon itself - /// - bool SupportsVFS() const - { - return m_instanceData->props.supports_vfs; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief **Callback to Kodi Function**
The extensions in the property from addon.xml - /// - /// @param[out] extensions vector list to store available extension - /// @return true if success and extensions present - /// - /// @remarks Only called from addon itself - /// - bool Extensions(std::vector& extensions) - { - for (unsigned int i = 0; i < m_instanceData->props.extension_count; ++i) - { - if (m_instanceData->props.extensions[i] != nullptr) - extensions.push_back(m_instanceData->props.extensions[i]); - } - return !extensions.empty(); - } - //---------------------------------------------------------------------------- - - //@} - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- - - //============================================================================ - /// - /// @defgroup cpp_kodi_addon_game_Operation 2. Game operations - /// @ingroup cpp_kodi_addon_game - /// @brief **Game operations** - /// - /// These are mandatory functions for using this addon to get the available - /// channels. - /// - //@{ - - //============================================================================ - /// - /// @brief Load a game - /// - /// @param[in] url The URL to load - /// @return the error, or @ref GAME_ERROR_NO_ERROR if the game was loaded - /// - virtual GAME_ERROR LoadGame(const std::string& url) - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Load a game that requires multiple files - /// - /// @param[in] type The game type - /// @param[in] urls An array of urls - /// @return the error, or @ref GAME_ERROR_NO_ERROR if the game was loaded - /// - virtual GAME_ERROR LoadGameSpecial(SPECIAL_GAME_TYPE type, const std::vector& urls) - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Begin playing without a game file - /// - /// If the add-on supports standalone mode, it must add the - /// tag to the extension point in addon.xml: - /// - /// false - /// - /// @return the error, or @ref GAME_ERROR_NO_ERROR if the game add-on was loaded - /// - virtual GAME_ERROR LoadStandalone() - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Unload the current game - /// - /// Unloads a currently loaded game - /// - /// @return the error, or @ref GAME_ERROR_NO_ERROR if the game was unloaded - /// - virtual GAME_ERROR UnloadGame() - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Get timing information about the loaded game - /// - /// @param[out] timing_info The info structure to fill - /// - /// @return the error, or @ref GAME_ERROR_NO_ERROR if info was filled - /// - virtual GAME_ERROR GetGameTiming(game_system_timing& timing_info) - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Get region of the loaded game - /// - /// @return the region, or @ref GAME_REGION_UNKNOWN if unknown or no game is loaded - /// - virtual GAME_REGION GetRegion() - { - return GAME_REGION_UNKNOWN; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Return true if the client requires the frontend to provide a game loop - /// - /// The game loop is a thread that calls RunFrame() in a loop at a rate - /// determined by the playback speed and the client's FPS. - /// - /// @return true if the frontend should provide a game loop, false otherwise - /// - virtual bool RequiresGameLoop() - { - return false; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Run a single frame for add-ons that use a game loop - /// - /// @return the error, or @ref GAME_ERROR_NO_ERROR if there was no error - /// - virtual GAME_ERROR RunFrame() - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Reset the current game - /// - /// @return the error, or @ref GAME_ERROR_NO_ERROR if the game was reset - /// - virtual GAME_ERROR Reset() - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief **Callback to Kodi Function**
Requests the frontend to stop the current game - /// - /// @remarks Only called from addon itself - /// - void CloseGame(void) { m_instanceData->toKodi.CloseGame(m_instanceData->toKodi.kodiInstance); } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @defgroup cpp_kodi_addon_game_Operation_CStream Class: CStream - /// @ingroup cpp_kodi_addon_game_Operation - /// @brief \cpp_class{ kodi::addon::CInstanceGame::CStream } - /// **Game stream handler** - /// - /// This class will be integrated into the addon, which can then open it if - /// necessary for the processing of an audio or video stream. - /// - /// - /// @note Callback to Kodi class - //@{ - class CStream - { - public: - CStream() = default; - - CStream(const game_stream_properties& properties) - { - Open(properties); - } - - ~CStream() - { - Close(); - } - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_game_Operation_CStream - /// @brief Create a stream for gameplay data - /// - /// @param[in] properties The stream properties - /// @return A stream handle, or `nullptr` on failure - /// - /// @remarks Only called from addon itself - /// - bool Open(const game_stream_properties& properties) - { - if (!CAddonBase::m_interface->globalSingleInstance) - return false; - - if (m_handle) - { - kodi::Log(ADDON_LOG_INFO, "kodi::addon::CInstanceGame::CStream already becomes reopened"); - Close(); - } - - AddonToKodiFuncTable_Game& cb = - static_cast(CAddonBase::m_interface->globalSingleInstance) - ->m_instanceData->toKodi; - m_handle = cb.OpenStream(cb.kodiInstance, &properties); - return m_handle != nullptr; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_game_Operation_CStream - /// @brief Free the specified stream - /// - /// @remarks Only called from addon itself - /// - void Close() - { - if (!m_handle || !CAddonBase::m_interface->globalSingleInstance) - return; - - AddonToKodiFuncTable_Game& cb = - static_cast(CAddonBase::m_interface->globalSingleInstance) - ->m_instanceData->toKodi; - cb.CloseStream(cb.kodiInstance, m_handle); - m_handle = nullptr; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_game_Operation_CStream - /// @brief Get a buffer for zero-copy stream data - /// - /// @param[in] width The framebuffer width, or 0 for no width specified - /// @param[in] height The framebuffer height, or 0 for no height specified - /// @param[out] buffer The buffer, or unmodified if false is returned - /// @return True if buffer was set, false otherwise - /// - /// @note If this returns true, buffer must be freed using \ref ReleaseBuffer(). - /// - /// @remarks Only called from addon itself - /// - bool GetBuffer(unsigned int width, unsigned int height, game_stream_buffer& buffer) - { - if (!m_handle || !CAddonBase::m_interface->globalSingleInstance) - return false; - - AddonToKodiFuncTable_Game& cb = - static_cast(CAddonBase::m_interface->globalSingleInstance) - ->m_instanceData->toKodi; - return cb.GetStreamBuffer(cb.kodiInstance, m_handle, width, height, &buffer); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_game_Operation_CStream - /// @brief Add a data packet to a stream - /// - /// @param[in] packet The data packet - /// - /// @remarks Only called from addon itself - /// - void AddData(const game_stream_packet& packet) - { - if (!m_handle || !CAddonBase::m_interface->globalSingleInstance) - return; - - AddonToKodiFuncTable_Game& cb = - static_cast(CAddonBase::m_interface->globalSingleInstance) - ->m_instanceData->toKodi; - cb.AddStreamData(cb.kodiInstance, m_handle, &packet); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_game_Operation_CStream - /// @brief Free an allocated buffer - /// - /// @param[in] buffer The buffer returned from GetStreamBuffer() - /// - /// @remarks Only called from addon itself - /// - void ReleaseBuffer(game_stream_buffer& buffer) - { - if (!m_handle || !CAddonBase::m_interface->globalSingleInstance) - return; - - AddonToKodiFuncTable_Game& cb = - static_cast(CAddonBase::m_interface->globalSingleInstance) - ->m_instanceData->toKodi; - cb.ReleaseStreamBuffer(cb.kodiInstance, m_handle, &buffer); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_game_Operation_CStream - /// @brief To check stream open was OK, e.g. after use of constructor - /// - /// @return true if stream was successfully opened - /// - /// @remarks Only called from addon itself - /// - bool IsOpen() const { return m_handle != nullptr; } - //-------------------------------------------------------------------------- - - private: - void* m_handle = nullptr; - }; - //@} - - //@} - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- - - //============================================================================ - /// - /// @defgroup cpp_kodi_addon_game_HardwareRendering 3. Hardware rendering operations - /// @ingroup cpp_kodi_addon_game - /// @brief **Hardware rendering operations** - /// - //@{ - - //============================================================================ - /// - /// @brief Invalidates the current HW context and reinitializes GPU resources - /// - /// Any GL state is lost, and must not be deinitialized explicitly. - /// - /// @return the error, or @ref GAME_ERROR_NO_ERROR if the HW context was reset - /// - virtual GAME_ERROR HwContextReset() - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Called before the context is destroyed - /// - /// Resources can be deinitialized at this step. - /// - /// @return the error, or @ref GAME_ERROR_NO_ERROR if the HW context was destroyed - /// - virtual GAME_ERROR HwContextDestroy() - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - - //============================================================================ - /// - /// @brief **Callback to Kodi Function**
Get a symbol from the hardware context - /// - /// @param[in] sym The symbol's name - /// - /// @return A function pointer for the specified symbol - /// - /// @remarks Only called from addon itself - /// - game_proc_address_t HwGetProcAddress(const char* sym) - { - return m_instanceData->toKodi.HwGetProcAddress(m_instanceData->toKodi.kodiInstance, sym); - } - //---------------------------------------------------------------------------- - - //@} - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- - - //============================================================================ - /// - /// @defgroup cpp_kodi_addon_game_InputOperations 4. Input operations - /// @ingroup cpp_kodi_addon_game - /// @brief **Input operations** - /// - //@{ - - //============================================================================ - /// - /// @brief Check if input is accepted for a feature on the controller - /// - /// If only a subset of the controller profile is used, this can return false - /// for unsupported features to not absorb their input. - /// - /// If the entire controller profile is used, this should always return true. - /// - /// @param[in] controller_id The ID of the controller profile - /// @param[in] feature_name The name of a feature in that profile - /// @return true if input is accepted for the feature, false otherwise - /// - virtual bool HasFeature(const std::string& controller_id, const std::string& feature_name) - { - return false; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Get the input topology that specifies which controllers can be connected - /// - /// @return The input topology, or null to use the default - /// - /// If this returns non-null, topology must be freed using FreeTopology(). - /// - /// If this returns null, the topology will default to a single port that can - /// accept all controllers imported by addon.xml. The port ID is set to - /// the @ref DEFAULT_PORT_ID constant. - /// - virtual game_input_topology* GetTopology() - { - return nullptr; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Free the topology's resources - /// - /// @param[in] topology The topology returned by GetTopology() - /// - virtual void FreeTopology(game_input_topology* topology) - { - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Set the layouts for known controllers - /// - /// @param[in] controllers The controller layouts - /// - /// After loading the input topology, the frontend will call this with - /// controller layouts for all controllers discovered in the topology. - /// - virtual void SetControllerLayouts(const std::vector& controllers) - { - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Enable/disable keyboard input using the specified controller - /// - /// @param[in] enable True to enable input, false otherwise - /// @param[in] controller_id The controller ID if enabling, or unused if disabling - /// - /// @return True if keyboard input was enabled, false otherwise - /// - virtual bool EnableKeyboard(bool enable, const std::string& controller_id) - { - return false; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Enable/disable mouse input using the specified controller - /// - /// @param[in] enable True to enable input, false otherwise - /// @param[in] controller_id The controller ID if enabling, or unused if disabling - /// - /// @return True if mouse input was enabled, false otherwise - /// - virtual bool EnableMouse(bool enable, const std::string& controller_id) - { - return false; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @brief Connect/disconnect a controller to a port on the virtual game console - /// - /// @param[in] connect True to connect a controller, false to disconnect - /// @param[in] port_address The address of the port - /// @param[in] controller_id The controller ID if connecting, or unused if disconnecting - /// @return True if the \p controller was (dis-)connected to the port, false otherwise - /// - /// The address is a string that allows traversal of the controller topology. - /// It is formed by alternating port IDs and controller IDs separated by "/". - /// - /// For example, assume that the topology represented in XML for Snes9x is: - /// - /// ~~~~~~~~~~~~~{.xml} - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// ... - /// - /// - /// - /// ~~~~~~~~~~~~~ - /// - /// To connect a multitap to the console's first port, the multitap's controller - /// info is set using the port address: - /// - /// 1 - /// - /// To connect a SNES controller to the second port of the multitap, the - /// controller info is next set using the address: - /// - /// 1/game.controller.multitap/2 - /// - /// Any attempts to connect a controller to a port on a disconnected multitap - /// will return false. - /// - virtual bool ConnectController(bool connect, - const std::string& port_address, - const std::string& controller_id) - { - return false; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Notify the add-on of an input event - /// - /// @param[in] event The input event - /// - /// @return true if the event was handled, false otherwise - /// - virtual bool InputEvent(const game_input_event& event) - { - return false; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief **Callback to Kodi Function**
Notify the port of an input event - /// - /// @param[in] event The input event - /// @return true if the event was handled, false otherwise - /// - /// @note Input events can arrive for the following sources: - /// - \ref GAME_INPUT_EVENT_MOTOR - /// - /// @remarks Only called from addon itself - /// - bool KodiInputEvent(const game_input_event& event) - { - return m_instanceData->toKodi.InputEvent(m_instanceData->toKodi.kodiInstance, &event); - } - //---------------------------------------------------------------------------- - - //@} - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- - - //============================================================================ - /// - /// @defgroup cpp_kodi_addon_game_SerializationOperations 5. Serialization operations - /// @ingroup cpp_kodi_addon_game - /// @brief **Serialization operations** - /// - //@{ - - //============================================================================ - /// - /// @brief Get the number of bytes required to serialize the game - /// - /// @return the number of bytes, or 0 if serialization is not supported - /// - virtual size_t SerializeSize() - { - return 0; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Serialize the state of the game - /// - /// @param[in] data The buffer receiving the serialized game data - /// @param[in] size The size of the buffer - /// - /// @return the error, or @ref GAME_ERROR_NO_ERROR if the game was serialized into the buffer - /// - virtual GAME_ERROR Serialize(uint8_t* data, size_t size) - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Deserialize the game from the given state - /// - /// @param[in] data A buffer containing the game's new state - /// @param[in] size The size of the buffer - /// - /// @return the error, or @ref GAME_ERROR_NO_ERROR if the game deserialized - /// - virtual GAME_ERROR Deserialize(const uint8_t* data, size_t size) - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //@} - -//--==----==----==----==----==----==----==----==----==----==----==----==----==-- - - //============================================================================ - /// - /// @defgroup cpp_kodi_addon_game_CheatOperations 6. Cheat operations - /// @ingroup cpp_kodi_addon_game - /// @brief **Cheat operations** - /// - //@{ - - //============================================================================ - /// - /// @brief Reset the cheat system - /// - /// @return the error, or @ref GAME_ERROR_NO_ERROR if the cheat system was reset - /// - virtual GAME_ERROR CheatReset() - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Get a region of memory - /// - /// @param[in] type The type of memory to retrieve - /// @param[in] data Set to the region of memory; must remain valid until UnloadGame() is called - /// @param[in] size Set to the size of the region of memory - /// - /// @return the error, or @ref GAME_ERROR_NO_ERROR if data was set to a valid buffer - /// - virtual GAME_ERROR GetMemory(GAME_MEMORY type, uint8_t*& data, size_t& size) - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Set a cheat code - /// - /// @param[in] index - /// @param[in] enabled - /// @param[in] code - /// - /// @return the error, or @ref GAME_ERROR_NO_ERROR if the cheat was set - /// - virtual GAME_ERROR SetCheat(unsigned int index, bool enabled, const std::string& code) - { - return GAME_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //@} - -private: - void SetAddonStruct(KODI_HANDLE instance) - { - if (instance == nullptr) - throw std::logic_error("kodi::addon::CInstanceGame: Creation with empty addon structure not" - "allowed, table must be given from Kodi!"); - - m_instanceData = static_cast(instance); - m_instanceData->toAddon.addonInstance = this; - - m_instanceData->toAddon.LoadGame = ADDON_LoadGame; - m_instanceData->toAddon.LoadGameSpecial = ADDON_LoadGameSpecial; - m_instanceData->toAddon.LoadStandalone = ADDON_LoadStandalone; - m_instanceData->toAddon.UnloadGame = ADDON_UnloadGame; - m_instanceData->toAddon.GetGameTiming = ADDON_GetGameTiming; - m_instanceData->toAddon.GetRegion = ADDON_GetRegion; - m_instanceData->toAddon.RequiresGameLoop = ADDON_RequiresGameLoop; - m_instanceData->toAddon.RunFrame = ADDON_RunFrame; - m_instanceData->toAddon.Reset = ADDON_Reset; - - m_instanceData->toAddon.HwContextReset = ADDON_HwContextReset; - m_instanceData->toAddon.HwContextDestroy = ADDON_HwContextDestroy; - - m_instanceData->toAddon.HasFeature = ADDON_HasFeature; - m_instanceData->toAddon.GetTopology = ADDON_GetTopology; - m_instanceData->toAddon.FreeTopology = ADDON_FreeTopology; - m_instanceData->toAddon.SetControllerLayouts = ADDON_SetControllerLayouts; - m_instanceData->toAddon.EnableKeyboard = ADDON_EnableKeyboard; - m_instanceData->toAddon.EnableMouse = ADDON_EnableMouse; - m_instanceData->toAddon.ConnectController = ADDON_ConnectController; - m_instanceData->toAddon.InputEvent = ADDON_InputEvent; - - m_instanceData->toAddon.SerializeSize = ADDON_SerializeSize; - m_instanceData->toAddon.Serialize = ADDON_Serialize; - m_instanceData->toAddon.Deserialize = ADDON_Deserialize; - - m_instanceData->toAddon.CheatReset = ADDON_CheatReset; - m_instanceData->toAddon.GetMemory = ADDON_GetMemory; - m_instanceData->toAddon.SetCheat = ADDON_SetCheat; - } - - // --- Game operations --------------------------------------------------------- - - inline static GAME_ERROR ADDON_LoadGame(const AddonInstance_Game* instance, const char* url) - { - return instance->toAddon.addonInstance->LoadGame(url); - } - - inline static GAME_ERROR ADDON_LoadGameSpecial(const AddonInstance_Game* instance, - SPECIAL_GAME_TYPE type, - const char** urls, - size_t urlCount) - { - std::vector urlList; - for (size_t i = 0; i < urlCount; ++i) - { - if (urls[i] != nullptr) - urlList.push_back(urls[i]); - } - - return instance->toAddon.addonInstance->LoadGameSpecial(type, urlList); - } - - inline static GAME_ERROR ADDON_LoadStandalone(const AddonInstance_Game* instance) - { - return instance->toAddon.addonInstance->LoadStandalone(); - } - - inline static GAME_ERROR ADDON_UnloadGame(const AddonInstance_Game* instance) - { - return instance->toAddon.addonInstance->UnloadGame(); - } - - inline static GAME_ERROR ADDON_GetGameTiming(const AddonInstance_Game* instance, - game_system_timing* timing_info) - { - return instance->toAddon.addonInstance->GetGameTiming(*timing_info); - } - - inline static GAME_REGION ADDON_GetRegion(const AddonInstance_Game* instance) - { - return instance->toAddon.addonInstance->GetRegion(); - } - - inline static bool ADDON_RequiresGameLoop(const AddonInstance_Game* instance) - { - return instance->toAddon.addonInstance->RequiresGameLoop(); - } - - inline static GAME_ERROR ADDON_RunFrame(const AddonInstance_Game* instance) - { - return instance->toAddon.addonInstance->RunFrame(); - } - - inline static GAME_ERROR ADDON_Reset(const AddonInstance_Game* instance) - { - return instance->toAddon.addonInstance->Reset(); - } - - - // --- Hardware rendering operations ------------------------------------------- - - inline static GAME_ERROR ADDON_HwContextReset(const AddonInstance_Game* instance) - { - return instance->toAddon.addonInstance->HwContextReset(); - } - - inline static GAME_ERROR ADDON_HwContextDestroy(const AddonInstance_Game* instance) - { - return instance->toAddon.addonInstance->HwContextDestroy(); - } - - - // --- Input operations -------------------------------------------------------- - - inline static bool ADDON_HasFeature(const AddonInstance_Game* instance, - const char* controller_id, - const char* feature_name) - { - return instance->toAddon.addonInstance->HasFeature(controller_id, feature_name); - } - - inline static game_input_topology* ADDON_GetTopology(const AddonInstance_Game* instance) - { - return instance->toAddon.addonInstance->GetTopology(); - } - - inline static void ADDON_FreeTopology(const AddonInstance_Game* instance, - game_input_topology* topology) - { - instance->toAddon.addonInstance->FreeTopology(topology); - } - - inline static void ADDON_SetControllerLayouts(const AddonInstance_Game* instance, - const game_controller_layout* controllers, - unsigned int controller_count) - { - if (controllers == nullptr) - return; - - std::vector controllerList; - for (unsigned int i = 0; i < controller_count; ++i) - controllerList.push_back(controllers[i]); - - instance->toAddon.addonInstance->SetControllerLayouts(controllerList); - } - - inline static bool ADDON_EnableKeyboard(const AddonInstance_Game* instance, - bool enable, - const char* controller_id) - { - return instance->toAddon.addonInstance->EnableKeyboard(enable, controller_id); - } - - inline static bool ADDON_EnableMouse(const AddonInstance_Game* instance, - bool enable, - const char* controller_id) - { - return instance->toAddon.addonInstance->EnableMouse(enable, controller_id); - } - - inline static bool ADDON_ConnectController(const AddonInstance_Game* instance, - bool connect, - const char* port_address, - const char* controller_id) - { - return instance->toAddon.addonInstance->ConnectController(connect, port_address, controller_id); - } - - inline static bool ADDON_InputEvent(const AddonInstance_Game* instance, - const game_input_event* event) - { - return instance->toAddon.addonInstance->InputEvent(*event); - } - - - // --- Serialization operations ------------------------------------------------ - - inline static size_t ADDON_SerializeSize(const AddonInstance_Game* instance) - { - return instance->toAddon.addonInstance->SerializeSize(); - } - - inline static GAME_ERROR ADDON_Serialize(const AddonInstance_Game* instance, - uint8_t* data, - size_t size) - { - return instance->toAddon.addonInstance->Serialize(data, size); - } - - inline static GAME_ERROR ADDON_Deserialize(const AddonInstance_Game* instance, - const uint8_t* data, - size_t size) - { - return instance->toAddon.addonInstance->Deserialize(data, size); - } - - - // --- Cheat operations -------------------------------------------------------- - - inline static GAME_ERROR ADDON_CheatReset(const AddonInstance_Game* instance) - { - return instance->toAddon.addonInstance->CheatReset(); - } - - inline static GAME_ERROR ADDON_GetMemory(const AddonInstance_Game* instance, - GAME_MEMORY type, - uint8_t** data, - size_t* size) - { - return instance->toAddon.addonInstance->GetMemory(type, *data, *size); - } - - inline static GAME_ERROR ADDON_SetCheat(const AddonInstance_Game* instance, - unsigned int index, - bool enabled, - const char* code) - { - return instance->toAddon.addonInstance->SetCheat(index, enabled, code); - } - - AddonInstance_Game* m_instanceData; -}; - -} /* namespace addon */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/ImageDecoder.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/ImageDecoder.h deleted file mode 100644 index e41e5ef..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/ImageDecoder.h +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../AddonBase.h" -#include "../c-api/addon-instance/image_decoder.h" - -#ifdef __cplusplus -namespace kodi -{ -namespace addon -{ - -//############################################################################## -/// @defgroup cpp_kodi_addon_imagedecoder_Defs Definitions, structures and enumerators -/// @ingroup cpp_kodi_addon_imagedecoder -/// @brief **Image decoder add-on general variables** -/// -/// Used to exchange the available options between Kodi and addon. -/// -/// - -//============================================================================== -/// -/// @addtogroup cpp_kodi_addon_imagedecoder -/// @brief @cpp_class{ kodi::addon::CInstanceImageDecoder } -/// **Image decoder add-on instance**\n -/// This instance type is used to allow Kodi various additional image format -/// types. -/// -/// This usage can be requested under various conditions, by a Mimetype protocol -/// defined in `addon.xml` or supported file extensions. -/// -/// Include the header @ref ImageDecoder.h "#include " -/// to use this class. -/// -/// ---------------------------------------------------------------------------- -/// -/// Here is an example of what the `addon.xml.in` would look like for an -/// image decoder addon: -/// -/// ~~~~~~~~~~~~~{.xml} -/// -/// -/// @ADDON_DEPENDS@ -/// -/// -/// My image decoder addon summary -/// My image decoder description -/// @PLATFORM@ -/// -/// -/// ~~~~~~~~~~~~~ -/// -/// ### Standard values that can be declared for processing in `addon.xml`. -/// -/// These values are used by Kodi to identify associated images and file -/// extensions and then to select the associated addon. -/// -/// \table_start -/// \table_h3{ Labels, Type, Description } -/// \table_row3{ `point`, -/// @anchor cpp_kodi_addon_imagedecoder_point -/// string, -/// The identification of the addon instance to image decoder is mandatory -/// `kodi.imagedecoder`. In addition\, the instance declared in the -/// first `` is also the main type of addon. -/// } -/// \table_row3{ `extension`, -/// @anchor cpp_kodi_addon_imagedecoder_defaultPort -/// string, -/// The from addon operated and supported image file endings.\n -/// Use a `|` to separate between different ones. -/// } -/// \table_row3{ `defaultPort`, -/// @anchor cpp_kodi_addon_imagedecoder_defaultPort -/// string, -/// The from addon operated image [mimetypes](https://en.wikipedia.org/wiki/Media_type).\n -/// Use a `|` to separate between different ones. -/// } -/// \table_row3{ `library_@PLATFORM@`, -/// @anchor cpp_kodi_addon_imagedecoder_library -/// string, -/// The runtime library used for the addon. This is usually declared by `cmake` and correctly displayed in the translated `addon.xml`. -/// } -/// \table_end -/// -/// @remark For more detailed description of the `addon.xml`, see also https://kodi.wiki/view/Addon.xml. -/// -/// -/// -------------------------------------------------------------------------- -/// -/// -/// **Example:** -/// -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// class ATTRIBUTE_HIDDEN CMyImageDecoder : public kodi::addon::CInstanceImageDecoder -/// { -/// public: -/// CMyImageDecoder(KODI_HANDLE instance, const std::string& kodiVersion); -/// -/// bool LoadImageFromMemory(unsigned char* buffer, -/// unsigned int bufSize, -/// unsigned int& width, -/// unsigned int& height) override; -/// -/// bool Decode(unsigned char* pixels, -/// unsigned int width, -/// unsigned int height, -/// unsigned int pitch, -/// ImageFormat format) override; -/// -/// ... -/// }; -/// -/// CMyImageDecoder::CMyImageDecoder(KODI_HANDLE instance, const std::string& kodiVersion) -/// : CInstanceImageDecoder(instance, kodiVersion) -/// { -/// ... -/// } -/// -/// bool CMyImageDecoder::LoadImageFromMemory(unsigned char* buffer, -/// unsigned int bufSize, -/// unsigned int& width, -/// unsigned int& height) -/// { -/// ... -/// return true; -/// } -/// -/// bool CMyImageDecoder::Decode(unsigned char* pixels, -/// unsigned int width, -/// unsigned int height, -/// unsigned int pitch, -/// ImageFormat format) override; -/// { -/// ... -/// return true; -/// } -/// -/// //---------------------------------------------------------------------- -/// -/// class ATTRIBUTE_HIDDEN CMyAddon : public kodi::addon::CAddonBase -/// { -/// public: -/// CMyAddon() = default; -/// ADDON_STATUS CreateInstance(int instanceType, -/// const std::string& instanceID, -/// KODI_HANDLE instance, -/// const std::string& version, -/// KODI_HANDLE& addonInstance) override; -/// }; -/// -/// // If you use only one instance in your add-on, can be instanceType and -/// // instanceID ignored -/// ADDON_STATUS CMyAddon::CreateInstance(int instanceType, -/// const std::string& instanceID, -/// KODI_HANDLE instance, -/// const std::string& version, -/// KODI_HANDLE& addonInstance) -/// { -/// if (instanceType == ADDON_INSTANCE_IMAGEDECODER) -/// { -/// kodi::Log(ADDON_LOG_NOTICE, "Creating my image decoder instance"); -/// addonInstance = new CMyImageDecoder(instance, version); -/// return ADDON_STATUS_OK; -/// } -/// else if (...) -/// { -/// ... -/// } -/// return ADDON_STATUS_UNKNOWN; -/// } -/// -/// ADDONCREATOR(CMyAddon) -/// ~~~~~~~~~~~~~ -/// -/// The destruction of the example class `CMyImageDecoder` is called from -/// Kodi's header. Manually deleting the add-on instance is not required. -/// -//------------------------------------------------------------------------------ -class ATTRIBUTE_HIDDEN CInstanceImageDecoder : public IAddonInstance -{ -public: - //============================================================================ - /// @ingroup cpp_kodi_addon_imagedecoder - /// @brief Class constructor. - /// - /// @param[in] instance The from Kodi given instance given be add-on - /// CreateInstance call with instance id - /// @ref ADDON_INSTANCE_IMAGEDECODER. - /// @param[in] kodiVersion [opt] Version used in Kodi for this instance, to - /// allow compatibility to older Kodi versions. - /// - /// @note Recommended to set `kodiVersion`. - /// - explicit CInstanceImageDecoder(KODI_HANDLE instance, const std::string& kodiVersion = "") - : IAddonInstance(ADDON_INSTANCE_IMAGEDECODER, - !kodiVersion.empty() ? kodiVersion - : GetKodiTypeVersion(ADDON_INSTANCE_IMAGEDECODER)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstanceImageDecoder: Creation of multiple together " - "with single instance way is not allowed!"); - - SetAddonStruct(instance); - } - //---------------------------------------------------------------------------- - - ~CInstanceImageDecoder() override = default; - - //============================================================================ - /// @ingroup cpp_kodi_addon_imagedecoder - /// @brief Initialize an encoder. - /// - /// @param[in] buffer The data to read from memory - /// @param[in] bufSize The buffer size - /// @param[in,out] width The optimal width of image on entry, obtained width - /// on return - /// @param[in,out] height The optimal height of image, actual obtained height - /// on return - /// @return true if successful done, false on error - /// - virtual bool LoadImageFromMemory(unsigned char* buffer, - unsigned int bufSize, - unsigned int& width, - unsigned int& height) = 0; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_imagedecoder - /// @brief Decode previously loaded image. - /// - /// @param[in] pixels Output buffer - /// @param[in] width Width of output image - /// @param[in] height Height of output image - /// @param[in] pitch Pitch of output image - /// @param[in] format Format of output image - /// @return true if successful done, false on error - /// - virtual bool Decode(unsigned char* pixels, - unsigned int width, - unsigned int height, - unsigned int pitch, - ImageFormat format) = 0; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_imagedecoder - /// @brief **Callback to Kodi Function**\n - /// Get the wanted mime type from Kodi. - /// - /// @return the mimetype wanted from Kodi - /// - /// @remarks Only called from addon itself. - /// - inline std::string MimeType() { return m_instanceData->props->mimetype; } - //---------------------------------------------------------------------------- - -private: - void SetAddonStruct(KODI_HANDLE instance) - { - if (instance == nullptr) - throw std::logic_error("kodi::addon::CInstanceImageDecoder: Creation with empty addon " - "structure not allowed, table must be given from Kodi!"); - - m_instanceData = static_cast(instance); - m_instanceData->toAddon->addonInstance = this; - m_instanceData->toAddon->load_image_from_memory = ADDON_LoadImageFromMemory; - m_instanceData->toAddon->decode = ADDON_Decode; - } - - inline static bool ADDON_LoadImageFromMemory(const AddonInstance_ImageDecoder* instance, - unsigned char* buffer, - unsigned int bufSize, - unsigned int* width, - unsigned int* height) - { - return static_cast(instance->toAddon->addonInstance) - ->LoadImageFromMemory(buffer, bufSize, *width, *height); - } - - inline static bool ADDON_Decode(const AddonInstance_ImageDecoder* instance, - unsigned char* pixels, - unsigned int width, - unsigned int height, - unsigned int pitch, - enum ImageFormat format) - { - return static_cast(instance->toAddon->addonInstance) - ->Decode(pixels, width, height, pitch, format); - } - - AddonInstance_ImageDecoder* m_instanceData; -}; - -} /* namespace addon */ -} /* namespace kodi */ -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Inputstream.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Inputstream.h deleted file mode 100644 index 354806e..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Inputstream.h +++ /dev/null @@ -1,881 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -/* - * Parts with a comment named "internal" are only used inside header and not - * used or accessed direct during add-on development! - */ - -#include "../AddonBase.h" -#include "../StreamCodec.h" -#include "../StreamCrypto.h" - -#ifdef BUILD_KODI_ADDON -#include "../DemuxPacket.h" -#include "../InputStreamConstants.h" -#else -#include "cores/VideoPlayer/Interface/Addon/DemuxPacket.h" -#include "cores/VideoPlayer/Interface/Addon/InputStreamConstants.h" -#endif - -//Increment this level always if you add features which can lead to compile failures in the addon -#define INPUTSTREAM_VERSION_LEVEL 2 - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - /*! - * @brief InputStream add-on capabilities. All capabilities are set to "false" as default. - */ - struct INPUTSTREAM_CAPABILITIES - { - enum MASKTYPE : uint32_t - { - /// supports interface IDemux - SUPPORTS_IDEMUX = (1 << 0), - - /// supports interface IPosTime - SUPPORTS_IPOSTIME = (1 << 1), - - /// supports interface IDisplayTime - SUPPORTS_IDISPLAYTIME = (1 << 2), - - /// supports seek - SUPPORTS_SEEK = (1 << 3), - - /// supports pause - SUPPORTS_PAUSE = (1 << 4), - - /// supports interface ITime - SUPPORTS_ITIME = (1 << 5), - - /// supports interface IChapter - SUPPORTS_ICHAPTER = (1 << 6), - }; - - /// set of supported capabilities - uint32_t m_mask; - }; - - /*! - * @brief structure of key/value pairs passed to addon on Open() - */ - struct INPUTSTREAM - { - const char* m_strURL; - const char* m_mimeType; - - unsigned int m_nCountInfoValues; - struct LISTITEMPROPERTY - { - const char* m_strKey; - const char* m_strValue; - } m_ListItemProperties[STREAM_MAX_PROPERTY_COUNT]; - - const char* m_libFolder; - const char* m_profileFolder; - }; - - /*! - * @brief Array of stream IDs - */ - struct INPUTSTREAM_IDS - { - static const unsigned int MAX_STREAM_COUNT = 256; - unsigned int m_streamCount; - unsigned int m_streamIds[MAX_STREAM_COUNT]; - }; - - /*! - * @brief MASTERING Metadata - */ - struct INPUTSTREAM_MASTERING_METADATA - { - double primary_r_chromaticity_x; - double primary_r_chromaticity_y; - double primary_g_chromaticity_x; - double primary_g_chromaticity_y; - double primary_b_chromaticity_x; - double primary_b_chromaticity_y; - double white_point_chromaticity_x; - double white_point_chromaticity_y; - double luminance_max; - double luminance_min; - }; - - /*! - * @brief CONTENTLIGHT Metadata - */ - struct INPUTSTREAM_CONTENTLIGHT_METADATA - { - uint64_t max_cll; - uint64_t max_fall; - }; - - /*! - * @brief stream properties - */ - struct INPUTSTREAM_INFO - { - enum STREAM_TYPE - { - TYPE_NONE = 0, - TYPE_VIDEO, - TYPE_AUDIO, - TYPE_SUBTITLE, - TYPE_TELETEXT, - TYPE_RDS, - } m_streamType; - - enum Codec_FEATURES : uint32_t - { - FEATURE_DECODE = 1 - }; - uint32_t m_features; - - enum STREAM_FLAGS : uint32_t - { - FLAG_NONE = 0x0000, - FLAG_DEFAULT = 0x0001, - FLAG_DUB = 0x0002, - FLAG_ORIGINAL = 0x0004, - FLAG_COMMENT = 0x0008, - FLAG_LYRICS = 0x0010, - FLAG_KARAOKE = 0x0020, - FLAG_FORCED = 0x0040, - FLAG_HEARING_IMPAIRED = 0x0080, - FLAG_VISUAL_IMPAIRED = 0x0100, - }; - - // Keep in sync with AVColorSpace - enum COLORSPACE - { - COLORSPACE_RGB = 0, - COLORSPACE_BT709 = 1, - COLORSPACE_UNSPECIFIED = 2, - COLORSPACE_UNKNOWN = COLORSPACE_UNSPECIFIED, // compatibility - COLORSPACE_RESERVED = 3, - COLORSPACE_FCC = 4, - COLORSPACE_BT470BG = 5, - COLORSPACE_SMPTE170M = 6, - COLORSPACE_SMPTE240M = 7, - COLORSPACE_YCGCO = 8, - COLORSPACE_YCOCG = COLORSPACE_YCGCO, - COLORSPACE_BT2020_NCL = 9, - COLORSPACE_BT2020_CL = 10, - COLORSPACE_SMPTE2085 = 11, - COLORSPACE_CHROMA_DERIVED_NCL = 12, - COLORSPACE_CHROMA_DERIVED_CL = 13, - COLORSPACE_ICTCP = 14, - COLORSPACE_MAX - }; - - // Keep in sync with AVColorPrimaries - enum COLORPRIMARIES : int32_t - { - COLORPRIMARY_RESERVED0 = 0, - COLORPRIMARY_BT709 = 1, - COLORPRIMARY_UNSPECIFIED = 2, - COLORPRIMARY_RESERVED = 3, - COLORPRIMARY_BT470M = 4, - COLORPRIMARY_BT470BG = 5, - COLORPRIMARY_SMPTE170M = 6, - COLORPRIMARY_SMPTE240M = 7, - COLORPRIMARY_FILM = 8, - COLORPRIMARY_BT2020 = 9, - COLORPRIMARY_SMPTE428 = 10, - COLORPRIMARY_SMPTEST428_1 = COLORPRIMARY_SMPTE428, - COLORPRIMARY_SMPTE431 = 11, - COLORPRIMARY_SMPTE432 = 12, - COLORPRIMARY_JEDEC_P22 = 22, - COLORPRIMARY_MAX - }; - - // Keep in sync with AVColorRange - enum COLORRANGE - { - COLORRANGE_UNKNOWN = 0, - COLORRANGE_LIMITED, - COLORRANGE_FULLRANGE, - COLORRANGE_MAX - }; - - // keep in sync with AVColorTransferCharacteristic - enum COLORTRC : int32_t - { - COLORTRC_RESERVED0 = 0, - COLORTRC_BT709 = 1, - COLORTRC_UNSPECIFIED = 2, - COLORTRC_RESERVED = 3, - COLORTRC_GAMMA22 = 4, - COLORTRC_GAMMA28 = 5, - COLORTRC_SMPTE170M = 6, - COLORTRC_SMPTE240M = 7, - COLORTRC_LINEAR = 8, - COLORTRC_LOG = 9, - COLORTRC_LOG_SQRT = 10, - COLORTRC_IEC61966_2_4 = 11, - COLORTRC_BT1361_ECG = 12, - COLORTRC_IEC61966_2_1 = 13, - COLORTRC_BT2020_10 = 14, - COLORTRC_BT2020_12 = 15, - COLORTRC_SMPTE2084 = 16, - COLORTRC_SMPTEST2084 = COLORTRC_SMPTE2084, - COLORTRC_SMPTE428 = 17, - COLORTRC_SMPTEST428_1 = COLORTRC_SMPTE428, - COLORTRC_ARIB_STD_B67 = 18, - COLORTRC_MAX - }; - - uint32_t m_flags; - - char m_name[256]; /*!< @brief (optinal) name of the stream, \0 for default handling */ - char m_codecName[32]; /*!< @brief (required) name of codec according to ffmpeg */ - char m_codecInternalName - [32]; /*!< @brief (optional) internal name of codec (selectionstream info) */ - STREAMCODEC_PROFILE m_codecProfile; /*!< @brief (optional) the profile of the codec */ - unsigned int m_pID; /*!< @brief (required) physical index */ - - const uint8_t* m_ExtraData; - unsigned int m_ExtraSize; - - char m_language[64]; /*!< @brief RFC 5646 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; - - CRYPTO_INFO m_cryptoInfo; - - // new in API version 2.0.8 - unsigned int m_codecFourCC; /*!< @brief Codec If available, the fourcc code codec */ - COLORSPACE m_colorSpace; /*!< @brief definition of colorspace */ - COLORRANGE m_colorRange; /*!< @brief color range if available */ - - //new in API 2.0.9 / INPUTSTREAM_VERSION_LEVEL 1 - COLORPRIMARIES m_colorPrimaries; - COLORTRC m_colorTransferCharacteristic; - INPUTSTREAM_MASTERING_METADATA* m_masteringMetadata; /*!< @brief mastering static Metadata */ - INPUTSTREAM_CONTENTLIGHT_METADATA* - m_contentLightMetadata; /*!< @brief content light static Metadata */ - }; - - struct INPUTSTREAM_TIMES - { - time_t startTime; - double ptsStart; - double ptsBegin; - double ptsEnd; - }; - - /*! - * @brief "C" ABI Structures to transfer the methods from this to Kodi - */ - - // this are properties given to the addon on create - // at this time we have no parameters for the addon - typedef struct AddonProps_InputStream /* internal */ - { - int dummy; - } AddonProps_InputStream; - - typedef struct AddonToKodiFuncTable_InputStream /* internal */ - { - KODI_HANDLE kodiInstance; - DemuxPacket* (*allocate_demux_packet)(void* kodiInstance, int data_size); - DemuxPacket* (*allocate_encrypted_demux_packet)(void* kodiInstance, - unsigned int data_size, - unsigned int encrypted_subsample_count); - void (*free_demux_packet)(void* kodiInstance, DemuxPacket* packet); - } AddonToKodiFuncTable_InputStream; - - struct AddonInstance_InputStream; - typedef struct KodiToAddonFuncTable_InputStream /* internal */ - { - KODI_HANDLE addonInstance; - - bool(__cdecl* open)(const AddonInstance_InputStream* instance, INPUTSTREAM* props); - void(__cdecl* close)(const AddonInstance_InputStream* instance); - const char*(__cdecl* get_path_list)(const AddonInstance_InputStream* instance); - void(__cdecl* get_capabilities)(const AddonInstance_InputStream* instance, - INPUTSTREAM_CAPABILITIES* capabilities); - - // IDemux - struct INPUTSTREAM_IDS(__cdecl* get_stream_ids)(const AddonInstance_InputStream* instance); - struct INPUTSTREAM_INFO(__cdecl* get_stream)(const AddonInstance_InputStream* instance, - int streamid); - void(__cdecl* enable_stream)(const AddonInstance_InputStream* instance, - int streamid, - bool enable); - bool(__cdecl* open_stream)(const AddonInstance_InputStream* instance, int streamid); - void(__cdecl* demux_reset)(const AddonInstance_InputStream* instance); - void(__cdecl* demux_abort)(const AddonInstance_InputStream* instance); - void(__cdecl* demux_flush)(const AddonInstance_InputStream* instance); - DemuxPacket*(__cdecl* demux_read)(const AddonInstance_InputStream* instance); - bool(__cdecl* demux_seek_time)(const AddonInstance_InputStream* instance, - double time, - bool backwards, - double* startpts); - void(__cdecl* demux_set_speed)(const AddonInstance_InputStream* instance, int speed); - void(__cdecl* set_video_resolution)(const AddonInstance_InputStream* instance, - int width, - int height); - - // IDisplayTime - int(__cdecl* get_total_time)(const AddonInstance_InputStream* instance); - int(__cdecl* get_time)(const AddonInstance_InputStream* instance); - - // ITime - bool(__cdecl* get_times)(const AddonInstance_InputStream* instance, INPUTSTREAM_TIMES* times); - - // IPosTime - bool(__cdecl* pos_time)(const AddonInstance_InputStream* instance, int ms); - - int(__cdecl* read_stream)(const AddonInstance_InputStream* instance, - uint8_t* buffer, - unsigned int bufferSize); - int64_t(__cdecl* seek_stream)(const AddonInstance_InputStream* instance, - int64_t position, - int whence); - int64_t(__cdecl* position_stream)(const AddonInstance_InputStream* instance); - int64_t(__cdecl* length_stream)(const AddonInstance_InputStream* instance); - bool(__cdecl* is_real_time_stream)(const AddonInstance_InputStream* instance); - - // IChapter - int(__cdecl* get_chapter)(const AddonInstance_InputStream* instance); - int(__cdecl* get_chapter_count)(const AddonInstance_InputStream* instance); - const char*(__cdecl* get_chapter_name)(const AddonInstance_InputStream* instance, int ch); - int64_t(__cdecl* get_chapter_pos)(const AddonInstance_InputStream* instance, int ch); - bool(__cdecl* seek_chapter)(const AddonInstance_InputStream* instance, int ch); - - int(__cdecl* block_size_stream)(const AddonInstance_InputStream* instance); - } KodiToAddonFuncTable_InputStream; - - typedef struct AddonInstance_InputStream /* internal */ - { - AddonProps_InputStream props; - AddonToKodiFuncTable_InputStream toKodi; - KodiToAddonFuncTable_InputStream toAddon; - } AddonInstance_InputStream; - -#ifdef __cplusplus -} /* extern "C" */ - -namespace kodi -{ -namespace addon -{ - -class ATTRIBUTE_HIDDEN CInstanceInputStream : public IAddonInstance -{ -public: - explicit CInstanceInputStream(KODI_HANDLE instance, const std::string& kodiVersion = "") - : IAddonInstance(ADDON_INSTANCE_INPUTSTREAM, - !kodiVersion.empty() ? kodiVersion - : GetKodiTypeVersion(ADDON_INSTANCE_INPUTSTREAM)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstanceInputStream: Creation of multiple together " - "with single instance way is not allowed!"); - - SetAddonStruct(instance, m_kodiVersion); - } - - ~CInstanceInputStream() override = default; - - /*! - * Open a stream. - * @param props - * @return True if the stream has been opened successfully, false otherwise. - * @remarks - */ - virtual bool Open(INPUTSTREAM& props) = 0; - - /*! - * Close an open stream. - * @remarks - */ - virtual void Close() = 0; - - /*! - * Get Capabilities of this addon. - * @param capabilities The add-on's capabilities. - * @remarks - */ - virtual void GetCapabilities(INPUTSTREAM_CAPABILITIES& capabilities) = 0; - - /*! - * Get IDs of available streams - * @remarks - */ - virtual INPUTSTREAM_IDS GetStreamIds() = 0; - - /*! - * Get stream properties of a stream. - * @param streamid unique id of stream - * @return struc of stream properties - * @remarks - */ - virtual INPUTSTREAM_INFO GetStream(int streamid) = 0; - - /*! - * 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 - */ - virtual void EnableStream(int streamid, bool enable) = 0; - - /*! - * Opens a stream for playback. - * @param streamid unique id of stream - * @remarks - */ - virtual bool OpenStream(int streamid) = 0; - - /*! - * Reset the demultiplexer in the add-on. - * @remarks Required if bHandlesDemuxing is set to true. - */ - virtual void DemuxReset() {} - - /*! - * Abort the demultiplexer thread in the add-on. - * @remarks Required if bHandlesDemuxing is set to true. - */ - virtual void DemuxAbort() {} - - /*! - * Flush all data that's currently in the demultiplexer buffer in the add-on. - * @remarks Required if bHandlesDemuxing is set to true. - */ - virtual void DemuxFlush() {} - - /*! - * 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 Kodi'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 occurred. - * @remarks Return NULL if this add-on won't provide this function. - */ - virtual DemuxPacket* DemuxRead() { return nullptr; } - - /*! - * Notify the InputStream addon/demuxer that Kodi 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. - */ - virtual bool DemuxSeekTime(double time, bool backwards, double& startpts) { return false; } - - /*! - * Notify the InputStream addon/demuxer that Kodi wishes to change playback speed - * @param speed The requested playback speed - * @remarks Optional, and only used if addon has its own demuxer. - */ - virtual void DemuxSetSpeed(int speed) {} - - /*! - * Sets desired width / height - * @param width / hight - */ - virtual void SetVideoResolution(int width, int height) {} - - /*! - * Totel time in ms - * @remarks - */ - virtual int GetTotalTime() { return -1; } - - /*! - * Playing time in ms - * @remarks - */ - virtual int GetTime() { return -1; } - - /*! - * Get current timing values in PTS scale - * @remarks - */ - virtual bool GetTimes(INPUTSTREAM_TIMES& times) { return false; } - - /*! - * Positions inputstream to playing time given in ms - * @remarks - */ - virtual bool PosTime(int ms) { return false; } - - /*! - * Return currently selected chapter - * @remarks - */ - virtual int GetChapter() { return -1; }; - - /*! - * Return number of available chapters - * @remarks - */ - virtual int GetChapterCount() { return 0; }; - - /*! - * Return name of chapter # ch - * @remarks - */ - virtual const char* GetChapterName(int ch) { return nullptr; }; - - /*! - * Return position if chapter # ch in milliseconds - * @remarks - */ - virtual int64_t GetChapterPos(int ch) { return 0; }; - - /*! - * Seek to the beginning of chapter # ch - * @remarks - */ - virtual bool SeekChapter(int ch) { return false; }; - - /*! - * Read from an open stream. - * @param buffer The buffer to store the data in. - * @param bufferSize 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. - */ - virtual int ReadStream(uint8_t* buffer, unsigned int bufferSize) { return -1; } - - /*! - * Seek in a stream. - * @param position The position to seek to. - * @param whence ? - * @return The new position. - * @remarks Return -1 if this add-on won't provide this function. - */ - virtual int64_t SeekStream(int64_t position, int whence = SEEK_SET) { return -1; } - - /*! - * @return The position in the stream that's currently being read. - * @remarks Return -1 if this add-on won't provide this function. - */ - virtual int64_t PositionStream() { return -1; } - - /*! - * @return The total length of the stream that's currently being read. - * @remarks Return -1 if this add-on won't provide this function. - */ - virtual int64_t LengthStream() { return -1; } - - /*! - * @return Obtain the chunk size to use when reading streams. - * @remarks Return 0 if this add-on won't provide this function. - */ - virtual int GetBlockSize() { return 0; } - - /*! - * Check for real-time streaming - * @return true if current stream is real-time - */ - virtual bool IsRealTimeStream() { return true; } - - /*! - * @brief Allocate a demux packet. Free with FreeDemuxPacket - * @param dataSize The size of the data that will go into the packet - * @return The allocated packet - */ - DemuxPacket* AllocateDemuxPacket(int dataSize) - { - return m_instanceData->toKodi.allocate_demux_packet(m_instanceData->toKodi.kodiInstance, - dataSize); - } - - /*! - * @brief Allocate a demux packet. Free with FreeDemuxPacket - * @param dataSize The size of the data that will go into the packet - * @return The allocated packet - */ - DemuxPacket* AllocateEncryptedDemuxPacket(int dataSize, unsigned int encryptedSubsampleCount) - { - return m_instanceData->toKodi.allocate_encrypted_demux_packet( - m_instanceData->toKodi.kodiInstance, dataSize, encryptedSubsampleCount); - } - - /*! - * @brief Free a packet that was allocated with AllocateDemuxPacket - * @param packet The packet to free - */ - void FreeDemuxPacket(DemuxPacket* packet) - { - return m_instanceData->toKodi.free_demux_packet(m_instanceData->toKodi.kodiInstance, packet); - } - -private: - static int compareVersion(const int v1[3], const int v2[3]) - { - for (unsigned i(0); i < 3; ++i) - if (v1[i] != v2[i]) - return v1[i] - v2[i]; - return 0; - } - - void SetAddonStruct(KODI_HANDLE instance, const std::string& kodiVersion) - { - if (instance == nullptr) - throw std::logic_error("kodi::addon::CInstanceInputStream: Creation with empty addon " - "structure not allowed, table must be given from Kodi!"); - int api[3] = { 0, 0, 0 }; - sscanf(kodiVersion.c_str(), "%d.%d.%d", &api[0], &api[1], &api[2]); - - m_instanceData = static_cast(instance); - m_instanceData->toAddon.addonInstance = this; - m_instanceData->toAddon.open = ADDON_Open; - m_instanceData->toAddon.close = ADDON_Close; - m_instanceData->toAddon.get_capabilities = ADDON_GetCapabilities; - - m_instanceData->toAddon.get_stream_ids = ADDON_GetStreamIds; - m_instanceData->toAddon.get_stream = ADDON_GetStream; - m_instanceData->toAddon.enable_stream = ADDON_EnableStream; - m_instanceData->toAddon.open_stream = ADDON_OpenStream; - m_instanceData->toAddon.demux_reset = ADDON_DemuxReset; - m_instanceData->toAddon.demux_abort = ADDON_DemuxAbort; - m_instanceData->toAddon.demux_flush = ADDON_DemuxFlush; - m_instanceData->toAddon.demux_read = ADDON_DemuxRead; - m_instanceData->toAddon.demux_seek_time = ADDON_DemuxSeekTime; - m_instanceData->toAddon.demux_set_speed = ADDON_DemuxSetSpeed; - m_instanceData->toAddon.set_video_resolution = ADDON_SetVideoResolution; - - m_instanceData->toAddon.get_total_time = ADDON_GetTotalTime; - m_instanceData->toAddon.get_time = ADDON_GetTime; - - m_instanceData->toAddon.get_times = ADDON_GetTimes; - m_instanceData->toAddon.pos_time = ADDON_PosTime; - - m_instanceData->toAddon.read_stream = ADDON_ReadStream; - m_instanceData->toAddon.seek_stream = ADDON_SeekStream; - m_instanceData->toAddon.position_stream = ADDON_PositionStream; - m_instanceData->toAddon.length_stream = ADDON_LengthStream; - m_instanceData->toAddon.is_real_time_stream = ADDON_IsRealTimeStream; - - int minChapterVersion[3] = { 2, 0, 10 }; - if (compareVersion(api, minChapterVersion) >= 0) - { - m_instanceData->toAddon.get_chapter = ADDON_GetChapter; - m_instanceData->toAddon.get_chapter_count = ADDON_GetChapterCount; - m_instanceData->toAddon.get_chapter_name = ADDON_GetChapterName; - m_instanceData->toAddon.get_chapter_pos = ADDON_GetChapterPos; - m_instanceData->toAddon.seek_chapter = ADDON_SeekChapter; - } - - int minBlockSizeVersion[3] = {2, 0, 12}; - if (compareVersion(api, minBlockSizeVersion) >= 0) - { - m_instanceData->toAddon.block_size_stream = ADDON_GetBlockSize; - } - } - - inline static bool ADDON_Open(const AddonInstance_InputStream* instance, INPUTSTREAM* props) - { - return static_cast(instance->toAddon.addonInstance)->Open(*props); - } - - inline static void ADDON_Close(const AddonInstance_InputStream* instance) - { - static_cast(instance->toAddon.addonInstance)->Close(); - } - - inline static void ADDON_GetCapabilities(const AddonInstance_InputStream* instance, - INPUTSTREAM_CAPABILITIES* capabilities) - { - static_cast(instance->toAddon.addonInstance) - ->GetCapabilities(*capabilities); - } - - - // IDemux - inline static struct INPUTSTREAM_IDS ADDON_GetStreamIds(const AddonInstance_InputStream* instance) - { - return static_cast(instance->toAddon.addonInstance)->GetStreamIds(); - } - - inline static struct INPUTSTREAM_INFO ADDON_GetStream(const AddonInstance_InputStream* instance, - int streamid) - { - return static_cast(instance->toAddon.addonInstance)->GetStream(streamid); - } - - inline static void ADDON_EnableStream(const AddonInstance_InputStream* instance, - int streamid, - bool enable) - { - static_cast(instance->toAddon.addonInstance) - ->EnableStream(streamid, enable); - } - - inline static bool ADDON_OpenStream(const AddonInstance_InputStream* instance, int streamid) - { - return static_cast(instance->toAddon.addonInstance) - ->OpenStream(streamid); - } - - inline static void ADDON_DemuxReset(const AddonInstance_InputStream* instance) - { - static_cast(instance->toAddon.addonInstance)->DemuxReset(); - } - - inline static void ADDON_DemuxAbort(const AddonInstance_InputStream* instance) - { - static_cast(instance->toAddon.addonInstance)->DemuxAbort(); - } - - inline static void ADDON_DemuxFlush(const AddonInstance_InputStream* instance) - { - static_cast(instance->toAddon.addonInstance)->DemuxFlush(); - } - - inline static DemuxPacket* ADDON_DemuxRead(const AddonInstance_InputStream* instance) - { - return static_cast(instance->toAddon.addonInstance)->DemuxRead(); - } - - inline static bool ADDON_DemuxSeekTime(const AddonInstance_InputStream* instance, - double time, - bool backwards, - double* startpts) - { - return static_cast(instance->toAddon.addonInstance) - ->DemuxSeekTime(time, backwards, *startpts); - } - - inline static void ADDON_DemuxSetSpeed(const AddonInstance_InputStream* instance, int speed) - { - static_cast(instance->toAddon.addonInstance)->DemuxSetSpeed(speed); - } - - inline static void ADDON_SetVideoResolution(const AddonInstance_InputStream* instance, - int width, - int height) - { - static_cast(instance->toAddon.addonInstance) - ->SetVideoResolution(width, height); - } - - - // IDisplayTime - inline static int ADDON_GetTotalTime(const AddonInstance_InputStream* instance) - { - return static_cast(instance->toAddon.addonInstance)->GetTotalTime(); - } - - inline static int ADDON_GetTime(const AddonInstance_InputStream* instance) - { - return static_cast(instance->toAddon.addonInstance)->GetTime(); - } - - // ITime - inline static bool ADDON_GetTimes(const AddonInstance_InputStream* instance, - INPUTSTREAM_TIMES* times) - { - return static_cast(instance->toAddon.addonInstance)->GetTimes(*times); - } - - // IPosTime - inline static bool ADDON_PosTime(const AddonInstance_InputStream* instance, int ms) - { - return static_cast(instance->toAddon.addonInstance)->PosTime(ms); - } - - inline static int ADDON_GetChapter(const AddonInstance_InputStream* instance) - { - return static_cast(instance->toAddon.addonInstance)->GetChapter(); - } - - inline static int ADDON_GetChapterCount(const AddonInstance_InputStream* instance) - { - return static_cast(instance->toAddon.addonInstance)->GetChapterCount(); - } - - inline static const char* ADDON_GetChapterName(const AddonInstance_InputStream* instance, int ch) - { - return static_cast(instance->toAddon.addonInstance)->GetChapterName(ch); - } - - inline static int64_t ADDON_GetChapterPos(const AddonInstance_InputStream* instance, int ch) - { - return static_cast(instance->toAddon.addonInstance)->GetChapterPos(ch); - } - - inline static bool ADDON_SeekChapter(const AddonInstance_InputStream* instance, int ch) - { - return static_cast(instance->toAddon.addonInstance)->SeekChapter(ch); - } - - inline static int ADDON_ReadStream(const AddonInstance_InputStream* instance, - uint8_t* buffer, - unsigned int bufferSize) - { - return static_cast(instance->toAddon.addonInstance) - ->ReadStream(buffer, bufferSize); - } - - inline static int64_t ADDON_SeekStream(const AddonInstance_InputStream* instance, - int64_t position, - int whence) - { - return static_cast(instance->toAddon.addonInstance) - ->SeekStream(position, whence); - } - - inline static int64_t ADDON_PositionStream(const AddonInstance_InputStream* instance) - { - return static_cast(instance->toAddon.addonInstance)->PositionStream(); - } - - inline static int64_t ADDON_LengthStream(const AddonInstance_InputStream* instance) - { - return static_cast(instance->toAddon.addonInstance)->LengthStream(); - } - - inline static int ADDON_GetBlockSize(const AddonInstance_InputStream* instance) - { - return static_cast(instance->toAddon.addonInstance)->GetBlockSize(); - } - - inline static bool ADDON_IsRealTimeStream(const AddonInstance_InputStream* instance) - { - return static_cast(instance->toAddon.addonInstance)->IsRealTimeStream(); - } - - AddonInstance_InputStream* m_instanceData; -}; - -} /* namespace addon */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PVR.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PVR.h deleted file mode 100644 index 0bca8e2..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PVR.h +++ /dev/null @@ -1,3423 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../c-api/addon-instance/pvr.h" -#include "pvr/ChannelGroups.h" -#include "pvr/Channels.h" -#include "pvr/EDL.h" -#include "pvr/EPG.h" -#include "pvr/General.h" -#include "pvr/MenuHook.h" -#include "pvr/Recordings.h" -#include "pvr/Stream.h" -#include "pvr/Timers.h" - -#ifdef __cplusplus - -/*! - * @internal - * @brief PVR "C++" API interface - * - * In this field are the pure addon-side C++ data. - * - * @note Changes can be made without problems and have no influence on other - * PVR addons that have already been created.\n - * \n - * Therefore, @ref ADDON_INSTANCE_VERSION_PVR_MIN can be ignored for these - * fields and only the @ref ADDON_INSTANCE_VERSION_PVR needs to be increased.\n - * \n - * Only must be min version increased if a new compile of addon breaks after - * changes here. - * - * Have by add of new parts a look about **Doxygen** `\\ingroup`, so that - * added parts included in documentation. - * - * If you add addon side related documentation, where his dev need know, use `///`. - * For parts only for Kodi make it like here. - * - * @endinternal - */ - -namespace kodi -{ -namespace addon -{ - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" Doxygen group set for the definitions -//{{{ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs Definitions, structures and enumerators -/// @ingroup cpp_kodi_addon_pvr -/// @brief **PVR client add-on instance definition values**\n -/// All PVR functions associated data structures. -/// -/// Used to exchange the available options between Kodi and addon.\n -/// The groups described here correspond to the groups of functions on PVR -/// instance class. -/// - -//############################################################################## -/// @defgroup cpp_kodi_addon_pvr_Defs_General 1. General -/// @ingroup cpp_kodi_addon_pvr_Defs -/// @brief **PVR add-on general variables**\n -/// Used to exchange the available options between Kodi and addon. -/// -/// This group also includes @ref cpp_kodi_addon_pvr_Defs_PVRCapabilities with -/// which Kodi an @ref kodi::addon::CInstancePVRClient::GetCapabilities() -/// queries the supported **modules** of the addon. -/// -/// The standard values are also below, once for error messages and once to -/// @ref kodi::addon::CInstancePVRClient::ConnectionStateChange() to give Kodi -/// any information. -/// -///@{ -//############################################################################## -/// @defgroup cpp_kodi_addon_pvr_Defs_General_Inputstream class PVRStreamProperty & definition PVR_STREAM_PROPERTY -/// @ingroup cpp_kodi_addon_pvr_Defs_General -/// @brief **Inputstream variables**\n -/// This includes values related to the outside of PVR available inputstream -/// system. -/// -/// This can be by separate instance on same addon, by handling in Kodi itself -/// or to reference of another addon where support needed inputstream. -/// -/// @note This is complete independent from own system included here -/// @ref cpp_kodi_addon_pvr_Streams "inputstream". -/// -//------------------------------------------------------------------------------ -///@} - -//############################################################################## -/// @defgroup cpp_kodi_addon_pvr_Defs_Channel 2. Channel -/// @ingroup cpp_kodi_addon_pvr_Defs -/// @brief **PVR add-on channel**\n -/// Used to exchange the available channel options between Kodi and addon. -/// -/// Modules here are mainly intended for @ref cpp_kodi_addon_pvr_Channels "channels", -/// but are also used on other modules to identify the respective TV/radio -/// channel. -/// -/// Because of @ref cpp_kodi_addon_pvr_Defs_Channel_PVRSignalStatus and -/// @ref cpp_kodi_addon_pvr_Defs_Channel_PVRDescrambleInfo is a special case at -/// this point. This is currently only used on running streams, but it may be -/// possible that this must always be usable in connection with PiP in the -/// future. -/// -//------------------------------------------------------------------------------ - -//############################################################################## -/// @defgroup cpp_kodi_addon_pvr_Defs_ChannelGroup 3. Channel Group -/// @ingroup cpp_kodi_addon_pvr_Defs -/// @brief **PVR add-on channel group**\n -/// This group contains data classes and values which are used in PVR on -/// @ref cpp_kodi_addon_pvr_supportsChannelGroups "channel groups". -/// -//------------------------------------------------------------------------------ - -//############################################################################## -/// @defgroup cpp_kodi_addon_pvr_Defs_epg 4. EPG Tag -/// @ingroup cpp_kodi_addon_pvr_Defs -/// @brief **PVR add-on EPG data**\n -/// Used on @ref cpp_kodi_addon_pvr_EPGTag "EPG methods in PVR instance class". -/// -/// See related modules about, also below in this view are few macros where -/// default values of associated places. -/// -//------------------------------------------------------------------------------ - -//############################################################################## -/// @defgroup cpp_kodi_addon_pvr_Defs_Recording 5. Recording -/// @ingroup cpp_kodi_addon_pvr_Defs -/// @brief **Representation of a recording**\n -/// Used to exchange the available recording data between Kodi and addon on -/// @ref cpp_kodi_addon_pvr_Recordings "Recordings methods in PVR instance class". -/// -//------------------------------------------------------------------------------ - -//############################################################################## -/// @defgroup cpp_kodi_addon_pvr_Defs_Timer 6. Timer -/// @ingroup cpp_kodi_addon_pvr_Defs -/// @brief **PVR add-on timer data**\n -/// Used to exchange the available timer data between Kodi and addon on -/// @ref cpp_kodi_addon_pvr_Timers "Timers methods in PVR instance class". -/// -//------------------------------------------------------------------------------ - -//############################################################################## -/// @defgroup cpp_kodi_addon_pvr_Defs_Menuhook 7. Menuhook -/// @ingroup cpp_kodi_addon_pvr_Defs -/// @brief **PVR Context menu data**\n -/// Define data for the context menus available to the user -/// -//------------------------------------------------------------------------------ - -//############################################################################## -/// @defgroup cpp_kodi_addon_pvr_Defs_EDLEntry 8. Edit decision list (EDL) -/// @ingroup cpp_kodi_addon_pvr_Defs -/// @brief **An edit decision list or EDL is used in the post-production process -/// of film editing and video editing**\n -/// Used on @ref kodi::addon::CInstancePVRClient::GetEPGTagEdl and -/// @ref kodi::addon::CInstancePVRClient::GetRecordingEdl -/// -//------------------------------------------------------------------------------ - -//############################################################################## -/// @defgroup cpp_kodi_addon_pvr_Defs_Stream 9. Inputstream -/// @ingroup cpp_kodi_addon_pvr_Defs -/// @brief **Inputstream**\n -/// This includes classes and values that are used in the PVR inputstream. -/// -/// Used on @ref cpp_kodi_addon_pvr_Streams "Inputstream methods in PVR instance class". -/// -/// @note The parts here will be removed in the future and replaced by the -/// separate @ref cpp_kodi_addon_inputstream "inputstream addon instance". -/// If there is already a possibility, new addons should do it via the -/// inputstream instance. -/// -//------------------------------------------------------------------------------ - -//}}} -//______________________________________________________________________________ - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" PVR addon instance class -//{{{ - -//============================================================================== -/// @addtogroup cpp_kodi_addon_pvr -/// @brief \cpp_class{ kodi::addon::CInstancePVRClient } -/// **PVR client add-on instance** -/// -/// Kodi features powerful [Live TV](https://kodi.wiki/view/Live_TV) and -/// [video recording (DVR/PVR)](http://en.wikipedia.org/wiki/Digital_video_recorder) -/// abilities using a very flexible distributed application structure. That is, by -/// leveraging other existing third-party -/// [PVR backend applications](https://kodi.wiki/view/PVR_backend) or -/// [DVR devices](https://kodi.wiki/view/PVR_backend) -/// that specialize in receiving television signals and also support the same type -/// of [client–server model](http://en.wikipedia.org/wiki/client%E2%80%93server_model) -/// which Kodi uses, (following a [frontend-backend](http://en.wikipedia.org/wiki/Front_and_back_ends) -/// design principle for [separation of concerns](http://en.wikipedia.org/wiki/Separation_of_concerns)), -/// these PVR features in Kodi allow you to watch Live TV, listen to radio, view an EPG TV-Guide -/// and schedule recordings, and also enables many other TV related features, all using -/// Kodi as your primary interface once the initial pairing connection and -/// configuration have been done. -/// -/// @note It is very important to understand that with "Live TV" in the reference -/// to PVR in Kodi, we do not mean [streaming video](http://en.wikipedia.org/wiki/Streaming_media) -/// from the internet via websites providing [free content](https://kodi.wiki/view/Free_content) -/// or online services such as Netflix, Hulu, Vudu and similar, no matter if that -/// content is actually streamed live or not. If that is what you are looking for -/// then you might want to look into [Video Addons](https://kodi.wiki/view/Add-ons) -/// for Kodi instead, (which again is not the same as the "PVR" or "Live TV" we -/// discuss in this article), but remember that [Kodi does not provide any video -/// content or video streaming services](https://kodi.wiki/view/Free_content). -/// -/// The use of the PVR is based on the @ref CInstancePVRClient. -/// -/// Include the header @ref PVR.h "#include " -/// to use this class. -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// Here is an example of what the `addon.xml.in` would look like for an PVR addon: -/// -/// ~~~~~~~~~~~~~{.xml} -/// -/// -/// @ADDON_DEPENDS@ -/// -/// -/// My PVR addon addon -/// My PVR addon description -/// @PLATFORM@ -/// -/// -/// ~~~~~~~~~~~~~ -/// -/// -/// At `` the basic instance definition is declared, this is intended to identify the addon as an PVR and to see its supported types: -/// | Name | Description -/// |------|---------------------- -/// | `point` | The identification of the addon instance to inputstream is mandatory `kodi.pvrclient`. In addition, the instance declared in the first `` is also the main type of addon. -/// | `library_@PLATFORM@` | The runtime library used for the addon. This is usually declared by cmake and correctly displayed in the translated `addon.xml`. -/// -/// -/// @remark For more detailed description of the `addon.xml`, see also https://kodi.wiki/view/Addon.xml. -/// -/// -/// -------------------------------------------------------------------------- -/// -/// **Example:** -/// -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// class CMyPVRClient : public ::kodi::addon::CInstancePVRClient -/// { -/// public: -/// CMyPVRClient(KODI_HANDLE instance, const std::string& kodiVersion); -/// -/// PVR_ERROR GetCapabilities(kodi::addon::PVRCapabilities& capabilities) override; -/// PVR_ERROR GetBackendName(std::string& name) override; -/// PVR_ERROR GetBackendVersion(std::string& version) override; -/// -/// PVR_ERROR GetChannelsAmount(int& amount) override; -/// PVR_ERROR GetChannels(bool radio, std::vector& channels) override; -/// PVR_ERROR GetChannelStreamProperties(const kodi::addon::PVRChannel& channel, -/// std::vector& properties) override; -/// -/// private: -/// std::vector m_myChannels; -/// }; -/// -/// CMyPVRClient::CMyPVRClient(KODI_HANDLE instance, const std::string& kodiVersion) -/// : CInstancePVRClient(instance, kodiVersion) -/// { -/// kodi::addon::PVRChannel channel; -/// channel.SetUniqueId(123); -/// channel.SetChannelNumber(1); -/// channel.SetChannelName("My test channel"); -/// m_myChannels.push_back(channel); -/// } -/// -/// PVR_ERROR CMyPVRClient::GetCapabilities(kodi::addon::PVRCapabilities& capabilities) -/// { -/// capabilities.SetSupportsTV(true); -/// return PVR_ERROR_NO_ERROR; -/// } -/// -/// PVR_ERROR CMyPVRClient::GetBackendName(std::string& name) -/// { -/// name = "My special PVR client"; -/// return PVR_ERROR_NO_ERROR; -/// } -/// -/// PVR_ERROR CMyPVRClient::GetBackendVersion(std::string& version) -/// { -/// version = "1.0.0"; -/// return PVR_ERROR_NO_ERROR; -/// } -/// -/// PVR_ERROR CMyInstance::GetChannelsAmount(int& amount) -/// { -/// amount = m_myChannels.size(); -/// return PVR_ERROR_NO_ERROR; -/// } -/// -/// PVR_ERROR CMyPVRClient::GetChannels(bool radio, std::vector& channels) -/// { -/// channels = m_myChannels; -/// return PVR_ERROR_NO_ERROR; -/// } -/// -/// PVR_ERROR CMyPVRClient::GetChannelStreamProperties(const kodi::addon::PVRChannel& channel, -/// std::vector& properties) -/// { -/// if (channel.GetUniqueId() == 123) -/// { -/// properties.push_back(PVR_STREAM_PROPERTY_STREAMURL, "http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4"); -/// properties.push_back(PVR_STREAM_PROPERTY_ISREALTIMESTREAM, "true"); -/// return PVR_ERROR_NO_ERROR; -/// } -/// return PVR_ERROR_UNKNOWN; -/// } -/// -/// ... -/// -/// //---------------------------------------------------------------------- -/// -/// class CMyAddon : public ::kodi::addon::CAddonBase -/// { -/// public: -/// CMyAddon() = default; -/// ADDON_STATUS CreateInstance(int instanceType, -/// const std::string& instanceID, -/// KODI_HANDLE instance, -/// const std::string& version, -/// KODI_HANDLE& addonInstance) override; -/// }; -/// -/// // If you use only one instance in your add-on, can be instanceType and -/// // instanceID ignored -/// ADDON_STATUS CMyAddon::CreateInstance(int instanceType, -/// const std::string& instanceID, -/// KODI_HANDLE instance, -/// const std::string& version, -/// KODI_HANDLE& addonInstance) -/// { -/// if (instanceType == ADDON_INSTANCE_PVR) -/// { -/// kodi::Log(ADDON_LOG_NOTICE, "Creating my PVR client instance"); -/// addonInstance = new CMyPVRClient(instance, version); -/// return ADDON_STATUS_OK; -/// } -/// else if (...) -/// { -/// ... -/// } -/// return ADDON_STATUS_UNKNOWN; -/// } -/// -/// ADDONCREATOR(CMyAddon) -/// ~~~~~~~~~~~~~ -/// -/// The destruction of the example class `CMyPVRClient` is called from -/// Kodi's header. Manually deleting the add-on instance is not required. -/// -class ATTRIBUTE_HIDDEN CInstancePVRClient : public IAddonInstance -{ -public: - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Base 1. Basic functions - /// @ingroup cpp_kodi_addon_pvr - /// @brief **Functions to manage the addon and get basic information about it**\n - /// These are e.g. @ref GetCapabilities to know supported groups at - /// this addon or the others to get information about the source of the PVR - /// stream. - /// - /// The with "Valid implementation required." declared functions are mandatory, - /// all others are an option. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Basic parts in interface:**\n - /// Copy this to your project and extend with your parts or leave functions - /// complete away where not used or supported. - /// - /// @copydetails cpp_kodi_addon_pvr_Base_header_addon_auto_check - /// @copydetails cpp_kodi_addon_pvr_Base_source_addon_auto_check - /// - ///@{ - - //============================================================================ - /// @brief PVR client class constructor. - /// - /// Used by an add-on that only supports only PVR and only in one instance. - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Here's example about the use of this:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// ... - /// - /// class ATTRIBUTE_HIDDEN CPVRExample - /// : public kodi::addon::CAddonBase, - /// public kodi::addon::CInstancePVRClient - /// { - /// public: - /// CPVRExample() - /// { - /// } - /// - /// ~CPVRExample() override; - /// { - /// } - /// - /// ... - /// }; - /// - /// ADDONCREATOR(CPVRExample) - /// ~~~~~~~~~~~~~ - /// - CInstancePVRClient() : IAddonInstance(ADDON_INSTANCE_PVR, GetKodiTypeVersion(ADDON_INSTANCE_PVR)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstancePVRClient: Creation of more as one in single " - "instance way is not allowed!"); - - SetAddonStruct(CAddonBase::m_interface->firstKodiInstance, m_kodiVersion); - CAddonBase::m_interface->globalSingleInstance = this; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief PVR client class constructor used to support multiple instance - /// types. - /// - /// @param[in] instance The instance value given to - /// `kodi::addon::CAddonBase::CreateInstance(...)`. - /// @param[in] kodiVersion [opt] Version used in Kodi for this instance, to - /// allow compatibility to older Kodi versions. - /// - /// @note Recommended to set `kodiVersion`. - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Here's example about the use of this:** - /// ~~~~~~~~~~~~~{.cpp} - /// class CMyPVRClient : public ::kodi::addon::CInstancePVRClient - /// { - /// public: - /// CMyPVRClient(KODI_HANDLE instance, const std::string& kodiVersion) - /// : CInstancePVRClient(instance, kodiVersion) - /// { - /// ... - /// } - /// - /// ... - /// }; - /// - /// ADDON_STATUS CMyAddon::CreateInstance(int instanceType, - /// const std::string& instanceID, - /// KODI_HANDLE instance, - /// const std::string& version, - /// KODI_HANDLE& addonInstance) - /// { - /// kodi::Log(ADDON_LOG_NOTICE, "Creating my PVR client instance"); - /// addonInstance = new CMyPVRClient(instance, version); - /// return ADDON_STATUS_OK; - /// } - /// ~~~~~~~~~~~~~ - /// - explicit CInstancePVRClient(KODI_HANDLE instance, const std::string& kodiVersion = "") - : IAddonInstance(ADDON_INSTANCE_PVR, - !kodiVersion.empty() ? kodiVersion : GetKodiTypeVersion(ADDON_INSTANCE_PVR)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstancePVRClient: Creation of multiple together with " - "single instance way is not allowed!"); - - SetAddonStruct(instance, m_kodiVersion); - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Destructor - /// - ~CInstancePVRClient() override = default; - //---------------------------------------------------------------------------- - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - //============================================================================ - /// @brief Get the list of features that this add-on provides. - /// - /// Called by Kodi 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 capabilities The with @ref cpp_kodi_addon_pvr_Defs_PVRCapabilities defined add-on's capabilities. - /// @return @ref PVR_ERROR_NO_ERROR if the properties were fetched successfully. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_PVRCapabilities_Help - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// PVR_ERROR CMyPVRClient::GetCapabilities(kodi::addon::PVRCapabilities& capabilities) - /// { - /// capabilities.SetSupportsTV(true); - /// capabilities.SetSupportsEPG(true); - /// return PVR_ERROR_NO_ERROR; - /// } - /// ~~~~~~~~~~~~~ - /// - /// -------------------------------------------------------------------------- - /// - /// @note Valid implementation required. - /// - virtual PVR_ERROR GetCapabilities(kodi::addon::PVRCapabilities& capabilities) = 0; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get the name reported by the backend that will be displayed in the UI. - /// - /// @param[out] name The name reported by the backend that will be displayed in the UI. - /// @return @ref PVR_ERROR_NO_ERROR if successfully done - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// PVR_ERROR CMyPVRClient::GetBackendName(std::string& name) - /// { - /// name = "My special PVR client"; - /// return PVR_ERROR_NO_ERROR; - /// } - /// ~~~~~~~~~~~~~ - /// - /// -------------------------------------------------------------------------- - /// - /// @note Valid implementation required. - /// - virtual PVR_ERROR GetBackendName(std::string& name) = 0; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get the version string reported by the backend that will be - /// displayed in the UI. - /// - /// @param[out] version The version string reported by the backend that will be - /// displayed in the UI. - /// @return @ref PVR_ERROR_NO_ERROR if successfully done - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// PVR_ERROR CMyPVRClient::GetBackendVersion(std::string& version) - /// { - /// version = "1.0.0"; - /// return PVR_ERROR_NO_ERROR; - /// } - /// ~~~~~~~~~~~~~ - /// - /// -------------------------------------------------------------------------- - /// - /// @note Valid implementation required. - /// - virtual PVR_ERROR GetBackendVersion(std::string& version) = 0; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get the hostname of the pvr backend server - /// - /// @param[out] hostname Hostname as ip address or alias. If backend does not - /// utilize a server, return empty string. - /// @return @ref PVR_ERROR_NO_ERROR if successfully done - /// - virtual PVR_ERROR GetBackendHostname(std::string& hostname) { return PVR_ERROR_NOT_IMPLEMENTED; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief To get the connection string reported by the backend that will be - /// displayed in the UI. - /// - /// @param[out] connection The connection string reported by the backend that - /// will be displayed in the UI. - /// @return @ref PVR_ERROR_NO_ERROR if successfully done - /// - virtual PVR_ERROR GetConnectionString(std::string& connection) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get the disk space reported by the backend (if supported). - /// - /// @param[in] total The total disk space in bytes. - /// @param[in] used The used disk space in bytes. - /// @return @ref PVR_ERROR_NO_ERROR if the drive space has been fetched - /// successfully. - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// PVR_ERROR CMyPVRClient::GetDriveSpace(uint64_t& total, uint64_t& used) - /// { - /// total = 10 * 1024 * 1024 * 1024; // To set complete size of drive in bytes - /// used = 122324243; // To set the used amount - /// return PVR_ERROR_NO_ERROR; - /// } - /// ~~~~~~~~~~~~~ - /// - virtual PVR_ERROR GetDriveSpace(uint64_t& total, uint64_t& used) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Call one of the settings related menu hooks (if supported). - /// - /// Supported @ref cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook "menu hook " - /// instances have to be added in `constructor()`, by calling @ref AddMenuHook() - /// on the callback. - /// - /// @param[in] menuhook The hook to call. - /// @return @ref PVR_ERROR_NO_ERROR if the hook was called successfully. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// PVR_ERROR CMyPVRClient::CallSettingsMenuHook(const kodi::addon::PVRMenuhook& menuhook) - /// { - /// if (menuhook.GetHookId() == 2) - /// kodi::QueueNotification(QUEUE_INFO, "", kodi::GetLocalizedString(menuhook.GetLocalizedStringId())); - /// return PVR_ERROR_NO_ERROR; - /// } - /// ~~~~~~~~~~~~~ - /// - virtual PVR_ERROR CallSettingsMenuHook(const kodi::addon::PVRMenuhook& menuhook) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief **Callback to Kodi Function**\nAdd or replace a menu hook for the context menu for this add-on - /// - /// This is a callback function, called from addon to give Kodi his context menu's. - /// - /// @param[in] menuhook The with @ref cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook defined hook to add - /// - /// @remarks Only called from addon itself - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Here's an example of the use of it:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// ... - /// - /// { - /// kodi::addon::PVRMenuhook hook; - /// hook.SetHookId(1); - /// hook.SetCategory(PVR_MENUHOOK_CHANNEL); - /// hook.SetLocalizedStringId(30000); - /// AddMenuHook(hook); - /// } - /// - /// { - /// kodi::addon::PVRMenuhook hook; - /// hook.SetHookId(2); - /// hook.SetCategory(PVR_MENUHOOK_SETTING); - /// hook.SetLocalizedStringId(30001); - /// AddMenuHook(hook); - /// } - /// ... - /// ~~~~~~~~~~~~~ - /// - /// **Here another way:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// ... - /// - /// AddMenuHook(kodi::addon::PVRMenuhook(1, 30000, PVR_MENUHOOK_CHANNEL)); - /// AddMenuHook(kodi::addon::PVRMenuhook(2, 30001, PVR_MENUHOOK_SETTING)); - /// ... - /// ~~~~~~~~~~~~~ - /// - inline void AddMenuHook(const kodi::addon::PVRMenuhook& hook) - { - m_instanceData->toKodi->AddMenuHook(m_instanceData->toKodi->kodiInstance, hook); - } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief **Callback to Kodi Function**\n - /// Notify a state change for a PVR backend connection. - /// - /// @param[in] connectionString The connection string reported by the backend - /// that can be displayed in the UI. - /// @param[in] newState The by @ref PVR_CONNECTION_STATE defined new state. - /// @param[in] message A localized addon-defined string representing the new - /// state, that can be displayed in the UI or **empty** if - /// the Kodi-defined default string for the new state - /// shall be displayed. - /// - /// @remarks Only called from addon itself - /// - /// - /// -------------------------------------------------------------------------- - /// - /// - /// **Here's an example of the use of it:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// #include /* for kodi::GetLocalizedString(...) */ - /// ... - /// - /// ConnectionStateChange("PVR demo connection lost", PVR_CONNECTION_STATE_DISCONNECTED, kodi::GetLocalizedString(30005, "Lost connection to Server");); - /// ... - /// ~~~~~~~~~~~~~ - /// - inline void ConnectionStateChange(const std::string& connectionString, - PVR_CONNECTION_STATE newState, - const std::string& message) - { - m_instanceData->toKodi->ConnectionStateChange( - m_instanceData->toKodi->kodiInstance, connectionString.c_str(), newState, message.c_str()); - } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief **Callback to Kodi Function**\n - /// Get user data path of the PVR addon. - /// - /// @return Path of current Kodi user - /// - /// @remarks Only called from addon itself - /// - /// @note Alternatively, @ref kodi::GetAddonPath() can be used for this. - /// - inline std::string UserPath() const { return m_instanceData->props->strUserPath; } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief **Callback to Kodi Function**\n - /// Get main client path of the PVR addon. - /// - /// @return Path of addon client - /// - /// @remarks Only called from addon itself. - /// - /// @note Alternatively, @ref kodi::GetBaseUserPath() can be used for this. - /// - inline std::string ClientPath() const { return m_instanceData->props->strClientPath; } - //---------------------------------------------------------------------------- - - ///@} - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Channels 2. Channels (required) - /// @ingroup cpp_kodi_addon_pvr - /// @brief **Functions to get available TV or Radio channels**\n - /// These are mandatory functions for using this addon to get the available - /// channels. - /// - /// @remarks Either @ref PVRCapabilities::SetSupportsTV "SetSupportsTV()" or - /// @ref PVRCapabilities::SetSupportsRadio "SetSupportsRadio()" is required to - /// be set to `true`.\n - /// If a channel changes after the initial import, or if a new one was added, - /// then the add-on should call @ref TriggerChannelUpdate(). - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Channel parts in interface:**\n - /// Copy this to your project and extend with your parts or leave functions - /// complete away where not used or supported. - /// - /// @copydetails cpp_kodi_addon_pvr_Channels_header_addon_auto_check - /// @copydetails cpp_kodi_addon_pvr_Channels_source_addon_auto_check - /// - ///@{ - - //============================================================================ - /// @brief The total amount of channels on the backend - /// - /// @param[out] amount The total amount of channels on the backend - /// @return @ref PVR_ERROR_NO_ERROR if the amount has been fetched successfully. - /// - /// @remarks Valid implementation required. - /// - virtual PVR_ERROR GetChannelsAmount(int& amount) { return PVR_ERROR_NOT_IMPLEMENTED; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Request the list of all channels from the backend. - /// - /// @param[in] radio True to get the radio channels, false to get the TV channels. - /// @param[out] results The channels defined with @ref cpp_kodi_addon_pvr_Defs_Channel_PVRChannel - /// and available at the addon, them transferred with - /// @ref cpp_kodi_addon_pvr_Defs_Channel_PVRChannelsResultSet. - /// @return @ref PVR_ERROR_NO_ERROR if the list has been fetched successfully. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Channel_PVRChannel_Help - /// - /// - /// -------------------------------------------------------------------------- - /// - /// @remarks - /// If @ref PVRCapabilities::SetSupportsTV() is set to - /// `true`, a valid result set needs to be provided for `radio = false`.\n - /// If @ref PVRCapabilities::SetSupportsRadio() is set to - /// `true`, a valid result set needs to be provided for `radio = true`. - /// At least one of these two must provide a valid result set. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// PVR_ERROR CMyPVRInstance::GetChannels(bool radio, kodi::addon::PVRChannelsResultSet& results) - /// { - /// // Minimal demo example, in reality bigger and loop to transfer all - /// kodi::addon::PVRChannel channel; - /// channel.SetUniqueId(123); - /// channel.SetIsRadio(false); - /// channel.SetChannelNumber(1); - /// channel.SetChannelName("My channel name"); - /// ... - /// - /// // Give it now to Kodi - /// results.Add(channel); - /// return PVR_ERROR_NO_ERROR; - /// } - /// ... - /// ~~~~~~~~~~~~~ - /// - virtual PVR_ERROR GetChannels(bool radio, kodi::addon::PVRChannelsResultSet& results) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get the stream properties for a channel from the backend. - /// - /// @param[in] channel The channel to get the stream properties for. - /// @param[out] properties the properties required to play the stream. - /// @return @ref PVR_ERROR_NO_ERROR if the stream is available. - /// - /// @remarks If @ref PVRCapabilities::SetSupportsTV "SetSupportsTV" or - /// @ref PVRCapabilities::SetSupportsRadio "SetSupportsRadio" are set to true - /// and @ref PVRCapabilities::SetHandlesInputStream "SetHandlesInputStream" is - /// set to false.\n\n - /// In this case the implementation must fill the property @ref PVR_STREAM_PROPERTY_STREAMURL - /// with the URL Kodi should resolve to playback the channel. - /// - /// @note The value directly related to inputstream must always begin with the - /// name of the associated add-on, e.g. `"inputstream.adaptive.manifest_update_parameter"`. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// PVR_ERROR CMyPVRInstance::GetChannelStreamProperties(const kodi::addon::PVRChannel& channel, - /// std::vector& properties) - /// { - /// ... - /// properties.emplace_back(PVR_STREAM_PROPERTY_INPUTSTREAM, "inputstream.adaptive"); - /// properties.emplace_back("inputstream.adaptive.manifest_type", "mpd"); - /// properties.emplace_back("inputstream.adaptive.manifest_update_parameter", "full"); - /// properties.emplace_back(PVR_STREAM_PROPERTY_MIMETYPE, "application/xml+dash"); - /// return PVR_ERROR_NO_ERROR; - /// } - /// ... - /// ~~~~~~~~~~~~~ - /// - virtual PVR_ERROR GetChannelStreamProperties( - const kodi::addon::PVRChannel& channel, - std::vector& properties) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get the signal status of the stream that's currently open. - /// - /// @param[out] signalStatus The signal status. - /// @return @ref PVR_ERROR_NO_ERROR if the signal status has been read successfully, false otherwise. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetHandlesInputStream "SetHandlesInputStream" - /// is set to true. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Channel_PVRSignalStatus_Help - /// - /// - /// -------------------------------------------------------------------------- - /// - /// - /// **Here's example about the use of this:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// ... - /// - /// class ATTRIBUTE_HIDDEN CPVRExample - /// : public kodi::addon::CAddonBase, - /// public kodi::addon::CInstancePVRClient - /// { - /// public: - /// ... - /// PVR_ERROR SignalStatus(PVRSignalStatus &signalStatus) override - /// { - /// signalStatus.SetAapterName("Example adapter 1"); - /// signalStatus.SetAdapterStatus("OK"); - /// signalStatus.SetSignal(0xFFFF); // 100% - /// - /// return PVR_ERROR_NO_ERROR; - /// } - /// }; - /// - /// ADDONCREATOR(CPVRExample) - /// ~~~~~~~~~~~~~ - /// - virtual PVR_ERROR GetSignalStatus(int channelUid, kodi::addon::PVRSignalStatus& signalStatus) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get the descramble information of the stream that's currently open. - /// - /// @param[out] descrambleInfo The descramble information. - /// @return @ref PVR_ERROR_NO_ERROR if the descramble information has been - /// read successfully, false otherwise. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsDescrambleInfo "supportsDescrambleInfo" - /// is set to true. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Channel_PVRDescrambleInfo_Help - /// - virtual PVR_ERROR GetDescrambleInfo(int channelUid, - kodi::addon::PVRDescrambleInfo& descrambleInfo) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief **Callback to Kodi Function**\n - /// Request Kodi to update it's list of channels. - /// - /// @remarks Only called from addon itself. - /// - inline void TriggerChannelUpdate() - { - m_instanceData->toKodi->TriggerChannelUpdate(m_instanceData->toKodi->kodiInstance); - } - //---------------------------------------------------------------------------- - - ///@} - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_supportsChannelGroups 3. Channel Groups (optional) - /// @ingroup cpp_kodi_addon_pvr - /// @brief Bring in this functions if you have set @ref PVRCapabilities::SetSupportsChannelGroups "supportsChannelGroups" - /// to true\n - /// This is used to divide available addon channels into groups, which can - /// then be selected by the user. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Channel group parts in interface:**\n - /// Copy this to your project and extend with your parts or leave functions - /// complete away where not used or supported. - /// - /// @copydetails cpp_kodi_addon_pvr_supportsChannelGroups_header_addon_auto_check - /// @copydetails cpp_kodi_addon_pvr_supportsChannelGroups_source_addon_auto_check - /// - ///@{ - - //============================================================================ - /// @brief Get the total amount of channel groups on the backend if it supports channel groups. - /// - /// @param[out] amount The total amount of channel groups on the backend - /// @return @ref PVR_ERROR_NO_ERROR if the amount has been fetched successfully. - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelGroups "supportsChannelGroups" is set to true. - /// - virtual PVR_ERROR GetChannelGroupsAmount(int& amount) { return PVR_ERROR_NOT_IMPLEMENTED; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get a list of available channel groups on addon - /// - /// Request the list of all channel groups from the backend if it supports - /// channel groups. - /// - /// @param[in] radio True to get the radio channel groups, false to get the - /// TV channel groups. - /// @param[out] results List of available groups on addon defined with - /// @ref cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroup, - /// them transferred with - /// @ref cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupsResultSet. - /// @return @ref PVR_ERROR_NO_ERROR if the list has been fetched successfully. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroup_Help - /// - /// - /// -------------------------------------------------------------------------- - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelGroups "supportsChannelGroups" - /// is set to true. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// PVR_ERROR CMyPVRInstance::GetChannelGroups(bool radio, kodi::addon::PVRChannelGroupsResultSet& groups) - /// { - /// kodi::addon::PVRChannelGroup group; - /// group.SetIsRadio(false); - /// group.SetGroupName("My group name"); - /// group.SetPosition(1); - /// ... - /// - /// // Give it now to Kodi - /// results.Add(group); - /// return PVR_ERROR_NO_ERROR; - /// } - /// ... - /// ~~~~~~~~~~~~~ - /// - virtual PVR_ERROR GetChannelGroups(bool radio, kodi::addon::PVRChannelGroupsResultSet& results) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get a list of members on a group - /// - /// Request the list of all group members of a group from the backend if it - /// supports channel groups. - /// - /// @param[in] group The group to get the members for. - /// @param[out] results List of available group member channels defined with - /// @ref cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMember, - /// them transferred with - /// @ref PVRChannelGroupMembersResultSet. - /// @return @ref PVR_ERROR_NO_ERROR if the list has been fetched successfully. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMember_Help - /// - /// -------------------------------------------------------------------------- - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelGroups "supportsChannelGroups" - /// is set to true. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// PVR_ERROR CMyPVRInstance::GetChannelGroupMembers(const kodi::addon::PVRChannelGroup& group, - /// kodi::addon::PVRChannelGroupMembersResultSet& results) - /// { - /// for (const auto& myGroup : m_myGroups) - /// { - /// if (myGroup.strGroupName == group.GetGroupName()) - /// { - /// for (unsigned int iChannelPtr = 0; iChannelPtr < myGroup.members.size(); iChannelPtr++) - /// { - /// int iId = myGroup.members.at(iChannelPtr) - 1; - /// if (iId < 0 || iId > (int)m_channels.size() - 1) - /// continue; - /// - /// PVRDemoChannel &channel = m_channels.at(iId); - /// kodi::addon::PVRChannelGroupMember kodiGroupMember; - /// kodiGroupMember.SetGroupName(group.GetGroupName()); - /// kodiGroupMember.SetChannelUniqueId(channel.iUniqueId); - /// kodiGroupMember.SetChannelNumber(channel.iChannelNumber); - /// kodiGroupMember.SetSubChannelNumber(channel.iSubChannelNumber); - /// - /// results.Add(kodiGroupMember); - /// } - /// } - /// } - /// return PVR_ERROR_NO_ERROR; - /// } - /// ... - /// ~~~~~~~~~~~~~ - /// - virtual PVR_ERROR GetChannelGroupMembers(const kodi::addon::PVRChannelGroup& group, - kodi::addon::PVRChannelGroupMembersResultSet& results) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief **Callback to Kodi Function**\n - /// Request Kodi to update it's list of channel groups. - /// - /// @remarks Only called from addon itself - /// - inline void TriggerChannelGroupsUpdate() - { - m_instanceData->toKodi->TriggerChannelGroupsUpdate(m_instanceData->toKodi->kodiInstance); - } - //---------------------------------------------------------------------------- - - ///@} - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_supportsChannelEdit 4. Channel edit (optional) - /// @ingroup cpp_kodi_addon_pvr - /// @brief Bring in this functions if you have set @ref PVRCapabilities::SetSupportsChannelSettings "supportsChannelSettings" - /// to true or for @ref OpenDialogChannelScan() set @ref PVRCapabilities::SetSupportsChannelScan "supportsChannelScan" - /// to true\n - /// The support of this is a pure option and not mandatory. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Channel edit parts in interface:**\n - /// Copy this to your project and extend with your parts or leave functions - /// complete away where not used or supported. - /// - /// @copydetails cpp_kodi_addon_pvr_supportsChannelEdit_header_addon_auto_check - /// @copydetails cpp_kodi_addon_pvr_supportsChannelEdit_source_addon_auto_check - /// - ///@{ - - //============================================================================ - /// @brief Delete a channel from the backend. - /// - /// @param[in] channel The channel to delete. - /// @return @ref PVR_ERROR_NO_ERROR if the channel has been deleted successfully. - /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelSettings "supportsChannelSettings" - /// is set to true. - /// - virtual PVR_ERROR DeleteChannel(const kodi::addon::PVRChannel& channel) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief Rename a channel on the backend. - /// - /// @param[in] channel The channel to rename, containing the new channel name. - /// @return @ref PVR_ERROR_NO_ERROR if the channel has been renamed successfully. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Channel_PVRChannel_Help - /// - /// - /// -------------------------------------------------------------------------- - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsChannelSettings "supportsChannelSettings" - /// is set to true. - /// - virtual PVR_ERROR RenameChannel(const kodi::addon::PVRChannel& channel) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief Show the channel settings dialog, if supported by the backend. - /// - /// @param[in] channel The channel to show the dialog for. - /// @return @ref PVR_ERROR_NO_ERROR if the dialog has been displayed successfully. - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelSettings "supportsChannelSettings" is set to true. - /// @note Use @ref cpp_kodi_gui_CWindow "kodi::gui::CWindow" to create dialog for them. - /// - virtual PVR_ERROR OpenDialogChannelSettings(const kodi::addon::PVRChannel& channel) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief Show the dialog to add a channel on the backend, if supported by the backend. - /// - /// @param[in] channel The channel to add. - /// @return @ref PVR_ERROR_NO_ERROR if the channel has been added successfully. - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelSettings "supportsChannelSettings" is set to true. - /// @note Use @ref cpp_kodi_gui_CWindow "kodi::gui::CWindow" to create dialog for them. - /// - virtual PVR_ERROR OpenDialogChannelAdd(const kodi::addon::PVRChannel& channel) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief Show the channel scan dialog if this backend supports it. - /// - /// @return @ref PVR_ERROR_NO_ERROR if the dialog was displayed successfully. - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelScan "supportsChannelScan" is set to true. - /// @note Use @ref cpp_kodi_gui_CWindow "kodi::gui::CWindow" to create dialog for them. - /// - virtual PVR_ERROR OpenDialogChannelScan() { return PVR_ERROR_NOT_IMPLEMENTED; } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief Call one of the channel related menu hooks (if supported). - /// - /// Supported @ref cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook instances have to be added in - /// `constructor()`, by calling @ref AddMenuHook() on the callback. - /// - /// @param[in] menuhook The hook to call. - /// @param[in] item The selected channel item for which the hook was called. - /// @return @ref PVR_ERROR_NO_ERROR if the hook was called successfully. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help - /// - virtual PVR_ERROR CallChannelMenuHook(const kodi::addon::PVRMenuhook& menuhook, - const kodi::addon::PVRChannel& item) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - ///@} - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_EPGTag 4. EPG methods (optional) - /// @ingroup cpp_kodi_addon_pvr - /// @brief **PVR EPG methods**\n - /// These C ++ class functions of are intended for processing EPG information - /// and for giving it to Kodi. - /// - /// The necessary data is transferred with @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag. - /// - /// @remarks Only used by Kodi if @ref PVRCapabilities::SetSupportsEPG "supportsEPG" - /// is set to true.\n\n - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **EPG parts in interface:**\n - /// Copy this to your project and extend with your parts or leave functions - /// complete away where not used or supported. - /// - /// @copydetails cpp_kodi_addon_pvr_EPGTag_header_addon_auto_check - /// @copydetails cpp_kodi_addon_pvr_EPGTag_source_addon_auto_check - /// - ///@{ - - //============================================================================ - /// @brief Request the EPG for a channel from the backend. - /// - /// @param[in] channelUid The UID of the channel to get the EPG table for. - /// @param[in] start Get events after this time (UTC). - /// @param[in] end Get events before this time (UTC). - /// @param[out] results List where available EPG information becomes - /// transferred with @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag - /// and given to Kodi - /// @return @ref PVR_ERROR_NO_ERROR if the table has been fetched successfully. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_epg_PVREPGTag_Help - /// - /// - /// -------------------------------------------------------------------------- - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsEPG "supportsEPG" is set to true. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// PVR_ERROR CMyPVRInstance::GetEPGForChannel(int channelUid, - /// time_t start, - /// time_t end, - /// kodi::addon::PVREPGTagsResultSet& results) - /// { - /// // Minimal demo example, in reality bigger, loop to transfer all and to - /// // match wanted times. - /// kodi::addon::PVREPGTag tag; - /// tag.SetUniqueBroadcastId(123); - /// tag.SetUniqueChannelId(123); - /// tag.SetTitle("My epg entry name"); - /// tag.SetGenreType(EPG_EVENT_CONTENTMASK_MOVIEDRAMA); - /// tag.SetStartTime(1589148283); // Seconds elapsed since 00:00 hours, Jan 1, 1970 UTC - /// tag.SetEndTime(1589151913); - /// ... - /// - /// // Give it now to Kodi - /// results.Add(tag); - /// return PVR_ERROR_NO_ERROR; - /// } - /// ... - /// ~~~~~~~~~~~~~ - /// - virtual PVR_ERROR GetEPGForChannel(int channelUid, - time_t start, - time_t end, - kodi::addon::PVREPGTagsResultSet& results) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Check if the given EPG tag can be recorded. - /// - /// @param[in] tag the @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "epg tag" to check. - /// @param[out] isRecordable Set to true if the tag can be recorded. - /// @return @ref PVR_ERROR_NO_ERROR if bIsRecordable has been set successfully. - /// - /// @remarks Optional, it return @ref PVR_ERROR_NOT_IMPLEMENTED by parent to let Kodi decide. - /// - virtual PVR_ERROR IsEPGTagRecordable(const kodi::addon::PVREPGTag& tag, bool& isRecordable) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Check if the given EPG tag can be played. - /// - /// @param[in] tag the @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "epg tag" to check. - /// @param[out] isPlayable Set to true if the tag can be played. - /// @return @ref PVR_ERROR_NO_ERROR if bIsPlayable has been set successfully. - /// - /// @remarks Required if add-on supports playing epg tags. - /// - virtual PVR_ERROR IsEPGTagPlayable(const kodi::addon::PVREPGTag& tag, bool& isPlayable) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Retrieve the edit decision list (EDL) of an EPG tag on the backend. - /// - /// @param[in] tag The @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "epg tag". - /// @param[out] edl The function has to write the EDL into this array. - /// @return @ref PVR_ERROR_NO_ERROR if the EDL was successfully read or no EDL exists. - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsEPGEdl "supportsEPGEdl" is set to true. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_EDLEntry_PVREDLEntry_Help - /// - /// - /// -------------------------------------------------------------------------- - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsEPGEdl "supportsEPGEdl" is set to true. - /// - virtual PVR_ERROR GetEPGTagEdl(const kodi::addon::PVREPGTag& tag, - std::vector& edl) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get the stream properties for an epg tag from the backend. - /// - /// @param[in] tag The @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "epg tag" to get the stream properties for. - /// @param[out] properties the properties required to play the stream. - /// @return @ref PVR_ERROR_NO_ERROR if the stream is available. - /// - /// @remarks Required if add-on supports playing epg tags. - /// In this case your implementation must fill the property @ref PVR_STREAM_PROPERTY_STREAMURL - /// with the URL Kodi should resolve to playback the epg tag. - /// It return @ref PVR_ERROR_NOT_IMPLEMENTED from parent if this add-on won't provide this function. - /// - /// @note The value directly related to inputstream must always begin with the - /// name of the associated add-on, e.g. `"inputstream.adaptive.manifest_update_parameter"`. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// PVR_ERROR CMyPVRInstance::GetEPGTagStreamProperties(const kodi::addon::PVREPGTag& tag, - /// std::vector& properties) - /// { - /// ... - /// properties.emplace_back(PVR_STREAM_PROPERTY_INPUTSTREAM, "inputstream.adaptive"); - /// properties.emplace_back("inputstream.adaptive.manifest_type", "mpd"); - /// properties.emplace_back("inputstream.adaptive.manifest_update_parameter", "full"); - /// properties.emplace_back(PVR_STREAM_PROPERTY_MIMETYPE, "application/xml+dash"); - /// return PVR_ERROR_NO_ERROR; - /// } - /// ... - /// ~~~~~~~~~~~~~ - /// - virtual PVR_ERROR GetEPGTagStreamProperties( - const kodi::addon::PVREPGTag& tag, std::vector& properties) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief 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 - /// @ref 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 - /// supplies the current epg time frame value in @ref EpgMaxDays() when creating the - /// addon and calls @ref SetEPGTimeFrame later whenever Kodi's epg time frame value - /// changes. - /// - /// @param[in] days number of days from "now". @ref EPG_TIMEFRAME_UNLIMITED means that Kodi - /// is interested in all epg events, regardless of event times. - /// @return @ref PVR_ERROR_NO_ERROR if new value was successfully set. - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsEPG "supportsEPG" is set to true. - /// - virtual PVR_ERROR SetEPGTimeFrame(int days) { return PVR_ERROR_NOT_IMPLEMENTED; } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief Call one of the EPG related menu hooks (if supported). - /// - /// Supported @ref cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook instances have to be added in - /// `constructor()`, by calling @ref AddMenuHook() on the callback. - /// - /// @param[in] menuhook The hook to call. - /// @param[in] tag The selected EPG item for which the hook was called. - /// @return @ref PVR_ERROR_NO_ERROR if the hook was called successfully. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help - /// - virtual PVR_ERROR CallEPGMenuHook(const kodi::addon::PVRMenuhook& menuhook, - const kodi::addon::PVREPGTag& tag) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief **Callback to Kodi Function**\n - /// Get the Max days handled by Kodi. - /// - /// If > @ref EPG_TIMEFRAME_UNLIMITED, in async epg mode, deliver only events - /// in the range from 'end time > now' to 'start time < now + EpgMaxDays(). - /// @ref EPG_TIMEFRAME_UNLIMITED, notify all events. - /// - /// @return The Max days handled by Kodi - /// - inline int EpgMaxDays() const { return m_instanceData->props->iEpgMaxDays; } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief **Callback to Kodi Function**\n - /// Schedule an EPG update for the given channel channel. - /// - /// @param[in] channelUid The unique id of the channel for this add-on - /// - /// @remarks Only called from addon itself - /// - inline void TriggerEpgUpdate(unsigned int channelUid) - { - m_instanceData->toKodi->TriggerEpgUpdate(m_instanceData->toKodi->kodiInstance, channelUid); - } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief **Callback to Kodi Function**\n - /// Notify a state change for an EPG event. - /// - /// @param[in] tag The @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "EPG tag" where have event. - /// @param[in] newState The new state. - /// - For @ref EPG_EVENT_CREATED and @ref EPG_EVENT_UPDATED, tag must be filled with all available event data, not just a delta. - /// - For @ref EPG_EVENT_DELETED, it is sufficient to fill @ref kodi::addon::PVREPGTag::SetUniqueBroadcastId - /// - /// @remarks Only called from addon itself, - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// - /// void CMyPVRInstance::MyProcessFunction() - /// { - /// ... - /// kodi::addon::PVREPGTag tag; // Here as mini add, in real it should be a complete tag - /// tag.SetUniqueId(123); - /// - /// // added namespace here not needed to have, only to have more clear for where is - /// kodi::addon::CInstancePVRClient::EpgEventStateChange(tag, EPG_EVENT_UPDATED); - /// ... - /// } - /// - /// ... - /// ~~~~~~~~~~~~~ - /// - inline void EpgEventStateChange(kodi::addon::PVREPGTag& tag, EPG_EVENT_STATE newState) - { - m_instanceData->toKodi->EpgEventStateChange(m_instanceData->toKodi->kodiInstance, tag.GetTag(), - newState); - } - //---------------------------------------------------------------------------- - - ///@} - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Recordings 5. Recordings (optional) - /// @ingroup cpp_kodi_addon_pvr - /// @brief **PVR recording methods**\n - /// To transfer available recordings of the PVR backend and to allow possible - /// playback. - /// - /// @remarks Only used by Kodi if @ref PVRCapabilities::SetSupportsRecordings "supportsRecordings" - /// is set to true.\n\n - /// If a recordings changes after the initial import, or if a new one was added, - /// then the add-on should call @ref TriggerRecordingUpdate(). - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Recordings parts in interface:**\n - /// Copy this to your project and extend with your parts or leave functions - /// complete away where not used or supported. - /// - /// @copydetails cpp_kodi_addon_pvr_Recordings_header_addon_auto_check - /// @copydetails cpp_kodi_addon_pvr_Recordings_source_addon_auto_check - /// - ///@{ - - //============================================================================ - /// @brief To get amount of recording present on backend - /// - /// @param[in] deleted if set return deleted recording (called if - /// @ref PVRCapabilities::SetSupportsRecordingsUndelete "supportsRecordingsUndelete" - /// set to true) - /// @param[out] amount The total amount of recordings on the backend - /// @return @ref PVR_ERROR_NO_ERROR if the amount has been fetched successfully. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings "supportsRecordings" is set to true. - /// - virtual PVR_ERROR GetRecordingsAmount(bool deleted, int& amount) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Request the list of all recordings from the backend, if supported. - /// - /// Recording entries are added to Kodi by calling TransferRecordingEntry() on the callback. - /// - /// @param[in] deleted if set return deleted recording (called if - /// @ref PVRCapabilities::SetSupportsRecordingsUndelete "supportsRecordingsUndelete" - /// set to true) - /// @param[out] results List of available recordings with @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording - /// becomes transferred with @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecordingsResultSet - /// and given to Kodi - /// @return @ref PVR_ERROR_NO_ERROR if the recordings have been fetched successfully. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings "supportsRecordings" - /// is set to true. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Recording_PVRRecording_Help - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// PVR_ERROR CMyPVRInstance::GetRecordings(bool deleted, kodi::addon::PVRRecordingsResultSet& results) - /// { - /// // Minimal demo example, in reality bigger and loop to transfer all - /// kodi::addon::PVRRecording recording; - /// recording.SetRecordingId(123); - /// recording.SetTitle("My recording name"); - /// ... - /// - /// // Give it now to Kodi - /// results.Add(recording); - /// return PVR_ERROR_NO_ERROR; - /// } - /// ... - /// ~~~~~~~~~~~~~ - /// - virtual PVR_ERROR GetRecordings(bool deleted, kodi::addon::PVRRecordingsResultSet& results) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Delete a recording on the backend. - /// - /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording to delete. - /// @return @ref PVR_ERROR_NO_ERROR if the recording has been deleted successfully. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings "supportsRecordings" - /// is set to true. - /// - virtual PVR_ERROR DeleteRecording(const kodi::addon::PVRRecording& recording) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Undelete a recording on the backend. - /// - /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording to undelete. - /// @return @ref PVR_ERROR_NO_ERROR if the recording has been undeleted successfully. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordingsUndelete "supportsRecordingsUndelete" - /// is set to true. - /// - virtual PVR_ERROR UndeleteRecording(const kodi::addon::PVRRecording& recording) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Delete all recordings permanent which in the deleted folder on the backend. - /// - /// @return @ref PVR_ERROR_NO_ERROR if the recordings has been deleted successfully. - /// - virtual PVR_ERROR DeleteAllRecordingsFromTrash() { return PVR_ERROR_NOT_IMPLEMENTED; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Rename a recording on the backend. - /// - /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording - /// to rename, containing the new name. - /// @return @ref PVR_ERROR_NO_ERROR if the recording has been renamed successfully. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings "supportsRecordings" - /// is set to true. - /// - virtual PVR_ERROR RenameRecording(const kodi::addon::PVRRecording& recording) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Set the lifetime of a recording on the backend. - /// - /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording - /// to change the lifetime for. recording.iLifetime - /// contains the new lieftime value. - /// @return @ref PVR_ERROR_NO_ERROR if the recording's lifetime has been set - /// successfully. - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsRecordingsLifetimeChange "supportsRecordingsLifetimeChange" - /// is set to true. - /// - virtual PVR_ERROR SetRecordingLifetime(const kodi::addon::PVRRecording& recording) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Set the play count of a recording on the backend. - /// - /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording - /// to change the play count. - /// @param[in] count Play count. - /// @return @ref PVR_ERROR_NO_ERROR if the recording's play count has been set - /// successfully. - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsRecordingPlayCount "supportsRecordingPlayCount" - /// is set to true. - /// - virtual PVR_ERROR SetRecordingPlayCount(const kodi::addon::PVRRecording& recording, int count) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Set the last watched position of a recording on the backend. - /// - /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording. - /// @param[in] lastplayedposition The last watched position in seconds - /// @return @ref PVR_ERROR_NO_ERROR if the position has been stored successfully. - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsLastPlayedPosition "supportsLastPlayedPosition" - /// is set to true. - /// - virtual PVR_ERROR SetRecordingLastPlayedPosition(const kodi::addon::PVRRecording& recording, - int lastplayedposition) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Retrieve the last watched position of a recording on the backend. - /// - /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording. - /// @param[out] position The last watched position in seconds - /// @return @ref PVR_ERROR_NO_ERROR if the amount has been fetched successfully. - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsRecordingPlayCount "supportsRecordingPlayCount" - /// is set to true. - /// - virtual PVR_ERROR GetRecordingLastPlayedPosition(const kodi::addon::PVRRecording& recording, - int& position) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Retrieve the edit decision list (EDL) of a recording on the backend. - /// - /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording. - /// @param[out] edl The function has to write the EDL into this array. - /// @return @ref PVR_ERROR_NO_ERROR if the EDL was successfully read or no EDL exists. - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsRecordingEdl "supportsRecordingEdl" - /// is set to true. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_EDLEntry_PVREDLEntry_Help - /// - virtual PVR_ERROR GetRecordingEdl(const kodi::addon::PVRRecording& recording, - std::vector& edl) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Retrieve the size of a recording on the backend. - /// - /// @param[in] recording The recording to get the size in bytes for. - /// @param[out] size The size in bytes of the recording - /// @return @ref PVR_ERROR_NO_ERROR if the recording's size has been set successfully. - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsRecordingSize "supportsRecordingSize" - /// is set to true. - /// - virtual PVR_ERROR GetRecordingSize(const kodi::addon::PVRRecording& recording, int64_t& size) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Get the stream properties for a recording from the backend. - /// - /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording - /// to get the stream properties for. - /// @param[out] properties The properties required to play the stream. - /// @return @ref PVR_ERROR_NO_ERROR if the stream is available. - /// - /// @remarks Required if @ref PVRCapabilities::SetSupportsRecordings "supportsRecordings" - /// is set to true and the add-on does not implement recording stream functions - /// (@ref OpenRecordedStream, ...).\n - /// In this case your implementation must fill the property @ref PVR_STREAM_PROPERTY_STREAMURL - /// with the URL Kodi should resolve to playback the recording. - /// - /// @note The value directly related to inputstream must always begin with the - /// name of the associated add-on, e.g. `"inputstream.adaptive.manifest_update_parameter"`. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// PVR_ERROR CMyPVRInstance::GetRecordingStreamProperties(const kodi::addon::PVRRecording& recording, - /// std::vector& properties) - /// { - /// ... - /// properties.emplace_back(PVR_STREAM_PROPERTY_INPUTSTREAM, "inputstream.adaptive"); - /// properties.emplace_back("inputstream.adaptive.manifest_type", "mpd"); - /// properties.emplace_back("inputstream.adaptive.manifest_update_parameter", "full"); - /// properties.emplace_back(PVR_STREAM_PROPERTY_MIMETYPE, "application/xml+dash"); - /// return PVR_ERROR_NO_ERROR; - /// } - /// ... - /// ~~~~~~~~~~~~~ - /// - virtual PVR_ERROR GetRecordingStreamProperties( - const kodi::addon::PVRRecording& recording, - std::vector& properties) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //========================================================================== - /// @brief Call one of the recording related menu hooks (if supported). - /// - /// Supported @ref cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook instances have to be added in - /// `constructor()`, by calling @ref AddMenuHook() on the callback. - /// - /// @param[in] menuhook The hook to call. - /// @param[in] item The selected recording item for which the hook was called. - /// @return @ref PVR_ERROR_NO_ERROR if the hook was called successfully. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help - /// - virtual PVR_ERROR CallRecordingMenuHook(const kodi::addon::PVRMenuhook& menuhook, - const kodi::addon::PVRRecording& item) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief **Callback to Kodi Function**\n - /// Display a notification in Kodi that a recording started or stopped on the - /// server. - /// - /// @param[in] recordingName The name of the recording to display - /// @param[in] fileName The filename of the recording - /// @param[in] on True when recording started, false when it stopped - /// - /// @remarks Only called from addon itself - /// - inline void RecordingNotification(const std::string& recordingName, - const std::string& fileName, - bool on) - { - m_instanceData->toKodi->RecordingNotification(m_instanceData->toKodi->kodiInstance, - recordingName.c_str(), fileName.c_str(), on); - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief **Callback to Kodi Function**\n - /// Request Kodi to update it's list of recordings. - /// - /// @remarks Only called from addon itself - /// - inline void TriggerRecordingUpdate() - { - m_instanceData->toKodi->TriggerRecordingUpdate(m_instanceData->toKodi->kodiInstance); - } - //---------------------------------------------------------------------------- - - ///@} - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Timers 6. Timers (optional) - /// @ingroup cpp_kodi_addon_pvr - /// @brief **PVR timer methods**\n - /// For editing and displaying timed work, such as video recording. - /// - /// @remarks Only used by Kodi if @ref PVRCapabilities::SetSupportsTimers "supportsTimers" - /// is set to true.\n\n - /// If a timer changes after the initial import, or if a new one was added, - /// then the add-on should call @ref TriggerTimerUpdate(). - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Timer parts in interface:**\n - /// Copy this to your project and extend with your parts or leave functions - /// complete away where not used or supported. - /// - /// @copydetails cpp_kodi_addon_pvr_Timers_header_addon_auto_check - /// @copydetails cpp_kodi_addon_pvr_Timers_source_addon_auto_check - /// - ///@{ - - //============================================================================ - /// @brief Retrieve the timer types supported by the backend. - /// - /// @param[out] types The function has to write the definition of the - /// @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType types - /// into this array. - /// @return @ref PVR_ERROR_NO_ERROR if the types were successfully written to - /// the array. - /// - /// @note Maximal 32 entries are allowed inside. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType_Help - /// - virtual PVR_ERROR GetTimerTypes(std::vector& types) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief To get total amount of timers on the backend or -1 on error. - /// - /// @param[out] amount The total amount of timers on the backend - /// @return @ref PVR_ERROR_NO_ERROR if the amount has been fetched successfully. - /// - /// @note Required to use if @ref PVRCapabilities::SetSupportsTimers "supportsTimers" - /// is set to true. - /// - virtual PVR_ERROR GetTimersAmount(int& amount) { return PVR_ERROR_NOT_IMPLEMENTED; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Request the list of all timers from the backend if supported. - /// - /// @param[out] results List of available timers with @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimer - /// becomes transferred with @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimersResultSet - /// and given to Kodi - /// @return @ref PVR_ERROR_NO_ERROR if the list has been fetched successfully. - /// - /// @note Required to use if @ref PVRCapabilities::SetSupportsTimers "supportsTimers" - /// is set to true. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Timer_PVRTimer_Help - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// PVR_ERROR CMyPVRInstance::GetTimers(kodi::addon::PVRTimersResultSet& results) - /// { - /// // Minimal demo example, in reality bigger and loop to transfer all - /// kodi::addon::PVRTimer timer; - /// timer.SetClientIndex(123); - /// timer.SetState(PVR_TIMER_STATE_SCHEDULED); - /// timer.SetTitle("My timer name"); - /// ... - /// - /// // Give it now to Kodi - /// results.Add(timer); - /// return PVR_ERROR_NO_ERROR; - /// } - /// ... - /// ~~~~~~~~~~~~~ - /// - virtual PVR_ERROR GetTimers(kodi::addon::PVRTimersResultSet& results) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Add a timer on the backend. - /// - /// @param[in] timer The timer to add. - /// @return @ref PVR_ERROR_NO_ERROR if the timer has been added successfully. - /// - /// @note Required to use if @ref PVRCapabilities::SetSupportsTimers "supportsTimers" - /// is set to true. - /// - virtual PVR_ERROR AddTimer(const kodi::addon::PVRTimer& timer) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Delete a timer on the backend. - /// - /// @param[in] timer The timer to delete. - /// @param[in] forceDelete Set to true to delete a timer that is currently - /// recording a program. - /// @return @ref PVR_ERROR_NO_ERROR if the timer has been deleted successfully. - /// - /// @note Required to use if @ref PVRCapabilities::SetSupportsTimers "supportsTimers" - /// is set to true. - /// - virtual PVR_ERROR DeleteTimer(const kodi::addon::PVRTimer& timer, bool forceDelete) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Update the timer information on the backend. - /// - /// @param[in] timer The timer to update. - /// @return @ref PVR_ERROR_NO_ERROR if the timer has been updated successfully. - /// - /// @note Required to use if @ref PVRCapabilities::SetSupportsTimers "supportsTimers" - /// is set to true. - /// - virtual PVR_ERROR UpdateTimer(const kodi::addon::PVRTimer& timer) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Call one of the timer related menu hooks (if supported). - /// - /// Supported @ref cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook instances have - /// to be added in `constructor()`, by calling @ref AddMenuHook() on the - /// callback. - /// - /// @param[in] menuhook The hook to call. - /// @param[in] item The selected timer item for which the hook was called. - /// @return @ref PVR_ERROR_NO_ERROR if the hook was called successfully. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help - /// - virtual PVR_ERROR CallTimerMenuHook(const kodi::addon::PVRMenuhook& menuhook, - const kodi::addon::PVRTimer& item) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief **Callback to Kodi Function**\n - /// Request Kodi to update it's list of timers. - /// - /// @remarks Only called from addon itself - /// - inline void TriggerTimerUpdate() - { - m_instanceData->toKodi->TriggerTimerUpdate(m_instanceData->toKodi->kodiInstance); - } - //---------------------------------------------------------------------------- - - ///@} - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_PowerManagement 7. Power management events (optional) - /// @ingroup cpp_kodi_addon_pvr - /// @brief **Used to notify the pvr addon for power management events**\n - /// Used to allow any energy savings. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Power management events in interface:**\n - /// Copy this to your project and extend with your parts or leave functions - /// complete away where not used or supported. - /// - /// @copydetails cpp_kodi_addon_pvr_PowerManagement_header_addon_auto_check - /// @copydetails cpp_kodi_addon_pvr_PowerManagement_source_addon_auto_check - /// - ///@{ - - //============================================================================ - /// @brief To notify addon about system sleep - /// - /// @return @ref PVR_ERROR_NO_ERROR If successfully done. - /// - virtual PVR_ERROR OnSystemSleep() { return PVR_ERROR_NOT_IMPLEMENTED; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief To notify addon about system wake up - /// - /// @return @ref PVR_ERROR_NO_ERROR If successfully done. - /// - virtual PVR_ERROR OnSystemWake() { return PVR_ERROR_NOT_IMPLEMENTED; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief To notify addon power saving on system is activated - /// - /// @return @ref PVR_ERROR_NO_ERROR If successfully done. - /// - virtual PVR_ERROR OnPowerSavingActivated() { return PVR_ERROR_NOT_IMPLEMENTED; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief To notify addon power saving on system is deactivated - /// - /// @return @ref PVR_ERROR_NO_ERROR If successfully done. - /// - virtual PVR_ERROR OnPowerSavingDeactivated() { return PVR_ERROR_NOT_IMPLEMENTED; } - //---------------------------------------------------------------------------- - - ///@} - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Streams 8. Inputstream - /// @ingroup cpp_kodi_addon_pvr - /// @brief **PVR Inputstream**\n - /// This includes functions that are used in the PVR inputstream. - /// - /// @warning The parts here will be removed in the future and replaced by the - /// separate @ref cpp_kodi_addon_inputstream "inputstream addon instance". - /// If there is already a possibility, new addons should do it via the - /// inputstream instance. - /// - ///@{ - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Streams_TV 8.1. TV stream - /// @ingroup cpp_kodi_addon_pvr_Streams - /// @brief **PVR TV stream**\n - /// Stream processing regarding live TV. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **TV stream parts in interface:**\n - /// Copy this to your project and extend with your parts or leave functions - /// complete away where not used or supported. - /// - /// @copydetails cpp_kodi_addon_pvr_Streams_TV_header_addon_auto_check - /// @copydetails cpp_kodi_addon_pvr_Streams_TV_source_addon_auto_check - /// - ///@{ - - //============================================================================ - /// @brief Open a live stream on the backend. - /// - /// @param[in] channel The channel to stream. - /// @return True if the stream has been opened successfully, false otherwise. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Channel_PVRChannel_Help - /// - /// - /// -------------------------------------------------------------------------- - /// - /// @remarks Required if @ref PVRCapabilities::SetHandlesInputStream() or - /// @ref PVRCapabilities::SetHandlesDemuxing() is set to true. - /// @ref CloseLiveStream() will always be called by Kodi prior to calling this - /// function. - /// - virtual bool OpenLiveStream(const kodi::addon::PVRChannel& channel) { return false; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Close an open live stream. - /// - /// @remarks Required if @ref PVRCapabilities::SetHandlesInputStream() or - /// @ref PVRCapabilities::SetHandlesDemuxing() is set to true. - /// - virtual void CloseLiveStream() {} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Read from an open live stream. - /// - /// @param[in] pBuffer The buffer to store the data in. - /// @param[in] iBufferSize The amount of bytes to read. - /// @return The amount of bytes that were actually read from the stream. - /// - /// @remarks Required if @ref PVRCapabilities::SetHandlesInputStream() is set - /// to true. - /// - virtual int ReadLiveStream(unsigned char* buffer, unsigned int size) { return 0; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Seek in a live stream on a backend that supports timeshifting. - /// - /// @param[in] position The position to seek to. - /// @param[in] whence [optional] offset relative to - /// You can set the value of whence to one of three things: - /// | Value | int | Description | - /// |:--------:|:---:|:----------------------------------------------------| - /// | SEEK_SET | 0 | position is relative to the beginning of the file. This is probably what you had in mind anyway, and is the most commonly used value for whence. - /// | SEEK_CUR | 1 | position is relative to the current file pointer position. So, in effect, you can say, "Move to my current position plus 30 bytes," or, "move to my current position minus 20 bytes." - /// | SEEK_END | 2 | position is relative to the end of the file. Just like SEEK_SET except from the other end of the file. Be sure to use negative values for offset if you want to back up from the end of the file, instead of going past the end into oblivion. - /// - /// @return The new position. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetHandlesInputStream() - /// is set to true. - /// - virtual int64_t SeekLiveStream(int64_t position, int whence) { return 0; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Obtain the length of a live stream. - /// - /// @return The total length of the stream that's currently being read. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetHandlesInputStream() - /// is set to true. - /// - virtual int64_t LengthLiveStream() { return 0; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Streams_TV_Demux 8.1.1. Stream demuxing - /// @ingroup cpp_kodi_addon_pvr_Streams_TV - /// @brief **PVR stream demuxing**\n - /// Read TV streams with own demux within addon. - /// - /// This is only on Live TV streams and only if @ref PVRCapabilities::SetHandlesDemuxing() - /// has been set to "true". - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Stream demuxing parts in interface:**\n - /// Copy this to your project and extend with your parts or leave functions - /// complete away where not used or supported. - /// - /// @copydetails cpp_kodi_addon_pvr_Streams_TV_Demux_header_addon_auto_check - /// @copydetails cpp_kodi_addon_pvr_Streams_TV_Demux_source_addon_auto_check - /// - ///@{ - - //============================================================================ - /// @brief Get the stream properties of the stream that's currently being read. - /// - /// @param[in] properties The properties of the currently playing stream. - /// @return @ref PVR_ERROR_NO_ERROR if the properties have been fetched successfully. - /// - /// @remarks Required, and only used if addon has its own demuxer. - /// - virtual PVR_ERROR GetStreamProperties(std::vector& properties) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief 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 @ref AllocateDemuxPacket(0) on the callback. - /// If the stream changed and Kodi's player needs to be reinitialised, then, - /// the add-on should call @ref AllocateDemuxPacket(0) on the callback, and set - /// the streamid to @ref DMX_SPECIALID_STREAMCHANGE and return the value. - /// The add-on should return `nullptr` if an error occurred. - /// - /// @remarks Required, and only used if addon has its own demuxer. - /// Return `nullptr` if this add-on won't provide this function. - /// - virtual DemuxPacket* DemuxRead() { return nullptr; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Reset the demultiplexer in the add-on. - /// - /// @remarks Required, and only used if addon has its own demuxer. - /// - virtual void DemuxReset() {} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Abort the demultiplexer thread in the add-on. - /// - /// @remarks Required, and only used if addon has its own demuxer. - /// - virtual void DemuxAbort() {} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Flush all data that's currently in the demultiplexer buffer in the - /// add-on. - /// - /// @remarks Required, and only used if addon has its own demuxer. - /// - virtual void DemuxFlush() {} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Notify the pvr addon/demuxer that Kodi wishes to change playback - /// speed. - /// - /// @param[in] speed The requested playback speed - /// - /// @remarks Optional, and only used if addon has its own demuxer. - /// - virtual void SetSpeed(int speed) {} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Notify the pvr addon/demuxer that Kodi wishes to fill demux queue. - /// - /// @param[in] mode The requested filling mode - /// - /// @remarks Optional, and only used if addon has its own demuxer. - /// - virtual void FillBuffer(bool mode) {} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Notify the pvr addon/demuxer that Kodi wishes to seek the stream by - /// time. - /// - /// @param[in] time The absolute time since stream start - /// @param[in] backwards True to seek to keyframe BEFORE time, else AFTER - /// @param[in] 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. - /// - virtual bool SeekTime(double time, bool backwards, double& startpts) { return false; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief **Callback to Kodi Function**\n - /// Get the codec id used by Kodi. - /// - /// @param[in] codecName The name of the codec - /// @return The codec_id, or a codec_id with 0 values when not supported - /// - /// @remarks Only called from addon itself - /// - inline PVRCodec GetCodecByName(const std::string& codecName) const - { - return PVRCodec(m_instanceData->toKodi->GetCodecByName(m_instanceData->toKodi->kodiInstance, - codecName.c_str())); - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief **Callback to Kodi Function**\n - /// Allocate a demux packet. Free with @ref FreeDemuxPacket(). - /// - /// @param[in] iDataSize The size of the data that will go into the packet - /// @return The allocated packet - /// - /// @remarks Only called from addon itself - /// - inline DemuxPacket* AllocateDemuxPacket(int iDataSize) - { - return m_instanceData->toKodi->AllocateDemuxPacket(m_instanceData->toKodi->kodiInstance, - iDataSize); - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief **Callback to Kodi Function**\n - /// Free a packet that was allocated with @ref AllocateDemuxPacket(). - /// - /// @param[in] pPacket The packet to free - /// - /// @remarks Only called from addon itself. - /// - inline void FreeDemuxPacket(DemuxPacket* pPacket) - { - m_instanceData->toKodi->FreeDemuxPacket(m_instanceData->toKodi->kodiInstance, pPacket); - } - //---------------------------------------------------------------------------- - ///@} - - ///@} - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Streams_Recording 8.2. Recording stream - /// @ingroup cpp_kodi_addon_pvr_Streams - /// @brief **PVR Recording stream**\n - /// Stream processing regarding recordings. - /// - /// @note Demuxing is not possible with the recordings. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Recording stream parts in interface:**\n - /// Copy this to your project and extend with your parts or leave functions - /// complete away where not used or supported. - /// - /// @copydetails cpp_kodi_addon_pvr_Streams_Recording_header_addon_auto_check - /// @copydetails cpp_kodi_addon_pvr_Streams_Recording_source_addon_auto_check - /// - ///@{ - - //============================================================================ - /// @brief Open a stream to a recording on the backend. - /// - /// @param[in] recording The recording to open. - /// @return True if the stream has been opened successfully, false otherwise. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings() - /// is set to true. @ref CloseRecordedStream() will always be called by Kodi - /// prior to calling this function. - /// - virtual bool OpenRecordedStream(const kodi::addon::PVRRecording& recording) { return false; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Close an open stream from a recording. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings() - /// is set to true. - /// - virtual void CloseRecordedStream() {} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Read from a recording. - /// - /// @param[in] buffer The buffer to store the data in. - /// @param[in] size The amount of bytes to read. - /// @return The amount of bytes that were actually read from the stream. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings() - /// is set to true. - /// - virtual int ReadRecordedStream(unsigned char* buffer, unsigned int size) { return 0; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Seek in a recorded stream. - /// - /// @param[in] position The position to seek to. - /// @param[in] whence [optional] offset relative to - /// You can set the value of whence to one of three things: - /// | Value | int | Description | - /// |:--------:|:---:|:----------------------------------------------------| - /// | SEEK_SET | 0 | position is relative to the beginning of the file. This is probably what you had in mind anyway, and is the most commonly used value for whence. - /// | SEEK_CUR | 1 | position is relative to the current file pointer position. So, in effect, you can say, "Move to my current position plus 30 bytes," or, "move to my current position minus 20 bytes." - /// | SEEK_END | 2 | position is relative to the end of the file. Just like SEEK_SET except from the other end of the file. Be sure to use negative values for offset if you want to back up from the end of the file, instead of going past the end into oblivion. - /// - /// @return The new position. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings() - /// is set to true. - /// - virtual int64_t SeekRecordedStream(int64_t position, int whence) { return 0; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Obtain the length of a recorded stream. - /// - /// @return The total length of the stream that's currently being read. - /// - /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings() - /// is true (=> @ref ReadRecordedStream). - /// - virtual int64_t LengthRecordedStream() { return 0; } - //---------------------------------------------------------------------------- - - ///@} - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Streams_Various 8.3. Various functions - /// @ingroup cpp_kodi_addon_pvr_Streams - /// @brief **Various other PVR stream related functions**\n - /// These apply to all other groups in inputstream and are therefore declared - /// as several. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Various stream parts in interface:**\n - /// Copy this to your project and extend with your parts or leave functions - /// complete away where not used or supported. - /// - /// @copydetails cpp_kodi_addon_pvr_Streams_Various_header_addon_auto_check - /// @copydetails cpp_kodi_addon_pvr_Streams_Various_source_addon_auto_check - /// - ///@{ - - //============================================================================ - /// - /// @brief Check if the backend support pausing the currently playing stream. - /// - /// This will enable/disable the pause button in Kodi based on the return - /// value. - /// - /// @return false if the PVR addon/backend does not support pausing, true if - /// possible - /// - virtual bool CanPauseStream() { return false; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Check if the backend supports seeking for the currently playing - /// stream. - /// - /// This will enable/disable the rewind/forward buttons in Kodi based on the - /// return value. - /// - /// @return false if the PVR addon/backend does not support seeking, true if - /// possible - /// - virtual bool CanSeekStream() { return false; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Notify the pvr addon that Kodi (un)paused the currently playing - /// stream. - /// - /// @param[in] paused To inform by `true` is paused and with `false` playing - /// - virtual void PauseStream(bool paused) {} - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Check for real-time streaming. - /// - /// @return true if current stream is real-time - /// - virtual bool IsRealTimeStream() { return false; } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Get stream times. - /// - /// @param[out] times A pointer to the data to be filled by the implementation. - /// @return @ref PVR_ERROR_NO_ERROR on success. - /// - virtual PVR_ERROR GetStreamTimes(kodi::addon::PVRStreamTimes& times) - { - return PVR_ERROR_NOT_IMPLEMENTED; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// @brief Obtain the chunk size to use when reading streams. - /// - /// @param[out] chunksize must be filled with the chunk size in bytes. - /// @return @ref PVR_ERROR_NO_ERROR if the chunk size has been fetched successfully. - /// - /// @remarks Optional, and only used if not reading from demuxer (=> @ref DemuxRead) and - /// @ref PVRCapabilities::SetSupportsRecordings() is true (=> @ref ReadRecordedStream) or - /// @ref PVRCapabilities::SetHandlesInputStream() is true (=> @ref ReadLiveStream). - /// - virtual PVR_ERROR GetStreamReadChunkSize(int& chunksize) { return PVR_ERROR_NOT_IMPLEMENTED; } - //---------------------------------------------------------------------------- - - ///@} - //--==----==----==----==----==----==----==----==----==----==----==----==----== - -private: - void SetAddonStruct(KODI_HANDLE instance, const std::string& kodiVersion) - { - if (instance == nullptr) - throw std::logic_error("kodi::addon::CInstancePVRClient: Creation with empty addon " - "structure not allowed, table must be given from Kodi!"); - - m_instanceData = static_cast(instance); - m_instanceData->toAddon->addonInstance = this; - //--==----==----==----==----==----==----==----==----==----==----==----==----== - m_instanceData->toAddon->GetCapabilities = ADDON_GetCapabilities; - m_instanceData->toAddon->GetConnectionString = ADDON_GetConnectionString; - m_instanceData->toAddon->GetBackendName = ADDON_GetBackendName; - m_instanceData->toAddon->GetBackendVersion = ADDON_GetBackendVersion; - m_instanceData->toAddon->GetBackendHostname = ADDON_GetBackendHostname; - m_instanceData->toAddon->GetDriveSpace = ADDON_GetDriveSpace; - m_instanceData->toAddon->CallSettingsMenuHook = ADDON_CallSettingsMenuHook; - //--==----==----==----==----==----==----==----==----==----==----==----==----== - m_instanceData->toAddon->GetChannelsAmount = ADDON_GetChannelsAmount; - m_instanceData->toAddon->GetChannels = ADDON_GetChannels; - m_instanceData->toAddon->GetChannelStreamProperties = ADDON_GetChannelStreamProperties; - m_instanceData->toAddon->GetSignalStatus = ADDON_GetSignalStatus; - m_instanceData->toAddon->GetDescrambleInfo = ADDON_GetDescrambleInfo; - //--==----==----==----==----==----==----==----==----==----==----==----==----== - m_instanceData->toAddon->GetChannelGroupsAmount = ADDON_GetChannelGroupsAmount; - m_instanceData->toAddon->GetChannelGroups = ADDON_GetChannelGroups; - m_instanceData->toAddon->GetChannelGroupMembers = ADDON_GetChannelGroupMembers; - //--==----==----==----==----==----==----==----==----==----==----==----==----== - m_instanceData->toAddon->DeleteChannel = ADDON_DeleteChannel; - m_instanceData->toAddon->RenameChannel = ADDON_RenameChannel; - m_instanceData->toAddon->OpenDialogChannelSettings = ADDON_OpenDialogChannelSettings; - m_instanceData->toAddon->OpenDialogChannelAdd = ADDON_OpenDialogChannelAdd; - m_instanceData->toAddon->OpenDialogChannelScan = ADDON_OpenDialogChannelScan; - m_instanceData->toAddon->CallChannelMenuHook = ADDON_CallChannelMenuHook; - //--==----==----==----==----==----==----==----==----==----==----==----==----== - m_instanceData->toAddon->GetEPGForChannel = ADDON_GetEPGForChannel; - m_instanceData->toAddon->IsEPGTagRecordable = ADDON_IsEPGTagRecordable; - m_instanceData->toAddon->IsEPGTagPlayable = ADDON_IsEPGTagPlayable; - m_instanceData->toAddon->GetEPGTagEdl = ADDON_GetEPGTagEdl; - m_instanceData->toAddon->GetEPGTagStreamProperties = ADDON_GetEPGTagStreamProperties; - m_instanceData->toAddon->SetEPGTimeFrame = ADDON_SetEPGTimeFrame; - m_instanceData->toAddon->CallEPGMenuHook = ADDON_CallEPGMenuHook; - //--==----==----==----==----==----==----==----==----==----==----==----==----== - m_instanceData->toAddon->GetRecordingsAmount = ADDON_GetRecordingsAmount; - m_instanceData->toAddon->GetRecordings = ADDON_GetRecordings; - m_instanceData->toAddon->DeleteRecording = ADDON_DeleteRecording; - m_instanceData->toAddon->UndeleteRecording = ADDON_UndeleteRecording; - m_instanceData->toAddon->DeleteAllRecordingsFromTrash = ADDON_DeleteAllRecordingsFromTrash; - m_instanceData->toAddon->RenameRecording = ADDON_RenameRecording; - m_instanceData->toAddon->SetRecordingLifetime = ADDON_SetRecordingLifetime; - m_instanceData->toAddon->SetRecordingPlayCount = ADDON_SetRecordingPlayCount; - m_instanceData->toAddon->SetRecordingLastPlayedPosition = ADDON_SetRecordingLastPlayedPosition; - m_instanceData->toAddon->GetRecordingLastPlayedPosition = ADDON_GetRecordingLastPlayedPosition; - m_instanceData->toAddon->GetRecordingEdl = ADDON_GetRecordingEdl; - m_instanceData->toAddon->GetRecordingSize = ADDON_GetRecordingSize; - m_instanceData->toAddon->GetRecordingStreamProperties = ADDON_GetRecordingStreamProperties; - m_instanceData->toAddon->CallRecordingMenuHook = ADDON_CallRecordingMenuHook; - //--==----==----==----==----==----==----==----==----==----==----==----==----== - m_instanceData->toAddon->GetTimerTypes = ADDON_GetTimerTypes; - m_instanceData->toAddon->GetTimersAmount = ADDON_GetTimersAmount; - m_instanceData->toAddon->GetTimers = ADDON_GetTimers; - m_instanceData->toAddon->AddTimer = ADDON_AddTimer; - m_instanceData->toAddon->DeleteTimer = ADDON_DeleteTimer; - m_instanceData->toAddon->UpdateTimer = ADDON_UpdateTimer; - m_instanceData->toAddon->CallTimerMenuHook = ADDON_CallTimerMenuHook; - //--==----==----==----==----==----==----==----==----==----==----==----==----== - m_instanceData->toAddon->OnSystemSleep = ADDON_OnSystemSleep; - m_instanceData->toAddon->OnSystemWake = ADDON_OnSystemWake; - m_instanceData->toAddon->OnPowerSavingActivated = ADDON_OnPowerSavingActivated; - m_instanceData->toAddon->OnPowerSavingDeactivated = ADDON_OnPowerSavingDeactivated; - //--==----==----==----==----==----==----==----==----==----==----==----==----== - m_instanceData->toAddon->OpenLiveStream = ADDON_OpenLiveStream; - m_instanceData->toAddon->CloseLiveStream = ADDON_CloseLiveStream; - m_instanceData->toAddon->ReadLiveStream = ADDON_ReadLiveStream; - m_instanceData->toAddon->SeekLiveStream = ADDON_SeekLiveStream; - m_instanceData->toAddon->LengthLiveStream = ADDON_LengthLiveStream; - m_instanceData->toAddon->GetStreamProperties = ADDON_GetStreamProperties; - m_instanceData->toAddon->GetStreamReadChunkSize = ADDON_GetStreamReadChunkSize; - m_instanceData->toAddon->IsRealTimeStream = ADDON_IsRealTimeStream; - //--==----==----==----==----==----==----==----==----==----==----==----==----== - m_instanceData->toAddon->OpenRecordedStream = ADDON_OpenRecordedStream; - m_instanceData->toAddon->CloseRecordedStream = ADDON_CloseRecordedStream; - m_instanceData->toAddon->ReadRecordedStream = ADDON_ReadRecordedStream; - m_instanceData->toAddon->SeekRecordedStream = ADDON_SeekRecordedStream; - m_instanceData->toAddon->LengthRecordedStream = ADDON_LengthRecordedStream; - //--==----==----==----==----==----==----==----==----==----==----==----==----== - m_instanceData->toAddon->DemuxReset = ADDON_DemuxReset; - m_instanceData->toAddon->DemuxAbort = ADDON_DemuxAbort; - m_instanceData->toAddon->DemuxFlush = ADDON_DemuxFlush; - m_instanceData->toAddon->DemuxRead = ADDON_DemuxRead; - //--==----==----==----==----==----==----==----==----==----==----==----==----== - m_instanceData->toAddon->CanPauseStream = ADDON_CanPauseStream; - m_instanceData->toAddon->PauseStream = ADDON_PauseStream; - m_instanceData->toAddon->CanSeekStream = ADDON_CanSeekStream; - m_instanceData->toAddon->SeekTime = ADDON_SeekTime; - m_instanceData->toAddon->SetSpeed = ADDON_SetSpeed; - m_instanceData->toAddon->FillBuffer = ADDON_FillBuffer; - m_instanceData->toAddon->GetStreamTimes = ADDON_GetStreamTimes; - } - - inline static PVR_ERROR ADDON_GetCapabilities(const AddonInstance_PVR* instance, - PVR_ADDON_CAPABILITIES* capabilities) - { - PVRCapabilities cppCapabilities(capabilities); - return static_cast(instance->toAddon->addonInstance) - ->GetCapabilities(cppCapabilities); - } - - inline static PVR_ERROR ADDON_GetBackendName(const AddonInstance_PVR* instance, - char* str, - int memSize) - { - std::string backendName; - PVR_ERROR err = static_cast(instance->toAddon->addonInstance) - ->GetBackendName(backendName); - if (err == PVR_ERROR_NO_ERROR) - strncpy(str, backendName.c_str(), memSize); - return err; - } - - inline static PVR_ERROR ADDON_GetBackendVersion(const AddonInstance_PVR* instance, - char* str, - int memSize) - { - std::string backendVersion; - PVR_ERROR err = static_cast(instance->toAddon->addonInstance) - ->GetBackendVersion(backendVersion); - if (err == PVR_ERROR_NO_ERROR) - strncpy(str, backendVersion.c_str(), memSize); - return err; - } - - inline static PVR_ERROR ADDON_GetBackendHostname(const AddonInstance_PVR* instance, - char* str, - int memSize) - { - std::string backendHostname; - PVR_ERROR err = static_cast(instance->toAddon->addonInstance) - ->GetBackendHostname(backendHostname); - if (err == PVR_ERROR_NO_ERROR) - strncpy(str, backendHostname.c_str(), memSize); - return err; - } - - inline static PVR_ERROR ADDON_GetConnectionString(const AddonInstance_PVR* instance, - char* str, - int memSize) - { - std::string connectionString; - PVR_ERROR err = static_cast(instance->toAddon->addonInstance) - ->GetConnectionString(connectionString); - if (err == PVR_ERROR_NO_ERROR) - strncpy(str, connectionString.c_str(), memSize); - return err; - } - - inline static PVR_ERROR ADDON_GetDriveSpace(const AddonInstance_PVR* instance, - uint64_t* total, - uint64_t* used) - { - return static_cast(instance->toAddon->addonInstance) - ->GetDriveSpace(*total, *used); - } - - inline static PVR_ERROR ADDON_CallSettingsMenuHook(const AddonInstance_PVR* instance, - const PVR_MENUHOOK* menuhook) - { - return static_cast(instance->toAddon->addonInstance) - ->CallSettingsMenuHook(menuhook); - } - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - inline static PVR_ERROR ADDON_GetChannelsAmount(const AddonInstance_PVR* instance, int* amount) - { - return static_cast(instance->toAddon->addonInstance) - ->GetChannelsAmount(*amount); - } - - inline static PVR_ERROR ADDON_GetChannels(const AddonInstance_PVR* instance, - ADDON_HANDLE handle, - bool radio) - { - PVRChannelsResultSet result(instance, handle); - return static_cast(instance->toAddon->addonInstance) - ->GetChannels(radio, result); - } - - inline static PVR_ERROR ADDON_GetChannelStreamProperties(const AddonInstance_PVR* instance, - const PVR_CHANNEL* channel, - PVR_NAMED_VALUE* properties, - unsigned int* propertiesCount) - { - *propertiesCount = 0; - std::vector propertiesList; - PVR_ERROR error = static_cast(instance->toAddon->addonInstance) - ->GetChannelStreamProperties(channel, propertiesList); - if (error == PVR_ERROR_NO_ERROR) - { - for (const auto& property : propertiesList) - { - strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName, - sizeof(properties[*propertiesCount].strName) - 1); - strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue, - sizeof(properties[*propertiesCount].strValue) - 1); - ++*propertiesCount; - if (*propertiesCount > STREAM_MAX_PROPERTY_COUNT) - break; - } - } - return error; - } - - inline static PVR_ERROR ADDON_GetSignalStatus(const AddonInstance_PVR* instance, - int channelUid, - PVR_SIGNAL_STATUS* signalStatus) - { - PVRSignalStatus cppSignalStatus(signalStatus); - return static_cast(instance->toAddon->addonInstance) - ->GetSignalStatus(channelUid, cppSignalStatus); - } - - inline static PVR_ERROR ADDON_GetDescrambleInfo(const AddonInstance_PVR* instance, - int channelUid, - PVR_DESCRAMBLE_INFO* descrambleInfo) - { - PVRDescrambleInfo cppDescrambleInfo(descrambleInfo); - return static_cast(instance->toAddon->addonInstance) - ->GetDescrambleInfo(channelUid, cppDescrambleInfo); - } - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - inline static PVR_ERROR ADDON_GetChannelGroupsAmount(const AddonInstance_PVR* instance, - int* amount) - { - return static_cast(instance->toAddon->addonInstance) - ->GetChannelGroupsAmount(*amount); - } - - inline static PVR_ERROR ADDON_GetChannelGroups(const AddonInstance_PVR* instance, - ADDON_HANDLE handle, - bool radio) - { - PVRChannelGroupsResultSet result(instance, handle); - return static_cast(instance->toAddon->addonInstance) - ->GetChannelGroups(radio, result); - } - - inline static PVR_ERROR ADDON_GetChannelGroupMembers(const AddonInstance_PVR* instance, - ADDON_HANDLE handle, - const PVR_CHANNEL_GROUP* group) - { - PVRChannelGroupMembersResultSet result(instance, handle); - return static_cast(instance->toAddon->addonInstance) - ->GetChannelGroupMembers(group, result); - } - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - inline static PVR_ERROR ADDON_DeleteChannel(const AddonInstance_PVR* instance, - const PVR_CHANNEL* channel) - { - return static_cast(instance->toAddon->addonInstance) - ->DeleteChannel(channel); - } - - inline static PVR_ERROR ADDON_RenameChannel(const AddonInstance_PVR* instance, - const PVR_CHANNEL* channel) - { - return static_cast(instance->toAddon->addonInstance) - ->RenameChannel(channel); - } - - inline static PVR_ERROR ADDON_OpenDialogChannelSettings(const AddonInstance_PVR* instance, - const PVR_CHANNEL* channel) - { - return static_cast(instance->toAddon->addonInstance) - ->OpenDialogChannelSettings(channel); - } - - inline static PVR_ERROR ADDON_OpenDialogChannelAdd(const AddonInstance_PVR* instance, - const PVR_CHANNEL* channel) - { - return static_cast(instance->toAddon->addonInstance) - ->OpenDialogChannelAdd(channel); - } - - inline static PVR_ERROR ADDON_OpenDialogChannelScan(const AddonInstance_PVR* instance) - { - return static_cast(instance->toAddon->addonInstance) - ->OpenDialogChannelScan(); - } - - inline static PVR_ERROR ADDON_CallChannelMenuHook(const AddonInstance_PVR* instance, - const PVR_MENUHOOK* menuhook, - const PVR_CHANNEL* channel) - { - return static_cast(instance->toAddon->addonInstance) - ->CallChannelMenuHook(menuhook, channel); - } - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - inline static PVR_ERROR ADDON_GetEPGForChannel(const AddonInstance_PVR* instance, - ADDON_HANDLE handle, - int channelUid, - time_t start, - time_t end) - { - PVREPGTagsResultSet result(instance, handle); - return static_cast(instance->toAddon->addonInstance) - ->GetEPGForChannel(channelUid, start, end, result); - } - - inline static PVR_ERROR ADDON_IsEPGTagRecordable(const AddonInstance_PVR* instance, - const EPG_TAG* tag, - bool* isRecordable) - { - return static_cast(instance->toAddon->addonInstance) - ->IsEPGTagRecordable(tag, *isRecordable); - } - - inline static PVR_ERROR ADDON_IsEPGTagPlayable(const AddonInstance_PVR* instance, - const EPG_TAG* tag, - bool* isPlayable) - { - return static_cast(instance->toAddon->addonInstance) - ->IsEPGTagPlayable(tag, *isPlayable); - } - - inline static PVR_ERROR ADDON_GetEPGTagEdl(const AddonInstance_PVR* instance, - const EPG_TAG* tag, - PVR_EDL_ENTRY* edl, - int* size) - { - *size = 0; - std::vector edlList; - PVR_ERROR error = static_cast(instance->toAddon->addonInstance) - ->GetEPGTagEdl(tag, edlList); - if (error == PVR_ERROR_NO_ERROR) - { - for (const auto& edlEntry : edlList) - { - edl[*size] = *edlEntry; - ++*size; - } - } - return error; - } - - inline static PVR_ERROR ADDON_GetEPGTagStreamProperties(const AddonInstance_PVR* instance, - const EPG_TAG* tag, - PVR_NAMED_VALUE* properties, - unsigned int* propertiesCount) - { - *propertiesCount = 0; - std::vector propertiesList; - PVR_ERROR error = static_cast(instance->toAddon->addonInstance) - ->GetEPGTagStreamProperties(tag, propertiesList); - if (error == PVR_ERROR_NO_ERROR) - { - for (const auto& property : propertiesList) - { - strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName, - sizeof(properties[*propertiesCount].strName) - 1); - strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue, - sizeof(properties[*propertiesCount].strValue) - 1); - ++*propertiesCount; - if (*propertiesCount > STREAM_MAX_PROPERTY_COUNT) - break; - } - } - return error; - } - - inline static PVR_ERROR ADDON_SetEPGTimeFrame(const AddonInstance_PVR* instance, int days) - { - return static_cast(instance->toAddon->addonInstance) - ->SetEPGTimeFrame(days); - } - - inline static PVR_ERROR ADDON_CallEPGMenuHook(const AddonInstance_PVR* instance, - const PVR_MENUHOOK* menuhook, - const EPG_TAG* tag) - { - return static_cast(instance->toAddon->addonInstance) - ->CallEPGMenuHook(menuhook, tag); - } - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - inline static PVR_ERROR ADDON_GetRecordingsAmount(const AddonInstance_PVR* instance, - bool deleted, - int* amount) - { - return static_cast(instance->toAddon->addonInstance) - ->GetRecordingsAmount(deleted, *amount); - } - - inline static PVR_ERROR ADDON_GetRecordings(const AddonInstance_PVR* instance, - ADDON_HANDLE handle, - bool deleted) - { - PVRRecordingsResultSet result(instance, handle); - return static_cast(instance->toAddon->addonInstance) - ->GetRecordings(deleted, result); - } - - inline static PVR_ERROR ADDON_DeleteRecording(const AddonInstance_PVR* instance, - const PVR_RECORDING* recording) - { - return static_cast(instance->toAddon->addonInstance) - ->DeleteRecording(recording); - } - - inline static PVR_ERROR ADDON_UndeleteRecording(const AddonInstance_PVR* instance, - const PVR_RECORDING* recording) - { - return static_cast(instance->toAddon->addonInstance) - ->UndeleteRecording(recording); - } - - inline static PVR_ERROR ADDON_DeleteAllRecordingsFromTrash(const AddonInstance_PVR* instance) - { - return static_cast(instance->toAddon->addonInstance) - ->DeleteAllRecordingsFromTrash(); - } - - inline static PVR_ERROR ADDON_RenameRecording(const AddonInstance_PVR* instance, - const PVR_RECORDING* recording) - { - return static_cast(instance->toAddon->addonInstance) - ->RenameRecording(recording); - } - - inline static PVR_ERROR ADDON_SetRecordingLifetime(const AddonInstance_PVR* instance, - const PVR_RECORDING* recording) - { - return static_cast(instance->toAddon->addonInstance) - ->SetRecordingLifetime(recording); - } - - inline static PVR_ERROR ADDON_SetRecordingPlayCount(const AddonInstance_PVR* instance, - const PVR_RECORDING* recording, - int count) - { - return static_cast(instance->toAddon->addonInstance) - ->SetRecordingPlayCount(recording, count); - } - - inline static PVR_ERROR ADDON_SetRecordingLastPlayedPosition(const AddonInstance_PVR* instance, - const PVR_RECORDING* recording, - int lastplayedposition) - { - return static_cast(instance->toAddon->addonInstance) - ->SetRecordingLastPlayedPosition(recording, lastplayedposition); - } - - inline static PVR_ERROR ADDON_GetRecordingLastPlayedPosition(const AddonInstance_PVR* instance, - const PVR_RECORDING* recording, - int* position) - { - return static_cast(instance->toAddon->addonInstance) - ->GetRecordingLastPlayedPosition(recording, *position); - } - - inline static PVR_ERROR ADDON_GetRecordingEdl(const AddonInstance_PVR* instance, - const PVR_RECORDING* recording, - PVR_EDL_ENTRY* edl, - int* size) - { - *size = 0; - std::vector edlList; - PVR_ERROR error = static_cast(instance->toAddon->addonInstance) - ->GetRecordingEdl(recording, edlList); - if (error == PVR_ERROR_NO_ERROR) - { - for (const auto& edlEntry : edlList) - { - edl[*size] = *edlEntry; - ++*size; - } - } - return error; - } - - inline static PVR_ERROR ADDON_GetRecordingSize(const AddonInstance_PVR* instance, - const PVR_RECORDING* recording, - int64_t* size) - { - return static_cast(instance->toAddon->addonInstance) - ->GetRecordingSize(recording, *size); - } - - inline static PVR_ERROR ADDON_GetRecordingStreamProperties(const AddonInstance_PVR* instance, - const PVR_RECORDING* recording, - PVR_NAMED_VALUE* properties, - unsigned int* propertiesCount) - { - *propertiesCount = 0; - std::vector propertiesList; - PVR_ERROR error = static_cast(instance->toAddon->addonInstance) - ->GetRecordingStreamProperties(recording, propertiesList); - if (error == PVR_ERROR_NO_ERROR) - { - for (const auto& property : propertiesList) - { - strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName, - sizeof(properties[*propertiesCount].strName) - 1); - strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue, - sizeof(properties[*propertiesCount].strValue) - 1); - ++*propertiesCount; - if (*propertiesCount > STREAM_MAX_PROPERTY_COUNT) - break; - } - } - return error; - } - - inline static PVR_ERROR ADDON_CallRecordingMenuHook(const AddonInstance_PVR* instance, - const PVR_MENUHOOK* menuhook, - const PVR_RECORDING* recording) - { - return static_cast(instance->toAddon->addonInstance) - ->CallRecordingMenuHook(menuhook, recording); - } - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - - inline static PVR_ERROR ADDON_GetTimerTypes(const AddonInstance_PVR* instance, - PVR_TIMER_TYPE* types, - int* typesCount) - { - *typesCount = 0; - std::vector timerTypes; - PVR_ERROR error = static_cast(instance->toAddon->addonInstance) - ->GetTimerTypes(timerTypes); - if (error == PVR_ERROR_NO_ERROR) - { - for (const auto& timerType : timerTypes) - { - types[*typesCount] = *timerType; - ++*typesCount; - if (*typesCount >= PVR_ADDON_TIMERTYPE_ARRAY_SIZE) - break; - } - } - return error; - } - - inline static PVR_ERROR ADDON_GetTimersAmount(const AddonInstance_PVR* instance, int* amount) - { - return static_cast(instance->toAddon->addonInstance) - ->GetTimersAmount(*amount); - } - - inline static PVR_ERROR ADDON_GetTimers(const AddonInstance_PVR* instance, ADDON_HANDLE handle) - { - PVRTimersResultSet result(instance, handle); - return static_cast(instance->toAddon->addonInstance)->GetTimers(result); - } - - inline static PVR_ERROR ADDON_AddTimer(const AddonInstance_PVR* instance, const PVR_TIMER* timer) - { - return static_cast(instance->toAddon->addonInstance)->AddTimer(timer); - } - - inline static PVR_ERROR ADDON_DeleteTimer(const AddonInstance_PVR* instance, - const PVR_TIMER* timer, - bool forceDelete) - { - return static_cast(instance->toAddon->addonInstance) - ->DeleteTimer(timer, forceDelete); - } - - inline static PVR_ERROR ADDON_UpdateTimer(const AddonInstance_PVR* instance, - const PVR_TIMER* timer) - { - return static_cast(instance->toAddon->addonInstance)->UpdateTimer(timer); - } - - inline static PVR_ERROR ADDON_CallTimerMenuHook(const AddonInstance_PVR* instance, - const PVR_MENUHOOK* menuhook, - const PVR_TIMER* timer) - { - return static_cast(instance->toAddon->addonInstance) - ->CallTimerMenuHook(menuhook, timer); - } - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - - inline static PVR_ERROR ADDON_OnSystemSleep(const AddonInstance_PVR* instance) - { - return static_cast(instance->toAddon->addonInstance)->OnSystemSleep(); - } - - inline static PVR_ERROR ADDON_OnSystemWake(const AddonInstance_PVR* instance) - { - return static_cast(instance->toAddon->addonInstance)->OnSystemWake(); - } - - inline static PVR_ERROR ADDON_OnPowerSavingActivated(const AddonInstance_PVR* instance) - { - return static_cast(instance->toAddon->addonInstance) - ->OnPowerSavingActivated(); - } - - inline static PVR_ERROR ADDON_OnPowerSavingDeactivated(const AddonInstance_PVR* instance) - { - return static_cast(instance->toAddon->addonInstance) - ->OnPowerSavingDeactivated(); - } - - // obsolete parts below - ///@{ - - inline static bool ADDON_OpenLiveStream(const AddonInstance_PVR* instance, - const PVR_CHANNEL* channel) - { - return static_cast(instance->toAddon->addonInstance) - ->OpenLiveStream(channel); - } - - inline static void ADDON_CloseLiveStream(const AddonInstance_PVR* instance) - { - static_cast(instance->toAddon->addonInstance)->CloseLiveStream(); - } - - inline static int ADDON_ReadLiveStream(const AddonInstance_PVR* instance, - unsigned char* buffer, - unsigned int size) - { - return static_cast(instance->toAddon->addonInstance) - ->ReadLiveStream(buffer, size); - } - - inline static int64_t ADDON_SeekLiveStream(const AddonInstance_PVR* instance, - int64_t position, - int whence) - { - return static_cast(instance->toAddon->addonInstance) - ->SeekLiveStream(position, whence); - } - - inline static int64_t ADDON_LengthLiveStream(const AddonInstance_PVR* instance) - { - return static_cast(instance->toAddon->addonInstance)->LengthLiveStream(); - } - - inline static PVR_ERROR ADDON_GetStreamProperties(const AddonInstance_PVR* instance, - PVR_STREAM_PROPERTIES* properties) - { - properties->iStreamCount = 0; - std::vector cppProperties; - PVR_ERROR err = static_cast(instance->toAddon->addonInstance) - ->GetStreamProperties(cppProperties); - if (err == PVR_ERROR_NO_ERROR) - { - for (unsigned int i = 0; i < cppProperties.size(); ++i) - { - memcpy(&properties->stream[i], - static_cast(cppProperties[i]), - sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); - ++properties->iStreamCount; - - if (properties->iStreamCount >= PVR_STREAM_MAX_STREAMS) - { - kodi::Log( - ADDON_LOG_ERROR, - "CInstancePVRClient::%s: Addon given with '%li' more allowed streams where '%i'", - __func__, cppProperties.size(), PVR_STREAM_MAX_STREAMS); - break; - } - } - } - - return err; - } - - inline static PVR_ERROR ADDON_GetStreamReadChunkSize(const AddonInstance_PVR* instance, - int* chunksize) - { - return static_cast(instance->toAddon->addonInstance) - ->GetStreamReadChunkSize(*chunksize); - } - - inline static bool ADDON_IsRealTimeStream(const AddonInstance_PVR* instance) - { - return static_cast(instance->toAddon->addonInstance)->IsRealTimeStream(); - } - - inline static bool ADDON_OpenRecordedStream(const AddonInstance_PVR* instance, - const PVR_RECORDING* recording) - { - return static_cast(instance->toAddon->addonInstance) - ->OpenRecordedStream(recording); - } - - inline static void ADDON_CloseRecordedStream(const AddonInstance_PVR* instance) - { - static_cast(instance->toAddon->addonInstance)->CloseRecordedStream(); - } - - inline static int ADDON_ReadRecordedStream(const AddonInstance_PVR* instance, - unsigned char* buffer, - unsigned int size) - { - return static_cast(instance->toAddon->addonInstance) - ->ReadRecordedStream(buffer, size); - } - - inline static int64_t ADDON_SeekRecordedStream(const AddonInstance_PVR* instance, - int64_t position, - int whence) - { - return static_cast(instance->toAddon->addonInstance) - ->SeekRecordedStream(position, whence); - } - - inline static int64_t ADDON_LengthRecordedStream(const AddonInstance_PVR* instance) - { - return static_cast(instance->toAddon->addonInstance) - ->LengthRecordedStream(); - } - - inline static void ADDON_DemuxReset(const AddonInstance_PVR* instance) - { - static_cast(instance->toAddon->addonInstance)->DemuxReset(); - } - - inline static void ADDON_DemuxAbort(const AddonInstance_PVR* instance) - { - static_cast(instance->toAddon->addonInstance)->DemuxAbort(); - } - - inline static void ADDON_DemuxFlush(const AddonInstance_PVR* instance) - { - static_cast(instance->toAddon->addonInstance)->DemuxFlush(); - } - - inline static DemuxPacket* ADDON_DemuxRead(const AddonInstance_PVR* instance) - { - return static_cast(instance->toAddon->addonInstance)->DemuxRead(); - } - - inline static bool ADDON_CanPauseStream(const AddonInstance_PVR* instance) - { - return static_cast(instance->toAddon->addonInstance)->CanPauseStream(); - } - - inline static bool ADDON_CanSeekStream(const AddonInstance_PVR* instance) - { - return static_cast(instance->toAddon->addonInstance)->CanSeekStream(); - } - - inline static void ADDON_PauseStream(const AddonInstance_PVR* instance, bool bPaused) - { - static_cast(instance->toAddon->addonInstance)->PauseStream(bPaused); - } - - inline static bool ADDON_SeekTime(const AddonInstance_PVR* instance, - double time, - bool backwards, - double* startpts) - { - return static_cast(instance->toAddon->addonInstance) - ->SeekTime(time, backwards, *startpts); - } - - inline static void ADDON_SetSpeed(const AddonInstance_PVR* instance, int speed) - { - static_cast(instance->toAddon->addonInstance)->SetSpeed(speed); - } - - inline static void ADDON_FillBuffer(const AddonInstance_PVR* instance, bool mode) - { - static_cast(instance->toAddon->addonInstance)->FillBuffer(mode); - } - - inline static PVR_ERROR ADDON_GetStreamTimes(const AddonInstance_PVR* instance, - PVR_STREAM_TIMES* times) - { - PVRStreamTimes cppTimes(times); - return static_cast(instance->toAddon->addonInstance) - ->GetStreamTimes(cppTimes); - } - ///@} - - AddonInstance_PVR* m_instanceData = nullptr; -}; -//}}} -//______________________________________________________________________________ - -} /* namespace addon */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Peripheral.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Peripheral.h deleted file mode 100644 index 2067d51..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Peripheral.h +++ /dev/null @@ -1,847 +0,0 @@ -/* - * Copyright (C) 2014-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../AddonBase.h" - -namespace kodi { namespace addon { class CInstancePeripheral; }} - -/* indicates a joystick has no preference for port number */ -#define NO_PORT_REQUESTED (-1) - -/* joystick's driver button/hat/axis index is unknown */ -#define DRIVER_INDEX_UNKNOWN (-1) - -extern "C" -{ - - /// @name Peripheral types - ///{ - - /*! - * @brief API error codes - */ - typedef enum PERIPHERAL_ERROR - { - PERIPHERAL_NO_ERROR = 0, // no error occurred - PERIPHERAL_ERROR_UNKNOWN = -1, // an unknown error occurred - PERIPHERAL_ERROR_FAILED = -2, // the command failed - PERIPHERAL_ERROR_INVALID_PARAMETERS = -3, // the parameters of the method are invalid for this operation - PERIPHERAL_ERROR_NOT_IMPLEMENTED = -4, // the method that the frontend called is not implemented - PERIPHERAL_ERROR_NOT_CONNECTED = -5, // no peripherals are connected - PERIPHERAL_ERROR_CONNECTION_FAILED = -6, // peripherals are connected, but command was interrupted - } PERIPHERAL_ERROR; - - /*! - * @brief Peripheral types - */ - typedef enum PERIPHERAL_TYPE - { - PERIPHERAL_TYPE_UNKNOWN, - PERIPHERAL_TYPE_JOYSTICK, - PERIPHERAL_TYPE_KEYBOARD, - } PERIPHERAL_TYPE; - - /*! - * @brief Information shared between peripherals - */ - typedef struct PERIPHERAL_INFO - { - PERIPHERAL_TYPE type; /*!< @brief type of peripheral */ - char* name; /*!< @brief name of peripheral */ - uint16_t vendor_id; /*!< @brief vendor ID of peripheral, 0x0000 if unknown */ - uint16_t product_id; /*!< @brief product ID of peripheral, 0x0000 if unknown */ - unsigned int index; /*!< @brief the order in which the add-on identified this peripheral */ - } ATTRIBUTE_PACKED PERIPHERAL_INFO; - - /*! - * @brief Peripheral add-on capabilities. - */ - typedef struct PERIPHERAL_CAPABILITIES - { - bool provides_joysticks; /*!< @brief true if the add-on provides joysticks */ - bool provides_joystick_rumble; - bool provides_joystick_power_off; - bool provides_buttonmaps; /*!< @brief true if the add-on provides button maps */ - } ATTRIBUTE_PACKED PERIPHERAL_CAPABILITIES; - ///} - - /// @name Event types - ///{ - - /*! - * @brief Types of events that can be sent and received - */ - typedef enum PERIPHERAL_EVENT_TYPE - { - PERIPHERAL_EVENT_TYPE_NONE, /*!< @brief unknown event */ - PERIPHERAL_EVENT_TYPE_DRIVER_BUTTON, /*!< @brief state changed for joystick driver button */ - PERIPHERAL_EVENT_TYPE_DRIVER_HAT, /*!< @brief state changed for joystick driver hat */ - PERIPHERAL_EVENT_TYPE_DRIVER_AXIS, /*!< @brief state changed for joystick driver axis */ - PERIPHERAL_EVENT_TYPE_SET_MOTOR, /*!< @brief set the state for joystick rumble motor */ - } PERIPHERAL_EVENT_TYPE; - - /*! - * @brief States a button can have - */ - typedef enum JOYSTICK_STATE_BUTTON - { - JOYSTICK_STATE_BUTTON_UNPRESSED = 0x0, /*!< @brief button is released */ - JOYSTICK_STATE_BUTTON_PRESSED = 0x1, /*!< @brief button is pressed */ - } JOYSTICK_STATE_BUTTON; - - /*! - * @brief States a D-pad (also called a hat) can have - */ - typedef enum JOYSTICK_STATE_HAT - { - JOYSTICK_STATE_HAT_UNPRESSED = 0x0, /*!< @brief no directions are pressed */ - JOYSTICK_STATE_HAT_LEFT = 0x1, /*!< @brief only left is pressed */ - JOYSTICK_STATE_HAT_RIGHT = 0x2, /*!< @brief only right is pressed */ - JOYSTICK_STATE_HAT_UP = 0x4, /*!< @brief only up is pressed */ - JOYSTICK_STATE_HAT_DOWN = 0x8, /*!< @brief only down is pressed */ - JOYSTICK_STATE_HAT_LEFT_UP = JOYSTICK_STATE_HAT_LEFT | JOYSTICK_STATE_HAT_UP, - JOYSTICK_STATE_HAT_LEFT_DOWN = JOYSTICK_STATE_HAT_LEFT | JOYSTICK_STATE_HAT_DOWN, - JOYSTICK_STATE_HAT_RIGHT_UP = JOYSTICK_STATE_HAT_RIGHT | JOYSTICK_STATE_HAT_UP, - JOYSTICK_STATE_HAT_RIGHT_DOWN = JOYSTICK_STATE_HAT_RIGHT | JOYSTICK_STATE_HAT_DOWN, - } JOYSTICK_STATE_HAT; - - /*! - * @brief Axis value in the closed interval [-1.0, 1.0] - * - * The axis state uses the XInput coordinate system: - * - Negative values signify down or to the left - * - Positive values signify up or to the right - */ - typedef float JOYSTICK_STATE_AXIS; - - /*! - * @brief Motor value in the closed interval [0.0, 1.0] - */ - typedef float JOYSTICK_STATE_MOTOR; - - /*! - * @brief Event information - */ - typedef struct PERIPHERAL_EVENT - { - /*! @brief Index of the peripheral handling/receiving the event */ - unsigned int peripheral_index; - - /*! @brief Type of the event used to determine which enum field to access below */ - PERIPHERAL_EVENT_TYPE type; - - /*! @brief The index of the event source */ - unsigned int driver_index; - - JOYSTICK_STATE_BUTTON driver_button_state; - JOYSTICK_STATE_HAT driver_hat_state; - JOYSTICK_STATE_AXIS driver_axis_state; - JOYSTICK_STATE_MOTOR motor_state; - } ATTRIBUTE_PACKED PERIPHERAL_EVENT; - ///} - - /// @name Joystick types - ///{ - - /*! - * @brief Info specific to joystick peripherals - */ - typedef struct JOYSTICK_INFO - { - PERIPHERAL_INFO peripheral; /*!< @brief peripheral info for this joystick */ - char* provider; /*!< @brief name of the driver or interface providing the joystick */ - int requested_port; /*!< @brief requested port number (such as for 360 controllers), or NO_PORT_REQUESTED */ - unsigned int button_count; /*!< @brief number of buttons reported by the driver */ - unsigned int hat_count; /*!< @brief number of hats reported by the driver */ - unsigned int axis_count; /*!< @brief number of axes reported by the driver */ - unsigned int motor_count; /*!< @brief number of motors reported by the driver */ - bool supports_poweroff; /*!< @brief whether the joystick supports being powered off */ - } ATTRIBUTE_PACKED JOYSTICK_INFO; - - /*! - * @brief Driver input primitives - * - * Mapping lower-level driver values to higher-level controller features is - * non-injective; two triggers can share a single axis. - * - * To handle this, driver values are subdivided into "primitives" that map - * injectively to higher-level features. - */ - typedef enum JOYSTICK_DRIVER_PRIMITIVE_TYPE - { - JOYSTICK_DRIVER_PRIMITIVE_TYPE_UNKNOWN, - JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON, - JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION, - JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS, - JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR, - JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY, - JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOUSE_BUTTON, - JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION, - } JOYSTICK_DRIVER_PRIMITIVE_TYPE; - - /*! - * @brief Button primitive - */ - typedef struct JOYSTICK_DRIVER_BUTTON - { - int index; - } ATTRIBUTE_PACKED JOYSTICK_DRIVER_BUTTON; - - /*! - * @brief Hat direction - */ - typedef enum JOYSTICK_DRIVER_HAT_DIRECTION - { - JOYSTICK_DRIVER_HAT_UNKNOWN, - JOYSTICK_DRIVER_HAT_LEFT, - JOYSTICK_DRIVER_HAT_RIGHT, - JOYSTICK_DRIVER_HAT_UP, - JOYSTICK_DRIVER_HAT_DOWN, - } JOYSTICK_DRIVER_HAT_DIRECTION; - - /*! - * @brief Hat direction primitive - */ - typedef struct JOYSTICK_DRIVER_HAT - { - int index; - JOYSTICK_DRIVER_HAT_DIRECTION direction; - } ATTRIBUTE_PACKED JOYSTICK_DRIVER_HAT; - - /*! - * @brief Semiaxis direction - */ - typedef enum JOYSTICK_DRIVER_SEMIAXIS_DIRECTION - { - JOYSTICK_DRIVER_SEMIAXIS_NEGATIVE = -1, /*!< @brief negative half of the axis */ - JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN = 0, /*!< @brief unknown direction */ - JOYSTICK_DRIVER_SEMIAXIS_POSITIVE = 1, /*!< @brief positive half of the axis */ - } JOYSTICK_DRIVER_SEMIAXIS_DIRECTION; - - /*! - * @brief Semiaxis primitive - */ - typedef struct JOYSTICK_DRIVER_SEMIAXIS - { - int index; - int center; - JOYSTICK_DRIVER_SEMIAXIS_DIRECTION direction; - unsigned int range; - } ATTRIBUTE_PACKED JOYSTICK_DRIVER_SEMIAXIS; - - /*! - * @brief Motor primitive - */ - typedef struct JOYSTICK_DRIVER_MOTOR - { - int index; - } ATTRIBUTE_PACKED JOYSTICK_DRIVER_MOTOR; - - /*! - * @brief Keyboard key primitive - */ - typedef struct JOYSTICK_DRIVER_KEY - { - char keycode[16]; - } ATTRIBUTE_PACKED JOYSTICK_DRIVER_KEY; - - /*! - * @brief Mouse buttons - */ - typedef enum JOYSTICK_DRIVER_MOUSE_INDEX - { - JOYSTICK_DRIVER_MOUSE_INDEX_UNKNOWN, - JOYSTICK_DRIVER_MOUSE_INDEX_LEFT, - JOYSTICK_DRIVER_MOUSE_INDEX_RIGHT, - JOYSTICK_DRIVER_MOUSE_INDEX_MIDDLE, - JOYSTICK_DRIVER_MOUSE_INDEX_BUTTON4, - JOYSTICK_DRIVER_MOUSE_INDEX_BUTTON5, - JOYSTICK_DRIVER_MOUSE_INDEX_WHEEL_UP, - JOYSTICK_DRIVER_MOUSE_INDEX_WHEEL_DOWN, - JOYSTICK_DRIVER_MOUSE_INDEX_HORIZ_WHEEL_LEFT, - JOYSTICK_DRIVER_MOUSE_INDEX_HORIZ_WHEEL_RIGHT, - } JOYSTICK_DRIVER_MOUSE_INDEX; - - /*! - * @brief Mouse button primitive - */ - typedef struct JOYSTICK_DRIVER_MOUSE_BUTTON - { - JOYSTICK_DRIVER_MOUSE_INDEX button; - } ATTRIBUTE_PACKED JOYSTICK_DRIVER_MOUSE_BUTTON; - - /*! - * @brief Relative pointer direction - */ - typedef enum JOYSTICK_DRIVER_RELPOINTER_DIRECTION - { - JOYSTICK_DRIVER_RELPOINTER_UNKNOWN, - JOYSTICK_DRIVER_RELPOINTER_LEFT, - JOYSTICK_DRIVER_RELPOINTER_RIGHT, - JOYSTICK_DRIVER_RELPOINTER_UP, - JOYSTICK_DRIVER_RELPOINTER_DOWN, - } JOYSTICK_DRIVER_RELPOINTER_DIRECTION; - - /*! - * @brief Relative pointer direction primitive - */ - typedef struct JOYSTICK_DRIVER_RELPOINTER - { - JOYSTICK_DRIVER_RELPOINTER_DIRECTION direction; - } ATTRIBUTE_PACKED JOYSTICK_DRIVER_RELPOINTER; - - /*! - * @brief Driver primitive struct - */ - typedef struct JOYSTICK_DRIVER_PRIMITIVE - { - JOYSTICK_DRIVER_PRIMITIVE_TYPE type; - union - { - struct JOYSTICK_DRIVER_BUTTON button; - struct JOYSTICK_DRIVER_HAT hat; - struct JOYSTICK_DRIVER_SEMIAXIS semiaxis; - struct JOYSTICK_DRIVER_MOTOR motor; - struct JOYSTICK_DRIVER_KEY key; - struct JOYSTICK_DRIVER_MOUSE_BUTTON mouse; - struct JOYSTICK_DRIVER_RELPOINTER relpointer; - }; - } ATTRIBUTE_PACKED JOYSTICK_DRIVER_PRIMITIVE; - - /*! - * @brief Controller feature - * - * Controller features are an abstraction over driver values. Each feature - * maps to one or more driver primitives. - */ - typedef enum JOYSTICK_FEATURE_TYPE - { - JOYSTICK_FEATURE_TYPE_UNKNOWN, - JOYSTICK_FEATURE_TYPE_SCALAR, - JOYSTICK_FEATURE_TYPE_ANALOG_STICK, - JOYSTICK_FEATURE_TYPE_ACCELEROMETER, - JOYSTICK_FEATURE_TYPE_MOTOR, - JOYSTICK_FEATURE_TYPE_RELPOINTER, - JOYSTICK_FEATURE_TYPE_ABSPOINTER, - JOYSTICK_FEATURE_TYPE_WHEEL, - JOYSTICK_FEATURE_TYPE_THROTTLE, - JOYSTICK_FEATURE_TYPE_KEY, - } JOYSTICK_FEATURE_TYPE; - - /*! - * @brief Indices used to access a feature's driver primitives - */ - typedef enum JOYSTICK_FEATURE_PRIMITIVE - { - // Scalar feature (a button, hat direction or semiaxis) - JOYSTICK_SCALAR_PRIMITIVE = 0, - - // Analog stick - JOYSTICK_ANALOG_STICK_UP = 0, - JOYSTICK_ANALOG_STICK_DOWN = 1, - JOYSTICK_ANALOG_STICK_RIGHT = 2, - JOYSTICK_ANALOG_STICK_LEFT = 3, - - // Accelerometer - JOYSTICK_ACCELEROMETER_POSITIVE_X = 0, - JOYSTICK_ACCELEROMETER_POSITIVE_Y = 1, - JOYSTICK_ACCELEROMETER_POSITIVE_Z = 2, - - // Motor - JOYSTICK_MOTOR_PRIMITIVE = 0, - - // Wheel - JOYSTICK_WHEEL_LEFT = 0, - JOYSTICK_WHEEL_RIGHT = 1, - - // Throttle - JOYSTICK_THROTTLE_UP = 0, - JOYSTICK_THROTTLE_DOWN = 1, - - // Key - JOYSTICK_KEY_PRIMITIVE = 0, - - // Mouse button - JOYSTICK_MOUSE_BUTTON = 0, - - // Relative pointer direction - JOYSTICK_RELPOINTER_UP = 0, - JOYSTICK_RELPOINTER_DOWN = 1, - JOYSTICK_RELPOINTER_RIGHT = 2, - JOYSTICK_RELPOINTER_LEFT = 3, - - // Maximum number of primitives - JOYSTICK_PRIMITIVE_MAX = 4, - } JOYSTICK_FEATURE_PRIMITIVE; - - /*! - * @brief Mapping between higher-level controller feature and its driver primitives - */ - typedef struct JOYSTICK_FEATURE - { - char* name; - JOYSTICK_FEATURE_TYPE type; - struct JOYSTICK_DRIVER_PRIMITIVE primitives[JOYSTICK_PRIMITIVE_MAX]; - } ATTRIBUTE_PACKED JOYSTICK_FEATURE; - ///} - - typedef struct AddonProps_Peripheral - { - const char* user_path; /*!< @brief path to the user profile */ - const char* addon_path; /*!< @brief path to this add-on */ - } ATTRIBUTE_PACKED AddonProps_Peripheral; - - struct AddonInstance_Peripheral; - - typedef struct AddonToKodiFuncTable_Peripheral - { - KODI_HANDLE kodiInstance; - void (*trigger_scan)(void* kodiInstance); - void (*refresh_button_maps)(void* kodiInstance, const char* device_name, const char* controller_id); - unsigned int (*feature_count)(void* kodiInstance, const char* controller_id, JOYSTICK_FEATURE_TYPE type); - JOYSTICK_FEATURE_TYPE (*feature_type)(void* kodiInstance, const char* controller_id, const char* feature_name); - } AddonToKodiFuncTable_Peripheral; - - //! @todo Mouse, light gun, multitouch - - typedef struct KodiToAddonFuncTable_Peripheral - { - kodi::addon::CInstancePeripheral* addonInstance; - - void (__cdecl* get_capabilities)(const AddonInstance_Peripheral* addonInstance, PERIPHERAL_CAPABILITIES* capabilities); - PERIPHERAL_ERROR (__cdecl* perform_device_scan)(const AddonInstance_Peripheral* addonInstance, unsigned int* peripheral_count, PERIPHERAL_INFO** scan_results); - void (__cdecl* free_scan_results)(const AddonInstance_Peripheral* addonInstance, unsigned int peripheral_count, PERIPHERAL_INFO* scan_results); - PERIPHERAL_ERROR (__cdecl* get_events)(const AddonInstance_Peripheral* addonInstance, unsigned int* event_count, PERIPHERAL_EVENT** events); - void (__cdecl* free_events)(const AddonInstance_Peripheral* addonInstance, unsigned int event_count, PERIPHERAL_EVENT* events); - bool (__cdecl* send_event)(const AddonInstance_Peripheral* addonInstance, const PERIPHERAL_EVENT* event); - - /// @name Joystick operations - ///{ - PERIPHERAL_ERROR (__cdecl* get_joystick_info)(const AddonInstance_Peripheral* addonInstance, unsigned int index, JOYSTICK_INFO* info); - void (__cdecl* free_joystick_info)(const AddonInstance_Peripheral* addonInstance, JOYSTICK_INFO* info); - PERIPHERAL_ERROR (__cdecl* get_features)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick, const char* controller_id, unsigned int* feature_count, JOYSTICK_FEATURE** features); - void (__cdecl* free_features)(const AddonInstance_Peripheral* addonInstance, unsigned int feature_count, JOYSTICK_FEATURE* features); - PERIPHERAL_ERROR (__cdecl* map_features)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick, const char* controller_id, unsigned int feature_count, const JOYSTICK_FEATURE* features); - PERIPHERAL_ERROR (__cdecl* get_ignored_primitives)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick, unsigned int* feature_count, JOYSTICK_DRIVER_PRIMITIVE** primitives); - void (__cdecl* free_primitives)(const AddonInstance_Peripheral* addonInstance, unsigned int, JOYSTICK_DRIVER_PRIMITIVE* primitives); - PERIPHERAL_ERROR (__cdecl* set_ignored_primitives)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick, unsigned int primitive_count, const JOYSTICK_DRIVER_PRIMITIVE* primitives); - void (__cdecl* save_button_map)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick); - void (__cdecl* revert_button_map)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick); - void (__cdecl* reset_button_map)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick, const char* controller_id); - void (__cdecl* power_off_joystick)(const AddonInstance_Peripheral* addonInstance, unsigned int index); - ///} - } KodiToAddonFuncTable_Peripheral; - - typedef struct AddonInstance_Peripheral - { - AddonProps_Peripheral props; - AddonToKodiFuncTable_Peripheral toKodi; - KodiToAddonFuncTable_Peripheral toAddon; - } AddonInstance_Peripheral; - -} /* extern "C" */ - -namespace kodi -{ -namespace addon -{ - - class ATTRIBUTE_HIDDEN CInstancePeripheral : public IAddonInstance - { - public: - CInstancePeripheral() - : IAddonInstance(ADDON_INSTANCE_PERIPHERAL, GetKodiTypeVersion(ADDON_INSTANCE_PERIPHERAL)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstancePeripheral: Creation of more as one in single instance way is not allowed!"); - - SetAddonStruct(CAddonBase::m_interface->firstKodiInstance); - CAddonBase::m_interface->globalSingleInstance = this; - } - - explicit CInstancePeripheral(KODI_HANDLE instance, const std::string& kodiVersion = "") - : IAddonInstance(ADDON_INSTANCE_PERIPHERAL, - !kodiVersion.empty() ? kodiVersion - : GetKodiTypeVersion(ADDON_INSTANCE_PERIPHERAL)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstancePeripheral: Creation of multiple together with single instance way is not allowed!"); - - SetAddonStruct(instance); - } - - ~CInstancePeripheral() override = default; - - /// @name Peripheral operations - ///{ - /*! - * @brief Get the list of features that this add-on provides - * @param capabilities The add-on's capabilities. - * @remarks Valid implementation required. - * - * Called by the frontend to query the add-on's capabilities and supported - * peripherals. All capabilities that the add-on supports should be set to true. - * - */ - virtual void GetCapabilities(PERIPHERAL_CAPABILITIES &capabilities) { } - - /*! - * @brief Perform a scan for joysticks - * @param peripheral_count Assigned to the number of peripherals allocated - * @param scan_results Assigned to allocated memory - * @return PERIPHERAL_NO_ERROR if successful; peripherals must be freed using - * FreeScanResults() in this case - * - * The frontend calls this when a hardware change is detected. If an add-on - * detects a hardware change, it can trigger this function using the - * TriggerScan() callback. - */ - virtual PERIPHERAL_ERROR PerformDeviceScan(unsigned int* peripheral_count, PERIPHERAL_INFO** scan_results) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; } - - /*! - * @brief Free the memory allocated in PerformDeviceScan() - * - * Must be called if PerformDeviceScan() returns PERIPHERAL_NO_ERROR. - * - * @param peripheral_count The number of events allocated for the events array - * @param scan_results The array of allocated peripherals - */ - virtual void FreeScanResults(unsigned int peripheral_count, PERIPHERAL_INFO* scan_results) { } - - /*! - * @brief Get all events that have occurred since the last call to GetEvents() - * @return PERIPHERAL_NO_ERROR if successful; events must be freed using - * FreeEvents() in this case - */ - virtual PERIPHERAL_ERROR GetEvents(unsigned int* event_count, PERIPHERAL_EVENT** events) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; } - - /*! - * @brief Free the memory allocated in GetEvents() - * - * Must be called if GetEvents() returns PERIPHERAL_NO_ERROR. - * - * @param event_count The number of events allocated for the events array - * @param events The array of allocated events - */ - virtual void FreeEvents(unsigned int event_count, PERIPHERAL_EVENT* events) { } - - /*! - * @brief Send an input event to the peripheral - * @param event The input event - * @return true if the event was handled, false otherwise - */ - virtual bool SendEvent(const PERIPHERAL_EVENT* event) { return false; } - ///} - - /// @name Joystick operations - /*! - * @note #define PERIPHERAL_ADDON_JOYSTICKS before including kodi_peripheral_dll.h - * in the add-on if the add-on provides joysticks and add provides_joysticks="true" - * to the kodi.peripheral extension point node in addon.xml. - */ - ///{ - /*! - * @brief Get extended info about an attached joystick - * @param index The joystick's driver index - * @param info The container for the allocated joystick info - * @return PERIPHERAL_NO_ERROR if successful; array must be freed using - * FreeJoystickInfo() in this case - */ - virtual PERIPHERAL_ERROR GetJoystickInfo(unsigned int index, JOYSTICK_INFO* info) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; } - - /*! - * @brief Free the memory allocated in GetJoystickInfo() - */ - virtual void FreeJoystickInfo(JOYSTICK_INFO* info) { } - - /*! - * @brief Get the features that allow translating the joystick into the controller profile - * @param joystick The device's joystick properties; unknown values may be left at their default - * @param controller_id The controller profile being requested, e.g. game.controller.default - * @param feature_count The number of features allocated for the features array - * @param features The array of allocated features - * @return PERIPHERAL_NO_ERROR if successful; array must be freed using - * FreeButtonMap() in this case - */ - virtual PERIPHERAL_ERROR GetFeatures(const JOYSTICK_INFO* joystick, const char* controller_id, - unsigned int* feature_count, JOYSTICK_FEATURE** features) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; } - - /*! - * @brief Free the memory allocated in GetFeatures() - * - * Must be called if GetFeatures() returns PERIPHERAL_NO_ERROR. - * - * @param feature_count The number of features allocated for the features array - * @param features The array of allocated features - */ - virtual void FreeFeatures(unsigned int feature_count, JOYSTICK_FEATURE* features) { } - - /*! - * @brief Add or update joystick features - * @param joystick The device's joystick properties; unknown values may be left at their default - * @param controller_id The game controller profile being updated - * @param feature_count The number of features in the features array - * @param features The array of features - * @return PERIPHERAL_NO_ERROR if successful - */ - virtual PERIPHERAL_ERROR MapFeatures(const JOYSTICK_INFO* joystick, const char* controller_id, - unsigned int feature_count, const JOYSTICK_FEATURE* features) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; } - - /*! - * @brief Get the driver primitives that should be ignored while mapping the device - * @param joystick The device's joystick properties; unknown values may be left at their default - * @param primitive_count The number of features allocated for the primitives array - * @param primitives The array of allocated driver primitives to be ignored - * @return PERIPHERAL_NO_ERROR if successful; array must be freed using - * FreePrimitives() in this case - */ - virtual PERIPHERAL_ERROR GetIgnoredPrimitives(const JOYSTICK_INFO* joystick, - unsigned int* primitive_count, - JOYSTICK_DRIVER_PRIMITIVE** primitives) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; } - - /*! - * @brief Free the memory allocated in GetIgnoredPrimitives() - * - * Must be called if GetIgnoredPrimitives() returns PERIPHERAL_NO_ERROR. - * - * @param primitive_count The number of driver primitives allocated for the primitives array - * @param primitives The array of allocated driver primitives - */ - virtual void FreePrimitives(unsigned int primitive_count, JOYSTICK_DRIVER_PRIMITIVE* primitives) { } - - /*! - * @brief Set the list of driver primitives that are ignored for the device - * @param joystick The device's joystick properties; unknown values may be left at their default - * @param primitive_count The number of driver features in the primitives array - * @param primitives The array of driver primitives to ignore - * @return PERIPHERAL_NO_ERROR if successful - */ - virtual PERIPHERAL_ERROR SetIgnoredPrimitives(const JOYSTICK_INFO* joystick, - unsigned int primitive_count, - const JOYSTICK_DRIVER_PRIMITIVE* primitives) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; } - - /*! - * @brief Save the button map for the given joystick - * @param joystick The device's joystick properties - */ - virtual void SaveButtonMap(const JOYSTICK_INFO* joystick) { } - - /*! - * @brief Revert the button map to the last time it was loaded or committed to disk - * @param joystick The device's joystick properties - */ - virtual void RevertButtonMap(const JOYSTICK_INFO* joystick) { } - - /*! - * @brief Reset the button map for the given joystick and controller profile ID - * @param joystick The device's joystick properties - * @param controller_id The game controller profile being reset - */ - virtual void ResetButtonMap(const JOYSTICK_INFO* joystick, const char* controller_id) { } - - /*! - * @brief Powers off the given joystick if supported - * @param index The joystick's driver index - */ - virtual void PowerOffJoystick(unsigned int index) { } - - const std::string AddonPath() const - { - return m_instanceData->props.addon_path; - } - - const std::string UserPath() const - { - return m_instanceData->props.user_path; - } - - /*! - * @brief Trigger a scan for peripherals - * - * The add-on calls this if a change in hardware is detected. - */ - void TriggerScan(void) - { - return m_instanceData->toKodi.trigger_scan(m_instanceData->toKodi.kodiInstance); - } - - /*! - * @brief Notify the frontend that button maps have changed - * - * @param[optional] deviceName The name of the device to refresh, or empty/null for all devices - * @param[optional] controllerId The controller ID to refresh, or empty/null for all controllers - */ - void RefreshButtonMaps(const std::string& deviceName = "", const std::string& controllerId = "") - { - return m_instanceData->toKodi.refresh_button_maps(m_instanceData->toKodi.kodiInstance, deviceName.c_str(), controllerId.c_str()); - } - - /*! - * @brief Return the number of features belonging to the specified controller - * - * @param controllerId The controller ID to enumerate - * @param type[optional] Type to filter by, or JOYSTICK_FEATURE_TYPE_UNKNOWN for all features - * - * @return The number of features matching the request parameters - */ - unsigned int FeatureCount(const std::string& controllerId, JOYSTICK_FEATURE_TYPE type = JOYSTICK_FEATURE_TYPE_UNKNOWN) - { - return m_instanceData->toKodi.feature_count(m_instanceData->toKodi.kodiInstance, controllerId.c_str(), type); - } - - /*! - * @brief Return the type of the feature - * - * @param controllerId The controller ID to check - * @param featureName The feature to check - * - * @return The type of the specified feature, or JOYSTICK_FEATURE_TYPE_UNKNOWN - * if unknown - */ - JOYSTICK_FEATURE_TYPE FeatureType(const std::string& controllerId, const std::string &featureName) - { - return m_instanceData->toKodi.feature_type(m_instanceData->toKodi.kodiInstance, controllerId.c_str(), featureName.c_str()); - } - - private: - void SetAddonStruct(KODI_HANDLE instance) - { - if (instance == nullptr) - throw std::logic_error("kodi::addon::CInstancePeripheral: Creation with empty addon structure not allowed, table must be given from Kodi!"); - - m_instanceData = static_cast(instance); - m_instanceData->toAddon.addonInstance = this; - - m_instanceData->toAddon.get_capabilities = ADDON_GetCapabilities; - m_instanceData->toAddon.perform_device_scan = ADDON_PerformDeviceScan; - m_instanceData->toAddon.free_scan_results = ADDON_FreeScanResults; - m_instanceData->toAddon.get_events = ADDON_GetEvents; - m_instanceData->toAddon.free_events = ADDON_FreeEvents; - m_instanceData->toAddon.send_event = ADDON_SendEvent; - - m_instanceData->toAddon.get_joystick_info = ADDON_GetJoystickInfo; - m_instanceData->toAddon.free_joystick_info = ADDON_FreeJoystickInfo; - m_instanceData->toAddon.get_features = ADDON_GetFeatures; - m_instanceData->toAddon.free_features = ADDON_FreeFeatures; - m_instanceData->toAddon.map_features = ADDON_MapFeatures; - m_instanceData->toAddon.get_ignored_primitives = ADDON_GetIgnoredPrimitives; - m_instanceData->toAddon.free_primitives = ADDON_FreePrimitives; - m_instanceData->toAddon.set_ignored_primitives = ADDON_SetIgnoredPrimitives; - m_instanceData->toAddon.save_button_map = ADDON_SaveButtonMap; - m_instanceData->toAddon.revert_button_map = ADDON_RevertButtonMap; - m_instanceData->toAddon.reset_button_map = ADDON_ResetButtonMap; - m_instanceData->toAddon.power_off_joystick = ADDON_PowerOffJoystick; - } - - inline static void ADDON_GetCapabilities(const AddonInstance_Peripheral* addonInstance, PERIPHERAL_CAPABILITIES *capabilities) - { - addonInstance->toAddon.addonInstance->GetCapabilities(*capabilities); - } - - inline static PERIPHERAL_ERROR ADDON_PerformDeviceScan(const AddonInstance_Peripheral* addonInstance, unsigned int* peripheral_count, PERIPHERAL_INFO** scan_results) - { - return addonInstance->toAddon.addonInstance->PerformDeviceScan(peripheral_count, scan_results); - } - - inline static void ADDON_FreeScanResults(const AddonInstance_Peripheral* addonInstance, unsigned int peripheral_count, PERIPHERAL_INFO* scan_results) - { - addonInstance->toAddon.addonInstance->FreeScanResults(peripheral_count, scan_results); - } - - inline static PERIPHERAL_ERROR ADDON_GetEvents(const AddonInstance_Peripheral* addonInstance, unsigned int* event_count, PERIPHERAL_EVENT** events) - { - return addonInstance->toAddon.addonInstance->GetEvents(event_count, events); - } - - inline static void ADDON_FreeEvents(const AddonInstance_Peripheral* addonInstance, unsigned int event_count, PERIPHERAL_EVENT* events) - { - addonInstance->toAddon.addonInstance->FreeEvents(event_count, events); - } - - inline static bool ADDON_SendEvent(const AddonInstance_Peripheral* addonInstance, const PERIPHERAL_EVENT* event) - { - return addonInstance->toAddon.addonInstance->SendEvent(event); - } - - - inline static PERIPHERAL_ERROR ADDON_GetJoystickInfo(const AddonInstance_Peripheral* addonInstance, unsigned int index, JOYSTICK_INFO* info) - { - return addonInstance->toAddon.addonInstance->GetJoystickInfo(index, info); - } - - inline static void ADDON_FreeJoystickInfo(const AddonInstance_Peripheral* addonInstance, JOYSTICK_INFO* info) - { - addonInstance->toAddon.addonInstance->FreeJoystickInfo(info); - } - - inline static PERIPHERAL_ERROR ADDON_GetFeatures(const AddonInstance_Peripheral* addonInstance, - const JOYSTICK_INFO* joystick, const char* controller_id, - unsigned int* feature_count, JOYSTICK_FEATURE** features) - { - return addonInstance->toAddon.addonInstance->GetFeatures(joystick, controller_id, feature_count, features); - } - - inline static void ADDON_FreeFeatures(const AddonInstance_Peripheral* addonInstance, unsigned int feature_count, JOYSTICK_FEATURE* features) - { - addonInstance->toAddon.addonInstance->FreeFeatures(feature_count, features); - } - - inline static PERIPHERAL_ERROR ADDON_MapFeatures(const AddonInstance_Peripheral* addonInstance, - const JOYSTICK_INFO* joystick, const char* controller_id, - unsigned int feature_count, const JOYSTICK_FEATURE* features) - { - return addonInstance->toAddon.addonInstance->MapFeatures(joystick, controller_id, feature_count, features); - } - - inline static PERIPHERAL_ERROR ADDON_GetIgnoredPrimitives(const AddonInstance_Peripheral* addonInstance, - const JOYSTICK_INFO* joystick, unsigned int* primitive_count, - JOYSTICK_DRIVER_PRIMITIVE** primitives) - { - return addonInstance->toAddon.addonInstance->GetIgnoredPrimitives(joystick, primitive_count, primitives); - } - - inline static void ADDON_FreePrimitives(const AddonInstance_Peripheral* addonInstance, - unsigned int primitive_count, JOYSTICK_DRIVER_PRIMITIVE* primitives) - { - addonInstance->toAddon.addonInstance->FreePrimitives(primitive_count, primitives); - } - - inline static PERIPHERAL_ERROR ADDON_SetIgnoredPrimitives(const AddonInstance_Peripheral* addonInstance, - const JOYSTICK_INFO* joystick, unsigned int primitive_count, - const JOYSTICK_DRIVER_PRIMITIVE* primitives) - { - return addonInstance->toAddon.addonInstance->SetIgnoredPrimitives(joystick, primitive_count, primitives); - } - - inline static void ADDON_SaveButtonMap(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick) - { - addonInstance->toAddon.addonInstance->SaveButtonMap(joystick); - } - - inline static void ADDON_RevertButtonMap(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick) - { - addonInstance->toAddon.addonInstance->RevertButtonMap(joystick); - } - - inline static void ADDON_ResetButtonMap(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick, const char* controller_id) - { - addonInstance->toAddon.addonInstance->ResetButtonMap(joystick, controller_id); - } - - inline static void ADDON_PowerOffJoystick(const AddonInstance_Peripheral* addonInstance, unsigned int index) - { - addonInstance->toAddon.addonInstance->PowerOffJoystick(index); - } - - AddonInstance_Peripheral* m_instanceData; - }; - -} /* namespace addon */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h deleted file mode 100644 index 62e5a93..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h +++ /dev/null @@ -1,735 +0,0 @@ -/* - * Copyright (C) 2014-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "Peripheral.h" - -#include // Requires c++11 -#include -#include -#include -#include - -#define PERIPHERAL_SAFE_DELETE(x) do { delete (x); (x) = NULL; } while (0) -#define PERIPHERAL_SAFE_DELETE_ARRAY(x) do { delete[] (x); (x) = NULL; } while (0) - -namespace kodi -{ -namespace addon -{ - /*! - * Utility class to manipulate arrays of peripheral types. - */ - template - class PeripheralVector - { - public: - static void ToStructs(const std::vector& vecObjects, THE_STRUCT** pStructs) - { - if (!pStructs) - return; - - if (vecObjects.empty()) - { - *pStructs = NULL; - } - else - { - (*pStructs) = new THE_STRUCT[vecObjects.size()]; - for (unsigned int i = 0; i < vecObjects.size(); i++) - vecObjects.at(i).ToStruct((*pStructs)[i]); - } - } - - static void ToStructs(const std::vector& vecObjects, THE_STRUCT** pStructs) - { - if (!pStructs) - return; - - if (vecObjects.empty()) - { - *pStructs = NULL; - } - else - { - *pStructs = new THE_STRUCT[vecObjects.size()]; - for (unsigned int i = 0; i < vecObjects.size(); i++) - vecObjects.at(i)->ToStruct((*pStructs)[i]); - } - } - - static void FreeStructs(unsigned int structCount, THE_STRUCT* structs) - { - if (structs) - { - for (unsigned int i = 0; i < structCount; i++) - THE_CLASS::FreeStruct(structs[i]); - } - PERIPHERAL_SAFE_DELETE_ARRAY(structs); - } - }; - - /*! - * ADDON::Peripheral - * - * Wrapper class providing peripheral information. Classes can extend - * Peripheral to inherit peripheral properties. - */ - class Peripheral - { - public: - Peripheral(PERIPHERAL_TYPE type = PERIPHERAL_TYPE_UNKNOWN, const std::string& strName = "") : - m_type(type), - m_strName(strName) - { - } - - explicit Peripheral(const PERIPHERAL_INFO& info) : - m_type(info.type), - m_strName(info.name ? info.name : ""), - m_vendorId(info.vendor_id), - m_productId(info.product_id), - m_index(info.index) - { - } - - virtual ~Peripheral(void) = default; - - PERIPHERAL_TYPE Type(void) const { return m_type; } - const std::string& Name(void) const { return m_strName; } - uint16_t VendorID(void) const { return m_vendorId; } - uint16_t ProductID(void) const { return m_productId; } - unsigned int Index(void) const { return m_index; } - - // Derived property: VID and PID are 0x0000 if unknown - bool IsVidPidKnown(void) const { return m_vendorId != 0 || m_productId != 0; } - - void SetType(PERIPHERAL_TYPE type) { m_type = type; } - void SetName(const std::string& strName) { m_strName = strName; } - void SetVendorID(uint16_t vendorId) { m_vendorId = vendorId; } - void SetProductID(uint16_t productId) { m_productId = productId; } - void SetIndex(unsigned int index) { m_index = index; } - - void ToStruct(PERIPHERAL_INFO& info) const - { - info.type = m_type; - info.name = new char[m_strName.size() + 1]; - info.vendor_id = m_vendorId; - info.product_id = m_productId; - info.index = m_index; - - std::strcpy(info.name, m_strName.c_str()); - } - - static void FreeStruct(PERIPHERAL_INFO& info) - { - PERIPHERAL_SAFE_DELETE_ARRAY(info.name); - } - - private: - PERIPHERAL_TYPE m_type; - std::string m_strName; - uint16_t m_vendorId = 0; - uint16_t m_productId = 0; - unsigned int m_index = 0; - }; - - typedef PeripheralVector Peripherals; - - /*! - * ADDON::PeripheralEvent - * - * Wrapper class for peripheral events. - */ - class PeripheralEvent - { - public: - PeripheralEvent() = default; - - PeripheralEvent(unsigned int peripheralIndex, unsigned int buttonIndex, JOYSTICK_STATE_BUTTON state) : - m_type(PERIPHERAL_EVENT_TYPE_DRIVER_BUTTON), - m_peripheralIndex(peripheralIndex), - m_driverIndex(buttonIndex), - m_buttonState(state) - { - } - - PeripheralEvent(unsigned int peripheralIndex, unsigned int hatIndex, JOYSTICK_STATE_HAT state) : - m_type(PERIPHERAL_EVENT_TYPE_DRIVER_HAT), - m_peripheralIndex(peripheralIndex), - m_driverIndex(hatIndex), - m_hatState(state) - { - } - - PeripheralEvent(unsigned int peripheralIndex, unsigned int axisIndex, JOYSTICK_STATE_AXIS state) : - m_type(PERIPHERAL_EVENT_TYPE_DRIVER_AXIS), - m_peripheralIndex(peripheralIndex), - m_driverIndex(axisIndex), - m_axisState(state) - { - } - - explicit PeripheralEvent(const PERIPHERAL_EVENT& event) : - m_type(event.type), - m_peripheralIndex(event.peripheral_index), - m_driverIndex(event.driver_index), - m_buttonState(event.driver_button_state), - m_hatState(event.driver_hat_state), - m_axisState(event.driver_axis_state), - m_motorState(event.motor_state) - { - } - - PERIPHERAL_EVENT_TYPE Type(void) const { return m_type; } - unsigned int PeripheralIndex(void) const { return m_peripheralIndex; } - unsigned int DriverIndex(void) const { return m_driverIndex; } - JOYSTICK_STATE_BUTTON ButtonState(void) const { return m_buttonState; } - JOYSTICK_STATE_HAT HatState(void) const { return m_hatState; } - JOYSTICK_STATE_AXIS AxisState(void) const { return m_axisState; } - JOYSTICK_STATE_MOTOR MotorState(void) const { return m_motorState; } - - void SetType(PERIPHERAL_EVENT_TYPE type) { m_type = type; } - void SetPeripheralIndex(unsigned int index) { m_peripheralIndex = index; } - void SetDriverIndex(unsigned int index) { m_driverIndex = index; } - void SetButtonState(JOYSTICK_STATE_BUTTON state) { m_buttonState = state; } - void SetHatState(JOYSTICK_STATE_HAT state) { m_hatState = state; } - void SetAxisState(JOYSTICK_STATE_AXIS state) { m_axisState = state; } - void SetMotorState(JOYSTICK_STATE_MOTOR state) { m_motorState = state; } - - void ToStruct(PERIPHERAL_EVENT& event) const - { - event.type = m_type; - event.peripheral_index = m_peripheralIndex; - event.driver_index = m_driverIndex; - event.driver_button_state = m_buttonState; - event.driver_hat_state = m_hatState; - event.driver_axis_state = m_axisState; - event.motor_state = m_motorState; - } - - static void FreeStruct(PERIPHERAL_EVENT& event) - { - (void)event; - } - - private: - PERIPHERAL_EVENT_TYPE m_type = PERIPHERAL_EVENT_TYPE_NONE; - unsigned int m_peripheralIndex = 0; - unsigned int m_driverIndex = 0; - JOYSTICK_STATE_BUTTON m_buttonState = JOYSTICK_STATE_BUTTON_UNPRESSED; - JOYSTICK_STATE_HAT m_hatState = JOYSTICK_STATE_HAT_UNPRESSED; - JOYSTICK_STATE_AXIS m_axisState = 0.0f; - JOYSTICK_STATE_MOTOR m_motorState = 0.0f; - }; - - typedef PeripheralVector PeripheralEvents; - - /*! - * kodi::addon::Joystick - * - * Wrapper class providing additional joystick information not provided by - * ADDON::Peripheral. - */ - class Joystick : public Peripheral - { - public: - Joystick(const std::string& provider = "", const std::string& strName = "") : - Peripheral(PERIPHERAL_TYPE_JOYSTICK, strName), - m_provider(provider), - m_requestedPort(NO_PORT_REQUESTED) - { - } - - Joystick(const Joystick& other) - { - *this = other; - } - - explicit Joystick(const JOYSTICK_INFO& info) : - Peripheral(info.peripheral), - m_provider(info.provider ? info.provider : ""), - m_requestedPort(info.requested_port), - m_buttonCount(info.button_count), - m_hatCount(info.hat_count), - m_axisCount(info.axis_count), - m_motorCount(info.motor_count), - m_supportsPowerOff(info.supports_poweroff) - { - } - - ~Joystick(void) override = default; - - Joystick& operator=(const Joystick& rhs) - { - if (this != &rhs) - { - Peripheral::operator=(rhs); - - m_provider = rhs.m_provider; - m_requestedPort = rhs.m_requestedPort; - m_buttonCount = rhs.m_buttonCount; - m_hatCount = rhs.m_hatCount; - m_axisCount = rhs.m_axisCount; - m_motorCount = rhs.m_motorCount; - m_supportsPowerOff = rhs.m_supportsPowerOff; - } - return *this; - } - - const std::string& Provider(void) const { return m_provider; } - int RequestedPort(void) const { return m_requestedPort; } - unsigned int ButtonCount(void) const { return m_buttonCount; } - unsigned int HatCount(void) const { return m_hatCount; } - unsigned int AxisCount(void) const { return m_axisCount; } - unsigned int MotorCount(void) const { return m_motorCount; } - bool SupportsPowerOff(void) const { return m_supportsPowerOff; } - - void SetProvider(const std::string& provider) { m_provider = provider; } - void SetRequestedPort(int requestedPort) { m_requestedPort = requestedPort; } - void SetButtonCount(unsigned int buttonCount) { m_buttonCount = buttonCount; } - void SetHatCount(unsigned int hatCount) { m_hatCount = hatCount; } - void SetAxisCount(unsigned int axisCount) { m_axisCount = axisCount; } - void SetMotorCount(unsigned int motorCount) { m_motorCount = motorCount; } - void SetSupportsPowerOff(bool supportsPowerOff) { m_supportsPowerOff = supportsPowerOff; } - - void ToStruct(JOYSTICK_INFO& info) const - { - Peripheral::ToStruct(info.peripheral); - - info.provider = new char[m_provider.size() + 1]; - info.requested_port = m_requestedPort; - info.button_count = m_buttonCount; - info.hat_count = m_hatCount; - info.axis_count = m_axisCount; - info.motor_count = m_motorCount; - info.supports_poweroff = m_supportsPowerOff; - - std::strcpy(info.provider, m_provider.c_str()); - } - - static void FreeStruct(JOYSTICK_INFO& info) - { - Peripheral::FreeStruct(info.peripheral); - - PERIPHERAL_SAFE_DELETE_ARRAY(info.provider); - } - - private: - std::string m_provider; - int m_requestedPort; - unsigned int m_buttonCount = 0; - unsigned int m_hatCount = 0; - unsigned int m_axisCount = 0; - unsigned int m_motorCount = 0; - bool m_supportsPowerOff = false; - }; - - typedef PeripheralVector Joysticks; - - /*! - * ADDON::DriverPrimitive - * - * Base class for joystick driver primitives. A driver primitive can be: - * - * 1) a button - * 2) a hat direction - * 3) a semiaxis (either the positive or negative half of an axis) - * 4) a motor - * 5) a keyboard key - * 6) a mouse button - * 7) a relative pointer direction - * - * The type determines the fields in use: - * - * Button: - * - driver index - * - * Hat direction: - * - driver index - * - hat direction - * - * Semiaxis: - * - driver index - * - center - * - semiaxis direction - * - range - * - * Motor: - * - driver index - * - * Key: - * - key code - * - * Mouse button: - * - driver index - * - * Relative pointer direction: - * - relative pointer direction - */ - struct DriverPrimitive - { - protected: - /*! - * \brief Construct a driver primitive of the specified type - */ - DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE type, unsigned int driverIndex) : - m_type(type), - m_driverIndex(driverIndex) - { - } - - public: - /*! - * \brief Construct an invalid driver primitive - */ - DriverPrimitive(void) = default; - - /*! - * \brief Construct a driver primitive representing a joystick button - */ - static DriverPrimitive CreateButton(unsigned int buttonIndex) - { - return DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON, buttonIndex); - } - - /*! - * \brief Construct a driver primitive representing one of the four direction - * arrows on a dpad - */ - DriverPrimitive(unsigned int hatIndex, JOYSTICK_DRIVER_HAT_DIRECTION direction) : - m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION), - m_driverIndex(hatIndex), - m_hatDirection(direction) - { - } - - /*! - * \brief Construct a driver primitive representing the positive or negative - * half of an axis - */ - DriverPrimitive(unsigned int axisIndex, int center, JOYSTICK_DRIVER_SEMIAXIS_DIRECTION direction, unsigned int range) : - m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS), - m_driverIndex(axisIndex), - m_center(center), - m_semiAxisDirection(direction), - m_range(range) - { - } - - /*! - * \brief Construct a driver primitive representing a motor - */ - static DriverPrimitive CreateMotor(unsigned int motorIndex) - { - return DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR, motorIndex); - } - - /*! - * \brief Construct a driver primitive representing a key on a keyboard - */ - DriverPrimitive(std::string keycode) : - m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY), - m_keycode(std::move(keycode)) - { - } - - /*! - * \brief Construct a driver primitive representing a mouse button - */ - static DriverPrimitive CreateMouseButton(JOYSTICK_DRIVER_MOUSE_INDEX buttonIndex) - { - return DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOUSE_BUTTON, static_cast(buttonIndex)); - } - - /*! - * \brief Construct a driver primitive representing one of the four - * direction in which a relative pointer can move - */ - DriverPrimitive(JOYSTICK_DRIVER_RELPOINTER_DIRECTION direction) : - m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION), - m_relPointerDirection(direction) - { - } - - explicit DriverPrimitive(const JOYSTICK_DRIVER_PRIMITIVE& primitive) : - m_type(primitive.type) - { - switch (m_type) - { - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON: - { - m_driverIndex = primitive.button.index; - break; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION: - { - m_driverIndex = primitive.hat.index; - m_hatDirection = primitive.hat.direction; - break; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS: - { - m_driverIndex = primitive.semiaxis.index; - m_center = primitive.semiaxis.center; - m_semiAxisDirection = primitive.semiaxis.direction; - m_range = primitive.semiaxis.range; - break; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR: - { - m_driverIndex = primitive.motor.index; - break; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY: - { - m_keycode = primitive.key.keycode; - break; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOUSE_BUTTON: - { - m_driverIndex = primitive.mouse.button; - break; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION: - { - m_relPointerDirection = primitive.relpointer.direction; - break; - } - default: - break; - } - } - - JOYSTICK_DRIVER_PRIMITIVE_TYPE Type(void) const { return m_type; } - unsigned int DriverIndex(void) const { return m_driverIndex; } - JOYSTICK_DRIVER_HAT_DIRECTION HatDirection(void) const { return m_hatDirection; } - int Center(void) const { return m_center; } - JOYSTICK_DRIVER_SEMIAXIS_DIRECTION SemiAxisDirection(void) const { return m_semiAxisDirection; } - unsigned int Range(void) const { return m_range; } - const std::string& Keycode(void) const { return m_keycode; } - JOYSTICK_DRIVER_MOUSE_INDEX MouseIndex(void) const { return static_cast(m_driverIndex); } - JOYSTICK_DRIVER_RELPOINTER_DIRECTION RelPointerDirection(void) const { return m_relPointerDirection; } - - bool operator==(const DriverPrimitive& other) const - { - if (m_type == other.m_type) - { - switch (m_type) - { - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON: - { - return m_driverIndex == other.m_driverIndex; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION: - { - return m_driverIndex == other.m_driverIndex && - m_hatDirection == other.m_hatDirection; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS: - { - return m_driverIndex == other.m_driverIndex && - m_center == other.m_center && - m_semiAxisDirection == other.m_semiAxisDirection && - m_range == other.m_range; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY: - { - return m_keycode == other.m_keycode; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR: - { - return m_driverIndex == other.m_driverIndex; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOUSE_BUTTON: - { - return m_driverIndex == other.m_driverIndex; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION: - { - return m_relPointerDirection == other.m_relPointerDirection; - } - default: - break; - } - } - return false; - } - - void ToStruct(JOYSTICK_DRIVER_PRIMITIVE& driver_primitive) const - { - driver_primitive.type = m_type; - switch (m_type) - { - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON: - { - driver_primitive.button.index = m_driverIndex; - break; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION: - { - driver_primitive.hat.index = m_driverIndex; - driver_primitive.hat.direction = m_hatDirection; - break; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS: - { - driver_primitive.semiaxis.index = m_driverIndex; - driver_primitive.semiaxis.center = m_center; - driver_primitive.semiaxis.direction = m_semiAxisDirection; - driver_primitive.semiaxis.range = m_range; - break; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR: - { - driver_primitive.motor.index = m_driverIndex; - break; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY: - { - const size_t size = sizeof(driver_primitive.key.keycode); - std::strncpy(driver_primitive.key.keycode, m_keycode.c_str(), size - 1); - driver_primitive.key.keycode[size - 1] = '\0'; - break; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOUSE_BUTTON: - { - driver_primitive.mouse.button = static_cast(m_driverIndex); - break; - } - case JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION: - { - driver_primitive.relpointer.direction = m_relPointerDirection; - break; - } - default: - break; - } - } - - static void FreeStruct(JOYSTICK_DRIVER_PRIMITIVE& primitive) - { - (void)primitive; - } - - private: - JOYSTICK_DRIVER_PRIMITIVE_TYPE m_type = JOYSTICK_DRIVER_PRIMITIVE_TYPE_UNKNOWN; - unsigned int m_driverIndex = 0; - JOYSTICK_DRIVER_HAT_DIRECTION m_hatDirection = JOYSTICK_DRIVER_HAT_UNKNOWN; - int m_center = 0; - JOYSTICK_DRIVER_SEMIAXIS_DIRECTION m_semiAxisDirection = JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN; - unsigned int m_range = 1; - std::string m_keycode; - JOYSTICK_DRIVER_RELPOINTER_DIRECTION m_relPointerDirection = JOYSTICK_DRIVER_RELPOINTER_UNKNOWN; - }; - - typedef PeripheralVector DriverPrimitives; - - /*! - * kodi::addon::JoystickFeature - * - * Class for joystick features. A feature can be: - * - * 1) scalar[1] - * 2) analog stick - * 3) accelerometer - * 4) motor - * 5) relative pointer[2] - * 6) absolute pointer - * 7) wheel - * 8) throttle - * 9) keyboard key - * - * [1] All three driver primitives (buttons, hats and axes) have a state that - * can be represented using a single scalar value. For this reason, - * features that map to a single primitive are called "scalar features". - * - * [2] Relative pointers are similar to analog sticks, but they use - * relative distances instead of positions. - */ - class JoystickFeature - { - public: - JoystickFeature(const std::string& name = "", JOYSTICK_FEATURE_TYPE type = JOYSTICK_FEATURE_TYPE_UNKNOWN) : - m_name(name), - m_type(type), - m_primitives{} - { - } - - JoystickFeature(const JoystickFeature& other) - { - *this = other; - } - - explicit JoystickFeature(const JOYSTICK_FEATURE& feature) : - m_name(feature.name ? feature.name : ""), - m_type(feature.type) - { - for (unsigned int i = 0; i < JOYSTICK_PRIMITIVE_MAX; i++) - m_primitives[i] = DriverPrimitive(feature.primitives[i]); - } - - JoystickFeature& operator=(const JoystickFeature& rhs) - { - if (this != &rhs) - { - m_name = rhs.m_name; - m_type = rhs.m_type; - m_primitives = rhs.m_primitives; - } - return *this; - } - - bool operator==(const JoystickFeature& other) const - { - return m_name == other.m_name && - m_type == other.m_type && - m_primitives == other.m_primitives; - } - - const std::string& Name(void) const { return m_name; } - JOYSTICK_FEATURE_TYPE Type(void) const { return m_type; } - bool IsValid() const { return m_type != JOYSTICK_FEATURE_TYPE_UNKNOWN; } - - void SetName(const std::string& name) { m_name = name; } - void SetType(JOYSTICK_FEATURE_TYPE type) { m_type = type; } - void SetInvalid(void) { m_type = JOYSTICK_FEATURE_TYPE_UNKNOWN; } - - const DriverPrimitive& Primitive(JOYSTICK_FEATURE_PRIMITIVE which) const { return m_primitives[which]; } - void SetPrimitive(JOYSTICK_FEATURE_PRIMITIVE which, const DriverPrimitive& primitive) { m_primitives[which] = primitive; } - - std::array& Primitives() { return m_primitives; } - const std::array& Primitives() const { return m_primitives; } - - void ToStruct(JOYSTICK_FEATURE& feature) const - { - feature.name = new char[m_name.length() + 1]; - feature.type = m_type; - for (unsigned int i = 0; i < JOYSTICK_PRIMITIVE_MAX; i++) - m_primitives[i].ToStruct(feature.primitives[i]); - - std::strcpy(feature.name, m_name.c_str()); - } - - static void FreeStruct(JOYSTICK_FEATURE& feature) - { - PERIPHERAL_SAFE_DELETE_ARRAY(feature.name); - } - - private: - std::string m_name; - JOYSTICK_FEATURE_TYPE m_type; - std::array m_primitives; - }; - - typedef PeripheralVector JoystickFeatures; - -} /* namespace addon */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h deleted file mode 100644 index f8a7380..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h +++ /dev/null @@ -1,460 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../AddonBase.h" -#include "../gui/renderHelper.h" - -namespace kodi { namespace addon { class CInstanceScreensaver; }} - -extern "C" -{ - -struct AddonInstance_Screensaver; - -/*! - * @brief Screensaver properties - * - * Not to be used outside this header. - */ -typedef struct AddonProps_Screensaver -{ - void *device; - int x; - int y; - int width; - int height; - float pixelRatio; - const char *name; - const char *presets; - const char *profile; -} AddonProps_Screensaver; - -/*! - * @brief Screensaver callbacks - * - * Not to be used outside this header. - */ -typedef struct AddonToKodiFuncTable_Screensaver -{ - KODI_HANDLE kodiInstance; -} AddonToKodiFuncTable_Screensaver; - -/*! - * @brief Screensaver function hooks - * - * Not to be used outside this header. - */ -typedef struct KodiToAddonFuncTable_Screensaver -{ - kodi::addon::CInstanceScreensaver* addonInstance; - bool (__cdecl* Start) (AddonInstance_Screensaver* instance); - void (__cdecl* Stop) (AddonInstance_Screensaver* instance); - void (__cdecl* Render) (AddonInstance_Screensaver* instance); -} KodiToAddonFuncTable_Screensaver; - -/*! - * @brief Screensaver instance - * - * Not to be used outside this header. - */ -typedef struct AddonInstance_Screensaver -{ - AddonProps_Screensaver props; - AddonToKodiFuncTable_Screensaver toKodi; - KodiToAddonFuncTable_Screensaver toAddon; -} AddonInstance_Screensaver; - -} /* extern "C" */ - -namespace kodi -{ -namespace addon -{ - - //============================================================================ - /// - /// \addtogroup cpp_kodi_addon_screensaver - /// @brief \cpp_class{ kodi::addon::CInstanceScreensaver } - /// **Screensaver add-on instance** - /// - /// A screensaver is a Kodi addon that fills the screen with moving images or - /// patterns when the computer is not in use. Initially designed to prevent - /// phosphor burn-in on CRT and plasma computer monitors (hence the name), - /// screensavers are now used primarily for entertainment, security or to - /// display system status information. - /// - /// Include the header \ref ScreenSaver.h "#include " - /// to use this class. - /// - /// This interface allows the creating of screensavers for Kodi, based upon - /// **DirectX** or/and **OpenGL** rendering with `C++` code. - /// - /// The interface is small and easy usable. It has three functions: - /// - /// * Start() - Called on creation - /// * Render() - Called at render time - /// * Stop() - Called when the screensaver has no work - /// - /// Additionally, there are several \ref cpp_kodi_addon_screensaver_CB "other functions" - /// available in which the child class can ask about the current hardware, - /// including the device, display and several other parts. - /// - /// - /// -------------------------------------------------------------------------- - /// - /// - /// **Here is an example of the minimum required code to start a screensaver:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// class CMyScreenSaver : public kodi::addon::CAddonBase, - /// public kodi::addon::CInstanceScreensaver - /// { - /// public: - /// CMyScreenSaver(); - /// - /// bool Start() override; - /// void Render() override; - /// }; - /// - /// CMyScreenSaver::CMyScreenSaver() - /// { - /// ... - /// } - /// - /// bool CMyScreenSaver::Start() - /// { - /// ... - /// return true; - /// } - /// - /// void CMyScreenSaver::Render() - /// { - /// ... - /// } - /// - /// ADDONCREATOR(CMyScreenSaver) - /// ~~~~~~~~~~~~~ - /// - /// - /// -------------------------------------------------------------------------- - /// - /// - /// **Here is another example where the screensaver is used together with - /// other instance types:** - /// - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// class CMyScreenSaver : public ::kodi::addon::CInstanceScreensaver - /// { - /// public: - /// CMyScreenSaver(KODI_HANDLE instance); - /// - /// bool Start() override; - /// void Render() override; - /// }; - /// - /// CMyScreenSaver::CMyScreenSaver(KODI_HANDLE instance) - /// : CInstanceScreensaver(instance) - /// { - /// ... - /// } - /// - /// bool CMyScreenSaver::Start() - /// { - /// ... - /// return true; - /// } - /// - /// void CMyScreenSaver::Render() - /// { - /// ... - /// } - /// - /// - /// /*----------------------------------------------------------------------*/ - /// - /// class CMyAddon : public ::kodi::addon::CAddonBase - /// { - /// public: - /// CMyAddon() { } - /// ADDON_STATUS CreateInstance(int instanceType, - /// std::string instanceID, - /// KODI_HANDLE instance, - /// KODI_HANDLE& addonInstance) override; - /// }; - /// - /// /* If you use only one instance in your add-on, can be instanceType and - /// * instanceID ignored */ - /// ADDON_STATUS CMyAddon::CreateInstance(int instanceType, - /// std::string instanceID, - /// KODI_HANDLE instance, - /// KODI_HANDLE& addonInstance) - /// { - /// if (instanceType == ADDON_INSTANCE_SCREENSAVER) - /// { - /// kodi::Log(ADDON_LOG_NOTICE, "Creating my Screensaver"); - /// addonInstance = new CMyScreenSaver(instance); - /// return ADDON_STATUS_OK; - /// } - /// else if (...) - /// { - /// ... - /// } - /// return ADDON_STATUS_UNKNOWN; - /// } - /// - /// ADDONCREATOR(CMyAddon) - /// ~~~~~~~~~~~~~ - /// - /// The destruction of the example class `CMyScreenSaver` is called from - /// Kodi's header. Manually deleting the add-on instance is not required. - /// - //---------------------------------------------------------------------------- - class ATTRIBUTE_HIDDEN CInstanceScreensaver : public IAddonInstance - { - public: - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver - /// @brief Screensaver class constructor - /// - /// Used by an add-on that only supports screensavers. - /// - CInstanceScreensaver() - : IAddonInstance(ADDON_INSTANCE_SCREENSAVER, GetKodiTypeVersion(ADDON_INSTANCE_SCREENSAVER)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstanceScreensaver: Creation of more as one in single instance way is not allowed!"); - - SetAddonStruct(CAddonBase::m_interface->firstKodiInstance); - CAddonBase::m_interface->globalSingleInstance = this; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver - /// @brief Screensaver class constructor used to support multiple instance - /// types - /// - /// @param[in] instance The instance value given to - /// `kodi::addon::CAddonBase::CreateInstance(...)`. - /// @param[in] kodiVersion [opt] Version used in Kodi for this instance, to - /// allow compatibility to older Kodi versions. - /// @note Recommended to set. - /// - /// @warning Only use `instance` from the CreateInstance call - /// - explicit CInstanceScreensaver(KODI_HANDLE instance, const std::string& kodiVersion = "") - : IAddonInstance(ADDON_INSTANCE_SCREENSAVER, - !kodiVersion.empty() ? kodiVersion - : GetKodiTypeVersion(ADDON_INSTANCE_SCREENSAVER)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstanceScreensaver: Creation of multiple together with single instance way is not allowed!"); - - SetAddonStruct(instance); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver - /// @brief Destructor - /// - ~CInstanceScreensaver() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver - /// @brief Used to notify the screensaver that it has been started - /// - /// @return true if the screensaver was started - /// successfully, false otherwise - /// - virtual bool Start() { return true; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver - /// @brief Used to inform the screensaver that the rendering control was - /// stopped - /// - virtual void Stop() {} - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver - /// @brief Used to indicate when the add-on should render - /// - virtual void Render() {} - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \defgroup cpp_kodi_addon_screensaver_CB Information functions - /// \ingroup cpp_kodi_addon_screensaver - /// @brief **To get info about the device, display and several other parts** - /// - //@{ - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver_CB - /// @brief Device that represents the display adapter - /// - /// @return A pointer to the device - /// - /// @note This is only available on **DirectX**, It us unused (`nullptr`) on - /// **OpenGL** - /// - inline void* Device() { return m_instanceData->props.device; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver_CB - /// @brief Returns the X position of the rendering window - /// - /// @return The X position, in pixels - /// - inline int X() { return m_instanceData->props.x; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver_CB - /// @brief Returns the Y position of the rendering window - /// - /// @return The Y position, in pixels - /// - inline int Y() { return m_instanceData->props.y; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver_CB - /// @brief Returns the width of the rendering window - /// - /// @return The width, in pixels - /// - inline int Width() { return m_instanceData->props.width; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver_CB - /// @brief Returns the height of the rendering window - /// - /// @return The height, in pixels - /// - inline int Height() { return m_instanceData->props.height; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver_CB - /// @brief Pixel aspect ratio (often abbreviated PAR) is a ratio that - /// describes how the width of a pixel compares to the height of that pixel. - /// - /// @return The pixel aspect ratio used by the display - /// - inline float PixelRatio() { return m_instanceData->props.pixelRatio; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver_CB - /// @brief Used to get the name of the add-on defined in `addon.xml` - /// - /// @return The add-on name - /// - inline std::string Name() { return m_instanceData->props.name; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver_CB - /// @brief Used to get the full path where the add-on is installed - /// - /// @return The add-on installation path - /// - inline std::string Presets() { return m_instanceData->props.presets; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_screensaver_CB - /// @brief Used to get the full path to the add-on's user profile - /// - /// @note The trailing folder (consisting of the add-on's ID) is not created - /// by default. If it is needed, you must call kodi::vfs::CreateDirectory() - /// to create the folder. - /// - /// @return Path to the user profile - /// - inline std::string Profile() { return m_instanceData->props.profile; } - //-------------------------------------------------------------------------- - //@} - - private: - void SetAddonStruct(KODI_HANDLE instance) - { - if (instance == nullptr) - throw std::logic_error("kodi::addon::CInstanceScreensaver: Creation with empty addon structure not allowed, table must be given from Kodi!"); - - m_instanceData = static_cast(instance); - m_instanceData->toAddon.addonInstance = this; - m_instanceData->toAddon.Start = ADDON_Start; - m_instanceData->toAddon.Stop = ADDON_Stop; - m_instanceData->toAddon.Render = ADDON_Render; - } - - inline static bool ADDON_Start(AddonInstance_Screensaver* instance) - { - instance->toAddon.addonInstance->m_renderHelper = kodi::gui::GetRenderHelper(); - return instance->toAddon.addonInstance->Start(); - } - - inline static void ADDON_Stop(AddonInstance_Screensaver* instance) - { - instance->toAddon.addonInstance->Stop(); - instance->toAddon.addonInstance->m_renderHelper = nullptr; - } - - inline static void ADDON_Render(AddonInstance_Screensaver* instance) - { - if (!instance->toAddon.addonInstance->m_renderHelper) - return; - instance->toAddon.addonInstance->m_renderHelper->Begin(); - instance->toAddon.addonInstance->Render(); - instance->toAddon.addonInstance->m_renderHelper->End(); - } - - /* - * Background render helper holds here and in addon base. - * In addon base also to have for the others, and stored here for the worst - * case where this class is independent from base and base becomes closed - * before. - * - * This is on Kodi with GL unused and the calls to there are empty (no work) - * On Kodi with Direct X where angle is present becomes this used. - */ - std::shared_ptr m_renderHelper; - AddonInstance_Screensaver* m_instanceData; - }; - -} /* namespace addon */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VFS.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VFS.h deleted file mode 100644 index efd5de2..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VFS.h +++ /dev/null @@ -1,1265 +0,0 @@ -/* - * Copyright (C) 2015-2018 Team Kodi - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../AddonBase.h" -#include "../Filesystem.h" - -#if !defined(_WIN32) -#include -#if !defined(__stat64) -#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) -#define __stat64 stat -#else -#define __stat64 stat64 -#endif -#endif -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //============================================================================ - /// @ingroup cpp_kodi_addon_vfs_Defs - /// @brief **VFS add-on URL data**\n - /// This class is used to inform the addon of the desired wanted connection. - /// - /// Used on mostly all addon functions to identify related target. - /// - struct VFSURL - { - /// @brief Desired URL of the file system to be edited - /// - /// This includes all available parts of the access and is structured as - /// follows: - /// - ``://``:```@```:``/``?`` - const char* url; - - /// @brief The associated domain name, which is optional and not available - /// in all cases. - const char* domain; - - /// @brief This includes the network address (e.g. `192.168.0.123`) or if - /// the addon refers to file packages the path to it - /// (e.g. `/home/by_me/MyPacket.rar`). - const char* hostname; - - /// @brief With this variable the desired path to a folder or file within - /// the hostname is given (e.g. `storage/videos/00001.ts`). - const char* filename; - - /// @brief [Networking port](https://en.wikipedia.org/wiki/Port_(computer_networking)) - /// to use for protocol. - unsigned int port; - - /// @brief Special options on opened URL, this can e.g. on RAR packages - /// `?flags=8&nextvalue=123` to inform about to not cache a read. - /// - /// Available options from Kodi: - /// | Value: | Description: - /// |-----------|------------------- - /// | flags=8 | Used on RAR packages so that no data is cached from the requested source. - /// | cache=no | Used on ZIP packages so that no data from the requested source is stored in the cache. However, this is currently not available from addons! - /// - /// In addition, other addons can use the URLs given by them to give options - /// that fit the respective VFS addon and allow special operations. - /// - /// @note This procedure is not yet standardized and is currently not - /// exactly available which are handed over. - const char* options; - - /// @brief Desired username. - const char* username; - - /// @brief Desired password. - const char* password; - - /// @brief The complete URL is passed on here, but the user name and - /// password are not shown and only appear to there as `USERNAME:PASSWORD`. - /// - /// As example `sftp://USERNAME:PASSWORD@192.168.178.123/storage/videos/00001.ts`. - const char* redacted; - - /// @brief The name which is taken as the basis by source and would be first - /// in folder view. - /// - /// As example on `sftp://dudu:isprivate@192.168.178.123/storage/videos/00001.ts` - /// becomes then `storage` used here. - const char* sharename; - - /// @brief Protocol name used on this stream, e.g. `sftp`. - const char* protocol; - }; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_vfs_Defs - /// @brief In/out value which is queried at @ref kodi::addon::CInstanceVFS::IoControl.\n - /// This declares the requested value on the addon, this gets or has to - /// transfer data depending on the value. - enum VFS_IOCTRL - { - /// @brief For cases where not supported control becomes asked. - /// - /// @note Should normally not given to addon. - VFS_IOCTRL_INVALID = 0, - - /// @brief @ref VFS_IOCTRL_NATIVE_DATA structure, containing what should be - /// passed to native ioctrl. - VFS_IOCTRL_NATIVE = 1, - - /// @brief To check seek is possible. - /// - //// Return 0 if known not to work, 1 if it should work on related calls. - VFS_IOCTRL_SEEK_POSSIBLE = 2, - - /// @brief @ref VFS_IOCTRL_CACHE_STATUS_DATA structure structure on related call - VFS_IOCTRL_CACHE_STATUS = 3, - - /// @brief Unsigned int with speed limit for caching in bytes per second - VFS_IOCTRL_CACHE_SETRATE = 4, - - /// @brief Enable/disable retry within the protocol handler (if supported) - VFS_IOCTRL_SET_RETRY = 16, - }; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_vfs_Defs - /// @brief Structure used in @ref kodi::addon::CInstanceVFS::IoControl - /// if question value for @ref VFS_IOCTRL_NATIVE is set\n - /// With this structure, data is transmitted to the Kodi addon. - /// - /// This corresponds to POSIX systems with regard to [ioctl](https://en.wikipedia.org/wiki/Ioctl) - /// data (emulated with Windows). - struct VFS_IOCTRL_NATIVE_DATA - { - unsigned long int request; - void* param; - }; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_vfs_Defs - /// @brief Structure used in @ref kodi::addon::CInstanceVFS::IoControl - /// if question value for @ref VFS_IOCTRL_CACHE_STATUS is set\n - /// This data is filled by the addon and returned to Kodi - struct VFS_IOCTRL_CACHE_STATUS_DATA - { - /// @brief Number of bytes cached forward of current position. - uint64_t forward; - - /// @brief Maximum number of bytes per second cache is allowed to fill. - unsigned int maxrate; - - /// @brief Average read rate from source file since last position change. - unsigned int currate; - - /// @brief Cache low speed condition detected? - bool lowspeed; - }; - //---------------------------------------------------------------------------- - - typedef struct VFSGetDirectoryCallbacks /* internal */ - { - bool (__cdecl* get_keyboard_input)(void* ctx, const char* heading, char** input, bool hidden_input); - void (__cdecl* set_error_dialog)(void* ctx, const char* heading, const char* line1, const char* line2, const char* line3); - void (__cdecl* require_authentication)(void* ctx, const char* url); - void* ctx; - } VFSGetDirectoryCallbacks; - - typedef struct AddonProps_VFSEntry /* internal */ - { - int dummy; - } AddonProps_VFSEntry; - - typedef struct AddonToKodiFuncTable_VFSEntry /* internal */ - { - KODI_HANDLE kodiInstance; - } AddonToKodiFuncTable_VFSEntry; - - struct AddonInstance_VFSEntry; - typedef struct KodiToAddonFuncTable_VFSEntry /* internal */ - { - KODI_HANDLE addonInstance; - - void*(__cdecl* open)(const struct AddonInstance_VFSEntry* instance, const struct VFSURL* url); - void*(__cdecl* open_for_write)(const struct AddonInstance_VFSEntry* instance, - const struct VFSURL* url, - bool overwrite); - ssize_t(__cdecl* read)(const struct AddonInstance_VFSEntry* instance, - void* context, - void* buffer, - size_t buf_size); - ssize_t(__cdecl* write)(const struct AddonInstance_VFSEntry* instance, - void* context, - const void* buffer, - size_t buf_size); - int64_t(__cdecl* seek)(const struct AddonInstance_VFSEntry* instance, - void* context, - int64_t position, - int whence); - int(__cdecl* truncate)(const struct AddonInstance_VFSEntry* instance, - void* context, - int64_t size); - int64_t(__cdecl* get_length)(const struct AddonInstance_VFSEntry* instance, void* context); - int64_t(__cdecl* get_position)(const struct AddonInstance_VFSEntry* instance, void* context); - int(__cdecl* get_chunk_size)(const struct AddonInstance_VFSEntry* instance, void* context); - int(__cdecl* io_control)(const struct AddonInstance_VFSEntry* instance, - void* context, - enum VFS_IOCTRL request, - void* param); - int(__cdecl* stat)(const struct AddonInstance_VFSEntry* instance, - const struct VFSURL* url, - struct __stat64* buffer); - bool(__cdecl* close)(const struct AddonInstance_VFSEntry* instance, void* context); - bool(__cdecl* exists)(const struct AddonInstance_VFSEntry* instance, const struct VFSURL* url); - void(__cdecl* clear_out_idle)(const struct AddonInstance_VFSEntry* instance); - void(__cdecl* disconnect_all)(const struct AddonInstance_VFSEntry* instance); - bool(__cdecl* delete_it)(const struct AddonInstance_VFSEntry* instance, - const struct VFSURL* url); - bool(__cdecl* rename)(const struct AddonInstance_VFSEntry* instance, - const struct VFSURL* url, - const struct VFSURL* url2); - bool(__cdecl* directory_exists)(const struct AddonInstance_VFSEntry* instance, - const struct VFSURL* url); - bool(__cdecl* remove_directory)(const struct AddonInstance_VFSEntry* instance, - const struct VFSURL* url); - bool(__cdecl* create_directory)(const struct AddonInstance_VFSEntry* instance, - const struct VFSURL* url); - bool(__cdecl* get_directory)(const struct AddonInstance_VFSEntry* instance, - const struct VFSURL* url, - struct VFSDirEntry** entries, - int* num_entries, - VFSGetDirectoryCallbacks* callbacks); - bool(__cdecl* contains_files)(const struct AddonInstance_VFSEntry* instance, - const struct VFSURL* url, - struct VFSDirEntry** entries, - int* num_entries, - char* rootpath); - void(__cdecl* free_directory)(const struct AddonInstance_VFSEntry* instance, - struct VFSDirEntry* entries, - int num_entries); - } KodiToAddonFuncTable_VFSEntry; - - typedef struct AddonInstance_VFSEntry /* internal */ - { - AddonProps_VFSEntry* props; - AddonToKodiFuncTable_VFSEntry* toKodi; - KodiToAddonFuncTable_VFSEntry* toAddon; - } AddonInstance_VFSEntry; - -#ifdef __cplusplus -} /* extern "C" */ - -namespace kodi -{ -namespace addon -{ - -//############################################################################## -/// @defgroup cpp_kodi_addon_vfs_Defs Definitions, structures and enumerators -/// \ingroup cpp_kodi_addon_vfs -/// @brief **VFS add-on general variables** -/// -/// Used to exchange the available options between Kodi and addon. -/// -/// - -//============================================================================== -/// -/// \addtogroup cpp_kodi_addon_vfs -/// @brief \cpp_class{ kodi::addon::CInstanceVFS } -/// **Virtual Filesystem (VFS) add-on instance** -/// -/// This instance type is used to allow Kodi various additional file system -/// types. Be it a special file system, a compressed package or a system -/// available over the network, everything is possible with it. -/// -/// This usage can be requested under various conditions, for example explicitly -/// by another addon, by a Mimetype protocol defined in `addon.xml` or supported -/// file extensions. -/// -/// Include the header @ref VFS.h "#include " -/// to use this class. -/// -/// ---------------------------------------------------------------------------- -/// -/// Here is an example of what the `addon.xml.in` would look like for an VFS addon: -/// -/// ~~~~~~~~~~~~~{.xml} -/// -/// -/// @ADDON_DEPENDS@ -/// -/// -/// My VFS addon summary -/// My VFS description -/// @PLATFORM@ -/// -/// -/// ~~~~~~~~~~~~~ -/// -/// @note Regarding boolean values with "false", these can also be omitted, -/// since this would be the default. -/// -/// -/// ### Standard values that can be declared for processing in `addon.xml`. -/// -/// These values are used by Kodi to identify associated streams and file -/// extensions and then to select the associated addon. -/// -/// \table_start -/// \table_h3{ Labels, Type, Description } -/// \table_row3{ `point`, -/// \anchor cpp_kodi_addon_vfs_point -/// string, -/// The identification of the addon instance to VFS is mandatory `kodi.vfs`. -/// In addition\, the instance declared in the first `` is also the main type of addon. -/// } -/// \table_row3{ `defaultPort`, -/// \anchor cpp_kodi_addon_vfs_defaultPort -/// integer, -/// Default [networking port](https://en.wikipedia.org/wiki/Port_(computer_networking)) -/// to use for protocol. -/// } -/// \table_row3{ `directories`, -/// \anchor cpp_kodi_addon_vfs_directories -/// boolean, -/// VFS entry can list directories. -/// } -/// \table_row3{ `extensions`, -/// \anchor cpp_kodi_addon_vfs_extensions -/// string, -/// Extensions for VFS entry.\n -/// It is possible to declare several using `|`\, e.g. `.abc|.def|.ghi`. -/// } -/// \table_row3{ `encodedhostname`, -/// \anchor cpp_kodi_addon_vfs_encodedhostname -/// boolean, -/// URL protocol from add-ons use encoded hostnames. -/// } -/// \table_row3{ `filedirectories`, -/// \anchor cpp_kodi_addon_vfs_filedirectories -/// boolean, -/// VFS entry contains file directories. -/// } -/// \table_row3{ `files`, -/// \anchor cpp_kodi_addon_vfs_directories -/// boolean, -/// Set to declare that VFS provides files. -/// } -/// \table_row3{ `protocols`, -/// \anchor cpp_kodi_addon_vfs_protocols -/// boolean, -/// Protocols for VFS entry.\n -/// It is possible to declare several using `|`\, e.g. `myprot1|myprot2`.\n -/// @note This field also used to show on GUI\, see `supportBrowsing` below about *2:. -/// When used there\, however\, only a **single** protocol is possible! -/// } -/// \table_row3{ `supportWrite`, -/// \anchor cpp_kodi_addon_vfs_supportWrite -/// boolean, -/// Protocol supports write operations. -/// } -/// \table_row3{ `zeroconf`, -/// \anchor cpp_kodi_addon_vfs_zeroconf -/// string, -/// [Zero conf](https://en.wikipedia.org/wiki/Zero-configuration_networking) announce string for VFS protocol. -/// } -/// \table_row3{ `library_@PLATFORM@`, -/// \anchor cpp_kodi_addon_vfs_library -/// string, -/// The runtime library used for the addon. This is usually declared by `cmake` and correctly displayed in the translated `addon.xml`. -/// } -/// \table_end -/// -/// -/// ### User selectable parts of the addon. -/// -/// The following table describes the values that can be defined by `addon.xml` -/// and which part they relate to for user input. -/// -/// \table_start -/// \table_h3{ Labels, Type, Description } -/// \table_row3{ `supportBrowsing`, -/// \anchor cpp_kodi_addon_vfs_protocol_supportBrowsing -/// boolean, -/// Protocol supports server browsing. Used to open related sources by users in the window.\n\n -/// | Associated places in Kodi: | -/// | :---- | -/// | \image html cpp_kodi_addon_vfs_protocol_1.png | -///
-/// *1: The entry in the menu represented by this option corresponds to the text given with `label`. -/// When the button is pressed\, @ref CInstanceVFS::GetDirectory is called on the add-on to get its content.\n -/// *2: Protocol name of the stream defined with `protocols` in xml.\n -/// @remark See also `supportDialog` about *3:. -/// } -/// \table_row3{ `supportDialog`, -/// \anchor cpp_kodi_addon_vfs_protocol_supportDialog -/// boolean, -/// To point out that Kodi assigns a dialog to this VFS in order to compare it with other values e.g. query supportPassword in it.\n -/// This will be available when adding sources in Kodi under "Add network location...".\n\n -/// | Associated places in Kodi: | -/// | :---- | -/// | \image html cpp_kodi_addon_vfs_protocol_2.png | -///
-/// *1: Field for selecting the VFS handler\, the addon will be available if `supportDialog` is set to `true`.\n -/// *2: To set the associated server address. **Note:** *This field is always activated and cannot be changed by the addon.*\n -/// *3: If `supportBrowsing` is set to `true`\, the button for opening a file selection dialog is given here too\, as in the file window.\n -/// *4: This field is available if `supportPath` is set to `true`.\n -/// *5: To edit the connection port. This field is available if `supportPort` is set to `true`.\n -/// *6: This sets the required username and is available when `supportUsername` is set to `true`.\n -/// *7: This sets the required password and is available when `supportPassword` is set to `true`. -/// } -/// \table_row3{ `supportPath`, -/// \anchor cpp_kodi_addon_vfs_protocol_supportPath -/// boolean, -/// Protocol has path in addition to server name (see `supportDialog` about *4:). -/// } -/// \table_row3{ `supportPort`, -/// \anchor cpp_kodi_addon_vfs_protocol_supportPort -/// boolean, -/// Protocol supports port customization (see `supportDialog` about *5:). -/// } -/// \table_row3{ `supportUsername`, -/// \anchor cpp_kodi_addon_vfs_protocol_supportUsername -/// boolean, -/// Protocol uses logins (see `supportDialog` about *6:). -/// } -/// \table_row3{ `supportPassword`, -/// \anchor cpp_kodi_addon_vfs_protocol_supportPassword -/// boolean, -/// Protocol supports passwords (see `supportDialog` about *7:). -/// } -/// \table_row3{ `protocols`, -/// \anchor cpp_kodi_addon_vfs_protocol_protocols -/// string, -/// Protocols for VFS entry. -/// @note This field is not editable and only used on GUI to show his name\, see `supportBrowsing` about *2: -/// } -/// \table_row3{ `label`, -/// \anchor cpp_kodi_addon_vfs_protocol_label -/// integer, -/// The text identification number used in Kodi for display in the menu at `supportDialog` -/// as a selection option and at `supportBrowsing` (see his image reference *1) as a menu entry.\n -/// This can be a text identifier in Kodi or from addon.\n -/// @remark For addon within 30000-30999 or 32000-32999. -/// } -/// \table_end -/// -/// @remark For more detailed description of the `addon.xml`, see also https://kodi.wiki/view/Addon.xml. -/// -/// -/// -------------------------------------------------------------------------- -/// -/// -/// **Example:** -/// -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// class CMyVFS : public kodi::addon::CInstanceVFS -/// { -/// public: -/// CMyVFS(KODI_HANDLE instance, const std::string& kodiVersion); -/// -/// // Add all your required functions, the most CInstanceVFS functions of -/// // must be included to have addon working correctly. -/// ... -/// }; -/// -/// CMyVFS::CMyVFS(KODI_HANDLE instance, const std::string& kodiVersion) -/// : CInstanceVFS(instance, kodiVersion) -/// { -/// ... -/// } -/// -/// ... -/// -/// /*----------------------------------------------------------------------*/ -/// -/// class CMyAddon : public kodi::addon::CAddonBase -/// { -/// public: -/// CMyAddon() { } -/// ADDON_STATUS CreateInstance(int instanceType, -/// const std::string& instanceID, -/// KODI_HANDLE instance, -/// const std::string& version, -/// KODI_HANDLE& addonInstance) override; -/// }; -/// -/// // If you use only one instance in your add-on, can be instanceType and -/// // instanceID ignored -/// ADDON_STATUS CMyAddon::CreateInstance(int instanceType, -/// const std::string& instanceID, -/// KODI_HANDLE instance, -/// const std::string& version, -/// KODI_HANDLE& addonInstance) -/// { -/// if (instanceType == ADDON_INSTANCE_VFS) -/// { -/// kodi::Log(ADDON_LOG_NOTICE, "Creating my VFS instance"); -/// addonInstance = new CMyVFS(instance, version); -/// return ADDON_STATUS_OK; -/// } -/// else if (...) -/// { -/// ... -/// } -/// return ADDON_STATUS_UNKNOWN; -/// } -/// -/// ADDONCREATOR(CMyAddon) -/// ~~~~~~~~~~~~~ -/// -/// The destruction of the example class `CMyVFS` is called from -/// Kodi's header. Manually deleting the add-on instance is not required. -/// -//---------------------------------------------------------------------------- -class ATTRIBUTE_HIDDEN CInstanceVFS : public IAddonInstance -{ -public: - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs - /// @brief VFS class constructor used to support multiple instance - /// types - /// - /// @param[in] instance The instance value given to - /// `kodi::addon::CAddonBase::CreateInstance(...)`. - /// @param[in] kodiVersion [opt] given from Kodi by @ref CAddonBase::CreateInstance - /// to identify his instance API version - /// - /// @note Instance path as a single is not supported by this type. It must - /// ensure that it can be called up several times. - /// - /// @warning Only use `instance` from the @ref CAddonBase::CreateInstance or - /// @ref CAddonBase::CreateInstance call. - /// - explicit CInstanceVFS(KODI_HANDLE instance, const std::string& kodiVersion = "") - : IAddonInstance(ADDON_INSTANCE_VFS, - !kodiVersion.empty() ? kodiVersion : GetKodiTypeVersion(ADDON_INSTANCE_VFS)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstanceVFS: Creation of multiple together with single " - "instance way is not allowed!"); - - SetAddonStruct(instance); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs - /// @brief Destructor - /// - ~CInstanceVFS() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @defgroup cpp_kodi_addon_vfs_general 1. General access functions - /// @ingroup cpp_kodi_addon_vfs - /// @brief **General access functions** - /// - /// This functions which are intended for getting folders, editing storage - /// locations and file system queries. - /// - - //========================================================================== - /// - /// @defgroup cpp_kodi_addon_vfs_filecontrol 2. File editing functions - /// @ingroup cpp_kodi_addon_vfs - /// @brief **File editing functions.** - /// - /// This value represents the addon-side handlers and to be able to identify - /// his own parts in the event of further access. - /// - - //@{ - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_filecontrol - /// @brief Open a file for input - /// - /// @param[in] url The URL of the file - /// @return Context for the opened file - virtual void* Open(const VFSURL& url) { return nullptr; } - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_filecontrol - /// @brief Open a file for output - /// - /// @param[in] url The URL of the file - /// @param[in] overWrite Whether or not to overwrite an existing file - /// @return Context for the opened file - /// - virtual void* OpenForWrite(const VFSURL& url, bool overWrite) { return nullptr; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_filecontrol - /// @brief Close a file - /// - /// @param[in] context The context of the file - /// @return True on success, false on failure - /// - virtual bool Close(void* context) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_filecontrol - /// @brief Read from a file - /// - /// @param[in] context The context of the file - /// @param[out] buffer The buffer to read data into - /// @param[in] uiBufSize Number of bytes to read - /// @return Number of bytes read - /// - virtual ssize_t Read(void* context, void* buffer, size_t uiBufSize) { return -1; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_filecontrol - /// @brief Write to a file - /// - /// @param[in] context The context of the file - /// @param[in] buffer The buffer to read data from - /// @param[in] uiBufSize Number of bytes to write - /// @return Number of bytes written - /// - virtual ssize_t Write(void* context, const void* buffer, size_t uiBufSize) { return -1; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_filecontrol - /// @brief Seek in a file - /// - /// @param[in] context The context of the file - /// @param[in] position The position to seek to - /// @param[in] whence Position in file 'position' is relative to (SEEK_CUR, SEEK_SET, SEEK_END) - /// @return Offset in file after seek - /// - virtual int64_t Seek(void* context, int64_t position, int whence) { return -1; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_filecontrol - /// @brief Truncate a file - /// - /// @param[in] context The context of the file - /// @param[in] size The size to truncate the file to - /// @return 0 on success, -1 on error - /// - virtual int Truncate(void* context, int64_t size) { return -1; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_filecontrol - /// @brief Get total size of a file - /// - /// @param[in] context The context of the file - /// @return Total file size - /// - virtual int64_t GetLength(void* context) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_filecontrol - /// @brief Get current position in a file - /// - /// @param[in] context The context of the file - /// @return Current position - /// - virtual int64_t GetPosition(void* context) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_filecontrol - /// @brief Get chunk size of a file - /// - /// @param[in] context The context of the file - /// @return Chunk size - /// - virtual int GetChunkSize(void* context) { return 1; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_filecontrol - /// @brief Perform an IO-control on the file - /// - /// @param[in] context The context of the file - /// @param[in] request The requested IO-control - /// @param[in] param Parameter attached to the IO-control - /// @return -1 on error, >= 0 on success - /// - virtual int IoControl(void* context, VFS_IOCTRL request, void* param) { return -1; } - //-------------------------------------------------------------------------- - //@} - - //@{ - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_general - /// @brief Stat a file - /// - /// @param[in] url The URL of the file - /// @param[in] buffer The buffer to store results in - /// @return -1 on error, 0 otherwise - /// - virtual int Stat(const VFSURL& url, struct __stat64* buffer) { return 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_general - /// @brief Check for file existence - /// - /// @param[in] url The URL of the file - /// @return True if file exists, false otherwise - /// - virtual bool Exists(const VFSURL& url) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_general - /// @brief Clear out any idle connections - /// - virtual void ClearOutIdle() {} - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_general - /// @brief Disconnect all connections - /// - virtual void DisconnectAll() {} - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_general - /// @brief Delete a file - /// - /// @param[in] url The URL of the file - /// @return True if deletion was successful, false otherwise - /// - virtual bool Delete(const VFSURL& url) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_general - /// @brief Rename a file - /// - /// @param[in] url The URL of the source file - /// @param[in] url2 The URL of the destination file - /// @return True if deletion was successful, false otherwise - /// - virtual bool Rename(const VFSURL& url, const VFSURL& url2) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_general - /// @brief Check for directory existence - /// - /// @param[in] url The URL of the file - /// @return True if directory exists, false otherwise - /// - virtual bool DirectoryExists(const VFSURL& url) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_general - /// @brief Remove a directory - /// - /// @param[in] url The URL of the directory - /// @return True if removal was successful, false otherwise - /// - virtual bool RemoveDirectory(const VFSURL& url) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_general - /// @brief Create a directory - /// - /// @param[in] url The URL of the file - /// @return True if creation was successful, false otherwise - /// - virtual bool CreateDirectory(const VFSURL& url) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @defgroup cpp_kodi_addon_vfs_general_cb_GetDirectory **Callbacks GetDirectory()** - /// @ingroup cpp_kodi_addon_vfs_general - /// @brief Callback functions on GetDirectory() - /// - /// This functions becomes available during call of GetDirectory() from - /// Kodi. - /// - /// If GetDirectory() returns false becomes the parts from here used on - /// next call of the function. - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// - /// #include - /// - /// ... - /// - /// bool CMyVFS::GetDirectory(const VFSURL& url, std::vector& items, CVFSCallbacks callbacks) - /// { - /// std::string neededString; - /// callbacks.GetKeyboardInput("Test", neededString, true); - /// if (neededString.empty()) - /// return false; - /// - /// // Do the work - /// ... - /// return true; - /// } - /// ~~~~~~~~~~~~~ - /// - class CVFSCallbacks - { - public: - /// @ingroup cpp_kodi_addon_vfs_general_cb_GetDirectory - /// @brief Require keyboard input - /// - /// Becomes called if GetDirectory() returns false and GetDirectory() - /// becomes after entry called again. - /// - /// @param[in] heading The heading of the keyboard dialog - /// @param[out] input The resulting string. Returns string after - /// second call! - /// @param[in] hiddenInput To show input only as "*" on dialog - /// @return True if input was received, false otherwise - /// - bool GetKeyboardInput(const std::string& heading, std::string& input, bool hiddenInput = false) - { - char* cInput = nullptr; - bool ret = m_cb->get_keyboard_input(m_cb->ctx, heading.c_str(), &cInput, hiddenInput); - if (cInput) - { - input = cInput; - ::kodi::addon::CAddonBase::m_interface->toKodi->free_string( - ::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, cInput); - } - return ret; - } - - /// @ingroup cpp_kodi_addon_vfs_general_cb_GetDirectory - /// @brief Display an error dialog - /// - /// @param[in] heading The heading of the error dialog - /// @param[in] line1 The first line of the error dialog - /// @param[in] line2 [opt] The second line of the error dialog - /// @param[in] line3 [opt] The third line of the error dialog - /// - void SetErrorDialog(const std::string& heading, - const std::string& line1, - const std::string& line2 = "", - const std::string& line3 = "") - { - m_cb->set_error_dialog(m_cb->ctx, heading.c_str(), line1.c_str(), line2.c_str(), - line3.c_str()); - } - - /// @ingroup cpp_kodi_addon_vfs_general_cb_GetDirectory - /// @brief Prompt the user for authentication of a URL - /// - /// @param[in] url The URL - void RequireAuthentication(const std::string& url) - { - m_cb->require_authentication(m_cb->ctx, url.c_str()); - } - - explicit CVFSCallbacks(const VFSGetDirectoryCallbacks* cb) : m_cb(cb) {} - - private: - const VFSGetDirectoryCallbacks* m_cb; - }; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_general - /// @brief List a directory - /// - /// @param[in] url The URL of the directory - /// @param[out] entries The entries in the directory, see - /// @ref cpp_kodi_vfs_CDirEntry "kodi::vfs::CDirEntry" - /// about his content - /// @param[in] callbacks A callback structure - /// @return Context for the directory listing - /// - /// - /// -------------------------------------------------------------------------- - /// - /// ### Callbacks: - /// @copydetails cpp_kodi_addon_vfs_general_cb_GetDirectory - /// - /// **Available callback functions** - /// | Function: | Description - /// |--|-- - /// | CVFSCallbacks::GetKeyboardInput | @copybrief CVFSCallbacks::GetKeyboardInput @copydetails CVFSCallbacks::GetKeyboardInput - /// | CVFSCallbacks::SetErrorDialog | @copybrief CVFSCallbacks::SetErrorDialog @copydetails CVFSCallbacks::SetErrorDialog - /// | CVFSCallbacks::RequireAuthentication | @copybrief CVFSCallbacks::RequireAuthentication @copydetails CVFSCallbacks::RequireAuthentication - /// - virtual bool GetDirectory(const VFSURL& url, - std::vector& entries, - CVFSCallbacks callbacks) - { - return false; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_vfs_general - /// @brief Check if file should be presented as a directory (multiple streams) - /// - /// @param[in] url The URL of the file - /// @param[out] entries The entries in the directory, see - /// @ref cpp_kodi_vfs_CDirEntry "kodi::vfs::CDirEntry" - /// about his content - /// @param[out] rootPath Path to root directory if multiple entries - /// @return Context for the directory listing - /// - virtual bool ContainsFiles(const VFSURL& url, - std::vector& entries, - std::string& rootPath) - { - return false; - } - //-------------------------------------------------------------------------- - //@} - -private: - void SetAddonStruct(KODI_HANDLE instance) - { - if (instance == nullptr) - throw std::logic_error("kodi::addon::CInstanceVFS: Creation with empty addon structure not " - "allowed, table must be given from Kodi!"); - - m_instanceData = static_cast(instance); - m_instanceData->toAddon->addonInstance = this; - m_instanceData->toAddon->open = ADDON_Open; - m_instanceData->toAddon->open_for_write = ADDON_OpenForWrite; - m_instanceData->toAddon->read = ADDON_Read; - m_instanceData->toAddon->write = ADDON_Write; - m_instanceData->toAddon->seek = ADDON_Seek; - m_instanceData->toAddon->truncate = ADDON_Truncate; - m_instanceData->toAddon->get_length = ADDON_GetLength; - m_instanceData->toAddon->get_position = ADDON_GetPosition; - m_instanceData->toAddon->get_chunk_size = ADDON_GetChunkSize; - m_instanceData->toAddon->io_control = ADDON_IoControl; - m_instanceData->toAddon->stat = ADDON_Stat; - m_instanceData->toAddon->close = ADDON_Close; - m_instanceData->toAddon->exists = ADDON_Exists; - m_instanceData->toAddon->clear_out_idle = ADDON_ClearOutIdle; - m_instanceData->toAddon->disconnect_all = ADDON_DisconnectAll; - m_instanceData->toAddon->delete_it = ADDON_Delete; - m_instanceData->toAddon->rename = ADDON_Rename; - m_instanceData->toAddon->directory_exists = ADDON_DirectoryExists; - m_instanceData->toAddon->remove_directory = ADDON_RemoveDirectory; - m_instanceData->toAddon->create_directory = ADDON_CreateDirectory; - m_instanceData->toAddon->get_directory = ADDON_GetDirectory; - m_instanceData->toAddon->free_directory = ADDON_FreeDirectory; - m_instanceData->toAddon->contains_files = ADDON_ContainsFiles; - } - - inline static void* ADDON_Open(const AddonInstance_VFSEntry* instance, const VFSURL* url) - { - return static_cast(instance->toAddon->addonInstance)->Open(*url); - } - - inline static void* ADDON_OpenForWrite(const AddonInstance_VFSEntry* instance, - const VFSURL* url, - bool overWrite) - { - return static_cast(instance->toAddon->addonInstance) - ->OpenForWrite(*url, overWrite); - } - - inline static ssize_t ADDON_Read(const AddonInstance_VFSEntry* instance, - void* context, - void* buffer, - size_t uiBufSize) - { - return static_cast(instance->toAddon->addonInstance) - ->Read(context, buffer, uiBufSize); - } - - inline static ssize_t ADDON_Write(const AddonInstance_VFSEntry* instance, - void* context, - const void* buffer, - size_t uiBufSize) - { - return static_cast(instance->toAddon->addonInstance) - ->Write(context, buffer, uiBufSize); - } - - inline static int64_t ADDON_Seek(const AddonInstance_VFSEntry* instance, - void* context, - int64_t position, - int whence) - { - return static_cast(instance->toAddon->addonInstance) - ->Seek(context, position, whence); - } - - inline static int ADDON_Truncate(const AddonInstance_VFSEntry* instance, - void* context, - int64_t size) - { - return static_cast(instance->toAddon->addonInstance)->Truncate(context, size); - } - - inline static int64_t ADDON_GetLength(const AddonInstance_VFSEntry* instance, void* context) - { - return static_cast(instance->toAddon->addonInstance)->GetLength(context); - } - - inline static int64_t ADDON_GetPosition(const AddonInstance_VFSEntry* instance, void* context) - { - return static_cast(instance->toAddon->addonInstance)->GetPosition(context); - } - - inline static int ADDON_GetChunkSize(const AddonInstance_VFSEntry* instance, void* context) - { - return static_cast(instance->toAddon->addonInstance)->GetChunkSize(context); - } - - inline static int ADDON_IoControl(const AddonInstance_VFSEntry* instance, - void* context, - enum VFS_IOCTRL request, - void* param) - { - return static_cast(instance->toAddon->addonInstance) - ->IoControl(context, request, param); - } - - inline static int ADDON_Stat(const AddonInstance_VFSEntry* instance, - const VFSURL* url, - struct __stat64* buffer) - { - return static_cast(instance->toAddon->addonInstance)->Stat(*url, buffer); - } - - inline static bool ADDON_Close(const AddonInstance_VFSEntry* instance, void* context) - { - return static_cast(instance->toAddon->addonInstance)->Close(context); - } - - inline static bool ADDON_Exists(const AddonInstance_VFSEntry* instance, const VFSURL* url) - { - return static_cast(instance->toAddon->addonInstance)->Exists(*url); - } - - inline static void ADDON_ClearOutIdle(const AddonInstance_VFSEntry* instance) - { - return static_cast(instance->toAddon->addonInstance)->ClearOutIdle(); - } - - inline static void ADDON_DisconnectAll(const AddonInstance_VFSEntry* instance) - { - return static_cast(instance->toAddon->addonInstance)->DisconnectAll(); - } - - inline static bool ADDON_Delete(const AddonInstance_VFSEntry* instance, const VFSURL* url) - { - return static_cast(instance->toAddon->addonInstance)->Delete(*url); - } - - inline static bool ADDON_Rename(const AddonInstance_VFSEntry* instance, - const VFSURL* url, - const VFSURL* url2) - { - return static_cast(instance->toAddon->addonInstance)->Rename(*url, *url2); - } - - inline static bool ADDON_DirectoryExists(const AddonInstance_VFSEntry* instance, - const VFSURL* url) - { - return static_cast(instance->toAddon->addonInstance)->DirectoryExists(*url); - } - - inline static bool ADDON_RemoveDirectory(const AddonInstance_VFSEntry* instance, - const VFSURL* url) - { - return static_cast(instance->toAddon->addonInstance)->RemoveDirectory(*url); - } - - inline static bool ADDON_CreateDirectory(const AddonInstance_VFSEntry* instance, - const VFSURL* url) - { - return static_cast(instance->toAddon->addonInstance)->CreateDirectory(*url); - } - - inline static bool ADDON_GetDirectory(const AddonInstance_VFSEntry* instance, - const VFSURL* url, - VFSDirEntry** retEntries, - int* num_entries, - VFSGetDirectoryCallbacks* callbacks) - { - std::vector addonEntries; - bool ret = static_cast(instance->toAddon->addonInstance) - ->GetDirectory(*url, addonEntries, CVFSCallbacks(callbacks)); - if (ret) - { - VFSDirEntry* entries = - static_cast(malloc(sizeof(VFSDirEntry) * addonEntries.size())); - for (unsigned int i = 0; i < addonEntries.size(); ++i) - { - entries[i].label = strdup(addonEntries[i].Label().c_str()); - entries[i].title = strdup(addonEntries[i].Title().c_str()); - entries[i].path = strdup(addonEntries[i].Path().c_str()); - entries[i].folder = addonEntries[i].IsFolder(); - entries[i].size = addonEntries[i].Size(); - entries[i].date_time = addonEntries[i].DateTime(); - - entries[i].num_props = 0; - const std::map& props = addonEntries[i].GetProperties(); - if (!props.empty()) - { - entries[i].properties = - static_cast(malloc(sizeof(VFSProperty) * props.size())); - for (const auto& prop : props) - { - entries[i].properties[entries[i].num_props].name = strdup(prop.first.c_str()); - entries[i].properties[entries[i].num_props].val = strdup(prop.second.c_str()); - ++entries[i].num_props; - } - } - else - entries[i].properties = nullptr; - } - *retEntries = entries; - *num_entries = static_cast(addonEntries.size()); - } - return ret; - } - - inline static void ADDON_FreeDirectory(const AddonInstance_VFSEntry* instance, - VFSDirEntry* entries, - int num_entries) - { - for (int i = 0; i < num_entries; ++i) - { - if (entries[i].properties) - { - for (unsigned int j = 0; j < entries[i].num_props; ++j) - { - free(entries[i].properties[j].name); - free(entries[i].properties[j].val); - } - free(entries[i].properties); - } - free(entries[i].label); - free(entries[i].title); - free(entries[i].path); - } - free(entries); - } - - inline static bool ADDON_ContainsFiles(const AddonInstance_VFSEntry* instance, - const VFSURL* url, - VFSDirEntry** retEntries, - int* num_entries, - char* rootpath) - { - std::string cppRootPath; - std::vector addonEntries; - bool ret = static_cast(instance->toAddon->addonInstance) - ->ContainsFiles(*url, addonEntries, cppRootPath); - if (ret) - { - strncpy(rootpath, cppRootPath.c_str(), ADDON_STANDARD_STRING_LENGTH); - - VFSDirEntry* entries = - static_cast(malloc(sizeof(VFSDirEntry) * addonEntries.size())); - for (size_t i = 0; i < addonEntries.size(); ++i) - { - entries[i].label = strdup(addonEntries[i].Label().c_str()); - entries[i].title = strdup(addonEntries[i].Title().c_str()); - entries[i].path = strdup(addonEntries[i].Path().c_str()); - entries[i].folder = addonEntries[i].IsFolder(); - entries[i].size = addonEntries[i].Size(); - entries[i].date_time = addonEntries[i].DateTime(); - - entries[i].num_props = 0; - const std::map& props = addonEntries[i].GetProperties(); - if (!props.empty()) - { - entries[i].properties = - static_cast(malloc(sizeof(VFSProperty) * props.size())); - for (const auto& prop : props) - { - entries[i].properties[entries[i].num_props].name = strdup(prop.first.c_str()); - entries[i].properties[entries[i].num_props].val = strdup(prop.second.c_str()); - ++entries[i].num_props; - } - } - else - entries[i].properties = nullptr; - } - *retEntries = entries; - *num_entries = static_cast(addonEntries.size()); - } - return ret; - } - - AddonInstance_VFSEntry* m_instanceData; -}; - -} /* namespace addon */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VideoCodec.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VideoCodec.h deleted file mode 100644 index 54246f0..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VideoCodec.h +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (C) 2017-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../AddonBase.h" -#include "../StreamCrypto.h" -#include "../StreamCodec.h" - -#ifdef BUILD_KODI_ADDON -#include "../DemuxPacket.h" -#else -#include "cores/VideoPlayer/Interface/Addon/DemuxPacket.h" -#endif - -namespace kodi { namespace addon { class CInstanceVideoCodec; } } - -extern "C" -{ - enum VIDEOCODEC_FORMAT - { - UnknownVideoFormat = 0, - VideoFormatYV12, - VideoFormatI420, - MaxVideoFormats - }; - - - struct VIDEOCODEC_INITDATA - { - enum Codec { - CodecUnknown = 0, - CodecVp8, - CodecH264, - CodecVp9 - } codec; - - STREAMCODEC_PROFILE codecProfile; - - //UnknownVideoFormat is terminator - VIDEOCODEC_FORMAT *videoFormats; - - uint32_t width, height; - - const uint8_t *extraData; - unsigned int extraDataSize; - - CRYPTO_INFO cryptoInfo; - }; - - struct VIDEOCODEC_PICTURE - { - enum VideoPlane { - YPlane = 0, - UPlane, - VPlane, - MaxPlanes = 3, - }; - - enum Flags : uint32_t { - FLAG_DROP, - FLAG_DRAIN - }; - - VIDEOCODEC_FORMAT videoFormat; - uint32_t flags; - - uint32_t width, height; - - uint8_t *decodedData; - size_t decodedDataSize; - - uint32_t planeOffsets[VideoPlane::MaxPlanes]; - uint32_t stride[VideoPlane::MaxPlanes]; - - int64_t pts; - - KODI_HANDLE buffer; //< will be passed in release_frame_buffer - }; - - enum VIDEOCODEC_RETVAL - { - VC_NONE = 0, //< noop - VC_ERROR, //< an error occurred, no other messages will be returned - VC_BUFFER, //< the decoder needs more data - VC_PICTURE, //< the decoder got a picture - VC_EOF, //< the decoder signals EOF - }; - - // this are properties given to the addon on create - // at this time we have no parameters for the addon - typedef struct AddonProps_VideoCodec - { - int dummy; - } AddonProps_VideoCodec; - - struct AddonInstance_VideoCodec; - typedef struct KodiToAddonFuncTable_VideoCodec - { - kodi::addon::CInstanceVideoCodec* addonInstance; - - //! \brief Opens a codec - bool (__cdecl* open) (const AddonInstance_VideoCodec* instance, VIDEOCODEC_INITDATA *initData); - - //! \brief Reconfigures a codec - bool (__cdecl* reconfigure) (const AddonInstance_VideoCodec* instance, VIDEOCODEC_INITDATA *initData); - - //! \brief Feed codec if requested from GetPicture() (return VC_BUFFER) - bool (__cdecl* add_data) (const AddonInstance_VideoCodec* instance, const DemuxPacket *packet); - - //! \brief Get a decoded picture / request new data - VIDEOCODEC_RETVAL (__cdecl* get_picture) (const AddonInstance_VideoCodec* instance, VIDEOCODEC_PICTURE *picture); - - //! \brief Get the name of this video decoder - const char *(__cdecl* get_name) (const AddonInstance_VideoCodec* instance); - - //! \brief Reset the codec - void (__cdecl* reset)(const AddonInstance_VideoCodec* instance); - } KodiToAddonFuncTable_VideoCodec; - - typedef struct AddonToKodiFuncTable_VideoCodec - { - KODI_HANDLE kodiInstance; - bool(*get_frame_buffer)(void* kodiInstance, VIDEOCODEC_PICTURE *picture); - void(*release_frame_buffer)(void* kodiInstance, void *buffer); - } AddonToKodiFuncTable_VideoCodec; - - typedef struct AddonInstance_VideoCodec - { - AddonProps_VideoCodec props; - AddonToKodiFuncTable_VideoCodec toKodi; - KodiToAddonFuncTable_VideoCodec toAddon; - } AddonInstance_VideoCodec; -} - -namespace kodi -{ - namespace addon - { - - class ATTRIBUTE_HIDDEN CInstanceVideoCodec : public IAddonInstance - { - public: - explicit CInstanceVideoCodec(KODI_HANDLE instance, const std::string& kodiVersion = "") - : IAddonInstance(ADDON_INSTANCE_VIDEOCODEC, - !kodiVersion.empty() ? kodiVersion - : GetKodiTypeVersion(ADDON_INSTANCE_VIDEOCODEC)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstanceVideoCodec: Creation of multiple together with single instance way is not allowed!"); - - SetAddonStruct(instance); - } - - ~CInstanceVideoCodec() override = default; - - //! \copydoc CInstanceVideoCodec::Open - virtual bool Open(VIDEOCODEC_INITDATA &initData) { return false; }; - - //! \copydoc CInstanceVideoCodec::Reconfigure - virtual bool Reconfigure(VIDEOCODEC_INITDATA &initData) { return false; }; - - //! \copydoc CInstanceVideoCodec::AddData - virtual bool AddData(const DemuxPacket &packet) { return false; }; - - //! \copydoc CInstanceVideoCodec::GetPicture - virtual VIDEOCODEC_RETVAL GetPicture(VIDEOCODEC_PICTURE &picture) { return VC_ERROR; }; - - //! \copydoc CInstanceVideoCodec::GetName - virtual const char *GetName() { return nullptr; }; - - //! \copydoc CInstanceVideoCodec::Reset - virtual void Reset() {}; - - /*! - * @brief AddonToKodi interface - */ - - //! \copydoc CInstanceVideoCodec::GetFrameBuffer - bool GetFrameBuffer(VIDEOCODEC_PICTURE &picture) - { - return m_instanceData->toKodi.get_frame_buffer(m_instanceData->toKodi.kodiInstance, &picture); - } - - //! \copydoc CInstanceVideoCodec::ReleaseFrameBuffer - void ReleaseFrameBuffer(void *buffer) - { - return m_instanceData->toKodi.release_frame_buffer(m_instanceData->toKodi.kodiInstance, buffer); - } - - private: - void SetAddonStruct(KODI_HANDLE instance) - { - if (instance == nullptr) - throw std::logic_error("kodi::addon::CInstanceVideoCodec: Creation with empty addon structure not allowed, table must be given from Kodi!"); - - m_instanceData = static_cast(instance); - - m_instanceData->toAddon.addonInstance = this; - m_instanceData->toAddon.open = ADDON_Open; - m_instanceData->toAddon.reconfigure = ADDON_Reconfigure; - m_instanceData->toAddon.add_data = ADDON_AddData; - m_instanceData->toAddon.get_picture = ADDON_GetPicture; - m_instanceData->toAddon.get_name = ADDON_GetName; - m_instanceData->toAddon.reset = ADDON_Reset; - } - - inline static bool ADDON_Open(const AddonInstance_VideoCodec* instance, VIDEOCODEC_INITDATA *initData) - { - return instance->toAddon.addonInstance->Open(*initData); - } - - inline static bool ADDON_Reconfigure(const AddonInstance_VideoCodec* instance, VIDEOCODEC_INITDATA *initData) - { - return instance->toAddon.addonInstance->Reconfigure(*initData); - } - - inline static bool ADDON_AddData(const AddonInstance_VideoCodec* instance, const DemuxPacket *packet) - { - return instance->toAddon.addonInstance->AddData(*packet); - } - - inline static VIDEOCODEC_RETVAL ADDON_GetPicture(const AddonInstance_VideoCodec* instance, VIDEOCODEC_PICTURE *picture) - { - return instance->toAddon.addonInstance->GetPicture(*picture); - } - - inline static const char *ADDON_GetName(const AddonInstance_VideoCodec* instance) - { - return instance->toAddon.addonInstance->GetName(); - } - - inline static void ADDON_Reset(const AddonInstance_VideoCodec* instance) - { - return instance->toAddon.addonInstance->Reset(); - } - - AddonInstance_VideoCodec* m_instanceData; - }; - } // namespace addon -} // namespace kodi diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Visualization.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Visualization.h deleted file mode 100644 index 4be785d..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Visualization.h +++ /dev/null @@ -1,789 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -/* - * Parts with a comment named "internal" are only used inside header and not - * used or accessed direct during add-on development! - */ - -#include "../AddonBase.h" -#include "../gui/renderHelper.h" - -namespace kodi { namespace addon { class CInstanceVisualization; }} - -extern "C" -{ - -struct AddonInstance_Visualization; - -typedef enum VIS_ACTION : unsigned int /* internal */ -{ - 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 -} VIS_ACTION; - -struct VIS_INFO /* internal */ -{ - bool bWantsFreq; - int iSyncDelay; -}; - -typedef struct AddonProps_Visualization /* internal */ -{ - void *device; - int x; - int y; - int width; - int height; - float pixelRatio; - const char *name; - const char *presets; - const char *profile; -} AddonProps_Visualization; - -typedef struct AddonToKodiFuncTable_Visualization /* internal */ -{ - KODI_HANDLE kodiInstance; - void (__cdecl* transfer_preset) (void* kodiInstance, const char* preset); - void (__cdecl* clear_presets) (void* kodiInstance); -} AddonToKodiFuncTable_Visualization; - -typedef struct KodiToAddonFuncTable_Visualization /* internal */ -{ - kodi::addon::CInstanceVisualization* addonInstance; - bool (__cdecl* start)(const AddonInstance_Visualization* instance, int channels, int samples_per_sec, int bits_per_sample, const char* song_name); - void (__cdecl* stop)(const AddonInstance_Visualization* instance); - void (__cdecl* audio_data)(const AddonInstance_Visualization* instance, const float* audio_data, int audio_data_length, float *freq_data, int freq_data_length); - bool (__cdecl* is_dirty)(const AddonInstance_Visualization* instance); - void (__cdecl* render)(const AddonInstance_Visualization* instance); - void (__cdecl* get_info)(const AddonInstance_Visualization* instance, VIS_INFO *info); - bool (__cdecl* on_action)(const AddonInstance_Visualization* instance, VIS_ACTION action, const void *param); - unsigned int (__cdecl *get_presets)(const AddonInstance_Visualization* instance); - int (__cdecl *get_active_preset)(const AddonInstance_Visualization* instance); - bool (__cdecl* is_locked)(const AddonInstance_Visualization* instance); -} KodiToAddonFuncTable_Visualization; - -typedef struct AddonInstance_Visualization /* internal */ -{ - AddonProps_Visualization* props; - AddonToKodiFuncTable_Visualization* toKodi; - KodiToAddonFuncTable_Visualization* toAddon; -} AddonInstance_Visualization; - -//============================================================================ -/// \defgroup cpp_kodi_addon_visualization_VisTrack class VisTrack -/// \ingroup cpp_kodi_addon_visualization -/// @brief **Visualization track information structure** -/// -/// Called from kodi::addon::CInstanceVisualization::UpdateTrack() with the -/// information of the currently-playing song. -/// -//@{ -struct VisTrack -{ - /// @brief Title of the current song. - const char *title; - - /// @brief Artist names, as a single string - const char *artist; - - /// @brief Album that the current song is from. - const char *album; - - /// @brief Album artist names, as a single string - const char *albumArtist; - - /// @brief The genre name from the music tag, if present. - const char *genre; - - /// @brief Comment of the current song stored in the ID tag info. - const char *comment; - - /// @brief Lyrics of the current song, if available. - const char *lyrics; - - const char *reserved1; - const char *reserved2; - - /// @brief Track number of the current song. - int trackNumber; - - /// @brief Disc number of the current song stored in the ID tag info. - int discNumber; - - /// @brief Duration of the current song, in seconds. - int duration; - - /// @brief Year that the current song was released. - int year; - - /// @brief The user-defined rating of the current song. - int rating; - - int reserved3; - int reserved4; -}; -//@} -//---------------------------------------------------------------------------- - -} /* extern "C" */ - -namespace kodi -{ -namespace addon -{ - - //============================================================================ - /// - /// \addtogroup cpp_kodi_addon_visualization - /// @brief \cpp_class{ kodi::addon::CInstanceVisualization } - /// **Visualization add-on instance** - /// - /// [Music visualization](https://en.wikipedia.org/wiki/Music_visualization), - /// or music visualisation, is a feature in Kodi that generates animated - /// imagery based on a piece of music. The imagery is usually generated and - /// rendered in real time synchronized to the music. - /// - /// Visualization techniques range from simple ones (e.g., a simulation of an - /// oscilloscope display) to elaborate ones, which often include a plurality - /// of composited effects. The changes in the music's loudness and frequency - /// spectrum are among the properties used as input to the visualization. - /// - /// Include the header \ref Visualization.h "#include " - /// to use this class. - /// - /// This interface allows the creation of visualizations for Kodi, based upon - /// **DirectX** or/and **OpenGL** rendering with `C++` code. - /// - /// Additionally, there are several \ref cpp_kodi_addon_visualization_CB "other functions" - /// available in which the child class can ask about the current hardware, - /// including the device, display and several other parts. - /// - /// -------------------------------------------------------------------------- - /// - /// - /// **Here is an example of the minimum required code to start a visualization:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// class CMyVisualization : public kodi::addon::CAddonBase, - /// public kodi::addon::CInstanceVisualization - /// { - /// public: - /// CMyVisualization(); - /// - /// bool Start(int channels, int samplesPerSec, int bitsPerSample, std::string songName) override; - /// void AudioData(const float* audioData, int audioDataLength, float* freqData, int freqDataLength) override; - /// void Render() override; - /// }; - /// - /// CMyVisualization::CMyVisualization() - /// { - /// ... - /// } - /// - /// bool CMyVisualization::Start(int channels, int samplesPerSec, int bitsPerSample, std::string songName) - /// { - /// ... - /// return true; - /// } - /// - /// void CMyVisualization::AudioData(const float* audioData, int audioDataLength, float* freqData, int freqDataLength) - /// { - /// ... - /// } - /// - /// void CMyVisualization::Render() - /// { - /// ... - /// } - /// - /// ADDONCREATOR(CMyVisualization) - /// ~~~~~~~~~~~~~ - /// - /// - /// -------------------------------------------------------------------------- - /// - /// - /// **Here is another example where the visualization is used together with - /// other instance types:** - /// - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// class CMyVisualization : public ::kodi::addon::CInstanceVisualization - /// { - /// public: - /// CMyVisualization(KODI_HANDLE instance); - /// - /// bool Start(int channels, int samplesPerSec, int bitsPerSample, std::string songName) override; - /// void AudioData(const float* audioData, int audioDataLength, float* freqData, int freqDataLength) override; - /// void Render() override; - /// }; - /// - /// CMyVisualization::CMyVisualization(KODI_HANDLE instance) - /// : CInstanceVisualization(instance) - /// { - /// ... - /// } - /// - /// bool CMyVisualization::Start(int channels, int samplesPerSec, int bitsPerSample, std::string songName) - /// { - /// ... - /// return true; - /// } - /// - /// void CMyVisualization::AudioData(const float* audioData, int audioDataLength, float* freqData, int freqDataLength) - /// { - /// ... - /// } - /// - /// void CMyVisualization::Render() - /// { - /// ... - /// } - /// - /// - /// /*----------------------------------------------------------------------*/ - /// - /// class CMyAddon : public ::kodi::addon::CAddonBase - /// { - /// public: - /// CMyAddon() { } - /// ADDON_STATUS CreateInstance(int instanceType, - /// std::string instanceID, - /// KODI_HANDLE instance, - /// KODI_HANDLE& addonInstance) override; - /// }; - /// - /// /* If you use only one instance in your add-on, can be instanceType and - /// * instanceID ignored */ - /// ADDON_STATUS CMyAddon::CreateInstance(int instanceType, - /// std::string instanceID, - /// KODI_HANDLE instance, - /// KODI_HANDLE& addonInstance) - /// { - /// if (instanceType == ADDON_INSTANCE_VISUALIZATION) - /// { - /// kodi::Log(ADDON_LOG_NOTICE, "Creating my Visualization"); - /// addonInstance = new CMyVisualization(instance); - /// return ADDON_STATUS_OK; - /// } - /// else if (...) - /// { - /// ... - /// } - /// return ADDON_STATUS_UNKNOWN; - /// } - /// - /// ADDONCREATOR(CMyAddon) - /// ~~~~~~~~~~~~~ - /// - /// The destruction of the example class `CMyVisualization` is called from - /// Kodi's header. Manually deleting the add-on instance is not required. - /// - //---------------------------------------------------------------------------- - class ATTRIBUTE_HIDDEN CInstanceVisualization : public IAddonInstance - { - public: - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Visualization class constructor - /// - /// Used by an add-on that only supports visualizations. - /// - CInstanceVisualization() - : IAddonInstance(ADDON_INSTANCE_VISUALIZATION, - GetKodiTypeVersion(ADDON_INSTANCE_VISUALIZATION)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstanceVisualization: Cannot create multiple instances of add-on."); - - SetAddonStruct(CAddonBase::m_interface->firstKodiInstance); - CAddonBase::m_interface->globalSingleInstance = this; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Visualization class constructor used to support multiple instance - /// types - /// - /// @param[in] instance The instance value given to - /// `kodi::addon::CAddonBase::CreateInstance(...)`. - /// @param[in] kodiVersion [opt] Version used in Kodi for this instance, to - /// allow compatibility to older Kodi versions. - /// @note Recommended to set. - /// - /// @warning Only use `instance` from the CreateInstance call - /// - explicit CInstanceVisualization(KODI_HANDLE instance, const std::string& kodiVersion = "") - : IAddonInstance(ADDON_INSTANCE_VISUALIZATION, - !kodiVersion.empty() ? kodiVersion - : GetKodiTypeVersion(ADDON_INSTANCE_VISUALIZATION)) - { - if (CAddonBase::m_interface->globalSingleInstance != nullptr) - throw std::logic_error("kodi::addon::CInstanceVisualization: Creation of multiple together with single instance way is not allowed!"); - - SetAddonStruct(instance); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Destructor - /// - ~CInstanceVisualization() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Used to notify the visualization that a new song has been started - /// - /// @param[in] channels Number of channels in the stream - /// @param[in] samplesPerSec Samples per second of stream - /// @param[in] bitsPerSample Number of bits in one sample - /// @param[in] songName The name of the currently-playing song - /// @return true if start successful done - /// - virtual bool Start(int channels, int samplesPerSec, int bitsPerSample, std::string songName) { return true; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Used to inform the visualization that the rendering control was - /// stopped - /// - virtual void Stop() {} - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Pass audio data to the visualization - /// - /// @param[in] audioData The raw audio data - /// @param[in] audioDataLength Length of the audioData array - /// @param[in] freqData The [FFT](https://en.wikipedia.org/wiki/Fast_Fourier_transform) - /// of the audio data - /// @param[in] freqDataLength Length of frequency data array - /// - /// Values **freqData** and **freqDataLength** are used if GetInfo() returns - /// true for the `wantsFreq` parameter. Otherwise, **freqData** is set to - /// `nullptr` and **freqDataLength** is `0`. - /// - virtual void AudioData(const float* audioData, int audioDataLength, float* freqData, int freqDataLength) {} - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Used to inform Kodi that the rendered region is dirty and need an - /// update - /// - /// @return True if dirty - /// - virtual bool IsDirty() { return true; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Used to indicate when the add-on should render - /// - virtual void Render() {} - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Used to get the number of buffers from the current visualization - /// - /// @param[out] wantsFreq Indicates whether the add-on wants FFT - /// data. If set to true, the **freqData** - /// and **freqDataLength** parameters of - /// AudioData() are used - /// @param[out] syncDelay The number of buffers to delay before - /// calling AudioData() - /// - /// @note If this function is not implemented, it will default to - /// `wantsFreq` = false and `syncDelay` = 0. - /// - virtual void GetInfo(bool& wantsFreq, int& syncDelay) { wantsFreq = false; syncDelay = 0; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Used to get a list of visualization presets the user can select - /// from - /// - /// @param[out] presets The vector list containing the names of - /// presets that the user can select - /// @return Return true if successful, or false if - /// there are no presets to choose from - /// - virtual bool GetPresets(std::vector& presets) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Get the index of the current preset - /// - /// @return Index number of the current preset - /// - virtual int GetActivePreset() { return -1; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Check if the add-on is locked to the current preset - /// - /// @return True if locked to the current preset - /// - virtual bool IsLocked() { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Load the previous visualization preset - /// - /// @return Return true if the previous preset was loaded - virtual bool PrevPreset() { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Load the next visualization preset - /// - /// @return Return true if the next preset was loaded - virtual bool NextPreset() { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Load a visualization preset - /// - /// This function is called after a new preset is selected. - /// - /// @param[in] select Preset index to use - /// @return Return true if the preset is loaded - virtual bool LoadPreset(int select) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Switch to a new random preset - /// - /// @return Return true if a random preset was loaded - virtual bool RandomPreset() { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Lock the current visualization preset, preventing it from changing - /// - /// @param[in] lockUnlock If set to true, the preset should be locked - /// @return Return true if the current preset is locked - virtual bool LockPreset(bool lockUnlock) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Used to increase/decrease the visualization preset rating - /// - /// @param[in] plusMinus If set to true the rating is increased, otherwise - /// decreased - /// @return Return true if the rating is modified - virtual bool RatePreset(bool plusMinus) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Inform the visualization of the current album art image - /// - /// @param[in] albumart Path to the current album art image - /// @return Return true if the image is used - virtual bool UpdateAlbumart(std::string albumart) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization - /// @brief Inform the visualization of the current track's tag information - /// - /// @param[in] track Visualization track information structure - /// @return Return true if the track information is used - virtual bool UpdateTrack(const VisTrack &track) { return false; } - - //========================================================================== - /// - /// \defgroup cpp_kodi_addon_visualization_CB Information functions - /// \ingroup cpp_kodi_addon_visualization - /// @brief **To get info about the device, display and several other parts** - /// - //@{ - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization_CB - /// @brief To transfer available presets on addon - /// - /// Used if @ref GetPresets not possible to use, e.g. where available presets - /// are only known during @ref Start call. - /// - /// @param[in] presets List to store available presets. - /// - /// @note The function should only be called once, if possible - /// - inline void TransferPresets(const std::vector& presets) - { - m_instanceData->toKodi->clear_presets(m_instanceData->toKodi->kodiInstance); - for (auto it : presets) - m_instanceData->toKodi->transfer_preset(m_instanceData->toKodi->kodiInstance, it.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization_CB - /// @brief Device that represents the display adapter - /// - /// @return A pointer to the used device - /// - /// @note This is only available on **DirectX**, It us unused (`nullptr`) on - /// **OpenGL** - /// - inline void* Device() { return m_instanceData->props->device; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization_CB - /// @brief Returns the X position of the rendering window - /// - /// @return The X position, in pixels - /// - inline int X() { return m_instanceData->props->x; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization_CB - /// @brief Returns the Y position of the rendering window - /// - /// @return The Y position, in pixels - /// - inline int Y() { return m_instanceData->props->y; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization_CB - /// @brief Returns the width of the rendering window - /// - /// @return The width, in pixels - /// - inline int Width() { return m_instanceData->props->width; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization_CB - /// @brief Returns the height of the rendering window - /// - /// @return The height, in pixels - /// - inline int Height() { return m_instanceData->props->height; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization_CB - /// @brief Pixel aspect ratio (often abbreviated PAR) is a ratio that - /// describes how the width of a pixel compares to the height of that pixel. - /// - /// @return The pixel aspect ratio used by the display - /// - inline float PixelRatio() { return m_instanceData->props->pixelRatio; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization_CB - /// @brief Used to get the name of the add-on defined in `addon.xml` - /// - /// @return The add-on name - /// - inline std::string Name() { return m_instanceData->props->name; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization_CB - /// @brief Used to get the full path where the add-on is installed - /// - /// @return The add-on installation path - /// - inline std::string Presets() { return m_instanceData->props->presets; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_addon_visualization_CB - /// @brief Used to get the full path to the add-on's user profile - /// - /// @note The trailing folder (consisting of the add-on's ID) is not created - /// by default. If it is needed, you must call kodi::vfs::CreateDirectory() - /// to create the folder. - /// - /// @return Path to the user profile - /// - inline std::string Profile() { return m_instanceData->props->profile; } - //-------------------------------------------------------------------------- - //@} - - private: - void SetAddonStruct(KODI_HANDLE instance) - { - if (instance == nullptr) - throw std::logic_error("kodi::addon::CInstanceVisualization: Null pointer instance passed."); - - m_instanceData = static_cast(instance); - m_instanceData->toAddon->addonInstance = this; - m_instanceData->toAddon->start = ADDON_Start; - m_instanceData->toAddon->stop = ADDON_Stop; - m_instanceData->toAddon->audio_data = ADDON_AudioData; - m_instanceData->toAddon->is_dirty = ADDON_IsDirty; - m_instanceData->toAddon->render = ADDON_Render; - m_instanceData->toAddon->get_info = ADDON_GetInfo; - m_instanceData->toAddon->on_action = ADDON_OnAction; - m_instanceData->toAddon->get_presets = ADDON_GetPresets; - m_instanceData->toAddon->get_active_preset = ADDON_GetActivePreset; - m_instanceData->toAddon->is_locked = ADDON_IsLocked; - } - - inline static bool ADDON_Start(const AddonInstance_Visualization* addon, int channels, int samplesPerSec, int bitsPerSample, const char* songName) - { - addon->toAddon->addonInstance->m_renderHelper = kodi::gui::GetRenderHelper(); - return addon->toAddon->addonInstance->Start(channels, samplesPerSec, bitsPerSample, songName); - } - - inline static void ADDON_Stop(const AddonInstance_Visualization* addon) - { - addon->toAddon->addonInstance->Stop(); - addon->toAddon->addonInstance->m_renderHelper = nullptr; - } - - inline static void ADDON_AudioData(const AddonInstance_Visualization* addon, const float* audioData, int audioDataLength, float *freqData, int freqDataLength) - { - addon->toAddon->addonInstance->AudioData(audioData, audioDataLength, freqData, freqDataLength); - } - - inline static bool ADDON_IsDirty(const AddonInstance_Visualization* addon) - { - return addon->toAddon->addonInstance->IsDirty(); - } - - inline static void ADDON_Render(const AddonInstance_Visualization* addon) - { - if (!addon->toAddon->addonInstance->m_renderHelper) - return; - addon->toAddon->addonInstance->m_renderHelper->Begin(); - addon->toAddon->addonInstance->Render(); - addon->toAddon->addonInstance->m_renderHelper->End(); - } - - inline static void ADDON_GetInfo(const AddonInstance_Visualization* addon, VIS_INFO *info) - { - addon->toAddon->addonInstance->GetInfo(info->bWantsFreq, info->iSyncDelay); - } - - inline static bool ADDON_OnAction(const AddonInstance_Visualization* addon, VIS_ACTION action, const void *param) - { - switch (action) - { - case VIS_ACTION_NEXT_PRESET: - return addon->toAddon->addonInstance->NextPreset(); - case VIS_ACTION_PREV_PRESET: - return addon->toAddon->addonInstance->PrevPreset(); - case VIS_ACTION_LOAD_PRESET: - return addon->toAddon->addonInstance->LoadPreset(*static_cast(param)); - case VIS_ACTION_RANDOM_PRESET: - return addon->toAddon->addonInstance->RandomPreset(); - case VIS_ACTION_LOCK_PRESET: - addon->toAddon->addonInstance->m_presetLockedByUser = !addon->toAddon->addonInstance->m_presetLockedByUser; - return addon->toAddon->addonInstance->LockPreset(addon->toAddon->addonInstance->m_presetLockedByUser); - case VIS_ACTION_RATE_PRESET_PLUS: - return addon->toAddon->addonInstance->RatePreset(true); - case VIS_ACTION_RATE_PRESET_MINUS: - return addon->toAddon->addonInstance->RatePreset(false); - case VIS_ACTION_UPDATE_ALBUMART: - return addon->toAddon->addonInstance->UpdateAlbumart(static_cast(param)); - case VIS_ACTION_UPDATE_TRACK: - return addon->toAddon->addonInstance->UpdateTrack(*static_cast(param)); - case VIS_ACTION_NONE: - default: - break; - } - return false; - } - - inline static unsigned int ADDON_GetPresets(const AddonInstance_Visualization* addon) - { - std::vector presets; - if (addon->toAddon->addonInstance->GetPresets(presets)) - { - for (auto it : presets) - addon->toAddon->addonInstance->m_instanceData->toKodi->transfer_preset(addon->toKodi->kodiInstance, it.c_str()); - } - - return static_cast(presets.size()); - } - - inline static int ADDON_GetActivePreset(const AddonInstance_Visualization* addon) - { - return addon->toAddon->addonInstance->GetActivePreset(); - } - - inline static bool ADDON_IsLocked(const AddonInstance_Visualization* addon) - { - return addon->toAddon->addonInstance->IsLocked(); - } - - std::shared_ptr m_renderHelper; - bool m_presetLockedByUser = false; - AddonInstance_Visualization* m_instanceData; - }; - -} /* namespace addon */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/CMakeLists.txt deleted file mode 100644 index 946849e..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -set(HEADERS ChannelGroups.h - Channels.h - EDL.h - EPG.h - General.h - MenuHook.h - Recordings.h - Stream.h - Timers.h) - -if(NOT ENABLE_STATIC_LIBS) - core_add_library(addons_kodi-addon-dev-kit_include_kodi_addon-instance_pvr) -endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/ChannelGroups.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/ChannelGroups.h deleted file mode 100644 index 17995bb..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/ChannelGroups.h +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../../c-api/addon-instance/pvr.h" - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" Definitions group 3 - PVR channel group -#ifdef __cplusplus - -namespace kodi -{ -namespace addon -{ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroup class PVRChannelGroup -/// @ingroup cpp_kodi_addon_pvr_Defs_ChannelGroup -/// @brief **PVR add-on channel group**\n -/// To define a group for channels, this becomes be asked from -/// @ref kodi::addon::CInstancePVRClient::GetChannelGroups() and used on -/// @ref kodi::addon::CInstancePVRClient::GetChannelGroupMembers() to get his -/// content with @ref cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMember "PVRChannelGroupMember". -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroup_Help -/// -///@{ -class PVRChannelGroup : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVRChannelGroup() { memset(m_cStructure, 0, sizeof(PVR_CHANNEL_GROUP)); } - PVRChannelGroup(const PVRChannelGroup& channel) : CStructHdl(channel) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroup_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroup - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroup : - /// | Name | Type | Set call | Get call | Usage - /// |------|------|----------|----------|----------- - /// | **Group name** | `std::string` | @ref PVRChannelGroup::SetGroupName "SetGroupName" | @ref PVRChannelGroup::GetGroupName "GetGroupName" | *required to set* - /// | **Is radio** | `bool` | @ref PVRChannelGroup::SetIsRadio "SetIsRadio" | @ref PVRChannelGroup::GetIsRadio "GetIsRadio" | *required to set* - /// | **Position** | `unsigned int` | @ref PVRChannelGroup::SetPosition "SetPosition" | @ref PVRChannelGroup::GetPosition "GetPosition" | *optional* - /// - - /// @ingroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroup - ///@{ - - /// @brief **required**\n - /// Name of this channel group. - void SetGroupName(const std::string& groupName) - { - strncpy(m_cStructure->strGroupName, groupName.c_str(), sizeof(m_cStructure->strGroupName) - 1); - } - - /// @brief To get with @ref SetGroupName changed values. - std::string GetGroupName() const { return m_cStructure->strGroupName; } - - /// @brief **required**\n - /// **true** If this is a radio channel group, **false** otherwise. - void SetIsRadio(bool isRadio) { m_cStructure->bIsRadio = isRadio; } - - /// @brief To get with @ref SetIsRadio changed values. - bool GetIsRadio() const { return m_cStructure->bIsRadio; } - - /// @brief **optional**\n - /// Sort position of the group (`0` indicates that the backend doesn't - /// support sorting of groups). - void SetPosition(unsigned int position) { m_cStructure->iPosition = position; } - - /// @brief To get with @ref SetPosition changed values. - unsigned int GetPosition() const { return m_cStructure->iPosition; } - - ///@} - -private: - PVRChannelGroup(const PVR_CHANNEL_GROUP* channel) : CStructHdl(channel) {} - PVRChannelGroup(PVR_CHANNEL_GROUP* channel) : CStructHdl(channel) {} -}; -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupsResultSet class PVRChannelGroupsResultSet -/// @ingroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroup -/// @brief **PVR add-on channel group member transfer class**\n -/// To transfer the content of @ref kodi::addon::CInstancePVRClient::GetChannelGroups(). -/// -///@{ -class PVRChannelGroupsResultSet -{ -public: - /*! \cond PRIVATE */ - PVRChannelGroupsResultSet() = delete; - PVRChannelGroupsResultSet(const AddonInstance_PVR* instance, ADDON_HANDLE handle) - : m_instance(instance), m_handle(handle) - { - } - /*! \endcond */ - - - /// @addtogroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupsResultSet - ///@{ - - /// @brief To add and give content from addon to Kodi on related call. - /// - /// @param[in] tag The to transferred data. - void Add(const kodi::addon::PVRChannelGroup& tag) - { - m_instance->toKodi->TransferChannelGroup(m_instance->toKodi->kodiInstance, m_handle, tag); - } - - ///@} - -private: - const AddonInstance_PVR* m_instance = nullptr; - const ADDON_HANDLE m_handle; -}; -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMember class PVRChannelGroupMember -/// @ingroup cpp_kodi_addon_pvr_Defs_ChannelGroup -/// @brief **PVR add-on channel group member**\n -/// To define the content of @ref kodi::addon::CInstancePVRClient::GetChannelGroups() -/// given groups. -/// -/// This content becomes then requested with @ref kodi::addon::CInstancePVRClient::GetChannelGroupMembers(). -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMember_Help -/// -///@{ -class PVRChannelGroupMember : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVRChannelGroupMember() { memset(m_cStructure, 0, sizeof(PVR_CHANNEL_GROUP_MEMBER)); } - PVRChannelGroupMember(const PVRChannelGroupMember& channel) : CStructHdl(channel) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMember_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMember - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMember : - /// | Name | Type | Set call | Get call | Usage - /// |-------|-------|-----------|----------|----------- - /// | **Group name** | `std::string` | @ref PVRChannelGroupMember::SetGroupName "SetGroupName" | @ref PVRChannelGroupMember::GetGroupName "GetGroupName" | *required to set* - /// | **Channel unique id** | `unsigned int` | @ref PVRChannelGroupMember::SetChannelUniqueId "SetChannelUniqueId" | @ref PVRChannelGroupMember::GetChannelUniqueId "GetChannelUniqueId" | *required to set* - /// | **Channel Number** | `unsigned int` | @ref PVRChannelGroupMember::SetChannelNumber "SetChannelNumber" | @ref PVRChannelGroupMember::GetChannelNumber "GetChannelNumber" | *optional* - /// | **Sub channel number** | `unsigned int` | @ref PVRChannelGroupMember::SetSubChannelNumber "SetSubChannelNumber"| @ref PVRChannelGroupMember::GetSubChannelNumber "GetSubChannelNumber" | *optional* - /// | **Order** | `int` | @ref PVRChannel::SetOrder "SetOrder" | @ref PVRChannel::GetOrder "GetOrder" | *optional* - /// - - /// @addtogroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMember - ///@{ - - /// @brief **required**\n - /// Name of the channel group to add the channel to. - void SetGroupName(const std::string& groupName) - { - strncpy(m_cStructure->strGroupName, groupName.c_str(), sizeof(m_cStructure->strGroupName) - 1); - } - - /// @brief To get with @ref SetGroupName changed values. - std::string GetGroupName() const { return m_cStructure->strGroupName; } - - /// @brief **required**\n - /// Unique id of the member. - void SetChannelUniqueId(unsigned int channelUniqueId) - { - m_cStructure->iChannelUniqueId = channelUniqueId; - } - - /// @brief To get with @ref SetChannelUniqueId changed values. - unsigned int GetChannelUniqueId() const { return m_cStructure->iChannelUniqueId; } - - /// @brief **optional**\n - /// Channel number within the group. - void SetChannelNumber(unsigned int channelNumber) - { - m_cStructure->iChannelNumber = channelNumber; - } - - /// @brief To get with @ref SetChannelNumber changed values. - unsigned int GetChannelNumber() const { return m_cStructure->iChannelNumber; } - - /// @brief **optional**\n - /// Sub channel number within the group (ATSC). - void SetSubChannelNumber(unsigned int subChannelNumber) - { - m_cStructure->iSubChannelNumber = subChannelNumber; - } - - /// @brief To get with @ref SetSubChannelNumber changed values. - unsigned int GetSubChannelNumber() const { return m_cStructure->iSubChannelNumber; } - - /// @brief **optional**\n - /// The value denoting the order of this channel in the 'All channels' group. - void SetOrder(bool order) { m_cStructure->iOrder = order; } - - /// @brief To get with @ref SetOrder changed values. - bool GetOrder() const { return m_cStructure->iOrder; } - - ///@} - -private: - PVRChannelGroupMember(const PVR_CHANNEL_GROUP_MEMBER* channel) : CStructHdl(channel) {} - PVRChannelGroupMember(PVR_CHANNEL_GROUP_MEMBER* channel) : CStructHdl(channel) {} -}; -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMembersResultSet class PVRChannelGroupMembersResultSet -/// @ingroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMember -/// @brief **PVR add-on channel group member transfer class**\n -/// To transfer the content of @ref kodi::addon::CInstancePVRClient::GetChannelGroupMembers(). -/// -///@{ -class PVRChannelGroupMembersResultSet -{ -public: - /*! \cond PRIVATE */ - PVRChannelGroupMembersResultSet() = delete; - PVRChannelGroupMembersResultSet(const AddonInstance_PVR* instance, ADDON_HANDLE handle) - : m_instance(instance), m_handle(handle) - { - } - /*! \endcond */ - - /// @addtogroup cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMembersResultSet - ///@{ - - /// @brief To add and give content from addon to Kodi on related call. - /// - /// @param[in] tag The to transferred data. - void Add(const kodi::addon::PVRChannelGroupMember& tag) - { - m_instance->toKodi->TransferChannelGroupMember(m_instance->toKodi->kodiInstance, m_handle, tag); - } - - ///@} - -private: - const AddonInstance_PVR* m_instance = nullptr; - const ADDON_HANDLE m_handle; -}; -///@} -//------------------------------------------------------------------------------ - -} /* namespace addon */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Channels.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Channels.h deleted file mode 100644 index 9c2f5d2..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Channels.h +++ /dev/null @@ -1,518 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../../c-api/addon-instance/pvr.h" - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" Definitions group 2 - PVR channel -#ifdef __cplusplus - -namespace kodi -{ -namespace addon -{ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_Channel_PVRChannel class PVRChannel -/// @ingroup cpp_kodi_addon_pvr_Defs_Channel -/// @brief **Channel data structure**\n -/// Representation of a TV or radio channel. -/// -/// This is used to store all the necessary TV or radio channel data and can -/// either provide the necessary data from / to Kodi for the associated -/// functions or can also be used in the addon to store its data. -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_Channel_PVRChannel_Help -/// -///@{ -class PVRChannel : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVRChannel() { memset(m_cStructure, 0, sizeof(PVR_CHANNEL)); } - PVRChannel(const PVRChannel& channel) : CStructHdl(channel) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_Channel_PVRChannel_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_Channel_PVRChannel - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_Channel_PVRChannel : - /// | Name | Type | Set call | Get call | Usage - /// |------|------|----------|----------|----------- - /// | **Unique id** | `unsigned int` | @ref PVRChannel::SetUniqueId "SetUniqueId" | @ref PVRChannel::GetUniqueId "GetUniqueId" | *required to set* - /// | **Is radio** | `bool` | @ref PVRChannel::SetIsRadio "SetIsRadio" | @ref PVRChannel::GetIsRadio "GetIsRadio" | *required to set* - /// | **Channel number** | `unsigned int` | @ref PVRChannel::SetChannelNumber "SetChannelNumber" | @ref PVRChannel::GetChannelNumber "GetChannelNumber" | *optional* - /// | **Sub channel number** | `unsigned int` | @ref PVRChannel::SetSubChannelNumber "SetSubChannelNumber" | @ref PVRChannel::GetSubChannelNumber "GetSubChannelNumber" | *optional* - /// | **Channel name** | `std::string` | @ref PVRChannel::SetChannelName "SetChannelName" | @ref PVRChannel::GetChannelName "GetChannelName" | *optional* - /// | **Mime type** | `std::string` | @ref PVRChannel::SetMimeType "SetMimeType" | @ref PVRChannel::GetMimeType "GetMimeType" | *optional* - /// | **Encryption system** | `unsigned int` | @ref PVRChannel::SetEncryptionSystem "SetEncryptionSystem" | @ref PVRChannel::GetEncryptionSystem "GetEncryptionSystem" | *optional* - /// | **Icon path** | `std::string` | @ref PVRChannel::SetIconPath "SetIconPath" | @ref PVRChannel::GetIconPath "GetIconPath" | *optional* - /// | **Is hidden** | `bool` | @ref PVRChannel::SetIsHidden "SetIsHidden" | @ref PVRChannel::GetIsHidden "GetIsHidden" | *optional* - /// | **Has archive** | `bool` | @ref PVRChannel::SetHasArchive "SetHasArchive" | @ref PVRChannel::GetHasArchive "GetHasArchive" | *optional* - /// | **Order** | `int` | @ref PVRChannel::SetOrder "SetOrder" | @ref PVRChannel::GetOrder "GetOrder" | *optional* - /// - - /// @addtogroup cpp_kodi_addon_pvr_Defs_Channel_PVRChannel - ///@{ - - /// @brief **required**\n - /// Unique identifier for this channel. - void SetUniqueId(unsigned int uniqueId) { m_cStructure->iUniqueId = uniqueId; } - - /// @brief To get with @ref SetUniqueId changed values. - unsigned int GetUniqueId() const { return m_cStructure->iUniqueId; } - - /// @brief **required**\n - /// **true** if this is a radio channel, **false** if it's a TV channel. - void SetIsRadio(bool isRadio) { m_cStructure->bIsRadio = isRadio; } - - /// @brief To get with @ref SetIsRadio changed values. - bool GetIsRadio() const { return m_cStructure->bIsRadio; } - - /// @brief **optional**\n - /// Channel number of this channel on the backend. - void SetChannelNumber(unsigned int channelNumber) - { - m_cStructure->iChannelNumber = channelNumber; - } - - /// @brief To get with @ref SetChannelNumber changed values. - unsigned int GetChannelNumber() const { return m_cStructure->iChannelNumber; } - - /// @brief **optional**\n - /// Sub channel number of this channel on the backend (ATSC). - void SetSubChannelNumber(unsigned int subChannelNumber) - { - m_cStructure->iSubChannelNumber = subChannelNumber; - } - - /// @brief To get with @ref SetSubChannelNumber changed values. - unsigned int GetSubChannelNumber() const { return m_cStructure->iSubChannelNumber; } - - /// @brief **optional**\n - /// Channel name given to this channel. - void SetChannelName(const std::string& channelName) - { - strncpy(m_cStructure->strChannelName, channelName.c_str(), - sizeof(m_cStructure->strChannelName) - 1); - } - - /// @brief To get with @ref SetChannelName changed values. - std::string GetChannelName() const { return m_cStructure->strChannelName; } - - /// @brief **optional**\n - /// Input format mime type. - /// - /// Available types can be found in https://www.iana.org/assignments/media-types/media-types.xhtml - /// on "application" and "video" or leave empty if unknown. - /// - void SetMimeType(const std::string& inputFormat) - { - strncpy(m_cStructure->strMimeType, inputFormat.c_str(), sizeof(m_cStructure->strMimeType) - 1); - } - - /// @brief To get with @ref SetMimeType changed values. - std::string GetMimeType() const { return m_cStructure->strMimeType; } - - /// @brief **optional**\n - /// The encryption ID or CaID of this channel (Conditional access systems). - /// - /// Lists about available ID's: - /// - http://www.dvb.org/index.php?id=174 - /// - http://en.wikipedia.org/wiki/Conditional_access_system - /// - void SetEncryptionSystem(unsigned int encryptionSystem) - { - m_cStructure->iEncryptionSystem = encryptionSystem; - } - - /// @brief To get with @ref SetEncryptionSystem changed values. - unsigned int GetEncryptionSystem() const { return m_cStructure->iEncryptionSystem; } - - /// @brief **optional**\n - /// Path to the channel icon (if present). - void SetIconPath(const std::string& iconPath) - { - strncpy(m_cStructure->strIconPath, iconPath.c_str(), sizeof(m_cStructure->strIconPath) - 1); - } - - /// @brief To get with @ref SetIconPath changed values. - std::string GetIconPath() const { return m_cStructure->strIconPath; } - - /// @brief **optional**\n - /// **true** if this channel is marked as hidden. - void SetIsHidden(bool isHidden) { m_cStructure->bIsHidden = isHidden; } - - /// @brief To get with @ref GetIsRadio changed values. - bool GetIsHidden() const { return m_cStructure->bIsHidden; } - - /// @brief **optional**\n - /// **true** if this channel has a server-side back buffer. - void SetHasArchive(bool hasArchive) { m_cStructure->bHasArchive = hasArchive; } - - /// @brief To get with @ref GetIsRadio changed values. - bool GetHasArchive() const { return m_cStructure->bHasArchive; } - - /// @brief **optional**\n - /// The value denoting the order of this channel in the 'All channels' group. - void SetOrder(bool order) { m_cStructure->iOrder = order; } - - /// @brief To get with @ref SetOrder changed values. - bool GetOrder() const { return m_cStructure->iOrder; } - ///@} - -private: - PVRChannel(const PVR_CHANNEL* channel) : CStructHdl(channel) {} - PVRChannel(PVR_CHANNEL* channel) : CStructHdl(channel) {} -}; -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_Channel_PVRChannelsResultSet class PVRChannelsResultSet -/// @ingroup cpp_kodi_addon_pvr_Defs_Channel_PVRChannel -/// @brief **PVR add-on channel transfer class**\n -/// To transfer the content of @ref kodi::addon::CInstancePVRClient::GetChannels(). -/// -///@{ -class PVRChannelsResultSet -{ -public: - /*! \cond PRIVATE */ - PVRChannelsResultSet() = delete; - PVRChannelsResultSet(const AddonInstance_PVR* instance, ADDON_HANDLE handle) - : m_instance(instance), m_handle(handle) - { - } - /*! \endcond */ - - /// @addtogroup cpp_kodi_addon_pvr_Defs_Channel_PVRChannelsResultSet - ///@{ - - /// @brief To add and give content from addon to Kodi on related call. - /// - /// @param[in] tag The to transferred data. - void Add(const kodi::addon::PVRChannel& tag) - { - m_instance->toKodi->TransferChannelEntry(m_instance->toKodi->kodiInstance, m_handle, tag); - } - - ///@} - -private: - const AddonInstance_PVR* m_instance = nullptr; - const ADDON_HANDLE m_handle; -}; -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_Channel_PVRSignalStatus class PVRSignalStatus -/// @ingroup cpp_kodi_addon_pvr_Defs_Channel -/// @brief **PVR Signal status information**\n -/// This class gives current status information from stream to Kodi. -/// -/// Used to get information for user by call of @ref kodi::addon::CInstancePVRClient::GetSignalStatus() -/// to see current quality and source. -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_Channel_PVRSignalStatus_Help -/// -///@{ -class PVRSignalStatus : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVRSignalStatus() = default; - PVRSignalStatus(const PVRSignalStatus& type) : CStructHdl(type) {} - /*! \endcond */ - - - /// @defgroup cpp_kodi_addon_pvr_Defs_Channel_PVRSignalStatus_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_Channel_PVRSignalStatus - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_Channel_PVRSignalStatus : - /// | Name | Type | Set call | Get call | Usage - /// |------|------|----------|----------|----------- - /// | **Adapter name** | `std::string` | @ref PVRSignalStatus::SetAdapterName "SetAdapterName" | @ref PVRSignalStatus::GetAdapterName "GetAdapterName" | *optional* - /// | **Adapter status** | `std::string` | @ref PVRSignalStatus::SetAdapterStatus "SetAdapterStatus" | @ref PVRSignalStatus::GetAdapterStatus "GetAdapterStatus" | *optional* - /// | **Service name** | `std::string` | @ref PVRSignalStatus::SetServiceName "SetServiceName" | @ref PVRSignalStatus::GetServiceName "GetServiceName" | *optional* - /// | **Provider name** | `std::string` | @ref PVRSignalStatus::SetProviderName "SetProviderName" | @ref PVRSignalStatus::GetProviderName "GetProviderName" | *optional* - /// | **Mux name** | `std::string` | @ref PVRSignalStatus::SetMuxName "SetMuxName" | @ref PVRSignalStatus::GetMuxName "GetMuxName" | *optional* - /// | **Signal/noise ratio** | `int` | @ref PVRSignalStatus::SetSNR "SetSNR" | @ref PVRSignalStatus::GetSNR "GetSNR" | *optional* - /// | **Signal strength** | `int` | @ref PVRSignalStatus::SetSignal "SetSignal" | @ref PVRSignalStatus::GetSignal "GetSignal" | *optional* - /// | **Bit error rate** | `long` | @ref PVRSignalStatus::SetBER "SetBER" | @ref PVRSignalStatus::GetBER "GetBER" | *optional* - /// | **Uncorrected blocks** | `long` | @ref PVRSignalStatus::SetUNC "SetUNC" | @ref PVRSignalStatus::GetUNC "GetUNC" | *optional* - /// - - /// @addtogroup cpp_kodi_addon_pvr_Defs_Channel_PVRSignalStatus - ///@{ - - /// @brief **optional**\n - /// Name of the adapter that's being used. - void SetAdapterName(const std::string& adapterName) - { - strncpy(m_cStructure->strAdapterName, adapterName.c_str(), - sizeof(m_cStructure->strAdapterName) - 1); - } - - /// @brief To get with @ref SetAdapterName changed values. - std::string GetAdapterName() const { return m_cStructure->strAdapterName; } - - /// @brief **optional**\n - /// Status of the adapter that's being used. - void SetAdapterStatus(const std::string& adapterStatus) - { - strncpy(m_cStructure->strAdapterStatus, adapterStatus.c_str(), - sizeof(m_cStructure->strAdapterStatus) - 1); - } - - /// @brief To get with @ref SetAdapterStatus changed values. - std::string GetAdapterStatus() const { return m_cStructure->strAdapterStatus; } - - /// @brief **optional**\n - /// Name of the current service. - void SetServiceName(const std::string& serviceName) - { - strncpy(m_cStructure->strServiceName, serviceName.c_str(), - sizeof(m_cStructure->strServiceName) - 1); - } - - /// @brief To get with @ref SetServiceName changed values. - std::string GetServiceName() const { return m_cStructure->strServiceName; } - - /// @brief **optional**\n - /// Name of the current service's provider. - void SetProviderName(const std::string& providerName) - { - strncpy(m_cStructure->strProviderName, providerName.c_str(), - sizeof(m_cStructure->strProviderName) - 1); - } - - /// @brief To get with @ref SetProviderName changed values. - std::string GetProviderName() const { return m_cStructure->strProviderName; } - - /// @brief **optional**\n - /// Name of the current mux. - void SetMuxName(const std::string& muxName) - { - strncpy(m_cStructure->strMuxName, muxName.c_str(), sizeof(m_cStructure->strMuxName) - 1); - } - - /// @brief To get with @ref SetMuxName changed values. - std::string GetMuxName() const { return m_cStructure->strMuxName; } - - /// @brief **optional**\n - /// Signal/noise ratio. - /// - /// @note 100% is 0xFFFF 65535 - void SetSNR(int snr) { m_cStructure->iSNR = snr; } - - /// @brief To get with @ref SetSNR changed values. - int GetSNR() const { return m_cStructure->iSNR; } - - /// @brief **optional**\n - /// Signal strength. - /// - /// @note 100% is 0xFFFF 65535 - void SetSignal(int signal) { m_cStructure->iSignal = signal; } - - /// @brief To get with @ref SetSignal changed values. - int GetSignal() const { return m_cStructure->iSignal; } - - /// @brief **optional**\n - /// Bit error rate. - void SetBER(long ber) { m_cStructure->iBER = ber; } - - /// @brief To get with @ref SetBER changed values. - long GetBER() const { return m_cStructure->iBER; } - - /// @brief **optional**\n - /// Uncorrected blocks: - void SetUNC(long unc) { m_cStructure->iUNC = unc; } - - /// @brief To get with @ref SetBER changed values. - long GetUNC() const { return m_cStructure->iUNC; } - ///@} - -private: - PVRSignalStatus(const PVR_SIGNAL_STATUS* type) : CStructHdl(type) {} - PVRSignalStatus(PVR_SIGNAL_STATUS* type) : CStructHdl(type) {} -}; -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_Channel_PVRDescrambleInfo class PVRDescrambleInfo -/// @ingroup cpp_kodi_addon_pvr_Defs_Channel -/// @brief **Data structure for descrample info**\n -/// Information data to give via this to Kodi. -/// -/// As description see also here https://en.wikipedia.org/wiki/Conditional_access. -/// -/// Used on @ref kodi::addon::CInstancePVRClient::GetDescrambleInfo(). -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_Channel_PVRDescrambleInfo_Help -/// -///@{ -class PVRDescrambleInfo : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVRDescrambleInfo() - { - m_cStructure->iPid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE; - m_cStructure->iCaid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE; - m_cStructure->iProvid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE; - m_cStructure->iEcmTime = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE; - m_cStructure->iHops = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE; - } - PVRDescrambleInfo(const PVRDescrambleInfo& type) : CStructHdl(type) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_Channel_PVRDescrambleInfo_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_Channel_PVRDescrambleInfo - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_Channel_PVRDescrambleInfo : - /// | Name | Type | Set call | Get call | Usage - /// |------|------|----------|----------|----------- - /// | **Packet identifier** | `int` | @ref PVRDescrambleInfo::SetPID "SetPID" | @ref PVRDescrambleInfo::GetPID "GetPID" | *optional* - /// | **Conditional access identifier** | `int` | @ref PVRDescrambleInfo::SetCAID "SetCAID" | @ref PVRDescrambleInfo::GetCAID "GetCAID" | *optional* - /// | **Provider-ID** | `int` | @ref PVRDescrambleInfo::SetProviderID "SetProviderID" | @ref PVRDescrambleInfo::GetProviderID "GetProviderID" | *optional* - /// | **ECM time** | `int` | @ref PVRDescrambleInfo::SetECMTime "SetECMTime" | @ref PVRDescrambleInfo::GetECMTime "GetECMTime" | *optional* - /// | **Hops** | `int` | @ref PVRDescrambleInfo::SetHops "SetHops" | @ref PVRDescrambleInfo::GetHops "GetHops" | *optional* - /// | **Descramble card system** | `std::string` | @ref PVRDescrambleInfo::SetHops "SetHops" | @ref PVRDescrambleInfo::GetHops "GetHops" | *optional* - /// | **Reader** | `std::string` | @ref PVRDescrambleInfo::SetReader "SetReader" | @ref PVRDescrambleInfo::GetReader "GetReader" | *optional* - /// | **From** | `std::string` | @ref PVRDescrambleInfo::SetFrom "SetFrom" | @ref PVRDescrambleInfo::GetFrom "GetFrom" | *optional* - /// | **Protocol** | `std::string` | @ref PVRDescrambleInfo::SetProtocol "SetProtocol" | @ref PVRDescrambleInfo::GetProtocol "GetProtocol" | *optional* - /// - - /// @addtogroup cpp_kodi_addon_pvr_Defs_Channel_PVRDescrambleInfo - ///@{ - - /// @brief **optional**\n - /// Packet identifier. - /// - /// Each table or elementary stream in a transport stream is identified by - /// a 13-bit packet identifier (PID). - /// - /// Is @ref PVR_DESCRAMBLE_INFO_NOT_AVAILABLE as default, if not available - void SetPID(int pid) { m_cStructure->iPid = pid; } - - /// @brief To get with @ref SetPID changed values - int GetPID() const { return m_cStructure->iPid; } - - /// @brief **optional**\n - /// Conditional access identifier. - /// - /// Conditional access (abbreviated CA) or conditional access system (abbreviated CAS) - /// is the protection of content by requiring certain criteria to be met before granting - /// access to the content. - /// - /// Available CA system ID's listed here https://www.dvbservices.com/identifiers/ca_system_id. - /// - /// @ref PVR_DESCRAMBLE_INFO_NOT_AVAILABLE if not available. - void SetCAID(int iCaid) { m_cStructure->iCaid = iCaid; } - - /// @brief To get with @ref SetCAID changed values. - int GetCAID() const { return m_cStructure->iCaid; } - - /// @brief **optional**\n - /// Provider-ID. - /// - /// Is @ref PVR_DESCRAMBLE_INFO_NOT_AVAILABLE as default, if not available. - void SetProviderID(int provid) { m_cStructure->iProvid = provid; } - - /// @brief To get with @ref SetProviderID changed values - int GetProviderID() const { return m_cStructure->iProvid; } - - /// @brief **optional**\n - /// ECM time. - /// - /// Is @ref PVR_DESCRAMBLE_INFO_NOT_AVAILABLE as default, if not available. - void SetECMTime(int ecmTime) { m_cStructure->iEcmTime = ecmTime; } - - /// @brief To get with @ref SetECMTime changed values. - int GetECMTime() const { return m_cStructure->iEcmTime; } - - /// @brief **optional**\n - /// Hops. - /// - /// Is @ref PVR_DESCRAMBLE_INFO_NOT_AVAILABLE as default, if not available. - void SetHops(int hops) { m_cStructure->iHops = hops; } - - /// @brief To get with @ref SetHops changed values. - int GetHops() const { return m_cStructure->iHops; } - - /// @brief **optional**\n - /// Empty string if not available. - void SetCardSystem(const std::string& cardSystem) - { - strncpy(m_cStructure->strCardSystem, cardSystem.c_str(), - sizeof(m_cStructure->strCardSystem) - 1); - } - - /// @brief To get with @ref SetCardSystem changed values. - std::string GetCardSystem() const { return m_cStructure->strCardSystem; } - - /// @brief **optional**\n - /// Empty string if not available. - void SetReader(const std::string& reader) - { - strncpy(m_cStructure->strReader, reader.c_str(), sizeof(m_cStructure->strReader) - 1); - } - - /// @brief To get with @ref SetReader changed values. - std::string GetReader() const { return m_cStructure->strReader; } - - /// @brief **optional**\n - /// Empty string if not available. - void SetFrom(const std::string& from) - { - strncpy(m_cStructure->strFrom, from.c_str(), sizeof(m_cStructure->strFrom) - 1); - } - - /// @brief To get with @ref SetFrom changed values. - std::string GetFrom() const { return m_cStructure->strFrom; } - - /// @brief **optional**\n - /// Empty string if not available. - void SetProtocol(const std::string& protocol) - { - strncpy(m_cStructure->strProtocol, protocol.c_str(), sizeof(m_cStructure->strProtocol) - 1); - } - - /// @brief To get with @ref SetProtocol changed values. - std::string GetProtocol() const { return m_cStructure->strProtocol; } - ///@} - -private: - PVRDescrambleInfo(const PVR_DESCRAMBLE_INFO* type) : CStructHdl(type) {} - PVRDescrambleInfo(PVR_DESCRAMBLE_INFO* type) : CStructHdl(type) {} -}; -///@} -//------------------------------------------------------------------------------ - -} /* namespace addon */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/EDL.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/EDL.h deleted file mode 100644 index 34c7c41..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/EDL.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../../c-api/addon-instance/pvr/pvr_edl.h" - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" Definitions group 8 - PVR Edit definition list (EDL) -#ifdef __cplusplus - -namespace kodi -{ -namespace addon -{ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_EDLEntry_PVREDLEntry class PVREDLEntry -/// @ingroup cpp_kodi_addon_pvr_Defs_EDLEntry -/// @brief **Edit definition list (EDL) entry**\n -/// Time places and type of related fields. -/// -/// This used within @ref cpp_kodi_addon_pvr_EPGTag "EPG" and -/// @ref cpp_kodi_addon_pvr_Recordings "recordings". -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_EDLEntry_PVREDLEntry_Help -/// -///@{ -class PVREDLEntry : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVREDLEntry() { memset(m_cStructure, 0, sizeof(PVR_EDL_ENTRY)); } - PVREDLEntry(const PVREDLEntry& type) : CStructHdl(type) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_EDLEntry_PVREDLEntry_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_EDLEntry_PVREDLEntry - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_EDLEntry_PVREDLEntry : - /// | Name | Type | Set call | Get call | Usage - /// |------|------|----------|----------|----------- - /// | **Start time** | `int64_t` | @ref PVREDLEntry::SetStart "SetStart" | @ref PVREDLEntry::GetStart "GetStart" | *required to set* - /// | **End time** | `int64_t` | @ref PVREDLEntry::SetEnd "SetEnd" | @ref PVREDLEntry::GetEnd "GetEnd" | *required to set* - /// | **Type** | @ref PVR_EDL_TYPE | @ref PVREDLEntry::SetType "SetType" | @ref PVREDLEntry::GetType "GetType" | *required to set* - /// - - /// @addtogroup cpp_kodi_addon_pvr_Defs_EDLEntry_PVREDLEntry - ///@{ - - /// @brief Start time in milliseconds. - void SetStart(int64_t start) { m_cStructure->start = start; } - - /// @brief To get with @ref SetStart() changed values. - int64_t GetStart() const { return m_cStructure->start; } - - /// @brief End time in milliseconds. - void SetEnd(int64_t end) { m_cStructure->end = end; } - - /// @brief To get with @ref SetEnd() changed values. - int64_t GetEnd() const { return m_cStructure->end; } - - /// @brief The with @ref PVR_EDL_TYPE used definition list type. - void SetType(PVR_EDL_TYPE type) { m_cStructure->type = type; } - - /// @brief To get with @ref SetType() changed values. - PVR_EDL_TYPE GetType() const { return m_cStructure->type; } - ///@} - -private: - PVREDLEntry(const PVR_EDL_ENTRY* type) : CStructHdl(type) {} - PVREDLEntry(PVR_EDL_ENTRY* type) : CStructHdl(type) {} -}; -///@} -//------------------------------------------------------------------------------ - -} /* namespace addon */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/EPG.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/EPG.h deleted file mode 100644 index e1fc04f..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/EPG.h +++ /dev/null @@ -1,500 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../../c-api/addon-instance/pvr.h" - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" Definitions group 4 - PVR EPG -#ifdef __cplusplus - -namespace kodi -{ -namespace addon -{ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_epg_PVREPGTag class PVREPGTag -/// @ingroup cpp_kodi_addon_pvr_Defs_epg -/// @brief **PVR add-on EPG data tag**\n -/// Representation of an EPG event. -/// -/// Herewith all EPG related data are saved in one class whereby the data can -/// be exchanged with Kodi, or can also be used on the addon to save there. -/// -/// See @ref cpp_kodi_addon_pvr_EPGTag "EPG methods" about usage. -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_epg_PVREPGTag_Help -/// -///@{ -class PVREPGTag : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVREPGTag() - { - memset(m_cStructure, 0, sizeof(EPG_TAG)); - m_cStructure->iSeriesNumber = EPG_TAG_INVALID_SERIES_EPISODE; - m_cStructure->iEpisodeNumber = EPG_TAG_INVALID_SERIES_EPISODE; - m_cStructure->iEpisodePartNumber = EPG_TAG_INVALID_SERIES_EPISODE; - } - PVREPGTag(const PVREPGTag& epg) : CStructHdl(epg) - { - m_title = epg.m_title; - m_plotOutline = epg.m_plotOutline; - m_plot = epg.m_plot; - m_originalTitle = epg.m_originalTitle; - m_cast = epg.m_cast; - m_director = epg.m_director; - m_writer = epg.m_writer; - m_IMDBNumber = epg.m_IMDBNumber; - m_iconPath = epg.m_iconPath; - m_genreDescription = epg.m_genreDescription; - m_episodeName = epg.m_episodeName; - m_seriesLink = epg.m_seriesLink; - m_firstAired = epg.m_firstAired; - } - /*! \endcond */ - - - /// @defgroup cpp_kodi_addon_pvr_Defs_epg_PVREPGTag_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_epg_PVREPGTag - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag : - /// | Name | Type | Set call | Get call | Usage - /// |------|------|----------|----------|--------- - /// | **Unique broadcast id** | `unsigned int` | @ref PVREPGTag::SetUniqueBroadcastId "SetUniqueBroadcastId" | @ref PVREPGTag::GetUniqueBroadcastId "GetUniqueBroadcastId" | *required to set* - /// | **Unique channel id** | `unsigned int` | @ref PVREPGTag::SetUniqueChannelId "SetUniqueChannelId" | @ref PVREPGTag::GetUniqueChannelId "GetUniqueChannelId" | *required to set* - /// | **Title** | `std::string` | @ref PVREPGTag::SetTitle "SetTitle" | @ref PVREPGTag::GetTitle "GetTitle" | *required to set* - /// | **Start time** | `time_t` | @ref PVREPGTag::SetStartTime "SetStartTime" | @ref PVREPGTag::GetStartTime "GetStartTime" | *required to set* - /// | **End time** | `time_t` | @ref PVREPGTag::SetEndTime "SetEndTime" | @ref PVREPGTag::GetEndTime "GetEndTime" | *required to set* - /// | **Plot outline** | `std::string` | @ref PVREPGTag::SetPlotOutline "SetPlotOutline" | @ref PVREPGTag::GetPlotOutline "GetPlotOutline" | *optional* - /// | **Plot** | `std::string` | @ref PVREPGTag::SetPlot "SetPlot" | @ref PVREPGTag::GetPlot "GetPlot" | *optional* - /// | **Original title** | `std::string` | @ref PVREPGTag::SetOriginalTitle "SetOriginalTitle" | @ref PVREPGTag::GetOriginalTitle "GetOriginalTitle" | *optional* - /// | **Cast** | `std::string` | @ref PVREPGTag::SetCast "SetCast" | @ref PVREPGTag::GetCast "GetCast" | *optional* - /// | **Director** | `std::string` | @ref PVREPGTag::SetDirector "SetDirector" | @ref PVREPGTag::GetDirector "GetDirector" | *optional* - /// | **Writer** | `std::string` | @ref PVREPGTag::SetWriter "SetWriter" | @ref PVREPGTag::GetWriter "GetWriter" | *optional* - /// | **Year** | `int` | @ref PVREPGTag::SetYear "SetYear" | @ref PVREPGTag::GetYear "GetYear" | *optional* - /// | **IMDB number** | `std::string` | @ref PVREPGTag::SetIMDBNumber "SetIMDBNumber" | @ref PVREPGTag::GetIMDBNumber "GetIMDBNumber" | *optional* - /// | **Icon path** | `std::string` | @ref PVREPGTag::SetIconPath "SetIconPath" | @ref PVREPGTag::GetIconPath "GetIconPath" | *optional* - /// | **Genre type** | `int` | @ref PVREPGTag::SetGenreType "SetGenreType" | @ref PVREPGTag::GetGenreType "GetGenreType" | *optional* - /// | **Genre sub type** | `int` | @ref PVREPGTag::SetGenreSubType "SetGenreSubType" | @ref PVREPGTag::GetGenreSubType "GetGenreSubType" | *optional* - /// | **Genre description** | `std::string` | @ref PVREPGTag::SetGenreDescription "SetGenreDescription" | @ref PVREPGTag::GetGenreDescription "GetGenreDescription" | *optional* - /// | **First aired** | `time_t` | @ref PVREPGTag::SetFirstAired "SetFirstAired" | @ref PVREPGTag::GetFirstAired "GetFirstAired" | *optional* - /// | **Parental rating** | `int` | @ref PVREPGTag::SetParentalRating "SetParentalRating" | @ref PVREPGTag::GetParentalRating "GetParentalRating" | *optional* - /// | **Star rating** | `int` | @ref PVREPGTag::SetStarRating "SetStarRating" | @ref PVREPGTag::GetStarRating "GetStarRating" | *optional* - /// | **Series number** | `int` | @ref PVREPGTag::SetSeriesNumber "SetSeriesNumber" | @ref PVREPGTag::GetSeriesNumber "GetSeriesNumber" | *optional* - /// | **Episode number** | `int` | @ref PVREPGTag::SetEpisodeNumber "SetEpisodeNumber" | @ref PVREPGTag::GetEpisodeNumber "GetEpisodeNumber" | *optional* - /// | **Episode part number** | `int` | @ref PVREPGTag::SetEpisodePartNumber "SetEpisodePartNumber" | @ref PVREPGTag::GetEpisodePartNumber "GetEpisodePartNumber" | *optional* - /// | **Episode name** | `std::string` | @ref PVREPGTag::SetEpisodeName "SetEpisodeName" | @ref PVREPGTag::GetEpisodeName "GetEpisodeName" | *optional* - /// | **Flags** | `unsigned int` | @ref PVREPGTag::SetFlags "SetFlags" | @ref PVREPGTag::GetFlags "GetFlags" | *optional* - /// | **Series link** | `std::string` | @ref PVREPGTag::SetSeriesLink "SetSeriesLink" | @ref PVREPGTag::GetSeriesLink "GetSeriesLink" | *optional* - /// - - /// @addtogroup cpp_kodi_addon_pvr_Defs_epg_PVREPGTag - ///@{ - - /// @brief **required**\n - /// Identifier for this event. Event uids must be unique for a channel. Valid uids must be greater than @ref EPG_TAG_INVALID_UID. - void SetUniqueBroadcastId(unsigned int uniqueBroadcastId) - { - m_cStructure->iUniqueBroadcastId = uniqueBroadcastId; - } - - /// @brief To get with @ref SetUniqueBroadcastId changed values. - unsigned int GetUniqueBroadcastId() const { return m_cStructure->iUniqueBroadcastId; } - - /// @brief **required**\n - /// Unique identifier of the channel this event belongs to. - void SetUniqueChannelId(unsigned int uniqueChannelId) - { - m_cStructure->iUniqueChannelId = uniqueChannelId; - } - - /// @brief To get with @ref SetUniqueChannelId changed values - unsigned int GetUniqueChannelId() const { return m_cStructure->iUniqueChannelId; } - - /// @brief **required**\n - /// This event's title. - void SetTitle(const std::string& title) { m_title = title; } - - /// @brief To get with @ref SetTitle changed values. - std::string GetTitle() const { return m_title; } - - /// @brief **required**\n - /// Start time in UTC. - /// - /// Seconds elapsed since 00:00 hours, Jan 1, 1970 UTC. - void SetStartTime(time_t startTime) { m_cStructure->startTime = startTime; } - - /// @brief To get with @ref SetStartTime changed values. - time_t GetStartTime() const { return m_cStructure->startTime; } - - /// @brief **required**\n - /// End time in UTC. - /// - /// Seconds elapsed since 00:00 hours, Jan 1, 1970 UTC. - void SetEndTime(time_t endTime) { m_cStructure->endTime = endTime; } - - /// @brief To get with @ref SetEndTime changed values. - time_t GetEndTime() const { return m_cStructure->endTime; } - - /// @brief **optional**\n - /// Plot outline name. - void SetPlotOutline(const std::string& plotOutline) { m_plotOutline = plotOutline; } - - /// @brief To get with @ref SetPlotOutline changed values. - std::string GetPlotOutline() const { return m_plotOutline; } - - /// @brief **optional**\n - /// Plot name. - void SetPlot(const std::string& plot) { m_plot = plot; } - - /// @brief To get with @ref GetPlot changed values. - std::string GetPlot() const { return m_plot; } - - /// @brief **optional**\n - /// Original title. - void SetOriginalTitle(const std::string& originalTitle) { m_originalTitle = originalTitle; } - - /// @brief To get with @ref SetOriginalTitle changed values - std::string GetOriginalTitle() const { return m_originalTitle; } - - /// @brief **optional**\n - /// Cast name(s). - /// - /// @note Use @ref EPG_STRING_TOKEN_SEPARATOR to separate different persons. - void SetCast(const std::string& cast) { m_cast = cast; } - - /// @brief To get with @ref SetCast changed values - std::string GetCast() const { return m_cast; } - - /// @brief **optional**\n - /// Director name(s). - /// - /// @note Use @ref EPG_STRING_TOKEN_SEPARATOR to separate different persons. - void SetDirector(const std::string& director) { m_director = director; } - - /// @brief To get with @ref SetDirector changed values. - std::string GetDirector() const { return m_director; } - - /// @brief **optional**\n - /// Writer name(s). - /// - /// @note Use @ref EPG_STRING_TOKEN_SEPARATOR to separate different persons. - void SetWriter(const std::string& writer) { m_writer = writer; } - - /// @brief To get with @ref SetDirector changed values - std::string GetWriter() const { return m_writer; } - - /// @brief **optional**\n - /// Year. - void SetYear(int year) { m_cStructure->iYear = year; } - - /// @brief To get with @ref SetYear changed values. - int GetYear() const { return m_cStructure->iYear; } - - /// @brief **optional**\n - /// [IMDB](https://en.wikipedia.org/wiki/IMDb) identification number. - void SetIMDBNumber(const std::string& IMDBNumber) { m_IMDBNumber = IMDBNumber; } - - /// @brief To get with @ref SetIMDBNumber changed values. - std::string GetIMDBNumber() const { return m_IMDBNumber; } - - /// @brief **optional**\n - /// Icon path. - void SetIconPath(const std::string& iconPath) { m_iconPath = iconPath; } - - /// @brief To get with @ref SetIconPath changed values. - std::string GetIconPath() const { return m_iconPath; } - - /// @brief **optional**\n - /// Genre type. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails EPG_EVENT_CONTENTMASK - /// - /// Use @ref EPG_GENRE_USE_STRING if type becomes given by @ref SetGenreDescription. - /// - /// @note If confirmed that backend brings the types in [ETSI EN 300 468](https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.14.01_60/en_300468v011401p.pdf) - /// conform values, can be @ref EPG_EVENT_CONTENTMASK ignored and to set here - /// with backend value. - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Example 1:** - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVREPGTag tag; - /// tag.SetGenreType(EPG_EVENT_CONTENTMASK_MOVIEDRAMA); - /// ~~~~~~~~~~~~~ - /// - /// -------------------------------------------------------------------------- - /// - /// **Example 2** (in case of other, not ETSI EN 300 468 conform genre types): - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVREPGTag tag; - /// tag.SetGenreType(EPG_GENRE_USE_STRING); - /// tag.SetGenreDescription("My special genre name"); // Should use (if possible) kodi::GetLocalizedString(...) to have match user language. - /// ~~~~~~~~~~~~~ - /// - void SetGenreType(int genreType) { m_cStructure->iGenreType = genreType; } - - /// @brief To get with @ref SetGenreType changed values - int GetGenreType() const { return m_cStructure->iGenreType; } - - /// @brief **optional**\n - /// Genre sub type. - /// - /// @copydetails EPG_EVENT_CONTENTMASK - /// - /// Subtypes groups related to set by @ref SetGenreType: - /// | Main genre type | List with available sub genre types - /// |-----------------|----------------------------------------- - /// | @ref EPG_EVENT_CONTENTMASK_UNDEFINED | Nothing, should be 0 - /// | @ref EPG_EVENT_CONTENTMASK_MOVIEDRAMA | @ref EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA - /// | @ref EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS | @ref EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS - /// | @ref EPG_EVENT_CONTENTMASK_SHOW | @ref EPG_EVENT_CONTENTSUBMASK_SHOW - /// | @ref EPG_EVENT_CONTENTMASK_SPORTS | @ref EPG_EVENT_CONTENTSUBMASK_SPORTS - /// | @ref EPG_EVENT_CONTENTMASK_CHILDRENYOUTH | @ref EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH - /// | @ref EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE | @ref EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE - /// | @ref EPG_EVENT_CONTENTMASK_ARTSCULTURE | @ref EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE - /// | @ref EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS | @ref EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS - /// | @ref EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE | @ref EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE - /// | @ref EPG_EVENT_CONTENTMASK_LEISUREHOBBIES | @ref EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES - /// | @ref EPG_EVENT_CONTENTMASK_SPECIAL | @ref EPG_EVENT_CONTENTSUBMASK_SPECIAL - /// | @ref EPG_EVENT_CONTENTMASK_USERDEFINED | Can be defined by you - /// | @ref EPG_GENRE_USE_STRING | **Kodi's own value**, which declares that the type with @ref SetGenreDescription is given. - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVREPGTag tag; - /// tag.SetGenreType(EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE); - /// tag.SetGenreSubType(EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE_JAZZ); - /// ~~~~~~~~~~~~~ - /// - void SetGenreSubType(int genreSubType) { m_cStructure->iGenreSubType = genreSubType; } - - /// @brief To get with @ref SetGenreSubType changed values. - int GetGenreSubType() const { return m_cStructure->iGenreSubType; } - - /// @brief **optional**\n genre. Will be used only when genreType == @ref EPG_GENRE_USE_STRING - /// or genreSubType == @ref EPG_GENRE_USE_STRING. - /// - /// Use @ref EPG_STRING_TOKEN_SEPARATOR to separate different genres. - /// - /// In case of other, not [ETSI EN 300 468](https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.14.01_60/en_300468v011401p.pdf) - /// conform genre types or something special. - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVREPGTag tag; - /// tag.SetGenreType(EPG_GENRE_USE_STRING); - /// tag.SetGenreDescription("Action" + EPG_STRING_TOKEN_SEPARATOR + "Thriller"); - /// ~~~~~~~~~~~~~ - /// - void SetGenreDescription(const std::string& genreDescription) - { - m_genreDescription = genreDescription; - } - - /// @brief To get with @ref SetGenreDescription changed values. - std::string GetGenreDescription() const { return m_genreDescription; } - - /// @brief **optional**\n - /// First aired in UTC. - void SetFirstAired(const std::string& firstAired) { m_firstAired = firstAired; } - - /// @brief To get with @ref SetFirstAired changed values. - std::string GetFirstAired() const { return m_firstAired; } - - /// @brief **optional**\n - /// Parental rating. - void SetParentalRating(int parentalRating) { m_cStructure->iParentalRating = parentalRating; } - - /// @brief To get with @ref SetParentalRatinge changed values. - int GetParentalRating() const { return m_cStructure->iParentalRating; } - - /// @brief **optional**\n - /// Star rating. - void SetStarRating(int starRating) { m_cStructure->iStarRating = starRating; } - - /// @brief To get with @ref SetStarRating changed values. - int GetStarRating() const { return m_cStructure->iStarRating; } - - /// @brief **optional**\n - /// Series number. - void SetSeriesNumber(int seriesNumber) { m_cStructure->iSeriesNumber = seriesNumber; } - - /// @brief To get with @ref SetSeriesNumber changed values. - int GetSeriesNumber() const { return m_cStructure->iSeriesNumber; } - - /// @brief **optional**\n - /// Episode number. - void SetEpisodeNumber(int episodeNumber) { m_cStructure->iEpisodeNumber = episodeNumber; } - - /// @brief To get with @ref SetEpisodeNumber changed values. - int GetEpisodeNumber() const { return m_cStructure->iEpisodeNumber; } - - /// @brief **optional**\n - /// Episode part number. - void SetEpisodePartNumber(int episodePartNumber) - { - m_cStructure->iEpisodePartNumber = episodePartNumber; - } - - /// @brief To get with @ref SetEpisodePartNumber changed values. - int GetEpisodePartNumber() const { return m_cStructure->iEpisodePartNumber; } - - /// @brief **optional**\n - /// Episode name. - void SetEpisodeName(const std::string& episodeName) { m_episodeName = episodeName; } - - /// @brief To get with @ref SetEpisodeName changed values. - std::string GetEpisodeName() const { return m_episodeName; } - - /// @brief **optional**\n - /// Bit field of independent flags associated with the EPG entry. - /// - /// See @ref cpp_kodi_addon_pvr_Defs_epg_EPG_TAG_FLAG for available bit flags. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_epg_EPG_TAG_FLAG - /// - void SetFlags(unsigned int flags) { m_cStructure->iFlags = flags; } - - /// @brief To get with @ref SetFlags changed values. - unsigned int GetFlags() const { return m_cStructure->iFlags; } - - /// @brief **optional**\n - /// Series link for this event. - void SetSeriesLink(const std::string& seriesLink) { m_seriesLink = seriesLink; } - - /// @brief To get with @ref SetSeriesLink changed values. - std::string GetSeriesLink() const { return m_seriesLink; } - - ///@} - - // Internal used, as this have own memory for strings and to translate them to "C" - EPG_TAG* GetTag() const - { - m_cStructure->strTitle = m_title.c_str(); - m_cStructure->strPlotOutline = m_plotOutline.c_str(); - m_cStructure->strPlot = m_plot.c_str(); - m_cStructure->strOriginalTitle = m_originalTitle.c_str(); - m_cStructure->strCast = m_cast.c_str(); - m_cStructure->strDirector = m_director.c_str(); - m_cStructure->strWriter = m_writer.c_str(); - m_cStructure->strIMDBNumber = m_IMDBNumber.c_str(); - m_cStructure->strIconPath = m_iconPath.c_str(); - m_cStructure->strGenreDescription = m_genreDescription.c_str(); - m_cStructure->strEpisodeName = m_episodeName.c_str(); - m_cStructure->strSeriesLink = m_seriesLink.c_str(); - m_cStructure->strFirstAired = m_firstAired.c_str(); - - return m_cStructure; - } - -private: - PVREPGTag(const EPG_TAG* epg) : CStructHdl(epg) { SetData(epg); } - PVREPGTag(EPG_TAG* epg) : CStructHdl(epg) { SetData(epg); } - - const PVREPGTag& operator=(const PVREPGTag& right); - const PVREPGTag& operator=(const EPG_TAG& right); - operator EPG_TAG*(); - - std::string m_title; - std::string m_plotOutline; - std::string m_plot; - std::string m_originalTitle; - std::string m_cast; - std::string m_director; - std::string m_writer; - std::string m_IMDBNumber; - std::string m_episodeName; - std::string m_iconPath; - std::string m_seriesLink; - std::string m_genreDescription; - std::string m_firstAired; - - void SetData(const EPG_TAG* tag) - { - m_title = tag->strTitle == nullptr ? "" : tag->strTitle; - m_plotOutline = tag->strPlotOutline == nullptr ? "" : tag->strPlotOutline; - m_plot = tag->strPlot == nullptr ? "" : tag->strPlot; - m_originalTitle = tag->strOriginalTitle == nullptr ? "" : tag->strOriginalTitle; - m_cast = tag->strCast == nullptr ? "" : tag->strCast; - m_director = tag->strDirector == nullptr ? "" : tag->strDirector; - m_writer = tag->strWriter == nullptr ? "" : tag->strWriter; - m_IMDBNumber = tag->strIMDBNumber == nullptr ? "" : tag->strIMDBNumber; - m_iconPath = tag->strIconPath == nullptr ? "" : tag->strIconPath; - m_genreDescription = tag->strGenreDescription == nullptr ? "" : tag->strGenreDescription; - m_episodeName = tag->strEpisodeName == nullptr ? "" : tag->strEpisodeName; - m_seriesLink = tag->strSeriesLink == nullptr ? "" : tag->strSeriesLink; - m_firstAired = tag->strFirstAired == nullptr ? "" : tag->strFirstAired; - } -}; -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_epg_PVREPGTagsResultSet class PVREPGTagsResultSet -/// @ingroup cpp_kodi_addon_pvr_Defs_epg_PVREPGTag -/// @brief **PVR add-on EPG entry transfer class**\n -/// To transfer the content of @ref kodi::addon::CInstancePVRClient::GetEPGForChannel(). -/// -/// @note This becomes only be used on addon call above, not usable outside on -/// addon itself. -///@{ -class PVREPGTagsResultSet -{ -public: - /*! \cond PRIVATE */ - PVREPGTagsResultSet() = delete; - PVREPGTagsResultSet(const AddonInstance_PVR* instance, ADDON_HANDLE handle) - : m_instance(instance), m_handle(handle) - { - } - /*! \endcond */ - - /// @addtogroup cpp_kodi_addon_pvr_Defs_epg_PVREPGTagsResultSet - ///@{ - - /// @brief To add and give content from addon to Kodi on related call. - /// - /// @param[in] tag The to transferred data. - void Add(const kodi::addon::PVREPGTag& tag) - { - m_instance->toKodi->TransferEpgEntry(m_instance->toKodi->kodiInstance, m_handle, tag.GetTag()); - } - - ///@} - -private: - const AddonInstance_PVR* m_instance = nullptr; - const ADDON_HANDLE m_handle; -}; -///@} -//------------------------------------------------------------------------------ - -} /* namespace addon */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/General.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/General.h deleted file mode 100644 index c7977c2..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/General.h +++ /dev/null @@ -1,511 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../../c-api/addon-instance/pvr/pvr_general.h" - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" Definitions group 1 - General PVR -#ifdef __cplusplus - -namespace kodi -{ -namespace addon -{ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_PVRTypeIntValue class PVRTypeIntValue -/// @ingroup cpp_kodi_addon_pvr_Defs_General -/// @brief **PVR add-on type value**\n -/// Representation of a `` event related value. -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_PVRTypeIntValue_Help -/// -///@{ -class PVRTypeIntValue : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVRTypeIntValue(const PVRTypeIntValue& data) : CStructHdl(data) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_PVRTypeIntValue_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_PVRTypeIntValue - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_PVRTypeIntValue : - /// | Name | Type | Set call | Get call - /// |------|------|----------|---------- - /// | **Value** | `int` | @ref PVRTypeIntValue::SetValue "SetValue" | @ref PVRTypeIntValue::GetValue "GetValue" - /// | **Description** | `std::string` | @ref PVRTypeIntValue::SetDescription "SetDescription" | @ref PVRTypeIntValue::GetDescription "GetDescription" - /// - /// @remark Further can there be used his class constructor to set values. - - /// @addtogroup cpp_kodi_addon_pvr_Defs_PVRTypeIntValue - ///@{ - - /// @brief Default class constructor. - /// - /// @note Values must be set afterwards. - PVRTypeIntValue() = default; - - /// @brief Class constructor with integrated value set. - /// - /// @param[in] value Type identification value - /// @param[in] description Type description text - PVRTypeIntValue(int value, const std::string& description) - { - SetValue(value); - SetDescription(description); - } - - /// @brief To set with the identification value. - void SetValue(int value) { m_cStructure->iValue = value; } - - /// @brief To get with the identification value. - int GetValue() const { return m_cStructure->iValue; } - - /// @brief To set with the description text of the value. - void SetDescription(const std::string& description) - { - strncpy(m_cStructure->strDescription, description.c_str(), - sizeof(m_cStructure->strDescription) - 1); - } - - /// @brief To get with the description text of the value. - std::string GetDescription() const { return m_cStructure->strDescription; } - ///@} - -private: - PVRTypeIntValue(const PVR_ATTRIBUTE_INT_VALUE* data) : CStructHdl(data) {} - PVRTypeIntValue(PVR_ATTRIBUTE_INT_VALUE* data) : CStructHdl(data) {} -}; -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_PVRCapabilities class PVRCapabilities -/// @ingroup cpp_kodi_addon_pvr_Defs_General -/// @brief **PVR add-on capabilities**\n -/// This class is needed to tell Kodi which options are supported on the addon. -/// -/// If a capability is set to **true**, then the corresponding methods from -/// @ref cpp_kodi_addon_pvr "kodi::addon::CInstancePVRClient" need to be -/// implemented. -/// -/// As default them all set to **false**. -/// -/// Used on @ref kodi::addon::CInstancePVRClient::GetCapabilities(). -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_PVRCapabilities_Help -/// -///@{ -class PVRCapabilities -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - explicit PVRCapabilities() = delete; - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_PVRCapabilities_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_PVRCapabilities - /// ---------------------------------------------------------------------------- - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_PVRCapabilities : - /// | Name | Type | Set call | Get call - /// |------|------|----------|---------- - /// | **Supports EPG** | `boolean` | @ref PVRCapabilities::SetSupportsEPG "SetSupportsEPG" | @ref PVRCapabilities::GetSupportsEPG "GetSupportsEPG" - /// | **Supports EPG EDL** | `boolean` | @ref PVRCapabilities::SetSupportsEPGEdl "SetSupportsEPGEdl" | @ref PVRCapabilities::GetSupportsEPGEdl "GetSupportsEPGEdl" - /// | **Supports TV** | `boolean` | @ref PVRCapabilities::SetSupportsTV "SetSupportsTV" | @ref PVRCapabilities::GetSupportsTV "GetSupportsTV" - /// | **Supports radio** | `boolean` | @ref PVRCapabilities::SetSupportsRadio "SetSupportsRadio" | @ref PVRCapabilities::GetSupportsRadio "GetSupportsRadio" - /// | **Supports recordings** | `boolean` | @ref PVRCapabilities::SetSupportsRecordings "SetSupportsRecordings" | @ref PVRCapabilities::GetSupportsRecordings "GetSupportsRecordings" - /// | **Supports recordings undelete** | `boolean` | @ref PVRCapabilities::SetSupportsRecordingsUndelete "SetSupportsRecordingsUndelete" | @ref PVRCapabilities::GetSupportsRecordingsUndelete "SetSupportsRecordingsUndelete" - /// | **Supports timers** | `boolean` | @ref PVRCapabilities::SetSupportsTimers "SetSupportsTimers" | @ref PVRCapabilities::GetSupportsTimers "GetSupportsTimers" - /// | **Supports channel groups** | `boolean` | @ref PVRCapabilities::SetSupportsChannelGroups "SetSupportsChannelGroups" | @ref PVRCapabilities::GetSupportsChannelGroups "GetSupportsChannelGroups" - /// | **Supports channel scan** | `boolean` | @ref PVRCapabilities::SetSupportsChannelScan "SetSupportsChannelScan" | @ref PVRCapabilities::GetSupportsChannelScan "GetSupportsChannelScan" - /// | **Supports channel settings** | `boolean` | @ref PVRCapabilities::SetSupportsChannelSettings "SetSupportsChannelSettings" | @ref PVRCapabilities::GetSupportsChannelSettings "GetSupportsChannelSettings" - /// | **Handles input stream** | `boolean` | @ref PVRCapabilities::SetHandlesInputStream "SetHandlesInputStream" | @ref PVRCapabilities::GetHandlesInputStream "GetHandlesInputStream" - /// | **Handles demuxing** | `boolean` | @ref PVRCapabilities::SetHandlesDemuxing "SetHandlesDemuxing" | @ref PVRCapabilities::GetHandlesDemuxing "GetHandlesDemuxing" - /// | **Supports recording play count** | `boolean` | @ref PVRCapabilities::SetSupportsRecordingPlayCount "SetSupportsRecordingPlayCount" | @ref PVRCapabilities::GetSupportsRecordingPlayCount "GetSupportsRecordingPlayCount" - /// | **Supports last played position** | `boolean` | @ref PVRCapabilities::SetSupportsLastPlayedPosition "SetSupportsLastPlayedPosition" | @ref PVRCapabilities::GetSupportsLastPlayedPosition "GetSupportsLastPlayedPosition" - /// | **Supports recording EDL** | `boolean` | @ref PVRCapabilities::SetSupportsRecordingEdl "SetSupportsRecordingEdl" | @ref PVRCapabilities::GetSupportsRecordingEdl "GetSupportsRecordingEdl" - /// | **Supports recordings rename** | `boolean` | @ref PVRCapabilities::SetSupportsRecordingsRename "SetSupportsRecordingsRename" | @ref PVRCapabilities::GetSupportsRecordingsRename "GetSupportsRecordingsRename" - /// | **Supports recordings lifetime change** | `boolean` | @ref PVRCapabilities::SetSupportsRecordingsLifetimeChange "SetSupportsRecordingsLifetimeChange" | @ref PVRCapabilities::GetSupportsRecordingsLifetimeChange "GetSupportsRecordingsLifetimeChange" - /// | **Supports descramble info** | `boolean` | @ref PVRCapabilities::SetSupportsDescrambleInfo "SetSupportsDescrambleInfo" | @ref PVRCapabilities::GetSupportsDescrambleInfo "GetSupportsDescrambleInfo" - /// | **Supports async EPG transfer** | `boolean` | @ref PVRCapabilities::SetSupportsAsyncEPGTransfer "SetSupportsAsyncEPGTransfer" | @ref PVRCapabilities::GetSupportsAsyncEPGTransfer "GetSupportsAsyncEPGTransfer" - /// | **Supports recording size** | `boolean` | @ref PVRCapabilities::SetSupportsRecordingSize "SetSupportsRecordingSize" | @ref PVRCapabilities::GetSupportsRecordingSize "GetSupportsRecordingSize" - /// | **Recordings lifetime values** | @ref cpp_kodi_addon_pvr_Defs_PVRTypeIntValue "PVRTypeIntValue" | @ref PVRCapabilities::SetRecordingsLifetimeValues "SetRecordingsLifetimeValues" | @ref PVRCapabilities::GetRecordingsLifetimeValues "GetRecordingsLifetimeValues" - /// - /// @warning This class can not be used outside of @ref kodi::addon::CInstancePVRClient::GetCapabilities() - /// - - /// @addtogroup cpp_kodi_addon_pvr_Defs_PVRCapabilities - ///@{ - - /// @brief Set **true** if the add-on provides EPG information. - void SetSupportsEPG(bool supportsEPG) { m_capabilities->bSupportsEPG = supportsEPG; } - - /// @brief To get with @ref SetSupportsEPG changed values. - bool GetSupportsEPG() const { return m_capabilities->bSupportsEPG; } - - /// @brief Set **true** if the backend supports retrieving an edit decision - /// list for an EPG tag. - void SetSupportsEPGEdl(bool supportsEPGEdl) { m_capabilities->bSupportsEPGEdl = supportsEPGEdl; } - - /// @brief To get with @ref SetSupportsEPGEdl changed values. - bool GetSupportsEPGEdl() const { return m_capabilities->bSupportsEPGEdl; } - - /// @brief Set **true** if this add-on provides TV channels. - void SetSupportsTV(bool supportsTV) { m_capabilities->bSupportsTV = supportsTV; } - - /// @brief To get with @ref SetSupportsTV changed values. - bool GetSupportsTV() const { return m_capabilities->bSupportsTV; } - - /// @brief Set **true** if this add-on provides TV channels. - void SetSupportsRadio(bool supportsRadio) { m_capabilities->bSupportsRadio = supportsRadio; } - - /// @brief To get with @ref SetSupportsRadio changed values. - bool GetSupportsRadio() const { return m_capabilities->bSupportsRadio; } - - /// @brief **true** if this add-on supports playback of recordings stored on - /// the backend. - void SetSupportsRecordings(bool supportsRecordings) - { - m_capabilities->bSupportsRecordings = supportsRecordings; - } - - /// @brief To get with @ref SetSupportsRecordings changed values. - bool GetSupportsRecordings() const { return m_capabilities->bSupportsRecordings; } - - /// @brief Set **true** if this add-on supports undelete of recordings stored - /// on the backend. - void SetSupportsRecordingsUndelete(bool supportsRecordingsUndelete) - { - m_capabilities->bSupportsRecordingsUndelete = supportsRecordingsUndelete; - } - - /// @brief To get with @ref SetSupportsRecordings changed values. - bool GetSupportsRecordingsUndelete() const { return m_capabilities->bSupportsRecordingsUndelete; } - - /// @brief Set **true** if this add-on supports the creation and editing of - /// timers. - void SetSupportsTimers(bool supportsTimers) { m_capabilities->bSupportsTimers = supportsTimers; } - - /// @brief To get with @ref SetSupportsTimers changed values. - bool GetSupportsTimers() const { return m_capabilities->bSupportsTimers; } - - /// @brief Set **true** if this add-on supports channel groups. - /// - /// It use the following functions: - /// - @ref kodi::addon::CInstancePVRClient::GetChannelGroupsAmount() - /// - @ref kodi::addon::CInstancePVRClient::GetChannelGroups() - /// - @ref kodi::addon::CInstancePVRClient::GetChannelGroupMembers() - void SetSupportsChannelGroups(bool supportsChannelGroups) - { - m_capabilities->bSupportsChannelGroups = supportsChannelGroups; - } - - /// @brief To get with @ref SetSupportsChannelGroups changed values. - bool GetSupportsChannelGroups() const { return m_capabilities->bSupportsChannelGroups; } - - /// @brief Set **true** if this add-on support scanning for new channels on - /// the backend. - /// - /// It use the following function: - /// - @ref kodi::addon::CInstancePVRClient::OpenDialogChannelScan() - void SetSupportsChannelScan(bool supportsChannelScan) - { - m_capabilities->bSupportsChannelScan = supportsChannelScan; - } - - /// @brief To get with @ref SetSupportsChannelScan changed values. - bool GetSupportsChannelScan() const { return m_capabilities->bSupportsChannelScan; } - - /// @brief Set **true** if this add-on supports channel edit. - /// - /// It use the following functions: - /// - @ref kodi::addon::CInstancePVRClient::DeleteChannel() - /// - @ref kodi::addon::CInstancePVRClient::RenameChannel() - /// - @ref kodi::addon::CInstancePVRClient::OpenDialogChannelSettings() - /// - @ref kodi::addon::CInstancePVRClient::OpenDialogChannelAdd() - void SetSupportsChannelSettings(bool supportsChannelSettings) - { - m_capabilities->bSupportsChannelSettings = supportsChannelSettings; - } - - /// @brief To get with @ref SetSupportsChannelSettings changed values. - bool GetSupportsChannelSettings() const { return m_capabilities->bSupportsChannelSettings; } - - /// @brief Set **true** if this add-on provides an input stream. false if Kodi - /// handles the stream. - void SetHandlesInputStream(bool handlesInputStream) - { - m_capabilities->bHandlesInputStream = handlesInputStream; - } - - /// @brief To get with @ref SetHandlesInputStream changed values. - bool GetHandlesInputStream() const { return m_capabilities->bHandlesInputStream; } - - /// @brief Set **true** if this add-on demultiplexes packets. - void SetHandlesDemuxing(bool handlesDemuxing) - { - m_capabilities->bHandlesDemuxing = handlesDemuxing; - } - - /// @brief To get with @ref SetHandlesDemuxing changed values. - bool GetHandlesDemuxing() const { return m_capabilities->bHandlesDemuxing; } - - /// @brief Set **true** if the backend supports play count for recordings. - void SetSupportsRecordingPlayCount(bool supportsRecordingPlayCount) - { - m_capabilities->bSupportsRecordingPlayCount = supportsRecordingPlayCount; - } - - /// @brief To get with @ref SetSupportsRecordingPlayCount changed values. - bool GetSupportsRecordingPlayCount() const { return m_capabilities->bSupportsRecordingPlayCount; } - - /// @brief Set **true** if the backend supports store/retrieve of last played - /// position for recordings. - void SetSupportsLastPlayedPosition(bool supportsLastPlayedPosition) - { - m_capabilities->bSupportsLastPlayedPosition = supportsLastPlayedPosition; - } - - /// @brief To get with @ref SetSupportsLastPlayedPosition changed values. - bool GetSupportsLastPlayedPosition() const { return m_capabilities->bSupportsLastPlayedPosition; } - - /// @brief Set **true** if the backend supports retrieving an edit decision - /// list for recordings. - void SetSupportsRecordingEdl(bool supportsRecordingEdl) - { - m_capabilities->bSupportsRecordingEdl = supportsRecordingEdl; - } - - /// @brief To get with @ref SetSupportsRecordingEdl changed values. - bool GetSupportsRecordingEdl() const { return m_capabilities->bSupportsRecordingEdl; } - - /// @brief Set **true** if the backend supports renaming recordings. - void SetSupportsRecordingsRename(bool supportsRecordingsRename) - { - m_capabilities->bSupportsRecordingsRename = supportsRecordingsRename; - } - - /// @brief To get with @ref SetSupportsRecordingsRename changed values. - bool GetSupportsRecordingsRename() const { return m_capabilities->bSupportsRecordingsRename; } - - /// @brief Set **true** if the backend supports changing lifetime for - /// recordings. - void SetSupportsRecordingsLifetimeChange(bool supportsRecordingsLifetimeChange) - { - m_capabilities->bSupportsRecordingsLifetimeChange = supportsRecordingsLifetimeChange; - } - - /// @brief To get with @ref SetSupportsRecordingsLifetimeChange changed - /// values. - bool GetSupportsRecordingsLifetimeChange() const - { - return m_capabilities->bSupportsRecordingsLifetimeChange; - } - - /// @brief Set **true** if the backend supports descramble information for - /// playing channels. - void SetSupportsDescrambleInfo(bool supportsDescrambleInfo) - { - m_capabilities->bSupportsDescrambleInfo = supportsDescrambleInfo; - } - - /// @brief To get with @ref SetSupportsDescrambleInfo changed values. - bool GetSupportsDescrambleInfo() const { return m_capabilities->bSupportsDescrambleInfo; } - - /// @brief Set **true** if this addon-on supports asynchronous transfer of epg - /// events to Kodi using the callback function - /// @ref kodi::addon::CInstancePVRClient::EpgEventStateChange(). - void SetSupportsAsyncEPGTransfer(bool supportsAsyncEPGTransfer) - { - m_capabilities->bSupportsAsyncEPGTransfer = supportsAsyncEPGTransfer; - } - - /// @brief To get with @ref SetSupportsAsyncEPGTransfer changed values. - bool GetSupportsAsyncEPGTransfer() const { return m_capabilities->bSupportsAsyncEPGTransfer; } - - /// @brief Set **true** if this addon-on supports retrieving size of recordings. - void SetSupportsRecordingSize(bool supportsRecordingSize) - { - m_capabilities->bSupportsRecordingSize = supportsRecordingSize; - } - - /// @brief To get with @ref SetSupportsRecordingSize changed values. - bool GetSupportsRecordingSize() const { return m_capabilities->bSupportsRecordingSize; } - - /// @brief **optional**\n - /// Set array containing the possible values for @ref PVRRecording::SetLifetime(). - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_PVRTypeIntValue_Help - void SetRecordingsLifetimeValues( - const std::vector& recordingsLifetimeValues) - { - m_capabilities->iRecordingsLifetimesSize = 0; - for (unsigned int i = 0; i < recordingsLifetimeValues.size() && - i < sizeof(m_capabilities->recordingsLifetimeValues); - ++i) - { - m_capabilities->recordingsLifetimeValues[i].iValue = - recordingsLifetimeValues[i].GetCStructure()->iValue; - strncpy(m_capabilities->recordingsLifetimeValues[i].strDescription, - recordingsLifetimeValues[i].GetCStructure()->strDescription, - sizeof(m_capabilities->recordingsLifetimeValues[i].strDescription) - 1); - ++m_capabilities->iRecordingsLifetimesSize; - } - } - - /// @brief To get with @ref SetRecordingsLifetimeValues changed values. - std::vector GetRecordingsLifetimeValues() const - { - std::vector recordingsLifetimeValues; - for (unsigned int i = 0; i < m_capabilities->iRecordingsLifetimesSize; ++i) - recordingsLifetimeValues.emplace_back( - m_capabilities->recordingsLifetimeValues[i].iValue, - m_capabilities->recordingsLifetimeValues[i].strDescription); - return recordingsLifetimeValues; - } - ///@} - -private: - PVRCapabilities(PVR_ADDON_CAPABILITIES* capabilities) : m_capabilities(capabilities) {} - - PVR_ADDON_CAPABILITIES* m_capabilities; -}; -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_General_Inputstream_PVRStreamProperty class PVRStreamProperty -/// @ingroup cpp_kodi_addon_pvr_Defs_General_Inputstream -/// @brief **PVR stream property value handler**\n -/// To set for Kodi wanted stream properties. -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_General_Inputstream_PVRStreamProperty_Help -/// -///--------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// ... -/// -/// PVR_ERROR CMyPVRInstance::GetChannelStreamProperties(const kodi::addon::PVRChannel& channel, -/// std::vector& properties) -/// { -/// ... -/// properties.emplace_back(PVR_STREAM_PROPERTY_INPUTSTREAM, "inputstream.adaptive"); -/// return PVR_ERROR_NO_ERROR; -/// } -/// -/// ... -/// ~~~~~~~~~~~~~ -/// -/// -/// **Example 2:** -/// ~~~~~~~~~~~~~{.cpp} -/// ... -/// -/// PVR_ERROR CMyPVRInstance::GetChannelStreamProperties(const kodi::addon::PVRChannel& channel, -/// std::vector& properties) -/// { -/// ... -/// kodi::addon::PVRStreamProperty property; -/// property.SetName(PVR_STREAM_PROPERTY_INPUTSTREAM); -/// property.SetValue("inputstream.adaptive"); -/// properties.emplace_back(property); -/// return PVR_ERROR_NO_ERROR; -/// } -/// -/// ... -/// ~~~~~~~~~~~~~ -/// -///@{ -class PVRStreamProperty : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVRStreamProperty(const PVRStreamProperty& data) : CStructHdl(data) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_General_Inputstream_PVRStreamProperty_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_General_Inputstream_PVRStreamProperty - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_General_Inputstream_PVRStreamProperty : - /// | Name | Type | Set call | Get call - /// |------|------|----------|---------- - /// | **Name** | `int` | @ref PVRStreamProperty::SetValue "SetName" | @ref PVRStreamProperty::GetName "GetName" - /// | **Value** | `std::string` | @ref PVRStreamProperty::SetValue "SetValue" | @ref PVRStreamProperty::GetValue "GetValue" - /// - /// @remark Further can there be used his class constructor to set values. - - /// @addtogroup cpp_kodi_addon_pvr_Defs_General_Inputstream_PVRStreamProperty - ///@{ - - /// @brief Default class constructor. - /// - /// @note Values must be set afterwards. - PVRStreamProperty() = default; - - /// @brief Class constructor with integrated value set. - /// - /// @param[in] name Type identification - /// @param[in] value Type used property value - PVRStreamProperty(const std::string& name, const std::string& value) - { - SetName(name); - SetValue(value); - } - - /// @brief To set with the identification name. - void SetName(const std::string& name) - { - strncpy(m_cStructure->strName, name.c_str(), sizeof(m_cStructure->strName) - 1); - } - - /// @brief To get with the identification name. - std::string GetName() const { return m_cStructure->strName; } - - /// @brief To set with the used property value. - void SetValue(const std::string& value) - { - strncpy(m_cStructure->strValue, value.c_str(), sizeof(m_cStructure->strValue) - 1); - } - - /// @brief To get with the used property value. - std::string GetValue() const { return m_cStructure->strValue; } - ///@} - -private: - PVRStreamProperty(const PVR_NAMED_VALUE* data) : CStructHdl(data) {} - PVRStreamProperty(PVR_NAMED_VALUE* data) : CStructHdl(data) {} -}; -///@} -//------------------------------------------------------------------------------ - -} /* namespace addon */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/MenuHook.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/MenuHook.h deleted file mode 100644 index 053a4d5..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/MenuHook.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../../c-api/addon-instance/pvr/pvr_menu_hook.h" - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" Definitions group 7 - Menu hook -#ifdef __cplusplus - -namespace kodi -{ -namespace addon -{ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook class PVRMenuhook -/// @ingroup cpp_kodi_addon_pvr_Defs_Menuhook -/// @brief **Context menu hook**\n -/// Menu hooks that are available in the context menus while playing a stream via this add-on. -/// And in the Live TV settings dialog. -/// -/// Possible menu's given to Kodi. -/// -/// This can be becomes used on this, if @ref kodi::addon::CInstancePVRClient::AddMenuHook() -/// was set to related type: -/// - @ref kodi::addon::CInstancePVRClient::CallSettingsMenuHook() -/// - @ref kodi::addon::CInstancePVRClient::CallChannelMenuHook() -/// - @ref kodi::addon::CInstancePVRClient::CallEPGMenuHook() -/// - @ref kodi::addon::CInstancePVRClient::CallRecordingMenuHook() -/// - @ref kodi::addon::CInstancePVRClient::CallTimerMenuHook() -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help -/// -///@{ -class PVRMenuhook : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /// @addtogroup cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook - /// @brief Optional class constructor with value set. - /// - /// @param[in] hookId This hook's identifier - /// @param[in] localizedStringId Localized string identifier - /// @param[in] category Category of menu hook, defined with @ref PVR_MENUHOOK_CAT - /// - /// - /// -------------------------------------------------------------------------- - /// - /// Example: - /// ~~~~~~~~~~~~~{.cpp} - /// AddMenuHook(kodi::addon::PVRMenuhook(1, 30001, PVR_MENUHOOK_CHANNEL)); - /// ~~~~~~~~~~~~~ - /// - PVRMenuhook(unsigned int hookId, unsigned int localizedStringId, PVR_MENUHOOK_CAT category) - { - m_cStructure->iHookId = hookId; - m_cStructure->iLocalizedStringId = localizedStringId; - m_cStructure->category = category; - } - - /*! \cond PRIVATE */ - PVRMenuhook() - { - m_cStructure->iHookId = 0; - m_cStructure->iLocalizedStringId = 0; - m_cStructure->category = PVR_MENUHOOK_UNKNOWN; - } - PVRMenuhook(const PVRMenuhook& data) : CStructHdl(data) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook : - /// | Name | Type | Set call | Get call | Usage - /// |------|------|----------|----------|----------- - /// | **This hook's identifier** | `unsigned int` | @ref PVRMenuhook::SetHookId "SetHookId" | @ref PVRMenuhook::GetHookId "GetHookId" | *required to set* - /// | **Localized string Identifier** | `unsigned int` | @ref PVRMenuhook::SetLocalizedStringId "SetLocalizedStringId" | @ref PVRMenuhook::GetLocalizedStringId "GetLocalizedStringId" | *required to set* - /// | **Category of menu hook** | @ref PVR_MENUHOOK_CAT | @ref PVRMenuhook::SetCategory "SetCategory" | @ref PVRMenuhook::GetCategory "GetCategory" | *required to set* - - /// @addtogroup cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook - ///@{ - - /// @brief **required**\n - /// This hook's identifier. - void SetHookId(unsigned int hookId) { m_cStructure->iHookId = hookId; } - - /// @brief To get with @ref SetHookId() changed values. - unsigned int GetHookId() const { return m_cStructure->iHookId; } - - /// @brief **required**\n - /// The id of the label for this hook in @ref kodi::GetLocalizedString(). - void SetLocalizedStringId(unsigned int localizedStringId) - { - m_cStructure->iLocalizedStringId = localizedStringId; - } - - /// @brief To get with @ref SetLocalizedStringId() changed values. - unsigned int GetLocalizedStringId() const { return m_cStructure->iLocalizedStringId; } - - /// @brief **required**\n - /// Category of menu hook. - void SetCategory(PVR_MENUHOOK_CAT category) { m_cStructure->category = category; } - - /// @brief To get with @ref SetCategory() changed values. - PVR_MENUHOOK_CAT GetCategory() const { return m_cStructure->category; } - ///@} - -private: - PVRMenuhook(const PVR_MENUHOOK* data) : CStructHdl(data) {} - PVRMenuhook(PVR_MENUHOOK* data) : CStructHdl(data) {} -}; -///@} -//------------------------------------------------------------------------------ - -} /* namespace addon */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Recordings.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Recordings.h deleted file mode 100644 index 24ecf11..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Recordings.h +++ /dev/null @@ -1,520 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../../c-api/addon-instance/pvr.h" - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" Definitions group 5 - PVR recordings -#ifdef __cplusplus - -namespace kodi -{ -namespace addon -{ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecording class PVRRecording -/// @ingroup cpp_kodi_addon_pvr_Defs_Recording -/// @brief **Data structure with available recordings data**\n -/// With this, recordings related data are transferred between addon and Kodi -/// and can also be used by the addon itself. -/// -/// The related values here are automatically initiated to defaults and need -/// only be set if supported and used. -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_Recording_PVRRecording_Help -/// -///@{ -class PVRRecording : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVRRecording() - { - m_cStructure->iSeriesNumber = PVR_RECORDING_INVALID_SERIES_EPISODE; - m_cStructure->iEpisodeNumber = PVR_RECORDING_INVALID_SERIES_EPISODE; - m_cStructure->recordingTime = 0; - m_cStructure->iDuration = PVR_RECORDING_VALUE_NOT_AVAILABLE; - m_cStructure->iPriority = PVR_RECORDING_VALUE_NOT_AVAILABLE; - m_cStructure->iLifetime = PVR_RECORDING_VALUE_NOT_AVAILABLE; - m_cStructure->iGenreType = PVR_RECORDING_VALUE_NOT_AVAILABLE; - m_cStructure->iGenreSubType = PVR_RECORDING_VALUE_NOT_AVAILABLE; - m_cStructure->iPlayCount = PVR_RECORDING_VALUE_NOT_AVAILABLE; - m_cStructure->iLastPlayedPosition = PVR_RECORDING_VALUE_NOT_AVAILABLE; - m_cStructure->bIsDeleted = false; - m_cStructure->iEpgEventId = 0; - m_cStructure->iChannelUid = PVR_RECORDING_VALUE_NOT_AVAILABLE; - m_cStructure->channelType = PVR_RECORDING_CHANNEL_TYPE_UNKNOWN; - m_cStructure->iFlags = 0; - m_cStructure->sizeInBytes = PVR_RECORDING_VALUE_NOT_AVAILABLE; - } - PVRRecording(const PVRRecording& recording) : CStructHdl(recording) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecording_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecording - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording : - /// | Name | Type | Set call | Get call | Usage - /// |------|------|----------|----------|----------- - /// | **Recording id** | `std::string` | @ref PVRRecording::SetRecordingId "SetRecordingId" | @ref PVRRecording::GetRecordingId "GetRecordingId" | *required to set* - /// | **Title** | `std::string` | @ref PVRRecording::SetTitle "SetTitle" | @ref PVRRecording::GetTitle "GetTitle" | *required to set* - /// | **Episode name** | `std::string` | @ref PVRRecording::SetEpisodeName "SetEpisodeName" | @ref PVRRecording::GetEpisodeName "GetEpisodeName" | *optional* - /// | **Series number** | `int` | @ref PVRRecording::SetSeriesNumber "SetSeriesNumber" | @ref PVRRecording::GetSeriesNumber "GetSeriesNumber" | *optional* - /// | **Episode number** | `int` | @ref PVRRecording::SetEpisodeNumber "SetEpisodeNumber" | @ref PVRRecording::GetEpisodeNumber "GetEpisodeNumber" | *optional* - /// | **Year** | `int` | @ref PVRRecording::SetYear "SetYear" | @ref PVRRecording::GetYear "GetYear" | *optional* - /// | **Directory** | `std::string` | @ref PVRRecording::SetDirectory "SetDirectory" | @ref PVRRecording::GetDirectory "GetDirectory" | *optional* - /// | **Plot outline** | `std::string` | @ref PVRRecording::SetPlotOutline "SetPlotOutline" | @ref PVRRecording::GetPlotOutline "GetPlotOutline" | *optional* - /// | **Plot** | `std::string` | @ref PVRRecording::SetPlot "SetPlot" | @ref PVRRecording::GetPlot "GetPlot" | *optional* - /// | **Genre description** | `std::string` | @ref PVRRecording::SetGenreDescription "SetGenreDescription" | @ref PVRRecording::GetGenreDescription "GetGenreDescription" | *optional* - /// | **Channel name** | `std::string` | @ref PVRRecording::SetChannelName "SetChannelName" | @ref PVRRecording::GetChannelName "GetChannelName" | *optional* - /// | **Icon path** | `std::string` | @ref PVRRecording::SetIconPath "SetIconPath" | @ref PVRRecording::GetIconPath "GetIconPath" | *optional* - /// | **Thumbnail path** | `std::string` | @ref PVRRecording::SetThumbnailPath "SetThumbnailPath" | @ref PVRRecording::GetThumbnailPath "GetThumbnailPath" | *optional* - /// | **Fanart path** | `std::string` | @ref PVRRecording::SetFanartPath "SetFanartPath" | @ref PVRRecording::GetFanartPath "GetFanartPath" | *optional* - /// | **Recording time** | `time_t` | @ref PVRRecording::SetRecordingTime "SetRecordingTime" | @ref PVRRecording::GetRecordingTime "GetRecordingTime" | *optional* - /// | **Duration** | `int` | @ref PVRRecording::SetDuration "SetDuration" | @ref PVRRecording::GetDuration "GetDuration" | *optional* - /// | **Priority** | `int` | @ref PVRRecording::SetPriority "SetPriority" | @ref PVRRecording::GetPriority "GetPriority" | *optional* - /// | **Lifetime** | `int` | @ref PVRRecording::SetLifetime "SetLifetime" | @ref PVRRecording::GetLifetime "GetLifetime" | *optional* - /// | **Genre type** | `int` | @ref PVRRecording::SetGenreType "SetGenreType" | @ref PVRRecording::GetGenreType "GetGenreType" | *optional* - /// | **Genre sub type** | `int` | @ref PVRRecording::SetGenreSubType "SetGenreSubType" | @ref PVRRecording::GetGenreSubType "GetGenreSubType" | *optional* - /// | **Play count** | `int` | @ref PVRRecording::SetPlayCount "SetPlayCount" | @ref PVRRecording::GetPlayCount "GetPlayCount" | *optional* - /// | **Last played position** | `int` | @ref PVRRecording::SetLastPlayedPosition "SetLastPlayedPosition" | @ref PVRRecording::GetLastPlayedPosition "GetLastPlayedPosition" | *optional* - /// | **Is deleted** | `bool` | @ref PVRRecording::SetIsDeleted "SetIsDeleted" | @ref PVRRecording::GetIsDeleted "GetIsDeleted" | *optional* - /// | **EPG event id** | `unsigned int` | @ref PVRRecording::SetEPGEventId "SetEPGEventId" | @ref PVRRecording::GetEPGEventId "GetEPGEventId" | *optional* - /// | **Channel unique id** | `int` | @ref PVRRecording::SetChannelUid "SetChannelUid" | @ref PVRRecording::GetChannelUid "GetChannelUid" | *optional* - /// | **Channel type** | @ref PVR_RECORDING_CHANNEL_TYPE | @ref PVRRecording::SetChannelType "SetChannelType" | @ref PVRRecording::GetChannelType "GetChannelType" | *optional* - /// | **First aired** | `std::string` | @ref PVRRecording::SetFirstAired "SetFirstAired" | @ref PVRRecording::GetFirstAired "GetFirstAired" | *optional* - /// | **Flags** | `std::string` | @ref PVRRecording::SetFlags "SetFlags" | @ref PVRRecording::GetFlags "GetFlags" | *optional* - /// | **Size in bytes** | `std::string` | @ref PVRRecording::SetSizeInBytes "SetSizeInBytes" | @ref PVRRecording::GetSizeInBytes "GetSizeInBytes" | *optional* - - /// @addtogroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecording - ///@{ - - /// @brief **required**\n - /// Unique identifier of the recording on the client. - void SetRecordingId(const std::string& recordingId) - { - strncpy(m_cStructure->strRecordingId, recordingId.c_str(), - sizeof(m_cStructure->strRecordingId) - 1); - } - - /// @brief To get with @ref SetRecordingId changed values. - std::string GetRecordingId() const { return m_cStructure->strRecordingId; } - - /// @brief **required**\n - /// The title of this recording. - void SetTitle(const std::string& title) - { - strncpy(m_cStructure->strTitle, title.c_str(), sizeof(m_cStructure->strTitle) - 1); - } - - /// @brief To get with @ref SetTitle changed values. - std::string GetTitle() const { return m_cStructure->strTitle; } - - /// @brief **optional**\n - /// Episode name (also known as subtitle). - void SetEpisodeName(const std::string& episodeName) - { - strncpy(m_cStructure->strEpisodeName, episodeName.c_str(), - sizeof(m_cStructure->strEpisodeName) - 1); - } - - /// @brief To get with @ref SetEpisodeName changed values. - std::string GetEpisodeName() const { return m_cStructure->strEpisodeName; } - - /// @brief **optional**\n - /// Series number (usually called season). - /// - /// Set to "0" for specials/pilot. For 'invalid' see @ref SetEpisodeNumber or set to -1. - void SetSeriesNumber(int seriesNumber) { m_cStructure->iSeriesNumber = seriesNumber; } - - /// @brief To get with @ref SetSeriesNumber changed values. - int GetSeriesNumber() const { return m_cStructure->iSeriesNumber; } - - /// @brief **optional**\n - /// Eepisode number within the "iSeriesNumber" season. - /// - /// For 'invalid' set to -1 or seriesNumber=episodeNumber=0 to show both are invalid. - void SetEpisodeNumber(int episodeNumber) { m_cStructure->iEpisodeNumber = episodeNumber; } - - /// @brief To get with @ref SetEpisodeNumber changed values. - int GetEpisodeNumber() const { return m_cStructure->iEpisodeNumber; } - - /// @brief **optional**\n - /// Year of first release (use to identify a specific movie re-make) / first - /// airing for TV shows. - /// - /// Set to '0' for invalid. - void SetYear(int year) { m_cStructure->iYear = year; } - - /// @brief To get with @ref SetYear changed values. - int GetYear() const { return m_cStructure->iYear; } - - /// @brief **optional**\n - /// - /// Directory of this recording on the client. - void SetDirectory(const std::string& directory) - { - strncpy(m_cStructure->strDirectory, directory.c_str(), sizeof(m_cStructure->strDirectory) - 1); - } - - /// @brief To get with @ref SetDirectory changed values. - std::string GetDirectory() const { return m_cStructure->strDirectory; } - - /// @brief **optional**\n - /// Plot outline name. - void SetPlotOutline(const std::string& plotOutline) - { - strncpy(m_cStructure->strPlotOutline, plotOutline.c_str(), - sizeof(m_cStructure->strPlotOutline) - 1); - } - - /// @brief To get with @ref SetPlotOutline changed values. - std::string GetPlotOutline() const { return m_cStructure->strPlotOutline; } - - /// @brief **optional**\n - /// Plot name. - void SetPlot(const std::string& plot) - { - strncpy(m_cStructure->strPlot, plot.c_str(), sizeof(m_cStructure->strPlot) - 1); - } - - /// @brief To get with @ref SetPlot changed values. - std::string GetPlot() const { return m_cStructure->strPlot; } - - /// @brief **optional**\n - /// Channel name. - void SetChannelName(const std::string& channelName) - { - strncpy(m_cStructure->strChannelName, channelName.c_str(), - sizeof(m_cStructure->strChannelName) - 1); - } - - /// @brief To get with @ref SetChannelName changed values. - std::string GetChannelName() const { return m_cStructure->strChannelName; } - - /// @brief **optional**\n - /// Channel logo (icon) path. - void SetIconPath(const std::string& iconPath) - { - strncpy(m_cStructure->strIconPath, iconPath.c_str(), sizeof(m_cStructure->strIconPath) - 1); - } - - /// @brief To get with @ref SetIconPath changed values. - std::string GetIconPath() const { return m_cStructure->strIconPath; } - - /// @brief **optional**\n - /// Thumbnail path. - void SetThumbnailPath(const std::string& thumbnailPath) - { - strncpy(m_cStructure->strThumbnailPath, thumbnailPath.c_str(), - sizeof(m_cStructure->strThumbnailPath) - 1); - } - - /// @brief To get with @ref SetThumbnailPath changed values. - std::string GetThumbnailPath() const { return m_cStructure->strThumbnailPath; } - - /// @brief **optional**\n - /// Fanart path. - void SetFanartPath(const std::string& fanartPath) - { - strncpy(m_cStructure->strFanartPath, fanartPath.c_str(), - sizeof(m_cStructure->strFanartPath) - 1); - } - - /// @brief To get with @ref SetFanartPath changed values. - std::string GetFanartPath() const { return m_cStructure->strFanartPath; } - - /// @brief **optional**\n - /// Start time of the recording. - void SetRecordingTime(time_t recordingTime) { m_cStructure->recordingTime = recordingTime; } - - /// @brief To get with @ref SetRecordingTime changed values. - time_t GetRecordingTime() const { return m_cStructure->recordingTime; } - - /// @brief **optional**\n - /// Duration of the recording in seconds. - void SetDuration(int duration) { m_cStructure->iDuration = duration; } - - /// @brief To get with @ref SetDuration changed values. - int GetDuration() const { return m_cStructure->iDuration; } - - /// @brief **optional**\n - /// Priority of this recording (from 0 - 100). - void SetPriority(int priority) { m_cStructure->iPriority = priority; } - - /// @brief To get with @ref SetPriority changed values. - int GetPriority() const { return m_cStructure->iPriority; } - - /// @brief **optional**\n - /// Life time in days of this recording. - void SetLifetime(int lifetime) { m_cStructure->iLifetime = lifetime; } - - /// @brief To get with @ref SetLifetime changed values. - int GetLifetime() const { return m_cStructure->iLifetime; } - - /// @brief **optional**\n - /// Genre type. - /// - /// Use @ref EPG_GENRE_USE_STRING if type becomes given by @ref SetGenreDescription. - /// - /// @note If confirmed that backend brings the types in [ETSI EN 300 468](https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.14.01_60/en_300468v011401p.pdf) - /// conform values, can be @ref EPG_EVENT_CONTENTMASK ignored and to set here - /// with backend value. - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Example 1:** - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVRRecording tag; - /// tag.SetGenreType(EPG_EVENT_CONTENTMASK_MOVIEDRAMA); - /// ~~~~~~~~~~~~~ - /// - /// -------------------------------------------------------------------------- - /// - /// **Example 2** (in case of other, not ETSI EN 300 468 conform genre types): - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVRRecording tag; - /// tag.SetGenreType(EPG_GENRE_USE_STRING); - /// tag.SetGenreDescription("My special genre name"); // Should use (if possible) kodi::GetLocalizedString(...) to have match user language. - /// ~~~~~~~~~~~~~ - /// - void SetGenreType(int genreType) { m_cStructure->iGenreType = genreType; } - - /// @brief To get with @ref SetGenreType changed values. - int GetGenreType() const { return m_cStructure->iGenreType; } - - /// @brief **optional**\n - /// Genre sub type. - /// - /// Subtypes groups related to set by @ref SetGenreType: - /// | Main genre type | List with available sub genre types - /// |-----------------|----------------------------------------- - /// | @ref EPG_EVENT_CONTENTMASK_UNDEFINED | Nothing, should be 0 - /// | @ref EPG_EVENT_CONTENTMASK_MOVIEDRAMA | @ref EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA - /// | @ref EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS | @ref EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS - /// | @ref EPG_EVENT_CONTENTMASK_SHOW | @ref EPG_EVENT_CONTENTSUBMASK_SHOW - /// | @ref EPG_EVENT_CONTENTMASK_SPORTS | @ref EPG_EVENT_CONTENTSUBMASK_SPORTS - /// | @ref EPG_EVENT_CONTENTMASK_CHILDRENYOUTH | @ref EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH - /// | @ref EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE | @ref EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE - /// | @ref EPG_EVENT_CONTENTMASK_ARTSCULTURE | @ref EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE - /// | @ref EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS | @ref EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS - /// | @ref EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE | @ref EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE - /// | @ref EPG_EVENT_CONTENTMASK_LEISUREHOBBIES | @ref EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES - /// | @ref EPG_EVENT_CONTENTMASK_SPECIAL | @ref EPG_EVENT_CONTENTSUBMASK_SPECIAL - /// | @ref EPG_EVENT_CONTENTMASK_USERDEFINED | Can be defined by you - /// | @ref EPG_GENRE_USE_STRING | **Kodi's own value**, which declares that the type with @ref SetGenreDescription is given. - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVRRecording tag; - /// tag.SetGenreType(EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE); - /// tag.SetGenreSubType(EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE_JAZZ); - /// ~~~~~~~~~~~~~ - /// - void SetGenreSubType(int genreSubType) { m_cStructure->iGenreSubType = genreSubType; } - - /// @brief To get with @ref SetGenreSubType changed values. - int GetGenreSubType() const { return m_cStructure->iGenreSubType; } - - /// @brief **optional**\n - /// To set own genre description name. - /// - /// Will be used only when genreType == @ref EPG_GENRE_USE_STRING or - /// genreSubType == @ref EPG_GENRE_USE_STRING. - /// - /// Use @ref EPG_STRING_TOKEN_SEPARATOR to separate different genres. - /// - /// In case of other, not [ETSI EN 300 468](https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.14.01_60/en_300468v011401p.pdf) - /// conform genre types or something special. - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVRRecording tag; - /// tag.SetGenreType(EPG_GENRE_USE_STRING); - /// tag.SetGenreDescription("Action" + EPG_STRING_TOKEN_SEPARATOR + "Thriller"); - /// ~~~~~~~~~~~~~ - /// - void SetGenreDescription(const std::string& genreDescription) - { - strncpy(m_cStructure->strGenreDescription, genreDescription.c_str(), - sizeof(m_cStructure->strGenreDescription) - 1); - } - - /// @brief To get with @ref SetGenreDescription changed values. - std::string GetGenreDescription() const { return m_cStructure->strGenreDescription; } - - /// @brief **optional**\n - /// Play count of this recording on the client. - void SetPlayCount(int playCount) { m_cStructure->iPlayCount = playCount; } - - /// @brief To get with @ref SetPlayCount changed values. - int GetPlayCount() const { return m_cStructure->iPlayCount; } - - /// @brief **optional**\n - /// Last played position of this recording on the client. - void SetLastPlayedPosition(int lastPlayedPosition) - { - m_cStructure->iLastPlayedPosition = lastPlayedPosition; - } - - /// @brief To get with @ref SetLastPlayedPosition changed values. - int GetLastPlayedPosition() const { return m_cStructure->iLastPlayedPosition; } - - /// @brief **optional**\n - /// Shows this recording is deleted and can be undelete. - void SetIsDeleted(int isDeleted) { m_cStructure->bIsDeleted = isDeleted; } - - /// @brief To get with @ref SetIsDeleted changed values. - int GetIsDeleted() const { return m_cStructure->bIsDeleted; } - - /// @brief **optional**\n - /// EPG event id associated with this recording. Valid ids must be greater than @ref EPG_TAG_INVALID_UID. - void SetEPGEventId(unsigned int epgEventId) { m_cStructure->iEpgEventId = epgEventId; } - - /// @brief To get with @ref SetEPGEventId changed values. - unsigned int GetEPGEventId() const { return m_cStructure->iEpgEventId; } - - /// @brief **optional**\n - /// Unique identifier of the channel for this recording. @ref PVR_CHANNEL_INVALID_UID - /// denotes that channel uid is not available. - void SetChannelUid(int channelUid) { m_cStructure->iChannelUid = channelUid; } - - /// @brief To get with @ref SetChannelUid changed values - int GetChannelUid() const { return m_cStructure->iChannelUid; } - - /// @brief **optional**\n - /// Channel type. - /// - /// Set to @ref PVR_RECORDING_CHANNEL_TYPE_UNKNOWN if the type cannot be - /// determined. - /// - /// -------------------------------------------------------------------------- - /// - /// Example: - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVRRecording tag; - /// tag.SetChannelType(PVR_RECORDING_CHANNEL_TYPE_TV); - /// ~~~~~~~~~~~~~ - /// - void SetChannelType(PVR_RECORDING_CHANNEL_TYPE channelType) - { - m_cStructure->channelType = channelType; - } - - /// @brief To get with @ref SetChannelType changed values - PVR_RECORDING_CHANNEL_TYPE GetChannelType() const { return m_cStructure->channelType; } - - /// @brief **optional**\n - /// First aired date of this recording. - /// - /// Used only for display purposes. Specify in W3C date format "YYYY-MM-DD". - /// - /// -------------------------------------------------------------------------- - /// - /// Example: - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVRRecording tag; - /// tag.SetFirstAired(1982-10-22); - /// ~~~~~~~~~~~~~ - /// - void SetFirstAired(const std::string& firstAired) - { - strncpy(m_cStructure->strFirstAired, firstAired.c_str(), - sizeof(m_cStructure->strFirstAired) - 1); - } - - /// @brief To get with @ref SetFirstAired changed values - std::string GetFirstAired() const { return m_cStructure->strFirstAired; } - - /// @brief **optional**\n - /// Bit field of independent flags associated with the recording. - /// - /// See @ref cpp_kodi_addon_pvr_Defs_Recording_PVR_RECORDING_FLAG for - /// available bit flags. - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_Recording_PVR_RECORDING_FLAG - /// - void SetFlags(unsigned int flags) { m_cStructure->iFlags = flags; } - - /// @brief To get with @ref SetFlags changed values. - unsigned int GetFlags() const { return m_cStructure->iFlags; } - - /// @brief **optional**\n - /// Size of the recording in bytes. - void SetSizeInBytes(int64_t sizeInBytes) { m_cStructure->sizeInBytes = sizeInBytes; } - - /// @brief To get with @ref SetSizeInBytes changed values. - int64_t GetSizeInBytes() const { return m_cStructure->sizeInBytes; } - ///@} - -private: - PVRRecording(const PVR_RECORDING* recording) : CStructHdl(recording) {} - PVRRecording(PVR_RECORDING* recording) : CStructHdl(recording) {} -}; -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecordingsResultSet class PVRRecordingsResultSet -/// @ingroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecording -/// @brief **PVR add-on recording transfer class**\n -/// To transfer the content of @ref kodi::addon::CInstancePVRClient::GetRecordings(). -/// -/// @note This becomes only be used on addon call above, not usable outside on -/// addon itself. -///@{ -class PVRRecordingsResultSet -{ -public: - /*! \cond PRIVATE */ - PVRRecordingsResultSet() = delete; - PVRRecordingsResultSet(const AddonInstance_PVR* instance, ADDON_HANDLE handle) - : m_instance(instance), m_handle(handle) - { - } - /*! \endcond */ - - /// @addtogroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecordingsResultSet - ///@{ - - /// @brief To add and give content from addon to Kodi on related call. - /// - /// @param[in] tag The to transferred data. - void Add(const kodi::addon::PVRRecording& tag) - { - m_instance->toKodi->TransferRecordingEntry(m_instance->toKodi->kodiInstance, m_handle, tag); - } - - ///@} - -private: - const AddonInstance_PVR* m_instance = nullptr; - const ADDON_HANDLE m_handle; -}; -///@} -//------------------------------------------------------------------------------ - -} /* namespace addon */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Stream.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Stream.h deleted file mode 100644 index 5613947..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Stream.h +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../../c-api/addon-instance/pvr/pvr_stream.h" - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" Definitions group 9 - PVR stream definitions (NOTE: Becomes replaced -// in future by inputstream addon instance way) - -#ifdef __cplusplus - -namespace kodi -{ -namespace addon -{ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_Stream_PVRCodec class PVRCodec -/// @ingroup cpp_kodi_addon_pvr_Defs_Stream -/// @brief **PVR codec identifier**\n -/// Used to exchange the desired codec type between Kodi and addon. -/// -/// @ref kodi::addon::CInstancePVRClient::GetCodecByName is used to get this data. -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_Stream_PVRCodec_Help -/// -///@{ -class PVRCodec : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVRCodec() - { - m_cStructure->codec_type = PVR_CODEC_TYPE_UNKNOWN; - m_cStructure->codec_id = PVR_INVALID_CODEC_ID; - } - PVRCodec(const PVRCodec& type) : CStructHdl(type) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_Stream_PVRCodec_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_Stream_PVRCodec - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_Stream_PVRCodec : - /// | Name | Type | Set call | Get call - /// |------|------|----------|---------- - /// | **Codec type** | @ref PVR_CODEC_TYPE | @ref PVRCodec::SetCodecType "SetCodecType" | @ref PVRCodec::GetCodecType "GetCodecType" - /// | **Codec identifier** | `unsigned int` | @ref PVRCodec::SetCodecId "SetCodecId" | @ref PVRCodec::GetCodecId "GetCodecId" - /// - - /// @addtogroup cpp_kodi_addon_pvr_Defs_Stream_PVRCodec - ///@{ - - /// @brief Codec type. - void SetCodecType(PVR_CODEC_TYPE codecType) { m_cStructure->codec_type = codecType; } - - /// @brief To get with @ref SetCodecType() changed values. - PVR_CODEC_TYPE GetCodecType() const { return m_cStructure->codec_type; } - - /// @brief Codec id. - /// - /// Related codec identifier, normally match the ffmpeg id's. - void SetCodecId(unsigned int codecId) { m_cStructure->codec_id = codecId; } - - /// @brief To get with @ref SetCodecId() changed values. - unsigned int GetCodecId() const { return m_cStructure->codec_id; } - ///@} - -private: - PVRCodec(const PVR_CODEC& type) : CStructHdl(&type) {} - PVRCodec(const PVR_CODEC* type) : CStructHdl(type) {} - PVRCodec(PVR_CODEC* type) : CStructHdl(type) {} -}; -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties class PVRStreamProperties -/// @ingroup cpp_kodi_addon_pvr_Defs_Stream -/// @brief **PVR stream properties**\n -/// All information about a respective stream is stored in this, so that Kodi -/// can process the data given by the addon after demux. -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties_Help -/// -///@{ -class PVRStreamProperties - : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVRStreamProperties() { memset(m_cStructure, 0, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); } - PVRStreamProperties(const PVRStreamProperties& type) : CStructHdl(type) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties - /// ---------------------------------------------------------------------------- - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties : - /// | Name | Type | Set call | Get call - /// |------|------|----------|---------- - /// | **PID** | `unsigned int` | @ref PVRStreamProperties::SetPID "SetPID" | @ref PVRStreamProperties::GetPID "GetPID" - /// | **Codec type** | @ref PVR_CODEC_TYPE | @ref PVRStreamProperties::SetCodecType "SetCodecType" | @ref PVRStreamProperties::GetCodecType "GetCodecType" - /// | **Codec identifier** | `unsigned int` | @ref PVRStreamProperties::SetCodecId "SetCodecId" | @ref PVRStreamProperties::GetCodecId "GetCodecId" - /// | **Language** | `std::string` | @ref PVRStreamProperties::SetLanguage "SetLanguage" | @ref PVRStreamProperties::GetLanguage "GetLanguage" - /// | **Subtitle info** | `int` | @ref PVRStreamProperties::SetSubtitleInfo "SetSubtitleInfo" | @ref PVRStreamProperties::GetSubtitleInfo "GetSubtitleInfo" - /// | **FPS scale** | `int` | @ref PVRStreamProperties::SetFPSScale "SetFPSScale" | @ref PVRStreamProperties::GetFPSScale "GetFPSScale" - /// | **FPS rate** | `int` | @ref PVRStreamProperties::SetFPSRate "SetFPSRate" | @ref PVRStreamProperties::GetFPSRate "GetFPSRate" - /// | **Height** | `int` | @ref PVRStreamProperties::SetHeight "SetHeight" | @ref PVRStreamProperties::GetHeight "GetHeight" - /// | **Width** | `int` | @ref PVRStreamProperties::SetWidth "SetWidth" | @ref PVRStreamProperties::GetWidth "GetWidth" - /// | **Aspect ratio** | `float` | @ref PVRStreamProperties::SetAspect "SetAspect" | @ref PVRStreamProperties::GetAspect "GetAspect" - /// | **Channels** | `int` | @ref PVRStreamProperties::SetChannels "SetChannels" | @ref PVRStreamProperties::GetChannels "GetChannels" - /// | **Samplerate** | `int` | @ref PVRStreamProperties::SetSampleRate "SetSampleRate" | @ref PVRStreamProperties::GetSampleRate "GetSampleRate" - /// | **Block align** | `int` | @ref PVRStreamProperties::SetBlockAlign "SetBlockAlign" | @ref PVRStreamProperties::GetBlockAlign "GetBlockAlign" - /// | **Bit rate** | `int` | @ref PVRStreamProperties::SetBitRate "SetBitRate" | @ref PVRStreamProperties::GetBitRate "GetBitRate" - /// | **Bits per sample** | `int` | @ref PVRStreamProperties::SetBitsPerSample "SetBitsPerSample" | @ref PVRStreamProperties::GetBitsPerSample "GetBitsPerSample" - /// - - /// @addtogroup cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties - ///@{ - - /// @brief PID. - void SetPID(unsigned int pid) { m_cStructure->iPID = pid; } - - /// @brief To get with @ref SetPID() changed values. - unsigned int GetPID() const { return m_cStructure->iPID; } - - /// @brief Codec type this stream. - void SetCodecType(PVR_CODEC_TYPE codecType) { m_cStructure->iCodecType = codecType; } - - /// @brief To get with @ref SetCodecType() changed values. - PVR_CODEC_TYPE GetCodecType() const { return m_cStructure->iCodecType; } - - /// @brief Codec id of this stream. - void SetCodecId(unsigned int codecId) { m_cStructure->iCodecId = codecId; } - - /// @brief To get with @ref SetCodecId() changed values. - unsigned int GetCodecId() const { return m_cStructure->iCodecId; } - - /// @brief 3 letter language id. - void SetLanguage(const std::string& language) - { - if (language.size() > 3) - { - kodi::Log(ADDON_LOG_ERROR, - "PVRStreamProperties::%s: Language string size '%li' higher as needed 3", __func__, - language.size()); - return; - } - m_cStructure->strLanguage[0] = language[0]; - m_cStructure->strLanguage[1] = language[1]; - m_cStructure->strLanguage[2] = language[2]; - m_cStructure->strLanguage[2] = 0; - } - - /// @brief To get with @ref SetLanguage() changed values. - std::string GetLanguage() const { return m_cStructure->strLanguage; } - - /// @brief Subtitle Info - void SetSubtitleInfo(int subtitleInfo) { m_cStructure->iSubtitleInfo = subtitleInfo; } - - /// @brief To get with @ref SetSubtitleInfo() changed values. - int GetSubtitleInfo() const { return m_cStructure->iSubtitleInfo; } - - /// @brief To set scale of 1000 and a rate of 29970 will result in 29.97 fps. - void SetFPSScale(int fpsScale) { m_cStructure->iFPSScale = fpsScale; } - - /// @brief To get with @ref SetFPSScale() changed values. - int GetFPSScale() const { return m_cStructure->iFPSScale; } - - /// @brief FPS rate - void SetFPSRate(int fpsRate) { m_cStructure->iFPSRate = fpsRate; } - - /// @brief To get with @ref SetFPSRate() changed values. - int GetFPSRate() const { return m_cStructure->iFPSRate; } - - /// @brief Height of the stream reported by the demuxer - void SetHeight(int height) { m_cStructure->iHeight = height; } - - /// @brief To get with @ref SetHeight() changed values. - int GetHeight() const { return m_cStructure->iHeight; } - - /// @brief Width of the stream reported by the demuxer. - void SetWidth(int width) { m_cStructure->iWidth = width; } - - /// @brief To get with @ref SetWidth() changed values. - int GetWidth() const { return m_cStructure->iWidth; } - - /// @brief Display aspect ratio of the stream. - void SetAspect(float aspect) { m_cStructure->fAspect = aspect; } - - /// @brief To get with @ref SetAspect() changed values. - float GetAspect() const { return m_cStructure->fAspect; } - - /// @brief Amount of channels. - void SetChannels(int channels) { m_cStructure->iChannels = channels; } - - /// @brief To get with @ref SetChannels() changed values. - int GetChannels() const { return m_cStructure->iChannels; } - - /// @brief Sample rate. - void SetSampleRate(int sampleRate) { m_cStructure->iSampleRate = sampleRate; } - - /// @brief To get with @ref SetSampleRate() changed values. - int GetSampleRate() const { return m_cStructure->iSampleRate; } - - /// @brief Block alignment - void SetBlockAlign(int blockAlign) { m_cStructure->iBlockAlign = blockAlign; } - - /// @brief To get with @ref SetBlockAlign() changed values. - int GetBlockAlign() const { return m_cStructure->iBlockAlign; } - - /// @brief Bit rate. - void SetBitRate(int bitRate) { m_cStructure->iBitRate = bitRate; } - - /// @brief To get with @ref SetBitRate() changed values. - int GetBitRate() const { return m_cStructure->iBitRate; } - - /// @brief Bits per sample. - void SetBitsPerSample(int bitsPerSample) { m_cStructure->iBitsPerSample = bitsPerSample; } - - /// @brief To get with @ref SetBitsPerSample() changed values. - int GetBitsPerSample() const { return m_cStructure->iBitsPerSample; } - ///@} - -private: - PVRStreamProperties(const PVR_STREAM_PROPERTIES::PVR_STREAM* type) : CStructHdl(type) {} - PVRStreamProperties(PVR_STREAM_PROPERTIES::PVR_STREAM* type) : CStructHdl(type) {} -}; -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_Stream_PVRStreamTimes class PVRStreamTimes -/// @ingroup cpp_kodi_addon_pvr_Defs_Stream -/// @brief **Times of playing stream (Live TV and recordings)**\n -/// This class is used to transfer the necessary data when -/// @ref kodi::addon::PVRStreamProperties::GetStreamTimes is called. -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_Stream_PVRStreamTimes_Help -/// -///@{ -class PVRStreamTimes : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVRStreamTimes() { memset(m_cStructure, 0, sizeof(PVR_STREAM_TIMES)); } - PVRStreamTimes(const PVRStreamTimes& type) : CStructHdl(type) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_Stream_PVRStreamTimes_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_Stream_PVRStreamTimes - /// ---------------------------------------------------------------------------- - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamTimes : - /// | Name | Type | Set call | Get call - /// |------|------|----------|---------- - /// | **Start time** | `time_t` | @ref PVRStreamTimes::SetStartTime "SetStartTime" | @ref PVRStreamTimes::GetStartTime "GetStartTime" - /// | **PTS start** | `int64_t` | @ref PVRStreamTimes::SetPTSStart "SetPTSStart" | @ref PVRStreamTimes::GetPTSStart "GetPTSStart" - /// | **PTS begin** | `int64_t` | @ref PVRStreamTimes::SetPTSBegin "SetPTSBegin" | @ref PVRStreamTimes::GetPTSBegin "GetPTSBegin" - /// | **PTS end** | `int64_t` | @ref PVRStreamTimes::SetPTSEnd "SetPTSEnd" | @ref PVRStreamTimes::GetPTSEnd "GetPTSEnd" - /// - - /// @addtogroup cpp_kodi_addon_pvr_Defs_Stream_PVRStreamTimes - ///@{ - - /// @brief For recordings, this must be zero. For Live TV, this is a reference - /// time in units of time_t (UTC) from which time elapsed starts. Ideally start - /// of tv show, but can be any other value. - void SetStartTime(time_t startTime) { m_cStructure->startTime = startTime; } - - /// @brief To get with @ref SetStartTime() changed values. - time_t GetStartTime() const { return m_cStructure->startTime; } - - /// @brief The pts of startTime. - void SetPTSStart(int64_t ptsStart) { m_cStructure->ptsStart = ptsStart; } - - /// @brief To get with @ref SetPTSStart() changed values. - int64_t GetPTSStart() const { return m_cStructure->ptsStart; } - - /// @brief Earliest pts player can seek back. Value is in micro seconds, - /// relative to PTS start. For recordings, this must be zero. For Live TV, this - /// must be zero if not timeshifting and must point to begin of the timeshift - /// buffer, otherwise. - void SetPTSBegin(int64_t ptsBegin) { m_cStructure->ptsBegin = ptsBegin; } - - /// @brief To get with @ref SetPTSBegin() changed values. - int64_t GetPTSBegin() const { return m_cStructure->ptsBegin; } - - /// @brief Latest pts player can seek forward. Value is in micro seconds, - /// relative to PTS start. For recordings, this must be the total length. For - /// Live TV, this must be zero if not timeshifting and must point to end of - /// the timeshift buffer, otherwise. - void SetPTSEnd(int64_t ptsEnd) { m_cStructure->ptsEnd = ptsEnd; } - - /// @brief To get with @ref SetPTSEnd() changed values. - int64_t GetPTSEnd() const { return m_cStructure->ptsEnd; } - ///@} - -private: - PVRStreamTimes(const PVR_STREAM_TIMES* type) : CStructHdl(type) {} - PVRStreamTimes(PVR_STREAM_TIMES* type) : CStructHdl(type) {} -}; -///@} -//------------------------------------------------------------------------------ - -} /* namespace addon */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Timers.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Timers.h deleted file mode 100644 index 6e05e55..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/pvr/Timers.h +++ /dev/null @@ -1,896 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "General.h" -#include "../../AddonBase.h" -#include "../../c-api/addon-instance/pvr.h" - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C++" Definitions group 6 - PVR timers -#ifdef __cplusplus - -namespace kodi -{ -namespace addon -{ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimer class PVRTimer -/// @ingroup cpp_kodi_addon_pvr_Defs_Timer -/// @brief **PVR add-on timer type**\n -/// Representation of a timer event. -/// -/// The related values here are automatically initiated to defaults and need -/// only be set if supported and used. -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_Timer_PVRTimer_Help -/// -///@{ -class PVRTimer : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVRTimer() - { - m_cStructure->iClientIndex = 0; - m_cStructure->state = PVR_TIMER_STATE_NEW; - m_cStructure->iTimerType = PVR_TIMER_TYPE_NONE; - m_cStructure->iParentClientIndex = 0; - m_cStructure->iClientChannelUid = PVR_TIMER_VALUE_NOT_AVAILABLE; - m_cStructure->startTime = 0; - m_cStructure->endTime = 0; - m_cStructure->bStartAnyTime = false; - m_cStructure->bEndAnyTime = false; - m_cStructure->bFullTextEpgSearch = false; - m_cStructure->iPriority = PVR_TIMER_VALUE_NOT_AVAILABLE; - m_cStructure->iLifetime = PVR_TIMER_VALUE_NOT_AVAILABLE; - m_cStructure->iMaxRecordings = PVR_TIMER_VALUE_NOT_AVAILABLE; - m_cStructure->iRecordingGroup = 0; - m_cStructure->firstDay = 0; - m_cStructure->iWeekdays = PVR_WEEKDAY_NONE; - m_cStructure->iPreventDuplicateEpisodes = 0; - m_cStructure->iEpgUid = 0; - m_cStructure->iMarginStart = 0; - m_cStructure->iMarginEnd = 0; - m_cStructure->iGenreType = PVR_TIMER_VALUE_NOT_AVAILABLE; - m_cStructure->iGenreSubType = PVR_TIMER_VALUE_NOT_AVAILABLE; - } - PVRTimer(const PVRTimer& data) : CStructHdl(data) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimer_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimer - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimer : - /// | Name | Type | Set call | Get call | Usage - /// |------|------|----------|----------|----------- - /// | **Client index** | `unsigned int` | @ref PVRTimer::SetClientIndex "SetClientIndex" | @ref PVRTimer::GetClientIndex "GetClientIndex" | *required to set* - /// | **State** | @ref PVR_TIMER_STATE | @ref PVRTimer::SetState "SetState" | @ref PVRTimer::GetState "GetState" | *required to set* - /// | **Type** | `unsigned int` | @ref PVRTimer::SetTimerType "SetTimerType" | @ref PVRTimer::GetTimerType "GetTimerType" | *required to set* - /// | **Title** | `std::string` | @ref PVRTimer::SetTitle "SetTitle" | @ref PVRTimer::GetTitle "GetTitle" | *required to set* - /// | **Parent client index** | `unsigned int` | @ref PVRTimer::SetParentClientIndex "SetParentClientIndex" | @ref PVRTimer::GetParentClientIndex "GetParentClientIndex" | *optional* - /// | **Client channel unique identifier** | `int` | @ref PVRTimer::SetClientChannelUid "SetClientChannelUid" | @ref PVRTimer::GetClientChannelUid "GetClientChannelUid" | *optional* - /// | **Start time** | `time_t` | @ref PVRTimer::SetStartTime "SetStartTime" | @ref PVRTimer::GetStartTime "GetStartTime" | *optional* - /// | **End time** | `time_t` | @ref PVRTimer::SetEndTime "SetEndTime" | @ref PVRTimer::GetEndTime "GetEndTime" | *optional* - /// | **Start any time** | `bool` | @ref PVRTimer::SetStartAnyTime "SetStartAnyTime" | @ref PVRTimer::GetStartAnyTime "GetStartAnyTime" | *optional* - /// | **End any time** | `bool` | @ref PVRTimer::SetEndAnyTime "SetEndAnyTime" | @ref PVRTimer::GetEndAnyTime "GetEndAnyTime" | *optional* - /// | **EPG search string** | `std::string` | @ref PVRTimer::SetEPGSearchString "SetEPGSearchString" | @ref PVRTimer::GetEPGSearchString "GetEPGSearchString" | *optional* - /// | **Full text EPG search** | `bool` | @ref PVRTimer::SetFullTextEpgSearch "SetFullTextEpgSearch" | @ref PVRTimer::GetFullTextEpgSearch "GetFullTextEpgSearch" | *optional* - /// | **Recording store directory** | `std::string` | @ref PVRTimer::SetDirectory "SetDirectory" | @ref PVRTimer::GetDirectory "GetDirectory" | *optional* - /// | **Timer priority** | `int` | @ref PVRTimer::SetPriority "SetPriority" | @ref PVRTimer::GetPriority "GetPriority" | *optional* - /// | **Timer lifetime** | `int` | @ref PVRTimer::SetLifetime "SetLifetime" | @ref PVRTimer::GetLifetime "GetLifetime" | *optional* - /// | **Max recordings** | `int` | @ref PVRTimer::SetMaxRecordings "SetMaxRecordings" | @ref PVRTimer::GetMaxRecordings "GetMaxRecordings" | *optional* - /// | **Recording group** | `unsigned int` | @ref PVRTimer::SetRecordingGroup "SetRecordingGroup" | @ref PVRTimer::GetRecordingGroup "GetRecordingGroup" | *optional* - /// | **First start day** | `time_t` | @ref PVRTimer::SetFirstDay "SetFirstDay" | @ref PVRTimer::GetFirstDay "GetFirstDay" | *optional* - /// | **Used timer weekdays** | `unsigned int` | @ref PVRTimer::SetWeekdays "SetWeekdays" | @ref PVRTimer::GetWeekdays "GetWeekdays" | *optional* - /// | **Prevent duplicate episodes** | `unsigned int` | @ref PVRTimer::SetPreventDuplicateEpisodes "SetPreventDuplicateEpisodes" | @ref PVRTimer::GetPreventDuplicateEpisodes "GetPreventDuplicateEpisodes" | *optional* - /// | **EPG unique identifier** | `unsigned int` | @ref PVRTimer::SetEPGUid "SetEPGUid" | @ref PVRTimer::GetEPGUid "GetEPGUid" | *optional* - /// | **Margin start** | `unsigned int` | @ref PVRTimer::SetMarginStart "SetMarginStart" | @ref PVRTimer::GetMarginStart "GetMarginStart" | *optional* - /// | **Margin end** | `unsigned int` | @ref PVRTimer::SetMarginEnd "SetMarginEnd" | @ref PVRTimer::GetMarginEnd "GetMarginEnd" | *optional* - /// | **Genre type** | `int` | @ref PVRTimer::SetGenreType "SetGenreType" | @ref PVRTimer::GetGenreType "GetGenreType" | *optional* - /// | **Genre sub type** | `int` | @ref PVRTimer::SetGenreSubType "SetGenreSubType" | @ref PVRTimer::GetGenreSubType "GetGenreSubType" | *optional* - /// | **Series link** | `std::string` | @ref PVRTimer::SetSeriesLink "SetSeriesLink" | @ref PVRTimer::GetSeriesLink "GetSeriesLink" | *optional* - - /// @addtogroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimer - ///@{ - - /// @brief **required**\n - /// The index of this timer given by the client. - /// - /// @ref 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 - /// @ref PVR_TIMER_NO_CLIENT_INDEX. - /// - void SetClientIndex(unsigned int clientIndex) { m_cStructure->iClientIndex = clientIndex; } - - /// @brief To get with @ref SetClientIndex changed values. - unsigned int GetClientIndex() const { return m_cStructure->iClientIndex; } - - /// @brief **required**\n - /// The state of this timer. - /// - /// @note @ref PVR_TIMER_STATE_NEW is default. - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVRTimer tag; - /// tag.SetState(PVR_TIMER_STATE_RECORDING); - /// ~~~~~~~~~~~~~ - /// - void SetState(PVR_TIMER_STATE state) { m_cStructure->state = state; } - - /// @brief To get with @ref SetState changed values. - PVR_TIMER_STATE GetState() const { return m_cStructure->state; } - - /// @brief **required**\n - /// 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 @ref PVR_TIMER_TYPE_NONE. - /// - /// Kodi does not interpret this value (except for checking for @ref PVR_TIMER_TYPE_NONE), - /// but will pass the right id to the addon with every @ref PVRTimer instance, - /// thus the addon easily can determine the timer type. - /// - /// @note @ref PVR_TIMER_TYPE_NONE is default. - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVRTimer tag; - /// tag.SetTimerType(123); - /// ~~~~~~~~~~~~~ - /// - void SetTimerType(unsigned int timerType) { m_cStructure->iTimerType = timerType; } - - /// @brief To get with @ref SetTimerType changed values. - unsigned int GetTimerType() const { return m_cStructure->iTimerType; } - - /// @brief **required**\n - /// A title for this timer. - void SetTitle(const std::string& title) - { - strncpy(m_cStructure->strTitle, title.c_str(), sizeof(m_cStructure->strTitle) - 1); - } - - /// @brief To get with @ref SetTitle changed values. - std::string GetTitle() const { return m_cStructure->strTitle; } - - /// @brief **optional**\n - /// For timers scheduled by a repeating timer. - /// - /// The index of the repeating timer that scheduled this timer (it's - /// @ref clientIndex value). Use @ref PVR_TIMER_NO_PARENT to indicate that - /// this timer was no scheduled by a repeating timer. - void SetParentClientIndex(unsigned int parentClientIndex) - { - m_cStructure->iParentClientIndex = parentClientIndex; - } - - /// @brief To get with @ref SetParentClientIndex changed values. - unsigned int GetParentClientIndex() const { return m_cStructure->iParentClientIndex; } - - /// @brief **optional**\n - /// Unique identifier of the channel to record on. - /// - /// @ref PVR_TIMER_ANY_CHANNEL will denote "any channel", not a specific one. - /// @ref PVR_CHANNEL_INVALID_UID denotes that channel uid is not available. - void SetClientChannelUid(int clientChannelUid) - { - m_cStructure->iClientChannelUid = clientChannelUid; - } - - /// @brief To get with @ref SetClientChannelUid changed values - int GetClientChannelUid() const { return m_cStructure->iClientChannelUid; } - - /// @brief **optional**\n - /// 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. - void SetStartTime(time_t startTime) { m_cStructure->startTime = startTime; } - - /// @brief To get with @ref SetStartTime changed values. - time_t GetStartTime() const { return m_cStructure->startTime; } - - /// @brief **optional**\n - /// End time of the recording in UTC. - void SetEndTime(time_t endTime) { m_cStructure->endTime = endTime; } - - /// @brief To get with @ref SetEndTime changed values. - time_t GetEndTime() const { return m_cStructure->endTime; } - - /// @brief **optional**\n - /// For EPG based (not Manual) timers indicates startTime does not apply. - /// - /// Default = false. - void SetStartAnyTime(bool startAnyTime) { m_cStructure->bStartAnyTime = startAnyTime; } - - /// @brief To get with @ref SetStartAnyTime changed values. - bool GetStartAnyTime() const { return m_cStructure->bStartAnyTime; } - - /// @brief **optional**\n - /// For EPG based (not Manual) timers indicates endTime does not apply. - /// - /// Default = false - void SetEndAnyTime(bool endAnyTime) { m_cStructure->bEndAnyTime = endAnyTime; } - - /// @brief To get with @ref SetEndAnyTime changed values. - bool GetEndAnyTime() const { return m_cStructure->bEndAnyTime; } - - /// @brief **optional**\n - /// A string used to search epg data for repeating epg-based timers. - /// - /// Format is backend-dependent, for example regexp. - void SetEPGSearchString(const std::string& epgSearchString) - { - strncpy(m_cStructure->strEpgSearchString, epgSearchString.c_str(), - sizeof(m_cStructure->strEpgSearchString) - 1); - } - - /// @brief To get with @ref SetEPGSearchString changed values - std::string GetEPGSearchString() const { return m_cStructure->strEpgSearchString; } - - /// @brief **optional**\n - /// Indicates, whether @ref SetEPGSearchString() is to match against the epg - /// episode title only or also against "other" epg data (backend-dependent). - void SetFullTextEpgSearch(bool fullTextEpgSearch) - { - m_cStructure->bFullTextEpgSearch = fullTextEpgSearch; - } - - /// @brief To get with @ref SetFullTextEpgSearch changed values. - bool GetFullTextEpgSearch() const { return m_cStructure->bFullTextEpgSearch; } - - /// @brief **optional**\n - /// The (relative) directory where the recording will be stored in. - void SetDirectory(const std::string& directory) - { - strncpy(m_cStructure->strDirectory, directory.c_str(), sizeof(m_cStructure->strDirectory) - 1); - } - - /// @brief To get with @ref SetDirectory changed values. - std::string GetDirectory() const { return m_cStructure->strDirectory; } - - /// @brief **optional**\n - /// The summary for this timer. - void SetSummary(const std::string& summary) - { - strncpy(m_cStructure->strSummary, summary.c_str(), sizeof(m_cStructure->strSummary) - 1); - } - - /// @brief To get with @ref SetDirectory changed values. - std::string GetSummary() const { return m_cStructure->strSummary; } - - /// @brief **optional**\n - /// The priority of this timer. - void SetPriority(int priority) { m_cStructure->iPriority = priority; } - - /// @brief To get with @ref SetPriority changed values. - int GetPriority() const { return m_cStructure->iPriority; } - - /// @brief **optional**\n - /// Lifetime of recordings created by this timer. - /// - /// Value > 0 days after which recordings will be deleted by the backend, < 0 - /// addon defined integer list reference, == 0 disabled. - void SetLifetime(int priority) { m_cStructure->iLifetime = priority; } - - /// @brief To get with @ref SetLifetime changed values. - int GetLifetime() const { return m_cStructure->iLifetime; } - - /// @brief **optional**\n - /// Maximum number of recordings this timer shall create. - /// - /// Value > 0 number of recordings, < 0 addon defined integer list reference, == 0 disabled. - void SetMaxRecordings(int maxRecordings) { m_cStructure->iMaxRecordings = maxRecordings; } - - /// @brief To get with @ref SetMaxRecordings changed values. - int GetMaxRecordings() const { return m_cStructure->iMaxRecordings; } - - /// @brief **optional**\n - /// Integer ref to addon/backend defined list of recording groups. - void SetRecordingGroup(unsigned int recordingGroup) - { - m_cStructure->iRecordingGroup = recordingGroup; - } - - /// @brief To get with @ref SetRecordingGroup changed values. - unsigned int GetRecordingGroup() const { return m_cStructure->iRecordingGroup; } - - /// @brief **optional**\n - /// The first day this timer is active, for repeating timers. - void SetFirstDay(time_t firstDay) { m_cStructure->firstDay = firstDay; } - - /// @brief To get with @ref SetFirstDay changed values. - time_t GetFirstDay() const { return m_cStructure->firstDay; } - - /// @brief **optional**\n - /// Week days, for repeating timers (see - /// @ref cpp_kodi_addon_pvr_Defs_Timer_PVR_WEEKDAY "PVR_WEEKDAY_*" constant values) - /// - /// @note @ref PVR_WEEKDAY_NONE is default. - /// - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// kodi::addon::PVRTimer tag; - /// tag.SetWeekdays(PVR_WEEKDAY_MONDAY | PVR_WEEKDAY_SATURDAY); - /// ... - /// ~~~~~~~~~~~~~ - void SetWeekdays(unsigned int weekdays) { m_cStructure->iWeekdays = weekdays; } - - /// @brief To get with @ref SetFirstDay changed values. - unsigned int GetWeekdays() const { return m_cStructure->iWeekdays; } - - /// @brief **optional**\n - /// Prevent duplicate episodes. - /// - /// Should 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. - void SetPreventDuplicateEpisodes(unsigned int preventDuplicateEpisodes) - { - m_cStructure->iPreventDuplicateEpisodes = preventDuplicateEpisodes; - } - - /// @brief To get with @ref SetPreventDuplicateEpisodes changed values. - unsigned int GetPreventDuplicateEpisodes() const - { - return m_cStructure->iPreventDuplicateEpisodes; - } - - /// @brief **optional**\n - /// EPG event id associated with this timer. Event ids must be unique for a - /// channel. - /// - /// Valid ids must be greater than @ref EPG_TAG_INVALID_UID. - void SetEPGUid(unsigned int epgUid) { m_cStructure->iEpgUid = epgUid; } - - /// @brief To get with @ref SetEPGUid changed values. - unsigned int GetEPGUid() const { return m_cStructure->iEpgUid; } - - /// @brief **optional**\n - /// If set, the backend starts the recording selected minutes before - /// @ref SetStartTime. - void SetMarginStart(unsigned int marginStart) { m_cStructure->iMarginStart = marginStart; } - - /// @brief To get with @ref SetMarginStart changed values. - unsigned int GetMarginStart() const { return m_cStructure->iMarginStart; } - - /// @brief **optional**\n - /// If set, the backend ends the recording selected minutes after - /// @ref SetEndTime. - void SetMarginEnd(unsigned int marginEnd) { m_cStructure->iMarginEnd = marginEnd; } - - /// @brief To get with @ref SetMarginEnd changed values. - unsigned int GetMarginEnd() const { return m_cStructure->iMarginEnd; } - - /// @brief **optional**\n - /// Genre type. - /// - /// @copydetails EPG_EVENT_CONTENTMASK - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// kodi::addon::PVRTimer tag; - /// tag.SetGenreType(EPG_EVENT_CONTENTMASK_MOVIEDRAMA); - /// ... - /// ~~~~~~~~~~~~~ - /// - /// @note If confirmed that backend brings the types in [ETSI EN 300 468](https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.14.01_60/en_300468v011401p.pdf) - /// conform values, can be @ref EPG_EVENT_CONTENTMASK ignored and to set here - /// with backend value. - /// - void SetGenreType(int genreType) { m_cStructure->iGenreType = genreType; } - - /// @brief To get with @ref SetGenreType changed values. - int GetGenreType() const { return m_cStructure->iGenreType; } - - /// @brief **optional**\n - /// Genre sub type. - /// - /// @copydetails EPG_EVENT_CONTENTMASK - /// - /// Subtypes groups related to set by @ref SetGenreType: - /// | Main genre type | List with available sub genre types - /// |-----------------|----------------------------------------- - /// | @ref EPG_EVENT_CONTENTMASK_UNDEFINED | Nothing, should be 0 - /// | @ref EPG_EVENT_CONTENTMASK_MOVIEDRAMA | @ref EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA - /// | @ref EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS | @ref EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS - /// | @ref EPG_EVENT_CONTENTMASK_SHOW | @ref EPG_EVENT_CONTENTSUBMASK_SHOW - /// | @ref EPG_EVENT_CONTENTMASK_SPORTS | @ref EPG_EVENT_CONTENTSUBMASK_SPORTS - /// | @ref EPG_EVENT_CONTENTMASK_CHILDRENYOUTH | @ref EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH - /// | @ref EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE | @ref EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE - /// | @ref EPG_EVENT_CONTENTMASK_ARTSCULTURE | @ref EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE - /// | @ref EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS | @ref EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS - /// | @ref EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE | @ref EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE - /// | @ref EPG_EVENT_CONTENTMASK_LEISUREHOBBIES | @ref EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES - /// | @ref EPG_EVENT_CONTENTMASK_SPECIAL | @ref EPG_EVENT_CONTENTSUBMASK_SPECIAL - /// | @ref EPG_EVENT_CONTENTMASK_USERDEFINED | Can be defined by you - /// - /// -------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// kodi::addon::PVRTimer tag; - /// tag.SetGenreType(EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE); - /// tag.SetGenreSubType(EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE_JAZZ); - /// ... - /// ~~~~~~~~~~~~~ - /// - void SetGenreSubType(int genreSubType) { m_cStructure->iGenreSubType = genreSubType; } - - /// @brief To get with @ref SetGenreType changed values. - int GetGenreSubType() const { return m_cStructure->iGenreSubType; } - - /// @brief **optional**\n - /// Series link for this timer. - /// - /// If set for an epg-based timer rule, matching events will be found by - /// checking with here, instead of @ref SetTitle() (and @ref SetFullTextEpgSearch()). - void SetSeriesLink(const std::string& seriesLink) - { - strncpy(m_cStructure->strSeriesLink, seriesLink.c_str(), - sizeof(m_cStructure->strSeriesLink) - 1); - } - - /// @brief To get with @ref SetSeriesLink changed values. - std::string GetSeriesLink() const { return m_cStructure->strSeriesLink; } - ///@} - -private: - PVRTimer(const PVR_TIMER* data) : CStructHdl(data) {} - PVRTimer(PVR_TIMER* data) : CStructHdl(data) {} -}; - -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimersResultSet class PVRTimersResultSet -/// @ingroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimer -/// @brief **PVR add-on timer transfer class**\n -/// To transfer the content of @ref kodi::addon::CInstancePVRClient::GetTimers(). -/// -/// @note This becomes only be used on addon call above, not usable outside on -/// addon itself. -///@{ -class PVRTimersResultSet -{ -public: - /*! \cond PRIVATE */ - PVRTimersResultSet() = delete; - PVRTimersResultSet(const AddonInstance_PVR* instance, ADDON_HANDLE handle) - : m_instance(instance), m_handle(handle) - { - } - /*! \endcond */ - - /// @addtogroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimersResultSet - ///@{ - - /// @brief To add and give content from addon to Kodi on related call. - /// - /// @param[in] tag The to transferred data. - void Add(const kodi::addon::PVRTimer& tag) - { - m_instance->toKodi->TransferTimerEntry(m_instance->toKodi->kodiInstance, m_handle, tag); - } - - ///@} - -private: - const AddonInstance_PVR* m_instance = nullptr; - const ADDON_HANDLE m_handle; -}; -///@} -//------------------------------------------------------------------------------ - -//============================================================================== -/// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType class PVRTimerType -/// @ingroup cpp_kodi_addon_pvr_Defs_Timer -/// @brief **PVR add-on timer type**\n -/// To define the content of @ref kodi::addon::CInstancePVRClient::GetTimerTypes() -/// given groups. -/// -/// ---------------------------------------------------------------------------- -/// -/// @copydetails cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType_Help -/// -///@{ -class PVRTimerType : public CStructHdl -{ - friend class CInstancePVRClient; - -public: - /*! \cond PRIVATE */ - PVRTimerType() - { - memset(m_cStructure, 0, sizeof(PVR_TIMER_TYPE)); - m_cStructure->iPrioritiesDefault = -1; - m_cStructure->iLifetimesDefault = -1; - m_cStructure->iPreventDuplicateEpisodesDefault = -1; - m_cStructure->iRecordingGroupDefault = -1; - m_cStructure->iMaxRecordingsDefault = -1; - } - PVRTimerType(const PVRTimerType& type) : CStructHdl(type) {} - /*! \endcond */ - - /// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType_Help Value Help - /// @ingroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType - /// ---------------------------------------------------------------------------- - /// - /// The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType : - /// | Name | Type | Set call | Get call | Usage - /// |------|------|----------|----------|----------- - /// | **Identifier** | `unsigned int` | @ref PVRTimerType::SetId "SetId" | @ref PVRTimerType::GetId "GetId" | *required to set* - /// | **Attributes** | `unsigned int` | @ref PVRTimerType::SetAttributes "SetAttributes" | @ref PVRTimerType::GetAttributes "GetAttributes" | *required to set* - /// | **Description** | `std::string` | @ref PVRTimerType::SetDescription "SetDescription" | @ref PVRTimerType::GetDescription "GetDescription" | *optional* - /// | | | | | | - /// | **Priority selection** | @ref cpp_kodi_addon_pvr_Defs_PVRTypeIntValue "PVRTypeIntValue" | @ref PVRTimerType::SetPriorities "SetPriorities" | @ref PVRTimerType::GetPriorities "GetPriorities" | *optional* - /// | **Priority default selection** | `int`| @ref PVRTimerType::SetPrioritiesDefault "SetPrioritiesDefault" | @ref PVRTimerType::GetPrioritiesDefault "GetPrioritiesDefault" | *optional* - /// | | | | | | - /// | **Lifetime selection** | @ref cpp_kodi_addon_pvr_Defs_PVRTypeIntValue "PVRTypeIntValue" | @ref PVRTimerType::SetLifetimes "SetLifetimes" | @ref PVRTimerType::GetLifetimes "GetLifetimes" | *optional* - /// | **Lifetime default selection** | `int`| @ref PVRTimerType::SetLifetimesDefault "SetLifetimesDefault" | @ref PVRTimerType::GetLifetimesDefault "GetLifetimesDefault" | *optional* - /// | | | | | | - /// | **Prevent duplicate episodes selection** | @ref cpp_kodi_addon_pvr_Defs_PVRTypeIntValue "PVRTypeIntValue" | @ref PVRTimerType::SetPreventDuplicateEpisodes "SetPreventDuplicateEpisodes" | @ref PVRTimerType::GetPreventDuplicateEpisodes "GetPreventDuplicateEpisodes" | *optional* - /// | **Prevent duplicate episodes default** | `int`| @ref PVRTimerType::SetPreventDuplicateEpisodesDefault "SetPreventDuplicateEpisodesDefault" | @ref PVRTimerType::GetPreventDuplicateEpisodesDefault "GetPreventDuplicateEpisodesDefault" | *optional* - /// | | | | | | - /// | **Recording group selection**| @ref cpp_kodi_addon_pvr_Defs_PVRTypeIntValue "PVRTypeIntValue" | @ref PVRTimerType::SetRecordingGroups "SetRecordingGroups" | @ref PVRTimerType::GetRecordingGroups "GetRecordingGroups" | *optional* - /// | **Recording group default** | `int`| @ref PVRTimerType::SetRecordingGroupDefault "SetRecordingGroupDefault" | @ref PVRTimerType::GetRecordingGroupDefault "GetRecordingGroupDefault" | *optional* - /// | | | | | | - /// | **Max recordings selection** | @ref cpp_kodi_addon_pvr_Defs_PVRTypeIntValue "PVRTypeIntValue" | @ref PVRTimerType::SetMaxRecordings "SetMaxRecordings" | @ref PVRTimerType::GetMaxRecordings "GetMaxRecordings" | *optional* - /// | **Max recordings default** | `int`| @ref PVRTimerType::SetMaxRecordingsDefault "SetMaxRecordingsDefault" | @ref PVRTimerType::GetMaxRecordingsDefault "GetMaxRecordingsDefault" | *optional* - /// - - /// @addtogroup cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType - ///@{ - - /// @brief **required**\n - /// This type's identifier. Ids must be > @ref PVR_TIMER_TYPE_NONE. - void SetId(unsigned int id) { m_cStructure->iId = id; } - - /// @brief To get with @ref SetAttributes changed values. - unsigned int GetId() const { return m_cStructure->iId; } - - /// @brief **required**\n - /// Defines the attributes for this type (@ref cpp_kodi_addon_pvr_Defs_Timer_PVR_TIMER_TYPE "PVR_TIMER_TYPE_*" constants). - /// - /// To defines the attributes for a type. These values are bit fields that can be - /// used together. - /// - ///-------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVRTimerType tag; - /// tag.SetAttributes(PVR_TIMER_TYPE_IS_MANUAL | PVR_TIMER_TYPE_IS_REPEATING); - /// ~~~~~~~~~~~~~ - /// - void SetAttributes(uint64_t attributes) { m_cStructure->iAttributes = attributes; } - - /// @brief To get with @ref SetAttributes changed values. - uint64_t GetAttributes() const { return m_cStructure->iAttributes; } - - /// @brief **optional**\n - /// 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.") - void SetDescription(const std::string& description) - { - strncpy(m_cStructure->strDescription, description.c_str(), - sizeof(m_cStructure->strDescription) - 1); - } - - /// @brief To get with @ref SetDescription changed values. - std::string GetDescription() const { return m_cStructure->strDescription; } - - //---------------------------------------------------------------------------- - - /// @brief **optional**\n - /// Priority value definitions. - /// - /// Array containing the possible values for @ref PVRTimer::SetPriority(). - /// - /// @param[in] priorities List of priority values - /// @param[in] prioritiesDefault [opt] The default value in list, can also be - /// set by @ref SetPrioritiesDefault() - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_PVRTypeIntValue_Help - void SetPriorities(const std::vector& priorities, int prioritiesDefault = -1) - { - m_cStructure->iPrioritiesSize = static_cast(priorities.size()); - for (unsigned int i = 0; - i < m_cStructure->iPrioritiesSize && i < sizeof(m_cStructure->priorities); ++i) - { - m_cStructure->priorities[i].iValue = priorities[i].GetCStructure()->iValue; - strncpy(m_cStructure->priorities[i].strDescription, - priorities[i].GetCStructure()->strDescription, - sizeof(m_cStructure->priorities[i].strDescription) - 1); - } - if (prioritiesDefault != -1) - m_cStructure->iPrioritiesDefault = prioritiesDefault; - } - - /// @brief To get with @ref SetPriorities changed values. - std::vector GetPriorities() const - { - std::vector ret; - for (unsigned int i = 0; i < m_cStructure->iPrioritiesSize; ++i) - ret.emplace_back(m_cStructure->priorities[i].iValue, - m_cStructure->priorities[i].strDescription); - return ret; - } - - /// @brief **optional**\n - /// The default value for @ref PVRTimer::SetPriority(). - /// - /// @note Must be filled if @ref SetPriorities contain values and not - /// defined there on second function value. - void SetPrioritiesDefault(int prioritiesDefault) - { - m_cStructure->iPrioritiesDefault = prioritiesDefault; - } - - /// @brief To get with @ref SetPrioritiesDefault changed values. - int GetPrioritiesDefault() const { return m_cStructure->iPrioritiesDefault; } - - //---------------------------------------------------------------------------- - - /// @brief **optional**\n - /// Lifetime value definitions. - /// - /// Array containing the possible values for @ref PVRTimer::SetLifetime(). - /// - /// @param[in] lifetimes List of lifetimes values - /// @param[in] lifetimesDefault [opt] The default value in list, can also be - /// set by @ref SetLifetimesDefault() - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_PVRTypeIntValue_Help - void SetLifetimes(const std::vector& lifetimes, int lifetimesDefault = -1) - { - m_cStructure->iLifetimesSize = static_cast(lifetimes.size()); - for (unsigned int i = 0; - i < m_cStructure->iLifetimesSize && i < sizeof(m_cStructure->lifetimes); ++i) - { - m_cStructure->lifetimes[i].iValue = lifetimes[i].GetCStructure()->iValue; - strncpy(m_cStructure->lifetimes[i].strDescription, - lifetimes[i].GetCStructure()->strDescription, - sizeof(m_cStructure->lifetimes[i].strDescription) - 1); - } - if (lifetimesDefault != -1) - m_cStructure->iLifetimesDefault = lifetimesDefault; - } - - /// @brief To get with @ref SetLifetimes changed values. - std::vector GetLifetimes() const - { - std::vector ret; - for (unsigned int i = 0; i < m_cStructure->iLifetimesSize; ++i) - ret.emplace_back(m_cStructure->lifetimes[i].iValue, - m_cStructure->lifetimes[i].strDescription); - return ret; - } - - /// @brief **optional**\n - /// The default value for @ref SetLifetimes(). - /// - /// @note Must be filled if @ref SetLifetimes contain values and not - /// defined there on second function value. - void SetLifetimesDefault(int lifetimesDefault) - { - m_cStructure->iLifetimesDefault = lifetimesDefault; - } - - /// @brief To get with @ref SetLifetimesDefault changed values. - int GetLifetimesDefault() const { return m_cStructure->iLifetimesDefault; } - - //---------------------------------------------------------------------------- - - /// @brief **optional**\n - /// Prevent duplicate episodes value definitions. - /// - /// Array containing the possible values for @ref PVRTimer::SetPreventDuplicateEpisodes(). - /// - /// @note Must be filled if @ref PVRTimer::SetPreventDuplicateEpisodes() is not empty. - /// - /// @param[in] preventDuplicateEpisodes List of duplicate episodes values - /// @param[in] preventDuplicateEpisodesDefault [opt] The default value in list, can also be - /// set by @ref SetPreventDuplicateEpisodesDefault() - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_PVRTypeIntValue_Help - void SetPreventDuplicateEpisodes( - const std::vector& preventDuplicateEpisodes, - int preventDuplicateEpisodesDefault = -1) - { - m_cStructure->iPreventDuplicateEpisodesSize = - static_cast(preventDuplicateEpisodes.size()); - for (unsigned int i = 0; i < m_cStructure->iPreventDuplicateEpisodesSize && - i < sizeof(m_cStructure->preventDuplicateEpisodes); - ++i) - { - m_cStructure->preventDuplicateEpisodes[i].iValue = - preventDuplicateEpisodes[i].GetCStructure()->iValue; - strncpy(m_cStructure->preventDuplicateEpisodes[i].strDescription, - preventDuplicateEpisodes[i].GetCStructure()->strDescription, - sizeof(m_cStructure->preventDuplicateEpisodes[i].strDescription) - 1); - } - if (preventDuplicateEpisodesDefault != -1) - m_cStructure->iPreventDuplicateEpisodesDefault = preventDuplicateEpisodesDefault; - } - - /// @brief To get with @ref SetPreventDuplicateEpisodes changed values. - std::vector GetPreventDuplicateEpisodes() const - { - std::vector ret; - for (unsigned int i = 0; i < m_cStructure->iPreventDuplicateEpisodesSize; ++i) - ret.emplace_back(m_cStructure->preventDuplicateEpisodes[i].iValue, - m_cStructure->preventDuplicateEpisodes[i].strDescription); - return ret; - } - - /// @brief **optional**\n - /// The default value for @ref PVRTimer::SetPreventDuplicateEpisodes(). - /// - /// @note Must be filled if @ref SetPreventDuplicateEpisodes contain values and not - /// defined there on second function value. - void SetPreventDuplicateEpisodesDefault(int preventDuplicateEpisodesDefault) - { - m_cStructure->iPreventDuplicateEpisodesDefault = preventDuplicateEpisodesDefault; - } - - /// @brief To get with @ref SetPreventDuplicateEpisodesDefault changed values. - int GetPreventDuplicateEpisodesDefault() const - { - return m_cStructure->iPreventDuplicateEpisodesDefault; - } - - //---------------------------------------------------------------------------- - - /// @brief **optional**\n - /// Array containing the possible values of @ref PVRTimer::SetRecordingGroup() - /// - /// @param[in] recordingGroup List of recording group values - /// @param[in] recordingGroupDefault [opt] The default value in list, can also be - /// set by @ref SetRecordingGroupDefault() - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_PVRTypeIntValue_Help - void SetRecordingGroups(const std::vector& recordingGroup, - int recordingGroupDefault = -1) - { - m_cStructure->iRecordingGroupSize = static_cast(recordingGroup.size()); - for (unsigned int i = 0; - i < m_cStructure->iRecordingGroupSize && i < sizeof(m_cStructure->recordingGroup); ++i) - { - m_cStructure->recordingGroup[i].iValue = recordingGroup[i].GetCStructure()->iValue; - strncpy(m_cStructure->recordingGroup[i].strDescription, - recordingGroup[i].GetCStructure()->strDescription, - sizeof(m_cStructure->recordingGroup[i].strDescription) - 1); - } - if (recordingGroupDefault != -1) - m_cStructure->iRecordingGroupDefault = recordingGroupDefault; - } - - /// @brief To get with @ref SetRecordingGroups changed values - std::vector GetRecordingGroups() const - { - std::vector ret; - for (unsigned int i = 0; i < m_cStructure->iRecordingGroupSize; ++i) - ret.emplace_back(m_cStructure->recordingGroup[i].iValue, - m_cStructure->recordingGroup[i].strDescription); - return ret; - } - - /// @brief **optional**\n - /// The default value for @ref PVRTimer::SetRecordingGroup(). - /// - /// @note Must be filled if @ref SetRecordingGroups contain values and not - /// defined there on second function value. - void SetRecordingGroupDefault(int recordingGroupDefault) - { - m_cStructure->iRecordingGroupDefault = recordingGroupDefault; - } - - /// @brief To get with @ref SetRecordingGroupDefault changed values - int GetRecordingGroupDefault() const { return m_cStructure->iRecordingGroupDefault; } - - //---------------------------------------------------------------------------- - - /// @brief **optional**\n - /// Array containing the possible values of @ref PVRTimer::SetMaxRecordings(). - /// - /// @param[in] maxRecordings List of lifetimes values - /// @param[in] maxRecordingsDefault [opt] The default value in list, can also be - /// set by @ref SetMaxRecordingsDefault() - /// - /// -------------------------------------------------------------------------- - /// - /// @copydetails cpp_kodi_addon_pvr_Defs_PVRTypeIntValue_Help - void SetMaxRecordings(const std::vector& maxRecordings, - int maxRecordingsDefault = -1) - { - m_cStructure->iMaxRecordingsSize = static_cast(maxRecordings.size()); - for (unsigned int i = 0; - i < m_cStructure->iMaxRecordingsSize && i < sizeof(m_cStructure->maxRecordings); ++i) - { - m_cStructure->maxRecordings[i].iValue = maxRecordings[i].GetCStructure()->iValue; - strncpy(m_cStructure->maxRecordings[i].strDescription, - maxRecordings[i].GetCStructure()->strDescription, - sizeof(m_cStructure->maxRecordings[i].strDescription) - 1); - } - if (maxRecordingsDefault != -1) - m_cStructure->iMaxRecordingsDefault = maxRecordingsDefault; - } - - /// @brief To get with @ref SetMaxRecordings changed values - std::vector GetMaxRecordings() const - { - std::vector ret; - for (unsigned int i = 0; i < m_cStructure->iMaxRecordingsSize; ++i) - ret.emplace_back(m_cStructure->maxRecordings[i].iValue, - m_cStructure->maxRecordings[i].strDescription); - return ret; - } - - /// @brief **optional**\n - /// The default value for @ref SetMaxRecordings(). - /// - /// Can be set with here if on @ref SetMaxRecordings not given as second value. - void SetMaxRecordingsDefault(int maxRecordingsDefault) - { - m_cStructure->iMaxRecordingsDefault = maxRecordingsDefault; - } - - /// @brief To get with @ref SetMaxRecordingsDefault changed values - int GetMaxRecordingsDefault() const { return m_cStructure->iMaxRecordingsDefault; } - ///@} - -private: - PVRTimerType(const PVR_TIMER_TYPE* type) : CStructHdl(type) {} - PVRTimerType(PVR_TIMER_TYPE* type) : CStructHdl(type) {} -}; -///@} -//------------------------------------------------------------------------------ - -} /* namespace addon */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/CMakeLists.txt deleted file mode 100644 index d7b2269..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(HEADERS addon_base.h - audio_engine.h - filesystem.h - general.h - network.h) - -if(NOT ENABLE_STATIC_LIBS) - core_add_library(addons_kodi-addon-dev-kit_include_kodi_c-api) -endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/CMakeLists.txt deleted file mode 100644 index dfcfe66..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -set(HEADERS image_decoder.h - pvr.h) - -if(NOT ENABLE_STATIC_LIBS) - core_add_library(addons_kodi-addon-dev-kit_include_kodi_c-api_addon-instance) -endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/image_decoder.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/image_decoder.h deleted file mode 100644 index 595a5dc..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/image_decoder.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../addon_base.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //============================================================================ - /// @ingroup cpp_kodi_addon_imagedecoder_Defs - /// @brief **Image format types**\n - /// Used to define wanted target format where image decoder should give to - /// Kodi. - /// - typedef enum ImageFormat - { - /// @brief A 32-bit ARGB pixel format, with alpha, that uses 8 bits per - /// channel, ARGBARGB... - ADDON_IMG_FMT_A8R8G8B8 = 1, - - /// @brief A 8, alpha only, 8bpp, AAA... - ADDON_IMG_FMT_A8 = 2, - - /// @brief RGBA 8:8:8:8, with alpha, 32bpp, RGBARGBA... - ADDON_IMG_FMT_RGBA8 = 3, - - /// @brief RGB 8:8:8, with alpha, 24bpp, RGBRGB... - ADDON_IMG_FMT_RGB8 = 4 - } ImageFormat; - //---------------------------------------------------------------------------- - - typedef struct AddonProps_ImageDecoder - { - const char* mimetype; - } AddonProps_ImageDecoder; - - typedef struct AddonToKodiFuncTable_ImageDecoder - { - KODI_HANDLE kodi_instance; - } AddonToKodiFuncTable_ImageDecoder; - - struct AddonInstance_ImageDecoder; - typedef struct KodiToAddonFuncTable_ImageDecoder - { - KODI_HANDLE addonInstance; - bool(__cdecl* load_image_from_memory)(const struct AddonInstance_ImageDecoder* instance, - unsigned char* buffer, - unsigned int buf_size, - unsigned int* width, - unsigned int* height); - - bool(__cdecl* decode)(const struct AddonInstance_ImageDecoder* instance, - unsigned char* pixels, - unsigned int width, - unsigned int height, - unsigned int pitch, - enum ImageFormat format); - } KodiToAddonFuncTable_ImageDecoder; - - typedef struct AddonInstance_ImageDecoder - { - struct AddonProps_ImageDecoder* props; - struct AddonToKodiFuncTable_ImageDecoder* toKodi; - struct KodiToAddonFuncTable_ImageDecoder* toAddon; - } AddonInstance_ImageDecoder; - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr.h deleted file mode 100644 index 2d255ad..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr.h +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "pvr/pvr_channel_groups.h" -#include "pvr/pvr_channels.h" -#include "pvr/pvr_defines.h" -#include "pvr/pvr_edl.h" -#include "pvr/pvr_epg.h" -#include "pvr/pvr_general.h" -#include "pvr/pvr_menu_hook.h" -#include "pvr/pvr_recordings.h" -#include "pvr/pvr_stream.h" -#include "pvr/pvr_timers.h" - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C" main interface function tables between Kodi and addon -// -// Values related to all parts and not used direct on addon, are to define here. -// -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - /*! - * @internal - * @brief PVR "C" basis API interface - * - * This field contains things that are exchanged between Kodi and Addon - * and is the basis of the PVR-side "C" API. - * - * @warning Care should be taken when making changes in this fields!\n - * Changes can destroy API in addons that have already been created. If a - * necessary change or new feature is added, the version of the PVR - * at @ref ADDON_INSTANCE_VERSION_PVR_MIN must be increased too.\n - * \n - * Conditional changes can be made in some places, without min PVR version - * increase. The add-on should then use CreateInstanceEx and add partial tests - * for this in the C++ header. - * - * Have by add of new parts a look about **Doxygen** `\\ingroup`, so that - * added parts included in documentation. - * - * If you add addon side related documentation, where his dev need know, - * use `///`. For parts only for Kodi make it like here. - * - * @endinternal - */ - - struct AddonInstance_PVR; - - /*! - * @brief Structure to define typical standard values - */ - typedef struct AddonProperties_PVR - { - const char* strUserPath; - const char* strClientPath; - int iEpgMaxDays; - } AddonProperties_PVR; - - /*! - * @brief Structure to transfer the methods from Kodi to addon - */ - typedef struct AddonToKodiFuncTable_PVR - { - // Pointer inside Kodi where used from him to find his class - KODI_HANDLE kodiInstance; - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // General callback functions - void (*AddMenuHook)(void* kodiInstance, const struct PVR_MENUHOOK* hook); - void (*RecordingNotification)(void* kodiInstance, - const char* name, - const char* fileName, - bool on); - void (*ConnectionStateChange)(void* kodiInstance, - const char* strConnectionString, - enum PVR_CONNECTION_STATE newState, - const char* strMessage); - void (*EpgEventStateChange)(void* kodiInstance, - struct EPG_TAG* tag, - enum EPG_EVENT_STATE newState); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // Transfer functions where give data back to Kodi, e.g. GetChannels calls TransferChannelEntry - void (*TransferChannelEntry)(void* kodiInstance, - const ADDON_HANDLE handle, - const struct PVR_CHANNEL* chan); - void (*TransferChannelGroup)(void* kodiInstance, - const ADDON_HANDLE handle, - const struct PVR_CHANNEL_GROUP* group); - void (*TransferChannelGroupMember)(void* kodiInstance, - const ADDON_HANDLE handle, - const struct PVR_CHANNEL_GROUP_MEMBER* member); - void (*TransferEpgEntry)(void* kodiInstance, - const ADDON_HANDLE handle, - const struct EPG_TAG* epgentry); - void (*TransferRecordingEntry)(void* kodiInstance, - const ADDON_HANDLE handle, - const struct PVR_RECORDING* recording); - void (*TransferTimerEntry)(void* kodiInstance, - const ADDON_HANDLE handle, - const struct PVR_TIMER* timer); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // Kodi inform interface functions - void (*TriggerChannelUpdate)(void* kodiInstance); - void (*TriggerChannelGroupsUpdate)(void* kodiInstance); - void (*TriggerEpgUpdate)(void* kodiInstance, unsigned int iChannelUid); - void (*TriggerRecordingUpdate)(void* kodiInstance); - void (*TriggerTimerUpdate)(void* kodiInstance); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // Stream demux interface functions - void (*FreeDemuxPacket)(void* kodiInstance, struct DemuxPacket* pPacket); - struct DemuxPacket* (*AllocateDemuxPacket)(void* kodiInstance, int iDataSize); - struct PVR_CODEC (*GetCodecByName)(const void* kodiInstance, const char* strCodecName); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // New functions becomes added below and can be on another API change (where - // breaks min API version) moved up. - } AddonToKodiFuncTable_PVR; - - /*! - * @brief Structure to transfer the methods from addon to Kodi - */ - typedef struct KodiToAddonFuncTable_PVR - { - // Pointer inside addon where used on them to find his instance class (currently unused!) - KODI_HANDLE addonInstance; - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // General interface functions - enum PVR_ERROR(__cdecl* GetCapabilities)(const struct AddonInstance_PVR*, - struct PVR_ADDON_CAPABILITIES*); - enum PVR_ERROR(__cdecl* GetBackendName)(const struct AddonInstance_PVR*, char*, int); - enum PVR_ERROR(__cdecl* GetBackendVersion)(const struct AddonInstance_PVR*, char*, int); - enum PVR_ERROR(__cdecl* GetBackendHostname)(const struct AddonInstance_PVR*, char*, int); - enum PVR_ERROR(__cdecl* GetConnectionString)(const struct AddonInstance_PVR*, char*, int); - enum PVR_ERROR(__cdecl* GetDriveSpace)(const struct AddonInstance_PVR*, uint64_t*, uint64_t*); - enum PVR_ERROR(__cdecl* CallSettingsMenuHook)(const struct AddonInstance_PVR*, - const struct PVR_MENUHOOK*); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // Channel interface functions - - enum PVR_ERROR(__cdecl* GetChannelsAmount)(const struct AddonInstance_PVR*, int*); - enum PVR_ERROR(__cdecl* GetChannels)(const struct AddonInstance_PVR*, ADDON_HANDLE, bool); - enum PVR_ERROR(__cdecl* GetChannelStreamProperties)(const struct AddonInstance_PVR*, - const struct PVR_CHANNEL*, - struct PVR_NAMED_VALUE*, - unsigned int*); - enum PVR_ERROR(__cdecl* GetSignalStatus)(const struct AddonInstance_PVR*, - int, - struct PVR_SIGNAL_STATUS*); - enum PVR_ERROR(__cdecl* GetDescrambleInfo)(const struct AddonInstance_PVR*, - int, - struct PVR_DESCRAMBLE_INFO*); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // Channel group interface functions - enum PVR_ERROR(__cdecl* GetChannelGroupsAmount)(const struct AddonInstance_PVR*, int*); - enum PVR_ERROR(__cdecl* GetChannelGroups)(const struct AddonInstance_PVR*, ADDON_HANDLE, bool); - enum PVR_ERROR(__cdecl* GetChannelGroupMembers)(const struct AddonInstance_PVR*, - ADDON_HANDLE, - const struct PVR_CHANNEL_GROUP*); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // Channel edit interface functions - enum PVR_ERROR(__cdecl* DeleteChannel)(const struct AddonInstance_PVR*, - const struct PVR_CHANNEL*); - enum PVR_ERROR(__cdecl* RenameChannel)(const struct AddonInstance_PVR*, - const struct PVR_CHANNEL*); - enum PVR_ERROR(__cdecl* OpenDialogChannelSettings)(const struct AddonInstance_PVR*, - const struct PVR_CHANNEL*); - enum PVR_ERROR(__cdecl* OpenDialogChannelAdd)(const struct AddonInstance_PVR*, - const struct PVR_CHANNEL*); - enum PVR_ERROR(__cdecl* OpenDialogChannelScan)(const struct AddonInstance_PVR*); - enum PVR_ERROR(__cdecl* CallChannelMenuHook)(const struct AddonInstance_PVR*, - const PVR_MENUHOOK*, - const PVR_CHANNEL*); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // EPG interface functions - enum PVR_ERROR(__cdecl* GetEPGForChannel)( - const struct AddonInstance_PVR*, ADDON_HANDLE, int, time_t, time_t); - enum PVR_ERROR(__cdecl* IsEPGTagRecordable)(const struct AddonInstance_PVR*, - const struct EPG_TAG*, - bool*); - enum PVR_ERROR(__cdecl* IsEPGTagPlayable)(const struct AddonInstance_PVR*, - const struct EPG_TAG*, - bool*); - enum PVR_ERROR(__cdecl* GetEPGTagEdl)(const struct AddonInstance_PVR*, - const struct EPG_TAG*, - struct PVR_EDL_ENTRY[], - int*); - enum PVR_ERROR(__cdecl* GetEPGTagStreamProperties)(const struct AddonInstance_PVR*, - const struct EPG_TAG*, - struct PVR_NAMED_VALUE*, - unsigned int*); - enum PVR_ERROR(__cdecl* SetEPGTimeFrame)(const struct AddonInstance_PVR*, int); - enum PVR_ERROR(__cdecl* CallEPGMenuHook)(const struct AddonInstance_PVR*, - const struct PVR_MENUHOOK*, - const struct EPG_TAG*); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // Recording interface functions - enum PVR_ERROR(__cdecl* GetRecordingsAmount)(const struct AddonInstance_PVR*, bool, int*); - enum PVR_ERROR(__cdecl* GetRecordings)(const struct AddonInstance_PVR*, ADDON_HANDLE, bool); - enum PVR_ERROR(__cdecl* DeleteRecording)(const struct AddonInstance_PVR*, - const struct PVR_RECORDING*); - enum PVR_ERROR(__cdecl* UndeleteRecording)(const struct AddonInstance_PVR*, - const struct PVR_RECORDING*); - enum PVR_ERROR(__cdecl* DeleteAllRecordingsFromTrash)(const struct AddonInstance_PVR*); - enum PVR_ERROR(__cdecl* RenameRecording)(const struct AddonInstance_PVR*, - const struct PVR_RECORDING*); - enum PVR_ERROR(__cdecl* SetRecordingLifetime)(const struct AddonInstance_PVR*, - const struct PVR_RECORDING*); - enum PVR_ERROR(__cdecl* SetRecordingPlayCount)(const struct AddonInstance_PVR*, - const struct PVR_RECORDING*, - int); - enum PVR_ERROR(__cdecl* SetRecordingLastPlayedPosition)(const struct AddonInstance_PVR*, - const struct PVR_RECORDING*, - int); - enum PVR_ERROR(__cdecl* GetRecordingLastPlayedPosition)(const struct AddonInstance_PVR*, - const struct PVR_RECORDING*, - int*); - enum PVR_ERROR(__cdecl* GetRecordingEdl)(const struct AddonInstance_PVR*, - const struct PVR_RECORDING*, - struct PVR_EDL_ENTRY[], - int*); - enum PVR_ERROR(__cdecl* GetRecordingSize)(const struct AddonInstance_PVR*, - const PVR_RECORDING*, - int64_t*); - enum PVR_ERROR(__cdecl* GetRecordingStreamProperties)(const struct AddonInstance_PVR*, - const struct PVR_RECORDING*, - struct PVR_NAMED_VALUE*, - unsigned int*); - enum PVR_ERROR(__cdecl* CallRecordingMenuHook)(const struct AddonInstance_PVR*, - const struct PVR_MENUHOOK*, - const struct PVR_RECORDING*); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // Timer interface functions - enum PVR_ERROR(__cdecl* GetTimerTypes)(const struct AddonInstance_PVR*, - struct PVR_TIMER_TYPE[], - int*); - enum PVR_ERROR(__cdecl* GetTimersAmount)(const struct AddonInstance_PVR*, int*); - enum PVR_ERROR(__cdecl* GetTimers)(const struct AddonInstance_PVR*, ADDON_HANDLE); - enum PVR_ERROR(__cdecl* AddTimer)(const struct AddonInstance_PVR*, const struct PVR_TIMER*); - enum PVR_ERROR(__cdecl* DeleteTimer)(const struct AddonInstance_PVR*, - const struct PVR_TIMER*, - bool); - enum PVR_ERROR(__cdecl* UpdateTimer)(const struct AddonInstance_PVR*, const struct PVR_TIMER*); - enum PVR_ERROR(__cdecl* CallTimerMenuHook)(const struct AddonInstance_PVR*, - const struct PVR_MENUHOOK*, - const struct PVR_TIMER*); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // Powersaving interface functions - enum PVR_ERROR(__cdecl* OnSystemSleep)(const struct AddonInstance_PVR*); - enum PVR_ERROR(__cdecl* OnSystemWake)(const struct AddonInstance_PVR*); - enum PVR_ERROR(__cdecl* OnPowerSavingActivated)(const struct AddonInstance_PVR*); - enum PVR_ERROR(__cdecl* OnPowerSavingDeactivated)(const struct AddonInstance_PVR*); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // Live stream read interface functions - bool(__cdecl* OpenLiveStream)(const struct AddonInstance_PVR*, const struct PVR_CHANNEL*); - void(__cdecl* CloseLiveStream)(const struct AddonInstance_PVR*); - int(__cdecl* ReadLiveStream)(const struct AddonInstance_PVR*, unsigned char*, unsigned int); - int64_t(__cdecl* SeekLiveStream)(const struct AddonInstance_PVR*, int64_t, int); - int64_t(__cdecl* LengthLiveStream)(const struct AddonInstance_PVR*); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // Recording stream read interface functions - bool(__cdecl* OpenRecordedStream)(const struct AddonInstance_PVR*, const struct PVR_RECORDING*); - void(__cdecl* CloseRecordedStream)(const struct AddonInstance_PVR*); - int(__cdecl* ReadRecordedStream)(const struct AddonInstance_PVR*, unsigned char*, unsigned int); - int64_t(__cdecl* SeekRecordedStream)(const struct AddonInstance_PVR*, int64_t, int); - int64_t(__cdecl* LengthRecordedStream)(const struct AddonInstance_PVR*); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // Stream demux interface functions - enum PVR_ERROR(__cdecl* GetStreamProperties)(const struct AddonInstance_PVR*, - struct PVR_STREAM_PROPERTIES*); - struct DemuxPacket*(__cdecl* DemuxRead)(const struct AddonInstance_PVR*); - void(__cdecl* DemuxReset)(const struct AddonInstance_PVR*); - void(__cdecl* DemuxAbort)(const struct AddonInstance_PVR*); - void(__cdecl* DemuxFlush)(const struct AddonInstance_PVR*); - void(__cdecl* SetSpeed)(const struct AddonInstance_PVR*, int); - void(__cdecl* FillBuffer)(const struct AddonInstance_PVR*, bool); - bool(__cdecl* SeekTime)(const struct AddonInstance_PVR*, double, bool, double*); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // General stream interface functions - bool(__cdecl* CanPauseStream)(const struct AddonInstance_PVR*); - void(__cdecl* PauseStream)(const struct AddonInstance_PVR*, bool); - bool(__cdecl* CanSeekStream)(const struct AddonInstance_PVR*); - bool(__cdecl* IsRealTimeStream)(const struct AddonInstance_PVR*); - enum PVR_ERROR(__cdecl* GetStreamTimes)(const struct AddonInstance_PVR*, - struct PVR_STREAM_TIMES*); - enum PVR_ERROR(__cdecl* GetStreamReadChunkSize)(const struct AddonInstance_PVR*, int*); - - //--==----==----==----==----==----==----==----==----==----==----==----==----== - // New functions becomes added below and can be on another API change (where - // breaks min API version) moved up. - } KodiToAddonFuncTable_PVR; - - typedef struct AddonInstance_PVR - { - struct AddonProperties_PVR* props; - struct AddonToKodiFuncTable_PVR* toKodi; - struct KodiToAddonFuncTable_PVR* toAddon; - } AddonInstance_PVR; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/CMakeLists.txt deleted file mode 100644 index 6617084..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(HEADERS pvr_channel_groups.h - pvr_channels.h - pvr_defines.h - pvr_edl.h - pvr_epg.h - pvr_general.h - pvr_menu_hook.h - pvr_recordings.h - pvr_stream.h - pvr_timers.h) - -if(NOT ENABLE_STATIC_LIBS) - core_add_library(addons_kodi-addon-dev-kit_include_kodi_c-api_addon-instance_pvr) -endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_channel_groups.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_channel_groups.h deleted file mode 100644 index 36f9ed6..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_channel_groups.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "pvr_defines.h" - -#include - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C" Definitions group 3 - PVR channel group -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - /*! - * @brief "C" PVR add-on channel group. - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref kodi::addon::PVRChannelGroup for description of values. - */ - typedef struct PVR_CHANNEL_GROUP - { - char strGroupName[PVR_ADDON_NAME_STRING_LENGTH]; - bool bIsRadio; - unsigned int iPosition; - } PVR_CHANNEL_GROUP; - - /*! - * @brief "C" PVR add-on channel group member. - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref kodi::addon::PVRChannelGroupMember for description of values. - */ - typedef struct PVR_CHANNEL_GROUP_MEMBER - { - char strGroupName[PVR_ADDON_NAME_STRING_LENGTH]; - unsigned int iChannelUniqueId; - unsigned int iChannelNumber; - unsigned int iSubChannelNumber; - int iOrder; - } PVR_CHANNEL_GROUP_MEMBER; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_channels.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_channels.h deleted file mode 100644 index a2ce591..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_channels.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "pvr_defines.h" - -#include - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C" Definitions group 2 - PVR channel -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_Channel - /// @brief Denotes that no channel uid is available. - /// - /// Special @ref kodi::addon::PVRTimer::SetClientChannelUid() and - /// @ref kodi::addon::PVRRecording::SetChannelUid() value to indicate that no - /// channel uid is available. - #define PVR_CHANNEL_INVALID_UID -1 - //---------------------------------------------------------------------------- - - /*! - * @brief "C" PVR add-on channel. - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref kodi::addon::PVRChannel for description of values. - */ - typedef struct PVR_CHANNEL - { - unsigned int iUniqueId; - bool bIsRadio; - unsigned int iChannelNumber; - unsigned int iSubChannelNumber; - char strChannelName[PVR_ADDON_NAME_STRING_LENGTH]; - char strMimeType[PVR_ADDON_INPUT_FORMAT_STRING_LENGTH]; - unsigned int iEncryptionSystem; - char strIconPath[PVR_ADDON_URL_STRING_LENGTH]; - bool bIsHidden; - bool bHasArchive; - int iOrder; - } PVR_CHANNEL; - - /*! - * @brief "C" PVR add-on signal status information. - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref kodi::addon::PVRSignalStatus for description of values. - */ - typedef struct PVR_SIGNAL_STATUS - { - char strAdapterName[PVR_ADDON_NAME_STRING_LENGTH]; - char strAdapterStatus[PVR_ADDON_NAME_STRING_LENGTH]; - char strServiceName[PVR_ADDON_NAME_STRING_LENGTH]; - char strProviderName[PVR_ADDON_NAME_STRING_LENGTH]; - char strMuxName[PVR_ADDON_NAME_STRING_LENGTH]; - int iSNR; - int iSignal; - long iBER; - long iUNC; - } PVR_SIGNAL_STATUS; - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_Channel_PVRDescrambleInfo - /// @brief Special @ref cpp_kodi_addon_pvr_Defs_Channel_PVRDescrambleInfo - /// value to indicate that a struct member's value is not available - /// - #define PVR_DESCRAMBLE_INFO_NOT_AVAILABLE -1 - //---------------------------------------------------------------------------- - - /*! - * @brief "C" PVR add-on descramble information. - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref kodi::addon::PVRDescrambleInfo for description of values. - */ - typedef struct PVR_DESCRAMBLE_INFO - { - int iPid; - int iCaid; - int iProvid; - int iEcmTime; - int iHops; - char strCardSystem[PVR_ADDON_DESCRAMBLE_INFO_STRING_LENGTH]; - char strReader[PVR_ADDON_DESCRAMBLE_INFO_STRING_LENGTH]; - char strFrom[PVR_ADDON_DESCRAMBLE_INFO_STRING_LENGTH]; - char strProtocol[PVR_ADDON_DESCRAMBLE_INFO_STRING_LENGTH]; - } PVR_DESCRAMBLE_INFO; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_defines.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_defines.h deleted file mode 100644 index af1daae..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_defines.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C" Standard PVR definitions -// -// Values related to all parts and not used direct on addon, are to define here. -// -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - /*! - * @brief API array sizes which are used for data exchange between - * Kodi and addon. - */ - ///@{ - #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 128 - #define PVR_ADDON_ATTRIBUTE_DESC_LENGTH 128 - #define PVR_ADDON_ATTRIBUTE_VALUES_ARRAY_SIZE 512 - #define PVR_ADDON_DESCRAMBLE_INFO_STRING_LENGTH 64 - #define PVR_ADDON_DATE_STRING_LENGTH 32 - ///@} - - /*! - * @brief "C" Representation of a general attribute integer value. - */ - typedef struct PVR_ATTRIBUTE_INT_VALUE - { - int iValue; - char strDescription[PVR_ADDON_ATTRIBUTE_DESC_LENGTH]; - } PVR_ATTRIBUTE_INT_VALUE; - - /*! - * @brief "C" Representation of a named value. - */ - typedef struct PVR_NAMED_VALUE - { - char strName[PVR_ADDON_NAME_STRING_LENGTH]; - char strValue[PVR_ADDON_NAME_STRING_LENGTH]; - } PVR_NAMED_VALUE; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_edl.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_edl.h deleted file mode 100644 index 8378eaf..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_edl.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "pvr_defines.h" - -#include - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C" Definitions group 8 - PVR Edit definition list (EDL) -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_EDLEntry_PVR_EDL_TYPE enum PVR_EDL_TYPE - /// @ingroup cpp_kodi_addon_pvr_Defs_EDLEntry - /// @brief **Edit definition list types**\n - /// Possible type values for @ref cpp_kodi_addon_pvr_Defs_EDLEntry_PVREDLEntry. - /// - ///@{ - typedef enum PVR_EDL_TYPE - { - /// @brief __0__ : cut (completely remove content) - PVR_EDL_TYPE_CUT = 0, - - /// @brief __1__ : mute audio - PVR_EDL_TYPE_MUTE = 1, - - /// @brief __2__ : scene markers (chapter seeking) - PVR_EDL_TYPE_SCENE = 2, - - /// @brief __3__ : commercial breaks - PVR_EDL_TYPE_COMBREAK = 3 - } PVR_EDL_TYPE; - ///@} - //---------------------------------------------------------------------------- - - /*! - * @brief "C" Edit definition list entry. - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref kodi::addon::PVREDLEntry for description of values. - */ - typedef struct PVR_EDL_ENTRY - { - int64_t start; - int64_t end; - enum PVR_EDL_TYPE type; - } PVR_EDL_ENTRY; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_epg.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_epg.h deleted file mode 100644 index 57c603f..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_epg.h +++ /dev/null @@ -1,653 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "pvr_defines.h" - -#include - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C" Definitions group 4 - PVR EPG -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT enum EPG_EVENT_CONTENTMASK (and sub types) - /// @ingroup cpp_kodi_addon_pvr_Defs_epg - /// @brief **EPG entry content event types.**\n - /// These ID's come from the DVB-SI EIT table "content descriptor" - /// Also known under the name "E-book genre assignments". - /// - /// See [ETSI EN 300 468 V1.14.1 (2014-05)](https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.14.01_60/en_300468v011401p.pdf) - /// about. - /// - /// Values used by this functions: - /// - @ref kodi::addon::PVREPGTag::SetGenreType() - /// - @ref kodi::addon::PVREPGTag::SetGenreSubType() - /// - @ref kodi::addon::PVRRecording::SetGenreType() - /// - @ref kodi::addon::PVRRecording::SetGenreSubType() - /// - /// Following types are listed here: - /// | emum Type | Description - /// |-----------|-------------------- - /// | @ref EPG_EVENT_CONTENTMASK | EPG entry main content to use. - /// | @ref EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA | EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_MOVIEDRAMA event types for sub type of "Movie/Drama". - /// | @ref EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS | EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS event types for sub type of "News/Current affairs". - /// | @ref EPG_EVENT_CONTENTSUBMASK_SHOW | EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_SHOW event types for sub type of "Show/Game show". - /// | @ref EPG_EVENT_CONTENTSUBMASK_SPORTS | @brief EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_SPORTS event types for sub type of "Sports". - /// | @ref EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH | EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_CHILDRENYOUTH event types for sub type of "Children's/Youth programmes". - /// | @ref EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE | EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE event types for sub type of "Music/Ballet/Dance". - /// | @ref EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE | EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_ARTSCULTURE event types for sub type of "Arts/Culture (without music)". - /// | @ref EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS | EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS event types for sub type of "Social/Political issues/Economics". - /// | @ref EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE | EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE event types for sub type of "Education/Science/Factual topics". - /// | @ref EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES | EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_LEISUREHOBBIES event types for sub type of "Leisure hobbies". - /// | @ref EPG_EVENT_CONTENTSUBMASK_SPECIAL | EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_SPECIAL event types for sub type of "Special characteristics". - ///@{ - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT - /// @brief EPG entry main content to use. - /// - ///@{ - typedef enum EPG_EVENT_CONTENTMASK - { - /// @brief __0x00__ : Undefined content mask entry. - EPG_EVENT_CONTENTMASK_UNDEFINED = 0x00, - - /// @brief __0x10__ : Movie/Drama.\n - /// \n - /// See @ref EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA about related sub types. - EPG_EVENT_CONTENTMASK_MOVIEDRAMA = 0x10, - - /// @brief __0x20__ : News/Current affairs.\n - /// \n - /// See @ref EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS about related sub types. - EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS = 0x20, - - /// @brief __0x30__ : Show/Game show.\n - /// \n - /// See @ref EPG_EVENT_CONTENTSUBMASK_SHOW about related sub types. - EPG_EVENT_CONTENTMASK_SHOW = 0x30, - - /// @brief __0x40__ : Sports.\n - /// \n - /// See @ref EPG_EVENT_CONTENTSUBMASK_SPORTS about related sub types. - EPG_EVENT_CONTENTMASK_SPORTS = 0x40, - - /// @brief __0x50__ : Children's/Youth programmes.\n - /// \n - /// See @ref EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH about related sub types. - EPG_EVENT_CONTENTMASK_CHILDRENYOUTH = 0x50, - - /// @brief __0x60__ : Music/Ballet/Dance.\n - /// \n - /// See @ref EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE about related sub types. - EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE = 0x60, - - /// @brief __0x70__ : Arts/Culture (without music).\n - /// \n - /// See @ref EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE about related sub types. - EPG_EVENT_CONTENTMASK_ARTSCULTURE = 0x70, - - /// @brief __0x80__ : Social/Political issues/Economics.\n - /// \n - /// See @ref EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS about related sub types. - EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS = 0x80, - - /// @brief __0x90__ : Education/Science/Factual topics.\n - /// \n - /// See @ref EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE about related sub types. - EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE = 0x90, - - /// @brief __0xA0__ : Leisure hobbies.\n - /// \n - /// See @ref EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES about related sub types. - EPG_EVENT_CONTENTMASK_LEISUREHOBBIES = 0xA0, - - /// @brief __0xB0__ : Special characteristics.\n - /// \n - /// See @ref EPG_EVENT_CONTENTSUBMASK_SPECIAL about related sub types. - EPG_EVENT_CONTENTMASK_SPECIAL = 0xB0, - - /// @brief __0xF0__ User defined. - EPG_EVENT_CONTENTMASK_USERDEFINED = 0xF0, - - /// @brief Used to override standard genre types with a own name about.\n - /// \n - /// Set to this value @ref EPG_GENRE_USE_STRING on following places: - /// - @ref kodi::addon::PVREPGTag::SetGenreType() - /// - @ref kodi::addon::PVREPGTag::SetGenreSubType() - /// - @ref kodi::addon::PVRRecording::SetGenreType() - /// - @ref kodi::addon::PVRRecording::SetGenreSubType() - /// - /// @warning Value here is not a [ETSI EN 300 468 V1.14.1 (2014-05)](https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.14.01_60/en_300468v011401p.pdf) - /// conform. - /// - /// @note This is a own Kodi definition to set that genre is given by own - /// string. Used on @ref kodi::addon::PVREPGTag::SetGenreDescription() and - /// @ref kodi::addon::PVRRecording::SetGenreDescription() - EPG_GENRE_USE_STRING = 0x100 - } EPG_EVENT_CONTENTMASK; - ///@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT - /// @brief EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_MOVIEDRAMA event - /// types for sub type of "Movie/Drama". - /// - ///@{ - typedef enum EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA - { - /// @brief __0x0__ : Movie/drama (general). - EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA_GENERAL = 0x0, - - /// @brief __0x1__ : Detective/thriller. - EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA_DETECTIVE_THRILLER = 0x1, - - /// @brief __0x2__ : Adventure/western/war. - EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA_ADVENTURE_WESTERN_WAR = 0x2, - - /// @brief __0x3__ : Science fiction/fantasy/horror. - EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA_SCIENCEFICTION_FANTASY_HORROR = 0x3, - - /// @brief __0x4__ : Comedy. - EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA_COMEDY = 0x4, - - /// @brief __0x5__ : Soap/melodrama/folkloric. - EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA_SOAP_MELODRAMA_FOLKLORIC = 0x5, - - /// @brief __0x6__ : Romance. - EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA_ROMANCE = 0x6, - - /// @brief __0x7__ : Serious/classical/religious/historical movie/drama. - EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA_SERIOUS_CLASSICAL_RELIGIOUS_HISTORICAL = 0x7, - - /// @brief __0x8__ : Adult movie/drama. - EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA_ADULT = 0x8, - - /// @brief __0xF__ : User defined. - EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA_USERDEFINED = 0xF - } EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA; - ///@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT - /// @brief EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS event - /// types for sub type of "News/Current affairs". - /// - typedef enum EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS - { - /// @brief __0x0__ : News/current affairs (general). - EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS_GENERAL = 0x0, - - /// @brief __0x1__ : News/weather report. - EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS_WEATHER = 0x1, - - /// @brief __0x2__ : News magazine. - EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS_MAGAZINE = 0x2, - - /// @brief __0x3__ : Documentary. - EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS_DOCUMENTARY = 0x3, - - /// @brief __0x4__ : Discussion/interview/debate - EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS_DISCUSSION_INTERVIEW_DEBATE = 0x4, - - /// @brief __0xF__ : User defined. - EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS_USERDEFINED = 0xF - } EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT - /// @brief EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_SHOW event - /// types for sub type of "Show/Game show". - /// - typedef enum EPG_EVENT_CONTENTSUBMASK_SHOW - { - /// @brief __0x0__ : Show/game show (general). - EPG_EVENT_CONTENTSUBMASK_SHOW_GENERAL = 0x0, - - /// @brief __0x1__ : Game show/quiz/contest. - EPG_EVENT_CONTENTSUBMASK_SHOW_GAMESHOW_QUIZ_CONTEST = 0x1, - - /// @brief __0x2__ : Variety show. - EPG_EVENT_CONTENTSUBMASK_SHOW_VARIETY_SHOW = 0x2, - - /// @brief __0x3__ : Talk show. - EPG_EVENT_CONTENTSUBMASK_SHOW_TALK_SHOW = 0x3, - - /// @brief __0xF__ : User defined. - EPG_EVENT_CONTENTSUBMASK_SHOW_USERDEFINED = 0xF - } EPG_EVENT_CONTENTSUBMASK_SHOW; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT - /// @brief EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_SPORTS event - /// types for sub type of "Sports". - /// - typedef enum EPG_EVENT_CONTENTSUBMASK_SPORTS - { - /// @brief __0x0__ : Sports (general). - EPG_EVENT_CONTENTSUBMASK_SPORTS_GENERAL = 0x0, - - /// @brief __0x1__ : Special events (Olympic Games, World Cup, etc.). - EPG_EVENT_CONTENTSUBMASK_SPORTS_OLYMPICGAMES_WORLDCUP = 0x1, - - /// @brief __0x2__ : Sports magazines. - EPG_EVENT_CONTENTSUBMASK_SPORTS_SPORTS_MAGAZINES = 0x2, - - /// @brief __0x3__ : Football/soccer. - EPG_EVENT_CONTENTSUBMASK_SPORTS_FOOTBALL_SOCCER = 0x3, - - /// @brief __0x4__ : Tennis/squash. - EPG_EVENT_CONTENTSUBMASK_SPORTS_TENNIS_SQUASH = 0x4, - - /// @brief __0x5__ : Team sports (excluding football). - EPG_EVENT_CONTENTSUBMASK_SPORTS_TEAMSPORTS = 0x5, - - /// @brief __0x6__ : Athletics. - EPG_EVENT_CONTENTSUBMASK_SPORTS_ATHLETICS = 0x6, - - /// @brief __0x7__ : Motor sport. - EPG_EVENT_CONTENTSUBMASK_SPORTS_MOTORSPORT = 0x7, - - /// @brief __0x8__ : Water sport. - EPG_EVENT_CONTENTSUBMASK_SPORTS_WATERSPORT = 0x8, - - /// @brief __0x9__ : Winter sports. - EPG_EVENT_CONTENTSUBMASK_SPORTS_WINTERSPORTS = 0x9, - - /// @brief __0xA__ : Equestrian. - EPG_EVENT_CONTENTSUBMASK_SPORTS_EQUESTRIAN = 0xA, - - /// @brief __0xB__ : Martial sports. - EPG_EVENT_CONTENTSUBMASK_SPORTS_MARTIALSPORTS = 0xB, - - /// @brief __0xF__ : User defined. - EPG_EVENT_CONTENTSUBMASK_SPORTS_USERDEFINED = 0xF - } EPG_EVENT_CONTENTSUBMASK_SPORTS; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT - /// @brief EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_CHILDRENYOUTH event - /// types for sub type of "Children's/Youth programmes". - /// - typedef enum EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH - { - /// @brief __0x0__ : Children's/youth programmes (general). - EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH_GENERAL = 0x0, - - /// @brief __0x1__ : Pre-school children's programmes. - EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH_PRESCHOOL_CHILDREN = 0x1, - - /// @brief __0x2__ : Entertainment programmes for 6 to 14. - EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH_ENTERTAIN_6TO14 = 0x2, - - /// @brief __0x3__ : Entertainment programmes for 10 to 16. - EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH_ENTERTAIN_10TO16 = 0x3, - - /// @brief __0x4__ : Informational/educational/school programmes. - EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH_INFORMATIONAL_EDUCATIONAL_SCHOOL = 0x4, - - /// @brief __0x5__ : Cartoons/puppets. - EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH_CARTOONS_PUPPETS = 0x5, - - /// @brief __0xF__ : User defined. - EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH_USERDEFINED = 0xF - } EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT - /// @brief EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE event - /// types for sub type of "Music/Ballet/Dance". - /// - typedef enum EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE - { - /// @brief __0x0__ : Music/ballet/dance (general). - EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE_GENERAL = 0x0, - - /// @brief __0x1__ : Rock/pop. - EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE_ROCKPOP = 0x1, - - /// @brief __0x2__ : Serious music/classical music. - EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE_SERIOUSMUSIC_CLASSICALMUSIC = 0x2, - - /// @brief __0x3__ : Folk/traditional music. - EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE_FOLK_TRADITIONAL_MUSIC = 0x3, - - /// @brief __0x4__ : Jazz. - EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE_JAZZ = 0x4, - - /// @brief __0x5__ : Musical/opera. - EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE_MUSICAL_OPERA = 0x5, - - /// @brief __0x6__ : Ballet. - EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE_BALLET = 0x6, - - /// @brief __0xF__ : User defined. - EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE_USERDEFINED = 0xF - } EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT - /// @brief EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_ARTSCULTURE event - /// types for sub type of "Arts/Culture (without music)". - /// - typedef enum EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE - { - /// @brief __0x0__ : Arts/culture (without music, general). - EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE_GENERAL = 0x0, - - /// @brief __0x1__ : Performing arts. - EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE_PERFORMINGARTS = 0x1, - - /// @brief __0x2__ : Fine arts. - EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE_FINEARTS = 0x2, - - /// @brief __0x3__ : Religion. - EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE_RELIGION = 0x3, - - /// @brief __0x4__ : Popular culture/traditional arts. - EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE_POPULARCULTURE_TRADITIONALARTS = 0x4, - - /// @brief __0x5__ : Literature. - EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE_LITERATURE = 0x5, - - /// @brief __0x6__ : Film/cinema. - EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE_FILM_CINEMA = 0x6, - - /// @brief __0x7__ : Experimental film/video. - EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE_EXPERIMENTALFILM_VIDEO = 0x7, - - /// @brief __0x8__ : Broadcasting/press. - EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE_BROADCASTING_PRESS = 0x8, - - /// @brief __0x9__ : New media. - EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE_NEWMEDIA = 0x9, - - /// @brief __0xA__ : Arts/culture magazines. - EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE_ARTS_CULTUREMAGAZINES = 0xA, - - /// @brief __0xB__ : Fashion. - EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE_FASHION = 0xB, - - /// @brief __0xF__ : User defined. - EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE_USERDEFINED = 0xF - } EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT - /// @brief EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS event - /// types for sub type of "Social/Political issues/Economics". - /// - typedef enum EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS - { - /// @brief __0x0__ : Social/political issues/economics (general). - EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS_GENERAL = 0x0, - - /// @brief __0x1__ : Magazines/reports/documentary. - EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS_MAGAZINES_REPORTS_DOCUMENTARY = 0x1, - - /// @brief __0x2__ : Economics/social advisory. - EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS_ECONOMICS_SOCIALADVISORY = 0x2, - - /// @brief __0x3__ : Remarkable people. - EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS_REMARKABLEPEOPLE = 0x3, - - /// @brief __0xF__ : User defined. - EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS_USERDEFINED = 0xF - } EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT - /// @brief EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE event - /// types for sub type of "Education/Science/Factual topics". - /// - typedef enum EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE - { - /// @brief __0x0__ : Education/science/factual topics (general). - EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE_GENERAL = 0x0, - - /// @brief __0x1__ : Nature/animals/environment. - EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE_NATURE_ANIMALS_ENVIRONMENT = 0x1, - - /// @brief __0x2__ : Technology/natural sciences. - EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE_TECHNOLOGY_NATURALSCIENCES = 0x2, - - /// @brief __0x3__ : Medicine/physiology/psychology. - EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE_MEDICINE_PHYSIOLOGY_PSYCHOLOGY = 0x3, - - /// @brief __0x4__ : Foreign countries/expeditions. - EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE_FOREIGNCOUNTRIES_EXPEDITIONS = 0x4, - - /// @brief __0x5__ : Social/spiritual sciences. - EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE_SOCIAL_SPIRITUALSCIENCES = 0x5, - - /// @brief __0x6__ : Further education. - EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE_FURTHEREDUCATION = 0x6, - - /// @brief __0x7__ : Languages. - EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE_LANGUAGES = 0x7, - - /// @brief __0xF__ : User defined. - EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE_USERDEFINED = 0xF - } EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT - /// @brief EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_LEISUREHOBBIES event - /// types for sub type of "Leisure hobbies". - /// - typedef enum EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES - { - /// @brief __0x0__ : Leisure hobbies (general) . - EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES_GENERAL = 0x0, - - /// @brief __0x1__ : Tourism/travel. - EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES_TOURISM_TRAVEL = 0x1, - - /// @brief __0x2__ : Handicraft. - EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES_HANDICRAFT = 0x2, - - /// @brief __0x3__ : Motoring. - EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES_MOTORING = 0x3, - - /// @brief __0x4__ : Fitness and health. - EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES_FITNESSANDHEALTH = 0x4, - - /// @brief __0x5__ : Cooking. - EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES_COOKING = 0x5, - - /// @brief __0x6__ : Advertisement/shopping. - EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES_ADVERTISEMENT_SHOPPING = 0x6, - - /// @brief __0x7__ : Gardening. - EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES_GARDENING = 0x7, - - /// @brief __0xF__ : User defined. - EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES_USERDEFINED = 0xF - } EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT - /// @brief EPG entry sub content to @ref EPG_EVENT_CONTENTMASK_SPECIAL event - /// types for sub type of "Special characteristics". - /// - typedef enum EPG_EVENT_CONTENTSUBMASK_SPECIAL - { - /// @brief __0x0__ : Special characteristics / Original language (general). - EPG_EVENT_CONTENTSUBMASK_SPECIAL_GENERAL = 0x0, - - /// @brief __0x1__ : Black and white. - EPG_EVENT_CONTENTSUBMASK_SPECIAL_BLACKANDWHITE = 0x1, - - /// @brief __0x2__ : Unpublished. - EPG_EVENT_CONTENTSUBMASK_SPECIAL_UNPUBLISHED = 0x2, - - /// @brief __0x3__ : Live broadcast. - EPG_EVENT_CONTENTSUBMASK_SPECIAL_LIVEBROADCAST = 0x3, - - /// @brief __0x4__ : Plano-stereoscopic. - EPG_EVENT_CONTENTSUBMASK_SPECIAL_PLANOSTEREOSCOPIC = 0x4, - - /// @brief __0x5__ : Local or regional. - EPG_EVENT_CONTENTSUBMASK_SPECIAL_LOCALORREGIONAL = 0x5, - - /// @brief __0xF__ : User defined. - EPG_EVENT_CONTENTSUBMASK_SPECIAL_USERDEFINED = 0xF - } EPG_EVENT_CONTENTSUBMASK_SPECIAL; - //---------------------------------------------------------------------------- - - ///@} - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg - /// @brief Separator to use in strings containing different tokens, for example - /// writers, directors, actors of an event. - /// - #define EPG_STRING_TOKEN_SEPARATOR "," - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_epg_EPG_TAG_FLAG enum EPG_TAG_FLAG - /// @ingroup cpp_kodi_addon_pvr_Defs_epg - /// @brief Bit field of independent flags associated with the EPG entry.\n - /// Values used by @ref kodi::addon::PVREPGTag::SetFlags(). - /// - /// Here's example about the use of this: - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVREPGTag tag; - /// tag.SetFlags(EPG_TAG_FLAG_IS_SERIES | EPG_TAG_FLAG_IS_NEW); - /// ~~~~~~~~~~~~~ - /// - ///@{ - typedef enum EPG_TAG_FLAG - { - /// @brief __0000 0000__ : Nothing special to say about this entry. - EPG_TAG_FLAG_UNDEFINED = 0, - - /// @brief __0000 0001__ : This EPG entry is part of a series. - EPG_TAG_FLAG_IS_SERIES = (1 << 0), - - /// @brief __0000 0010__ : This EPG entry will be flagged as new. - EPG_TAG_FLAG_IS_NEW = (1 << 1), - - /// @brief __0000 0100__ : This EPG entry will be flagged as a premiere. - EPG_TAG_FLAG_IS_PREMIERE = (1 << 2), - - /// @brief __0000 1000__ : This EPG entry will be flagged as a finale. - EPG_TAG_FLAG_IS_FINALE = (1 << 3), - - /// @brief __0001 0000__ : This EPG entry will be flagged as live. - EPG_TAG_FLAG_IS_LIVE = (1 << 4), - } EPG_TAG_FLAG; - ///@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg - /// @brief Special PVREPGTag::SetUniqueBroadcastId value - /// - /// Special @ref kodi::addon::PVREPGTag::SetUniqueBroadcastId() value to - /// indicate that a tag has not a valid EPG event uid. - /// - #define EPG_TAG_INVALID_UID 0 - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg - /// @brief Special @ref kodi::addon::PVREPGTag::SetSeriesNumber(), @ref kodi::addon::PVREPGTag::SetEpisodeNumber() - /// and @ref kodi::addon::PVREPGTag::SetEpisodePartNumber() value to indicate - /// it is not to be used. - /// - #define EPG_TAG_INVALID_SERIES_EPISODE -1 - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_epg - /// @brief Timeframe value for use with @ref kodi::addon::CInstancePVRClient::SetEPGTimeFrame() - /// function to indicate "no timeframe". - /// - #define EPG_TIMEFRAME_UNLIMITED -1 - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_epg_EPG_EVENT_STATE enum EPG_EVENT_STATE - /// @ingroup cpp_kodi_addon_pvr_Defs_epg - /// @brief **EPG event states.**\n - /// Used with @ref kodi::addon::CInstancePVRClient::EpgEventStateChange() - /// callback. - /// - ///@{ - typedef enum EPG_EVENT_STATE - { - /// @brief __0__ : Event created. - EPG_EVENT_CREATED = 0, - - /// @brief __1__ : Event updated. - EPG_EVENT_UPDATED = 1, - - /// @brief __2__ : Event deleted. - EPG_EVENT_DELETED = 2, - } EPG_EVENT_STATE; - ///@} - //---------------------------------------------------------------------------- - - /*! - * @brief "C" PVR add-on channel group member. - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref kodi::addon::PVREPGTag for description of values. - */ - typedef struct EPG_TAG - { - unsigned int iUniqueBroadcastId; - unsigned int iUniqueChannelId; - const char* strTitle; - time_t startTime; - time_t endTime; - const char* strPlotOutline; - const char* strPlot; - const char* strOriginalTitle; - const char* strCast; - const char* strDirector; - const char* strWriter; - int iYear; - const char* strIMDBNumber; - const char* strIconPath; - int iGenreType; - int iGenreSubType; - const char* strGenreDescription; - const char* strFirstAired; - int iParentalRating; - int iStarRating; - int iSeriesNumber; - int iEpisodeNumber; - int iEpisodePartNumber; - const char* strEpisodeName; - unsigned int iFlags; - const char* strSeriesLink; - } EPG_TAG; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_general.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_general.h deleted file mode 100644 index 52787b0..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_general.h +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "pvr_defines.h" - -#ifdef BUILD_KODI_ADDON -#include "../../../InputStreamConstants.h" -#else -#include "cores/VideoPlayer/Interface/Addon/InputStreamConstants.h" -#endif - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C" Definitions group 1 - General PVR -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_General_PVR_ERROR enum PVR_ERROR - /// @ingroup cpp_kodi_addon_pvr_Defs_General - /// @brief **PVR add-on error codes**\n - /// Used as return values on most PVR related functions. - /// - /// In this way, a PVR instance signals errors in its processing and, under - /// certain conditions, allows Kodi to make corrections. - /// - ///@{ - typedef enum PVR_ERROR - { - /// @brief __0__ : No error occurred. - PVR_ERROR_NO_ERROR = 0, - - /// @brief __-1__ : An unknown error occurred. - PVR_ERROR_UNKNOWN = -1, - - /// @brief __-2__ : The method that Kodi called is not implemented by the add-on. - PVR_ERROR_NOT_IMPLEMENTED = -2, - - /// @brief __-3__ : The backend reported an error, or the add-on isn't connected. - PVR_ERROR_SERVER_ERROR = -3, - - /// @brief __-4__ : The command was sent to the backend, but the response timed out. - PVR_ERROR_SERVER_TIMEOUT = -4, - - /// @brief __-5__ : The command was rejected by the backend. - PVR_ERROR_REJECTED = -5, - - /// @brief __-6__ : The requested item can not be added, because it's already present. - PVR_ERROR_ALREADY_PRESENT = -6, - - /// @brief __-7__ : The parameters of the method that was called are invalid for this - /// operation. - PVR_ERROR_INVALID_PARAMETERS = -7, - - /// @brief __-8__ : A recording is running, so the timer can't be deleted without - /// doing a forced delete. - PVR_ERROR_RECORDING_RUNNING = -8, - - /// @brief __-9__ : The command failed. - PVR_ERROR_FAILED = -9, - } PVR_ERROR; - ///@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_General_PVR_CONNECTION_STATE enum PVR_CONNECTION_STATE - /// @ingroup cpp_kodi_addon_pvr_Defs_General - /// @brief **PVR backend connection states**\n - /// Used with @ref kodi::addon::CInstancePVRClient::ConnectionStateChange() callback. - /// - /// With this, a PVR instance signals that Kodi should perform special - /// operations. - /// - ///@{ - typedef enum PVR_CONNECTION_STATE - { - /// @brief __0__ : Unknown state (e.g. not yet tried to connect). - PVR_CONNECTION_STATE_UNKNOWN = 0, - - /// @brief __1__ : Backend server is not reachable (e.g. server not existing or - /// network down). - PVR_CONNECTION_STATE_SERVER_UNREACHABLE = 1, - - /// @brief __2__ : 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_SERVER_MISMATCH = 2, - - /// @brief __3__ : Backend server is reachable, but server version does not match - /// client requirements. - PVR_CONNECTION_STATE_VERSION_MISMATCH = 3, - - /// @brief __4__ : Backend server is reachable, but denies client access (e.g. due - /// to wrong credentials). - PVR_CONNECTION_STATE_ACCESS_DENIED = 4, - - /// @brief __5__ : Connection to backend server is established. - PVR_CONNECTION_STATE_CONNECTED = 5, - - /// @brief __6__ : No connection to backend server (e.g. due to network errors or - /// client initiated disconnect). - PVR_CONNECTION_STATE_DISCONNECTED = 6, - - /// @brief __7__ : Connecting to backend. - PVR_CONNECTION_STATE_CONNECTING = 7, - } PVR_CONNECTION_STATE; - ///@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_General_PVR_STREAM_PROPERTY definition PVR_STREAM_PROPERTY - /// @ingroup cpp_kodi_addon_pvr_Defs_General_Inputstream - /// @brief **PVR related stream property values**\n - /// This is used to pass additional data to Kodi on a given PVR stream. - /// - /// Then transferred to livestream, recordings or EPG Tag stream using the - /// properties. - /// - /// This defines are used by: - /// - @ref kodi::addon::CInstancePVRClient::GetChannelStreamProperties() - /// - @ref kodi::addon::CInstancePVRClient::GetEPGTagStreamProperties() - /// - @ref kodi::addon::CInstancePVRClient::GetRecordingStreamProperties() - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// - /// PVR_ERROR CMyPVRInstance::GetChannelStreamProperties(const kodi::addon::PVRChannel& channel, - /// std::vector& properties) - /// { - /// ... - /// properties.emplace_back(PVR_STREAM_PROPERTY_INPUTSTREAM, "inputstream.adaptive"); - /// properties.emplace_back("inputstream.adaptive.manifest_type", "mpd"); - /// properties.emplace_back("inputstream.adaptive.manifest_update_parameter", "full"); - /// properties.emplace_back(PVR_STREAM_PROPERTY_MIMETYPE, "application/xml+dash"); - /// return PVR_ERROR_NO_ERROR; - /// } - /// - /// ... - /// ~~~~~~~~~~~~~ - /// - ///@{ - - /// @brief the URL of the stream that should be played. - /// - #define PVR_STREAM_PROPERTY_STREAMURL "streamurl" - - /// @brief To define in stream properties the name of the inputstream add-on - /// that should be used. - /// - /// Leave blank to use Kodi's built-in playing capabilities or to allow ffmpeg - /// to handle directly set to @ref PVR_STREAM_PROPERTY_VALUE_INPUTSTREAMFFMPEG. - /// - #define PVR_STREAM_PROPERTY_INPUTSTREAM STREAM_PROPERTY_INPUTSTREAM - - /// @brief Identification string for an input stream. - /// - /// This value can be used in addition to @ref PVR_STREAM_PROPERTY_INPUTSTREAM. - /// It is used to provide the respective inpustream addon with additional - /// identification. - /// - /// The difference between this and other stream properties is that it is also - /// passed in the associated @ref kodi::addon::CAddonBase::CreateInstance() - /// call. - /// - /// This makes it possible to select different processing classes within the - /// associated add-on. - /// - /// - ///--------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// - /// // On PVR instance of addon - /// PVR_ERROR CMyPVRInstance::GetChannelStreamProperties(const kodi::addon::PVRChannel& channel, - /// std::vector& properties) - /// { - /// ... - /// // For here on example the inpustream is also inside the PVR addon - /// properties.emplace_back(PVR_STREAM_PROPERTY_INPUTSTREAM, "pvr.my_one"); - /// properties.emplace_back(PVR_STREAM_PROPERTY_INPUTSTREAM_INSTANCE_ID, "my_special_id_1"); - /// return PVR_ERROR_NO_ERROR; - /// } - /// - /// ... - /// - /// // On CAddonBase part of addon - /// ADDON_STATUS CMyAddon::CreateInstanceEx(int instanceType, - /// std::string instanceID, - /// KODI_HANDLE instance, - /// KODI_HANDLE& addonInstance - /// const std::string& version) - /// { - /// if (instanceType == ADDON_INSTANCE_INPUTSTREAM) - /// { - /// kodi::Log(ADDON_LOG_NOTICE, "Creating my special inputstream"); - /// if (instanceID == "my_special_id_1") - /// addonInstance = new CMyPVRClientInstance_Type1(instance, version); - /// else if (instanceID == "my_special_id_2") - /// addonInstance = new CMyPVRClientInstance_Type2(instance, version); - /// return ADDON_STATUS_OK; - /// } - /// else if (...) - /// { - /// ... - /// } - /// return ADDON_STATUS_UNKNOWN; - /// } - /// - /// ... - /// ~~~~~~~~~~~~~ - /// - #define PVR_STREAM_PROPERTY_INPUTSTREAM_INSTANCE_ID STREAM_PROPERTY_INPUTSTREAM_INSTANCE_ID - - /// @brief the MIME type of the stream that should be played. - /// - #define PVR_STREAM_PROPERTY_MIMETYPE "mimetype" - - /// @brief "true" to denote that the stream that should be played is a - /// realtime stream. - /// - /// Any other value indicates that this is no realtime stream. - /// - #define PVR_STREAM_PROPERTY_ISREALTIMESTREAM STREAM_PROPERTY_ISREALTIMESTREAM - - /// @brief "true" to denote that if the stream is from an EPG tag. - /// - /// It should be played is a live stream. Otherwise if it's a EPG tag it will - /// play as normal video. - /// - #define PVR_STREAM_PROPERTY_EPGPLAYBACKASLIVE "epgplaybackaslive" - - /// @brief Special value for @ref PVR_STREAM_PROPERTY_INPUTSTREAM to use - /// ffmpeg to directly play a stream URL. - #define PVR_STREAM_PROPERTY_VALUE_INPUTSTREAMFFMPEG STREAM_PROPERTY_VALUE_INPUTSTREAMFFMPEG - - ///@} - //----------------------------------------------------------------------------- - - /*! - * @brief "C" PVR add-on capabilities. - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref kodi::addon::PVRCapabilities for description of values. - */ - typedef struct PVR_ADDON_CAPABILITIES - { - bool bSupportsEPG; - bool bSupportsEPGEdl; - bool bSupportsTV; - bool bSupportsRadio; - bool bSupportsRecordings; - bool bSupportsRecordingsUndelete; - bool bSupportsTimers; - bool bSupportsChannelGroups; - bool bSupportsChannelScan; - bool bSupportsChannelSettings; - bool bHandlesInputStream; - bool bHandlesDemuxing; - bool bSupportsRecordingPlayCount; - bool bSupportsLastPlayedPosition; - bool bSupportsRecordingEdl; - bool bSupportsRecordingsRename; - bool bSupportsRecordingsLifetimeChange; - bool bSupportsDescrambleInfo; - bool bSupportsAsyncEPGTransfer; - bool bSupportsRecordingSize; - - unsigned int iRecordingsLifetimesSize; - struct PVR_ATTRIBUTE_INT_VALUE recordingsLifetimeValues[PVR_ADDON_ATTRIBUTE_VALUES_ARRAY_SIZE]; - } PVR_ADDON_CAPABILITIES; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_menu_hook.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_menu_hook.h deleted file mode 100644 index df2216f..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_menu_hook.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "pvr_defines.h" - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C" Definitions group 7 - Menu hook -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_Menuhook_PVR_MENUHOOK_CAT enum PVR_MENUHOOK_CAT - /// @ingroup cpp_kodi_addon_pvr_Defs_Menuhook - /// @brief **PVR context menu hook categories**\n - /// Possible menu types given to Kodi with @ref kodi::addon::CInstancePVRClient::AddMenuHook(). - /// - ///@{ - typedef enum PVR_MENUHOOK_CAT - { - /// @brief __-1__ : Unknown menu hook. - PVR_MENUHOOK_UNKNOWN = -1, - - /// @brief __0__ : All categories. - PVR_MENUHOOK_ALL = 0, - - /// @brief __1__ : For channels. - PVR_MENUHOOK_CHANNEL = 1, - - /// @brief __2__ : For timers. - PVR_MENUHOOK_TIMER = 2, - - /// @brief __3__ : For EPG. - PVR_MENUHOOK_EPG = 3, - - /// @brief __4__ : For recordings. - PVR_MENUHOOK_RECORDING = 4, - - /// @brief __5__ : For deleted recordings. - PVR_MENUHOOK_DELETED_RECORDING = 5, - - /// @brief __6__ : For settings. - PVR_MENUHOOK_SETTING = 6, - } PVR_MENUHOOK_CAT; - ///@} - //---------------------------------------------------------------------------- - - /*! - * @brief "C" PVR add-on menu hook. - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref kodi::addon::PVRMenuhook for description of values. - */ - typedef struct PVR_MENUHOOK - { - unsigned int iHookId; - unsigned int iLocalizedStringId; - enum PVR_MENUHOOK_CAT category; - } PVR_MENUHOOK; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_recordings.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_recordings.h deleted file mode 100644 index 1a7fc66..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_recordings.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "pvr_defines.h" - -#include -#include -#include - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C" Definitions group 5 - PVR recordings -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_Recording_PVR_RECORDING_FLAG enum PVR_RECORDING_FLAG - /// @ingroup cpp_kodi_addon_pvr_Defs_Recording - /// @brief **Bit field of independent flags associated with the EPG entry.**\n - /// Values used by @ref kodi::addon::PVRRecording::SetFlags(). - /// - /// Here's example about the use of this: - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVRRecording tag; - /// tag.SetFlags(PVR_RECORDING_FLAG_IS_SERIES | PVR_RECORDING_FLAG_IS_PREMIERE); - /// ~~~~~~~~~~~~~ - /// - ///@{ - typedef enum PVR_RECORDING_FLAG - { - /// @brief __0000 0000__ : Nothing special to say about this recording. - PVR_RECORDING_FLAG_UNDEFINED = 0, - - /// @brief __0000 0001__ : This recording is part of a series. - PVR_RECORDING_FLAG_IS_SERIES = (1 << 0), - - /// @brief __0000 0010__ : This recording will be flagged as new. - PVR_RECORDING_FLAG_IS_NEW = (1 << 1), - - /// @brief __0000 0100__ : This recording will be flagged as a premiere. - PVR_RECORDING_FLAG_IS_PREMIERE = (1 << 2), - - /// @brief __0000 1000__ : This recording will be flagged as a finale. - PVR_RECORDING_FLAG_IS_FINALE = (1 << 3), - - /// @brief __0001 0000__ : This recording will be flagged as live. - PVR_RECORDING_FLAG_IS_LIVE = (1 << 4), - } PVR_RECORDING_FLAG; - ///@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecording - /// @brief Special @ref kodi::addon::PVRRecording::SetSeriesNumber() and - /// @ref kodi::addon::PVRRecording::SetEpisodeNumber() value to indicate it is - /// not to be used. - /// - /// Used if recording has no valid season and/or episode info. - /// - #define PVR_RECORDING_INVALID_SERIES_EPISODE EPG_TAG_INVALID_SERIES_EPISODE - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecording - /// @brief Value where set in background to inform that related part not used. - /// - /// Normally this related parts need not to set by this as it is default. - #define PVR_RECORDING_VALUE_NOT_AVAILABLE -1 - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_Recording_PVR_RECORDING_CHANNEL_TYPE enum PVR_RECORDING_CHANNEL_TYPE - /// @ingroup cpp_kodi_addon_pvr_Defs_Recording - /// @brief **PVR recording channel types**\n - /// Used on @ref kodi::addon::PVRRecording::SetChannelType() value to set related - /// type. - /// - ///@{ - typedef enum PVR_RECORDING_CHANNEL_TYPE - { - /// @brief __0__ : Unknown type. - PVR_RECORDING_CHANNEL_TYPE_UNKNOWN = 0, - - /// @brief __1__ : TV channel. - PVR_RECORDING_CHANNEL_TYPE_TV = 1, - - /// @brief __2__ : Radio channel. - PVR_RECORDING_CHANNEL_TYPE_RADIO = 2, - } PVR_RECORDING_CHANNEL_TYPE; - ///@} - //---------------------------------------------------------------------------- - - /*! - * @brief "C" PVR add-on recording. - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref kodi::addon::PVRRecording for description of values. - */ - typedef struct PVR_RECORDING - { - char strRecordingId[PVR_ADDON_NAME_STRING_LENGTH]; - char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; - char strEpisodeName[PVR_ADDON_NAME_STRING_LENGTH]; - int iSeriesNumber; - int iEpisodeNumber; - int iYear; - char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; - char strPlotOutline[PVR_ADDON_DESC_STRING_LENGTH]; - char strPlot[PVR_ADDON_DESC_STRING_LENGTH]; - char strGenreDescription[PVR_ADDON_DESC_STRING_LENGTH]; - char strChannelName[PVR_ADDON_NAME_STRING_LENGTH]; - char strIconPath[PVR_ADDON_URL_STRING_LENGTH]; - char strThumbnailPath[PVR_ADDON_URL_STRING_LENGTH]; - char strFanartPath[PVR_ADDON_URL_STRING_LENGTH]; - time_t recordingTime; - int iDuration; - int iPriority; - int iLifetime; - int iGenreType; - int iGenreSubType; - int iPlayCount; - int iLastPlayedPosition; - bool bIsDeleted; - unsigned int iEpgEventId; - int iChannelUid; - enum PVR_RECORDING_CHANNEL_TYPE channelType; - char strFirstAired[PVR_ADDON_DATE_STRING_LENGTH]; - unsigned int iFlags; - int64_t sizeInBytes; - } PVR_RECORDING; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_stream.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_stream.h deleted file mode 100644 index 04b4059..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_stream.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "pvr_defines.h" - -#ifdef BUILD_KODI_ADDON -#include "../../../DemuxPacket.h" -#else -#include "cores/VideoPlayer/Interface/Addon/DemuxPacket.h" -#endif - -#include -#include - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C" Definitions group 9 - PVR stream definitions (NOTE: Becomes replaced -// in future by inputstream addon instance way) -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_Stream - /// @brief Maximum of allowed streams - /// - #define PVR_STREAM_MAX_STREAMS 20 - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_Stream - /// @brief Invalid codec identifier - /// - #define PVR_INVALID_CODEC_ID 0 - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_addon_pvr_Defs_Stream - /// @brief Invalid codec - /// - #define PVR_INVALID_CODEC \ - { \ - PVR_CODEC_TYPE_UNKNOWN, PVR_INVALID_CODEC_ID \ - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_Stream_PVR_CODEC_TYPE enum PVR_CODEC_TYPE - /// @ingroup cpp_kodi_addon_pvr_Defs_Stream - /// @brief **Inputstream types**\n - /// To identify type on stream. - /// - /// Used on @ref kodi::addon::PVRStreamProperties::SetCodecType and @ref kodi::addon::PVRStreamProperties::SetCodecType. - /// - ///@{ - typedef enum PVR_CODEC_TYPE - { - /// @brief To set nothing defined. - PVR_CODEC_TYPE_UNKNOWN = -1, - - /// @brief To identify @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties as Video. - PVR_CODEC_TYPE_VIDEO, - - /// @brief To identify @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties as Audio. - PVR_CODEC_TYPE_AUDIO, - - /// @brief To identify @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties as Data. - /// - /// With codec id related source identified. - PVR_CODEC_TYPE_DATA, - - /// @brief To identify @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties as Subtitle. - PVR_CODEC_TYPE_SUBTITLE, - - /// @brief To identify @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties as Radio RDS. - PVR_CODEC_TYPE_RDS, - - PVR_CODEC_TYPE_NB - } PVR_CODEC_TYPE; - ///@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_Stream_PVR_CODEC struct PVR_CODEC - /// @ingroup cpp_kodi_addon_pvr_Defs_Stream - /// @brief **Codec identification structure**\n - /// Identifier about stream between Kodi and addon. - /// - ///@{ - typedef struct PVR_CODEC - { - /// @brief Used codec type for stream. - enum PVR_CODEC_TYPE codec_type; - - /// @brief Related codec identifier, normally match the ffmpeg id's. - unsigned int codec_id; - } PVR_CODEC; - ///@} - //---------------------------------------------------------------------------- - - /*! - * @brief "C" Stream properties - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties for description of values. - */ - typedef struct PVR_STREAM_PROPERTIES - { - unsigned int iStreamCount; - struct PVR_STREAM - { - unsigned int iPID; - enum PVR_CODEC_TYPE iCodecType; - unsigned int iCodecId; - char strLanguage[4]; - int iSubtitleInfo; - int iFPSScale; - int iFPSRate; - int iHeight; - int iWidth; - float fAspect; - int iChannels; - int iSampleRate; - int iBlockAlign; - int iBitRate; - int iBitsPerSample; - } stream[PVR_STREAM_MAX_STREAMS]; - } PVR_STREAM_PROPERTIES; - - /*! - * @brief "C" Times of playing stream (Live TV and recordings) - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamTimes for description of values. - */ - typedef struct PVR_STREAM_TIMES - { - time_t startTime; - int64_t ptsStart; - int64_t ptsBegin; - int64_t ptsEnd; - } PVR_STREAM_TIMES; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_timers.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_timers.h deleted file mode 100644 index bc16adb..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_timers.h +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "pvr_defines.h" - -#include -#include -#include - -//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ -// "C" Definitions group 6 - PVR timers -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVR_TIMER_ definition PVR_TIMER (various) - /// @ingroup cpp_kodi_addon_pvr_Defs_Timer - /// @brief **PVR timer various different definitions**\n - /// This mostly used on @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimer "kodi::addon::PVRTimer" - /// to define default or not available. - /// - ///@{ - - //============================================================================ - /// @brief Numeric PVR timer type definitions (@ref kodi::addon::PVRTimer::SetTimerType() - /// values). - /// - /// "Null" value for a numeric timer type. - #define PVR_TIMER_TYPE_NONE 0 - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Special @ref kodi::addon::PVRTimer::SetClientIndex() value to indicate - /// that a timer has not (yet) a valid client index. - /// - /// Timer has not (yet) a valid client index. - #define PVR_TIMER_NO_CLIENT_INDEX 0 - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Special @ref kodi::addon::PVRTimer::SetParentClientIndex() value to - /// indicate that a timer has no parent. - /// - /// Timer has no parent; it was not scheduled by a repeating timer. - #define PVR_TIMER_NO_PARENT PVR_TIMER_NO_CLIENT_INDEX - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Special @ref kodi::addon::PVRTimer::SetEPGUid() value to indicate - /// that a timer has no EPG event uid. - /// - /// Timer has no EPG event unique identifier. - #define PVR_TIMER_NO_EPG_UID EPG_TAG_INVALID_UID - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Special @ref kodi::addon::PVRTimer::SetClientChannelUid() value to - /// indicate "any channel". Useful for some repeating timer types. - /// - /// denotes "any channel", not a specific one. - /// - #define PVR_TIMER_ANY_CHANNEL -1 - //---------------------------------------------------------------------------- - - //============================================================================ - /// @brief Value where set in background to inform that related part not used. - /// - /// Normally this related parts need not to set by this as it is default. - #define PVR_TIMER_VALUE_NOT_AVAILABLE -1 - //---------------------------------------------------------------------------- - - ///@} - //---------------------------------------------------------------------------- - - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVR_TIMER_TYPES enum PVR_TIMER_TYPES - /// @ingroup cpp_kodi_addon_pvr_Defs_Timer - /// @brief **PVR timer type attributes (@ref kodi::addon::PVRTimerType::SetAttributes() values).**\n - /// To defines the attributes for a type. These values are bit fields that can be - /// used together. - /// - ///-------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::addon::PVRTimerType tag; - /// tag.SetAttributes(PVR_TIMER_TYPE_IS_MANUAL | PVR_TIMER_TYPE_IS_REPEATING); - /// ~~~~~~~~~~~~~ - /// - ///@{ - typedef enum PVR_TIMER_TYPES - { - /// @brief __0000 0000 0000 0000 0000 0000 0000 0000__ :\n Empty attribute value. - PVR_TIMER_TYPE_ATTRIBUTE_NONE = 0, - - /// @brief __0000 0000 0000 0000 0000 0000 0000 0001__ :\n Defines whether this is a type for - /// manual (time-based) or epg-based timers. - PVR_TIMER_TYPE_IS_MANUAL = (1 << 0), - - /// @brief __0000 0000 0000 0000 0000 0000 0000 0010__ :\n Defines whether this is a type for - /// repeating or one-shot timers. - PVR_TIMER_TYPE_IS_REPEATING = (1 << 1), - - /// @brief __0000 0000 0000 0000 0000 0000 0000 0100__ :\n Timers of this type must not be edited - /// by Kodi. - PVR_TIMER_TYPE_IS_READONLY = (1 << 2), - - /// @brief __0000 0000 0000 0000 0000 0000 0000 1000__ :\n Timers of this type must not be created - /// by Kodi. All other operations are allowed, though. - PVR_TIMER_TYPE_FORBIDS_NEW_INSTANCES = (1 << 3), - - /// @brief __0000 0000 0000 0000 0000 0000 0001 0000__ :\n This type supports enabling/disabling - /// of the timer (@ref kodi::addon::PVRTimer::SetState() with - /// @ref PVR_TIMER_STATE_SCHEDULED | @ref PVR_TIMER_STATE_DISABLED). - PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE = (1 << 4), - - /// @brief __0000 0000 0000 0000 0000 0000 0010 0000__ :\n This type supports channels - /// (@ref kodi::addon::PVRTimer::SetClientChannelUid()). - PVR_TIMER_TYPE_SUPPORTS_CHANNELS = (1 << 5), - - /// @brief __0000 0000 0000 0000 0000 0000 0100 0000__ :\n This type supports a recording start - /// time (@ref kodi::addon::PVRTimer::SetStartTime()). - PVR_TIMER_TYPE_SUPPORTS_START_TIME = (1 << 6), - - /// @brief __0000 0000 0000 0000 0000 0000 1000 0000__ :\n This type supports matching epg episode - /// title using@ref kodi::addon::PVRTimer::SetEPGSearchString(). - PVR_TIMER_TYPE_SUPPORTS_TITLE_EPG_MATCH = (1 << 7), - - /// @brief __0000 0000 0000 0000 0000 0001 0000 0000__ :\n This type supports matching "more" epg - /// data (not just episode title) using @ref kodi::addon::PVRTimer::SetEPGSearchString(). - /// Setting @ref PVR_TIMER_TYPE_SUPPORTS_FULLTEXT_EPG_MATCH implies - /// @ref PVR_TIMER_TYPE_SUPPORTS_TITLE_EPG_MATCH. - PVR_TIMER_TYPE_SUPPORTS_FULLTEXT_EPG_MATCH = (1 << 8), - - /// @brief __0000 0000 0000 0000 0000 0010 0000 0000__ :\n This type supports a first day the - /// timer gets active (@ref kodi::addon::PVRTimer::SetFirstDay()). - PVR_TIMER_TYPE_SUPPORTS_FIRST_DAY = (1 << 9), - - /// @brief __0000 0000 0000 0000 0000 0100 0000 0000__ :\n This type supports weekdays for - /// defining the recording schedule (@ref kodi::addon::PVRTimer::SetWeekdays()). - PVR_TIMER_TYPE_SUPPORTS_WEEKDAYS = (1 << 10), - - /// @brief __0000 0000 0000 0000 0000 1000 0000 0000__ :\n This type supports the "record only new episodes" feature - /// (@ref kodi::addon::PVRTimer::SetPreventDuplicateEpisodes()). - PVR_TIMER_TYPE_SUPPORTS_RECORD_ONLY_NEW_EPISODES = (1 << 11), - - /// @brief __0000 0000 0000 0000 0001 0000 0000 0000__ :\n This type supports pre and post record time (@ref kodi::addon::PVRTimer::SetMarginStart(), - /// @ref kodi::addon::PVRTimer::SetMarginEnd()). - PVR_TIMER_TYPE_SUPPORTS_START_END_MARGIN = (1 << 12), - - /// @brief __0000 0000 0000 0000 0010 0000 0000 0000__ :\n This type supports recording priority (@ref kodi::addon::PVRTimer::SetPriority()). - PVR_TIMER_TYPE_SUPPORTS_PRIORITY = (1 << 13), - - /// @brief __0000 0000 0000 0000 0100 0000 0000 0000__ :\n This type supports recording lifetime (@ref kodi::addon::PVRTimer::SetLifetime()). - PVR_TIMER_TYPE_SUPPORTS_LIFETIME = (1 << 14), - - /// @brief __0000 0000 0000 0000 1000 0000 0000 0000__ :\n This type supports placing recordings in user defined folders - /// (@ref kodi::addon::PVRTimer::SetDirectory()). - PVR_TIMER_TYPE_SUPPORTS_RECORDING_FOLDERS = (1 << 15), - - /// @brief __0000 0000 0000 0001 0000 0000 0000 0000__ :\n This type supports a list of recording groups - /// (@ref kodi::addon::PVRTimer::SetRecordingGroup()). - PVR_TIMER_TYPE_SUPPORTS_RECORDING_GROUP = (1 << 16), - - /// @brief __0000 0000 0000 0010 0000 0000 0000 0000__ :\n This type supports a recording end time (@ref kodi::addon::PVRTimer::SetEndTime()). - PVR_TIMER_TYPE_SUPPORTS_END_TIME = (1 << 17), - - /// @brief __0000 0000 0000 0100 0000 0000 0000 0000__ :\n Enables an 'Any Time' over-ride option for start time - /// (using @ref kodi::addon::PVRTimer::SetStartAnyTime()). - PVR_TIMER_TYPE_SUPPORTS_START_ANYTIME = (1 << 18), - - /// @brief __0000 0000 0000 1000 0000 0000 0000 0000__ :\n Enables a separate 'Any Time' over-ride for end time - /// (using @ref kodi::addon::PVRTimer::SetEndAnyTime()). - PVR_TIMER_TYPE_SUPPORTS_END_ANYTIME = (1 << 19), - - /// @brief __0000 0000 0001 0000 0000 0000 0000 0000__ :\n This type supports specifying a maximum recordings setting' - /// (@ref kodi::addon::PVRTimer::SetMaxRecordings()). - PVR_TIMER_TYPE_SUPPORTS_MAX_RECORDINGS = (1 << 20), - - /// @brief __0000 0000 0010 0000 0000 0000 0000 0000__ :\n This type should not appear on any create menus which don't - /// provide an associated @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "EPG tag". - PVR_TIMER_TYPE_REQUIRES_EPG_TAG_ON_CREATE = (1 << 21), - - /// @brief __0000 0000 0100 0000 0000 0000 0000 0000__ :\n This type should not appear on any create menus which provide an - /// associated @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "EPG tag". - PVR_TIMER_TYPE_FORBIDS_EPG_TAG_ON_CREATE = (1 << 22), - - /// @brief __0000 0000 1000 0000 0000 0000 0000 0000__ :\n This type should not appear on any create menus unless associated - /// with an @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "EPG tag" with - /// 'series' attributes. - /// - /// Following conditions allow this: - /// - @ref kodi::addon::PVREPGTag::SetFlags() have flag @ref EPG_TAG_FLAG_IS_SERIES - /// - @ref kodi::addon::PVREPGTag::SetSeriesNumber() > 0 - /// - @ref kodi::addon::PVREPGTag::SetEpisodeNumber() > 0 - /// - @ref kodi::addon::PVREPGTag::SetEpisodePartNumber() > 0 - /// - /// Implies @ref PVR_TIMER_TYPE_REQUIRES_EPG_TAG_ON_CREATE. - PVR_TIMER_TYPE_REQUIRES_EPG_SERIES_ON_CREATE = (1 << 23), - - /// @brief __0000 0001 0000 0000 0000 0000 0000 0000__ :\n This type supports 'any channel', for example when defining a timer - /// rule that should match any channel instaed of a particular channel. - PVR_TIMER_TYPE_SUPPORTS_ANY_CHANNEL = (1 << 24), - - /// @brief __0000 0010 0000 0000 0000 0000 0000 0000__ :\n This type should not appear on any create menus which don't provide - /// an associated @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "EPG tag" with - /// a series link. - PVR_TIMER_TYPE_REQUIRES_EPG_SERIESLINK_ON_CREATE = (1 << 25), - - /// @brief __0000 0100 0000 0000 0000 0000 0000 0000__ :\n This type allows deletion of an otherwise read-only timer. - PVR_TIMER_TYPE_SUPPORTS_READONLY_DELETE = (1 << 26), - - /// @brief __0000 1000 0000 0000 0000 0000 0000 0000__ :\n Timers of this type do trigger a reminder if time is up. - PVR_TIMER_TYPE_IS_REMINDER = (1 << 27), - - /// @brief __0001 0000 0000 0000 0000 0000 0000 0000__ :\n This type supports pre record time (@ref kodi::addon::PVRTimer::SetMarginStart()). - PVR_TIMER_TYPE_SUPPORTS_START_MARGIN = (1 << 28), - - /// @brief __0010 0000 0000 0000 0000 0000 0000 0000__ :\n This type supports post record time (@ref kodi::addon::PVRTimer::SetMarginEnd()). - PVR_TIMER_TYPE_SUPPORTS_END_MARGIN = (1 << 29), - } PVR_TIMER_TYPES; - ///@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVR_WEEKDAY enum PVR_WEEKDAY - /// @ingroup cpp_kodi_addon_pvr_Defs_Timer - /// @brief **PVR timer weekdays** (@ref kodi::addon::PVRTimer::SetWeekdays() **values**)\n - /// Used to select the days of a week you want. - /// - /// It can be also used to select several days e.g.: - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// unsigned int day = PVR_WEEKDAY_MONDAY | PVR_WEEKDAY_SATURDAY; - /// ... - /// ~~~~~~~~~~~~~ - /// - ///@{ - typedef enum PVR_WEEKDAYS - { - /// @brief __0000 0000__ : Nothing selected. - PVR_WEEKDAY_NONE = 0, - - /// @brief __0000 0001__ : To select Monday. - PVR_WEEKDAY_MONDAY = (1 << 0), - - /// @brief __0000 0010__ : To select Tuesday. - PVR_WEEKDAY_TUESDAY = (1 << 1), - - /// @brief __0000 0100__ : To select Wednesday. - PVR_WEEKDAY_WEDNESDAY = (1 << 2), - - /// @brief __0000 1000__ : To select Thursday. - PVR_WEEKDAY_THURSDAY = (1 << 3), - - /// @brief __0001 0000__ : To select Friday. - PVR_WEEKDAY_FRIDAY = (1 << 4), - - /// @brief __0010 0000__ : To select Saturday. - PVR_WEEKDAY_SATURDAY = (1 << 5), - - /// @brief __0100 0000__ : To select Sunday. - PVR_WEEKDAY_SUNDAY = (1 << 6), - - /// @brief __0111 1111__ : To select all days of week. - PVR_WEEKDAY_ALLDAYS = PVR_WEEKDAY_MONDAY | PVR_WEEKDAY_TUESDAY | PVR_WEEKDAY_WEDNESDAY | - PVR_WEEKDAY_THURSDAY | PVR_WEEKDAY_FRIDAY | PVR_WEEKDAY_SATURDAY | - PVR_WEEKDAY_SUNDAY - } PVR_WEEKDAY; - ///@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_addon_pvr_Defs_Timer_PVR_TIMER_STATE enum PVR_TIMER_STATE - /// @ingroup cpp_kodi_addon_pvr_Defs_Timer - /// @brief **PVR timer states**\n - /// To set within @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimer "kodi::addon::PVRTimer" - /// the needed state about. - /// - ///@{ - typedef enum PVR_TIMER_STATE - { - /// @brief __0__ : 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_NEW = 0, - - /// @brief __1__ : The timer is scheduled for recording. - PVR_TIMER_STATE_SCHEDULED = 1, - - /// @brief __2__ : The timer is currently recordings. - PVR_TIMER_STATE_RECORDING = 2, - - /// @brief __3__ : The recording completed successfully. - PVR_TIMER_STATE_COMPLETED = 3, - - /// @brief __4__ : Recording started, but was aborted. - PVR_TIMER_STATE_ABORTED = 4, - - /// @brief __5__ : The timer was scheduled, but was canceled. - PVR_TIMER_STATE_CANCELLED = 5, - - /// @brief __6__ : The scheduled timer conflicts with another one, but will be - /// recorded. - PVR_TIMER_STATE_CONFLICT_OK = 6, - - /// @brief __7__ : The scheduled timer conflicts with another one and won't be - /// recorded. - PVR_TIMER_STATE_CONFLICT_NOK = 7, - - /// @brief __8__ : The timer is scheduled, but can't be recorded for some reason. - PVR_TIMER_STATE_ERROR = 8, - - /// @brief __9__ : The timer was disabled by the user, can be enabled via setting - /// the state to @ref PVR_TIMER_STATE_SCHEDULED. - PVR_TIMER_STATE_DISABLED = 9, - } PVR_TIMER_STATE; - ///@} - //---------------------------------------------------------------------------- - - /*! - * @brief "C" PVR add-on timer event. - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimer "kodi::addon::PVRTimer" for - * description of values. - */ - typedef struct PVR_TIMER - { - unsigned int iClientIndex; - unsigned int iParentClientIndex; - int iClientChannelUid; - time_t startTime; - time_t endTime; - bool bStartAnyTime; - bool bEndAnyTime; - enum PVR_TIMER_STATE state; - unsigned int iTimerType; - char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; - char strEpgSearchString[PVR_ADDON_NAME_STRING_LENGTH]; - bool bFullTextEpgSearch; - char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; - char strSummary[PVR_ADDON_DESC_STRING_LENGTH]; - int iPriority; - int iLifetime; - int iMaxRecordings; - unsigned int iRecordingGroup; - time_t firstDay; - unsigned int iWeekdays; - unsigned int iPreventDuplicateEpisodes; - unsigned int iEpgUid; - unsigned int iMarginStart; - unsigned int iMarginEnd; - int iGenreType; - int iGenreSubType; - char strSeriesLink[PVR_ADDON_URL_STRING_LENGTH]; - } PVR_TIMER; - - /*! - * @brief "C" PVR add-on timer event type. - * - * Structure used to interface in "C" between Kodi and Addon. - * - * See @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType "kodi::addon::PVRTimerType" for - * description of values. - */ - typedef struct PVR_TIMER_TYPE - { - unsigned int iId; - uint64_t iAttributes; - char strDescription[PVR_ADDON_TIMERTYPE_STRING_LENGTH]; - - unsigned int iPrioritiesSize; - struct PVR_ATTRIBUTE_INT_VALUE priorities[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; - int iPrioritiesDefault; - - unsigned int iLifetimesSize; - struct PVR_ATTRIBUTE_INT_VALUE lifetimes[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; - int iLifetimesDefault; - - unsigned int iPreventDuplicateEpisodesSize; - struct PVR_ATTRIBUTE_INT_VALUE preventDuplicateEpisodes[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; - unsigned int iPreventDuplicateEpisodesDefault; - - unsigned int iRecordingGroupSize; - struct PVR_ATTRIBUTE_INT_VALUE recordingGroup[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; - unsigned int iRecordingGroupDefault; - - unsigned int iMaxRecordingsSize; - struct PVR_ATTRIBUTE_INT_VALUE maxRecordings[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE_SMALL]; - int iMaxRecordingsDefault; - } PVR_TIMER_TYPE; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon_base.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon_base.h deleted file mode 100644 index 1924d77..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/addon_base.h +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (C) 2005-2019 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "stdbool.h" -#include "stdint.h" - -#ifndef TARGET_WINDOWS -#ifndef __cdecl -#define __cdecl -#endif -#ifndef __declspec -#define __declspec(X) -#endif -#endif - -#undef ATTRIBUTE_PACKED -#undef PRAGMA_PACK_BEGIN -#undef PRAGMA_PACK_END - -#if defined(__GNUC__) -#define ATTRIBUTE_PACKED __attribute__((packed)) -#define PRAGMA_PACK 0 -#define ATTRIBUTE_HIDDEN __attribute__((visibility("hidden"))) -#endif - -#if !defined(ATTRIBUTE_PACKED) -#define ATTRIBUTE_PACKED -#define PRAGMA_PACK 1 -#endif - -#if !defined(ATTRIBUTE_HIDDEN) -#define ATTRIBUTE_HIDDEN -#endif - -#ifdef _MSC_VER -#define ATTRIBUTE_FORCEINLINE __forceinline -#elif defined(__GNUC__) -#define ATTRIBUTE_FORCEINLINE inline __attribute__((__always_inline__)) -#elif defined(__CLANG__) -#if __has_attribute(__always_inline__) -#define ATTRIBUTE_FORCEINLINE inline __attribute__((__always_inline__)) -#else -#define ATTRIBUTE_FORCEINLINE inline -#endif -#else -#define ATTRIBUTE_FORCEINLINE inline -#endif - -/* - * To have a on add-on and kodi itself handled string always on known size! - */ -#define ADDON_STANDARD_STRING_LENGTH 1024 -#define ADDON_STANDARD_STRING_LENGTH_SMALL 256 - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //============================================================================ - /// @ingroup cpp_kodi_addon_addonbase - /// @brief Return value of functions in @ref cpp_kodi_addon_addonbase "kodi::addon::CAddonBase" - /// and associated classes. - /// - ///@{ - typedef enum ADDON_STATUS - { - /// @brief For everything OK and no error - ADDON_STATUS_OK, - - /// @brief A needed connection was lost - ADDON_STATUS_LOST_CONNECTION, - - /// @brief Addon needs a restart inside Kodi - ADDON_STATUS_NEED_RESTART, - - /// @brief Necessary settings are not yet set - ADDON_STATUS_NEED_SETTINGS, - - /// @brief Unknown and incomprehensible error - ADDON_STATUS_UNKNOWN, - - /// @brief Permanent failure, like failing to resolve methods - ADDON_STATUS_PERMANENT_FAILURE, - - /* internal used return error if function becomes not used from child on - * addon */ - ADDON_STATUS_NOT_IMPLEMENTED - } ADDON_STATUS; - ///@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_Defs_AddonLog enum AddonLog - /// @ingroup cpp_kodi_Defs - /// @brief **Log file type definitions**\n - /// These define the types of log entries given with @ref kodi::Log() to Kodi. - /// - /// ------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// kodi::Log(ADDON_LOG_ERROR, "%s: There is an error occurred!", __func__); - /// - /// ~~~~~~~~~~~~~ - /// - ///@{ - typedef enum AddonLog - { - /// @brief **0** : To include debug information in the log file. - ADDON_LOG_DEBUG = 0, - - /// @brief **1** : To include information messages in the log file. - ADDON_LOG_INFO = 1, - - /// @brief **2** : To write warnings in the log file. - ADDON_LOG_WARNING = 2, - - /// @brief **3** : To report error messages in the log file. - ADDON_LOG_ERROR = 3, - - /// @brief **4** : To notify fatal unrecoverable errors, which can may also indicate - /// upcoming crashes. - ADDON_LOG_FATAL = 4 - } AddonLog; - ///@} - //---------------------------------------------------------------------------- - - /*! @brief Standard undefined pointer handle */ - typedef void* KODI_HANDLE; - - /*! - * @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 struct ADDON_HANDLE_STRUCT* ADDON_HANDLE; - - /*! - * @brief Callback function tables from addon to Kodi - * Set complete from Kodi! - */ - struct AddonToKodiFuncTable_kodi; - struct AddonToKodiFuncTable_kodi_audioengine; - struct AddonToKodiFuncTable_kodi_filesystem; - struct AddonToKodiFuncTable_kodi_network; - struct AddonToKodiFuncTable_kodi_gui; - typedef struct AddonToKodiFuncTable_Addon - { - // Pointer inside Kodi, used on callback functions to give related handle - // class, for this ADDON::CAddonDll inside Kodi. - KODI_HANDLE kodiBase; - - // Function addresses used for callbacks from addon to Kodi - char* (*get_type_version)(void* kodiBase, int type); - - void (*free_string)(void* kodiBase, char* str); - void (*free_string_array)(void* kodiBase, char** arr, int numElements); - char* (*get_addon_path)(void* kodiBase); - char* (*get_base_user_path)(void* kodiBase); - void (*addon_log_msg)(void* kodiBase, const int loglevel, const char* msg); - - bool (*get_setting_bool)(void* kodiBase, const char* id, bool* value); - bool (*get_setting_int)(void* kodiBase, const char* id, int* value); - bool (*get_setting_float)(void* kodiBase, const char* id, float* value); - bool (*get_setting_string)(void* kodiBase, const char* id, char** value); - - bool (*set_setting_bool)(void* kodiBase, const char* id, bool value); - bool (*set_setting_int)(void* kodiBase, const char* id, int value); - bool (*set_setting_float)(void* kodiBase, const char* id, float value); - bool (*set_setting_string)(void* kodiBase, const char* id, const char* value); - - void* (*get_interface)(void* kodiBase, const char* name, const char* version); - - struct AddonToKodiFuncTable_kodi* kodi; - struct AddonToKodiFuncTable_kodi_audioengine* kodi_audioengine; - struct AddonToKodiFuncTable_kodi_filesystem* kodi_filesystem; - struct AddonToKodiFuncTable_kodi_gui* kodi_gui; - struct AddonToKodiFuncTable_kodi_network* kodi_network; - - // Move up by min version change about - bool (*is_setting_using_default)(void* kodiBase, const char* id); - } AddonToKodiFuncTable_Addon; - - /*! - * @brief Function tables from Kodi to addon - */ - typedef struct KodiToAddonFuncTable_Addon - { - void (*destroy)(); - ADDON_STATUS (*get_status)(); - ADDON_STATUS(*create_instance) - (int instanceType, - const char* instanceID, - KODI_HANDLE instance, - const char* version, - KODI_HANDLE* addonInstance, - KODI_HANDLE parent); - void (*destroy_instance)(int instanceType, KODI_HANDLE instance); - ADDON_STATUS (*set_setting)(const char* settingName, const void* settingValue); - } KodiToAddonFuncTable_Addon; - - /*! - * @brief Main structure passed from kodi to addon with basic information needed to - * create add-on. - */ - typedef struct AddonGlobalInterface - { - // String with full path where add-on is installed (without his name on end) - // Set from Kodi! - const char* libBasePath; - - // Master API version of Kodi itself (ADDON_GLOBAL_VERSION_MAIN) - const char* kodi_base_api_version; - - // Pointer of first created instance, used in case this add-on goes with single way - // Set from Kodi! - KODI_HANDLE firstKodiInstance; - - // Pointer to master base class inside add-on - // Set from addon header (kodi::addon::CAddonBase)! - KODI_HANDLE addonBase; - - // Pointer to a instance used on single way (together with this class) - // Set from addon header (kodi::addon::IAddonInstance)! - KODI_HANDLE globalSingleInstance; - - // Callback function tables from addon to Kodi - // Set from Kodi! - AddonToKodiFuncTable_Addon* toKodi; - - // Function tables from Kodi to addon - // Set from addon header! - KodiToAddonFuncTable_Addon* toAddon; - } AddonGlobalInterface; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/audio_engine.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/audio_engine.h deleted file mode 100644 index 02e96ac..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/audio_engine.h +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (C) 2005-2019 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "stdint.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ - // "C" Definitions, structures and enumerators of audio engine - //{{{ - - //============================================================================ - /// @defgroup cpp_kodi_audioengine_Defs_AudioEngineStreamOptions enum AudioEngineStreamOptions - /// @ingroup cpp_kodi_audioengine_Defs - /// @brief **Bit options to pass to CAEStream**\n - /// A bit field of stream options. - /// - /// - /// ------------------------------------------------------------------------ - /// - /// **Usage example:** - /// ~~~~~~~~~~~~~{.cpp} - /// // Here only as minimal, "format" must be set to wanted types - /// kodi::audioengine::AudioEngineFormat format; - /// m_audioengine = new kodi::audioengine::CAEStream(format, AUDIO_STREAM_FORCE_RESAMPLE | AUDIO_STREAM_AUTOSTART); - /// ~~~~~~~~~~~~~ - /// - //@{ - typedef enum AudioEngineStreamOptions - { - /// force resample even if rates match - AUDIO_STREAM_FORCE_RESAMPLE = 1 << 0, - /// create the stream paused - AUDIO_STREAM_PAUSED = 1 << 1, - /// autostart the stream when enough data is buffered - AUDIO_STREAM_AUTOSTART = 1 << 2, - } AudioEngineStreamOptions; - //@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_audioengine_Defs_AudioEngineChannel enum AudioEngineChannel - /// @ingroup cpp_kodi_audioengine_Defs - /// @brief **The possible channels**\n - /// Used to set available or used channels on stream. - /// - /// - /// ------------------------------------------------------------------------ - /// - /// **Usage example:** - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::audioengine::AudioEngineFormat format; - /// format.SetChannelLayout(std::vector(AUDIOENGINE_CH_FL, AUDIOENGINE_CH_FR)); - /// ~~~~~~~~~~~~~ - /// - //@{ - enum AudioEngineChannel - { - /// Used inside to indicate the end of a list and not for addon use directly. - AUDIOENGINE_CH_NULL = -1, - /// RAW Audio format - AUDIOENGINE_CH_RAW, - /// Front left - AUDIOENGINE_CH_FL, - /// Front right - AUDIOENGINE_CH_FR, - /// Front center - AUDIOENGINE_CH_FC, - /// LFE / Subwoofer - AUDIOENGINE_CH_LFE, - /// Back left - AUDIOENGINE_CH_BL, - /// Back right - AUDIOENGINE_CH_BR, - /// Front left over center - AUDIOENGINE_CH_FLOC, - /// Front right over center - AUDIOENGINE_CH_FROC, - /// Back center - AUDIOENGINE_CH_BC, - /// Side left - AUDIOENGINE_CH_SL, - /// Side right - AUDIOENGINE_CH_SR, - /// Top front left - AUDIOENGINE_CH_TFL, - /// Top front right - AUDIOENGINE_CH_TFR, - /// Top front center - AUDIOENGINE_CH_TFC, - /// Top center - AUDIOENGINE_CH_TC, - /// Top back left - AUDIOENGINE_CH_TBL, - /// Top back right - AUDIOENGINE_CH_TBR, - /// Top back center - AUDIOENGINE_CH_TBC, - /// Back left over center - AUDIOENGINE_CH_BLOC, - /// Back right over center - AUDIOENGINE_CH_BROC, - /// Maximum possible value, to use e.g. as size inside list - AUDIOENGINE_CH_MAX - }; - //@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_audioengine_Defs_AudioEngineDataFormat enum AudioEngineDataFormat - /// @ingroup cpp_kodi_audioengine_Defs - /// @brief **Audio sample formats**\n - /// The bit layout of the audio data. - /// - /// LE = Little Endian, BE = Big Endian, NE = Native Endian - /// - /// For planar sample formats, each audio channel is in a separate data plane, - /// and linesize is the buffer size, in bytes, for a single plane. All data - /// planes must be the same size. For packed sample formats, only the first - /// data plane is used, and samples for each channel are interleaved. In this - /// case, linesize is the buffer size, in bytes, for the 1 plane. - /// - /// @note This is ordered from the worst to best preferred formats - /// - /// - /// ------------------------------------------------------------------------ - /// - /// **Usage example:** - /// ~~~~~~~~~~~~~{.cpp} - /// kodi::audioengine::AudioEngineFormat format; - /// format.SetDataFormat(AUDIOENGINE_FMT_FLOATP); - /// ~~~~~~~~~~~~~ - /// - //@{ - enum AudioEngineDataFormat - { - /// To define format as invalid - AUDIOENGINE_FMT_INVALID = -1, - - /// Unsigned integer 8 bit - AUDIOENGINE_FMT_U8, - - /// Big Endian signed integer 16 bit - AUDIOENGINE_FMT_S16BE, - /// Little Endian signed integer 16 bit - AUDIOENGINE_FMT_S16LE, - /// Native Endian signed integer 16 bit - AUDIOENGINE_FMT_S16NE, - - /// Big Endian signed integer 32 bit - AUDIOENGINE_FMT_S32BE, - /// Little Endian signed integer 32 bit - AUDIOENGINE_FMT_S32LE, - /// Native Endian signed integer 32 bit - AUDIOENGINE_FMT_S32NE, - - /// Big Endian signed integer 24 bit (in 4 bytes) - AUDIOENGINE_FMT_S24BE4, - /// Little Endian signed integer 24 bit (in 4 bytes) - AUDIOENGINE_FMT_S24LE4, - /// Native Endian signed integer 24 bit (in 4 bytes) - AUDIOENGINE_FMT_S24NE4, - /// S32 with bits_per_sample < 32 - AUDIOENGINE_FMT_S24NE4MSB, - - /// Big Endian signed integer 24 bit (3 bytes) - AUDIOENGINE_FMT_S24BE3, - /// Little Endian signed integer 24 bit (3 bytes) - AUDIOENGINE_FMT_S24LE3, - /// Native Endian signed integer 24 bit (3 bytes) - AUDIOENGINE_FMT_S24NE3, - - /// Double floating point - AUDIOENGINE_FMT_DOUBLE, - /// Floating point - AUDIOENGINE_FMT_FLOAT, - - /// **Bitstream**\n - /// RAW Audio format - AUDIOENGINE_FMT_RAW, - - /// **Planar format**\n - /// Unsigned byte - AUDIOENGINE_FMT_U8P, - /// **Planar format**\n - /// Native Endian signed 16 bit - AUDIOENGINE_FMT_S16NEP, - /// **Planar format**\n - /// Native Endian signed 32 bit - AUDIOENGINE_FMT_S32NEP, - /// **Planar format**\n - /// Native Endian signed integer 24 bit (in 4 bytes) - AUDIOENGINE_FMT_S24NE4P, - /// **Planar format**\n - /// S32 with bits_per_sample < 32 - AUDIOENGINE_FMT_S24NE4MSBP, - /// **Planar format**\n - /// Native Endian signed integer 24 bit (in 3 bytes) - AUDIOENGINE_FMT_S24NE3P, - /// **Planar format**\n - /// Double floating point - AUDIOENGINE_FMT_DOUBLEP, - /// **Planar format**\n - /// Floating point - AUDIOENGINE_FMT_FLOATP, - - /// Amount of sample formats. - AUDIOENGINE_FMT_MAX - }; - //@} - //---------------------------------------------------------------------------- - - /*! - * @brief Internal API structure which are used for data exchange between - * Kodi and addon. - */ - struct AUDIO_ENGINE_FORMAT - { - /*! The stream's data format (eg, AUDIOENGINE_FMT_S16LE) */ - enum AudioEngineDataFormat 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 AudioEngineChannel m_channels[AUDIOENGINE_CH_MAX]; - - /*! The number of frames per period */ - unsigned int m_frames; - - /*! The size of one frame in bytes */ - unsigned int m_frameSize; - }; - - /* A stream handle pointer, which is only used internally by the addon stream handle */ - typedef void AEStreamHandle; - - //}}} - - //¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ - // "C" Internal interface tables for intercommunications between addon and kodi - //{{{ - - /* - * Function address structure, not need to visible on dev kit doxygen - * documentation - */ - typedef struct AddonToKodiFuncTable_kodi_audioengine - { - AEStreamHandle* (*make_stream)(void* kodiBase, - struct AUDIO_ENGINE_FORMAT* format, - unsigned int options); - void (*free_stream)(void* kodiBase, AEStreamHandle* stream); - bool (*get_current_sink_format)(void* kodiBase, struct AUDIO_ENGINE_FORMAT* sink_format); - - // Audio Engine Stream definitions - unsigned int (*aestream_get_space)(void* kodiBase, AEStreamHandle* handle); - unsigned int (*aestream_add_data)(void* kodiBase, - AEStreamHandle* handle, - uint8_t* const* data, - unsigned int offset, - unsigned int frames, - double pts, - bool hasDownmix, - double centerMixLevel); - double (*aestream_get_delay)(void* kodiBase, AEStreamHandle* handle); - bool (*aestream_is_buffering)(void* kodiBase, AEStreamHandle* handle); - double (*aestream_get_cache_time)(void* kodiBase, AEStreamHandle* handle); - double (*aestream_get_cache_total)(void* kodiBase, AEStreamHandle* handle); - void (*aestream_pause)(void* kodiBase, AEStreamHandle* handle); - void (*aestream_resume)(void* kodiBase, AEStreamHandle* handle); - void (*aestream_drain)(void* kodiBase, AEStreamHandle* handle, bool wait); - bool (*aestream_is_draining)(void* kodiBase, AEStreamHandle* handle); - bool (*aestream_is_drained)(void* kodiBase, AEStreamHandle* handle); - void (*aestream_flush)(void* kodiBase, AEStreamHandle* handle); - float (*aestream_get_volume)(void* kodiBase, AEStreamHandle* handle); - void (*aestream_set_volume)(void* kodiBase, AEStreamHandle* handle, float volume); - float (*aestream_get_amplification)(void* kodiBase, AEStreamHandle* handle); - void (*aestream_set_amplification)(void* kodiBase, AEStreamHandle* handle, float amplify); - unsigned int (*aestream_get_frame_size)(void* kodiBase, AEStreamHandle* handle); - unsigned int (*aestream_get_channel_count)(void* kodiBase, AEStreamHandle* handle); - unsigned int (*aestream_get_sample_rate)(void* kodiBase, AEStreamHandle* handle); - enum AudioEngineDataFormat (*aestream_get_data_format)(void* kodiBase, AEStreamHandle* handle); - double (*aestream_get_resample_ratio)(void* kodiBase, AEStreamHandle* handle); - void (*aestream_set_resample_ratio)(void* kodiBase, AEStreamHandle* handle, double ratio); - } AddonToKodiFuncTable_kodi_audioengine; - - //}}} - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/filesystem.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/filesystem.h deleted file mode 100644 index b68a24c..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/filesystem.h +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include -#include -#include - -#ifdef _WIN32 // windows -#ifndef _SSIZE_T_DEFINED -typedef intptr_t ssize_t; -#define _SSIZE_T_DEFINED -#endif // !_SSIZE_T_DEFINED - -// Prevent conflicts with Windows macros where have this names. -#ifdef CreateDirectory -#undef CreateDirectory -#endif // CreateDirectory -#ifdef DeleteFile -#undef DeleteFile -#endif // DeleteFile -#endif // _WIN32 - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ - // "C" Definitions, structures and enumerators of filesystem - //{{{ - - //============================================================================ - /// @defgroup cpp_kodi_vfs_Defs_OpenFileFlags enum OpenFileFlags - /// @ingroup cpp_kodi_vfs_Defs - /// @brief **Flags to define way how file becomes opened**\n - /// The values can be used together, e.g. `file.Open("myfile", ADDON_READ_TRUNCATED | ADDON_READ_CHUNKED);` - /// - /// Used on @ref kodi::vfs::CFile::OpenFile(). - /// - ///@{ - typedef enum OpenFileFlags - { - /// @brief **0000 0000 0001** :\n - /// Indicate that caller can handle truncated reads, where function - /// returns before entire buffer has been filled. - ADDON_READ_TRUNCATED = 0x01, - - /// @brief **0000 0000 0010** :\n - /// Indicate that that caller support read in the minimum defined - /// chunk size, this disables internal cache then. - ADDON_READ_CHUNKED = 0x02, - - /// @brief **0000 0000 0100** :\n - /// Use cache to access this file. - ADDON_READ_CACHED = 0x04, - - /// @brief **0000 0000 1000** :\n - /// Open without caching. regardless to file type. - ADDON_READ_NO_CACHE = 0x08, - - /// @brief **0000 0001 0000** :\n - /// Calcuate bitrate for file while reading. - ADDON_READ_BITRATE = 0x10, - - /// @brief **0000 0010 0000** :\n - /// Indicate to the caller we will seek between multiple streams in - /// the file frequently. - ADDON_READ_MULTI_STREAM = 0x20, - - /// @brief **0000 0100 0000** :\n - /// indicate to the caller file is audio and/or video (and e.g. may - /// grow). - ADDON_READ_AUDIO_VIDEO = 0x40, - - /// @brief **0000 1000 0000** :\n - /// Indicate that caller will do write operations before reading. - ADDON_READ_AFTER_WRITE = 0x80, - - /// @brief **0001 0000 0000** :\n - /// Indicate that caller want to reopen a file if its already open. - ADDON_READ_REOPEN = 0x100 - } OpenFileFlags; - ///@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_vfs_Defs_CURLOptiontype enum CURLOptiontype - /// @ingroup cpp_kodi_vfs_Defs - /// @brief **CURL message types**\n - /// Used on kodi::vfs::CFile::CURLAddOption(). - /// - //@{ - typedef enum CURLOptiontype - { - /// @brief Set a general option. - ADDON_CURL_OPTION_OPTION, - - /// @brief Set a protocol option. - /// - /// The following names for *ADDON_CURL_OPTION_PROTOCOL* are possible: - /// - /// | Option name | Description - /// |------------------------------------:|:-------------------------------- - /// | `accept-charset` | Set the "accept-charset" header - /// | `acceptencoding or encoding` | Set the "accept-encoding" header - /// | `active-remote` | Set the "active-remote" header - /// | `auth` | Set the authentication method. Possible values: any, anysafe, digest, ntlm - /// | `connection-timeout` | Set the connection timeout in seconds - /// | `cookie` | Set the "cookie" header - /// | `customrequest` | Set a custom HTTP request like DELETE - /// | `noshout` | Set to true if kodi detects a stream as shoutcast by mistake. - /// | `postdata` | Set the post body (value needs to be base64 encoded). (Implicitly sets the request to POST) - /// | `referer` | Set the "referer" header - /// | `user-agent` | Set the "user-agent" header - /// | `seekable` | Set the stream seekable. 1: enable, 0: disable - /// | `sslcipherlist` | Set list of accepted SSL ciphers. - /// - ADDON_CURL_OPTION_PROTOCOL, - - /// @brief Set User and password - ADDON_CURL_OPTION_CREDENTIALS, - - /// @brief Add a Header - ADDON_CURL_OPTION_HEADER - } CURLOptiontype; - //@} - //---------------------------------------------------------------------------- - - //============================================================================ - /// @defgroup cpp_kodi_vfs_Defs_FilePropertyTypes enum FilePropertyTypes - /// @ingroup cpp_kodi_vfs_Defs - /// @brief **File property types**\n - /// Mostly to read internet sources. - /// - /// Used on kodi::vfs::CFile::GetPropertyValue() and kodi::vfs::CFile::GetPropertyValues(). - /// - //@{ - typedef enum FilePropertyTypes - { - /// @brief Get protocol response line. - ADDON_FILE_PROPERTY_RESPONSE_PROTOCOL, - /// @brief Get a response header. - ADDON_FILE_PROPERTY_RESPONSE_HEADER, - /// @brief Get file content type. - ADDON_FILE_PROPERTY_CONTENT_TYPE, - /// @brief Get file content charset. - ADDON_FILE_PROPERTY_CONTENT_CHARSET, - /// @brief Get file mime type. - ADDON_FILE_PROPERTY_MIME_TYPE, - /// @brief Get file effective URL (last one if redirected). - ADDON_FILE_PROPERTY_EFFECTIVE_URL - } FilePropertyTypes; - //@} - //---------------------------------------------------------------------------- - - //}}} - - //¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ - // "C" Internal interface tables for intercommunications between addon and kodi - //{{{ - - struct KODI_HTTP_HEADER - { - void* handle; - - char* (*get_value)(void* kodiBase, void* handle, const char* param); - char** (*get_values)(void* kodiBase, void* handle, const char* param, int* length); - char* (*get_header)(void* kodiBase, void* handle); - char* (*get_mime_type)(void* kodiBase, void* handle); - char* (*get_charset)(void* kodiBase, void* handle); - char* (*get_proto_line)(void* kodiBase, void* handle); - }; - - struct STAT_STRUCTURE - { - /// ID of device containing file - uint32_t deviceId; - /// Total size, in bytes - uint64_t size; - /// Time of last access - time_t accessTime; - /// Time of last modification - time_t modificationTime; - /// Time of last status change - time_t statusTime; - /// The stat url is a directory - bool isDirectory; - /// The stat url is a symbolic link - bool isSymLink; - }; - - struct VFS_CACHE_STATUS_DATA - { - uint64_t forward; - unsigned int maxrate; - unsigned int currate; - bool lowspeed; - }; - - struct VFSProperty - { - char* name; - char* val; - }; - - struct VFSDirEntry - { - char* label; //!< item label - char* title; //!< item title - char* path; //!< item path - unsigned int num_props; //!< Number of properties attached to item - struct VFSProperty* properties; //!< Properties - time_t date_time; //!< file creation date & time - bool folder; //!< Item is a folder - uint64_t size; //!< Size of file represented by item - }; - - typedef struct AddonToKodiFuncTable_kodi_filesystem - { - bool (*can_open_directory)(void* kodiBase, const char* url); - bool (*create_directory)(void* kodiBase, const char* path); - bool (*remove_directory)(void* kodiBase, const char* path); - bool (*directory_exists)(void* kodiBase, const char* path); - bool (*get_directory)(void* kodiBase, - const char* path, - const char* mask, - struct VFSDirEntry** items, - unsigned int* num_items); - void (*free_directory)(void* kodiBase, struct VFSDirEntry* items, unsigned int num_items); - - bool (*file_exists)(void* kodiBase, const char* filename, bool useCache); - bool (*stat_file)(void* kodiBase, const char* filename, struct STAT_STRUCTURE* buffer); - bool (*delete_file)(void* kodiBase, const char* filename); - bool (*rename_file)(void* kodiBase, const char* filename, const char* newFileName); - bool (*copy_file)(void* kodiBase, const char* filename, const char* dest); - - char* (*get_file_md5)(void* kodiBase, const char* filename); - char* (*get_cache_thumb_name)(void* kodiBase, const char* filename); - char* (*make_legal_filename)(void* kodiBase, const char* filename); - char* (*make_legal_path)(void* kodiBase, const char* path); - char* (*translate_special_protocol)(void* kodiBase, const char* strSource); - bool (*is_internet_stream)(void* kodiBase, const char* path, bool strictCheck); - bool (*is_on_lan)(void* kodiBase, const char* path); - bool (*is_remote)(void* kodiBase, const char* path); - bool (*is_local)(void* kodiBase, const char* path); - bool (*is_url)(void* kodiBase, const char* path); - bool (*get_http_header)(void* kodiBase, const char* url, struct KODI_HTTP_HEADER* headers); - bool (*get_mime_type)(void* kodiBase, const char* url, char** content, const char* useragent); - bool (*get_content_type)(void* kodiBase, - const char* url, - char** content, - const char* useragent); - bool (*get_cookies)(void* kodiBase, const char* url, char** cookies); - bool (*http_header_create)(void* kodiBase, struct KODI_HTTP_HEADER* headers); - void (*http_header_free)(void* kodiBase, struct KODI_HTTP_HEADER* headers); - - void* (*open_file)(void* kodiBase, const char* filename, unsigned int flags); - void* (*open_file_for_write)(void* kodiBase, const char* filename, bool overwrite); - ssize_t (*read_file)(void* kodiBase, void* file, void* ptr, size_t size); - bool (*read_file_string)(void* kodiBase, void* file, char* szLine, int iLineLength); - ssize_t (*write_file)(void* kodiBase, void* file, const void* ptr, size_t size); - void (*flush_file)(void* kodiBase, void* file); - int64_t (*seek_file)(void* kodiBase, void* file, int64_t position, int whence); - int (*truncate_file)(void* kodiBase, void* file, int64_t size); - int64_t (*get_file_position)(void* kodiBase, void* file); - int64_t (*get_file_length)(void* kodiBase, void* file); - double (*get_file_download_speed)(void* kodiBase, void* file); - void (*close_file)(void* kodiBase, void* file); - int (*get_file_chunk_size)(void* kodiBase, void* file); - bool (*io_control_get_seek_possible)(void* kodiBase, void* file); - bool (*io_control_get_cache_status)(void* kodiBase, - void* file, - struct VFS_CACHE_STATUS_DATA* status); - bool (*io_control_set_cache_rate)(void* kodiBase, void* file, unsigned int rate); - bool (*io_control_set_retry)(void* kodiBase, void* file, bool retry); - char** (*get_property_values)( - void* kodiBase, void* file, int type, const char* name, int* numValues); - - void* (*curl_create)(void* kodiBase, const char* url); - bool (*curl_add_option)( - void* kodiBase, void* file, int type, const char* name, const char* value); - bool (*curl_open)(void* kodiBase, void* file, unsigned int flags); - - bool (*get_disk_space)( - void* kodiBase, const char* path, uint64_t* capacity, uint64_t* free, uint64_t* available); - } AddonToKodiFuncTable_kodi_filesystem; - - //}}} - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/general.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/general.h deleted file mode 100644 index ede8e94..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/general.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - //============================================================================ - /// \ingroup cpp_kodi_Defs - /// @brief For kodi::CurrentKeyboardLayout used defines - /// - typedef enum StdKbButtons - { - /// The quantity of buttons per row on Kodi's standard keyboard - STD_KB_BUTTONS_PER_ROW = 20, - /// The quantity of rows on Kodi's standard keyboard - STD_KB_BUTTONS_MAX_ROWS = 4, - /// Keyboard layout type, this for initial standard - STD_KB_MODIFIER_KEY_NONE = 0x00, - /// Keyboard layout type, this for shift controled layout (uppercase) - STD_KB_MODIFIER_KEY_SHIFT = 0x01, - /// Keyboard layout type, this to show symbols - STD_KB_MODIFIER_KEY_SYMBOL = 0x02 - } StdKbButtons; - //---------------------------------------------------------------------------- - - //============================================================================ - /// \ingroup cpp_kodi_Defs - /// @brief For kodi::QueueNotification() used message types - /// - typedef enum QueueMsg - { - /// Show info notification message - QUEUE_INFO, - /// Show warning notification message - QUEUE_WARNING, - /// Show error notification message - QUEUE_ERROR, - /// Show with own given image and parts if set on values - QUEUE_OWN_STYLE - } QueueMsg; - //---------------------------------------------------------------------------- - - //============================================================================ - /// \ingroup cpp_kodi_Defs - /// @brief Format codes to get string from them. - /// - /// Used on kodi::GetLanguage(). - /// - typedef enum LangFormats - { - /// two letter code as defined in ISO 639-1 - LANG_FMT_ISO_639_1, - /// three letter code as defined in ISO 639-2/T or ISO 639-2/B - LANG_FMT_ISO_639_2, - /// full language name in English - LANG_FMT_ENGLISH_NAME - } LangFormats; - //---------------------------------------------------------------------------- - - /* - * For interface between add-on and kodi. - * - * This structure defines the addresses of functions stored inside Kodi which - * are then available for the add-on to call - * - * All function pointers there are used by the C++ interface functions below. - * You find the set of them on xbmc/addons/interfaces/General.cpp - * - * Note: For add-on development itself this is not needed - */ - typedef struct AddonKeyboardKeyTable - { - char* keys[STD_KB_BUTTONS_MAX_ROWS][STD_KB_BUTTONS_PER_ROW]; - } AddonKeyboardKeyTable; - typedef struct AddonToKodiFuncTable_kodi - { - char* (*get_addon_info)(void* kodiBase, const char* id); - bool (*open_settings_dialog)(void* kodiBase); - char* (*unknown_to_utf8)(void* kodiBase, const char* source, bool* ret, bool failOnBadChar); - char* (*get_localized_string)(void* kodiBase, long label_id); - char* (*get_language)(void* kodiBase, int format, bool region); - bool (*queue_notification)(void* kodiBase, - int type, - const char* header, - const char* message, - const char* imageFile, - unsigned int displayTime, - bool withSound, - unsigned int messageTime); - void (*get_md5)(void* kodiBase, const char* text, char* md5); - char* (*get_temp_path)(void* kodiBase); - char* (*get_region)(void* kodiBase, const char* id); - void (*get_free_mem)(void* kodiBase, long* free, long* total, bool as_bytes); - int (*get_global_idle_time)(void* kodiBase); - bool (*is_addon_avilable)(void* kodiBase, const char* id, char** version, bool* enabled); - void (*kodi_version)(void* kodiBase, - char** compile_name, - int* major, - int* minor, - char** revision, - char** tag, - char** tagversion); - char* (*get_current_skin_id)(void* kodiBase); - bool (*get_keyboard_layout)(void* kodiBase, - char** layout_name, - int modifier_key, - struct AddonKeyboardKeyTable* layout); - bool (*change_keyboard_layout)(void* kodiBase, char** layout_name); - } AddonToKodiFuncTable_kodi; - - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/network.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/network.h deleted file mode 100644 index 6c0441f..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/c-api/network.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - /* - * For interface between add-on and kodi. - * - * This structure defines the addresses of functions stored inside Kodi which - * are then available for the add-on to call - * - * All function pointers there are used by the C++ interface functions below. - * You find the set of them on xbmc/addons/interfaces/General.cpp - * - * Note: For add-on development itself this is not needed - */ - typedef struct AddonToKodiFuncTable_kodi_network - { - bool (*wake_on_lan)(void* kodiBase, const char* mac); - char* (*get_ip_address)(void* kodiBase); - char* (*dns_lookup)(void* kodiBase, const char* url, bool* ret); - char* (*url_encode)(void* kodiBase, const char* url); - char* (*get_hostname)(void* kodiBase); - bool (*is_local_host)(void* kodiBase, const char* hostname); - bool (*is_host_on_lan)(void* kodiBase, const char* hostname, bool offLineCheck); - char* (*get_user_agent)(void* kodiBase); - } AddonToKodiFuncTable_kodi_network; - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/CMakeLists.txt deleted file mode 100644 index 834ec00..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(HEADERS General.h - ListItem.h - Window.h - definitions.h - renderHelper.h) - -if(NOT ENABLE_STATIC_LIBS) - core_add_library(addons_kodi-addon-dev-kit_include_kodi_gui) -endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/General.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/General.h deleted file mode 100644 index b5a6393..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/General.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../AddonBase.h" -#include "definitions.h" - -namespace kodi -{ -namespace gui -{ - - //============================================================================ - /// - // \defgroup cpp_kodi_gui ::general - /// \addtogroup cpp_kodi_gui - /// @{ - /// @brief **Allow use of binary classes and function to use on add-on's** - /// - /// Permits the use of the required functions of the add-on to Kodi. This class - /// also contains some functions to the control. - /// - /// These are pure functions them no other initialization need. - /// - /// It has the header \ref kodi/gui/General.h "#include " be included - /// to enjoy it. - /// - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui - /// @brief Performs a graphical lock of rendering engine - /// - inline void ATTRIBUTE_HIDDEN Lock() - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->general->lock(); - } - - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui - /// @brief Performs a graphical unlock of previous locked rendering engine - /// - inline void ATTRIBUTE_HIDDEN Unlock() - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->general->unlock(); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui - /// @brief Return the the current screen height with pixel - /// - inline int ATTRIBUTE_HIDDEN GetScreenHeight() - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->general->get_screen_height(CAddonBase::m_interface->toKodi->kodiBase); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui - /// @brief Return the the current screen width with pixel - /// - inline int ATTRIBUTE_HIDDEN GetScreenWidth() - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->general->get_screen_width(CAddonBase::m_interface->toKodi->kodiBase); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui - /// @brief Return the the current screen rendering resolution - /// - inline int ATTRIBUTE_HIDDEN GetVideoResolution() - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->general->get_video_resolution(CAddonBase::m_interface->toKodi->kodiBase); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui - /// @brief Returns the id for the current 'active' dialog as an integer. - /// - /// @return The currently active dialog Id - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// .. - /// int wid = kodi::gui::GetCurrentWindowDialogId(); - /// .. - /// ~~~~~~~~~~~~~ - /// - inline int ATTRIBUTE_HIDDEN GetCurrentWindowDialogId() - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->general->get_current_window_dialog_id(CAddonBase::m_interface->toKodi->kodiBase); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui - /// @brief Returns the id for the current 'active' window as an integer. - /// - /// @return The currently active window Id - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// .. - /// int wid = kodi::gui::GetCurrentWindowId(); - /// .. - /// ~~~~~~~~~~~~~ - /// - inline int ATTRIBUTE_HIDDEN GetCurrentWindowId() - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->general->get_current_window_id(CAddonBase::m_interface->toKodi->kodiBase); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui - /// \brief To get hardware specific device context interface - /// - /// \return The currently active device context - /// - /// \warning This function is only be supported under Windows, on all other - /// OS it return `nullptr`! - /// - /// \note Returned Windows class pointer is `ID3D11DeviceContext1`. - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// .. - /// ID3D11DeviceContext1* context = static_cast(kodi::gui::GetHWContext()); - /// .. - /// ~~~~~~~~~~~~~ - /// - inline void* GetHWContext() - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->general->get_hw_context(CAddonBase::m_interface->toKodi->kodiBase); - } - //-------------------------------------------------------------------------- - -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h deleted file mode 100644 index 1af4863..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../AddonBase.h" -#include "definitions.h" - -#include - -namespace kodi -{ -namespace gui -{ - - class CWindow; - - class ATTRIBUTE_HIDDEN CAddonGUIControlBase - { - public: - GUIHANDLE GetControlHandle() const { return m_controlHandle; } - - protected: - explicit CAddonGUIControlBase(CAddonGUIControlBase* window) - : m_controlHandle(nullptr), - m_interface(::kodi::addon::CAddonBase::m_interface->toKodi), - m_Window(window) {} - - virtual ~CAddonGUIControlBase() = default; - - friend class CWindow; - - GUIHANDLE m_controlHandle; - AddonToKodiFuncTable_Addon* m_interface; - CAddonGUIControlBase* m_Window; - - private: - CAddonGUIControlBase() = delete; - CAddonGUIControlBase(const CAddonGUIControlBase&) = delete; - CAddonGUIControlBase &operator=(const CAddonGUIControlBase&) = delete; - }; - - class CListItem; - typedef std::shared_ptr ListItemPtr; - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_CListItem List Item - /// \ingroup cpp_kodi_gui - /// @brief \cpp_class{ kodi::gui::CListItem } - /// **Selectable window list item** - /// - /// The list item control is used for creating item lists in Kodi - /// - /// The with \ref ListItem.h "#include " given - /// class is used to create a item entry for a list on window and to support it's - /// control. - /// - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_CListItem_Defs Definitions, structures and enumerators - /// \ingroup cpp_kodi_gui_CListItem - /// @brief **Library definition values** - /// - - class ATTRIBUTE_HIDDEN CListItem : public CAddonGUIControlBase - { - public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief Class constructor with parameters - /// - /// @param[in] label Item label - /// @param[in] label2 Second Item label (if needed) - /// @param[in] iconImage Item icon image (if needed) - /// @param[in] path Path to where item is defined - /// - CListItem( - const std::string& label = "", - const std::string& label2 = "", - const std::string& iconImage = "", - const std::string& path = "") - : CAddonGUIControlBase(nullptr) - { - m_controlHandle = m_interface->kodi_gui->listItem->create(m_interface->kodiBase, label.c_str(), - label2.c_str(), iconImage.c_str(), - path.c_str()); - } - - /* - * Constructor used for parts given by list items from addon window - * - * Related to call of "ListItemPtr kodi::gui::CWindow::GetListItem(int listPos)" - * Not needed for addon development itself - */ - explicit CListItem(GUIHANDLE listItemHandle) - : CAddonGUIControlBase(nullptr) - { - m_controlHandle = listItemHandle; - } - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief Class destructor - /// - ~CListItem() override - { - m_interface->kodi_gui->listItem->destroy(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief Returns the listitem label. - /// - /// @return Label of item - /// - std::string GetLabel() - { - std::string label; - char* ret = m_interface->kodi_gui->listItem->get_label(m_interface->kodiBase, m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - label = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return label; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief Sets the listitem label. - /// - /// @param[in] label string or unicode - text string. - /// - void SetLabel(const std::string& label) - { - m_interface->kodi_gui->listItem->set_label(m_interface->kodiBase, m_controlHandle, label.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief Returns the second listitem label. - /// - /// @return Second label of item - /// - std::string GetLabel2() - { - std::string label; - char* ret = m_interface->kodi_gui->listItem->get_label2(m_interface->kodiBase, m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - label = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return label; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief Sets the listitem's label2. - /// - /// @param[in] label string or unicode - text string. - /// - void SetLabel2(const std::string& label) - { - m_interface->kodi_gui->listItem->set_label2(m_interface->kodiBase, m_controlHandle, label.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief Sets the listitem's art - /// - /// @param[in] type Type of Art to set - /// - Some default art values (any string possible): - /// | value (type) | Type | - /// |:-------------:|:--------------------------------------------------| - /// | thumb | string - image filename - /// | poster | string - image filename - /// | banner | string - image filename - /// | fanart | string - image filename - /// | clearart | string - image filename - /// | clearlogo | string - image filename - /// | landscape | string - image filename - /// | icon | string - image filename - /// @return The url to use for Art - /// - std::string GetArt(const std::string& type) - { - std::string strReturn; - char* ret = m_interface->kodi_gui->listItem->get_art(m_interface->kodiBase, m_controlHandle, type.c_str()); - if (ret != nullptr) - { - if (std::strlen(ret)) - strReturn = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return strReturn; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief Sets the listitem's art - /// - /// @param[in] type Type of Art to set - /// @param[in] url The url to use for Art - /// - Some default art values (any string possible): - /// | value (type) | Type | - /// |:-------------:|:--------------------------------------------------| - /// | thumb | string - image filename - /// | poster | string - image filename - /// | banner | string - image filename - /// | fanart | string - image filename - /// | clearart | string - image filename - /// | clearlogo | string - image filename - /// | landscape | string - image filename - /// | icon | string - image filename - /// - void SetArt(const std::string& type, const std::string& url) - { - m_interface->kodi_gui->listItem->set_art(m_interface->kodiBase, m_controlHandle, type.c_str(), url.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief Returns the path / filename of this listitem. - /// - /// @return Path string - /// - std::string GetPath() - { - std::string strReturn; - char* ret = m_interface->kodi_gui->listItem->get_path(m_interface->kodiBase, m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - strReturn = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return strReturn; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief Sets the listitem's path. - /// - /// @param[in] path string or unicode - path, activated when - /// item is clicked. - /// - /// @note You can use the above as keywords for arguments. - /// - void SetPath(const std::string& path) - { - m_interface->kodi_gui->listItem->set_path(m_interface->kodiBase, m_controlHandle, path.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief Sets a listitem property, similar to an infolabel. - /// - /// @param[in] key string - property name. - /// @param[in] value string or unicode - value of property. - /// - /// @note Key is NOT case sensitive. - /// You can use the above as keywords for arguments and skip certain\n - /// optional arguments.\n - /// Once you use a keyword, all following arguments require the - /// keyword. - /// - /// Some of these are treated internally by Kodi, such as the - /// 'StartOffset' property, which is the offset in seconds at which to - /// start playback of an item. Others may be used in the skin to add - /// extra information, such as 'WatchedCount' for tvshow items - /// - void SetProperty(const std::string& key, const std::string& value) - { - m_interface->kodi_gui->listItem->set_property(m_interface->kodiBase, m_controlHandle, key.c_str(), value.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief Returns a listitem property as a string, similar to an infolabel. - /// - /// @param[in] key string - property name. - /// @return string - List item property - /// - /// @note Key is NOT case sensitive.\n - /// You can use the above as keywords for arguments and skip certain - /// optional arguments.\n - /// Once you use a keyword, all following arguments require the - /// keyword. - /// - std::string GetProperty(const std::string& key) - { - std::string label; - char* ret = m_interface->kodi_gui->listItem->get_property(m_interface->kodiBase, m_controlHandle, key.c_str()); - if (ret != nullptr) - { - if (std::strlen(ret)) - label = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return label; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief To control selection of item in list (also multiple selection, - /// in list on serveral items possible). - /// - /// @param[in] selected if true becomes set as selected - /// - void Select(bool selected) - { - m_interface->kodi_gui->listItem->select(m_interface->kodiBase, m_controlHandle, selected); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CListItem - /// @brief Returns the listitem's selected status. - /// - /// @return true if selected, otherwise false - /// - bool IsSelected() - { - return m_interface->kodi_gui->listItem->is_selected(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - }; - -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h deleted file mode 100644 index 5011374..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h +++ /dev/null @@ -1,909 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../AddonBase.h" -#include "ListItem.h" - -#ifdef BUILD_KODI_ADDON -#include "../ActionIDs.h" -#else -#include "input/actions/ActionIDs.h" -#endif - -namespace kodi -{ -namespace gui -{ - - class CListItem; - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_CWindow Window - /// \ingroup cpp_kodi_gui - /// @brief \cpp_class{ kodi::gui::CWindow } - /// **Main window control class** - /// - /// The with \ref Window.h "#include " - /// included file brings support to create a window or dialog on Kodi. - /// - /// -------------------------------------------------------------------------- - /// - /// On functions defined input variable controlId (GUI control identifier) - /// is the on window.xml defined value behind type added with id="..." and - /// used to identify for changes there and on callbacks. - /// - /// ~~~~~~~~~~~~~{.xml} - /// - /// Title Label - /// ... - /// - /// - /// progress control - /// ... - /// - /// ~~~~~~~~~~~~~ - /// - /// - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_CWindow_Defs Definitions, structures and enumerators - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Library definition values - /// - - class ATTRIBUTE_HIDDEN CWindow : public CAddonGUIControlBase - { - public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Class constructor with needed values for window / dialog. - /// - /// Creates a new Window class. - /// - /// @param[in] xmlFilename XML file for the skin - /// @param[in] defaultSkin default skin to use if needed not available - /// @param[in] asDialog Use window as dialog if set - /// @param[in] isMedia [opt] bool - if False, create a regular window. - /// if True, create a mediawindow. - /// (default=false) - /// @note only usable for windows not for dialogs. - /// - /// - CWindow(const std::string& xmlFilename, const std::string& defaultSkin, bool asDialog, bool isMedia = false) - : CAddonGUIControlBase(nullptr) - { - m_controlHandle = m_interface->kodi_gui->window->create(m_interface->kodiBase, xmlFilename.c_str(), - defaultSkin.c_str(), asDialog, isMedia); - if (!m_controlHandle) - kodi::Log(ADDON_LOG_FATAL, "kodi::gui::CWindow can't create window class from Kodi !!!"); - m_interface->kodi_gui->window->set_callbacks(m_interface->kodiBase, m_controlHandle, this, - CBOnInit, CBOnFocus, CBOnClick, CBOnAction, - CBGetContextButtons, CBOnContextButton); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup CWindow - /// @brief Class destructor - /// - /// - /// - ~CWindow() override - { - if (m_controlHandle) - m_interface->kodi_gui->window->destroy(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Show this window. - /// - /// Shows this window by activating it, calling close() after it wil activate the - /// current window again. - /// - /// @note If your Add-On ends this window will be closed to. To show it forever, - /// make a loop at the end of your Add-On or use doModal() instead. - /// - /// @warning If used must be the class be global present until Kodi becomes - /// closed. The creation can be done after before "Show" becomes called, but - /// not delete class after them. - /// - /// @return Return true if call and show is successed, - /// if false was something failed to get needed - /// skin parts. - /// - bool Show() - { - return m_interface->kodi_gui->window->show(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Closes this window. - /// - /// Closes this window by activating the old window. - /// @note The window is not deleted with this method. - /// - void Close() - { - m_interface->kodi_gui->window->close(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Display this window until close() is called. - /// - void DoModal() - { - m_interface->kodi_gui->window->do_modal(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Gives the control with the supplied focus. - /// - /// @param[in] iControlId On skin defined id of control - /// @return Return true if call and focus is successed, - /// if false was something failed to get needed - /// skin parts. - /// - /// - bool SetFocusId(int iControlId) - { - return m_interface->kodi_gui->window->set_focus_id(m_interface->kodiBase, m_controlHandle, iControlId); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Returns the id of the control which is focused. - /// - /// @return Focused control id - /// - /// - int GetFocusId() - { - return m_interface->kodi_gui->window->get_focus_id(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief To set the used label on given control id - /// - /// @param[in] controlId Control id where label need to set - /// @param[in] label Label to use - /// - /// - void SetControlLabel(int controlId, const std::string& label) - { - m_interface->kodi_gui->window->set_control_label(m_interface->kodiBase, m_controlHandle, controlId, label.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief To set the visibility on given control id - /// - /// @param[in] controlId Control id where visibility is changed - /// @param[in] visible Boolean value with `true` for visible, `false` for hidden - /// - /// - void SetControlVisible(int controlId, bool visible) - { - m_interface->kodi_gui->window->set_control_visible(m_interface->kodiBase, m_controlHandle, controlId, visible); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief To set the selection on given control id - /// - /// @param[in] controlId Control id where selection is changed - /// @param[in] selected Boolean value with `true` for selected, `false` for not - /// - /// - void SetControlSelected(int controlId, bool selected) - { - m_interface->kodi_gui->window->set_control_selected(m_interface->kodiBase, m_controlHandle, controlId, selected); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Sets a window property, similar to an infolabel. - /// - /// @param[in] key string - property name. - /// @param[in] value string or unicode - value of property. - /// - /// @note Key is NOT case sensitive. Setting value to an empty string is - /// equivalent to clearProperty(key).\n - /// You can use the above as keywords for arguments and skip certain - /// optional arguments.\n - /// Once you use a keyword, all following arguments require the keyword. - /// - void SetProperty(const std::string& key, const std::string& value) - { - m_interface->kodi_gui->window->set_property(m_interface->kodiBase, m_controlHandle, key.c_str(), value.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Returns a window property as a string, similar to an infolabel. - /// - /// @param[in] key string - property name. - /// @return The property as strin (if present) - /// - /// @note Key is NOT case sensitive. Setting value to an empty string is - /// equivalent to clearProperty(key).\n - /// You can use the above as keywords for arguments and skip certain - /// optional arguments.\n - /// Once you use a keyword, all following arguments require the keyword. - /// - /// - std::string GetProperty(const std::string& key) const - { - std::string label; - char* ret = m_interface->kodi_gui->window->get_property(m_interface->kodiBase, m_controlHandle, key.c_str()); - if (ret != nullptr) - { - if (std::strlen(ret)) - label = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return label; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Sets a window property with integer value - /// - /// @param[in] key string - property name. - /// @param[in] value integer value to set - /// - /// - void SetPropertyInt(const std::string& key, int value) - { - m_interface->kodi_gui->window->set_property_int(m_interface->kodiBase, m_controlHandle, key.c_str(), value); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Returns a window property with integer value - /// - /// @param[in] key string - property name. - /// @return integer value of property - /// - int GetPropertyInt(const std::string& key) const - { - return m_interface->kodi_gui->window->get_property_int(m_interface->kodiBase, m_controlHandle, key.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Sets a window property with boolean value - /// - /// @param[in] key string - property name. - /// @param[in] value boolean value to set - /// - /// - void SetPropertyBool(const std::string& key, bool value) - { - m_interface->kodi_gui->window->set_property_bool(m_interface->kodiBase, m_controlHandle, key.c_str(), value); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Returns a window property with boolean value - /// - /// @param[in] key string - property name. - /// @return boolean value of property - /// - bool GetPropertyBool(const std::string& key) const - { - return m_interface->kodi_gui->window->get_property_bool(m_interface->kodiBase, m_controlHandle, key.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Sets a window property with double value - /// - /// @param[in] key string - property name. - /// @param[in] value double value to set - /// - /// - void SetPropertyDouble(const std::string& key, double value) - { - m_interface->kodi_gui->window->set_property_double(m_interface->kodiBase, m_controlHandle, key.c_str(), value); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Returns a window property with double value - /// - /// @param[in] key string - property name. - /// @return double value of property - /// - /// - double GetPropertyDouble(const std::string& key) const - { - return m_interface->kodi_gui->window->get_property_double(m_interface->kodiBase, m_controlHandle, key.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Remove all present properties from window - /// - /// - /// - void ClearProperties() - { - m_interface->kodi_gui->window->clear_properties(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Clears the specific window property. - /// - /// @param[in] key string - property name. - /// - /// @note Key is NOT case sensitive. Equivalent to SetProperty(key, "") - /// You can use the above as keywords for arguments and skip certain - /// optional arguments. - /// Once you use a keyword, all following arguments require the - /// keyword. - /// - /// - ///----------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// .. - /// ClearProperty('Category') - /// .. - /// ~~~~~~~~~~~~~ - /// - void ClearProperty(const std::string& key) - { - m_interface->kodi_gui->window->clear_property(m_interface->kodiBase, m_controlHandle, key.c_str()); - } - //-------------------------------------------------------------------------- - - //@{ - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Function delete all entries in integrated list. - /// - /// - /// - void ClearList() - { - m_interface->kodi_gui->window->clear_item_list(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief To add a list item in the on window integrated list. - /// - /// @param[in] item List item to add - /// @param[in] itemPosition [opt] The position for item, default is on end - /// - /// - void AddListItem(ListItemPtr item, int itemPosition = -1) - { - m_interface->kodi_gui->window->add_list_item(m_interface->kodiBase, m_controlHandle, item->m_controlHandle, itemPosition); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief To add a list item based upon string in the on window integrated list. - /// - /// @param[in] item List item to add - /// @param[in] itemPosition [opt] The position for item, default is on end - /// - /// - void AddListItem(const std::string item, int itemPosition = -1) - { - m_interface->kodi_gui->window->add_list_item(m_interface->kodiBase, m_controlHandle, std::make_shared(item)->m_controlHandle, itemPosition); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Remove list item on position. - /// - /// @param[in] itemPosition List position to remove - /// - /// - void RemoveListItem(int itemPosition) - { - m_interface->kodi_gui->window->remove_list_item_from_position(m_interface->kodiBase, m_controlHandle, itemPosition); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Remove item with given control class from list. - /// - /// @param[in] item List item control class to remove - /// - /// - void RemoveListItem(ListItemPtr item) - { - m_interface->kodi_gui->window->remove_list_item(m_interface->kodiBase, m_controlHandle, item->m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief To get list item control class on wanted position. - /// - /// @param[in] listPos Position from where control is needed - /// @return The list item control class or null if not found - /// - /// @warning Function returns a new generated **CListItem** class! - /// - ListItemPtr GetListItem(int listPos) - { - GUIHANDLE handle = m_interface->kodi_gui->window->get_list_item(m_interface->kodiBase, m_controlHandle, listPos); - if (!handle) - return ListItemPtr(); - - return std::make_shared(handle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief To set position of selected part in list. - /// - /// @param[in] listPos Position to use - /// - /// - void SetCurrentListPosition(int listPos) - { - m_interface->kodi_gui->window->set_current_list_position(m_interface->kodiBase, m_controlHandle, listPos); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief To get current selected position in list - /// - /// @return Current list position - /// - /// - int GetCurrentListPosition() - { - return m_interface->kodi_gui->window->get_current_list_position(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief To get the amount of entries in the list. - /// - /// @return Size of in window integrated control class - /// - /// - int GetListSize() - { - return m_interface->kodi_gui->window->get_list_size(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Sets a container property, similar to an infolabel. - /// - /// @param[in] key string - property name. - /// @param[in] value string or unicode - value of property. - /// - /// @note Key is NOT case sensitive.\n - /// You can use the above as keywords for arguments and skip certain - /// optional arguments.\n - /// Once you use a keyword, all following arguments require the keyword. - /// - /// - void SetContainerProperty(const std::string& key, const std::string& value) - { - m_interface->kodi_gui->window->set_container_property(m_interface->kodiBase, m_controlHandle, key.c_str(), value.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Sets the content type of the container. - /// - /// @param[in] value string or unicode - content value. - /// - /// __Available content types__ - /// | Name | Media | - /// |:-----------:|:-----------------------------------------| - /// | actors | Videos - /// | addons | Addons, Music, Pictures, Programs, Videos - /// | albums | Music, Videos - /// | artists | Music, Videos - /// | countries | Music, Videos - /// | directors | Videos - /// | files | Music, Videos - /// | games | Games - /// | genres | Music, Videos - /// | images | Pictures - /// | mixed | Music, Videos - /// | movies | Videos - /// | Musicvideos | Music, Videos - /// | playlists | Music, Videos - /// | seasons | Videos - /// | sets | Videos - /// | songs | Music - /// | studios | Music, Videos - /// | tags | Music, Videos - /// | tvshows | Videos - /// | videos | Videos - /// | years | Music, Videos - /// - /// - void SetContainerContent(const std::string& value) - { - m_interface->kodi_gui->window->set_container_content(m_interface->kodiBase, m_controlHandle, value.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief Get the id of the currently visible container. - /// - /// @return currently visible container id - /// - /// - int GetCurrentContainerId() - { - return m_interface->kodi_gui->window->get_current_container_id(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - //@} - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow - /// @brief To inform Kodi that it need to render region new. - /// - /// - void MarkDirtyRegion() - { - return m_interface->kodi_gui->window->mark_dirty_region(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - // - /// @defgroup cpp_kodi_gui_CWindow_callbacks Callback functions from Kodi to add-on - /// \ingroup cpp_kodi_gui_CWindow - //@{ - /// @brief GUI window callback functions. - /// - /// Functions to handle control callbacks from Kodi - /// - /// ------------------------------------------------------------------------ - /// - /// @link cpp_kodi_gui_CWindow Go back to normal functions from CWindow@endlink - // - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow_callbacks - /// @brief OnInit method. - /// - /// @return Return true if initialize was done successful - /// - /// - virtual bool OnInit() { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow_callbacks - /// @brief OnFocus method. - /// - /// @param[in] controlId GUI control identifier - /// @return Return true if focus condition was handled there or false to handle them by Kodi itself - /// - /// - virtual bool OnFocus(int controlId) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow_callbacks - /// @brief OnClick method. - /// - /// @param[in] controlId GUI control identifier - /// @return Return true if click was handled there - /// or false to handle them by Kodi itself - /// - /// - virtual bool OnClick(int controlId) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow_callbacks - /// @brief OnAction method. - /// - /// @param[in] actionId The action id to perform, see - /// \ref kodi_key_action_ids to get list of - /// them - /// @return Return true if action was handled there - /// or false to handle them by Kodi itself - /// - /// - /// This method will receive all actions that the main program will send - /// to this window. - /// - /// @note - /// - By default, only the \c PREVIOUS_MENU and \c NAV_BACK actions are handled. - /// - Overwrite this method to let your code handle all actions. - /// - Don't forget to capture \c ACTION_PREVIOUS_MENU or \c ACTION_NAV_BACK, else the user can't close this window. - /// - /// - ///-------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// .. - /// /* Window used with parent / child way */ - /// bool cYOUR_CLASS::OnAction(int actionId) - /// { - /// switch (action) - /// { - /// case ACTION_PREVIOUS_MENU: - /// case ACTION_NAV_BACK: - /// printf("action recieved: previous"); - /// Close(); - /// return true; - /// case ACTION_SHOW_INFO: - /// printf("action recieved: show info"); - /// break; - /// case ACTION_STOP: - /// printf("action recieved: stop"); - /// break; - /// case ACTION_PAUSE: - /// printf("action recieved: pause"); - /// break; - /// default: - /// break; - /// } - /// return false; - /// } - /// .. - /// ~~~~~~~~~~~~~ - /// - virtual bool OnAction(int actionId, uint32_t buttoncode, wchar_t unicode) - { - switch (actionId) - { - case ACTION_PREVIOUS_MENU: - case ACTION_NAV_BACK: - Close(); - return true; - default: - break; - } - return false; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow_callbacks - /// @brief Get context menu buttons for list entry - /// - /// @param[in] itemNumber selected list item entry - /// @param[in] buttons list where context menus becomes added with his - /// identifier and name. - /// - virtual void GetContextButtons(int itemNumber, std::vector< std::pair > &buttons) - { - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow_callbacks - /// @brief Called after selection in context menu - /// - /// @param[in] itemNumber selected list item entry - /// @param[in] button the pressed button id - /// @return true if handled, otherwise false - /// - virtual bool OnContextButton(int itemNumber, unsigned int button) - { - return false; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_CWindow_callbacks - /// @brief **Set independent callbacks** - /// - /// If the class is used independent (with "new CWindow") and - /// not as parent (with "cCLASS_own : CWindow") from own must be the - /// callback from Kodi to add-on overdriven with own functions! - /// - /// @param[in] cbhdl The pointer to own handle data - /// structure / class - /// @param[in] CBOnInit Own defined window init function - /// @param[in] CBOnFocus Own defined focus function - /// @param[in] CBOnClick Own defined click function - /// @param[in] CBOnAction Own defined action function - /// @param[in] CBGetContextButtons [opt] To get context menu entries for - /// lists function - /// @param[in] CBOnContextButton [opt] Used context menu entry function - /// - /// - ///-------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// ... - /// - /// bool OnInit(GUIHANDLE cbhdl) - /// { - /// ... - /// return true; - /// } - /// - /// bool OnFocus(GUIHANDLE cbhdl, int controlId) - /// { - /// ... - /// return true; - /// } - /// - /// bool OnClick(GUIHANDLE cbhdl, int controlId) - /// { - /// ... - /// return true; - /// } - /// - /// bool OnAction(GUIHANDLE cbhdl, int actionId) - /// { - /// ... - /// return true; - /// } - /// - /// ... - /// /* Somewhere where you create the window */ - /// CWindow myWindow = new CWindow; - /// myWindow->SetIndependentCallbacks(myWindow, OnInit, OnFocus, OnClick, OnAction); - /// ... - /// ~~~~~~~~~~~~~ - /// - void SetIndependentCallbacks( - GUIHANDLE cbhdl, - bool (*CBOnInit) (GUIHANDLE cbhdl), - bool (*CBOnFocus) (GUIHANDLE cbhdl, int controlId), - bool (*CBOnClick) (GUIHANDLE cbhdl, int controlId), - bool (*CBOnAction) (GUIHANDLE cbhdl, int actionId, uint32_t buttoncode, wchar_t unicode), - void (*CBGetContextButtons) (GUIHANDLE cbhdl, int itemNumber, gui_context_menu_pair* buttons, unsigned int* size) = nullptr, - bool (*CBOnContextButton) (GUIHANDLE cbhdl, int itemNumber, unsigned int button) = nullptr) - { - if (!cbhdl || - !CBOnInit || !CBOnFocus || !CBOnClick || !CBOnAction) - { - kodi::Log(ADDON_LOG_FATAL, "kodi::gui::CWindow::%s called with nullptr !!!", __FUNCTION__); - return; - } - - m_interface->kodi_gui->window->set_callbacks(m_interface->kodiBase, m_controlHandle, cbhdl, - CBOnInit, CBOnFocus, CBOnClick, CBOnAction, - CBGetContextButtons, CBOnContextButton); - } - //-------------------------------------------------------------------------- - //@} - - private: - static bool CBOnInit(GUIHANDLE cbhdl) - { - return static_cast(cbhdl)->OnInit(); - } - - static bool CBOnFocus(GUIHANDLE cbhdl, int controlId) - { - return static_cast(cbhdl)->OnFocus(controlId); - } - - static bool CBOnClick(GUIHANDLE cbhdl, int controlId) - { - return static_cast(cbhdl)->OnClick(controlId); - } - - static bool CBOnAction(GUIHANDLE cbhdl, int actionId, uint32_t buttoncode, wchar_t unicode) - { - return static_cast(cbhdl)->OnAction(actionId, buttoncode, unicode); - } - - static void CBGetContextButtons(GUIHANDLE cbhdl, int itemNumber, gui_context_menu_pair* buttons, unsigned int* size) - { - std::vector< std::pair > buttonList; - static_cast(cbhdl)->GetContextButtons(itemNumber, buttonList); - if (!buttonList.empty()) - { - unsigned int presentSize = static_cast(buttonList.size()); - if (presentSize > *size) - kodi::Log(ADDON_LOG_WARNING, "GetContextButtons: More as allowed '%i' entries present!", *size); - else - *size = presentSize; - for (unsigned int i = 0; i < *size; ++i) - { - buttons[i].id = buttonList[i].first; - strncpy(buttons[i].name, buttonList[i].second.c_str(), ADDON_MAX_CONTEXT_ENTRY_NAME_LENGTH); - } - } - } - - static bool CBOnContextButton(GUIHANDLE cbhdl, int itemNumber, unsigned int button) - { - return static_cast(cbhdl)->OnContextButton(itemNumber, button); - } - }; - -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h deleted file mode 100644 index 081ab06..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../Window.h" - -namespace kodi -{ -namespace gui -{ -namespace controls -{ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_controls_CButton Control Button -/// \ingroup cpp_kodi_gui -/// @brief \cpp_class{ kodi::gui::controls::CButton } -/// **Standard push button control for window** -/// -/// The button control is used for creating push buttons in Kodi. You can -/// choose the position, size, and look of the button, as well as choosing -/// what action(s) should be performed when pushed. -/// -/// It has the header \ref Button.h "#include " -/// be included to enjoy it. -/// -/// Here you find the needed skin part for a \ref skin_Button_control "button control" -/// -/// @note The call of the control is only possible from the corresponding -/// window as its class and identification number is required. -/// -class ATTRIBUTE_HIDDEN CButton : public CAddonGUIControlBase -{ -public: - //========================================================================== - /// - /// @ingroup cpp_kodi_gui_control_CButton - /// @brief Construct a new control - /// - /// @param[in] window related window control class - /// @param[in] controlId Used skin xml control id - /// - CButton(CWindow* window, int controlId) : CAddonGUIControlBase(window) - { - m_controlHandle = m_interface->kodi_gui->window->get_control_button( - m_interface->kodiBase, m_Window->GetControlHandle(), controlId); - if (!m_controlHandle) - kodi::Log(ADDON_LOG_FATAL, "kodi::gui::CButton can't create control class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_gui_control_CButton - /// @brief Destructor - /// - ~CButton() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_gui_control_CButton - /// @brief Set the control on window to visible - /// - /// @param[in] visible If true visible, otherwise hidden - /// - void SetVisible(bool visible) - { - m_interface->kodi_gui->control_button->set_visible(m_interface->kodiBase, m_controlHandle, - visible); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_gui_control_CButton - /// @brief Set's the control's enabled/disabled state - /// - /// @param[in] enabled If true enabled, otherwise disabled - /// - void SetEnabled(bool enabled) - { - m_interface->kodi_gui->control_button->set_enabled(m_interface->kodiBase, m_controlHandle, - enabled); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_gui_control_CButton - /// @brief To set the text string on button - /// - /// @param[in] label Text to show - /// - void SetLabel(const std::string& label) - { - m_interface->kodi_gui->control_button->set_label(m_interface->kodiBase, m_controlHandle, - label.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_gui_control_CButton - /// @brief Get the used text from button - /// - /// @return Text shown - /// - std::string GetLabel() const - { - std::string label; - char* ret = - m_interface->kodi_gui->control_button->get_label(m_interface->kodiBase, m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - label = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return label; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_gui_control_CButton - /// @brief If two labels are used for button becomes it set with them - /// - /// @param[in] label Text for second label - /// - void SetLabel2(const std::string& label) - { - m_interface->kodi_gui->control_button->set_label2(m_interface->kodiBase, m_controlHandle, - label.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// @ingroup cpp_kodi_gui_control_CButton - /// @brief Get the second label if present - /// - /// @return Second label - /// - std::string GetLabel2() const - { - std::string label; - char* ret = - m_interface->kodi_gui->control_button->get_label2(m_interface->kodiBase, m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - label = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return label; - } - //-------------------------------------------------------------------------- -}; - -} /* namespace controls */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/CMakeLists.txt deleted file mode 100644 index c7cc1dd..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -set(HEADERS Button.h - Edit.h - FadeLabel.h - Image.h - Label.h - Progress.h - RadioButton.h - Rendering.h - SettingsSlider.h - Slider.h - Spin.h - TextBox.h) - -if(NOT ENABLE_STATIC_LIBS) - core_add_library(addons_kodi-addon-dev-kit_include_kodi_gui_controls) -endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h deleted file mode 100644 index 99c01de..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../Window.h" - -namespace kodi -{ -namespace gui -{ -namespace controls -{ - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_controls_CEdit Control Edit - /// \ingroup cpp_kodi_gui - /// @brief \cpp_class{ kodi::gui::controls::CEdit } - /// **Editable window text control used as an input control for the osd keyboard - /// and other input fields** - /// - /// The edit control allows a user to input text in Kodi. You can choose the - /// font, size, colour, location and header of the text to be displayed. - /// - /// It has the header \ref Edit.h "#include " - /// be included to enjoy it. - /// - /// Here you find the needed skin part for a \ref skin_Edit_control - /// "edit control". - /// - /// @note The call of the control is only possible from the corresponding - /// window as its class and identification number is required. - /// - - //============================================================================ - // see gui/definition.h for use of group "cpp_kodi_gui_controls_CEdit_Defs" - /// - /// \defgroup cpp_kodi_gui_controls_CEdit_Defs Definitions, structures and enumerators - /// \ingroup cpp_kodi_gui_controls_CEdit - /// @brief **Library definition values** - /// - -} /* namespace controls */ -} /* namespace gui */ -} /* namespace kodi */ - -//============================================================================ -/// -/// \ingroup cpp_kodi_gui_controls_CEdit_Defs -/// @{ -/// @anchor AddonGUIInputType -/// @brief Text input types used on kodi::gui::controls::CEdit -enum AddonGUIInputType -{ - /// Text inside edit control only readable - ADDON_INPUT_TYPE_READONLY = -1, - /// Normal text entries - ADDON_INPUT_TYPE_TEXT = 0, - /// To use on edit control only numeric numbers - ADDON_INPUT_TYPE_NUMBER, - /// To insert seconds - ADDON_INPUT_TYPE_SECONDS, - /// To insert time - ADDON_INPUT_TYPE_TIME, - /// To insert a date - ADDON_INPUT_TYPE_DATE, - /// Used for write in IP addresses - ADDON_INPUT_TYPE_IPADDRESS, - /// Text field used as password entry field with not visible text - ADDON_INPUT_TYPE_PASSWORD, - /// Text field used as password entry field with not visible text but - /// returned as MD5 value - ADDON_INPUT_TYPE_PASSWORD_MD5, - /// Use text field for search purpose - ADDON_INPUT_TYPE_SEARCH, - /// Text field as filter - ADDON_INPUT_TYPE_FILTER, - /// - ADDON_INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW -}; -/// @} -//---------------------------------------------------------------------------- - -namespace kodi -{ -namespace gui -{ -namespace controls -{ - -class ATTRIBUTE_HIDDEN CEdit : public CAddonGUIControlBase -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CEdit - /// @brief Construct a new control - /// - /// @param[in] window related window control class - /// @param[in] controlId Used skin xml control id - /// - CEdit(CWindow* window, int controlId) : CAddonGUIControlBase(window) - { - m_controlHandle = m_interface->kodi_gui->window->get_control_edit( - m_interface->kodiBase, m_Window->GetControlHandle(), controlId); - if (!m_controlHandle) - kodi::Log(ADDON_LOG_FATAL, - "kodi::gui::control::CEdit can't create control class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CEdit - /// @brief Destructor - /// - ~CEdit() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CEdit - /// @brief Set the control on window to visible - /// - /// @param[in] visible If true visible, otherwise hidden - /// - void SetVisible(bool visible) - { - m_interface->kodi_gui->control_edit->set_visible(m_interface->kodiBase, m_controlHandle, - visible); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CEdit - /// @brief Set's the control's enabled/disabled state - /// - /// @param[in] enabled If true enabled, otherwise disabled - /// - void SetEnabled(bool enabled) - { - m_interface->kodi_gui->control_edit->set_enabled(m_interface->kodiBase, m_controlHandle, - enabled); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CEdit - /// @brief To set the text string on edit control - /// - /// @param[in] label Text to show - /// - void SetLabel(const std::string& label) - { - m_interface->kodi_gui->control_edit->set_label(m_interface->kodiBase, m_controlHandle, - label.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CEdit - /// @brief Returns the text heading for this edit control. - /// - /// @return Heading text - /// - std::string GetLabel() const - { - std::string label; - char* ret = - m_interface->kodi_gui->control_edit->get_label(m_interface->kodiBase, m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - label = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return label; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CEdit - /// @brief Set's text heading for this edit control. - /// - /// @param[in] text string or unicode - text string. - /// - void SetText(const std::string& text) - { - m_interface->kodi_gui->control_edit->set_text(m_interface->kodiBase, m_controlHandle, - text.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CEdit - /// @brief Returns the text value for this edit control. - /// - /// @return Text value of control - /// - std::string GetText() const - { - std::string text; - char* ret = - m_interface->kodi_gui->control_edit->get_text(m_interface->kodiBase, m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - text = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return text; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CEdit - /// @brief Set the cursor position on text. - /// - /// @param[in] iPosition The position to set - /// - void SetCursorPosition(unsigned int iPosition) - { - m_interface->kodi_gui->control_edit->set_cursor_position(m_interface->kodiBase, m_controlHandle, - iPosition); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CEdit - /// @brief To get current cursor position on text field - /// - /// @return The current cursor position - /// - unsigned int GetCursorPosition() - { - return m_interface->kodi_gui->control_edit->get_cursor_position(m_interface->kodiBase, - m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CEdit - /// @brief To set field input type which are defined on \ref AddonGUIInputType - /// - /// @param[in] type The \ref AddonGUIInputType "Add-on input type" - /// to use - /// @param[in] heading The heading text for related keyboard - /// dialog - /// - void SetInputType(AddonGUIInputType type, const std::string& heading) - { - m_interface->kodi_gui->control_edit->set_input_type(m_interface->kodiBase, m_controlHandle, - static_cast(type), heading.c_str()); - } - //-------------------------------------------------------------------------- -}; - -} /* namespace controls */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h deleted file mode 100644 index 02c843f..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../Window.h" - -namespace kodi -{ -namespace gui -{ -namespace controls -{ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_controls_CFadeLabel Control Fade Label -/// \ingroup cpp_kodi_gui -/// @brief \cpp_class{ kodi::gui::controls::CFadeLabel } -/// **Window control used to show multiple pieces of text in the same position, -/// by fading from one to the other** -/// -/// The fade label control is used for displaying multiple pieces of text in -/// the same space in Kodi. You can choose the font, size, colour, location -/// and contents of the text to be displayed. The first piece of information -/// to display fades in over 50 frames, then scrolls off to the left. Once it -/// is finished scrolling off screen, the second piece of information fades -/// in and the process repeats. A fade label control is not supported in a -/// list container. -/// -/// It has the header \ref FadeLabel.h "#include " -/// be included to enjoy it. -/// -/// Here you find the needed skin part for a \ref Fade_Label_Control "fade label control" -/// -/// @note The call of the control is only possible from the corresponding -/// window as its class and identification number is required. -/// -class ATTRIBUTE_HIDDEN CFadeLabel : public CAddonGUIControlBase -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CFadeLabel - /// @brief Construct a new control. - /// - /// @param[in] window related window control class - /// @param[in] controlId Used skin xml control id - /// - CFadeLabel(CWindow* window, int controlId) : CAddonGUIControlBase(window) - { - m_controlHandle = m_interface->kodi_gui->window->get_control_fade_label( - m_interface->kodiBase, m_Window->GetControlHandle(), controlId); - if (!m_controlHandle) - kodi::Log(ADDON_LOG_FATAL, - "kodi::gui::controls::CFadeLabel can't create control class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CFadeLabel - /// @brief Destructor. - /// - ~CFadeLabel() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CFadeLabel - /// @brief Set the control on window to visible. - /// - /// @param[in] visible If true visible, otherwise hidden - /// - void SetVisible(bool visible) - { - m_interface->kodi_gui->control_fade_label->set_visible(m_interface->kodiBase, m_controlHandle, - visible); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CFadeLabel - /// @brief To add additional text string on fade label. - /// - /// @param[in] label Text to show - /// - void AddLabel(const std::string& label) - { - m_interface->kodi_gui->control_fade_label->add_label(m_interface->kodiBase, m_controlHandle, - label.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CFadeLabel - /// @brief Get the used text from button - /// - /// @return Text shown - /// - std::string GetLabel() const - { - std::string label; - char* ret = m_interface->kodi_gui->control_fade_label->get_label(m_interface->kodiBase, - m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - label = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return label; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CFadeLabel - /// @brief To enable or disable scrolling on fade label - /// - /// @param[in] scroll To enable scrolling set to true, otherwise is - /// disabled - /// - void SetScrolling(bool scroll) - { - m_interface->kodi_gui->control_fade_label->set_scrolling(m_interface->kodiBase, m_controlHandle, - scroll); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CFadeLabel - /// @brief To reset al inserted labels. - /// - void Reset() - { - m_interface->kodi_gui->control_fade_label->reset(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- -}; - -} /* namespace controls */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h deleted file mode 100644 index b4d092f..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../Window.h" - -namespace kodi -{ -namespace gui -{ -namespace controls -{ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_controls_CImage Control Image -/// \ingroup cpp_kodi_gui -/// @brief \cpp_class{ kodi::gui::controls::CImage } -/// **Window control used to show an image.** -/// -/// The image control is used for displaying images in Kodi. You can choose -/// the position, size, transparency and contents of the image to be displayed. -/// -/// It has the header \ref Image.h "#include " -/// be included to enjoy it. -/// -/// Here you find the needed skin part for a \ref Image_Control "image control" -/// -/// @note The call of the control is only possible from the corresponding -/// window as its class and identification number is required. -/// -class ATTRIBUTE_HIDDEN CImage : public CAddonGUIControlBase -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CImage - /// @brief Construct a new control - /// - /// @param[in] window related window control class - /// @param[in] controlId Used skin xml control id - /// - CImage(CWindow* window, int controlId) : CAddonGUIControlBase(window) - { - m_controlHandle = m_interface->kodi_gui->window->get_control_image( - m_interface->kodiBase, m_Window->GetControlHandle(), controlId); - if (!m_controlHandle) - kodi::Log(ADDON_LOG_FATAL, - "kodi::gui::controls::CImage can't create control class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CImage - /// @brief Destructor - /// - ~CImage() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CImage - /// @brief Set the control on window to visible - /// - /// @param[in] visible If true visible, otherwise hidden - /// - void SetVisible(bool visible) - { - m_interface->kodi_gui->control_image->set_visible(m_interface->kodiBase, m_controlHandle, - visible); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CImage - /// @brief To set the filename used on image control. - /// - /// @param[in] filename Image file to use - /// @param[in] useCache To define storage of image, default is - /// in cache, if false becomes it loaded - /// always on changes again - /// - void SetFileName(const std::string& filename, bool useCache = true) - { - m_interface->kodi_gui->control_image->set_filename(m_interface->kodiBase, m_controlHandle, - filename.c_str(), useCache); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CImage - /// @brief To set set the diffuse color on image. - /// - /// @param[in] colorDiffuse Color to use for diffuse - /// - void SetColorDiffuse(uint32_t colorDiffuse) - { - m_interface->kodi_gui->control_image->set_color_diffuse(m_interface->kodiBase, m_controlHandle, - colorDiffuse); - } - //-------------------------------------------------------------------------- -}; - -} /* namespace controls */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h deleted file mode 100644 index 82604bd..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../Window.h" - -namespace kodi -{ -namespace gui -{ -namespace controls -{ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_controls_CLabel Control Label -/// \ingroup cpp_kodi_gui -/// @brief \cpp_class{ kodi::gui::controls::CLabel } -/// **Window control used to show some lines of text.** -/// -/// The label control is used for displaying text in Kodi. You can choose -/// the font, size, colour, location and contents of the text to be displayed. -/// -/// It has the header \ref Label.h "#include " -/// be included to enjoy it. -/// -/// Here you find the needed skin part for a \ref Label_Control "label control" -/// -/// @note The call of the control is only possible from the corresponding -/// window as its class and identification number is required. -/// -class ATTRIBUTE_HIDDEN CLabel : public CAddonGUIControlBase -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CLabel - /// @brief Construct a new control - /// - /// @param[in] window related window control class - /// @param[in] controlId Used skin xml control id - /// - CLabel(CWindow* window, int controlId) : CAddonGUIControlBase(window) - { - m_controlHandle = m_interface->kodi_gui->window->get_control_label( - m_interface->kodiBase, m_Window->GetControlHandle(), controlId); - if (!m_controlHandle) - kodi::Log(ADDON_LOG_FATAL, - "kodi::gui::controls::CLabel can't create control class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CLabel - /// @brief Destructor - /// - ~CLabel() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CLabel - /// @brief Set the control on window to visible - /// - /// @param[in] visible If true visible, otherwise hidden - /// - void SetVisible(bool visible) - { - m_interface->kodi_gui->control_label->set_visible(m_interface->kodiBase, m_controlHandle, - visible); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CLabel - /// @brief To set the text string on label - /// - /// @param[in] text Text to show - /// - void SetLabel(const std::string& text) - { - m_interface->kodi_gui->control_label->set_label(m_interface->kodiBase, m_controlHandle, - text.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CLabel - /// @brief Get the used text from control - /// - /// @return Used text on label control - /// - std::string GetLabel() const - { - std::string label; - char* ret = - m_interface->kodi_gui->control_label->get_label(m_interface->kodiBase, m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - label = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return label; - } - //-------------------------------------------------------------------------- -}; - -} /* namespace controls */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h deleted file mode 100644 index 8cb582b..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../Window.h" - -namespace kodi -{ -namespace gui -{ -namespace controls -{ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_controls_CProgress Control Progress -/// \ingroup cpp_kodi_gui -/// @brief \cpp_class{ kodi::gui::controls::CProgress } -/// **Window control to show the progress of a particular operation** -/// -/// The progress control is used to show the progress of an item that may take -/// a long time, or to show how far through a movie you are. You can choose -/// the position, size, and look of the progress control. -/// -/// It has the header \ref Progress.h "#include " -/// be included to enjoy it. -/// -/// Here you find the needed skin part for a \ref Progress_Control "progress control" -/// -/// @note The call of the control is only possible from the corresponding -/// window as its class and identification number is required. -/// -class ATTRIBUTE_HIDDEN CProgress : public CAddonGUIControlBase -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CProgress - /// @brief Construct a new control - /// - /// @param[in] window related window control class - /// @param[in] controlId Used skin xml control id - /// - CProgress(CWindow* window, int controlId) : CAddonGUIControlBase(window) - { - m_controlHandle = m_interface->kodi_gui->window->get_control_progress( - m_interface->kodiBase, m_Window->GetControlHandle(), controlId); - if (!m_controlHandle) - kodi::Log(ADDON_LOG_FATAL, - "kodi::gui::controls::CProgress can't create control class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CProgress - /// @brief Destructor - /// - ~CProgress() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CProgress - /// @brief Set the control on window to visible - /// - /// @param[in] visible If true visible, otherwise hidden - /// - void SetVisible(bool visible) - { - m_interface->kodi_gui->control_progress->set_visible(m_interface->kodiBase, m_controlHandle, - visible); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CProgress - /// @brief To set Percent position of control - /// - /// @param[in] percent The percent position to use - /// - void SetPercentage(float percent) - { - m_interface->kodi_gui->control_progress->set_percentage(m_interface->kodiBase, m_controlHandle, - percent); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CProgress - /// @brief Get the active percent position of progress bar - /// - /// @return Progress position as percent - /// - float GetPercentage() const - { - return m_interface->kodi_gui->control_progress->get_percentage(m_interface->kodiBase, - m_controlHandle); - } - //-------------------------------------------------------------------------- -}; - -} /* namespace controls */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h deleted file mode 100644 index 305195d..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../Window.h" - -namespace kodi -{ -namespace gui -{ -namespace controls -{ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_controls_CRadioButton Control Radio Button -/// \ingroup cpp_kodi_gui -/// @brief \cpp_class{ kodi::gui::controls::CRadioButton } -/// **Window control for a radio button (as used for on/off settings)** -/// -/// The radio button control is used for creating push button on/off settings -/// in Kodi. You can choose the position, size, and look of the button. When -/// the user clicks on the radio button, the state will change, toggling the -/// extra textures (textureradioon and textureradiooff). Used for settings -/// controls. -/// -/// It has the header \ref RadioButton.h "#include " -/// be included to enjoy it. -/// -/// Here you find the needed skin part for a \ref Radio_button_control "radio button control" -/// -/// @note The call of the control is only possible from the corresponding -/// window as its class and identification number is required. -/// -class ATTRIBUTE_HIDDEN CRadioButton : public CAddonGUIControlBase -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRadioButton - /// @brief Construct a new control - /// - /// @param[in] window related window control class - /// @param[in] controlId Used skin xml control id - /// - CRadioButton(CWindow* window, int controlId) : CAddonGUIControlBase(window) - { - m_controlHandle = m_interface->kodi_gui->window->get_control_radio_button( - m_interface->kodiBase, m_Window->GetControlHandle(), controlId); - if (!m_controlHandle) - kodi::Log(ADDON_LOG_FATAL, - "kodi::gui::controls::CRadioButton can't create control class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRadioButton - /// @brief Destructor - /// - ~CRadioButton() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRadioButton - /// @brief Set the control on window to visible - /// - /// @param[in] visible If true visible, otherwise hidden - /// - void SetVisible(bool visible) - { - m_interface->kodi_gui->control_radio_button->set_visible(m_interface->kodiBase, m_controlHandle, - visible); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRadioButton - /// @brief Set's the control's enabled/disabled state - /// - /// @param[in] enabled If true enabled, otherwise disabled - /// - void SetEnabled(bool enabled) - { - m_interface->kodi_gui->control_radio_button->set_enabled(m_interface->kodiBase, m_controlHandle, - enabled); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRadioButton - /// @brief To set the text string on radio button - /// - /// @param[in] label Text to show - /// - void SetLabel(const std::string& label) - { - m_interface->kodi_gui->control_radio_button->set_label(m_interface->kodiBase, m_controlHandle, - label.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRadioButton - /// @brief Get the used text from control - /// - /// @return Text shown - /// - std::string GetLabel() const - { - std::string label; - char* ret = m_interface->kodi_gui->control_radio_button->get_label(m_interface->kodiBase, - m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - label = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return label; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRadioButton - /// @brief To set radio button condition to on or off - /// - /// @param[in] selected true set radio button to selection on, otherwise - /// off - /// - void SetSelected(bool selected) - { - m_interface->kodi_gui->control_radio_button->set_selected(m_interface->kodiBase, - m_controlHandle, selected); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRadioButton - /// @brief Get the current selected condition of radio button - /// - /// @return Selected condition - /// - bool IsSelected() const - { - return m_interface->kodi_gui->control_radio_button->is_selected(m_interface->kodiBase, - m_controlHandle); - } - //-------------------------------------------------------------------------- -}; - -} /* namespace controls */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h deleted file mode 100644 index 7cc9b24..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../Window.h" -#include "../renderHelper.h" - -namespace kodi -{ -namespace gui -{ -namespace controls -{ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_controls_CRendering Control Rendering -/// \ingroup cpp_kodi_gui -/// @brief \cpp_class{ kodi::gui::controls::CRendering } -/// **Window control for rendering own parts** -/// -/// This rendering control is used when own parts are needed. You have the -/// control over them to render direct OpenGL or DirectX content to the -/// screen set by the size of them. -/// -/// Alternative can be the virtual functions from t his been ignored if the -/// callbacks are defined by the \ref CRendering_SetIndependentCallbacks function and -/// class is used as single and not as a parent class. -/// -/// It has the header \ref Rendering.h "#include " -/// be included to enjoy it. -/// -/// Here you find the needed skin part for a \ref Addon_Rendering_control "rendering control" -/// -/// @note The call of the control is only possible from the corresponding -/// window as its class and identification number is required. -/// - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_controls_CRendering_Defs Definitions, structures and enumerators -/// \ingroup cpp_kodi_gui_controls_CRendering -/// @brief **Library definition values** -/// - -class ATTRIBUTE_HIDDEN CRendering : public CAddonGUIControlBase -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRendering - /// @brief Construct a new control - /// - /// @param[in] window related window control class - /// @param[in] controlId Used skin xml control id - /// - CRendering(CWindow* window, int controlId) : CAddonGUIControlBase(window) - { - m_controlHandle = m_interface->kodi_gui->window->get_control_render_addon( - m_interface->kodiBase, m_Window->GetControlHandle(), controlId); - if (m_controlHandle) - m_interface->kodi_gui->control_rendering->set_callbacks(m_interface->kodiBase, - m_controlHandle, this, OnCreateCB, - OnRenderCB, OnStopCB, OnDirtyCB); - else - kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::%s can't create control class from Kodi !!!", - __FUNCTION__); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRendering - /// @brief Destructor - /// - ~CRendering() override - { - m_interface->kodi_gui->control_rendering->destroy(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRendering - /// @brief To create rendering control on Add-on - /// - /// Function creates the needed rendering control for Kodi which becomes - /// handled and processed from Add-on - /// - /// @note This is callback function from Kodi to Add-on and not to use - /// for calls from add-on to this function. - /// - /// @param[in] x Horizontal position - /// @param[in] y Vertical position - /// @param[in] w Width of control - /// @param[in] h Height of control - /// @param[in] device The device to use. For OpenGL is empty - /// on Direct X is the needed device send. - /// @return Add-on needs to return true if successed, - /// otherwise false. - /// - virtual bool Create(int x, int y, int w, int h, void* device) { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRendering - /// @brief Render process call from Kodi - /// - /// @note This is callback function from Kodi to Add-on and not to use - /// for calls from add-on to this function. - /// - virtual void Render() {} - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRendering - /// @brief Call from Kodi to stop rendering process - /// - /// @note This is callback function from Kodi to Add-on and not to use - /// for calls from add-on to this function. - /// - virtual void Stop() {} - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRendering - /// @brief Call from Kodi where add-on becomes asked about dirty rendering - /// region. - /// - /// @note This is callback function from Kodi to Add-on and not to use - /// for calls from add-on to this function. - /// - virtual bool Dirty() { return false; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CRendering - /// \anchor CRendering_SetIndependentCallbacks - /// @brief If the class is used independent (with "new CRendering") - /// and not as parent (with "cCLASS_own : CRendering") from own must - /// be the callback from Kodi to add-on overdriven with own functions! - /// - void SetIndependentCallbacks( - GUIHANDLE 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)) - { - if (!cbhdl || !CBCreate || !CBRender || !CBStop || !CBDirty) - { - kodi::Log(ADDON_LOG_ERROR, "kodi::gui::controls::%s called with nullptr !!!", __FUNCTION__); - return; - } - - m_interface->kodi_gui->control_rendering->set_callbacks( - m_interface->kodiBase, m_controlHandle, cbhdl, CBCreate, CBRender, CBStop, CBDirty); - } - //-------------------------------------------------------------------------- - -private: - /* - * Defined callback functions from Kodi to add-on, for use in parent / child system - * (is private)! - */ - static bool OnCreateCB(void* cbhdl, int x, int y, int w, int h, void* device) - { - static_cast(cbhdl)->m_renderHelper = kodi::gui::GetRenderHelper(); - return static_cast(cbhdl)->Create(x, y, w, h, device); - } - - static void OnRenderCB(void* cbhdl) - { - if (!static_cast(cbhdl)->m_renderHelper) - return; - static_cast(cbhdl)->m_renderHelper->Begin(); - static_cast(cbhdl)->Render(); - static_cast(cbhdl)->m_renderHelper->End(); - } - - static void OnStopCB(void* cbhdl) - { - static_cast(cbhdl)->Stop(); - static_cast(cbhdl)->m_renderHelper = nullptr; - } - - static bool OnDirtyCB(void* cbhdl) { return static_cast(cbhdl)->Dirty(); } - - std::shared_ptr m_renderHelper; -}; - -} /* namespace controls */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h deleted file mode 100644 index 76a02aa..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../Window.h" - -namespace kodi -{ -namespace gui -{ -namespace controls -{ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_controls_CSettingsSlider Control Settings Slider -/// \ingroup cpp_kodi_gui -/// @brief \cpp_class{ kodi::gui::controls::CSettingsSlider } -/// **Window control for moveable slider with text name** -/// -/// The settings slider control is used in the settings screens for when an -/// option is best specified on a sliding scale. You can choose the position, -/// size, and look of the slider control. It is basically a cross between the -/// button control and a slider control. It has a label and focus and non -/// focus textures, as well as a slider control on the right. -/// -/// It has the header \ref SettingsSlider.h "#include " -/// be included to enjoy it. -/// -/// Here you find the needed skin part for a \ref Settings_Slider_Control "settings slider control" -/// -/// @note The call of the control is only possible from the corresponding -/// window as its class and identification number is required. -/// -class ATTRIBUTE_HIDDEN CSettingsSlider : public CAddonGUIControlBase -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief Construct a new control - /// - /// @param[in] window related window control class - /// @param[in] controlId Used skin xml control id - /// - CSettingsSlider(CWindow* window, int controlId) : CAddonGUIControlBase(window) - { - m_controlHandle = m_interface->kodi_gui->window->get_control_settings_slider( - m_interface->kodiBase, m_Window->GetControlHandle(), controlId); - if (!m_controlHandle) - kodi::Log(ADDON_LOG_FATAL, - "kodi::gui::controls::CSettingsSlider can't create control class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief Destructor - /// - ~CSettingsSlider() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief Set the control on window to visible - /// - /// @param[in] visible If true visible, otherwise hidden - /// - void SetVisible(bool visible) - { - m_interface->kodi_gui->control_settings_slider->set_visible(m_interface->kodiBase, - m_controlHandle, visible); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief Set's the control's enabled/disabled state - /// - /// @param[in] enabled If true enabled, otherwise disabled - /// - void SetEnabled(bool enabled) - { - m_interface->kodi_gui->control_settings_slider->set_enabled(m_interface->kodiBase, - m_controlHandle, enabled); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief To set the text string on settings slider - /// - /// @param[in] text Text to show - /// - void SetText(const std::string& text) - { - m_interface->kodi_gui->control_settings_slider->set_text(m_interface->kodiBase, m_controlHandle, - text.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief To reset slider on defaults - /// - void Reset() - { - m_interface->kodi_gui->control_settings_slider->reset(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief To set the the range as integer of slider, e.g. -10 is the slider - /// start and e.g. +10 is the from here defined position where it reach the - /// end. - /// - /// Ad default is the range from 0 to 100. - /// - /// The integer interval is as default 1 and can be changed with - /// @ref SetIntInterval. - /// - /// @param[in] start Integer start value - /// @param[in] end Integer end value - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only - /// one each can be used. - /// - void SetIntRange(int start, int end) - { - m_interface->kodi_gui->control_settings_slider->set_int_range(m_interface->kodiBase, - m_controlHandle, start, end); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief Set the slider position with the given integer value. The Range - /// must be defined with a call from \ref SetIntRange before. - /// - /// @param[in] value Position in range to set with integer - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values ​​can be not together and can, therefore, only - /// one each can be used. - /// - void SetIntValue(int value) - { - m_interface->kodi_gui->control_settings_slider->set_int_value(m_interface->kodiBase, - m_controlHandle, value); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief To get the current position as integer value. - /// - /// @return The position as integer - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values ​​can be not together and can, therefore, only - /// one each can be used. - /// - int GetIntValue() const - { - return m_interface->kodi_gui->control_settings_slider->get_int_value(m_interface->kodiBase, - m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief To set the interval steps of slider, as default is it 1. If it - /// becomes changed with this function will a step of the user with the - /// value fixed here be executed. - /// - /// @param[in] interval Intervall step to set. - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values ​​can be not together and can, therefore, only - /// one each can be used. - /// - void SetIntInterval(int interval) - { - m_interface->kodi_gui->control_settings_slider->set_int_interval(m_interface->kodiBase, - m_controlHandle, interval); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief Sets the percent of the slider. - /// - /// @param[in] percent float - Percent value of slide - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values ​​can be not together and can, therefore, only - /// one each can be used. - /// - void SetPercentage(float percent) - { - m_interface->kodi_gui->control_settings_slider->set_percentage(m_interface->kodiBase, - m_controlHandle, percent); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief Returns a float of the percent of the slider. - /// - /// @return float - Percent of slider - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values ​​can be not together and can, therefore, only - /// one each can be used. - /// - float GetPercentage() const - { - return m_interface->kodi_gui->control_settings_slider->get_percentage(m_interface->kodiBase, - m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief To set the the range as float of slider, e.g. -25.0 is the slider - /// start and e.g. +25.0 is the from here defined position where it reach - /// the end. - /// - /// As default is the range 0.0 to 1.0. - /// - /// The float interval is as default 0.1 and can be changed with - /// @ref SetFloatInterval. - /// - /// @param[in] start Integer start value - /// @param[in] end Integer end value - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values ​​ can be not together and can, therefore, only - /// one each can be used. - /// - void SetFloatRange(float start, float end) - { - m_interface->kodi_gui->control_settings_slider->set_float_range(m_interface->kodiBase, - m_controlHandle, start, end); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief Set the slider position with the given float value. The Range - /// can be defined with a call from \ref SetIntRange before, as default it - /// is 0.0 to 1.0. - /// - /// @param[in] value Position in range to set with float - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values ​​can be not together and can, therefore, only - /// one each can be used. - /// - void SetFloatValue(float value) - { - m_interface->kodi_gui->control_settings_slider->set_float_value(m_interface->kodiBase, - m_controlHandle, value); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief To get the current position as float value. - /// - /// @return The position as float - /// - float GetFloatValue() const - { - return m_interface->kodi_gui->control_settings_slider->get_float_value(m_interface->kodiBase, - m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSettingsSlider - /// @brief To set the interval steps of slider, as default is it 0.1 If it - /// becomes changed with this function will a step of the user with the - /// value fixed here be executed. - /// - /// @param[in] interval Intervall step to set. - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values ​​can be not together and can, therefore, only - /// one each can be used. - /// - void SetFloatInterval(float interval) - { - m_interface->kodi_gui->control_settings_slider->set_float_interval(m_interface->kodiBase, - m_controlHandle, interval); - } - //-------------------------------------------------------------------------- -}; - -} /* namespace controls */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h deleted file mode 100644 index 715cc7d..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../Window.h" - -namespace kodi -{ -namespace gui -{ -namespace controls -{ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_controls_CSlider Control Slider -/// \ingroup cpp_kodi_gui -/// @brief \cpp_class{ kodi::gui::controls::CSlider } -/// **Window control for moveable slider** -/// -/// The slider control is used for things where a sliding bar best represents -/// the operation at hand (such as a volume control or seek control). You can -/// choose the position, size, and look of the slider control. -/// -/// It has the header \ref Slider.h "#include " -/// be included to enjoy it. -/// -/// Here you find the needed skin part for a \ref Slider_Control "slider control" -/// -/// @note The call of the control is only possible from the corresponding -/// window as its class and identification number is required. -/// -class ATTRIBUTE_HIDDEN CSlider : public CAddonGUIControlBase -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief Construct a new control - /// - /// @param[in] window related window control class - /// @param[in] controlId Used skin xml control id - /// - CSlider(CWindow* window, int controlId) : CAddonGUIControlBase(window) - { - m_controlHandle = m_interface->kodi_gui->window->get_control_slider( - m_interface->kodiBase, m_Window->GetControlHandle(), controlId); - if (!m_controlHandle) - kodi::Log(ADDON_LOG_FATAL, - "kodi::gui::controls::CSlider can't create control class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief Destructor - /// - ~CSlider() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief Set the control on window to visible - /// - /// @param[in] visible If true visible, otherwise hidden - /// - void SetVisible(bool visible) - { - m_interface->kodi_gui->control_slider->set_visible(m_interface->kodiBase, m_controlHandle, - visible); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief Set's the control's enabled/disabled state - /// - /// @param[in] enabled If true enabled, otherwise disabled - /// - void SetEnabled(bool enabled) - { - m_interface->kodi_gui->control_slider->set_enabled(m_interface->kodiBase, m_controlHandle, - enabled); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief To reset slider on defaults - /// - void Reset() - { - m_interface->kodi_gui->control_slider->reset(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief With GetDescription becomes a string value of position returned. - /// - /// @return Text string about current slider position - /// - /// The following are the text definition returned from this: - /// | Value | Without range selection | With range selection | - /// |:---------:|:------------------------|:-------------------------------| - /// | float | %2.2f | [%2.2f, %2.2f] | - /// | integer | %i | [%i, %i] | - /// | percent | %i%% | [%i%%, %i%%] | - /// - std::string GetDescription() const - { - std::string text; - char* ret = m_interface->kodi_gui->control_slider->get_description(m_interface->kodiBase, - m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - text = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return text; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief To set the the range as integer of slider, e.g. -10 is the slider - /// start and e.g. +10 is the from here defined position where it reach the - /// end. - /// - /// Ad default is the range from 0 to 100. - /// - /// The integer interval is as default 1 and can be changed with - /// @ref SetIntInterval. - /// - /// @param[in] start Integer start value - /// @param[in] end Integer end value - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only one - /// each can be used. - /// - void SetIntRange(int start, int end) - { - m_interface->kodi_gui->control_slider->set_int_range(m_interface->kodiBase, m_controlHandle, - start, end); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup CSlider - /// @brief Set the slider position with the given integer value. The Range - /// must be defined with a call from \ref SetIntRange before. - /// - /// @param[in] value Position in range to set with integer - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only one - /// each can be used. - /// - void SetIntValue(int value) - { - m_interface->kodi_gui->control_slider->set_int_value(m_interface->kodiBase, m_controlHandle, - value); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief To get the current position as integer value. - /// - /// @return The position as integer - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only - /// one each can be used. - /// - int GetIntValue() const - { - return m_interface->kodi_gui->control_slider->get_int_value(m_interface->kodiBase, - m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief To set the interval steps of slider, as default is it 1. If it - /// becomes changed with this function will a step of the user with the - /// value fixed here be executed. - /// - /// @param[in] interval Intervall step to set. - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only one - /// each can be used. - /// - void SetIntInterval(int interval) - { - m_interface->kodi_gui->control_slider->set_int_interval(m_interface->kodiBase, m_controlHandle, - interval); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief Sets the percent of the slider. - /// - /// @param[in] percent float - Percent value of slide - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only one - /// each can be used. - /// - void SetPercentage(float percent) - { - m_interface->kodi_gui->control_slider->set_percentage(m_interface->kodiBase, m_controlHandle, - percent); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief Returns a float of the percent of the slider. - /// - /// @return float - Percent of slider - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only one - /// each can be used. - /// - float GetPercentage() const - { - return m_interface->kodi_gui->control_slider->get_percentage(m_interface->kodiBase, - m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief To set the the range as float of slider, e.g. -25.0 is the slider - /// start and e.g. +25.0 is the from here defined position where it reach - /// the end. - /// - /// As default is the range 0.0 to 1.0. - /// - /// The float interval is as default 0.1 and can be changed with - /// @ref SetFloatInterval. - /// - /// @param[in] start Integer start value - /// @param[in] end Integer end value - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only - /// one each can be used. - /// - void SetFloatRange(float start, float end) - { - m_interface->kodi_gui->control_slider->set_float_range(m_interface->kodiBase, m_controlHandle, - start, end); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief Set the slider position with the given float value. The Range - /// can be defined with a call from \ref SetIntRange before, as default it - /// is 0.0 to 1.0. - /// - /// @param[in] value Position in range to set with float - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only one - /// each can be used. - /// - void SetFloatValue(float value) - { - m_interface->kodi_gui->control_slider->set_float_value(m_interface->kodiBase, m_controlHandle, - value); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief To get the current position as float value. - /// - /// @return The position as float - /// - float GetFloatValue() const - { - return m_interface->kodi_gui->control_slider->get_float_value(m_interface->kodiBase, - m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSlider - /// @brief To set the interval steps of slider, as default is it 0.1 If it - /// becomes changed with this function will a step of the user with the - /// value fixed here be executed. - /// - /// @param[in] interval Intervall step to set. - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only - /// one each can be used. - /// - void SetFloatInterval(float interval) - { - m_interface->kodi_gui->control_slider->set_float_interval(m_interface->kodiBase, - m_controlHandle, interval); - } - //-------------------------------------------------------------------------- -}; - -} /* namespace controls */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h deleted file mode 100644 index db8d491..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h +++ /dev/null @@ -1,365 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../Window.h" - -namespace kodi -{ -namespace gui -{ -namespace controls -{ - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_controls_CSpin Control Spin - /// \ingroup cpp_kodi_gui - /// @brief \cpp_class{ kodi::gui::controls::CSpin } - /// **Window control used for cycling up/down controls** - /// - /// The settings spin control is used in the settings screens for when a list - /// of options can be chosen from using up/down arrows. You can choose the - /// position, size, and look of the spin control. It is basically a cross - /// between the button control and a spin control. It has a label and focus - /// and non focus textures, as well as a spin control on the right. - /// - /// It has the header \ref Spin.h "#include " - /// be included to enjoy it. - /// - /// Here you find the needed skin part for a \ref Spin_Control "spin control" - /// - /// @note The call of the control is only possible from the corresponding - /// window as its class and identification number is required. - /// - - - //============================================================================ - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @anchor AddonGUISpinControlType - /// @brief The values here defines the used value format for steps on - /// spin control. - /// - typedef enum AddonGUISpinControlType - { - /// One spin step interpreted as integer - ADDON_SPIN_CONTROL_TYPE_INT = 1, - /// One spin step interpreted as floating point value - ADDON_SPIN_CONTROL_TYPE_FLOAT = 2, - /// One spin step interpreted as text string - ADDON_SPIN_CONTROL_TYPE_TEXT = 3, - /// One spin step interpreted as a page change value - ADDON_SPIN_CONTROL_TYPE_PAGE = 4 - } AddonGUISpinControlType; - //---------------------------------------------------------------------------- - - class ATTRIBUTE_HIDDEN CSpin : public CAddonGUIControlBase - { - public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief Construct a new control - /// - /// @param[in] window related window control class - /// @param[in] controlId Used skin xml control id - /// - CSpin(CWindow* window, int controlId) - : CAddonGUIControlBase(window) - { - m_controlHandle = m_interface->kodi_gui->window->get_control_spin(m_interface->kodiBase, m_Window->GetControlHandle(), controlId); - if (!m_controlHandle) - kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CSpin can't create control class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief Destructor - /// - ~CSpin() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief Set the control on window to visible - /// - /// @param[in] visible If true visible, otherwise hidden - /// - void SetVisible(bool visible) - { - m_interface->kodi_gui->control_spin->set_visible(m_interface->kodiBase, m_controlHandle, visible); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief Set's the control's enabled/disabled state - /// - /// @param[in] enabled If true enabled, otherwise disabled - /// - void SetEnabled(bool enabled) - { - m_interface->kodi_gui->control_spin->set_enabled(m_interface->kodiBase, m_controlHandle, enabled); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief To set the text string on spin control - /// - /// @param[in] text Text to show as name for spin - /// - void SetText(const std::string& text) - { - m_interface->kodi_gui->control_spin->set_text(m_interface->kodiBase, m_controlHandle, text.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief To reset spin control to defaults - /// - void Reset() - { - m_interface->kodi_gui->control_spin->reset(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief To set the with SpinControlType defined types of spin. - /// - /// @param[in] type The type to use - /// - /// @note See description of \ref AddonGUISpinControlType for available types. - /// - void SetType(AddonGUISpinControlType type) - { - m_interface->kodi_gui->control_spin->set_type(m_interface->kodiBase, m_controlHandle, (int)type); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief To add a label entry in spin defined with a value as string. - /// - /// Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function. - /// - /// @param[in] label Label string to view on skin - /// @param[in] value String value to use for selection - /// of them. - /// - void AddLabel(const std::string& label, const std::string& value) - { - m_interface->kodi_gui->control_spin->add_string_label(m_interface->kodiBase, m_controlHandle, label.c_str(), value.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief To add a label entry in spin defined with a value as integer. - /// - /// Format must be set to ADDON_SPIN_CONTROL_TYPE_INT to use this function. - /// - /// @param[in] label Label string to view on skin - /// @param[in] value Integer value to use for selection - /// of them. - /// - void AddLabel(const std::string& label, int value) - { - m_interface->kodi_gui->control_spin->add_int_label(m_interface->kodiBase, m_controlHandle, label.c_str(), value); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief To change the spin to position with them string as value. - /// - /// Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function. - /// - /// @param[in] value String value to change to - /// - void SetStringValue(const std::string& value) - { - m_interface->kodi_gui->control_spin->set_string_value(m_interface->kodiBase, m_controlHandle, value.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief To get the current spin control position with text string value. - /// - /// Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function. - /// - /// @return Currently selected string value - /// - std::string GetStringValue() const - { - std::string value; - char* ret = m_interface->kodi_gui->control_spin->get_string_value(m_interface->kodiBase, m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - value = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return value; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief To set the the range as integer of slider, e.g. -10 is the slider - /// start and e.g. +10 is the from here defined position where it reach the - /// end. - /// - /// Ad default is the range from 0 to 100. - /// - /// @param[in] start Integer start value - /// @param[in] end Integer end value - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only - /// one each can be used and must be defined with \ref SetType before. - /// - void SetIntRange(int start, int end) - { - m_interface->kodi_gui->control_spin->set_int_range(m_interface->kodiBase, m_controlHandle, start, end); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief Set the slider position with the given integer value. The Range - /// must be defined with a call from \ref SetIntRange before. - /// - /// @param[in] value Position in range to set with integer - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only - /// one each can be used and must be defined with \ref SetType before. - /// - void SetIntValue(int value) - { - m_interface->kodi_gui->control_spin->set_int_value(m_interface->kodiBase, m_controlHandle, value); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief To get the current position as integer value. - /// - /// @return The position as integer - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only - /// one each can be used and must be defined with \ref SetType before. - /// - int GetIntValue() const - { - return m_interface->kodi_gui->control_spin->get_int_value(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief To set the the range as float of spin, e.g. -25.0 is the spin - /// start and e.g. +25.0 is the from here defined position where it reach - /// the end. - /// - /// As default is the range 0.0 to 1.0. - /// - /// The float interval is as default 0.1 and can be changed with - /// @ref SetFloatInterval. - /// - /// @param[in] start Integer start value - /// @param[in] end Integer end value - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only - /// one each can be used and must be defined with \ref SetType before. - /// - void SetFloatRange(float start, float end) - { - m_interface->kodi_gui->control_spin->set_float_range(m_interface->kodiBase, m_controlHandle, start, end); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief Set the spin position with the given float value. The Range - /// can be defined with a call from \ref SetIntRange before, as default it - /// is 0.0 to 1.0. - /// - /// @param[in] value Position in range to set with float - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only - /// one each can be used and must be defined with \ref SetType before. - /// - void SetFloatValue(float value) - { - m_interface->kodi_gui->control_spin->set_float_value(m_interface->kodiBase, m_controlHandle, value); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief To get the current position as float value. - /// - /// @return The position as float - /// - float GetFloatValue() const - { - return m_interface->kodi_gui->control_spin->get_float_value(m_interface->kodiBase, m_controlHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CSpin - /// @brief To set the interval steps of spin, as default is it 0.1 If it - /// becomes changed with this function will a step of the user with the - /// value fixed here be executed. - /// - /// @param[in] interval Intervall step to set. - /// - /// @note Percent, floating point or integer are alone possible. Combining - /// these different values can be not together and can, therefore, only - /// one each can be used and must be defined with \ref SetType before. - /// - void SetFloatInterval(float interval) - { - m_interface->kodi_gui->control_spin->set_float_interval(m_interface->kodiBase, m_controlHandle, interval); - } - //-------------------------------------------------------------------------- - }; - -} /* namespace controls */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h deleted file mode 100644 index b4e8ae0..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../Window.h" - -namespace kodi -{ -namespace gui -{ -namespace controls -{ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_controls_CTextBox Control Text Box -/// \ingroup cpp_kodi_gui -/// @brief \cpp_class{ kodi::gui::controls::CTextBox } -/// **Used to show a multi-page piece of text** -/// -/// The text box control can be used to display descriptions, help texts or -/// other larger texts. It corresponds to the representation which is also to -/// be seen on the CDialogTextViewer. -/// -/// It has the header \ref TextBox.h "#include " -/// be included to enjoy it. -/// -/// Here you find the needed skin part for a \ref Text_Box "textbox control". -/// -/// @note The call of the control is only possible from the corresponding -/// window as its class and identification number is required. -/// -class ATTRIBUTE_HIDDEN CTextBox : public CAddonGUIControlBase -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief Construct a new control - /// - /// @param[in] window related window control class - /// @param[in] controlId Used skin xml control id - /// - CTextBox(CWindow* window, int controlId) : CAddonGUIControlBase(window) - { - m_controlHandle = m_interface->kodi_gui->window->get_control_text_box( - m_interface->kodiBase, m_Window->GetControlHandle(), controlId); - if (!m_controlHandle) - kodi::Log(ADDON_LOG_FATAL, - "kodi::gui::controls::CTextBox can't create control class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief Destructor - /// - ~CTextBox() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief Set the control on window to visible - /// - /// @param[in] visible If true visible, otherwise hidden - /// - void SetVisible(bool visible) - { - m_interface->kodi_gui->control_text_box->set_visible(m_interface->kodiBase, m_controlHandle, - visible); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief To reset box an remove all the text - /// - void Reset() { m_interface->kodi_gui->control_text_box->reset(m_controlHandle, m_controlHandle); } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief To set the text on box - /// - /// @param[in] text Text to show - /// - void SetText(const std::string& text) - { - m_interface->kodi_gui->control_text_box->set_text(m_interface->kodiBase, m_controlHandle, - text.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief Get the used text from control - /// - /// @return Text shown - /// - std::string GetText() const - { - std::string text; - char* ret = - m_interface->kodi_gui->control_text_box->get_text(m_interface->kodiBase, m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - text = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return text; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief To scroll text on other position - /// - /// @param[in] position The line position to scroll to - /// - void Scroll(unsigned int position) - { - m_interface->kodi_gui->control_text_box->scroll(m_interface->kodiBase, m_controlHandle, - position); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief To set automatic scrolling of textbox - /// - /// Specifies the timing and conditions of any autoscrolling this textbox - /// should have. Times are in milliseconds. The content is delayed for the - /// given delay, then scrolls at a rate of one line per time interval until - /// the end. If the repeat tag is present, it then delays for the repeat - /// time, fades out over 1 second, and repeats. It does not wrap or reset - /// to the top at the end of the scroll. - /// - /// @param[in] delay Content delay - /// @param[in] time One line per time interval - /// @param[in] repeat Delays with given time, fades out over 1 - /// second, and repeats - /// - void SetAutoScrolling(int delay, int time, int repeat) - { - m_interface->kodi_gui->control_text_box->set_auto_scrolling( - m_interface->kodiBase, m_controlHandle, delay, time, repeat); - } - //-------------------------------------------------------------------------- -}; - -} /* namespace controls */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h deleted file mode 100644 index 4eb64c7..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include -#include - -/* - * Internal Structures to have "C"-Style data transfer - */ -extern "C" -{ - -typedef struct AddonToKodiFuncTable_kodi_gui_general -{ - void (*lock)(); - void (*unlock)(); - int (*get_screen_height)(void* kodiBase); - int (*get_screen_width)(void* kodiBase); - int (*get_video_resolution)(void* kodiBase); - int (*get_current_window_dialog_id)(void* kodiBase); - int (*get_current_window_id)(void* kodiBase); - void* (*get_hw_context)(void* kodiBase); -} AddonToKodiFuncTable_kodi_gui_general; - -typedef struct AddonToKodiFuncTable_kodi_gui_control_button -{ - void (*set_visible)(void* kodiBase, void* handle, bool visible); - void (*set_enabled)(void* kodiBase, void* handle, bool enabled); - void (*set_label)(void* kodiBase, void* handle, const char* label); - char* (*get_label)(void* kodiBase, void* handle); - void (*set_label2)(void* kodiBase, void* handle, const char *label); - char* (*get_label2)(void* kodiBase, void* handle); -} AddonToKodiFuncTable_kodi_gui_control_button; - -typedef struct AddonToKodiFuncTable_kodi_gui_control_edit -{ - void (*set_visible)(void* kodiBase, void* handle, bool visible); - void (*set_enabled)(void* kodiBase, void* handle, bool enabled); - void (*set_label)(void* kodiBase, void* handle, const char* label); - char* (*get_label)(void* kodiBase, void* handle); - void (*set_text)(void* kodiBase, void* handle, const char* text); - char* (*get_text)(void* kodiBase, void* handle); - void (*set_cursor_position)(void* kodiBase, void* handle, unsigned int position); - unsigned int (*get_cursor_position)(void* kodiBase, void* handle); - void (*set_input_type)(void* kodiBase, void* handle, int type, const char* heading); -} AddonToKodiFuncTable_kodi_gui_control_edit; - -typedef struct AddonToKodiFuncTable_kodi_gui_control_fade_label -{ - void (*set_visible)(void* kodiBase, void* handle, bool visible); - void (*add_label)(void* kodiBase, void* handle, const char* text); - char* (*get_label)(void* kodiBase, void* handle); - void (*set_scrolling)(void* kodiBase, void* handle, bool scroll); - void (*reset)(void* kodiBase, void* handle); -} AddonToKodiFuncTable_kodi_gui_control_fade_label; - -typedef struct AddonToKodiFuncTable_kodi_gui_control_image -{ - void (*set_visible)(void* kodiBase, void* handle, bool visible); - void (*set_filename)(void* kodiBase, void* handle, const char* filename, bool use_cache); - void (*set_color_diffuse)(void* kodiBase, void* handle, uint32_t color_diffuse); -} AddonToKodiFuncTable_kodi_gui_control_image; - -typedef struct AddonToKodiFuncTable_kodi_gui_control_label -{ - void (*set_visible)(void* kodiBase, void* handle, bool visible); - void (*set_label)(void* kodiBase, void* handle, const char* text); - char* (*get_label)(void* kodiBase, void* handle); -} AddonToKodiFuncTable_kodi_gui_control_label; - -typedef struct AddonToKodiFuncTable_kodi_gui_control_progress -{ - void (*set_visible)(void* kodiBase, void* handle, bool visible); - void (*set_percentage)(void* kodiBase, void* handle, float percent); - float (*get_percentage)(void* kodiBase, void* handle); -} AddonToKodiFuncTable_kodi_gui_control_progress; - -typedef struct AddonToKodiFuncTable_kodi_gui_control_radio_button -{ - void (*set_visible)(void* kodiBase, void* handle, bool visible); - void (*set_enabled)(void* kodiBase, void* handle, bool enabled); - void (*set_label)(void* kodiBase, void* handle, const char* text); - char* (*get_label)(void* kodiBase, void* handle); - void (*set_selected)(void* kodiBase, void* handle, bool selected); - bool (*is_selected)(void* kodiBase, void* handle); -} AddonToKodiFuncTable_kodi_gui_control_radio_button; - -typedef struct AddonToKodiFuncTable_kodi_gui_control_rendering -{ - void (*set_callbacks)(void* kodiBase, void* handle, void* clienthandle, - bool (*createCB)(void*,int,int,int,int,void*), - void (*renderCB)(void*), - void (*stopCB)(void*), - bool (*dirtyCB)(void*)); - void (*destroy)(void *kodiBase, void* handle); -} AddonToKodiFuncTable_kodi_gui_control_rendering; - -typedef struct AddonToKodiFuncTable_kodi_gui_control_settings_slider -{ - void (*set_visible)(void* kodiBase, void* handle, bool visible); - void (*set_enabled)(void* kodiBase, void* handle, bool enabled); - void (*set_text)(void* kodiBase, void* handle, const char* label); - void (*reset)(void* kodiBase, void* handle); - void (*set_int_range)(void* kodiBase, void* handle, int start, int end); - void (*set_int_value)(void* kodiBase, void* handle, int value); - int (*get_int_value)(void* kodiBase, void* handle); - void (*set_int_interval)(void* kodiBase, void* handle, int interval); - void (*set_percentage)(void* kodiBase, void* handle, float percent); - float (*get_percentage)(void* kodiBase, void* handle); - void (*set_float_range)(void* kodiBase, void* handle, float start, float end); - void (*set_float_value)(void* kodiBase, void* handle, float value); - float (*get_float_value)(void* kodiBase, void* handle); - void (*set_float_interval)(void* kodiBase, void* handle, float interval); -} AddonToKodiFuncTable_kodi_gui_control_settings_slider; - -typedef struct AddonToKodiFuncTable_kodi_gui_control_slider -{ - void (*set_visible)(void* kodiBase, void* handle, bool visible); - void (*set_enabled)(void* kodiBase, void* handle, bool enabled); - void (*reset)(void* kodiBase, void* handle); - char* (*get_description)(void* kodiBase, void* handle); - void (*set_int_range)(void* kodiBase, void* handle, int start, int end); - void (*set_int_value)(void* kodiBase, void* handle, int value); - int (*get_int_value)(void* kodiBase, void* handle); - void (*set_int_interval)(void* kodiBase, void* handle, int interval); - void (*set_percentage)(void* kodiBase, void* handle, float percent); - float (*get_percentage)(void* kodiBase, void* handle); - void (*set_float_range)(void* kodiBase, void* handle, float start, float end); - void (*set_float_value)(void* kodiBase, void* handle, float value); - float (*get_float_value)(void* kodiBase, void* handle); - void (*set_float_interval)(void* kodiBase, void* handle, float interval); -} AddonToKodiFuncTable_kodi_gui_control_slider; - -typedef struct AddonToKodiFuncTable_kodi_gui_control_spin -{ - void (*set_visible)(void* kodiBase, void* handle, bool visible); - void (*set_enabled)(void* kodiBase, void* handle, bool enabled); - void (*set_text)(void* kodiBase, void* handle, const char* text); - void (*reset)(void* kodiBase, void* handle); - void (*set_type)(void* kodiBase, void* handle, int type); - void (*add_string_label)(void* kodiBase, void* handle, const char* label, const char* value); - void (*set_string_value)(void* kodiBase, void* handle, const char* value); - char* (*get_string_value)(void* kodiBase, void* handle); - void (*add_int_label)(void* kodiBase, void* handle, const char* label, int value); - void (*set_int_range)(void* kodiBase, void* handle, int start, int end); - void (*set_int_value)(void* kodiBase, void* handle, int value); - int (*get_int_value)(void* kodiBase, void* handle); - void (*set_float_range)(void* kodiBase, void* handle, float start, float end); - void (*set_float_value)(void* kodiBase, void* handle, float value); - float (*get_float_value)(void* kodiBase, void* handle); - void (*set_float_interval)(void* kodiBase, void* handle, float interval); -} AddonToKodiFuncTable_kodi_gui_control_spin; - -typedef struct AddonToKodiFuncTable_kodi_gui_control_text_box -{ - void (*set_visible)(void* kodiBase, void* handle, bool visible); - void (*reset)(void* kodiBase, void* handle); - void (*set_text)(void* kodiBase, void* handle, const char* text); - char* (*get_text)(void* kodiBase, void* handle); - void (*scroll)(void* kodiBase, void* handle, unsigned int scroll); - void (*set_auto_scrolling)(void* kodiBase, void* handle, int delay, int time, int repeat); -} AddonToKodiFuncTable_kodi_gui_control_text_box; - -typedef struct AddonToKodiFuncTable_kodi_gui_dialogContextMenu -{ - int (*open)(void* kodiBase, const char *heading, const char *entries[], unsigned int size); -} AddonToKodiFuncTable_kodi_gui_dialogContextMenu; - -typedef struct AddonToKodiFuncTable_kodi_gui_dialogExtendedProgress -{ - void* (*new_dialog)(void* kodiBase, const char *title); - void (*delete_dialog)(void* kodiBase, void* handle); - char* (*get_title)(void* kodiBase, void* handle); - void (*set_title)(void* kodiBase, void* handle, const char *title); - char* (*get_text)(void* kodiBase, void* handle); - void (*set_text)(void* kodiBase, void* handle, const char *text); - bool (*is_finished)(void* kodiBase, void* handle); - void (*mark_finished)(void* kodiBase, void* handle); - float (*get_percentage)(void* kodiBase, void* handle); - void (*set_percentage)(void* kodiBase, void* handle, float percentage); - void (*set_progress)(void* kodiBase, void* handle, int currentItem, int itemCount); -} AddonToKodiFuncTable_kodi_gui_dialogExtendedProgress; - -typedef struct AddonToKodiFuncTable_kodi_gui_dialogFileBrowser -{ - bool (*show_and_get_directory)(void* kodiBase, const char* shares, const char* heading, const char* path_in, char** path_out, bool writeOnly); - bool (*show_and_get_file)(void* kodiBase, const char* shares, const char* mask, const char* heading, const char* path_in, char** path_out, bool use_thumbs, bool use_file_directories); - bool (*show_and_get_file_from_dir)(void* kodiBase, const char* directory, const char* mask, const char* heading, const char* path_in, char** path_out, bool use_thumbs, bool use_file_directories, bool singleList); - bool (*show_and_get_file_list)(void* kodiBase, const char* shares, const char* mask, const char* heading, char*** file_list, unsigned int* entries, bool use_thumbs, bool use_file_directories); - bool (*show_and_get_source)(void* kodiBase, const char* path_in, char** path_out, bool allow_network_shares, const char* additional_share, const char* type); - bool (*show_and_get_image)(void* kodiBase, const char* shares, const char* heading, const char* path_in, char** path_out); - bool (*show_and_get_image_list)(void* kodiBase, const char* shares, const char* heading, char*** file_list, unsigned int* entries); - void (*clear_file_list)(void* kodiBase, char*** file_list, unsigned int entries); -} AddonToKodiFuncTable_kodi_gui_dialogFileBrowser; - -// typedef void (*char_callback_t) (CGUIKeyboard *ref, const std::string &typedString); - -typedef struct AddonToKodiFuncTable_kodi_gui_dialogKeyboard -{ - bool (*show_and_get_input_with_head)(void* kodiBase, const char* text_in, char** text_out, const char* heading, bool allow_empty_result, bool hiddenInput, unsigned int auto_close_ms); - bool (*show_and_get_input)(void* kodiBase, const char* text_in, char** text_out, bool allow_empty_result, unsigned int auto_close_ms); - bool (*show_and_get_new_password_with_head)(void* kodiBase, const char* password_in, char** password_out, const char* heading, bool allow_empty_result, unsigned int auto_close_ms); - bool (*show_and_get_new_password)(void* kodiBase, const char* password_in, char** password_out, unsigned int auto_close_ms); - bool (*show_and_verify_new_password_with_head)(void* kodiBase, char** password_out, const char* heading, bool allow_empty_result, unsigned int auto_close_ms); - bool (*show_and_verify_new_password)(void* kodiBase, char** password_out, unsigned int auto_close_ms); - int (*show_and_verify_password)(void* kodiBase, const char* password_in, char** password_out, const char* heading, int retries, unsigned int auto_close_ms); - bool (*show_and_get_filter)(void* kodiBase, const char* text_in, char** text_out, bool searching, unsigned int auto_close_ms); - bool (*send_text_to_active_keyboard)(void* kodiBase, const char* text, bool close_keyboard); - bool (*is_keyboard_activated)(void* kodiBase); -} AddonToKodiFuncTable_kodi_gui_dialogKeyboard; - -typedef struct AddonToKodiFuncTable_kodi_gui_dialogNumeric -{ - bool (*show_and_verify_new_password)(void* kodiBase, char** password); - int (*show_and_verify_password)(void* kodiBase, const char* password, const char *heading, int retries); - bool (*show_and_verify_input)(void* kodiBase, const char* verify_in, char** verify_out, const char* heading, bool verify_input); - bool (*show_and_get_time)(void* kodiBase, tm *time, const char *heading); - bool (*show_and_get_date)(void* kodiBase, tm *date, const char *heading); - bool (*show_and_get_ip_address)(void* kodiBase, const char* ip_address_in, char** ip_address_out, const char *heading); - bool (*show_and_get_number)(void* kodiBase, const char* input_in, char** input_out, const char *heading, unsigned int auto_close_ms); - bool (*show_and_get_seconds)(void* kodiBase, const char* time_in, char** time_out, const char *heading); -} AddonToKodiFuncTable_kodi_gui_dialogNumeric; - -typedef struct AddonToKodiFuncTable_kodi_gui_dialogOK -{ - void (*show_and_get_input_single_text)(void* kodiBase, const char *heading, const char *text); - void (*show_and_get_input_line_text)(void* kodiBase, const char *heading, const char *line0, const char *line1, const char *line2); -} AddonToKodiFuncTable_kodi_gui_dialogOK; - -typedef struct AddonToKodiFuncTable_kodi_gui_dialogProgress -{ - void* (*new_dialog)(void* kodiBase); - void (*delete_dialog)(void* kodiBase, void* handle); - void (*open)(void* kodiBase, void* handle); - void (*set_heading)(void* kodiBase, void* handle, const char* heading); - void (*set_line)(void* kodiBase, void* handle, unsigned int lineNo, const char* line); - void (*set_can_cancel)(void* kodiBase, void* handle, bool canCancel); - bool (*is_canceled)(void* kodiBase, void* handle); - void (*set_percentage)(void* kodiBase, void* handle, int percentage); - int (*get_percentage)(void* kodiBase, void* handle); - void (*show_progress_bar)(void* kodiBase, void* handle, bool pnOff); - void (*set_progress_max)(void* kodiBase, void* handle, int max); - void (*set_progress_advance)(void* kodiBase, void* handle, int nSteps); - bool (*abort)(void* kodiBase, void* handle); -} AddonToKodiFuncTable_kodi_gui_dialogProgress; - -typedef struct AddonToKodiFuncTable_kodi_gui_dialogSelect -{ - int (*open)(void* kodiBase, const char *heading, const char *entries[], unsigned int size, int selected, unsigned int autoclose); - bool (*open_multi_select)(void* kodiBase, const char* heading, const char* entryIDs[], const char* entryNames[], - bool entriesSelected[], unsigned int size, unsigned int autoclose); -} AddonToKodiFuncTable_kodi_gui_dialogSelect; - -typedef struct AddonToKodiFuncTable_kodi_gui_dialogTextViewer -{ - void (*open)(void* kodiBase, const char *heading, const char *text); -} AddonToKodiFuncTable_kodi_gui_dialogTextViewer; - -typedef struct AddonToKodiFuncTable_kodi_gui_dialogYesNo -{ - bool (*show_and_get_input_single_text)(void* kodiBase, const char *heading, const char *text, bool *canceled, const char *noLabel, const char *yesLabel); - bool (*show_and_get_input_line_text)(void* kodiBase, const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel, const char *yesLabel); - bool (*show_and_get_input_line_button_text)(void* kodiBase, const char *heading, const char *line0, const char *line1, const char *line2, bool *canceled, const char *noLabel, const char *yesLabel); -} AddonToKodiFuncTable_kodi_gui_dialogYesNo; - -typedef struct AddonToKodiFuncTable_kodi_gui_listItem -{ - void* (*create)(void* kodiBase, const char* label, const char* label2, const char* icon_image, const char* path); - void (*destroy)(void* kodiBase, void* handle); - char* (*get_label)(void* kodiBase, void* handle); - void (*set_label)(void* kodiBase, void* handle, const char* label); - char* (*get_label2)(void* kodiBase, void* handle); - void (*set_label2)(void* kodiBase, void* handle, const char* label); - char* (*get_art)(void* kodiBase, void* handle, const char* type); - void (*set_art)(void* kodiBase, void* handle, const char* type, const char* image); - char* (*get_path)(void* kodiBase, void* handle); - void (*set_path)(void* kodiBase, void* handle, const char* path); - char* (*get_property)(void* kodiBase, void* handle, const char* key); - void (*set_property)(void* kodiBase, void* handle, const char* key, const char* value); - void (*select)(void* kodiBase, void* handle, bool select); - bool (*is_selected)(void* kodiBase, void* handle); -} AddonToKodiFuncTable_kodi_gui_listItem; - -#define ADDON_MAX_CONTEXT_ENTRIES 20 -#define ADDON_MAX_CONTEXT_ENTRY_NAME_LENGTH 80 -typedef struct gui_context_menu_pair -{ - unsigned int id; - char name[ADDON_MAX_CONTEXT_ENTRY_NAME_LENGTH]; -} gui_context_menu_pair; - -typedef struct AddonToKodiFuncTable_kodi_gui_window -{ - /* Window creation functions */ - void* (*create)(void* kodiBase, const char* xml_filename, const char* default_skin, bool as_dialog, bool is_media); - void (*destroy)(void* kodiBase, void* handle); - void (*set_callbacks)(void* kodiBase, void* handle, void* clienthandle, - bool (*CBInit)(void*), - bool (*CBFocus)(void*, int), - bool (*CBClick)(void*, int), - bool (*CBOnAction)(void*, int, uint32_t, wchar_t), - void (*CBGetContextButtons)(void*, int, gui_context_menu_pair*, unsigned int*), - bool (*CBOnContextButton)(void*, int, unsigned int)); - bool (*show)(void* kodiBase, void* handle); - bool (*close)(void* kodiBase, void* handle); - bool (*do_modal)(void* kodiBase, void* handle); - - /* Window control functions */ - bool (*set_focus_id)(void* kodiBase, void* handle, int control_id); - int (*get_focus_id)(void* kodiBase, void* handle); - void (*set_control_label)(void* kodiBase, void* handle, int control_id, const char* label); - void (*set_control_visible)(void* kodiBase, void* handle, int control_id, bool visible); - void (*set_control_selected)(void* kodiBase, void* handle, int control_id, bool selected); - - /* Window property functions */ - void (*set_property)(void* kodiBase, void* handle, const char* key, const char* value); - void (*set_property_int)(void* kodiBase, void* handle, const char* key, int value); - void (*set_property_bool)(void* kodiBase, void* handle, const char* key, bool value); - void (*set_property_double)(void* kodiBase, void* handle, const char* key, double value); - char* (*get_property)(void* kodiBase, void* handle, const char* key); - int (*get_property_int)(void* kodiBase, void* handle, const char* key); - bool (*get_property_bool)(void* kodiBase, void* handle, const char* key); - double (*get_property_double)(void* kodiBase, void* handle, const char* key); - void (*clear_properties)(void* kodiBase, void* handle); - void (*clear_property)(void* kodiBase, void* handle, const char* key); - - /* List item functions */ - void (*clear_item_list)(void* kodiBase, void* handle); - void (*add_list_item)(void* kodiBase, void* handle, void* item, int list_position); - void (*remove_list_item_from_position)(void* kodiBase, void* handle, int list_position); - void (*remove_list_item)(void* kodiBase, void* handle, void* item); - void* (*get_list_item)(void* kodiBase, void* handle, int list_position); - void (*set_current_list_position)(void* kodiBase, void* handle, int list_position); - int (*get_current_list_position)(void* kodiBase, void* handle); - int (*get_list_size)(void* kodiBase, void* handle); - void (*set_container_property)(void* kodiBase, void* handle, const char* key, const char* value); - void (*set_container_content)(void* kodiBase, void* handle, const char* value); - int (*get_current_container_id)(void* kodiBase, void* handle); - - /* Various functions */ - void (*mark_dirty_region)(void* kodiBase, void* handle); - - /* GUI control access functions */ - void* (*get_control_button)(void* kodiBase, void* handle, int control_id); - void* (*get_control_edit)(void* kodiBase, void* handle, int control_id); - void* (*get_control_fade_label)(void* kodiBase, void* handle, int control_id); - void* (*get_control_image)(void* kodiBase, void* handle, int control_id); - void* (*get_control_label)(void* kodiBase, void* handle, int control_id); - void* (*get_control_progress)(void* kodiBase, void* handle, int control_id); - void* (*get_control_radio_button)(void* kodiBase, void* handle, int control_id); - void* (*get_control_render_addon)(void* kodiBase, void* handle, int control_id); - void* (*get_control_settings_slider)(void* kodiBase, void* handle, int control_id); - void* (*get_control_slider)(void* kodiBase, void* handle, int control_id); - void* (*get_control_spin)(void* kodiBase, void* handle, int control_id); - void* (*get_control_text_box)(void* kodiBase, void* handle, int control_id); - void* (*get_control_dummy1)(void* kodiBase, void* handle, int control_id); - void* (*get_control_dummy2)(void* kodiBase, void* handle, int control_id); - void* (*get_control_dummy3)(void* kodiBase, void* handle, int control_id); - void* (*get_control_dummy4)(void* kodiBase, void* handle, int control_id); - void* (*get_control_dummy5)(void* kodiBase, void* handle, int control_id); - void* (*get_control_dummy6)(void* kodiBase, void* handle, int control_id); - void* (*get_control_dummy7)(void* kodiBase, void* handle, int control_id); - void* (*get_control_dummy8)(void* kodiBase, void* handle, int control_id); - void* (*get_control_dummy9)(void* kodiBase, void* handle, int control_id); - void* (*get_control_dummy10)(void* kodiBase, void* handle, int control_id); /* This and above used to add new get_control_* functions */ -} AddonToKodiFuncTable_kodi_gui_window; - -typedef struct AddonToKodiFuncTable_kodi_gui -{ - AddonToKodiFuncTable_kodi_gui_general* general; - AddonToKodiFuncTable_kodi_gui_control_button* control_button; - AddonToKodiFuncTable_kodi_gui_control_edit* control_edit; - AddonToKodiFuncTable_kodi_gui_control_fade_label* control_fade_label; - AddonToKodiFuncTable_kodi_gui_control_label* control_label; - AddonToKodiFuncTable_kodi_gui_control_image* control_image; - AddonToKodiFuncTable_kodi_gui_control_progress* control_progress; - AddonToKodiFuncTable_kodi_gui_control_radio_button* control_radio_button; - AddonToKodiFuncTable_kodi_gui_control_rendering* control_rendering; - AddonToKodiFuncTable_kodi_gui_control_settings_slider* control_settings_slider; - AddonToKodiFuncTable_kodi_gui_control_slider* control_slider; - AddonToKodiFuncTable_kodi_gui_control_spin* control_spin; - AddonToKodiFuncTable_kodi_gui_control_text_box* control_text_box; - void* control_dummy1; - void* control_dummy2; - void* control_dummy3; - void* control_dummy4; - void* control_dummy5; - void* control_dummy6; - void* control_dummy7; - void* control_dummy8; - void* control_dummy9; - void* control_dummy10; /* This and above used to add new controls */ - AddonToKodiFuncTable_kodi_gui_dialogContextMenu* dialogContextMenu; - AddonToKodiFuncTable_kodi_gui_dialogExtendedProgress* dialogExtendedProgress; - AddonToKodiFuncTable_kodi_gui_dialogFileBrowser* dialogFileBrowser; - AddonToKodiFuncTable_kodi_gui_dialogKeyboard* dialogKeyboard; - AddonToKodiFuncTable_kodi_gui_dialogNumeric* dialogNumeric; - AddonToKodiFuncTable_kodi_gui_dialogOK* dialogOK; - AddonToKodiFuncTable_kodi_gui_dialogProgress* dialogProgress; - AddonToKodiFuncTable_kodi_gui_dialogSelect* dialogSelect; - AddonToKodiFuncTable_kodi_gui_dialogTextViewer* dialogTextViewer; - AddonToKodiFuncTable_kodi_gui_dialogYesNo* dialogYesNo; - void* dialog_dummy1; - void* dialog_dummy2; - void* dialog_dummy3; - void* dialog_dummy4; - void* dialog_dummy5; - void* dialog_dummy6; - void* dialog_dummy7; - void* dialog_dummy8; - void* dialog_dummy9; - void* dialog_dummy10; /* This and above used to add new dialogs */ - AddonToKodiFuncTable_kodi_gui_listItem* listItem; - AddonToKodiFuncTable_kodi_gui_window* window; -} AddonToKodiFuncTable_kodi_gui; - -} /* extern "C" */ - -//============================================================================ -/// -/// \ingroup cpp_kodi_gui_CControlRendering_Defs cpp_kodi_gui_CWindow_Defs -/// @{ -/// @brief Handle to use as independent pointer for GUI -typedef void* GUIHANDLE; -/// @} -//---------------------------------------------------------------------------- diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt deleted file mode 100644 index 7227343..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(HEADERS ContextMenu.h - ExtendedProgress.h - FileBrowser.h - Keyboard.h - Numeric.h - OK.h - Progress.h - Select.h - TextViewer.h - YesNo.h) - -if(NOT ENABLE_STATIC_LIBS) - core_add_library(addons_kodi-addon-dev-kit_include_kodi_gui_dialogs) -endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h deleted file mode 100644 index d545030..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../definitions.h" -#include "../../AddonBase.h" - -namespace kodi -{ -namespace gui -{ -namespace dialogs -{ - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_dialogs_ContextMenu Dialog Context Menu - /// \ingroup cpp_kodi_gui - /// @brief \cpp_namespace{ kodi::gui::dialogs::ContextMenu } - /// **Context menu dialog** - /// - /// The function listed below permits the call of a dialogue as context menu to - /// select of an entry as a key - /// - /// It has the header \ref ContextMenu.h "#include " - /// be included to enjoy it. - /// - /// - namespace ContextMenu - { - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_ContextMenu - /// @brief Show a context menu dialog about given parts. - /// - /// @param[in] heading Dialog heading name - /// @param[in] entries String list about entries - /// @return The selected entry, if return -1 was nothing selected or canceled - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// const std::vector entries - /// { - /// "Test 1", - /// "Test 2", - /// "Test 3", - /// "Test 4", - /// "Test 5" - /// }; - /// - /// int selected = kodi::gui::dialogs::ContextMenu::Show("Test selection", entries); - /// if (selected < 0) - /// fprintf(stderr, "Item selection canceled\n"); - /// else - /// fprintf(stderr, "Selected item is: %i\n", selected); - /// ~~~~~~~~~~~~~ - /// - inline int ATTRIBUTE_HIDDEN Show(const std::string& heading, - const std::vector& entries) - { - using namespace ::kodi::addon; - unsigned int size = static_cast(entries.size()); - const char** cEntries = static_cast(malloc(size * sizeof(const char**))); - for (unsigned int i = 0; i < size; ++i) - { - cEntries[i] = entries[i].c_str(); - } - int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogContextMenu->open( - CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size); - free(cEntries); - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_ContextMenu - /// @brief Show a context menu dialog about given parts. - /// - /// @param[in] heading Dialog heading name - /// @param[in] entries String list about entries - /// @return The selected entry, if return -1 was nothing selected or canceled - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// const std::vector> entries - /// { - /// { "ID 1", "Test 1" }, - /// { "ID 2", "Test 2" }, - /// { "ID 3", "Test 3" }, - /// { "ID 4", "Test 4" }, - /// { "ID 5", "Test 5" } - /// }; - /// - /// int selected = kodi::gui::dialogs::ContextMenu::Show("Test selection", entries); - /// if (selected < 0) - /// fprintf(stderr, "Item selection canceled\n"); - /// else - /// fprintf(stderr, "Selected item is: %i\n", selected); - /// ~~~~~~~~~~~~~ - /// - inline int ATTRIBUTE_HIDDEN Show( - const std::string& heading, const std::vector>& entries) - { - using namespace ::kodi::addon; - unsigned int size = static_cast(entries.size()); - const char** cEntries = static_cast(malloc(size*sizeof(const char**))); - for (unsigned int i = 0; i < size; ++i) - { - cEntries[i] = entries[i].second.c_str(); - } - int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogContextMenu->open(CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size); - free(cEntries); - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_ContextMenu - /// @brief Show a context menu dialog about given parts. - /// - /// @param[in] heading Dialog heading name - /// @param[in] entries String list about entries - /// @return The selected entry, if return -1 was nothing selected or canceled - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// const std::vector> entries - /// { - /// { 1, "Test 1" }, - /// { 2, "Test 2" }, - /// { 3, "Test 3" }, - /// { 4, "Test 4" }, - /// { 5, "Test 5" } - /// }; - /// - /// int selected = kodi::gui::dialogs::ContextMenu::Show("Test selection", entries); - /// if (selected < 0) - /// fprintf(stderr, "Item selection canceled\n"); - /// else - /// fprintf(stderr, "Selected item is: %i\n", selected); - /// ~~~~~~~~~~~~~ - /// - inline int ATTRIBUTE_HIDDEN Show(const std::string& heading, - const std::vector>& entries) - { - using namespace ::kodi::addon; - unsigned int size = static_cast(entries.size()); - const char** cEntries = static_cast(malloc(size*sizeof(const char**))); - for (unsigned int i = 0; i < size; ++i) - { - cEntries[i] = entries[i].second.c_str(); - } - int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogContextMenu->open(CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size); - free(cEntries); - return ret; - } - //-------------------------------------------------------------------------- - }; - -} /* namespace dialogs */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h deleted file mode 100644 index 5a49b70..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../definitions.h" -#include "../../AddonBase.h" - -namespace kodi -{ -namespace gui -{ -namespace dialogs -{ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_dialogs_CExtendedProgress Dialog Extended Progress -/// \ingroup cpp_kodi_gui -/// @brief \cpp_class{ kodi::gui::dialogs::ExtendedProgress } -/// **Progress dialog shown for background work** -/// -/// The with \ref ExtendedProgress.h "#include " -/// given class are basically used to create Kodi's extended progress. -/// -/// -/// -------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// kodi::gui::dialogs::CExtendedProgress *ext_progress = new kodi::gui::dialogs::CExtendedProgress("Test Extended progress"); -/// ext_progress->SetText("Test progress"); -/// for (unsigned int i = 0; i < 50; i += 10) -/// { -/// ext_progress->SetProgress(i, 100); -/// sleep(1); -/// } -/// -/// ext_progress->SetTitle("Test Extended progress - Second round"); -/// ext_progress->SetText("Test progress - Step 2"); -/// -/// for (unsigned int i = 50; i < 100; i += 10) -/// { -/// ext_progress->SetProgress(i, 100); -/// sleep(1); -/// } -/// delete ext_progress; -/// ~~~~~~~~~~~~~ -/// -class ATTRIBUTE_HIDDEN CExtendedProgress -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress - /// Construct a new dialog - /// - /// @param[in] title Title string - /// - explicit CExtendedProgress(const std::string& title = "") - { - using namespace ::kodi::addon; - m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->new_dialog( - CAddonBase::m_interface->toKodi->kodiBase, title.c_str()); - if (!m_DialogHandle) - kodi::Log(ADDON_LOG_FATAL, - "kodi::gui::CDialogExtendedProgress can't create window class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress - /// Destructor - /// - ~CExtendedProgress() - { - using namespace ::kodi::addon; - if (m_DialogHandle) - CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->delete_dialog( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress - /// @brief Get the used title - /// - /// @return Title string - /// - std::string Title() const - { - using namespace ::kodi::addon; - std::string text; - char* strMsg = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_title( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); - if (strMsg != nullptr) - { - if (std::strlen(strMsg)) - text = strMsg; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - strMsg); - } - return text; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress - /// @brief To set the title of dialog - /// - /// @param[in] title Title string - /// - void SetTitle(const std::string& title) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_title( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, title.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress - /// @brief Get the used text information string - /// - /// @return Text string - /// - std::string Text() const - { - using namespace ::kodi::addon; - std::string text; - char* strMsg = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_text( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); - if (strMsg != nullptr) - { - if (std::strlen(strMsg)) - text = strMsg; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - strMsg); - } - return text; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress - /// @brief To set the used text information string - /// - /// @param[in] text information text to set - /// - void SetText(const std::string& text) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_text( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, text.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress - /// @brief To ask dialog is finished - /// - /// @return True if on end - /// - bool IsFinished() const - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->is_finished( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress - /// @brief Mark progress finished - /// - void MarkFinished() - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->mark_finished( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress - /// @brief Get the current progress position as percent - /// - /// @return Position - /// - float Percentage() const - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_percentage( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress - /// @brief To set the current progress position as percent - /// - /// @param[in] percentage Position to use from 0.0 to 100.0 - /// - void SetPercentage(float percentage) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_percentage( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, percentage); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress - /// @brief To set progress position with predefined places - /// - /// @param[in] currentItem Place position to use - /// @param[in] itemCount Amount of used places - /// - void SetProgress(int currentItem, int itemCount) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_progress( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, currentItem, itemCount); - } - //-------------------------------------------------------------------------- - -private: - void* m_DialogHandle; -}; - -} /* namespace dialogs */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h deleted file mode 100644 index 90da063..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../definitions.h" -#include "../../AddonBase.h" - -namespace kodi -{ -namespace gui -{ -namespace dialogs -{ - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_dialogs_FileBrowser Dialog File Browser - /// \ingroup cpp_kodi_gui - /// @brief \cpp_namespace{ kodi::gui::dialogs::FileBrowser } - /// **File browser dialog** - /// - /// The functions listed below of the class "FileBrowser" offer - /// the possibility to select to a file by the user of the add-on. - /// - /// It allows all the options that are possible in Kodi itself and offers all - /// support file types. - /// - /// It has the header \ref FileBrowser.h "#include " - /// be included to enjoy it. - /// - namespace FileBrowser - { - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_FileBrowser - /// @brief Directory selection dialog - /// - /// @param[in] shares With Shares becomes the available start folders - /// be set. - /// @param[in] heading Dialog header name - /// @param[in,out] path As in the path to start and return value about - /// selected directory - /// @param[in] writeOnly If set only writeable folders are shown. - /// @return False if selection becomes canceled. - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// /* - /// * Example show directory selection dialog with on 'share' (first value) - /// * defined directory types. - /// * - /// * If this becomes leaved empty and 'directory' is empty goes it to the - /// * base path of the hard disk. - /// * - /// * Also can be with path written to 'directory' before the dialog forced - /// * to a start place. - /// */ - /// std::string directory; - /// bool ret = kodi::gui::dialogs::FileBrowser::ShowAndGetDirectory("local|network|removable", - /// "Test directory selection", - /// directory, - /// false); - /// fprintf(stderr, "Selected directory is : %s and was %s\n", directory.c_str(), ret ? "OK" : "Canceled"); - /// ~~~~~~~~~~~~~ - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetDirectory(const std::string& shares, - const std::string& heading, - std::string& path, - bool writeOnly = false) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_directory( - CAddonBase::m_interface->toKodi->kodiBase, shares.c_str(), heading.c_str(), path.c_str(), - &retString, writeOnly); - if (retString != nullptr) - { - if (std::strlen(retString)) - path = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_FileBrowser - /// @brief File selection dialog - /// - /// @param[in] shares With Shares becomes the available start - /// folders be set. - /// @param[in] mask The mask to filter visible files, e.g. - /// ".m3u|.pls|.b4s|.wpl". - /// @param[in] heading Dialog header name - /// @param[in,out] path As in the path to start and Return value - /// about selected file - /// @param[in] useThumbs If set show thumbs if possible on dialog. - /// @param[in] useFileDirectories If set also packages (e.g. *.zip) are - /// handled as directories. - /// @return False if selection becomes canceled. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetFile(const std::string& shares, - const std::string& mask, - const std::string& heading, - std::string& path, - bool useThumbs = false, - bool useFileDirectories = false) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_file(CAddonBase::m_interface->toKodi->kodiBase, - shares.c_str(), mask.c_str(), heading.c_str(), path.c_str(), &retString, - useThumbs, useFileDirectories); - if (retString != nullptr) - { - if (std::strlen(retString)) - path = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_FileBrowser - /// @brief File selection from a directory - /// - /// @param[in] directory The directory name where the dialog - /// start, possible are normal names and - /// kodi's special names. - /// @param[in] mask The mask to filter visible files, e.g. - /// ".m3u|.pls|.b4s|.wpl". - /// @param[in] heading Dialog header name - /// @param[in,out] path As in the path to start and Return value - /// about selected file - /// @param[in] useThumbs If set show thumbs if possible on dialog. - /// @param[in] useFileDirectories If set also packages (e.g. *.zip) are - /// handled as directories. - /// @param[in] singleList - /// @return False if selection becomes canceled. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetFileFromDir(const std::string& directory, - const std::string& mask, - const std::string& heading, - std::string& path, - bool useThumbs = false, - bool useFileDirectories = false, - bool singleList = false) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_file_from_dir(CAddonBase::m_interface->toKodi->kodiBase, - directory.c_str(), mask.c_str(), heading.c_str(), - path.c_str(), &retString, useThumbs, - useFileDirectories, singleList); - if (retString != nullptr) - { - if (std::strlen(retString)) - path = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_FileBrowser - /// @brief File selection dialog to get several in to a list - /// - /// @param[in] shares With Shares becomes the available start - /// folders be set. - /// @param[in] mask The mask to filter visible files, e.g. - /// ".m3u|.pls|.b4s|.wpl". - /// @param[in] heading Dialog header name - /// @param[out] fileList Return value about selected files - /// @param[in] useThumbs If set show thumbs if possible on dialog. - /// @param[in] useFileDirectories If set also packages (e.g. *.zip) are - /// handled as directories. - /// @return False if selection becomes canceled. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetFileList(const std::string& shares, - const std::string& mask, - const std::string& heading, - std::vector& fileList, - bool useThumbs = false, - bool useFileDirectories = false) - { - using namespace ::kodi::addon; - char** list = nullptr; - unsigned int listSize = 0; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_file_list(CAddonBase::m_interface->toKodi->kodiBase, - shares.c_str(), mask.c_str(), heading.c_str(), &list, &listSize, - useThumbs, useFileDirectories); - if (ret) - { - for (unsigned int i = 0; i < listSize; ++i) - fileList.emplace_back(list[i]); - CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->clear_file_list(CAddonBase::m_interface->toKodi->kodiBase, &list, listSize); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_FileBrowser - /// @brief Source selection dialog - /// - /// @param[in,out] path As in the path to start and Return value - /// about selected source - /// @param[in] allowNetworkShares Allow also access to network - /// @param[in] additionalShare With additionalShare becomes the available - /// start folders be set (optional). - /// @param[in] type - /// @return False if selection becomes canceled. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetSource(std::string& path, - bool allowNetworkShares, - const std::string& additionalShare = "", - const std::string& type = "") - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_source(CAddonBase::m_interface->toKodi->kodiBase, path.c_str(), &retString, - allowNetworkShares, additionalShare.c_str(), type.c_str()); - if (retString != nullptr) - { - if (std::strlen(retString)) - path = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_FileBrowser - /// @brief Image selection dialog - /// - /// @param[in] shares With Shares becomes the available start folders be - /// set. - /// @param[in] heading Dialog header name - /// @param[out] path Return value about selected image - /// @return False if selection becomes canceled. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetImage(const std::string& shares, - const std::string& heading, - std::string& path) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_image(CAddonBase::m_interface->toKodi->kodiBase, - shares.c_str(), heading.c_str(), path.c_str(), &retString); - if (retString != nullptr) - { - if (std::strlen(retString)) - path = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_FileBrowser - /// @brief Image selection dialog to get several in to a list - /// - /// @param[in] shares With Shares becomes the available start folders - /// be set. - /// @param[in] heading Dialog header name - /// @param[out] file_list Return value about selected images - /// @return False if selection becomes canceled. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetImageList(const std::string& shares, - const std::string& heading, - std::vector& file_list) - { - using namespace ::kodi::addon; - char** list = nullptr; - unsigned int listSize = 0; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_image_list(CAddonBase::m_interface->toKodi->kodiBase, - shares.c_str(), heading.c_str(), &list, &listSize); - if (ret) - { - for (unsigned int i = 0; i < listSize; ++i) - file_list.emplace_back(list[i]); - CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->clear_file_list(CAddonBase::m_interface->toKodi->kodiBase, &list, listSize); - } - return ret; - } - //-------------------------------------------------------------------------- - }; - -} /* namespace dialogs */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h deleted file mode 100644 index 843bdfa..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h +++ /dev/null @@ -1,422 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../definitions.h" -#include "../../AddonBase.h" - -namespace kodi -{ -namespace gui -{ -namespace dialogs -{ - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_dialogs_Keyboard Dialog Keyboard - /// \ingroup cpp_kodi_gui - /// @brief \cpp_namespace{ kodi::gui::dialogs::Keyboard } - /// **Keyboard dialogs** - /// - /// The functions listed below have to be permitted by the user for the - /// representation of a keyboard around an input. - /// - /// The class supports several kinds, from an easy text choice up to the - /// passport Word production and their confirmation for add-on. - /// - /// It has the header \ref Keyboard.h "#include " - /// be included to enjoy it. - /// - namespace Keyboard - { - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Keyboard - /// @brief Show keyboard with initial value `text` and replace with result - /// string. - /// - /// @param[in,out] text Overwritten with user input if return=true. - /// @param[in] heading String shown on dialog title. - /// @param[in] allowEmptyResult Whether a blank password is valid or not. - /// @param[in] hiddenInput The inserted input is not shown as text. - /// @param[in] autoCloseMs To close the dialog after a specified - /// time, in milliseconds, default is 0 which - /// keeps the dialog open indefinitely. - /// @return true if successful display and user input. - /// false if unsuccessful display, no user - /// input, or canceled editing. - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// /* - /// * The example shows the display of keyboard call dialog at Kodi from the add-on. - /// * Below all values are set, however, can last two (hidden input = false and autoCloseMs = 0) - /// * to be released if not needed. - /// */ - /// std::string text = "Please change me to them want you want"; /*< It can be leaved empty or a - /// entry text added */ - /// bool bRet = ::kodi::gui::dialogs::Keyboard::ShowAndGetInput(text, - /// "Demonstration text entry", - /// true, - /// false, - /// 0); - /// fprintf(stderr, "Written keyboard input is : '%s' and was %s\n", - /// text.c_str(), bRet ? "OK" : "Canceled"); - /// ~~~~~~~~~~~~~ - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(std::string& text, - const std::string& heading, - bool allowEmptyResult, - bool hiddenInput = false, - unsigned int autoCloseMs = 0) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = - CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_input_with_head( - CAddonBase::m_interface->toKodi->kodiBase, text.c_str(), &retString, heading.c_str(), - allowEmptyResult, hiddenInput, autoCloseMs); - if (retString != nullptr) - { - text = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, - retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Keyboard - /// @brief The example shows the display of keyboard call dialog at Kodi - /// from the add-on. - /// - /// @param[out] text Overwritten with user input if return=true. - /// @param[in] allowEmptyResult If set to true keyboard can also exited - /// without entered text. - /// @param[in] autoCloseMs To close the dialog after a specified time, - /// in milliseconds, default is 0 which keeps - /// the dialog open indefinitely. - /// @return true if successful display and user input. - /// false if unsuccessful display, no user - /// input, or canceled editing. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(std::string& text, - bool allowEmptyResult, - unsigned int autoCloseMs = 0) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_input(CAddonBase::m_interface->toKodi->kodiBase, - text.c_str(), &retString, - allowEmptyResult, autoCloseMs); - if (retString != nullptr) - { - text = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Keyboard - /// @brief Shows keyboard and prompts for a password. Differs from - /// `ShowAndVerifyNewPassword()` in that no second verification - /// - /// @param[in,out] newPassword Overwritten with user input if return=true. - /// @param[in] heading String shown on dialog title. - /// @param[in] allowEmptyResult Whether a blank password is valid or not. - /// @param[in] autoCloseMs To close the dialog after a specified time, - /// in milliseconds, default is 0 which keeps - /// the dialog open indefinitely. - /// @return true if successful display and user input. - /// false if unsuccessful display, no user - /// input, or canceled editing. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetNewPassword(std::string& newPassword, - const std::string& heading, - bool allowEmptyResult, - unsigned int autoCloseMs = 0) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_new_password_with_head(CAddonBase::m_interface->toKodi->kodiBase, - newPassword.c_str(), &retString, heading.c_str(), - allowEmptyResult, autoCloseMs); - if (retString != nullptr) - { - newPassword = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Keyboard - /// @brief Shows keyboard and prompts for a password. Differs from - /// `ShowAndVerifyNewPassword()` in that no second verification - /// - /// @param[in,out] newPassword Overwritten with user input if return=true. - /// @param[in] autoCloseMs To close the dialog after a specified time, - /// in milliseconds, default is 0 which keeps - /// the dialog open indefinitely. - /// @return true if successful display and user input. - /// false if unsuccessful display, no user - /// input, or canceled editing. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetNewPassword(std::string& newPassword, - unsigned int autoCloseMs = 0) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_new_password(CAddonBase::m_interface->toKodi->kodiBase, - newPassword.c_str(), &retString, autoCloseMs); - if (retString != nullptr) - { - newPassword = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Keyboard - /// @brief Show keyboard twice to get and confirm a user-entered password - /// string. - /// - /// @param[out] newPassword Overwritten with user input if return=true. - /// @param[in] heading String shown on dialog title. - /// @param[in] allowEmptyResult - /// @param[in] autoCloseMs To close the dialog after a specified time, - /// in milliseconds, default is 0 which keeps - /// the dialog open indefinitely. - /// @return true if successful display and user input. - /// false if unsuccessful display, no user - /// input, or canceled editing. - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// #include - /// - /// /* - /// * The example below shows the complete use of keyboard dialog for password - /// * check. If only one check from add-on needed can be function with retries - /// * set to '0' called alone. - /// * - /// * The use of MD5 translated password is always required for the check on Kodi! - /// */ - /// - /// int maxretries = 3; - /// /* - /// * Password names need to be send as md5 sum to kodi. - /// */ - /// std::string password; - /// kodi::GetMD5("kodi", password); - /// - /// /* - /// * To the loop about password checks. - /// */ - /// int ret; - /// for (unsigned int i = 0; i < maxretries; i++) - /// { - /// /* - /// * Ask the user about the password. - /// */ - /// ret = ::kodi::gui::dialogs::Keyboard::ShowAndVerifyPassword(password, "Demo password call for PW 'kodi'", i, 0); - /// if (ret == 0) - /// { - /// fprintf(stderr, "Password successfull confirmed after '%i' tries\n", i+1); - /// break; - /// } - /// else if (ret < 0) - /// { - /// fprintf(stderr, "Canceled editing on try '%i'\n", i+1); - /// break; - /// } - /// else /* if (ret > 0) */ - /// { - /// fprintf(stderr, "Wrong password entered on try '%i'\n", i+1); - /// } - /// } - /// ~~~~~~~~~~~~~ - /// - inline bool ATTRIBUTE_HIDDEN ShowAndVerifyNewPassword(std::string& newPassword, - const std::string& heading, - bool allowEmptyResult, - unsigned int autoCloseMs = 0) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_verify_new_password_with_head(CAddonBase::m_interface->toKodi->kodiBase, - &retString, heading.c_str(), allowEmptyResult, - autoCloseMs); - if (retString != nullptr) - { - newPassword = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Keyboard - /// @brief Show keyboard twice to get and confirm a user-entered password - /// string. - /// - /// @param[out] newPassword Overwritten with user input if return=true. - /// @param[in] autoCloseMs To close the dialog after a specified time, - /// in milliseconds, default is 0 which keeps - /// the dialog open indefinitely. - /// @return true if successful display and user input. - /// false if unsuccessful display, no user - /// input, or canceled editing. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndVerifyNewPassword(std::string& newPassword, - unsigned int autoCloseMs = 0) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_verify_new_password(CAddonBase::m_interface->toKodi->kodiBase, - &retString, autoCloseMs); - if (retString != nullptr) - { - newPassword = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Keyboard - /// @brief Show keyboard and verify user input against `password`. - /// - /// @param[in,out] password Value to compare against user input. - /// @param[in] heading String shown on dialog title. - /// @param[in] retries If greater than 0, shows "Incorrect - /// password, %d retries left" on dialog line 2, - /// else line 2 is blank. - /// @param[in] autoCloseMs To close the dialog after a specified time, - /// in milliseconds, default is 0 which keeps - /// the dialog open indefinitely. - /// @return 0 if successful display and user input. 1 if - /// unsuccessful input. -1 if no user input or - /// canceled editing. - /// - inline int ATTRIBUTE_HIDDEN ShowAndVerifyPassword(std::string& password, - const std::string& heading, - int retries, - unsigned int autoCloseMs = 0) - { - using namespace ::kodi::addon; - char* retString = nullptr; - int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_verify_password(CAddonBase::m_interface->toKodi->kodiBase, - password.c_str(), &retString, heading.c_str(), - retries, autoCloseMs); - if (retString != nullptr) - { - password = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Keyboard - /// @brief Shows a filter related keyboard - /// - /// @param[in,out] text Overwritten with user input if return=true. - /// @param[in] searching Use dialog for search and send our search - /// message in safe way (only the active window - /// needs it) - /// - header name if true is "Enter search string" - /// - header name if false is "Enter value" - /// @param autoCloseMs To close the dialog after a specified time, - /// in milliseconds, default is 0 which keeps - /// the dialog open indefinitely. - /// @return true if successful display and user input. - /// false if unsuccessful display, no user - /// input, or canceled editing. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetFilter(std::string& text, - bool searching, - unsigned int autoCloseMs = 0) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_filter(CAddonBase::m_interface->toKodi->kodiBase, - text.c_str(), &retString, searching, autoCloseMs); - if (retString != nullptr) - { - text = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Keyboard - /// @brief Send a text to a visible keyboard - /// - /// @param[in] text Overwritten with user input if return=true. - /// @param[in] closeKeyboard The open dialog is if also closed on 'true'. - /// @return true if successful done, false if - /// unsuccessful or keyboard not present. - /// - inline bool ATTRIBUTE_HIDDEN SendTextToActiveKeyboard(const std::string& text, - bool closeKeyboard = false) - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->send_text_to_active_keyboard(CAddonBase::m_interface->toKodi->kodiBase, - text.c_str(), closeKeyboard); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Keyboard - /// @brief Check for visible keyboard on GUI - /// - /// @return true if keyboard present, false if not present - /// - inline bool ATTRIBUTE_HIDDEN IsKeyboardActivated() - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->is_keyboard_activated(CAddonBase::m_interface->toKodi->kodiBase); - } - //-------------------------------------------------------------------------- - }; - -} /* namespace dialogs */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h deleted file mode 100644 index bff7683..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h +++ /dev/null @@ -1,362 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../definitions.h" -#include "../../AddonBase.h" - -namespace kodi -{ -namespace gui -{ -namespace dialogs -{ - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_dialogs_Numeric Dialog Numeric - /// \ingroup cpp_kodi_gui - /// @{ - /// @brief \cpp_namespace{ kodi::gui::dialogs::Numeric } - /// **Numeric dialogs** - /// - /// The functions listed below have to be permitted by the user for the - /// representation of a numeric keyboard around an input. - /// - /// The class supports several kinds, from an easy number choice up to the - /// passport Word production and their confirmation for add-on. - /// - /// It has the header \ref Numeric.h "#include " - /// be included to enjoy it. - /// - namespace Numeric - { - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Numeric - /// @brief Use dialog to get numeric new password - /// - /// @param[out] newPassword String to preload into the keyboard - /// accumulator. Overwritten with user input - /// if return=true. Returned in MD5 format. - /// @return true if successful display and user - /// input entry/re-entry. - /// false if unsuccessful display, no user - /// input, or canceled editing. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndVerifyNewPassword(std::string& newPassword) - { - using namespace ::kodi::addon; - char* pw = nullptr; - bool ret = - CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_new_password( - CAddonBase::m_interface->toKodi->kodiBase, &pw); - if (pw != nullptr) - { - newPassword = pw; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, pw); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Numeric - /// @brief Use dialog to verify numeric password. - /// - /// @param[in] password Password to compare with user input, need - /// in MD5 format. - /// @param[in] heading Heading to display - /// @param[in] retries If greater than 0, shows "Incorrect - /// password, %d retries left" on dialog - /// line 2, else line 2 is blank. - /// @return Possible values: - /// - 0 if successful display and user input. - /// - 1 if unsuccessful input. - /// - -1 if no user input or canceled editing. - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include /* fprintf */ - /// #include - /// #include - /// - /// /* - /// * The example below shows the complete use of keyboard dialog for password - /// * check. If only one check from add-on needed can be function with retries - /// * set to '0' called alone. - /// * - /// * The use of MD5 translated password is always required for the check on Kodi! - /// */ - /// - /// int maxretries = 3; - /// - /// /* - /// * Password names need to be send as md5 sum to kodi. - /// */ - /// std::string password = kodi::GetMD5("1234"); - /// - /// /* - /// * To the loop about password checks. - /// */ - /// int ret; - /// for (unsigned int i = 0; i < maxretries; i++) - /// { - /// /* - /// * Ask the user about the password. - /// */ - /// ret = kodi::gui::dialogs::Numeric::ShowAndVerifyPassword(password, "Demo numeric password call for PW '1234'", i); - /// if (ret == 0) - /// { - /// fprintf(stderr, "Numeric password successfull confirmed after '%i' tries\n", i+1); - /// break; - /// } - /// else if (ret < 0) - /// { - /// fprintf(stderr, "Canceled editing on try '%i'\n", i+1); - /// break; - /// } - /// else /* if (ret > 0) */ - /// { - /// fprintf(stderr, "Wrong numeric password entered on try '%i'\n", i+1); - /// } - /// } - /// ~~~~~~~~~~~~~ - /// - inline int ATTRIBUTE_HIDDEN ShowAndVerifyPassword(const std::string& password, - const std::string& heading, - int retries) - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_password(CAddonBase::m_interface->toKodi->kodiBase, - password.c_str(), heading.c_str(), retries); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Numeric - /// @brief Use dialog to verify numeric password - /// - /// @param[in,out] toVerify Value to compare against user input. - /// @param[in] heading Heading to display - /// @param[in] verifyInput If set as true we verify the users input - /// versus toVerify. - /// @return true if successful display and user - /// input. false if unsuccessful display, no - /// user input, or canceled editing. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndVerifyInput(std::string& toVerify, - const std::string& heading, - bool verifyInput) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_input(CAddonBase::m_interface->toKodi->kodiBase, - toVerify.c_str(), &retString, heading.c_str(), verifyInput); - if (retString != nullptr) - { - toVerify = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Numeric - /// @brief Use dialog to get time value. - /// - /// @param[out] time Overwritten with user input if - /// return=true and time inserted. - /// @param[in] heading Heading to display. - /// @return true if successful display and user - /// input. false if unsuccessful display, no - /// user input, or canceled editing. - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include /* printf */ - /// #include /* time_t, struct tm, time, localtime, strftime */ - /// #include - /// - /// time_t rawtime; - /// struct tm * timeinfo; - /// char buffer [10]; - /// - /// time (&rawtime); - /// timeinfo = localtime(&rawtime); - /// bool bRet = kodi::gui::dialogs::Numeric::ShowAndGetTime(*timeinfo, "Selected time test call"); - /// strftime(buffer, sizeof(buffer), "%H:%M.", timeinfo); - /// printf("Selected time it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled"); - /// ~~~~~~~~~~~~~ - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetTime(tm& time, const std::string& heading) - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_time(CAddonBase::m_interface->toKodi->kodiBase, &time, heading.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Numeric - /// @brief Use dialog to get date value. - /// - /// @param[in,out] date Overwritten with user input if - /// return=true and date inserted. - /// @param[in] heading Heading to display - /// @return true if successful display and user - /// input. false if unsuccessful display, no - /// user input, or canceled editing. - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include /* printf */ - /// #include /* time_t, struct tm, time, localtime, strftime */ - /// #include - /// - /// time_t rawtime; - /// struct tm * timeinfo; - /// char buffer [20]; - /// - /// time (&rawtime); - /// timeinfo = localtime(&rawtime); - /// bool bRet = kodi::gui::dialogs::Numeric::ShowAndGetDate(*timeinfo, "Selected date test call"); - /// strftime(buffer, sizeof(buffer), "%Y-%m-%d", timeinfo); - /// printf("Selected date it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled"); - /// ~~~~~~~~~~~~~ - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetDate(tm& date, const std::string& heading) - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_date(CAddonBase::m_interface->toKodi->kodiBase, &date, heading.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Numeric - /// @brief Use dialog to get a IP - /// - /// @param[in,out] ipAddress Overwritten with user input if - /// return=true and IP address inserted. - /// @param[in] heading Heading to display. - /// @return true if successful display and - /// user input. false if unsuccessful - /// display, no user input, or canceled - /// editing. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetIPAddress(std::string& ipAddress, - const std::string& heading) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_ip_address(CAddonBase::m_interface->toKodi->kodiBase, - ipAddress.c_str(), &retString, heading.c_str()); - if (retString != nullptr) - { - ipAddress = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Numeric - /// @brief Use dialog to get normal number. - /// - /// @param[in,out] input Overwritten with user input if - /// return=true and time in seconds inserted - /// @param[in] heading Heading to display - /// @param[in] autoCloseTimeoutMs To close the dialog after a specified - /// time, in milliseconds, default is 0 - /// which keeps the dialog open - /// indefinitely. - /// @return true if successful display and user - /// input. false if unsuccessful display, no - /// user input, or canceled editing. - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include /* printf */ - /// #include /* strtoull (C++11) */ - /// #include - /// - /// std::string number; - /// bool bRet = kodi::gui::dialogs::Numeric::ShowAndGetNumber(number, "Number test call"); - /// printf("Written number input is : %llu and was %s\n", - /// strtoull(number.c_str(), nullptr, 0), bRet ? "OK" : "Canceled"); - /// ~~~~~~~~~~~~~ - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetNumber(std::string& input, - const std::string& heading, - unsigned int autoCloseTimeoutMs = 0) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_number(CAddonBase::m_interface->toKodi->kodiBase, - input.c_str(), &retString, heading.c_str(), autoCloseTimeoutMs); - if (retString != nullptr) - { - input = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Numeric - /// @brief Show numeric keypad to get seconds. - /// - /// @param[in,out] time Overwritten with user input if return=true and - /// time in seconds inserted. - /// @param[in] heading Heading to display - /// @return true if successful display and user input. false - /// if unsuccessful display, no user input, or - /// canceled editing. - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetSeconds(std::string& time, const std::string& heading) - { - using namespace ::kodi::addon; - char* retString = nullptr; - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_seconds(CAddonBase::m_interface->toKodi->kodiBase, - time.c_str(), &retString, heading.c_str()); - if (retString != nullptr) - { - time = retString; - CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); - } - return ret; - } - //-------------------------------------------------------------------------- - }; - /// @} - -} /* namespace dialogs */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h deleted file mode 100644 index b9a3a0d..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" -#include "../definitions.h" - -namespace kodi -{ -namespace gui -{ -namespace dialogs -{ - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_dialogs_OK Dialog OK - /// \ingroup cpp_kodi_gui - /// @{ - /// @brief \cpp_namespace{ kodi::gui::dialogs::OK } - /// **OK dialog** - /// - /// The functions listed below permit the call of a dialogue of information, a - /// confirmation of the user by press from OK required. - /// - /// It has the header \ref OK.h "#include " - /// be included to enjoy it. - /// - namespace OK - { - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_OK - /// @brief Use dialog to inform user with text and confirmation with OK with continued string. - /// - /// @param[in] heading Dialog heading. - /// @param[in] text Multi-line text. - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// ... - /// kodi::gui::dialogs::OK::ShowAndGetInput("Test dialog", "Hello World!\nI'm a call from add-on\n :) :D"); - /// ~~~~~~~~~~~~~ - /// - inline void ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading, const std::string& text) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogOK->show_and_get_input_single_text( - CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), text.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_OK - /// @brief Use dialog to inform user with text and confirmation with OK with strings separated to the lines. - /// - /// @param[in] heading Dialog heading. - /// @param[in] line0 Line #1 text. - /// @param[in] line1 Line #2 text. - /// @param[in] line2 Line #3 text. - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// ... - /// kodi::gui::dialogs::OK::ShowAndGetInput("Test dialog", "Hello World!", "I'm a call from add-on", " :) :D"); - /// ~~~~~~~~~~~~~ - /// - inline void ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading, - const std::string& line0, - const std::string& line1, - const std::string& line2) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogOK->show_and_get_input_line_text(CAddonBase::m_interface->toKodi->kodiBase, - heading.c_str(), line0.c_str(), line1.c_str(), - line2.c_str()); - } - //-------------------------------------------------------------------------- - } - /// @} - -} /* namespace dialogs */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h deleted file mode 100644 index b1f8cc5..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../definitions.h" -#include "../../AddonBase.h" - -namespace kodi -{ -namespace gui -{ -namespace dialogs -{ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_dialogs_CProgress Dialog Progress -/// \ingroup cpp_kodi_gui -/// @brief \cpp_class{ kodi::gui::dialogs::CProgress } -/// **Progress dialog shown in center** -/// -/// The with \ref DialogProgress.h "#include " -/// given class are basically used to create Kodi's progress dialog with named -/// text fields. -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// #include -/// -/// kodi::gui::dialogs::CProgress *progress = new kodi::gui::dialogs::CProgress; -/// progress->SetHeading("Test progress"); -/// progress->SetLine(1, "line 1"); -/// progress->SetLine(2, "line 2"); -/// progress->SetLine(3, "line 3"); -/// progress->SetCanCancel(true); -/// progress->ShowProgressBar(true); -/// progress->Open(); -/// for (unsigned int i = 0; i < 100; i += 10) -/// { -/// progress->SetPercentage(i); -/// sleep(1); -/// } -/// delete progress; -/// ~~~~~~~~~~~~~ -/// -class ATTRIBUTE_HIDDEN CProgress -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CProgress - /// @brief Construct a new dialog - /// - CProgress() - { - using namespace ::kodi::addon; - m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->new_dialog( - CAddonBase::m_interface->toKodi->kodiBase); - if (!m_DialogHandle) - kodi::Log(ADDON_LOG_FATAL, - "kodi::gui::dialogs::CProgress can't create window class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CProgress - /// @brief Destructor - /// - ~CProgress() - { - using namespace ::kodi::addon; - if (m_DialogHandle) - CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->delete_dialog( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CProgress - /// @brief To open the dialog - /// - void Open() - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->open( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CProgress - /// @brief Set the heading title of dialog - /// - /// @param[in] heading Title string to use - /// - void SetHeading(const std::string& heading) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_heading( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, heading.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CProgress - /// @brief To set the line text field on dialog from 0 - 2 - /// - /// @param[in] iLine Line number - /// @param[in] line Text string - /// - void SetLine(unsigned int iLine, const std::string& line) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_line( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, iLine, line.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CProgress - /// @brief To enable and show cancel button on dialog - /// - /// @param[in] canCancel if true becomes it shown - /// - void SetCanCancel(bool canCancel) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_can_cancel( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, canCancel); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CProgress - /// @brief To check dialog for clicked cancel button - /// - /// @return True if canceled - /// - bool IsCanceled() const - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->is_canceled( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CProgress - /// @brief Get the current progress position as percent - /// - /// @param[in] percentage Position to use from 0 to 100 - /// - void SetPercentage(int percentage) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_percentage( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, percentage); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CProgress - /// @brief To set the current progress position as percent - /// - /// @return Current Position used from 0 to 100 - /// - int GetPercentage() const - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->get_percentage( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CProgress - /// @brief To show or hide progress bar dialog - /// - /// @param[in] onOff If true becomes it shown - /// - void ShowProgressBar(bool onOff) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->show_progress_bar( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, onOff); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CProgress - /// @brief Set the maximum position of progress, needed if `SetProgressAdvance(...)` is used - /// - /// @param[in] max Biggest usable position to use - /// - void SetProgressMax(int max) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_progress_max( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, max); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CProgress - /// @brief To increase progress bar by defined step size until reach of maximum position - /// - /// @param[in] steps Step size to increase, default is 1 - /// - void SetProgressAdvance(int steps = 1) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_progress_advance( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, steps); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_CProgress - /// @brief To check progress was canceled on work - /// - /// @return True if aborted - /// - bool Abort() - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->abort( - CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); - } - //-------------------------------------------------------------------------- - -private: - void* m_DialogHandle; -}; - -} /* namespace dialogs */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h deleted file mode 100644 index 39a98fe..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../definitions.h" -#include "../../AddonBase.h" - -//============================================================================== -/// \defgroup cpp_kodi_vfs_Defs Definitions, structures and enumerators -/// \ingroup cpp_kodi_gui_dialogs_Select -/// @brief **Dialog Select definition values** -//------------------------------------------------------------------------------ - -//============================================================================== -/// \ingroup cpp_kodi_vfs_Defs -/// @brief **Selection entry structure** -/// -typedef struct SSelectionEntry -{ - //============================================================================ - /// Structure constructor - /// - /// There becomes selected always set to false. - /// - SSelectionEntry() = default; - //---------------------------------------------------------------------------- - - /// Entry identfication string - std::string id; - - /// Entry name to show on GUI dialog - std::string name; - - /// Place where entry can be preselected and after return the from user - /// selected is set. - bool selected = false; -} SSelectionEntry; -//------------------------------------------------------------------------------ - -namespace kodi -{ -namespace gui -{ -namespace dialogs -{ - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_dialogs_Select Dialog Select - /// \ingroup cpp_kodi_gui - /// @{ - /// @brief \cpp_namespace{ kodi::gui::dialogs::Select } - /// **Selection dialog** - /// - /// The function listed below permits the call of a dialogue to select of an - /// entry as a key - /// - /// It has the header \ref Select.h "#include " - /// be included to enjoy it. - /// - /// - namespace Select - { - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Select - /// @brief Show a selection dialog about given parts. - /// - /// @param[in] heading Dialog heading name - /// @param[in] entries String list about entries - /// @param[in] selected [opt] Predefined selection (default is - /// -1 for the first) - /// @param[in] autoclose [opt] To close dialog automatic after the given - /// time in ms. As '0' it stays open. - /// @return The selected entry, if return -1 was - /// nothing selected or canceled - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// const std::vector entries - /// { - /// "Test 1", - /// "Test 2", - /// "Test 3", - /// "Test 4", - /// "Test 5" - /// }; - /// - /// int selected = kodi::gui::dialogs::Select::Show("Test selection", entries, -1); - /// if (selected < 0) - /// fprintf(stderr, "Item selection canceled\n"); - /// else - /// fprintf(stderr, "Selected item is: %i\n", selected); - /// ~~~~~~~~~~~~~ - /// - inline int ATTRIBUTE_HIDDEN Show(const std::string& heading, - const std::vector& entries, - int selected = -1, - unsigned int autoclose = 0) - { - using namespace ::kodi::addon; - unsigned int size = static_cast(entries.size()); - const char** cEntries = (const char**)malloc(size * sizeof(const char**)); - for (unsigned int i = 0; i < size; ++i) - { - cEntries[i] = entries[i].c_str(); - } - int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogSelect->open( - CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size, selected, - autoclose); - free(cEntries); - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Select - /// @brief Show a selection dialog about given parts. - /// - /// This function is mostly equal to the other, only becomes the string list - /// here done by a SSelectionEntry, where a ID string can be defined. - /// - /// @param[in] heading Dialog heading name - /// @param[in] entries SSelectionEntry list about entries - /// @param[in] selected [opt] Predefined selection (default is - /// -1 for the first) - /// @param[in] autoclose [opt] To close dialog automatic after the given - /// time in ms. As '0' it stays open. - /// @return The selected entry, if return -1 was - /// nothing selected or canceled - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// std::vector entries - /// { - /// { "ID 1", "Test 1", false }, - /// { "ID 2", "Test 2", false }, - /// { "ID 3", "Test 3", false }, - /// { "ID 4", "Test 4", false }, - /// { "ID 5", "Test 5", false } - /// }; - /// - /// int selected = kodi::gui::dialogs::Select::Show("Test selection", entries, -1); - /// if (selected < 0) - /// fprintf(stderr, "Item selection canceled\n"); - /// else - /// fprintf(stderr, "Selected item is: %i\n", selected); - /// ~~~~~~~~~~~~~ - /// - inline int ATTRIBUTE_HIDDEN Show(const std::string& heading, - std::vector& entries, - int selected = -1, - unsigned int autoclose = 0) - { - using namespace ::kodi::addon; - unsigned int size = static_cast(entries.size()); - const char** cEntries = static_cast(malloc(size*sizeof(const char*))); - for (unsigned int i = 0; i < size; ++i) - { - cEntries[i] = entries[i].name.c_str(); - if (selected == -1 && entries[i].selected) - selected = i; - } - int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogSelect->open(CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), - cEntries, size, selected, autoclose); - if (ret >= 0) - { - entries[ret].selected = true; - } - free(cEntries); - return ret; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_Select - /// @brief Show a multiple selection dialog about given parts. - /// - /// @param[in] heading Dialog heading name - /// @param[in] entries SSelectionEntry list about entries - /// @param[in] autoclose [opt] To close dialog automatic after the given - /// time in ms. As '0' it stays open. - /// @return The selected entries, if return empty was - /// nothing selected or canceled - /// - /// With selected on SSelectionEntry can be a pre selection defined. - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// std::vector entries - /// { - /// { "ID 1", "Test 1", false }, - /// { "ID 2", "Test 2", false }, - /// { "ID 3", "Test 3", false }, - /// { "ID 4", "Test 4", false }, - /// { "ID 5", "Test 5", false } - /// }; - /// - /// bool ret = kodi::gui::dialogs::Select::ShowMultiSelect("Test selection", entries); - /// if (!ret) - /// fprintf(stderr, "Selection canceled\n"); - /// else - /// { - /// fprintf(stderr, "Selected items:\n"); - /// for (const auto& entry : entries) - /// { - /// if (entry.selected) - /// fprintf(stderr, " - %s\n", entry.selected.id.c_str()); - /// } - /// } - /// ~~~~~~~~~~~~~ - /// - inline bool ATTRIBUTE_HIDDEN ShowMultiSelect(const std::string& heading, - std::vector& entries, - int autoclose = 0) - { - using namespace ::kodi::addon; - unsigned int size = static_cast(entries.size()); - const char** cEntryIDs = static_cast(malloc(size*sizeof(const char*))); - const char** cEntryNames = static_cast(malloc(size*sizeof(const char*))); - bool* cEntriesSelected = static_cast(malloc(size*sizeof(bool))); - for (unsigned int i = 0; i < size; ++i) - { - cEntryIDs[i] = entries[i].id.c_str(); - cEntryNames[i] = entries[i].name.c_str(); - cEntriesSelected[i] = entries[i].selected; - } - bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogSelect->open_multi_select(CAddonBase::m_interface->toKodi->kodiBase, - heading.c_str(), cEntryIDs, cEntryNames, - cEntriesSelected, size, autoclose); - if (ret) - { - for (unsigned int i = 0; i < size; ++i) - entries[i].selected = cEntriesSelected[i]; - } - free(cEntryNames); - free(cEntryIDs); - free(cEntriesSelected); - return ret; - } - //-------------------------------------------------------------------------- - }; - /// @} - -} /* namespace dialogs */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h deleted file mode 100644 index 5c81837..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2015-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../definitions.h" -#include "../../AddonBase.h" - -namespace kodi -{ -namespace gui -{ -namespace dialogs -{ - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_dialogs_TextViewer Dialog Text Viewer - /// \ingroup cpp_kodi_gui - /// @{ - /// @brief \cpp_namespace{ kodi::gui::dialogs::TextViewer } - /// **Text viewer dialog** - /// - /// The text viewer dialog can be used to display descriptions, help texts or - /// other larger texts. - /// - /// In order to achieve a line break is a \\n directly in the text or - /// in the "./resources/language/resource.language.??_??/strings.po" - /// to call with std::string kodi::general::GetLocalizedString(...);. - /// - /// It has the header \ref TextViewer.h "#include " - /// be included to enjoy it. - /// - namespace TextViewer - { - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_TextViewer - /// @brief Show info text dialog - /// - /// @param[in] heading Small heading text - /// @param[in] text Showed text on dialog - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// kodi::gui::dialogs::TextViewer::Show("The Wizard of Oz (1939 film)", - /// "The Wizard of Oz is a 1939 American musical comedy-drama fantasy film " - /// "produced by Metro-Goldwyn-Mayer, and the most well-known and commercially " - /// "successful adaptation based on the 1900 novel The Wonderful Wizard of Oz " - /// "by L. Frank Baum. The film stars Judy Garland as Dorothy Gale. The film" - /// "co-stars Terry the dog, billed as Toto; Ray Bolger, Jack Haley, Bert Lahr, " - /// "Frank Morgan, Billie Burke, Margaret Hamilton, with Charley Grapewin and " - /// "Clara Blandick, and the Singer Midgets as the Munchkins.\n" - /// "\n" - /// "Notable for its use of Technicolor, fantasy storytelling, musical score and " - /// "unusual characters, over the years it has become an icon of American popular " - /// "culture. It was nominated for six Academy Awards, including Best Picture but " - /// "lost to Gone with the Wind. It did win in two other categories including Best " - /// "Original Song for \"Over the Rainbow\". However, the film was a box office " - /// "disappointment on its initial release, earning only $3,017,000 on a $2,777,000 " - /// "budget, despite receiving largely positive reviews. It was MGM's most " - /// "expensive production at that time, and did not completely recoup the studio's " - /// "investment and turn a profit until theatrical re-releases starting in 1949.\n" - /// "\n" - /// "The 1956 broadcast television premiere of the film on CBS re-introduced the " - /// "film to the wider public and eventually made the presentation an annual " - /// "tradition, making it one of the most known films in cinema history. The " - /// "film was named the most-viewed motion picture on television syndication by " - /// "the Library of Congress who also included the film in its National Film " - /// "Registry in its inaugural year in 1989. Designation on the registry calls " - /// "for efforts to preserve it for being \"culturally, historically, and " - /// "aesthetically significant\". It is also one of the few films on UNESCO's " - /// "Memory of the World Register.\n" - /// "\n" - /// "The Wizard of Oz is often ranked on best-movie lists in critics' and public " - /// "polls. It is the source of many quotes referenced in modern popular culture. " - /// "It was directed primarily by Victor Fleming (who left production to take " - /// "over direction on the troubled Gone with the Wind production). Noel Langley, " - /// "Florence Ryerson and Edgar Allan Woolf received credit for the screenplay, " - /// "but there were uncredited contributions by others. The songs were written " - /// "by Edgar \"Yip\" Harburg (lyrics) and Harold Arlen (music). The incidental " - /// "music, based largely on the songs, was composed by Herbert Stothart, with " - /// "interspersed renderings from classical composers.\n"); - /// ~~~~~~~~~~~~~ - /// - inline void ATTRIBUTE_HIDDEN Show(const std::string& heading, const std::string& text) - { - using namespace ::kodi::addon; - CAddonBase::m_interface->toKodi->kodi_gui->dialogTextViewer->open( - CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), text.c_str()); - } - //-------------------------------------------------------------------------- - }; - /// @} - -} /* namespace dialogs */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h deleted file mode 100644 index 67c2fc4..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../definitions.h" -#include "../../AddonBase.h" - -namespace kodi -{ -namespace gui -{ -namespace dialogs -{ - - //============================================================================ - /// - /// \defgroup cpp_kodi_gui_dialogs_YesNo Dialog Yes/No - /// \ingroup cpp_kodi_gui - /// @{ - /// @brief \cpp_namespace{ kodi::gui::dialogs::YesNo } - /// **Yes / No dialog** - /// - /// The Yes / No dialog can be used to inform the user about questions and get - /// the answer. - /// - /// In order to achieve a line break is a \\n directly in the text or - /// in the "./resources/language/resource.language.??_??/strings.po" - /// to call with std::string kodi::general::GetLocalizedString(...);. - /// - /// It has the header \ref YesNo.h "#include " - /// be included to enjoy it. - /// - /// - namespace YesNo - { - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_YesNo - /// @brief Use dialog to get numeric new password with one text string shown - /// everywhere and cancel return field - /// - /// @param[in] heading Dialog heading - /// @param[in] text Multi-line text - /// @param[out] canceled Return value about cancel button - /// @param[in] noLabel [opt] label to put on the no button - /// @param[in] yesLabel [opt] label to put on the yes button - /// @return Returns True if 'Yes' was pressed, else False - /// - /// @note It is preferred to only use this as it is actually a multi-line text. - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// bool canceled; - /// bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput( - /// "Yes / No test call", /* The Header */ - /// "You has opened Yes / No dialog for test\n\nIs this OK for you?", - /// canceled, /* return value about cancel button */ - /// "Not really", /* No label, is optional and if empty "No" */ - /// "Ohhh yes"); /* Yes label, also optional and if empty "Yes" */ - /// fprintf(stderr, "You has called Yes/No, returned '%s' and was %s\n", - /// ret ? "yes" : "no", - /// canceled ? "canceled" : "not canceled"); - /// ~~~~~~~~~~~~~ - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading, - const std::string& text, - bool& canceled, - const std::string& noLabel = "", - const std::string& yesLabel = "") - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_single_text( - CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), text.c_str(), &canceled, - noLabel.c_str(), yesLabel.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_YesNo - /// @brief Use dialog to get numeric new password with separated line strings - /// - /// @param[in] heading Dialog heading - /// @param[in] line0 Line #0 text - /// @param[in] line1 Line #1 text - /// @param[in] line2 Line #2 text - /// @param[in] noLabel [opt] label to put on the no button. - /// @param[in] yesLabel [opt] label to put on the yes button. - /// @return Returns True if 'Yes' was pressed, else False. - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput( - /// "Yes / No test call", // The Header - /// "You has opened Yes / No dialog for test", - /// "", - /// "Is this OK for you?", - /// "Not really", // No label, is optional and if empty "No" - /// "Ohhh yes"); // Yes label, also optional and if empty "Yes" - /// fprintf(stderr, "You has called Yes/No, returned '%s'\n", - /// ret ? "yes" : "no"); - /// ~~~~~~~~~~~~~ - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading, - const std::string& line0, - const std::string& line1, - const std::string& line2, - const std::string& noLabel = "", - const std::string& yesLabel = "") - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_line_text(CAddonBase::m_interface->toKodi->kodiBase, - heading.c_str(), line0.c_str(), line1.c_str(), line2.c_str(), - noLabel.c_str(), yesLabel.c_str()); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_dialogs_YesNo - /// @brief Use dialog to get numeric new password with separated line strings and cancel return field - /// - /// @param[in] heading Dialog heading - /// @param[in] line0 Line #0 text - /// @param[in] line1 Line #1 text - /// @param[in] line2 Line #2 text - /// @param[out] canceled Return value about cancel button - /// @param[in] noLabel [opt] label to put on the no button - /// @param[in] yesLabel [opt] label to put on the yes button - /// @return Returns True if 'Yes' was pressed, else False - /// - /// - ///------------------------------------------------------------------------- - /// - /// **Example:** - /// ~~~~~~~~~~~~~{.cpp} - /// #include - /// - /// bool canceled; - /// bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput( - /// "Yes / No test call", // The Header - /// "You has opened Yes / No dialog for test", - /// "", - /// "Is this OK for you?", - /// canceled, // return value about cancel button - /// "Not really", // No label, is optional and if empty "No" - /// "Ohhh yes"); // Yes label, also optional and if empty "Yes" - /// fprintf(stderr, "You has called Yes/No, returned '%s' and was %s\n", - /// ret ? "yes" : "no", - /// canceled ? "canceled" : "not canceled"); - /// ~~~~~~~~~~~~~ - /// - inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading, - const std::string& line0, - const std::string& line1, - const std::string& line2, - bool& canceled, - const std::string& noLabel = "", - const std::string& yesLabel = "") - { - using namespace ::kodi::addon; - return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_line_button_text(CAddonBase::m_interface->toKodi->kodiBase, - heading.c_str(), line0.c_str(), line1.c_str(), line2.c_str(), - &canceled, noLabel.c_str(), yesLabel.c_str()); - } - //-------------------------------------------------------------------------- - }; - /// @} - -} /* namespace dialogs */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/CMakeLists.txt deleted file mode 100644 index a9ab70c..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -set(HEADERS GL.h - GLonDX.h - Shader.h) - -if(NOT ENABLE_STATIC_LIBS) - core_add_library(addons_kodi-addon-dev-kit_include_kodi_gui_gl) -endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GL.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GL.h deleted file mode 100644 index 943c7d0..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GL.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2005-2019 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -//============================================================================== -/// -/// \defgroup cpp_kodi_gui_gl OpenGL helpers -/// \ingroup cpp_kodi_gui -/// \brief Auxiliary functions for Open GL -/// -/// This group includes help for definitions, functions, and classes for -/// OpenGL. -/// -/// To use OpenGL for your system, add the \ref GL.h "#include ". -/// -/// -///----------------------------------------------------------------------------- -/// -/// The \ref HAS_GL is declared if Open GL is required and \ref HAS_GLES if Open GL -/// Embedded Systems (ES) is required, with ES the version is additionally given -/// in the definition, this can be "2" or "3". -/// -/// -///----------------------------------------------------------------------------- -/// -/// Following \ref GL_TYPE_STRING define can be used, for example, to manage -/// different folders for GL and GLES and make the selection easier. -/// This are on OpenGL "GL" and on Open GL|ES "GLES". -/// -/// **Example:** -/// ~~~~~~~~~~~~~~~~~{.cpp} -/// kodi::GetAddonPath("resources/shaders/" GL_TYPE_STRING "/frag.glsl"); -/// ~~~~~~~~~~~~~~~~~ -/// -/// -///---------------------------------------------------------------------------- -/// -/// In addition, \ref BUFFER_OFFSET is declared in it which can be used to give an -/// offset on the array to GL. -/// -/// **Example:** -/// ~~~~~~~~~~~~~~~~~{.cpp} -/// const struct PackedVertex { -/// float position[3]; // Position x, y, z -/// float color[4]; // Color r, g, b, a -/// } vertices[3] = { -/// { { -0.5f, -0.5f, 0.0f }, { 1.0f, 0.0f, 0.0f, 1.0f } }, -/// { { 0.5f, -0.5f, 0.0f }, { 0.0f, 1.0f, 0.0f, 1.0f } }, -/// { { 0.0f, 0.5f, 0.0f }, { 0.0f, 0.0f, 1.0f, 1.0f } } -/// }; -/// -/// glVertexAttribPointer(m_aPosition, 3, GL_FLOAT, GL_FALSE, sizeof(PackedVertex), BUFFER_OFFSET(offsetof(PackedVertex, position))); -/// glEnableVertexAttribArray(m_aPosition); -/// -/// glVertexAttribPointer(m_aColor, 4, GL_FLOAT, GL_FALSE, sizeof(PackedVertex), BUFFER_OFFSET(offsetof(PackedVertex, color))); -/// glEnableVertexAttribArray(m_aColor); -/// ~~~~~~~~~~~~~~~~~ - -#if HAS_GL - #define GL_TYPE_STRING "GL" - // always define GL_GLEXT_PROTOTYPES before include gl headers - #if !defined(GL_GLEXT_PROTOTYPES) - #define GL_GLEXT_PROTOTYPES - #endif - #if defined(TARGET_LINUX) - #include - #include - #elif defined(TARGET_FREEBSD) - #include - #elif defined(TARGET_DARWIN) - #include - #include - #elif defined(WIN32) - #error Use of GL under Windows is not possible - #endif -#elif HAS_GLES >= 2 - #define GL_TYPE_STRING "GLES" - #if defined(WIN32) - #if defined(HAS_ANGLE) - #include - #else - #error Use of GLES only be available under Windows by the use of angle - #endif - #elif defined(TARGET_DARWIN) - #if HAS_GLES == 3 - #include - #include - #else - #include - #include - #endif - #else - #if HAS_GLES == 3 - #include - #include - #else - #include - #include - #endif - #endif -#endif - -#ifndef BUFFER_OFFSET -#define BUFFER_OFFSET(i) ((char *)nullptr + (i)) -#endif diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GLonDX.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GLonDX.h deleted file mode 100644 index 7a6a0a1..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GLonDX.h +++ /dev/null @@ -1,369 +0,0 @@ -/* - * Copyright (C) 2005-2019 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -#pragma comment( lib, "d3dcompiler.lib" ) -#ifndef GL_CLIENT_VERSION -#define GL_CLIENT_VERSION 3 -#endif - -namespace kodi -{ -namespace gui -{ -namespace gl -{ - -class ATTRIBUTE_HIDDEN CGLonDX : public kodi::gui::IRenderHelper -{ -public: - explicit CGLonDX() : m_pContext(reinterpret_cast(kodi::gui::GetHWContext())) {} - ~CGLonDX() override { destruct(); } - - bool Init() override - { - EGLint egl_display_attrs[] = - { - EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, - EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, EGL_DONT_CARE, - EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, EGL_DONT_CARE, - EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE, EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE, - EGL_NONE - }; - EGLint egl_config_attrs[] = - { - EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, - EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE, - EGL_RENDERABLE_TYPE, GL_CLIENT_VERSION == 3 ? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT, - EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, - EGL_NONE - }; - EGLint egl_context_attrs[] = - { - EGL_CONTEXT_CLIENT_VERSION, GL_CLIENT_VERSION, EGL_NONE - }; - - m_eglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, egl_display_attrs); - if (m_eglDisplay == EGL_NO_DISPLAY) - { - Log(ADDON_LOG_ERROR, "GLonDX: unable to get EGL display (%s)", eglGetErrorString()); - return false; - } - - if (eglInitialize(m_eglDisplay, nullptr, nullptr) != EGL_TRUE) - { - Log(ADDON_LOG_ERROR, "GLonDX: unable to init EGL display (%s)", eglGetErrorString()); - return false; - } - - EGLint numConfigs = 0; - if (eglChooseConfig(m_eglDisplay, egl_config_attrs, &m_eglConfig, 1, &numConfigs) != EGL_TRUE || numConfigs == 0) - { - Log(ADDON_LOG_ERROR, "GLonDX: unable to get EGL config (%s)", eglGetErrorString()); - return false; - } - - m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, nullptr, egl_context_attrs); - if (m_eglContext == EGL_NO_CONTEXT) - { - Log(ADDON_LOG_ERROR, "GLonDX: unable to create EGL context (%s)", eglGetErrorString()); - return false; - } - - if (!createD3DResources()) - return false; - - if (eglMakeCurrent(m_eglDisplay, m_eglBuffer, m_eglBuffer, m_eglContext) != EGL_TRUE) - { - Log(ADDON_LOG_ERROR, "GLonDX: unable to make current EGL (%s)", eglGetErrorString()); - return false; - } - return true; - } - - void CheckGL(ID3D11DeviceContext* device) - { - if (m_pContext != device) - { - m_pSRView = nullptr; - m_pVShader = nullptr; - m_pPShader = nullptr; - m_pContext = device; - - if (m_eglBuffer != EGL_NO_SURFACE) - { - eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglDestroySurface(m_eglDisplay, m_eglBuffer); - m_eglBuffer = EGL_NO_SURFACE; - } - - // create new resources - if (!createD3DResources()) - return; - - eglMakeCurrent(m_eglDisplay, m_eglBuffer, m_eglBuffer, m_eglContext); - } - } - - void Begin() override - { - // confirm on begin D3D context is correct - CheckGL(reinterpret_cast(kodi::gui::GetHWContext())); - - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - } - - void End() override - { - glFlush(); - - // set our primitive shaders - m_pContext->VSSetShader(m_pVShader.Get(), nullptr, 0); - m_pContext->PSSetShader(m_pPShader.Get(), nullptr, 0); - m_pContext->PSSetShaderResources(0, 1, m_pSRView.GetAddressOf()); - // draw texture - m_pContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); - m_pContext->IASetVertexBuffers(0, 0, nullptr, nullptr, nullptr); - m_pContext->IASetInputLayout(nullptr); - m_pContext->Draw(4, 0); - // unset shaders - m_pContext->PSSetShader(nullptr, nullptr, 0); - m_pContext->VSSetShader(nullptr, nullptr, 0); - // unbind our view - ID3D11ShaderResourceView* views[1] = {}; - m_pContext->PSSetShaderResources(0, 1, views); - } - -private: - enum ShaderType - { - VERTEX_SHADER, - PIXEL_SHADER - }; - - bool createD3DResources() - { - HANDLE sharedHandle; - Microsoft::WRL::ComPtr pDevice; - Microsoft::WRL::ComPtr pRTView; - Microsoft::WRL::ComPtr pRTResource; - Microsoft::WRL::ComPtr pRTTexture; - Microsoft::WRL::ComPtr pOffScreenTexture; - Microsoft::WRL::ComPtr dxgiResource; - - m_pContext->GetDevice(&pDevice); - m_pContext->OMGetRenderTargets(1, &pRTView, nullptr); - if (!pRTView) - return false; - - pRTView->GetResource(&pRTResource); - if (FAILED(pRTResource.As(&pRTTexture))) - return false; - - D3D11_TEXTURE2D_DESC texDesc; - pRTTexture->GetDesc(&texDesc); - texDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; - texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; - texDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; - if (FAILED(pDevice->CreateTexture2D(&texDesc, nullptr, &pOffScreenTexture))) - { - Log(ADDON_LOG_ERROR, "GLonDX: unable to create intermediate texture"); - return false; - } - - CD3D11_SHADER_RESOURCE_VIEW_DESC srvDesc(pOffScreenTexture.Get(), D3D11_SRV_DIMENSION_TEXTURE2D); - if (FAILED(pDevice->CreateShaderResourceView(pOffScreenTexture.Get(), &srvDesc, &m_pSRView))) - { - Log(ADDON_LOG_ERROR, "GLonDX: unable to create shader view"); - return false; - } - - if (FAILED(pOffScreenTexture.As(&dxgiResource)) || - FAILED(dxgiResource->GetSharedHandle(&sharedHandle))) - { - Log(ADDON_LOG_ERROR, "GLonDX: unable get shared handle for texture"); - return false; - } - - // initiate simple shaders - if (FAILED(d3dCreateShader(VERTEX_SHADER, vs_out_shader_text, &m_pVShader))) - { - Log(ADDON_LOG_ERROR, "GLonDX: unable to create vertex shader view"); - return false; - } - - if (FAILED(d3dCreateShader(PIXEL_SHADER, ps_out_shader_text, &m_pPShader))) - { - Log(ADDON_LOG_ERROR, "GLonDX: unable to create pixel shader view"); - return false; - } - - // create EGL buffer from D3D shared texture - EGLint egl_buffer_attrs[] = - { - EGL_WIDTH, static_cast(texDesc.Width), - EGL_HEIGHT, static_cast(texDesc.Height), - EGL_TEXTURE_TARGET, EGL_TEXTURE_2D, - EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA, - EGL_NONE - }; - - m_eglBuffer = eglCreatePbufferFromClientBuffer(m_eglDisplay, - EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, - sharedHandle, m_eglConfig, egl_buffer_attrs); - - if (m_eglBuffer == EGL_NO_SURFACE) - { - Log(ADDON_LOG_ERROR, "GLonDX: unable to create EGL buffer (%s)", eglGetErrorString()); - return false; - } - return true; - } - - HRESULT d3dCreateShader(ShaderType shaderType, const std::string& source, IUnknown** ppShader) const - { - Microsoft::WRL::ComPtr pBlob; - Microsoft::WRL::ComPtr pErrors; - - auto hr = D3DCompile(source.c_str(), source.length(), nullptr, nullptr, nullptr, "main", - shaderType == PIXEL_SHADER ? "ps_4_0" : "vs_4_0", 0, 0, &pBlob, &pErrors); - - if (SUCCEEDED(hr)) - { - Microsoft::WRL::ComPtr pDevice; - m_pContext->GetDevice(&pDevice); - - if (shaderType == PIXEL_SHADER) - { - hr = pDevice->CreatePixelShader(pBlob->GetBufferPointer(), pBlob->GetBufferSize(), nullptr, - reinterpret_cast(ppShader)); - } - else - { - hr = pDevice->CreateVertexShader(pBlob->GetBufferPointer(), pBlob->GetBufferSize(), nullptr, - reinterpret_cast(ppShader)); - } - - if (FAILED(hr)) - { - Log(ADDON_LOG_ERROR, "GLonDX: unable to create %s shader", - shaderType == PIXEL_SHADER ? "pixel" : "vertex"); - } - } - else - { - Log(ADDON_LOG_ERROR, "GLonDX: unable to compile shader (%s)", pErrors->GetBufferPointer()); - } - return hr; - } - - static const char* eglGetErrorString() - { -#define CASE_STR( value ) case value: return #value - switch (eglGetError()) - { - CASE_STR(EGL_SUCCESS); - CASE_STR(EGL_NOT_INITIALIZED); - CASE_STR(EGL_BAD_ACCESS); - CASE_STR(EGL_BAD_ALLOC); - CASE_STR(EGL_BAD_ATTRIBUTE); - CASE_STR(EGL_BAD_CONTEXT); - CASE_STR(EGL_BAD_CONFIG); - CASE_STR(EGL_BAD_CURRENT_SURFACE); - CASE_STR(EGL_BAD_DISPLAY); - CASE_STR(EGL_BAD_SURFACE); - CASE_STR(EGL_BAD_MATCH); - CASE_STR(EGL_BAD_PARAMETER); - CASE_STR(EGL_BAD_NATIVE_PIXMAP); - CASE_STR(EGL_BAD_NATIVE_WINDOW); - CASE_STR(EGL_CONTEXT_LOST); - default: - return "Unknown"; - } -#undef CASE_STR - } - - void destruct() - { - if (m_eglDisplay != EGL_NO_DISPLAY) - { - eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - - if (m_eglBuffer != EGL_NO_SURFACE) - { - eglDestroySurface(m_eglDisplay, m_eglBuffer); - m_eglBuffer = EGL_NO_SURFACE; - } - - if (m_eglContext != EGL_NO_CONTEXT) - { - eglDestroyContext(m_eglDisplay, m_eglContext); - m_eglContext = EGL_NO_CONTEXT; - } - - eglTerminate(m_eglDisplay); - m_eglDisplay = EGL_NO_DISPLAY; - } - - m_pSRView = nullptr; - m_pVShader = nullptr; - m_pPShader = nullptr; - m_pContext = nullptr; - } - - EGLConfig m_eglConfig = EGL_NO_CONFIG_KHR; - EGLDisplay m_eglDisplay = EGL_NO_DISPLAY; - EGLContext m_eglContext = EGL_NO_CONTEXT; - EGLSurface m_eglBuffer = EGL_NO_SURFACE; - - ID3D11DeviceContext* m_pContext = nullptr; // don't hold context - Microsoft::WRL::ComPtr m_pSRView = nullptr; - Microsoft::WRL::ComPtr m_pVShader = nullptr; - Microsoft::WRL::ComPtr m_pPShader = nullptr; - -#define TO_STRING(...) #__VA_ARGS__ - std::string vs_out_shader_text = TO_STRING( - void main(uint id : SV_VertexId, out float2 tex : TEXCOORD0, out float4 pos : SV_POSITION) - { - tex = float2(id % 2, (id % 4) >> 1); - pos = float4((tex.x - 0.5f) * 2, -(tex.y - 0.5f) * 2, 0, 1); - }); - - std::string ps_out_shader_text = TO_STRING( - Texture2D texMain : register(t0); - SamplerState Sampler - { - Filter = MIN_MAG_MIP_LINEAR; - AddressU = CLAMP; - AddressV = CLAMP; - Comparison = NEVER; - }; - - float4 main(in float2 tex : TEXCOORD0) : SV_TARGET - { - return texMain.Sample(Sampler, tex); - }); -#undef TO_STRING -}; /* class CGLonDX */ - -} /* namespace gl */ - -using CRenderHelper = gl::CGLonDX; -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/Shader.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/Shader.h deleted file mode 100644 index 209f274..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/Shader.h +++ /dev/null @@ -1,594 +0,0 @@ -/* - * Copyright (C) 2005-2019 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "GL.h" - -#include -#include -#include - -#include -#include - -#define LOG_SIZE 1024 -#define GLchar char - -namespace kodi -{ -namespace gui -{ -namespace gl -{ - -//======================================================================== -/// CShader - base class -class ATTRIBUTE_HIDDEN CShader -{ -public: - CShader() = default; - virtual ~CShader() = default; - virtual bool Compile(const std::string& extraBegin = "", - const std::string& extraEnd = "") = 0; - virtual void Free() = 0; - virtual GLuint Handle() = 0; - - bool LoadSource(const std::string& file) - { - char buffer[16384]; - - kodi::vfs::CFile source; - if (!source.OpenFile(file)) - { - kodi::Log(ADDON_LOG_ERROR, "CShader::%s: Failed to open file '%s'", __FUNCTION__, file.c_str()); - return false; - } - size_t len = source.Read(buffer, sizeof(buffer)); - m_source.assign(buffer); - m_source[len] = 0; - source.Close(); - return true; - } - - bool OK() const { return m_compiled; } - -protected: - std::string m_source; - std::string m_lastLog; - bool m_compiled = false; -}; -//------------------------------------------------------------------------ - -//======================================================================== -/// CVertexShader -class ATTRIBUTE_HIDDEN CVertexShader : public CShader -{ -public: - CVertexShader() = default; - ~CVertexShader() override { Free(); } - - void Free() override - { - if (m_vertexShader) - glDeleteShader(m_vertexShader); - m_vertexShader = 0; - } - - bool Compile(const std::string& extraBegin = "", - const std::string& extraEnd = "") override - { - GLint params[4]; - - Free(); - - m_vertexShader = glCreateShader(GL_VERTEX_SHADER); - - GLsizei count = 0; - const char *sources[3]; - if (!extraBegin.empty()) - sources[count++] = extraBegin.c_str(); - if (!m_source.empty()) - sources[count++] = m_source.c_str(); - if (!extraEnd.empty()) - sources[count++] = extraEnd.c_str(); - - glShaderSource(m_vertexShader, count, sources, nullptr); - glCompileShader(m_vertexShader); - glGetShaderiv(m_vertexShader, GL_COMPILE_STATUS, params); - if (params[0] != GL_TRUE) - { - GLchar log[LOG_SIZE]; - glGetShaderInfoLog(m_vertexShader, LOG_SIZE, nullptr, log); - kodi::Log(ADDON_LOG_ERROR, "CVertexShader::%s: %s", __FUNCTION__, log); - fprintf(stderr, "CVertexShader::%s: %s\n", __FUNCTION__, log); - m_lastLog = log; - m_compiled = false; - } - else - { - GLchar log[LOG_SIZE]; - glGetShaderInfoLog(m_vertexShader, LOG_SIZE, nullptr, log); - m_lastLog = log; - m_compiled = true; - } - return m_compiled; - } - - GLuint Handle() override { return m_vertexShader; } - -protected: - GLuint m_vertexShader = 0; -}; -//------------------------------------------------------------------------ - -//======================================================================== -/// CPixelShader -class ATTRIBUTE_HIDDEN CPixelShader : public CShader -{ -public: - CPixelShader() = default; - ~CPixelShader() { Free(); } - void Free() override - { - if (m_pixelShader) - glDeleteShader(m_pixelShader); - m_pixelShader = 0; - } - - bool Compile(const std::string& extraBegin = "", - const std::string& extraEnd = "") override - { - GLint params[4]; - - Free(); - - m_pixelShader = glCreateShader(GL_FRAGMENT_SHADER); - - GLsizei count = 0; - const char *sources[3]; - if (!extraBegin.empty()) - sources[count++] = extraBegin.c_str(); - if (!m_source.empty()) - sources[count++] = m_source.c_str(); - if (!extraEnd.empty()) - sources[count++] = extraEnd.c_str(); - - glShaderSource(m_pixelShader, count, sources, 0); - glCompileShader(m_pixelShader); - glGetShaderiv(m_pixelShader, GL_COMPILE_STATUS, params); - if (params[0] != GL_TRUE) - { - GLchar log[LOG_SIZE]; - glGetShaderInfoLog(m_pixelShader, LOG_SIZE, nullptr, log); - kodi::Log(ADDON_LOG_ERROR, "CPixelShader::%s: %s", __FUNCTION__, log); - fprintf(stderr, "CPixelShader::%s: %s\n", __FUNCTION__, log); - m_lastLog = log; - m_compiled = false; - } - else - { - GLchar log[LOG_SIZE]; - glGetShaderInfoLog(m_pixelShader, LOG_SIZE, nullptr, log); - m_lastLog = log; - m_compiled = true; - } - return m_compiled; - } - - GLuint Handle() override { return m_pixelShader; } - -protected: - GLuint m_pixelShader = 0; -}; -//------------------------------------------------------------------------ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_gl_CShaderProgram GL Shader Program -/// \ingroup cpp_kodi_gui_gl -/// @brief \cpp_class{ kodi::gui::gl::CShaderProgram } -/// **Class to manage an OpenGL shader program** -/// -/// With this class the used GL shader code can be defined on the GPU and -/// its variables can be managed between CPU and GPU. -/// -/// It has the header \ref Shader.h "#include " -/// be included to enjoy it. -/// -/// ---------------------------------------------------------------------------- -/// -/// Example: -/// -/// ~~~~~~~~~~~~~{.cpp} -/// -/// #include -/// ... -/// -/// class ATTRIBUTE_HIDDEN CExample -/// : ..., -/// public kodi::gui::gl::CShaderProgram -/// { -/// public: -/// CExample() = default; -/// -/// bool Start(); -/// void Render(); -/// -/// // override functions for kodi::gui::gl::CShaderProgram -/// void OnCompiledAndLinked() override; -/// bool OnEnabled() override; -/// -/// private: -/// ... -/// GLint m_aPosition = -1; -/// GLint m_aColor = -1; -/// }; -/// -/// bool CExample::Start() -/// { -/// // Define shaders and load -/// std::string fraqShader = kodi::GetAddonPath("resources/shaders/" GL_TYPE_STRING "/glsl.frag"); -/// std::string vertShader = kodi::GetAddonPath("resources/shaders/" GL_TYPE_STRING "/glsl.vert"); -/// if (!LoadShaderFiles(vertShader, fraqShader) || !CompileAndLink()) -/// return false; -/// -/// ... -/// return true; -/// } -/// -/// ... -/// -/// void CExample::Render() -/// { -/// ... -/// -/// EnableShader(); -/// ... -/// DO WORK -/// ... -/// DisableShader(); -/// } -/// -/// void CExample::OnCompiledAndLinked() -/// { -/// ... -/// DO YOUR WORK HERE FOR WHAT IS ONE TIME REQUIRED DURING COMPILE OF SHADER, E.G.: -/// -/// m_aPosition = glGetAttribLocation(ProgramHandle(), "a_position"); -/// m_aColor = glGetAttribLocation(ProgramHandle(), "a_color"); -/// } -/// -/// bool OnEnabled() override -/// { -/// ... -/// DO YOUR WORK HERE FOR WHAT REQUIRED DURING ENABLE OF SHADER -/// ... -/// return true; -/// } -/// -/// ADDONCREATOR(CExample); -/// ~~~~~~~~~~~~~ -/// - -//======================================================================== -/// CShaderProgram -class ATTRIBUTE_HIDDEN CShaderProgram -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief Construct a new shader - /// - /// Load must be done later with \ref LoadShaderFiles. - /// - CShaderProgram() = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief Construct a new shader and load defined shader files - /// - /// @param[in] vert Path to used GL vertext shader - /// @param[in] frag Path to used GL fragment shader - /// - CShaderProgram(const std::string& vert, const std::string& frag) - { - LoadShaderFiles(vert, frag); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief Destructor - /// - virtual ~CShaderProgram() - { - ShaderFree(); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief To load manually the needed shader files - /// - /// @param[in] vert Path to used GL vertext shader - /// @param[in] frag Path to used GL fragment shader - /// - /// - /// @note The use of the files is optional, but it must either be passed over - /// here or via \ref CompileAndLink, or both of the source code. - /// - bool LoadShaderFiles(const std::string& vert, const std::string& frag) - { - if (!kodi::vfs::FileExists(vert) || !m_pVP.LoadSource(vert)) - { - kodi::Log(ADDON_LOG_ERROR, "%s: Failed to load '%s'", __func__, vert.c_str()); - return false; - } - - if (!kodi::vfs::FileExists(frag) || !m_pFP.LoadSource(frag)) - { - kodi::Log(ADDON_LOG_ERROR, "%s: Failed to load '%s'", __func__, frag.c_str()); - return false; - } - - return true; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief To compile and link the shader to the GL interface - /// - /// Optionally, additional source code can be transferred here, or it can be - /// used independently without any files - /// - /// @param[in] vertexExtraBegin [opt] To additionally add vextex source - /// code to the beginning of the loaded file - /// source code - /// @param[in] vertexExtraEnd [opt] To additionally add vextex source - /// code to the end of the loaded file - /// source code - /// @param[in] fragmentExtraBegin [opt] To additionally add fragment source - /// code to the beginning of the loaded file - /// source code - /// @param[in] fragmentExtraEnd [opt] To additionally add fragment source - /// code to the end of the loaded file - /// source code - /// @return true if compile was successed - /// - /// - /// @note In the case of a compile error, it will be written once into the Kodi - /// log and in addition to the console output to quickly detect the errors when - /// writing the damage. - /// - /// - bool CompileAndLink(const std::string& vertexExtraBegin = "", - const std::string& vertexExtraEnd = "", - const std::string& fragmentExtraBegin = "", - const std::string& fragmentExtraEnd = "") - { - GLint params[4]; - - // free resources - ShaderFree(); - m_ok = false; - - // compiled vertex shader - if (!m_pVP.Compile(vertexExtraBegin, vertexExtraEnd)) - { - kodi::Log(ADDON_LOG_ERROR, "GL: Error compiling vertex shader"); - return false; - } - - // compile pixel shader - if (!m_pFP.Compile(fragmentExtraBegin, fragmentExtraEnd)) - { - m_pVP.Free(); - kodi::Log(ADDON_LOG_ERROR, "GL: Error compiling fragment shader"); - return false; - } - - // create program object - m_shaderProgram = glCreateProgram(); - if (!m_shaderProgram) - { - kodi::Log(ADDON_LOG_ERROR, "CShaderProgram::%s: Failed to create GL program", __FUNCTION__); - ShaderFree(); - return false; - } - - // attach the vertex shader - glAttachShader(m_shaderProgram, m_pVP.Handle()); - glAttachShader(m_shaderProgram, m_pFP.Handle()); - - // link the program - glLinkProgram(m_shaderProgram); - glGetProgramiv(m_shaderProgram, GL_LINK_STATUS, params); - if (params[0] != GL_TRUE) - { - GLchar log[LOG_SIZE]; - glGetProgramInfoLog(m_shaderProgram, LOG_SIZE, nullptr, log); - kodi::Log(ADDON_LOG_ERROR, "CShaderProgram::%s: %s", __FUNCTION__, log); - fprintf(stderr, "CShaderProgram::%s: %s\n", __FUNCTION__, log); - ShaderFree(); - return false; - } - - m_validated = false; - m_ok = true; - OnCompiledAndLinked(); - return true; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief To activate the shader and use it on the GPU - /// - /// @return true if enable was successfull done - /// - /// - /// @note During this call, the \ref OnEnabled stored in the child is also - /// called - /// - bool EnableShader() - { - if (ShaderOK()) - { - glUseProgram(m_shaderProgram); - if (OnEnabled()) - { - if (!m_validated) - { - // validate the program - GLint params[4]; - glValidateProgram(m_shaderProgram); - glGetProgramiv(m_shaderProgram, GL_VALIDATE_STATUS, params); - if (params[0] != GL_TRUE) - { - GLchar log[LOG_SIZE]; - glGetProgramInfoLog(m_shaderProgram, LOG_SIZE, nullptr, log); - kodi::Log(ADDON_LOG_ERROR, "CShaderProgram::%s: %s", __FUNCTION__, log); - fprintf(stderr, "CShaderProgram::%s: %s\n", __FUNCTION__, log); - } - m_validated = true; - } - return true; - } - else - { - glUseProgram(0); - return false; - } - return true; - } - return false; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief To deactivate the shader use on the GPU - /// - void DisableShader() - { - if (ShaderOK()) - { - glUseProgram(0); - OnDisabled(); - } - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief Used to check if shader has been loaded before. - /// - /// @return true if enable was successfull done - /// - /// @note The CompileAndLink call sets these values - /// - ATTRIBUTE_FORCEINLINE bool ShaderOK() const { return m_ok; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief To get the vertex shader class used by Kodi at the addon - /// - /// @return pointer to vertex shader class - /// - ATTRIBUTE_FORCEINLINE CVertexShader& VertexShader() { return m_pVP; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief To get the fragment shader class used by Kodi at the addon - /// - /// @return pointer to fragment shader class - /// - ATTRIBUTE_FORCEINLINE CPixelShader& PixelShader() { return m_pFP; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief Used to get the definition created in the OpenGL itself - /// - /// @return GLuint of GL shader program handler - /// - ATTRIBUTE_FORCEINLINE GLuint ProgramHandle() { return m_shaderProgram; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \defgroup cpp_kodi_gui_gl_CShaderProgram_child Child Functions - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief \cpp_class{ kodi::gui::gl::CShaderProgram child functions } - /// - /// Functions that are added by parent in the child - //@{ - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram_child - /// @brief Mandatory child function to set the necessary CPU to GPU data - /// - virtual void OnCompiledAndLinked() {}; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram_child - /// @brief Optional function to exchange data between CPU and GPU while - /// activating the shader - /// - /// @return true if enable was successfull done - /// - virtual bool OnEnabled() { return true; }; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram_child - /// @brief Optional child function that may have to be performed when - /// switching off the shader - virtual void OnDisabled() {}; - //-------------------------------------------------------------------------- - //@} - -private: - void ShaderFree() - { - if (m_shaderProgram) - glDeleteProgram(m_shaderProgram); - m_shaderProgram = 0; - m_ok = false; - } - - CVertexShader m_pVP; - CPixelShader m_pFP; - GLuint m_shaderProgram = 0; - bool m_ok = false; - bool m_validated = false; -}; -//------------------------------------------------------------------------ - -} /* namespace gl */ -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/renderHelper.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/renderHelper.h deleted file mode 100644 index 2e96d21..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/renderHelper.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2005-2019 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../AddonBase.h" - -namespace kodi -{ -namespace gui -{ -struct ATTRIBUTE_HIDDEN IRenderHelper -{ - virtual ~IRenderHelper() = default; - virtual bool Init() = 0; - virtual void Begin() = 0; - virtual void End() = 0; -}; /* class IRenderHelper */ -} /* namespace gui */ -} /* namespace kodi */ - -#if defined(WIN32) && defined(HAS_ANGLE) -#include "gl/GLonDX.h" -#else -/* - * Default background GUI render helper class - */ -namespace kodi -{ -namespace gui -{ -struct ATTRIBUTE_HIDDEN CRenderHelperStub : public IRenderHelper -{ - bool Init() override { return true; } - void Begin() override { } - void End() override { } -}; /* class CRenderHelperStub */ - -using CRenderHelper = CRenderHelperStub; -} /* namespace gui */ -} /* namespace kodi */ -#endif - -namespace kodi -{ -namespace gui -{ - -/* - * Create render background handler, e.g. becomes on "Windows" Angle used - * to emulate GL. - * - * This only be used internal and not from addon's direct. - * - * Function defines here and not in CAddonBase because of a hen and egg problem. - */ -inline std::shared_ptr ATTRIBUTE_HIDDEN GetRenderHelper() -{ - using namespace ::kodi::addon; - if (static_cast(CAddonBase::m_interface->addonBase)->m_renderHelper) - return static_cast(CAddonBase::m_interface->addonBase)->m_renderHelper; - - const std::shared_ptr renderHelper(new CRenderHelper()); - if (!renderHelper->Init()) - return nullptr; - - static_cast(CAddonBase::m_interface->addonBase)->m_renderHelper = - renderHelper; // Hold on base for other types - return renderHelper; -} - -} /* namespace gui */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/platform/android/System.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/platform/android/System.h deleted file mode 100644 index ef2d728..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/platform/android/System.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "../../AddonBase.h" - -/* - * For interface between add-on and kodi. - * - * This structure defines the addresses of functions stored inside Kodi which - * are then available for the add-on to call - * - * All function pointers there are used by the C++ interface functions below. - * You find the set of them on xbmc/addons/interfaces/General.cpp - * - * Note: For add-on development itself this is not needed - */ - -static const char* INTERFACE_ANDROID_SYSTEM_NAME = "ANDROID_SYSTEM"; -static const char* INTERFACE_ANDROID_SYSTEM_VERSION = "1.0.1"; -static const char* INTERFACE_ANDROID_SYSTEM_VERSION_MIN = "1.0.1"; - -struct AddonToKodiFuncTable_android_system -{ - void* (*get_jni_env)(); - int (*get_sdk_version)(); - const char *(*get_class_name)(); -}; - -//============================================================================== -/// -/// \defgroup cpp_kodi_platform Interface - kodi::platform -/// \ingroup cpp -/// @brief **Android platform specific functions** -/// -/// #include " -/// -//------------------------------------------------------------------------------ - -namespace kodi -{ -namespace platform -{ -class ATTRIBUTE_HIDDEN CInterfaceAndroidSystem -{ -public: - CInterfaceAndroidSystem() - : m_interface(static_cast( - GetInterface(INTERFACE_ANDROID_SYSTEM_NAME, INTERFACE_ANDROID_SYSTEM_VERSION))){}; - - //============================================================================ - /// - /// \ingroup cpp_kodi_platform - /// @brief request an JNI env pointer for the calling thread. - /// JNI env has to be controlled by kodi because of the underlying - /// threading concep. - /// - /// @param[in]: - /// @return JNI env pointer for the calling thread - /// - inline void* GetJNIEnv() - { - if (m_interface) - return m_interface->get_jni_env(); - - return nullptr; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// - /// \ingroup cpp_kodi_platform - /// @brief request the android sdk version to e.g. initialize JNIBase. - /// - /// @param[in]: - /// @return Android SDK version - /// - inline int GetSDKVersion() - { - if (m_interface) - return m_interface->get_sdk_version(); - - return 0; - } - - //============================================================================ - /// - /// \ingroup cpp_kodi_platform - /// @brief request the android main class name e.g. org.xbmc.kodi. - /// - /// @param[in]: - /// @return package class name - /// - inline std::string GetClassName() - { - if (m_interface) - return m_interface->get_class_name(); - - return std::string(); - } - -private: - AddonToKodiFuncTable_android_system* m_interface; -}; -//---------------------------------------------------------------------------- - -} /* namespace platform */ -} /* namespace kodi */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/CMakeLists.txt deleted file mode 100644 index 939585c..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(HEADERS DllHelper.h ) - -if(NOT ENABLE_STATIC_LIBS) - core_add_library(addons_kodi-addon-dev-kit_include_kodi_tools) -endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/DllHelper.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/DllHelper.h deleted file mode 100644 index 3cc9eea..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/DllHelper.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#ifdef __cplusplus - -#include - -#include -#include -#include - -//============================================================================== -/// @ingroup cpp_kodi_tools_CDllHelper -/// @brief Macro to translate the given pointer value name of functions to -/// requested function name. -/// -/// @note This should always be used and does the work of -/// @ref kodi::tools::CDllHelper::RegisterSymbol(). -/// -#define REGISTER_DLL_SYMBOL(functionPtr) \ - kodi::tools::CDllHelper::RegisterSymbol(functionPtr, #functionPtr) -//------------------------------------------------------------------------------ - -namespace kodi -{ -namespace tools -{ - -//============================================================================== -/// @defgroup cpp_kodi_tools_CDllHelper class CDllHelper -/// @ingroup cpp_kodi_tools -/// @brief **Class to help with load of shared library functions**\n -/// You can add them as parent to your class and to help with load of shared -/// library functions. -/// -/// @note To use on Windows must you also include [dlfcn-win32](https://github.com/dlfcn-win32/dlfcn-win32) -/// on your addon!\n\n -/// Furthermore, this allows the use of Android where the required library is -/// copied to an EXE useable folder. -/// -/// -/// ---------------------------------------------------------------------------- -/// -/// **Example:** -/// ~~~~~~~~~~~~~{.cpp} -/// -/// #include -/// -/// ... -/// class CMyInstance : public kodi::addon::CInstanceAudioDecoder, -/// private kodi::tools::CDllHelper -/// { -/// public: -/// CMyInstance(KODI_HANDLE instance, const std::string& kodiVersion); -/// bool Start(); -/// -/// ... -/// -/// // The pointers for on shared library exported functions -/// int (*Init)(); -/// void (*Cleanup)(); -/// int (*GetLength)(); -/// }; -/// -/// CMyInstance::CMyInstance(KODI_HANDLE instance, const std::string& kodiVersion) -/// : CInstanceAudioDecoder(instance, kodiVersion) -/// { -/// } -/// -/// bool CMyInstance::Start() -/// { -/// std::string lib = kodi::GetAddonPath("myLib.so"); -/// if (!LoadDll(lib)) return false; -/// if (!REGISTER_DLL_SYMBOL(Init)) return false; -/// if (!REGISTER_DLL_SYMBOL(Cleanup)) return false; -/// if (!REGISTER_DLL_SYMBOL(GetLength)) return false; -/// -/// Init(); -/// return true; -/// } -/// ... -/// ~~~~~~~~~~~~~ -/// -///@{ -class ATTRIBUTE_HIDDEN CDllHelper -{ -public: - //============================================================================ - /// @ingroup cpp_kodi_tools_CDllHelper - /// @brief Class constructor. - /// - CDllHelper() = default; - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_tools_CDllHelper - /// @brief Class destructor. - /// - virtual ~CDllHelper() - { - if (m_dll) - dlclose(m_dll); - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_tools_CDllHelper - /// @brief Function to load requested library. - /// - /// @param[in] path The path with filename of shared library to load - /// @return true if load was successful done - /// - bool LoadDll(std::string path) - { -#if defined(TARGET_ANDROID) - if (kodi::vfs::FileExists(path)) - { - // Check already defined for "xbmcaltbinaddons", if yes no copy necassary. - std::string xbmcaltbinaddons = - kodi::vfs::TranslateSpecialProtocol("special://xbmcaltbinaddons/"); - if (path.compare(0, xbmcaltbinaddons.length(), xbmcaltbinaddons) != 0) - { - bool doCopy = true; - std::string dstfile = xbmcaltbinaddons + kodi::vfs::GetFileName(path); - - kodi::vfs::FileStatus dstFileStat; - if (kodi::vfs::StatFile(dstfile, dstFileStat)) - { - kodi::vfs::FileStatus srcFileStat; - if (kodi::vfs::StatFile(path, srcFileStat)) - { - if (dstFileStat.GetSize() == srcFileStat.GetSize() && - dstFileStat.GetModificationTime() > srcFileStat.GetModificationTime()) - doCopy = false; - } - } - - if (doCopy) - { - kodi::Log(ADDON_LOG_DEBUG, "Caching '%s' to '%s'", path.c_str(), dstfile.c_str()); - if (!kodi::vfs::CopyFile(path, dstfile)) - { - kodi::Log(ADDON_LOG_ERROR, "Failed to cache '%s' to '%s'", path.c_str(), - dstfile.c_str()); - return false; - } - } - - path = dstfile; - } - } - else - { - return false; - } -#endif - - m_dll = dlopen(path.c_str(), RTLD_LAZY); - if (m_dll == nullptr) - { - kodi::Log(ADDON_LOG_ERROR, "Unable to load %s", dlerror()); - return false; - } - return true; - } - //---------------------------------------------------------------------------- - - //============================================================================ - /// @ingroup cpp_kodi_tools_CDllHelper - /// @brief Function to register requested library symbol. - /// - /// @warning This function should not be used, use instead the macro - /// @ref REGISTER_DLL_SYMBOL to register the symbol pointer. - /// - /// - /// Use this always via Macro, e.g.: - /// ~~~~~~~~~~~~~{.cpp} - /// if (!REGISTER_DLL_SYMBOL(Init)) - /// return false; - /// ~~~~~~~~~~~~~ - /// - template - bool RegisterSymbol(T& functionPtr, const char* strFunctionPtr) - { - functionPtr = reinterpret_cast(dlsym(m_dll, strFunctionPtr)); - if (functionPtr == nullptr) - { - kodi::Log(ADDON_LOG_ERROR, "Unable to assign function %s", dlerror()); - return false; - } - return true; - } - //---------------------------------------------------------------------------- - -private: - void* m_dll = nullptr; -}; -///@} -//------------------------------------------------------------------------------ - -} /* namespace tools */ -} /* namespace kodi */ - -#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h deleted file mode 100644 index 041e22b..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h +++ /dev/null @@ -1,482 +0,0 @@ -/* - * Copyright (C) 2016-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include - -#define STR_HELPER(x) #x -#define STR(x) STR_HELPER(x) - -/* - *------------------------------------------------------------------------------ - * Some parts on headers are only be used for Kodi itself and internally (not - * for add-on development). - * - * For this reason also no doxygen part with "///" defined there. - * ----------------------------------------------------------------------------- - */ - -/* - * Versions of all add-on globals and instances are defined below. - * - * This is added here and not in related header to prevent not - * needed includes during compile. Also have it here a better - * overview. - */ - -// Ignore clang here, as this must be good in overview and as the main reason, -// because cmake uses this area in this form to perform its addon dependency -// check. -// clang-format off -#define ADDON_GLOBAL_VERSION_MAIN "1.2.4" -#define ADDON_GLOBAL_VERSION_MAIN_MIN "1.2.0" -#define ADDON_GLOBAL_VERSION_MAIN_XML_ID "kodi.binary.global.main" -#define ADDON_GLOBAL_VERSION_MAIN_DEPENDS "AddonBase.h" \ - "addon-instance/" \ - "c-api/addon_base.h" - -#define ADDON_GLOBAL_VERSION_GENERAL "1.0.5" -#define ADDON_GLOBAL_VERSION_GENERAL_MIN "1.0.4" -#define ADDON_GLOBAL_VERSION_GENERAL_XML_ID "kodi.binary.global.general" -#define ADDON_GLOBAL_VERSION_GENERAL_DEPENDS "General.h" - -#define ADDON_GLOBAL_VERSION_GUI "5.14.1" -#define ADDON_GLOBAL_VERSION_GUI_MIN "5.14.0" -#define ADDON_GLOBAL_VERSION_GUI_XML_ID "kodi.binary.global.gui" -#define ADDON_GLOBAL_VERSION_GUI_DEPENDS "ActionIDs.h" \ - "gui/" - -#define ADDON_GLOBAL_VERSION_AUDIOENGINE "1.1.1" -#define ADDON_GLOBAL_VERSION_AUDIOENGINE_MIN "1.1.0" -#define ADDON_GLOBAL_VERSION_AUDIOENGINE_XML_ID "kodi.binary.global.audioengine" -#define ADDON_GLOBAL_VERSION_AUDIOENGINE_DEPENDS "AudioEngine.h" \ - "c-api/audio_engine.h" - -#define ADDON_GLOBAL_VERSION_FILESYSTEM "1.1.4" -#define ADDON_GLOBAL_VERSION_FILESYSTEM_MIN "1.1.0" -#define ADDON_GLOBAL_VERSION_FILESYSTEM_XML_ID "kodi.binary.global.filesystem" -#define ADDON_GLOBAL_VERSION_FILESYSTEM_DEPENDS "Filesystem.h" \ - "c-api/filesystem.h" \ - "gui/gl/Shader.h" \ - "tools/DllHelper.h" - -#define ADDON_GLOBAL_VERSION_NETWORK "1.0.4" -#define ADDON_GLOBAL_VERSION_NETWORK_MIN "1.0.0" -#define ADDON_GLOBAL_VERSION_NETWORK_XML_ID "kodi.binary.global.network" -#define ADDON_GLOBAL_VERSION_NETWORK_DEPENDS "Network.h" \ - "c-api/network.h" - -#define ADDON_GLOBAL_VERSION_TOOLS "1.0.1" -#define ADDON_GLOBAL_VERSION_TOOLS_MIN "1.0.0" -#define ADDON_GLOBAL_VERSION_TOOLS_XML_ID "kodi.binary.global.tools" -#define ADDON_GLOBAL_VERSION_TOOLS_DEPENDS "tools/DllHelper.h" - -#define ADDON_INSTANCE_VERSION_AUDIODECODER "2.0.2" -#define ADDON_INSTANCE_VERSION_AUDIODECODER_MIN "2.0.1" -#define ADDON_INSTANCE_VERSION_AUDIODECODER_XML_ID "kodi.binary.instance.audiodecoder" -#define ADDON_INSTANCE_VERSION_AUDIODECODER_DEPENDS "addon-instance/AudioDecoder.h" - -#define ADDON_INSTANCE_VERSION_AUDIOENCODER "2.0.2" -#define ADDON_INSTANCE_VERSION_AUDIOENCODER_MIN "2.0.1" -#define ADDON_INSTANCE_VERSION_AUDIOENCODER_XML_ID "kodi.binary.instance.audioencoder" -#define ADDON_INSTANCE_VERSION_AUDIOENCODER_DEPENDS "addon-instance/AudioEncoder.h" - -#define ADDON_INSTANCE_VERSION_GAME "2.0.2" -#define ADDON_INSTANCE_VERSION_GAME_MIN "2.0.1" -#define ADDON_INSTANCE_VERSION_GAME_XML_ID "kodi.binary.instance.game" -#define ADDON_INSTANCE_VERSION_GAME_DEPENDS "addon-instance/Game.h" - -#define ADDON_INSTANCE_VERSION_IMAGEDECODER "2.1.1" -#define ADDON_INSTANCE_VERSION_IMAGEDECODER_MIN "2.1.0" -#define ADDON_INSTANCE_VERSION_IMAGEDECODER_XML_ID "kodi.binary.instance.imagedecoder" -#define ADDON_INSTANCE_VERSION_IMAGEDECODER_DEPENDS "addon-instance/ImageDecoder.h" - -#define ADDON_INSTANCE_VERSION_INPUTSTREAM "2.3.3" -#define ADDON_INSTANCE_VERSION_INPUTSTREAM_MIN "2.3.1" -#define ADDON_INSTANCE_VERSION_INPUTSTREAM_XML_ID "kodi.binary.instance.inputstream" -#define ADDON_INSTANCE_VERSION_INPUTSTREAM_DEPENDS "addon-instance/Inputstream.h" - -#define ADDON_INSTANCE_VERSION_PERIPHERAL "1.3.9" -#define ADDON_INSTANCE_VERSION_PERIPHERAL_MIN "1.3.8" -#define ADDON_INSTANCE_VERSION_PERIPHERAL_XML_ID "kodi.binary.instance.peripheral" -#define ADDON_INSTANCE_VERSION_PERIPHERAL_DEPENDS "addon-instance/Peripheral.h" \ - "addon-instance/PeripheralUtils.h" - -#define ADDON_INSTANCE_VERSION_PVR "7.0.1" -#define ADDON_INSTANCE_VERSION_PVR_MIN "7.0.0" -#define ADDON_INSTANCE_VERSION_PVR_XML_ID "kodi.binary.instance.pvr" -#define ADDON_INSTANCE_VERSION_PVR_DEPENDS "c-api/addon-instance/pvr.h" \ - "c-api/addon-instance/pvr/pvr_channel_groups.h" \ - "c-api/addon-instance/pvr/pvr_channels.h" \ - "c-api/addon-instance/pvr/pvr_defines.h" \ - "c-api/addon-instance/pvr/pvr_edl.h" \ - "c-api/addon-instance/pvr/pvr_epg.h" \ - "c-api/addon-instance/pvr/pvr_general.h" \ - "c-api/addon-instance/pvr/pvr_menu_hook.h" \ - "c-api/addon-instance/pvr/pvr_recordings.h" \ - "c-api/addon-instance/pvr/pvr_stream.h" \ - "c-api/addon-instance/pvr/pvr_timers.h" \ - "addon-instance/PVR.h" \ - "addon-instance/pvr/ChannelGroups.h" \ - "addon-instance/pvr/Channels.h" \ - "addon-instance/pvr/EDL.h" \ - "addon-instance/pvr/EPG.h" \ - "addon-instance/pvr/General.h" \ - "addon-instance/pvr/MenuHook.h" \ - "addon-instance/pvr/Recordings.h" \ - "addon-instance/pvr/Stream.h" \ - "addon-instance/pvr/Timers.h" - -#define ADDON_INSTANCE_VERSION_SCREENSAVER "2.0.2" -#define ADDON_INSTANCE_VERSION_SCREENSAVER_MIN "2.0.1" -#define ADDON_INSTANCE_VERSION_SCREENSAVER_XML_ID "kodi.binary.instance.screensaver" -#define ADDON_INSTANCE_VERSION_SCREENSAVER_DEPENDS "addon-instance/Screensaver.h" - -#define ADDON_INSTANCE_VERSION_VFS "2.3.2" -#define ADDON_INSTANCE_VERSION_VFS_MIN "2.3.1" -#define ADDON_INSTANCE_VERSION_VFS_XML_ID "kodi.binary.instance.vfs" -#define ADDON_INSTANCE_VERSION_VFS_DEPENDS "addon-instance/VFS.h" - -#define ADDON_INSTANCE_VERSION_VISUALIZATION "2.0.4" -#define ADDON_INSTANCE_VERSION_VISUALIZATION_MIN "2.0.3" -#define ADDON_INSTANCE_VERSION_VISUALIZATION_XML_ID "kodi.binary.instance.visualization" -#define ADDON_INSTANCE_VERSION_VISUALIZATION_DEPENDS "addon-instance/Visualization.h" - -#define ADDON_INSTANCE_VERSION_VIDEOCODEC "1.0.3" -#define ADDON_INSTANCE_VERSION_VIDEOCODEC_MIN "1.0.2" -#define ADDON_INSTANCE_VERSION_VIDEOCODEC_XML_ID "kodi.binary.instance.videocodec" -#define ADDON_INSTANCE_VERSION_VIDEOCODEC_DEPENDS "addon-instance/VideoCodec.h" \ - "StreamCodec.h" \ - "StreamCrypto.h" -// clang-format on - -//============================================================================== -/// -/// @ingroup cpp_kodi_addon_addonbase -/// The currently available instance types for Kodi add-ons -/// -/// \internal -/// @note For add of new types take a new number on end. To change -/// existing numbers can be make problems on already compiled add-ons. -/// \endinternal -/// -typedef enum ADDON_TYPE -{ - /* addon global parts */ - ADDON_GLOBAL_MAIN = 0, - ADDON_GLOBAL_GUI = 1, - ADDON_GLOBAL_AUDIOENGINE = 2, - ADDON_GLOBAL_GENERAL = 3, - ADDON_GLOBAL_NETWORK = 4, - ADDON_GLOBAL_FILESYSTEM = 5, - ADDON_GLOBAL_TOOLS = 6, - // Last used global id, used in loops to check versions. - // Need to change if new global type becomes added! - ADDON_GLOBAL_MAX = 6, - - /* addon type instances */ - - /// Audio decoder instance, see \ref cpp_kodi_addon_audiodecoder "kodi::addon::CInstanceAudioDecoder" - ADDON_INSTANCE_AUDIODECODER = 102, - - /// Audio encoder instance, see \ref cpp_kodi_addon_audioencoder "kodi::addon::CInstanceAudioEncoder" - ADDON_INSTANCE_AUDIOENCODER = 103, - - /// Game instance, see \ref cpp_kodi_addon_game "kodi::addon::CInstanceGame" - ADDON_INSTANCE_GAME = 104, - - /// Input stream instance, see \ref cpp_kodi_addon_inputstream "kodi::addon::CInstanceInputStream" - ADDON_INSTANCE_INPUTSTREAM = 105, - - /// Peripheral instance, see \ref cpp_kodi_addon_peripheral "kodi::addon::CInstancePeripheral" - ADDON_INSTANCE_PERIPHERAL = 106, - - /// Game instance, see \ref cpp_kodi_addon_pvr "kodi::addon::CInstancePVRClient" - ADDON_INSTANCE_PVR = 107, - - /// PVR client instance, see \ref cpp_kodi_addon_screensaver "kodi::addon::CInstanceScreensaver" - ADDON_INSTANCE_SCREENSAVER = 108, - - /// Music visualization instance, see \ref cpp_kodi_addon_visualization "kodi::addon::CInstanceVisualization" - ADDON_INSTANCE_VISUALIZATION = 109, - - /// Virtual Filesystem (VFS) instance, see \ref cpp_kodi_addon_vfs "kodi::addon::CInstanceVFS" - ADDON_INSTANCE_VFS = 110, - - /// Image Decoder instance, see \ref cpp_kodi_addon_imagedecoder "kodi::addon::CInstanceImageDecoder" - ADDON_INSTANCE_IMAGEDECODER = 111, - - /// Video Decoder instance, see \ref cpp_kodi_addon_videocodec "kodi::addon::CInstanceVideoCodec" - ADDON_INSTANCE_VIDEOCODEC = 112, -} ADDON_TYPE; -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -extern "C" { -namespace kodi { -namespace addon { -#endif - -/// -/// This is used from Kodi to get the active version of add-on parts. -/// It is compiled in add-on and also in Kodi itself, with this can be Kodi -/// compare the version from him with them on add-on. -/// -/// @param[in] type The with 'enum ADDON_TYPE' type to ask -/// @return version The current version of asked type -/// -inline const char* GetTypeVersion(int type) -{ - /* - * #ifdef's below becomes set by cmake, no set by hand needed. - */ - switch (type) - { - /* addon global parts */ - case ADDON_GLOBAL_MAIN: - return ADDON_GLOBAL_VERSION_MAIN; -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_GENERAL_USED) - case ADDON_GLOBAL_GENERAL: - return ADDON_GLOBAL_VERSION_GENERAL; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_GUI_USED) - case ADDON_GLOBAL_GUI: - return ADDON_GLOBAL_VERSION_GUI; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_AUDIOENGINE_USED) - case ADDON_GLOBAL_AUDIOENGINE: - return ADDON_GLOBAL_VERSION_AUDIOENGINE; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_FILESYSTEM_USED) - case ADDON_GLOBAL_FILESYSTEM: - return ADDON_GLOBAL_VERSION_FILESYSTEM; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_NETWORK_USED) - case ADDON_GLOBAL_NETWORK: - return ADDON_GLOBAL_VERSION_NETWORK; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_TOOLS_USED) - case ADDON_GLOBAL_TOOLS: - return ADDON_GLOBAL_VERSION_TOOLS; -#endif - - /* addon type instances */ -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_AUDIODECODER_USED) - case ADDON_INSTANCE_AUDIODECODER: - return ADDON_INSTANCE_VERSION_AUDIODECODER; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_AUDIOENCODER_USED) - case ADDON_INSTANCE_AUDIOENCODER: - return ADDON_INSTANCE_VERSION_AUDIOENCODER; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_GAME_USED) - case ADDON_INSTANCE_GAME: - return ADDON_INSTANCE_VERSION_GAME; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_IMAGEDECODER_USED) - case ADDON_INSTANCE_IMAGEDECODER: - return ADDON_INSTANCE_VERSION_IMAGEDECODER; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_INPUTSTREAM_USED) - case ADDON_INSTANCE_INPUTSTREAM: - return ADDON_INSTANCE_VERSION_INPUTSTREAM; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_PERIPHERAL_USED) - case ADDON_INSTANCE_PERIPHERAL: - return ADDON_INSTANCE_VERSION_PERIPHERAL; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_PVR_USED) - case ADDON_INSTANCE_PVR: - return ADDON_INSTANCE_VERSION_PVR; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_SCREENSAVER_USED) - case ADDON_INSTANCE_SCREENSAVER: - return ADDON_INSTANCE_VERSION_SCREENSAVER; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_VFS_USED) - case ADDON_INSTANCE_VFS: - return ADDON_INSTANCE_VERSION_VFS; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_VISUALIZATION_USED) - case ADDON_INSTANCE_VISUALIZATION: - return ADDON_INSTANCE_VERSION_VISUALIZATION; -#endif -#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_VIDEOCODEC_USED) - case ADDON_INSTANCE_VIDEOCODEC: - return ADDON_INSTANCE_VERSION_VIDEOCODEC; -#endif - } - return "0.0.0"; -} - -/// -/// This is used from Kodi to get the minimum supported version of add-on parts. -/// It is compiled in add-on and also in Kodi itself, with this can be Kodi -/// compare the version from him with them on add-on. -/// -/// @param[in] type The with 'enum ADDON_TYPE' type to ask -/// @return version The minimum version of asked type -/// -inline const char* GetTypeMinVersion(int type) -{ - switch (type) - { - /* addon global parts */ - case ADDON_GLOBAL_MAIN: - return ADDON_GLOBAL_VERSION_MAIN_MIN; - case ADDON_GLOBAL_GUI: - return ADDON_GLOBAL_VERSION_GUI_MIN; - case ADDON_GLOBAL_GENERAL: - return ADDON_GLOBAL_VERSION_GENERAL_MIN; - case ADDON_GLOBAL_AUDIOENGINE: - return ADDON_GLOBAL_VERSION_AUDIOENGINE_MIN; - case ADDON_GLOBAL_FILESYSTEM: - return ADDON_GLOBAL_VERSION_FILESYSTEM_MIN; - case ADDON_GLOBAL_NETWORK: - return ADDON_GLOBAL_VERSION_NETWORK_MIN; - case ADDON_GLOBAL_TOOLS: - return ADDON_GLOBAL_VERSION_TOOLS_MIN; - - /* addon type instances */ - case ADDON_INSTANCE_AUDIODECODER: - return ADDON_INSTANCE_VERSION_AUDIODECODER_MIN; - case ADDON_INSTANCE_AUDIOENCODER: - return ADDON_INSTANCE_VERSION_AUDIOENCODER_MIN; - case ADDON_INSTANCE_GAME: - return ADDON_INSTANCE_VERSION_GAME_MIN; - case ADDON_INSTANCE_IMAGEDECODER: - return ADDON_INSTANCE_VERSION_IMAGEDECODER_MIN; - case ADDON_INSTANCE_INPUTSTREAM: - return ADDON_INSTANCE_VERSION_INPUTSTREAM_MIN; - case ADDON_INSTANCE_PERIPHERAL: - return ADDON_INSTANCE_VERSION_PERIPHERAL_MIN; - case ADDON_INSTANCE_PVR: - return ADDON_INSTANCE_VERSION_PVR_MIN; - case ADDON_INSTANCE_SCREENSAVER: - return ADDON_INSTANCE_VERSION_SCREENSAVER_MIN; - case ADDON_INSTANCE_VFS: - return ADDON_INSTANCE_VERSION_VFS_MIN; - case ADDON_INSTANCE_VISUALIZATION: - return ADDON_INSTANCE_VERSION_VISUALIZATION_MIN; - case ADDON_INSTANCE_VIDEOCODEC: - return ADDON_INSTANCE_VERSION_VIDEOCODEC_MIN; - } - return "0.0.0"; -} - -/// -/// Function used internally on add-on and in Kodi itself to get name -/// about given type. -/// -/// @param[in] type The with 'enum ADDON_TYPE' defined type to ask -/// @return Name of the asked instance type -/// -inline const char* GetTypeName(int type) -{ - switch (type) - { - /* addon global parts */ - case ADDON_GLOBAL_MAIN: - return "Addon"; - case ADDON_GLOBAL_GUI: - return "GUI"; - case ADDON_GLOBAL_GENERAL: - return "General"; - case ADDON_GLOBAL_AUDIOENGINE: - return "AudioEngine"; - case ADDON_GLOBAL_FILESYSTEM: - return "Filesystem"; - case ADDON_GLOBAL_NETWORK: - return "Network"; - case ADDON_GLOBAL_TOOLS: - return "Tools"; - - /* addon type instances */ - case ADDON_INSTANCE_AUDIODECODER: - return "AudioDecoder"; - case ADDON_INSTANCE_AUDIOENCODER: - return "AudioEncoder"; - case ADDON_INSTANCE_GAME: - return "Game"; - case ADDON_INSTANCE_IMAGEDECODER: - return "ImageDecoder"; - case ADDON_INSTANCE_INPUTSTREAM: - return "Inputstream"; - case ADDON_INSTANCE_PERIPHERAL: - return "Peripheral"; - case ADDON_INSTANCE_PVR: - return "PVR"; - case ADDON_INSTANCE_SCREENSAVER: - return "ScreenSaver"; - case ADDON_INSTANCE_VISUALIZATION: - return "Visualization"; - case ADDON_INSTANCE_VIDEOCODEC: - return "VideoCodec"; - } - return "unknown"; -} - -/// -/// Function used internally on add-on and in Kodi itself to get id number -/// about given type name. -/// -/// @param[in] name The type name string to ask -/// @return Id number of the asked instance type -/// -/// @warning String must be lower case here! -/// -inline int GetTypeId(const char* name) -{ - if (name) - { - if (strcmp(name, "addon") == 0) - return ADDON_GLOBAL_MAIN; - else if (strcmp(name, "general") == 0) - return ADDON_GLOBAL_GENERAL; - else if (strcmp(name, "gui") == 0) - return ADDON_GLOBAL_GUI; - else if (strcmp(name, "audioengine") == 0) - return ADDON_GLOBAL_AUDIOENGINE; - else if (strcmp(name, "filesystem") == 0) - return ADDON_GLOBAL_FILESYSTEM; - else if (strcmp(name, "network") == 0) - return ADDON_GLOBAL_NETWORK; - else if (strcmp(name, "tools") == 0) - return ADDON_GLOBAL_TOOLS; - else if (strcmp(name, "audiodecoder") == 0) - return ADDON_INSTANCE_AUDIODECODER; - else if (strcmp(name, "audioencoder") == 0) - return ADDON_INSTANCE_AUDIOENCODER; - else if (strcmp(name, "game") == 0) - return ADDON_INSTANCE_GAME; - else if (strcmp(name, "imagedecoder") == 0) - return ADDON_INSTANCE_IMAGEDECODER; - else if (strcmp(name, "inputstream") == 0) - return ADDON_INSTANCE_INPUTSTREAM; - else if (strcmp(name, "peripheral") == 0) - return ADDON_INSTANCE_PERIPHERAL; - else if (strcmp(name, "pvr") == 0) - return ADDON_INSTANCE_PVR; - else if (strcmp(name, "screensaver") == 0) - return ADDON_INSTANCE_SCREENSAVER; - else if (strcmp(name, "vfs") == 0) - return ADDON_INSTANCE_VFS; - else if (strcmp(name, "visualization") == 0) - return ADDON_INSTANCE_VISUALIZATION; - else if (strcmp(name, "videocodec") == 0) - return ADDON_INSTANCE_VIDEOCODEC; - } - return -1; -} - -#ifdef __cplusplus -} /* namespace addon */ -} /* namespace kodi */ -} /* extern "C" */ -#endif -- cgit v1.2.3