GstRtsp.RTSPConnection¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class GstRtsp.RTSPConnection¶
This object manages the RTSP connection to the server. It provides function to receive and send bytes and messages.
- classmethod accept(socket, cancellable)[source]¶
- Parameters:
socket (
Gio.Socket
) – a socketcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
to cancel the operation
- Returns:
GstRtsp.RTSPResult.OK
when conn contains a valid connection.- conn:
storage for a
GstRtsp.RTSPConnection
- Return type:
(
GstRtsp.RTSPResult
, conn:GstRtsp.RTSPConnection
orNone
)
Accept a new connection on socket and create a new
GstRtsp.RTSPConnection
for handling communication on new socket.
- classmethod create(url)[source]¶
- Parameters:
url (
GstRtsp.RTSPUrl
) – aGstRtsp.RTSPUrl
- Returns:
GstRtsp.RTSPResult.OK
when conn contains a valid connection.- conn:
storage for a
GstRtsp.RTSPConnection
- Return type:
(
GstRtsp.RTSPResult
, conn:GstRtsp.RTSPConnection
)
Create a newly allocated
GstRtsp.RTSPConnection
from url and store it in conn. The connection will not yet attempt to connect to url, useGstRtsp.RTSPConnection.connect
().A copy of url will be made.
- classmethod create_from_socket(socket, ip, port, initial_buffer)[source]¶
- Parameters:
socket (
Gio.Socket
) – aGio.Socket
ip (
str
) – the IP address of the other endport (
int
) – the port used by the other endinitial_buffer (
str
) –GstRtsp.data
already read from fd
- Returns:
GstRtsp.RTSPResult.OK
when conn contains a valid connection.- conn:
storage for a
GstRtsp.RTSPConnection
- Return type:
(
GstRtsp.RTSPResult
, conn:GstRtsp.RTSPConnection
orNone
)
Create a new
GstRtsp.RTSPConnection
for handling communication on the existing socket socket. The initial_buffer contains zero terminatedGstRtsp.data
already read from socket which should be used before starting to read newGstRtsp.data
.
- add_extra_http_request_header(key, value)[source]¶
-
Add header to be appended to any HTTP
GstRtsp.request
made by connection. If the header already exists then the old header is replaced by the new header.Only applicable in HTTP tunnel mode.
New in version 1.24.
- close()[source]¶
- Returns:
GstRtsp.RTSPResult.OK
on success.- Return type:
Close the connected self. After this call, the connection is in the same state as when it was first created.
- connect(timeout)[source]¶
- Parameters:
timeout (
GLib.TimeVal
) – aGLib.TimeVal
timeout- Returns:
GstRtsp.RTSPResult.OK
when a connection could be made.- Return type:
Attempt to connect to the url of self made with
GstRtsp.RTSPConnection.create
(). If timeout isNone
this function can block forever. If timeout contains a valid timeout, this function will returnGstRtsp.RTSPResult.ETIMEOUT
after the timeout expired.This function can be cancelled with
GstRtsp.RTSPConnection.flush
().Deprecated since version 1.18.
- connect_usec(timeout)[source]¶
- Parameters:
timeout (
int
) – a timeout in microseconds- Returns:
GstRtsp.RTSPResult.OK
when a connection could be made.- Return type:
Attempt to connect to the url of self made with
GstRtsp.RTSPConnection.create
(). If timeout is 0 this function can block forever. If timeout contains a valid timeout, this function will returnGstRtsp.RTSPResult.ETIMEOUT
after the timeout expired.This function can be cancelled with
GstRtsp.RTSPConnection.flush
().New in version 1.18.
- connect_with_response(timeout, response)[source]¶
- Parameters:
timeout (
GLib.TimeVal
) – aGLib.TimeVal
timeoutresponse (
GstRtsp.RTSPMessage
) – aGstRtsp.RTSPMessage
- Returns:
GstRtsp.RTSPResult.OK
when a connection could be made.- Return type:
Attempt to connect to the url of self made with
GstRtsp.RTSPConnection.create
(). If timeout isNone
this function can block forever. If timeout contains a valid timeout, this function will returnGstRtsp.RTSPResult.ETIMEOUT
after the timeout expired. If self is set to tunneled, response will contain aGstRtsp.response
to the tunnelingGstRtsp.request
messages.This function can be cancelled with
GstRtsp.RTSPConnection.flush
().New in version 1.8.
Deprecated since version 1.18.
- connect_with_response_usec(timeout, response)[source]¶
- Parameters:
timeout (
int
) – a timeout in microsecondsresponse (
GstRtsp.RTSPMessage
) – aGstRtsp.RTSPMessage
- Returns:
GstRtsp.RTSPResult.OK
when a connection could be made.- Return type:
Attempt to connect to the url of self made with
GstRtsp.RTSPConnection.create
(). If timeout is 0 this function can block forever. If timeout contains a valid timeout, this function will returnGstRtsp.RTSPResult.ETIMEOUT
after the timeout expired. If self is set to tunneled, response will contain aGstRtsp.response
to the tunnelingGstRtsp.request
messages.This function can be cancelled with
GstRtsp.RTSPConnection.flush
().New in version 1.18.
- do_tunnel(conn2)[source]¶
- Parameters:
conn2 (
GstRtsp.RTSPConnection
orNone
) – aGstRtsp.RTSPConnection
orNone
- Returns:
return
GstRtsp.RTSPResult.OK
on success.- Return type:
If self received the first tunnel connection and conn2 received the second tunnel connection, link the two connections together so that self manages the tunneled connection.
After this call, conn2 cannot be used anymore and must be freed with
GstRtsp.RTSPConnection.free
().If conn2 is
None
then only the base64 decoding context will be setup for self.
- flush(flush)[source]¶
- Parameters:
flush (
bool
) – start or stop the flush- Returns:
- Return type:
Start or stop the flushing action on self. When flushing, all current and future actions on self will return
GstRtsp.RTSPResult.EINTR
until the connection is set to non-flushing mode again.
- free()[source]¶
- Returns:
GstRtsp.RTSPResult.OK
on success.- Return type:
Close and free self.
- get_ignore_x_server_reply()[source]¶
- Returns:
returns
True
if the x-server-ip-address header reply will be ignored, else returnsFalse
- Return type:
Get the ignore_x_server_reply value.
New in version 1.20.
- get_ip()[source]¶
- Returns:
The IP address as a string. this value remains valid until the connection is closed.
- Return type:
Retrieve the IP address of the other end of self.
- get_read_socket()[source]¶
- Returns:
the file descriptor used for reading or
None
on error. The file descriptor remains valid until the connection is closed.- Return type:
Gio.Socket
orNone
Get the file descriptor for reading.
- get_remember_session_id()[source]¶
- Returns:
True
if theGstRtsp.RTSPConnection
remembers the session id in the lastGstRtsp.response
to set it on any furtherGstRtsp.request
.- Return type:
- get_tls()[source]¶
- Raises:
- Returns:
the TLS connection for self.
- Return type:
Get the TLS connection of self.
For client side this will return the
Gio.TlsClientConnection
when connected over TLS.For server side connections, this function will create a
Gio.TlsServerConnection
when called the first time and will return that same connection on subsequent calls. The server is then responsible for configuring the TLS connection.New in version 1.2.
- get_tls_database()[source]¶
- Returns:
the anchor certificate authorities database, or
None
if no database has been previously set. UseGObject.Object.unref
() to release the certificate database.- Return type:
Gets the anchor certificate authorities database that will be used after a server certificate can’t be verified with the default certificate database.
New in version 1.4.
- get_tls_interaction()[source]¶
- Returns:
a reference on the
Gio.TlsInteraction
. UseGObject.Object.unref
() to release.- Return type:
Gets a
Gio.TlsInteraction
object to be used when the connection or certificate database need to interact with the user. This will be used to prompt the user for passwords where necessary.New in version 1.6.
- get_tls_validation_flags()[source]¶
- Returns:
the validation flags.
- Return type:
Gets the TLS validation flags used to verify the peer certificate when a TLS connection is established.
GLib guarantees that if certificate verification fails, at least one error will be set, but it does not guarantee that all possible errors will be set. Accordingly, you may not safely decide to ignore any particular type of error.
For example, it would be incorrect to ignore
Gio.TlsCertificateFlags.EXPIRED
if you want to allow expired certificates, because this could potentially be the only error flag set even if other problems exist with the certificate.New in version 1.2.1.
- get_url()[source]¶
- Returns:
The URL. This value remains valid until the connection is freed.
- Return type:
Retrieve the URL of the other end of self.
- get_write_socket()[source]¶
- Returns:
the file descriptor used for writing or
None
on error. The file descriptor remains valid until the connection is closed.- Return type:
Gio.Socket
orNone
Get the file descriptor for writing.
- is_tunneled()[source]¶
- Returns:
if self is using HTTP tunneling.
- Return type:
Get the tunneling state of the connection.
- next_timeout(timeout)[source]¶
- Parameters:
timeout (
GLib.TimeVal
) – a timeout- Returns:
- Return type:
Calculate the next timeout for self, storing the result in timeout.
Deprecated since version 1.18.
- next_timeout_usec()[source]¶
- Returns:
#the next timeout in microseconds
- Return type:
Calculate the next timeout for self
New in version 1.18.
- poll(events, timeout)[source]¶
- Parameters:
events (
GstRtsp.RTSPEvent
) – a bitmask ofGstRtsp.RTSPEvent
flags to checktimeout (
GLib.TimeVal
) – a timeout
- Returns:
GstRtsp.RTSPResult.OK
on success.- revents:
location for result flags
- Return type:
(
GstRtsp.RTSPResult
, revents:GstRtsp.RTSPEvent
)
Wait up to the specified timeout for the connection to become available for at least one of the operations specified in events. When the function returns with
GstRtsp.RTSPResult.OK
, revents will contain a bitmask of available operations on self.timeout can be
None
, in which case this function might block forever.This function can be cancelled with
GstRtsp.RTSPConnection.flush
().Deprecated since version 1.18.
- poll_usec(events, timeout)[source]¶
- Parameters:
events (
GstRtsp.RTSPEvent
) – a bitmask ofGstRtsp.RTSPEvent
flags to checktimeout (
int
) – a timeout in microseconds
- Returns:
GstRtsp.RTSPResult.OK
on success.- revents:
location for result flags
- Return type:
(
GstRtsp.RTSPResult
, revents:GstRtsp.RTSPEvent
)
Wait up to the specified timeout for the connection to become available for at least one of the operations specified in events. When the function returns with
GstRtsp.RTSPResult.OK
, revents will contain a bitmask of available operations on self.timeout can be 0, in which case this function might block forever.
This function can be cancelled with
GstRtsp.RTSPConnection.flush
().New in version 1.18.
- read(data, timeout)[source]¶
- Parameters:
data (
bytes
) – theGstRtsp.data
to readtimeout (
GLib.TimeVal
) – a timeout value orNone
- Returns:
GstRtsp.RTSPResult.OK
on success.- Return type:
Attempt to read size bytes into data from the connected self, blocking up to the specified timeout. timeout can be
None
, in which case this function might block forever.This function can be cancelled with
GstRtsp.RTSPConnection.flush
().Deprecated since version 1.18.
- read_usec(data, timeout)[source]¶
- Parameters:
- Returns:
GstRtsp.RTSPResult.OK
on success.- Return type:
Attempt to read size bytes into data from the connected self, blocking up to the specified timeout. timeout can be 0, in which case this function might block forever.
This function can be cancelled with
GstRtsp.RTSPConnection.flush
().New in version 1.18.
- receive(message, timeout)[source]¶
- Parameters:
message (
GstRtsp.RTSPMessage
) – the message to readtimeout (
GLib.TimeVal
) – a timeout value orNone
- Returns:
GstRtsp.RTSPResult.OK
on success.- Return type:
Attempt to read into message from the connected self, blocking up to the specified timeout. timeout can be
None
, in which case this function might block forever.This function can be cancelled with
GstRtsp.RTSPConnection.flush
().Deprecated since version 1.18.
- receive_usec(message, timeout)[source]¶
- Parameters:
message (
GstRtsp.RTSPMessage
) – the message to readtimeout (
int
) – a timeout value or 0
- Returns:
GstRtsp.RTSPResult.OK
on success.- Return type:
Attempt to read into message from the connected self, blocking up to the specified timeout. timeout can be 0, in which case this function might block forever.
This function can be cancelled with
GstRtsp.RTSPConnection.flush
().New in version 1.18.
- send(message, timeout)[source]¶
- Parameters:
message (
GstRtsp.RTSPMessage
) – the message to sendtimeout (
GLib.TimeVal
) – a timeout value orNone
- Returns:
GstRtsp.RTSPResult.OK
on success.- Return type:
Attempt to send message to the connected self, blocking up to the specified timeout. timeout can be
None
, in which case this function might block forever.This function can be cancelled with
GstRtsp.RTSPConnection.flush
().Deprecated since version 1.18.
- send_messages(messages, timeout)[source]¶
- Parameters:
messages ([
GstRtsp.RTSPMessage
]) – the messages to sendtimeout (
GLib.TimeVal
) – a timeout value orNone
- Returns:
GstRtsp.RTSPResult.OK
on success.- Return type:
Attempt to send messages to the connected self, blocking up to the specified timeout. timeout can be
None
, in which case this function might block forever.This function can be cancelled with
GstRtsp.RTSPConnection.flush
().New in version 1.16.
Deprecated since version 1.18.
- send_messages_usec(messages, timeout)[source]¶
- Parameters:
messages ([
GstRtsp.RTSPMessage
]) – the messages to sendtimeout (
int
) – a timeout value in microseconds
- Returns:
GstRtsp.RTSPResult.OK
on Since.- Return type:
Attempt to send messages to the connected self, blocking up to the specified timeout. timeout can be 0, in which case this function might block forever.
This function can be cancelled with
GstRtsp.RTSPConnection.flush
().New in version 1.18.
- send_usec(message, timeout)[source]¶
- Parameters:
message (
GstRtsp.RTSPMessage
) – the message to sendtimeout (
int
) – a timeout value in microseconds
- Returns:
GstRtsp.RTSPResult.OK
on success.- Return type:
Attempt to send message to the connected self, blocking up to the specified timeout. timeout can be 0, in which case this function might block forever.
This function can be cancelled with
GstRtsp.RTSPConnection.flush
().New in version 1.18.
- set_accept_certificate_func(func, *user_data)[source]¶
- Parameters:
func (
GstRtsp.RTSPConnectionAcceptCertificateFunc
) – aGstRtsp.RTSPConnectionAcceptCertificateFunc
to check certificatesuser_data (
object
orNone
) – UserGstRtsp.data
passed to func
Sets a custom accept-certificate function for checking certificates for validity. This will directly map to
Gio.TlsConnection
‘s “accept-certificate” signal and be performed after the default checks ofGstRtsp.RTSPConnection
(checking against theGio.TlsDatabase
with the givenGio.TlsCertificateFlags
) have failed. If noGio.TlsDatabase
is set on this connection, only func will be called.New in version 1.14.
- set_auth(method, user, pass_)[source]¶
- Parameters:
method (
GstRtsp.RTSPAuthMethod
) – authentication methoduser (
str
) – the userpass (
str
) – the password
- Returns:
- Return type:
Configure self for authentication mode method with user and pass as the user and password respectively.
- set_auth_param(param, value)[source]¶
-
Setup self with authentication directives. This is not necessary for methods
GstRtsp.RTSPAuthMethod.NONE
andGstRtsp.RTSPAuthMethod.BASIC
. ForGstRtsp.RTSPAuthMethod.DIGEST
, directives should be taken from the digest challenge in the WWW-AuthenticateGstRtsp.response
header and can include realm, domain, nonce, opaque, stale, algorithm, qop as per RFC2617.
- set_content_length_limit(limit)[source]¶
- Parameters:
limit (
int
) – Content-Length limit
Configure self to use the specified Content-Length limit. Both requests and responses are validated. If content-length is exceeded, ENOMEM error will be returned.
New in version 1.18.
- set_http_mode(enable)[source]¶
-
By setting the HTTP mode to
True
the message parsing will support HTTP messages in addition to the RTSP messages. It will also disable the automatic handling of setting up an HTTP tunnel.
- set_ignore_x_server_reply(ignore)[source]¶
- Parameters:
ignore (
bool
) –True
to ignore the x-server-ip-address header reply orFalse
to comply with it (False
is the default).
Set whether to ignore the x-server-ip-address header reply or not. If the header is ignored, the original address will be used instead.
New in version 1.20.
- set_qos_dscp(qos_dscp)[source]¶
- Parameters:
qos_dscp (
int
) – DSCP value- Returns:
GstRtsp.RTSPResult.OK
on success.- Return type:
Configure self to use the specified DSCP value.
- set_remember_session_id(remember)[source]¶
-
Sets if the
GstRtsp.RTSPConnection
should remember the session id from the lastGstRtsp.response
received and force it onto any further requests.The default value is
True
- set_tls_database(database)[source]¶
- Parameters:
database (
Gio.TlsDatabase
orNone
) – aGio.TlsDatabase
Sets the anchor certificate authorities database. This certificate database will be used to verify the server’s certificate in case it can’t be verified with the default certificate database first.
New in version 1.4.
- set_tls_interaction(interaction)[source]¶
- Parameters:
interaction (
Gio.TlsInteraction
orNone
) – aGio.TlsInteraction
Sets a
Gio.TlsInteraction
object to be used when the connection or certificate database need to interact with the user. This will be used to prompt the user for passwords where necessary.New in version 1.6.
- set_tls_validation_flags(flags)[source]¶
- Parameters:
flags (
Gio.TlsCertificateFlags
) – the validation flags.- Returns:
True
if the validation flags are set correctly, orFalse
if self isNone
or is not a TLS connection.- Return type:
Sets the TLS validation flags to be used to verify the peer certificate when a TLS connection is established.
GLib guarantees that if certificate verification fails, at least one error will be set, but it does not guarantee that all possible errors will be set. Accordingly, you may not safely decide to ignore any particular type of error.
For example, it would be incorrect to mask
Gio.TlsCertificateFlags.EXPIRED
if you want to allow expired certificates, because this could potentially be the only error flag set even if other problems exist with the certificate.New in version 1.2.1.
- set_tunneled(tunneled)[source]¶
- Parameters:
tunneled (
bool
) – the new state
Set the HTTP tunneling state of the connection. This must be configured before the self is connected.
- write(data, timeout)[source]¶
- Parameters:
data (
bytes
) – theGstRtsp.data
to writetimeout (
GLib.TimeVal
) – a timeout value orNone
- Returns:
GstRtsp.RTSPResult.OK
on success.- Return type:
Attempt to write size bytes of data to the connected self, blocking up to the specified timeout. timeout can be
None
, in which case this function might block forever.This function can be cancelled with
GstRtsp.RTSPConnection.flush
().Deprecated since version 1.18.
- write_usec(data, timeout)[source]¶
- Parameters:
- Returns:
GstRtsp.RTSPResult.OK
on success.- Return type:
Attempt to write size bytes of data to the connected self, blocking up to the specified timeout. timeout can be 0, in which case this function might block forever.
This function can be cancelled with
GstRtsp.RTSPConnection.flush
().New in version 1.18.