V4L program problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



I am using v4l programing for my v4l frame capture
card. and now I can use mmap capture to get my video .
it seems ok. But now I encounter a problem---how can I
change my capture size without close v4l card ?
The following is my code of changing size ,but it does
work . I dont know why.

set_size(int width,int height)
{
   gb_frame = 0;
   /* start to grab the first frame */
   gb_buf.frame = 1 - gb_frame;
   gb_buf.height = height;
   gb_buf.width = width;
   gb_buf.format = VIDEO_PALETTE_YUV420P;
        
   ret = ioctl(video_fd, VIDIOCMCAPTURE, &gb_buf);
   if (ret < 0 && errno != EAGAIN) {
            /* try YUV422 */
      gb_buf.format = VIDEO_PALETTE_YUV422;
      ret = ioctl(video_fd, VIDIOCMCAPTURE, &gb_buf);
      if (ret < 0 && errno != EAGAIN) {
	/* try RGB24 */
        gb_buf.format = VIDEO_PALETTE_RGB24;
        ret = ioctl(video_fd, VIDIOCMCAPTURE,
&gb_buf);
      }
   }
   if (ret < 0) {
     if (errno != EAGAIN) {
       fprintf(stderr, "Fatal: grab device does not
support suitable format\n");
       } else {
                fprintf(stderr,"Fatal: grab device
does not receive any video signal\n");
         }
            return 1;
    }
  return 0;
}
this function always return 1;ie ,it cannot
successfully exec ioctl functions.
but in my open  code , this part is also include in it
. it never fails. why this happen ? what lead to it ?
please give your help .
thanks in advance .


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux