Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: ppapi/c/dev/ppb_video_capture_dev.h

Issue 9234064: Implement device enumeration for PPB_VideoCapture_Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes in response to Antoine's comments. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 /* From dev/ppb_video_capture_dev.idl modified Tue Oct 11 10:01:39 2011. */ 6 /* From dev/ppb_video_capture_dev.idl modified Thu Jan 26 11:39:48 2012. */
7 7
8 #ifndef PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_ 8 #ifndef PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_
9 #define PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_ 9 #define PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_
10 10
11 #include "ppapi/c/dev/pp_video_capture_dev.h" 11 #include "ppapi/c/dev/pp_video_capture_dev.h"
12 #include "ppapi/c/pp_bool.h" 12 #include "ppapi/c/pp_bool.h"
13 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_instance.h" 14 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_macros.h" 15 #include "ppapi/c/pp_macros.h"
15 #include "ppapi/c/pp_resource.h" 16 #include "ppapi/c/pp_resource.h"
16 #include "ppapi/c/pp_stdint.h" 17 #include "ppapi/c/pp_stdint.h"
17 18
18 #define PPB_VIDEOCAPTURE_DEV_INTERFACE_0_1 "PPB_VideoCapture(Dev);0.1" 19 #define PPB_VIDEOCAPTURE_DEV_INTERFACE_0_1 "PPB_VideoCapture(Dev);0.1"
19 #define PPB_VIDEOCAPTURE_DEV_INTERFACE PPB_VIDEOCAPTURE_DEV_INTERFACE_0_1 20 #define PPB_VIDEOCAPTURE_DEV_INTERFACE_0_2 "PPB_VideoCapture(Dev);0.2"
21 #define PPB_VIDEOCAPTURE_DEV_INTERFACE PPB_VIDEOCAPTURE_DEV_INTERFACE_0_2
20 22
21 /** 23 /**
22 * @file 24 * @file
23 * This file defines the <code>PPB_VideoCapture_Dev</code> interface. 25 * This file defines the <code>PPB_VideoCapture_Dev</code> interface.
24 */ 26 */
25 27
26 28
27 /** 29 /**
28 * @addtogroup Interfaces 30 * @addtogroup Interfaces
29 * @{ 31 * @{
(...skipping 16 matching lines...) Expand all
46 * 5- When the plugin is done with the buffer, call ReuseBuffer 48 * 5- When the plugin is done with the buffer, call ReuseBuffer
47 * 6- Stop the capture using StopCapture. 49 * 6- Stop the capture using StopCapture.
48 * 50 *
49 * The browser may change the resolution based on the constraints of the system, 51 * The browser may change the resolution based on the constraints of the system,
50 * in which case OnDeviceInfo will be called again, with new buffers. 52 * in which case OnDeviceInfo will be called again, with new buffers.
51 * 53 *
52 * The buffers contain the pixel data for a frame. The format is planar YUV 54 * The buffers contain the pixel data for a frame. The format is planar YUV
53 * 4:2:0, one byte per pixel, tightly packed (width x height Y values, then 55 * 4:2:0, one byte per pixel, tightly packed (width x height Y values, then
54 * width/2 x height/2 U values, then width/2 x height/2 V values). 56 * width/2 x height/2 U values, then width/2 x height/2 V values).
55 */ 57 */
56 struct PPB_VideoCapture_Dev_0_1 { 58 struct PPB_VideoCapture_Dev_0_2 {
57 /** 59 /**
58 * Creates a new VideoCapture. 60 * Creates a new VideoCapture.
59 */ 61 */
60 PP_Resource (*Create)(PP_Instance instance); 62 PP_Resource (*Create)(PP_Instance instance);
61 /** 63 /**
62 * Returns PP_TRUE if the given resource is a VideoCapture. 64 * Returns PP_TRUE if the given resource is a VideoCapture.
63 */ 65 */
64 PP_Bool (*IsVideoCapture)(PP_Resource video_capture); 66 PP_Bool (*IsVideoCapture)(PP_Resource video_capture);
65 /** 67 /**
66 * Starts the capture. |requested_info| is a pointer to a structure containing 68 * Enumerates video capture devices. Once the operation is completed
67 * the requested resolution and frame rate. |buffer_count| is the number of 69 * successfully. |GetDevices()| can be used to retrieve the devices.
68 * buffers requested by the plugin. Note: it is only used as advisory, the 70 */
69 * browser may allocate more of fewer based on available resources. 71 int32_t (*EnumerateDevices)(PP_Resource video_capture,
70 * How many buffers depends on usage. At least 2 to make sure latency doesn't 72 struct PP_CompletionCallback callback);
71 * cause lost frames. If the plugin expects to hold on to more than one buffer 73 /**
72 * at a time (e.g. to do multi-frame processing, like video encoding), it 74 * Gets video capture devices. The returned value is a PPB_ResourceArray_Dev
73 * should request that many more. 75 * resource if successful, which holds a list of PPB_DeviceRef_Dev resources.
76 */
77 PP_Resource (*GetDevices)(PP_Resource video_capture);
78 /**
79 * Starts the capture. |device_ref| identifies a video capture device. It
80 * could be one of the resource in the array returned by |GetDevices()|, or 0
81 * which means the default device.
82 * |requested_info| is a pointer to a structure containing the requested
83 * resolution and frame rate. |buffer_count| is the number of buffers
84 * requested by the plugin. Note: it is only used as advisory, the browser may
85 * allocate more or fewer based on available resources. How many buffers
86 * depends on usage. At least 2 to make sure latency doesn't cause lost
87 * frames. If the plugin expects to hold on to more than one buffer at a time
88 * (e.g. to do multi-frame processing, like video encoding), it should request
89 * that many more.
74 * 90 *
75 * Returns PP_ERROR_FAILED if called when the capture was already started, or 91 * Returns PP_ERROR_FAILED if called when the capture was already started, or
76 * PP_OK on success. 92 * PP_OK on success.
77 */ 93 */
78 int32_t (*StartCapture)( 94 int32_t (*StartCapture)(
79 PP_Resource video_capture, 95 PP_Resource video_capture,
96 PP_Resource device_ref,
80 const struct PP_VideoCaptureDeviceInfo_Dev* requested_info, 97 const struct PP_VideoCaptureDeviceInfo_Dev* requested_info,
81 uint32_t buffer_count); 98 uint32_t buffer_count);
82 /** 99 /**
83 * Allows the browser to reuse a buffer that was previously sent by 100 * Allows the browser to reuse a buffer that was previously sent by
84 * PPP_VideoCapture_Dev.OnBufferReady. |buffer| is the index of the buffer in 101 * PPP_VideoCapture_Dev.OnBufferReady. |buffer| is the index of the buffer in
85 * the array returned by PPP_VideoCapture_Dev.OnDeviceInfo. 102 * the array returned by PPP_VideoCapture_Dev.OnDeviceInfo.
86 * 103 *
87 * Returns PP_ERROR_BADARGUMENT if buffer is out of range (greater than the 104 * Returns PP_ERROR_BADARGUMENT if buffer is out of range (greater than the
88 * number of buffers returned by PPP_VideoCapture_Dev.OnDeviceInfo), or if it 105 * number of buffers returned by PPP_VideoCapture_Dev.OnDeviceInfo), or if it
89 * is not currently owned by the plugin. Returns PP_OK otherwise. 106 * is not currently owned by the plugin. Returns PP_OK otherwise.
90 */ 107 */
91 int32_t (*ReuseBuffer)(PP_Resource video_capture, uint32_t buffer); 108 int32_t (*ReuseBuffer)(PP_Resource video_capture, uint32_t buffer);
92 /** 109 /**
93 * Stops the capture. 110 * Stops the capture.
94 * 111 *
95 * Returns PP_ERROR_FAILED if the capture wasn't already started, or PP_OK on 112 * Returns PP_ERROR_FAILED if the capture wasn't already started, or PP_OK on
96 * success. 113 * success.
97 */ 114 */
98 int32_t (*StopCapture)(PP_Resource video_capture); 115 int32_t (*StopCapture)(PP_Resource video_capture);
99 }; 116 };
100 117
101 typedef struct PPB_VideoCapture_Dev_0_1 PPB_VideoCapture_Dev; 118 typedef struct PPB_VideoCapture_Dev_0_2 PPB_VideoCapture_Dev;
119
120 struct PPB_VideoCapture_Dev_0_1 {
121 PP_Resource (*Create)(PP_Instance instance);
122 PP_Bool (*IsVideoCapture)(PP_Resource video_capture);
123 int32_t (*StartCapture)(
124 PP_Resource video_capture,
125 const struct PP_VideoCaptureDeviceInfo_Dev* requested_info,
126 uint32_t buffer_count);
127 int32_t (*ReuseBuffer)(PP_Resource video_capture, uint32_t buffer);
128 int32_t (*StopCapture)(PP_Resource video_capture);
129 };
102 /** 130 /**
103 * @} 131 * @}
104 */ 132 */
105 133
106 #endif /* PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_ */ 134 #endif /* PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_ */
107 135
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698