diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi')
28 files changed, 7086 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h new file mode 100644 index 0000000..c1d8238 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h | |||
| @@ -0,0 +1,564 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | /*! | ||
| 24 | * @file kodi_adsp_dll.h | ||
| 25 | * @section sec1 Basic audio dsp addon interface description | ||
| 26 | * @author Team Kodi | ||
| 27 | * @date 10. May 2014 | ||
| 28 | * @version 0.1.5 | ||
| 29 | * | ||
| 30 | * @subsection sec1_1 General | ||
| 31 | * @li The basic support on the addon is supplied with the | ||
| 32 | * AE_DSP_ADDON_CAPABILITIES data which becomes asked over | ||
| 33 | * GetAddonCapabilities(...), further the addon must register his available | ||
| 34 | * modes on startup with the RegisterMode(...) callback function (see | ||
| 35 | * libKODI_adsp.h). If one of this two points is not set the addon becomes | ||
| 36 | * ignored for the chain step. | ||
| 37 | * | ||
| 38 | * @subsection sec1_2 Processing | ||
| 39 | * @li On start of new stream the addon becomes called with StreamCreate(...) | ||
| 40 | * to check about given values that it support it basically and can create | ||
| 41 | * his structure, if nothing is supported it can return AE_DSP_ERROR_IGNORE_ME. | ||
| 42 | * | ||
| 43 | * @li As next step StreamIsModeSupported(...) becomes called for every | ||
| 44 | * available and enabled modes, is separated due to more as one available mode | ||
| 45 | * on the addon is possible, if the mode is not supported it can also be return | ||
| 46 | * AE_DSP_ERROR_IGNORE_ME. | ||
| 47 | * - If mode is a resample mode and returns no error it becomes asked with | ||
| 48 | * InputResampleSampleRate(...) or OutputResampleSampleRate(...) (relevant | ||
| 49 | * to his type) about his given sample rate. | ||
| 50 | * - About the from user selected master processing mode the related addon | ||
| 51 | * becomes called now with MasterProcessSetMode(...) to handle it's | ||
| 52 | * selectionon the addon given by the own addon type identifier or by | ||
| 53 | * KODI's useddatabase id, also the currently used stream type (e.g. | ||
| 54 | * Music or Video) is send. | ||
| 55 | * - If the addon supports only one master mode it can ignore this function | ||
| 56 | * and return always AE_DSP_ERROR_NO_ERROR. | ||
| 57 | * - If the master mode is set the addon becomes asked about the from him | ||
| 58 | * given output channel layout related to up- or downmix modes, if | ||
| 59 | * nothing becomes changed on the layout it can return -1. | ||
| 60 | * - The MasterProcessSetMode(...) is also called if from user a another | ||
| 61 | * mode becomes selected. | ||
| 62 | * | ||
| 63 | * @li Then as last step shortly before the first process call becomes executed | ||
| 64 | * the addon is called one time with StreamInitialize(...) to inform that | ||
| 65 | * processing is started on the given settings. | ||
| 66 | * - This function becomes also called on all add-ons if the master process | ||
| 67 | * becomes changed. | ||
| 68 | * - Also every process after StreamInitialize on the addon mode becomes asked | ||
| 69 | * with _..._ProcessNeededSamplesize(...) about required memory size for the | ||
| 70 | * output of his data, if no other size is required it can return 0. | ||
| 71 | * | ||
| 72 | * @li From now the processing becomes handled for the different steps with | ||
| 73 | * _..._Process(...). | ||
| 74 | * - Further it becomes asked with _..._GetDelay(...) about his processing | ||
| 75 | * time as float value in seconds, needed for video and audio alignment. | ||
| 76 | * | ||
| 77 | * @li On the end of the processing if the source becomes stopped the | ||
| 78 | * StreamDestroy(...) function becomes called on all active processing add-ons. | ||
| 79 | * | ||
| 80 | * @note | ||
| 81 | * The StreamCreate(...) can be becomes called for a new stream before the | ||
| 82 | * previous was closed with StreamDestroy(...) ! To have a speed improve. | ||
| 83 | */ | ||
| 84 | |||
| 85 | #include "xbmc_addon_dll.h" | ||
| 86 | #include "kodi_adsp_types.h" | ||
| 87 | |||
| 88 | /*! | ||
| 89 | * Functions that the Audio DSP add-on must implement, but some can be empty. | ||
| 90 | * | ||
| 91 | * The 'remarks' field indicates which methods should be implemented, and which | ||
| 92 | * ones are optional. | ||
| 93 | */ | ||
| 94 | |||
| 95 | extern "C" | ||
| 96 | { | ||
| 97 | /*! @name Audio DSP add-on methods */ | ||
| 98 | //@{ | ||
| 99 | /*! | ||
| 100 | * Get the KODI_AE_DSP_API_VERSION that was used to compile this add-on. | ||
| 101 | * Used to check if this add-on is compatible with KODI. | ||
| 102 | * @return The KODI_AE_DSP_API_VERSION that was used to compile this add-on. | ||
| 103 | * @remarks Valid implementation required. | ||
| 104 | */ | ||
| 105 | const char* GetAudioDSPAPIVersion(void); | ||
| 106 | |||
| 107 | /*! | ||
| 108 | * Get the KODI_AE_DSP_MIN_API_VERSION that was used to compile this add-on. | ||
| 109 | * Used to check if this add-on is compatible with KODI. | ||
| 110 | * @return The KODI_AE_DSP_MIN_API_VERSION that was used to compile this add-on. | ||
| 111 | * @remarks Valid implementation required. | ||
| 112 | */ | ||
| 113 | const char* GetMinimumAudioDSPAPIVersion(void); | ||
| 114 | |||
| 115 | /*! | ||
| 116 | * @brief Get the KODI_GUI_API_VERSION that was used to compile this add-on. | ||
| 117 | * Used to check if this add-on is compatible with KODI. | ||
| 118 | * @return The KODI_GUI_API_VERSION that was used to compile this add-on. | ||
| 119 | * @remarks Valid implementation required. | ||
| 120 | */ | ||
| 121 | const char* GetGUIAPIVersion(void); | ||
| 122 | |||
| 123 | /*! | ||
| 124 | * @brief Get the KODI_GUI_MIN_API_VERSION that was used to compile this | ||
| 125 | * add-on. | ||
| 126 | * Used to check if this add-on is compatible with KODI. | ||
| 127 | * @return The KODI_GUI_MIN_API_VERSION that was used to compile this add-on. | ||
| 128 | * @remarks Valid implementation required. | ||
| 129 | */ | ||
| 130 | const char* GetMinimumGUIAPIVersion(void); | ||
| 131 | |||
| 132 | /*! | ||
| 133 | * @brief Get the list of features that this add-on provides. | ||
| 134 | * Called by KODI to query the add-ons capabilities. | ||
| 135 | * Used to check which options should be presented in the DSP, which methods | ||
| 136 | * to call, etc. | ||
| 137 | * All capabilities that the add-on supports should be set to true. | ||
| 138 | * @param pCapabilities The add-ons capabilities. | ||
| 139 | * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully. | ||
| 140 | * @remarks Valid implementation required. | ||
| 141 | */ | ||
| 142 | AE_DSP_ERROR GetAddonCapabilities(AE_DSP_ADDON_CAPABILITIES *pCapabilities); | ||
| 143 | |||
| 144 | /*! | ||
| 145 | * @return The name reported by the back end that will be displayed in the | ||
| 146 | * UI. | ||
| 147 | * @remarks Valid implementation required. | ||
| 148 | */ | ||
| 149 | const char* GetDSPName(void); | ||
| 150 | |||
| 151 | /*! | ||
| 152 | * @return The version string reported by the back end that will be displayed | ||
| 153 | * in the UI. | ||
| 154 | * @remarks Valid implementation required. | ||
| 155 | */ | ||
| 156 | const char* GetDSPVersion(void); | ||
| 157 | |||
| 158 | /*! | ||
| 159 | * @brief Call one of the menu hooks (if supported). | ||
| 160 | * Supported AE_DSP_MENUHOOK instances have to be added in ADDON_Create(), | ||
| 161 | * by calling AddMenuHook() on the callback. | ||
| 162 | * @param menuhook The hook to call. | ||
| 163 | * @param item The selected item for which the hook was called. | ||
| 164 | * @return AE_DSP_ERROR_NO_ERROR if the hook was called successfully. | ||
| 165 | * @remarks Optional. Return AE_DSP_ERROR_NOT_IMPLEMENTED if this add-on | ||
| 166 | * won't provide this function. | ||
| 167 | */ | ||
| 168 | AE_DSP_ERROR CallMenuHook(const AE_DSP_MENUHOOK& menuhook, const AE_DSP_MENUHOOK_DATA &item); | ||
| 169 | //@} | ||
| 170 | |||
| 171 | /** @name DSP processing control, used to open and close a stream | ||
| 172 | * @remarks Valid implementation required. | ||
| 173 | */ | ||
| 174 | //@{ | ||
| 175 | /*! | ||
| 176 | * @brief Set up Audio DSP with selected audio settings (use the basic | ||
| 177 | * present audio stream data format). | ||
| 178 | * Used to detect available add-ons for present stream, as example stereo | ||
| 179 | * surround upmix not needed on 5.1 audio stream. | ||
| 180 | * @param addonSettings The add-ons audio settings. | ||
| 181 | * @param pProperties The properties of the currently playing stream. | ||
| 182 | * @param handle On this becomes addon informated about stream id and can set function addresses which need on calls | ||
| 183 | * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully | ||
| 184 | * and data can be performed. AE_DSP_ERROR_IGNORE_ME if format is not | ||
| 185 | * supported, but without fault. | ||
| 186 | * @remarks Valid implementation required. | ||
| 187 | */ | ||
| 188 | AE_DSP_ERROR StreamCreate(const AE_DSP_SETTINGS *addonSettings, const AE_DSP_STREAM_PROPERTIES* pProperties, ADDON_HANDLE handle); | ||
| 189 | |||
| 190 | /*! | ||
| 191 | * Remove the selected id from currently used DSP processes | ||
| 192 | * @param handle identification data for stream | ||
| 193 | * @return AE_DSP_ERROR_NO_ERROR if the becomes found and removed | ||
| 194 | * @remarks Valid implementation required. | ||
| 195 | */ | ||
| 196 | AE_DSP_ERROR StreamDestroy(const ADDON_HANDLE handle); | ||
| 197 | |||
| 198 | /*! | ||
| 199 | * @brief Ask the add-on about a requested processing mode that it is | ||
| 200 | * supported on the current stream. Is called about every add-on mode after | ||
| 201 | * successed StreamCreate. | ||
| 202 | * @param handle identification data for stream | ||
| 203 | * @param type The processing mode type, see AE_DSP_MODE_TYPE for definitions | ||
| 204 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 205 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 206 | * RegisterMode callback, | ||
| 207 | * @param unique_db_mode_id The Mode unique id generated from dsp database. | ||
| 208 | * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully | ||
| 209 | * or if the stream is not supported the add-on must return | ||
| 210 | * AE_DSP_ERROR_IGNORE_ME. | ||
| 211 | * @remarks Valid implementation required. | ||
| 212 | */ | ||
| 213 | AE_DSP_ERROR StreamIsModeSupported(const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int mode_id, int unique_db_mode_id); | ||
| 214 | |||
| 215 | /*! | ||
| 216 | * @brief Set up Audio DSP with selected audio settings (detected on data of | ||
| 217 | * first present audio packet) | ||
| 218 | * @param addonSettings The add-ons audio settings. | ||
| 219 | * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully. | ||
| 220 | * @remarks Valid implementation required. | ||
| 221 | */ | ||
| 222 | AE_DSP_ERROR StreamInitialize(const ADDON_HANDLE handle, const AE_DSP_SETTINGS *addonSettings); | ||
| 223 | //@} | ||
| 224 | |||
| 225 | /** @name DSP input processing | ||
| 226 | * @remarks Only used by KODI if bSupportsInputProcess is set to true. | ||
| 227 | */ | ||
| 228 | //@{ | ||
| 229 | /*! | ||
| 230 | * @brief DSP input processing | ||
| 231 | * Can be used to have unchanged stream.. | ||
| 232 | * All DSP add-ons allowed to-do this. | ||
| 233 | * @param handle identification data for stream | ||
| 234 | * @param array_in Pointer to data memory | ||
| 235 | * @param samples Amount of samples inside array_in | ||
| 236 | * @return true if work was OK | ||
| 237 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 238 | * GetAddonCapabilities | ||
| 239 | */ | ||
| 240 | bool InputProcess(const ADDON_HANDLE handle, const float **array_in, unsigned int samples); | ||
| 241 | //@} | ||
| 242 | |||
| 243 | /** @name DSP pre-resampling | ||
| 244 | * @remarks Only used by KODI if bSupportsInputResample is set to true. | ||
| 245 | */ | ||
| 246 | //@{ | ||
| 247 | /*! | ||
| 248 | * @brief If the add-on operate with buffered arrays and the output size can | ||
| 249 | * be higher as the input it becomes asked about needed size before any | ||
| 250 | * InputResampleProcess call. | ||
| 251 | * @param handle identification data for stream | ||
| 252 | * @return The needed size of output array or 0 if no changes within it | ||
| 253 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 254 | * GetAddonCapabilities | ||
| 255 | */ | ||
| 256 | unsigned int InputResampleProcessNeededSamplesize(const ADDON_HANDLE handle); | ||
| 257 | |||
| 258 | /*! | ||
| 259 | * @brief DSP re sample processing before master. | ||
| 260 | * Here a high quality resample can be performed. | ||
| 261 | * Only one DSP add-on is allowed to-do this! | ||
| 262 | * @param handle identification data for stream | ||
| 263 | * @param array_in Pointer to input data memory | ||
| 264 | * @param array_out Pointer to output data memory | ||
| 265 | * @param samples Amount of samples inside array_in | ||
| 266 | * @return Amount of samples processed | ||
| 267 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 268 | * GetAddonCapabilities | ||
| 269 | */ | ||
| 270 | unsigned int InputResampleProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples); | ||
| 271 | |||
| 272 | /*! | ||
| 273 | * @brief Returns the re-sampling generated new sample rate used before the | ||
| 274 | * master process | ||
| 275 | * @param handle identification data for stream | ||
| 276 | * @return The new sample rate | ||
| 277 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 278 | * GetAddonCapabilities | ||
| 279 | */ | ||
| 280 | int InputResampleSampleRate(const ADDON_HANDLE handle); | ||
| 281 | |||
| 282 | /*! | ||
| 283 | * @brief Returns the time in seconds that it will take | ||
| 284 | * for the next added packet to be returned to KODI. | ||
| 285 | * @param handle identification data for stream | ||
| 286 | * @return the delay in seconds | ||
| 287 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 288 | * GetAddonCapabilities | ||
| 289 | */ | ||
| 290 | float InputResampleGetDelay(const ADDON_HANDLE handle); | ||
| 291 | //@} | ||
| 292 | |||
| 293 | /** @name DSP Pre processing | ||
| 294 | * @remarks Only used by KODI if bSupportsPreProcess is set to true. | ||
| 295 | */ | ||
| 296 | //@{ | ||
| 297 | /*! | ||
| 298 | * @brief If the addon operate with buffered arrays and the output size can | ||
| 299 | * be higher as the input it becomes asked about needed size before any | ||
| 300 | * PreProcess call. | ||
| 301 | * @param handle identification data for stream | ||
| 302 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 303 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 304 | * RegisterMode callback and can be defined from add-on as a structure | ||
| 305 | * pointer or anything else what is needed to find it. | ||
| 306 | * @return The needed size of output array or 0 if no changes within it | ||
| 307 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 308 | * GetAddonCapabilities | ||
| 309 | */ | ||
| 310 | unsigned int PreProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id); | ||
| 311 | |||
| 312 | /*! | ||
| 313 | * @brief Returns the time in seconds that it will take | ||
| 314 | * for the next added packet to be returned to KODI. | ||
| 315 | * @param handle identification data for stream | ||
| 316 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 317 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 318 | * RegisterMode callback and can be defined from add-on as a structure | ||
| 319 | * pointer or anything else what is needed to find it. | ||
| 320 | * @return the delay in seconds | ||
| 321 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 322 | * GetAddonCapabilities | ||
| 323 | */ | ||
| 324 | float PreProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id); | ||
| 325 | |||
| 326 | /*! | ||
| 327 | * @brief DSP preprocessing | ||
| 328 | * All DSP add-ons allowed to-do this. | ||
| 329 | * @param handle identification data for stream | ||
| 330 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 331 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 332 | * RegisterMode callback and can be defined from add-on as a structure | ||
| 333 | * pointer or anything else what is needed to find it. | ||
| 334 | * @param array_in Pointer to input data memory | ||
| 335 | * @param array_out Pointer to output data memory | ||
| 336 | * @param samples Amount of samples inside array_in | ||
| 337 | * @return Amount of samples processed | ||
| 338 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 339 | * GetAddonCapabilities | ||
| 340 | */ | ||
| 341 | unsigned int PreProcess(const ADDON_HANDLE handle, unsigned int mode_id, float **array_in, float **array_out, unsigned int samples); | ||
| 342 | //@} | ||
| 343 | |||
| 344 | /** @name DSP Master processing | ||
| 345 | * @remarks Only used by KODI if bSupportsMasterProcess is set to true. | ||
| 346 | */ | ||
| 347 | //@{ | ||
| 348 | /*! | ||
| 349 | * @brief Set the active master process mode | ||
| 350 | * @param handle identification data for stream | ||
| 351 | * @param type Requested stream type for the selected master mode | ||
| 352 | * @param mode_id The Mode identifier. | ||
| 353 | * @param unique_db_mode_id The Mode unique id generated from DSP database. | ||
| 354 | * @return AE_DSP_ERROR_NO_ERROR if the setup was successful | ||
| 355 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 356 | * GetAddonCapabilities | ||
| 357 | */ | ||
| 358 | AE_DSP_ERROR MasterProcessSetMode(const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id); | ||
| 359 | |||
| 360 | /*! | ||
| 361 | * @brief If the add-on operate with buffered arrays and the output size can | ||
| 362 | * be higher as the input it becomes asked about needed size before any | ||
| 363 | * MasterProcess call. | ||
| 364 | * @param handle identification data for stream | ||
| 365 | * @return The needed size of output array or 0 if no changes within it | ||
| 366 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 367 | * GetAddonCapabilities | ||
| 368 | */ | ||
| 369 | unsigned int MasterProcessNeededSamplesize(const ADDON_HANDLE handle); | ||
| 370 | |||
| 371 | /*! | ||
| 372 | * @brief Returns the time in seconds that it will take | ||
| 373 | * for the next added packet to be returned to KODI. | ||
| 374 | * @param handle identification data for stream | ||
| 375 | * @return the delay in seconds | ||
| 376 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 377 | * GetAddonCapabilities | ||
| 378 | */ | ||
| 379 | float MasterProcessGetDelay(const ADDON_HANDLE handle); | ||
| 380 | |||
| 381 | /*! | ||
| 382 | * @brief Returns the from selected master mode performed channel alignment | ||
| 383 | * @param handle identification data for stream | ||
| 384 | * @retval out_channel_present_flags the exact channel present flags after | ||
| 385 | * performed up-/downmix | ||
| 386 | * @return the amount channels | ||
| 387 | * @remarks Optional. Must be used and set if a channel up- or downmix is | ||
| 388 | * processed from the active master mode | ||
| 389 | */ | ||
| 390 | int MasterProcessGetOutChannels(const ADDON_HANDLE handle, unsigned long &out_channel_present_flags); | ||
| 391 | |||
| 392 | /*! | ||
| 393 | * @brief Master processing becomes performed with it | ||
| 394 | * Here a channel up-mix/down-mix for stereo surround sound can be performed | ||
| 395 | * Only one DSP add-on is allowed to-do this! | ||
| 396 | * @param handle identification data for stream | ||
| 397 | * @param array_in Pointer to input data memory | ||
| 398 | * @param array_out Pointer to output data memory | ||
| 399 | * @param samples Amount of samples inside array_in | ||
| 400 | * @return Amount of samples processed | ||
| 401 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 402 | * GetAddonCapabilities | ||
| 403 | */ | ||
| 404 | unsigned int MasterProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples); | ||
| 405 | |||
| 406 | /*! | ||
| 407 | * Used to get a information string about the processed work to show on skin | ||
| 408 | * @return A string to show | ||
| 409 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 410 | * GetAddonCapabilities | ||
| 411 | */ | ||
| 412 | const char *MasterProcessGetStreamInfoString(const ADDON_HANDLE handle); | ||
| 413 | //@} | ||
| 414 | |||
| 415 | /** @name DSP Post processing | ||
| 416 | * @remarks Only used by KODI if bSupportsPostProcess is set to true. | ||
| 417 | */ | ||
| 418 | //@{ | ||
| 419 | /*! | ||
| 420 | * If the add-on operate with buffered arrays and the output size can be | ||
| 421 | * higher as the input it becomes asked about needed size before any | ||
| 422 | * PostProcess call. | ||
| 423 | * @param handle identification data for stream | ||
| 424 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 425 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 426 | * RegisterMode callback, and can be defined from add-on as a structure | ||
| 427 | * pointer or anything else what is needed to find it. | ||
| 428 | * @return The needed size of output array or 0 if no changes within it | ||
| 429 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 430 | * GetAddonCapabilities | ||
| 431 | */ | ||
| 432 | unsigned int PostProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id); | ||
| 433 | |||
| 434 | /*! | ||
| 435 | * Returns the time in seconds that it will take | ||
| 436 | * for the next added packet to be returned to KODI. | ||
| 437 | * @param handle identification data for stream | ||
| 438 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 439 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 440 | * RegisterMode callback, and can be defined from add-on as a structure | ||
| 441 | * pointer or anything else what is needed to find it. | ||
| 442 | * @return the delay in seconds | ||
| 443 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 444 | * GetAddonCapabilities | ||
| 445 | */ | ||
| 446 | float PostProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id); | ||
| 447 | |||
| 448 | /*! | ||
| 449 | * @brief DSP post processing | ||
| 450 | * On the post processing can be things performed with additional channel | ||
| 451 | * upmix like 6.1 to 7.1 | ||
| 452 | * or frequency/volume corrections, speaker distance handling, equalizer... . | ||
| 453 | * All DSP add-ons allowed to-do this. | ||
| 454 | * @param handle identification data for stream | ||
| 455 | * @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 456 | * is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 457 | * RegisterMode callback, and can be defined from add-on as a structure | ||
| 458 | * pointer or anything else what is needed to find it. | ||
| 459 | * @param array_in Pointer to input data memory | ||
| 460 | * @param array_out Pointer to output data memory | ||
| 461 | * @param samples Amount of samples inside array_in | ||
| 462 | * @return Amount of samples processed | ||
| 463 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 464 | * GetAddonCapabilities | ||
| 465 | */ | ||
| 466 | unsigned int PostProcess(const ADDON_HANDLE handle, unsigned int mode_id, float **array_in, float **array_out, unsigned int samples); | ||
| 467 | //@} | ||
| 468 | |||
| 469 | /** @name DSP Post re-sampling | ||
| 470 | * @remarks Only used by KODI if bSupportsOutputResample is set to true. | ||
| 471 | */ | ||
| 472 | //@{ | ||
| 473 | /*! | ||
| 474 | * @brief If the add-on operate with buffered arrays and the output size | ||
| 475 | * can be higher as the input | ||
| 476 | * it becomes asked about needed size before any OutputResampleProcess call. | ||
| 477 | * @param handle identification data for stream | ||
| 478 | * @return The needed size of output array or 0 if no changes within it | ||
| 479 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 480 | * GetAddonCapabilities | ||
| 481 | */ | ||
| 482 | unsigned int OutputResampleProcessNeededSamplesize(const ADDON_HANDLE handle); | ||
| 483 | |||
| 484 | /*! | ||
| 485 | * @brief Re-sampling after master processing becomes performed with it if | ||
| 486 | * needed, only | ||
| 487 | * one add-on can perform it. | ||
| 488 | * @param handle identification data for stream | ||
| 489 | * @param array_in Pointer to input data memory | ||
| 490 | * @param array_out Pointer to output data memory | ||
| 491 | * @param samples Amount of samples inside array_in | ||
| 492 | * @return Amount of samples processed | ||
| 493 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 494 | * GetAddonCapabilities | ||
| 495 | */ | ||
| 496 | unsigned int OutputResampleProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples); | ||
| 497 | |||
| 498 | /*! | ||
| 499 | * @brief Returns the re-sampling generated new sample rate used after the | ||
| 500 | * master process. | ||
| 501 | * @param handle identification data for stream | ||
| 502 | * @return The new sample rate | ||
| 503 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 504 | * GetAddonCapabilities | ||
| 505 | */ | ||
| 506 | int OutputResampleSampleRate(const ADDON_HANDLE handle); | ||
| 507 | |||
| 508 | /*! | ||
| 509 | * @brief Returns the time in seconds that it will take for the next added | ||
| 510 | * packet to be returned to KODI. | ||
| 511 | * @param handle identification data for stream | ||
| 512 | * @return the delay in seconds | ||
| 513 | * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 514 | * GetAddonCapabilities | ||
| 515 | */ | ||
| 516 | float OutputResampleGetDelay(const ADDON_HANDLE handle); | ||
| 517 | //@} | ||
| 518 | |||
| 519 | // function to export the above structure to KODI | ||
| 520 | void __declspec(dllexport) get_addon(struct AudioDSP* pDSP) | ||
| 521 | { | ||
| 522 | pDSP->GetAudioDSPAPIVersion = GetAudioDSPAPIVersion; | ||
| 523 | pDSP->GetMinimumAudioDSPAPIVersion = GetMinimumAudioDSPAPIVersion; | ||
| 524 | pDSP->GetGUIAPIVersion = GetGUIAPIVersion; | ||
| 525 | pDSP->GetMinimumGUIAPIVersion = GetMinimumGUIAPIVersion; | ||
| 526 | pDSP->GetAddonCapabilities = GetAddonCapabilities; | ||
| 527 | pDSP->GetDSPName = GetDSPName; | ||
| 528 | pDSP->GetDSPVersion = GetDSPVersion; | ||
| 529 | pDSP->MenuHook = CallMenuHook; | ||
| 530 | |||
| 531 | pDSP->StreamCreate = StreamCreate; | ||
| 532 | pDSP->StreamDestroy = StreamDestroy; | ||
| 533 | pDSP->StreamIsModeSupported = StreamIsModeSupported; | ||
| 534 | pDSP->StreamInitialize = StreamInitialize; | ||
| 535 | |||
| 536 | pDSP->InputProcess = InputProcess; | ||
| 537 | |||
| 538 | pDSP->InputResampleProcessNeededSamplesize = InputResampleProcessNeededSamplesize; | ||
| 539 | pDSP->InputResampleProcess = InputResampleProcess; | ||
| 540 | pDSP->InputResampleGetDelay = InputResampleGetDelay; | ||
| 541 | pDSP->InputResampleSampleRate = InputResampleSampleRate; | ||
| 542 | |||
| 543 | pDSP->PreProcessNeededSamplesize = PreProcessNeededSamplesize; | ||
| 544 | pDSP->PreProcessGetDelay = PreProcessGetDelay; | ||
| 545 | pDSP->PreProcess = PreProcess; | ||
| 546 | |||
| 547 | pDSP->MasterProcessSetMode = MasterProcessSetMode; | ||
| 548 | pDSP->MasterProcessNeededSamplesize = MasterProcessNeededSamplesize; | ||
| 549 | pDSP->MasterProcessGetDelay = MasterProcessGetDelay; | ||
| 550 | pDSP->MasterProcessGetOutChannels = MasterProcessGetOutChannels; | ||
| 551 | pDSP->MasterProcess = MasterProcess; | ||
| 552 | pDSP->MasterProcessGetStreamInfoString = MasterProcessGetStreamInfoString; | ||
| 553 | |||
| 554 | pDSP->PostProcessNeededSamplesize = PostProcessNeededSamplesize; | ||
| 555 | pDSP->PostProcessGetDelay = PostProcessGetDelay; | ||
| 556 | pDSP->PostProcess = PostProcess; | ||
| 557 | |||
| 558 | pDSP->OutputResampleProcessNeededSamplesize = OutputResampleProcessNeededSamplesize; | ||
| 559 | pDSP->OutputResampleProcess = OutputResampleProcess; | ||
| 560 | pDSP->OutputResampleSampleRate = OutputResampleSampleRate; | ||
| 561 | pDSP->OutputResampleGetDelay = OutputResampleGetDelay; | ||
| 562 | }; | ||
| 563 | }; | ||
| 564 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h new file mode 100644 index 0000000..6e492c8 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h | |||
| @@ -0,0 +1,524 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | /*! | ||
| 24 | * Common data structures shared between KODI and KODI's audio DSP add-ons | ||
| 25 | */ | ||
| 26 | |||
| 27 | #ifdef TARGET_WINDOWS | ||
| 28 | #include <windows.h> | ||
| 29 | #else | ||
| 30 | #ifndef __cdecl | ||
| 31 | #define __cdecl | ||
| 32 | #endif | ||
| 33 | #ifndef __declspec | ||
| 34 | #define __declspec(X) | ||
| 35 | #endif | ||
| 36 | #endif | ||
| 37 | |||
| 38 | #include <cstddef> | ||
| 39 | |||
| 40 | #include "xbmc_addon_types.h" | ||
| 41 | #include "xbmc_codec_types.h" | ||
| 42 | |||
| 43 | #undef ATTRIBUTE_PACKED | ||
| 44 | #undef PRAGMA_PACK_BEGIN | ||
| 45 | #undef PRAGMA_PACK_END | ||
| 46 | |||
| 47 | #if defined(__GNUC__) | ||
| 48 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | ||
| 49 | #define ATTRIBUTE_PACKED __attribute__ ((packed)) | ||
| 50 | #define PRAGMA_PACK 0 | ||
| 51 | #endif | ||
| 52 | #endif | ||
| 53 | |||
| 54 | #if !defined(ATTRIBUTE_PACKED) | ||
| 55 | #define ATTRIBUTE_PACKED | ||
| 56 | #define PRAGMA_PACK 1 | ||
| 57 | #endif | ||
| 58 | |||
| 59 | #define AE_DSP_ADDON_STRING_LENGTH 1024 | ||
| 60 | |||
| 61 | #define AE_DSP_STREAM_MAX_STREAMS 8 | ||
| 62 | #define AE_DSP_STREAM_MAX_MODES 32 | ||
| 63 | |||
| 64 | /* current Audio DSP API version */ | ||
| 65 | #define KODI_AE_DSP_API_VERSION "0.1.8" | ||
| 66 | |||
| 67 | /* min. Audio DSP API version */ | ||
| 68 | #define KODI_AE_DSP_MIN_API_VERSION "0.1.8" | ||
| 69 | |||
| 70 | #ifdef __cplusplus | ||
| 71 | extern "C" { | ||
| 72 | #endif | ||
| 73 | |||
| 74 | typedef unsigned int AE_DSP_STREAM_ID; | ||
| 75 | |||
| 76 | /*! | ||
| 77 | * @brief Audio DSP add-on error codes | ||
| 78 | */ | ||
| 79 | typedef enum | ||
| 80 | { | ||
| 81 | AE_DSP_ERROR_NO_ERROR = 0, /*!< @brief no error occurred */ | ||
| 82 | AE_DSP_ERROR_UNKNOWN = -1, /*!< @brief an unknown error occurred */ | ||
| 83 | AE_DSP_ERROR_IGNORE_ME = -2, /*!< @brief the used input stream can not processed and add-on want to ignore */ | ||
| 84 | AE_DSP_ERROR_NOT_IMPLEMENTED = -3, /*!< @brief the method that KODI called is not implemented by the add-on */ | ||
| 85 | AE_DSP_ERROR_REJECTED = -4, /*!< @brief the command was rejected by the DSP */ | ||
| 86 | AE_DSP_ERROR_INVALID_PARAMETERS = -5, /*!< @brief the parameters of the method that was called are invalid for this operation */ | ||
| 87 | AE_DSP_ERROR_INVALID_SAMPLERATE = -6, /*!< @brief the processed samplerate is not supported */ | ||
| 88 | AE_DSP_ERROR_INVALID_IN_CHANNELS = -7, /*!< @brief the processed input channel format is not supported */ | ||
| 89 | AE_DSP_ERROR_INVALID_OUT_CHANNELS = -8, /*!< @brief the processed output channel format is not supported */ | ||
| 90 | AE_DSP_ERROR_FAILED = -9, /*!< @brief the command failed */ | ||
| 91 | } AE_DSP_ERROR; | ||
| 92 | |||
| 93 | /*! | ||
| 94 | * @brief The possible DSP channels (used as pointer inside arrays) | ||
| 95 | */ | ||
| 96 | typedef enum | ||
| 97 | { | ||
| 98 | AE_DSP_CH_INVALID = -1, | ||
| 99 | AE_DSP_CH_FL = 0, | ||
| 100 | AE_DSP_CH_FR, | ||
| 101 | AE_DSP_CH_FC, | ||
| 102 | AE_DSP_CH_LFE, | ||
| 103 | AE_DSP_CH_BL, | ||
| 104 | AE_DSP_CH_BR, | ||
| 105 | AE_DSP_CH_FLOC, | ||
| 106 | AE_DSP_CH_FROC, | ||
| 107 | AE_DSP_CH_BC, | ||
| 108 | AE_DSP_CH_SL, | ||
| 109 | AE_DSP_CH_SR, | ||
| 110 | AE_DSP_CH_TFL, | ||
| 111 | AE_DSP_CH_TFR, | ||
| 112 | AE_DSP_CH_TFC, | ||
| 113 | AE_DSP_CH_TC, | ||
| 114 | AE_DSP_CH_TBL, | ||
| 115 | AE_DSP_CH_TBR, | ||
| 116 | AE_DSP_CH_TBC, | ||
| 117 | AE_DSP_CH_BLOC, | ||
| 118 | AE_DSP_CH_BROC, | ||
| 119 | |||
| 120 | AE_DSP_CH_MAX | ||
| 121 | } AE_DSP_CHANNEL; | ||
| 122 | |||
| 123 | /*! | ||
| 124 | * @brief Present channel flags | ||
| 125 | */ | ||
| 126 | typedef enum | ||
| 127 | { | ||
| 128 | AE_DSP_PRSNT_CH_UNDEFINED = 0, | ||
| 129 | AE_DSP_PRSNT_CH_FL = 1<<0, | ||
| 130 | AE_DSP_PRSNT_CH_FR = 1<<1, | ||
| 131 | AE_DSP_PRSNT_CH_FC = 1<<2, | ||
| 132 | AE_DSP_PRSNT_CH_LFE = 1<<3, | ||
| 133 | AE_DSP_PRSNT_CH_BL = 1<<4, | ||
| 134 | AE_DSP_PRSNT_CH_BR = 1<<5, | ||
| 135 | AE_DSP_PRSNT_CH_FLOC = 1<<6, | ||
| 136 | AE_DSP_PRSNT_CH_FROC = 1<<7, | ||
| 137 | AE_DSP_PRSNT_CH_BC = 1<<8, | ||
| 138 | AE_DSP_PRSNT_CH_SL = 1<<9, | ||
| 139 | AE_DSP_PRSNT_CH_SR = 1<<10, | ||
| 140 | AE_DSP_PRSNT_CH_TFL = 1<<11, | ||
| 141 | AE_DSP_PRSNT_CH_TFR = 1<<12, | ||
| 142 | AE_DSP_PRSNT_CH_TFC = 1<<13, | ||
| 143 | AE_DSP_PRSNT_CH_TC = 1<<14, | ||
| 144 | AE_DSP_PRSNT_CH_TBL = 1<<15, | ||
| 145 | AE_DSP_PRSNT_CH_TBR = 1<<16, | ||
| 146 | AE_DSP_PRSNT_CH_TBC = 1<<17, | ||
| 147 | AE_DSP_PRSNT_CH_BLOC = 1<<18, | ||
| 148 | AE_DSP_PRSNT_CH_BROC = 1<<19 | ||
| 149 | } AE_DSP_CHANNEL_PRESENT; | ||
| 150 | |||
| 151 | /** | ||
| 152 | * @brief The various stream type formats | ||
| 153 | * Used for audio DSP processing to know input audio type | ||
| 154 | */ | ||
| 155 | typedef enum | ||
| 156 | { | ||
| 157 | AE_DSP_ASTREAM_INVALID = -1, | ||
| 158 | AE_DSP_ASTREAM_BASIC = 0, | ||
| 159 | AE_DSP_ASTREAM_MUSIC, | ||
| 160 | AE_DSP_ASTREAM_MOVIE, | ||
| 161 | AE_DSP_ASTREAM_GAME, | ||
| 162 | AE_DSP_ASTREAM_APP, | ||
| 163 | AE_DSP_ASTREAM_PHONE, | ||
| 164 | AE_DSP_ASTREAM_MESSAGE, | ||
| 165 | |||
| 166 | AE_DSP_ASTREAM_AUTO, | ||
| 167 | AE_DSP_ASTREAM_MAX | ||
| 168 | } AE_DSP_STREAMTYPE; | ||
| 169 | |||
| 170 | /*! | ||
| 171 | * @brief Add-ons supported audio stream type flags | ||
| 172 | * used on master mode information on AE_DSP_MODES to know | ||
| 173 | * on which audio stream the master mode is supported | ||
| 174 | */ | ||
| 175 | typedef enum | ||
| 176 | { | ||
| 177 | AE_DSP_PRSNT_ASTREAM_BASIC = 1<<0, | ||
| 178 | AE_DSP_PRSNT_ASTREAM_MUSIC = 1<<1, | ||
| 179 | AE_DSP_PRSNT_ASTREAM_MOVIE = 1<<2, | ||
| 180 | AE_DSP_PRSNT_ASTREAM_GAME = 1<<3, | ||
| 181 | AE_DSP_PRSNT_ASTREAM_APP = 1<<4, | ||
| 182 | AE_DSP_PRSNT_ASTREAM_MESSAGE = 1<<5, | ||
| 183 | AE_DSP_PRSNT_ASTREAM_PHONE = 1<<6, | ||
| 184 | } AE_DSP_ASTREAM_PRESENT; | ||
| 185 | |||
| 186 | /** | ||
| 187 | * @brief The various base type formats | ||
| 188 | * Used for audio DSP processing to know input audio source | ||
| 189 | */ | ||
| 190 | typedef enum | ||
| 191 | { | ||
| 192 | AE_DSP_ABASE_INVALID = -1, | ||
| 193 | AE_DSP_ABASE_STEREO = 0, | ||
| 194 | AE_DSP_ABASE_MONO, | ||
| 195 | AE_DSP_ABASE_MULTICHANNEL, | ||
| 196 | AE_DSP_ABASE_AC3, | ||
| 197 | AE_DSP_ABASE_EAC3, | ||
| 198 | AE_DSP_ABASE_DTS, | ||
| 199 | AE_DSP_ABASE_DTSHD_MA, | ||
| 200 | AE_DSP_ABASE_DTSHD_HRA, | ||
| 201 | AE_DSP_ABASE_TRUEHD, | ||
| 202 | AE_DSP_ABASE_MLP, | ||
| 203 | AE_DSP_ABASE_FLAC, | ||
| 204 | |||
| 205 | AE_DSP_ABASE_MAX | ||
| 206 | } AE_DSP_BASETYPE; | ||
| 207 | |||
| 208 | |||
| 209 | /** | ||
| 210 | * @brief The from KODI in settings requested audio process quality. | ||
| 211 | * The KODI internal used quality levels is translated to this values | ||
| 212 | * for usage on DSP processing add-ons. Is present on iQualityLevel | ||
| 213 | * inside AE_DSP_SETTINGS. | ||
| 214 | */ | ||
| 215 | typedef enum | ||
| 216 | { | ||
| 217 | AE_DSP_QUALITY_UNKNOWN = -1, /*!< @brief Unset, unknown or incorrect quality level */ | ||
| 218 | AE_DSP_QUALITY_DEFAULT = 0, /*!< @brief Engine's default quality level */ | ||
| 219 | |||
| 220 | /* Basic quality levels */ | ||
| 221 | AE_DSP_QUALITY_LOW = 20, /*!< @brief Low quality level */ | ||
| 222 | AE_DSP_QUALITY_MID = 30, /*!< @brief Standard quality level */ | ||
| 223 | AE_DSP_QUALITY_HIGH = 50, /*!< @brief Best sound processing quality */ | ||
| 224 | |||
| 225 | /* Optional quality levels */ | ||
| 226 | AE_DSP_QUALITY_REALLYHIGH = 100 /*!< @brief Uncompromising optional quality level, usually with unmeasurable and unnoticeable improvement */ | ||
| 227 | } AE_DSP_QUALITY; | ||
| 228 | |||
| 229 | /*! | ||
| 230 | * @brief Audio DSP menu hook categories. | ||
| 231 | * Used to identify on AE_DSP_MENUHOOK given add-on related skin dialog/windows. | ||
| 232 | * Except AE_DSP_MENUHOOK_ALL and AE_DSP_MENUHOOK_SETTING are the menus available | ||
| 233 | * from DSP playback dialogue which can be opened over KODI file context menu and over | ||
| 234 | * button on full screen OSD window. | ||
| 235 | * | ||
| 236 | * Menu hook AE_DSP_MENUHOOK_SETTING is available from DSP processing setup dialogue. | ||
| 237 | */ | ||
| 238 | typedef enum | ||
| 239 | { | ||
| 240 | AE_DSP_MENUHOOK_UNKNOWN =-1, /*!< @brief unknown menu hook */ | ||
| 241 | AE_DSP_MENUHOOK_ALL = 0, /*!< @brief all categories */ | ||
| 242 | AE_DSP_MENUHOOK_PRE_PROCESS = 1, /*!< @brief for pre processing */ | ||
| 243 | AE_DSP_MENUHOOK_MASTER_PROCESS = 2, /*!< @brief for master processing */ | ||
| 244 | AE_DSP_MENUHOOK_POST_PROCESS = 3, /*!< @brief for post processing */ | ||
| 245 | AE_DSP_MENUHOOK_RESAMPLE = 4, /*!< @brief for re sample */ | ||
| 246 | AE_DSP_MENUHOOK_MISCELLANEOUS = 5, /*!< @brief for miscellaneous dialogues */ | ||
| 247 | AE_DSP_MENUHOOK_INFORMATION = 6, /*!< @brief dialogue to show processing information */ | ||
| 248 | AE_DSP_MENUHOOK_SETTING = 7, /*!< @brief for settings */ | ||
| 249 | } AE_DSP_MENUHOOK_CAT; | ||
| 250 | |||
| 251 | /*! | ||
| 252 | * @brief Menu hooks that are available in the menus while playing a stream via this add-on. | ||
| 253 | */ | ||
| 254 | typedef struct AE_DSP_MENUHOOK | ||
| 255 | { | ||
| 256 | unsigned int iHookId; /*!< @brief (required) this hook's identifier */ | ||
| 257 | unsigned int iLocalizedStringId; /*!< @brief (required) the id of the label for this hook in g_localizeStrings */ | ||
| 258 | AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) category of menu hook */ | ||
| 259 | unsigned int iRelevantModeId; /*!< @brief (required) except category AE_DSP_MENUHOOK_SETTING and AE_DSP_MENUHOOK_ALL must be the related mode id present here */ | ||
| 260 | bool bNeedPlayback; /*!< @brief (required) set to true if menu hook need playback and active processing */ | ||
| 261 | } ATTRIBUTE_PACKED AE_DSP_MENUHOOK; | ||
| 262 | |||
| 263 | /*! | ||
| 264 | * @brief Properties passed to the Create() method of an add-on. | ||
| 265 | */ | ||
| 266 | typedef struct AE_DSP_PROPERTIES | ||
| 267 | { | ||
| 268 | const char* strUserPath; /*!< @brief path to the user profile */ | ||
| 269 | const char* strAddonPath; /*!< @brief path to this add-on */ | ||
| 270 | } AE_DSP_PROPERTIES; | ||
| 271 | |||
| 272 | /*! | ||
| 273 | * @brief Audio DSP add-on capabilities. All capabilities are set to "false" as default. | ||
| 274 | * If a capability is set to true, then the corresponding methods from kodi_audiodsp_dll.h need to be implemented. | ||
| 275 | */ | ||
| 276 | typedef struct AE_DSP_ADDON_CAPABILITIES | ||
| 277 | { | ||
| 278 | bool bSupportsInputProcess; /*!< @brief true if this add-on provides audio input processing */ | ||
| 279 | bool bSupportsInputResample; /*!< @brief true if this add-on provides audio resample before master handling */ | ||
| 280 | bool bSupportsPreProcess; /*!< @brief true if this add-on provides audio pre processing */ | ||
| 281 | bool bSupportsMasterProcess; /*!< @brief true if this add-on provides audio master processing */ | ||
| 282 | bool bSupportsPostProcess; /*!< @brief true if this add-on provides audio post processing */ | ||
| 283 | bool bSupportsOutputResample; /*!< @brief true if this add-on provides audio re sample after master handling */ | ||
| 284 | } ATTRIBUTE_PACKED AE_DSP_ADDON_CAPABILITIES; | ||
| 285 | |||
| 286 | /*! | ||
| 287 | * @brief Audio processing settings for in and out arrays | ||
| 288 | * Send on creation and before first processed audio packet to add-on | ||
| 289 | */ | ||
| 290 | typedef struct AE_DSP_SETTINGS | ||
| 291 | { | ||
| 292 | AE_DSP_STREAM_ID iStreamID; /*!< @brief id of the audio stream packets */ | ||
| 293 | AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */ | ||
| 294 | int iInChannels; /*!< @brief the amount of input channels */ | ||
| 295 | unsigned long lInChannelPresentFlags; /*!< @brief the exact channel mapping flags of input */ | ||
| 296 | int iInFrames; /*!< @brief the input frame size from KODI */ | ||
| 297 | unsigned int iInSamplerate; /*!< @brief the basic sample rate of the audio packet */ | ||
| 298 | int iProcessFrames; /*!< @brief the processing frame size inside add-on's */ | ||
| 299 | unsigned int iProcessSamplerate; /*!< @brief the sample rate after input resample present in master processing */ | ||
| 300 | int iOutChannels; /*!< @brief the amount of output channels */ | ||
| 301 | unsigned long lOutChannelPresentFlags; /*!< @brief the exact channel mapping flags for output */ | ||
| 302 | int iOutFrames; /*!< @brief the final out frame size for KODI */ | ||
| 303 | unsigned int iOutSamplerate; /*!< @brief the final sample rate of the audio packet */ | ||
| 304 | bool bInputResamplingActive; /*!< @brief if a re-sampling is performed before master processing this flag is set to true */ | ||
| 305 | bool bStereoUpmix; /*!< @brief true if the stereo upmix setting on kodi is set */ | ||
| 306 | int iQualityLevel; /*!< @brief the from KODI selected quality level for signal processing */ | ||
| 307 | /*! | ||
| 308 | * @note about "iProcessSamplerate" and "iProcessFrames" is set from KODI after call of StreamCreate on input re sample add-on, if re-sampling | ||
| 309 | * and processing is handled inside the same add-on, this value must be ignored! | ||
| 310 | */ | ||
| 311 | } ATTRIBUTE_PACKED AE_DSP_SETTINGS; | ||
| 312 | |||
| 313 | /*! | ||
| 314 | * @brief Stream profile properties | ||
| 315 | * Can be used to detect best master processing mode and for post processing methods. | ||
| 316 | */ | ||
| 317 | //@{ | ||
| 318 | |||
| 319 | /*! | ||
| 320 | * @brief Dolby profile types. Given from several formats, e.g. Dolby Digital or TrueHD | ||
| 321 | * Used on AE_DSP_PROFILE_AC3_EAC3 and AE_DSP_PROFILE_MLP_TRUEHD | ||
| 322 | */ | ||
| 323 | #define AE_DSP_PROFILE_DOLBY_NONE 0 | ||
| 324 | #define AE_DSP_PROFILE_DOLBY_SURROUND 1 | ||
| 325 | #define AE_DSP_PROFILE_DOLBY_PLII 2 | ||
| 326 | #define AE_DSP_PROFILE_DOLBY_PLIIX 3 | ||
| 327 | #define AE_DSP_PROFILE_DOLBY_PLIIZ 4 | ||
| 328 | #define AE_DSP_PROFILE_DOLBY_EX 5 | ||
| 329 | #define AE_DSP_PROFILE_DOLBY_HEADPHONE 6 | ||
| 330 | |||
| 331 | /*! | ||
| 332 | * @brief DTS/DTS HD profile types | ||
| 333 | * Used on AE_DSP_PROFILE_DTS_DTSHD | ||
| 334 | */ | ||
| 335 | #define AE_DSP_PROFILE_DTS 0 | ||
| 336 | #define AE_DSP_PROFILE_DTS_ES 1 | ||
| 337 | #define AE_DSP_PROFILE_DTS_96_24 2 | ||
| 338 | #define AE_DSP_PROFILE_DTS_HD_HRA 3 | ||
| 339 | #define AE_DSP_PROFILE_DTS_HD_MA 4 | ||
| 340 | |||
| 341 | /*! | ||
| 342 | * @brief AC3/EAC3 based service types | ||
| 343 | * Used on AE_DSP_PROFILE_AC3_EAC3 | ||
| 344 | */ | ||
| 345 | #define AE_DSP_SERVICE_TYPE_MAIN 0 | ||
| 346 | #define AE_DSP_SERVICE_TYPE_EFFECTS 1 | ||
| 347 | #define AE_DSP_SERVICE_TYPE_VISUALLY_IMPAIRED 2 | ||
| 348 | #define AE_DSP_SERVICE_TYPE_HEARING_IMPAIRED 3 | ||
| 349 | #define AE_DSP_SERVICE_TYPE_DIALOGUE 4 | ||
| 350 | #define AE_DSP_SERVICE_TYPE_COMMENTARY 5 | ||
| 351 | #define AE_DSP_SERVICE_TYPE_EMERGENCY 6 | ||
| 352 | #define AE_DSP_SERVICE_TYPE_VOICE_OVER 7 | ||
| 353 | #define AE_DSP_SERVICE_TYPE_KARAOKE 8 | ||
| 354 | |||
| 355 | /*! | ||
| 356 | * @brief AC3/EAC3 based room types | ||
| 357 | * Present on AE_DSP_PROFILE_AC3_EAC3 and can be used for frequency corrections | ||
| 358 | * at post processing, e.g. THX Re-Equalization | ||
| 359 | */ | ||
| 360 | #define AE_DSP_ROOM_TYPE_UNDEFINED 0 | ||
| 361 | #define AE_DSP_ROOM_TYPE_SMALL 1 | ||
| 362 | #define AE_DSP_ROOM_TYPE_LARGE 2 | ||
| 363 | |||
| 364 | /*! | ||
| 365 | * @brief AC3/EAC3 stream profile properties | ||
| 366 | */ | ||
| 367 | //! @todo add handling for it (currently never becomes set) | ||
| 368 | typedef struct AE_DSP_PROFILE_AC3_EAC3 | ||
| 369 | { | ||
| 370 | unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */ | ||
| 371 | unsigned int iServiceType; /*!< defined by AE_DSP_SERVICE_TYPE_* */ | ||
| 372 | unsigned int iRoomType; /*!< defined by AE_DSP_ROOM_TYPE_* (NOTICE: Information about it currently not supported from ffmpeg and must be implemented) */ | ||
| 373 | } ATTRIBUTE_PACKED AE_DSP_PROFILE_AC3_EAC3; | ||
| 374 | |||
| 375 | /*! | ||
| 376 | * @brief MLP/Dolby TrueHD stream profile properties | ||
| 377 | */ | ||
| 378 | //! @todo add handling for it (currently never becomes set) | ||
| 379 | typedef struct AE_DSP_PROFILE_MLP_TRUEHD | ||
| 380 | { | ||
| 381 | unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */ | ||
| 382 | } ATTRIBUTE_PACKED AE_DSP_PROFILE_MLP_TRUEHD; | ||
| 383 | |||
| 384 | /*! | ||
| 385 | * @brief DTS/DTS HD stream profile properties | ||
| 386 | */ | ||
| 387 | //! @todo add handling for it (currently never becomes set) | ||
| 388 | typedef struct AE_DSP_PROFILE_DTS_DTSHD | ||
| 389 | { | ||
| 390 | unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DTS* */ | ||
| 391 | bool bSurroundMatrix; /*!< if set to true given 2.0 stream is surround encoded */ | ||
| 392 | } ATTRIBUTE_PACKED AE_DSP_PROFILE_DTS_DTSHD; | ||
| 393 | |||
| 394 | union AE_DSP_PROFILE | ||
| 395 | { | ||
| 396 | AE_DSP_PROFILE_AC3_EAC3 ac3_eac3; /*!< Dolby Digital/Digital+ profile data */ | ||
| 397 | AE_DSP_PROFILE_MLP_TRUEHD mlp_truehd; /*!< MLP or Dolby TrueHD profile data */ | ||
| 398 | AE_DSP_PROFILE_DTS_DTSHD dts_dtshd; /*!< DTS/DTS-HD profile data */ | ||
| 399 | }; | ||
| 400 | //@} | ||
| 401 | |||
| 402 | /*! | ||
| 403 | * @brief Audio DSP stream properties | ||
| 404 | * Used to check for the DSP add-on that the stream is supported, | ||
| 405 | * as example Dolby Digital Ex processing is only required on Dolby Digital with 5.1 layout | ||
| 406 | */ | ||
| 407 | typedef struct AE_DSP_STREAM_PROPERTIES | ||
| 408 | { | ||
| 409 | AE_DSP_STREAM_ID iStreamID; /*!< @brief stream id of the audio stream packets */ | ||
| 410 | AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */ | ||
| 411 | int iBaseType; /*!< @brief the input stream base type source eg, Dolby Digital */ | ||
| 412 | const char* strName; /*!< @brief the audio stream name */ | ||
| 413 | const char* strCodecId; /*!< @brief codec id string of the audio stream */ | ||
| 414 | const char* strLanguage; /*!< @brief language id of the audio stream */ | ||
| 415 | int iIdentifier; /*!< @brief audio stream id inside player */ | ||
| 416 | int iChannels; /*!< @brief amount of basic channels */ | ||
| 417 | int iSampleRate; /*!< @brief sample rate */ | ||
| 418 | AE_DSP_PROFILE Profile; /*!< @brief current running stream profile data */ | ||
| 419 | } ATTRIBUTE_PACKED AE_DSP_STREAM_PROPERTIES; | ||
| 420 | |||
| 421 | /*! | ||
| 422 | * @brief Audio DSP mode categories | ||
| 423 | */ | ||
| 424 | typedef enum | ||
| 425 | { | ||
| 426 | AE_DSP_MODE_TYPE_UNDEFINED = -1, /*!< @brief undefined type, never be used from add-on! */ | ||
| 427 | AE_DSP_MODE_TYPE_INPUT_RESAMPLE = 0, /*!< @brief for input re sample */ | ||
| 428 | AE_DSP_MODE_TYPE_PRE_PROCESS = 1, /*!< @brief for preprocessing */ | ||
| 429 | AE_DSP_MODE_TYPE_MASTER_PROCESS = 2, /*!< @brief for master processing */ | ||
| 430 | AE_DSP_MODE_TYPE_POST_PROCESS = 3, /*!< @brief for post processing */ | ||
| 431 | AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE = 4, /*!< @brief for output re sample */ | ||
| 432 | AE_DSP_MODE_TYPE_MAX = 5 | ||
| 433 | } AE_DSP_MODE_TYPE; | ||
| 434 | |||
| 435 | /*! | ||
| 436 | * @brief Audio DSP master mode information | ||
| 437 | * Used to get all available modes for current input stream | ||
| 438 | */ | ||
| 439 | typedef struct AE_DSP_MODES | ||
| 440 | { | ||
| 441 | unsigned int iModesCount; /*!< @brief (required) count of how much modes are in AE_DSP_MODES */ | ||
| 442 | struct AE_DSP_MODE | ||
| 443 | { | ||
| 444 | int iUniqueDBModeId; /*!< @brief (required) the inside add-on used identifier for the mode, set by KODI's audio DSP database */ | ||
| 445 | AE_DSP_MODE_TYPE iModeType; /*!< @brief (required) the processong mode type, see AE_DSP_MODE_TYPE */ | ||
| 446 | char strModeName[AE_DSP_ADDON_STRING_LENGTH]; /*!< @brief (required) the addon name of the mode, used on KODI's logs */ | ||
| 447 | |||
| 448 | unsigned int iModeNumber; /*!< @brief (required) number of this mode on the add-on, is used on process functions with value "mode_id" */ | ||
| 449 | unsigned int iModeSupportTypeFlags; /*!< @brief (required) flags about supported input types for this mode, see AE_DSP_ASTREAM_PRESENT */ | ||
| 450 | bool bHasSettingsDialog; /*!< @brief (required) if setting dialog(s) are available it must be set to true */ | ||
| 451 | bool bIsDisabled; /*!< @brief (optional) true if this mode is marked as disabled and not enabled default, only relevant for master processes, all other types always disabled as default */ | ||
| 452 | |||
| 453 | unsigned int iModeName; /*!< @brief (required) the name id of the mode for this hook in g_localizeStrings */ | ||
| 454 | unsigned int iModeSetupName; /*!< @brief (optional) the name id of the mode inside settings for this hook in g_localizeStrings */ | ||
| 455 | unsigned int iModeDescription; /*!< @brief (optional) the description id of the mode for this hook in g_localizeStrings */ | ||
| 456 | unsigned int iModeHelp; /*!< @brief (optional) help string id for inside DSP settings dialog of the mode for this hook in g_localizeStrings */ | ||
| 457 | |||
| 458 | char strOwnModeImage[AE_DSP_ADDON_STRING_LENGTH]; /*!< @brief (optional) flag image for the mode */ | ||
| 459 | char strOverrideModeImage[AE_DSP_ADDON_STRING_LENGTH]; /*!< @brief (optional) image to override KODI Image for the mode, eg. Dolby Digital with Dolby Digital Ex (only used on master modes) */ | ||
| 460 | } mode[AE_DSP_STREAM_MAX_MODES]; /*!< @brief Modes array storage */ | ||
| 461 | } ATTRIBUTE_PACKED AE_DSP_MODES; | ||
| 462 | |||
| 463 | /*! | ||
| 464 | * @brief Audio DSP menu hook data | ||
| 465 | */ | ||
| 466 | typedef struct AE_DSP_MENUHOOK_DATA | ||
| 467 | { | ||
| 468 | AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) related menuhook data category */ | ||
| 469 | union data { | ||
| 470 | AE_DSP_STREAM_ID iStreamId; /*!< @brief currently only stream id is used, is used as union to have extension possibility */ | ||
| 471 | } data; /*!< @brief related category related data */ | ||
| 472 | } ATTRIBUTE_PACKED AE_DSP_MENUHOOK_DATA; | ||
| 473 | |||
| 474 | /*! | ||
| 475 | * @brief Structure to transfer the methods from kodi_audiodsp_dll.h to KODI | ||
| 476 | */ | ||
| 477 | struct AudioDSP | ||
| 478 | { | ||
| 479 | const char* (__cdecl* GetAudioDSPAPIVersion) (void); | ||
| 480 | const char* (__cdecl* GetMinimumAudioDSPAPIVersion) (void); | ||
| 481 | const char* (__cdecl* GetGUIAPIVersion) (void); | ||
| 482 | const char* (__cdecl* GetMinimumGUIAPIVersion) (void); | ||
| 483 | AE_DSP_ERROR (__cdecl* GetAddonCapabilities) (AE_DSP_ADDON_CAPABILITIES*); | ||
| 484 | const char* (__cdecl* GetDSPName) (void); | ||
| 485 | const char* (__cdecl* GetDSPVersion) (void); | ||
| 486 | AE_DSP_ERROR (__cdecl* MenuHook) (const AE_DSP_MENUHOOK&, const AE_DSP_MENUHOOK_DATA&); | ||
| 487 | |||
| 488 | AE_DSP_ERROR (__cdecl* StreamCreate) (const AE_DSP_SETTINGS*, const AE_DSP_STREAM_PROPERTIES*, ADDON_HANDLE); | ||
| 489 | AE_DSP_ERROR (__cdecl* StreamDestroy) (const ADDON_HANDLE); | ||
| 490 | AE_DSP_ERROR (__cdecl* StreamIsModeSupported) (const ADDON_HANDLE, AE_DSP_MODE_TYPE, unsigned int, int); | ||
| 491 | AE_DSP_ERROR (__cdecl* StreamInitialize) (const ADDON_HANDLE, const AE_DSP_SETTINGS*); | ||
| 492 | |||
| 493 | bool (__cdecl* InputProcess) (const ADDON_HANDLE, const float**, unsigned int); | ||
| 494 | |||
| 495 | unsigned int (__cdecl* InputResampleProcessNeededSamplesize) (const ADDON_HANDLE); | ||
| 496 | unsigned int (__cdecl* InputResampleProcess) (const ADDON_HANDLE, float**, float**, unsigned int); | ||
| 497 | float (__cdecl* InputResampleGetDelay) (const ADDON_HANDLE); | ||
| 498 | int (__cdecl* InputResampleSampleRate) (const ADDON_HANDLE); | ||
| 499 | |||
| 500 | unsigned int (__cdecl* PreProcessNeededSamplesize) (const ADDON_HANDLE, unsigned int); | ||
| 501 | float (__cdecl* PreProcessGetDelay) (const ADDON_HANDLE, unsigned int); | ||
| 502 | unsigned int (__cdecl* PreProcess) (const ADDON_HANDLE, unsigned int, float**, float**, unsigned int); | ||
| 503 | |||
| 504 | AE_DSP_ERROR (__cdecl* MasterProcessSetMode) (const ADDON_HANDLE, AE_DSP_STREAMTYPE, unsigned int, int); | ||
| 505 | unsigned int (__cdecl* MasterProcessNeededSamplesize) (const ADDON_HANDLE); | ||
| 506 | float (__cdecl* MasterProcessGetDelay) (const ADDON_HANDLE); | ||
| 507 | int (__cdecl* MasterProcessGetOutChannels) (const ADDON_HANDLE, unsigned long&); | ||
| 508 | unsigned int (__cdecl* MasterProcess) (const ADDON_HANDLE, float**, float**, unsigned int); | ||
| 509 | const char* (__cdecl* MasterProcessGetStreamInfoString) (const ADDON_HANDLE); | ||
| 510 | |||
| 511 | unsigned int (__cdecl* PostProcessNeededSamplesize) (const ADDON_HANDLE, unsigned int); | ||
| 512 | float (__cdecl* PostProcessGetDelay) (const ADDON_HANDLE, unsigned int); | ||
| 513 | unsigned int (__cdecl* PostProcess) (const ADDON_HANDLE, unsigned int, float**, float**, unsigned int); | ||
| 514 | |||
| 515 | unsigned int (__cdecl* OutputResampleProcessNeededSamplesize)(const ADDON_HANDLE); | ||
| 516 | unsigned int (__cdecl* OutputResampleProcess) (const ADDON_HANDLE, float**, float**, unsigned int); | ||
| 517 | float (__cdecl* OutputResampleGetDelay) (const ADDON_HANDLE); | ||
| 518 | int (__cdecl* OutputResampleSampleRate) (const ADDON_HANDLE); | ||
| 519 | }; | ||
| 520 | |||
| 521 | #ifdef __cplusplus | ||
| 522 | } | ||
| 523 | #endif | ||
| 524 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h new file mode 100644 index 0000000..78bc3cc --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2013 Team XBMC | ||
| 3 | * http://xbmc.org | ||
| 4 | * | ||
| 5 | * This Program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This Program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with XBMC; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | #pragma once | ||
| 22 | |||
| 23 | #include <stdint.h> | ||
| 24 | #include "xbmc_addon_dll.h" | ||
| 25 | #include "kodi_audiodec_types.h" | ||
| 26 | |||
| 27 | extern "C" | ||
| 28 | { | ||
| 29 | //! \copydoc AudioDecoder::Init | ||
| 30 | void* Init(const char* file, unsigned int filecache, int* channels, | ||
| 31 | int* samplerate, int* bitspersample, int64_t* totaltime, | ||
| 32 | int* bitrate, AEDataFormat* format, const AEChannel** channelinfo); | ||
| 33 | |||
| 34 | //! \copydoc AudioDecoder::ReadPCM | ||
| 35 | int ReadPCM(void* context, uint8_t* buffer, int size, int* actualsize); | ||
| 36 | |||
| 37 | //! \copydoc AudioDecoder::Seek | ||
| 38 | int64_t Seek(void* context, int64_t time); | ||
| 39 | |||
| 40 | //! \copydoc AudioDecoder::ReadTag | ||
| 41 | bool ReadTag(const char* file, char* title, | ||
| 42 | char* artist, int* length); | ||
| 43 | |||
| 44 | //! \copydoc AudioDecoder::TrackCount | ||
| 45 | int TrackCount(const char* file); | ||
| 46 | |||
| 47 | //! \copydoc AudioDecoder::DeInit | ||
| 48 | bool DeInit(void* context); | ||
| 49 | |||
| 50 | // function to export the above structure to XBMC | ||
| 51 | void __declspec(dllexport) get_addon(struct AudioDecoder* pScr) | ||
| 52 | { | ||
| 53 | pScr->Init = Init; | ||
| 54 | pScr->ReadPCM = ReadPCM; | ||
| 55 | pScr->Seek = Seek; | ||
| 56 | pScr->ReadTag = ReadTag; | ||
| 57 | pScr->TrackCount = TrackCount; | ||
| 58 | pScr->DeInit = DeInit; | ||
| 59 | }; | ||
| 60 | }; | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h new file mode 100644 index 0000000..82d71e5 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2013 Team XBMC | ||
| 3 | * http://xbmc.org | ||
| 4 | * | ||
| 5 | * This Program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This Program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with XBMC; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | #pragma once | ||
| 22 | |||
| 23 | #include <stdint.h> | ||
| 24 | #ifdef BUILD_KODI_ADDON | ||
| 25 | #include "AEChannelData.h" | ||
| 26 | #else | ||
| 27 | #include "cores/AudioEngine/Utils/AEChannelData.h" | ||
| 28 | #endif | ||
| 29 | |||
| 30 | extern "C" | ||
| 31 | { | ||
| 32 | struct AUDIODEC_INFO | ||
| 33 | { | ||
| 34 | int dummy; | ||
| 35 | }; | ||
| 36 | |||
| 37 | struct AUDIODEC_PROPS | ||
| 38 | { | ||
| 39 | int dummy; | ||
| 40 | }; | ||
| 41 | |||
| 42 | struct AudioDecoder | ||
| 43 | { | ||
| 44 | //! \brief Initialize a decoder | ||
| 45 | //! \param file The file to read | ||
| 46 | //! \param filecache The file cache size | ||
| 47 | //! \param channels Number of channels in output stream | ||
| 48 | //! \param samplerate Samplerate of output stream | ||
| 49 | //! \param bitspersample Bits per sample in output stream | ||
| 50 | //! \param totaltime Total time for stream | ||
| 51 | //! \param bitrate Average bitrate of input stream | ||
| 52 | //! \param format Data format for output stream | ||
| 53 | //! \param info Channel mapping for output stream | ||
| 54 | //! \return Context of output stream | ||
| 55 | //! \sa ICodec::Init | ||
| 56 | void* (__cdecl* Init) (const char* file, unsigned int filecache, | ||
| 57 | int* channels, int* samplerate, | ||
| 58 | int* bitspersample, int64_t* totaltime, | ||
| 59 | int* bitrate, AEDataFormat* format, | ||
| 60 | const AEChannel** info); | ||
| 61 | |||
| 62 | //! \brief Produce some noise | ||
| 63 | //! \param context Context of output stream | ||
| 64 | //! \param buffer Output buffer | ||
| 65 | //! \param size Size of output buffer | ||
| 66 | //! \param actualsize Actual number of bytes written to output buffer | ||
| 67 | //! \return 0 on success, -1 on end of stream, 1 on failure | ||
| 68 | //! \sa ICodec::ReadPCM | ||
| 69 | int (__cdecl* ReadPCM) (void* context, uint8_t* buffer, int size, int* actualsize); | ||
| 70 | |||
| 71 | |||
| 72 | //! \brief Seek in output stream | ||
| 73 | //! \param context Context of output stream | ||
| 74 | //! \param time Time position to seek to in milliseconds | ||
| 75 | //! \return Time position seek ended up on | ||
| 76 | //! \sa ICodec::Seek | ||
| 77 | int64_t (__cdecl* Seek) (void* context, int64_t time); | ||
| 78 | |||
| 79 | //! \brief Read tag of a file | ||
| 80 | //! \param file File to read tag for | ||
| 81 | //! \param title Title of file | ||
| 82 | //! \param artist Artist of file | ||
| 83 | //! \param length Length of file | ||
| 84 | //! \return True on success, false on failure | ||
| 85 | //! \sa IMusicInfoTagLoader::ReadTag | ||
| 86 | bool (__cdecl* ReadTag)(const char* file, char* title, | ||
| 87 | char* artist, int* length); | ||
| 88 | |||
| 89 | //! \brief Get number of tracks in a file | ||
| 90 | //! \param file File to read tag for | ||
| 91 | //! \return Number of tracks in file | ||
| 92 | //! \sa CMusicFileDirectory | ||
| 93 | int (__cdecl* TrackCount) (const char* file); | ||
| 94 | |||
| 95 | //! \brief Close down an output stream | ||
| 96 | //! \param context Context of stream | ||
| 97 | //! \return True on success, false on failure | ||
| 98 | //! \sa ICodec::DeInit | ||
| 99 | bool (__cdecl* DeInit)(void* context); | ||
| 100 | }; | ||
| 101 | } | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h new file mode 100644 index 0000000..0402ace --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h | |||
| @@ -0,0 +1,165 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | /*! | ||
| 24 | * Common data structures shared between KODI and KODI's binary add-ons | ||
| 25 | */ | ||
| 26 | |||
| 27 | #ifdef BUILD_KODI_ADDON | ||
| 28 | #include "kodi/AudioEngine/AEChannelInfo.h" | ||
| 29 | #else | ||
| 30 | #include "cores/AudioEngine/Utils/AEChannelInfo.h" | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #ifdef TARGET_WINDOWS | ||
| 34 | #include <windows.h> | ||
| 35 | #else | ||
| 36 | #ifndef __cdecl | ||
| 37 | #define __cdecl | ||
| 38 | #endif | ||
| 39 | #ifndef __declspec | ||
| 40 | #define __declspec(X) | ||
| 41 | #endif | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #include <cstddef> | ||
| 45 | |||
| 46 | #undef ATTRIBUTE_PACKED | ||
| 47 | #undef PRAGMA_PACK_BEGIN | ||
| 48 | #undef PRAGMA_PACK_END | ||
| 49 | |||
| 50 | #if defined(__GNUC__) | ||
| 51 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | ||
| 52 | #define ATTRIBUTE_PACKED __attribute__ ((packed)) | ||
| 53 | #define PRAGMA_PACK 0 | ||
| 54 | #endif | ||
| 55 | #endif | ||
| 56 | |||
| 57 | #if !defined(ATTRIBUTE_PACKED) | ||
| 58 | #define ATTRIBUTE_PACKED | ||
| 59 | #define PRAGMA_PACK 1 | ||
| 60 | #endif | ||
| 61 | |||
| 62 | /* current Audio DSP API version */ | ||
| 63 | #define KODI_AUDIOENGINE_API_VERSION "0.0.1" | ||
| 64 | |||
| 65 | /* min. Audio DSP API version */ | ||
| 66 | #define KODI_AUDIOENGINE_MIN_API_VERSION "0.0.1" | ||
| 67 | |||
| 68 | |||
| 69 | #ifdef __cplusplus | ||
| 70 | extern "C" { | ||
| 71 | #endif | ||
| 72 | |||
| 73 | /** | ||
| 74 | * A stream handle pointer, which is only used internally by the addon stream handle | ||
| 75 | */ | ||
| 76 | typedef void AEStreamHandle; | ||
| 77 | |||
| 78 | /** | ||
| 79 | * The audio format structure that fully defines a stream's audio information | ||
| 80 | */ | ||
| 81 | typedef struct AudioEngineFormat | ||
| 82 | { | ||
| 83 | /** | ||
| 84 | * The stream's data format (eg, AE_FMT_S16LE) | ||
| 85 | */ | ||
| 86 | enum AEDataFormat m_dataFormat; | ||
| 87 | |||
| 88 | /** | ||
| 89 | * The stream's sample rate (eg, 48000) | ||
| 90 | */ | ||
| 91 | unsigned int m_sampleRate; | ||
| 92 | |||
| 93 | /** | ||
| 94 | * The encoded streams sample rate if a bitstream, otherwise undefined | ||
| 95 | */ | ||
| 96 | unsigned int m_encodedRate; | ||
| 97 | |||
| 98 | /** | ||
| 99 | * The amount of used speaker channels | ||
| 100 | */ | ||
| 101 | unsigned int m_channelCount; | ||
| 102 | |||
| 103 | /** | ||
| 104 | * The stream's channel layout | ||
| 105 | */ | ||
| 106 | enum AEChannel m_channels[AE_CH_MAX]; | ||
| 107 | |||
| 108 | /** | ||
| 109 | * The number of frames per period | ||
| 110 | */ | ||
| 111 | unsigned int m_frames; | ||
| 112 | |||
| 113 | /** | ||
| 114 | * The size of one frame in bytes | ||
| 115 | */ | ||
| 116 | unsigned int m_frameSize; | ||
| 117 | |||
| 118 | AudioEngineFormat() | ||
| 119 | { | ||
| 120 | m_dataFormat = AE_FMT_INVALID; | ||
| 121 | m_sampleRate = 0; | ||
| 122 | m_encodedRate = 0; | ||
| 123 | m_frames = 0; | ||
| 124 | m_frameSize = 0; | ||
| 125 | m_channelCount = 0; | ||
| 126 | |||
| 127 | for (unsigned int ch = 0; ch < AE_CH_MAX; ch++) | ||
| 128 | { | ||
| 129 | m_channels[ch] = AE_CH_NULL; | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 133 | bool compareFormat(const AudioEngineFormat *fmt) | ||
| 134 | { | ||
| 135 | if (!fmt) | ||
| 136 | { | ||
| 137 | return false; | ||
| 138 | } | ||
| 139 | |||
| 140 | if (m_dataFormat != fmt->m_dataFormat || | ||
| 141 | m_sampleRate != fmt->m_sampleRate || | ||
| 142 | m_encodedRate != fmt->m_encodedRate || | ||
| 143 | m_frames != fmt->m_frames || | ||
| 144 | m_frameSize != fmt->m_frameSize || | ||
| 145 | m_channelCount != fmt->m_channelCount) | ||
| 146 | { | ||
| 147 | return false; | ||
| 148 | } | ||
| 149 | |||
| 150 | for (unsigned int ch = 0; ch < AE_CH_MAX; ch++) | ||
| 151 | { | ||
| 152 | if (fmt->m_channels[ch] != m_channels[ch]) | ||
| 153 | { | ||
| 154 | return false; | ||
| 155 | } | ||
| 156 | } | ||
| 157 | |||
| 158 | return true; | ||
| 159 | } | ||
| 160 | } AudioEngineFormat; | ||
| 161 | |||
| 162 | #ifdef __cplusplus | ||
| 163 | } | ||
| 164 | #endif | ||
| 165 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h new file mode 100644 index 0000000..6ecf566 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h | |||
| @@ -0,0 +1,257 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2016 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include "kodi_inputstream_types.h" | ||
| 24 | #include "xbmc_addon_dll.h" | ||
| 25 | |||
| 26 | /*! | ||
| 27 | * Functions that the InputStream client add-on must implement, but some can be empty. | ||
| 28 | * | ||
| 29 | * The 'remarks' field indicates which methods should be implemented, and which ones are optional. | ||
| 30 | */ | ||
| 31 | |||
| 32 | extern "C" | ||
| 33 | { | ||
| 34 | /*! | ||
| 35 | * Open a stream. | ||
| 36 | * @param props | ||
| 37 | * @return True if the stream has been opened successfully, false otherwise. | ||
| 38 | * @remarks | ||
| 39 | */ | ||
| 40 | bool Open(INPUTSTREAM& props); | ||
| 41 | |||
| 42 | /*! | ||
| 43 | * Close an open stream. | ||
| 44 | * @remarks | ||
| 45 | */ | ||
| 46 | void Close(void); | ||
| 47 | |||
| 48 | /*! | ||
| 49 | * Get path/url for this addon. | ||
| 50 | * @remarks | ||
| 51 | */ | ||
| 52 | const char* GetPathList(void); | ||
| 53 | |||
| 54 | /*! | ||
| 55 | * Get Capabilities of this addon. | ||
| 56 | * @remarks | ||
| 57 | */ | ||
| 58 | struct INPUTSTREAM_CAPABILITIES GetCapabilities(); | ||
| 59 | |||
| 60 | |||
| 61 | /*! | ||
| 62 | * Get IDs of available streams | ||
| 63 | * @remarks | ||
| 64 | */ | ||
| 65 | INPUTSTREAM_IDS GetStreamIds(); | ||
| 66 | |||
| 67 | /*! | ||
| 68 | * Get stream properties of a stream. | ||
| 69 | * @param streamId unique id of stream | ||
| 70 | * @return struc of stream properties | ||
| 71 | * @remarks | ||
| 72 | */ | ||
| 73 | INPUTSTREAM_INFO GetStream(int streamid); | ||
| 74 | |||
| 75 | /*! | ||
| 76 | * Enable or disable a stream. | ||
| 77 | * A disabled stream does not send demux packets | ||
| 78 | * @param streamId unique id of stream | ||
| 79 | * @param enable true for enable, false for disable | ||
| 80 | * @remarks | ||
| 81 | */ | ||
| 82 | void EnableStream(int streamid, bool enable); | ||
| 83 | |||
| 84 | /*! | ||
| 85 | * Enables a stream at the given PTS. | ||
| 86 | * @param streamId unique id of stream | ||
| 87 | * @param pts position in stream in microseconds | ||
| 88 | * @remarks will only be called if CAPABILITIES::m_supportsEnableAtPTS is set to true | ||
| 89 | */ | ||
| 90 | void EnableStreamAtPTS(int streamid, uint64_t pts); | ||
| 91 | |||
| 92 | /*! | ||
| 93 | * Reset the demultiplexer in the add-on. | ||
| 94 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 95 | */ | ||
| 96 | void DemuxReset(void); | ||
| 97 | |||
| 98 | /*! | ||
| 99 | * Abort the demultiplexer thread in the add-on. | ||
| 100 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 101 | */ | ||
| 102 | void DemuxAbort(void); | ||
| 103 | |||
| 104 | /*! | ||
| 105 | * Flush all data that's currently in the demultiplexer buffer in the add-on. | ||
| 106 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 107 | */ | ||
| 108 | void DemuxFlush(void); | ||
| 109 | |||
| 110 | /*! | ||
| 111 | * Read the next packet from the demultiplexer, if there is one. | ||
| 112 | * @return The next packet. | ||
| 113 | * If there is no next packet, then the add-on should return the | ||
| 114 | * packet created by calling AllocateDemuxPacket(0) on the callback. | ||
| 115 | * If the stream changed and XBMC's player needs to be reinitialised, | ||
| 116 | * then, the add-on should call AllocateDemuxPacket(0) on the | ||
| 117 | * callback, and set the streamid to DMX_SPECIALID_STREAMCHANGE and | ||
| 118 | * return the value. | ||
| 119 | * The add-on should return NULL if an error occured. | ||
| 120 | * @remarks Return NULL if this add-on won't provide this function. | ||
| 121 | */ | ||
| 122 | DemuxPacket* DemuxRead(void); | ||
| 123 | |||
| 124 | /*! | ||
| 125 | * Notify the InputStream addon/demuxer that XBMC wishes to seek the stream by time | ||
| 126 | * Demuxer is required to set stream to an IDR frame | ||
| 127 | * @param time The absolute time since stream start | ||
| 128 | * @param backwards True to seek to keyframe BEFORE time, else AFTER | ||
| 129 | * @param startpts can be updated to point to where display should start | ||
| 130 | * @return True if the seek operation was possible | ||
| 131 | * @remarks Optional, and only used if addon has its own demuxer. | ||
| 132 | */ | ||
| 133 | bool DemuxSeekTime(int time, bool backwards, double *startpts); | ||
| 134 | |||
| 135 | /*! | ||
| 136 | * Notify the InputStream addon/demuxer that XBMC wishes to change playback speed | ||
| 137 | * @param speed The requested playback speed | ||
| 138 | * @remarks Optional, and only used if addon has its own demuxer. | ||
| 139 | */ | ||
| 140 | void DemuxSetSpeed(int speed); | ||
| 141 | |||
| 142 | |||
| 143 | /*! | ||
| 144 | * Totel time in ms | ||
| 145 | * @remarks | ||
| 146 | */ | ||
| 147 | int GetTotalTime(); | ||
| 148 | |||
| 149 | /*! | ||
| 150 | * Playing time in ms | ||
| 151 | * @remarks | ||
| 152 | */ | ||
| 153 | int GetTime(); | ||
| 154 | |||
| 155 | /*! | ||
| 156 | * Positions inputstream to playing time given in ms | ||
| 157 | * @remarks | ||
| 158 | */ | ||
| 159 | bool PosTime(int ms); | ||
| 160 | |||
| 161 | |||
| 162 | /*! | ||
| 163 | * Check if the backend support pausing the currently playing stream | ||
| 164 | * This will enable/disable the pause button in XBMC based on the return value | ||
| 165 | * @return false if the InputStream addon/backend does not support pausing, true if possible | ||
| 166 | */ | ||
| 167 | bool CanPauseStream(); | ||
| 168 | |||
| 169 | /*! | ||
| 170 | * Check if the backend supports seeking for the currently playing stream | ||
| 171 | * This will enable/disable the rewind/forward buttons in XBMC based on the return value | ||
| 172 | * @return false if the InputStream addon/backend does not support seeking, true if possible | ||
| 173 | */ | ||
| 174 | bool CanSeekStream(); | ||
| 175 | |||
| 176 | |||
| 177 | /*! | ||
| 178 | * Read from an open stream. | ||
| 179 | * @param pBuffer The buffer to store the data in. | ||
| 180 | * @param iBufferSize The amount of bytes to read. | ||
| 181 | * @return The amount of bytes that were actually read from the stream. | ||
| 182 | * @remarks Return -1 if this add-on won't provide this function. | ||
| 183 | */ | ||
| 184 | int ReadStream(uint8_t* pBuffer, unsigned int iBufferSize); | ||
| 185 | |||
| 186 | /*! | ||
| 187 | * Seek in a stream. | ||
| 188 | * @param iPosition The position to seek to. | ||
| 189 | * @param iWhence ? | ||
| 190 | * @return The new position. | ||
| 191 | * @remarks Return -1 if this add-on won't provide this function. | ||
| 192 | */ | ||
| 193 | int64_t SeekStream(int64_t iPosition, int iWhence = SEEK_SET); | ||
| 194 | |||
| 195 | /*! | ||
| 196 | * @return The position in the stream that's currently being read. | ||
| 197 | * @remarks Return -1 if this add-on won't provide this function. | ||
| 198 | */ | ||
| 199 | int64_t PositionStream(void); | ||
| 200 | |||
| 201 | /*! | ||
| 202 | * @return The total length of the stream that's currently being read. | ||
| 203 | * @remarks Return -1 if this add-on won't provide this function. | ||
| 204 | */ | ||
| 205 | int64_t LengthStream(void); | ||
| 206 | |||
| 207 | |||
| 208 | /*! | ||
| 209 | * @brief Notify the InputStream addon that XBMC (un)paused the currently playing stream | ||
| 210 | */ | ||
| 211 | void PauseStream(double time); | ||
| 212 | |||
| 213 | |||
| 214 | /*! | ||
| 215 | * Check for real-time streaming | ||
| 216 | * @return true if current stream is real-time | ||
| 217 | */ | ||
| 218 | bool IsRealTimeStream(); | ||
| 219 | |||
| 220 | /*! | ||
| 221 | * Called by XBMC to assign the function pointers of this add-on to pClient. | ||
| 222 | * @param pClient The struct to assign the function pointers to. | ||
| 223 | */ | ||
| 224 | void __declspec(dllexport) get_addon(struct InputStreamAddonFunctions* pClient) | ||
| 225 | { | ||
| 226 | pClient->Open = Open; | ||
| 227 | pClient->Close = Close; | ||
| 228 | pClient->GetPathList = GetPathList; | ||
| 229 | pClient->GetCapabilities = GetCapabilities; | ||
| 230 | |||
| 231 | pClient->GetStreamIds = GetStreamIds; | ||
| 232 | pClient->GetStream = GetStream; | ||
| 233 | pClient->EnableStream = EnableStream; | ||
| 234 | pClient->EnableStreamAtPTS = EnableStreamAtPTS; | ||
| 235 | pClient->DemuxReset = DemuxReset; | ||
| 236 | pClient->DemuxAbort = DemuxAbort; | ||
| 237 | pClient->DemuxFlush = DemuxFlush; | ||
| 238 | pClient->DemuxRead = DemuxRead; | ||
| 239 | pClient->DemuxSeekTime = DemuxSeekTime; | ||
| 240 | pClient->DemuxSetSpeed = DemuxSetSpeed; | ||
| 241 | |||
| 242 | pClient->GetTotalTime = GetTotalTime; | ||
| 243 | pClient->GetTime = GetTime; | ||
| 244 | |||
| 245 | pClient->PosTime = PosTime; | ||
| 246 | |||
| 247 | pClient->CanPauseStream = CanPauseStream; | ||
| 248 | pClient->CanSeekStream = CanSeekStream; | ||
| 249 | |||
| 250 | pClient->ReadStream = ReadStream; | ||
| 251 | pClient->SeekStream = SeekStream; | ||
| 252 | pClient->PositionStream = PositionStream; | ||
| 253 | pClient->LengthStream = LengthStream; | ||
| 254 | pClient->PauseStream = PauseStream; | ||
| 255 | pClient->IsRealTimeStream = IsRealTimeStream; | ||
| 256 | }; | ||
| 257 | }; | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h new file mode 100644 index 0000000..33741d8 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h | |||
| @@ -0,0 +1,161 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2016 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifndef __cdecl | ||
| 24 | #define __cdecl | ||
| 25 | #endif | ||
| 26 | |||
| 27 | #ifdef BUILD_KODI_ADDON | ||
| 28 | #include "DVDDemuxPacket.h" | ||
| 29 | #else | ||
| 30 | #include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h" | ||
| 31 | #endif | ||
| 32 | |||
| 33 | extern "C" { | ||
| 34 | |||
| 35 | // this are properties given to the addon on create | ||
| 36 | // at this time we have no parameters for the addon | ||
| 37 | typedef struct INPUTSTREAM_PROPS | ||
| 38 | { | ||
| 39 | int dummy; | ||
| 40 | } INPUTSTREAM_PROPS; | ||
| 41 | |||
| 42 | /*! | ||
| 43 | * @brief InputStream add-on capabilities. All capabilities are set to "false" as default. | ||
| 44 | */ | ||
| 45 | typedef struct INPUTSTREAM_CAPABILITIES | ||
| 46 | { | ||
| 47 | bool m_supportsIDemux; /*!< @brief supports interface IDemux */ | ||
| 48 | bool m_supportsIPosTime; /*!< @brief supports interface IPosTime */ | ||
| 49 | bool m_supportsIDisplayTime; /*!< @brief supports interface IDisplayTime */ | ||
| 50 | bool m_supportsSeek; /*!< @brief supports seek */ | ||
| 51 | bool m_supportsPause; /*!< @brief supports pause */ | ||
| 52 | bool m_supportsEnableAtPTS; /*!< @brief supports enabling streams at a given PTS time */ | ||
| 53 | } INPUTSTREAM_CAPABILITIES; | ||
| 54 | |||
| 55 | /*! | ||
| 56 | * @brief structure of key/value pairs passed to addon on Open() | ||
| 57 | */ | ||
| 58 | typedef struct INPUTSTREAM | ||
| 59 | { | ||
| 60 | static const unsigned int MAX_INFO_COUNT = 8; | ||
| 61 | |||
| 62 | const char *m_strURL; | ||
| 63 | |||
| 64 | unsigned int m_nCountInfoValues; | ||
| 65 | struct LISTITEMPROPERTY | ||
| 66 | { | ||
| 67 | const char *m_strKey; | ||
| 68 | const char *m_strValue; | ||
| 69 | } m_ListItemProperties[MAX_INFO_COUNT]; | ||
| 70 | } INPUTSTREAM; | ||
| 71 | |||
| 72 | /*! | ||
| 73 | * @brief Array of stream IDs | ||
| 74 | */ | ||
| 75 | typedef struct INPUTSTREAM_IDS | ||
| 76 | { | ||
| 77 | static const unsigned int MAX_STREAM_COUNT = 32; | ||
| 78 | unsigned int m_streamCount; | ||
| 79 | unsigned int m_streamIds[MAX_STREAM_COUNT]; | ||
| 80 | } INPUTSTREAM_IDS; | ||
| 81 | |||
| 82 | /*! | ||
| 83 | * @brief stream properties | ||
| 84 | */ | ||
| 85 | typedef struct INPUTSTREAM_INFO | ||
| 86 | { | ||
| 87 | enum STREAM_TYPE | ||
| 88 | { | ||
| 89 | TYPE_NONE, | ||
| 90 | TYPE_VIDEO, | ||
| 91 | TYPE_AUDIO, | ||
| 92 | TYPE_SUBTITLE, | ||
| 93 | TYPE_TELETEXT | ||
| 94 | } m_streamType; | ||
| 95 | |||
| 96 | char m_codecName[32]; /*!< @brief (required) name of codec according to ffmpeg */ | ||
| 97 | char m_codecInternalName[32]; /*!< @brief (optional) internal name of codec (selectionstream info) */ | ||
| 98 | unsigned int m_pID; /*!< @brief (required) physical index */ | ||
| 99 | unsigned int m_Bandwidth; /*!< @brief (optional) bandwidth of the stream (selectionstream info) */ | ||
| 100 | |||
| 101 | const uint8_t *m_ExtraData; | ||
| 102 | unsigned int m_ExtraSize; | ||
| 103 | |||
| 104 | char m_language[4]; /*!< @brief ISO 639 3-letter language code (empty string if undefined) */ | ||
| 105 | |||
| 106 | unsigned int m_FpsScale; /*!< @brief Scale of 1000 and a rate of 29970 will result in 29.97 fps */ | ||
| 107 | unsigned int m_FpsRate; | ||
| 108 | unsigned int m_Height; /*!< @brief height of the stream reported by the demuxer */ | ||
| 109 | unsigned int m_Width; /*!< @brief width of the stream reported by the demuxer */ | ||
| 110 | float m_Aspect; /*!< @brief display aspect of stream */ | ||
| 111 | |||
| 112 | unsigned int m_Channels; /*!< @brief (required) amount of channels */ | ||
| 113 | unsigned int m_SampleRate; /*!< @brief (required) sample rate */ | ||
| 114 | unsigned int m_BitRate; /*!< @brief (required) bit rate */ | ||
| 115 | unsigned int m_BitsPerSample; /*!< @brief (required) bits per sample */ | ||
| 116 | unsigned int m_BlockAlign; | ||
| 117 | } INPUTSTREAM_INFO; | ||
| 118 | |||
| 119 | /*! | ||
| 120 | * @brief Structure to transfer the methods from xbmc_inputstream_dll.h to XBMC | ||
| 121 | */ | ||
| 122 | typedef struct InputStreamAddonFunctions | ||
| 123 | { | ||
| 124 | bool (__cdecl* Open)(INPUTSTREAM&); | ||
| 125 | void (__cdecl* Close)(void); | ||
| 126 | const char* (__cdecl* GetPathList)(void); | ||
| 127 | struct INPUTSTREAM_CAPABILITIES (__cdecl* GetCapabilities)(void); | ||
| 128 | |||
| 129 | // IDemux | ||
| 130 | struct INPUTSTREAM_IDS (__cdecl* GetStreamIds)(); | ||
| 131 | struct INPUTSTREAM_INFO (__cdecl* GetStream)(int); | ||
| 132 | void (__cdecl* EnableStream)(int, bool); | ||
| 133 | void (__cdecl* EnableStreamAtPTS)(int, uint64_t); | ||
| 134 | void (__cdecl* DemuxReset)(void); | ||
| 135 | void (__cdecl* DemuxAbort)(void); | ||
| 136 | void (__cdecl* DemuxFlush)(void); | ||
| 137 | DemuxPacket* (__cdecl* DemuxRead)(void); | ||
| 138 | bool (__cdecl* DemuxSeekTime)(int, bool, double*); | ||
| 139 | void (__cdecl* DemuxSetSpeed)(int); | ||
| 140 | |||
| 141 | // IDisplayTime | ||
| 142 | int (__cdecl* GetTotalTime)(void); | ||
| 143 | int (__cdecl* GetTime)(void); | ||
| 144 | |||
| 145 | // IPosTime | ||
| 146 | bool (__cdecl* PosTime)(int); | ||
| 147 | |||
| 148 | // Seekable (mandatory) | ||
| 149 | bool (__cdecl* CanPauseStream)(void); | ||
| 150 | bool (__cdecl* CanSeekStream)(void); | ||
| 151 | |||
| 152 | int (__cdecl* ReadStream)(uint8_t*, unsigned int); | ||
| 153 | int64_t(__cdecl* SeekStream)(int64_t, int); | ||
| 154 | int64_t (__cdecl* PositionStream)(void); | ||
| 155 | int64_t (__cdecl* LengthStream)(void); | ||
| 156 | void (__cdecl* PauseStream)(double); | ||
| 157 | bool (__cdecl* IsRealTimeStream)(void); | ||
| 158 | } InputStreamAddonFunctions; | ||
| 159 | } | ||
| 160 | |||
| 161 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h new file mode 100644 index 0000000..46e34a6 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h | |||
| @@ -0,0 +1,232 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2014 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> | ||
| 23 | #include <vector> | ||
| 24 | #include <string.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | #include <stdio.h> | ||
| 27 | #include "kodi_adsp_types.h" | ||
| 28 | #include "libXBMC_addon.h" | ||
| 29 | |||
| 30 | typedef void* ADSPHANDLE; | ||
| 31 | |||
| 32 | #ifdef _WIN32 | ||
| 33 | #define ADSP_HELPER_DLL "\\library.kodi.adsp\\libKODI_adsp" ADDON_HELPER_EXT | ||
| 34 | #else | ||
| 35 | #define ADSP_HELPER_DLL_NAME "libKODI_adsp-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 36 | #define ADSP_HELPER_DLL "/library.kodi.adsp/" ADSP_HELPER_DLL_NAME | ||
| 37 | #endif | ||
| 38 | |||
| 39 | class CAddonSoundPlay; | ||
| 40 | |||
| 41 | class CHelper_libKODI_adsp | ||
| 42 | { | ||
| 43 | public: | ||
| 44 | CHelper_libKODI_adsp(void) | ||
| 45 | { | ||
| 46 | m_libKODI_adsp = NULL; | ||
| 47 | m_Handle = NULL; | ||
| 48 | } | ||
| 49 | |||
| 50 | ~CHelper_libKODI_adsp(void) | ||
| 51 | { | ||
| 52 | if (m_libKODI_adsp) | ||
| 53 | { | ||
| 54 | ADSP_unregister_me(m_Handle, m_Callbacks); | ||
| 55 | dlclose(m_libKODI_adsp); | ||
| 56 | } | ||
| 57 | } | ||
| 58 | |||
| 59 | /*! | ||
| 60 | * @brief Resolve all callback methods | ||
| 61 | * @param handle Pointer to the add-on | ||
| 62 | * @return True when all methods were resolved, false otherwise. | ||
| 63 | */ | ||
| 64 | bool RegisterMe(void* handle) | ||
| 65 | { | ||
| 66 | m_Handle = handle; | ||
| 67 | |||
| 68 | std::string libBasePath; | ||
| 69 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 70 | libBasePath += ADSP_HELPER_DLL; | ||
| 71 | |||
| 72 | #if defined(ANDROID) | ||
| 73 | struct stat st; | ||
| 74 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 75 | { | ||
| 76 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 77 | libBasePath = tempbin + "/" + ADSP_HELPER_DLL_NAME; | ||
| 78 | } | ||
| 79 | #endif | ||
| 80 | |||
| 81 | m_libKODI_adsp = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 82 | if (m_libKODI_adsp == NULL) | ||
| 83 | { | ||
| 84 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 85 | return false; | ||
| 86 | } | ||
| 87 | |||
| 88 | ADSP_register_me = (void* (*)(void *HANDLE)) | ||
| 89 | dlsym(m_libKODI_adsp, "ADSP_register_me"); | ||
| 90 | if (ADSP_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 91 | |||
| 92 | ADSP_unregister_me = (void (*)(void* HANDLE, void* CB)) | ||
| 93 | dlsym(m_libKODI_adsp, "ADSP_unregister_me"); | ||
| 94 | if (ADSP_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 95 | |||
| 96 | ADSP_add_menu_hook = (void (*)(void* HANDLE, void* CB, AE_DSP_MENUHOOK *hook)) | ||
| 97 | dlsym(m_libKODI_adsp, "ADSP_add_menu_hook"); | ||
| 98 | if (ADSP_add_menu_hook == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 99 | |||
| 100 | ADSP_remove_menu_hook = (void (*)(void* HANDLE, void* CB, AE_DSP_MENUHOOK *hook)) | ||
| 101 | dlsym(m_libKODI_adsp, "ADSP_remove_menu_hook"); | ||
| 102 | if (ADSP_remove_menu_hook == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 103 | |||
| 104 | ADSP_register_mode = (void (*)(void *HANDLE, void* CB, AE_DSP_MODES::AE_DSP_MODE *modes)) | ||
| 105 | dlsym(m_libKODI_adsp, "ADSP_register_mode"); | ||
| 106 | if (ADSP_register_mode == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 107 | |||
| 108 | ADSP_unregister_mode = (void (*)(void* HANDLE, void* CB, AE_DSP_MODES::AE_DSP_MODE *modes)) | ||
| 109 | dlsym(m_libKODI_adsp, "ADSP_unregister_mode"); | ||
| 110 | if (ADSP_unregister_mode == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 111 | |||
| 112 | ADSP_get_sound_play = (CAddonSoundPlay* (*)(void *HANDLE, void *CB, const char *filename)) | ||
| 113 | dlsym(m_libKODI_adsp, "ADSP_get_sound_play"); | ||
| 114 | if (ADSP_get_sound_play == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 115 | |||
| 116 | ADSP_release_sound_play = (void (*)(CAddonSoundPlay* p)) | ||
| 117 | dlsym(m_libKODI_adsp, "ADSP_release_sound_play"); | ||
| 118 | if (ADSP_release_sound_play == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 119 | |||
| 120 | m_Callbacks = ADSP_register_me(m_Handle); | ||
| 121 | return m_Callbacks != NULL; | ||
| 122 | } | ||
| 123 | |||
| 124 | /*! | ||
| 125 | * @brief Add or replace a menu hook for the context menu for this add-on | ||
| 126 | * @param hook The hook to add | ||
| 127 | */ | ||
| 128 | void AddMenuHook(AE_DSP_MENUHOOK* hook) | ||
| 129 | { | ||
| 130 | return ADSP_add_menu_hook(m_Handle, m_Callbacks, hook); | ||
| 131 | } | ||
| 132 | |||
| 133 | /*! | ||
| 134 | * @brief Remove a menu hook for the context menu for this add-on | ||
| 135 | * @param hook The hook to remove | ||
| 136 | */ | ||
| 137 | void RemoveMenuHook(AE_DSP_MENUHOOK* hook) | ||
| 138 | { | ||
| 139 | return ADSP_remove_menu_hook(m_Handle, m_Callbacks, hook); | ||
| 140 | } | ||
| 141 | |||
| 142 | /*! | ||
| 143 | * @brief Add or replace master mode information inside audio dsp database. | ||
| 144 | * Becomes identifier written inside mode to iModeID if it was 0 (undefined) | ||
| 145 | * @param mode The master mode to add or update inside database | ||
| 146 | */ | ||
| 147 | void RegisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) | ||
| 148 | { | ||
| 149 | return ADSP_register_mode(m_Handle, m_Callbacks, mode); | ||
| 150 | } | ||
| 151 | |||
| 152 | /*! | ||
| 153 | * @brief Remove a master mode from audio dsp database | ||
| 154 | * @param mode The Mode to remove | ||
| 155 | */ | ||
| 156 | void UnregisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) | ||
| 157 | { | ||
| 158 | return ADSP_unregister_mode(m_Handle, m_Callbacks, mode); | ||
| 159 | } | ||
| 160 | |||
| 161 | /*! | ||
| 162 | * @brief Open a sound playing class | ||
| 163 | * @param filename The wav filename to open | ||
| 164 | */ | ||
| 165 | CAddonSoundPlay* GetSoundPlay(const char *filename) | ||
| 166 | { | ||
| 167 | return ADSP_get_sound_play(m_Handle, m_Callbacks, filename); | ||
| 168 | } | ||
| 169 | |||
| 170 | /*! | ||
| 171 | * @brief Remove a played file class | ||
| 172 | * @param p The playback to remove | ||
| 173 | */ | ||
| 174 | void ReleaseSoundPlay(CAddonSoundPlay* p) | ||
| 175 | { | ||
| 176 | return ADSP_release_sound_play(p); | ||
| 177 | } | ||
| 178 | |||
| 179 | protected: | ||
| 180 | void* (*ADSP_register_me)(void*); | ||
| 181 | |||
| 182 | void (*ADSP_unregister_me)(void*, void*); | ||
| 183 | void (*ADSP_add_menu_hook)(void*, void*, AE_DSP_MENUHOOK*); | ||
| 184 | void (*ADSP_remove_menu_hook)(void*, void*, AE_DSP_MENUHOOK*); | ||
| 185 | void (*ADSP_register_mode)(void*, void*, AE_DSP_MODES::AE_DSP_MODE*); | ||
| 186 | void (*ADSP_unregister_mode)(void*, void*, AE_DSP_MODES::AE_DSP_MODE*); | ||
| 187 | CAddonSoundPlay* (*ADSP_get_sound_play)(void*, void*, const char *); | ||
| 188 | void (*ADSP_release_sound_play)(CAddonSoundPlay*); | ||
| 189 | |||
| 190 | private: | ||
| 191 | void* m_libKODI_adsp; | ||
| 192 | void* m_Handle; | ||
| 193 | void* m_Callbacks; | ||
| 194 | struct cb_array | ||
| 195 | { | ||
| 196 | const char* libPath; | ||
| 197 | }; | ||
| 198 | }; | ||
| 199 | |||
| 200 | class CAddonSoundPlay | ||
| 201 | { | ||
| 202 | public: | ||
| 203 | CAddonSoundPlay(void *hdl, void *cb, const char *filename); | ||
| 204 | virtual ~CAddonSoundPlay(); | ||
| 205 | |||
| 206 | /*! play the sound this object represents */ | ||
| 207 | virtual void Play(); | ||
| 208 | |||
| 209 | /*! stop playing the sound this object represents */ | ||
| 210 | virtual void Stop(); | ||
| 211 | |||
| 212 | /*! return true if the sound is currently playing */ | ||
| 213 | virtual bool IsPlaying(); | ||
| 214 | |||
| 215 | /*! set the playback channel position of this sound, AE_DSP_CH_INVALID for all */ | ||
| 216 | virtual void SetChannel(AE_DSP_CHANNEL channel); | ||
| 217 | |||
| 218 | /*! get the current playback volume of this sound, AE_DSP_CH_INVALID for all */ | ||
| 219 | virtual AE_DSP_CHANNEL GetChannel(); | ||
| 220 | |||
| 221 | /*! set the playback volume of this sound */ | ||
| 222 | virtual void SetVolume(float volume); | ||
| 223 | |||
| 224 | /*! get the current playback volume of this sound */ | ||
| 225 | virtual float GetVolume(); | ||
| 226 | |||
| 227 | private: | ||
| 228 | std::string m_Filename; | ||
| 229 | void *m_Handle; | ||
| 230 | void *m_cb; | ||
| 231 | ADSPHANDLE m_PlayHandle; | ||
| 232 | }; | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h new file mode 100644 index 0000000..f541637 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h | |||
| @@ -0,0 +1,324 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2014 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 <stdio.h> | ||
| 23 | #include <stdlib.h> | ||
| 24 | #include <string> | ||
| 25 | #include <string.h> | ||
| 26 | #include <vector> | ||
| 27 | |||
| 28 | #include "kodi_audioengine_types.h" | ||
| 29 | #ifdef BUILD_KODI_ADDON | ||
| 30 | #include "kodi/AudioEngine/AEChannelData.h" | ||
| 31 | #include "kodi/AudioEngine/AEChannelInfo.h" | ||
| 32 | #include "kodi/AudioEngine/AEStreamData.h" | ||
| 33 | #else | ||
| 34 | #include "cores/AudioEngine/Utils/AEChannelData.h" | ||
| 35 | #include "cores/AudioEngine/Utils/AEChannelInfo.h" | ||
| 36 | #include "cores/AudioEngine/Utils/AEStreamData.h" | ||
| 37 | #endif | ||
| 38 | |||
| 39 | #include "libXBMC_addon.h" | ||
| 40 | |||
| 41 | #ifdef _WIN32 | ||
| 42 | #define AUDIOENGINE_HELPER_DLL "\\library.kodi.audioengine\\libKODI_audioengine" ADDON_HELPER_EXT | ||
| 43 | #else | ||
| 44 | #define AUDIOENGINE_HELPER_DLL_NAME "libKODI_audioengine-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 45 | #define AUDIOENGINE_HELPER_DLL "/library.kodi.audioengine/" AUDIOENGINE_HELPER_DLL_NAME | ||
| 46 | #endif | ||
| 47 | |||
| 48 | class CAddonAEStream; | ||
| 49 | |||
| 50 | class CHelper_libKODI_audioengine | ||
| 51 | { | ||
| 52 | public: | ||
| 53 | CHelper_libKODI_audioengine(void) | ||
| 54 | { | ||
| 55 | m_libKODI_audioengine = NULL; | ||
| 56 | m_Handle = NULL; | ||
| 57 | } | ||
| 58 | |||
| 59 | ~CHelper_libKODI_audioengine(void) | ||
| 60 | { | ||
| 61 | if (m_libKODI_audioengine) | ||
| 62 | { | ||
| 63 | AudioEngine_unregister_me(m_Handle, m_Callbacks); | ||
| 64 | dlclose(m_libKODI_audioengine); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| 68 | /*! | ||
| 69 | * @brief Resolve all callback methods | ||
| 70 | * @param handle Pointer to the add-on | ||
| 71 | * @return True when all methods were resolved, false otherwise. | ||
| 72 | */ | ||
| 73 | bool RegisterMe(void* handle) | ||
| 74 | { | ||
| 75 | m_Handle = handle; | ||
| 76 | |||
| 77 | std::string libBasePath; | ||
| 78 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 79 | libBasePath += AUDIOENGINE_HELPER_DLL; | ||
| 80 | |||
| 81 | #if defined(ANDROID) | ||
| 82 | struct stat st; | ||
| 83 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 84 | { | ||
| 85 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 86 | libBasePath = tempbin + "/" + AUDIOENGINE_HELPER_DLL; | ||
| 87 | } | ||
| 88 | #endif | ||
| 89 | |||
| 90 | m_libKODI_audioengine = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 91 | if (m_libKODI_audioengine == NULL) | ||
| 92 | { | ||
| 93 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 94 | return false; | ||
| 95 | } | ||
| 96 | |||
| 97 | AudioEngine_register_me = (void* (*)(void *HANDLE)) | ||
| 98 | dlsym(m_libKODI_audioengine, "AudioEngine_register_me"); | ||
| 99 | if (AudioEngine_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 100 | |||
| 101 | AudioEngine_unregister_me = (void(*)(void* HANDLE, void* CB)) | ||
| 102 | dlsym(m_libKODI_audioengine, "AudioEngine_unregister_me"); | ||
| 103 | if (AudioEngine_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 104 | |||
| 105 | AudioEngine_MakeStream = (CAddonAEStream* (*)(void*, void*, AudioEngineFormat, unsigned int)) | ||
| 106 | dlsym(m_libKODI_audioengine, "AudioEngine_make_stream"); | ||
| 107 | if (AudioEngine_MakeStream == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 108 | |||
| 109 | AudioEngine_FreeStream = (void(*)(CAddonAEStream*)) | ||
| 110 | dlsym(m_libKODI_audioengine, "AudioEngine_free_stream"); | ||
| 111 | if (AudioEngine_FreeStream == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 112 | |||
| 113 | AudioEngine_GetCurrentSinkFormat = (bool(*)(void*, void*, AudioEngineFormat*)) | ||
| 114 | dlsym(m_libKODI_audioengine, "AudioEngine_get_current_sink_Format"); | ||
| 115 | if (AudioEngine_GetCurrentSinkFormat == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 116 | |||
| 117 | m_Callbacks = AudioEngine_register_me(m_Handle); | ||
| 118 | return m_Callbacks != NULL; | ||
| 119 | } | ||
| 120 | |||
| 121 | /** | ||
| 122 | * Creates and returns a new handle to an IAEStream in the format specified, this function should never fail | ||
| 123 | * @param DataFormat The data format the incoming audio will be in (eg, AE_FMT_S16LE) | ||
| 124 | * @param SampleRate The sample rate of the audio data (eg, 48000) | ||
| 125 | * @param ChannelLayout The order of the channels in the audio data | ||
| 126 | * @param Options A bit field of stream options (see: enum AEStreamOptions) | ||
| 127 | * @return a new Handle to an IAEStream that will accept data in the requested format | ||
| 128 | */ | ||
| 129 | CAddonAEStream* MakeStream(AudioEngineFormat Format, unsigned int Options = 0) | ||
| 130 | { | ||
| 131 | return AudioEngine_MakeStream(m_Handle, m_Callbacks, Format, Options); | ||
| 132 | } | ||
| 133 | |||
| 134 | /** | ||
| 135 | * This method will remove the specifyed stream from the engine. | ||
| 136 | * For OSX/IOS this is essential to reconfigure the audio output. | ||
| 137 | * @param stream The stream to be altered | ||
| 138 | * @return NULL | ||
| 139 | */ | ||
| 140 | void FreeStream(CAddonAEStream **Stream) | ||
| 141 | { | ||
| 142 | AudioEngine_FreeStream(*Stream); | ||
| 143 | *Stream = NULL; | ||
| 144 | } | ||
| 145 | |||
| 146 | /** | ||
| 147 | * Get the current sink data format | ||
| 148 | * | ||
| 149 | * @param Current sink data format. For more details see AudioEngineFormat. | ||
| 150 | * @return Returns true on success, else false. | ||
| 151 | */ | ||
| 152 | bool GetCurrentSinkFormat(AudioEngineFormat &SinkFormat) | ||
| 153 | { | ||
| 154 | return AudioEngine_GetCurrentSinkFormat(m_Handle, m_Callbacks, &SinkFormat); | ||
| 155 | } | ||
| 156 | |||
| 157 | protected: | ||
| 158 | void* (*AudioEngine_register_me)(void*); | ||
| 159 | void (*AudioEngine_unregister_me)(void*, void*); | ||
| 160 | CAddonAEStream* (*AudioEngine_MakeStream)(void*, void*, AudioEngineFormat, unsigned int); | ||
| 161 | bool (*AudioEngine_GetCurrentSinkFormat)(void*, void*, AudioEngineFormat *SinkFormat); | ||
| 162 | void (*AudioEngine_FreeStream)(CAddonAEStream*); | ||
| 163 | |||
| 164 | private: | ||
| 165 | void* m_libKODI_audioengine; | ||
| 166 | void* m_Handle; | ||
| 167 | void* m_Callbacks; | ||
| 168 | struct cb_array | ||
| 169 | { | ||
| 170 | const char* libPath; | ||
| 171 | }; | ||
| 172 | }; | ||
| 173 | |||
| 174 | // Audio Engine Stream Class | ||
| 175 | class CAddonAEStream | ||
| 176 | { | ||
| 177 | public: | ||
| 178 | CAddonAEStream(void *Addon, void *Callbacks, AEStreamHandle *StreamHandle); | ||
| 179 | virtual ~CAddonAEStream(); | ||
| 180 | |||
| 181 | /** | ||
| 182 | * Returns the amount of space available in the stream | ||
| 183 | * @return The number of bytes AddData will consume | ||
| 184 | */ | ||
| 185 | virtual unsigned int GetSpace(); | ||
| 186 | |||
| 187 | /** | ||
| 188 | * Add planar or interleaved PCM data to the stream | ||
| 189 | * @param Data array of pointers to the planes | ||
| 190 | * @param Offset to frame in frames | ||
| 191 | * @param Frames number of frames | ||
| 192 | * @return The number of frames consumed | ||
| 193 | */ | ||
| 194 | virtual unsigned int AddData(uint8_t* const *Data, unsigned int Offset, unsigned int Frames); | ||
| 195 | |||
| 196 | /** | ||
| 197 | * Returns the time in seconds that it will take | ||
| 198 | * for the next added packet to be heard from the speakers. | ||
| 199 | * @return seconds | ||
| 200 | */ | ||
| 201 | virtual double GetDelay(); | ||
| 202 | |||
| 203 | /** | ||
| 204 | * Returns if the stream is buffering | ||
| 205 | * @return True if the stream is buffering | ||
| 206 | */ | ||
| 207 | virtual bool IsBuffering(); | ||
| 208 | |||
| 209 | /** | ||
| 210 | * Returns the time in seconds that it will take | ||
| 211 | * to underrun the cache if no sample is added. | ||
| 212 | * @return seconds | ||
| 213 | */ | ||
| 214 | virtual double GetCacheTime(); | ||
| 215 | |||
| 216 | /** | ||
| 217 | * Returns the total time in seconds of the cache | ||
| 218 | * @return seconds | ||
| 219 | */ | ||
| 220 | virtual double GetCacheTotal(); | ||
| 221 | |||
| 222 | /** | ||
| 223 | * Pauses the stream playback | ||
| 224 | */ | ||
| 225 | virtual void Pause(); | ||
| 226 | |||
| 227 | /** | ||
| 228 | * Resumes the stream after pausing | ||
| 229 | */ | ||
| 230 | virtual void Resume(); | ||
| 231 | |||
| 232 | /** | ||
| 233 | * Start draining the stream | ||
| 234 | * @note Once called AddData will not consume more data. | ||
| 235 | */ | ||
| 236 | virtual void Drain(bool Wait); | ||
| 237 | |||
| 238 | /** | ||
| 239 | * Returns true if the is stream draining | ||
| 240 | */ | ||
| 241 | virtual bool IsDraining(); | ||
| 242 | |||
| 243 | /** | ||
| 244 | * Returns true if the is stream has finished draining | ||
| 245 | */ | ||
| 246 | virtual bool IsDrained(); | ||
| 247 | |||
| 248 | /** | ||
| 249 | * Flush all buffers dropping the audio data | ||
| 250 | */ | ||
| 251 | virtual void Flush(); | ||
| 252 | |||
| 253 | /** | ||
| 254 | * Return the stream's current volume level | ||
| 255 | * @return The volume level between 0.0 and 1.0 | ||
| 256 | */ | ||
| 257 | virtual float GetVolume(); | ||
| 258 | |||
| 259 | /** | ||
| 260 | * Set the stream's volume level | ||
| 261 | * @param volume The new volume level between 0.0 and 1.0 | ||
| 262 | */ | ||
| 263 | virtual void SetVolume(float Volume); | ||
| 264 | |||
| 265 | /** | ||
| 266 | * Gets the stream's volume amplification in linear units. | ||
| 267 | * @return The volume amplification factor between 1.0 and 1000.0 | ||
| 268 | */ | ||
| 269 | virtual float GetAmplification(); | ||
| 270 | |||
| 271 | /** | ||
| 272 | * Sets the stream's volume amplification in linear units. | ||
| 273 | * @param The volume amplification factor between 1.0 and 1000.0 | ||
| 274 | */ | ||
| 275 | virtual void SetAmplification(float Amplify); | ||
| 276 | |||
| 277 | /** | ||
| 278 | * Returns the size of one audio frame in bytes (channelCount * resolution) | ||
| 279 | * @return The size in bytes of one frame | ||
| 280 | */ | ||
| 281 | virtual const unsigned int GetFrameSize() const; | ||
| 282 | |||
| 283 | /** | ||
| 284 | * Returns the number of channels the stream is configured to accept | ||
| 285 | * @return The channel count | ||
| 286 | */ | ||
| 287 | virtual const unsigned int GetChannelCount() const; | ||
| 288 | |||
| 289 | /** | ||
| 290 | * Returns the stream's sample rate, if the stream is using a dynamic sample rate, this value will NOT reflect any changes made by calls to SetResampleRatio() | ||
| 291 | * @return The stream's sample rate (eg, 48000) | ||
| 292 | */ | ||
| 293 | virtual const unsigned int GetSampleRate() const; | ||
| 294 | |||
| 295 | /** | ||
| 296 | * Return the data format the stream has been configured with | ||
| 297 | * @return The stream's data format (eg, AE_FMT_S16LE) | ||
| 298 | */ | ||
| 299 | virtual const AEDataFormat GetDataFormat() const; | ||
| 300 | |||
| 301 | /** | ||
| 302 | * Return the resample ratio | ||
| 303 | * @note This will return an undefined value if the stream is not resampling | ||
| 304 | * @return the current resample ratio or undefined if the stream is not resampling | ||
| 305 | */ | ||
| 306 | virtual double GetResampleRatio(); | ||
| 307 | |||
| 308 | /** | ||
| 309 | * Sets the resample ratio | ||
| 310 | * @note This function may return false if the stream is not resampling, if you wish to use this be sure to set the AESTREAM_FORCE_RESAMPLE option | ||
| 311 | * @param ratio the new sample rate ratio, calculated by ((double)desiredRate / (double)GetSampleRate()) | ||
| 312 | */ | ||
| 313 | virtual void SetResampleRatio(double Ratio); | ||
| 314 | |||
| 315 | /** | ||
| 316 | * Sginal a clock change | ||
| 317 | */ | ||
| 318 | virtual void Discontinuity(); | ||
| 319 | |||
| 320 | private: | ||
| 321 | AEStreamHandle *m_StreamHandle; | ||
| 322 | void *m_Callbacks; | ||
| 323 | void *m_AddonHandle; | ||
| 324 | }; | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h new file mode 100644 index 0000000..bdaeb4c --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h | |||
| @@ -0,0 +1,845 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 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 XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string> | ||
| 23 | #include <vector> | ||
| 24 | #include <string.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | #include <stdio.h> | ||
| 27 | #include "libXBMC_addon.h" | ||
| 28 | |||
| 29 | typedef void* GUIHANDLE; | ||
| 30 | |||
| 31 | #ifdef _WIN32 | ||
| 32 | #define GUI_HELPER_DLL "\\library.kodi.guilib\\libKODI_guilib" ADDON_HELPER_EXT | ||
| 33 | #else | ||
| 34 | #define GUI_HELPER_DLL_NAME "libKODI_guilib-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 35 | #define GUI_HELPER_DLL "/library.kodi.guilib/" GUI_HELPER_DLL_NAME | ||
| 36 | #endif | ||
| 37 | |||
| 38 | /* current ADDONGUI API version */ | ||
| 39 | #define KODI_GUILIB_API_VERSION "5.11.0" | ||
| 40 | |||
| 41 | /* min. ADDONGUI API version */ | ||
| 42 | #define KODI_GUILIB_MIN_API_VERSION "5.10.0" | ||
| 43 | |||
| 44 | #define ADDON_ACTION_PREVIOUS_MENU 10 | ||
| 45 | #define ADDON_ACTION_CLOSE_DIALOG 51 | ||
| 46 | #define ADDON_ACTION_NAV_BACK 92 | ||
| 47 | |||
| 48 | class CAddonGUIWindow; | ||
| 49 | class CAddonGUISpinControl; | ||
| 50 | class CAddonGUIRadioButton; | ||
| 51 | class CAddonGUIProgressControl; | ||
| 52 | class CAddonListItem; | ||
| 53 | class CAddonGUIRenderingControl; | ||
| 54 | class CAddonGUISliderControl; | ||
| 55 | class CAddonGUISettingsSliderControl; | ||
| 56 | |||
| 57 | class CHelper_libKODI_guilib | ||
| 58 | { | ||
| 59 | public: | ||
| 60 | CHelper_libKODI_guilib() | ||
| 61 | { | ||
| 62 | m_libKODI_guilib = NULL; | ||
| 63 | m_Handle = NULL; | ||
| 64 | } | ||
| 65 | |||
| 66 | ~CHelper_libKODI_guilib() | ||
| 67 | { | ||
| 68 | if (m_libKODI_guilib) | ||
| 69 | { | ||
| 70 | GUI_unregister_me(m_Handle, m_Callbacks); | ||
| 71 | dlclose(m_libKODI_guilib); | ||
| 72 | } | ||
| 73 | } | ||
| 74 | |||
| 75 | bool RegisterMe(void *Handle) | ||
| 76 | { | ||
| 77 | m_Handle = Handle; | ||
| 78 | |||
| 79 | std::string libBasePath; | ||
| 80 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 81 | libBasePath += GUI_HELPER_DLL; | ||
| 82 | |||
| 83 | #if defined(ANDROID) | ||
| 84 | struct stat st; | ||
| 85 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 86 | { | ||
| 87 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 88 | libBasePath = tempbin + "/" + GUI_HELPER_DLL_NAME; | ||
| 89 | } | ||
| 90 | #endif | ||
| 91 | |||
| 92 | m_libKODI_guilib = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 93 | if (m_libKODI_guilib == NULL) | ||
| 94 | { | ||
| 95 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 96 | return false; | ||
| 97 | } | ||
| 98 | |||
| 99 | GUI_register_me = (void* (*)(void *HANDLE)) | ||
| 100 | dlsym(m_libKODI_guilib, "GUI_register_me"); | ||
| 101 | if (GUI_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 102 | |||
| 103 | GUI_unregister_me = (void (*)(void *HANDLE, void *CB)) | ||
| 104 | dlsym(m_libKODI_guilib, "GUI_unregister_me"); | ||
| 105 | if (GUI_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 106 | |||
| 107 | GUI_lock = (void (*)(void *HANDLE, void *CB)) | ||
| 108 | dlsym(m_libKODI_guilib, "GUI_lock"); | ||
| 109 | if (GUI_lock == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 110 | |||
| 111 | GUI_unlock = (void (*)(void *HANDLE, void *CB)) | ||
| 112 | dlsym(m_libKODI_guilib, "GUI_unlock"); | ||
| 113 | if (GUI_unlock == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 114 | |||
| 115 | GUI_get_screen_height = (int (*)(void *HANDLE, void *CB)) | ||
| 116 | dlsym(m_libKODI_guilib, "GUI_get_screen_height"); | ||
| 117 | if (GUI_get_screen_height == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 118 | |||
| 119 | GUI_get_screen_width = (int (*)(void *HANDLE, void *CB)) | ||
| 120 | dlsym(m_libKODI_guilib, "GUI_get_screen_width"); | ||
| 121 | if (GUI_get_screen_width == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 122 | |||
| 123 | GUI_get_video_resolution = (int (*)(void *HANDLE, void *CB)) | ||
| 124 | dlsym(m_libKODI_guilib, "GUI_get_video_resolution"); | ||
| 125 | if (GUI_get_video_resolution == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 126 | |||
| 127 | GUI_Window_create = (CAddonGUIWindow* (*)(void *HANDLE, void *CB, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog)) | ||
| 128 | dlsym(m_libKODI_guilib, "GUI_Window_create"); | ||
| 129 | if (GUI_Window_create == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 130 | |||
| 131 | GUI_Window_destroy = (void (*)(CAddonGUIWindow* p)) | ||
| 132 | dlsym(m_libKODI_guilib, "GUI_Window_destroy"); | ||
| 133 | if (GUI_Window_destroy == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 134 | |||
| 135 | GUI_control_get_spin = (CAddonGUISpinControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) | ||
| 136 | dlsym(m_libKODI_guilib, "GUI_control_get_spin"); | ||
| 137 | if (GUI_control_get_spin == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 138 | |||
| 139 | GUI_control_release_spin = (void (*)(CAddonGUISpinControl* p)) | ||
| 140 | dlsym(m_libKODI_guilib, "GUI_control_release_spin"); | ||
| 141 | if (GUI_control_release_spin == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 142 | |||
| 143 | GUI_control_get_radiobutton = (CAddonGUIRadioButton* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) | ||
| 144 | dlsym(m_libKODI_guilib, "GUI_control_get_radiobutton"); | ||
| 145 | if (GUI_control_get_radiobutton == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 146 | |||
| 147 | GUI_control_release_radiobutton = (void (*)(CAddonGUIRadioButton* p)) | ||
| 148 | dlsym(m_libKODI_guilib, "GUI_control_release_radiobutton"); | ||
| 149 | if (GUI_control_release_radiobutton == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 150 | |||
| 151 | GUI_control_get_progress = (CAddonGUIProgressControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) | ||
| 152 | dlsym(m_libKODI_guilib, "GUI_control_get_progress"); | ||
| 153 | if (GUI_control_get_progress == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 154 | |||
| 155 | GUI_control_release_progress = (void (*)(CAddonGUIProgressControl* p)) | ||
| 156 | dlsym(m_libKODI_guilib, "GUI_control_release_progress"); | ||
| 157 | if (GUI_control_release_progress == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 158 | |||
| 159 | GUI_ListItem_create = (CAddonListItem* (*)(void *HANDLE, void *CB, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path)) | ||
| 160 | dlsym(m_libKODI_guilib, "GUI_ListItem_create"); | ||
| 161 | if (GUI_ListItem_create == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 162 | |||
| 163 | GUI_ListItem_destroy = (void (*)(CAddonListItem* p)) | ||
| 164 | dlsym(m_libKODI_guilib, "GUI_ListItem_destroy"); | ||
| 165 | if (GUI_ListItem_destroy == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 166 | |||
| 167 | GUI_control_get_rendering = (CAddonGUIRenderingControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) | ||
| 168 | dlsym(m_libKODI_guilib, "GUI_control_get_rendering"); | ||
| 169 | if (GUI_control_get_rendering == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 170 | |||
| 171 | GUI_control_release_rendering = (void (*)(CAddonGUIRenderingControl* p)) | ||
| 172 | dlsym(m_libKODI_guilib, "GUI_control_release_rendering"); | ||
| 173 | if (GUI_control_release_rendering == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 174 | |||
| 175 | GUI_control_get_slider = (CAddonGUISliderControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) | ||
| 176 | dlsym(m_libKODI_guilib, "GUI_control_get_slider"); | ||
| 177 | if (GUI_control_get_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 178 | |||
| 179 | GUI_control_release_slider = (void (*)(CAddonGUISliderControl* p)) | ||
| 180 | dlsym(m_libKODI_guilib, "GUI_control_release_slider"); | ||
| 181 | if (GUI_control_release_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 182 | |||
| 183 | GUI_control_get_settings_slider = (CAddonGUISettingsSliderControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) | ||
| 184 | dlsym(m_libKODI_guilib, "GUI_control_get_settings_slider"); | ||
| 185 | if (GUI_control_get_settings_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 186 | |||
| 187 | GUI_control_release_settings_slider = (void (*)(CAddonGUISettingsSliderControl* p)) | ||
| 188 | dlsym(m_libKODI_guilib, "GUI_control_release_settings_slider"); | ||
| 189 | if (GUI_control_release_settings_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 190 | |||
| 191 | GUI_dialog_keyboard_show_and_get_input_with_head = (bool (*)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs)) | ||
| 192 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_input_with_head"); | ||
| 193 | if (GUI_dialog_keyboard_show_and_get_input_with_head == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 194 | |||
| 195 | GUI_dialog_keyboard_show_and_get_input = (bool (*)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs)) | ||
| 196 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_input"); | ||
| 197 | if (GUI_dialog_keyboard_show_and_get_input == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 198 | |||
| 199 | GUI_dialog_keyboard_show_and_get_new_password_with_head = (bool (*)(void *HANDLE, void *CB, char &newPassword, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, unsigned int autoCloseMs)) | ||
| 200 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_new_password_with_head"); | ||
| 201 | if (GUI_dialog_keyboard_show_and_get_new_password_with_head == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 202 | |||
| 203 | GUI_dialog_keyboard_show_and_get_new_password = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs)) | ||
| 204 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_new_password"); | ||
| 205 | if (GUI_dialog_keyboard_show_and_get_new_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 206 | |||
| 207 | GUI_dialog_keyboard_show_and_verify_new_password_with_head = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, unsigned int autoCloseMs)) | ||
| 208 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_verify_new_password_with_head"); | ||
| 209 | if (GUI_dialog_keyboard_show_and_verify_new_password_with_head == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 210 | |||
| 211 | GUI_dialog_keyboard_show_and_verify_new_password = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs)) | ||
| 212 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_verify_new_password"); | ||
| 213 | if (GUI_dialog_keyboard_show_and_verify_new_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 214 | |||
| 215 | GUI_dialog_keyboard_show_and_verify_password = (int (*)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs)) | ||
| 216 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_verify_password"); | ||
| 217 | if (GUI_dialog_keyboard_show_and_verify_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 218 | |||
| 219 | GUI_dialog_keyboard_show_and_get_filter = (bool (*)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs)) | ||
| 220 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_filter"); | ||
| 221 | if (GUI_dialog_keyboard_show_and_get_filter == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 222 | |||
| 223 | GUI_dialog_keyboard_send_text_to_active_keyboard = (bool (*)(void *HANDLE, void *CB, const char *aTextString, bool closeKeyboard)) | ||
| 224 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_send_text_to_active_keyboard"); | ||
| 225 | if (GUI_dialog_keyboard_send_text_to_active_keyboard == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 226 | |||
| 227 | GUI_dialog_keyboard_is_activated = (bool (*)(void *HANDLE, void *CB)) | ||
| 228 | dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_is_activated"); | ||
| 229 | if (GUI_dialog_keyboard_is_activated == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 230 | |||
| 231 | GUI_dialog_numeric_show_and_verify_new_password = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize)) | ||
| 232 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_verify_new_password"); | ||
| 233 | if (GUI_dialog_numeric_show_and_verify_new_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 234 | |||
| 235 | GUI_dialog_numeric_show_and_verify_password = (int (*)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries)) | ||
| 236 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_verify_password"); | ||
| 237 | if (GUI_dialog_numeric_show_and_verify_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 238 | |||
| 239 | GUI_dialog_numeric_show_and_verify_input = (bool (*)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput)) | ||
| 240 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_verify_input"); | ||
| 241 | if (GUI_dialog_numeric_show_and_verify_input == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 242 | |||
| 243 | GUI_dialog_numeric_show_and_get_time = (bool (*)(void *HANDLE, void *CB, tm &time, const char *strHeading)) | ||
| 244 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_time"); | ||
| 245 | if (GUI_dialog_numeric_show_and_get_time == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 246 | |||
| 247 | GUI_dialog_numeric_show_and_get_date = (bool (*)(void *HANDLE, void *CB, tm &date, const char *strHeading)) | ||
| 248 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_date"); | ||
| 249 | if (GUI_dialog_numeric_show_and_get_date == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 250 | |||
| 251 | GUI_dialog_numeric_show_and_get_ipaddress = (bool (*)(void *HANDLE, void *CB, char &IPAddress, unsigned int iMaxStringSize, const char *strHeading)) | ||
| 252 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_ipaddress"); | ||
| 253 | if (GUI_dialog_numeric_show_and_get_ipaddress == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 254 | |||
| 255 | GUI_dialog_numeric_show_and_get_number = (bool (*)(void *HANDLE, void *CB, char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs)) | ||
| 256 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_number"); | ||
| 257 | if (GUI_dialog_numeric_show_and_get_number == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 258 | |||
| 259 | GUI_dialog_numeric_show_and_get_seconds = (bool (*)(void *HANDLE, void *CB, char &strTime, unsigned int iMaxStringSize, const char *strHeading)) | ||
| 260 | dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_seconds"); | ||
| 261 | if (GUI_dialog_numeric_show_and_get_seconds == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 262 | |||
| 263 | GUI_dialog_filebrowser_show_and_get_file = (bool (*)(void *HANDLE, void *CB, const char *directory, const char *mask, const char *heading, char &path, unsigned int iMaxStringSize, bool useThumbs, bool useFileDirectories, bool singleList)) | ||
| 264 | dlsym(m_libKODI_guilib, "GUI_dialog_filebrowser_show_and_get_file"); | ||
| 265 | if (GUI_dialog_filebrowser_show_and_get_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 266 | |||
| 267 | GUI_dialog_ok_show_and_get_input_single_text = (void (*)(void *HANDLE, void *CB, const char *heading, const char *text)) | ||
| 268 | dlsym(m_libKODI_guilib, "GUI_dialog_ok_show_and_get_input_single_text"); | ||
| 269 | if (GUI_dialog_ok_show_and_get_input_single_text == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 270 | |||
| 271 | GUI_dialog_ok_show_and_get_input_line_text = (void (*)(void *HANDLE, void *CB, const char *heading, const char *line0, const char *line1, const char *line2)) | ||
| 272 | dlsym(m_libKODI_guilib, "GUI_dialog_ok_show_and_get_input_line_text"); | ||
| 273 | if (GUI_dialog_ok_show_and_get_input_line_text == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 274 | |||
| 275 | GUI_dialog_yesno_show_and_get_input_singletext = (bool (*)(void *HANDLE, void *CB, const char *heading, const char *text, bool& bCanceled, const char *noLabel, const char *yesLabel)) | ||
| 276 | dlsym(m_libKODI_guilib, "GUI_dialog_yesno_show_and_get_input_singletext"); | ||
| 277 | if (GUI_dialog_yesno_show_and_get_input_singletext == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 278 | |||
| 279 | GUI_dialog_yesno_show_and_get_input_linetext = (bool (*)(void *HANDLE, void *CB, const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel, const char *yesLabel)) | ||
| 280 | dlsym(m_libKODI_guilib, "GUI_dialog_yesno_show_and_get_input_linetext"); | ||
| 281 | if (GUI_dialog_yesno_show_and_get_input_linetext == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 282 | |||
| 283 | GUI_dialog_yesno_show_and_get_input_linebuttontext = (bool (*)(void *HANDLE, void *CB, const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel, const char *yesLabel)) | ||
| 284 | dlsym(m_libKODI_guilib, "GUI_dialog_yesno_show_and_get_input_linebuttontext"); | ||
| 285 | if (GUI_dialog_yesno_show_and_get_input_linebuttontext == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 286 | |||
| 287 | GUI_dialog_text_viewer = (void (*)(void *hdl, void *cb, const char *heading, const char *text)) | ||
| 288 | dlsym(m_libKODI_guilib, "GUI_dialog_text_viewer"); | ||
| 289 | if (GUI_dialog_text_viewer == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 290 | |||
| 291 | GUI_dialog_select = (int (*)(void *hdl, void *cb, const char *heading, const char *entries[], unsigned int size, int selected)) | ||
| 292 | dlsym(m_libKODI_guilib, "GUI_dialog_select"); | ||
| 293 | if (GUI_dialog_select == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 294 | |||
| 295 | m_Callbacks = GUI_register_me(m_Handle); | ||
| 296 | return m_Callbacks != NULL; | ||
| 297 | } | ||
| 298 | |||
| 299 | void Lock() | ||
| 300 | { | ||
| 301 | return GUI_lock(m_Handle, m_Callbacks); | ||
| 302 | } | ||
| 303 | |||
| 304 | void Unlock() | ||
| 305 | { | ||
| 306 | return GUI_unlock(m_Handle, m_Callbacks); | ||
| 307 | } | ||
| 308 | |||
| 309 | int GetScreenHeight() | ||
| 310 | { | ||
| 311 | return GUI_get_screen_height(m_Handle, m_Callbacks); | ||
| 312 | } | ||
| 313 | |||
| 314 | int GetScreenWidth() | ||
| 315 | { | ||
| 316 | return GUI_get_screen_width(m_Handle, m_Callbacks); | ||
| 317 | } | ||
| 318 | |||
| 319 | int GetVideoResolution() | ||
| 320 | { | ||
| 321 | return GUI_get_video_resolution(m_Handle, m_Callbacks); | ||
| 322 | } | ||
| 323 | |||
| 324 | CAddonGUIWindow* Window_create(const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog) | ||
| 325 | { | ||
| 326 | return GUI_Window_create(m_Handle, m_Callbacks, xmlFilename, defaultSkin, forceFallback, asDialog); | ||
| 327 | } | ||
| 328 | |||
| 329 | void Window_destroy(CAddonGUIWindow* p) | ||
| 330 | { | ||
| 331 | return GUI_Window_destroy(p); | ||
| 332 | } | ||
| 333 | |||
| 334 | CAddonGUISpinControl* Control_getSpin(CAddonGUIWindow *window, int controlId) | ||
| 335 | { | ||
| 336 | return GUI_control_get_spin(m_Handle, m_Callbacks, window, controlId); | ||
| 337 | } | ||
| 338 | |||
| 339 | void Control_releaseSpin(CAddonGUISpinControl* p) | ||
| 340 | { | ||
| 341 | return GUI_control_release_spin(p); | ||
| 342 | } | ||
| 343 | |||
| 344 | CAddonGUIRadioButton* Control_getRadioButton(CAddonGUIWindow *window, int controlId) | ||
| 345 | { | ||
| 346 | return GUI_control_get_radiobutton(m_Handle, m_Callbacks, window, controlId); | ||
| 347 | } | ||
| 348 | |||
| 349 | void Control_releaseRadioButton(CAddonGUIRadioButton* p) | ||
| 350 | { | ||
| 351 | return GUI_control_release_radiobutton(p); | ||
| 352 | } | ||
| 353 | |||
| 354 | CAddonGUIProgressControl* Control_getProgress(CAddonGUIWindow *window, int controlId) | ||
| 355 | { | ||
| 356 | return GUI_control_get_progress(m_Handle, m_Callbacks, window, controlId); | ||
| 357 | } | ||
| 358 | |||
| 359 | void Control_releaseProgress(CAddonGUIProgressControl* p) | ||
| 360 | { | ||
| 361 | return GUI_control_release_progress(p); | ||
| 362 | } | ||
| 363 | |||
| 364 | CAddonListItem* ListItem_create(const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path) | ||
| 365 | { | ||
| 366 | return GUI_ListItem_create(m_Handle, m_Callbacks, label, label2, iconImage, thumbnailImage, path); | ||
| 367 | } | ||
| 368 | |||
| 369 | void ListItem_destroy(CAddonListItem* p) | ||
| 370 | { | ||
| 371 | return GUI_ListItem_destroy(p); | ||
| 372 | } | ||
| 373 | |||
| 374 | CAddonGUIRenderingControl* Control_getRendering(CAddonGUIWindow *window, int controlId) | ||
| 375 | { | ||
| 376 | return GUI_control_get_rendering(m_Handle, m_Callbacks, window, controlId); | ||
| 377 | } | ||
| 378 | |||
| 379 | void Control_releaseRendering(CAddonGUIRenderingControl* p) | ||
| 380 | { | ||
| 381 | return GUI_control_release_rendering(p); | ||
| 382 | } | ||
| 383 | |||
| 384 | CAddonGUISliderControl* Control_getSlider(CAddonGUIWindow *window, int controlId) | ||
| 385 | { | ||
| 386 | return GUI_control_get_slider(m_Handle, m_Callbacks, window, controlId); | ||
| 387 | } | ||
| 388 | |||
| 389 | void Control_releaseSlider(CAddonGUISliderControl* p) | ||
| 390 | { | ||
| 391 | return GUI_control_release_slider(p); | ||
| 392 | } | ||
| 393 | |||
| 394 | CAddonGUISettingsSliderControl* Control_getSettingsSlider(CAddonGUIWindow *window, int controlId) | ||
| 395 | { | ||
| 396 | return GUI_control_get_settings_slider(m_Handle, m_Callbacks, window, controlId); | ||
| 397 | } | ||
| 398 | |||
| 399 | void Control_releaseSettingsSlider(CAddonGUISettingsSliderControl* p) | ||
| 400 | { | ||
| 401 | return GUI_control_release_settings_slider(p); | ||
| 402 | } | ||
| 403 | |||
| 404 | /*! @name GUI Keyboard functions */ | ||
| 405 | //@{ | ||
| 406 | bool Dialog_Keyboard_ShowAndGetInput(char &strText, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs = 0) | ||
| 407 | { | ||
| 408 | return GUI_dialog_keyboard_show_and_get_input_with_head(m_Handle, m_Callbacks, strText, iMaxStringSize, strHeading, allowEmptyResult, hiddenInput, autoCloseMs); | ||
| 409 | } | ||
| 410 | |||
| 411 | bool Dialog_Keyboard_ShowAndGetInput(char &strText, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs = 0) | ||
| 412 | { | ||
| 413 | return GUI_dialog_keyboard_show_and_get_input(m_Handle, m_Callbacks, strText, iMaxStringSize, allowEmptyResult, autoCloseMs); | ||
| 414 | } | ||
| 415 | |||
| 416 | bool Dialog_Keyboard_ShowAndGetNewPassword(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs = 0) | ||
| 417 | { | ||
| 418 | return GUI_dialog_keyboard_show_and_get_new_password_with_head(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs); | ||
| 419 | } | ||
| 420 | |||
| 421 | bool Dialog_Keyboard_ShowAndGetNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs = 0) | ||
| 422 | { | ||
| 423 | return GUI_dialog_keyboard_show_and_get_new_password(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, autoCloseMs); | ||
| 424 | } | ||
| 425 | |||
| 426 | bool Dialog_Keyboard_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs = 0) | ||
| 427 | { | ||
| 428 | return GUI_dialog_keyboard_show_and_verify_new_password_with_head(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs); | ||
| 429 | } | ||
| 430 | |||
| 431 | bool Dialog_Keyboard_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs = 0) | ||
| 432 | { | ||
| 433 | return GUI_dialog_keyboard_show_and_verify_new_password(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, autoCloseMs); | ||
| 434 | } | ||
| 435 | |||
| 436 | int Dialog_Keyboard_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs = 0) | ||
| 437 | { | ||
| 438 | return GUI_dialog_keyboard_show_and_verify_password(m_Handle, m_Callbacks, strPassword, iMaxStringSize, strHeading, iRetries, autoCloseMs); | ||
| 439 | } | ||
| 440 | |||
| 441 | bool Dialog_Keyboard_ShowAndGetFilter(char &strText, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs = 0) | ||
| 442 | { | ||
| 443 | return GUI_dialog_keyboard_show_and_get_filter(m_Handle, m_Callbacks, strText, iMaxStringSize, searching, autoCloseMs); | ||
| 444 | } | ||
| 445 | |||
| 446 | bool Dialog_Keyboard_SendTextToActiveKeyboard(const char *aTextString, bool closeKeyboard = false) | ||
| 447 | { | ||
| 448 | return GUI_dialog_keyboard_send_text_to_active_keyboard(m_Handle, m_Callbacks, aTextString, closeKeyboard); | ||
| 449 | } | ||
| 450 | |||
| 451 | bool Dialog_Keyboard_isKeyboardActivated() | ||
| 452 | { | ||
| 453 | return GUI_dialog_keyboard_is_activated(m_Handle, m_Callbacks); | ||
| 454 | } | ||
| 455 | //@} | ||
| 456 | |||
| 457 | /*! @name GUI Numeric functions */ | ||
| 458 | //@{ | ||
| 459 | bool Dialog_Numeric_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize) | ||
| 460 | { | ||
| 461 | return GUI_dialog_numeric_show_and_verify_new_password(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize); | ||
| 462 | } | ||
| 463 | |||
| 464 | int Dialog_Numeric_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries) | ||
| 465 | { | ||
| 466 | return GUI_dialog_numeric_show_and_verify_password(m_Handle, m_Callbacks, strPassword, iMaxStringSize, strHeading, iRetries); | ||
| 467 | } | ||
| 468 | |||
| 469 | bool Dialog_Numeric_ShowAndVerifyInput(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput) | ||
| 470 | { | ||
| 471 | return GUI_dialog_numeric_show_and_verify_input(m_Handle, m_Callbacks, strPassword, iMaxStringSize, strHeading, bGetUserInput); | ||
| 472 | } | ||
| 473 | |||
| 474 | bool Dialog_Numeric_ShowAndGetTime(tm &time, const char *strHeading) | ||
| 475 | { | ||
| 476 | return GUI_dialog_numeric_show_and_get_time(m_Handle, m_Callbacks, time, strHeading); | ||
| 477 | } | ||
| 478 | |||
| 479 | bool Dialog_Numeric_ShowAndGetDate(tm &date, const char *strHeading) | ||
| 480 | { | ||
| 481 | return GUI_dialog_numeric_show_and_get_date(m_Handle, m_Callbacks, date, strHeading); | ||
| 482 | } | ||
| 483 | |||
| 484 | bool Dialog_Numeric_ShowAndGetIPAddress(char &strIPAddress, unsigned int iMaxStringSize, const char *strHeading) | ||
| 485 | { | ||
| 486 | return GUI_dialog_numeric_show_and_get_ipaddress(m_Handle, m_Callbacks, strIPAddress, iMaxStringSize, strHeading); | ||
| 487 | } | ||
| 488 | |||
| 489 | bool Dialog_Numeric_ShowAndGetNumber(char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs = 0) | ||
| 490 | { | ||
| 491 | return GUI_dialog_numeric_show_and_get_number(m_Handle, m_Callbacks, strInput, iMaxStringSize, strHeading, iAutoCloseTimeoutMs); | ||
| 492 | } | ||
| 493 | |||
| 494 | bool Dialog_Numeric_ShowAndGetSeconds(char &strTime, unsigned int iMaxStringSize, const char *strHeading) | ||
| 495 | { | ||
| 496 | return GUI_dialog_numeric_show_and_get_seconds(m_Handle, m_Callbacks, strTime, iMaxStringSize, strHeading); | ||
| 497 | } | ||
| 498 | //@} | ||
| 499 | |||
| 500 | /*! @name GUI File browser functions */ | ||
| 501 | //@{ | ||
| 502 | bool Dialog_FileBrowser_ShowAndGetFile(const char *directory, const char *mask, const char *heading, char &strPath, unsigned int iMaxStringSize, bool useThumbs = false, bool useFileDirectories = false, bool singleList = false) | ||
| 503 | { | ||
| 504 | return GUI_dialog_filebrowser_show_and_get_file(m_Handle, m_Callbacks, directory, mask, heading, strPath, iMaxStringSize, useThumbs, useFileDirectories, singleList); | ||
| 505 | } | ||
| 506 | //@} | ||
| 507 | |||
| 508 | /*! @name GUI OK Dialog functions */ | ||
| 509 | //@{ | ||
| 510 | void Dialog_OK_ShowAndGetInput(const char *heading, const char *text) | ||
| 511 | { | ||
| 512 | GUI_dialog_ok_show_and_get_input_single_text(m_Handle, m_Callbacks, heading, text); | ||
| 513 | } | ||
| 514 | |||
| 515 | void Dialog_OK_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2) | ||
| 516 | { | ||
| 517 | GUI_dialog_ok_show_and_get_input_line_text(m_Handle, m_Callbacks, heading, line0, line1, line2); | ||
| 518 | } | ||
| 519 | //@} | ||
| 520 | |||
| 521 | /*! @name GUI Yes No Dialog functions */ | ||
| 522 | //@{ | ||
| 523 | bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *text, bool& bCanceled, const char *noLabel = "", const char *yesLabel = "") | ||
| 524 | { | ||
| 525 | return GUI_dialog_yesno_show_and_get_input_singletext(m_Handle, m_Callbacks, heading, text, bCanceled, noLabel, yesLabel); | ||
| 526 | } | ||
| 527 | |||
| 528 | bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel = "", const char *yesLabel = "") | ||
| 529 | { | ||
| 530 | return GUI_dialog_yesno_show_and_get_input_linetext(m_Handle, m_Callbacks, heading, line0, line1, line2, noLabel, yesLabel); | ||
| 531 | } | ||
| 532 | |||
| 533 | bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel = "", const char *yesLabel = "") | ||
| 534 | { | ||
| 535 | return GUI_dialog_yesno_show_and_get_input_linebuttontext(m_Handle, m_Callbacks, heading, line0, line1, line2, bCanceled, noLabel, yesLabel); | ||
| 536 | } | ||
| 537 | //@} | ||
| 538 | |||
| 539 | /*! @name GUI Text viewer Dialog */ | ||
| 540 | //@{ | ||
| 541 | void Dialog_TextViewer(const char *heading, const char *text) | ||
| 542 | { | ||
| 543 | return GUI_dialog_text_viewer(m_Handle, m_Callbacks, heading, text); | ||
| 544 | } | ||
| 545 | //@} | ||
| 546 | |||
| 547 | /*! @name GUI select Dialog */ | ||
| 548 | //@{ | ||
| 549 | int Dialog_Select(const char *heading, const char *entries[], unsigned int size, int selected = -1) | ||
| 550 | { | ||
| 551 | return GUI_dialog_select(m_Handle, m_Callbacks, heading, entries, size, selected); | ||
| 552 | } | ||
| 553 | //@} | ||
| 554 | |||
| 555 | protected: | ||
| 556 | void* (*GUI_register_me)(void *HANDLE); | ||
| 557 | void (*GUI_unregister_me)(void *HANDLE, void* CB); | ||
| 558 | void (*GUI_lock)(void *HANDLE, void* CB); | ||
| 559 | void (*GUI_unlock)(void *HANDLE, void* CB); | ||
| 560 | int (*GUI_get_screen_height)(void *HANDLE, void* CB); | ||
| 561 | int (*GUI_get_screen_width)(void *HANDLE, void* CB); | ||
| 562 | int (*GUI_get_video_resolution)(void *HANDLE, void* CB); | ||
| 563 | CAddonGUIWindow* (*GUI_Window_create)(void *HANDLE, void* CB, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog); | ||
| 564 | void (*GUI_Window_destroy)(CAddonGUIWindow* p); | ||
| 565 | CAddonGUISpinControl* (*GUI_control_get_spin)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); | ||
| 566 | void (*GUI_control_release_spin)(CAddonGUISpinControl* p); | ||
| 567 | CAddonGUIRadioButton* (*GUI_control_get_radiobutton)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); | ||
| 568 | void (*GUI_control_release_radiobutton)(CAddonGUIRadioButton* p); | ||
| 569 | CAddonGUIProgressControl* (*GUI_control_get_progress)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); | ||
| 570 | void (*GUI_control_release_progress)(CAddonGUIProgressControl* p); | ||
| 571 | CAddonListItem* (*GUI_ListItem_create)(void *HANDLE, void* CB, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path); | ||
| 572 | void (*GUI_ListItem_destroy)(CAddonListItem* p); | ||
| 573 | CAddonGUIRenderingControl* (*GUI_control_get_rendering)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); | ||
| 574 | void (*GUI_control_release_rendering)(CAddonGUIRenderingControl* p); | ||
| 575 | CAddonGUISliderControl* (*GUI_control_get_slider)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); | ||
| 576 | void (*GUI_control_release_slider)(CAddonGUISliderControl* p); | ||
| 577 | CAddonGUISettingsSliderControl* (*GUI_control_get_settings_slider)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); | ||
| 578 | void (*GUI_control_release_settings_slider)(CAddonGUISettingsSliderControl* p); | ||
| 579 | bool (*GUI_dialog_keyboard_show_and_get_input_with_head)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs); | ||
| 580 | bool (*GUI_dialog_keyboard_show_and_get_input)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs); | ||
| 581 | bool (*GUI_dialog_keyboard_show_and_get_new_password_with_head)(void *HANDLE, void *CB, char &newPassword, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, unsigned int autoCloseMs); | ||
| 582 | bool (*GUI_dialog_keyboard_show_and_get_new_password)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs); | ||
| 583 | bool (*GUI_dialog_keyboard_show_and_verify_new_password_with_head)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, unsigned int autoCloseMs); | ||
| 584 | bool (*GUI_dialog_keyboard_show_and_verify_new_password)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs); | ||
| 585 | int (*GUI_dialog_keyboard_show_and_verify_password)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs); | ||
| 586 | bool (*GUI_dialog_keyboard_show_and_get_filter)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs); | ||
| 587 | bool (*GUI_dialog_keyboard_send_text_to_active_keyboard)(void *HANDLE, void *CB, const char *aTextString, bool closeKeyboard); | ||
| 588 | bool (*GUI_dialog_keyboard_is_activated)(void *HANDLE, void *CB); | ||
| 589 | bool (*GUI_dialog_numeric_show_and_verify_new_password)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize); | ||
| 590 | int (*GUI_dialog_numeric_show_and_verify_password)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries); | ||
| 591 | bool (*GUI_dialog_numeric_show_and_verify_input)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput); | ||
| 592 | bool (*GUI_dialog_numeric_show_and_get_time)(void *HANDLE, void *CB, tm &time, const char *strHeading); | ||
| 593 | bool (*GUI_dialog_numeric_show_and_get_date)(void *HANDLE, void *CB, tm &date, const char *strHeading); | ||
| 594 | bool (*GUI_dialog_numeric_show_and_get_ipaddress)(void *HANDLE, void *CB, char &IPAddress, unsigned int iMaxStringSize, const char *strHeading); | ||
| 595 | bool (*GUI_dialog_numeric_show_and_get_number)(void *HANDLE, void *CB, char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs); | ||
| 596 | bool (*GUI_dialog_numeric_show_and_get_seconds)(void *HANDLE, void *CB, char &strTime, unsigned int iMaxStringSize, const char *strHeading); | ||
| 597 | bool (*GUI_dialog_filebrowser_show_and_get_file)(void *HANDLE, void *CB, const char *directory, const char *mask, const char *heading, char &path, unsigned int iMaxStringSize, bool useThumbs, bool useFileDirectories, bool singleList); | ||
| 598 | void (*GUI_dialog_ok_show_and_get_input_single_text)(void *HANDLE, void *CB, const char *heading, const char *text); | ||
| 599 | void (*GUI_dialog_ok_show_and_get_input_line_text)(void *HANDLE, void *CB, const char *heading, const char *line0, const char *line1, const char *line2); | ||
| 600 | bool (*GUI_dialog_yesno_show_and_get_input_singletext)(void *HANDLE, void *CB, const char *heading, const char *text, bool& bCanceled, const char *noLabel, const char *yesLabel); | ||
| 601 | bool (*GUI_dialog_yesno_show_and_get_input_linetext)(void *HANDLE, void *CB, const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel, const char *yesLabel); | ||
| 602 | bool (*GUI_dialog_yesno_show_and_get_input_linebuttontext)(void *HANDLE, void *CB, const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel, const char *yesLabel); | ||
| 603 | void (*GUI_dialog_text_viewer)(void *hdl, void *cb, const char *heading, const char *text); | ||
| 604 | int (*GUI_dialog_select)(void *hdl, void *cb, const char *heading, const char *entries[], unsigned int size, int selected); | ||
| 605 | |||
| 606 | private: | ||
| 607 | void *m_libKODI_guilib; | ||
| 608 | void *m_Handle; | ||
| 609 | void *m_Callbacks; | ||
| 610 | struct cb_array | ||
| 611 | { | ||
| 612 | const char* libPath; | ||
| 613 | }; | ||
| 614 | }; | ||
| 615 | |||
| 616 | class CAddonGUISpinControl | ||
| 617 | { | ||
| 618 | public: | ||
| 619 | CAddonGUISpinControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); | ||
| 620 | virtual ~CAddonGUISpinControl(void) {} | ||
| 621 | |||
| 622 | virtual void SetVisible(bool yesNo); | ||
| 623 | virtual void SetText(const char *label); | ||
| 624 | virtual void Clear(); | ||
| 625 | virtual void AddLabel(const char *label, int iValue); | ||
| 626 | virtual int GetValue(); | ||
| 627 | virtual void SetValue(int iValue); | ||
| 628 | |||
| 629 | private: | ||
| 630 | CAddonGUIWindow *m_Window; | ||
| 631 | int m_ControlId; | ||
| 632 | GUIHANDLE m_SpinHandle; | ||
| 633 | void *m_Handle; | ||
| 634 | void *m_cb; | ||
| 635 | }; | ||
| 636 | |||
| 637 | class CAddonGUIRadioButton | ||
| 638 | { | ||
| 639 | public: | ||
| 640 | CAddonGUIRadioButton(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); | ||
| 641 | virtual ~CAddonGUIRadioButton() {} | ||
| 642 | |||
| 643 | virtual void SetVisible(bool yesNo); | ||
| 644 | virtual void SetText(const char *label); | ||
| 645 | virtual void SetSelected(bool yesNo); | ||
| 646 | virtual bool IsSelected(); | ||
| 647 | |||
| 648 | private: | ||
| 649 | CAddonGUIWindow *m_Window; | ||
| 650 | int m_ControlId; | ||
| 651 | GUIHANDLE m_ButtonHandle; | ||
| 652 | void *m_Handle; | ||
| 653 | void *m_cb; | ||
| 654 | }; | ||
| 655 | |||
| 656 | class CAddonGUIProgressControl | ||
| 657 | { | ||
| 658 | public: | ||
| 659 | CAddonGUIProgressControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); | ||
| 660 | virtual ~CAddonGUIProgressControl(void) {} | ||
| 661 | |||
| 662 | virtual void SetPercentage(float fPercent); | ||
| 663 | virtual float GetPercentage() const; | ||
| 664 | virtual void SetInfo(int iInfo); | ||
| 665 | virtual int GetInfo() const; | ||
| 666 | virtual std::string GetDescription() const; | ||
| 667 | |||
| 668 | private: | ||
| 669 | CAddonGUIWindow *m_Window; | ||
| 670 | int m_ControlId; | ||
| 671 | GUIHANDLE m_ProgressHandle; | ||
| 672 | void *m_Handle; | ||
| 673 | void *m_cb; | ||
| 674 | }; | ||
| 675 | |||
| 676 | class CAddonGUISliderControl | ||
| 677 | { | ||
| 678 | public: | ||
| 679 | CAddonGUISliderControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); | ||
| 680 | virtual ~CAddonGUISliderControl(void) {} | ||
| 681 | |||
| 682 | virtual void SetVisible(bool yesNo); | ||
| 683 | virtual std::string GetDescription() const; | ||
| 684 | |||
| 685 | virtual void SetIntRange(int iStart, int iEnd); | ||
| 686 | virtual void SetIntValue(int iValue); | ||
| 687 | virtual int GetIntValue() const; | ||
| 688 | virtual void SetIntInterval(int iInterval); | ||
| 689 | |||
| 690 | virtual void SetPercentage(float fPercent); | ||
| 691 | virtual float GetPercentage() const; | ||
| 692 | |||
| 693 | virtual void SetFloatRange(float fStart, float fEnd); | ||
| 694 | virtual void SetFloatValue(float fValue); | ||
| 695 | virtual float GetFloatValue() const; | ||
| 696 | virtual void SetFloatInterval(float fInterval); | ||
| 697 | |||
| 698 | private: | ||
| 699 | CAddonGUIWindow *m_Window; | ||
| 700 | int m_ControlId; | ||
| 701 | GUIHANDLE m_SliderHandle; | ||
| 702 | void *m_Handle; | ||
| 703 | void *m_cb; | ||
| 704 | }; | ||
| 705 | |||
| 706 | class CAddonGUISettingsSliderControl | ||
| 707 | { | ||
| 708 | public: | ||
| 709 | CAddonGUISettingsSliderControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); | ||
| 710 | virtual ~CAddonGUISettingsSliderControl(void) {} | ||
| 711 | |||
| 712 | virtual void SetVisible(bool yesNo); | ||
| 713 | virtual void SetText(const char *label); | ||
| 714 | virtual std::string GetDescription() const; | ||
| 715 | |||
| 716 | virtual void SetIntRange(int iStart, int iEnd); | ||
| 717 | virtual void SetIntValue(int iValue); | ||
| 718 | virtual int GetIntValue() const; | ||
| 719 | virtual void SetIntInterval(int iInterval); | ||
| 720 | |||
| 721 | virtual void SetPercentage(float fPercent); | ||
| 722 | virtual float GetPercentage() const; | ||
| 723 | |||
| 724 | virtual void SetFloatRange(float fStart, float fEnd); | ||
| 725 | virtual void SetFloatValue(float fValue); | ||
| 726 | virtual float GetFloatValue() const; | ||
| 727 | virtual void SetFloatInterval(float fInterval); | ||
| 728 | |||
| 729 | private: | ||
| 730 | CAddonGUIWindow *m_Window; | ||
| 731 | int m_ControlId; | ||
| 732 | GUIHANDLE m_SettingsSliderHandle; | ||
| 733 | void *m_Handle; | ||
| 734 | void *m_cb; | ||
| 735 | }; | ||
| 736 | |||
| 737 | class CAddonListItem | ||
| 738 | { | ||
| 739 | friend class CAddonGUIWindow; | ||
| 740 | |||
| 741 | public: | ||
| 742 | CAddonListItem(void *hdl, void *cb, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path); | ||
| 743 | virtual ~CAddonListItem(void) {} | ||
| 744 | |||
| 745 | virtual const char *GetLabel(); | ||
| 746 | virtual void SetLabel(const char *label); | ||
| 747 | virtual const char *GetLabel2(); | ||
| 748 | virtual void SetLabel2(const char *label); | ||
| 749 | virtual void SetIconImage(const char *image); | ||
| 750 | virtual void SetThumbnailImage(const char *image); | ||
| 751 | virtual void SetInfo(const char *Info); | ||
| 752 | virtual void SetProperty(const char *key, const char *value); | ||
| 753 | virtual const char *GetProperty(const char *key) const; | ||
| 754 | virtual void SetPath(const char *Path); | ||
| 755 | |||
| 756 | // {(char*)"select(); | ||
| 757 | // {(char*)"isSelected(); | ||
| 758 | protected: | ||
| 759 | GUIHANDLE m_ListItemHandle; | ||
| 760 | void *m_Handle; | ||
| 761 | void *m_cb; | ||
| 762 | }; | ||
| 763 | |||
| 764 | class CAddonGUIWindow | ||
| 765 | { | ||
| 766 | friend class CAddonGUISpinControl; | ||
| 767 | friend class CAddonGUIRadioButton; | ||
| 768 | friend class CAddonGUIProgressControl; | ||
| 769 | friend class CAddonGUIRenderingControl; | ||
| 770 | friend class CAddonGUISliderControl; | ||
| 771 | friend class CAddonGUISettingsSliderControl; | ||
| 772 | |||
| 773 | public: | ||
| 774 | CAddonGUIWindow(void *hdl, void *cb, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog); | ||
| 775 | virtual ~CAddonGUIWindow(); | ||
| 776 | |||
| 777 | virtual bool Show(); | ||
| 778 | virtual void Close(); | ||
| 779 | virtual void DoModal(); | ||
| 780 | virtual bool SetFocusId(int iControlId); | ||
| 781 | virtual int GetFocusId(); | ||
| 782 | virtual bool SetCoordinateResolution(int res); | ||
| 783 | virtual void SetProperty(const char *key, const char *value); | ||
| 784 | virtual void SetPropertyInt(const char *key, int value); | ||
| 785 | virtual void SetPropertyBool(const char *key, bool value); | ||
| 786 | virtual void SetPropertyDouble(const char *key, double value); | ||
| 787 | virtual const char *GetProperty(const char *key) const; | ||
| 788 | virtual int GetPropertyInt(const char *key) const; | ||
| 789 | virtual bool GetPropertyBool(const char *key) const; | ||
| 790 | virtual double GetPropertyDouble(const char *key) const; | ||
| 791 | virtual void ClearProperties(); | ||
| 792 | virtual int GetListSize(); | ||
| 793 | virtual void ClearList(); | ||
| 794 | virtual GUIHANDLE AddStringItem(const char *name, int itemPosition = -1); | ||
| 795 | virtual void AddItem(GUIHANDLE item, int itemPosition = -1); | ||
| 796 | virtual void AddItem(CAddonListItem *item, int itemPosition = -1); | ||
| 797 | virtual void RemoveItem(int itemPosition); | ||
| 798 | virtual GUIHANDLE GetListItem(int listPos); | ||
| 799 | virtual void SetCurrentListPosition(int listPos); | ||
| 800 | virtual int GetCurrentListPosition(); | ||
| 801 | virtual void SetControlLabel(int controlId, const char *label); | ||
| 802 | virtual void MarkDirtyRegion(); | ||
| 803 | |||
| 804 | virtual bool OnClick(int controlId); | ||
| 805 | virtual bool OnFocus(int controlId); | ||
| 806 | virtual bool OnInit(); | ||
| 807 | virtual bool OnAction(int actionId); | ||
| 808 | |||
| 809 | GUIHANDLE m_cbhdl; | ||
| 810 | bool (*CBOnInit)(GUIHANDLE cbhdl); | ||
| 811 | bool (*CBOnFocus)(GUIHANDLE cbhdl, int controlId); | ||
| 812 | bool (*CBOnClick)(GUIHANDLE cbhdl, int controlId); | ||
| 813 | bool (*CBOnAction)(GUIHANDLE cbhdl, int actionId); | ||
| 814 | |||
| 815 | protected: | ||
| 816 | GUIHANDLE m_WindowHandle; | ||
| 817 | void *m_Handle; | ||
| 818 | void *m_cb; | ||
| 819 | }; | ||
| 820 | |||
| 821 | class CAddonGUIRenderingControl | ||
| 822 | { | ||
| 823 | public: | ||
| 824 | CAddonGUIRenderingControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); | ||
| 825 | virtual ~CAddonGUIRenderingControl(); | ||
| 826 | virtual void Init(); | ||
| 827 | |||
| 828 | virtual bool Create(int x, int y, int w, int h, void *device); | ||
| 829 | virtual void Render(); | ||
| 830 | virtual void Stop(); | ||
| 831 | virtual bool Dirty(); | ||
| 832 | |||
| 833 | GUIHANDLE m_cbhdl; | ||
| 834 | bool (*CBCreate)(GUIHANDLE cbhdl, int x, int y, int w, int h, void *device); | ||
| 835 | void (*CBRender)(GUIHANDLE cbhdl); | ||
| 836 | void (*CBStop)(GUIHANDLE cbhdl); | ||
| 837 | bool (*CBDirty)(GUIHANDLE cbhdl); | ||
| 838 | |||
| 839 | private: | ||
| 840 | CAddonGUIWindow *m_Window; | ||
| 841 | int m_ControlId; | ||
| 842 | GUIHANDLE m_RenderingHandle; | ||
| 843 | void *m_Handle; | ||
| 844 | void *m_cb; | ||
| 845 | }; | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h new file mode 100644 index 0000000..e0dc881 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h | |||
| @@ -0,0 +1,150 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2016 Team XBMC | ||
| 3 | * http://www.xbmc.org | ||
| 4 | * | ||
| 5 | * This Program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This Program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with XBMC; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | #pragma once | ||
| 22 | |||
| 23 | #include <string> | ||
| 24 | #include <vector> | ||
| 25 | #include <string.h> | ||
| 26 | #include <stdlib.h> | ||
| 27 | #include <stdio.h> | ||
| 28 | #include "libXBMC_addon.h" | ||
| 29 | |||
| 30 | #ifdef BUILD_KODI_ADDON | ||
| 31 | #include "DVDDemuxPacket.h" | ||
| 32 | #else | ||
| 33 | #include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h" | ||
| 34 | #endif | ||
| 35 | |||
| 36 | #ifdef _WIN32 | ||
| 37 | #define INPUTSTREAM_HELPER_DLL "\\library.kodi.inputstream\\libKODI_inputstream" ADDON_HELPER_EXT | ||
| 38 | #else | ||
| 39 | #define INPUTSTREAM_HELPER_DLL_NAME "libKODI_inputstream-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 40 | #define INPUTSTREAM_HELPER_DLL "/library.kodi.inputstream/" INPUTSTREAM_HELPER_DLL_NAME | ||
| 41 | #endif | ||
| 42 | |||
| 43 | class CHelper_libKODI_inputstream | ||
| 44 | { | ||
| 45 | public: | ||
| 46 | CHelper_libKODI_inputstream(void) | ||
| 47 | { | ||
| 48 | m_libKODI_inputstream = nullptr; | ||
| 49 | m_Handle = nullptr; | ||
| 50 | } | ||
| 51 | |||
| 52 | ~CHelper_libKODI_inputstream(void) | ||
| 53 | { | ||
| 54 | if (m_libKODI_inputstream) | ||
| 55 | { | ||
| 56 | INPUTSTREAM_unregister_me(m_Handle, m_Callbacks); | ||
| 57 | dlclose(m_libKODI_inputstream); | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | /*! | ||
| 62 | * @brief Resolve all callback methods | ||
| 63 | * @param handle Pointer to the add-on | ||
| 64 | * @return True when all methods were resolved, false otherwise. | ||
| 65 | */ | ||
| 66 | bool RegisterMe(void* handle) | ||
| 67 | { | ||
| 68 | m_Handle = handle; | ||
| 69 | |||
| 70 | std::string libBasePath; | ||
| 71 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 72 | libBasePath += INPUTSTREAM_HELPER_DLL; | ||
| 73 | |||
| 74 | m_libKODI_inputstream = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 75 | if (m_libKODI_inputstream == nullptr) | ||
| 76 | { | ||
| 77 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 78 | return false; | ||
| 79 | } | ||
| 80 | |||
| 81 | INPUTSTREAM_register_me = (void* (*)(void *HANDLE)) | ||
| 82 | dlsym(m_libKODI_inputstream, "INPUTSTREAM_register_me"); | ||
| 83 | if (INPUTSTREAM_register_me == nullptr) | ||
| 84 | { | ||
| 85 | fprintf(stderr, "Unable to assign function %s\n", dlerror()); | ||
| 86 | return false; | ||
| 87 | } | ||
| 88 | |||
| 89 | INPUTSTREAM_unregister_me = (void (*)(void* HANDLE, void* CB)) | ||
| 90 | dlsym(m_libKODI_inputstream, "INPUTSTREAM_unregister_me"); | ||
| 91 | if (INPUTSTREAM_unregister_me == nullptr) | ||
| 92 | { | ||
| 93 | fprintf(stderr, "Unable to assign function %s\n", dlerror()); | ||
| 94 | return false; | ||
| 95 | } | ||
| 96 | |||
| 97 | INPUTSTREAM_free_demux_packet = (void (*)(void* HANDLE, void* CB, DemuxPacket* pPacket)) | ||
| 98 | dlsym(m_libKODI_inputstream, "INPUTSTREAM_free_demux_packet"); | ||
| 99 | if (INPUTSTREAM_free_demux_packet == NULL) | ||
| 100 | { | ||
| 101 | fprintf(stderr, "Unable to assign function %s\n", dlerror()); | ||
| 102 | return false; | ||
| 103 | } | ||
| 104 | |||
| 105 | INPUTSTREAM_allocate_demux_packet = (DemuxPacket* (*)(void* HANDLE, void* CB, int iDataSize)) | ||
| 106 | dlsym(m_libKODI_inputstream, "INPUTSTREAM_allocate_demux_packet"); | ||
| 107 | if (INPUTSTREAM_allocate_demux_packet == NULL) | ||
| 108 | { | ||
| 109 | fprintf(stderr, "Unable to assign function %s\n", dlerror()); | ||
| 110 | return false; | ||
| 111 | } | ||
| 112 | |||
| 113 | m_Callbacks = INPUTSTREAM_register_me(m_Handle); | ||
| 114 | return m_Callbacks != nullptr; | ||
| 115 | } | ||
| 116 | |||
| 117 | /*! | ||
| 118 | * @brief Allocate a demux packet. Free with FreeDemuxPacket | ||
| 119 | * @param iDataSize The size of the data that will go into the packet | ||
| 120 | * @return The allocated packet | ||
| 121 | */ | ||
| 122 | DemuxPacket* AllocateDemuxPacket(int iDataSize) | ||
| 123 | { | ||
| 124 | return INPUTSTREAM_allocate_demux_packet(m_Handle, m_Callbacks, iDataSize); | ||
| 125 | } | ||
| 126 | |||
| 127 | /*! | ||
| 128 | * @brief Free a packet that was allocated with AllocateDemuxPacket | ||
| 129 | * @param pPacket The packet to free | ||
| 130 | */ | ||
| 131 | void FreeDemuxPacket(DemuxPacket* pPacket) | ||
| 132 | { | ||
| 133 | return INPUTSTREAM_free_demux_packet(m_Handle, m_Callbacks, pPacket); | ||
| 134 | } | ||
| 135 | |||
| 136 | protected: | ||
| 137 | void* (*INPUTSTREAM_register_me)(void*); | ||
| 138 | void (*INPUTSTREAM_unregister_me)(void*, void*); | ||
| 139 | void (*INPUTSTREAM_free_demux_packet)(void*, void*, DemuxPacket*); | ||
| 140 | DemuxPacket* (*INPUTSTREAM_allocate_demux_packet)(void*, void*, int); | ||
| 141 | |||
| 142 | private: | ||
| 143 | void* m_libKODI_inputstream; | ||
| 144 | void* m_Handle; | ||
| 145 | void* m_Callbacks; | ||
| 146 | struct cb_array | ||
| 147 | { | ||
| 148 | const char* libPath; | ||
| 149 | }; | ||
| 150 | }; | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h new file mode 100644 index 0000000..e8d5ec7 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h | |||
| @@ -0,0 +1,710 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 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 XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string> | ||
| 23 | #include <vector> | ||
| 24 | #include <string.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | #include <stdio.h> | ||
| 27 | #include <stdint.h> | ||
| 28 | #include <stdarg.h> | ||
| 29 | |||
| 30 | #if defined(BUILD_KODI_ADDON) | ||
| 31 | #include "IFileTypes.h" | ||
| 32 | #else | ||
| 33 | #include "filesystem/IFileTypes.h" | ||
| 34 | #endif | ||
| 35 | |||
| 36 | struct VFSDirEntry; | ||
| 37 | |||
| 38 | #ifdef _WIN32 // windows | ||
| 39 | #ifndef _SSIZE_T_DEFINED | ||
| 40 | typedef intptr_t ssize_t; | ||
| 41 | #define _SSIZE_T_DEFINED | ||
| 42 | #endif // !_SSIZE_T_DEFINED | ||
| 43 | |||
| 44 | #if defined(BUILD_KODI_ADDON) | ||
| 45 | #include "p8-platform/windows/dlfcn-win32.h" | ||
| 46 | #else | ||
| 47 | #include "dlfcn-win32.h" | ||
| 48 | #endif | ||
| 49 | |||
| 50 | #define ADDON_DLL "\\library.xbmc.addon\\libXBMC_addon" ADDON_HELPER_EXT | ||
| 51 | #define ADDON_HELPER_EXT ".dll" | ||
| 52 | #else // windows | ||
| 53 | // the ADDON_HELPER_ARCH is the platform dependend name which is used | ||
| 54 | // as part of the name of dynamic addon libraries. It has to match the | ||
| 55 | // strings which are set in configure.ac for the "ARCH" variable. | ||
| 56 | #if defined(__APPLE__) // osx | ||
| 57 | #if defined(__arm__) || defined(__aarch64__) | ||
| 58 | #define ADDON_HELPER_ARCH "arm-osx" | ||
| 59 | #else | ||
| 60 | #define ADDON_HELPER_ARCH "x86-osx" | ||
| 61 | #endif | ||
| 62 | #define ADDON_HELPER_EXT ".dylib" | ||
| 63 | #else // linux | ||
| 64 | #if defined(__x86_64__) | ||
| 65 | #define ADDON_HELPER_ARCH "x86_64-linux" | ||
| 66 | #elif defined(_POWERPC) | ||
| 67 | #define ADDON_HELPER_ARCH "powerpc-linux" | ||
| 68 | #elif defined(_POWERPC64) | ||
| 69 | #define ADDON_HELPER_ARCH "powerpc64-linux" | ||
| 70 | #elif defined(__ARMEL__) | ||
| 71 | #define ADDON_HELPER_ARCH "arm" | ||
| 72 | #elif defined(__aarch64__) | ||
| 73 | #define ADDON_HELPER_ARCH "aarch64" | ||
| 74 | #elif defined(__mips__) | ||
| 75 | #define ADDON_HELPER_ARCH "mips" | ||
| 76 | #else | ||
| 77 | #define ADDON_HELPER_ARCH "i486-linux" | ||
| 78 | #endif | ||
| 79 | #define ADDON_HELPER_EXT ".so" | ||
| 80 | #endif | ||
| 81 | #include <dlfcn.h> // linux+osx | ||
| 82 | #define ADDON_DLL_NAME "libXBMC_addon-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 83 | #define ADDON_DLL "/library.xbmc.addon/" ADDON_DLL_NAME | ||
| 84 | #endif | ||
| 85 | #if defined(ANDROID) | ||
| 86 | #include <sys/stat.h> | ||
| 87 | #endif | ||
| 88 | |||
| 89 | #ifdef LOG_DEBUG | ||
| 90 | #undef LOG_DEBUG | ||
| 91 | #endif | ||
| 92 | #ifdef LOG_INFO | ||
| 93 | #undef LOG_INFO | ||
| 94 | #endif | ||
| 95 | #ifdef LOG_NOTICE | ||
| 96 | #undef LOG_NOTICE | ||
| 97 | #endif | ||
| 98 | #ifdef LOG_ERROR | ||
| 99 | #undef LOG_ERROR | ||
| 100 | #endif | ||
| 101 | |||
| 102 | namespace ADDON | ||
| 103 | { | ||
| 104 | typedef enum addon_log | ||
| 105 | { | ||
| 106 | LOG_DEBUG, | ||
| 107 | LOG_INFO, | ||
| 108 | LOG_NOTICE, | ||
| 109 | LOG_ERROR | ||
| 110 | } addon_log_t; | ||
| 111 | |||
| 112 | typedef enum queue_msg | ||
| 113 | { | ||
| 114 | QUEUE_INFO, | ||
| 115 | QUEUE_WARNING, | ||
| 116 | QUEUE_ERROR | ||
| 117 | } queue_msg_t; | ||
| 118 | |||
| 119 | class CHelper_libXBMC_addon | ||
| 120 | { | ||
| 121 | public: | ||
| 122 | CHelper_libXBMC_addon() | ||
| 123 | { | ||
| 124 | m_libXBMC_addon = NULL; | ||
| 125 | m_Handle = NULL; | ||
| 126 | } | ||
| 127 | |||
| 128 | ~CHelper_libXBMC_addon() | ||
| 129 | { | ||
| 130 | if (m_libXBMC_addon) | ||
| 131 | { | ||
| 132 | XBMC_unregister_me(m_Handle, m_Callbacks); | ||
| 133 | dlclose(m_libXBMC_addon); | ||
| 134 | } | ||
| 135 | } | ||
| 136 | |||
| 137 | bool RegisterMe(void *Handle) | ||
| 138 | { | ||
| 139 | m_Handle = Handle; | ||
| 140 | |||
| 141 | std::string libBasePath; | ||
| 142 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 143 | libBasePath += ADDON_DLL; | ||
| 144 | |||
| 145 | #if defined(ANDROID) | ||
| 146 | struct stat st; | ||
| 147 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 148 | { | ||
| 149 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 150 | libBasePath = tempbin + "/" + ADDON_DLL_NAME; | ||
| 151 | } | ||
| 152 | #endif | ||
| 153 | |||
| 154 | m_libXBMC_addon = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 155 | if (m_libXBMC_addon == NULL) | ||
| 156 | { | ||
| 157 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 158 | return false; | ||
| 159 | } | ||
| 160 | |||
| 161 | XBMC_register_me = (void* (*)(void *HANDLE)) | ||
| 162 | dlsym(m_libXBMC_addon, "XBMC_register_me"); | ||
| 163 | if (XBMC_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 164 | |||
| 165 | XBMC_unregister_me = (void (*)(void* HANDLE, void* CB)) | ||
| 166 | dlsym(m_libXBMC_addon, "XBMC_unregister_me"); | ||
| 167 | if (XBMC_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 168 | |||
| 169 | XBMC_log = (void (*)(void* HANDLE, void* CB, const addon_log_t loglevel, const char *msg)) | ||
| 170 | dlsym(m_libXBMC_addon, "XBMC_log"); | ||
| 171 | if (XBMC_log == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 172 | |||
| 173 | XBMC_get_setting = (bool (*)(void* HANDLE, void* CB, const char* settingName, void *settingValue)) | ||
| 174 | dlsym(m_libXBMC_addon, "XBMC_get_setting"); | ||
| 175 | if (XBMC_get_setting == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 176 | |||
| 177 | XBMC_queue_notification = (void (*)(void* HANDLE, void* CB, const queue_msg_t loglevel, const char *msg)) | ||
| 178 | dlsym(m_libXBMC_addon, "XBMC_queue_notification"); | ||
| 179 | if (XBMC_queue_notification == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 180 | |||
| 181 | XBMC_wake_on_lan = (bool (*)(void* HANDLE, void *CB, const char *mac)) | ||
| 182 | dlsym(m_libXBMC_addon, "XBMC_wake_on_lan"); | ||
| 183 | if (XBMC_wake_on_lan == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 184 | |||
| 185 | XBMC_unknown_to_utf8 = (char* (*)(void* HANDLE, void* CB, const char* str)) | ||
| 186 | dlsym(m_libXBMC_addon, "XBMC_unknown_to_utf8"); | ||
| 187 | if (XBMC_unknown_to_utf8 == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 188 | |||
| 189 | XBMC_get_localized_string = (char* (*)(void* HANDLE, void* CB, int dwCode)) | ||
| 190 | dlsym(m_libXBMC_addon, "XBMC_get_localized_string"); | ||
| 191 | if (XBMC_get_localized_string == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 192 | |||
| 193 | XBMC_free_string = (void (*)(void* HANDLE, void* CB, char* str)) | ||
| 194 | dlsym(m_libXBMC_addon, "XBMC_free_string"); | ||
| 195 | if (XBMC_free_string == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 196 | |||
| 197 | XBMC_get_dvd_menu_language = (char* (*)(void* HANDLE, void* CB)) | ||
| 198 | dlsym(m_libXBMC_addon, "XBMC_get_dvd_menu_language"); | ||
| 199 | if (XBMC_get_dvd_menu_language == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 200 | |||
| 201 | XBMC_open_file = (void* (*)(void* HANDLE, void* CB, const char* strFileName, unsigned int flags)) | ||
| 202 | dlsym(m_libXBMC_addon, "XBMC_open_file"); | ||
| 203 | if (XBMC_open_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 204 | |||
| 205 | XBMC_open_file_for_write = (void* (*)(void* HANDLE, void* CB, const char* strFileName, bool bOverWrite)) | ||
| 206 | dlsym(m_libXBMC_addon, "XBMC_open_file_for_write"); | ||
| 207 | if (XBMC_open_file_for_write == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 208 | |||
| 209 | XBMC_read_file = (ssize_t (*)(void* HANDLE, void* CB, void* file, void* lpBuf, size_t uiBufSize)) | ||
| 210 | dlsym(m_libXBMC_addon, "XBMC_read_file"); | ||
| 211 | if (XBMC_read_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 212 | |||
| 213 | XBMC_read_file_string = (bool (*)(void* HANDLE, void* CB, void* file, char *szLine, int iLineLength)) | ||
| 214 | dlsym(m_libXBMC_addon, "XBMC_read_file_string"); | ||
| 215 | if (XBMC_read_file_string == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 216 | |||
| 217 | XBMC_write_file = (ssize_t (*)(void* HANDLE, void* CB, void* file, const void* lpBuf, size_t uiBufSize)) | ||
| 218 | dlsym(m_libXBMC_addon, "XBMC_write_file"); | ||
| 219 | if (XBMC_write_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 220 | |||
| 221 | XBMC_flush_file = (void (*)(void* HANDLE, void* CB, void* file)) | ||
| 222 | dlsym(m_libXBMC_addon, "XBMC_flush_file"); | ||
| 223 | if (XBMC_flush_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 224 | |||
| 225 | XBMC_seek_file = (int64_t (*)(void* HANDLE, void* CB, void* file, int64_t iFilePosition, int iWhence)) | ||
| 226 | dlsym(m_libXBMC_addon, "XBMC_seek_file"); | ||
| 227 | if (XBMC_seek_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 228 | |||
| 229 | XBMC_truncate_file = (int (*)(void* HANDLE, void* CB, void* file, int64_t iSize)) | ||
| 230 | dlsym(m_libXBMC_addon, "XBMC_truncate_file"); | ||
| 231 | if (XBMC_truncate_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 232 | |||
| 233 | XBMC_get_file_position = (int64_t (*)(void* HANDLE, void* CB, void* file)) | ||
| 234 | dlsym(m_libXBMC_addon, "XBMC_get_file_position"); | ||
| 235 | if (XBMC_get_file_position == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 236 | |||
| 237 | XBMC_get_file_length = (int64_t (*)(void* HANDLE, void* CB, void* file)) | ||
| 238 | dlsym(m_libXBMC_addon, "XBMC_get_file_length"); | ||
| 239 | if (XBMC_get_file_length == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 240 | |||
| 241 | XBMC_get_file_download_speed = (double(*)(void* HANDLE, void* CB, void* file)) | ||
| 242 | dlsym(m_libXBMC_addon, "XBMC_get_file_download_speed"); | ||
| 243 | if (XBMC_get_file_download_speed == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 244 | |||
| 245 | XBMC_close_file = (void (*)(void* HANDLE, void* CB, void* file)) | ||
| 246 | dlsym(m_libXBMC_addon, "XBMC_close_file"); | ||
| 247 | if (XBMC_close_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 248 | |||
| 249 | XBMC_get_file_chunk_size = (int (*)(void* HANDLE, void* CB, void* file)) | ||
| 250 | dlsym(m_libXBMC_addon, "XBMC_get_file_chunk_size"); | ||
| 251 | if (XBMC_get_file_chunk_size == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 252 | |||
| 253 | XBMC_file_exists = (bool (*)(void* HANDLE, void* CB, const char *strFileName, bool bUseCache)) | ||
| 254 | dlsym(m_libXBMC_addon, "XBMC_file_exists"); | ||
| 255 | if (XBMC_file_exists == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 256 | |||
| 257 | XBMC_stat_file = (int (*)(void* HANDLE, void* CB, const char *strFileName, struct __stat64* buffer)) | ||
| 258 | dlsym(m_libXBMC_addon, "XBMC_stat_file"); | ||
| 259 | if (XBMC_stat_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 260 | |||
| 261 | XBMC_delete_file = (bool (*)(void* HANDLE, void* CB, const char *strFileName)) | ||
| 262 | dlsym(m_libXBMC_addon, "XBMC_delete_file"); | ||
| 263 | if (XBMC_delete_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 264 | |||
| 265 | XBMC_can_open_directory = (bool (*)(void* HANDLE, void* CB, const char* strURL)) | ||
| 266 | dlsym(m_libXBMC_addon, "XBMC_can_open_directory"); | ||
| 267 | if (XBMC_can_open_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 268 | |||
| 269 | XBMC_create_directory = (bool (*)(void* HANDLE, void* CB, const char* strPath)) | ||
| 270 | dlsym(m_libXBMC_addon, "XBMC_create_directory"); | ||
| 271 | if (XBMC_create_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 272 | |||
| 273 | XBMC_directory_exists = (bool (*)(void* HANDLE, void* CB, const char* strPath)) | ||
| 274 | dlsym(m_libXBMC_addon, "XBMC_directory_exists"); | ||
| 275 | if (XBMC_directory_exists == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 276 | |||
| 277 | XBMC_remove_directory = (bool (*)(void* HANDLE, void* CB, const char* strPath)) | ||
| 278 | dlsym(m_libXBMC_addon, "XBMC_remove_directory"); | ||
| 279 | if (XBMC_remove_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 280 | |||
| 281 | XBMC_get_directory = (bool (*)(void* HANDLE, void* CB, const char* strPath, const char* mask, VFSDirEntry** items, unsigned int* num_items)) | ||
| 282 | dlsym(m_libXBMC_addon, "XBMC_get_directory"); | ||
| 283 | if (XBMC_get_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 284 | |||
| 285 | XBMC_free_directory = (void (*)(void* HANDLE, void* CB, VFSDirEntry* items, unsigned int num_items)) | ||
| 286 | dlsym(m_libXBMC_addon, "XBMC_free_directory"); | ||
| 287 | if (XBMC_free_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 288 | |||
| 289 | XBMC_curl_create = (void* (*)(void *HANDLE, void* CB, const char* strURL)) | ||
| 290 | dlsym(m_libXBMC_addon, "XBMC_curl_create"); | ||
| 291 | if (XBMC_curl_create == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 292 | |||
| 293 | XBMC_curl_add_option = (bool (*)(void *HANDLE, void* CB, void *file, XFILE::CURLOPTIONTYPE type, const char* name, const char *value)) | ||
| 294 | dlsym(m_libXBMC_addon, "XBMC_curl_add_option"); | ||
| 295 | if (XBMC_curl_add_option == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 296 | |||
| 297 | XBMC_curl_open = (bool (*)(void *HANDLE, void* CB, void *file, unsigned int flags)) | ||
| 298 | dlsym(m_libXBMC_addon, "XBMC_curl_open"); | ||
| 299 | if (XBMC_curl_open == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 300 | |||
| 301 | m_Callbacks = XBMC_register_me(m_Handle); | ||
| 302 | return m_Callbacks != NULL; | ||
| 303 | } | ||
| 304 | |||
| 305 | /*! | ||
| 306 | * @brief Add a message to XBMC's log. | ||
| 307 | * @param loglevel The log level of the message. | ||
| 308 | * @param format The format of the message to pass to XBMC. | ||
| 309 | */ | ||
| 310 | void Log(const addon_log_t loglevel, const char *format, ... ) | ||
| 311 | { | ||
| 312 | char buffer[16384]; | ||
| 313 | va_list args; | ||
| 314 | va_start (args, format); | ||
| 315 | vsprintf (buffer, format, args); | ||
| 316 | va_end (args); | ||
| 317 | return XBMC_log(m_Handle, m_Callbacks, loglevel, buffer); | ||
| 318 | } | ||
| 319 | |||
| 320 | /*! | ||
| 321 | * @brief Get a settings value for this add-on. | ||
| 322 | * @param settingName The name of the setting to get. | ||
| 323 | * @param settingValue The value. | ||
| 324 | * @return True if the settings was fetched successfully, false otherwise. | ||
| 325 | */ | ||
| 326 | bool GetSetting(const char* settingName, void *settingValue) | ||
| 327 | { | ||
| 328 | return XBMC_get_setting(m_Handle, m_Callbacks, settingName, settingValue); | ||
| 329 | } | ||
| 330 | |||
| 331 | /*! | ||
| 332 | * @brief Queue a notification in the GUI. | ||
| 333 | * @param type The message type. | ||
| 334 | * @param format The format of the message to pass to display in XBMC. | ||
| 335 | */ | ||
| 336 | void QueueNotification(const queue_msg_t type, const char *format, ... ) | ||
| 337 | { | ||
| 338 | char buffer[16384]; | ||
| 339 | va_list args; | ||
| 340 | va_start (args, format); | ||
| 341 | vsprintf (buffer, format, args); | ||
| 342 | va_end (args); | ||
| 343 | return XBMC_queue_notification(m_Handle, m_Callbacks, type, buffer); | ||
| 344 | } | ||
| 345 | |||
| 346 | /*! | ||
| 347 | * @brief Send WakeOnLan magic packet. | ||
| 348 | * @param mac Network address of the host to wake. | ||
| 349 | * @return True if the magic packet was successfully sent, false otherwise. | ||
| 350 | */ | ||
| 351 | bool WakeOnLan(const char* mac) | ||
| 352 | { | ||
| 353 | return XBMC_wake_on_lan(m_Handle, m_Callbacks, mac); | ||
| 354 | } | ||
| 355 | |||
| 356 | /*! | ||
| 357 | * @brief Translate a string with an unknown encoding to UTF8. | ||
| 358 | * @param str The string to translate. | ||
| 359 | * @return The string translated to UTF8. Must be freed by calling FreeString() when done. | ||
| 360 | */ | ||
| 361 | char* UnknownToUTF8(const char* str) | ||
| 362 | { | ||
| 363 | return XBMC_unknown_to_utf8(m_Handle, m_Callbacks, str); | ||
| 364 | } | ||
| 365 | |||
| 366 | /*! | ||
| 367 | * @brief Get a localised message. | ||
| 368 | * @param dwCode The code of the message to get. | ||
| 369 | * @return The message. Must be freed by calling FreeString() when done. | ||
| 370 | */ | ||
| 371 | char* GetLocalizedString(int dwCode) | ||
| 372 | { | ||
| 373 | return XBMC_get_localized_string(m_Handle, m_Callbacks, dwCode); | ||
| 374 | } | ||
| 375 | |||
| 376 | |||
| 377 | /*! | ||
| 378 | * @brief Get the DVD menu language. | ||
| 379 | * @return The language. Must be freed by calling FreeString() when done. | ||
| 380 | */ | ||
| 381 | char* GetDVDMenuLanguage() | ||
| 382 | { | ||
| 383 | return XBMC_get_dvd_menu_language(m_Handle, m_Callbacks); | ||
| 384 | } | ||
| 385 | |||
| 386 | /*! | ||
| 387 | * @brief Free the memory used by str | ||
| 388 | * @param str The string to free | ||
| 389 | */ | ||
| 390 | void FreeString(char* str) | ||
| 391 | { | ||
| 392 | return XBMC_free_string(m_Handle, m_Callbacks, str); | ||
| 393 | } | ||
| 394 | |||
| 395 | /*! | ||
| 396 | * @brief Open the file with filename via XBMC's CFile. Needs to be closed by calling CloseFile() when done. | ||
| 397 | * @param strFileName The filename to open. | ||
| 398 | * @param flags The flags to pass. Documented in XBMC's File.h | ||
| 399 | * @return A handle for the file, or NULL if it couldn't be opened. | ||
| 400 | */ | ||
| 401 | void* OpenFile(const char* strFileName, unsigned int flags) | ||
| 402 | { | ||
| 403 | return XBMC_open_file(m_Handle, m_Callbacks, strFileName, flags); | ||
| 404 | } | ||
| 405 | |||
| 406 | /*! | ||
| 407 | * @brief Open the file with filename via XBMC's CFile in write mode. Needs to be closed by calling CloseFile() when done. | ||
| 408 | * @param strFileName The filename to open. | ||
| 409 | * @param bOverWrite True to overwrite, false otherwise. | ||
| 410 | * @return A handle for the file, or NULL if it couldn't be opened. | ||
| 411 | */ | ||
| 412 | void* OpenFileForWrite(const char* strFileName, bool bOverWrite) | ||
| 413 | { | ||
| 414 | return XBMC_open_file_for_write(m_Handle, m_Callbacks, strFileName, bOverWrite); | ||
| 415 | } | ||
| 416 | |||
| 417 | /*! | ||
| 418 | * @brief Read from an open file. | ||
| 419 | * @param file The file handle to read from. | ||
| 420 | * @param lpBuf The buffer to store the data in. | ||
| 421 | * @param uiBufSize The size of the buffer. | ||
| 422 | * @return number of successfully read bytes if any bytes were read and stored in | ||
| 423 | * buffer, zero if no bytes are available to read (end of file was reached) | ||
| 424 | * or undetectable error occur, -1 in case of any explicit error | ||
| 425 | */ | ||
| 426 | ssize_t ReadFile(void* file, void* lpBuf, size_t uiBufSize) | ||
| 427 | { | ||
| 428 | return XBMC_read_file(m_Handle, m_Callbacks, file, lpBuf, uiBufSize); | ||
| 429 | } | ||
| 430 | |||
| 431 | /*! | ||
| 432 | * @brief Read a string from an open file. | ||
| 433 | * @param file The file handle to read from. | ||
| 434 | * @param szLine The buffer to store the data in. | ||
| 435 | * @param iLineLength The size of the buffer. | ||
| 436 | * @return True when a line was read, false otherwise. | ||
| 437 | */ | ||
| 438 | bool ReadFileString(void* file, char *szLine, int iLineLength) | ||
| 439 | { | ||
| 440 | return XBMC_read_file_string(m_Handle, m_Callbacks, file, szLine, iLineLength); | ||
| 441 | } | ||
| 442 | |||
| 443 | /*! | ||
| 444 | * @brief Write to a file opened in write mode. | ||
| 445 | * @param file The file handle to write to. | ||
| 446 | * @param lpBuf The data to write. | ||
| 447 | * @param uiBufSize Size of the data to write. | ||
| 448 | * @return number of successfully written bytes if any bytes were written, | ||
| 449 | * zero if no bytes were written and no detectable error occur, | ||
| 450 | * -1 in case of any explicit error | ||
| 451 | */ | ||
| 452 | ssize_t WriteFile(void* file, const void* lpBuf, size_t uiBufSize) | ||
| 453 | { | ||
| 454 | return XBMC_write_file(m_Handle, m_Callbacks, file, lpBuf, uiBufSize); | ||
| 455 | } | ||
| 456 | |||
| 457 | /*! | ||
| 458 | * @brief Flush buffered data. | ||
| 459 | * @param file The file handle to flush the data for. | ||
| 460 | */ | ||
| 461 | void FlushFile(void* file) | ||
| 462 | { | ||
| 463 | return XBMC_flush_file(m_Handle, m_Callbacks, file); | ||
| 464 | } | ||
| 465 | |||
| 466 | /*! | ||
| 467 | * @brief Seek in an open file. | ||
| 468 | * @param file The file handle to see in. | ||
| 469 | * @param iFilePosition The new position. | ||
| 470 | * @param iWhence Seek argument. See stdio.h for possible values. | ||
| 471 | * @return The new position. | ||
| 472 | */ | ||
| 473 | int64_t SeekFile(void* file, int64_t iFilePosition, int iWhence) | ||
| 474 | { | ||
| 475 | return XBMC_seek_file(m_Handle, m_Callbacks, file, iFilePosition, iWhence); | ||
| 476 | } | ||
| 477 | |||
| 478 | /*! | ||
| 479 | * @brief Truncate a file to the requested size. | ||
| 480 | * @param file The file handle to truncate. | ||
| 481 | * @param iSize The new max size. | ||
| 482 | * @return New size? | ||
| 483 | */ | ||
| 484 | int TruncateFile(void* file, int64_t iSize) | ||
| 485 | { | ||
| 486 | return XBMC_truncate_file(m_Handle, m_Callbacks, file, iSize); | ||
| 487 | } | ||
| 488 | |||
| 489 | /*! | ||
| 490 | * @brief The current position in an open file. | ||
| 491 | * @param file The file handle to get the position for. | ||
| 492 | * @return The requested position. | ||
| 493 | */ | ||
| 494 | int64_t GetFilePosition(void* file) | ||
| 495 | { | ||
| 496 | return XBMC_get_file_position(m_Handle, m_Callbacks, file); | ||
| 497 | } | ||
| 498 | |||
| 499 | /*! | ||
| 500 | * @brief Get the file size of an open file. | ||
| 501 | * @param file The file to get the size for. | ||
| 502 | * @return The requested size. | ||
| 503 | */ | ||
| 504 | int64_t GetFileLength(void* file) | ||
| 505 | { | ||
| 506 | return XBMC_get_file_length(m_Handle, m_Callbacks, file); | ||
| 507 | } | ||
| 508 | |||
| 509 | /*! | ||
| 510 | * @brief Get the download speed of an open file if available. | ||
| 511 | * @param file The file to get the size for. | ||
| 512 | * @return The download speed in seconds. | ||
| 513 | */ | ||
| 514 | double GetFileDownloadSpeed(void* file) | ||
| 515 | { | ||
| 516 | return XBMC_get_file_download_speed(m_Handle, m_Callbacks, file); | ||
| 517 | } | ||
| 518 | |||
| 519 | /*! | ||
| 520 | * @brief Close an open file. | ||
| 521 | * @param file The file handle to close. | ||
| 522 | */ | ||
| 523 | void CloseFile(void* file) | ||
| 524 | { | ||
| 525 | return XBMC_close_file(m_Handle, m_Callbacks, file); | ||
| 526 | } | ||
| 527 | |||
| 528 | /*! | ||
| 529 | * @brief Get the chunk size for an open file. | ||
| 530 | * @param file the file handle to get the size for. | ||
| 531 | * @return The requested size. | ||
| 532 | */ | ||
| 533 | int GetFileChunkSize(void* file) | ||
| 534 | { | ||
| 535 | return XBMC_get_file_chunk_size(m_Handle, m_Callbacks, file); | ||
| 536 | } | ||
| 537 | |||
| 538 | /*! | ||
| 539 | * @brief Check if a file exists. | ||
| 540 | * @param strFileName The filename to check. | ||
| 541 | * @param bUseCache Check in file cache. | ||
| 542 | * @return true if the file exists false otherwise. | ||
| 543 | */ | ||
| 544 | bool FileExists(const char *strFileName, bool bUseCache) | ||
| 545 | { | ||
| 546 | return XBMC_file_exists(m_Handle, m_Callbacks, strFileName, bUseCache); | ||
| 547 | } | ||
| 548 | |||
| 549 | /*! | ||
| 550 | * @brief Reads file status. | ||
| 551 | * @param strFileName The filename to read the status from. | ||
| 552 | * @param buffer The file status is written into this buffer. | ||
| 553 | * @return The file status was successfully read. | ||
| 554 | */ | ||
| 555 | int StatFile(const char *strFileName, struct __stat64* buffer) | ||
| 556 | { | ||
| 557 | return XBMC_stat_file(m_Handle, m_Callbacks, strFileName, buffer); | ||
| 558 | } | ||
| 559 | |||
| 560 | /*! | ||
| 561 | * @brief Deletes a file. | ||
| 562 | * @param strFileName The filename to delete. | ||
| 563 | * @return The file was successfully deleted. | ||
| 564 | */ | ||
| 565 | bool DeleteFile(const char *strFileName) | ||
| 566 | { | ||
| 567 | return XBMC_delete_file(m_Handle, m_Callbacks, strFileName); | ||
| 568 | } | ||
| 569 | |||
| 570 | /*! | ||
| 571 | * @brief Checks whether a directory can be opened. | ||
| 572 | * @param strUrl The URL of the directory to check. | ||
| 573 | * @return True when it can be opened, false otherwise. | ||
| 574 | */ | ||
| 575 | bool CanOpenDirectory(const char* strUrl) | ||
| 576 | { | ||
| 577 | return XBMC_can_open_directory(m_Handle, m_Callbacks, strUrl); | ||
| 578 | } | ||
| 579 | |||
| 580 | /*! | ||
| 581 | * @brief Creates a directory. | ||
| 582 | * @param strPath Path to the directory. | ||
| 583 | * @return True when it was created, false otherwise. | ||
| 584 | */ | ||
| 585 | bool CreateDirectory(const char *strPath) | ||
| 586 | { | ||
| 587 | return XBMC_create_directory(m_Handle, m_Callbacks, strPath); | ||
| 588 | } | ||
| 589 | |||
| 590 | /*! | ||
| 591 | * @brief Checks if a directory exists. | ||
| 592 | * @param strPath Path to the directory. | ||
| 593 | * @return True when it exists, false otherwise. | ||
| 594 | */ | ||
| 595 | bool DirectoryExists(const char *strPath) | ||
| 596 | { | ||
| 597 | return XBMC_directory_exists(m_Handle, m_Callbacks, strPath); | ||
| 598 | } | ||
| 599 | |||
| 600 | /*! | ||
| 601 | * @brief Removes a directory. | ||
| 602 | * @param strPath Path to the directory. | ||
| 603 | * @return True when it was removed, false otherwise. | ||
| 604 | */ | ||
| 605 | bool RemoveDirectory(const char *strPath) | ||
| 606 | { | ||
| 607 | return XBMC_remove_directory(m_Handle, m_Callbacks, strPath); | ||
| 608 | } | ||
| 609 | |||
| 610 | /*! | ||
| 611 | * @brief Lists a directory. | ||
| 612 | * @param strPath Path to the directory. | ||
| 613 | * @param mask File mask | ||
| 614 | * @param items The directory entries | ||
| 615 | * @param num_items Number of entries in directory | ||
| 616 | * @return True if listing was successful, false otherwise. | ||
| 617 | */ | ||
| 618 | bool GetDirectory(const char *strPath, const char* mask, VFSDirEntry** items, unsigned int* num_items) | ||
| 619 | { | ||
| 620 | return XBMC_get_directory(m_Handle, m_Callbacks, strPath, mask, items, num_items); | ||
| 621 | } | ||
| 622 | |||
| 623 | /*! | ||
| 624 | * @brief Free a directory list | ||
| 625 | * @param items The directory entries | ||
| 626 | * @param num_items Number of entries in directory | ||
| 627 | */ | ||
| 628 | void FreeDirectory(VFSDirEntry* items, unsigned int num_items) | ||
| 629 | { | ||
| 630 | return XBMC_free_directory(m_Handle, m_Callbacks, items, num_items); | ||
| 631 | } | ||
| 632 | |||
| 633 | /*! | ||
| 634 | * @brief Create a Curl representation | ||
| 635 | * @param strURL the URL of the Type. | ||
| 636 | */ | ||
| 637 | void* CURLCreate(const char* strURL) | ||
| 638 | { | ||
| 639 | return XBMC_curl_create(m_Handle, m_Callbacks, strURL); | ||
| 640 | } | ||
| 641 | |||
| 642 | /*! | ||
| 643 | * @brief Adds options to the curl file created with CURLCeate | ||
| 644 | * @param file file pointer to the file returned by CURLCeate | ||
| 645 | * @param type option type to set | ||
| 646 | * @param name name of the option | ||
| 647 | * @param value value of the option | ||
| 648 | */ | ||
| 649 | bool CURLAddOption(void* file, XFILE::CURLOPTIONTYPE type, const char* name, const char * value) | ||
| 650 | { | ||
| 651 | return XBMC_curl_add_option(m_Handle, m_Callbacks, file, type, name, value); | ||
| 652 | } | ||
| 653 | |||
| 654 | /*! | ||
| 655 | * @brief Opens the curl file created with CURLCeate | ||
| 656 | * @param file file pointer to the file returned by CURLCeate | ||
| 657 | * @param flags one or more bitwise or combinded flags form XFILE | ||
| 658 | */ | ||
| 659 | bool CURLOpen(void* file, unsigned int flags) | ||
| 660 | { | ||
| 661 | return XBMC_curl_open(m_Handle, m_Callbacks, file, flags); | ||
| 662 | } | ||
| 663 | |||
| 664 | protected: | ||
| 665 | void* (*XBMC_register_me)(void *HANDLE); | ||
| 666 | void (*XBMC_unregister_me)(void *HANDLE, void* CB); | ||
| 667 | void (*XBMC_log)(void *HANDLE, void* CB, const addon_log_t loglevel, const char *msg); | ||
| 668 | bool (*XBMC_get_setting)(void *HANDLE, void* CB, const char* settingName, void *settingValue); | ||
| 669 | void (*XBMC_queue_notification)(void *HANDLE, void* CB, const queue_msg_t type, const char *msg); | ||
| 670 | bool (*XBMC_wake_on_lan)(void *HANDLE, void* CB, const char* mac); | ||
| 671 | char* (*XBMC_unknown_to_utf8)(void *HANDLE, void* CB, const char* str); | ||
| 672 | char* (*XBMC_get_localized_string)(void *HANDLE, void* CB, int dwCode); | ||
| 673 | char* (*XBMC_get_dvd_menu_language)(void *HANDLE, void* CB); | ||
| 674 | void (*XBMC_free_string)(void *HANDLE, void* CB, char* str); | ||
| 675 | void* (*XBMC_open_file)(void *HANDLE, void* CB, const char* strFileName, unsigned int flags); | ||
| 676 | void* (*XBMC_open_file_for_write)(void *HANDLE, void* CB, const char* strFileName, bool bOverWrite); | ||
| 677 | ssize_t (*XBMC_read_file)(void *HANDLE, void* CB, void* file, void* lpBuf, size_t uiBufSize); | ||
| 678 | bool (*XBMC_read_file_string)(void *HANDLE, void* CB, void* file, char *szLine, int iLineLength); | ||
| 679 | ssize_t(*XBMC_write_file)(void *HANDLE, void* CB, void* file, const void* lpBuf, size_t uiBufSize); | ||
| 680 | void (*XBMC_flush_file)(void *HANDLE, void* CB, void* file); | ||
| 681 | int64_t (*XBMC_seek_file)(void *HANDLE, void* CB, void* file, int64_t iFilePosition, int iWhence); | ||
| 682 | int (*XBMC_truncate_file)(void *HANDLE, void* CB, void* file, int64_t iSize); | ||
| 683 | int64_t (*XBMC_get_file_position)(void *HANDLE, void* CB, void* file); | ||
| 684 | int64_t (*XBMC_get_file_length)(void *HANDLE, void* CB, void* file); | ||
| 685 | double(*XBMC_get_file_download_speed)(void *HANDLE, void* CB, void* file); | ||
| 686 | void (*XBMC_close_file)(void *HANDLE, void* CB, void* file); | ||
| 687 | int (*XBMC_get_file_chunk_size)(void *HANDLE, void* CB, void* file); | ||
| 688 | bool (*XBMC_file_exists)(void *HANDLE, void* CB, const char *strFileName, bool bUseCache); | ||
| 689 | int (*XBMC_stat_file)(void *HANDLE, void* CB, const char *strFileName, struct __stat64* buffer); | ||
| 690 | bool (*XBMC_delete_file)(void *HANDLE, void* CB, const char *strFileName); | ||
| 691 | bool (*XBMC_can_open_directory)(void *HANDLE, void* CB, const char* strURL); | ||
| 692 | bool (*XBMC_create_directory)(void *HANDLE, void* CB, const char* strPath); | ||
| 693 | bool (*XBMC_directory_exists)(void *HANDLE, void* CB, const char* strPath); | ||
| 694 | bool (*XBMC_remove_directory)(void *HANDLE, void* CB, const char* strPath); | ||
| 695 | bool (*XBMC_get_directory)(void *HANDLE, void* CB, const char* strPath, const char* mask, VFSDirEntry** items, unsigned int* num_items); | ||
| 696 | void (*XBMC_free_directory)(void *HANDLE, void* CB, VFSDirEntry* items, unsigned int num_items); | ||
| 697 | void* (*XBMC_curl_create)(void *HANDLE, void* CB, const char* strURL); | ||
| 698 | bool (*XBMC_curl_add_option)(void *HANDLE, void* CB, void *file, XFILE::CURLOPTIONTYPE type, const char* name, const char *value); | ||
| 699 | bool (*XBMC_curl_open)(void *m_Handle, void *m_Callbacks, void *file, unsigned int flags); | ||
| 700 | |||
| 701 | private: | ||
| 702 | void *m_libXBMC_addon; | ||
| 703 | void *m_Handle; | ||
| 704 | void *m_Callbacks; | ||
| 705 | struct cb_array | ||
| 706 | { | ||
| 707 | const char* libPath; | ||
| 708 | }; | ||
| 709 | }; | ||
| 710 | }; | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h new file mode 100644 index 0000000..3853f08 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 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 XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string> | ||
| 23 | #include <vector> | ||
| 24 | #include <string.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | #include <stdio.h> | ||
| 27 | #include "xbmc_codec_types.h" | ||
| 28 | #include "libXBMC_addon.h" | ||
| 29 | |||
| 30 | #ifdef _WIN32 | ||
| 31 | #define CODEC_HELPER_DLL "\\library.xbmc.codec\\libXBMC_codec" ADDON_HELPER_EXT | ||
| 32 | #else | ||
| 33 | #define CODEC_HELPER_DLL_NAME "libXBMC_codec-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 34 | #define CODEC_HELPER_DLL "/library.xbmc.codec/" CODEC_HELPER_DLL_NAME | ||
| 35 | #endif | ||
| 36 | |||
| 37 | class CHelper_libXBMC_codec | ||
| 38 | { | ||
| 39 | public: | ||
| 40 | CHelper_libXBMC_codec(void) | ||
| 41 | { | ||
| 42 | m_libXBMC_codec = NULL; | ||
| 43 | m_Handle = NULL; | ||
| 44 | } | ||
| 45 | |||
| 46 | ~CHelper_libXBMC_codec(void) | ||
| 47 | { | ||
| 48 | if (m_libXBMC_codec) | ||
| 49 | { | ||
| 50 | CODEC_unregister_me(m_Handle, m_Callbacks); | ||
| 51 | dlclose(m_libXBMC_codec); | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | /*! | ||
| 56 | * @brief Resolve all callback methods | ||
| 57 | * @param handle Pointer to the add-on | ||
| 58 | * @return True when all methods were resolved, false otherwise. | ||
| 59 | */ | ||
| 60 | bool RegisterMe(void* handle) | ||
| 61 | { | ||
| 62 | m_Handle = handle; | ||
| 63 | |||
| 64 | std::string libBasePath; | ||
| 65 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 66 | libBasePath += CODEC_HELPER_DLL; | ||
| 67 | |||
| 68 | #if defined(ANDROID) | ||
| 69 | struct stat st; | ||
| 70 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 71 | { | ||
| 72 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 73 | libBasePath = tempbin + "/" + CODEC_HELPER_DLL_NAME; | ||
| 74 | } | ||
| 75 | #endif | ||
| 76 | |||
| 77 | m_libXBMC_codec = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 78 | if (m_libXBMC_codec == NULL) | ||
| 79 | { | ||
| 80 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 81 | return false; | ||
| 82 | } | ||
| 83 | |||
| 84 | CODEC_register_me = (void* (*)(void *HANDLE)) | ||
| 85 | dlsym(m_libXBMC_codec, "CODEC_register_me"); | ||
| 86 | if (CODEC_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 87 | |||
| 88 | CODEC_unregister_me = (void (*)(void* HANDLE, void* CB)) | ||
| 89 | dlsym(m_libXBMC_codec, "CODEC_unregister_me"); | ||
| 90 | if (CODEC_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 91 | |||
| 92 | CODEC_get_codec_by_name = (xbmc_codec_t (*)(void* HANDLE, void* CB, const char* strCodecName)) | ||
| 93 | dlsym(m_libXBMC_codec, "CODEC_get_codec_by_name"); | ||
| 94 | if (CODEC_get_codec_by_name == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 95 | |||
| 96 | m_Callbacks = CODEC_register_me(m_Handle); | ||
| 97 | return m_Callbacks != NULL; | ||
| 98 | } | ||
| 99 | |||
| 100 | /*! | ||
| 101 | * @brief Get the codec id used by XBMC | ||
| 102 | * @param strCodecName The name of the codec | ||
| 103 | * @return The codec_id, or a codec_id with 0 values when not supported | ||
| 104 | */ | ||
| 105 | xbmc_codec_t GetCodecByName(const char* strCodecName) | ||
| 106 | { | ||
| 107 | return CODEC_get_codec_by_name(m_Handle, m_Callbacks, strCodecName); | ||
| 108 | } | ||
| 109 | |||
| 110 | protected: | ||
| 111 | void* (*CODEC_register_me)(void*); | ||
| 112 | void (*CODEC_unregister_me)(void*, void*); | ||
| 113 | xbmc_codec_t (*CODEC_get_codec_by_name)(void *HANDLE, void* CB, const char* strCodecName); | ||
| 114 | |||
| 115 | private: | ||
| 116 | void* m_libXBMC_codec; | ||
| 117 | void* m_Handle; | ||
| 118 | void* m_Callbacks; | ||
| 119 | struct cb_array | ||
| 120 | { | ||
| 121 | const char* libPath; | ||
| 122 | }; | ||
| 123 | }; | ||
| 124 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h new file mode 100644 index 0000000..3e3d479 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h | |||
| @@ -0,0 +1,366 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 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 XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string> | ||
| 23 | #include <vector> | ||
| 24 | #include <string.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | #include <stdio.h> | ||
| 27 | #include "xbmc_pvr_types.h" | ||
| 28 | #include "libXBMC_addon.h" | ||
| 29 | |||
| 30 | #ifdef _WIN32 | ||
| 31 | #define PVR_HELPER_DLL "\\library.xbmc.pvr\\libXBMC_pvr" ADDON_HELPER_EXT | ||
| 32 | #else | ||
| 33 | #define PVR_HELPER_DLL_NAME "libXBMC_pvr-" ADDON_HELPER_ARCH ADDON_HELPER_EXT | ||
| 34 | #define PVR_HELPER_DLL "/library.xbmc.pvr/" PVR_HELPER_DLL_NAME | ||
| 35 | #endif | ||
| 36 | |||
| 37 | #define DVD_TIME_BASE 1000000 | ||
| 38 | #define DVD_NOPTS_VALUE (-1LL<<52) // should be possible to represent in both double and __int64 | ||
| 39 | |||
| 40 | class CHelper_libXBMC_pvr | ||
| 41 | { | ||
| 42 | public: | ||
| 43 | CHelper_libXBMC_pvr(void) | ||
| 44 | { | ||
| 45 | m_libXBMC_pvr = NULL; | ||
| 46 | m_Handle = NULL; | ||
| 47 | } | ||
| 48 | |||
| 49 | ~CHelper_libXBMC_pvr(void) | ||
| 50 | { | ||
| 51 | if (m_libXBMC_pvr) | ||
| 52 | { | ||
| 53 | PVR_unregister_me(m_Handle, m_Callbacks); | ||
| 54 | dlclose(m_libXBMC_pvr); | ||
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | /*! | ||
| 59 | * @brief Resolve all callback methods | ||
| 60 | * @param handle Pointer to the add-on | ||
| 61 | * @return True when all methods were resolved, false otherwise. | ||
| 62 | */ | ||
| 63 | bool RegisterMe(void* handle) | ||
| 64 | { | ||
| 65 | m_Handle = handle; | ||
| 66 | |||
| 67 | std::string libBasePath; | ||
| 68 | libBasePath = ((cb_array*)m_Handle)->libPath; | ||
| 69 | libBasePath += PVR_HELPER_DLL; | ||
| 70 | |||
| 71 | #if defined(ANDROID) | ||
| 72 | struct stat st; | ||
| 73 | if(stat(libBasePath.c_str(),&st) != 0) | ||
| 74 | { | ||
| 75 | std::string tempbin = getenv("XBMC_ANDROID_LIBS"); | ||
| 76 | libBasePath = tempbin + "/" + PVR_HELPER_DLL_NAME; | ||
| 77 | } | ||
| 78 | #endif | ||
| 79 | |||
| 80 | m_libXBMC_pvr = dlopen(libBasePath.c_str(), RTLD_LAZY); | ||
| 81 | if (m_libXBMC_pvr == NULL) | ||
| 82 | { | ||
| 83 | fprintf(stderr, "Unable to load %s\n", dlerror()); | ||
| 84 | return false; | ||
| 85 | } | ||
| 86 | |||
| 87 | PVR_register_me = (void* (*)(void *HANDLE)) | ||
| 88 | dlsym(m_libXBMC_pvr, "PVR_register_me"); | ||
| 89 | if (PVR_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 90 | |||
| 91 | PVR_unregister_me = (void (*)(void* HANDLE, void* CB)) | ||
| 92 | dlsym(m_libXBMC_pvr, "PVR_unregister_me"); | ||
| 93 | if (PVR_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 94 | |||
| 95 | PVR_transfer_epg_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const EPG_TAG *epgentry)) | ||
| 96 | dlsym(m_libXBMC_pvr, "PVR_transfer_epg_entry"); | ||
| 97 | if (PVR_transfer_epg_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 98 | |||
| 99 | PVR_transfer_channel_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL *chan)) | ||
| 100 | dlsym(m_libXBMC_pvr, "PVR_transfer_channel_entry"); | ||
| 101 | if (PVR_transfer_channel_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 102 | |||
| 103 | PVR_transfer_timer_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_TIMER *timer)) | ||
| 104 | dlsym(m_libXBMC_pvr, "PVR_transfer_timer_entry"); | ||
| 105 | if (PVR_transfer_timer_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 106 | |||
| 107 | PVR_transfer_recording_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_RECORDING *recording)) | ||
| 108 | dlsym(m_libXBMC_pvr, "PVR_transfer_recording_entry"); | ||
| 109 | if (PVR_transfer_recording_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 110 | |||
| 111 | PVR_add_menu_hook = (void (*)(void* HANDLE, void* CB, PVR_MENUHOOK *hook)) | ||
| 112 | dlsym(m_libXBMC_pvr, "PVR_add_menu_hook"); | ||
| 113 | if (PVR_add_menu_hook == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 114 | |||
| 115 | PVR_recording = (void (*)(void* HANDLE, void* CB, const char *Name, const char *FileName, bool On)) | ||
| 116 | dlsym(m_libXBMC_pvr, "PVR_recording"); | ||
| 117 | if (PVR_recording == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 118 | |||
| 119 | PVR_trigger_timer_update = (void (*)(void* HANDLE, void* CB)) | ||
| 120 | dlsym(m_libXBMC_pvr, "PVR_trigger_timer_update"); | ||
| 121 | if (PVR_trigger_timer_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 122 | |||
| 123 | PVR_trigger_recording_update = (void (*)(void* HANDLE, void* CB)) | ||
| 124 | dlsym(m_libXBMC_pvr, "PVR_trigger_recording_update"); | ||
| 125 | if (PVR_trigger_recording_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 126 | |||
| 127 | PVR_trigger_channel_update = (void (*)(void* HANDLE, void* CB)) | ||
| 128 | dlsym(m_libXBMC_pvr, "PVR_trigger_channel_update"); | ||
| 129 | if (PVR_trigger_channel_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 130 | |||
| 131 | PVR_trigger_channel_groups_update = (void (*)(void* HANDLE, void* CB)) | ||
| 132 | dlsym(m_libXBMC_pvr, "PVR_trigger_channel_groups_update"); | ||
| 133 | if (PVR_trigger_channel_groups_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 134 | |||
| 135 | PVR_trigger_epg_update = (void (*)(void* HANDLE, void* CB, unsigned int iChannelUid)) | ||
| 136 | dlsym(m_libXBMC_pvr, "PVR_trigger_epg_update"); | ||
| 137 | if (PVR_trigger_epg_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 138 | |||
| 139 | PVR_transfer_channel_group = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP *group)) | ||
| 140 | dlsym(m_libXBMC_pvr, "PVR_transfer_channel_group"); | ||
| 141 | if (PVR_transfer_channel_group == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 142 | |||
| 143 | PVR_transfer_channel_group_member = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER *member)) | ||
| 144 | dlsym(m_libXBMC_pvr, "PVR_transfer_channel_group_member"); | ||
| 145 | if (PVR_transfer_channel_group_member == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 146 | |||
| 147 | #ifdef USE_DEMUX | ||
| 148 | PVR_free_demux_packet = (void (*)(void* HANDLE, void* CB, DemuxPacket* pPacket)) | ||
| 149 | dlsym(m_libXBMC_pvr, "PVR_free_demux_packet"); | ||
| 150 | if (PVR_free_demux_packet == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 151 | |||
| 152 | PVR_allocate_demux_packet = (DemuxPacket* (*)(void* HANDLE, void* CB, int iDataSize)) | ||
| 153 | dlsym(m_libXBMC_pvr, "PVR_allocate_demux_packet"); | ||
| 154 | if (PVR_allocate_demux_packet == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 155 | #endif | ||
| 156 | |||
| 157 | PVR_connection_state_change = (void (*)(void* HANDLE, void* CB, const char *strConnectionString, PVR_CONNECTION_STATE newState, const char *strMessage)) | ||
| 158 | dlsym(m_libXBMC_pvr, "PVR_connection_state_change"); | ||
| 159 | if (PVR_connection_state_change == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 160 | |||
| 161 | PVR_epg_event_state_change = (void (*)(void* HANDLE, void* CB, EPG_TAG* tag, unsigned int iUniqueChannelId, EPG_EVENT_STATE newState)) | ||
| 162 | dlsym(m_libXBMC_pvr, "PVR_epg_event_state_change"); | ||
| 163 | if (PVR_epg_event_state_change == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } | ||
| 164 | |||
| 165 | m_Callbacks = PVR_register_me(m_Handle); | ||
| 166 | return m_Callbacks != NULL; | ||
| 167 | } | ||
| 168 | |||
| 169 | /*! | ||
| 170 | * @brief Transfer an EPG tag from the add-on to XBMC | ||
| 171 | * @param handle The handle parameter that XBMC used when requesting the EPG data | ||
| 172 | * @param entry The entry to transfer to XBMC | ||
| 173 | */ | ||
| 174 | void TransferEpgEntry(const ADDON_HANDLE handle, const EPG_TAG* entry) | ||
| 175 | { | ||
| 176 | return PVR_transfer_epg_entry(m_Handle, m_Callbacks, handle, entry); | ||
| 177 | } | ||
| 178 | |||
| 179 | /*! | ||
| 180 | * @brief Transfer a channel entry from the add-on to XBMC | ||
| 181 | * @param handle The handle parameter that XBMC used when requesting the channel list | ||
| 182 | * @param entry The entry to transfer to XBMC | ||
| 183 | */ | ||
| 184 | void TransferChannelEntry(const ADDON_HANDLE handle, const PVR_CHANNEL* entry) | ||
| 185 | { | ||
| 186 | return PVR_transfer_channel_entry(m_Handle, m_Callbacks, handle, entry); | ||
| 187 | } | ||
| 188 | |||
| 189 | /*! | ||
| 190 | * @brief Transfer a timer entry from the add-on to XBMC | ||
| 191 | * @param handle The handle parameter that XBMC used when requesting the timers list | ||
| 192 | * @param entry The entry to transfer to XBMC | ||
| 193 | */ | ||
| 194 | void TransferTimerEntry(const ADDON_HANDLE handle, const PVR_TIMER* entry) | ||
| 195 | { | ||
| 196 | return PVR_transfer_timer_entry(m_Handle, m_Callbacks, handle, entry); | ||
| 197 | } | ||
| 198 | |||
| 199 | /*! | ||
| 200 | * @brief Transfer a recording entry from the add-on to XBMC | ||
| 201 | * @param handle The handle parameter that XBMC used when requesting the recordings list | ||
| 202 | * @param entry The entry to transfer to XBMC | ||
| 203 | */ | ||
| 204 | void TransferRecordingEntry(const ADDON_HANDLE handle, const PVR_RECORDING* entry) | ||
| 205 | { | ||
| 206 | return PVR_transfer_recording_entry(m_Handle, m_Callbacks, handle, entry); | ||
| 207 | } | ||
| 208 | |||
| 209 | /*! | ||
| 210 | * @brief Transfer a channel group from the add-on to XBMC. The group will be created if it doesn't exist. | ||
| 211 | * @param handle The handle parameter that XBMC used when requesting the channel groups list | ||
| 212 | * @param entry The entry to transfer to XBMC | ||
| 213 | */ | ||
| 214 | void TransferChannelGroup(const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP* entry) | ||
| 215 | { | ||
| 216 | return PVR_transfer_channel_group(m_Handle, m_Callbacks, handle, entry); | ||
| 217 | } | ||
| 218 | |||
| 219 | /*! | ||
| 220 | * @brief Transfer a channel group member entry from the add-on to XBMC. The channel will be added to the group if the group can be found. | ||
| 221 | * @param handle The handle parameter that XBMC used when requesting the channel group members list | ||
| 222 | * @param entry The entry to transfer to XBMC | ||
| 223 | */ | ||
| 224 | void TransferChannelGroupMember(const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER* entry) | ||
| 225 | { | ||
| 226 | return PVR_transfer_channel_group_member(m_Handle, m_Callbacks, handle, entry); | ||
| 227 | } | ||
| 228 | |||
| 229 | /*! | ||
| 230 | * @brief Add or replace a menu hook for the context menu for this add-on | ||
| 231 | * @param hook The hook to add | ||
| 232 | */ | ||
| 233 | void AddMenuHook(PVR_MENUHOOK* hook) | ||
| 234 | { | ||
| 235 | return PVR_add_menu_hook(m_Handle, m_Callbacks, hook); | ||
| 236 | } | ||
| 237 | |||
| 238 | /*! | ||
| 239 | * @brief Display a notification in XBMC that a recording started or stopped on the server | ||
| 240 | * @param strRecordingName The name of the recording to display | ||
| 241 | * @param strFileName The filename of the recording | ||
| 242 | * @param bOn True when recording started, false when it stopped | ||
| 243 | */ | ||
| 244 | void Recording(const char* strRecordingName, const char* strFileName, bool bOn) | ||
| 245 | { | ||
| 246 | return PVR_recording(m_Handle, m_Callbacks, strRecordingName, strFileName, bOn); | ||
| 247 | } | ||
| 248 | |||
| 249 | /*! | ||
| 250 | * @brief Request XBMC to update it's list of timers | ||
| 251 | */ | ||
| 252 | void TriggerTimerUpdate(void) | ||
| 253 | { | ||
| 254 | return PVR_trigger_timer_update(m_Handle, m_Callbacks); | ||
| 255 | } | ||
| 256 | |||
| 257 | /*! | ||
| 258 | * @brief Request XBMC to update it's list of recordings | ||
| 259 | */ | ||
| 260 | void TriggerRecordingUpdate(void) | ||
| 261 | { | ||
| 262 | return PVR_trigger_recording_update(m_Handle, m_Callbacks); | ||
| 263 | } | ||
| 264 | |||
| 265 | /*! | ||
| 266 | * @brief Request XBMC to update it's list of channels | ||
| 267 | */ | ||
| 268 | void TriggerChannelUpdate(void) | ||
| 269 | { | ||
| 270 | return PVR_trigger_channel_update(m_Handle, m_Callbacks); | ||
| 271 | } | ||
| 272 | |||
| 273 | /*! | ||
| 274 | * @brief Schedule an EPG update for the given channel channel | ||
| 275 | * @param iChannelUid The unique id of the channel for this add-on | ||
| 276 | */ | ||
| 277 | void TriggerEpgUpdate(unsigned int iChannelUid) | ||
| 278 | { | ||
| 279 | return PVR_trigger_epg_update(m_Handle, m_Callbacks, iChannelUid); | ||
| 280 | } | ||
| 281 | |||
| 282 | /*! | ||
| 283 | * @brief Request XBMC to update it's list of channel groups | ||
| 284 | */ | ||
| 285 | void TriggerChannelGroupsUpdate(void) | ||
| 286 | { | ||
| 287 | return PVR_trigger_channel_groups_update(m_Handle, m_Callbacks); | ||
| 288 | } | ||
| 289 | |||
| 290 | #ifdef USE_DEMUX | ||
| 291 | /*! | ||
| 292 | * @brief Free a packet that was allocated with AllocateDemuxPacket | ||
| 293 | * @param pPacket The packet to free | ||
| 294 | */ | ||
| 295 | void FreeDemuxPacket(DemuxPacket* pPacket) | ||
| 296 | { | ||
| 297 | return PVR_free_demux_packet(m_Handle, m_Callbacks, pPacket); | ||
| 298 | } | ||
| 299 | |||
| 300 | /*! | ||
| 301 | * @brief Allocate a demux packet. Free with FreeDemuxPacket | ||
| 302 | * @param iDataSize The size of the data that will go into the packet | ||
| 303 | * @return The allocated packet | ||
| 304 | */ | ||
| 305 | DemuxPacket* AllocateDemuxPacket(int iDataSize) | ||
| 306 | { | ||
| 307 | return PVR_allocate_demux_packet(m_Handle, m_Callbacks, iDataSize); | ||
| 308 | } | ||
| 309 | #endif | ||
| 310 | |||
| 311 | /*! | ||
| 312 | * @brief Notify a state change for a PVR backend connection | ||
| 313 | * @param strConnectionString The connection string reported by the backend that can be displayed in the UI. | ||
| 314 | * @param newState The new state. | ||
| 315 | * @param strMessage A localized addon-defined string representing the new state, that can be displayed | ||
| 316 | * in the UI or NULL if the Kodi-defined default string for the new state shall be displayed. | ||
| 317 | */ | ||
| 318 | void ConnectionStateChange(const char *strConnectionString, PVR_CONNECTION_STATE newState, const char *strMessage) | ||
| 319 | { | ||
| 320 | return PVR_connection_state_change(m_Handle, m_Callbacks, strConnectionString, newState, strMessage); | ||
| 321 | } | ||
| 322 | |||
| 323 | /*! | ||
| 324 | * @brief Notify a state change for an EPG event | ||
| 325 | * @param tag The EPG event. | ||
| 326 | * @param iUniqueChannelId The unique id of the channel for the EPG event | ||
| 327 | * @param newState The new state. For EPG_EVENT_CREATED and EPG_EVENT_UPDATED, tag must be filled with all available | ||
| 328 | * event data, not just a delta. For EPG_EVENT_DELETED, it is sufficient to fill EPG_TAG.iUniqueBroadcastId | ||
| 329 | */ | ||
| 330 | void EpgEventStateChange(EPG_TAG *tag, unsigned int iUniqueChannelId, EPG_EVENT_STATE newState) | ||
| 331 | { | ||
| 332 | return PVR_epg_event_state_change(m_Handle, m_Callbacks, tag, iUniqueChannelId, newState); | ||
| 333 | } | ||
| 334 | |||
| 335 | protected: | ||
| 336 | void* (*PVR_register_me)(void*); | ||
| 337 | void (*PVR_unregister_me)(void*, void*); | ||
| 338 | void (*PVR_transfer_epg_entry)(void*, void*, const ADDON_HANDLE, const EPG_TAG*); | ||
| 339 | void (*PVR_transfer_channel_entry)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL*); | ||
| 340 | void (*PVR_transfer_timer_entry)(void*, void*, const ADDON_HANDLE, const PVR_TIMER*); | ||
| 341 | void (*PVR_transfer_recording_entry)(void*, void*, const ADDON_HANDLE, const PVR_RECORDING*); | ||
| 342 | void (*PVR_add_menu_hook)(void*, void*, PVR_MENUHOOK*); | ||
| 343 | void (*PVR_recording)(void*, void*, const char*, const char*, bool); | ||
| 344 | void (*PVR_trigger_channel_update)(void*, void*); | ||
| 345 | void (*PVR_trigger_channel_groups_update)(void*, void*); | ||
| 346 | void (*PVR_trigger_timer_update)(void*, void*); | ||
| 347 | void (*PVR_trigger_recording_update)(void* , void*); | ||
| 348 | void (*PVR_trigger_epg_update)(void*, void*, unsigned int); | ||
| 349 | void (*PVR_transfer_channel_group)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL_GROUP*); | ||
| 350 | void (*PVR_transfer_channel_group_member)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL_GROUP_MEMBER*); | ||
| 351 | #ifdef USE_DEMUX | ||
| 352 | void (*PVR_free_demux_packet)(void*, void*, DemuxPacket*); | ||
| 353 | DemuxPacket* (*PVR_allocate_demux_packet)(void*, void*, int); | ||
| 354 | #endif | ||
| 355 | void (*PVR_connection_state_change)(void*, void*, const char*, PVR_CONNECTION_STATE, const char*); | ||
| 356 | void (*PVR_epg_event_state_change)(void*, void*, EPG_TAG*, unsigned int, EPG_EVENT_STATE); | ||
| 357 | |||
| 358 | private: | ||
| 359 | void* m_libXBMC_pvr; | ||
| 360 | void* m_Handle; | ||
| 361 | void* m_Callbacks; | ||
| 362 | struct cb_array | ||
| 363 | { | ||
| 364 | const char* libPath; | ||
| 365 | }; | ||
| 366 | }; | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h new file mode 100644 index 0000000..2eb972e --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h | |||
| @@ -0,0 +1,189 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include "xbmc_addon_types.h" | ||
| 24 | |||
| 25 | #include <vector> | ||
| 26 | #include <string.h> | ||
| 27 | #include <stdlib.h> | ||
| 28 | |||
| 29 | class DllSetting | ||
| 30 | { | ||
| 31 | public: | ||
| 32 | enum SETTING_TYPE { NONE=0, CHECK, SPIN }; | ||
| 33 | |||
| 34 | DllSetting(SETTING_TYPE t, const char *n, const char *l) | ||
| 35 | { | ||
| 36 | id = NULL; | ||
| 37 | label = NULL; | ||
| 38 | if (n) | ||
| 39 | { | ||
| 40 | id = new char[strlen(n)+1]; | ||
| 41 | strcpy(id, n); | ||
| 42 | } | ||
| 43 | if (l) | ||
| 44 | { | ||
| 45 | label = new char[strlen(l)+1]; | ||
| 46 | strcpy(label, l); | ||
| 47 | } | ||
| 48 | current = 0; | ||
| 49 | type = t; | ||
| 50 | } | ||
| 51 | |||
| 52 | DllSetting(const DllSetting &rhs) // copy constructor | ||
| 53 | { | ||
| 54 | id = NULL; | ||
| 55 | label = NULL; | ||
| 56 | if (rhs.id) | ||
| 57 | { | ||
| 58 | id = new char[strlen(rhs.id)+1]; | ||
| 59 | strcpy(id, rhs.id); | ||
| 60 | } | ||
| 61 | if (rhs.label) | ||
| 62 | { | ||
| 63 | label = new char[strlen(rhs.label)+1]; | ||
| 64 | strcpy(label, rhs.label); | ||
| 65 | } | ||
| 66 | current = rhs.current; | ||
| 67 | type = rhs.type; | ||
| 68 | for (unsigned int i = 0; i < rhs.entry.size(); i++) | ||
| 69 | { | ||
| 70 | char *lab = new char[strlen(rhs.entry[i]) + 1]; | ||
| 71 | strcpy(lab, rhs.entry[i]); | ||
| 72 | entry.push_back(lab); | ||
| 73 | } | ||
| 74 | } | ||
| 75 | |||
| 76 | ~DllSetting() | ||
| 77 | { | ||
| 78 | delete[] id; | ||
| 79 | delete[] label; | ||
| 80 | for (unsigned int i=0; i < entry.size(); i++) | ||
| 81 | delete[] entry[i]; | ||
| 82 | } | ||
| 83 | |||
| 84 | void AddEntry(const char *label) | ||
| 85 | { | ||
| 86 | if (!label || type != SPIN) return; | ||
| 87 | char *lab = new char[strlen(label) + 1]; | ||
| 88 | strcpy(lab, label); | ||
| 89 | entry.push_back(lab); | ||
| 90 | } | ||
| 91 | |||
| 92 | // data members | ||
| 93 | SETTING_TYPE type; | ||
| 94 | char* id; | ||
| 95 | char* label; | ||
| 96 | int current; | ||
| 97 | std::vector<const char *> entry; | ||
| 98 | }; | ||
| 99 | |||
| 100 | class DllUtils | ||
| 101 | { | ||
| 102 | public: | ||
| 103 | |||
| 104 | static unsigned int VecToStruct(std::vector<DllSetting> &vecSet, ADDON_StructSetting*** sSet) | ||
| 105 | { | ||
| 106 | *sSet = NULL; | ||
| 107 | if (vecSet.empty()) | ||
| 108 | return 0; | ||
| 109 | |||
| 110 | unsigned int uiElements=0; | ||
| 111 | |||
| 112 | *sSet = (ADDON_StructSetting**)malloc(vecSet.size()*sizeof(ADDON_StructSetting*)); | ||
| 113 | for(unsigned int i=0;i<vecSet.size();i++) | ||
| 114 | { | ||
| 115 | (*sSet)[i] = NULL; | ||
| 116 | (*sSet)[i] = (ADDON_StructSetting*)malloc(sizeof(ADDON_StructSetting)); | ||
| 117 | (*sSet)[i]->id = NULL; | ||
| 118 | (*sSet)[i]->label = NULL; | ||
| 119 | uiElements++; | ||
| 120 | |||
| 121 | if (vecSet[i].id && vecSet[i].label) | ||
| 122 | { | ||
| 123 | (*sSet)[i]->id = strdup(vecSet[i].id); | ||
| 124 | (*sSet)[i]->label = strdup(vecSet[i].label); | ||
| 125 | (*sSet)[i]->type = vecSet[i].type; | ||
| 126 | (*sSet)[i]->current = vecSet[i].current; | ||
| 127 | (*sSet)[i]->entry_elements = 0; | ||
| 128 | (*sSet)[i]->entry = NULL; | ||
| 129 | if(vecSet[i].type == DllSetting::SPIN && !vecSet[i].entry.empty()) | ||
| 130 | { | ||
| 131 | (*sSet)[i]->entry = (char**)malloc(vecSet[i].entry.size()*sizeof(char**)); | ||
| 132 | for(unsigned int j=0;j<vecSet[i].entry.size();j++) | ||
| 133 | { | ||
| 134 | if(strlen(vecSet[i].entry[j]) > 0) | ||
| 135 | { | ||
| 136 | (*sSet)[i]->entry[j] = strdup(vecSet[i].entry[j]); | ||
| 137 | (*sSet)[i]->entry_elements++; | ||
| 138 | } | ||
| 139 | } | ||
| 140 | } | ||
| 141 | } | ||
| 142 | } | ||
| 143 | return uiElements; | ||
| 144 | } | ||
| 145 | |||
| 146 | static void StructToVec(unsigned int iElements, ADDON_StructSetting*** sSet, std::vector<DllSetting> *vecSet) | ||
| 147 | { | ||
| 148 | if(iElements == 0) | ||
| 149 | return; | ||
| 150 | |||
| 151 | vecSet->clear(); | ||
| 152 | for(unsigned int i=0;i<iElements;i++) | ||
| 153 | { | ||
| 154 | DllSetting vSet((DllSetting::SETTING_TYPE)(*sSet)[i]->type, (*sSet)[i]->id, (*sSet)[i]->label); | ||
| 155 | if((*sSet)[i]->type == DllSetting::SPIN) | ||
| 156 | { | ||
| 157 | for(unsigned int j=0;j<(*sSet)[i]->entry_elements;j++) | ||
| 158 | { | ||
| 159 | vSet.AddEntry((*sSet)[i]->entry[j]); | ||
| 160 | } | ||
| 161 | } | ||
| 162 | vSet.current = (*sSet)[i]->current; | ||
| 163 | vecSet->push_back(vSet); | ||
| 164 | } | ||
| 165 | } | ||
| 166 | |||
| 167 | static void FreeStruct(unsigned int iElements, ADDON_StructSetting*** sSet) | ||
| 168 | { | ||
| 169 | if(iElements == 0) | ||
| 170 | return; | ||
| 171 | |||
| 172 | for(unsigned int i=0;i<iElements;i++) | ||
| 173 | { | ||
| 174 | if((*sSet)[i]->type == DllSetting::SPIN) | ||
| 175 | { | ||
| 176 | for(unsigned int j=0;j<(*sSet)[i]->entry_elements;j++) | ||
| 177 | { | ||
| 178 | free((*sSet)[i]->entry[j]); | ||
| 179 | } | ||
| 180 | free((*sSet)[i]->entry); | ||
| 181 | } | ||
| 182 | free((*sSet)[i]->id); | ||
| 183 | free((*sSet)[i]->label); | ||
| 184 | free((*sSet)[i]); | ||
| 185 | } | ||
| 186 | free(*sSet); | ||
| 187 | } | ||
| 188 | }; | ||
| 189 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h new file mode 100644 index 0000000..ff7194f --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifdef TARGET_WINDOWS | ||
| 24 | #include <windows.h> | ||
| 25 | #else | ||
| 26 | #ifndef __cdecl | ||
| 27 | #define __cdecl | ||
| 28 | #endif | ||
| 29 | #ifndef __declspec | ||
| 30 | #define __declspec(X) | ||
| 31 | #endif | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #include "xbmc_addon_types.h" | ||
| 35 | |||
| 36 | #ifdef __cplusplus | ||
| 37 | extern "C" { | ||
| 38 | #endif | ||
| 39 | |||
| 40 | ADDON_STATUS __declspec(dllexport) ADDON_Create(void *callbacks, void* props); | ||
| 41 | void __declspec(dllexport) ADDON_Stop(); | ||
| 42 | void __declspec(dllexport) ADDON_Destroy(); | ||
| 43 | ADDON_STATUS __declspec(dllexport) ADDON_GetStatus(); | ||
| 44 | bool __declspec(dllexport) ADDON_HasSettings(); | ||
| 45 | unsigned int __declspec(dllexport) ADDON_GetSettings(ADDON_StructSetting ***sSet); | ||
| 46 | ADDON_STATUS __declspec(dllexport) ADDON_SetSetting(const char *settingName, const void *settingValue); | ||
| 47 | void __declspec(dllexport) ADDON_FreeSettings(); | ||
| 48 | void __declspec(dllexport) ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data); | ||
| 49 | |||
| 50 | #ifdef __cplusplus | ||
| 51 | }; | ||
| 52 | #endif | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h new file mode 100644 index 0000000..2ceb5c5 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifdef __cplusplus | ||
| 24 | extern "C" { | ||
| 25 | #endif | ||
| 26 | |||
| 27 | enum ADDON_STATUS | ||
| 28 | { | ||
| 29 | ADDON_STATUS_OK, | ||
| 30 | ADDON_STATUS_LOST_CONNECTION, | ||
| 31 | ADDON_STATUS_NEED_RESTART, | ||
| 32 | ADDON_STATUS_NEED_SETTINGS, | ||
| 33 | ADDON_STATUS_UNKNOWN, | ||
| 34 | ADDON_STATUS_NEED_SAVEDSETTINGS, | ||
| 35 | ADDON_STATUS_PERMANENT_FAILURE /**< permanent failure, like failing to resolve methods */ | ||
| 36 | }; | ||
| 37 | |||
| 38 | typedef struct | ||
| 39 | { | ||
| 40 | int type; | ||
| 41 | char* id; | ||
| 42 | char* label; | ||
| 43 | int current; | ||
| 44 | char** entry; | ||
| 45 | unsigned int entry_elements; | ||
| 46 | } ADDON_StructSetting; | ||
| 47 | |||
| 48 | /*! | ||
| 49 | * @brief Handle used to return data from the PVR add-on to CPVRClient | ||
| 50 | */ | ||
| 51 | struct ADDON_HANDLE_STRUCT | ||
| 52 | { | ||
| 53 | void *callerAddress; /*!< address of the caller */ | ||
| 54 | void *dataAddress; /*!< address to store data in */ | ||
| 55 | int dataIdentifier; /*!< parameter to pass back when calling the callback */ | ||
| 56 | }; | ||
| 57 | typedef ADDON_HANDLE_STRUCT *ADDON_HANDLE; | ||
| 58 | |||
| 59 | #ifdef __cplusplus | ||
| 60 | }; | ||
| 61 | #endif | ||
| 62 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h new file mode 100644 index 0000000..932d34f --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include <stdint.h> | ||
| 24 | #include "xbmc_addon_dll.h" | ||
| 25 | #include "xbmc_audioenc_types.h" | ||
| 26 | |||
| 27 | extern "C" | ||
| 28 | { | ||
| 29 | //! \copydoc AudioEncoder::Create | ||
| 30 | void* Create(audioenc_callbacks *callbacks); | ||
| 31 | |||
| 32 | //! \copydoc AudioEncoder::Start | ||
| 33 | bool Start(void* context, int iInChannels, int iInRate, int iInBits, | ||
| 34 | const char* title, const char* artist, | ||
| 35 | const char* albumartist, const char* album, | ||
| 36 | const char* year, const char* track, | ||
| 37 | const char* genre, const char* comment, int iTrackLength); | ||
| 38 | |||
| 39 | //! \copydoc AudioEncoder::Encode | ||
| 40 | int Encode(void* context, int nNumBytesRead, uint8_t* pbtStream); | ||
| 41 | |||
| 42 | //! \copydoc AudioEncoder::Finish | ||
| 43 | bool Finish(void* context); | ||
| 44 | |||
| 45 | //! \copydoc AudioEncoder::Free | ||
| 46 | void Free(void* context); | ||
| 47 | |||
| 48 | // function to export the above structure to XBMC | ||
| 49 | void __declspec(dllexport) get_addon(struct AudioEncoder* pScr) | ||
| 50 | { | ||
| 51 | pScr->Create = Create; | ||
| 52 | pScr->Start = Start; | ||
| 53 | pScr->Encode = Encode; | ||
| 54 | pScr->Finish = Finish; | ||
| 55 | pScr->Free = Free; | ||
| 56 | }; | ||
| 57 | }; | ||
| 58 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h new file mode 100644 index 0000000..df5164e --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifdef TARGET_WINDOWS | ||
| 24 | #include <windows.h> | ||
| 25 | #else | ||
| 26 | #ifndef __cdecl | ||
| 27 | #define __cdecl | ||
| 28 | #endif | ||
| 29 | #ifndef __declspec | ||
| 30 | #define __declspec(X) | ||
| 31 | #endif | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #include <stdint.h> | ||
| 35 | |||
| 36 | extern "C" | ||
| 37 | { | ||
| 38 | struct AUDIOENC_INFO | ||
| 39 | { | ||
| 40 | int dummy; | ||
| 41 | }; | ||
| 42 | |||
| 43 | struct AUDIOENC_PROPS | ||
| 44 | { | ||
| 45 | int dummy; | ||
| 46 | }; | ||
| 47 | |||
| 48 | typedef int (*audioenc_write_callback)(void* opaque, uint8_t* data, int len); | ||
| 49 | typedef int64_t (*audioenc_seek_callback)(void* opaque, int64_t pos, int whence); | ||
| 50 | |||
| 51 | typedef struct | ||
| 52 | { | ||
| 53 | void* opaque; | ||
| 54 | audioenc_write_callback write; | ||
| 55 | audioenc_seek_callback seek; | ||
| 56 | } audioenc_callbacks; | ||
| 57 | |||
| 58 | struct AudioEncoder | ||
| 59 | { | ||
| 60 | /*! \brief Create encoder context | ||
| 61 | \param callbacks Pointer to audioenc_callbacks structure. | ||
| 62 | \return opaque pointer to encoder context, to be passed to other methods. | ||
| 63 | \sa IEncoder::Init | ||
| 64 | */ | ||
| 65 | void (*(__cdecl *Create) (audioenc_callbacks* callbacks)); | ||
| 66 | |||
| 67 | /*! \brief Start encoder | ||
| 68 | \param context Encoder context from Create. | ||
| 69 | \param iInChannels Number of channels | ||
| 70 | \param iInRate Sample rate of input data | ||
| 71 | \param iInBits Bits per sample in input data | ||
| 72 | \param title The title of the song | ||
| 73 | \param artist The artist of the song | ||
| 74 | \param albumartist The albumartist of the song | ||
| 75 | \param year The year of the song | ||
| 76 | \param track The track number of the song | ||
| 77 | \param genre The genre of the song | ||
| 78 | \param comment A comment to attach to the song | ||
| 79 | \param iTrackLength Total track length in seconds | ||
| 80 | \sa IEncoder::Init | ||
| 81 | */ | ||
| 82 | bool (__cdecl* Start) (void* context, int iInChannels, int iInRate, int iInBits, | ||
| 83 | const char* title, const char* artist, | ||
| 84 | const char* albumartist, const char* album, | ||
| 85 | const char* year, const char* track, | ||
| 86 | const char* genre, const char* comment, | ||
| 87 | int iTrackLength); | ||
| 88 | |||
| 89 | /*! \brief Encode a chunk of audio | ||
| 90 | \param context Encoder context from Create. | ||
| 91 | \param nNumBytesRead Number of bytes in input buffer | ||
| 92 | \param pbtStream the input buffer | ||
| 93 | \return Number of bytes consumed | ||
| 94 | \sa IEncoder::Encode | ||
| 95 | */ | ||
| 96 | int (__cdecl* Encode) (void* context, int nNumBytesRead, uint8_t* pbtStream); | ||
| 97 | |||
| 98 | /*! \brief Finalize encoding | ||
| 99 | \param context Encoder context from Create. | ||
| 100 | \return True on success, false on failure. | ||
| 101 | */ | ||
| 102 | bool (__cdecl* Finish) (void* context); | ||
| 103 | |||
| 104 | /*! \brief Free encoder context | ||
| 105 | \param context Encoder context to free. | ||
| 106 | */ | ||
| 107 | void (__cdecl* Free)(void* context); | ||
| 108 | }; | ||
| 109 | } | ||
| 110 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h new file mode 100644 index 0000000..01e7548 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifdef __cplusplus | ||
| 24 | extern "C" { | ||
| 25 | #endif | ||
| 26 | |||
| 27 | typedef unsigned int xbmc_codec_id_t; | ||
| 28 | |||
| 29 | typedef enum | ||
| 30 | { | ||
| 31 | XBMC_CODEC_TYPE_UNKNOWN = -1, | ||
| 32 | XBMC_CODEC_TYPE_VIDEO, | ||
| 33 | XBMC_CODEC_TYPE_AUDIO, | ||
| 34 | XBMC_CODEC_TYPE_DATA, | ||
| 35 | XBMC_CODEC_TYPE_SUBTITLE, | ||
| 36 | XBMC_CODEC_TYPE_RDS, | ||
| 37 | XBMC_CODEC_TYPE_NB | ||
| 38 | } xbmc_codec_type_t; | ||
| 39 | |||
| 40 | typedef struct | ||
| 41 | { | ||
| 42 | xbmc_codec_type_t codec_type; | ||
| 43 | xbmc_codec_id_t codec_id; | ||
| 44 | } xbmc_codec_t; | ||
| 45 | |||
| 46 | #define XBMC_INVALID_CODEC_ID 0 | ||
| 47 | #define XBMC_INVALID_CODEC { XBMC_CODEC_TYPE_UNKNOWN, XBMC_INVALID_CODEC_ID } | ||
| 48 | |||
| 49 | #ifdef __cplusplus | ||
| 50 | }; | ||
| 51 | #endif | ||
| 52 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h new file mode 100644 index 0000000..9460952 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h | |||
| @@ -0,0 +1,123 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 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 XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string.h> | ||
| 23 | #include <time.h> | ||
| 24 | |||
| 25 | #undef ATTRIBUTE_PACKED | ||
| 26 | #undef PRAGMA_PACK_BEGIN | ||
| 27 | #undef PRAGMA_PACK_END | ||
| 28 | |||
| 29 | #if defined(__GNUC__) | ||
| 30 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | ||
| 31 | #define ATTRIBUTE_PACKED __attribute__ ((packed)) | ||
| 32 | #define PRAGMA_PACK 0 | ||
| 33 | #endif | ||
| 34 | #endif | ||
| 35 | |||
| 36 | #if !defined(ATTRIBUTE_PACKED) | ||
| 37 | #define ATTRIBUTE_PACKED | ||
| 38 | #define PRAGMA_PACK 1 | ||
| 39 | #endif | ||
| 40 | |||
| 41 | /*! @name EPG entry content event types */ | ||
| 42 | //@{ | ||
| 43 | /* These IDs come from the DVB-SI EIT table "content descriptor" | ||
| 44 | * Also known under the name "E-book genre assignments" | ||
| 45 | */ | ||
| 46 | #define EPG_EVENT_CONTENTMASK_UNDEFINED 0x00 | ||
| 47 | #define EPG_EVENT_CONTENTMASK_MOVIEDRAMA 0x10 | ||
| 48 | #define EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS 0x20 | ||
| 49 | #define EPG_EVENT_CONTENTMASK_SHOW 0x30 | ||
| 50 | #define EPG_EVENT_CONTENTMASK_SPORTS 0x40 | ||
| 51 | #define EPG_EVENT_CONTENTMASK_CHILDRENYOUTH 0x50 | ||
| 52 | #define EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE 0x60 | ||
| 53 | #define EPG_EVENT_CONTENTMASK_ARTSCULTURE 0x70 | ||
| 54 | #define EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS 0x80 | ||
| 55 | #define EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE 0x90 | ||
| 56 | #define EPG_EVENT_CONTENTMASK_LEISUREHOBBIES 0xA0 | ||
| 57 | #define EPG_EVENT_CONTENTMASK_SPECIAL 0xB0 | ||
| 58 | #define EPG_EVENT_CONTENTMASK_USERDEFINED 0xF0 | ||
| 59 | //@} | ||
| 60 | |||
| 61 | /* Set EPGTAG.iGenreType to EPG_GENRE_USE_STRING to transfer genre strings to XBMC */ | ||
| 62 | #define EPG_GENRE_USE_STRING 0x100 | ||
| 63 | |||
| 64 | #ifdef __cplusplus | ||
| 65 | extern "C" { | ||
| 66 | #endif | ||
| 67 | |||
| 68 | /* EPG_TAG.iFlags values */ | ||
| 69 | const unsigned int EPG_TAG_FLAG_UNDEFINED = 0x00000000; /*!< @brief nothing special to say about this entry */ | ||
| 70 | const unsigned int EPG_TAG_FLAG_IS_SERIES = 0x00000001; /*!< @brief this EPG entry is part of a series */ | ||
| 71 | |||
| 72 | /* Special EPG_TAG.iUniqueBroadcastId value */ | ||
| 73 | |||
| 74 | /*! | ||
| 75 | * @brief special EPG_TAG.iUniqueBroadcastId value to indicate that a tag has not a valid EPG event uid. | ||
| 76 | */ | ||
| 77 | const unsigned int EPG_TAG_INVALID_UID = 0; | ||
| 78 | |||
| 79 | /*! | ||
| 80 | * @brief EPG event states. Used with EpgEventStateChange callback. | ||
| 81 | */ | ||
| 82 | typedef enum | ||
| 83 | { | ||
| 84 | EPG_EVENT_CREATED = 0, /*!< @brief event created */ | ||
| 85 | EPG_EVENT_UPDATED = 1, /*!< @brief event updated */ | ||
| 86 | EPG_EVENT_DELETED = 2, /*!< @brief event deleted */ | ||
| 87 | } EPG_EVENT_STATE; | ||
| 88 | |||
| 89 | /*! | ||
| 90 | * @brief Representation of an EPG event. | ||
| 91 | */ | ||
| 92 | typedef struct EPG_TAG { | ||
| 93 | unsigned int iUniqueBroadcastId; /*!< @brief (required) identifier for this event. Valid uids must be greater than EPG_TAG_INVALID_UID. */ | ||
| 94 | const char * strTitle; /*!< @brief (required) this event's title */ | ||
| 95 | unsigned int iChannelNumber; /*!< @brief (required) the number of the channel this event occurs on */ | ||
| 96 | time_t startTime; /*!< @brief (required) start time in UTC */ | ||
| 97 | time_t endTime; /*!< @brief (required) end time in UTC */ | ||
| 98 | const char * strPlotOutline; /*!< @brief (optional) plot outline */ | ||
| 99 | const char * strPlot; /*!< @brief (optional) plot */ | ||
| 100 | const char * strOriginalTitle; /*!< @brief (optional) originaltitle */ | ||
| 101 | const char * strCast; /*!< @brief (optional) cast */ | ||
| 102 | const char * strDirector; /*!< @brief (optional) director */ | ||
| 103 | const char * strWriter; /*!< @brief (optional) writer */ | ||
| 104 | int iYear; /*!< @brief (optional) year */ | ||
| 105 | const char * strIMDBNumber; /*!< @brief (optional) IMDBNumber */ | ||
| 106 | const char * strIconPath; /*!< @brief (optional) icon path */ | ||
| 107 | int iGenreType; /*!< @brief (optional) genre type */ | ||
| 108 | int iGenreSubType; /*!< @brief (optional) genre sub type */ | ||
| 109 | const char * strGenreDescription; /*!< @brief (optional) genre. Will be used only when iGenreType = EPG_GENRE_USE_STRING */ | ||
| 110 | time_t firstAired; /*!< @brief (optional) first aired in UTC */ | ||
| 111 | int iParentalRating; /*!< @brief (optional) parental rating */ | ||
| 112 | int iStarRating; /*!< @brief (optional) star rating */ | ||
| 113 | bool bNotify; /*!< @brief (optional) notify the user when this event starts */ | ||
| 114 | int iSeriesNumber; /*!< @brief (optional) series number */ | ||
| 115 | int iEpisodeNumber; /*!< @brief (optional) episode number */ | ||
| 116 | int iEpisodePartNumber; /*!< @brief (optional) episode part number */ | ||
| 117 | const char * strEpisodeName; /*!< @brief (optional) episode name */ | ||
| 118 | unsigned int iFlags; /*!< @brief (optional) bit field of independent flags associated with the EPG entry */ | ||
| 119 | } ATTRIBUTE_PACKED EPG_TAG; | ||
| 120 | |||
| 121 | #ifdef __cplusplus | ||
| 122 | } | ||
| 123 | #endif | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h new file mode 100644 index 0000000..8b54ea6 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h | |||
| @@ -0,0 +1,741 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include "xbmc_addon_dll.h" | ||
| 24 | #include "xbmc_pvr_types.h" | ||
| 25 | |||
| 26 | /*! | ||
| 27 | * Functions that the PVR client add-on must implement, but some can be empty. | ||
| 28 | * | ||
| 29 | * The 'remarks' field indicates which methods should be implemented, and which ones are optional. | ||
| 30 | */ | ||
| 31 | |||
| 32 | extern "C" | ||
| 33 | { | ||
| 34 | /*! @name PVR add-on methods */ | ||
| 35 | //@{ | ||
| 36 | /*! | ||
| 37 | * Get the XBMC_PVR_API_VERSION that was used to compile this add-on. | ||
| 38 | * Used to check if this add-on is compatible with XBMC. | ||
| 39 | * @return The XBMC_PVR_API_VERSION that was used to compile this add-on. | ||
| 40 | * @remarks Valid implementation required. | ||
| 41 | */ | ||
| 42 | const char* GetPVRAPIVersion(void); | ||
| 43 | |||
| 44 | /*! | ||
| 45 | * Get the XBMC_PVR_MIN_API_VERSION that was used to compile this add-on. | ||
| 46 | * Used to check if this add-on is compatible with XBMC. | ||
| 47 | * @return The XBMC_PVR_MIN_API_VERSION that was used to compile this add-on. | ||
| 48 | * @remarks Valid implementation required. | ||
| 49 | */ | ||
| 50 | const char* GetMininumPVRAPIVersion(void); | ||
| 51 | |||
| 52 | /*! | ||
| 53 | * Get the XBMC_GUI_API_VERSION that was used to compile this add-on. | ||
| 54 | * Used to check if this add-on is compatible with XBMC. | ||
| 55 | * @return The XBMC_GUI_API_VERSION that was used to compile this add-on or empty string if this add-on does not depend on Kodi GUI API. | ||
| 56 | * @remarks Valid implementation required. | ||
| 57 | * @note see libKODI_guilib.h about related parts | ||
| 58 | */ | ||
| 59 | const char* GetGUIAPIVersion(void); | ||
| 60 | |||
| 61 | /*! | ||
| 62 | * Get the XBMC_GUI_MIN_API_VERSION that was used to compile this add-on. | ||
| 63 | * Used to check if this add-on is compatible with XBMC. | ||
| 64 | * @return The XBMC_GUI_MIN_API_VERSION that was used to compile this add-on or empty string if this add-on does not depend on Kodi GUI API. | ||
| 65 | * @remarks Valid implementation required. | ||
| 66 | * @note see libKODI_guilib.h about related parts | ||
| 67 | */ | ||
| 68 | const char* GetMininumGUIAPIVersion(void); | ||
| 69 | |||
| 70 | /*! | ||
| 71 | * Get the list of features that this add-on provides. | ||
| 72 | * Called by XBMC to query the add-on's capabilities. | ||
| 73 | * Used to check which options should be presented in the UI, which methods to call, etc. | ||
| 74 | * All capabilities that the add-on supports should be set to true. | ||
| 75 | * @param pCapabilities The add-on's capabilities. | ||
| 76 | * @return PVR_ERROR_NO_ERROR if the properties were fetched successfully. | ||
| 77 | * @remarks Valid implementation required. | ||
| 78 | */ | ||
| 79 | PVR_ERROR GetAddonCapabilities(PVR_ADDON_CAPABILITIES *pCapabilities); | ||
| 80 | |||
| 81 | /*! | ||
| 82 | * @return The name reported by the backend that will be displayed in the UI. | ||
| 83 | * @remarks Valid implementation required. | ||
| 84 | */ | ||
| 85 | const char* GetBackendName(void); | ||
| 86 | |||
| 87 | /*! | ||
| 88 | * @return The version string reported by the backend that will be displayed in the UI. | ||
| 89 | * @remarks Valid implementation required. | ||
| 90 | */ | ||
| 91 | const char* GetBackendVersion(void); | ||
| 92 | |||
| 93 | /*! | ||
| 94 | * @return The connection string reported by the backend that will be displayed in the UI. | ||
| 95 | * @remarks Valid implementation required. | ||
| 96 | */ | ||
| 97 | const char* GetConnectionString(void); | ||
| 98 | |||
| 99 | /*! | ||
| 100 | * Get the disk space reported by the backend (if supported). | ||
| 101 | * @param iTotal The total disk space in bytes. | ||
| 102 | * @param iUsed The used disk space in bytes. | ||
| 103 | * @return PVR_ERROR_NO_ERROR if the drive space has been fetched successfully. | ||
| 104 | * @remarks Optional. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 105 | */ | ||
| 106 | PVR_ERROR GetDriveSpace(long long* iTotal, long long* iUsed); | ||
| 107 | |||
| 108 | /*! | ||
| 109 | * Call one of the menu hooks (if supported). | ||
| 110 | * Supported PVR_MENUHOOK instances have to be added in ADDON_Create(), by calling AddMenuHook() on the callback. | ||
| 111 | * @param menuhook The hook to call. | ||
| 112 | * @param item The selected item for which the hook was called. | ||
| 113 | * @return PVR_ERROR_NO_ERROR if the hook was called successfully. | ||
| 114 | * @remarks Optional. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 115 | */ | ||
| 116 | PVR_ERROR CallMenuHook(const PVR_MENUHOOK& menuhook, const PVR_MENUHOOK_DATA &item); | ||
| 117 | //@} | ||
| 118 | |||
| 119 | /*! @name PVR EPG methods | ||
| 120 | * @remarks Only used by XBMC if bSupportsEPG is set to true. | ||
| 121 | */ | ||
| 122 | //@{ | ||
| 123 | /*! | ||
| 124 | * Request the EPG for a channel from the backend. | ||
| 125 | * EPG entries are added to XBMC by calling TransferEpgEntry() on the callback. | ||
| 126 | * @param handle Handle to pass to the callback method. | ||
| 127 | * @param channel The channel to get the EPG table for. | ||
| 128 | * @param iStart Get events after this time (UTC). | ||
| 129 | * @param iEnd Get events before this time (UTC). | ||
| 130 | * @return PVR_ERROR_NO_ERROR if the table has been fetched successfully. | ||
| 131 | * @remarks Required if bSupportsEPG is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 132 | */ | ||
| 133 | PVR_ERROR GetEPGForChannel(ADDON_HANDLE handle, const PVR_CHANNEL& channel, time_t iStart, time_t iEnd); | ||
| 134 | //@} | ||
| 135 | |||
| 136 | /*! @name PVR channel group methods | ||
| 137 | * @remarks Only used by XBMC is bSupportsChannelGroups is set to true. | ||
| 138 | * If a group or one of the group members changes after the initial import, or if a new one was added, then the add-on | ||
| 139 | * should call TriggerChannelGroupsUpdate() | ||
| 140 | */ | ||
| 141 | //@{ | ||
| 142 | /*! | ||
| 143 | * Get the total amount of channel groups on the backend if it supports channel groups. | ||
| 144 | * @return The amount of channels, or -1 on error. | ||
| 145 | * @remarks Required if bSupportsChannelGroups is set to true. Return -1 if this add-on won't provide this function. | ||
| 146 | */ | ||
| 147 | int GetChannelGroupsAmount(void); | ||
| 148 | |||
| 149 | /*! | ||
| 150 | * Request the list of all channel groups from the backend if it supports channel groups. | ||
| 151 | * Channel group entries are added to XBMC by calling TransferChannelGroup() on the callback. | ||
| 152 | * @param handle Handle to pass to the callback method. | ||
| 153 | * @param bRadio True to get the radio channel groups, false to get the TV channel groups. | ||
| 154 | * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. | ||
| 155 | * @remarks Required if bSupportsChannelGroups is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 156 | */ | ||
| 157 | PVR_ERROR GetChannelGroups(ADDON_HANDLE handle, bool bRadio); | ||
| 158 | |||
| 159 | /*! | ||
| 160 | * Request the list of all group members of a group from the backend if it supports channel groups. | ||
| 161 | * Member entries are added to XBMC by calling TransferChannelGroupMember() on the callback. | ||
| 162 | * @param handle Handle to pass to the callback method. | ||
| 163 | * @param group The group to get the members for. | ||
| 164 | * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. | ||
| 165 | * @remarks Required if bSupportsChannelGroups is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 166 | */ | ||
| 167 | PVR_ERROR GetChannelGroupMembers(ADDON_HANDLE handle, const PVR_CHANNEL_GROUP& group); | ||
| 168 | //@} | ||
| 169 | |||
| 170 | /** @name PVR channel methods | ||
| 171 | * @remarks Either bSupportsTV or bSupportsRadio is required to be set to true. | ||
| 172 | * If a channel changes after the initial import, or if a new one was added, then the add-on | ||
| 173 | * should call TriggerChannelUpdate() | ||
| 174 | */ | ||
| 175 | //@{ | ||
| 176 | /*! | ||
| 177 | * Show the channel scan dialog if this backend supports it. | ||
| 178 | * @return PVR_ERROR_NO_ERROR if the dialog was displayed successfully. | ||
| 179 | * @remarks Required if bSupportsChannelScan is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 180 | * @note see libKODI_guilib.h about related parts | ||
| 181 | */ | ||
| 182 | PVR_ERROR OpenDialogChannelScan(void); | ||
| 183 | |||
| 184 | /*! | ||
| 185 | * @return The total amount of channels on the backend, or -1 on error. | ||
| 186 | * @remarks Valid implementation required. | ||
| 187 | */ | ||
| 188 | int GetChannelsAmount(void); | ||
| 189 | |||
| 190 | /*! | ||
| 191 | * Request the list of all channels from the backend. | ||
| 192 | * Channel entries are added to XBMC by calling TransferChannelEntry() on the callback. | ||
| 193 | * @param handle Handle to pass to the callback method. | ||
| 194 | * @param bRadio True to get the radio channels, false to get the TV channels. | ||
| 195 | * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. | ||
| 196 | * @remarks If bSupportsTV is set to true, a valid result set needs to be provided for bRadio = false. | ||
| 197 | * If bSupportsRadio is set to true, a valid result set needs to be provided for bRadio = true. | ||
| 198 | * At least one of these two must provide a valid result set. | ||
| 199 | */ | ||
| 200 | PVR_ERROR GetChannels(ADDON_HANDLE handle, bool bRadio); | ||
| 201 | |||
| 202 | /*! | ||
| 203 | * Delete a channel from the backend. | ||
| 204 | * @param channel The channel to delete. | ||
| 205 | * @return PVR_ERROR_NO_ERROR if the channel has been deleted successfully. | ||
| 206 | * @remarks Required if bSupportsChannelSettings is set to true. | ||
| 207 | */ | ||
| 208 | PVR_ERROR DeleteChannel(const PVR_CHANNEL& channel); | ||
| 209 | |||
| 210 | /*! | ||
| 211 | * Rename a channel on the backend. | ||
| 212 | * @param channel The channel to rename, containing the new channel name. | ||
| 213 | * @return PVR_ERROR_NO_ERROR if the channel has been renamed successfully. | ||
| 214 | * @remarks Optional, and only used if bSupportsChannelSettings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 215 | */ | ||
| 216 | PVR_ERROR RenameChannel(const PVR_CHANNEL& channel); | ||
| 217 | |||
| 218 | /*! | ||
| 219 | * Move a channel to another channel number on the backend. | ||
| 220 | * @param channel The channel to move, containing the new channel number. | ||
| 221 | * @return PVR_ERROR_NO_ERROR if the channel has been moved successfully. | ||
| 222 | * @remarks Optional, and only used if bSupportsChannelSettings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 223 | */ | ||
| 224 | PVR_ERROR MoveChannel(const PVR_CHANNEL& channel); | ||
| 225 | |||
| 226 | /*! | ||
| 227 | * Show the channel settings dialog, if supported by the backend. | ||
| 228 | * @param channel The channel to show the dialog for. | ||
| 229 | * @return PVR_ERROR_NO_ERROR if the dialog has been displayed successfully. | ||
| 230 | * @remarks Required if bSupportsChannelSettings is set to true. | ||
| 231 | * @note see libKODI_guilib.h about related parts | ||
| 232 | */ | ||
| 233 | PVR_ERROR OpenDialogChannelSettings(const PVR_CHANNEL& channel); | ||
| 234 | |||
| 235 | /*! | ||
| 236 | * Show the dialog to add a channel on the backend, if supported by the backend. | ||
| 237 | * @param channel The channel to add. | ||
| 238 | * @return PVR_ERROR_NO_ERROR if the channel has been added successfully. | ||
| 239 | * @remarks Required if bSupportsChannelSettings is set to true. | ||
| 240 | * @note see libKODI_guilib.h about related parts | ||
| 241 | */ | ||
| 242 | PVR_ERROR OpenDialogChannelAdd(const PVR_CHANNEL& channel); | ||
| 243 | //@} | ||
| 244 | |||
| 245 | /** @name PVR recording methods | ||
| 246 | * @remarks Only used by XBMC is bSupportsRecordings is set to true. | ||
| 247 | * If a recording changes after the initial import, or if a new one was added, | ||
| 248 | * then the add-on should call TriggerRecordingUpdate() | ||
| 249 | */ | ||
| 250 | //@{ | ||
| 251 | /*! | ||
| 252 | * @return The total amount of recordings on the backend or -1 on error. | ||
| 253 | * @param deleted if set return deleted recording (called if bSupportsRecordingsUndelete set to true) | ||
| 254 | * @remarks Required if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 255 | */ | ||
| 256 | int GetRecordingsAmount(bool deleted); | ||
| 257 | |||
| 258 | /*! | ||
| 259 | * Request the list of all recordings from the backend, if supported. | ||
| 260 | * Recording entries are added to XBMC by calling TransferRecordingEntry() on the callback. | ||
| 261 | * @param handle Handle to pass to the callback method. | ||
| 262 | * @param deleted if set return deleted recording (called if bSupportsRecordingsUndelete set to true) | ||
| 263 | * @return PVR_ERROR_NO_ERROR if the recordings have been fetched successfully. | ||
| 264 | * @remarks Required if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 265 | */ | ||
| 266 | PVR_ERROR GetRecordings(ADDON_HANDLE handle, bool deleted); | ||
| 267 | |||
| 268 | /*! | ||
| 269 | * Delete a recording on the backend. | ||
| 270 | * @param recording The recording to delete. | ||
| 271 | * @return PVR_ERROR_NO_ERROR if the recording has been deleted successfully. | ||
| 272 | * @remarks Optional, and only used if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 273 | */ | ||
| 274 | PVR_ERROR DeleteRecording(const PVR_RECORDING& recording); | ||
| 275 | |||
| 276 | /*! | ||
| 277 | * Undelete a recording on the backend. | ||
| 278 | * @param recording The recording to undelete. | ||
| 279 | * @return PVR_ERROR_NO_ERROR if the recording has been undeleted successfully. | ||
| 280 | * @remarks Optional, and only used if bSupportsRecordingsUndelete is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 281 | */ | ||
| 282 | PVR_ERROR UndeleteRecording(const PVR_RECORDING& recording); | ||
| 283 | |||
| 284 | /*! | ||
| 285 | * @brief Delete all recordings permanent which in the deleted folder on the backend. | ||
| 286 | * @return PVR_ERROR_NO_ERROR if the recordings has been deleted successfully. | ||
| 287 | */ | ||
| 288 | PVR_ERROR DeleteAllRecordingsFromTrash(); | ||
| 289 | |||
| 290 | /*! | ||
| 291 | * Rename a recording on the backend. | ||
| 292 | * @param recording The recording to rename, containing the new name. | ||
| 293 | * @return PVR_ERROR_NO_ERROR if the recording has been renamed successfully. | ||
| 294 | * @remarks Optional, and only used if bSupportsRecordings is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 295 | */ | ||
| 296 | PVR_ERROR RenameRecording(const PVR_RECORDING& recording); | ||
| 297 | |||
| 298 | /*! | ||
| 299 | * Set the play count of a recording on the backend. | ||
| 300 | * @param recording The recording to change the play count. | ||
| 301 | * @param count Play count. | ||
| 302 | * @return PVR_ERROR_NO_ERROR if the recording's play count has been set successfully. | ||
| 303 | * @remarks Required if bSupportsRecordingPlayCount is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 304 | */ | ||
| 305 | PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING& recording, int count); | ||
| 306 | |||
| 307 | /*! | ||
| 308 | * Set the last watched position of a recording on the backend. | ||
| 309 | * @param recording The recording. | ||
| 310 | * @param position The last watched position in seconds | ||
| 311 | * @return PVR_ERROR_NO_ERROR if the position has been stored successfully. | ||
| 312 | * @remarks Required if bSupportsLastPlayedPosition is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 313 | */ | ||
| 314 | PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING& recording, int lastplayedposition); | ||
| 315 | |||
| 316 | /*! | ||
| 317 | * Retrieve the last watched position of a recording on the backend. | ||
| 318 | * @param recording The recording. | ||
| 319 | * @return The last watched position in seconds or -1 on error | ||
| 320 | * @remarks Required if bSupportsRecordingPlayCount is set to true. Return -1 if this add-on won't provide this function. | ||
| 321 | */ | ||
| 322 | int GetRecordingLastPlayedPosition(const PVR_RECORDING& recording); | ||
| 323 | |||
| 324 | /*! | ||
| 325 | * Retrieve the edit decision list (EDL) of a recording on the backend. | ||
| 326 | * @param recording The recording. | ||
| 327 | * @param edl out: The function has to write the EDL list into this array. | ||
| 328 | * @param size in: The maximum size of the EDL, out: the actual size of the EDL. | ||
| 329 | * @return PVR_ERROR_NO_ERROR if the EDL was successfully read. | ||
| 330 | * @remarks Required if bSupportsRecordingEdl is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 331 | */ | ||
| 332 | PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY edl[], int *size); | ||
| 333 | |||
| 334 | /*! | ||
| 335 | * Retrieve the timer types supported by the backend. | ||
| 336 | * @param types out: The function has to write the definition of the supported timer types into this array. | ||
| 337 | * @param typesCount in: The maximum size of the list, out: the actual size of the list. default: PVR_ADDON_TIMERTYPE_ARRAY_SIZE | ||
| 338 | * @return PVR_ERROR_NO_ERROR if the types were successfully written to the array. | ||
| 339 | * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 340 | */ | ||
| 341 | PVR_ERROR GetTimerTypes(PVR_TIMER_TYPE types[], int *typesCount); | ||
| 342 | |||
| 343 | //@} | ||
| 344 | /** @name PVR timer methods | ||
| 345 | * @remarks Only used by XBMC is bSupportsTimers is set to true. | ||
| 346 | * If a timer changes after the initial import, or if a new one was added, | ||
| 347 | * then the add-on should call TriggerTimerUpdate() | ||
| 348 | */ | ||
| 349 | //@{ | ||
| 350 | /*! | ||
| 351 | * @return The total amount of timers on the backend or -1 on error. | ||
| 352 | * @remarks Required if bSupportsTimers is set to true. Return -1 if this add-on won't provide this function. | ||
| 353 | */ | ||
| 354 | int GetTimersAmount(void); | ||
| 355 | |||
| 356 | /*! | ||
| 357 | * Request the list of all timers from the backend if supported. | ||
| 358 | * Timer entries are added to XBMC by calling TransferTimerEntry() on the callback. | ||
| 359 | * @param handle Handle to pass to the callback method. | ||
| 360 | * @return PVR_ERROR_NO_ERROR if the list has been fetched successfully. | ||
| 361 | * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 362 | */ | ||
| 363 | PVR_ERROR GetTimers(ADDON_HANDLE handle); | ||
| 364 | |||
| 365 | /*! | ||
| 366 | * Add a timer on the backend. | ||
| 367 | * @param timer The timer to add. | ||
| 368 | * @return PVR_ERROR_NO_ERROR if the timer has been added successfully. | ||
| 369 | * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 370 | */ | ||
| 371 | PVR_ERROR AddTimer(const PVR_TIMER& timer); | ||
| 372 | |||
| 373 | /*! | ||
| 374 | * Delete a timer on the backend. | ||
| 375 | * @param timer The timer to delete. | ||
| 376 | * @param bForceDelete Set to true to delete a timer that is currently recording a program. | ||
| 377 | * @return PVR_ERROR_NO_ERROR if the timer has been deleted successfully. | ||
| 378 | * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 379 | */ | ||
| 380 | PVR_ERROR DeleteTimer(const PVR_TIMER& timer, bool bForceDelete); | ||
| 381 | |||
| 382 | /*! | ||
| 383 | * Update the timer information on the backend. | ||
| 384 | * @param timer The timer to update. | ||
| 385 | * @return PVR_ERROR_NO_ERROR if the timer has been updated successfully. | ||
| 386 | * @remarks Required if bSupportsTimers is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 387 | */ | ||
| 388 | PVR_ERROR UpdateTimer(const PVR_TIMER& timer); | ||
| 389 | |||
| 390 | //@} | ||
| 391 | |||
| 392 | /** @name PVR live stream methods, used to open and close a stream to a channel, and optionally perform read operations on the stream */ | ||
| 393 | //@{ | ||
| 394 | /*! | ||
| 395 | * Open a live stream on the backend. | ||
| 396 | * @param channel The channel to stream. | ||
| 397 | * @return True if the stream has been opened successfully, false otherwise. | ||
| 398 | * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return false if this add-on won't provide this function. | ||
| 399 | */ | ||
| 400 | bool OpenLiveStream(const PVR_CHANNEL& channel); | ||
| 401 | |||
| 402 | /*! | ||
| 403 | * Close an open live stream. | ||
| 404 | * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. | ||
| 405 | */ | ||
| 406 | void CloseLiveStream(void); | ||
| 407 | |||
| 408 | /*! | ||
| 409 | * Read from an open live stream. | ||
| 410 | * @param pBuffer The buffer to store the data in. | ||
| 411 | * @param iBufferSize The amount of bytes to read. | ||
| 412 | * @return The amount of bytes that were actually read from the stream. | ||
| 413 | * @remarks Required if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. | ||
| 414 | */ | ||
| 415 | int ReadLiveStream(unsigned char* pBuffer, unsigned int iBufferSize); | ||
| 416 | |||
| 417 | /*! | ||
| 418 | * Seek in a live stream on a backend that supports timeshifting. | ||
| 419 | * @param iPosition The position to seek to. | ||
| 420 | * @param iWhence ? | ||
| 421 | * @return The new position. | ||
| 422 | * @remarks Optional, and only used if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. | ||
| 423 | */ | ||
| 424 | long long SeekLiveStream(long long iPosition, int iWhence = SEEK_SET); | ||
| 425 | |||
| 426 | /*! | ||
| 427 | * @return The position in the stream that's currently being read. | ||
| 428 | * @remarks Optional, and only used if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. | ||
| 429 | */ | ||
| 430 | long long PositionLiveStream(void); | ||
| 431 | |||
| 432 | /*! | ||
| 433 | * @return The total length of the stream that's currently being read. | ||
| 434 | * @remarks Optional, and only used if bHandlesInputStream is set to true. Return -1 if this add-on won't provide this function. | ||
| 435 | */ | ||
| 436 | long long LengthLiveStream(void); | ||
| 437 | |||
| 438 | /*! | ||
| 439 | * Switch to another channel. Only to be called when a live stream has already been opened. | ||
| 440 | * @param channel The channel to switch to. | ||
| 441 | * @return True if the switch was successful, false otherwise. | ||
| 442 | * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return false if this add-on won't provide this function. | ||
| 443 | */ | ||
| 444 | bool SwitchChannel(const PVR_CHANNEL& channel); | ||
| 445 | |||
| 446 | /*! | ||
| 447 | * Get the signal status of the stream that's currently open. | ||
| 448 | * @param signalStatus The signal status. | ||
| 449 | * @return True if the signal status has been read successfully, false otherwise. | ||
| 450 | * @remarks Optional, and only used if bHandlesInputStream or bHandlesDemuxing is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 451 | */ | ||
| 452 | PVR_ERROR SignalStatus(PVR_SIGNAL_STATUS& signalStatus); | ||
| 453 | |||
| 454 | /*! | ||
| 455 | * Get the stream URL for a channel from the backend. Used by the MediaPortal add-on. | ||
| 456 | * @param channel The channel to get the stream URL for. | ||
| 457 | * @return The requested URL. | ||
| 458 | * @remarks Optional, and only used if bHandlesInputStream is set to true. Return NULL if this add-on won't provide this function. | ||
| 459 | */ | ||
| 460 | const char* GetLiveStreamURL(const PVR_CHANNEL& channel); | ||
| 461 | |||
| 462 | /*! | ||
| 463 | * Get the stream properties of the stream that's currently being read. | ||
| 464 | * @param pProperties The properties of the currently playing stream. | ||
| 465 | * @return PVR_ERROR_NO_ERROR if the properties have been fetched successfully. | ||
| 466 | * @remarks Required if bHandlesInputStream or bHandlesDemuxing is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 467 | */ | ||
| 468 | PVR_ERROR GetStreamProperties(PVR_STREAM_PROPERTIES* pProperties); | ||
| 469 | //@} | ||
| 470 | |||
| 471 | /** @name PVR recording stream methods, used to open and close a stream to a recording, and perform read operations on the stream. | ||
| 472 | * @remarks This will only be used if the backend doesn't provide a direct URL in the recording tag. | ||
| 473 | */ | ||
| 474 | //@{ | ||
| 475 | /*! | ||
| 476 | * Open a stream to a recording on the backend. | ||
| 477 | * @param recording The recording to open. | ||
| 478 | * @return True if the stream has been opened successfully, false otherwise. | ||
| 479 | * @remarks Optional, and only used if bSupportsRecordings is set to true. Return false if this add-on won't provide this function. | ||
| 480 | */ | ||
| 481 | bool OpenRecordedStream(const PVR_RECORDING& recording); | ||
| 482 | |||
| 483 | /*! | ||
| 484 | * Close an open stream from a recording. | ||
| 485 | * @remarks Optional, and only used if bSupportsRecordings is set to true. | ||
| 486 | */ | ||
| 487 | void CloseRecordedStream(void); | ||
| 488 | |||
| 489 | /*! | ||
| 490 | * Read from a recording. | ||
| 491 | * @param pBuffer The buffer to store the data in. | ||
| 492 | * @param iBufferSize The amount of bytes to read. | ||
| 493 | * @return The amount of bytes that were actually read from the stream. | ||
| 494 | * @remarks Optional, and only used if bSupportsRecordings is set to true, but required if OpenRecordedStream() is implemented. Return -1 if this add-on won't provide this function. | ||
| 495 | */ | ||
| 496 | int ReadRecordedStream(unsigned char* pBuffer, unsigned int iBufferSize); | ||
| 497 | |||
| 498 | /*! | ||
| 499 | * Seek in a recorded stream. | ||
| 500 | * @param iPosition The position to seek to. | ||
| 501 | * @param iWhence ? | ||
| 502 | * @return The new position. | ||
| 503 | * @remarks Optional, and only used if bSupportsRecordings is set to true. Return -1 if this add-on won't provide this function. | ||
| 504 | */ | ||
| 505 | long long SeekRecordedStream(long long iPosition, int iWhence = SEEK_SET); | ||
| 506 | |||
| 507 | /*! | ||
| 508 | * @return The position in the stream that's currently being read. | ||
| 509 | * @remarks Optional, and only used if bSupportsRecordings is set to true. Return -1 if this add-on won't provide this function. | ||
| 510 | */ | ||
| 511 | long long PositionRecordedStream(void); | ||
| 512 | |||
| 513 | /*! | ||
| 514 | * @return The total length of the stream that's currently being read. | ||
| 515 | * @remarks Optional, and only used if bSupportsRecordings is set to true. Return -1 if this add-on won't provide this function. | ||
| 516 | */ | ||
| 517 | long long LengthRecordedStream(void); | ||
| 518 | //@} | ||
| 519 | |||
| 520 | /** @name PVR demultiplexer methods | ||
| 521 | * @remarks Only used by XBMC is bHandlesDemuxing is set to true. | ||
| 522 | */ | ||
| 523 | //@{ | ||
| 524 | /*! | ||
| 525 | * Reset the demultiplexer in the add-on. | ||
| 526 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 527 | */ | ||
| 528 | void DemuxReset(void); | ||
| 529 | |||
| 530 | /*! | ||
| 531 | * Abort the demultiplexer thread in the add-on. | ||
| 532 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 533 | */ | ||
| 534 | void DemuxAbort(void); | ||
| 535 | |||
| 536 | /*! | ||
| 537 | * Flush all data that's currently in the demultiplexer buffer in the add-on. | ||
| 538 | * @remarks Required if bHandlesDemuxing is set to true. | ||
| 539 | */ | ||
| 540 | void DemuxFlush(void); | ||
| 541 | |||
| 542 | /*! | ||
| 543 | * Read the next packet from the demultiplexer, if there is one. | ||
| 544 | * @return The next packet. | ||
| 545 | * If there is no next packet, then the add-on should return the | ||
| 546 | * packet created by calling AllocateDemuxPacket(0) on the callback. | ||
| 547 | * If the stream changed and XBMC's player needs to be reinitialised, | ||
| 548 | * then, the add-on should call AllocateDemuxPacket(0) on the | ||
| 549 | * callback, and set the streamid to DMX_SPECIALID_STREAMCHANGE and | ||
| 550 | * return the value. | ||
| 551 | * The add-on should return NULL if an error occured. | ||
| 552 | * @remarks Required if bHandlesDemuxing is set to true. Return NULL if this add-on won't provide this function. | ||
| 553 | */ | ||
| 554 | DemuxPacket* DemuxRead(void); | ||
| 555 | //@} | ||
| 556 | |||
| 557 | /*! | ||
| 558 | * Delay to use when using switching channels for add-ons not providing an input stream. | ||
| 559 | * If the add-on does provide an input stream, then this method will not be called. | ||
| 560 | * Those add-ons can do that in OpenLiveStream() if needed. | ||
| 561 | * @return The delay in milliseconds. | ||
| 562 | */ | ||
| 563 | unsigned int GetChannelSwitchDelay(void); | ||
| 564 | |||
| 565 | /*! | ||
| 566 | * Check if the backend support pausing the currently playing stream | ||
| 567 | * This will enable/disable the pause button in XBMC based on the return value | ||
| 568 | * @return false if the PVR addon/backend does not support pausing, true if possible | ||
| 569 | */ | ||
| 570 | bool CanPauseStream(); | ||
| 571 | |||
| 572 | /*! | ||
| 573 | * Check if the backend supports seeking for the currently playing stream | ||
| 574 | * This will enable/disable the rewind/forward buttons in XBMC based on the return value | ||
| 575 | * @return false if the PVR addon/backend does not support seeking, true if possible | ||
| 576 | */ | ||
| 577 | bool CanSeekStream(); | ||
| 578 | |||
| 579 | /*! | ||
| 580 | * @brief Notify the pvr addon that XBMC (un)paused the currently playing stream | ||
| 581 | */ | ||
| 582 | void PauseStream(bool bPaused); | ||
| 583 | |||
| 584 | /*! | ||
| 585 | * Notify the pvr addon/demuxer that XBMC wishes to seek the stream by time | ||
| 586 | * @param time The absolute time since stream start | ||
| 587 | * @param backwards True to seek to keyframe BEFORE time, else AFTER | ||
| 588 | * @param startpts can be updated to point to where display should start | ||
| 589 | * @return True if the seek operation was possible | ||
| 590 | * @remarks Optional, and only used if addon has its own demuxer. Return False if this add-on won't provide this function. | ||
| 591 | */ | ||
| 592 | bool SeekTime(int time, bool backwards, double *startpts); | ||
| 593 | |||
| 594 | /*! | ||
| 595 | * Notify the pvr addon/demuxer that XBMC wishes to change playback speed | ||
| 596 | * @param speed The requested playback speed | ||
| 597 | * @remarks Optional, and only used if addon has its own demuxer. | ||
| 598 | */ | ||
| 599 | void SetSpeed(int speed); | ||
| 600 | |||
| 601 | /*! | ||
| 602 | * Get actual playing time from addon. With timeshift enabled this is | ||
| 603 | * different to live. | ||
| 604 | * @return time as UTC | ||
| 605 | */ | ||
| 606 | time_t GetPlayingTime(); | ||
| 607 | |||
| 608 | /*! | ||
| 609 | * Get time of oldest packet in timeshift buffer | ||
| 610 | * @return time as UTC | ||
| 611 | */ | ||
| 612 | time_t GetBufferTimeStart(); | ||
| 613 | |||
| 614 | /*! | ||
| 615 | * Get time of latest packet in timeshift buffer | ||
| 616 | * @return time as UTC | ||
| 617 | */ | ||
| 618 | time_t GetBufferTimeEnd(); | ||
| 619 | |||
| 620 | /*! | ||
| 621 | * Get the hostname of the pvr backend server | ||
| 622 | * @return hostname as ip address or alias. If backend does not | ||
| 623 | * utilize a server, return empty string. | ||
| 624 | */ | ||
| 625 | const char* GetBackendHostname(); | ||
| 626 | |||
| 627 | /*! | ||
| 628 | * Check if timeshift is active | ||
| 629 | * @return true if timeshift is active | ||
| 630 | */ | ||
| 631 | bool IsTimeshifting(); | ||
| 632 | |||
| 633 | /*! | ||
| 634 | * Check for real-time streaming | ||
| 635 | * @return true if current stream is real-time | ||
| 636 | */ | ||
| 637 | bool IsRealTimeStream(); | ||
| 638 | |||
| 639 | /*! | ||
| 640 | * Tell the client the time frame to use when notifying epg events back to Kodi. The client might push epg events asynchronously | ||
| 641 | * to Kodi using the callback function EpgEventStateChange. To be able to only push events that are actually of interest for Kodi, | ||
| 642 | * client needs to know about the epg time frame Kodi uses. Kodi calls this function once after the client add-on has been sucessfully | ||
| 643 | * initialized and then everytime the time frame value changes. | ||
| 644 | * @param iDays number of days from "now". EPG_TIMEFRAME_UNLIMITED means that Kodi is interested in all epg events, regardless of event times. | ||
| 645 | * @return PVR_ERROR_NO_ERROR if new value was successfully set. | ||
| 646 | * @remarks Required if bSupportsEPG is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. | ||
| 647 | */ | ||
| 648 | PVR_ERROR SetEPGTimeFrame(int iDays); | ||
| 649 | |||
| 650 | /*! | ||
| 651 | * Called by XBMC to assign the function pointers of this add-on to pClient. | ||
| 652 | * @param pClient The struct to assign the function pointers to. | ||
| 653 | */ | ||
| 654 | void __declspec(dllexport) get_addon(struct PVRClient* pClient) | ||
| 655 | { | ||
| 656 | pClient->GetPVRAPIVersion = GetPVRAPIVersion; | ||
| 657 | pClient->GetMininumPVRAPIVersion = GetMininumPVRAPIVersion; | ||
| 658 | pClient->GetGUIAPIVersion = GetGUIAPIVersion; | ||
| 659 | pClient->GetMininumGUIAPIVersion = GetMininumGUIAPIVersion; | ||
| 660 | pClient->GetAddonCapabilities = GetAddonCapabilities; | ||
| 661 | pClient->GetStreamProperties = GetStreamProperties; | ||
| 662 | pClient->GetConnectionString = GetConnectionString; | ||
| 663 | pClient->GetBackendName = GetBackendName; | ||
| 664 | pClient->GetBackendVersion = GetBackendVersion; | ||
| 665 | pClient->GetDriveSpace = GetDriveSpace; | ||
| 666 | pClient->OpenDialogChannelScan = OpenDialogChannelScan; | ||
| 667 | pClient->MenuHook = CallMenuHook; | ||
| 668 | |||
| 669 | pClient->GetEpg = GetEPGForChannel; | ||
| 670 | |||
| 671 | pClient->GetChannelGroupsAmount = GetChannelGroupsAmount; | ||
| 672 | pClient->GetChannelGroups = GetChannelGroups; | ||
| 673 | pClient->GetChannelGroupMembers = GetChannelGroupMembers; | ||
| 674 | |||
| 675 | pClient->GetChannelsAmount = GetChannelsAmount; | ||
| 676 | pClient->GetChannels = GetChannels; | ||
| 677 | pClient->DeleteChannel = DeleteChannel; | ||
| 678 | pClient->RenameChannel = RenameChannel; | ||
| 679 | pClient->MoveChannel = MoveChannel; | ||
| 680 | pClient->OpenDialogChannelSettings = OpenDialogChannelSettings; | ||
| 681 | pClient->OpenDialogChannelAdd = OpenDialogChannelAdd; | ||
| 682 | |||
| 683 | pClient->GetRecordingsAmount = GetRecordingsAmount; | ||
| 684 | pClient->GetRecordings = GetRecordings; | ||
| 685 | pClient->DeleteRecording = DeleteRecording; | ||
| 686 | pClient->UndeleteRecording = UndeleteRecording; | ||
| 687 | pClient->DeleteAllRecordingsFromTrash = DeleteAllRecordingsFromTrash; | ||
| 688 | pClient->RenameRecording = RenameRecording; | ||
| 689 | pClient->SetRecordingPlayCount = SetRecordingPlayCount; | ||
| 690 | pClient->SetRecordingLastPlayedPosition = SetRecordingLastPlayedPosition; | ||
| 691 | pClient->GetRecordingLastPlayedPosition = GetRecordingLastPlayedPosition; | ||
| 692 | pClient->GetRecordingEdl = GetRecordingEdl; | ||
| 693 | |||
| 694 | pClient->GetTimerTypes = GetTimerTypes; | ||
| 695 | pClient->GetTimersAmount = GetTimersAmount; | ||
| 696 | pClient->GetTimers = GetTimers; | ||
| 697 | pClient->AddTimer = AddTimer; | ||
| 698 | pClient->DeleteTimer = DeleteTimer; | ||
| 699 | pClient->UpdateTimer = UpdateTimer; | ||
| 700 | |||
| 701 | pClient->OpenLiveStream = OpenLiveStream; | ||
| 702 | pClient->CloseLiveStream = CloseLiveStream; | ||
| 703 | pClient->ReadLiveStream = ReadLiveStream; | ||
| 704 | pClient->SeekLiveStream = SeekLiveStream; | ||
| 705 | pClient->PositionLiveStream = PositionLiveStream; | ||
| 706 | pClient->LengthLiveStream = LengthLiveStream; | ||
| 707 | pClient->SwitchChannel = SwitchChannel; | ||
| 708 | pClient->SignalStatus = SignalStatus; | ||
| 709 | pClient->GetLiveStreamURL = GetLiveStreamURL; | ||
| 710 | pClient->GetChannelSwitchDelay = GetChannelSwitchDelay; | ||
| 711 | pClient->CanPauseStream = CanPauseStream; | ||
| 712 | pClient->PauseStream = PauseStream; | ||
| 713 | pClient->CanSeekStream = CanSeekStream; | ||
| 714 | pClient->SeekTime = SeekTime; | ||
| 715 | pClient->SetSpeed = SetSpeed; | ||
| 716 | |||
| 717 | pClient->OpenRecordedStream = OpenRecordedStream; | ||
| 718 | pClient->CloseRecordedStream = CloseRecordedStream; | ||
| 719 | pClient->ReadRecordedStream = ReadRecordedStream; | ||
| 720 | pClient->SeekRecordedStream = SeekRecordedStream; | ||
| 721 | pClient->PositionRecordedStream = PositionRecordedStream; | ||
| 722 | pClient->LengthRecordedStream = LengthRecordedStream; | ||
| 723 | |||
| 724 | pClient->DemuxReset = DemuxReset; | ||
| 725 | pClient->DemuxAbort = DemuxAbort; | ||
| 726 | pClient->DemuxFlush = DemuxFlush; | ||
| 727 | pClient->DemuxRead = DemuxRead; | ||
| 728 | |||
| 729 | pClient->GetPlayingTime = GetPlayingTime; | ||
| 730 | pClient->GetBufferTimeStart = GetBufferTimeStart; | ||
| 731 | pClient->GetBufferTimeEnd = GetBufferTimeEnd; | ||
| 732 | |||
| 733 | pClient->GetBackendHostname = GetBackendHostname; | ||
| 734 | |||
| 735 | pClient->IsTimeshifting = IsTimeshifting; | ||
| 736 | pClient->IsRealTimeStream = IsRealTimeStream; | ||
| 737 | |||
| 738 | pClient->SetEPGTimeFrame = SetEPGTimeFrame; | ||
| 739 | }; | ||
| 740 | }; | ||
| 741 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h new file mode 100644 index 0000000..83bb13a --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h | |||
| @@ -0,0 +1,597 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifdef TARGET_WINDOWS | ||
| 24 | #include <windows.h> | ||
| 25 | #else | ||
| 26 | #ifndef __cdecl | ||
| 27 | #define __cdecl | ||
| 28 | #endif | ||
| 29 | #ifndef __declspec | ||
| 30 | #define __declspec(X) | ||
| 31 | #endif | ||
| 32 | #endif | ||
| 33 | #include <string.h> | ||
| 34 | #include <stdint.h> | ||
| 35 | |||
| 36 | #include "xbmc_addon_types.h" | ||
| 37 | #include "xbmc_epg_types.h" | ||
| 38 | #include "xbmc_codec_types.h" | ||
| 39 | |||
| 40 | /*! @note Define "USE_DEMUX" at compile time if demuxing in the PVR add-on is used. | ||
| 41 | * Also XBMC's "DVDDemuxPacket.h" file must be in the include path of the add-on, | ||
| 42 | * and the add-on should set bHandlesDemuxing to true. | ||
| 43 | */ | ||
| 44 | #ifdef USE_DEMUX | ||
| 45 | #include "DVDDemuxPacket.h" | ||
| 46 | #else | ||
| 47 | struct DemuxPacket; | ||
| 48 | #endif | ||
| 49 | |||
| 50 | #undef ATTRIBUTE_PACKED | ||
| 51 | #undef PRAGMA_PACK_BEGIN | ||
| 52 | #undef PRAGMA_PACK_END | ||
| 53 | |||
| 54 | #if defined(__GNUC__) | ||
| 55 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | ||
| 56 | #define ATTRIBUTE_PACKED __attribute__ ((packed)) | ||
| 57 | #define PRAGMA_PACK 0 | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if !defined(ATTRIBUTE_PACKED) | ||
| 62 | #define ATTRIBUTE_PACKED | ||
| 63 | #define PRAGMA_PACK 1 | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #define PVR_ADDON_NAME_STRING_LENGTH 1024 | ||
| 67 | #define PVR_ADDON_URL_STRING_LENGTH 1024 | ||
| 68 | #define PVR_ADDON_DESC_STRING_LENGTH 1024 | ||
| 69 | #define PVR_ADDON_INPUT_FORMAT_STRING_LENGTH 32 | ||
| 70 | #define PVR_ADDON_EDL_LENGTH 32 | ||
| 71 | #define PVR_ADDON_TIMERTYPE_ARRAY_SIZE 32 | ||
| 72 | #define PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE 512 | ||
| 73 | #define PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE_SMALL 128 | ||
| 74 | #define PVR_ADDON_TIMERTYPE_STRING_LENGTH 64 | ||
| 75 | |||
| 76 | /* using the default avformat's MAX_STREAMS value to be safe */ | ||
| 77 | #define PVR_STREAM_MAX_STREAMS 20 | ||
| 78 | |||
| 79 | /* current PVR API version */ | ||
| 80 | #define XBMC_PVR_API_VERSION "5.0.0" | ||
| 81 | |||
| 82 | /* min. PVR API version */ | ||
| 83 | #define XBMC_PVR_MIN_API_VERSION "5.0.0" | ||
| 84 | |||
| 85 | #ifdef __cplusplus | ||
| 86 | extern "C" { | ||
| 87 | #endif | ||
| 88 | |||
| 89 | /*! | ||
| 90 | * @brief numeric PVR timer type definitions (PVR_TIMER.iTimerType values) | ||
| 91 | */ | ||
| 92 | const unsigned int PVR_TIMER_TYPE_NONE = 0; /*!< @brief "Null" value for a numeric timer type. */ | ||
| 93 | |||
| 94 | /*! | ||
| 95 | * @brief special PVR_TIMER.iClientIndex value to indicate that a timer has not (yet) a valid client index. | ||
| 96 | */ | ||
| 97 | const unsigned int PVR_TIMER_NO_CLIENT_INDEX = 0; /*!< @brief timer has not (yet) a valid client index. */ | ||
| 98 | |||
| 99 | /*! | ||
| 100 | * @brief special PVR_TIMER.iParentClientIndex value to indicate that a timer has no parent. | ||
| 101 | */ | ||
| 102 | const unsigned int PVR_TIMER_NO_PARENT = PVR_TIMER_NO_CLIENT_INDEX; /*!< @brief timer has no parent; it was not scheduled by a repeating timer. */ | ||
| 103 | |||
| 104 | /*! | ||
| 105 | * @brief special PVR_TIMER.iEpgUid value to indicate that a timer has no EPG event uid. | ||
| 106 | */ | ||
| 107 | const unsigned int PVR_TIMER_NO_EPG_UID = EPG_TAG_INVALID_UID; /*!< @brief timer has no EPG event uid. */ | ||
| 108 | |||
| 109 | /*! | ||
| 110 | * @brief special PVR_TIMER.iClientChannelUid value to indicate "any channel". Useful for some repeating timer types. | ||
| 111 | */ | ||
| 112 | const int PVR_TIMER_ANY_CHANNEL = -1; /*!< @brief denotes "any channel", not a specific one. */ | ||
| 113 | |||
| 114 | /*! | ||
| 115 | * @brief PVR timer type attributes (PVR_TIMER_TYPE.iAttributes values) | ||
| 116 | */ | ||
| 117 | const unsigned int PVR_TIMER_TYPE_ATTRIBUTE_NONE = 0x00000000; | ||
| 118 | |||
| 119 | const unsigned int PVR_TIMER_TYPE_IS_MANUAL = 0x00000001; /*!< @brief defines whether this is a type for manual (time-based) or epg-based timers */ | ||
| 120 | const unsigned int PVR_TIMER_TYPE_IS_REPEATING = 0x00000002; /*!< @brief defines whether this is a type for repeating or one-shot timers */ | ||
| 121 | const unsigned int PVR_TIMER_TYPE_IS_READONLY = 0x00000004; /*!< @brief timers of this type must not be edited by Kodi */ | ||
| 122 | const unsigned int PVR_TIMER_TYPE_FORBIDS_NEW_INSTANCES = 0x00000008; /*!< @brief timers of this type must not be created by Kodi. All other operations are allowed, though */ | ||
| 123 | |||
| 124 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE = 0x00000010; /*!< @brief this type supports enabling/disabling of the timer (PVR_TIMER.state SCHEDULED|DISBALED) */ | ||
| 125 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_CHANNELS = 0x00000020; /*!< @brief this type supports channels (PVR_TIMER.iClientChannelUid) */ | ||
| 126 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_START_TIME = 0x00000040; /*!< @brief this type supports a recording start time (PVR_TIMER.startTime) */ | ||
| 127 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_TITLE_EPG_MATCH = 0x00000080; /*!< @brief this type supports matching epg episode title using PVR_TIMER.strEpgSearchString */ | ||
| 128 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_FULLTEXT_EPG_MATCH = 0x00000100; /*!< @brief this type supports matching "more" epg data (not just episode title) using PVR_TIMER.strEpgSearchString. Setting FULLTEXT_EPG_MATCH implies TITLE_EPG_MATCH */ | ||
| 129 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_FIRST_DAY = 0x00000200; /*!< @brief this type supports a first day the timer gets active (PVR_TIMER.firstday) */ | ||
| 130 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_WEEKDAYS = 0x00000400; /*!< @brief this type supports weekdays for defining the recording schedule (PVR_TIMER.iWeekdays) */ | ||
| 131 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_RECORD_ONLY_NEW_EPISODES = 0x00000800; /*!< @brief this type supports the "record only new episodes" feature (PVR_TIMER.iPreventDuplicateEpisodes) */ | ||
| 132 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_START_END_MARGIN = 0x00001000; /*!< @brief this type supports pre and post record time (PVR_TIMER.iMarginStart, PVR_TIMER.iMarginEnd) */ | ||
| 133 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_PRIORITY = 0x00002000; /*!< @brief this type supports recording priority (PVR_TIMER.iPriority) */ | ||
| 134 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_LIFETIME = 0x00004000; /*!< @brief this type supports recording lifetime (PVR_TIMER.iLifetime) */ | ||
| 135 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_RECORDING_FOLDERS = 0x00008000; /*!< @brief this type supports placing recordings in user defined folders (PVR_TIMER.strDirectory) */ | ||
| 136 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_RECORDING_GROUP = 0x00010000; /*!< @brief this type supports a list of recording groups (PVR_TIMER.iRecordingGroup) */ | ||
| 137 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_END_TIME = 0x00020000; /*!< @brief this type supports a recording end time (PVR_TIMER.endTime) */ | ||
| 138 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_START_ANYTIME = 0x00040000; /*!< @brief enables an 'Any Time' over-ride option for startTime (using PVR_TIMER.bStartAnyTime) */ | ||
| 139 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_END_ANYTIME = 0x00080000; /*!< @brief enables a separate 'Any Time' over-ride for endTime (using PVR_TIMER.bEndAnyTime) */ | ||
| 140 | const unsigned int PVR_TIMER_TYPE_SUPPORTS_MAX_RECORDINGS = 0x00100000; /*!< @brief this type supports specifying a maximum recordings setting' (PVR_TIMER.iMaxRecordings) */ | ||
| 141 | const unsigned int PVR_TIMER_TYPE_REQUIRES_EPG_TAG_ON_CREATE = 0x00200000; /*!< @brief this type shold not appear on any create menus which don't provide an associated EPG tag */ | ||
| 142 | const unsigned int PVR_TIMER_TYPE_FORBIDS_EPG_TAG_ON_CREATE = 0x00400000; /*!< @brief this type should not appear on any create menus which provide an associated EPG tag */ | ||
| 143 | const unsigned int PVR_TIMER_TYPE_REQUIRES_EPG_SERIES_ON_CREATE = 0x00800000; /*!< @brief this type should not appear on any create menus unless associated with an EPG tag with 'series' attributes (EPG_TAG.iFlags & EPG_TAG_FLAG_IS_SERIES || EPG_TAG.iSeriesNumber > 0 || EPG_TAG.iEpisodeNumber > 0 || EPG_TAG.iEpisodePartNumber > 0). Implies PVR_TIMER_TYPE_REQUIRES_EPG_TAG_ON_CREATE */ | ||
| 144 | |||
| 145 | /*! | ||
| 146 | * @brief PVR timer weekdays (PVR_TIMER.iWeekdays values) | ||
| 147 | */ | ||
| 148 | const unsigned int PVR_WEEKDAY_NONE = 0x00; | ||
| 149 | const unsigned int PVR_WEEKDAY_MONDAY = 0x01; | ||
| 150 | const unsigned int PVR_WEEKDAY_TUESDAY = 0x02; | ||
| 151 | const unsigned int PVR_WEEKDAY_WEDNESDAY = 0x04; | ||
| 152 | const unsigned int PVR_WEEKDAY_THURSDAY = 0x08; | ||
| 153 | const unsigned int PVR_WEEKDAY_FRIDAY = 0x10; | ||
| 154 | const unsigned int PVR_WEEKDAY_SATURDAY = 0x20; | ||
| 155 | const unsigned int PVR_WEEKDAY_SUNDAY = 0x40; | ||
| 156 | const unsigned int PVR_WEEKDAY_ALLDAYS = PVR_WEEKDAY_MONDAY | PVR_WEEKDAY_TUESDAY | PVR_WEEKDAY_WEDNESDAY | | ||
| 157 | PVR_WEEKDAY_THURSDAY | PVR_WEEKDAY_FRIDAY | PVR_WEEKDAY_SATURDAY | | ||
| 158 | PVR_WEEKDAY_SUNDAY; | ||
| 159 | |||
| 160 | /*! | ||
| 161 | * @brief timeframe value for use with SetEPGTimeFrame function to indicate "no timeframe". | ||
| 162 | */ | ||
| 163 | const int EPG_TIMEFRAME_UNLIMITED = -1; | ||
| 164 | |||
| 165 | /*! | ||
| 166 | * @brief special PVR_TIMER.iClientChannelUid and PVR_RECORDING.iChannelUid value to indicate that no channel uid is available. | ||
| 167 | */ | ||
| 168 | const int PVR_CHANNEL_INVALID_UID = -1; /*!< @brief denotes that no channel uid is avaliable. */ | ||
| 169 | |||
| 170 | /*! | ||
| 171 | * @brief PVR add-on error codes | ||
| 172 | */ | ||
| 173 | typedef enum | ||
| 174 | { | ||
| 175 | PVR_ERROR_NO_ERROR = 0, /*!< @brief no error occurred */ | ||
| 176 | PVR_ERROR_UNKNOWN = -1, /*!< @brief an unknown error occurred */ | ||
| 177 | PVR_ERROR_NOT_IMPLEMENTED = -2, /*!< @brief the method that XBMC called is not implemented by the add-on */ | ||
| 178 | PVR_ERROR_SERVER_ERROR = -3, /*!< @brief the backend reported an error, or the add-on isn't connected */ | ||
| 179 | PVR_ERROR_SERVER_TIMEOUT = -4, /*!< @brief the command was sent to the backend, but the response timed out */ | ||
| 180 | PVR_ERROR_REJECTED = -5, /*!< @brief the command was rejected by the backend */ | ||
| 181 | PVR_ERROR_ALREADY_PRESENT = -6, /*!< @brief the requested item can not be added, because it's already present */ | ||
| 182 | PVR_ERROR_INVALID_PARAMETERS = -7, /*!< @brief the parameters of the method that was called are invalid for this operation */ | ||
| 183 | PVR_ERROR_RECORDING_RUNNING = -8, /*!< @brief a recording is running, so the timer can't be deleted without doing a forced delete */ | ||
| 184 | PVR_ERROR_FAILED = -9, /*!< @brief the command failed */ | ||
| 185 | } PVR_ERROR; | ||
| 186 | |||
| 187 | /*! | ||
| 188 | * @brief PVR timer states | ||
| 189 | */ | ||
| 190 | typedef enum | ||
| 191 | { | ||
| 192 | PVR_TIMER_STATE_NEW = 0, /*!< @brief the timer was just created on the backend and is not yet active. This state must not be used for timers just created on the client side. */ | ||
| 193 | PVR_TIMER_STATE_SCHEDULED = 1, /*!< @brief the timer is scheduled for recording */ | ||
| 194 | PVR_TIMER_STATE_RECORDING = 2, /*!< @brief the timer is currently recordings */ | ||
| 195 | PVR_TIMER_STATE_COMPLETED = 3, /*!< @brief the recording completed successfully */ | ||
| 196 | PVR_TIMER_STATE_ABORTED = 4, /*!< @brief recording started, but was aborted */ | ||
| 197 | PVR_TIMER_STATE_CANCELLED = 5, /*!< @brief the timer was scheduled, but was canceled */ | ||
| 198 | PVR_TIMER_STATE_CONFLICT_OK = 6, /*!< @brief the scheduled timer conflicts with another one, but will be recorded */ | ||
| 199 | PVR_TIMER_STATE_CONFLICT_NOK = 7, /*!< @brief the scheduled timer conflicts with another one and won't be recorded */ | ||
| 200 | PVR_TIMER_STATE_ERROR = 8, /*!< @brief the timer is scheduled, but can't be recorded for some reason */ | ||
| 201 | PVR_TIMER_STATE_DISABLED = 9, /*!< @brief the timer was disabled by the user, can be enabled via setting the state to PVR_TIMER_STATE_SCHEDULED */ | ||
| 202 | } PVR_TIMER_STATE; | ||
| 203 | |||
| 204 | /*! | ||
| 205 | * @brief PVR menu hook categories | ||
| 206 | */ | ||
| 207 | typedef enum | ||
| 208 | { | ||
| 209 | PVR_MENUHOOK_UNKNOWN =-1, /*!< @brief unknown menu hook */ | ||
| 210 | PVR_MENUHOOK_ALL = 0, /*!< @brief all categories */ | ||
| 211 | PVR_MENUHOOK_CHANNEL = 1, /*!< @brief for channels */ | ||
| 212 | PVR_MENUHOOK_TIMER = 2, /*!< @brief for timers */ | ||
| 213 | PVR_MENUHOOK_EPG = 3, /*!< @brief for EPG */ | ||
| 214 | PVR_MENUHOOK_RECORDING = 4, /*!< @brief for recordings */ | ||
| 215 | PVR_MENUHOOK_DELETED_RECORDING = 5, /*!< @brief for deleted recordings */ | ||
| 216 | PVR_MENUHOOK_SETTING = 6, /*!< @brief for settings */ | ||
| 217 | } PVR_MENUHOOK_CAT; | ||
| 218 | |||
| 219 | /*! | ||
| 220 | * @brief PVR backend connection states. Used with ConnectionStateChange callback. | ||
| 221 | */ | ||
| 222 | typedef enum | ||
| 223 | { | ||
| 224 | PVR_CONNECTION_STATE_UNKNOWN = 0, /*!< @brief unknown state (e.g. not yet tried to connect) */ | ||
| 225 | PVR_CONNECTION_STATE_SERVER_UNREACHABLE = 1, /*!< @brief backend server is not reachable (e.g. server not existing or network down)*/ | ||
| 226 | PVR_CONNECTION_STATE_SERVER_MISMATCH = 2, /*!< @brief backend server is reachable, but there is not the expected type of server running (e.g. HTSP required, but FTP running at given server:port) */ | ||
| 227 | PVR_CONNECTION_STATE_VERSION_MISMATCH = 3, /*!< @brief backend server is reachable, but server version does not match client requirements */ | ||
| 228 | PVR_CONNECTION_STATE_ACCESS_DENIED = 4, /*!< @brief backend server is reachable, but denies client access (e.g. due to wrong credentials) */ | ||
| 229 | PVR_CONNECTION_STATE_CONNECTED = 5, /*!< @brief connection to backend server is established */ | ||
| 230 | PVR_CONNECTION_STATE_DISCONNECTED = 6, /*!< @brief no connection to backend server (e.g. due to network errors or client initiated disconnect)*/ | ||
| 231 | } PVR_CONNECTION_STATE; | ||
| 232 | |||
| 233 | /*! | ||
| 234 | * @brief Properties passed to the Create() method of an add-on. | ||
| 235 | */ | ||
| 236 | typedef struct PVR_PROPERTIES | ||
| 237 | { | ||
| 238 | const char* strUserPath; /*!< @brief path to the user profile */ | ||
| 239 | const char* strClientPath; /*!< @brief path to this add-on */ | ||
| 240 | } PVR_PROPERTIES; | ||
| 241 | |||
| 242 | /*! | ||
| 243 | * @brief PVR add-on capabilities. All capabilities are set to "false" as default. | ||
| 244 | * If a capabilty is set to true, then the corresponding methods from xbmc_pvr_dll.h need to be implemented. | ||
| 245 | */ | ||
| 246 | typedef struct PVR_ADDON_CAPABILITIES | ||
| 247 | { | ||
| 248 | bool bSupportsEPG; /*!< @brief true if the add-on provides EPG information */ | ||
| 249 | bool bSupportsTV; /*!< @brief true if this add-on provides TV channels */ | ||
| 250 | bool bSupportsRadio; /*!< @brief true if this add-on supports radio channels */ | ||
| 251 | bool bSupportsRecordings; /*!< @brief true if this add-on supports playback of recordings stored on the backend */ | ||
| 252 | bool bSupportsRecordingsUndelete; /*!< @brief true if this add-on supports undelete of recordings stored on the backend */ | ||
| 253 | bool bSupportsTimers; /*!< @brief true if this add-on supports the creation and editing of timers */ | ||
| 254 | bool bSupportsChannelGroups; /*!< @brief true if this add-on supports channel groups */ | ||
| 255 | bool bSupportsChannelScan; /*!< @brief true if this add-on support scanning for new channels on the backend */ | ||
| 256 | bool bSupportsChannelSettings; /*!< @brief true if this add-on supports the following functions: DeleteChannel, RenameChannel, MoveChannel, DialogChannelSettings and DialogAddChannel */ | ||
| 257 | bool bHandlesInputStream; /*!< @brief true if this add-on provides an input stream. false if XBMC handles the stream. */ | ||
| 258 | bool bHandlesDemuxing; /*!< @brief true if this add-on demultiplexes packets. */ | ||
| 259 | bool bSupportsRecordingPlayCount; /*!< @brief true if the backend supports play count for recordings. */ | ||
| 260 | bool bSupportsLastPlayedPosition; /*!< @brief true if the backend supports store/retrieve of last played position for recordings. */ | ||
| 261 | bool bSupportsRecordingEdl; /*!< @brief true if the backend supports retrieving an edit decision list for recordings. */ | ||
| 262 | } ATTRIBUTE_PACKED PVR_ADDON_CAPABILITIES; | ||
| 263 | |||
| 264 | /*! | ||
| 265 | * @brief PVR stream properties | ||
| 266 | */ | ||
| 267 | typedef struct PVR_STREAM_PROPERTIES | ||
| 268 | { | ||
| 269 | unsigned int iStreamCount; | ||
| 270 | struct PVR_STREAM | ||
| 271 | { | ||
| 272 | unsigned int iPhysicalId; /*!< @brief (required) physical index */ | ||
| 273 | xbmc_codec_type_t iCodecType; /*!< @brief (required) codec type this stream */ | ||
| 274 | xbmc_codec_id_t iCodecId; /*!< @brief (required) codec id of this stream */ | ||
| 275 | char strLanguage[4]; /*!< @brief (required) language id */ | ||
| 276 | int iIdentifier; /*!< @brief (required) stream id */ | ||
| 277 | int iFPSScale; /*!< @brief (required) scale of 1000 and a rate of 29970 will result in 29.97 fps */ | ||
| 278 | int iFPSRate; /*!< @brief (required) FPS rate */ | ||
| 279 | int iHeight; /*!< @brief (required) height of the stream reported by the demuxer */ | ||
| 280 | int iWidth; /*!< @brief (required) width of the stream reported by the demuxer */ | ||
| 281 | float fAspect; /*!< @brief (required) display aspect ratio of the stream */ | ||
| 282 | int iChannels; /*!< @brief (required) amount of channels */ | ||
| 283 | int iSampleRate; /*!< @brief (required) sample rate */ | ||
| 284 | int iBlockAlign; /*!< @brief (required) block alignment */ | ||
| 285 | int iBitRate; /*!< @brief (required) bit rate */ | ||
| 286 | int iBitsPerSample; /*!< @brief (required) bits per sample */ | ||
| 287 | } stream[PVR_STREAM_MAX_STREAMS]; /*!< @brief (required) the streams */ | ||
| 288 | } ATTRIBUTE_PACKED PVR_STREAM_PROPERTIES; | ||
| 289 | |||
| 290 | /*! | ||
| 291 | * @brief Signal status information | ||
| 292 | */ | ||
| 293 | typedef struct PVR_SIGNAL_STATUS | ||
| 294 | { | ||
| 295 | char strAdapterName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the adapter that's being used */ | ||
| 296 | char strAdapterStatus[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) status of the adapter that's being used */ | ||
| 297 | char strServiceName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the current service */ | ||
| 298 | char strProviderName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the current service's provider */ | ||
| 299 | char strMuxName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) name of the current mux */ | ||
| 300 | int iSNR; /*!< @brief (optional) signal/noise ratio */ | ||
| 301 | int iSignal; /*!< @brief (optional) signal strength */ | ||
| 302 | long iBER; /*!< @brief (optional) bit error rate */ | ||
| 303 | long iUNC; /*!< @brief (optional) uncorrected blocks */ | ||
| 304 | } ATTRIBUTE_PACKED PVR_SIGNAL_STATUS; | ||
| 305 | |||
| 306 | /*! | ||
| 307 | * @brief Menu hooks that are available in the context menus while playing a stream via this add-on. | ||
| 308 | * And in the Live TV settings dialog | ||
| 309 | */ | ||
| 310 | typedef struct PVR_MENUHOOK | ||
| 311 | { | ||
| 312 | unsigned int iHookId; /*!< @brief (required) this hook's identifier */ | ||
| 313 | unsigned int iLocalizedStringId; /*!< @brief (required) the id of the label for this hook in g_localizeStrings */ | ||
| 314 | PVR_MENUHOOK_CAT category; /*!< @brief (required) category of menu hook */ | ||
| 315 | } ATTRIBUTE_PACKED PVR_MENUHOOK; | ||
| 316 | |||
| 317 | /*! | ||
| 318 | * @brief Representation of a TV or radio channel. | ||
| 319 | */ | ||
| 320 | typedef struct PVR_CHANNEL | ||
| 321 | { | ||
| 322 | unsigned int iUniqueId; /*!< @brief (required) unique identifier for this channel */ | ||
| 323 | bool bIsRadio; /*!< @brief (required) true if this is a radio channel, false if it's a TV channel */ | ||
| 324 | unsigned int iChannelNumber; /*!< @brief (optional) channel number of this channel on the backend */ | ||
| 325 | unsigned int iSubChannelNumber; /*!< @brief (optional) sub channel number of this channel on the backend (ATSC) */ | ||
| 326 | char strChannelName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) channel name given to this channel */ | ||
| 327 | char strInputFormat[PVR_ADDON_INPUT_FORMAT_STRING_LENGTH]; /*!< @brief (optional) input format type. types can be found in ffmpeg/libavformat/allformats.c | ||
| 328 | leave empty if unknown */ | ||
| 329 | char strStreamURL[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) the URL to use to access this channel. | ||
| 330 | leave empty to use this add-on to access the stream. | ||
| 331 | set to a path that's supported by XBMC otherwise. */ | ||
| 332 | unsigned int iEncryptionSystem; /*!< @brief (optional) the encryption ID or CaID of this channel */ | ||
| 333 | char strIconPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) path to the channel icon (if present) */ | ||
| 334 | bool bIsHidden; /*!< @brief (optional) true if this channel is marked as hidden */ | ||
| 335 | } ATTRIBUTE_PACKED PVR_CHANNEL; | ||
| 336 | |||
| 337 | typedef struct PVR_CHANNEL_GROUP | ||
| 338 | { | ||
| 339 | char strGroupName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) name of this channel group */ | ||
| 340 | bool bIsRadio; /*!< @brief (required) true if this is a radio channel group, false otherwise. */ | ||
| 341 | unsigned int iPosition; /*!< @brief (optional) sort position of the group (0 indicates that the backend doesn't support sorting of groups) */ | ||
| 342 | } ATTRIBUTE_PACKED PVR_CHANNEL_GROUP; | ||
| 343 | |||
| 344 | typedef struct PVR_CHANNEL_GROUP_MEMBER | ||
| 345 | { | ||
| 346 | char strGroupName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) name of the channel group to add the channel to */ | ||
| 347 | unsigned int iChannelUniqueId; /*!< @brief (required) unique id of the member */ | ||
| 348 | unsigned int iChannelNumber; /*!< @brief (optional) channel number within the group */ | ||
| 349 | } ATTRIBUTE_PACKED PVR_CHANNEL_GROUP_MEMBER; | ||
| 350 | |||
| 351 | /*! | ||
| 352 | * @brief Representation of a timer's attribute integer value. | ||
| 353 | */ | ||
| 354 | typedef struct PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE | ||
| 355 | { | ||
| 356 | int iValue; /*!< @brief (required) an integer value for a certain timer attribute */ | ||
| 357 | char strDescription[PVR_ADDON_TIMERTYPE_STRING_LENGTH]; /*!< @brief (optional) a localized string describing the value. If left blank, Kodi will | ||
| 358 | generate a suitable representation (like the integer value as string) */ | ||
| 359 | } ATTRIBUTE_PACKED PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE; | ||
| 360 | |||
| 361 | /*! | ||
| 362 | * @brief Representation of a timer type. | ||
| 363 | */ | ||
| 364 | typedef struct PVR_TIMER_TYPE | ||
| 365 | { | ||
| 366 | unsigned int iId; /*!< @brief (required) this type's identifier. Ids must be > PVR_TIMER_TYPE_NONE. */ | ||
| 367 | unsigned int iAttributes; /*!< @brief (required) defines the attributes for this type (PVR_TIMER_TYPE_* constants). */ | ||
| 368 | char strDescription[PVR_ADDON_TIMERTYPE_STRING_LENGTH]; /*!< @brief (optional) a short localized string describing the purpose of the type. (e.g. | ||
| 369 | "Any time at this channel if title matches"). If left blank, Kodi will generate a | ||
| 370 | description based on the attributes REPEATING and MANUAL. (e.g. "Repeating EPG-based." */ | ||
| 371 | /* priority value definitions */ | ||
| 372 | unsigned int iPrioritiesSize; /*!< @brief (required) Count of possible values for PVR_TMER.iPriority. 0 means priority | ||
| 373 | is not supported by this timer type or no own value definition wanted, but to use Kodi defaults | ||
| 374 | of 1..100. */ | ||
| 375 | PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE | ||
| 376 | priorities[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; /*!< @brief (optional) Array containing the possible values for PVR_TMER.iPriority. Must be | ||
| 377 | filled if iPrioritiesSize > 0 */ | ||
| 378 | int iPrioritiesDefault; /*!< @brief (optional) The default value for PVR_TMER.iPriority. Must be filled if iPrioritiesSize > 0 */ | ||
| 379 | |||
| 380 | /* lifetime value definitions */ | ||
| 381 | unsigned int iLifetimesSize; /*!< @brief (required) Count of possible values for PVR_TMER.iLifetime. 0 means lifetime | ||
| 382 | is not supported by this timer type or no own value definition wanted, but to use Kodi defaults | ||
| 383 | of 1..365. */ | ||
| 384 | PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE | ||
| 385 | lifetimes[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; /*!< @brief (optional) Array containing the possible values for PVR_TMER.iLifetime. Must be | ||
| 386 | filled if iLifetimesSize > 0 */ | ||
| 387 | int iLifetimesDefault; /*!< @brief (optional) The default value for PVR_TMER.iLifetime. Must be filled if iLifetimesSize > 0 */ | ||
| 388 | |||
| 389 | /* prevent duplicate episodes value definitions */ | ||
| 390 | unsigned int iPreventDuplicateEpisodesSize; /*!< @brief (required) Count of possible values for PVR_TMER.iPreventDuplicateEpisodes. 0 means duplicate | ||
| 391 | episodes prevention is not supported by this timer type or no own value definition wanted, but to use | ||
| 392 | Kodi defaults. */ | ||
| 393 | PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE | ||
| 394 | preventDuplicateEpisodes[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; | ||
| 395 | /*!< @brief (optional) Array containing the possible values for PVR_TMER.iPreventDuplicateEpisodes.. Must | ||
| 396 | be filled if iPreventDuplicateEpisodesSize > 0 */ | ||
| 397 | unsigned int iPreventDuplicateEpisodesDefault; /*!< @brief (optional) The default value for PVR_TMER.iPreventDuplicateEpisodesSize. Must be filled if iPreventDuplicateEpisodesSize > 0 */ | ||
| 398 | |||
| 399 | /* recording folder list value definitions */ | ||
| 400 | unsigned int iRecordingGroupSize; /*!< @brief (required) Count of possible values of PVR_TIMER.iRecordingGroup. 0 means folder lists are not supported by this timer type */ | ||
| 401 | PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE | ||
| 402 | recordingGroup[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE]; | ||
| 403 | /*!< @brief (optional) Array containing the possible values of PVR_TMER.iRecordingGroup. Must be filled if iRecordingGroupSize > 0 */ | ||
| 404 | unsigned int iRecordingGroupDefault; /*!< @brief (optional) The default value for PVR_TIMER.iRecordingGroup. Must be filled in if PVR_TIMER.iRecordingGroupSize > 0 */ | ||
| 405 | |||
| 406 | /* max recordings value definitions */ | ||
| 407 | unsigned int iMaxRecordingsSize; /*!< @brief (required) Count of possible values of PVR_TIMER.iMaxRecordings. 0 means max recordings are not supported by this timer type */ | ||
| 408 | PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE | ||
| 409 | maxRecordings[PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE_SMALL]; | ||
| 410 | /*!< @brief (optional) Array containing the possible values of PVR_TMER.iMaxRecordings. */ | ||
| 411 | int iMaxRecordingsDefault; /*!< @brief (optional) The default value for PVR_TIMER.iMaxRecordings. Must be filled in if PVR_TIMER.iMaxRecordingsSize > 0 */ | ||
| 412 | |||
| 413 | } ATTRIBUTE_PACKED PVR_TIMER_TYPE; | ||
| 414 | |||
| 415 | /*! | ||
| 416 | * @brief Representation of a timer event. | ||
| 417 | */ | ||
| 418 | typedef struct PVR_TIMER { | ||
| 419 | unsigned int iClientIndex; /*!< @brief (required) the index of this timer given by the client. PVR_TIMER_NO_CLIENT_INDEX indicates that the index was not yet set by the client, for example for new timers created by | ||
| 420 | Kodi and passed the first time to the client. A valid index must be greater than PVR_TIMER_NO_CLIENT_INDEX. */ | ||
| 421 | unsigned int iParentClientIndex; /*!< @brief (optional) for timers scheduled by a repeating timer, the index of the repeating timer that scheduled this timer (it's PVR_TIMER.iClientIndex value). Use PVR_TIMER_NO_PARENT | ||
| 422 | to indicate that this timer was no scheduled by a repeating timer. */ | ||
| 423 | int iClientChannelUid; /*!< @brief (optional) unique identifier of the channel to record on. PVR_TIMER_ANY_CHANNEL will denote "any channel", not a specific one. PVR_CHANNEL_INVALID_UID denotes that channel uid is not available.*/ | ||
| 424 | time_t startTime; /*!< @brief (optional) start time of the recording in UTC. Instant timers that are sent to the add-on by Kodi will have this value set to 0.*/ | ||
| 425 | time_t endTime; /*!< @brief (optional) end time of the recording in UTC. */ | ||
| 426 | bool bStartAnyTime; /*!< @brief (optional) for EPG based (not Manual) timers indicates startTime does not apply. Default = false */ | ||
| 427 | bool bEndAnyTime; /*!< @brief (optional) for EPG based (not Manual) timers indicates endTime does not apply. Default = false */ | ||
| 428 | PVR_TIMER_STATE state; /*!< @brief (required) the state of this timer */ | ||
| 429 | unsigned int iTimerType; /*!< @brief (required) the type of this timer. It is private to the addon and can be freely defined by the addon. The value must be greater than PVR_TIMER_TYPE_NONE. | ||
| 430 | Kodi does not interpret this value (except for checking for PVR_TIMER_TYPE_NONE), but will pass the right id to the addon with every PVR_TIMER instance, thus the addon easily can determine | ||
| 431 | the timer type. */ | ||
| 432 | char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) a title for this timer */ | ||
| 433 | char strEpgSearchString[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) a string used to search epg data for repeating epg-based timers. Format is backend-dependent, for example regexp */ | ||
| 434 | bool bFullTextEpgSearch; /*!< @brief (optional) indicates, whether strEpgSearchString is to match against the epg episode title only or also against "other" epg data (backend-dependent) */ | ||
| 435 | char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) the (relative) directory where the recording will be stored in */ | ||
| 436 | char strSummary[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) the summary for this timer */ | ||
| 437 | int iPriority; /*!< @brief (optional) the priority of this timer */ | ||
| 438 | int iLifetime; /*!< @brief (optional) lifetime of recordings created by this timer. > 0 days after which recordings will be deleted by the backend, < 0 addon defined integer list reference, == 0 disabled */ | ||
| 439 | int iMaxRecordings; /*!< @brief (optional) maximum number of recordings this timer shall create. > 0 number of recordings, < 0 addon defined integer list reference, == 0 disabled */ | ||
| 440 | unsigned int iRecordingGroup; /*!< @brief (optional) integer ref to addon/backend defined list of recording groups*/ | ||
| 441 | time_t firstDay; /*!< @brief (optional) the first day this timer is active, for repeating timers */ | ||
| 442 | unsigned int iWeekdays; /*!< @brief (optional) week days, for repeating timers */ | ||
| 443 | unsigned int iPreventDuplicateEpisodes; /*!< @brief (optional) 1 if backend should only record new episodes in case of a repeating epg-based timer, 0 if all episodes shall be recorded (no duplicate detection). Actual algorithm for | ||
| 444 | duplicate detection is defined by the backend. Addons may define own values for different duplicate detection algorithms, thus this is not just a bool.*/ | ||
| 445 | unsigned int iEpgUid; /*!< @brief (optional) EPG event id associated with this timer. Valid ids must be greater than EPG_TAG_INVALID_UID. */ | ||
| 446 | unsigned int iMarginStart; /*!< @brief (optional) if set, the backend starts the recording iMarginStart minutes before startTime. */ | ||
| 447 | unsigned int iMarginEnd; /*!< @brief (optional) if set, the backend ends the recording iMarginEnd minutes after endTime. */ | ||
| 448 | int iGenreType; /*!< @brief (optional) genre type */ | ||
| 449 | int iGenreSubType; /*!< @brief (optional) genre sub type */ | ||
| 450 | } ATTRIBUTE_PACKED PVR_TIMER; | ||
| 451 | |||
| 452 | /*! | ||
| 453 | * @brief Representation of a recording. | ||
| 454 | */ | ||
| 455 | typedef struct PVR_RECORDING { | ||
| 456 | char strRecordingId[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) unique id of the recording on the client. */ | ||
| 457 | char strTitle[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (required) the title of this recording */ | ||
| 458 | char strEpisodeName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) episode name (also known as subtitle) */ | ||
| 459 | int iSeriesNumber; /*!< @brief (optional) series number (usually called season). Set to "0" for specials/pilot. For 'invalid' see iEpisodeNumber or set to -1 */ | ||
| 460 | int iEpisodeNumber; /*!< @brief (optional) episode number within the "iSeriesNumber" season. For 'invalid' set to -1 or iSeriesNumber=iEpisodeNumber=0 to show both are invalid */ | ||
| 461 | int iYear; /*!< @brief (optional) year of first release (use to identify a specific movie re-make) / first airing for TV shows. Set to '0' for invalid. */ | ||
| 462 | |||
| 463 | char strStreamURL[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (required) stream URL to access this recording */ | ||
| 464 | char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) directory of this recording on the client */ | ||
| 465 | char strPlotOutline[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot outline */ | ||
| 466 | char strPlot[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot */ | ||
| 467 | char strChannelName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) channel name */ | ||
| 468 | char strIconPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) icon path */ | ||
| 469 | char strThumbnailPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) thumbnail path */ | ||
| 470 | char strFanartPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) fanart path */ | ||
| 471 | time_t recordingTime; /*!< @brief (optional) start time of the recording */ | ||
| 472 | int iDuration; /*!< @brief (optional) duration of the recording in seconds */ | ||
| 473 | int iPriority; /*!< @brief (optional) priority of this recording (from 0 - 100) */ | ||
| 474 | int iLifetime; /*!< @brief (optional) life time in days of this recording */ | ||
| 475 | int iGenreType; /*!< @brief (optional) genre type */ | ||
| 476 | int iGenreSubType; /*!< @brief (optional) genre sub type */ | ||
| 477 | int iPlayCount; /*!< @brief (optional) play count of this recording on the client */ | ||
| 478 | int iLastPlayedPosition; /*!< @brief (optional) last played position of this recording on the client */ | ||
| 479 | bool bIsDeleted; /*!< @brief (optional) shows this recording is deleted and can be undelete */ | ||
| 480 | unsigned int iEpgEventId; /*!< @brief (optional) EPG event id associated with this recording. Valid ids must be greater than EPG_TAG_INVALID_UID. */ | ||
| 481 | int iChannelUid; /*!< @brief (optional) unique identifier of the channel for this recording. PVR_CHANNEL_INVALID_UID denotes that channel uid is not available. */ | ||
| 482 | } ATTRIBUTE_PACKED PVR_RECORDING; | ||
| 483 | |||
| 484 | /*! | ||
| 485 | * @brief Edit definition list (EDL) | ||
| 486 | */ | ||
| 487 | typedef enum | ||
| 488 | { | ||
| 489 | PVR_EDL_TYPE_CUT = 0, /*!< @brief cut (completly remove content) */ | ||
| 490 | PVR_EDL_TYPE_MUTE = 1, /*!< @brief mute audio */ | ||
| 491 | PVR_EDL_TYPE_SCENE = 2, /*!< @brief scene markers (chapter seeking) */ | ||
| 492 | PVR_EDL_TYPE_COMBREAK = 3 /*!< @brief commercial breaks */ | ||
| 493 | } PVR_EDL_TYPE; | ||
| 494 | |||
| 495 | typedef struct PVR_EDL_ENTRY | ||
| 496 | { | ||
| 497 | int64_t start; // ms | ||
| 498 | int64_t end; // ms | ||
| 499 | PVR_EDL_TYPE type; | ||
| 500 | } ATTRIBUTE_PACKED PVR_EDL_ENTRY; | ||
| 501 | |||
| 502 | /*! | ||
| 503 | * @brief PVR menu hook data | ||
| 504 | */ | ||
| 505 | typedef struct PVR_MENUHOOK_DATA | ||
| 506 | { | ||
| 507 | PVR_MENUHOOK_CAT cat; | ||
| 508 | union data { | ||
| 509 | int iEpgUid; | ||
| 510 | PVR_CHANNEL channel; | ||
| 511 | PVR_TIMER timer; | ||
| 512 | PVR_RECORDING recording; | ||
| 513 | } data; | ||
| 514 | } ATTRIBUTE_PACKED PVR_MENUHOOK_DATA; | ||
| 515 | |||
| 516 | /*! | ||
| 517 | * @brief Structure to transfer the methods from xbmc_pvr_dll.h to XBMC | ||
| 518 | */ | ||
| 519 | typedef struct PVRClient | ||
| 520 | { | ||
| 521 | const char* (__cdecl* GetPVRAPIVersion)(void); | ||
| 522 | const char* (__cdecl* GetMininumPVRAPIVersion)(void); | ||
| 523 | const char* (__cdecl* GetGUIAPIVersion)(void); | ||
| 524 | const char* (__cdecl* GetMininumGUIAPIVersion)(void); | ||
| 525 | PVR_ERROR (__cdecl* GetAddonCapabilities)(PVR_ADDON_CAPABILITIES*); | ||
| 526 | PVR_ERROR (__cdecl* GetStreamProperties)(PVR_STREAM_PROPERTIES*); | ||
| 527 | const char* (__cdecl* GetBackendName)(void); | ||
| 528 | const char* (__cdecl* GetBackendVersion)(void); | ||
| 529 | const char* (__cdecl* GetConnectionString)(void); | ||
| 530 | PVR_ERROR (__cdecl* GetDriveSpace)(long long*, long long*); | ||
| 531 | PVR_ERROR (__cdecl* MenuHook)(const PVR_MENUHOOK&, const PVR_MENUHOOK_DATA&); | ||
| 532 | PVR_ERROR (__cdecl* GetEpg)(ADDON_HANDLE, const PVR_CHANNEL&, time_t, time_t); | ||
| 533 | int (__cdecl* GetChannelGroupsAmount)(void); | ||
| 534 | PVR_ERROR (__cdecl* GetChannelGroups)(ADDON_HANDLE, bool); | ||
| 535 | PVR_ERROR (__cdecl* GetChannelGroupMembers)(ADDON_HANDLE, const PVR_CHANNEL_GROUP&); | ||
| 536 | PVR_ERROR (__cdecl* OpenDialogChannelScan)(void); | ||
| 537 | int (__cdecl* GetChannelsAmount)(void); | ||
| 538 | PVR_ERROR (__cdecl* GetChannels)(ADDON_HANDLE, bool); | ||
| 539 | PVR_ERROR (__cdecl* DeleteChannel)(const PVR_CHANNEL&); | ||
| 540 | PVR_ERROR (__cdecl* RenameChannel)(const PVR_CHANNEL&); | ||
| 541 | PVR_ERROR (__cdecl* MoveChannel)(const PVR_CHANNEL&); | ||
| 542 | PVR_ERROR (__cdecl* OpenDialogChannelSettings)(const PVR_CHANNEL&); | ||
| 543 | PVR_ERROR (__cdecl* OpenDialogChannelAdd)(const PVR_CHANNEL&); | ||
| 544 | int (__cdecl* GetRecordingsAmount)(bool); | ||
| 545 | PVR_ERROR (__cdecl* GetRecordings)(ADDON_HANDLE, bool); | ||
| 546 | PVR_ERROR (__cdecl* DeleteRecording)(const PVR_RECORDING&); | ||
| 547 | PVR_ERROR (__cdecl* UndeleteRecording)(const PVR_RECORDING&); | ||
| 548 | PVR_ERROR (__cdecl* DeleteAllRecordingsFromTrash)(void); | ||
| 549 | PVR_ERROR (__cdecl* RenameRecording)(const PVR_RECORDING&); | ||
| 550 | PVR_ERROR (__cdecl* SetRecordingPlayCount)(const PVR_RECORDING&, int); | ||
| 551 | PVR_ERROR (__cdecl* SetRecordingLastPlayedPosition)(const PVR_RECORDING&, int); | ||
| 552 | int (__cdecl* GetRecordingLastPlayedPosition)(const PVR_RECORDING&); | ||
| 553 | PVR_ERROR (__cdecl* GetRecordingEdl)(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*); | ||
| 554 | PVR_ERROR (__cdecl* GetTimerTypes)(PVR_TIMER_TYPE[], int*); | ||
| 555 | int (__cdecl* GetTimersAmount)(void); | ||
| 556 | PVR_ERROR (__cdecl* GetTimers)(ADDON_HANDLE); | ||
| 557 | PVR_ERROR (__cdecl* AddTimer)(const PVR_TIMER&); | ||
| 558 | PVR_ERROR (__cdecl* DeleteTimer)(const PVR_TIMER&, bool); | ||
| 559 | PVR_ERROR (__cdecl* UpdateTimer)(const PVR_TIMER&); | ||
| 560 | bool (__cdecl* OpenLiveStream)(const PVR_CHANNEL&); | ||
| 561 | void (__cdecl* CloseLiveStream)(void); | ||
| 562 | int (__cdecl* ReadLiveStream)(unsigned char*, unsigned int); | ||
| 563 | long long (__cdecl* SeekLiveStream)(long long, int); | ||
| 564 | long long (__cdecl* PositionLiveStream)(void); | ||
| 565 | long long (__cdecl* LengthLiveStream)(void); | ||
| 566 | bool (__cdecl* SwitchChannel)(const PVR_CHANNEL&); | ||
| 567 | PVR_ERROR (__cdecl* SignalStatus)(PVR_SIGNAL_STATUS&); | ||
| 568 | const char* (__cdecl* GetLiveStreamURL)(const PVR_CHANNEL&); | ||
| 569 | bool (__cdecl* OpenRecordedStream)(const PVR_RECORDING&); | ||
| 570 | void (__cdecl* CloseRecordedStream)(void); | ||
| 571 | int (__cdecl* ReadRecordedStream)(unsigned char*, unsigned int); | ||
| 572 | long long (__cdecl* SeekRecordedStream)(long long, int); | ||
| 573 | long long (__cdecl* PositionRecordedStream)(void); | ||
| 574 | long long (__cdecl* LengthRecordedStream)(void); | ||
| 575 | void (__cdecl* DemuxReset)(void); | ||
| 576 | void (__cdecl* DemuxAbort)(void); | ||
| 577 | void (__cdecl* DemuxFlush)(void); | ||
| 578 | DemuxPacket* (__cdecl* DemuxRead)(void); | ||
| 579 | unsigned int (__cdecl* GetChannelSwitchDelay)(void); | ||
| 580 | bool (__cdecl* CanPauseStream)(void); | ||
| 581 | void (__cdecl* PauseStream)(bool); | ||
| 582 | bool (__cdecl* CanSeekStream)(void); | ||
| 583 | bool (__cdecl* SeekTime)(int, bool, double*); | ||
| 584 | void (__cdecl* SetSpeed)(int); | ||
| 585 | time_t (__cdecl* GetPlayingTime)(void); | ||
| 586 | time_t (__cdecl* GetBufferTimeStart)(void); | ||
| 587 | time_t (__cdecl* GetBufferTimeEnd)(void); | ||
| 588 | const char* (__cdecl* GetBackendHostname)(void); | ||
| 589 | bool (__cdecl* IsTimeshifting)(void); | ||
| 590 | bool (__cdecl* IsRealTimeStream)(void); | ||
| 591 | PVR_ERROR (__cdecl* SetEPGTimeFrame)(int); | ||
| 592 | } PVRClient; | ||
| 593 | |||
| 594 | #ifdef __cplusplus | ||
| 595 | } | ||
| 596 | #endif | ||
| 597 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h new file mode 100644 index 0000000..8652a0a --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include "xbmc_addon_dll.h" | ||
| 24 | #include "xbmc_scr_types.h" | ||
| 25 | |||
| 26 | extern "C" | ||
| 27 | { | ||
| 28 | |||
| 29 | // Functions that your visualisation must implement | ||
| 30 | void Start(); | ||
| 31 | void Render(); | ||
| 32 | void GetInfo(SCR_INFO* pInfo); | ||
| 33 | |||
| 34 | // function to export the above structure to XBMC | ||
| 35 | void __declspec(dllexport) get_addon(struct ScreenSaver* pScr) | ||
| 36 | { | ||
| 37 | pScr->Start = Start; | ||
| 38 | pScr->Render = Render; | ||
| 39 | pScr->GetInfo = GetInfo; | ||
| 40 | }; | ||
| 41 | }; | ||
| 42 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h new file mode 100644 index 0000000..5785b25 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | extern "C" | ||
| 24 | { | ||
| 25 | struct SCR_INFO | ||
| 26 | { | ||
| 27 | int dummy; | ||
| 28 | }; | ||
| 29 | |||
| 30 | struct SCR_PROPS | ||
| 31 | { | ||
| 32 | void *device; | ||
| 33 | int x; | ||
| 34 | int y; | ||
| 35 | int width; | ||
| 36 | int height; | ||
| 37 | float pixelRatio; | ||
| 38 | const char *name; | ||
| 39 | const char *presets; | ||
| 40 | const char *profile; | ||
| 41 | }; | ||
| 42 | |||
| 43 | struct ScreenSaver | ||
| 44 | { | ||
| 45 | void (__cdecl* Start) (); | ||
| 46 | void (__cdecl* Render) (); | ||
| 47 | void (__cdecl* GetInfo)(SCR_INFO *info); | ||
| 48 | }; | ||
| 49 | } | ||
| 50 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp new file mode 100644 index 0000000..099776a --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp | |||
| @@ -0,0 +1,264 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 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 XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "xbmc_pvr_types.h" | ||
| 23 | #include <algorithm> | ||
| 24 | #include <map> | ||
| 25 | |||
| 26 | namespace ADDON | ||
| 27 | { | ||
| 28 | /** | ||
| 29 | * Represents a single stream. It extends the PODS to provide some operators | ||
| 30 | * overloads. | ||
| 31 | */ | ||
| 32 | class XbmcPvrStream : public PVR_STREAM_PROPERTIES::PVR_STREAM | ||
| 33 | { | ||
| 34 | public: | ||
| 35 | XbmcPvrStream() | ||
| 36 | { | ||
| 37 | Clear(); | ||
| 38 | } | ||
| 39 | |||
| 40 | XbmcPvrStream(const XbmcPvrStream &other) | ||
| 41 | { | ||
| 42 | memcpy(this, &other, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); | ||
| 43 | } | ||
| 44 | |||
| 45 | XbmcPvrStream& operator=(const XbmcPvrStream &other) | ||
| 46 | { | ||
| 47 | memcpy(this, &other, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); | ||
| 48 | return *this; | ||
| 49 | } | ||
| 50 | |||
| 51 | /** | ||
| 52 | * Compares this stream based on another stream | ||
| 53 | * @param other | ||
| 54 | * @return | ||
| 55 | */ | ||
| 56 | inline bool operator==(const XbmcPvrStream &other) const | ||
| 57 | { | ||
| 58 | return iPhysicalId == other.iPhysicalId && iCodecId == other.iCodecId; | ||
| 59 | } | ||
| 60 | |||
| 61 | /** | ||
| 62 | * Compares this stream with another one so that video streams are sorted | ||
| 63 | * before any other streams and the others are sorted by the physical ID | ||
| 64 | * @param other | ||
| 65 | * @return | ||
| 66 | */ | ||
| 67 | bool operator<(const XbmcPvrStream &other) const | ||
| 68 | { | ||
| 69 | if (iCodecType == XBMC_CODEC_TYPE_VIDEO) | ||
| 70 | return true; | ||
| 71 | else if (other.iCodecType != XBMC_CODEC_TYPE_VIDEO) | ||
| 72 | return iPhysicalId < other.iPhysicalId; | ||
| 73 | else | ||
| 74 | return false; | ||
| 75 | } | ||
| 76 | |||
| 77 | /** | ||
| 78 | * Clears the stream | ||
| 79 | */ | ||
| 80 | void Clear() | ||
| 81 | { | ||
| 82 | memset(this, 0, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); | ||
| 83 | iCodecId = XBMC_INVALID_CODEC_ID; | ||
| 84 | iCodecType = XBMC_CODEC_TYPE_UNKNOWN; | ||
| 85 | } | ||
| 86 | |||
| 87 | /** | ||
| 88 | * Checks whether the stream has been cleared | ||
| 89 | * @return | ||
| 90 | */ | ||
| 91 | inline bool IsCleared() const | ||
| 92 | { | ||
| 93 | return iCodecId == XBMC_INVALID_CODEC_ID && | ||
| 94 | iCodecType == XBMC_CODEC_TYPE_UNKNOWN; | ||
| 95 | } | ||
| 96 | }; | ||
| 97 | |||
| 98 | class XbmcStreamProperties | ||
| 99 | { | ||
| 100 | public: | ||
| 101 | typedef std::vector<XbmcPvrStream> stream_vector; | ||
| 102 | |||
| 103 | XbmcStreamProperties(void) | ||
| 104 | { | ||
| 105 | // make sure the vector won't have to resize itself later | ||
| 106 | m_streamVector = new stream_vector(); | ||
| 107 | m_streamVector->reserve(PVR_STREAM_MAX_STREAMS); | ||
| 108 | } | ||
| 109 | |||
| 110 | virtual ~XbmcStreamProperties(void) | ||
| 111 | { | ||
| 112 | delete m_streamVector; | ||
| 113 | } | ||
| 114 | |||
| 115 | /** | ||
| 116 | * Resets the streams | ||
| 117 | */ | ||
| 118 | void Clear(void) | ||
| 119 | { | ||
| 120 | m_streamVector->clear(); | ||
| 121 | m_streamIndex.clear(); | ||
| 122 | } | ||
| 123 | |||
| 124 | /** | ||
| 125 | * Returns the index of the stream with the specified physical ID, or -1 if | ||
| 126 | * there no stream is found. This method is called very often which is why | ||
| 127 | * we keep a separate map for this. | ||
| 128 | * @param iPhysicalId | ||
| 129 | * @return | ||
| 130 | */ | ||
| 131 | int GetStreamId(unsigned int iPhysicalId) const | ||
| 132 | { | ||
| 133 | std::map<unsigned int, int>::const_iterator it = m_streamIndex.find(iPhysicalId); | ||
| 134 | if (it != m_streamIndex.end()) | ||
| 135 | return it->second; | ||
| 136 | |||
| 137 | return -1; | ||
| 138 | } | ||
| 139 | |||
| 140 | /** | ||
| 141 | * Returns the stream with the specified physical ID, or null if no such | ||
| 142 | * stream exists | ||
| 143 | * @param iPhysicalId | ||
| 144 | * @return | ||
| 145 | */ | ||
| 146 | XbmcPvrStream* GetStreamById(unsigned int iPhysicalId) const | ||
| 147 | { | ||
| 148 | int position = GetStreamId(iPhysicalId); | ||
| 149 | return position != -1 ? &m_streamVector->at(position) : NULL; | ||
| 150 | } | ||
| 151 | |||
| 152 | /** | ||
| 153 | * Populates the specified stream with the stream having the specified | ||
| 154 | * physical ID. If the stream is not found only target stream's physical ID | ||
| 155 | * will be populated. | ||
| 156 | * @param iPhysicalId | ||
| 157 | * @param stream | ||
| 158 | */ | ||
| 159 | void GetStreamData(unsigned int iPhysicalId, XbmcPvrStream* stream) | ||
| 160 | { | ||
| 161 | XbmcPvrStream *foundStream = GetStreamById(iPhysicalId); | ||
| 162 | if (foundStream) | ||
| 163 | *stream = *foundStream; | ||
| 164 | else | ||
| 165 | { | ||
| 166 | stream->iIdentifier = -1; | ||
| 167 | stream->iPhysicalId = iPhysicalId; | ||
| 168 | } | ||
| 169 | } | ||
| 170 | |||
| 171 | /** | ||
| 172 | * Populates props with the current streams and returns whether there are | ||
| 173 | * any streams at the moment or not. | ||
| 174 | * @param props | ||
| 175 | * @return | ||
| 176 | */ | ||
| 177 | bool GetProperties(PVR_STREAM_PROPERTIES* props) | ||
| 178 | { | ||
| 179 | unsigned int i = 0; | ||
| 180 | for (stream_vector::const_iterator it = m_streamVector->begin(); | ||
| 181 | it != m_streamVector->end(); ++it, ++i) | ||
| 182 | { | ||
| 183 | memcpy(&props->stream[i], &(*it), sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); | ||
| 184 | } | ||
| 185 | |||
| 186 | props->iStreamCount = m_streamVector->size(); | ||
| 187 | return (props->iStreamCount > 0); | ||
| 188 | } | ||
| 189 | |||
| 190 | /** | ||
| 191 | * Merges new streams into the current list of streams. Identical streams | ||
| 192 | * will retain their respective indexes and new streams will replace unused | ||
| 193 | * indexes or be appended. | ||
| 194 | * @param newStreams | ||
| 195 | */ | ||
| 196 | void UpdateStreams(stream_vector &newStreams) | ||
| 197 | { | ||
| 198 | // sort the new streams | ||
| 199 | std::sort(newStreams.begin(), newStreams.end()); | ||
| 200 | |||
| 201 | // ensure we never have more than PVR_STREAMS_MAX_STREAMS streams | ||
| 202 | if (newStreams.size() > PVR_STREAM_MAX_STREAMS) | ||
| 203 | { | ||
| 204 | while (newStreams.size() > PVR_STREAM_MAX_STREAMS) | ||
| 205 | newStreams.pop_back(); | ||
| 206 | |||
| 207 | XBMC->Log(LOG_ERROR, "%s - max amount of streams reached", __FUNCTION__); | ||
| 208 | } | ||
| 209 | |||
| 210 | stream_vector::iterator newStreamPosition; | ||
| 211 | for (stream_vector::iterator it = m_streamVector->begin(); it != m_streamVector->end(); ++it) | ||
| 212 | { | ||
| 213 | newStreamPosition = std::find(newStreams.begin(), newStreams.end(), *it); | ||
| 214 | |||
| 215 | // if the current stream no longer exists we clear it, otherwise we | ||
| 216 | // copy it and remove it from newStreams | ||
| 217 | if (newStreamPosition == newStreams.end()) | ||
| 218 | it->Clear(); | ||
| 219 | else | ||
| 220 | { | ||
| 221 | *it = *newStreamPosition; | ||
| 222 | newStreams.erase(newStreamPosition); | ||
| 223 | } | ||
| 224 | } | ||
| 225 | |||
| 226 | // replace cleared streams with new streams | ||
| 227 | for (stream_vector::iterator it = m_streamVector->begin(); | ||
| 228 | it != m_streamVector->end() && !newStreams.empty(); ++it) | ||
| 229 | { | ||
| 230 | if (it->IsCleared()) | ||
| 231 | { | ||
| 232 | *it = newStreams.front(); | ||
| 233 | newStreams.erase(newStreams.begin()); | ||
| 234 | } | ||
| 235 | } | ||
| 236 | |||
| 237 | // append any remaining new streams | ||
| 238 | m_streamVector->insert(m_streamVector->end(), newStreams.begin(), newStreams.end()); | ||
| 239 | |||
| 240 | // remove trailing cleared streams | ||
| 241 | while (m_streamVector->back().IsCleared()) | ||
| 242 | m_streamVector->pop_back(); | ||
| 243 | |||
| 244 | // update the index | ||
| 245 | UpdateIndex(); | ||
| 246 | } | ||
| 247 | |||
| 248 | private: | ||
| 249 | stream_vector *m_streamVector; | ||
| 250 | std::map<unsigned int, int> m_streamIndex; | ||
| 251 | |||
| 252 | /** | ||
| 253 | * Updates the stream index | ||
| 254 | */ | ||
| 255 | void UpdateIndex() | ||
| 256 | { | ||
| 257 | m_streamIndex.clear(); | ||
| 258 | |||
| 259 | int i = 0; | ||
| 260 | for (stream_vector::const_iterator it = m_streamVector->begin(); it != m_streamVector->end(); ++it, ++i) | ||
| 261 | m_streamIndex[it->iPhysicalId] = i; | ||
| 262 | } | ||
| 263 | }; | ||
| 264 | } | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h new file mode 100644 index 0000000..50452c2 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include "xbmc_addon_dll.h" | ||
| 24 | #include "xbmc_vis_types.h" | ||
| 25 | |||
| 26 | extern "C" | ||
| 27 | { | ||
| 28 | // Functions that your visualisation must implement | ||
| 29 | void Start(int iChannels, int iSamplesPerSec, int iBitsPerSample, const char* szSongName); | ||
| 30 | void AudioData(const float* pAudioData, int iAudioDataLength, float *pFreqData, int iFreqDataLength); | ||
| 31 | void Render(); | ||
| 32 | bool OnAction(long action, const void *param); | ||
| 33 | void GetInfo(VIS_INFO* pInfo); | ||
| 34 | unsigned int GetPresets(char ***presets); | ||
| 35 | unsigned GetPreset(); | ||
| 36 | unsigned int GetSubModules(char ***presets); | ||
| 37 | bool IsLocked(); | ||
| 38 | |||
| 39 | // function to export the above structure to XBMC | ||
| 40 | void __declspec(dllexport) get_addon(struct Visualisation* pVisz) | ||
| 41 | { | ||
| 42 | pVisz->Start = Start; | ||
| 43 | pVisz->AudioData = AudioData; | ||
| 44 | pVisz->Render = Render; | ||
| 45 | pVisz->OnAction = OnAction; | ||
| 46 | pVisz->GetInfo = GetInfo; | ||
| 47 | pVisz->GetPresets = GetPresets; | ||
| 48 | pVisz->GetPreset = GetPreset; | ||
| 49 | pVisz->GetSubModules = GetSubModules; | ||
| 50 | pVisz->IsLocked = IsLocked; | ||
| 51 | }; | ||
| 52 | }; | ||
| 53 | |||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h new file mode 100644 index 0000000..708ffef --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2015 Team Kodi | ||
| 5 | * http://kodi.tv | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with Kodi; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | /* | ||
| 24 | Common data structures shared between Kodi and Kodi's visualisations | ||
| 25 | */ | ||
| 26 | |||
| 27 | #include <cstddef> | ||
| 28 | |||
| 29 | extern "C" | ||
| 30 | { | ||
| 31 | struct VIS_INFO | ||
| 32 | { | ||
| 33 | int bWantsFreq; | ||
| 34 | int iSyncDelay; | ||
| 35 | }; | ||
| 36 | |||
| 37 | struct VIS_PROPS | ||
| 38 | { | ||
| 39 | void *device; | ||
| 40 | int x; | ||
| 41 | int y; | ||
| 42 | int width; | ||
| 43 | int height; | ||
| 44 | float pixelRatio; | ||
| 45 | const char *name; | ||
| 46 | const char *presets; | ||
| 47 | const char *profile; | ||
| 48 | const char *submodule; | ||
| 49 | }; | ||
| 50 | |||
| 51 | enum VIS_ACTION | ||
| 52 | { | ||
| 53 | VIS_ACTION_NONE = 0, | ||
| 54 | VIS_ACTION_NEXT_PRESET, | ||
| 55 | VIS_ACTION_PREV_PRESET, | ||
| 56 | VIS_ACTION_LOAD_PRESET, | ||
| 57 | VIS_ACTION_RANDOM_PRESET, | ||
| 58 | VIS_ACTION_LOCK_PRESET, | ||
| 59 | VIS_ACTION_RATE_PRESET_PLUS, | ||
| 60 | VIS_ACTION_RATE_PRESET_MINUS, | ||
| 61 | VIS_ACTION_UPDATE_ALBUMART, | ||
| 62 | VIS_ACTION_UPDATE_TRACK | ||
| 63 | }; | ||
| 64 | |||
| 65 | class VisTrack | ||
| 66 | { | ||
| 67 | public: | ||
| 68 | VisTrack() | ||
| 69 | { | ||
| 70 | title = artist = album = albumArtist = NULL; | ||
| 71 | genre = comment = lyrics = reserved1 = reserved2 = NULL; | ||
| 72 | trackNumber = discNumber = duration = year = 0; | ||
| 73 | rating = 0; | ||
| 74 | reserved3 = reserved4 = 0; | ||
| 75 | } | ||
| 76 | |||
| 77 | const char *title; | ||
| 78 | const char *artist; | ||
| 79 | const char *album; | ||
| 80 | const char *albumArtist; | ||
| 81 | const char *genre; | ||
| 82 | const char *comment; | ||
| 83 | const char *lyrics; | ||
| 84 | const char *reserved1; | ||
| 85 | const char *reserved2; | ||
| 86 | |||
| 87 | int trackNumber; | ||
| 88 | int discNumber; | ||
| 89 | int duration; | ||
| 90 | int year; | ||
| 91 | char rating; | ||
| 92 | int reserved3; | ||
| 93 | int reserved4; | ||
| 94 | }; | ||
| 95 | |||
| 96 | struct Visualisation | ||
| 97 | { | ||
| 98 | void (__cdecl* Start)(int iChannels, int iSamplesPerSec, int iBitsPerSample, const char* szSongName); | ||
| 99 | void (__cdecl* AudioData)(const float* pAudioData, int iAudioDataLength, float *pFreqData, int iFreqDataLength); | ||
| 100 | void (__cdecl* Render) (); | ||
| 101 | void (__cdecl* GetInfo)(VIS_INFO *info); | ||
| 102 | bool (__cdecl* OnAction)(long flags, const void *param); | ||
| 103 | int (__cdecl* HasPresets)(); | ||
| 104 | unsigned int (__cdecl *GetPresets)(char ***presets); | ||
| 105 | unsigned int (__cdecl *GetPreset)(); | ||
| 106 | unsigned int (__cdecl *GetSubModules)(char ***modules); | ||
| 107 | bool (__cdecl* IsLocked)(); | ||
| 108 | }; | ||
| 109 | } | ||
| 110 | |||
