OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 MediaCodecBridge(const std::string& mime, | 196 MediaCodecBridge(const std::string& mime, |
197 bool is_secure, | 197 bool is_secure, |
198 MediaCodecDirection direction); | 198 MediaCodecDirection direction); |
199 | 199 |
200 // Calls start() against the media codec instance. Used in StartXXX() after | 200 // Calls start() against the media codec instance. Used in StartXXX() after |
201 // configuring media codec. Returns whether media codec was successfully | 201 // configuring media codec. Returns whether media codec was successfully |
202 // started. | 202 // started. |
203 bool StartInternal() WARN_UNUSED_RESULT; | 203 bool StartInternal() WARN_UNUSED_RESULT; |
204 | 204 |
| 205 // Called to get the buffer address given the output buffer index and offset. |
| 206 // This function returns the size of the output and |addr| is the pointer to |
| 207 // the address to read. |
| 208 int GetOutputBufferAddress(int index, size_t offset, void** addr); |
| 209 |
205 jobject media_codec() { return j_media_codec_.obj(); } | 210 jobject media_codec() { return j_media_codec_.obj(); } |
206 MediaCodecDirection direction_; | 211 MediaCodecDirection direction_; |
207 | 212 |
208 private: | 213 private: |
209 // Fills a particular input buffer; returns false if |data_size| exceeds the | 214 // Fills a particular input buffer; returns false if |data_size| exceeds the |
210 // input buffer's capacity (and doesn't touch the input buffer in that case). | 215 // input buffer's capacity (and doesn't touch the input buffer in that case). |
211 bool FillInputBuffer(int index, | 216 bool FillInputBuffer(int index, |
212 const uint8* data, | 217 const uint8* data, |
213 size_t data_size) WARN_UNUSED_RESULT; | 218 size_t data_size) WARN_UNUSED_RESULT; |
214 | 219 |
(...skipping 14 matching lines...) Expand all Loading... |
229 | 234 |
230 // Start the audio codec bridge. | 235 // Start the audio codec bridge. |
231 bool Start(const AudioCodec& codec, int sample_rate, int channel_count, | 236 bool Start(const AudioCodec& codec, int sample_rate, int channel_count, |
232 const uint8* extra_data, size_t extra_data_size, | 237 const uint8* extra_data, size_t extra_data_size, |
233 int64 codec_delay_ns, int64 seek_preroll_ns, | 238 int64 codec_delay_ns, int64 seek_preroll_ns, |
234 bool play_audio, jobject media_crypto) WARN_UNUSED_RESULT; | 239 bool play_audio, jobject media_crypto) WARN_UNUSED_RESULT; |
235 | 240 |
236 // Play the output buffer. This call must be called after | 241 // Play the output buffer. This call must be called after |
237 // DequeueOutputBuffer() and before ReleaseOutputBuffer. Returns the playback | 242 // DequeueOutputBuffer() and before ReleaseOutputBuffer. Returns the playback |
238 // head position expressed in frames. | 243 // head position expressed in frames. |
239 int64 PlayOutputBuffer(int index, size_t size); | 244 int64 PlayOutputBuffer(int index, size_t size, size_t offset); |
240 | 245 |
241 // Set the volume of the audio output. | 246 // Set the volume of the audio output. |
242 void SetVolume(double volume); | 247 void SetVolume(double volume); |
243 | 248 |
244 private: | 249 private: |
245 explicit AudioCodecBridge(const std::string& mime); | 250 explicit AudioCodecBridge(const std::string& mime); |
246 | 251 |
247 // Configure the java MediaFormat object with the extra codec data passed in. | 252 // Configure the java MediaFormat object with the extra codec data passed in. |
248 bool ConfigureMediaFormat(jobject j_format, const AudioCodec& codec, | 253 bool ConfigureMediaFormat(jobject j_format, const AudioCodec& codec, |
249 const uint8* extra_data, size_t extra_data_size, | 254 const uint8* extra_data, size_t extra_data_size, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 VideoCodecBridge(const std::string& mime, | 299 VideoCodecBridge(const std::string& mime, |
295 bool is_secure, | 300 bool is_secure, |
296 MediaCodecDirection direction); | 301 MediaCodecDirection direction); |
297 | 302 |
298 int adaptive_playback_supported_for_testing_; | 303 int adaptive_playback_supported_for_testing_; |
299 }; | 304 }; |
300 | 305 |
301 } // namespace media | 306 } // namespace media |
302 | 307 |
303 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 308 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
OLD | NEW |