首页| 论坛| 消息

标题:大家帮我看看这个线程的问题,好吗?
作者:陈媛媛
日期:2007-01-10 11:06
内容:

vid_mmap等变量是全局的,
int v4lstart(int fd)
{
if (ioctl (fd, VIDIOCMCAPTURE, &vid_mmap) == -1) {
perror ("ioctl VIDIOCMCAPTURE");
munmap (map, vid_buf.size);
return -1;
}
vid_mmap.frame = 1;
if (ioctl (fd, VIDIOCMCAPTURE, &vid_mmap) == -1) {
perror ("ioctl VIDIOCMCAPTURE");
munmap (map, vid_buf.size);
return -1;
}
return 0;
}
char *v4lsyn(int fd,int i)
{int bytes = 3;
vid_mmap.frame = (i +1)%2;
i++;
if (ioctl (fd, VIDIOCSYNC, &vid_mmap.frame) == -1) {
perror ("ioctl VIDIOCSYNC");
munmap (map, vid_buf.size);
return (NULL);
}
map=map +vid_buf.offsets;
/*if (palette == VIDEO_PALETTE_YUV420P) {
if (verbose)
fprintf (stderr, "converting from YUV to RGB\n");
convmap = malloc ( width * height * bytes );
v4l_yuv420p2rgb (convmap, map, width, height, bytes * 8);
memcpy (map, convmap, (size_t) width * height * bytes);
free (convmap);
}*/
convmap =(unsigned char *) malloc ( width * height * bytes );
v4l_yuv420p2rgb (convmap, map, width, height, bytes * 8);
memcpy (map, convmap, (size_t) width * height * bytes);
free (convmap);

return ((char *)map);
}
int v4lcapture(int fd)
{
if (ioctl (fd, VIDIOCMCAPTURE, &vid_mmap) == -1)
{
perror ("ioctl VIDIOCMCAPTURE");
mun ..

回复 发表
主题 版块