GstRtspServer.RTSPStream

g GObject.Object GObject.Object GstRtspServer.RTSPStream GstRtspServer.RTSPStream GObject.Object->GstRtspServer.RTSPStream

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class new (idx, payloader, pad)
  add_multicast_client_address (destination, rtp_port, rtcp_port, family)
  add_transport (trans)
  allocate_udp_sockets (family, transport, use_client_settings)
  complete_stream (transport)
  get_address_pool ()
  get_buffer_size ()
  get_caps ()
  get_control ()
  get_current_seqnum ()
  get_dscp_qos ()
  get_index ()
  get_joined_bin ()
  get_max_mcast_ttl ()
  get_mtu ()
  get_multicast_address (family)
  get_multicast_client_addresses ()
  get_multicast_iface ()
  get_profiles ()
  get_protocols ()
  get_pt ()
  get_publish_clock_mode ()
  get_rate_control ()
  get_rates ()
  get_retransmission_pt ()
  get_retransmission_time ()
  get_rtcp_multicast_socket (family)
  get_rtcp_socket (family)
  get_rtp_multicast_socket (family)
  get_rtp_socket (family)
  get_rtpinfo ()
  get_rtpsession ()
  get_server_port (family)
  get_sinkpad ()
  get_srcpad ()
  get_srtp_encoder ()
  get_ssrc ()
  get_ulpfec_enabled ()
  get_ulpfec_percentage ()
  get_ulpfec_pt ()
  handle_keymgmt (keymgmt)
  has_control (control)
  is_bind_mcast_address ()
  is_blocking ()
  is_client_side ()
  is_complete ()
  is_receiver ()
  is_sender ()
  is_transport_supported (transport)
  join_bin (bin, rtpbin, state)
  leave_bin (bin, rtpbin)
  query_position ()
  query_stop ()
  recv_rtcp (buffer)
  recv_rtp (buffer)
  remove_transport (trans)
  request_aux_receiver (sessid)
  request_aux_sender (sessid)
  request_ulpfec_decoder (rtpbin, sessid)
  request_ulpfec_encoder (sessid)
  reserve_address (address, port, n_ports, ttl)
  seekable ()
  set_address_pool (pool)
  set_bind_mcast_address (bind_mcast_addr)
  set_blocked (blocked)
  set_buffer_size (size)
  set_client_side (client_side)
  set_control (control)
  set_dscp_qos (dscp_qos)
  set_max_mcast_ttl (ttl)
  set_mtu (mtu)
  set_multicast_iface (multicast_iface)
  set_profiles (profiles)
  set_protocols (protocols)
  set_pt_map (pt, caps)
  set_publish_clock_mode (mode)
  set_rate_control (enabled)
  set_retransmission_pt (rtx_pt)
  set_retransmission_time (time)
  set_seqnum_offset (seqnum)
  set_ulpfec_percentage (percentage)
  set_ulpfec_pt (pt)
  transport_filter (func, *user_data)
  unblock_linked ()
  update_crypto (ssrc, crypto)
  verify_mcast_ttl (ttl)

Virtual Methods

Inherited:GObject.Object (7)

Properties

Name Type Flags Short Description
control str r/w The control string for this stream
profiles GstRtsp.RTSPProfile r/w Allowed transfer profiles
protocols GstRtsp.RTSPLowerTrans r/w Allowed lower transport protocols

Signals

Inherited:GObject.Object (1)
Name Short Description
new-rtcp-encoder  
new-rtp-encoder  
new-rtp-rtcp-decoder  

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent GObject.Object r  

Class Details

class GstRtspServer.RTSPStream(**kwargs)
Bases:GObject.Object
Abstract:No
Structure:GstRtspServer.RTSPStreamClass

The definition of a media stream.

classmethod new(idx, payloader, pad)[source]
Parameters:
Returns:

a new GstRtspServer.RTSPStream

Return type:

GstRtspServer.RTSPStream

