1 /* GStreamer
2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2005 Wim Taymans <wim@fluendo.com>
4 * 2005 Andy Wingo <wingo@pobox.com>
5 *
6 * gstnetclientclock.h: clock that synchronizes itself to a time provider over
7 * the network
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
18 *
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
23 */
26 #ifndef __GST_NET_CLIENT_CLOCK_H__
27 #define __GST_NET_CLIENT_CLOCK_H__
29 #include <gst/gst.h>
30 #include <gst/gstsystemclock.h>
32 G_BEGIN_DECLS
34 #include <errno.h>
35 #include <string.h>
36 #include <sys/types.h>
38 #ifdef G_OS_WIN32
39 # include <winsock2.h>
40 #else
41 # include <netdb.h>
42 # include <sys/socket.h>
43 # include <netinet/in.h>
44 # include <arpa/inet.h>
45 #endif /*G_OS_WIN32 */
47 #include <fcntl.h>
49 #define GST_TYPE_NET_CLIENT_CLOCK \
50 (gst_net_client_clock_get_type())
51 #define GST_NET_CLIENT_CLOCK(obj) \
52 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NET_CLIENT_CLOCK,GstNetClientClock))
53 #define GST_NET_CLIENT_CLOCK_CLASS(klass) \
54 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NET_CLIENT_CLOCK,GstNetClientClockClass))
55 #define GST_IS_NET_CLIENT_CLOCK(obj) \
56 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NET_CLIENT_CLOCK))
57 #define GST_IS_NET_CLIENT_CLOCK_CLASS(klass) \
58 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NET_CLIENT_CLOCK))
60 typedef struct _GstNetClientClock GstNetClientClock;
61 typedef struct _GstNetClientClockClass GstNetClientClockClass;
62 typedef struct _GstNetClientClockPrivate GstNetClientClockPrivate;
64 /**
65 * GstNetClientClock:
66 * @clock: the parent clock structure.
67 *
68 * Opaque #GstNetClientClock structure.
69 */
70 struct _GstNetClientClock {
71 GstSystemClock clock;
73 /*< protected >*/
74 gchar *address;
75 gint port;
77 /*< private >*/
78 int sock;
79 int control_sock[2];
81 GstClockTime current_timeout;
83 struct sockaddr_id *servaddr;
85 GThread *thread;
87 /*< private >*/
88 GstNetClientClockPrivate *priv;
90 gpointer _gst_reserved[GST_PADDING - 1];
91 };
93 struct _GstNetClientClockClass {
94 GstSystemClockClass parent_class;
96 /*< private >*/
97 gpointer _gst_reserved[GST_PADDING];
98 };
100 GType gst_net_client_clock_get_type (void);
101 GstClock* gst_net_client_clock_new (gchar *name, const gchar *remote_address,
102 gint remote_port, GstClockTime base_time);
104 G_END_DECLS
106 #endif /* __GST_NET_CLIENT_CLOCK_H__ */