1 #ifndef DEVICES_USB_VIDEO_H
2 #define DEVICES_USB_VIDEO_H
4 ** $VER: usb_video.h 2.0 (15.12.07)
6 ** usb definitions include file
8 ** (C) Copyright 2008 Chris Hodges
12 #include <exec/types.h>
18 /* Usb Video Requests */
19 #define UVUDR_SET_CUR 0x01
20 #define UVUDR_GET_CUR 0x81
21 #define UVUDR_SET_MIN 0x02
22 #define UVUDR_GET_MIN 0x82
23 #define UVUDR_SET_MAX 0x03
24 #define UVUDR_GET_MAX 0x83
25 #define UVUDR_SET_RES 0x04
26 #define UVUDR_GET_RES 0x84
27 #define UVUDR_GET_LEN 0x85
28 #define UVUDR_GET_INFO 0x86
29 #define UVUDR_GET_DEF 0x87
31 /* Video Ctrl class specific interface descriptor subtypes */
32 #define UDST_VIDEO_CTRL_HEADER 0x01
33 #define UDST_VIDEO_CTRL_INPUT_TERMINAL 0x02
34 #define UDST_VIDEO_CTRL_OUTPUT_TERMINAL 0x03
35 #define UDST_VIDEO_CTRL_SELECTOR_UNIT 0x04
36 #define UDST_VIDEO_CTRL_PROCESSING_UNIT 0x05
37 #define UDST_VIDEO_CTRL_EXTENSION_UNIT 0x06
39 /* Video Streaming class specific interface descriptor subtypes */
40 #define UDST_VIDEO_STREAM_INPUT_HEADER 0x01
41 #define UDST_VIDEO_STREAM_OUTPUT_HEADER 0x02
42 #define UDST_VIDEO_STREAM_STILL_IMAGE_FRAME 0x03
43 #define UDST_VIDEO_STREAM_FORMAT_UNCOMPRESSED 0x04
44 #define UDST_VIDEO_STREAM_FRAME_UNCOMPRESSED 0x05
45 #define UDST_VIDEO_STREAM_FORMAT_MJPEG 0x06
46 #define UDST_VIDEO_STREAM_FRAME_MJPEG 0x07
47 #define UDST_VIDEO_STREAM_FORMAT_MPEG2TS 0x0a
48 #define UDST_VIDEO_STREAM_FORMAT_DV 0x0c
49 #define UDST_VIDEO_STREAM_COLORFORMAT 0x0d
50 #define UDST_VIDEO_STREAM_FORMAT_FRAME_BASED 0x10
51 #define UDST_VIDEO_STREAM_FRAME_FRAME_BASED 0x11
52 #define UDST_VIDEO_STREAM_FORMAT_STREAM_BASED 0x12
54 /* Videoclass specific endpoint descriptors subtypes */
55 #define UDST_VIDEO_EP_GENERAL 0x01
56 #define UDST_VIDEO_EP_ENDPOINT 0x02
57 #define UDST_VIDEO_EP_INTERRUPT 0x03
60 #define VIDEO_NO_SUBCLASS 0x00
61 #define VIDEO_CTRL_SUBCLASS 0x01
62 #define VIDEO_STREAM_SUBCLASS 0x02
63 #define VIDEO_IFCOLL_SUBCLASS 0x03
65 /* USB Video specific stuff */
67 /* USB Video USB Terminal types */
68 #define UVUTT_VENDOR 0x0100 /* USB vendor specific */
69 #define UVUTT_STREAMING 0x0101 /* USB streaming */
71 /* USB Video Input Terminal types */
72 #define UVITT_VENDOR 0x0200 /* Input Vendor specific */
73 #define UVITT_CAMERA 0x0201 /* Camera sensor */
74 #define UVITT_MEDIA_TRANSPORT 0x0202 /* Sequential media */
76 /* USB Video Output Terminal types */
77 #define UVOTT_VENDOR 0x0300 /* Output Vendor specific */
78 #define UVOTT_DISPLAY 0x0301 /* Generic display */
79 #define UVOTT_MEDIA_TRANSPORT 0x0302 /* Sequential media */
81 /* USB Video External Terminal types */
82 #define UVETT_VENDOR 0x0400 /* External Vendor specific */
83 #define UVETT_COMPOSITE_CONNECTOR 0x0401 /* Composite video connector */
84 #define UVETT_SVIDEO_CONNECTOR 0x0402 /* S-video connector */
85 #define UVETT_COMPONENT_CONNECTOR 0x0403 /* Component video connector */
87 /* VideoControl Interface Control Selectors */
88 #define UVVCCS_VIDEO_POWER_MODE_CONTROL 0x01
89 #define UVVCCS_REQUEST_ERROR_CODE_CONTROL 0x02
91 /* Selector Unit Control Selectors */
92 #define UVSUCS_INPUT_SELECT_CONTROL 0x01
94 /* Camera Terminal Control Selectors */
95 #define UVCTCS_SCANNING_MODE_CONTROL 0x01
96 #define UVCTCS_AE_MODE_CONTROL 0x02
97 #define UVCTCS_AE_PRIORITY_CONTROL 0x03
98 #define UVCTCS_EXPOSURE_TIME_ABS_CONTROL 0x04
99 #define UVCTCS_EXPOSURE_TIME_REL_CONTROL 0x05
100 #define UVCTCS_FOCUS_ABS_CONTROL 0x06
101 #define UVCTCS_FOCUS_REL_CONTROL 0x07
102 #define UVCTCS_FOCUS_AUTO_CONTROL 0x08
103 #define UVCTCS_IRIS_ABS_CONTROL 0x09
104 #define UVCTCS_IRIS_REL_CONTROL 0x0a
105 #define UVCTCS_ZOOM_ABS_CONTROL 0x0b
106 #define UVCTCS_ZOOM_REL_CONTROL 0x0c
107 #define UVCTCS_PANTILT_ABS_CONTROL 0x0d
108 #define UVCTCS_PANTILT_REL_CONTROL 0x0e
109 #define UVCTCS_ROLL_ABS_CONTROL 0x0f
110 #define UVCTCS_ROLL_REL_CONTROL 0x10
111 #define UVCTCS_PRIVACY_CONTROL 0x11
113 /* Processing Unit Control Selectors */
114 #define UVPUCS_BACKLIGHT_COMP_CONTROL 0x01
115 #define UVPUCS_BRIGHTNESS_CONTROL 0x02
116 #define UVPUCS_CONTRAST_CONTROL 0x03
117 #define UVPUCS_GAIN_CONTROL 0x04
118 #define UVPUCS_POWER_LINE_FREQ_CONTROL 0x05
119 #define UVPUCS_HUE_CONTROL 0x06
120 #define UVPUCS_SATURATION_CONTROL 0x07
121 #define UVPUCS_SHARPNESS_CONTROL 0x08
122 #define UVPUCS_GAMMA_CONTROL 0x09
123 #define UVPUCS_WB_TEMP_CONTROL 0x0a
124 #define UVPUCS_WB_TEMP_AUTO_CONTROL 0x0b
125 #define UVPUCS_WB_COMPONENT_CONTROL 0x0c
126 #define UVPUCS_WB_COMPONENT_AUTO_CONTROL 0x0d
127 #define UVPUCS_DIGITAL_MULT_CONTROL 0x0e
128 #define UVPUCS_DIGITAL_MULT_LIMIT_CONTROL 0x0f
129 #define UVPUCS_HUE_AUTO_CONTROL 0x10
130 #define UVPUCS_ANALOG_VIDEO_STD_CONTROL 0x11
131 #define UVPUCS_ANALOG_LOCK_STATUS_CONTROL 0x12
133 /* VideoStreaming Interface Control Selectors */
134 #define UVVSCS_PROBE_CONTROL 0x01
135 #define UVVSCS_COMMIT_CONTROL 0x02
136 #define UVVSCS_STILL_PROBE_CONTROL 0x03
137 #define UVVSCS_STILL_COMMIT_CONTROL 0x04
138 #define UVVSCS_IMAGE_TRIGGER_CONTROL 0x05
139 #define UVVSCS_STREAM_ERROR_COE_CONTROL 0x06
140 #define UVVSCS_GENERATE_KEY_FRAME_CONTROL 0x07
141 #define UVVSCS_UPDATE_FRAME_SEG_CONTROL 0x08
142 #define UVVSCS_SYNCH_DELAY_CONTROL 0x09
145 /* USB Video Spec 1.1 stuff */
146 struct UsbVideoHeaderDesc
148 UBYTE bLength
; /* Size of this descriptor */
149 UBYTE bDescriptorType
; /* Descriptor Type (0x24) */
150 UBYTE bDescriptorSubType
; /* Subtype (0x01) */
151 UBYTE bcdUVC0
; /* Low byte of spec version (0x00) */
152 UBYTE bcdUVC1
; /* High byte of spec version (0x01) */
153 UBYTE wTotalLength0
; /* Total length of all descriptors (low byte) */
154 UBYTE wTotalLength1
; /* Total length of all descriptors (high byte) */
155 UBYTE dwClockFreq
[4]; /* Clock frequency (deprecated) */
156 UBYTE bInCollection
; /* The number of Video/MidiStreaming */
157 UBYTE baInterfaceNr
[1]; /* Interface number of the first VideoStreaming interface */
160 struct UsbVideoInputTermDesc
162 UBYTE bLength
; /* Size of this descriptor */
163 UBYTE bDescriptorType
; /* Descriptor Type (0x24) */
164 UBYTE bDescriptorSubType
; /* Subtype (0x02) */
165 UBYTE bTerminalID
; /* unique ID */
166 UWORD wTerminalType
; /* Terminal Type */
167 UBYTE bAssocTerminal
; /* Associated Output Terminal ID */
168 UBYTE iTerminal
; /* String descriptor */
169 UBYTE extra
[0]; /* depending on the type, extra bytes may follow */
172 struct UsbVideoOutputTermDesc
174 UBYTE bLength
; /* Size of this descriptor */
175 UBYTE bDescriptorType
; /* Descriptor Type (0x24) */
176 UBYTE bDescriptorSubType
; /* Subtype (0x03) */
177 UBYTE bTerminalID
; /* unique ID */
178 UWORD wTerminalType
; /* Terminal Type */
179 UBYTE bAssocTerminal
; /* Associated Output Terminal ID */
180 UBYTE bSourceID
; /* ID of the Unit or Terminal to which this Terminal is connected. */
181 UBYTE iTerminal
; /* String descriptor */
182 UBYTE extra
[0]; /* depending on the type, extra bytes may follow */
185 struct UsbVideoCameraTermDesc
187 UBYTE bLength
; /* Size of this descriptor */
188 UBYTE bDescriptorType
; /* Descriptor Type (0x24) */
189 UBYTE bDescriptorSubType
; /* Subtype (0x04) */
190 UBYTE bTerminalID
; /* unique ID */
191 UWORD wTerminalType
; /* Terminal Type */
192 UBYTE bAssocTerminal
; /* Associated Output Terminal ID */
193 UBYTE bSourceID
; /* ID of the Unit or Terminal to which this Terminal is connected. */
194 UBYTE iTerminal
; /* String descriptor */
195 UBYTE wObjFocalLengthMin0
; /* Focal Length minimum low byte */
196 UBYTE wObjFocalLengthMin1
; /* Focal Length minimum high byte */
197 UBYTE wObjFocalLengthMax0
; /* Focal Length maximum low byte */
198 UBYTE wObjFocalLengthMax1
; /* Focal Length maximum high byte */
199 UBYTE wOcFocalLength0
; /* Ocular Focal Length low byte */
200 UBYTE wOcFocalLength1
; /* Ocular Focal Length high byte */
201 UBYTE bControlSize
; /* Size in bytes of an element of the control array */
202 UBYTE bmControls
[0]; /* Ckontrols bitmap */
205 /* this data structure is of no use, as it's highly variable in size */
206 struct UsbVideoSelectorUnitDesc
208 UBYTE bLength
; /* Size of this descriptor */
209 UBYTE bDescriptorType
; /* Descriptor Type (0x24) */
210 UBYTE bDescriptorSubType
; /* Subtype (0x05) */
211 UBYTE bUnitID
; /* unique ID */
212 UBYTE bNrInPins
; /* Number of Input Pins */
213 UBYTE baSourceID
[0]; /* ID of the Unit or Terminal to which the nth Input Pin of this Selector Unit is connected. */
214 UBYTE iSelector
; /* String descriptor */
217 /* this data structure is of no use, as it's highly variable in size */
218 struct UsbVideoProcessingUnitDesc
220 UBYTE bLength
; /* Size of this descriptor */
221 UBYTE bDescriptorType
; /* Descriptor Type (0x24) */
222 UBYTE bDescriptorSubType
; /* Subtype (0x07) */
223 UBYTE bUnitID
; /* unique ID */
224 UBYTE bSourceID
; /* ID of the Unit or Terminal to which this Unit is connected */
225 UWORD wMaxMultiplier
; /* maximum digital magnification */
226 UBYTE bControlSize
; /* Size in bytes of an element of the control array */
227 UBYTE bmControls
[0]; /* Controls bitmap */
228 UBYTE iProcessing
; /* String descriptor */
229 UBYTE bmVideoStandards
; /* A Bitmap of all analog video standards supported */
232 /* this data structure is of no use, as it's highly variable in size */
233 struct UsbVideoExtensionUnitDesc
235 UBYTE bLength
; /* Size of this descriptor */
236 UBYTE bDescriptorType
; /* Descriptor Type (0x24) */
237 UBYTE bDescriptorSubType
; /* Subtype (0x08) */
238 UBYTE bUnitID
; /* unique ID */
239 ULONG guidExtensionCode
; /* vendor specific */
240 UBYTE bNumControls
; /* Number of controls in this extension unit */
241 UBYTE bNrInPins
; /* Number of Input Pins */
242 UBYTE baSourceID
[0]; /* ID of the Unit or Terminal to which the nth Input Pin of this Extension Unit is connected. */
243 UBYTE bControlSize
; /* Size in bytes of an element of the control array */
244 UBYTE bmControls
[0]; /* Controls bitmap */
245 UBYTE iExtension
; /* String descriptor */
248 /* generic video stuff */
249 struct UsbVideoInputHeaderIFDesc
251 UBYTE bLength
; /* Size of this descriptor */
252 UBYTE bDescriptorType
; /* Descriptor Type (0x24) */
253 UBYTE bDescriptorSubType
; /* Subtype (0x01) */
254 UBYTE bNumFormats
; /* Number of video payload format descriptors following */
255 UWORD wTotalLength
; /* Length of descriptor */
256 UBYTE bEndpointAddress
; /* Endpoint for bulk or iso video data */
257 UBYTE bmInfo
; /* Capabilities bitmap */
258 UBYTE bTerminalLink
; /* Terminal linked to this interface */
259 UBYTE bStillCaptureMethod
; /* Method of still image capture supported */
260 UBYTE bTriggerSupport
; /* HW Triggering support */
261 UBYTE bTriggerUsage
; /* Trigger behaviour */
262 UBYTE bControlSize
; /* Size in bytes of an element of the control array */
263 UBYTE bmControls
[0]; /* Controls bitmap */
266 struct UsbVideoOutputHeaderIFDesc
268 UBYTE bLength
; /* Size of this descriptor */
269 UBYTE bDescriptorType
; /* Descriptor Type (0x24) */
270 UBYTE bDescriptorSubType
; /* Subtype (0x02) */
271 UBYTE bNumFormats
; /* Number of video payload format descriptors following */
272 UWORD wTotalLength
; /* Length of descriptor */
273 UBYTE bEndpointAddress
; /* Endpoint for bulk or iso video data */
274 UBYTE bTerminalLink
; /* Terminal linked to this interface */
275 UBYTE bControlSize
; /* Size in bytes of an element of the control array */
276 UBYTE bmControls
[0]; /* Controls bitmap */
279 /* this data structure is of no use, as it's highly variable in size */
280 struct UsbVideoStillImageFrameIFDesc
282 UBYTE bLength
; /* Size of this descriptor */
283 UBYTE bDescriptorType
; /* Descriptor Type (0x24) */
284 UBYTE bDescriptorSubType
; /* Subtype (0x03) */
285 UBYTE bEndpointAddress
; /* Endpoint for bulk or iso video data */
286 UBYTE bNumImageSizePatterns
; /* Number of image size patterns of this format */
287 UBYTE baImageSizePatterns
[0]; /* Array of width/heights */
288 UBYTE bNumCompressionPatterns
; /* Number of compression patterns of this format */
289 UBYTE baCompression
[0]; /* Array of compressions */
292 struct UsbVideoColorFormatIFDesc
294 UBYTE bLength
; /* Size of this descriptor (6) */
295 UBYTE bDescriptorType
; /* Descriptor Type (0x24) */
296 UBYTE bDescriptorSubType
; /* Subtype (0x0d) */
297 UBYTE bColorPrimaries
; /* Color primaries and reference white */
298 UBYTE bTransferChar
; /* Transfer characteristics (gamma) */
299 UBYTE bMatrixCoefficients
; /* Matrix used to compute luma and chroma */
302 /* MJPEG Video Format stuff */
304 #define UVMJHF_FRAME_ID 0x01 /* Alternating bit for frame */
305 #define UVMJHF_END_OF_FRAME 0x02 /* Indicates last fragment of frame */
306 #define UVMJHF_HAS_PTS 0x04 /* Indicates the presence of the PTS field */
307 #define UVMJHF_HAS_SCR 0x08 /* Indicates the presence of the SCR field */
308 #define UVMJHF_STILL_IMAGE 0x20 /* This is part of a still image */
309 #define UVMJHF_ERROR 0x40 /* Error in the device streaming */
310 #define UVMJHF_END_OF_HEADER 0x80 /* End of header bytes */
312 struct UsbVideoMJPEGStreamHeader
314 UBYTE bHeaderLength
; /* Size of this header */
315 UBYTE bmHeader
; /* Bitfield header field */
316 UBYTE dwPTS
[4]; /* Presentation Time Stamp */
317 UBYTE dwSCR
[4]; /* Source Clock Reference */
320 struct UsbVideoMJPEGFormatDesc
322 UBYTE bLength
; /* Size of this descriptor */
323 UBYTE bDescriptorType
; /* Descriptor Type (0x24) */
324 UBYTE bDescriptorSubType
; /* Subtype (0x06) */
325 UBYTE bFormatIndex
; /* Index of this Format Descriptor */
326 UBYTE bNumFrameDescriptors
; /* Number of Frame Descriptors following */
327 UBYTE bmFlags
; /* Specifies characteristics of this format */
328 UBYTE bDefaultFrameIndex
; /* Optimum frame index (used to select resolution) */
329 UBYTE bAspectRatioX
; /* X dimension of the picture aspect ratio */
330 UBYTE bAspectRatioY
; /* Y dimension of the picture aspect ratio */
331 UBYTE bmInterlaceFlags
; /* Specifies interlace information */
332 UBYTE bCopyProtect
; /* CP info */
335 struct UsbVideoMJPEGFrameDesc
337 UBYTE bLength
; /* Size of this descriptor */
338 UBYTE bDescriptorType
; /* Descriptor Type (0x24) */
339 UBYTE bDescriptorSubType
; /* Subtype (0x07) */
340 UBYTE bFrameIndex
; /* Index of this Frame Descriptor */
341 UBYTE bmCapabilites
; /* Capabilities bitmap */
342 UBYTE wWidth0
; /* Width low byte */
343 UBYTE wWidth1
; /* Width high byte */
344 UBYTE wHeight0
; /* Height low byte */
345 UBYTE wHeight1
; /* Height high byte */
346 UBYTE dwMinBitRate
[4]; /* Minimum bitrate at default compression */
347 UBYTE dwMaxBitRate
[4]; /* Maximum bitrate at default compression */
348 UBYTE dwMaxVideoFrameBuf
[4]; /* Deprecated */
349 UBYTE dwDefaultFrameIval
[4]; /* Default frame interval */
350 UBYTE bFrameIntervalType
; /* How many frame intervals (continuous or fixed) are supported */
351 UBYTE dwFrameInterval
[4]; /* Array of frame intervals or min/max/step */
354 #if defined(__GNUC__)
358 #endif /* DEVICES_USB_VIDEO_H */