From 9dc7859184d4b7ad1dd7e2b54704e994dbace329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alicia=20Boya=20Garc=C3=ADa?= Date: Thu, 30 Nov 2017 20:44:23 +0100 Subject: [PATCH] matroskademux: Allow Matroska headers to be read more than once This is necessary for MSE, where a new MSE initialization segment may be appended at any point. These MSE initialization segments consist of an entire WebM file until the first Cluster element (not included). [1] Note that track definitions are ignored on successive headers, they must match, but this is not checked by matroskademux (look for `(!demux->tracks_parsed)` in the code). Source pads are not altered when the new headers are read. This patch has been splitted from the original patch from eocanha in [2]. [1] https://www.w3.org/TR/mse-byte-stream-format-webm/ [2] https://bug334082.bugzilla-attachments.gnome.org/attachment.cgi?id=362212 https://bugzilla.gnome.org/show_bug.cgi?id=793333 --- gst/matroska/matroska-demux.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index b7e13bb801..24a7294851 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -4984,6 +4984,11 @@ gst_matroska_demux_parse_id (GstMatroskaDemux * demux, guint32 id, case GST_MATROSKA_READ_STATE_DATA: case GST_MATROSKA_READ_STATE_SEEK: switch (id) { + case GST_EBML_ID_HEADER: + GST_READ_CHECK (gst_matroska_demux_flush (demux, read)); + demux->common.state = GST_MATROSKA_READ_STATE_SEGMENT; + gst_matroska_demux_check_seekability (demux); + break; case GST_MATROSKA_ID_SEGMENTINFO: if (!demux->common.segmentinfo_parsed) { GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));