| 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 "ppapi/c/private/pp_content_decryptor.h" | 8 #include "ppapi/c/private/pp_content_decryptor.h" |
| 9 #include "ppapi/c/private/ppb_content_decryptor_private.h" | 9 #include "ppapi/c/private/ppb_content_decryptor_private.h" |
| 10 #include "ppapi/c/private/ppp_content_decryptor_private.h" | 10 #include "ppapi/c/private/ppp_content_decryptor_private.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 public: | 25 public: |
| 26 explicit ContentDecryptor_Private(Instance* instance); | 26 explicit ContentDecryptor_Private(Instance* instance); |
| 27 virtual ~ContentDecryptor_Private(); | 27 virtual ~ContentDecryptor_Private(); |
| 28 | 28 |
| 29 // PPP_ContentDecryptor_Private functions exposed as virtual functions | 29 // PPP_ContentDecryptor_Private functions exposed as virtual functions |
| 30 // for you to override. | 30 // for you to override. |
| 31 // TODO(tomfinegan): This could be optimized to pass pp::Var instead of | 31 // TODO(tomfinegan): This could be optimized to pass pp::Var instead of |
| 32 // strings. The change would allow the CDM wrapper to reuse vars when | 32 // strings. The change would allow the CDM wrapper to reuse vars when |
| 33 // replying to the browser. | 33 // replying to the browser. |
| 34 virtual void Initialize(const std::string& key_system) = 0; | 34 virtual void Initialize(const std::string& key_system) = 0; |
| 35 virtual void CreateSession(uint32_t session_id, | 35 virtual void CreateSession(uint32_t promise_id, |
| 36 const std::string& content_type, | 36 const std::string& init_data_type, |
| 37 pp::VarArrayBuffer init_data) = 0; | 37 pp::VarArrayBuffer init_data, |
| 38 virtual void LoadSession(uint32_t session_id, | 38 PP_SessionType session_type) = 0; |
| 39 virtual void LoadSession(uint32_t promise_id, |
| 39 const std::string& web_session_id) = 0; | 40 const std::string& web_session_id) = 0; |
| 40 virtual void UpdateSession(uint32_t session_id, | 41 virtual void UpdateSession(uint32_t promise_id, |
| 42 const std::string& web_session_id, |
| 41 pp::VarArrayBuffer response) = 0; | 43 pp::VarArrayBuffer response) = 0; |
| 42 virtual void ReleaseSession(uint32_t session_id) = 0; | 44 virtual void ReleaseSession(uint32_t promise_id, |
| 45 const std::string& web_session_id) = 0; |
| 43 virtual void Decrypt(pp::Buffer_Dev encrypted_buffer, | 46 virtual void Decrypt(pp::Buffer_Dev encrypted_buffer, |
| 44 const PP_EncryptedBlockInfo& encrypted_block_info) = 0; | 47 const PP_EncryptedBlockInfo& encrypted_block_info) = 0; |
| 45 virtual void InitializeAudioDecoder( | 48 virtual void InitializeAudioDecoder( |
| 46 const PP_AudioDecoderConfig& decoder_config, | 49 const PP_AudioDecoderConfig& decoder_config, |
| 47 pp::Buffer_Dev extra_data_resource) = 0; | 50 pp::Buffer_Dev extra_data_resource) = 0; |
| 48 virtual void InitializeVideoDecoder( | 51 virtual void InitializeVideoDecoder( |
| 49 const PP_VideoDecoderConfig& decoder_config, | 52 const PP_VideoDecoderConfig& decoder_config, |
| 50 pp::Buffer_Dev extra_data_resource) = 0; | 53 pp::Buffer_Dev extra_data_resource) = 0; |
| 51 virtual void DeinitializeDecoder(PP_DecryptorStreamType decoder_type, | 54 virtual void DeinitializeDecoder(PP_DecryptorStreamType decoder_type, |
| 52 uint32_t request_id) = 0; | 55 uint32_t request_id) = 0; |
| 53 virtual void ResetDecoder(PP_DecryptorStreamType decoder_type, | 56 virtual void ResetDecoder(PP_DecryptorStreamType decoder_type, |
| 54 uint32_t request_id) = 0; | 57 uint32_t request_id) = 0; |
| 55 // Null |encrypted_frame| means end-of-stream buffer. | 58 // Null |encrypted_frame| means end-of-stream buffer. |
| 56 virtual void DecryptAndDecode( | 59 virtual void DecryptAndDecode( |
| 57 PP_DecryptorStreamType decoder_type, | 60 PP_DecryptorStreamType decoder_type, |
| 58 pp::Buffer_Dev encrypted_buffer, | 61 pp::Buffer_Dev encrypted_buffer, |
| 59 const PP_EncryptedBlockInfo& encrypted_block_info) = 0; | 62 const PP_EncryptedBlockInfo& encrypted_block_info) = 0; |
| 60 | 63 |
| 61 // PPB_ContentDecryptor_Private methods for passing data from the decryptor | 64 // PPB_ContentDecryptor_Private methods for passing data from the decryptor |
| 62 // to the browser. | 65 // to the browser. |
| 63 void SessionCreated(uint32_t session_id, const std::string& web_session_id); | 66 void PromiseResolved(uint32_t promise_id); |
| 64 void SessionMessage(uint32_t session_id, | 67 void PromiseResolvedWithSession(uint32_t promise_id, |
| 68 const std::string& web_session_id); |
| 69 void PromiseRejected(uint32_t promise_id, |
| 70 const std::string& error_name, |
| 71 uint32_t system_code, |
| 72 const std::string& error_description); |
| 73 void SessionMessage(const std::string& web_session_id, |
| 65 pp::VarArrayBuffer message, | 74 pp::VarArrayBuffer message, |
| 66 const std::string& default_url); | 75 const std::string& destination_url); |
| 67 void SessionReady(uint32_t session_id); | 76 void SessionReady(const std::string& web_session_id); |
| 68 void SessionClosed(uint32_t session_id); | 77 void SessionClosed(const std::string& web_session_id); |
| 69 void SessionError(uint32_t session_id, | 78 void SessionError(const std::string& web_session_id, |
| 70 int32_t media_error, | 79 const std::string& error_name, |
| 71 uint32_t system_code); | 80 uint32_t system_code, |
| 81 const std::string& error_description); |
| 72 | 82 |
| 73 // The plugin must not hold a reference to the encrypted buffer resource | 83 // The plugin must not hold a reference to the encrypted buffer resource |
| 74 // provided to Decrypt() when it calls this method. The browser will reuse | 84 // provided to Decrypt() when it calls this method. The browser will reuse |
| 75 // the buffer in a subsequent Decrypt() call. | 85 // the buffer in a subsequent Decrypt() call. |
| 76 void DeliverBlock(pp::Buffer_Dev decrypted_block, | 86 void DeliverBlock(pp::Buffer_Dev decrypted_block, |
| 77 const PP_DecryptedBlockInfo& decrypted_block_info); | 87 const PP_DecryptedBlockInfo& decrypted_block_info); |
| 78 | 88 |
| 79 void DecoderInitializeDone(PP_DecryptorStreamType decoder_type, | 89 void DecoderInitializeDone(PP_DecryptorStreamType decoder_type, |
| 80 uint32_t request_id, | 90 uint32_t request_id, |
| 81 bool status); | 91 bool status); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 96 void DeliverSamples(pp::Buffer_Dev audio_frames, | 106 void DeliverSamples(pp::Buffer_Dev audio_frames, |
| 97 const PP_DecryptedSampleInfo& decrypted_sample_info); | 107 const PP_DecryptedSampleInfo& decrypted_sample_info); |
| 98 | 108 |
| 99 private: | 109 private: |
| 100 InstanceHandle associated_instance_; | 110 InstanceHandle associated_instance_; |
| 101 }; | 111 }; |
| 102 | 112 |
| 103 } // namespace pp | 113 } // namespace pp |
| 104 | 114 |
| 105 #endif // PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_ | 115 #endif // PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_ |
| OLD | NEW |