[Sumover-dev] [svn commit] r4390 - vic/branches/mpeg4/video

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Thu Feb 12 13:30:01 GMT 2009


Author: douglask
Date: Thu Feb 12 13:29:58 2009
New Revision: 4390

Modified:
   vic/branches/mpeg4/video/grabber-v4l2.cpp

Log:
Clip horizontally (if necessary) V4L2 capture resolutions that satisfy the vertical resolution, but ignore resolutions that are very wide and most likely not square pixels (like the Kworld USB2800's 720x240 resolution)


Modified: vic/branches/mpeg4/video/grabber-v4l2.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-v4l2.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-v4l2.cpp	Thu Feb 12 13:29:58 2009
@@ -946,9 +946,16 @@
                                         if ( (err = v4l2_ioctl(fd_, VIDIOC_S_FMT, &fmt) ) )
                                                 debug_msg("\nV4L2: Failed to set format\n");
 
-                                        if ( fmt.fmt.pix.width > (unsigned int)width_ )
+                                        /* Clip horizontally (if necessary) capture resolutions that satisfy the
+                                         * vertical resolution, but ignore resolutions that are very wide and most
+                                         * likely not square pixels
+                                         */
+                                        if ( (fmt.fmt.pix.width > (unsigned int)width_ ) &&
+                                                               (fmt.fmt.pix.height == (unsigned int)height_) &&
+                                                               (fmt.fmt.pix.width < (2 * fmt.fmt.pix.height)) ) {
                                                 inw_ = width_ = fmt.fmt.pix.width;
-
+                                                debug_msg("V4L2: will clip input width=%d to %d\n", inw_, outw_);
+                                        }
 
                                         if ( ( fmt.fmt.pix.width == (unsigned int)width_ ) &&
                                                                 ( fmt.fmt.pix.height == (unsigned int)height_ ) )  {



More information about the Sumover-dev mailing list