blob: c171e453c0b5ad555d75566a1de257a5c1d54ae4 [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
// clang-format off
#include <zircon/compiler.h>
__BEGIN_CDECLS;
// video interface subclasses
#define USB_SUBCLASS_VIDEO_CONTROL 0x01
#define USB_SUBCLASS_VIDEO_STREAMING 0x02
#define USB_SUBCLASS_VIDEO_INTERFACE_COLLECTION 0x03
// video class specific descriptor types
#define USB_VIDEO_CS_DEVICE 0x21
#define USB_VIDEO_CS_CONFIGURATION 0x22
#define USB_VIDEO_CS_STRING 0x23
#define USB_VIDEO_CS_INTERFACE 0x24
#define USB_VIDEO_CS_ENDPOINT 0x25
// video class specific VC interface descriptor subtypes
#define USB_VIDEO_VC_HEADER 0x01
#define USB_VIDEO_VC_INPUT_TERMINAL 0x02
#define USB_VIDEO_VC_OUTPUT_TERMINAL 0x03
#define USB_VIDEO_VC_SELECTOR_UNIT 0x04
#define USB_VIDEO_VC_PROCESSING_UNIT 0x05
#define USB_VIDEO_VC_EXTENSION_UNIT 0x06
#define USB_VIDEO_VC_ENCODING_UNIT 0x07
// video class specific VS interface descriptor subtypes
#define USB_VIDEO_VS_INPUT_HEADER 0x01
#define USB_VIDEO_VS_OUTPUT_HEADER 0x02
#define USB_VIDEO_VS_STILL_IMAGE_FRAME 0x03
#define USB_VIDEO_VS_FORMAT_UNCOMPRESSED 0x04
#define USB_VIDEO_VS_FRAME_UNCOMPRESSED 0x05
#define USB_VIDEO_VS_FORMAT_MJPEG 0x06
#define USB_VIDEO_VS_FRAME_MJPEG 0x07
#define USB_VIDEO_VS_FORMAT_MPEG2TS 0x0A
#define USB_VIDEO_VS_FORMAT_DV 0x0C
#define USB_VIDEO_VS_COLORFORMAT 0x0D
#define USB_VIDEO_VS_FORMAT_FRAME_BASED 0x10
#define USB_VIDEO_VS_FRAME_FRAME_BASED 0x11
#define USB_VIDEO_VS_FORMAT_STREAM_BASED 0x12
#define USB_VIDEO_VS_FORMAT_H264 0x13
#define USB_VIDEO_VS_FRAME_H264 0x14
#define USB_VIDEO_VS_FORMAT_H264_SIMULCAST 0x15
#define USB_VIDEO_VS_FORMAT_VP8 0x16
#define USB_VIDEO_VS_FRAME_VP8 0x17
#define USB_VIDEO_VS_FORMAT_VP8_SIMULCAST 0x18
// video class specific endpoint descriptor subtypes
#define USB_VIDEO_EP_GENERAL 0x01
#define USB_VIDEO_EP_ENDPOINT 0x02
#define USB_VIDEO_EP_INTERRUPT 0x03
// video class specific request codes
#define USB_VIDEO_SET_CUR 0x01
#define USB_VIDEO_SET_CUR_ALL 0x11
#define USB_VIDEO_GET_CUR 0x81
#define USB_VIDEO_GET_MIN 0x82
#define USB_VIDEO_GET_MAX 0x83
#define USB_VIDEO_GET_RES 0x84
#define USB_VIDEO_GET_LEN 0x85
#define USB_VIDEO_GET_INFO 0x86
#define USB_VIDEO_GET_DEF 0x87
#define USB_VIDEO_GET_CUR_ALL 0x91
#define USB_VIDEO_GET_MIN_ALL 0x92
#define USB_VIDEO_GET_MAX_ALL 0x93
#define USB_VIDEO_GET_RES_ALL 0x94
#define USB_VIDEO_GET_DEF_ALL 0x97
// video streaming interface control selectors
#define USB_VIDEO_VS_PROBE_CONTROL 0x01
#define USB_VIDEO_VS_COMMIT_CONTROL 0x02
#define USB_VIDEO_VS_STILL_PROBE_CONTROL 0x03
#define USB_VIDEO_VS_STILL_COMMIT_CONTROL 0x04
#define USB_VIDEO_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05
#define USB_VIDEO_VS_STREAM_ERROR_CODE_CONTROL 0x06
#define USB_VIDEO_VS_GENERATE_KEY_FRAME_CONTROL 0x07
#define USB_VIDEO_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08
#define USB_VIDEO_VS_SYNCH_DELAY_CONTROL 0x09
// header for usb_video_vc_* below
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
uint8_t bDescriptorSubtype;
} __PACKED usb_video_vc_desc_header;
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
uint8_t bDescriptorSubtype; // USB_VIDEO_VC_HEADER
uint16_t bcdUVC;
uint16_t wTotalLength;
uint32_t dwClockFrequency;
uint8_t bInCollection;
uint8_t baInterfaceNr[];
} __PACKED usb_video_vc_header_desc;
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
uint8_t bDescriptorSubtype; // USB_VIDEO_VC_INPUT_TERMINAL
uint8_t bTerminalID;
uint16_t wTerminalType;
uint8_t bAssocTerminal;
uint8_t iTerminal;
} __PACKED usb_video_vc_input_terminal_desc;
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
uint8_t bDescriptorSubtype; // USB_VIDEO_VC_OUTPUT_TERMINAL
uint8_t bTerminalID;
uint16_t wTerminalType;
uint8_t bAssocTerminal;
uint8_t bSourceID;
uint8_t iTerminal;
} __PACKED usb_video_vc_output_terminal_desc;
// class specific VC interrupt endpoint descriptor
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType; // USB_VIDEO_CS_ENDPOINT
uint8_t bDescriptorSubtype; // USB_ENDPOINT_INTERRUPT
uint16_t wMaxTransferSize;
} __PACKED usb_video_vc_interrupt_endpoint_desc;
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
uint8_t bDescriptorSubtype; // USB_VIDEO_VS_HEADER
uint8_t bNumFormats;
uint16_t wTotalLength;
uint8_t bEndpointAddress;
uint8_t bmInfo;
uint8_t bTerminalLink;
uint8_t bStillCaptureMethod;
uint8_t bTriggerSupport;
uint8_t bTriggerUsage;
uint8_t bControlSize;
uint8_t bmaControls[];
} __PACKED usb_video_vs_input_header_desc;
// USB Video Payload Uncompressed
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
uint8_t bDescriptorSubType; // USB_VIDEO_VS_FORMAT_UNCOMPRESSED
uint8_t bFormatIndex;
uint8_t bNumFrameDescriptors;
unsigned char guidFormat[16];
uint8_t bBitsPerPixel;
uint8_t bDefaultFrameIndex;
uint8_t bAspectRatioX;
uint8_t bAspectRatioY;
uint8_t bmInterfaceFlags;
uint8_t bCopyProtect;
} __PACKED usb_video_vs_uncompressed_format_desc;
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
uint8_t bDescriptorSubType; // USB_VIDEO_VS_FRAME_UNCOMPRESSED
uint8_t bFrameIndex;
uint8_t bmCapabilities;
uint16_t wWidth;
uint16_t wHeight;
uint32_t dwMinBitRate;
uint32_t dwMaxBitRate;
uint32_t dwMaxVideoFrameBufferSize;
uint32_t dwDefaultFrameInterval;
uint8_t bFrameIntervalType;
uint32_t dwFrameInterval[];
} __PACKED usb_video_vs_uncompressed_video_frame_desc;
__END_CDECLS;