GstRtp.RTPBasePayload

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.Element Gst.Element GstRtp.RTPBasePayload GstRtp.RTPBasePayload Gst.Element->GstRtp.RTPBasePayload Gst.Object->Gst.Element

Subclasses:

GstRtp.RTPBaseAudioPayload

Methods

Inherited:

Gst.Element (81), Gst.Object (27), GObject.Object (37)

Structs:

Gst.ElementClass (10), GObject.ObjectClass (5)

allocate_output_buffer (payload_len, pad_len, csrc_count)

get_source_count (buffer)

is_filled (size, duration)

is_source_info_enabled ()

push (buffer)

push_list (list)

set_options (media, dynamic, encoding_name, clock_rate)

set_outcaps_structure (s)

set_source_info_enabled (enable)

Virtual Methods

Inherited:

Gst.Element (16), Gst.Object (1), GObject.Object (7)

do_get_caps (pad, filter)

do_handle_buffer (buffer)

do_query (pad, query)

do_set_caps (caps)

do_sink_event (event)

do_src_event (event)

Properties

Inherited:

Gst.Object (2)

Name

Type

Flags

Short Description

auto-header-extension

bool

r/w

Whether RTP header extensions should be automatically enabled, if an implementation is available

max-ptime

int

r/w

Maximum duration of the packet data in ns (-1 = unlimited up to MTU)

min-ptime

int

r/w

Minimum duration of the packet data in ns (can’t go above MTU)

mtu

int

r/w

Maximum size of one packet

onvif-no-rate-control

bool

r/w

Enable ONVIF Rate-Control=no timestamping mode

perfect-rtptime

bool

r/w

Generate perfect RTP timestamps when possible

pt

int

r/w

The payload type of the packets

ptime-multiple

int

r/w

Force buffers to be multiples of this duration in ns (0 disables)

scale-rtptime

bool

r/w

Whether the RTP timestamp should be scaled with the rate (speed)

seqnum

int

r

The RTP sequence number of the last processed packet

seqnum-offset

int

r/w

Offset to add to all outgoing seqnum (-1 = random)

source-info

bool

r/w

Write CSRC based on buffer meta RTP source information

ssrc

int

r/w

The SSRC of the packets (default == random)

stats

Gst.Structure

r

Various statistics

timestamp

int

r

The RTP timestamp of the last processed packet

timestamp-offset

int

r/w

Offset to add to all outgoing timestamps (default = random)

Signals

Inherited:

Gst.Element (3), Gst.Object (1), GObject.Object (1)

Name

Short Description

add-extension

Add ext as an extension for writing part of an RTP header extension onto outgoing RTP packets.

clear-extensions

Clear all RTP header extensions used by this payloader.

request-extension

The returned ext must be configured with the correct ext_id and with the necessary attributes as required by the extension implementation.

Fields

Inherited:

Gst.Element (3), Gst.Object (1), GObject.Object (1)

Name

Type

Access

Description

clock_rate

int

r

current_ssrc

int

r

dynamic

bool

r

element

Gst.Element

r

encoding_name

str

r

max_ptime

int

r

media

str

r

min_ptime

int

r

mtu

int

r

pt

int

r

ptime

int

r

ptime_multiple

int

r

segment

Gst.Segment

r

seqnum

int

r

seqnum_base

int

r

seqnum_offset

int

r

sinkpad

Gst.Pad

r

srcpad

Gst.Pad

r

ssrc

int

r

timestamp

int

r

ts_base

int

r

ts_offset

int

r

Class Details

class GstRtp.RTPBasePayload(**kwargs)
Bases:

Gst.Element

Abstract:

Yes

Structure:

GstRtp.RTPBasePayloadClass

Provides a base class for RTP payloaders

allocate_output_buffer(payload_len, pad_len, csrc_count)
Parameters:
  • payload_len (int) – the length of the payload

  • pad_len (int) – the amount of padding

  • csrc_count (int) – the minimum number of CSRC entries

Returns:

A newly allocated buffer that can hold an RTP packet with given parameters.

Return type:

Gst.Buffer

Allocate a new Gst.Buffer with enough data to hold an RTP packet with minimum csrc_count CSRCs, a payload length of payload_len and padding of pad_len. If self has GstRtp.RTPBasePayload :source-info True additional CSRCs may be allocated and filled with RTP source information.

New in version 1.16.

get_source_count(buffer)
Parameters:

