Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
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
31extern "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
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 PVR_HANDLE handle,
100 const struct PVR_CHANNEL* chan);
101 void (*TransferProviderEntry)(void* kodiInstance,
102 const PVR_HANDLE handle,
103 const struct PVR_PROVIDER* chanProvider);
104 void (*TransferChannelGroup)(void* kodiInstance,
105 const PVR_HANDLE handle,
106 const struct PVR_CHANNEL_GROUP* group);
107 void (*TransferChannelGroupMember)(void* kodiInstance,
108 const PVR_HANDLE handle,
109 const struct PVR_CHANNEL_GROUP_MEMBER* member);
110 void (*TransferEpgEntry)(void* kodiInstance,
111 const PVR_HANDLE handle,
112 const struct EPG_TAG* epgentry);
113 void (*TransferRecordingEntry)(void* kodiInstance,
114 const PVR_HANDLE handle,
115 const struct PVR_RECORDING* recording);
116 void (*TransferTimerEntry)(void* kodiInstance,
117 const PVR_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**);
153 enum PVR_ERROR(__cdecl* GetBackendVersion)(const struct AddonInstance_PVR*, char**);
154 enum PVR_ERROR(__cdecl* GetBackendHostname)(const struct AddonInstance_PVR*, char**);
155 enum PVR_ERROR(__cdecl* GetConnectionString)(const struct AddonInstance_PVR*, char**);
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 enum PVR_ERROR(__cdecl* GetChannelsAmount)(const struct AddonInstance_PVR*, int*);
163 enum PVR_ERROR(__cdecl* GetChannels)(const struct AddonInstance_PVR*, PVR_HANDLE, bool);
164 enum PVR_ERROR(__cdecl* GetChannelStreamProperties)(const struct AddonInstance_PVR*,
165 const struct PVR_CHANNEL*,
166 enum PVR_SOURCE,
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*, PVR_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*, PVR_HANDLE, bool);
186 enum PVR_ERROR(__cdecl* GetChannelGroupMembers)(const struct AddonInstance_PVR*,
187 PVR_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*, PVR_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 unsigned 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*, PVR_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 unsigned 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 unsigned int*);
271 enum PVR_ERROR(__cdecl* GetTimersAmount)(const struct AddonInstance_PVR*, int*);
272 enum PVR_ERROR(__cdecl* GetTimers)(const struct AddonInstance_PVR*, PVR_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*,
300 const struct PVR_RECORDING*,
301 int64_t*);
302 void(__cdecl* CloseRecordedStream)(const struct AddonInstance_PVR*, int64_t);
303 int(__cdecl* ReadRecordedStream)(const struct AddonInstance_PVR*,
304 int64_t,
305 unsigned char*,
306 unsigned int);
307 int64_t(__cdecl* SeekRecordedStream)(const struct AddonInstance_PVR*, int64_t, int64_t, int);
308 int64_t(__cdecl* LengthRecordedStream)(const struct AddonInstance_PVR*, int64_t);
309 PVR_ERROR(__cdecl* IsRecordedStreamRealTime)(const struct AddonInstance_PVR*, int64_t, bool*);
310 PVR_ERROR(__cdecl* PauseRecordedStream)(const struct AddonInstance_PVR*, int64_t, bool);
311 PVR_ERROR(__cdecl* GetRecordedStreamTimes)
312 (const struct AddonInstance_PVR*, int64_t, PVR_STREAM_TIMES*);
313
314 //--==----==----==----==----==----==----==----==----==----==----==----==----==
315 // Stream demux interface functions
316 enum PVR_ERROR(__cdecl* GetStreamProperties)(const struct AddonInstance_PVR*,
317 struct PVR_STREAM_PROPERTIES*);
318 enum PVR_ERROR(__cdecl* StreamClosed)(const struct AddonInstance_PVR*);
319 struct DEMUX_PACKET*(__cdecl* DemuxRead)(const struct AddonInstance_PVR*);
320 void(__cdecl* DemuxReset)(const struct AddonInstance_PVR*);
321 void(__cdecl* DemuxAbort)(const struct AddonInstance_PVR*);
322 void(__cdecl* DemuxFlush)(const struct AddonInstance_PVR*);
323 void(__cdecl* SetSpeed)(const struct AddonInstance_PVR*, int);
324 void(__cdecl* FillBuffer)(const struct AddonInstance_PVR*, bool);
325 bool(__cdecl* SeekTime)(const struct AddonInstance_PVR*, double, bool, double*);
326
327 //--==----==----==----==----==----==----==----==----==----==----==----==----==
328 // General stream interface functions
329 bool(__cdecl* CanPauseStream)(const struct AddonInstance_PVR*);
330 void(__cdecl* PauseStream)(const struct AddonInstance_PVR*, bool);
331 bool(__cdecl* CanSeekStream)(const struct AddonInstance_PVR*);
332 bool(__cdecl* IsRealTimeStream)(const struct AddonInstance_PVR*);
333 enum PVR_ERROR(__cdecl* GetStreamTimes)(const struct AddonInstance_PVR*,
334 struct PVR_STREAM_TIMES*);
335 enum PVR_ERROR(__cdecl* GetStreamReadChunkSize)(const struct AddonInstance_PVR*, int*);
336
337 //--==----==----==----==----==----==----==----==----==----==----==----==----==
338 // Resource deallocation interface functions
339 enum PVR_ERROR(__cdecl* FreeCapabilities)(const struct AddonInstance_PVR*,
340 struct PVR_ADDON_CAPABILITIES*);
341 enum PVR_ERROR(__cdecl* FreeTimerTypes)(const struct AddonInstance_PVR*,
342 struct PVR_TIMER_TYPE**,
343 unsigned int);
344 enum PVR_ERROR(__cdecl* FreeProperties)(const struct AddonInstance_PVR*,
345 struct PVR_NAMED_VALUE**,
346 unsigned int);
347 enum PVR_ERROR(__cdecl* FreeDescrambleInfo)(const struct AddonInstance_PVR*,
348 struct PVR_DESCRAMBLE_INFO*);
349 enum PVR_ERROR(__cdecl* FreeSignalStatus)(const struct AddonInstance_PVR*,
350 struct PVR_SIGNAL_STATUS*);
351 enum PVR_ERROR(__cdecl* FreeEdlEntries)(const struct AddonInstance_PVR*,
352 struct PVR_EDL_ENTRY**,
353 unsigned int);
354 enum PVR_ERROR(__cdecl* FreeString)(const struct AddonInstance_PVR*, char*);
355
356 //--==----==----==----==----==----==----==----==----==----==----==----==----==
357 // New functions becomes added below and can be on another API change (where
358 // breaks min API version) moved up.
360
361 typedef struct AddonInstance_PVR
362 {
363 struct AddonProperties_PVR* props;
364 struct AddonToKodiFuncTable_PVR* toKodi;
365 struct KodiToAddonFuncTable_PVR* toAddon;
367
368#ifdef __cplusplus
369}
370#endif /* __cplusplus */
371
372#endif /* !C_API_ADDONINSTANCE_PVR_H */
Definition demux_packet.h:46
PVR_CONNECTION_STATE
Definition pvr_general.h:83
PVR_ERROR
Definition pvr_general.h:36
PVR_SOURCE
Definition pvr_general.h:127
Definition pvr_stream.h:97
EPG_EVENT_STATE
Definition pvr_epg.h:602
Definition pvr.h:362
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:350
"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:44
"C" PVR add-on provider.
Definition pvr_providers.h:80
"C" PVR add-on recording.
Definition pvr_recordings.h:111
"C" PVR add-on signal status information.
Definition pvr_channels.h:64
"C" Stream properties
Definition pvr_stream.h:115
"C" Times of playing stream (Live TV and recordings)
Definition pvr_stream.h:145
"C" PVR add-on timer type.
Definition pvr_timers.h:379
"C" PVR add-on timer event.
Definition pvr_timers.h:338