diff --git a/ChangeLog b/ChangeLog index ea4f1a33f..1e4eca356 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-01-04 Moritz Bunkus + + * mkvmerge: bug fix: fixed TrueHD detection both as raw streams as + well as inside other contains if the stream does not start with a + TrueHD sync frame. + 2016-01-03 Moritz Bunkus * MKVToolNix GUI: new merge tool feature: added a layout for the diff --git a/src/common/truehd.cpp b/src/common/truehd.cpp index de26199c2..52a378fe8 100644 --- a/src/common/truehd.cpp +++ b/src/common/truehd.cpp @@ -58,7 +58,7 @@ truehd_frame_t::parse_ac3_header(unsigned char const *data, m_type = truehd_frame_t::sync; m_size = m_ac3_header.m_bytes; - return size >= m_ac3_header.m_bytes; + return size >= m_ac3_header.m_bytes ? verify_ac3_checksum(data, size) : false; } bool @@ -235,7 +235,7 @@ truehd_parser_c::resync(unsigned int offset) { for (offset = offset + 4; (offset + 4) < size; ++offset) { uint32_t sync_word = get_uint32_be(&data[offset]); - if ((TRUEHD_SYNC_WORD == sync_word) || (MLP_SYNC_WORD == sync_word) || (AC3_SYNC_WORD == get_uint16_be(&data[offset - 4]))) { + if (mtx::included_in(sync_word, TRUEHD_SYNC_WORD, MLP_SYNC_WORD)) { m_sync_state = state_synced; return offset - 4; } diff --git a/tests/results.txt b/tests/results.txt index bbad16ca8..23b835429 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -370,3 +370,4 @@ T_521mp4_edit_list_constant_offset_with_segment_duration_not_0:07984c40325903cbc T_522mpeg_1_2_es_no_start_code_at_beginning:067554d94399178b6bb56b49746b04b6:passed:20151230-182435:0.299243222 T_523mpeg_ts_pes_size_0:5351b2c74ad4327eeecee1ccf658ef5f-217f7e6e3e04a6afe253487af08c0598:passed:20151230-221825:1.635929691 T_524mpeg2_misdetected_as_truehd:b023d230d68c2545c6cb6859786c692b:passed:20160102-222743:1.10526128 +T_525truehd_doesnt_start_with_sync_frame:a7f55b158ec9a3438eaee8b28b13a7cf:passed:20160104-205804:0.313378755 diff --git a/tests/test-525truehd_doesnt_start_with_sync_frame.rb b/tests/test-525truehd_doesnt_start_with_sync_frame.rb new file mode 100755 index 000000000..1675e5fa2 --- /dev/null +++ b/tests/test-525truehd_doesnt_start_with_sync_frame.rb @@ -0,0 +1,5 @@ +#!/usr/bin/ruby -w + +# T_525truehd_doesnt_start_with_sync_frame +describe "mkvmerge / TrueHD recognition if the stream doesn't start with a TrueHD sync frame" +test_identify "data/truehd/truehd-not-starting-with-sync-frame.thd"