forked from len0rd/rockbox
Now correctly skips ID3V1 tags to avoid gaps between tracks
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3365 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2d42f9e4e3
commit
cc136c5c60
1 changed files with 34 additions and 12 deletions
|
|
@ -1718,17 +1718,39 @@ static void mpeg_thread(void)
|
|||
DEBUGF("time: %d\n", t2 - t1);
|
||||
DEBUGF("R: %x\n", len);
|
||||
|
||||
/* Make sure that the write pointer is at a word
|
||||
boundary when we reach the end of the file */
|
||||
if (len < amount_to_read) {
|
||||
/* Now make sure that we don't feed the MAS with ID3V1
|
||||
data */
|
||||
if (len < amount_to_read)
|
||||
{
|
||||
int tagptr = mp3buf_write + len - 128;
|
||||
int i;
|
||||
char *tag = "TAG";
|
||||
int taglen = 128;
|
||||
|
||||
for(i = 0;i < 3;i++)
|
||||
{
|
||||
if(tagptr >= mp3buflen)
|
||||
tagptr -= mp3buflen;
|
||||
|
||||
if(mp3buf[tagptr] != tag[i])
|
||||
taglen = 0;
|
||||
|
||||
tagptr++;
|
||||
}
|
||||
|
||||
if(taglen)
|
||||
{
|
||||
/* Skip id3v1 tag */
|
||||
DEBUGF("Skipping ID3v1 tag\n");
|
||||
len -= id3tags[tag_read_idx]->id3.id3v1len;
|
||||
/* The very rare case when the buffer wrapped
|
||||
inside the tag must be taken care of */
|
||||
len -= taglen;
|
||||
|
||||
/* The very rare case when the entire tag
|
||||
wasn't read in this read() call must be
|
||||
taken care of */
|
||||
if(len < 0)
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
mp3buf_write += len;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue