Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ppapi/cpp/dev/video_decoder_dev.h" | 5 #include "ppapi/cpp/dev/video_decoder_dev.h" |
| 6 | 6 |
| 7 #include "ppapi/c/dev/ppb_video_decoder_dev.h" | 7 #include <algorithm> |
| 8 | |
| 8 #include "ppapi/c/dev/ppp_video_decoder_dev.h" | 9 #include "ppapi/c/dev/ppp_video_decoder_dev.h" |
| 9 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/cpp/common.h" | 11 #include "ppapi/cpp/common.h" |
| 11 #include "ppapi/cpp/instance.h" | 12 #include "ppapi/cpp/instance.h" |
| 12 #include "ppapi/cpp/module.h" | 13 #include "ppapi/cpp/module.h" |
| 13 #include "ppapi/cpp/module_impl.h" | 14 #include "ppapi/cpp/module_impl.h" |
| 14 | 15 |
| 15 using std::vector; | 16 using std::vector; |
| 16 | 17 |
| 17 namespace pp { | 18 namespace pp { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 29 Client* client) | 30 Client* client) |
| 30 : client_(client) { | 31 : client_(client) { |
| 31 if (!has_interface<PPB_VideoDecoder_Dev>()) | 32 if (!has_interface<PPB_VideoDecoder_Dev>()) |
| 32 return; | 33 return; |
| 33 // TODO(vmr): Implement. | 34 // TODO(vmr): Implement. |
| 34 } | 35 } |
| 35 | 36 |
| 36 VideoDecoder::~VideoDecoder() {} | 37 VideoDecoder::~VideoDecoder() {} |
| 37 | 38 |
| 38 vector<uint32_t> VideoDecoder::GetConfigs( | 39 vector<uint32_t> VideoDecoder::GetConfigs( |
| 39 Instance* /* instance */, | 40 Instance* instance, |
| 40 const vector<uint32_t>& /* prototype_config */) { | 41 const vector<uint32_t>& prototype_config) { |
| 41 // TODO(vmr): Implement. | 42 // TODO(vmr): Implement. |
| 42 vector<uint32_t> matching_configs; | 43 vector<uint32_t> empty_config; |
| 43 if (!has_interface<PPB_VideoDecoder_Dev>()) | 44 if (!has_interface<PPB_VideoDecoder_Dev>()) |
| 44 return matching_configs; | 45 return empty_config; |
| 45 return matching_configs; | 46 |
| 47 // Get the number of matching configs first. | |
| 48 uint32_t num_of_matching_configs; | |
| 49 PP_VideoConfigElement* proto_config_array = | |
|
Ami GONE FROM CHROMIUM
2011/05/24 17:55:07
scoped_array?
| |
| 50 new PP_VideoConfigElement[prototype_config.size()]; | |
| 51 std::copy(prototype_config.begin(), prototype_config.end(), | |
| 52 proto_config_array); | |
| 53 get_interface<PPB_VideoDecoder_Dev>()->GetConfigs( | |
| 54 instance->pp_instance(), proto_config_array, NULL, 0, | |
| 55 &num_of_matching_configs); | |
| 56 if (num_of_matching_configs == 0) { | |
| 57 delete [] proto_config_array; | |
| 58 return empty_config; | |
| 59 } | |
| 60 | |
| 61 // 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/
| |
| 62 PP_VideoConfigElement* matching_config_array | |
| 63 = new PP_VideoConfigElement[num_of_matching_configs]; | |
|
Ami GONE FROM CHROMIUM
2011/05/24 17:55:07
indent
| |
| 64 get_interface<PPB_VideoDecoder_Dev>()->GetConfigs( | |
| 65 instance->pp_instance(), proto_config_array, matching_config_array, | |
| 66 num_of_matching_configs, &num_of_matching_configs); | |
| 67 vector<uint32_t> matches(matching_config_array[0], | |
| 68 matching_config_array[num_of_matching_configs - 1]); | |
| 69 delete [] matching_config_array; | |
| 70 delete [] proto_config_array; | |
| 71 return matches; | |
| 46 } | 72 } |
| 47 | 73 |
| 48 void VideoDecoder::AssignGLESBuffers(uint32_t /* no_of_buffers */, | 74 void VideoDecoder::AssignGLESBuffers( |
| 49 const PP_GLESBuffer_Dev& /* buffers */) { | 75 uint32_t /* no_of_buffers */, |
| 76 const std::vector<PP_GLESBuffer_Dev>& /* buffers */) { | |
| 50 // TODO(vmr): Implement. | 77 // TODO(vmr): Implement. |
| 51 } | 78 } |
| 52 | 79 |
| 53 void VideoDecoder::AssignSysmemBuffers( | 80 void VideoDecoder::AssignSysmemBuffers( |
| 54 uint32_t /* no_of_buffers */, | 81 uint32_t /* no_of_buffers */, |
| 55 const PP_SysmemBuffer_Dev& /* buffers */) { | 82 const std::vector<PP_SysmemBuffer_Dev>& /* buffers */) { |
| 56 // TODO(vmr): Implement. | 83 // TODO(vmr): Implement. |
| 57 } | 84 } |
| 58 | 85 |
| 59 bool VideoDecoder::Decode( | 86 bool VideoDecoder::Decode( |
| 60 const PP_VideoBitstreamBuffer_Dev& /* bitstream_buffer */, | 87 const PP_VideoBitstreamBuffer_Dev& /* bitstream_buffer */, |
| 61 CompletionCallback /* callback */) { | 88 CompletionCallback /* callback */) { |
| 62 // TODO(vmr): Implement. | 89 // TODO(vmr): Implement. |
| 63 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) | 90 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) |
| 64 return false; | 91 return false; |
| 65 return false; | 92 return false; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 77 } | 104 } |
| 78 | 105 |
| 79 bool VideoDecoder::Abort(CompletionCallback /* callback */) { | 106 bool VideoDecoder::Abort(CompletionCallback /* callback */) { |
| 80 // TODO(vmr): Implement. | 107 // TODO(vmr): Implement. |
| 81 if (!has_interface<PPB_VideoDecoder_Dev>()) | 108 if (!has_interface<PPB_VideoDecoder_Dev>()) |
| 82 return false; | 109 return false; |
| 83 return true; | 110 return true; |
| 84 } | 111 } |
| 85 | 112 |
| 86 } // namespace pp | 113 } // namespace pp |
| OLD | NEW |