tdav_audiounit.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (C) 2010-2011 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango.org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with DOUBANGO.
  20. *
  21. */
  22. #ifndef TDAV_AUDIO_UNIT_H
  23. #define TDAV_AUDIO_UNIT_H
  24. #include "tinydav_config.h"
  25. #if HAVE_COREAUDIO_AUDIO_UNIT
  26. #include <AudioUnit/AudioUnit.h>
  27. #include <AudioToolbox/AudioToolbox.h>
  28. #include "tsk_object.h"
  29. TDAV_BEGIN_DECLS
  30. #if TARGET_OS_MAC
  31. # if AUDIO_UNIT_VERSION < 1060
  32. # define AudioComponent Component
  33. # define AudioComponentInstance ComponentInstance
  34. # define AudioComponentDescription ComponentDescription
  35. # define AudioComponentFindNext FindNextComponent
  36. # define AudioComponentInstanceNew OpenAComponent
  37. # define AudioComponentInstanceDispose CloseComponent
  38. # endif
  39. #endif /* TARGET_OS_MAC */
  40. typedef void* tdav_audiounit_handle_t;
  41. tdav_audiounit_handle_t* tdav_audiounit_handle_create(uint64_t session_id);
  42. AudioComponentInstance tdav_audiounit_handle_get_instance(tdav_audiounit_handle_t* self);
  43. int tdav_audiounit_handle_signal_consumer_ready(tdav_audiounit_handle_t* self);
  44. int tdav_audiounit_handle_signal_producer_ready(tdav_audiounit_handle_t* self);
  45. int tdav_audiounit_handle_start(tdav_audiounit_handle_t* self);
  46. uint32_t tdav_audiounit_handle_get_frame_duration(tdav_audiounit_handle_t* self);
  47. int tdav_audiounit_handle_configure(tdav_audiounit_handle_t* self, tsk_bool_t consumer, uint32_t ptime, AudioStreamBasicDescription* audioFormat);
  48. int tdav_audiounit_handle_mute(tdav_audiounit_handle_t* self, tsk_bool_t mute);
  49. int tdav_audiounit_handle_interrupt(tdav_audiounit_handle_t* self, tsk_bool_t interrupt);
  50. int tdav_audiounit_handle_stop(tdav_audiounit_handle_t* self);
  51. int tdav_audiounit_handle_destroy(tdav_audiounit_handle_t** self);
  52. TDAV_END_DECLS
  53. #endif /* HAVE_COREAUDIO_AUDIO_UNIT */
  54. #endif /* TDAV_AUDIO_UNIT_H */