OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_ |
6 #define CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_ | 6 #define CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
| 11 #include <vector> |
11 | 12 |
12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
13 #include "base/callback_helpers.h" | 14 #include "base/callback_helpers.h" |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
17 #include "media/base/cdm_promise.h" | 18 #include "media/base/cdm_promise.h" |
18 #include "media/base/cdm_promise_adapter.h" | 19 #include "media/base/cdm_promise_adapter.h" |
19 #include "media/base/channel_layout.h" | 20 #include "media/base/channel_layout.h" |
20 #include "media/base/decryptor.h" | 21 #include "media/base/decryptor.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 const media::SessionMessageCB& session_message_cb, | 54 const media::SessionMessageCB& session_message_cb, |
54 const media::SessionClosedCB& session_closed_cb, | 55 const media::SessionClosedCB& session_closed_cb, |
55 const media::LegacySessionErrorCB& legacy_session_error_cb, | 56 const media::LegacySessionErrorCB& legacy_session_error_cb, |
56 const media::SessionKeysChangeCB& session_keys_change_cb, | 57 const media::SessionKeysChangeCB& session_keys_change_cb, |
57 const media::SessionExpirationUpdateCB& session_expiration_update_cb, | 58 const media::SessionExpirationUpdateCB& session_expiration_update_cb, |
58 const base::Closure& fatal_plugin_error_cb); | 59 const base::Closure& fatal_plugin_error_cb); |
59 | 60 |
60 void InstanceCrashed(); | 61 void InstanceCrashed(); |
61 | 62 |
62 // Provides access to PPP_ContentDecryptor_Private. | 63 // Provides access to PPP_ContentDecryptor_Private. |
63 void SetServerCertificate(const uint8_t* certificate, | 64 void SetServerCertificate(const std::vector<uint8_t>& certificate, |
64 uint32_t certificate_length, | |
65 scoped_ptr<media::SimpleCdmPromise> promise); | 65 scoped_ptr<media::SimpleCdmPromise> promise); |
66 void CreateSessionAndGenerateRequest( | 66 void CreateSessionAndGenerateRequest( |
67 media::MediaKeys::SessionType session_type, | 67 media::MediaKeys::SessionType session_type, |
68 media::EmeInitDataType init_data_type, | 68 media::EmeInitDataType init_data_type, |
69 const uint8* init_data, | 69 const std::vector<uint8_t>& init_data, |
70 int init_data_length, | |
71 scoped_ptr<media::NewSessionCdmPromise> promise); | 70 scoped_ptr<media::NewSessionCdmPromise> promise); |
72 void LoadSession(media::MediaKeys::SessionType session_type, | 71 void LoadSession(media::MediaKeys::SessionType session_type, |
73 const std::string& session_id, | 72 const std::string& session_id, |
74 scoped_ptr<media::NewSessionCdmPromise> promise); | 73 scoped_ptr<media::NewSessionCdmPromise> promise); |
75 void UpdateSession(const std::string& session_id, | 74 void UpdateSession(const std::string& session_id, |
76 const uint8* response, | 75 const std::vector<uint8_t>& response, |
77 int response_length, | |
78 scoped_ptr<media::SimpleCdmPromise> promise); | 76 scoped_ptr<media::SimpleCdmPromise> promise); |
79 void CloseSession(const std::string& session_id, | 77 void CloseSession(const std::string& session_id, |
80 scoped_ptr<media::SimpleCdmPromise> promise); | 78 scoped_ptr<media::SimpleCdmPromise> promise); |
81 void RemoveSession(const std::string& session_id, | 79 void RemoveSession(const std::string& session_id, |
82 scoped_ptr<media::SimpleCdmPromise> promise); | 80 scoped_ptr<media::SimpleCdmPromise> promise); |
83 bool Decrypt(media::Decryptor::StreamType stream_type, | 81 bool Decrypt(media::Decryptor::StreamType stream_type, |
84 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, | 82 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
85 const media::Decryptor::DecryptCB& decrypt_cb); | 83 const media::Decryptor::DecryptCB& decrypt_cb); |
86 bool CancelDecrypt(media::Decryptor::StreamType stream_type); | 84 bool CancelDecrypt(media::Decryptor::StreamType stream_type); |
87 bool InitializeAudioDecoder( | 85 bool InitializeAudioDecoder( |
88 const media::AudioDecoderConfig& decoder_config, | 86 const media::AudioDecoderConfig& decoder_config, |
89 const media::Decryptor::DecoderInitCB& decoder_init_cb); | 87 const media::Decryptor::DecoderInitCB& decoder_init_cb); |
90 bool InitializeVideoDecoder( | 88 bool InitializeVideoDecoder( |
91 const media::VideoDecoderConfig& decoder_config, | 89 const media::VideoDecoderConfig& decoder_config, |
92 const media::Decryptor::DecoderInitCB& decoder_init_cb); | 90 const media::Decryptor::DecoderInitCB& decoder_init_cb); |
93 // TODO(tomfinegan): Add callback args for DeinitializeDecoder() and | 91 // TODO(tomfinegan): Add callback args for DeinitializeDecoder() and |
94 // ResetDecoder() | 92 // ResetDecoder() |
95 bool DeinitializeDecoder(media::Decryptor::StreamType stream_type); | 93 bool DeinitializeDecoder(media::Decryptor::StreamType stream_type); |
96 bool ResetDecoder(media::Decryptor::StreamType stream_type); | 94 bool ResetDecoder(media::Decryptor::StreamType stream_type); |
97 // Note: These methods can be used with unencrypted data. | 95 // Note: These methods can be used with unencrypted data. |
98 bool DecryptAndDecodeAudio( | 96 bool DecryptAndDecodeAudio( |
99 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, | 97 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
100 const media::Decryptor::AudioDecodeCB& audio_decode_cb); | 98 const media::Decryptor::AudioDecodeCB& audio_decode_cb); |
101 bool DecryptAndDecodeVideo( | 99 bool DecryptAndDecodeVideo( |
102 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, | 100 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
103 const media::Decryptor::VideoDecodeCB& video_decode_cb); | 101 const media::Decryptor::VideoDecodeCB& video_decode_cb); |
104 | 102 |
105 // PPB_ContentDecryptor_Private dispatching methods. | 103 // PPB_ContentDecryptor_Private dispatching methods. |
106 void OnPromiseResolved(uint32 promise_id); | 104 void OnPromiseResolved(uint32_t promise_id); |
107 void OnPromiseResolvedWithSession(uint32 promise_id, PP_Var session_id); | 105 void OnPromiseResolvedWithSession(uint32_t promise_id, PP_Var session_id); |
108 void OnPromiseRejected(uint32 promise_id, | 106 void OnPromiseRejected(uint32_t promise_id, |
109 PP_CdmExceptionCode exception_code, | 107 PP_CdmExceptionCode exception_code, |
110 uint32 system_code, | 108 uint32_t system_code, |
111 PP_Var error_description); | 109 PP_Var error_description); |
112 void OnSessionMessage(PP_Var session_id, | 110 void OnSessionMessage(PP_Var session_id, |
113 PP_CdmMessageType message_type, | 111 PP_CdmMessageType message_type, |
114 PP_Var message, | 112 PP_Var message, |
115 PP_Var legacy_destination_url); | 113 PP_Var legacy_destination_url); |
116 void OnSessionKeysChange(PP_Var session_id, | 114 void OnSessionKeysChange(PP_Var session_id, |
117 PP_Bool has_additional_usable_key, | 115 PP_Bool has_additional_usable_key, |
118 uint32_t key_count, | 116 uint32_t key_count, |
119 const struct PP_KeyInformation key_information[]); | 117 const struct PP_KeyInformation key_information[]); |
120 void OnSessionExpirationChange(PP_Var session_id, PP_Time new_expiry_time); | 118 void OnSessionExpirationChange(PP_Var session_id, PP_Time new_expiry_time); |
121 void OnSessionClosed(PP_Var session_id); | 119 void OnSessionClosed(PP_Var session_id); |
122 void OnLegacySessionError(PP_Var session_id, | 120 void OnLegacySessionError(PP_Var session_id, |
123 PP_CdmExceptionCode exception_code, | 121 PP_CdmExceptionCode exception_code, |
124 uint32 system_code, | 122 uint32_t system_code, |
125 PP_Var error_description); | 123 PP_Var error_description); |
126 void DeliverBlock(PP_Resource decrypted_block, | 124 void DeliverBlock(PP_Resource decrypted_block, |
127 const PP_DecryptedBlockInfo* block_info); | 125 const PP_DecryptedBlockInfo* block_info); |
128 void DecoderInitializeDone(PP_DecryptorStreamType decoder_type, | 126 void DecoderInitializeDone(PP_DecryptorStreamType decoder_type, |
129 uint32_t request_id, | 127 uint32_t request_id, |
130 PP_Bool success); | 128 PP_Bool success); |
131 void DecoderDeinitializeDone(PP_DecryptorStreamType decoder_type, | 129 void DecoderDeinitializeDone(PP_DecryptorStreamType decoder_type, |
132 uint32_t request_id); | 130 uint32_t request_id); |
133 void DecoderResetDone(PP_DecryptorStreamType decoder_type, | 131 void DecoderResetDone(PP_DecryptorStreamType decoder_type, |
134 uint32_t request_id); | 132 uint32_t request_id); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 245 |
248 base::WeakPtr<ContentDecryptorDelegate> weak_this_; | 246 base::WeakPtr<ContentDecryptorDelegate> weak_this_; |
249 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; | 247 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; |
250 | 248 |
251 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); | 249 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); |
252 }; | 250 }; |
253 | 251 |
254 } // namespace content | 252 } // namespace content |
255 | 253 |
256 #endif // CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_ | 254 #endif // CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_ |
OLD | NEW |