OLD | NEW |
---|---|
(Empty) | |
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 */ | |
5 | |
6 /* From private/ppb_image_capture_private.idl, | |
7 * modified Wed Aug 6 16:10:41 2014. | |
8 */ | |
9 | |
10 #ifndef PPAPI_C_PRIVATE_PPB_IMAGE_CAPTURE_PRIVATE_H_ | |
11 #define PPAPI_C_PRIVATE_PPB_IMAGE_CAPTURE_PRIVATE_H_ | |
12 | |
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" | |
20 | |
21 #define PPB_IMAGECAPTURE_PRIVATE_INTERFACE_0_1 "PPB_ImageCapture_Private;0.1" | |
22 #define PPB_IMAGECAPTURE_PRIVATE_INTERFACE \ | |
23 PPB_IMAGECAPTURE_PRIVATE_INTERFACE_0_1 | |
24 | |
25 /** | |
26 * @file | |
27 * Defines the <code>PPB_ImageCapture_Private</code> interface. Used for taking | |
28 * an image from a camera source. | |
29 */ | |
30 | |
31 | |
32 /** | |
33 * @addtogroup Typedefs | |
34 * @{ | |
35 */ | |
36 /** | |
37 * Callback function for <code>PPB_ImageCapture_Private.CaptureStillImage | |
38 * </code>. Called as near as possible to the moment when an image is | |
39 * captured from the sensor. This is a good opportunity to play a shutter | |
40 * sound or give other feedback of camera operation. This will occur after | |
41 * the image was captured, but before the actual data is available. | |
42 * | |
43 * Parameters: | |
44 * |image_capture| the PPB_ImageCapture_Private resource. | |
45 * |sequence_id| The sequence ID of the image capture, same as the one from | |
46 * CaptureStillImage. | |
47 */ | |
48 typedef void (*PPB_ImageCapture_Private_ShutterCallback)( | |
49 PP_Resource image_capture, | |
50 int64_t sequence_id); | |
51 | |
52 /** | |
53 * Callback function for <code>PPB_ImageCapture_Private.CaptureStillImage | |
54 * </code>. Called for the camera to deliver a preview image. The client | |
55 * can use this to show the captured image. The format and the size are | |
56 * decided by the associated MediaStream video tracks. Call | |
57 * <code>PPB_VideoFrame</code> functions to know the exact format and size. | |
58 * | |
59 * Parameters: | |
60 * |image_capture| the PPB_ImageCapture_Private resource. | |
61 * |sequence_id| The sequence ID of the image capture, same as the one from | |
62 * CaptureStillImage. | |
63 * |preview| A <code>PP_Resource</code> corresponding to a VideoFrame | |
64 * resource used to store the preview image. | |
65 */ | |
66 typedef void (*PPB_ImageCapture_Private_PreviewCallback)( | |
67 PP_Resource image_capture, | |
68 int64_t sequence_id, | |
69 PP_Resource preview); | |
70 | |
71 /** | |
72 * Callback function for <code>PPB_ImageCapture_Private.CaptureStillImage | |
73 * </code>. Called for the camera to deliver a still JPEG image. | |
74 * | |
75 * Parameters: | |
76 * |image_capture| the PPB_ImageCapture_Private resource. | |
77 * |sequence_id| The sequence ID of the image capture, same as the one from | |
78 * CaptureStillImage. | |
79 * |jpeg| A <code>PP_Resource</code> corresponding to a VideoFrame | |
80 * resource used to store the JPEG image. | |
81 */ | |
82 typedef void (*PPB_ImageCapture_Private_JPEGCallback)(PP_Resource image_capture, | |
83 int64_t sequence_id, | |
84 PP_Resource jpeg); | |
85 /** | |
86 * @} | |
87 */ | |
88 | |
89 /** | |
90 * @addtogroup Interfaces | |
91 * @{ | |
92 */ | |
93 struct PPB_ImageCapture_Private_0_1 { | |
94 /** | |
95 * Creates a PPB_ImageCapture_Private resource. | |
96 * | |
97 * @param[in] instance A <code>PP_Instance</code> identifying one instance | |
98 * of a module. | |
99 * @param[in] camera_source_id A <code>PP_Var</code> identifying a camera | |
100 * source. The type is string. The ID can be obtained from | |
101 * MediaStreamTrack.getSources() or MediaStreamVideoTrack.id. If a | |
102 * MediaStreamVideoTrack is associated with the same source and the track | |
103 * is closed, this PPB_ImageCapture_Private object can still do image capture. | |
104 * | |
105 * @return A <code>PP_Resource</code> corresponding to a | |
106 * PPB_ImageCapture_Private resource if successful, 0 if failed. | |
107 */ | |
108 PP_Resource (*Create)(PP_Instance instance, struct PP_Var camera_source_id); | |
109 /** | |
110 * Determines if a resource is an image capture resource. | |
111 * | |
112 * @param[in] resource The <code>PP_Resource</code> to test. | |
113 * | |
114 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | |
115 * resource is an image capture resource or <code>PP_FALSE</code> | |
116 * otherwise. | |
117 */ | |
118 PP_Bool (*IsImageCapture)(PP_Resource resource); | |
119 /** | |
120 * Disconnects from the camera and cancels all pending capture requests. | |
121 * After this returns, no callbacks will be called. If <code> | |
122 * PPB_ImageCapture_Private</code> is destroyed and is not closed yet, this | |
123 * function will be automatically called. Calling this more than once has no | |
124 * effect. | |
125 * | |
126 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an | |
127 * image capture resource. | |
128 */ | |
129 void (*Close)(PP_Resource resource); | |
130 /** | |
131 * Sets the configuration of the image capture. | |
132 * If <code>SetConfig()</code> is not called, default settings will be used. | |
133 * | |
134 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an | |
135 * image capture resource. | |
136 * @param[in] config A <code>PP_ImageCaptureConfig_Private</code> object. | |
137 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon | |
138 * completion of <code>SetConfig()</code>. | |
139 * | |
140 * @return An int32_t containing a result code from <code>pp_errors.h</code>. | |
141 * Returns <code>PP_ERROR_INPROGRESS</code> if there is a pending call of | |
142 * <code>SetConfig()</code> or <code>CaptureStillImage()</code>. | |
143 * If an error is returned, all configuration will not be changed. | |
144 */ | |
145 int32_t (*SetConfig)(PP_Resource image_capture, | |
146 PP_Resource config, | |
147 struct PP_CompletionCallback callback); | |
148 /** | |
149 * Gets the configuration of the image capture. | |
150 * | |
151 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an | |
152 * image capture resource. | |
153 * @param[out] config A <code>PP_ImageCaptureConfig_Private</code> for | |
154 storing the | |
155 * current image capture config on success. Otherwise, the values will not be | |
156 * changed. | |
157 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon | |
158 * completion of <code>GetConfig()</code>. | |
159 * | |
160 * @return An int32_t containing a result code from <code>pp_errors.h</code>. | |
161 */ | |
162 int32_t (*GetConfig)(PP_Resource image_capture, | |
163 PP_Resource* config, | |
164 struct PP_CompletionCallback callback); | |
165 /** | |
166 * Gets the image capture capabilities of the camera. | |
167 * | |
168 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an | |
169 * image capture resource. | |
170 * @param[out] capabilities A <code>PPB_CameraCapabilities_Private</code> for | |
171 * storing the image capture capabilities on success. Otherwise, the value | |
172 * will not be changed. | |
173 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon | |
174 * completion of <code>GetCapabilities()</code>. | |
175 * | |
176 * @return An int32_t containing a result code from <code>pp_errors.h</code>. | |
177 */ | |
178 int32_t (*GetCapabilities)(PP_Resource image_capture, | |
179 PP_Resource* capabilities, | |
180 struct PP_CompletionCallback callback); | |
181 /** | |
182 * Captures a still JPEG image from the camera. | |
183 * | |
184 * Triggers an asynchronous image capture. The camera will initiate a series | |
185 * of callbacks to the application as the image capture progresses. The | |
186 * callbacks will be invoked in the order of shutter callback, preview | |
187 * callback,and JPEG callback. The shutter callback occurs after the image is | |
188 * captured. This can be used to trigger a sound to let the user know that | |
189 * image has been captured. The preview callback occurs when a scaled, fully | |
190 * processed preview image is available. The JPEG callback occurs when the | |
191 * compressed image is available. | |
192 * | |
193 * The size of the preview image in preview callback is determined by | |
194 * <code>PPB_ImageCaptureConfig_Private.SetPreviewSize</code>. The format is | |
195 * decided by the camera and can be got from <code>PPB_VideoFrame.GetFormat | |
196 * </code>. | |
197 * | |
198 * The camera may need to stop and re-start the streaming during image | |
199 * capture. If some MediaStreamVideoTrack are associated with the camera | |
200 * source, they will receive mute and unmute events. | |
201 * | |
202 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an | |
203 * image capture resource. | |
204 * @param[in] shutter_callback A <code> | |
205 * PPB_ImageCapture_Private_ShutterCallback</code> callback to indicate the | |
206 * image has been taken. | |
207 * @param[in] preview_callback A <code> | |
208 * PPB_ImageCapture_Private_PreviewCallback</code> callback to return a | |
209 * preview of the captured imgage. | |
Justin Chuang
2014/08/07 04:27:28
typo of image
wuchengli
2014/08/07 15:33:55
Done.
| |
210 * @param[in] jpeg_callback A <code> | |
211 * PPB_ImageCapture_Private_JpegCallback</code> callback to return captured | |
212 * JPEG image. | |
213 * @param[out] sequence_id The sequence ID is a unique monotonically | |
214 * increasing value starting from 0, incremented every time a new request like | |
215 * image capture is submitted. | |
216 * | |
217 * @return An int32_t containing a result code from <code>pp_errors.h</code>. | |
218 * PP_OK means the callbacks will be triggered. Other values mean the | |
219 * callbacks will not be triggered. | |
220 */ | |
221 int32_t (*CaptureStillImage)( | |
222 PP_Resource image_capture, | |
223 PPB_ImageCapture_Private_ShutterCallback shutter_callback, | |
224 PPB_ImageCapture_Private_PreviewCallback preview_callback, | |
225 PPB_ImageCapture_Private_JPEGCallback jpeg_callback, | |
226 int64_t* sequence_id); | |
227 }; | |
228 | |
229 typedef struct PPB_ImageCapture_Private_0_1 PPB_ImageCapture_Private; | |
230 /** | |
231 * @} | |
232 */ | |
233 | |
234 #endif /* PPAPI_C_PRIVATE_PPB_IMAGE_CAPTURE_PRIVATE_H_ */ | |
235 | |
OLD | NEW |