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