From 579a566b44f016c1e32ea34d5e7a846178d99517 Mon Sep 17 00:00:00 2001 From: "kyle.hu.gz" Date: Fri, 19 Feb 2010 15:04:35 +0000 Subject: [PATCH] stm32_radio: Updated the VBR average bitrate calculation. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@425 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- bsp/stm32_radio/mp3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bsp/stm32_radio/mp3.c b/bsp/stm32_radio/mp3.c index 16be5c2d68..dc1bc2644b 100644 --- a/bsp/stm32_radio/mp3.c +++ b/bsp/stm32_radio/mp3.c @@ -410,6 +410,7 @@ void mp3_get_info(const char* filename, struct tag_info* info) { rt_uint32_t frames = ((rt_uint32_t) mp3_fd_buffer[p + 8] << 24) | ((rt_uint32_t) mp3_fd_buffer[p + 9] << 16) | ((rt_uint32_t) mp3_fd_buffer[p + 10] << 8) | (rt_uint32_t) mp3_fd_buffer[p + 11]; info->duration = frames * samples_per_frame / frame_info.samprate; + info->bit_rate = lseek(fd, 0, SEEK_END) * 8 / info->duration; } } /* @@ -420,8 +421,8 @@ void mp3_get_info(const char* filename, struct tag_info* info) { // CBR info->duration = lseek(fd, 0, SEEK_END) / (frame_info.bitrate / 8); /* second */ + info->bit_rate = frame_info.bitrate; } - info->bit_rate = frame_info.bitrate; info->sampling = frame_info.samprate; }