tests: AAC demuxing/decoding

This commit is contained in:
Alexander Kojevnikov 2013-03-27 09:00:21 -07:00
parent 7627ecbb7a
commit b5fcfface1
4 changed files with 7 additions and 1 deletions

View File

@ -134,9 +134,12 @@ std::unique_ptr<AudioFile> Audio::open(const std::string& file_name)
bits_per_sample = codec_context->bits_per_raw_sample;
if (!bits_per_sample) {
// APE uses bpcs, FLAC uses bprs.
// TODO: old comment, verify
bits_per_sample = codec_context->bits_per_coded_sample;
}
if (codec_context->codec_id == AV_CODEC_ID_AAC) {
// AAC decoder sets both bps and bitrate.
bits_per_sample = 0;
}
if (bits_per_sample) {
bit_rate = 0;
}

Binary file not shown.

View File

@ -50,6 +50,7 @@ static void test_file(const std::string& name, const FileInfo& info)
void test_audio_info()
{
const double MP3_T = 5.0 * 1152 / 44100; // 5 frames * duration per mp3 frame
const double M4A_T = (10240 + 628) / 2.0 / 44100;
std::map<std::string, FileInfo> files = {
{"1ch-96000Hz-24bps.flac", {"FLAC", 0, 96000, 24, 1, 0.1}},
@ -63,6 +64,7 @@ void test_audio_info()
{"2ch-44100Hz-320cbr.mp3", {"MP3", 320000, 44100, 0, 2, MP3_T}},
{"2ch-44100Hz-V0.mp3", {"MP3", 201329, 44100, 0, 2, MP3_T}},
{"2ch-44100Hz-V2.mp3", {"MP3", 150124, 44100, 0, 2, MP3_T}},
{"2ch-44100Hz-q100.m4a", {"AAC", 159649, 44100, 0, 2, M4A_T}},
{"2ch-44100Hz-q5.ogg", {"Vorbis", 160000, 44100, 0, 2, 0.1}},
};
for (const auto& item : files) {

View File

@ -58,6 +58,7 @@ void test_audio_read()
{"2ch-44100Hz-320cbr.mp3", 2 * 1152 * 4 + 94},
{"2ch-44100Hz-V0.mp3", 2 * 1152 * 4 + 94},
{"2ch-44100Hz-V2.mp3", 2 * 1152 * 4 + 94},
{"2ch-44100Hz-q100.m4a", 10240},
{"2ch-44100Hz-q5.ogg", 2 * 1024 * 4 + 1152},
};
for (const auto& item : files) {