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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace mojo { | 22 namespace mojo { |
23 template <typename T, typename U> | 23 template <typename T, typename U> |
24 struct TypeConverter; | 24 struct TypeConverter; |
25 template <typename T> | 25 template <typename T> |
26 class StructPtr; | 26 class StructPtr; |
27 }; | 27 }; |
28 | 28 |
29 namespace media { | 29 namespace media { |
30 class AudioBus; | 30 class AudioBus; |
31 | 31 |
32 namespace interfaces { | 32 namespace mojom { |
33 class AudioBuffer; | 33 class AudioBuffer; |
34 } | 34 } |
35 | 35 |
36 // An audio buffer that takes a copy of the data passed to it, holds it, and | 36 // An audio buffer that takes a copy of the data passed to it, holds it, and |
37 // copies it into an AudioBus when needed. Also supports an end of stream | 37 // copies it into an AudioBus when needed. Also supports an end of stream |
38 // marker. | 38 // marker. |
39 class MEDIA_EXPORT AudioBuffer | 39 class MEDIA_EXPORT AudioBuffer |
40 : public base::RefCountedThreadSafe<AudioBuffer> { | 40 : public base::RefCountedThreadSafe<AudioBuffer> { |
41 public: | 41 public: |
42 // Alignment of each channel's data; this must match what ffmpeg expects | 42 // Alignment of each channel's data; this must match what ffmpeg expects |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 // The size of allocated data memory block. For planar formats channels go | 146 // The size of allocated data memory block. For planar formats channels go |
147 // sequentially in this block. | 147 // sequentially in this block. |
148 size_t data_size() const { return data_size_; } | 148 size_t data_size() const { return data_size_; } |
149 | 149 |
150 private: | 150 private: |
151 friend class base::RefCountedThreadSafe<AudioBuffer>; | 151 friend class base::RefCountedThreadSafe<AudioBuffer>; |
152 | 152 |
153 // mojo::TypeConverter added as a friend so that AudioBuffer can be | 153 // mojo::TypeConverter added as a friend so that AudioBuffer can be |
154 // transferred across a mojo connection. | 154 // transferred across a mojo connection. |
155 friend struct mojo::TypeConverter<mojo::StructPtr<interfaces::AudioBuffer>, | 155 friend struct mojo::TypeConverter<mojo::StructPtr<mojom::AudioBuffer>, |
156 scoped_refptr<AudioBuffer>>; | 156 scoped_refptr<AudioBuffer>>; |
157 | 157 |
158 // Allocates aligned contiguous buffer to hold all channel data (1 block for | 158 // Allocates aligned contiguous buffer to hold all channel data (1 block for |
159 // interleaved data, |channel_count| blocks for planar data), copies | 159 // interleaved data, |channel_count| blocks for planar data), copies |
160 // [data,data+data_size) to the allocated buffer(s). If |data| is null, no | 160 // [data,data+data_size) to the allocated buffer(s). If |data| is null, no |
161 // data is copied. If |create_buffer| is false, no data buffer is created (or | 161 // data is copied. If |create_buffer| is false, no data buffer is created (or |
162 // copied to). | 162 // copied to). |
163 AudioBuffer(SampleFormat sample_format, | 163 AudioBuffer(SampleFormat sample_format, |
164 ChannelLayout channel_layout, | 164 ChannelLayout channel_layout, |
165 int channel_count, | 165 int channel_count, |
(...skipping 21 matching lines...) Expand all Loading... |
187 | 187 |
188 // For planar data, points to each channels data. | 188 // For planar data, points to each channels data. |
189 std::vector<uint8_t*> channel_data_; | 189 std::vector<uint8_t*> channel_data_; |
190 | 190 |
191 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); | 191 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); |
192 }; | 192 }; |
193 | 193 |
194 } // namespace media | 194 } // namespace media |
195 | 195 |
196 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ | 196 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ |
OLD | NEW |