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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 // Return the channel layout. | 124 // Return the channel layout. |
125 ChannelLayout channel_layout() const { return channel_layout_; } | 125 ChannelLayout channel_layout() const { return channel_layout_; } |
126 | 126 |
127 base::TimeDelta timestamp() const { return timestamp_; } | 127 base::TimeDelta timestamp() const { return timestamp_; } |
128 base::TimeDelta duration() const { return duration_; } | 128 base::TimeDelta duration() const { return duration_; } |
129 void set_timestamp(base::TimeDelta timestamp) { timestamp_ = timestamp; } | 129 void set_timestamp(base::TimeDelta timestamp) { timestamp_ = timestamp; } |
130 | 130 |
131 // If there's no data in this buffer, it represents end of stream. | 131 // If there's no data in this buffer, it represents end of stream. |
132 bool end_of_stream() const { return end_of_stream_; } | 132 bool end_of_stream() const { return end_of_stream_; } |
133 | 133 |
134 // Access to the raw buffer for ffmpeg to write directly to. Data for planar | 134 // Access to the raw buffer for ffmpeg and Android MediaCodec decoders to |
135 // data is grouped by channel. There is only 1 entry for interleaved formats. | 135 // write directly to. For planar formats the vector elements correspond to |
136 // the channels. For interleaved formats only only the first element is | |
xhwang
2016/02/05 21:37:36
s/only only/only/
Tima Vaisburd
2016/02/06 03:54:11
This is gone.
| |
137 // defined (i.e. channel_data()[0]) and it contains the buffer pointer. | |
136 const std::vector<uint8_t*>& channel_data() const { return channel_data_; } | 138 const std::vector<uint8_t*>& channel_data() const { return channel_data_; } |
xhwang
2016/02/05 21:37:36
This could be confusing as a public API. For examp
Tima Vaisburd
2016/02/06 03:54:11
Reformulated.
| |
137 | 139 |
140 // The size of allocated data memory block. For planar formats the channels | |
141 // go sequentially in this block. | |
142 size_t data_size() const { return data_size_; } | |
143 | |
138 private: | 144 private: |
139 friend class base::RefCountedThreadSafe<AudioBuffer>; | 145 friend class base::RefCountedThreadSafe<AudioBuffer>; |
140 | 146 |
141 // mojo::TypeConverter added as a friend so that AudioBuffer can be | 147 // mojo::TypeConverter added as a friend so that AudioBuffer can be |
142 // transferred across a mojo connection. | 148 // transferred across a mojo connection. |
143 friend struct mojo::TypeConverter<mojo::StructPtr<interfaces::AudioBuffer>, | 149 friend struct mojo::TypeConverter<mojo::StructPtr<interfaces::AudioBuffer>, |
144 scoped_refptr<AudioBuffer>>; | 150 scoped_refptr<AudioBuffer>>; |
145 | 151 |
146 // Allocates aligned contiguous buffer to hold all channel data (1 block for | 152 // Allocates aligned contiguous buffer to hold all channel data (1 block for |
147 // interleaved data, |channel_count| blocks for planar data), copies | 153 // interleaved data, |channel_count| blocks for planar data), copies |
(...skipping 27 matching lines...) Expand all Loading... | |
175 | 181 |
176 // For planar data, points to each channels data. | 182 // For planar data, points to each channels data. |
177 std::vector<uint8_t*> channel_data_; | 183 std::vector<uint8_t*> channel_data_; |
178 | 184 |
179 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); | 185 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); |
180 }; | 186 }; |
181 | 187 |
182 } // namespace media | 188 } // namespace media |
183 | 189 |
184 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ | 190 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ |
OLD | NEW |