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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 uint32_t request_id); | 98 uint32_t request_id); |
99 void DeliverFrame(PP_Resource decrypted_frame, | 99 void DeliverFrame(PP_Resource decrypted_frame, |
100 const PP_DecryptedFrameInfo* frame_info); | 100 const PP_DecryptedFrameInfo* frame_info); |
101 void DeliverSamples(PP_Resource audio_frames, | 101 void DeliverSamples(PP_Resource audio_frames, |
102 const PP_DecryptedBlockInfo* block_info); | 102 const PP_DecryptedBlockInfo* block_info); |
103 | 103 |
104 private: | 104 private: |
105 // Cancels the pending decrypt-and-decode callback for |stream_type|. | 105 // Cancels the pending decrypt-and-decode callback for |stream_type|. |
106 void CancelDecode(media::Decryptor::StreamType stream_type); | 106 void CancelDecode(media::Decryptor::StreamType stream_type); |
107 | 107 |
108 // Fills |resource| with a PPB_Buffer_Impl and copies |data| into the buffer | 108 // Fills |resource| with a PPB_Buffer_Impl and copies the data from |
109 // resource. This method reuses |audio_input_resource_| and | 109 // |encrypted_buffer| into the buffer resource. This method reuses |
110 // |video_input_resource_| to reduce the latency in requesting new | 110 // |audio_input_resource_| and |video_input_resource_| to reduce the latency |
111 // PPB_Buffer_Impl resources. The caller must make sure that | 111 // in requesting new PPB_Buffer_Impl resources. The caller must make sure that |
112 // |audio_input_resource_| or |video_input_resource_| is available before | 112 // |audio_input_resource_| or |video_input_resource_| is available before |
113 // calling this method. | 113 // calling this method. |
114 // If |data| is NULL, sets |*resource| to NULL. | 114 // |
| 115 // An end of stream |encrypted_buffer| is represented as a null |resource|. |
| 116 // |
115 // Returns true upon success and false if any error happened. | 117 // Returns true upon success and false if any error happened. |
116 bool MakeMediaBufferResource(media::Decryptor::StreamType stream_type, | 118 bool MakeMediaBufferResource( |
117 const uint8* data, uint32_t size, | 119 media::Decryptor::StreamType stream_type, |
118 scoped_refptr<PPB_Buffer_Impl>* resource); | 120 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
| 121 scoped_refptr<PPB_Buffer_Impl>* resource); |
119 | 122 |
120 void FreeBuffer(uint32_t buffer_id); | 123 void FreeBuffer(uint32_t buffer_id); |
121 | 124 |
122 void SetBufferToFreeInTrackingInfo(PP_DecryptTrackingInfo* tracking_info); | 125 void SetBufferToFreeInTrackingInfo(PP_DecryptTrackingInfo* tracking_info); |
123 | 126 |
124 const PP_Instance pp_instance_; | 127 const PP_Instance pp_instance_; |
125 const PPP_ContentDecryptor_Private* const plugin_decryption_interface_; | 128 const PPP_ContentDecryptor_Private* const plugin_decryption_interface_; |
126 | 129 |
127 // Callbacks for firing key events. | 130 // Callbacks for firing key events. |
128 media::KeyAddedCB key_added_cb_; | 131 media::KeyAddedCB key_added_cb_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; | 168 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; |
166 base::WeakPtr<ContentDecryptorDelegate> weak_this_; | 169 base::WeakPtr<ContentDecryptorDelegate> weak_this_; |
167 | 170 |
168 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); | 171 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); |
169 }; | 172 }; |
170 | 173 |
171 } // namespace ppapi | 174 } // namespace ppapi |
172 } // namespace webkit | 175 } // namespace webkit |
173 | 176 |
174 #endif // WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ | 177 #endif // WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ |
OLD | NEW |