Pepper_31_C_interfaces
Public Attributes | List of all members
PPB_VideoCapture_Dev_0_3 Struct Reference

#include <ppb_video_capture_dev.h>

Collaboration diagram for PPB_VideoCapture_Dev_0_3:
Collaboration graph

Public Attributes

PP_Resource(* Create )(PP_Instance instance)
 
PP_Bool(* IsVideoCapture )(PP_Resource video_capture)
 
int32_t(* EnumerateDevices )(PP_Resource video_capture, struct PP_ArrayOutput output, struct PP_CompletionCallback callback)
 
int32_t(* MonitorDeviceChange )(PP_Resource video_capture, PP_MonitorDeviceChangeCallback callback, void *user_data)
 
int32_t(* Open )(PP_Resource video_capture, PP_Resource device_ref, const struct PP_VideoCaptureDeviceInfo_Dev *requested_info, uint32_t buffer_count, struct PP_CompletionCallback callback)
 
int32_t(* StartCapture )(PP_Resource video_capture)
 
int32_t(* ReuseBuffer )(PP_Resource video_capture, uint32_t buffer)
 
int32_t(* StopCapture )(PP_Resource video_capture)
 
void(* Close )(PP_Resource video_capture)
 

Detailed Description

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).

Definition at line 64 of file ppb_video_capture_dev.h.

Member Data Documentation

void(* PPB_VideoCapture_Dev_0_3::Close)(PP_Resource video_capture)

Closes the video capture device, and stops capturing if necessary. It is not valid to call |Open()| again after a call to this method. If a video capture resource is destroyed while a device is still open, then it will be implicitly closed, so you are not required to call this method.

Definition at line 159 of file ppb_video_capture_dev.h.

PP_Resource(* PPB_VideoCapture_Dev_0_3::Create)(PP_Instance instance)

Creates a new VideoCapture.

Definition at line 68 of file ppb_video_capture_dev.h.

int32_t(* PPB_VideoCapture_Dev_0_3::EnumerateDevices)(PP_Resource video_capture, struct PP_ArrayOutput output, struct PP_CompletionCallback callback)

Enumerates video capture devices.

Parameters
[in]video_captureA PP_Resource corresponding to a video capture resource.
[in]outputAn output array which will receive PPB_DeviceRef_Dev resources on success. Please note that the ref count of those resources has already been increased by 1 for the caller.
[in]callbackA PP_CompletionCallback to run on completion.
Returns
An error code from pp_errors.h.

Definition at line 87 of file ppb_video_capture_dev.h.

PP_Bool(* PPB_VideoCapture_Dev_0_3::IsVideoCapture)(PP_Resource video_capture)

Returns PP_TRUE if the given resource is a VideoCapture.

Definition at line 72 of file ppb_video_capture_dev.h.

int32_t(* PPB_VideoCapture_Dev_0_3::MonitorDeviceChange)(PP_Resource video_capture, PP_MonitorDeviceChangeCallback callback, void *user_data)

Requests device change notifications.

Parameters
[in]video_captureA PP_Resource corresponding to a video capture resource.
[in]callbackThe callback to receive notifications. If not NULL, it will be called once for the currently available devices, and then every time the list of available devices changes. All calls will happen on the same thread as the one on which MonitorDeviceChange() is called. It will receive notifications until video_capture is destroyed or MonitorDeviceChange() is called to set a new callback for video_capture. You can pass NULL to cancel sending notifications.
[in,out]user_dataAn opaque pointer that will be passed to callback.
Returns
An error code from pp_errors.h.

Definition at line 108 of file ppb_video_capture_dev.h.

int32_t(* PPB_VideoCapture_Dev_0_3::Open)(PP_Resource video_capture, PP_Resource device_ref, const struct PP_VideoCaptureDeviceInfo_Dev *requested_info, uint32_t buffer_count, struct PP_CompletionCallback callback)

Opens a video capture device. |device_ref| identifies a video capture device. It could be one of the resource in the array returned by |EnumerateDevices()|, or 0 which means the default device. |requested_info| is a pointer to a structure containing the requested resolution and frame rate. |buffer_count| is the number of buffers requested by the plugin. Note: it is only used as advisory, the browser may allocate more or fewer based on available resources. How many buffers depends on usage. At least 2 to make sure latency doesn't cause lost frames. If the plugin expects to hold on to more than one buffer at a time (e.g. to do multi-frame processing, like video encoding), it should request that many more.

Definition at line 124 of file ppb_video_capture_dev.h.

int32_t(* PPB_VideoCapture_Dev_0_3::ReuseBuffer)(PP_Resource video_capture, uint32_t buffer)

Allows the browser to reuse a buffer that was previously sent by PPP_VideoCapture_Dev.OnBufferReady. |buffer| is the index of the buffer in the array returned by PPP_VideoCapture_Dev.OnDeviceInfo.

Returns PP_ERROR_BADARGUMENT if buffer is out of range (greater than the number of buffers returned by PPP_VideoCapture_Dev.OnDeviceInfo), or if it is not currently owned by the plugin. Returns PP_OK otherwise.

Definition at line 145 of file ppb_video_capture_dev.h.

int32_t(* PPB_VideoCapture_Dev_0_3::StartCapture)(PP_Resource video_capture)

Starts the capture.

Returns PP_ERROR_FAILED if called when the capture was already started, or PP_OK on success.

Definition at line 135 of file ppb_video_capture_dev.h.

int32_t(* PPB_VideoCapture_Dev_0_3::StopCapture)(PP_Resource video_capture)

Stops the capture.

Returns PP_ERROR_FAILED if the capture wasn't already started, or PP_OK on success.

Definition at line 152 of file ppb_video_capture_dev.h.


The documentation for this struct was generated from the following file: