视频监控:
1,在UBUNTU下安装SDL库
2,运行,解读源程序
3, 两台pc机之间的视频监控
4,开发板上的usb视频驱动的移植
5,开发板和pc机之间的监控
SDL库:简易直控媒体层得缩写,用于直接控制底层的多媒体硬件的接口,framebuffer接口,支持 windows和linux,支持很多语言
SDL的安装:SDL-1.2.14.tar拷到linux中,解压,进入,执行.config文件(配置)生成makefile文件 ,make
1)v4l的数据结构 */
/* 在video4linux API中定义了如下数据结构,详细的数据结构定义可以参考v4l API的文档,这里就编程中经常使用的数据结构作出说明。 */
/* 首先我们定义一个描述设备的数据结构,它包含了v4l中定义的所有数据结构: */
typedef struct _v4ldevice
{
int fd;//设备号
struct video_capability capability;
struct video_channel channel[10];
struct video_picture picture;
struct video_clip clip;
struct video_window window;
struct video_capture capture;
struct video_buffer buffer;
struct video_mmap mmap;
struct video_mbuf mbuf;
struct video_unit unit;
unsigned char *map;//mmap方式获取数据时,数据的首地址
pthread_mutex_t mutex;
int frame;
int framestat[2];
int overlay;
}v4ldevice;
/* 下面解释上面这个数据结构中包含的数据结构,这些结构的定义都在中。 */
/* * struct video_capability */
/* name[32] Canonical name for this interface */
/* type Type of interface */
/* channels Number of radio/tv channels if appropriate */
/* audios Number of audio devices if appropriate */
/* maxwidth Maximum capture width in pixels */
/* maxheight Maximum capture height in pixels */
/* minwidth Minimum capture width in pixels */
/* minheight Minimum capture height in pixels */
/* 在程序中,通过ioctl函数的VIDIOCGCAP控制命令读写设备通道已获取这个结构,有关ioctl的使用,比较复杂,这里就不说了。下面列出获取这一数据结构的代码: */
int v4lgetcapability(v4ldevice *vd)
{
if(ioctl(vd->fd, VIDIOCGCAP, &(vd->capability)) < 0) {
v4lperror("v4lopen:VIDIOCGCAP");
return -1;
}
return 0;
}
/* * struct video_picture */
/* brightness Picture brightness */
/* hue Picture hue (colour only) */
/* colour Picture colour (colour only) */
/* contrast Picture contrast */
/* whiteness The whiteness (greyscale only) */
/* depth The capture depth (may need to match the frame buffer depth) */
/* palette Reports the palette that should be used for this image */
/* 这个数据结构主要定义了图像的属性,诸如亮度,对比度,等等。这一结构的获取通过ioctl发出VIDIOCGPICT控制命令获取。 *