gst/base/gstbasesink.*: No need to store the clock, the parent element class already...
[platform/upstream/gstreamer.git] / libs / gst / net / gstnetclientclock.h
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  */
24
25
26 #ifndef __GST_NET_CLIENT_CLOCK_H__
27 #define __GST_NET_CLIENT_CLOCK_H__
28
29 #include <gst/gst.h>
30 #include <gst/gstsystemclock.h>
31
32 G_BEGIN_DECLS
33
34 #include <errno.h>
35 #include <string.h>
36 #include <sys/types.h>
37 #include <netdb.h>
38 #include <sys/socket.h>
39 #include <netinet/in.h>
40 #include <arpa/inet.h>
41
42 #include <fcntl.h>
43
44 #define GST_TYPE_NET_CLIENT_CLOCK \
45   (gst_net_client_clock_get_type())
46 #define GST_NET_CLIENT_CLOCK(obj) \
47   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NET_CLIENT_CLOCK,GstNetClientClock))
48 #define GST_NET_CLIENT_CLOCK_CLASS(klass) \
49   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NET_CLIENT_CLOCK,GstNetClientClockClass))
50 #define GST_IS_NET_CLIENT_CLOCK(obj) \
51   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NET_CLIENT_CLOCK))
52 #define GST_IS_NET_CLIENT_CLOCK_CLASS(obj) \
53   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NET_CLIENT_CLOCK))
54
55 typedef struct _GstNetClientClock GstNetClientClock;
56 typedef struct _GstNetClientClockClass GstNetClientClockClass;
57
58 struct _GstNetClientClock {
59   GstSystemClock clock;
60
61   /*< protected >*/
62   gchar *address;
63   gint port;
64   
65   gint window_size;
66   GstClockTime timeout;
67
68   /*< private >*/
69   int sock;
70   int control_sock[2];
71
72   GstClockTime current_timeout;
73
74   struct sockaddr_id *servaddr;
75
76   GThread *thread;
77
78   /*< private >*/
79   gpointer _gst_reserved[GST_PADDING];
80 };
81
82 struct _GstNetClientClockClass {
83   GstSystemClockClass parent_class;
84
85   /*< private >*/
86   gpointer _gst_reserved[GST_PADDING];
87 };
88
89 GType           gst_net_client_clock_get_type   (void);
90 GstClock*       gst_net_client_clock_new        (gchar *name, const gchar *remote_address,
91                                                  gint remote_port, GstClockTime base_time);
92
93 G_END_DECLS
94
95 #endif /* __GST_NET_CLIENT_CLOCK_H__ */