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

Side by Side Diff: media/blink/encrypted_media_player_support.h

Issue 759933003: Move OnNeedKey() to WebMediaPlayerImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 6 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ 5 #ifndef MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_
6 #define MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ 6 #define MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 13 matching lines...) Expand all
24 class WebMediaPlayerClient; 24 class WebMediaPlayerClient;
25 class WebString; 25 class WebString;
26 } 26 }
27 27
28 namespace media { 28 namespace media {
29 29
30 class WebContentDecryptionModuleImpl; 30 class WebContentDecryptionModuleImpl;
31 31
32 // Provides support to prefixed EME implementation. 32 // Provides support to prefixed EME implementation.
33 // Do NOT add unprefixed EME functionality to this class! 33 // Do NOT add unprefixed EME functionality to this class!
34 // TODO(xhwang): Move CreateNeedKeyCB() outside this class. Then when we 34 // TODO(xhwang): When deprecating prefixed EME support, drop this whole file.
35 // deprecate prefixed EME support, drop this whole file.
36
37 class EncryptedMediaPlayerSupport 35 class EncryptedMediaPlayerSupport
38 : public base::SupportsWeakPtr<EncryptedMediaPlayerSupport> { 36 : public base::SupportsWeakPtr<EncryptedMediaPlayerSupport> {
39 public: 37 public:
40 typedef base::Callback<void(CdmContext*, const CdmAttachedCB&)> 38 typedef base::Callback<void(CdmContext*, const CdmAttachedCB&)>
41 SetCdmContextCB; 39 SetCdmContextCB;
42 40
43 EncryptedMediaPlayerSupport(scoped_ptr<CdmFactory> cdm_factory, 41 EncryptedMediaPlayerSupport(scoped_ptr<CdmFactory> cdm_factory,
44 blink::WebMediaPlayerClient* client, 42 blink::WebMediaPlayerClient* client,
45 const SetCdmContextCB& set_cdm_context_cb); 43 const SetCdmContextCB& set_cdm_context_cb);
46 ~EncryptedMediaPlayerSupport(); 44 ~EncryptedMediaPlayerSupport();
47 45
48 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest( 46 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest(
49 blink::WebLocalFrame* frame, 47 blink::WebLocalFrame* frame,
50 const blink::WebString& key_system, 48 const blink::WebString& key_system,
51 const unsigned char* init_data, 49 const unsigned char* init_data,
52 unsigned init_data_length); 50 unsigned init_data_length);
53 51
54 blink::WebMediaPlayer::MediaKeyException AddKey( 52 blink::WebMediaPlayer::MediaKeyException AddKey(
55 const blink::WebString& key_system, 53 const blink::WebString& key_system,
56 const unsigned char* key, 54 const unsigned char* key,
57 unsigned key_length, 55 unsigned key_length,
58 const unsigned char* init_data, 56 const unsigned char* init_data,
59 unsigned init_data_length, 57 unsigned init_data_length,
60 const blink::WebString& session_id); 58 const blink::WebString& session_id);
61 59
62 blink::WebMediaPlayer::MediaKeyException CancelKeyRequest( 60 blink::WebMediaPlayer::MediaKeyException CancelKeyRequest(
63 const blink::WebString& key_system, 61 const blink::WebString& key_system,
64 const blink::WebString& session_id); 62 const blink::WebString& session_id);
65 63
66 Demuxer::NeedKeyCB CreateNeedKeyCB(); 64 void SetInitDataType(const std::string& init_data_type);
67 65
68 void OnPipelineDecryptError(); 66 void OnPipelineDecryptError();
69 67
70 private: 68 private:
71 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequestInternal( 69 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequestInternal(
72 blink::WebLocalFrame* frame, 70 blink::WebLocalFrame* frame,
73 const std::string& key_system, 71 const std::string& key_system,
74 const unsigned char* init_data, 72 const unsigned char* init_data,
75 unsigned init_data_length); 73 unsigned init_data_length);
76 74
77 blink::WebMediaPlayer::MediaKeyException AddKeyInternal( 75 blink::WebMediaPlayer::MediaKeyException AddKeyInternal(
78 const std::string& key_system, 76 const std::string& key_system,
79 const unsigned char* key, 77 const unsigned char* key,
80 unsigned key_length, 78 unsigned key_length,
81 const unsigned char* init_data, 79 const unsigned char* init_data,
82 unsigned init_data_length, 80 unsigned init_data_length,
83 const std::string& session_id); 81 const std::string& session_id);
84 82
85 blink::WebMediaPlayer::MediaKeyException CancelKeyRequestInternal( 83 blink::WebMediaPlayer::MediaKeyException CancelKeyRequestInternal(
86 const std::string& key_system, 84 const std::string& key_system,
87 const std::string& session_id); 85 const std::string& session_id);
88 86
89 void OnNeedKey(const std::string& type,
90 const std::vector<uint8>& init_data);
91
92 void OnKeyAdded(const std::string& session_id); 87 void OnKeyAdded(const std::string& session_id);
93 void OnKeyError(const std::string& session_id, 88 void OnKeyError(const std::string& session_id,
94 MediaKeys::KeyError error_code, 89 MediaKeys::KeyError error_code,
95 uint32 system_code); 90 uint32 system_code);
96 void OnKeyMessage(const std::string& session_id, 91 void OnKeyMessage(const std::string& session_id,
97 const std::vector<uint8>& message, 92 const std::vector<uint8>& message,
98 const GURL& destination_url); 93 const GURL& destination_url);
99 94
100 scoped_ptr<CdmFactory> cdm_factory_; 95 scoped_ptr<CdmFactory> cdm_factory_;
101 96
102 blink::WebMediaPlayerClient* client_; 97 blink::WebMediaPlayerClient* client_;
103 98
104 // The currently selected key system. Empty string means that no key system 99 // The currently selected key system. Empty string means that no key system
105 // has been selected. 100 // has been selected.
106 std::string current_key_system_; 101 std::string current_key_system_;
107 102
108 // Temporary for EME v0.1. In the future the init data type should be passed 103 // We assume all streams are from the same container, thus have the same
109 // through GenerateKeyRequest() directly from WebKit. 104 // init data type.
110 std::string init_data_type_; 105 std::string init_data_type_;
111 106
112 SetCdmContextCB set_cdm_context_cb_; 107 SetCdmContextCB set_cdm_context_cb_;
113 108
114 // Manages decryption keys and decrypts encrypted frames. 109 // Manages decryption keys and decrypts encrypted frames.
115 scoped_ptr<ProxyDecryptor> proxy_decryptor_; 110 scoped_ptr<ProxyDecryptor> proxy_decryptor_;
116 111
117 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupport); 112 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupport);
118 }; 113 };
119 114
120 } // namespace media 115 } // namespace media
121 116
122 #endif // MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ 117 #endif // MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.cc ('k') | media/blink/encrypted_media_player_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698