Pepper: add Image Capture interfaces.

API proposal:
https://docs.google.com/a/chromium.org/document/d/1deeCrsvT9xA77UP4yWMhqbHgS3FvYCTF_8meIMQRrDo/edit#

BUG=387547
TEST=Build chrome, run PPAPITest, and run an app that uses ppapi.

Review URL: https://codereview.chromium.org/391323002

Cr-Commit-Position: refs/heads/master@{#290186}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290186 0039d316-1c4b-4281-b951-d872f2087c98
parent 5a74271d
/* 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.
*/
/**
* This file defines the PPB_CameraCapabilities_Private interface for
* establishing an image capture configuration resource within the browser.
*/
[generate_thunk]
label Chrome {
M39 = 0.1
};
/**
* The <code>PPB_CameraCapabilities_Private</code> interface contains pointers
* to several functions for getting the image capture capabilities within the
* browser.
*/
[version=0.1]
interface PPB_CameraCapabilities_Private {
/**
* Creates a PPB_CameraCapabilities_Private resource.
*
* @param[in] instance A <code>PP_Instance</code> identifying one instance of
* a module.
*
* @return A <code>PP_Resource</code> corresponding to a
* PPB_CameraCapabilities_Private resource if successful, 0 if failed.
*/
PP_Resource Create([in] PP_Instance instance);
/**
* IsCameraCapabilities() determines if the given resource is a
* <code>PPB_CameraCapabilities_Private</code>.
*
* @param[in] resource A <code>PP_Resource</code> corresponding to an image
* capture capabilities resource.
*
* @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given
* resource is an <code>PP_CameraCapabilities_Private</code> resource,
* otherwise <code>PP_FALSE</code>.
*/
PP_Bool IsCameraCapabilities(
[in] PP_Resource resource);
/**
* GetSupportedPreviewSizes() returns the supported preview sizes for the
* given <code>PPB_CameraCapabilities_Private</code>.
*
* @param[in] capabilities A <code>PP_Resource</code> corresponding to an
* image capture capabilities resource.
* @param[out] array_size The size of preview size array.
* @param[out] An array of <code>PP_Size</code> corresponding to the
* supported preview sizes in pixels. The ownership of the array belongs to
* <code>PPB_CameraCapabilities_Private</code> and the caller should not
* free it. When a PPB_CameraCapabilities_Private is deleted, the array
* returning from this is no longer valid.
*/
void GetSupportedPreviewSizes(
[in] PP_Resource capabilities,
[out] int32_t array_size,
[out, size_is(array_size)] PP_Size[] preview_sizes);
/**
* GetSupportedJpegSize() returns the supported JPEG sizes for the given
* <code>PPB_CameraCapabilities_Private</code>.
*
* @param[in] capabilities A <code>PP_Resource</code> corresponding to an
* image capture capabilities resource.
* @param[out] array_size The size of JPEG size array. If the output of this
* is 0, the camera has no support for generating JPEG images.
* @param[out] An array of <code>PP_Size</code> corresponding to the
* supported JPEG image sizes in pixels. The ownership of the array belongs
* to <code>PPB_CameraCapabilities_Private</code> and the caller should not
* free it. When a PPB_CameraCapabilities_Private is deleted, the array
* returning from this is no longer valid.
*/
void GetSupportedJpegSizes(
[in] PP_Resource capabilities,
[out] int32_t array_size,
[out, size_is(array_size)] PP_Size[] jpeg_sizes);
};
/* 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.
*/
/**
* This file defines the PPB_ImageCaptureConfig_Private interface for
* establishing an image capture configuration resource within the browser.
*/
[generate_thunk]
label Chrome {
M39 = 0.1
};
/**
* The <code>PPB_ImageCaptureConfig_Private</code> interface contains pointers
* to several functions for establishing image capture configuration within the
* browser. The new configuration will take effect after <code>
* PPB_ImageCapture_Private.SetConfig</code> is called.
*/
[version=0.1]
interface PPB_ImageCaptureConfig_Private {
/**
* Creates a PPB_ImageCaptureConfig_Private resource.
*
* @param[in] instance A <code>PP_Instance</code> identifying one instance of
* a module.
*
* @return A <code>PP_Resource</code> corresponding to a
* PPB_ImageCaptureConfig_Private resource if successful, 0 if failed.
*/
PP_Resource Create([in] PP_Instance instance);
/**
* IsImageCaptureConfig() determines if the given resource is a
* <code>PPB_ImageCaptureConfig_Private</code>.
*
* @param[in] resource A <code>PP_Resource</code> corresponding to an image
* capture config resource.
*
* @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given
* resource is an <code>ImageCaptureConfig_Private</code> resource, otherwise
* <code>PP_FALSE</code>.
*/
PP_Bool IsImageCaptureConfig(
[in] PP_Resource resource);
/**
* GetPreviewSize() returns the preview image size in pixels for the given
* <code>PPB_ImageCaptureConfig_Private</code>.
*
* @param[in] config A <code>PP_Resource</code> corresponding to an image
* capture config resource.
* @param[out] preview_size A <code>PP_Size</code> that indicates the
* requested preview image size.
*/
void GetPreviewSize(
[in] PP_Resource config,
[out] PP_Size preview_size);
/**
* SetPreviewSize() sets the preview image size for the given <code>
* PPB_ImageCaptureConfig_Private</code>.
*
* @param[in] config A <code>PP_Resource</code> corresponding to a
* <code>PPB_ImageCaptureConfig_Private</code>.
* @param[in] preview_size A <code>PP_Size</code> that indicates the requested
* preview image size.
*/
void SetPreviewSize(
[in] PP_Resource config,
[in] PP_Size preview_size);
/**
* GetJpegSize() returns the JPEG image size in pixels for the given
* <code>PPB_ImageCaptureConfig_Private</code>.
*
* @param[in] config A <code>PP_Resource</code> corresponding to an image
* capture config resource.
* @param[out] jpeg_size A <code>PP_Size</code> that indicates the current
* JPEG image size.
*/
void GetJpegSize(
[in] PP_Resource config,
[out] PP_Size jpeg_size);
/**
* SetJpegSize() sets the JPEG image size for the given
* <code>PPB_ImageCaptureConfig_Private</code>.
*
* @param[in] config A <code>PP_Resource</code> corresponding to a
* <code>PPB_ImageCaptureConfig_Private</code>.
* @param[in] jpeg_size A <code>PP_Size</code> that indicates the requested
* JPEG image size.
*/
void SetJpegSize(
[in] PP_Resource config,
[in] PP_Size jpeg_size);
};
This diff is collapsed.
/* 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.
*/
/* From private/ppb_camera_capabilities_private.idl,
* modified Thu Aug 14 11:40:27 2014.
*/
#ifndef PPAPI_C_PRIVATE_PPB_CAMERA_CAPABILITIES_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_CAMERA_CAPABILITIES_PRIVATE_H_
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_size.h"
#include "ppapi/c/pp_stdint.h"
#define PPB_CAMERACAPABILITIES_PRIVATE_INTERFACE_0_1 \
"PPB_CameraCapabilities_Private;0.1"
#define PPB_CAMERACAPABILITIES_PRIVATE_INTERFACE \
PPB_CAMERACAPABILITIES_PRIVATE_INTERFACE_0_1
/**
* @file
* This file defines the PPB_CameraCapabilities_Private interface for
* establishing an image capture configuration resource within the browser.
*/
/**
* @addtogroup Interfaces
* @{
*/
/**
* The <code>PPB_CameraCapabilities_Private</code> interface contains pointers
* to several functions for getting the image capture capabilities within the
* browser.
*/
struct PPB_CameraCapabilities_Private_0_1 {
/**
* Creates a PPB_CameraCapabilities_Private resource.
*
* @param[in] instance A <code>PP_Instance</code> identifying one instance of
* a module.
*
* @return A <code>PP_Resource</code> corresponding to a
* PPB_CameraCapabilities_Private resource if successful, 0 if failed.
*/
PP_Resource (*Create)(PP_Instance instance);
/**
* IsCameraCapabilities() determines if the given resource is a
* <code>PPB_CameraCapabilities_Private</code>.
*
* @param[in] resource A <code>PP_Resource</code> corresponding to an image
* capture capabilities resource.
*
* @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given
* resource is an <code>PP_CameraCapabilities_Private</code> resource,
* otherwise <code>PP_FALSE</code>.
*/
PP_Bool (*IsCameraCapabilities)(PP_Resource resource);
/**
* GetSupportedPreviewSizes() returns the supported preview sizes for the
* given <code>PPB_CameraCapabilities_Private</code>.
*
* @param[in] capabilities A <code>PP_Resource</code> corresponding to an
* image capture capabilities resource.
* @param[out] array_size The size of preview size array.
* @param[out] An array of <code>PP_Size</code> corresponding to the
* supported preview sizes in pixels. The ownership of the array belongs to
* <code>PPB_CameraCapabilities_Private</code> and the caller should not
* free it. When a PPB_CameraCapabilities_Private is deleted, the array
* returning from this is no longer valid.
*/
void (*GetSupportedPreviewSizes)(PP_Resource capabilities,
int32_t* array_size,
struct PP_Size* preview_sizes[]);
/**
* GetSupportedJpegSize() returns the supported JPEG sizes for the given
* <code>PPB_CameraCapabilities_Private</code>.
*
* @param[in] capabilities A <code>PP_Resource</code> corresponding to an
* image capture capabilities resource.
* @param[out] array_size The size of JPEG size array. If the output of this
* is 0, the camera has no support for generating JPEG images.
* @param[out] An array of <code>PP_Size</code> corresponding to the
* supported JPEG image sizes in pixels. The ownership of the array belongs
* to <code>PPB_CameraCapabilities_Private</code> and the caller should not
* free it. When a PPB_CameraCapabilities_Private is deleted, the array
* returning from this is no longer valid.
*/
void (*GetSupportedJpegSizes)(PP_Resource capabilities,
int32_t* array_size,
struct PP_Size* jpeg_sizes[]);
};
typedef struct PPB_CameraCapabilities_Private_0_1
PPB_CameraCapabilities_Private;
/**
* @}
*/
#endif /* PPAPI_C_PRIVATE_PPB_CAMERA_CAPABILITIES_PRIVATE_H_ */
/* 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.
*/
/* From private/ppb_image_capture_config_private.idl,
* modified Wed Aug 13 17:43:55 2014.
*/
#ifndef PPAPI_C_PRIVATE_PPB_IMAGE_CAPTURE_CONFIG_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_IMAGE_CAPTURE_CONFIG_PRIVATE_H_
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_size.h"
#include "ppapi/c/pp_stdint.h"
#define PPB_IMAGECAPTURECONFIG_PRIVATE_INTERFACE_0_1 \
"PPB_ImageCaptureConfig_Private;0.1"
#define PPB_IMAGECAPTURECONFIG_PRIVATE_INTERFACE \
PPB_IMAGECAPTURECONFIG_PRIVATE_INTERFACE_0_1
/**
* @file
* This file defines the PPB_ImageCaptureConfig_Private interface for
* establishing an image capture configuration resource within the browser.
*/
/**
* @addtogroup Interfaces
* @{
*/
/**
* The <code>PPB_ImageCaptureConfig_Private</code> interface contains pointers
* to several functions for establishing image capture configuration within the
* browser. The new configuration will take effect after <code>
* PPB_ImageCapture_Private.SetConfig</code> is called.
*/
struct PPB_ImageCaptureConfig_Private_0_1 {
/**
* Creates a PPB_ImageCaptureConfig_Private resource.
*
* @param[in] instance A <code>PP_Instance</code> identifying one instance of
* a module.
*
* @return A <code>PP_Resource</code> corresponding to a
* PPB_ImageCaptureConfig_Private resource if successful, 0 if failed.
*/
PP_Resource (*Create)(PP_Instance instance);
/**
* IsImageCaptureConfig() determines if the given resource is a
* <code>PPB_ImageCaptureConfig_Private</code>.
*
* @param[in] resource A <code>PP_Resource</code> corresponding to an image
* capture config resource.
*
* @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given
* resource is an <code>ImageCaptureConfig_Private</code> resource, otherwise
* <code>PP_FALSE</code>.
*/
PP_Bool (*IsImageCaptureConfig)(PP_Resource resource);
/**
* GetPreviewSize() returns the preview image size in pixels for the given
* <code>PPB_ImageCaptureConfig_Private</code>.
*
* @param[in] config A <code>PP_Resource</code> corresponding to an image
* capture config resource.
* @param[out] preview_size A <code>PP_Size</code> that indicates the
* requested preview image size.
*/
void (*GetPreviewSize)(PP_Resource config, struct PP_Size* preview_size);
/**
* SetPreviewSize() sets the preview image size for the given <code>
* PPB_ImageCaptureConfig_Private</code>.
*
* @param[in] config A <code>PP_Resource</code> corresponding to a
* <code>PPB_ImageCaptureConfig_Private</code>.
* @param[in] preview_size A <code>PP_Size</code> that indicates the requested
* preview image size.
*/
void (*SetPreviewSize)(PP_Resource config,
const struct PP_Size* preview_size);
/**
* GetJpegSize() returns the JPEG image size in pixels for the given
* <code>PPB_ImageCaptureConfig_Private</code>.
*
* @param[in] config A <code>PP_Resource</code> corresponding to an image
* capture config resource.
* @param[out] jpeg_size A <code>PP_Size</code> that indicates the current
* JPEG image size.
*/
void (*GetJpegSize)(PP_Resource config, struct PP_Size* jpeg_size);
/**
* SetJpegSize() sets the JPEG image size for the given
* <code>PPB_ImageCaptureConfig_Private</code>.
*
* @param[in] config A <code>PP_Resource</code> corresponding to a
* <code>PPB_ImageCaptureConfig_Private</code>.
* @param[in] jpeg_size A <code>PP_Size</code> that indicates the requested
* JPEG image size.
*/
void (*SetJpegSize)(PP_Resource config, const struct PP_Size* jpeg_size);
};
typedef struct PPB_ImageCaptureConfig_Private_0_1
PPB_ImageCaptureConfig_Private;
/**
* @}
*/
#endif /* PPAPI_C_PRIVATE_PPB_IMAGE_CAPTURE_CONFIG_PRIVATE_H_ */
This diff is collapsed.
/* 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.
*/
#ifndef PPAPI_CPP_PRIVATE_CAMERA_CAPABILITIES_PRIVATE_H_
#define PPAPI_CPP_PRIVATE_CAMERA_CAPABILITIES_PRIVATE_H_
#include "ppapi/c/private/ppb_camera_capabilities_private.h"
#include "ppapi/cpp/resource.h"
#include "ppapi/cpp/size.h"
/// @file
/// This file defines the CameraCapabilities_Private interface for
/// establishing an image capture configuration resource within the browser.
namespace pp {
/// The <code>CameraCapabilities_Private</code> interface contains methods for
/// getting the image capture capabilities within the browser.
class CameraCapabilities_Private : public Resource {
public:
/// Default constructor for creating an is_null()
/// <code>CameraCapabilities_Private</code> object.
CameraCapabilities_Private();
/// The copy constructor for <code>CameraCapabilities_Private</code>.
///
/// @param[in] other A reference to a <code>CameraCapabilities_Private
/// </code>.
CameraCapabilities_Private(const CameraCapabilities_Private& other);
/// Constructs a <code>CameraCapabilities_Private</code> from a <code>
/// Resource</code>.
///
/// @param[in] resource A <code>PPB_CameraCapabilities_Private</code>
/// resource.
explicit CameraCapabilities_Private(const Resource& resource);
/// Constructs a <code>CameraCapabilities_Private</code> object.
///
/// @param[in] instance The instance with which this resource will be
/// associated.
explicit CameraCapabilities_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>PPB_CameraCapabilities_Private</code>
/// resource.
CameraCapabilities_Private(PassRef, PP_Resource resource);
// Destructor.
~CameraCapabilities_Private();
/// GetSupportedPreviewSizes() returns the supported preview sizes for the
/// given <code>CameraCapabilities_Private</code>.
///
/// @param[out] A vector of <code>Size</code> corresponding to the
/// supported preview sizes in pixels.
void GetSupportedPreviewSizes(std::vector<Size>* preview_sizes);
/// GetSupportedJpegSize() returns the supported JPEG sizes for the given
/// <code>CameraCapabilities_Private</code>.
///
/// @param[out] A vector of <code>Size</code> corresponding to the
/// supported JPEG image sizes in pixels.
void GetSupportedJpegSizes(std::vector<Size>* jpeg_sizes);
/// IsCameraCapabilities() determines if the given resource is a
/// <code>CameraCapabilities_Private</code>.
///
/// @param[in] resource A <code>Resource</code> corresponding to an image
/// capture capabilities resource.
///
/// @return true if the given resource is an <code>
/// CameraCapabilities_Private</code> resource, otherwise false.
static bool IsCameraCapabilities(const Resource& resource);
};
} // namespace pp
#endif /* PPAPI_CPP_PRIVATE_CAMERA_CAPABILITIES_PRIVATE_H_ */
/* 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.
*/
#ifndef PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_CONFIG_PRIVATE_H_
#define PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_CONFIG_PRIVATE_H_
#include "ppapi/c/private/ppb_image_capture_config_private.h"
#include "ppapi/cpp/resource.h"
#include "ppapi/cpp/size.h"
/// @file
/// This file defines the ImageCaptureConfig_Private interface for
/// establishing an image capture configuration resource within the browser.
namespace pp {
/// The <code>ImageCaptureConfig_Private</code> interface contains methods for
/// establishing image capture configuration within the browser. The new
/// configuration will take effect after <code>
/// ImageCaptureConfig_Private.SetConfig</code> is called.
class ImageCaptureConfig_Private {
public:
/// Default constructor for creating an is_null()
/// <code>ImageCaptureConfig_Private</code> object.
ImageCaptureConfig_Private();
/// The copy constructor for <code>ImageCaptureConfig_Private</code>.
///
/// @param[in] other A reference to a <code>ImageCaptureConfig_Private
/// </code>.
ImageCaptureConfig_Private(const ImageCaptureConfig_Private& other);
/// Constructs a <code>ImageCaptureConfig_Private</code> from a <code>
/// Resource</code>.
///
/// @param[in] resource A <code>PPB_ImageCaptureConfig_Private</code>
/// resource.
explicit ImageCaptureConfig_Private(const Resource& resource);
/// Constructs a <code>ImageCaptureConfig_Private</code> object.
///
/// @param[in] instance The instance with which this resource will be
/// associated.
explicit ImageCaptureConfig_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>PPB_ImageCaptureConfig_Private</code>
/// resource.
ImageCaptureConfig_Private(PassRef, PP_Resource resource);
// Destructor.
~ImageCaptureConfig_Private();
/// GetPreviewSize() returns the preview image size in pixels for the given
/// <code>ImageCaptureConfig_Private</code>.
///
/// @param[out] preview_size A <code>Size</code> that indicates the
/// requested preview image size.
void GetPreviewSize(Size* preview_size);
/// SetPreviewSize() sets the preview image size for the given <code>
/// ImageCaptureConfig_Private</code>.
///
/// @param[in] preview_size A <code>Size</code> that indicates the
/// requested preview image size.
void SetPreviewSize(const Size& preview_size);
/// GetJpegSize() returns the JPEG image size in pixels for the given
/// <code>ImageCaptureConfig_Private</code>.
///
/// @param[out] jpeg_size A <code>Size</code> that indicates the current
/// JPEG image size.
void GetJpegSize(Size* jpeg_size);
/// SetJpegSize() sets the JPEG image size for the given <code>
/// ImageCaptureConfig_Private</code>.
///
/// @param[in] jpeg_size A <code>Size</code> that indicates the requested
/// JPEG image size.
void SetJpegSize(const Size& jpeg_size);
/// IsImageCaptureConfig() determines if the given resource is a
/// <code>ImageCaptureConfig_Private</code>.
///
/// @param[in] resource A <code>Resource</code> corresponding to an image
/// capture config resource.
///
/// @return true if the given resource is an <code>
/// ImageCaptureConfig_Private</code> resource, otherwise false.
static bool IsImageCaptureConfig(const Resource& resource);
};
} // namespace pp
#endif /* PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_CONFIG_PRIVATE_H_ */
/* 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.
*/
#ifndef PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_
#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"
/// @file
/// Defines the <code>ImageCapture_Private</code> interface. Used for
/// acquiring a single still image from a camera source.
namespace pp {
/// 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.
/// 3. 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.
class ImageCapture_Private {
public:
/// Default constructor for creating an is_null()
/// <code>ImageCapture_Private</code> object.
ImageCapture_Private();
/// Creates 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);
/// 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.
ImageCapture_Private(PassRef, PP_Resource resource);
// Destructor.
~ImageCapture_Private();
/// 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);
/// Sets the configuration of the image capture.
/// If <code>SetConfig()</code> is not called, default settings will be used.
///
/// @param[in] config A <code>ImageCaptureConfig_Private</code> object.
/// @param[in] callback <code>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, the configuration will not be changed.
int32_t SetConfig(const ImageCaptureConfig_Private& config,
const CompletionCallback& callback);
/// Gets the configuration of the image capture.
///
/// @param[in] callback A <code>CompletionCallbackWithOutput</code>
/// to be called upon completion.
///
/// @return An int32_t containing a result code from <code>pp_errors.h</code>.
int32_t GetConfig(
const CompletionCallbackWithOutput<ImageCaptureConfig_Private>& callback);
/// Gets the camera capabilities.
///
/// The camera capabilities do not change for a given camera source.
///
/// @param[in] callback A <code>CompletionCallbackWithOutput</code>
/// to be called upon completion.
///
/// @return An int32_t containing a result code from <code>pp_errors.h</code>.
int32_t GetCameraCapabilities(
const CompletionCallbackWithOutput<CameraCapabilities_Private>& 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 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. If there is an error after the capture is
/// in progress, the error callback passed to <code>
/// ImageCapture_Private.Create()</code> 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>ImageCaptureConfig_Private.SetPreviewSize</code>. The format is
/// decided by the camera and can be got from <code>VideoFrame.GetFormat
/// </code>. The size of the JPEG image is determined by <code>
/// ImageCaptureConfig_Private.SetJpegSize</code>.
///
/// The camera may need to stop and re-start streaming during image capture.
/// If some MediaStreamVideoTrack are associated with the camera source, they
/// will receive mute and unmute events. The mute event will be received
/// before all the callbacks. The unmute event will be received after all the
/// callbacks. The preview image will not be sent to the video tracks
/// associated with the camera.
///
/// @param[in] shutter_callback A <code>
/// ImageCapture_Private_ShutterCallback</code> callback to indicate the
/// image has been taken.
/// @param[in] preview_callback A <code>
/// ImageCapture_Private_PreviewCallback</code> callback to return a
/// preview of the captured image.
/// @param[in] jpeg_callback A <code>
/// 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>.
/// PP_OK means the callbacks will be triggered. Other values mean the
/// callbacks will not be triggered.
int32_t CaptureStillImage(
PPB_ImageCapture_Private_ShutterCallback shutter_callback,
PPB_ImageCapture_Private_PreviewCallback preview_callback,
PPB_ImageCapture_Private_JpegCallback jpeg_callback,
int64_t* sequence_id);
/// Determines if a resource is an image capture resource.
///
/// @param[in] resource The <code>Resource</code> to test.
///
/// @return true if the given resource is an image capture resource or false
/// otherwise.
static bool IsImageCapture(const Resource& resource);
};
} // namespace pp
#endif /* PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_ */
......@@ -63,6 +63,7 @@
#include "ppapi/c/private/ppb_flash_drm.h"
#include "ppapi/c/private/ppb_flash_menu.h"
#include "ppapi/c/private/ppb_host_resolver_private.h"
#include "ppapi/c/private/ppb_image_capture_private.h"
#include "ppapi/c/private/ppb_instance_private.h"
#include "ppapi/c/private/ppb_isolated_file_system_private.h"
#include "ppapi/c/private/ppb_nacl_private.h"
......@@ -177,6 +178,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_DRM_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_DRM_1_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Menu_0_2;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ImageCapture_Private_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_Private_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_2;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NaCl_Private_1_0;
......@@ -2660,6 +2662,8 @@ static struct PP_Var Pnacl_M13_PPP_Selection_Dev_GetSelectedText(PP_Instance ins
/* Not generating wrapper methods for PPP_Zoom_Dev_0_3 */
/* Not generating wrapper methods for PPB_CameraCapabilities_Private_0_1 */
/* Begin wrapper methods for PPB_ContentDecryptor_Private_0_12 */
static void Pnacl_M36_PPB_ContentDecryptor_Private_PromiseResolved(PP_Instance instance, uint32_t promise_id) {
......@@ -3300,6 +3304,47 @@ static PP_Bool Pnacl_M19_PPB_HostResolver_Private_GetNetAddress(PP_Resource host
/* End wrapper methods for PPB_HostResolver_Private_0_1 */
/* Not generating wrapper methods for PPB_ImageCaptureConfig_Private_0_1 */
/* Begin wrapper methods for PPB_ImageCapture_Private_0_1 */
static PP_Resource Pnacl_M39_PPB_ImageCapture_Private_Create(PP_Instance instance, struct PP_Var* camera_source_id, PPB_ImageCapture_Private_ErrorCallback error_callback, void* user_data) {
const struct PPB_ImageCapture_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_ImageCapture_Private_0_1.real_iface;
return iface->Create(instance, *camera_source_id, error_callback, user_data);
}
static PP_Bool Pnacl_M39_PPB_ImageCapture_Private_IsImageCapture(PP_Resource resource) {
const struct PPB_ImageCapture_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_ImageCapture_Private_0_1.real_iface;
return iface->IsImageCapture(resource);
}
static int32_t Pnacl_M39_PPB_ImageCapture_Private_Close(PP_Resource resource, struct PP_CompletionCallback* callback) {
const struct PPB_ImageCapture_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_ImageCapture_Private_0_1.real_iface;
return iface->Close(resource, *callback);
}
static int32_t Pnacl_M39_PPB_ImageCapture_Private_SetConfig(PP_Resource image_capture, PP_Resource config, struct PP_CompletionCallback* callback) {
const struct PPB_ImageCapture_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_ImageCapture_Private_0_1.real_iface;
return iface->SetConfig(image_capture, config, *callback);
}
static int32_t Pnacl_M39_PPB_ImageCapture_Private_GetConfig(PP_Resource image_capture, PP_Resource* config, struct PP_CompletionCallback* callback) {
const struct PPB_ImageCapture_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_ImageCapture_Private_0_1.real_iface;
return iface->GetConfig(image_capture, config, *callback);
}
static int32_t Pnacl_M39_PPB_ImageCapture_Private_GetCameraCapabilities(PP_Resource image_capture, PP_Resource* capabilities, struct PP_CompletionCallback* callback) {
const struct PPB_ImageCapture_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_ImageCapture_Private_0_1.real_iface;
return iface->GetCameraCapabilities(image_capture, capabilities, *callback);
}
static int32_t Pnacl_M39_PPB_ImageCapture_Private_CaptureStillImage(PP_Resource image_capture, PPB_ImageCapture_Private_ShutterCallback shutter_callback, PPB_ImageCapture_Private_PreviewCallback preview_callback, PPB_ImageCapture_Private_JpegCallback jpeg_callback, int64_t* sequence_id) {
const struct PPB_ImageCapture_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_ImageCapture_Private_0_1.real_iface;
return iface->CaptureStillImage(image_capture, shutter_callback, preview_callback, jpeg_callback, sequence_id);
}
/* End wrapper methods for PPB_ImageCapture_Private_0_1 */
/* Not generating wrapper methods for PPB_InputEvent_Private_0_1 */
/* Begin wrapper methods for PPB_Instance_Private_0_1 */
......@@ -5106,6 +5151,8 @@ static const struct PPP_Selection_Dev_0_3 Pnacl_Wrappers_PPP_Selection_Dev_0_3 =
/* Not generating wrapper interface for PPP_Zoom_Dev_0_3 */
/* Not generating wrapper interface for PPB_CameraCapabilities_Private_0_1 */
static const struct PPB_ContentDecryptor_Private_0_12 Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_12 = {
.PromiseResolved = (void (*)(PP_Instance instance, uint32_t promise_id))&Pnacl_M36_PPB_ContentDecryptor_Private_PromiseResolved,
.PromiseResolvedWithSession = (void (*)(PP_Instance instance, uint32_t promise_id, struct PP_Var web_session_id))&Pnacl_M36_PPB_ContentDecryptor_Private_PromiseResolvedWithSession,
......@@ -5281,6 +5328,18 @@ static const struct PPB_HostResolver_Private_0_1 Pnacl_Wrappers_PPB_HostResolver
.GetNetAddress = (PP_Bool (*)(PP_Resource host_resolver, uint32_t index, struct PP_NetAddress_Private* addr))&Pnacl_M19_PPB_HostResolver_Private_GetNetAddress
};
/* Not generating wrapper interface for PPB_ImageCaptureConfig_Private_0_1 */
static const struct PPB_ImageCapture_Private_0_1 Pnacl_Wrappers_PPB_ImageCapture_Private_0_1 = {
.Create = (PP_Resource (*)(PP_Instance instance, struct PP_Var camera_source_id, PPB_ImageCapture_Private_ErrorCallback error_callback, void* user_data))&Pnacl_M39_PPB_ImageCapture_Private_Create,
.IsImageCapture = (PP_Bool (*)(PP_Resource resource))&Pnacl_M39_PPB_ImageCapture_Private_IsImageCapture,
.Close = (int32_t (*)(PP_Resource resource, struct PP_CompletionCallback callback))&Pnacl_M39_PPB_ImageCapture_Private_Close,
.SetConfig = (int32_t (*)(PP_Resource image_capture, PP_Resource config, struct PP_CompletionCallback callback))&Pnacl_M39_PPB_ImageCapture_Private_SetConfig,
.GetConfig = (int32_t (*)(PP_Resource image_capture, PP_Resource* config, struct PP_CompletionCallback callback))&Pnacl_M39_PPB_ImageCapture_Private_GetConfig,
.GetCameraCapabilities = (int32_t (*)(PP_Resource image_capture, PP_Resource* capabilities, struct PP_CompletionCallback callback))&Pnacl_M39_PPB_ImageCapture_Private_GetCameraCapabilities,
.CaptureStillImage = (int32_t (*)(PP_Resource image_capture, PPB_ImageCapture_Private_ShutterCallback shutter_callback, PPB_ImageCapture_Private_PreviewCallback preview_callback, PPB_ImageCapture_Private_JpegCallback jpeg_callback, int64_t* sequence_id))&Pnacl_M39_PPB_ImageCapture_Private_CaptureStillImage
};
/* Not generating wrapper interface for PPB_InputEvent_Private_0_1 */
static const struct PPB_Instance_Private_0_1 Pnacl_Wrappers_PPB_Instance_Private_0_1 = {
......@@ -6051,6 +6110,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1
.real_iface = NULL
};
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ImageCapture_Private_0_1 = {
.iface_macro = PPB_IMAGECAPTURE_PRIVATE_INTERFACE_0_1,
.wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_ImageCapture_Private_0_1,
.real_iface = NULL
};
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_Private_0_1 = {
.iface_macro = PPB_INSTANCE_PRIVATE_INTERFACE_0_1,
.wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_Instance_Private_0_1,
......@@ -6282,6 +6347,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = {
&Pnacl_WrapperInfo_PPB_Flash_DRM_1_1,
&Pnacl_WrapperInfo_PPB_Flash_Menu_0_2,
&Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1,
&Pnacl_WrapperInfo_PPB_ImageCapture_Private_0_1,
&Pnacl_WrapperInfo_PPB_Instance_Private_0_1,
&Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_2,
&Pnacl_WrapperInfo_PPB_NaCl_Private_1_0,
......
......@@ -105,6 +105,7 @@
#include "ppapi/c/ppp_mouse_lock.h"
#include "ppapi/c/private/pp_private_font_charset.h"
#include "ppapi/c/private/pp_video_frame_private.h"
#include "ppapi/c/private/ppb_camera_capabilities_private.h"
#include "ppapi/c/private/ppb_content_decryptor_private.h"
#include "ppapi/c/private/ppb_display_color_profile_private.h"
#include "ppapi/c/private/ppb_ext_crx_file_system_private.h"
......@@ -116,6 +117,8 @@
#include "ppapi/c/private/ppb_flash_menu.h"
#include "ppapi/c/private/ppb_flash_message_loop.h"
#include "ppapi/c/private/ppb_host_resolver_private.h"
#include "ppapi/c/private/ppb_image_capture_config_private.h"
#include "ppapi/c/private/ppb_image_capture_private.h"
#include "ppapi/c/private/ppb_input_event_private.h"
#include "ppapi/c/private/ppb_instance_private.h"
#include "ppapi/c/private/ppb_nacl_private.h"
......
......@@ -52,10 +52,13 @@
#include "ppapi/cpp/net_address.h"
#include "ppapi/cpp/network_proxy.h"
#include "ppapi/cpp/point.h"
#include "ppapi/cpp/private/camera_capabilities_private.h"
#include "ppapi/cpp/private/content_decryptor_private.h"
#include "ppapi/cpp/private/find_private.h"
#include "ppapi/cpp/private/flash_font_file.h"
#include "ppapi/cpp/private/flash_fullscreen.h"
#include "ppapi/cpp/private/image_capture_config_private.h"
#include "ppapi/cpp/private/image_capture_private.h"
#include "ppapi/cpp/private/instance_private.h"
#include "ppapi/cpp/private/instance_private.h"
#include "ppapi/cpp/private/net_address_private.h"
......
// 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.
// From private/ppb_camera_capabilities_private.idl,
// modified Wed Aug 13 14:08:24 2014.
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_camera_capabilities_private.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppapi_thunk_export.h"
#include "ppapi/thunk/ppb_camera_capabilities_api.h"
namespace ppapi {
namespace thunk {
namespace {
PP_Resource Create(PP_Instance instance) {
VLOG(4) << "PPB_CameraCapabilities_Private::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
return enter.functions()->CreateCameraCapabilitiesPrivate(instance);
}
PP_Bool IsCameraCapabilities(PP_Resource resource) {
VLOG(4) << "PPB_CameraCapabilities_Private::IsCameraCapabilities()";
EnterResource<PPB_CameraCapabilities_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
void GetSupportedPreviewSizes(PP_Resource capabilities,
int32_t* array_size,
struct PP_Size* preview_sizes[]) {
VLOG(4) << "PPB_CameraCapabilities_Private::GetSupportedPreviewSizes()";
EnterResource<PPB_CameraCapabilities_API> enter(capabilities, true);
if (enter.failed())
return;
enter.object()->GetSupportedPreviewSizes(array_size, preview_sizes);
}
void GetSupportedJpegSizes(PP_Resource capabilities,
int32_t* array_size,
struct PP_Size* jpeg_sizes[]) {
VLOG(4) << "PPB_CameraCapabilities_Private::GetSupportedJpegSizes()";
EnterResource<PPB_CameraCapabilities_API> enter(capabilities, true);
if (enter.failed())
return;
enter.object()->GetSupportedJpegSizes(array_size, jpeg_sizes);
}
const PPB_CameraCapabilities_Private_0_1
g_ppb_cameracapabilities_private_thunk_0_1 = {
&Create,
&IsCameraCapabilities,
&GetSupportedPreviewSizes,
&GetSupportedJpegSizes
};
} // namespace
PPAPI_THUNK_EXPORT const PPB_CameraCapabilities_Private_0_1*
GetPPB_CameraCapabilities_Private_0_1_Thunk() {
return &g_ppb_cameracapabilities_private_thunk_0_1;
}
} // namespace thunk
} // namespace ppapi
// 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.
// From private/ppb_image_capture_config_private.idl,
// modified Wed Aug 13 14:07:52 2014.
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_image_capture_config_private.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppapi_thunk_export.h"
#include "ppapi/thunk/ppb_image_capture_config_api.h"
namespace ppapi {
namespace thunk {
namespace {
PP_Resource Create(PP_Instance instance) {
VLOG(4) << "PPB_ImageCaptureConfig_Private::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
return enter.functions()->CreateImageCaptureConfigPrivate(instance);
}
PP_Bool IsImageCaptureConfig(PP_Resource resource) {
VLOG(4) << "PPB_ImageCaptureConfig_Private::IsImageCaptureConfig()";
EnterResource<PPB_ImageCaptureConfig_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
void GetPreviewSize(PP_Resource config, struct PP_Size* preview_size) {
VLOG(4) << "PPB_ImageCaptureConfig_Private::GetPreviewSize()";
EnterResource<PPB_ImageCaptureConfig_API> enter(config, true);
if (enter.failed())
return;
enter.object()->GetPreviewSize(preview_size);
}
void SetPreviewSize(PP_Resource config, const struct PP_Size* preview_size) {
VLOG(4) << "PPB_ImageCaptureConfig_Private::SetPreviewSize()";
EnterResource<PPB_ImageCaptureConfig_API> enter(config, true);
if (enter.failed())
return;
enter.object()->SetPreviewSize(preview_size);
}
void GetJpegSize(PP_Resource config, struct PP_Size* jpeg_size) {
VLOG(4) << "PPB_ImageCaptureConfig_Private::GetJpegSize()";
EnterResource<PPB_ImageCaptureConfig_API> enter(config, true);
if (enter.failed())
return;
enter.object()->GetJpegSize(jpeg_size);
}
void SetJpegSize(PP_Resource config, const struct PP_Size* jpeg_size) {
VLOG(4) << "PPB_ImageCaptureConfig_Private::SetJpegSize()";
EnterResource<PPB_ImageCaptureConfig_API> enter(config, true);
if (enter.failed())
return;
enter.object()->SetJpegSize(jpeg_size);
}
const PPB_ImageCaptureConfig_Private_0_1
g_ppb_imagecaptureconfig_private_thunk_0_1 = {
&Create,
&IsImageCaptureConfig,
&GetPreviewSize,
&SetPreviewSize,
&GetJpegSize,
&SetJpegSize
};
} // namespace
PPAPI_THUNK_EXPORT const PPB_ImageCaptureConfig_Private_0_1*
GetPPB_ImageCaptureConfig_Private_0_1_Thunk() {
return &g_ppb_imagecaptureconfig_private_thunk_0_1;
}
} // namespace thunk
} // namespace ppapi
// 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.
// From private/ppb_image_capture_private.idl,
// modified Wed Aug 13 17:26:13 2014.
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_image_capture_private.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppapi_thunk_export.h"
#include "ppapi/thunk/ppb_image_capture_api.h"
namespace ppapi {
namespace thunk {
namespace {
PP_Resource Create(PP_Instance instance,
struct PP_Var camera_source_id,
PPB_ImageCapture_Private_ErrorCallback error_callback,
void* user_data) {
VLOG(4) << "PPB_ImageCapture_Private::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
return enter.functions()->CreateImageCapturePrivate(instance,
camera_source_id,
error_callback,
user_data);
}
PP_Bool IsImageCapture(PP_Resource resource) {
VLOG(4) << "PPB_ImageCapture_Private::IsImageCapture()";
EnterResource<PPB_ImageCapture_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
int32_t Close(PP_Resource resource, struct PP_CompletionCallback callback) {
VLOG(4) << "PPB_ImageCapture_Private::Close()";
EnterResource<PPB_ImageCapture_API> enter(resource, callback, true);
if (enter.failed())
return enter.retval();
return enter.SetResult(enter.object()->Close(enter.callback()));
}
int32_t SetConfig(PP_Resource image_capture,
PP_Resource config,
struct PP_CompletionCallback callback) {
VLOG(4) << "PPB_ImageCapture_Private::SetConfig()";
EnterResource<PPB_ImageCapture_API> enter(image_capture, callback, true);
if (enter.failed())
return enter.retval();
return enter.SetResult(enter.object()->SetConfig(config, enter.callback()));
}
int32_t GetConfig(PP_Resource image_capture,
PP_Resource* config,
struct PP_CompletionCallback callback) {
VLOG(4) << "PPB_ImageCapture_Private::GetConfig()";
EnterResource<PPB_ImageCapture_API> enter(image_capture, callback, true);
if (enter.failed())
return enter.retval();
return enter.SetResult(enter.object()->GetConfig(config, enter.callback()));
}
int32_t GetCameraCapabilities(PP_Resource image_capture,
PP_Resource* capabilities,
struct PP_CompletionCallback callback) {
VLOG(4) << "PPB_ImageCapture_Private::GetCameraCapabilities()";
EnterResource<PPB_ImageCapture_API> enter(image_capture, callback, true);
if (enter.failed())
return enter.retval();
return enter.SetResult(enter.object()->GetCameraCapabilities(
capabilities,
enter.callback()));
}
int32_t CaptureStillImage(
PP_Resource image_capture,
PPB_ImageCapture_Private_ShutterCallback shutter_callback,
PPB_ImageCapture_Private_PreviewCallback preview_callback,
PPB_ImageCapture_Private_JpegCallback jpeg_callback,
int64_t* sequence_id) {
VLOG(4) << "PPB_ImageCapture_Private::CaptureStillImage()";
EnterResource<PPB_ImageCapture_API> enter(image_capture, true);
if (enter.failed())
return enter.retval();
return enter.object()->CaptureStillImage(shutter_callback,
preview_callback,
jpeg_callback,
sequence_id);
}
const PPB_ImageCapture_Private_0_1 g_ppb_imagecapture_private_thunk_0_1 = {
&Create,
&IsImageCapture,
&Close,
&SetConfig,
&GetConfig,
&GetCameraCapabilities,
&CaptureStillImage
};
} // namespace
PPAPI_THUNK_EXPORT const PPB_ImageCapture_Private_0_1*
GetPPB_ImageCapture_Private_0_1_Thunk() {
return &g_ppb_imagecapture_private_thunk_0_1;
}
} // namespace thunk
} // namespace ppapi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment