From 9610c7f354541c360be44c524454e55f162c9884 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philip=20J=C3=A4genstedt?= Date: Mon, 17 May 2010 05:27:44 +0200 Subject: [PATCH] matroska: handle matroska and webm doctype versions equally The original plan was to let WebM v1 be the same as Matroska v2 (with extra constraints), but for simplicity it was decided to handle the versions equally, such that e.g. SimpleBlock is only allowed in WebM v2. --- gst/matroska/matroska-demux.c | 8 +++----- gst/matroska/matroska-mux.c | 7 ++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index 8478893..a311b4a 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -2581,15 +2581,13 @@ gst_matroska_demux_parse_header (GstMatroskaDemux * demux) doctype_class = g_type_class_ref (GST_TYPE_MATROSKA_DOCTYPE); doctype_value = g_enum_get_value_by_nick (doctype_class, doctype); if (doctype_value) { - guint max_version = - doctype_value->value == GST_MATROSKA_DOCTYPE_MATROSKA ? 2 : 1; - if (version <= max_version) { + if (version <= 2) { GST_INFO_OBJECT (demux, "Input is %s version %d", doctype, version); ret = GST_FLOW_OK; } else { GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), - ("Demuxer version (%d) is too old to read %s version %d", - max_version, doctype, version)); + ("Demuxer version (2) is too old to read %s version %d", + doctype, version)); } } else { GST_ELEMENT_ERROR (demux, STREAM, WRONG_TYPE, (NULL), diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index 6f9dc54..2f32cf6 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -2600,7 +2600,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad) } } - /* write the block, for Matroska v2 and WebM use SimpleBlock if possible + /* write the block, for doctype v2 use SimpleBlock if possible * one slice (*breath*). * FIXME: Need to do correct lacing! */ relative_timestamp64 = GST_BUFFER_TIMESTAMP (buf) - mux->cluster_time; @@ -2612,10 +2612,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad) relative_timestamp64 -= mux->time_scale / 2; } relative_timestamp = relative_timestamp64 / (gint64) mux->time_scale; - if (((mux->doctype == GST_MATROSKA_DOCTYPE_MATROSKA - && mux->doctype_version > 1) - || mux->doctype == GST_MATROSKA_DOCTYPE_WEBM) - && !write_duration) { + if (mux->doctype_version > 1 && !write_duration) { int flags = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT) ? 0 : 0x80; -- 2.7.4