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

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

Issue 276973005: BrowserMediaPlayerManager manages MediaKeys objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MEDIA_EXPORT Created 6 years, 7 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>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 static bool IsKeySystemSupportedWithType( 52 static bool IsKeySystemSupportedWithType(
53 const std::string& key_system, 53 const std::string& key_system,
54 const std::string& container_mime_type); 54 const std::string& container_mime_type);
55 55
56 static bool IsSecureDecoderRequired(SecurityLevel security_level); 56 static bool IsSecureDecoderRequired(SecurityLevel security_level);
57 57
58 static bool RegisterMediaDrmBridge(JNIEnv* env); 58 static bool RegisterMediaDrmBridge(JNIEnv* env);
59 59
60 // Returns a MediaDrmBridge instance if |key_system| is supported, or a NULL 60 // Returns a MediaDrmBridge instance if |key_system| is supported, or a NULL
61 // pointer otherwise. 61 // pointer otherwise.
62 static scoped_ptr<MediaDrmBridge> Create(int cdm_id, 62 static scoped_ptr<MediaDrmBridge> Create(
63 const std::string& key_system, 63 const std::string& key_system,
64 const GURL& security_origin, 64 const SessionCreatedCB& session_created_cb,
65 MediaPlayerManager* manager); 65 const SessionMessageCB& session_message_cb,
66 const SessionReadyCB& session_ready_cb,
67 const SessionClosedCB& session_closed_cb,
68 const SessionErrorCB& session_error_cb);
69
70 // Returns a MediaDrmBridge instance if |key_system| is supported, or a NULL
71 // otherwise. No session callbacks are provided. This is used when we need to
72 // use MediaDrmBridge without creating any sessions.
73 static scoped_ptr<MediaDrmBridge> Create(const std::string& key_system);
ddorwin 2014/05/13 00:59:38 For clarity (and because overloading is not allowe
xhwang 2014/05/14 16:42:06 Done.
66 74
67 // Returns true if |security_level| is successfully set, or false otherwise. 75 // Returns true if |security_level| is successfully set, or false otherwise.
68 // Call this function right after Create() and before any other calls. 76 // Call this function right after Create() and before any other calls.
69 // Note: 77 // Note:
70 // - If this function is not called, the default security level of the device 78 // - If this function is not called, the default security level of the device
71 // will be used. 79 // will be used.
72 // - It's recommended to call this function only once on a MediaDrmBridge 80 // - It's recommended to call this function only once on a MediaDrmBridge
73 // object. Calling this function multiples times may cause errors. 81 // object. Calling this function multiples times may cause errors.
74 bool SetSecurityLevel(SecurityLevel security_level); 82 bool SetSecurityLevel(SecurityLevel security_level);
75 83
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 120
113 // Reset the device credentials. 121 // Reset the device credentials.
114 void ResetDeviceCredentials(const ResetCredentialsCB& callback); 122 void ResetDeviceCredentials(const ResetCredentialsCB& callback);
115 123
116 // Called by the java object when credential reset is completed. 124 // Called by the java object when credential reset is completed.
117 void OnResetDeviceCredentialsCompleted(JNIEnv* env, jobject, bool success); 125 void OnResetDeviceCredentialsCompleted(JNIEnv* env, jobject, bool success);
118 126
119 // Helper function to determine whether a protected surface is needed for the 127 // Helper function to determine whether a protected surface is needed for the
120 // video playback. 128 // video playback.
121 bool IsProtectedSurfaceRequired(); 129 bool IsProtectedSurfaceRequired();
122 130
ddorwin 2014/05/13 00:59:38 Note: My earlier comments wondered whether we shou
xhwang 2014/05/14 16:42:06 See my reply above for discussion.
123 int cdm_id() const { return cdm_id_; }
124
125 const GURL& security_origin() const { return security_origin_; }
126
127 private: 131 private:
128 MediaDrmBridge(int cdm_id, 132 MediaDrmBridge(const std::vector<uint8>& scheme_uuid,
129 const std::vector<uint8>& scheme_uuid, 133 const SessionCreatedCB& session_created_cb,
130 const GURL& security_origin, 134 const SessionMessageCB& session_message_cb,
131 MediaPlayerManager* manager); 135 const SessionReadyCB& session_ready_cb,
136 const SessionClosedCB& session_closed_cb,
137 const SessionErrorCB& session_error_cb);
132 138
133 // Get the security level of the media. 139 // Get the security level of the media.
134 SecurityLevel GetSecurityLevel(); 140 SecurityLevel GetSecurityLevel();
135 141
136 // ID of the CDM object.
137 int cdm_id_;
138
139 // UUID of the key system. 142 // UUID of the key system.
140 std::vector<uint8> scheme_uuid_; 143 std::vector<uint8> scheme_uuid_;
141 144
142 // media stream's security origin.
143 const GURL security_origin_;
144
145 // Java MediaDrm instance. 145 // Java MediaDrm instance.
146 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_; 146 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_;
147 147
148 // Non-owned pointer. 148 // Callbacks for firing session events.
149 MediaPlayerManager* manager_; 149 SessionCreatedCB session_created_cb_;
150 SessionMessageCB session_message_cb_;
151 SessionReadyCB session_ready_cb_;
152 SessionClosedCB session_closed_cb_;
153 SessionErrorCB session_error_cb_;
150 154
151 base::Closure media_crypto_ready_cb_; 155 base::Closure media_crypto_ready_cb_;
152 156
153 ResetCredentialsCB reset_credentials_cb_; 157 ResetCredentialsCB reset_credentials_cb_;
154 158
155 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); 159 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge);
156 }; 160 };
157 161
158 } // namespace media 162 } // namespace media
159 163
160 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 164 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698