1
0
Fork 0
forked from len0rd/rockbox

Better skipping of leading garbage. Fixes bug #625868.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2752 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-10-27 23:07:26 +00:00
parent da407264c2
commit c41322c591
3 changed files with 9 additions and 8 deletions

View file

@ -713,11 +713,9 @@ static int getsonglength(int fd, struct mp3entry *entry)
filetime = entry->filesize/bpf*tpf;
}
DEBUGF("Old ID3V2 length: %x\n", entry->id3v2len);
/* Adjust the tag length only if there is a tag present */
if(entry->id3v2len || header_found)
entry->id3v2len = bytecount;
DEBUGF("New ID3V2 length: %x\n", bytecount);
/* Update the seek point for the first playable frame */
entry->first_frame_offset = bytecount;
DEBUGF("First frame is at %x\n", entry->first_frame_offset);
return filetime;
}

View file

@ -33,6 +33,9 @@ struct mp3entry {
unsigned int frequency;
unsigned int id3v2len;
unsigned int id3v1len;
unsigned int first_frame_offset; /* Byte offset to first real MP3 frame.
Used for skipping leading garbage to
avoid gaps between tracks. */
unsigned int filesize; /* in bytes */
unsigned int length; /* song length */
unsigned int elapsed; /* ms played */

View file

@ -775,7 +775,7 @@ static int new_file(int steps)
{
/* skip past id3v2 tag */
lseek(mpeg_file,
id3tags[new_tag_idx]->id3.id3v2len,
id3tags[new_tag_idx]->id3.first_frame_offset,
SEEK_SET);
id3tags[new_tag_idx]->id3.index = steps;
id3tags[new_tag_idx]->id3.offset = 0;
@ -967,7 +967,7 @@ static void mpeg_thread(void)
else {
/* skip past id3v2 tag */
lseek(mpeg_file,
id3tags[tag_read_idx]->id3.id3v2len,
id3tags[tag_read_idx]->id3.first_frame_offset,
SEEK_SET);
}