From 5434fe510b3f8f6a20d3fac8732e732852e0b2d1 Mon Sep 17 00:00:00 2001 From: vspader Date: Sun, 17 Feb 2008 19:59:01 +0000 Subject: [PATCH] Fixed mp3 bitrate calculation. --- Plugins/MAD/MADDecoder.h | 2 +- Plugins/MAD/MADDecoder.m | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Plugins/MAD/MADDecoder.h b/Plugins/MAD/MADDecoder.h index 8f7c689ed..af41d8952 100644 --- a/Plugins/MAD/MADDecoder.h +++ b/Plugins/MAD/MADDecoder.h @@ -23,7 +23,7 @@ unsigned char _inputBuffer[INPUT_BUFFER_SIZE+MAD_BUFFER_GUARD]; unsigned char *_outputBuffer; int _outputFrames; - int _fileSize; + long _fileSize; id _source; diff --git a/Plugins/MAD/MADDecoder.m b/Plugins/MAD/MADDecoder.m index bab58e715..22626efbc 100644 --- a/Plugins/MAD/MADDecoder.m +++ b/Plugins/MAD/MADDecoder.m @@ -271,8 +271,7 @@ } } - //Need to make sure this is correct - bitrate = (_fileSize - id3_length) / ((sampleRate/1000.0)/totalFrames); + bitrate = ((_fileSize - id3_length)/128) * (sampleRate/totalFrames); mad_frame_finish (&frame); mad_stream_finish (&stream);