New typefind system: bytestream is now part of the core all plugins have been modifie...
[platform/upstream/gstreamer.git] / gst / gstbytestream.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
52 GstByteStream*          gst_bytestream_new              (GstPad *pad);
53 void                    gst_bytestream_destroy          (GstByteStream *bs);
54
55 void                    gst_bytestream_reset            (GstByteStream *bs);
56 guint32                 gst_bytestream_read             (GstByteStream *bs, GstBuffer** buf, guint32 len);
57 guint64                 gst_bytestream_tell             (GstByteStream *bs);
58 guint64                 gst_bytestream_length           (GstByteStream *bs);
59 gboolean                gst_bytestream_size_hint        (GstByteStream *bs, guint32 size);
60 gboolean                gst_bytestream_seek             (GstByteStream *bs, gint64 offset, GstSeekType type);
61 guint32                 gst_bytestream_peek             (GstByteStream *bs, GstBuffer** buf, guint32 len);
62 guint32                 gst_bytestream_peek_bytes       (GstByteStream *bs, guint8** data, guint32 len);
63 gboolean                gst_bytestream_flush            (GstByteStream *bs, guint32 len);
64 void                    gst_bytestream_flush_fast       (GstByteStream *bs, guint32 len);
65 void                    gst_bytestream_get_status       (GstByteStream *bs, guint32 *avail_out, GstEvent **event_out);
66 guint64                 gst_bytestream_get_timestamp    (GstByteStream *bs);
67
68 void                    gst_bytestream_print_status     (GstByteStream *bs);
69
70 G_END_DECLS
71
72 #endif /* __GST_BYTESTREAM_H__ */