a3dcc6194c933bbddf86760349d75b4028ed129c
[platform/upstream/gstreamer.git] / libs / gst / bytestream / bytestream.h
1 /* GStreamer
2  * Copyright (C) 2001 Erik Walthinsen <omega@temple-baptist.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_BYTESTREAM_H__
21 #define __GST_BYTESTREAM_H__
22
23 #include <glib.h>
24 #include <gst/gstpad.h>
25 #include <gst/gstevent.h>
26
27 G_BEGIN_DECLS
28
29 typedef struct _GstByteStream GstByteStream;
30
31 struct _GstByteStream {
32   GstPad        *pad;
33
34   GstEvent      *event;
35
36   GSList        *buflist;
37   guint32        headbufavail;
38   guint32        listavail;
39
40   /* we keep state of assembled pieces */
41   guint8        *assembled;
42   guint32        assembled_len; /* only valid when assembled != NULL */
43
44   /* this is needed for gst_bytestream_tell */
45   guint64        offset;
46   guint64        last_ts;
47
48   /* if we are in the seek state (waiting for DISCONT) */
49   gboolean       in_seek;
50
51   gpointer _gst_reserved[GST_PADDING];
52 };
53
54 GstByteStream*          gst_bytestream_new              (GstPad *pad);
55 void                    gst_bytestream_destroy          (GstByteStream *bs);
56
57 void                    gst_bytestream_reset            (GstByteStream *bs);
58 guint32                 gst_bytestream_read             (GstByteStream *bs, GstBuffer** buf, guint32 len);
59 guint64                 gst_bytestream_tell             (GstByteStream *bs);
60 guint64                 gst_bytestream_length           (GstByteStream *bs);
61 gboolean                gst_bytestream_size_hint        (GstByteStream *bs, guint32 size);
62 gboolean                gst_bytestream_seek             (GstByteStream *bs, gint64 offset, GstSeekType method);
63
64 guint32                 gst_bytestream_peek             (GstByteStream *bs, GstBuffer** buf, guint32 len);
65 guint32                 gst_bytestream_peek_bytes       (GstByteStream *bs, guint8** data, guint32 len);
66 gboolean                gst_bytestream_flush            (GstByteStream *bs, guint32 len);
67 void                    gst_bytestream_flush_fast       (GstByteStream *bs, guint32 len);
68 void                    gst_bytestream_get_status       (GstByteStream *bs, guint32 *avail_out, GstEvent **event_out);
69 guint64                 gst_bytestream_get_timestamp    (GstByteStream *bs);
70
71 void                    gst_bytestream_print_status     (GstByteStream *bs);
72
73 G_END_DECLS
74
75 #endif /* __GST_BYTESTREAM_H__ */