| 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 <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // and ready to be StartAudio/Video()ed again. HOWEVER, due to the buggy | 100 // and ready to be StartAudio/Video()ed again. HOWEVER, due to the buggy |
| 101 // vendor's implementation , b/8125974, Stop() -> StartAudio/Video() may not | 101 // vendor's implementation , b/8125974, Stop() -> StartAudio/Video() may not |
| 102 // work on some devices. For reliability, Stop() -> delete and recreate new | 102 // work on some devices. For reliability, Stop() -> delete and recreate new |
| 103 // instance -> StartAudio/Video() is recommended. | 103 // instance -> StartAudio/Video() is recommended. |
| 104 void Stop(); | 104 void Stop(); |
| 105 | 105 |
| 106 // Used for getting output format. This is valid after DequeueInputBuffer() | 106 // Used for getting output format. This is valid after DequeueInputBuffer() |
| 107 // returns a format change by returning INFO_OUTPUT_FORMAT_CHANGED | 107 // returns a format change by returning INFO_OUTPUT_FORMAT_CHANGED |
| 108 void GetOutputFormat(int* width, int* height); | 108 void GetOutputFormat(int* width, int* height); |
| 109 | 109 |
| 110 // Used for checking for new sampling rate after DequeueInputBuffer() returns |
| 111 // INFO_OUTPUT_FORMAT_CHANGED |
| 112 void GetOutputSamplingRate(int* sampling_rate); |
| 113 |
| 110 // Submits a byte array to the given input buffer. Call this after getting an | 114 // Submits a byte array to the given input buffer. Call this after getting an |
| 111 // available buffer from DequeueInputBuffer(). If |data| is NULL, assume the | 115 // available buffer from DequeueInputBuffer(). If |data| is NULL, assume the |
| 112 // input buffer has already been populated (but still obey |size|). | 116 // input buffer has already been populated (but still obey |size|). |
| 113 // |data_size| must be less than kint32max (because Java). | 117 // |data_size| must be less than kint32max (because Java). |
| 114 MediaCodecStatus QueueInputBuffer(int index, | 118 MediaCodecStatus QueueInputBuffer(int index, |
| 115 const uint8* data, | 119 const uint8* data, |
| 116 size_t data_size, | 120 size_t data_size, |
| 117 const base::TimeDelta& presentation_time); | 121 const base::TimeDelta& presentation_time); |
| 118 | 122 |
| 119 // Similar to the above call, but submits a buffer that is encrypted. Note: | 123 // Similar to the above call, but submits a buffer that is encrypted. Note: |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 179 |
| 176 // Returns an input buffer's base pointer and capacity. | 180 // Returns an input buffer's base pointer and capacity. |
| 177 void GetInputBuffer(int input_buffer_index, uint8** data, size_t* capacity); | 181 void GetInputBuffer(int input_buffer_index, uint8** data, size_t* capacity); |
| 178 | 182 |
| 179 // Copy |dst_size| bytes from output buffer |index|'s |offset| onwards into | 183 // Copy |dst_size| bytes from output buffer |index|'s |offset| onwards into |
| 180 // |*dst|. | 184 // |*dst|. |
| 181 bool CopyFromOutputBuffer(int index, size_t offset, void* dst, int dst_size); | 185 bool CopyFromOutputBuffer(int index, size_t offset, void* dst, int dst_size); |
| 182 | 186 |
| 183 static bool RegisterMediaCodecBridge(JNIEnv* env); | 187 static bool RegisterMediaCodecBridge(JNIEnv* env); |
| 184 | 188 |
| 189 bool reconfigureAudioTrack(); |
| 190 |
| 185 protected: | 191 protected: |
| 186 // Returns true if |mime_type| is known to be unaccelerated (i.e. backed by a | 192 // Returns true if |mime_type| is known to be unaccelerated (i.e. backed by a |
| 187 // software codec instead of a hardware one). | 193 // software codec instead of a hardware one). |
| 188 static bool IsKnownUnaccelerated(const std::string& mime_type, | 194 static bool IsKnownUnaccelerated(const std::string& mime_type, |
| 189 MediaCodecDirection direction); | 195 MediaCodecDirection direction); |
| 190 | 196 |
| 191 MediaCodecBridge(const std::string& mime, | 197 MediaCodecBridge(const std::string& mime, |
| 192 bool is_secure, | 198 bool is_secure, |
| 193 MediaCodecDirection direction); | 199 MediaCodecDirection direction); |
| 194 | 200 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 VideoCodecBridge(const std::string& mime, | 293 VideoCodecBridge(const std::string& mime, |
| 288 bool is_secure, | 294 bool is_secure, |
| 289 MediaCodecDirection direction); | 295 MediaCodecDirection direction); |
| 290 | 296 |
| 291 int adaptive_playback_supported_for_testing_; | 297 int adaptive_playback_supported_for_testing_; |
| 292 }; | 298 }; |
| 293 | 299 |
| 294 } // namespace media | 300 } // namespace media |
| 295 | 301 |
| 296 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 302 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
| OLD | NEW |