mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
Improvements for vbrfix plugin:
* Properly account for ID3v1 tags * Play time computation fixes * Add speech feedback Patch by Igor Poretsky Change-Id: Ia6df8fb171882a88527cfa9d3b76b705f09becdd
This commit is contained in:
parent
c46147c6b2
commit
22c6326974
6 changed files with 91 additions and 23 deletions
|
|
@ -71,7 +71,9 @@ static int getsonglength(int fd, struct mp3entry *entry)
|
|||
if(bytecount < 0)
|
||||
return -1;
|
||||
|
||||
bytecount += entry->id3v2len;
|
||||
/* Subtract the meta information from the file size to get
|
||||
the true size of the MP3 stream */
|
||||
entry->filesize -= entry->id3v1len + entry->id3v2len;
|
||||
|
||||
/* Validate byte count, in case the file has been edited without
|
||||
* updating the header.
|
||||
|
|
@ -99,6 +101,9 @@ static int getsonglength(int fd, struct mp3entry *entry)
|
|||
}
|
||||
}
|
||||
|
||||
entry->filesize -= bytecount;
|
||||
bytecount += entry->id3v2len;
|
||||
|
||||
entry->bitrate = info.bitrate;
|
||||
entry->frequency = info.frequency;
|
||||
entry->layer = info.layer;
|
||||
|
|
@ -127,7 +132,7 @@ static int getsonglength(int fd, struct mp3entry *entry)
|
|||
if (info.bitrate < 8)
|
||||
filetime = 0;
|
||||
else
|
||||
filetime = (entry->filesize - bytecount) / (info.bitrate / 8);
|
||||
filetime = entry->filesize / (info.bitrate >> 3);
|
||||
/* bitrate is in kbps so this delivers milliseconds. Doing bitrate / 8
|
||||
* instead of filesize * 8 is exact, because mpeg audio bitrates are
|
||||
* always multiples of 8, and it avoids overflows. */
|
||||
|
|
@ -163,6 +168,7 @@ bool get_mp3_metadata(int fd, struct mp3entry *entry)
|
|||
{
|
||||
entry->title = NULL;
|
||||
entry->filesize = filesize(fd);
|
||||
entry->id3v1len = getid3v1len(fd);
|
||||
entry->id3v2len = getid3v2len(fd);
|
||||
entry->tracknum = 0;
|
||||
entry->discnum = 0;
|
||||
|
|
@ -174,10 +180,6 @@ bool get_mp3_metadata(int fd, struct mp3entry *entry)
|
|||
return false;
|
||||
entry->length = len;
|
||||
|
||||
/* Subtract the meta information from the file size to get
|
||||
the true size of the MP3 stream */
|
||||
entry->filesize -= entry->first_frame_offset;
|
||||
|
||||
/* only seek to end of file if no id3v2 tags were found */
|
||||
if (!entry->id3v2len) {
|
||||
setid3v1title(fd, entry);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue