spek

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

commit a46d2e89517c6e91bea3697acb50f757ce9cd242
parent 406b4bf4a416a956a59752c2fcd854383c84461c
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Mon, 25 Feb 2013 21:07:03 -0800

Don't set bit rate for lossless streams

Diffstat:
Msrc/spek-audio.cc | 3+++
Atests/samples/2ch-44100Hz-16bps.wav | 0
Mtests/test-audio-info.cc | 1+
3 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/spek-audio.cc b/src/spek-audio.cc @@ -141,6 +141,9 @@ std::unique_ptr<AudioFile> Audio::open(const std::string& file_name) // TODO: old comment, verify bits_per_sample = codec_context->bits_per_coded_sample; } + if (bits_per_sample) { + bit_rate = 0; + } channels = codec_context->channels; if (stream->duration != AV_NOPTS_VALUE) { diff --git a/tests/samples/2ch-44100Hz-16bps.wav b/tests/samples/2ch-44100Hz-16bps.wav Binary files differ. diff --git a/tests/test-audio-info.cc b/tests/test-audio-info.cc @@ -50,6 +50,7 @@ void test_audio_info() std::map<std::string, FileInfo> files = { { "1ch-96000Hz-24bps.flac", {"FLAC (Free Lossless Audio Codec)", 0, 96000, 24, 1, 0.1} }, { "2ch-48000Hz-16bps.flac", {"FLAC (Free Lossless Audio Codec)", 0, 48000, 16, 2, 0.1} }, + { "2ch-44100Hz-16bps.wav", {"PCM signed 16-bit little-endian", 0, 44100, 16, 2, 0.1} }, }; for (const auto& item : files) { run([&] () { test_file(item.first, item.second); }, "audio info: " + item.first);