OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_AUDIO_BUS_H_ | 5 #ifndef MEDIA_BASE_AUDIO_BUS_H_ |
6 #define MEDIA_BASE_AUDIO_BUS_H_ | 6 #define MEDIA_BASE_AUDIO_BUS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/aligned_memory.h" | 10 #include "base/memory/aligned_memory.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 int channels() const { return channel_data_.size(); } | 86 int channels() const { return channel_data_.size(); } |
87 int frames() const { return frames_; } | 87 int frames() const { return frames_; } |
88 void set_frames(int frames); | 88 void set_frames(int frames); |
89 | 89 |
90 // Helper method for zeroing out all channels of audio data. | 90 // Helper method for zeroing out all channels of audio data. |
91 void Zero(); | 91 void Zero(); |
92 void ZeroFrames(int frames); | 92 void ZeroFrames(int frames); |
93 void ZeroFramesPartial(int start_frame, int frames); | 93 void ZeroFramesPartial(int start_frame, int frames); |
94 | 94 |
95 private: | 95 private: |
96 friend class scoped_ptr<AudioBus>; | 96 friend struct base::DefaultDeleter<AudioBus>; |
97 ~AudioBus(); | 97 ~AudioBus(); |
98 | 98 |
99 AudioBus(int channels, int frames); | 99 AudioBus(int channels, int frames); |
100 AudioBus(int channels, int frames, float* data); | 100 AudioBus(int channels, int frames, float* data); |
101 AudioBus(int frames, const std::vector<float*>& channel_data); | 101 AudioBus(int frames, const std::vector<float*>& channel_data); |
102 explicit AudioBus(int channels); | 102 explicit AudioBus(int channels); |
103 | 103 |
104 // Helper method for building |channel_data_| from a block of memory. |data| | 104 // Helper method for building |channel_data_| from a block of memory. |data| |
105 // must be at least BlockSize() bytes in size. | 105 // must be at least BlockSize() bytes in size. |
106 void BuildChannelData(int channels, int aligned_frame, float* data); | 106 void BuildChannelData(int channels, int aligned_frame, float* data); |
107 | 107 |
108 // Contiguous block of channel memory. | 108 // Contiguous block of channel memory. |
109 scoped_ptr_malloc<float, base::ScopedPtrAlignedFree> data_; | 109 scoped_ptr_malloc<float, base::ScopedPtrAlignedFree> data_; |
110 | 110 |
111 std::vector<float*> channel_data_; | 111 std::vector<float*> channel_data_; |
112 int frames_; | 112 int frames_; |
113 | 113 |
114 // Protect SetChannelData() and set_frames() for use by CreateWrapper(). | 114 // Protect SetChannelData() and set_frames() for use by CreateWrapper(). |
115 bool can_set_channel_data_; | 115 bool can_set_channel_data_; |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(AudioBus); | 117 DISALLOW_COPY_AND_ASSIGN(AudioBus); |
118 }; | 118 }; |
119 | 119 |
120 } // namespace media | 120 } // namespace media |
121 | 121 |
122 #endif // MEDIA_BASE_AUDIO_BUS_H_ | 122 #endif // MEDIA_BASE_AUDIO_BUS_H_ |
OLD | NEW |