OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CONTENT_RENDERER_MEDIA_CDM_PPAPI_DECRYPTOR_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CDM_PPAPI_DECRYPTOR_H_ |
6 #define CONTENT_RENDERER_MEDIA_CDM_PPAPI_DECRYPTOR_H_ | 6 #define CONTENT_RENDERER_MEDIA_CDM_PPAPI_DECRYPTOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "content/renderer/media/cdm/pepper_cdm_wrapper.h" | 16 #include "content/renderer/media/cdm/pepper_cdm_wrapper.h" |
17 #include "media/base/cdm_context.h" | 17 #include "media/base/cdm_context.h" |
18 #include "media/base/cdm_factory.h" | 18 #include "media/base/cdm_factory.h" |
19 #include "media/base/content_decryption_module.h" | |
19 #include "media/base/decryptor.h" | 20 #include "media/base/decryptor.h" |
20 #include "media/base/media_keys.h" | |
21 #include "media/base/video_decoder_config.h" | 21 #include "media/base/video_decoder_config.h" |
22 | 22 |
23 class GURL; | 23 class GURL; |
24 | 24 |
25 namespace base { | 25 namespace base { |
26 class SingleThreadTaskRunner; | 26 class SingleThreadTaskRunner; |
27 } | 27 } |
28 | 28 |
29 namespace content { | 29 namespace content { |
30 class ContentDecryptorDelegate; | 30 class ContentDecryptorDelegate; |
31 | 31 |
32 // PpapiDecryptor implements media::MediaKeys and media::Decryptor and forwards | 32 // PpapiDecryptor implements media::ContentDecryptionModule and media::Decryptor |
33 // and forwards | |
33 // all calls to the PluginInstance. | 34 // all calls to the PluginInstance. |
jrummell
2016/12/12 22:08:39
nit: Can you combine the comment lines?
xhwang
2016/12/12 22:32:50
Done.
| |
34 // This class should always be created & destroyed on the main renderer thread. | 35 // This class should always be created & destroyed on the main renderer thread. |
35 class PpapiDecryptor : public media::MediaKeys, | 36 class PpapiDecryptor : public media::ContentDecryptionModule, |
36 public media::CdmContext, | 37 public media::CdmContext, |
37 public media::Decryptor { | 38 public media::Decryptor { |
38 public: | 39 public: |
39 static void Create( | 40 static void Create( |
40 const std::string& key_system, | 41 const std::string& key_system, |
41 const GURL& security_origin, | 42 const GURL& security_origin, |
42 bool allow_distinctive_identifier, | 43 bool allow_distinctive_identifier, |
43 bool allow_persistent_state, | 44 bool allow_persistent_state, |
44 const CreatePepperCdmCB& create_pepper_cdm_cb, | 45 const CreatePepperCdmCB& create_pepper_cdm_cb, |
45 const media::SessionMessageCB& session_message_cb, | 46 const media::SessionMessageCB& session_message_cb, |
46 const media::SessionClosedCB& session_closed_cb, | 47 const media::SessionClosedCB& session_closed_cb, |
47 const media::SessionKeysChangeCB& session_keys_change_cb, | 48 const media::SessionKeysChangeCB& session_keys_change_cb, |
48 const media::SessionExpirationUpdateCB& session_expiration_update_cb, | 49 const media::SessionExpirationUpdateCB& session_expiration_update_cb, |
49 const media::CdmCreatedCB& cdm_created_cb); | 50 const media::CdmCreatedCB& cdm_created_cb); |
50 | 51 |
51 // media::MediaKeys implementation. | 52 // media::ContentDecryptionModule implementation. |
52 void SetServerCertificate( | 53 void SetServerCertificate( |
53 const std::vector<uint8_t>& certificate, | 54 const std::vector<uint8_t>& certificate, |
54 std::unique_ptr<media::SimpleCdmPromise> promise) override; | 55 std::unique_ptr<media::SimpleCdmPromise> promise) override; |
55 void CreateSessionAndGenerateRequest( | 56 void CreateSessionAndGenerateRequest( |
56 SessionType session_type, | 57 SessionType session_type, |
57 media::EmeInitDataType init_data_type, | 58 media::EmeInitDataType init_data_type, |
58 const std::vector<uint8_t>& init_data, | 59 const std::vector<uint8_t>& init_data, |
59 std::unique_ptr<media::NewSessionCdmPromise> promise) override; | 60 std::unique_ptr<media::NewSessionCdmPromise> promise) override; |
60 void LoadSession( | 61 void LoadSession( |
61 SessionType session_type, | 62 SessionType session_type, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 | 107 |
107 void InitializeCdm(const std::string& key_system, | 108 void InitializeCdm(const std::string& key_system, |
108 bool allow_distinctive_identifier, | 109 bool allow_distinctive_identifier, |
109 bool allow_persistent_state, | 110 bool allow_persistent_state, |
110 std::unique_ptr<media::SimpleCdmPromise> promise); | 111 std::unique_ptr<media::SimpleCdmPromise> promise); |
111 | 112 |
112 void OnDecoderInitialized(StreamType stream_type, bool success); | 113 void OnDecoderInitialized(StreamType stream_type, bool success); |
113 | 114 |
114 // Callbacks for |plugin_cdm_delegate_| to fire session events. | 115 // Callbacks for |plugin_cdm_delegate_| to fire session events. |
115 void OnSessionMessage(const std::string& session_id, | 116 void OnSessionMessage(const std::string& session_id, |
116 MediaKeys::MessageType message_type, | 117 ContentDecryptionModule::MessageType message_type, |
117 const std::vector<uint8_t>& message); | 118 const std::vector<uint8_t>& message); |
118 void OnSessionKeysChange(const std::string& session_id, | 119 void OnSessionKeysChange(const std::string& session_id, |
119 bool has_additional_usable_key, | 120 bool has_additional_usable_key, |
120 media::CdmKeysInfo keys_info); | 121 media::CdmKeysInfo keys_info); |
121 void OnSessionExpirationUpdate(const std::string& session_id, | 122 void OnSessionExpirationUpdate(const std::string& session_id, |
122 base::Time new_expiry_time); | 123 base::Time new_expiry_time); |
123 void OnSessionClosed(const std::string& session_id); | 124 void OnSessionClosed(const std::string& session_id); |
124 | 125 |
125 void AttemptToResumePlayback(); | 126 void AttemptToResumePlayback(); |
126 | 127 |
(...skipping 23 matching lines...) Expand all Loading... | |
150 | 151 |
151 // NOTE: Weak pointers must be invalidated before all other member variables. | 152 // NOTE: Weak pointers must be invalidated before all other member variables. |
152 base::WeakPtrFactory<PpapiDecryptor> weak_ptr_factory_; | 153 base::WeakPtrFactory<PpapiDecryptor> weak_ptr_factory_; |
153 | 154 |
154 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); | 155 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); |
155 }; | 156 }; |
156 | 157 |
157 } // namespace content | 158 } // namespace content |
158 | 159 |
159 #endif // CONTENT_RENDERER_MEDIA_CDM_PPAPI_DECRYPTOR_H_ | 160 #endif // CONTENT_RENDERER_MEDIA_CDM_PPAPI_DECRYPTOR_H_ |
OLD | NEW |