libs/gst/net/: Massive code removal and cleanups because of GstPoll.
[platform/upstream/gstreamer.git] / libs / gst / net / gstnettimeprovider.h
1 /* GStreamer
2  * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
3  *               2006 Joni Valtanen <joni.valtanen@movial.fi>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21
22 #ifndef __GST_NET_TIME_PROVIDER_H__
23 #define __GST_NET_TIME_PROVIDER_H__
24
25 /* to determinate os */
26 #include <glib.h>
27
28 #include <gst/gst.h>
29
30 G_BEGIN_DECLS
31
32 #include <errno.h>
33 #include <string.h>
34 #include <sys/types.h>
35
36 #ifdef G_OS_WIN32
37 #include <winsock2.h>
38 #else
39 #include <netdb.h>
40 #include <sys/socket.h>
41 #include <netinet/in.h>
42 #include <arpa/inet.h>
43 #endif
44
45 #include <fcntl.h>
46
47 #define GST_TYPE_NET_TIME_PROVIDER \
48   (gst_net_time_provider_get_type())
49 #define GST_NET_TIME_PROVIDER(obj) \
50   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NET_TIME_PROVIDER,GstNetTimeProvider))
51 #define GST_NET_TIME_PROVIDER_CLASS(klass) \
52   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NET_TIME_PROVIDER,GstNetTimeProviderClass))
53 #define GST_IS_NET_TIME_PROVIDER(obj) \
54   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NET_TIME_PROVIDER))
55 #define GST_IS_NET_TIME_PROVIDER_CLASS(klass) \
56   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NET_TIME_PROVIDER))
57
58 typedef struct _GstNetTimeProvider GstNetTimeProvider;
59 typedef struct _GstNetTimeProviderClass GstNetTimeProviderClass;
60
61 /**
62  * GstNetTimeProvider:
63  * @parent: the parent object structure.
64  *
65  * Opaque #GstNetTimeProvider structure.
66  */
67 struct _GstNetTimeProvider {
68   GstObject parent;
69
70   /*< private >*/
71   gchar *address;
72   int port;
73
74   /* the size of _gst_reserved2 and sock must equal three ints since this used
75    * to be int sock and int control_sock[2]. This relies on the fact that
76    * GstPollFD happens to be two ints */
77   int _gst_reserved2;
78   GstPollFD sock;
79   GstPoll *fdset;
80
81   GThread *thread;
82
83   GstClock *clock;
84
85   union {
86     gpointer _gst_reserved1;
87     /* has to be a gint, we use atomic ops here */
88     gint active;
89   } active;
90
91   /*< private >*/
92   gpointer _gst_reserved[GST_PADDING - 2];
93 };
94
95 struct _GstNetTimeProviderClass {
96   GstObjectClass parent_class;
97 };
98
99 GType                   gst_net_time_provider_get_type  (void);
100 GstNetTimeProvider*     gst_net_time_provider_new       (GstClock *clock,
101                                                          const gchar *address,
102                                                          gint port);
103
104 G_END_DECLS
105
106
107 #endif /* __GST_NET_TIME_PROVIDER_H__ */