mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-03 16:09:39 +00:00
matroska: move GstMatroska{Demux,Parse}::state to GstMatroskaReadCommon
https://bugzilla.gnome.org/show_bug.cgi?id=650877
This commit is contained in:
parent
090e3a6f41
commit
51c7e6d252
5 changed files with 59 additions and 70 deletions
|
@ -2,6 +2,7 @@
|
||||||
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
* (c) 2006 Tim-Philipp Müller <tim centricular net>
|
* (c) 2006 Tim-Philipp Müller <tim centricular net>
|
||||||
* (c) 2008 Sebastian Dröge <slomo@circular-chaos.org>
|
* (c) 2008 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
* (c) 2011 Debarshi Ray <rishi@gnu.org>
|
||||||
*
|
*
|
||||||
* matroska-demux.c: matroska file/stream demuxer
|
* matroska-demux.c: matroska file/stream demuxer
|
||||||
*
|
*
|
||||||
|
@ -361,7 +362,7 @@ gst_matroska_demux_reset (GstElement * element)
|
||||||
GST_DEBUG_OBJECT (demux, "Resetting state");
|
GST_DEBUG_OBJECT (demux, "Resetting state");
|
||||||
|
|
||||||
/* reset input */
|
/* reset input */
|
||||||
demux->state = GST_MATROSKA_DEMUX_STATE_START;
|
demux->common.state = GST_MATROSKA_READ_STATE_START;
|
||||||
|
|
||||||
/* clean up existing streams */
|
/* clean up existing streams */
|
||||||
if (demux->common.src) {
|
if (demux->common.src) {
|
||||||
|
@ -2444,7 +2445,7 @@ static GstMatroskaIndex *
|
||||||
gst_matroska_demux_search_pos (GstMatroskaDemux * demux, GstClockTime time)
|
gst_matroska_demux_search_pos (GstMatroskaDemux * demux, GstClockTime time)
|
||||||
{
|
{
|
||||||
GstMatroskaIndex *entry = NULL;
|
GstMatroskaIndex *entry = NULL;
|
||||||
GstMatroskaDemuxState current_state;
|
GstMatroskaReadState current_state;
|
||||||
GstClockTime otime, prev_cluster_time, current_cluster_time, cluster_time;
|
GstClockTime otime, prev_cluster_time, current_cluster_time, cluster_time;
|
||||||
gint64 opos, newpos, startpos = 0, current_offset;
|
gint64 opos, newpos, startpos = 0, current_offset;
|
||||||
gint64 prev_cluster_offset = -1, current_cluster_offset, cluster_offset;
|
gint64 prev_cluster_offset = -1, current_cluster_offset, cluster_offset;
|
||||||
|
@ -2462,14 +2463,14 @@ gst_matroska_demux_search_pos (GstMatroskaDemux * demux, GstClockTime time)
|
||||||
prev_cluster_time = GST_CLOCK_TIME_NONE;
|
prev_cluster_time = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
/* store some current state */
|
/* store some current state */
|
||||||
current_state = demux->state;
|
current_state = demux->common.state;
|
||||||
g_return_val_if_fail (current_state == GST_MATROSKA_DEMUX_STATE_DATA, NULL);
|
g_return_val_if_fail (current_state == GST_MATROSKA_READ_STATE_DATA, NULL);
|
||||||
|
|
||||||
current_cluster_offset = demux->cluster_offset;
|
current_cluster_offset = demux->cluster_offset;
|
||||||
current_cluster_time = demux->cluster_time;
|
current_cluster_time = demux->cluster_time;
|
||||||
current_offset = demux->offset;
|
current_offset = demux->offset;
|
||||||
|
|
||||||
demux->state = GST_MATROSKA_DEMUX_STATE_SCANNING;
|
demux->common.state = GST_MATROSKA_READ_STATE_SCANNING;
|
||||||
|
|
||||||
/* estimate using start and current position */
|
/* estimate using start and current position */
|
||||||
GST_OBJECT_LOCK (demux);
|
GST_OBJECT_LOCK (demux);
|
||||||
|
@ -2607,7 +2608,7 @@ exit:
|
||||||
demux->cluster_offset = current_cluster_offset;
|
demux->cluster_offset = current_cluster_offset;
|
||||||
demux->cluster_time = current_cluster_time;
|
demux->cluster_time = current_cluster_time;
|
||||||
demux->offset = current_offset;
|
demux->offset = current_offset;
|
||||||
demux->state = current_state;
|
demux->common.state = current_state;
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
@ -2837,7 +2838,7 @@ gst_matroska_demux_handle_seek_push (GstMatroskaDemux * demux, GstPad * pad,
|
||||||
|
|
||||||
GST_OBJECT_LOCK (demux);
|
GST_OBJECT_LOCK (demux);
|
||||||
/* handle the seek event in the chain function */
|
/* handle the seek event in the chain function */
|
||||||
demux->state = GST_MATROSKA_DEMUX_STATE_SEEK;
|
demux->common.state = GST_MATROSKA_READ_STATE_SEEK;
|
||||||
/* no more seek can be issued until state reset to _DATA */
|
/* no more seek can be issued until state reset to _DATA */
|
||||||
|
|
||||||
/* copy the event */
|
/* copy the event */
|
||||||
|
@ -2877,7 +2878,7 @@ gst_matroska_demux_handle_src_event (GstPad * pad, GstEvent * event)
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_SEEK:
|
case GST_EVENT_SEEK:
|
||||||
/* no seeking until we are (safely) ready */
|
/* no seeking until we are (safely) ready */
|
||||||
if (demux->state != GST_MATROSKA_DEMUX_STATE_DATA) {
|
if (demux->common.state != GST_MATROSKA_READ_STATE_DATA) {
|
||||||
GST_DEBUG_OBJECT (demux, "not ready for seeking yet");
|
GST_DEBUG_OBJECT (demux, "not ready for seeking yet");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -5414,15 +5415,15 @@ gst_matroska_demux_parse_id (GstMatroskaDemux * demux, guint32 id,
|
||||||
if (G_LIKELY (length != G_MAXUINT64))
|
if (G_LIKELY (length != G_MAXUINT64))
|
||||||
read += needed;
|
read += needed;
|
||||||
|
|
||||||
switch (demux->state) {
|
switch (demux->common.state) {
|
||||||
case GST_MATROSKA_DEMUX_STATE_START:
|
case GST_MATROSKA_READ_STATE_START:
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case GST_EBML_ID_HEADER:
|
case GST_EBML_ID_HEADER:
|
||||||
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
||||||
ret = gst_matroska_demux_parse_header (demux, &ebml);
|
ret = gst_matroska_demux_parse_header (demux, &ebml);
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
goto parse_failed;
|
goto parse_failed;
|
||||||
demux->state = GST_MATROSKA_DEMUX_STATE_SEGMENT;
|
demux->common.state = GST_MATROSKA_READ_STATE_SEGMENT;
|
||||||
gst_matroska_demux_check_seekability (demux);
|
gst_matroska_demux_check_seekability (demux);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -5430,7 +5431,7 @@ gst_matroska_demux_parse_id (GstMatroskaDemux * demux, guint32 id,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_MATROSKA_DEMUX_STATE_SEGMENT:
|
case GST_MATROSKA_READ_STATE_SEGMENT:
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case GST_MATROSKA_ID_SEGMENT:
|
case GST_MATROSKA_ID_SEGMENT:
|
||||||
/* eat segment prefix */
|
/* eat segment prefix */
|
||||||
|
@ -5441,7 +5442,7 @@ gst_matroska_demux_parse_id (GstMatroskaDemux * demux, guint32 id,
|
||||||
/* seeks are from the beginning of the segment,
|
/* seeks are from the beginning of the segment,
|
||||||
* after the segment ID/length */
|
* after the segment ID/length */
|
||||||
demux->common.ebml_segment_start = demux->offset;
|
demux->common.ebml_segment_start = demux->offset;
|
||||||
demux->state = GST_MATROSKA_DEMUX_STATE_HEADER;
|
demux->common.state = GST_MATROSKA_READ_STATE_HEADER;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GST_WARNING_OBJECT (demux,
|
GST_WARNING_OBJECT (demux,
|
||||||
|
@ -5451,14 +5452,14 @@ gst_matroska_demux_parse_id (GstMatroskaDemux * demux, guint32 id,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_MATROSKA_DEMUX_STATE_SCANNING:
|
case GST_MATROSKA_READ_STATE_SCANNING:
|
||||||
if (id != GST_MATROSKA_ID_CLUSTER &&
|
if (id != GST_MATROSKA_ID_CLUSTER &&
|
||||||
id != GST_MATROSKA_ID_CLUSTERTIMECODE)
|
id != GST_MATROSKA_ID_CLUSTERTIMECODE)
|
||||||
goto skip;
|
goto skip;
|
||||||
/* fall-through */
|
/* fall-through */
|
||||||
case GST_MATROSKA_DEMUX_STATE_HEADER:
|
case GST_MATROSKA_READ_STATE_HEADER:
|
||||||
case GST_MATROSKA_DEMUX_STATE_DATA:
|
case GST_MATROSKA_READ_STATE_DATA:
|
||||||
case GST_MATROSKA_DEMUX_STATE_SEEK:
|
case GST_MATROSKA_READ_STATE_SEEK:
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case GST_MATROSKA_ID_SEGMENTINFO:
|
case GST_MATROSKA_ID_SEGMENTINFO:
|
||||||
if (!demux->segmentinfo_parsed) {
|
if (!demux->segmentinfo_parsed) {
|
||||||
|
@ -5487,8 +5488,9 @@ gst_matroska_demux_parse_id (GstMatroskaDemux * demux, guint32 id,
|
||||||
goto no_tracks;
|
goto no_tracks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (G_UNLIKELY (demux->state == GST_MATROSKA_DEMUX_STATE_HEADER)) {
|
if (G_UNLIKELY (demux->common.state
|
||||||
demux->state = GST_MATROSKA_DEMUX_STATE_DATA;
|
== GST_MATROSKA_READ_STATE_HEADER)) {
|
||||||
|
demux->common.state = GST_MATROSKA_READ_STATE_DATA;
|
||||||
demux->first_cluster_offset = demux->offset;
|
demux->first_cluster_offset = demux->offset;
|
||||||
GST_DEBUG_OBJECT (demux, "signaling no more pads");
|
GST_DEBUG_OBJECT (demux, "signaling no more pads");
|
||||||
gst_element_no_more_pads (GST_ELEMENT (demux));
|
gst_element_no_more_pads (GST_ELEMENT (demux));
|
||||||
|
@ -5588,7 +5590,7 @@ gst_matroska_demux_parse_id (GstMatroskaDemux * demux, guint32 id,
|
||||||
ret = gst_matroska_read_common_parse_index (&demux->common, &ebml);
|
ret = gst_matroska_read_common_parse_index (&demux->common, &ebml);
|
||||||
/* only push based; delayed index building */
|
/* only push based; delayed index building */
|
||||||
if (ret == GST_FLOW_OK
|
if (ret == GST_FLOW_OK
|
||||||
&& demux->state == GST_MATROSKA_DEMUX_STATE_SEEK) {
|
&& demux->common.state == GST_MATROSKA_READ_STATE_SEEK) {
|
||||||
GstEvent *event;
|
GstEvent *event;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (demux);
|
GST_OBJECT_LOCK (demux);
|
||||||
|
@ -5602,7 +5604,7 @@ gst_matroska_demux_parse_id (GstMatroskaDemux * demux, guint32 id,
|
||||||
goto seek_failed;
|
goto seek_failed;
|
||||||
/* resume data handling, main thread clear to seek again */
|
/* resume data handling, main thread clear to seek again */
|
||||||
GST_OBJECT_LOCK (demux);
|
GST_OBJECT_LOCK (demux);
|
||||||
demux->state = GST_MATROSKA_DEMUX_STATE_DATA;
|
demux->common.state = GST_MATROSKA_READ_STATE_DATA;
|
||||||
GST_OBJECT_UNLOCK (demux);
|
GST_OBJECT_UNLOCK (demux);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -5681,7 +5683,7 @@ gst_matroska_demux_loop (GstPad * pad)
|
||||||
guint needed;
|
guint needed;
|
||||||
|
|
||||||
/* If we have to close a segment, send a new segment to do this now */
|
/* If we have to close a segment, send a new segment to do this now */
|
||||||
if (G_LIKELY (demux->state == GST_MATROSKA_DEMUX_STATE_DATA)) {
|
if (G_LIKELY (demux->common.state == GST_MATROSKA_READ_STATE_DATA)) {
|
||||||
if (G_UNLIKELY (demux->close_segment)) {
|
if (G_UNLIKELY (demux->close_segment)) {
|
||||||
gst_matroska_demux_send_event (demux, demux->close_segment);
|
gst_matroska_demux_send_event (demux, demux->close_segment);
|
||||||
demux->close_segment = NULL;
|
demux->close_segment = NULL;
|
||||||
|
@ -5919,7 +5921,7 @@ gst_matroska_demux_handle_sink_event (GstPad * pad, GstEvent * event)
|
||||||
"received format %d newsegment %" GST_SEGMENT_FORMAT, format,
|
"received format %d newsegment %" GST_SEGMENT_FORMAT, format,
|
||||||
&segment);
|
&segment);
|
||||||
|
|
||||||
if (demux->state < GST_MATROSKA_DEMUX_STATE_DATA) {
|
if (demux->common.state < GST_MATROSKA_READ_STATE_DATA) {
|
||||||
GST_DEBUG_OBJECT (demux, "still starting");
|
GST_DEBUG_OBJECT (demux, "still starting");
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -5955,7 +5957,7 @@ gst_matroska_demux_handle_sink_event (GstPad * pad, GstEvent * event)
|
||||||
}
|
}
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
{
|
{
|
||||||
if (demux->state != GST_MATROSKA_DEMUX_STATE_DATA) {
|
if (demux->common.state != GST_MATROSKA_READ_STATE_DATA) {
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
GST_ELEMENT_ERROR (demux, STREAM, DEMUX,
|
GST_ELEMENT_ERROR (demux, STREAM, DEMUX,
|
||||||
(NULL), ("got eos and didn't receive a complete header object"));
|
(NULL), ("got eos and didn't receive a complete header object"));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* GStreamer Matroska muxer/demuxer
|
/* GStreamer Matroska muxer/demuxer
|
||||||
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
* (c) 2011 Debarshi Ray <rishi@gnu.org>
|
||||||
*
|
*
|
||||||
* matroska-demux.h: matroska file/stream demuxer definition
|
* matroska-demux.h: matroska file/stream demuxer definition
|
||||||
*
|
*
|
||||||
|
@ -42,15 +43,6 @@ G_BEGIN_DECLS
|
||||||
#define GST_IS_MATROSKA_DEMUX_CLASS(klass) \
|
#define GST_IS_MATROSKA_DEMUX_CLASS(klass) \
|
||||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MATROSKA_DEMUX))
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MATROSKA_DEMUX))
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
GST_MATROSKA_DEMUX_STATE_START,
|
|
||||||
GST_MATROSKA_DEMUX_STATE_SEGMENT,
|
|
||||||
GST_MATROSKA_DEMUX_STATE_HEADER,
|
|
||||||
GST_MATROSKA_DEMUX_STATE_DATA,
|
|
||||||
GST_MATROSKA_DEMUX_STATE_SEEK,
|
|
||||||
GST_MATROSKA_DEMUX_STATE_SCANNING
|
|
||||||
} GstMatroskaDemuxState;
|
|
||||||
|
|
||||||
typedef struct _GstMatroskaDemux {
|
typedef struct _GstMatroskaDemux {
|
||||||
GstElement parent;
|
GstElement parent;
|
||||||
|
|
||||||
|
@ -72,7 +64,6 @@ typedef struct _GstMatroskaDemux {
|
||||||
|
|
||||||
/* state */
|
/* state */
|
||||||
gboolean streaming;
|
gboolean streaming;
|
||||||
GstMatroskaDemuxState state;
|
|
||||||
guint level_up;
|
guint level_up;
|
||||||
guint64 seek_block;
|
guint64 seek_block;
|
||||||
gboolean seek_first;
|
gboolean seek_first;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
* (c) 2006 Tim-Philipp Müller <tim centricular net>
|
* (c) 2006 Tim-Philipp Müller <tim centricular net>
|
||||||
* (c) 2008 Sebastian Dröge <slomo@circular-chaos.org>
|
* (c) 2008 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
* (c) 2011 Debarshi Ray <rishi@gnu.org>
|
||||||
*
|
*
|
||||||
* matroska-parse.c: matroska file/stream parser
|
* matroska-parse.c: matroska file/stream parser
|
||||||
*
|
*
|
||||||
|
@ -292,7 +293,7 @@ gst_matroska_parse_reset (GstElement * element)
|
||||||
GST_DEBUG_OBJECT (parse, "Resetting state");
|
GST_DEBUG_OBJECT (parse, "Resetting state");
|
||||||
|
|
||||||
/* reset input */
|
/* reset input */
|
||||||
parse->state = GST_MATROSKA_PARSE_STATE_START;
|
parse->common.state = GST_MATROSKA_READ_STATE_START;
|
||||||
|
|
||||||
/* clean up existing streams */
|
/* clean up existing streams */
|
||||||
if (parse->common.src) {
|
if (parse->common.src) {
|
||||||
|
@ -2195,7 +2196,7 @@ gst_matroska_parse_handle_seek_push (GstMatroskaParse * parse, GstPad * pad,
|
||||||
|
|
||||||
GST_OBJECT_LOCK (parse);
|
GST_OBJECT_LOCK (parse);
|
||||||
/* handle the seek event in the chain function */
|
/* handle the seek event in the chain function */
|
||||||
parse->state = GST_MATROSKA_PARSE_STATE_SEEK;
|
parse->common.state = GST_MATROSKA_READ_STATE_SEEK;
|
||||||
/* no more seek can be issued until state reset to _DATA */
|
/* no more seek can be issued until state reset to _DATA */
|
||||||
|
|
||||||
/* copy the event */
|
/* copy the event */
|
||||||
|
@ -2235,7 +2236,7 @@ gst_matroska_parse_handle_src_event (GstPad * pad, GstEvent * event)
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_SEEK:
|
case GST_EVENT_SEEK:
|
||||||
/* no seeking until we are (safely) ready */
|
/* no seeking until we are (safely) ready */
|
||||||
if (parse->state != GST_MATROSKA_PARSE_STATE_DATA) {
|
if (parse->common.state != GST_MATROSKA_READ_STATE_DATA) {
|
||||||
GST_DEBUG_OBJECT (parse, "not ready for seeking yet");
|
GST_DEBUG_OBJECT (parse, "not ready for seeking yet");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -4097,15 +4098,15 @@ gst_matroska_parse_parse_id (GstMatroskaParse * parse, guint32 id,
|
||||||
if (G_LIKELY (length != G_MAXUINT64))
|
if (G_LIKELY (length != G_MAXUINT64))
|
||||||
read += needed;
|
read += needed;
|
||||||
|
|
||||||
switch (parse->state) {
|
switch (parse->common.state) {
|
||||||
case GST_MATROSKA_PARSE_STATE_START:
|
case GST_MATROSKA_READ_STATE_START:
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case GST_EBML_ID_HEADER:
|
case GST_EBML_ID_HEADER:
|
||||||
GST_READ_CHECK (gst_matroska_parse_take (parse, read, &ebml));
|
GST_READ_CHECK (gst_matroska_parse_take (parse, read, &ebml));
|
||||||
ret = gst_matroska_parse_parse_header (parse, &ebml);
|
ret = gst_matroska_parse_parse_header (parse, &ebml);
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
goto parse_failed;
|
goto parse_failed;
|
||||||
parse->state = GST_MATROSKA_PARSE_STATE_SEGMENT;
|
parse->common.state = GST_MATROSKA_READ_STATE_SEGMENT;
|
||||||
gst_matroska_parse_check_seekability (parse);
|
gst_matroska_parse_check_seekability (parse);
|
||||||
gst_matroska_parse_accumulate_streamheader (parse, ebml.buf);
|
gst_matroska_parse_accumulate_streamheader (parse, ebml.buf);
|
||||||
break;
|
break;
|
||||||
|
@ -4114,7 +4115,7 @@ gst_matroska_parse_parse_id (GstMatroskaParse * parse, guint32 id,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_MATROSKA_PARSE_STATE_SEGMENT:
|
case GST_MATROSKA_READ_STATE_SEGMENT:
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case GST_MATROSKA_ID_SEGMENT:
|
case GST_MATROSKA_ID_SEGMENT:
|
||||||
/* eat segment prefix */
|
/* eat segment prefix */
|
||||||
|
@ -4125,7 +4126,7 @@ gst_matroska_parse_parse_id (GstMatroskaParse * parse, guint32 id,
|
||||||
/* seeks are from the beginning of the segment,
|
/* seeks are from the beginning of the segment,
|
||||||
* after the segment ID/length */
|
* after the segment ID/length */
|
||||||
parse->common.ebml_segment_start = parse->offset;
|
parse->common.ebml_segment_start = parse->offset;
|
||||||
parse->state = GST_MATROSKA_PARSE_STATE_HEADER;
|
parse->common.state = GST_MATROSKA_READ_STATE_HEADER;
|
||||||
gst_matroska_parse_accumulate_streamheader (parse, ebml.buf);
|
gst_matroska_parse_accumulate_streamheader (parse, ebml.buf);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -4137,14 +4138,14 @@ gst_matroska_parse_parse_id (GstMatroskaParse * parse, guint32 id,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_MATROSKA_PARSE_STATE_SCANNING:
|
case GST_MATROSKA_READ_STATE_SCANNING:
|
||||||
if (id != GST_MATROSKA_ID_CLUSTER &&
|
if (id != GST_MATROSKA_ID_CLUSTER &&
|
||||||
id != GST_MATROSKA_ID_CLUSTERTIMECODE)
|
id != GST_MATROSKA_ID_CLUSTERTIMECODE)
|
||||||
goto skip;
|
goto skip;
|
||||||
/* fall-through */
|
/* fall-through */
|
||||||
case GST_MATROSKA_PARSE_STATE_HEADER:
|
case GST_MATROSKA_READ_STATE_HEADER:
|
||||||
case GST_MATROSKA_PARSE_STATE_DATA:
|
case GST_MATROSKA_READ_STATE_DATA:
|
||||||
case GST_MATROSKA_PARSE_STATE_SEEK:
|
case GST_MATROSKA_READ_STATE_SEEK:
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case GST_MATROSKA_ID_SEGMENTINFO:
|
case GST_MATROSKA_ID_SEGMENTINFO:
|
||||||
GST_READ_CHECK (gst_matroska_parse_take (parse, read, &ebml));
|
GST_READ_CHECK (gst_matroska_parse_take (parse, read, &ebml));
|
||||||
|
@ -4165,8 +4166,9 @@ gst_matroska_parse_parse_id (GstMatroskaParse * parse, guint32 id,
|
||||||
GST_DEBUG_OBJECT (parse, "Cluster before Track");
|
GST_DEBUG_OBJECT (parse, "Cluster before Track");
|
||||||
goto not_streamable;
|
goto not_streamable;
|
||||||
}
|
}
|
||||||
if (G_UNLIKELY (parse->state == GST_MATROSKA_PARSE_STATE_HEADER)) {
|
if (G_UNLIKELY (parse->common.state
|
||||||
parse->state = GST_MATROSKA_PARSE_STATE_DATA;
|
== GST_MATROSKA_READ_STATE_HEADER)) {
|
||||||
|
parse->common.state = GST_MATROSKA_READ_STATE_DATA;
|
||||||
parse->first_cluster_offset = parse->offset;
|
parse->first_cluster_offset = parse->offset;
|
||||||
GST_DEBUG_OBJECT (parse, "signaling no more pads");
|
GST_DEBUG_OBJECT (parse, "signaling no more pads");
|
||||||
}
|
}
|
||||||
|
@ -4263,7 +4265,7 @@ gst_matroska_parse_parse_id (GstMatroskaParse * parse, guint32 id,
|
||||||
ret = gst_matroska_read_common_parse_index (&parse->common, &ebml);
|
ret = gst_matroska_read_common_parse_index (&parse->common, &ebml);
|
||||||
/* only push based; delayed index building */
|
/* only push based; delayed index building */
|
||||||
if (ret == GST_FLOW_OK
|
if (ret == GST_FLOW_OK
|
||||||
&& parse->state == GST_MATROSKA_PARSE_STATE_SEEK) {
|
&& parse->common.state == GST_MATROSKA_READ_STATE_SEEK) {
|
||||||
GstEvent *event;
|
GstEvent *event;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (parse);
|
GST_OBJECT_LOCK (parse);
|
||||||
|
@ -4277,7 +4279,7 @@ gst_matroska_parse_parse_id (GstMatroskaParse * parse, guint32 id,
|
||||||
goto seek_failed;
|
goto seek_failed;
|
||||||
/* resume data handling, main thread clear to seek again */
|
/* resume data handling, main thread clear to seek again */
|
||||||
GST_OBJECT_LOCK (parse);
|
GST_OBJECT_LOCK (parse);
|
||||||
parse->state = GST_MATROSKA_PARSE_STATE_DATA;
|
parse->common.state = GST_MATROSKA_READ_STATE_DATA;
|
||||||
GST_OBJECT_UNLOCK (parse);
|
GST_OBJECT_UNLOCK (parse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4362,7 +4364,7 @@ gst_matroska_parse_loop (GstPad * pad)
|
||||||
guint needed;
|
guint needed;
|
||||||
|
|
||||||
/* If we have to close a segment, send a new segment to do this now */
|
/* If we have to close a segment, send a new segment to do this now */
|
||||||
if (G_LIKELY (parse->state == GST_MATROSKA_PARSE_STATE_DATA)) {
|
if (G_LIKELY (parse->common.state == GST_MATROSKA_READ_STATE_DATA)) {
|
||||||
if (G_UNLIKELY (parse->close_segment)) {
|
if (G_UNLIKELY (parse->close_segment)) {
|
||||||
gst_matroska_parse_send_event (parse, parse->close_segment);
|
gst_matroska_parse_send_event (parse, parse->close_segment);
|
||||||
parse->close_segment = NULL;
|
parse->close_segment = NULL;
|
||||||
|
@ -4600,7 +4602,7 @@ gst_matroska_parse_handle_sink_event (GstPad * pad, GstEvent * event)
|
||||||
"received format %d newsegment %" GST_SEGMENT_FORMAT, format,
|
"received format %d newsegment %" GST_SEGMENT_FORMAT, format,
|
||||||
&segment);
|
&segment);
|
||||||
|
|
||||||
if (parse->state < GST_MATROSKA_PARSE_STATE_DATA) {
|
if (parse->common.state < GST_MATROSKA_READ_STATE_DATA) {
|
||||||
GST_DEBUG_OBJECT (parse, "still starting");
|
GST_DEBUG_OBJECT (parse, "still starting");
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -4634,7 +4636,7 @@ gst_matroska_parse_handle_sink_event (GstPad * pad, GstEvent * event)
|
||||||
}
|
}
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
{
|
{
|
||||||
if (parse->state != GST_MATROSKA_PARSE_STATE_DATA) {
|
if (parse->common.state != GST_MATROSKA_READ_STATE_DATA) {
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
GST_ELEMENT_ERROR (parse, STREAM, DEMUX,
|
GST_ELEMENT_ERROR (parse, STREAM, DEMUX,
|
||||||
(NULL), ("got eos and didn't receive a complete header object"));
|
(NULL), ("got eos and didn't receive a complete header object"));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* GStreamer Matroska muxer/demuxer
|
/* GStreamer Matroska muxer/demuxer
|
||||||
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
* (c) 2011 Debarshi Ray <rishi@gnu.org>
|
||||||
*
|
*
|
||||||
* matroska-parse.h: matroska file/stream parseer definition
|
* matroska-parse.h: matroska file/stream parseer definition
|
||||||
*
|
*
|
||||||
|
@ -42,15 +43,6 @@ G_BEGIN_DECLS
|
||||||
#define GST_IS_MATROSKA_PARSE_CLASS(klass) \
|
#define GST_IS_MATROSKA_PARSE_CLASS(klass) \
|
||||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MATROSKA_PARSE))
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MATROSKA_PARSE))
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
GST_MATROSKA_PARSE_STATE_START,
|
|
||||||
GST_MATROSKA_PARSE_STATE_SEGMENT,
|
|
||||||
GST_MATROSKA_PARSE_STATE_HEADER,
|
|
||||||
GST_MATROSKA_PARSE_STATE_DATA,
|
|
||||||
GST_MATROSKA_PARSE_STATE_SEEK,
|
|
||||||
GST_MATROSKA_PARSE_STATE_SCANNING
|
|
||||||
} GstMatroskaParseState;
|
|
||||||
|
|
||||||
typedef struct _GstMatroskaParse {
|
typedef struct _GstMatroskaParse {
|
||||||
GstElement parent;
|
GstElement parent;
|
||||||
|
|
||||||
|
@ -77,7 +69,6 @@ typedef struct _GstMatroskaParse {
|
||||||
|
|
||||||
/* state */
|
/* state */
|
||||||
//gboolean streaming;
|
//gboolean streaming;
|
||||||
GstMatroskaParseState state;
|
|
||||||
guint level_up;
|
guint level_up;
|
||||||
guint64 seek_block;
|
guint64 seek_block;
|
||||||
gboolean seek_first;
|
gboolean seek_first;
|
||||||
|
|
|
@ -28,13 +28,13 @@
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GST_MATROSKA_READ_COMMON_STATE_START,
|
GST_MATROSKA_READ_STATE_START,
|
||||||
GST_MATROSKA_READ_COMMON_STATE_SEGMENT,
|
GST_MATROSKA_READ_STATE_SEGMENT,
|
||||||
GST_MATROSKA_READ_COMMON_STATE_HEADER,
|
GST_MATROSKA_READ_STATE_HEADER,
|
||||||
GST_MATROSKA_READ_COMMON_STATE_DATA,
|
GST_MATROSKA_READ_STATE_DATA,
|
||||||
GST_MATROSKA_READ_COMMON_STATE_SEEK,
|
GST_MATROSKA_READ_STATE_SEEK,
|
||||||
GST_MATROSKA_READ_COMMON_STATE_SCANNING
|
GST_MATROSKA_READ_STATE_SCANNING
|
||||||
} GstMatroskaReadCommonState;
|
} GstMatroskaReadState;
|
||||||
|
|
||||||
typedef struct _GstMatroskaReadCommon {
|
typedef struct _GstMatroskaReadCommon {
|
||||||
GstIndex *element_index;
|
GstIndex *element_index;
|
||||||
|
@ -44,6 +44,9 @@ typedef struct _GstMatroskaReadCommon {
|
||||||
GPtrArray *src;
|
GPtrArray *src;
|
||||||
guint num_streams;
|
guint num_streams;
|
||||||
|
|
||||||
|
/* state */
|
||||||
|
GstMatroskaReadState state;
|
||||||
|
|
||||||
/* did we parse cues/tracks/segmentinfo already? */
|
/* did we parse cues/tracks/segmentinfo already? */
|
||||||
gboolean index_parsed;
|
gboolean index_parsed;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue