1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** USBX Component                                                        */
17 /**                                                                       */
18 /**   Video Class                                                         */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  COMPONENT DEFINITION                                   RELEASE        */
27 /*                                                                        */
28 /*    ux_host_class_video.h                               PORTABLE C      */
29 /*                                                           6.1.8        */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    Chaoqiong Xiao, Microsoft Corporation                               */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file contains all the header and extern functions used by the  */
37 /*    USBX video class.                                                   */
38 /*                                                                        */
39 /*  RELEASE HISTORY                                                       */
40 /*                                                                        */
41 /*    DATE              NAME                      DESCRIPTION             */
42 /*                                                                        */
43 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
44 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
45 /*                                            added new definition, field */
46 /*                                            and functions for video     */
47 /*                                            control handling, used UX   */
48 /*                                            prefix to refer to TX       */
49 /*                                            symbols instead of using    */
50 /*                                            them directly,              */
51 /*                                            resulting in version 6.1    */
52 /*  08-02-2021     Wen Wang                 Modified comment(s),          */
53 /*                                            added extern "C" keyword    */
54 /*                                            for compatibility with C++, */
55 /*                                            added new definitions       */
56 /*                                            according to UVC 1.5 Class  */
57 /*                                            specification,              */
58 /*                                            resulting in version 6.1.8  */
59 /*                                                                        */
60 /**************************************************************************/
61 
62 #ifndef UX_HOST_CLASS_VIDEO_H
63 #define UX_HOST_CLASS_VIDEO_H
64 
65 /* Determine if a C++ compiler is being used.  If so, ensure that standard
66    C is used to process the API information.  */
67 
68 #ifdef   __cplusplus
69 
70 /* Yes, C++ compiler is present.  Use standard C.  */
71 extern   "C" {
72 
73 #endif
74 
75 /* Define external static data.  */
76 extern UCHAR _ux_system_class_video_interface_descriptor_structure[];
77 extern UCHAR _ux_system_class_video_input_terminal_descriptor_structure[];
78 extern UCHAR _ux_system_class_video_input_header_descriptor_structure[];
79 extern UCHAR _ux_system_class_video_processing_unit_descriptor_structure[];
80 extern UCHAR _ux_system_class_video_streaming_interface_descriptor_structure[];
81 extern UCHAR _ux_system_class_video_streaming_endpoint_descriptor_structure[];
82 extern UCHAR _ux_system_class_video_frame_descriptor_structure[];
83 
84 extern UCHAR _ux_system_host_class_video_name[];
85 
86 /* Define Video Class IOCTL constants.  */
87 
88 #define UX_HOST_CLASS_VIDEO_IOCTL_GET_INPUT_TERMINAL                                        0x01
89 #define UX_HOST_CLASS_VIDEO_IOCTL_GET_FORMAT_NUMBER                                         0x02
90 #define UX_HOST_CLASS_VIDEO_IOCTL_GET_FORMAT_DATA                                           0x03
91 #define UX_HOST_CLASS_VIDEO_IOCTL_GET_FRAME_NUMBER                                          0x04
92 #define UX_HOST_CLASS_VIDEO_IOCTL_GET_FRAME_DATA                                            0x05
93 #define UX_HOST_CLASS_VIDEO_IOCTL_CHANNEL_START                                             0x06
94 #define UX_HOST_CLASS_VIDEO_IOCTL_CHANNEL_STOP                                              0x07
95 #define UX_HOST_CLASS_VIDEO_IOCTL_GET_FRAME_INTERVAL                                        0x08
96 
97 #define UX_HOST_CLASS_VIDEO_IOCTL_ABORT_IN_PIPE                                             0x80
98 
99 /* Define Video Class main constants.  */
100 
101 #define UX_HOST_CLASS_VIDEO_CLASS_TRANSFER_TIMEOUT                                          30
102 #define UX_HOST_CLASS_VIDEO_CLASS                                                           0x0e
103 #define UX_HOST_CLASS_VIDEO_SUBCLASS_UNDEFINED                                              0
104 #define UX_HOST_CLASS_VIDEO_SUBCLASS_CONTROL                                                1
105 #define UX_HOST_CLASS_VIDEO_SUBCLASS_STREAMING                                              2
106 #define UX_HOST_CLASS_VIDEO_SUBCLASS_INTERFACE_COLLECTION                                   3
107 
108 
109 /* Define Video Class main descriptor types.  */
110 
111 #define UX_HOST_CLASS_VIDEO_CS_UNDEFINED                                                    0x20
112 #define UX_HOST_CLASS_VIDEO_CS_DEVICE                                                       0x21
113 #define UX_HOST_CLASS_VIDEO_CS_CONFIGURATION                                                0x22
114 #define UX_HOST_CLASS_VIDEO_CS_STRING                                                       0x23
115 #define UX_HOST_CLASS_VIDEO_CS_INTERFACE                                                    0x24
116 #define UX_HOST_CLASS_VIDEO_CS_ENDPOINT                                                     0x25
117 
118 /* Define Video Class specific VC .  */
119 
120 #define UX_HOST_CLASS_VIDEO_VC_DESCRIPTOR_UNDEFINED                                         0x00
121 #define UX_HOST_CLASS_VIDEO_VC_HEADER                                                       0x01
122 #define UX_HOST_CLASS_VIDEO_VC_INPUT_TERMINAL                                               0x02
123 #define UX_HOST_CLASS_VIDEO_VC_OUTPUT_TERMINAL                                              0x03
124 #define UX_HOST_CLASS_VIDEO_VC_SELECTOR_UNIT                                                0x04
125 #define UX_HOST_CLASS_VIDEO_VC_PROCESSING_UNIT                                              0x05
126 #define UX_HOST_CLASS_VIDEO_VC_EXTENSION_UNIT                                               0x06
127 #define UX_HOST_CLASS_VIDEO_VC_ENCODING_UNIT                                                0x07
128 
129 /* Define Video Class specific VS .  */
130 
131 #define UX_HOST_CLASS_VIDEO_VS_UNDEFINED                                                    0x00
132 #define UX_HOST_CLASS_VIDEO_VS_INPUT_HEADER                                                 0x01
133 #define UX_HOST_CLASS_VIDEO_VS_OUTPUT_HEADER                                                0x02
134 #define UX_HOST_CLASS_VIDEO_VS_STILL_IMAGE_FRAME                                            0x03
135 #define UX_HOST_CLASS_VIDEO_VS_FORMAT_UNCOMPRESSED                                          0x04
136 #define UX_HOST_CLASS_VIDEO_VS_FRAME_UNCOMPRESSED                                           0x05
137 #define UX_HOST_CLASS_VIDEO_VS_FORMAT_MJPEG                                                 0x06
138 #define UX_HOST_CLASS_VIDEO_VS_FRAME_MJPEG                                                  0x07
139 #define UX_HOST_CLASS_VIDEO_VS_FORMAT_MPEG2TS                                               0x0A
140 #define UX_HOST_CLASS_VIDEO_VS_FORMAT_DV                                                    0x0C
141 #define UX_HOST_CLASS_VIDEO_VS_COLORFORMAT                                                  0x0D
142 #define UX_HOST_CLASS_VIDEO_VS_FORMAT_FRAME_BASED                                           0x10
143 #define UX_HOST_CLASS_VIDEO_VS_FRAME_FRAME_BASED                                            0x11
144 #define UX_HOST_CLASS_VIDEO_VS_FORMAT_STREAM_BASED                                          0x12
145 #define UX_HOST_CLASS_VIDEO_VS_FORMAT_H264                                                  0x13
146 #define UX_HOST_CLASS_VIDEO_VS_FRAME_H264                                                   0x14
147 #define UX_HOST_CLASS_VIDEO_VS_FORMAT_H264_SIMULCAST                                        0x15
148 #define UX_HOST_CLASS_VIDEO_VS_FORMAT_VP8                                                   0x16
149 #define UX_HOST_CLASS_VIDEO_VS_FRAME_VP8                                                    0x17
150 #define UX_HOST_CLASS_VIDEO_VS_FORMAT_VP8_SIMULCAST                                         0x18
151 
152 
153 /* Define Video Class specific Control Selectors.  */
154 
155 #define UX_HOST_CLASS_VIDEO_CT_CONTROL_UNDEFINED                                            0x00
156 #define UX_HOST_CLASS_VIDEO_CT_SCANNING_MODE_CONTROL                                        0x01
157 #define UX_HOST_CLASS_VIDEO_CT_AE_MODE_CONTROL                                              0x02
158 #define UX_HOST_CLASS_VIDEO_CT_AE_PRIORITY_CONTROL                                          0x03
159 #define UX_HOST_CLASS_VIDEO_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL                               0x04
160 #define UX_HOST_CLASS_VIDEO_CT_EXPOSURE_TIME_RELATIVE_CONTROL                               0x05
161 #define UX_HOST_CLASS_VIDEO_CT_FOCUS_ABSOLUTE_CONTROL                                       0x06
162 #define UX_HOST_CLASS_VIDEO_CT_FOCUS_RELATIVE_CONTROL                                       0x07
163 #define UX_HOST_CLASS_VIDEO_CT_FOCUS_AUTO_CONTROL                                           0x08
164 #define UX_HOST_CLASS_VIDEO_CT_IRIS_ABSOLUTE_CONTROL                                        0x09
165 #define UX_HOST_CLASS_VIDEO_CT_IRIS_RELATIVE_CONTROL                                        0x0A
166 #define UX_HOST_CLASS_VIDEO_CT_ZOOM_ABSOLUTE_CONTROL                                        0x0B
167 #define UX_HOST_CLASS_VIDEO_CT_ZOOM_RELATIVE_CONTROL                                        0x0C
168 #define UX_HOST_CLASS_VIDEO_CT_PANTILT_ABSOLUTE_CONTROL                                     0x0D
169 #define UX_HOST_CLASS_VIDEO_CT_PANTILT_RELATIVE_CONTROL                                     0x0E
170 #define UX_HOST_CLASS_VIDEO_CT_ROLL_ABSOLUTE_CONTROL                                        0x0F
171 #define UX_HOST_CLASS_VIDEO_CT_ROLL_RELATIVE_CONTROL                                        0x10
172 #define UX_HOST_CLASS_VIDEO_CT_PRIVACY_CONTROL                                              0x11
173 #define UX_HOST_CLASS_VIDEO_CT_FOCUS_SIMPLE_CONTROL                                         0x12
174 #define UX_HOST_CLASS_VIDEO_CT_WINDOW_CONTROL                                               0x13
175 #define UX_HOST_CLASS_VIDEO_CT_REGION_OF_INTEREST_CONTROL                                   0x14
176 
177 
178 #define UX_HOST_CLASS_VIDEO_PU_CONTROL_UNDEFINED                                            0x00
179 #define UX_HOST_CLASS_VIDEO_PU_BACKLIGHT_COMPENSATION_CONTROL                               0x01
180 #define UX_HOST_CLASS_VIDEO_PU_BRIGHTNESS_CONTROL                                           0x02
181 #define UX_HOST_CLASS_VIDEO_PU_CONTRAST_CONTROL                                             0x03
182 #define UX_HOST_CLASS_VIDEO_PU_GAIN_CONTROL                                                 0x04
183 #define UX_HOST_CLASS_VIDEO_PU_POWER_LINE_FREQUENCY_CONTROL                                 0x05
184 #define UX_HOST_CLASS_VIDEO_PU_HUE_CONTROL                                                  0x06
185 #define UX_HOST_CLASS_VIDEO_PU_SATURATION_CONTROL                                           0x07
186 #define UX_HOST_CLASS_VIDEO_PU_SHARPNESS_CONTROL                                            0x08
187 #define UX_HOST_CLASS_VIDEO_PU_GAMMA_CONTROL                                                0x09
188 #define UX_HOST_CLASS_VIDEO_PU_WHITE_BALANCE_TEMPERATURE_CONTROL                            0x0A
189 #define UX_HOST_CLASS_VIDEO_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL                       0x0B
190 #define UX_HOST_CLASS_VIDEO_PU_WHITE_BALANCE_COMPONENT_CONTROL                              0x0C
191 #define UX_HOST_CLASS_VIDEO_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL                         0x0D
192 #define UX_HOST_CLASS_VIDEO_PU_DIGITAL_MULTIPLIER_CONTROL                                   0x0E
193 #define UX_HOST_CLASS_VIDEO_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL                             0x0F
194 #define UX_HOST_CLASS_VIDEO_PU_HUE_AUTO_CONTROL                                             0x10
195 #define UX_HOST_CLASS_VIDEO_PU_ANALOG_VIDEO_STANDARD_CONTROL                                0x11
196 #define UX_HOST_CLASS_VIDEO_PU_ANALOG_LOCK_STATUS_CONTROL                                   0x12
197 #define UX_HOST_CLASS_VIDEO_PU_CONTRAST_AUTO_CONTROL                                        0x13
198 
199 
200 #define UX_HOST_CLASS_VIDEO_VS_CONTROL_UNDEFINED                                            0x00
201 #define UX_HOST_CLASS_VIDEO_VS_PROBE_CONTROL                                                0x01
202 #define UX_HOST_CLASS_VIDEO_VS_COMMIT_CONTROL                                               0x02
203 #define UX_HOST_CLASS_VIDEO_VS_STILL_PROBE_CONTROL                                          0x03
204 #define UX_HOST_CLASS_VIDEO_VS_STILL_COMMIT_CONTROL                                         0x04
205 #define UX_HOST_CLASS_VIDEO_VS_STILL_IMAGE_TRIGGER_CONTROL                                  0x05
206 #define UX_HOST_CLASS_VIDEO_VS_STREAM_ERROR_CODE_CONTROL                                    0x06
207 #define UX_HOST_CLASS_VIDEO_VS_GENERATE_KEY_FRAME_CONTROL                                   0x07
208 #define UX_HOST_CLASS_VIDEO_VS_UPDATE_FRAME_SEGMENT_CONTROL                                 0x08
209 #define UX_HOST_CLASS_VIDEO_VS_SYNCH_DELAY_CONTROL                                          0x09
210 
211 
212 /* Define USB Video Class terminal types.  */
213 
214 #define UX_HOST_CLASS_VIDEO_TT_VENDOR_SPECIFIC                                              0x0100
215 #define UX_HOST_CLASS_VIDEO_TT_STREAMING                                                    0x0101
216 
217 #define UX_HOST_CLASS_VIDEO_ITT_VENDOR_SPECIFIC                                             0x0200
218 #define UX_HOST_CLASS_VIDEO_ITT_CAMERA                                                      0x0201
219 #define UX_HOST_CLASS_VIDEO_ITT_MEDIA_TRANSPORT_INPUT                                       0x0202
220 
221 #define UX_HOST_CLASS_VIDEO_OTT_VENDOR_SPECIFIC                                             0x0300
222 #define UX_HOST_CLASS_VIDEO_OTT_CAMERA                                                      0x0301
223 #define UX_HOST_CLASS_VIDEO_OTT_MEDIA_TRANSPORT_INPUT                                       0x0302
224 
225 
226 /* Define USB Video Class Request Error Code Control.  */
227 
228 #define UX_HOST_CLASS_VIDEO_REQUEST_ERROR_CODE_NO_ERROR                                     0x00
229 #define UX_HOST_CLASS_VIDEO_REQUEST_ERROR_CODE_NOT_READY                                    0x01
230 #define UX_HOST_CLASS_VIDEO_REQUEST_ERROR_CODE_WRONG_STATE                                  0x02
231 #define UX_HOST_CLASS_VIDEO_REQUEST_ERROR_CODE_POWER                                        0x03
232 #define UX_HOST_CLASS_VIDEO_REQUEST_ERROR_CODE_OUT_OF_RANGE                                 0x04
233 #define UX_HOST_CLASS_VIDEO_REQUEST_ERROR_CODE_INVALID_INPUT                                0x05
234 #define UX_HOST_CLASS_VIDEO_REQUEST_ERROR_CODE_INVALID_CONTROL                              0x06
235 #define UX_HOST_CLASS_VIDEO_REQUEST_ERROR_CODE_INVALID_REQUEST                              0x07
236 #define UX_HOST_CLASS_VIDEO_REQUEST_ERROR_CODE_INVALID_VALUE_WITHIN_RANGE                   0x08
237 #define UX_HOST_CLASS_VIDEO_REQUEST_ERROR_CODE_UNKNOWN                                      0xFF
238 
239 
240 /* Define Video Class encoding format types.  */
241 
242 #define UX_HOST_CLASS_VIDEO_INTERFACE_DESCRIPTOR_ENTRIES                                    8
243 #define UX_HOST_CLASS_VIDEO_INTERFACE_DESCRIPTOR_LENGTH                                     8
244 
245 #define UX_HOST_CLASS_VIDEO_INPUT_TERMINAL_DESCRIPTOR_ENTRIES                               7
246 #define UX_HOST_CLASS_VIDEO_INPUT_TERMINAL_DESCRIPTOR_LENGTH                                8
247 
248 #define UX_HOST_CLASS_VIDEO_INPUT_HEADER_DESCRIPTOR_ENTRIES                                 12
249 #define UX_HOST_CLASS_VIDEO_INPUT_HEADER_DESCRIPTOR_LENGTH                                  13
250 
251 #define UX_HOST_CLASS_VIDEO_PROCESSING_UNIT_DESCRIPTOR_ENTRIES                              8
252 #define UX_HOST_CLASS_VIDEO_PROCESSING_UNIT_DESCRIPTOR_LENGTH                               9
253 
254 #define UX_HOST_CLASS_VIDEO_STREAMING_INTERFACE_DESCRIPTOR_ENTRIES                          6
255 #define UX_HOST_CLASS_VIDEO_STREAMING_INTERFACE_DESCRIPTOR_LENGTH                           6
256 
257 #define UX_HOST_CLASS_VIDEO_STREAMING_ENDPOINT_DESCRIPTOR_ENTRIES                           6
258 #define UX_HOST_CLASS_VIDEO_STREAMING_ENDPOINT_DESCRIPTOR_LENGTH                            6
259 
260 #define UX_HOST_CLASS_VIDEO_FRAME_DESCRIPTOR_ENTRIES                                        12
261 #define UX_HOST_CLASS_VIDEO_FRAME_DESCRIPTOR_LENGTH                                         30
262 
263 
264 /* Define Video Class specific interface descriptor.  */
265 
266 #define UX_HOST_CLASS_VIDEO_MAX_CHANNEL                                                     8
267 #define UX_HOST_CLASS_VIDEO_NAME_LENGTH                                                     64
268 
269 /* Define Video Class specific request codes.  */
270 
271 #define UX_HOST_CLASS_VIDEO_REQUEST_CODE_UNDEFINED                                          0x00
272 #define UX_HOST_CLASS_VIDEO_SET_CUR                                                         0x01
273 #define UX_HOST_CLASS_VIDEO_GET_CUR                                                         0x81
274 #define UX_HOST_CLASS_VIDEO_GET_MIN                                                         0x82
275 #define UX_HOST_CLASS_VIDEO_GET_MAX                                                         0x83
276 #define UX_HOST_CLASS_VIDEO_GET_RES                                                         0x84
277 #define UX_HOST_CLASS_VIDEO_GET_INFO                                                        0x86
278 #define UX_HOST_CLASS_VIDEO_GET_DEF                                                         0x87
279 #define UX_HOST_CLASS_VIDEO_GET_CUR_ALL                                                     0x91
280 #define UX_HOST_CLASS_VIDEO_GET_MIN_ALL                                                     0x92
281 #define UX_HOST_CLASS_VIDEO_GET_MAX_ALL                                                     0x93
282 #define UX_HOST_CLASS_VIDEO_GET_RES_ALL                                                     0x94
283 #define UX_HOST_CLASS_VIDEO_GET_GET_DEF_ALL                                                 0x97
284 
285 /* Define Video Class error codes.  */
286 
287 #define UX_HOST_CLASS_VIDEO_WRONG_TYPE                                                      0x90
288 #define UX_HOST_CLASS_VIDEO_WRONG_INTERFACE                                                 0x91
289 #define UX_HOST_CLASS_VIDEO_PARAMETER_ERROR                                                 0x92
290 #define UX_HOST_CLASS_VIDEO_DEVICE_NOT_READY                                                0x93
291 
292 /* Define Video Class Terminal Control Selectors.  */
293 #define UX_HOST_CLASS_VIDEO_TCS_VC_CONTROL_UNDEFINED                                        0x00
294 #define UX_HOST_CLASS_VIDEO_TCS_VC_VIDEO_POWER_MODE_CONTROL                                 0x01
295 #define UX_HOST_CLASS_VIDEO_TCS_VC_REQUEST_ERROR_CODE_CONTROL                               0x02
296 
297 #define UX_HOST_CLASS_VIDEO_TCS_TE_CONTROL_UNDEFINED                                        0x00
298 
299 #define UX_HOST_CLASS_VIDEO_TCS_SU_CONTROL_UNDEFINED                                        0x00
300 #define UX_HOST_CLASS_VIDEO_TCS_SU_INPUT_SELECT_CONTROL                                     0x01
301 
302 #define UX_HOST_CLASS_VIDEO_TCS_CT_CONTROL_UNDEFINED                                        0x00
303 #define UX_HOST_CLASS_VIDEO_TCS_CT_SCANNING_MODE_CONTROL                                    0x01
304 #define UX_HOST_CLASS_VIDEO_TCS_CT_AE_MODE_CONTROL                                          0x02
305 #define UX_HOST_CLASS_VIDEO_TCS_CT_AE_PRIORITY_CONTROL                                      0x03
306 #define UX_HOST_CLASS_VIDEO_TCS_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL                           0x04
307 #define UX_HOST_CLASS_VIDEO_TCS_CT_EXPOSURE_TIME_RELATIVE_CONTROL                           0x05
308 #define UX_HOST_CLASS_VIDEO_TCS_CT_FOCUS_ABSOLUTE_CONTROL                                   0x06
309 #define UX_HOST_CLASS_VIDEO_TCS_CT_FOCUS_RELATIVE_CONTROL                                   0x07
310 #define UX_HOST_CLASS_VIDEO_TCS_CT_FOCUS_AUTO_CONTROL                                       0x08
311 #define UX_HOST_CLASS_VIDEO_TCS_CT_IRIS_ABSOLUTE_CONTROL                                    0x09
312 #define UX_HOST_CLASS_VIDEO_TCS_CT_IRIS_RELATIVE_CONTROL                                    0x0A
313 #define UX_HOST_CLASS_VIDEO_TCS_CT_ZOOM_ABSOLUTE_CONTROL                                    0x0B
314 #define UX_HOST_CLASS_VIDEO_TCS_CT_ZOOM_RELATIVE_CONTROL                                    0x0C
315 #define UX_HOST_CLASS_VIDEO_TCS_CT_PANTILT_ABSOLUTE_CONTROL                                 0x0D
316 #define UX_HOST_CLASS_VIDEO_TCS_CT_PANTILT_RELATIVE_CONTROL                                 0x0E
317 #define UX_HOST_CLASS_VIDEO_TCS_CT_ROLL_ABSOLUTE_CONTROL                                    0x0F
318 #define UX_HOST_CLASS_VIDEO_TCS_CT_ROLL_RELATIVE_CONTROL                                    0x10
319 #define UX_HOST_CLASS_VIDEO_TCS_CT_PRIVACY_CONTROL                                          0x11
320 
321 #define UX_HOST_CLASS_VIDEO_TCS_PU_CONTROL_UNDEFINED                                        0x00
322 #define UX_HOST_CLASS_VIDEO_TCS_PU_BACKLIGHT_COMPENSATION_CONTROL                           0x01
323 #define UX_HOST_CLASS_VIDEO_TCS_PU_BRIGHTNESS_CONTROL                                       0x02
324 #define UX_HOST_CLASS_VIDEO_TCS_PU_CONTRAST_CONTROL                                         0x03
325 #define UX_HOST_CLASS_VIDEO_TCS_PU_GAIN_CONTROL                                             0x04
326 #define UX_HOST_CLASS_VIDEO_TCS_PU_POWER_LINE_FREQUENCY_CONTROL                             0x05
327 #define UX_HOST_CLASS_VIDEO_TCS_PU_HUE_CONTROL                                              0x06
328 #define UX_HOST_CLASS_VIDEO_TCS_PU_SATURATION_CONTROL                                       0x07
329 #define UX_HOST_CLASS_VIDEO_TCS_PU_SHARPNESS_CONTROL                                        0x08
330 #define UX_HOST_CLASS_VIDEO_TCS_PU_GAMMA_CONTROL                                            0x09
331 #define UX_HOST_CLASS_VIDEO_TCS_PU_WHITE_BALANCE_TEMPERATURE_CONTROL                        0x0A
332 #define UX_HOST_CLASS_VIDEO_TCS_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL                   0x0B
333 #define UX_HOST_CLASS_VIDEO_TCS_PU_WHITE_BALANCE_COMPONENT_CONTROL                          0x0C
334 
335 #define UX_HOST_CLASS_VIDEO_TCS_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL                     0x0D
336 #define UX_HOST_CLASS_VIDEO_TCS_PU_DIGITAL_MULTIPLIER_CONTROL                               0x0E
337 #define UX_HOST_CLASS_VIDEO_TCS_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL                         0x0F
338 #define UX_HOST_CLASS_VIDEO_TCS_PU_HUE_AUTO_CONTROL                                         0x10
339 #define UX_HOST_CLASS_VIDEO_TCS_PU_ANALOG_VIDEO_STANDARD_CONTROL                            0x11
340 #define UX_HOST_CLASS_VIDEO_TCS_PU_ANALOG_LOCK_STATUS_CONTROL                               0x12
341 #define UX_HOST_CLASS_VIDEO_TCS_PU_CONTRAST_AUTO_CONTROL                                    0x13
342 
343 #define UX_HOST_CLASS_VIDEO_TCS_XU_CONTROL_UNDEFINED                                        0x00
344 
345 #define UX_HOST_CLASS_VIDEO_TCS_VS_CONTROL_UNDEFINED                                        0x00
346 #define UX_HOST_CLASS_VIDEO_TCS_VS_PROBE_CONTROL                                            0x01
347 #define UX_HOST_CLASS_VIDEO_TCS_VS_COMMIT_CONTROL                                           0x02
348 #define UX_HOST_CLASS_VIDEO_TCS_VS_STILL_PROBE_CONTROL                                      0x03
349 #define UX_HOST_CLASS_VIDEO_TCS_VS_STILL_COMMIT_CONTROL                                     0x04
350 #define UX_HOST_CLASS_VIDEO_TCS_VS_STILL_IMAGE_TRIGGER_CONTROL                              0x05
351 #define UX_HOST_CLASS_VIDEO_TCS_VS_STREAM_ERROR_CODE_CONTROL                                0x06
352 #define UX_HOST_CLASS_VIDEO_TCS_VS_GENERATE_KEY_FRAME_CONTROL                               0x07
353 #define UX_HOST_CLASS_VIDEO_TCS_VS_UPDATE_FRAME_SEGMENT_CONTROL                             0x08
354 #define UX_HOST_CLASS_VIDEO_TCS_VS_SYNCH_DELAY_CONTROL                                      0x09
355 
356 /* Define Video Class Probe and Commit Controls */
357 
358 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_LENGTH                                             34
359 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_HINT                                               0
360 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_FORMAT_INDEX                                       2
361 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_FRAME_INDEX                                        3
362 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_FRAME_INTERVAL                                     4
363 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_KEY_FRAME_RATE                                     8
364 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_PFRAME_RAE                                         10
365 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_COMP_QUALITY                                       12
366 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_COMP_WINDOW_SIZE                                   14
367 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_DELAY                                              16
368 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_MAX_VIDEO_FRAME_SIZE                               18
369 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_MAX_PAYLOAD_TRANSFER_SIZE                          22
370 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_CLOCK_FREQUENCY                                    26
371 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_FRAMING_INFO                                       30
372 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_PREFERED_VERSION                                   31
373 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_MIN_VERSION                                        32
374 #define UX_HOST_CLASS_VIDEO_PROBE_COMMIT_MAX_VERSION                                        33
375 
376 #ifndef UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST_COUNT
377 #define UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST_COUNT                                          8
378 #endif
379 
380 typedef struct UX_HOST_CLASS_VIDEO_INTERFACE_HEADER_DESCRIPTOR_STRUCT
381 {
382 
383     ULONG           bLength;
384     ULONG           bDescriptorType;
385     ULONG           bDescriptorSubType;
386     ULONG           bcdUVC;
387     ULONG           wTotalLength;
388     ULONG           dwClockFrequency;
389     ULONG           bInCollection;
390     ULONG           baInterfaceNr;
391 } UX_HOST_CLASS_VIDEO_INTERFACE_HEADER_DESCRIPTOR;
392 
393 /* Define Video Class specific input header interface descriptor.  */
394 
395 typedef struct UX_HOST_CLASS_VIDEO_INPUT_TERMINAL_DESCRIPTOR_STRUCT
396 {
397 
398     ULONG           bLength;
399     ULONG           bDescriptorType;
400     ULONG           bDescriptorSubType;
401     ULONG           bTerminalID;
402     ULONG           wTerminalType;
403     ULONG           bAssocTerminal;
404     ULONG           iTerminal;
405 } UX_HOST_CLASS_VIDEO_INPUT_TERMINAL_DESCRIPTOR;
406 
407 /* Define Video Class specific input header interface descriptor.  */
408 
409 typedef struct UX_HOST_CLASS_VIDEO_INPUT_HEADER_DESCRIPTOR_STRUCT
410 {
411 
412     ULONG           bLength;
413     ULONG           bDescriptorType;
414     ULONG           bDescriptorSubType;
415     ULONG           bNumFormats;
416     ULONG           wTotalLength;
417     ULONG           bEndpointAddress;
418     ULONG           bmInfo;
419     ULONG           bTerminalLink;
420     ULONG           bStillCaptureMethod;
421     ULONG           bTriggerSupport;
422     ULONG           bTriggerUsage;
423     ULONG           bControlSize;
424     ULONG           bmaControls;
425 } UX_HOST_CLASS_VIDEO_INPUT_HEADER_DESCRIPTOR;
426 
427 /* Define Video Class Selector descriptor.  */
428 
429 typedef struct UX_HOST_CLASS_VIDEO_SELECTOR_UNIT_DESCRIPTOR_STRUCT
430 {
431 
432     ULONG           bLength;
433     ULONG           bDescriptorType;
434     ULONG           bDescriptorSubtype;
435     ULONG           bUnitID;
436     ULONG           bNrInPins;
437     ULONG           baSourceID;
438 } UX_HOST_CLASS_VIDEO_SELECTOR_UNIT_DESCRIPTOR;
439 
440 /* Define Video Class Camera Terminal descriptor.  */
441 
442 typedef struct UX_HOST_CLASS_VIDEO_CAMERA_TERMINAL_DESCRIPTOR_STRUCT
443 {
444 
445     ULONG           bLength;
446     ULONG           bDescriptorType;
447     ULONG           bDescriptorSubtype;
448     ULONG           bTerminalID;
449     ULONG           wTerminalType;
450     ULONG           bAssocTerminal;
451     ULONG           iTerminal;
452     ULONG           wObjectiveFocalLengthMin;
453     ULONG           wObjectiveFocalLengthMax;
454     ULONG           wOcularFocalLength;
455     ULONG           bControlSize;
456     ULONG           bmControls;
457 } UX_HOST_CLASS_VIDEO_CAMERA_TERMINAL_DESCRIPTOR;
458 
459 /* Define Video Class Frame descriptor.  */
460 
461 typedef struct UX_HOST_CLASS_VIDEO_FRAME_DESCRIPTOR_STRUCT
462 {
463 
464     ULONG           bLength;
465     ULONG           bDescriptorType;
466     ULONG           bDescriptorSubtype;
467     ULONG           bFrameIndex;
468     ULONG           bmCapabilities;
469     ULONG           wWidth;
470     ULONG           wHeight;
471     ULONG           dwMinBitRate;
472     ULONG           dwMaxBitRate;
473     ULONG           dwMaxVideoFrameBufferSize;
474     ULONG           dwDefaultFrameInterval;
475     ULONG           bFrameIntervalType;
476 } UX_HOST_CLASS_VIDEO_FRAME_DESCRIPTOR;
477 
478 
479 
480 /* Define Video Class Processing Unit descriptor.  */
481 
482 typedef struct UX_HOST_CLASS_VIDEO_PROCESSING_UNIT_DESCRIPTOR_STRUCT
483 {
484 
485     ULONG           bLength;
486     ULONG           bDescriptorType;
487     ULONG           bDescriptorSubtype;
488     ULONG           bUnitID;
489     ULONG           bSourceID;
490     ULONG           wMaxMultiplier;
491     ULONG           bControlSize;
492     ULONG           bmControls;
493     ULONG           iProcessing;
494     ULONG           bmVideoStandards;
495 } UX_HOST_CLASS_VIDEO_PROCESSING_UNIT_DESCRIPTOR;
496 
497 
498 /* Define Video Class instance structure.  */
499 
500 typedef struct UX_HOST_CLASS_VIDEO_STRUCT
501 {
502 
503     struct UX_HOST_CLASS_VIDEO_STRUCT
504                     *ux_host_class_video_next_instance;
505     UX_HOST_CLASS   *ux_host_class_video_class;
506     UX_DEVICE       *ux_host_class_video_device;
507     UX_INTERFACE    *ux_host_class_video_streaming_interface;
508     ULONG           ux_host_class_video_control_interface_number;
509     UX_ENDPOINT     *ux_host_class_video_isochronous_endpoint;
510     UINT            ux_host_class_video_state;
511     ULONG           ux_host_class_video_feature_unit_id;
512     ULONG           ux_host_class_video_terminal_id;
513     ULONG           ux_host_class_video_terminal_type;
514     UCHAR           *ux_host_class_video_configuration_descriptor;
515     ULONG           ux_host_class_video_configuration_descriptor_length;
516     UCHAR           ux_host_class_video_name[UX_HOST_CLASS_VIDEO_NAME_LENGTH];
517     ULONG           ux_host_class_video_number_formats;
518     ULONG           ux_host_class_video_length_formats;
519     UCHAR           *ux_host_class_video_format_address;
520     UCHAR           *ux_host_class_video_current_format_address;
521     ULONG           ux_host_class_video_current_format;
522     ULONG           ux_host_class_video_number_frames;
523     ULONG           ux_host_class_video_current_frame;
524     UCHAR           *ux_host_class_video_current_frame_address;
525     ULONG           ux_host_class_video_current_frame_interval;
526     ULONG           ux_host_class_video_current_max_payload_size;
527     UX_TRANSFER     ux_host_class_video_transfer_requests[UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST_COUNT];
528     ULONG           ux_host_class_video_transfer_request_start_index;
529     ULONG           ux_host_class_video_transfer_request_end_index;
530     UX_SEMAPHORE    ux_host_class_video_semaphore;
531     UX_SEMAPHORE    ux_host_class_video_semaphore_control_request;
532     VOID            (*ux_host_class_video_transfer_completion_function)(UX_TRANSFER*);
533 
534 } UX_HOST_CLASS_VIDEO;
535 
536 
537 /* Define Video Class isochronous USB transfer request structure.  */
538 
539 typedef struct UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST_STRUCT
540 {
541 
542     ULONG           ux_host_class_video_transfer_request_status;
543     UCHAR *         ux_host_class_video_transfer_request_data_pointer;
544     ULONG           ux_host_class_video_transfer_request_requested_length;
545     ULONG           ux_host_class_video_transfer_request_actual_length;
546     VOID            (*ux_host_class_video_transfer_request_completion_function) (struct UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST_STRUCT *);
547     UX_SEMAPHORE    ux_host_class_video_transfer_request_semaphore;
548     VOID            *ux_host_class_video_transfer_request_class_instance;
549     UINT            ux_host_class_video_transfer_request_completion_code;
550     struct UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST_STRUCT
551                     *ux_host_class_video_transfer_request_next_video_transfer_request;
552     UX_TRANSFER     ux_host_class_video_transfer_request;
553 } UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST;
554 
555 
556 /* Define Video Class channel/value control structures.  */
557 
558 typedef struct UX_HOST_CLASS_VIDEO_CONTROL_STRUCT
559 {
560 
561     ULONG          ux_host_class_video_control;
562     LONG           ux_host_class_video_control_min;
563     LONG           ux_host_class_video_control_max;
564     LONG           ux_host_class_video_control_res;
565     LONG           ux_host_class_video_control_cur;
566 } UX_HOST_CLASS_VIDEO_CONTROL;
567 
568 /* Define Video Class input terminal structures.  */
569 
570 typedef struct UX_HOST_CLASS_VIDEO_PARAMETER_INPUT_TERMINAL_STRUCT
571 {
572 
573     ULONG           ux_host_class_video_parameter_input_terminal_id;
574     ULONG           ux_host_class_video_parameter_input_terminal_type;
575 
576 } UX_HOST_CLASS_VIDEO_PARAMETER_INPUT_TERMINAL;
577 
578 /* Define Video Class format number structure.  */
579 
580 typedef struct UX_HOST_CLASS_VIDEO_PARAMETER_NUMBER_FORMATS_STRUCT
581 {
582 
583     ULONG           ux_host_class_video_parameter_number_formats;
584 
585 } UX_HOST_CLASS_VIDEO_PARAMETER_NUMBER_FORMATS;
586 
587 /* Define Video Class format data structure.  */
588 
589 typedef struct UX_HOST_CLASS_VIDEO_PARAMETER_FORMAT_DATA_STRUCT
590 {
591 
592     ULONG           ux_host_class_video_parameter_format_requested;
593     ULONG           ux_host_class_video_parameter_format_subtype;
594     ULONG           ux_host_class_video_parameter_number_frame_descriptors;
595 
596 } UX_HOST_CLASS_VIDEO_PARAMETER_FORMAT_DATA;
597 
598 typedef struct UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_DATA_STRUCT
599 {
600 
601     ULONG           ux_host_class_video_parameter_frame_requested;
602     ULONG           ux_host_class_video_parameter_frame_subtype;
603     ULONG           ux_host_class_video_parameter_frame_width;
604     ULONG           ux_host_class_video_parameter_frame_height;
605     ULONG           ux_host_class_video_parameter_default_frame_interval;
606     ULONG           ux_host_class_video_parameter_frame_interval_type;
607 
608 } UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_DATA;
609 
610 
611 typedef struct UX_HOST_CLASS_VIDEO_PARAMETER_CHANNEL_STRUCT
612 {
613 
614     ULONG           ux_host_class_video_parameter_channel_bandwidth_selection;
615     ULONG           ux_host_class_video_parameter_format_requested;
616     ULONG           ux_host_class_video_parameter_frame_requested;
617     ULONG           ux_host_class_video_parameter_frame_interval_requested;
618 
619 } UX_HOST_CLASS_VIDEO_PARAMETER_CHANNEL;
620 
621 typedef struct UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_INTERVAL_STRUCT
622 {
623 
624     ULONG           ux_host_class_video_parameter_frame_requested;
625     ULONG          *ux_host_class_video_parameter_frame_interval_buffer;
626     ULONG           ux_host_class_video_parameter_frame_interval_buffer_length;
627     ULONG           ux_host_class_video_parameter_frame_interval_buffer_length_written;
628 
629 } UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_INTERVAL;
630 
631 /* Define Video Class function prototypes.  */
632 
633 UINT    _ux_host_class_video_activate(UX_HOST_CLASS_COMMAND *command);
634 UINT    _ux_host_class_video_configure(UX_HOST_CLASS_VIDEO *video);
635 UINT    _ux_host_class_video_control_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control);
636 UINT    _ux_host_class_video_control_value_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control);
637 UINT    _ux_host_class_video_control_value_set(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control);
638 UINT    _ux_host_class_video_deactivate(UX_HOST_CLASS_COMMAND *command);
639 UINT    _ux_host_class_video_descriptor_get(UX_HOST_CLASS_VIDEO *video);
640 UINT    _ux_host_class_video_endpoints_get(UX_HOST_CLASS_VIDEO *video);
641 UINT    _ux_host_class_video_entry(UX_HOST_CLASS_COMMAND *command);
642 UINT    _ux_host_class_video_read(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST *video_transfer_request);
643 UINT    _ux_host_class_video_transfer_request(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST *video_transfer_request);
644 VOID    _ux_host_class_video_transfer_request_completed(UX_TRANSFER *transfer_request);
645 VOID    _ux_host_class_video_transfer_request_callback(UX_TRANSFER *transfer_request);
646 UINT    _ux_host_class_video_control_list_get(UX_HOST_CLASS_VIDEO *video);
647 UINT    _ux_host_class_video_input_format_get(UX_HOST_CLASS_VIDEO *video);
648 UINT    _ux_host_class_video_input_terminal_get(UX_HOST_CLASS_VIDEO *video);
649 UINT    _ux_host_class_video_alternate_setting_locate(UX_HOST_CLASS_VIDEO *video, UINT max_payload_size, UINT *alternate_setting);
650 UINT    _ux_host_class_video_ioctl(UX_HOST_CLASS_VIDEO *video, ULONG ioctl_function, VOID *parameter);
651 UINT    _ux_host_class_video_format_data_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_PARAMETER_FORMAT_DATA *format_parameter);
652 UINT    _ux_host_class_video_frame_data_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_DATA *frame_parameter);
653 UINT    _ux_host_class_video_frame_interval_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_INTERVAL *interval_parameter);
654 UINT    _ux_host_class_video_channel_start(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_PARAMETER_CHANNEL *video_parameter);
655 UINT    _ux_host_class_video_stop(UX_HOST_CLASS_VIDEO *video);
656 UINT    _ux_host_class_video_start(UX_HOST_CLASS_VIDEO *video);
657 UINT    _ux_host_class_video_frame_parameters_set(UX_HOST_CLASS_VIDEO *video, ULONG frame_format, ULONG width, ULONG height, ULONG frame_interval);
658 ULONG   _ux_host_class_video_max_payload_get(UX_HOST_CLASS_VIDEO *video);
659 UINT    _ux_host_class_video_transfer_buffer_add(UX_HOST_CLASS_VIDEO *video, UCHAR* buffer);
660 UINT    _ux_host_class_video_transfer_buffers_add(UX_HOST_CLASS_VIDEO *video, UCHAR** buffers, ULONG num_buffers);
661 VOID    _ux_host_class_video_transfer_callback_set(UX_HOST_CLASS_VIDEO *video, VOID (*callback_function)(UX_TRANSFER*));
662 UINT    _ux_host_class_video_entities_parse(UX_HOST_CLASS_VIDEO *video,
663                         UINT(*parse_function)(VOID  *arg,
664                                             UCHAR *packed_interface_descriptor,
665                                             UCHAR *packed_entity_descriptor),
666                         VOID* arg);
667 UINT    _ux_host_class_video_control_request(UX_HOST_CLASS_VIDEO *video,
668                         UINT request, UCHAR interface_index,
669                         UINT entity_id, UINT control_selector,
670                         UCHAR *parameter, UINT parameter_size);
671 
672 /* Define Video Class API prototypes.  */
673 
674 #define ux_host_class_video_entry                   _ux_host_class_video_entry
675 #define ux_host_class_video_control_get             _ux_host_class_video_control_get
676 #define ux_host_class_video_control_value_get       _ux_host_class_video_control_value_get
677 #define ux_host_class_video_control_value_set       _ux_host_class_video_control_value_set
678 #define ux_host_class_video_read                    _ux_host_class_video_read
679 #define ux_host_class_video_ioctl                   _ux_host_class_video_ioctl
680 #define ux_host_class_video_start                   _ux_host_class_video_start
681 #define ux_host_class_video_stop                    _ux_host_class_video_stop
682 #define ux_host_class_video_frame_parameters_set    _ux_host_class_video_frame_parameters_set
683 #define ux_host_class_video_max_payload_get         _ux_host_class_video_max_payload_get
684 #define ux_host_class_video_transfer_buffer_add     _ux_host_class_video_transfer_buffer_add
685 #define ux_host_class_video_transfer_buffers_add    _ux_host_class_video_transfer_buffers_add
686 #define ux_host_class_video_transfer_callback_set   _ux_host_class_video_transfer_callback_set
687 #define ux_host_class_video_entities_parse          _ux_host_class_video_entities_parse
688 #define ux_host_class_video_control_request         _ux_host_class_video_control_request
689 
690 /* Determine if a C++ compiler is being used.  If so, complete the standard
691    C conditional started above.  */
692 #ifdef __cplusplus
693 }
694 #endif
695 
696 #endif
697 
698 
699