Initial import
[platform/upstream/gst-rtsp-server.git] / src / rtsp-server.h
1 /* GStreamer
2  * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <unistd.h>
23 #include <errno.h>
24 #include <string.h>
25 #include <sys/time.h>
26 #include <sys/types.h>
27 #include <netinet/in.h>
28 #include <netdb.h>
29 #include <sys/socket.h>
30 #include <sys/wait.h>
31 #include <fcntl.h>
32 #include <arpa/inet.h>
33
34 #include <gst/gst.h>
35
36 #include "rtsp-session-pool.h"
37
38 #ifndef __GST_RTSP_SERVER_H__
39 #define __GST_RTSP_SERVER_H__
40
41 G_BEGIN_DECLS
42
43 #define GST_TYPE_RTSP_SERVER              (gst_rtsp_server_get_type ())
44 #define GST_IS_RTSP_SERVER(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_SERVER))
45 #define GST_IS_RTSP_SERVER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_SERVER))
46 #define GST_RTSP_SERVER_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
47 #define GST_RTSP_SERVER(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServer))
48 #define GST_RTSP_SERVER_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
49 #define GST_RTSP_SERVER_CAST(obj)         ((GstRTSPServer*)(obj))
50 #define GST_RTSP_SERVER_CLASS_CAST(klass) ((GstRTSPServerClass*)(klass))
51
52 typedef struct _GstRTSPServer GstRTSPServer;
53 typedef struct _GstRTSPServerClass GstRTSPServerClass;
54
55 struct _GstRTSPServer {
56   GObject       parent;
57
58   /* server information */
59   int server_port;
60   gchar *host;
61   struct sockaddr_in server_sin;
62
63   /* socket */
64   GstPollFD server_sock;
65
66   GIOChannel *io_channel;
67   GSource *io_watch;
68
69   /* sessions on this server */
70   GstRTSPSessionPool *pool;
71 };
72
73 struct _GstRTSPServerClass {
74   GObjectClass  parent_class;
75 };
76
77 GType             gst_rtsp_server_get_type             (void);
78
79 GstRTSPServer *   gst_rtsp_server_new                  (void);
80
81 guint             gst_rtsp_server_attach               (GstRTSPServer *server, 
82                                                         GMainContext *context);
83
84 G_END_DECLS
85
86 #endif /* __GST_RTSP_SERVER_H__ */