upload tizen1.0 source
[framework/multimedia/gst-plugins-good0.10.git] / gst / matroska / matroska-parse.h
1 /* GStreamer Matroska muxer/demuxer
2  * (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3  *
4  * matroska-parse.h: matroska file/stream parseer 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_PARSE_H__
23 #define __GST_MATROSKA_PARSE_H__
24
25 #include <gst/gst.h>
26 #include <gst/base/gstadapter.h>
27
28 #include "ebml-read.h"
29 #include "matroska-ids.h"
30
31 G_BEGIN_DECLS
32
33 #define GST_TYPE_MATROSKA_PARSE \
34   (gst_matroska_parse_get_type ())
35 #define GST_MATROSKA_PARSE(obj) \
36   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MATROSKA_PARSE, GstMatroskaParse))
37 #define GST_MATROSKA_PARSE_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MATROSKA_PARSE, GstMatroskaParseClass))
39 #define GST_IS_MATROSKA_PARSE(obj) \
40   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MATROSKA_PARSE))
41 #define GST_IS_MATROSKA_PARSE_CLASS(klass) \
42   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MATROSKA_PARSE))
43
44 typedef enum {
45   GST_MATROSKA_PARSE_STATE_START,
46   GST_MATROSKA_PARSE_STATE_SEGMENT,
47   GST_MATROSKA_PARSE_STATE_HEADER,
48   GST_MATROSKA_PARSE_STATE_DATA,
49   GST_MATROSKA_PARSE_STATE_SEEK,
50   GST_MATROSKA_PARSE_STATE_SCANNING
51 } GstMatroskaParseState;
52
53 typedef struct _GstMatroskaParse {
54   GstElement              parent;
55
56   /* < private > */
57
58   GstIndex                *element_index;
59   gint                     element_index_writer_id;
60
61   /* pads */
62   GstPad                  *sinkpad;
63   GstPad                  *srcpad;
64   GPtrArray               *src;
65   GstClock                *clock;
66   guint                    num_streams;
67   guint                    num_v_streams;
68   guint                    num_a_streams;
69   guint                    num_t_streams;
70
71   GstBuffer *streamheader;
72   gboolean pushed_headers;
73   GstClockTime last_timestamp;
74
75   /* metadata */
76   gchar                   *muxing_app;
77   gchar                   *writing_app;
78   gint64                   created;
79
80   /* state */
81   //gboolean                 streaming;
82   GstMatroskaParseState    state;
83   guint                    level_up;
84   guint64                  seek_block;
85   gboolean                 seek_first;
86
87   /* did we parse cues/tracks/segmentinfo already? */
88   gboolean                 index_parsed;
89   gboolean                 tracks_parsed;
90   gboolean                 segmentinfo_parsed;
91   gboolean                 attachments_parsed;
92   GList                   *tags_parsed;
93   GList                   *seek_parsed;
94
95   /* start-of-segment */
96   guint64                  ebml_segment_start;
97
98   /* a cue (index) table */
99   GArray                  *index;
100
101   /* timescale in the file */
102   guint64                  time_scale;
103
104   /* keeping track of playback position */
105   GstSegment               segment;
106   gboolean                 segment_running;
107   GstClockTime             last_stop_end;
108
109   GstEvent                *close_segment;
110   GstEvent                *new_segment;
111   GstTagList              *global_tags;
112
113   /* pull mode caching */
114   GstBuffer *cached_buffer;
115
116   /* push and pull mode */
117   guint64                  offset;
118   /* some state saving */
119   GstClockTime             cluster_time;
120   guint64                  cluster_offset;
121   guint64                  first_cluster_offset;
122   guint64                  next_cluster_offset;
123
124   /* push based mode usual suspects */
125   GstAdapter              *adapter;
126   /* index stuff */
127   gboolean                 seekable;
128   gboolean                 building_index;
129   guint64                  index_offset;
130   GstEvent                *seek_event;
131   gboolean                 need_newsegment;
132
133   /* reverse playback */
134   GArray                  *seek_index;
135   gint                     seek_entry;
136 } GstMatroskaParse;
137
138 typedef struct _GstMatroskaParseClass {
139   GstElementClass parent;
140 } GstMatroskaParseClass;
141
142 gboolean gst_matroska_parse_plugin_init (GstPlugin *plugin);
143
144 G_END_DECLS
145
146 #endif /* __GST_MATROSKA_PARSE_H__ */