gst-indent
[platform/upstream/gst-plugins-good.git] / gst / matroska / ebml-write.h
1 /* GStreamer EBML I/O
2  * (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3  *
4  * ebml-write.c: write EBML data to file/stream
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef __GST_EBML_WRITE_H__
23 #define __GST_EBML_WRITE_H__
24
25 #include <glib.h>
26 #include <gst/gst.h>
27
28 G_BEGIN_DECLS
29 #define GST_TYPE_EBML_WRITE \
30   (gst_ebml_write_get_type ())
31 #define GST_EBML_WRITE(obj) \
32   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_EBML_WRITE, GstEbmlWrite))
33 #define GST_EBML_WRITE_CLASS(klass) \
34   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_EBML_WRITE, GstEbmlWriteClass))
35 #define GST_IS_EBML_WRITE(obj) \
36   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_EBML_WRITE))
37 #define GST_IS_EBML_WRITE_CLASS(obj) \
38   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_EBML_WRITE))
39 #define GST_EBML_WRITE_GET_CLASS(obj) \
40   (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_EBML_WRITE, GstEbmlWriteClass))
41     typedef struct _GstEbmlWrite
42 {
43   GstElement parent;
44
45   GstPad *srcpad;
46   guint64 pos;
47
48   GstBuffer *cache;
49   guint handled;
50 } GstEbmlWrite;
51
52 typedef struct _GstEbmlWriteClass
53 {
54   GstElementClass parent;
55 } GstEbmlWriteClass;
56
57 GType gst_ebml_write_get_type (void);
58
59 /*
60  * Caching means that we do not push one buffer for
61  * each element, but fill this one until a flush.
62  */
63 void gst_ebml_write_set_cache (GstEbmlWrite * ebml, guint size);
64 void gst_ebml_write_flush_cache (GstEbmlWrite * ebml);
65
66 /*
67  * Seeking.
68  */
69 void gst_ebml_write_seek (GstEbmlWrite * ebml, guint64 pos);
70
71 /*
72  * Data writing. 
73  */
74 void gst_ebml_write_uint (GstEbmlWrite * ebml, guint32 id, guint64 num);
75 void gst_ebml_write_sint (GstEbmlWrite * ebml, guint32 id, gint64 num);
76 void gst_ebml_write_float (GstEbmlWrite * ebml, guint32 id, gdouble num);
77 void gst_ebml_write_ascii (GstEbmlWrite * ebml, guint32 id, const gchar * str);
78 void gst_ebml_write_utf8 (GstEbmlWrite * ebml, guint32 id, const gchar * str);
79 void gst_ebml_write_date (GstEbmlWrite * ebml, guint32 id, gint64 date);
80 guint64 gst_ebml_write_master_start (GstEbmlWrite * ebml, guint32 id);
81 void gst_ebml_write_master_finish (GstEbmlWrite * ebml, guint64 startpos);
82 void gst_ebml_write_binary (GstEbmlWrite * ebml,
83     guint32 id, guchar * binary, guint64 length);
84 void gst_ebml_write_header (GstEbmlWrite * ebml,
85     gchar * doctype, guint version);
86
87 /*
88  * Note: this is supposed to be used only for media data.
89  */
90 void gst_ebml_write_buffer_header (GstEbmlWrite * ebml,
91     guint32 id, guint64 length);
92 void gst_ebml_write_buffer (GstEbmlWrite * ebml, GstBuffer * data);
93
94 /*
95  * A hack, basically... See matroska-mux.c. I should actually
96  * make a nice _replace_element_with_size() or so, but this
97  * works for now.
98  */
99 void gst_ebml_replace_uint (GstEbmlWrite * ebml, guint64 pos, guint64 num);
100
101 G_END_DECLS
102 #endif /* __GST_EBML_WRITE_H__ */