Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to...
[platform/upstream/gst-plugins-good.git] / gst / matroska / matroska-mux.h
1 /* GStreamer Matroska muxer/demuxer
2  * (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3  *
4  * matroska-mux.h: matroska file/stream muxer object types
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_MATROSKA_MUX_H__
23 #define __GST_MATROSKA_MUX_H__
24
25 #include <gst/gst.h>
26
27 #include "ebml-write.h"
28 #include "matroska-ids.h"
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_MATROSKA_MUX \
33   (gst_matroska_mux_get_type ())
34 #define GST_MATROSKA_MUX(obj) \
35   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MATROSKA_MUX, GstMatroskaMux))
36 #define GST_MATROSKA_MUX_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MATROSKA_MUX, GstMatroskaMux))
38 #define GST_IS_MATROSKA_MUX(obj) \
39   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MATROSKA_MUX))
40 #define GST_IS_MATROSKA_MUX_CLASS(obj) \
41   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MATROSKA_MUX))
42
43 #define GST_MATROSKA_MUX_MAX_STREAMS 64
44
45 typedef enum {
46   GST_MATROSKA_MUX_STATE_START,
47   GST_MATROSKA_MUX_STATE_HEADER,
48   GST_MATROSKA_MUX_STATE_DATA,
49 } GstMatroskaMuxState;
50
51 typedef struct _GstMatroskaMux {
52   GstEbmlWrite   parent;
53
54   /* pads */
55   GstPad        *srcpad;
56   struct {
57     GstMatroskaTrackContext *track;
58     GstBuffer   *buffer;
59     gboolean     eos;
60   } sink[GST_MATROSKA_MUX_MAX_STREAMS];
61   guint          num_streams,
62                  num_v_streams, num_a_streams, num_t_streams;
63
64   /* metadata - includes writing_app and creation_time */
65   GstCaps       *metadata;
66
67   /* state */
68   GstMatroskaMuxState state;
69
70   /* a cue (index) table */
71   GstMatroskaIndex *index;
72   guint          num_indexes;
73
74   /* timescale in the file */
75   guint64        time_scale;
76
77   /* length, position (time, ns) */
78   guint64        duration;
79
80   /* byte-positions of master-elements (for replacing contents) */
81   guint64        segment_pos,
82                  seekhead_pos,
83                  cues_pos,
84 #if 0
85                  tags_pos,
86 #endif
87                  info_pos,
88                  tracks_pos,
89                  duration_pos;
90   guint64        segment_master;
91 } GstMatroskaMux;
92
93 typedef struct _GstMatroskaMuxClass {
94   GstEbmlWriteClass parent;
95 } GstMatroskaMuxClass;
96
97 GType    gst_matroska_mux_get_type    (void);
98
99 gboolean gst_matroska_mux_plugin_init (GstPlugin *plugin);
100
101 G_END_DECLS
102
103 #endif /* __GST_MATROSKA_MUX_H__ */