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

Unified Diff: ppapi/api/private/ppb_image_capture_private.idl

Issue 391323002: Pepper: add Image Capture interfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/api/private/ppb_image_capture_private.idl
diff --git a/ppapi/api/private/ppb_image_capture_private.idl b/ppapi/api/private/ppb_image_capture_private.idl
new file mode 100644
index 0000000000000000000000000000000000000000..2f0fc98404e020c15efaeb4cf15e63da22f83c37
--- /dev/null
+++ b/ppapi/api/private/ppb_image_capture_private.idl
@@ -0,0 +1,208 @@
+/* Copyright 2014 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * 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.
+ * an image from a camera source.
+ */
+
+[generate_thunk]
+
+label Chrome {
+ M39 = 0.1
+};
+
+/**
+ * Callback function for <code>PPB_ImageCapture_Private.CaptureStillImage
+ * </code>. Called as near as possible to the moment when an image is
+ * captured from the sensor. This is a good opportunity to play a shutter
+ * sound or give other feedback of camera operation. This will occur after
+ * the image was captured, but before the actual data is available.
+ *
+ * Parameters:
+ * |image_capture| the PPB_ImageCapture_Private resource.
+ * |sequence_id| The sequence ID of the image capture, same as the one from
+ * CaptureStillImage.
+ */
+typedef void PPB_ImageCapture_Private_ShutterCallback(
+ [in] PP_Resource image_capture,
+ [in] int64_t sequence_id);
+
+/**
+ * Callback function for <code>PPB_ImageCapture_Private.CaptureStillImage
+ * </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.
+ * can use this to show the captured image. The format and the size are
+ * decided by the associated MediaStream video tracks. Call
+ * <code>PPB_VideoFrame</code> functions to know the exact format and size.
+ *
Pawel Osciak 2014/08/07 06:22:46 s/know/get/
wuchengli 2014/08/07 15:33:55 Removed this.
+ * Parameters:
+ * |image_capture| the PPB_ImageCapture_Private resource.
+ * |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(
+ [in] PP_Resource image_capture,
+ [in] int64_t sequence_id,
+ [in] PP_Resource preview);
+
+/**
+ * Callback function for <code>PPB_ImageCapture_Private.CaptureStillImage
+ * </code>. Called for the camera to deliver a still JPEG image.
+ *
+ * Parameters:
+ * |image_capture| the PPB_ImageCapture_Private resource.
+ * |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(
+ [in] PP_Resource image_capture,
+ [in] int64_t sequence_id,
+ [in] PP_Resource jpeg);
+
+interface PPB_ImageCapture_Private {
+ /**
+ * Creates a PPB_ImageCapture_Private resource.
+ *
+ * @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.
+ *
+ * @return A <code>PP_Resource</code> corresponding to a
+ * PPB_ImageCapture_Private resource if successful, 0 if failed.
+ */
+ PP_Resource Create([in] PP_Instance instance,
+ [in] PP_Var camera_source_id);
+
+ /**
+ * Determines if a resource is an image capture resource.
+ *
+ * @param[in] resource The <code>PP_Resource</code> to test.
+ *
+ * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
+ * resource is an image capture resource or <code>PP_FALSE</code>
+ * otherwise.
+ */
+ PP_Bool IsImageCapture([in] PP_Resource resource);
+
+ /**
+ * 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
+ * function will be automatically called. Calling this more than once has no
+ * effect.
+ *
+ * @param[in] image_capture A <code>PP_Resource</code> corresponding to an
+ * image capture resource.
+ */
+ void Close([in] PP_Resource resource);
+
+ /**
+ * Sets the configuration of the image capture.
+ * If <code>SetConfig()</code> is not called, default settings will be used.
+ *
+ * @param[in] image_capture A <code>PP_Resource</code> corresponding to an
+ * 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>.
+ *
+ * @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
+ * <code>SetConfig()</code> or <code>CaptureStillImage()</code>.
+ * 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.
+ */
+ int32_t SetConfig([in] PP_Resource image_capture,
+ [in] PP_Resource config,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Gets the configuration of the image capture.
+ *
+ * @param[in] image_capture A <code>PP_Resource</code> corresponding to an
+ * image capture resource.
+ * @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.
+ * 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>.
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ */
+ int32_t GetConfig([in] PP_Resource image_capture,
+ [out] PP_Resource config,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Gets the image capture capabilities of the camera.
+ *
+ * @param[in] image_capture A <code>PP_Resource</code> corresponding to an
+ * image capture resource.
+ * @param[out] capabilities A <code>PPB_CameraCapabilities_Private</code> for
+ * 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>GetCapabilities()</code>.
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ */
+ int32_t GetCapabilities([in] PP_Resource image_capture,
+ [out] PP_Resource capabilities,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Captures a still JPEG image from the camera.
+ *
+ * Triggers an asynchronous image capture. The camera will initiate a series
+ * of callbacks to the application as the image capture progresses. The
+ * callbacks will be invoked in the order of shutter callback, preview
+ * 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.
+ * captured. This can be used to trigger a sound to let the user know that
+ * 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.
+ *
+ * The size of the preview image in preview callback is determined by
+ * <code>PPB_ImageCaptureConfig_Private.SetPreviewSize</code>. The format is
+ * decided by the camera and can be got from <code>PPB_VideoFrame.GetFormat
+ * </code>.
+ *
+ * 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.
+ * capture. If some MediaStreamVideoTrack are associated with the camera
+ * source, they will receive mute and unmute events.
+ *
+ * @param[in] image_capture A <code>PP_Resource</code> corresponding to an
+ * image capture resource.
+ * @param[in] shutter_callback A <code>
+ * PPB_ImageCapture_Private_ShutterCallback</code> callback to indicate the
+ * image has been taken.
+ * @param[in] preview_callback A <code>
+ * PPB_ImageCapture_Private_PreviewCallback</code> callback to return a
+ * preview of the captured imgage.
+ * @param[in] jpeg_callback A <code>
+ * PPB_ImageCapture_Private_JpegCallback</code> callback to return captured
+ * JPEG image.
+ * @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.
+ *
+ * @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
+ * PP_OK means the callbacks will be triggered. Other values mean the
+ * callbacks will not be triggered.
+ */
+ int32_t CaptureStillImage(
+ [in] PP_Resource image_capture,
+ [in] PPB_ImageCapture_Private_ShutterCallback shutter_callback,
+ [in] PPB_ImageCapture_Private_PreviewCallback preview_callback,
+ [in] PPB_ImageCapture_Private_JPEGCallback jpeg_callback,
+ [out] int64_t sequence_id);
+};

Powered by Google App Engine
This is Rietveld 408576698