RTPBuffer

The GstRTPBuffer helper functions makes it easy to parse and create regular #GstBuffer objects that contain RTP payloads. These buffers are typically of 'application/x-rtp' #GstCaps.

class RTPBuffer {
GstRTPBuffer cInstance;
}

Members

Functions

addExtensionOnebyteHeader
bool addExtensionOnebyteHeader(ubyte id, ubyte[] data)

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 mechanism 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 gstrtp.rtpbuffer.RTPBuffer.addExtensionTwobytesHeader

addExtensionTwobytesHeader
bool addExtensionTwobytesHeader(ubyte appbits, ubyte id, ubyte[] data)

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 mechanism 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 gstrtp.rtpbuffer.RTPBuffer.addExtensionOnebyteHeader

getCsrc
uint getCsrc(ubyte idx)

Get the CSRC at index idx in buffer.

getCsrcCount
ubyte getCsrcCount()

Get the CSRC count of the RTP packet in buffer.

getExtension
bool getExtension()

Check if the extension bit is set on the RTP packet in buffer.

getExtensionData
glib.bytes.Bytes getExtensionData(ushort bits)

Similar to gst_rtp_buffer_get_extension_data, but more suitable for language bindings usage. bits will contain the extension 16 bits of custom data and the extension data (not including the extension header) is placed in a new #GBytes structure.

getExtensionOnebyteHeader
bool getExtensionOnebyteHeader(ubyte id, uint nth, ubyte[] data)

Parses RFC 5285 style header extensions with a one byte header. It will return the nth extension with the requested id.

getExtensionTwobytesHeader
bool getExtensionTwobytesHeader(ubyte appbits, ubyte id, uint nth, ubyte[] data)

Parses RFC 5285 style header extensions with a two bytes header. It will return the nth extension with the requested id.

getHeaderLen
uint getHeaderLen()

Return the total length of the header in buffer. This include the length of the fixed header, the CSRC list and the extension header.

getMarker
bool getMarker()

Check if the marker bit is set on the RTP packet in buffer.

getPacketLen
uint getPacketLen()

Return the total length of the packet in buffer.

getPadding
bool getPadding()

Check if the padding bit is set on the RTP packet in buffer.

getPayload
glib.bytes.Bytes getPayload()

Similar to gst_rtp_buffer_get_payload, but more suitable for language bindings usage. The return value is a pointer to a #GBytes structure containing the payload data in rtp.

getPayloadBuffer
gst.buffer.Buffer getPayloadBuffer()

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.

getPayloadLen
uint getPayloadLen()

Get the length of the payload of the RTP packet in buffer.

getPayloadSubbuffer
gst.buffer.Buffer getPayloadSubbuffer(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 is subbuffered.

getPayloadType
ubyte getPayloadType()

Get the payload type of the RTP packet in buffer.

getSeq
ushort getSeq()

Get the sequence number of the RTP packet in buffer.

getSsrc
uint getSsrc()

Get the SSRC of the RTP packet in buffer.

getTimestamp
uint getTimestamp()

Get the timestamp of the RTP packet in buffer.

getVersion
ubyte getVersion()

Get the version number of the RTP packet in buffer.

padTo
void padTo(uint len)

Set the amount of padding in the RTP packet in buffer to len. If len is 0, the padding is removed.

removeExtensionData
void removeExtensionData()

Unsets the extension bit of the RTP buffer and removes the extension header and data.

setCsrc
void setCsrc(ubyte idx, uint csrc)

Modify the CSRC at index idx in buffer to csrc.

setExtension
void setExtension(bool extension)

Set the extension bit on the RTP packet in buffer to extension.

setExtensionData
bool setExtensionData(ushort bits, ushort length)

Set the extension bit of the rtp buffer and fill in the bits and length of the extension header. If the existing extension data is not large enough, it will be made larger.

setMarker
void setMarker(bool marker)

Set the marker bit on the RTP packet in buffer to marker.

setPacketLen
void setPacketLen(uint len)

Set the total rtp size to len. The data in the buffer will be made larger if needed. Any padding will be removed from the packet.

setPadding
void setPadding(bool padding)

Set the padding bit on the RTP packet in buffer to padding.

setPayloadType
void setPayloadType(ubyte payloadType)

Set the payload type of the RTP packet in buffer to payload_type.

setSeq
void setSeq(ushort seq)

Set the sequence number of the RTP packet in buffer to seq.

setSsrc
void setSsrc(uint ssrc)

Set the SSRC on the RTP packet in buffer to ssrc.

setTimestamp
void setTimestamp(uint timestamp)

Set the timestamp of the RTP packet in buffer to timestamp.

setVersion
void setVersion(ubyte version_)

Set the version of the RTP packet in buffer to version.

unmap
void unmap()

Unmap rtp previously mapped with gstrtp.rtpbuffer.RTPBuffer.map.

Static functions

allocateData
void allocateData(gst.buffer.Buffer buffer, uint payloadLen, ubyte padLen, ubyte csrcCount)

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. buffer must be writable and all previous memory in buffer will be freed. If pad_len is >0, the padding bit will be set. All other RTP header fields will be set to 0/FALSE.

calcHeaderLen
uint calcHeaderLen(ubyte csrcCount)

Calculate the header length of an RTP packet with csrc_count CSRC entries. An RTP packet can have at most 15 CSRC entries.

calcPacketLen
uint calcPacketLen(uint payloadLen, ubyte padLen, ubyte csrcCount)

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.

calcPayloadLen
uint calcPayloadLen(uint packetLen, ubyte padLen, ubyte csrcCount)

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.

compareSeqnum
int compareSeqnum(ushort seqnum1, ushort seqnum2)

Compare two sequence numbers, taking care of wraparounds. This function returns the difference between seqnum1 and seqnum2.

defaultClockRate
uint defaultClockRate(ubyte payloadType)

Get the default clock-rate for the static payload type payload_type.

extTimestamp
ulong extTimestamp(ulong exttimestamp, uint 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.

getExtensionOnebyteHeaderFromBytes
bool getExtensionOnebyteHeaderFromBytes(glib.bytes.Bytes bytes, ushort bitPattern, ubyte id, uint nth, ubyte[] data)

Similar to gst_rtp_buffer_get_extension_onebyte_header, but working on the #GBytes you get from gst_rtp_buffer_get_extension_bytes. Parses RFC 5285 style header extensions with a one byte header. It will return the nth extension with the requested id.

map
bool map(gst.buffer.Buffer buffer, gst.types.MapFlags flags, gstrtp.rtpbuffer.RTPBuffer rtp)

Map the contents of buffer into rtp.

newAllocate
gst.buffer.Buffer newAllocate(uint payloadLen, ubyte padLen, ubyte csrcCount)

Allocate a new #GstBuffer with enough data to hold an RTP packet with csrc_count CSRCs, a payload length of payload_len and padding of pad_len. All other RTP header fields will be set to 0/FALSE.

newAllocateLen
gst.buffer.Buffer newAllocateLen(uint packetLen, ubyte padLen, ubyte csrcCount)

Create a new #GstBuffer that can hold an RTP packet that is exactly packet_len long. The length of the payload depends on pad_len and csrc_count and can be calculated with gstrtp.rtpbuffer.RTPBuffer.calcPayloadLen. All RTP header fields will be set to 0/FALSE.

newCopyData
gst.buffer.Buffer newCopyData(ubyte[] data)

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.