video.h 16 KB

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