1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ppapi/cpp/private/camera_capabilities_private.h"
7 #include "ppapi/c/pp_bool.h"
8 #include "ppapi/c/pp_size.h"
9 #include "ppapi/cpp/instance_handle.h"
10 #include "ppapi/cpp/module_impl.h"
17 const char* interface_name
<PPB_CameraCapabilities_Private_0_1
>() {
18 return PPB_CAMERACAPABILITIES_PRIVATE_INTERFACE_0_1
;
23 CameraCapabilities_Private::CameraCapabilities_Private() {
26 CameraCapabilities_Private::CameraCapabilities_Private(
27 const CameraCapabilities_Private
& other
)
31 CameraCapabilities_Private::CameraCapabilities_Private(const Resource
& resource
)
32 : Resource(resource
) {
33 PP_DCHECK(IsCameraCapabilities(resource
));
36 CameraCapabilities_Private::CameraCapabilities_Private(PassRef
,
38 : Resource(PASS_REF
, resource
) {
41 CameraCapabilities_Private::~CameraCapabilities_Private() {
44 void CameraCapabilities_Private::GetSupportedVideoCaptureFormats(
45 std::vector
<PP_VideoCaptureFormat
>* formats
) {
46 if (!has_interface
<PPB_CameraCapabilities_Private_0_1
>()) {
52 PP_VideoCaptureFormat
* array
;
53 get_interface
<PPB_CameraCapabilities_Private_0_1
>()
54 ->GetSupportedVideoCaptureFormats(pp_resource(), &array_size
, &array
);
56 formats
->reserve(array_size
);
57 for (uint32_t i
= 0; i
< array_size
; i
++) {
58 formats
->push_back(array
[i
]);
63 bool CameraCapabilities_Private::IsCameraCapabilities(
64 const Resource
& resource
) {
65 if (!has_interface
<PPB_CameraCapabilities_Private_0_1
>())
69 get_interface
<PPB_CameraCapabilities_Private_0_1
>()->IsCameraCapabilities(
70 resource
.pp_resource()));