-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathprogram_guide.txt
92 lines (78 loc) · 3.12 KB
/
program_guide.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
2012-2-1 10:00:30
jshwang
bsp调用顺序:
开系统时钟
TVD_init 一次性配置
TVD_config 配置接口、制式。composite支持ntsc和pal,最多可以四路composite,并且只能相同制式。ypbpr只支持480/576i
TVD_get_status 查询状态,注意在TVD_config调用后延时100ms后才可以检测状态
应用可以通过查询此状态来调整制式配置
TVD_set_width 设置宽
TVD_set_width_jump 设置跳转
TVD_set_height 设置高
TVD_set_fmt 设置格式,目前只支持planar yuv420
一切就绪
TVD_irq_enable 开启中断
TVD_capture_on 开始抓帧
关闭时
TVD_capture_off 关闭中断
TVD_irq_disable 停止抓帧
关闭系统时钟
===============================================================
linux驱动说明:
===============================================================
提供两个ioctl来设置和查询
VIDIOC_S_FMT、VIDIOC_G_FMT
注意类型是V4L2_BUF_TYPE_PRIVATE
对raw_data进行如下约定
raw_data[0]: interface --- 0=composite 1=ypbpr
raw_data[1]: system --- 0=ntsc/480i 1=pal/576i
raw_data[8]: row --- channel number in row
raw_data[9]: column --- channel number in column
raw_data[10]: channel_index[0] --- channel0 index, 0=disable, non-0=index
raw_data[11]: channel_index[1] --- channel1 index, 0=disable, non-0=index
raw_data[12]: channel_index[2] --- channel2 index, 0=disable, non-0=index
raw_data[13]: channel_index[3] --- channel3 index, 0=disable, non-0=index
interface表示接口,如复合视频和分量
system制式
row表示横向的通道数
column表示纵向的通道数
channel_index如果是0表示不适用该通路,是非零数字表示在屏幕的摆放位置,从左到右,从上到下,从1开始,最大为4
例如,四路复合视频、制式为ntsc、排成2*2,从左上角依次排放,则
interface=0, system=0, row=2, column=0, channel_index[0]=1, channel_index[1]=2, channel_index[2]=3, channel_index[3]=4
上层根据配置的row、column、system来得到显示尺寸
比如row=1, column=1, system=0, 则width=720, height=480
row=2, column=2, system=1, 则width=1440, height=1152
示例代码:
1)VIDIOC_S_FMT配置
///////////////////////////////////////////////////////////
// int fd = open ("/dev/video0", O_RDWR | O_NONBLOCK, 0);
struct v4l2_format fmt_priv;
CLEAR (fmt_priv);
fmt_priv.type = V4L2_BUF_TYPE_PRIVATE;
fmt_priv.fmt.raw_data[0] =0;//interface
fmt_priv.fmt.raw_data[1] =0;//system
fmt_priv.fmt.raw_data[8] =2;//row
fmt_priv.fmt.raw_data[9] =2;//column
fmt_priv.fmt.raw_data[10] =1;//channel_index
fmt_priv.fmt.raw_data[11] =2;//channel_index
fmt_priv.fmt.raw_data[12] =3;//channel_index
fmt_priv.fmt.raw_data[13] =4;//channel_index
if (-1 == ioctl (fd, VIDIOC_S_FMT, &fmt_priv)){
printf("VIDIOC_S_FMT error! \n");
return -1;
}
// close (fd);
///////////////////////////////////////////////////////////
2)VIDIOC_G_FMT查询
///////////////////////////////////////////////////////////
// int fd = open ("/dev/video0", O_RDWR | O_NONBLOCK, 0);
struct v4l2_format fmt_priv;
CLEAR (fmt_priv);
fmt_priv.type = V4L2_BUF_TYPE_PRIVATE;
if (-1 == ioctl (fd, VIDIOC_G_FMT, &fmt_priv)){
printf("VIDIOC_G_FMT error! \n");
return -1;
}
// close (fd);
///////////////////////////////////////////////////////////
其它操作VIDIOC_REQBUFS, VIDIOC_STREAMON, VIDIOC_STREAMOFF等跟摄像头操作类型