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

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: 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,
49 const std::string& init_data_type,
51 const unsigned char* init_data, 50 const unsigned char* init_data,
52 unsigned init_data_length); 51 unsigned init_data_length);
53 52
54 blink::WebMediaPlayer::MediaKeyException AddKey( 53 blink::WebMediaPlayer::MediaKeyException AddKey(
55 const blink::WebString& key_system, 54 const blink::WebString& key_system,
56 const unsigned char* key, 55 const unsigned char* key,
57 unsigned key_length, 56 unsigned key_length,
58 const unsigned char* init_data, 57 const unsigned char* init_data,
59 unsigned init_data_length, 58 unsigned init_data_length,
60 const blink::WebString& session_id); 59 const blink::WebString& session_id);
61 60
62 blink::WebMediaPlayer::MediaKeyException CancelKeyRequest( 61 blink::WebMediaPlayer::MediaKeyException CancelKeyRequest(
63 const blink::WebString& key_system, 62 const blink::WebString& key_system,
64 const blink::WebString& session_id); 63 const blink::WebString& session_id);
65 64
66 Demuxer::NeedKeyCB CreateNeedKeyCB();
67
68 void OnPipelineDecryptError(); 65 void OnPipelineDecryptError();
69 66
70 private: 67 private:
71 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequestInternal( 68 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequestInternal(
72 blink::WebLocalFrame* frame, 69 blink::WebLocalFrame* frame,
73 const std::string& key_system, 70 const std::string& key_system,
71 const std::string& init_data_type,
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
109 // through GenerateKeyRequest() directly from WebKit.
110 std::string init_data_type_;
111
112 SetCdmContextCB set_cdm_context_cb_; 103 SetCdmContextCB set_cdm_context_cb_;
113 104
114 // Manages decryption keys and decrypts encrypted frames. 105 // Manages decryption keys and decrypts encrypted frames.
115 scoped_ptr<ProxyDecryptor> proxy_decryptor_; 106 scoped_ptr<ProxyDecryptor> proxy_decryptor_;
116 107
117 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupport); 108 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupport);
118 }; 109 };
119 110
120 } // namespace media 111 } // namespace media
121 112
122 #endif // MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ 113 #endif // MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_
OLDNEW
« no previous file with comments | « no previous file | media/blink/encrypted_media_player_support.cc » ('j') | media/blink/webmediaplayer_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698