Roll src/third_party/WebKit ef7cfd7:80927b2 (svn 194570:194575)
[chromium-blink-merge.git] / ppapi / c / private / ppb_camera_device_private.h
blob821ad299db95e2d4f151a18b1f334c6396f603c9
1 /* Copyright 2014 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.
4 */
6 /* From private/ppb_camera_device_private.idl,
7 * modified Fri Feb 20 13:48:52 2015.
8 */
10 #ifndef PPAPI_C_PRIVATE_PPB_CAMERA_DEVICE_PRIVATE_H_
11 #define PPAPI_C_PRIVATE_PPB_CAMERA_DEVICE_PRIVATE_H_
13 #include "ppapi/c/pp_bool.h"
14 #include "ppapi/c/pp_completion_callback.h"
15 #include "ppapi/c/pp_instance.h"
16 #include "ppapi/c/pp_macros.h"
17 #include "ppapi/c/pp_resource.h"
18 #include "ppapi/c/pp_stdint.h"
19 #include "ppapi/c/pp_var.h"
21 #define PPB_CAMERADEVICE_PRIVATE_INTERFACE_0_1 "PPB_CameraDevice_Private;0.1"
22 #define PPB_CAMERADEVICE_PRIVATE_INTERFACE \
23 PPB_CAMERADEVICE_PRIVATE_INTERFACE_0_1
25 /**
26 * @file
27 * Defines the <code>PPB_CameraDevice_Private</code> interface. Used for
28 * manipulating a camera device.
32 /**
33 * @addtogroup Interfaces
34 * @{
36 /**
37 * To query camera capabilities:
38 * 1. Get a PPB_CameraDevice_Private object by Create().
39 * 2. Open() camera device with track id of MediaStream video track.
40 * 3. Call GetCameraCapabilities() to get a
41 * <code>PPB_CameraCapabilities_Private</code> object, which can be used to
42 * query camera capabilities.
44 struct PPB_CameraDevice_Private_0_1 {
45 /**
46 * Creates a PPB_CameraDevice_Private resource.
48 * @param[in] instance A <code>PP_Instance</code> identifying one instance
49 * of a module.
51 * @return A <code>PP_Resource</code> corresponding to a
52 * PPB_CameraDevice_Private resource if successful, 0 if failed.
54 PP_Resource (*Create)(PP_Instance instance);
55 /**
56 * Determines if a resource is a camera device resource.
58 * @param[in] resource The <code>PP_Resource</code> to test.
60 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
61 * resource is a camera device resource or <code>PP_FALSE</code>
62 * otherwise.
64 PP_Bool (*IsCameraDevice)(PP_Resource resource);
65 /**
66 * Opens a camera device.
68 * @param[in] camera_device A <code>PP_Resource</code> corresponding to a
69 * camera device resource.
70 * @param[in] device_id A <code>PP_Var</code> identifying a camera device. The
71 * type is string. The ID can be obtained from MediaStreamTrack.getSources()
72 * or MediaStreamVideoTrack.id.
73 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
74 * completion of <code>Open()</code>.
76 * @return An error code from <code>pp_errors.h</code>.
78 int32_t (*Open)(PP_Resource camera_device,
79 struct PP_Var device_id,
80 struct PP_CompletionCallback callback);
81 /**
82 * Disconnects from the camera and cancels all pending requests.
83 * After this returns, no callbacks will be called. If <code>
84 * PPB_CameraDevice_Private</code> is destroyed and is not closed yet, this
85 * function will be automatically called. Calling this more than once has no
86 * effect.
88 * @param[in] camera_device A <code>PP_Resource</code> corresponding to a
89 * camera device resource.
91 void (*Close)(PP_Resource camera_device);
92 /**
93 * Gets the camera capabilities.
95 * The camera capabilities do not change for a given camera source.
97 * @param[in] camera_device A <code>PP_Resource</code> corresponding to a
98 * camera device resource.
99 * @param[out] capabilities A <code>PPB_CameraCapabilities_Private</code> for
100 * storing the camera capabilities on success. Otherwise, the value will not
101 * be changed.
102 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon
103 * completion of <code>GetCameraCapabilities()</code>.
105 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
107 int32_t (*GetCameraCapabilities)(PP_Resource camera_device,
108 PP_Resource* capabilities,
109 struct PP_CompletionCallback callback);
112 typedef struct PPB_CameraDevice_Private_0_1 PPB_CameraDevice_Private;
114 * @}
117 #endif /* PPAPI_C_PRIVATE_PPB_CAMERA_DEVICE_PRIVATE_H_ */