Create a new media stream with index idx that handles RTP GstRtsp.data on pad and has a payloader element payloader if pad is a source pad or a depayloader element payloader if pad is a sink pad.

add_multicast_client_address(destination, rtp_port, rtcp_port, family)[source]
Parameters:
  • destination (str) – a multicast address to add
  • rtp_port (int) – RTP port
  • rtcp_port (int) – RTCP port
  • family (Gio.SocketFamily) – socket family
Returns:

True if destination can be addedd and handled by self.

Return type:

bool

Add multicast client address to stream. At this point, the sockets that will stream RTP and RTCP GstRtsp.data to destination are supposed to be allocated.

New in version 1.16.

add_transport(trans)[source]
Parameters:trans (GstRtspServer.RTSPStreamTransport) – a GstRtspServer.RTSPStreamTransport
Returns:True if trans was added
Return type:bool

Add the transport in trans to self. The media of self will then also be send to the values configured in trans. Adding the same transport twice will not add it a second time.

self must be joined to a bin.

trans must contain a valid GstRtsp.RTSPTransport.

allocate_udp_sockets(family, transport, use_client_settings)[source]
Parameters:
Returns:

True if the RTP and RTCP sockets have been succeccully allocated.

Return type:

bool

Allocates RTP and RTCP ports.

complete_stream(transport)[source]
Parameters:transport (GstRtsp.RTSPTransport) – a GstRtsp.RTSPTransport
Returns:True if the stream has been sucessfully updated.
Return type:bool

Add a receiver and sender part to the pipeline based on the transport from SETUP.

New in version 1.14.

get_address_pool()[source]
Returns:the GstRtspServer.RTSPAddressPool of self. GObject.Object.unref() after usage.
Return type:GstRtspServer.RTSPAddressPool or None

Get the GstRtspServer.RTSPAddressPool used as the address pool of self.

get_buffer_size()[source]
Returns:the size of the UDP TX buffer
Return type:int

Get the size of the UDP transmission buffer (in bytes)

New in version 1.6.

get_caps()[source]
Returns:the Gst.Caps of self. use gst_caps_unref() after usage.
Return type:Gst.Caps or None

Retrieve the current caps of self.

get_control()[source]
Returns:the control string. GLib.free() after usage.
Return type:str or None

Get the control string to identify this stream.

get_current_seqnum()[source]
Return type:int
get_dscp_qos()[source]
Returns:the DSCP QoS value of the outgoing sockets, or -1 if disbled.
Return type:int

Get the configured DSCP QoS in of the outgoing sockets.

get_index()[source]
Returns:the stream index.
Return type:int

Get the stream index.

get_joined_bin()[source]
Returns:the joined bin or None.
Return type:Gst.Bin or None

Get the previous joined bin with GstRtspServer.RTSPStream.join_bin() or None.

get_max_mcast_ttl()[source]
Returns:the maximum time-to-live value of outgoing multicast packets.
Return type:int

Get the the maximum time-to-live value of outgoing multicast packets.

New in version 1.16.

get_mtu()[source]
Returns:the MTU of the payloader.
Return type:int

Get the configured MTU in the payloader of self.

get_multicast_address(family)[source]
Parameters:family (Gio.SocketFamily) – the Gio.SocketFamily
Returns:the GstRtspServer.RTSPAddress of self or None when no address could be allocated. GstRtspServer.RTSPAddress.free() after usage.
Return type:GstRtspServer.RTSPAddress or None

Get the multicast address of self for family. The original GstRtspServer.RTSPAddress is cached and copy is returned, so freeing the return value won’t release the address from the pool.

get_multicast_client_addresses()[source]
Returns:A comma separated list of host:port pairs with destinations
Return type:str

Get all multicast client addresses that RTP GstRtsp.data will be sent to

New in version 1.16.

get_multicast_iface()[source]
Returns:the multicast interface for self. GLib.free() after usage.
Return type:str or None

Get the multicast interface used for self.

