video.h 16 KB

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