GstRtsp.RTSPConnection¶
Fields¶
None
Methods¶
| class | accept(socket, cancellable) | 
| class | create(url) | 
| class | create_from_socket(socket, ip, port, initial_buffer) | 
| clear_auth_params() | |
| close() | |
| connect(timeout) | |
| connect_usec(timeout) | |
| connect_with_response(timeout, response) | |
| connect_with_response_usec(timeout, response) | |
| do_tunnel(conn2) | |
| flush(flush) | |
| free() | |
| get_ip() | |
| get_read_socket() | |
| get_remember_session_id() | |
| get_tls() | |
| get_tls_database() | |
| get_tls_interaction() | |
| get_tls_validation_flags() | |
| get_tunnelid() | |
| get_url() | |
| get_write_socket() | |
| is_tunneled() | |
| next_timeout(timeout) | |
| next_timeout_usec() | |
| poll(events, revents, timeout) | |
| poll_usec(events, revents, timeout) | |
| read(data, size, timeout) | |
| read_usec(data, size, timeout) | |
| receive(message, timeout) | |
| receive_usec(message, timeout) | |
| reset_timeout() | |
| send(message, timeout) | |
| send_messages(messages, timeout) | |
| send_messages_usec(messages, timeout) | |
| send_usec(message, timeout) | |
| set_accept_certificate_func(func, *user_data) | |
| set_auth(method, user, pass_) | |
| set_auth_param(param, value) | |
| set_content_length_limit(limit) | |
| set_http_mode(enable) | |
| set_ip(ip) | |
| set_proxy(host, port) | |
| set_qos_dscp(qos_dscp) | |
| set_remember_session_id(remember) | |
| set_tls_database(database) | |
| set_tls_interaction(interaction) | |
| set_tls_validation_flags(flags) | |
| set_tunneled(tunneled) | |
| write(data, size, timeout) | |
| write_usec(data, size, timeout) | 
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 socket
- cancellable (Gio.CancellableorNone) – aGio.Cancellableto cancel the operation
 - Returns: - GstRtsp.RTSPResult.OKwhen conn contains a valid connection.- conn: - storage for a - GstRtsp.RTSPConnection- Return type: - ( - GstRtsp.RTSPResult, conn:- GstRtsp.RTSPConnection)- Accept a new connection on socket and create a new - GstRtsp.RTSPConnectionfor handling communication on new socket.
