UVC是屬於USB行業規范中的USB設備類規范,用於USB接口的視頻設備的一個統一的數據交換規范。其中UVC官方協議文檔 UVC 1.5 Class specification是對整個UVC協議的框架做了規范,USB_Video_Example則規定了描述符等的數據結構和相關的一些其他相關規定。
1、UVC概述
在UVC規范中明確要求,具有實際UVC功能的視頻設備只要需要兩種接口:一種為VC Interface(視頻控制接口),VS Interface(視頻流接口)。其中VC接口用於對UVC設備進行配置操控,而VS接口則用於負責傳輸視頻數據流,兩者相互配合完成UVC設備功能。
2、UVC拓撲結構
UVC的將設備在拓撲結構上抽象成為了幾個主要的硬件功能模塊,有以下幾種:
輸入端點(Input Terminal)
輸出端點(Output Terminal)
camera端點(Camera Terminal)
選擇單元(Selector Unit)
處理單元(Processing Unit)
拓展單元(Extension Unit)
在USB_Video_Example 1.5中以一個網絡攝像頭設備為例展現其拓撲結構的示例圖如下:
從Sensor和另一個復合視頻設備得到的數據流由CT和IT輸入,經過SU選擇送到PU處理,再由OT綁定到指定的USB端點。最后由USB端點與主機交互數據發送到host。在實際的UVC設備設備中,可能沒有上圖中的一些功能某塊,可能只有其中一些模塊來完成的。
同時從上面的拓撲結構圖可以看出,左半部分框架組成了UVC中的VC接口部分,右半部分框架組成了VS接口部分。
3、概念補充
3.1 Terminal(端點)
Terminal是指整個UVC功能的入口和出口,邏輯意義上講Terminal只有一個出口或者入口,它要么代表整個UVC功能的數據輸入點,要么代表數據在流經UVC內部的各Unit功能單元后的最終流出點。
1)IT(輸入端點)
An Input Terminal (IT) is an entity that represents a starting point for data streams inside the video function.
一個輸入Terminal (IT)終端是一個實體,代表數據流的開始端點
輸入端點一般在拓撲圖中用下圖表示:
2)OT(輸出端點)
An Output Terminal (OT) represents an ending point for data streams.
一個輸出Terminal (OT)終端是一個實體,代表數據流的結束端點。
輸出端點一般在拓撲圖中用下圖表示:
3)CT(Camera端點)
CT代表硬件上的數據采集源(sensor),用於控制視頻流傳輸中的設備特性的。它規定支持以下特性控制:
Scanning Mode (Progressive or Interlaced):掃描模式(逐行掃描或隔行掃描)
Auto-Exposure Mode:自動曝光模式
Auto-Exposure Priority:自動曝光優先級
Exposure Time:曝光時間
Focus:聚焦
Auto-Focus:自動聚焦
Simple Focus:簡單聚焦
Iris:可變光圈
Zoom:縮放/變焦
Pan:移動鏡頭
Roll:滾動
Tilt:傾斜
Digital Windowing:數字窗口
Region of Interest:感興趣區域
3.2 Unit(單元)
Unit可以理解為構建出UVC設備功能的各功能單元,多個Unit按照一定的規則連接后就是一個完整的UVC功能設備。Spec規定Unit有一個或多個入口,一個出口;也就是說可以有多個Unit或Terminal作為一個Unit的輸入源頭,而數據在流經Unit后僅能作為其他Unit或Terminal的一個輸入源頭。
規范1.5中定義了四種Unit:
Selector Unit (SU),Processing Unit (PU),Extension Unit (EU),Extension (XU)
1)SU(選擇單元)
SU單元用來控制圖像數據采集源的切換和選擇。例如上面相機拓撲圖有兩個數據輸入源,這時需要SU來進行切換和選擇。
選擇單元一般在拓撲圖中用下圖表示:
2)PU(處理單元)
PU代表對采集所得圖像數據進行加工的單元,負責對采集到的圖像特性進行調整設置,主要有以下一些特性:
User Controls
Brightness(背光)
Contrast(對比度)
Hue(色度)
Saturatio(飽和度)
Sharpness(銳度)
Gamma(伽馬)
Digital Multiplier (Zoom)(數字放大)
Auto Controls
White Balance Temperature(白平衡色溫)
White Balance Component(白平衡組件)
Blcklight Compensation(背光補償)
Contrast(對比度)
Other
Gain(增益)
Power Line Frequency(功率線平率)
Analog Video Standard(模擬視頻標准)
Analog Video Lock Status(模擬視頻死鎖狀態)
處理單元一般在拓撲圖中用下圖表示:
3)EU(編碼單元)

