/* 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 PPB_CameraDevice_Private interface. Used for * manipulating a camera device. */ [generate_thunk] label Chrome { M42 = 0.1 }; /** * To query camera capabilities: * 1. Get a PPB_CameraDevice_Private object by Create(). * 2. Open() camera device with track id of MediaStream video track. * 3. Call GetCameraCapabilities() to get a * PPB_CameraCapabilities_Private object, which can be used to * query camera capabilities. */ interface PPB_CameraDevice_Private { /** * Creates a PPB_CameraDevice_Private resource. * * @param[in] instance A PP_Instance identifying one instance * of a module. * * @return A PP_Resource corresponding to a * PPB_CameraDevice_Private resource if successful, 0 if failed. */ PP_Resource Create([in] PP_Instance instance); /** * Determines if a resource is a camera device resource. * * @param[in] resource The PP_Resource to test. * * @return A PP_Bool with PP_TRUE if the given * resource is a camera device resource or PP_FALSE * otherwise. */ PP_Bool IsCameraDevice([in] PP_Resource resource); /** * Opens a camera device. * * @param[in] camera_device A PP_Resource corresponding to a * camera device resource. * @param[in] device_id A PP_Var identifying a camera device. The * type is string. The ID can be obtained from MediaStreamTrack.getSources() * or MediaStreamVideoTrack.id. * @param[in] callback A PP_CompletionCallback to be called upon * completion of Open(). * * @return An error code from pp_errors.h. */ int32_t Open( [in] PP_Resource camera_device, [in] PP_Var device_id, [in] PP_CompletionCallback callback); /** * Disconnects from the camera and cancels all pending requests. * After this returns, no callbacks will be called. If * PPB_CameraDevice_Private is destroyed and is not closed yet, this * function will be automatically called. Calling this more than once has no * effect. * * @param[in] camera_device A PP_Resource corresponding to a * camera device resource. */ void Close([in] PP_Resource camera_device); /** * Gets the camera capabilities. * * The camera capabilities do not change for a given camera source. * * @param[in] camera_device A PP_Resource corresponding to a * camera device resource. * @param[out] capabilities A PPB_CameraCapabilities_Private for * storing the camera capabilities on success. Otherwise, the value will not * be changed. * @param[in] callback PP_CompletionCallback to be called upon * completion of GetCameraCapabilities(). * * @return An int32_t containing a result code from pp_errors.h. */ int32_t GetCameraCapabilities([in] PP_Resource camera_device, [out] PP_Resource capabilities, [in] PP_CompletionCallback callback); };