@@ -516,13 +516,19 @@ retry:
memset( &(imgformat.fmt.pix), 0, sizeof( struct v4l2_pix_format ) );
imgformat.fmt.pix.width = capwidth;
imgformat.fmt.pix.height = vidin->height;
- imgformat.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
imgformat.fmt.pix.field = V4L2_FIELD_INTERLACED;
+ imgformat.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
- if( ioctl( vidin->grab_fd, VIDIOC_S_FMT, &imgformat ) < 0 ) {
+ if( ioctl( vidin->grab_fd, VIDIOC_S_FMT, &imgformat ) < 0 ||
+ imgformat.fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV ) {
/* Try for UYVY instead. */
+ memset( &(imgformat.fmt.pix), 0, sizeof( struct v4l2_pix_format ) );
+ imgformat.fmt.pix.width = capwidth;
+ imgformat.fmt.pix.height = vidin->height;
+ imgformat.fmt.pix.field = V4L2_FIELD_INTERLACED;
imgformat.fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY;
- if( ioctl( vidin->grab_fd, VIDIOC_S_FMT, &imgformat ) < 0 ) {
+ if( ioctl( vidin->grab_fd, VIDIOC_S_FMT, &imgformat ) < 0 ||
+ imgformat.fmt.pix.pixelformat != V4L2_PIX_FMT_UYVY ) {
fprintf( stderr, "\n"
" Your capture card driver: %s\n"
Drivers can either reject an unsupported pixelformat in VIDIOC_S_FMT, or replace it with a supported one. Either option is allowed. tvtime assumes that it is rejected, but instead it should check if it chose something else, and then retry with UYVY. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> ---