summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h
diff options
context:
space:
mode:
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.h529
1 files changed, 0 insertions, 529 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
deleted file mode 100644
index b0ecb8b..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h
+++ /dev/null
@@ -1,529 +0,0 @@
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 * selection on 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
95extern "C"
96{
97 /*! @name Audio DSP add-on methods */
98 //@{
99 /*!
100 * @brief Get the list of features that this add-on provides.
101 * Called by KODI to query the add-ons capabilities.
102 * Used to check which options should be presented in the DSP, which methods
103 * to call, etc.
104 * All capabilities that the add-on supports should be set to true.
105 * @param pCapabilities The add-ons capabilities.
106 * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully.
107 * @remarks Valid implementation required.
108 */
109 AE_DSP_ERROR GetAddonCapabilities(AE_DSP_ADDON_CAPABILITIES *pCapabilities);
110
111 /*!
112 * @return The name reported by the back end that will be displayed in the
113 * UI.
114 * @remarks Valid implementation required.
115 */
116 const char* GetDSPName(void);
117
118 /*!
119 * @return The version string reported by the back end that will be displayed
120 * in the UI.
121 * @remarks Valid implementation required.
122 */
123 const char* GetDSPVersion(void);
124
125 /*!
126 * @brief Call one of the menu hooks (if supported).
127 * Supported AE_DSP_MENUHOOK instances have to be added in ADDON_Create(),
128 * by calling AddMenuHook() on the callback.
129 * @param menuhook The hook to call.
130 * @param item The selected item for which the hook was called.
131 * @return AE_DSP_ERROR_NO_ERROR if the hook was called successfully.
132 * @remarks Optional. Return AE_DSP_ERROR_NOT_IMPLEMENTED if this add-on
133 * won't provide this function.
134 */
135 AE_DSP_ERROR CallMenuHook(const AE_DSP_MENUHOOK& menuhook, const AE_DSP_MENUHOOK_DATA &item);
136 //@}
137
138 /** @name DSP processing control, used to open and close a stream
139 * @remarks Valid implementation required.
140 */
141 //@{
142 /*!
143 * @brief Set up Audio DSP with selected audio settings (use the basic
144 * present audio stream data format).
145 * Used to detect available add-ons for present stream, as example stereo
146 * surround upmix not needed on 5.1 audio stream.
147 * @param addonSettings The add-ons audio settings.
148 * @param pProperties The properties of the currently playing stream.
149 * @param handle On this becomes addon informed about stream id and can set function addresses which need on calls
150 * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully
151 * and data can be performed. AE_DSP_ERROR_IGNORE_ME if format is not
152 * supported, but without fault.
153 * @remarks Valid implementation required.
154 */
155 AE_DSP_ERROR StreamCreate(const AE_DSP_SETTINGS *addonSettings, const AE_DSP_STREAM_PROPERTIES* pProperties, ADDON_HANDLE handle);
156
157 /*!
158 * Remove the selected id from currently used DSP processes
159 * @param handle identification data for stream
160 * @return AE_DSP_ERROR_NO_ERROR if the becomes found and removed
161 * @remarks Valid implementation required.
162 */
163 AE_DSP_ERROR StreamDestroy(const ADDON_HANDLE handle);
164
165 /*!
166 * @brief Ask the add-on about a requested processing mode that it is
167 * supported on the current stream. Is called about every add-on mode after
168 * successed StreamCreate.
169 * @param handle identification data for stream
170 * @param type The processing mode type, see AE_DSP_MODE_TYPE for definitions
171 * @param mode_id The mode inside add-on which must be performed on call. Id
172 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
173 * RegisterMode callback,
174 * @param unique_db_mode_id The Mode unique id generated from dsp database.
175 * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully
176 * or if the stream is not supported the add-on must return
177 * AE_DSP_ERROR_IGNORE_ME.
178 * @remarks Valid implementation required.
179 */
180 AE_DSP_ERROR StreamIsModeSupported(const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int mode_id, int unique_db_mode_id);
181
182 /*!
183 * @brief Set up Audio DSP with selected audio settings (detected on data of
184 * first present audio packet)
185 * @param addonSettings The add-ons audio settings.
186 * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully.
187 * @remarks Valid implementation required.
188 */
189 AE_DSP_ERROR StreamInitialize(const ADDON_HANDLE handle, const AE_DSP_SETTINGS *addonSettings);
190 //@}
191
192 /** @name DSP input processing
193 * @remarks Only used by KODI if bSupportsInputProcess is set to true.
194 */
195 //@{
196 /*!
197 * @brief DSP input processing
198 * Can be used to have unchanged stream..
199 * All DSP add-ons allowed to-do this.
200 * @param handle identification data for stream
201 * @param array_in Pointer to data memory
202 * @param samples Amount of samples inside array_in
203 * @return true if work was OK
204 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
205 * GetAddonCapabilities
206 */
207 bool InputProcess(const ADDON_HANDLE handle, const float **array_in, unsigned int samples);
208 //@}
209
210 /** @name DSP pre-resampling
211 * @remarks Only used by KODI if bSupportsInputResample is set to true.
212 */
213 //@{
214 /*!
215 * @brief If the add-on operate with buffered arrays and the output size can
216 * be higher as the input it becomes asked about needed size before any
217 * InputResampleProcess call.
218 * @param handle identification data for stream
219 * @return The needed size of output array or 0 if no changes within it
220 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
221 * GetAddonCapabilities
222 */
223 unsigned int InputResampleProcessNeededSamplesize(const ADDON_HANDLE handle);
224
225 /*!
226 * @brief DSP re sample processing before master.
227 * Here a high quality resample can be performed.
228 * Only one DSP add-on is allowed to-do this!
229 * @param handle identification data for stream
230 * @param array_in Pointer to input data memory
231 * @param array_out Pointer to output data memory
232 * @param samples Amount of samples inside array_in
233 * @return Amount of samples processed
234 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
235 * GetAddonCapabilities
236 */
237 unsigned int InputResampleProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples);
238
239 /*!
240 * @brief Returns the re-sampling generated new sample rate used before the
241 * master process
242 * @param handle identification data for stream
243 * @return The new sample rate
244 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
245 * GetAddonCapabilities
246 */
247 int InputResampleSampleRate(const ADDON_HANDLE handle);
248
249 /*!
250 * @brief Returns the time in seconds that it will take
251 * for the next added packet to be returned to KODI.
252 * @param handle identification data for stream
253 * @return the delay in seconds
254 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
255 * GetAddonCapabilities
256 */
257 float InputResampleGetDelay(const ADDON_HANDLE handle);
258 //@}
259
260 /** @name DSP Pre processing
261 * @remarks Only used by KODI if bSupportsPreProcess is set to true.
262 */
263 //@{
264 /*!
265 * @brief If the addon operate with buffered arrays and the output size can
266 * be higher as the input it becomes asked about needed size before any
267 * PreProcess call.
268 * @param handle identification data for stream
269 * @param mode_id The mode inside add-on which must be performed on call. Id
270 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
271 * RegisterMode callback and can be defined from add-on as a structure
272 * pointer or anything else what is needed to find it.
273 * @return The needed size of output array or 0 if no changes within it
274 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
275 * GetAddonCapabilities
276 */
277 unsigned int PreProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id);
278
279 /*!
280 * @brief Returns the time in seconds that it will take
281 * for the next added packet to be returned to KODI.
282 * @param handle identification data for stream
283 * @param mode_id The mode inside add-on which must be performed on call. Id
284 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
285 * RegisterMode callback and can be defined from add-on as a structure
286 * pointer or anything else what is needed to find it.
287 * @return the delay in seconds
288 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
289 * GetAddonCapabilities
290 */
291 float PreProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id);
292
293 /*!
294 * @brief DSP preprocessing
295 * All DSP add-ons allowed to-do this.
296 * @param handle identification data for stream
297 * @param mode_id The mode inside add-on which must be performed on call. Id
298 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
299 * RegisterMode callback and can be defined from add-on as a structure
300 * pointer or anything else what is needed to find it.
301 * @param array_in Pointer to input data memory
302 * @param array_out Pointer to output data memory
303 * @param samples Amount of samples inside array_in
304 * @return Amount of samples processed
305 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
306 * GetAddonCapabilities
307 */
308 unsigned int PreProcess(const ADDON_HANDLE handle, unsigned int mode_id, float **array_in, float **array_out, unsigned int samples);
309 //@}
310
311 /** @name DSP Master processing
312 * @remarks Only used by KODI if bSupportsMasterProcess is set to true.
313 */
314 //@{
315 /*!
316 * @brief Set the active master process mode
317 * @param handle identification data for stream
318 * @param type Requested stream type for the selected master mode
319 * @param mode_id The Mode identifier.
320 * @param unique_db_mode_id The Mode unique id generated from DSP database.
321 * @return AE_DSP_ERROR_NO_ERROR if the setup was successful
322 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
323 * GetAddonCapabilities
324 */
325 AE_DSP_ERROR MasterProcessSetMode(const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id);
326
327 /*!
328 * @brief If the add-on operate with buffered arrays and the output size can
329 * be higher as the input it becomes asked about needed size before any
330 * MasterProcess call.
331 * @param handle identification data for stream
332 * @return The needed size of output array or 0 if no changes within it
333 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
334 * GetAddonCapabilities
335 */
336 unsigned int MasterProcessNeededSamplesize(const ADDON_HANDLE handle);
337
338 /*!
339 * @brief Returns the time in seconds that it will take
340 * for the next added packet to be returned to KODI.
341 * @param handle identification data for stream
342 * @return the delay in seconds
343 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
344 * GetAddonCapabilities
345 */
346 float MasterProcessGetDelay(const ADDON_HANDLE handle);
347
348 /*!
349 * @brief Returns the from selected master mode performed channel alignment
350 * @param handle identification data for stream
351 * @retval out_channel_present_flags the exact channel present flags after
352 * performed up-/downmix
353 * @return the amount channels
354 * @remarks Optional. Must be used and set if a channel up- or downmix is
355 * processed from the active master mode
356 */
357 int MasterProcessGetOutChannels(const ADDON_HANDLE handle, unsigned long &out_channel_present_flags);
358
359 /*!
360 * @brief Master processing becomes performed with it
361 * Here a channel up-mix/down-mix for stereo surround sound can be performed
362 * Only one DSP add-on is allowed to-do this!
363 * @param handle identification data for stream
364 * @param array_in Pointer to input data memory
365 * @param array_out Pointer to output data memory
366 * @param samples Amount of samples inside array_in
367 * @return Amount of samples processed
368 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
369 * GetAddonCapabilities
370 */
371 unsigned int MasterProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples);
372
373 /*!
374 * Used to get a information string about the processed work to show on skin
375 * @return A string to show
376 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
377 * GetAddonCapabilities
378 */
379 const char *MasterProcessGetStreamInfoString(const ADDON_HANDLE handle);
380 //@}
381
382 /** @name DSP Post processing
383 * @remarks Only used by KODI if bSupportsPostProcess is set to true.
384 */
385 //@{
386 /*!
387 * If the add-on operate with buffered arrays and the output size can be
388 * higher as the input it becomes asked about needed size before any
389 * PostProcess call.
390 * @param handle identification data for stream
391 * @param mode_id The mode inside add-on which must be performed on call. Id
392 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
393 * RegisterMode callback, and can be defined from add-on as a structure
394 * pointer or anything else what is needed to find it.
395 * @return The needed size of output array or 0 if no changes within it
396 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
397 * GetAddonCapabilities
398 */
399 unsigned int PostProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id);
400
401 /*!
402 * Returns the time in seconds that it will take
403 * for the next added packet to be returned to KODI.
404 * @param handle identification data for stream
405 * @param mode_id The mode inside add-on which must be performed on call. Id
406 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
407 * RegisterMode callback, and can be defined from add-on as a structure
408 * pointer or anything else what is needed to find it.
409 * @return the delay in seconds
410 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
411 * GetAddonCapabilities
412 */
413 float PostProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id);
414
415 /*!
416 * @brief DSP post processing
417 * On the post processing can be things performed with additional channel
418 * upmix like 6.1 to 7.1
419 * or frequency/volume corrections, speaker distance handling, equalizer... .
420 * All DSP add-ons allowed to-do this.
421 * @param handle identification data for stream
422 * @param mode_id The mode inside add-on which must be performed on call. Id
423 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
424 * RegisterMode callback, and can be defined from add-on as a structure
425 * pointer or anything else what is needed to find it.
426 * @param array_in Pointer to input data memory
427 * @param array_out Pointer to output data memory
428 * @param samples Amount of samples inside array_in
429 * @return Amount of samples processed
430 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
431 * GetAddonCapabilities
432 */
433 unsigned int PostProcess(const ADDON_HANDLE handle, unsigned int mode_id, float **array_in, float **array_out, unsigned int samples);
434 //@}
435
436 /** @name DSP Post re-sampling
437 * @remarks Only used by KODI if bSupportsOutputResample is set to true.
438 */
439 //@{
440 /*!
441 * @brief If the add-on operate with buffered arrays and the output size
442 * can be higher as the input
443 * it becomes asked about needed size before any OutputResampleProcess call.
444 * @param handle identification data for stream
445 * @return The needed size of output array or 0 if no changes within it
446 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
447 * GetAddonCapabilities
448 */
449 unsigned int OutputResampleProcessNeededSamplesize(const ADDON_HANDLE handle);
450
451 /*!
452 * @brief Re-sampling after master processing becomes performed with it if
453 * needed, only
454 * one add-on can perform it.
455 * @param handle identification data for stream
456 * @param array_in Pointer to input data memory
457 * @param array_out Pointer to output data memory
458 * @param samples Amount of samples inside array_in
459 * @return Amount of samples processed
460 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
461 * GetAddonCapabilities
462 */
463 unsigned int OutputResampleProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples);
464
465 /*!
466 * @brief Returns the re-sampling generated new sample rate used after the
467 * master process.
468 * @param handle identification data for stream
469 * @return The new sample rate
470 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
471 * GetAddonCapabilities
472 */
473 int OutputResampleSampleRate(const ADDON_HANDLE handle);
474
475 /*!
476 * @brief Returns the time in seconds that it will take for the next added
477 * packet to be returned to KODI.
478 * @param handle identification data for stream
479 * @return the delay in seconds
480 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
481 * GetAddonCapabilities
482 */
483 float OutputResampleGetDelay(const ADDON_HANDLE handle);
484 //@}
485
486 // function to export the above structure to KODI
487 void __declspec(dllexport) get_addon(void* ptr)
488 {
489 KodiToAddonFuncTable_AudioDSP* pDSP = static_cast<KodiToAddonFuncTable_AudioDSP*>(ptr);
490
491 pDSP->GetAddonCapabilities = GetAddonCapabilities;
492 pDSP->GetDSPName = GetDSPName;
493 pDSP->GetDSPVersion = GetDSPVersion;
494 pDSP->MenuHook = CallMenuHook;
495
496 pDSP->StreamCreate = StreamCreate;
497 pDSP->StreamDestroy = StreamDestroy;
498 pDSP->StreamIsModeSupported = StreamIsModeSupported;
499 pDSP->StreamInitialize = StreamInitialize;
500
501 pDSP->InputProcess = InputProcess;
502
503 pDSP->InputResampleProcessNeededSamplesize = InputResampleProcessNeededSamplesize;
504 pDSP->InputResampleProcess = InputResampleProcess;
505 pDSP->InputResampleGetDelay = InputResampleGetDelay;
506 pDSP->InputResampleSampleRate = InputResampleSampleRate;
507
508 pDSP->PreProcessNeededSamplesize = PreProcessNeededSamplesize;
509 pDSP->PreProcessGetDelay = PreProcessGetDelay;
510 pDSP->PreProcess = PreProcess;
511
512 pDSP->MasterProcessSetMode = MasterProcessSetMode;
513 pDSP->MasterProcessNeededSamplesize = MasterProcessNeededSamplesize;
514 pDSP->MasterProcessGetDelay = MasterProcessGetDelay;
515 pDSP->MasterProcessGetOutChannels = MasterProcessGetOutChannels;
516 pDSP->MasterProcess = MasterProcess;
517 pDSP->MasterProcessGetStreamInfoString = MasterProcessGetStreamInfoString;
518
519 pDSP->PostProcessNeededSamplesize = PostProcessNeededSamplesize;
520 pDSP->PostProcessGetDelay = PostProcessGetDelay;
521 pDSP->PostProcess = PostProcess;
522
523 pDSP->OutputResampleProcessNeededSamplesize = OutputResampleProcessNeededSamplesize;
524 pDSP->OutputResampleProcess = OutputResampleProcess;
525 pDSP->OutputResampleSampleRate = OutputResampleSampleRate;
526 pDSP->OutputResampleGetDelay = OutputResampleGetDelay;
527 };
528};
529