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 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback_helpers.h" | 13 #include "base/callback_helpers.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/containers/scoped_ptr_hash_map.h" | 15 #include "base/containers/scoped_ptr_hash_map.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "media/base/cdm_promise.h" | 18 #include "media/base/cdm_promise.h" |
19 #include "media/base/channel_layout.h" | 19 #include "media/base/channel_layout.h" |
20 #include "media/base/decryptor.h" | 20 #include "media/base/decryptor.h" |
21 #include "media/base/media_keys.h" | 21 #include "media/base/media_keys.h" |
22 #include "media/base/sample_format.h" | 22 #include "media/base/sample_format.h" |
| 23 #include "ppapi/c/pp_time.h" |
23 #include "ppapi/c/private/pp_content_decryptor.h" | 24 #include "ppapi/c/private/pp_content_decryptor.h" |
24 #include "ppapi/c/private/ppp_content_decryptor_private.h" | 25 #include "ppapi/c/private/ppp_content_decryptor_private.h" |
25 #include "ui/gfx/size.h" | 26 #include "ui/gfx/size.h" |
26 | 27 |
27 namespace media { | 28 namespace media { |
28 class AudioDecoderConfig; | 29 class AudioDecoderConfig; |
29 class DecoderBuffer; | 30 class DecoderBuffer; |
30 class VideoDecoderConfig; | 31 class VideoDecoderConfig; |
31 } | 32 } |
32 | 33 |
(...skipping 15 matching lines...) Expand all Loading... |
48 void Initialize(const std::string& key_system, | 49 void Initialize(const std::string& key_system, |
49 const media::SessionMessageCB& session_message_cb, | 50 const media::SessionMessageCB& session_message_cb, |
50 const media::SessionReadyCB& session_ready_cb, | 51 const media::SessionReadyCB& session_ready_cb, |
51 const media::SessionClosedCB& session_closed_cb, | 52 const media::SessionClosedCB& session_closed_cb, |
52 const media::SessionErrorCB& session_error_cb, | 53 const media::SessionErrorCB& session_error_cb, |
53 const base::Closure& fatal_plugin_error_cb); | 54 const base::Closure& fatal_plugin_error_cb); |
54 | 55 |
55 void InstanceCrashed(); | 56 void InstanceCrashed(); |
56 | 57 |
57 // Provides access to PPP_ContentDecryptor_Private. | 58 // Provides access to PPP_ContentDecryptor_Private. |
| 59 void SetServerCertificate(const uint8* certificate, |
| 60 int certificate_length, |
| 61 scoped_ptr<media::SimpleCdmPromise> promise); |
58 void CreateSession(const std::string& init_data_type, | 62 void CreateSession(const std::string& init_data_type, |
59 const uint8* init_data, | 63 const uint8* init_data, |
60 int init_data_length, | 64 int init_data_length, |
61 media::MediaKeys::SessionType session_type, | 65 media::MediaKeys::SessionType session_type, |
62 scoped_ptr<media::NewSessionCdmPromise> promise); | 66 scoped_ptr<media::NewSessionCdmPromise> promise); |
63 void LoadSession(const std::string& web_session_id, | 67 void LoadSession(const std::string& web_session_id, |
64 scoped_ptr<media::NewSessionCdmPromise> promise); | 68 scoped_ptr<media::NewSessionCdmPromise> promise); |
65 void UpdateSession(const std::string& web_session_id, | 69 void UpdateSession(const std::string& web_session_id, |
66 const uint8* response, | 70 const uint8* response, |
67 int response_length, | 71 int response_length, |
68 scoped_ptr<media::SimpleCdmPromise> promise); | 72 scoped_ptr<media::SimpleCdmPromise> promise); |
69 void ReleaseSession(const std::string& web_session_id, | 73 void CloseSession(const std::string& web_session_id, |
70 scoped_ptr<media::SimpleCdmPromise> promise); | 74 scoped_ptr<media::SimpleCdmPromise> promise); |
| 75 void RemoveSession(const std::string& web_session_id, |
| 76 scoped_ptr<media::SimpleCdmPromise> promise); |
| 77 void GetUsableKeyIds(const std::string& web_session_id, |
| 78 scoped_ptr<media::KeyIdsPromise> promise); |
71 bool Decrypt(media::Decryptor::StreamType stream_type, | 79 bool Decrypt(media::Decryptor::StreamType stream_type, |
72 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, | 80 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
73 const media::Decryptor::DecryptCB& decrypt_cb); | 81 const media::Decryptor::DecryptCB& decrypt_cb); |
74 bool CancelDecrypt(media::Decryptor::StreamType stream_type); | 82 bool CancelDecrypt(media::Decryptor::StreamType stream_type); |
75 bool InitializeAudioDecoder( | 83 bool InitializeAudioDecoder( |
76 const media::AudioDecoderConfig& decoder_config, | 84 const media::AudioDecoderConfig& decoder_config, |
77 const media::Decryptor::DecoderInitCB& decoder_init_cb); | 85 const media::Decryptor::DecoderInitCB& decoder_init_cb); |
78 bool InitializeVideoDecoder( | 86 bool InitializeVideoDecoder( |
79 const media::VideoDecoderConfig& decoder_config, | 87 const media::VideoDecoderConfig& decoder_config, |
80 const media::Decryptor::DecoderInitCB& decoder_init_cb); | 88 const media::Decryptor::DecoderInitCB& decoder_init_cb); |
81 // TODO(tomfinegan): Add callback args for DeinitializeDecoder() and | 89 // TODO(tomfinegan): Add callback args for DeinitializeDecoder() and |
82 // ResetDecoder() | 90 // ResetDecoder() |
83 bool DeinitializeDecoder(media::Decryptor::StreamType stream_type); | 91 bool DeinitializeDecoder(media::Decryptor::StreamType stream_type); |
84 bool ResetDecoder(media::Decryptor::StreamType stream_type); | 92 bool ResetDecoder(media::Decryptor::StreamType stream_type); |
85 // Note: These methods can be used with unencrypted data. | 93 // Note: These methods can be used with unencrypted data. |
86 bool DecryptAndDecodeAudio( | 94 bool DecryptAndDecodeAudio( |
87 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, | 95 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
88 const media::Decryptor::AudioDecodeCB& audio_decode_cb); | 96 const media::Decryptor::AudioDecodeCB& audio_decode_cb); |
89 bool DecryptAndDecodeVideo( | 97 bool DecryptAndDecodeVideo( |
90 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, | 98 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
91 const media::Decryptor::VideoDecodeCB& video_decode_cb); | 99 const media::Decryptor::VideoDecodeCB& video_decode_cb); |
92 | 100 |
93 // PPB_ContentDecryptor_Private dispatching methods. | 101 // PPB_ContentDecryptor_Private dispatching methods. |
94 void OnPromiseResolved(uint32 promise_id); | 102 void OnPromiseResolved(uint32 promise_id); |
95 void OnPromiseResolvedWithSession(uint32 promise_id, PP_Var web_session_id); | 103 void OnPromiseResolvedWithSession(uint32 promise_id, PP_Var web_session_id); |
| 104 void OnPromiseResolvedWithKeyIds(uint32 promise_id, PP_Var key_ids_array); |
96 void OnPromiseRejected(uint32 promise_id, | 105 void OnPromiseRejected(uint32 promise_id, |
97 PP_CdmExceptionCode exception_code, | 106 PP_CdmExceptionCode exception_code, |
98 uint32 system_code, | 107 uint32 system_code, |
99 PP_Var error_description); | 108 PP_Var error_description); |
100 void OnSessionMessage(PP_Var web_session_id, | 109 void OnSessionMessage(PP_Var web_session_id, |
101 PP_Var message, | 110 PP_Var message, |
102 PP_Var destination_url); | 111 PP_Var destination_url); |
| 112 void OnSessionKeysChange(PP_Var web_session_id, |
| 113 PP_Bool has_additional_usable_key); |
| 114 void OnSessionExpirationChange(PP_Var web_session_id, |
| 115 PP_Time new_expiry_time); |
103 void OnSessionReady(PP_Var web_session_id); | 116 void OnSessionReady(PP_Var web_session_id); |
104 void OnSessionClosed(PP_Var web_session_id); | 117 void OnSessionClosed(PP_Var web_session_id); |
105 void OnSessionError(PP_Var web_session_id, | 118 void OnSessionError(PP_Var web_session_id, |
106 PP_CdmExceptionCode exception_code, | 119 PP_CdmExceptionCode exception_code, |
107 uint32 system_code, | 120 uint32 system_code, |
108 PP_Var error_description); | 121 PP_Var error_description); |
109 void DeliverBlock(PP_Resource decrypted_block, | 122 void DeliverBlock(PP_Resource decrypted_block, |
110 const PP_DecryptedBlockInfo* block_info); | 123 const PP_DecryptedBlockInfo* block_info); |
111 void DecoderInitializeDone(PP_DecryptorStreamType decoder_type, | 124 void DecoderInitializeDone(PP_DecryptorStreamType decoder_type, |
112 uint32_t request_id, | 125 uint32_t request_id, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 256 |
244 base::WeakPtr<ContentDecryptorDelegate> weak_this_; | 257 base::WeakPtr<ContentDecryptorDelegate> weak_this_; |
245 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; | 258 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; |
246 | 259 |
247 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); | 260 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); |
248 }; | 261 }; |
249 | 262 |
250 } // namespace content | 263 } // namespace content |
251 | 264 |
252 #endif // CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_ | 265 #endif // CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_ |
OLD | NEW |