Fixed AAC detection

AAC data which does not start on the first byte was not detected
properly. The reason is that the AAC scanning code did not take
the start offset into account. Also the AAC reader class treated
the offset to the first header being != 0 as an error.
This commit is contained in:
Moritz Bunkus 2009-02-06 10:24:46 +01:00
parent 1d78829d4e
commit 1244d00df9
3 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2009-02-06 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: Fixed the detection of AAC files whose first
AAC header does not start on the first byte of the file.
2009-01-19 Moritz Bunkus <moritz@bunkus.org>
* mmg: bug fix: It was possible to crash mmg by clicking onto the

View File

@ -106,7 +106,6 @@ parse_aac_adif_header(unsigned char *buf,
static bool
is_adts_header(unsigned char *buf,
int size,
int bpos,
aac_header_t *aac_header,
bool emphasis_present) {
int id, profile, sfreq_index, channels, frame_length;
@ -163,7 +162,7 @@ find_aac_header(unsigned char *buf,
try {
bpos = 0;
while (bpos < size) {
if (is_adts_header(buf, size, bpos, aac_header, emphasis_present))
if (is_adts_header(buf + bpos, size - bpos, aac_header, emphasis_present))
return bpos;
bpos++;
}

View File

@ -98,7 +98,7 @@ aac_reader_c::aac_reader_c(track_info_c &_ti)
adif = 1;
} else {
if (find_aac_header(chunk, init_read_len, &aacheader, emphasis_present) != 0)
if (find_aac_header(chunk, init_read_len, &aacheader, emphasis_present) < 0)
throw error_c(boost::format(Y("aac_reader: No valid AAC packet found in the first %1% bytes.\n")) % init_read_len);
guess_adts_version();
adif = 0;