Macro qtTrIdx() replaced by tr() and QT_TRANSLATE_NOOP()
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / gst-libs / gst / netbuffer / gstnetbuffer.h
1 /* GStreamer
2  * Copyright (C) <2005> Wim Taymans <wim@fluendo.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., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __GST_NETBUFFER_H__
21 #define __GST_NETBUFFER_H__
22
23 #include <gst/gst.h>
24
25 G_BEGIN_DECLS
26
27 typedef struct _GstNetBuffer GstNetBuffer;
28 typedef struct _GstNetBufferClass GstNetBufferClass;
29 typedef struct _GstNetAddress GstNetAddress;
30
31 #define GST_TYPE_NETBUFFER            (gst_netbuffer_get_type())
32 #define GST_IS_NETBUFFER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NETBUFFER))
33 #define GST_IS_NETBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_NETBUFFER))
34 #define GST_NETBUFFER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_NETBUFFER, GstNetBufferClass))
35 #define GST_NETBUFFER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NETBUFFER, GstNetBuffer))
36 #define GST_NETBUFFER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_NETBUFFER, GstNetBufferClass))
37
38 /**
39  * GstNetType:
40  * @GST_NET_TYPE_UNKNOWN: unknown address type
41  * @GST_NET_TYPE_IP4: an IPv4 address type
42  * @GST_NET_TYPE_IP6: and IPv6 address type
43  *
44  * The Address type used in #GstNetAddress.
45  */
46 typedef enum {
47   GST_NET_TYPE_UNKNOWN,
48   GST_NET_TYPE_IP4,
49   GST_NET_TYPE_IP6,
50 } GstNetType;
51
52 /**
53  * GST_NETADDRESS_MAX_LEN:
54  *
55  * The maximum length of a string representation of a GstNetAddress as produced
56  * by gst_netaddress_to_string().
57  *
58  * Since: 0.10.24
59  */
60 #define GST_NETADDRESS_MAX_LEN  64
61
62 /**
63  * GstNetAddress:
64  *
65  * An opaque network address as used in #GstNetBuffer.
66  */
67 struct _GstNetAddress {
68   /*< private >*/
69   GstNetType    type;
70   union {
71     guint8        ip6[16];
72     guint32       ip4;
73   } address;
74   guint16       port;
75   /*< private >*/
76   gpointer _gst_reserved[GST_PADDING];
77 };
78
79 /**
80  * GstNetBuffer:
81  * @buffer: the parent #GstBuffer
82  * @from: the address where this buffer came from.
83  * @to: the address where this buffer should go to.
84  *
85  * buffer for use in network sources and sinks.
86  * It contains the source or destination address of the buffer.
87  */
88 struct _GstNetBuffer {
89   GstBuffer buffer;
90
91   GstNetAddress from;
92   GstNetAddress to;
93
94   /*< private >*/
95   gpointer _gst_reserved[GST_PADDING];
96 };
97
98 struct _GstNetBufferClass {
99   GstBufferClass  buffer_class;
100
101   /*< private >*/
102   gpointer _gst_reserved[GST_PADDING];
103 };
104
105 /* creating buffers */
106 GType           gst_netbuffer_get_type           (void);
107
108 GstNetBuffer*   gst_netbuffer_new                (void);
109
110 /* address operations */
111 void            gst_netaddress_set_ip4_address   (GstNetAddress *naddr, guint32 address, guint16 port);
112 void            gst_netaddress_set_ip6_address   (GstNetAddress *naddr, guint8 address[16], guint16 port);
113 gint            gst_netaddress_set_address_bytes (GstNetAddress *naddr, GstNetType type,
114                                                   guint8 address[16], guint16 port);
115
116 GstNetType      gst_netaddress_get_net_type      (const GstNetAddress *naddr);
117 gboolean        gst_netaddress_get_ip4_address   (const GstNetAddress *naddr, guint32 *address, guint16 *port);
118 gboolean        gst_netaddress_get_ip6_address   (const GstNetAddress *naddr, guint8 address[16], guint16 *port);
119 gint            gst_netaddress_get_address_bytes (const GstNetAddress *naddr, guint8 address[16], guint16 *port);
120
121 gboolean        gst_netaddress_equal             (const GstNetAddress *naddr1,
122                                                   const GstNetAddress *naddr2);
123
124 gint            gst_netaddress_to_string         (const GstNetAddress *naddr, gchar *dest, gulong len);
125
126 G_END_DECLS
127
128 #endif /* __GST_NETBUFFER_H__ */
129