Git init
[framework/multimedia/gstreamer0.10.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 #include <ws2tcpip.h>
39 #ifndef socklen_t
40 #define socklen_t int
41 #endif
42 #else
43 #include <netdb.h>
44 #include <sys/socket.h>
45 #include <netinet/in.h>
46 #include <arpa/inet.h>
47 #endif
48
49 #include <fcntl.h>
50
51 #define GST_TYPE_NET_TIME_PROVIDER \
52   (gst_net_time_provider_get_type())
53 #define GST_NET_TIME_PROVIDER(obj) \
54   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NET_TIME_PROVIDER,GstNetTimeProvider))
55 #define GST_NET_TIME_PROVIDER_CLASS(klass) \
56   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NET_TIME_PROVIDER,GstNetTimeProviderClass))
57 #define GST_IS_NET_TIME_PROVIDER(obj) \
58   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NET_TIME_PROVIDER))
59 #define GST_IS_NET_TIME_PROVIDER_CLASS(klass) \
60   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NET_TIME_PROVIDER))
61
62 typedef struct _GstNetTimeProvider GstNetTimeProvider;
63 typedef struct _GstNetTimeProviderClass GstNetTimeProviderClass;
64 typedef struct _GstNetTimeProviderPrivate GstNetTimeProviderPrivate;
65
66
67 /**
68  * GstNetTimeProvider:
69  *
70  * Opaque #GstNetTimeProvider structure.
71  */
72 struct _GstNetTimeProvider {
73   GstObject parent;
74
75   /*< private >*/
76   gchar *address;
77   int port;
78
79   int sock;
80   int control_sock[2];
81
82   GThread *thread;
83
84   GstClock *clock;
85
86   union {
87     gpointer _gst_reserved1;
88     /* has to be a gint, we use atomic ops here */
89     gint active;
90   } active;
91
92   /*< private >*/
93   GstNetTimeProviderPrivate *priv;
94
95   gpointer _gst_reserved[GST_PADDING - 2];
96 };
97
98 struct _GstNetTimeProviderClass {
99   GstObjectClass parent_class;
100 };
101
102 GType                   gst_net_time_provider_get_type  (void);
103 GstNetTimeProvider*     gst_net_time_provider_new       (GstClock *clock,
104                                                          const gchar *address,
105                                                          gint port);
106
107 G_END_DECLS
108
109
110 #endif /* __GST_NET_TIME_PROVIDER_H__ */