- socket (
 - 
classmethod create(url)[source]¶
- Parameters: - url ( - GstRtsp.RTSPUrl) – a- GstRtsp.RTSPUrl- Returns: - GstRtsp.RTSPResult.OKwhen conn contains a valid connection.- conn: - storage for a - GstRtsp.RTSPConnection- Return type: - ( - GstRtsp.RTSPResult, conn:- GstRtsp.RTSPConnection)- Create a newly allocated - GstRtsp.RTSPConnectionfrom url and store it in conn. The connection will not yet attempt to connect to url, use- GstRtsp.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 end
- port (int) – the port used by the other end
- initial_buffer (str) –GstRtsp.dataalready read from fd
 - Returns: - GstRtsp.RTSPResult.OKwhen conn contains a valid connection.- conn: - storage for a - GstRtsp.RTSPConnection- Return type: - ( - GstRtsp.RTSPResult, conn:- GstRtsp.RTSPConnection)- Create a new - GstRtsp.RTSPConnectionfor handling communication on the existing socket socket. The initial_buffer contains zero terminated- GstRtsp.dataalready read from socket which should be used before starting to read new- GstRtsp.data.
- socket (
 - 
close()[source]¶
- Returns: - GstRtsp.RTSPResult.OKon success.- Return type: - GstRtsp.RTSPResult- 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) – a- GLib.TimeValtimeout- Returns: - GstRtsp.RTSPResult.OKwhen a connection could be made.- Return type: - GstRtsp.RTSPResult- Attempt to connect to the url of self made with - GstRtsp.RTSPConnection.create(). If timeout is- Nonethis function can block forever. If timeout contains a valid timeout, this function will return- GstRtsp.RTSPResult.ETIMEOUTafter 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.OKwhen a connection could be made.- Return type: - GstRtsp.RTSPResult- 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 return- GstRtsp.RTSPResult.ETIMEOUTafter 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.TimeValtimeout
- response (GstRtsp.RTSPMessage) – aGstRtsp.RTSPMessage
 - Returns: - GstRtsp.RTSPResult.OKwhen a connection could be made.- Return type: - Attempt to connect to the url of self made with - GstRtsp.RTSPConnection.create(). If timeout is- Nonethis function can block forever. If timeout contains a valid timeout, this function will return- GstRtsp.RTSPResult.ETIMEOUTafter the timeout expired. If self is set to tunneled, response will contain a- GstRtsp.responseto the tunneling- GstRtsp.requestmessages.- This function can be cancelled with - GstRtsp.RTSPConnection.flush().- New in version 1.8. - Deprecated since version 1.18. 
- timeout (
 - 
connect_with_response_usec(timeout, response)[source]¶
- Parameters: - timeout (int) – a timeout in microseconds
- response (GstRtsp.RTSPMessage) – aGstRtsp.RTSPMessage
 - Returns: - GstRtsp.RTSPResult.OKwhen 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 return- GstRtsp.RTSPResult.ETIMEOUTafter the timeout expired. If self is set to tunneled, response will contain a- GstRtsp.responseto the tunneling- GstRtsp.requestmessages.- This function can be cancelled with - GstRtsp.RTSPConnection.flush().- New in version 1.18. 
- timeout (
 - 
do_tunnel(conn2)[source]¶
- Parameters: - conn2 ( - GstRtsp.RTSPConnection) – a- GstRtsp.RTSPConnectionor- None- Returns: - return - GstRtsp.RTSPResult.OKon success.- Return type: - GstRtsp.RTSPResult- 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 - Nonethen only the base64 decoding context will be setup for self.
 - 
flush(flush)[source]¶
- Parameters: - flush ( - bool) – start or stop the flush- Returns: - GstRtsp.RTSPResult.OK.- Return type: - GstRtsp.RTSPResult- Start or stop the flushing action on self. When flushing, all current and future actions on self will return - GstRtsp.RTSPResult.EINTRuntil the connection is set to non-flushing mode again.
 - 
free()[source]¶
- Returns: - GstRtsp.RTSPResult.OKon success.- Return type: - GstRtsp.RTSPResult- Close and free self. 
 - 
get_ip()[source]¶
- Returns: - The IP address as a string. this value remains valid until the connection is closed. - Return type: - str- Retrieve the IP address of the other end of self. 
 - 
get_read_socket()[source]¶
- Returns: - the file descriptor used for reading or - Noneon error. The file descriptor remains valid until the connection is closed.- Return type: - Gio.Socket- Get the file descriptor for reading. 
 - 
get_remember_session_id()[source]¶
- Returns: - Trueif the- GstRtsp.RTSPConnectionremembers the session id in the last- GstRtsp.responseto set it on any further- GstRtsp.request.- Return type: - bool
 - 
get_tls()[source]¶
- Raises: - GLib.Error- Returns: - the TLS connection for self. - Return type: - Gio.TlsConnection- Get the TLS connection of self. - For client side this will return the - Gio.TlsClientConnectionwhen connected over TLS.- For server side connections, this function will create a - Gio.TlsServerConnectionwhen 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 - Noneif no database has been previously set. Use- GObject.Object.unref() to release the certificate database.- Return type: - Gio.TlsDatabase- 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. Use- GObject.Object.unref() to release.- Return type: - Gio.TlsInteraction- Gets a - Gio.TlsInteractionobject 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 validationg flags. - Return type: - Gio.TlsCertificateFlags- Gets the TLS validation flags used to verify the peer certificate when a TLS connection is established. - New in version 1.2.1. 
 - 
get_tunnelid()[source]¶
- Returns: - returns a non-empty string if self is being tunneled over HTTP. - Return type: - str- Get the tunnel session id the connection. 
 - 
get_url()[source]¶
- Returns: - The URL. This value remains valid until the connection is freed. - Return type: - GstRtsp.RTSPUrl- Retrieve the URL of the other end of self. 
 - 
get_write_socket()[source]¶
- Returns: - the file descriptor used for writing or - Noneon error. The file descriptor remains valid until the connection is closed.- Return type: - Gio.Socket- Get the file descriptor for writing. 
 - 
is_tunneled()[source]¶
- Returns: - if self is using HTTP tunneling. - Return type: - bool- Get the tunneling state of the connection. 
 - 
next_timeout(timeout)[source]¶
- Parameters: - timeout ( - GLib.TimeVal) – a timeout- Returns: - GstRtsp.RTSPResult.OK.- Return type: - GstRtsp.RTSPResult- 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: - int- Calculate the next timeout for self - New in version 1.18. 
 - 
poll(events, revents, timeout)[source]¶
- Parameters: - events (GstRtsp.RTSPEvent) – a bitmask ofGstRtsp.RTSPEventflags to check
- revents (GstRtsp.RTSPEvent) – location for result flags
- timeout (GLib.TimeVal) – a timeout
 - Returns: - GstRtsp.RTSPResult.OKon success.- Return type: - 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. 
- events (
 - 
poll_usec(events, revents, timeout)[source]¶
- Parameters: - events (GstRtsp.RTSPEvent) – a bitmask ofGstRtsp.RTSPEventflags to check
- revents (GstRtsp.RTSPEvent) – location for result flags
- timeout (int) – a timeout in microseconds
 - Returns: - GstRtsp.RTSPResult.OKon success.- Return type: - 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. 
- events (
 - 
read(data, size, timeout)[source]¶
- Parameters: - data (int) – theGstRtsp.datato read
- size (int) – the size of data
- timeout (GLib.TimeVal) – a timeout value orNone
 - Returns: - GstRtsp.RTSPResult.OKon 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. 
- data (
 - 
read_usec(data, size, timeout)[source]¶
- Parameters: - Returns: - GstRtsp.RTSPResult.OKon 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 read
- timeout (GLib.TimeVal) – a timeout value orNone
 - Returns: - GstRtsp.RTSPResult.OKon 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. 
- message (
 - 
receive_usec(message, timeout)[source]¶
- Parameters: - message (GstRtsp.RTSPMessage) – the message to read
- timeout (int) – a timeout value or 0
 - Returns: - GstRtsp.RTSPResult.OKon 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. 
- message (
 - 
reset_timeout()[source]¶
- Returns: - GstRtsp.RTSPResult.OK.- Return type: - GstRtsp.RTSPResult- Reset the timeout of self. 
 - 
send(message, timeout)[source]¶
- Parameters: - message (GstRtsp.RTSPMessage) – the message to send
- timeout (GLib.TimeVal) – a timeout value orNone
 - Returns: - GstRtsp.RTSPResult.OKon 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. 
- message (
 - 
send_messages(messages, timeout)[source]¶
- Parameters: - messages ([GstRtsp.RTSPMessage]) – the messages to send
- timeout (GLib.TimeVal) – a timeout value orNone
 - Returns: - GstRtsp.RTSPResult.OKon 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. 
- messages ([
 - 
send_messages_usec(messages, timeout)[source]¶
- Parameters: - messages ([GstRtsp.RTSPMessage]) – the messages to send
- timeout (int) – a timeout value in microseconds
 - Returns: - GstRtsp.RTSPResult.OKon 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. 
- messages ([
 - 
send_usec(message, timeout)[source]¶
- Parameters: - message (GstRtsp.RTSPMessage) – the message to send
- timeout (int) – a timeout value in microseconds
 - Returns: - GstRtsp.RTSPResult.OKon 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. 
- message (
 - 
set_accept_certificate_func(func, *user_data)[source]¶
- Parameters: - func (GstRtsp.RTSPConnectionAcceptCertificateFunc) – aGstRtsp.RTSPConnectionAcceptCertificateFuncto check certificates
- user_data (objectorNone) – UserGstRtsp.datapassed 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 of- GstRtsp.RTSPConnection(checking against the- Gio.TlsDatabasewith the given- Gio.TlsCertificateFlags) have failed. If no- Gio.TlsDatabaseis set on this connection, only func will be called.- New in version 1.14. 
- func (
 - 
set_auth(method, user, pass_)[source]¶
- Parameters: - method (GstRtsp.RTSPAuthMethod) – authentication method
- user (str) – the user
- pass (str) – the password
 - Returns: - Return type: - Configure self for authentication mode method with user and pass as the user and password respectively. 
- method (
 - 
set_auth_param(param, value)[source]¶
- Parameters: - Setup self with authentication directives. This is not necessary for methods - GstRtsp.RTSPAuthMethod.NONEand- GstRtsp.RTSPAuthMethod.BASIC. For- GstRtsp.RTSPAuthMethod.DIGEST, directives should be taken from the digest challenge in the WWW-Authenticate- GstRtsp.responseheader 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]¶
- Parameters: - enable ( - bool) –- Trueto enable manual HTTP mode- By setting the HTTP mode to - Truethe 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_qos_dscp(qos_dscp)[source]¶
- Parameters: - qos_dscp ( - int) – DSCP value- Returns: - GstRtsp.RTSPResult.OKon success.- Return type: - GstRtsp.RTSPResult- Configure self to use the specified DSCP value. 
 - 
set_remember_session_id(remember)[source]¶
- Parameters: - remember ( - bool) –- Trueif the connection should remember the session id- Sets if the - GstRtsp.RTSPConnectionshould remember the session id from the last- GstRtsp.responsereceived and force it onto any further requests.- The default value is - True
 - 
set_tls_database(database)[source]¶
- Parameters: - database ( - Gio.TlsDatabase) – a- Gio.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) – a- Gio.TlsInteraction- Sets a - Gio.TlsInteractionobject 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: - Trueif the validation flags are set correctly, or- Falseif self is- Noneor is not a TLS connection.- Return type: - bool- Sets the TLS validation flags to be used to verify the peer certificate when a TLS connection is established. - 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, size, timeout)[source]¶
- Parameters: - data (int) – theGstRtsp.datato write
- size (int) – the size of data
- timeout (GLib.TimeVal) – a timeout value orNone
 - Returns: - GstRtsp.RTSPResult.OKon 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. 
- data (
 - 
write_usec(data, size, timeout)[source]¶
- Parameters: - Returns: - GstRtsp.RTSPResult.OKon 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. 
 
- 
classmethod