| 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 // Returns the number of input buffers used by the codec. | |
| 111 int GetInputBuffersCount(); | |
| 112 | |
| 113 // Submits a byte array to the given input buffer. Call this after getting an | 110 // Submits a byte array to the given input buffer. Call this after getting an |
| 114 // available buffer from DequeueInputBuffer(). If |data| is NULL, assume the | 111 // available buffer from DequeueInputBuffer(). If |data| is NULL, assume the |
| 115 // input buffer has already been populated (but still obey |size|). | 112 // input buffer has already been populated (but still obey |size|). |
| 116 // |data_size| must be less than kint32max (because Java). | 113 // |data_size| must be less than kint32max (because Java). |
| 117 MediaCodecStatus QueueInputBuffer(int index, | 114 MediaCodecStatus QueueInputBuffer(int index, |
| 118 const uint8* data, | 115 const uint8* data, |
| 119 size_t data_size, | 116 size_t data_size, |
| 120 const base::TimeDelta& presentation_time); | 117 const base::TimeDelta& presentation_time); |
| 121 | 118 |
| 122 // Similar to the above call, but submits a buffer that is encrypted. Note: | 119 // Similar to the above call, but submits a buffer that is encrypted. Note: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 size_t* size, | 159 size_t* size, |
| 163 base::TimeDelta* presentation_time, | 160 base::TimeDelta* presentation_time, |
| 164 bool* end_of_stream, | 161 bool* end_of_stream, |
| 165 bool* key_frame); | 162 bool* key_frame); |
| 166 | 163 |
| 167 // Returns the buffer to the codec. If you previously specified a surface when | 164 // Returns the buffer to the codec. If you previously specified a surface when |
| 168 // configuring this video decoder you can optionally render the buffer. | 165 // configuring this video decoder you can optionally render the buffer. |
| 169 void ReleaseOutputBuffer(int index, bool render); | 166 void ReleaseOutputBuffer(int index, bool render); |
| 170 | 167 |
| 171 // Returns the number of output buffers used by the codec. | 168 // Returns the number of output buffers used by the codec. |
| 169 // TODO(qinmin): this call is deprecated in Lollipop. |
| 172 int GetOutputBuffersCount(); | 170 int GetOutputBuffersCount(); |
| 173 | 171 |
| 174 // Returns the capacity of each output buffer used by the codec. | 172 // Returns the capacity of each output buffer used by the codec. |
| 173 // TODO(qinmin): this call is deprecated in Lollipop. |
| 175 size_t GetOutputBuffersCapacity(); | 174 size_t GetOutputBuffersCapacity(); |
| 176 | 175 |
| 177 // Gets output buffers from media codec and keeps them inside the java class. | |
| 178 // To access them, use DequeueOutputBuffer(). Returns whether output buffers | |
| 179 // were successfully obtained. | |
| 180 bool GetOutputBuffers() WARN_UNUSED_RESULT; | |
| 181 | |
| 182 // Returns an input buffer's base pointer and capacity. | 176 // Returns an input buffer's base pointer and capacity. |
| 183 void GetInputBuffer(int input_buffer_index, uint8** data, size_t* capacity); | 177 void GetInputBuffer(int input_buffer_index, uint8** data, size_t* capacity); |
| 184 | 178 |
| 185 // Copy |dst_size| bytes from output buffer |index|'s |offset| onwards into | 179 // Copy |dst_size| bytes from output buffer |index|'s |offset| onwards into |
| 186 // |*dst|. | 180 // |*dst|. |
| 187 bool CopyFromOutputBuffer(int index, size_t offset, void* dst, int dst_size); | 181 bool CopyFromOutputBuffer(int index, size_t offset, void* dst, int dst_size); |
| 188 | 182 |
| 189 static bool RegisterMediaCodecBridge(JNIEnv* env); | 183 static bool RegisterMediaCodecBridge(JNIEnv* env); |
| 190 | 184 |
| 191 protected: | 185 protected: |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 VideoCodecBridge(const std::string& mime, | 287 VideoCodecBridge(const std::string& mime, |
| 294 bool is_secure, | 288 bool is_secure, |
| 295 MediaCodecDirection direction); | 289 MediaCodecDirection direction); |
| 296 | 290 |
| 297 int adaptive_playback_supported_for_testing_; | 291 int adaptive_playback_supported_for_testing_; |
| 298 }; | 292 }; |
| 299 | 293 |
| 300 } // namespace media | 294 } // namespace media |
| 301 | 295 |
| 302 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 296 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
| OLD | NEW |