summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PVR.h
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PVR.h')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PVR.h3423
1 files changed, 3423 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PVR.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PVR.h
new file mode 100644
index 0000000..0bca8e2
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PVR.h
@@ -0,0 +1,3423 @@
1/*
2 * Copyright (C) 2005-2018 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/pvr.h"
12#include "pvr/ChannelGroups.h"
13#include "pvr/Channels.h"
14#include "pvr/EDL.h"
15#include "pvr/EPG.h"
16#include "pvr/General.h"
17#include "pvr/MenuHook.h"
18#include "pvr/Recordings.h"
19#include "pvr/Stream.h"
20#include "pvr/Timers.h"
21
22#ifdef __cplusplus
23
24/*!
25 * @internal
26 * @brief PVR "C++" API interface
27 *
28 * In this field are the pure addon-side C++ data.
29 *
30 * @note Changes can be made without problems and have no influence on other
31 * PVR addons that have already been created.\n
32 * \n
33 * Therefore, @ref ADDON_INSTANCE_VERSION_PVR_MIN can be ignored for these
34 * fields and only the @ref ADDON_INSTANCE_VERSION_PVR needs to be increased.\n
35 * \n
36 * Only must be min version increased if a new compile of addon breaks after
37 * changes here.
38 *
39 * Have by add of new parts a look about **Doxygen** `\\ingroup`, so that
40 * added parts included in documentation.
41 *
42 * If you add addon side related documentation, where his dev need know, use `///`.
43 * For parts only for Kodi make it like here.
44 *
45 * @endinternal
46 */
47
48namespace kodi
49{
50namespace addon
51{
52
53//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
54// "C++" Doxygen group set for the definitions
55//{{{
56
57//==============================================================================
58/// @defgroup cpp_kodi_addon_pvr_Defs Definitions, structures and enumerators
59/// @ingroup cpp_kodi_addon_pvr
60/// @brief **PVR client add-on instance definition values**\n
61/// All PVR functions associated data structures.
62///
63/// Used to exchange the available options between Kodi and addon.\n
64/// The groups described here correspond to the groups of functions on PVR
65/// instance class.
66///
67
68//##############################################################################
69/// @defgroup cpp_kodi_addon_pvr_Defs_General 1. General
70/// @ingroup cpp_kodi_addon_pvr_Defs
71/// @brief **PVR add-on general variables**\n
72/// Used to exchange the available options between Kodi and addon.
73///
74/// This group also includes @ref cpp_kodi_addon_pvr_Defs_PVRCapabilities with
75/// which Kodi an @ref kodi::addon::CInstancePVRClient::GetCapabilities()
76/// queries the supported **modules** of the addon.
77///
78/// The standard values are also below, once for error messages and once to
79/// @ref kodi::addon::CInstancePVRClient::ConnectionStateChange() to give Kodi
80/// any information.
81///
82///@{
83//##############################################################################
84/// @defgroup cpp_kodi_addon_pvr_Defs_General_Inputstream class PVRStreamProperty & definition PVR_STREAM_PROPERTY
85/// @ingroup cpp_kodi_addon_pvr_Defs_General
86/// @brief **Inputstream variables**\n
87/// This includes values related to the outside of PVR available inputstream
88/// system.
89///
90/// This can be by separate instance on same addon, by handling in Kodi itself
91/// or to reference of another addon where support needed inputstream.
92///
93/// @note This is complete independent from own system included here
94/// @ref cpp_kodi_addon_pvr_Streams "inputstream".
95///
96//------------------------------------------------------------------------------
97///@}
98
99//##############################################################################
100/// @defgroup cpp_kodi_addon_pvr_Defs_Channel 2. Channel
101/// @ingroup cpp_kodi_addon_pvr_Defs
102/// @brief **PVR add-on channel**\n
103/// Used to exchange the available channel options between Kodi and addon.
104///
105/// Modules here are mainly intended for @ref cpp_kodi_addon_pvr_Channels "channels",
106/// but are also used on other modules to identify the respective TV/radio
107/// channel.
108///
109/// Because of @ref cpp_kodi_addon_pvr_Defs_Channel_PVRSignalStatus and
110/// @ref cpp_kodi_addon_pvr_Defs_Channel_PVRDescrambleInfo is a special case at
111/// this point. This is currently only used on running streams, but it may be
112/// possible that this must always be usable in connection with PiP in the
113/// future.
114///
115//------------------------------------------------------------------------------
116
117//##############################################################################
118/// @defgroup cpp_kodi_addon_pvr_Defs_ChannelGroup 3. Channel Group
119/// @ingroup cpp_kodi_addon_pvr_Defs
120/// @brief **PVR add-on channel group**\n
121/// This group contains data classes and values which are used in PVR on
122/// @ref cpp_kodi_addon_pvr_supportsChannelGroups "channel groups".
123///
124//------------------------------------------------------------------------------
125
126//##############################################################################
127/// @defgroup cpp_kodi_addon_pvr_Defs_epg 4. EPG Tag
128/// @ingroup cpp_kodi_addon_pvr_Defs
129/// @brief **PVR add-on EPG data**\n
130/// Used on @ref cpp_kodi_addon_pvr_EPGTag "EPG methods in PVR instance class".
131///
132/// See related modules about, also below in this view are few macros where
133/// default values of associated places.
134///
135//------------------------------------------------------------------------------
136
137//##############################################################################
138/// @defgroup cpp_kodi_addon_pvr_Defs_Recording 5. Recording
139/// @ingroup cpp_kodi_addon_pvr_Defs
140/// @brief **Representation of a recording**\n
141/// Used to exchange the available recording data between Kodi and addon on
142/// @ref cpp_kodi_addon_pvr_Recordings "Recordings methods in PVR instance class".
143///
144//------------------------------------------------------------------------------
145
146//##############################################################################
147/// @defgroup cpp_kodi_addon_pvr_Defs_Timer 6. Timer
148/// @ingroup cpp_kodi_addon_pvr_Defs
149/// @brief **PVR add-on timer data**\n
150/// Used to exchange the available timer data between Kodi and addon on
151/// @ref cpp_kodi_addon_pvr_Timers "Timers methods in PVR instance class".
152///
153//------------------------------------------------------------------------------
154
155//##############################################################################
156/// @defgroup cpp_kodi_addon_pvr_Defs_Menuhook 7. Menuhook
157/// @ingroup cpp_kodi_addon_pvr_Defs
158/// @brief **PVR Context menu data**\n
159/// Define data for the context menus available to the user
160///
161//------------------------------------------------------------------------------
162
163//##############################################################################
164/// @defgroup cpp_kodi_addon_pvr_Defs_EDLEntry 8. Edit decision list (EDL)
165/// @ingroup cpp_kodi_addon_pvr_Defs
166/// @brief **An edit decision list or EDL is used in the post-production process
167/// of film editing and video editing**\n
168/// Used on @ref kodi::addon::CInstancePVRClient::GetEPGTagEdl and
169/// @ref kodi::addon::CInstancePVRClient::GetRecordingEdl
170///
171//------------------------------------------------------------------------------
172
173//##############################################################################
174/// @defgroup cpp_kodi_addon_pvr_Defs_Stream 9. Inputstream
175/// @ingroup cpp_kodi_addon_pvr_Defs
176/// @brief **Inputstream**\n
177/// This includes classes and values that are used in the PVR inputstream.
178///
179/// Used on @ref cpp_kodi_addon_pvr_Streams "Inputstream methods in PVR instance class".
180///
181/// @note The parts here will be removed in the future and replaced by the
182/// separate @ref cpp_kodi_addon_inputstream "inputstream addon instance".
183/// If there is already a possibility, new addons should do it via the
184/// inputstream instance.
185///
186//------------------------------------------------------------------------------
187
188//}}}
189//______________________________________________________________________________
190
191//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
192// "C++" PVR addon instance class
193//{{{
194
195//==============================================================================
196/// @addtogroup cpp_kodi_addon_pvr
197/// @brief \cpp_class{ kodi::addon::CInstancePVRClient }
198/// **PVR client add-on instance**
199///
200/// Kodi features powerful [Live TV](https://kodi.wiki/view/Live_TV) and
201/// [video recording (DVR/PVR)](http://en.wikipedia.org/wiki/Digital_video_recorder)
202/// abilities using a very flexible distributed application structure. That is, by
203/// leveraging other existing third-party
204/// [PVR backend applications](https://kodi.wiki/view/PVR_backend) or
205/// [DVR devices](https://kodi.wiki/view/PVR_backend)
206/// that specialize in receiving television signals and also support the same type
207/// of [client–server model](http://en.wikipedia.org/wiki/client%E2%80%93server_model)
208/// which Kodi uses, (following a [frontend-backend](http://en.wikipedia.org/wiki/Front_and_back_ends)
209/// design principle for [separation of concerns](http://en.wikipedia.org/wiki/Separation_of_concerns)),
210/// these PVR features in Kodi allow you to watch Live TV, listen to radio, view an EPG TV-Guide
211/// and schedule recordings, and also enables many other TV related features, all using
212/// Kodi as your primary interface once the initial pairing connection and
213/// configuration have been done.
214///
215/// @note It is very important to understand that with "Live TV" in the reference
216/// to PVR in Kodi, we do not mean [streaming video](http://en.wikipedia.org/wiki/Streaming_media)
217/// from the internet via websites providing [free content](https://kodi.wiki/view/Free_content)
218/// or online services such as Netflix, Hulu, Vudu and similar, no matter if that
219/// content is actually streamed live or not. If that is what you are looking for
220/// then you might want to look into [Video Addons](https://kodi.wiki/view/Add-ons)
221/// for Kodi instead, (which again is not the same as the "PVR" or "Live TV" we
222/// discuss in this article), but remember that [Kodi does not provide any video
223/// content or video streaming services](https://kodi.wiki/view/Free_content).
224///
225/// The use of the PVR is based on the @ref CInstancePVRClient.
226///
227/// Include the header @ref PVR.h "#include <kodi/addon-instance/PVR.h>"
228/// to use this class.
229///
230///
231/// ----------------------------------------------------------------------------
232///
233/// Here is an example of what the <b>`addon.xml.in`</b> would look like for an PVR addon:
234///
235/// ~~~~~~~~~~~~~{.xml}
236/// <?xml version="1.0" encoding="UTF-8"?>
237/// <addon
238/// id="pvr.myspecialnamefor"
239/// version="1.0.0"
240/// name="My special PVR addon"
241/// provider-name="Your Name">
242/// <requires>@ADDON_DEPENDS@</requires>
243/// <extension
244/// point="kodi.pvrclient"
245/// library_@PLATFORM@="@LIBRARY_FILENAME@"/>
246/// <extension point="xbmc.addon.metadata">
247/// <summary lang="en_GB">My PVR addon addon</summary>
248/// <description lang="en_GB">My PVR addon description</description>
249/// <platform>@PLATFORM@</platform>
250/// </extension>
251/// </addon>
252/// ~~~~~~~~~~~~~
253///
254///
255/// At <b>`<extension point="kodi.pvrclient" ...>`</b> the basic instance definition is declared, this is intended to identify the addon as an PVR and to see its supported types:
256/// | Name | Description
257/// |------|----------------------
258/// | <b>`point`</b> | The identification of the addon instance to inputstream is mandatory <b>`kodi.pvrclient`</b>. In addition, the instance declared in the first <b>`<extension ... />`</b> is also the main type of addon.
259/// | <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`.
260///
261///
262/// @remark For more detailed description of the <b>`addon.xml`</b>, see also https://kodi.wiki/view/Addon.xml.
263///
264///
265/// --------------------------------------------------------------------------
266///
267/// **Example:**
268///
269/// ~~~~~~~~~~~~~{.cpp}
270/// #include <kodi/addon-instance/PVR.h>
271///
272/// class CMyPVRClient : public ::kodi::addon::CInstancePVRClient
273/// {
274/// public:
275/// CMyPVRClient(KODI_HANDLE instance, const std::string& kodiVersion);
276///
277/// PVR_ERROR GetCapabilities(kodi::addon::PVRCapabilities& capabilities) override;
278/// PVR_ERROR GetBackendName(std::string& name) override;
279/// PVR_ERROR GetBackendVersion(std::string& version) override;
280///
281/// PVR_ERROR GetChannelsAmount(int& amount) override;
282/// PVR_ERROR GetChannels(bool radio, std::vector<kodi::addon::PVRChannel>& channels) override;
283/// PVR_ERROR GetChannelStreamProperties(const kodi::addon::PVRChannel& channel,
284/// std::vector<kodi::addon::PVRStreamProperty>& properties) override;
285///
286/// private:
287/// std::vector<kodi::addon::PVRChannel> m_myChannels;
288/// };
289///
290/// CMyPVRClient::CMyPVRClient(KODI_HANDLE instance, const std::string& kodiVersion)
291/// : CInstancePVRClient(instance, kodiVersion)
292/// {
293/// kodi::addon::PVRChannel channel;
294/// channel.SetUniqueId(123);
295/// channel.SetChannelNumber(1);
296/// channel.SetChannelName("My test channel");
297/// m_myChannels.push_back(channel);
298/// }
299///
300/// PVR_ERROR CMyPVRClient::GetCapabilities(kodi::addon::PVRCapabilities& capabilities)
301/// {
302/// capabilities.SetSupportsTV(true);
303/// return PVR_ERROR_NO_ERROR;
304/// }
305///
306/// PVR_ERROR CMyPVRClient::GetBackendName(std::string& name)
307/// {
308/// name = "My special PVR client";
309/// return PVR_ERROR_NO_ERROR;
310/// }
311///
312/// PVR_ERROR CMyPVRClient::GetBackendVersion(std::string& version)
313/// {
314/// version = "1.0.0";
315/// return PVR_ERROR_NO_ERROR;
316/// }
317///
318/// PVR_ERROR CMyInstance::GetChannelsAmount(int& amount)
319/// {
320/// amount = m_myChannels.size();
321/// return PVR_ERROR_NO_ERROR;
322/// }
323///
324/// PVR_ERROR CMyPVRClient::GetChannels(bool radio, std::vector<kodi::addon::PVRChannel>& channels)
325/// {
326/// channels = m_myChannels;
327/// return PVR_ERROR_NO_ERROR;
328/// }
329///
330/// PVR_ERROR CMyPVRClient::GetChannelStreamProperties(const kodi::addon::PVRChannel& channel,
331/// std::vector<kodi::addon::PVRStreamProperty>& properties)
332/// {
333/// if (channel.GetUniqueId() == 123)
334/// {
335/// properties.push_back(PVR_STREAM_PROPERTY_STREAMURL, "http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4");
336/// properties.push_back(PVR_STREAM_PROPERTY_ISREALTIMESTREAM, "true");
337/// return PVR_ERROR_NO_ERROR;
338/// }
339/// return PVR_ERROR_UNKNOWN;
340/// }
341///
342/// ...
343///
344/// //----------------------------------------------------------------------
345///
346/// class CMyAddon : public ::kodi::addon::CAddonBase
347/// {
348/// public:
349/// CMyAddon() = default;
350/// ADDON_STATUS CreateInstance(int instanceType,
351/// const std::string& instanceID,
352/// KODI_HANDLE instance,
353/// const std::string& version,
354/// KODI_HANDLE& addonInstance) override;
355/// };
356///
357/// // If you use only one instance in your add-on, can be instanceType and
358/// // instanceID ignored
359/// ADDON_STATUS CMyAddon::CreateInstance(int instanceType,
360/// const std::string& instanceID,
361/// KODI_HANDLE instance,
362/// const std::string& version,
363/// KODI_HANDLE& addonInstance)
364/// {
365/// if (instanceType == ADDON_INSTANCE_PVR)
366/// {
367/// kodi::Log(ADDON_LOG_NOTICE, "Creating my PVR client instance");
368/// addonInstance = new CMyPVRClient(instance, version);
369/// return ADDON_STATUS_OK;
370/// }
371/// else if (...)
372/// {
373/// ...
374/// }
375/// return ADDON_STATUS_UNKNOWN;
376/// }
377///
378/// ADDONCREATOR(CMyAddon)
379/// ~~~~~~~~~~~~~
380///
381/// The destruction of the example class `CMyPVRClient` is called from
382/// Kodi's header. Manually deleting the add-on instance is not required.
383///
384class ATTRIBUTE_HIDDEN CInstancePVRClient : public IAddonInstance
385{
386public:
387 //============================================================================
388 /// @defgroup cpp_kodi_addon_pvr_Base 1. Basic functions
389 /// @ingroup cpp_kodi_addon_pvr
390 /// @brief **Functions to manage the addon and get basic information about it**\n
391 /// These are e.g. @ref GetCapabilities to know supported groups at
392 /// this addon or the others to get information about the source of the PVR
393 /// stream.
394 ///
395 /// The with "Valid implementation required." declared functions are mandatory,
396 /// all others are an option.
397 ///
398 ///
399 ///---------------------------------------------------------------------------
400 ///
401 /// **Basic parts in interface:**\n
402 /// Copy this to your project and extend with your parts or leave functions
403 /// complete away where not used or supported.
404 ///
405 /// @copydetails cpp_kodi_addon_pvr_Base_header_addon_auto_check
406 /// @copydetails cpp_kodi_addon_pvr_Base_source_addon_auto_check
407 ///
408 ///@{
409
410 //============================================================================
411 /// @brief PVR client class constructor.
412 ///
413 /// Used by an add-on that only supports only PVR and only in one instance.
414 ///
415 ///
416 /// --------------------------------------------------------------------------
417 ///
418 /// **Here's example about the use of this:**
419 /// ~~~~~~~~~~~~~{.cpp}
420 /// #include <kodi/addon-instance/PVR.h>
421 /// ...
422 ///
423 /// class ATTRIBUTE_HIDDEN CPVRExample
424 /// : public kodi::addon::CAddonBase,
425 /// public kodi::addon::CInstancePVRClient
426 /// {
427 /// public:
428 /// CPVRExample()
429 /// {
430 /// }
431 ///
432 /// ~CPVRExample() override;
433 /// {
434 /// }
435 ///
436 /// ...
437 /// };
438 ///
439 /// ADDONCREATOR(CPVRExample)
440 /// ~~~~~~~~~~~~~
441 ///
442 CInstancePVRClient() : IAddonInstance(ADDON_INSTANCE_PVR, GetKodiTypeVersion(ADDON_INSTANCE_PVR))
443 {
444 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
445 throw std::logic_error("kodi::addon::CInstancePVRClient: Creation of more as one in single "
446 "instance way is not allowed!");
447
448 SetAddonStruct(CAddonBase::m_interface->firstKodiInstance, m_kodiVersion);
449 CAddonBase::m_interface->globalSingleInstance = this;
450 }
451 //----------------------------------------------------------------------------
452
453 //============================================================================
454 /// @brief PVR client class constructor used to support multiple instance
455 /// types.
456 ///
457 /// @param[in] instance The instance value given to
458 /// <b>`kodi::addon::CAddonBase::CreateInstance(...)`</b>.
459 /// @param[in] kodiVersion [opt] Version used in Kodi for this instance, to
460 /// allow compatibility to older Kodi versions.
461 ///
462 /// @note Recommended to set <b>`kodiVersion`</b>.
463 ///
464 ///
465 /// --------------------------------------------------------------------------
466 ///
467 /// **Here's example about the use of this:**
468 /// ~~~~~~~~~~~~~{.cpp}
469 /// class CMyPVRClient : public ::kodi::addon::CInstancePVRClient
470 /// {
471 /// public:
472 /// CMyPVRClient(KODI_HANDLE instance, const std::string& kodiVersion)
473 /// : CInstancePVRClient(instance, kodiVersion)
474 /// {
475 /// ...
476 /// }
477 ///
478 /// ...
479 /// };
480 ///
481 /// ADDON_STATUS CMyAddon::CreateInstance(int instanceType,
482 /// const std::string& instanceID,
483 /// KODI_HANDLE instance,
484 /// const std::string& version,
485 /// KODI_HANDLE& addonInstance)
486 /// {
487 /// kodi::Log(ADDON_LOG_NOTICE, "Creating my PVR client instance");
488 /// addonInstance = new CMyPVRClient(instance, version);
489 /// return ADDON_STATUS_OK;
490 /// }
491 /// ~~~~~~~~~~~~~
492 ///
493 explicit CInstancePVRClient(KODI_HANDLE instance, const std::string& kodiVersion = "")
494 : IAddonInstance(ADDON_INSTANCE_PVR,
495 !kodiVersion.empty() ? kodiVersion : GetKodiTypeVersion(ADDON_INSTANCE_PVR))
496 {
497 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
498 throw std::logic_error("kodi::addon::CInstancePVRClient: Creation of multiple together with "
499 "single instance way is not allowed!");
500
501 SetAddonStruct(instance, m_kodiVersion);
502 }
503 //----------------------------------------------------------------------------
504
505 //============================================================================
506 /// @brief Destructor
507 ///
508 ~CInstancePVRClient() override = default;
509 //----------------------------------------------------------------------------
510
511 //--==----==----==----==----==----==----==----==----==----==----==----==----==
512
513 //============================================================================
514 /// @brief Get the list of features that this add-on provides.
515 ///
516 /// Called by Kodi to query the add-on's capabilities.
517 /// Used to check which options should be presented in the UI, which methods to call, etc.
518 /// All capabilities that the add-on supports should be set to true.
519 ///
520 /// @param capabilities The with @ref cpp_kodi_addon_pvr_Defs_PVRCapabilities defined add-on's capabilities.
521 /// @return @ref PVR_ERROR_NO_ERROR if the properties were fetched successfully.
522 ///
523 /// --------------------------------------------------------------------------
524 ///
525 /// @copydetails cpp_kodi_addon_pvr_Defs_PVRCapabilities_Help
526 ///
527 ///
528 /// --------------------------------------------------------------------------
529 ///
530 /// **Example:**
531 /// ~~~~~~~~~~~~~{.cpp}
532 /// PVR_ERROR CMyPVRClient::GetCapabilities(kodi::addon::PVRCapabilities& capabilities)
533 /// {
534 /// capabilities.SetSupportsTV(true);
535 /// capabilities.SetSupportsEPG(true);
536 /// return PVR_ERROR_NO_ERROR;
537 /// }
538 /// ~~~~~~~~~~~~~
539 ///
540 /// --------------------------------------------------------------------------
541 ///
542 /// @note Valid implementation required.
543 ///
544 virtual PVR_ERROR GetCapabilities(kodi::addon::PVRCapabilities& capabilities) = 0;
545 //----------------------------------------------------------------------------
546
547 //============================================================================
548 /// @brief Get the name reported by the backend that will be displayed in the UI.
549 ///
550 /// @param[out] name The name reported by the backend that will be displayed in the UI.
551 /// @return @ref PVR_ERROR_NO_ERROR if successfully done
552 ///
553 ///
554 /// --------------------------------------------------------------------------
555 ///
556 /// **Example:**
557 /// ~~~~~~~~~~~~~{.cpp}
558 /// PVR_ERROR CMyPVRClient::GetBackendName(std::string& name)
559 /// {
560 /// name = "My special PVR client";
561 /// return PVR_ERROR_NO_ERROR;
562 /// }
563 /// ~~~~~~~~~~~~~
564 ///
565 /// --------------------------------------------------------------------------
566 ///
567 /// @note Valid implementation required.
568 ///
569 virtual PVR_ERROR GetBackendName(std::string& name) = 0;
570 //----------------------------------------------------------------------------
571
572 //============================================================================
573 /// @brief Get the version string reported by the backend that will be
574 /// displayed in the UI.
575 ///
576 /// @param[out] version The version string reported by the backend that will be
577 /// displayed in the UI.
578 /// @return @ref PVR_ERROR_NO_ERROR if successfully done
579 ///
580 ///
581 /// --------------------------------------------------------------------------
582 ///
583 /// **Example:**
584 /// ~~~~~~~~~~~~~{.cpp}
585 /// PVR_ERROR CMyPVRClient::GetBackendVersion(std::string& version)
586 /// {
587 /// version = "1.0.0";
588 /// return PVR_ERROR_NO_ERROR;
589 /// }
590 /// ~~~~~~~~~~~~~
591 ///
592 /// --------------------------------------------------------------------------
593 ///
594 /// @note Valid implementation required.
595 ///
596 virtual PVR_ERROR GetBackendVersion(std::string& version) = 0;
597 //----------------------------------------------------------------------------
598
599 //============================================================================
600 /// @brief Get the hostname of the pvr backend server
601 ///
602 /// @param[out] hostname Hostname as ip address or alias. If backend does not
603 /// utilize a server, return empty string.
604 /// @return @ref PVR_ERROR_NO_ERROR if successfully done
605 ///
606 virtual PVR_ERROR GetBackendHostname(std::string& hostname) { return PVR_ERROR_NOT_IMPLEMENTED; }
607 //----------------------------------------------------------------------------
608
609 //============================================================================
610 /// @brief To get the connection string reported by the backend that will be
611 /// displayed in the UI.
612 ///
613 /// @param[out] connection The connection string reported by the backend that
614 /// will be displayed in the UI.
615 /// @return @ref PVR_ERROR_NO_ERROR if successfully done
616 ///
617 virtual PVR_ERROR GetConnectionString(std::string& connection)
618 {
619 return PVR_ERROR_NOT_IMPLEMENTED;
620 }
621 //----------------------------------------------------------------------------
622
623 //============================================================================
624 /// @brief Get the disk space reported by the backend (if supported).
625 ///
626 /// @param[in] total The total disk space in bytes.
627 /// @param[in] used The used disk space in bytes.
628 /// @return @ref PVR_ERROR_NO_ERROR if the drive space has been fetched
629 /// successfully.
630 ///
631 ///
632 /// --------------------------------------------------------------------------
633 ///
634 /// **Example:**
635 /// ~~~~~~~~~~~~~{.cpp}
636 /// PVR_ERROR CMyPVRClient::GetDriveSpace(uint64_t& total, uint64_t& used)
637 /// {
638 /// total = 10 * 1024 * 1024 * 1024; // To set complete size of drive in bytes
639 /// used = 122324243; // To set the used amount
640 /// return PVR_ERROR_NO_ERROR;
641 /// }
642 /// ~~~~~~~~~~~~~
643 ///
644 virtual PVR_ERROR GetDriveSpace(uint64_t& total, uint64_t& used)
645 {
646 return PVR_ERROR_NOT_IMPLEMENTED;
647 }
648 //----------------------------------------------------------------------------
649
650 //============================================================================
651 /// @brief Call one of the settings related menu hooks (if supported).
652 ///
653 /// Supported @ref cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook "menu hook "
654 /// instances have to be added in `constructor()`, by calling @ref AddMenuHook()
655 /// on the callback.
656 ///
657 /// @param[in] menuhook The hook to call.
658 /// @return @ref PVR_ERROR_NO_ERROR if the hook was called successfully.
659 ///
660 /// --------------------------------------------------------------------------
661 ///
662 /// @copydetails cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help
663 ///
664 ///
665 /// --------------------------------------------------------------------------
666 ///
667 /// **Example:**
668 /// ~~~~~~~~~~~~~{.cpp}
669 /// PVR_ERROR CMyPVRClient::CallSettingsMenuHook(const kodi::addon::PVRMenuhook& menuhook)
670 /// {
671 /// if (menuhook.GetHookId() == 2)
672 /// kodi::QueueNotification(QUEUE_INFO, "", kodi::GetLocalizedString(menuhook.GetLocalizedStringId()));
673 /// return PVR_ERROR_NO_ERROR;
674 /// }
675 /// ~~~~~~~~~~~~~
676 ///
677 virtual PVR_ERROR CallSettingsMenuHook(const kodi::addon::PVRMenuhook& menuhook)
678 {
679 return PVR_ERROR_NOT_IMPLEMENTED;
680 }
681 //----------------------------------------------------------------------------
682
683 //==========================================================================
684 /// @brief **Callback to Kodi Function**\nAdd or replace a menu hook for the context menu for this add-on
685 ///
686 /// This is a callback function, called from addon to give Kodi his context menu's.
687 ///
688 /// @param[in] menuhook The with @ref cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook defined hook to add
689 ///
690 /// @remarks Only called from addon itself
691 ///
692 /// --------------------------------------------------------------------------
693 ///
694 /// @copydetails cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help
695 ///
696 ///
697 /// --------------------------------------------------------------------------
698 ///
699 /// **Here's an example of the use of it:**
700 /// ~~~~~~~~~~~~~{.cpp}
701 /// #include <kodi/addon-instance/PVR.h>
702 /// ...
703 ///
704 /// {
705 /// kodi::addon::PVRMenuhook hook;
706 /// hook.SetHookId(1);
707 /// hook.SetCategory(PVR_MENUHOOK_CHANNEL);
708 /// hook.SetLocalizedStringId(30000);
709 /// AddMenuHook(hook);
710 /// }
711 ///
712 /// {
713 /// kodi::addon::PVRMenuhook hook;
714 /// hook.SetHookId(2);
715 /// hook.SetCategory(PVR_MENUHOOK_SETTING);
716 /// hook.SetLocalizedStringId(30001);
717 /// AddMenuHook(hook);
718 /// }
719 /// ...
720 /// ~~~~~~~~~~~~~
721 ///
722 /// **Here another way:**
723 /// ~~~~~~~~~~~~~{.cpp}
724 /// #include <kodi/addon-instance/PVR.h>
725 /// ...
726 ///
727 /// AddMenuHook(kodi::addon::PVRMenuhook(1, 30000, PVR_MENUHOOK_CHANNEL));
728 /// AddMenuHook(kodi::addon::PVRMenuhook(2, 30001, PVR_MENUHOOK_SETTING));
729 /// ...
730 /// ~~~~~~~~~~~~~
731 ///
732 inline void AddMenuHook(const kodi::addon::PVRMenuhook& hook)
733 {
734 m_instanceData->toKodi->AddMenuHook(m_instanceData->toKodi->kodiInstance, hook);
735 }
736 //----------------------------------------------------------------------------
737
738 //==========================================================================
739 /// @brief **Callback to Kodi Function**\n
740 /// Notify a state change for a PVR backend connection.
741 ///
742 /// @param[in] connectionString The connection string reported by the backend
743 /// that can be displayed in the UI.
744 /// @param[in] newState The by @ref PVR_CONNECTION_STATE defined new state.
745 /// @param[in] message A localized addon-defined string representing the new
746 /// state, that can be displayed in the UI or **empty** if
747 /// the Kodi-defined default string for the new state
748 /// shall be displayed.
749 ///
750 /// @remarks Only called from addon itself
751 ///
752 ///
753 /// --------------------------------------------------------------------------
754 ///
755 ///
756 /// **Here's an example of the use of it:**
757 /// ~~~~~~~~~~~~~{.cpp}
758 /// #include <kodi/addon-instance/PVR.h>
759 /// #include <kodi/General.h> /* for kodi::GetLocalizedString(...) */
760 /// ...
761 ///
762 /// ConnectionStateChange("PVR demo connection lost", PVR_CONNECTION_STATE_DISCONNECTED, kodi::GetLocalizedString(30005, "Lost connection to Server"););
763 /// ...
764 /// ~~~~~~~~~~~~~
765 ///
766 inline void ConnectionStateChange(const std::string& connectionString,
767 PVR_CONNECTION_STATE newState,
768 const std::string& message)
769 {
770 m_instanceData->toKodi->ConnectionStateChange(
771 m_instanceData->toKodi->kodiInstance, connectionString.c_str(), newState, message.c_str());
772 }
773 //----------------------------------------------------------------------------
774
775 //==========================================================================
776 /// @brief **Callback to Kodi Function**\n
777 /// Get user data path of the PVR addon.
778 ///
779 /// @return Path of current Kodi user
780 ///
781 /// @remarks Only called from addon itself
782 ///
783 /// @note Alternatively, @ref kodi::GetAddonPath() can be used for this.
784 ///
785 inline std::string UserPath() const { return m_instanceData->props->strUserPath; }
786 //----------------------------------------------------------------------------
787
788 //==========================================================================
789 /// @brief **Callback to Kodi Function**\n
790 /// Get main client path of the PVR addon.
791 ///
792 /// @return Path of addon client
793 ///
794 /// @remarks Only called from addon itself.
795 ///
796 /// @note Alternatively, @ref kodi::GetBaseUserPath() can be used for this.
797 ///
798 inline std::string ClientPath() const { return m_instanceData->props->strClientPath; }
799 //----------------------------------------------------------------------------
800
801 ///@}
802 //--==----==----==----==----==----==----==----==----==----==----==----==----==
803
804 //============================================================================
805 /// @defgroup cpp_kodi_addon_pvr_Channels 2. Channels (required)
806 /// @ingroup cpp_kodi_addon_pvr
807 /// @brief **Functions to get available TV or Radio channels**\n
808 /// These are mandatory functions for using this addon to get the available
809 /// channels.
810 ///
811 /// @remarks Either @ref PVRCapabilities::SetSupportsTV "SetSupportsTV()" or
812 /// @ref PVRCapabilities::SetSupportsRadio "SetSupportsRadio()" is required to
813 /// be set to <b>`true`</b>.\n
814 /// If a channel changes after the initial import, or if a new one was added,
815 /// then the add-on should call @ref TriggerChannelUpdate().
816 ///
817 ///
818 ///---------------------------------------------------------------------------
819 ///
820 /// **Channel parts in interface:**\n
821 /// Copy this to your project and extend with your parts or leave functions
822 /// complete away where not used or supported.
823 ///
824 /// @copydetails cpp_kodi_addon_pvr_Channels_header_addon_auto_check
825 /// @copydetails cpp_kodi_addon_pvr_Channels_source_addon_auto_check
826 ///
827 ///@{
828
829 //============================================================================
830 /// @brief The total amount of channels on the backend
831 ///
832 /// @param[out] amount The total amount of channels on the backend
833 /// @return @ref PVR_ERROR_NO_ERROR if the amount has been fetched successfully.
834 ///
835 /// @remarks Valid implementation required.
836 ///
837 virtual PVR_ERROR GetChannelsAmount(int& amount) { return PVR_ERROR_NOT_IMPLEMENTED; }
838 //----------------------------------------------------------------------------
839
840 //============================================================================
841 /// @brief Request the list of all channels from the backend.
842 ///
843 /// @param[in] radio True to get the radio channels, false to get the TV channels.
844 /// @param[out] results The channels defined with @ref cpp_kodi_addon_pvr_Defs_Channel_PVRChannel
845 /// and available at the addon, them transferred with
846 /// @ref cpp_kodi_addon_pvr_Defs_Channel_PVRChannelsResultSet.
847 /// @return @ref PVR_ERROR_NO_ERROR if the list has been fetched successfully.
848 ///
849 /// --------------------------------------------------------------------------
850 ///
851 /// @copydetails cpp_kodi_addon_pvr_Defs_Channel_PVRChannel_Help
852 ///
853 ///
854 /// --------------------------------------------------------------------------
855 ///
856 /// @remarks
857 /// If @ref PVRCapabilities::SetSupportsTV() is set to
858 /// <b>`true`</b>, a valid result set needs to be provided for <b>`radio = false`</b>.\n
859 /// If @ref PVRCapabilities::SetSupportsRadio() is set to
860 /// <b>`true`</b>, a valid result set needs to be provided for <b>`radio = true`</b>.
861 /// At least one of these two must provide a valid result set.
862 ///
863 ///
864 ///---------------------------------------------------------------------------
865 ///
866 /// **Example:**
867 /// ~~~~~~~~~~~~~{.cpp}
868 /// ...
869 /// PVR_ERROR CMyPVRInstance::GetChannels(bool radio, kodi::addon::PVRChannelsResultSet& results)
870 /// {
871 /// // Minimal demo example, in reality bigger and loop to transfer all
872 /// kodi::addon::PVRChannel channel;
873 /// channel.SetUniqueId(123);
874 /// channel.SetIsRadio(false);
875 /// channel.SetChannelNumber(1);
876 /// channel.SetChannelName("My channel name");
877 /// ...
878 ///
879 /// // Give it now to Kodi
880 /// results.Add(channel);
881 /// return PVR_ERROR_NO_ERROR;
882 /// }
883 /// ...
884 /// ~~~~~~~~~~~~~
885 ///
886 virtual PVR_ERROR GetChannels(bool radio, kodi::addon::PVRChannelsResultSet& results)
887 {
888 return PVR_ERROR_NOT_IMPLEMENTED;
889 }
890 //----------------------------------------------------------------------------
891
892 //============================================================================
893 /// @brief Get the stream properties for a channel from the backend.
894 ///
895 /// @param[in] channel The channel to get the stream properties for.
896 /// @param[out] properties the properties required to play the stream.
897 /// @return @ref PVR_ERROR_NO_ERROR if the stream is available.
898 ///
899 /// @remarks If @ref PVRCapabilities::SetSupportsTV "SetSupportsTV" or
900 /// @ref PVRCapabilities::SetSupportsRadio "SetSupportsRadio" are set to true
901 /// and @ref PVRCapabilities::SetHandlesInputStream "SetHandlesInputStream" is
902 /// set to false.\n\n
903 /// In this case the implementation must fill the property @ref PVR_STREAM_PROPERTY_STREAMURL
904 /// with the URL Kodi should resolve to playback the channel.
905 ///
906 /// @note The value directly related to inputstream must always begin with the
907 /// name of the associated add-on, e.g. <b>`"inputstream.adaptive.manifest_update_parameter"`</b>.
908 ///
909 ///
910 ///---------------------------------------------------------------------------
911 ///
912 /// **Example:**
913 /// ~~~~~~~~~~~~~{.cpp}
914 /// ...
915 /// PVR_ERROR CMyPVRInstance::GetChannelStreamProperties(const kodi::addon::PVRChannel& channel,
916 /// std::vector<kodi::addon::PVRStreamProperty>& properties)
917 /// {
918 /// ...
919 /// properties.emplace_back(PVR_STREAM_PROPERTY_INPUTSTREAM, "inputstream.adaptive");
920 /// properties.emplace_back("inputstream.adaptive.manifest_type", "mpd");
921 /// properties.emplace_back("inputstream.adaptive.manifest_update_parameter", "full");
922 /// properties.emplace_back(PVR_STREAM_PROPERTY_MIMETYPE, "application/xml+dash");
923 /// return PVR_ERROR_NO_ERROR;
924 /// }
925 /// ...
926 /// ~~~~~~~~~~~~~
927 ///
928 virtual PVR_ERROR GetChannelStreamProperties(
929 const kodi::addon::PVRChannel& channel,
930 std::vector<kodi::addon::PVRStreamProperty>& properties)
931 {
932 return PVR_ERROR_NOT_IMPLEMENTED;
933 }
934 //----------------------------------------------------------------------------
935
936 //============================================================================
937 /// @brief Get the signal status of the stream that's currently open.
938 ///
939 /// @param[out] signalStatus The signal status.
940 /// @return @ref PVR_ERROR_NO_ERROR if the signal status has been read successfully, false otherwise.
941 ///
942 /// @remarks Optional, and only used if @ref PVRCapabilities::SetHandlesInputStream "SetHandlesInputStream"
943 /// is set to true.
944 ///
945 /// --------------------------------------------------------------------------
946 ///
947 /// @copydetails cpp_kodi_addon_pvr_Defs_Channel_PVRSignalStatus_Help
948 ///
949 ///
950 /// --------------------------------------------------------------------------
951 ///
952 ///
953 /// **Here's example about the use of this:**
954 /// ~~~~~~~~~~~~~{.cpp}
955 /// #include <kodi/addon-instance/PVR.h>
956 /// ...
957 ///
958 /// class ATTRIBUTE_HIDDEN CPVRExample
959 /// : public kodi::addon::CAddonBase,
960 /// public kodi::addon::CInstancePVRClient
961 /// {
962 /// public:
963 /// ...
964 /// PVR_ERROR SignalStatus(PVRSignalStatus &signalStatus) override
965 /// {
966 /// signalStatus.SetAapterName("Example adapter 1");
967 /// signalStatus.SetAdapterStatus("OK");
968 /// signalStatus.SetSignal(0xFFFF); // 100%
969 ///
970 /// return PVR_ERROR_NO_ERROR;
971 /// }
972 /// };
973 ///
974 /// ADDONCREATOR(CPVRExample)
975 /// ~~~~~~~~~~~~~
976 ///
977 virtual PVR_ERROR GetSignalStatus(int channelUid, kodi::addon::PVRSignalStatus& signalStatus)
978 {
979 return PVR_ERROR_NOT_IMPLEMENTED;
980 }
981 //----------------------------------------------------------------------------
982
983 //============================================================================
984 /// @brief Get the descramble information of the stream that's currently open.
985 ///
986 /// @param[out] descrambleInfo The descramble information.
987 /// @return @ref PVR_ERROR_NO_ERROR if the descramble information has been
988 /// read successfully, false otherwise.
989 ///
990 /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsDescrambleInfo "supportsDescrambleInfo"
991 /// is set to true.
992 ///
993 /// --------------------------------------------------------------------------
994 ///
995 /// @copydetails cpp_kodi_addon_pvr_Defs_Channel_PVRDescrambleInfo_Help
996 ///
997 virtual PVR_ERROR GetDescrambleInfo(int channelUid,
998 kodi::addon::PVRDescrambleInfo& descrambleInfo)
999 {
1000 return PVR_ERROR_NOT_IMPLEMENTED;
1001 }
1002 //----------------------------------------------------------------------------
1003
1004 //============================================================================
1005 /// @brief **Callback to Kodi Function**\n
1006 /// Request Kodi to update it's list of channels.
1007 ///
1008 /// @remarks Only called from addon itself.
1009 ///
1010 inline void TriggerChannelUpdate()
1011 {
1012 m_instanceData->toKodi->TriggerChannelUpdate(m_instanceData->toKodi->kodiInstance);
1013 }
1014 //----------------------------------------------------------------------------
1015
1016 ///@}
1017 //--==----==----==----==----==----==----==----==----==----==----==----==----==
1018
1019 //============================================================================
1020 /// @defgroup cpp_kodi_addon_pvr_supportsChannelGroups 3. Channel Groups (optional)
1021 /// @ingroup cpp_kodi_addon_pvr
1022 /// @brief <b>Bring in this functions if you have set @ref PVRCapabilities::SetSupportsChannelGroups "supportsChannelGroups"
1023 /// to true</b>\n
1024 /// This is used to divide available addon channels into groups, which can
1025 /// then be selected by the user.
1026 ///
1027 ///
1028 ///---------------------------------------------------------------------------
1029 ///
1030 /// **Channel group parts in interface:**\n
1031 /// Copy this to your project and extend with your parts or leave functions
1032 /// complete away where not used or supported.
1033 ///
1034 /// @copydetails cpp_kodi_addon_pvr_supportsChannelGroups_header_addon_auto_check
1035 /// @copydetails cpp_kodi_addon_pvr_supportsChannelGroups_source_addon_auto_check
1036 ///
1037 ///@{
1038
1039 //============================================================================
1040 /// @brief Get the total amount of channel groups on the backend if it supports channel groups.
1041 ///
1042 /// @param[out] amount The total amount of channel groups on the backend
1043 /// @return @ref PVR_ERROR_NO_ERROR if the amount has been fetched successfully.
1044 ///
1045 /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelGroups "supportsChannelGroups" is set to true.
1046 ///
1047 virtual PVR_ERROR GetChannelGroupsAmount(int& amount) { return PVR_ERROR_NOT_IMPLEMENTED; }
1048 //----------------------------------------------------------------------------
1049
1050 //============================================================================
1051 /// @brief Get a list of available channel groups on addon
1052 ///
1053 /// Request the list of all channel groups from the backend if it supports
1054 /// channel groups.
1055 ///
1056 /// @param[in] radio True to get the radio channel groups, false to get the
1057 /// TV channel groups.
1058 /// @param[out] results List of available groups on addon defined with
1059 /// @ref cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroup,
1060 /// them transferred with
1061 /// @ref cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupsResultSet.
1062 /// @return @ref PVR_ERROR_NO_ERROR if the list has been fetched successfully.
1063 ///
1064 /// --------------------------------------------------------------------------
1065 ///
1066 /// @copydetails cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroup_Help
1067 ///
1068 ///
1069 /// --------------------------------------------------------------------------
1070 ///
1071 /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelGroups "supportsChannelGroups"
1072 /// is set to true.
1073 ///
1074 ///
1075 ///---------------------------------------------------------------------------
1076 ///
1077 /// **Example:**
1078 /// ~~~~~~~~~~~~~{.cpp}
1079 /// ...
1080 /// PVR_ERROR CMyPVRInstance::GetChannelGroups(bool radio, kodi::addon::PVRChannelGroupsResultSet& groups)
1081 /// {
1082 /// kodi::addon::PVRChannelGroup group;
1083 /// group.SetIsRadio(false);
1084 /// group.SetGroupName("My group name");
1085 /// group.SetPosition(1);
1086 /// ...
1087 ///
1088 /// // Give it now to Kodi
1089 /// results.Add(group);
1090 /// return PVR_ERROR_NO_ERROR;
1091 /// }
1092 /// ...
1093 /// ~~~~~~~~~~~~~
1094 ///
1095 virtual PVR_ERROR GetChannelGroups(bool radio, kodi::addon::PVRChannelGroupsResultSet& results)
1096 {
1097 return PVR_ERROR_NOT_IMPLEMENTED;
1098 }
1099 //----------------------------------------------------------------------------
1100
1101 //============================================================================
1102 /// @brief Get a list of members on a group
1103 ///
1104 /// Request the list of all group members of a group from the backend if it
1105 /// supports channel groups.
1106 ///
1107 /// @param[in] group The group to get the members for.
1108 /// @param[out] results List of available group member channels defined with
1109 /// @ref cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMember,
1110 /// them transferred with
1111 /// @ref PVRChannelGroupMembersResultSet.
1112 /// @return @ref PVR_ERROR_NO_ERROR if the list has been fetched successfully.
1113 ///
1114 /// --------------------------------------------------------------------------
1115 ///
1116 /// @copydetails cpp_kodi_addon_pvr_Defs_ChannelGroup_PVRChannelGroupMember_Help
1117 ///
1118 /// --------------------------------------------------------------------------
1119 ///
1120 /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelGroups "supportsChannelGroups"
1121 /// is set to true.
1122 ///
1123 ///
1124 ///---------------------------------------------------------------------------
1125 ///
1126 /// **Example:**
1127 /// ~~~~~~~~~~~~~{.cpp}
1128 /// ...
1129 /// PVR_ERROR CMyPVRInstance::GetChannelGroupMembers(const kodi::addon::PVRChannelGroup& group,
1130 /// kodi::addon::PVRChannelGroupMembersResultSet& results)
1131 /// {
1132 /// for (const auto& myGroup : m_myGroups)
1133 /// {
1134 /// if (myGroup.strGroupName == group.GetGroupName())
1135 /// {
1136 /// for (unsigned int iChannelPtr = 0; iChannelPtr < myGroup.members.size(); iChannelPtr++)
1137 /// {
1138 /// int iId = myGroup.members.at(iChannelPtr) - 1;
1139 /// if (iId < 0 || iId > (int)m_channels.size() - 1)
1140 /// continue;
1141 ///
1142 /// PVRDemoChannel &channel = m_channels.at(iId);
1143 /// kodi::addon::PVRChannelGroupMember kodiGroupMember;
1144 /// kodiGroupMember.SetGroupName(group.GetGroupName());
1145 /// kodiGroupMember.SetChannelUniqueId(channel.iUniqueId);
1146 /// kodiGroupMember.SetChannelNumber(channel.iChannelNumber);
1147 /// kodiGroupMember.SetSubChannelNumber(channel.iSubChannelNumber);
1148 ///
1149 /// results.Add(kodiGroupMember);
1150 /// }
1151 /// }
1152 /// }
1153 /// return PVR_ERROR_NO_ERROR;
1154 /// }
1155 /// ...
1156 /// ~~~~~~~~~~~~~
1157 ///
1158 virtual PVR_ERROR GetChannelGroupMembers(const kodi::addon::PVRChannelGroup& group,
1159 kodi::addon::PVRChannelGroupMembersResultSet& results)
1160 {
1161 return PVR_ERROR_NOT_IMPLEMENTED;
1162 }
1163 //----------------------------------------------------------------------------
1164
1165 //============================================================================
1166 /// @brief **Callback to Kodi Function**\n
1167 /// Request Kodi to update it's list of channel groups.
1168 ///
1169 /// @remarks Only called from addon itself
1170 ///
1171 inline void TriggerChannelGroupsUpdate()
1172 {
1173 m_instanceData->toKodi->TriggerChannelGroupsUpdate(m_instanceData->toKodi->kodiInstance);
1174 }
1175 //----------------------------------------------------------------------------
1176
1177 ///@}
1178 //--==----==----==----==----==----==----==----==----==----==----==----==----==
1179
1180 //============================================================================
1181 /// @defgroup cpp_kodi_addon_pvr_supportsChannelEdit 4. Channel edit (optional)
1182 /// @ingroup cpp_kodi_addon_pvr
1183 /// @brief <b>Bring in this functions if you have set @ref PVRCapabilities::SetSupportsChannelSettings "supportsChannelSettings"
1184 /// to true or for @ref OpenDialogChannelScan() set @ref PVRCapabilities::SetSupportsChannelScan "supportsChannelScan"
1185 /// to true</b>\n
1186 /// The support of this is a pure option and not mandatory.
1187 ///
1188 ///
1189 ///---------------------------------------------------------------------------
1190 ///
1191 /// **Channel edit parts in interface:**\n
1192 /// Copy this to your project and extend with your parts or leave functions
1193 /// complete away where not used or supported.
1194 ///
1195 /// @copydetails cpp_kodi_addon_pvr_supportsChannelEdit_header_addon_auto_check
1196 /// @copydetails cpp_kodi_addon_pvr_supportsChannelEdit_source_addon_auto_check
1197 ///
1198 ///@{
1199
1200 //============================================================================
1201 /// @brief Delete a channel from the backend.
1202 ///
1203 /// @param[in] channel The channel to delete.
1204 /// @return @ref PVR_ERROR_NO_ERROR if the channel has been deleted successfully.
1205 /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelSettings "supportsChannelSettings"
1206 /// is set to true.
1207 ///
1208 virtual PVR_ERROR DeleteChannel(const kodi::addon::PVRChannel& channel)
1209 {
1210 return PVR_ERROR_NOT_IMPLEMENTED;
1211 }
1212 //----------------------------------------------------------------------------
1213
1214 //==========================================================================
1215 /// @brief Rename a channel on the backend.
1216 ///
1217 /// @param[in] channel The channel to rename, containing the new channel name.
1218 /// @return @ref PVR_ERROR_NO_ERROR if the channel has been renamed successfully.
1219 ///
1220 /// --------------------------------------------------------------------------
1221 ///
1222 /// @copydetails cpp_kodi_addon_pvr_Defs_Channel_PVRChannel_Help
1223 ///
1224 ///
1225 /// --------------------------------------------------------------------------
1226 ///
1227 /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsChannelSettings "supportsChannelSettings"
1228 /// is set to true.
1229 ///
1230 virtual PVR_ERROR RenameChannel(const kodi::addon::PVRChannel& channel)
1231 {
1232 return PVR_ERROR_NOT_IMPLEMENTED;
1233 }
1234 //----------------------------------------------------------------------------
1235
1236 //==========================================================================
1237 /// @brief Show the channel settings dialog, if supported by the backend.
1238 ///
1239 /// @param[in] channel The channel to show the dialog for.
1240 /// @return @ref PVR_ERROR_NO_ERROR if the dialog has been displayed successfully.
1241 ///
1242 /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelSettings "supportsChannelSettings" is set to true.
1243 /// @note Use @ref cpp_kodi_gui_CWindow "kodi::gui::CWindow" to create dialog for them.
1244 ///
1245 virtual PVR_ERROR OpenDialogChannelSettings(const kodi::addon::PVRChannel& channel)
1246 {
1247 return PVR_ERROR_NOT_IMPLEMENTED;
1248 }
1249 //----------------------------------------------------------------------------
1250
1251 //==========================================================================
1252 /// @brief Show the dialog to add a channel on the backend, if supported by the backend.
1253 ///
1254 /// @param[in] channel The channel to add.
1255 /// @return @ref PVR_ERROR_NO_ERROR if the channel has been added successfully.
1256 ///
1257 /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelSettings "supportsChannelSettings" is set to true.
1258 /// @note Use @ref cpp_kodi_gui_CWindow "kodi::gui::CWindow" to create dialog for them.
1259 ///
1260 virtual PVR_ERROR OpenDialogChannelAdd(const kodi::addon::PVRChannel& channel)
1261 {
1262 return PVR_ERROR_NOT_IMPLEMENTED;
1263 }
1264 //----------------------------------------------------------------------------
1265
1266 //==========================================================================
1267 /// @brief Show the channel scan dialog if this backend supports it.
1268 ///
1269 /// @return @ref PVR_ERROR_NO_ERROR if the dialog was displayed successfully.
1270 ///
1271 /// @remarks Required if @ref PVRCapabilities::SetSupportsChannelScan "supportsChannelScan" is set to true.
1272 /// @note Use @ref cpp_kodi_gui_CWindow "kodi::gui::CWindow" to create dialog for them.
1273 ///
1274 virtual PVR_ERROR OpenDialogChannelScan() { return PVR_ERROR_NOT_IMPLEMENTED; }
1275 //----------------------------------------------------------------------------
1276
1277 //==========================================================================
1278 /// @brief Call one of the channel related menu hooks (if supported).
1279 ///
1280 /// Supported @ref cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook instances have to be added in
1281 /// `constructor()`, by calling @ref AddMenuHook() on the callback.
1282 ///
1283 /// @param[in] menuhook The hook to call.
1284 /// @param[in] item The selected channel item for which the hook was called.
1285 /// @return @ref PVR_ERROR_NO_ERROR if the hook was called successfully.
1286 ///
1287 /// --------------------------------------------------------------------------
1288 ///
1289 /// @copydetails cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help
1290 ///
1291 virtual PVR_ERROR CallChannelMenuHook(const kodi::addon::PVRMenuhook& menuhook,
1292 const kodi::addon::PVRChannel& item)
1293 {
1294 return PVR_ERROR_NOT_IMPLEMENTED;
1295 }
1296 //----------------------------------------------------------------------------
1297
1298 ///@}
1299 //--==----==----==----==----==----==----==----==----==----==----==----==----==
1300
1301 //============================================================================
1302 /// @defgroup cpp_kodi_addon_pvr_EPGTag 4. EPG methods (optional)
1303 /// @ingroup cpp_kodi_addon_pvr
1304 /// @brief **PVR EPG methods**\n
1305 /// These C ++ class functions of are intended for processing EPG information
1306 /// and for giving it to Kodi.
1307 ///
1308 /// The necessary data is transferred with @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag.
1309 ///
1310 /// @remarks Only used by Kodi if @ref PVRCapabilities::SetSupportsEPG "supportsEPG"
1311 /// is set to true.\n\n
1312 ///
1313 ///
1314 ///---------------------------------------------------------------------------
1315 ///
1316 /// **EPG parts in interface:**\n
1317 /// Copy this to your project and extend with your parts or leave functions
1318 /// complete away where not used or supported.
1319 ///
1320 /// @copydetails cpp_kodi_addon_pvr_EPGTag_header_addon_auto_check
1321 /// @copydetails cpp_kodi_addon_pvr_EPGTag_source_addon_auto_check
1322 ///
1323 ///@{
1324
1325 //============================================================================
1326 /// @brief Request the EPG for a channel from the backend.
1327 ///
1328 /// @param[in] channelUid The UID of the channel to get the EPG table for.
1329 /// @param[in] start Get events after this time (UTC).
1330 /// @param[in] end Get events before this time (UTC).
1331 /// @param[out] results List where available EPG information becomes
1332 /// transferred with @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag
1333 /// and given to Kodi
1334 /// @return @ref PVR_ERROR_NO_ERROR if the table has been fetched successfully.
1335 ///
1336 /// --------------------------------------------------------------------------
1337 ///
1338 /// @copydetails cpp_kodi_addon_pvr_Defs_epg_PVREPGTag_Help
1339 ///
1340 ///
1341 /// --------------------------------------------------------------------------
1342 ///
1343 /// @remarks Required if @ref PVRCapabilities::SetSupportsEPG "supportsEPG" is set to true.
1344 ///
1345 ///
1346 ///---------------------------------------------------------------------------
1347 ///
1348 /// **Example:**
1349 /// ~~~~~~~~~~~~~{.cpp}
1350 /// ...
1351 /// PVR_ERROR CMyPVRInstance::GetEPGForChannel(int channelUid,
1352 /// time_t start,
1353 /// time_t end,
1354 /// kodi::addon::PVREPGTagsResultSet& results)
1355 /// {
1356 /// // Minimal demo example, in reality bigger, loop to transfer all and to
1357 /// // match wanted times.
1358 /// kodi::addon::PVREPGTag tag;
1359 /// tag.SetUniqueBroadcastId(123);
1360 /// tag.SetUniqueChannelId(123);
1361 /// tag.SetTitle("My epg entry name");
1362 /// tag.SetGenreType(EPG_EVENT_CONTENTMASK_MOVIEDRAMA);
1363 /// tag.SetStartTime(1589148283); // Seconds elapsed since 00:00 hours, Jan 1, 1970 UTC
1364 /// tag.SetEndTime(1589151913);
1365 /// ...
1366 ///
1367 /// // Give it now to Kodi
1368 /// results.Add(tag);
1369 /// return PVR_ERROR_NO_ERROR;
1370 /// }
1371 /// ...
1372 /// ~~~~~~~~~~~~~
1373 ///
1374 virtual PVR_ERROR GetEPGForChannel(int channelUid,
1375 time_t start,
1376 time_t end,
1377 kodi::addon::PVREPGTagsResultSet& results)
1378 {
1379 return PVR_ERROR_NOT_IMPLEMENTED;
1380 }
1381 //----------------------------------------------------------------------------
1382
1383 //============================================================================
1384 /// @brief Check if the given EPG tag can be recorded.
1385 ///
1386 /// @param[in] tag the @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "epg tag" to check.
1387 /// @param[out] isRecordable Set to true if the tag can be recorded.
1388 /// @return @ref PVR_ERROR_NO_ERROR if bIsRecordable has been set successfully.
1389 ///
1390 /// @remarks Optional, it return @ref PVR_ERROR_NOT_IMPLEMENTED by parent to let Kodi decide.
1391 ///
1392 virtual PVR_ERROR IsEPGTagRecordable(const kodi::addon::PVREPGTag& tag, bool& isRecordable)
1393 {
1394 return PVR_ERROR_NOT_IMPLEMENTED;
1395 }
1396 //----------------------------------------------------------------------------
1397
1398 //============================================================================
1399 /// @brief Check if the given EPG tag can be played.
1400 ///
1401 /// @param[in] tag the @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "epg tag" to check.
1402 /// @param[out] isPlayable Set to true if the tag can be played.
1403 /// @return @ref PVR_ERROR_NO_ERROR if bIsPlayable has been set successfully.
1404 ///
1405 /// @remarks Required if add-on supports playing epg tags.
1406 ///
1407 virtual PVR_ERROR IsEPGTagPlayable(const kodi::addon::PVREPGTag& tag, bool& isPlayable)
1408 {
1409 return PVR_ERROR_NOT_IMPLEMENTED;
1410 }
1411 //----------------------------------------------------------------------------
1412
1413 //============================================================================
1414 /// @brief Retrieve the edit decision list (EDL) of an EPG tag on the backend.
1415 ///
1416 /// @param[in] tag The @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "epg tag".
1417 /// @param[out] edl The function has to write the EDL into this array.
1418 /// @return @ref PVR_ERROR_NO_ERROR if the EDL was successfully read or no EDL exists.
1419 ///
1420 /// @remarks Required if @ref PVRCapabilities::SetSupportsEPGEdl "supportsEPGEdl" is set to true.
1421 ///
1422 /// --------------------------------------------------------------------------
1423 ///
1424 /// @copydetails cpp_kodi_addon_pvr_Defs_EDLEntry_PVREDLEntry_Help
1425 ///
1426 ///
1427 /// --------------------------------------------------------------------------
1428 ///
1429 /// @remarks Required if @ref PVRCapabilities::SetSupportsEPGEdl "supportsEPGEdl" is set to true.
1430 ///
1431 virtual PVR_ERROR GetEPGTagEdl(const kodi::addon::PVREPGTag& tag,
1432 std::vector<kodi::addon::PVREDLEntry>& edl)
1433 {
1434 return PVR_ERROR_NOT_IMPLEMENTED;
1435 }
1436 //----------------------------------------------------------------------------
1437
1438 //============================================================================
1439 /// @brief Get the stream properties for an epg tag from the backend.
1440 ///
1441 /// @param[in] tag The @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "epg tag" to get the stream properties for.
1442 /// @param[out] properties the properties required to play the stream.
1443 /// @return @ref PVR_ERROR_NO_ERROR if the stream is available.
1444 ///
1445 /// @remarks Required if add-on supports playing epg tags.
1446 /// In this case your implementation must fill the property @ref PVR_STREAM_PROPERTY_STREAMURL
1447 /// with the URL Kodi should resolve to playback the epg tag.
1448 /// It return @ref PVR_ERROR_NOT_IMPLEMENTED from parent if this add-on won't provide this function.
1449 ///
1450 /// @note The value directly related to inputstream must always begin with the
1451 /// name of the associated add-on, e.g. <b>`"inputstream.adaptive.manifest_update_parameter"`</b>.
1452 ///
1453 ///
1454 ///---------------------------------------------------------------------------
1455 ///
1456 /// **Example:**
1457 /// ~~~~~~~~~~~~~{.cpp}
1458 /// ...
1459 /// PVR_ERROR CMyPVRInstance::GetEPGTagStreamProperties(const kodi::addon::PVREPGTag& tag,
1460 /// std::vector<kodi::addon::PVRStreamProperty>& properties)
1461 /// {
1462 /// ...
1463 /// properties.emplace_back(PVR_STREAM_PROPERTY_INPUTSTREAM, "inputstream.adaptive");
1464 /// properties.emplace_back("inputstream.adaptive.manifest_type", "mpd");
1465 /// properties.emplace_back("inputstream.adaptive.manifest_update_parameter", "full");
1466 /// properties.emplace_back(PVR_STREAM_PROPERTY_MIMETYPE, "application/xml+dash");
1467 /// return PVR_ERROR_NO_ERROR;
1468 /// }
1469 /// ...
1470 /// ~~~~~~~~~~~~~
1471 ///
1472 virtual PVR_ERROR GetEPGTagStreamProperties(
1473 const kodi::addon::PVREPGTag& tag, std::vector<kodi::addon::PVRStreamProperty>& properties)
1474 {
1475 return PVR_ERROR_NOT_IMPLEMENTED;
1476 }
1477 //----------------------------------------------------------------------------
1478
1479 //============================================================================
1480 /// @brief Tell the client the time frame to use when notifying epg events back to Kodi
1481 ///
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
1484 /// interest for Kodi, client needs to know about the epg time frame Kodi uses. Kodi
1485 /// supplies the current epg time frame value in @ref EpgMaxDays() when creating the
1486 /// addon and calls @ref SetEPGTimeFrame later whenever Kodi's epg time frame value
1487 /// changes.
1488 ///
1489 /// @param[in] days number of days from "now". @ref EPG_TIMEFRAME_UNLIMITED means that Kodi
1490 /// is interested in all epg events, regardless of event times.
1491 /// @return @ref PVR_ERROR_NO_ERROR if new value was successfully set.
1492 ///
1493 /// @remarks Required if @ref PVRCapabilities::SetSupportsEPG "supportsEPG" is set to true.
1494 ///
1495 virtual PVR_ERROR SetEPGTimeFrame(int days) { return PVR_ERROR_NOT_IMPLEMENTED; }
1496 //----------------------------------------------------------------------------
1497
1498 //==========================================================================
1499 /// @brief Call one of the EPG related menu hooks (if supported).
1500 ///
1501 /// Supported @ref cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook instances have to be added in
1502 /// `constructor()`, by calling @ref AddMenuHook() on the callback.
1503 ///
1504 /// @param[in] menuhook The hook to call.
1505 /// @param[in] tag The selected EPG item for which the hook was called.
1506 /// @return @ref PVR_ERROR_NO_ERROR if the hook was called successfully.
1507 ///
1508 /// --------------------------------------------------------------------------
1509 ///
1510 /// @copydetails cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help
1511 ///
1512 virtual PVR_ERROR CallEPGMenuHook(const kodi::addon::PVRMenuhook& menuhook,
1513 const kodi::addon::PVREPGTag& tag)
1514 {
1515 return PVR_ERROR_NOT_IMPLEMENTED;
1516 }
1517 //----------------------------------------------------------------------------
1518
1519 //==========================================================================
1520 /// @brief **Callback to Kodi Function**\n
1521 /// Get the Max days handled by Kodi.
1522 ///
1523 /// If > @ref EPG_TIMEFRAME_UNLIMITED, in async epg mode, deliver only events
1524 /// in the range from 'end time > now' to 'start time < now + EpgMaxDays().
1525 /// @ref EPG_TIMEFRAME_UNLIMITED, notify all events.
1526 ///
1527 /// @return The Max days handled by Kodi
1528 ///
1529 inline int EpgMaxDays() const { return m_instanceData->props->iEpgMaxDays; }
1530 //----------------------------------------------------------------------------
1531
1532 //==========================================================================
1533 /// @brief **Callback to Kodi Function**\n
1534 /// Schedule an EPG update for the given channel channel.
1535 ///
1536 /// @param[in] channelUid The unique id of the channel for this add-on
1537 ///
1538 /// @remarks Only called from addon itself
1539 ///
1540 inline void TriggerEpgUpdate(unsigned int channelUid)
1541 {
1542 m_instanceData->toKodi->TriggerEpgUpdate(m_instanceData->toKodi->kodiInstance, channelUid);
1543 }
1544 //----------------------------------------------------------------------------
1545
1546 //==========================================================================
1547 /// @brief **Callback to Kodi Function**\n
1548 /// Notify a state change for an EPG event.
1549 ///
1550 /// @param[in] tag The @ref cpp_kodi_addon_pvr_Defs_epg_PVREPGTag "EPG tag" where have event.
1551 /// @param[in] newState The new state.
1552 /// - For @ref EPG_EVENT_CREATED and @ref EPG_EVENT_UPDATED, tag must be filled with all available event data, not just a delta.
1553 /// - For @ref EPG_EVENT_DELETED, it is sufficient to fill @ref kodi::addon::PVREPGTag::SetUniqueBroadcastId
1554 ///
1555 /// @remarks Only called from addon itself,
1556 ///
1557 ///
1558 ///---------------------------------------------------------------------------
1559 ///
1560 /// **Example:**
1561 /// ~~~~~~~~~~~~~{.cpp}
1562 /// ...
1563 ///
1564 /// void CMyPVRInstance::MyProcessFunction()
1565 /// {
1566 /// ...
1567 /// kodi::addon::PVREPGTag tag; // Here as mini add, in real it should be a complete tag
1568 /// tag.SetUniqueId(123);
1569 ///
1570 /// // added namespace here not needed to have, only to have more clear for where is
1571 /// kodi::addon::CInstancePVRClient::EpgEventStateChange(tag, EPG_EVENT_UPDATED);
1572 /// ...
1573 /// }
1574 ///
1575 /// ...
1576 /// ~~~~~~~~~~~~~
1577 ///
1578 inline void EpgEventStateChange(kodi::addon::PVREPGTag& tag, EPG_EVENT_STATE newState)
1579 {
1580 m_instanceData->toKodi->EpgEventStateChange(m_instanceData->toKodi->kodiInstance, tag.GetTag(),
1581 newState);
1582 }
1583 //----------------------------------------------------------------------------
1584
1585 ///@}
1586 //--==----==----==----==----==----==----==----==----==----==----==----==----==
1587
1588 //============================================================================
1589 /// @defgroup cpp_kodi_addon_pvr_Recordings 5. Recordings (optional)
1590 /// @ingroup cpp_kodi_addon_pvr
1591 /// @brief **PVR recording methods**\n
1592 /// To transfer available recordings of the PVR backend and to allow possible
1593 /// playback.
1594 ///
1595 /// @remarks Only used by Kodi if @ref PVRCapabilities::SetSupportsRecordings "supportsRecordings"
1596 /// is set to true.\n\n
1597 /// If a recordings changes after the initial import, or if a new one was added,
1598 /// then the add-on should call @ref TriggerRecordingUpdate().
1599 ///
1600 ///
1601 ///---------------------------------------------------------------------------
1602 ///
1603 /// **Recordings parts in interface:**\n
1604 /// Copy this to your project and extend with your parts or leave functions
1605 /// complete away where not used or supported.
1606 ///
1607 /// @copydetails cpp_kodi_addon_pvr_Recordings_header_addon_auto_check
1608 /// @copydetails cpp_kodi_addon_pvr_Recordings_source_addon_auto_check
1609 ///
1610 ///@{
1611
1612 //============================================================================
1613 /// @brief To get amount of recording present on backend
1614 ///
1615 /// @param[in] deleted if set return deleted recording (called if
1616 /// @ref PVRCapabilities::SetSupportsRecordingsUndelete "supportsRecordingsUndelete"
1617 /// set to true)
1618 /// @param[out] amount The total amount of recordings on the backend
1619 /// @return @ref PVR_ERROR_NO_ERROR if the amount has been fetched successfully.
1620 ///
1621 /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings "supportsRecordings" is set to true.
1622 ///
1623 virtual PVR_ERROR GetRecordingsAmount(bool deleted, int& amount)
1624 {
1625 return PVR_ERROR_NOT_IMPLEMENTED;
1626 }
1627 //----------------------------------------------------------------------------
1628
1629 //============================================================================
1630 /// @brief Request the list of all recordings from the backend, if supported.
1631 ///
1632 /// Recording entries are added to Kodi by calling TransferRecordingEntry() on the callback.
1633 ///
1634 /// @param[in] deleted if set return deleted recording (called if
1635 /// @ref PVRCapabilities::SetSupportsRecordingsUndelete "supportsRecordingsUndelete"
1636 /// set to true)
1637 /// @param[out] results List of available recordings with @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording
1638 /// becomes transferred with @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecordingsResultSet
1639 /// and given to Kodi
1640 /// @return @ref PVR_ERROR_NO_ERROR if the recordings have been fetched successfully.
1641 ///
1642 /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings "supportsRecordings"
1643 /// is set to true.
1644 ///
1645 /// --------------------------------------------------------------------------
1646 ///
1647 /// @copydetails cpp_kodi_addon_pvr_Defs_Recording_PVRRecording_Help
1648 ///
1649 ///
1650 ///---------------------------------------------------------------------------
1651 ///
1652 /// **Example:**
1653 /// ~~~~~~~~~~~~~{.cpp}
1654 /// ...
1655 /// PVR_ERROR CMyPVRInstance::GetRecordings(bool deleted, kodi::addon::PVRRecordingsResultSet& results)
1656 /// {
1657 /// // Minimal demo example, in reality bigger and loop to transfer all
1658 /// kodi::addon::PVRRecording recording;
1659 /// recording.SetRecordingId(123);
1660 /// recording.SetTitle("My recording name");
1661 /// ...
1662 ///
1663 /// // Give it now to Kodi
1664 /// results.Add(recording);
1665 /// return PVR_ERROR_NO_ERROR;
1666 /// }
1667 /// ...
1668 /// ~~~~~~~~~~~~~
1669 ///
1670 virtual PVR_ERROR GetRecordings(bool deleted, kodi::addon::PVRRecordingsResultSet& results)
1671 {
1672 return PVR_ERROR_NOT_IMPLEMENTED;
1673 }
1674 //----------------------------------------------------------------------------
1675
1676 //============================================================================
1677 /// @brief Delete a recording on the backend.
1678 ///
1679 /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording to delete.
1680 /// @return @ref PVR_ERROR_NO_ERROR if the recording has been deleted successfully.
1681 ///
1682 /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings "supportsRecordings"
1683 /// is set to true.
1684 ///
1685 virtual PVR_ERROR DeleteRecording(const kodi::addon::PVRRecording& recording)
1686 {
1687 return PVR_ERROR_NOT_IMPLEMENTED;
1688 }
1689 //----------------------------------------------------------------------------
1690
1691 //============================================================================
1692 /// @brief Undelete a recording on the backend.
1693 ///
1694 /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording to undelete.
1695 /// @return @ref PVR_ERROR_NO_ERROR if the recording has been undeleted successfully.
1696 ///
1697 /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordingsUndelete "supportsRecordingsUndelete"
1698 /// is set to true.
1699 ///
1700 virtual PVR_ERROR UndeleteRecording(const kodi::addon::PVRRecording& recording)
1701 {
1702 return PVR_ERROR_NOT_IMPLEMENTED;
1703 }
1704 //----------------------------------------------------------------------------
1705
1706 //============================================================================
1707 /// @brief Delete all recordings permanent which in the deleted folder on the backend.
1708 ///
1709 /// @return @ref PVR_ERROR_NO_ERROR if the recordings has been deleted successfully.
1710 ///
1711 virtual PVR_ERROR DeleteAllRecordingsFromTrash() { return PVR_ERROR_NOT_IMPLEMENTED; }
1712 //----------------------------------------------------------------------------
1713
1714 //============================================================================
1715 /// @brief Rename a recording on the backend.
1716 ///
1717 /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording
1718 /// to rename, containing the new name.
1719 /// @return @ref PVR_ERROR_NO_ERROR if the recording has been renamed successfully.
1720 ///
1721 /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings "supportsRecordings"
1722 /// is set to true.
1723 ///
1724 virtual PVR_ERROR RenameRecording(const kodi::addon::PVRRecording& recording)
1725 {
1726 return PVR_ERROR_NOT_IMPLEMENTED;
1727 }
1728 //----------------------------------------------------------------------------
1729
1730 //============================================================================
1731 /// @brief Set the lifetime of a recording on the backend.
1732 ///
1733 /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording
1734 /// to change the lifetime for. recording.iLifetime
1735 /// contains the new lieftime value.
1736 /// @return @ref PVR_ERROR_NO_ERROR if the recording's lifetime has been set
1737 /// successfully.
1738 ///
1739 /// @remarks Required if @ref PVRCapabilities::SetSupportsRecordingsLifetimeChange "supportsRecordingsLifetimeChange"
1740 /// is set to true.
1741 ///
1742 virtual PVR_ERROR SetRecordingLifetime(const kodi::addon::PVRRecording& recording)
1743 {
1744 return PVR_ERROR_NOT_IMPLEMENTED;
1745 }
1746 //----------------------------------------------------------------------------
1747
1748 //============================================================================
1749 /// @brief Set the play count of a recording on the backend.
1750 ///
1751 /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording
1752 /// to change the play count.
1753 /// @param[in] count Play count.
1754 /// @return @ref PVR_ERROR_NO_ERROR if the recording's play count has been set
1755 /// successfully.
1756 ///
1757 /// @remarks Required if @ref PVRCapabilities::SetSupportsRecordingPlayCount "supportsRecordingPlayCount"
1758 /// is set to true.
1759 ///
1760 virtual PVR_ERROR SetRecordingPlayCount(const kodi::addon::PVRRecording& recording, int count)
1761 {
1762 return PVR_ERROR_NOT_IMPLEMENTED;
1763 }
1764 //----------------------------------------------------------------------------
1765
1766 //============================================================================
1767 /// @brief Set the last watched position of a recording on the backend.
1768 ///
1769 /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording.
1770 /// @param[in] lastplayedposition The last watched position in seconds
1771 /// @return @ref PVR_ERROR_NO_ERROR if the position has been stored successfully.
1772 ///
1773 /// @remarks Required if @ref PVRCapabilities::SetSupportsLastPlayedPosition "supportsLastPlayedPosition"
1774 /// is set to true.
1775 ///
1776 virtual PVR_ERROR SetRecordingLastPlayedPosition(const kodi::addon::PVRRecording& recording,
1777 int lastplayedposition)
1778 {
1779 return PVR_ERROR_NOT_IMPLEMENTED;
1780 }
1781 //----------------------------------------------------------------------------
1782
1783 //============================================================================
1784 /// @brief Retrieve the last watched position of a recording on the backend.
1785 ///
1786 /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording.
1787 /// @param[out] position The last watched position in seconds
1788 /// @return @ref PVR_ERROR_NO_ERROR if the amount has been fetched successfully.
1789 ///
1790 /// @remarks Required if @ref PVRCapabilities::SetSupportsRecordingPlayCount "supportsRecordingPlayCount"
1791 /// is set to true.
1792 ///
1793 virtual PVR_ERROR GetRecordingLastPlayedPosition(const kodi::addon::PVRRecording& recording,
1794 int& position)
1795 {
1796 return PVR_ERROR_NOT_IMPLEMENTED;
1797 }
1798 //----------------------------------------------------------------------------
1799
1800 //============================================================================
1801 /// @brief Retrieve the edit decision list (EDL) of a recording on the backend.
1802 ///
1803 /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording.
1804 /// @param[out] edl The function has to write the EDL into this array.
1805 /// @return @ref PVR_ERROR_NO_ERROR if the EDL was successfully read or no EDL exists.
1806 ///
1807 /// @remarks Required if @ref PVRCapabilities::SetSupportsRecordingEdl "supportsRecordingEdl"
1808 /// is set to true.
1809 ///
1810 /// --------------------------------------------------------------------------
1811 ///
1812 /// @copydetails cpp_kodi_addon_pvr_Defs_EDLEntry_PVREDLEntry_Help
1813 ///
1814 virtual PVR_ERROR GetRecordingEdl(const kodi::addon::PVRRecording& recording,
1815 std::vector<kodi::addon::PVREDLEntry>& edl)
1816 {
1817 return PVR_ERROR_NOT_IMPLEMENTED;
1818 }
1819 //----------------------------------------------------------------------------
1820
1821 //============================================================================
1822 /// @brief Retrieve the size of a recording on the backend.
1823 ///
1824 /// @param[in] recording The recording to get the size in bytes for.
1825 /// @param[out] size The size in bytes of the recording
1826 /// @return @ref PVR_ERROR_NO_ERROR if the recording's size has been set successfully.
1827 ///
1828 /// @remarks Required if @ref PVRCapabilities::SetSupportsRecordingSize "supportsRecordingSize"
1829 /// is set to true.
1830 ///
1831 virtual PVR_ERROR GetRecordingSize(const kodi::addon::PVRRecording& recording, int64_t& size)
1832 {
1833 return PVR_ERROR_NOT_IMPLEMENTED;
1834 }
1835 //----------------------------------------------------------------------------
1836
1837 //============================================================================
1838 /// @brief Get the stream properties for a recording from the backend.
1839 ///
1840 /// @param[in] recording The @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording
1841 /// to get the stream properties for.
1842 /// @param[out] properties The properties required to play the stream.
1843 /// @return @ref PVR_ERROR_NO_ERROR if the stream is available.
1844 ///
1845 /// @remarks Required if @ref PVRCapabilities::SetSupportsRecordings "supportsRecordings"
1846 /// is set to true and the add-on does not implement recording stream functions
1847 /// (@ref OpenRecordedStream, ...).\n
1848 /// In this case your implementation must fill the property @ref PVR_STREAM_PROPERTY_STREAMURL
1849 /// with the URL Kodi should resolve to playback the recording.
1850 ///
1851 /// @note The value directly related to inputstream must always begin with the
1852 /// name of the associated add-on, e.g. <b>`"inputstream.adaptive.manifest_update_parameter"`</b>.
1853 ///
1854 ///
1855 ///---------------------------------------------------------------------------
1856 ///
1857 /// **Example:**
1858 /// ~~~~~~~~~~~~~{.cpp}
1859 /// ...
1860 /// PVR_ERROR CMyPVRInstance::GetRecordingStreamProperties(const kodi::addon::PVRRecording& recording,
1861 /// std::vector<kodi::addon::PVRStreamProperty>& properties)
1862 /// {
1863 /// ...
1864 /// properties.emplace_back(PVR_STREAM_PROPERTY_INPUTSTREAM, "inputstream.adaptive");
1865 /// properties.emplace_back("inputstream.adaptive.manifest_type", "mpd");
1866 /// properties.emplace_back("inputstream.adaptive.manifest_update_parameter", "full");
1867 /// properties.emplace_back(PVR_STREAM_PROPERTY_MIMETYPE, "application/xml+dash");
1868 /// return PVR_ERROR_NO_ERROR;
1869 /// }
1870 /// ...
1871 /// ~~~~~~~~~~~~~
1872 ///
1873 virtual PVR_ERROR GetRecordingStreamProperties(
1874 const kodi::addon::PVRRecording& recording,
1875 std::vector<kodi::addon::PVRStreamProperty>& properties)
1876 {
1877 return PVR_ERROR_NOT_IMPLEMENTED;
1878 }
1879 //----------------------------------------------------------------------------
1880
1881 //==========================================================================
1882 /// @brief Call one of the recording related menu hooks (if supported).
1883 ///
1884 /// Supported @ref cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook instances have to be added in
1885 /// `constructor()`, by calling @ref AddMenuHook() on the callback.
1886 ///
1887 /// @param[in] menuhook The hook to call.
1888 /// @param[in] item The selected recording item for which the hook was called.
1889 /// @return @ref PVR_ERROR_NO_ERROR if the hook was called successfully.
1890 ///
1891 /// --------------------------------------------------------------------------
1892 ///
1893 /// @copydetails cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help
1894 ///
1895 virtual PVR_ERROR CallRecordingMenuHook(const kodi::addon::PVRMenuhook& menuhook,
1896 const kodi::addon::PVRRecording& item)
1897 {
1898 return PVR_ERROR_NOT_IMPLEMENTED;
1899 }
1900 //----------------------------------------------------------------------------
1901
1902 //============================================================================
1903 /// @brief **Callback to Kodi Function**\n
1904 /// Display a notification in Kodi that a recording started or stopped on the
1905 /// server.
1906 ///
1907 /// @param[in] recordingName The name of the recording to display
1908 /// @param[in] fileName The filename of the recording
1909 /// @param[in] on True when recording started, false when it stopped
1910 ///
1911 /// @remarks Only called from addon itself
1912 ///
1913 inline void RecordingNotification(const std::string& recordingName,
1914 const std::string& fileName,
1915 bool on)
1916 {
1917 m_instanceData->toKodi->RecordingNotification(m_instanceData->toKodi->kodiInstance,
1918 recordingName.c_str(), fileName.c_str(), on);
1919 }
1920 //----------------------------------------------------------------------------
1921
1922 //============================================================================
1923 /// @brief **Callback to Kodi Function**\n
1924 /// Request Kodi to update it's list of recordings.
1925 ///
1926 /// @remarks Only called from addon itself
1927 ///
1928 inline void TriggerRecordingUpdate()
1929 {
1930 m_instanceData->toKodi->TriggerRecordingUpdate(m_instanceData->toKodi->kodiInstance);
1931 }
1932 //----------------------------------------------------------------------------
1933
1934 ///@}
1935 //--==----==----==----==----==----==----==----==----==----==----==----==----==
1936
1937 //============================================================================
1938 /// @defgroup cpp_kodi_addon_pvr_Timers 6. Timers (optional)
1939 /// @ingroup cpp_kodi_addon_pvr
1940 /// @brief **PVR timer methods**\n
1941 /// For editing and displaying timed work, such as video recording.
1942 ///
1943 /// @remarks Only used by Kodi if @ref PVRCapabilities::SetSupportsTimers "supportsTimers"
1944 /// is set to true.\n\n
1945 /// If a timer changes after the initial import, or if a new one was added,
1946 /// then the add-on should call @ref TriggerTimerUpdate().
1947 ///
1948 ///
1949 ///---------------------------------------------------------------------------
1950 ///
1951 /// **Timer parts in interface:**\n
1952 /// Copy this to your project and extend with your parts or leave functions
1953 /// complete away where not used or supported.
1954 ///
1955 /// @copydetails cpp_kodi_addon_pvr_Timers_header_addon_auto_check
1956 /// @copydetails cpp_kodi_addon_pvr_Timers_source_addon_auto_check
1957 ///
1958 ///@{
1959
1960 //============================================================================
1961 /// @brief Retrieve the timer types supported by the backend.
1962 ///
1963 /// @param[out] types The function has to write the definition of the
1964 /// @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType types
1965 /// into this array.
1966 /// @return @ref PVR_ERROR_NO_ERROR if the types were successfully written to
1967 /// the array.
1968 ///
1969 /// @note Maximal 32 entries are allowed inside.
1970 ///
1971 /// --------------------------------------------------------------------------
1972 ///
1973 /// @copydetails cpp_kodi_addon_pvr_Defs_Timer_PVRTimerType_Help
1974 ///
1975 virtual PVR_ERROR GetTimerTypes(std::vector<kodi::addon::PVRTimerType>& types)
1976 {
1977 return PVR_ERROR_NOT_IMPLEMENTED;
1978 }
1979 //----------------------------------------------------------------------------
1980
1981 //============================================================================
1982 /// @brief To get total amount of timers on the backend or -1 on error.
1983 ///
1984 /// @param[out] amount The total amount of timers on the backend
1985 /// @return @ref PVR_ERROR_NO_ERROR if the amount has been fetched successfully.
1986 ///
1987 /// @note Required to use if @ref PVRCapabilities::SetSupportsTimers "supportsTimers"
1988 /// is set to true.
1989 ///
1990 virtual PVR_ERROR GetTimersAmount(int& amount) { return PVR_ERROR_NOT_IMPLEMENTED; }
1991 //----------------------------------------------------------------------------
1992
1993 //============================================================================
1994 /// @brief Request the list of all timers from the backend if supported.
1995 ///
1996 /// @param[out] results List of available timers with @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimer
1997 /// becomes transferred with @ref cpp_kodi_addon_pvr_Defs_Timer_PVRTimersResultSet
1998 /// and given to Kodi
1999 /// @return @ref PVR_ERROR_NO_ERROR if the list has been fetched successfully.
2000 ///
2001 /// @note Required to use if @ref PVRCapabilities::SetSupportsTimers "supportsTimers"
2002 /// is set to true.
2003 ///
2004 /// --------------------------------------------------------------------------
2005 ///
2006 /// @copydetails cpp_kodi_addon_pvr_Defs_Timer_PVRTimer_Help
2007 ///
2008 ///
2009 ///---------------------------------------------------------------------------
2010 ///
2011 /// **Example:**
2012 /// ~~~~~~~~~~~~~{.cpp}
2013 /// ...
2014 /// PVR_ERROR CMyPVRInstance::GetTimers(kodi::addon::PVRTimersResultSet& results)
2015 /// {
2016 /// // Minimal demo example, in reality bigger and loop to transfer all
2017 /// kodi::addon::PVRTimer timer;
2018 /// timer.SetClientIndex(123);
2019 /// timer.SetState(PVR_TIMER_STATE_SCHEDULED);
2020 /// timer.SetTitle("My timer name");
2021 /// ...
2022 ///
2023 /// // Give it now to Kodi
2024 /// results.Add(timer);
2025 /// return PVR_ERROR_NO_ERROR;
2026 /// }
2027 /// ...
2028 /// ~~~~~~~~~~~~~
2029 ///
2030 virtual PVR_ERROR GetTimers(kodi::addon::PVRTimersResultSet& results)
2031 {
2032 return PVR_ERROR_NOT_IMPLEMENTED;
2033 }
2034 //----------------------------------------------------------------------------
2035
2036 //============================================================================
2037 /// @brief Add a timer on the backend.
2038 ///
2039 /// @param[in] timer The timer to add.
2040 /// @return @ref PVR_ERROR_NO_ERROR if the timer has been added successfully.
2041 ///
2042 /// @note Required to use if @ref PVRCapabilities::SetSupportsTimers "supportsTimers"
2043 /// is set to true.
2044 ///
2045 virtual PVR_ERROR AddTimer(const kodi::addon::PVRTimer& timer)
2046 {
2047 return PVR_ERROR_NOT_IMPLEMENTED;
2048 }
2049 //----------------------------------------------------------------------------
2050
2051 //============================================================================
2052 /// @brief Delete a timer on the backend.
2053 ///
2054 /// @param[in] timer The timer to delete.
2055 /// @param[in] forceDelete Set to true to delete a timer that is currently
2056 /// recording a program.
2057 /// @return @ref PVR_ERROR_NO_ERROR if the timer has been deleted successfully.
2058 ///
2059 /// @note Required to use if @ref PVRCapabilities::SetSupportsTimers "supportsTimers"
2060 /// is set to true.
2061 ///
2062 virtual PVR_ERROR DeleteTimer(const kodi::addon::PVRTimer& timer, bool forceDelete)
2063 {
2064 return PVR_ERROR_NOT_IMPLEMENTED;
2065 }
2066 //----------------------------------------------------------------------------
2067
2068 //============================================================================
2069 /// @brief Update the timer information on the backend.
2070 ///
2071 /// @param[in] timer The timer to update.
2072 /// @return @ref PVR_ERROR_NO_ERROR if the timer has been updated successfully.
2073 ///
2074 /// @note Required to use if @ref PVRCapabilities::SetSupportsTimers "supportsTimers"
2075 /// is set to true.
2076 ///
2077 virtual PVR_ERROR UpdateTimer(const kodi::addon::PVRTimer& timer)
2078 {
2079 return PVR_ERROR_NOT_IMPLEMENTED;
2080 }
2081 //----------------------------------------------------------------------------
2082
2083 //============================================================================
2084 /// @brief Call one of the timer related menu hooks (if supported).
2085 ///
2086 /// Supported @ref cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook instances have
2087 /// to be added in `constructor()`, by calling @ref AddMenuHook() on the
2088 /// callback.
2089 ///
2090 /// @param[in] menuhook The hook to call.
2091 /// @param[in] item The selected timer item for which the hook was called.
2092 /// @return @ref PVR_ERROR_NO_ERROR if the hook was called successfully.
2093 ///
2094 /// --------------------------------------------------------------------------
2095 ///
2096 /// @copydetails cpp_kodi_addon_pvr_Defs_Menuhook_PVRMenuhook_Help
2097 ///
2098 virtual PVR_ERROR CallTimerMenuHook(const kodi::addon::PVRMenuhook& menuhook,
2099 const kodi::addon::PVRTimer& item)
2100 {
2101 return PVR_ERROR_NOT_IMPLEMENTED;
2102 }
2103 //----------------------------------------------------------------------------
2104
2105 //============================================================================
2106 /// @brief **Callback to Kodi Function**\n
2107 /// Request Kodi to update it's list of timers.
2108 ///
2109 /// @remarks Only called from addon itself
2110 ///
2111 inline void TriggerTimerUpdate()
2112 {
2113 m_instanceData->toKodi->TriggerTimerUpdate(m_instanceData->toKodi->kodiInstance);
2114 }
2115 //----------------------------------------------------------------------------
2116
2117 ///@}
2118 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2119
2120 //============================================================================
2121 /// @defgroup cpp_kodi_addon_pvr_PowerManagement 7. Power management events (optional)
2122 /// @ingroup cpp_kodi_addon_pvr
2123 /// @brief **Used to notify the pvr addon for power management events**\n
2124 /// Used to allow any energy savings.
2125 ///
2126 ///
2127 ///---------------------------------------------------------------------------
2128 ///
2129 /// **Power management events in interface:**\n
2130 /// Copy this to your project and extend with your parts or leave functions
2131 /// complete away where not used or supported.
2132 ///
2133 /// @copydetails cpp_kodi_addon_pvr_PowerManagement_header_addon_auto_check
2134 /// @copydetails cpp_kodi_addon_pvr_PowerManagement_source_addon_auto_check
2135 ///
2136 ///@{
2137
2138 //============================================================================
2139 /// @brief To notify addon about system sleep
2140 ///
2141 /// @return @ref PVR_ERROR_NO_ERROR If successfully done.
2142 ///
2143 virtual PVR_ERROR OnSystemSleep() { return PVR_ERROR_NOT_IMPLEMENTED; }
2144 //----------------------------------------------------------------------------
2145
2146 //============================================================================
2147 /// @brief To notify addon about system wake up
2148 ///
2149 /// @return @ref PVR_ERROR_NO_ERROR If successfully done.
2150 ///
2151 virtual PVR_ERROR OnSystemWake() { return PVR_ERROR_NOT_IMPLEMENTED; }
2152 //----------------------------------------------------------------------------
2153
2154 //============================================================================
2155 /// @brief To notify addon power saving on system is activated
2156 ///
2157 /// @return @ref PVR_ERROR_NO_ERROR If successfully done.
2158 ///
2159 virtual PVR_ERROR OnPowerSavingActivated() { return PVR_ERROR_NOT_IMPLEMENTED; }
2160 //----------------------------------------------------------------------------
2161
2162 //============================================================================
2163 /// @brief To notify addon power saving on system is deactivated
2164 ///
2165 /// @return @ref PVR_ERROR_NO_ERROR If successfully done.
2166 ///
2167 virtual PVR_ERROR OnPowerSavingDeactivated() { return PVR_ERROR_NOT_IMPLEMENTED; }
2168 //----------------------------------------------------------------------------
2169
2170 ///@}
2171 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2172
2173 //============================================================================
2174 /// @defgroup cpp_kodi_addon_pvr_Streams 8. Inputstream
2175 /// @ingroup cpp_kodi_addon_pvr
2176 /// @brief **PVR Inputstream**\n
2177 /// This includes functions that are used in the PVR inputstream.
2178 ///
2179 /// @warning The parts here will be removed in the future and replaced by the
2180 /// separate @ref cpp_kodi_addon_inputstream "inputstream addon instance".
2181 /// If there is already a possibility, new addons should do it via the
2182 /// inputstream instance.
2183 ///
2184 ///@{
2185
2186 //============================================================================
2187 /// @defgroup cpp_kodi_addon_pvr_Streams_TV 8.1. TV stream
2188 /// @ingroup cpp_kodi_addon_pvr_Streams
2189 /// @brief **PVR TV stream**\n
2190 /// Stream processing regarding live TV.
2191 ///
2192 ///
2193 ///---------------------------------------------------------------------------
2194 ///
2195 /// **TV stream parts in interface:**\n
2196 /// Copy this to your project and extend with your parts or leave functions
2197 /// complete away where not used or supported.
2198 ///
2199 /// @copydetails cpp_kodi_addon_pvr_Streams_TV_header_addon_auto_check
2200 /// @copydetails cpp_kodi_addon_pvr_Streams_TV_source_addon_auto_check
2201 ///
2202 ///@{
2203
2204 //============================================================================
2205 /// @brief Open a live stream on the backend.
2206 ///
2207 /// @param[in] channel The channel to stream.
2208 /// @return True if the stream has been opened successfully, false otherwise.
2209 ///
2210 /// --------------------------------------------------------------------------
2211 ///
2212 /// @copydetails cpp_kodi_addon_pvr_Defs_Channel_PVRChannel_Help
2213 ///
2214 ///
2215 /// --------------------------------------------------------------------------
2216 ///
2217 /// @remarks Required if @ref PVRCapabilities::SetHandlesInputStream() or
2218 /// @ref PVRCapabilities::SetHandlesDemuxing() is set to true.
2219 /// @ref CloseLiveStream() will always be called by Kodi prior to calling this
2220 /// function.
2221 ///
2222 virtual bool OpenLiveStream(const kodi::addon::PVRChannel& channel) { return false; }
2223 //----------------------------------------------------------------------------
2224
2225 //============================================================================
2226 /// @brief Close an open live stream.
2227 ///
2228 /// @remarks Required if @ref PVRCapabilities::SetHandlesInputStream() or
2229 /// @ref PVRCapabilities::SetHandlesDemuxing() is set to true.
2230 ///
2231 virtual void CloseLiveStream() {}
2232 //----------------------------------------------------------------------------
2233
2234 //============================================================================
2235 /// @brief Read from an open live stream.
2236 ///
2237 /// @param[in] pBuffer The buffer to store the data in.
2238 /// @param[in] iBufferSize The amount of bytes to read.
2239 /// @return The amount of bytes that were actually read from the stream.
2240 ///
2241 /// @remarks Required if @ref PVRCapabilities::SetHandlesInputStream() is set
2242 /// to true.
2243 ///
2244 virtual int ReadLiveStream(unsigned char* buffer, unsigned int size) { return 0; }
2245 //----------------------------------------------------------------------------
2246
2247 //============================================================================
2248 /// @brief Seek in a live stream on a backend that supports timeshifting.
2249 ///
2250 /// @param[in] position The position to seek to.
2251 /// @param[in] whence [optional] offset relative to
2252 /// You can set the value of whence to one of three things:
2253 /// | Value | int | Description |
2254 /// |:--------:|:---:|:----------------------------------------------------|
2255 /// | 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.
2256 /// | 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."
2257 /// | 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.
2258 ///
2259 /// @return The new position.
2260 ///
2261 /// @remarks Optional, and only used if @ref PVRCapabilities::SetHandlesInputStream()
2262 /// is set to true.
2263 ///
2264 virtual int64_t SeekLiveStream(int64_t position, int whence) { return 0; }
2265 //----------------------------------------------------------------------------
2266
2267 //============================================================================
2268 /// @brief Obtain the length of a live stream.
2269 ///
2270 /// @return The total length of the stream that's currently being read.
2271 ///
2272 /// @remarks Optional, and only used if @ref PVRCapabilities::SetHandlesInputStream()
2273 /// is set to true.
2274 ///
2275 virtual int64_t LengthLiveStream() { return 0; }
2276 //----------------------------------------------------------------------------
2277
2278 //============================================================================
2279 /// @defgroup cpp_kodi_addon_pvr_Streams_TV_Demux 8.1.1. Stream demuxing
2280 /// @ingroup cpp_kodi_addon_pvr_Streams_TV
2281 /// @brief **PVR stream demuxing**\n
2282 /// Read TV streams with own demux within addon.
2283 ///
2284 /// This is only on Live TV streams and only if @ref PVRCapabilities::SetHandlesDemuxing()
2285 /// has been set to "true".
2286 ///
2287 ///
2288 ///---------------------------------------------------------------------------
2289 ///
2290 /// **Stream demuxing parts in interface:**\n
2291 /// Copy this to your project and extend with your parts or leave functions
2292 /// complete away where not used or supported.
2293 ///
2294 /// @copydetails cpp_kodi_addon_pvr_Streams_TV_Demux_header_addon_auto_check
2295 /// @copydetails cpp_kodi_addon_pvr_Streams_TV_Demux_source_addon_auto_check
2296 ///
2297 ///@{
2298
2299 //============================================================================
2300 /// @brief Get the stream properties of the stream that's currently being read.
2301 ///
2302 /// @param[in] properties The properties of the currently playing stream.
2303 /// @return @ref PVR_ERROR_NO_ERROR if the properties have been fetched successfully.
2304 ///
2305 /// @remarks Required, and only used if addon has its own demuxer.
2306 ///
2307 virtual PVR_ERROR GetStreamProperties(std::vector<kodi::addon::PVRStreamProperties>& properties)
2308 {
2309 return PVR_ERROR_NOT_IMPLEMENTED;
2310 }
2311 //----------------------------------------------------------------------------
2312
2313 //============================================================================
2314 /// @brief Read the next packet from the demultiplexer, if there is one.
2315 ///
2316 /// @return The next packet.
2317 /// If there is no next packet, then the add-on should return the packet
2318 /// created by calling @ref AllocateDemuxPacket(0) on the callback.
2319 /// If the stream changed and Kodi's player needs to be reinitialised, then,
2320 /// the add-on should call @ref AllocateDemuxPacket(0) on the callback, and set
2321 /// the streamid to @ref DMX_SPECIALID_STREAMCHANGE and return the value.
2322 /// The add-on should return `nullptr` if an error occurred.
2323 ///
2324 /// @remarks Required, and only used if addon has its own demuxer.
2325 /// Return `nullptr` if this add-on won't provide this function.
2326 ///
2327 virtual DemuxPacket* DemuxRead() { return nullptr; }
2328 //----------------------------------------------------------------------------
2329
2330 //============================================================================
2331 /// @brief Reset the demultiplexer in the add-on.
2332 ///
2333 /// @remarks Required, and only used if addon has its own demuxer.
2334 ///
2335 virtual void DemuxReset() {}
2336 //----------------------------------------------------------------------------
2337
2338 //============================================================================
2339 /// @brief Abort the demultiplexer thread in the add-on.
2340 ///
2341 /// @remarks Required, and only used if addon has its own demuxer.
2342 ///
2343 virtual void DemuxAbort() {}
2344 //----------------------------------------------------------------------------
2345
2346 //============================================================================
2347 /// @brief Flush all data that's currently in the demultiplexer buffer in the
2348 /// add-on.
2349 ///
2350 /// @remarks Required, and only used if addon has its own demuxer.
2351 ///
2352 virtual void DemuxFlush() {}
2353 //----------------------------------------------------------------------------
2354
2355 //============================================================================
2356 /// @brief Notify the pvr addon/demuxer that Kodi wishes to change playback
2357 /// speed.
2358 ///
2359 /// @param[in] speed The requested playback speed
2360 ///
2361 /// @remarks Optional, and only used if addon has its own demuxer.
2362 ///
2363 virtual void SetSpeed(int speed) {}
2364 //----------------------------------------------------------------------------
2365
2366 //============================================================================
2367 /// @brief Notify the pvr addon/demuxer that Kodi wishes to fill demux queue.
2368 ///
2369 /// @param[in] mode The requested filling mode
2370 ///
2371 /// @remarks Optional, and only used if addon has its own demuxer.
2372 ///
2373 virtual void FillBuffer(bool mode) {}
2374 //----------------------------------------------------------------------------
2375
2376 //============================================================================
2377 /// @brief Notify the pvr addon/demuxer that Kodi wishes to seek the stream by
2378 /// time.
2379 ///
2380 /// @param[in] time The absolute time since stream start
2381 /// @param[in] backwards True to seek to keyframe BEFORE time, else AFTER
2382 /// @param[in] startpts can be updated to point to where display should start
2383 /// @return True if the seek operation was possible
2384 ///
2385 /// @remarks Optional, and only used if addon has its own demuxer.
2386 /// Return False if this add-on won't provide this function.
2387 ///
2388 virtual bool SeekTime(double time, bool backwards, double& startpts) { return false; }
2389 //----------------------------------------------------------------------------
2390
2391 //============================================================================
2392 /// @brief **Callback to Kodi Function**\n
2393 /// Get the codec id used by Kodi.
2394 ///
2395 /// @param[in] codecName The name of the codec
2396 /// @return The codec_id, or a codec_id with 0 values when not supported
2397 ///
2398 /// @remarks Only called from addon itself
2399 ///
2400 inline PVRCodec GetCodecByName(const std::string& codecName) const
2401 {
2402 return PVRCodec(m_instanceData->toKodi->GetCodecByName(m_instanceData->toKodi->kodiInstance,
2403 codecName.c_str()));
2404 }
2405 //----------------------------------------------------------------------------
2406
2407 //============================================================================
2408 /// @brief **Callback to Kodi Function**\n
2409 /// Allocate a demux packet. Free with @ref FreeDemuxPacket().
2410 ///
2411 /// @param[in] iDataSize The size of the data that will go into the packet
2412 /// @return The allocated packet
2413 ///
2414 /// @remarks Only called from addon itself
2415 ///
2416 inline DemuxPacket* AllocateDemuxPacket(int iDataSize)
2417 {
2418 return m_instanceData->toKodi->AllocateDemuxPacket(m_instanceData->toKodi->kodiInstance,
2419 iDataSize);
2420 }
2421 //----------------------------------------------------------------------------
2422
2423 //============================================================================
2424 /// @brief **Callback to Kodi Function**\n
2425 /// Free a packet that was allocated with @ref AllocateDemuxPacket().
2426 ///
2427 /// @param[in] pPacket The packet to free
2428 ///
2429 /// @remarks Only called from addon itself.
2430 ///
2431 inline void FreeDemuxPacket(DemuxPacket* pPacket)
2432 {
2433 m_instanceData->toKodi->FreeDemuxPacket(m_instanceData->toKodi->kodiInstance, pPacket);
2434 }
2435 //----------------------------------------------------------------------------
2436 ///@}
2437
2438 ///@}
2439 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2440
2441 //============================================================================
2442 /// @defgroup cpp_kodi_addon_pvr_Streams_Recording 8.2. Recording stream
2443 /// @ingroup cpp_kodi_addon_pvr_Streams
2444 /// @brief **PVR Recording stream**\n
2445 /// Stream processing regarding recordings.
2446 ///
2447 /// @note Demuxing is not possible with the recordings.
2448 ///
2449 ///
2450 ///---------------------------------------------------------------------------
2451 ///
2452 /// **Recording stream parts in interface:**\n
2453 /// Copy this to your project and extend with your parts or leave functions
2454 /// complete away where not used or supported.
2455 ///
2456 /// @copydetails cpp_kodi_addon_pvr_Streams_Recording_header_addon_auto_check
2457 /// @copydetails cpp_kodi_addon_pvr_Streams_Recording_source_addon_auto_check
2458 ///
2459 ///@{
2460
2461 //============================================================================
2462 /// @brief Open a stream to a recording on the backend.
2463 ///
2464 /// @param[in] recording The recording to open.
2465 /// @return True if the stream has been opened successfully, false otherwise.
2466 ///
2467 /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings()
2468 /// is set to true. @ref CloseRecordedStream() will always be called by Kodi
2469 /// prior to calling this function.
2470 ///
2471 virtual bool OpenRecordedStream(const kodi::addon::PVRRecording& recording) { return false; }
2472 //----------------------------------------------------------------------------
2473
2474 //============================================================================
2475 /// @brief Close an open stream from a recording.
2476 ///
2477 /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings()
2478 /// is set to true.
2479 ///
2480 virtual void CloseRecordedStream() {}
2481 //----------------------------------------------------------------------------
2482
2483 //============================================================================
2484 /// @brief Read from a recording.
2485 ///
2486 /// @param[in] buffer The buffer to store the data in.
2487 /// @param[in] size The amount of bytes to read.
2488 /// @return The amount of bytes that were actually read from the stream.
2489 ///
2490 /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings()
2491 /// is set to true.
2492 ///
2493 virtual int ReadRecordedStream(unsigned char* buffer, unsigned int size) { return 0; }
2494 //----------------------------------------------------------------------------
2495
2496 //============================================================================
2497 /// @brief Seek in a recorded stream.
2498 ///
2499 /// @param[in] position The position to seek to.
2500 /// @param[in] whence [optional] offset relative to
2501 /// You can set the value of whence to one of three things:
2502 /// | Value | int | Description |
2503 /// |:--------:|:---:|:----------------------------------------------------|
2504 /// | 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.
2505 /// | 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."
2506 /// | 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.
2507 ///
2508 /// @return The new position.
2509 ///
2510 /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings()
2511 /// is set to true.
2512 ///
2513 virtual int64_t SeekRecordedStream(int64_t position, int whence) { return 0; }
2514 //----------------------------------------------------------------------------
2515
2516 //============================================================================
2517 /// @brief Obtain the length of a recorded stream.
2518 ///
2519 /// @return The total length of the stream that's currently being read.
2520 ///
2521 /// @remarks Optional, and only used if @ref PVRCapabilities::SetSupportsRecordings()
2522 /// is true (=> @ref ReadRecordedStream).
2523 ///
2524 virtual int64_t LengthRecordedStream() { return 0; }
2525 //----------------------------------------------------------------------------
2526
2527 ///@}
2528 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2529
2530 //============================================================================
2531 /// @defgroup cpp_kodi_addon_pvr_Streams_Various 8.3. Various functions
2532 /// @ingroup cpp_kodi_addon_pvr_Streams
2533 /// @brief **Various other PVR stream related functions**\n
2534 /// These apply to all other groups in inputstream and are therefore declared
2535 /// as several.
2536 ///
2537 ///
2538 ///---------------------------------------------------------------------------
2539 ///
2540 /// **Various stream parts in interface:**\n
2541 /// Copy this to your project and extend with your parts or leave functions
2542 /// complete away where not used or supported.
2543 ///
2544 /// @copydetails cpp_kodi_addon_pvr_Streams_Various_header_addon_auto_check
2545 /// @copydetails cpp_kodi_addon_pvr_Streams_Various_source_addon_auto_check
2546 ///
2547 ///@{
2548
2549 //============================================================================
2550 ///
2551 /// @brief Check if the backend support pausing the currently playing stream.
2552 ///
2553 /// This will enable/disable the pause button in Kodi based on the return
2554 /// value.
2555 ///
2556 /// @return false if the PVR addon/backend does not support pausing, true if
2557 /// possible
2558 ///
2559 virtual bool CanPauseStream() { return false; }
2560 //----------------------------------------------------------------------------
2561
2562 //============================================================================
2563 ///
2564 /// @brief Check if the backend supports seeking for the currently playing
2565 /// stream.
2566 ///
2567 /// This will enable/disable the rewind/forward buttons in Kodi based on the
2568 /// return value.
2569 ///
2570 /// @return false if the PVR addon/backend does not support seeking, true if
2571 /// possible
2572 ///
2573 virtual bool CanSeekStream() { return false; }
2574 //----------------------------------------------------------------------------
2575
2576 //============================================================================
2577 ///
2578 /// @brief Notify the pvr addon that Kodi (un)paused the currently playing
2579 /// stream.
2580 ///
2581 /// @param[in] paused To inform by `true` is paused and with `false` playing
2582 ///
2583 virtual void PauseStream(bool paused) {}
2584 //----------------------------------------------------------------------------
2585
2586 //============================================================================
2587 ///
2588 /// @brief Check for real-time streaming.
2589 ///
2590 /// @return true if current stream is real-time
2591 ///
2592 virtual bool IsRealTimeStream() { return false; }
2593 //----------------------------------------------------------------------------
2594
2595 //============================================================================
2596 ///
2597 /// @brief Get stream times.
2598 ///
2599 /// @param[out] times A pointer to the data to be filled by the implementation.
2600 /// @return @ref PVR_ERROR_NO_ERROR on success.
2601 ///
2602 virtual PVR_ERROR GetStreamTimes(kodi::addon::PVRStreamTimes& times)
2603 {
2604 return PVR_ERROR_NOT_IMPLEMENTED;
2605 }
2606 //----------------------------------------------------------------------------
2607
2608 //============================================================================
2609 ///
2610 /// @brief Obtain the chunk size to use when reading streams.
2611 ///
2612 /// @param[out] chunksize must be filled with the chunk size in bytes.
2613 /// @return @ref PVR_ERROR_NO_ERROR if the chunk size has been fetched successfully.
2614 ///
2615 /// @remarks Optional, and only used if not reading from demuxer (=> @ref DemuxRead) and
2616 /// @ref PVRCapabilities::SetSupportsRecordings() is true (=> @ref ReadRecordedStream) or
2617 /// @ref PVRCapabilities::SetHandlesInputStream() is true (=> @ref ReadLiveStream).
2618 ///
2619 virtual PVR_ERROR GetStreamReadChunkSize(int& chunksize) { return PVR_ERROR_NOT_IMPLEMENTED; }
2620 //----------------------------------------------------------------------------
2621
2622 ///@}
2623 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2624
2625private:
2626 void SetAddonStruct(KODI_HANDLE instance, const std::string& kodiVersion)
2627 {
2628 if (instance == nullptr)
2629 throw std::logic_error("kodi::addon::CInstancePVRClient: Creation with empty addon "
2630 "structure not allowed, table must be given from Kodi!");
2631
2632 m_instanceData = static_cast<AddonInstance_PVR*>(instance);
2633 m_instanceData->toAddon->addonInstance = this;
2634 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2635 m_instanceData->toAddon->GetCapabilities = ADDON_GetCapabilities;
2636 m_instanceData->toAddon->GetConnectionString = ADDON_GetConnectionString;
2637 m_instanceData->toAddon->GetBackendName = ADDON_GetBackendName;
2638 m_instanceData->toAddon->GetBackendVersion = ADDON_GetBackendVersion;
2639 m_instanceData->toAddon->GetBackendHostname = ADDON_GetBackendHostname;
2640 m_instanceData->toAddon->GetDriveSpace = ADDON_GetDriveSpace;
2641 m_instanceData->toAddon->CallSettingsMenuHook = ADDON_CallSettingsMenuHook;
2642 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2643 m_instanceData->toAddon->GetChannelsAmount = ADDON_GetChannelsAmount;
2644 m_instanceData->toAddon->GetChannels = ADDON_GetChannels;
2645 m_instanceData->toAddon->GetChannelStreamProperties = ADDON_GetChannelStreamProperties;
2646 m_instanceData->toAddon->GetSignalStatus = ADDON_GetSignalStatus;
2647 m_instanceData->toAddon->GetDescrambleInfo = ADDON_GetDescrambleInfo;
2648 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2649 m_instanceData->toAddon->GetChannelGroupsAmount = ADDON_GetChannelGroupsAmount;
2650 m_instanceData->toAddon->GetChannelGroups = ADDON_GetChannelGroups;
2651 m_instanceData->toAddon->GetChannelGroupMembers = ADDON_GetChannelGroupMembers;
2652 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2653 m_instanceData->toAddon->DeleteChannel = ADDON_DeleteChannel;
2654 m_instanceData->toAddon->RenameChannel = ADDON_RenameChannel;
2655 m_instanceData->toAddon->OpenDialogChannelSettings = ADDON_OpenDialogChannelSettings;
2656 m_instanceData->toAddon->OpenDialogChannelAdd = ADDON_OpenDialogChannelAdd;
2657 m_instanceData->toAddon->OpenDialogChannelScan = ADDON_OpenDialogChannelScan;
2658 m_instanceData->toAddon->CallChannelMenuHook = ADDON_CallChannelMenuHook;
2659 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2660 m_instanceData->toAddon->GetEPGForChannel = ADDON_GetEPGForChannel;
2661 m_instanceData->toAddon->IsEPGTagRecordable = ADDON_IsEPGTagRecordable;
2662 m_instanceData->toAddon->IsEPGTagPlayable = ADDON_IsEPGTagPlayable;
2663 m_instanceData->toAddon->GetEPGTagEdl = ADDON_GetEPGTagEdl;
2664 m_instanceData->toAddon->GetEPGTagStreamProperties = ADDON_GetEPGTagStreamProperties;
2665 m_instanceData->toAddon->SetEPGTimeFrame = ADDON_SetEPGTimeFrame;
2666 m_instanceData->toAddon->CallEPGMenuHook = ADDON_CallEPGMenuHook;
2667 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2668 m_instanceData->toAddon->GetRecordingsAmount = ADDON_GetRecordingsAmount;
2669 m_instanceData->toAddon->GetRecordings = ADDON_GetRecordings;
2670 m_instanceData->toAddon->DeleteRecording = ADDON_DeleteRecording;
2671 m_instanceData->toAddon->UndeleteRecording = ADDON_UndeleteRecording;
2672 m_instanceData->toAddon->DeleteAllRecordingsFromTrash = ADDON_DeleteAllRecordingsFromTrash;
2673 m_instanceData->toAddon->RenameRecording = ADDON_RenameRecording;
2674 m_instanceData->toAddon->SetRecordingLifetime = ADDON_SetRecordingLifetime;
2675 m_instanceData->toAddon->SetRecordingPlayCount = ADDON_SetRecordingPlayCount;
2676 m_instanceData->toAddon->SetRecordingLastPlayedPosition = ADDON_SetRecordingLastPlayedPosition;
2677 m_instanceData->toAddon->GetRecordingLastPlayedPosition = ADDON_GetRecordingLastPlayedPosition;
2678 m_instanceData->toAddon->GetRecordingEdl = ADDON_GetRecordingEdl;
2679 m_instanceData->toAddon->GetRecordingSize = ADDON_GetRecordingSize;
2680 m_instanceData->toAddon->GetRecordingStreamProperties = ADDON_GetRecordingStreamProperties;
2681 m_instanceData->toAddon->CallRecordingMenuHook = ADDON_CallRecordingMenuHook;
2682 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2683 m_instanceData->toAddon->GetTimerTypes = ADDON_GetTimerTypes;
2684 m_instanceData->toAddon->GetTimersAmount = ADDON_GetTimersAmount;
2685 m_instanceData->toAddon->GetTimers = ADDON_GetTimers;
2686 m_instanceData->toAddon->AddTimer = ADDON_AddTimer;
2687 m_instanceData->toAddon->DeleteTimer = ADDON_DeleteTimer;
2688 m_instanceData->toAddon->UpdateTimer = ADDON_UpdateTimer;
2689 m_instanceData->toAddon->CallTimerMenuHook = ADDON_CallTimerMenuHook;
2690 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2691 m_instanceData->toAddon->OnSystemSleep = ADDON_OnSystemSleep;
2692 m_instanceData->toAddon->OnSystemWake = ADDON_OnSystemWake;
2693 m_instanceData->toAddon->OnPowerSavingActivated = ADDON_OnPowerSavingActivated;
2694 m_instanceData->toAddon->OnPowerSavingDeactivated = ADDON_OnPowerSavingDeactivated;
2695 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2696 m_instanceData->toAddon->OpenLiveStream = ADDON_OpenLiveStream;
2697 m_instanceData->toAddon->CloseLiveStream = ADDON_CloseLiveStream;
2698 m_instanceData->toAddon->ReadLiveStream = ADDON_ReadLiveStream;
2699 m_instanceData->toAddon->SeekLiveStream = ADDON_SeekLiveStream;
2700 m_instanceData->toAddon->LengthLiveStream = ADDON_LengthLiveStream;
2701 m_instanceData->toAddon->GetStreamProperties = ADDON_GetStreamProperties;
2702 m_instanceData->toAddon->GetStreamReadChunkSize = ADDON_GetStreamReadChunkSize;
2703 m_instanceData->toAddon->IsRealTimeStream = ADDON_IsRealTimeStream;
2704 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2705 m_instanceData->toAddon->OpenRecordedStream = ADDON_OpenRecordedStream;
2706 m_instanceData->toAddon->CloseRecordedStream = ADDON_CloseRecordedStream;
2707 m_instanceData->toAddon->ReadRecordedStream = ADDON_ReadRecordedStream;
2708 m_instanceData->toAddon->SeekRecordedStream = ADDON_SeekRecordedStream;
2709 m_instanceData->toAddon->LengthRecordedStream = ADDON_LengthRecordedStream;
2710 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2711 m_instanceData->toAddon->DemuxReset = ADDON_DemuxReset;
2712 m_instanceData->toAddon->DemuxAbort = ADDON_DemuxAbort;
2713 m_instanceData->toAddon->DemuxFlush = ADDON_DemuxFlush;
2714 m_instanceData->toAddon->DemuxRead = ADDON_DemuxRead;
2715 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2716 m_instanceData->toAddon->CanPauseStream = ADDON_CanPauseStream;
2717 m_instanceData->toAddon->PauseStream = ADDON_PauseStream;
2718 m_instanceData->toAddon->CanSeekStream = ADDON_CanSeekStream;
2719 m_instanceData->toAddon->SeekTime = ADDON_SeekTime;
2720 m_instanceData->toAddon->SetSpeed = ADDON_SetSpeed;
2721 m_instanceData->toAddon->FillBuffer = ADDON_FillBuffer;
2722 m_instanceData->toAddon->GetStreamTimes = ADDON_GetStreamTimes;
2723 }
2724
2725 inline static PVR_ERROR ADDON_GetCapabilities(const AddonInstance_PVR* instance,
2726 PVR_ADDON_CAPABILITIES* capabilities)
2727 {
2728 PVRCapabilities cppCapabilities(capabilities);
2729 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2730 ->GetCapabilities(cppCapabilities);
2731 }
2732
2733 inline static PVR_ERROR ADDON_GetBackendName(const AddonInstance_PVR* instance,
2734 char* str,
2735 int memSize)
2736 {
2737 std::string backendName;
2738 PVR_ERROR err = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2739 ->GetBackendName(backendName);
2740 if (err == PVR_ERROR_NO_ERROR)
2741 strncpy(str, backendName.c_str(), memSize);
2742 return err;
2743 }
2744
2745 inline static PVR_ERROR ADDON_GetBackendVersion(const AddonInstance_PVR* instance,
2746 char* str,
2747 int memSize)
2748 {
2749 std::string backendVersion;
2750 PVR_ERROR err = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2751 ->GetBackendVersion(backendVersion);
2752 if (err == PVR_ERROR_NO_ERROR)
2753 strncpy(str, backendVersion.c_str(), memSize);
2754 return err;
2755 }
2756
2757 inline static PVR_ERROR ADDON_GetBackendHostname(const AddonInstance_PVR* instance,
2758 char* str,
2759 int memSize)
2760 {
2761 std::string backendHostname;
2762 PVR_ERROR err = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2763 ->GetBackendHostname(backendHostname);
2764 if (err == PVR_ERROR_NO_ERROR)
2765 strncpy(str, backendHostname.c_str(), memSize);
2766 return err;
2767 }
2768
2769 inline static PVR_ERROR ADDON_GetConnectionString(const AddonInstance_PVR* instance,
2770 char* str,
2771 int memSize)
2772 {
2773 std::string connectionString;
2774 PVR_ERROR err = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2775 ->GetConnectionString(connectionString);
2776 if (err == PVR_ERROR_NO_ERROR)
2777 strncpy(str, connectionString.c_str(), memSize);
2778 return err;
2779 }
2780
2781 inline static PVR_ERROR ADDON_GetDriveSpace(const AddonInstance_PVR* instance,
2782 uint64_t* total,
2783 uint64_t* used)
2784 {
2785 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2786 ->GetDriveSpace(*total, *used);
2787 }
2788
2789 inline static PVR_ERROR ADDON_CallSettingsMenuHook(const AddonInstance_PVR* instance,
2790 const PVR_MENUHOOK* menuhook)
2791 {
2792 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2793 ->CallSettingsMenuHook(menuhook);
2794 }
2795
2796 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2797
2798 inline static PVR_ERROR ADDON_GetChannelsAmount(const AddonInstance_PVR* instance, int* amount)
2799 {
2800 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2801 ->GetChannelsAmount(*amount);
2802 }
2803
2804 inline static PVR_ERROR ADDON_GetChannels(const AddonInstance_PVR* instance,
2805 ADDON_HANDLE handle,
2806 bool radio)
2807 {
2808 PVRChannelsResultSet result(instance, handle);
2809 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2810 ->GetChannels(radio, result);
2811 }
2812
2813 inline static PVR_ERROR ADDON_GetChannelStreamProperties(const AddonInstance_PVR* instance,
2814 const PVR_CHANNEL* channel,
2815 PVR_NAMED_VALUE* properties,
2816 unsigned int* propertiesCount)
2817 {
2818 *propertiesCount = 0;
2819 std::vector<PVRStreamProperty> propertiesList;
2820 PVR_ERROR error = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2821 ->GetChannelStreamProperties(channel, propertiesList);
2822 if (error == PVR_ERROR_NO_ERROR)
2823 {
2824 for (const auto& property : propertiesList)
2825 {
2826 strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName,
2827 sizeof(properties[*propertiesCount].strName) - 1);
2828 strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue,
2829 sizeof(properties[*propertiesCount].strValue) - 1);
2830 ++*propertiesCount;
2831 if (*propertiesCount > STREAM_MAX_PROPERTY_COUNT)
2832 break;
2833 }
2834 }
2835 return error;
2836 }
2837
2838 inline static PVR_ERROR ADDON_GetSignalStatus(const AddonInstance_PVR* instance,
2839 int channelUid,
2840 PVR_SIGNAL_STATUS* signalStatus)
2841 {
2842 PVRSignalStatus cppSignalStatus(signalStatus);
2843 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2844 ->GetSignalStatus(channelUid, cppSignalStatus);
2845 }
2846
2847 inline static PVR_ERROR ADDON_GetDescrambleInfo(const AddonInstance_PVR* instance,
2848 int channelUid,
2849 PVR_DESCRAMBLE_INFO* descrambleInfo)
2850 {
2851 PVRDescrambleInfo cppDescrambleInfo(descrambleInfo);
2852 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2853 ->GetDescrambleInfo(channelUid, cppDescrambleInfo);
2854 }
2855
2856 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2857
2858 inline static PVR_ERROR ADDON_GetChannelGroupsAmount(const AddonInstance_PVR* instance,
2859 int* amount)
2860 {
2861 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2862 ->GetChannelGroupsAmount(*amount);
2863 }
2864
2865 inline static PVR_ERROR ADDON_GetChannelGroups(const AddonInstance_PVR* instance,
2866 ADDON_HANDLE handle,
2867 bool radio)
2868 {
2869 PVRChannelGroupsResultSet result(instance, handle);
2870 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2871 ->GetChannelGroups(radio, result);
2872 }
2873
2874 inline static PVR_ERROR ADDON_GetChannelGroupMembers(const AddonInstance_PVR* instance,
2875 ADDON_HANDLE handle,
2876 const PVR_CHANNEL_GROUP* group)
2877 {
2878 PVRChannelGroupMembersResultSet result(instance, handle);
2879 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2880 ->GetChannelGroupMembers(group, result);
2881 }
2882
2883 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2884
2885 inline static PVR_ERROR ADDON_DeleteChannel(const AddonInstance_PVR* instance,
2886 const PVR_CHANNEL* channel)
2887 {
2888 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2889 ->DeleteChannel(channel);
2890 }
2891
2892 inline static PVR_ERROR ADDON_RenameChannel(const AddonInstance_PVR* instance,
2893 const PVR_CHANNEL* channel)
2894 {
2895 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2896 ->RenameChannel(channel);
2897 }
2898
2899 inline static PVR_ERROR ADDON_OpenDialogChannelSettings(const AddonInstance_PVR* instance,
2900 const PVR_CHANNEL* channel)
2901 {
2902 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2903 ->OpenDialogChannelSettings(channel);
2904 }
2905
2906 inline static PVR_ERROR ADDON_OpenDialogChannelAdd(const AddonInstance_PVR* instance,
2907 const PVR_CHANNEL* channel)
2908 {
2909 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2910 ->OpenDialogChannelAdd(channel);
2911 }
2912
2913 inline static PVR_ERROR ADDON_OpenDialogChannelScan(const AddonInstance_PVR* instance)
2914 {
2915 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2916 ->OpenDialogChannelScan();
2917 }
2918
2919 inline static PVR_ERROR ADDON_CallChannelMenuHook(const AddonInstance_PVR* instance,
2920 const PVR_MENUHOOK* menuhook,
2921 const PVR_CHANNEL* channel)
2922 {
2923 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2924 ->CallChannelMenuHook(menuhook, channel);
2925 }
2926
2927 //--==----==----==----==----==----==----==----==----==----==----==----==----==
2928
2929 inline static PVR_ERROR ADDON_GetEPGForChannel(const AddonInstance_PVR* instance,
2930 ADDON_HANDLE handle,
2931 int channelUid,
2932 time_t start,
2933 time_t end)
2934 {
2935 PVREPGTagsResultSet result(instance, handle);
2936 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2937 ->GetEPGForChannel(channelUid, start, end, result);
2938 }
2939
2940 inline static PVR_ERROR ADDON_IsEPGTagRecordable(const AddonInstance_PVR* instance,
2941 const EPG_TAG* tag,
2942 bool* isRecordable)
2943 {
2944 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2945 ->IsEPGTagRecordable(tag, *isRecordable);
2946 }
2947
2948 inline static PVR_ERROR ADDON_IsEPGTagPlayable(const AddonInstance_PVR* instance,
2949 const EPG_TAG* tag,
2950 bool* isPlayable)
2951 {
2952 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2953 ->IsEPGTagPlayable(tag, *isPlayable);
2954 }
2955
2956 inline static PVR_ERROR ADDON_GetEPGTagEdl(const AddonInstance_PVR* instance,
2957 const EPG_TAG* tag,
2958 PVR_EDL_ENTRY* edl,
2959 int* size)
2960 {
2961 *size = 0;
2962 std::vector<PVREDLEntry> edlList;
2963 PVR_ERROR error = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2964 ->GetEPGTagEdl(tag, edlList);
2965 if (error == PVR_ERROR_NO_ERROR)
2966 {
2967 for (const auto& edlEntry : edlList)
2968 {
2969 edl[*size] = *edlEntry;
2970 ++*size;
2971 }
2972 }
2973 return error;
2974 }
2975
2976 inline static PVR_ERROR ADDON_GetEPGTagStreamProperties(const AddonInstance_PVR* instance,
2977 const EPG_TAG* tag,
2978 PVR_NAMED_VALUE* properties,
2979 unsigned int* propertiesCount)
2980 {
2981 *propertiesCount = 0;
2982 std::vector<PVRStreamProperty> propertiesList;
2983 PVR_ERROR error = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2984 ->GetEPGTagStreamProperties(tag, propertiesList);
2985 if (error == PVR_ERROR_NO_ERROR)
2986 {
2987 for (const auto& property : propertiesList)
2988 {
2989 strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName,
2990 sizeof(properties[*propertiesCount].strName) - 1);
2991 strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue,
2992 sizeof(properties[*propertiesCount].strValue) - 1);
2993 ++*propertiesCount;
2994 if (*propertiesCount > STREAM_MAX_PROPERTY_COUNT)
2995 break;
2996 }
2997 }
2998 return error;
2999 }
3000
3001 inline static PVR_ERROR ADDON_SetEPGTimeFrame(const AddonInstance_PVR* instance, int days)
3002 {
3003 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3004 ->SetEPGTimeFrame(days);
3005 }
3006
3007 inline static PVR_ERROR ADDON_CallEPGMenuHook(const AddonInstance_PVR* instance,
3008 const PVR_MENUHOOK* menuhook,
3009 const EPG_TAG* tag)
3010 {
3011 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3012 ->CallEPGMenuHook(menuhook, tag);
3013 }
3014
3015 //--==----==----==----==----==----==----==----==----==----==----==----==----==
3016
3017 inline static PVR_ERROR ADDON_GetRecordingsAmount(const AddonInstance_PVR* instance,
3018 bool deleted,
3019 int* amount)
3020 {
3021 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3022 ->GetRecordingsAmount(deleted, *amount);
3023 }
3024
3025 inline static PVR_ERROR ADDON_GetRecordings(const AddonInstance_PVR* instance,
3026 ADDON_HANDLE handle,
3027 bool deleted)
3028 {
3029 PVRRecordingsResultSet result(instance, handle);
3030 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3031 ->GetRecordings(deleted, result);
3032 }
3033
3034 inline static PVR_ERROR ADDON_DeleteRecording(const AddonInstance_PVR* instance,
3035 const PVR_RECORDING* recording)
3036 {
3037 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3038 ->DeleteRecording(recording);
3039 }
3040
3041 inline static PVR_ERROR ADDON_UndeleteRecording(const AddonInstance_PVR* instance,
3042 const PVR_RECORDING* recording)
3043 {
3044 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3045 ->UndeleteRecording(recording);
3046 }
3047
3048 inline static PVR_ERROR ADDON_DeleteAllRecordingsFromTrash(const AddonInstance_PVR* instance)
3049 {
3050 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3051 ->DeleteAllRecordingsFromTrash();
3052 }
3053
3054 inline static PVR_ERROR ADDON_RenameRecording(const AddonInstance_PVR* instance,
3055 const PVR_RECORDING* recording)
3056 {
3057 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3058 ->RenameRecording(recording);
3059 }
3060
3061 inline static PVR_ERROR ADDON_SetRecordingLifetime(const AddonInstance_PVR* instance,
3062 const PVR_RECORDING* recording)
3063 {
3064 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3065 ->SetRecordingLifetime(recording);
3066 }
3067
3068 inline static PVR_ERROR ADDON_SetRecordingPlayCount(const AddonInstance_PVR* instance,
3069 const PVR_RECORDING* recording,
3070 int count)
3071 {
3072 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3073 ->SetRecordingPlayCount(recording, count);
3074 }
3075
3076 inline static PVR_ERROR ADDON_SetRecordingLastPlayedPosition(const AddonInstance_PVR* instance,
3077 const PVR_RECORDING* recording,
3078 int lastplayedposition)
3079 {
3080 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3081 ->SetRecordingLastPlayedPosition(recording, lastplayedposition);
3082 }
3083
3084 inline static PVR_ERROR ADDON_GetRecordingLastPlayedPosition(const AddonInstance_PVR* instance,
3085 const PVR_RECORDING* recording,
3086 int* position)
3087 {
3088 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3089 ->GetRecordingLastPlayedPosition(recording, *position);
3090 }
3091
3092 inline static PVR_ERROR ADDON_GetRecordingEdl(const AddonInstance_PVR* instance,
3093 const PVR_RECORDING* recording,
3094 PVR_EDL_ENTRY* edl,
3095 int* size)
3096 {
3097 *size = 0;
3098 std::vector<PVREDLEntry> edlList;
3099 PVR_ERROR error = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3100 ->GetRecordingEdl(recording, edlList);
3101 if (error == PVR_ERROR_NO_ERROR)
3102 {
3103 for (const auto& edlEntry : edlList)
3104 {
3105 edl[*size] = *edlEntry;
3106 ++*size;
3107 }
3108 }
3109 return error;
3110 }
3111
3112 inline static PVR_ERROR ADDON_GetRecordingSize(const AddonInstance_PVR* instance,
3113 const PVR_RECORDING* recording,
3114 int64_t* size)
3115 {
3116 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3117 ->GetRecordingSize(recording, *size);
3118 }
3119
3120 inline static PVR_ERROR ADDON_GetRecordingStreamProperties(const AddonInstance_PVR* instance,
3121 const PVR_RECORDING* recording,
3122 PVR_NAMED_VALUE* properties,
3123 unsigned int* propertiesCount)
3124 {
3125 *propertiesCount = 0;
3126 std::vector<PVRStreamProperty> propertiesList;
3127 PVR_ERROR error = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3128 ->GetRecordingStreamProperties(recording, propertiesList);
3129 if (error == PVR_ERROR_NO_ERROR)
3130 {
3131 for (const auto& property : propertiesList)
3132 {
3133 strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName,
3134 sizeof(properties[*propertiesCount].strName) - 1);
3135 strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue,
3136 sizeof(properties[*propertiesCount].strValue) - 1);
3137 ++*propertiesCount;
3138 if (*propertiesCount > STREAM_MAX_PROPERTY_COUNT)
3139 break;
3140 }
3141 }
3142 return error;
3143 }
3144
3145 inline static PVR_ERROR ADDON_CallRecordingMenuHook(const AddonInstance_PVR* instance,
3146 const PVR_MENUHOOK* menuhook,
3147 const PVR_RECORDING* recording)
3148 {
3149 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3150 ->CallRecordingMenuHook(menuhook, recording);
3151 }
3152
3153 //--==----==----==----==----==----==----==----==----==----==----==----==----==
3154
3155
3156 inline static PVR_ERROR ADDON_GetTimerTypes(const AddonInstance_PVR* instance,
3157 PVR_TIMER_TYPE* types,
3158 int* typesCount)
3159 {
3160 *typesCount = 0;
3161 std::vector<PVRTimerType> timerTypes;
3162 PVR_ERROR error = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3163 ->GetTimerTypes(timerTypes);
3164 if (error == PVR_ERROR_NO_ERROR)
3165 {
3166 for (const auto& timerType : timerTypes)
3167 {
3168 types[*typesCount] = *timerType;
3169 ++*typesCount;
3170 if (*typesCount >= PVR_ADDON_TIMERTYPE_ARRAY_SIZE)
3171 break;
3172 }
3173 }
3174 return error;
3175 }
3176
3177 inline static PVR_ERROR ADDON_GetTimersAmount(const AddonInstance_PVR* instance, int* amount)
3178 {
3179 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3180 ->GetTimersAmount(*amount);
3181 }
3182
3183 inline static PVR_ERROR ADDON_GetTimers(const AddonInstance_PVR* instance, ADDON_HANDLE handle)
3184 {
3185 PVRTimersResultSet result(instance, handle);
3186 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->GetTimers(result);
3187 }
3188
3189 inline static PVR_ERROR ADDON_AddTimer(const AddonInstance_PVR* instance, const PVR_TIMER* timer)
3190 {
3191 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->AddTimer(timer);
3192 }
3193
3194 inline static PVR_ERROR ADDON_DeleteTimer(const AddonInstance_PVR* instance,
3195 const PVR_TIMER* timer,
3196 bool forceDelete)
3197 {
3198 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3199 ->DeleteTimer(timer, forceDelete);
3200 }
3201
3202 inline static PVR_ERROR ADDON_UpdateTimer(const AddonInstance_PVR* instance,
3203 const PVR_TIMER* timer)
3204 {
3205 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->UpdateTimer(timer);
3206 }
3207
3208 inline static PVR_ERROR ADDON_CallTimerMenuHook(const AddonInstance_PVR* instance,
3209 const PVR_MENUHOOK* menuhook,
3210 const PVR_TIMER* timer)
3211 {
3212 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3213 ->CallTimerMenuHook(menuhook, timer);
3214 }
3215
3216 //--==----==----==----==----==----==----==----==----==----==----==----==----==
3217
3218 inline static PVR_ERROR ADDON_OnSystemSleep(const AddonInstance_PVR* instance)
3219 {
3220 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->OnSystemSleep();
3221 }
3222
3223 inline static PVR_ERROR ADDON_OnSystemWake(const AddonInstance_PVR* instance)
3224 {
3225 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->OnSystemWake();
3226 }
3227
3228 inline static PVR_ERROR ADDON_OnPowerSavingActivated(const AddonInstance_PVR* instance)
3229 {
3230 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3231 ->OnPowerSavingActivated();
3232 }
3233
3234 inline static PVR_ERROR ADDON_OnPowerSavingDeactivated(const AddonInstance_PVR* instance)
3235 {
3236 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3237 ->OnPowerSavingDeactivated();
3238 }
3239
3240 // obsolete parts below
3241 ///@{
3242
3243 inline static bool ADDON_OpenLiveStream(const AddonInstance_PVR* instance,
3244 const PVR_CHANNEL* channel)
3245 {
3246 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3247 ->OpenLiveStream(channel);
3248 }
3249
3250 inline static void ADDON_CloseLiveStream(const AddonInstance_PVR* instance)
3251 {
3252 static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->CloseLiveStream();
3253 }
3254
3255 inline static int ADDON_ReadLiveStream(const AddonInstance_PVR* instance,
3256 unsigned char* buffer,
3257 unsigned int size)
3258 {
3259 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3260 ->ReadLiveStream(buffer, size);
3261 }
3262
3263 inline static int64_t ADDON_SeekLiveStream(const AddonInstance_PVR* instance,
3264 int64_t position,
3265 int whence)
3266 {
3267 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3268 ->SeekLiveStream(position, whence);
3269 }
3270
3271 inline static int64_t ADDON_LengthLiveStream(const AddonInstance_PVR* instance)
3272 {
3273 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->LengthLiveStream();
3274 }
3275
3276 inline static PVR_ERROR ADDON_GetStreamProperties(const AddonInstance_PVR* instance,
3277 PVR_STREAM_PROPERTIES* properties)
3278 {
3279 properties->iStreamCount = 0;
3280 std::vector<PVRStreamProperties> cppProperties;
3281 PVR_ERROR err = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3282 ->GetStreamProperties(cppProperties);
3283 if (err == PVR_ERROR_NO_ERROR)
3284 {
3285 for (unsigned int i = 0; i < cppProperties.size(); ++i)
3286 {
3287 memcpy(&properties->stream[i],
3288 static_cast<PVR_STREAM_PROPERTIES::PVR_STREAM*>(cppProperties[i]),
3289 sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM));
3290 ++properties->iStreamCount;
3291
3292 if (properties->iStreamCount >= PVR_STREAM_MAX_STREAMS)
3293 {
3294 kodi::Log(
3295 ADDON_LOG_ERROR,
3296 "CInstancePVRClient::%s: Addon given with '%li' more allowed streams where '%i'",
3297 __func__, cppProperties.size(), PVR_STREAM_MAX_STREAMS);
3298 break;
3299 }
3300 }
3301 }
3302
3303 return err;
3304 }
3305
3306 inline static PVR_ERROR ADDON_GetStreamReadChunkSize(const AddonInstance_PVR* instance,
3307 int* chunksize)
3308 {
3309 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3310 ->GetStreamReadChunkSize(*chunksize);
3311 }
3312
3313 inline static bool ADDON_IsRealTimeStream(const AddonInstance_PVR* instance)
3314 {
3315 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->IsRealTimeStream();
3316 }
3317
3318 inline static bool ADDON_OpenRecordedStream(const AddonInstance_PVR* instance,
3319 const PVR_RECORDING* recording)
3320 {
3321 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3322 ->OpenRecordedStream(recording);
3323 }
3324
3325 inline static void ADDON_CloseRecordedStream(const AddonInstance_PVR* instance)
3326 {
3327 static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->CloseRecordedStream();
3328 }
3329
3330 inline static int ADDON_ReadRecordedStream(const AddonInstance_PVR* instance,
3331 unsigned char* buffer,
3332 unsigned int size)
3333 {
3334 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3335 ->ReadRecordedStream(buffer, size);
3336 }
3337
3338 inline static int64_t ADDON_SeekRecordedStream(const AddonInstance_PVR* instance,
3339 int64_t position,
3340 int whence)
3341 {
3342 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3343 ->SeekRecordedStream(position, whence);
3344 }
3345
3346 inline static int64_t ADDON_LengthRecordedStream(const AddonInstance_PVR* instance)
3347 {
3348 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3349 ->LengthRecordedStream();
3350 }
3351
3352 inline static void ADDON_DemuxReset(const AddonInstance_PVR* instance)
3353 {
3354 static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->DemuxReset();
3355 }
3356
3357 inline static void ADDON_DemuxAbort(const AddonInstance_PVR* instance)
3358 {
3359 static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->DemuxAbort();
3360 }
3361
3362 inline static void ADDON_DemuxFlush(const AddonInstance_PVR* instance)
3363 {
3364 static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->DemuxFlush();
3365 }
3366
3367 inline static DemuxPacket* ADDON_DemuxRead(const AddonInstance_PVR* instance)
3368 {
3369 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->DemuxRead();
3370 }
3371
3372 inline static bool ADDON_CanPauseStream(const AddonInstance_PVR* instance)
3373 {
3374 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->CanPauseStream();
3375 }
3376
3377 inline static bool ADDON_CanSeekStream(const AddonInstance_PVR* instance)
3378 {
3379 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->CanSeekStream();
3380 }
3381
3382 inline static void ADDON_PauseStream(const AddonInstance_PVR* instance, bool bPaused)
3383 {
3384 static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->PauseStream(bPaused);
3385 }
3386
3387 inline static bool ADDON_SeekTime(const AddonInstance_PVR* instance,
3388 double time,
3389 bool backwards,
3390 double* startpts)
3391 {
3392 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3393 ->SeekTime(time, backwards, *startpts);
3394 }
3395
3396 inline static void ADDON_SetSpeed(const AddonInstance_PVR* instance, int speed)
3397 {
3398 static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->SetSpeed(speed);
3399 }
3400
3401 inline static void ADDON_FillBuffer(const AddonInstance_PVR* instance, bool mode)
3402 {
3403 static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->FillBuffer(mode);
3404 }
3405
3406 inline static PVR_ERROR ADDON_GetStreamTimes(const AddonInstance_PVR* instance,
3407 PVR_STREAM_TIMES* times)
3408 {
3409 PVRStreamTimes cppTimes(times);
3410 return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3411 ->GetStreamTimes(cppTimes);
3412 }
3413 ///@}
3414
3415 AddonInstance_PVR* m_instanceData = nullptr;
3416};
3417//}}}
3418//______________________________________________________________________________
3419
3420} /* namespace addon */
3421} /* namespace kodi */
3422
3423#endif /* __cplusplus */