summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfred <fred@home.lan>2011-04-27 15:35:40 (GMT)
committer fred <fred@home.lan>2011-04-27 15:35:40 (GMT)
commit2919c5a795806564a22243eba141910f55ed8b75 (patch)
tree56b66a865adb8c3ddbfa61803f40d9b112c9f87a
parent1bc8962ddb916fedc66cd8d596d983fd2e2dbb14 (diff)
Sets the default v4l2 resolution to 640x480
- with my webcam, the image freezes if not set up with 640x480 resolution. Moved the m_res->setsX() to fill the list with the right resolution.
-rw-r--r--src/v4l2_layer.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/v4l2_layer.cpp b/src/v4l2_layer.cpp
index b6548bc..8d9955a 100644
--- a/src/v4l2_layer.cpp
+++ b/src/v4l2_layer.cpp
@@ -229,22 +229,22 @@ bool V4L2CamLayer::open(const char *devfile) {
return (false);
}
+///////////// does not work with my ricoh and the uvcvideo module .... just comment out if needed
+ format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ format.fmt.pix.width = 640;
+ format.fmt.pix.height = 480;
+ format.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
+ format.fmt.pix.field = V4L2_FIELD_ANY;
+ if(0 == ioctl(fd, VIDIOC_TRY_FMT, &format)) {
+ if(-1 == ioctl(fd, VIDIOC_S_FMT, &format)) {
+ error("VIDIOC_S_FMT: %s", strerror(errno));
+ return(false);
+ }
+ }
+
if (m_res) {
m_res->setsX(format.fmt.pix.width);
}
-///////////// does not work with my ricoh and the uvcvideo module .... just comment out if needed
-// format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-// format.fmt.pix.width = 352;
-// format.fmt.pix.height = 288;
-// format.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
-// format.fmt.pix.field = V4L2_FIELD_ANY;
-// if(0 == ioctl(fd, VIDIOC_TRY_FMT, &format)) {
-// std::cerr << "--- we should be able to setup the resolution :)" << std::endl;
-// if(-1 == ioctl(fd, VIDIOC_S_FMT, &format)) {
-// error("VIDIOC_S_FMT: %s", strerror(errno));
-// return(false);
-// }
-// }
// Need to find out (request?) specific data format (sec 1.10.1)
memset(&format, 0, sizeof(format));