2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "AudioEngine.h"
11 #include "ServiceBroker.h"
12 #include "addons/kodi-dev-kit/include/kodi/AddonBase.h"
13 #include "cores/AudioEngine/Interfaces/AE.h"
14 #include "cores/AudioEngine/Interfaces/AEStream.h"
15 #include "cores/AudioEngine/Utils/AEStreamData.h"
16 #include "utils/log.h"
18 using namespace kodi
; // addon-dev-kit namespace
19 using namespace kodi::audioengine
; // addon-dev-kit namespace
24 void Interface_AudioEngine::Init(AddonGlobalInterface
* addonInterface
)
26 addonInterface
->toKodi
->kodi_audioengine
= new AddonToKodiFuncTable_kodi_audioengine();
28 // write KODI audio DSP specific add-on function addresses to callback table
29 addonInterface
->toKodi
->kodi_audioengine
->make_stream
= audioengine_make_stream
;
30 addonInterface
->toKodi
->kodi_audioengine
->free_stream
= audioengine_free_stream
;
31 addonInterface
->toKodi
->kodi_audioengine
->get_current_sink_format
= get_current_sink_format
;
33 // AEStream add-on function callback table
34 addonInterface
->toKodi
->kodi_audioengine
->aestream_get_space
= aestream_get_space
;
35 addonInterface
->toKodi
->kodi_audioengine
->aestream_add_data
= aestream_add_data
;
36 addonInterface
->toKodi
->kodi_audioengine
->aestream_get_delay
= aestream_get_delay
;
37 addonInterface
->toKodi
->kodi_audioengine
->aestream_is_buffering
= aestream_is_buffering
;
38 addonInterface
->toKodi
->kodi_audioengine
->aestream_get_cache_time
= aestream_get_cache_time
;
39 addonInterface
->toKodi
->kodi_audioengine
->aestream_get_cache_total
= aestream_get_cache_total
;
40 addonInterface
->toKodi
->kodi_audioengine
->aestream_pause
= aestream_pause
;
41 addonInterface
->toKodi
->kodi_audioengine
->aestream_resume
= aestream_resume
;
42 addonInterface
->toKodi
->kodi_audioengine
->aestream_drain
= aestream_drain
;
43 addonInterface
->toKodi
->kodi_audioengine
->aestream_is_draining
= aestream_is_draining
;
44 addonInterface
->toKodi
->kodi_audioengine
->aestream_is_drained
= aestream_is_drained
;
45 addonInterface
->toKodi
->kodi_audioengine
->aestream_flush
= aestream_flush
;
46 addonInterface
->toKodi
->kodi_audioengine
->aestream_get_volume
= aestream_get_volume
;
47 addonInterface
->toKodi
->kodi_audioengine
->aestream_set_volume
= aestream_set_volume
;
48 addonInterface
->toKodi
->kodi_audioengine
->aestream_get_amplification
= aestream_get_amplification
;
49 addonInterface
->toKodi
->kodi_audioengine
->aestream_set_amplification
= aestream_set_amplification
;
50 addonInterface
->toKodi
->kodi_audioengine
->aestream_get_frame_size
= aestream_get_frame_size
;
51 addonInterface
->toKodi
->kodi_audioengine
->aestream_get_channel_count
= aestream_get_channel_count
;
52 addonInterface
->toKodi
->kodi_audioengine
->aestream_get_sample_rate
= aestream_get_sample_rate
;
53 addonInterface
->toKodi
->kodi_audioengine
->aestream_get_data_format
= aestream_get_data_format
;
54 addonInterface
->toKodi
->kodi_audioengine
->aestream_get_resample_ratio
=
55 aestream_get_resample_ratio
;
56 addonInterface
->toKodi
->kodi_audioengine
->aestream_set_resample_ratio
=
57 aestream_set_resample_ratio
;
60 void Interface_AudioEngine::DeInit(AddonGlobalInterface
* addonInterface
)
62 if (addonInterface
->toKodi
) /* <-- Safe check, needed so long old addon way is present */
64 delete addonInterface
->toKodi
->kodi_audioengine
;
65 addonInterface
->toKodi
->kodi_audioengine
= nullptr;
69 AEChannel
Interface_AudioEngine::TranslateAEChannelToKodi(AudioEngineChannel channel
)
73 case AUDIOENGINE_CH_RAW
:
75 case AUDIOENGINE_CH_FL
:
77 case AUDIOENGINE_CH_FR
:
79 case AUDIOENGINE_CH_FC
:
81 case AUDIOENGINE_CH_LFE
:
83 case AUDIOENGINE_CH_BL
:
85 case AUDIOENGINE_CH_BR
:
87 case AUDIOENGINE_CH_FLOC
:
89 case AUDIOENGINE_CH_FROC
:
91 case AUDIOENGINE_CH_BC
:
93 case AUDIOENGINE_CH_SL
:
95 case AUDIOENGINE_CH_SR
:
97 case AUDIOENGINE_CH_TFL
:
99 case AUDIOENGINE_CH_TFR
:
101 case AUDIOENGINE_CH_TFC
:
103 case AUDIOENGINE_CH_TC
:
105 case AUDIOENGINE_CH_TBL
:
107 case AUDIOENGINE_CH_TBR
:
109 case AUDIOENGINE_CH_TBC
:
111 case AUDIOENGINE_CH_BLOC
:
113 case AUDIOENGINE_CH_BROC
:
115 case AUDIOENGINE_CH_MAX
:
117 case AUDIOENGINE_CH_NULL
:
123 AudioEngineChannel
Interface_AudioEngine::TranslateAEChannelToAddon(AEChannel channel
)
128 return AUDIOENGINE_CH_RAW
;
130 return AUDIOENGINE_CH_FL
;
132 return AUDIOENGINE_CH_FR
;
134 return AUDIOENGINE_CH_FC
;
136 return AUDIOENGINE_CH_LFE
;
138 return AUDIOENGINE_CH_BL
;
140 return AUDIOENGINE_CH_BR
;
142 return AUDIOENGINE_CH_FLOC
;
144 return AUDIOENGINE_CH_FROC
;
146 return AUDIOENGINE_CH_BC
;
148 return AUDIOENGINE_CH_SL
;
150 return AUDIOENGINE_CH_SR
;
152 return AUDIOENGINE_CH_TFL
;
154 return AUDIOENGINE_CH_TFR
;
156 return AUDIOENGINE_CH_TFC
;
158 return AUDIOENGINE_CH_TC
;
160 return AUDIOENGINE_CH_TBL
;
162 return AUDIOENGINE_CH_TBR
;
164 return AUDIOENGINE_CH_TBC
;
166 return AUDIOENGINE_CH_BLOC
;
168 return AUDIOENGINE_CH_BROC
;
170 return AUDIOENGINE_CH_MAX
;
173 return AUDIOENGINE_CH_NULL
;
177 AEDataFormat
Interface_AudioEngine::TranslateAEFormatToKodi(AudioEngineDataFormat format
)
181 case AUDIOENGINE_FMT_U8
:
183 case AUDIOENGINE_FMT_S16BE
:
185 case AUDIOENGINE_FMT_S16LE
:
187 case AUDIOENGINE_FMT_S16NE
:
189 case AUDIOENGINE_FMT_S32BE
:
191 case AUDIOENGINE_FMT_S32LE
:
193 case AUDIOENGINE_FMT_S32NE
:
195 case AUDIOENGINE_FMT_S24BE4
:
196 return AE_FMT_S24BE4
;
197 case AUDIOENGINE_FMT_S24LE4
:
198 return AE_FMT_S24LE4
;
199 case AUDIOENGINE_FMT_S24NE4
:
200 return AE_FMT_S24NE4
;
201 case AUDIOENGINE_FMT_S24NE4MSB
:
202 return AE_FMT_S24NE4MSB
;
203 case AUDIOENGINE_FMT_S24BE3
:
204 return AE_FMT_S24BE3
;
205 case AUDIOENGINE_FMT_S24LE3
:
206 return AE_FMT_S24LE3
;
207 case AUDIOENGINE_FMT_S24NE3
:
208 return AE_FMT_S24NE3
;
209 case AUDIOENGINE_FMT_DOUBLE
:
210 return AE_FMT_DOUBLE
;
211 case AUDIOENGINE_FMT_FLOAT
:
213 case AUDIOENGINE_FMT_RAW
:
215 case AUDIOENGINE_FMT_U8P
:
217 case AUDIOENGINE_FMT_S16NEP
:
218 return AE_FMT_S16NEP
;
219 case AUDIOENGINE_FMT_S32NEP
:
220 return AE_FMT_S32NEP
;
221 case AUDIOENGINE_FMT_S24NE4P
:
222 return AE_FMT_S24NE4P
;
223 case AUDIOENGINE_FMT_S24NE4MSBP
:
224 return AE_FMT_S24NE4MSBP
;
225 case AUDIOENGINE_FMT_S24NE3P
:
226 return AE_FMT_S24NE3P
;
227 case AUDIOENGINE_FMT_DOUBLEP
:
228 return AE_FMT_DOUBLEP
;
229 case AUDIOENGINE_FMT_FLOATP
:
230 return AE_FMT_FLOATP
;
231 case AUDIOENGINE_FMT_MAX
:
233 case AUDIOENGINE_FMT_INVALID
:
235 return AE_FMT_INVALID
;
239 AudioEngineDataFormat
Interface_AudioEngine::TranslateAEFormatToAddon(AEDataFormat format
)
244 return AUDIOENGINE_FMT_U8
;
246 return AUDIOENGINE_FMT_S16BE
;
248 return AUDIOENGINE_FMT_S16LE
;
250 return AUDIOENGINE_FMT_S16NE
;
252 return AUDIOENGINE_FMT_S32BE
;
254 return AUDIOENGINE_FMT_S32LE
;
256 return AUDIOENGINE_FMT_S32NE
;
258 return AUDIOENGINE_FMT_S24BE4
;
260 return AUDIOENGINE_FMT_S24LE4
;
262 return AUDIOENGINE_FMT_S24NE4
;
263 case AE_FMT_S24NE4MSB
:
264 return AUDIOENGINE_FMT_S24NE4MSB
;
266 return AUDIOENGINE_FMT_S24BE3
;
268 return AUDIOENGINE_FMT_S24LE3
;
270 return AUDIOENGINE_FMT_S24NE3
;
272 return AUDIOENGINE_FMT_DOUBLE
;
274 return AUDIOENGINE_FMT_FLOAT
;
276 return AUDIOENGINE_FMT_RAW
;
278 return AUDIOENGINE_FMT_U8P
;
280 return AUDIOENGINE_FMT_S16NEP
;
282 return AUDIOENGINE_FMT_S32NEP
;
284 return AUDIOENGINE_FMT_S24NE4P
;
285 case AE_FMT_S24NE4MSBP
:
286 return AUDIOENGINE_FMT_S24NE4MSBP
;
288 return AUDIOENGINE_FMT_S24NE3P
;
290 return AUDIOENGINE_FMT_DOUBLEP
;
292 return AUDIOENGINE_FMT_FLOATP
;
294 return AUDIOENGINE_FMT_MAX
;
297 return AUDIOENGINE_FMT_INVALID
;
301 AEStreamHandle
* Interface_AudioEngine::audioengine_make_stream(void* kodiBase
,
302 AUDIO_ENGINE_FORMAT
* streamFormat
,
303 unsigned int options
)
305 if (!kodiBase
|| !streamFormat
)
308 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamFormat='{}')",
309 __FUNCTION__
, kodiBase
, static_cast<void*>(streamFormat
));
313 IAE
* engine
= CServiceBroker::GetActiveAE();
317 CAEChannelInfo layout
;
318 for (unsigned int ch
= 0; ch
< AUDIOENGINE_CH_MAX
; ++ch
)
320 if (streamFormat
->m_channels
[ch
] == AUDIOENGINE_CH_NULL
)
322 layout
+= TranslateAEChannelToKodi(streamFormat
->m_channels
[ch
]);
325 AEAudioFormat format
;
326 format
.m_channelLayout
= layout
;
327 format
.m_dataFormat
= TranslateAEFormatToKodi(streamFormat
->m_dataFormat
);
328 format
.m_sampleRate
= streamFormat
->m_sampleRate
;
330 /* Translate addon options to kodi's options */
332 if (options
& AUDIO_STREAM_FORCE_RESAMPLE
)
333 kodiOption
|= AESTREAM_FORCE_RESAMPLE
;
334 if (options
& AUDIO_STREAM_PAUSED
)
335 kodiOption
|= AESTREAM_PAUSED
;
336 if (options
& AUDIO_STREAM_AUTOSTART
)
337 kodiOption
|= AESTREAM_AUTOSTART
;
339 return engine
->MakeStream(format
, kodiOption
).release();
342 void Interface_AudioEngine::audioengine_free_stream(void* kodiBase
, AEStreamHandle
* streamHandle
)
344 if (!kodiBase
|| !streamHandle
)
347 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
348 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
352 IAE
* engine
= CServiceBroker::GetActiveAE();
354 engine
->FreeStream(static_cast<IAEStream
*>(streamHandle
), true);
357 bool Interface_AudioEngine::get_current_sink_format(void* kodiBase
, AUDIO_ENGINE_FORMAT
* format
)
359 if (!kodiBase
|| !format
)
362 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', format='{}')",
363 __FUNCTION__
, kodiBase
, static_cast<void*>(format
));
367 IAE
* engine
= CServiceBroker::GetActiveAE();
371 AEAudioFormat sinkFormat
;
372 if (!engine
->GetCurrentSinkFormat(sinkFormat
))
374 CLog::Log(LOGERROR
, "Interface_AudioEngine::{} - failed to get current sink format from AE!",
379 format
->m_dataFormat
= TranslateAEFormatToAddon(sinkFormat
.m_dataFormat
);
380 format
->m_sampleRate
= sinkFormat
.m_sampleRate
;
381 format
->m_frames
= sinkFormat
.m_frames
;
382 format
->m_frameSize
= sinkFormat
.m_frameSize
;
383 format
->m_channelCount
= sinkFormat
.m_channelLayout
.Count();
384 for (unsigned int ch
= 0; ch
< format
->m_channelCount
&& ch
< AUDIOENGINE_CH_MAX
; ++ch
)
386 format
->m_channels
[ch
] = TranslateAEChannelToAddon(sinkFormat
.m_channelLayout
[ch
]);
392 unsigned int Interface_AudioEngine::aestream_get_space(void* kodiBase
, AEStreamHandle
* streamHandle
)
394 if (!kodiBase
|| !streamHandle
)
397 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
398 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
402 return static_cast<IAEStream
*>(streamHandle
)->GetSpace();
405 unsigned int Interface_AudioEngine::aestream_add_data(void* kodiBase
,
406 AEStreamHandle
* streamHandle
,
407 uint8_t* const* data
,
412 double centerMixLevel
)
414 if (!kodiBase
|| !streamHandle
)
417 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
418 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
422 if (!CServiceBroker::GetActiveAE())
425 IAEStream::ExtData extData
;
427 extData
.hasDownmix
= hasDownmix
;
428 extData
.centerMixLevel
= centerMixLevel
;
429 return static_cast<IAEStream
*>(streamHandle
)->AddData(data
, offset
, frames
, &extData
);
432 double Interface_AudioEngine::aestream_get_delay(void* kodiBase
, AEStreamHandle
* streamHandle
)
434 if (!kodiBase
|| !streamHandle
)
437 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
438 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
442 if (!CServiceBroker::GetActiveAE())
445 return static_cast<IAEStream
*>(streamHandle
)->GetDelay();
448 bool Interface_AudioEngine::aestream_is_buffering(void* kodiBase
, AEStreamHandle
* streamHandle
)
450 if (!kodiBase
|| !streamHandle
)
453 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
454 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
458 if (!CServiceBroker::GetActiveAE())
461 return static_cast<IAEStream
*>(streamHandle
)->IsBuffering();
464 double Interface_AudioEngine::aestream_get_cache_time(void* kodiBase
, AEStreamHandle
* streamHandle
)
466 if (!kodiBase
|| !streamHandle
)
469 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
470 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
474 if (!CServiceBroker::GetActiveAE())
477 return static_cast<IAEStream
*>(streamHandle
)->GetCacheTime();
480 double Interface_AudioEngine::aestream_get_cache_total(void* kodiBase
, AEStreamHandle
* streamHandle
)
482 if (!kodiBase
|| !streamHandle
)
485 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
486 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
490 if (!CServiceBroker::GetActiveAE())
493 return static_cast<IAEStream
*>(streamHandle
)->GetCacheTotal();
496 void Interface_AudioEngine::aestream_pause(void* kodiBase
, AEStreamHandle
* streamHandle
)
498 if (!kodiBase
|| !streamHandle
)
501 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
502 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
506 if (!CServiceBroker::GetActiveAE())
509 static_cast<IAEStream
*>(streamHandle
)->Pause();
512 void Interface_AudioEngine::aestream_resume(void* kodiBase
, AEStreamHandle
* streamHandle
)
514 if (!kodiBase
|| !streamHandle
)
517 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
518 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
522 static_cast<IAEStream
*>(streamHandle
)->Resume();
525 void Interface_AudioEngine::aestream_drain(void* kodiBase
, AEStreamHandle
* streamHandle
, bool wait
)
527 if (!kodiBase
|| !streamHandle
)
530 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
531 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
535 if (!CServiceBroker::GetActiveAE())
538 static_cast<IAEStream
*>(streamHandle
)->Drain(wait
);
541 bool Interface_AudioEngine::aestream_is_draining(void* kodiBase
, AEStreamHandle
* streamHandle
)
543 if (!kodiBase
|| !streamHandle
)
546 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
547 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
551 if (!CServiceBroker::GetActiveAE())
554 return static_cast<IAEStream
*>(streamHandle
)->IsDraining();
557 bool Interface_AudioEngine::aestream_is_drained(void* kodiBase
, AEStreamHandle
* streamHandle
)
559 if (!kodiBase
|| !streamHandle
)
562 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
563 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
567 if (!CServiceBroker::GetActiveAE())
570 return static_cast<IAEStream
*>(streamHandle
)->IsDrained();
573 void Interface_AudioEngine::aestream_flush(void* kodiBase
, AEStreamHandle
* streamHandle
)
575 if (!kodiBase
|| !streamHandle
)
578 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
579 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
583 if (!CServiceBroker::GetActiveAE())
586 static_cast<IAEStream
*>(streamHandle
)->Flush();
589 float Interface_AudioEngine::aestream_get_volume(void* kodiBase
, AEStreamHandle
* streamHandle
)
591 if (!kodiBase
|| !streamHandle
)
594 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
595 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
599 if (!CServiceBroker::GetActiveAE())
602 return static_cast<IAEStream
*>(streamHandle
)->GetVolume();
605 void Interface_AudioEngine::aestream_set_volume(void* kodiBase
,
606 AEStreamHandle
* streamHandle
,
609 if (!kodiBase
|| !streamHandle
)
612 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
613 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
617 if (!CServiceBroker::GetActiveAE())
620 static_cast<IAEStream
*>(streamHandle
)->SetVolume(volume
);
623 float Interface_AudioEngine::aestream_get_amplification(void* kodiBase
,
624 AEStreamHandle
* streamHandle
)
626 if (!kodiBase
|| !streamHandle
)
629 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
630 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
634 if (!CServiceBroker::GetActiveAE())
637 return static_cast<IAEStream
*>(streamHandle
)->GetAmplification();
640 void Interface_AudioEngine::aestream_set_amplification(void* kodiBase
,
641 AEStreamHandle
* streamHandle
,
644 if (!kodiBase
|| !streamHandle
)
647 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
648 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
652 if (!CServiceBroker::GetActiveAE())
655 static_cast<IAEStream
*>(streamHandle
)->SetAmplification(amplify
);
658 unsigned int Interface_AudioEngine::aestream_get_frame_size(void* kodiBase
,
659 AEStreamHandle
* streamHandle
)
661 if (!kodiBase
|| !streamHandle
)
664 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
665 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
669 if (!CServiceBroker::GetActiveAE())
672 return static_cast<IAEStream
*>(streamHandle
)->GetFrameSize();
675 unsigned int Interface_AudioEngine::aestream_get_channel_count(void* kodiBase
,
676 AEStreamHandle
* streamHandle
)
678 if (!kodiBase
|| !streamHandle
)
681 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
682 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
686 if (!CServiceBroker::GetActiveAE())
689 return static_cast<IAEStream
*>(streamHandle
)->GetChannelCount();
692 unsigned int Interface_AudioEngine::aestream_get_sample_rate(void* kodiBase
,
693 AEStreamHandle
* streamHandle
)
695 if (!kodiBase
|| !streamHandle
)
698 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
699 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
703 if (!CServiceBroker::GetActiveAE())
706 return static_cast<IAEStream
*>(streamHandle
)->GetSampleRate();
709 AudioEngineDataFormat
Interface_AudioEngine::aestream_get_data_format(void* kodiBase
,
710 AEStreamHandle
* streamHandle
)
712 if (!kodiBase
|| !streamHandle
)
715 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
716 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
717 return AUDIOENGINE_FMT_INVALID
;
720 if (!CServiceBroker::GetActiveAE())
721 return AUDIOENGINE_FMT_INVALID
;
723 return TranslateAEFormatToAddon(static_cast<IAEStream
*>(streamHandle
)->GetDataFormat());
726 double Interface_AudioEngine::aestream_get_resample_ratio(void* kodiBase
,
727 AEStreamHandle
* streamHandle
)
729 if (!kodiBase
|| !streamHandle
)
732 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
733 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
737 if (!CServiceBroker::GetActiveAE())
740 return static_cast<IAEStream
*>(streamHandle
)->GetResampleRatio();
743 void Interface_AudioEngine::aestream_set_resample_ratio(void* kodiBase
,
744 AEStreamHandle
* streamHandle
,
747 if (!kodiBase
|| !streamHandle
)
750 "Interface_AudioEngine::{} - invalid stream data (kodiBase='{}', streamHandle='{}')",
751 __FUNCTION__
, kodiBase
, static_cast<void*>(streamHandle
));
755 if (!CServiceBroker::GetActiveAE())
758 static_cast<IAEStream
*>(streamHandle
)->SetResampleRatio(ratio
);
761 } /* namespace ADDON */