[PATCHv2 13/19] media: common: saa7146: fall back to V4L2_PIX_FMT_BGR24

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

 



If the requested pixelformat is not supported, then fall
back to V4L2_PIX_FMT_BGR24 for improved V4L2 compliance.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
---
 drivers/media/common/saa7146/saa7146_video.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/common/saa7146/saa7146_video.c b/drivers/media/common/saa7146/saa7146_video.c
index e698b4470db3..d706aa3b5967 100644
--- a/drivers/media/common/saa7146/saa7146_video.c
+++ b/drivers/media/common/saa7146/saa7146_video.c
@@ -367,8 +367,10 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma
 	DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh);
 
 	fmt = saa7146_format_by_fourcc(dev, f->fmt.pix.pixelformat);
-	if (NULL == fmt)
-		return -EINVAL;
+	if (!fmt) {
+		f->fmt.pix.pixelformat = V4L2_PIX_FMT_BGR24;
+		fmt = saa7146_format_by_fourcc(dev, f->fmt.pix.pixelformat);
+	}
 
 	field = f->fmt.pix.field;
 	maxw  = vv->standard->h_max_out;
-- 
2.39.2




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux