matroskademux: Support "webm" DocType

This commit is contained in:
Philip Jägenstedt 2010-05-09 19:28:59 +02:00 committed by Sebastian Dröge
parent 3b4759de18
commit 1daeb26df1

View file

@ -2574,18 +2574,32 @@ gst_matroska_demux_parse_header (GstMatroskaDemux * demux)
if ((ret = gst_ebml_read_header (ebml, &doctype, &version)) != GST_FLOW_OK) if ((ret = gst_ebml_read_header (ebml, &doctype, &version)) != GST_FLOW_OK)
return ret; return ret;
if (!doctype || strcmp (doctype, "matroska") != 0) { ret = GST_FLOW_ERROR;
GST_ELEMENT_ERROR (demux, STREAM, WRONG_TYPE, (NULL), if (doctype) {
("Input is not a matroska stream (doctype=%s)", GEnumClass *doctype_class;
doctype ? doctype : "none")); GEnumValue *doctype_value;
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) {
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));
}
} else {
GST_ELEMENT_ERROR (demux, STREAM, WRONG_TYPE, (NULL),
("Input is not a matroska stream (doctype=%s)", doctype));
}
g_type_class_unref (doctype_class);
g_free (doctype); g_free (doctype);
return GST_FLOW_ERROR; } else {
} GST_ELEMENT_ERROR (demux, STREAM, WRONG_TYPE, (NULL),
g_free (doctype); ("Input is not a matroska stream"));
if (version > 2) {
GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL),
("Demuxer version (2) is too old to read stream version %d", version));
return GST_FLOW_ERROR;
} }
return ret; return ret;