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