Chromium Code Reviews| Index: ppapi/cpp/dev/video_decoder_dev.cc |
| diff --git a/ppapi/cpp/dev/video_decoder_dev.cc b/ppapi/cpp/dev/video_decoder_dev.cc |
| index 504530a29616642ddb08da314695e13f02a0d2cb..0750e22b79f26fec935286981bf00ca37c271fb4 100644 |
| --- a/ppapi/cpp/dev/video_decoder_dev.cc |
| +++ b/ppapi/cpp/dev/video_decoder_dev.cc |
| @@ -12,8 +12,6 @@ |
| #include "ppapi/cpp/module.h" |
| #include "ppapi/cpp/module_impl.h" |
| -using std::vector; |
| - |
| namespace pp { |
| namespace { |
| @@ -24,64 +22,74 @@ template <> const char* interface_name<PPB_VideoDecoder_Dev>() { |
| } // namespace |
| -VideoDecoder::VideoDecoder(const Instance* /* instance */, |
| - const std::vector<uint32_t>& /* config */, |
| - CompletionCallback /* callback */, |
| +VideoDecoder::VideoDecoder(const Instance* instance, |
| + PP_VideoConfigElement* config, |
|
Ami GONE FROM CHROMIUM
2011/06/01 18:26:28
const
Ville-Mikko Rautio
2011/06/03 09:26:05
Done.
|
| + CompletionCallback callback, |
| Client* client) |
| : client_(client) { |
| if (!has_interface<PPB_VideoDecoder_Dev>()) |
| return; |
| - // TODO(vmr): Implement. |
| + PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create( |
| + instance->pp_instance(), config, callback.pp_completion_callback())); |
| } |
| VideoDecoder::~VideoDecoder() {} |
| -vector<uint32_t> VideoDecoder::GetConfigs( |
| - Instance* /* instance */, |
| - const vector<uint32_t>& /* prototype_config */) { |
| - // TODO(vmr): Implement. |
| - vector<uint32_t> matching_configs; |
| +bool VideoDecoder::GetConfigs(Instance* instance, |
| + const PP_VideoConfigElement* prototype_config, |
| + PP_VideoConfigElement* matching_configs, |
| + uint32_t matching_configs_size, |
| + uint32_t* num_of_matching_configs) { |
| if (!has_interface<PPB_VideoDecoder_Dev>()) |
| - return matching_configs; |
| - return matching_configs; |
| + return false; |
| + return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->GetConfigs( |
| + instance->pp_instance(), prototype_config, matching_configs, |
| + matching_configs_size, num_of_matching_configs)); |
| } |
| -void VideoDecoder::AssignGLESBuffers(uint32_t /* no_of_buffers */, |
| - const PP_GLESBuffer_Dev& /* buffers */) { |
| - // TODO(vmr): Implement. |
| +void VideoDecoder::AssignGLESBuffers( |
| + const std::vector<PP_GLESBuffer_Dev>& buffers) { |
| + if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) |
| + return; |
| + get_interface<PPB_VideoDecoder_Dev>()->AssignGLESBuffers( |
| + pp_resource(), buffers.size(), &buffers[0]); |
| } |
| void VideoDecoder::AssignSysmemBuffers( |
| - uint32_t /* no_of_buffers */, |
| - const PP_SysmemBuffer_Dev& /* buffers */) { |
| - // TODO(vmr): Implement. |
| + const std::vector<PP_SysmemBuffer_Dev>& buffers) { |
| + if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) |
| + return; |
| + get_interface<PPB_VideoDecoder_Dev>()->AssignSysmemBuffers( |
| + pp_resource(), buffers.size(), &buffers[0]); |
| } |
| -bool VideoDecoder::Decode( |
| - const PP_VideoBitstreamBuffer_Dev& /* bitstream_buffer */, |
| - CompletionCallback /* callback */) { |
| - // TODO(vmr): Implement. |
| +bool VideoDecoder::Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer, |
| + CompletionCallback callback) { |
| if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) |
| return false; |
| - return false; |
| + return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Decode( |
| + pp_resource(), &bitstream_buffer, callback.pp_completion_callback())); |
| } |
| -void VideoDecoder::ReusePictureBuffer(int32_t /* picture_buffer_id */) { |
| - // TODO(vmr): Implement. |
| +void VideoDecoder::ReusePictureBuffer(int32_t picture_buffer_id) { |
| + if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) |
| + return; |
| + get_interface<PPB_VideoDecoder_Dev>()->ReusePictureBuffer( |
| + pp_resource(), picture_buffer_id); |
| } |
| -bool VideoDecoder::Flush(CompletionCallback /* callback */) { |
| - // TODO(vmr): Implement. |
| - if (!has_interface<PPB_VideoDecoder_Dev>()) |
| +bool VideoDecoder::Flush(CompletionCallback callback) { |
| + if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) |
| return false; |
| - return true; |
| + return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Flush( |
| + pp_resource(), callback.pp_completion_callback())); |
| } |
| -bool VideoDecoder::Abort(CompletionCallback /* callback */) { |
| - // TODO(vmr): Implement. |
| - if (!has_interface<PPB_VideoDecoder_Dev>()) |
| +bool VideoDecoder::Abort(CompletionCallback callback) { |
| + if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) |
| return false; |
| - return true; |
| + return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Abort( |
| + pp_resource(), callback.pp_completion_callback())); |
| } |
| } // namespace pp |