Message ID | 20230302130330.1125172-11-hverkuil-cisco@xs4all.nl (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | saa7146: convert to vb2 | expand |
diff --git a/drivers/media/common/saa7146/saa7146_video.c b/drivers/media/common/saa7146/saa7146_video.c index 6d8da22dd321..bf42de07625e 100644 --- a/drivers/media/common/saa7146/saa7146_video.c +++ b/drivers/media/common/saa7146/saa7146_video.c @@ -372,8 +372,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;
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@xs4all.nl> --- drivers/media/common/saa7146/saa7146_video.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)