GstRtspServer.RTSPServer¶
| Subclasses: | GstRtspServer.RTSPOnvifServer | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | io_func(socket, condition, server) | 
| class | new() | 
| attach(context) | |
| client_filter(func, *user_data) | |
| create_socket(cancellable) | |
| create_source(cancellable) | |
| get_address() | |
| get_auth() | |
| get_backlog() | |
| get_bound_port() | |
| get_content_length_limit() | |
| get_mount_points() | |
| get_service() | |
| get_session_pool() | |
| get_thread_pool() | |
| set_address(address) | |
| set_auth(auth) | |
| set_backlog(backlog) | |
| set_content_length_limit(limit) | |
| set_mount_points(mounts) | |
| set_service(service) | |
| set_session_pool(pool) | |
| set_thread_pool(pool) | |
| transfer_connection(socket, ip, port, initial_buffer) | 
Properties¶
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| address | str | r/w | The address the server uses to listen on | 
| backlog | int | r/w | The maximum length to which the queue of pending connections may grow | 
| bound-port | int | r | The port number the server is listening on | 
| content-length-limit | int | r/w | Limitation of Content-Length | 
| mount-points | GstRtspServer.RTSPMountPoints | r/w | The mount points to use for client session | 
| service | str | r/w | The service or port number the server uses to listen on | 
| session-pool | GstRtspServer.RTSPSessionPool | r/w | The session pool to use for client session | 
Class Details¶
- 
class GstRtspServer.RTSPServer(**kwargs)¶
- Bases: - GObject.Object- Abstract: - No - Structure: - GstRtspServer.RTSPServerClass- This object listens on a port, creates and manages the clients connected to it. - 
classmethod io_func(socket, condition, server)[source]¶
- Parameters: - socket (Gio.Socket) – aGio.Socket
- condition (GLib.IOCondition) – the condition on source
- server (GstRtspServer.RTSPServer) – aGstRtspServer.RTSPServer
 - Returns: - Trueif the source could be connected,- Falseif an error occurred.- Return type: - A default - Gio.SocketSourceFuncthat creates a new- GstRtspServer.RTSPClientto accept and handle a new connection on socket or server.
- socket (
 - 
classmethod new()[source]¶
- Returns: - a new - GstRtspServer.RTSPServer- Return type: - GstRtspServer.RTSPServer- Create a new - GstRtspServer.RTSPServerinstance.
 - 
attach(context)[source]¶
- Parameters: - context ( - GLib.MainContextor- None) – a- GLib.MainContext- Returns: - the ID (greater than 0) for the source within the - GLib.MainContext.- Return type: - int- Attaches self to context. When the mainloop for context is run, the server will be dispatched. When context is - None, the default context will be used).- This function should be called when the server properties and urls are fully configured and the server is ready to start. - This takes a reference on self until the source is destroyed. Note that if context is not the default main context as returned by - GLib.MainContext.default() (or- None),- GLib.Source.remove() cannot be used to destroy the source. In that case it is recommended to use- GstRtspServer.RTSPServer.create_source() and attach it to context manually.
 - 
client_filter(func, *user_data)[source]¶
- Parameters: - func (GstRtspServer.RTSPServerClientFilterFuncorNone) – a callback
- user_data (objectorNone) – userGstRtsp.datapassed to func
 - Returns: - a - GLib.Listwith all clients for which func returned- GstRtspServer.RTSPFilterResult.REF. After usage, each element in the- GLib.Listshould be unreffed before the list is freed.- Return type: - Call func for each client managed by self. The result value of func determines what happens to the client. 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 client will be removed from self.- If func returns - GstRtspServer.RTSPFilterResult.KEEP, the client will remain in self.- If func returns - GstRtspServer.RTSPFilterResult.REF, the client will remain in self but will also be added with an additional ref to the result- GLib.Listof this function..- When func is - None,- GstRtspServer.RTSPFilterResult.REFwill be assumed for each client.