4)XU(擴展單元)
XU是為了特定供應商添加規范而提供的單元。
擴展單元一般在拓撲圖中用下圖表示:
3.3、Video Control Interface(視頻控制接口)
VC主要用於控制UVC功能中的Units和Terminals,通過對不同的Units和Terminals下發不同的指令,從而影響UVC設備的當前工作狀態;Host端下發的所有對UVC設備的操縱控制命令都是經由此Interface完成的。以上面拓撲圖所表示的設備為例:
該設備包含了一個Processing Unit、一個Input Terminal、Output Terminal和Selector Unit,VC Interface需要對它們下發不同的命令,為此VC Interface需要包含一個控制端點(強制性要求),它使用的就是每個USB設備中默認的端點0。另外一個Interrupt端點則是可選的,用來返回或通知Host端當前的UVC設備內部狀態有變化。大部分情況下,一個UVC設備的VC Interface不需一定要實現此端點,但一旦UVC設備需要實現某些特定feature時,Spec會強制性要求實現該interrupt端點。
3.4、Video Streaming Interface(視頻流接口)
VS Interface則專注與負責傳輸UVC設備的Video數據到Host端。若一UVC設備支持n種格式的Video數據,則它需要實現n個VS Interface,每個Interface對應一種專門的數據格式;
3.5、Video Interface Collection(視頻接口集合)&&Interface Association Description(視頻關聯描述符)

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 co-reside 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 Interface Collections can be dynamic in devices that support multiple operating modes. Because the VideoControl interface, together with its associated VideoStreaming interface(s), constitutes the ‘logical interface’ to the video function, they must all come into existence at the same moment in time. Changing the operating mode of a device causes the previous Video Interface Collection to be replaced with a new Video Interface Collection, followed by reinitialization of the host software. This specification does not provide a mechanism for the host to initiate such a mode change, which is typically initiated via a physical switch on the device.As stated earlier, video functionality is located at the interface level in the device class hierarchy.The following sections describe the Video Interface Collection, containing a single VideoControl interface and optional VideoStreaming interfaces, together with their associated endpoints that are used for video function control and for data stream transfer. 中: 一個設備可以支持多種配置,每個配置內可能有多個接口,每個接口可能會被輪流設置。這些接口可能存在於同一復合設備的不同功能中。幾個獨立的視頻功能可能存在於同一設備內,屬於同一功能的接口被分配到視頻接口集合用IAD描述。如果設備包含多個獨立的視頻功能,那么就可能存在多個視頻接口集合(個人理解為一個獨立的視頻功能對應一個集合)。 比如一個裝配有內置麥克風的桌面照相機作為一個例子。有一個接口集合去處理對音頻功能的控制與配置,另外一個接口集合則去處理視頻方面的控制與配置。在其中一個接口集合中,VC接口會對該功能內部進行控制,另外一個VS接口則去處理來自相機視頻子系統傳輸過來的數據。 視頻接口集合在支持多個操作模式的設備中是動態的。因為VC接口和VS接口組成視頻功能中的“邏輯接口”,它們必須在同一時刻同時存在。改變設備的操作模式則之前的視頻接口集合也會被新的視頻接口集合替換,緊隨着由主機軟件重新初始化。本說明書中沒有提供用於主機的機制來啟動這樣的模式改變,這是通過設備上的物理開關啟動的。 如上所述,視頻功能位於設備類結構層次的接口層。接下來的章節將描述視頻接口集合,包含了單個VC接口和可選的VS接口,結合它們的關聯端點用於將視頻功能控制和數據流傳輸。
- 設備描述符(Device Descriptor)
- 設備限定描述符(Device QualifierDescriptor)
- 設備配置描述符(Configure Descriptor)
- 其他速度描述符(Other Speed Descriptor)
- 字符描述符(String Descriptor)
- 接口聯合描述符(Interface Association Descriptor)
- 視頻控制接口描述符(VideoControl Interface Descriptor)
-
視頻控制端點描述符(VideoControl Endpoint Descriptor)
-
視頻流接口描述符(VideoStreaming Interface Descriptor)
-
視頻流端點描述符(VideoStreaming Endpoint Descriptor)
- 接口控制請求(Interface Control Request)
- Camera終端控制請求(Camera Terminal Control Request)
- 選擇單元控制請求(Selector Unit Control Request)
-
處理單元控制請求(Processing Unit Control Request)
-
擴展單元控制請求(Extension Unit Control Request)