summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2021-03-04 23:36:40 +0100
committermanuel <manuel@mausz.at>2021-03-04 23:36:40 +0100
commit3cb8aa05f8cee9e860cf83531682ff0ed4af6a4f (patch)
tree921f4829b32126f80f9113c124f2e14c0ebce8d9 /xbmc/addons/kodi-dev-kit/include/kodi/addon-instance
parentbe933ef2241d79558f91796cc5b3a161f72ebf9c (diff)
downloadkodi-pvr-build-Matrix.tar.gz
kodi-pvr-build-Matrix.tar.bz2
kodi-pvr-build-Matrix.zip
sync with upstreamMatrix
Diffstat (limited to 'xbmc/addons/kodi-dev-kit/include/kodi/addon-instance')
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/AudioDecoder.h8
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Inputstream.h2198
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/PVR.h80
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Screensaver.h2
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/VFS.h4
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/VideoCodec.h601
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Visualization.h4
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/CMakeLists.txt8
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/DemuxPacket.h12
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/StreamCodec.h11
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/StreamConstants.h11
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/StreamCrypto.h99
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/TimingConstants.h59
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/peripheral/PeripheralUtils.h2
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Stream.h2
15 files changed, 2330 insertions, 771 deletions
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/AudioDecoder.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/AudioDecoder.h
index a6bea7d..747225f 100644
--- a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/AudioDecoder.h
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/AudioDecoder.h
@@ -241,7 +241,7 @@ private:
241 241
242//============================================================================== 242//==============================================================================
243/// 243///
244/// \addtogroup cpp_kodi_addon_audiodecoder 244/// @addtogroup cpp_kodi_addon_audiodecoder
245/// @brief \cpp_class{ kodi::addon::CInstanceAudioDecoder } 245/// @brief \cpp_class{ kodi::addon::CInstanceAudioDecoder }
246/// **Audio decoder add-on instance** 246/// **Audio decoder add-on instance**
247/// 247///
@@ -289,9 +289,11 @@ private:
289/// |:------------------------------|---------------------------------------- 289/// |:------------------------------|----------------------------------------
290/// | <b>`point`</b> | Addon type specification<br>At all addon types and for this kind always <b>"kodi.audiodecoder"</b>. 290/// | <b>`point`</b> | Addon type specification<br>At all addon types and for this kind always <b>"kodi.audiodecoder"</b>.
291/// | <b>`library_@PLATFORM@`</b> | Sets the used library name, which is automatically set by cmake at addon build. 291/// | <b>`library_@PLATFORM@`</b> | Sets the used library name, which is automatically set by cmake at addon build.
292/// | <b>`name`</b> | The name of the decoder used in Kodi for display.
293/// | <b>`extension`</b> | The file extensions / styles supported by this addon. 292/// | <b>`extension`</b> | The file extensions / styles supported by this addon.
294/// | <b>`tags`</b> | Boolean to point out that addon can bring own information to replayed file, if <b>`false`</b> only the file name is used as info.<br>If <b>`true`</b>, \ref CInstanceAudioDecoder::ReadTag is used and must be implemented. 293/// | <b>`mimetype`</b> | A stream URL mimetype where can be used to force to this addon.
294/// | <b>`name`</b> | The name of the decoder used in Kodi for display.
295/// | <b>`tags`</b> | Boolean to point out that addon can bring own information to replayed file, if <b>`false`</b> only the file name is used as info.<br>If <b>`true`</b>, @ref CInstanceAudioDecoder::ReadTag is used and must be implemented.
296/// | <b>`tracks`</b> | Boolean to in inform one file can contains several different streams.
295/// 297///
296/// -------------------------------------------------------------------------- 298/// --------------------------------------------------------------------------
297/// 299///
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Inputstream.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Inputstream.h
index 396b92e..c4c7aca 100644
--- a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Inputstream.h
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Inputstream.h
@@ -8,435 +8,1162 @@
8 8
9#pragma once 9#pragma once
10 10
11/*
12 * Parts with a comment named "internal" are only used inside header and not
13 * used or accessed direct during add-on development!
14 */
15
16#include "../AddonBase.h" 11#include "../AddonBase.h"
17#include "../StreamCodec.h" 12#include "../c-api/addon-instance/inputstream.h"
18#include "../StreamCrypto.h" 13#include "inputstream/StreamCodec.h"
14#include "inputstream/StreamConstants.h"
15#include "inputstream/StreamCrypto.h"
16#include "inputstream/TimingConstants.h"
17
18#ifdef __cplusplus
19
20#include <map>
21
22namespace kodi
23{
24namespace addon
25{
19 26
20#ifdef BUILD_KODI_ADDON 27//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
21#include "../DemuxPacket.h" 28// "C++" Doxygen group set for the definitions
22#include "../InputStreamConstants.h" 29//{{{
23#else
24#include "cores/VideoPlayer/Interface/Addon/DemuxPacket.h"
25#include "cores/VideoPlayer/Interface/Addon/InputStreamConstants.h"
26#endif
27 30
28//Increment this level always if you add features which can lead to compile failures in the addon 31//==============================================================================
29#define INPUTSTREAM_VERSION_LEVEL 2 32/// @defgroup cpp_kodi_addon_inputstream_Defs Definitions, structures and enumerators
33/// @ingroup cpp_kodi_addon_inputstream
34/// @brief **Inputstream add-on instance definition values**\n
35/// All inputstream functions associated data structures.
36///
37/// Used to exchange the available options between Kodi and addon.\n
38/// The groups described here correspond to the groups of functions on inputstream
39/// instance class.
40///
41/// In addition, some of the things described here are also used on the
42/// @ref cpp_kodi_addon_videocodec "video codec" addon.
43///
30 44
31#define INPUTSTREAM_MAX_STREAM_COUNT 256 45//##############################################################################
32#define INPUTSTREAM_MAX_STRING_NAME_SIZE 256 46/// @defgroup cpp_kodi_addon_inputstream_Defs_Interface 1. Interface
33#define INPUTSTREAM_MAX_STRING_CODEC_SIZE 32 47/// @ingroup cpp_kodi_addon_inputstream_Defs
34#define INPUTSTREAM_MAX_STRING_LANGUAGE_SIZE 64 48/// @brief **Inputstream add-on general variables**\n
49/// Used to exchange the available options between Kodi and addon.
50///
35 51
36#ifdef __cplusplus 52//##############################################################################
37extern "C" 53/// @defgroup cpp_kodi_addon_inputstream_Defs_StreamConstants 2. Stream constants
54/// @ingroup cpp_kodi_addon_inputstream_Defs
55/// @brief **Used to exchange any additional data between the caller and processor.**\n
56/// This includes the standardized values, in addition, an addon can also use
57/// its own special uses to be exchanged in the same way.
58///
59/// These values can be used by other addons (e.g. video addon) or stream files
60/// to select the respective inputstream addon and to transfer additional values.
61///
62/// ----------------------------------------------------------------------------
63///
64/// **Example:**
65///
66/// This example use the @ref STREAM_PROPERTY_INPUTSTREAM on a <b>`*.strm`</b>
67/// file to select needed addon and a additional value where related to selected
68/// addon itself.
69///
70/// ~~~~~~~~~~~~
71/// #KODIPROP:inputstream=inputstream.adaptive
72/// #KODIPROP:inputstream.adaptive.manifest_type=mpd
73/// http://rdmedia.bbc.co.uk/dash/ondemand/testcard/1/client_manifest-events-multilang.mpd
74/// ~~~~~~~~~~~~
75///
76/// These are then given to Kodi and the respectively selected addon by means of
77/// his @ref kodi::addon::CInstanceInputStream::Open "Open" call
78/// in @ref kodi::addon::InputstreamProperty::GetProperties.
79///
80/// The largest possible amount of these <b>`#KODIPROP`</b> values is defined
81/// with @ref STREAM_MAX_PROPERTY_COUNT.
82///
83
84//##############################################################################
85/// @defgroup cpp_kodi_addon_inputstream_Defs_TimingConstants 3. Stream timing
86/// @ingroup cpp_kodi_addon_inputstream_Defs
87/// @brief **Timebase and timestamp definitions.**\n
88/// Used to exchange the available options between Kodi and addon.
89///
90
91//##############################################################################
92/// @defgroup cpp_kodi_addon_inputstream_Defs_StreamCodec 4. Stream codec
93/// @ingroup cpp_kodi_addon_inputstream_Defs
94/// @brief **Inputstream codec control**\n
95/// Used to manage stream codec data.
96///
97
98//##############################################################################
99/// @defgroup cpp_kodi_addon_inputstream_Defs_StreamEncryption 5. Stream encryption
100/// @ingroup cpp_kodi_addon_inputstream_Defs
101/// @brief **Inputstream encryption control**\n
102/// Used to manage encrypted streams within addon.
103///
104
105//}}}
106//______________________________________________________________________________
107
108class CInstanceInputStream;
109
110//==============================================================================
111/// @defgroup cpp_kodi_addon_inputstream_Defs_InputstreamProperty class InputstreamProperty
112/// @ingroup cpp_kodi_addon_inputstream_Defs_Interface
113/// @brief <b>URL and Data of key/value pairs passed to addon on @ref kodi::addon::CInstanceInputStream::Open "Open".</b>\n
114/// This is used to have the necessary data of the stream to be opened.
115///
116/// ----------------------------------------------------------------------------
117///
118/// @copydetails cpp_kodi_addon_inputstream_Defs_InputstreamProperty_Help
119///
120/// @warning This data are only given from Kodi to addon and can't be used
121/// on other places on addon.
122///
123///@{
124class ATTRIBUTE_HIDDEN InputstreamProperty
125 : public CStructHdl<InputstreamProperty, INPUTSTREAM_PROPERTY>
38{ 126{
39#endif /* __cplusplus */ 127 /*! \cond PRIVATE */
128 friend class CInstanceInputStream;
129 /*! \endcond */
130
131public:
132 /// @defgroup cpp_kodi_addon_inputstream_Defs_InputstreamProperty_Help Value Help
133 /// @ingroup cpp_kodi_addon_inputstream_Defs_InputstreamProperty
134 ///
135 /// <b>The following table contains values that can be set with @ref cpp_kodi_addon_inputstream_Defs_InputstreamProperty :</b>
136 /// | Name | Type | Get call
137 /// |------|------|----------
138 /// | **Stream URL** | `std::string` | @ref InputstreamProperty::GetURL "GetURL"
139 /// | **Mime type** | `std::string` | @ref InputstreamProperty::GetMimeType "GetMimeType"
140 /// | **Available amount of properties** | `unsigned int` | @ref InputstreamProperty::GetPropertiesAmount "GetPropertiesAmount"
141 /// | **List of properties** | `std::map<std::string, std::string>` | @ref InputstreamProperty::GetProperties "GetProperties"
142 /// | **Get addon library folder** | `std::string` | @ref InputstreamProperty::GetLibFolder "GetLibFolder"
143 /// | **Get addon profile/user folder** | `std::string` | @ref InputstreamProperty::GetProfileFolder "GetProfileFolder"
144
145 /// @addtogroup cpp_kodi_addon_inputstream_Defs_InputstreamProperty
146 ///@{
147
148 /// @brief Stream URL to open.
149 std::string GetURL() const { return m_cStructure->m_strURL; }
150
151 /// @brief Stream mime type.
152 std::string GetMimeType() const { return m_cStructure->m_mimeType; }
40 153
41 /*! 154 /// @brief Amount of available properties.
42 * @brief InputStream add-on capabilities. All capabilities are set to "false" as default. 155 unsigned int GetPropertiesAmount() const
43 */
44 struct INPUTSTREAM_CAPABILITIES
45 { 156 {
46 enum MASKTYPE : uint32_t 157 return m_cStructure->m_nCountInfoValues;
158 }
159
160 /// @brief List of available properties-
161 const std::map<std::string, std::string> GetProperties() const
162 {
163 std::map<std::string, std::string> props;
164 for (unsigned int i = 0; i < m_cStructure->m_nCountInfoValues; ++i)
47 { 165 {
48 /// supports interface IDemux 166 props.emplace(m_cStructure->m_ListItemProperties[i].m_strKey,
49 SUPPORTS_IDEMUX = (1 << 0), 167 m_cStructure->m_ListItemProperties[i].m_strValue);
168 }
169 return props;
170 }
171
172 /// @brief Get addon library folder.
173 ///
174 /// @note As alternative can also @ref kodi::GetAddonPath used.
175 std::string GetLibFolder() const { return m_cStructure->m_libFolder; }
176
177 /// @brief Get addon profile/user folder.
178 ///
179 /// @note As alternative can also @ref kodi::GetBaseUserPath used.
180 std::string GetProfileFolder() const { return m_cStructure->m_profileFolder; }
181
182 ///@}
50 183
51 /// supports interface IPosTime 184private:
52 SUPPORTS_IPOSTIME = (1 << 1), 185 InputstreamProperty() = delete;
186 InputstreamProperty(const InputstreamProperty& stream) = delete;
187 InputstreamProperty(const INPUTSTREAM_PROPERTY* stream) : CStructHdl(stream) {}
188 InputstreamProperty(INPUTSTREAM_PROPERTY* stream) : CStructHdl(stream) {}
189};
190///@}
191//------------------------------------------------------------------------------
192
193//==============================================================================
194/// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamCapabilities class InputstreamCapabilities
195/// @ingroup cpp_kodi_addon_inputstream_Defs_Interface
196/// @brief **InputStream add-on capabilities. All capabilities are set to "false" as default.**\n
197/// Asked to addon on @ref kodi::addon::CInstanceInputStream::GetCapabilities "GetCapabilities".
198///
199/// ----------------------------------------------------------------------------
200///
201/// @copydetails cpp_kodi_addon_inputstream_Defs_Interface_InputstreamCapabilities_Help
202///
203///@{
204class ATTRIBUTE_HIDDEN InputstreamCapabilities
205 : public CStructHdl<InputstreamCapabilities, INPUTSTREAM_CAPABILITIES>
206{
207 /*! \cond PRIVATE */
208 friend class CInstanceInputStream;
209 /*! \endcond */
210
211public:
212 /*! \cond PRIVATE */
213 InputstreamCapabilities() = default;
214 InputstreamCapabilities(const InputstreamCapabilities& stream) : CStructHdl(stream) {}
215 /*! \endcond */
216
217 /// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamCapabilities_Help Value Help
218 /// @ingroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamCapabilities
219 ///
220 /// <b>The following table contains values that can be set with @ref cpp_kodi_addon_inputstream_Defs_Interface_InputstreamCapabilities :</b>
221 /// | Name | Type | Set call | Get call
222 /// |------|------|----------|----------
223 /// | **Capabilities bit mask** | `uint32_t` | @ref InputstreamCapabilities::SetMask "SetMask" | @ref InputstreamCapabilities::GetMask "GetMask"
224
225 /// @addtogroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamCapabilities
226 ///@{
53 227
54 /// supports interface IDisplayTime 228 /// @brief Set of supported capabilities.
55 SUPPORTS_IDISPLAYTIME = (1 << 2), 229 void SetMask(uint32_t mask) const { m_cStructure->m_mask = mask; }
56 230
57 /// supports seek 231 /// @brief Get of supported capabilities.
58 SUPPORTS_SEEK = (1 << 3), 232 uint32_t GetMask() const { return m_cStructure->m_mask; }
59 233
60 /// supports pause 234 ///@}
61 SUPPORTS_PAUSE = (1 << 4),
62 235
63 /// supports interface ITime 236private:
64 SUPPORTS_ITIME = (1 << 5), 237 InputstreamCapabilities(const INPUTSTREAM_CAPABILITIES* stream) : CStructHdl(stream) {}
238 InputstreamCapabilities(INPUTSTREAM_CAPABILITIES* stream) : CStructHdl(stream) {}
239};
240///@}
241//------------------------------------------------------------------------------
242
243//==============================================================================
244/// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamMasteringMetadata class InputstreamMasteringMetadata
245/// @ingroup cpp_kodi_addon_inputstream_Defs_Interface
246/// @brief **Mastering metadata.**\n
247/// Describes the metadata for [HDR10](https://en.wikipedia.org/wiki/High-dynamic-range_video).
248///
249/// Used when video is compressed using [High Efficiency Video Coding (HEVC)](https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding).
250/// This is used to describe the capabilities of the display used to master the
251/// content and the luminance values of the content.
252///
253/// Used on @ref kodi::addon::InputstreamInfo::SetMasteringMetadata and @ref kodi::addon::InputstreamInfo::GetMasteringMetadata.
254///
255/// ----------------------------------------------------------------------------
256///
257/// @copydetails cpp_kodi_addon_inputstream_Defs_Interface_InputstreamMasteringMetadata_Help
258///
259///@{
260class ATTRIBUTE_HIDDEN InputstreamMasteringMetadata
261 : public CStructHdl<InputstreamMasteringMetadata, INPUTSTREAM_MASTERING_METADATA>
262{
263 /*! \cond PRIVATE */
264 friend class CInstanceInputStream;
265 friend class InputstreamInfo;
266 /*! \endcond */
65 267
66 /// supports interface IChapter 268public:
67 SUPPORTS_ICHAPTER = (1 << 6), 269 /*! \cond PRIVATE */
68 }; 270 InputstreamMasteringMetadata() = default;
271 InputstreamMasteringMetadata(const InputstreamMasteringMetadata& stream) : CStructHdl(stream) {}
272 /*! \endcond */
273
274 /// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamMasteringMetadata_Help Value Help
275 /// @ingroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamMasteringMetadata
276 ///
277 /// <b>The following table contains values that can be set with @ref cpp_kodi_addon_inputstream_Defs_Interface_InputstreamMasteringMetadata :</b>
278 /// | Name | Type | Set call | Get call
279 /// |------|------|----------|----------
280 /// | **Chromaticity X coordinates of the red** | `double` | @ref InputstreamMasteringMetadata::SetPrimaryR_ChromaticityX "SetPrimaryR_ChromaticityX" | @ref InputstreamMasteringMetadata::GetPrimaryR_ChromaticityX "GetPrimaryR_ChromaticityX"
281 /// | **Chromaticity Y coordinates of the red** | `double` | @ref InputstreamMasteringMetadata::SetPrimaryR_ChromaticityY "SetPrimaryR_ChromaticityY" | @ref InputstreamMasteringMetadata::GetPrimaryR_ChromaticityY "GetPrimaryR_ChromaticityY"
282 /// | **Chromaticity X coordinates of the green** | `double` | @ref InputstreamMasteringMetadata::SetPrimaryG_ChromaticityX "SetPrimaryG_ChromaticityX" | @ref InputstreamMasteringMetadata::GetPrimaryG_ChromaticityX "GetPrimaryG_ChromaticityX"
283 /// | **Chromaticity Y coordinates of the green** | `double` | @ref InputstreamMasteringMetadata::SetPrimaryG_ChromaticityY "SetPrimaryG_ChromaticityY" | @ref InputstreamMasteringMetadata::GetPrimaryG_ChromaticityY "GetPrimaryG_ChromaticityY"
284 /// | **Chromaticity X coordinates of the blue** | `double` | @ref InputstreamMasteringMetadata::SetPrimaryB_ChromaticityX "SetPrimaryB_ChromaticityX" | @ref InputstreamMasteringMetadata::GetPrimaryB_ChromaticityX "GetPrimaryB_ChromaticityX"
285 /// | **Chromaticity Y coordinates of the blue** | `double` | @ref InputstreamMasteringMetadata::SetPrimaryB_ChromaticityY "SetPrimaryB_ChromaticityY" | @ref InputstreamMasteringMetadata::GetPrimaryB_ChromaticityY "GetPrimaryB_ChromaticityY"
286 /// | **Chromaticity X coordinates of the white point** | `double` | @ref InputstreamMasteringMetadata::SetWhitePoint_ChromaticityX "SetWhitePoint_ChromaticityX" | @ref InputstreamMasteringMetadata::GetWhitePoint_ChromaticityX "GetWhitePoint_ChromaticityX"
287 /// | **Chromaticity Y coordinates of the white point** | `double` | @ref InputstreamMasteringMetadata::SetWhitePoint_ChromaticityY "SetWhitePoint_ChromaticityY" | @ref InputstreamMasteringMetadata::GetWhitePoint_ChromaticityY "GetWhitePoint_ChromaticityY"
288 /// | **Maximum number of bits of the display** | `double` | @ref InputstreamMasteringMetadata::SetLuminanceMax "SetLuminanceMax" | @ref InputstreamMasteringMetadata::GetLuminanceMax "GetLuminanceMax"
289 /// | **Minimum number of bits of the display** | `double` | @ref InputstreamMasteringMetadata::SetLuminanceMin "SetLuminanceMin" | @ref InputstreamMasteringMetadata::GetLuminanceMin "GetLuminanceMin"
69 290
70 /// set of supported capabilities 291 /// @addtogroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamMasteringMetadata
71 uint32_t m_mask; 292 ///@{
72 };
73 293
74 /*! 294 /// @brief Metadata class compare.
75 * @brief structure of key/value pairs passed to addon on Open() 295 ///
76 */ 296 /// To compare the metadata with another one.
77 struct INPUTSTREAM 297 ///
298 /// @return true if they equal, false otherwise
299 bool operator==(const kodi::addon::InputstreamMasteringMetadata& right) const
78 { 300 {
79 const char* m_strURL; 301 if (memcmp(m_cStructure, right.m_cStructure, sizeof(INPUTSTREAM_MASTERING_METADATA)) == 0)
80 const char* m_mimeType; 302 return true;
303 return false;
304 }
81 305
82 unsigned int m_nCountInfoValues; 306 /// @brief Set the chromaticity coordinates of the red value in the
83 struct LISTITEMPROPERTY 307 /// [CIE1931](https://en.wikipedia.org/wiki/CIE_1931_color_space) color space.
84 { 308 ///
85 const char* m_strKey; 309 /// X coordinate. The values are normalized to 50,000.
86 const char* m_strValue; 310 void SetPrimaryR_ChromaticityX(double value) { m_cStructure->primary_r_chromaticity_x = value; }
87 } m_ListItemProperties[STREAM_MAX_PROPERTY_COUNT];
88 311
89 const char* m_libFolder; 312 /// @brief Get the chromaticity X coordinates of the red value.
90 const char* m_profileFolder; 313 double GetPrimaryR_ChromaticityX() { return m_cStructure->primary_r_chromaticity_x; }
91 };
92 314
93 /*! 315 /// @brief The chromaticity coordinates of the red value in the
94 * @brief Array of stream IDs 316 /// [CIE1931](https://en.wikipedia.org/wiki/CIE_1931_color_space) color space.
95 */ 317 ///
96 struct INPUTSTREAM_IDS 318 /// Y coordinate. The values are normalized to 50,000.
319 void SetPrimaryR_ChromaticityY(double value) { m_cStructure->primary_r_chromaticity_y = value; }
320
321 /// @brief Get the chromaticity Y coordinates of the red value.
322 double GetPrimaryR_ChromaticityY() { return m_cStructure->primary_r_chromaticity_y; }
323
324 /// @brief Set the chromaticity coordinates of the green value in the
325 /// [CIE1931](https://en.wikipedia.org/wiki/CIE_1931_color_space) color space.
326 ///
327 /// X coordinate. The values are normalized to 50,000.
328 void SetPrimaryG_ChromaticityX(double value) { m_cStructure->primary_g_chromaticity_x = value; }
329
330 /// @brief Get the chromaticity X coordinates of the green value.
331 double GetPrimaryG_ChromaticityX() { return m_cStructure->primary_g_chromaticity_x; }
332
333 /// @brief Set the chromaticity coordinates of the green value in the
334 /// [CIE1931](https://en.wikipedia.org/wiki/CIE_1931_color_space) color space.
335 ///
336 /// Y coordinate. The values are normalized to 50,000.
337 void SetPrimaryG_ChromaticityY(double value) { m_cStructure->primary_g_chromaticity_y = value; }
338
339 /// @brief Get the chromaticity Y coordinates of the green value.
340 double GetPrimaryG_ChromaticityY() { return m_cStructure->primary_g_chromaticity_y; }
341
342 /// @brief The chromaticity coordinates of the blue value in the
343 /// [CIE1931](https://en.wikipedia.org/wiki/CIE_1931_color_space) color space.
344 ///
345 /// X coordinate. The values are normalized to 50,000.
346 void SetPrimaryB_ChromaticityX(double value) { m_cStructure->primary_b_chromaticity_x = value; }
347
348 /// @brief Get the chromaticity X coordinates of the blue value.
349 double GetPrimaryB_ChromaticityX() { return m_cStructure->primary_b_chromaticity_x; }
350
351 /// @brief The chromaticity coordinates of the blue value in the
352 /// [CIE1931](https://en.wikipedia.org/wiki/CIE_1931_color_space) color space.
353 ///
354 /// Y coordinate. The values are normalized to 50,000.
355 void SetPrimaryB_ChromaticityY(double value) { m_cStructure->primary_b_chromaticity_y = value; }
356
357 /// @brief Get the chromaticity Y coordinates of the blue value.
358 double GetPrimaryB_ChromaticityY() { return m_cStructure->primary_b_chromaticity_y; }
359
360 /// @brief Set the chromaticity coordinates of the white point in the
361 /// [CIE1931](https://en.wikipedia.org/wiki/CIE_1931_color_space) color space.
362 ///
363 /// X coordinate. The values are normalized to 50,000.
364 void SetWhitePoint_ChromaticityX(double value)
97 { 365 {
98 unsigned int m_streamCount; 366 m_cStructure->white_point_chromaticity_x = value;
99 unsigned int m_streamIds[INPUTSTREAM_MAX_STREAM_COUNT]; 367 }
100 }; 368
369 /// @brief Get the chromaticity X coordinates of the white point
370 double GetWhitePoint_ChromaticityX() { return m_cStructure->white_point_chromaticity_x; }
101 371
102 /*! 372 /// @brief Set the chromaticity coordinates of the white point in the
103 * @brief MASTERING Metadata 373 /// [CIE1931](https://en.wikipedia.org/wiki/CIE_1931_color_space) color space.
104 */ 374 ///
105 struct INPUTSTREAM_MASTERING_METADATA 375 /// Y coordinate. The values are normalized to 50,000.
376 void SetWhitePoint_ChromaticityY(double value)
106 { 377 {
107 double primary_r_chromaticity_x; 378 m_cStructure->white_point_chromaticity_y = value;
108 double primary_r_chromaticity_y; 379 }
109 double primary_g_chromaticity_x; 380
110 double primary_g_chromaticity_y; 381 /// @brief Get the chromaticity Y coordinates of the white point.
111 double primary_b_chromaticity_x; 382 double GetWhitePoint_ChromaticityY() { return m_cStructure->white_point_chromaticity_y; }
112 double primary_b_chromaticity_y; 383
113 double white_point_chromaticity_x; 384 /// @brief Set the maximum number of bits of the display used to master the content.
114 double white_point_chromaticity_y; 385 ///
115 double luminance_max; 386 /// Values are normalized to 10,000.
116 double luminance_min; 387 void SetLuminanceMax(double value) { m_cStructure->luminance_max = value; }
117 }; 388
389 /// @brief Get the maximum number of bits of the display.
390 double GetLuminanceMax() { return m_cStructure->luminance_max; }
118 391
119 /*! 392 /// @brief Set the minimum number of bits of the display used to master the content.
120 * @brief CONTENTLIGHT Metadata 393 ///
121 */ 394 /// Values are normalized to 10,000.
122 struct INPUTSTREAM_CONTENTLIGHT_METADATA 395 void SetLuminanceMin(double value) { m_cStructure->luminance_min = value; }
396
397 /// @brief Get the minimum number of bits of the display.
398 double GetLuminanceMin() { return m_cStructure->luminance_min; }
399
400 ///@}
401
402private:
403 InputstreamMasteringMetadata(const INPUTSTREAM_MASTERING_METADATA* stream) : CStructHdl(stream) {}
404 InputstreamMasteringMetadata(INPUTSTREAM_MASTERING_METADATA* stream) : CStructHdl(stream) {}
405};
406///@}
407//------------------------------------------------------------------------------
408
409//==============================================================================
410/// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamContentlightMetadata class InputstreamContentlightMetadata
411/// @ingroup cpp_kodi_addon_inputstream_Defs_Interface
412/// @brief **Contentlight metadata**\n
413/// Describes the metadata for [HDR10](https://en.wikipedia.org/wiki/High-dynamic-range_video).
414/// See also @ref cpp_kodi_addon_inputstream_Defs_Interface_InputstreamMasteringMetadata "InputstreamMasteringMetadata".
415///
416/// Used on @ref kodi::addon::InputstreamInfo::SetContentLightMetadata and @ref kodi::addon::InputstreamInfo::GetContentLightMetadata.
417///
418/// ----------------------------------------------------------------------------
419///
420/// @copydetails cpp_kodi_addon_inputstream_Defs_Interface_InputstreamContentlightMetadata_Help
421///
422///@{
423class ATTRIBUTE_HIDDEN InputstreamContentlightMetadata
424 : public CStructHdl<InputstreamContentlightMetadata, INPUTSTREAM_CONTENTLIGHT_METADATA>
425{
426 /*! \cond PRIVATE */
427 friend class CInstanceInputStream;
428 friend class InputstreamInfo;
429 /*! \endcond */
430
431public:
432 /*! \cond PRIVATE */
433 InputstreamContentlightMetadata() = default;
434 InputstreamContentlightMetadata(const InputstreamContentlightMetadata& stream)
435 : CStructHdl(stream)
123 { 436 {
124 uint64_t max_cll; 437 }
125 uint64_t max_fall; 438 /*! \endcond */
126 }; 439
440 /// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamContentlightMetadata_Help Value Help
441 /// @ingroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamContentlightMetadata
442 ///
443 /// <b>The following table contains values that can be set with @ref cpp_kodi_addon_inputstream_Defs_Interface_InputstreamContentlightMetadata :</b>
444 /// | Name | Type | Set call | Get call
445 /// |------|------|----------|----------
446 /// | **Maximum content light level** | `double` | @ref InputstreamContentlightMetadata::SetMaxCll "SetMaxCll" | @ref InputstreamContentlightMetadata::GetMaxCll "GetMaxCll"
447 /// | **Maximum frame average light level** | `double` | @ref InputstreamContentlightMetadata::SetMaxFall "SetMaxFall" | @ref InputstreamContentlightMetadata::GetMaxFall "GetMaxFall"
448
449 /// @addtogroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamContentlightMetadata
450 ///@{
127 451
128 /*! 452 /// @brief Metadata class compare.
129 * @brief stream properties 453 ///
130 */ 454 /// To compare the metadata with another one.
131 struct INPUTSTREAM_INFO 455 ///
456 /// @return true if they equal, false otherwise
457 bool operator==(const kodi::addon::InputstreamContentlightMetadata& right) const
132 { 458 {
133 enum STREAM_TYPE 459 if (memcmp(m_cStructure, right.m_cStructure, sizeof(INPUTSTREAM_CONTENTLIGHT_METADATA)) == 0)
134 { 460 return true;
135 TYPE_NONE = 0, 461 return false;
136 TYPE_VIDEO, 462 }
137 TYPE_AUDIO,
138 TYPE_SUBTITLE,
139 TYPE_TELETEXT,
140 TYPE_RDS,
141 } m_streamType;
142 463
143 enum Codec_FEATURES : uint32_t 464 /// @brief Set the maximum content light level (MaxCLL).
144 { 465 ///
145 FEATURE_DECODE = 1 466 /// This is the bit value corresponding to the brightest pixel used anywhere
146 }; 467 /// in the content.
147 uint32_t m_features; 468 void SetMaxCll(uint64_t value) { m_cStructure->max_cll = value; }
148 469
149 enum STREAM_FLAGS : uint32_t 470 /// @brief Get the maximum content light level (MaxCLL).
150 { 471 uint64_t GetMaxCll() { return m_cStructure->max_cll; }
151 FLAG_NONE = 0x0000,
152 FLAG_DEFAULT = 0x0001,
153 FLAG_DUB = 0x0002,
154 FLAG_ORIGINAL = 0x0004,
155 FLAG_COMMENT = 0x0008,
156 FLAG_LYRICS = 0x0010,
157 FLAG_KARAOKE = 0x0020,
158 FLAG_FORCED = 0x0040,
159 FLAG_HEARING_IMPAIRED = 0x0080,
160 FLAG_VISUAL_IMPAIRED = 0x0100,
161 };
162 472
163 // Keep in sync with AVColorSpace 473 /// @brief Set the maximum frame average light level (MaxFALL).
164 enum COLORSPACE 474 ///
165 { 475 /// This is the bit value corresponding to the average luminance of the frame
166 COLORSPACE_RGB = 0, 476 /// which has the brightest average luminance anywhere in the content.
167 COLORSPACE_BT709 = 1, 477 void SetMaxFall(uint64_t value) { m_cStructure->max_fall = value; }
168 COLORSPACE_UNSPECIFIED = 2,
169 COLORSPACE_UNKNOWN = COLORSPACE_UNSPECIFIED, // compatibility
170 COLORSPACE_RESERVED = 3,
171 COLORSPACE_FCC = 4,
172 COLORSPACE_BT470BG = 5,
173 COLORSPACE_SMPTE170M = 6,
174 COLORSPACE_SMPTE240M = 7,
175 COLORSPACE_YCGCO = 8,
176 COLORSPACE_YCOCG = COLORSPACE_YCGCO,
177 COLORSPACE_BT2020_NCL = 9,
178 COLORSPACE_BT2020_CL = 10,
179 COLORSPACE_SMPTE2085 = 11,
180 COLORSPACE_CHROMA_DERIVED_NCL = 12,
181 COLORSPACE_CHROMA_DERIVED_CL = 13,
182 COLORSPACE_ICTCP = 14,
183 COLORSPACE_MAX
184 };
185 478
186 // Keep in sync with AVColorPrimaries 479 /// @brief Get the maximum frame average light level (MaxFALL).
187 enum COLORPRIMARIES : int32_t 480 uint64_t GetMaxFall() { return m_cStructure->max_fall; }
188 {
189 COLORPRIMARY_RESERVED0 = 0,
190 COLORPRIMARY_BT709 = 1,
191 COLORPRIMARY_UNSPECIFIED = 2,
192 COLORPRIMARY_RESERVED = 3,
193 COLORPRIMARY_BT470M = 4,
194 COLORPRIMARY_BT470BG = 5,
195 COLORPRIMARY_SMPTE170M = 6,
196 COLORPRIMARY_SMPTE240M = 7,
197 COLORPRIMARY_FILM = 8,
198 COLORPRIMARY_BT2020 = 9,
199 COLORPRIMARY_SMPTE428 = 10,
200 COLORPRIMARY_SMPTEST428_1 = COLORPRIMARY_SMPTE428,
201 COLORPRIMARY_SMPTE431 = 11,
202 COLORPRIMARY_SMPTE432 = 12,
203 COLORPRIMARY_JEDEC_P22 = 22,
204 COLORPRIMARY_MAX
205 };
206 481
207 // Keep in sync with AVColorRange 482 ///@}
208 enum COLORRANGE
209 {
210 COLORRANGE_UNKNOWN = 0,
211 COLORRANGE_LIMITED,
212 COLORRANGE_FULLRANGE,
213 COLORRANGE_MAX
214 };
215 483
216 // keep in sync with AVColorTransferCharacteristic 484private:
217 enum COLORTRC : int32_t 485 InputstreamContentlightMetadata(const INPUTSTREAM_CONTENTLIGHT_METADATA* stream)
218 { 486 : CStructHdl(stream)
219 COLORTRC_RESERVED0 = 0, 487 {
220 COLORTRC_BT709 = 1, 488 }
221 COLORTRC_UNSPECIFIED = 2, 489 InputstreamContentlightMetadata(INPUTSTREAM_CONTENTLIGHT_METADATA* stream) : CStructHdl(stream) {}
222 COLORTRC_RESERVED = 3, 490};
223 COLORTRC_GAMMA22 = 4, 491///@}
224 COLORTRC_GAMMA28 = 5, 492//------------------------------------------------------------------------------
225 COLORTRC_SMPTE170M = 6,
226 COLORTRC_SMPTE240M = 7,
227 COLORTRC_LINEAR = 8,
228 COLORTRC_LOG = 9,
229 COLORTRC_LOG_SQRT = 10,
230 COLORTRC_IEC61966_2_4 = 11,
231 COLORTRC_BT1361_ECG = 12,
232 COLORTRC_IEC61966_2_1 = 13,
233 COLORTRC_BT2020_10 = 14,
234 COLORTRC_BT2020_12 = 15,
235 COLORTRC_SMPTE2084 = 16,
236 COLORTRC_SMPTEST2084 = COLORTRC_SMPTE2084,
237 COLORTRC_SMPTE428 = 17,
238 COLORTRC_SMPTEST428_1 = COLORTRC_SMPTE428,
239 COLORTRC_ARIB_STD_B67 = 18,
240 COLORTRC_MAX
241 };
242 493
243 uint32_t m_flags; 494//==============================================================================
495/// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamInfo class InputstreamInfo
496/// @ingroup cpp_kodi_addon_inputstream_Defs_Interface
497/// @brief **Inputstream add-on stream info**\n
498/// This is used to give Kodi the associated and necessary data for an open stream.
499///
500/// Used on @ref kodi::addon::CInstanceInputStream::GetStream().
501///
502/// ----------------------------------------------------------------------------
503///
504/// @copydetails cpp_kodi_addon_inputstream_Defs_Interface_InputstreamInfo_Help
505///
506///@{
507class ATTRIBUTE_HIDDEN InputstreamInfo : public CStructHdl<InputstreamInfo, INPUTSTREAM_INFO>
508{
509 /*! \cond PRIVATE */
510 friend class CInstanceInputStream;
511 /*! \endcond */
244 512
245 //! @brief (optional) name of the stream, \0 for default handling 513public:
246 char m_name[INPUTSTREAM_MAX_STRING_NAME_SIZE]; 514 /*! \cond PRIVATE */
515 InputstreamInfo() = default;
516 InputstreamInfo(const InputstreamInfo& stream) : CStructHdl(stream)
517 {
518 SetCryptoSession(stream.GetCryptoSession());
519 CopyExtraData();
520 }
521 /*! \endcond */
247 522
248 //! @brief (required) name of codec according to ffmpeg 523 /// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamInfo_Help Value Help
249 char m_codecName[INPUTSTREAM_MAX_STRING_CODEC_SIZE]; 524 /// @ingroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamInfo
525 ///
526 /// <b>The following table contains values that can be set with @ref cpp_kodi_addon_inputstream_Defs_Interface_InputstreamInfo :</b>
527 /// | Name | Type used | Required | Set call | Get call
528 /// |------|-----------|----------|----------|---------
529 /// | **Stream type** | all | yes | @ref InputstreamInfo::SetStreamType "SetStreamType" | @ref InputstreamInfo::GetStreamType "GetStreamType"
530 /// | **Feature flags** | all | yes | @ref InputstreamInfo::SetFeatures "SetFeatures" | @ref InputstreamInfo::GetFeatures "GetFeatures"
531 /// | **Flags** | all | yes | @ref InputstreamInfo::SetFlags "SetFlags" | @ref InputstreamInfo::GetFlags "GetFlags"
532 /// | **Name** | all | no | @ref InputstreamInfo::SetName "SetName" | @ref InputstreamInfo::GetName "GetName"
533 /// | **Codec name** | all | yes | @ref InputstreamInfo::SetCodecName "SetCodecName" | @ref InputstreamInfo::GetCodecName "GetCodecName"
534 /// | **Codec internal name** | all | no | @ref InputstreamInfo::SetCodecInternalName "SetCodecInternalName" | @ref InputstreamInfo::GetCodecInternalName "GetCodecInternalName"
535 /// | **Codec Profile** | all | no | @ref InputstreamInfo::SetCodecProfile "SetCodecProfile" | @ref InputstreamInfo::GetCodecProfile "GetCodecProfile"
536 /// | **Physical index** | all | yes | @ref InputstreamInfo::SetPhysicalIndex "SetPhysicalIndex" | @ref InputstreamInfo::GetPhysicalIndex "GetPhysicalIndex"
537 /// | **Extra data** | Subtitle / all | Type related required | @ref InputstreamInfo::SetExtraData "SetExtraData" | @ref InputstreamInfo::GetExtraData "GetExtraData"
538 /// | **RFC 5646 language code** | all | no | @ref InputstreamInfo::SetLanguage "SetLanguage" | @ref InputstreamInfo::GetLanguage "GetLanguage"
539 /// | **FPS scale** | Video | Type related required | @ref InputstreamInfo::SetFpsScale "SetFpsScale" | @ref InputstreamInfo::GetFpsScale "GetFpsScale"
540 /// | **FPS rate** | Video | Type related required | @ref InputstreamInfo::SetFpsRate "SetFpsRate" | @ref InputstreamInfo::GetFpsRate "GetFpsRate"
541 /// | **Height** | Video | Type related required | @ref InputstreamInfo::SetHeight "SetHeight" | @ref InputstreamInfo::GetHeight "GetHeight"
542 /// | **Width** | Video | Type related required | @ref InputstreamInfo::SetWidth "SetWidth" | @ref InputstreamInfo::GetWidth "GetWidth"
543 /// | **Aspect** | Video | Type related required | @ref InputstreamInfo::SetAspect "SetAspect" | @ref InputstreamInfo::GetAspect "GetAspect"
544 /// | **Channel quantity** | Audio | Type related required | @ref InputstreamInfo::SetChannels "SetChannels" | @ref InputstreamInfo::GetChannels "GetChannels"
545 /// | **Sample rate** | Audio | Type related required | @ref InputstreamInfo::SetSampleRate "SetSampleRate" | @ref InputstreamInfo::GetSampleRate "GetSampleRate"
546 /// | **Bit rate** | Audio | Type related required | @ref InputstreamInfo::SetBitRate "SetBitRate" | @ref InputstreamInfo::GetBitRate "GetBitRate"
547 /// | **Bits per sample** | Audio | Type related required | @ref InputstreamInfo::SetBitsPerSample "SetBitsPerSample" | @ref InputstreamInfo::GetBitsPerSample "GetBitsPerSample"
548 /// | **Block align** | | no | @ref InputstreamInfo::SetBlockAlign "SetBlockAlign" | @ref InputstreamInfo::GetBlockAlign "GetBlockAlign"
549 /// | **Crypto session info** | | no | @ref InputstreamInfo::SetCryptoSession "SetCryptoSession" | @ref InputstreamInfo::GetCryptoSession "GetCryptoSession"
550 /// | **Four CC code** | | no | @ref InputstreamInfo::SetCodecFourCC "SetCodecFourCC" | @ref InputstreamInfo::GetCodecFourCC "GetCodecFourCC"
551 /// | **Color space** | | no | @ref InputstreamInfo::SetColorSpace "SetColorSpace" | @ref InputstreamInfo::GetColorSpace "GetColorSpace"
552 /// | **Color range** | | no | @ref InputstreamInfo::SetColorRange "SetColorRange" | @ref InputstreamInfo::GetColorRange "GetColorRange"
553 /// | **Color primaries** | | no | @ref InputstreamInfo::SetColorPrimaries "SetColorPrimaries" | @ref InputstreamInfo::GetColorPrimaries "GetColorPrimaries"
554 /// | **Color transfer characteristic** | | no | @ref InputstreamInfo::SetColorTransferCharacteristic "SetColorTransferCharacteristic" | @ref InputstreamInfo::GetColorTransferCharacteristic "GetColorTransferCharacteristic"
555 /// | **Mastering metadata** | | no | @ref InputstreamInfo::SetMasteringMetadata "SetMasteringMetadata" | @ref InputstreamInfo::GetMasteringMetadata "GetMasteringMetadata"
556 /// | **Content light metadata** | | no | @ref InputstreamInfo::SetContentLightMetadata "SetContentLightMetadata" | @ref InputstreamInfo::GetContentLightMetadata "GetContentLightMetadata"
557 ///
250 558
251 //! @brief (optional) internal name of codec (selectionstream info) 559 /// @addtogroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamInfo
252 char m_codecInternalName[INPUTSTREAM_MAX_STRING_CODEC_SIZE]; 560 ///@{
253 561
254 //! @brief (optional) the profile of the codec 562 /// @brief Set the wanted stream type.
255 STREAMCODEC_PROFILE m_codecProfile; 563 ///
564 /// @param[in] streamType By @ref INPUTSTREAM_TYPE defined type
565 void SetStreamType(INPUTSTREAM_TYPE streamType) { m_cStructure->m_streamType = streamType; }
256 566
257 //! @brief (required) physical index 567 /// @brief To get with @ref SetStreamType changed values.
258 unsigned int m_pID; 568 INPUTSTREAM_TYPE GetStreamType() const { return m_cStructure->m_streamType; }
259 569
260 const uint8_t* m_ExtraData; 570 /// @brief Set special supported feature flags of inputstream.
261 unsigned int m_ExtraSize; 571 ///
572 /// @param[in] features By @ref INPUTSTREAM_CODEC_FEATURES defined type
573 void SetFeatures(uint32_t features) { m_cStructure->m_features = features; }
262 574
263 //! @brief RFC 5646 language code (empty string if undefined) 575 /// @brief To get with @ref SetFeatures changed values.
264 char m_language[INPUTSTREAM_MAX_STRING_LANGUAGE_SIZE]; 576 uint32_t GetFeatures() const { return m_cStructure->m_features; }
265 577
266 //! Video stream related data 578 /// @brief Set supported flags of inputstream.
267 //@{ 579 ///
580 /// @param[in] flags The on @ref INPUTSTREAM_FLAGS defined flags to set
581 void SetFlags(uint32_t flags) { m_cStructure->m_flags = flags; }
268 582
269 //! @brief Scale of 1000 and a rate of 29970 will result in 29.97 fps 583 /// @brief To get with @ref SetFeatures changed values.
270 unsigned int m_FpsScale; 584 uint32_t GetFlags() const { return m_cStructure->m_flags; }
271 585
272 unsigned int m_FpsRate; 586 /// @brief (optional) Name of the stream, leave empty for default handling.
587 ///
588 /// @param[in] name Stream name
589 void SetName(const std::string& name)
590 {
591 strncpy(m_cStructure->m_name, name.c_str(), INPUTSTREAM_MAX_STRING_NAME_SIZE);
592 }
273 593
274 //! @brief height of the stream reported by the demuxer 594 /// @brief To get with @ref SetName changed values.
275 unsigned int m_Height; 595 std::string GetName() const { return m_cStructure->m_name; }
276 596
277 //! @brief width of the stream reported by the demuxer 597 /// @brief (required) Name of codec according to ffmpeg.
278 unsigned int m_Width; 598 ///
599 /// See https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/codec_desc.c about
600 /// available names.
601 ///
602 /// @remark On @ref INPUTSTREAM_TYPE_TELETEXT and @ref INPUTSTREAM_TYPE_RDS
603 /// this can be ignored and leaved empty.
604 ///
605 /// @param[in] codeName Codec name
606 void SetCodecName(const std::string& codecName)
607 {
608 strncpy(m_cStructure->m_codecName, codecName.c_str(), INPUTSTREAM_MAX_STRING_CODEC_SIZE);
609 }
279 610
280 //! @brief display aspect of stream 611 /// @brief To get with @ref SetCodecName changed values.
281 float m_Aspect; 612 std::string GetCodecName() const { return m_cStructure->m_codecName; }
282 613
283 //@} 614 /// @brief (optional) Internal name of codec (selectionstream info).
615 ///
616 /// @param[in] codecName Internal codec name
617 void SetCodecInternalName(const std::string& codecName)
618 {
619 strncpy(m_cStructure->m_codecInternalName, codecName.c_str(),
620 INPUTSTREAM_MAX_STRING_CODEC_SIZE);
621 }
622
623 /// @brief To get with @ref SetCodecInternalName changed values.
624 std::string GetCodecInternalName() const { return m_cStructure->m_codecInternalName; }
625
626 /// @brief (optional) The profile of the codec.
627 ///
628 /// @param[in] codecProfile Values with @ref STREAMCODEC_PROFILE to use
629 void SetCodecProfile(STREAMCODEC_PROFILE codecProfile)
630 {
631 m_cStructure->m_codecProfile = codecProfile;
632 }
633
634 /// @brief To get with @ref SetCodecProfile changed values.
635 STREAMCODEC_PROFILE GetCodecProfile() const { return m_cStructure->m_codecProfile; }
636
637 /// @brief (required) Physical index.
638 ///
639 /// @param[in] id Index identifier
640 void SetPhysicalIndex(unsigned int id) { m_cStructure->m_pID = id; }
641
642 /// @brief To get with @ref SetPhysicalIndex changed values.
643 unsigned int GetPhysicalIndex() const { return m_cStructure->m_pID; }
644
645 /// @brief Additional data where can needed on streams.
646 ///
647 /// @param[in] extraData List with memory of extra data
648 void SetExtraData(const std::vector<uint8_t>& extraData)
649 {
650 m_extraData = extraData;
651 m_cStructure->m_ExtraData = m_extraData.data();
652 m_cStructure->m_ExtraSize = m_extraData.size();
653 }
654
655 /// @brief Additional data where can needed on streams.
656 ///
657 /// @param[in] extraData Pointer with memory of extra data
658 /// @param[in] extraSize Size to store
659 void SetExtraData(const uint8_t* extraData, size_t extraSize)
660 {
661 m_extraData.clear();
662 if (extraData && extraSize > 0)
663 {
664 for (size_t i = 0; i < extraSize; ++i)
665 m_extraData.emplace_back(extraData[i]);
666 }
667
668 m_cStructure->m_ExtraData = m_extraData.data();
669 m_cStructure->m_ExtraSize = m_extraData.size();
670 }
671
672 /// @brief To get with @ref SetExtraData changed values.
673 const std::vector<uint8_t>& GetExtraData() { return m_extraData; }
674
675 /// @brief To get size with @ref SetExtraData changed values.
676 size_t GetExtraDataSize() { return m_extraData.size(); }
677
678 /// @brief Compare extra data from outside with class
679 ///
680 /// @param[in] extraData Pointer with memory of extra data for compare
681 /// @param[in] extraSize Size to compare
682 /// @return true if they equal, false otherwise
683 bool CompareExtraData(const uint8_t* extraData, size_t extraSize) const
684 {
685 if (!extraData || m_extraData.size() != extraSize)
686 return false;
687 for (size_t i = 0; i < extraSize; ++i)
688 {
689 if (m_extraData[i] != extraData[i])
690 return false;
691 }
692 return true;
693 }
694
695 /// @brief Clear additional data.
696 void ClearExtraData()
697 {
698 m_extraData.clear();
699 m_cStructure->m_ExtraData = m_extraData.data();
700 m_cStructure->m_ExtraSize = m_extraData.size();
701 }
702
703 /// @brief RFC 5646 language code (empty string if undefined).
704 ///
705 /// @param[in] language The language to set
706 void SetLanguage(const std::string& language)
707 {
708 strncpy(m_cStructure->m_language, language.c_str(), INPUTSTREAM_MAX_STRING_LANGUAGE_SIZE);
709 }
284 710
285 //! Audio stream related data 711 /// @brief To get with @ref SetLanguage changed values.
286 //@{ 712 std::string GetLanguage() const { return m_cStructure->m_language; }
287 713
288 //! @brief (required) amount of channels 714 /// @brief Scale of 1000 and a rate of 29970 will result in 29.97 fps.
289 unsigned int m_Channels; 715 ///
716 /// @param[in] fpsScale Scale rate
717 void SetFpsScale(unsigned int fpsScale) { m_cStructure->m_FpsScale = fpsScale; }
290 718
291 //! @brief (required) sample rate 719 /// @brief To get with @ref SetFpsScale changed values.
292 unsigned int m_SampleRate; 720 unsigned int GetFpsScale() const { return m_cStructure->m_FpsScale; }
293 721
294 //! @brief (required) bit rate 722 /// @brief Rate to use for stream.
295 unsigned int m_BitRate; 723 ///
724 /// @param[in] fpsRate Rate to use
725 void SetFpsRate(unsigned int fpsRate) { m_cStructure->m_FpsRate = fpsRate; }
296 726
297 //! @brief (required) bits per sample 727 /// @brief To get with @ref SetFpsRate changed values.
298 unsigned int m_BitsPerSample; 728 unsigned int GetFpsRate() const { return m_cStructure->m_FpsRate; }
299 729
300 unsigned int m_BlockAlign; 730 /// @brief Height of the stream reported by the demuxer.
731 ///
732 /// @param[in] height Height to use
733 void SetHeight(unsigned int height) { m_cStructure->m_Height = height; }
301 734
302 //@} 735 /// @brief To get with @ref SetHeight changed values.
736 unsigned int GetHeight() const { return m_cStructure->m_Height; }
303 737
304 CRYPTO_INFO m_cryptoInfo; 738 /// @brief Width of the stream reported by the demuxer.
739 ///
740 /// @param[in] width Width to use
741 void SetWidth(unsigned int width) { m_cStructure->m_Width = width; }
305 742
306 // new in API version 2.0.8 743 /// @brief To get with @ref SetWidth changed values.
307 //@{ 744 unsigned int GetWidth() const { return m_cStructure->m_Width; }
308 //! @brief Codec If available, the fourcc code codec
309 unsigned int m_codecFourCC;
310 745
311 //! @brief definition of colorspace 746 /// @brief Display aspect of stream.
312 COLORSPACE m_colorSpace; 747 ///
748 /// @param[in] aspect Aspect ratio to use
749 void SetAspect(float aspect) { m_cStructure->m_Aspect = aspect; }
313 750
314 //! @brief color range if available 751 /// @brief To get with @ref SetAspect changed values.
315 COLORRANGE m_colorRange; 752 float GetAspect() const { return m_cStructure->m_Aspect; }
316 //@}
317 753
318 //new in API 2.0.9 / INPUTSTREAM_VERSION_LEVEL 1 754 /// @brief (required) Amount of channels.
319 //@{ 755 ///
320 COLORPRIMARIES m_colorPrimaries; 756 /// @param[in] sampleRate Channels to use
321 COLORTRC m_colorTransferCharacteristic; 757 void SetChannels(unsigned int channels) { m_cStructure->m_Channels = channels; }
322 //@}
323 758
324 //! @brief mastering static Metadata 759 /// @brief To get with @ref SetChannels changed values.
325 INPUTSTREAM_MASTERING_METADATA* m_masteringMetadata; 760 unsigned int GetChannels() const { return m_cStructure->m_Channels; }
326 761
327 //! @brief content light static Metadata 762 /// @brief (required) Sample rate.
328 INPUTSTREAM_CONTENTLIGHT_METADATA* m_contentLightMetadata; 763 ///
329 }; 764 /// @param[in] sampleRate Rate to use
765 void SetSampleRate(unsigned int sampleRate) { m_cStructure->m_SampleRate = sampleRate; }
330 766
331 struct INPUTSTREAM_TIMES 767 /// @brief To get with @ref SetSampleRate changed values.
768 unsigned int GetSampleRate() const { return m_cStructure->m_SampleRate; }
769
770 /// @brief Bit rate.
771 ///
772 /// @param[in] bitRate Rate to use
773 void SetBitRate(unsigned int bitRate) { m_cStructure->m_BitRate = bitRate; }
774
775 /// @brief To get with @ref SetBitRate changed values.
776 unsigned int GetBitRate() const { return m_cStructure->m_BitRate; }
777
778 /// @brief (required) Bits per sample.
779 ///
780 /// @param[in] bitsPerSample Bits per sample to use
781 void SetBitsPerSample(unsigned int bitsPerSample)
332 { 782 {
333 time_t startTime; 783 m_cStructure->m_BitsPerSample = bitsPerSample;
334 double ptsStart; 784 }
335 double ptsBegin;
336 double ptsEnd;
337 };
338 785
339 /*! 786 /// @brief To get with @ref SetBitsPerSample changed values.
340 * @brief "C" ABI Structures to transfer the methods from this to Kodi 787 unsigned int GetBitsPerSample() const { return m_cStructure->m_BitsPerSample; }
341 */
342 788
343 // this are properties given to the addon on create 789 /// @brief To set the necessary stream block alignment size.
344 // at this time we have no parameters for the addon 790 ///
345 typedef struct AddonProps_InputStream /* internal */ 791 /// @param[in] blockAlign Block size in byte
792 void SetBlockAlign(unsigned int blockAlign) { m_cStructure->m_BlockAlign = blockAlign; }
793
794 /// @brief To get with @ref SetBlockAlign changed values.
795 unsigned int GetBlockAlign() const { return m_cStructure->m_BlockAlign; }
796
797 /// @brief To set stream crypto session informations.
798 ///
799 /// @param[in] cryptoSession The with @ref cpp_kodi_addon_inputstream_Defs_Interface_StreamCryptoSession setable info
800 ///
801 void SetCryptoSession(const kodi::addon::StreamCryptoSession& cryptoSession)
346 { 802 {
347 int dummy; 803 m_cryptoSession = cryptoSession;
348 } AddonProps_InputStream; 804 memcpy(&m_cStructure->m_cryptoSession, m_cryptoSession.GetCStructure(),
805 sizeof(STREAM_CRYPTO_SESSION));
806 }
807
808 /// @brief To get with @ref GetCryptoSession changed values.
809 const kodi::addon::StreamCryptoSession& GetCryptoSession() const { return m_cryptoSession; }
349 810
350 typedef struct AddonToKodiFuncTable_InputStream /* internal */ 811 /// @brief Codec If available, the fourcc code codec.
812 ///
813 /// @param[in] codecFourCC Codec four CC code
814 void SetCodecFourCC(unsigned int codecFourCC) { m_cStructure->m_codecFourCC = codecFourCC; }
815
816 /// @brief To get with @ref SetCodecFourCC changed values
817 unsigned int GetCodecFourCC() const { return m_cStructure->m_codecFourCC; }
818
819 /// @brief Definition of colorspace.
820 ///
821 /// @param[in] colorSpace The with @ref INPUTSTREAM_COLORSPACE setable color space
822 void SetColorSpace(INPUTSTREAM_COLORSPACE colorSpace) { m_cStructure->m_colorSpace = colorSpace; }
823
824 /// @brief To get with @ref SetColorSpace changed values.
825 INPUTSTREAM_COLORSPACE GetColorSpace() const { return m_cStructure->m_colorSpace; }
826
827 /// @brief Color range if available.
828 ///
829 /// @param[in] colorRange The with @ref INPUTSTREAM_COLORRANGE setable color space
830 void SetColorRange(INPUTSTREAM_COLORRANGE colorRange) { m_cStructure->m_colorRange = colorRange; }
831
832 /// @brief To get with @ref SetColorRange changed values.
833 INPUTSTREAM_COLORRANGE GetColorRange() const { return m_cStructure->m_colorRange; }
834
835 /// @brief Chromaticity coordinates of the source primaries. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.
836 ///
837 /// @param[in] colorPrimaries The with @ref INPUTSTREAM_COLORPRIMARIES setable values
838 void SetColorPrimaries(INPUTSTREAM_COLORPRIMARIES colorPrimaries)
351 { 839 {
352 KODI_HANDLE kodiInstance; 840 m_cStructure->m_colorPrimaries = colorPrimaries;
353 DemuxPacket* (*allocate_demux_packet)(void* kodiInstance, int data_size); 841 }
354 DemuxPacket* (*allocate_encrypted_demux_packet)(void* kodiInstance, 842
355 unsigned int data_size, 843 /// @brief To get with @ref SetColorPrimaries changed values.
356 unsigned int encrypted_subsample_count); 844 INPUTSTREAM_COLORPRIMARIES GetColorPrimaries() const { return m_cStructure->m_colorPrimaries; }
357 void (*free_demux_packet)(void* kodiInstance, DemuxPacket* packet);
358 } AddonToKodiFuncTable_InputStream;
359 845
360 struct AddonInstance_InputStream; 846 /// @brief Color Transfer Characteristic. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2.
361 typedef struct KodiToAddonFuncTable_InputStream /* internal */ 847 ///
848 /// @param[in] colorTransferCharacteristic The with @ref INPUTSTREAM_COLORTRC setable characteristic
849 void SetColorTransferCharacteristic(INPUTSTREAM_COLORTRC colorTransferCharacteristic)
362 { 850 {
363 KODI_HANDLE addonInstance; 851 m_cStructure->m_colorTransferCharacteristic = colorTransferCharacteristic;
852 }
364 853
365 bool(__cdecl* open)(const AddonInstance_InputStream* instance, INPUTSTREAM* props); 854 /// @brief To get with @ref SetColorTransferCharacteristic changed values.
366 void(__cdecl* close)(const AddonInstance_InputStream* instance); 855 INPUTSTREAM_COLORTRC GetColorTransferCharacteristic() const
367 const char*(__cdecl* get_path_list)(const AddonInstance_InputStream* instance); 856 {
368 void(__cdecl* get_capabilities)(const AddonInstance_InputStream* instance, 857 return m_cStructure->m_colorTransferCharacteristic;
369 INPUTSTREAM_CAPABILITIES* capabilities); 858 }
370 859
371 // IDemux 860 /// @brief Mastering static Metadata.
372 struct INPUTSTREAM_IDS(__cdecl* get_stream_ids)(const AddonInstance_InputStream* instance); 861 ///
373 struct INPUTSTREAM_INFO(__cdecl* get_stream)(const AddonInstance_InputStream* instance, 862 /// Describes the metadata for HDR10, used when video is compressed using High
374 int streamid); 863 /// Efficiency Video Coding (HEVC). This is used to describe the capabilities
375 void(__cdecl* enable_stream)(const AddonInstance_InputStream* instance, 864 /// of the display used to master the content and the luminance values of the
376 int streamid, 865 /// content.
377 bool enable); 866 ///
378 bool(__cdecl* open_stream)(const AddonInstance_InputStream* instance, int streamid); 867 /// @param[in] masteringMetadata The with @ref cpp_kodi_addon_inputstream_Defs_Interface_InputstreamMasteringMetadata setable metadata
379 void(__cdecl* demux_reset)(const AddonInstance_InputStream* instance); 868 void SetMasteringMetadata(const kodi::addon::InputstreamMasteringMetadata& masteringMetadata)
380 void(__cdecl* demux_abort)(const AddonInstance_InputStream* instance); 869 {
381 void(__cdecl* demux_flush)(const AddonInstance_InputStream* instance); 870 m_masteringMetadata = masteringMetadata;
382 DemuxPacket*(__cdecl* demux_read)(const AddonInstance_InputStream* instance); 871 m_cStructure->m_masteringMetadata = m_masteringMetadata;
383 bool(__cdecl* demux_seek_time)(const AddonInstance_InputStream* instance, 872 }
384 double time,
385 bool backwards,
386 double* startpts);
387 void(__cdecl* demux_set_speed)(const AddonInstance_InputStream* instance, int speed);
388 void(__cdecl* set_video_resolution)(const AddonInstance_InputStream* instance,
389 int width,
390 int height);
391 873
392 // IDisplayTime 874 /// @brief To get with @ref SetMasteringMetadata changed values.
393 int(__cdecl* get_total_time)(const AddonInstance_InputStream* instance); 875 const kodi::addon::InputstreamMasteringMetadata& GetMasteringMetadata() const
394 int(__cdecl* get_time)(const AddonInstance_InputStream* instance); 876 {
877 return m_masteringMetadata;
878 }
395 879
396 // ITime 880 /// @brief Clear mastering static Metadata.
397 bool(__cdecl* get_times)(const AddonInstance_InputStream* instance, INPUTSTREAM_TIMES* times); 881 void ClearMasteringMetadata() { m_cStructure->m_masteringMetadata = nullptr; }
398 882
399 // IPosTime 883 /// @brief Content light static Metadata.
400 bool(__cdecl* pos_time)(const AddonInstance_InputStream* instance, int ms); 884 ///
885 /// The maximum content light level (MaxCLL) and frame average light level
886 /// (MaxFALL) for the metadata for HDR10.
887 ///
888 /// @param[in] contentLightMetadata The with @ref cpp_kodi_addon_inputstream_Defs_Interface_InputstreamContentlightMetadata setable metadata
889 void SetContentLightMetadata(
890 const kodi::addon::InputstreamContentlightMetadata& contentLightMetadata)
891 {
892 m_contentLightMetadata = contentLightMetadata;
893 m_cStructure->m_contentLightMetadata = m_contentLightMetadata;
894 }
401 895
402 int(__cdecl* read_stream)(const AddonInstance_InputStream* instance, 896 /// @brief To get with @ref SetContentLightMetadata changed values.
403 uint8_t* buffer, 897 const kodi::addon::InputstreamContentlightMetadata& GetContentLightMetadata() const
404 unsigned int bufferSize); 898 {
405 int64_t(__cdecl* seek_stream)(const AddonInstance_InputStream* instance, 899 return m_contentLightMetadata;
406 int64_t position, 900 }
407 int whence);
408 int64_t(__cdecl* position_stream)(const AddonInstance_InputStream* instance);
409 int64_t(__cdecl* length_stream)(const AddonInstance_InputStream* instance);
410 bool(__cdecl* is_real_time_stream)(const AddonInstance_InputStream* instance);
411 901
412 // IChapter 902 /// @brief Clear content light static Metadata.
413 int(__cdecl* get_chapter)(const AddonInstance_InputStream* instance); 903 void ClearContentLightMetadata() { m_cStructure->m_contentLightMetadata = nullptr; }
414 int(__cdecl* get_chapter_count)(const AddonInstance_InputStream* instance);
415 const char*(__cdecl* get_chapter_name)(const AddonInstance_InputStream* instance, int ch);
416 int64_t(__cdecl* get_chapter_pos)(const AddonInstance_InputStream* instance, int ch);
417 bool(__cdecl* seek_chapter)(const AddonInstance_InputStream* instance, int ch);
418 904
419 int(__cdecl* block_size_stream)(const AddonInstance_InputStream* instance); 905 ///@}
420 } KodiToAddonFuncTable_InputStream;
421 906
422 typedef struct AddonInstance_InputStream /* internal */ 907private:
908 InputstreamInfo(const INPUTSTREAM_INFO* stream) : CStructHdl(stream)
423 { 909 {
424 AddonProps_InputStream* props; 910 SetCryptoSession(StreamCryptoSession(&stream->m_cryptoSession));
425 AddonToKodiFuncTable_InputStream* toKodi; 911 CopyExtraData();
426 KodiToAddonFuncTable_InputStream* toAddon; 912 }
427 } AddonInstance_InputStream; 913 InputstreamInfo(INPUTSTREAM_INFO* stream) : CStructHdl(stream)
914 {
915 SetCryptoSession(StreamCryptoSession(&stream->m_cryptoSession));
916 CopyExtraData();
917 }
428 918
429#ifdef __cplusplus 919 void CopyExtraData()
430} /* extern "C" */ 920 {
921 if (m_cStructure->m_ExtraData && m_cStructure->m_ExtraSize > 0)
922 {
923 for (unsigned int i = 0; i < m_cStructure->m_ExtraSize; ++i)
924 m_extraData.emplace_back(m_cStructure->m_ExtraData[i]);
925 }
926 if (m_cStructure->m_masteringMetadata)
927 m_masteringMetadata = m_cStructure->m_masteringMetadata;
928 if (m_cStructure->m_contentLightMetadata)
929 m_contentLightMetadata = m_cStructure->m_contentLightMetadata;
930 }
931 std::vector<uint8_t> m_extraData;
932 StreamCryptoSession m_cryptoSession;
933 InputstreamMasteringMetadata m_masteringMetadata;
934 InputstreamContentlightMetadata m_contentLightMetadata;
935};
936///@}
937//------------------------------------------------------------------------------
431 938
432namespace kodi 939//==============================================================================
433{ 940/// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamTimes class InputstreamTimes
434namespace addon 941/// @ingroup cpp_kodi_addon_inputstream_Defs_Interface
942/// @brief **Inputstream add-on times**\n
943/// Used on @ref kodi::addon::CInstanceInputStream::GetTimes().
944///
945/// ----------------------------------------------------------------------------
946///
947/// @copydetails cpp_kodi_addon_inputstream_Defs_Interface_InputstreamTimes_Help
948///
949///@{
950class ATTRIBUTE_HIDDEN InputstreamTimes : public CStructHdl<InputstreamTimes, INPUTSTREAM_TIMES>
435{ 951{
952 /*! \cond PRIVATE */
953 friend class CInstanceInputStream;
954 /*! \endcond */
955
956public:
957 /*! \cond PRIVATE */
958 InputstreamTimes() = default;
959 InputstreamTimes(const InputstreamTimes& stream) : CStructHdl(stream) {}
960 /*! \endcond */
961
962 /// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamTimes_Help Value Help
963 /// @ingroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamTimes
964 ///
965 /// <b>The following table contains values that can be set with @ref cpp_kodi_addon_inputstream_Defs_Interface_InputstreamTimes :</b>
966 /// | Name | Type | Set call | Get call
967 /// |------|------|----------|--------------------
968 /// | **Start time** | `time_t` | @ref InputstreamTimes::SetStartTime "SetStartTime" | @ref InputstreamTimes::GetStartTime "GetStartTime"
969 /// | **PTS start** | `double` | @ref InputstreamTimes::SetPtsStart "SetPtsStart" | @ref InputstreamTimes::GetPtsStart "GetPtsStart"
970 /// | **PTS begin** | `double` | @ref InputstreamTimes::SetPtsBegin "SetPtsBegin" | @ref InputstreamTimes::GetPtsBegin "GetPtsBegin"
971 /// | **PTS end** | `double` | @ref InputstreamTimes::SetPtsEnd "SetPtsEnd" | @ref InputstreamTimes::GetPtsEnd "GetPtsEnd"
972 ///
973
974 /// @addtogroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamTimes
975 ///@{
976
977 /// @brief Start time in milliseconds
978 void SetStartTime(time_t startTime) const { m_cStructure->startTime = startTime; }
979
980 /// @brief To get with @ref SetStartTime changed values
981 time_t GetStartTime() const { return m_cStructure->startTime; }
982
983 /// @brief Start PTS
984 void SetPtsStart(double ptsStart) const { m_cStructure->ptsStart = ptsStart; }
985
986 /// @brief To get with @ref SetPtsStart changed values
987 double GetPtsStart() const { return m_cStructure->ptsStart; }
436 988
989 /// @brief Begin PTS
990 void SetPtsBegin(double ptsBegin) const { m_cStructure->ptsBegin = ptsBegin; }
991
992 /// @brief To get with @ref SetPtsBegin changed values
993 double GetPtsBegin() const { return m_cStructure->ptsBegin; }
994
995 /// @brief End PTS
996 void SetPtsEnd(double ptsEnd) const { m_cStructure->ptsEnd = ptsEnd; }
997
998 /// @brief To get with @ref SetPtsEnd changed values
999 double GetPtsEnd() const { return m_cStructure->ptsEnd; }
1000
1001 ///@}
1002
1003private:
1004 InputstreamTimes(const INPUTSTREAM_TIMES* stream) : CStructHdl(stream) {}
1005 InputstreamTimes(INPUTSTREAM_TIMES* stream) : CStructHdl(stream) {}
1006};
1007///@}
1008//------------------------------------------------------------------------------
1009
1010//============================================================================
1011///
1012/// @addtogroup cpp_kodi_addon_inputstream
1013/// @brief \cpp_class{ kodi::addon::CInstanceInputStream }
1014/// **Inputstream add-on instance**
1015///
1016/// This instance type is for using input streams to video and audio, to process
1017/// and then give them to Kodi.
1018///
1019/// This usage can be requested under various conditions, for example explicitly
1020/// by another addon, by a Mimetype protocol defined in `addon.xml` or supported
1021/// file extensions.
1022///
1023/// In addition, stream files (* .strm) can be linked to an inputstream addon
1024/// using <b>`#KODIPROP:inputstream=<ADDON_NAME>`</b>.
1025///
1026/// Include the header @ref Inputstream.h "#include <kodi/addon-instance/Inputstream.h>"
1027/// to use this class.
1028///
1029/// ----------------------------------------------------------------------------
1030///
1031/// Here is an example of what the <b>`addon.xml.in`</b> would look like for an inputstream addon:
1032///
1033/// ~~~~~~~~~~~~~{.xml}
1034/// <?xml version="1.0" encoding="UTF-8"?>
1035/// <addon
1036/// id="inputstream.myspecialnamefor"
1037/// version="1.0.0"
1038/// name="My InputStream addon"
1039/// provider-name="Your Name">
1040/// <requires>@ADDON_DEPENDS@</requires>
1041/// <extension
1042/// point="kodi.inputstream"
1043/// extension=".xyz|.zyx"
1044/// listitemprops="license_type|license_key|license_data|license_flags"
1045/// protocols="myspecialnamefor|myspecialnamefors"
1046/// library_@PLATFORM@="@LIBRARY_FILENAME@"/>
1047/// <extension point="xbmc.addon.metadata">
1048/// <summary lang="en_GB">My InputStream addon</summary>
1049/// <description lang="en_GB">My InputStream description</description>
1050/// <platform>@PLATFORM@</platform>
1051/// </extension>
1052/// </addon>
1053/// ~~~~~~~~~~~~~
1054///
1055///
1056/// At <b>`<extension point="kodi.inputstream" ...>`</b> the basic instance definition is declared, this is intended to identify the addon as an input stream and to see its supported types:
1057/// | Name | Description
1058/// |------|----------------------
1059/// | <b>`point`</b> | The identification of the addon instance to inputstream is mandatory <b>`kodi.inputstream`</b>. In addition, the instance declared in the first <b>`<extension ... />`</b> is also
1060/// | <b>`extension`</b> | A filename extension is an identifier specified as a suffix to the name of a computer file where supported by addon.
1061/// | <b>`listitemprops`</b> | Values that are available to the addon at @ref InputstreamProperty::GetProperties() and that can be passed to @ref CInstanceInputStream::Open() ith the respective values.
1062/// | <b>`protocols`</b> | The streaming protocol is a special protocol supported by the addon for the transmission of streaming media data over a network.
1063/// | <b>`library_@PLATFORM@`</b> | The runtime library used for the addon. This is usually declared by cmake and correctly displayed in the translated `addon.xml`.
1064///
1065///
1066/// @remark For more detailed description of the <b>`addon.xml`</b>, see also https://kodi.wiki/view/Addon.xml.
1067///
1068///
1069/// --------------------------------------------------------------------------
1070///
1071///
1072/// **Example:**
1073///
1074/// ~~~~~~~~~~~~~{.cpp}
1075/// #include <kodi/addon-instance/Inputstream.h>
1076///
1077/// class CMyInputstream : public kodi::addon::CInstanceInputStream
1078/// {
1079/// public:
1080/// CMyInputstream(KODI_HANDLE instance, const std::string& kodiVersion);
1081///
1082/// void GetCapabilities(kodi::addon::InputstreamCapabilities& capabilities) override;
1083/// bool Open(const kodi::addon::InputstreamProperty& props) override;
1084/// void Close() override;
1085/// ...
1086/// };
1087///
1088/// CMyInputstream::CMyInputstream(KODI_HANDLE instance, const std::string& kodiVersion)
1089/// : kodi::addon::CInstanceInputStream(instance, kodiVersion)
1090/// {
1091/// ...
1092/// }
1093///
1094/// void CMyInputstream::GetCapabilities(kodi::addon::InputstreamCapabilities& capabilities)
1095/// {
1096/// capabilities.SetMask(INPUTSTREAM_SUPPORTS_IDEMUX | INPUTSTREAM_SUPPORTS_PAUSE);
1097/// }
1098///
1099/// void CMyInputstream::Open(const kodi::addon::InputstreamProperty& props)
1100/// {
1101/// std::string url = props.GetURL();
1102/// ...
1103/// }
1104///
1105/// void CMyInputstream::Close()
1106/// {
1107/// ...
1108/// }
1109///
1110/// ...
1111///
1112/// //----------------------------------------------------------------------
1113///
1114/// class CMyAddon : public kodi::addon::CAddonBase
1115/// {
1116/// public:
1117/// CMyAddon() = default;
1118/// ADDON_STATUS CreateInstance(int instanceType,
1119/// std::string instanceID,
1120/// KODI_HANDLE instance,
1121/// const std::string& version,
1122/// KODI_HANDLE& addonInstance) override;
1123/// };
1124///
1125/// // If you use only one instance in your add-on, can be instanceType and
1126/// // instanceID ignored
1127/// ADDON_STATUS CMyAddon::CreateInstance(int instanceType,
1128/// std::string instanceID,
1129/// KODI_HANDLE instance,
1130/// const std::string& version,
1131/// KODI_HANDLE& addonInstance)
1132/// {
1133/// if (instanceType == ADDON_INSTANCE_INPUTSTREAM)
1134/// {
1135/// kodi::Log(ADDON_LOG_NOTICE, "Creating my Inputstream");
1136/// addonInstance = new CMyInputstream(instance, version);
1137/// return ADDON_STATUS_OK;
1138/// }
1139/// else if (...)
1140/// {
1141/// ...
1142/// }
1143/// return ADDON_STATUS_UNKNOWN;
1144/// }
1145///
1146/// ADDONCREATOR(CMyAddon)
1147/// ~~~~~~~~~~~~~
1148///
1149/// The destruction of the example class `CMyInputstream` is called from
1150/// Kodi's header. Manually deleting the add-on instance is not required.
1151///
1152//------------------------------------------------------------------------------
437class ATTRIBUTE_HIDDEN CInstanceInputStream : public IAddonInstance 1153class ATTRIBUTE_HIDDEN CInstanceInputStream : public IAddonInstance
438{ 1154{
439public: 1155public:
1156 //============================================================================
1157 /// @ingroup cpp_kodi_addon_inputstream
1158 /// @brief Inputstream class constructor used to support multiple instance
1159 /// types
1160 ///
1161 /// @param[in] instance The instance value given to <b>`kodi::addon::CAddonBase::CreateInstance(...)`</b>
1162 /// @param[in] kodiVersion [opt] Version used in Kodi for this instance, to
1163 /// allow compatibility to older Kodi versions.
1164 ///
1165 /// @warning Only use `instance` from the @ref CAddonBase::CreateInstance call.
1166 ///
440 explicit CInstanceInputStream(KODI_HANDLE instance, const std::string& kodiVersion = "") 1167 explicit CInstanceInputStream(KODI_HANDLE instance, const std::string& kodiVersion = "")
441 : IAddonInstance(ADDON_INSTANCE_INPUTSTREAM, 1168 : IAddonInstance(ADDON_INSTANCE_INPUTSTREAM,
442 !kodiVersion.empty() ? kodiVersion 1169 !kodiVersion.empty() ? kodiVersion
@@ -448,242 +1175,590 @@ public:
448 1175
449 SetAddonStruct(instance, m_kodiVersion); 1176 SetAddonStruct(instance, m_kodiVersion);
450 } 1177 }
1178 //----------------------------------------------------------------------------
451 1179
1180 //============================================================================
1181 /// @ingroup cpp_kodi_addon_inputstream
1182 /// @brief Destructor
1183 ///
452 ~CInstanceInputStream() override = default; 1184 ~CInstanceInputStream() override = default;
1185 //----------------------------------------------------------------------------
453 1186
454 /*! 1187 //============================================================================
455 * Open a stream. 1188 /// @ingroup cpp_kodi_addon_inputstream
456 * @param props 1189 /// @brief Get the list of features that this add-on provides.
457 * @return True if the stream has been opened successfully, false otherwise. 1190 ///
458 * @remarks 1191 /// Called by Kodi to query the add-on's capabilities.
459 */ 1192 /// Used to check which options should be presented in the UI, which methods to call, etc.
460 virtual bool Open(INPUTSTREAM& props) = 0; 1193 /// All capabilities that the add-on supports should be set to true.
1194 ///
1195 /// @param[out] capabilities The with @ref cpp_kodi_addon_inputstream_Defs_Capabilities defined add-on's capabilities.
1196 ///
1197 ///
1198 /// --------------------------------------------------------------------------
1199 ///
1200 /// @copydetails cpp_kodi_addon_inputstream_Defs_Interface_InputstreamCapabilities_Help
1201 ///
1202 /// --------------------------------------------------------------------------
1203 /// @note Valid implementation required.
1204 ///
1205 ///
1206 /// --------------------------------------------------------------------------
1207 ///
1208 /// **Example:**
1209 ///
1210 /// ~~~~~~~~~~~~~{.cpp}
1211 /// void CMyInputstream::GetCapabilities(kodi::addon::InputstreamCapabilities& capabilities)
1212 /// {
1213 /// capabilities.SetMask(INPUTSTREAM_SUPPORTS_IDEMUX | INPUTSTREAM_SUPPORTS_PAUSE);
1214 /// }
1215 /// ~~~~~~~~~~~~~
1216 ///
1217 virtual void GetCapabilities(kodi::addon::InputstreamCapabilities& capabilities) = 0;
1218 //----------------------------------------------------------------------------
461 1219
462 /*! 1220 //============================================================================
463 * Close an open stream. 1221 /// @ingroup cpp_kodi_addon_inputstream
464 * @remarks 1222 /// @brief Open a stream.
465 */ 1223 ///
1224 /// @param[in] props The used properties about the stream
1225 /// @return True if the stream has been opened successfully, false otherwise.
1226 ///
1227 ///
1228 /// --------------------------------------------------------------------------
1229 ///
1230 /// @copydetails cpp_kodi_addon_inputstream_Defs_InputstreamProperty_Help
1231 ///
1232 /// --------------------------------------------------------------------------
1233 /// @note Valid implementation required.
1234 ///
1235 ///
1236 /// --------------------------------------------------------------------------
1237 ///
1238 /// **Example:**
1239 ///
1240 /// ~~~~~~~~~~~~~{.cpp}
1241 /// void CMyInputstream::Open(const kodi::addon::InputstreamProperty& props)
1242 /// {
1243 /// std::string url = props.GetURL();
1244 /// std::string license_key = props.GetProperties()["inputstream.myspecialnamefor.license_key"];
1245 /// ...
1246 /// }
1247 /// ~~~~~~~~~~~~~
1248 ///
1249 virtual bool Open(const kodi::addon::InputstreamProperty& props) = 0;
1250 //----------------------------------------------------------------------------
1251
1252 //============================================================================
1253 /// @ingroup cpp_kodi_addon_inputstream
1254 /// @brief Close an open stream.
1255 ///
1256 /// @remarks
1257 ///
1258 ///
1259 /// --------------------------------------------------------------------------
1260 /// @note Valid implementation required.
1261 ///
466 virtual void Close() = 0; 1262 virtual void Close() = 0;
1263 //----------------------------------------------------------------------------
467 1264
468 /*! 1265 //============================================================================
469 * Get Capabilities of this addon. 1266 /// @ingroup cpp_kodi_addon_inputstream
470 * @param capabilities The add-on's capabilities. 1267 /// @brief Check for real-time streaming
471 * @remarks 1268 ///
472 */ 1269 /// @return true if current stream is real-time
473 virtual void GetCapabilities(INPUTSTREAM_CAPABILITIES& capabilities) = 0; 1270 ///
1271 virtual bool IsRealTimeStream() { return true; }
1272 //----------------------------------------------------------------------------
474 1273
475 /*! 1274 //############################################################################
476 * Get IDs of available streams 1275 /// @defgroup cpp_kodi_addon_inputstream_Read 1. Stream read
477 * @remarks 1276 /// @brief **Functions required to read streams direct and demux inside Kodi.**
478 */ 1277 ///
479 virtual INPUTSTREAM_IDS GetStreamIds() = 0; 1278 /// This part contains at least the functions necessary for addon that have to
1279 /// be supported. This can only be ignored if you use your own demux.
1280 ///
1281 /// The data loaded by Kodi is then processed in it itself. The source does not
1282 /// matter, only Kodi must be able to process this stream data itself and is
1283 /// therefore limited in some things.
1284 ///
1285 /// For more complex things, the addon must integrate its own demuxer and,
1286 /// if necessary, even its own codec processing (see @ref cpp_kodi_addon_codec "Codec").
1287 ///
1288 /// @note These are used and must be set by the addon if the @ref INPUTSTREAM_SUPPORTS_IDEMUX
1289 /// is <em><b>undefined</b></em> in the capabilities (see @ref GetCapabilities()).
1290 /// Otherwise becomes @ref cpp_kodi_addon_inputstream_Demux "demuxing" used.
1291 ///
1292 /// @ingroup cpp_kodi_addon_inputstream
1293 ///@{
480 1294
481 /*! 1295 //============================================================================
482 * Get stream properties of a stream. 1296 /// @brief Read from an open stream.
483 * @param streamid unique id of stream 1297 ///
484 * @return struc of stream properties 1298 /// @param[in] buffer The buffer to store the data in.
485 * @remarks 1299 /// @param[in] bufferSize The amount of bytes to read.
486 */ 1300 /// @return The amount of bytes that were actually read from the stream.
487 virtual INPUTSTREAM_INFO GetStream(int streamid) = 0; 1301 ///
1302 virtual int ReadStream(uint8_t* buffer, unsigned int bufferSize) { return -1; }
1303 //----------------------------------------------------------------------------
488 1304
489 /*! 1305 //============================================================================
490 * Enable or disable a stream. 1306 /// @brief Seek in a stream.
491 * A disabled stream does not send demux packets 1307 ///
492 * @param streamid unique id of stream 1308 /// @param[in] position The position to seek to
493 * @param enable true for enable, false for disable 1309 /// @param[in] whence offset relative to<br>
494 * @remarks 1310 /// You can set the value of whence to one of three things:
495 */ 1311 /// | Value | int | Description |
496 virtual void EnableStream(int streamid, bool enable) = 0; 1312 /// |:------------:|:-----:|:----------------------------------------------------|
1313 /// | **SEEK_SET** | `0` | position is relative to the beginning of the file. This is probably what you had in mind anyway, and is the most commonly used value for whence.
1314 /// | **SEEK_CUR** | `1` | position is relative to the current file pointer position. So, in effect, you can say, "Move to my current position plus 30 bytes," or, "move to my current position minus 20 bytes."
1315 /// | **SEEK_END** | `2` | position is relative to the end of the file. Just like SEEK_SET except from the other end of the file. Be sure to use negative values for offset if you want to back up from the end of the file, instead of going past the end into oblivion.
1316 ///
1317 /// @return Returns the resulting offset location as measured in bytes from
1318 /// the beginning of the file. On error, the value -1 is returned.
1319 ///
1320 /// @remarks Optional and can leaved away or return -1 if this add-on won't
1321 /// provide this function.
1322 ///
1323 virtual int64_t SeekStream(int64_t position, int whence = SEEK_SET) { return -1; }
1324 //----------------------------------------------------------------------------
497 1325
498 /*! 1326 //============================================================================
499 * Opens a stream for playback. 1327 /// @brief The position in the stream that's currently being read.
500 * @param streamid unique id of stream 1328 ///
501 * @remarks 1329 /// @return Stream position
502 */ 1330 ///
503 virtual bool OpenStream(int streamid) = 0; 1331 /// @remarks Optional and can leaved away or return -1 if this add-on won't
1332 /// provide this function.
1333 ///
1334 virtual int64_t PositionStream() { return -1; }
1335 //----------------------------------------------------------------------------
1336
1337 //============================================================================
1338 /// @brief The Total length of the stream that's currently being read.
1339 ///
1340 /// @return Length of the stream
1341 ///
1342 /// @remarks Optional and can leaved away or return -1 if this add-on won't
1343 /// provide this function.
1344 ///
1345 virtual int64_t LengthStream() { return -1; }
1346 //--------------------------------------------------------------------------
1347
1348 //==========================================================================
1349 /// @brief Obtain the chunk size to use when reading streams.
1350 ///
1351 /// @return Block chunk size
1352 ///
1353 /// @remarks Optional and can leaved away or return 0 if this add-on won't
1354 /// provide this function.
1355 ///
1356 virtual int GetBlockSize() { return 0; }
1357 //--------------------------------------------------------------------------
1358
1359 ///@}
1360
1361 //############################################################################
1362 /// @defgroup cpp_kodi_addon_inputstream_Demux 2. Stream demuxing (optional)
1363 /// @brief **Read demux streams.**
1364 ///
1365 /// @note These are used and must be set by the addon if the @ref INPUTSTREAM_SUPPORTS_IDEMUX is set in the capabilities (see @ref GetCapabilities()).
1366 ///
1367 /// @ingroup cpp_kodi_addon_inputstream
1368 ///@{
1369
1370 //============================================================================
1371 /// @brief Get IDs of available streams
1372 ///
1373 /// @param[in] ids list of used identifications
1374 /// @return true if successfully done, otherwise false
1375 ///
1376 /// @remarks This id's are used to identify wanted data on @ref GetStream call.
1377 ///
1378 ///
1379 /// --------------------------------------------------------------------------
1380 ///
1381 /// **Example:**
1382 ///
1383 /// ~~~~~~~~~~~~~{.cpp}
1384 ///
1385 /// bool CMyInputstream::GetStreamIds(std::vector<unsigned int>& ids)
1386 /// {
1387 /// kodi::Log(ADDON_LOG_DEBUG, "GetStreamIds(...)");
1388 ///
1389 /// if (m_opened)
1390 /// {
1391 /// // This check not needed to have, the ABI checks also about, but make
1392 /// // sure you not give more as 32 streams.
1393 /// if (m_myStreams.size() > MAX_STREAM_COUNT)
1394 /// {
1395 /// kodi::Log(ADDON_LOG_ERROR, "Too many streams, only %u supported", MAX_STREAM_COUNT);
1396 /// return false;
1397 /// }
1398 ///
1399 /// ids.emplace_back(m_myAudioStreamId);
1400 ///
1401 /// for (const auto& streamPair : m_myOtherStreams)
1402 /// {
1403 /// ids.emplace_back(streamPair.second->uniqueId);
1404 /// }
1405 /// }
1406 ///
1407 /// return !ids.empty();
1408 /// }
1409 /// ~~~~~~~~~~~~~
1410 ///
1411 virtual bool GetStreamIds(std::vector<unsigned int>& ids) { return false; }
1412 //----------------------------------------------------------------------------
1413
1414 //============================================================================
1415 /// @brief Function for giving detailed stream information
1416 ///
1417 /// The associated information is set here for IDs previously given with
1418 /// @ref GetStreamIds.
1419 ///
1420 /// This data is required to identify the associated codec and, if necessary,
1421 /// to refer to your own codec (if available in the addon).
1422 ///
1423 /// @param[in] streamid unique id of stream
1424 /// @param[out] stream Information data of wanted stream
1425 /// @return true if successfully done, otherwise false
1426 ///
1427 /// @remarks Available stream id's previously asked by @ref GetStreamIds
1428 ///
1429 ///
1430 /// --------------------------------------------------------------------------
1431 ///
1432 /// @copydetails cpp_kodi_addon_inputstream_Defs_Interface_InputstreamInfo_Help
1433 ///
1434 /// --------------------------------------------------------------------------
1435 ///
1436 /// **Example:**
1437 ///
1438 /// ~~~~~~~~~~~~~{.cpp}
1439 /// bool CMyInputstream::GetStream(int streamid, kodi::addon::InputstreamInfo& stream)
1440 /// {
1441 /// // This is just a small example, this type will be significantly larger
1442 /// // for larger and more complex streams.
1443 /// if (streamid == m_myAudioStreamId)
1444 /// {
1445 /// // This only a minimal exampl
1446 /// stream.SetStreamType(INPUTSTREAM_TYPE_AUDIO);
1447 /// stream.SetFeatures(INPUTSTREAM_FEATURE_NONE); // Only added to example, INPUTSTREAM_FEATURE_NONE is default and no need to call
1448 /// stream.SetFlags(INPUTSTREAM_FLAG_NONE); // Only added to example, INPUTSTREAM_FLAG_NONE is default and no need to call
1449 /// stream.SetCodecName("mp2"); // Codec name, string must by equal with FFmpeg, see https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/codec_desc.c
1450 /// stream.SetPhysicalIndex(1); // Identifier required to set
1451 /// stream.SetLanguage("en");
1452 /// stream.SetChannels(2);
1453 /// stream.SetSampleRate(48000);
1454 /// stream.SetBitRate(0);
1455 /// stream.SetBitsPerSample(16);
1456 /// }
1457 /// else ...
1458 /// ...
1459 /// return true;
1460 /// }
1461 /// ~~~~~~~~~~~~~
1462 ///
1463 virtual bool GetStream(int streamid, kodi::addon::InputstreamInfo& stream) { return false; }
1464 //----------------------------------------------------------------------------
1465
1466 //============================================================================
1467 /// @brief Enable or disable a stream.
1468 ///
1469 /// A disabled stream does not send demux packets
1470 ///
1471 /// @param[in] streamid unique id of stream
1472 /// @param[in] enable true for enable, false for disable
1473 ///
1474 /// @remarks Available stream id's previously asked by @ref GetStreamIds
1475 ///
1476 ///
1477 /// --------------------------------------------------------------------------
1478 /// @note Valid implementation required.
1479 ///
1480 virtual void EnableStream(int streamid, bool enable) {}
1481 //----------------------------------------------------------------------------
504 1482
505 /*! 1483 //============================================================================
506 * Reset the demultiplexer in the add-on. 1484 /// @brief Opens a stream for playback.
507 * @remarks Required if bHandlesDemuxing is set to true. 1485 ///
508 */ 1486 /// @param[in] streamid unique id of stream
1487 ///
1488 /// @remarks Available stream id's previously asked by @ref GetStreamIds
1489 ///
1490 ///
1491 /// --------------------------------------------------------------------------
1492 /// @note Valid implementation required.
1493 ///
1494 virtual bool OpenStream(int streamid) { return false; }
1495 //----------------------------------------------------------------------------
1496
1497 //============================================================================
1498 /// @brief Reset the demultiplexer in the add-on.
1499 ///
1500 /// @remarks Optional, and only used if addon has its own demuxer.
1501 ///
509 virtual void DemuxReset() {} 1502 virtual void DemuxReset() {}
1503 //----------------------------------------------------------------------------
510 1504
511 /*! 1505 //============================================================================
512 * Abort the demultiplexer thread in the add-on. 1506 /// @brief Abort the demultiplexer thread in the add-on.
513 * @remarks Required if bHandlesDemuxing is set to true. 1507 ///
514 */ 1508 /// @remarks Optional, and only used if addon has its own demuxer.
1509 ///
515 virtual void DemuxAbort() {} 1510 virtual void DemuxAbort() {}
1511 //----------------------------------------------------------------------------
516 1512
517 /*! 1513 //============================================================================
518 * Flush all data that's currently in the demultiplexer buffer in the add-on. 1514 /// @brief Flush all data that's currently in the demultiplexer buffer in the add-on.
519 * @remarks Required if bHandlesDemuxing is set to true. 1515 ///
520 */ 1516 /// @remarks Optional, and only used if addon has its own demuxer.
1517 ///
521 virtual void DemuxFlush() {} 1518 virtual void DemuxFlush() {}
1519 //----------------------------------------------------------------------------
522 1520
523 /*! 1521 //============================================================================
524 * Read the next packet from the demultiplexer, if there is one. 1522 /// @brief Read the next packet from the demultiplexer, if there is one.
525 * @return The next packet. 1523 ///
526 * If there is no next packet, then the add-on should return the 1524 /// @return The next packet.
527 * packet created by calling AllocateDemuxPacket(0) on the callback. 1525 /// If there is no next packet, then the add-on should return the
528 * If the stream changed and Kodi's player needs to be reinitialised, 1526 /// packet created by calling @ref AllocateDemuxPacket "AllocateDemuxPacket(0)" on the callback.
529 * then, the add-on should call AllocateDemuxPacket(0) on the 1527 /// If the stream changed and Kodi's player needs to be reinitialised,
530 * callback, and set the streamid to DMX_SPECIALID_STREAMCHANGE and 1528 /// then, the add-on should call @ref AllocateDemuxPacket "AllocateDemuxPacket(0)" on the
531 * return the value. 1529 /// callback, and set the streamid to DMX_SPECIALID_STREAMCHANGE and
532 * The add-on should return NULL if an error occurred. 1530 /// return the value.
533 * @remarks Return NULL if this add-on won't provide this function. 1531 /// The add-on should return <b>`nullptr`</b> if an error occured.
534 */ 1532 ///
535 virtual DemuxPacket* DemuxRead() { return nullptr; } 1533 /// @remarks Return <b>`nullptr`</b> if this add-on won't provide this function.
1534 ///
1535 virtual DEMUX_PACKET* DemuxRead() { return nullptr; }
1536 //----------------------------------------------------------------------------
536 1537
537 /*! 1538 //============================================================================
538 * Notify the InputStream addon/demuxer that Kodi wishes to seek the stream by time 1539 /// @brief Notify the InputStream addon/demuxer that Kodi wishes to seek the stream by time
539 * Demuxer is required to set stream to an IDR frame 1540 ///
540 * @param time The absolute time since stream start 1541 /// Demuxer is required to set stream to an IDR frame
541 * @param backwards True to seek to keyframe BEFORE time, else AFTER 1542 ///
542 * @param startpts can be updated to point to where display should start 1543 /// @param[in] time The absolute time since stream start
543 * @return True if the seek operation was possible 1544 /// @param[in] backwards True to seek to keyframe BEFORE time, else AFTER
544 * @remarks Optional, and only used if addon has its own demuxer. 1545 /// @param[in] startpts can be updated to point to where display should start
545 */ 1546 /// @return True if the seek operation was possible
1547 ///
1548 /// @remarks Optional, and only used if addon has its own demuxer.
1549 ///
546 virtual bool DemuxSeekTime(double time, bool backwards, double& startpts) { return false; } 1550 virtual bool DemuxSeekTime(double time, bool backwards, double& startpts) { return false; }
1551 //----------------------------------------------------------------------------
547 1552
548 /*! 1553 //============================================================================
549 * Notify the InputStream addon/demuxer that Kodi wishes to change playback speed 1554 /// @brief Notify the InputStream addon/demuxer that Kodi wishes to change playback speed
550 * @param speed The requested playback speed 1555 ///
551 * @remarks Optional, and only used if addon has its own demuxer. 1556 /// @param[in] speed The requested playback speed
552 */ 1557 ///
1558 /// @remarks Optional, and only used if addon has its own demuxer.
1559 ///
553 virtual void DemuxSetSpeed(int speed) {} 1560 virtual void DemuxSetSpeed(int speed) {}
1561 //----------------------------------------------------------------------------
554 1562
555 /*! 1563 //============================================================================
556 * Sets desired width / height 1564 /// @brief Sets desired width / height
557 * @param width / hight 1565 ///
558 */ 1566 /// @param[in] width Width to set
1567 /// @param[in] height Height to set
1568 ///
559 virtual void SetVideoResolution(int width, int height) {} 1569 virtual void SetVideoResolution(int width, int height) {}
1570 //----------------------------------------------------------------------------
560 1571
561 /*! 1572 //=============================================================================
562 * Totel time in ms 1573 /// @brief Allocate a demux packet. Free with @ref FreeDemuxPacket
563 * @remarks 1574 ///
564 */ 1575 /// @param[in] dataSize The size of the data that will go into the packet
565 virtual int GetTotalTime() { return -1; } 1576 /// @return The allocated packet
1577 ///
1578 /// @remarks Only called from addon itself
1579 ///
1580 DEMUX_PACKET* AllocateDemuxPacket(int dataSize)
1581 {
1582 return m_instanceData->toKodi->allocate_demux_packet(m_instanceData->toKodi->kodiInstance,
1583 dataSize);
1584 }
1585 //----------------------------------------------------------------------------
566 1586
567 /*! 1587 //============================================================================
568 * Playing time in ms 1588 /// @brief Allocate a encrypted demux packet. Free with @ref FreeDemuxPacket
569 * @remarks 1589 ///
570 */ 1590 /// @param[in] dataSize The size of the data that will go into the packet
571 virtual int GetTime() { return -1; } 1591 /// @param[in] encryptedSubsampleCount The encrypted subsample count
1592 /// @return The allocated packet
1593 ///
1594 /// @remarks Only called from addon itself
1595 ///
1596 DEMUX_PACKET* AllocateEncryptedDemuxPacket(int dataSize, unsigned int encryptedSubsampleCount)
1597 {
1598 return m_instanceData->toKodi->allocate_encrypted_demux_packet(
1599 m_instanceData->toKodi->kodiInstance, dataSize, encryptedSubsampleCount);
1600 }
1601 //----------------------------------------------------------------------------
572 1602
573 /*! 1603 //============================================================================
574 * Get current timing values in PTS scale 1604 /// @brief Free a packet that was allocated with AllocateDemuxPacket
575 * @remarks 1605 ///
576 */ 1606 /// @param[in] packet The packet to free
577 virtual bool GetTimes(INPUTSTREAM_TIMES& times) { return false; } 1607 ///
1608 /// @remarks Only called from addon itself
1609 ///
1610 void FreeDemuxPacket(DEMUX_PACKET* packet)
1611 {
1612 return m_instanceData->toKodi->free_demux_packet(m_instanceData->toKodi->kodiInstance, packet);
1613 }
1614 //----------------------------------------------------------------------------
578 1615
579 /*! 1616 ///@}
580 * Positions inputstream to playing time given in ms
581 * @remarks
582 */
583 virtual bool PosTime(int ms) { return false; }
584 1617
585 /*! 1618 //############################################################################
586 * Return currently selected chapter 1619 /// @defgroup cpp_kodi_addon_inputstream_Time 3. Time (optional)
587 * @remarks 1620 /// @brief **To get stream position time.**
588 */ 1621 ///
589 virtual int GetChapter() { return -1; }; 1622 /// @note These are used and must be set by the addon if the @ref INPUTSTREAM_SUPPORTS_IDISPLAYTIME is set in the capabilities (see @ref GetCapabilities()).
1623 ///
1624 /// @ingroup cpp_kodi_addon_inputstream
1625 ///@{
590 1626
591 /*! 1627 //==========================================================================
592 * Return number of available chapters 1628 /// @brief Totel time in ms
593 * @remarks 1629 ///
594 */ 1630 /// @return Total time in milliseconds
595 virtual int GetChapterCount() { return 0; }; 1631 ///
1632 /// @remarks
1633 ///
1634 virtual int GetTotalTime() { return -1; }
1635 //--------------------------------------------------------------------------
596 1636
597 /*! 1637 //==========================================================================
598 * Return name of chapter # ch 1638 /// @brief Playing time in ms
599 * @remarks 1639 ///
600 */ 1640 /// @return Playing time in milliseconds
601 virtual const char* GetChapterName(int ch) { return nullptr; }; 1641 ///
1642 /// @remarks
1643 ///
1644 virtual int GetTime() { return -1; }
1645 //--------------------------------------------------------------------------
602 1646
603 /*! 1647 ///@}
604 * Return position if chapter # ch in milliseconds
605 * @remarks
606 */
607 virtual int64_t GetChapterPos(int ch) { return 0; };
608 1648
609 /*! 1649 //############################################################################
610 * Seek to the beginning of chapter # ch 1650 /// @defgroup cpp_kodi_addon_inputstream_Times 4. Times (optional)
611 * @remarks 1651 /// @brief **Another way to get stream position time.**
612 */ 1652 ///
613 virtual bool SeekChapter(int ch) { return false; }; 1653 /// @note These are used and must be set by the addon if the @ref INPUTSTREAM_SUPPORTS_ITIME is set in the capabilities (see @ref GetCapabilities()).
1654 ///
1655 /// @ingroup cpp_kodi_addon_inputstream
1656 ///@{
614 1657
615 /*! 1658 //============================================================================
616 * Read from an open stream. 1659 /// @brief Get current timing values in PTS scale
617 * @param buffer The buffer to store the data in. 1660 ///
618 * @param bufferSize The amount of bytes to read. 1661 /// @param[out] times The with @ref InputstreamTimes to given times
619 * @return The amount of bytes that were actually read from the stream. 1662 /// @return true if successfully done, false if not
620 * @remarks Return -1 if this add-on won't provide this function. 1663 ///
621 */ 1664 /// @copydetails cpp_kodi_addon_inputstream_Defs_Times_Help
622 virtual int ReadStream(uint8_t* buffer, unsigned int bufferSize) { return -1; } 1665 ///
1666 /// @remarks
1667 ///
1668 virtual bool GetTimes(InputstreamTimes& times) { return false; }
1669 //----------------------------------------------------------------------------
623 1670
624 /*! 1671 ///@}
625 * Seek in a stream.
626 * @param position The position to seek to.
627 * @param whence ?
628 * @return The new position.
629 * @remarks Return -1 if this add-on won't provide this function.
630 */
631 virtual int64_t SeekStream(int64_t position, int whence = SEEK_SET) { return -1; }
632 1672
633 /*! 1673 //############################################################################
634 * @return The position in the stream that's currently being read. 1674 /// @defgroup cpp_kodi_addon_inputstream_PosTime 5. Position time (optional)
635 * @remarks Return -1 if this add-on won't provide this function. 1675 /// @brief **Third way get stream position time.**
636 */ 1676 ///
637 virtual int64_t PositionStream() { return -1; } 1677 /// @note These are used and must be set by the addon if the @ref INPUTSTREAM_SUPPORTS_IPOSTIME is set in the capabilities (see @ref GetCapabilities()).
1678 ///
1679 /// @ingroup cpp_kodi_addon_inputstream
1680 ///@{
638 1681
639 /*! 1682 //============================================================================
640 * @return The total length of the stream that's currently being read. 1683 /// @brief Positions inputstream to playing time given in ms
641 * @remarks Return -1 if this add-on won't provide this function. 1684 ///
642 */ 1685 /// @param[in] ms Position time in milliseconds
643 virtual int64_t LengthStream() { return -1; } 1686 ///
1687 /// @remarks
1688 ///
1689 virtual bool PosTime(int ms) { return false; }
1690 //----------------------------------------------------------------------------
644 1691
645 /*! 1692 ///@}
646 * @return Obtain the chunk size to use when reading streams.
647 * @remarks Return 0 if this add-on won't provide this function.
648 */
649 virtual int GetBlockSize() { return 0; }
650 1693
651 /*! 1694 //############################################################################
652 * Check for real-time streaming 1695 /// @defgroup cpp_kodi_addon_inputstream_Chapter 6. Chapter (optional)
653 * @return true if current stream is real-time 1696 /// @brief **Used to get available chapters.**
654 */ 1697 ///
655 virtual bool IsRealTimeStream() { return true; } 1698 /// @note These are used and must be set by the addon if the @ref INPUTSTREAM_SUPPORTS_ICHAPTER is set in the capabilities (see @ref GetCapabilities()).
1699 ///
1700 /// @ingroup cpp_kodi_addon_inputstream
1701 ///@{
656 1702
657 /*! 1703 //==========================================================================
658 * @brief Allocate a demux packet. Free with FreeDemuxPacket 1704 ///
659 * @param dataSize The size of the data that will go into the packet 1705 /// @brief Return currently selected chapter
660 * @return The allocated packet 1706 ///
661 */ 1707 /// @return Chapter number
662 DemuxPacket* AllocateDemuxPacket(int dataSize) 1708 ///
663 { 1709 /// @remarks
664 return m_instanceData->toKodi->allocate_demux_packet(m_instanceData->toKodi->kodiInstance, 1710 ///
665 dataSize); 1711 virtual int GetChapter() { return -1; };
666 } 1712 //--------------------------------------------------------------------------
667 1713
668 /*! 1714 //==========================================================================
669 * @brief Allocate a demux packet. Free with FreeDemuxPacket 1715 ///
670 * @param dataSize The size of the data that will go into the packet 1716 /// @brief Return number of available chapters
671 * @return The allocated packet 1717 ///
672 */ 1718 /// @return Chapter count
673 DemuxPacket* AllocateEncryptedDemuxPacket(int dataSize, unsigned int encryptedSubsampleCount) 1719 ///
674 { 1720 /// @remarks
675 return m_instanceData->toKodi->allocate_encrypted_demux_packet( 1721 ///
676 m_instanceData->toKodi->kodiInstance, dataSize, encryptedSubsampleCount); 1722 virtual int GetChapterCount() { return 0; };
677 } 1723 //--------------------------------------------------------------------------
678 1724
679 /*! 1725 //==========================================================================
680 * @brief Free a packet that was allocated with AllocateDemuxPacket 1726 ///
681 * @param packet The packet to free 1727 /// @brief Return name of chapter
682 */ 1728 ///
683 void FreeDemuxPacket(DemuxPacket* packet) 1729 /// @param[in] ch Chapter identifier
684 { 1730 /// @return Chapter name
685 return m_instanceData->toKodi->free_demux_packet(m_instanceData->toKodi->kodiInstance, packet); 1731 ///
686 } 1732 /// @remarks
1733 ///
1734 virtual const char* GetChapterName(int ch) { return nullptr; };
1735 //--------------------------------------------------------------------------
1736
1737 //==========================================================================
1738 ///
1739 /// @brief Return position if chapter # ch in milliseconds
1740 ///
1741 /// @param[in] ch Chapter to get position from
1742 /// @return Position in milliseconds
1743 ///
1744 /// @remarks
1745 ///
1746 virtual int64_t GetChapterPos(int ch) { return 0; };
1747 //--------------------------------------------------------------------------
1748
1749 //==========================================================================
1750 ///
1751 /// @brief Seek to the beginning of chapter # ch
1752 ///
1753 /// @param[in] ch Chapter to seek
1754 /// @return True if successfully done, false if not
1755 ///
1756 /// @remarks
1757 ///
1758 virtual bool SeekChapter(int ch) { return false; };
1759 //--------------------------------------------------------------------------
1760
1761 ///@}
687 1762
688private: 1763private:
689 static int compareVersion(const int v1[3], const int v2[3]) 1764 static int compareVersion(const int v1[3], const int v2[3])
@@ -752,9 +1827,10 @@ private:
752 */ 1827 */
753 } 1828 }
754 1829
755 inline static bool ADDON_Open(const AddonInstance_InputStream* instance, INPUTSTREAM* props) 1830 inline static bool ADDON_Open(const AddonInstance_InputStream* instance,
1831 INPUTSTREAM_PROPERTY* props)
756 { 1832 {
757 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->Open(*props); 1833 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->Open(props);
758 } 1834 }
759 1835
760 inline static void ADDON_Close(const AddonInstance_InputStream* instance) 1836 inline static void ADDON_Close(const AddonInstance_InputStream* instance)
@@ -765,22 +1841,48 @@ private:
765 inline static void ADDON_GetCapabilities(const AddonInstance_InputStream* instance, 1841 inline static void ADDON_GetCapabilities(const AddonInstance_InputStream* instance,
766 INPUTSTREAM_CAPABILITIES* capabilities) 1842 INPUTSTREAM_CAPABILITIES* capabilities)
767 { 1843 {
768 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance) 1844 InputstreamCapabilities caps(capabilities);
769 ->GetCapabilities(*capabilities); 1845 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetCapabilities(caps);
770 } 1846 }
771 1847
772 1848
773 // IDemux 1849 // IDemux
774 inline static struct INPUTSTREAM_IDS ADDON_GetStreamIds(const AddonInstance_InputStream* instance) 1850 inline static bool ADDON_GetStreamIds(const AddonInstance_InputStream* instance,
1851 struct INPUTSTREAM_IDS* ids)
775 { 1852 {
776 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetStreamIds(); 1853 std::vector<unsigned int> idList;
1854 bool ret =
1855 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetStreamIds(idList);
1856 if (ret)
1857 {
1858 for (size_t i = 0; i < idList.size() && i < INPUTSTREAM_MAX_STREAM_COUNT; ++i)
1859 {
1860 ids->m_streamCount++;
1861 ids->m_streamIds[i] = idList[i];
1862 }
1863 }
1864 return ret;
777 } 1865 }
778 1866
779 inline static struct INPUTSTREAM_INFO ADDON_GetStream(const AddonInstance_InputStream* instance, 1867 inline static bool ADDON_GetStream(
780 int streamid) 1868 const AddonInstance_InputStream* instance,
1869 int streamid,
1870 struct INPUTSTREAM_INFO* info,
1871 KODI_HANDLE* demuxStream,
1872 KODI_HANDLE (*transfer_stream)(KODI_HANDLE handle,
1873 int streamId,
1874 struct INPUTSTREAM_INFO* stream))
781 { 1875 {
782 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance) 1876 InputstreamInfo infoData(info);
783 ->GetStream(streamid); 1877 bool ret = static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
1878 ->GetStream(streamid, infoData);
1879 if (ret && transfer_stream)
1880 {
1881 // Do this with given callback to prevent memory problems and leaks. This
1882 // then create on Kodi the needed class where then given back on demuxStream.
1883 *demuxStream = transfer_stream(instance->toKodi->kodiInstance, streamid, info);
1884 }
1885 return ret;
784 } 1886 }
785 1887
786 inline static void ADDON_EnableStream(const AddonInstance_InputStream* instance, 1888 inline static void ADDON_EnableStream(const AddonInstance_InputStream* instance,
@@ -812,7 +1914,7 @@ private:
812 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxFlush(); 1914 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxFlush();
813 } 1915 }
814 1916
815 inline static DemuxPacket* ADDON_DemuxRead(const AddonInstance_InputStream* instance) 1917 inline static DEMUX_PACKET* ADDON_DemuxRead(const AddonInstance_InputStream* instance)
816 { 1918 {
817 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxRead(); 1919 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxRead();
818 } 1920 }
@@ -855,7 +1957,8 @@ private:
855 inline static bool ADDON_GetTimes(const AddonInstance_InputStream* instance, 1957 inline static bool ADDON_GetTimes(const AddonInstance_InputStream* instance,
856 INPUTSTREAM_TIMES* times) 1958 INPUTSTREAM_TIMES* times)
857 { 1959 {
858 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetTimes(*times); 1960 InputstreamTimes cppTimes(times);
1961 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetTimes(cppTimes);
859 } 1962 }
860 1963
861 // IPosTime 1964 // IPosTime
@@ -927,6 +2030,7 @@ private:
927 2030
928 AddonInstance_InputStream* m_instanceData; 2031 AddonInstance_InputStream* m_instanceData;
929}; 2032};
2033//------------------------------------------------------------------------------
930 2034
931} /* namespace addon */ 2035} /* namespace addon */
932} /* namespace kodi */ 2036} /* namespace kodi */
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/PVR.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/PVR.h
index d5977a7..61e294f 100644
--- a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/PVR.h
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/PVR.h
@@ -36,7 +36,7 @@
36 * Only must be min version increased if a new compile of addon breaks after 36 * Only must be min version increased if a new compile of addon breaks after
37 * changes here. 37 * changes here.
38 * 38 *
39 * Have by add of new parts a look about **Doxygen** `\\ingroup`, so that 39 * Have by add of new parts a look about **Doxygen** `\@ingroup`, so that
40 * added parts included in documentation. 40 * added parts included in documentation.
41 * 41 *
42 * If you add addon side related documentation, where his dev need know, use `///`. 42 * If you add addon side related documentation, where his dev need know, use `///`.
@@ -1477,22 +1477,39 @@ public:
1477 //---------------------------------------------------------------------------- 1477 //----------------------------------------------------------------------------
1478 1478
1479 //============================================================================ 1479 //============================================================================
1480 /// @brief Tell the client the time frame to use when notifying epg events back to Kodi 1480 /// @brief Tell the client the past time frame to use when notifying epg events back to Kodi
1481 /// 1481 ///
1482 /// The client might push epg events asynchronously to Kodi using the callback function 1482 /// The client might push epg events asynchronously to Kodi using the callback function
1483 /// @ref EpgEventStateChange. To be able to only push events that are actually of 1483 /// @ref EpgEventStateChange. To be able to only push events that are actually of
1484 /// interest for Kodi, client needs to know about the epg time frame Kodi uses. Kodi 1484 /// interest for Kodi, client needs to know about the epg time frame Kodi uses. Kodi supplies
1485 /// supplies the current epg time frame value in @ref EpgMaxDays() when creating the 1485 /// the current epg max past time frame value @ref EpgMaxPastDays() when creating the addon
1486 /// addon and calls @ref SetEPGTimeFrame later whenever Kodi's epg time frame value 1486 /// and calls @ref SetEPGMaxPastDays later whenever Kodi's epg time frame value changes.
1487 /// changes.
1488 /// 1487 ///
1489 /// @param[in] days number of days from "now". @ref EPG_TIMEFRAME_UNLIMITED means that Kodi 1488 /// @param[in] pastDays number of days before "now". @ref EPG_TIMEFRAME_UNLIMITED means that Kodi
1490 /// is interested in all epg events, regardless of event times. 1489 /// is interested in all epg events, regardless of event times.
1491 /// @return @ref PVR_ERROR_NO_ERROR if new value was successfully set. 1490 /// @return @ref PVR_ERROR_NO_ERROR if new value was successfully set.
1492 /// 1491 ///
1493 /// @remarks Required if @ref PVRCapabilities::SetSupportsEPG "supportsEPG" is set to true. 1492 /// @remarks Required if @ref PVRCapabilities::SetSupportsEPG "supportsEPG" is set to true.
1494 /// 1493 ///
1495 virtual PVR_ERROR SetEPGTimeFrame(int days) { return PVR_ERROR_NOT_IMPLEMENTED; } 1494 virtual PVR_ERROR SetEPGMaxPastDays(int pastDays) { return PVR_ERROR_NOT_IMPLEMENTED; }
1495 //----------------------------------------------------------------------------
1496
1497 //============================================================================
1498 /// @brief Tell the client the future time frame to use when notifying epg events back to Kodi
1499 ///
1500 /// The client might push epg events asynchronously to Kodi using the callback function
1501 /// @ref EpgEventStateChange. To be able to only push events that are actually of
1502 /// interest for Kodi, client needs to know about the epg time frame Kodi uses. Kodi supplies
1503 /// the current epg max future time frame value @ref EpgMaxFutureDays() when creating the addon
1504 /// and calls @ref SetEPGMaxFutureDays later whenever Kodi's epg time frame value changes.
1505 ///
1506 /// @param[in] futureDays number of days from "now". @ref EPG_TIMEFRAME_UNLIMITED means that Kodi
1507 /// is interested in all epg events, regardless of event times.
1508 /// @return @ref PVR_ERROR_NO_ERROR if new value was successfully set.
1509 ///
1510 /// @remarks Required if @ref PVRCapabilities::SetSupportsEPG "supportsEPG" is set to true.
1511 ///
1512 virtual PVR_ERROR SetEPGMaxFutureDays(int futureDays) { return PVR_ERROR_NOT_IMPLEMENTED; }
1496 //---------------------------------------------------------------------------- 1513 //----------------------------------------------------------------------------
1497 1514
1498 //========================================================================== 1515 //==========================================================================
@@ -1518,15 +1535,28 @@ public:
1518 1535
1519 //========================================================================== 1536 //==========================================================================
1520 /// @brief **Callback to Kodi Function**\n 1537 /// @brief **Callback to Kodi Function**\n
1521 /// Get the Max days handled by Kodi. 1538 /// Get the Max past days handled by Kodi.
1522 /// 1539 ///
1523 /// If > @ref EPG_TIMEFRAME_UNLIMITED, in async epg mode, deliver only events 1540 /// If > @ref EPG_TIMEFRAME_UNLIMITED, in async epg mode, deliver only events in the
1524 /// in the range from 'end time > now' to 'start time < now + EpgMaxDays(). 1541 /// range from 'end time > now - EpgMaxPastDays()' to 'start time < now + EpgMaxFutureDays().
1525 /// @ref EPG_TIMEFRAME_UNLIMITED, notify all events. 1542 /// @ref EPG_TIMEFRAME_UNLIMITED, notify all events.
1526 /// 1543 ///
1527 /// @return The Max days handled by Kodi 1544 /// @return The Max past days handled by Kodi
1528 /// 1545 ///
1529 inline int EpgMaxDays() const { return m_instanceData->props->iEpgMaxDays; } 1546 inline int EpgMaxPastDays() const { return m_instanceData->props->iEpgMaxPastDays; }
1547 //----------------------------------------------------------------------------
1548
1549 //==========================================================================
1550 /// @brief **Callback to Kodi Function**\n
1551 /// Get the Max future days handled by Kodi.
1552 ///
1553 /// If > @ref EPG_TIMEFRAME_UNLIMITED, in async epg mode, deliver only events in the
1554 /// range from 'end time > now - EpgMaxPastDays()' to 'start time < now + EpgMaxFutureDays().
1555 /// @ref EPG_TIMEFRAME_UNLIMITED, notify all events.
1556 ///
1557 /// @return The Max future days handled by Kodi
1558 ///
1559 inline int EpgMaxFutureDays() const { return m_instanceData->props->iEpgMaxFutureDays; }
1530 //---------------------------------------------------------------------------- 1560 //----------------------------------------------------------------------------
1531 1561
1532 //========================================================================== 1562 //==========================================================================
@@ -2324,7 +2354,7 @@ public:
2324 /// @remarks Required, and only used if addon has its own demuxer. 2354 /// @remarks Required, and only used if addon has its own demuxer.
2325 /// Return `nullptr` if this add-on won't provide this function. 2355 /// Return `nullptr` if this add-on won't provide this function.
2326 /// 2356 ///
2327 virtual DemuxPacket* DemuxRead() { return nullptr; } 2357 virtual DEMUX_PACKET* DemuxRead() { return nullptr; }
2328 //---------------------------------------------------------------------------- 2358 //----------------------------------------------------------------------------
2329 2359
2330 //============================================================================ 2360 //============================================================================
@@ -2413,7 +2443,7 @@ public:
2413 /// 2443 ///
2414 /// @remarks Only called from addon itself 2444 /// @remarks Only called from addon itself
2415 /// 2445 ///
2416 inline DemuxPacket* AllocateDemuxPacket(int iDataSize) 2446 inline DEMUX_PACKET* AllocateDemuxPacket(int iDataSize)
2417 { 2447 {
2418 return m_instanceData->toKodi->AllocateDemuxPacket(m_instanceData->toKodi->kodiInstance, 2448 return m_instanceData->toKodi->AllocateDemuxPacket(m_instanceData->toKodi->kodiInstance,
2419 iDataSize); 2449 iDataSize);
@@ -2428,7 +2458,7 @@ public:
2428 /// 2458 ///
2429 /// @remarks Only called from addon itself. 2459 /// @remarks Only called from addon itself.
2430 /// 2460 ///
2431 inline void FreeDemuxPacket(DemuxPacket* pPacket) 2461 inline void FreeDemuxPacket(DEMUX_PACKET* pPacket)
2432 { 2462 {
2433 m_instanceData->toKodi->FreeDemuxPacket(m_instanceData->toKodi->kodiInstance, pPacket); 2463 m_instanceData->toKodi->FreeDemuxPacket(m_instanceData->toKodi->kodiInstance, pPacket);
2434 } 2464 }
@@ -2662,7 +2692,8 @@ private:
2662 m_instanceData->toAddon->IsEPGTagPlayable = ADDON_IsEPGTagPlayable; 2692 m_instanceData->toAddon->IsEPGTagPlayable = ADDON_IsEPGTagPlayable;
2663 m_instanceData->toAddon->GetEPGTagEdl = ADDON_GetEPGTagEdl; 2693 m_instanceData->toAddon->GetEPGTagEdl = ADDON_GetEPGTagEdl;
2664 m_instanceData->toAddon->GetEPGTagStreamProperties = ADDON_GetEPGTagStreamProperties; 2694 m_instanceData->toAddon->GetEPGTagStreamProperties = ADDON_GetEPGTagStreamProperties;
2665 m_instanceData->toAddon->SetEPGTimeFrame = ADDON_SetEPGTimeFrame; 2695 m_instanceData->toAddon->SetEPGMaxPastDays = ADDON_SetEPGMaxPastDays;
2696 m_instanceData->toAddon->SetEPGMaxFutureDays = ADDON_SetEPGMaxFutureDays;
2666 m_instanceData->toAddon->CallEPGMenuHook = ADDON_CallEPGMenuHook; 2697 m_instanceData->toAddon->CallEPGMenuHook = ADDON_CallEPGMenuHook;
2667 //--==----==----==----==----==----==----==----==----==----==----==----==----== 2698 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2668 m_instanceData->toAddon->GetRecordingsAmount = ADDON_GetRecordingsAmount; 2699 m_instanceData->toAddon->GetRecordingsAmount = ADDON_GetRecordingsAmount;
@@ -2998,10 +3029,17 @@ private:
2998 return error; 3029 return error;
2999 } 3030 }
3000 3031
3001 inline static PVR_ERROR ADDON_SetEPGTimeFrame(const AddonInstance_PVR* instance, int days) 3032 inline static PVR_ERROR ADDON_SetEPGMaxPastDays(const AddonInstance_PVR* instance, int pastDays)
3033 {
3034 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3035 ->SetEPGMaxPastDays(pastDays);
3036 }
3037
3038 inline static PVR_ERROR ADDON_SetEPGMaxFutureDays(const AddonInstance_PVR* instance,
3039 int futureDays)
3002 { 3040 {
3003 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance) 3041 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3004 ->SetEPGTimeFrame(days); 3042 ->SetEPGMaxFutureDays(futureDays);
3005 } 3043 }
3006 3044
3007 inline static PVR_ERROR ADDON_CallEPGMenuHook(const AddonInstance_PVR* instance, 3045 inline static PVR_ERROR ADDON_CallEPGMenuHook(const AddonInstance_PVR* instance,
@@ -3364,7 +3402,7 @@ private:
3364 static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->DemuxFlush(); 3402 static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->DemuxFlush();
3365 } 3403 }
3366 3404
3367 inline static DemuxPacket* ADDON_DemuxRead(const AddonInstance_PVR* instance) 3405 inline static DEMUX_PACKET* ADDON_DemuxRead(const AddonInstance_PVR* instance)
3368 { 3406 {
3369 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->DemuxRead(); 3407 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->DemuxRead();
3370 } 3408 }
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Screensaver.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Screensaver.h
index 4902fcb..d4ac1aa 100644
--- a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Screensaver.h
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Screensaver.h
@@ -41,7 +41,7 @@ namespace addon
41/// * <b><c>Render()</c></b> - Called at render time 41/// * <b><c>Render()</c></b> - Called at render time
42/// * <b><c>Stop()</c></b> - Called when the screensaver has no work 42/// * <b><c>Stop()</c></b> - Called when the screensaver has no work
43/// 43///
44/// Additionally, there are several \ref cpp_kodi_addon_screensaver_CB "other functions" 44/// Additionally, there are several @ref cpp_kodi_addon_screensaver_CB "other functions"
45/// available in which the child class can ask about the current hardware, 45/// available in which the child class can ask about the current hardware,
46/// including the device, display and several other parts. 46/// including the device, display and several other parts.
47/// 47///
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/VFS.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/VFS.h
index 177bf72..dbfb833 100644
--- a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/VFS.h
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/VFS.h
@@ -152,7 +152,7 @@ private:
152 152
153//############################################################################## 153//##############################################################################
154/// @defgroup cpp_kodi_addon_vfs_Defs Definitions, structures and enumerators 154/// @defgroup cpp_kodi_addon_vfs_Defs Definitions, structures and enumerators
155/// \ingroup cpp_kodi_addon_vfs 155/// @ingroup cpp_kodi_addon_vfs
156/// @brief **VFS add-on general variables** 156/// @brief **VFS add-on general variables**
157/// 157///
158/// Used to exchange the available options between Kodi and addon. 158/// Used to exchange the available options between Kodi and addon.
@@ -161,7 +161,7 @@ private:
161 161
162//============================================================================== 162//==============================================================================
163/// 163///
164/// \addtogroup cpp_kodi_addon_vfs 164/// @addtogroup cpp_kodi_addon_vfs
165/// @brief \cpp_class{ kodi::addon::CInstanceVFS } 165/// @brief \cpp_class{ kodi::addon::CInstanceVFS }
166/// **Virtual Filesystem (VFS) add-on instance** 166/// **Virtual Filesystem (VFS) add-on instance**
167/// 167///
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/VideoCodec.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/VideoCodec.h
index 12893db..7cf58a0 100644
--- a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/VideoCodec.h
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/VideoCodec.h
@@ -9,241 +9,456 @@
9#pragma once 9#pragma once
10 10
11#include "../AddonBase.h" 11#include "../AddonBase.h"
12#include "../StreamCrypto.h" 12#include "../c-api/addon-instance/video_codec.h"
13#include "../StreamCodec.h" 13#include "inputstream/DemuxPacket.h"
14#include "inputstream/StreamCodec.h"
15#include "inputstream/StreamCrypto.h"
14 16
15#ifdef BUILD_KODI_ADDON 17#ifdef __cplusplus
16#include "../DemuxPacket.h"
17#else
18#include "cores/VideoPlayer/Interface/Addon/DemuxPacket.h"
19#endif
20 18
21extern "C" 19namespace kodi
20{
21namespace addon
22{ 22{
23 enum VIDEOCODEC_FORMAT
24 {
25 UnknownVideoFormat = 0,
26 VideoFormatYV12,
27 VideoFormatI420,
28 MaxVideoFormats
29 };
30
31
32 struct VIDEOCODEC_INITDATA
33 {
34 enum Codec {
35 CodecUnknown = 0,
36 CodecVp8,
37 CodecH264,
38 CodecVp9
39 } codec;
40
41 STREAMCODEC_PROFILE codecProfile;
42
43 //UnknownVideoFormat is terminator
44 VIDEOCODEC_FORMAT *videoFormats;
45
46 uint32_t width, height;
47
48 const uint8_t *extraData;
49 unsigned int extraDataSize;
50
51 CRYPTO_INFO cryptoInfo;
52 };
53
54 struct VIDEOCODEC_PICTURE
55 {
56 enum VideoPlane {
57 YPlane = 0,
58 UPlane,
59 VPlane,
60 MaxPlanes = 3,
61 };
62
63 enum Flags : uint32_t {
64 FLAG_DROP,
65 FLAG_DRAIN
66 };
67
68 VIDEOCODEC_FORMAT videoFormat;
69 uint32_t flags;
70
71 uint32_t width, height;
72 23
73 uint8_t *decodedData; 24class CInstanceVideoCodec;
74 size_t decodedDataSize;
75 25
76 uint32_t planeOffsets[VideoPlane::MaxPlanes]; 26//==============================================================================
77 uint32_t stride[VideoPlane::MaxPlanes]; 27/// @defgroup cpp_kodi_addon_videocodec_Defs_VideoCodecInitdata class VideoCodecInitdata
28/// @ingroup cpp_kodi_addon_videocodec_Defs
29/// @brief Initialization data to open a video codec stream.
30///
31/// ----------------------------------------------------------------------------
32///
33/// @copydetails cpp_kodi_addon_videocodec_Defs_VideoCodecInitdata_Help
34///
35///@{
36class ATTRIBUTE_HIDDEN VideoCodecInitdata
37 : public CStructHdl<VideoCodecInitdata, VIDEOCODEC_INITDATA>
38{
39 /*! \cond PRIVATE */
40 friend class CInstanceVideoCodec;
41 /*! \endcond */
78 42
79 int64_t pts; 43public:
44 /// @defgroup cpp_kodi_addon_videocodec_Defs_VideoCodecInitdata_Help Value Help
45 /// @ingroup cpp_kodi_addon_videocodec_Defs_VideoCodecInitdata
46 ///
47 /// <b>The following table contains values that can be set with @ref cpp_kodi_addon_videocodec_Defs_VideoCodecInitdata :</b>
48 /// | Name | Type | Get call
49 /// |------|------|----------
50 /// | **Codec type** | `VIDEOCODEC_TYPE` | @ref VideoCodecInitdata::GetCodecType "GetCodecType"
51 /// | **Codec profile** | `STREAMCODEC_PROFILE` | @ref VideoCodecInitdata::GetCodecProfile "GetCodecProfile"
52 /// | **Video formats** | `std::vector<VIDEOCODEC_FORMAT>` | @ref VideoCodecInitdata::GetVideoFormats "GetVideoFormats"
53 /// | **Width** | `uint32_t` | @ref VideoCodecInitdata::GetWidth "GetWidth"
54 /// | **Height** | `uint32_t` | @ref VideoCodecInitdata::GetHeight "GetHeight"
55 /// | **Extra data** | `const uint8_t*` | @ref VideoCodecInitdata::GetExtraData "GetExtraData"
56 /// | **Extra data size** | `unsigned int` | @ref VideoCodecInitdata::GetExtraDataSize "GetExtraDataSize"
57 /// | **Crypto session** | `kodi::addon::StreamCryptoSession` | @ref VideoCodecInitdata::GetCryptoSession "GetCryptoSession"
58 ///
80 59
81 KODI_HANDLE videoBufferHandle; //< will be passed in release_frame_buffer 60 /// @addtogroup cpp_kodi_addon_videocodec_Defs_VideoCodecInitdata
82 }; 61 ///@{
83 62
84 enum VIDEOCODEC_RETVAL 63 /// @brief The codec type required by Kodi to process the stream.
85 { 64 ///
86 VC_NONE = 0, //< noop 65 /// See @ref VIDEOCODEC_TYPE for possible values.
87 VC_ERROR, //< an error occurred, no other messages will be returned 66 VIDEOCODEC_TYPE GetCodecType() const { return m_cStructure->codec; }
88 VC_BUFFER, //< the decoder needs more data
89 VC_PICTURE, //< the decoder got a picture
90 VC_EOF, //< the decoder signals EOF
91 };
92 67
93 // this are properties given to the addon on create 68 /// @brief Used profiles for non-scalable 2D video
94 // at this time we have no parameters for the addon 69 STREAMCODEC_PROFILE GetCodecProfile() const { return m_cStructure->codecProfile; }
95 typedef struct AddonProps_VideoCodec
96 {
97 int dummy;
98 } AddonProps_VideoCodec;
99 70
100 struct AddonInstance_VideoCodec; 71 /// @brief The video stream representations requested by Kodi
101 typedef struct KodiToAddonFuncTable_VideoCodec 72 ///
73 /// This contains a list of the required video formats. One of them has to
74 /// select the addon to return the created image.
75 ///
76 std::vector<VIDEOCODEC_FORMAT> GetVideoFormats() const
102 { 77 {
103 KODI_HANDLE addonInstance; 78 std::vector<VIDEOCODEC_FORMAT> formats;
79 unsigned int i = 0;
80 while (i < VIDEOCODEC_FORMAT_MAXFORMATS &&
81 m_cStructure->videoFormats[i] != VIDEOCODEC_FORMAT_UNKNOWN)
82 formats.emplace_back(m_cStructure->videoFormats[i++]);
83 if (formats.empty())
84 formats.emplace_back(VIDEOCODEC_FORMAT_UNKNOWN);
85 return formats;
86 }
104 87
105 //! \brief Opens a codec 88 /// @brief Picture width.
106 bool (__cdecl* open) (const AddonInstance_VideoCodec* instance, VIDEOCODEC_INITDATA *initData); 89 uint32_t GetWidth() const { return m_cStructure->width; }
107 90
108 //! \brief Reconfigures a codec 91 /// @brief Picture height.
109 bool (__cdecl* reconfigure) (const AddonInstance_VideoCodec* instance, VIDEOCODEC_INITDATA *initData); 92 uint32_t GetHeight() const { return m_cStructure->height; }
110 93
111 //! \brief Feed codec if requested from GetPicture() (return VC_BUFFER) 94 /// @brief Depending on the required decoding, additional data given by the stream.
112 bool (__cdecl* add_data) (const AddonInstance_VideoCodec* instance, const DemuxPacket *packet); 95 const uint8_t* GetExtraData() const { return m_cStructure->extraData; }
113 96
114 //! \brief Get a decoded picture / request new data 97 /// @brief Size of the data given with @ref extraData.
115 VIDEOCODEC_RETVAL (__cdecl* get_picture) (const AddonInstance_VideoCodec* instance, VIDEOCODEC_PICTURE *picture); 98 unsigned int GetExtraDataSize() const { return m_cStructure->extraDataSize; }
116 99
117 //! \brief Get the name of this video decoder 100 /// @brief **Data to manage stream cryptography**\n
118 const char *(__cdecl* get_name) (const AddonInstance_VideoCodec* instance); 101 /// To get class structure manages any encryption values required in order to have
102 /// them available in their stream processing.
103 ///
104 /// ----------------------------------------------------------------------------
105 ///
106 /// @copydetails cpp_kodi_addon_inputstream_Defs_Info_StreamCryptoSession_Help
107 ///
108 kodi::addon::StreamCryptoSession GetCryptoSession() const { return &m_cStructure->cryptoSession; }
119 109
120 //! \brief Reset the codec 110 ///@}
121 void (__cdecl* reset)(const AddonInstance_VideoCodec* instance);
122 } KodiToAddonFuncTable_VideoCodec;
123 111
124 typedef struct AddonToKodiFuncTable_VideoCodec 112private:
125 { 113 VideoCodecInitdata() = delete;
126 KODI_HANDLE kodiInstance; 114 VideoCodecInitdata(const VideoCodecInitdata& session) : CStructHdl(session) {}
127 bool(*get_frame_buffer)(void* kodiInstance, VIDEOCODEC_PICTURE *picture); 115 VideoCodecInitdata(const VIDEOCODEC_INITDATA* session) : CStructHdl(session) {}
128 void(*release_frame_buffer)(void* kodiInstance, void *buffer); 116 VideoCodecInitdata(VIDEOCODEC_INITDATA* session) : CStructHdl(session) {}
129 } AddonToKodiFuncTable_VideoCodec; 117};
118///@}
119//------------------------------------------------------------------------------
130 120
131 typedef struct AddonInstance_VideoCodec 121//##############################################################################
132 { 122/// @defgroup cpp_kodi_addon_videocodec_Defs Definitions, structures and enumerators
133 AddonProps_VideoCodec* props; 123/// @ingroup cpp_kodi_addon_videocodec
134 AddonToKodiFuncTable_VideoCodec* toKodi; 124/// @brief **Video codec add-on general variables**
135 KodiToAddonFuncTable_VideoCodec* toAddon; 125///
136 } AddonInstance_VideoCodec; 126/// Used to exchange the available options between Kodi and addon.
137} 127///
128///
138 129
139namespace kodi 130//============================================================================
131///
132/// @addtogroup cpp_kodi_addon_videocodec
133/// @brief \cpp_class{ kodi::addon::CInstanceVideoCodec }
134/// **Video codec add-on instance**
135///
136/// This is an addon instance class to add an additional video decoder to Kodi
137/// using addon.
138///
139/// This means that either a new type of decoding can be introduced to an input
140/// stream add-on that requires special types of decoding.
141///
142/// When using the inputstream addon, @ref cpp_kodi_addon_inputstream_Defs_Interface_InputstreamInfo
143/// to @ref cpp_kodi_addon_inputstream_Defs_Info is used to declare that the
144/// decoder stored in the addon is used.
145///
146/// @note At the moment this can only be used together with input stream addons,
147/// independent use as a codec addon is not yet possible.
148///
149/// Include the header @ref VideoCodec.h "#include <kodi/addon-instance/VideoCodec.h>"
150/// to use this class.
151///
152/// --------------------------------------------------------------------------
153///
154/// **Example:**
155/// This as an example when used together with @ref cpp_kodi_addon_inputstream "kodi::addon::CInstanceInputStream".
156///
157/// ~~~~~~~~~~~~~{.cpp}
158/// #include <kodi/addon-instance/Inputstream.h>
159/// #include <kodi/addon-instance/VideoCodec.h>
160///
161/// class CMyVideoCodec : public kodi::addon::CInstanceVideoCodec
162/// {
163/// public:
164/// CMyVideoCodec(KODI_HANDLE instance, CMyInputstream* inputstream);
165/// ...
166///
167/// private:
168/// CMyInputstream* m_inputstream;
169/// };
170///
171/// CMyVideoCodec::CMyVideoCodec(KODI_HANDLE instance,
172/// const std::string& version,
173/// CMyInputstream* inputstream)
174/// : kodi::addon::CInstanceVideoCodec(instance, version),
175/// m_inputstream(inputstream)
176/// {
177/// ...
178/// }
179/// ...
180///
181/// //----------------------------------------------------------------------
182///
183/// class CMyInputstream : public kodi::addon::CInstanceInputStream
184/// {
185/// public:
186/// CMyInputstream(KODI_HANDLE instance, const std::string& kodiVersion);
187///
188/// ADDON_STATUS CreateInstance(int instanceType,
189/// std::string instanceID,
190/// KODI_HANDLE instance,
191/// const std::string& version,
192/// KODI_HANDLE& addonInstance) override;
193/// ...
194/// };
195///
196/// CMyInputstream::CMyInputstream(KODI_HANDLE instance, const std::string& kodiVersion)
197/// : kodi::addon::CInstanceInputStream(instance, kodiVersion)
198/// {
199/// ...
200/// }
201///
202/// ADDON_STATUS CMyInputstream::CreateInstance(int instanceType,
203/// std::string instanceID,
204/// KODI_HANDLE instance,
205/// const std::string& version,
206/// KODI_HANDLE& addonInstance)
207/// {
208/// if (instanceType == ADDON_INSTANCE_VIDEOCODEC)
209/// {
210/// addonInstance = new CMyVideoCodec(instance, version, this);
211/// return ADDON_STATUS_OK;
212/// }
213/// return ADDON_STATUS_NOT_IMPLEMENTED;
214/// }
215///
216/// ...
217///
218/// //----------------------------------------------------------------------
219///
220/// class CMyAddon : public kodi::addon::CAddonBase
221/// {
222/// public:
223/// CMyAddon() { }
224/// ADDON_STATUS CreateInstance(int instanceType,
225/// std::string instanceID,
226/// KODI_HANDLE instance,
227/// const std::string& version,
228/// KODI_HANDLE& addonInstance) override;
229/// };
230///
231/// // If you use only one instance in your add-on, can be instanceType and
232/// // instanceID ignored
233/// ADDON_STATUS CMyAddon::CreateInstance(int instanceType,
234/// std::string instanceID,
235/// KODI_HANDLE instance,
236/// const std::string& version,
237/// KODI_HANDLE& addonInstance)
238/// {
239/// if (instanceType == ADDON_INSTANCE_INPUTSTREAM)
240/// {
241/// kodi::Log(ADDON_LOG_NOTICE, "Creating my Inputstream");
242/// addonInstance = new CMyInputstream(instance, version);
243/// return ADDON_STATUS_OK;
244/// }
245/// else if (...)
246/// {
247/// ...
248/// }
249/// return ADDON_STATUS_UNKNOWN;
250/// }
251///
252/// ADDONCREATOR(CMyAddon)
253/// ~~~~~~~~~~~~~
254///
255/// The destruction of the example class `CMyInputstream` is called from
256/// Kodi's header. Manually deleting the add-on instance is not required.
257///
258///
259class ATTRIBUTE_HIDDEN CInstanceVideoCodec : public IAddonInstance
140{ 260{
141 namespace addon 261public:
262 //============================================================================
263 /// @ingroup cpp_kodi_addon_videocodec
264 /// @brief Video codec class constructor used to support multiple instance
265 /// types
266 ///
267 /// @param[in] instance The instance value given to <b>`kodi::addon::CAddonBase::CreateInstance(...)`</b>,
268 /// or by a inputstream instance if them declared as parent.
269 /// @param[in] kodiVersion [opt] Version used in Kodi for this instance, to
270 /// allow compatibility to older Kodi versions.
271 ///
272 explicit CInstanceVideoCodec(KODI_HANDLE instance, const std::string& kodiVersion = "")
273 : IAddonInstance(ADDON_INSTANCE_VIDEOCODEC,
274 !kodiVersion.empty() ? kodiVersion
275 : GetKodiTypeVersion(ADDON_INSTANCE_VIDEOCODEC))
142 { 276 {
277 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
278 throw std::logic_error("kodi::addon::CInstanceVideoCodec: Creation of multiple together with "
279 "single instance way is not allowed!");
143 280
144 class ATTRIBUTE_HIDDEN CInstanceVideoCodec : public IAddonInstance 281 SetAddonStruct(instance);
145 { 282 }
146 public: 283 //----------------------------------------------------------------------------
147 explicit CInstanceVideoCodec(KODI_HANDLE instance, const std::string& kodiVersion = "")
148 : IAddonInstance(ADDON_INSTANCE_VIDEOCODEC,
149 !kodiVersion.empty() ? kodiVersion
150 : GetKodiTypeVersion(ADDON_INSTANCE_VIDEOCODEC))
151 {
152 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
153 throw std::logic_error("kodi::addon::CInstanceVideoCodec: Creation of multiple together with single instance way is not allowed!");
154 284
155 SetAddonStruct(instance); 285 //============================================================================
156 } 286 /// @ingroup cpp_kodi_addon_videocodec
287 /// @brief Destructor
288 ///
289 ~CInstanceVideoCodec() override = default;
290 //----------------------------------------------------------------------------
157 291
158 ~CInstanceVideoCodec() override = default; 292 //============================================================================
293 /// @ingroup cpp_kodi_addon_videocodec
294 /// @brief Open the decoder, returns true on success
295 ///
296 /// Decoders not capable of running multiple instances should return false in case
297 /// there is already a instance open.
298 ///
299 /// @param[in] initData Video codec init data
300 /// @return true if successfully done
301 ///
302 ///
303 /// ----------------------------------------------------------------------------
304 ///
305 /// @copydetails cpp_kodi_addon_videocodec_Defs_VideoCodecInitdata_Help
306 ///
307 virtual bool Open(const kodi::addon::VideoCodecInitdata& initData) { return false; }
308 //----------------------------------------------------------------------------
159 309
160 //! \copydoc CInstanceVideoCodec::Open 310 //============================================================================
161 virtual bool Open(VIDEOCODEC_INITDATA &initData) { return false; }; 311 /// @ingroup cpp_kodi_addon_videocodec
312 /// @brief Reconfigure the decoder, returns true on success
313 ///
314 /// Decoders not capable of runnung multiple instances may be capable of reconfiguring
315 /// the running instance. If Reconfigure returns false, player will close / open
316 /// the decoder
317 ///
318 /// @param[in] initData Video codec reconfigure data
319 /// @return true if successfully done
320 ///
321 virtual bool Reconfigure(const kodi::addon::VideoCodecInitdata& initData) { return false; }
322 //----------------------------------------------------------------------------
162 323
163 //! \copydoc CInstanceVideoCodec::Reconfigure 324 //============================================================================
164 virtual bool Reconfigure(VIDEOCODEC_INITDATA &initData) { return false; }; 325 /// @ingroup cpp_kodi_addon_videocodec
326 /// @brief add data, decoder has to consume the entire packet
327 ///
328 /// @param[in] packet Data to process for decode
329 /// @return true if the packet was consumed or if resubmitting it is useless
330 ///
331 virtual bool AddData(const DEMUX_PACKET& packet) { return false; }
332 //----------------------------------------------------------------------------
165 333
166 //! \copydoc CInstanceVideoCodec::AddData 334 //============================================================================
167 virtual bool AddData(const DemuxPacket &packet) { return false; }; 335 /// @ingroup cpp_kodi_addon_videocodec
336 /// @brief GetPicture controls decoding.
337 ///
338 /// Player calls it on every cycle it can signal a picture, request a buffer,
339 /// or return none, if nothing applies the data is valid until the next
340 /// GetPicture return @ref VC_PICTURE
341 ///
342 /// @param[in,out] Structure which contains the necessary data
343 /// @return The with @ref VIDEOCODEC_RETVAL return values
344 ///
345 virtual VIDEOCODEC_RETVAL GetPicture(VIDEOCODEC_PICTURE& picture) { return VC_ERROR; }
346 //----------------------------------------------------------------------------
168 347
169 //! \copydoc CInstanceVideoCodec::GetPicture 348 //============================================================================
170 virtual VIDEOCODEC_RETVAL GetPicture(VIDEOCODEC_PICTURE &picture) { return VC_ERROR; }; 349 /// @ingroup cpp_kodi_addon_videocodec
350 /// @brief should return codecs name
351 ///
352 /// @return Codec name
353 ///
354 virtual const char* GetName() { return nullptr; }
355 //----------------------------------------------------------------------------
171 356
172 //! \copydoc CInstanceVideoCodec::GetName 357 //============================================================================
173 virtual const char *GetName() { return nullptr; }; 358 /// @ingroup cpp_kodi_addon_videocodec
359 /// @brief Reset the decoder
360 ///
361 virtual void Reset() {}
362 //----------------------------------------------------------------------------
174 363
175 //! \copydoc CInstanceVideoCodec::Reset 364 /*!
176 virtual void Reset() {}; 365 * @brief AddonToKodi interface
366 */
177 367
178 /*! 368 //============================================================================
179 * @brief AddonToKodi interface 369 /// @ingroup cpp_kodi_addon_videocodec
180 */ 370 /// @brief All picture members can be expected to be set correctly except
371 /// decodedData and pts.
372 ///
373 /// GetFrameBuffer has to set decodedData to a valid memory address and return true.
374 ///
375 /// @param[out] picture The buffer, or unmodified if false is returned
376 /// @return In case buffer allocation fails, it return false.
377 ///
378 /// @note If this returns true, buffer must be freed using @ref ReleaseFrameBuffer().
379 ///
380 /// @remarks Only called from addon itself
381 ///
382 bool GetFrameBuffer(VIDEOCODEC_PICTURE& picture)
383 {
384 return m_instanceData->toKodi->get_frame_buffer(m_instanceData->toKodi->kodiInstance, &picture);
385 }
386 //----------------------------------------------------------------------------
181 387
182 //! \copydoc CInstanceVideoCodec::GetFrameBuffer 388 //============================================================================
183 bool GetFrameBuffer(VIDEOCODEC_PICTURE &picture) 389 ///
184 { 390 /// @ingroup cpp_kodi_addon_videocodec
185 return m_instanceData->toKodi->get_frame_buffer(m_instanceData->toKodi->kodiInstance, 391 /// @brief Release the with @ref GetFrameBuffer() given framebuffer.
186 &picture); 392 ///
187 } 393 /// @param[in] handle the on @ref VIDEOCODEC_PICTURE.videoBufferHandle defined buffer handle
394 ///
395 /// @remarks Only called from addon itself
396 ///
397 void ReleaseFrameBuffer(void* buffer)
398 {
399 return m_instanceData->toKodi->release_frame_buffer(m_instanceData->toKodi->kodiInstance,
400 buffer);
401 }
402 //----------------------------------------------------------------------------
188 403
189 //! \copydoc CInstanceVideoCodec::ReleaseFrameBuffer 404private:
190 void ReleaseFrameBuffer(void *buffer) 405 void SetAddonStruct(KODI_HANDLE instance)
191 { 406 {
192 return m_instanceData->toKodi->release_frame_buffer(m_instanceData->toKodi->kodiInstance, 407 if (instance == nullptr)
193 buffer); 408 throw std::logic_error("kodi::addon::CInstanceVideoCodec: Creation with empty addon "
194 } 409 "structure not allowed, table must be given from Kodi!");
195 410
196 private: 411 m_instanceData = static_cast<AddonInstance_VideoCodec*>(instance);
197 void SetAddonStruct(KODI_HANDLE instance)
198 {
199 if (instance == nullptr)
200 throw std::logic_error("kodi::addon::CInstanceVideoCodec: Creation with empty addon structure not allowed, table must be given from Kodi!");
201 412
202 m_instanceData = static_cast<AddonInstance_VideoCodec*>(instance); 413 m_instanceData->toAddon->addonInstance = this;
414 m_instanceData->toAddon->open = ADDON_Open;
415 m_instanceData->toAddon->reconfigure = ADDON_Reconfigure;
416 m_instanceData->toAddon->add_data = ADDON_AddData;
417 m_instanceData->toAddon->get_picture = ADDON_GetPicture;
418 m_instanceData->toAddon->get_name = ADDON_GetName;
419 m_instanceData->toAddon->reset = ADDON_Reset;
420 }
203 421
204 m_instanceData->toAddon->addonInstance = this; 422 inline static bool ADDON_Open(const AddonInstance_VideoCodec* instance,
205 m_instanceData->toAddon->open = ADDON_Open; 423 VIDEOCODEC_INITDATA* initData)
206 m_instanceData->toAddon->reconfigure = ADDON_Reconfigure; 424 {
207 m_instanceData->toAddon->add_data = ADDON_AddData; 425 return static_cast<CInstanceVideoCodec*>(instance->toAddon->addonInstance)->Open(initData);
208 m_instanceData->toAddon->get_picture = ADDON_GetPicture; 426 }
209 m_instanceData->toAddon->get_name = ADDON_GetName;
210 m_instanceData->toAddon->reset = ADDON_Reset;
211 }
212 427
213 inline static bool ADDON_Open(const AddonInstance_VideoCodec* instance, VIDEOCODEC_INITDATA *initData) 428 inline static bool ADDON_Reconfigure(const AddonInstance_VideoCodec* instance,
214 { 429 VIDEOCODEC_INITDATA* initData)
215 return static_cast<CInstanceVideoCodec*>(instance->toAddon->addonInstance)->Open(*initData); 430 {
216 } 431 return static_cast<CInstanceVideoCodec*>(instance->toAddon->addonInstance)
432 ->Reconfigure(initData);
433 }
217 434
218 inline static bool ADDON_Reconfigure(const AddonInstance_VideoCodec* instance, VIDEOCODEC_INITDATA *initData) 435 inline static bool ADDON_AddData(const AddonInstance_VideoCodec* instance,
219 { 436 const DEMUX_PACKET* packet)
220 return static_cast<CInstanceVideoCodec*>(instance->toAddon->addonInstance) 437 {
221 ->Reconfigure(*initData); 438 return static_cast<CInstanceVideoCodec*>(instance->toAddon->addonInstance)->AddData(*packet);
222 } 439 }
223 440
224 inline static bool ADDON_AddData(const AddonInstance_VideoCodec* instance, const DemuxPacket *packet) 441 inline static VIDEOCODEC_RETVAL ADDON_GetPicture(const AddonInstance_VideoCodec* instance,
225 { 442 VIDEOCODEC_PICTURE* picture)
226 return static_cast<CInstanceVideoCodec*>(instance->toAddon->addonInstance) 443 {
227 ->AddData(*packet); 444 return static_cast<CInstanceVideoCodec*>(instance->toAddon->addonInstance)
228 } 445 ->GetPicture(*picture);
446 }
229 447
230 inline static VIDEOCODEC_RETVAL ADDON_GetPicture(const AddonInstance_VideoCodec* instance, VIDEOCODEC_PICTURE *picture) 448 inline static const char* ADDON_GetName(const AddonInstance_VideoCodec* instance)
231 { 449 {
232 return static_cast<CInstanceVideoCodec*>(instance->toAddon->addonInstance) 450 return static_cast<CInstanceVideoCodec*>(instance->toAddon->addonInstance)->GetName();
233 ->GetPicture(*picture); 451 }
234 }
235 452
236 inline static const char *ADDON_GetName(const AddonInstance_VideoCodec* instance) 453 inline static void ADDON_Reset(const AddonInstance_VideoCodec* instance)
237 { 454 {
238 return static_cast<CInstanceVideoCodec*>(instance->toAddon->addonInstance)->GetName(); 455 return static_cast<CInstanceVideoCodec*>(instance->toAddon->addonInstance)->Reset();
239 } 456 }
240 457
241 inline static void ADDON_Reset(const AddonInstance_VideoCodec* instance) 458 AddonInstance_VideoCodec* m_instanceData;
242 { 459};
243 return static_cast<CInstanceVideoCodec*>(instance->toAddon->addonInstance)->Reset();
244 }
245 460
246 AddonInstance_VideoCodec* m_instanceData; 461} // namespace addon
247 };
248 } // namespace addon
249} // namespace kodi 462} // namespace kodi
463
464#endif /* __cplusplus */
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Visualization.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Visualization.h
index 7b1db65..1dddea2 100644
--- a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Visualization.h
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Visualization.h
@@ -721,7 +721,7 @@ public:
721 inline void TransferPresets(const std::vector<std::string>& presets) 721 inline void TransferPresets(const std::vector<std::string>& presets)
722 { 722 {
723 m_instanceData->toKodi->clear_presets(m_instanceData->toKodi->kodiInstance); 723 m_instanceData->toKodi->clear_presets(m_instanceData->toKodi->kodiInstance);
724 for (auto it : presets) 724 for (const auto& it : presets)
725 m_instanceData->toKodi->transfer_preset(m_instanceData->toKodi->kodiInstance, it.c_str()); 725 m_instanceData->toKodi->transfer_preset(m_instanceData->toKodi->kodiInstance, it.c_str());
726 } 726 }
727 //---------------------------------------------------------------------------- 727 //----------------------------------------------------------------------------
@@ -915,7 +915,7 @@ private:
915 std::vector<std::string> presets; 915 std::vector<std::string> presets;
916 if (thisClass->GetPresets(presets)) 916 if (thisClass->GetPresets(presets))
917 { 917 {
918 for (auto it : presets) 918 for (const auto& it : presets)
919 thisClass->m_instanceData->toKodi->transfer_preset(addon->toKodi->kodiInstance, it.c_str()); 919 thisClass->m_instanceData->toKodi->transfer_preset(addon->toKodi->kodiInstance, it.c_str());
920 } 920 }
921 921
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/CMakeLists.txt b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/CMakeLists.txt
new file mode 100644
index 0000000..a551b4b
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/CMakeLists.txt
@@ -0,0 +1,8 @@
1set(HEADERS DemuxPacket.h
2 StreamCodec.h
3 StreamConstants.h
4 TimingConstants.h)
5
6if(NOT ENABLE_STATIC_LIBS)
7 core_add_library(addons_kodi-dev-kit_include_kodi_addon-instance_inputstream)
8endif()
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/DemuxPacket.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/DemuxPacket.h
new file mode 100644
index 0000000..f965b9f
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/DemuxPacket.h
@@ -0,0 +1,12 @@
1/*
2 * Copyright (C) 2005-2020 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "TimingConstants.h"
12#include "../../c-api/addon-instance/inputstream/demux_packet.h"
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/StreamCodec.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/StreamCodec.h
new file mode 100644
index 0000000..e80e2ca
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/StreamCodec.h
@@ -0,0 +1,11 @@
1/*
2 * Copyright (C) 2005-2020 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../../c-api/addon-instance/inputstream/stream_codec.h"
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/StreamConstants.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/StreamConstants.h
new file mode 100644
index 0000000..200631b
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/StreamConstants.h
@@ -0,0 +1,11 @@
1/*
2 * Copyright (C) 2005-2020 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../../c-api/addon-instance/inputstream/stream_constants.h"
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/StreamCrypto.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/StreamCrypto.h
new file mode 100644
index 0000000..8a85121
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/StreamCrypto.h
@@ -0,0 +1,99 @@
1/*
2 * Copyright (C) 2005-2020 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../../c-api/addon-instance/inputstream/stream_crypto.h"
12#include "../../AddonBase.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace addon
19{
20
21class CInstanceInputStream;
22class InputstreamInfo;
23class VideoCodecInitdata;
24
25//==============================================================================
26/// @defgroup cpp_kodi_addon_inputstream_Defs_StreamEncryption_StreamCryptoSession class StreamCryptoSession
27/// @ingroup cpp_kodi_addon_inputstream_Defs_StreamEncryption
28/// @brief **Data to manage stream cryptography**\n
29/// This class structure manages any encryption values required in order to have
30/// them available in their stream processing.
31///
32/// Used on inputstream by @ref kodi::addon::InputstreamInfo::SetCryptoSession /
33/// @ref kodi::addon::InputstreamInfo::GetCryptoSession and are given to the
34/// used video codec to decrypt related data.
35///
36/// ----------------------------------------------------------------------------
37///
38/// @copydetails cpp_kodi_addon_inputstream_Defs_Info_StreamCryptoSession_Help
39///
40///@{
41class ATTRIBUTE_HIDDEN StreamCryptoSession
42 : public CStructHdl<StreamCryptoSession, STREAM_CRYPTO_SESSION>
43{
44 /*! \cond PRIVATE */
45 friend class CInstanceInputStream;
46 friend class InputstreamInfo;
47 friend class VideoCodecInitdata;
48 /*! \endcond */
49
50public:
51 /*! \cond PRIVATE */
52 StreamCryptoSession() { memset(m_cStructure, 0, sizeof(STREAM_CRYPTO_SESSION)); }
53 StreamCryptoSession(const StreamCryptoSession& session) : CStructHdl(session) {}
54 /*! \endcond */
55
56 /// @defgroup cpp_kodi_addon_inputstream_Defs_Info_StreamCryptoSession_Help Value Help
57 /// @ingroup cpp_kodi_addon_inputstream_Defs_Info_StreamCryptoSession
58 ///
59 /// <b>The following table contains values that can be set with @ref cpp_kodi_addon_inputstream_Defs_Info_StreamCryptoSession :</b>
60 /// | Name | Type | Set call | Get call
61 /// |------|------|----------|----------
62 /// | **Keysystem for encrypted media** | @ref STREAM_CRYPTO_KEY_SYSTEM | @ref StreamCryptoSession::SetKeySystem "SetKeySystem" | @ref StreamCryptoSession::GetKeySystem "GetKeySystem"
63 /// | **Flags for special conditions** | `uint8_t` | @ref StreamCryptoSession::SetFlags "SetFlags" | @ref StreamCryptoSession::GetFlags "GetFlags"
64 /// | **Crypto session key id** | `std::string` | @ref StreamCryptoSession::SetSessionId "SetSessionId" | @ref StreamCryptoSession::GetSessionId "GetSessionId"
65
66 /// @brief To set keysystem for encrypted media, @ref STREAM_CRYPTO_KEY_SYSTEM_NONE for
67 /// unencrypted media.
68 ///
69 /// See @ref STREAM_CRYPTO_KEY_SYSTEM for available options.
70 void SetKeySystem(STREAM_CRYPTO_KEY_SYSTEM keySystem) { m_cStructure->keySystem = keySystem; }
71
72 /// @brief Get keysystem for encrypted media.
73 STREAM_CRYPTO_KEY_SYSTEM GetKeySystem() const { return m_cStructure->keySystem; }
74
75 /// @brief Set bit flags to use special conditions, see @ref STREAM_CRYPTO_FLAGS
76 /// for available flags.
77 void SetFlags(uint8_t flags) { m_cStructure->flags = flags; }
78
79 /// @brief Get flags for special conditions.
80 uint8_t GetFlags() const { return m_cStructure->flags; }
81
82 /// @brief To set the crypto session key identifier.
83 void SetSessionId(const std::string& sessionId)
84 {
85 strncpy(m_cStructure->sessionId, sessionId.c_str(), sizeof(m_cStructure->sessionId) - 1);
86 }
87
88 /// @brief To get the crypto session key identifier.
89 std::string GetSessionId() const { return m_cStructure->sessionId; }
90
91private:
92 StreamCryptoSession(const STREAM_CRYPTO_SESSION* session) : CStructHdl(session) {}
93 StreamCryptoSession(STREAM_CRYPTO_SESSION* session) : CStructHdl(session) {}
94};
95
96} /* namespace addon */
97} /* namespace kodi */
98
99#endif /* __cplusplus */
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/TimingConstants.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/TimingConstants.h
new file mode 100644
index 0000000..22f8952
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/TimingConstants.h
@@ -0,0 +1,59 @@
1/*
2 * Copyright (C) 2005-2020 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../../c-api/addon-instance/inputstream/timing_constants.h"
12
13#ifdef __cplusplus
14
15// Unset the on timing_constants.h given defines
16#undef STREAM_TIME_TO_MSEC
17#undef STREAM_SEC_TO_TIME
18#undef STREAM_MSEC_TO_TIME
19
20/// @ingroup cpp_kodi_addon_inputstream_Defs_TimingConstants
21/// @brief Converts a stream time to milliseconds as an integer value.
22///
23/// @param[in] x Stream time
24/// @return Milliseconds
25///
26/// @note Within "C" code this is used as `#define`.
27///
28constexpr int STREAM_TIME_TO_MSEC(double x)
29{
30 return static_cast<int>(x * 1000 / STREAM_TIME_BASE);
31}
32
33/// @ingroup cpp_kodi_addon_inputstream_Defs_TimingConstants
34/// @brief Converts a time in seconds to the used stream time format.
35///
36/// @param[in] x Seconds
37/// @return Stream time
38///
39/// @note Within "C" code this is used as `#define`.
40///
41constexpr double STREAM_SEC_TO_TIME(double x)
42{
43 return x * STREAM_TIME_BASE;
44}
45
46/// @ingroup cpp_kodi_addon_inputstream_Defs_TimingConstants
47/// @brief Converts a time in milliseconds to the used stream time format.
48///
49/// @param[in] x Milliseconds
50/// @return Stream time
51///
52/// @note Within "C" code this is used as `#define`.
53///
54constexpr double STREAM_MSEC_TO_TIME(double x)
55{
56 return x * STREAM_TIME_BASE / 1000;
57}
58
59#endif /* __cplusplus */
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/peripheral/PeripheralUtils.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/peripheral/PeripheralUtils.h
index febaeb9..1a6cc63 100644
--- a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/peripheral/PeripheralUtils.h
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/peripheral/PeripheralUtils.h
@@ -806,7 +806,7 @@ struct DriverPrimitive
806{ 806{
807protected: 807protected:
808 /*! 808 /*!
809 * \brief Construct a driver primitive of the specified type 809 * @brief Construct a driver primitive of the specified type
810 */ 810 */
811 DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE type, unsigned int driverIndex) 811 DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE type, unsigned int driverIndex)
812 : m_type(type), m_driverIndex(driverIndex) 812 : m_type(type), m_driverIndex(driverIndex)
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
index 5613947..4241c23 100644
--- 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
@@ -166,7 +166,7 @@ public:
166 m_cStructure->strLanguage[0] = language[0]; 166 m_cStructure->strLanguage[0] = language[0];
167 m_cStructure->strLanguage[1] = language[1]; 167 m_cStructure->strLanguage[1] = language[1];
168 m_cStructure->strLanguage[2] = language[2]; 168 m_cStructure->strLanguage[2] = language[2];
169 m_cStructure->strLanguage[2] = 0; 169 m_cStructure->strLanguage[3] = 0;
170 } 170 }
171 171
172 /// @brief To get with @ref SetLanguage() changed values. 172 /// @brief To get with @ref SetLanguage() changed values.