summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_mkv.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-10-21 22:58:51 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-10-21 22:58:51 +0300
commitdd61521a6ebe73ac8060974c43ac4a6d8fda2e25 (patch)
treec3a10ba3116fa42534597144d35471903dc108d3 /libmpdemux/demux_mkv.c
parent7a190c461ba02cd973dd86f7ca732dd2bcd77848 (diff)
downloadmpv-dd61521a6ebe73ac8060974c43ac4a6d8fda2e25.tar.bz2
mpv-dd61521a6ebe73ac8060974c43ac4a6d8fda2e25.tar.xz
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.
Diffstat (limited to 'libmpdemux/demux_mkv.c')
-rw-r--r--libmpdemux/demux_mkv.c5
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);