Merge remote-tracking branch 'origin/master' into 0.11
[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., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include <gst/gst.h>
21
22 #ifndef __GST_ADAPTER_H__
23 #define __GST_ADAPTER_H__
24
25 G_BEGIN_DECLS
26
27
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))
40
41 typedef struct _GstAdapter GstAdapter;
42 typedef struct _GstAdapterClass GstAdapterClass;
43 typedef struct _GstAdapterPrivate GstAdapterPrivate;
44
45 /**
46  * GstAdapter:
47  *
48  * The opaque #GstAdapter data structure.
49  */
50 struct _GstAdapter {
51   GObject       object;
52
53   /*< private >*/
54   GSList *      buflist;
55   GSList *      buflist_end;
56   gsize         size;
57   gsize         skip;
58
59   /* we keep state of assembled pieces */
60   gpointer      assembled_data;
61   gsize         assembled_size;
62   gsize         assembled_len;
63
64   GstAdapterPrivate *priv;
65
66   gpointer _gst_reserved[GST_PADDING];
67 };
68
69 struct _GstAdapterClass {
70   GObjectClass  parent_class;
71
72   /*< private >*/
73   gpointer _gst_reserved[GST_PADDING];
74 };
75
76 GType                   gst_adapter_get_type            (void);
77
78 GstAdapter *            gst_adapter_new                 (void) G_GNUC_MALLOC;
79
80 void                    gst_adapter_clear               (GstAdapter *adapter);
81 void                    gst_adapter_push                (GstAdapter *adapter, GstBuffer* buf);
82 gconstpointer           gst_adapter_map                 (GstAdapter *adapter, gsize size);
83 void                    gst_adapter_unmap               (GstAdapter *adapter);
84 void                    gst_adapter_copy                (GstAdapter *adapter, gpointer dest,
85                                                          gsize offset, gsize size);
86 void                    gst_adapter_flush               (GstAdapter *adapter, gsize flush);
87 gpointer                gst_adapter_take                (GstAdapter *adapter, gsize nbytes);
88 GstBuffer*              gst_adapter_take_buffer         (GstAdapter *adapter, gsize nbytes);
89 GList*                  gst_adapter_take_list           (GstAdapter *adapter, gsize nbytes);
90 gsize                   gst_adapter_available           (GstAdapter *adapter);
91 gsize                   gst_adapter_available_fast      (GstAdapter *adapter);
92
93 GstClockTime            gst_adapter_prev_pts            (GstAdapter *adapter, guint64 *distance);
94 GstClockTime            gst_adapter_prev_dts            (GstAdapter *adapter, guint64 *distance);
95
96 gsize                   gst_adapter_masked_scan_uint32  (GstAdapter * adapter, guint32 mask,
97                                                          guint32 pattern, gsize offset, gsize size);
98
99 gsize                   gst_adapter_masked_scan_uint32_peek  (GstAdapter * adapter, guint32 mask,
100                                                          guint32 pattern, gsize offset, gsize size, guint32 * value);
101
102 G_END_DECLS
103
104 #endif /* __GST_ADAPTER_H__ */