| 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> |
| 11 | 11 |
| 12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "media/base/media_export.h" | 15 #include "media/base/media_export.h" |
| 16 #include "media/base/media_keys.h" | 16 #include "media/base/media_keys.h" |
| 17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 18 | 18 |
| 19 class GURL; | 19 class GURL; |
| 20 | 20 |
| 21 namespace media { | 21 namespace media { |
| 22 | 22 |
| 23 class MediaPlayerManager; | 23 class MediaPlayerManager; |
| 24 | 24 |
| 25 // This class provides DRM services for android EME implementation. | 25 // This class provides DRM services for android EME implementation. |
| 26 // TODO(qinmin): implement all the functions in this class. | 26 // TODO(qinmin): implement all the functions in this class. |
| 27 class MEDIA_EXPORT MediaDrmBridge : public MediaKeys { | 27 class MEDIA_EXPORT MediaDrmBridge { |
| 28 public: | 28 public: |
| 29 enum SecurityLevel { | 29 enum SecurityLevel { |
| 30 SECURITY_LEVEL_NONE = 0, | 30 SECURITY_LEVEL_NONE = 0, |
| 31 SECURITY_LEVEL_1 = 1, | 31 SECURITY_LEVEL_1 = 1, |
| 32 SECURITY_LEVEL_3 = 3, | 32 SECURITY_LEVEL_3 = 3, |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 typedef base::Callback<void(bool)> ResetCredentialsCB; | 35 typedef base::Callback<void(bool)> ResetCredentialsCB; |
| 36 | 36 |
| 37 virtual ~MediaDrmBridge(); | 37 virtual ~MediaDrmBridge(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 66 | 66 |
| 67 // Returns true if |security_level| is successfully set, or false otherwise. | 67 // Returns true if |security_level| is successfully set, or false otherwise. |
| 68 // Call this function right after Create() and before any other calls. | 68 // Call this function right after Create() and before any other calls. |
| 69 // Note: | 69 // Note: |
| 70 // - If this function is not called, the default security level of the device | 70 // - If this function is not called, the default security level of the device |
| 71 // will be used. | 71 // will be used. |
| 72 // - It's recommended to call this function only once on a MediaDrmBridge | 72 // - It's recommended to call this function only once on a MediaDrmBridge |
| 73 // object. Calling this function multiples times may cause errors. | 73 // object. Calling this function multiples times may cause errors. |
| 74 bool SetSecurityLevel(SecurityLevel security_level); | 74 bool SetSecurityLevel(SecurityLevel security_level); |
| 75 | 75 |
| 76 // MediaKeys implementations. | 76 // Media key operations. |
| 77 virtual bool CreateSession(uint32 session_id, | 77 bool CreateSession(uint32 session_id, |
| 78 const std::string& content_type, | 78 const std::string& content_type, |
| 79 const uint8* init_data, | 79 const uint8* init_data, |
| 80 int init_data_length) OVERRIDE; | 80 int init_data_length); |
| 81 virtual void LoadSession(uint32 session_id, | 81 void LoadSession(uint32 session_id, const std::string& web_session_id); |
| 82 const std::string& web_session_id) OVERRIDE; | 82 void UpdateSession(uint32 session_id, |
| 83 virtual void UpdateSession(uint32 session_id, | 83 const uint8* response, |
| 84 const uint8* response, | 84 int response_length); |
| 85 int response_length) OVERRIDE; | 85 void ReleaseSession(uint32 session_id); |
| 86 virtual void ReleaseSession(uint32 session_id) OVERRIDE; | |
| 87 | 86 |
| 88 // Returns a MediaCrypto object if it's already created. Returns a null object | 87 // Returns a MediaCrypto object if it's already created. Returns a null object |
| 89 // otherwise. | 88 // otherwise. |
| 90 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); | 89 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); |
| 91 | 90 |
| 92 // Sets callback which will be called when MediaCrypto is ready. | 91 // Sets callback which will be called when MediaCrypto is ready. |
| 93 // If |closure| is null, previously set callback will be cleared. | 92 // If |closure| is null, previously set callback will be cleared. |
| 94 void SetMediaCryptoReadyCB(const base::Closure& closure); | 93 void SetMediaCryptoReadyCB(const base::Closure& closure); |
| 95 | 94 |
| 96 // Called after a MediaCrypto object is created. | 95 // Called after a MediaCrypto object is created. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 base::Closure media_crypto_ready_cb_; | 150 base::Closure media_crypto_ready_cb_; |
| 152 | 151 |
| 153 ResetCredentialsCB reset_credentials_cb_; | 152 ResetCredentialsCB reset_credentials_cb_; |
| 154 | 153 |
| 155 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); | 154 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); |
| 156 }; | 155 }; |
| 157 | 156 |
| 158 } // namespace media | 157 } // namespace media |
| 159 | 158 |
| 160 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ | 159 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ |
| OLD | NEW |