4 #include <tins/endianness.h>
6 #include <tins/pdu_option.h>
7 #include <tins/small_uint.h>
47 RTP(
const uint8_t* data, uint32_t size);
87 uint32_t
timestamp()
const {
return Endian::be_to_host(header_.timestamp); }
92 uint32_t
ssrc_id()
const {
return Endian::be_to_host(header_.ssrc_id); }
151 void sequence_number(uint16_t seq_num) { header_.seq_num = Endian::host_to_be(seq_num); }
157 void timestamp(uint32_t timestamp) { header_.timestamp = Endian::host_to_be(timestamp); }
163 void ssrc_id(uint32_t ssrc_id) { header_.ssrc_id = Endian::host_to_be(ssrc_id); }
170 padding_bit(size > 0);
171 padding_size_ = size;
187 void add_extension_data(
const uint32_t value);
198 bool remove_extension_data(
const uint32_t value);
205 bool search_extension_data(
const uint32_t value);
215 void add_csrc_id(
const uint32_t csrc_id);
226 bool remove_csrc_id(
const uint32_t value);
233 bool search_csrc_id(
const uint32_t value);
243 uint32_t header_size()
const;
253 uint32_t
trailer_size()
const {
return static_cast<uint32_t
>(padding_size_); }
269 #if TINS_IS_BIG_ENDIAN
276 #elif TINS_IS_LITTLE_ENDIAN
277 uint16_t csrc_count:4,
290 struct rtp_extension_header {
295 void write_serialization(uint8_t* buffer, uint32_t size);
296 csrc_ids_type::const_iterator search_csrc_id_iterator(
const uint32_t csrc_id)
const;
297 csrc_ids_type::iterator search_csrc_id_iterator(
const uint32_t csrc_id);
298 extension_header_data_type::const_iterator search_extension_data_iterator(
const uint32_t data)
const;
299 extension_header_data_type::iterator search_extension_data_iterator(
const uint32_t data);
305 void padding_bit(small_uint<1> padding) { header_.padding = padding; }
311 void csrc_count(small_uint<4> csrc_count) { header_.csrc_count = csrc_count; }
317 void extension_length(uint16_t length) { ext_header_.length = Endian::host_to_be(length); }
320 csrc_ids_type csrc_ids_;
321 rtp_extension_header ext_header_;
322 extension_header_data_type ext_data_;
323 uint8_t padding_size_;
Base class for protocol data units.
Definition: pdu.h:107
PDUType
Enum which identifies each type of PDU.
Definition: pdu.h:127
Represents a RTP PDU.
Definition: rtp.h:19
const csrc_ids_type & csrc_ids() const
Getter for the CSRC identifiers.
Definition: rtp.h:97
std::vector< uint32_t > extension_header_data_type
Definition: rtp.h:34
void sequence_number(uint16_t seq_num)
Setter for the sequence number.
Definition: rtp.h:151
small_uint< 1 > padding_bit() const
Getter for the padding bit.
Definition: rtp.h:57
small_uint< 4 > csrc_count() const
Getter for the CSRC count.
Definition: rtp.h:67
void ssrc_id(uint32_t ssrc_id)
Setter for the SSRC identifier.
Definition: rtp.h:163
uint32_t ssrc_id() const
Getter for the SSRC identifier.
Definition: rtp.h:92
std::vector< uint32_t > csrc_ids_type
Definition: rtp.h:29
uint16_t extension_length() const
Getter for the extension header length.
Definition: rtp.h:114
uint32_t trailer_size() const
Returns the RTP packet's trailer length.
Definition: rtp.h:253
void payload_type(small_uint< 7 > payload_type)
Setter for the payload type.
Definition: rtp.h:145
small_uint< 7 > payload_type() const
Getter for the payload type.
Definition: rtp.h:77
uint8_t padding_size() const
Getter for the padding size.
Definition: rtp.h:104
RTP * clone() const
Definition: rtp.h:264
small_uint< 1 > extension_bit() const
Getter for the extension bit.
Definition: rtp.h:62
void extension_bit(small_uint< 1 > extension)
Setter for the extension bit.
Definition: rtp.h:133
void extension_profile(uint16_t profile)
Setter for the extension header profile.
Definition: rtp.h:178
small_uint< 1 > marker_bit() const
Getter for the marker bit.
Definition: rtp.h:72
const extension_header_data_type & extension_data() const
Getter for the extension header data.
Definition: rtp.h:119
void version(small_uint< 2 > version)
Setter for the version.
Definition: rtp.h:127
uint32_t timestamp() const
Getter for the timestamp.
Definition: rtp.h:87
uint16_t sequence_number() const
Getter for the sequence number.
Definition: rtp.h:82
uint16_t extension_profile() const
Getter for the extension header profile.
Definition: rtp.h:109
PDUType pdu_type() const
Getter for the PDU's type.
Definition: rtp.h:259
void timestamp(uint32_t timestamp)
Setter for the timestamp.
Definition: rtp.h:157
void padding_size(uint8_t size)
Setter for the padding size.
Definition: rtp.h:169
small_uint< 2 > version() const
Getter for the version.
Definition: rtp.h:52
void marker_bit(small_uint< 1 > marker)
Setter for the marker bit.
Definition: rtp.h:139
The Tins namespace.
Definition: address_range.h:38