| 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_DRM_BRIDGE_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ |
| 6 #define MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 using ResetCredentialsCB = base::Callback<void(bool)>; | 49 using ResetCredentialsCB = base::Callback<void(bool)>; |
| 50 | 50 |
| 51 // Notification called when MediaCrypto object is ready. | 51 // Notification called when MediaCrypto object is ready. |
| 52 // Parameters: | 52 // Parameters: |
| 53 // |media_crypto| - global reference to MediaCrypto object | 53 // |media_crypto| - global reference to MediaCrypto object |
| 54 // |needs_protected_surface| - true if protected surface is required. | 54 // |needs_protected_surface| - true if protected surface is required. |
| 55 using MediaCryptoReadyCB = base::Callback<void(JavaObjectPtr media_crypto, | 55 using MediaCryptoReadyCB = base::Callback<void(JavaObjectPtr media_crypto, |
| 56 bool needs_protected_surface)>; | 56 bool needs_protected_surface)>; |
| 57 | 57 |
| 58 // Checks whether MediaDRM is available. | 58 // Checks whether MediaDRM is available and usable, including for decoding. |
| 59 // All other static methods check IsAvailable() internally. There's no need | 59 // All other static methods check IsAvailable() or equivalent internally. |
| 60 // to check IsAvailable() explicitly before calling them. | 60 // There is no need to check IsAvailable() explicitly before calling them. |
| 61 static bool IsAvailable(); | 61 static bool IsAvailable(); |
| 62 | 62 |
| 63 static bool RegisterMediaDrmBridge(JNIEnv* env); | 63 static bool RegisterMediaDrmBridge(JNIEnv* env); |
| 64 | 64 |
| 65 // Checks whether |key_system| is supported. | 65 // Checks whether |key_system| is supported. |
| 66 static bool IsKeySystemSupported(const std::string& key_system); | 66 static bool IsKeySystemSupported(const std::string& key_system); |
| 67 | 67 |
| 68 // Checks whether |key_system| is supported with |container_mime_type|. | 68 // Checks whether |key_system| is supported with |container_mime_type|. |
| 69 // |container_mime_type| must not be empty. | 69 // |container_mime_type| must not be empty. |
| 70 static bool IsKeySystemSupportedWithType( | 70 static bool IsKeySystemSupportedWithType( |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // Called by the java object when credential reset is completed. | 236 // Called by the java object when credential reset is completed. |
| 237 void OnResetDeviceCredentialsCompleted( | 237 void OnResetDeviceCredentialsCompleted( |
| 238 JNIEnv* env, | 238 JNIEnv* env, |
| 239 const base::android::JavaParamRef<jobject>&, | 239 const base::android::JavaParamRef<jobject>&, |
| 240 bool success); | 240 bool success); |
| 241 | 241 |
| 242 private: | 242 private: |
| 243 // For DeleteSoon() in DeleteOnCorrectThread(). | 243 // For DeleteSoon() in DeleteOnCorrectThread(). |
| 244 friend class base::DeleteHelper<MediaDrmBridge>; | 244 friend class base::DeleteHelper<MediaDrmBridge>; |
| 245 | 245 |
| 246 static scoped_refptr<MediaDrmBridge> CreateInternal( |
| 247 const std::string& key_system, |
| 248 SecurityLevel security_level, |
| 249 const CreateFetcherCB& create_fetcher_cb, |
| 250 const SessionMessageCB& session_message_cb, |
| 251 const SessionClosedCB& session_closed_cb, |
| 252 const LegacySessionErrorCB& legacy_session_error_cb, |
| 253 const SessionKeysChangeCB& session_keys_change_cb, |
| 254 const SessionExpirationUpdateCB& session_expiration_update_cb); |
| 255 |
| 246 // Constructs a MediaDrmBridge for |scheme_uuid| and |security_level|. The | 256 // Constructs a MediaDrmBridge for |scheme_uuid| and |security_level|. The |
| 247 // default security level will be used if |security_level| is | 257 // default security level will be used if |security_level| is |
| 248 // SECURITY_LEVEL_DEFAULT. Sessions should not be created if session callbacks | 258 // SECURITY_LEVEL_DEFAULT. Sessions should not be created if session callbacks |
| 249 // are null. | 259 // are null. |
| 250 MediaDrmBridge(const std::vector<uint8_t>& scheme_uuid, | 260 MediaDrmBridge(const std::vector<uint8_t>& scheme_uuid, |
| 251 SecurityLevel security_level, | 261 SecurityLevel security_level, |
| 252 const CreateFetcherCB& create_fetcher_cb, | 262 const CreateFetcherCB& create_fetcher_cb, |
| 253 const SessionMessageCB& session_message_cb, | 263 const SessionMessageCB& session_message_cb, |
| 254 const SessionClosedCB& session_closed_cb, | 264 const SessionClosedCB& session_closed_cb, |
| 255 const LegacySessionErrorCB& legacy_session_error_cb, | 265 const LegacySessionErrorCB& legacy_session_error_cb, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 328 |
| 319 // NOTE: Weak pointers must be invalidated before all other member variables. | 329 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 320 base::WeakPtrFactory<MediaDrmBridge> weak_factory_; | 330 base::WeakPtrFactory<MediaDrmBridge> weak_factory_; |
| 321 | 331 |
| 322 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); | 332 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); |
| 323 }; | 333 }; |
| 324 | 334 |
| 325 } // namespace media | 335 } // namespace media |
| 326 | 336 |
| 327 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ | 337 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ |
| OLD | NEW |