1 /* GStreamer Matroska muxer/demuxer
2 * (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3 * (c) 2011 Debarshi Ray <rishi@gnu.org>
5 * matroska-read-common.h: shared by matroska file/stream demuxer and parser
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_READ_COMMON_H__
24 #define __GST_MATROSKA_READ_COMMON_H__
28 #include <gst/base/gstadapter.h>
30 #include "matroska-ids.h"
35 GST_MATROSKA_READ_STATE_START,
36 GST_MATROSKA_READ_STATE_SEGMENT,
37 GST_MATROSKA_READ_STATE_HEADER,
38 GST_MATROSKA_READ_STATE_DATA,
39 GST_MATROSKA_READ_STATE_SEEK,
40 GST_MATROSKA_READ_STATE_SCANNING
41 } GstMatroskaReadState;
43 typedef struct _GstMatroskaReadCommon {
44 GstIndex *element_index;
45 gint element_index_writer_id;
53 GstMatroskaReadState state;
55 /* did we parse cues/tracks/segmentinfo already? */
56 gboolean index_parsed;
58 /* start-of-segment */
59 guint64 ebml_segment_start;
61 /* a cue (index) table */
64 /* timescale in the file */
67 GstTagList *global_tags;
69 /* pull mode caching */
70 GstBuffer *cached_buffer;
72 /* push and pull mode */
75 /* push based mode usual suspects */
77 } GstMatroskaReadCommon;
79 GstFlowReturn gst_matroska_decode_content_encodings (GArray * encodings);
80 gboolean gst_matroska_decode_data (GArray * encodings, guint8 ** data_out,
81 guint * size_out, GstMatroskaTrackEncodingScope scope, gboolean free);
82 gint gst_matroska_index_seek_find (GstMatroskaIndex * i1, GstClockTime * time,
84 GstMatroskaIndex * gst_matroska_read_common_do_index_seek (
85 GstMatroskaReadCommon * common, GstMatroskaTrackContext * track, gint64
86 seek_pos, GArray ** _index, gint * _entry_index);
87 void gst_matroska_read_common_found_global_tag (GstMatroskaReadCommon * common,
88 GstElement * el, GstTagList * taglist);
89 gint64 gst_matroska_read_common_get_length (GstMatroskaReadCommon * common);
90 GstMatroskaTrackContext * gst_matroska_read_common_get_seek_track (
91 GstMatroskaReadCommon * common, GstMatroskaTrackContext * track);
92 GstFlowReturn gst_matroska_read_common_parse_index (GstMatroskaReadCommon *
93 common, GstEbmlRead * ebml);
94 GstFlowReturn gst_matroska_read_common_parse_header (GstMatroskaReadCommon *
95 common, GstEbmlRead * ebml);
96 GstFlowReturn gst_matroska_read_common_parse_skip (GstMatroskaReadCommon *
97 common, GstEbmlRead * ebml, const gchar * parent_name, guint id);
98 GstFlowReturn gst_matroska_read_common_peek_bytes (GstMatroskaReadCommon *
99 common, guint64 offset, guint size, GstBuffer ** p_buf, guint8 ** bytes);
100 GstFlowReturn gst_matroska_read_common_peek_id_length_pull (GstMatroskaReadCommon *
101 common, GstElement * el, guint32 * _id, guint64 * _length, guint *
103 GstFlowReturn gst_matroska_read_common_peek_id_length_push (GstMatroskaReadCommon *
104 common, GstElement * el, guint32 * _id, guint64 * _length, guint *
106 gint gst_matroska_read_common_stream_from_num (GstMatroskaReadCommon * common,
108 GstFlowReturn gst_matroska_read_common_read_track_encodings (
109 GstMatroskaReadCommon * common, GstEbmlRead * ebml,
110 GstMatroskaTrackContext * context);
111 void gst_matroska_read_common_reset_streams (GstMatroskaReadCommon * common,
112 GstClockTime time, gboolean full);
113 gboolean gst_matroska_read_common_tracknumber_unique (GstMatroskaReadCommon *
114 common, guint64 num);
118 #endif /* __GST_MATROSKA_READ_COMMON_H__ */