tdav_consumer_audio.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. /**@file tdav_consumer_audio.h
  23. * @brief Base class for all Audio consumers.
  24. *
  25. * @author Mamadou Diop <diopmamadou(at)doubango.org>
  26. */
  27. #ifndef TINYDAV_CONSUMER_AUDIO_H
  28. #define TINYDAV_CONSUMER_AUDIO_H
  29. #include "tinydav_config.h"
  30. #include "tinymedia/tmedia_consumer.h"
  31. #include "tsk_safeobj.h"
  32. TDAV_BEGIN_DECLS
  33. #define TDAV_CONSUMER_AUDIO(self) ((tdav_consumer_audio_t*)(self))
  34. typedef struct tdav_consumer_audio_s {
  35. TMEDIA_DECLARE_CONSUMER;
  36. struct tmedia_denoise_s* denoise;
  37. struct tmedia_resampler_s* resampler;
  38. struct tmedia_jitterbuffer_s* jitterbuffer;
  39. TSK_DECLARE_SAFEOBJ;
  40. }
  41. tdav_consumer_audio_t;
  42. TINYDAV_API int tdav_consumer_audio_init(tdav_consumer_audio_t* self);
  43. TINYDAV_API int tdav_consumer_audio_cmp(const tsk_object_t* consumer1, const tsk_object_t* consumer2);
  44. #define tdav_consumer_audio_prepare(self, codec) tmedia_consumer_prepare(TDAV_CONSUMER_AUDIO(self), codec)
  45. #define tdav_consumer_audio_start(self) tmedia_consumer_start(TDAV_CONSUMER_AUDIO(self))
  46. #define tdav_consumer_audio_consume(self, buffer, size) tmedia_consumer_consume(TDAV_CONSUMER_AUDIO(self), buffer, size)
  47. #define tdav_consumer_audio_pause(self) tmedia_consumer_pause(TDAV_CONSUMER_AUDIO(self))
  48. #define tdav_consumer_audio_stop(self) tmedia_consumer_stop(TDAV_CONSUMER_AUDIO(self))
  49. TINYDAV_API int tdav_consumer_audio_set(tdav_consumer_audio_t* self, const tmedia_param_t* param);
  50. TINYDAV_API int tdav_consumer_audio_put(tdav_consumer_audio_t* self, const void* data, tsk_size_t data_size, const tsk_object_t* proto_hdr);
  51. TINYDAV_API tsk_size_t tdav_consumer_audio_get(tdav_consumer_audio_t* self, void* out_data, tsk_size_t out_size);
  52. TINYDAV_API int tdav_consumer_audio_tick(tdav_consumer_audio_t* self);
  53. void tdav_consumer_audio_set_denoise(tdav_consumer_audio_t* self, struct tmedia_denoise_s* denoise);
  54. void tdav_consumer_audio_set_jitterbuffer(tdav_consumer_audio_t* self, struct tmedia_jitterbuffer_s* jitterbuffer);
  55. TINYDAV_API int tdav_consumer_audio_reset(tdav_consumer_audio_t* self);
  56. TINYDAV_API int tdav_consumer_audio_deinit(tdav_consumer_audio_t* self);
  57. #define TDAV_DECLARE_CONSUMER_AUDIO tdav_consumer_audio_t __consumer_audio__
  58. TDAV_END_DECLS
  59. #endif /* TINYDAV_CONSUMER_AUDIO_H */