2 * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef __GST_RTSP_SERVER_H__
21 #define __GST_RTSP_SERVER_H__
27 typedef struct _GstRTSPServer GstRTSPServer;
28 typedef struct _GstRTSPServerClass GstRTSPServerClass;
29 typedef struct _GstRTSPServerPrivate GstRTSPServerPrivate;
31 #include "rtsp-session-pool.h"
32 #include "rtsp-mount-points.h"
33 #include "rtsp-client.h"
34 #include "rtsp-auth.h"
36 #define GST_TYPE_RTSP_SERVER (gst_rtsp_server_get_type ())
37 #define GST_IS_RTSP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_SERVER))
38 #define GST_IS_RTSP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_SERVER))
39 #define GST_RTSP_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
40 #define GST_RTSP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServer))
41 #define GST_RTSP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
42 #define GST_RTSP_SERVER_CAST(obj) ((GstRTSPServer*)(obj))
43 #define GST_RTSP_SERVER_CLASS_CAST(klass) ((GstRTSPServerClass*)(klass))
48 * This object listens on a port, creates and manages the clients connected to
51 struct _GstRTSPServer {
54 GstRTSPServerPrivate *priv;
60 * @create_client: Create, configure a new GstRTSPClient
61 * object that handles the new connection on @socket.
62 * @setup_connection: Setup the new client connection. The default
63 * implementation will configure the TLS certificate.
64 * @client_connected: emited when a new client connected.
66 * The RTSP server class structure
68 struct _GstRTSPServerClass {
69 GObjectClass parent_class;
73 GstRTSPClient * (*create_client) (GstRTSPServer *server);
74 gboolean (*setup_connection) (GstRTSPServer *server, GstRTSPClient *client,
75 GstRTSPConnection *conn);
77 void (*client_connected) (GstRTSPServer *server, GstRTSPClient *client);
80 GType gst_rtsp_server_get_type (void);
82 GstRTSPServer * gst_rtsp_server_new (void);
84 void gst_rtsp_server_set_address (GstRTSPServer *server, const gchar *address);
85 gchar * gst_rtsp_server_get_address (GstRTSPServer *server);
87 void gst_rtsp_server_set_service (GstRTSPServer *server, const gchar *service);
88 gchar * gst_rtsp_server_get_service (GstRTSPServer *server);
90 int gst_rtsp_server_get_bound_port (GstRTSPServer *server);
92 void gst_rtsp_server_set_backlog (GstRTSPServer *server, gint backlog);
93 gint gst_rtsp_server_get_backlog (GstRTSPServer *server);
95 void gst_rtsp_server_set_session_pool (GstRTSPServer *server, GstRTSPSessionPool *pool);
96 GstRTSPSessionPool * gst_rtsp_server_get_session_pool (GstRTSPServer *server);
98 void gst_rtsp_server_set_mount_points (GstRTSPServer *server, GstRTSPMountPoints *mounts);
99 GstRTSPMountPoints * gst_rtsp_server_get_mount_points (GstRTSPServer *server);
101 void gst_rtsp_server_set_auth (GstRTSPServer *server, GstRTSPAuth *auth);
102 GstRTSPAuth * gst_rtsp_server_get_auth (GstRTSPServer *server);
104 void gst_rtsp_server_set_thread_pool (GstRTSPServer *server, GstRTSPThreadPool *pool);
105 GstRTSPThreadPool * gst_rtsp_server_get_thread_pool (GstRTSPServer *server);
107 void gst_rtsp_server_set_use_client_settings (GstRTSPServer *server,
108 gboolean use_client_settings);
109 gboolean gst_rtsp_server_get_use_client_settings (GstRTSPServer *server);
111 void gst_rtsp_server_set_tls_certificate (GstRTSPServer *server, GTlsCertificate *cert);
112 GTlsCertificate * gst_rtsp_server_get_tls_certificate (GstRTSPServer *server);
114 gboolean gst_rtsp_server_transfer_connection (GstRTSPServer * server, GSocket *socket,
115 const gchar * ip, gint port,
116 const gchar *initial_buffer);
118 gboolean gst_rtsp_server_io_func (GSocket *socket, GIOCondition condition,
119 GstRTSPServer *server);
121 GSocket * gst_rtsp_server_create_socket (GstRTSPServer *server,
122 GCancellable *cancellable,
124 GSource * gst_rtsp_server_create_source (GstRTSPServer *server,
125 GCancellable * cancellable,
127 guint gst_rtsp_server_attach (GstRTSPServer *server,
128 GMainContext *context);
132 #endif /* __GST_RTSP_SERVER_H__ */