OLD | NEW |
1 /* Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 | 5 |
6 /** | 6 /** |
7 * Defines the <code>PPB_ImageCapture_Private</code> interface. Used for | 7 * Defines the <code>PPB_ImageCapture_Private</code> interface. Used for |
8 * acquiring a single still image from a camera source. | 8 * acquiring a single still image from a camera source. |
9 */ | 9 */ |
10 | 10 |
11 [generate_thunk] | 11 [generate_thunk] |
12 | 12 |
13 label Chrome { | 13 label Chrome { |
14 M39 = 0.1 | 14 M42 = 0.1 |
15 }; | 15 }; |
16 | 16 |
17 /** | 17 /** |
18 * To query camera capabilities: | 18 * To query camera capabilities: |
19 * 1. Get a PPB_ImageCapture_Private object by Create(). | 19 * 1. Get a PPB_ImageCapture_Private object by Create(). |
20 * 2. Open() camera device with track id of MediaStream video track. | 20 * 2. Open() camera device with track id of MediaStream video track. |
21 * 3. Call GetCameraCapabilities() to get a | 21 * 3. Call GetCameraCapabilities() to get a |
22 * <code>PPB_CameraCapabilities_Private</code> object, which can be used to | 22 * <code>PPB_CameraCapabilities_Private</code> object, which can be used to |
23 * query camera capabilities. | 23 * query camera capabilities. |
24 */ | 24 */ |
25 interface PPB_ImageCapture_Private { | 25 interface PPB_ImageCapture_Private { |
26 /** | 26 /** |
27 * Creates a PPB_ImageCapture_Private resource. | 27 * Creates a PPB_ImageCapture_Private resource. |
28 * | 28 * |
29 * @param[in] instance A <code>PP_Instance</code> identifying one instance | 29 * @param[in] instance A <code>PP_Instance</code> identifying one instance |
30 * of a module. | 30 * of a module. |
31 * @param[in] camera_source_id A <code>PP_Var</code> identifying a camera | |
32 * source. The type is string. The ID can be obtained from | |
33 * MediaStreamTrack.getSources() or MediaStreamVideoTrack.id. If a | |
34 * MediaStreamVideoTrack is associated with the same source and the track | |
35 * is closed, this PPB_ImageCapture_Private object can still do image capture. | |
36 * @param[in] error_callback A <code>PPB_ImageCapture_Private_ErrorCallback | |
37 * </code> callback to indicate the image capture has failed. | |
38 * @param[inout] user_data An opaque pointer that will be passed to the | |
39 * callbacks of PPB_ImageCapture_Private. | |
40 * | 31 * |
41 * @return A <code>PP_Resource</code> corresponding to a | 32 * @return A <code>PP_Resource</code> corresponding to a |
42 * PPB_ImageCapture_Private resource if successful, 0 if failed. | 33 * PPB_ImageCapture_Private resource if successful, 0 if failed. |
43 */ | 34 */ |
44 PP_Resource Create([in] PP_Instance instance, | 35 PP_Resource Create([in] PP_Instance instance); |
45 [in] PP_Var camera_source_id, | |
46 [inout] mem_t user_data); | |
47 | 36 |
48 /** | 37 /** |
49 * Determines if a resource is an image capture resource. | 38 * Determines if a resource is an image capture resource. |
50 * | 39 * |
51 * @param[in] resource The <code>PP_Resource</code> to test. | 40 * @param[in] resource The <code>PP_Resource</code> to test. |
52 * | 41 * |
53 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | 42 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
54 * resource is an image capture resource or <code>PP_FALSE</code> | 43 * resource is an image capture resource or <code>PP_FALSE</code> |
55 * otherwise. | 44 * otherwise. |
56 */ | 45 */ |
57 PP_Bool IsImageCapture([in] PP_Resource resource); | 46 PP_Bool IsImageCapture([in] PP_Resource resource); |
58 | 47 |
59 /** | 48 /** |
| 49 * Opens a video capture device. |
| 50 * |
| 51 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an |
| 52 * image capture 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>. |
| 58 * |
| 59 * @return An error code from <code>pp_errors.h</code>. |
| 60 */ |
| 61 int32_t Open( |
| 62 [in] PP_Resource image_capture, |
| 63 [in] PP_Var device_id, |
| 64 [in] PP_CompletionCallback callback); |
| 65 |
| 66 /** |
60 * Disconnects from the camera and cancels all pending capture requests. | 67 * Disconnects from the camera and cancels all pending capture requests. |
61 * After this returns, no callbacks will be called. If <code> | 68 * After this returns, no callbacks will be called. If <code> |
62 * PPB_ImageCapture_Private</code> is destroyed and is not closed yet, this | 69 * PPB_ImageCapture_Private</code> is destroyed and is not closed yet, this |
63 * function will be automatically called. Calling this more than once has no | 70 * function will be automatically called. Calling this more than once has no |
64 * effect. | 71 * effect. |
65 * | 72 * |
66 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an | 73 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an |
67 * image capture resource. | 74 * image capture resource. |
68 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon | |
69 * completion of <code>Close()</code>. | |
70 * | |
71 * @return An int32_t containing a result code from <code>pp_errors.h</code>. | |
72 */ | 75 */ |
73 int32_t Close([in] PP_Resource resource, | 76 void Close([in] PP_Resource image_capture); |
74 [in] PP_CompletionCallback callback); | |
75 | 77 |
76 /** | 78 /** |
77 * Gets the camera capabilities. | 79 * Gets the camera capabilities. |
78 * | 80 * |
79 * The camera capabilities do not change for a given camera source. | 81 * The camera capabilities do not change for a given camera source. |
80 * | 82 * |
81 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an | 83 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an |
82 * image capture resource. | 84 * image capture resource. |
83 * @param[out] capabilities A <code>PPB_CameraCapabilities_Private</code> for | 85 * @param[out] capabilities A <code>PPB_CameraCapabilities_Private</code> for |
84 * storing the image capture capabilities on success. Otherwise, the value | 86 * storing the image capture capabilities on success. Otherwise, the value |
85 * will not be changed. | 87 * will not be changed. |
86 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon | 88 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon |
87 * completion of <code>GetCameraCapabilities()</code>. | 89 * completion of <code>GetCameraCapabilities()</code>. |
88 * | 90 * |
89 * @return An int32_t containing a result code from <code>pp_errors.h</code>. | 91 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
90 */ | 92 */ |
91 int32_t GetCameraCapabilities([in] PP_Resource image_capture, | 93 int32_t GetCameraCapabilities([in] PP_Resource image_capture, |
92 [out] PP_Resource capabilities, | 94 [out] PP_Resource capabilities, |
93 [in] PP_CompletionCallback callback); | 95 [in] PP_CompletionCallback callback); |
94 }; | 96 }; |
OLD | NEW |