From d2bb534dddc0a349d1401ea46cb80cfdc3fbfe12 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Sun, 4 Jun 2006 04:45:47 +0000 Subject: [PATCH] Better estimate of bitrate on mp3 files --- src/scan-mp3.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/scan-mp3.c b/src/scan-mp3.c index cf71c13f..d498dada 100644 --- a/src/scan-mp3.c +++ b/src/scan-mp3.c @@ -942,6 +942,7 @@ int scan_mp3_get_mp3fileinfo(char *file, MP3FILE *pmp3) { buffer[index+fi.xing_offset+4+10] << 8 | buffer[index+fi.xing_offset+4+11]; } + fi.bitrate = 0; } if((conf_get_int("general","scan_type",0) != 0) && @@ -975,6 +976,10 @@ int scan_mp3_get_mp3fileinfo(char *file, MP3FILE *pmp3) { (double) fi.samplerate); } + /* back-calculate bitrate from duration */ + pmp3->bitrate = ((pmp3->file_size / 1000) * 8) / + (pmp3->song_length / 1000); + } DPRINTF(E_DBG,L_SCAN," Song Length: %d\n",pmp3->song_length);