expand tabs
[platform/upstream/gst-plugins-good.git] / gst / matroska / matroska-demux.h
1 /* GStreamer Matroska muxer/demuxer
2  * (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3  *
4  * matroska-demux.h: matroska file/stream demuxer definition
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_DEMUX_H__
23 #define __GST_MATROSKA_DEMUX_H__
24
25 #include <gst/gst.h>
26
27 #include "ebml-read.h"
28 #include "matroska-ids.h"
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_MATROSKA_DEMUX \
33   (gst_matroska_demux_get_type ())
34 #define GST_MATROSKA_DEMUX(obj) \
35   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MATROSKA_DEMUX, GstMatroskaDemux))
36 #define GST_MATROSKA_DEMUX_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MATROSKA_DEMUX, GstMatroskaDemux))
38 #define GST_IS_MATROSKA_DEMUX(obj) \
39   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MATROSKA_DEMUX))
40 #define GST_IS_MATROSKA_DEMUX_CLASS(obj) \
41   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MATROSKA_DEMUX))
42
43 #define GST_MATROSKA_DEMUX_MAX_STREAMS 64       
44
45 typedef enum {
46   GST_MATROSKA_DEMUX_STATE_START,
47   GST_MATROSKA_DEMUX_STATE_HEADER,
48   GST_MATROSKA_DEMUX_STATE_DATA
49 } GstMatroskaDemuxState;
50
51 typedef struct _GstMatroskaDemuxIndex {
52   guint64        pos;   /* of the corresponding *cluster*! */
53   guint16        track; /* reference to 'num' */
54   guint64        time;  /* in nanoseconds */
55 } GstMatroskaDemuxIndex;
56
57 typedef struct _GstMatroskaDemux {
58   GstEbmlRead              parent;
59
60   /* pads */
61   GstPad                  *sinkpad;
62   GstMatroskaTrackContext *src[GST_MATROSKA_DEMUX_MAX_STREAMS];
63   GstClock                *clock;
64   guint                    num_streams;
65   guint                    num_v_streams;
66   guint                    num_a_streams;
67   guint                    num_t_streams;
68
69   /* metadata */
70   gchar                   *muxing_app;
71   gchar                   *writing_app;
72   gint64                   created;
73
74   /* state */
75   GstMatroskaDemuxState    state;
76   guint                    level_up;
77
78   /* did we parse metadata/cues already? */
79   gboolean                 metadata_parsed;
80   gboolean                 index_parsed;
81
82   /* start-of-segment */
83   guint64                  ebml_segment_start;
84
85   /* a cue (index) table */
86   GstMatroskaIndex        *index;
87   guint                    num_indexes;
88
89   /* timescale in the file */
90   guint64                  time_scale;
91
92   /* length, position (time, ns) */
93   guint64                  pos;
94   guint64                  duration;
95
96   /* a possible pending seek */
97   gboolean                 seek_pending;
98
99   gdouble                  segment_rate;
100   gint64                   segment_start;
101   gint64                   segment_stop;
102   gboolean                 segment_play;
103 } GstMatroskaDemux;
104
105 typedef struct _GstMatroskaDemuxClass {
106   GstEbmlReadClass parent;
107 } GstMatroskaDemuxClass;
108
109 gboolean gst_matroska_demux_plugin_init (GstPlugin *plugin);
110
111 G_END_DECLS
112
113 #endif /* __GST_MATROSKA_DEMUX_H__ */