Index: ppapi/c/private/ppb_image_capture_private.h |
diff --git a/ppapi/c/private/ppb_image_capture_private.h b/ppapi/c/private/ppb_image_capture_private.h |
index 190c9a65a506d7970d08c3b787c915b193059910..35581e76c614036c921910f4e8a226b766d461f1 100644 |
--- a/ppapi/c/private/ppb_image_capture_private.h |
+++ b/ppapi/c/private/ppb_image_capture_private.h |
@@ -4,7 +4,7 @@ |
*/ |
/* From private/ppb_image_capture_private.idl, |
- * modified Wed Aug 13 17:26:13 2014. |
+ * modified Tue Nov 4 11:28:23 2014. |
*/ |
#ifndef PPAPI_C_PRIVATE_PPB_IMAGE_CAPTURE_PRIVATE_H_ |
@@ -41,13 +41,10 @@ |
* actual data is available. |
* |
* Parameters: |
- * |user_data| The same pointer that was passed into <code> |
- * PPB_ImageCapture_Private.Create()</code>. |
* |sequence_id| The sequence ID of the image capture, same as the one from |
* CaptureStillImage. |
*/ |
-typedef void (*PPB_ImageCapture_Private_ShutterCallback)(void* user_data, |
- int64_t sequence_id); |
+typedef void (*PPB_ImageCapture_Private_ShutterCallback)(uint64_t sequence_id); |
/** |
* Callback function for <code>PPB_ImageCapture_Private.CaptureStillImage |
@@ -56,15 +53,12 @@ typedef void (*PPB_ImageCapture_Private_ShutterCallback)(void* user_data, |
* </code> for more information. |
* |
* Parameters: |
- * |user_data| The same pointer that was passed into <code> |
- * PPB_ImageCapture_Private.Create()</code>. |
* |sequence_id| The sequence ID of the image capture, same as the one from |
* CaptureStillImage. |
* |preview| A <code>PP_Resource</code> corresponding to a VideoFrame |
* resource used to store the preview image. |
*/ |
-typedef void (*PPB_ImageCapture_Private_PreviewCallback)(void* user_data, |
- int64_t sequence_id, |
+typedef void (*PPB_ImageCapture_Private_PreviewCallback)(uint64_t sequence_id, |
PP_Resource preview); |
/** |
@@ -73,15 +67,12 @@ typedef void (*PPB_ImageCapture_Private_PreviewCallback)(void* user_data, |
* PPB_ImageCapture_Private.CaptureStillImage</code> for more information. |
* |
* Parameters: |
- * |user_data| The same pointer that was passed into <code> |
- * PPB_ImageCapture_Private.Create()</code>. |
* |sequence_id| The sequence ID of the image capture, same as the one from |
* CaptureStillImage. |
* |jpeg| A <code>PP_Resource</code> corresponding to a VideoFrame |
* resource used to store the JPEG image. |
*/ |
-typedef void (*PPB_ImageCapture_Private_JpegCallback)(void* user_data, |
- int64_t sequence_id, |
+typedef void (*PPB_ImageCapture_Private_JpegCallback)(uint64_t sequence_id, |
PP_Resource jpeg); |
/** |
@@ -89,14 +80,11 @@ typedef void (*PPB_ImageCapture_Private_JpegCallback)(void* user_data, |
* </code> to indicate the image capture has failed. |
* |
* Parameters: |
- * |user_data| The same pointer that was passed into <code> |
- * PPB_ImageCapture_Private.Create()</code>. |
* |sequence_id| The sequence ID of the image capture, same as the one from |
* CaptureStillImage. |
* |int32_t| An error code from <code>pp_errors.h</code>. |
*/ |
-typedef void (*PPB_ImageCapture_Private_ErrorCallback)(void* user_data, |
- int64_t sequence_id, |
+typedef void (*PPB_ImageCapture_Private_ErrorCallback)(uint64_t sequence_id, |
int32_t pp_error); |
/** |
* @} |
@@ -109,14 +97,15 @@ typedef void (*PPB_ImageCapture_Private_ErrorCallback)(void* user_data, |
/** |
* To capture a still image with this class, use the following steps. |
* 1. Get a PPB_ImageCapture_Private object by Create(). |
- * 2. Call GetCameraCapabilities to get the supported preview sizes. |
- * 3. For optimal performance, set one of the supported preview size as the |
+ * 2. Open() the device with camera source ID. |
+ * 3. Call GetCameraCapabilities() to get the supported preview sizes. |
+ * 4. For optimal performance, set one of the supported preview size as the |
* constraints of getUserMedia. Use the created MediaStreamVideoTrack for |
* camera previews. |
- * 4. Set the same preview size and other settings by SetConfig. |
- * 5. Call CaptureStillImage to capture a still image. Play the shutter sound in |
- * the shutter callback. The image from the preview callback can be used for |
- * display. JPEG image will be returned to the JPEG callback. |
+ * 5. Set the same preview size and other settings by SetConfig(). |
+ * 6. Call CaptureStillImage() to capture a still image. Play the shutter sound |
+ * in the shutter callback. The image from the preview callback can be used |
+ * for displaying preview. JPEG image will be returned by the JPEG callback. |
*/ |
struct PPB_ImageCapture_Private_0_1 { |
/** |
@@ -124,23 +113,11 @@ struct PPB_ImageCapture_Private_0_1 { |
* |
* @param[in] instance A <code>PP_Instance</code> identifying one instance |
* of a module. |
- * @param[in] camera_source_id A <code>PP_Var</code> identifying a camera |
- * source. The type is string. The ID can be obtained from |
- * MediaStreamTrack.getSources() or MediaStreamVideoTrack.id. If a |
- * MediaStreamVideoTrack is associated with the same source and the track |
- * is closed, this PPB_ImageCapture_Private object can still do image capture. |
- * @param[in] error_callback A <code>PPB_ImageCapture_Private_ErrorCallback |
- * </code> callback to indicate the image capture has failed. |
- * @param[inout] user_data An opaque pointer that will be passed to the |
- * callbacks of PPB_ImageCapture_Private. |
* |
* @return A <code>PP_Resource</code> corresponding to a |
* PPB_ImageCapture_Private resource if successful, 0 if failed. |
*/ |
- PP_Resource (*Create)(PP_Instance instance, |
- struct PP_Var camera_source_id, |
- PPB_ImageCapture_Private_ErrorCallback error_callback, |
- void* user_data); |
+ PP_Resource (*Create)(PP_Instance instance); |
/** |
* Determines if a resource is an image capture resource. |
* |
@@ -152,6 +129,24 @@ struct PPB_ImageCapture_Private_0_1 { |
*/ |
PP_Bool (*IsImageCapture)(PP_Resource resource); |
/** |
+ * Opens a video capture device. |
+ * |
+ * @param[in] image_capture A <code>PP_Resource</code> corresponding to an |
+ * image capture resource. |
+ * @param[in] device_id A <code>PP_Var</code> identifying a camera device. The |
+ * type is string. The ID can be obtained from MediaStreamTrack.getSources() |
+ * or MediaStreamVideoTrack.id. If a MediaStreamVideoTrack is associated with |
+ * the same source and the track is closed, this PPB_ImageCapture_Private |
+ * object can still do image capture. |
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
+ * completion of <code>Open()</code>. |
+ * |
+ * @return An error code from <code>pp_errors.h</code>. |
+ */ |
+ int32_t (*Open)(PP_Resource image_capture, |
+ struct PP_Var device_id, |
+ struct PP_CompletionCallback callback); |
+ /** |
* Disconnects from the camera and cancels all pending capture requests. |
* After this returns, no callbacks will be called. If <code> |
* PPB_ImageCapture_Private</code> is destroyed and is not closed yet, this |
@@ -160,12 +155,8 @@ struct PPB_ImageCapture_Private_0_1 { |
* |
* @param[in] image_capture A <code>PP_Resource</code> corresponding to an |
* image capture resource. |
- * @param[in] callback <code>PP_CompletionCallback</code> to be called upon |
- * completion of <code>Close()</code>. |
- * |
- * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
*/ |
- int32_t (*Close)(PP_Resource resource, struct PP_CompletionCallback callback); |
+ void (*Close)(PP_Resource image_capture); |
/** |
* Sets the configuration of the image capture. |
* If <code>SetConfig()</code> is not called, default settings will be used. |
@@ -174,7 +165,8 @@ struct PPB_ImageCapture_Private_0_1 { |
* image capture resource. |
* @param[in] config A <code>PP_ImageCaptureConfig_Private</code> object. |
* @param[in] callback <code>PP_CompletionCallback</code> to be called upon |
- * completion of <code>SetConfig()</code>. |
+ * completion of <code>SetConfig()</code>. This callback will only run if the |
+ * return code is <code>PP_OK_COMPLETIONPENDING</code>. |
* |
* @return An int32_t containing a result code from <code>pp_errors.h</code>. |
* Returns <code>PP_ERROR_INPROGRESS</code> if there is a pending call of |
@@ -193,7 +185,8 @@ struct PPB_ImageCapture_Private_0_1 { |
* the current image capture config on success. Otherwise, the values will not |
* be changed. |
* @param[in] callback <code>PP_CompletionCallback</code> to be called upon |
- * completion of <code>GetConfig()</code>. |
+ * completion of <code>GetConfig()</code>. This callback will only run if the |
+ * return code is <code>PP_OK_COMPLETIONPENDING</code>. |
* |
* @return An int32_t containing a result code from <code>pp_errors.h</code>. |
*/ |
@@ -211,7 +204,8 @@ struct PPB_ImageCapture_Private_0_1 { |
* storing the image capture capabilities on success. Otherwise, the value |
* will not be changed. |
* @param[in] callback <code>PP_CompletionCallback</code> to be called upon |
- * completion of <code>GetCameraCapabilities()</code>. |
+ * completion of <code>GetCameraCapabilities()</code>. This callback will only |
+ * run if the return code is <code>PP_OK_COMPLETIONPENDING</code>. |
* |
* @return An int32_t containing a result code from <code>pp_errors.h</code>. |
*/ |
@@ -219,6 +213,14 @@ struct PPB_ImageCapture_Private_0_1 { |
PP_Resource* capabilities, |
struct PP_CompletionCallback callback); |
/** |
+ * Allows the browser to reuse preview buffer and JPEG buffer that was |
+ * previously sent by |preview_calback| and |jpeg_callback| registered in |
+ * <code>PPB_ImageCapture_Private.CaptureStillImage()</code>. |
+ * |
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
+ */ |
+ int32_t (*ReuseBuffers)(PP_Resource image_capture); |
+ /** |
* Captures a still JPEG image from the camera. |
* |
* Triggers an asynchronous image capture. The camera will initiate a series |
@@ -229,9 +231,8 @@ struct PPB_ImageCapture_Private_0_1 { |
* image has been captured. The preview callback occurs when a scaled, fully |
* processed preview image is available. The JPEG callback occurs when the |
* compressed image is available. If there is an error after the capture is in |
- * progress, the error callback passed to <code> |
- * PPB_ImageCapture_Private.Create()</code> will be invoked. All the callbacks |
- * are invoked by the thread that calls this function. |
+ * progress, the error callback will be invoked. All the callbacks are invoked |
+ * by the thread that calls this function. |
* |
* The size of the preview image in preview callback is determined by |
* <code>PPB_ImageCaptureConfig_Private.SetPreviewSize</code>. The format is |
@@ -257,6 +258,8 @@ struct PPB_ImageCapture_Private_0_1 { |
* @param[in] jpeg_callback A <code> |
* PPB_ImageCapture_Private_JpegCallback</code> callback to return captured |
* JPEG image. |
+ * @param[in] error_callback A <code>PPB_ImageCapture_Private_ErrorCallback |
+ * </code> callback to indicate <code>CaptureStillImage()</code> has failed. |
* @param[out] sequence_id The sequence ID is a unique monotonically |
* increasing value starting from 0, incremented every time a new request like |
* image capture is submitted. |
@@ -270,7 +273,8 @@ struct PPB_ImageCapture_Private_0_1 { |
PPB_ImageCapture_Private_ShutterCallback shutter_callback, |
PPB_ImageCapture_Private_PreviewCallback preview_callback, |
PPB_ImageCapture_Private_JpegCallback jpeg_callback, |
- int64_t* sequence_id); |
+ PPB_ImageCapture_Private_ErrorCallback error_callback, |
+ uint64_t* sequence_id); |
}; |
typedef struct PPB_ImageCapture_Private_0_1 PPB_ImageCapture_Private; |