UVC
UVC
CHAPTER 2 FUNCTIONAL CHARACTERISTICS The video function is located at the interface level.
The interface descriptor could be seen as a header or grouping of the endpoints into a functional group performing a single feature of the device. For example you could have a multi-function fax/scanner/printer device. Interface descriptor one could describe the endpoints of the fax function, Interface descriptor two the scanner function and Interface descriptor three the printer function. Unlike the configuration descriptor, there is no limitation as to having only one interface enabled at a time. A device could have 1 or many interface descriptors enabled at once.
We can establish the following hierarchy: A Video Function One Video Control (VC) Interface One or more Video Streaming (VS) Interfaces. VC + VS = Video Interface Collection (VIC) Descriptor (IAD) Which is described by a Interface Association
In order to belong to the Video Interface Class, the only requirement is that it exposes one VC since the VS interfaces are optional. Video Interface Class subclasses Video Function Topology To be able to manipulate the physical properties of a video function, its functionality must be divided into addressable entities. The following two generic entities are identified: Units Terminals Units Units provide the basic building blocks to fully describe most video functions. Video functions are built by connecting together several of these Units. A Unit has one or more Input Pins and a single Output Pin, where each Pin represents a cluster of logical data streams inside the video function. Units are wired together by connecting their I/O Pins according to the required topology. A single Output Pin can be connected to one or more Input Pins (fan-out allowed). However, a single Input Pin can only be connected to one Output Pin (fan-in disallowed). Loops or cycles within the graph topology are not allowed. Video Control Interface Video Streaming Interface
Input pins
1 n
Unit
1 Output pin
Terminals In addition, the concept of Terminal is introduced. There are two types of Terminals. An Input Terminal (IT) is an entity that represents a starting point for data streams inside the video function. An Output Terminal (OT) represents an ending point for data streams. From the video functions perspective, a USB endpoint is a typical example of an Input Terminal or Output Terminal. It either provides data streams to the video function (IT) or consumes data streams coming from the video function (OT). Likewise, a Charge Coupled Device (CCD) sensor, built into the video function is represented as an Input Terminal in the video functions model. Connection to a Terminal is made through its single Input Pin or Output Pin. Input Pins of a Unit are numbered starting from one up to the total number of Input Pins on the Unit. The Output Pin number is always one. Terminals have one Input or Output Pin that is always numbered one. The data through the I/O pins can be digital, analog or hybrid. Each element has a descriptor: Units Unit Descriptor (UD) Terminals Terminal Descriptor (TD)
Units and Terminals Common * Input Terminal * Output Terminal * Selector Unit * Processing Unit * Extension Unit Especific * Media Transport Terminal * Camera Terminal
Video Control
Properties: * Current setting * Minimum setting * Maximum setting * Resolution * Size * Default
Input Terminals The Host needs to use both the endpoint descriptors and the Input Terminal descriptor to get a full understanding of the characteristics and capabilities of the Input Terminal. Stream-related parameters are stored in the endpoint descriptors. Control-related parameters are stored in the Terminal descriptor. Output Terminals The Host needs to use both the endpoint descriptors and the Output Terminal descriptor to fully understand the characteristics and capabilities of the Output Terminal. Stream- related parameters are stored in the endpoint descriptors. Control-related parameters are stored in the Terminal descriptor. Camera Terminal The Camera Terminal (CT) controls mechanical (or equivalent digital) features of the device component that transmits the video stream. As such, it is only applicable to video capture devices with controllable lens or sensor characteristics. A Camera Terminal is always represented as an Input Terminal with a single output pin. Selector Unit The Selector Unit (SU) selects from n input data streams and routes them unaltered to the single output stream. It represents a source selector, capable of selecting among a number of sources. It has an Input Pin for each source stream and a single Output Pin. Processing Unit The Processing Unit (PU) controls image attributes of the video being streamed through it. It has a single input and output pin. Extension Unit The Extension Unit (XU) is the method provided by this specification to add vendor-specific building blocks to the specification. The Extension Unit can have one or more Input Pins and has a single Output Pin. Operational Model A device can support multiple configurations. Within each configuration can be multiple interfaces, each possibly having alternate settings. These interfaces can pertain to different functions that coreside in the same composite device. Several independent video functions can exist in the same device. Interfaces that belong to the same video function are grouped into a Video Interface Collection described by an Interface Association Descriptor. If the device contains multiple independent video functions, there must be multiple Video Interface Collections (and hence multiple Interface Association Descriptors), each providing full access to their associated video function. As an example of a composite device, consider a desktop camera equipped with a built in microphone. Such a device could be configured to have one interface collection dealing with configuration and control of the audio function, while another interface collection deals with its video aspects. One of those, the VideoControl interface, is used to control the inner workings of the
function, whereas the other, the VideoStreaming interface, handles the data traffic received from the camera video subsystem. Video Control Interface This interface can contain the following endpoints. A control endpoint for manipulating Unit and Terminal settings and retrieving the state of the video function. This endpoint is mandatory, and the default endpoint 0 is used for this purpose. An interrupt endpoint for status returns. This endpoint is optional, but may be mandatory under certain conditions. Video Streaming Interface VideoStreaming interfaces are used to interchange digital data streams between the Host and the video function. A Video Function can have zero or more VideoStreaming Interfaces. Each VideoStreaming interface can have: One isochronous or bulk data endpoint for video . An optional dedicated bulk endpoint for still images related to the video .
A VideoStreaming interface with isochronous endpoints must have alternate settings that can be used to change certain characteristics of the interface and underlying endpoint(s). A typical use of alternate settings is to provide a way to change the bandwidth requirements an active isochronous pipe imposes on the USB. All devices that transfer isochronous video data must incorporate a zerobandwidth alternate setting for each VideoStreaming interface that has an isochronous video endpoint, and it must be the default alternate setting (alternate setting zero). A device offers to the Host software the option to temporarily relinquish USB bandwidth by switching to this alternate setting. The zero-bandwidth alternate setting does not contain a VideoStreaming isochronous data endpoint descriptor. A VideoStreaming interface containing a bulk endpoint for streaming shall support only alternate setting zero. Additional alternate settings containing bulk endpoints are not permitted in a device that is compliant with the Video Class specification. If a VideoStreaming interface with an isochronous endpoint supports a set of video parameter combinations (including video format, frame size and frame rate) that utilize significantly varying amounts of bandwidth across all combinations, it is recommended that the VideoStreaming interface support a range (greater than two) of alternate interface settings with varying maximum packet sizes. By doing so, the host would be able to select an appropriate alternate setting for the given video parameter combination that makes most efficient use of bus bandwidth. Negotiation The optimal allocation of the USB bandwidth to match the functions bandwidth requirement is achieved via negotiation between the host and the device. The negotiation process allows the host to provide preferred stream parameters to the device, while the device selects the best combination of streaming parameters and reports the maximum bandwidth usage for those settings. The host will use the bandwidth information to identify the
optimal alternate interface. The device is responsible for choosing the live streaming parameters once the bandwidth is allocated. These parameters may be different than originally agreed upon during the negotiation process. However, during the negotiation process, the host provided hints to the device indicating the preferred way to choose the live stream parameters. Video Streaming and Still Images (protocols and other stuff)
Control Transfers Control Transfers such as GET_CUR and SET_CUR are composed of three basic stages: Setup, Data and Status. A same control can not request a new control transfer until the previous one is complete, another control transfers from another controls can be performed at this time. When there is an error on the control transfer process a stall status is done on the Data stage and then the transfer is terminated. When the Data Stage requires more than 10ms to produce the State Change it must send the Status Stage with a Status Interrupt flag activated, so if the host supports interrupts it will be able to query another Control Transfers of different controls, when the device has changed it Status it sends a Control Change Interrupt to let it know to the host about the change (or error in the worst case).
For a more detailed information see page 40 of USB Video Class Definition for Video Devices.
Status Interrupts
A USB VideoControl interface can support an optional interrupt endpoint to inform the Host about the status of the different addressable entities (Terminals, Units, interfaces and endpoints) inside the video function. The interrupt endpoint, if present, is used by the entire Video Interface Collection to convey status information to the Host. It is considered part of the VideoControl interface because this is the anchor interface for the Collection. This interrupt endpoint is mandatory if: The device supports hardware triggers for still image capture. The device implements any AutoUpdate controls (controls supporting device initiated changes). The device implements any Asynchronous controls. A Control shall support Control Change events if any of the following is true: The Control state can be changed independently of host control. The Control can take longer than 10ms from the start of the Data stage through the completion of the Status stage when transferring to the device (SET_CUR operations). The device indicates support for the Control Change event for any particular control via the GET_INFO attribute .
When the control interrupt is set, the host will wait for the interrupt before send any other request to the same control.