[vlc-commits] demux: mkv: fix more hvcC detection

2018-06-11 Thread Zhao Zhili
vlc | branch: master | Zhao Zhili  | Mon Jun 11 
20:54:37 2018 +0800| [6de3cec0ca402f0085372f6839cfb1d63c9afc38] | committer: 
Francois 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: Francois Cartegnie 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6de3cec0ca402f0085372f6839cfb1d63c9afc38
---

 modules/demux/mkv/matroska_segment_parse.cpp | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp 
b/modules/demux/mkv/matroska_segment_parse.cpp
index add75d84bd..c4754723ec 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -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 );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] demux: mkv: fix more hvcC detection

2018-06-25 Thread Zhao Zhili
vlc/vlc-3.0 | branch: master | Zhao Zhili  | Mon Jun 11 
20:54:37 2018 +0800| [87a83eb9f3cc010d0d1603bbb3976c69ce2d20be] | committer: 
Jean-Baptiste Kempf

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: Francois Cartegnie 
(cherry picked from commit 6de3cec0ca402f0085372f6839cfb1d63c9afc38)
Signed-off-by: Jean-Baptiste Kempf 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=87a83eb9f3cc010d0d1603bbb3976c69ce2d20be
---

 modules/demux/mkv/matroska_segment_parse.cpp | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp 
b/modules/demux/mkv/matroska_segment_parse.cpp
index 4bd4eaacee..f546413905 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -1593,17 +1593,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 );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits