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., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
22 #ifndef __GST_ADAPTER_H__
23 #define __GST_ADAPTER_H__
25 #include <gst/base/base-prelude.h>
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))
46 * The opaque #GstAdapter data structure.
48 typedef struct _GstAdapter GstAdapter;
49 typedef struct _GstAdapterClass GstAdapterClass;
52 GType gst_adapter_get_type (void);
55 GstAdapter * gst_adapter_new (void) G_GNUC_MALLOC;
58 void gst_adapter_clear (GstAdapter *adapter);
61 void gst_adapter_push (GstAdapter *adapter, GstBuffer* buf);
64 gconstpointer gst_adapter_map (GstAdapter *adapter, gsize size);
67 void gst_adapter_unmap (GstAdapter *adapter);
70 void gst_adapter_copy (GstAdapter *adapter, gpointer dest,
71 gsize offset, gsize size);
73 GBytes * gst_adapter_copy_bytes (GstAdapter *adapter,
74 gsize offset, gsize size);
76 void gst_adapter_flush (GstAdapter *adapter, gsize flush);
79 gpointer gst_adapter_take (GstAdapter *adapter, gsize nbytes);
82 GstBuffer* gst_adapter_take_buffer (GstAdapter *adapter, gsize nbytes);
85 GList* gst_adapter_take_list (GstAdapter *adapter, gsize nbytes);
88 GstBuffer * gst_adapter_take_buffer_fast (GstAdapter *adapter, gsize nbytes);
91 GstBufferList * gst_adapter_take_buffer_list (GstAdapter *adapter, gsize nbytes);
94 GstBuffer* gst_adapter_get_buffer (GstAdapter *adapter, gsize nbytes);
97 GList* gst_adapter_get_list (GstAdapter *adapter, gsize nbytes);
100 GstBuffer * gst_adapter_get_buffer_fast (GstAdapter *adapter, gsize nbytes);
103 GstBufferList * gst_adapter_get_buffer_list (GstAdapter *adapter, gsize nbytes);
106 gsize gst_adapter_available (GstAdapter *adapter);
109 gsize gst_adapter_available_fast (GstAdapter *adapter);
112 GstClockTime gst_adapter_prev_pts (GstAdapter *adapter, guint64 *distance);
115 GstClockTime gst_adapter_prev_dts (GstAdapter *adapter, guint64 *distance);
118 GstClockTime gst_adapter_prev_pts_at_offset (GstAdapter * adapter, gsize offset, guint64 * distance);
121 GstClockTime gst_adapter_prev_dts_at_offset (GstAdapter * adapter, gsize offset, guint64 * distance);
124 guint64 gst_adapter_prev_offset (GstAdapter *adapter, guint64 *distance);
127 GstClockTime gst_adapter_pts_at_discont (GstAdapter *adapter);
130 GstClockTime gst_adapter_dts_at_discont (GstAdapter *adapter);
133 guint64 gst_adapter_offset_at_discont (GstAdapter *adapter);
136 guint64 gst_adapter_distance_from_discont (GstAdapter *adapter);
139 gssize gst_adapter_masked_scan_uint32 (GstAdapter * adapter, guint32 mask,
140 guint32 pattern, gsize offset, gsize size);
142 gssize gst_adapter_masked_scan_uint32_peek (GstAdapter * adapter, guint32 mask,
143 guint32 pattern, gsize offset, gsize size, guint32 * value);
145 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
146 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAdapter, gst_object_unref)
151 #endif /* __GST_ADAPTER_H__ */