WAV reader: Make DTS detection more resilient

This commit is contained in:
Moritz Bunkus 2011-10-16 22:44:47 +02:00
parent 96f83f2cd9
commit d1e8caaa4b
4 changed files with 24 additions and 3 deletions

View File

@ -1,5 +1,8 @@
2011-10-16 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: Fixed PCM audio in WAV sometimes being
detected as DTS.
* mkvmerge: enhancement: The verbose identification mode will add
the properties "default_duration", "audio_sampling_frequency" and
"audio_channels" if appropriate and if the corresponding header

View File

@ -107,7 +107,7 @@ protected:
virtual int decode_buffer(int len);
};
#define DTS_READ_SIZE 16384
#define DTS_READ_SIZE 65536
class wav_dts_demuxer_c: public wav_demuxer_c {
private:
@ -318,8 +318,12 @@ wav_dts_demuxer_c::probe(mm_io_cptr &io) {
io->restore_pos();
if (detect_dts(m_buf[m_cur_buf]->get_buffer(), len, m_pack_14_16, m_swap_bytes)) {
len = decode_buffer(len);
if (find_dts_header(m_buf[m_cur_buf]->get_buffer(), len, &m_dtsheader) >= 0) {
len = decode_buffer(len);
int pos = find_consecutive_dts_headers(m_buf[m_cur_buf]->get_buffer(), len, 5);
if (0 <= pos) {
if (0 > find_dts_header(m_buf[m_cur_buf]->get_buffer() + pos, len - pos, &m_dtsheader))
return false;
mxverb(3, boost::format("DTSinWAV: 14->16 %1% swap %2%\n") % m_pack_14_16 % m_swap_bytes);
return true;
}

View File

@ -164,3 +164,4 @@ T_315ui_locale_uk_UA:23026ac2ed9767541e89f2261bcf8b60-3182bfa8c7ef57b56185285fbd
T_316ui_locale_zh_CN:23026ac2ed9767541e89f2261bcf8b60-399cd00f7f8a16f553c448c97b560a70:passed:20111016-192532:0.719437777
T_317ui_locale_zh_TW:af26160704aa699ca03270813855ec7d-836878bf8118c2b708d4fcadd88245dc:passed:20111016-192531:0.705209719
T_318ui_locale_invalid:ok:passed:20111016-192531:0.044292216
T_319wav_with_pcm_detected_as_dts:eb7f2acc6f008c40d13f068e911ce9c0:passed:20111016-224416:0.071996925

View File

@ -0,0 +1,13 @@
#!/usr/bin/ruby -w
class T_319wav_with_pcm_detected_as_dts < Test
def description
"mkvmerge / WAV with PCM detected as DTS"
end
def run
merge "data/simple/wav_with_pcm_detected_as_dts.wav"
hash_tmp
end
end