| 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 WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 class WEBKIT_PLUGINS_EXPORT ContentDecryptorDelegate { | 33 class WEBKIT_PLUGINS_EXPORT ContentDecryptorDelegate { |
| 34 public: | 34 public: |
| 35 // ContentDecryptorDelegate does not take ownership of | 35 // ContentDecryptorDelegate does not take ownership of |
| 36 // |plugin_decryption_interface|. Therefore |plugin_decryption_interface| | 36 // |plugin_decryption_interface|. Therefore |plugin_decryption_interface| |
| 37 // must outlive this object. | 37 // must outlive this object. |
| 38 ContentDecryptorDelegate( | 38 ContentDecryptorDelegate( |
| 39 PP_Instance pp_instance, | 39 PP_Instance pp_instance, |
| 40 const PPP_ContentDecryptor_Private* plugin_decryption_interface); | 40 const PPP_ContentDecryptor_Private* plugin_decryption_interface); |
| 41 | 41 |
| 42 void Initialize(const std::string& key_system); |
| 43 |
| 42 void SetKeyEventCallbacks(const media::KeyAddedCB& key_added_cb, | 44 void SetKeyEventCallbacks(const media::KeyAddedCB& key_added_cb, |
| 43 const media::KeyErrorCB& key_error_cb, | 45 const media::KeyErrorCB& key_error_cb, |
| 44 const media::KeyMessageCB& key_message_cb, | 46 const media::KeyMessageCB& key_message_cb, |
| 45 const media::NeedKeyCB& need_key_cb); | 47 const media::NeedKeyCB& need_key_cb); |
| 46 | 48 |
| 47 // Provides access to PPP_ContentDecryptor_Private. | 49 // Provides access to PPP_ContentDecryptor_Private. |
| 48 bool GenerateKeyRequest(const std::string& key_system, | 50 bool GenerateKeyRequest(const std::string& type, |
| 49 const std::string& type, | |
| 50 const uint8* init_data, | 51 const uint8* init_data, |
| 51 int init_data_length); | 52 int init_data_length); |
| 52 bool AddKey(const std::string& session_id, | 53 bool AddKey(const std::string& session_id, |
| 53 const uint8* key, | 54 const uint8* key, |
| 54 int key_length, | 55 int key_length, |
| 55 const uint8* init_data, | 56 const uint8* init_data, |
| 56 int init_data_length); | 57 int init_data_length); |
| 57 bool CancelKeyRequest(const std::string& session_id); | 58 bool CancelKeyRequest(const std::string& session_id); |
| 58 bool Decrypt(media::Decryptor::StreamType stream_type, | 59 bool Decrypt(media::Decryptor::StreamType stream_type, |
| 59 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, | 60 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 bool ResetDecoder(media::Decryptor::StreamType stream_type); | 72 bool ResetDecoder(media::Decryptor::StreamType stream_type); |
| 72 // Note: These methods can be used with unencrypted data. | 73 // Note: These methods can be used with unencrypted data. |
| 73 bool DecryptAndDecodeAudio( | 74 bool DecryptAndDecodeAudio( |
| 74 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, | 75 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
| 75 const media::Decryptor::AudioDecodeCB& audio_decode_cb); | 76 const media::Decryptor::AudioDecodeCB& audio_decode_cb); |
| 76 bool DecryptAndDecodeVideo( | 77 bool DecryptAndDecodeVideo( |
| 77 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, | 78 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
| 78 const media::Decryptor::VideoDecodeCB& video_decode_cb); | 79 const media::Decryptor::VideoDecodeCB& video_decode_cb); |
| 79 | 80 |
| 80 // PPB_ContentDecryptor_Private dispatching methods. | 81 // PPB_ContentDecryptor_Private dispatching methods. |
| 82 // TODO(ddorwin): Remove this method. |
| 81 void NeedKey(PP_Var key_system, PP_Var session_id, PP_Var init_data); | 83 void NeedKey(PP_Var key_system, PP_Var session_id, PP_Var init_data); |
| 84 // TODO(ddorwin): Remove key_system_var parameter from these methods. |
| 82 void KeyAdded(PP_Var key_system, PP_Var session_id); | 85 void KeyAdded(PP_Var key_system, PP_Var session_id); |
| 83 void KeyMessage(PP_Var key_system, | 86 void KeyMessage(PP_Var key_system, |
| 84 PP_Var session_id, | 87 PP_Var session_id, |
| 85 PP_Var message, | 88 PP_Var message, |
| 86 PP_Var default_url); | 89 PP_Var default_url); |
| 87 void KeyError(PP_Var key_system, | 90 void KeyError(PP_Var key_system, |
| 88 PP_Var session_id, | 91 PP_Var session_id, |
| 89 int32_t media_error, | 92 int32_t media_error, |
| 90 int32_t system_code); | 93 int32_t system_code); |
| 91 void DeliverBlock(PP_Resource decrypted_block, | 94 void DeliverBlock(PP_Resource decrypted_block, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 121 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, | 124 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
| 122 scoped_refptr<PPB_Buffer_Impl>* resource); | 125 scoped_refptr<PPB_Buffer_Impl>* resource); |
| 123 | 126 |
| 124 void FreeBuffer(uint32_t buffer_id); | 127 void FreeBuffer(uint32_t buffer_id); |
| 125 | 128 |
| 126 void SetBufferToFreeInTrackingInfo(PP_DecryptTrackingInfo* tracking_info); | 129 void SetBufferToFreeInTrackingInfo(PP_DecryptTrackingInfo* tracking_info); |
| 127 | 130 |
| 128 const PP_Instance pp_instance_; | 131 const PP_Instance pp_instance_; |
| 129 const PPP_ContentDecryptor_Private* const plugin_decryption_interface_; | 132 const PPP_ContentDecryptor_Private* const plugin_decryption_interface_; |
| 130 | 133 |
| 134 // TODO(ddorwin): Remove after updating the Pepper API to not use key system. |
| 135 std::string key_system_; |
| 136 |
| 131 // Callbacks for firing key events. | 137 // Callbacks for firing key events. |
| 132 media::KeyAddedCB key_added_cb_; | 138 media::KeyAddedCB key_added_cb_; |
| 133 media::KeyErrorCB key_error_cb_; | 139 media::KeyErrorCB key_error_cb_; |
| 134 media::KeyMessageCB key_message_cb_; | 140 media::KeyMessageCB key_message_cb_; |
| 135 media::NeedKeyCB need_key_cb_; | 141 media::NeedKeyCB need_key_cb_; |
| 136 | 142 |
| 137 gfx::Size natural_size_; | 143 gfx::Size natural_size_; |
| 138 | 144 |
| 139 // Request ID for tracking pending content decryption callbacks. | 145 // Request ID for tracking pending content decryption callbacks. |
| 140 // Note that zero indicates an invalid request ID. | 146 // Note that zero indicates an invalid request ID. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 169 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; | 175 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; |
| 170 base::WeakPtr<ContentDecryptorDelegate> weak_this_; | 176 base::WeakPtr<ContentDecryptorDelegate> weak_this_; |
| 171 | 177 |
| 172 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); | 178 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); |
| 173 }; | 179 }; |
| 174 | 180 |
| 175 } // namespace ppapi | 181 } // namespace ppapi |
| 176 } // namespace webkit | 182 } // namespace webkit |
| 177 | 183 |
| 178 #endif // WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ | 184 #endif // WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ |
| OLD | NEW |