The GstRTPBuffer helper functions makes it easy to parse and create regular Buffer objects that contain RTP
payloads.
These buffers are typically of 'application/x-rtp' Caps.
- public static void allocate_data (Buffer buffer, uint payload_len, uint8 pad_len, uint8 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
.
- public static uint calc_header_len (uint8 csrc_count)
Calculate the header length of an RTP packet with csrc_count
CSRC entries.
- public static uint calc_packet_len (uint payload_len, uint8 pad_len, uint8 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 static uint calc_payload_len (uint packet_len, uint8 pad_len, uint8 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 static int compare_seqnum (uint16 seqnum1, uint16 seqnum2)
Compare two sequence numbers, taking care of wraparounds.
- public static uint32 default_clock_rate (uint8 payload_type)
Get the default clock-rate for the static payload type
payload_type
.
- public static uint64 ext_timestamp (ref uint64 exttimestamp, uint32 timestamp)
Update the exttimestamp
field with the extended timestamp
of timestamp
For the first call of the method, exttimestamp
should point to a location with a value of -1.
- public static bool get_extension_onebyte_header_from_bytes (Bytes bytes, uint16 bit_pattern, uint8 id, uint nth, out unowned uint8[] data)
Similar to gst_rtp_buffer_get_extension_onebyte_header, but working on
the Bytes you get from gst_rtp_buffer_get_extension_bytes.
- public static bool map (Buffer buffer, MapFlags flags, out Buffer rtp)
Map the contents of buffer
into rtp
.
- public static Buffer new_allocate (uint payload_len, uint8 pad_len, uint8 csrc_count)
Allocate a new Buffer with enough data to
hold an RTP packet with csrc_count
CSRCs, a payload length of payload_len
and padding of pad_len
.
- public static Buffer new_allocate_len (uint packet_len, uint8 pad_len, uint8 csrc_count)
Create a new Buffer that can hold an RTP
packet that is exactly packet_len
long.
- public static Buffer new_copy_data (uint8[] data)
Create a new buffer and set the data to a copy of data.length
bytes of data
and the size to data.length
.
- public static Buffer new_take_data (owned uint8[] data)
Create a new buffer and set the data and size of the buffer to
data
and data.length
respectively.
- public bool add_extension_onebyte_header (uint8 id, uint8[] data)
Adds a RFC 5285 header extension with a one byte header to the end of
the RTP header.
- public bool add_extension_twobytes_header (uint8 appbits, uint8 id, uint8[] data)
Adds a RFC 5285 header extension with a two bytes header to the end of
the RTP header.
- public uint32 get_csrc (uint8 idx)
Get the CSRC at index idx
in buffer
.
- public uint8 get_csrc_count ()
Get the CSRC count of the RTP packet in buffer
.
- public bool get_extension ()
Check if the extension bit is set on the RTP packet in buffer
.
- public Bytes get_extension_bytes (out uint16 bits)
Similar to gst_rtp_buffer_get_extension_data, but more suitable for
language bindings usage.
- public bool get_extension_data (out uint16 bits, out unowned uint8[] data, out uint wordlen)
Get the extension data.
- public bool get_extension_onebyte_header (uint8 id, uint nth, out unowned uint8[] data)
Parses RFC 5285 style header extensions with a one byte header.
- public bool get_extension_twobytes_header (out uint8 appbits, uint8 id, uint nth, out unowned uint8[] data)
Parses RFC 5285 style header extensions with a two bytes header.
- public uint get_header_len ()
Return the total length of the header in buffer
.
- public bool get_marker ()
Check if the marker bit is set on the RTP packet in buffer
.
- public uint get_packet_len ()
Return the total length of the packet in buffer
.
- public bool get_padding ()
Check if the padding bit is set on the RTP packet in buffer
.
- public unowned uint8[] get_payload ()
Get a pointer to the payload data in buffer
.
- public Buffer get_payload_buffer ()
Create a buffer of the payload of the RTP packet in buffer
.
- public Bytes get_payload_bytes ()
Similar to gst_rtp_buffer_get_payload, but more suitable for language
bindings usage.
- public uint get_payload_len ()
Get the length of the payload of the RTP packet in buffer
.
- public Buffer get_payload_subbuffer (uint offset, uint len)
Create a subbuffer of the payload of the RTP packet in buffer
.
- public uint8 get_payload_type ()
Get the payload type of the RTP packet in buffer
.
- public uint16 get_seq ()
Get the sequence number of the RTP packet in buffer
.
- public uint32 get_ssrc ()
Get the SSRC of the RTP packet in buffer
.
- public uint32 get_timestamp ()
Get the timestamp of the RTP packet in buffer
.
- public uint8 get_version ()
Get the version number of the RTP packet in buffer
.
- public void pad_to (uint len)
Set the amount of padding in the RTP packet in buffer
to
len
.
- public void remove_extension_data ()
Unsets the extension bit of the RTP buffer and removes the extension
header and data.
- public void set_csrc (uint8 idx, uint32 csrc)
Modify the CSRC at index idx
in buffer
to
csrc
.
- public void set_extension (bool extension)
Set the extension bit on the RTP packet in buffer
to
extension
.
- public bool set_extension_data (uint16 bits, uint16 length)
Set the extension bit of the rtp buffer and fill in the bits
and length
of the extension header.
- public void set_marker (bool marker)
Set the marker bit on the RTP packet in buffer
to
marker
.
- public void set_packet_len (uint len)
Set the total this size to len
.
- public void set_padding (bool padding)
Set the padding bit on the RTP packet in buffer
to
padding
.
- public void set_payload_type (uint8 payload_type)
Set the payload type of the RTP packet in buffer
to
payload_type
.
- public void set_seq (uint16 seq)
Set the sequence number of the RTP packet in buffer
to
seq
.
- public void set_ssrc (uint32 ssrc)
Set the SSRC on the RTP packet in buffer
to ssrc
.
- public void set_timestamp (uint32 timestamp)
Set the timestamp of the RTP packet in buffer
to
timestamp
.
- public void set_version (uint8 version)
Set the version of the RTP packet in buffer
to
version
.
- public void unmap ()
Unmap this previously mapped with
map.