Commit 6de3cec0 authored by Zhao Zhili's avatar Zhao Zhili Committed by François Cartegnie

demux: mkv: fix more hvcC detection

MKV files made by DivXMKVMux 9.8.12.1750 are broken too. FFmpeg
hevc_parse.c did the same thing to workaround the issue.
Signed-off-by: François Cartegnie's avatarFrancois Cartegnie <fcvlcdev@free.fr>
parent 584b75bb
......@@ -1586,17 +1586,13 @@ bool matroska_segment_c::TrackInit( mkv_track_t * p_tk )
/* HACK: if we found invalid format, made by mkvmerge < 16.0.0,
* we try to fix it. They fixed it in 16.0.0. */
const char* app = vars.obj->psz_writing_application;
if( p_extra && p_extra[0] == 0 && app != NULL &&
strncmp(app, "mkvmerge", sizeof("mkvmerge")-1) == 0 )
if( p_extra && vars.p_tk->i_extra_data >= 3 &&
p_extra[0] == 0 && (p_extra[1] != 0 || p_extra[2] > 1) )
{
int major_version;
if( sscanf(app, "mkvmerge v%d.", &major_version) && major_version < 16 )
{
msg_Dbg(vars.p_demuxer,
"Invalid HEVC reserved bits in mkv file"
"made by mkvmerge < v16.0.0 detected, fixing it");
p_extra[0] = 0x01;
}
msg_Warn(vars.p_demuxer,
"Invalid HEVC reserved bits in mkv file "
"made by %s, fixing it", app ? app : "unknown app");
p_extra[0] = 0x01;
}
fill_extra_data( vars.p_tk, 0 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment