uvc摄像头代码解析1

一.FAQ

1.判断自己的摄像头是否支持uvc标准

输入lsusb //列出usb设备

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0c45:62f1 Microdia 						//摄像头
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 1a40:0101 TERMINUS TECHNOLOGY INC. 
Bus 002 Device 003: ID 17ef:6025 Lenovo 

更详细的树形图lsusb -t

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=musb-hdrc/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/4p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=musb-hdrc/1p, 480M
    |__ Port 1: Dev 4, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=, 480M
    |__ Port 1: Dev 4, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=, 480M
    |__ Port 1: Dev 4, If 2, Class=audio, Driver=snd-usb-audio, 480M
    |__ Port 1: Dev 4, If 3, Class=audio, Driver=snd-usb-audio, 480M
lsusb -d 0c45:62f1 -v | grep "14 Video" 检测设备属性

bFunctionClasss      14 Video
bInterfaceClass 	   14 Video
bInterfaceClass 	   14 Video
bInterfaceClass 	   14 Video
bInterfaceClass 	   14 Video
bInterfaceClass 	   14 Video
bInterfaceClass 	   14 Video
bInterfaceClass 	   14 Video
bInterfaceClass 	   14 Video

显示类似上面信息表示该摄像头是支持uvc标准的

2.使能/关闭调试的trace打印信息

echo 0xffff > /sys/module/uvcvideo/parameters/trace
echo 0 > /sys/module/uvcvideo/parameters/trace

3.播放测试

mplayer tv:// -tv fps=25

 mplayer的交叉编译移植请参考http://blog.csdn.net/orz415678659/article/details/9469271

二.uvc类标准

1.下载标准协议地址

http://www.usb.org/developers/devclass_docs

2.功能特性(翻译)

Each video function has a single VideoControl (VC) interface and can have several VideoStreaming (VS) interfaces
每个视频有且仅有1个VideoControl (VC)接口和可有多个 VideoStreaming (VS) 接口

The VideoControl (VC) interface is used to access the device controls of the function whereas
the VideoStreaming (VS) interfaces are used to transport data streams into and out of the function.
VC接口用于设备功能控制,VS接口用于传输数据流进出

Video Interface Class Code(A.1 P171)

视频接口类代码 就是宏定义的USB_CLASS_VIDEO

总共有3种子类subclass

1.VideoControl Interface 视频控制接口子类

2.VideoStreaming Interface 视频数据流接口子类

3.Video Interface Collection 视频接口集合子类

宏定义

/* A.2. Video Interface Subclass Codes */
#define UVC_SC_UNDEFINED						0x00
#define UVC_SC_VIDEOCONTROL						0x01
#define UVC_SC_VIDEOSTREAMING					0x02
#define UVC_SC_VIDEO_INTERFACE_COLLECTION		0x03

Units provide the basic building blocks to fully describe most video functions ,A Unit has one or more Input Pins and a single Output Pin,
Unit提供了基础模块来全面描述大部分的视频功能,一个Unit可以由一个或多个输入引脚和仅一个输出引脚(这里的每一个pin代表一个逻辑上的数据流)

Unit可以通过pin引脚连接在一起,一个输出pin可以连接多个输入pin,但一个输入pin只能连接一个输出pin

uvc摄像头代码解析1_第1张图片

An Input Terminal (IT) is an entity that represents a starting point for data streams inside the video function.

一个输入Terminal (IT)终端是一个实体代表数据流的开始端点

An Output Terminal (OT) represents an ending point for data streams.

一个输出Terminal (OT)终端是一个实体代表数据流的结束端点

Terminals have one Input or Output Pin that is always numbered one.

Terminal只有1个输入或一个输出引脚pin

The Camera Terminal (CT) controls mechanical (or equivalent digital) features of the device component that transmits the video stream.

摄像头Terminal (CT)控制传输视频流的设备组件特性(Scanning Mode扫描模式 Auto-Exposure Mode自动曝光模式 Auto-Exposure Priority自动曝光优先级

Exposure Time 曝光时间 Focus聚焦 Auto-Focus自动聚焦 Simple Focus简单聚焦 Iris红外 Zoom放大 Pan摇动 Roll滚动 Tilt倾斜 Digital Windowing数字窗口

Region of Interest 感应区)

The Selector Unit (SU) selects from n input data streams and routes them unaltered to the single output stream.

选择Unit (SU)选择多个输入数据流并路由它们到单一的输出流


The Processing Unit (PU) controls image attributes of the video being streamed through it.

处理Unit (PU)控制流经它的视频流图像属性(【Brightness背光 Hue色度 Saturation饱和度 Sharpness锐度 Gamma伽马值 Digital Multiplier (Zoom)数字放大】

【White Balance Temperature白平衡色温 White Balance Component白平衡组件 Backlight Compensation背光补偿 Contrast对比度】

【Gain增益 Power Line Frequency电源线频率 Analog Video Standard模拟视频标准 Analog Video Lock Status模拟视频锁存状态】)

The Encoding Unit controls attributes of the encoder that encodes the video being streamed through it.

编码Unit (EU)控制流过的视频流编码的编码器的属性(...)

The Extension Unit (XU) is the method provided by this specification to add vendor-specific building blocks to the specification

扩展Unit (XU)提供厂商特殊控制模块方法

这样我们就可以用组件Terminal和Unit组成一个usb摄像头模型

uvc摄像头代码解析1_第2张图片

 uvc摄像头代码解析2

你可能感兴趣的:(linux,unit,Terminal,摄像头,uvc)