[PATCH 3/3] tests/ioctl_v4l2: extended tests

Edgar Kaziahmedov edos at linux.com
Tue Mar 28 15:21:30 UTC 2017


In accordance with changes made, this commit
adds tests for the new functionality. Moreover, to
avoid the "copy-paste" code for ioctl's requests
like VIDIOC_TRY_FMT and VIDIOC_S_FMT there are
special functions: init_v4l2_format, print_ioctl_v4l2.

Signed-off-by: Edgar Kaziahmedov <edos at linux.com>
---
 tests/ioctl_v4l2.c | 370 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 322 insertions(+), 48 deletions(-)

diff --git a/tests/ioctl_v4l2.c b/tests/ioctl_v4l2.c
index bff5d435..2667243e 100644
--- a/tests/ioctl_v4l2.c
+++ b/tests/ioctl_v4l2.c
@@ -56,6 +56,235 @@
 
 static const unsigned int magic = 0xdeadbeef;
 
+static void
+init_v4l2_format(struct v4l2_format *const p_format,
+		 const unsigned int buf_type)
+{
+	memset(p_format, -1, sizeof(*p_format));
+	p_format->type = buf_type;
+	switch (buf_type) {
+	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+		p_format->fmt.pix.width = 0xdad1beaf;
+		p_format->fmt.pix.height = 0xdad2beaf;
+		p_format->fmt.pix.pixelformat = magic;
+		p_format->fmt.pix.field = V4L2_FIELD_NONE;
+		p_format->fmt.pix.bytesperline = 0xdad3beaf;
+		p_format->fmt.pix.sizeimage = 0xdad4beaf;
+		p_format->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG;
+		break;
+#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
+	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: {
+		unsigned int i;
+
+		p_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+		p_format->fmt.pix_mp.width = 0xdad1beaf;
+		p_format->fmt.pix_mp.height = 0xdad2beaf;
+		p_format->fmt.pix_mp.pixelformat = magic;
+		p_format->fmt.pix_mp.field = V4L2_FIELD_NONE;
+		p_format->fmt.pix_mp.colorspace = V4L2_COLORSPACE_JPEG;
+		struct v4l2_plane_pix_format* cur_pix =
+		       p_format->fmt.pix_mp.plane_fmt;
+		for (i = 0;
+		     i < ARRAY_SIZE(p_format->fmt.pix_mp.plane_fmt);
+		     i++) {
+			cur_pix[i].sizeimage = 0xbadc0de0 | i;
+			cur_pix[i].bytesperline = 0xdadbeaf0 | i;
+		}
+		break;
+	}
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY
+	case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: {
+		p_format->fmt.win.w.left = 0xfeedface;
+		p_format->fmt.win.w.top = 0xfeedbacc;
+		p_format->fmt.win.w.width = 0xfeedbacc;
+		p_format->fmt.win.w.height = 0xfeedbacc;
+		p_format->fmt.win.field = V4L2_FIELD_ANY;
+		p_format->fmt.win.chromakey = 0xaabbccdd;
+		p_format->fmt.win.clipcount = 2;
+		p_format->fmt.win.clips =
+			tail_alloc(sizeof(*p_format->fmt.win.clips) *
+			p_format->fmt.win.clipcount);
+		p_format->fmt.win.clips[0].c.left = 0xfeedface;
+		p_format->fmt.win.clips[0].c.top = 0xfeedbacc;
+		p_format->fmt.win.clips[0].c.width = 0xfeedbacc;
+		p_format->fmt.win.clips[0].c.height = 0xfeedbacc;
+		p_format->fmt.win.clips[1].c.left = 0xfeedface;
+		p_format->fmt.win.clips[1].c.top = 0xfeedbacc;
+		p_format->fmt.win.clips[1].c.width = 0xfeedbacc;
+		p_format->fmt.win.clips[1].c.height = 0xfeedbacc;
+
+		p_format->fmt.win.bitmap = (void*) -2UL;
+		p_format->fmt.win.global_alpha = 0xc001face;
+		break;
+	}
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_VBI_CAPTURE
+	case V4L2_BUF_TYPE_VBI_CAPTURE:
+		p_format->fmt.vbi.sampling_rate = 0xfaceb01d;
+		p_format->fmt.vbi.offset = 0x12345678;
+		p_format->fmt.vbi.samples_per_line = 0xf001ba11;
+		p_format->fmt.vbi.sample_format = magic;
+		p_format->fmt.vbi.start[0] = 0xba11ba11;
+		p_format->fmt.vbi.start[1] = 0xba22ba22;
+		p_format->fmt.vbi.count[0] = 0xba33ba33;
+		p_format->fmt.vbi.count[1] = 0xba44ba44;
+		p_format->fmt.vbi.flags = V4L2_VBI_INTERLACED;
+		p_format->fmt.vbi.reserved[0] = 0x20162017;
+		p_format->fmt.vbi.reserved[1] = 0xb00b1ebe;
+		break;
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
+	case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: {
+		unsigned int i;
+
+		p_format->fmt.sliced.service_set = V4L2_SLICED_VPS;
+		p_format->fmt.sliced.io_size = 0xb01dface;
+		p_format->fmt.sliced.reserved[0] = 0xdad2beaf;
+		p_format->fmt.sliced.reserved[1] = 0xdad3beaf;
+		for (i = 0;
+		     i < ARRAY_SIZE(p_format->fmt.sliced.service_lines[0]);
+		     i++) {
+			p_format->fmt.sliced.service_lines[0][i] = 0xface | i;
+			p_format->fmt.sliced.service_lines[1][i] = 0xbaff | i;
+		}
+		break;
+	}
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE
+	case V4L2_BUF_TYPE_SDR_CAPTURE:
+		p_format->fmt.sdr.pixelformat = magic;
+		p_format->fmt.sdr.buffersize = 0xb01dface;
+		break;
+#endif
+	}
+}
+
+static void
+print_ioctl_v4l2(struct v4l2_format *const p_format,
+		 const char* request, const unsigned int buf_type)
+{
+	switch (buf_type) {
+	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+		printf("ioctl(-1, %s, {type=V4L2_BUF_TYPE_VIDEO_OUTPUT"
+		       ", fmt.pix={width=%u, height=%u, pixelformat="
+		       "v4l2_fourcc('\\x%x', '\\x%x', '\\x%x', '\\x%x')"
+		       ", field=V4L2_FIELD_NONE, bytesperline=%u, sizeimage=%u"
+		       ", colorspace=V4L2_COLORSPACE_JPEG}}) = -1 EBADF (%m)\n",
+		       request,
+		       p_format->fmt.pix.width, p_format->fmt.pix.height,
+		       cc0(magic), cc1(magic), cc2(magic), cc3(magic),
+		       p_format->fmt.pix.bytesperline,
+		       p_format->fmt.pix.sizeimage);
+		break;
+#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
+	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: {
+		unsigned int i;
+		printf("ioctl(-1, %s"
+		       ", {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE"
+		       ", fmt.pix_mp={width=%u, height=%u, pixelformat="
+		       "v4l2_fourcc('\\x%x', '\\x%x', '\\x%x', '\\x%x')"
+		       ", field=V4L2_FIELD_NONE, colorspace=V4L2_COLORSPACE_JPEG"
+		       ", plane_fmt=[",
+		       request,
+		       p_format->fmt.pix_mp.width, p_format->fmt.pix_mp.height,
+		       cc0(magic), cc1(magic), cc2(magic), cc3(magic));
+		for (i = 0;
+		     i < ARRAY_SIZE(p_format->fmt.pix_mp.plane_fmt);
+		     ++i) {
+			if (i)
+				printf(", ");
+			printf("{sizeimage=%u, bytesperline=%u}",
+			p_format->fmt.pix_mp.plane_fmt[i].sizeimage,
+			p_format->fmt.pix_mp.plane_fmt[i].bytesperline);
+		}
+		printf("], num_planes=%u}}) = -1 EBADF (%m)\n",
+		p_format->fmt.pix_mp.num_planes);
+		break;
+	}
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY
+	case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
+		printf("ioctl(-1, %s, {type=V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY"
+		       ", fmt.win={left=%d, top=%d, width=%u, height=%u"
+		       ", field=V4L2_FIELD_ANY, chromakey=%#x, clips="
+		       "[{left=%d, top=%d, width=%u, height=%u}, "
+		       "{left=%d, top=%d, width=%u, height=%u}]"
+		       ", clipcount=%u, bitmap=%p, global_alpha=%#x}})"
+		       " = -1 EBADF (%m)\n",
+		       request,
+		       p_format->fmt.win.w.left, p_format->fmt.win.w.top,
+		       p_format->fmt.win.w.width, p_format->fmt.win.w.height,
+		       p_format->fmt.win.chromakey,
+		       p_format->fmt.win.clips[0].c.left,
+		       p_format->fmt.win.clips[0].c.top,
+		       p_format->fmt.win.clips[0].c.width,
+		       p_format->fmt.win.clips[0].c.height,
+		       p_format->fmt.win.clips[1].c.left,
+		       p_format->fmt.win.clips[1].c.top,
+		       p_format->fmt.win.clips[1].c.width,
+		       p_format->fmt.win.clips[1].c.height,
+		       p_format->fmt.win.clipcount,
+		       p_format->fmt.win.bitmap,
+		       p_format->fmt.win.global_alpha);
+		break;
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_VBI_CAPTURE
+	case V4L2_BUF_TYPE_VBI_CAPTURE:
+		printf("ioctl(-1, %s, {type=V4L2_BUF_TYPE_VBI_CAPTURE"
+		       ", fmt.vbi={sampling_rate=%u, offset=%u"
+		       ", samples_per_line=%u, sample_format="
+		       "v4l2_fourcc('\\x%x', '\\x%x', '\\x%x', '\\x%x')"
+		       ", start=%u,%u, count=%u,%u"
+		       ", flags=V4L2_VBI_INTERLACED, reserved=%#x,%#x}})"
+		       " = -1 EBADF (%m)\n",
+		       request,
+		       p_format->fmt.vbi.sampling_rate,
+		       p_format->fmt.vbi.offset,
+		       p_format->fmt.vbi.samples_per_line,
+		       cc0(magic), cc1(magic), cc2(magic), cc3(magic),
+		       p_format->fmt.vbi.start[0], p_format->fmt.vbi.start[1],
+		       p_format->fmt.vbi.count[0], p_format->fmt.vbi.count[1],
+		       p_format->fmt.vbi.reserved[0],
+		       p_format->fmt.vbi.reserved[1]);
+		break;
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
+	case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: {
+		unsigned int i;
+		printf("ioctl(-1, %s, {type=V4L2_BUF_TYPE_SLICED_VBI_CAPTURE"
+		       ", fmt.sliced={service_set=V4L2_SLICED_VPS"
+		       ", io_size=%u, service_lines=[",
+		       request,
+		       p_format->fmt.sliced.io_size);
+		for (i = 0;
+		     i < ARRAY_SIZE(p_format->fmt.sliced.service_lines[0]);
+		     ++i) {
+			if (i)
+				printf(", ");
+			printf("{line[%u]=%#x, %#x}", i,
+			p_format->fmt.sliced.service_lines[0][i],
+			p_format->fmt.sliced.service_lines[1][i]);
+		}
+		printf("], reserved=%#x,%#x}}) = -1 EBADF (%m)\n",
+		        p_format->fmt.sliced.reserved[0],
+			p_format->fmt.sliced.reserved[1]);
+		break;
+	}
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE
+	case V4L2_BUF_TYPE_SDR_CAPTURE:
+		printf("ioctl(-1, %s, {type=V4L2_BUF_TYPE_SDR_CAPTURE"
+		       ", fmt.sdr={pixelformat=v4l2_fourcc('\\x%x', '\\x%x',"
+		       " '\\x%x', '\\x%x'), buffersize=%u}}) = -1 EBADF (%m)\n",
+		       request,
+		       cc0(magic), cc1(magic), cc2(magic), cc3(magic),
+		       p_format->fmt.sdr.buffersize);
+		break;
+#endif
+	}
+}
+
 int
 main(void )
 {
@@ -89,77 +318,122 @@ main(void )
 	printf("ioctl(-1, VIDIOC_G_FMT, NULL) = -1 EBADF (%m)\n");
 
 	TAIL_ALLOC_OBJECT_CONST_PTR(struct v4l2_format, p_format);
-	p_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 
+	p_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	ioctl(-1, VIDIOC_G_FMT, p_format);
 	printf("ioctl(-1, VIDIOC_G_FMT"
 	       ", {type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 EBADF (%m)\n");
+#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
+	p_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+	ioctl(-1, VIDIOC_G_FMT, p_format);
+	printf("ioctl(-1, VIDIOC_G_FMT"
+	       ", {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE}) ="
+	       " -1 EBADF (%m)\n");
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY
+	p_format->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY;
+	ioctl(-1, VIDIOC_G_FMT, p_format);
+	printf("ioctl(-1, VIDIOC_G_FMT"
+	       ", {type=V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY}) ="
+	       " -1 EBADF (%m)\n");
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_VBI_CAPTURE
+	p_format->type = V4L2_BUF_TYPE_VBI_CAPTURE;
+	ioctl(-1, VIDIOC_G_FMT, p_format);
+	printf("ioctl(-1, VIDIOC_G_FMT"
+	       ", {type=V4L2_BUF_TYPE_VBI_CAPTURE}) = -1 EBADF (%m)\n");
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
+	p_format->type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
+	ioctl(-1, VIDIOC_G_FMT, p_format);
+	printf("ioctl(-1, VIDIOC_G_FMT"
+	       ", {type=V4L2_BUF_TYPE_SLICED_VBI_CAPTURE}) = -1 EBADF (%m)\n");
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE
+	p_format->type = V4L2_BUF_TYPE_SDR_CAPTURE;
+	ioctl(-1, VIDIOC_G_FMT, p_format);
+	printf("ioctl(-1, VIDIOC_G_FMT"
+	       ", {type=V4L2_BUF_TYPE_SDR_CAPTURE}) = -1 EBADF (%m)\n");
+#endif
 
 	/* VIDIOC_S_FMT */
 	ioctl(-1, VIDIOC_S_FMT, 0);
 	printf("ioctl(-1, VIDIOC_S_FMT, NULL) = -1 EBADF (%m)\n");
 
-	p_format->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-	p_format->fmt.pix.width = 0xdad1beaf;
-	p_format->fmt.pix.height = 0xdad2beaf;
-	p_format->fmt.pix.pixelformat = magic;
-	p_format->fmt.pix.field = V4L2_FIELD_NONE;
-	p_format->fmt.pix.bytesperline = 0xdad3beaf;
-	p_format->fmt.pix.sizeimage = 0xdad4beaf;
-	p_format->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG;
+	init_v4l2_format(p_format, V4L2_BUF_TYPE_VIDEO_OUTPUT);
+	ioctl(-1, VIDIOC_S_FMT, p_format);
+	print_ioctl_v4l2(p_format, "VIDIOC_S_FMT", V4L2_BUF_TYPE_VIDEO_OUTPUT);
 
+#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
+	init_v4l2_format(p_format, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
 	ioctl(-1, VIDIOC_S_FMT, p_format);
-	printf("ioctl(-1, VIDIOC_S_FMT, {type=V4L2_BUF_TYPE_VIDEO_OUTPUT"
-	       ", fmt.pix={width=%u, height=%u, pixelformat="
-	       "v4l2_fourcc('\\x%x', '\\x%x', '\\x%x', '\\x%x')"
-	       ", field=V4L2_FIELD_NONE, bytesperline=%u, sizeimage=%u"
-	       ", colorspace=V4L2_COLORSPACE_JPEG}}) = -1 EBADF (%m)\n",
-	       p_format->fmt.pix.width, p_format->fmt.pix.height,
-	       cc0(magic), cc1(magic), cc2(magic), cc3(magic),
-	       p_format->fmt.pix.bytesperline, p_format->fmt.pix.sizeimage);
+	print_ioctl_v4l2(p_format, "VIDIOC_S_FMT",
+			 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY
+	init_v4l2_format(p_format, V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY);
+	ioctl(-1, VIDIOC_S_FMT, p_format);
+	print_ioctl_v4l2(p_format, "VIDIOC_S_FMT",
+			 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY);
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_VBI_CAPTURE
+	init_v4l2_format(p_format, V4L2_BUF_TYPE_VBI_CAPTURE);
+	ioctl(-1, VIDIOC_S_FMT, p_format);
+	print_ioctl_v4l2(p_format, "VIDIOC_S_FMT", V4L2_BUF_TYPE_VBI_CAPTURE);
+
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
+	init_v4l2_format(p_format, V4L2_BUF_TYPE_SLICED_VBI_CAPTURE);
+	ioctl(-1, VIDIOC_S_FMT, p_format);
+	print_ioctl_v4l2(p_format, "VIDIOC_S_FMT",
+			 V4L2_BUF_TYPE_SLICED_VBI_CAPTURE);
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE
+	init_v4l2_format(p_format, V4L2_BUF_TYPE_SDR_CAPTURE);
+	ioctl(-1, VIDIOC_S_FMT, p_format);
+	print_ioctl_v4l2(p_format, "VIDIOC_S_FMT", V4L2_BUF_TYPE_SDR_CAPTURE);
+
+#endif
 
 	/* VIDIOC_TRY_FMT */
 	ioctl(-1, VIDIOC_TRY_FMT, 0);
 	printf("ioctl(-1, VIDIOC_TRY_FMT, NULL) = -1 EBADF (%m)\n");
 
 #if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
-	memset(p_format, -1, sizeof(*p_format));
-	p_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
-	p_format->fmt.pix_mp.width = 0xdad1beaf;
-	p_format->fmt.pix_mp.height = 0xdad2beaf;
-	p_format->fmt.pix_mp.pixelformat = magic;
-	p_format->fmt.pix_mp.field = V4L2_FIELD_NONE;
-	p_format->fmt.pix_mp.colorspace = V4L2_COLORSPACE_JPEG;
-	unsigned int i;
-	for (i = 0; i < ARRAY_SIZE(p_format->fmt.pix_mp.plane_fmt); ++i) {
-		p_format->fmt.pix_mp.plane_fmt[i].sizeimage = 0xbadc0de0 | i;
-		p_format->fmt.pix_mp.plane_fmt[i].bytesperline = 0xdadbeaf0 | i;
-	}
+	init_v4l2_format(p_format, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
 	ioctl(-1, VIDIOC_TRY_FMT, p_format);
-	printf("ioctl(-1, VIDIOC_TRY_FMT"
-	       ", {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE"
-	       ", fmt.pix_mp={width=%u, height=%u, pixelformat="
-	       "v4l2_fourcc('\\x%x', '\\x%x', '\\x%x', '\\x%x')"
-	       ", field=V4L2_FIELD_NONE, colorspace=V4L2_COLORSPACE_JPEG"
-	       ", plane_fmt=[",
-	       p_format->fmt.pix_mp.width, p_format->fmt.pix_mp.height,
-	       cc0(magic), cc1(magic), cc2(magic), cc3(magic));
-	for (i = 0; i < ARRAY_SIZE(p_format->fmt.pix_mp.plane_fmt); ++i) {
-		if (i)
-			printf(", ");
-		printf("{sizeimage=%u, bytesperline=%u}",
-		       p_format->fmt.pix_mp.plane_fmt[i].sizeimage,
-		       p_format->fmt.pix_mp.plane_fmt[i].bytesperline);
-	}
-	printf("], num_planes=%u}}) = -1 EBADF (%m)\n",
-	       p_format->fmt.pix_mp.num_planes);
-#else
+	print_ioctl_v4l2(p_format, "VIDIOC_TRY_FMT",
+			 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY
+	init_v4l2_format(p_format, V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY);
+	ioctl(-1, VIDIOC_TRY_FMT, p_format);
+	print_ioctl_v4l2(p_format, "VIDIOC_TRY_FMT",
+			 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY);
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_VBI_CAPTURE
+	init_v4l2_format(p_format, V4L2_BUF_TYPE_VBI_CAPTURE);
+	ioctl(-1, VIDIOC_TRY_FMT, p_format);
+	print_ioctl_v4l2(p_format, "VIDIOC_TRY_FMT", V4L2_BUF_TYPE_VBI_CAPTURE);
+
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
+	init_v4l2_format(p_format, V4L2_BUF_TYPE_SLICED_VBI_CAPTURE);
+	ioctl(-1, VIDIOC_TRY_FMT, p_format);
+	print_ioctl_v4l2(p_format, "VIDIOC_TRY_FMT",
+			 V4L2_BUF_TYPE_SLICED_VBI_CAPTURE);
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE
+	init_v4l2_format(p_format, V4L2_BUF_TYPE_SDR_CAPTURE);
+	ioctl(-1, VIDIOC_TRY_FMT, p_format);
+	print_ioctl_v4l2(p_format, "VIDIOC_TRY_FMT", V4L2_BUF_TYPE_SDR_CAPTURE);
+
+#endif
 	struct v4l2_format *const p_v4l2_format =
 		page + size - sizeof(*p_v4l2_format);
 	ioctl(-1, VIDIOC_TRY_FMT, p_v4l2_format);
 	printf("ioctl(-1, VIDIOC_TRY_FMT, {type=%#x /* V4L2_BUF_TYPE_??? */})"
 	       " = -1 EBADF (%m)\n", p_v4l2_format->type);
-#endif
 
 	/* VIDIOC_REQBUFS */
 	ioctl(-1, VIDIOC_REQBUFS, 0);
-- 
2.11.0





More information about the Strace-devel mailing list