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 /* Do *not* use these defines outside of rtsp-server. Use G_DEPRECATED instead. */
28 #ifdef GST_DISABLE_DEPRECATED
29 #define GST_RTSP_SERVER_DEPRECATED GST_RTSP_SERVER_API
30 #define GST_RTSP_SERVER_DEPRECATED_FOR(f) GST_RTSP_SERVER_API
32 #define GST_RTSP_SERVER_DEPRECATED G_DEPRECATED GST_RTSP_SERVER_API
33 #define GST_RTSP_SERVER_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) GST_RTSP_SERVER_API
36 typedef struct _GstRTSPServer GstRTSPServer;
37 typedef struct _GstRTSPServerClass GstRTSPServerClass;
38 typedef struct _GstRTSPServerPrivate GstRTSPServerPrivate;
40 #include "rtsp-server-prelude.h"
41 #include "rtsp-session-pool.h"
42 #include "rtsp-session.h"
43 #include "rtsp-media.h"
44 #include "rtsp-stream.h"
45 #include "rtsp-stream-transport.h"
46 #include "rtsp-address-pool.h"
47 #include "rtsp-thread-pool.h"
48 #include "rtsp-client.h"
49 #include "rtsp-context.h"
50 #include "rtsp-server.h"
51 #include "rtsp-mount-points.h"
52 #include "rtsp-media-factory.h"
53 #include "rtsp-permissions.h"
54 #include "rtsp-auth.h"
55 #include "rtsp-token.h"
56 #include "rtsp-session-media.h"
58 #include "rtsp-media-factory-uri.h"
59 #include "rtsp-params.h"
61 #define GST_TYPE_RTSP_SERVER (gst_rtsp_server_get_type ())
62 #define GST_IS_RTSP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_SERVER))
63 #define GST_IS_RTSP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_SERVER))
64 #define GST_RTSP_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
65 #define GST_RTSP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServer))
66 #define GST_RTSP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
67 #define GST_RTSP_SERVER_CAST(obj) ((GstRTSPServer*)(obj))
68 #define GST_RTSP_SERVER_CLASS_CAST(klass) ((GstRTSPServerClass*)(klass))
73 * This object listens on a port, creates and manages the clients connected to
76 struct _GstRTSPServer {
80 GstRTSPServerPrivate *priv;
81 gpointer _gst_reserved[GST_PADDING];
86 * @create_client: Create, configure a new GstRTSPClient
87 * object that handles the new connection on @socket. The default
88 * implementation will create a GstRTSPClient and will configure the
89 * mount-points, auth, session-pool and thread-pool on the client.
90 * @client_connected: emitted when a new client connected.
92 * The RTSP server class structure
94 struct _GstRTSPServerClass {
95 GObjectClass parent_class;
97 GstRTSPClient * (*create_client) (GstRTSPServer *server);
100 void (*client_connected) (GstRTSPServer *server, GstRTSPClient *client);
103 gpointer _gst_reserved[GST_PADDING_LARGE];
107 GType gst_rtsp_server_get_type (void);
110 GstRTSPServer * gst_rtsp_server_new (void);
113 void gst_rtsp_server_set_address (GstRTSPServer *server, const gchar *address);
116 gchar * gst_rtsp_server_get_address (GstRTSPServer *server);
119 void gst_rtsp_server_set_service (GstRTSPServer *server, const gchar *service);
122 gchar * gst_rtsp_server_get_service (GstRTSPServer *server);
125 void gst_rtsp_server_set_backlog (GstRTSPServer *server, gint backlog);
128 gint gst_rtsp_server_get_backlog (GstRTSPServer *server);
131 int gst_rtsp_server_get_bound_port (GstRTSPServer *server);
134 void gst_rtsp_server_set_session_pool (GstRTSPServer *server, GstRTSPSessionPool *pool);
137 GstRTSPSessionPool * gst_rtsp_server_get_session_pool (GstRTSPServer *server);
140 void gst_rtsp_server_set_mount_points (GstRTSPServer *server, GstRTSPMountPoints *mounts);
143 GstRTSPMountPoints * gst_rtsp_server_get_mount_points (GstRTSPServer *server);
146 void gst_rtsp_server_set_auth (GstRTSPServer *server, GstRTSPAuth *auth);
149 GstRTSPAuth * gst_rtsp_server_get_auth (GstRTSPServer *server);
152 void gst_rtsp_server_set_thread_pool (GstRTSPServer *server, GstRTSPThreadPool *pool);
155 GstRTSPThreadPool * gst_rtsp_server_get_thread_pool (GstRTSPServer *server);
158 gboolean gst_rtsp_server_transfer_connection (GstRTSPServer * server, GSocket *socket,
159 const gchar * ip, gint port,
160 const gchar *initial_buffer);
163 gboolean gst_rtsp_server_io_func (GSocket *socket, GIOCondition condition,
164 GstRTSPServer *server);
167 GSocket * gst_rtsp_server_create_socket (GstRTSPServer *server,
168 GCancellable *cancellable,
172 GSource * gst_rtsp_server_create_source (GstRTSPServer *server,
173 GCancellable * cancellable,
177 guint gst_rtsp_server_attach (GstRTSPServer *server,
178 GMainContext *context);
181 * GstRTSPServerClientFilterFunc:
182 * @server: a #GstRTSPServer object
183 * @client: a #GstRTSPClient in @server
184 * @user_data: user data that has been given to gst_rtsp_server_client_filter()
186 * This function will be called by the gst_rtsp_server_client_filter(). An
187 * implementation should return a value of #GstRTSPFilterResult.
189 * When this function returns #GST_RTSP_FILTER_REMOVE, @client will be removed
192 * A return value of #GST_RTSP_FILTER_KEEP will leave @client untouched in
195 * A value of #GST_RTSP_FILTER_REF will add @client to the result #GList of
196 * gst_rtsp_server_client_filter().
198 * Returns: a #GstRTSPFilterResult.
200 typedef GstRTSPFilterResult (*GstRTSPServerClientFilterFunc) (GstRTSPServer *server,
201 GstRTSPClient *client,
205 GList * gst_rtsp_server_client_filter (GstRTSPServer *server,
206 GstRTSPServerClientFilterFunc func,
209 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
210 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPServer, gst_object_unref)
215 #endif /* __GST_RTSP_SERVER_H__ */