From: Dominic L. <ma...@us...> - 2005-10-19 20:54:41
|
Update of /cvsroot/robotflow/RobotFlow/Devices/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23150/include Modified Files: V4L2Capture.h Log Message: fixed segfault, default to RGB24 Index: V4L2Capture.h =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/Devices/include/V4L2Capture.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** V4L2Capture.h 19 Oct 2005 20:41:35 -0000 1.10 --- V4L2Capture.h 19 Oct 2005 20:54:33 -0000 1.11 *************** *** 25,28 **** --- 25,29 ---- #include <linux/videodev2.h> #include "Image.h" + #include "Object.h" namespace RobotFlow { *************** *** 32,36 **** #define DEFAULT_WIDTH 320 #define DEFAULT_HEIGHT 240 ! #define DEFAULT_FORMAT V4L2_PIX_FMT_RGB555 class capture { --- 33,37 ---- #define DEFAULT_WIDTH 320 #define DEFAULT_HEIGHT 240 ! #define DEFAULT_FORMAT V4L2_PIX_FMT_RGB24 class capture { *************** *** 54,58 **** buffer * buffers; unsigned int n_buffers; ! Image *m_image; --- 55,59 ---- buffer * buffers; unsigned int n_buffers; ! FD::ObjectRef m_image; *************** *** 65,69 **** buffers = NULL; n_buffers = 0; - m_image = NULL; } --- 66,69 ---- *************** *** 80,87 **** stop_capturing (); uninit_device (); ! close_device (); ! if (m_image) { ! delete m_image; ! } } --- 80,84 ---- stop_capturing (); uninit_device (); ! close_device (); } *************** *** 104,111 **** fputc ('.', stdout); fflush (stdout); //allocate image ! m_image = Image::alloc(DEFAULT_WIDTH,DEFAULT_HEIGHT,2); //copy image ! memcpy(m_image->get_data(),p, DEFAULT_WIDTH * DEFAULT_HEIGHT * 2); } --- 101,113 ---- fputc ('.', stdout); fflush (stdout); + //allocate image ! Image *image = Image::alloc(DEFAULT_WIDTH,DEFAULT_HEIGHT,3); ! //copy image ! memcpy(image->get_data(),p, DEFAULT_WIDTH * DEFAULT_HEIGHT * 3); ! ! m_image = FD::ObjectRef(image); ! } *************** *** 205,209 **** } ! Image* mainloop (void) { for (;;) { --- 207,211 ---- } ! FD::ObjectRef mainloop (void) { for (;;) { *************** *** 534,538 **** /* Buggy driver paranoia. */ ! min = fmt.fmt.pix.width * 2; if (fmt.fmt.pix.bytesperline < min) fmt.fmt.pix.bytesperline = min; --- 536,540 ---- /* Buggy driver paranoia. */ ! min = fmt.fmt.pix.width * 3; if (fmt.fmt.pix.bytesperline < min) fmt.fmt.pix.bytesperline = min; |