Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: ppapi/c/private/ppb_image_capture_private.h

Issue 884483007: Image Capture PPAPI: remove unused APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 /* From private/ppb_image_capture_private.idl, 6 /* From private/ppb_image_capture_private.idl,
7 * modified Mon Feb 2 21:41:55 2015. 7 * modified Tue Feb 3 22:24:35 2015.
8 */ 8 */
9 9
10 #ifndef PPAPI_C_PRIVATE_PPB_IMAGE_CAPTURE_PRIVATE_H_ 10 #ifndef PPAPI_C_PRIVATE_PPB_IMAGE_CAPTURE_PRIVATE_H_
11 #define PPAPI_C_PRIVATE_PPB_IMAGE_CAPTURE_PRIVATE_H_ 11 #define PPAPI_C_PRIVATE_PPB_IMAGE_CAPTURE_PRIVATE_H_
12 12
13 #include "ppapi/c/pp_bool.h" 13 #include "ppapi/c/pp_bool.h"
14 #include "ppapi/c/pp_completion_callback.h" 14 #include "ppapi/c/pp_completion_callback.h"
15 #include "ppapi/c/pp_instance.h" 15 #include "ppapi/c/pp_instance.h"
16 #include "ppapi/c/pp_macros.h" 16 #include "ppapi/c/pp_macros.h"
17 #include "ppapi/c/pp_resource.h" 17 #include "ppapi/c/pp_resource.h"
18 #include "ppapi/c/pp_stdint.h" 18 #include "ppapi/c/pp_stdint.h"
19 #include "ppapi/c/pp_var.h" 19 #include "ppapi/c/pp_var.h"
20 20
21 #define PPB_IMAGECAPTURE_PRIVATE_INTERFACE_0_1 "PPB_ImageCapture_Private;0.1" 21 #define PPB_IMAGECAPTURE_PRIVATE_INTERFACE_0_1 "PPB_ImageCapture_Private;0.1"
22 #define PPB_IMAGECAPTURE_PRIVATE_INTERFACE \ 22 #define PPB_IMAGECAPTURE_PRIVATE_INTERFACE \
23 PPB_IMAGECAPTURE_PRIVATE_INTERFACE_0_1 23 PPB_IMAGECAPTURE_PRIVATE_INTERFACE_0_1
24 24
25 /** 25 /**
26 * @file 26 * @file
27 * Defines the <code>PPB_ImageCapture_Private</code> interface. Used for 27 * Defines the <code>PPB_ImageCapture_Private</code> interface. Used for
28 * acquiring a single still image from a camera source. 28 * acquiring a single still image from a camera source.
29 */ 29 */
30 30
31 31
32 /** 32 /**
33 * @addtogroup Typedefs
34 * @{
35 */
36 /**
37 * Callback function for <code>PPB_ImageCapture_Private.CaptureStillImage
38 * </code> to indicate the image has been captured from the sensor. This is a
39 * good opportunity to play a shutter sound or give other feedback of camera
40 * operation. This will occur after the image was captured, but before the
41 * actual data is available.
42 *
43 * Parameters:
44 * |user_data| The same pointer that was passed into <code>
45 * PPB_ImageCapture_Private.Create()</code>.
46 * |sequence_id| The sequence ID of the image capture, same as the one from
47 * CaptureStillImage.
48 */
49 typedef void (*PPB_ImageCapture_Private_ShutterCallback)(void* user_data,
50 int64_t sequence_id);
51
52 /**
53 * Callback function for <code>PPB_ImageCapture_Private.CaptureStillImage
54 * </code> to deliver a preview image. The client can use this to show the
55 * captured image. See <code>PPB_ImageCapture_Private.CaptureStillImage
56 * </code> for more information.
57 *
58 * Parameters:
59 * |user_data| The same pointer that was passed into <code>
60 * PPB_ImageCapture_Private.Create()</code>.
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)(void* user_data,
67 int64_t sequence_id,
68 PP_Resource preview);
69
70 /**
71 * Callback function for <code>PPB_ImageCapture_Private.CaptureStillImage
72 * </code> to deliver a still JPEG image. See <code>
73 * PPB_ImageCapture_Private.CaptureStillImage</code> for more information.
74 *
75 * Parameters:
76 * |user_data| The same pointer that was passed into <code>
77 * PPB_ImageCapture_Private.Create()</code>.
78 * |sequence_id| The sequence ID of the image capture, same as the one from
79 * CaptureStillImage.
80 * |jpeg| A <code>PP_Resource</code> corresponding to a VideoFrame
81 * resource used to store the JPEG image.
82 */
83 typedef void (*PPB_ImageCapture_Private_JpegCallback)(void* user_data,
84 int64_t sequence_id,
85 PP_Resource jpeg);
86
87 /**
88 * Callback function for <code>PPB_ImageCapture_Private.CaptureStillImage
89 * </code> to indicate the image capture has failed.
90 *
91 * Parameters:
92 * |user_data| The same pointer that was passed into <code>
93 * PPB_ImageCapture_Private.Create()</code>.
94 * |sequence_id| The sequence ID of the image capture, same as the one from
95 * CaptureStillImage.
96 * |int32_t| An error code from <code>pp_errors.h</code>.
97 */
98 typedef void (*PPB_ImageCapture_Private_ErrorCallback)(void* user_data,
99 int64_t sequence_id,
100 int32_t pp_error);
101 /**
102 * @}
103 */
104
105 /**
106 * @addtogroup Interfaces 33 * @addtogroup Interfaces
107 * @{ 34 * @{
108 */ 35 */
109 /** 36 /**
110 * To capture a still image with this class, use the following steps. 37 * To capture a still image with this class, use the following steps.
111 * 1. Get a PPB_ImageCapture_Private object by Create(). 38 * 1. Get a PPB_ImageCapture_Private object by Create().
112 * 2. Call GetCameraCapabilities to get the supported preview sizes. 39 * 2. Call GetCameraCapabilities to get the supported preview sizes.
113 * 3. For optimal performance, set one of the supported preview size as the 40 * 3. For optimal performance, set one of the supported preview size as the
114 * constraints of getUserMedia. Use the created MediaStreamVideoTrack for 41 * constraints of getUserMedia. Use the created MediaStreamVideoTrack for
115 * camera previews. 42 * camera previews.
116 * 4. Set the same preview size and other settings by SetConfig.
117 * 5. Call CaptureStillImage to capture a still image. Play the shutter sound in
118 * the shutter callback. The image from the preview callback can be used for
119 * display. JPEG image will be returned to the JPEG callback.
120 */ 43 */
121 struct PPB_ImageCapture_Private_0_1 { 44 struct PPB_ImageCapture_Private_0_1 {
122 /** 45 /**
123 * Creates a PPB_ImageCapture_Private resource. 46 * Creates a PPB_ImageCapture_Private resource.
124 * 47 *
125 * @param[in] instance A <code>PP_Instance</code> identifying one instance 48 * @param[in] instance A <code>PP_Instance</code> identifying one instance
126 * of a module. 49 * of a module.
127 * 50 *
128 * @return A <code>PP_Resource</code> corresponding to a 51 * @return A <code>PP_Resource</code> corresponding to a
129 * PPB_ImageCapture_Private resource if successful, 0 if failed. 52 * PPB_ImageCapture_Private resource if successful, 0 if failed.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 * After this returns, no callbacks will be called. If <code> 85 * After this returns, no callbacks will be called. If <code>
163 * PPB_ImageCapture_Private</code> is destroyed and is not closed yet, this 86 * PPB_ImageCapture_Private</code> is destroyed and is not closed yet, this
164 * function will be automatically called. Calling this more than once has no 87 * function will be automatically called. Calling this more than once has no
165 * effect. 88 * effect.
166 * 89 *
167 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an 90 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an
168 * image capture resource. 91 * image capture resource.
169 */ 92 */
170 void (*Close)(PP_Resource image_capture); 93 void (*Close)(PP_Resource image_capture);
171 /** 94 /**
172 * Sets the configuration of the image capture.
173 * If <code>SetConfig()</code> is not called, default settings will be used.
174 *
175 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an
176 * image capture resource.
177 * @param[in] config A <code>PP_ImageCaptureConfig_Private</code> object.
178 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon
179 * completion of <code>SetConfig()</code>.
180 *
181 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
182 * Returns <code>PP_ERROR_INPROGRESS</code> if there is a pending call of
183 * <code>SetConfig()</code> or <code>CaptureStillImage()</code>.
184 * If an error is returned, the configuration will not be changed.
185 */
186 int32_t (*SetConfig)(PP_Resource image_capture,
187 PP_Resource config,
188 struct PP_CompletionCallback callback);
189 /**
190 * Gets the configuration of the image capture.
191 *
192 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an
193 * image capture resource.
194 * @param[out] config A <code>PP_ImageCaptureConfig_Private</code> for storing
195 * the current image capture config on success. Otherwise, the values will not
196 * be changed.
197 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon
198 * completion of <code>GetConfig()</code>.
199 *
200 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
201 */
202 int32_t (*GetConfig)(PP_Resource image_capture,
203 PP_Resource* config,
204 struct PP_CompletionCallback callback);
205 /**
206 * Gets the camera capabilities. 95 * Gets the camera capabilities.
207 * 96 *
208 * The camera capabilities do not change for a given camera source. 97 * The camera capabilities do not change for a given camera source.
209 * 98 *
210 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an 99 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an
211 * image capture resource. 100 * image capture resource.
212 * @param[out] capabilities A <code>PPB_CameraCapabilities_Private</code> for 101 * @param[out] capabilities A <code>PPB_CameraCapabilities_Private</code> for
213 * storing the image capture capabilities on success. Otherwise, the value 102 * storing the image capture capabilities on success. Otherwise, the value
214 * will not be changed. 103 * will not be changed.
215 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon 104 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon
216 * completion of <code>GetCameraCapabilities()</code>. 105 * completion of <code>GetCameraCapabilities()</code>.
217 * 106 *
218 * @return An int32_t containing a result code from <code>pp_errors.h</code>. 107 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
219 */ 108 */
220 int32_t (*GetCameraCapabilities)(PP_Resource image_capture, 109 int32_t (*GetCameraCapabilities)(PP_Resource image_capture,
221 PP_Resource* capabilities, 110 PP_Resource* capabilities,
222 struct PP_CompletionCallback callback); 111 struct PP_CompletionCallback callback);
223 /**
224 * Captures a still JPEG image from the camera.
225 *
226 * Triggers an asynchronous image capture. The camera will initiate a series
227 * of callbacks to the application as the image capture progresses. The
228 * callbacks will be invoked in the order of shutter callback, preview
229 * callback, and JPEG callback. The shutter callback occurs after the image is
230 * captured. This can be used to trigger a sound to let the user know that
231 * image has been captured. The preview callback occurs when a scaled, fully
232 * processed preview image is available. The JPEG callback occurs when the
233 * compressed image is available. If there is an error after the capture is in
234 * progress, the error callback passed to <code>
235 * PPB_ImageCapture_Private.Create()</code> will be invoked. All the callbacks
236 * are invoked by the thread that calls this function.
237 *
238 * The size of the preview image in preview callback is determined by
239 * <code>PPB_ImageCaptureConfig_Private.SetPreviewSize</code>. The format is
240 * decided by the camera and can be got from <code>PPB_VideoFrame.GetFormat
241 * </code>. The size of the JPEG image is determined by <code>
242 * PPB_ImageCaptureConfig_Private.SetJpegSize</code>.
243 *
244 * The camera may need to stop and re-start streaming during image capture. If
245 * some MediaStreamVideoTrack are associated with the camera source, they will
246 * receive mute and unmute events. The mute event will be received before all
247 * the callbacks. The unmute event will be received after all the callbacks.
248 * The preview image will not be sent to the video tracks associated with the
249 * camera.
250 *
251 * @param[in] image_capture A <code>PP_Resource</code> corresponding to an
252 * image capture resource.
253 * @param[in] shutter_callback A <code>
254 * PPB_ImageCapture_Private_ShutterCallback</code> callback to indicate the
255 * image has been taken.
256 * @param[in] preview_callback A <code>
257 * PPB_ImageCapture_Private_PreviewCallback</code> callback to return a
258 * preview of the captured image.
259 * @param[in] jpeg_callback A <code>
260 * PPB_ImageCapture_Private_JpegCallback</code> callback to return captured
261 * JPEG image.
262 * @param[out] sequence_id The sequence ID is a unique monotonically
263 * increasing value starting from 0, incremented every time a new request like
264 * image capture is submitted.
265 *
266 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
267 * PP_OK means the callbacks will be triggered. Other values mean the
268 * callbacks will not be triggered.
269 */
270 int32_t (*CaptureStillImage)(
271 PP_Resource image_capture,
272 PPB_ImageCapture_Private_ShutterCallback shutter_callback,
273 PPB_ImageCapture_Private_PreviewCallback preview_callback,
274 PPB_ImageCapture_Private_JpegCallback jpeg_callback,
275 int64_t* sequence_id);
276 }; 112 };
277 113
278 typedef struct PPB_ImageCapture_Private_0_1 PPB_ImageCapture_Private; 114 typedef struct PPB_ImageCapture_Private_0_1 PPB_ImageCapture_Private;
279 /** 115 /**
280 * @} 116 * @}
281 */ 117 */
282 118
283 #endif /* PPAPI_C_PRIVATE_PPB_IMAGE_CAPTURE_PRIVATE_H_ */ 119 #endif /* PPAPI_C_PRIVATE_PPB_IMAGE_CAPTURE_PRIVATE_H_ */
284 120
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698