1 #ifndef DEVICES_USB_VIDEO_H
    2 #define DEVICES_USB_VIDEO_H
    3 /*
    4 **	$VER: usb_video.h 2.0 (15.12.07)
    5 **
    6 **	usb definitions include file
    7 **
    8 **	(C) Copyright 2008 Chris Hodges
    9 **	    All Rights Reserved
   10 */
   11 
   12 #include <exec/types.h>
   13 
   14 #if defined(__GNUC__)
   15 # pragma pack(1)
   16 #endif
   17 
   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
   30 
   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
   38 
   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
   53 
   54 /* Video MIDI class specific interface descriptor subtypes */
   55 
   56 /* Videoclass specific endpoint descriptors subtypes */
   57 #define UDST_VIDEO_EP_GENERAL    0x01
   58 #define UDST_VIDEO_EP_ENDPOINT   0x02
   59 #define UDST_VIDEO_EP_INTERRUPT  0x03
   60 
   61 /* Video classes */
   62 #define VIDEO_NO_SUBCLASS     0x00
   63 #define VIDEO_CTRL_SUBCLASS   0x01
   64 #define VIDEO_STREAM_SUBCLASS 0x02
   65 #define VIDEO_IFCOLL_SUBCLASS 0x03
   66 
   67 /* USB Video specific stuff */
   68 
   69 /* USB Video USB Terminal types */
   70 #define UVUTT_VENDOR           0x0100 /* USB vendor specific */
   71 #define UVUTT_STREAMING        0x0101 /* USB streaming */
   72 
   73 /* USB Video Input Terminal types */
   74 #define UVITT_VENDOR           0x0200 /* Input Vendor specific */
   75 #define UVITT_CAMERA           0x0201 /* Camera sensor */
   76 #define UVITT_MEDIA_TRANSPORT  0x0202 /* Sequential media */
   77 
   78 /* USB Video Output Terminal types */
   79 #define UVOTT_VENDOR           0x0300 /* Output Vendor specific */
   80 #define UVOTT_DISPLAY          0x0301 /* Generic display */
   81 #define UVOTT_MEDIA_TRANSPORT  0x0302 /* Sequential media */
   82 
   83 /* USB Video External Terminal types */
   84 #define UVETT_VENDOR           0x0400 /* External Vendor specific */
   85 #define UVETT_COMPOSITE_CONNECTOR 0x0401 /* Composite video connector */
   86 #define UVETT_SVIDEO_CONNECTOR 0x0402 /* S-video connector */
   87 #define UVETT_COMPONENT_CONNECTOR 0x0403 /* Component video connector */
   88 
   89 /* VideoControl Interface Control Selectors */
   90 #define UVVCCS_VIDEO_POWER_MODE_CONTROL   0x01
   91 #define UVVCCS_REQUEST_ERROR_CODE_CONTROL 0x02
   92 
   93 #if 0
   94 /* USB Video Spec 1.0 stuff */
   95 struct UsbVideoHeaderDesc10
   96 {
   97     UBYTE bLength;             /* Size of this descriptor */
   98     UBYTE bDescriptorType;     /* Descriptor Type (0x24) */
   99     UBYTE bDescriptorSubType;  /* Subtype (0x01) */
  100     UBYTE bcdADC0;             /* Low byte of spec version (0x00) */
  101     UBYTE bcdADC1;             /* High byte of spec version (0x01) */
  102     UBYTE wTotalLength0;       /* Total length of all descriptors (low byte) */
  103     UBYTE wTotalLength1;       /* Total length of all descriptors (high byte) */
  104     UBYTE bInCollection;       /* The number of Video/MidiStreaming */
  105     UBYTE baInterfaceNr[1];    /* Interface number of the first VideoStreaming or MIDIStreaming interface */
  106 };
  107 
  108 struct UsbVideoInputTermDesc10
  109 {
  110     UBYTE bLength;             /* Size of this descriptor */
  111     UBYTE bDescriptorType;     /* Descriptor Type (0x24) */
  112     UBYTE bDescriptorSubType;  /* Subtype (0x02) */
  113     UBYTE bTerminalID;         /* unique ID */
  114     UWORD wTerminalType;       /* Terminal Type */
  115     UBYTE bAssocTerminal;      /* Associated Output Terminal ID */
  116     UBYTE bNrChannels;         /* Number of logical output channels in the output terminal */
  117     UWORD wChannelConfig;      /* Spacial location */
  118     UBYTE iChannelNames;       /* String descriptor */
  119     UBYTE iTerminal;           /* String descriptor */
  120 };
  121 
  122 struct UsbVideoOutputTermDesc10
  123 {
  124     UBYTE bLength;             /* Size of this descriptor */
  125     UBYTE bDescriptorType;     /* Descriptor Type (0x24) */
  126     UBYTE bDescriptorSubType;  /* Subtype (0x03) */
  127     UBYTE bTerminalID;         /* unique ID */
  128     UWORD wTerminalType;       /* Terminal Type */
  129     UBYTE bAssocTerminal;      /* Associated Output Terminal ID */
  130     UBYTE bSourceID;           /* ID of the Unit or Terminal to which this Terminal is connected. */
  131     UBYTE iTerminal;           /* String descriptor */
  132 };
  133 
  134 /* this data structure is of no use, as it's highly variable in size */
  135 struct UsbVideoMixerUnitDesc10
  136 {
  137     UBYTE bLength;             /* Size of this descriptor */
  138     UBYTE bDescriptorType;     /* Descriptor Type (0x24) */
  139     UBYTE bDescriptorSubType;  /* Subtype (0x04) */
  140     UBYTE bUnitID;             /* unique ID */
  141     UBYTE bNrInPins;           /* Number of Input Pins */
  142     UBYTE baSourceID[0];       /* ID of the Unit or Terminal to which the nth Input Pin of this Mixer Unit is connected. */
  143     UBYTE bNrChannels;         /* Number of logical output channels in the Mixer's output video channel cluster. */
  144     UWORD wChannelConfig;      /* Spatial location */
  145     UBYTE iChannelNames;       /* String descriptor */
  146     UBYTE bmControls[0];       /* Controls bitmap */
  147     UBYTE iMixer;              /* String descriptor */
  148 };
  149 
  150 /* this data structure is of no use, as it's highly variable in size */
  151 struct UsbVideoSelectorUnitDesc10
  152 {
  153     UBYTE bLength;             /* Size of this descriptor */
  154     UBYTE bDescriptorType;     /* Descriptor Type (0x24) */
  155     UBYTE bDescriptorSubType;  /* Subtype (0x05) */
  156     UBYTE bUnitID;             /* unique ID */
  157     UBYTE bNrInPins;           /* Number of Input Pins */
  158     UBYTE baSourceID[0];       /* ID of the Unit or Terminal to which the nth Input Pin of this Selector Unit is connected. */
  159     UBYTE iSelector;           /* String descriptor */
  160 };
  161 
  162 /* this data structure is of no use, as it's highly variable in size */
  163 struct UsbVideoFeatureUnitDesc10
  164 {
  165     UBYTE bLength;             /* Size of this descriptor */
  166     UBYTE bDescriptorType;     /* Descriptor Type (0x24) */
  167     UBYTE bDescriptorSubType;  /* Subtype (0x06) */
  168     UBYTE bUnitID;             /* unique ID */
  169     UBYTE bSourceID;           /* ID of the Unit or Terminal to which this Terminal is connected. */
  170     UBYTE bControlSize;        /* Size in bytes of an element of the control array */
  171     UBYTE bmaControls[0];      /* Controls matrix */
  172     UBYTE iFeature;            /* String descriptor */
  173 };
  174 
  175 /* this data structure is of no use, as it's highly variable in size */
  176 struct UsbVideoProcessingUnitDesc10
  177 {
  178     UBYTE bLength;             /* Size of this descriptor */
  179     UBYTE bDescriptorType;     /* Descriptor Type (0x24) */
  180     UBYTE bDescriptorSubType;  /* Subtype (0x07) */
  181     UBYTE bUnitID;             /* unique ID */
  182     UWORD wProcessType;        /* type of processing */
  183     UBYTE bNrInPins;           /* Number of Input Pins */
  184     UBYTE baSourceID[0];       /* ID of the Unit or Terminal to which the nth Input Pin of this Processing Unit is connected. */
  185     UBYTE bNrChannels;         /* Number of logical output channels in the Mixer's output video channel cluster. */
  186     UWORD wChannelConfig;      /* Spatial location */
  187     UBYTE iChannelNames;       /* String descriptor */
  188     UBYTE bControlSize;        /* Size in bytes of an element of the control array */
  189     UBYTE bmControls[0];       /* Controls bitmap */
  190     UBYTE iProcessing;         /* String descriptor */
  191 };
  192 
  193 /* this data structure is of no use, as it's highly variable in size */
  194 struct UsbVideoExtensionUnitDesc10
  195 {
  196     UBYTE bLength;             /* Size of this descriptor */
  197     UBYTE bDescriptorType;     /* Descriptor Type (0x24) */
  198     UBYTE bDescriptorSubType;  /* Subtype (0x08) */
  199     UBYTE bUnitID;             /* unique ID */
  200     UWORD wExtensionCode;      /* vendor specific */
  201     UBYTE bNrInPins;           /* Number of Input Pins */
  202     UBYTE baSourceID[0];       /* ID of the Unit or Terminal to which the nth Input Pin of this Mixer Unit is connected. */
  203     UBYTE bNrChannels;         /* Number of logical output channels in the Mixer's output video channel cluster. */
  204     UWORD wChannelConfig;      /* Spatial location */
  205     UBYTE iChannelNames;       /* String descriptor */
  206     UBYTE bControlSize;        /* Size in bytes of an element of the control array */
  207     UBYTE bmControls[0];       /* Controls bitmap */
  208     UBYTE iExtension;          /* String descriptor */
  209 };
  210  
  211 /* USB Video Spec 2.0 stuff */
  212 struct UsbVideoHeaderDesc20
  213 {
  214     UBYTE bLength;             /* Size of this descriptor */
  215     UBYTE bDescriptorType;     /* Descriptor Type (0x24) */
  216     UBYTE bDescriptorSubType;  /* Subtype (0x01) */
  217     UBYTE bcdADC0;             /* Low byte of spec version (0x00)*/
  218     UBYTE bcdADC1;             /* High byte of spec version (0x02) */
  219     UBYTE bCategory;           /* Primary use of the video function */
  220     UWORD wTotalLength;        /* Total length of all descriptors */
  221     UBYTE bmControls;          /* Latency control (%00=n/a,%01=read only, %11=r/w) */
  222 };
  223 
  224 struct UsbVideoInputTermDesc20
  225 {
  226     UBYTE bLength;             /* Size of this descriptor */
  227     UBYTE bDescriptorType;     /* Descriptor Type (0x24) */
  228     UBYTE bDescriptorSubType;  /* Subtype (0x02) */
  229     UBYTE bTerminalID;         /* unique ID */
  230     UWORD wTerminalType;       /* Terminal Type */
  231     UBYTE bAssocTerminal;      /* Associated Output Terminal ID */
  232     UBYTE bCSourceID;          /* ID of the Clock Entity */
  233     UBYTE bNrChannels;         /* Number of logical output channels in the output terminal */
  234     UBYTE bmChannelConfig[4];  /* Bitmap of spacial location */
  235     UBYTE iChannelNames;       /* String descriptor */
  236     UBYTE bmControls;          /* Various controls */
  237     UBYTE iTerminal;           /* String descriptor */
  238 };
  239 
  240 /* generic video stuff */
  241 struct UsbVideoGeneralIFDesc
  242 {
  243     UBYTE bLength;             /* Size of this descriptor */
  244     UBYTE bDescriptorType;     /* Descriptor Type (0x24) */
  245     UBYTE bDescriptorSubType;  /* Subtype (0x01) */
  246     UBYTE bTerminalLink;       /* Terminal linked to this interface */
  247     UBYTE bDelay;              /* Delay in frames */
  248     UBYTE wFormatTag0;         /* Data Format (low byte) */
  249     UBYTE wFormatTag1;         /* Data Format (high byte) */
  250 };
  251 
  252 struct UsbVideoType1FormatDesc
  253 {
  254     UBYTE bLength;             /* Size of this descriptor */
  255     UBYTE bDescriptorType;     /* Descriptor Type (0x24) */
  256     UBYTE bDescriptorSubType;  /* Subtype (0x02) */
  257     UBYTE bFormatType;         /* Format Type I (0x01) */
  258     UBYTE bNrChannels;         /* Number of physical channels */
  259     UBYTE bSubframeSize;       /* Number of bytes occubied by one video subframe (1-4) */
  260     UBYTE bBitResolution;      /* Number of bits used in a subframe */
  261     UBYTE bSamFreqType;        /* 0 = continuous freq, otherwise number of discrete freqs */
  262     UBYTE tSamFreq0[3];        /* first sampling freq (or lower range) */
  263 };
  264 
  265 struct UsbVideoGeneralEPDesc
  266 {
  267     UBYTE bLength;             /* Size of this descriptor */
  268     UBYTE bDescriptorType;     /* Descriptor Type (0x25) */
  269     UBYTE bDescriptorSubType;  /* Subtype (0x01) */
  270     UBYTE bmAttributes;        /* bit 0: Sampling freq, bit 1: Pitch, bit 7 = MaxPktsOnly */
  271     UBYTE bLockDelayUnits;     /* 0=undef, 1=ms, 2=PCM samples */
  272     UBYTE wLockDelay0;         /* Delay until locked (low byte) */
  273     UBYTE wLockDelay1;         /* Delay until locked (high byte) */
  274 };
  275 #endif
  276 
  277 
  278 #if defined(__GNUC__)
  279 # pragma pack()
  280 #endif
  281 
  282 #endif /* DEVICES_USB_VIDEO_H */