summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2017-09-02 15:02:54 +0200
committermanuel <manuel@mausz.at>2017-09-02 15:02:54 +0200
commit0afb1d4d51973cf52973617c92236d851a039d31 (patch)
tree300741b800f0e013ba1e709cc46460de6383f2bb /xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h
parent86b22151f0758311fd146ff508e7254337414bc1 (diff)
downloadkodi-pvr-build-0afb1d4d51973cf52973617c92236d851a039d31.tar.gz
kodi-pvr-build-0afb1d4d51973cf52973617c92236d851a039d31.tar.bz2
kodi-pvr-build-0afb1d4d51973cf52973617c92236d851a039d31.zip
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h145
1 files changed, 81 insertions, 64 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h
index 1265dcd..02faf86 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h
@@ -139,7 +139,7 @@ extern "C"
139 } 139 }
140 } 140 }
141 141
142 return true; 142 return true;
143 } 143 }
144 }; 144 };
145 //@} 145 //@}
@@ -154,33 +154,34 @@ extern "C"
154 */ 154 */
155 typedef struct AddonToKodiFuncTable_kodi_audioengine 155 typedef struct AddonToKodiFuncTable_kodi_audioengine
156 { 156 {
157 AEStreamHandle* (*MakeStream) (void *kodiBase, AudioEngineFormat format, unsigned int options); 157 AEStreamHandle* (*make_stream)(void *kodiBase, AudioEngineFormat* format, unsigned int options);
158 void (*FreeStream) (void *kodiBase, AEStreamHandle *stream); 158 void (*free_stream)(void *kodiBase, AEStreamHandle *stream);
159 bool (*GetCurrentSinkFormat) (void *kodiBase, AudioEngineFormat *SinkFormat); 159 bool (*get_current_sink_format)(void *kodiBase, AudioEngineFormat* sink_format);
160 160
161 // Audio Engine Stream definitions 161 // Audio Engine Stream definitions
162 unsigned int (*AEStream_GetSpace) (void *kodiBase, AEStreamHandle *handle); 162 unsigned int (*aestream_get_space)(void *kodiBase, AEStreamHandle *handle);
163 unsigned int (*AEStream_AddData) (void *kodiBase, AEStreamHandle *handle, uint8_t* const *Data, unsigned int Offset, unsigned int Frames); 163 unsigned int (*aestream_add_data)(void *kodiBase, AEStreamHandle *handle, uint8_t* const *data,
164 double (*AEStream_GetDelay)(void *kodiBase, AEStreamHandle *handle); 164 unsigned int offset, unsigned int frames, double pts);
165 bool (*AEStream_IsBuffering)(void *kodiBase, AEStreamHandle *handle); 165 double (*aestream_get_delay)(void *kodiBase, AEStreamHandle *handle);
166 double (*AEStream_GetCacheTime)(void *kodiBase, AEStreamHandle *handle); 166 bool (*aestream_is_buffering)(void *kodiBase, AEStreamHandle *handle);
167 double (*AEStream_GetCacheTotal)(void *kodiBase, AEStreamHandle *handle); 167 double (*aestream_get_cache_time)(void *kodiBase, AEStreamHandle *handle);
168 void (*AEStream_Pause)(void *kodiBase, AEStreamHandle *handle); 168 double (*aestream_get_cache_total)(void *kodiBase, AEStreamHandle *handle);
169 void (*AEStream_Resume)(void *kodiBase, AEStreamHandle *handle); 169 void (*aestream_pause)(void *kodiBase, AEStreamHandle *handle);
170 void (*AEStream_Drain)(void *kodiBase, AEStreamHandle *handle, bool Wait); 170 void (*aestream_resume)(void *kodiBase, AEStreamHandle *handle);
171 bool (*AEStream_IsDraining)(void *kodiBase, AEStreamHandle *handle); 171 void (*aestream_drain)(void *kodiBase, AEStreamHandle *handle, bool wait);
172 bool (*AEStream_IsDrained)(void *kodiBase, AEStreamHandle *handle); 172 bool (*aestream_is_draining)(void *kodiBase, AEStreamHandle *handle);
173 void (*AEStream_Flush)(void *kodiBase, AEStreamHandle *handle); 173 bool (*aestream_is_drained)(void *kodiBase, AEStreamHandle *handle);
174 float (*AEStream_GetVolume)(void *kodiBase, AEStreamHandle *handle); 174 void (*aestream_flush)(void *kodiBase, AEStreamHandle *handle);
175 void (*AEStream_SetVolume)(void *kodiBase, AEStreamHandle *handle, float Volume); 175 float (*aestream_get_volume)(void *kodiBase, AEStreamHandle *handle);
176 float (*AEStream_GetAmplification)(void *kodiBase, AEStreamHandle *handle); 176 void (*aestream_set_volume)(void *kodiBase, AEStreamHandle *handle, float volume);
177 void (*AEStream_SetAmplification)(void *kodiBase, AEStreamHandle *handle, float Amplify); 177 float (*aestream_get_amplification)(void *kodiBase, AEStreamHandle *handle);
178 unsigned int (*AEStream_GetFrameSize)(void *kodiBase, AEStreamHandle *handle); 178 void (*aestream_set_amplification)(void *kodiBase, AEStreamHandle *handle, float amplify);
179 unsigned int (*AEStream_GetChannelCount)(void *kodiBase, AEStreamHandle *handle); 179 unsigned int (*aestream_get_frame_size)(void *kodiBase, AEStreamHandle *handle);
180 unsigned int (*AEStream_GetSampleRate)(void *kodiBase, AEStreamHandle *handle); 180 unsigned int (*aestream_get_channel_count)(void *kodiBase, AEStreamHandle *handle);
181 AEDataFormat (*AEStream_GetDataFormat)(void *kodiBase, AEStreamHandle *handle); 181 unsigned int (*aestream_get_sample_rate)(void *kodiBase, AEStreamHandle *handle);
182 double (*AEStream_GetResampleRatio)(void *kodiBase, AEStreamHandle *handle); 182 AEDataFormat (*aestream_get_data_format)(void *kodiBase, AEStreamHandle *handle);
183 void (*AEStream_SetResampleRatio)(void *kodiBase, AEStreamHandle *handle, double Ratio); 183 double (*aestream_get_resample_ratio)(void *kodiBase, AEStreamHandle *handle);
184 void (*aestream_set_resample_ratio)(void *kodiBase, AEStreamHandle *handle, double ratio);
184 } AddonToKodiFuncTable_kodi_audioengine; 185 } AddonToKodiFuncTable_kodi_audioengine;
185 186
186} /* extern "C" */ 187} /* extern "C" */
@@ -242,12 +243,12 @@ namespace audioengine
242 /// 243 ///
243 /// **Bit options to pass to CAELib_Stream (on Kodi by <c>IAE::MakeStream</c>)** 244 /// **Bit options to pass to CAELib_Stream (on Kodi by <c>IAE::MakeStream</c>)**
244 /// 245 ///
245 /// | enum AEStreamOptions | Value: | Description: 246 /// | enum AEStreamOptions | Value: | Description:
246 /// |-------------------------:|:------:|:----------------------------------- 247 /// |----------------------------:|:------:|:-----------------------------------
247 /// | AE_STREAM_FORCE_RESAMPLE | 1 << 0 | Force resample even if rates match 248 /// | AUDIO_STREAM_FORCE_RESAMPLE | 1 << 0 | Force resample even if rates match
248 /// | AE_STREAM_PAUSED | 1 << 1 | Create the stream paused 249 /// | AUDIO_STREAM_PAUSED | 1 << 1 | Create the stream paused
249 /// | AE_STREAM_AUTOSTART | 1 << 2 | Autostart the stream when enough data is buffered 250 /// | AUDIO_STREAM_AUTOSTART | 1 << 2 | Autostart the stream when enough data is buffered
250 /// | AE_STREAM_BYPASS_ADSP | 1 << 3 | if this option is set the ADSP-System is bypassed and the raw stream will be passed through IAESink. 251 /// | AUDIO_STREAM_BYPASS_ADSP | 1 << 3 | if this option is set the ADSP-System is bypassed and the raw stream will be passed through IAESink.
251 /// 252 ///
252 /// 253 ///
253 /// ------------------------------------------------------------------------ 254 /// ------------------------------------------------------------------------
@@ -261,7 +262,16 @@ namespace audioengine
261 /// 262 ///
262 /// ... 263 /// ...
263 /// 264 ///
264 /// CAddonAEStream* stream = new CAddonAEStream(AE_FMT_S16LE, AE_STREAM_AUTOSTART | AE_STREAM_BYPASS_ADSP); 265 /// AudioEngineFormat format;
266 /// format.m_dataFormat = AE_FMT_FLOAT;
267 /// format.m_channelCount = 2;
268 /// format.m_channels[0] = AE_CH_FL;
269 /// format.m_channels[1] = AE_CH_FR;
270 /// format.m_channels[2] = AE_CH_NULL;
271 /// format.m_sampleRate = 48000;
272 /// format.m_frameSize = sizeof(float)*format.m_channelCount;
273 /// format.m_frames = 512;
274 /// CAddonAEStream* stream = new CAddonAEStream(format, AE_STREAM_AUTOSTART | AE_STREAM_BYPASS_ADSP);
265 /// 275 ///
266 /// ~~~~~~~~~~~~~ 276 /// ~~~~~~~~~~~~~
267 /// 277 ///
@@ -269,22 +279,27 @@ namespace audioengine
269 : m_kodiBase(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase), 279 : m_kodiBase(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase),
270 m_cb(::kodi::addon::CAddonBase::m_interface->toKodi->kodi_audioengine) 280 m_cb(::kodi::addon::CAddonBase::m_interface->toKodi->kodi_audioengine)
271 { 281 {
272 m_StreamHandle = m_cb->MakeStream(m_kodiBase, format, options); 282 m_StreamHandle = m_cb->make_stream(m_kodiBase, &format, options);
273 if (m_StreamHandle == nullptr) 283 if (m_StreamHandle == nullptr)
274 { 284 {
275 kodi::Log(ADDON_LOG_FATAL, "CAddonAEStream: MakeStream failed!"); 285 kodi::Log(ADDON_LOG_FATAL, "CAddonAEStream: make_stream failed!");
276 } 286 }
277 } 287 }
278 //-------------------------------------------------------------------------- 288 //--------------------------------------------------------------------------
279 289
290 //==========================================================================
291 /// @ingroup cpp_kodi_audioengine_CAddonAEStream
292 /// @brief Class destructor
293 ///
280 ~CAddonAEStream() 294 ~CAddonAEStream()
281 { 295 {
282 if (m_StreamHandle) 296 if (m_StreamHandle)
283 { 297 {
284 m_cb->FreeStream(m_kodiBase, m_StreamHandle); 298 m_cb->free_stream(m_kodiBase, m_StreamHandle);
285 m_StreamHandle = nullptr; 299 m_StreamHandle = nullptr;
286 } 300 }
287 } 301 }
302 //--------------------------------------------------------------------------
288 303
289 //========================================================================== 304 //==========================================================================
290 /// @ingroup cpp_kodi_audioengine_CAddonAEStream 305 /// @ingroup cpp_kodi_audioengine_CAddonAEStream
@@ -294,7 +309,7 @@ namespace audioengine
294 /// 309 ///
295 unsigned int GetSpace() 310 unsigned int GetSpace()
296 { 311 {
297 return m_cb->AEStream_GetSpace(m_kodiBase, m_StreamHandle); 312 return m_cb->aestream_get_space(m_kodiBase, m_StreamHandle);
298 } 313 }
299 //-------------------------------------------------------------------------- 314 //--------------------------------------------------------------------------
300 315
@@ -302,14 +317,15 @@ namespace audioengine
302 /// @ingroup cpp_kodi_audioengine_CAddonAEStream 317 /// @ingroup cpp_kodi_audioengine_CAddonAEStream
303 /// @brief Add planar or interleaved PCM data to the stream 318 /// @brief Add planar or interleaved PCM data to the stream
304 /// 319 ///
305 /// @param data array of pointers to the planes 320 /// @param[in] data array of pointers to the planes
306 /// @param offset to frame in frames 321 /// @param[in] offset to frame in frames
307 /// @param frames number of frames 322 /// @param[in] frames number of frames
323 /// @param[in] pts presentation timestamp
308 /// @return The number of frames consumed 324 /// @return The number of frames consumed
309 /// 325 ///
310 unsigned int AddData(uint8_t* const *data, unsigned int offset, unsigned int frames) 326 unsigned int AddData(uint8_t* const *data, unsigned int offset, unsigned int frames, double pts = 0.0)
311 { 327 {
312 return m_cb->AEStream_AddData(m_kodiBase, m_StreamHandle, data, offset, frames); 328 return m_cb->aestream_add_data(m_kodiBase, m_StreamHandle, data, offset, frames, pts);
313 } 329 }
314 //-------------------------------------------------------------------------- 330 //--------------------------------------------------------------------------
315 331
@@ -322,7 +338,7 @@ namespace audioengine
322 /// 338 ///
323 double GetDelay() 339 double GetDelay()
324 { 340 {
325 return m_cb->AEStream_GetDelay(m_kodiBase, m_StreamHandle); 341 return m_cb->aestream_get_delay(m_kodiBase, m_StreamHandle);
326 } 342 }
327 //-------------------------------------------------------------------------- 343 //--------------------------------------------------------------------------
328 344
@@ -334,7 +350,7 @@ namespace audioengine
334 /// 350 ///
335 bool IsBuffering() 351 bool IsBuffering()
336 { 352 {
337 return m_cb->AEStream_IsBuffering(m_kodiBase, m_StreamHandle); 353 return m_cb->aestream_is_buffering(m_kodiBase, m_StreamHandle);
338 } 354 }
339 //-------------------------------------------------------------------------- 355 //--------------------------------------------------------------------------
340 356
@@ -347,7 +363,7 @@ namespace audioengine
347 /// 363 ///
348 double GetCacheTime() 364 double GetCacheTime()
349 { 365 {
350 return m_cb->AEStream_GetCacheTime(m_kodiBase, m_StreamHandle); 366 return m_cb->aestream_get_cache_time(m_kodiBase, m_StreamHandle);
351 } 367 }
352 //-------------------------------------------------------------------------- 368 //--------------------------------------------------------------------------
353 369
@@ -359,7 +375,7 @@ namespace audioengine
359 /// 375 ///
360 double GetCacheTotal() 376 double GetCacheTotal()
361 { 377 {
362 return m_cb->AEStream_GetCacheTotal(m_kodiBase, m_StreamHandle); 378 return m_cb->aestream_get_cache_total(m_kodiBase, m_StreamHandle);
363 } 379 }
364 //-------------------------------------------------------------------------- 380 //--------------------------------------------------------------------------
365 381
@@ -369,7 +385,7 @@ namespace audioengine
369 /// 385 ///
370 void Pause() 386 void Pause()
371 { 387 {
372 return m_cb->AEStream_Pause(m_kodiBase, m_StreamHandle); 388 return m_cb->aestream_pause(m_kodiBase, m_StreamHandle);
373 } 389 }
374 //-------------------------------------------------------------------------- 390 //--------------------------------------------------------------------------
375 391
@@ -379,7 +395,7 @@ namespace audioengine
379 /// 395 ///
380 void Resume() 396 void Resume()
381 { 397 {
382 return m_cb->AEStream_Resume(m_kodiBase, m_StreamHandle); 398 return m_cb->aestream_resume(m_kodiBase, m_StreamHandle);
383 } 399 }
384 //-------------------------------------------------------------------------- 400 //--------------------------------------------------------------------------
385 401
@@ -392,9 +408,9 @@ namespace audioengine
392 /// 408 ///
393 /// @note Once called AddData will not consume more data. 409 /// @note Once called AddData will not consume more data.
394 /// 410 ///
395 void Drain(bool wait) 411 void Drain(bool wait = true)
396 { 412 {
397 return m_cb->AEStream_Drain(m_kodiBase, m_StreamHandle, wait=true); 413 return m_cb->aestream_drain(m_kodiBase, m_StreamHandle, wait);
398 } 414 }
399 //-------------------------------------------------------------------------- 415 //--------------------------------------------------------------------------
400 416
@@ -404,7 +420,7 @@ namespace audioengine
404 /// 420 ///
405 bool IsDraining() 421 bool IsDraining()
406 { 422 {
407 return m_cb->AEStream_IsDraining(m_kodiBase, m_StreamHandle); 423 return m_cb->aestream_is_draining(m_kodiBase, m_StreamHandle);
408 } 424 }
409 //-------------------------------------------------------------------------- 425 //--------------------------------------------------------------------------
410 426
@@ -414,7 +430,7 @@ namespace audioengine
414 /// 430 ///
415 bool IsDrained() 431 bool IsDrained()
416 { 432 {
417 return m_cb->AEStream_IsDrained(m_kodiBase, m_StreamHandle); 433 return m_cb->aestream_is_drained(m_kodiBase, m_StreamHandle);
418 } 434 }
419 //-------------------------------------------------------------------------- 435 //--------------------------------------------------------------------------
420 436
@@ -424,7 +440,7 @@ namespace audioengine
424 /// 440 ///
425 void Flush() 441 void Flush()
426 { 442 {
427 return m_cb->AEStream_Flush(m_kodiBase, m_StreamHandle); 443 return m_cb->aestream_flush(m_kodiBase, m_StreamHandle);
428 } 444 }
429 //-------------------------------------------------------------------------- 445 //--------------------------------------------------------------------------
430 446
@@ -436,7 +452,7 @@ namespace audioengine
436 /// 452 ///
437 float GetVolume() 453 float GetVolume()
438 { 454 {
439 return m_cb->AEStream_GetVolume(m_kodiBase, m_StreamHandle); 455 return m_cb->aestream_get_volume(m_kodiBase, m_StreamHandle);
440 } 456 }
441 //-------------------------------------------------------------------------- 457 //--------------------------------------------------------------------------
442 458
@@ -448,7 +464,7 @@ namespace audioengine
448 /// 464 ///
449 void SetVolume(float volume) 465 void SetVolume(float volume)
450 { 466 {
451 return m_cb->AEStream_SetVolume(m_kodiBase, m_StreamHandle, volume); 467 return m_cb->aestream_set_volume(m_kodiBase, m_StreamHandle, volume);
452 } 468 }
453 //-------------------------------------------------------------------------- 469 //--------------------------------------------------------------------------
454 470
@@ -460,7 +476,7 @@ namespace audioengine
460 /// 476 ///
461 float GetAmplification() 477 float GetAmplification()
462 { 478 {
463 return m_cb->AEStream_GetAmplification(m_kodiBase, m_StreamHandle); 479 return m_cb->aestream_get_amplification(m_kodiBase, m_StreamHandle);
464 } 480 }
465 //-------------------------------------------------------------------------- 481 //--------------------------------------------------------------------------
466 482
@@ -473,7 +489,7 @@ namespace audioengine
473 /// 489 ///
474 void SetAmplification(float amplify) 490 void SetAmplification(float amplify)
475 { 491 {
476 return m_cb->AEStream_SetAmplification(m_kodiBase, m_StreamHandle, amplify); 492 return m_cb->aestream_set_amplification(m_kodiBase, m_StreamHandle, amplify);
477 } 493 }
478 //-------------------------------------------------------------------------- 494 //--------------------------------------------------------------------------
479 495
@@ -485,7 +501,7 @@ namespace audioengine
485 /// 501 ///
486 unsigned int GetFrameSize() const 502 unsigned int GetFrameSize() const
487 { 503 {
488 return m_cb->AEStream_GetFrameSize(m_kodiBase, m_StreamHandle); 504 return m_cb->aestream_get_frame_size(m_kodiBase, m_StreamHandle);
489 } 505 }
490 //-------------------------------------------------------------------------- 506 //--------------------------------------------------------------------------
491 507
@@ -497,7 +513,7 @@ namespace audioengine
497 /// 513 ///
498 unsigned int GetChannelCount() const 514 unsigned int GetChannelCount() const
499 { 515 {
500 return m_cb->AEStream_GetChannelCount(m_kodiBase, m_StreamHandle); 516 return m_cb->aestream_get_channel_count(m_kodiBase, m_StreamHandle);
501 } 517 }
502 //-------------------------------------------------------------------------- 518 //--------------------------------------------------------------------------
503 519
@@ -511,7 +527,7 @@ namespace audioengine
511 /// 527 ///
512 unsigned int GetSampleRate() const 528 unsigned int GetSampleRate() const
513 { 529 {
514 return m_cb->AEStream_GetSampleRate(m_kodiBase, m_StreamHandle); 530 return m_cb->aestream_get_sample_rate(m_kodiBase, m_StreamHandle);
515 } 531 }
516 //-------------------------------------------------------------------------- 532 //--------------------------------------------------------------------------
517 533
@@ -523,7 +539,7 @@ namespace audioengine
523 /// 539 ///
524 AEDataFormat GetDataFormat() const 540 AEDataFormat GetDataFormat() const
525 { 541 {
526 return m_cb->AEStream_GetDataFormat(m_kodiBase, m_StreamHandle); 542 return m_cb->aestream_get_data_format(m_kodiBase, m_StreamHandle);
527 } 543 }
528 //-------------------------------------------------------------------------- 544 //--------------------------------------------------------------------------
529 545
@@ -537,7 +553,7 @@ namespace audioengine
537 /// 553 ///
538 double GetResampleRatio() 554 double GetResampleRatio()
539 { 555 {
540 return m_cb->AEStream_GetResampleRatio(m_kodiBase, m_StreamHandle); 556 return m_cb->aestream_get_resample_ratio(m_kodiBase, m_StreamHandle);
541 } 557 }
542 //-------------------------------------------------------------------------- 558 //--------------------------------------------------------------------------
543 559
@@ -553,7 +569,7 @@ namespace audioengine
553 /// 569 ///
554 void SetResampleRatio(double ratio) 570 void SetResampleRatio(double ratio)
555 { 571 {
556 m_cb->AEStream_SetResampleRatio(m_kodiBase, m_StreamHandle, ratio); 572 m_cb->aestream_set_resample_ratio(m_kodiBase, m_StreamHandle, ratio);
557 } 573 }
558 //-------------------------------------------------------------------------- 574 //--------------------------------------------------------------------------
559 575
@@ -572,7 +588,8 @@ namespace audioengine
572 /// 588 ///
573 inline bool GetCurrentSinkFormat(AudioEngineFormat &format) 589 inline bool GetCurrentSinkFormat(AudioEngineFormat &format)
574 { 590 {
575 return ::kodi::addon::CAddonBase::m_interface->toKodi->kodi_audioengine->GetCurrentSinkFormat(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, &format); 591 using namespace kodi::addon;
592 return CAddonBase::m_interface->toKodi->kodi_audioengine->get_current_sink_format(CAddonBase::m_interface->toKodi->kodiBase, &format);
576 } 593 }
577 //---------------------------------------------------------------------------- 594 //----------------------------------------------------------------------------
578 595