| Index: ppapi/cpp/private/image_capture_private.h
|
| diff --git a/ppapi/cpp/private/image_capture_private.h b/ppapi/cpp/private/image_capture_private.h
|
| index ab4afbbdcd900466d07e2470d221700ffa0dc474..de892f4026761d2d45e04d0fcdfcb2605541c6b9 100644
|
| --- a/ppapi/cpp/private/image_capture_private.h
|
| +++ b/ppapi/cpp/private/image_capture_private.h
|
| @@ -7,9 +7,6 @@
|
| #define PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_
|
|
|
| #include "ppapi/c/private/ppb_image_capture_private.h"
|
| -#include "ppapi/cpp/completion_callback.h"
|
| -#include "ppapi/cpp/private/camera_capabilities_private.h"
|
| -#include "ppapi/cpp/private/image_capture_config_private.h"
|
| #include "ppapi/cpp/resource.h"
|
| #include "ppapi/cpp/var.h"
|
|
|
| @@ -18,6 +15,14 @@
|
| /// acquiring a single still image from a camera source.
|
| namespace pp {
|
|
|
| +class CameraCapabilities_Private;
|
| +class CompletionCallback;
|
| +class ImageCaptureConfig_Private;
|
| +class InstanceHandle;
|
| +
|
| +template <typename T>
|
| +class CompletionCallbackWithOutput;
|
| +
|
| /// To capture a still image with this class, use the following steps.
|
| /// 1. Create an ImageCapture_Private object by the constructor.
|
| /// 2. Call GetCameraCapabilities to get the supported preview sizes.
|
| @@ -28,58 +33,57 @@ namespace pp {
|
| /// 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.
|
| -class ImageCapture_Private {
|
| +class ImageCapture_Private : public Resource {
|
| public:
|
| /// Default constructor for creating an is_null()
|
| /// <code>ImageCapture_Private</code> object.
|
| ImageCapture_Private();
|
|
|
| - /// Creates an ImageCapture_Private resource.
|
| + /// The copy constructor for <code>ImageCapture_Private</code>.
|
| + ///
|
| + /// @param[in] other A reference to a <code>ImageCapture_Private</code>.
|
| + ImageCapture_Private(const ImageCapture_Private& other);
|
| +
|
| + /// Constructs an <code>ImageCapture_Private</code> from
|
| + /// a <code>Resource</code>.
|
| + ///
|
| + /// @param[in] resource A <code>PPB_ImageCapture_Private</code> resource.
|
| + explicit ImageCapture_Private(const Resource& resource);
|
| +
|
| + /// Constructs an ImageCapture_Private resource.
|
| ///
|
| /// @param[in] instance A <code>PP_Instance</code> identifying one instance
|
| /// of a module.
|
| - /// @param[in] camera_source_id A <code>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 ImageCapture_Private object can still do image capture.
|
| - /// @param[in] error_callback A <code>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 ImageCapture_Private.
|
| - ImageCapture_Private(const InstanceHandle& instance,
|
| - const Var& camera_source_id,
|
| - PPB_ImageCapture_Private_ErrorCallback error_callback,
|
| - void* user_data);
|
| -
|
| - /// Constructs a <code>ImageCapture_Private</code> from a <code>
|
| - /// Resource</code>.
|
| - ///
|
| - /// @param[in] resource A <code>ImageCapture_Private</code>
|
| - /// resource.
|
| - explicit ImageCapture_Private(const Resource& resource);
|
| + ImageCapture_Private(const InstanceHandle& instance);
|
|
|
| /// A constructor used when you have received a <code>PP_Resource</code> as a
|
| /// return value that has had 1 ref added for you.
|
| ///
|
| - /// @param[in] resource A <code>ImageCapture_Private</code>
|
| - /// resource.
|
| + /// @param[in] resource A <code>PPB_ImageCapture_Private</code> resource.
|
| ImageCapture_Private(PassRef, PP_Resource resource);
|
|
|
| // Destructor.
|
| ~ImageCapture_Private();
|
|
|
| + /// Opens a video capture device.
|
| + ///
|
| + /// @param[in] camera_source_id A <code>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 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 int32_t containing a result code from <code>pp_errors.h</code>.
|
| + int32_t Open(const Var& camera_source_id, const CompletionCallback& callback);
|
| +
|
| /// Disconnects from the camera and cancels all pending capture requests.
|
| /// After this returns, no callbacks will be called. If <code>
|
| /// 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] callback <code>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(const CompletionCallback& callback);
|
| + void Close();
|
|
|
| /// Sets the configuration of the image capture.
|
| /// If <code>SetConfig()</code> is not called, default settings will be used.
|
| @@ -115,6 +119,13 @@ class ImageCapture_Private {
|
| int32_t GetCameraCapabilities(
|
| const CompletionCallbackWithOutput<CameraCapabilities_Private>& 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();
|
| +
|
| /// Captures a still JPEG image from the camera.
|
| ///
|
| /// Triggers an asynchronous image capture. The camera will initiate a series
|
| @@ -151,6 +162,8 @@ class ImageCapture_Private {
|
| /// @param[in] jpeg_callback A <code>
|
| /// 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.
|
| @@ -162,7 +175,8 @@ class ImageCapture_Private {
|
| 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);
|
|
|
| /// Determines if a resource is an image capture resource.
|
| ///
|
| @@ -176,4 +190,3 @@ class ImageCapture_Private {
|
| } // namespace pp
|
|
|
| #endif /* PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_ */
|
| -
|
|
|