2003-11-21 21:34:27 +00:00
|
|
|
/* GStreamer Matroska muxer/demuxer
|
|
|
|
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
2011-05-23 15:48:57 +00:00
|
|
|
* (c) 2011 Debarshi Ray <rishi@gnu.org>
|
2003-11-21 21:34:27 +00:00
|
|
|
*
|
|
|
|
* matroska-demux.h: matroska file/stream demuxer definition
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2003-11-21 21:34:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_MATROSKA_DEMUX_H__
|
|
|
|
#define __GST_MATROSKA_DEMUX_H__
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2014-05-26 16:21:25 +00:00
|
|
|
#include <gst/base/gstflowcombiner.h>
|
2003-11-21 21:34:27 +00:00
|
|
|
|
|
|
|
#include "ebml-read.h"
|
|
|
|
#include "matroska-ids.h"
|
2011-05-23 15:06:44 +00:00
|
|
|
#include "matroska-read-common.h"
|
2003-11-21 21:34:27 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
2004-03-15 16:32:54 +00:00
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
#define GST_TYPE_MATROSKA_DEMUX \
|
|
|
|
(gst_matroska_demux_get_type ())
|
|
|
|
#define GST_MATROSKA_DEMUX(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MATROSKA_DEMUX, GstMatroskaDemux))
|
|
|
|
#define GST_MATROSKA_DEMUX_CLASS(klass) \
|
2006-04-20 13:23:40 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MATROSKA_DEMUX, GstMatroskaDemuxClass))
|
2003-11-21 21:34:27 +00:00
|
|
|
#define GST_IS_MATROSKA_DEMUX(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MATROSKA_DEMUX))
|
2006-04-20 13:23:40 +00:00
|
|
|
#define GST_IS_MATROSKA_DEMUX_CLASS(klass) \
|
2003-11-21 21:34:27 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MATROSKA_DEMUX))
|
2004-03-15 16:32:54 +00:00
|
|
|
|
|
|
|
typedef struct _GstMatroskaDemux {
|
2010-05-18 12:44:15 +00:00
|
|
|
GstElement parent;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2008-12-05 09:24:18 +00:00
|
|
|
/* < private > */
|
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
GstMatroskaReadCommon common;
|
2009-05-14 12:46:14 +00:00
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
/* pads */
|
2005-10-18 18:12:31 +00:00
|
|
|
GstClock *clock;
|
2018-08-15 10:25:21 +00:00
|
|
|
gboolean have_nonintraonly_v_streams;
|
2005-10-18 18:12:31 +00:00
|
|
|
guint num_v_streams;
|
|
|
|
guint num_a_streams;
|
|
|
|
guint num_t_streams;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2013-07-22 13:22:55 +00:00
|
|
|
guint group_id;
|
|
|
|
gboolean have_group_id;
|
|
|
|
|
2014-05-26 16:21:25 +00:00
|
|
|
GstFlowCombiner *flowcombiner;
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
/* state */
|
2010-04-14 09:53:46 +00:00
|
|
|
gboolean streaming;
|
2009-12-16 11:48:02 +00:00
|
|
|
guint64 seek_block;
|
2010-05-18 12:44:15 +00:00
|
|
|
gboolean seek_first;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2008-06-13 19:07:03 +00:00
|
|
|
/* did we parse cues/tracks/segmentinfo already? */
|
|
|
|
gboolean tracks_parsed;
|
2010-05-18 12:44:15 +00:00
|
|
|
GList *seek_parsed;
|
2003-12-07 23:05:58 +00:00
|
|
|
|
2011-02-10 10:56:33 +00:00
|
|
|
/* cluster positions (optional) */
|
|
|
|
GArray *clusters;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
/* keeping track of playback position */
|
2009-12-09 19:42:44 +00:00
|
|
|
GstClockTime last_stop_end;
|
2011-09-21 17:45:42 +00:00
|
|
|
GstClockTime stream_start_time;
|
2008-08-08 16:20:26 +00:00
|
|
|
|
2012-07-20 09:07:58 +00:00
|
|
|
/* Stop time for reverse playback */
|
|
|
|
GstClockTime to_time;
|
2008-08-08 16:20:26 +00:00
|
|
|
GstEvent *new_segment;
|
2009-12-16 11:43:27 +00:00
|
|
|
|
|
|
|
/* some state saving */
|
|
|
|
GstClockTime cluster_time;
|
|
|
|
guint64 cluster_offset;
|
2017-01-18 10:27:38 +00:00
|
|
|
guint64 cluster_prevsize; /* 0 if unknown */
|
2010-07-22 10:05:26 +00:00
|
|
|
guint64 first_cluster_offset;
|
2010-07-26 13:51:49 +00:00
|
|
|
guint64 next_cluster_offset;
|
2012-07-24 19:11:18 +00:00
|
|
|
GstClockTime requested_seek_time;
|
|
|
|
guint64 seek_offset;
|
2010-05-18 12:44:15 +00:00
|
|
|
|
2017-06-10 13:14:41 +00:00
|
|
|
/* alternative duration; optionally obtained from last cluster */
|
|
|
|
guint64 last_cluster_offset;
|
|
|
|
GstClockTime stream_last_time;
|
|
|
|
|
2010-04-14 09:53:46 +00:00
|
|
|
/* index stuff */
|
|
|
|
gboolean seekable;
|
|
|
|
gboolean building_index;
|
|
|
|
guint64 index_offset;
|
|
|
|
GstEvent *seek_event;
|
2011-11-26 09:01:07 +00:00
|
|
|
gboolean need_segment;
|
2013-07-25 04:39:58 +00:00
|
|
|
guint32 segment_seqnum;
|
2010-03-23 16:34:50 +00:00
|
|
|
|
|
|
|
/* reverse playback */
|
|
|
|
GArray *seek_index;
|
|
|
|
gint seek_entry;
|
2011-09-14 12:46:00 +00:00
|
|
|
|
2017-01-18 10:27:38 +00:00
|
|
|
gboolean seen_cluster_prevsize; /* We track this because the
|
|
|
|
* first cluster won't have
|
|
|
|
* this set, so we can't just
|
|
|
|
* check cluster_prevsize to
|
|
|
|
* determine if it's there
|
|
|
|
* or not. We assume if one
|
|
|
|
* cluster has it, all but
|
|
|
|
* the first will have it. */
|
|
|
|
|
2018-08-15 11:14:24 +00:00
|
|
|
guint max_backtrack_distance; /* in seconds (0 = don't backtrack) */
|
|
|
|
|
2011-09-14 12:46:00 +00:00
|
|
|
/* gap handling */
|
|
|
|
guint64 max_gap_time;
|
2011-12-21 16:43:10 +00:00
|
|
|
|
|
|
|
/* for non-finalized files, with invalid segment duration */
|
|
|
|
gboolean invalid_duration;
|
2014-12-19 09:57:29 +00:00
|
|
|
|
|
|
|
/* Cached upstream length (default G_MAXUINT64) */
|
|
|
|
guint64 cached_length;
|
2003-11-21 21:34:27 +00:00
|
|
|
} GstMatroskaDemux;
|
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
typedef struct _GstMatroskaDemuxClass {
|
2010-05-18 12:44:15 +00:00
|
|
|
GstElementClass parent;
|
2003-11-21 21:34:27 +00:00
|
|
|
} GstMatroskaDemuxClass;
|
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
gboolean gst_matroska_demux_plugin_init (GstPlugin *plugin);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
2004-03-15 16:32:54 +00:00
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
#endif /* __GST_MATROSKA_DEMUX_H__ */
|