spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit b5fcfface151f778f296184522940af379a3ecf3
parent 7627ecbb7a2d16fba7b51e72e397f5c86755eb3a
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Wed, 27 Mar 2013 09:00:21 -0700

tests: AAC demuxing/decoding

Diffstat:
Msrc/spek-audio.cc | 5++++-
Atests/samples/2ch-44100Hz-q100.m4a | 0
Mtests/test-audio-info.cc | 2++
Mtests/test-audio-read.cc | 1+
4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/spek-audio.cc b/src/spek-audio.cc @@ -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; } diff --git a/tests/samples/2ch-44100Hz-q100.m4a b/tests/samples/2ch-44100Hz-q100.m4a Binary files differ. diff --git a/tests/test-audio-info.cc b/tests/test-audio-info.cc @@ -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) { diff --git a/tests/test-audio-read.cc b/tests/test-audio-read.cc @@ -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) {