1 /* GStreamer Matroska muxer/demuxer
2 * (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * matroska-demux.h: matroska file/stream demuxer definition
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.
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.
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.
22 #ifndef __GST_MATROSKA_DEMUX_H__
23 #define __GST_MATROSKA_DEMUX_H__
26 #include <gst/base/gstadapter.h>
28 #include "ebml-read.h"
29 #include "matroska-ids.h"
33 #define GST_TYPE_MATROSKA_DEMUX \
34 (gst_matroska_demux_get_type ())
35 #define GST_MATROSKA_DEMUX(obj) \
36 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MATROSKA_DEMUX, GstMatroskaDemux))
37 #define GST_MATROSKA_DEMUX_CLASS(klass) \
38 (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MATROSKA_DEMUX, GstMatroskaDemuxClass))
39 #define GST_IS_MATROSKA_DEMUX(obj) \
40 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MATROSKA_DEMUX))
41 #define GST_IS_MATROSKA_DEMUX_CLASS(klass) \
42 (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MATROSKA_DEMUX))
45 GST_MATROSKA_DEMUX_STATE_START,
46 GST_MATROSKA_DEMUX_STATE_SEGMENT,
47 GST_MATROSKA_DEMUX_STATE_HEADER,
48 GST_MATROSKA_DEMUX_STATE_DATA,
49 GST_MATROSKA_DEMUX_STATE_SEEK,
50 GST_MATROSKA_DEMUX_STATE_SCANNING
51 } GstMatroskaDemuxState;
53 typedef struct _GstMatroskaDemux {
58 GstIndex *element_index;
59 gint element_index_writer_id;
77 GstMatroskaDemuxState state;
82 /* did we parse cues/tracks/segmentinfo already? */
83 gboolean index_parsed;
84 gboolean tracks_parsed;
85 gboolean segmentinfo_parsed;
86 gboolean attachments_parsed;
90 /* start-of-segment */
91 guint64 ebml_segment_start;
93 /* a cue (index) table */
95 /* cluster positions (optional) */
98 /* timescale in the file */
101 /* keeping track of playback position */
103 gboolean segment_running;
104 GstClockTime last_stop_end;
106 GstEvent *close_segment;
107 GstEvent *new_segment;
108 GstTagList *global_tags;
110 /* pull mode caching */
111 GstBuffer *cached_buffer;
113 /* push and pull mode */
115 /* some state saving */
116 GstClockTime cluster_time;
117 guint64 cluster_offset;
118 guint64 first_cluster_offset;
119 guint64 next_cluster_offset;
121 /* push based mode usual suspects */
125 gboolean building_index;
126 guint64 index_offset;
127 GstEvent *seek_event;
128 gboolean need_newsegment;
130 /* reverse playback */
135 typedef struct _GstMatroskaDemuxClass {
136 GstElementClass parent;
137 } GstMatroskaDemuxClass;
139 gboolean gst_matroska_demux_plugin_init (GstPlugin *plugin);
143 #endif /* __GST_MATROSKA_DEMUX_H__ */