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

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Wed Dec 17 06:42:14 GMT 2008


Author: douglask
Date: Wed Dec 17 06:41:51 2008
New Revision: 4342

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

Log:
V4L2 code fix to prevent infinite loops with broken VIDIOC_ENUM_FMT ioctls

Fix a dumb mistake with the setting of width_ and height_ 


Modified: vic/branches/mpeg4/video/grabber-v4l2.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-v4l2.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-v4l2.cpp	Wed Dec 17 06:41:51 2008
@@ -1147,8 +1147,10 @@
         }
 
         while ( !format_ok ) {
-                width_  = CIF_WIDTH  *2  / decimate_;
-                height_ = CIF_HEIGHT *2  / decimate_;
+                if (capture_standard == CS_VC) {
+                        width_  = CIF_WIDTH  *2  / decimate_;
+                        height_ = CIF_HEIGHT *2  / decimate_;
+                }
 
                 debug_msg("V4L2: format");
                 switch (cformat_) {
@@ -1188,7 +1190,10 @@
                         fmtd.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                         err = v4l2_ioctl(fd_, VIDIOC_ENUM_FMT, &fmtd);
                         if (err) {
-                                debug_msg("VIDIOC_ENUM_FMT returned error %d\n",errno);
+                                debug_msg("V4L2: VIDIOC_ENUM_FMT returned unexpected EINVAL error code\n");
+                                debug_msg("V4L2: giving up ...\n");
+                                format_ok = 1;
+
                         } else {
                                 if (fmtd.pixelformat == pixelformat) {
                                         memset(&fmt,0,sizeof(fmt));
@@ -1283,7 +1288,6 @@
                                                         default :
                                                                 debug_msg("V4L2: giving up ...\n");
                                                                 format_ok = 1;
-                                                                capture_standard = CS_VC;
                                                         }
                                                         break;
 
@@ -1300,7 +1304,6 @@
                 }
         }
 
-
         allocref();
 }
 



More information about the Sumover-dev mailing list