Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.2

Request #6784 Problem when calculating the duration of songs
Submitted: 2006-02-14 21:11 UTC
From: nozimica Assigned: alexmerz
Status: Analyzed Package: MP3_ID (version 1.2.0)
PHP Version: 4.3.10 OS: Any
Roadmaps: (Not assigned)    
Subscription  


 [2006-02-14 21:11 UTC] nozimica
Description: ------------ I noticed that when calculating the duration of a song, is not considerated that some bytes (I think that about 128) are dedicated to store the info of that song. One may think that amount of bytes are not sufficient to give trouble, but in specific cases it does. It happened to me, so I reviewed the code of the class, and found this issue. The song I tested was 9.216.000 bytes long. Bitrate 192kbps, not variable. According to xmms, has 383 seconds, but according to MP3_ID, it should have 384... in the line 928 of Id.php, where are the files not encoded in VBR, and with bitrate != 0, we have: $s = ((8*filesize($this->file))/1000) / $this->bitrate; this, applied to the file I'm talking about, is: $s = 384; in the line 932 whe round the number above, but it is already an integer: $this->lengths = (int)$s; in the line 940 whe have: $this->musicsize = ceil($this->lengths * $this->bitrate * 1000 / 8); instance variable supposed to be the the size of the file, without tag overhead, but with this formula, gives us: $this->musicsize = 9216000 that is to say, if the file has no info tags at all!! This is because (according to what I suppose), when the size of the file can be divided by ($bitrate * 1000), this problem arises. Please let me know if I am right, and if so, how I should help... :D And my english is not as good as I should want, but I try!!

Comments