Index: ppapi/api/ppb_image_capture.idl |
diff --git a/ppapi/api/ppb_image_capture.idl b/ppapi/api/ppb_image_capture.idl |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5d2f49a9cbbc05c41b8469a8f978b6809d44719b |
--- /dev/null |
+++ b/ppapi/api/ppb_image_capture.idl |
@@ -0,0 +1,122 @@ |
+/* 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</code> interface. Used for taking |
+ * a picture from the source of a MediaStream video track. |
+ */ |
+ |
+[generate_thunk] |
+ |
+label Chrome { |
+ [channel=dev] M39 = 0.1 |
+}; |
+ |
+[version=0.1] |
+interface PPB_ImageCapture { |
+ /** |
+ * Creates a PPB_ImageCapture resource. |
+ * |
+ * @param[in] media_stream_video_track A <code>PP_Resource</code> identifying |
+ * one MediaStream video track. |
+ * |
Justin Chuang
2014/07/21 17:34:56
What happens if the video track is Close()-ed?
wuchengli
2014/07/29 03:24:49
Now I think video track and image capture should b
Owen Lin
2014/07/29 03:34:43
I think we need stream on to take a photo. It need
|
+ * @return A <code>PP_Resource</code> corresponding to a |
+ * PPB_ImageCapture resource if successful, 0 if failed. |
+ */ |
+ PP_Resource Create([in] PP_Resource media_stream_video_track); |
dmichael (off chromium)
2014/07/16 23:10:54
I'm a little unsure about this. I like that it nea
wuchengli
2014/07/17 14:05:47
I followed the design in Mediastream Image Capture
wuchengli
2014/07/29 03:24:49
I've changed the constructor argument to 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); |
+ |
+ /** |
+ * 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</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>TakePhoto()</code>. |
+ * If an error is returned, all configuration will not be changed. |
+ */ |
+ 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</code> for storing 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>. |
+ * |
+ * @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>PP_ImageCaptureCapabilities</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); |
+ |
+ /** |
+ * Takes a photo from the camera. |
+ * |
Justin Chuang
2014/07/21 17:34:56
Add comments that it may mute()/unmute() the paire
wuchengli
2014/07/29 03:24:50
Done.
|
+ * @param[in] image_capture A <code>PP_Resource</code> corresponding to an |
+ * image capture resource. |
+ * @param[out] postview_frame A <code>PP_Resource</code> corresponding to a |
+ * VideoFrame resource used to store the postview. The client can use this to |
+ * show the captured photo. The format and the size are decided by the |
+ * associated MediaStream video track. |
+ * @param[out] photo A <code>PP_Resource</code> corresponding to a VideoFrame |
+ * resource used to store the encoded picture. The default format is JPEG. |
Justin Chuang
2014/07/21 17:34:56
I suspect that we need to add a new PP_Resource.
wuchengli
2014/07/29 03:24:49
PPB_ImageData applies to only ARGB so we should no
|
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called when |
+ * the picture has been taken and the camera can be moved without making the |
+ * picture blurry. The client can play a shutter sound if needed. |
+ * @param[in] postview_callback A <code>PP_CompletionCallback</code> to be |
+ * called to store a postview video frame in <code>postview_frame</code> |
+ * @param[in] photo_callback A <code>PP_CompletionCallback</code> to be |
+ * called upon completion of TakePhoto(). <code>photo</code> will contain the |
+ * encoded picture. |
Justin Chuang
2014/07/21 17:34:56
A general question: do we want to do something lik
wuchengli
2014/07/29 03:24:49
We may need it in the future. When I was on Androi
|
+ * |
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
+ */ |
+ int32_t TakePhoto([in] PP_Resource image_capture, |
+ [out] PP_Resource postview_frame, |
+ [out] PP_Resource photo, |
+ [in] PP_CompletionCallback shutter_callback, |
+ [in] PP_CompletionCallback postview_callback, |
+ [in] PP_CompletionCallback photo_callback); |
dmichael (off chromium)
2014/07/16 23:10:54
We can't use multiple completion callbacks for 1 f
wuchengli
2014/07/17 14:05:47
You are right. I read the documentation of complet
wuchengli
2014/07/29 03:24:49
I moved the callbacks to PPP_ImageCapture_Private.
|
+}; |