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 PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_ | 5 #ifndef PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_ |
6 #define PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_ | 6 #define PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 virtual ~ContentDecryptor_Private(); | 30 virtual ~ContentDecryptor_Private(); |
31 | 31 |
32 // PPP_ContentDecryptor_Private functions exposed as virtual functions | 32 // PPP_ContentDecryptor_Private functions exposed as virtual functions |
33 // for you to override. | 33 // for you to override. |
34 // TODO(tomfinegan): This could be optimized to pass pp::Var instead of | 34 // TODO(tomfinegan): This could be optimized to pass pp::Var instead of |
35 // strings. The change would allow the CDM wrapper to reuse vars when | 35 // strings. The change would allow the CDM wrapper to reuse vars when |
36 // replying to the browser. | 36 // replying to the browser. |
37 virtual void Initialize(const std::string& key_system) = 0; | 37 virtual void Initialize(const std::string& key_system) = 0; |
38 virtual void SetServerCertificate(uint32_t promise_id, | 38 virtual void SetServerCertificate(uint32_t promise_id, |
39 pp::VarArrayBuffer server_certificate) = 0; | 39 pp::VarArrayBuffer server_certificate) = 0; |
40 virtual void CreateSession(uint32_t promise_id, | 40 virtual void CreateSessionAndGenerateRequest( |
41 const std::string& init_data_type, | 41 uint32_t promise_id, |
42 pp::VarArrayBuffer init_data, | 42 PP_SessionType session_type, |
43 PP_SessionType session_type) = 0; | 43 const std::string& init_data_type, |
| 44 pp::VarArrayBuffer init_data) = 0; |
44 virtual void LoadSession(uint32_t promise_id, | 45 virtual void LoadSession(uint32_t promise_id, |
| 46 PP_SessionType session_type, |
45 const std::string& web_session_id) = 0; | 47 const std::string& web_session_id) = 0; |
46 virtual void UpdateSession(uint32_t promise_id, | 48 virtual void UpdateSession(uint32_t promise_id, |
47 const std::string& web_session_id, | 49 const std::string& web_session_id, |
48 pp::VarArrayBuffer response) = 0; | 50 pp::VarArrayBuffer response) = 0; |
49 virtual void CloseSession(uint32_t promise_id, | 51 virtual void CloseSession(uint32_t promise_id, |
50 const std::string& web_session_id) = 0; | 52 const std::string& web_session_id) = 0; |
51 virtual void RemoveSession(uint32_t promise_id, | 53 virtual void RemoveSession(uint32_t promise_id, |
52 const std::string& web_session_id) = 0; | 54 const std::string& web_session_id) = 0; |
53 virtual void GetUsableKeyIds(uint32_t promise_id, | |
54 const std::string& web_session_id) = 0; | |
55 virtual void Decrypt(pp::Buffer_Dev encrypted_buffer, | 55 virtual void Decrypt(pp::Buffer_Dev encrypted_buffer, |
56 const PP_EncryptedBlockInfo& encrypted_block_info) = 0; | 56 const PP_EncryptedBlockInfo& encrypted_block_info) = 0; |
57 virtual void InitializeAudioDecoder( | 57 virtual void InitializeAudioDecoder( |
58 const PP_AudioDecoderConfig& decoder_config, | 58 const PP_AudioDecoderConfig& decoder_config, |
59 pp::Buffer_Dev extra_data_resource) = 0; | 59 pp::Buffer_Dev extra_data_resource) = 0; |
60 virtual void InitializeVideoDecoder( | 60 virtual void InitializeVideoDecoder( |
61 const PP_VideoDecoderConfig& decoder_config, | 61 const PP_VideoDecoderConfig& decoder_config, |
62 pp::Buffer_Dev extra_data_resource) = 0; | 62 pp::Buffer_Dev extra_data_resource) = 0; |
63 virtual void DeinitializeDecoder(PP_DecryptorStreamType decoder_type, | 63 virtual void DeinitializeDecoder(PP_DecryptorStreamType decoder_type, |
64 uint32_t request_id) = 0; | 64 uint32_t request_id) = 0; |
65 virtual void ResetDecoder(PP_DecryptorStreamType decoder_type, | 65 virtual void ResetDecoder(PP_DecryptorStreamType decoder_type, |
66 uint32_t request_id) = 0; | 66 uint32_t request_id) = 0; |
67 // Null |encrypted_frame| means end-of-stream buffer. | 67 // Null |encrypted_frame| means end-of-stream buffer. |
68 virtual void DecryptAndDecode( | 68 virtual void DecryptAndDecode( |
69 PP_DecryptorStreamType decoder_type, | 69 PP_DecryptorStreamType decoder_type, |
70 pp::Buffer_Dev encrypted_buffer, | 70 pp::Buffer_Dev encrypted_buffer, |
71 const PP_EncryptedBlockInfo& encrypted_block_info) = 0; | 71 const PP_EncryptedBlockInfo& encrypted_block_info) = 0; |
72 | 72 |
73 // PPB_ContentDecryptor_Private methods for passing data from the decryptor | 73 // PPB_ContentDecryptor_Private methods for passing data from the decryptor |
74 // to the browser. | 74 // to the browser. |
75 void PromiseResolved(uint32_t promise_id); | 75 void PromiseResolved(uint32_t promise_id); |
76 void PromiseResolvedWithSession(uint32_t promise_id, | 76 void PromiseResolvedWithSession(uint32_t promise_id, |
77 const std::string& web_session_id); | 77 const std::string& web_session_id); |
78 void PromiseResolvedWithKeyIds( | |
79 uint32_t promise_id, | |
80 const std::vector<std::vector<uint8_t> >& key_ids); | |
81 void PromiseRejected(uint32_t promise_id, | 78 void PromiseRejected(uint32_t promise_id, |
82 PP_CdmExceptionCode exception_code, | 79 PP_CdmExceptionCode exception_code, |
83 uint32_t system_code, | 80 uint32_t system_code, |
84 const std::string& error_description); | 81 const std::string& error_description); |
85 void SessionMessage(const std::string& web_session_id, | 82 void SessionMessage(const std::string& web_session_id, |
86 pp::VarArrayBuffer message, | 83 PP_CdmMessageType message_type, |
87 const std::string& destination_url); | 84 pp::VarArrayBuffer message); |
88 void SessionKeysChange(const std::string& web_session_id, | 85 void SessionKeysChange(const std::string& web_session_id, |
89 bool has_additional_usable_key); | 86 bool has_additional_usable_key, |
| 87 const std::vector<PP_KeyInformation>& key_information); |
90 void SessionExpirationChange(const std::string& web_session_id, | 88 void SessionExpirationChange(const std::string& web_session_id, |
91 PP_Time new_expiry_time); | 89 PP_Time new_expiry_time); |
92 void SessionReady(const std::string& web_session_id); | |
93 void SessionClosed(const std::string& web_session_id); | 90 void SessionClosed(const std::string& web_session_id); |
94 void SessionError(const std::string& web_session_id, | 91 void SessionError(const std::string& web_session_id, |
95 PP_CdmExceptionCode exception_code, | 92 PP_CdmExceptionCode exception_code, |
96 uint32_t system_code, | 93 uint32_t system_code, |
97 const std::string& error_description); | 94 const std::string& error_description); |
98 | 95 |
99 // The plugin must not hold a reference to the encrypted buffer resource | 96 // The plugin must not hold a reference to the encrypted buffer resource |
100 // provided to Decrypt() when it calls this method. The browser will reuse | 97 // provided to Decrypt() when it calls this method. The browser will reuse |
101 // the buffer in a subsequent Decrypt() call. | 98 // the buffer in a subsequent Decrypt() call. |
102 void DeliverBlock(pp::Buffer_Dev decrypted_block, | 99 void DeliverBlock(pp::Buffer_Dev decrypted_block, |
(...skipping 19 matching lines...) Expand all Loading... |
122 void DeliverSamples(pp::Buffer_Dev audio_frames, | 119 void DeliverSamples(pp::Buffer_Dev audio_frames, |
123 const PP_DecryptedSampleInfo& decrypted_sample_info); | 120 const PP_DecryptedSampleInfo& decrypted_sample_info); |
124 | 121 |
125 private: | 122 private: |
126 InstanceHandle associated_instance_; | 123 InstanceHandle associated_instance_; |
127 }; | 124 }; |
128 | 125 |
129 } // namespace pp | 126 } // namespace pp |
130 | 127 |
131 #endif // PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_ | 128 #endif // PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_ |
OLD | NEW |