buffer (Gst.Buffer) – a Gst.Buffer, typically the buffer to payload

Returns:

The number of sources.

Return type:

int

Count the total number of RTP sources found in the meta of buffer, which will be automically added by GstRtp.RTPBasePayload.allocate_output_buffer(). If GstRtp.RTPBasePayload :source-info is False the count will be 0.

New in version 1.16.

is_filled(size, duration)
Parameters:
  • size (int) – the size of the packet

  • duration (int) – the duration of the packet

Returns:

True if the packet of size and duration would exceed the configured MTU or max_ptime.

Return type:

bool

Check if the packet with size and duration would exceed the configured maximum size.

is_source_info_enabled()
Returns:

True if source-info is enabled.

Return type:

bool

Queries whether the payloader will add contributing sources (CSRCs) to the RTP header from GstRtp.RTPSourceMeta.

New in version 1.16.

push(buffer)
Parameters:

buffer (Gst.Buffer) – a Gst.Buffer

Returns:

a Gst.FlowReturn.

Return type:

Gst.FlowReturn

Push buffer to the peer element of the payloader. The SSRC, payload type, seqnum and timestamp of the RTP buffer will be updated first.

This function takes ownership of buffer.

push_list(list)
Parameters:

list (Gst.BufferList) – a Gst.BufferList

Returns:

a Gst.FlowReturn.

Return type:

Gst.FlowReturn

Push list to the peer element of the payloader. The SSRC, payload type, seqnum and timestamp of the RTP buffer will be updated first.

This function takes ownership of list.

set_options(media, dynamic, encoding_name, clock_rate)
Parameters:
  • media (str) – the media type (typically “audio” or “video”)

  • dynamic (bool) – if the payload type is dynamic

  • encoding_name (str) – the encoding name

  • clock_rate (int) – the clock rate of the media

Set the rtp options of the payloader. These options will be set in the caps of the payloader. Subclasses must call this method before calling GstRtp.RTPBasePayload.push() or gst_rtp_base_payload_set_outcaps().

set_outcaps_structure(s)
Parameters:

s (Gst.Structure or None) – a Gst.Structure with the caps fields

Returns:

True if the caps could be set.

Return type:

bool

Configure the output caps with the optional fields.

New in version 1.20.

set_source_info_enabled(enable)
Parameters:

enable (bool) – whether to add contributing sources to RTP packets

Enable or disable adding contributing sources to RTP packets from GstRtp.RTPSourceMeta.

New in version 1.16.

do_get_caps(pad, filter) virtual
Parameters:
Return type:

Gst.Caps

do_handle_buffer(buffer) virtual
Parameters:

buffer (Gst.Buffer) –

Return type:

Gst.FlowReturn

do_query(pad, query) virtual
Parameters:
Return type:

bool

do_set_caps(caps) virtual
Parameters:

caps (Gst.Caps) –

Return type:

bool

do_sink_event(event) virtual
Parameters:

event (Gst.Event) –

Return type:

bool

do_src_event(event) virtual
Parameters:

event (Gst.Event) –

Return type:

bool

Signal Details

GstRtp.RTPBasePayload.signals.add_extension(r_t_p_base_payload, ext)
Signal Name:

add-extension

Flags:

RUN_LAST, ACTION

Parameters:

Add ext as an extension for writing part of an RTP header extension onto outgoing RTP packets.

New in version 1.20.

GstRtp.RTPBasePayload.signals.clear_extensions(r_t_p_base_payload)
Signal Name:

clear-extensions

Flags:

RUN_LAST, ACTION

Parameters:

r_t_p_base_payload (GstRtp.RTPBasePayload) – The object which received the signal

Clear all RTP header extensions used by this payloader.

New in version 1.20.

GstRtp.RTPBasePayload.signals.request_extension(r_t_p_base_payload, ext_id, ext_uri)
Signal Name:

request-extension

Flags:

RUN_LAST

Parameters:
  • r_t_p_base_payload (GstRtp.RTPBasePayload) – The object which received the signal

  • ext_id (int) – the extension id being requested

  • ext_uri (str) – the extension URI being requested

Returns:

the GstRtp.RTPHeaderExtension for ext_id, or None

Return type:

GstRtp.RTPHeaderExtension or None

The returned ext must be configured with the correct ext_id and with the necessary attributes as required by the extension implementation.

New in version 1.20.

Property Details

GstRtp.RTPBasePayload.props.auto_header_extension
Name:

