| 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 <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 SECURITY_LEVEL_3 = 3, | 34 SECURITY_LEVEL_3 = 3, |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 typedef base::Callback<void(bool)> ResetCredentialsCB; | 37 typedef base::Callback<void(bool)> ResetCredentialsCB; |
| 38 | 38 |
| 39 virtual ~MediaDrmBridge(); | 39 virtual ~MediaDrmBridge(); |
| 40 | 40 |
| 41 // Checks whether MediaDRM is available. | 41 // Checks whether MediaDRM is available. |
| 42 static bool IsAvailable(); | 42 static bool IsAvailable(); |
| 43 | 43 |
| 44 static bool IsSecurityLevelSupported(const std::vector<uint8>& scheme_uuid, | 44 // TODO(xhwang): Add tests for MediaDrmBridge. See http://crbug.com/303864 |
| 45 static bool IsSecurityLevelSupported(const std::string& key_system, |
| 45 SecurityLevel security_level); | 46 SecurityLevel security_level); |
| 46 | 47 |
| 47 static bool IsCryptoSchemeSupported(const std::vector<uint8>& scheme_uuid, | 48 // TODO(xhwang): The |container_mime_type| is not the same as contentType in |
| 48 const std::string& container_mime_type); | 49 // the EME spec. Revisit this once the spec issue with initData type is |
| 50 // resolved. |
| 51 static bool IsKeySystemSupportedWithType( |
| 52 const std::string& key_system, |
| 53 const std::string& container_mime_type); |
| 49 | 54 |
| 50 static bool IsSecureDecoderRequired(SecurityLevel security_level); | 55 static bool IsSecureDecoderRequired(SecurityLevel security_level); |
| 51 | 56 |
| 52 static bool RegisterMediaDrmBridge(JNIEnv* env); | 57 static bool RegisterMediaDrmBridge(JNIEnv* env); |
| 53 | 58 |
| 54 // Returns a MediaDrmBridge instance if |scheme_uuid| is supported, or a NULL | 59 // Returns a MediaDrmBridge instance if |key_system| is supported, or a NULL |
| 55 // pointer otherwise. | 60 // pointer otherwise. |
| 56 static scoped_ptr<MediaDrmBridge> Create( | 61 static scoped_ptr<MediaDrmBridge> Create(int cdm_id, |
| 57 int cdm_id, | 62 const std::string& key_system, |
| 58 const std::vector<uint8>& scheme_uuid, | 63 const GURL& frame_url, |
| 59 const GURL& frame_url, | 64 MediaPlayerManager* manager); |
| 60 MediaPlayerManager* manager); | |
| 61 | 65 |
| 62 // Returns true if |security_level| is successfully set, or false otherwise. | 66 // Returns true if |security_level| is successfully set, or false otherwise. |
| 63 // Call this function right after Create() and before any other calls. | 67 // Call this function right after Create() and before any other calls. |
| 64 // Note: | 68 // Note: |
| 65 // - If this function is not called, the default security level of the device | 69 // - If this function is not called, the default security level of the device |
| 66 // will be used. | 70 // will be used. |
| 67 // - It's recommended to call this function only once on a MediaDrmBridge | 71 // - It's recommended to call this function only once on a MediaDrmBridge |
| 68 // object. Calling this function multiples times may cause errors. | 72 // object. Calling this function multiples times may cause errors. |
| 69 bool SetSecurityLevel(SecurityLevel security_level); | 73 bool SetSecurityLevel(SecurityLevel security_level); |
| 70 | 74 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 base::Closure media_crypto_ready_cb_; | 150 base::Closure media_crypto_ready_cb_; |
| 147 | 151 |
| 148 ResetCredentialsCB reset_credentials_cb_; | 152 ResetCredentialsCB reset_credentials_cb_; |
| 149 | 153 |
| 150 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); | 154 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); |
| 151 }; | 155 }; |
| 152 | 156 |
| 153 } // namespace media | 157 } // namespace media |
| 154 | 158 |
| 155 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ | 159 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ |
| OLD | NEW |