| 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 // Returns a MediaDrmBridge instance if |scheme_uuid| is supported, or a NULL | 33 // Returns a MediaDrmBridge instance if |scheme_uuid| is supported, or a NULL |
| 34 // pointer otherwise. | 34 // pointer otherwise. |
| 35 static MediaDrmBridge* Create(int media_keys_id, | 35 static MediaDrmBridge* Create(int media_keys_id, |
| 36 const std::vector<uint8>& scheme_uuid, | 36 const std::vector<uint8>& scheme_uuid, |
| 37 MediaPlayerManager* manager); | 37 MediaPlayerManager* manager); |
| 38 | 38 |
| 39 // Checks whether MediaDRM is available. | 39 // Checks whether MediaDRM is available. |
| 40 static bool IsAvailable(); | 40 static bool IsAvailable(); |
| 41 | 41 |
| 42 static bool IsCryptoSchemeSupported(const std::vector<uint8>& scheme_uuid, |
| 43 const std::string& container_mime_type); |
| 44 |
| 45 static bool IsSecureDecoderRequired(const std::string& security_level_str); |
| 46 |
| 42 static bool RegisterMediaDrmBridge(JNIEnv* env); | 47 static bool RegisterMediaDrmBridge(JNIEnv* env); |
| 43 | 48 |
| 44 // MediaKeys implementations. | 49 // MediaKeys implementations. |
| 45 virtual bool GenerateKeyRequest(const std::string& type, | 50 virtual bool GenerateKeyRequest(const std::string& type, |
| 46 const uint8* init_data, | 51 const uint8* init_data, |
| 47 int init_data_length) OVERRIDE; | 52 int init_data_length) OVERRIDE; |
| 48 virtual void AddKey(const uint8* key, int key_length, | 53 virtual void AddKey(const uint8* key, int key_length, |
| 49 const uint8* init_data, int init_data_length, | 54 const uint8* init_data, int init_data_length, |
| 50 const std::string& session_id) OVERRIDE; | 55 const std::string& session_id) OVERRIDE; |
| 51 virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE; | 56 virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 71 // Called when error happens. | 76 // Called when error happens. |
| 72 void OnKeyError(JNIEnv* env, jobject, jstring j_session_id); | 77 void OnKeyError(JNIEnv* env, jobject, jstring j_session_id); |
| 73 | 78 |
| 74 // Helper function to determine whether a protected surface is needed for the | 79 // Helper function to determine whether a protected surface is needed for the |
| 75 // video playback. | 80 // video playback. |
| 76 bool IsProtectedSurfaceRequired(); | 81 bool IsProtectedSurfaceRequired(); |
| 77 | 82 |
| 78 int media_keys_id() const { return media_keys_id_; } | 83 int media_keys_id() const { return media_keys_id_; } |
| 79 | 84 |
| 80 private: | 85 private: |
| 86 static bool IsSecureDecoderRequired(SecurityLevel security_level); |
| 87 |
| 81 MediaDrmBridge(int media_keys_id, | 88 MediaDrmBridge(int media_keys_id, |
| 82 const std::vector<uint8>& scheme_uuid, | 89 const std::vector<uint8>& scheme_uuid, |
| 83 MediaPlayerManager* manager); | 90 MediaPlayerManager* manager); |
| 84 | 91 |
| 85 // Get the security level of the media. | 92 // Get the security level of the media. |
| 86 SecurityLevel GetSecurityLevel(); | 93 SecurityLevel GetSecurityLevel(); |
| 87 | 94 |
| 88 // ID of the MediaKeys object. | 95 // ID of the MediaKeys object. |
| 89 int media_keys_id_; | 96 int media_keys_id_; |
| 90 | 97 |
| 91 // UUID of the key system. | 98 // UUID of the key system. |
| 92 std::vector<uint8> scheme_uuid_; | 99 std::vector<uint8> scheme_uuid_; |
| 93 | 100 |
| 94 // Java MediaDrm instance. | 101 // Java MediaDrm instance. |
| 95 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_; | 102 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_; |
| 96 | 103 |
| 97 // Non-owned pointer. | 104 // Non-owned pointer. |
| 98 MediaPlayerManager* manager_; | 105 MediaPlayerManager* manager_; |
| 99 | 106 |
| 100 base::Closure media_crypto_ready_cb_; | 107 base::Closure media_crypto_ready_cb_; |
| 101 | 108 |
| 102 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); | 109 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); |
| 103 }; | 110 }; |
| 104 | 111 |
| 105 } // namespace media | 112 } // namespace media |
| 106 | 113 |
| 107 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ | 114 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ |
| OLD | NEW |