forked from len0rd/rockbox
Improve handling of RVA2 (replaygain) frames.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16262 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
14995ffee3
commit
fdac6417c9
1 changed files with 10 additions and 4 deletions
|
@ -423,7 +423,8 @@ static int parseuser( struct mp3entry* entry, char* tag, int bufferpos )
|
||||||
static int parserva2( struct mp3entry* entry, char* tag, int bufferpos )
|
static int parserva2( struct mp3entry* entry, char* tag, int bufferpos )
|
||||||
{
|
{
|
||||||
int desc_len = strlen(tag);
|
int desc_len = strlen(tag);
|
||||||
int end_pos = tag - entry->id3v2buf + desc_len + 5;
|
int start_pos = tag - entry->id3v2buf;
|
||||||
|
int end_pos = start_pos + desc_len + 5;
|
||||||
int value_len = 0;
|
int value_len = 0;
|
||||||
unsigned char* value = tag + desc_len + 1;
|
unsigned char* value = tag + desc_len + 1;
|
||||||
|
|
||||||
|
@ -471,14 +472,19 @@ static int parserva2( struct mp3entry* entry, char* tag, int bufferpos )
|
||||||
if (strcasecmp(tag, "album") == 0) {
|
if (strcasecmp(tag, "album") == 0) {
|
||||||
album = true;
|
album = true;
|
||||||
} else if (strcasecmp(tag, "track") != 0) {
|
} else if (strcasecmp(tag, "track") != 0) {
|
||||||
gain = 0;
|
/* Only accept non-track values if we don't have any previous
|
||||||
|
* value.
|
||||||
|
*/
|
||||||
|
if (entry->track_gain != 0) {
|
||||||
|
return start_pos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
value_len = parse_replaygain_int(album, gain, peak * 2, entry,
|
value_len = parse_replaygain_int(album, gain, peak * 2, entry,
|
||||||
tag, sizeof(entry->id3v2buf) - (tag - entry->id3v2buf));
|
tag, sizeof(entry->id3v2buf) - start_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tag - entry->id3v2buf + value_len;
|
return start_pos + value_len;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue