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 | 10 |
10 #include "ppapi/c/private/pp_content_decryptor.h" | 11 #include "ppapi/c/private/pp_content_decryptor.h" |
11 #include "ppapi/c/private/ppb_content_decryptor_private.h" | 12 #include "ppapi/c/private/ppb_content_decryptor_private.h" |
12 #include "ppapi/c/private/ppp_content_decryptor_private.h" | 13 #include "ppapi/c/private/ppp_content_decryptor_private.h" |
13 | 14 |
14 #include "ppapi/cpp/dev/buffer_dev.h" | 15 #include "ppapi/cpp/dev/buffer_dev.h" |
15 #include "ppapi/cpp/instance_handle.h" | 16 #include "ppapi/cpp/instance_handle.h" |
16 #include "ppapi/cpp/var.h" | 17 #include "ppapi/cpp/var.h" |
17 #include "ppapi/cpp/var_array_buffer.h" | 18 #include "ppapi/cpp/var_array_buffer.h" |
18 | 19 |
19 namespace pp { | 20 namespace pp { |
20 | 21 |
21 class Instance; | 22 class Instance; |
22 | 23 |
23 // TODO(tomfinegan): Remove redundant pp:: usage, and pass VarArrayBuffers as | 24 // TODO(tomfinegan): Remove redundant pp:: usage, and pass VarArrayBuffers as |
24 // const references. | 25 // const references. |
25 | 26 |
26 class ContentDecryptor_Private { | 27 class ContentDecryptor_Private { |
27 public: | 28 public: |
28 explicit ContentDecryptor_Private(Instance* instance); | 29 explicit ContentDecryptor_Private(Instance* instance); |
29 virtual ~ContentDecryptor_Private(); | 30 virtual ~ContentDecryptor_Private(); |
30 | 31 |
31 // PPP_ContentDecryptor_Private functions exposed as virtual functions | 32 // PPP_ContentDecryptor_Private functions exposed as virtual functions |
32 // for you to override. | 33 // for you to override. |
33 // 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 |
34 // 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 |
35 // replying to the browser. | 36 // replying to the browser. |
36 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, | |
39 pp::VarArrayBuffer server_certificate) = 0; | |
37 virtual void CreateSession(uint32_t promise_id, | 40 virtual void CreateSession(uint32_t promise_id, |
38 const std::string& init_data_type, | 41 const std::string& init_data_type, |
39 pp::VarArrayBuffer init_data, | 42 pp::VarArrayBuffer init_data, |
40 PP_SessionType session_type) = 0; | 43 PP_SessionType session_type) = 0; |
41 virtual void LoadSession(uint32_t promise_id, | 44 virtual void LoadSession(uint32_t promise_id, |
42 const std::string& web_session_id) = 0; | 45 const std::string& web_session_id) = 0; |
43 virtual void UpdateSession(uint32_t promise_id, | 46 virtual void UpdateSession(uint32_t promise_id, |
44 const std::string& web_session_id, | 47 const std::string& web_session_id, |
45 pp::VarArrayBuffer response) = 0; | 48 pp::VarArrayBuffer response) = 0; |
46 virtual void ReleaseSession(uint32_t promise_id, | 49 virtual void CloseSession(uint32_t promise_id, |
47 const std::string& web_session_id) = 0; | 50 const std::string& web_session_id) = 0; |
palmer
2014/08/26 19:09:21
What is the format of these web session IDs? (Agai
jrummell
2014/08/29 22:35:35
From https://dvcs.w3.org/hg/html-media/raw-file/de
| |
51 virtual void RemoveSession(uint32_t promise_id, | |
52 const std::string& web_session_id) = 0; | |
53 virtual void GetUsableKeyIds(uint32_t promise_id, | |
54 const std::string& web_session_id) = 0; | |
48 virtual void Decrypt(pp::Buffer_Dev encrypted_buffer, | 55 virtual void Decrypt(pp::Buffer_Dev encrypted_buffer, |
49 const PP_EncryptedBlockInfo& encrypted_block_info) = 0; | 56 const PP_EncryptedBlockInfo& encrypted_block_info) = 0; |
50 virtual void InitializeAudioDecoder( | 57 virtual void InitializeAudioDecoder( |
51 const PP_AudioDecoderConfig& decoder_config, | 58 const PP_AudioDecoderConfig& decoder_config, |
52 pp::Buffer_Dev extra_data_resource) = 0; | 59 pp::Buffer_Dev extra_data_resource) = 0; |
53 virtual void InitializeVideoDecoder( | 60 virtual void InitializeVideoDecoder( |
54 const PP_VideoDecoderConfig& decoder_config, | 61 const PP_VideoDecoderConfig& decoder_config, |
55 pp::Buffer_Dev extra_data_resource) = 0; | 62 pp::Buffer_Dev extra_data_resource) = 0; |
56 virtual void DeinitializeDecoder(PP_DecryptorStreamType decoder_type, | 63 virtual void DeinitializeDecoder(PP_DecryptorStreamType decoder_type, |
57 uint32_t request_id) = 0; | 64 uint32_t request_id) = 0; |
58 virtual void ResetDecoder(PP_DecryptorStreamType decoder_type, | 65 virtual void ResetDecoder(PP_DecryptorStreamType decoder_type, |
59 uint32_t request_id) = 0; | 66 uint32_t request_id) = 0; |
60 // Null |encrypted_frame| means end-of-stream buffer. | 67 // Null |encrypted_frame| means end-of-stream buffer. |
61 virtual void DecryptAndDecode( | 68 virtual void DecryptAndDecode( |
62 PP_DecryptorStreamType decoder_type, | 69 PP_DecryptorStreamType decoder_type, |
63 pp::Buffer_Dev encrypted_buffer, | 70 pp::Buffer_Dev encrypted_buffer, |
64 const PP_EncryptedBlockInfo& encrypted_block_info) = 0; | 71 const PP_EncryptedBlockInfo& encrypted_block_info) = 0; |
65 | 72 |
66 // PPB_ContentDecryptor_Private methods for passing data from the decryptor | 73 // PPB_ContentDecryptor_Private methods for passing data from the decryptor |
67 // to the browser. | 74 // to the browser. |
68 void PromiseResolved(uint32_t promise_id); | 75 void PromiseResolved(uint32_t promise_id); |
69 void PromiseResolvedWithSession(uint32_t promise_id, | 76 void PromiseResolvedWithSession(uint32_t promise_id, |
70 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); | |
71 void PromiseRejected(uint32_t promise_id, | 81 void PromiseRejected(uint32_t promise_id, |
72 PP_CdmExceptionCode exception_code, | 82 PP_CdmExceptionCode exception_code, |
73 uint32_t system_code, | 83 uint32_t system_code, |
74 const std::string& error_description); | 84 const std::string& error_description); |
75 void SessionMessage(const std::string& web_session_id, | 85 void SessionMessage(const std::string& web_session_id, |
76 pp::VarArrayBuffer message, | 86 pp::VarArrayBuffer message, |
77 const std::string& destination_url); | 87 const std::string& destination_url); |
88 void SessionKeysChange(const std::string& web_session_id, | |
89 bool has_additional_usable_key); | |
90 void SessionExpirationChange(const std::string& web_session_id, | |
91 PP_Time new_expiry_time); | |
78 void SessionReady(const std::string& web_session_id); | 92 void SessionReady(const std::string& web_session_id); |
79 void SessionClosed(const std::string& web_session_id); | 93 void SessionClosed(const std::string& web_session_id); |
80 void SessionError(const std::string& web_session_id, | 94 void SessionError(const std::string& web_session_id, |
81 PP_CdmExceptionCode exception_code, | 95 PP_CdmExceptionCode exception_code, |
82 uint32_t system_code, | 96 uint32_t system_code, |
83 const std::string& error_description); | 97 const std::string& error_description); |
84 | 98 |
85 // The plugin must not hold a reference to the encrypted buffer resource | 99 // The plugin must not hold a reference to the encrypted buffer resource |
86 // provided to Decrypt() when it calls this method. The browser will reuse | 100 // provided to Decrypt() when it calls this method. The browser will reuse |
87 // the buffer in a subsequent Decrypt() call. | 101 // the buffer in a subsequent Decrypt() call. |
(...skipping 20 matching lines...) Expand all Loading... | |
108 void DeliverSamples(pp::Buffer_Dev audio_frames, | 122 void DeliverSamples(pp::Buffer_Dev audio_frames, |
109 const PP_DecryptedSampleInfo& decrypted_sample_info); | 123 const PP_DecryptedSampleInfo& decrypted_sample_info); |
110 | 124 |
111 private: | 125 private: |
112 InstanceHandle associated_instance_; | 126 InstanceHandle associated_instance_; |
113 }; | 127 }; |
114 | 128 |
115 } // namespace pp | 129 } // namespace pp |
116 | 130 |
117 #endif // PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_ | 131 #endif // PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_ |
OLD | NEW |