1/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6/**
7 * This file defines the <code>PPP_VideoCapture_Dev</code> interface.
8 */
9label Chrome {
10  M15 = 0.1
11};
12
13/**
14 * Video Capture client interface. See |PPB_VideoCapture_Dev| for general theory
15 * of operation.
16 */
17[macro="PPP_VIDEO_CAPTURE_DEV_INTERFACE"]
18interface PPP_VideoCapture_Dev {
19  /**
20   * Signals the capture device information, such as resolution and frame rate,
21   * and the array of buffers that the browser will use to send pixel data.
22   *
23   * |info| is a pointer to the PP_VideoCaptureDeviceInfo_Dev structure
24   * containing resolution and frame rate.
25   * |buffer_count| is the number of buffers, and |buffers| is the array of
26   * PPB_Buffer_Dev buffers.
27   *
28   * Note: the buffers are passed without an extra reference. The plugin is
29   * expected to add its own references to the buffers.
30   */
31  void OnDeviceInfo([in] PP_Instance instance,
32                    [in] PP_Resource video_capture,
33                    [in] PP_VideoCaptureDeviceInfo_Dev info,
34                    [in] uint32_t buffer_count,
35                    [in, size_is(buffer_count)] PP_Resource[] buffers);
36
37  /**
38   * Signals status changes on the VideoCapture. |status| is a
39   * one of the values from PP_VideoCaptureStatus_Dev;
40   */
41  void OnStatus([in] PP_Instance instance,
42                [in] PP_Resource video_capture,
43                [in] uint32_t status);
44
45  /**
46   * Signals an error from the video capture system.
47   *
48   * Errors that can be generated:
49   * - PP_ERROR_NOMEMORY: not enough memory was available to allocate buffers.
50   * - PP_ERROR_FAILED: video capture could not start.
51   */
52  void OnError([in] PP_Instance instance,
53               [in] PP_Resource video_capture,
54               [in] uint32_t error_code);
55
56  /**
57   * Signals that a buffer is available for consumption by the plugin.
58   *
59   * |buffer| is the index of the buffer, in the array returned by OnDeviceInfo.
60   */
61  void OnBufferReady([in] PP_Instance instance,
62                     [in] PP_Resource video_capture,
63                     [in] uint32_t buffer);
64};
65