GstRtspServer.RTSPSession

g GObject.Object GObject.Object GstRtspServer.RTSPSession GstRtspServer.RTSPSession GObject.Object->GstRtspServer.RTSPSession

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (sessionid)

allow_expire ()

dup_media (path)

filter (func, *user_data)

get_header ()

get_media (path)

get_sessionid ()

get_timeout ()

is_expired (now)

is_expired_usec (now)

manage_media (path, media)

next_timeout (now)

next_timeout_usec (now)

prevent_expire ()

release_media (media)

set_timeout (timeout)

touch ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

extra-timeout

int

r/w

Add extra time to timeout

sessionid

str

r/w/co

the session id

timeout

int

r/w

the timeout of the session (0 = never)

timeout-always-visible

bool

r/w

timeout always visible in header

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class GstRtspServer.RTSPSession(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GstRtspServer.RTSPSessionClass

Session information kept by the server for a specific client. One client session, identified with a session id, can handle multiple medias identified with the url of a media.

classmethod new(sessionid)[source]
Parameters:

sessionid (str) – a session id

Returns:

a new GstRtspServer.RTSPSession

Return type:

GstRtspServer.RTSPSession

Create a new GstRtspServer.RTSPSession instance with sessionid.

allow_expire()[source]

Allow self to expire. This method must be called an equal amount of time as GstRtspServer.RTSPSession.prevent_expire().

dup_media(path)[source]
Parameters:

path (str) – the path for the media

Returns:

the configuration for path in self, should be unreferenced when no longer needed.

matched:

the amount of matched characters

Return type:

(GstRtspServer.RTSPSessionMedia or None, matched: int)

Gets the session media for path, increasing its reference count. matched will contain the number of matched characters of path.

New in version 1.20.

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

a GLib.List with all media 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.RTSPSessionMedia]

Call func for each media in self. The result value of func determines what happens to the media. 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 media will be removed from self.

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

If func returns GstRtspServer.RTSPFilterResult.REF, the media 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 all media.

get_header()[source]
Returns:

the Session header of self. GLib.free() after usage.

Return type:

str or None

Get the string that can be placed in the Session header field.

get_media(path)[source]
Parameters:

path (str) – the path for the media

Returns:

the configuration for path in self.

matched:

the amount of matched characters

Return type:

(GstRtspServer.RTSPSessionMedia or None, matched: int)

Gets the session media for path. matched will contain the number of matched characters of path.

get_sessionid()[source]
Returns:

the sessionid of self. The value remains valid as long as self is alive.

Return type:

str or None

Get the sessionid of self.

get_timeout()[source]
Returns:

the timeout of self in seconds.

Return type:

int

Get the timeout value of self.

is_expired(now)[source]
Parameters:

now (GLib.TimeVal) – the current system time

Returns:

True if self timed out

Return type:

bool

Check if self timeout out.

Deprecated since version ???: Use GstRtspServer.RTSPSession.is_expired_usec() instead.

is_expired_usec(now)[source]
Parameters:

now (int) – the current monotonic time

Returns:

True if self timed out

Return type:

bool

Check if self timeout out.

manage_media(path, media)[source]
Parameters:
Returns:

a new GstRTSPSessionMedia object.

Return type:

GstRtspServer.RTSPSessionMedia

Manage the media object obj in self. path will be used to retrieve this media from the session with GstRtspServer.RTSPSession.get_media().

Ownership is taken from media.

next_timeout(now)[source]
Parameters:

now (GLib.TimeVal) – the current system time

Returns:

the amount of milliseconds since the session will time out.

Return type:

int

Get the amount of milliseconds till the session will expire.

Deprecated since version ???: Use GstRtspServer.RTSPSession.next_timeout_usec() instead.

next_timeout_usec(now)[source]
Parameters:

now (int) – the current monotonic time

Returns:

the amount of milliseconds since the session will time out.

Return type:

int

Get the amount of milliseconds till the session will expire.

prevent_expire()[source]

Prevent self from expiring.

release_media(media)[source]
Parameters:

media (GstRtspServer.RTSPSessionMedia) – a GstRtspServer.RTSPMedia

Returns:

True if there are more media session left in self.

Return type:

bool

Release the managed media in self, freeing the memory allocated by it.

set_timeout(timeout)[source]
Parameters:

timeout (int) – the new timeout

Configure self for a timeout of timeout seconds. The session will be cleaned up when there is no activity for timeout seconds.

touch()[source]

Update the last_access time of the session to the current time.

Property Details

GstRtspServer.RTSPSession.props.extra_timeout
Name:

extra-timeout

Type:

int

Default Value:

5

Flags:

READABLE, WRITABLE

Add extra time to timeout

GstRtspServer.RTSPSession.props.sessionid
Name:

sessionid

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

the session id

GstRtspServer.RTSPSession.props.timeout
Name:

timeout

Type:

int

Default Value:

60

Flags:

READABLE, WRITABLE

the timeout of the session (0 = never)

GstRtspServer.RTSPSession.props.timeout_always_visible
Name:

timeout-always-visible

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

timeout always visible in header