auto-header-extension

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

If enabled, the payloader will automatically try to enable all the RTP header extensions provided in the src caps, saving the application the need to handle these extensions manually using the GstRtp.RTPBasePayload ::request-extension: signal.

New in version 1.20.

GstRtp.RTPBasePayload.props.max_ptime
Name:

max-ptime

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE

Maximum duration of the packet data in ns (-1 = unlimited up to MTU)

GstRtp.RTPBasePayload.props.min_ptime
Name:

min-ptime

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Minimum duration of the packet data in ns (can’t go above MTU)

GstRtp.RTPBasePayload.props.mtu
Name:

mtu

Type:

int

Default Value:

1400

Flags:

READABLE, WRITABLE

Maximum size of one packet

GstRtp.RTPBasePayload.props.onvif_no_rate_control
Name:

onvif-no-rate-control

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Make the payloader timestamp packets according to the Rate-Control=no behaviour specified in the ONVIF replay spec.

New in version 1.16.

GstRtp.RTPBasePayload.props.perfect_rtptime
Name:

perfect-rtptime

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Try to use the offset fields to generate perfect RTP timestamps. When this option is disabled, RTP timestamps are generated from GST_BUFFER_PTS of each payloaded buffer. The PTSes of buffers may not necessarily increment with the amount of data in each input buffer, consider e.g. the case where the buffer arrives from a network which means that the PTS is unrelated to the amount of data. Because the RTP timestamps are generated from GST_BUFFER_PTS this can result in RTP timestamps that also don’t increment with the amount of data in the payloaded packet. To circumvent this it is possible to set the perfect rtptime option enabled. When this option is enabled the payloader will increment the RTP timestamps based on GST_BUFFER_OFFSET which relates to the amount of data in each packet rather than the GST_BUFFER_PTS of each buffer and therefore the RTP timestamps will more closely correlate with the amount of data in each buffer. Currently GstRtp.RTPBasePayload is limited to handling perfect RTP timestamps for audio streams.

GstRtp.RTPBasePayload.props.pt
Name:

pt

Type:

int

Default Value:

96

Flags:

READABLE, WRITABLE

The payload type of the packets

GstRtp.RTPBasePayload.props.ptime_multiple
Name:

ptime-multiple

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Force buffers to be multiples of this duration in ns (0 disables)

GstRtp.RTPBasePayload.props.scale_rtptime
Name:

scale-rtptime

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Make the RTP packets’ timestamps be scaled with the segment’s rate (corresponding to RTSP speed parameter). Disabling this property means the timestamps will not be affected by the set delivery speed (RTSP speed).

Example: A server wants to allow streaming a recorded video in double speed but still have the timestamps correspond to the position in the video. This is achieved by the client setting RTSP Speed to 2 while the server has this property disabled.

New in version 1.18.

GstRtp.RTPBasePayload.props.seqnum
Name:

seqnum

Type:

int

Default Value:

0

Flags:

READABLE

The RTP sequence number of the last processed packet

GstRtp.RTPBasePayload.props.seqnum_offset
Name:

seqnum-offset

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE

Offset to add to all outgoing seqnum (-1 = random)

GstRtp.RTPBasePayload.props.source_info
Name:

source-info

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Enable writing the CSRC field in allocated RTP header based on RTP source information found in the input buffer’s GstRtp.RTPSourceMeta.

New in version 1.16.

GstRtp.RTPBasePayload.props.ssrc
Name:

ssrc

Type:

int

Default Value:

4294967295

Flags:

READABLE, WRITABLE

The SSRC of the packets (default == random)

GstRtp.RTPBasePayload.props.stats
Name:

stats

Type:

Gst.Structure

Default Value:

None

Flags:

READABLE

Various payloader statistics retrieved atomically (and are therefore synchroized with each other), these can be used e.g. to generate an RTP-Info header. This property return a Gst.Structure named application/x-rtp-payload-stats containing the following fields relating to the last processed buffer and current state of the stream being payloaded:

GstRtp.RTPBasePayload.props.timestamp
Name:

timestamp

Type:

int

Default Value:

0

Flags:

READABLE

The RTP timestamp of the last processed packet

GstRtp.RTPBasePayload.props.timestamp_offset
Name:

timestamp-offset

Type:

int

Default Value:

4294967295

Flags:

READABLE, WRITABLE

Offset to add to all outgoing timestamps (default = random)