-
public bool rtcp_buffer_add_packet (Buffer buffer, RTCPType type, ref RTCPPacket packet)
Add a new packet of type to buffer. packet will point to the
newly created packet. if the max mtu is exceeded for the buffer.
-
public void rtcp_buffer_end (Buffer buffer)
Finish buffer after being constructured. This function is usually called after
rtcp_buffer_new and after adding the RTCP items to the new buffer. The function
adjusts the size of buffer with the total length of all the added packets.
-
public bool rtcp_buffer_get_first_packet (Buffer buffer, ref RTCPPacket packet)
Initialize a new RTCPPacket pointer that points to the
first packet in
-
public uint rtcp_buffer_get_packet_count (Buffer buffer)
Get the number of RTCP packets in buffer.
-
public weak Buffer rtcp_buffer_new (uint mtu)
Create a new buffer for constructing RTCP packets. The packet will have a maximum size of mtu
.
-
public weak Buffer rtcp_buffer_new_copy_data (void* data, uint len)
Create a new buffer and set the data to a copy of len bytes of data and the
size to len. The data will be freed when the buffer is freed.
-
public weak Buffer rtcp_buffer_new_take_data (void* data, uint len)
Create a new buffer and set the data and size of the buffer to data and len
respectively. data will be freed when the buffer is unreffed, so this function transfers ownership of data
to the new buffer.
-
public bool rtcp_buffer_validate (Buffer buffer)
-
public bool rtcp_buffer_validate_data (uchar data, uint len)
Check if the data and size point to the data of a valid RTCP (compound)
packet. Use this function to validate a packet before using the other functions in this module.
-
public uint64 rtcp_ntp_to_unix (uint64 ntptime)
Converts an NTP time to UNIX nanoseconds. ntptime can typically be the NTP time of an SR
RTCP message and contains, in the upper 32 bits, the number of seconds since 1900 and, in the lower 32 bits, the fractional seconds.
The resulting value will be the number of nanoseconds since 1970.
-
public RTCPSDESType rtcp_sdes_name_to_type (string name)
Convert name into a GstRTCPSDESType. name is typically a key in a
Structure containing SDES items. is a private sdes item.
-
public unowned string rtcp_sdes_type_to_name (RTCPSDESType type)
Converts type to the string equivalent. The string is typically used as a key in a
Structure containing SDES items.
-
public uint64 rtcp_unix_to_ntp (uint64 unixtime)
Converts a UNIX timestamp in nanoseconds to an NTP time. The caller should pass a value with nanoseconds
since 1970. The NTP time will, in the upper 32 bits, contain the number of seconds since 1900 and, in the lower 32 bits, the
fractional seconds. The resulting value can be used as an ntptime for constructing SR RTCP packets.
-
public bool rtp_buffer_add_extension_onebyte_header (Buffer buffer, uchar id, void* data, uint size)
Adds a RFC 5285 header extension with a one byte header to the end of the RTP header. If there is
already a RFC 5285 header extension with a one byte header, the new extension will be appended. It will not work if there is already a
header extension that does not follow the mecanism described in RFC 5285 or if there is a header extension with a two bytes header as
described in RFC 5285. In that case, use
rtp_buffer_add_extension_twobytes_header
-
public bool rtp_buffer_add_extension_twobytes_header (Buffer buffer, uchar appbits, uchar id, void* data, uint size)
Adds a RFC 5285 header extension with a two bytes header to the end of the RTP header. If there is
already a RFC 5285 header extension with a two bytes header, the new extension will be appended. It will not work if there is already
a header extension that does not follow the mecanism described in RFC 5285 or if there is a header extension with a one byte header as
described in RFC 5285. In that case, use
rtp_buffer_add_extension_onebyte_header
-
public void rtp_buffer_allocate_data (Buffer buffer, uint payload_len, uchar pad_len, uchar csrc_count)
Allocate enough data in buffer to hold an RTP packet with csrc_count CSRCs, a
payload length of payload_len and padding of pad_len. MALLOCDATA of buffer will be overwritten
and will not be freed. All other RTP header fields will be set to 0/FALSE.
-
public uint rtp_buffer_calc_header_len (uchar csrc_count)
Calculate the header length of an RTP packet with csrc_count CSRC entries. An RTP packet
can have at most 15 CSRC entries.
-
public uint rtp_buffer_calc_packet_len (uint payload_len, uchar pad_len, uchar csrc_count)
Calculate the total length of an RTP packet with a payload size of payload_len, a padding
of pad_len and a csrc_count CSRC entries.
-
public uint rtp_buffer_calc_payload_len (uint packet_len, uchar pad_len, uchar csrc_count)
Calculate the length of the payload of an RTP packet with size packet_len, a padding of
pad_len and a csrc_count CSRC entries.
-
public int rtp_buffer_compare_seqnum (uint16 seqnum1, uint16 seqnum2)
Compare two sequence numbers, taking care of wraparounds. This function returns the difference between
seqnum1 and seqnum2. are equal or a positive value if seqnum1 is smaller than segnum2
.
-
public uint32 rtp_buffer_default_clock_rate (uchar payload_type)
Get the default clock-rate for the static payload type payload_type. the clock-rate is
undefined.
-
public uint64 rtp_buffer_ext_timestamp (uint64 exttimestamp, uint32 timestamp)
Update the exttimestamp field with timestamp. For the first call of the
method, exttimestamp should point to a location with a value of -1. This function makes sure that the returned value is a
constantly increasing value even in the case where there is a timestamp wraparound.
-
public uint32 rtp_buffer_get_csrc (Buffer buffer, uchar idx)
Get the CSRC at index idx in buffer.
-
public uchar rtp_buffer_get_csrc_count (Buffer buffer)
Get the CSRC count of the RTP packet in buffer.
-
public bool rtp_buffer_get_extension (Buffer buffer)
Check if the extension bit is set on the RTP packet in buffer.
-
public bool rtp_buffer_get_extension_data (Buffer buffer, out uint16 bits, out void* data, out uint wordlen)
Get the extension data. bits will contain the extension 16 bits of custom data. data
will point to the data in the extension and wordlen will contain the length of data in 32 bits
words. If buffer did not contain an extension, this function will return false with bits,
data and wordlen unchanged.
-
public bool rtp_buffer_get_extension_onebyte_header (Buffer buffer, uchar id, uint nth, void* data, uint size)
Parses RFC 5285 style header extensions with a one byte header. It will return the nth extension with
the requested id.
-
public bool rtp_buffer_get_extension_twobytes_header (Buffer buffer, uchar appbits, uchar id, uint nth, void* data, uint size)
Parses RFC 5285 style header extensions with a two bytes header. It will return the nth extension with
the requested id.
-
public uint rtp_buffer_get_header_len (Buffer buffer)
Return the total length of the header in buffer. This include the length of the fixed
header, the CSRC list and the extension header.
-
public bool rtp_buffer_get_marker (Buffer buffer)
Check if the marker bit is set on the RTP packet in buffer.
-
public uint rtp_buffer_get_packet_len (Buffer buffer)
Return the total length of the packet in buffer.
-
public bool rtp_buffer_get_padding (Buffer buffer)
Check if the padding bit is set on the RTP packet in buffer.
-
public void* rtp_buffer_get_payload (Buffer buffer)
Get a pointer to the payload data in buffer. This pointer is valid as long as a reference
to buffer is held.
-
public weak Buffer rtp_buffer_get_payload_buffer (Buffer buffer)
Create a buffer of the payload of the RTP packet in buffer. This function will internally
create a subbuffer of buffer so that a memcpy can be avoided.
-
public uint rtp_buffer_get_payload_len (Buffer buffer)
Get the length of the payload of the RTP packet in buffer.
-
public weak Buffer rtp_buffer_get_payload_subbuffer (Buffer buffer, uint offset, uint len)
Create a subbuffer of the payload of the RTP packet in buffer. offset bytes
are skipped in the payload and the subbuffer will be of size len. If len is -1 the total payload starting
from offset if subbuffered.
-
public uchar rtp_buffer_get_payload_type (Buffer buffer)
Get the payload type of the RTP packet in buffer.
-
public uint16 rtp_buffer_get_seq (Buffer buffer)
Get the sequence number of the RTP packet in buffer.
-
public uint32 rtp_buffer_get_ssrc (Buffer buffer)
Get the SSRC of the RTP packet in buffer.
-
public uint32 rtp_buffer_get_timestamp (Buffer buffer)
Get the timestamp of the RTP packet in buffer.
-
public uchar rtp_buffer_get_version (Buffer buffer)
Get the version number of the RTP packet in buffer.
-
public bool rtp_buffer_list_add_extension_onebyte_header (BufferListIterator it, uchar id, void* data, uint size)
Adds a RFC 5285 header extension with a one byte header to the end of the RTP header. If there is
already a RFC 5285 header extension with a one byte header, the new extension will be appended. It will not work if there is already a
header extension that does not follow the mecanism described in RFC 5285 or if there is a header extension with a two bytes header as
described in RFC 5285. In that case, use
rtp_buffer_list_add_extension_twobytes_header This function will not modify the data section of the RTP buffer, only the header.
-
public bool rtp_buffer_list_add_extension_twobytes_header (BufferListIterator it, uchar appbits, uchar id, void* data, uint size)
Adds a RFC 5285 header extension with a two bytes header to the end of the RTP header. If there is
already a RFC 5285 header extension with a two bytes header, the new extension will be appended. It will not work if there is already
a header extension that does not follow the mecanism described in RFC 5285 or if there is a header extension with a one byte header as
described in RFC 5285. In that case, use
rtp_buffer_add_extension_onebyte_header This function will not modify the data section of the RTP buffer, only the header.
-
public weak BufferList rtp_buffer_list_from_buffer (Buffer buffer)
Splits a Buffer into a
BufferList containing separate buffers for the header and data
sections.
-
public bool rtp_buffer_list_get_extension_onebyte_header (BufferList bufferlist, uint group_idx, uchar id, uint nth, void* data, uint size)
Parses RFC 5285 style header extensions with a one byte header. It will return the nth extension with
the requested id.
-
public bool rtp_buffer_list_get_extension_twobytes_header (BufferList bufferlist, uint group_idx, uchar appbits, uchar id, uint nth, void* data, uint size)
Parses RFC 5285 style header extensions with a two bytes header. It will return the nth extension with
the requested id.
-
public uint rtp_buffer_list_get_payload_len (BufferList list)
Get the length of the payload of the RTP packet in list.
-
public uchar rtp_buffer_list_get_payload_type (BufferList list)
Get the payload type of the first RTP packet in list. All packets in list
should have the same payload type.
-
public uint16 rtp_buffer_list_get_seq (BufferList list)
Get the sequence number of the first RTP packet in list. All packets within list
have the same sequence number.
-
public uint32 rtp_buffer_list_get_ssrc (BufferList list)
Get the SSRC of the first RTP packet in list. All RTP packets within list have
the same SSRC.
-
public uint32 rtp_buffer_list_get_timestamp (BufferList list)
Get the timestamp of the first RTP packet in list. All packets within list
have the same timestamp.
-
public void rtp_buffer_list_set_payload_type (BufferList list, uchar payload_type)
Set the payload type of each RTP packet in list to payload_type.
-
public uint16 rtp_buffer_list_set_seq (BufferList list, uint16 seq)
Set the sequence number of each RTP packet in list to seq.
-
public void rtp_buffer_list_set_ssrc (BufferList list, uint32 ssrc)
Set the SSRC on each RTP packet in list to ssrc.
-
public void rtp_buffer_list_set_timestamp (BufferList list, uint32 timestamp)
Set the timestamp of each RTP packet in list to timestamp.
-
public bool rtp_buffer_list_validate (BufferList list)
Check if all RTP packets in the list are valid using validate_data. Use this
function to validate an list before using the other functions in this module.
-
public weak Buffer rtp_buffer_new_allocate (uint payload_len, uchar pad_len, uchar csrc_count)
Allocate a new Buffer with enough data to
hold an RTP packet with All other RTP header fields will be set to 0/FALSE. parameters.
-
public weak Buffer rtp_buffer_new_allocate_len (uint packet_len, uchar pad_len, uchar csrc_count)
Create a new Buffer that can hold an RTP
packet that is exactly All RTP header fields will be set to 0/FALSE.
-
public weak Buffer rtp_buffer_new_copy_data (void* data, uint len)
Create a new buffer and set the data to a copy of len bytes of data and the
size to len. The data will be freed when the buffer is freed.
-
public weak Buffer rtp_buffer_new_take_data (void* data, uint len)
Create a new buffer and set the data and size of the buffer to data and len
respectively. data will be freed when the buffer is unreffed, so this function transfers ownership of data
to the new buffer.
-
public void rtp_buffer_pad_to (Buffer buffer, uint len)
Set the amount of padding in the RTP packet in buffer to
-
public void rtp_buffer_set_csrc (Buffer buffer, uchar idx, uint32 csrc)
Modify the CSRC at index idx in buffer to csrc.
-
public void rtp_buffer_set_extension (Buffer buffer, bool extension)
Set the extension bit on the RTP packet in buffer to extension.
-
public bool rtp_buffer_set_extension_data (Buffer buffer, uint16 bits, uint16 length)
Set the extension bit of the rtp buffer and fill in the bits and length of the
extension header. It will refuse to set the extension data if the buffer is not large enough.
-
public void rtp_buffer_set_marker (Buffer buffer, bool marker)
Set the marker bit on the RTP packet in buffer to marker.
-
public void rtp_buffer_set_packet_len (Buffer buffer, uint len)
Set the total buffer size to len. The data in the buffer will be made larger
if needed. Any padding will be removed from the packet.
-
public void rtp_buffer_set_padding (Buffer buffer, bool padding)
Set the padding bit on the RTP packet in buffer to padding.
-
public void rtp_buffer_set_payload_type (Buffer buffer, uchar payload_type)
Set the payload type of the RTP packet in buffer to payload_type.
-
public void rtp_buffer_set_seq (Buffer buffer, uint16 seq)
Set the sequence number of the RTP packet in buffer to seq.
-
public void rtp_buffer_set_ssrc (Buffer buffer, uint32 ssrc)
Set the SSRC on the RTP packet in buffer to ssrc.
-
public void rtp_buffer_set_timestamp (Buffer buffer, uint32 timestamp)
Set the timestamp of the RTP packet in buffer to timestamp.
-
public void rtp_buffer_set_version (Buffer buffer, uchar version)
Set the version of the RTP packet in buffer to version.
-
public bool rtp_buffer_validate (Buffer buffer)
Check if the data pointed to by buffer is a valid RTP packet using validate_data
. Use this function to validate a packet before using the other functions in this module.
-
public bool rtp_buffer_validate_data (uchar data, uint len)
Check if the data and size point to the data of a valid RTP packet. This
function checks the length, version and padding of the packet data. Use this function to validate a packet before using the other
functions in this module.