From 76a52e7ec679ca626f01896232a93de74c79aebe Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 17 Feb 2014 15:00:41 +0100 Subject: [PATCH] v4l2-compliance: restore the initial formats after testing S_FMT The format you end up with after S_FMT has been run through its paces is the smallest possible format. However, that's not what you want for the streaming tests. So we restore the initial formats at the end of the tests. Signed-off-by: Hans Verkuil --- utils/v4l2-compliance/v4l2-test-formats.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp index 2f23ac5..4f68b2d 100644 --- a/utils/v4l2-compliance/v4l2-test-formats.cpp +++ b/utils/v4l2-compliance/v4l2-test-formats.cpp @@ -749,6 +749,7 @@ int testSetFormats(struct node *node) { struct v4l2_clip clip, clip_set; struct v4l2_format fmt, fmt_set; + struct v4l2_format initial_fmts[V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE + 1]; int type; int ret; @@ -759,6 +760,7 @@ int testSetFormats(struct node *node) createInvalidFmt(fmt, clip, type); doioctl(node, VIDIOC_G_FMT, &fmt); + initial_fmts[type] = fmt; createInvalidFmt(fmt_set, clip_set, type); ret = doioctl(node, VIDIOC_S_FMT, &fmt_set); if (ret == EINVAL) { @@ -846,6 +848,13 @@ int testSetFormats(struct node *node) } } + /* Restore initial format */ + for (type = 0; type <= V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; type++) { + if (!(node->valid_buftypes & (1 << type))) + continue; + + doioctl(node, VIDIOC_S_FMT, &initial_fmts[type]); + } return 0; } -- 2.7.4