get_profiles()[source]
Returns:a GstRtsp.RTSPProfile
Return type:GstRtsp.RTSPProfile

Get the allowed profiles of self.

get_protocols()[source]
Returns:a GstRtsp.RTSPLowerTrans
Return type:GstRtsp.RTSPLowerTrans

Get the allowed protocols of self.

get_pt()[source]
Returns:the stream payload type.
Return type:int

Get the stream payload type.

get_publish_clock_mode()[source]
Returns:The GstRtspServer.RTSPPublishClockMode
Return type:GstRtspServer.RTSPPublishClockMode

Gets if and how the stream clock should be published according to RFC7273.

New in version 1.8.

get_rate_control()[source]
Returns:whether self will follow the Rate-Control=no behaviour as specified in the ONVIF replay spec.
Return type:bool

New in version 1.18.

get_rates()[source]
Returns:True if rate and/or applied_rate could be determined.
rate:the configured rate
applied_rate:the configured applied_rate
Return type:(bool, rate: float, applied_rate: float)

Retrieve the current rate and/or applied_rate.

New in version 1.18.

get_retransmission_pt()[source]
Returns:The retransmission PT.
Return type:int

Get the payload-type used for retransmission of this stream

get_retransmission_time()[source]
Returns:the amount of time to store retransmission GstRtsp.data.
Return type:int

Get the amount of time to store retransmission GstRtsp.data.

get_rtcp_multicast_socket(family)[source]
Parameters:family (Gio.SocketFamily) – the socket family
Returns:the multicast RTCP socket or None if no socket could be allocated for family. Unref after usage
Return type:Gio.Socket or None

Get the multicast RTCP socket from self for a family.

New in version 1.14.

get_rtcp_socket(family)[source]
Parameters:family (Gio.SocketFamily) – the socket family
Returns:the RTCP socket or None if no socket could be allocated for family. Unref after usage
Return type:Gio.Socket or None

Get the RTCP socket from self for a family.

self must be joined to a bin.

get_rtp_multicast_socket(family)[source]
Parameters:family (Gio.SocketFamily) – the socket family
Returns:the multicast RTP socket or None if no

socket could be allocated for family. Unref after usage

Return type:Gio.Socket or None

Get the multicast RTP socket from self for a family.

get_rtp_socket(family)[source]
Parameters:family (Gio.SocketFamily) – the socket family
Returns:the RTP socket or None if no socket could be allocated for family. Unref after usage
Return type:Gio.Socket or None

Get the RTP socket from self for a family.

self must be joined to a bin.

get_rtpinfo()[source]
Returns:True when rtptime, seq and running-time could be determined.
rtptime:result RTP timestamp
seq:result RTP seqnum
clock_rate:the clock rate
running_time:result running-time
Return type:(bool, rtptime: int, seq: int, clock_rate: int, running_time: int)

Retrieve the current rtptime, seq and running-time. This is used to construct a RTPInfo reply header.

get_rtpsession()[source]
Returns:The RTP session of this stream. Unref after usage.
Return type:GObject.Object

Get the RTP session of this stream.

get_server_port(family)[source]
Parameters:family (Gio.SocketFamily) – the port family to get
Returns:result server port
Return type:server_port: GstRtsp.RTSPRange

Fill server_port with the port pair used by the server. This function can only be called when self has been joined.

get_sinkpad()[source]
Returns:the sinkpad. Unref after usage.
Return type:Gst.Pad or None

Get the sinkpad associated with self.

get_srcpad()[source]
Returns:the srcpad. Unref after usage.
Return type:Gst.Pad or None

Get the srcpad associated with self.

get_srtp_encoder()[source]
Returns:The SRTP encoder for this stream. Unref after usage.
Return type:Gst.Element

Get the SRTP encoder for this stream.

get_ssrc()[source]
Returns:result ssrc
Return type:ssrc: int

Get the SSRC used by the RTP session of this stream. This function can only be called when self has been joined.

