mirror of
https://github.com/taglib/taglib.git
synced 2025-07-19 05:24:25 -04:00
Merge pull request #980 from ufleisch/ufleisch/wav-float-without-fact
Calculate bitrate for IEEE Float WAV files without fact chunk (#959)
This commit is contained in:
@ -35,7 +35,8 @@ namespace
|
||||
enum WaveFormat
|
||||
{
|
||||
FORMAT_UNKNOWN = 0x0000,
|
||||
FORMAT_PCM = 0x0001
|
||||
FORMAT_PCM = 0x0001,
|
||||
FORMAT_IEEE_FLOAT = 0x0003
|
||||
};
|
||||
}
|
||||
|
||||
@ -183,7 +184,7 @@ void RIFF::WAV::Properties::read(File *file)
|
||||
}
|
||||
|
||||
d->format = data.toShort(0, false);
|
||||
if(d->format != FORMAT_PCM && totalSamples == 0) {
|
||||
if(d->format != FORMAT_PCM && d->format != FORMAT_IEEE_FLOAT && totalSamples == 0) {
|
||||
debug("RIFF::WAV::Properties::read() - Non-PCM format, but 'fact' chunk not found.");
|
||||
return;
|
||||
}
|
||||
@ -192,7 +193,7 @@ void RIFF::WAV::Properties::read(File *file)
|
||||
d->sampleRate = data.toUInt(4, false);
|
||||
d->bitsPerSample = data.toShort(14, false);
|
||||
|
||||
if(d->format != FORMAT_PCM)
|
||||
if(d->format != FORMAT_PCM && !(d->format == FORMAT_IEEE_FLOAT && totalSamples == 0))
|
||||
d->sampleFrames = totalSamples;
|
||||
else if(d->channels > 0 && d->bitsPerSample > 0)
|
||||
d->sampleFrames = streamLength / (d->channels * ((d->bitsPerSample + 7) / 8));
|
||||
|
Reference in New Issue
Block a user