When I understand it correctly, an utvfu(4) device supports either the
frame size for PAL or NTSC.  So, the VIDIOC_ENUM_FRAMESIZES ioctl should
only return one frame size, which isn't the case currently.  video(1)
repeatedly returns various times the same frame size, ffmpeg(1) and
ffplay(1) even go in to an infinite loop.

The attached diff limits to one frame size.

OK?


Index: sys/dev/usb/utvfu.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/utvfu.c,v
retrieving revision 1.13
diff -u -p -u -p -r1.13 utvfu.c
--- sys/dev/usb/utvfu.c 24 Nov 2021 21:57:56 -0000      1.13
+++ sys/dev/usb/utvfu.c 25 Nov 2021 05:57:58 -0000
@@ -537,6 +537,10 @@ utvfu_enum_fsizes(void *v, struct v4l2_f
        if (fsizes->pixel_format != V4L2_PIX_FMT_YUYV)
                return (EINVAL);
 
+       /* The device only supports one frame size. */
+       if (fsizes->index >= 1)
+               return (EINVAL);
+
        fsizes->type = V4L2_FRMSIZE_TYPE_DISCRETE;
        fsizes->discrete.width = utvfu_norm_params[sc->sc_normi].cap_width;
        fsizes->discrete.height = utvfu_norm_params[sc->sc_normi].cap_height;

Reply via email to