Top | ![]() |
![]() |
![]() |
![]() |
GstRTSPServer * | gst_rtsp_server_new () |
gchar * | gst_rtsp_server_get_address () |
void | gst_rtsp_server_set_address () |
gchar * | gst_rtsp_server_get_service () |
void | gst_rtsp_server_set_service () |
gint | gst_rtsp_server_get_backlog () |
void | gst_rtsp_server_set_backlog () |
int | gst_rtsp_server_get_bound_port () |
GstRTSPMountPoints * | gst_rtsp_server_get_mount_points () |
void | gst_rtsp_server_set_mount_points () |
GstRTSPSessionPool * | gst_rtsp_server_get_session_pool () |
void | gst_rtsp_server_set_session_pool () |
GstRTSPThreadPool * | gst_rtsp_server_get_thread_pool () |
void | gst_rtsp_server_set_thread_pool () |
GstRTSPAuth * | gst_rtsp_server_get_auth () |
void | gst_rtsp_server_set_auth () |
gboolean | gst_rtsp_server_transfer_connection () |
gboolean | gst_rtsp_server_io_func () |
GSocket * | gst_rtsp_server_create_socket () |
GSource * | gst_rtsp_server_create_source () |
guint | gst_rtsp_server_attach () |
GstRTSPFilterResult | (*GstRTSPServerClientFilterFunc) () |
GList * | gst_rtsp_server_client_filter () |
gchar * | address | Read / Write |
gint | backlog | Read / Write |
gint | bound-port | Read |
GstRTSPMountPoints * | mount-points | Read / Write |
gchar * | service | Read / Write |
GstRTSPSessionPool * | session-pool | Read / Write |
The server object is the object listening for connections on a port and creating GstRTSPClient objects to handle those connections.
The server will listen on the address set with gst_rtsp_server_set_address()
and the port or service configured with gst_rtsp_server_set_service()
.
Use gst_rtsp_server_set_backlog()
to configure the amount of pending requests
that the server will keep. By default the server listens on the current
network (0.0.0.0) and port 8554.
The server will require an SSL connection when a TLS certificate has been
set in the auth object with gst_rtsp_auth_set_tls_certificate()
.
To start the server, use gst_rtsp_server_attach()
to attach it to a
GMainContext. For more control, gst_rtsp_server_create_source()
and
gst_rtsp_server_create_socket()
can be used to get a GSource and GSocket
respectively.
gst_rtsp_server_transfer_connection() can be used to transfer an existing socket to the RTSP server, for example from an HTTP server.
Once the server socket is attached to a mainloop, it will start accepting connections. When a new connection is received, a new GstRTSPClient object is created to handle the connection. The new client will be configured with the server GstRTSPAuth, GstRTSPMountPoints, GstRTSPSessionPool and GstRTSPThreadPool.
The server uses the configured GstRTSPThreadPool object to handle the remainder of the communication with this client.
Last reviewed on 2013-07-11 (1.0.0)
GstRTSPServer *
gst_rtsp_server_new (void
);
Create a new GstRTSPServer instance.
gchar *
gst_rtsp_server_get_address (GstRTSPServer *server
);
Get the address on which the server will accept connections.
void gst_rtsp_server_set_address (GstRTSPServer *server
,const gchar *address
);
Configure server
to accept connections on the given address.
This function must be called before the server is bound.
gchar *
gst_rtsp_server_get_service (GstRTSPServer *server
);
Get the service on which the server will accept connections.
void gst_rtsp_server_set_service (GstRTSPServer *server
,const gchar *service
);
Configure server
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
gst_rtsp_server_get_bound_port()
.
This function must be called before the server is bound.
gint
gst_rtsp_server_get_backlog (GstRTSPServer *server
);
The maximum amount of queued requests for the server.
void gst_rtsp_server_set_backlog (GstRTSPServer *server
,gint backlog
);
configure the maximum amount of requests that may be queued for the server.
This function must be called before the server is bound.
int
gst_rtsp_server_get_bound_port (GstRTSPServer *server
);
Get the port number where the server was bound to.
GstRTSPMountPoints *
gst_rtsp_server_get_mount_points (GstRTSPServer *server
);
Get the GstRTSPMountPoints used as the mount points of server
.
void gst_rtsp_server_set_mount_points (GstRTSPServer *server
,GstRTSPMountPoints *mounts
);
configure mounts
to be used as the mount points of server
.
GstRTSPSessionPool *
gst_rtsp_server_get_session_pool (GstRTSPServer *server
);
Get the GstRTSPSessionPool used as the session pool of server
.
void gst_rtsp_server_set_session_pool (GstRTSPServer *server
,GstRTSPSessionPool *pool
);
configure pool
to be used as the session pool of server
.
GstRTSPThreadPool *
gst_rtsp_server_get_thread_pool (GstRTSPServer *server
);
Get the GstRTSPThreadPool used as the thread pool of server
.
void gst_rtsp_server_set_thread_pool (GstRTSPServer *server
,GstRTSPThreadPool *pool
);
configure pool
to be used as the thread pool of server
.
GstRTSPAuth *
gst_rtsp_server_get_auth (GstRTSPServer *server
);
Get the GstRTSPAuth used as the authentication manager of server
.
void gst_rtsp_server_set_auth (GstRTSPServer *server
,GstRTSPAuth *auth
);
configure auth
to be used as the authentication manager of server
.
gboolean gst_rtsp_server_transfer_connection (GstRTSPServer *server
,GSocket *socket
,const gchar *ip
,gint port
,const gchar *initial_buffer
);
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 data
that the HTTP server read from the socket while parsing the HTTP header.
gboolean gst_rtsp_server_io_func (GSocket *socket
,GIOCondition condition
,GstRTSPServer *server
);
A default GSocketSourceFunc that creates a new GstRTSPClient to accept and handle a
new connection on socket
or server
.
GSocket * gst_rtsp_server_create_socket (GstRTSPServer *server
,GCancellable *cancellable
,GError **error
);
Create a GSocket for server
. The socket will listen on the
configured service.
GSource * gst_rtsp_server_create_source (GstRTSPServer *server
,GCancellable *cancellable
,GError **error
);
Create a GSource for server
. The new source will have a default
GSocketSourceFunc of gst_rtsp_server_io_func()
.
cancellable
if not NULL
can 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 g_cancellable_is_cancelled()
.
This takes a reference on server
until source
is destroyed.
the GSource for server
or NULL
when an error
occurred. Free with g_source_unref()
.
[transfer full]
guint gst_rtsp_server_attach (GstRTSPServer *server
,GMainContext *context
);
Attaches server
to context
. When the mainloop for context
is run, the
server will be dispatched. When context
is NULL
, 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 server
until the source is destroyed. Note that
if context
is not the default main context as returned by
g_main_context_default()
(or NULL
), g_source_remove()
cannot be used to
destroy the source. In that case it is recommended to use
gst_rtsp_server_create_source()
and attach it to context
manually.
GstRTSPFilterResult (*GstRTSPServerClientFilterFunc) (GstRTSPServer *server
,GstRTSPClient *client
,gpointer user_data
);
This function will be called by the gst_rtsp_server_client_filter()
. An
implementation should return a value of GstRTSPFilterResult.
When this function returns GST_RTSP_FILTER_REMOVE, client
will be removed
from server
.
A return value of GST_RTSP_FILTER_KEEP will leave client
untouched in
server
.
A value of GST_RTSP_FILTER_REF will add client
to the result GList of
gst_rtsp_server_client_filter()
.
server |
a GstRTSPServer object |
|
client |
a GstRTSPClient in |
|
user_data |
user data that has been given to |
GList * gst_rtsp_server_client_filter (GstRTSPServer *server
,GstRTSPServerClientFilterFunc func
,gpointer user_data
);
Call func
for each client managed by server
. The result value of func
determines what happens to the client. func
will be called with server
locked so no further actions on server
can be performed from func
.
If func
returns GST_RTSP_FILTER_REMOVE, the client will be removed from
server
.
If func
returns GST_RTSP_FILTER_KEEP, the client will remain in server
.
If func
returns GST_RTSP_FILTER_REF, the client will remain in server
but
will also be added with an additional ref to the result GList of this
function..
When func
is NULL
, GST_RTSP_FILTER_REF will be assumed for each client.
a GList with all
clients for which func
returned GST_RTSP_FILTER_REF. After usage, each
element in the GList should be unreffed before the list is freed.
[element-type GstRTSPClient][transfer full]
struct GstRTSPServer;
This object listens on a port, creates and manages the clients connected to it.
struct GstRTSPServerClass { GObjectClass parent_class; GstRTSPClient * (*create_client) (GstRTSPServer *server); /* signals */ void (*client_connected) (GstRTSPServer *server, GstRTSPClient *client); };
The RTSP server class structure
“address”
property “address” gchar *
The address the server uses to listen on.
Flags: Read / Write
Default value: "0.0.0.0"
“backlog”
property “backlog” gint
The maximum length to which the queue of pending connections may grow.
Flags: Read / Write
Allowed values: >= 0
Default value: 5
“bound-port”
property “bound-port” gint
The port number the server is listening on.
Flags: Read
Allowed values: [-1,65535]
Default value: -1
“mount-points”
property“mount-points” GstRTSPMountPoints *
The mount points to use for client session.
Flags: Read / Write
“service”
property “service” gchar *
The service or port number the server uses to listen on.
Flags: Read / Write
Default value: "8554"
“session-pool”
property“session-pool” GstRTSPSessionPool *
The session pool to use for client session.
Flags: Read / Write
“client-connected”
signalvoid user_function (GstRTSPServer *gstrtspserver, GstRTSPClient *arg1, gpointer user_data)
Flags: Run Last