当前位置:编程学习 > C/C++ >>

uvc摄像头代码解析1

一.FAQ
1.判断自己的摄像头是否支持uvc标准
输入lsusb //列出usb设备
[cpp]  
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
[cpp] 
/:  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='bInte易做图ceClass 0x0e not yet handled', Driver=, 480M  
    |__ Port 1: Dev 4, If 1, Class='bInte易做图ceClass 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" 检测设备属性
[cpp]  
bFunctionClasss      14 Video  
bInte易做图ceClass        14 Video  
bInte易做图ceClass        14 Video  
bInte易做图ceClass        14 Video  
bInte易做图ceClass        14 Video  
bInte易做图ceClass        14 Video  
bInte易做图ceClass        14 Video  
bInte易做图ceClass        14 Video  
bInte易做图ceClass        14 Video  
显示类似上面信息表示该摄像头是支持uvc标准的
2.使能/关闭调试的trace打印信息
[cpp] 
echo 0xffff > /sys/module/uvcvideo/parameters/trace  
echo 0 > /sys/module/uvcvideo/parameters/trace  
3.播放测试
[cpp] view plaincopy
mplayer tv:// -tv fps=25  
 
二.uvc类标准
1.下载标准协议地址
[cpp]  
http://www.usb.org/developers/devclass_docs  
2.功能特性(翻译)
Each video function has a single VideoControl (VC) inte易做图ce and can have several VideoStreaming (VS) inte易做图ces
每个视频有且仅有1个VideoControl (VC)接口和可有多个 VideoStreaming (VS) 接口
The VideoControl (VC) inte易做图ce is used to access the device controls of the function whereas
the VideoStreaming (VS) inte易做图ces are used to transport data streams into and out of the function.
VC接口用于设备功能控制,VS接口用于传输数据流进出
Video Inte易做图ce Class Code(A.1 P171)
视频接口类代码 就是宏定义的USB_CLASS_VIDEO
总共有3种子类subclass
1.VideoControl Inte易做图ce 视频控制接口子类
2.VideoStreaming Inte易做图ce 视频数据流接口子类
3.Video Inte易做图ce Collection 视频接口集合子类
宏定义
[cpp] v 
/* A.2. Video Inte易做图ce 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代表一个逻辑上的数据流)
补充:软件开发 , C++ ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,