Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: media/base/android/media_drm_bridge.h

Issue 308073004: Add PlayerTracker and BrowserCdm interfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor fix Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser_cdm.h"
15 #include "media/base/media_export.h" 16 #include "media/base/media_export.h"
16 #include "media/base/media_keys.h" 17 #include "media/cdm/player_tracker_impl.h"
17 #include "url/gurl.h" 18 #include "url/gurl.h"
18 19
19 class GURL; 20 class GURL;
20 21
21 namespace media { 22 namespace media {
22 23
23 class MediaPlayerManager; 24 class MediaPlayerManager;
24 25
25 // This class provides DRM services for android EME implementation. 26 // This class provides DRM services for android EME implementation.
26 // TODO(qinmin): implement all the functions in this class. 27 // TODO(qinmin): implement all the functions in this class.
27 class MEDIA_EXPORT MediaDrmBridge : public MediaKeys { 28 class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm {
28 public: 29 public:
29 enum SecurityLevel { 30 enum SecurityLevel {
30 SECURITY_LEVEL_NONE = 0, 31 SECURITY_LEVEL_NONE = 0,
31 SECURITY_LEVEL_1 = 1, 32 SECURITY_LEVEL_1 = 1,
32 SECURITY_LEVEL_3 = 3, 33 SECURITY_LEVEL_3 = 3,
33 }; 34 };
34 35
35 typedef base::Callback<void(bool)> ResetCredentialsCB; 36 typedef base::Callback<void(bool)> ResetCredentialsCB;
36 37
37 virtual ~MediaDrmBridge(); 38 virtual ~MediaDrmBridge();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 82
82 // Returns true if |security_level| is successfully set, or false otherwise. 83 // Returns true if |security_level| is successfully set, or false otherwise.
83 // Call this function right after Create() and before any other calls. 84 // Call this function right after Create() and before any other calls.
84 // Note: 85 // Note:
85 // - If this function is not called, the default security level of the device 86 // - If this function is not called, the default security level of the device
86 // will be used. 87 // will be used.
87 // - It's recommended to call this function only once on a MediaDrmBridge 88 // - It's recommended to call this function only once on a MediaDrmBridge
88 // object. Calling this function multiples times may cause errors. 89 // object. Calling this function multiples times may cause errors.
89 bool SetSecurityLevel(SecurityLevel security_level); 90 bool SetSecurityLevel(SecurityLevel security_level);
90 91
91 // MediaKeys implementations. 92 // BrowserCdm implementations.
92 virtual bool CreateSession(uint32 session_id, 93 virtual bool CreateSession(uint32 session_id,
93 const std::string& content_type, 94 const std::string& content_type,
94 const uint8* init_data, 95 const uint8* init_data,
95 int init_data_length) OVERRIDE; 96 int init_data_length) OVERRIDE;
96 virtual void LoadSession(uint32 session_id, 97 virtual void LoadSession(uint32 session_id,
97 const std::string& web_session_id) OVERRIDE; 98 const std::string& web_session_id) OVERRIDE;
98 virtual void UpdateSession(uint32 session_id, 99 virtual void UpdateSession(uint32 session_id,
99 const uint8* response, 100 const uint8* response,
100 int response_length) OVERRIDE; 101 int response_length) OVERRIDE;
101 virtual void ReleaseSession(uint32 session_id) OVERRIDE; 102 virtual void ReleaseSession(uint32 session_id) OVERRIDE;
103 virtual int RegisterPlayer(const base::Closure& new_key_cb,
104 const base::Closure& cdm_destroyed_cb) OVERRIDE;
ddorwin 2014/05/30 20:50:05 UPDATE: Looking at the next file, this might need
xhwang 2014/06/02 20:11:43 This is really the reverse of SetCdm(). How about
105 virtual void UnregisterPlayer(int registration_id) OVERRIDE;
102 106
103 // Returns a MediaCrypto object if it's already created. Returns a null object 107 // Returns a MediaCrypto object if it's already created. Returns a null object
104 // otherwise. 108 // otherwise.
105 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); 109 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto();
106 110
107 // Sets callback which will be called when MediaCrypto is ready. 111 // Sets callback which will be called when MediaCrypto is ready.
108 // If |closure| is null, previously set callback will be cleared. 112 // If |closure| is null, previously set callback will be cleared.
109 void SetMediaCryptoReadyCB(const base::Closure& closure); 113 void SetMediaCryptoReadyCB(const base::Closure& closure);
110 114
111 // Called after a MediaCrypto object is created. 115 // Called after a MediaCrypto object is created.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 SessionCreatedCB session_created_cb_; 160 SessionCreatedCB session_created_cb_;
157 SessionMessageCB session_message_cb_; 161 SessionMessageCB session_message_cb_;
158 SessionReadyCB session_ready_cb_; 162 SessionReadyCB session_ready_cb_;
159 SessionClosedCB session_closed_cb_; 163 SessionClosedCB session_closed_cb_;
160 SessionErrorCB session_error_cb_; 164 SessionErrorCB session_error_cb_;
161 165
162 base::Closure media_crypto_ready_cb_; 166 base::Closure media_crypto_ready_cb_;
163 167
164 ResetCredentialsCB reset_credentials_cb_; 168 ResetCredentialsCB reset_credentials_cb_;
165 169
170 PlayerTrackerImpl player_tracker_;
171
166 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); 172 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge);
167 }; 173 };
168 174
169 } // namespace media 175 } // namespace media
170 176
171 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 177 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698