Logo Search packages:      
Sourcecode: camstream version File versions  Download package

bool CVideoDevice::SetSize ( int  width,
int  height 

Set a new image size.

FALSE when the call failed, TRUE when the new size was accepted by the device.
This function will attempt to set a new image size; not all sizes between the minimum and maximum size may be allowed by the device; however, there is currently no way to retrieve a list of possible sizes. It is safest to stick to CIF (352x288) and SIF (320x240) formats and subsizes hereof, and VGA. Also it's wise to use to multiples of 8 in both directions. SetSize will return FALSE when the size was rejected by the driver.

Definition at line 799 of file VideoDevice.cc.

References GetSize(), MCapture(), MSync(), and Resized().

Referenced by SetSize().

   struct video_window vwin;

printf("CVideoDevice::SetSize(%d, %d)\n", width, height);
   if (CamFD < 0 || width > max_w || height > max_h)
     return FALSE;
   if (ioctl(CamFD, VIDIOCGWIN, &vwin) < 0) {
     perror("GWIN: ");
     return FALSE;
   MSync(); // Drop current frame if we're mmap()ing

   memset(&vwin, 0, sizeof(vwin));
   vwin.width = width;
   vwin.height = height;
   vwin.clipcount = 0;
   if (ioctl(CamFD, VIDIOCSWIN, &vwin) < 0) {
   else {
     /* Read back; it might be the hardware decides a bit differently 
        (for example, multiples of 8)
     if (image_w == 0 && image_h == 0) /* woops */
       return FALSE;

   // Reset images
   if (PalRGB) {
   if (PalYUV) {

   emit Resized(QSize(image_w, image_h));
   return TRUE;

Generated by  Doxygen 1.6.0   Back to index