2 * Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
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.
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.
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.
22 #ifndef __GST_ADAPTER_H__
23 #define __GST_ADAPTER_H__
28 #define GST_TYPE_ADAPTER \
29 (gst_adapter_get_type())
30 #define GST_ADAPTER(obj) \
31 (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ADAPTER, GstAdapter))
32 #define GST_ADAPTER_CLASS(klass) \
33 (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ADAPTER, GstAdapterClass))
34 #define GST_ADAPTER_GET_CLASS(obj) \
35 (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_ADAPTER, GstAdapterClass))
36 #define GST_IS_ADAPTER(obj) \
37 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ADAPTER))
38 #define GST_IS_ADAPTER_CLASS(klass) \
39 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ADAPTER))
41 typedef struct _GstAdapter GstAdapter;
42 typedef struct _GstAdapterClass GstAdapterClass;
43 typedef struct _GstAdapterPrivate GstAdapterPrivate;
48 * The opaque #GstAdapter data structure.
58 /* we keep state of assembled pieces */
59 guint8 * assembled_data;
64 /* Remember where the end of our buffer list is to
65 * speed up the push */
68 GstAdapterPrivate *priv;
70 gpointer _gst_reserved[GST_PADDING - 2];
73 struct _GstAdapterClass {
74 GObjectClass parent_class;
77 gpointer _gst_reserved[GST_PADDING];
80 GType gst_adapter_get_type (void);
82 GstAdapter * gst_adapter_new (void) G_GNUC_MALLOC;
84 void gst_adapter_clear (GstAdapter *adapter);
85 void gst_adapter_push (GstAdapter *adapter, GstBuffer* buf);
86 const guint8 * gst_adapter_peek (GstAdapter *adapter, guint size);
87 void gst_adapter_copy (GstAdapter *adapter, guint8 *dest,
88 guint offset, guint size);
89 void gst_adapter_flush (GstAdapter *adapter, guint flush);
90 guint8* gst_adapter_take (GstAdapter *adapter, guint nbytes);
91 GstBuffer* gst_adapter_take_buffer (GstAdapter *adapter, guint nbytes);
92 GList* gst_adapter_take_list (GstAdapter *adapter, guint nbytes);
93 guint gst_adapter_available (GstAdapter *adapter);
94 guint gst_adapter_available_fast (GstAdapter *adapter);
96 GstClockTime gst_adapter_prev_timestamp (GstAdapter *adapter, guint64 *distance);
98 guint gst_adapter_masked_scan_uint32 (GstAdapter * adapter, guint32 mask,
99 guint32 pattern, guint offset, guint size);
101 guint gst_adapter_masked_scan_uint32_peek (GstAdapter * adapter, guint32 mask,
102 guint32 pattern, guint offset, guint size, guint32 * value);
106 #endif /* __GST_ADAPTER_H__ */