| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Returns a MediaDrmBridge instance if |scheme_uuid| is supported, or a NULL | 32 // Returns a MediaDrmBridge instance if |scheme_uuid| is supported, or a NULL |
| 33 // pointer otherwise. | 33 // pointer otherwise. |
| 34 static MediaDrmBridge* Create(int media_keys_id, | 34 static MediaDrmBridge* Create(int media_keys_id, |
| 35 const std::vector<uint8>& scheme_uuid, | 35 const std::vector<uint8>& scheme_uuid, |
| 36 MediaPlayerManager* manager); | 36 MediaPlayerManager* manager); |
| 37 | 37 |
| 38 // Checks whether MediaDRM is available. | 38 // Checks whether MediaDRM is available. |
| 39 static bool IsAvailable(); | 39 static bool IsAvailable(); |
| 40 | 40 |
| 41 static bool IsCryptoSchemeSupported(const std::vector<uint8>& scheme_uuid, |
| 42 const std::string& container_mime_type); |
| 43 |
| 44 static bool IsSecureDecoderRequired(const std::string& security_level_str); |
| 45 |
| 41 static bool RegisterMediaDrmBridge(JNIEnv* env); | 46 static bool RegisterMediaDrmBridge(JNIEnv* env); |
| 42 | 47 |
| 43 // MediaKeys implementations. | 48 // MediaKeys implementations. |
| 44 virtual bool GenerateKeyRequest(const std::string& type, | 49 virtual bool GenerateKeyRequest(const std::string& type, |
| 45 const uint8* init_data, | 50 const uint8* init_data, |
| 46 int init_data_length) OVERRIDE; | 51 int init_data_length) OVERRIDE; |
| 47 virtual void AddKey(const uint8* key, int key_length, | 52 virtual void AddKey(const uint8* key, int key_length, |
| 48 const uint8* init_data, int init_data_length, | 53 const uint8* init_data, int init_data_length, |
| 49 const std::string& session_id) OVERRIDE; | 54 const std::string& session_id) OVERRIDE; |
| 50 virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE; | 55 virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 62 // Helper function to determine whether a protected surface is needed for the | 67 // Helper function to determine whether a protected surface is needed for the |
| 63 // video playback. | 68 // video playback. |
| 64 bool IsProtectedSurfaceRequired(); | 69 bool IsProtectedSurfaceRequired(); |
| 65 | 70 |
| 66 // Methods to create and release a MediaCrypto object. | 71 // Methods to create and release a MediaCrypto object. |
| 67 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); | 72 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); |
| 68 | 73 |
| 69 int media_keys_id() const { return media_keys_id_; } | 74 int media_keys_id() const { return media_keys_id_; } |
| 70 | 75 |
| 71 private: | 76 private: |
| 77 static bool IsSecureDecoderRequired(SecurityLevel security_level); |
| 78 |
| 72 MediaDrmBridge(int media_keys_id, | 79 MediaDrmBridge(int media_keys_id, |
| 73 const std::vector<uint8>& scheme_uuid, | 80 const std::vector<uint8>& scheme_uuid, |
| 74 MediaPlayerManager* manager); | 81 MediaPlayerManager* manager); |
| 75 | 82 |
| 76 // Get the security level of the media. | 83 // Get the security level of the media. |
| 77 SecurityLevel GetSecurityLevel(); | 84 SecurityLevel GetSecurityLevel(); |
| 78 | 85 |
| 79 // ID of the MediaKeys object. | 86 // ID of the MediaKeys object. |
| 80 int media_keys_id_; | 87 int media_keys_id_; |
| 81 | 88 |
| 82 // UUID of the key system. | 89 // UUID of the key system. |
| 83 std::vector<uint8> scheme_uuid_; | 90 std::vector<uint8> scheme_uuid_; |
| 84 | 91 |
| 85 // Java MediaDrm instance. | 92 // Java MediaDrm instance. |
| 86 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_; | 93 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_; |
| 87 | 94 |
| 88 // Non-owned pointer. | 95 // Non-owned pointer. |
| 89 MediaPlayerManager* manager_; | 96 MediaPlayerManager* manager_; |
| 90 | 97 |
| 91 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); | 98 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); |
| 92 }; | 99 }; |
| 93 | 100 |
| 94 } // namespace media | 101 } // namespace media |
| 95 | 102 |
| 96 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ | 103 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ |
| OLD | NEW |