Index: media/audio/sounds/wav_reader.h |
diff --git a/media/audio/sounds/wav_reader.h b/media/audio/sounds/wav_reader.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2b02871f841d9fd370e0c87d7f817468d114d851 |
--- /dev/null |
+++ b/media/audio/sounds/wav_reader.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_AUDIO_SOUNDS_WAV_READER_H_ |
+#define MEDIA_AUDIO_SOUNDS_WAV_READER_H_ |
+ |
+#include "base/compiler_specific.h" |
+#include "media/audio/sounds/wav_parser.h" |
+ |
+namespace media { |
+ |
+class AudioBus; |
+ |
+class MEDIA_EXPORT WavReader { |
+ public: |
+ WavReader() {} |
+ virtual ~WavReader() {} |
+ |
+ // Returns true when cursor points to the end of the track. |
+ virtual bool AtEnd(size_t cursor) = 0; |
+ |
+ // Copies the audio data to |bus| starting from the |cursor| and in |
+ // the case of success stores the number of written bytes in |
+ // |bytes_written|. |bytes_written| should not be NULL. |
+ virtual bool CopyTo(AudioBus* bus, size_t cursor, size_t* bytes_written) = 0; |
+}; |
+ |
+class MEDIA_EXPORT WavReaderImpl : public WavReader { |
+ public: |
+ explicit WavReaderImpl(const WavParser& wav_parser); |
+ virtual ~WavReaderImpl(); |
+ |
+ // WavReader implementation: |
+ virtual bool AtEnd(size_t cursor) OVERRIDE; |
+ virtual bool CopyTo(AudioBus* bus, |
+ size_t cursor, |
+ size_t* bytes_written) OVERRIDE; |
+ |
+ private: |
+ WavParser wav_parser_; |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_AUDIO_SOUNDS_WAV_READER_H_ |