diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h | 436 |
1 files changed, 436 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h new file mode 100644 index 0000000..fa90f77 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h | |||
| @@ -0,0 +1,436 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2016-2017 Team KODI | ||
| 4 | * http://kodi.tv | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with KODI; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string.h> | ||
| 23 | |||
| 24 | #define STR_HELPER(x) #x | ||
| 25 | #define STR(x) STR_HELPER(x) | ||
| 26 | |||
| 27 | /* | ||
| 28 | *------------------------------------------------------------------------------ | ||
| 29 | * Some parts on headers are only be used for Kodi itself and internally (not | ||
| 30 | * for add-on development). | ||
| 31 | * | ||
| 32 | * For this reason also no doxygen part with "///" defined there. | ||
| 33 | * ----------------------------------------------------------------------------- | ||
| 34 | */ | ||
| 35 | |||
| 36 | /* | ||
| 37 | * Versions of all add-on globals and instances are defined below. | ||
| 38 | * | ||
| 39 | * This is added here and not in related header to prevent not | ||
| 40 | * needed includes during compile. Also have it here a better | ||
| 41 | * overview. | ||
| 42 | */ | ||
| 43 | |||
| 44 | #define ADDON_GLOBAL_VERSION_MAIN "1.0.7" | ||
| 45 | #define ADDON_GLOBAL_VERSION_MAIN_MIN "1.0.2" | ||
| 46 | #define ADDON_GLOBAL_VERSION_MAIN_XML_ID "kodi.binary.global.main" | ||
| 47 | #define ADDON_GLOBAL_VERSION_MAIN_DEPENDS "AddonBase.h" \ | ||
| 48 | "xbmc_addon_dll.h" \ | ||
| 49 | "xbmc_addon_types.h" \ | ||
| 50 | "libXBMC_addon.h" \ | ||
| 51 | "addon-instance/" | ||
| 52 | |||
| 53 | #define ADDON_GLOBAL_VERSION_GENERAL "1.0.0" | ||
| 54 | #define ADDON_GLOBAL_VERSION_GENERAL_MIN "1.0.0" | ||
| 55 | #define ADDON_GLOBAL_VERSION_GENERAL_XML_ID "kodi.binary.global.general" | ||
| 56 | #define ADDON_GLOBAL_VERSION_GENERAL_DEPENDS "General.h" | ||
| 57 | |||
| 58 | #define ADDON_GLOBAL_VERSION_GUI "5.11.0" | ||
| 59 | #define ADDON_GLOBAL_VERSION_GUI_MIN "5.10.0" | ||
| 60 | #define ADDON_GLOBAL_VERSION_GUI_XML_ID "kodi.binary.global.gui" | ||
| 61 | #define ADDON_GLOBAL_VERSION_GUI_DEPENDS "libKODI_guilib.h" | ||
| 62 | |||
| 63 | #define ADDON_GLOBAL_VERSION_AUDIOENGINE "1.0.0" | ||
| 64 | #define ADDON_GLOBAL_VERSION_AUDIOENGINE_MIN "1.0.0" | ||
| 65 | #define ADDON_GLOBAL_VERSION_AUDIOENGINE_XML_ID "kodi.binary.global.audioengine" | ||
| 66 | #define ADDON_GLOBAL_VERSION_AUDIOENGINE_DEPENDS "AudioEngine.h" | ||
| 67 | |||
| 68 | #define ADDON_GLOBAL_VERSION_FILESYSTEM "1.0.0" | ||
| 69 | #define ADDON_GLOBAL_VERSION_FILESYSTEM_MIN "1.0.0" | ||
| 70 | #define ADDON_GLOBAL_VERSION_FILESYSTEM_XML_ID "kodi.binary.global.filesystem" | ||
| 71 | #define ADDON_GLOBAL_VERSION_FILESYSTEM_DEPENDS "Filesystem.h" | ||
| 72 | |||
| 73 | #define ADDON_GLOBAL_VERSION_NETWORK "1.0.0" | ||
| 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 | |||
| 78 | #define ADDON_INSTANCE_VERSION_ADSP "0.1.10" | ||
| 79 | #define ADDON_INSTANCE_VERSION_ADSP_MIN "0.1.10" | ||
| 80 | #define ADDON_INSTANCE_VERSION_ADSP_XML_ID "kodi.binary.instance.adsp" | ||
| 81 | #define ADDON_INSTANCE_VERSION_ADSP_DEPENDS "kodi_adsp_dll.h" \ | ||
| 82 | "kodi_adsp_types.h" \ | ||
| 83 | "libKODI_adsp.h" | ||
| 84 | |||
| 85 | #define ADDON_INSTANCE_VERSION_AUDIODECODER "1.0.1" | ||
| 86 | #define ADDON_INSTANCE_VERSION_AUDIODECODER_MIN "1.0.1" | ||
| 87 | #define ADDON_INSTANCE_VERSION_AUDIODECODER_XML_ID "kodi.binary.instance.audiodecoder" | ||
| 88 | #define ADDON_INSTANCE_VERSION_AUDIODECODER_DEPENDS "kodi_audiodec_dll.h" \ | ||
| 89 | "kodi_audiodec_types.h" | ||
| 90 | |||
| 91 | #define ADDON_INSTANCE_VERSION_AUDIOENCODER "1.0.1" | ||
| 92 | #define ADDON_INSTANCE_VERSION_AUDIOENCODER_MIN "1.0.1" | ||
| 93 | #define ADDON_INSTANCE_VERSION_AUDIOENCODER_XML_ID "kodi.binary.instance.audioencoder" | ||
| 94 | #define ADDON_INSTANCE_VERSION_AUDIOENCODER_DEPENDS "xbmc_audioenc_dll.h" \ | ||
| 95 | "xbmc_audioenc_types.h" | ||
| 96 | |||
| 97 | #define ADDON_INSTANCE_VERSION_GAME "1.0.32" | ||
| 98 | #define ADDON_INSTANCE_VERSION_GAME_MIN "1.0.32" | ||
| 99 | #define ADDON_INSTANCE_VERSION_GAME_XML_ID "kodi.binary.instance.game" | ||
| 100 | #define ADDON_INSTANCE_VERSION_GAME_DEPENDS "kodi_game_dll.h" \ | ||
| 101 | "kodi_game_types.h" \ | ||
| 102 | "libKODI_game.h" | ||
| 103 | |||
| 104 | #define ADDON_INSTANCE_VERSION_IMAGEDECODER "1.0.1" | ||
| 105 | #define ADDON_INSTANCE_VERSION_IMAGEDECODER_MIN "1.0.1" | ||
| 106 | #define ADDON_INSTANCE_VERSION_IMAGEDECODER_XML_ID "kodi.binary.instance.imagedecoder" | ||
| 107 | #define ADDON_INSTANCE_VERSION_IMAGEDECODER_DEPENDS "kodi_imagedec_dll.h" \ | ||
| 108 | "kodi_imagedec_types.h" | ||
| 109 | |||
| 110 | #define ADDON_INSTANCE_VERSION_INPUTSTREAM "1.0.8" | ||
| 111 | #define ADDON_INSTANCE_VERSION_INPUTSTREAM_MIN "1.0.8" | ||
| 112 | #define ADDON_INSTANCE_VERSION_INPUTSTREAM_XML_ID "kodi.binary.instance.inputstream" | ||
| 113 | #define ADDON_INSTANCE_VERSION_INPUTSTREAM_DEPENDS "libKODI_inputstream.h" \ | ||
| 114 | "kodi_inputstream_dll.h" \ | ||
| 115 | "kodi_inputstream_types.h" | ||
| 116 | |||
| 117 | #define ADDON_INSTANCE_VERSION_PERIPHERAL "1.3.3" | ||
| 118 | #define ADDON_INSTANCE_VERSION_PERIPHERAL_MIN "1.3.3" | ||
| 119 | #define ADDON_INSTANCE_VERSION_PERIPHERAL_XML_ID "kodi.binary.instance.peripheral" | ||
| 120 | #define ADDON_INSTANCE_VERSION_PERIPHERAL_DEPENDS "kodi_peripheral_dll.h" \ | ||
| 121 | "kodi_peripheral_types.h" \ | ||
| 122 | "kodi_peripheral_utils.hpp" \ | ||
| 123 | "libKODI_peripheral.h" | ||
| 124 | |||
| 125 | #define ADDON_INSTANCE_VERSION_PVR "5.2.4" | ||
| 126 | #define ADDON_INSTANCE_VERSION_PVR_MIN "5.2.4" | ||
| 127 | #define ADDON_INSTANCE_VERSION_PVR_XML_ID "kodi.binary.instance.pvr" | ||
| 128 | #define ADDON_INSTANCE_VERSION_PVR_DEPENDS "xbmc_pvr_dll.h" \ | ||
| 129 | "xbmc_pvr_types.h" \ | ||
| 130 | "xbmc_epg_types.h" \ | ||
| 131 | "libXBMC_pvr.h" | ||
| 132 | |||
| 133 | #define ADDON_INSTANCE_VERSION_SCREENSAVER "2.0.0" | ||
| 134 | #define ADDON_INSTANCE_VERSION_SCREENSAVER_MIN "2.0.0" | ||
| 135 | #define ADDON_INSTANCE_VERSION_SCREENSAVER_XML_ID "kodi.binary.instance.screensaver" | ||
| 136 | #define ADDON_INSTANCE_VERSION_SCREENSAVER_DEPENDS "addon-instance/Screensaver.h" | ||
| 137 | |||
| 138 | #define ADDON_INSTANCE_VERSION_VFS "1.0.1" | ||
| 139 | #define ADDON_INSTANCE_VERSION_VFS_MIN "1.0.1" | ||
| 140 | #define ADDON_INSTANCE_VERSION_VFS_XML_ID "kodi.binary.instance.vfs" | ||
| 141 | #define ADDON_INSTANCE_VERSION_VFS_DEPENDS "kodi_vfs_dll.h" \ | ||
| 142 | "kodi_vfs_types.h" \ | ||
| 143 | "kodi_vfs_utils.hpp" | ||
| 144 | |||
| 145 | #define ADDON_INSTANCE_VERSION_VISUALIZATION "1.0.1" | ||
| 146 | #define ADDON_INSTANCE_VERSION_VISUALIZATION_MIN "1.0.1" | ||
| 147 | #define ADDON_INSTANCE_VERSION_VISUALIZATION_XML_ID "kodi.binary.instance.visualization" | ||
| 148 | #define ADDON_INSTANCE_VERSION_VISUALIZATION_DEPENDS "xbmc_vis_dll.h" \ | ||
| 149 | "xbmc_vis_types.h" | ||
| 150 | |||
| 151 | /// | ||
| 152 | /// The currently available instance types for Kodi add-ons | ||
| 153 | /// | ||
| 154 | /// \internal | ||
| 155 | /// @note For add of new types take a new number on end. To change | ||
| 156 | /// existing numbers can be make problems on already compiled add-ons. | ||
| 157 | /// \endinternal | ||
| 158 | /// | ||
| 159 | typedef enum ADDON_TYPE | ||
| 160 | { | ||
| 161 | /* addon global parts */ | ||
| 162 | ADDON_GLOBAL_MAIN = 0, | ||
| 163 | ADDON_GLOBAL_GUI = 1, | ||
| 164 | ADDON_GLOBAL_AUDIOENGINE = 2, | ||
| 165 | ADDON_GLOBAL_GENERAL = 3, | ||
| 166 | ADDON_GLOBAL_NETWORK = 4, | ||
| 167 | ADDON_GLOBAL_FILESYSTEM = 5, | ||
| 168 | ADDON_GLOBAL_MAX = 5, // Last used global id, used in loops to check versions. Need to change if new global type becomes added. | ||
| 169 | |||
| 170 | /* addon type instances */ | ||
| 171 | ADDON_INSTANCE_ADSP = 101, | ||
| 172 | ADDON_INSTANCE_AUDIODECODER = 102, | ||
| 173 | ADDON_INSTANCE_AUDIOENCODER = 103, | ||
| 174 | ADDON_INSTANCE_GAME = 104, | ||
| 175 | ADDON_INSTANCE_INPUTSTREAM = 105, | ||
| 176 | ADDON_INSTANCE_PERIPHERAL = 106, | ||
| 177 | ADDON_INSTANCE_PVR = 107, | ||
| 178 | ADDON_INSTANCE_SCREENSAVER = 108, | ||
| 179 | ADDON_INSTANCE_VISUALIZATION = 109, | ||
| 180 | ADDON_INSTANCE_VFS = 110, | ||
| 181 | ADDON_INSTANCE_IMAGEDECODER = 111, | ||
| 182 | } ADDON_TYPE; | ||
| 183 | |||
| 184 | #ifdef __cplusplus | ||
| 185 | extern "C" { | ||
| 186 | namespace kodi { | ||
| 187 | namespace addon { | ||
| 188 | #endif | ||
| 189 | |||
| 190 | /// | ||
| 191 | /// This is used from Kodi to get the active version of add-on parts. | ||
| 192 | /// It is compiled in add-on and also in Kodi itself, with this can be Kodi | ||
| 193 | /// compare the version from him with them on add-on. | ||
| 194 | /// | ||
| 195 | /// @param[in] type The with 'enum ADDON_TYPE' type to ask | ||
| 196 | /// @return version The current version of asked type | ||
| 197 | /// | ||
| 198 | inline const char* GetTypeVersion(int type) | ||
| 199 | { | ||
| 200 | /* | ||
| 201 | * #ifdef's below becomes set by cmake, no set by hand needed. | ||
| 202 | */ | ||
| 203 | switch (type) | ||
| 204 | { | ||
| 205 | /* addon global parts */ | ||
| 206 | case ADDON_GLOBAL_MAIN: | ||
| 207 | return ADDON_GLOBAL_VERSION_MAIN; | ||
| 208 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_GENERAL_USED) | ||
| 209 | case ADDON_GLOBAL_GENERAL: | ||
| 210 | return ADDON_GLOBAL_VERSION_GENERAL; | ||
| 211 | #endif | ||
| 212 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_GUI_USED) | ||
| 213 | case ADDON_GLOBAL_GUI: | ||
| 214 | return ADDON_GLOBAL_VERSION_GUI; | ||
| 215 | #endif | ||
| 216 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_AUDIOENGINE_USED) | ||
| 217 | case ADDON_GLOBAL_AUDIOENGINE: | ||
| 218 | return ADDON_GLOBAL_VERSION_AUDIOENGINE; | ||
| 219 | #endif | ||
| 220 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_FILESYSTEM_USED) | ||
| 221 | case ADDON_GLOBAL_FILESYSTEM: | ||
| 222 | return ADDON_GLOBAL_VERSION_FILESYSTEM; | ||
| 223 | #endif | ||
| 224 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_GLOBAL_VERSION_NETWORK_USED) | ||
| 225 | case ADDON_GLOBAL_NETWORK: | ||
| 226 | return ADDON_GLOBAL_VERSION_NETWORK; | ||
| 227 | #endif | ||
| 228 | |||
| 229 | /* addon type instances */ | ||
| 230 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_ADSP_USED) | ||
| 231 | case ADDON_INSTANCE_ADSP: | ||
| 232 | return ADDON_INSTANCE_VERSION_ADSP; | ||
| 233 | #endif | ||
| 234 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_AUDIODECODER_USED) | ||
| 235 | case ADDON_INSTANCE_AUDIODECODER: | ||
| 236 | return ADDON_INSTANCE_VERSION_AUDIODECODER; | ||
| 237 | #endif | ||
| 238 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_AUDIOENCODER_USED) | ||
| 239 | case ADDON_INSTANCE_AUDIOENCODER: | ||
| 240 | return ADDON_INSTANCE_VERSION_AUDIOENCODER; | ||
| 241 | #endif | ||
| 242 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_GAME_USED) | ||
| 243 | case ADDON_INSTANCE_GAME: | ||
| 244 | return ADDON_INSTANCE_VERSION_GAME; | ||
| 245 | #endif | ||
| 246 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_IMAGEDECODER_USED) | ||
| 247 | case ADDON_INSTANCE_IMAGEDECODER: | ||
| 248 | return ADDON_INSTANCE_VERSION_IMAGEDECODER; | ||
| 249 | #endif | ||
| 250 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_INPUTSTREAM_USED) | ||
| 251 | case ADDON_INSTANCE_INPUTSTREAM: | ||
| 252 | return ADDON_INSTANCE_VERSION_INPUTSTREAM; | ||
| 253 | #endif | ||
| 254 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_PERIPHERAL_USED) | ||
| 255 | case ADDON_INSTANCE_PERIPHERAL: | ||
| 256 | return ADDON_INSTANCE_VERSION_PERIPHERAL; | ||
| 257 | #endif | ||
| 258 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_PVR_USED) | ||
| 259 | case ADDON_INSTANCE_PVR: | ||
| 260 | return ADDON_INSTANCE_VERSION_PVR; | ||
| 261 | #endif | ||
| 262 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_SCREENSAVER_USED) | ||
| 263 | case ADDON_INSTANCE_SCREENSAVER: | ||
| 264 | return ADDON_INSTANCE_VERSION_SCREENSAVER; | ||
| 265 | #endif | ||
| 266 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_VFS_USED) | ||
| 267 | case ADDON_INSTANCE_VFS: | ||
| 268 | return ADDON_INSTANCE_VERSION_VFS; | ||
| 269 | #endif | ||
| 270 | #if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_VISUALIZATION_USED) | ||
| 271 | case ADDON_INSTANCE_VISUALIZATION: | ||
| 272 | return ADDON_INSTANCE_VERSION_VISUALIZATION; | ||
| 273 | #endif | ||
| 274 | } | ||
| 275 | return "0.0.0"; | ||
| 276 | } | ||
| 277 | |||
| 278 | /// | ||
| 279 | /// This is used from Kodi to get the minimum supported version of add-on parts. | ||
| 280 | /// It is compiled in add-on and also in Kodi itself, with this can be Kodi | ||
| 281 | /// compare the version from him with them on add-on. | ||
| 282 | /// | ||
| 283 | /// @param[in] type The with 'enum ADDON_TYPE' type to ask | ||
| 284 | /// @return version The minimum version of asked type | ||
| 285 | /// | ||
| 286 | inline const char* GetTypeMinVersion(int type) | ||
| 287 | { | ||
| 288 | switch (type) | ||
| 289 | { | ||
| 290 | /* addon global parts */ | ||
| 291 | case ADDON_GLOBAL_MAIN: | ||
| 292 | return ADDON_GLOBAL_VERSION_MAIN_MIN; | ||
| 293 | case ADDON_GLOBAL_GUI: | ||
| 294 | return ADDON_GLOBAL_VERSION_GUI_MIN; | ||
| 295 | case ADDON_GLOBAL_GENERAL: | ||
| 296 | return ADDON_GLOBAL_VERSION_GENERAL_MIN; | ||
| 297 | case ADDON_GLOBAL_AUDIOENGINE: | ||
| 298 | return ADDON_GLOBAL_VERSION_AUDIOENGINE_MIN; | ||
| 299 | case ADDON_GLOBAL_FILESYSTEM: | ||
| 300 | return ADDON_GLOBAL_VERSION_FILESYSTEM_MIN; | ||
| 301 | case ADDON_GLOBAL_NETWORK: | ||
| 302 | return ADDON_GLOBAL_VERSION_NETWORK_MIN; | ||
| 303 | |||
| 304 | /* addon type instances */ | ||
| 305 | case ADDON_INSTANCE_ADSP: | ||
| 306 | return ADDON_INSTANCE_VERSION_ADSP_MIN; | ||
| 307 | case ADDON_INSTANCE_AUDIODECODER: | ||
| 308 | return ADDON_INSTANCE_VERSION_AUDIODECODER_MIN; | ||
| 309 | case ADDON_INSTANCE_AUDIOENCODER: | ||
| 310 | return ADDON_INSTANCE_VERSION_AUDIOENCODER_MIN; | ||
| 311 | case ADDON_INSTANCE_GAME: | ||
| 312 | return ADDON_INSTANCE_VERSION_GAME_MIN; | ||
| 313 | case ADDON_INSTANCE_IMAGEDECODER: | ||
| 314 | return ADDON_INSTANCE_VERSION_IMAGEDECODER_MIN; | ||
| 315 | case ADDON_INSTANCE_INPUTSTREAM: | ||
| 316 | return ADDON_INSTANCE_VERSION_INPUTSTREAM_MIN; | ||
| 317 | case ADDON_INSTANCE_PERIPHERAL: | ||
| 318 | return ADDON_INSTANCE_VERSION_PERIPHERAL_MIN; | ||
| 319 | case ADDON_INSTANCE_PVR: | ||
| 320 | return ADDON_INSTANCE_VERSION_PVR_MIN; | ||
| 321 | case ADDON_INSTANCE_SCREENSAVER: | ||
| 322 | return ADDON_INSTANCE_VERSION_SCREENSAVER_MIN; | ||
| 323 | case ADDON_INSTANCE_VFS: | ||
| 324 | return ADDON_INSTANCE_VERSION_VFS_MIN; | ||
| 325 | case ADDON_INSTANCE_VISUALIZATION: | ||
| 326 | return ADDON_INSTANCE_VERSION_VISUALIZATION_MIN; | ||
| 327 | } | ||
| 328 | return "0.0.0"; | ||
| 329 | } | ||
| 330 | |||
| 331 | /// | ||
| 332 | /// Function used internally on add-on and in Kodi itself to get name | ||
| 333 | /// about given type. | ||
| 334 | /// | ||
| 335 | /// @param[in] type The with 'enum ADDON_TYPE' defined type to ask | ||
| 336 | /// @return Name of the asked instance type | ||
| 337 | /// | ||
| 338 | inline const char* GetTypeName(int type) | ||
| 339 | { | ||
| 340 | switch (type) | ||
| 341 | { | ||
| 342 | /* addon global parts */ | ||
| 343 | case ADDON_GLOBAL_MAIN: | ||
| 344 | return "Addon"; | ||
| 345 | case ADDON_GLOBAL_GUI: | ||
| 346 | return "GUI"; | ||
| 347 | case ADDON_GLOBAL_GENERAL: | ||
| 348 | return "General"; | ||
| 349 | case ADDON_GLOBAL_AUDIOENGINE: | ||
| 350 | return "AudioEngine"; | ||
| 351 | case ADDON_GLOBAL_FILESYSTEM: | ||
| 352 | return "Filesystem"; | ||
| 353 | case ADDON_GLOBAL_NETWORK: | ||
| 354 | return "Network"; | ||
| 355 | |||
| 356 | /* addon type instances */ | ||
| 357 | case ADDON_INSTANCE_ADSP: | ||
| 358 | return "ADSP"; | ||
| 359 | case ADDON_INSTANCE_AUDIODECODER: | ||
| 360 | return "AudioDecoder"; | ||
| 361 | case ADDON_INSTANCE_AUDIOENCODER: | ||
| 362 | return "AudioEncoder"; | ||
| 363 | case ADDON_INSTANCE_GAME: | ||
| 364 | return "Game"; | ||
| 365 | case ADDON_INSTANCE_IMAGEDECODER: | ||
| 366 | return "ImageDecoder"; | ||
| 367 | case ADDON_INSTANCE_INPUTSTREAM: | ||
| 368 | return "Inputstream"; | ||
| 369 | case ADDON_INSTANCE_PERIPHERAL: | ||
| 370 | return "Peripheral"; | ||
| 371 | case ADDON_INSTANCE_PVR: | ||
| 372 | return "PVR"; | ||
| 373 | case ADDON_INSTANCE_SCREENSAVER: | ||
| 374 | return "ScreenSaver"; | ||
| 375 | case ADDON_INSTANCE_VISUALIZATION: | ||
| 376 | return "Visualization"; | ||
| 377 | } | ||
| 378 | return "unknown"; | ||
| 379 | } | ||
| 380 | |||
| 381 | /// | ||
| 382 | /// Function used internally on add-on and in Kodi itself to get id number | ||
| 383 | /// about given type name. | ||
| 384 | /// | ||
| 385 | /// @param[in] name The type name string to ask | ||
| 386 | /// @return Id number of the asked instance type | ||
| 387 | /// | ||
| 388 | /// @warning String must be lower case here! | ||
| 389 | /// | ||
| 390 | inline int GetTypeId(const char* name) | ||
| 391 | { | ||
| 392 | if (name) | ||
| 393 | { | ||
| 394 | if (strcmp(name, "addon") == 0) | ||
| 395 | return ADDON_GLOBAL_MAIN; | ||
| 396 | else if (strcmp(name, "general") == 0) | ||
| 397 | return ADDON_GLOBAL_GENERAL; | ||
| 398 | else if (strcmp(name, "gui") == 0) | ||
| 399 | return ADDON_GLOBAL_GUI; | ||
| 400 | else if (strcmp(name, "audioengine") == 0) | ||
| 401 | return ADDON_GLOBAL_AUDIOENGINE; | ||
| 402 | else if (strcmp(name, "filesystem") == 0) | ||
| 403 | return ADDON_GLOBAL_FILESYSTEM; | ||
| 404 | else if (strcmp(name, "network") == 0) | ||
| 405 | return ADDON_GLOBAL_NETWORK; | ||
| 406 | else if (strcmp(name, "adsp") == 0) | ||
| 407 | return ADDON_INSTANCE_ADSP; | ||
| 408 | else if (strcmp(name, "audiodecoder") == 0) | ||
| 409 | return ADDON_INSTANCE_AUDIODECODER; | ||
| 410 | else if (strcmp(name, "audioencoder") == 0) | ||
| 411 | return ADDON_INSTANCE_AUDIOENCODER; | ||
| 412 | else if (strcmp(name, "game") == 0) | ||
| 413 | return ADDON_INSTANCE_GAME; | ||
| 414 | else if (strcmp(name, "imagedecoder") == 0) | ||
| 415 | return ADDON_INSTANCE_IMAGEDECODER; | ||
| 416 | else if (strcmp(name, "inputstream") == 0) | ||
| 417 | return ADDON_INSTANCE_INPUTSTREAM; | ||
| 418 | else if (strcmp(name, "peripheral") == 0) | ||
| 419 | return ADDON_INSTANCE_PERIPHERAL; | ||
| 420 | else if (strcmp(name, "pvr") == 0) | ||
| 421 | return ADDON_INSTANCE_PVR; | ||
| 422 | else if (strcmp(name, "screensaver") == 0) | ||
| 423 | return ADDON_INSTANCE_SCREENSAVER; | ||
| 424 | else if (strcmp(name, "vfs") == 0) | ||
| 425 | return ADDON_INSTANCE_VFS; | ||
| 426 | else if (strcmp(name, "visualization") == 0) | ||
| 427 | return ADDON_INSTANCE_VISUALIZATION; | ||
| 428 | } | ||
| 429 | return -1; | ||
| 430 | } | ||
| 431 | |||
| 432 | #ifdef __cplusplus | ||
| 433 | } /* namespace addon */ | ||
| 434 | } /* namespace kodi */ | ||
| 435 | } /* extern "C" */ | ||
| 436 | #endif | ||
