您的位置:首页 > 其它

UVC 摄像头驱动(一)硬件描述

2016-11-12 23:12 561 查看

虚拟摄像头驱动vivi

内核中使用 video_device 结构来描述一个 video 设备,以虚拟摄像头驱动 vivi 为例,整体框架无非是:

分配一个 video_device

设置 video_device 的众多的 ioctl 等

注册 video_register_device

对于一个虚拟摄像头驱动来说,上层应用程序无论是来查询视频格式,还是设置格式,我们都是伪造的,视频缓冲区的数据也更是伪造的。那么对于一个真正的usb 摄像头来说,设备的信息比如它支持的视频格式等,我们就要通过分析 usb 的描述符,视频数据要通过访问 usb 设备来获取。

uvc摄像头驱动

uvc 摄像头驱动,首先它是一个 usb 设备驱动,对于 usb 设备驱动整体框架也可以分为三步:

分配 usb_driver 结构体

设置 usb_driver 结构

设置 it_table 表示驱动支持哪些 usb 设备

probe 函数

分配 video_device

设置 video_deivce

注册 video_register_device

注册 usb_register

摄像头硬件模型

协议下载

uvc == usb video class ,标准协议可以从 usb.org下载,所有的标准协议都可以下载到,比如 Mass Storage 、HID …

硬件模型

摄像头硬件模型可以大致分为以下两部分,VC interface 和 VS interface



VC interface 用于控制,内部又分为多个 unit 和 terminal ,unit 用于内部处理,terminal 用于内外链接。

VS interface 用于传输,内部包括视频数据传输的端点以及摄像头支持的视频格式等信息。

功能特性(翻译)

Each video function has a single VideoControl (VC) interface and can have several VideoStreaming (VS) interfaces

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.

每个视频有且仅有1个VideoControl (VC)接口和可有多个 VideoStreaming (VS) 接口,VC接口用于设备功能控制,VS接口用于传输数据流进出

VC 内部抽象出了两个概念 unit 和 terminal

Unit

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



[b]Select Unit[/b]

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

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



[b]Processing Unit[/b]

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



处理Unit (PU)控制流经它的视频流图像属性。

User Controls

Brightness

Hue

Saturation

Sharpness

Gamma

Digital Multiplier (Zoom)

Auto Controls

White Balance Temperature

White Balance Component

Backlight Compensation

Contrast

Other

Gain

Power Line Frequency

Analog Video Standard

Analog Video Lock Status

Terminal

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

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

[b]Input Terminal[/b]

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

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



[b]Out Terminal[/b]

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

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



[b]Camera Terminal[/b]

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

CameraTerminal (CT)控制传输视频流的设备组件特性

Scanning Mode扫描模式

Auto-Exposure Mode自动曝光模式

Auto-Exposure Priority自动曝光优先级

Exposure Time 曝光时间

Focus聚焦

Auto-Focus自动聚焦

Simple Focus简单聚焦

Iris红外

Zoom放大

Pan摇动

Roll滚动

Tilt倾斜

Digital Windowing数字窗口
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息