OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BUFFER_H_ | 5 #ifndef MEDIA_BASE_AUDIO_BUFFER_H_ |
6 #define MEDIA_BASE_AUDIO_BUFFER_H_ | 6 #define MEDIA_BASE_AUDIO_BUFFER_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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Trim an AudioBuffer by removing |frames_to_trim| frames from the start. | 80 // Trim an AudioBuffer by removing |frames_to_trim| frames from the start. |
81 // Timestamp and duration are adjusted to reflect the fewer frames. | 81 // Timestamp and duration are adjusted to reflect the fewer frames. |
82 // Note that repeated calls to TrimStart() may result in timestamp() and | 82 // Note that repeated calls to TrimStart() may result in timestamp() and |
83 // duration() being off by a few microseconds due to rounding issues. | 83 // duration() being off by a few microseconds due to rounding issues. |
84 void TrimStart(int frames_to_trim); | 84 void TrimStart(int frames_to_trim); |
85 | 85 |
86 // Trim an AudioBuffer by removing |frames_to_trim| frames from the end. | 86 // Trim an AudioBuffer by removing |frames_to_trim| frames from the end. |
87 // Duration is adjusted to reflect the fewer frames. | 87 // Duration is adjusted to reflect the fewer frames. |
88 void TrimEnd(int frames_to_trim); | 88 void TrimEnd(int frames_to_trim); |
89 | 89 |
| 90 // Trim an AudioBuffer by removing |end - start| frames starting at |start| |
| 91 // and ending at |end|; i.e. exclusive. Even if start is zero, timestamp() is |
| 92 // not adjusted, only duration(). |
| 93 void TrimRange(int start, int end); |
| 94 |
90 // Return the number of channels. | 95 // Return the number of channels. |
91 int channel_count() const { return channel_count_; } | 96 int channel_count() const { return channel_count_; } |
92 | 97 |
93 // Return the number of frames held. | 98 // Return the number of frames held. |
94 int frame_count() const { return adjusted_frame_count_; } | 99 int frame_count() const { return adjusted_frame_count_; } |
95 | 100 |
96 // Return the sample rate. | 101 // Return the sample rate. |
97 int sample_rate() const { return sample_rate_; } | 102 int sample_rate() const { return sample_rate_; } |
98 | 103 |
99 // Return the channel layout. | 104 // Return the channel layout. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 156 |
152 // For planar data, points to each channels data. | 157 // For planar data, points to each channels data. |
153 std::vector<uint8*> channel_data_; | 158 std::vector<uint8*> channel_data_; |
154 | 159 |
155 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); | 160 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); |
156 }; | 161 }; |
157 | 162 |
158 } // namespace media | 163 } // namespace media |
159 | 164 |
160 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ | 165 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ |
OLD | NEW |