//#Rockie Cheng
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define CLEAR(x) memset (&(x), 0, sizeof (x)) //宏定义清楚
struct buffer {
void * start;
size_t length;
}; //定义一个buffer结构体,这个结构体用于盛放申请到的内存首地址和长度
static char *dev_name = "/dev/video0";//摄像头设备名
static int fd = -1; //文件描述符fd
struct buffer *buffers = NULL;
static unsigned int n_buffers = 0;
FILE *file_fd; //
static unsigned long file_length;
static unsigned char *file_name;
//获取一帧数据,
static int read_frame (void)
{
struct v4l2_buffer buf; //用于盛放一帧数据的信息
unsigned int i;
CLEAR (buf);
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
int ff = ioctl (fd, VIDIOC_DQBUF, &buf); //从视频缓冲区的输出队列中取得一个已经保存有一帧视频数据的视频缓冲区
if(ff<0)
推荐精选