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, | |
11 M19 = 0.2 | 10 M19 = 0.2 |
12 }; | 11 }; |
13 | 12 |
14 /** | 13 /** |
15 * Video capture interface. It goes hand-in-hand with PPP_VideoCapture_Dev. | 14 * Video capture interface. It goes hand-in-hand with PPP_VideoCapture_Dev. |
16 * | 15 * |
17 * Theory of operation: | 16 * Theory of operation: |
18 * 1- Create a VideoCapture resource using Create. | 17 * 1- Create a VideoCapture resource using Create. |
19 * 2- Find available video capture devices using EnumerateDevices. | 18 * 2- Find available video capture devices using EnumerateDevices. |
20 * 3- Open a video capture device. In addition to a device reference (0 can be | 19 * 3- Open a video capture device. In addition to a device reference (0 can be |
(...skipping 26 matching lines...) Expand all Loading... |
47 PP_Resource Create( | 46 PP_Resource Create( |
48 [in] PP_Instance instance); | 47 [in] PP_Instance instance); |
49 | 48 |
50 /** | 49 /** |
51 * Returns PP_TRUE if the given resource is a VideoCapture. | 50 * Returns PP_TRUE if the given resource is a VideoCapture. |
52 */ | 51 */ |
53 PP_Bool IsVideoCapture( | 52 PP_Bool IsVideoCapture( |
54 [in] PP_Resource video_capture); | 53 [in] PP_Resource video_capture); |
55 | 54 |
56 /** | 55 /** |
57 * Starts the capture. |requested_info| is a pointer to a structure containing | |
58 * the requested resolution and frame rate. |buffer_count| is the number of | |
59 * buffers requested by the plugin. Note: it is only used as advisory, the | |
60 * browser may allocate more or fewer based on available resources. | |
61 * How many buffers depends on usage. At least 2 to make sure latency doesn't | |
62 * cause lost frames. If the plugin expects to hold on to more than one buffer | |
63 * at a time (e.g. to do multi-frame processing, like video encoding), it | |
64 * should request that many more. | |
65 * | |
66 * Returns PP_ERROR_FAILED if called when the capture was already started, or | |
67 * PP_OK on success. | |
68 */ | |
69 [version=0.1] | |
70 int32_t StartCapture( | |
71 [in] PP_Resource video_capture, | |
72 [in] PP_VideoCaptureDeviceInfo_Dev requested_info, | |
73 [in] uint32_t buffer_count); | |
74 | |
75 /** | |
76 * Enumerates video capture devices. Once the operation is completed | 56 * Enumerates video capture devices. Once the operation is completed |
77 * successfully, |devices| will be set to a PPB_ResourceArray_Dev resource, | 57 * successfully, |devices| will be set to a PPB_ResourceArray_Dev resource, |
78 * which holds a list of PPB_DeviceRef_Dev resources. | 58 * which holds a list of PPB_DeviceRef_Dev resources. |
79 * | 59 * |
80 * Please note that: | 60 * Please note that: |
81 * - this method ignores the previous value pointed to by |devices| (won't | 61 * - this method ignores the previous value pointed to by |devices| (won't |
82 * release reference even if it is not 0); | 62 * release reference even if it is not 0); |
83 * - |devices| must be valid until |callback| is called, if the method | 63 * - |devices| must be valid until |callback| is called, if the method |
84 * returns PP_OK_COMPLETIONPENDING; | 64 * returns PP_OK_COMPLETIONPENDING; |
85 * - the ref count of the returned |devices| has already been increased by 1 | 65 * - the ref count of the returned |devices| has already been increased by 1 |
86 * for the caller. | 66 * for the caller. |
87 */ | 67 */ |
88 [version=0.2] | |
89 int32_t EnumerateDevices( | 68 int32_t EnumerateDevices( |
90 [in] PP_Resource video_capture, | 69 [in] PP_Resource video_capture, |
91 [out] PP_Resource devices, | 70 [out] PP_Resource devices, |
92 [in] PP_CompletionCallback callback); | 71 [in] PP_CompletionCallback callback); |
93 | 72 |
94 /** | 73 /** |
95 * Opens a video capture device. |device_ref| identifies a video capture | 74 * Opens a video capture device. |device_ref| identifies a video capture |
96 * device. It could be one of the resource in the array returned by | 75 * device. It could be one of the resource in the array returned by |
97 * |EnumerateDevices()|, or 0 which means the default device. | 76 * |EnumerateDevices()|, or 0 which means the default device. |
98 * |requested_info| is a pointer to a structure containing the requested | 77 * |requested_info| is a pointer to a structure containing the requested |
99 * resolution and frame rate. |buffer_count| is the number of buffers | 78 * resolution and frame rate. |buffer_count| is the number of buffers |
100 * requested by the plugin. Note: it is only used as advisory, the browser may | 79 * requested by the plugin. Note: it is only used as advisory, the browser may |
101 * allocate more or fewer based on available resources. How many buffers | 80 * allocate more or fewer based on available resources. How many buffers |
102 * depends on usage. At least 2 to make sure latency doesn't cause lost | 81 * depends on usage. At least 2 to make sure latency doesn't cause lost |
103 * frames. If the plugin expects to hold on to more than one buffer at a time | 82 * frames. If the plugin expects to hold on to more than one buffer at a time |
104 * (e.g. to do multi-frame processing, like video encoding), it should request | 83 * (e.g. to do multi-frame processing, like video encoding), it should request |
105 * that many more. | 84 * that many more. |
106 */ | 85 */ |
107 [version=0.2] | |
108 int32_t Open( | 86 int32_t Open( |
109 [in] PP_Resource video_capture, | 87 [in] PP_Resource video_capture, |
110 [in] PP_Resource device_ref, | 88 [in] PP_Resource device_ref, |
111 [in] PP_VideoCaptureDeviceInfo_Dev requested_info, | 89 [in] PP_VideoCaptureDeviceInfo_Dev requested_info, |
112 [in] uint32_t buffer_count, | 90 [in] uint32_t buffer_count, |
113 [in] PP_CompletionCallback callback); | 91 [in] PP_CompletionCallback callback); |
114 | 92 |
115 /** | 93 /** |
116 * Starts the capture. | 94 * Starts the capture. |
117 * | 95 * |
118 * Returns PP_ERROR_FAILED if called when the capture was already started, or | 96 * Returns PP_ERROR_FAILED if called when the capture was already started, or |
119 * PP_OK on success. | 97 * PP_OK on success. |
120 */ | 98 */ |
121 [version=0.2] | |
122 int32_t StartCapture( | 99 int32_t StartCapture( |
123 [in] PP_Resource video_capture); | 100 [in] PP_Resource video_capture); |
124 | 101 |
125 /** | 102 /** |
126 * Allows the browser to reuse a buffer that was previously sent by | 103 * Allows the browser to reuse a buffer that was previously sent by |
127 * PPP_VideoCapture_Dev.OnBufferReady. |buffer| is the index of the buffer in | 104 * PPP_VideoCapture_Dev.OnBufferReady. |buffer| is the index of the buffer in |
128 * the array returned by PPP_VideoCapture_Dev.OnDeviceInfo. | 105 * the array returned by PPP_VideoCapture_Dev.OnDeviceInfo. |
129 * | 106 * |
130 * Returns PP_ERROR_BADARGUMENT if buffer is out of range (greater than the | 107 * Returns PP_ERROR_BADARGUMENT if buffer is out of range (greater than the |
131 * number of buffers returned by PPP_VideoCapture_Dev.OnDeviceInfo), or if it | 108 * number of buffers returned by PPP_VideoCapture_Dev.OnDeviceInfo), or if it |
(...skipping 11 matching lines...) Expand all Loading... |
143 */ | 120 */ |
144 int32_t StopCapture( | 121 int32_t StopCapture( |
145 [in] PP_Resource video_capture); | 122 [in] PP_Resource video_capture); |
146 | 123 |
147 /** | 124 /** |
148 * Closes the video capture device, and stops capturing if necessary. It is | 125 * Closes the video capture device, and stops capturing if necessary. It is |
149 * not valid to call |Open()| again after a call to this method. | 126 * not valid to call |Open()| again after a call to this method. |
150 * If a video capture resource is destroyed while a device is still open, then | 127 * If a video capture resource is destroyed while a device is still open, then |
151 * it will be implicitly closed, so you are not required to call this method. | 128 * it will be implicitly closed, so you are not required to call this method. |
152 */ | 129 */ |
153 [version=0.2] | |
154 void Close( | 130 void Close( |
155 [in] PP_Resource video_capture); | 131 [in] PP_Resource video_capture); |
156 }; | 132 }; |
OLD | NEW |