matroska: move GstMatroska{Demux,Parse}::state to GstMatroskaReadCommon
[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  * (c) 2011 Debarshi Ray <rishi@gnu.org>
4  *
5  * matroska-demux.h: matroska file/stream demuxer definition
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #ifndef __GST_MATROSKA_DEMUX_H__
24 #define __GST_MATROSKA_DEMUX_H__
25
26 #include <gst/gst.h>
27 #include <gst/base/gstadapter.h>
28
29 #include "ebml-read.h"
30 #include "matroska-ids.h"
31 #include "matroska-read-common.h"
32
33 G_BEGIN_DECLS
34
35 #define GST_TYPE_MATROSKA_DEMUX \
36   (gst_matroska_demux_get_type ())
37 #define GST_MATROSKA_DEMUX(obj) \
38   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MATROSKA_DEMUX, GstMatroskaDemux))
39 #define GST_MATROSKA_DEMUX_CLASS(klass) \
40   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MATROSKA_DEMUX, GstMatroskaDemuxClass))
41 #define GST_IS_MATROSKA_DEMUX(obj) \
42   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MATROSKA_DEMUX))
43 #define GST_IS_MATROSKA_DEMUX_CLASS(klass) \
44   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MATROSKA_DEMUX))
45
46 typedef struct _GstMatroskaDemux {
47   GstElement              parent;
48
49   /* < private > */
50
51   GstMatroskaReadCommon    common;
52
53   /* pads */
54   GstPad                  *sinkpad;
55   GstClock                *clock;
56   guint                    num_v_streams;
57   guint                    num_a_streams;
58   guint                    num_t_streams;
59
60   /* metadata */
61   gchar                   *muxing_app;
62   gchar                   *writing_app;
63   gint64                   created;
64
65   /* state */
66   gboolean                 streaming;
67   guint                    level_up;
68   guint64                  seek_block;
69   gboolean                 seek_first;
70
71   /* did we parse cues/tracks/segmentinfo already? */
72   gboolean                 tracks_parsed;
73   gboolean                 segmentinfo_parsed;
74   gboolean                 attachments_parsed;
75   GList                   *tags_parsed;
76   GList                   *seek_parsed;
77
78   /* cluster positions (optional) */
79   GArray                  *clusters;
80
81   /* keeping track of playback position */
82   GstSegment               segment;
83   gboolean                 segment_running;
84   GstClockTime             last_stop_end;
85
86   GstEvent                *close_segment;
87   GstEvent                *new_segment;
88   GstTagList              *global_tags;
89
90   /* pull mode caching */
91   GstBuffer *cached_buffer;
92
93   /* push and pull mode */
94   guint64                  offset;
95   /* some state saving */
96   GstClockTime             cluster_time;
97   guint64                  cluster_offset;
98   guint64                  first_cluster_offset;
99   guint64                  next_cluster_offset;
100
101   /* push based mode usual suspects */
102   GstAdapter              *adapter;
103   /* index stuff */
104   gboolean                 seekable;
105   gboolean                 building_index;
106   guint64                  index_offset;
107   GstEvent                *seek_event;
108   gboolean                 need_newsegment;
109
110   /* reverse playback */
111   GArray                  *seek_index;
112   gint                     seek_entry;
113 } GstMatroskaDemux;
114
115 typedef struct _GstMatroskaDemuxClass {
116   GstElementClass parent;
117 } GstMatroskaDemuxClass;
118
119 gboolean gst_matroska_demux_plugin_init (GstPlugin *plugin);
120
121 G_END_DECLS
122
123 #endif /* __GST_MATROSKA_DEMUX_H__ */