[opencv] 17/98: Removed ioctl calls to query for VIDIOC_G_INPUT and VIDIOC_ENUMINPUT since information returned by the calls is never used. Fixed icvCaptureFromCAM_V4L return value in case of V4L2 camera initialization failure.
Mattia Rizzolo
mattia at debian.org
Tue Oct 4 17:51:19 UTC 2016
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to annotated tag 2.4.13
in repository opencv.
commit 389f176a67741b403275a4e16e1dc2f26a3e64fa
Author: Vitaly Tuzov <vitaly.tuzov at itseez.com>
Date: Mon Jan 18 12:54:53 2016 +0300
Removed ioctl calls to query for VIDIOC_G_INPUT and VIDIOC_ENUMINPUT since information returned by the calls is never used.
Fixed icvCaptureFromCAM_V4L return value in case of V4L2 camera initialization failure.
---
modules/highgui/src/cap_v4l.cpp | 47 +++--------------------------------------
1 file changed, 3 insertions(+), 44 deletions(-)
diff --git a/modules/highgui/src/cap_v4l.cpp b/modules/highgui/src/cap_v4l.cpp
index d09c8f8..2599cad 100644
--- a/modules/highgui/src/cap_v4l.cpp
+++ b/modules/highgui/src/cap_v4l.cpp
@@ -491,8 +491,6 @@ static int try_init_v4l2(CvCaptureCAM_V4L* capture, char *deviceName)
// 0 then detected nothing
// 1 then V4L2 device
- int deviceIndex;
-
/* Open and test V4L2 device */
capture->deviceHandle = open (deviceName, O_RDWR /* required */ | O_NONBLOCK, 0);
if (-1 == capture->deviceHandle)
@@ -514,28 +512,6 @@ static int try_init_v4l2(CvCaptureCAM_V4L* capture, char *deviceName)
return 0;
}
- /* Query channels number */
- if (-1 == ioctl (capture->deviceHandle, VIDIOC_G_INPUT, &deviceIndex))
- {
-#ifndef NDEBUG
- fprintf(stderr, "(DEBUG) try_init_v4l2 VIDIOC_G_INPUT \"%s\": %s\n", deviceName, strerror(errno));
-#endif
- icvCloseCAM_V4L(capture);
- return 0;
- }
-
- /* Query information about current input */
- CLEAR (capture->inp);
- capture->inp.index = deviceIndex;
- if (-1 == ioctl (capture->deviceHandle, VIDIOC_ENUMINPUT, &capture->inp))
- {
-#ifndef NDEBUG
- fprintf(stderr, "(DEBUG) try_init_v4l2 VIDIOC_ENUMINPUT \"%s\": %s\n", deviceName, strerror(errno));
-#endif
- icvCloseCAM_V4L(capture);
- return 0;
- }
-
return 1;
}
@@ -834,26 +810,6 @@ static int _capture_V4L2 (CvCaptureCAM_V4L *capture, char *deviceName)
return -1;
}
- /* The following code sets the CHANNEL_NUMBER of the video input. Some video sources
- have sub "Channel Numbers". For a typical V4L TV capture card, this is usually 1.
- I myself am using a simple NTSC video input capture card that uses the value of 1.
- If you are not in North America or have a different video standard, you WILL have to change
- the following settings and recompile/reinstall. This set of settings is based on
- the most commonly encountered input video source types (like my bttv card) */
-
- if(capture->inp.index > 0) {
- CLEAR (capture->inp);
- capture->inp.index = CHANNEL_NUMBER;
- /* Set only channel number to CHANNEL_NUMBER */
- /* V4L2 have a status field from selected video mode */
- if (-1 == ioctl (capture->deviceHandle, VIDIOC_ENUMINPUT, &capture->inp))
- {
- fprintf (stderr, "HIGHGUI ERROR: V4L2: Aren't able to set channel number\n");
- icvCloseCAM_V4L (capture);
- return -1;
- }
- } /* End if */
-
/* Find Window info */
CLEAR (capture->form);
capture->form.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -1157,6 +1113,9 @@ static CvCaptureCAM_V4L * icvCaptureFromCAM_V4L (int index)
}
#endif /* HAVE_CAMV4L */
#ifdef HAVE_CAMV4L2
+#ifndef HAVE_CAMV4L
+ return NULL;
+#endif /* !HAVE_CAMV4L */
} else {
V4L2_SUPPORT = 1;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git
More information about the debian-science-commits
mailing list