diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-10-21 22:58:51 +0300 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-10-21 22:58:51 +0300 |
commit | dd61521a6ebe73ac8060974c43ac4a6d8fda2e25 (patch) | |
tree | c3a10ba3116fa42534597144d35471903dc108d3 | |
parent | 7a190c461ba02cd973dd86f7ca732dd2bcd77848 (diff) |
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.
-rw-r--r-- | libmpdemux/demux_mkv.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); |