Explicitly add python-numpy dependency to install-build-deps.
[chromium-blink-merge.git] / ppapi / cpp / private / content_decryptor_private.h
blob25aba52c1f8b00bcf963a42406b8401db0d1f805
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
3 // found in the LICENSE file.
5 #ifndef PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_
6 #define PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_
8 #include <string>
9 #include <vector>
11 #include "ppapi/c/private/pp_content_decryptor.h"
12 #include "ppapi/c/private/ppb_content_decryptor_private.h"
13 #include "ppapi/c/private/ppp_content_decryptor_private.h"
15 #include "ppapi/cpp/dev/buffer_dev.h"
16 #include "ppapi/cpp/instance_handle.h"
17 #include "ppapi/cpp/var.h"
18 #include "ppapi/cpp/var_array_buffer.h"
20 namespace pp {
22 class Instance;
24 // TODO(tomfinegan): Remove redundant pp:: usage, and pass VarArrayBuffers as
25 // const references.
27 class ContentDecryptor_Private {
28 public:
29 explicit ContentDecryptor_Private(Instance* instance);
30 virtual ~ContentDecryptor_Private();
32 // PPP_ContentDecryptor_Private functions exposed as virtual functions
33 // for you to override.
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
36 // replying to the browser.
37 virtual void Initialize(const std::string& key_system) = 0;
38 virtual void SetServerCertificate(uint32_t promise_id,
39 pp::VarArrayBuffer server_certificate) = 0;
40 virtual void CreateSession(uint32_t promise_id,
41 const std::string& init_data_type,
42 pp::VarArrayBuffer init_data,
43 PP_SessionType session_type) = 0;
44 virtual void LoadSession(uint32_t promise_id,
45 const std::string& web_session_id) = 0;
46 virtual void UpdateSession(uint32_t promise_id,
47 const std::string& web_session_id,
48 pp::VarArrayBuffer response) = 0;
49 virtual void CloseSession(uint32_t promise_id,
50 const std::string& web_session_id) = 0;
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;
55 virtual void Decrypt(pp::Buffer_Dev encrypted_buffer,
56 const PP_EncryptedBlockInfo& encrypted_block_info) = 0;
57 virtual void InitializeAudioDecoder(
58 const PP_AudioDecoderConfig& decoder_config,
59 pp::Buffer_Dev extra_data_resource) = 0;
60 virtual void InitializeVideoDecoder(
61 const PP_VideoDecoderConfig& decoder_config,
62 pp::Buffer_Dev extra_data_resource) = 0;
63 virtual void DeinitializeDecoder(PP_DecryptorStreamType decoder_type,
64 uint32_t request_id) = 0;
65 virtual void ResetDecoder(PP_DecryptorStreamType decoder_type,
66 uint32_t request_id) = 0;
67 // Null |encrypted_frame| means end-of-stream buffer.
68 virtual void DecryptAndDecode(
69 PP_DecryptorStreamType decoder_type,
70 pp::Buffer_Dev encrypted_buffer,
71 const PP_EncryptedBlockInfo& encrypted_block_info) = 0;
73 // PPB_ContentDecryptor_Private methods for passing data from the decryptor
74 // to the browser.
75 void PromiseResolved(uint32_t promise_id);
76 void PromiseResolvedWithSession(uint32_t promise_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,
82 PP_CdmExceptionCode exception_code,
83 uint32_t system_code,
84 const std::string& error_description);
85 void SessionMessage(const std::string& web_session_id,
86 pp::VarArrayBuffer message,
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);
92 void SessionReady(const std::string& web_session_id);
93 void SessionClosed(const std::string& web_session_id);
94 void SessionError(const std::string& web_session_id,
95 PP_CdmExceptionCode exception_code,
96 uint32_t system_code,
97 const std::string& error_description);
99 // 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
101 // the buffer in a subsequent Decrypt() call.
102 void DeliverBlock(pp::Buffer_Dev decrypted_block,
103 const PP_DecryptedBlockInfo& decrypted_block_info);
105 void DecoderInitializeDone(PP_DecryptorStreamType decoder_type,
106 uint32_t request_id,
107 bool status);
108 void DecoderDeinitializeDone(PP_DecryptorStreamType decoder_type,
109 uint32_t request_id);
110 void DecoderResetDone(PP_DecryptorStreamType decoder_type,
111 uint32_t request_id);
113 // The plugin must not hold a reference to the encrypted buffer resource
114 // provided to DecryptAndDecode() when it calls this method. The browser will
115 // reuse the buffer in a subsequent DecryptAndDecode() call.
116 void DeliverFrame(pp::Buffer_Dev decrypted_frame,
117 const PP_DecryptedFrameInfo& decrypted_frame_info);
119 // The plugin must not hold a reference to the encrypted buffer resource
120 // provided to DecryptAndDecode() when it calls this method. The browser will
121 // reuse the buffer in a subsequent DecryptAndDecode() call.
122 void DeliverSamples(pp::Buffer_Dev audio_frames,
123 const PP_DecryptedSampleInfo& decrypted_sample_info);
125 private:
126 InstanceHandle associated_instance_;
129 } // namespace pp
131 #endif // PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_