- func (
 - 
create_socket(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – a- Gio.Cancellable- Raises: - GLib.Error- Returns: - the - Gio.Socketfor self or- Nonewhen an error occurred.- Return type: - Gio.Socket- Create a - Gio.Socketfor self. The socket will listen on the configured service.
 - 
create_source(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – a- Gio.Cancellableor- None.- Raises: - GLib.Error- Returns: - the - GLib.Sourcefor self or- Nonewhen an error occurred. Free with- GLib.Source.unref()- Return type: - GLib.Source- Create a - GLib.Sourcefor self. The new source will have a default- Gio.SocketSourceFuncof- GstRtspServer.RTSPServer.io_func().- cancellable if not - Nonecan be used to cancel the source, which will cause the source to trigger, reporting the current condition (which is likely 0 unless cancellation happened at the same time as a condition change). You can check for this in the callback using- Gio.Cancellable.is_cancelled().- This takes a reference on self until source is destroyed. 
 - 
get_address()[source]¶
- Returns: - the server address. - GLib.free() after usage.- Return type: - stror- None- Get the address on which the server will accept connections. 
 - 
get_auth()[source]¶
- Returns: - the - GstRtspServer.RTSPAuthof self.- GObject.Object.unref() after usage.- Return type: - GstRtspServer.RTSPAuthor- None- Get the - GstRtspServer.RTSPAuthused as the authentication manager of self.
 - 
get_backlog()[source]¶
- Returns: - the server backlog. - Return type: - int- The maximum amount of queued requests for the server. 
 - 
get_bound_port()[source]¶
- Returns: - the port number - Return type: - int- Get the port number where the server was bound to. 
 - 
get_content_length_limit()[source]¶
- Returns: - the Content-Length limit. - Return type: - int- Get the Content-Length limit of self. - New in version 1.18. 
 - 
get_mount_points()[source]¶
- Returns: - the - GstRtspServer.RTSPMountPointsof self.- GObject.Object.unref() after usage.- Return type: - GstRtspServer.RTSPMountPointsor- None- Get the - GstRtspServer.RTSPMountPointsused as the mount points of self.
 - 
get_service()[source]¶
- Returns: - the service. use - GLib.free() after usage.- Return type: - stror- None- Get the service on which the server will accept connections. 
 - 
get_session_pool()[source]¶
- Returns: - the - GstRtspServer.RTSPSessionPoolused for sessions.- GObject.Object.unref() after usage.- Return type: - GstRtspServer.RTSPSessionPoolor- None- Get the - GstRtspServer.RTSPSessionPoolused as the session pool of self.
 - 
get_thread_pool()[source]¶
- Returns: - the - GstRtspServer.RTSPThreadPoolof self.- GObject.Object.unref() after usage.- Return type: - GstRtspServer.RTSPThreadPoolor- None- Get the - GstRtspServer.RTSPThreadPoolused as the thread pool of self.
 - 
set_address(address)[source]¶
- Parameters: - address ( - str) – the address- Configure self to accept connections on the given address. - This function must be called before the server is bound. 
 - 
set_auth(auth)[source]¶
- Parameters: - auth ( - GstRtspServer.RTSPAuthor- None) – a- GstRtspServer.RTSPAuth- configure auth to be used as the authentication manager of self. 
 - 
set_backlog(backlog)[source]¶
- Parameters: - backlog ( - int) – the backlog- configure the maximum amount of requests that may be queued for the server. - This function must be called before the server is bound. 
 - 
set_content_length_limit(limit)[source]¶
- Parameters: - limit ( - int) –- Define an appropriate - GstRtsp.requestsize limit and reject requests exceeding the limit.- New in version 1.18. 
 - 
set_mount_points(mounts)[source]¶
- Parameters: - mounts ( - GstRtspServer.RTSPMountPointsor- None) – a- GstRtspServer.RTSPMountPoints- configure mounts to be used as the mount points of self. 
 - 
set_service(service)[source]¶
- Parameters: - service ( - str) – the service- Configure self to accept connections on the given service. service should be a string containing the service name (see services(5)) or a string containing a port number between 1 and 65535. - When service is set to “0”, the server will listen on a random free port. The actual used port can be retrieved with - GstRtspServer.RTSPServer.get_bound_port().- This function must be called before the server is bound. 
 - 
set_session_pool(pool)[source]¶
- Parameters: - pool ( - GstRtspServer.RTSPSessionPoolor- None) – a- GstRtspServer.RTSPSessionPool- configure pool to be used as the session pool of self. 
 - 
set_thread_pool(pool)[source]¶
- Parameters: - pool ( - GstRtspServer.RTSPThreadPoolor- None) – a- GstRtspServer.RTSPThreadPool- configure pool to be used as the thread pool of self. 
 - 
transfer_connection(socket, ip, port, initial_buffer)[source]¶
- Parameters: - socket (Gio.Socket) – a network socket
- ip (str) – the IP address of the remote client
- port (int) – the port used by the other end
- initial_buffer (strorNone) – any initialGstRtsp.datathat was already read from the socket
 - Returns: - Return type: - Take an existing network socket and use it for an RTSP connection. This is used when transferring a socket from an HTTP server which should be used as an RTSP over HTTP tunnel. The initial_buffer contains any remaining - GstRtsp.datathat the HTTP server read from the socket while parsing the HTTP header.
- socket (
 - 
do_client_connected(client) virtual¶
- Parameters: - client ( - GstRtspServer.RTSPClient) –
 
- 
classmethod 
Signal Details¶
- 
GstRtspServer.RTSPServer.signals.client_connected(r_t_s_p_server, object)¶
- Signal Name: - client-connected- Flags: - Parameters: - r_t_s_p_server (GstRtspServer.RTSPServer) – The object which received the signal
- object (GstRtspServer.RTSPClient) –
 
- r_t_s_p_server (
Property Details¶
- 
GstRtspServer.RTSPServer.props.address¶
- Name: - address- Type: - str- Default Value: - '0.0.0.0'- Flags: - READABLE,- WRITABLE- The address the server uses to listen on 
- 
GstRtspServer.RTSPServer.props.backlog¶
- Name: - backlog- Type: - int- Default Value: - 5- Flags: - READABLE,- WRITABLE- The maximum length to which the queue of pending connections may grow 
- 
GstRtspServer.RTSPServer.props.bound_port¶
- Name: - bound-port- Type: - int- Default Value: - -1- Flags: - READABLE- The port number the server is listening on 
- 
GstRtspServer.RTSPServer.props.content_length_limit¶
- Name: - content-length-limit- Type: - int- Default Value: - 4294967295- Flags: - READABLE,- WRITABLE- Limitation of Content-Length 
- 
GstRtspServer.RTSPServer.props.mount_points¶
- Name: - mount-points- Type: - GstRtspServer.RTSPMountPoints- Default Value: - None- Flags: - READABLE,- WRITABLE- The mount points to use for client session 
- 
GstRtspServer.RTSPServer.props.service¶
- Name: - service- Type: - str- Default Value: - '8554'- Flags: - READABLE,- WRITABLE- The service or port number the server uses to listen on 
- 
GstRtspServer.RTSPServer.props.session_pool¶
- Name: - session-pool- Type: - GstRtspServer.RTSPSessionPool- Default Value: - None- Flags: - READABLE,- WRITABLE- The session pool to use for client session