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

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

Issue 17289006: Separate CDM initialization from GenerateKeyRequest & remove key_system parameters. (Closed) Base URL: master
Patch Set: rebase only Created 7 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
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 "media/base/media_export.h" 13 #include "media/base/media_export.h"
14 #include "media/base/media_keys.h" 14 #include "media/base/media_keys.h"
15 15
16 namespace media { 16 namespace media {
17 17
18 // This class provides DRM services for android EME implementation. 18 // This class provides DRM services for android EME implementation.
19 // TODO(qinmin): implement all the functions in this class. 19 // TODO(qinmin): implement all the functions in this class.
20 class MEDIA_EXPORT MediaDrmBridge : public MediaKeys { 20 class MEDIA_EXPORT MediaDrmBridge : public MediaKeys {
21 public: 21 public:
22 // TODO(xhwang): Pass in |key_system|.
22 MediaDrmBridge(int media_keys_id, const std::vector<uint8>& uuid); 23 MediaDrmBridge(int media_keys_id, const std::vector<uint8>& uuid);
23 virtual ~MediaDrmBridge(); 24 virtual ~MediaDrmBridge();
24 25
25 // Checks whether DRM is available. 26 // Checks whether DRM is available.
26 static bool IsAvailable(); 27 static bool IsAvailable();
27 28
28 // MediaKeys implementations. 29 // MediaKeys implementations.
29 virtual bool GenerateKeyRequest(const std::string& key_system, 30 virtual bool GenerateKeyRequest(const std::string& type,
30 const std::string& type,
31 const uint8* init_data, 31 const uint8* init_data,
32 int init_data_length) OVERRIDE; 32 int init_data_length) OVERRIDE;
33 virtual void AddKey(const std::string& key_system, 33 virtual void AddKey(const uint8* key, int key_length,
34 const uint8* key, int key_length,
35 const uint8* init_data, int init_data_length, 34 const uint8* init_data, int init_data_length,
36 const std::string& session_id) OVERRIDE; 35 const std::string& session_id) OVERRIDE;
37 virtual void CancelKeyRequest(const std::string& key_system, 36 virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE;
38 const std::string& session_id) OVERRIDE;
39 37
40 // Drm related message was received. 38 // Drm related message was received.
41 void OnDrmEvent(JNIEnv* env, jobject, jstring session_id, 39 void OnDrmEvent(JNIEnv* env, jobject, jstring session_id,
42 jint event, jint extra, jstring data); 40 jint event, jint extra, jstring data);
43 41
44 // Called after we got the response for GenerateKeyRequest(). 42 // Called after we got the response for GenerateKeyRequest().
45 void OnKeyMessage(JNIEnv* env, jobject, jstring session_id, 43 void OnKeyMessage(JNIEnv* env, jobject, jstring session_id,
46 jbyteArray message, jstring destination_url); 44 jbyteArray message, jstring destination_url);
47 45
48 // Methods to create and release a MediaCrypto object. 46 // Methods to create and release a MediaCrypto object.
49 base::android::ScopedJavaLocalRef<jobject> CreateMediaCrypto( 47 base::android::ScopedJavaLocalRef<jobject> CreateMediaCrypto(
50 const std::string& session_id); 48 const std::string& session_id);
51 void ReleaseMediaCrypto(const std::string& session_id); 49 void ReleaseMediaCrypto(const std::string& session_id);
52 50
53 int media_keys_id() const { return media_keys_id_; } 51 int media_keys_id() const { return media_keys_id_; }
54 52
55 private: 53 private:
56 // Id of the MediaKeys object. 54 // Id of the MediaKeys object.
57 int media_keys_id_; 55 int media_keys_id_;
58 56
59 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); 57 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge);
60 }; 58 };
61 59
62 } // namespace media 60 } // namespace media
63 61
64 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 62 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
OLDNEW
« no previous file with comments | « content/renderer/media/webmediaplayer_proxy_impl_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