From fc485af1be847bf3ea7429514b452c04bcf9e660 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 23 Jun 2010 09:34:22 +0000 Subject: [PATCH] Minor comment fixes --- panda/src/vision/webcamVideoCursorV4L.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/panda/src/vision/webcamVideoCursorV4L.cxx b/panda/src/vision/webcamVideoCursorV4L.cxx index ffa520636b..cc0564d0c0 100644 --- a/panda/src/vision/webcamVideoCursorV4L.cxx +++ b/panda/src/vision/webcamVideoCursorV4L.cxx @@ -146,6 +146,8 @@ WebcamVideoCursorV4L(WebcamVideoV4L *src) : MovieVideoCursor(src) { return; } + // Find the best format in our _pformats vector. + // MJPEG is preferred over YUYV, as it's much smaller. _format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; pvector::iterator it; for (it = src->_pformats.begin(); it != src->_pformats.end(); ++it) { @@ -168,14 +170,10 @@ WebcamVideoCursorV4L(WebcamVideoV4L *src) : MovieVideoCursor(src) { return; } - // No interlacing - _format->fmt.pix.field = V4L2_FIELD_NONE; - - // This really should be there, but for - // some reason it causes weird memory corruption. - + // Request a format of this size, and no interlacing _format->fmt.pix.width = _size_x; _format->fmt.pix.height = _size_y; + _format->fmt.pix.field = V4L2_FIELD_NONE; // Now politely ask the driver to switch to this format if (-1 == ioctl(_fd, VIDIOC_S_FMT, _format)) { @@ -211,6 +209,7 @@ WebcamVideoCursorV4L(WebcamVideoV4L *src) : MovieVideoCursor(src) { vision_cat.error() << "Not enough memory!\n"; } + // Set up the mmap buffers struct v4l2_buffer buf; for (int i = 0; i < _bufcount; ++i) { memset(&buf, 0, sizeof buf);