Skip to content

Commit f20b60a

Browse files
authored
app/v4l2_to_ip: refine code (#689)
(cherry picked from commit f4a85c5)
1 parent 0c11624 commit f20b60a

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

app/v4l2_to_ip/v4l2_to_ip.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -842,25 +842,30 @@ static int video_set_format(struct device* dev, unsigned int w, unsigned int h,
842842

843843
ret = ioctl(dev->fd, VIDIOC_S_FMT, &fmt);
844844
if (ret < 0) {
845-
printf("Unable to set format: %s (%d).\n", strerror(errno), errno);
845+
printf("Failed to configure video format: %s (%d).\n", strerror(errno), errno);
846846
return ret;
847847
}
848848

849849
if (video_is_mplane(dev)) {
850-
printf("Video format set: %s (%08x) %ux%u field %s, %u planes: \n",
851-
v4l2_format_name(fmt.fmt.pix_mp.pixelformat), fmt.fmt.pix_mp.pixelformat,
852-
fmt.fmt.pix_mp.width, fmt.fmt.pix_mp.height,
853-
v4l2_field_name(fmt.fmt.pix_mp.field), fmt.fmt.pix_mp.num_planes);
850+
printf(
851+
"Video attributes, pixel format: %s (%08x), resolution: %ux%u field: %s, number "
852+
"of planes: %u\n",
853+
v4l2_format_name(fmt.fmt.pix_mp.pixelformat), fmt.fmt.pix_mp.pixelformat,
854+
fmt.fmt.pix_mp.width, fmt.fmt.pix_mp.height,
855+
v4l2_field_name(fmt.fmt.pix_mp.field), fmt.fmt.pix_mp.num_planes);
854856

855857
for (i = 0; i < fmt.fmt.pix_mp.num_planes; i++) {
856-
printf(" * Stride %u, buffer size %u\n", fmt.fmt.pix_mp.plane_fmt[i].bytesperline,
858+
printf("Plane %d attributes, stride: %u, buffer size: %u\n", i,
859+
fmt.fmt.pix_mp.plane_fmt[i].bytesperline,
857860
fmt.fmt.pix_mp.plane_fmt[i].sizeimage);
858861
}
859862
} else {
860-
printf("Video format set: %s (%08x) %ux%u (stride %u) field %s buffer size %u\n",
861-
v4l2_format_name(fmt.fmt.pix.pixelformat), fmt.fmt.pix.pixelformat,
862-
fmt.fmt.pix.width, fmt.fmt.pix.height, fmt.fmt.pix.bytesperline,
863-
v4l2_field_name(fmt.fmt.pix.field), fmt.fmt.pix.sizeimage);
863+
printf(
864+
"Video attributes, pixel format: %s (%08x), resolution: %ux%u, stride: %u, "
865+
"field: %s buffer size %u\n",
866+
v4l2_format_name(fmt.fmt.pix.pixelformat), fmt.fmt.pix.pixelformat,
867+
fmt.fmt.pix.width, fmt.fmt.pix.height, fmt.fmt.pix.bytesperline,
868+
v4l2_field_name(fmt.fmt.pix.field), fmt.fmt.pix.sizeimage);
864869
}
865870

866871
return 0;

0 commit comments

Comments
 (0)