Chromium Code Reviews| Index: media/audio/sounds/wav_parser.h |
| diff --git a/media/audio/sounds/wav_audio_handler.h b/media/audio/sounds/wav_parser.h |
| similarity index 63% |
| rename from media/audio/sounds/wav_audio_handler.h |
| rename to media/audio/sounds/wav_parser.h |
| index a2c3e02365002133fdd84bd01451ef0c421d4887..5ce863eeeea5d808a92c52b70a3d6487955d0e48 100644 |
| --- a/media/audio/sounds/wav_audio_handler.h |
| +++ b/media/audio/sounds/wav_parser.h |
| @@ -2,36 +2,30 @@ |
| // 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_AUDIO_HANDLER_H_ |
| -#define MEDIA_AUDIO_SOUNDS_WAV_AUDIO_HANDLER_H_ |
| +#ifndef MEDIA_AUDIO_SOUNDS_WAV_PARSER_H_ |
| +#define MEDIA_AUDIO_SOUNDS_WAV_PARSER_H_ |
| #include "base/strings/string_piece.h" |
| +#include "base/time/time.h" |
| #include "media/base/media_export.h" |
| namespace media { |
| -class AudioBus; |
| - |
| // This class provides the input from wav file format. See |
| // https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ |
| -class MEDIA_EXPORT WavAudioHandler { |
| +class MEDIA_EXPORT WavParser { |
| public: |
| - explicit WavAudioHandler(const base::StringPiece& wav_data); |
| - virtual ~WavAudioHandler(); |
| - |
| - // Returns true when cursor points to the end of the track. |
| - bool AtEnd(size_t cursor) const; |
| - |
| - // 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. |
| - bool CopyTo(AudioBus* bus, size_t cursor, size_t* bytes_written) const; |
| + explicit WavParser(const base::StringPiece& wav_data); |
| + virtual ~WavParser(); |
| - int size() const { return data_.size(); } |
| uint16 num_channels() const { return num_channels_; } |
|
DaleCurtis
2013/12/17 19:28:52
At this point it'd just be easier to expose an aud
ygorshenin1
2013/12/18 14:33:12
Done.
|
| uint32 sample_rate() const { return sample_rate_; } |
| uint32 byte_rate() const { return byte_rate_; } |
| uint16 bits_per_sample() const { return bits_per_sample_; } |
| + int bytes_per_sample() const { return bytes_per_sample_; } |
| + int bytes_per_frame() const { return bytes_per_frame_; } |
| + const base::TimeDelta& duration() const { return duration_; } |
| + const base::StringPiece& data() const { return data_; } |
| private: |
| // Parses a chunk of wav format data. Returns the length of the chunk. |
| @@ -52,8 +46,9 @@ class MEDIA_EXPORT WavAudioHandler { |
| uint16 bits_per_sample_; |
| int bytes_per_sample_; |
| int bytes_per_frame_; |
| + base::TimeDelta duration_; |
| }; |
| } // namespace media |
| -#endif // MEDIA_AUDIO_SOUNDS_WAV_AUDIO_HANDLER_H_ |
| +#endif // MEDIA_AUDIO_SOUNDS_WAV_PARSER_H_ |