| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "media/base/decryptor.h" | 15 #include "media/base/decryptor.h" |
| 16 #include "ppapi/c/private/pp_content_decryptor.h" | 16 #include "ppapi/c/private/pp_content_decryptor.h" |
| 17 #include "ppapi/c/private/ppp_content_decryptor_private.h" | 17 #include "ppapi/c/private/ppp_content_decryptor_private.h" |
| 18 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
| 19 #include "webkit/plugins/webkit_plugins_export.h" | 19 #include "webkit/plugins/webkit_plugins_export.h" |
| 20 | 20 |
| 21 namespace media { | 21 namespace media { |
| 22 class AudioDecoderConfig; | 22 class AudioDecoderConfig; |
| 23 class DecoderBuffer; | 23 class DecoderBuffer; |
| 24 class DecryptorClient; | |
| 25 class VideoDecoderConfig; | 24 class VideoDecoderConfig; |
| 26 } | 25 } |
| 27 | 26 |
| 28 namespace webkit { | 27 namespace webkit { |
| 29 namespace ppapi { | 28 namespace ppapi { |
| 30 | 29 |
| 31 class PPB_Buffer_Impl; | 30 class PPB_Buffer_Impl; |
| 32 | 31 |
| 33 class WEBKIT_PLUGINS_EXPORT ContentDecryptorDelegate { | 32 class WEBKIT_PLUGINS_EXPORT ContentDecryptorDelegate { |
| 34 public: | 33 public: |
| 35 // ContentDecryptorDelegate does not take ownership of | 34 // ContentDecryptorDelegate does not take ownership of |
| 36 // |plugin_decryption_interface|. Therefore |plugin_decryption_interface| | 35 // |plugin_decryption_interface|. Therefore |plugin_decryption_interface| |
| 37 // must outlive this object. | 36 // must outlive this object. |
| 38 ContentDecryptorDelegate( | 37 ContentDecryptorDelegate( |
| 39 PP_Instance pp_instance, | 38 PP_Instance pp_instance, |
| 40 const PPP_ContentDecryptor_Private* plugin_decryption_interface); | 39 const PPP_ContentDecryptor_Private* plugin_decryption_interface); |
| 41 | 40 |
| 41 void SetKeyEventCallbacks(const media::KeyAddedCB& key_added_cb, |
| 42 const media::KeyErrorCB& key_error_cb, |
| 43 const media::KeyMessageCB& key_message_cb, |
| 44 const media::NeedKeyCB& need_key_cb); |
| 45 |
| 42 // Provides access to PPP_ContentDecryptor_Private. | 46 // Provides access to PPP_ContentDecryptor_Private. |
| 43 void set_decrypt_client(media::DecryptorClient* decryptor_client); | |
| 44 bool GenerateKeyRequest(const std::string& key_system, | 47 bool GenerateKeyRequest(const std::string& key_system, |
| 45 const std::string& type, | 48 const std::string& type, |
| 46 const uint8* init_data, | 49 const uint8* init_data, |
| 47 int init_data_length); | 50 int init_data_length); |
| 48 bool AddKey(const std::string& session_id, | 51 bool AddKey(const std::string& session_id, |
| 49 const uint8* key, | 52 const uint8* key, |
| 50 int key_length, | 53 int key_length, |
| 51 const uint8* init_data, | 54 const uint8* init_data, |
| 52 int init_data_length); | 55 int init_data_length); |
| 53 bool CancelKeyRequest(const std::string& session_id); | 56 bool CancelKeyRequest(const std::string& session_id); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 const uint8* data, uint32_t size, | 117 const uint8* data, uint32_t size, |
| 115 scoped_refptr<PPB_Buffer_Impl>* resource); | 118 scoped_refptr<PPB_Buffer_Impl>* resource); |
| 116 | 119 |
| 117 void FreeBuffer(uint32_t buffer_id); | 120 void FreeBuffer(uint32_t buffer_id); |
| 118 | 121 |
| 119 void SetBufferToFreeInTrackingInfo(PP_DecryptTrackingInfo* tracking_info); | 122 void SetBufferToFreeInTrackingInfo(PP_DecryptTrackingInfo* tracking_info); |
| 120 | 123 |
| 121 const PP_Instance pp_instance_; | 124 const PP_Instance pp_instance_; |
| 122 const PPP_ContentDecryptor_Private* const plugin_decryption_interface_; | 125 const PPP_ContentDecryptor_Private* const plugin_decryption_interface_; |
| 123 | 126 |
| 124 media::DecryptorClient* decryptor_client_; | 127 // Callbacks for firing key events. |
| 128 media::KeyAddedCB key_added_cb_; |
| 129 media::KeyErrorCB key_error_cb_; |
| 130 media::KeyMessageCB key_message_cb_; |
| 131 media::NeedKeyCB need_key_cb_; |
| 125 | 132 |
| 126 gfx::Size natural_size_; | 133 gfx::Size natural_size_; |
| 127 | 134 |
| 128 // Request ID for tracking pending content decryption callbacks. | 135 // Request ID for tracking pending content decryption callbacks. |
| 129 // Note that zero indicates an invalid request ID. | 136 // Note that zero indicates an invalid request ID. |
| 130 // TODO(xhwang): Add completion callbacks for Reset/Stop and remove the use | 137 // TODO(xhwang): Add completion callbacks for Reset/Stop and remove the use |
| 131 // of request IDs. | 138 // of request IDs. |
| 132 uint32_t next_decryption_request_id_; | 139 uint32_t next_decryption_request_id_; |
| 133 | 140 |
| 134 uint32_t pending_audio_decrypt_request_id_; | 141 uint32_t pending_audio_decrypt_request_id_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 158 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; | 165 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; |
| 159 base::WeakPtr<ContentDecryptorDelegate> weak_this_; | 166 base::WeakPtr<ContentDecryptorDelegate> weak_this_; |
| 160 | 167 |
| 161 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); | 168 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); |
| 162 }; | 169 }; |
| 163 | 170 |
| 164 } // namespace ppapi | 171 } // namespace ppapi |
| 165 } // namespace webkit | 172 } // namespace webkit |
| 166 | 173 |
| 167 #endif // WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ | 174 #endif // WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ |
| OLD | NEW |