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., 51 Franklin St, Fifth Floor, 20 * Boston, MA 02110-1301, 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/gstflowcombiner.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 GstClock *clock; 55 gboolean have_nonintraonly_v_streams; 56 guint num_v_streams; 57 guint num_a_streams; 58 guint num_t_streams; 59 60 guint group_id; 61 gboolean have_group_id; 62 63 GstFlowCombiner *flowcombiner; 64 65 /* state */ 66 gboolean streaming; 67 guint64 seek_block; 68 gboolean seek_first; 69 70 /* did we parse cues/tracks/segmentinfo already? */ 71 gboolean tracks_parsed; 72 GList *seek_parsed; 73 74 /* cluster positions (optional) */ 75 GArray *clusters; 76 77 /* keeping track of playback position */ 78 GstClockTime last_stop_end; 79 GstClockTime stream_start_time; 80 81 /* Stop time for reverse playback */ 82 GstClockTime to_time; 83 GstEvent *new_segment; 84 85 /* some state saving */ 86 GstClockTime cluster_time; 87 guint64 cluster_offset; 88 guint64 cluster_prevsize; /* 0 if unknown */ 89 guint64 first_cluster_offset; 90 guint64 next_cluster_offset; 91 GstClockTime requested_seek_time; 92 guint64 seek_offset; 93 GstClockTime audio_lead_in_ts; 94 95 /* alternative duration; optionally obtained from last cluster */ 96 guint64 last_cluster_offset; 97 GstClockTime stream_last_time; 98 99 /* index stuff */ 100 gboolean seekable; 101 gboolean building_index; 102 guint64 index_offset; 103 GstEvent *seek_event; 104 GstEvent *deferred_seek_event; 105 GstPad *deferred_seek_pad; 106 gboolean need_segment; 107 guint32 segment_seqnum; 108 109 /* reverse playback */ 110 GArray *seek_index; 111 gint seek_entry; 112 113 gboolean seen_cluster_prevsize; /* We track this because the 114 * first cluster won't have 115 * this set, so we can't just 116 * check cluster_prevsize to 117 * determine if it's there 118 * or not. We assume if one 119 * cluster has it, all but 120 * the first will have it. */ 121 122 guint max_backtrack_distance; /* in seconds (0 = don't backtrack) */ 123 124 /* gap handling */ 125 guint64 max_gap_time; 126 127 /* for non-finalized files, with invalid segment duration */ 128 gboolean invalid_duration; 129 130 /* Cached upstream length (default G_MAXUINT64) */ 131 guint64 cached_length; 132 } GstMatroskaDemux; 133 134 typedef struct _GstMatroskaDemuxClass { 135 GstElementClass parent; 136 } GstMatroskaDemuxClass; 137 138 G_END_DECLS 139 140 #endif /* __GST_MATROSKA_DEMUX_H__ */ 141