/* Copyright 2012 The Chromium Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* From dev/ppb_video_capture_dev.idl modified Thu Dec 12 15:36:11 2013. */ #ifndef PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_ #define PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_ #include "ppapi/c/dev/pp_video_capture_dev.h" #include "ppapi/c/dev/ppb_device_ref_dev.h" #include "ppapi/c/pp_array_output.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" #define PPB_VIDEOCAPTURE_DEV_INTERFACE_0_3 … #define PPB_VIDEOCAPTURE_DEV_INTERFACE … /** * @file * This file defines the <code>PPB_VideoCapture_Dev</code> interface. */ /** * @addtogroup Interfaces * @{ */ /** * Video capture interface. It goes hand-in-hand with PPP_VideoCapture_Dev. * * Theory of operation: * 1- Create a VideoCapture resource using Create. * 2- Find available video capture devices using EnumerateDevices. * 3- Open a video capture device. In addition to a device reference (0 can be * used to indicate the default device), you pass in the requested info * (resolution, frame rate), as well as suggest a number of buffers you will * need. * 4- Start the capture using StartCapture. * 5- Receive the OnDeviceInfo callback, in PPP_VideoCapture_Dev, which will * give you the actual capture info (the requested one is not guaranteed), as * well as an array of buffers allocated by the browser. * 6- On every frame captured by the browser, OnBufferReady (in * PPP_VideoCapture_Dev) is called with the index of the buffer from the array * containing the new frame. The buffer is now "owned" by the plugin, and the * browser won't reuse it until ReuseBuffer is called. * 7- When the plugin is done with the buffer, call ReuseBuffer. * 8- Stop the capture using StopCapture. * 9- Close the device. * * The browser may change the resolution based on the constraints of the system, * in which case OnDeviceInfo will be called again, with new buffers. * * The buffers contain the pixel data for a frame. The format is planar YUV * 4:2:0, one byte per pixel, tightly packed (width x height Y values, then * width/2 x height/2 U values, then width/2 x height/2 V values). */ struct PPB_VideoCapture_Dev_0_3 { … }; PPB_VideoCapture_Dev; /** * @} */ #endif /* PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_ */