GstRtspServer.RTSPMediaFactory

g GObject.Object GObject.Object GstRtspServer.RTSPMediaFactory GstRtspServer.RTSPMediaFactory GObject.Object->GstRtspServer.RTSPMediaFactory

Subclasses:

GstRtspServer.RTSPMediaFactoryURI, GstRtspServer.RTSPOnvifMediaFactory

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

add_role_from_structure (structure)

construct (url)

create_element (url)

get_address_pool ()

get_buffer_size ()

get_clock ()

get_do_retransmission ()

get_dscp_qos ()

get_ensure_keyunit_on_start ()

get_ensure_keyunit_on_start_timeout ()

get_latency ()

get_launch ()

get_max_mcast_ttl ()

get_media_gtype ()

get_multicast_iface ()

get_permissions ()

get_profiles ()

get_protocols ()

get_publish_clock_mode ()

get_retransmission_time ()

get_suspend_mode ()

get_transport_mode ()

is_bind_mcast_address ()

is_enable_rtcp ()

is_eos_shutdown ()

is_shared ()

is_stop_on_disonnect ()

set_address_pool (pool)

set_bind_mcast_address (bind_mcast_addr)

set_buffer_size (size)

set_clock (clock)

set_do_retransmission (do_retransmission)

set_dscp_qos (dscp_qos)

set_enable_rtcp (enable)

set_ensure_keyunit_on_start (ensure_keyunit_on_start)

set_ensure_keyunit_on_start_timeout (timeout)

set_eos_shutdown (eos_shutdown)

set_latency (latency)

set_launch (launch)

set_max_mcast_ttl (ttl)

set_media_gtype (media_gtype)

set_multicast_iface (multicast_iface)

set_permissions (permissions)

set_profiles (profiles)

set_protocols (protocols)

set_publish_clock_mode (mode)

set_retransmission_time (time)

set_shared (shared)

set_stop_on_disconnect (stop_on_disconnect)

set_suspend_mode (mode)

set_transport_mode (mode)

Virtual Methods

Inherited:

GObject.Object (7)

do_configure (media)

do_construct (url)

do_create_element (url)

do_gen_key (url)

do_media_configure (media)

do_media_constructed (media)

Properties

Name

Type

Flags

Short Description

bind-mcast-address

bool

r/w

Whether the multicast sockets should be bound to multicast addresses or INADDR_ANY

buffer-size

int

r/w

The kernel UDP buffer size to use

clock

Gst.Clock

r/w

Clock to be used by the pipelines created for all medias of this factory

dscp-qos

int

r/w

The IP DSCP field to use

enable-rtcp

bool

r/w

Whether the created media should send and receive RTCP

ensure-keyunit-on-start

bool

r/w

If media from this factory should ensure a key unit when a client connects.

ensure-keyunit-on-start-timeout

int

r/w

Timeout in milliseconds used to determine if a keyunit should be discarded when a client connects.

eos-shutdown

bool

r/w

Send EOS down the pipeline before shutting down

latency

int

r/w

Latency used for receiving media in milliseconds

launch

str

r/w

A launch description of the pipeline

max-mcast-ttl

int

r/w

The maximum time-to-live value of outgoing multicast packets

profiles

GstRtsp.RTSPProfile

r/w

Allowed transfer profiles

protocols

GstRtsp.RTSPLowerTrans

r/w

Allowed lower transport protocols

shared

bool

r/w

If media from this factory is shared

stop-on-disconnect

bool

r/w

If media from this factory should be stopped when a client disconnects without TEARDOWN

suspend-mode

GstRtspServer.RTSPSuspendMode

r/w

Control how media will be suspended

transport-mode

GstRtspServer.RTSPTransportMode

r/w

If media from this factory is for PLAY or RECORD

Signals

Inherited:

GObject.Object (1)

Name

Short Description

media-configure

