[PATCH 2/2] tests: new test cases for ioctl_v4l2
Edgar Kaziahmedov
edos at linux.com
Mon Apr 10 10:45:02 UTC 2017
* tests/ioctl_v4l2.c (main) [VIDIOC_S_FMT]: Add check for all V4L2_BUF_TYPEs.
(main) [VIDIOC_G_FMT]: Likewise.
(main) [VIDIOC_TRY_FMT]: Likewise.
(init_v4l2_format): New function to avoid the 'copy-paste' in
tests of VIDIOC_S_FMT and VIDIOC_TRY_FMT.
(print_ioctl_v4l2): Likewise.
Signed-off-by: Edgar Kaziahmedov <edos at linux.com>
---
tests/ioctl_v4l2.c | 416 ++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 367 insertions(+), 49 deletions(-)
diff --git a/tests/ioctl_v4l2.c b/tests/ioctl_v4l2.c
index bff5d435..4ab21cb5 100644
--- a/tests/ioctl_v4l2.c
+++ b/tests/ioctl_v4l2.c
@@ -56,6 +56,256 @@
static const unsigned int magic = 0xdeadbeef;
+static void
+init_v4l2_format(struct v4l2_format *const f,
+ const unsigned int buf_type)
+{
+ memset(f, -1, sizeof(*f));
+ f->type = buf_type;
+ switch (buf_type) {
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+ f->fmt.pix.width = 0xdad1beaf;
+ f->fmt.pix.height = 0xdad2beaf;
+ f->fmt.pix.pixelformat = magic;
+ f->fmt.pix.field = V4L2_FIELD_NONE;
+ f->fmt.pix.bytesperline = 0xdad3beaf;
+ f->fmt.pix.sizeimage = 0xdad4beaf;
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG;
+ break;
+#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: {
+ unsigned int i;
+
+ f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+ f->fmt.pix_mp.width = 0xdad1beaf;
+ f->fmt.pix_mp.height = 0xdad2beaf;
+ f->fmt.pix_mp.pixelformat = magic;
+ f->fmt.pix_mp.field = V4L2_FIELD_NONE;
+ f->fmt.pix_mp.colorspace = V4L2_COLORSPACE_JPEG;
+ struct v4l2_plane_pix_format* cur_pix =
+ f->fmt.pix_mp.plane_fmt;
+ for (i = 0;
+ i < ARRAY_SIZE(f->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:
+#endif
+ case V4L2_BUF_TYPE_VIDEO_OVERLAY: {
+ f->fmt.win.w.left = 0xfeedface;
+ f->fmt.win.w.top = 0xfeedbacc;
+ f->fmt.win.w.width = 0xfeedbacc;
+ f->fmt.win.w.height = 0xfeedbacc;
+ f->fmt.win.field = V4L2_FIELD_ANY;
+ f->fmt.win.chromakey = 0xaabbccdd;
+ f->fmt.win.clipcount = 2;
+ f->fmt.win.clips =
+ tail_alloc(sizeof(*f->fmt.win.clips) *
+ f->fmt.win.clipcount);
+ f->fmt.win.clips[0].c.left = 0xfeedface;
+ f->fmt.win.clips[0].c.top = 0xfeedbacc;
+ f->fmt.win.clips[0].c.width = 0xfeedbacc;
+ f->fmt.win.clips[0].c.height = 0xfeedbacc;
+ f->fmt.win.clips[1].c.left = 0xfeedface;
+ f->fmt.win.clips[1].c.top = 0xfeedbacc;
+ f->fmt.win.clips[1].c.width = 0xfeedbacc;
+ f->fmt.win.clips[1].c.height = 0xfeedbacc;
+
+ f->fmt.win.bitmap = (void*) -2UL;
+ f->fmt.win.global_alpha = 0xce;
+ break;
+ }
+ case V4L2_BUF_TYPE_VBI_CAPTURE:
+ case V4L2_BUF_TYPE_VBI_OUTPUT:
+ f->fmt.vbi.sampling_rate = 0xfaceb01d;
+ f->fmt.vbi.offset = 0x12345678;
+ f->fmt.vbi.samples_per_line = 0xf001ba11;
+ f->fmt.vbi.sample_format = magic;
+ f->fmt.vbi.start[0] = 0xba11ba11;
+ f->fmt.vbi.start[1] = 0xba22ba22;
+ f->fmt.vbi.count[0] = 0xba33ba33;
+ f->fmt.vbi.count[1] = 0xba44ba44;
+ f->fmt.vbi.flags = V4L2_VBI_INTERLACED;
+ break;
+#if HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
+ case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
+ case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: {
+ unsigned int i;
+
+ f->fmt.sliced.service_set = V4L2_SLICED_VPS;
+ f->fmt.sliced.io_size = 0xb01dface;
+ for (i = 0;
+ i < ARRAY_SIZE(f->fmt.sliced.service_lines[0]);
+ i++) {
+ f->fmt.sliced.service_lines[0][i] = 0xface | i;
+ f->fmt.sliced.service_lines[1][i] = 0xbaff | i;
+ }
+ break;
+ }
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SDR_OUTPUT
+ case V4L2_BUF_TYPE_SDR_OUTPUT:
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE
+ case V4L2_BUF_TYPE_SDR_CAPTURE:
+ f->fmt.sdr.pixelformat = magic;
+ f->fmt.sdr.buffersize = 0xb01dface;
+ break;
+#endif
+ }
+}
+
+static void
+_print_ioctl_v4l2(struct v4l2_format *const f,
+ const char* request, const unsigned int buf_type,
+ const char* buf_type_string)
+{
+ switch (buf_type) {
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+ printf("ioctl(-1, %s, {type=%s"
+ ", 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,
+ buf_type_string,
+ f->fmt.pix.width, f->fmt.pix.height,
+ cc0(magic), cc1(magic), cc2(magic), cc3(magic),
+ f->fmt.pix.bytesperline,
+ f->fmt.pix.sizeimage);
+ break;
+#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: {
+ unsigned int i;
+ printf("ioctl(-1, %s"
+ ", {type=%s"
+ ", 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,
+ buf_type_string,
+ f->fmt.pix_mp.width, f->fmt.pix_mp.height,
+ cc0(magic), cc1(magic), cc2(magic), cc3(magic));
+ for (i = 0;
+ i < ARRAY_SIZE(f->fmt.pix_mp.plane_fmt);
+ ++i) {
+ if (i)
+ printf(", ");
+ printf("{sizeimage=%u, bytesperline=%u}",
+ f->fmt.pix_mp.plane_fmt[i].sizeimage,
+ f->fmt.pix_mp.plane_fmt[i].bytesperline);
+ }
+ printf("], num_planes=%u}}) = -1 EBADF (%m)\n",
+ f->fmt.pix_mp.num_planes);
+ break;
+ }
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
+#endif
+ case V4L2_BUF_TYPE_VIDEO_OVERLAY: {
+ printf("ioctl(-1, %s, {type=%s"
+ ", 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,
+ buf_type_string,
+ f->fmt.win.w.left, f->fmt.win.w.top,
+ f->fmt.win.w.width, f->fmt.win.w.height,
+ f->fmt.win.chromakey,
+ f->fmt.win.clips[0].c.left,
+ f->fmt.win.clips[0].c.top,
+ f->fmt.win.clips[0].c.width,
+ f->fmt.win.clips[0].c.height,
+ f->fmt.win.clips[1].c.left,
+ f->fmt.win.clips[1].c.top,
+ f->fmt.win.clips[1].c.width,
+ f->fmt.win.clips[1].c.height,
+ f->fmt.win.clipcount, f->fmt.win.bitmap,
+ f->fmt.win.global_alpha);
+ break;
+ }
+ case V4L2_BUF_TYPE_VBI_CAPTURE:
+ case V4L2_BUF_TYPE_VBI_OUTPUT:
+ printf("ioctl(-1, %s, {type=%s"
+ ", 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}})"
+ " = -1 EBADF (%m)\n",
+ request,
+ buf_type_string,
+ f->fmt.vbi.sampling_rate, f->fmt.vbi.offset,
+ f->fmt.vbi.samples_per_line,
+ cc0(magic), cc1(magic), cc2(magic), cc3(magic),
+ f->fmt.vbi.start[0], f->fmt.vbi.start[1],
+ f->fmt.vbi.count[0], f->fmt.vbi.count[1]);
+ break;
+#if HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
+ case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
+ case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: {
+ unsigned int i, j;
+
+ printf("ioctl(-1, %s, {type=%s"
+ ", fmt.sliced={service_set=V4L2_SLICED_VPS"
+ ", io_size=%u, service_lines=[",
+ request,
+ buf_type_string,
+ f->fmt.sliced.io_size);
+ for (i = 0;
+ i < ARRAY_SIZE(f->fmt.sliced.service_lines);
+ i++) {
+ if (i > 0)
+ printf(", ");
+ printf("[");
+ for (j = 0;
+ j < ARRAY_SIZE(f->fmt.sliced.service_lines[0]);
+ j++) {
+ if (j > 0)
+ printf(", ");
+ printf("%#x",
+ f->fmt.sliced.service_lines[i][j]);
+ }
+ printf("]");
+ }
+ printf("]}}) = -1 EBADF (%m)\n");
+ break;
+ }
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SDR_OUTPUT
+ case V4L2_BUF_TYPE_SDR_OUTPUT:
+#endif
+#if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE
+ case V4L2_BUF_TYPE_SDR_CAPTURE: {
+ printf("ioctl(-1, %s, {type=%s"
+ ", fmt.sdr={pixelformat=v4l2_fourcc('\\x%x', '\\x%x',"
+ " '\\x%x', '\\x%x'), buffersize=%u}}) = -1 EBADF (%m)\n",
+ request,
+ buf_type_string,
+ cc0(magic), cc1(magic), cc2(magic), cc3(magic),
+ f->fmt.sdr.buffersize);
+ break;
+#endif
+ }
+ }
+}
+#define print_ioctl_v4l2(v4l2_format, request, buf_type) do { \
+ _print_ioctl_v4l2((v4l2_format), (request), (buf_type), #buf_type); \
+} while (0)
+
int
main(void )
{
@@ -89,77 +339,145 @@ 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
+ p_format->type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
+ ioctl(-1, VIDIOC_G_FMT, p_format);
+ printf("ioctl(-1, VIDIOC_G_FMT"
+ ", {type=V4L2_BUF_TYPE_VIDEO_OVERLAY}) ="
+ " -1 EBADF (%m)\n");
+ 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");
+#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
+#if HAVE_DECL_V4L2_BUF_TYPE_SDR_OUTPUT
+ p_format->type = V4L2_BUF_TYPE_SDR_OUTPUT;
+ ioctl(-1, VIDIOC_G_FMT, p_format);
+ printf("ioctl(-1, VIDIOC_G_FMT"
+ ", {type=V4L2_BUF_TYPE_SDR_OUTPUT}) = -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);
- 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_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);
+ 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
+ init_v4l2_format(p_format, V4L2_BUF_TYPE_VIDEO_OVERLAY);
+ ioctl(-1, VIDIOC_S_FMT, p_format);
+ print_ioctl_v4l2(p_format, "VIDIOC_S_FMT",
+ V4L2_BUF_TYPE_VIDEO_OVERLAY);
+ 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);
+#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
+#if HAVE_DECL_V4L2_BUF_TYPE_SDR_OUTPUT
+ init_v4l2_format(p_format, V4L2_BUF_TYPE_SDR_OUTPUT);
+ ioctl(-1, VIDIOC_S_FMT, p_format);
+ print_ioctl_v4l2(p_format, "VIDIOC_S_FMT", V4L2_BUF_TYPE_SDR_OUTPUT);
+#endif
/* VIDIOC_TRY_FMT */
ioctl(-1, VIDIOC_TRY_FMT, 0);
printf("ioctl(-1, VIDIOC_TRY_FMT, NULL) = -1 EBADF (%m)\n");
+ init_v4l2_format(p_format, V4L2_BUF_TYPE_VIDEO_OUTPUT);
+ ioctl(-1, VIDIOC_TRY_FMT, p_format);
+ print_ioctl_v4l2(p_format, "VIDIOC_TRY_FMT",
+ V4L2_BUF_TYPE_VIDEO_OUTPUT);
#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
+ init_v4l2_format(p_format, V4L2_BUF_TYPE_VIDEO_OVERLAY);
+ ioctl(-1, VIDIOC_TRY_FMT, p_format);
+ print_ioctl_v4l2(p_format, "VIDIOC_TRY_FMT",
+ V4L2_BUF_TYPE_VIDEO_OVERLAY);
+
+ 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);
+#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
+#if HAVE_DECL_V4L2_BUF_TYPE_SDR_OUTPUT
+ init_v4l2_format(p_format, V4L2_BUF_TYPE_SDR_OUTPUT);
+ ioctl(-1, VIDIOC_TRY_FMT, p_format);
+ print_ioctl_v4l2(p_format, "VIDIOC_TRY_FMT", V4L2_BUF_TYPE_SDR_OUTPUT);
+#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