get_ulpfec_enabled()
Return type:bool
get_ulpfec_percentage()[source]
Returns:the amount of redundancy applied when creating ULPFEC protection packets.
Return type:int

New in version 1.16.

get_ulpfec_pt()[source]
Returns:the payload type used for ULPFEC protection packets
Return type:int

New in version 1.16.

handle_keymgmt(keymgmt)[source]
Parameters:keymgmt (str) – a keymgmt header
Return type:bool

Parse and handle a KeyMgmt header.

New in version 1.16.

has_control(control)[source]
Parameters:control (str or None) – a control string
Returns:True is self has control as the control string
Return type:bool

Check if self has the control string control.

is_bind_mcast_address()[source]
Returns:True if multicast sockets are configured to be bound to multicast addresses.
Return type:bool

Check if multicast sockets are configured to be bound to multicast addresses.

New in version 1.16.

is_blocking()[source]
Returns:True if self is blocking
Return type:bool

Check if self is blocking on a Gst.Buffer.

is_client_side()[source]
Returns:True if this GstRtspServer.RTSPStream is client-side.
Return type:bool

See GstRtspServer.RTSPStream.set_client_side()

is_complete()[source]
Returns:True if the stream contains at least one sink element.
Return type:bool

Checks whether the stream is complete, contains the receiver and the sender parts. As the stream contains sink(s) element(s), it’s possible to perform seek operations on it.

New in version 1.14.

is_receiver()[source]
Returns:True if the stream is a receiver and False otherwise.
Return type:bool

Checks whether the stream is a receiver.

New in version 1.14.

is_sender()[source]
Returns:True if the stream is a sender and False otherwise.
Return type:bool

Checks whether the stream is a sender.

New in version 1.14.

is_transport_supported(transport)[source]
Parameters:transport (GstRtsp.RTSPTransport) – a GstRtsp.RTSPTransport
Returns:True if transport can be handled by self.
Return type:bool

Check if transport can be handled by stream

join_bin(bin, rtpbin, state)[source]
Parameters:
Returns:

True on success.

Return type:

bool

Join the Gst.Bin bin that contains the element rtpbin.

self will link to rtpbin, which must be inside bin. The elements added to bin will be set to the state given in state.

leave_bin(bin, rtpbin)[source]
Parameters:
Returns:

True on success.

Return type:

bool

Remove the elements of self from bin.

query_position()[source]
Returns:True if the position could be queried
position:current position of a GstRtspServer.RTSPStream
Return type:(bool, position: int)

Query the position of the stream in Gst.Format.TIME. This only considers the RTP parts of the pipeline and not the RTCP parts.

query_stop()[source]
Returns:True if the stop could be queried
stop:current stop of a GstRtspServer.RTSPStream
Return type:(bool, stop: int)

Query the stop of the stream in Gst.Format.TIME. This only considers the RTP parts of the pipeline and not the RTCP parts.

recv_rtcp(buffer)[source]
Parameters:buffer (Gst.Buffer) – a Gst.Buffer
Returns:a Gst.FlowReturn.
Return type:Gst.FlowReturn

Handle an RTCP buffer for the stream. This method is usually called when a message has been received from a client using the TCP transport.

This function takes ownership of buffer.

recv_rtp(buffer)[source]
Parameters:buffer (Gst.Buffer) – a Gst.Buffer
Returns:a Gst.FlowReturn.
Return type:Gst.FlowReturn

Handle an RTP buffer for the stream. This method is usually called when a message has been received from a client using the TCP transport.

This function takes ownership of buffer.

remove_transport(trans)[source]
Parameters:trans (GstRtspServer.RTSPStreamTransport) – a GstRtspServer.RTSPStreamTransport
Returns:True if trans was removed
Return type:bool

Remove the transport in trans from self. The media of self will not be sent to the values configured in trans.

self must be joined to a bin.

trans must contain a valid GstRtsp.RTSPTransport.

