This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/tvtime.git tree:

Subject: tvtime: support drivers that always select a pixfmt in S_FMT
Author:  Hans Verkuil <hverkuil-ci...@xs4all.nl>
Date:    Wed Apr 12 12:08:31 2023 +0100

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.

Link: 
https://lore.kernel.org/linux-media/a5dff340-ab8a-46e0-1f0c-25ceaf9fe...@xs4all.nl
Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mche...@kernel.org>

 src/videoinput.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/tvtime.git/commit/?id=b22f8e196d8640d28f22fe7e429c70f56804e3c4
diff --git a/src/videoinput.c b/src/videoinput.c
index 5c147c8e079e..237f6845eb91 100644
--- a/src/videoinput.c
+++ b/src/videoinput.c
@@ -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"

Reply via email to