app-camera.c测试程序
#include "v4l.h"
v4l_device vd;
void main()
{
v4l_open(DEFAULT_DEVICE,&vd);
v4l_mmap_init(&vd);
v4l_grab_init(&vd,320,240);
v4l_grab_sync(&vd);
/*while(1)
{
vd.frame_current^=1;
v4l_grab_frame(&vd,vd.frame_current);
v4l_grab_sync(&vd);
}*/
v4l_close(&vd);
}
编译运行结果出乎意料产生了v4l_get_capability fail : Invalid argument或者VIDIOCGCAP:Invalid argument,只要是使用v4l给的ioctl命令都是这样的错误,如图3所示
图3
老外是这样讲的:I'm having some issue working with V4L (the API that provides unified access to various video capturing for Linux). I'm tryng to make a VIDIOCGCAP ioctl call, but I get an INVALID ARGUMENT error. 并贴上了自己的调试结果和源码,如图4。
图4
然后当真,就有人回复Perhaps you need to try using V4L2 instead, namely the VIDIOC_QUERYCAP ioctl.大致意思是你使用v4l2试一试,命令宏都差不多。如图5。
图5
ok,it works...我表示和这个老外一样的惊讶。
例如,FYI, V4L is an antiquated interface and most new devices are brought-up with V4L2 support.