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., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __GST_RTSP_SERVER_H__
21 #define __GST_RTSP_SERVER_H__
27 typedef struct _GstRTSPServer GstRTSPServer;
28 typedef struct _GstRTSPServerClass GstRTSPServerClass;
30 #include "rtsp-session-pool.h"
31 #include "rtsp-media-mapping.h"
32 #include "rtsp-media-factory-uri.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))
45 #define GST_RTSP_SERVER_GET_LOCK(server) (&(GST_RTSP_SERVER_CAST(server)->lock))
46 #define GST_RTSP_SERVER_LOCK(server) (g_mutex_lock(GST_RTSP_SERVER_GET_LOCK(server)))
47 #define GST_RTSP_SERVER_UNLOCK(server) (g_mutex_unlock(GST_RTSP_SERVER_GET_LOCK(server)))
52 * This object listens on a port, creates and manages the clients connected to
55 struct _GstRTSPServer {
60 /* server information */
65 /* sessions on this server */
66 GstRTSPSessionPool *session_pool;
68 /* media mapper for this server */
69 GstRTSPMediaMapping *media_mapping;
71 /* authentication manager */
74 /* the clients that are connected */
81 * @create_client: Create, configure a new GstRTSPClient
82 * object that handles the new connection on @socket.
83 * @accept_client: accept a new GstRTSPClient
85 * The RTSP server class structure
87 struct _GstRTSPServerClass {
88 GObjectClass parent_class;
90 GstRTSPClient * (*create_client) (GstRTSPServer *server);
91 gboolean (*accept_client) (GstRTSPServer *server, GstRTSPClient *client,
92 GSocket *socket, GError **error);
94 void (*client_connected) (GstRTSPServer *server, GstRTSPClient *client);
97 GType gst_rtsp_server_get_type (void);
99 GstRTSPServer * gst_rtsp_server_new (void);
101 void gst_rtsp_server_set_address (GstRTSPServer *server, const gchar *address);
102 gchar * gst_rtsp_server_get_address (GstRTSPServer *server);
104 void gst_rtsp_server_set_service (GstRTSPServer *server, const gchar *service);
105 gchar * gst_rtsp_server_get_service (GstRTSPServer *server);
107 void gst_rtsp_server_set_backlog (GstRTSPServer *server, gint backlog);
108 gint gst_rtsp_server_get_backlog (GstRTSPServer *server);
110 void gst_rtsp_server_set_session_pool (GstRTSPServer *server, GstRTSPSessionPool *pool);
111 GstRTSPSessionPool * gst_rtsp_server_get_session_pool (GstRTSPServer *server);
113 void gst_rtsp_server_set_media_mapping (GstRTSPServer *server, GstRTSPMediaMapping *mapping);
114 GstRTSPMediaMapping * gst_rtsp_server_get_media_mapping (GstRTSPServer *server);
116 void gst_rtsp_server_set_auth (GstRTSPServer *server, GstRTSPAuth *auth);
117 GstRTSPAuth * gst_rtsp_server_get_auth (GstRTSPServer *server);
119 gboolean gst_rtsp_server_io_func (GSocket *socket, GIOCondition condition,
120 GstRTSPServer *server);
122 GSocket * gst_rtsp_server_create_socket (GstRTSPServer *server,
123 GCancellable *cancellable,
125 GSource * gst_rtsp_server_create_source (GstRTSPServer *server,
126 GCancellable * cancellable,
128 guint gst_rtsp_server_attach (GstRTSPServer *server,
129 GMainContext *context);
133 #endif /* __GST_RTSP_SERVER_H__ */