camera/drv-v4l2.c
static int capture_query_buffer_type(V4L2Capture *dev){
  struct v4l2_format argp;
  int fd = dev->fd;
  int i=0,k=0;
  int res;

  memset(dev->buffer_type,0,sizeof(dev->buffer_type));
	
  dev->buffer_types = 0;
	
  argp.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
  res = ioctl(fd,VIDIOC_G_FMT,&argp);	
		
  for (i=0;i<V4L2_BUF_TYPE_PRIVATE;i++){
    argp.type = i;
    res = ioctl(fd,VIDIOC_TRY_FMT,&argp);
    //res = v4l_ioctl(dev,VIDIOC_TRY_FMT,&argp);
    //printf("res=%d\n",res);
    if (!res) {
      dev->buffer_type[i] = 1;
      k++;
    } 	
  }
	
  dev->buffer_types= k;
	
  return k;
}
/**  Query no. of buffer type supported.
 *  Internal function. Should be involved by v4l_dev_open only.
 */
Query no. of buffer type supported.
Internal function. Should be involved by v4l_dev_open only.
Query no . of buffer type supported . Internal function . Should be involved by v4l_dev_open only .
static int capture_query_buffer_type(V4L2Capture *dev){
  struct v4l2_format argp;
  int fd = dev->fd;
  int i=0,k=0;
  int res;
  memset(dev->buffer_type,0,sizeof(dev->buffer_type));
  dev->buffer_types = 0;
  argp.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
  res = ioctl(fd,VIDIOC_G_FMT,&argp);	
  for (i=0;i<V4L2_BUF_TYPE_PRIVATE;i++){
    argp.type = i;
    res = ioctl(fd,VIDIOC_TRY_FMT,&argp);
    if (!res) {
      dev->buffer_type[i] = 1;
      k++;
    } 	
  }
  dev->buffer_types= k;
  return k;
}
static int capture_query_buffer_type ( V4L2Capture * dev ) { struct v4l2_format argp ; int fd = dev -> fd ; int i = 0 , k = 0 ; int res ; memset ( dev -> buffer_type , 0 , sizeof ( dev -> buffer_type ) ) ; dev -> buffer_types = 0 ; argp . type = V4L2_BUF_TYPE_VIDEO_CAPTURE ; res = ioctl ( fd , VIDIOC_G_FMT , & argp ) ; for ( i = 0 ; i < V4L2_BUF_TYPE_PRIVATE ; i ++ ) { argp . type = i ; res = ioctl ( fd , VIDIOC_TRY_FMT , & argp ) ; if ( ! res ) { dev -> buffer_type [ i ] = 1 ; k ++ ; } } dev -> buffer_types = k ; return k ; }
Query no.
Query no .
//res = v4l_ioctl(dev,VIDIOC_TRY_FMT,&argp); //printf("res=%d\n",res);