Functions¶
Details¶
- GstRtp.buffer_add_rtp_source_meta(buffer, ssrc, csrc)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
- Returns:
the
GstRtp.RTPSourceMeta
on buffer.- Return type:
Attaches RTP source information to buffer.
New in version 1.16.
- GstRtp.buffer_get_rtp_source_meta(buffer)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
- Returns:
the
GstRtp.RTPSourceMeta
orNone
when there is no such metadata on buffer.- Return type:
Find the
GstRtp.RTPSourceMeta
on buffer.New in version 1.16.
- GstRtp.rtcp_buffer_map(buffer, flags, rtcp)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – a buffer with an RTCP packetflags (
Gst.MapFlags
) – flags for the mappingrtcp (
GstRtp.RTCPBuffer
) – resultingGstRtp.RTCPBuffer
- Return type:
Open buffer for reading or writing, depending on flags. The resulting RTCP buffer state is stored in rtcp.
- GstRtp.rtcp_buffer_new(mtu)[source]¶
- Parameters:
mtu (
int
) – the maximum mtu size.- Returns:
A newly allocated buffer.
- Return type:
Create a new buffer for constructing RTCP packets. The packet will have a maximum size of mtu.
- GstRtp.rtcp_buffer_new_copy_data(data)[source]¶
- Parameters:
data (
bytes
) – data for the new buffer- Returns:
A newly allocated buffer with a copy of data and of size len.
- Return type:
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.
- GstRtp.rtcp_buffer_new_take_data(data)[source]¶
- Parameters:
data (
bytes
) – data for the new buffer- Returns:
A newly allocated buffer with data and of size len.
- Return type:
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.
- GstRtp.rtcp_buffer_validate(buffer)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – the buffer to validate- Returns:
True
if buffer is a valid RTCP packet.- Return type:
Check if the data pointed to by buffer is a valid RTCP packet using
GstRtp.RTCPBuffer.validate_data
().
- GstRtp.rtcp_buffer_validate_data(data)[source]¶
- Parameters:
data (
bytes
) – the data to validate- Returns:
True
if the data points to a valid RTCP packet.- Return type:
Check if the data and size point to the data of a valid compound, non-reduced size RTCP packet. Use this function to validate a packet before using the other functions in this module.
- GstRtp.rtcp_buffer_validate_data_reduced(data)[source]¶
- Parameters:
data (
bytes
) – the data to validate- Returns:
True
if the data points to a valid RTCP packet.- Return type:
Check if the data and size point to the data of a valid RTCP packet. Use this function to validate a packet before using the other functions in this module.
This function is updated to support reduced size rtcp packets according to RFC 5506 and will validate full compound RTCP packets as well as reduced size RTCP packets.
New in version 1.6.
- GstRtp.rtcp_buffer_validate_reduced(buffer)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – the buffer to validate- Returns:
True
if buffer is a valid RTCP packet.- Return type:
Check if the data pointed to by buffer is a valid RTCP packet using
GstRtp.RTCPBuffer.validate_reduced
().New in version 1.6.
- GstRtp.rtcp_ntp_to_unix(ntptime)[source]¶
- Parameters:
ntptime (
int
) – an NTP timestamp- Returns:
the UNIX time for ntptime in nanoseconds.
- Return type:
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.
- GstRtp.rtcp_sdes_name_to_type(name)[source]¶
- Parameters:
name (
str
) – a SDES name- Returns:
the
GstRtp.RTCPSDESType
for name orGstRtp.RTCPSDESType.PRIV
when name is a private sdes item.- Return type:
Convert name into a GstRTCPSDESType. name is typically a key in a
Gst.Structure
containing SDES items.
- GstRtp.rtcp_sdes_type_to_name(type)[source]¶
- Parameters:
type (
GstRtp.RTCPSDESType
) – aGstRtp.RTCPSDESType
- Returns:
the string equivalent of type
- Return type:
Converts type to the string equivalent. The string is typically used as a key in a
Gst.Structure
containing SDES items.
- GstRtp.rtcp_unix_to_ntp(unixtime)[source]¶
- Parameters:
unixtime (
int
) – an UNIX timestamp in nanoseconds- Returns:
the NTP time for unixtime.
- Return type:
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.
- GstRtp.rtp_buffer_allocate_data(buffer, payload_len, pad_len, csrc_count)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
payload_len (
int
) – the length of the payloadpad_len (
int
) – the amount of paddingcsrc_count (
int
) – the number of CSRC entries
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
.
- GstRtp.rtp_buffer_calc_header_len(csrc_count)[source]¶
- Parameters:
csrc_count (
int
) – the number of CSRC entries- Returns:
The length of an RTP header with csrc_count CSRC entries.
- Return type:
Calculate the header length of an RTP packet with csrc_count CSRC entries. An RTP packet can have at most 15 CSRC entries.
- GstRtp.rtp_buffer_calc_packet_len(payload_len, pad_len, csrc_count)[source]¶
- Parameters:
- Returns:
The total length of an RTP header with given parameters.
- Return type:
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.
- GstRtp.rtp_buffer_calc_payload_len(packet_len, pad_len, csrc_count)[source]¶
- Parameters:
- Returns:
The length of the payload of an RTP packet with given parameters.
- Return type:
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.
- GstRtp.rtp_buffer_compare_seqnum(seqnum1, seqnum2)[source]¶
- Parameters:
- Returns:
a negative value if seqnum1 is bigger than seqnum2, 0 if they are equal or a positive value if seqnum1 is smaller than segnum2.
- Return type:
Compare two sequence numbers, taking care of wraparounds. This function returns the difference between seqnum1 and seqnum2.
- GstRtp.rtp_buffer_default_clock_rate(payload_type)[source]¶
- Parameters:
payload_type (
int
) – the static payload type- Returns:
the default clock rate or -1 if the payload type is not static or the clock-rate is undefined.
- Return type:
Get the default clock-rate for the static payload type payload_type.
- GstRtp.rtp_buffer_ext_timestamp(exttimestamp, timestamp)[source]¶
- Parameters:
- Returns:
The extended timestamp of timestamp or 0 if the result can’t go anywhere backwards.
- exttimestamp:
a previous extended timestamp
- Return type:
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.
This function is able to handle both forward and backward timestamps taking into account:
timestamp wraparound making sure that the returned value is properly increased.
timestamp unwraparound making sure that the returned value is properly decreased.
- GstRtp.rtp_buffer_get_extension_onebyte_header_from_bytes(bytes, bit_pattern, id, nth)[source]¶
- Parameters:
bytes (
GLib.Bytes
) –GLib.Bytes
bit_pattern (
int
) – The bit-pattern. Anything but 0xBEDE is rejected.id (
int
) – The ID of the header extension to be read (between 1 and 14).nth (
int
) – Read the nth extension packet with the requested ID
- Returns:
True
if bytes had the requested header extension- data:
location for data
- Return type:
Similar to
GstRtp.RTPBuffer.get_extension_onebyte_header
, but working on theGLib.Bytes
you get fromGstRtp.RTPBuffer.get_extension_data
. Parses RFC 5285 style header extensions with a one byte header. It will return the nth extension with the requested id.New in version 1.18.
- GstRtp.rtp_buffer_map(buffer, flags)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
flags (
Gst.MapFlags
) –Gst.MapFlags
- Returns:
True
if buffer could be mapped.- rtp:
- Return type:
(
bool
, rtp:GstRtp.RTPBuffer
)
Map the contents of buffer into rtp.
- GstRtp.rtp_buffer_new_allocate(payload_len, pad_len, csrc_count)[source]¶
- Parameters:
- Returns:
A newly allocated buffer that can hold an RTP packet with given parameters.
- Return type:
Allocate a new
Gst.Buffer
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
.
- GstRtp.rtp_buffer_new_allocate_len(packet_len, pad_len, csrc_count)[source]¶
- Parameters:
- Returns:
A newly allocated buffer that can hold an RTP packet of packet_len.
- Return type:
Create a new
Gst.Buffer
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 withGstRtp.RTPBuffer.calc_payload_len
(). All RTP header fields will be set to 0/False
.
- GstRtp.rtp_buffer_new_copy_data(data)[source]¶
- Parameters:
data (
bytes
) – data for the new buffer- Returns:
A newly allocated buffer with a copy of data and of size len.
- Return type:
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.
- GstRtp.rtp_buffer_new_take_data(data)[source]¶
- Parameters:
data (
bytes
) – data for the new buffer- Returns:
A newly allocated buffer with data and of size len.
- Return type:
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.
- GstRtp.rtp_get_header_extension_list()[source]¶
- Returns:
a
GLib.List
ofGst.ElementFactory
's. UseGst.PluginFeature.list_free
() after use- Return type:
Retrieve all the factories of the currently registered RTP header extensions. Call
Gst.ElementFactory.create
() with each factory to create the associatedGstRtp.RTPHeaderExtension
.New in version 1.20.
- GstRtp.rtp_hdrext_get_ntp_56(data)[source]¶
- Parameters:
data (
bytes
) – the data to read from- Returns:
True
on success.- ntptime:
the result NTP time
- Return type:
Reads the NTP time from the size NTP-56 extension bytes in data and store the result in ntptime.
- GstRtp.rtp_hdrext_get_ntp_64(data)[source]¶
- Parameters:
data (
bytes
) – the data to read from- Returns:
True
on success.- ntptime:
the result NTP time
- Return type:
Reads the NTP time from the size NTP-64 extension bytes in data and store the result in ntptime.
- GstRtp.rtp_hdrext_set_ntp_56(data, size, ntptime)[source]¶
- Parameters:
- Returns:
True
on success.- Return type:
Writes the NTP time in ntptime to the format required for the NTP-56 header extension. data must hold at least
GstRtp.RTP_HDREXT_NTP_56_SIZE
bytes.
- GstRtp.rtp_hdrext_set_ntp_64(data, size, ntptime)[source]¶
- Parameters:
- Returns:
True
on success.- Return type:
Writes the NTP time in ntptime to the format required for the NTP-64 header extension. data must hold at least
GstRtp.RTP_HDREXT_NTP_64_SIZE
bytes.
- GstRtp.rtp_payload_info_for_name(media, encoding_name)[source]¶
- Parameters:
- Returns:
a
GstRtp.RTPPayloadInfo
orNone
when no info could be found.- Return type:
Get the
GstRtp.RTPPayloadInfo
for media and encoding_name. This function is mostly used to get the default clock-rate and bandwidth for dynamic payload types specified with media and encoding name.The search for encoding_name will be performed in a case insensitive way.
- GstRtp.rtp_payload_info_for_pt(payload_type)[source]¶
- Parameters:
payload_type (
int
) – the payload_type to find- Returns:
a
GstRtp.RTPPayloadInfo
orNone
when no info could be found.- Return type:
Get the
GstRtp.RTPPayloadInfo
for payload_type. This function is mostly used to get the default clock-rate and bandwidth for static payload types specified with payload_type.