xref: /openbsd/sys/dev/usb/uvideo.h (revision 404b540a)
1 /*	$OpenBSD: uvideo.h,v 1.45 2009/02/19 21:17:35 deraadt Exp $ */
2 
3 /*
4  * Copyright (c) 2007 Robert Nagy <robert@openbsd.org>
5  * Copyright (c) 2008 Marcus Glocker <mglocker@openbsd.org>
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #include <sys/queue.h>
21 #include <sys/videoio.h>
22 
23 /*
24  * USB Video Class
25  */
26 /* Table A-7: Video Class-Specific Endpoint Descriptor Subtypes */
27 #define	EP_UNDEFINED					0x00
28 #define EP_GENERAL					0x01
29 #define EP_ENDPOINT					0x02
30 #define EP_INTERRUPT					0x03
31 
32 /* Table A-5: Video Class-Specific VC Interface Descriptor Subtypes */
33 #define	UDESCSUB_VC_DESCRIPTOR_UNDEFINED		0x00
34 #define UDESCSUB_VC_HEADER				0x01
35 #define UDESCSUB_VC_INPUT_TERMINAL			0x02
36 #define UDESCSUB_VC_OUTPUT_TERMINAL			0x03
37 #define UDESCSUB_VC_SELECTOR_UNIT			0x04
38 #define UDESCSUB_VC_PROCESSING_UNIT			0x05
39 #define UDESCSUB_VC_EXTENSION_UNIT			0x06
40 
41 /* Table A-6: Video Class-Specific VS Interface Descriptor Subtypes */
42 #define	UDESCSUB_VS_UNDEFINED				0x00
43 #define UDESCSUB_VS_INPUT_HEADER			0x01
44 #define UDESCSUB_VS_OUTPUT_HEADER			0x02
45 #define UDESCSUB_VS_STILL_IMAGE_FRAME			0x03
46 #define UDESCSUB_VS_FORMAT_UNCOMPRESSED			0x04
47 #define UDESCSUB_VS_FRAME_UNCOMPRESSED			0x05
48 #define UDESCSUB_VS_FORMAT_MJPEG			0x06
49 #define UDESCSUB_VS_FRAME_MJPEG				0x07
50 #define UDESCSUB_VS_FORMAT_MPEG2TS			0x0a
51 #define UDESCSUB_VS_FORMAT_DV				0x0c
52 #define UDESCSUB_VS_COLORFORMAT				0x0d
53 #define UDESCSUB_VS_FORMAT_FRAME_BASED			0x10
54 #define UDESCSUB_VS_FRAME_FRAME_BASED			0x11
55 #define UDESCSUB_VS_FORMAT_STREAM_BASED			0x12
56 
57 /* Table A-8: Video Class-Specific Request Codes */
58 #define RC_UNDEFINED					0x00
59 #define SET_CUR						0x01
60 #define GET_CUR						0x81
61 #define GET_MIN						0x82
62 #define GET_MAX						0x83
63 #define GET_RES						0x84
64 #define GET_LEN						0x85
65 #define GET_INFO					0x86
66 #define GET_DEF						0x87
67 
68 /* Table A-9: Video Control Interface Control Selectors */
69 #define VC_CONTROL_UNDEFINED				0x00
70 #define VC_VIDEO_POWER_MODE_CONTROL			0x01
71 #define VC_REQUEST_ERROR_CODE_CONTROL			0x02
72 
73 /* Table A-11: Selector Unit Control Selectors */
74 #define	SU_CONTROL_UNDEFINED				0x00
75 #define	SU_INPUT_SELECT_CONTROL 			0x01
76 
77 /* Table A-12: Camera Terminal Control Selectors */
78 #define	CT_CONTROL_UNDEFINED				0x00
79 #define	CT_SCANNING_MODE_CONTROL			0x01
80 #define	CT_AE_MODE_CONTROL				0x02
81 #define	CT_AE_PRIORITY_CONTROL				0x03
82 #define	CT_EXPOSURE_TIME_ABSOLUTE_CONTROL		0x04
83 #define	CT_EXPOSURE_TIME_RELATIVE_CONTROL		0x05
84 #define	CT_FOCUS_ABSOLUTE_CONTROL			0x06
85 #define	CT_FOCUS_RELATIVE_CONTROL			0x07
86 #define	CT_FOCUS_AUTO_CONTROL				0x08
87 #define	CT_IRIS_ABSOLUTE_CONTROL			0x09
88 #define	CT_IRIS_RELATIVE_CONTROL			0x0a
89 #define	CT_ZOOM_ABSOLUTE_CONTROL			0x0b
90 #define	CT_ZOOM_RELATIVE_CONTROL			0x0c
91 #define	CT_PANTILT_ABSOLUTE_CONTROL			0x0d
92 #define	CT_PANTILT_RELATIVE_CONTROL			0x0e
93 #define	CT_ROLL_ABSOLUTE_CONTROL			0x0f
94 #define	CT_ROLL_RELATIVE_CONTROL			0x10
95 #define	CT_PRIVACY_CONTROL				0x11
96 
97 /* Table A-13: Processing Unit Control Selectors */
98 #define	PU_CONTROL_UNDEFINED				0x00
99 #define	PU_BACKLIGHT_COMPENSATION_CONTROL		0x01
100 #define	PU_BRIGHTNESS_CONTROL				0x02
101 #define	PU_CONTRAST_CONTROL				0x03
102 #define	PU_GAIN_CONTROL 				0x04
103 #define	PU_POWER_LINE_FREQUENCY_CONTROL 		0x05
104 #define	PU_HUE_CONTROL					0x06
105 #define	PU_SATURATION_CONTROL				0x07
106 #define	PU_SHARPNESS_CONTROL				0x08
107 #define	PU_GAMMA_CONTROL				0x09
108 #define	PU_WHITE_BALANCE_TEMPERATURE_CONTROL		0x0a
109 #define	PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL	0x0b
110 #define	PU_WHITE_BALANCE_COMPONENT_CONTROL		0x0c
111 #define	PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 	0x0d
112 #define	PU_DIGITAL_MULTIPLIER_CONTROL			0x0e
113 #define	PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL		0x0f
114 #define	PU_HUE_AUTO_CONTROL				0x10
115 #define	PU_ANALOG_VIDEO_STANDARD_CONTROL		0x11
116 #define	PU_ANALOG_LOCK_STATUS_CONTROL			0x12
117 
118 /* Table A-15: VideoStreaming Interface Control Selectors */
119 #define	VS_CONTROL_UNDEFINED				0x00
120 #define	VS_PROBE_CONTROL				0x01
121 #define	VS_COMMIT_CONTROL				0x02
122 #define	VS_STILL_PROBE_CONTROL				0x03
123 #define	VS_STILL_COMMIT_CONTROL 			0x04
124 #define	VS_STILL_IMAGE_TRIGGER_CONTROL			0x05
125 #define	VS_STREAM_ERROR_CODE_CONTROL			0x06
126 #define	VS_GENERATE_KEY_FRAME_CONTROL			0x07
127 #define	VS_UPDATE_FRAME_SEGMENT_CONTROL			0x08
128 #define	VS_SYNC_DELAY_CONTROL				0x09
129 
130 /* probe commit bmRequests */
131 #define	UVIDEO_SET_IF					0x21
132 #define	UVIDEO_GET_IF					0xa1
133 #define	UVIDEO_SET_EP					0x22
134 #define	UVIDEO_GET_EP					0xa2
135 
136 /* Table B-1: USB Terminal Types */
137 #define	TT_VENDOR_SPECIFIC				0x0100
138 #define	TT_STREAMING					0x0101
139 
140 /* Table B-2: Input Terminal Types */
141 #define	ITT_VENDOR_SPECIFIC				0x0200
142 #define	ITT_CAMERA					0x0201
143 #define	ITT_MEDIA_TRANSPORT_INPUT			0x0202
144 
145 /* Table B-3: Output Terminal Types */
146 #define	OTT_VENDOR_SPECIFIC				0x0300
147 #define	OTT_DISPLAY					0x0301
148 #define	OTT_MEDIA_TRANSPORT_OUTPUT			0x0302
149 
150 /* Table B-4: External Terminal Types */
151 #define	EXTERNAL_VENDOR_SPECIFIC			0x0400
152 #define	COMPOSITE_CONNECTOR				0x0401
153 #define	SVIDEO_CONNECTOR				0x0402
154 #define	COMPONENT_CONNECTOR				0x0403
155 
156 /* Table 3-3: VC Interface Header Descriptor */
157 struct usb_video_header_desc {
158 	uByte	bLength;
159 	uByte	bDescriptorType;
160 	uByte	bDescriptorSubtype;
161 	uWord	bcdUVC;
162 	uWord	wTotalLength;
163 	uDWord	dwClockFrequency;
164 	uByte	bInCollection;
165 } __packed;
166 
167 struct usb_video_header_desc_all {
168 	struct usb_video_header_desc	*fix;
169 	uByte				*baInterfaceNr;
170 };
171 
172 /* Table 3-4: Input Terminal Descriptor */
173 struct usb_video_input_terminal_desc {
174 	uByte	bLength;
175 	uByte	bDescriptorType;
176 	uByte	bDescriptorSubtype;
177 	uByte	bTerminalID;
178 	uWord	wTerminalType;
179 	uByte	bAssocTerminal;
180 	uByte	iTerminal;
181 } __packed;
182 
183 /* Table 3-5: Output Terminal Descriptor */
184 struct usb_video_output_terminal_desc {
185 	uByte	bLength;
186 	uByte	bDescriptorType;
187 	uByte	bDescriptorSubtype;
188 	uByte	bTerminalID;
189 	uWord	wTerminalType;
190 	uByte	bAssocTerminal;
191 	uByte	bSourceID;
192 	uByte	iTerminal;
193 } __packed;
194 
195 /* Table 3-6: Camera Terminal Descriptor */
196 struct usb_video_camera_terminal_desc {
197 	uByte	bLength;
198 	uByte	bDescriptorType;
199 	uByte	bDescriptorSubtype;
200 	uByte	bTerminalID;
201 	uWord	wTerminalType;
202 	uByte	bAssocTerminal;
203 	uByte	iTerminal;
204 	uWord	wObjectiveFocalLengthMin;
205 	uWord	wObjectiveFocalLengthMax;
206 	uWord	wOcularFocalLength;
207 	uByte	bControlSize;
208 	uByte	*bmControls;
209 } __packed;
210 
211 /* Table 3-8: VC Processing Unit Descriptor */
212 struct usb_video_vc_processing_desc {
213 	uByte	bLength;
214 	uByte	bDescriptorType;
215 	uByte	bDescriptorSubtype;
216 	uByte	bUnitID;
217 	uByte	bSourceID;
218 	uWord	wMaxMultiplier;
219 	uByte	bControlSize;
220 	uWord	bmControls;	/* XXX must be variable size of bControlSize */
221 	uByte	iProcessing;
222 	uByte	bmVideoStandards;
223 } __packed;
224 
225 /* Table 3-9: VC Extension Unit Descriptor */
226 struct usb_video_vc_extension_desc {
227 	uByte	bLength;
228 	uByte	bDescriptorType;
229 	uByte	bDescriptorSubtype;
230 	uByte	bUnitID;
231 	uByte	guidExtensionCode[16];
232 	uByte	bNumControls;
233 	uByte	bNrInPins;
234 } __packed;
235 
236 /* Table 3-11: VC Endpoint Descriptor */
237 struct usb_video_vc_endpoint_desc {
238 	uByte	bLength;
239 	uByte	bDescriptorType;
240 	uByte	bDescriptorSubtype;
241 	uWord	wMaxTransferSize;
242 } __packed;
243 
244 /* Table 3-13: Interface Input Header Descriptor */
245 struct usb_video_input_header_desc {
246 	uByte	bLength;
247 	uByte	bDescriptorType;
248 	uByte	bDescriptorSubtype;
249 	uByte	bNumFormats;
250 	uWord	wTotalLength;
251 	uByte	bEndpointAddress;
252 	uByte	bmInfo;
253 	uByte	bTerminalLink;
254 	uByte	bStillCaptureMethod;
255 	uByte	bTriggerSupport;
256 	uByte	bTriggerUsage;
257 	uByte	bControlSize;
258 } __packed;
259 
260 struct usb_video_input_header_desc_all {
261 	struct usb_video_input_header_desc	*fix;
262 	uByte					*bmaControls;
263 };
264 
265 /* Table 3-18: Color Matching Descriptor */
266 struct usb_video_color_matching_descr {
267 	uByte	bLength;
268 	uByte	bDescriptorType;
269 	uByte	bDescriptorSubtype;
270 	uByte	bColorPrimaries;
271 	uByte	bTransferCharacteristics;
272 	uByte	bMatrixCoefficients;
273 } __packed;
274 
275 /* Table 4-47: Video Probe and Commit Controls */
276 struct usb_video_probe_commit {
277 	uWord	bmHint;
278 	uByte	bFormatIndex;
279 	uByte	bFrameIndex;
280 	uDWord	dwFrameInterval;
281 	uWord	wKeyFrameRate;
282 	uWord	wPFrameRate;
283 	uWord	wCompQuality;
284 	uWord	wCompWindowSize;
285 	uWord	wDelay;
286 	uDWord	dwMaxVideoFrameSize;
287 	uDWord	dwMaxPayloadTransferSize;
288 	uDWord	dwClockFrequency;
289 	uByte	bmFramingInfo;
290 	uByte	bPreferedVersion;
291 	uByte	bMinVersion;
292 	uByte	bMaxVersion;
293 } __packed;
294 
295 /*
296  * USB Video Payload Uncompressed
297  */
298 /* Table 2-1: Compression Formats */
299 #define	UVIDEO_FORMAT_GUID_YUY2	{			\
300     0x59, 0x55, 0x59, 0x32, 0x00, 0x00, 0x10, 0x00,	\
301     0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }
302 
303 #define	UVIDEO_FORMAT_GUID_NV12	{			\
304     0x4e, 0x56, 0x31, 0x32, 0x00, 0x00, 0x10, 0x00,	\
305     0x80, 0x00, 0x00, 0xaa, 0x00, 0x38,	0x9b, 0x71 }
306 
307 #define	UVIDEO_FORMAT_GUID_UYVY	{			\
308     0x55, 0x59, 0x56, 0x59, 0x00, 0x00, 0x10, 0x00,	\
309     0x80, 0x00, 0x00, 0xaa, 0x00, 0x38,	0x9b, 0x71 }
310 
311 /*
312  * USB Video Payload MJPEG
313  */
314 /* Table 2-1: Stream Header Format for the Motion-JPEG */
315 #define UVIDEO_SH_MAX_LEN	12
316 #define UVIDEO_SH_MIN_LEN	2
317 struct usb_video_stream_header {
318 	uByte	bLength;
319 	uByte	bFlags;
320 #define	UVIDEO_SH_FLAG_FID	(1 << 0)
321 #define	UVIDEO_SH_FLAG_EOF	(1 << 1)
322 #define	UVIDEO_SH_FLAG_PTS	(1 << 2)
323 #define	UVIDEO_SH_FLAG_SCR	(1 << 3)
324 #define	UVIDEO_SH_FLAG_RES	(1 << 4)
325 #define	UVIDEO_SH_FLAG_STI	(1 << 5)
326 #define	UVIDEO_SH_FLAG_ERR	(1 << 6)
327 #define	UVIDEO_SH_FLAG_EOH	(1 << 7)
328 	/* TODO complete struct */
329 } __packed;
330 
331 /* Table 3-1: Motion-JPEG Video Format Descriptor */
332 struct usb_video_format_mjpeg_desc {
333 	uByte	bLength;
334 	uByte	bDescriptorType;
335 	uByte	bDescriptorSubtype;
336 	uByte	bFormatIndex;
337 	uByte	bNumFrameDescriptors;
338 	uByte	bmFlags;
339 	uByte	bDefaultFrameIndex;
340 	uByte	bAspectRatioX;
341 	uByte	bAspectRatioY;
342 	uByte	bmInterlaceFlags;
343 	uByte	bCopyProtect;
344 } __packed;
345 
346 /* Table 3-2: Motion-JPEG Video Frame Descriptor */
347 struct usb_video_frame_mjpeg_desc {
348 	uByte	bLength;
349 	uByte	bDescriptorType;
350 	uByte	bDescriptorSubtype;
351 	uByte	bFrameIndex;
352 	uByte	bmCapabilities;
353 	uWord	wWidth;
354 	uWord	wHeight;
355 	uDWord	dwMinBitRate;
356 	uDWord	dwMaxBitRate;
357 	uDWord	dwMaxVideoFrameBufferSize;
358 	uDWord	dwDefaultFrameInterval;
359 	uByte	bFrameIntervalType;
360 	/* TODO add continous/discrete frame intervals (Table 3-3/3-4) */
361 } __packed;
362 
363 /*
364  * USB Video Payload Uncompressed
365  */
366 /* Table 3-1: Uncompressed Video Format Descriptor */
367 struct usb_video_format_uncompressed_desc {
368 	uByte	bLength;
369 	uByte	bDescriptorType;
370 	uByte	bDescriptorSubtype;
371 	uByte	bFormatIndex;
372 	uByte	bNumFrameDescriptors;
373 	uByte	guidFormat[16];
374 	uByte	bBitsPerPixel;
375 	uByte	bDefaultFrameIndex;
376 	uByte	bAspectRatioX;
377 	uByte	bAspectRatioY;
378 	uByte	bmInterlaceFlags;
379 	uByte	bCopyProtect;
380 } __packed;
381 
382 /* Table 3-2: Uncompressed Video Frame Descriptor */
383 struct usb_video_frame_uncompressed_desc {
384 	uByte	bLength;
385 	uByte	bDescriptorType;
386 	uByte	bDescriptorSubtype;
387 	uByte	bFrameIndex;
388 	uByte	bmCapabilities;
389 	uWord	wWidth;
390 	uWord	wHeight;
391 	uDWord	dwMinBitRate;
392 	uDWord	dwMaxBitRate;
393 	uDWord	dwMaxVideoFrameBufferSize;
394 	uDWord	dwDefaultFrameInterval;
395 	uByte	bFrameIntervalType;
396 	/* TODO add continous/discrete frame intervals (Table 3-3/3-4) */
397 } __packed;
398 
399 /*
400  * Driver specific private definitions.
401  */
402 struct uvideo_format_desc {
403 	uByte	bLength;
404 	uByte	bDescriptorType;
405 	uByte	bDescriptorSubtype;
406 	uByte	bFormatIndex;
407 	uByte	bNumFrameDescriptors;
408 	union {
409 		/* mjpeg */
410 		struct {
411 			uByte	bmFlags;
412 			uByte	bDefaultFrameIndex;
413 			uByte	bAspectRatioX;
414 			uByte	bAspectRatioY;
415 			uByte	bmInterlaceFlags;
416 			uByte	bCopyProtect;
417 		} mjpeg;
418 
419 		/* uncompressed */
420 		struct {
421 			uByte	guidFormat[16];
422 			uByte	bBitsPerPixel;
423 			uByte	bDefaultFrameIndex;
424 			uByte	bAspectRatioX;
425 			uByte	bAspectRatioY;
426 			uByte	bmInterlaceFlags;
427 			uByte	bCopyProtect;
428 		} uc;
429 	} u;
430 } __packed;
431 
432 #define UVIDEO_NFRAMES_MAX	40
433 struct uvideo_isoc_xfer {
434 	struct uvideo_softc	*sc;
435 	usbd_xfer_handle	 xfer;
436 	void			*buf;
437 	uint16_t		 size[UVIDEO_NFRAMES_MAX];
438 };
439 
440 struct uvideo_bulk_xfer {
441 	struct uvideo_softc	*sc;
442 	usbd_xfer_handle	 xfer;
443 	void			*buf;
444 	uint16_t		 size;
445 };
446 
447 #define UVIDEO_IXFERS		3
448 struct uvideo_vs_iface {
449 	usbd_interface_handle  	 ifaceh;
450 	usbd_pipe_handle	 pipeh;
451 	int			 iface;
452 	int			 numalts;
453 	int			 curalt;
454 	int			 endpoint;
455 	uint32_t		 psize;
456 	int			 bulk_endpoint;
457 	int			 bulk_running;
458 	struct uvideo_isoc_xfer	 ixfer[UVIDEO_IXFERS];
459 	struct uvideo_bulk_xfer	 bxfer;
460 };
461 
462 struct uvideo_frame_buffer {
463 	int		 sample;
464 	uint8_t		 fid;
465 	int		 offset;
466 	int		 buf_size;
467 	uint8_t		*buf;
468 };
469 
470 #define UVIDEO_MAX_BUFFERS	32
471 struct uvideo_mmap {
472 	SIMPLEQ_ENTRY(uvideo_mmap)	q_frames;
473 	uint8_t				*buf;
474 	struct v4l2_buffer		 v4l2_buf;
475 };
476 typedef SIMPLEQ_HEAD(, uvideo_mmap) q_mmap;
477 
478 struct uvideo_format_group {
479 	uint32_t				 pixelformat;
480 	uint8_t					 format_dfidx;
481 	struct uvideo_format_desc		*format;
482 	/* frame descriptors for mjpeg and uncompressed are identical */
483 #define UVIDEO_MAX_FRAME			 16
484 	struct usb_video_frame_mjpeg_desc	*frame_cur;
485 	struct usb_video_frame_mjpeg_desc	*frame[UVIDEO_MAX_FRAME];
486 	int					 frame_num;
487 };
488 
489 struct uvideo_res {
490 	int width;
491 	int height;
492 	int fidx;
493 };
494 
495 struct uvideo_controls {
496 	int		cid;
497 	int		type;
498 	char		name[32];
499 	uint16_t	ctrl_bitmap;
500 	uint16_t	ctrl_selector;
501 	uint16_t	ctrl_len;
502 } uvideo_ctrls[] = {
503 	/* TODO complete control list */
504 	{
505 	    V4L2_CID_BRIGHTNESS,
506 	    V4L2_CTRL_TYPE_INTEGER,
507 	    "Brightness",
508 	    (1 << 0),
509 	    PU_BRIGHTNESS_CONTROL,
510 	    2
511 	},
512 	{
513 	    V4L2_CID_CONTRAST,
514 	    V4L2_CTRL_TYPE_INTEGER,
515 	    "Contrast",
516 	    (1 << 1),
517 	    PU_CONTRAST_CONTROL,
518 	    2
519 	},
520 	{
521 	    V4L2_CID_HUE,
522 	    V4L2_CTRL_TYPE_INTEGER,
523 	    "Hue",
524 	    (1 << 2),
525 	    PU_HUE_CONTROL,
526 	    2
527 	},
528 	{
529 	    V4L2_CID_SATURATION,
530 	    V4L2_CTRL_TYPE_INTEGER,
531 	    "Saturation",
532 	    (1 << 3),
533 	    PU_SATURATION_CONTROL,
534 	    2
535 	},
536 	{
537 	    V4L2_CID_GAMMA,
538 	    V4L2_CTRL_TYPE_INTEGER,
539 	    "Gamma",
540 	    (1 << 5),
541 	    PU_GAMMA_CONTROL,
542 	    2
543 	},
544 	{
545 	    V4L2_CID_GAIN,
546 	    V4L2_CTRL_TYPE_INTEGER,
547 	    "Gain",
548 	    (1 << 9),
549 	    PU_GAIN_CONTROL,
550 	    2,
551 	},
552 	{ 0, 0, "", 0, 0, 0 }
553 };
554 
555 struct uvideo_softc {
556 	struct device				 sc_dev;
557 	usbd_device_handle			 sc_udev;
558 	int					 sc_nifaces;
559 	usbd_interface_handle			*sc_ifaces;
560 
561 	struct device				*sc_videodev;
562 
563 	int					 sc_enabled;
564 	int					 sc_dying;
565 	int					 sc_max_fbuf_size;
566 	int					 sc_negotiated_flag;
567 
568 	struct uvideo_frame_buffer		 sc_frame_buffer;
569 
570 	struct uvideo_mmap			 sc_mmap[UVIDEO_MAX_BUFFERS];
571 	uint8_t					*sc_mmap_buffer;
572 	q_mmap					 sc_mmap_q;
573 	int					 sc_mmap_count;
574 	int					 sc_mmap_cur;
575 	int					 sc_mmap_flag;
576 
577 	struct vnode				*sc_vp;
578 	struct usb_task				 sc_task_write;
579 
580 	int					 sc_nframes;
581 	struct usb_video_probe_commit		 sc_desc_probe;
582 	struct usb_video_header_desc_all	 sc_desc_vc_header;
583 	struct usb_video_input_header_desc_all	 sc_desc_vs_input_header;
584 
585 #define UVIDEO_MAX_PU				 8
586 	int					 sc_desc_vc_pu_num;
587 	struct usb_video_vc_processing_desc	*sc_desc_vc_pu_cur;
588 	struct usb_video_vc_processing_desc	*sc_desc_vc_pu[UVIDEO_MAX_PU];
589 
590 #define UVIDEO_MAX_FORMAT			 8
591 	int					 sc_fmtgrp_idx;
592 	int					 sc_fmtgrp_num;
593 	struct uvideo_format_group		*sc_fmtgrp_cur;
594 	struct uvideo_format_group		 sc_fmtgrp[UVIDEO_MAX_FORMAT];
595 
596 #define	UVIDEO_MAX_VS_NUM			 8
597 	struct uvideo_vs_iface			*sc_vs_cur;
598 	struct uvideo_vs_iface			 sc_vs_coll[UVIDEO_MAX_VS_NUM];
599 
600 	void					*sc_uplayer_arg;
601 	int					*sc_uplayer_fsize;
602 	uint8_t					*sc_uplayer_fbuffer;
603 	void					 (*sc_uplayer_intr)(void *);
604 
605 	struct uvideo_devs			*sc_quirk;
606 	usbd_status				(*sc_decode_stream_header)
607 						    (struct uvideo_softc *,
608 						    uint8_t *, int);
609 };
610