Also assume SBR if the sampling frequency is < 44100 even if only the 2 byte identifier is used.

This commit is contained in:
Moritz Bunkus 2003-12-23 12:11:59 +00:00
parent 4bf8041122
commit 632a6f861d
4 changed files with 25 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2003-12-23 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: There are MP4 files that actually contain HE-AAC but
don't have the 5 byte identifier. mkvmerge will also assume SBR if
there's only the 2 byte identifier with a sampling frequency <
44100Hz.
2003-12-22 Moritz Bunkus <moritz@bunkus.org>
* mkvextract: bug fix: Wrong display output and illegal memory

View File

@ -181,3 +181,13 @@ int find_aac_header(unsigned char *buf, int size, aac_header_t *aac_header,
return -1;
}
int get_aac_sampling_freq_idx(int sampling_freq) {
int i;
for (i = 0; i < 16; i++)
if (sampling_freq >= (aac_sampling_freq[i] - 1000))
return i;
return 0; // should never happen
}

View File

@ -37,5 +37,6 @@ int parse_aac_adif_header(unsigned char *buf, int size,
aac_header_t *aac_header);
int find_aac_header(unsigned char *buf, int size, aac_header_t *aac_header,
bool emphasis_present);
int get_aac_sampling_freq_idx(int sampling_freq);
#endif // __AACCOMMON_H

View File

@ -176,7 +176,7 @@ void qtmp4_reader_c::parse_headers() {
tmp = io->read_uint32_be();
mxverb(2, PFX " File type major brand: %c%c%c%c\n", BE2STR(tmp));
tmp = io->read_uint32_be();
mxverb(2, PFX " File type minor brand: %c%c%c%c\n", BE2STR(tmp));
mxverb(2, PFX " File type minor brand: 0x%08x\n", tmp);
for (i = 0; i < ((atom_size - 16) / 4); i++) {
tmp = io->read_uint32();
mxverb(2, PFX " File type compatible brands #%d: %.4s\n", i, &tmp);
@ -1083,6 +1083,12 @@ void qtmp4_reader_c::create_packetizer(int64_t tid) {
sbraac = true;
mxverb(2, ", SBR sample_rate_idx: %d", osrate_idx);
profile = AAC_PROFILE_SBR;
} else if (aac_sampling_freq[srate_idx] < 44100) {
sbraac = true;
profile = AAC_PROFILE_SBR;
osrate_idx =
get_aac_sampling_freq_idx(aac_sampling_freq[srate_idx] * 2);
mxverb(2, ", implicit SBR sample_rate_idx: %d", osrate_idx);
} else
sbraac = false;
mxverb(2, "\n");