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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // Trim an AudioBuffer by removing |frames_to_trim| frames from the start. | 78 // Trim an AudioBuffer by removing |frames_to_trim| frames from the start. |
79 // Timestamp and duration are adjusted to reflect the fewer frames. | 79 // Timestamp and duration are adjusted to reflect the fewer frames. |
80 // Note that repeated calls to TrimStart() may result in timestamp() and | 80 // Note that repeated calls to TrimStart() may result in timestamp() and |
81 // duration() being off by a few microseconds due to rounding issues. | 81 // duration() being off by a few microseconds due to rounding issues. |
82 void TrimStart(int frames_to_trim); | 82 void TrimStart(int frames_to_trim); |
83 | 83 |
84 // Trim an AudioBuffer by removing |frames_to_trim| frames from the end. | 84 // Trim an AudioBuffer by removing |frames_to_trim| frames from the end. |
85 // Duration is adjusted to reflect the fewer frames. | 85 // Duration is adjusted to reflect the fewer frames. |
86 void TrimEnd(int frames_to_trim); | 86 void TrimEnd(int frames_to_trim); |
87 | 87 |
| 88 // Trim an AudioBuffer by removing |end - start| frames from [|start|, |end|). |
| 89 // Even if |start| is zero, timestamp() is not adjusted, only duration(). |
| 90 void TrimRange(int start, int end); |
| 91 |
88 // Return the number of channels. | 92 // Return the number of channels. |
89 int channel_count() const { return channel_count_; } | 93 int channel_count() const { return channel_count_; } |
90 | 94 |
91 // Return the number of frames held. | 95 // Return the number of frames held. |
92 int frame_count() const { return adjusted_frame_count_; } | 96 int frame_count() const { return adjusted_frame_count_; } |
93 | 97 |
94 // Return the sample rate. | 98 // Return the sample rate. |
95 int sample_rate() const { return sample_rate_; } | 99 int sample_rate() const { return sample_rate_; } |
96 | 100 |
97 // Return the channel layout. | 101 // Return the channel layout. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 146 |
143 // For planar data, points to each channels data. | 147 // For planar data, points to each channels data. |
144 std::vector<uint8*> channel_data_; | 148 std::vector<uint8*> channel_data_; |
145 | 149 |
146 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); | 150 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); |
147 }; | 151 }; |
148 | 152 |
149 } // namespace media | 153 } // namespace media |
150 | 154 |
151 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ | 155 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ |
OLD | NEW |