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 #ifndef C_API_ADDONINSTANCE_PVR_H
10 #define C_API_ADDONINSTANCE_PVR_H
11 
12 #include "../../AddonBase.h"
13 #include "pvr/pvr_channel_groups.h"
14 #include "pvr/pvr_channels.h"
15 #include "pvr/pvr_defines.h"
16 #include "pvr/pvr_edl.h"
17 #include "pvr/pvr_epg.h"
18 #include "pvr/pvr_general.h"
19 #include "pvr/pvr_menu_hook.h"
20 #include "pvr/pvr_providers.h"
21 #include "pvr/pvr_recordings.h"
22 #include "pvr/pvr_stream.h"
23 #include "pvr/pvr_timers.h"
24 
25 //¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
26 // "C" main interface function tables between Kodi and addon
27 //
28 // Values related to all parts and not used direct on addon, are to define here.
29 //
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #endif /* __cplusplus */
34 
60  struct AddonInstance_PVR;
61 
65  typedef struct AddonProperties_PVR
66  {
67  const char* strUserPath;
68  const char* strClientPath;
69  int iEpgMaxFutureDays;
70  int iEpgMaxPastDays;
72 
76  typedef struct AddonToKodiFuncTable_PVR
77  {
78  // Pointer inside Kodi where used from him to find his class
79  KODI_HANDLE kodiInstance;
80 
81  //--==----==----==----==----==----==----==----==----==----==----==----==----==
82  // General callback functions
83  void (*AddMenuHook)(void* kodiInstance, const struct PVR_MENUHOOK* hook);
84  void (*RecordingNotification)(void* kodiInstance,
85  const char* name,
86  const char* fileName,
87  bool on);
88  void (*ConnectionStateChange)(void* kodiInstance,
89  const char* strConnectionString,
90  enum PVR_CONNECTION_STATE newState,
91  const char* strMessage);
92  void (*EpgEventStateChange)(void* kodiInstance,
93  struct EPG_TAG* tag,
94  enum EPG_EVENT_STATE newState);
95 
96  //--==----==----==----==----==----==----==----==----==----==----==----==----==
97  // Transfer functions where give data back to Kodi, e.g. GetChannels calls TransferChannelEntry
98  void (*TransferChannelEntry)(void* kodiInstance,
99  const ADDON_HANDLE handle,
100  const struct PVR_CHANNEL* chan);
101  void (*TransferProviderEntry)(void* kodiInstance,
102  const ADDON_HANDLE handle,
103  const struct PVR_PROVIDER* chanProvider);
104  void (*TransferChannelGroup)(void* kodiInstance,
105  const ADDON_HANDLE handle,
106  const struct PVR_CHANNEL_GROUP* group);
107  void (*TransferChannelGroupMember)(void* kodiInstance,
108  const ADDON_HANDLE handle,
109  const struct PVR_CHANNEL_GROUP_MEMBER* member);
110  void (*TransferEpgEntry)(void* kodiInstance,
111  const ADDON_HANDLE handle,
112  const struct EPG_TAG* epgentry);
113  void (*TransferRecordingEntry)(void* kodiInstance,
114  const ADDON_HANDLE handle,
115  const struct PVR_RECORDING* recording);
116  void (*TransferTimerEntry)(void* kodiInstance,
117  const ADDON_HANDLE handle,
118  const struct PVR_TIMER* timer);
119 
120  //--==----==----==----==----==----==----==----==----==----==----==----==----==
121  // Kodi inform interface functions
122  void (*TriggerChannelUpdate)(void* kodiInstance);
123  void (*TriggerProvidersUpdate)(void* kodiInstance);
124  void (*TriggerChannelGroupsUpdate)(void* kodiInstance);
125  void (*TriggerEpgUpdate)(void* kodiInstance, unsigned int iChannelUid);
126  void (*TriggerRecordingUpdate)(void* kodiInstance);
127  void (*TriggerTimerUpdate)(void* kodiInstance);
128 
129  //--==----==----==----==----==----==----==----==----==----==----==----==----==
130  // Stream demux interface functions
131  void (*FreeDemuxPacket)(void* kodiInstance, struct DEMUX_PACKET* pPacket);
132  struct DEMUX_PACKET* (*AllocateDemuxPacket)(void* kodiInstance, int iDataSize);
133  struct PVR_CODEC (*GetCodecByName)(const void* kodiInstance, const char* strCodecName);
134 
135  //--==----==----==----==----==----==----==----==----==----==----==----==----==
136  // New functions becomes added below and can be on another API change (where
137  // breaks min API version) moved up.
139 
144  {
145  // Pointer inside addon where used on them to find his instance class (currently unused!)
146  KODI_HANDLE addonInstance;
147 
148  //--==----==----==----==----==----==----==----==----==----==----==----==----==
149  // General interface functions
150  enum PVR_ERROR(__cdecl* GetCapabilities)(const struct AddonInstance_PVR*,
151  struct PVR_ADDON_CAPABILITIES*);
152  enum PVR_ERROR(__cdecl* GetBackendName)(const struct AddonInstance_PVR*, char*, int);
153  enum PVR_ERROR(__cdecl* GetBackendVersion)(const struct AddonInstance_PVR*, char*, int);
154  enum PVR_ERROR(__cdecl* GetBackendHostname)(const struct AddonInstance_PVR*, char*, int);
155  enum PVR_ERROR(__cdecl* GetConnectionString)(const struct AddonInstance_PVR*, char*, int);
156  enum PVR_ERROR(__cdecl* GetDriveSpace)(const struct AddonInstance_PVR*, uint64_t*, uint64_t*);
157  enum PVR_ERROR(__cdecl* CallSettingsMenuHook)(const struct AddonInstance_PVR*,
158  const struct PVR_MENUHOOK*);
159 
160  //--==----==----==----==----==----==----==----==----==----==----==----==----==
161  // Channel interface functions
162 
163  enum PVR_ERROR(__cdecl* GetChannelsAmount)(const struct AddonInstance_PVR*, int*);
164  enum PVR_ERROR(__cdecl* GetChannels)(const struct AddonInstance_PVR*, ADDON_HANDLE, bool);
165  enum PVR_ERROR(__cdecl* GetChannelStreamProperties)(const struct AddonInstance_PVR*,
166  const struct PVR_CHANNEL*,
167  struct PVR_NAMED_VALUE*,
168  unsigned int*);
169  enum PVR_ERROR(__cdecl* GetSignalStatus)(const struct AddonInstance_PVR*,
170  int,
171  struct PVR_SIGNAL_STATUS*);
172  enum PVR_ERROR(__cdecl* GetDescrambleInfo)(const struct AddonInstance_PVR*,
173  int,
174  struct PVR_DESCRAMBLE_INFO*);
175 
176  //--==----==----==----==----==----==----==----==----==----==----==----==----==
177  // Provider interface functions
178 
179  enum PVR_ERROR(__cdecl* GetProvidersAmount)(const struct AddonInstance_PVR*, int*);
180  enum PVR_ERROR(__cdecl* GetProviders)(const struct AddonInstance_PVR*, ADDON_HANDLE);
181 
182  //--==----==----==----==----==----==----==----==----==----==----==----==----==
183  // Channel group interface functions
184  enum PVR_ERROR(__cdecl* GetChannelGroupsAmount)(const struct AddonInstance_PVR*, int*);
185  enum PVR_ERROR(__cdecl* GetChannelGroups)(const struct AddonInstance_PVR*, ADDON_HANDLE, bool);
186  enum PVR_ERROR(__cdecl* GetChannelGroupMembers)(const struct AddonInstance_PVR*,
187  ADDON_HANDLE,
188  const struct PVR_CHANNEL_GROUP*);
189 
190  //--==----==----==----==----==----==----==----==----==----==----==----==----==
191  // Channel edit interface functions
192  enum PVR_ERROR(__cdecl* DeleteChannel)(const struct AddonInstance_PVR*,
193  const struct PVR_CHANNEL*);
194  enum PVR_ERROR(__cdecl* RenameChannel)(const struct AddonInstance_PVR*,
195  const struct PVR_CHANNEL*);
196  enum PVR_ERROR(__cdecl* OpenDialogChannelSettings)(const struct AddonInstance_PVR*,
197  const struct PVR_CHANNEL*);
198  enum PVR_ERROR(__cdecl* OpenDialogChannelAdd)(const struct AddonInstance_PVR*,
199  const struct PVR_CHANNEL*);
200  enum PVR_ERROR(__cdecl* OpenDialogChannelScan)(const struct AddonInstance_PVR*);
201  enum PVR_ERROR(__cdecl* CallChannelMenuHook)(const struct AddonInstance_PVR*,
202  const PVR_MENUHOOK*,
203  const PVR_CHANNEL*);
204 
205  //--==----==----==----==----==----==----==----==----==----==----==----==----==
206  // EPG interface functions
207  enum PVR_ERROR(__cdecl* GetEPGForChannel)(
208  const struct AddonInstance_PVR*, ADDON_HANDLE, int, time_t, time_t);
209  enum PVR_ERROR(__cdecl* IsEPGTagRecordable)(const struct AddonInstance_PVR*,
210  const struct EPG_TAG*,
211  bool*);
212  enum PVR_ERROR(__cdecl* IsEPGTagPlayable)(const struct AddonInstance_PVR*,
213  const struct EPG_TAG*,
214  bool*);
215  enum PVR_ERROR(__cdecl* GetEPGTagEdl)(const struct AddonInstance_PVR*,
216  const struct EPG_TAG*,
217  struct PVR_EDL_ENTRY[],
218  int*);
219  enum PVR_ERROR(__cdecl* GetEPGTagStreamProperties)(const struct AddonInstance_PVR*,
220  const struct EPG_TAG*,
221  struct PVR_NAMED_VALUE*,
222  unsigned int*);
223  enum PVR_ERROR(__cdecl* SetEPGMaxPastDays)(const struct AddonInstance_PVR*, int);
224  enum PVR_ERROR(__cdecl* SetEPGMaxFutureDays)(const struct AddonInstance_PVR*, int);
225  enum PVR_ERROR(__cdecl* CallEPGMenuHook)(const struct AddonInstance_PVR*,
226  const struct PVR_MENUHOOK*,
227  const struct EPG_TAG*);
228 
229  //--==----==----==----==----==----==----==----==----==----==----==----==----==
230  // Recording interface functions
231  enum PVR_ERROR(__cdecl* GetRecordingsAmount)(const struct AddonInstance_PVR*, bool, int*);
232  enum PVR_ERROR(__cdecl* GetRecordings)(const struct AddonInstance_PVR*, ADDON_HANDLE, bool);
233  enum PVR_ERROR(__cdecl* DeleteRecording)(const struct AddonInstance_PVR*,
234  const struct PVR_RECORDING*);
235  enum PVR_ERROR(__cdecl* UndeleteRecording)(const struct AddonInstance_PVR*,
236  const struct PVR_RECORDING*);
237  enum PVR_ERROR(__cdecl* DeleteAllRecordingsFromTrash)(const struct AddonInstance_PVR*);
238  enum PVR_ERROR(__cdecl* RenameRecording)(const struct AddonInstance_PVR*,
239  const struct PVR_RECORDING*);
240  enum PVR_ERROR(__cdecl* SetRecordingLifetime)(const struct AddonInstance_PVR*,
241  const struct PVR_RECORDING*);
242  enum PVR_ERROR(__cdecl* SetRecordingPlayCount)(const struct AddonInstance_PVR*,
243  const struct PVR_RECORDING*,
244  int);
245  enum PVR_ERROR(__cdecl* SetRecordingLastPlayedPosition)(const struct AddonInstance_PVR*,
246  const struct PVR_RECORDING*,
247  int);
248  enum PVR_ERROR(__cdecl* GetRecordingLastPlayedPosition)(const struct AddonInstance_PVR*,
249  const struct PVR_RECORDING*,
250  int*);
251  enum PVR_ERROR(__cdecl* GetRecordingEdl)(const struct AddonInstance_PVR*,
252  const struct PVR_RECORDING*,
253  struct PVR_EDL_ENTRY[],
254  int*);
255  enum PVR_ERROR(__cdecl* GetRecordingSize)(const struct AddonInstance_PVR*,
256  const PVR_RECORDING*,
257  int64_t*);
258  enum PVR_ERROR(__cdecl* GetRecordingStreamProperties)(const struct AddonInstance_PVR*,
259  const struct PVR_RECORDING*,
260  struct PVR_NAMED_VALUE*,
261  unsigned int*);
262  enum PVR_ERROR(__cdecl* CallRecordingMenuHook)(const struct AddonInstance_PVR*,
263  const struct PVR_MENUHOOK*,
264  const struct PVR_RECORDING*);
265 
266  //--==----==----==----==----==----==----==----==----==----==----==----==----==
267  // Timer interface functions
268  enum PVR_ERROR(__cdecl* GetTimerTypes)(const struct AddonInstance_PVR*,
269  struct PVR_TIMER_TYPE[],
270  int*);
271  enum PVR_ERROR(__cdecl* GetTimersAmount)(const struct AddonInstance_PVR*, int*);
272  enum PVR_ERROR(__cdecl* GetTimers)(const struct AddonInstance_PVR*, ADDON_HANDLE);
273  enum PVR_ERROR(__cdecl* AddTimer)(const struct AddonInstance_PVR*, const struct PVR_TIMER*);
274  enum PVR_ERROR(__cdecl* DeleteTimer)(const struct AddonInstance_PVR*,
275  const struct PVR_TIMER*,
276  bool);
277  enum PVR_ERROR(__cdecl* UpdateTimer)(const struct AddonInstance_PVR*, const struct PVR_TIMER*);
278  enum PVR_ERROR(__cdecl* CallTimerMenuHook)(const struct AddonInstance_PVR*,
279  const struct PVR_MENUHOOK*,
280  const struct PVR_TIMER*);
281 
282  //--==----==----==----==----==----==----==----==----==----==----==----==----==
283  // Powersaving interface functions
284  enum PVR_ERROR(__cdecl* OnSystemSleep)(const struct AddonInstance_PVR*);
285  enum PVR_ERROR(__cdecl* OnSystemWake)(const struct AddonInstance_PVR*);
286  enum PVR_ERROR(__cdecl* OnPowerSavingActivated)(const struct AddonInstance_PVR*);
287  enum PVR_ERROR(__cdecl* OnPowerSavingDeactivated)(const struct AddonInstance_PVR*);
288 
289  //--==----==----==----==----==----==----==----==----==----==----==----==----==
290  // Live stream read interface functions
291  bool(__cdecl* OpenLiveStream)(const struct AddonInstance_PVR*, const struct PVR_CHANNEL*);
292  void(__cdecl* CloseLiveStream)(const struct AddonInstance_PVR*);
293  int(__cdecl* ReadLiveStream)(const struct AddonInstance_PVR*, unsigned char*, unsigned int);
294  int64_t(__cdecl* SeekLiveStream)(const struct AddonInstance_PVR*, int64_t, int);
295  int64_t(__cdecl* LengthLiveStream)(const struct AddonInstance_PVR*);
296 
297  //--==----==----==----==----==----==----==----==----==----==----==----==----==
298  // Recording stream read interface functions
299  bool(__cdecl* OpenRecordedStream)(const struct AddonInstance_PVR*, const struct PVR_RECORDING*);
300  void(__cdecl* CloseRecordedStream)(const struct AddonInstance_PVR*);
301  int(__cdecl* ReadRecordedStream)(const struct AddonInstance_PVR*, unsigned char*, unsigned int);
302  int64_t(__cdecl* SeekRecordedStream)(const struct AddonInstance_PVR*, int64_t, int);
303  int64_t(__cdecl* LengthRecordedStream)(const struct AddonInstance_PVR*);
304 
305  //--==----==----==----==----==----==----==----==----==----==----==----==----==
306  // Stream demux interface functions
307  enum PVR_ERROR(__cdecl* GetStreamProperties)(const struct AddonInstance_PVR*,
308  struct PVR_STREAM_PROPERTIES*);
309  struct DEMUX_PACKET*(__cdecl* DemuxRead)(const struct AddonInstance_PVR*);
310  void(__cdecl* DemuxReset)(const struct AddonInstance_PVR*);
311  void(__cdecl* DemuxAbort)(const struct AddonInstance_PVR*);
312  void(__cdecl* DemuxFlush)(const struct AddonInstance_PVR*);
313  void(__cdecl* SetSpeed)(const struct AddonInstance_PVR*, int);
314  void(__cdecl* FillBuffer)(const struct AddonInstance_PVR*, bool);
315  bool(__cdecl* SeekTime)(const struct AddonInstance_PVR*, double, bool, double*);
316 
317  //--==----==----==----==----==----==----==----==----==----==----==----==----==
318  // General stream interface functions
319  bool(__cdecl* CanPauseStream)(const struct AddonInstance_PVR*);
320  void(__cdecl* PauseStream)(const struct AddonInstance_PVR*, bool);
321  bool(__cdecl* CanSeekStream)(const struct AddonInstance_PVR*);
322  bool(__cdecl* IsRealTimeStream)(const struct AddonInstance_PVR*);
323  enum PVR_ERROR(__cdecl* GetStreamTimes)(const struct AddonInstance_PVR*,
324  struct PVR_STREAM_TIMES*);
325  enum PVR_ERROR(__cdecl* GetStreamReadChunkSize)(const struct AddonInstance_PVR*, int*);
326 
327  //--==----==----==----==----==----==----==----==----==----==----==----==----==
328  // New functions becomes added below and can be on another API change (where
329  // breaks min API version) moved up.
331 
332  typedef struct AddonInstance_PVR
333  {
334  struct AddonProperties_PVR* props;
335  struct AddonToKodiFuncTable_PVR* toKodi;
336  struct KodiToAddonFuncTable_PVR* toAddon;
338 
339 #ifdef __cplusplus
340 }
341 #endif /* __cplusplus */
342 
343 #endif /* !C_API_ADDONINSTANCE_PVR_H */
Definition: demux_packet.h:46
PVR_CONNECTION_STATE
Definition: pvr_general.h:82
PVR_ERROR
Definition: pvr_general.h:35
Definition: pvr_stream.h:94
EPG_EVENT_STATE
Definition: pvr_epg.h:602
Definition: pvr.h:333
Structure to define typical standard values.
Definition: pvr.h:66
Structure to transfer the methods from Kodi to addon.
Definition: pvr.h:77
"C" PVR add-on channel group member.
Definition: pvr_epg.h:623
Structure to transfer the methods from addon to Kodi.
Definition: pvr.h:144
"C" PVR add-on capabilities.
Definition: pvr_general.h:268
"C" PVR add-on channel group member.
Definition: pvr_channel_groups.h:45
"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 provider.
Definition: pvr_providers.h:80
"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
"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