camera/drv-v4l2.c
int v4l2CaptureSetImageFormat(V4L2Capture *capture,fourcc_t fourcc,VidSize *size){
  struct v4l2_format argp;
  int res;
	
  argp.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
  res = v4l_ioctl(capture,VIDIOC_G_FMT,&argp);
	
  if (!res){
    argp.fmt.pix.pixelformat = fourcc;
    if (size){
      argp.fmt.pix.width = size->width;
      argp.fmt.pix.height = size->height;
    }
    res = v4l_ioctl(capture,VIDIOC_S_FMT,&argp);
		
    capture_refresh_image_format(capture);	
		
  }
  return res;	
}
/**
 * @param capture The video capture structure
 * 
 * @param fourcc The fourcc code to be assigned for the device
 * @param size Pointer to v4lframesize for the input image's size. Pass a null pointer to use orignial size.
 * @Return Non-zero value to indicate error
 */
@param capture The video capture structure

@param fourcc The fourcc code to be assigned for the device
@param size Pointer to v4lframesize for the input image's size. Pass a null pointer to use orignial size.
@Return Non-zero value to indicate error
@param capture The video capture structure @param fourcc The fourcc code to be assigned for the device @param size Pointer to v4lframesize for the input image ' s size . Pass a null pointer to use orignial size . @Return Non - zero value to indicate error
int v4l2CaptureSetImageFormat(V4L2Capture *capture,fourcc_t fourcc,VidSize *size){
  struct v4l2_format argp;
  int res;
  argp.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
  res = v4l_ioctl(capture,VIDIOC_G_FMT,&argp);
  if (!res){
    argp.fmt.pix.pixelformat = fourcc;
    if (size){
      argp.fmt.pix.width = size->width;
      argp.fmt.pix.height = size->height;
    }
    res = v4l_ioctl(capture,VIDIOC_S_FMT,&argp);
    capture_refresh_image_format(capture);	
  }
  return res;	
}
int v4l2CaptureSetImageFormat ( V4L2Capture * capture , fourcc_t fourcc , VidSize * size ) { struct v4l2_format argp ; int res ; argp . type = V4L2_BUF_TYPE_VIDEO_CAPTURE ; res = v4l_ioctl ( capture , VIDIOC_G_FMT , & argp ) ; if ( ! res ) { argp . fmt . pix . pixelformat = fourcc ; if ( size ) { argp . fmt . pix . width = size -> width ; argp . fmt . pix . height = size -> height ; } res = v4l_ioctl ( capture , VIDIOC_S_FMT , & argp ) ; capture_refresh_image_format ( capture ) ; } return res ; }
@param capture The video capture structure
@param capture The video capture structure