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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 231 |
232 // See MediaCodecBridge::IsKnownUnaccelerated(). | 232 // See MediaCodecBridge::IsKnownUnaccelerated(). |
233 static bool IsKnownUnaccelerated(const AudioCodec& codec); | 233 static bool IsKnownUnaccelerated(const AudioCodec& codec); |
234 | 234 |
235 // Start the audio codec bridge. | 235 // Start the audio codec bridge. |
236 bool Start(const AudioCodec& codec, int sample_rate, int channel_count, | 236 bool Start(const AudioCodec& codec, int sample_rate, int channel_count, |
237 const uint8* extra_data, size_t extra_data_size, | 237 const uint8* extra_data, size_t extra_data_size, |
238 int64 codec_delay_ns, int64 seek_preroll_ns, | 238 int64 codec_delay_ns, int64 seek_preroll_ns, |
239 bool play_audio, jobject media_crypto) WARN_UNUSED_RESULT; | 239 bool play_audio, jobject media_crypto) WARN_UNUSED_RESULT; |
240 | 240 |
241 // Play the output buffer. This call must be called after | 241 // Plays the output buffer right away or save for later playback if |postpone| |
242 // DequeueOutputBuffer() and before ReleaseOutputBuffer. Returns the playback | 242 // is set to true. This call must be called after DequeueOutputBuffer() and |
243 // head position expressed in frames. | 243 // before ReleaseOutputBuffer. The data is extracted from the output buffers |
244 int64 PlayOutputBuffer(int index, size_t size, size_t offset); | 244 // using |index|, |size| and |offset|. Returns the playback head position |
| 245 // expressed in frames. |
| 246 // When |postpone| is set to true, the next PlayOutputBuffer() should have |
| 247 // postpone == false, and it will play two buffers: the postponed one and |
| 248 // the one identified by |index|. |
| 249 int64 PlayOutputBuffer(int index, |
| 250 size_t size, |
| 251 size_t offset, |
| 252 bool postpone = false); |
245 | 253 |
246 // Set the volume of the audio output. | 254 // Set the volume of the audio output. |
247 void SetVolume(double volume); | 255 void SetVolume(double volume); |
248 | 256 |
249 private: | 257 private: |
250 explicit AudioCodecBridge(const std::string& mime); | 258 explicit AudioCodecBridge(const std::string& mime); |
251 | 259 |
252 // Configure the java MediaFormat object with the extra codec data passed in. | 260 // Configure the java MediaFormat object with the extra codec data passed in. |
253 bool ConfigureMediaFormat(jobject j_format, const AudioCodec& codec, | 261 bool ConfigureMediaFormat(jobject j_format, const AudioCodec& codec, |
254 const uint8* extra_data, size_t extra_data_size, | 262 const uint8* extra_data, size_t extra_data_size, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 VideoCodecBridge(const std::string& mime, | 307 VideoCodecBridge(const std::string& mime, |
300 bool is_secure, | 308 bool is_secure, |
301 MediaCodecDirection direction); | 309 MediaCodecDirection direction); |
302 | 310 |
303 int adaptive_playback_supported_for_testing_; | 311 int adaptive_playback_supported_for_testing_; |
304 }; | 312 }; |
305 | 313 |
306 } // namespace media | 314 } // namespace media |
307 | 315 |
308 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 316 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
OLD | NEW |