diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h | 564 |
1 files changed, 564 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 | |||
