tests: rewrite ioctl_v4l2 test without reliance on init_magic
* tests/ioctl_v4l2.c (cc0, cc1, cc2, cc3, fourcc): New macros. (main): Use them. Rewrite expected output without assumptions on any particular magic data.
This commit is contained in:
parent
84e3de2018
commit
ff9f61dce9
@ -44,6 +44,28 @@ init_magic(void *addr, const unsigned int size)
|
||||
*(unsigned int *) p = magic;
|
||||
}
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
# define cc0(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 24))
|
||||
# define cc1(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 16))
|
||||
# define cc2(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 8))
|
||||
# define cc3(arg) ((unsigned int) (unsigned char) (arg))
|
||||
# define fourcc(a0, a1, a2, a3) \
|
||||
((unsigned int)(a3) | \
|
||||
((unsigned int)(a2) << 8) | \
|
||||
((unsigned int)(a1) << 16) | \
|
||||
((unsigned int)(a0) << 24))
|
||||
#else
|
||||
# define cc0(arg) ((unsigned int) (unsigned char) (arg))
|
||||
# define cc1(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 8))
|
||||
# define cc2(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 16))
|
||||
# define cc3(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 24))
|
||||
# define fourcc(a0, a1, a2, a3) \
|
||||
((unsigned int)(a0) | \
|
||||
((unsigned int)(a1) << 8) | \
|
||||
((unsigned int)(a2) << 16) | \
|
||||
((unsigned int)(a3) << 24))
|
||||
#endif
|
||||
|
||||
int
|
||||
main(void )
|
||||
{
|
||||
@ -51,21 +73,7 @@ main(void )
|
||||
void *const page = tail_alloc(size);
|
||||
init_magic(page, size);
|
||||
|
||||
const union u_pixel_format {
|
||||
unsigned int pixelformat;
|
||||
unsigned char cc[sizeof(int)];
|
||||
} u = {
|
||||
#if WORDS_BIGENDIAN
|
||||
.cc = {
|
||||
(unsigned char) (magic >> 24),
|
||||
(unsigned char) (magic >> 16),
|
||||
(unsigned char) (magic >> 8),
|
||||
(unsigned char) magic
|
||||
}
|
||||
#else
|
||||
.pixelformat = magic
|
||||
#endif
|
||||
};
|
||||
unsigned char cc[sizeof(int)] = { 'A', '\'', '\\', '\xfa' };
|
||||
|
||||
/* VIDIOC_QUERYCAP */
|
||||
ioctl(-1, VIDIOC_QUERYCAP, 0);
|
||||
@ -83,14 +91,14 @@ main(void )
|
||||
p_fmtdesc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
ioctl(-1, VIDIOC_ENUM_FMT, p_fmtdesc);
|
||||
printf("ioctl(-1, VIDIOC_ENUM_FMT, {index=%u"
|
||||
", type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 EBADF (%m)\n", magic);
|
||||
", type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 EBADF (%m)\n",
|
||||
p_fmtdesc->index);
|
||||
|
||||
/* VIDIOC_G_FMT */
|
||||
ioctl(-1, VIDIOC_G_FMT, 0);
|
||||
printf("ioctl(-1, VIDIOC_G_FMT, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
struct v4l2_format *const p_format =
|
||||
tail_alloc(sizeof(*p_format));
|
||||
struct v4l2_format *const p_format = tail_alloc(sizeof(*p_format));
|
||||
p_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
|
||||
ioctl(-1, VIDIOC_G_FMT, p_format);
|
||||
@ -104,7 +112,7 @@ main(void )
|
||||
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 = 0xdeadbeef;
|
||||
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;
|
||||
@ -117,7 +125,7 @@ main(void )
|
||||
", 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,
|
||||
u.cc[0], u.cc[1], u.cc[2], u.cc[3],
|
||||
cc0(magic), cc1(magic), cc2(magic), cc3(magic),
|
||||
p_format->fmt.pix.bytesperline, p_format->fmt.pix.sizeimage);
|
||||
|
||||
/* VIDIOC_TRY_FMT */
|
||||
@ -129,7 +137,7 @@ main(void )
|
||||
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 = 0xdeadbeef;
|
||||
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;
|
||||
@ -145,7 +153,7 @@ main(void )
|
||||
", field=V4L2_FIELD_NONE, colorspace=V4L2_COLORSPACE_JPEG"
|
||||
", plane_fmt=[",
|
||||
p_format->fmt.pix_mp.width, p_format->fmt.pix_mp.height,
|
||||
u.cc[0], u.cc[1], u.cc[2], u.cc[3]);
|
||||
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(", ");
|
||||
@ -156,44 +164,55 @@ main(void )
|
||||
printf("], num_planes=%u}}) = -1 EBADF (%m)\n",
|
||||
p_format->fmt.pix_mp.num_planes);
|
||||
#else
|
||||
ioctl(-1, VIDIOC_TRY_FMT, page);
|
||||
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", magic);
|
||||
" = -1 EBADF (%m)\n", p_v4l2_format->type);
|
||||
#endif
|
||||
|
||||
/* VIDIOC_REQBUFS */
|
||||
ioctl(-1, VIDIOC_REQBUFS, 0);
|
||||
printf("ioctl(-1, VIDIOC_REQBUFS, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_REQBUFS,
|
||||
page + size - sizeof(struct v4l2_requestbuffers));
|
||||
struct v4l2_requestbuffers *const p_v4l2_requestbuffers =
|
||||
page + size - sizeof(*p_v4l2_requestbuffers);
|
||||
ioctl(-1, VIDIOC_REQBUFS, p_v4l2_requestbuffers);
|
||||
printf("ioctl(-1, VIDIOC_REQBUFS, {count=%u, type=%#x"
|
||||
" /* V4L2_BUF_TYPE_??? */, memory=%#x /* V4L2_MEMORY_??? */})"
|
||||
" = -1 EBADF (%m)\n", magic, magic, magic);
|
||||
" = -1 EBADF (%m)\n",
|
||||
p_v4l2_requestbuffers->count,
|
||||
p_v4l2_requestbuffers->type,
|
||||
p_v4l2_requestbuffers->memory);
|
||||
|
||||
/* VIDIOC_QUERYBUF */
|
||||
ioctl(-1, VIDIOC_QUERYBUF, 0);
|
||||
printf("ioctl(-1, VIDIOC_QUERYBUF, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_QUERYBUF, page + size - sizeof(struct v4l2_buffer));
|
||||
struct v4l2_buffer *const p_v4l2_buffer =
|
||||
page + size - sizeof(*p_v4l2_buffer);
|
||||
ioctl(-1, VIDIOC_QUERYBUF, p_v4l2_buffer);
|
||||
printf("ioctl(-1, VIDIOC_QUERYBUF, {type=%#x /* V4L2_BUF_TYPE_??? */"
|
||||
", index=%u}) = -1 EBADF (%m)\n", magic, magic);
|
||||
", index=%u}) = -1 EBADF (%m)\n",
|
||||
p_v4l2_buffer->type, p_v4l2_buffer->index);
|
||||
|
||||
/* VIDIOC_QBUF */
|
||||
ioctl(-1, VIDIOC_QBUF, 0);
|
||||
printf("ioctl(-1, VIDIOC_QBUF, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_QBUF, page + size - sizeof(struct v4l2_buffer));
|
||||
ioctl(-1, VIDIOC_QBUF, p_v4l2_buffer);
|
||||
printf("ioctl(-1, VIDIOC_QBUF, {type=%#x /* V4L2_BUF_TYPE_??? */"
|
||||
", index=%u}) = -1 EBADF (%m)\n", magic, magic);
|
||||
", index=%u}) = -1 EBADF (%m)\n",
|
||||
p_v4l2_buffer->type, p_v4l2_buffer->index);
|
||||
|
||||
/* VIDIOC_DQBUF */
|
||||
ioctl(-1, VIDIOC_DQBUF, 0);
|
||||
printf("ioctl(-1, VIDIOC_DQBUF, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_DQBUF, page + size - sizeof(struct v4l2_buffer));
|
||||
ioctl(-1, VIDIOC_DQBUF, p_v4l2_buffer);
|
||||
printf("ioctl(-1, VIDIOC_DQBUF, {type=%#x"
|
||||
" /* V4L2_BUF_TYPE_??? */}) = -1 EBADF (%m)\n", magic);
|
||||
" /* V4L2_BUF_TYPE_??? */}) = -1 EBADF (%m)\n",
|
||||
p_v4l2_buffer->type);
|
||||
|
||||
/* VIDIOC_G_FBUF */
|
||||
ioctl(-1, VIDIOC_G_FBUF, 0);
|
||||
@ -206,42 +225,49 @@ main(void )
|
||||
ioctl(-1, VIDIOC_S_FBUF, 0);
|
||||
printf("ioctl(-1, VIDIOC_S_FBUF, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_S_FBUF, page + size - sizeof(struct v4l2_framebuffer));
|
||||
struct v4l2_framebuffer *const p_v4l2_framebuffer =
|
||||
page + size - sizeof(*p_v4l2_framebuffer);
|
||||
ioctl(-1, VIDIOC_S_FBUF, p_v4l2_framebuffer);
|
||||
printf("ioctl(-1, VIDIOC_S_FBUF, {capability=%#x"
|
||||
", flags=%#x, base=%#lx}) = -1 EBADF (%m)\n",
|
||||
magic, magic, *(unsigned long *) page);
|
||||
", flags=%#x, base=%p}) = -1 EBADF (%m)\n",
|
||||
p_v4l2_framebuffer->capability,
|
||||
p_v4l2_framebuffer->flags,
|
||||
p_v4l2_framebuffer->base);
|
||||
|
||||
/* VIDIOC_STREAMON */
|
||||
ioctl(-1, VIDIOC_STREAMON, 0);
|
||||
printf("ioctl(-1, VIDIOC_STREAMON, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_STREAMON, page + size - sizeof(int));
|
||||
int *const p_int = page + size - sizeof(int);
|
||||
ioctl(-1, VIDIOC_STREAMON, p_int);
|
||||
printf("ioctl(-1, VIDIOC_STREAMON, [%#x /* V4L2_BUF_TYPE_??? */])"
|
||||
" = -1 EBADF (%m)\n", magic);
|
||||
" = -1 EBADF (%m)\n", *p_int);
|
||||
|
||||
/* VIDIOC_STREAMOFF */
|
||||
ioctl(-1, VIDIOC_STREAMOFF, 0);
|
||||
printf("ioctl(-1, VIDIOC_STREAMOFF, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_STREAMOFF, page + size - sizeof(int));
|
||||
ioctl(-1, VIDIOC_STREAMOFF, p_int);
|
||||
printf("ioctl(-1, VIDIOC_STREAMOFF, [%#x /* V4L2_BUF_TYPE_??? */])"
|
||||
" = -1 EBADF (%m)\n", magic);
|
||||
" = -1 EBADF (%m)\n", *p_int);
|
||||
|
||||
/* VIDIOC_G_PARM */
|
||||
ioctl(-1, VIDIOC_G_PARM, 0);
|
||||
printf("ioctl(-1, VIDIOC_G_PARM, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_G_PARM, page + size - sizeof(struct v4l2_streamparm));
|
||||
struct v4l2_streamparm *const p_v4l2_streamparm =
|
||||
page + size - sizeof(*p_v4l2_streamparm);
|
||||
ioctl(-1, VIDIOC_G_PARM, p_v4l2_streamparm);
|
||||
printf("ioctl(-1, VIDIOC_G_PARM, {type=%#x /* V4L2_BUF_TYPE_??? */})"
|
||||
" = -1 EBADF (%m)\n", magic);
|
||||
" = -1 EBADF (%m)\n", p_v4l2_streamparm->type);
|
||||
|
||||
/* VIDIOC_S_PARM */
|
||||
ioctl(-1, VIDIOC_S_PARM, 0);
|
||||
printf("ioctl(-1, VIDIOC_S_PARM, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_S_PARM, page);
|
||||
ioctl(-1, VIDIOC_S_PARM, p_v4l2_streamparm);
|
||||
printf("ioctl(-1, VIDIOC_S_PARM, {type=%#x /* V4L2_BUF_TYPE_??? */})"
|
||||
" = -1 EBADF (%m)\n", magic);
|
||||
" = -1 EBADF (%m)\n", p_v4l2_streamparm->type);
|
||||
|
||||
struct v4l2_streamparm *const p_streamparm =
|
||||
tail_alloc(sizeof(*p_streamparm));
|
||||
@ -279,58 +305,64 @@ main(void )
|
||||
ioctl(-1, VIDIOC_S_STD, 0);
|
||||
printf("ioctl(-1, VIDIOC_S_STD, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_S_STD, page + size - sizeof(long long));
|
||||
long long *const p_longlong = page + size - sizeof(*p_longlong);
|
||||
ioctl(-1, VIDIOC_S_STD, p_longlong);
|
||||
printf("ioctl(-1, VIDIOC_S_STD, [%#llx]) = -1 EBADF (%m)\n",
|
||||
*(unsigned long long *) page);
|
||||
*p_longlong);
|
||||
|
||||
/* VIDIOC_ENUMSTD */
|
||||
ioctl(-1, VIDIOC_ENUMSTD, 0);
|
||||
printf("ioctl(-1, VIDIOC_ENUMSTD, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
struct v4l2_standard *const p_standard =
|
||||
tail_alloc(sizeof(*p_standard));
|
||||
p_standard->index = magic;
|
||||
ioctl(-1, VIDIOC_ENUMSTD, p_standard);
|
||||
struct v4l2_standard *const p_v4l2_standard =
|
||||
page + size - sizeof(*p_v4l2_standard);
|
||||
ioctl(-1, VIDIOC_ENUMSTD, p_v4l2_standard);
|
||||
printf("ioctl(-1, VIDIOC_ENUMSTD, {index=%u}) = -1 EBADF (%m)\n",
|
||||
magic);
|
||||
p_v4l2_standard->index);
|
||||
|
||||
/* VIDIOC_ENUMINPUT */
|
||||
ioctl(-1, VIDIOC_ENUMINPUT, 0);
|
||||
printf("ioctl(-1, VIDIOC_ENUMINPUT, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_ENUMINPUT, page);
|
||||
struct v4l2_input *const p_v4l2_input =
|
||||
page + size - sizeof(*p_v4l2_input);
|
||||
ioctl(-1, VIDIOC_ENUMINPUT, p_v4l2_input);
|
||||
printf("ioctl(-1, VIDIOC_ENUMINPUT, {index=%u}) = -1 EBADF (%m)\n",
|
||||
magic);
|
||||
p_v4l2_input->index);
|
||||
|
||||
/* VIDIOC_G_CTRL */
|
||||
ioctl(-1, VIDIOC_G_CTRL, 0);
|
||||
printf("ioctl(-1, VIDIOC_G_CTRL, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_G_CTRL, page + size - sizeof(struct v4l2_control));
|
||||
struct v4l2_control *const p_v4l2_control =
|
||||
page + size - sizeof(*p_v4l2_control);
|
||||
ioctl(-1, VIDIOC_G_CTRL, p_v4l2_control);
|
||||
printf("ioctl(-1, VIDIOC_G_CTRL, {id=%#x /* V4L2_CID_??? */})"
|
||||
" = -1 EBADF (%m)\n", magic);
|
||||
" = -1 EBADF (%m)\n", p_v4l2_control->id);
|
||||
|
||||
/* VIDIOC_S_CTRL */
|
||||
ioctl(-1, VIDIOC_S_CTRL, 0);
|
||||
printf("ioctl(-1, VIDIOC_S_CTRL, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_S_CTRL, page + size - sizeof(struct v4l2_control));
|
||||
ioctl(-1, VIDIOC_S_CTRL, p_v4l2_control);
|
||||
printf("ioctl(-1, VIDIOC_S_CTRL, {id=%#x /* V4L2_CID_??? */"
|
||||
", value=%d}) = -1 EBADF (%m)\n", magic, magic);
|
||||
", value=%d}) = -1 EBADF (%m)\n",
|
||||
p_v4l2_control->id, p_v4l2_control->value);
|
||||
|
||||
/* VIDIOC_QUERYCTRL */
|
||||
ioctl(-1, VIDIOC_QUERYCTRL, 0);
|
||||
printf("ioctl(-1, VIDIOC_QUERYCTRL, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_QUERYCTRL,
|
||||
page + size - sizeof(struct v4l2_queryctrl));
|
||||
struct v4l2_queryctrl *const p_v4l2_queryctrl =
|
||||
page + size - sizeof(*p_v4l2_queryctrl);
|
||||
ioctl(-1, VIDIOC_QUERYCTRL, p_v4l2_queryctrl);
|
||||
# ifdef V4L2_CTRL_FLAG_NEXT_CTRL
|
||||
printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL"
|
||||
"|%#x /* V4L2_CID_??? */}) = -1 EBADF (%m)\n",
|
||||
magic & ~V4L2_CTRL_FLAG_NEXT_CTRL);
|
||||
p_v4l2_queryctrl->id & ~V4L2_CTRL_FLAG_NEXT_CTRL);
|
||||
# else
|
||||
printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=%#x /* V4L2_CID_??? */})"
|
||||
" = -1 EBADF (%m)\n", magic);
|
||||
" = -1 EBADF (%m)\n", p_v4l2_queryctrl->id);
|
||||
# endif
|
||||
|
||||
struct v4l2_queryctrl *const p_queryctrl =
|
||||
@ -351,33 +383,41 @@ main(void )
|
||||
ioctl(-1, VIDIOC_S_INPUT, 0);
|
||||
printf("ioctl(-1, VIDIOC_S_INPUT, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_S_INPUT, page + size - sizeof(int));
|
||||
printf("ioctl(-1, VIDIOC_S_INPUT, [%u]) = -1 EBADF (%m)\n", magic);
|
||||
ioctl(-1, VIDIOC_S_INPUT, p_int);
|
||||
printf("ioctl(-1, VIDIOC_S_INPUT, [%u]) = -1 EBADF (%m)\n", *p_int);
|
||||
|
||||
/* VIDIOC_CROPCAP */
|
||||
ioctl(-1, VIDIOC_CROPCAP, 0);
|
||||
printf("ioctl(-1, VIDIOC_CROPCAP, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_CROPCAP, page + size - sizeof(struct v4l2_cropcap));
|
||||
struct v4l2_cropcap *const p_v4l2_cropcap =
|
||||
page + size - sizeof(*p_v4l2_cropcap);
|
||||
ioctl(-1, VIDIOC_CROPCAP, p_v4l2_cropcap);
|
||||
printf("ioctl(-1, VIDIOC_CROPCAP, {type=%#x /* V4L2_BUF_TYPE_??? */})"
|
||||
" = -1 EBADF (%m)\n", magic);
|
||||
" = -1 EBADF (%m)\n", p_v4l2_cropcap->type);
|
||||
|
||||
/* VIDIOC_G_CROP */
|
||||
ioctl(-1, VIDIOC_G_CROP, 0);
|
||||
printf("ioctl(-1, VIDIOC_G_CROP, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_G_CROP, page + size - sizeof(struct v4l2_crop));
|
||||
struct v4l2_crop *const p_v4l2_crop =
|
||||
page + size - sizeof(*p_v4l2_crop);
|
||||
ioctl(-1, VIDIOC_G_CROP, p_v4l2_crop);
|
||||
printf("ioctl(-1, VIDIOC_G_CROP, {type=%#x /* V4L2_BUF_TYPE_??? */})"
|
||||
" = -1 EBADF (%m)\n", magic);
|
||||
" = -1 EBADF (%m)\n", p_v4l2_crop->type);
|
||||
|
||||
/* VIDIOC_S_CROP */
|
||||
ioctl(-1, VIDIOC_S_CROP, 0);
|
||||
printf("ioctl(-1, VIDIOC_S_CROP, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_S_CROP, page + size - sizeof(struct v4l2_crop));
|
||||
ioctl(-1, VIDIOC_S_CROP, p_v4l2_crop);
|
||||
printf("ioctl(-1, VIDIOC_S_CROP, {type=%#x /* V4L2_BUF_TYPE_??? */"
|
||||
", c={left=%d, top=%d, width=%u, height=%u}}) = -1 EBADF (%m)\n",
|
||||
magic, magic, magic, magic, magic);
|
||||
p_v4l2_crop->type,
|
||||
p_v4l2_crop->c.left,
|
||||
p_v4l2_crop->c.top,
|
||||
p_v4l2_crop->c.width,
|
||||
p_v4l2_crop->c.height);
|
||||
|
||||
#ifdef VIDIOC_S_EXT_CTRLS
|
||||
/* VIDIOC_S_EXT_CTRLS */
|
||||
@ -473,48 +513,47 @@ main(void )
|
||||
struct v4l2_frmsizeenum *const p_frmsizeenum =
|
||||
tail_alloc(sizeof(*p_frmsizeenum));
|
||||
p_frmsizeenum->index = magic;
|
||||
const union u_pixel_format u_frmsizeenum = {
|
||||
.cc = { 'A', '\'', '\\', '\xfa' }
|
||||
};
|
||||
#if WORDS_BIGENDIAN
|
||||
p_frmsizeenum->pixel_format =
|
||||
(unsigned) u_frmsizeenum.cc[0] << 24 |
|
||||
(unsigned) u_frmsizeenum.cc[1] << 16 |
|
||||
(unsigned) u_frmsizeenum.cc[2] << 8 |
|
||||
(unsigned) u_frmsizeenum.cc[3];
|
||||
#else
|
||||
p_frmsizeenum->pixel_format = u_frmsizeenum.pixelformat;
|
||||
#endif
|
||||
p_frmsizeenum->pixel_format = fourcc(cc[0], cc[1], cc[2], cc[3]);
|
||||
|
||||
ioctl(-1, VIDIOC_ENUM_FRAMESIZES, p_frmsizeenum);
|
||||
printf("ioctl(-1, VIDIOC_ENUM_FRAMESIZES, {index=%u"
|
||||
", pixel_format=v4l2_fourcc('%c', '\\%c', '\\%c', '\\x%x')})"
|
||||
" = -1 EBADF (%m)\n", p_frmsizeenum->index,
|
||||
u_frmsizeenum.cc[0], u_frmsizeenum.cc[1],
|
||||
u_frmsizeenum.cc[2], u_frmsizeenum.cc[3]);
|
||||
cc[0], cc[1], cc[2], cc[3]);
|
||||
#endif /* VIDIOC_ENUM_FRAMESIZES */
|
||||
|
||||
#ifdef VIDIOC_ENUM_FRAMEINTERVALS
|
||||
ioctl(-1, VIDIOC_ENUM_FRAMEINTERVALS, 0);
|
||||
printf("ioctl(-1, VIDIOC_ENUM_FRAMEINTERVALS, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_ENUM_FRAMEINTERVALS, page);
|
||||
struct v4l2_frmivalenum *const p_v4l2_frmivalenum =
|
||||
page + size - sizeof(*p_v4l2_frmivalenum);
|
||||
ioctl(-1, VIDIOC_ENUM_FRAMEINTERVALS, p_v4l2_frmivalenum);
|
||||
printf("ioctl(-1, VIDIOC_ENUM_FRAMEINTERVALS, {index=%u"
|
||||
", pixel_format=v4l2_fourcc('\\x%x', '\\x%x', '\\x%x', '\\x%x')"
|
||||
", width=%u, height=%u}) = -1 EBADF (%m)\n",
|
||||
magic, u.cc[0], u.cc[1], u.cc[2], u.cc[3], magic, magic);
|
||||
p_v4l2_frmivalenum->index,
|
||||
cc0(p_v4l2_frmivalenum->pixel_format),
|
||||
cc1(p_v4l2_frmivalenum->pixel_format),
|
||||
cc2(p_v4l2_frmivalenum->pixel_format),
|
||||
cc3(p_v4l2_frmivalenum->pixel_format),
|
||||
p_v4l2_frmivalenum->width,
|
||||
p_v4l2_frmivalenum->height);
|
||||
#endif /* VIDIOC_ENUM_FRAMEINTERVALS */
|
||||
|
||||
#ifdef VIDIOC_CREATE_BUFS
|
||||
ioctl(-1, VIDIOC_CREATE_BUFS, 0);
|
||||
printf("ioctl(-1, VIDIOC_CREATE_BUFS, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
ioctl(-1, VIDIOC_CREATE_BUFS,
|
||||
page + size - sizeof(struct v4l2_create_buffers));
|
||||
struct v4l2_create_buffers *const p_v4l2_create_buffers =
|
||||
page + size - sizeof(*p_v4l2_create_buffers);
|
||||
ioctl(-1, VIDIOC_CREATE_BUFS, p_v4l2_create_buffers);
|
||||
printf("ioctl(-1, VIDIOC_CREATE_BUFS, {count=%u, memory=%#x"
|
||||
" /* V4L2_MEMORY_??? */, format={type=%#x"
|
||||
" /* V4L2_BUF_TYPE_??? */}}) = -1 EBADF (%m)\n",
|
||||
magic, magic, magic);
|
||||
p_v4l2_create_buffers->count,
|
||||
p_v4l2_create_buffers->memory,
|
||||
p_v4l2_create_buffers->format.type);
|
||||
#endif /* VIDIOC_CREATE_BUFS */
|
||||
|
||||
puts("+++ exited with 0 +++");
|
||||
|
Loading…
Reference in New Issue
Block a user