Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * This file defines the <code>PPB_VideoCapture_Dev</code> interface. | 7 * This file defines the <code>PPB_VideoCapture_Dev</code> interface. |
| 8 */ | 8 */ |
| 9 label Chrome { | 9 label Chrome { |
| 10 M14 = 0.1 | 10 M14 = 0.1, |
| 11 M18 = 0.2 | |
| 11 }; | 12 }; |
| 12 | 13 |
| 13 /** | 14 /** |
| 14 * Video capture interface. It goes hand-in-hand with PPP_VideoCapture_Dev. | 15 * Video capture interface. It goes hand-in-hand with PPP_VideoCapture_Dev. |
| 15 * | 16 * |
| 16 * Theory of operation: | 17 * Theory of operation: |
| 17 * 1- Create a VideoCapture resource using Create. | 18 * 1- Create a VideoCapture resource using Create. |
| 18 * 2- Start the capture using StartCapture. You pass in the requested info | 19 * 2- Start the capture using StartCapture. You pass in the requested info |
| 19 * (resolution, frame rate), as well as suggest a number of buffers you will | 20 * (resolution, frame rate), as well as suggest a number of buffers you will |
| 20 * need. | 21 * need. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 45 /** | 46 /** |
| 46 * Returns PP_TRUE if the given resource is a VideoCapture. | 47 * Returns PP_TRUE if the given resource is a VideoCapture. |
| 47 */ | 48 */ |
| 48 PP_Bool IsVideoCapture( | 49 PP_Bool IsVideoCapture( |
| 49 [in] PP_Resource video_capture); | 50 [in] PP_Resource video_capture); |
| 50 | 51 |
| 51 /** | 52 /** |
| 52 * Starts the capture. |requested_info| is a pointer to a structure containing | 53 * Starts the capture. |requested_info| is a pointer to a structure containing |
| 53 * the requested resolution and frame rate. |buffer_count| is the number of | 54 * the requested resolution and frame rate. |buffer_count| is the number of |
| 54 * buffers requested by the plugin. Note: it is only used as advisory, the | 55 * buffers requested by the plugin. Note: it is only used as advisory, the |
| 55 * browser may allocate more of fewer based on available resources. | 56 * browser may allocate more or fewer based on available resources. |
| 56 * How many buffers depends on usage. At least 2 to make sure latency doesn't | 57 * How many buffers depends on usage. At least 2 to make sure latency doesn't |
| 57 * cause lost frames. If the plugin expects to hold on to more than one buffer | 58 * cause lost frames. If the plugin expects to hold on to more than one buffer |
| 58 * at a time (e.g. to do multi-frame processing, like video encoding), it | 59 * at a time (e.g. to do multi-frame processing, like video encoding), it |
| 59 * should request that many more. | 60 * should request that many more. |
| 60 * | 61 * |
| 61 * Returns PP_ERROR_FAILED if called when the capture was already started, or | 62 * Returns PP_ERROR_FAILED if called when the capture was already started, or |
| 62 * PP_OK on success. | 63 * PP_OK on success. |
| 63 */ | 64 */ |
| 64 int32_t StartCapture( | 65 int32_t StartCapture( |
|
viettrungluu
2012/01/27 18:54:34
Maybe we should deprecate this version (and remove
yzshen1
2012/01/27 19:20:40
It won't show up in v0.2. The generator decides to
| |
| 65 [in] PP_Resource video_capture, | 66 [in] PP_Resource video_capture, |
| 66 [in] PP_VideoCaptureDeviceInfo_Dev requested_info, | 67 [in] PP_VideoCaptureDeviceInfo_Dev requested_info, |
| 67 [in] uint32_t buffer_count); | 68 [in] uint32_t buffer_count); |
| 68 | 69 |
| 69 /** | 70 /** |
| 71 * Enumerates video capture devices. Once the operation is completed | |
| 72 * successfully. |GetDevices()| can be used to retrieve the devices. | |
| 73 */ | |
| 74 [version=0.2] | |
| 75 int32_t EnumerateDevices( | |
| 76 [in] PP_Resource video_capture, | |
| 77 [in] PP_CompletionCallback callback); | |
| 78 | |
| 79 /** | |
| 80 * Gets video capture devices. The returned value is a PPB_ResourceArray_Dev | |
| 81 * resource if successful, which holds a list of PPB_DeviceRef_Dev resources. | |
| 82 */ | |
| 83 [version=0.2] | |
| 84 PP_Resource GetDevices( | |
| 85 [in] PP_Resource video_capture); | |
| 86 | |
| 87 /** | |
| 88 * Starts the capture. |device_ref| identifies a video capture device. It | |
| 89 * could be one of the resource in the array returned by |GetDevices()|, or 0 | |
| 90 * which means the default device. | |
| 91 * |requested_info| is a pointer to a structure containing the requested | |
| 92 * resolution and frame rate. |buffer_count| is the number of buffers | |
| 93 * requested by the plugin. Note: it is only used as advisory, the browser may | |
| 94 * allocate more or fewer based on available resources. How many buffers | |
| 95 * depends on usage. At least 2 to make sure latency doesn't cause lost | |
| 96 * frames. If the plugin expects to hold on to more than one buffer at a time | |
| 97 * (e.g. to do multi-frame processing, like video encoding), it should request | |
| 98 * that many more. | |
| 99 * | |
| 100 * Returns PP_ERROR_FAILED if called when the capture was already started, or | |
| 101 * PP_OK on success. | |
| 102 */ | |
| 103 [version=0.2] | |
| 104 int32_t StartCapture( | |
| 105 [in] PP_Resource video_capture, | |
| 106 [in] PP_Resource device_ref, | |
| 107 [in] PP_VideoCaptureDeviceInfo_Dev requested_info, | |
| 108 [in] uint32_t buffer_count); | |
| 109 | |
| 110 /** | |
| 70 * Allows the browser to reuse a buffer that was previously sent by | 111 * Allows the browser to reuse a buffer that was previously sent by |
| 71 * PPP_VideoCapture_Dev.OnBufferReady. |buffer| is the index of the buffer in | 112 * PPP_VideoCapture_Dev.OnBufferReady. |buffer| is the index of the buffer in |
| 72 * the array returned by PPP_VideoCapture_Dev.OnDeviceInfo. | 113 * the array returned by PPP_VideoCapture_Dev.OnDeviceInfo. |
| 73 * | 114 * |
| 74 * Returns PP_ERROR_BADARGUMENT if buffer is out of range (greater than the | 115 * Returns PP_ERROR_BADARGUMENT if buffer is out of range (greater than the |
| 75 * number of buffers returned by PPP_VideoCapture_Dev.OnDeviceInfo), or if it | 116 * number of buffers returned by PPP_VideoCapture_Dev.OnDeviceInfo), or if it |
| 76 * is not currently owned by the plugin. Returns PP_OK otherwise. | 117 * is not currently owned by the plugin. Returns PP_OK otherwise. |
| 77 */ | 118 */ |
| 78 int32_t ReuseBuffer( | 119 int32_t ReuseBuffer( |
| 79 [in] PP_Resource video_capture, | 120 [in] PP_Resource video_capture, |
| 80 [in] uint32_t buffer); | 121 [in] uint32_t buffer); |
| 81 | 122 |
| 82 /** | 123 /** |
| 83 * Stops the capture. | 124 * Stops the capture. |
| 84 * | 125 * |
| 85 * Returns PP_ERROR_FAILED if the capture wasn't already started, or PP_OK on | 126 * Returns PP_ERROR_FAILED if the capture wasn't already started, or PP_OK on |
| 86 * success. | 127 * success. |
| 87 */ | 128 */ |
| 88 int32_t StopCapture( | 129 int32_t StopCapture( |
| 89 [in] PP_Resource video_capture); | 130 [in] PP_Resource video_capture); |
| 90 }; | 131 }; |
| OLD | NEW |