Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
versions.h
1/*
2 * Copyright (C) 2016-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#ifndef KODI_VERSIONS_H
12#define KODI_VERSIONS_H
13
14#include <string.h>
15
16#define STR_HELPER(x) #x
17#define STR(x) STR_HELPER(x)
18
19/*
20 *------------------------------------------------------------------------------
21 * Some parts on headers are only be used for Kodi itself and internally (not
22 * for add-on development).
23 *
24 * For this reason also no doxygen part with "///" defined there.
25 * -----------------------------------------------------------------------------
26 */
27
28/*
29 * Versions of all add-on globals and instances are defined below.
30 *
31 * This is added here and not in related header to prevent not
32 * needed includes during compile. Also have it here a better
33 * overview.
34 */
35
36// Ignore clang here, as this must be good in overview and as the main reason,
37// because cmake uses this area in this form to perform its addon dependency
38// check.
39// clang-format off
40#define ADDON_GLOBAL_VERSION_MAIN "2.0.2"
41#define ADDON_GLOBAL_VERSION_MAIN_MIN "2.0.0"
42#define ADDON_GLOBAL_VERSION_MAIN_XML_ID "kodi.binary.global.main"
43#define ADDON_GLOBAL_VERSION_MAIN_DEPENDS "AddonBase.h" \
44 "addon-instance/" \
45 "c-api/addon_base.h"
46
47#define ADDON_GLOBAL_VERSION_GENERAL "1.0.5"
48#define ADDON_GLOBAL_VERSION_GENERAL_MIN "1.0.4"
49#define ADDON_GLOBAL_VERSION_GENERAL_XML_ID "kodi.binary.global.general"
50#define ADDON_GLOBAL_VERSION_GENERAL_DEPENDS "General.h"
51
52#define ADDON_GLOBAL_VERSION_GUI "5.15.1"
53#define ADDON_GLOBAL_VERSION_GUI_MIN "5.15.0"
54#define ADDON_GLOBAL_VERSION_GUI_XML_ID "kodi.binary.global.gui"
55#define ADDON_GLOBAL_VERSION_GUI_DEPENDS "c-api/gui/input/action_ids.h" \
56 "c-api/gui/" \
57 "gui/"
58
59#define ADDON_GLOBAL_VERSION_AUDIOENGINE "1.1.1"
60#define ADDON_GLOBAL_VERSION_AUDIOENGINE_MIN "1.1.0"
61#define ADDON_GLOBAL_VERSION_AUDIOENGINE_XML_ID "kodi.binary.global.audioengine"
62#define ADDON_GLOBAL_VERSION_AUDIOENGINE_DEPENDS "AudioEngine.h" \
63 "c-api/audio_engine.h"
64
65#define ADDON_GLOBAL_VERSION_FILESYSTEM "1.1.9"
66#define ADDON_GLOBAL_VERSION_FILESYSTEM_MIN "1.1.7"
67#define ADDON_GLOBAL_VERSION_FILESYSTEM_XML_ID "kodi.binary.global.filesystem"
68#define ADDON_GLOBAL_VERSION_FILESYSTEM_DEPENDS "Filesystem.h" \
69 "c-api/filesystem.h" \
70 "gui/gl/Shader.h" \
71 "tools/DllHelper.h"
72
73#define ADDON_GLOBAL_VERSION_NETWORK "1.0.4"
74#define ADDON_GLOBAL_VERSION_NETWORK_MIN "1.0.0"
75#define ADDON_GLOBAL_VERSION_NETWORK_XML_ID "kodi.binary.global.network"
76#define ADDON_GLOBAL_VERSION_NETWORK_DEPENDS "Network.h" \
77 "c-api/network.h"
78
79#define ADDON_GLOBAL_VERSION_TOOLS "1.0.4"
80#define ADDON_GLOBAL_VERSION_TOOLS_MIN "1.0.0"
81#define ADDON_GLOBAL_VERSION_TOOLS_XML_ID "kodi.binary.global.tools"
82#define ADDON_GLOBAL_VERSION_TOOLS_DEPENDS "tools/DllHelper.h" \
83 "tools/EndTime.h" \
84 "tools/StringUtils.h" \
85 "tools/Thread.h" \
86 "tools/Timer.h"
87
88#define ADDON_INSTANCE_VERSION_AUDIODECODER "4.0.0"
89#define ADDON_INSTANCE_VERSION_AUDIODECODER_MIN "4.0.0"
90#define ADDON_INSTANCE_VERSION_AUDIODECODER_XML_ID "kodi.binary.instance.audiodecoder"
91#define ADDON_INSTANCE_VERSION_AUDIODECODER_DEPENDS "c-api/addon-instance/audiodecoder.h" \
92 "addon-instance/AudioDecoder.h"
93
94#define ADDON_INSTANCE_VERSION_AUDIOENCODER "3.0.0"
95#define ADDON_INSTANCE_VERSION_AUDIOENCODER_MIN "3.0.0"
96#define ADDON_INSTANCE_VERSION_AUDIOENCODER_XML_ID "kodi.binary.instance.audioencoder"
97#define ADDON_INSTANCE_VERSION_AUDIOENCODER_DEPENDS "c-api/addon-instance/audioencoder.h" \
98 "addon-instance/AudioEncoder.h"
99
100#define ADDON_INSTANCE_VERSION_GAME "3.0.2"
101#define ADDON_INSTANCE_VERSION_GAME_MIN "3.0.0"
102#define ADDON_INSTANCE_VERSION_GAME_XML_ID "kodi.binary.instance.game"
103#define ADDON_INSTANCE_VERSION_GAME_DEPENDS "addon-instance/Game.h"
104
105#define ADDON_INSTANCE_VERSION_IMAGEDECODER "3.0.1"
106#define ADDON_INSTANCE_VERSION_IMAGEDECODER_MIN "3.0.0"
107#define ADDON_INSTANCE_VERSION_IMAGEDECODER_XML_ID "kodi.binary.instance.imagedecoder"
108#define ADDON_INSTANCE_VERSION_IMAGEDECODER_DEPENDS "c-api/addon-instance/imagedecoder.h" \
109 "addon-instance/ImageDecoder.h"
110
111#define ADDON_INSTANCE_VERSION_INPUTSTREAM "3.3.0"
112#define ADDON_INSTANCE_VERSION_INPUTSTREAM_MIN "3.3.0"
113#define ADDON_INSTANCE_VERSION_INPUTSTREAM_XML_ID "kodi.binary.instance.inputstream"
114#define ADDON_INSTANCE_VERSION_INPUTSTREAM_DEPENDS "c-api/addon-instance/inputstream.h" \
115 "c-api/addon-instance/inputstream/demux_packet.h" \
116 "c-api/addon-instance/inputstream/stream_codec.h" \
117 "c-api/addon-instance/inputstream/stream_constants.h" \
118 "c-api/addon-instance/inputstream/stream_crypto.h" \
119 "c-api/addon-instance/inputstream/timing_constants.h" \
120 "addon-instance/Inputstream.h" \
121 "addon-instance/inputstream/DemuxPacket.h" \
122 "addon-instance/inputstream/StreamCodec.h" \
123 "addon-instance/inputstream/StreamConstants.h" \
124 "addon-instance/inputstream/StreamCrypto.h" \
125 "addon-instance/inputstream/TimingConstants.h"
126
127#define ADDON_INSTANCE_VERSION_PERIPHERAL "3.0.2"
128#define ADDON_INSTANCE_VERSION_PERIPHERAL_MIN "3.0.0"
129#define ADDON_INSTANCE_VERSION_PERIPHERAL_XML_ID "kodi.binary.instance.peripheral"
130#define ADDON_INSTANCE_VERSION_PERIPHERAL_DEPENDS "addon-instance/Peripheral.h" \
131 "addon-instance/PeripheralUtils.h"
132
133#define ADDON_INSTANCE_VERSION_PVR "9.2.0"
134#define ADDON_INSTANCE_VERSION_PVR_MIN "9.2.0"
135#define ADDON_INSTANCE_VERSION_PVR_XML_ID "kodi.binary.instance.pvr"
136#define ADDON_INSTANCE_VERSION_PVR_DEPENDS "c-api/addon-instance/pvr.h" \
137 "c-api/addon-instance/pvr/pvr_channel_groups.h" \
138 "c-api/addon-instance/pvr/pvr_channels.h" \
139 "c-api/addon-instance/pvr/pvr_defines.h" \
140 "c-api/addon-instance/pvr/pvr_edl.h" \
141 "c-api/addon-instance/pvr/pvr_epg.h" \
142 "c-api/addon-instance/pvr/pvr_general.h" \
143 "c-api/addon-instance/pvr/pvr_menu_hook.h" \
144 "c-api/addon-instance/pvr/pvr_providers.h" \
145 "c-api/addon-instance/pvr/pvr_recordings.h" \
146 "c-api/addon-instance/pvr/pvr_stream.h" \
147 "c-api/addon-instance/pvr/pvr_timers.h" \
148 "addon-instance/PVR.h" \
149 "addon-instance/pvr/ChannelGroups.h" \
150 "addon-instance/pvr/Channels.h" \
151 "addon-instance/pvr/EDL.h" \
152 "addon-instance/pvr/EPG.h" \
153 "addon-instance/pvr/General.h" \
154 "addon-instance/pvr/MenuHook.h" \
155 "addon-instance/pvr/Providers.h" \
156 "addon-instance/pvr/Recordings.h" \
157 "addon-instance/pvr/Stream.h" \
158 "addon-instance/pvr/Timers.h"
159
160#define ADDON_INSTANCE_VERSION_SCREENSAVER "2.2.0"
161#define ADDON_INSTANCE_VERSION_SCREENSAVER_MIN "2.2.0"
162#define ADDON_INSTANCE_VERSION_SCREENSAVER_XML_ID "kodi.binary.instance.screensaver"
163#define ADDON_INSTANCE_VERSION_SCREENSAVER_DEPENDS "c-api/addon-instance/screensaver.h" \
164 "addon-instance/Screensaver.h"
165
166#define ADDON_INSTANCE_VERSION_VFS "3.0.1"
167#define ADDON_INSTANCE_VERSION_VFS_MIN "3.0.1"
168#define ADDON_INSTANCE_VERSION_VFS_XML_ID "kodi.binary.instance.vfs"
169#define ADDON_INSTANCE_VERSION_VFS_DEPENDS "c-api/addon-instance/vfs.h" \
170 "addon-instance/VFS.h"
171
172#define ADDON_INSTANCE_VERSION_VISUALIZATION "4.0.0"
173#define ADDON_INSTANCE_VERSION_VISUALIZATION_MIN "4.0.0"
174#define ADDON_INSTANCE_VERSION_VISUALIZATION_XML_ID "kodi.binary.instance.visualization"
175#define ADDON_INSTANCE_VERSION_VISUALIZATION_DEPENDS "addon-instance/Visualization.h" \
176 "c-api/addon-instance/visualization.h"
177
178#define ADDON_INSTANCE_VERSION_VIDEOCODEC "2.1.0"
179#define ADDON_INSTANCE_VERSION_VIDEOCODEC_MIN "2.1.0"
180#define ADDON_INSTANCE_VERSION_VIDEOCODEC_XML_ID "kodi.binary.instance.videocodec"
181#define ADDON_INSTANCE_VERSION_VIDEOCODEC_DEPENDS "c-api/addon-instance/video_codec.h" \
182 "c-api/addon-instance/inputstream/stream_codec.h" \
183 "c-api/addon-instance/inputstream/stream_crypto.h" \
184 "addon-instance/VideoCodec.h" \
185 "addon-instance/inputstream/StreamCodec.h" \
186 "addon-instance/inputstream/StreamCrypto.h" \
187// clang-format on
188
189//==============================================================================
202typedef enum ADDON_TYPE
203{
204 /* addon global parts */
205 ADDON_GLOBAL_MAIN = 0,
206 ADDON_GLOBAL_GUI = 1,
207 ADDON_GLOBAL_AUDIOENGINE = 2,
208 ADDON_GLOBAL_GENERAL = 3,
209 ADDON_GLOBAL_NETWORK = 4,
210 ADDON_GLOBAL_FILESYSTEM = 5,
211 ADDON_GLOBAL_TOOLS = 6,
212 // Last used global id, used in loops to check versions.
213 // Need to change if new global type becomes added!
214 ADDON_GLOBAL_MAX = 6,
215
216 /* addon instance types */
217
220
223
226
229
232
235
238
241
244
247
250} ADDON_TYPE;
252//------------------------------------------------------------------------------
253
254#ifdef __cplusplus
255extern "C" {
256namespace kodi {
257namespace addon {
258#endif
259
268inline const char* GetTypeVersion(int type)
269{
270 /*
271 * #ifdef's below becomes set by cmake, no set by hand needed.
272 */
273 switch (type)
274 {
275 /* addon global parts */
276 case ADDON_GLOBAL_MAIN:
277 return ADDON_GLOBAL_VERSION_MAIN;
278#if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_GENERAL_USED)
279 case ADDON_GLOBAL_GENERAL:
280 return ADDON_GLOBAL_VERSION_GENERAL;
281#endif
282#if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_GUI_USED)
283 case ADDON_GLOBAL_GUI:
284 return ADDON_GLOBAL_VERSION_GUI;
285#endif
286#if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_AUDIOENGINE_USED)
287 case ADDON_GLOBAL_AUDIOENGINE:
288 return ADDON_GLOBAL_VERSION_AUDIOENGINE;
289#endif
290#if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_FILESYSTEM_USED)
291 case ADDON_GLOBAL_FILESYSTEM:
292 return ADDON_GLOBAL_VERSION_FILESYSTEM;
293#endif
294#if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_NETWORK_USED)
295 case ADDON_GLOBAL_NETWORK:
296 return ADDON_GLOBAL_VERSION_NETWORK;
297#endif
298#if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_TOOLS_USED)
299 case ADDON_GLOBAL_TOOLS:
300 return ADDON_GLOBAL_VERSION_TOOLS;
301#endif
302
303 /* addon type instances */
304#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_AUDIODECODER_USED)
306 return ADDON_INSTANCE_VERSION_AUDIODECODER;
307#endif
308#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_AUDIOENCODER_USED)
310 return ADDON_INSTANCE_VERSION_AUDIOENCODER;
311#endif
312#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_GAME_USED)
314 return ADDON_INSTANCE_VERSION_GAME;
315#endif
316#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_IMAGEDECODER_USED)
318 return ADDON_INSTANCE_VERSION_IMAGEDECODER;
319#endif
320#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_INPUTSTREAM_USED)
322 return ADDON_INSTANCE_VERSION_INPUTSTREAM;
323#endif
324#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_PERIPHERAL_USED)
326 return ADDON_INSTANCE_VERSION_PERIPHERAL;
327#endif
328#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_PVR_USED)
330 return ADDON_INSTANCE_VERSION_PVR;
331#endif
332#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_SCREENSAVER_USED)
334 return ADDON_INSTANCE_VERSION_SCREENSAVER;
335#endif
336#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_VFS_USED)
338 return ADDON_INSTANCE_VERSION_VFS;
339#endif
340#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_VISUALIZATION_USED)
342 return ADDON_INSTANCE_VERSION_VISUALIZATION;
343#endif
344#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_VIDEOCODEC_USED)
346 return ADDON_INSTANCE_VERSION_VIDEOCODEC;
347#endif
348 }
349 return "0.0.0";
350}
351
360inline const char* GetTypeMinVersion(int type)
361{
362 switch (type)
363 {
364 /* addon global parts */
365 case ADDON_GLOBAL_MAIN:
366 return ADDON_GLOBAL_VERSION_MAIN_MIN;
367 case ADDON_GLOBAL_GUI:
368 return ADDON_GLOBAL_VERSION_GUI_MIN;
369 case ADDON_GLOBAL_GENERAL:
370 return ADDON_GLOBAL_VERSION_GENERAL_MIN;
371 case ADDON_GLOBAL_AUDIOENGINE:
372 return ADDON_GLOBAL_VERSION_AUDIOENGINE_MIN;
373 case ADDON_GLOBAL_FILESYSTEM:
374 return ADDON_GLOBAL_VERSION_FILESYSTEM_MIN;
375 case ADDON_GLOBAL_NETWORK:
376 return ADDON_GLOBAL_VERSION_NETWORK_MIN;
377 case ADDON_GLOBAL_TOOLS:
378 return ADDON_GLOBAL_VERSION_TOOLS_MIN;
379
380 /* addon type instances */
382 return ADDON_INSTANCE_VERSION_AUDIODECODER_MIN;
384 return ADDON_INSTANCE_VERSION_AUDIOENCODER_MIN;
386 return ADDON_INSTANCE_VERSION_GAME_MIN;
388 return ADDON_INSTANCE_VERSION_IMAGEDECODER_MIN;
390 return ADDON_INSTANCE_VERSION_INPUTSTREAM_MIN;
392 return ADDON_INSTANCE_VERSION_PERIPHERAL_MIN;
394 return ADDON_INSTANCE_VERSION_PVR_MIN;
396 return ADDON_INSTANCE_VERSION_SCREENSAVER_MIN;
398 return ADDON_INSTANCE_VERSION_VFS_MIN;
400 return ADDON_INSTANCE_VERSION_VISUALIZATION_MIN;
402 return ADDON_INSTANCE_VERSION_VIDEOCODEC_MIN;
403 }
404 return "0.0.0";
405}
406
414inline const char* GetTypeName(int type)
415{
416 switch (type)
417 {
418 /* addon global parts */
419 case ADDON_GLOBAL_MAIN:
420 return "Addon";
421 case ADDON_GLOBAL_GUI:
422 return "GUI";
423 case ADDON_GLOBAL_GENERAL:
424 return "General";
425 case ADDON_GLOBAL_AUDIOENGINE:
426 return "AudioEngine";
427 case ADDON_GLOBAL_FILESYSTEM:
428 return "Filesystem";
429 case ADDON_GLOBAL_NETWORK:
430 return "Network";
431 case ADDON_GLOBAL_TOOLS:
432 return "Tools";
433
434 /* addon type instances */
436 return "AudioDecoder";
438 return "AudioEncoder";
440 return "Game";
442 return "ImageDecoder";
444 return "Inputstream";
446 return "Peripheral";
448 return "PVR";
450 return "ScreenSaver";
452 return "Visualization";
454 return "VideoCodec";
455 }
456 return "unknown";
457}
458
468inline int GetTypeId(const char* name)
469{
470 if (name)
471 {
472 if (strcmp(name, "addon") == 0)
473 return ADDON_GLOBAL_MAIN;
474 else if (strcmp(name, "general") == 0)
475 return ADDON_GLOBAL_GENERAL;
476 else if (strcmp(name, "gui") == 0)
477 return ADDON_GLOBAL_GUI;
478 else if (strcmp(name, "audioengine") == 0)
479 return ADDON_GLOBAL_AUDIOENGINE;
480 else if (strcmp(name, "filesystem") == 0)
481 return ADDON_GLOBAL_FILESYSTEM;
482 else if (strcmp(name, "network") == 0)
483 return ADDON_GLOBAL_NETWORK;
484 else if (strcmp(name, "tools") == 0)
485 return ADDON_GLOBAL_TOOLS;
486 else if (strcmp(name, "audiodecoder") == 0)
488 else if (strcmp(name, "audioencoder") == 0)
490 else if (strcmp(name, "game") == 0)
491 return ADDON_INSTANCE_GAME;
492 else if (strcmp(name, "imagedecoder") == 0)
494 else if (strcmp(name, "inputstream") == 0)
496 else if (strcmp(name, "peripheral") == 0)
498 else if (strcmp(name, "pvr") == 0)
499 return ADDON_INSTANCE_PVR;
500 else if (strcmp(name, "screensaver") == 0)
502 else if (strcmp(name, "vfs") == 0)
503 return ADDON_INSTANCE_VFS;
504 else if (strcmp(name, "visualization") == 0)
506 else if (strcmp(name, "videocodec") == 0)
508 }
509 return -1;
510}
511
512#ifdef __cplusplus
513} /* namespace addon */
514} /* namespace kodi */
515} /* extern "C" */
516#endif
517
518#endif /* !KODI_VERSIONS_H */
ADDON_TYPE
Definition versions.h:203
@ ADDON_INSTANCE_PVR
PVR client instance, see kodi::addon::CInstancePVRClient.
Definition versions.h:234
@ ADDON_INSTANCE_AUDIODECODER
Audio decoder instance, see kodi::addon::CInstanceAudioDecoder.
Definition versions.h:219
@ ADDON_INSTANCE_VISUALIZATION
Music visualization instance, see kodi::addon::CInstanceVisualization.
Definition versions.h:240
@ ADDON_INSTANCE_AUDIOENCODER
Audio encoder instance, see kodi::addon::CInstanceAudioEncoder.
Definition versions.h:222
@ ADDON_INSTANCE_SCREENSAVER
Screen saver instance, see kodi::addon::CInstanceScreensaver.
Definition versions.h:237
@ ADDON_INSTANCE_VFS
Virtual Filesystem (VFS) instance, see kodi::addon::CInstanceVFS.
Definition versions.h:243
@ ADDON_INSTANCE_INPUTSTREAM
Input stream instance, see kodi::addon::CInstanceInputStream.
Definition versions.h:228
@ ADDON_INSTANCE_VIDEOCODEC
Video codec instance, see kodi::addon::CInstanceVideoCodec.
Definition versions.h:249
@ ADDON_INSTANCE_PERIPHERAL
Peripheral instance, see kodi::addon::CInstancePeripheral.
Definition versions.h:231
@ ADDON_INSTANCE_GAME
Game instance, see kodi::addon::CInstanceGame.
Definition versions.h:225
@ ADDON_INSTANCE_IMAGEDECODER
Image decoder instance, see kodi::addon::CInstanceImageDecoder.
Definition versions.h:246