tdav_consumer_video.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (C) 2011 Doubango Telecom <http://www.doubango.org>
  3. *
  4. * Contact: Mamadou Diop <diopmamadou [at) doubango (DOT) 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_video.h
  23. * @brief Base class for all Video consumers.
  24. *
  25. * @author Mamadou Diop <diopmamadou [at) doubango (DOT) org>
  26. */
  27. #ifndef TINYDAV_CONSUMER_VIDEO_H
  28. #define TINYDAV_CONSUMER_VIDEO_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_VIDEO(self) ((tdav_consumer_video_t*)(self))
  34. typedef struct tdav_consumer_video_s {
  35. TMEDIA_DECLARE_CONSUMER;
  36. struct tmedia_jitterbuffer_s* jitterbuffer;
  37. TSK_DECLARE_SAFEOBJ;
  38. }
  39. tdav_consumer_video_t;
  40. TINYDAV_API int tdav_consumer_video_init(tdav_consumer_video_t* self);
  41. TINYDAV_API int tdav_consumer_video_cmp(const tsk_object_t* consumer1, const tsk_object_t* consumer2);
  42. #define tdav_consumer_video_prepare(self, codec) tmedia_consumer_prepare(TDAV_CONSUMER_VIDEO(self), codec)
  43. #define tdav_consumer_video_start(self) tmedia_consumer_start(TDAV_CONSUMER_VIDEO(self))
  44. #define tdav_consumer_video_consume(self, buffer, size) tmedia_consumer_consume(TDAV_CONSUMER_VIDEO(self), buffer, size)
  45. #define tdav_consumer_video_pause(self) tmedia_consumer_pause(TDAV_CONSUMER_VIDEO(self))
  46. #define tdav_consumer_video_stop(self) tmedia_consumer_stop(TDAV_CONSUMER_VIDEO(self))
  47. #define tdav_consumer_video_has_jb(self) ((self) && (self)->jitterbuffer)
  48. TINYDAV_API int tdav_consumer_video_set(tdav_consumer_video_t* self, const tmedia_param_t* param);
  49. TINYDAV_API int tdav_consumer_video_put(tdav_consumer_video_t* self, const void* data, tsk_size_t data_size, const tsk_object_t* proto_hdr);
  50. TINYDAV_API tsk_size_t tdav_consumer_video_get(tdav_consumer_video_t* self, void* out_data, tsk_size_t out_size);
  51. TINYDAV_API int tdav_consumer_video_tick(tdav_consumer_video_t* self);
  52. TINYDAV_API int tdav_consumer_video_reset(tdav_consumer_video_t* self);
  53. TINYDAV_API int tdav_consumer_video_deinit(tdav_consumer_video_t* self);
  54. #define TDAV_DECLARE_CONSUMER_VIDEO tdav_consumer_video_t __consumer_video__
  55. TDAV_END_DECLS
  56. #endif /* TINYDAV_CONSUMER_VIDEO_H */