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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 to write directly to. Data for planar |
135 // data is grouped by channel. There is only 1 entry for interleaved formats. | 135 // data is grouped by channel. There is only 1 entry for interleaved formats. |
136 const std::vector<uint8_t*>& channel_data() const { return channel_data_; } | 136 const std::vector<uint8_t*>& channel_data() const { return channel_data_; } |
137 | 137 |
138 // Access to the interleaved raw buffer for Android MediaCodec to write | |
139 // directly to. | |
140 uint8_t* interleaved_data() const { return data_.get(); } | |
DaleCurtis
2016/02/01 19:08:17
You can just use channel_data()[0] in this case, s
Tima Vaisburd
2016/02/04 22:59:12
Removed these methods and added data_size() method
| |
141 size_t interleaved_data_size() const { return data_ ? data_size_ : 0; } | |
142 | |
138 private: | 143 private: |
139 friend class base::RefCountedThreadSafe<AudioBuffer>; | 144 friend class base::RefCountedThreadSafe<AudioBuffer>; |
140 | 145 |
141 // mojo::TypeConverter added as a friend so that AudioBuffer can be | 146 // mojo::TypeConverter added as a friend so that AudioBuffer can be |
142 // transferred across a mojo connection. | 147 // transferred across a mojo connection. |
143 friend struct mojo::TypeConverter<mojo::StructPtr<interfaces::AudioBuffer>, | 148 friend struct mojo::TypeConverter<mojo::StructPtr<interfaces::AudioBuffer>, |
144 scoped_refptr<AudioBuffer>>; | 149 scoped_refptr<AudioBuffer>>; |
145 | 150 |
146 // Allocates aligned contiguous buffer to hold all channel data (1 block for | 151 // Allocates aligned contiguous buffer to hold all channel data (1 block for |
147 // interleaved data, |channel_count| blocks for planar data), copies | 152 // interleaved data, |channel_count| blocks for planar data), copies |
(...skipping 27 matching lines...) Expand all Loading... | |
175 | 180 |
176 // For planar data, points to each channels data. | 181 // For planar data, points to each channels data. |
177 std::vector<uint8_t*> channel_data_; | 182 std::vector<uint8_t*> channel_data_; |
178 | 183 |
179 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); | 184 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); |
180 }; | 185 }; |
181 | 186 |
182 } // namespace media | 187 } // namespace media |
183 | 188 |
184 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ | 189 #endif // MEDIA_BASE_AUDIO_BUFFER_H_ |
OLD | NEW |