- 论坛徽章:
- 0
|
硬件:三星i9220
软件:debian for arm 直接装在手机上的,利用chroot 进入debian.带编译器,直接在手机上编译的程序。
我想在底层运行一个摄像头监控程序,基于v4l2
cam_c_fp = open("/dev/video0", O_RDWR);
if (cam_c_fp < 0) {
printf("CODEC : Open Failed \n");
return -1;
}
int ret = ioctl(cam_c_fp , VIDIOC_QUERYCAP, &cap);
if (ret < 0) {
printf("V4L2 : ioctl on VIDIOC_QUERYCAP failled\n");
exit(1);
}
printf("V4L2 : Name of the interface is %s\n", cap.driver);
这里很正常,还能显示出Name of the interface is sec fimc driver.
然后运行到:
/* Set format */
codec_fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
codec_fmt.fmt.pix.width = LCD_WIDTH;
codec_fmt.fmt.pix.height = LCD_HEIGHT;
codec_fmt.fmt.pix.pixelformat= V4L2_PIX_FMT_YUV420;
ret = ioctl(cam_c_fp , VIDIOC_S_FMT, &codec_fmt);
即执行ioctl后,手机立马重启了。
请教各位这是由什么引起的呢?
是不是android不能直接这样做? |
|