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 1749ab05fe3f26d62425b40a84d85f7d334acb46..e245b69e3b1e05102ec6ba7e173ba26b77f6b197 100644 |
| --- a/ppapi/cpp/dev/video_decoder_dev.cc |
| +++ b/ppapi/cpp/dev/video_decoder_dev.cc |
| @@ -4,7 +4,8 @@ |
| #include "ppapi/cpp/dev/video_decoder_dev.h" |
| -#include "ppapi/c/dev/ppb_video_decoder_dev.h" |
| +#include <algorithm> |
| + |
| #include "ppapi/c/dev/ppp_video_decoder_dev.h" |
| #include "ppapi/c/pp_errors.h" |
| #include "ppapi/cpp/common.h" |
| @@ -36,23 +37,49 @@ VideoDecoder::VideoDecoder(const Instance* /* instance */, |
| VideoDecoder::~VideoDecoder() {} |
| vector<uint32_t> VideoDecoder::GetConfigs( |
| - Instance* /* instance */, |
| - const vector<uint32_t>& /* prototype_config */) { |
| + Instance* instance, |
| + const vector<uint32_t>& prototype_config) { |
| // TODO(vmr): Implement. |
| - vector<uint32_t> matching_configs; |
| + vector<uint32_t> empty_config; |
| if (!has_interface<PPB_VideoDecoder_Dev>()) |
| - return matching_configs; |
| - return matching_configs; |
| + return empty_config; |
| + |
| + // Get the number of matching configs first. |
| + uint32_t num_of_matching_configs; |
| + PP_VideoConfigElement* proto_config_array = |
|
Ami GONE FROM CHROMIUM
2011/05/24 17:55:07
scoped_array?
|
| + new PP_VideoConfigElement[prototype_config.size()]; |
| + std::copy(prototype_config.begin(), prototype_config.end(), |
| + proto_config_array); |
| + get_interface<PPB_VideoDecoder_Dev>()->GetConfigs( |
| + instance->pp_instance(), proto_config_array, NULL, 0, |
| + &num_of_matching_configs); |
| + if (num_of_matching_configs == 0) { |
| + delete [] proto_config_array; |
| + return empty_config; |
| + } |
| + |
| + // Then get the actual configs and restore it in a vector. |
|
Ami GONE FROM CHROMIUM
2011/05/24 17:55:07
s/restore it/store them/
|
| + PP_VideoConfigElement* matching_config_array |
| + = new PP_VideoConfigElement[num_of_matching_configs]; |
|
Ami GONE FROM CHROMIUM
2011/05/24 17:55:07
indent
|
| + get_interface<PPB_VideoDecoder_Dev>()->GetConfigs( |
| + instance->pp_instance(), proto_config_array, matching_config_array, |
| + num_of_matching_configs, &num_of_matching_configs); |
| + vector<uint32_t> matches(matching_config_array[0], |
| + matching_config_array[num_of_matching_configs - 1]); |
| + delete [] matching_config_array; |
| + delete [] proto_config_array; |
| + return matches; |
| } |
| -void VideoDecoder::AssignGLESBuffers(uint32_t /* no_of_buffers */, |
| - const PP_GLESBuffer_Dev& /* buffers */) { |
| +void VideoDecoder::AssignGLESBuffers( |
| + uint32_t /* no_of_buffers */, |
| + const std::vector<PP_GLESBuffer_Dev>& /* buffers */) { |
| // TODO(vmr): Implement. |
| } |
| void VideoDecoder::AssignSysmemBuffers( |
| uint32_t /* no_of_buffers */, |
| - const PP_SysmemBuffer_Dev& /* buffers */) { |
| + const std::vector<PP_SysmemBuffer_Dev>& /* buffers */) { |
| // TODO(vmr): Implement. |
| } |