media-constructed

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class GstRtspServer.RTSPMediaFactory(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GstRtspServer.RTSPMediaFactoryClass

The definition and logic for constructing the pipeline for a media. The media can contain multiple streams like audio and video.

classmethod new()[source]
Returns:

a new GstRtspServer.RTSPMediaFactory object.

Return type:

GstRtspServer.RTSPMediaFactory

Create a new GstRtspServer.RTSPMediaFactory instance.

add_role_from_structure(structure)[source]
Parameters:

structure (Gst.Structure) –

A convenience wrapper around GstRtspServer.RTSPPermissions.add_role_from_structure(). If self had no permissions, new permissions will be created and the role will be added to it.

New in version 1.14.

construct(url)[source]
Parameters:

url (GstRtsp.RTSPUrl) – the url used

Returns:

a new GstRtspServer.RTSPMedia if the media could be prepared.

Return type:

GstRtspServer.RTSPMedia or None

Construct the media object and create its streams. Implementations should create the needed gstreamer elements and add them to the result object. No state changes should be performed on them yet.

One or more GstRtspServer.RTSPStream objects should be created from the result with GstRtspServer.RTSPMedia.create_stream ().

After the media is constructed, it can be configured and then prepared with GstRtspServer.RTSPMedia.prepare ().

The returned media will be locked and must be unlocked afterwards.

create_element(url)[source]
Parameters:

url (GstRtsp.RTSPUrl) – the url used

Returns:

a new Gst.Element.

Return type:

Gst.Element or None

Construct and return a Gst.Element that is a Gst.Bin containing the elements to use for streaming the media.

The bin should contain payloaders pay\%d for each stream. The default implementation of this function returns the bin created from the launch parameter.

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 kernel UDP buffer size.

Return type:

int

Get the kernel UDP buffer size.

get_clock()[source]
Returns:

The Gst.Clock

Return type:

Gst.Clock or None

Returns the clock that is going to be used by the pipelines of all medias created from this factory.

New in version 1.8.

get_do_retransmission()[source]
Returns:

Whether retransmission requests will be sent for receiving media

Return type:

bool

New in version 1.16.

get_dscp_qos()[source]
Returns:

the media DSCP QoS value or -1 if disabled.

Return type:

int

Get the configured media DSCP QoS.

New in version 1.18.

get_ensure_keyunit_on_start()[source]
Returns:

The ensure-keyunit-on-start flag.

Return type:

bool

Get ensure-keyunit-on-start flag.

New in version 1.24.

get_ensure_keyunit_on_start_timeout()[source]
Returns:

The ensure-keyunit-on-start-timeout time.

Return type:

int

Get ensure-keyunit-on-start-timeout time.

New in version 1.24.

get_latency()[source]
Returns:

latency in milliseconds

Return type:

int

Get the latency that is used for receiving media

get_launch()[source]
Returns:

the configured launch description. GLib.free() after usage.

Return type:

str or None

Get the Gst.parse_launch() pipeline description that will be used in the default prepare vmethod.

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_media_gtype()[source]
Return type:

GObject.GType

Return the GObject.GType of the GstRtspServer.RTSPMedia subclass this factory will create.

New in version 1.6.

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_permissions()[source]
Returns:

a GstRtspServer.RTSPPermissions object, unref after usage.

Return type:

GstRtspServer.RTSPPermissions or None

Get the permissions object from 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_publish_clock_mode()[source]
Returns:

The GstRtspServer.RTSPPublishClockMode

Return type:

GstRtspServer.RTSPPublishClockMode

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

New in version 1.8.

get_retransmission_time()[source]
Returns:

a #GstClockTime

Return type:

int

Get the time that is stored for retransmission purposes

get_suspend_mode()[source]
Returns:

a GstRtspServer.RTSPSuspendMode.

Return type:

GstRtspServer.RTSPSuspendMode

Get how media created from this factory will be suspended.

get_transport_mode()[source]
Returns:

The transport mode.

Return type:

GstRtspServer.RTSPTransportMode

Get if media created from this factory can be used for PLAY or RECORD methods.

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_enable_rtcp()[source]
Returns:

True if created media will send and receive RTCP

Return type:

bool

Check if created media will send and receive RTCP

New in version 1.20.

is_eos_shutdown()[source]
Returns:

True if the media will receive EOS before shutdown.

Return type:

bool

Get if media created from this factory will have an EOS event sent to the pipeline before shutdown.

is_shared()[source]
Returns:

True if the media will be shared between clients.

Return type:

bool

Get if media created from this factory can be shared between clients.

is_stop_on_disonnect()[source]
Return type:

bool

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_buffer_size(size)[source]
Parameters:

size (int) – the new value

Set the kernel UDP buffer size.

set_clock(clock)[source]
Parameters:

clock (Gst.Clock or None) – the clock to be used by the media factory

Configures a specific clock to be used by the pipelines of all medias created from this factory.

New in version 1.8.

set_do_retransmission(do_retransmission)[source]
Parameters:

do_retransmission (bool) –

Set whether retransmission requests will be sent for receiving media

New in version 1.16.

set_dscp_qos(dscp_qos)[source]
Parameters:

dscp_qos (int) – a new dscp qos value (0-63, or -1 to disable)

Configure the media dscp qos to dscp_qos.

New in version 1.18.

set_enable_rtcp(enable)[source]
Parameters:

enable (bool) – the new value

Decide whether the created media should send and receive RTCP

New in version 1.20.

set_ensure_keyunit_on_start(ensure_keyunit_on_start)[source]
Parameters:

ensure_keyunit_on_start (bool) – the new value

If media from this factory should ensure a key unit when a client connects.

New in version 1.24.

set_ensure_keyunit_on_start_timeout(timeout)[source]
Parameters:

timeout (int) – the new value

Configures medias from this factory to consider keyunits older than timeout to be expired. Expired keyunits will be discarded.

New in version 1.24.

set_eos_shutdown(eos_shutdown)[source]
Parameters:

eos_shutdown (bool) – the new value

Configure if media created from this factory will have an EOS sent to the pipeline before shutdown.

set_latency(latency)[source]
Parameters:

latency (int) – latency in milliseconds

Configure the latency used for receiving media

set_launch(launch)[source]
Parameters:

launch (str) – the launch description

The Gst.parse_launch() line to use for constructing the pipeline in the default prepare vmethod.

The pipeline description should return a Gst.Bin as the toplevel element which can be accomplished by enclosing the description with brackets ‘(’ ‘)’.

The description should return a pipeline with payloaders named pay0, pay1, etc.. Each of the payloaders will result in a stream.

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_media_gtype(media_gtype)[source]
Parameters:

media_gtype (GObject.GType) – the GObject.GType of the class to create

Configure the GObject.GType of the GstRtspServer.RTSPMedia subclass to create (by default, overridden construct vmethods may of course do something different)

New in version 1.6.

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_permissions(permissions)[source]
Parameters:

permissions (GstRtspServer.RTSPPermissions or None) – a GstRtspServer.RTSPPermissions

Set permissions on self.

set_profiles(profiles)[source]
Parameters:

profiles (GstRtsp.RTSPProfile) – the new flags

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_publish_clock_mode(mode)[source]
Parameters:

mode (GstRtspServer.RTSPPublishClockMode) – the clock publish mode

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

New in version 1.8.

set_retransmission_time(time)[source]
Parameters:

time (int) – a #GstClockTime

Configure the time to store for possible retransmission

set_shared(shared)[source]
Parameters:

shared (bool) – the new value

Configure if media created from this factory can be shared between clients.

set_stop_on_disconnect(stop_on_disconnect)[source]
Parameters:

stop_on_disconnect (bool) – the new value

Configure if media created from this factory should be stopped when a client disconnects without sending TEARDOWN.

set_suspend_mode(mode)[source]
Parameters:

mode (GstRtspServer.RTSPSuspendMode) – the new GstRtspServer.RTSPSuspendMode

Configure how media created from this factory will be suspended.

set_transport_mode(mode)[source]
Parameters:

mode (GstRtspServer.RTSPTransportMode) – the new value

Configure if this factory creates media for PLAY or RECORD modes.

do_configure(media) virtual
Parameters:

media (GstRtspServer.RTSPMedia) –

configure the media created with construct. The default implementation will configure the ‘shared’ property of the media.

do_construct(url) virtual
Parameters:

url (GstRtsp.RTSPUrl) – the url used

Returns:

a new GstRtspServer.RTSPMedia if the media could be prepared.

Return type:

GstRtspServer.RTSPMedia or None

Construct the media object and create its streams. Implementations should create the needed gstreamer elements and add them to the result object. No state changes should be performed on them yet.

One or more GstRtspServer.RTSPStream objects should be created from the result with GstRtspServer.RTSPMedia.create_stream ().

After the media is constructed, it can be configured and then prepared with GstRtspServer.RTSPMedia.prepare ().

The returned media will be locked and must be unlocked afterwards.

do_create_element(url) virtual
Parameters:

url (GstRtsp.RTSPUrl) – the url used

Returns:

a new Gst.Element.

Return type:

Gst.Element or None

Construct and return a Gst.Element that is a Gst.Bin containing the elements to use for streaming the media.

The bin should contain payloaders pay\%d for each stream. The default implementation of this function returns the bin created from the launch parameter.

do_gen_key(url) virtual
Parameters:

url (GstRtsp.RTSPUrl) –

Return type:

str

convert url to a key for caching shared GstRtspServer.RTSPMedia objects. The default implementation of this function will use the complete URL including the query parameters to return a key.

do_media_configure(media) virtual
Parameters:

media (GstRtspServer.RTSPMedia) –

signal emitted when a media should be configured

do_media_constructed(media) virtual
Parameters:

media (GstRtspServer.RTSPMedia) –

signal emitted when a media was constructed

Signal Details

GstRtspServer.RTSPMediaFactory.signals.media_configure(r_t_s_p_media_factory, object)
Signal Name:

media-configure

Flags:

RUN_LAST

Parameters:
GstRtspServer.RTSPMediaFactory.signals.media_constructed(r_t_s_p_media_factory, object)
Signal Name:

media-constructed

Flags:

RUN_LAST

Parameters:

Property Details

GstRtspServer.RTSPMediaFactory.props.bind_mcast_address
Name:

bind-mcast-address

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the multicast sockets should be bound to multicast addresses or INADDR_ANY

GstRtspServer.RTSPMediaFactory.props.buffer_size
Name:

buffer-size

Type:

int

Default Value:

524288

Flags:

READABLE, WRITABLE

The kernel UDP buffer size to use

GstRtspServer.RTSPMediaFactory.props.clock
Name:

clock

Type:

Gst.Clock

Default Value:

None

Flags:

READABLE, WRITABLE

Clock to be used by the pipelines created for all medias of this factory

GstRtspServer.RTSPMediaFactory.props.dscp_qos
Name:

dscp-qos

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE

The IP DSCP field to use

GstRtspServer.RTSPMediaFactory.props.enable_rtcp
Name:

enable-rtcp

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether the created media should send and receive RTCP

New in version 1.20.

GstRtspServer.RTSPMediaFactory.props.ensure_keyunit_on_start
Name:

ensure-keyunit-on-start

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

If media from this factory should ensure a key unit when a client connects.

This property will ensure that the stream always starts on a key unit instead of a delta unit which the client would not be able to decode.

Note that this will only affect non-shared medias for now.

New in version 1.24.

GstRtspServer.RTSPMediaFactory.props.ensure_keyunit_on_start_timeout
Name:

ensure-keyunit-on-start-timeout

Type:

int

Default Value:

100

Flags:

READABLE, WRITABLE

Timeout in milliseconds used to determine if a keyunit should be discarded when a client connects.

If the timeout has been reached a new keyframe will be forced, otherwise the currently blocking keyframe will be used.

This options is only relevant when ensure-keyunit-on-start is enabled.

New in version 1.24.

GstRtspServer.RTSPMediaFactory.props.eos_shutdown
Name:

eos-shutdown

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Send EOS down the pipeline before shutting down

GstRtspServer.RTSPMediaFactory.props.latency
Name:

latency

Type:

int

Default Value:

200

Flags:

READABLE, WRITABLE

Latency used for receiving media in milliseconds

GstRtspServer.RTSPMediaFactory.props.launch
Name:

launch

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

A launch description of the pipeline

GstRtspServer.RTSPMediaFactory.props.max_mcast_ttl
Name:

max-mcast-ttl

Type:

int

Default Value:

255

Flags:

READABLE, WRITABLE

The maximum time-to-live value of outgoing multicast packets

GstRtspServer.RTSPMediaFactory.props.profiles
Name:

profiles

Type:

GstRtsp.RTSPProfile

Default Value:

GstRtsp.RTSPProfile.AVP

Flags:

READABLE, WRITABLE

Allowed transfer profiles

GstRtspServer.RTSPMediaFactory.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

GstRtspServer.RTSPMediaFactory.props.shared
Name:

shared

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

If media from this factory is shared

GstRtspServer.RTSPMediaFactory.props.stop_on_disconnect
Name:

stop-on-disconnect

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

If media from this factory should be stopped when a client disconnects without TEARDOWN

GstRtspServer.RTSPMediaFactory.props.suspend_mode
Name:

suspend-mode

Type:

GstRtspServer.RTSPSuspendMode

Default Value:

GstRtspServer.RTSPSuspendMode.NONE

Flags:

READABLE, WRITABLE

Control how media will be suspended

GstRtspServer.RTSPMediaFactory.props.transport_mode
Name:

transport-mode

Type:

GstRtspServer.RTSPTransportMode

Default Value:

GstRtspServer.RTSPTransportMode.PLAY

Flags:

READABLE, WRITABLE

If media from this factory is for PLAY or RECORD