diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2014-03-10 10:58:24 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-03-11 10:30:08 -0300 |
commit | 4e8ec0a46f48c86b215a5b76f621927aa40a2440 (patch) | |
tree | 2185b2db3186556aebdbb8831665d01f947ba82c | |
parent | 4340583159b354f0c967b71518699bcc814c8614 (diff) |
[media] mem2mem_testdev: pick default format with try_fmt
This resolves an issue raised by v4l2-compliance: if the given format does
not exist, then pick a default format.
While there is an exception regarding this for TV capture drivers, this
m2m driver should do the right thing.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | drivers/media/platform/mem2mem_testdev.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/media/platform/mem2mem_testdev.c b/drivers/media/platform/mem2mem_testdev.c index 5c6067d7a7c0..104d86318107 100644 --- a/drivers/media/platform/mem2mem_testdev.c +++ b/drivers/media/platform/mem2mem_testdev.c @@ -543,7 +543,11 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct m2mtest_ctx *ctx = file2ctx(file); fmt = find_format(f); - if (!fmt || !(fmt->types & MEM2MEM_CAPTURE)) { + if (!fmt) { + f->fmt.pix.pixelformat = formats[0].fourcc; + fmt = find_format(f); + } + if (!(fmt->types & MEM2MEM_CAPTURE)) { v4l2_err(&ctx->dev->v4l2_dev, "Fourcc format (0x%08x) invalid.\n", f->fmt.pix.pixelformat); @@ -561,7 +565,11 @@ static int vidioc_try_fmt_vid_out(struct file *file, void *priv, struct m2mtest_ctx *ctx = file2ctx(file); fmt = find_format(f); - if (!fmt || !(fmt->types & MEM2MEM_OUTPUT)) { + if (!fmt) { + f->fmt.pix.pixelformat = formats[0].fourcc; + fmt = find_format(f); + } + if (!(fmt->types & MEM2MEM_OUTPUT)) { v4l2_err(&ctx->dev->v4l2_dev, "Fourcc format (0x%08x) invalid.\n", f->fmt.pix.pixelformat); |