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

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: comments addressed 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
« no previous file with comments | « media/base/android/cdm_factory_android.cc ('k') | media/base/android/media_drm_bridge.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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> CreateSessionless(
74 const std::string& key_system);
66 75
67 // Returns true if |security_level| is successfully set, or false otherwise. 76 // Returns true if |security_level| is successfully set, or false otherwise.
68 // Call this function right after Create() and before any other calls. 77 // Call this function right after Create() and before any other calls.
69 // Note: 78 // Note:
70 // - If this function is not called, the default security level of the device 79 // - If this function is not called, the default security level of the device
71 // will be used. 80 // will be used.
72 // - It's recommended to call this function only once on a MediaDrmBridge 81 // - It's recommended to call this function only once on a MediaDrmBridge
73 // object. Calling this function multiples times may cause errors. 82 // object. Calling this function multiples times may cause errors.
74 bool SetSecurityLevel(SecurityLevel security_level); 83 bool SetSecurityLevel(SecurityLevel security_level);
75 84
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Reset the device credentials. 122 // Reset the device credentials.
114 void ResetDeviceCredentials(const ResetCredentialsCB& callback); 123 void ResetDeviceCredentials(const ResetCredentialsCB& callback);
115 124
116 // Called by the java object when credential reset is completed. 125 // Called by the java object when credential reset is completed.
117 void OnResetDeviceCredentialsCompleted(JNIEnv* env, jobject, bool success); 126 void OnResetDeviceCredentialsCompleted(JNIEnv* env, jobject, bool success);
118 127
119 // Helper function to determine whether a protected surface is needed for the 128 // Helper function to determine whether a protected surface is needed for the
120 // video playback. 129 // video playback.
121 bool IsProtectedSurfaceRequired(); 130 bool IsProtectedSurfaceRequired();
122 131
123 int cdm_id() const { return cdm_id_; }
124
125 const GURL& security_origin() const { return security_origin_; }
126
127 private: 132 private:
128 MediaDrmBridge(int cdm_id, 133 MediaDrmBridge(const std::vector<uint8>& scheme_uuid,
129 const std::vector<uint8>& scheme_uuid, 134 const SessionCreatedCB& session_created_cb,
130 const GURL& security_origin, 135 const SessionMessageCB& session_message_cb,
131 MediaPlayerManager* manager); 136 const SessionReadyCB& session_ready_cb,
137 const SessionClosedCB& session_closed_cb,
138 const SessionErrorCB& session_error_cb);
132 139
133 // Get the security level of the media. 140 // Get the security level of the media.
134 SecurityLevel GetSecurityLevel(); 141 SecurityLevel GetSecurityLevel();
135 142
136 // ID of the CDM object.
137 int cdm_id_;
138
139 // UUID of the key system. 143 // UUID of the key system.
140 std::vector<uint8> scheme_uuid_; 144 std::vector<uint8> scheme_uuid_;
141 145
142 // media stream's security origin.
143 const GURL security_origin_;
144
145 // Java MediaDrm instance. 146 // Java MediaDrm instance.
146 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_; 147 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_;
147 148
148 // Non-owned pointer. 149 // Callbacks for firing session events.
149 MediaPlayerManager* manager_; 150 SessionCreatedCB session_created_cb_;
151 SessionMessageCB session_message_cb_;
152 SessionReadyCB session_ready_cb_;
153 SessionClosedCB session_closed_cb_;
154 SessionErrorCB session_error_cb_;
150 155
151 base::Closure media_crypto_ready_cb_; 156 base::Closure media_crypto_ready_cb_;
152 157
153 ResetCredentialsCB reset_credentials_cb_; 158 ResetCredentialsCB reset_credentials_cb_;
154 159
155 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); 160 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge);
156 }; 161 };
157 162
158 } // namespace media 163 } // namespace media
159 164
160 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 165 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
OLDNEW
« no previous file with comments | « media/base/android/cdm_factory_android.cc ('k') | media/base/android/media_drm_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698