From: Hans Verkuil Date: Mon, 17 Feb 2014 14:00:41 +0000 (+0100) Subject: v4l2-compliance: restore the initial formats after testing S_FMT X-Git-Tag: v4l-utils-1.2.0~207 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=76a52e7ec679ca626f01896232a93de74c79aebe;p=platform%2Fupstream%2Fv4l-utils.git 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 --- 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; }