public:
buffers(bool is_output, bool is_mmap)
{
- if (is_output) {
- is_mplane = capabilities &
- (V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE);
- type = is_mplane ?
- V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE : V4L2_BUF_TYPE_VIDEO_OUTPUT;
- } else {
- is_mplane = capabilities &
- (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE);
- type = is_mplane ?
- V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : V4L2_BUF_TYPE_VIDEO_CAPTURE;
- }
+ type = is_output ? vidout_buftype : vidcap_buftype;
memory = is_mmap ? V4L2_MEMORY_MMAP : V4L2_MEMORY_USERPTR;
}
void streaming_list(int fd)
{
if (options[OptListBuffers]) {
- bool is_mplane = capabilities &
- (V4L2_CAP_VIDEO_CAPTURE_MPLANE |
- V4L2_CAP_VIDEO_M2M_MPLANE);
-
- list_buffers(fd, is_mplane ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE :
- V4L2_BUF_TYPE_VIDEO_CAPTURE);
+ list_buffers(fd, vidcap_buftype);
}
if (options[OptListBuffersOut]) {
- bool is_mplane = capabilities &
- (V4L2_CAP_VIDEO_OUTPUT_MPLANE |
- V4L2_CAP_VIDEO_M2M_MPLANE);
-
- list_buffers(fd, is_mplane ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE :
- V4L2_BUF_TYPE_VIDEO_OUTPUT);
+ list_buffers(fd, vidout_buftype);
}
if (options[OptListBuffersVbi]) {
{
printf("\nVideo Capture Formats options:\n"
" --list-formats display supported video formats [VIDIOC_ENUM_FMT]\n"
- " --list-formats-mplane\n"
- " display supported video multi-planar formats\n"
- " [VIDIOC_ENUM_FMT]\n"
" --list-formats-ext display supported video formats including frame sizes\n"
" and intervals\n"
- " --list-formats-ext-mplane\n"
- " display supported video multi-planar formats including\n"
- " frame sizes and intervals\n"
" --list-framesizes=<f>\n"
" list supported framesizes for pixelformat <f>\n"
" [VIDIOC_ENUM_FRAMESIZES]\n"
" <f> can be one of:\n"
" any, none, top, bottom, interlaced, seq_tb, seq_bt,\n"
" alternate, interlaced_tb, interlaced_bt\n"
- " --get-fmt-video-mplane\n"
- " query the video capture format through the multi-planar API\n"
- " [VIDIOC_G_FMT]\n"
- " --set-fmt-video-mplane\n"
- " --try-fmt-video-mplane=width=<w>,height=<h>,pixelformat=<pf>,field=<f>\n"
- " set/try the video capture format using the multi-planar API\n"
- " [VIDIOC_S/TRY_FMT]\n"
- " pixelformat is either the format index as reported by\n"
- " --list-formats-mplane, or the fourcc value as a string.\n"
- " <f> can be one of:\n"
- " any, none, top, bottom, interlaced, seq_tb, seq_bt,\n"
- " alternate, interlaced_tb, interlaced_bt\n"
);
}
}
}
-static void print_video_formats_ext(int fd, enum v4l2_buf_type type)
+static void print_video_formats_ext(int fd, __u32 type)
{
struct v4l2_fmtdesc fmt;
struct v4l2_frmsizeenum frmsize;
{
struct v4l2_format fmt;
struct v4l2_format tmp;
- bool is_mplane = capabilities &
- (V4L2_CAP_VIDEO_CAPTURE_MPLANE |
- V4L2_CAP_VIDEO_M2M_MPLANE);
- fmt.type = is_mplane ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE :
- V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ fmt.type = vidcap_buftype;
if (test_ioctl(fd, VIDIOC_G_FMT, &fmt) < 0)
return;
bool ok;
tmp = fmt;
- if (is_mplane)
+ if (is_multiplanar)
tmp.fmt.pix_mp.field = f;
else
tmp.fmt.pix.field = f;
if (test_ioctl(fd, VIDIOC_TRY_FMT, &tmp) < 0)
continue;
- if (is_mplane)
+ if (is_multiplanar)
ok = tmp.fmt.pix_mp.field == f;
else
ok = tmp.fmt.pix.field == f;
char *value, *subs;
switch (ch) {
- case OptSetVideoMplaneFormat:
- case OptTryVideoMplaneFormat:
- set_fmts = parse_fmt(optarg, width, height, field, pixfmt);
- if (!set_fmts) {
- vidcap_usage();
- exit(1);
- }
- vfmt.fmt.pix_mp.width = width;
- vfmt.fmt.pix_mp.height = height;
- vfmt.fmt.pix_mp.field = field;
- vfmt.fmt.pix_mp.pixelformat = pixfmt;
- break;
-
case OptSetVideoFormat:
case OptTryVideoFormat:
set_fmts = parse_fmt(optarg, width, height, field, pixfmt);
vidcap_usage();
exit(1);
}
- vfmt.fmt.pix.width = width;
- vfmt.fmt.pix.height = height;
- vfmt.fmt.pix.field = field;
- vfmt.fmt.pix.pixelformat = pixfmt;
+ if (is_multiplanar) {
+ vfmt.fmt.pix_mp.width = width;
+ vfmt.fmt.pix_mp.height = height;
+ vfmt.fmt.pix_mp.field = field;
+ vfmt.fmt.pix_mp.pixelformat = pixfmt;
+ } else {
+ vfmt.fmt.pix.width = width;
+ vfmt.fmt.pix.height = height;
+ vfmt.fmt.pix.field = field;
+ vfmt.fmt.pix.pixelformat = pixfmt;
+ }
break;
case OptListFrameSizes:
if (strlen(optarg) == 4)
int ret;
if (options[OptSetVideoFormat] || options[OptTryVideoFormat]) {
- struct v4l2_format in_vfmt;
-
- in_vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- if (doioctl(fd, VIDIOC_G_FMT, &in_vfmt) == 0) {
- if (set_fmts & FmtWidth)
- in_vfmt.fmt.pix.width = vfmt.fmt.pix.width;
- if (set_fmts & FmtHeight)
- in_vfmt.fmt.pix.height = vfmt.fmt.pix.height;
- if (set_fmts & FmtPixelFormat) {
- in_vfmt.fmt.pix.pixelformat = vfmt.fmt.pix.pixelformat;
- if (in_vfmt.fmt.pix.pixelformat < 256) {
- in_vfmt.fmt.pix.pixelformat =
- find_pixel_format(fd, in_vfmt.fmt.pix.pixelformat,
- false, false);
+ struct v4l2_format vfmt;
+
+ vfmt.type = vidcap_buftype;
+ if (doioctl(fd, VIDIOC_G_FMT, &vfmt) == 0) {
+ if (is_multiplanar) {
+ if (set_fmts & FmtWidth)
+ vfmt.fmt.pix_mp.width = vfmt.fmt.pix_mp.width;
+ if (set_fmts & FmtHeight)
+ vfmt.fmt.pix_mp.height = vfmt.fmt.pix_mp.height;
+ if (set_fmts & FmtPixelFormat) {
+ vfmt.fmt.pix_mp.pixelformat = vfmt.fmt.pix_mp.pixelformat;
+ if (vfmt.fmt.pix_mp.pixelformat < 256) {
+ vfmt.fmt.pix_mp.pixelformat =
+ find_pixel_format(fd, vfmt.fmt.pix_mp.pixelformat,
+ false, true);
+ }
+ }
+ /* G_FMT might return bytesperline values > width,
+ * reset them to 0 to force the driver to update them
+ * to the closest value for the new width. */
+ for (unsigned i = 0; i < vfmt.fmt.pix_mp.num_planes; i++)
+ vfmt.fmt.pix_mp.plane_fmt[i].bytesperline = 0;
+ } else {
+ if (set_fmts & FmtWidth)
+ vfmt.fmt.pix.width = vfmt.fmt.pix.width;
+ if (set_fmts & FmtHeight)
+ vfmt.fmt.pix.height = vfmt.fmt.pix.height;
+ if (set_fmts & FmtPixelFormat) {
+ vfmt.fmt.pix.pixelformat = vfmt.fmt.pix.pixelformat;
+ if (vfmt.fmt.pix.pixelformat < 256) {
+ vfmt.fmt.pix.pixelformat =
+ find_pixel_format(fd, vfmt.fmt.pix.pixelformat,
+ false, false);
+ }
}
+ /* G_FMT might return a bytesperline value > width,
+ * reset this to 0 to force the driver to update it
+ * to the closest value for the new width. */
+ vfmt.fmt.pix.bytesperline = 0;
}
- /* G_FMT might return a bytesperline value > width,
- * reset this to 0 to force the driver to update it
- * to the closest value for the new width. */
- in_vfmt.fmt.pix.bytesperline = 0;
+
if (options[OptSetVideoFormat])
- ret = doioctl(fd, VIDIOC_S_FMT, &in_vfmt);
+ ret = doioctl(fd, VIDIOC_S_FMT, &vfmt);
else
- ret = doioctl(fd, VIDIOC_TRY_FMT, &in_vfmt);
+ ret = doioctl(fd, VIDIOC_TRY_FMT, &vfmt);
if (ret == 0 && (verbose || options[OptTryVideoFormat]))
- printfmt(in_vfmt);
- }
- }
-
- if (options[OptSetVideoMplaneFormat] || options[OptTryVideoMplaneFormat]) {
- struct v4l2_format in_vfmt;
-
- in_vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
- if (doioctl(fd, VIDIOC_G_FMT, &in_vfmt) == 0) {
- if (set_fmts & FmtWidth)
- in_vfmt.fmt.pix_mp.width = vfmt.fmt.pix_mp.width;
- if (set_fmts & FmtHeight)
- in_vfmt.fmt.pix_mp.height = vfmt.fmt.pix_mp.height;
- if (set_fmts & FmtPixelFormat) {
- in_vfmt.fmt.pix_mp.pixelformat = vfmt.fmt.pix_mp.pixelformat;
- if (in_vfmt.fmt.pix_mp.pixelformat < 256) {
- in_vfmt.fmt.pix_mp.pixelformat =
- find_pixel_format(fd, in_vfmt.fmt.pix_mp.pixelformat,
- false, true);
- }
- }
- /* G_FMT might return bytesperline values > width,
- * reset them to 0 to force the driver to update them
- * to the closest value for the new width. */
- for (unsigned i = 0; i < in_vfmt.fmt.pix_mp.num_planes; i++)
- in_vfmt.fmt.pix_mp.plane_fmt[i].bytesperline = 0;
- if (options[OptSetVideoMplaneFormat])
- ret = doioctl(fd, VIDIOC_S_FMT, &in_vfmt);
- else
- ret = doioctl(fd, VIDIOC_TRY_FMT, &in_vfmt);
- if (ret == 0 && (verbose || options[OptTryVideoMplaneFormat]))
- printfmt(in_vfmt);
+ printfmt(vfmt);
}
}
}
void vidcap_get(int fd)
{
if (options[OptGetVideoFormat]) {
- vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- if (doioctl(fd, VIDIOC_G_FMT, &vfmt) == 0)
- printfmt(vfmt);
- }
-
- if (options[OptGetVideoMplaneFormat]) {
- vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+ vfmt.type = vidcap_buftype;
if (doioctl(fd, VIDIOC_G_FMT, &vfmt) == 0)
printfmt(vfmt);
}
{
if (options[OptListFormats]) {
printf("ioctl: VIDIOC_ENUM_FMT\n");
- print_video_formats(fd, V4L2_BUF_TYPE_VIDEO_CAPTURE);
- }
-
- if (options[OptListMplaneFormats]) {
- printf("ioctl: VIDIOC_ENUM_FMT\n");
- print_video_formats(fd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+ print_video_formats(fd, vidcap_buftype);
}
if (options[OptListFormatsExt]) {
printf("ioctl: VIDIOC_ENUM_FMT\n");
- print_video_formats_ext(fd, V4L2_BUF_TYPE_VIDEO_CAPTURE);
- }
-
- if (options[OptListMplaneFormatsExt]) {
- printf("ioctl: VIDIOC_ENUM_FMT\n");
- print_video_formats_ext(fd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+ print_video_formats_ext(fd, vidcap_buftype);
}
if (options[OptListFields]) {
" <f> can be one of:\n"
" any, none, top, bottom, interlaced, seq_tb, seq_bt,\n"
" alternate, interlaced_tb, interlaced_bt\n"
- " --list-formats-out-mplane\n"
- " display supported video output multi-planar formats\n"
- " [VIDIOC_ENUM_FMT]\n"
- " --get-fmt-video-out-mplane\n"
- " query the video output format using the multi-planar API\n"
- " [VIDIOC_G_FMT]\n"
- " --set-fmt-video-out-mplane\n"
- " --try-fmt-video-out-mplane=width=<w>,height=<h>,pixelformat=<pf>,field=<f>\n"
- " set/try the video output format with the multi-planar API\n"
- " [VIDIOC_S/TRY_FMT]\n"
- " pixelformat is either the format index as reported by\n"
- " --list-formats-out-mplane, or the fourcc value as a string.\n"
- " <f> can be one of:\n"
- " any, none, top, bottom, interlaced, seq_tb, seq_bt,\n"
- " alternate, interlaced_tb, interlaced_bt\n"
);
}
{
struct v4l2_format fmt;
struct v4l2_format tmp;
- bool is_mplane = capabilities &
- (V4L2_CAP_VIDEO_OUTPUT_MPLANE |
- V4L2_CAP_VIDEO_M2M_MPLANE);
- fmt.type = is_mplane ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE :
- V4L2_BUF_TYPE_VIDEO_OUTPUT;
+ fmt.type = vidout_buftype;
if (test_ioctl(fd, VIDIOC_G_FMT, &fmt) < 0)
return;
bool ok;
tmp = fmt;
- if (is_mplane)
+ if (is_multiplanar)
tmp.fmt.pix_mp.field = f;
else
tmp.fmt.pix.field = f;
if (test_ioctl(fd, VIDIOC_TRY_FMT, &tmp) < 0)
continue;
- if (is_mplane)
+ if (is_multiplanar)
ok = tmp.fmt.pix_mp.field == f;
else
ok = tmp.fmt.pix.field == f;
__u32 width, height, field, pixfmt;
switch (ch) {
- case OptSetVideoOutMplaneFormat:
- case OptTryVideoOutMplaneFormat:
- set_fmts_out = parse_fmt(optarg, width, height, field, pixfmt);
- if (!set_fmts_out) {
- vidcap_usage();
- exit(1);
- }
- vfmt_out.fmt.pix_mp.width = width;
- vfmt_out.fmt.pix_mp.height = height;
- vfmt_out.fmt.pix_mp.field = field;
- vfmt_out.fmt.pix_mp.pixelformat = pixfmt;
- break;
-
case OptSetVideoOutFormat:
case OptTryVideoOutFormat:
set_fmts_out = parse_fmt(optarg, width, height, field, pixfmt);
vidcap_usage();
exit(1);
}
- vfmt_out.fmt.pix.width = width;
- vfmt_out.fmt.pix.height = height;
- vfmt_out.fmt.pix.field = field;
- vfmt_out.fmt.pix.pixelformat = pixfmt;
+ if (is_multiplanar) {
+ vfmt_out.fmt.pix_mp.width = width;
+ vfmt_out.fmt.pix_mp.height = height;
+ vfmt_out.fmt.pix_mp.field = field;
+ vfmt_out.fmt.pix_mp.pixelformat = pixfmt;
+ } else {
+ vfmt_out.fmt.pix.width = width;
+ vfmt_out.fmt.pix.height = height;
+ vfmt_out.fmt.pix.field = field;
+ vfmt_out.fmt.pix.pixelformat = pixfmt;
+ }
break;
}
}
int ret;
if (options[OptSetVideoOutFormat] || options[OptTryVideoOutFormat]) {
- struct v4l2_format in_vfmt;
-
- in_vfmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
- if (doioctl(fd, VIDIOC_G_FMT, &in_vfmt) == 0) {
- if (set_fmts_out & FmtWidth)
- in_vfmt.fmt.pix.width = vfmt_out.fmt.pix.width;
- if (set_fmts_out & FmtHeight)
- in_vfmt.fmt.pix.height = vfmt_out.fmt.pix.height;
- if (set_fmts_out & FmtPixelFormat) {
- in_vfmt.fmt.pix.pixelformat = vfmt_out.fmt.pix.pixelformat;
- if (in_vfmt.fmt.pix.pixelformat < 256) {
- in_vfmt.fmt.pix.pixelformat =
- find_pixel_format(fd, in_vfmt.fmt.pix.pixelformat,
- true, false);
+ struct v4l2_format vfmt;
+
+ vfmt.type = vidout_buftype;
+ if (doioctl(fd, VIDIOC_G_FMT, &vfmt) == 0) {
+ if (is_multiplanar) {
+ if (set_fmts_out & FmtWidth)
+ vfmt.fmt.pix_mp.width = vfmt_out.fmt.pix_mp.width;
+ if (set_fmts_out & FmtHeight)
+ vfmt.fmt.pix_mp.height = vfmt_out.fmt.pix_mp.height;
+ if (set_fmts_out & FmtPixelFormat) {
+ vfmt.fmt.pix_mp.pixelformat = vfmt_out.fmt.pix_mp.pixelformat;
+ if (vfmt.fmt.pix_mp.pixelformat < 256) {
+ vfmt.fmt.pix_mp.pixelformat =
+ find_pixel_format(fd, vfmt.fmt.pix_mp.pixelformat,
+ true, true);
+ }
+ }
+ /* G_FMT might return bytesperline values > width,
+ * reset them to 0 to force the driver to update them
+ * to the closest value for the new width. */
+ for (unsigned i = 0; i < vfmt.fmt.pix_mp.num_planes; i++)
+ vfmt.fmt.pix_mp.plane_fmt[i].bytesperline = 0;
+ } else {
+ if (set_fmts_out & FmtWidth)
+ vfmt.fmt.pix.width = vfmt_out.fmt.pix.width;
+ if (set_fmts_out & FmtHeight)
+ vfmt.fmt.pix.height = vfmt_out.fmt.pix.height;
+ if (set_fmts_out & FmtPixelFormat) {
+ vfmt.fmt.pix.pixelformat = vfmt_out.fmt.pix.pixelformat;
+ if (vfmt.fmt.pix.pixelformat < 256) {
+ vfmt.fmt.pix.pixelformat =
+ find_pixel_format(fd, vfmt.fmt.pix.pixelformat,
+ true, false);
+ }
}
+ /* G_FMT might return a bytesperline value > width,
+ * reset this to 0 to force the driver to update it
+ * to the closest value for the new width. */
+ vfmt.fmt.pix.bytesperline = 0;
}
- /* G_FMT might return a bytesperline value > width,
- * reset this to 0 to force the driver to update it
- * to the closest value for the new width. */
- in_vfmt.fmt.pix.bytesperline = 0;
if (options[OptSetVideoOutFormat])
- ret = doioctl(fd, VIDIOC_S_FMT, &in_vfmt);
+ ret = doioctl(fd, VIDIOC_S_FMT, &vfmt);
else
- ret = doioctl(fd, VIDIOC_TRY_FMT, &in_vfmt);
+ ret = doioctl(fd, VIDIOC_TRY_FMT, &vfmt);
if (ret == 0 && (verbose || options[OptTryVideoOutFormat]))
- printfmt(in_vfmt);
- }
- }
-
- if (options[OptSetVideoOutMplaneFormat] || options[OptTryVideoOutMplaneFormat]) {
- struct v4l2_format in_vfmt;
-
- in_vfmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
- if (doioctl(fd, VIDIOC_G_FMT, &in_vfmt) == 0) {
- if (set_fmts_out & FmtWidth)
- in_vfmt.fmt.pix_mp.width = vfmt_out.fmt.pix_mp.width;
- if (set_fmts_out & FmtHeight)
- in_vfmt.fmt.pix_mp.height = vfmt_out.fmt.pix_mp.height;
- if (set_fmts_out & FmtPixelFormat) {
- in_vfmt.fmt.pix_mp.pixelformat = vfmt_out.fmt.pix_mp.pixelformat;
- if (in_vfmt.fmt.pix_mp.pixelformat < 256) {
- in_vfmt.fmt.pix_mp.pixelformat =
- find_pixel_format(fd, in_vfmt.fmt.pix_mp.pixelformat,
- true, true);
- }
- }
- /* G_FMT might return bytesperline values > width,
- * reset them to 0 to force the driver to update them
- * to the closest value for the new width. */
- for (unsigned i = 0; i < in_vfmt.fmt.pix_mp.num_planes; i++)
- in_vfmt.fmt.pix_mp.plane_fmt[i].bytesperline = 0;
-
- if (options[OptSetVideoOutMplaneFormat])
- ret = doioctl(fd, VIDIOC_S_FMT, &in_vfmt);
- else
- ret = doioctl(fd, VIDIOC_TRY_FMT, &in_vfmt);
- if (ret == 0 && (verbose || options[OptTryVideoOutMplaneFormat]))
- printfmt(in_vfmt);
+ printfmt(vfmt);
}
}
}
void vidout_get(int fd)
{
if (options[OptGetVideoOutFormat]) {
- vfmt_out.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
- if (doioctl(fd, VIDIOC_G_FMT, &vfmt_out) == 0)
- printfmt(vfmt_out);
- }
-
- if (options[OptGetVideoOutMplaneFormat]) {
- vfmt_out.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+ vfmt_out.type = vidout_buftype;
if (doioctl(fd, VIDIOC_G_FMT, &vfmt_out) == 0)
printfmt(vfmt_out);
}
{
if (options[OptListOutFormats]) {
printf("ioctl: VIDIOC_ENUM_FMT\n");
- print_video_formats(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT);
- }
-
- if (options[OptListOutMplaneFormats]) {
- printf("ioctl: VIDIOC_ENUM_FMT\n");
- print_video_formats(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
+ print_video_formats(fd, vidout_buftype);
}
if (options[OptListOutFields]) {
int verbose;
unsigned capabilities;
+bool is_multiplanar;
+__u32 vidcap_buftype;
+__u32 vidout_buftype;
static struct option long_options[] = {
{"list-audio-inputs", no_argument, 0, OptListAudioInputs},
{"get-fmt-video", no_argument, 0, OptGetVideoFormat},
{"set-fmt-video", required_argument, 0, OptSetVideoFormat},
{"try-fmt-video", required_argument, 0, OptTryVideoFormat},
- {"get-fmt-video-mplane", no_argument, 0, OptGetVideoMplaneFormat},
- {"set-fmt-video-mplane", required_argument, 0, OptSetVideoMplaneFormat},
- {"try-fmt-video-mplane", required_argument, 0, OptTryVideoMplaneFormat},
{"get-fmt-video-out", no_argument, 0, OptGetVideoOutFormat},
{"set-fmt-video-out", required_argument, 0, OptSetVideoOutFormat},
{"try-fmt-video-out", required_argument, 0, OptTryVideoOutFormat},
- {"get-fmt-video-out-mplane", no_argument, 0, OptGetVideoOutMplaneFormat},
- {"set-fmt-video-out-mplane", required_argument, 0, OptSetVideoOutMplaneFormat},
- {"try-fmt-video-out-mplane", required_argument, 0, OptTryVideoOutMplaneFormat},
{"help", no_argument, 0, OptHelp},
{"help-tuner", no_argument, 0, OptHelpTuner},
{"help-io", no_argument, 0, OptHelpIO},
{"set-freq", required_argument, 0, OptSetFreq},
{"list-standards", no_argument, 0, OptListStandards},
{"list-formats", no_argument, 0, OptListFormats},
- {"list-formats-mplane", no_argument, 0, OptListMplaneFormats},
{"list-formats-ext", no_argument, 0, OptListFormatsExt},
- {"list-formats-ext-mplane", no_argument, 0, OptListMplaneFormatsExt},
{"list-fields", no_argument, 0, OptListFields},
{"list-framesizes", required_argument, 0, OptListFrameSizes},
{"list-frameintervals", required_argument, 0, OptListFrameIntervals},
{"list-formats-overlay", no_argument, 0, OptListOverlayFormats},
{"list-formats-out", no_argument, 0, OptListOutFormats},
- {"list-formats-out-mplane", no_argument, 0, OptListOutMplaneFormats},
{"list-fields-out", no_argument, 0, OptListOutFields},
{"get-standard", no_argument, 0, OptGetStandard},
{"set-standard", required_argument, 0, OptSetStandard},
return flags2s(flags, fmtdesc_def);
}
-void print_video_formats(int fd, enum v4l2_buf_type type)
+void print_video_formats(int fd, __u32 type)
{
struct v4l2_fmtdesc fmt;
if (capabilities & V4L2_CAP_DEVICE_CAPS)
capabilities = vcap.device_caps;
+ is_multiplanar = capabilities & (V4L2_CAP_VIDEO_CAPTURE_MPLANE |
+ V4L2_CAP_VIDEO_M2M_MPLANE |
+ V4L2_CAP_VIDEO_OUTPUT_MPLANE);
+
+ vidcap_buftype = is_multiplanar ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE :
+ V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ vidout_buftype = is_multiplanar ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE :
+ V4L2_BUF_TYPE_VIDEO_OUTPUT;
+
common_process_controls(fd);
if (wait_for_event == V4L2_EVENT_CTRL && wait_event_id)
if (options[OptAll]) {
options[OptGetVideoFormat] = 1;
- options[OptGetVideoMplaneFormat] = 1;
options[OptGetCrop] = 1;
options[OptGetVideoOutFormat] = 1;
- options[OptGetVideoOutMplaneFormat] = 1;
options[OptGetDriverInfo] = 1;
options[OptGetInput] = 1;
options[OptGetOutput] = 1;
OptSetVideoFormat = 'v',
OptUseWrapper = 'w',
- OptGetVideoMplaneFormat = 128,
- OptSetVideoMplaneFormat,
- OptGetSlicedVbiOutFormat,
+ OptGetSlicedVbiOutFormat = 128,
OptGetOverlayFormat,
OptGetOutputOverlayFormat,
OptGetVbiFormat,
OptGetVbiOutFormat,
OptGetVideoOutFormat,
- OptGetVideoOutMplaneFormat,
OptSetSlicedVbiOutFormat,
OptSetOutputOverlayFormat,
OptSetOverlayFormat,
//OptSetVbiFormat, TODO
//OptSetVbiOutFormat, TODO
OptSetVideoOutFormat,
- OptSetVideoOutMplaneFormat,
OptTryVideoOutFormat,
- OptTryVideoOutMplaneFormat,
OptTrySlicedVbiOutFormat,
OptTrySlicedVbiFormat,
OptTryVideoFormat,
- OptTryVideoMplaneFormat,
OptTryOutputOverlayFormat,
OptTryOverlayFormat,
//OptTryVbiFormat, TODO
OptAll,
OptListStandards,
OptListFormats,
- OptListMplaneFormats,
OptListFormatsExt,
- OptListMplaneFormatsExt,
OptListFields,
OptListFrameSizes,
OptListFrameIntervals,
OptListOverlayFormats,
OptListOutFormats,
- OptListOutMplaneFormats,
OptListOutFields,
OptLogStatus,
OptVerbose,
extern char options[OptLast];
extern unsigned capabilities;
+extern bool is_multiplanar;
+extern __u32 vidcap_buftype;
+extern __u32 vidout_buftype;
extern int verbose;
typedef struct {
int parse_fmt(char *optarg, __u32 &width, __u32 &height, __u32 &field, __u32 &pixelformat);
__u32 find_pixel_format(int fd, unsigned index, bool output, bool mplane);
void printfmt(const struct v4l2_format &vfmt);
-void print_video_formats(int fd, enum v4l2_buf_type type);
+void print_video_formats(int fd, __u32 type);
#define doioctl(n, r, p) doioctl_name(n, r, p, #r)