From dd61521a6ebe73ac8060974c43ac4a6d8fda2e25 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Thu, 21 Oct 2010 22:58:51 +0300 Subject: demux_mkv: accept files with no doctype in EBML header Assume files which start with an EBML header but have no DocType element in that header have type "matroska", and attempt to play them. Reportedly some mkvmerge versions create such files. --- libmpdemux/demux_mkv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libmpdemux') diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c index f7f04b72d9..c9d8312e61 100644 --- a/libmpdemux/demux_mkv.c +++ b/libmpdemux/demux_mkv.c @@ -1644,7 +1644,10 @@ static int demux_mkv_open(demuxer_t *demuxer) struct ebml_parse_ctx parse_ctx = { .no_error_messages = true }; if (ebml_read_element(s, &parse_ctx, &ebml_master, &ebml_ebml_desc) < 0) return 0; - if (bstrcmp(ebml_master.doc_type, BSTR("matroska")) != 0 + if (ebml_master.doc_type.start == NULL) { + mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] File has EBML header but no doctype." + " Assuming \"matroska\".\n"); + } else if (bstrcmp(ebml_master.doc_type, BSTR("matroska")) != 0 && bstrcmp(ebml_master.doc_type, BSTR("webm")) != 0) { mp_msg(MSGT_DEMUX, MSGL_DBG2, "[mkv] no head found\n"); talloc_free(parse_ctx.talloc_ctx); -- cgit v1.2.3