#ifndef MEDIA_AUDIO_SOUNDS_WAV_AUDIO_HANDLER_H_
#define MEDIA_AUDIO_SOUNDS_WAV_AUDIO_HANDLER_H_
#include "base/strings/string_piece.h"
#include "base/time/time.h"
#include "media/audio/audio_parameters.h"
#include "media/base/media_export.h"
namespace media {
class AudioBus;
class MEDIA_EXPORT WavAudioHandler {
public:
explicit WavAudioHandler(const base::StringPiece& wav_data);
virtual ~WavAudioHandler();
bool AtEnd(size_t cursor) const;
bool CopyTo(AudioBus* bus, size_t cursor, size_t* bytes_written) const;
const AudioParameters& params() const { return params_; }
const base::StringPiece& data() const { return data_; }
private:
int ParseSubChunk(const base::StringPiece& data);
bool ParseFmtChunk(const base::StringPiece& data);
bool ParseDataChunk(const base::StringPiece& data);
base::StringPiece data_;
AudioParameters params_;
uint16 num_channels_;
uint32 sample_rate_;
uint16 bits_per_sample_;
};
}
#endif