Commit c43679bd authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Only register devices that have the capture capability.

parent eae0bed9
......@@ -629,9 +629,18 @@ static void msv4l2_detect(MSWebCamManager *obj){
if (fd!=-1){
if (v4l2_ioctl (fd, VIDIOC_QUERYCAP, &cap)==0) {
/* is a V4LV2 */
MSWebCam *cam=ms_web_cam_new(&v4l2_card_desc);
cam->name=ms_strdup(devname);
ms_web_cam_manager_add_cam(obj,cam);
uint32_t camera_caps = cap.capabilities;
#ifdef V4L2_CAP_DEVICE_CAPS
if (cap.capabilities & V4L2_CAP_DEVICE_CAPS) {
camera_caps = cap.device_caps;
}
#endif
if (((camera_caps & V4L2_CAP_VIDEO_CAPTURE) || (camera_caps & V4L2_CAP_VIDEO_CAPTURE_MPLANE))
&& !((camera_caps & V4L2_CAP_VIDEO_OUTPUT) || (camera_caps & V4L2_CAP_VIDEO_OUTPUT_MPLANE))) {
MSWebCam *cam=ms_web_cam_new(&v4l2_card_desc);
cam->name=ms_strdup(devname);
ms_web_cam_manager_add_cam(obj,cam);
}
}
close(fd);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment