| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // Copy frames into |dest|. |frames_to_copy| is the number of frames to copy. | 66 // Copy frames into |dest|. |frames_to_copy| is the number of frames to copy. |
| 67 // |source_frame_offset| specifies how many frames in the buffer to skip | 67 // |source_frame_offset| specifies how many frames in the buffer to skip |
| 68 // first. |dest_frame_offset| is the frame offset in |dest|. The frames are | 68 // first. |dest_frame_offset| is the frame offset in |dest|. The frames are |
| 69 // converted from their source format into planar float32 data (which is all | 69 // converted from their source format into planar float32 data (which is all |
| 70 // that AudioBus handles). | 70 // that AudioBus handles). |
| 71 void ReadFrames(int frames_to_copy, | 71 void ReadFrames(int frames_to_copy, |
| 72 int source_frame_offset, | 72 int source_frame_offset, |
| 73 int dest_frame_offset, | 73 int dest_frame_offset, |
| 74 AudioBus* dest); | 74 AudioBus* dest); |
| 75 | 75 |
| 76 // Copy |frames_to_copy| frames into |dest|, |frames_to_copy| is the size of |
| 77 // buffer pointed to by |dest| NOT the per channel number of frames. The |
| 78 // frames are converted from their source format into interleaved int32. |
| 79 // Note: |frames_to_copy| must be a multiple of channel_count. |
| 80 void ReadFramesInterleavedS32(int frames_to_copy, int32* dest); |
| 81 |
| 76 // Trim an AudioBuffer by removing |frames_to_trim| frames from the start. | 82 // Trim an AudioBuffer by removing |frames_to_trim| frames from the start. |
| 77 // Timestamp and duration are adjusted to reflect the fewer frames. | 83 // Timestamp and duration are adjusted to reflect the fewer frames. |
| 78 // Note that repeated calls to TrimStart() may result in timestamp() and | 84 // Note that repeated calls to TrimStart() may result in timestamp() and |
| 79 // duration() being off by a few microseconds due to rounding issues. | 85 // duration() being off by a few microseconds due to rounding issues. |
| 80 void TrimStart(int frames_to_trim); | 86 void TrimStart(int frames_to_trim); |
| 81 | 87 |
| 82 // Trim an AudioBuffer by removing |frames_to_trim| frames from the end. | 88 // Trim an AudioBuffer by removing |frames_to_trim| frames from the end. |
| 83 // Duration is adjusted to reflect the fewer frames. | 89 // Duration is adjusted to reflect the fewer frames. |
| 84 void TrimEnd(int frames_to_trim); | 90 void TrimEnd(int frames_to_trim); |
| 85 | 91 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 150 |
| 145 // For planar data, points to each channels data. | 151 // For planar data, points to each channels data. |
| 146 std::vector<uint8*> channel_data_; | 152 std::vector<uint8*> channel_data_; |
| 147 | 153 |
| 148 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); | 154 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); |
| 149 }; | 155 }; |
| 150 | 156 |
| 151 } // namespace media | 157 } // namespace media |
| 152 | 158 |
| 153 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ | 159 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ |
| OLD | NEW |