GstRtp.RTPBaseAudioPayload

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 GstRtp.RTPBaseAudioPayload GstRtp.RTPBaseAudioPayload GstRtp.RTPBasePayload->GstRtp.RTPBaseAudioPayload

Subclasses:

None

Methods

Inherited:

GstRtp.RTPBasePayload (9), Gst.Element (81), Gst.Object (27), GObject.Object (37)

Structs:

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

flush (payload_len, timestamp)

get_adapter ()

push (data, timestamp)

set_frame_based ()

set_frame_options (frame_duration, frame_size)

set_sample_based ()

set_sample_options (sample_size)

set_samplebits_options (sample_size)

Virtual Methods

Inherited:

GstRtp.RTPBasePayload (6), Gst.Element (16), Gst.Object (1), GObject.Object (7)

Properties

Inherited:

GstRtp.RTPBasePayload (16), Gst.Object (2)

Name

Type

Flags

Short Description

buffer-list

bool

r/w

Use Buffer Lists

Signals

Inherited:

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

Fields

Inherited:

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

Name

Type

Access

Description

base_ts

int

r

frame_duration

int

r

frame_size

int

r

payload

GstRtp.RTPBasePayload

r

sample_size

int

r

Class Details

class GstRtp.RTPBaseAudioPayload(**kwargs)
Bases:

GstRtp.RTPBasePayload

Abstract:

No

Structure:

GstRtp.RTPBaseAudioPayloadClass

Provides a base class for audio RTP payloaders for frame or sample based audio codecs (constant bitrate)

This class derives from GstRtp.RTPBasePayload. It can be used for payloading audio codecs. It will only work with constant bitrate codecs. It supports both frame based and sample based codecs. It takes care of packing up the audio data into RTP packets and filling up the headers accordingly. The payloading is done based on the maximum MTU (mtu) and the maximum time per packet (max-ptime). The general idea is to divide large data buffers into smaller RTP packets. The RTP packet size is the minimum of either the MTU, max-ptime (if set) or available data. The RTP packet size is always larger or equal to min-ptime (if set). If min-ptime is not set, any residual data is sent in a last RTP packet. In the case of frame based codecs, the resulting RTP packets always contain full frames.

Usage

To use this base class, your child element needs to call either GstRtp.RTPBaseAudioPayload.set_frame_based() or GstRtp.RTPBaseAudioPayload.set_sample_based(). This is usually done in the element’s _init() function. Then, the child element must call either GstRtp.RTPBaseAudioPayload.set_frame_options(), GstRtp.RTPBaseAudioPayload.set_sample_options() or GstRtp.RTPBaseAudioPayload.set_samplebits_options. Since GstRtp.RTPBaseAudioPayload derives from GstRtp.RTPBasePayload, the child element must set any variables or call/override any functions required by that base class. The child element does not need to override any other functions specific to GstRtp.RTPBaseAudioPayload.

flush(payload_len, timestamp)
Parameters:
  • payload_len (int) – length of payload

  • timestamp (int) – a #GstClockTime

Returns:

a Gst.FlowReturn

Return type:

Gst.FlowReturn

Create an RTP buffer and store payload_len bytes of the adapter as the payload. Set the timestamp on the new buffer to timestamp before pushing the buffer downstream.

If payload_len is -1, all pending bytes will be flushed. If timestamp is -1, the timestamp will be calculated automatically.

get_adapter()
Returns:

a GstBase.Adapter.

Return type:

GstBase.Adapter

Gets the internal adapter used by the depayloader.

push(data, timestamp)
Parameters:
  • data (bytes) – data to set as payload

  • timestamp (int) – a #GstClockTime

Returns:

a Gst.FlowReturn

Return type:

Gst.FlowReturn

Create an RTP buffer and store payload_len bytes of data as the payload. Set the timestamp on the new buffer to timestamp before pushing the buffer downstream.

set_frame_based()

Tells GstRtp.RTPBaseAudioPayload that the child element is for a frame based audio codec

set_frame_options(frame_duration, frame_size)
Parameters:
  • frame_duration (int) – The duraction of an audio frame in milliseconds.

  • frame_size (int) – The size of an audio frame in bytes.

Sets the options for frame based audio codecs.

set_sample_based()

Tells GstRtp.RTPBaseAudioPayload that the child element is for a sample based audio codec

set_sample_options(sample_size)
Parameters:

sample_size (int) – Size per sample in bytes.

Sets the options for sample based audio codecs.

set_samplebits_options(sample_size)
Parameters:

sample_size (int) – Size per sample in bits.

Sets the options for sample based audio codecs.

Property Details

GstRtp.RTPBaseAudioPayload.props.buffer_list
Name:

buffer-list

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Use Buffer Lists