WAV: Avoid using a magic number.

This commit is contained in:
Tsuda Kageyu 2015-06-30 15:59:01 +09:00
parent 9c8e36d3be
commit 801c9db810
2 changed files with 15 additions and 3 deletions

View File

@ -29,6 +29,16 @@
using namespace TagLib;
namespace
{
// Quoted from RFC 2361.
enum WaveFormat
{
FORMAT_UNKNOWN = 0x0000,
FORMAT_PCM = 0x0001
};
}
class RIFF::WAV::Properties::PropertiesPrivate
{
public:
@ -173,7 +183,7 @@ void RIFF::WAV::Properties::read(File *file)
}
d->format = data.toShort(0, false);
if(d->format != 1 && totalSamples == 0) {
if(d->format != FORMAT_PCM && totalSamples == 0) {
debug("RIFF::WAV::Properties::read() - Non-PCM format, but 'fact' chunk not found.");
return;
}

View File

@ -139,9 +139,11 @@ namespace TagLib {
/*!
* Returns the format ID of the file.
* 0 for unknown, 1 for PCM, 2 for ADPCM, 3 for 32/64-bit IEEE754, and so forth.
* 0 for unknown, 1 for PCM, 2 for ADPCM, 3 for 32/64-bit IEEE754, and
* so forth.
*
* \note For further information, refer to RFC 2361.
* \note For further information, refer to the WAVE Form Registration
* Numbers in RFC 2361.
*/
int format() const;