Laurent Pinchart | de05f63 | 2009-06-26 12:15:38 -0300 | [diff] [blame] | 1 | /* |
| 2 | * USB Video Class definitions. |
| 3 | * |
| 4 | * Copyright (C) 2009 Laurent Pinchart <laurent.pinchart@skynet.be> |
| 5 | * |
| 6 | * This file holds USB constants and structures defined by the USB Device |
| 7 | * Class Definition for Video Devices. Unless otherwise stated, comments |
| 8 | * below reference relevant sections of the USB Video Class 1.1 specification |
| 9 | * available at |
| 10 | * |
| 11 | * http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1.zip |
| 12 | */ |
| 13 | |
| 14 | #ifndef __LINUX_USB_VIDEO_H |
| 15 | #define __LINUX_USB_VIDEO_H |
| 16 | |
| 17 | #include <linux/types.h> |
| 18 | |
| 19 | /* -------------------------------------------------------------------------- |
| 20 | * UVC constants |
| 21 | */ |
| 22 | |
| 23 | /* A.2. Video Interface Subclass Codes */ |
| 24 | #define UVC_SC_UNDEFINED 0x00 |
| 25 | #define UVC_SC_VIDEOCONTROL 0x01 |
| 26 | #define UVC_SC_VIDEOSTREAMING 0x02 |
| 27 | #define UVC_SC_VIDEO_INTERFACE_COLLECTION 0x03 |
| 28 | |
| 29 | /* A.3. Video Interface Protocol Codes */ |
| 30 | #define UVC_PC_PROTOCOL_UNDEFINED 0x00 |
| 31 | |
| 32 | /* A.5. Video Class-Specific VC Interface Descriptor Subtypes */ |
| 33 | #define UVC_VC_DESCRIPTOR_UNDEFINED 0x00 |
| 34 | #define UVC_VC_HEADER 0x01 |
| 35 | #define UVC_VC_INPUT_TERMINAL 0x02 |
| 36 | #define UVC_VC_OUTPUT_TERMINAL 0x03 |
| 37 | #define UVC_VC_SELECTOR_UNIT 0x04 |
| 38 | #define UVC_VC_PROCESSING_UNIT 0x05 |
| 39 | #define UVC_VC_EXTENSION_UNIT 0x06 |
| 40 | |
| 41 | /* A.6. Video Class-Specific VS Interface Descriptor Subtypes */ |
| 42 | #define UVC_VS_UNDEFINED 0x00 |
| 43 | #define UVC_VS_INPUT_HEADER 0x01 |
| 44 | #define UVC_VS_OUTPUT_HEADER 0x02 |
| 45 | #define UVC_VS_STILL_IMAGE_FRAME 0x03 |
| 46 | #define UVC_VS_FORMAT_UNCOMPRESSED 0x04 |
| 47 | #define UVC_VS_FRAME_UNCOMPRESSED 0x05 |
| 48 | #define UVC_VS_FORMAT_MJPEG 0x06 |
| 49 | #define UVC_VS_FRAME_MJPEG 0x07 |
| 50 | #define UVC_VS_FORMAT_MPEG2TS 0x0a |
| 51 | #define UVC_VS_FORMAT_DV 0x0c |
| 52 | #define UVC_VS_COLORFORMAT 0x0d |
| 53 | #define UVC_VS_FORMAT_FRAME_BASED 0x10 |
| 54 | #define UVC_VS_FRAME_FRAME_BASED 0x11 |
| 55 | #define UVC_VS_FORMAT_STREAM_BASED 0x12 |
| 56 | |
| 57 | /* A.7. Video Class-Specific Endpoint Descriptor Subtypes */ |
| 58 | #define UVC_EP_UNDEFINED 0x00 |
| 59 | #define UVC_EP_GENERAL 0x01 |
| 60 | #define UVC_EP_ENDPOINT 0x02 |
| 61 | #define UVC_EP_INTERRUPT 0x03 |
| 62 | |
| 63 | /* A.8. Video Class-Specific Request Codes */ |
| 64 | #define UVC_RC_UNDEFINED 0x00 |
| 65 | #define UVC_SET_CUR 0x01 |
| 66 | #define UVC_GET_CUR 0x81 |
| 67 | #define UVC_GET_MIN 0x82 |
| 68 | #define UVC_GET_MAX 0x83 |
| 69 | #define UVC_GET_RES 0x84 |
| 70 | #define UVC_GET_LEN 0x85 |
| 71 | #define UVC_GET_INFO 0x86 |
| 72 | #define UVC_GET_DEF 0x87 |
| 73 | |
| 74 | /* A.9.1. VideoControl Interface Control Selectors */ |
| 75 | #define UVC_VC_CONTROL_UNDEFINED 0x00 |
| 76 | #define UVC_VC_VIDEO_POWER_MODE_CONTROL 0x01 |
| 77 | #define UVC_VC_REQUEST_ERROR_CODE_CONTROL 0x02 |
| 78 | |
| 79 | /* A.9.2. Terminal Control Selectors */ |
| 80 | #define UVC_TE_CONTROL_UNDEFINED 0x00 |
| 81 | |
| 82 | /* A.9.3. Selector Unit Control Selectors */ |
| 83 | #define UVC_SU_CONTROL_UNDEFINED 0x00 |
| 84 | #define UVC_SU_INPUT_SELECT_CONTROL 0x01 |
| 85 | |
| 86 | /* A.9.4. Camera Terminal Control Selectors */ |
| 87 | #define UVC_CT_CONTROL_UNDEFINED 0x00 |
| 88 | #define UVC_CT_SCANNING_MODE_CONTROL 0x01 |
| 89 | #define UVC_CT_AE_MODE_CONTROL 0x02 |
| 90 | #define UVC_CT_AE_PRIORITY_CONTROL 0x03 |
| 91 | #define UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x04 |
| 92 | #define UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x05 |
| 93 | #define UVC_CT_FOCUS_ABSOLUTE_CONTROL 0x06 |
| 94 | #define UVC_CT_FOCUS_RELATIVE_CONTROL 0x07 |
| 95 | #define UVC_CT_FOCUS_AUTO_CONTROL 0x08 |
| 96 | #define UVC_CT_IRIS_ABSOLUTE_CONTROL 0x09 |
| 97 | #define UVC_CT_IRIS_RELATIVE_CONTROL 0x0a |
| 98 | #define UVC_CT_ZOOM_ABSOLUTE_CONTROL 0x0b |
| 99 | #define UVC_CT_ZOOM_RELATIVE_CONTROL 0x0c |
| 100 | #define UVC_CT_PANTILT_ABSOLUTE_CONTROL 0x0d |
| 101 | #define UVC_CT_PANTILT_RELATIVE_CONTROL 0x0e |
| 102 | #define UVC_CT_ROLL_ABSOLUTE_CONTROL 0x0f |
| 103 | #define UVC_CT_ROLL_RELATIVE_CONTROL 0x10 |
| 104 | #define UVC_CT_PRIVACY_CONTROL 0x11 |
| 105 | |
| 106 | /* A.9.5. Processing Unit Control Selectors */ |
| 107 | #define UVC_PU_CONTROL_UNDEFINED 0x00 |
| 108 | #define UVC_PU_BACKLIGHT_COMPENSATION_CONTROL 0x01 |
| 109 | #define UVC_PU_BRIGHTNESS_CONTROL 0x02 |
| 110 | #define UVC_PU_CONTRAST_CONTROL 0x03 |
| 111 | #define UVC_PU_GAIN_CONTROL 0x04 |
| 112 | #define UVC_PU_POWER_LINE_FREQUENCY_CONTROL 0x05 |
| 113 | #define UVC_PU_HUE_CONTROL 0x06 |
| 114 | #define UVC_PU_SATURATION_CONTROL 0x07 |
| 115 | #define UVC_PU_SHARPNESS_CONTROL 0x08 |
| 116 | #define UVC_PU_GAMMA_CONTROL 0x09 |
| 117 | #define UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x0a |
| 118 | #define UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x0b |
| 119 | #define UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x0c |
| 120 | #define UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0d |
| 121 | #define UVC_PU_DIGITAL_MULTIPLIER_CONTROL 0x0e |
| 122 | #define UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x0f |
| 123 | #define UVC_PU_HUE_AUTO_CONTROL 0x10 |
| 124 | #define UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11 |
| 125 | #define UVC_PU_ANALOG_LOCK_STATUS_CONTROL 0x12 |
| 126 | |
| 127 | /* A.9.7. VideoStreaming Interface Control Selectors */ |
| 128 | #define UVC_VS_CONTROL_UNDEFINED 0x00 |
| 129 | #define UVC_VS_PROBE_CONTROL 0x01 |
| 130 | #define UVC_VS_COMMIT_CONTROL 0x02 |
| 131 | #define UVC_VS_STILL_PROBE_CONTROL 0x03 |
| 132 | #define UVC_VS_STILL_COMMIT_CONTROL 0x04 |
| 133 | #define UVC_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05 |
| 134 | #define UVC_VS_STREAM_ERROR_CODE_CONTROL 0x06 |
| 135 | #define UVC_VS_GENERATE_KEY_FRAME_CONTROL 0x07 |
| 136 | #define UVC_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08 |
| 137 | #define UVC_VS_SYNC_DELAY_CONTROL 0x09 |
| 138 | |
| 139 | /* B.1. USB Terminal Types */ |
| 140 | #define UVC_TT_VENDOR_SPECIFIC 0x0100 |
| 141 | #define UVC_TT_STREAMING 0x0101 |
| 142 | |
| 143 | /* B.2. Input Terminal Types */ |
| 144 | #define UVC_ITT_VENDOR_SPECIFIC 0x0200 |
| 145 | #define UVC_ITT_CAMERA 0x0201 |
| 146 | #define UVC_ITT_MEDIA_TRANSPORT_INPUT 0x0202 |
| 147 | |
| 148 | /* B.3. Output Terminal Types */ |
| 149 | #define UVC_OTT_VENDOR_SPECIFIC 0x0300 |
| 150 | #define UVC_OTT_DISPLAY 0x0301 |
| 151 | #define UVC_OTT_MEDIA_TRANSPORT_OUTPUT 0x0302 |
| 152 | |
| 153 | /* B.4. External Terminal Types */ |
| 154 | #define UVC_EXTERNAL_VENDOR_SPECIFIC 0x0400 |
| 155 | #define UVC_COMPOSITE_CONNECTOR 0x0401 |
| 156 | #define UVC_SVIDEO_CONNECTOR 0x0402 |
| 157 | #define UVC_COMPONENT_CONNECTOR 0x0403 |
| 158 | |
| 159 | /* 2.4.2.2. Status Packet Type */ |
| 160 | #define UVC_STATUS_TYPE_CONTROL 1 |
| 161 | #define UVC_STATUS_TYPE_STREAMING 2 |
| 162 | |
Laurent Pinchart | bbafc0c | 2010-07-10 15:03:20 -0300 | [diff] [blame] | 163 | /* 2.4.3.3. Payload Header Information */ |
| 164 | #define UVC_STREAM_EOH (1 << 7) |
| 165 | #define UVC_STREAM_ERR (1 << 6) |
| 166 | #define UVC_STREAM_STI (1 << 5) |
| 167 | #define UVC_STREAM_RES (1 << 4) |
| 168 | #define UVC_STREAM_SCR (1 << 3) |
| 169 | #define UVC_STREAM_PTS (1 << 2) |
| 170 | #define UVC_STREAM_EOF (1 << 1) |
| 171 | #define UVC_STREAM_FID (1 << 0) |
| 172 | |
Laurent Pinchart | 1b4e21c | 2010-06-17 11:11:51 -0300 | [diff] [blame] | 173 | /* 4.1.2. Control Capabilities */ |
| 174 | #define UVC_CONTROL_CAP_GET (1 << 0) |
| 175 | #define UVC_CONTROL_CAP_SET (1 << 1) |
| 176 | #define UVC_CONTROL_CAP_DISABLED (1 << 2) |
| 177 | #define UVC_CONTROL_CAP_AUTOUPDATE (1 << 3) |
| 178 | #define UVC_CONTROL_CAP_ASYNCHRONOUS (1 << 4) |
| 179 | |
Laurent Pinchart | bbafc0c | 2010-07-10 15:03:20 -0300 | [diff] [blame] | 180 | /* ------------------------------------------------------------------------ |
| 181 | * UVC structures |
| 182 | */ |
| 183 | |
| 184 | /* All UVC descriptors have these 3 fields at the beginning */ |
| 185 | struct uvc_descriptor_header { |
| 186 | __u8 bLength; |
| 187 | __u8 bDescriptorType; |
| 188 | __u8 bDescriptorSubType; |
| 189 | } __attribute__((packed)); |
| 190 | |
| 191 | /* 3.7.2. Video Control Interface Header Descriptor */ |
| 192 | struct uvc_header_descriptor { |
| 193 | __u8 bLength; |
| 194 | __u8 bDescriptorType; |
| 195 | __u8 bDescriptorSubType; |
| 196 | __u16 bcdUVC; |
| 197 | __u16 wTotalLength; |
| 198 | __u32 dwClockFrequency; |
| 199 | __u8 bInCollection; |
| 200 | __u8 baInterfaceNr[]; |
| 201 | } __attribute__((__packed__)); |
| 202 | |
| 203 | #define UVC_DT_HEADER_SIZE(n) (12+(n)) |
| 204 | |
| 205 | #define UVC_HEADER_DESCRIPTOR(n) \ |
| 206 | uvc_header_descriptor_##n |
| 207 | |
| 208 | #define DECLARE_UVC_HEADER_DESCRIPTOR(n) \ |
| 209 | struct UVC_HEADER_DESCRIPTOR(n) { \ |
| 210 | __u8 bLength; \ |
| 211 | __u8 bDescriptorType; \ |
| 212 | __u8 bDescriptorSubType; \ |
| 213 | __u16 bcdUVC; \ |
| 214 | __u16 wTotalLength; \ |
| 215 | __u32 dwClockFrequency; \ |
| 216 | __u8 bInCollection; \ |
| 217 | __u8 baInterfaceNr[n]; \ |
| 218 | } __attribute__ ((packed)) |
| 219 | |
| 220 | /* 3.7.2.1. Input Terminal Descriptor */ |
| 221 | struct uvc_input_terminal_descriptor { |
| 222 | __u8 bLength; |
| 223 | __u8 bDescriptorType; |
| 224 | __u8 bDescriptorSubType; |
| 225 | __u8 bTerminalID; |
| 226 | __u16 wTerminalType; |
| 227 | __u8 bAssocTerminal; |
| 228 | __u8 iTerminal; |
| 229 | } __attribute__((__packed__)); |
| 230 | |
| 231 | #define UVC_DT_INPUT_TERMINAL_SIZE 8 |
| 232 | |
| 233 | /* 3.7.2.2. Output Terminal Descriptor */ |
| 234 | struct uvc_output_terminal_descriptor { |
| 235 | __u8 bLength; |
| 236 | __u8 bDescriptorType; |
| 237 | __u8 bDescriptorSubType; |
| 238 | __u8 bTerminalID; |
| 239 | __u16 wTerminalType; |
| 240 | __u8 bAssocTerminal; |
| 241 | __u8 bSourceID; |
| 242 | __u8 iTerminal; |
| 243 | } __attribute__((__packed__)); |
| 244 | |
| 245 | #define UVC_DT_OUTPUT_TERMINAL_SIZE 9 |
| 246 | |
| 247 | /* 3.7.2.3. Camera Terminal Descriptor */ |
| 248 | struct uvc_camera_terminal_descriptor { |
| 249 | __u8 bLength; |
| 250 | __u8 bDescriptorType; |
| 251 | __u8 bDescriptorSubType; |
| 252 | __u8 bTerminalID; |
| 253 | __u16 wTerminalType; |
| 254 | __u8 bAssocTerminal; |
| 255 | __u8 iTerminal; |
| 256 | __u16 wObjectiveFocalLengthMin; |
| 257 | __u16 wObjectiveFocalLengthMax; |
| 258 | __u16 wOcularFocalLength; |
| 259 | __u8 bControlSize; |
| 260 | __u8 bmControls[3]; |
| 261 | } __attribute__((__packed__)); |
| 262 | |
| 263 | #define UVC_DT_CAMERA_TERMINAL_SIZE(n) (15+(n)) |
| 264 | |
| 265 | /* 3.7.2.4. Selector Unit Descriptor */ |
| 266 | struct uvc_selector_unit_descriptor { |
| 267 | __u8 bLength; |
| 268 | __u8 bDescriptorType; |
| 269 | __u8 bDescriptorSubType; |
| 270 | __u8 bUnitID; |
| 271 | __u8 bNrInPins; |
| 272 | __u8 baSourceID[0]; |
| 273 | __u8 iSelector; |
| 274 | } __attribute__((__packed__)); |
| 275 | |
| 276 | #define UVC_DT_SELECTOR_UNIT_SIZE(n) (6+(n)) |
| 277 | |
| 278 | #define UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ |
| 279 | uvc_selector_unit_descriptor_##n |
| 280 | |
| 281 | #define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ |
| 282 | struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) { \ |
| 283 | __u8 bLength; \ |
| 284 | __u8 bDescriptorType; \ |
| 285 | __u8 bDescriptorSubType; \ |
| 286 | __u8 bUnitID; \ |
| 287 | __u8 bNrInPins; \ |
| 288 | __u8 baSourceID[n]; \ |
| 289 | __u8 iSelector; \ |
| 290 | } __attribute__ ((packed)) |
| 291 | |
| 292 | /* 3.7.2.5. Processing Unit Descriptor */ |
| 293 | struct uvc_processing_unit_descriptor { |
| 294 | __u8 bLength; |
| 295 | __u8 bDescriptorType; |
| 296 | __u8 bDescriptorSubType; |
| 297 | __u8 bUnitID; |
| 298 | __u8 bSourceID; |
| 299 | __u16 wMaxMultiplier; |
| 300 | __u8 bControlSize; |
| 301 | __u8 bmControls[2]; |
| 302 | __u8 iProcessing; |
| 303 | } __attribute__((__packed__)); |
| 304 | |
| 305 | #define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n)) |
| 306 | |
| 307 | /* 3.7.2.6. Extension Unit Descriptor */ |
| 308 | struct uvc_extension_unit_descriptor { |
| 309 | __u8 bLength; |
| 310 | __u8 bDescriptorType; |
| 311 | __u8 bDescriptorSubType; |
| 312 | __u8 bUnitID; |
| 313 | __u8 guidExtensionCode[16]; |
| 314 | __u8 bNumControls; |
| 315 | __u8 bNrInPins; |
| 316 | __u8 baSourceID[0]; |
| 317 | __u8 bControlSize; |
| 318 | __u8 bmControls[0]; |
| 319 | __u8 iExtension; |
| 320 | } __attribute__((__packed__)); |
| 321 | |
| 322 | #define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n)) |
| 323 | |
| 324 | #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ |
| 325 | uvc_extension_unit_descriptor_##p_##n |
| 326 | |
| 327 | #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ |
| 328 | struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \ |
| 329 | __u8 bLength; \ |
| 330 | __u8 bDescriptorType; \ |
| 331 | __u8 bDescriptorSubType; \ |
| 332 | __u8 bUnitID; \ |
| 333 | __u8 guidExtensionCode[16]; \ |
| 334 | __u8 bNumControls; \ |
| 335 | __u8 bNrInPins; \ |
| 336 | __u8 baSourceID[p]; \ |
| 337 | __u8 bControlSize; \ |
| 338 | __u8 bmControls[n]; \ |
| 339 | __u8 iExtension; \ |
| 340 | } __attribute__ ((packed)) |
| 341 | |
| 342 | /* 3.8.2.2. Video Control Interrupt Endpoint Descriptor */ |
| 343 | struct uvc_control_endpoint_descriptor { |
| 344 | __u8 bLength; |
| 345 | __u8 bDescriptorType; |
| 346 | __u8 bDescriptorSubType; |
| 347 | __u16 wMaxTransferSize; |
| 348 | } __attribute__((__packed__)); |
| 349 | |
| 350 | #define UVC_DT_CONTROL_ENDPOINT_SIZE 5 |
| 351 | |
| 352 | /* 3.9.2.1. Input Header Descriptor */ |
| 353 | struct uvc_input_header_descriptor { |
| 354 | __u8 bLength; |
| 355 | __u8 bDescriptorType; |
| 356 | __u8 bDescriptorSubType; |
| 357 | __u8 bNumFormats; |
| 358 | __u16 wTotalLength; |
| 359 | __u8 bEndpointAddress; |
| 360 | __u8 bmInfo; |
| 361 | __u8 bTerminalLink; |
| 362 | __u8 bStillCaptureMethod; |
| 363 | __u8 bTriggerSupport; |
| 364 | __u8 bTriggerUsage; |
| 365 | __u8 bControlSize; |
| 366 | __u8 bmaControls[]; |
| 367 | } __attribute__((__packed__)); |
| 368 | |
| 369 | #define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p)) |
| 370 | |
| 371 | #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ |
| 372 | uvc_input_header_descriptor_##n_##p |
| 373 | |
| 374 | #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ |
| 375 | struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \ |
| 376 | __u8 bLength; \ |
| 377 | __u8 bDescriptorType; \ |
| 378 | __u8 bDescriptorSubType; \ |
| 379 | __u8 bNumFormats; \ |
| 380 | __u16 wTotalLength; \ |
| 381 | __u8 bEndpointAddress; \ |
| 382 | __u8 bmInfo; \ |
| 383 | __u8 bTerminalLink; \ |
| 384 | __u8 bStillCaptureMethod; \ |
| 385 | __u8 bTriggerSupport; \ |
| 386 | __u8 bTriggerUsage; \ |
| 387 | __u8 bControlSize; \ |
| 388 | __u8 bmaControls[p][n]; \ |
| 389 | } __attribute__ ((packed)) |
| 390 | |
| 391 | /* 3.9.2.2. Output Header Descriptor */ |
| 392 | struct uvc_output_header_descriptor { |
| 393 | __u8 bLength; |
| 394 | __u8 bDescriptorType; |
| 395 | __u8 bDescriptorSubType; |
| 396 | __u8 bNumFormats; |
| 397 | __u16 wTotalLength; |
| 398 | __u8 bEndpointAddress; |
| 399 | __u8 bTerminalLink; |
| 400 | __u8 bControlSize; |
| 401 | __u8 bmaControls[]; |
| 402 | } __attribute__((__packed__)); |
| 403 | |
| 404 | #define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p)) |
| 405 | |
| 406 | #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ |
| 407 | uvc_output_header_descriptor_##n_##p |
| 408 | |
| 409 | #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ |
| 410 | struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \ |
| 411 | __u8 bLength; \ |
| 412 | __u8 bDescriptorType; \ |
| 413 | __u8 bDescriptorSubType; \ |
| 414 | __u8 bNumFormats; \ |
| 415 | __u16 wTotalLength; \ |
| 416 | __u8 bEndpointAddress; \ |
| 417 | __u8 bTerminalLink; \ |
| 418 | __u8 bControlSize; \ |
| 419 | __u8 bmaControls[p][n]; \ |
| 420 | } __attribute__ ((packed)) |
| 421 | |
| 422 | /* 3.9.2.6. Color matching descriptor */ |
| 423 | struct uvc_color_matching_descriptor { |
| 424 | __u8 bLength; |
| 425 | __u8 bDescriptorType; |
| 426 | __u8 bDescriptorSubType; |
| 427 | __u8 bColorPrimaries; |
| 428 | __u8 bTransferCharacteristics; |
| 429 | __u8 bMatrixCoefficients; |
| 430 | } __attribute__((__packed__)); |
| 431 | |
| 432 | #define UVC_DT_COLOR_MATCHING_SIZE 6 |
| 433 | |
| 434 | /* 4.3.1.1. Video Probe and Commit Controls */ |
| 435 | struct uvc_streaming_control { |
| 436 | __u16 bmHint; |
| 437 | __u8 bFormatIndex; |
| 438 | __u8 bFrameIndex; |
| 439 | __u32 dwFrameInterval; |
| 440 | __u16 wKeyFrameRate; |
| 441 | __u16 wPFrameRate; |
| 442 | __u16 wCompQuality; |
| 443 | __u16 wCompWindowSize; |
| 444 | __u16 wDelay; |
| 445 | __u32 dwMaxVideoFrameSize; |
| 446 | __u32 dwMaxPayloadTransferSize; |
| 447 | __u32 dwClockFrequency; |
| 448 | __u8 bmFramingInfo; |
| 449 | __u8 bPreferedVersion; |
| 450 | __u8 bMinVersion; |
| 451 | __u8 bMaxVersion; |
| 452 | } __attribute__((__packed__)); |
| 453 | |
| 454 | /* Uncompressed Payload - 3.1.1. Uncompressed Video Format Descriptor */ |
| 455 | struct uvc_format_uncompressed { |
| 456 | __u8 bLength; |
| 457 | __u8 bDescriptorType; |
| 458 | __u8 bDescriptorSubType; |
| 459 | __u8 bFormatIndex; |
| 460 | __u8 bNumFrameDescriptors; |
| 461 | __u8 guidFormat[16]; |
| 462 | __u8 bBitsPerPixel; |
| 463 | __u8 bDefaultFrameIndex; |
| 464 | __u8 bAspectRatioX; |
| 465 | __u8 bAspectRatioY; |
| 466 | __u8 bmInterfaceFlags; |
| 467 | __u8 bCopyProtect; |
| 468 | } __attribute__((__packed__)); |
| 469 | |
| 470 | #define UVC_DT_FORMAT_UNCOMPRESSED_SIZE 27 |
| 471 | |
| 472 | /* Uncompressed Payload - 3.1.2. Uncompressed Video Frame Descriptor */ |
| 473 | struct uvc_frame_uncompressed { |
| 474 | __u8 bLength; |
| 475 | __u8 bDescriptorType; |
| 476 | __u8 bDescriptorSubType; |
| 477 | __u8 bFrameIndex; |
| 478 | __u8 bmCapabilities; |
| 479 | __u16 wWidth; |
| 480 | __u16 wHeight; |
| 481 | __u32 dwMinBitRate; |
| 482 | __u32 dwMaxBitRate; |
| 483 | __u32 dwMaxVideoFrameBufferSize; |
| 484 | __u32 dwDefaultFrameInterval; |
| 485 | __u8 bFrameIntervalType; |
| 486 | __u32 dwFrameInterval[]; |
| 487 | } __attribute__((__packed__)); |
| 488 | |
| 489 | #define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n)) |
| 490 | |
| 491 | #define UVC_FRAME_UNCOMPRESSED(n) \ |
| 492 | uvc_frame_uncompressed_##n |
| 493 | |
| 494 | #define DECLARE_UVC_FRAME_UNCOMPRESSED(n) \ |
| 495 | struct UVC_FRAME_UNCOMPRESSED(n) { \ |
| 496 | __u8 bLength; \ |
| 497 | __u8 bDescriptorType; \ |
| 498 | __u8 bDescriptorSubType; \ |
| 499 | __u8 bFrameIndex; \ |
| 500 | __u8 bmCapabilities; \ |
| 501 | __u16 wWidth; \ |
| 502 | __u16 wHeight; \ |
| 503 | __u32 dwMinBitRate; \ |
| 504 | __u32 dwMaxBitRate; \ |
| 505 | __u32 dwMaxVideoFrameBufferSize; \ |
| 506 | __u32 dwDefaultFrameInterval; \ |
| 507 | __u8 bFrameIntervalType; \ |
| 508 | __u32 dwFrameInterval[n]; \ |
| 509 | } __attribute__ ((packed)) |
| 510 | |
| 511 | /* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */ |
| 512 | struct uvc_format_mjpeg { |
| 513 | __u8 bLength; |
| 514 | __u8 bDescriptorType; |
| 515 | __u8 bDescriptorSubType; |
| 516 | __u8 bFormatIndex; |
| 517 | __u8 bNumFrameDescriptors; |
| 518 | __u8 bmFlags; |
| 519 | __u8 bDefaultFrameIndex; |
| 520 | __u8 bAspectRatioX; |
| 521 | __u8 bAspectRatioY; |
| 522 | __u8 bmInterfaceFlags; |
| 523 | __u8 bCopyProtect; |
| 524 | } __attribute__((__packed__)); |
| 525 | |
| 526 | #define UVC_DT_FORMAT_MJPEG_SIZE 11 |
| 527 | |
| 528 | /* MJPEG Payload - 3.1.2. MJPEG Video Frame Descriptor */ |
| 529 | struct uvc_frame_mjpeg { |
| 530 | __u8 bLength; |
| 531 | __u8 bDescriptorType; |
| 532 | __u8 bDescriptorSubType; |
| 533 | __u8 bFrameIndex; |
| 534 | __u8 bmCapabilities; |
| 535 | __u16 wWidth; |
| 536 | __u16 wHeight; |
| 537 | __u32 dwMinBitRate; |
| 538 | __u32 dwMaxBitRate; |
| 539 | __u32 dwMaxVideoFrameBufferSize; |
| 540 | __u32 dwDefaultFrameInterval; |
| 541 | __u8 bFrameIntervalType; |
| 542 | __u32 dwFrameInterval[]; |
| 543 | } __attribute__((__packed__)); |
| 544 | |
| 545 | #define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n)) |
| 546 | |
| 547 | #define UVC_FRAME_MJPEG(n) \ |
| 548 | uvc_frame_mjpeg_##n |
| 549 | |
| 550 | #define DECLARE_UVC_FRAME_MJPEG(n) \ |
| 551 | struct UVC_FRAME_MJPEG(n) { \ |
| 552 | __u8 bLength; \ |
| 553 | __u8 bDescriptorType; \ |
| 554 | __u8 bDescriptorSubType; \ |
| 555 | __u8 bFrameIndex; \ |
| 556 | __u8 bmCapabilities; \ |
| 557 | __u16 wWidth; \ |
| 558 | __u16 wHeight; \ |
| 559 | __u32 dwMinBitRate; \ |
| 560 | __u32 dwMaxBitRate; \ |
| 561 | __u32 dwMaxVideoFrameBufferSize; \ |
| 562 | __u32 dwDefaultFrameInterval; \ |
| 563 | __u8 bFrameIntervalType; \ |
| 564 | __u32 dwFrameInterval[n]; \ |
| 565 | } __attribute__ ((packed)) |
| 566 | |
Laurent Pinchart | de05f63 | 2009-06-26 12:15:38 -0300 | [diff] [blame] | 567 | #endif /* __LINUX_USB_VIDEO_H */ |
| 568 | |