Merged 2019

This commit is contained in:
Moritz Bunkus 2004-08-21 15:46:41 +00:00
parent 7f656b5108
commit 969915fff6
2 changed files with 19 additions and 2 deletions

View File

@ -1,5 +1,8 @@
2004-08-21 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: WAV files which contained a 'PAD ' chunk
before the 'data' chunk were not processed at all.
* mkvmerge: bug fix: Use 'setjmp' and 'longjmp' Instead of
throwing a C++ exception during the chapter parsing
stage. Otherwise libexpat will abort with a non-descriptive error

View File

@ -60,7 +60,8 @@ wav_reader_c::probe_file(mm_io_c *mm_io,
}
if (strncmp((char *)wheader.riff.id, "RIFF", 4) ||
strncmp((char *)wheader.riff.wave_id, "WAVE", 4) ||
strncmp((char *)wheader.data.id, "data", 4))
(strncmp((char *)wheader.data.id, "data", 4) &&
strncmp((char *)wheader.data.id, "PAD ", 4)))
return 0;
return 1;
@ -91,6 +92,18 @@ wav_reader_c::wav_reader_c(track_info_c *nti)
ti->id = 0; // ID for this track.
is_dts = false;
while (1) {
if (!strncmp((char *)wheader.data.id, "data", 4))
break;
if ((mm_io->getFilePointer() + get_uint32(&wheader.data.len) +
sizeof(struct chunk_struct)) > size)
throw error_c("wav_reader: No 'data' chunk found.");
mm_io->setFilePointer(get_uint32(&wheader.data.len), seek_current);
if (mm_io->read(&wheader.data, sizeof(struct chunk_struct)) !=
sizeof(struct chunk_struct))
throw error_c("wav_reader: No 'data' chunk found.");
}
if (verbose)
mxinfo(FMT_FN "Using the WAV demultiplexer.\n", ti->fname);
@ -100,8 +113,9 @@ wav_reader_c::wav_reader_c(track_info_c *nti)
unsigned short buf[2][max_dts_packet_size/2];
int cur_buf = 0;
mm_io->save_pos();
long rlen = mm_io->read(obuf, max_dts_packet_size);
mm_io->setFilePointer(sizeof(wheader), seek_beginning);
mm_io->restore_pos();
for (dts_swap_bytes = 0; dts_swap_bytes < 2; dts_swap_bytes++) {
memcpy(buf[cur_buf], obuf, rlen);