diff options
| author | manuel <manuel@mausz.at> | 2017-07-23 16:59:43 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2017-07-23 16:59:43 +0200 |
| commit | 4c3251ec645c8b71820dab7e51e612e5919d4e75 (patch) | |
| tree | 9533268a93e58fc2e16de1b8ee3fafe3784e5225 /xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h | |
| parent | f44ecaa4f27e7538ddcad66d40e543bffa2d2d86 (diff) | |
| download | kodi-pvr-build-4c3251ec645c8b71820dab7e51e612e5919d4e75.tar.gz kodi-pvr-build-4c3251ec645c8b71820dab7e51e612e5919d4e75.tar.bz2 kodi-pvr-build-4c3251ec645c8b71820dab7e51e612e5919d4e75.zip | |
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h | 1288 |
1 files changed, 1288 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h new file mode 100644 index 0000000..c508f80 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h | |||
| @@ -0,0 +1,1288 @@ | |||
| 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 "../AddonBase.h" | ||
| 24 | |||
| 25 | #define AE_DSP_STREAM_MAX_STREAMS 8 | ||
| 26 | #define AE_DSP_STREAM_MAX_MODES 32 | ||
| 27 | |||
| 28 | /*! | ||
| 29 | * @file Addon.h | ||
| 30 | * @section sec1 Basic audio dsp addon interface description | ||
| 31 | * @author Team Kodi | ||
| 32 | * @date 10. May 2014 | ||
| 33 | * @version 0.1.5 | ||
| 34 | * | ||
| 35 | * @subsection sec1_1 General | ||
| 36 | * @li The basic support on the addon is supplied with the | ||
| 37 | * AE_DSP_ADDON_CAPABILITIES data which becomes asked over | ||
| 38 | * GetCapabilities(...), further the addon must register his available | ||
| 39 | * modes on startup with the RegisterMode(...) callback function. | ||
| 40 | * If one of this two points is not set the addon becomes | ||
| 41 | * ignored for the chain step. | ||
| 42 | * | ||
| 43 | * @subsection sec1_2 Processing | ||
| 44 | * @li On start of new stream the addon becomes called with StreamCreate(...) | ||
| 45 | * to check about given values that it support it basically and can create | ||
| 46 | * his structure, if nothing is supported it can return AE_DSP_ERROR_IGNORE_ME. | ||
| 47 | * | ||
| 48 | * @li As next step StreamIsModeSupported(...) becomes called for every | ||
| 49 | * available and enabled modes, is separated due to more as one available mode | ||
| 50 | * on the addon is possible, if the mode is not supported it can also be return | ||
| 51 | * AE_DSP_ERROR_IGNORE_ME. | ||
| 52 | * - If mode is a resample mode and returns no error it becomes asked with | ||
| 53 | * InputResampleSampleRate(...) or OutputResampleSampleRate(...) (relevant | ||
| 54 | * to his type) about his given sample rate. | ||
| 55 | * - About the from user selected master processing mode the related addon | ||
| 56 | * becomes called now with MasterProcessSetMode(...) to handle it's | ||
| 57 | * selectionon the addon given by the own addon type identifier or by | ||
| 58 | * KODI's useddatabase id, also the currently used stream type (e.g. | ||
| 59 | * Music or Video) is send. | ||
| 60 | * - If the addon supports only one master mode it can ignore this function | ||
| 61 | * and return always AE_DSP_ERROR_NO_ERROR. | ||
| 62 | * - If the master mode is set the addon becomes asked about the from him | ||
| 63 | * given output channel layout related to up- or downmix modes, if | ||
| 64 | * nothing becomes changed on the layout it can return -1. | ||
| 65 | * - The MasterProcessSetMode(...) is also called if from user a another | ||
| 66 | * mode becomes selected. | ||
| 67 | * | ||
| 68 | * @li Then as last step shortly before the first process call becomes executed | ||
| 69 | * the addon is called one time with StreamInitialize(...) to inform that | ||
| 70 | * processing is started on the given settings. | ||
| 71 | * - This function becomes also called on all add-ons if the master process | ||
| 72 | * becomes changed. | ||
| 73 | * - Also every process after StreamInitialize on the addon mode becomes asked | ||
| 74 | * with _..._ProcessNeededSamplesize(...) about required memory size for the | ||
| 75 | * output of his data, if no other size is required it can return 0. | ||
| 76 | * | ||
| 77 | * @li From now the processing becomes handled for the different steps with | ||
| 78 | * _..._Process(...). | ||
| 79 | * - Further it becomes asked with _..._GetDelay(...) about his processing | ||
| 80 | * time as float value in seconds, needed for video and audio alignment. | ||
| 81 | * | ||
| 82 | * @li On the end of the processing if the source becomes stopped the | ||
| 83 | * StreamDestroy(...) function becomes called on all active processing add-ons. | ||
| 84 | * | ||
| 85 | * @note | ||
| 86 | * The StreamCreate(...) can be becomes called for a new stream before the | ||
| 87 | * previous was closed with StreamDestroy(...) ! To have a speed improve. | ||
| 88 | */ | ||
| 89 | |||
| 90 | namespace kodi { namespace addon { class CInstanceAudioDSP; }} | ||
| 91 | |||
| 92 | extern "C" { | ||
| 93 | |||
| 94 | typedef void* ADSPHANDLE; | ||
| 95 | |||
| 96 | typedef unsigned int AE_DSP_STREAM_ID; | ||
| 97 | |||
| 98 | /*! | ||
| 99 | * @brief Audio DSP add-on error codes | ||
| 100 | */ | ||
| 101 | typedef enum | ||
| 102 | { | ||
| 103 | AE_DSP_ERROR_NO_ERROR = 0, /*!< @brief no error occurred */ | ||
| 104 | AE_DSP_ERROR_UNKNOWN = -1, /*!< @brief an unknown error occurred */ | ||
| 105 | AE_DSP_ERROR_IGNORE_ME = -2, /*!< @brief the used input stream can not processed and add-on want to ignore */ | ||
| 106 | AE_DSP_ERROR_NOT_IMPLEMENTED = -3, /*!< @brief the method that KODI called is not implemented by the add-on */ | ||
| 107 | AE_DSP_ERROR_REJECTED = -4, /*!< @brief the command was rejected by the DSP */ | ||
| 108 | AE_DSP_ERROR_INVALID_PARAMETERS = -5, /*!< @brief the parameters of the method that was called are invalid for this operation */ | ||
| 109 | AE_DSP_ERROR_INVALID_SAMPLERATE = -6, /*!< @brief the processed samplerate is not supported */ | ||
| 110 | AE_DSP_ERROR_INVALID_IN_CHANNELS = -7, /*!< @brief the processed input channel format is not supported */ | ||
| 111 | AE_DSP_ERROR_INVALID_OUT_CHANNELS = -8, /*!< @brief the processed output channel format is not supported */ | ||
| 112 | AE_DSP_ERROR_FAILED = -9, /*!< @brief the command failed */ | ||
| 113 | } AE_DSP_ERROR; | ||
| 114 | |||
| 115 | /*! | ||
| 116 | * @brief The possible DSP channels (used as pointer inside arrays) | ||
| 117 | */ | ||
| 118 | typedef enum | ||
| 119 | { | ||
| 120 | AE_DSP_CH_INVALID = -1, | ||
| 121 | AE_DSP_CH_FL = 0, | ||
| 122 | AE_DSP_CH_FR, | ||
| 123 | AE_DSP_CH_FC, | ||
| 124 | AE_DSP_CH_LFE, | ||
| 125 | AE_DSP_CH_BL, | ||
| 126 | AE_DSP_CH_BR, | ||
| 127 | AE_DSP_CH_FLOC, | ||
| 128 | AE_DSP_CH_FROC, | ||
| 129 | AE_DSP_CH_BC, | ||
| 130 | AE_DSP_CH_SL, | ||
| 131 | AE_DSP_CH_SR, | ||
| 132 | AE_DSP_CH_TFL, | ||
| 133 | AE_DSP_CH_TFR, | ||
| 134 | AE_DSP_CH_TFC, | ||
| 135 | AE_DSP_CH_TC, | ||
| 136 | AE_DSP_CH_TBL, | ||
| 137 | AE_DSP_CH_TBR, | ||
| 138 | AE_DSP_CH_TBC, | ||
| 139 | AE_DSP_CH_BLOC, | ||
| 140 | AE_DSP_CH_BROC, | ||
| 141 | |||
| 142 | AE_DSP_CH_MAX | ||
| 143 | } AE_DSP_CHANNEL; | ||
| 144 | |||
| 145 | /*! | ||
| 146 | * @brief Present channel flags | ||
| 147 | */ | ||
| 148 | typedef enum | ||
| 149 | { | ||
| 150 | AE_DSP_PRSNT_CH_UNDEFINED = 0, | ||
| 151 | AE_DSP_PRSNT_CH_FL = 1<<AE_DSP_CH_FL, | ||
| 152 | AE_DSP_PRSNT_CH_FR = 1<<AE_DSP_CH_FR, | ||
| 153 | AE_DSP_PRSNT_CH_FC = 1<<AE_DSP_CH_FC, | ||
| 154 | AE_DSP_PRSNT_CH_LFE = 1<<AE_DSP_CH_LFE, | ||
| 155 | AE_DSP_PRSNT_CH_BL = 1<<AE_DSP_CH_BL, | ||
| 156 | AE_DSP_PRSNT_CH_BR = 1<<AE_DSP_CH_BR, | ||
| 157 | AE_DSP_PRSNT_CH_FLOC = 1<<AE_DSP_CH_FLOC, | ||
| 158 | AE_DSP_PRSNT_CH_FROC = 1<<AE_DSP_CH_FROC, | ||
| 159 | AE_DSP_PRSNT_CH_BC = 1<<AE_DSP_CH_BC, | ||
| 160 | AE_DSP_PRSNT_CH_SL = 1<<AE_DSP_CH_SL, | ||
| 161 | AE_DSP_PRSNT_CH_SR = 1<<AE_DSP_CH_SR, | ||
| 162 | AE_DSP_PRSNT_CH_TFL = 1<<AE_DSP_CH_TFL, | ||
| 163 | AE_DSP_PRSNT_CH_TFR = 1<<AE_DSP_CH_TFR, | ||
| 164 | AE_DSP_PRSNT_CH_TFC = 1<<AE_DSP_CH_TFC, | ||
| 165 | AE_DSP_PRSNT_CH_TC = 1<<AE_DSP_CH_TC, | ||
| 166 | AE_DSP_PRSNT_CH_TBL = 1<<AE_DSP_CH_TBL, | ||
| 167 | AE_DSP_PRSNT_CH_TBR = 1<<AE_DSP_CH_TBR, | ||
| 168 | AE_DSP_PRSNT_CH_TBC = 1<<AE_DSP_CH_TBC, | ||
| 169 | AE_DSP_PRSNT_CH_BLOC = 1<<AE_DSP_CH_BLOC, | ||
| 170 | AE_DSP_PRSNT_CH_BROC = 1<<AE_DSP_CH_BROC | ||
| 171 | } AE_DSP_CHANNEL_PRESENT; | ||
| 172 | |||
| 173 | /** | ||
| 174 | * @brief The various stream type formats | ||
| 175 | * Used for audio DSP processing to know input audio type | ||
| 176 | */ | ||
| 177 | typedef enum | ||
| 178 | { | ||
| 179 | AE_DSP_ASTREAM_INVALID = -1, | ||
| 180 | AE_DSP_ASTREAM_BASIC = 0, | ||
| 181 | AE_DSP_ASTREAM_MUSIC, | ||
| 182 | AE_DSP_ASTREAM_MOVIE, | ||
| 183 | AE_DSP_ASTREAM_GAME, | ||
| 184 | AE_DSP_ASTREAM_APP, | ||
| 185 | AE_DSP_ASTREAM_PHONE, | ||
| 186 | AE_DSP_ASTREAM_MESSAGE, | ||
| 187 | |||
| 188 | AE_DSP_ASTREAM_AUTO, | ||
| 189 | AE_DSP_ASTREAM_MAX | ||
| 190 | } AE_DSP_STREAMTYPE; | ||
| 191 | |||
| 192 | /*! | ||
| 193 | * @brief Add-ons supported audio stream type flags | ||
| 194 | * used on master mode information on AE_DSP_MODES to know | ||
| 195 | * on which audio stream the master mode is supported | ||
| 196 | */ | ||
| 197 | typedef enum | ||
| 198 | { | ||
| 199 | AE_DSP_PRSNT_ASTREAM_BASIC = 1<<AE_DSP_ASTREAM_BASIC, | ||
| 200 | AE_DSP_PRSNT_ASTREAM_MUSIC = 1<<AE_DSP_ASTREAM_MUSIC, | ||
| 201 | AE_DSP_PRSNT_ASTREAM_MOVIE = 1<<AE_DSP_ASTREAM_MOVIE, | ||
| 202 | AE_DSP_PRSNT_ASTREAM_GAME = 1<<AE_DSP_ASTREAM_GAME, | ||
| 203 | AE_DSP_PRSNT_ASTREAM_APP = 1<<AE_DSP_ASTREAM_APP, | ||
| 204 | AE_DSP_PRSNT_ASTREAM_PHONE = 1<<AE_DSP_ASTREAM_PHONE, | ||
| 205 | AE_DSP_PRSNT_ASTREAM_MESSAGE = 1<<AE_DSP_ASTREAM_MESSAGE, | ||
| 206 | } AE_DSP_ASTREAM_PRESENT; | ||
| 207 | |||
| 208 | /** | ||
| 209 | * @brief The various base type formats | ||
| 210 | * Used for audio DSP processing to know input audio source | ||
| 211 | */ | ||
| 212 | typedef enum | ||
| 213 | { | ||
| 214 | AE_DSP_ABASE_INVALID = -1, | ||
| 215 | AE_DSP_ABASE_STEREO = 0, | ||
| 216 | AE_DSP_ABASE_MONO, | ||
| 217 | AE_DSP_ABASE_MULTICHANNEL, | ||
| 218 | AE_DSP_ABASE_AC3, | ||
| 219 | AE_DSP_ABASE_EAC3, | ||
| 220 | AE_DSP_ABASE_DTS, | ||
| 221 | AE_DSP_ABASE_DTSHD_MA, | ||
| 222 | AE_DSP_ABASE_DTSHD_HRA, | ||
| 223 | AE_DSP_ABASE_TRUEHD, | ||
| 224 | AE_DSP_ABASE_MLP, | ||
| 225 | AE_DSP_ABASE_FLAC, | ||
| 226 | |||
| 227 | AE_DSP_ABASE_MAX | ||
| 228 | } AE_DSP_BASETYPE; | ||
| 229 | |||
| 230 | |||
| 231 | /** | ||
| 232 | * @brief The from KODI in settings requested audio process quality. | ||
| 233 | * The KODI internal used quality levels is translated to this values | ||
| 234 | * for usage on DSP processing add-ons. Is present on iQualityLevel | ||
| 235 | * inside AE_DSP_SETTINGS. | ||
| 236 | */ | ||
| 237 | typedef enum | ||
| 238 | { | ||
| 239 | AE_DSP_QUALITY_UNKNOWN = -1, /*!< @brief Unset, unknown or incorrect quality level */ | ||
| 240 | AE_DSP_QUALITY_DEFAULT = 0, /*!< @brief Engine's default quality level */ | ||
| 241 | |||
| 242 | /* Basic quality levels */ | ||
| 243 | AE_DSP_QUALITY_LOW = 20, /*!< @brief Low quality level */ | ||
| 244 | AE_DSP_QUALITY_MID = 30, /*!< @brief Standard quality level */ | ||
| 245 | AE_DSP_QUALITY_HIGH = 50, /*!< @brief Best sound processing quality */ | ||
| 246 | |||
| 247 | /* Optional quality levels */ | ||
| 248 | AE_DSP_QUALITY_REALLYHIGH = 100 /*!< @brief Uncompromising optional quality level, usually with unmeasurable and unnoticeable improvement */ | ||
| 249 | } AE_DSP_QUALITY; | ||
| 250 | |||
| 251 | /*! | ||
| 252 | * @brief Audio DSP menu hook categories. | ||
| 253 | * Used to identify on AE_DSP_MENUHOOK given add-on related skin dialog/windows. | ||
| 254 | * Except AE_DSP_MENUHOOK_ALL and AE_DSP_MENUHOOK_SETTING are the menus available | ||
| 255 | * from DSP playback dialogue which can be opened over KODI file context menu and over | ||
| 256 | * button on full screen OSD window. | ||
| 257 | * | ||
| 258 | * Menu hook AE_DSP_MENUHOOK_SETTING is available from DSP processing setup dialogue. | ||
| 259 | */ | ||
| 260 | typedef enum | ||
| 261 | { | ||
| 262 | AE_DSP_MENUHOOK_UNKNOWN =-1, /*!< @brief unknown menu hook */ | ||
| 263 | AE_DSP_MENUHOOK_ALL = 0, /*!< @brief all categories */ | ||
| 264 | AE_DSP_MENUHOOK_PRE_PROCESS = 1, /*!< @brief for pre processing */ | ||
| 265 | AE_DSP_MENUHOOK_MASTER_PROCESS = 2, /*!< @brief for master processing */ | ||
| 266 | AE_DSP_MENUHOOK_POST_PROCESS = 3, /*!< @brief for post processing */ | ||
| 267 | AE_DSP_MENUHOOK_RESAMPLE = 4, /*!< @brief for re sample */ | ||
| 268 | AE_DSP_MENUHOOK_MISCELLANEOUS = 5, /*!< @brief for miscellaneous dialogues */ | ||
| 269 | AE_DSP_MENUHOOK_INFORMATION = 6, /*!< @brief dialogue to show processing information */ | ||
| 270 | AE_DSP_MENUHOOK_SETTING = 7, /*!< @brief for settings */ | ||
| 271 | } AE_DSP_MENUHOOK_CAT; | ||
| 272 | |||
| 273 | /*! | ||
| 274 | * @brief Menu hooks that are available in the menus while playing a stream via this add-on. | ||
| 275 | */ | ||
| 276 | typedef struct AE_DSP_MENUHOOK | ||
| 277 | { | ||
| 278 | unsigned int iHookId; /*!< @brief (required) this hook's identifier */ | ||
| 279 | unsigned int iLocalizedStringId; /*!< @brief (required) the id of the label for this hook in g_localizeStrings */ | ||
| 280 | AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) category of menu hook */ | ||
| 281 | unsigned int iRelevantModeId; /*!< @brief (required) except category AE_DSP_MENUHOOK_SETTING and AE_DSP_MENUHOOK_ALL must be the related mode id present here */ | ||
| 282 | bool bNeedPlayback; /*!< @brief (required) set to true if menu hook need playback and active processing */ | ||
| 283 | } ATTRIBUTE_PACKED AE_DSP_MENUHOOK; | ||
| 284 | |||
| 285 | /*! | ||
| 286 | * @brief Audio DSP add-on capabilities. All capabilities are set to "false" as default. | ||
| 287 | * If a capability is set to true, then the corresponding methods from kodi_audiodsp_dll.h need to be implemented. | ||
| 288 | */ | ||
| 289 | typedef struct AE_DSP_ADDON_CAPABILITIES | ||
| 290 | { | ||
| 291 | bool bSupportsInputProcess; /*!< @brief true if this add-on provides audio input processing */ | ||
| 292 | bool bSupportsInputResample; /*!< @brief true if this add-on provides audio resample before master handling */ | ||
| 293 | bool bSupportsPreProcess; /*!< @brief true if this add-on provides audio pre processing */ | ||
| 294 | bool bSupportsMasterProcess; /*!< @brief true if this add-on provides audio master processing */ | ||
| 295 | bool bSupportsPostProcess; /*!< @brief true if this add-on provides audio post processing */ | ||
| 296 | bool bSupportsOutputResample; /*!< @brief true if this add-on provides audio re sample after master handling */ | ||
| 297 | } ATTRIBUTE_PACKED AE_DSP_ADDON_CAPABILITIES; | ||
| 298 | |||
| 299 | /*! | ||
| 300 | * @brief Audio processing settings for in and out arrays | ||
| 301 | * Send on creation and before first processed audio packet to add-on | ||
| 302 | */ | ||
| 303 | typedef struct AE_DSP_SETTINGS | ||
| 304 | { | ||
| 305 | AE_DSP_STREAM_ID iStreamID; /*!< @brief id of the audio stream packets */ | ||
| 306 | AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */ | ||
| 307 | int iInChannels; /*!< @brief the amount of input channels */ | ||
| 308 | unsigned long lInChannelPresentFlags; /*!< @brief the exact channel mapping flags of input */ | ||
| 309 | int iInFrames; /*!< @brief the input frame size from KODI */ | ||
| 310 | unsigned int iInSamplerate; /*!< @brief the basic sample rate of the audio packet */ | ||
| 311 | int iProcessFrames; /*!< @brief the processing frame size inside add-on's */ | ||
| 312 | unsigned int iProcessSamplerate; /*!< @brief the sample rate after input resample present in master processing */ | ||
| 313 | int iOutChannels; /*!< @brief the amount of output channels */ | ||
| 314 | unsigned long lOutChannelPresentFlags; /*!< @brief the exact channel mapping flags for output */ | ||
| 315 | int iOutFrames; /*!< @brief the final out frame size for KODI */ | ||
| 316 | unsigned int iOutSamplerate; /*!< @brief the final sample rate of the audio packet */ | ||
| 317 | bool bInputResamplingActive; /*!< @brief if a re-sampling is performed before master processing this flag is set to true */ | ||
| 318 | bool bStereoUpmix; /*!< @brief true if the stereo upmix setting on kodi is set */ | ||
| 319 | int iQualityLevel; /*!< @brief the from KODI selected quality level for signal processing */ | ||
| 320 | /*! | ||
| 321 | * @note about "iProcessSamplerate" and "iProcessFrames" is set from KODI after call of StreamCreate on input re sample add-on, if re-sampling | ||
| 322 | * and processing is handled inside the same add-on, this value must be ignored! | ||
| 323 | */ | ||
| 324 | } ATTRIBUTE_PACKED AE_DSP_SETTINGS; | ||
| 325 | |||
| 326 | /*! | ||
| 327 | * @brief Stream profile properties | ||
| 328 | * Can be used to detect best master processing mode and for post processing methods. | ||
| 329 | */ | ||
| 330 | //@{ | ||
| 331 | |||
| 332 | /*! | ||
| 333 | * @brief Dolby profile types. Given from several formats, e.g. Dolby Digital or TrueHD | ||
| 334 | * Used on AE_DSP_PROFILE_AC3_EAC3 and AE_DSP_PROFILE_MLP_TRUEHD | ||
| 335 | */ | ||
| 336 | #define AE_DSP_PROFILE_DOLBY_NONE 0 | ||
| 337 | #define AE_DSP_PROFILE_DOLBY_SURROUND 1 | ||
| 338 | #define AE_DSP_PROFILE_DOLBY_PLII 2 | ||
| 339 | #define AE_DSP_PROFILE_DOLBY_PLIIX 3 | ||
| 340 | #define AE_DSP_PROFILE_DOLBY_PLIIZ 4 | ||
| 341 | #define AE_DSP_PROFILE_DOLBY_EX 5 | ||
| 342 | #define AE_DSP_PROFILE_DOLBY_HEADPHONE 6 | ||
| 343 | |||
| 344 | /*! | ||
| 345 | * @brief DTS/DTS HD profile types | ||
| 346 | * Used on AE_DSP_PROFILE_DTS_DTSHD | ||
| 347 | */ | ||
| 348 | #define AE_DSP_PROFILE_DTS 0 | ||
| 349 | #define AE_DSP_PROFILE_DTS_ES 1 | ||
| 350 | #define AE_DSP_PROFILE_DTS_96_24 2 | ||
| 351 | #define AE_DSP_PROFILE_DTS_HD_HRA 3 | ||
| 352 | #define AE_DSP_PROFILE_DTS_HD_MA 4 | ||
| 353 | |||
| 354 | /*! | ||
| 355 | * @brief AC3/EAC3 based service types | ||
| 356 | * Used on AE_DSP_PROFILE_AC3_EAC3 | ||
| 357 | */ | ||
| 358 | #define AE_DSP_SERVICE_TYPE_MAIN 0 | ||
| 359 | #define AE_DSP_SERVICE_TYPE_EFFECTS 1 | ||
| 360 | #define AE_DSP_SERVICE_TYPE_VISUALLY_IMPAIRED 2 | ||
| 361 | #define AE_DSP_SERVICE_TYPE_HEARING_IMPAIRED 3 | ||
| 362 | #define AE_DSP_SERVICE_TYPE_DIALOGUE 4 | ||
| 363 | #define AE_DSP_SERVICE_TYPE_COMMENTARY 5 | ||
| 364 | #define AE_DSP_SERVICE_TYPE_EMERGENCY 6 | ||
| 365 | #define AE_DSP_SERVICE_TYPE_VOICE_OVER 7 | ||
| 366 | #define AE_DSP_SERVICE_TYPE_KARAOKE 8 | ||
| 367 | |||
| 368 | /*! | ||
| 369 | * @brief AC3/EAC3 based room types | ||
| 370 | * Present on AE_DSP_PROFILE_AC3_EAC3 and can be used for frequency corrections | ||
| 371 | * at post processing, e.g. THX Re-Equalization | ||
| 372 | */ | ||
| 373 | #define AE_DSP_ROOM_TYPE_UNDEFINED 0 | ||
| 374 | #define AE_DSP_ROOM_TYPE_SMALL 1 | ||
| 375 | #define AE_DSP_ROOM_TYPE_LARGE 2 | ||
| 376 | |||
| 377 | /*! | ||
| 378 | * @brief AC3/EAC3 stream profile properties | ||
| 379 | */ | ||
| 380 | //! @todo add handling for it (currently never becomes set) | ||
| 381 | typedef struct AE_DSP_PROFILE_AC3_EAC3 | ||
| 382 | { | ||
| 383 | unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */ | ||
| 384 | unsigned int iServiceType; /*!< defined by AE_DSP_SERVICE_TYPE_* */ | ||
| 385 | unsigned int iRoomType; /*!< defined by AE_DSP_ROOM_TYPE_* (NOTICE: Information about it currently not supported from ffmpeg and must be implemented) */ | ||
| 386 | } ATTRIBUTE_PACKED AE_DSP_PROFILE_AC3_EAC3; | ||
| 387 | |||
| 388 | /*! | ||
| 389 | * @brief MLP/Dolby TrueHD stream profile properties | ||
| 390 | */ | ||
| 391 | //! @todo add handling for it (currently never becomes set) | ||
| 392 | typedef struct AE_DSP_PROFILE_MLP_TRUEHD | ||
| 393 | { | ||
| 394 | unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */ | ||
| 395 | } ATTRIBUTE_PACKED AE_DSP_PROFILE_MLP_TRUEHD; | ||
| 396 | |||
| 397 | /*! | ||
| 398 | * @brief DTS/DTS HD stream profile properties | ||
| 399 | */ | ||
| 400 | //! @todo add handling for it (currently never becomes set) | ||
| 401 | typedef struct AE_DSP_PROFILE_DTS_DTSHD | ||
| 402 | { | ||
| 403 | unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DTS* */ | ||
| 404 | bool bSurroundMatrix; /*!< if set to true given 2.0 stream is surround encoded */ | ||
| 405 | } ATTRIBUTE_PACKED AE_DSP_PROFILE_DTS_DTSHD; | ||
| 406 | |||
| 407 | union AE_DSP_PROFILE | ||
| 408 | { | ||
| 409 | AE_DSP_PROFILE_AC3_EAC3 ac3_eac3; /*!< Dolby Digital/Digital+ profile data */ | ||
| 410 | AE_DSP_PROFILE_MLP_TRUEHD mlp_truehd; /*!< MLP or Dolby TrueHD profile data */ | ||
| 411 | AE_DSP_PROFILE_DTS_DTSHD dts_dtshd; /*!< DTS/DTS-HD profile data */ | ||
| 412 | }; | ||
| 413 | //@} | ||
| 414 | |||
| 415 | /*! | ||
| 416 | * @brief Audio DSP stream properties | ||
| 417 | * Used to check for the DSP add-on that the stream is supported, | ||
| 418 | * as example Dolby Digital Ex processing is only required on Dolby Digital with 5.1 layout | ||
| 419 | */ | ||
| 420 | typedef struct AE_DSP_STREAM_PROPERTIES | ||
| 421 | { | ||
| 422 | AE_DSP_STREAM_ID iStreamID; /*!< @brief stream id of the audio stream packets */ | ||
| 423 | AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */ | ||
| 424 | int iBaseType; /*!< @brief the input stream base type source eg, Dolby Digital */ | ||
| 425 | const char* strName; /*!< @brief the audio stream name */ | ||
| 426 | const char* strCodecId; /*!< @brief codec id string of the audio stream */ | ||
| 427 | const char* strLanguage; /*!< @brief language id of the audio stream */ | ||
| 428 | int iIdentifier; /*!< @brief audio stream id inside player */ | ||
| 429 | int iChannels; /*!< @brief amount of basic channels */ | ||
| 430 | int iSampleRate; /*!< @brief sample rate */ | ||
| 431 | AE_DSP_PROFILE Profile; /*!< @brief current running stream profile data */ | ||
| 432 | } ATTRIBUTE_PACKED AE_DSP_STREAM_PROPERTIES; | ||
| 433 | |||
| 434 | /*! | ||
| 435 | * @brief Audio DSP mode categories | ||
| 436 | */ | ||
| 437 | typedef enum | ||
| 438 | { | ||
| 439 | AE_DSP_MODE_TYPE_UNDEFINED = -1, /*!< @brief undefined type, never be used from add-on! */ | ||
| 440 | AE_DSP_MODE_TYPE_INPUT_RESAMPLE = 0, /*!< @brief for input re sample */ | ||
| 441 | AE_DSP_MODE_TYPE_PRE_PROCESS = 1, /*!< @brief for preprocessing */ | ||
| 442 | AE_DSP_MODE_TYPE_MASTER_PROCESS = 2, /*!< @brief for master processing */ | ||
| 443 | AE_DSP_MODE_TYPE_POST_PROCESS = 3, /*!< @brief for post processing */ | ||
| 444 | AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE = 4, /*!< @brief for output re sample */ | ||
| 445 | AE_DSP_MODE_TYPE_MAX = 5 | ||
| 446 | } AE_DSP_MODE_TYPE; | ||
| 447 | |||
| 448 | /*! | ||
| 449 | * @brief Audio DSP master mode information | ||
| 450 | * Used to get all available modes for current input stream | ||
| 451 | */ | ||
| 452 | typedef struct AE_DSP_MODES | ||
| 453 | { | ||
| 454 | unsigned int iModesCount; /*!< @brief (required) count of how much modes are in AE_DSP_MODES */ | ||
| 455 | struct AE_DSP_MODE | ||
| 456 | { | ||
| 457 | int iUniqueDBModeId; /*!< @brief (required) the inside add-on used identifier for the mode, set by KODI's audio DSP database */ | ||
| 458 | AE_DSP_MODE_TYPE iModeType; /*!< @brief (required) the processong mode type, see AE_DSP_MODE_TYPE */ | ||
| 459 | char strModeName[ADDON_STANDARD_STRING_LENGTH]; /*!< @brief (required) the addon name of the mode, used on KODI's logs */ | ||
| 460 | |||
| 461 | unsigned int iModeNumber; /*!< @brief (required) number of this mode on the add-on, is used on process functions with value "mode_id" */ | ||
| 462 | unsigned int iModeSupportTypeFlags; /*!< @brief (required) flags about supported input types for this mode, see AE_DSP_ASTREAM_PRESENT */ | ||
| 463 | bool bHasSettingsDialog; /*!< @brief (required) if setting dialog(s) are available it must be set to true */ | ||
| 464 | 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 */ | ||
| 465 | |||
| 466 | unsigned int iModeName; /*!< @brief (required) the name id of the mode for this hook in g_localizeStrings */ | ||
| 467 | unsigned int iModeSetupName; /*!< @brief (optional) the name id of the mode inside settings for this hook in g_localizeStrings */ | ||
| 468 | unsigned int iModeDescription; /*!< @brief (optional) the description id of the mode for this hook in g_localizeStrings */ | ||
| 469 | unsigned int iModeHelp; /*!< @brief (optional) help string id for inside DSP settings dialog of the mode for this hook in g_localizeStrings */ | ||
| 470 | |||
| 471 | char strOwnModeImage[ADDON_STANDARD_STRING_LENGTH]; /*!< @brief (optional) flag image for the mode */ | ||
| 472 | char strOverrideModeImage[ADDON_STANDARD_STRING_LENGTH];/*!< @brief (optional) image to override KODI Image for the mode, eg. Dolby Digital with Dolby Digital Ex (only used on master modes) */ | ||
| 473 | } mode[AE_DSP_STREAM_MAX_MODES]; /*!< @brief Modes array storage */ | ||
| 474 | } ATTRIBUTE_PACKED AE_DSP_MODES; | ||
| 475 | |||
| 476 | /*! | ||
| 477 | * @brief Audio DSP menu hook data | ||
| 478 | */ | ||
| 479 | typedef struct AE_DSP_MENUHOOK_DATA | ||
| 480 | { | ||
| 481 | AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) related menuhook data category */ | ||
| 482 | union data { | ||
| 483 | AE_DSP_STREAM_ID iStreamId; /*!< @brief currently only stream id is used, is used as union to have extension possibility */ | ||
| 484 | } data; /*!< @brief related category related data */ | ||
| 485 | } ATTRIBUTE_PACKED AE_DSP_MENUHOOK_DATA; | ||
| 486 | |||
| 487 | /*! | ||
| 488 | * @brief Properties passed to the Create() method of an add-on. | ||
| 489 | */ | ||
| 490 | typedef struct AddonProps_AudioDSP | ||
| 491 | { | ||
| 492 | const char* strUserPath; /*!< @brief path to the user profile */ | ||
| 493 | const char* strAddonPath; /*!< @brief path to this add-on */ | ||
| 494 | } AddonProps_AudioDSP; | ||
| 495 | |||
| 496 | typedef struct AddonToKodiFuncTable_AudioDSP | ||
| 497 | { | ||
| 498 | void* kodiInstance; | ||
| 499 | void (*add_menu_hook)(void* kodiInstance, AE_DSP_MENUHOOK *hook); | ||
| 500 | void (*remove_menu_hook)(void* kodiInstance, AE_DSP_MENUHOOK *hook); | ||
| 501 | void (*register_mode)(void* kodiInstance, AE_DSP_MODES::AE_DSP_MODE *mode); | ||
| 502 | void (*unregister_mode)(void* kodiInstance, AE_DSP_MODES::AE_DSP_MODE *mode); | ||
| 503 | } AddonToKodiFuncTable_AudioDSP; | ||
| 504 | |||
| 505 | struct AddonInstance_AudioDSP; | ||
| 506 | typedef struct KodiToAddonFuncTable_AudioDSP | ||
| 507 | { | ||
| 508 | kodi::addon::CInstanceAudioDSP* addonInstance; | ||
| 509 | void (__cdecl* get_capabilities)(AddonInstance_AudioDSP const* addonInstance, AE_DSP_ADDON_CAPABILITIES*); | ||
| 510 | const char* (__cdecl* get_dsp_name)(AddonInstance_AudioDSP const* addonInstance); | ||
| 511 | const char* (__cdecl* get_dsp_version)(AddonInstance_AudioDSP const* addonInstance); | ||
| 512 | AE_DSP_ERROR (__cdecl* menu_hook)(AddonInstance_AudioDSP const* addonInstance, const AE_DSP_MENUHOOK*, const AE_DSP_MENUHOOK_DATA*); | ||
| 513 | |||
| 514 | AE_DSP_ERROR (__cdecl* stream_create)(AddonInstance_AudioDSP const* addonInstance, const AE_DSP_SETTINGS*, const AE_DSP_STREAM_PROPERTIES*, ADDON_HANDLE); | ||
| 515 | AE_DSP_ERROR (__cdecl* stream_destroy)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE); | ||
| 516 | AE_DSP_ERROR (__cdecl* stream_is_mode_supported)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, AE_DSP_MODE_TYPE, unsigned int, int); | ||
| 517 | AE_DSP_ERROR (__cdecl* stream_initialize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const AE_DSP_SETTINGS*); | ||
| 518 | |||
| 519 | bool (__cdecl* input_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const float**, unsigned int); | ||
| 520 | |||
| 521 | unsigned int (__cdecl* input_resample_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE); | ||
| 522 | unsigned int (__cdecl* input_resample_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const float**, float**, unsigned int); | ||
| 523 | float (__cdecl* input_resample_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE); | ||
| 524 | int (__cdecl* input_resample_samplerate)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE); | ||
| 525 | |||
| 526 | unsigned int (__cdecl* pre_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int); | ||
| 527 | float (__cdecl* pre_process_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int); | ||
| 528 | unsigned int (__cdecl* pre_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int, const float**, float**, unsigned int); | ||
| 529 | |||
| 530 | AE_DSP_ERROR (__cdecl* master_process_set_mode)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, AE_DSP_STREAMTYPE, unsigned int, int); | ||
| 531 | unsigned int (__cdecl* master_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE); | ||
| 532 | float (__cdecl* master_process_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE); | ||
| 533 | int (__cdecl* master_process_get_out_channels)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned long*); | ||
| 534 | unsigned int (__cdecl* master_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const float**, float**, unsigned int); | ||
| 535 | const char* (__cdecl* master_process_get_stream_info_string)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE); | ||
| 536 | |||
| 537 | unsigned int (__cdecl* post_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int); | ||
| 538 | float (__cdecl* post_process_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int); | ||
| 539 | unsigned int (__cdecl* post_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int, const float**, float**, unsigned int); | ||
| 540 | |||
| 541 | unsigned int (__cdecl* output_resample_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE); | ||
| 542 | unsigned int (__cdecl* output_resample_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const float**, float**, unsigned int); | ||
| 543 | float (__cdecl* output_resample_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE); | ||
| 544 | int (__cdecl* output_resample_samplerate)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE); | ||
| 545 | } KodiToAddonFuncTable_AudioDSP; | ||
| 546 | |||
| 547 | typedef struct AddonInstance_AudioDSP | ||
| 548 | { | ||
| 549 | AddonProps_AudioDSP props; | ||
| 550 | AddonToKodiFuncTable_AudioDSP toKodi; | ||
| 551 | KodiToAddonFuncTable_AudioDSP toAddon; | ||
| 552 | } AddonInstance_AudioDSP; | ||
| 553 | |||
| 554 | } /* extern "C" */ | ||
| 555 | |||
| 556 | namespace kodi { | ||
| 557 | namespace addon { | ||
| 558 | |||
| 559 | class CInstanceAudioDSP : public IAddonInstance | ||
| 560 | { | ||
| 561 | public: | ||
| 562 | //========================================================================== | ||
| 563 | /// @brief Class constructor | ||
| 564 | /// | ||
| 565 | CInstanceAudioDSP() | ||
| 566 | : IAddonInstance(ADDON_INSTANCE_ADSP) | ||
| 567 | { | ||
| 568 | if (CAddonBase::m_interface->globalSingleInstance != nullptr) | ||
| 569 | throw std::logic_error("kodi::addon::CInstanceAudioDSP: Creation of more as one in single instance way is not allowed!"); | ||
| 570 | |||
| 571 | SetAddonStruct(CAddonBase::m_interface->firstKodiInstance); | ||
| 572 | CAddonBase::m_interface->globalSingleInstance = this; | ||
| 573 | } | ||
| 574 | //-------------------------------------------------------------------------- | ||
| 575 | |||
| 576 | //========================================================================== | ||
| 577 | /// @brief Class constructor | ||
| 578 | /// | ||
| 579 | /// @param[in] instance The from Kodi given instance given be | ||
| 580 | /// add-on CreateInstance call with instance | ||
| 581 | /// id ADDON_INSTANCE_ADSP. | ||
| 582 | /// | ||
| 583 | CInstanceAudioDSP(KODI_HANDLE instance) | ||
| 584 | : IAddonInstance(ADDON_INSTANCE_ADSP) | ||
| 585 | { | ||
| 586 | if (CAddonBase::m_interface->globalSingleInstance != nullptr) | ||
| 587 | throw std::logic_error("kodi::addon::CInstanceAudioDSP: Creation of multiple together with single instance way is not allowed!"); | ||
| 588 | |||
| 589 | SetAddonStruct(instance); | ||
| 590 | } | ||
| 591 | //-------------------------------------------------------------------------- | ||
| 592 | |||
| 593 | /*! @name Audio DSP add-on methods */ | ||
| 594 | //@{ | ||
| 595 | //========================================================================== | ||
| 596 | /// | ||
| 597 | /// @brief Get the list of features that this add-on provides. | ||
| 598 | /// Called by KODI to query the add-ons capabilities. | ||
| 599 | /// Used to check which options should be presented in the DSP, which methods | ||
| 600 | /// to call, etc. | ||
| 601 | /// All capabilities that the add-on supports should be set to true. | ||
| 602 | /// @param capabilities The add-ons capabilities. | ||
| 603 | /// @remarks Valid implementation required. | ||
| 604 | /// | ||
| 605 | virtual void GetCapabilities(AE_DSP_ADDON_CAPABILITIES& capabilities) = 0; | ||
| 606 | //-------------------------------------------------------------------------- | ||
| 607 | |||
| 608 | //========================================================================== | ||
| 609 | /// | ||
| 610 | /// @return The name reported by the back end that will be displayed in the | ||
| 611 | /// UI. | ||
| 612 | /// @remarks Valid implementation required. | ||
| 613 | /// | ||
| 614 | virtual std::string GetDSPName() = 0; | ||
| 615 | //-------------------------------------------------------------------------- | ||
| 616 | |||
| 617 | //========================================================================== | ||
| 618 | /// | ||
| 619 | /// @return The version string reported by the back end that will be displayed | ||
| 620 | /// in the UI. | ||
| 621 | /// @remarks Valid implementation required. | ||
| 622 | /// | ||
| 623 | virtual std::string GetDSPVersion() = 0; | ||
| 624 | //-------------------------------------------------------------------------- | ||
| 625 | |||
| 626 | //========================================================================== | ||
| 627 | /// | ||
| 628 | /// @brief Call one of the menu hooks (if supported). | ||
| 629 | /// Supported AE_DSP_MENUHOOK instances have to be added in ADDON_Create(), | ||
| 630 | /// by calling AddMenuHook() on the callback. | ||
| 631 | /// @param menuhook The hook to call. | ||
| 632 | /// @param item The selected item for which the hook was called. | ||
| 633 | /// @return AE_DSP_ERROR_NO_ERROR if the hook was called successfully. | ||
| 634 | /// @remarks Optional. Return AE_DSP_ERROR_NOT_IMPLEMENTED if this add-on | ||
| 635 | /// won't provide this function. | ||
| 636 | /// | ||
| 637 | virtual AE_DSP_ERROR MenuHook(const AE_DSP_MENUHOOK& menuhook, const AE_DSP_MENUHOOK_DATA& item) { return AE_DSP_ERROR_NOT_IMPLEMENTED; } | ||
| 638 | //-------------------------------------------------------------------------- | ||
| 639 | //@} | ||
| 640 | |||
| 641 | //========================================================================== | ||
| 642 | /// @name DSP processing control, used to open and close a stream | ||
| 643 | /// @remarks Valid implementation required. | ||
| 644 | /// | ||
| 645 | //@{ | ||
| 646 | /// | ||
| 647 | /// @brief Set up Audio DSP with selected audio settings (use the basic | ||
| 648 | /// present audio stream data format). | ||
| 649 | /// Used to detect available add-ons for present stream, as example stereo | ||
| 650 | /// surround upmix not needed on 5.1 audio stream. | ||
| 651 | /// @param addonSettings The add-ons audio settings. | ||
| 652 | /// @param properties The properties of the currently playing stream. | ||
| 653 | /// @param handle On this becomes addon informated about stream id and can set function addresses which need on calls | ||
| 654 | /// @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully | ||
| 655 | /// and data can be performed. AE_DSP_ERROR_IGNORE_ME if format is not | ||
| 656 | /// supported, but without fault. | ||
| 657 | /// @remarks Valid implementation required. | ||
| 658 | /// | ||
| 659 | virtual AE_DSP_ERROR StreamCreate(const AE_DSP_SETTINGS& addonSettings, const AE_DSP_STREAM_PROPERTIES& properties, ADDON_HANDLE handle) = 0; | ||
| 660 | //-------------------------------------------------------------------------- | ||
| 661 | |||
| 662 | //========================================================================== | ||
| 663 | /// | ||
| 664 | /// Remove the selected id from currently used DSP processes | ||
| 665 | /// @param handle identification data for stream | ||
| 666 | /// @return AE_DSP_ERROR_NO_ERROR if the becomes found and removed | ||
| 667 | /// @remarks Valid implementation required. | ||
| 668 | /// | ||
| 669 | virtual AE_DSP_ERROR StreamDestroy(const ADDON_HANDLE handle) = 0; | ||
| 670 | //-------------------------------------------------------------------------- | ||
| 671 | |||
| 672 | //========================================================================== | ||
| 673 | /// | ||
| 674 | /// @brief Ask the add-on about a requested processing mode that it is | ||
| 675 | /// supported on the current stream. Is called about every add-on mode after | ||
| 676 | /// successed StreamCreate. | ||
| 677 | /// @param handle identification data for stream | ||
| 678 | /// @param type The processing mode type, see AE_DSP_MODE_TYPE for definitions | ||
| 679 | /// @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 680 | /// is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 681 | /// RegisterMode callback, | ||
| 682 | /// @param unique_db_mode_id The Mode unique id generated from dsp database. | ||
| 683 | /// @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully | ||
| 684 | /// or if the stream is not supported the add-on must return | ||
| 685 | /// AE_DSP_ERROR_IGNORE_ME. | ||
| 686 | /// @remarks Valid implementation required. | ||
| 687 | /// | ||
| 688 | virtual AE_DSP_ERROR StreamIsModeSupported(const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int mode_id, int unique_db_mode_id) = 0; | ||
| 689 | //-------------------------------------------------------------------------- | ||
| 690 | |||
| 691 | //========================================================================== | ||
| 692 | /// | ||
| 693 | /// @brief Set up Audio DSP with selected audio settings (detected on data of | ||
| 694 | /// first present audio packet) | ||
| 695 | /// @param addonSettings The add-ons audio settings. | ||
| 696 | /// @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully. | ||
| 697 | /// @remarks Valid implementation required. | ||
| 698 | /// | ||
| 699 | virtual AE_DSP_ERROR StreamInitialize(const ADDON_HANDLE handle, const AE_DSP_SETTINGS& addonSettings) = 0; | ||
| 700 | //-------------------------------------------------------------------------- | ||
| 701 | |||
| 702 | //@} | ||
| 703 | |||
| 704 | /// @name DSP input processing | ||
| 705 | /// @remarks Only used by KODI if bSupportsInputProcess is set to true. | ||
| 706 | /// | ||
| 707 | //@{ | ||
| 708 | //========================================================================== | ||
| 709 | /// | ||
| 710 | /// @brief DSP input processing | ||
| 711 | /// Can be used to have unchanged stream.. | ||
| 712 | /// All DSP add-ons allowed to-do this. | ||
| 713 | /// @param handle identification data for stream | ||
| 714 | /// @param array_in Pointer to data memory | ||
| 715 | /// @param samples Amount of samples inside array_in | ||
| 716 | /// @return true if work was OK | ||
| 717 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 718 | /// GetCapabilities | ||
| 719 | /// | ||
| 720 | virtual bool InputProcess(const ADDON_HANDLE handle, const float** array_in, unsigned int samples) { return true; } | ||
| 721 | //-------------------------------------------------------------------------- | ||
| 722 | //@} | ||
| 723 | |||
| 724 | /// @name DSP pre-resampling | ||
| 725 | /// @remarks Only used by KODI if bSupportsInputResample is set to true. | ||
| 726 | /// | ||
| 727 | //@{ | ||
| 728 | //========================================================================== | ||
| 729 | /// | ||
| 730 | /// @brief If the add-on operate with buffered arrays and the output size can | ||
| 731 | /// be higher as the input it becomes asked about needed size before any | ||
| 732 | /// InputResampleProcess call. | ||
| 733 | /// @param handle identification data for stream | ||
| 734 | /// @return The needed size of output array or 0 if no changes within it | ||
| 735 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 736 | /// GetCapabilities | ||
| 737 | /// | ||
| 738 | virtual unsigned int InputResampleProcessNeededSamplesize(const ADDON_HANDLE handle) { return 0; } | ||
| 739 | //-------------------------------------------------------------------------- | ||
| 740 | |||
| 741 | //========================================================================== | ||
| 742 | /// | ||
| 743 | /// @brief DSP re sample processing before master. | ||
| 744 | /// Here a high quality resample can be performed. | ||
| 745 | /// Only one DSP add-on is allowed to-do this! | ||
| 746 | /// @param handle identification data for stream | ||
| 747 | /// @param array_in Pointer to input data memory | ||
| 748 | /// @param array_out Pointer to output data memory | ||
| 749 | /// @param samples Amount of samples inside array_in | ||
| 750 | /// @return Amount of samples processed | ||
| 751 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 752 | /// GetCapabilities | ||
| 753 | /// | ||
| 754 | virtual unsigned int InputResampleProcess(const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) { return 0; } | ||
| 755 | //-------------------------------------------------------------------------- | ||
| 756 | |||
| 757 | //========================================================================== | ||
| 758 | /// | ||
| 759 | /// @brief Returns the re-sampling generated new sample rate used before the | ||
| 760 | /// master process | ||
| 761 | /// @param handle identification data for stream | ||
| 762 | /// @return The new sample rate | ||
| 763 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 764 | /// GetCapabilities | ||
| 765 | /// | ||
| 766 | virtual int InputResampleSampleRate(const ADDON_HANDLE handle) { return 0; } | ||
| 767 | //-------------------------------------------------------------------------- | ||
| 768 | |||
| 769 | //========================================================================== | ||
| 770 | /// | ||
| 771 | /// @brief Returns the time in seconds that it will take | ||
| 772 | /// for the next added packet to be returned to KODI. | ||
| 773 | /// @param handle identification data for stream | ||
| 774 | /// @return the delay in seconds | ||
| 775 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 776 | /// GetCapabilities | ||
| 777 | /// | ||
| 778 | virtual float InputResampleGetDelay(const ADDON_HANDLE handle) { return 0.0f; } | ||
| 779 | //-------------------------------------------------------------------------- | ||
| 780 | //@} | ||
| 781 | |||
| 782 | /** @name DSP Pre processing | ||
| 783 | * @remarks Only used by KODI if bSupportsPreProcess is set to true. | ||
| 784 | */ | ||
| 785 | //@{ | ||
| 786 | //========================================================================== | ||
| 787 | /// | ||
| 788 | /// @brief If the addon operate with buffered arrays and the output size can | ||
| 789 | /// be higher as the input it becomes asked about needed size before any | ||
| 790 | /// PreProcess call. | ||
| 791 | /// @param handle identification data for stream | ||
| 792 | /// @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 793 | /// is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 794 | /// RegisterMode callback and can be defined from add-on as a structure | ||
| 795 | /// pointer or anything else what is needed to find it. | ||
| 796 | /// @return The needed size of output array or 0 if no changes within it | ||
| 797 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 798 | /// GetCapabilities | ||
| 799 | /// | ||
| 800 | virtual unsigned int PreProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id) { return 0; } | ||
| 801 | //-------------------------------------------------------------------------- | ||
| 802 | |||
| 803 | //========================================================================== | ||
| 804 | /// | ||
| 805 | /// @brief Returns the time in seconds that it will take | ||
| 806 | /// for the next added packet to be returned to KODI. | ||
| 807 | /// @param handle identification data for stream | ||
| 808 | /// @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 809 | /// is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 810 | /// RegisterMode callback and can be defined from add-on as a structure | ||
| 811 | /// pointer or anything else what is needed to find it. | ||
| 812 | /// @return the delay in seconds | ||
| 813 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 814 | /// GetCapabilities | ||
| 815 | /// | ||
| 816 | virtual float PreProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id) { return 0.0f; } | ||
| 817 | //-------------------------------------------------------------------------- | ||
| 818 | |||
| 819 | //========================================================================== | ||
| 820 | /// | ||
| 821 | /// @brief DSP preprocessing | ||
| 822 | /// All DSP add-ons allowed to-do this. | ||
| 823 | /// @param handle identification data for stream | ||
| 824 | /// @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 825 | /// is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 826 | /// RegisterMode callback and can be defined from add-on as a structure | ||
| 827 | /// pointer or anything else what is needed to find it. | ||
| 828 | /// @param array_in Pointer to input data memory | ||
| 829 | /// @param array_out Pointer to output data memory | ||
| 830 | /// @param samples Amount of samples inside array_in | ||
| 831 | /// @return Amount of samples processed | ||
| 832 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 833 | /// GetCapabilities | ||
| 834 | /// | ||
| 835 | virtual unsigned int PreProcess(const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples) { return 0; } | ||
| 836 | //-------------------------------------------------------------------------- | ||
| 837 | //@} | ||
| 838 | |||
| 839 | /** @name DSP Master processing | ||
| 840 | * @remarks Only used by KODI if bSupportsMasterProcess is set to true. | ||
| 841 | */ | ||
| 842 | //@{ | ||
| 843 | //========================================================================== | ||
| 844 | /// | ||
| 845 | /// @brief Set the active master process mode | ||
| 846 | /// @param handle identification data for stream | ||
| 847 | /// @param type Requested stream type for the selected master mode | ||
| 848 | /// @param mode_id The Mode identifier. | ||
| 849 | /// @param unique_db_mode_id The Mode unique id generated from DSP database. | ||
| 850 | /// @return AE_DSP_ERROR_NO_ERROR if the setup was successful | ||
| 851 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 852 | /// GetCapabilities | ||
| 853 | /// | ||
| 854 | virtual AE_DSP_ERROR MasterProcessSetMode(const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id) { return AE_DSP_ERROR_NOT_IMPLEMENTED; } | ||
| 855 | //-------------------------------------------------------------------------- | ||
| 856 | |||
| 857 | //========================================================================== | ||
| 858 | /// | ||
| 859 | /// @brief If the add-on operate with buffered arrays and the output size can | ||
| 860 | /// be higher as the input it becomes asked about needed size before any | ||
| 861 | /// MasterProcess call. | ||
| 862 | /// @param handle identification data for stream | ||
| 863 | /// @return The needed size of output array or 0 if no changes within it | ||
| 864 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 865 | /// GetCapabilities | ||
| 866 | /// | ||
| 867 | virtual unsigned int MasterProcessNeededSamplesize(const ADDON_HANDLE handle) { return 0; } | ||
| 868 | //-------------------------------------------------------------------------- | ||
| 869 | |||
| 870 | //========================================================================== | ||
| 871 | /// | ||
| 872 | /// @brief Returns the time in seconds that it will take | ||
| 873 | /// for the next added packet to be returned to KODI. | ||
| 874 | /// @param handle identification data for stream | ||
| 875 | /// @return the delay in seconds | ||
| 876 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 877 | /// GetCapabilities | ||
| 878 | /// | ||
| 879 | virtual float MasterProcessGetDelay(const ADDON_HANDLE handle) { return 0.0f; } | ||
| 880 | //-------------------------------------------------------------------------- | ||
| 881 | |||
| 882 | //========================================================================== | ||
| 883 | /// | ||
| 884 | /// @brief Returns the from selected master mode performed channel alignment | ||
| 885 | /// @param handle identification data for stream | ||
| 886 | /// @retval out_channel_present_flags the exact channel present flags after | ||
| 887 | /// performed up-/downmix | ||
| 888 | /// @return the amount channels | ||
| 889 | /// @remarks Optional. Must be used and set if a channel up- or downmix is | ||
| 890 | /// processed from the active master mode | ||
| 891 | /// | ||
| 892 | virtual int MasterProcessGetOutChannels(const ADDON_HANDLE handle, unsigned long& out_channel_present_flags) { return 0; } | ||
| 893 | //-------------------------------------------------------------------------- | ||
| 894 | |||
| 895 | //========================================================================== | ||
| 896 | /// | ||
| 897 | /// @brief Master processing becomes performed with it | ||
| 898 | /// Here a channel up-mix/down-mix for stereo surround sound can be performed | ||
| 899 | /// Only one DSP add-on is allowed to-do this! | ||
| 900 | /// @param handle identification data for stream | ||
| 901 | /// @param array_in Pointer to input data memory | ||
| 902 | /// @param array_out Pointer to output data memory | ||
| 903 | /// @param samples Amount of samples inside array_in | ||
| 904 | /// @return Amount of samples processed | ||
| 905 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 906 | /// GetCapabilities | ||
| 907 | /// | ||
| 908 | virtual unsigned int MasterProcess(const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) { return 0; } | ||
| 909 | //-------------------------------------------------------------------------- | ||
| 910 | |||
| 911 | //========================================================================== | ||
| 912 | /// | ||
| 913 | /// Used to get a information string about the processed work to show on skin | ||
| 914 | /// @return A string to show | ||
| 915 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 916 | /// GetCapabilities | ||
| 917 | /// | ||
| 918 | virtual std::string MasterProcessGetStreamInfoString(const ADDON_HANDLE handle) { return ""; } | ||
| 919 | //-------------------------------------------------------------------------- | ||
| 920 | //@} | ||
| 921 | |||
| 922 | /** @name DSP Post processing | ||
| 923 | * @remarks Only used by KODI if bSupportsPostProcess is set to true. | ||
| 924 | */ | ||
| 925 | //@{ | ||
| 926 | //========================================================================== | ||
| 927 | /// | ||
| 928 | /// If the add-on operate with buffered arrays and the output size can be | ||
| 929 | /// higher as the input it becomes asked about needed size before any | ||
| 930 | /// PostProcess call. | ||
| 931 | /// @param handle identification data for stream | ||
| 932 | /// @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 933 | /// is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 934 | /// RegisterMode callback, and can be defined from add-on as a structure | ||
| 935 | /// pointer or anything else what is needed to find it. | ||
| 936 | /// @return The needed size of output array or 0 if no changes within it | ||
| 937 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 938 | /// GetCapabilities | ||
| 939 | /// | ||
| 940 | virtual unsigned int PostProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id) { return 0; } | ||
| 941 | //-------------------------------------------------------------------------- | ||
| 942 | |||
| 943 | //========================================================================== | ||
| 944 | /// | ||
| 945 | /// Returns the time in seconds that it will take | ||
| 946 | /// for the next added packet to be returned to KODI. | ||
| 947 | /// @param handle identification data for stream | ||
| 948 | /// @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 949 | /// is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 950 | /// RegisterMode callback, and can be defined from add-on as a structure | ||
| 951 | /// pointer or anything else what is needed to find it. | ||
| 952 | /// @return the delay in seconds | ||
| 953 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 954 | /// GetCapabilities | ||
| 955 | /// | ||
| 956 | virtual float PostProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id) { return 0.0f; } | ||
| 957 | //-------------------------------------------------------------------------- | ||
| 958 | |||
| 959 | //========================================================================== | ||
| 960 | |||
| 961 | /// | ||
| 962 | /// @brief DSP post processing | ||
| 963 | /// On the post processing can be things performed with additional channel | ||
| 964 | /// upmix like 6.1 to 7.1 | ||
| 965 | /// or frequency/volume corrections, speaker distance handling, equalizer... . | ||
| 966 | /// All DSP add-ons allowed to-do this. | ||
| 967 | /// @param handle identification data for stream | ||
| 968 | /// @param mode_id The mode inside add-on which must be performed on call. Id | ||
| 969 | /// is set from add-on by iModeNumber on AE_DSP_MODE structure during | ||
| 970 | /// RegisterMode callback, and can be defined from add-on as a structure | ||
| 971 | /// pointer or anything else what is needed to find it. | ||
| 972 | /// @param array_in Pointer to input data memory | ||
| 973 | /// @param array_out Pointer to output data memory | ||
| 974 | /// @param samples Amount of samples inside array_in | ||
| 975 | /// @return Amount of samples processed | ||
| 976 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 977 | /// GetCapabilities | ||
| 978 | /// | ||
| 979 | virtual unsigned int PostProcess(const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples) { return 0; } | ||
| 980 | |||
| 981 | //-------------------------------------------------------------------------- | ||
| 982 | //@} | ||
| 983 | |||
| 984 | /** @name DSP Post re-sampling | ||
| 985 | * @remarks Only used by KODI if bSupportsOutputResample is set to true. | ||
| 986 | */ | ||
| 987 | //@{ | ||
| 988 | //========================================================================== | ||
| 989 | /// | ||
| 990 | /// @brief If the add-on operate with buffered arrays and the output size | ||
| 991 | /// can be higher as the input | ||
| 992 | /// it becomes asked about needed size before any OutputResampleProcess call. | ||
| 993 | /// @param handle identification data for stream | ||
| 994 | /// @return The needed size of output array or 0 if no changes within it | ||
| 995 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 996 | /// GetCapabilities | ||
| 997 | /// | ||
| 998 | virtual unsigned int OutputResampleProcessNeededSamplesize(const ADDON_HANDLE handle) { return 0; } | ||
| 999 | //-------------------------------------------------------------------------- | ||
| 1000 | |||
| 1001 | //========================================================================== | ||
| 1002 | /// | ||
| 1003 | /// @brief Re-sampling after master processing becomes performed with it if | ||
| 1004 | /// needed, only | ||
| 1005 | /// one add-on can perform it. | ||
| 1006 | /// @param handle identification data for stream | ||
| 1007 | /// @param array_in Pointer to input data memory | ||
| 1008 | /// @param array_out Pointer to output data memory | ||
| 1009 | /// @param samples Amount of samples inside array_in | ||
| 1010 | /// @return Amount of samples processed | ||
| 1011 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 1012 | /// GetCapabilities | ||
| 1013 | /// | ||
| 1014 | virtual unsigned int OutputResampleProcess(const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) { return 0; } | ||
| 1015 | //-------------------------------------------------------------------------- | ||
| 1016 | |||
| 1017 | //========================================================================== | ||
| 1018 | /// | ||
| 1019 | /// @brief Returns the re-sampling generated new sample rate used after the | ||
| 1020 | /// master process. | ||
| 1021 | /// @param handle identification data for stream | ||
| 1022 | /// @return The new sample rate | ||
| 1023 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 1024 | /// GetCapabilities | ||
| 1025 | /// | ||
| 1026 | virtual int OutputResampleSampleRate(const ADDON_HANDLE handle) { return 0; } | ||
| 1027 | //-------------------------------------------------------------------------- | ||
| 1028 | |||
| 1029 | //========================================================================== | ||
| 1030 | /// | ||
| 1031 | /// @brief Returns the time in seconds that it will take for the next added | ||
| 1032 | /// packet to be returned to KODI. | ||
| 1033 | /// @param handle identification data for stream | ||
| 1034 | /// @return the delay in seconds | ||
| 1035 | /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with | ||
| 1036 | /// GetCapabilities | ||
| 1037 | /// | ||
| 1038 | virtual float OutputResampleGetDelay(const ADDON_HANDLE handle) { return 0.0f; } | ||
| 1039 | //-------------------------------------------------------------------------- | ||
| 1040 | //@} | ||
| 1041 | |||
| 1042 | //========================================================================== | ||
| 1043 | /// | ||
| 1044 | /// @brief Add or replace a menu hook for the context menu for this add-on | ||
| 1045 | /// @param hook The hook to add | ||
| 1046 | /// | ||
| 1047 | void AddMenuHook(AE_DSP_MENUHOOK* hook) | ||
| 1048 | { | ||
| 1049 | return m_instanceData->toKodi.add_menu_hook(m_instanceData->toKodi.kodiInstance, hook); | ||
| 1050 | } | ||
| 1051 | //-------------------------------------------------------------------------- | ||
| 1052 | |||
| 1053 | //========================================================================== | ||
| 1054 | /// | ||
| 1055 | /// @brief Remove a menu hook for the context menu for this add-on | ||
| 1056 | /// @param hook The hook to remove | ||
| 1057 | /// | ||
| 1058 | void RemoveMenuHook(AE_DSP_MENUHOOK* hook) | ||
| 1059 | { | ||
| 1060 | return m_instanceData->toKodi.remove_menu_hook(m_instanceData->toKodi.kodiInstance, hook); | ||
| 1061 | } | ||
| 1062 | //-------------------------------------------------------------------------- | ||
| 1063 | |||
| 1064 | //========================================================================== | ||
| 1065 | /// | ||
| 1066 | /// @brief Add or replace master mode information inside audio dsp database. | ||
| 1067 | /// Becomes identifier written inside mode to iModeID if it was 0 (undefined) | ||
| 1068 | /// @param mode The master mode to add or update inside database | ||
| 1069 | /// | ||
| 1070 | void RegisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) | ||
| 1071 | { | ||
| 1072 | return m_instanceData->toKodi.register_mode(m_instanceData->toKodi.kodiInstance, mode); | ||
| 1073 | } | ||
| 1074 | //-------------------------------------------------------------------------- | ||
| 1075 | |||
| 1076 | //========================================================================== | ||
| 1077 | /// | ||
| 1078 | /// @brief Remove a master mode from audio dsp database | ||
| 1079 | /// @param mode The Mode to remove | ||
| 1080 | /// | ||
| 1081 | void UnregisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) | ||
| 1082 | { | ||
| 1083 | return m_instanceData->toKodi.unregister_mode(m_instanceData->toKodi.kodiInstance, mode); | ||
| 1084 | } | ||
| 1085 | //-------------------------------------------------------------------------- | ||
| 1086 | |||
| 1087 | private: | ||
| 1088 | void SetAddonStruct(KODI_HANDLE instance) | ||
| 1089 | { | ||
| 1090 | if (instance == nullptr) | ||
| 1091 | throw std::logic_error("kodi::addon::CInstanceAudioDSP: Null pointer instance passed."); | ||
| 1092 | |||
| 1093 | m_instanceData = static_cast<AddonInstance_AudioDSP*>(instance); | ||
| 1094 | |||
| 1095 | m_instanceData->toAddon.get_capabilities = ADDON_GetCapabilities; | ||
| 1096 | m_instanceData->toAddon.get_dsp_name = ADDON_GetDSPName; | ||
| 1097 | m_instanceData->toAddon.get_dsp_version = ADDON_GetDSPVersion; | ||
| 1098 | m_instanceData->toAddon.menu_hook = ADDON_MenuHook; | ||
| 1099 | |||
| 1100 | m_instanceData->toAddon.stream_create = ADDON_StreamCreate; | ||
| 1101 | m_instanceData->toAddon.stream_destroy = ADDON_StreamDestroy; | ||
| 1102 | m_instanceData->toAddon.stream_is_mode_supported = ADDON_StreamIsModeSupported; | ||
| 1103 | m_instanceData->toAddon.stream_initialize = ADDON_StreamInitialize; | ||
| 1104 | |||
| 1105 | m_instanceData->toAddon.input_process = ADDON_InputProcess; | ||
| 1106 | |||
| 1107 | m_instanceData->toAddon.input_resample_process_needed_samplesize = ADDON_InputResampleProcessNeededSamplesize; | ||
| 1108 | m_instanceData->toAddon.input_resample_process = ADDON_InputResampleProcess; | ||
| 1109 | m_instanceData->toAddon.input_resample_get_delay = ADDON_InputResampleGetDelay; | ||
| 1110 | m_instanceData->toAddon.input_resample_samplerate = ADDON_InputResampleSampleRate; | ||
| 1111 | |||
| 1112 | m_instanceData->toAddon.pre_process_needed_samplesize = ADDON_PreProcessNeededSamplesize; | ||
| 1113 | m_instanceData->toAddon.pre_process_get_delay = ADDON_PreProcessGetDelay; | ||
| 1114 | m_instanceData->toAddon.pre_process = ADDON_PreProcess; | ||
| 1115 | |||
| 1116 | m_instanceData->toAddon.master_process_set_mode = ADDON_MasterProcessSetMode; | ||
| 1117 | m_instanceData->toAddon.master_process_needed_samplesize = ADDON_MasterProcessNeededSamplesize; | ||
| 1118 | m_instanceData->toAddon.master_process_get_delay = ADDON_MasterProcessGetDelay; | ||
| 1119 | m_instanceData->toAddon.master_process_get_out_channels = ADDON_MasterProcessGetOutChannels; | ||
| 1120 | m_instanceData->toAddon.master_process = ADDON_MasterProcess; | ||
| 1121 | m_instanceData->toAddon.master_process_get_stream_info_string = ADDON_MasterProcessGetStreamInfoString; | ||
| 1122 | |||
| 1123 | m_instanceData->toAddon.post_process_needed_samplesize = ADDON_PostProcessNeededSamplesize; | ||
| 1124 | m_instanceData->toAddon.post_process_get_delay = ADDON_PostProcessGetDelay; | ||
| 1125 | m_instanceData->toAddon.post_process = ADDON_PostProcess; | ||
| 1126 | |||
| 1127 | m_instanceData->toAddon.output_resample_process_needed_samplesize = ADDON_OutputResampleProcessNeededSamplesize; | ||
| 1128 | m_instanceData->toAddon.output_resample_process = ADDON_OutputResampleProcess; | ||
| 1129 | m_instanceData->toAddon.output_resample_get_delay = ADDON_OutputResampleGetDelay; | ||
| 1130 | m_instanceData->toAddon.output_resample_samplerate = ADDON_OutputResampleSampleRate; | ||
| 1131 | } | ||
| 1132 | |||
| 1133 | static inline void ADDON_GetCapabilities(AddonInstance_AudioDSP const* instance, AE_DSP_ADDON_CAPABILITIES *capabilities) | ||
| 1134 | { | ||
| 1135 | instance->toAddon.addonInstance->GetCapabilities(*capabilities); | ||
| 1136 | } | ||
| 1137 | |||
| 1138 | static inline const char* ADDON_GetDSPName(AddonInstance_AudioDSP const* instance) | ||
| 1139 | { | ||
| 1140 | instance->toAddon.addonInstance->m_dspName = instance->toAddon.addonInstance->GetDSPName(); | ||
| 1141 | return instance->toAddon.addonInstance->m_dspName.c_str(); | ||
| 1142 | } | ||
| 1143 | |||
| 1144 | static inline const char* ADDON_GetDSPVersion(AddonInstance_AudioDSP const* instance) | ||
| 1145 | { | ||
| 1146 | instance->toAddon.addonInstance->m_dspVersion = instance->toAddon.addonInstance->GetDSPVersion(); | ||
| 1147 | return instance->toAddon.addonInstance->m_dspVersion.c_str(); | ||
| 1148 | } | ||
| 1149 | |||
| 1150 | static inline AE_DSP_ERROR ADDON_MenuHook(AddonInstance_AudioDSP const* instance, const AE_DSP_MENUHOOK* menuhook, const AE_DSP_MENUHOOK_DATA* item) | ||
| 1151 | { | ||
| 1152 | return instance->toAddon.addonInstance->MenuHook(*menuhook, *item); | ||
| 1153 | } | ||
| 1154 | |||
| 1155 | static inline AE_DSP_ERROR ADDON_StreamCreate(AddonInstance_AudioDSP const* instance, const AE_DSP_SETTINGS *addonSettings, const AE_DSP_STREAM_PROPERTIES* properties, ADDON_HANDLE handle) | ||
| 1156 | { | ||
| 1157 | return instance->toAddon.addonInstance->StreamCreate(*addonSettings, *properties, handle); | ||
| 1158 | } | ||
| 1159 | |||
| 1160 | static inline AE_DSP_ERROR ADDON_StreamDestroy(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) | ||
| 1161 | { | ||
| 1162 | return instance->toAddon.addonInstance->StreamDestroy(handle); | ||
| 1163 | } | ||
| 1164 | |||
| 1165 | static inline AE_DSP_ERROR ADDON_StreamIsModeSupported(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int mode_id, int unique_db_mode_id) | ||
| 1166 | { | ||
| 1167 | return instance->toAddon.addonInstance->StreamIsModeSupported(handle, type, mode_id, unique_db_mode_id); | ||
| 1168 | } | ||
| 1169 | |||
| 1170 | static inline AE_DSP_ERROR ADDON_StreamInitialize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const AE_DSP_SETTINGS *addonSettings) | ||
| 1171 | { | ||
| 1172 | return instance->toAddon.addonInstance->StreamInitialize(handle, *addonSettings); | ||
| 1173 | } | ||
| 1174 | |||
| 1175 | static inline bool ADDON_InputProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, unsigned int samples) | ||
| 1176 | { | ||
| 1177 | return instance->toAddon.addonInstance->InputProcess(handle, array_in, samples); | ||
| 1178 | } | ||
| 1179 | |||
| 1180 | static inline unsigned int ADDON_InputResampleProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) | ||
| 1181 | { | ||
| 1182 | return instance->toAddon.addonInstance->InputResampleProcessNeededSamplesize(handle); | ||
| 1183 | } | ||
| 1184 | |||
| 1185 | static inline unsigned int ADDON_InputResampleProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) | ||
| 1186 | { | ||
| 1187 | return instance->toAddon.addonInstance->InputResampleProcess(handle, array_in, array_out, samples); | ||
| 1188 | } | ||
| 1189 | |||
| 1190 | static inline int ADDON_InputResampleSampleRate(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) | ||
| 1191 | { | ||
| 1192 | return instance->toAddon.addonInstance->InputResampleSampleRate(handle); | ||
| 1193 | } | ||
| 1194 | |||
| 1195 | static inline float ADDON_InputResampleGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) | ||
| 1196 | { | ||
| 1197 | return instance->toAddon.addonInstance->InputResampleGetDelay(handle); | ||
| 1198 | } | ||
| 1199 | |||
| 1200 | static inline unsigned int ADDON_PreProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id) | ||
| 1201 | { | ||
| 1202 | return instance->toAddon.addonInstance->PreProcessNeededSamplesize(handle, mode_id); | ||
| 1203 | } | ||
| 1204 | |||
| 1205 | static inline float ADDON_PreProcessGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id) | ||
| 1206 | { | ||
| 1207 | return instance->toAddon.addonInstance->PreProcessGetDelay(handle, mode_id); | ||
| 1208 | } | ||
| 1209 | |||
| 1210 | static inline unsigned int ADDON_PreProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples) | ||
| 1211 | { | ||
| 1212 | return instance->toAddon.addonInstance->PreProcess(handle, mode_id, array_in, array_out, samples); | ||
| 1213 | } | ||
| 1214 | |||
| 1215 | static inline AE_DSP_ERROR ADDON_MasterProcessSetMode(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id) | ||
| 1216 | { | ||
| 1217 | return instance->toAddon.addonInstance->MasterProcessSetMode(handle, type, mode_id, unique_db_mode_id); | ||
| 1218 | } | ||
| 1219 | |||
| 1220 | static inline unsigned int ADDON_MasterProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) | ||
| 1221 | { | ||
| 1222 | return instance->toAddon.addonInstance->MasterProcessNeededSamplesize(handle); | ||
| 1223 | } | ||
| 1224 | |||
| 1225 | static inline float ADDON_MasterProcessGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) | ||
| 1226 | { | ||
| 1227 | return instance->toAddon.addonInstance->MasterProcessGetDelay(handle); | ||
| 1228 | } | ||
| 1229 | |||
| 1230 | static inline int ADDON_MasterProcessGetOutChannels(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned long* out_channel_present_flags) | ||
| 1231 | { | ||
| 1232 | return instance->toAddon.addonInstance->MasterProcessGetOutChannels(handle, *out_channel_present_flags); | ||
| 1233 | } | ||
| 1234 | |||
| 1235 | static inline unsigned int ADDON_MasterProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) | ||
| 1236 | { | ||
| 1237 | return instance->toAddon.addonInstance->MasterProcess(handle, array_in, array_out, samples); | ||
| 1238 | } | ||
| 1239 | |||
| 1240 | static inline const char* ADDON_MasterProcessGetStreamInfoString(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) | ||
| 1241 | { | ||
| 1242 | instance->toAddon.addonInstance->m_streamInfoString = instance->toAddon.addonInstance->MasterProcessGetStreamInfoString(handle); | ||
| 1243 | return instance->toAddon.addonInstance->m_streamInfoString.c_str(); | ||
| 1244 | } | ||
| 1245 | |||
| 1246 | static inline unsigned int ADDON_PostProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id) | ||
| 1247 | { | ||
| 1248 | return instance->toAddon.addonInstance->PostProcessNeededSamplesize(handle, mode_id); | ||
| 1249 | } | ||
| 1250 | |||
| 1251 | static inline float ADDON_PostProcessGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id) | ||
| 1252 | { | ||
| 1253 | return instance->toAddon.addonInstance->PostProcessGetDelay(handle, mode_id); | ||
| 1254 | } | ||
| 1255 | |||
| 1256 | static inline unsigned int ADDON_PostProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples) | ||
| 1257 | { | ||
| 1258 | return instance->toAddon.addonInstance->PostProcess(handle, mode_id, array_in, array_out, samples); | ||
| 1259 | } | ||
| 1260 | |||
| 1261 | static inline unsigned int ADDON_OutputResampleProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) | ||
| 1262 | { | ||
| 1263 | return instance->toAddon.addonInstance->OutputResampleProcessNeededSamplesize(handle); | ||
| 1264 | } | ||
| 1265 | |||
| 1266 | static inline unsigned int ADDON_OutputResampleProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) | ||
| 1267 | { | ||
| 1268 | return instance->toAddon.addonInstance->OutputResampleProcess(handle, array_in, array_out, samples); | ||
| 1269 | } | ||
| 1270 | |||
| 1271 | static inline int ADDON_OutputResampleSampleRate(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) | ||
| 1272 | { | ||
| 1273 | return instance->toAddon.addonInstance->OutputResampleSampleRate(handle); | ||
| 1274 | } | ||
| 1275 | |||
| 1276 | static inline float ADDON_OutputResampleGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle) | ||
| 1277 | { | ||
| 1278 | return instance->toAddon.addonInstance->OutputResampleGetDelay(handle); | ||
| 1279 | } | ||
| 1280 | |||
| 1281 | std::string m_dspName; | ||
| 1282 | std::string m_dspVersion; | ||
| 1283 | std::string m_streamInfoString; | ||
| 1284 | AddonInstance_AudioDSP* m_instanceData; | ||
| 1285 | }; | ||
| 1286 | |||
| 1287 | } /* namespace addon */ | ||
| 1288 | } /* namespace kodi */ | ||
