forked from len0rd/rockbox
Commit FS#7831. Corrects our flac decoder to not reject files that have samplecount set to 0.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27244 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2cdf332f01
commit
33df565584
1 changed files with 13 additions and 6 deletions
|
@ -86,17 +86,24 @@ bool get_flac_metadata(int fd, struct mp3entry* id3)
|
||||||
|
|
||||||
/* totalsamples is a 36-bit field, but we assume <= 32 bits are used */
|
/* totalsamples is a 36-bit field, but we assume <= 32 bits are used */
|
||||||
totalsamples = get_long_be(&buf[14]);
|
totalsamples = get_long_be(&buf[14]);
|
||||||
|
|
||||||
/* Calculate track length (in ms) and estimate the bitrate (in kbit/s) */
|
if(totalsamples > 0)
|
||||||
id3->length = ((int64_t) totalsamples * 1000) / id3->frequency;
|
{
|
||||||
|
/* Calculate track length (in ms) and estimate the bitrate (in kbit/s) */
|
||||||
if (id3->length <= 0)
|
id3->length = ((int64_t) totalsamples * 1000) / id3->frequency;
|
||||||
|
id3->bitrate = (id3->filesize * 8) / id3->length;
|
||||||
|
}
|
||||||
|
else if (totalsamples == 0)
|
||||||
|
{
|
||||||
|
id3->length = 0;
|
||||||
|
id3->bitrate = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
logf("flac length invalid!");
|
logf("flac length invalid!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
id3->bitrate = ((int64_t) id3->filesize * 8) / id3->length;
|
|
||||||
}
|
}
|
||||||
else if (type == 4) /* 4 is the VORBIS_COMMENT block */
|
else if (type == 4) /* 4 is the VORBIS_COMMENT block */
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue