1 /* GStreamer Matroska muxer/demuxer
2 * (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3 * (c) 2011 Debarshi Ray <rishi@gnu.org>
5 * matroska-demux.h: matroska file/stream demuxer definition
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.
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.
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.
23 #ifndef __GST_MATROSKA_DEMUX_H__
24 #define __GST_MATROSKA_DEMUX_H__
28 #include "ebml-read.h"
29 #include "matroska-ids.h"
30 #include "matroska-read-common.h"
34 #define GST_TYPE_MATROSKA_DEMUX \
35 (gst_matroska_demux_get_type ())
36 #define GST_MATROSKA_DEMUX(obj) \
37 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MATROSKA_DEMUX, GstMatroskaDemux))
38 #define GST_MATROSKA_DEMUX_CLASS(klass) \
39 (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MATROSKA_DEMUX, GstMatroskaDemuxClass))
40 #define GST_IS_MATROSKA_DEMUX(obj) \
41 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MATROSKA_DEMUX))
42 #define GST_IS_MATROSKA_DEMUX_CLASS(klass) \
43 (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MATROSKA_DEMUX))
45 typedef struct _GstMatroskaDemux {
50 GstMatroskaReadCommon common;
64 /* did we parse cues/tracks/segmentinfo already? */
65 gboolean tracks_parsed;
68 /* cluster positions (optional) */
71 /* keeping track of playback position */
72 gboolean segment_running;
73 GstClockTime last_stop_end;
74 GstClockTime stream_start_time;
76 GstEvent *close_segment;
77 GstEvent *new_segment;
79 /* some state saving */
80 GstClockTime cluster_time;
81 guint64 cluster_offset;
82 guint64 first_cluster_offset;
83 guint64 next_cluster_offset;
85 #ifdef MKV_DEMUX_MODIFICATION
86 gint64 duration; /* need to check */
87 GstClockTime time_position;
88 GstMatroskaTrackContext* audio_stream;
90 gboolean found_videokeyframe;
91 gboolean found_audioframe;
92 gboolean seek_head_cluster_info_absent;
93 gboolean seek_head_cue_info_absent;
94 gboolean index_table_created;
95 gboolean index_table_array_creation;
96 guint32 initial_offset;
101 gboolean building_index;
102 guint64 index_offset;
103 GstEvent *seek_event;
104 gboolean need_newsegment;
106 /* reverse playback */
110 #ifdef MKV_DEMUX_MODIFICATION
111 GstClockTime next_key_cluster_time;
112 guint64 next_key_frame_offset;
113 GstClockTime current_ts;
114 GstClockTime current_fwd_ts;
115 GstClockTime next_keyframe_ts;
116 GstClockTime prev_keyframe_ts;
117 gboolean is_eos_blockgroup;
118 gboolean is_eos_simpleblock;
120 gboolean video_keyframe_pushed;
124 guint64 max_gap_time;
126 /* for non-finalized files, with invalid segment duration */
127 gboolean invalid_duration;
130 typedef struct _GstMatroskaDemuxClass {
131 GstElementClass parent;
132 } GstMatroskaDemuxClass;
134 gboolean gst_matroska_demux_plugin_init (GstPlugin *plugin);
138 #endif /* __GST_MATROSKA_DEMUX_H__ */