| 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_SDK_MEDIA_CODEC_BRIDGE_H_ | 5 #ifndef MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ |
| 6 #define MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ | 6 #define MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 bool* end_of_stream, | 61 bool* end_of_stream, |
| 62 bool* key_frame) override; | 62 bool* key_frame) override; |
| 63 void ReleaseOutputBuffer(int index, bool render) override; | 63 void ReleaseOutputBuffer(int index, bool render) override; |
| 64 MediaCodecStatus GetInputBuffer(int input_buffer_index, | 64 MediaCodecStatus GetInputBuffer(int input_buffer_index, |
| 65 uint8_t** data, | 65 uint8_t** data, |
| 66 size_t* capacity) override; | 66 size_t* capacity) override; |
| 67 MediaCodecStatus GetOutputBufferAddress(int index, | 67 MediaCodecStatus GetOutputBufferAddress(int index, |
| 68 size_t offset, | 68 size_t offset, |
| 69 const uint8_t** addr, | 69 const uint8_t** addr, |
| 70 size_t* capacity) override; | 70 size_t* capacity) override; |
| 71 bool IsSoftwareCodec() override; |
| 71 | 72 |
| 72 static bool RegisterSdkMediaCodecBridge(JNIEnv* env); | 73 static bool RegisterSdkMediaCodecBridge(JNIEnv* env); |
| 73 | 74 |
| 74 protected: | 75 protected: |
| 75 SdkMediaCodecBridge(const std::string& mime, | 76 SdkMediaCodecBridge(const std::string& mime, |
| 76 bool is_secure, | 77 bool is_secure, |
| 77 MediaCodecDirection direction); | 78 MediaCodecDirection direction, |
| 78 | 79 bool require_software_codec); |
| 79 | 80 |
| 80 jobject media_codec() { return j_media_codec_.obj(); } | 81 jobject media_codec() { return j_media_codec_.obj(); } |
| 81 MediaCodecDirection direction_; | 82 MediaCodecDirection direction_; |
| 82 | 83 |
| 83 private: | 84 private: |
| 84 // Java MediaCodec instance. | 85 // Java MediaCodec instance. |
| 85 base::android::ScopedJavaGlobalRef<jobject> j_media_codec_; | 86 base::android::ScopedJavaGlobalRef<jobject> j_media_codec_; |
| 86 | 87 |
| 87 DISALLOW_COPY_AND_ASSIGN(SdkMediaCodecBridge); | 88 DISALLOW_COPY_AND_ASSIGN(SdkMediaCodecBridge); |
| 88 }; | 89 }; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 MediaCodecDirection direction); | 165 MediaCodecDirection direction); |
| 165 | 166 |
| 166 // Create, start, and return a VideoCodecBridge decoder or NULL on failure. | 167 // Create, start, and return a VideoCodecBridge decoder or NULL on failure. |
| 167 static VideoCodecBridge* CreateDecoder( | 168 static VideoCodecBridge* CreateDecoder( |
| 168 const VideoCodec& codec, // e.g. media::kCodecVP8 | 169 const VideoCodec& codec, // e.g. media::kCodecVP8 |
| 169 bool is_secure, // Will be used with encrypted content. | 170 bool is_secure, // Will be used with encrypted content. |
| 170 const gfx::Size& size, // Output frame size. | 171 const gfx::Size& size, // Output frame size. |
| 171 jobject surface, // Output surface, optional. | 172 jobject surface, // Output surface, optional. |
| 172 jobject media_crypto, // MediaCrypto object, optional. | 173 jobject media_crypto, // MediaCrypto object, optional. |
| 173 bool allow_adaptive_playback = | 174 bool allow_adaptive_playback = |
| 174 true); // Should adaptive playback be allowed if supported. | 175 true, // Should adaptive playback be allowed if supported. |
| 176 bool require_software_codec = false); // Require software decoder? |
| 175 | 177 |
| 176 // Create, start, and return a VideoCodecBridge encoder or NULL on failure. | 178 // Create, start, and return a VideoCodecBridge encoder or NULL on failure. |
| 177 static VideoCodecBridge* CreateEncoder( | 179 static VideoCodecBridge* CreateEncoder( |
| 178 const VideoCodec& codec, // e.g. media::kCodecVP8 | 180 const VideoCodec& codec, // e.g. media::kCodecVP8 |
| 179 const gfx::Size& size, // input frame size | 181 const gfx::Size& size, // input frame size |
| 180 int bit_rate, // bits/second | 182 int bit_rate, // bits/second |
| 181 int frame_rate, // frames/second | 183 int frame_rate, // frames/second |
| 182 int i_frame_interval, // count | 184 int i_frame_interval, // count |
| 183 int color_format); // MediaCodecInfo.CodecCapabilities. | 185 int color_format); // MediaCodecInfo.CodecCapabilities. |
| 184 | 186 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 195 // will be false. If |adaptive_playback_supported| is larger than 0, the | 197 // will be false. If |adaptive_playback_supported| is larger than 0, the |
| 196 // return value will be true. | 198 // return value will be true. |
| 197 void set_adaptive_playback_supported_for_testing( | 199 void set_adaptive_playback_supported_for_testing( |
| 198 int adaptive_playback_supported) { | 200 int adaptive_playback_supported) { |
| 199 adaptive_playback_supported_for_testing_ = adaptive_playback_supported; | 201 adaptive_playback_supported_for_testing_ = adaptive_playback_supported; |
| 200 } | 202 } |
| 201 | 203 |
| 202 private: | 204 private: |
| 203 VideoCodecBridge(const std::string& mime, | 205 VideoCodecBridge(const std::string& mime, |
| 204 bool is_secure, | 206 bool is_secure, |
| 205 MediaCodecDirection direction); | 207 MediaCodecDirection direction, |
| 208 bool require_software_codec); |
| 206 | 209 |
| 207 int adaptive_playback_supported_for_testing_; | 210 int adaptive_playback_supported_for_testing_; |
| 208 }; | 211 }; |
| 209 | 212 |
| 210 } // namespace media | 213 } // namespace media |
| 211 | 214 |
| 212 #endif // MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ | 215 #endif // MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ |
| OLD | NEW |