GstRtsp.RTSPWatch

Fields

None

Methods

attach (context)

get_send_backlog ()

reset ()

send_message (message)

send_messages (messages)

set_flushing (flushing)

set_send_backlog (bytes, messages)

unref ()

wait_backlog (timeout)

wait_backlog_usec (timeout)

write_data (data)

Details

class GstRtsp.RTSPWatch

Opaque RTSP watch object that can be used for asynchronous RTSP operations.

attach(context)
Parameters:

context (GLib.MainContext or None) – a GLib.MainContext (if None, the default context will be used)

Returns:

the ID (greater than 0) for the watch within the GLib.MainContext.

Return type:

int

Adds a GstRtsp.RTSPWatch to a context so that it will be executed within that context.

get_send_backlog()
Returns:

bytes:

maximum bytes

messages:

maximum messages

Return type:

(bytes: int, messages: int)

Get the maximum amount of bytes and messages that will be queued in self. See GstRtsp.RTSPWatch.set_send_backlog().

New in version 1.2.

reset()

Reset self, this is usually called after GstRtsp.RTSPConnection.do_tunnel() when the file descriptors of the connection might have changed.

send_message(message)
Parameters:

message (GstRtsp.RTSPMessage) – a GstRtsp.RTSPMessage

Returns:

GstRtsp.RTSPResult.OK on success.

id:

location for a message ID or None

Return type:

(GstRtsp.RTSPResult, id: int)

Send a message using the connection of the self. If it cannot be sent immediately, it will be queued for transmission in self. The contents of message will then be serialized and transmitted when the connection of the self becomes writable. In case the message is queued, the ID returned in id will be non-zero and used as the ID argument in the message_sent callback.

send_messages(messages)
Parameters:

messages ([GstRtsp.RTSPMessage]) – the messages to send

Returns:

GstRtsp.RTSPResult.OK on success.

id:

location for a message ID or None

Return type:

(GstRtsp.RTSPResult, id: int)

Sends messages using the connection of the self. If they cannot be sent immediately, they will be queued for transmission in self. The contents of messages will then be serialized and transmitted when the connection of the self becomes writable. In case the messages are queued, the ID returned in id will be non-zero and used as the ID argument in the message_sent callback once the last message is sent. The callback will only be called once for the last message.

New in version 1.16.

set_flushing(flushing)
Parameters:

flushing (bool) – new flushing state

When flushing is True, abort a call to GstRtsp.RTSPWatch.wait_backlog() and make sure GstRtsp.RTSPWatch.write_data() returns immediately with GstRtsp.RTSPResult.EINTR. And empty the queue.

New in version 1.4.

set_send_backlog(bytes, messages)
Parameters:
  • bytes (int) – maximum bytes

  • messages (int) – maximum messages

Set the maximum amount of bytes and messages that will be queued in self. When the maximum amounts are exceeded, GstRtsp.RTSPWatch.write_data() and GstRtsp.RTSPWatch.send_message() will return GstRtsp.RTSPResult.ENOMEM.

A value of 0 for bytes or messages means no limits.

New in version 1.2.

unref()

Decreases the reference count of self by one. If the resulting reference count is zero the watch and associated memory will be destroyed.

wait_backlog(timeout)
Parameters:

timeout (GLib.TimeVal) – a GLib.TimeVal timeout

Returns:

GstRtsp.RTSPResult.OK when if there is room in queue. GstRtsp.RTSPResult.ETIMEOUT when timeout was reached. GstRtsp.RTSPResult.EINTR when self is flushing GstRtsp.RTSPResult.EINVAL when called with invalid parameters.

Return type:

GstRtsp.RTSPResult

Wait until there is place in the backlog queue, timeout is reached or self is set to flushing.

If timeout is None this function can block forever. If timeout contains a valid timeout, this function will return GstRtsp.RTSPResult.ETIMEOUT after the timeout expired.

The typically use of this function is when GstRtsp.RTSPWatch.write_data returns GstRtsp.RTSPResult.ENOMEM. The caller then calls this function to wait for free space in the backlog queue and try again.

New in version 1.4.

Deprecated since version 1.18.

wait_backlog_usec(timeout)
Parameters:

timeout (int) – a timeout in microseconds

Returns:

GstRtsp.RTSPResult.OK when if there is room in queue. GstRtsp.RTSPResult.ETIMEOUT when timeout was reached. GstRtsp.RTSPResult.EINTR when self is flushing GstRtsp.RTSPResult.EINVAL when called with invalid parameters.

Return type:

GstRtsp.RTSPResult

Wait until there is place in the backlog queue, timeout is reached or self is set to flushing.

If timeout is 0 this function can block forever. If timeout contains a valid timeout, this function will return GstRtsp.RTSPResult.ETIMEOUT after the timeout expired.

The typically use of this function is when GstRtsp.RTSPWatch.write_data returns GstRtsp.RTSPResult.ENOMEM. The caller then calls this function to wait for free space in the backlog queue and try again.

New in version 1.18.

write_data(data)
Parameters:

data (bytes) – the GstRtsp.data to queue

Returns:

GstRtsp.RTSPResult.OK on success. GstRtsp.RTSPResult.ENOMEM when the backlog limits are reached. GstRtsp.RTSPResult.EINTR when self was flushing.

id:

location for a message ID or None

Return type:

(GstRtsp.RTSPResult, id: int)

Write data using the connection of the self. If it cannot be sent immediately, it will be queued for transmission in self. The contents of message will then be serialized and transmitted when the connection of the self becomes writable. In case the message is queued, the ID returned in id will be non-zero and used as the ID argument in the message_sent callback.

This function will take ownership of data and GLib.free() it after use.

If the amount of queued GstRtsp.data exceeds the limits set with GstRtsp.RTSPWatch.set_send_backlog(), this function will return GstRtsp.RTSPResult.ENOMEM.