request_aux_receiver(sessid)[source]
Parameters:sessid (int) – the session id
Returns:a Gst.Element.
Return type:Gst.Element or None

Creating a rtxreceive bin

New in version 1.16.

request_aux_sender(sessid)[source]
Parameters:sessid (int) – the session id
Returns:a Gst.Element.
Return type:Gst.Element or None

Creating a rtxsend bin

New in version 1.6.

request_ulpfec_decoder(rtpbin, sessid)[source]
Parameters:
Returns:

a Gst.Element.

Return type:

Gst.Element or None

Creating a rtpulpfecdec element

New in version 1.16.

request_ulpfec_encoder(sessid)[source]
Parameters:sessid (int) –
Returns:a Gst.Element.
Return type:Gst.Element or None

Creating a rtpulpfecenc element

New in version 1.16.

reserve_address(address, port, n_ports, ttl)[source]
Parameters:
  • address (str) – an address
  • port (int) – a port
  • n_ports (int) – n_ports
  • ttl (int) – a TTL
Returns:

the GstRtspServer.RTSPAddress of self or None when the address could not be reserved. GstRtspServer.RTSPAddress.free() after usage.

Return type:

GstRtspServer.RTSPAddress or None

Reserve address and port as the address and port of self. The original GstRtspServer.RTSPAddress is cached and copy is returned, so freeing the return value won’t release the address from the pool.

seekable()[source]
Returns:True if self is seekable, else False.
Return type:bool

Checks whether the individual self is seekable.

New in version 1.14.

set_address_pool(pool)[source]
Parameters:pool (GstRtspServer.RTSPAddressPool or None) – a GstRtspServer.RTSPAddressPool

configure pool to be used as the address pool of self.

set_bind_mcast_address(bind_mcast_addr)[source]
Parameters:bind_mcast_addr (bool) – the new value

Decide whether the multicast socket should be bound to a multicast address or INADDR_ANY.

New in version 1.16.

set_blocked(blocked)[source]
Parameters:blocked (bool) – boolean indicating we should block or unblock
Returns:True on success
Return type:bool

Blocks or unblocks the dataflow on self.

set_buffer_size(size)[source]
Parameters:size (int) – the buffer size

Set the size of the UDP transmission buffer (in bytes) Needs to be set before the stream is joined to a bin.

New in version 1.6.

set_client_side(client_side)[source]
Parameters:client_side (bool) – True if this GstRtspServer.RTSPStream is running on the ‘client’ side of an RTSP connection.

Sets the GstRtspServer.RTSPStream as a ‘client side’ stream - used for sending streams to an RTSP server via RECORD. This has the practical effect of changing which UDP port numbers are used when setting up the local side of the stream sending to be either the ‘server’ or ‘client’ pair of a configured UDP transport.

set_control(control)[source]
Parameters:control (str or None) – a control string

Set the control string in self.

set_dscp_qos(dscp_qos)[source]
Parameters:dscp_qos (int) – a new dscp qos value (0-63, or -1 to disable)

Configure the dscp qos of the outgoing sockets to dscp_qos.

set_max_mcast_ttl(ttl)[source]
Parameters:ttl (int) – the new multicast ttl value
Returns:True if the requested ttl has been set successfully.
Return type:bool

Set the maximum time-to-live value of outgoing multicast packets.

New in version 1.16.

set_mtu(mtu)[source]
Parameters:mtu (int) – a new MTU

Configure the mtu in the payloader of self to mtu.

set_multicast_iface(multicast_iface)[source]
Parameters:multicast_iface (str or None) – a multicast interface name

configure multicast_iface to be used for self.

set_profiles(profiles)[source]
Parameters:profiles (GstRtsp.RTSPProfile) – the new profiles

Configure the allowed profiles for self.

set_protocols(protocols)[source]
Parameters:protocols (GstRtsp.RTSPLowerTrans) – the new flags

Configure the allowed lower transport for self.

set_pt_map(pt, caps)[source]
Parameters:

Configure a pt map between pt and caps.

