36ceef83b736d92001c756371b6cf3c68797dfca
[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
27 G_BEGIN_DECLS
28
29 /**
30  * GST_NET_TIME_PACKET_SIZE:
31  *
32  * The size of the packets sent between network clocks.
33  */
34 #define GST_NET_TIME_PACKET_SIZE 16
35
36 typedef struct _GstNetTimePacket GstNetTimePacket;
37
38 /**
39  * GstNetTimePacket:
40  * @local_time: the local time when this packet was sent
41  * @remote_time: the remote time observation
42  *
43  * Content of a #GstNetTimePacket.
44  */
45 struct _GstNetTimePacket {
46   GstClockTime local_time;
47   GstClockTime remote_time;
48 };
49
50 GST_EXPORT
51 GType                   gst_net_time_packet_get_type    (void);
52
53 GST_EXPORT
54 GstNetTimePacket*       gst_net_time_packet_new         (const guint8 *buffer);
55
56 GST_EXPORT
57 GstNetTimePacket*       gst_net_time_packet_copy        (const GstNetTimePacket *packet);
58
59 GST_EXPORT
60 void                    gst_net_time_packet_free        (GstNetTimePacket *packet);
61
62 GST_EXPORT
63 guint8*                 gst_net_time_packet_serialize   (const GstNetTimePacket *packet);
64
65 GST_EXPORT
66 GstNetTimePacket*       gst_net_time_packet_receive     (GSocket         * socket,
67                                                          GSocketAddress ** src_address,
68                                                          GError         ** error);
69 GST_EXPORT
70 gboolean                gst_net_time_packet_send        (const GstNetTimePacket * packet,
71                                                          GSocket                * socket,
72                                                          GSocketAddress         * dest_address,
73                                                          GError                ** error);
74
75 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
76 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstNetTimePacket, gst_net_time_packet_free)
77 #endif
78
79 G_END_DECLS
80
81
82 #endif /* __GST_NET_TIME_PACKET_H__ */