trtp_rtp_packet.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (C) 2012 Doubango Telecom <http://www.doubango.org>
  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 trtp_rtp_packet.h
  23. * @brief RTP packet.
  24. *
  25. * @author Mamadou Diop <diopmamadou(at)doubango.org>
  26. *
  27. */
  28. #ifndef TINYRTP_RTP_PACKET_H
  29. #define TINYRTP_RTP_PACKET_H
  30. #include "tinyrtp_config.h"
  31. #include "tinyrtp/rtp/trtp_rtp_header.h"
  32. #include "tsk_object.h"
  33. TRTP_BEGIN_DECLS
  34. typedef struct trtp_rtp_packet_s {
  35. TSK_DECLARE_OBJECT;
  36. trtp_rtp_header_t* header;
  37. struct {
  38. void* data;
  39. const void* data_const; // never free()d. an alternative to "data"
  40. tsk_size_t size;
  41. } payload;
  42. /* extension header as per RFC 3550 section 5.3.1 */
  43. struct {
  44. void* data;
  45. tsk_size_t size; /* contains the first two 16-bit fields */
  46. } extension;
  47. }
  48. trtp_rtp_packet_t;
  49. typedef tsk_list_t trtp_rtp_packets_L_t;
  50. TINYRTP_API trtp_rtp_packet_t* trtp_rtp_packet_create_null();
  51. TINYRTP_API trtp_rtp_packet_t* trtp_rtp_packet_create(uint32_t ssrc, uint16_t seq_num, uint32_t timestamp, uint8_t payload_type, tsk_bool_t marker);
  52. TINYRTP_API trtp_rtp_packet_t* trtp_rtp_packet_create_2(const trtp_rtp_header_t* header);
  53. TINYRTP_API tsk_size_t trtp_rtp_packet_guess_serialbuff_size(const trtp_rtp_packet_t *self);
  54. TINYRTP_API tsk_size_t trtp_rtp_packet_serialize_to(const trtp_rtp_packet_t *self, void* buffer, tsk_size_t size);
  55. TINYRTP_API tsk_buffer_t* trtp_rtp_packet_serialize(const trtp_rtp_packet_t *self, tsk_size_t num_bytes_pad);
  56. TINYRTP_API trtp_rtp_packet_t* trtp_rtp_packet_deserialize(const void *data, tsk_size_t size);
  57. TINYRTP_GEXTERN const tsk_object_def_t *trtp_rtp_packet_def_t;
  58. TRTP_END_DECLS
  59. #endif /* TINYRTP_RTP_PACKET_H */