From be933ef2241d79558f91796cc5b3a161f72ebf9c Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 19 Oct 2020 00:52:24 +0200 Subject: sync with upstream --- .../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 +++++++++++++++++++++ 10 files changed, 3779 insertions(+) create mode 100644 xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/CMakeLists.txt create mode 100644 xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/ChannelGroups.h create mode 100644 xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Channels.h create mode 100644 xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/EDL.h create mode 100644 xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/EPG.h create mode 100644 xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/General.h create mode 100644 xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/MenuHook.h create mode 100644 xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Recordings.h create mode 100644 xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Stream.h create mode 100644 xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Timers.h (limited to 'xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr') diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/CMakeLists.txt b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/CMakeLists.txt new file mode 100644 index 0000000..3443b1e --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/CMakeLists.txt @@ -0,0 +1,13 @@ +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-dev-kit_include_kodi_addon-instance_pvr) +endif() diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/ChannelGroups.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/ChannelGroups.h new file mode 100644 index 0000000..17995bb --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/ChannelGroups.h @@ -0,0 +1,271 @@ +/* + * 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-dev-kit/include/kodi/addon-instance/pvr/Channels.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Channels.h new file mode 100644 index 0000000..9c2f5d2 --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Channels.h @@ -0,0 +1,518 @@ +/* + * 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-dev-kit/include/kodi/addon-instance/pvr/EDL.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/EDL.h new file mode 100644 index 0000000..34c7c41 --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/EDL.h @@ -0,0 +1,90 @@ +/* + * 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-dev-kit/include/kodi/addon-instance/pvr/EPG.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/EPG.h new file mode 100644 index 0000000..e1fc04f --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/EPG.h @@ -0,0 +1,500 @@ +/* + * 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-dev-kit/include/kodi/addon-instance/pvr/General.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/General.h new file mode 100644 index 0000000..c7977c2 --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/General.h @@ -0,0 +1,511 @@ +/* + * 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-dev-kit/include/kodi/addon-instance/pvr/MenuHook.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/MenuHook.h new file mode 100644 index 0000000..053a4d5 --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/MenuHook.h @@ -0,0 +1,130 @@ +/* + * 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-dev-kit/include/kodi/addon-instance/pvr/Recordings.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Recordings.h new file mode 100644 index 0000000..24ecf11 --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Recordings.h @@ -0,0 +1,520 @@ +/* + * 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-dev-kit/include/kodi/addon-instance/pvr/Stream.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Stream.h new file mode 100644 index 0000000..5613947 --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Stream.h @@ -0,0 +1,330 @@ +/* + * 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-dev-kit/include/kodi/addon-instance/pvr/Timers.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Timers.h new file mode 100644 index 0000000..6e05e55 --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Timers.h @@ -0,0 +1,896 @@ +/* + * 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 */ -- cgit v1.2.3