Kodi Development  20.0
for Binary and Script based Add-Ons
PVR.h
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/Providers.h"
19 #include "pvr/Recordings.h"
20 #include "pvr/Stream.h"
21 #include "pvr/Timers.h"
22 
23 #ifdef __cplusplus
24 
49 namespace kodi
50 {
51 namespace addon
52 {
53 
54 //¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
55 // "C++" Doxygen group set for the definitions
56 //{{{
57 
58 //==============================================================================
68 
69 //##############################################################################
84 //##############################################################################
97 //------------------------------------------------------------------------------
99 
100 //##############################################################################
116 //------------------------------------------------------------------------------
117 
118 //##############################################################################
125 //------------------------------------------------------------------------------
126 
127 //##############################################################################
136 //------------------------------------------------------------------------------
137 
138 //##############################################################################
145 //------------------------------------------------------------------------------
146 
147 //##############################################################################
154 //------------------------------------------------------------------------------
155 
156 //##############################################################################
162 //------------------------------------------------------------------------------
163 
164 //##############################################################################
170 //------------------------------------------------------------------------------
171 
172 //##############################################################################
180 //------------------------------------------------------------------------------
181 
182 //##############################################################################
195 //------------------------------------------------------------------------------
196 
197 //}}}
198 //______________________________________________________________________________
199 
200 //¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
201 // "C++" PVR addon instance class
202 //{{{
203 
204 //==============================================================================
407 class ATTRIBUTE_HIDDEN CInstancePVRClient : public IAddonInstance
408 {
409 public:
410  //============================================================================
432 
433  //============================================================================
466  {
467  if (CAddonBase::m_interface->globalSingleInstance != nullptr)
468  throw std::logic_error("kodi::addon::CInstancePVRClient: Creation of more as one in single "
469  "instance way is not allowed!");
470 
471  SetAddonStruct(CAddonBase::m_interface->firstKodiInstance, m_kodiVersion);
472  CAddonBase::m_interface->globalSingleInstance = this;
473  }
474  //----------------------------------------------------------------------------
475 
476  //============================================================================
516  explicit CInstancePVRClient(KODI_HANDLE instance, const std::string& kodiVersion = "")
518  !kodiVersion.empty() ? kodiVersion : GetKodiTypeVersion(ADDON_INSTANCE_PVR))
519  {
520  if (CAddonBase::m_interface->globalSingleInstance != nullptr)
521  throw std::logic_error("kodi::addon::CInstancePVRClient: Creation of multiple together with "
522  "single instance way is not allowed!");
523 
524  SetAddonStruct(instance, m_kodiVersion);
525  }
526  //----------------------------------------------------------------------------
527 
528  //============================================================================
531  ~CInstancePVRClient() override = default;
532  //----------------------------------------------------------------------------
533 
534  //--==----==----==----==----==----==----==----==----==----==----==----==----==
535 
536  //============================================================================
568  //----------------------------------------------------------------------------
569 
570  //============================================================================
592  virtual PVR_ERROR GetBackendName(std::string& name) = 0;
593  //----------------------------------------------------------------------------
594 
595  //============================================================================
619  virtual PVR_ERROR GetBackendVersion(std::string& version) = 0;
620  //----------------------------------------------------------------------------
621 
622  //============================================================================
629  virtual PVR_ERROR GetBackendHostname(std::string& hostname) { return PVR_ERROR_NOT_IMPLEMENTED; }
630  //----------------------------------------------------------------------------
631 
632  //============================================================================
640  virtual PVR_ERROR GetConnectionString(std::string& connection)
641  {
643  }
644  //----------------------------------------------------------------------------
645 
646  //============================================================================
667  virtual PVR_ERROR GetDriveSpace(uint64_t& total, uint64_t& used)
668  {
670  }
671  //----------------------------------------------------------------------------
672 
673  //============================================================================
701  {
703  }
704  //----------------------------------------------------------------------------
705 
706  //==========================================================================
755  inline void AddMenuHook(const kodi::addon::PVRMenuhook& hook)
756  {
757  m_instanceData->toKodi->AddMenuHook(m_instanceData->toKodi->kodiInstance, hook);
758  }
759  //----------------------------------------------------------------------------
760 
761  //==========================================================================
789  inline void ConnectionStateChange(const std::string& connectionString,
790  PVR_CONNECTION_STATE newState,
791  const std::string& message)
792  {
793  m_instanceData->toKodi->ConnectionStateChange(
794  m_instanceData->toKodi->kodiInstance, connectionString.c_str(), newState, message.c_str());
795  }
796  //----------------------------------------------------------------------------
797 
798  //==========================================================================
808  inline std::string UserPath() const { return m_instanceData->props->strUserPath; }
809  //----------------------------------------------------------------------------
810 
811  //==========================================================================
821  inline std::string ClientPath() const { return m_instanceData->props->strClientPath; }
822  //----------------------------------------------------------------------------
823 
825  //--==----==----==----==----==----==----==----==----==----==----==----==----==
826 
827  //============================================================================
851 
852  //============================================================================
861  virtual PVR_ERROR GetProvidersAmount(int& amount) { return PVR_ERROR_NOT_IMPLEMENTED; }
862  //----------------------------------------------------------------------------
863 
864  //============================================================================
902  {
904  }
905  //----------------------------------------------------------------------------
906 
907  //============================================================================
914  {
915  m_instanceData->toKodi->TriggerProvidersUpdate(m_instanceData->toKodi->kodiInstance);
916  }
917  //----------------------------------------------------------------------------
918 
919  //============================================================================
927  virtual PVR_ERROR GetChannelsAmount(int& amount) { return PVR_ERROR_NOT_IMPLEMENTED; }
928  //----------------------------------------------------------------------------
929 
930  //============================================================================
977  {
979  }
980  //----------------------------------------------------------------------------
981 
982  //============================================================================
1019  const kodi::addon::PVRChannel& channel,
1020  std::vector<kodi::addon::PVRStreamProperty>& properties)
1021  {
1023  }
1024  //----------------------------------------------------------------------------
1025 
1026  //============================================================================
1067  virtual PVR_ERROR GetSignalStatus(int channelUid, kodi::addon::PVRSignalStatus& signalStatus)
1068  {
1070  }
1071  //----------------------------------------------------------------------------
1072 
1073  //============================================================================
1087  virtual PVR_ERROR GetDescrambleInfo(int channelUid,
1088  kodi::addon::PVRDescrambleInfo& descrambleInfo)
1089  {
1091  }
1092  //----------------------------------------------------------------------------
1093 
1094  //============================================================================
1100  inline void TriggerChannelUpdate()
1101  {
1102  m_instanceData->toKodi->TriggerChannelUpdate(m_instanceData->toKodi->kodiInstance);
1103  }
1104  //----------------------------------------------------------------------------
1105 
1107  //--==----==----==----==----==----==----==----==----==----==----==----==----==
1108 
1109  //============================================================================
1128 
1129  //============================================================================
1138  //----------------------------------------------------------------------------
1139 
1140  //============================================================================
1186  {
1188  }
1189  //----------------------------------------------------------------------------
1190 
1191  //============================================================================
1250  {
1252  }
1253  //----------------------------------------------------------------------------
1254 
1255  //============================================================================
1262  {
1263  m_instanceData->toKodi->TriggerChannelGroupsUpdate(m_instanceData->toKodi->kodiInstance);
1264  }
1265  //----------------------------------------------------------------------------
1266 
1268  //--==----==----==----==----==----==----==----==----==----==----==----==----==
1269 
1270  //============================================================================
1289 
1290  //============================================================================
1299  {
1301  }
1302  //----------------------------------------------------------------------------
1303 
1304  //==========================================================================
1321  {
1323  }
1324  //----------------------------------------------------------------------------
1325 
1326  //==========================================================================
1336  {
1338  }
1339  //----------------------------------------------------------------------------
1340 
1341  //==========================================================================
1351  {
1353  }
1354  //----------------------------------------------------------------------------
1355 
1356  //==========================================================================
1365  //----------------------------------------------------------------------------
1366 
1367  //==========================================================================
1382  const kodi::addon::PVRChannel& item)
1383  {
1385  }
1386  //----------------------------------------------------------------------------
1387 
1389  //--==----==----==----==----==----==----==----==----==----==----==----==----==
1390 
1391  //============================================================================
1414 
1415  //============================================================================
1464  virtual PVR_ERROR GetEPGForChannel(int channelUid,
1465  time_t start,
1466  time_t end,
1468  {
1470  }
1471  //----------------------------------------------------------------------------
1472 
1473  //============================================================================
1482  virtual PVR_ERROR IsEPGTagRecordable(const kodi::addon::PVREPGTag& tag, bool& isRecordable)
1483  {
1485  }
1486  //----------------------------------------------------------------------------
1487 
1488  //============================================================================
1497  virtual PVR_ERROR IsEPGTagPlayable(const kodi::addon::PVREPGTag& tag, bool& isPlayable)
1498  {
1500  }
1501  //----------------------------------------------------------------------------
1502 
1503  //============================================================================
1522  std::vector<kodi::addon::PVREDLEntry>& edl)
1523  {
1525  }
1526  //----------------------------------------------------------------------------
1527 
1528  //============================================================================
1563  const kodi::addon::PVREPGTag& tag, std::vector<kodi::addon::PVRStreamProperty>& properties)
1564  {
1566  }
1567  //----------------------------------------------------------------------------
1568 
1569  //============================================================================
1584  virtual PVR_ERROR SetEPGMaxPastDays(int pastDays) { return PVR_ERROR_NOT_IMPLEMENTED; }
1585  //----------------------------------------------------------------------------
1586 
1587  //============================================================================
1602  virtual PVR_ERROR SetEPGMaxFutureDays(int futureDays) { return PVR_ERROR_NOT_IMPLEMENTED; }
1603  //----------------------------------------------------------------------------
1604 
1605  //==========================================================================
1620  const kodi::addon::PVREPGTag& tag)
1621  {
1623  }
1624  //----------------------------------------------------------------------------
1625 
1626  //==========================================================================
1636  inline int EpgMaxPastDays() const { return m_instanceData->props->iEpgMaxPastDays; }
1637  //----------------------------------------------------------------------------
1638 
1639  //==========================================================================
1649  inline int EpgMaxFutureDays() const { return m_instanceData->props->iEpgMaxFutureDays; }
1650  //----------------------------------------------------------------------------
1651 
1652  //==========================================================================
1660  inline void TriggerEpgUpdate(unsigned int channelUid)
1661  {
1662  m_instanceData->toKodi->TriggerEpgUpdate(m_instanceData->toKodi->kodiInstance, channelUid);
1663  }
1664  //----------------------------------------------------------------------------
1665 
1666  //==========================================================================
1699  {
1700  m_instanceData->toKodi->EpgEventStateChange(m_instanceData->toKodi->kodiInstance, tag.GetTag(),
1701  newState);
1702  }
1703  //----------------------------------------------------------------------------
1704 
1706  //--==----==----==----==----==----==----==----==----==----==----==----==----==
1707 
1708  //============================================================================
1731 
1732  //============================================================================
1743  virtual PVR_ERROR GetRecordingsAmount(bool deleted, int& amount)
1744  {
1746  }
1747  //----------------------------------------------------------------------------
1748 
1749  //============================================================================
1791  {
1793  }
1794  //----------------------------------------------------------------------------
1795 
1796  //============================================================================
1806  {
1808  }
1809  //----------------------------------------------------------------------------
1810 
1811  //============================================================================
1821  {
1823  }
1824  //----------------------------------------------------------------------------
1825 
1826  //============================================================================
1832  //----------------------------------------------------------------------------
1833 
1834  //============================================================================
1845  {
1847  }
1848  //----------------------------------------------------------------------------
1849 
1850  //============================================================================
1863  {
1865  }
1866  //----------------------------------------------------------------------------
1867 
1868  //============================================================================
1880  virtual PVR_ERROR SetRecordingPlayCount(const kodi::addon::PVRRecording& recording, int count)
1881  {
1883  }
1884  //----------------------------------------------------------------------------
1885 
1886  //============================================================================
1897  int lastplayedposition)
1898  {
1900  }
1901  //----------------------------------------------------------------------------
1902 
1903  //============================================================================
1914  int& position)
1915  {
1917  }
1918  //----------------------------------------------------------------------------
1919 
1920  //============================================================================
1935  std::vector<kodi::addon::PVREDLEntry>& edl)
1936  {
1938  }
1939  //----------------------------------------------------------------------------
1940 
1941  //============================================================================
1951  virtual PVR_ERROR GetRecordingSize(const kodi::addon::PVRRecording& recording, int64_t& size)
1952  {
1954  }
1955  //----------------------------------------------------------------------------
1956 
1957  //============================================================================
1994  const kodi::addon::PVRRecording& recording,
1995  std::vector<kodi::addon::PVRStreamProperty>& properties)
1996  {
1998  }
1999  //----------------------------------------------------------------------------
2000 
2001  //==========================================================================
2016  const kodi::addon::PVRRecording& item)
2017  {
2019  }
2020  //----------------------------------------------------------------------------
2021 
2022  //============================================================================
2033  inline void RecordingNotification(const std::string& recordingName,
2034  const std::string& fileName,
2035  bool on)
2036  {
2037  m_instanceData->toKodi->RecordingNotification(m_instanceData->toKodi->kodiInstance,
2038  recordingName.c_str(), fileName.c_str(), on);
2039  }
2040  //----------------------------------------------------------------------------
2041 
2042  //============================================================================
2049  {
2050  m_instanceData->toKodi->TriggerRecordingUpdate(m_instanceData->toKodi->kodiInstance);
2051  }
2052  //----------------------------------------------------------------------------
2053 
2055  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2056 
2057  //============================================================================
2079 
2080  //============================================================================
2095  virtual PVR_ERROR GetTimerTypes(std::vector<kodi::addon::PVRTimerType>& types)
2096  {
2098  }
2099  //----------------------------------------------------------------------------
2100 
2101  //============================================================================
2110  virtual PVR_ERROR GetTimersAmount(int& amount) { return PVR_ERROR_NOT_IMPLEMENTED; }
2111  //----------------------------------------------------------------------------
2112 
2113  //============================================================================
2151  {
2153  }
2154  //----------------------------------------------------------------------------
2155 
2156  //============================================================================
2166  {
2168  }
2169  //----------------------------------------------------------------------------
2170 
2171  //============================================================================
2182  virtual PVR_ERROR DeleteTimer(const kodi::addon::PVRTimer& timer, bool forceDelete)
2183  {
2185  }
2186  //----------------------------------------------------------------------------
2187 
2188  //============================================================================
2198  {
2200  }
2201  //----------------------------------------------------------------------------
2202 
2203  //============================================================================
2219  const kodi::addon::PVRTimer& item)
2220  {
2222  }
2223  //----------------------------------------------------------------------------
2224 
2225  //============================================================================
2231  inline void TriggerTimerUpdate()
2232  {
2233  m_instanceData->toKodi->TriggerTimerUpdate(m_instanceData->toKodi->kodiInstance);
2234  }
2235  //----------------------------------------------------------------------------
2236 
2238  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2239 
2240  //============================================================================
2257 
2258  //============================================================================
2264  //----------------------------------------------------------------------------
2265 
2266  //============================================================================
2272  //----------------------------------------------------------------------------
2273 
2274  //============================================================================
2280  //----------------------------------------------------------------------------
2281 
2282  //============================================================================
2288  //----------------------------------------------------------------------------
2289 
2291  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2292 
2293  //============================================================================
2305 
2306  //============================================================================
2323 
2324  //============================================================================
2342  virtual bool OpenLiveStream(const kodi::addon::PVRChannel& channel) { return false; }
2343  //----------------------------------------------------------------------------
2344 
2345  //============================================================================
2351  virtual void CloseLiveStream() {}
2352  //----------------------------------------------------------------------------
2353 
2354  //============================================================================
2364  virtual int ReadLiveStream(unsigned char* buffer, unsigned int size) { return 0; }
2365  //----------------------------------------------------------------------------
2366 
2367  //============================================================================
2384  virtual int64_t SeekLiveStream(int64_t position, int whence) { return 0; }
2385  //----------------------------------------------------------------------------
2386 
2387  //============================================================================
2395  virtual int64_t LengthLiveStream() { return 0; }
2396  //----------------------------------------------------------------------------
2397 
2398  //============================================================================
2418 
2419  //============================================================================
2427  virtual PVR_ERROR GetStreamProperties(std::vector<kodi::addon::PVRStreamProperties>& properties)
2428  {
2430  }
2431  //----------------------------------------------------------------------------
2432 
2433  //============================================================================
2447  virtual DEMUX_PACKET* DemuxRead() { return nullptr; }
2448  //----------------------------------------------------------------------------
2449 
2450  //============================================================================
2455  virtual void DemuxReset() {}
2456  //----------------------------------------------------------------------------
2457 
2458  //============================================================================
2463  virtual void DemuxAbort() {}
2464  //----------------------------------------------------------------------------
2465 
2466  //============================================================================
2472  virtual void DemuxFlush() {}
2473  //----------------------------------------------------------------------------
2474 
2475  //============================================================================
2483  virtual void SetSpeed(int speed) {}
2484  //----------------------------------------------------------------------------
2485 
2486  //============================================================================
2493  virtual void FillBuffer(bool mode) {}
2494  //----------------------------------------------------------------------------
2495 
2496  //============================================================================
2508  virtual bool SeekTime(double time, bool backwards, double& startpts) { return false; }
2509  //----------------------------------------------------------------------------
2510 
2511  //============================================================================
2520  inline PVRCodec GetCodecByName(const std::string& codecName) const
2521  {
2522  return PVRCodec(m_instanceData->toKodi->GetCodecByName(m_instanceData->toKodi->kodiInstance,
2523  codecName.c_str()));
2524  }
2525  //----------------------------------------------------------------------------
2526 
2527  //============================================================================
2536  inline DEMUX_PACKET* AllocateDemuxPacket(int iDataSize)
2537  {
2538  return m_instanceData->toKodi->AllocateDemuxPacket(m_instanceData->toKodi->kodiInstance,
2539  iDataSize);
2540  }
2541  //----------------------------------------------------------------------------
2542 
2543  //============================================================================
2551  inline void FreeDemuxPacket(DEMUX_PACKET* pPacket)
2552  {
2553  m_instanceData->toKodi->FreeDemuxPacket(m_instanceData->toKodi->kodiInstance, pPacket);
2554  }
2555  //----------------------------------------------------------------------------
2557 
2559  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2560 
2561  //============================================================================
2580 
2581  //============================================================================
2591  virtual bool OpenRecordedStream(const kodi::addon::PVRRecording& recording) { return false; }
2592  //----------------------------------------------------------------------------
2593 
2594  //============================================================================
2600  virtual void CloseRecordedStream() {}
2601  //----------------------------------------------------------------------------
2602 
2603  //============================================================================
2613  virtual int ReadRecordedStream(unsigned char* buffer, unsigned int size) { return 0; }
2614  //----------------------------------------------------------------------------
2615 
2616  //============================================================================
2633  virtual int64_t SeekRecordedStream(int64_t position, int whence) { return 0; }
2634  //----------------------------------------------------------------------------
2635 
2636  //============================================================================
2644  virtual int64_t LengthRecordedStream() { return 0; }
2645  //----------------------------------------------------------------------------
2646 
2648  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2649 
2650  //============================================================================
2668 
2669  //============================================================================
2679  virtual bool CanPauseStream() { return false; }
2680  //----------------------------------------------------------------------------
2681 
2682  //============================================================================
2693  virtual bool CanSeekStream() { return false; }
2694  //----------------------------------------------------------------------------
2695 
2696  //============================================================================
2703  virtual void PauseStream(bool paused) {}
2704  //----------------------------------------------------------------------------
2705 
2706  //============================================================================
2712  virtual bool IsRealTimeStream() { return false; }
2713  //----------------------------------------------------------------------------
2714 
2715  //============================================================================
2723  {
2725  }
2726  //----------------------------------------------------------------------------
2727 
2728  //============================================================================
2739  virtual PVR_ERROR GetStreamReadChunkSize(int& chunksize) { return PVR_ERROR_NOT_IMPLEMENTED; }
2740  //----------------------------------------------------------------------------
2741 
2743  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2744 
2745 private:
2746  void SetAddonStruct(KODI_HANDLE instance, const std::string& kodiVersion)
2747  {
2748  if (instance == nullptr)
2749  throw std::logic_error("kodi::addon::CInstancePVRClient: Creation with empty addon "
2750  "structure not allowed, table must be given from Kodi!");
2751 
2752  m_instanceData = static_cast<AddonInstance_PVR*>(instance);
2753  m_instanceData->toAddon->addonInstance = this;
2754  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2755  m_instanceData->toAddon->GetCapabilities = ADDON_GetCapabilities;
2756  m_instanceData->toAddon->GetConnectionString = ADDON_GetConnectionString;
2757  m_instanceData->toAddon->GetBackendName = ADDON_GetBackendName;
2758  m_instanceData->toAddon->GetBackendVersion = ADDON_GetBackendVersion;
2759  m_instanceData->toAddon->GetBackendHostname = ADDON_GetBackendHostname;
2760  m_instanceData->toAddon->GetDriveSpace = ADDON_GetDriveSpace;
2761  m_instanceData->toAddon->CallSettingsMenuHook = ADDON_CallSettingsMenuHook;
2762  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2763  m_instanceData->toAddon->GetChannelsAmount = ADDON_GetChannelsAmount;
2764  m_instanceData->toAddon->GetChannels = ADDON_GetChannels;
2765  m_instanceData->toAddon->GetChannelStreamProperties = ADDON_GetChannelStreamProperties;
2766  m_instanceData->toAddon->GetSignalStatus = ADDON_GetSignalStatus;
2767  m_instanceData->toAddon->GetDescrambleInfo = ADDON_GetDescrambleInfo;
2768  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2769  m_instanceData->toAddon->GetProvidersAmount = ADDON_GetProvidersAmount;
2770  m_instanceData->toAddon->GetProviders = ADDON_GetProviders;
2771  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2772  m_instanceData->toAddon->GetChannelGroupsAmount = ADDON_GetChannelGroupsAmount;
2773  m_instanceData->toAddon->GetChannelGroups = ADDON_GetChannelGroups;
2774  m_instanceData->toAddon->GetChannelGroupMembers = ADDON_GetChannelGroupMembers;
2775  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2776  m_instanceData->toAddon->DeleteChannel = ADDON_DeleteChannel;
2777  m_instanceData->toAddon->RenameChannel = ADDON_RenameChannel;
2778  m_instanceData->toAddon->OpenDialogChannelSettings = ADDON_OpenDialogChannelSettings;
2779  m_instanceData->toAddon->OpenDialogChannelAdd = ADDON_OpenDialogChannelAdd;
2780  m_instanceData->toAddon->OpenDialogChannelScan = ADDON_OpenDialogChannelScan;
2781  m_instanceData->toAddon->CallChannelMenuHook = ADDON_CallChannelMenuHook;
2782  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2783  m_instanceData->toAddon->GetEPGForChannel = ADDON_GetEPGForChannel;
2784  m_instanceData->toAddon->IsEPGTagRecordable = ADDON_IsEPGTagRecordable;
2785  m_instanceData->toAddon->IsEPGTagPlayable = ADDON_IsEPGTagPlayable;
2786  m_instanceData->toAddon->GetEPGTagEdl = ADDON_GetEPGTagEdl;
2787  m_instanceData->toAddon->GetEPGTagStreamProperties = ADDON_GetEPGTagStreamProperties;
2788  m_instanceData->toAddon->SetEPGMaxPastDays = ADDON_SetEPGMaxPastDays;
2789  m_instanceData->toAddon->SetEPGMaxFutureDays = ADDON_SetEPGMaxFutureDays;
2790  m_instanceData->toAddon->CallEPGMenuHook = ADDON_CallEPGMenuHook;
2791  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2792  m_instanceData->toAddon->GetRecordingsAmount = ADDON_GetRecordingsAmount;
2793  m_instanceData->toAddon->GetRecordings = ADDON_GetRecordings;
2794  m_instanceData->toAddon->DeleteRecording = ADDON_DeleteRecording;
2795  m_instanceData->toAddon->UndeleteRecording = ADDON_UndeleteRecording;
2796  m_instanceData->toAddon->DeleteAllRecordingsFromTrash = ADDON_DeleteAllRecordingsFromTrash;
2797  m_instanceData->toAddon->RenameRecording = ADDON_RenameRecording;
2798  m_instanceData->toAddon->SetRecordingLifetime = ADDON_SetRecordingLifetime;
2799  m_instanceData->toAddon->SetRecordingPlayCount = ADDON_SetRecordingPlayCount;
2800  m_instanceData->toAddon->SetRecordingLastPlayedPosition = ADDON_SetRecordingLastPlayedPosition;
2801  m_instanceData->toAddon->GetRecordingLastPlayedPosition = ADDON_GetRecordingLastPlayedPosition;
2802  m_instanceData->toAddon->GetRecordingEdl = ADDON_GetRecordingEdl;
2803  m_instanceData->toAddon->GetRecordingSize = ADDON_GetRecordingSize;
2804  m_instanceData->toAddon->GetRecordingStreamProperties = ADDON_GetRecordingStreamProperties;
2805  m_instanceData->toAddon->CallRecordingMenuHook = ADDON_CallRecordingMenuHook;
2806  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2807  m_instanceData->toAddon->GetTimerTypes = ADDON_GetTimerTypes;
2808  m_instanceData->toAddon->GetTimersAmount = ADDON_GetTimersAmount;
2809  m_instanceData->toAddon->GetTimers = ADDON_GetTimers;
2810  m_instanceData->toAddon->AddTimer = ADDON_AddTimer;
2811  m_instanceData->toAddon->DeleteTimer = ADDON_DeleteTimer;
2812  m_instanceData->toAddon->UpdateTimer = ADDON_UpdateTimer;
2813  m_instanceData->toAddon->CallTimerMenuHook = ADDON_CallTimerMenuHook;
2814  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2815  m_instanceData->toAddon->OnSystemSleep = ADDON_OnSystemSleep;
2816  m_instanceData->toAddon->OnSystemWake = ADDON_OnSystemWake;
2817  m_instanceData->toAddon->OnPowerSavingActivated = ADDON_OnPowerSavingActivated;
2818  m_instanceData->toAddon->OnPowerSavingDeactivated = ADDON_OnPowerSavingDeactivated;
2819  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2820  m_instanceData->toAddon->OpenLiveStream = ADDON_OpenLiveStream;
2821  m_instanceData->toAddon->CloseLiveStream = ADDON_CloseLiveStream;
2822  m_instanceData->toAddon->ReadLiveStream = ADDON_ReadLiveStream;
2823  m_instanceData->toAddon->SeekLiveStream = ADDON_SeekLiveStream;
2824  m_instanceData->toAddon->LengthLiveStream = ADDON_LengthLiveStream;
2825  m_instanceData->toAddon->GetStreamProperties = ADDON_GetStreamProperties;
2826  m_instanceData->toAddon->GetStreamReadChunkSize = ADDON_GetStreamReadChunkSize;
2827  m_instanceData->toAddon->IsRealTimeStream = ADDON_IsRealTimeStream;
2828  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2829  m_instanceData->toAddon->OpenRecordedStream = ADDON_OpenRecordedStream;
2830  m_instanceData->toAddon->CloseRecordedStream = ADDON_CloseRecordedStream;
2831  m_instanceData->toAddon->ReadRecordedStream = ADDON_ReadRecordedStream;
2832  m_instanceData->toAddon->SeekRecordedStream = ADDON_SeekRecordedStream;
2833  m_instanceData->toAddon->LengthRecordedStream = ADDON_LengthRecordedStream;
2834  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2835  m_instanceData->toAddon->DemuxReset = ADDON_DemuxReset;
2836  m_instanceData->toAddon->DemuxAbort = ADDON_DemuxAbort;
2837  m_instanceData->toAddon->DemuxFlush = ADDON_DemuxFlush;
2838  m_instanceData->toAddon->DemuxRead = ADDON_DemuxRead;
2839  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2840  m_instanceData->toAddon->CanPauseStream = ADDON_CanPauseStream;
2841  m_instanceData->toAddon->PauseStream = ADDON_PauseStream;
2842  m_instanceData->toAddon->CanSeekStream = ADDON_CanSeekStream;
2843  m_instanceData->toAddon->SeekTime = ADDON_SeekTime;
2844  m_instanceData->toAddon->SetSpeed = ADDON_SetSpeed;
2845  m_instanceData->toAddon->FillBuffer = ADDON_FillBuffer;
2846  m_instanceData->toAddon->GetStreamTimes = ADDON_GetStreamTimes;
2847  }
2848 
2849  inline static PVR_ERROR ADDON_GetCapabilities(const AddonInstance_PVR* instance,
2850  PVR_ADDON_CAPABILITIES* capabilities)
2851  {
2852  PVRCapabilities cppCapabilities(capabilities);
2853  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2854  ->GetCapabilities(cppCapabilities);
2855  }
2856 
2857  inline static PVR_ERROR ADDON_GetBackendName(const AddonInstance_PVR* instance,
2858  char* str,
2859  int memSize)
2860  {
2861  std::string backendName;
2862  PVR_ERROR err = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2863  ->GetBackendName(backendName);
2864  if (err == PVR_ERROR_NO_ERROR)
2865  strncpy(str, backendName.c_str(), memSize);
2866  return err;
2867  }
2868 
2869  inline static PVR_ERROR ADDON_GetBackendVersion(const AddonInstance_PVR* instance,
2870  char* str,
2871  int memSize)
2872  {
2873  std::string backendVersion;
2874  PVR_ERROR err = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2875  ->GetBackendVersion(backendVersion);
2876  if (err == PVR_ERROR_NO_ERROR)
2877  strncpy(str, backendVersion.c_str(), memSize);
2878  return err;
2879  }
2880 
2881  inline static PVR_ERROR ADDON_GetBackendHostname(const AddonInstance_PVR* instance,
2882  char* str,
2883  int memSize)
2884  {
2885  std::string backendHostname;
2886  PVR_ERROR err = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2887  ->GetBackendHostname(backendHostname);
2888  if (err == PVR_ERROR_NO_ERROR)
2889  strncpy(str, backendHostname.c_str(), memSize);
2890  return err;
2891  }
2892 
2893  inline static PVR_ERROR ADDON_GetConnectionString(const AddonInstance_PVR* instance,
2894  char* str,
2895  int memSize)
2896  {
2897  std::string connectionString;
2898  PVR_ERROR err = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2899  ->GetConnectionString(connectionString);
2900  if (err == PVR_ERROR_NO_ERROR)
2901  strncpy(str, connectionString.c_str(), memSize);
2902  return err;
2903  }
2904 
2905  inline static PVR_ERROR ADDON_GetDriveSpace(const AddonInstance_PVR* instance,
2906  uint64_t* total,
2907  uint64_t* used)
2908  {
2909  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2910  ->GetDriveSpace(*total, *used);
2911  }
2912 
2913  inline static PVR_ERROR ADDON_CallSettingsMenuHook(const AddonInstance_PVR* instance,
2914  const PVR_MENUHOOK* menuhook)
2915  {
2916  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2917  ->CallSettingsMenuHook(menuhook);
2918  }
2919 
2920  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2921 
2922  inline static PVR_ERROR ADDON_GetChannelsAmount(const AddonInstance_PVR* instance, int* amount)
2923  {
2924  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2925  ->GetChannelsAmount(*amount);
2926  }
2927 
2928  inline static PVR_ERROR ADDON_GetChannels(const AddonInstance_PVR* instance,
2929  ADDON_HANDLE handle,
2930  bool radio)
2931  {
2932  PVRChannelsResultSet result(instance, handle);
2933  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2934  ->GetChannels(radio, result);
2935  }
2936 
2937  inline static PVR_ERROR ADDON_GetChannelStreamProperties(const AddonInstance_PVR* instance,
2938  const PVR_CHANNEL* channel,
2939  PVR_NAMED_VALUE* properties,
2940  unsigned int* propertiesCount)
2941  {
2942  *propertiesCount = 0;
2943  std::vector<PVRStreamProperty> propertiesList;
2944  PVR_ERROR error = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2945  ->GetChannelStreamProperties(channel, propertiesList);
2946  if (error == PVR_ERROR_NO_ERROR)
2947  {
2948  for (const auto& property : propertiesList)
2949  {
2950  strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName,
2951  sizeof(properties[*propertiesCount].strName) - 1);
2952  strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue,
2953  sizeof(properties[*propertiesCount].strValue) - 1);
2954  ++*propertiesCount;
2955  if (*propertiesCount > STREAM_MAX_PROPERTY_COUNT)
2956  break;
2957  }
2958  }
2959  return error;
2960  }
2961 
2962  inline static PVR_ERROR ADDON_GetSignalStatus(const AddonInstance_PVR* instance,
2963  int channelUid,
2964  PVR_SIGNAL_STATUS* signalStatus)
2965  {
2966  PVRSignalStatus cppSignalStatus(signalStatus);
2967  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2968  ->GetSignalStatus(channelUid, cppSignalStatus);
2969  }
2970 
2971  inline static PVR_ERROR ADDON_GetDescrambleInfo(const AddonInstance_PVR* instance,
2972  int channelUid,
2973  PVR_DESCRAMBLE_INFO* descrambleInfo)
2974  {
2975  PVRDescrambleInfo cppDescrambleInfo(descrambleInfo);
2976  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2977  ->GetDescrambleInfo(channelUid, cppDescrambleInfo);
2978  }
2979 
2980  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2981 
2982  inline static PVR_ERROR ADDON_GetProvidersAmount(const AddonInstance_PVR* instance, int* amount)
2983  {
2984  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
2985  ->GetProvidersAmount(*amount);
2986  }
2987 
2988  inline static PVR_ERROR ADDON_GetProviders(const AddonInstance_PVR* instance, ADDON_HANDLE handle)
2989  {
2990  PVRProvidersResultSet result(instance, handle);
2991  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->GetProviders(result);
2992  }
2993 
2994  //--==----==----==----==----==----==----==----==----==----==----==----==----==
2995 
2996  inline static PVR_ERROR ADDON_GetChannelGroupsAmount(const AddonInstance_PVR* instance,
2997  int* amount)
2998  {
2999  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3000  ->GetChannelGroupsAmount(*amount);
3001  }
3002 
3003  inline static PVR_ERROR ADDON_GetChannelGroups(const AddonInstance_PVR* instance,
3004  ADDON_HANDLE handle,
3005  bool radio)
3006  {
3007  PVRChannelGroupsResultSet result(instance, handle);
3008  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3009  ->GetChannelGroups(radio, result);
3010  }
3011 
3012  inline static PVR_ERROR ADDON_GetChannelGroupMembers(const AddonInstance_PVR* instance,
3013  ADDON_HANDLE handle,
3014  const PVR_CHANNEL_GROUP* group)
3015  {
3016  PVRChannelGroupMembersResultSet result(instance, handle);
3017  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3018  ->GetChannelGroupMembers(group, result);
3019  }
3020 
3021  //--==----==----==----==----==----==----==----==----==----==----==----==----==
3022 
3023  inline static PVR_ERROR ADDON_DeleteChannel(const AddonInstance_PVR* instance,
3024  const PVR_CHANNEL* channel)
3025  {
3026  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3027  ->DeleteChannel(channel);
3028  }
3029 
3030  inline static PVR_ERROR ADDON_RenameChannel(const AddonInstance_PVR* instance,
3031  const PVR_CHANNEL* channel)
3032  {
3033  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3034  ->RenameChannel(channel);
3035  }
3036 
3037  inline static PVR_ERROR ADDON_OpenDialogChannelSettings(const AddonInstance_PVR* instance,
3038  const PVR_CHANNEL* channel)
3039  {
3040  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3041  ->OpenDialogChannelSettings(channel);
3042  }
3043 
3044  inline static PVR_ERROR ADDON_OpenDialogChannelAdd(const AddonInstance_PVR* instance,
3045  const PVR_CHANNEL* channel)
3046  {
3047  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3048  ->OpenDialogChannelAdd(channel);
3049  }
3050 
3051  inline static PVR_ERROR ADDON_OpenDialogChannelScan(const AddonInstance_PVR* instance)
3052  {
3053  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3054  ->OpenDialogChannelScan();
3055  }
3056 
3057  inline static PVR_ERROR ADDON_CallChannelMenuHook(const AddonInstance_PVR* instance,
3058  const PVR_MENUHOOK* menuhook,
3059  const PVR_CHANNEL* channel)
3060  {
3061  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3062  ->CallChannelMenuHook(menuhook, channel);
3063  }
3064 
3065  //--==----==----==----==----==----==----==----==----==----==----==----==----==
3066 
3067  inline static PVR_ERROR ADDON_GetEPGForChannel(const AddonInstance_PVR* instance,
3068  ADDON_HANDLE handle,
3069  int channelUid,
3070  time_t start,
3071  time_t end)
3072  {
3073  PVREPGTagsResultSet result(instance, handle);
3074  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3075  ->GetEPGForChannel(channelUid, start, end, result);
3076  }
3077 
3078  inline static PVR_ERROR ADDON_IsEPGTagRecordable(const AddonInstance_PVR* instance,
3079  const EPG_TAG* tag,
3080  bool* isRecordable)
3081  {
3082  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3083  ->IsEPGTagRecordable(tag, *isRecordable);
3084  }
3085 
3086  inline static PVR_ERROR ADDON_IsEPGTagPlayable(const AddonInstance_PVR* instance,
3087  const EPG_TAG* tag,
3088  bool* isPlayable)
3089  {
3090  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3091  ->IsEPGTagPlayable(tag, *isPlayable);
3092  }
3093 
3094  inline static PVR_ERROR ADDON_GetEPGTagEdl(const AddonInstance_PVR* instance,
3095  const EPG_TAG* tag,
3096  PVR_EDL_ENTRY* edl,
3097  int* size)
3098  {
3099  std::vector<PVREDLEntry> edlList;
3100  PVR_ERROR error = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3101  ->GetEPGTagEdl(tag, edlList);
3102  if (static_cast<int>(edlList.size()) > *size)
3103  {
3104  kodi::Log(
3106  "CInstancePVRClient::%s: Truncating %d EDL entries from client to permitted size %d",
3107  __func__, static_cast<int>(edlList.size()), *size);
3108  edlList.resize(*size);
3109  }
3110  *size = 0;
3111  if (error == PVR_ERROR_NO_ERROR)
3112  {
3113  for (const auto& edlEntry : edlList)
3114  {
3115  edl[*size] = *edlEntry;
3116  ++*size;
3117  }
3118  }
3119  return error;
3120  }
3121 
3122  inline static PVR_ERROR ADDON_GetEPGTagStreamProperties(const AddonInstance_PVR* instance,
3123  const EPG_TAG* tag,
3124  PVR_NAMED_VALUE* properties,
3125  unsigned int* propertiesCount)
3126  {
3127  *propertiesCount = 0;
3128  std::vector<PVRStreamProperty> propertiesList;
3129  PVR_ERROR error = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3130  ->GetEPGTagStreamProperties(tag, propertiesList);
3131  if (error == PVR_ERROR_NO_ERROR)
3132  {
3133  for (const auto& property : propertiesList)
3134  {
3135  strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName,
3136  sizeof(properties[*propertiesCount].strName) - 1);
3137  strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue,
3138  sizeof(properties[*propertiesCount].strValue) - 1);
3139  ++*propertiesCount;
3140  if (*propertiesCount > STREAM_MAX_PROPERTY_COUNT)
3141  break;
3142  }
3143  }
3144  return error;
3145  }
3146 
3147  inline static PVR_ERROR ADDON_SetEPGMaxPastDays(const AddonInstance_PVR* instance, int pastDays)
3148  {
3149  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3150  ->SetEPGMaxPastDays(pastDays);
3151  }
3152 
3153  inline static PVR_ERROR ADDON_SetEPGMaxFutureDays(const AddonInstance_PVR* instance,
3154  int futureDays)
3155  {
3156  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3157  ->SetEPGMaxFutureDays(futureDays);
3158  }
3159 
3160  inline static PVR_ERROR ADDON_CallEPGMenuHook(const AddonInstance_PVR* instance,
3161  const PVR_MENUHOOK* menuhook,
3162  const EPG_TAG* tag)
3163  {
3164  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3165  ->CallEPGMenuHook(menuhook, tag);
3166  }
3167 
3168  //--==----==----==----==----==----==----==----==----==----==----==----==----==
3169 
3170  inline static PVR_ERROR ADDON_GetRecordingsAmount(const AddonInstance_PVR* instance,
3171  bool deleted,
3172  int* amount)
3173  {
3174  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3175  ->GetRecordingsAmount(deleted, *amount);
3176  }
3177 
3178  inline static PVR_ERROR ADDON_GetRecordings(const AddonInstance_PVR* instance,
3179  ADDON_HANDLE handle,
3180  bool deleted)
3181  {
3182  PVRRecordingsResultSet result(instance, handle);
3183  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3184  ->GetRecordings(deleted, result);
3185  }
3186 
3187  inline static PVR_ERROR ADDON_DeleteRecording(const AddonInstance_PVR* instance,
3188  const PVR_RECORDING* recording)
3189  {
3190  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3191  ->DeleteRecording(recording);
3192  }
3193 
3194  inline static PVR_ERROR ADDON_UndeleteRecording(const AddonInstance_PVR* instance,
3195  const PVR_RECORDING* recording)
3196  {
3197  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3198  ->UndeleteRecording(recording);
3199  }
3200 
3201  inline static PVR_ERROR ADDON_DeleteAllRecordingsFromTrash(const AddonInstance_PVR* instance)
3202  {
3203  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3204  ->DeleteAllRecordingsFromTrash();
3205  }
3206 
3207  inline static PVR_ERROR ADDON_RenameRecording(const AddonInstance_PVR* instance,
3208  const PVR_RECORDING* recording)
3209  {
3210  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3211  ->RenameRecording(recording);
3212  }
3213 
3214  inline static PVR_ERROR ADDON_SetRecordingLifetime(const AddonInstance_PVR* instance,
3215  const PVR_RECORDING* recording)
3216  {
3217  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3218  ->SetRecordingLifetime(recording);
3219  }
3220 
3221  inline static PVR_ERROR ADDON_SetRecordingPlayCount(const AddonInstance_PVR* instance,
3222  const PVR_RECORDING* recording,
3223  int count)
3224  {
3225  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3226  ->SetRecordingPlayCount(recording, count);
3227  }
3228 
3229  inline static PVR_ERROR ADDON_SetRecordingLastPlayedPosition(const AddonInstance_PVR* instance,
3230  const PVR_RECORDING* recording,
3231  int lastplayedposition)
3232  {
3233  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3234  ->SetRecordingLastPlayedPosition(recording, lastplayedposition);
3235  }
3236 
3237  inline static PVR_ERROR ADDON_GetRecordingLastPlayedPosition(const AddonInstance_PVR* instance,
3238  const PVR_RECORDING* recording,
3239  int* position)
3240  {
3241  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3242  ->GetRecordingLastPlayedPosition(recording, *position);
3243  }
3244 
3245  inline static PVR_ERROR ADDON_GetRecordingEdl(const AddonInstance_PVR* instance,
3246  const PVR_RECORDING* recording,
3247  PVR_EDL_ENTRY* edl,
3248  int* size)
3249  {
3250  std::vector<PVREDLEntry> edlList;
3251  PVR_ERROR error = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3252  ->GetRecordingEdl(recording, edlList);
3253  if (static_cast<int>(edlList.size()) > *size)
3254  {
3255  kodi::Log(
3257  "CInstancePVRClient::%s: Truncating %d EDL entries from client to permitted size %d",
3258  __func__, static_cast<int>(edlList.size()), *size);
3259  edlList.resize(*size);
3260  }
3261  *size = 0;
3262  if (error == PVR_ERROR_NO_ERROR)
3263  {
3264  for (const auto& edlEntry : edlList)
3265  {
3266  edl[*size] = *edlEntry;
3267  ++*size;
3268  }
3269  }
3270  return error;
3271  }
3272 
3273  inline static PVR_ERROR ADDON_GetRecordingSize(const AddonInstance_PVR* instance,
3274  const PVR_RECORDING* recording,
3275  int64_t* size)
3276  {
3277  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3278  ->GetRecordingSize(recording, *size);
3279  }
3280 
3281  inline static PVR_ERROR ADDON_GetRecordingStreamProperties(const AddonInstance_PVR* instance,
3282  const PVR_RECORDING* recording,
3283  PVR_NAMED_VALUE* properties,
3284  unsigned int* propertiesCount)
3285  {
3286  *propertiesCount = 0;
3287  std::vector<PVRStreamProperty> propertiesList;
3288  PVR_ERROR error = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3289  ->GetRecordingStreamProperties(recording, propertiesList);
3290  if (error == PVR_ERROR_NO_ERROR)
3291  {
3292  for (const auto& property : propertiesList)
3293  {
3294  strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName,
3295  sizeof(properties[*propertiesCount].strName) - 1);
3296  strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue,
3297  sizeof(properties[*propertiesCount].strValue) - 1);
3298  ++*propertiesCount;
3299  if (*propertiesCount > STREAM_MAX_PROPERTY_COUNT)
3300  break;
3301  }
3302  }
3303  return error;
3304  }
3305 
3306  inline static PVR_ERROR ADDON_CallRecordingMenuHook(const AddonInstance_PVR* instance,
3307  const PVR_MENUHOOK* menuhook,
3308  const PVR_RECORDING* recording)
3309  {
3310  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3311  ->CallRecordingMenuHook(menuhook, recording);
3312  }
3313 
3314  //--==----==----==----==----==----==----==----==----==----==----==----==----==
3315 
3316 
3317  inline static PVR_ERROR ADDON_GetTimerTypes(const AddonInstance_PVR* instance,
3318  PVR_TIMER_TYPE* types,
3319  int* typesCount)
3320  {
3321  *typesCount = 0;
3322  std::vector<PVRTimerType> timerTypes;
3323  PVR_ERROR error = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3324  ->GetTimerTypes(timerTypes);
3325  if (error == PVR_ERROR_NO_ERROR)
3326  {
3327  for (const auto& timerType : timerTypes)
3328  {
3329  types[*typesCount] = *timerType;
3330  ++*typesCount;
3331  if (*typesCount >= PVR_ADDON_TIMERTYPE_ARRAY_SIZE)
3332  break;
3333  }
3334  }
3335  return error;
3336  }
3337 
3338  inline static PVR_ERROR ADDON_GetTimersAmount(const AddonInstance_PVR* instance, int* amount)
3339  {
3340  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3341  ->GetTimersAmount(*amount);
3342  }
3343 
3344  inline static PVR_ERROR ADDON_GetTimers(const AddonInstance_PVR* instance, ADDON_HANDLE handle)
3345  {
3346  PVRTimersResultSet result(instance, handle);
3347  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->GetTimers(result);
3348  }
3349 
3350  inline static PVR_ERROR ADDON_AddTimer(const AddonInstance_PVR* instance, const PVR_TIMER* timer)
3351  {
3352  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->AddTimer(timer);
3353  }
3354 
3355  inline static PVR_ERROR ADDON_DeleteTimer(const AddonInstance_PVR* instance,
3356  const PVR_TIMER* timer,
3357  bool forceDelete)
3358  {
3359  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3360  ->DeleteTimer(timer, forceDelete);
3361  }
3362 
3363  inline static PVR_ERROR ADDON_UpdateTimer(const AddonInstance_PVR* instance,
3364  const PVR_TIMER* timer)
3365  {
3366  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->UpdateTimer(timer);
3367  }
3368 
3369  inline static PVR_ERROR ADDON_CallTimerMenuHook(const AddonInstance_PVR* instance,
3370  const PVR_MENUHOOK* menuhook,
3371  const PVR_TIMER* timer)
3372  {
3373  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3374  ->CallTimerMenuHook(menuhook, timer);
3375  }
3376 
3377  //--==----==----==----==----==----==----==----==----==----==----==----==----==
3378 
3379  inline static PVR_ERROR ADDON_OnSystemSleep(const AddonInstance_PVR* instance)
3380  {
3381  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->OnSystemSleep();
3382  }
3383 
3384  inline static PVR_ERROR ADDON_OnSystemWake(const AddonInstance_PVR* instance)
3385  {
3386  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->OnSystemWake();
3387  }
3388 
3389  inline static PVR_ERROR ADDON_OnPowerSavingActivated(const AddonInstance_PVR* instance)
3390  {
3391  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3392  ->OnPowerSavingActivated();
3393  }
3394 
3395  inline static PVR_ERROR ADDON_OnPowerSavingDeactivated(const AddonInstance_PVR* instance)
3396  {
3397  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3398  ->OnPowerSavingDeactivated();
3399  }
3400 
3401  // obsolete parts below
3403 
3404  inline static bool ADDON_OpenLiveStream(const AddonInstance_PVR* instance,
3405  const PVR_CHANNEL* channel)
3406  {
3407  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3408  ->OpenLiveStream(channel);
3409  }
3410 
3411  inline static void ADDON_CloseLiveStream(const AddonInstance_PVR* instance)
3412  {
3413  static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->CloseLiveStream();
3414  }
3415 
3416  inline static int ADDON_ReadLiveStream(const AddonInstance_PVR* instance,
3417  unsigned char* buffer,
3418  unsigned int size)
3419  {
3420  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3421  ->ReadLiveStream(buffer, size);
3422  }
3423 
3424  inline static int64_t ADDON_SeekLiveStream(const AddonInstance_PVR* instance,
3425  int64_t position,
3426  int whence)
3427  {
3428  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3429  ->SeekLiveStream(position, whence);
3430  }
3431 
3432  inline static int64_t ADDON_LengthLiveStream(const AddonInstance_PVR* instance)
3433  {
3434  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->LengthLiveStream();
3435  }
3436 
3437  inline static PVR_ERROR ADDON_GetStreamProperties(const AddonInstance_PVR* instance,
3438  PVR_STREAM_PROPERTIES* properties)
3439  {
3440  properties->iStreamCount = 0;
3441  std::vector<PVRStreamProperties> cppProperties;
3442  PVR_ERROR err = static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3443  ->GetStreamProperties(cppProperties);
3444  if (err == PVR_ERROR_NO_ERROR)
3445  {
3446  for (unsigned int i = 0; i < cppProperties.size(); ++i)
3447  {
3448  memcpy(&properties->stream[i],
3449  static_cast<PVR_STREAM_PROPERTIES::PVR_STREAM*>(cppProperties[i]),
3451  ++properties->iStreamCount;
3452 
3453  if (properties->iStreamCount >= PVR_STREAM_MAX_STREAMS)
3454  {
3455  kodi::Log(
3457  "CInstancePVRClient::%s: Addon given with '%li' more allowed streams where '%i'",
3458  __func__, cppProperties.size(), PVR_STREAM_MAX_STREAMS);
3459  break;
3460  }
3461  }
3462  }
3463 
3464  return err;
3465  }
3466 
3467  inline static PVR_ERROR ADDON_GetStreamReadChunkSize(const AddonInstance_PVR* instance,
3468  int* chunksize)
3469  {
3470  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3471  ->GetStreamReadChunkSize(*chunksize);
3472  }
3473 
3474  inline static bool ADDON_IsRealTimeStream(const AddonInstance_PVR* instance)
3475  {
3476  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->IsRealTimeStream();
3477  }
3478 
3479  inline static bool ADDON_OpenRecordedStream(const AddonInstance_PVR* instance,
3480  const PVR_RECORDING* recording)
3481  {
3482  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3483  ->OpenRecordedStream(recording);
3484  }
3485 
3486  inline static void ADDON_CloseRecordedStream(const AddonInstance_PVR* instance)
3487  {
3488  static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->CloseRecordedStream();
3489  }
3490 
3491  inline static int ADDON_ReadRecordedStream(const AddonInstance_PVR* instance,
3492  unsigned char* buffer,
3493  unsigned int size)
3494  {
3495  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3496  ->ReadRecordedStream(buffer, size);
3497  }
3498 
3499  inline static int64_t ADDON_SeekRecordedStream(const AddonInstance_PVR* instance,
3500  int64_t position,
3501  int whence)
3502  {
3503  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3504  ->SeekRecordedStream(position, whence);
3505  }
3506 
3507  inline static int64_t ADDON_LengthRecordedStream(const AddonInstance_PVR* instance)
3508  {
3509  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3510  ->LengthRecordedStream();
3511  }
3512 
3513  inline static void ADDON_DemuxReset(const AddonInstance_PVR* instance)
3514  {
3515  static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->DemuxReset();
3516  }
3517 
3518  inline static void ADDON_DemuxAbort(const AddonInstance_PVR* instance)
3519  {
3520  static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->DemuxAbort();
3521  }
3522 
3523  inline static void ADDON_DemuxFlush(const AddonInstance_PVR* instance)
3524  {
3525  static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->DemuxFlush();
3526  }
3527 
3528  inline static DEMUX_PACKET* ADDON_DemuxRead(const AddonInstance_PVR* instance)
3529  {
3530  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->DemuxRead();
3531  }
3532 
3533  inline static bool ADDON_CanPauseStream(const AddonInstance_PVR* instance)
3534  {
3535  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->CanPauseStream();
3536  }
3537 
3538  inline static bool ADDON_CanSeekStream(const AddonInstance_PVR* instance)
3539  {
3540  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->CanSeekStream();
3541  }
3542 
3543  inline static void ADDON_PauseStream(const AddonInstance_PVR* instance, bool bPaused)
3544  {
3545  static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->PauseStream(bPaused);
3546  }
3547 
3548  inline static bool ADDON_SeekTime(const AddonInstance_PVR* instance,
3549  double time,
3550  bool backwards,
3551  double* startpts)
3552  {
3553  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3554  ->SeekTime(time, backwards, *startpts);
3555  }
3556 
3557  inline static void ADDON_SetSpeed(const AddonInstance_PVR* instance, int speed)
3558  {
3559  static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->SetSpeed(speed);
3560  }
3561 
3562  inline static void ADDON_FillBuffer(const AddonInstance_PVR* instance, bool mode)
3563  {
3564  static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)->FillBuffer(mode);
3565  }
3566 
3567  inline static PVR_ERROR ADDON_GetStreamTimes(const AddonInstance_PVR* instance,
3568  PVR_STREAM_TIMES* times)
3569  {
3570  PVRStreamTimes cppTimes(times);
3571  return static_cast<CInstancePVRClient*>(instance->toAddon->addonInstance)
3572  ->GetStreamTimes(cppTimes);
3573  }
3575 
3576  AddonInstance_PVR* m_instanceData = nullptr;
3577 };
3578 //}}}
3579 //______________________________________________________________________________
3580 
3581 } /* namespace addon */
3582 } /* namespace kodi */
3583 
3584 #endif /* __cplusplus */
Definition: PVR.h:408
Definition: AddonBase.h:186
Definition: General.h:116
Definition: ChannelGroups.h:38
Definition: ChannelGroups.h:238
Definition: ChannelGroups.h:103
Definition: Channels.h:39
Definition: Channels.h:208
Definition: Stream.h:39
Definition: Channels.h:393
Definition: EPG.h:40
Definition: MenuHook.h:46
Definition: Providers.h:162
Definition: Recordings.h:39
Definition: Recordings.h:512
Definition: Channels.h:253
Definition: Stream.h:262
Definition: Timers.h:39
Definition: Timers.h:487
@ ADDON_LOG_WARNING
2 : To write warnings in the log file.
Definition: addon_base.h:180
@ ADDON_LOG_ERROR
3 : To report error messages in the log file.
Definition: addon_base.h:183
@ ADDON_INSTANCE_PVR
Game instance, see kodi::addon::CInstancePVRClient.
Definition: versions.h:232
Definition: demux_packet.h:46
#define STREAM_MAX_PROPERTY_COUNT
Max number of properties that can be sent to an Inputstream addon.
Definition: stream_constants.h:57
virtual PVR_ERROR GetBackendHostname(std::string &hostname)
Get the hostname of the pvr backend server.
Definition: PVR.h:629
std::string ClientPath() const
Callback to Kodi Function Get main client path of the PVR addon.
Definition: PVR.h:821
void AddMenuHook(const kodi::addon::PVRMenuhook &hook)
Callback to Kodi Function\nAdd or replace a menu hook for the context menu for this add-on
Definition: PVR.h:755
virtual PVR_ERROR GetBackendVersion(std::string &version)=0
Get the version string reported by the backend that will be displayed in the UI.
~CInstancePVRClient() override=default
Destructor.
virtual PVR_ERROR CallSettingsMenuHook(const kodi::addon::PVRMenuhook &menuhook)
Call one of the settings related menu hooks (if supported).
Definition: PVR.h:700
virtual PVR_ERROR GetConnectionString(std::string &connection)
To get the connection string reported by the backend that will be displayed in the UI.
Definition: PVR.h:640
virtual PVR_ERROR GetDriveSpace(uint64_t &total, uint64_t &used)
Get the disk space reported by the backend (if supported).
Definition: PVR.h:667
void ConnectionStateChange(const std::string &connectionString, PVR_CONNECTION_STATE newState, const std::string &message)
Callback to Kodi Function Notify a state change for a PVR backend connection.
Definition: PVR.h:789
CInstancePVRClient(KODI_HANDLE instance, const std::string &kodiVersion="")
PVR client class constructor used to support multiple instance types.
Definition: PVR.h:516
virtual PVR_ERROR GetCapabilities(kodi::addon::PVRCapabilities &capabilities)=0
Get the list of features that this add-on provides.
virtual PVR_ERROR GetBackendName(std::string &name)=0
Get the name reported by the backend that will be displayed in the UI.
std::string UserPath() const
Callback to Kodi Function Get user data path of the PVR addon.
Definition: PVR.h:808
CInstancePVRClient()
PVR client class constructor.
Definition: PVR.h:465
void TriggerProvidersUpdate()
Callback to Kodi Function Request Kodi to update it's list of providers.
Definition: PVR.h:913
virtual PVR_ERROR GetSignalStatus(int channelUid, kodi::addon::PVRSignalStatus &signalStatus)
Get the signal status of the stream that's currently open.
Definition: PVR.h:1067
virtual PVR_ERROR GetChannelStreamProperties(const kodi::addon::PVRChannel &channel, std::vector< kodi::addon::PVRStreamProperty > &properties)
Get the stream properties for a channel from the backend.
Definition: PVR.h:1018
virtual PVR_ERROR GetDescrambleInfo(int channelUid, kodi::addon::PVRDescrambleInfo &descrambleInfo)
Get the descramble information of the stream that's currently open.
Definition: PVR.h:1087
void TriggerChannelUpdate()
Callback to Kodi Function Request Kodi to update it's list of channels.
Definition: PVR.h:1100
virtual PVR_ERROR GetChannels(bool radio, kodi::addon::PVRChannelsResultSet &results)
Request the list of all channels from the backend.
Definition: PVR.h:976
virtual PVR_ERROR GetProviders(kodi::addon::PVRProvidersResultSet &results)
Request the list of all providers from the backend.
Definition: PVR.h:901
virtual PVR_ERROR GetProvidersAmount(int &amount)
The total amount of providers on the backend.
Definition: PVR.h:861
virtual PVR_ERROR GetChannelsAmount(int &amount)
The total amount of channels on the backend.
Definition: PVR.h:927
PVR_CONNECTION_STATE
Definition: pvr_general.h:82
PVR_ERROR
Definition: pvr_general.h:35
@ PVR_ERROR_NOT_IMPLEMENTED
-2 : The method that Kodi called is not implemented by the add-on.
Definition: pvr_general.h:43
@ PVR_ERROR_NO_ERROR
0 : No error occurred.
Definition: pvr_general.h:37
#define PVR_STREAM_MAX_STREAMS
Maximum of allowed streams.
Definition: pvr_stream.h:30
EPG_EVENT_STATE
Definition: pvr_epg.h:602
virtual PVR_ERROR GetEPGForChannel(int channelUid, time_t start, time_t end, kodi::addon::PVREPGTagsResultSet &results)
Request the EPG for a channel from the backend.
Definition: PVR.h:1464
void TriggerEpgUpdate(unsigned int channelUid)
Callback to Kodi Function Schedule an EPG update for the given channel channel.
Definition: PVR.h:1660
virtual PVR_ERROR SetEPGMaxPastDays(int pastDays)
Tell the client the past time frame to use when notifying epg events back to Kodi.
Definition: PVR.h:1584
virtual PVR_ERROR IsEPGTagPlayable(const kodi::addon::PVREPGTag &tag, bool &isPlayable)
Check if the given EPG tag can be played.
Definition: PVR.h:1497
virtual PVR_ERROR SetEPGMaxFutureDays(int futureDays)
Tell the client the future time frame to use when notifying epg events back to Kodi.
Definition: PVR.h:1602
virtual PVR_ERROR GetEPGTagStreamProperties(const kodi::addon::PVREPGTag &tag, std::vector< kodi::addon::PVRStreamProperty > &properties)
Get the stream properties for an epg tag from the backend.
Definition: PVR.h:1562
int EpgMaxPastDays() const
Callback to Kodi Function Get the Max past days handled by Kodi.
Definition: PVR.h:1636
virtual PVR_ERROR CallEPGMenuHook(const kodi::addon::PVRMenuhook &menuhook, const kodi::addon::PVREPGTag &tag)
Call one of the EPG related menu hooks (if supported).
Definition: PVR.h:1619
virtual PVR_ERROR GetEPGTagEdl(const kodi::addon::PVREPGTag &tag, std::vector< kodi::addon::PVREDLEntry > &edl)
Retrieve the edit decision list (EDL) of an EPG tag on the backend.
Definition: PVR.h:1521
virtual PVR_ERROR IsEPGTagRecordable(const kodi::addon::PVREPGTag &tag, bool &isRecordable)
Check if the given EPG tag can be recorded.
Definition: PVR.h:1482
int EpgMaxFutureDays() const
Callback to Kodi Function Get the Max future days handled by Kodi.
Definition: PVR.h:1649
void EpgEventStateChange(kodi::addon::PVREPGTag &tag, EPG_EVENT_STATE newState)
Callback to Kodi Function Notify a state change for an EPG event.
Definition: PVR.h:1698
virtual PVR_ERROR OnPowerSavingDeactivated()
To notify addon power saving on system is deactivated.
Definition: PVR.h:2287
virtual PVR_ERROR OnPowerSavingActivated()
To notify addon power saving on system is activated.
Definition: PVR.h:2279
virtual PVR_ERROR OnSystemSleep()
To notify addon about system sleep.
Definition: PVR.h:2263
virtual PVR_ERROR OnSystemWake()
To notify addon about system wake up.
Definition: PVR.h:2271
virtual PVR_ERROR CallRecordingMenuHook(const kodi::addon::PVRMenuhook &menuhook, const kodi::addon::PVRRecording &item)
Call one of the recording related menu hooks (if supported).
Definition: PVR.h:2015
virtual PVR_ERROR GetRecordings(bool deleted, kodi::addon::PVRRecordingsResultSet &results)
Request the list of all recordings from the backend, if supported.
Definition: PVR.h:1790
virtual PVR_ERROR RenameRecording(const kodi::addon::PVRRecording &recording)
Rename a recording on the backend.
Definition: PVR.h:1844
virtual PVR_ERROR GetRecordingSize(const kodi::addon::PVRRecording &recording, int64_t &size)
Retrieve the size of a recording on the backend.
Definition: PVR.h:1951
virtual PVR_ERROR SetRecordingLastPlayedPosition(const kodi::addon::PVRRecording &recording, int lastplayedposition)
Set the last watched position of a recording on the backend.
Definition: PVR.h:1896
void RecordingNotification(const std::string &recordingName, const std::string &fileName, bool on)
Callback to Kodi Function Display a notification in Kodi that a recording started or stopped on the s...
Definition: PVR.h:2033
virtual PVR_ERROR GetRecordingEdl(const kodi::addon::PVRRecording &recording, std::vector< kodi::addon::PVREDLEntry > &edl)
Retrieve the edit decision list (EDL) of a recording on the backend.
Definition: PVR.h:1934
void TriggerRecordingUpdate()
Callback to Kodi Function Request Kodi to update it's list of recordings.
Definition: PVR.h:2048
virtual PVR_ERROR GetRecordingStreamProperties(const kodi::addon::PVRRecording &recording, std::vector< kodi::addon::PVRStreamProperty > &properties)
Get the stream properties for a recording from the backend.
Definition: PVR.h:1993
virtual PVR_ERROR GetRecordingsAmount(bool deleted, int &amount)
To get amount of recording present on backend.
Definition: PVR.h:1743
virtual PVR_ERROR SetRecordingLifetime(const kodi::addon::PVRRecording &recording)
Set the lifetime of a recording on the backend.
Definition: PVR.h:1862
virtual PVR_ERROR SetRecordingPlayCount(const kodi::addon::PVRRecording &recording, int count)
Set the play count of a recording on the backend.
Definition: PVR.h:1880
virtual PVR_ERROR UndeleteRecording(const kodi::addon::PVRRecording &recording)
Undelete a recording on the backend.
Definition: PVR.h:1820
virtual PVR_ERROR GetRecordingLastPlayedPosition(const kodi::addon::PVRRecording &recording, int &position)
Retrieve the last watched position of a recording on the backend.
Definition: PVR.h:1913
virtual PVR_ERROR DeleteAllRecordingsFromTrash()
Delete all recordings permanent which in the deleted folder on the backend.
Definition: PVR.h:1831
virtual PVR_ERROR DeleteRecording(const kodi::addon::PVRRecording &recording)
Delete a recording on the backend.
Definition: PVR.h:1805
virtual int ReadRecordedStream(unsigned char *buffer, unsigned int size)
Read from a recording.
Definition: PVR.h:2613
virtual bool OpenRecordedStream(const kodi::addon::PVRRecording &recording)
Open a stream to a recording on the backend.
Definition: PVR.h:2591
virtual int64_t LengthRecordedStream()
Obtain the length of a recorded stream.
Definition: PVR.h:2644
virtual void CloseRecordedStream()
Close an open stream from a recording.
Definition: PVR.h:2600
virtual int64_t SeekRecordedStream(int64_t position, int whence)
Seek in a recorded stream.
Definition: PVR.h:2633
virtual PVR_ERROR GetStreamProperties(std::vector< kodi::addon::PVRStreamProperties > &properties)
Get the stream properties of the stream that's currently being read.
Definition: PVR.h:2427
virtual void DemuxReset()
Reset the demultiplexer in the add-on.
Definition: PVR.h:2455
PVRCodec GetCodecByName(const std::string &codecName) const
Callback to Kodi Function Get the codec id used by Kodi.
Definition: PVR.h:2520
void FreeDemuxPacket(DEMUX_PACKET *pPacket)
Callback to Kodi Function Free a packet that was allocated with AllocateDemuxPacket().
Definition: PVR.h:2551
virtual void DemuxAbort()
Abort the demultiplexer thread in the add-on.
Definition: PVR.h:2463
virtual DEMUX_PACKET * DemuxRead()
Read the next packet from the demultiplexer, if there is one.
Definition: PVR.h:2447
virtual void DemuxFlush()
Flush all data that's currently in the demultiplexer buffer in the add-on.
Definition: PVR.h:2472
virtual bool SeekTime(double time, bool backwards, double &startpts)
Notify the pvr addon/demuxer that Kodi wishes to seek the stream by time.
Definition: PVR.h:2508
virtual void SetSpeed(int speed)
Notify the pvr addon/demuxer that Kodi wishes to change playback speed.
Definition: PVR.h:2483
DEMUX_PACKET * AllocateDemuxPacket(int iDataSize)
Callback to Kodi Function Allocate a demux packet. Free with FreeDemuxPacket().
Definition: PVR.h:2536
virtual void FillBuffer(bool mode)
Notify the pvr addon/demuxer that Kodi wishes to fill demux queue.
Definition: PVR.h:2493
virtual void CloseLiveStream()
Close an open live stream.
Definition: PVR.h:2351
virtual bool OpenLiveStream(const kodi::addon::PVRChannel &channel)
Open a live stream on the backend.
Definition: PVR.h:2342
virtual int64_t SeekLiveStream(int64_t position, int whence)
Seek in a live stream on a backend that supports timeshifting.
Definition: PVR.h:2384
virtual int ReadLiveStream(unsigned char *buffer, unsigned int size)
Read from an open live stream.
Definition: PVR.h:2364
virtual int64_t LengthLiveStream()
Obtain the length of a live stream.
Definition: PVR.h:2395
virtual PVR_ERROR GetStreamTimes(kodi::addon::PVRStreamTimes &times)
Get stream times.
Definition: PVR.h:2722
virtual bool CanPauseStream()
Check if the backend support pausing the currently playing stream.
Definition: PVR.h:2679
virtual bool IsRealTimeStream()
Check for real-time streaming.
Definition: PVR.h:2712
virtual void PauseStream(bool paused)
Notify the pvr addon that Kodi (un)paused the currently playing stream.
Definition: PVR.h:2703
virtual PVR_ERROR GetStreamReadChunkSize(int &chunksize)
Obtain the chunk size to use when reading streams.
Definition: PVR.h:2739
virtual bool CanSeekStream()
Check if the backend supports seeking for the currently playing stream.
Definition: PVR.h:2693
void TriggerTimerUpdate()
Callback to Kodi Function Request Kodi to update it's list of timers.
Definition: PVR.h:2231
virtual PVR_ERROR UpdateTimer(const kodi::addon::PVRTimer &timer)
Update the timer information on the backend.
Definition: PVR.h:2197
virtual PVR_ERROR DeleteTimer(const kodi::addon::PVRTimer &timer, bool forceDelete)
Delete a timer on the backend.
Definition: PVR.h:2182
virtual PVR_ERROR CallTimerMenuHook(const kodi::addon::PVRMenuhook &menuhook, const kodi::addon::PVRTimer &item)
Call one of the timer related menu hooks (if supported).
Definition: PVR.h:2218
virtual PVR_ERROR AddTimer(const kodi::addon::PVRTimer &timer)
Add a timer on the backend.
Definition: PVR.h:2165
virtual PVR_ERROR GetTimers(kodi::addon::PVRTimersResultSet &results)
Request the list of all timers from the backend if supported.
Definition: PVR.h:2150
virtual PVR_ERROR GetTimersAmount(int &amount)
To get total amount of timers on the backend or -1 on error.
Definition: PVR.h:2110
virtual PVR_ERROR GetTimerTypes(std::vector< kodi::addon::PVRTimerType > &types)
Retrieve the timer types supported by the backend.
Definition: PVR.h:2095
virtual PVR_ERROR OpenDialogChannelAdd(const kodi::addon::PVRChannel &channel)
Show the dialog to add a channel on the backend, if supported by the backend.
Definition: PVR.h:1350
virtual PVR_ERROR RenameChannel(const kodi::addon::PVRChannel &channel)
Rename a channel on the backend.
Definition: PVR.h:1320
virtual PVR_ERROR OpenDialogChannelScan()
Show the channel scan dialog if this backend supports it.
Definition: PVR.h:1364
virtual PVR_ERROR OpenDialogChannelSettings(const kodi::addon::PVRChannel &channel)
Show the channel settings dialog, if supported by the backend.
Definition: PVR.h:1335
virtual PVR_ERROR DeleteChannel(const kodi::addon::PVRChannel &channel)
Delete a channel from the backend.
Definition: PVR.h:1298
virtual PVR_ERROR CallChannelMenuHook(const kodi::addon::PVRMenuhook &menuhook, const kodi::addon::PVRChannel &item)
Call one of the channel related menu hooks (if supported).
Definition: PVR.h:1381
virtual PVR_ERROR GetChannelGroupMembers(const kodi::addon::PVRChannelGroup &group, kodi::addon::PVRChannelGroupMembersResultSet &results)
Get a list of members on a group.
Definition: PVR.h:1248
virtual PVR_ERROR GetChannelGroupsAmount(int &amount)
Get the total amount of channel groups on the backend if it supports channel groups.
Definition: PVR.h:1137
void TriggerChannelGroupsUpdate()
Callback to Kodi Function Request Kodi to update it's list of channel groups.
Definition: PVR.h:1261
virtual PVR_ERROR GetChannelGroups(bool radio, kodi::addon::PVRChannelGroupsResultSet &results)
Get a list of available channel groups on addon.
Definition: PVR.h:1185
std::string ATTRIBUTE_HIDDEN GetKodiTypeVersion(int type)
To get used version inside Kodi itself about asked type.
Definition: AddonBase.h:630
void ATTRIBUTE_HIDDEN Log(const AddonLog loglevel, const char *format,...)
Add a message to Kodi's log.
Definition: AddonBase.h:749
Definition: pvr.h:333
"C" PVR add-on channel group member.
Definition: pvr_epg.h:623
"C" PVR add-on capabilities.
Definition: pvr_general.h:268
"C" PVR add-on channel group.
Definition: pvr_channel_groups.h:31
"C" PVR add-on channel.
Definition: pvr_channels.h:41
"C" PVR add-on descramble information.
Definition: pvr_channels.h:92
"C" Edit definition list entry.
Definition: pvr_edl.h:55
"C" PVR add-on menu hook.
Definition: pvr_menu_hook.h:65
"C" Representation of a named value.
Definition: pvr_defines.h:57
"C" PVR add-on recording.
Definition: pvr_recordings.h:110
"C" PVR add-on signal status information.
Definition: pvr_channels.h:64
"C" Stream properties
Definition: pvr_stream.h:112
Definition: pvr_stream.h:115
"C" Times of playing stream (Live TV and recordings)
Definition: pvr_stream.h:142
"C" PVR add-on timer event type.
Definition: pvr_timers.h:380
"C" PVR add-on timer event.
Definition: pvr_timers.h:341