aggregator: Assert if the sink/src pad type that is to be used is not a GstAggregator...
[platform/upstream/gstreamer.git] / libs / gst / base / gstadapter.h
1 /* GStreamer
2  * Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
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 #include <gst/gst.h>
21
22 #ifndef __GST_ADAPTER_H__
23 #define __GST_ADAPTER_H__
24
25 #include <gst/base/base-prelude.h>
26
27 G_BEGIN_DECLS
28
29
30 #define GST_TYPE_ADAPTER \
31   (gst_adapter_get_type())
32 #define GST_ADAPTER(obj) \
33   (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ADAPTER, GstAdapter))
34 #define GST_ADAPTER_CLASS(klass) \
35   (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ADAPTER, GstAdapterClass))
36 #define GST_ADAPTER_GET_CLASS(obj) \
37   (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_ADAPTER, GstAdapterClass))
38 #define GST_IS_ADAPTER(obj) \
39   (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ADAPTER))
40 #define GST_IS_ADAPTER_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ADAPTER))
42
43 /**
44  * GstAdapter:
45  *
46  * The opaque #GstAdapter data structure.
47  */
48 typedef struct _GstAdapter GstAdapter;
49 typedef struct _GstAdapterClass GstAdapterClass;
50
51 GST_BASE_API
52 GType                   gst_adapter_get_type            (void);
53
54 GST_BASE_API
55 GstAdapter *            gst_adapter_new                 (void) G_GNUC_MALLOC;
56
57 GST_BASE_API
58 void                    gst_adapter_clear               (GstAdapter *adapter);
59
60 GST_BASE_API
61 void                    gst_adapter_push                (GstAdapter *adapter, GstBuffer* buf);
62
63 GST_BASE_API
64 gconstpointer           gst_adapter_map                 (GstAdapter *adapter, gsize size);
65
66 GST_BASE_API
67 void                    gst_adapter_unmap               (GstAdapter *adapter);
68
69 GST_BASE_API
70 void                    gst_adapter_copy                (GstAdapter *adapter, gpointer dest,
71                                                          gsize offset, gsize size);
72 GST_BASE_API
73 GBytes *                gst_adapter_copy_bytes          (GstAdapter *adapter,
74                                                          gsize offset, gsize size);
75 GST_BASE_API
76 void                    gst_adapter_flush               (GstAdapter *adapter, gsize flush);
77
78 GST_BASE_API
79 gpointer                gst_adapter_take                (GstAdapter *adapter, gsize nbytes);
80
81 GST_BASE_API
82 GstBuffer*              gst_adapter_take_buffer         (GstAdapter *adapter, gsize nbytes);
83
84 GST_BASE_API
85 GList*                  gst_adapter_take_list           (GstAdapter *adapter, gsize nbytes);
86
87 GST_BASE_API
88 GstBuffer *             gst_adapter_take_buffer_fast    (GstAdapter *adapter, gsize nbytes);
89
90 GST_BASE_API
91 GstBufferList *         gst_adapter_take_buffer_list    (GstAdapter *adapter, gsize nbytes);
92
93 GST_BASE_API
94 GstBuffer*              gst_adapter_get_buffer          (GstAdapter *adapter, gsize nbytes);
95
96 GST_BASE_API
97 GList*                  gst_adapter_get_list            (GstAdapter *adapter, gsize nbytes);
98
99 GST_BASE_API
100 GstBuffer *             gst_adapter_get_buffer_fast     (GstAdapter *adapter, gsize nbytes);
101
102 GST_BASE_API
103 GstBufferList *         gst_adapter_get_buffer_list     (GstAdapter *adapter, gsize nbytes);
104
105 GST_BASE_API
106 gsize                   gst_adapter_available           (GstAdapter *adapter);
107
108 GST_BASE_API
109 gsize                   gst_adapter_available_fast      (GstAdapter *adapter);
110
111 GST_BASE_API
112 GstClockTime            gst_adapter_prev_pts            (GstAdapter *adapter, guint64 *distance);
113
114 GST_BASE_API
115 GstClockTime            gst_adapter_prev_dts            (GstAdapter *adapter, guint64 *distance);
116
117 GST_BASE_API
118 GstClockTime            gst_adapter_prev_pts_at_offset  (GstAdapter * adapter, gsize offset, guint64 * distance);
119
120 GST_BASE_API
121 GstClockTime            gst_adapter_prev_dts_at_offset  (GstAdapter * adapter, gsize offset, guint64 * distance);
122
123 GST_BASE_API
124 guint64                 gst_adapter_prev_offset         (GstAdapter *adapter, guint64 *distance);
125
126 GST_BASE_API
127 GstClockTime            gst_adapter_pts_at_discont      (GstAdapter *adapter);
128
129 GST_BASE_API
130 GstClockTime            gst_adapter_dts_at_discont      (GstAdapter *adapter);
131
132 GST_BASE_API
133 guint64                 gst_adapter_offset_at_discont   (GstAdapter *adapter);
134
135 GST_BASE_API
136 guint64                 gst_adapter_distance_from_discont (GstAdapter *adapter);
137
138 GST_BASE_API
139 gssize                  gst_adapter_masked_scan_uint32  (GstAdapter * adapter, guint32 mask,
140                                                          guint32 pattern, gsize offset, gsize size);
141 GST_BASE_API
142 gssize                  gst_adapter_masked_scan_uint32_peek  (GstAdapter * adapter, guint32 mask,
143                                                          guint32 pattern, gsize offset, gsize size, guint32 * value);
144
145 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
146 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAdapter, gst_object_unref)
147 #endif
148
149 G_END_DECLS
150
151 #endif /* __GST_ADAPTER_H__ */