*** vic/video/grabber-video4linux.cpp.orig Wed Dec 11 08:33:23 2002 --- vic/video/grabber-video4linux.cpp Wed Dec 11 08:39:09 2002 *************** *** 113,118 **** --- 113,119 ---- int fd_; int format_; int have_422P; + int have_420P; int v4lformat_; int byteorder_; int cformat_; *************** *** 262,267 **** --- 263,269 ---- have_mmap = 0; have_422P = 0; + have_420P = 0; fd_ = open(dev, O_RDWR); if (fd_ < 0) { *************** *** 276,281 **** --- 278,287 ---- if (-1 != ioctl(fd_, VIDIOCMCAPTURE, &vid_mmap)) { have_422P = 1; } + vid_mmap.format = VIDEO_PALETTE_YUV420P; + if (-1 != ioctl(fd_, VIDIOCMCAPTURE, &vid_mmap)) { + have_420P = 1; + } /* Release device */ close(fd_); *************** *** 531,537 **** case CF_411: case CF_CIF: ! packed422_to_planar411((char*)frame_,fr); break; case CF_422: --- 537,546 ---- case CF_411: case CF_CIF: ! if( have_420P ) ! memcpy((void *)frame_, (const void *)fr, (size_t)height_*width_*3/2); ! else ! packed422_to_planar411((char*)frame_,fr); break; case CF_422: *************** *** 728,737 **** --- 737,752 ---- switch (cformat_) { case CF_CIF: set_size_411(width_, height_); + if( have_420P ) { + v4lformat_ = VIDEO_PALETTE_YUV420P; + } DEBUG(fprintf(stderr," cif")); break; case CF_411: set_size_411(width_, height_); + if( have_420P ) { + v4lformat_ = VIDEO_PALETTE_YUV420P; + } DEBUG(fprintf(stderr," 411")); break; case CF_422: