Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ppapi / api / private / ppb_camera_device_private.idl
blobd87ac2059a8e0d236e75996cb557294a17a2e5a6
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 /**
7 * Defines the <code>PPB_CameraDevice_Private</code> interface. Used for
8 * manipulating a camera device.
9 */
11 [generate_thunk]
13 label Chrome {
14 M42 = 0.1
17 /**
18 * To query camera capabilities:
19 * 1. Get a PPB_CameraDevice_Private object by Create().
20 * 2. Open() camera device with track id of MediaStream video track.
21 * 3. Call GetCameraCapabilities() to get a
22 * <code>PPB_CameraCapabilities_Private</code> object, which can be used to
23 * query camera capabilities.
25 interface PPB_CameraDevice_Private {
26 /**
27 * Creates a PPB_CameraDevice_Private resource.
29 * @param[in] instance A <code>PP_Instance</code> identifying one instance
30 * of a module.
32 * @return A <code>PP_Resource</code> corresponding to a
33 * PPB_CameraDevice_Private resource if successful, 0 if failed.
35 PP_Resource Create([in] PP_Instance instance);
37 /**
38 * Determines if a resource is a camera device resource.
40 * @param[in] resource The <code>PP_Resource</code> to test.
42 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
43 * resource is a camera device resource or <code>PP_FALSE</code>
44 * otherwise.
46 PP_Bool IsCameraDevice([in] PP_Resource resource);
48 /**
49 * Opens a camera device.
51 * @param[in] camera_device A <code>PP_Resource</code> corresponding to a
52 * camera device resource.
53 * @param[in] device_id A <code>PP_Var</code> identifying a camera device. The
54 * type is string. The ID can be obtained from MediaStreamTrack.getSources()
55 * or MediaStreamVideoTrack.id.
56 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
57 * completion of <code>Open()</code>.
59 * @return An error code from <code>pp_errors.h</code>.
61 int32_t Open(
62 [in] PP_Resource camera_device,
63 [in] PP_Var device_id,
64 [in] PP_CompletionCallback callback);
66 /**
67 * Disconnects from the camera and cancels all pending requests.
68 * After this returns, no callbacks will be called. If <code>
69 * PPB_CameraDevice_Private</code> is destroyed and is not closed yet, this
70 * function will be automatically called. Calling this more than once has no
71 * effect.
73 * @param[in] camera_device A <code>PP_Resource</code> corresponding to a
74 * camera device resource.
76 void Close([in] PP_Resource camera_device);
78 /**
79 * Gets the camera capabilities.
81 * The camera capabilities do not change for a given camera source.
83 * @param[in] camera_device A <code>PP_Resource</code> corresponding to a
84 * camera device resource.
85 * @param[out] capabilities A <code>PPB_CameraCapabilities_Private</code> for
86 * storing the camera capabilities on success. Otherwise, the value will not
87 * be changed.
88 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon
89 * completion of <code>GetCameraCapabilities()</code>.
91 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
93 int32_t GetCameraCapabilities([in] PP_Resource camera_device,
94 [out] PP_Resource capabilities,
95 [in] PP_CompletionCallback callback);