forked from len0rd/rockbox
Tweak id3v1 tag stripping, better code, same functionality. Ensure correct buf_idx on track when rebuffer&seek.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9653 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2f11d60dcd
commit
2f4edabfce
1 changed files with 20 additions and 27 deletions
|
@ -892,7 +892,7 @@ static void rebuffer_and_seek(size_t newpos)
|
||||||
|
|
||||||
/* Clear codec buffer. */
|
/* Clear codec buffer. */
|
||||||
filebufused = 0;
|
filebufused = 0;
|
||||||
buf_ridx = buf_widx = 0;
|
buf_ridx = buf_widx = cur_ti->buf_idx + newpos;
|
||||||
|
|
||||||
/* Write to the now current track */
|
/* Write to the now current track */
|
||||||
track_widx = track_ridx;
|
track_widx = track_ridx;
|
||||||
|
@ -1113,40 +1113,33 @@ void strip_id3v1_tag(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static const unsigned char tag[] = "TAG";
|
static const unsigned char tag[] = "TAG";
|
||||||
size_t tagptr;
|
size_t tag_idx;
|
||||||
bool found = true;
|
size_t cur_idx;
|
||||||
|
|
||||||
if (filebufused >= 128)
|
tag_idx = buf_widx;
|
||||||
|
if (tag_idx < 128)
|
||||||
|
tag_idx += filebuflen;
|
||||||
|
tag_idx -= 128;
|
||||||
|
|
||||||
|
if (filebufused > 128 && tag_idx > buf_ridx)
|
||||||
{
|
{
|
||||||
tagptr = buf_widx;
|
cur_idx = tag_idx;
|
||||||
if (tagptr < 128)
|
|
||||||
tagptr += filebuflen;
|
|
||||||
tagptr -= 128;
|
|
||||||
|
|
||||||
for(i = 0;i < 3;i++)
|
for(i = 0;i < 3;i++)
|
||||||
{
|
{
|
||||||
if(filebuf[tagptr] != tag[i])
|
if(filebuf[cur_idx] != tag[i])
|
||||||
{
|
return;
|
||||||
found = false;
|
|
||||||
break;
|
if(++cur_idx >= filebuflen)
|
||||||
|
cur_idx -= filebuflen;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(++tagptr >= filebuflen)
|
|
||||||
tagptr -= filebuflen;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(found)
|
|
||||||
{
|
|
||||||
/* Skip id3v1 tag */
|
/* Skip id3v1 tag */
|
||||||
logf("Skipping ID3v1 tag");
|
logf("Skipping ID3v1 tag");
|
||||||
if (buf_widx < 128)
|
buf_widx = tag_idx;
|
||||||
buf_widx += filebuflen;
|
|
||||||
buf_widx -= 128;
|
|
||||||
tracks[track_widx].available -= 128;
|
tracks[track_widx].available -= 128;
|
||||||
tracks[track_widx].filesize -= 128;
|
tracks[track_widx].filesize -= 128;
|
||||||
filebufused -= 128;
|
filebufused -= 128;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void audio_read_file(void)
|
static void audio_read_file(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue