2 * Copyright 2011, Haiku Inc. All Rights Reserved.
3 * Copyright 2009, Ithamar Adema, <ithamar.adema@team-embedded.nl>.
4 * Distributed under the terms of the MIT License.
10 /* Class/Subclass/Protocol */
12 #define SC_UNDEFINED 0x0
13 #define SC_VIDEOCONTROL 0x1
14 #define SC_VIDEOSTREAMING 0x2
15 #define SC_VIDEO_INTERFACE_COLLECTION 0x3
16 #define PC_PROTOCOL_UNDEFINED 0x0
18 #define CS_UNDEFINED 0x20
19 #define CS_DEVICE 0x21
20 #define CS_CONFIGURATION 0x22
21 #define CS_STRING 0x23
22 #define CS_INTERFACE 0x24
23 #define CS_ENDPOINT 0x25
25 /* Video Control Class Descriptors */
26 #define VC_DESCRIPTOR_UNDEFINED 0x0
28 #define VC_INPUT_TERMINAL 0x2
29 #define VC_OUTPUT_TERMINAL 0x3
30 #define VC_SELECTOR_UNIT 0x4
31 #define VC_PROCESSING_UNIT 0x5
32 #define VC_EXTENSION_UNIT 0x6
34 /* Video Streaming Class Descriptors */
35 #define VS_UNDEFINED 0x00
36 #define VS_INPUT_HEADER 0x01
37 #define VS_OUTPUT_HEADER 0x02
38 #define VS_STILL_IMAGE_FRAME 0x03
39 #define VS_FORMAT_UNCOMPRESSED 0x04
40 #define VS_FRAME_UNCOMPRESSED 0x05
41 #define VS_FORMAT_MJPEG 0x06
42 #define VS_FRAME_MJPEG 0x07
43 #define VS_FORMAT_MPEG2TS 0x0a
44 #define VS_FORMAT_DV 0x0c
45 #define VS_COLORFORMAT 0x0d
46 #define VS_FORMAT_FRAME_BASED 0x10
47 #define VS_FRAME_FRAME_BASED 0x11
48 #define VS_FORMAT_STREAM_BASED 0x12
50 #define EP_UNDEFINED 0x0
51 #define EP_GENERAL 0x1
52 #define EP_ENDPOINT 0x2
53 #define EP_INTERRUPT 0x3
55 #define RC_UNDEFINED 0x00
65 #define VC_CONTROL_UNDEFINED 0x0
66 #define VC_VIDEO_POWER_MODE_CONTROL 0x1
67 #define VC_REQUEST_ERROR_CODE_CONTROL 0x2
69 #define TE_CONTROL_UNDEFINED 0x0
71 #define SU_CONTROL_UNDEFINED 0x0
72 #define SU_INPUT_SELECT_CONTROL 0x1
74 #define CT_CONTROL_UNDEFINED 0x0
75 #define CT_SCANNING_MODE_CONTROL 0x1
76 #define CT_AE_MODE_CONTROL 0x2
77 #define CT_AE_PRIORITY_CONTROL 0x3
78 #define CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x4
79 #define CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x5
80 #define CT_FOCUS_ABSOLUTE_CONTROL 0x6
81 #define CT_FOCUS_RELATIVE_CONTROL 0x7
82 #define CT_FOCUS_AUTO_CONTROL 0x8
83 #define CT_IRIS_ABSOLUTE_CONTROL 0x9
84 #define CT_IRIS_RELATIVE_CONTROL 0xa
85 #define CT_ZOOM_ABSOLUTE_CONTROL 0xb
86 #define CT_ZOOM_RELATIVE_CONTROL 0xc
87 #define CT_PANTILT_ABSOLUTE_CONTROL 0xd
88 #define CT_PANTILT_RELATIVE_CONTROL 0xe
89 #define CT_ROLL_ABSOLUTE_CONTROL 0xf
90 #define CT_ROLL_RELATIVE_CONTROL 0x10
91 #define CT_PRIVACY_CONTROL 0x11
93 #define PU_CONTROL_UNDEFINED 0x0
94 #define PU_BACKLIGHT_COMPENSATION_CONTROL 0x1
95 #define PU_BRIGHTNESS_CONTROL 0x2
96 #define PU_CONTRAST_CONTROL 0x3
97 #define PU_GAIN_CONTROL 0x4
98 #define PU_POWER_LINE_FREQUENCY_CONTROL 0x5
99 #define PU_HUE_CONTROL 0x6
100 #define PU_SATURATION_CONTROL 0x7
101 #define PU_SHARPNESS_CONTROL 0x8
102 #define PU_GAMMA_CONTROL 0x9
103 #define PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0xa
104 #define PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0xb
105 #define PU_WHITE_BALANCE_COMPONENT_CONTROL 0xc
106 #define PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0xd
107 #define PU_DIGITAL_MULTIPLIER_CONTROL 0xe
108 #define PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0xf
109 #define PU_HUE_AUTO_CONTROL 0x10
110 #define PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11
111 #define PU_ANALOG_LOCK_STATUS_CONTROL 0x12
113 #define XU_CONTROL_UNDEFINED 0x0
115 #define VS_CONTROL_UNDEFINED 0x0
116 #define VS_PROBE_CONTROL 0x1
117 #define VS_COMMIT_CONTROL 0x2
118 #define VS_STILL_PROBE_CONTROL 0x3
119 #define VS_STILL_COMMIT_CONTROL 0x4
120 #define VS_STILL_IMAGE_TRIGGER_CONTROL 0x5
121 #define VS_STREAM_ERROR_CODE_CONTROL 0x6
122 #define VS_GENERATE_KEY_FRAME_CONTROL 0x7
123 #define VS_UPDATE_FRAME_SEGMENT_CONTROL 0x8
124 #define VS_SYNCH_DELAY_CONTROL 0x9
126 typedef struct usbvc_class_descriptor
{
128 uint8 descriptorType
;
129 uint8 descriptorSubtype
;
130 } _PACKED usbvc_class_descriptor
;
132 struct usbvc_input_header_descriptor
{
134 uint8 descriptorType
;
135 uint8 descriptorSubtype
;
138 uint8 endpointAddress
;
141 uint8 stillCaptureMethod
;
142 uint8 triggerSupport
;
148 struct usbvc_output_header_descriptor
{
150 uint8 descriptorType
;
151 uint8 descriptorSubtype
;
154 uint8 endpointAddress
;
160 typedef uint8 usbvc_guid
[16];
162 struct usbvc_format_descriptor
{
164 uint8 descriptorType
;
165 uint8 descriptorSubtype
;
167 uint8 numFrameDescriptors
;
172 uint8 defaultFrameIndex
;
175 uint8 interlaceFlags
;
180 uint8 defaultFrameIndex
;
183 uint8 interlaceFlags
;
189 struct usbvc_frame_descriptor
{
191 uint8 descriptorType
;
192 uint8 descriptorSubtype
;
199 uint32 maxVideoFrameBufferSize
;
200 uint32 defaultFrameInterval
;
201 uint8 frameIntervalType
;
204 uint32 minFrameInterval
;
205 uint32 maxFrameInterval
;
206 uint32 frameIntervalStep
;
208 uint32 discreteFrameIntervals
[0];
215 } _PACKED usbvc_image_size_pattern
;
217 struct usbvc_still_image_frame_descriptor
{
219 uint8 descriptorType
;
220 uint8 descriptorSubtype
;
221 uint8 endpointAddress
;
222 uint8 numImageSizePatterns
;
223 usbvc_image_size_pattern imageSizePatterns
[0];
224 uint8
NumCompressionPatterns() const { return *(CompressionPatterns() - 1); }
225 const uint8
* CompressionPatterns() const {
226 return ((const uint8
*)imageSizePatterns
+ sizeof(usbvc_image_size_pattern
)
227 * numImageSizePatterns
+ sizeof(uint8
));
231 struct usbvc_color_matching_descriptor
{
233 uint8 descriptorType
;
234 uint8 descriptorSubtype
;
235 uint8 colorPrimaries
;
236 uint8 transferCharacteristics
;
237 uint8 matrixCoefficients
;
241 struct usbvc_interface_header_descriptor
{
243 uint8 descriptorType
;
244 uint8 descriptorSubtype
;
247 uint32 clockFrequency
;
248 uint8 numInterfacesNumbers
;
249 uint8 interfaceNumbers
[0];
252 struct usbvc_input_terminal_descriptor
{
254 uint8 descriptorType
;
255 uint8 descriptorSubtype
;
258 uint8 associatedTerminal
;
262 struct usbvc_output_terminal_descriptor
{
264 uint8 descriptorType
;
265 uint8 descriptorSubtype
;
268 uint8 associatedTerminal
;
273 struct usbvc_camera_terminal_descriptor
{
275 uint8 descriptorType
;
276 uint8 descriptorSubtype
;
279 uint8 associatedTerminal
;
281 uint16 objectiveFocalLengthMin
;
282 uint16 objectiveFocalLengthMax
;
283 uint16 ocularFocalLength
;
288 struct usbvc_selector_unit_descriptor
{
290 uint8 descriptorType
;
291 uint8 descriptorSubtype
;
295 uint8
Selector() const { return sourceID
[numInputPins
]; }
298 struct usbvc_processing_unit_descriptor
{
300 uint8 descriptorType
;
301 uint8 descriptorSubtype
;
304 uint16 maxMultiplier
;
307 uint8
Processing() const { return controls
[controlSize
]; }
308 uint8
VideoStandards() const { return controls
[controlSize
+1]; }
311 struct usbvc_extension_unit_descriptor
{
313 uint8 descriptorType
;
314 uint8 descriptorSubtype
;
316 usbvc_guid guidExtensionCode
;
320 uint8
ControlSize() const { return sourceID
[numInputPins
]; }
321 const uint8
* Controls() const { return &sourceID
[numInputPins
+1]; }
322 uint8
Extension() const
323 { return sourceID
[numInputPins
+ ControlSize() + 1]; }
326 struct usbvc_probecommit
{
330 uint32 frameInterval
;
334 uint16 compWindowSize
;
336 uint32 maxVideoFrameSize
;
337 uint32 maxPayloadTransferSize
;
338 uint32 clockFrequency
;
340 uint8 preferredVersion
;
343 void SetFrameInterval(uint32 interval
)
344 { frameInterval
= interval
; }
348 #endif /* _USB_VIDEO_H */