]> granicus.if.org Git - taglib/commitdiff
WAV: Avoid using a magic number.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Tue, 30 Jun 2015 06:59:01 +0000 (15:59 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Tue, 30 Jun 2015 06:59:01 +0000 (15:59 +0900)
taglib/riff/wav/wavproperties.cpp
taglib/riff/wav/wavproperties.h

index 48f068c757560e03c273f31311e73ef5d3e5bee4..39f0dddcabbfdf9a901c41d5fa7d24f26ac216ae 100644 (file)
 
 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;
   }
index ab1b9e70100b9db46da1ae1a44afb610ac4e7062..1fd6a13699e4cab7d9b17b1c7169c91064e3bf34 100644 (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;