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