摄像头驱动程序的移植前期准备和基本框架

 

视频监控:

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控制命令获取。 *

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值