a04ea030ddc967e0c9247b415dbe84ce83015724
[platform/upstream/gstreamer.git] / libs / gst / net / gstnettimepacket.h
1 /* GStreamer
2  * Copyright (C) 2005 Andy Wingo <wingo@pobox.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., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20
21 #ifndef __GST_NET_TIME_PACKET_H__
22 #define __GST_NET_TIME_PACKET_H__
23
24 #include <gst/gst.h>
25 #include <gio/gio.h>
26 #include <gst/net/net-prelude.h>
27
28 G_BEGIN_DECLS
29
30 /**
31  * GST_NET_TIME_PACKET_SIZE:
32  *
33  * The size of the packets sent between network clocks.
34  */
35 #define GST_NET_TIME_PACKET_SIZE 16
36
37 typedef struct _GstNetTimePacket GstNetTimePacket;
38
39 /**
40  * GstNetTimePacket:
41  * @local_time: the local time when this packet was sent
42  * @remote_time: the remote time observation
43  *
44  * Content of a #GstNetTimePacket.
45  */
46 struct _GstNetTimePacket {
47   GstClockTime local_time;
48   GstClockTime remote_time;
49 };
50
51 GST_NET_API
52 GType                   gst_net_time_packet_get_type    (void);
53
54 GST_NET_API
55 GstNetTimePacket*       gst_net_time_packet_new         (const guint8 *buffer);
56
57 GST_NET_API
58 GstNetTimePacket*       gst_net_time_packet_copy        (const GstNetTimePacket *packet);
59
60 GST_NET_API
61 void                    gst_net_time_packet_free        (GstNetTimePacket *packet);
62
63 GST_NET_API
64 guint8*                 gst_net_time_packet_serialize   (const GstNetTimePacket *packet);
65
66 GST_NET_API
67 GstNetTimePacket*       gst_net_time_packet_receive     (GSocket         * socket,
68                                                          GSocketAddress ** src_address,
69                                                          GError         ** error);
70 GST_NET_API
71 gboolean                gst_net_time_packet_send        (const GstNetTimePacket * packet,
72                                                          GSocket                * socket,
73                                                          GSocketAddress         * dest_address,
74                                                          GError                ** error);
75
76 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
77 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstNetTimePacket, gst_net_time_packet_free)
78 #endif
79
80 G_END_DECLS
81
82
83 #endif /* __GST_NET_TIME_PACKET_H__ */