video.h 17 KB

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