set_publish_clock_mode(mode)[source]
Parameters:mode (GstRtspServer.RTSPPublishClockMode) – the clock publish mode

Sets if and how the stream clock should be published according to RFC7273.

New in version 1.8.

set_rate_control(enabled)[source]
Parameters:enabled (bool) –

Define whether self will follow the Rate-Control=no behaviour as specified in the ONVIF replay spec.

New in version 1.18.

set_retransmission_pt(rtx_pt)[source]
Parameters:rtx_pt (int) – a int

Set the payload type (pt) for retransmission of this stream.

set_retransmission_time(time)[source]
Parameters:time (int) – a #GstClockTime

Set the amount of time to store retransmission packets.

set_seqnum_offset(seqnum)[source]
Parameters:seqnum (int) –
set_ulpfec_percentage(percentage)[source]
Parameters:percentage (int) –

Sets the amount of redundancy to apply when creating ULPFEC protection packets.

New in version 1.16.

set_ulpfec_pt(pt)[source]
Parameters:pt (int) –

Set the payload type to be used for ULPFEC protection packets

New in version 1.16.

transport_filter(func, *user_data)[source]
Parameters:
Returns:

a GLib.List with all transports for which func returned GstRtspServer.RTSPFilterResult.REF. After usage, each element in the GLib.List should be unreffed before the list is freed.

Return type:

[GstRtspServer.RTSPStreamTransport]

Call func for each transport managed by self. The result value of func determines what happens to the transport. func will be called with self locked so no further actions on self can be performed from func.

If func returns GstRtspServer.RTSPFilterResult.REMOVE, the transport will be removed from self.

If func returns GstRtspServer.RTSPFilterResult.KEEP, the transport will remain in self.

If func returns GstRtspServer.RTSPFilterResult.REF, the transport will remain in self but will also be added with an additional ref to the result GLib.List of this function..

When func is None, GstRtspServer.RTSPFilterResult.REF will be assumed for each transport.

unblock_linked()[source]
Return type:bool
update_crypto(ssrc, crypto)[source]
Parameters:
Returns:

True if crypto could be updated

Return type:

bool

Update the new crypto information for ssrc in self. If information for ssrc did not exist, it will be added. If information for ssrc existed, it will be replaced. If crypto is None, it will be removed from self.

verify_mcast_ttl(ttl)[source]
Parameters:ttl (int) – a requested multicast ttl
Returns:True if the requested ttl value is allowed.
Return type:bool

Check if the requested multicast ttl value is allowed.

New in version 1.16.

Signal Details

GstRtspServer.RTSPStream.signals.new_rtcp_encoder(r_t_s_p_stream, object)
Signal Name:

new-rtcp-encoder

Flags:

RUN_LAST

Parameters:
GstRtspServer.RTSPStream.signals.new_rtp_encoder(r_t_s_p_stream, object)
Signal Name:

new-rtp-encoder

Flags:

RUN_LAST

Parameters:
GstRtspServer.RTSPStream.signals.new_rtp_rtcp_decoder(r_t_s_p_stream, object)
Signal Name:

new-rtp-rtcp-decoder

Flags:

RUN_LAST

Parameters:

Property Details

GstRtspServer.RTSPStream.props.control
Name:control
Type:str
Default Value:None
Flags:READABLE, WRITABLE

The control string for this stream

GstRtspServer.RTSPStream.props.profiles
Name:profiles
Type:GstRtsp.RTSPProfile
Default Value:GstRtsp.RTSPProfile.AVP
Flags:READABLE, WRITABLE

Allowed transfer profiles

GstRtspServer.RTSPStream.props.protocols
Name:protocols
Type:GstRtsp.RTSPLowerTrans
Default Value:GstRtsp.RTSPLowerTrans.UDP | GstRtsp.RTSPLowerTrans.UDP_MCAST | GstRtsp.RTSPLowerTrans.TCP
Flags:READABLE, WRITABLE

Allowed lower transport protocols