camera/drv-v4l2.c
static int capture_query_image_format(V4L2Capture *dev){
  int res;
  int i;
  int fd = dev->fd;
	
  int max = 20;
  struct v4l2_fmtdesc argp;

  dev->imageformat_list = malloc(sizeof(int) * (max+1));
  dev->imageformat_list[0] = 0;
	
  argp.type = V4L2_BUF_TYPE_VIDEO_CAPTURE ;
  i = 0;
		
  while (1){
    argp.index = i;
    res = ioctl(fd,VIDIOC_ENUM_FMT,&argp);
    if (res){
      break;
    } else {
			
      dev->imageformat_list[i++] = argp.pixelformat;

      //			DPRINTF("Supported image format[%d] = %s \n",i-1,
      //				vidFourccToString(argp.pixelformat) ? vidFourccToString(argp.pixelformat) : "Unknown"
      //				);
      //DPRINTF("%08x\n",argp.pixelformat);

      if (i>=max){
        max+=10;
        dev->imageformat_list=realloc(dev->imageformat_list,sizeof(int) * (max+1));
      }									
    }
  }
  dev->imageformat_list[i]=0;
  //}
  return i;
}
/// Query the supported image formats(in fourcc) for Video Capture Stream.
Query the supported image formats(in fourcc) for Video Capture Stream.
Query the supported image formats ( in fourcc ) for Video Capture Stream .
static int capture_query_image_format(V4L2Capture *dev){
  int res;
  int i;
  int fd = dev->fd;
  int max = 20;
  struct v4l2_fmtdesc argp;
  dev->imageformat_list = malloc(sizeof(int) * (max+1));
  dev->imageformat_list[0] = 0;
  argp.type = V4L2_BUF_TYPE_VIDEO_CAPTURE ;
  i = 0;
  while (1){
    argp.index = i;
    res = ioctl(fd,VIDIOC_ENUM_FMT,&argp);
    if (res){
      break;
    } else {
      dev->imageformat_list[i++] = argp.pixelformat;
      if (i>=max){
        max+=10;
        dev->imageformat_list=realloc(dev->imageformat_list,sizeof(int) * (max+1));
      }									
    }
  }
  dev->imageformat_list[i]=0;
  return i;
}
static int capture_query_image_format ( V4L2Capture * dev ) { int res ; int i ; int fd = dev -> fd ; int max = 20 ; struct v4l2_fmtdesc argp ; dev -> imageformat_list = malloc ( sizeof ( int ) * ( max + 1 ) ) ; dev -> imageformat_list [ 0 ] = 0 ; argp . type = V4L2_BUF_TYPE_VIDEO_CAPTURE ; i = 0 ; while ( 1 ) { argp . index = i ; res = ioctl ( fd , VIDIOC_ENUM_FMT , & argp ) ; if ( res ) { break ; } else { dev -> imageformat_list [ i ++ ] = argp . pixelformat ; if ( i >= max ) { max += 10 ; dev -> imageformat_list = realloc ( dev -> imageformat_list , sizeof ( int ) * ( max + 1 ) ) ; } } } dev -> imageformat_list [ i ] = 0 ; return i ; }
Query the supported image formats(in fourcc) for Video Capture Stream.
Query the supported image formats ( in fourcc ) for Video Capture Stream .
//			DPRINTF("Supported image format[%d] = %s \n",i-1, //				vidFourccToString(argp.pixelformat) ? vidFourccToString(argp.pixelformat) : "Unknown" //				); //DPRINTF("%08x\n",argp.pixelformat); //}