Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "media/base/decryptor.h" | 13 #include "media/base/decryptor.h" |
| 14 #include "ppapi/c/private/pp_content_decryptor.h" | 14 #include "ppapi/c/private/pp_content_decryptor.h" |
| 15 #include "ppapi/c/private/ppp_content_decryptor_private.h" | 15 #include "ppapi/c/private/ppp_content_decryptor_private.h" |
| 16 #include "ppapi/shared_impl/scoped_pp_resource.h" | |
| 16 #include "webkit/plugins/webkit_plugins_export.h" | 17 #include "webkit/plugins/webkit_plugins_export.h" |
| 17 | 18 |
| 18 namespace media { | 19 namespace media { |
| 19 class AudioDecoderConfig; | 20 class AudioDecoderConfig; |
| 20 class DecoderBuffer; | 21 class DecoderBuffer; |
| 21 class DecryptorClient; | 22 class DecryptorClient; |
| 22 class VideoDecoderConfig; | 23 class VideoDecoderConfig; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace webkit { | 26 namespace webkit { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 uint32_t request_id); | 91 uint32_t request_id); |
| 91 void DeliverFrame(PP_Resource decrypted_frame, | 92 void DeliverFrame(PP_Resource decrypted_frame, |
| 92 const PP_DecryptedFrameInfo* frame_info); | 93 const PP_DecryptedFrameInfo* frame_info); |
| 93 void DeliverSamples(PP_Resource audio_frames, | 94 void DeliverSamples(PP_Resource audio_frames, |
| 94 const PP_DecryptedBlockInfo* block_info); | 95 const PP_DecryptedBlockInfo* block_info); |
| 95 | 96 |
| 96 private: | 97 private: |
| 97 // Cancels the pending decrypt-and-decode callback for |stream_type|. | 98 // Cancels the pending decrypt-and-decode callback for |stream_type|. |
| 98 void CancelDecode(media::Decryptor::StreamType stream_type); | 99 void CancelDecode(media::Decryptor::StreamType stream_type); |
| 99 | 100 |
| 101 // Fills |resource| with a PP_Resource containing a PPB_Buffer_Impl and | |
| 102 // copies |data| into the buffer resource. This method reuses | |
|
ddorwin
2012/11/17 02:07:38
Why "create" and copy in a single function? First,
xhwang
2012/11/18 00:10:33
This memcpy is for input, which is usually small.
| |
| 103 // |audio_input_resource_| and |video_input_resource_| to reduce the latency | |
| 104 // in requesting new PPB_Buffer_Impl resources. The caller must make sure that | |
| 105 // |audio_input_resource_| or |video_input_resource_| is available before | |
| 106 // calling this method. | |
| 107 // If |data| is NULL, fills |resource| with a PP_Resource with ID of 0. | |
| 108 // Returns true upon success and false if any error happened. | |
| 109 bool MakeMediaBufferResource(media::Decryptor::StreamType stream_type, | |
| 110 const uint8* data, int size, | |
| 111 ::ppapi::ScopedPPResource* resource); | |
| 112 | |
| 100 const PP_Instance pp_instance_; | 113 const PP_Instance pp_instance_; |
| 101 const PPP_ContentDecryptor_Private* const plugin_decryption_interface_; | 114 const PPP_ContentDecryptor_Private* const plugin_decryption_interface_; |
| 102 | 115 |
| 103 media::DecryptorClient* decryptor_client_; | 116 media::DecryptorClient* decryptor_client_; |
| 104 | 117 |
| 105 // Request ID for tracking pending content decryption callbacks. | 118 // Request ID for tracking pending content decryption callbacks. |
| 106 // Note that zero indicates an invalid request ID. | 119 // Note that zero indicates an invalid request ID. |
| 107 // TODO(xhwang): Add completion callbacks for Reset/Stop and remove the use | 120 // TODO(xhwang): Add completion callbacks for Reset/Stop and remove the use |
| 108 // of request IDs. | 121 // of request IDs. |
| 109 uint32_t next_decryption_request_id_; | 122 uint32_t next_decryption_request_id_; |
| 110 | 123 |
| 111 uint32_t pending_audio_decrypt_request_id_; | 124 uint32_t pending_audio_decrypt_request_id_; |
| 112 media::Decryptor::DecryptCB pending_audio_decrypt_cb_; | 125 media::Decryptor::DecryptCB pending_audio_decrypt_cb_; |
| 113 | 126 |
| 114 uint32_t pending_video_decrypt_request_id_; | 127 uint32_t pending_video_decrypt_request_id_; |
| 115 media::Decryptor::DecryptCB pending_video_decrypt_cb_; | 128 media::Decryptor::DecryptCB pending_video_decrypt_cb_; |
| 116 | 129 |
| 117 uint32_t pending_audio_decoder_init_request_id_; | 130 uint32_t pending_audio_decoder_init_request_id_; |
| 118 media::Decryptor::DecoderInitCB pending_audio_decoder_init_cb_; | 131 media::Decryptor::DecoderInitCB pending_audio_decoder_init_cb_; |
| 119 | 132 |
| 120 uint32_t pending_video_decoder_init_request_id_; | 133 uint32_t pending_video_decoder_init_request_id_; |
| 121 media::Decryptor::DecoderInitCB pending_video_decoder_init_cb_; | 134 media::Decryptor::DecoderInitCB pending_video_decoder_init_cb_; |
| 122 | 135 |
| 123 uint32_t pending_audio_decode_request_id_; | 136 uint32_t pending_audio_decode_request_id_; |
| 124 media::Decryptor::AudioDecodeCB pending_audio_decode_cb_; | 137 media::Decryptor::AudioDecodeCB pending_audio_decode_cb_; |
| 125 | 138 |
| 126 uint32_t pending_video_decode_request_id_; | 139 uint32_t pending_video_decode_request_id_; |
| 127 media::Decryptor::VideoDecodeCB pending_video_decode_cb_; | 140 media::Decryptor::VideoDecodeCB pending_video_decode_cb_; |
| 128 | 141 |
| 142 // ScopedPPResource for audio and video input buffers. | |
|
ddorwin
2012/11/17 02:07:38
Maybe add
// See MakeMediaBufferResource.
for an
xhwang
2012/11/18 00:10:33
Done.
| |
| 143 ::ppapi::ScopedPPResource audio_input_resource_; | |
| 144 int audio_input_resource_size_; | |
| 145 ::ppapi::ScopedPPResource video_input_resource_; | |
| 146 int video_input_resource_size_; | |
| 147 | |
| 129 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); | 148 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); |
| 130 }; | 149 }; |
| 131 | 150 |
| 132 } // namespace ppapi | 151 } // namespace ppapi |
| 133 } // namespace webkit | 152 } // namespace webkit |
| 134 | 153 |
| 135 #endif // WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ | 154 #endif // WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ |
| OLD | NEW |