Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / common_audio / wav_header.h
index f9ed8a5..37f78a6 100644 (file)
 #ifndef WEBRTC_COMMON_AUDIO_WAV_HEADER_H_
 #define WEBRTC_COMMON_AUDIO_WAV_HEADER_H_
 
+#include <stddef.h>
 #include <stdint.h>
 
 namespace webrtc {
 
-static const int kWavHeaderSize = 44;
+static const size_t kWavHeaderSize = 44;
 
 enum WavFormat {
   kWavFormatPcm   = 1,  // PCM, each sample of size bytes_per_sample
@@ -33,7 +34,7 @@ bool CheckWavParameters(int num_channels,
 // Write a kWavHeaderSize bytes long WAV header to buf. The payload that
 // follows the header is supposed to have the specified number of interleaved
 // channels and contain the specified total number of samples of the specified
-// type.
+// type. CHECKs the input parameters for validity.
 void WriteWavHeader(uint8_t* buf,
                     int num_channels,
                     int sample_rate,
@@ -41,6 +42,15 @@ void WriteWavHeader(uint8_t* buf,
                     int bytes_per_sample,
                     uint32_t num_samples);
 
+// Read a kWavHeaderSize bytes long WAV header from buf and parse the values
+// into the provided output parameters. Returns false if the header is invalid.
+bool ReadWavHeader(const uint8_t* buf,
+                   int* num_channels,
+                   int* sample_rate,
+                   WavFormat* format,
+                   int* bytes_per_sample,
+                   uint32_t* num_samples);
+
 }  // namespace webrtc
 
 #endif  // WEBRTC_COMMON_AUDIO_WAV_HEADER_H_