From 706a4ed0c2292e3e103adf0a75686cecc271a27f Mon Sep 17 00:00:00 2001 From: tth Date: Fri, 2 Aug 2019 03:33:59 +0200 Subject: [PATCH] more harmony in display --- v4l2/t.c | 2 +- v4l2/v4l2_pr_structs.c | 16 +++++++--------- v4l2/video-infos.c | 12 +++++++++++- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/v4l2/t.c b/v4l2/t.c index 6e6618d..266a590 100644 --- a/v4l2/t.c +++ b/v4l2/t.c @@ -38,7 +38,7 @@ fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; foo = ioctl(vfd, VIDIOC_G_FMT, &fmt); fprintf(stderr, "ioctl -> %d\n", foo); if (0 != foo) { - perror("ioctl S_FMT"); + perror("ioctl G_FMT"); exit(1); } diff --git a/v4l2/v4l2_pr_structs.c b/v4l2/v4l2_pr_structs.c index 3b6fe41..83d44e8 100644 --- a/v4l2/v4l2_pr_structs.c +++ b/v4l2/v4l2_pr_structs.c @@ -219,24 +219,24 @@ return "???"; int pr_v4l2_format(char *txt, struct v4l2_format *ptr) { fprintf(FP, "-- v4l2_format, %-15s %p\n", txt, ptr); -fprintf(FP, " type %d %s\n", ptr->type,/* enum v4l2_buf_type */ +fprintf(FP, " type %d %s\n", ptr->type,/* enum v4l2_buf_type */ fmttype2str(ptr->type)); switch(ptr->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - fprintf(FP, " dims %dx%d\n", + fprintf(FP, " dims %dx%d\n", ptr->fmt.pix.width, ptr->fmt.pix.height); - fprintf(FP, " pixformat %s\n", + fprintf(FP, " pixformat %s\n", str_fourcc(ptr->fmt.pix.pixelformat)); - fprintf(FP, " field %d\n", + fprintf(FP, " field %d\n", ptr->fmt.pix.field); /* enum v4l2_field */ - fprintf(FP, " padding %d\n", + fprintf(FP, " padding %d\n", ptr->fmt.pix.bytesperline); - fprintf(FP, " sizeimage %d\n", + fprintf(FP, " sizeimage %d\n", ptr->fmt.pix.sizeimage); - fprintf(FP, " colorspace %d %s\n", + fprintf(FP, " colorspace %d %s\n", ptr->fmt.pix.colorspace, str_colorspace(ptr->fmt.pix.colorspace)); break; @@ -245,8 +245,6 @@ switch(ptr->type) { break; } - -fputs(".\n", FP); return 0; } /* --------------------------------------------------------------------- */ diff --git a/v4l2/video-infos.c b/v4l2/video-infos.c index c017596..8845556 100644 --- a/v4l2/video-infos.c +++ b/v4l2/video-infos.c @@ -174,7 +174,7 @@ int vfd, foo; char ligne[100]; struct v4l2_capability cap; -// struct v4l2_format fmt; +struct v4l2_format fmt; struct v4l2_input input; // int index; @@ -213,6 +213,16 @@ sprintf(ligne, "input %d", input.index); pr_v4l2_input(ligne, &input); ***/ +memset(&fmt, 0, sizeof(fmt)); +fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; +foo = ioctl(vfd, VIDIOC_G_FMT, &fmt); +fprintf(stderr, "ioctl -> %d\n", foo); +if (0 != foo) { + perror("ioctl G_FMT"); + exit(1); + } +pr_v4l2_format("Experimental", &fmt); + foo = enum_image_formats(vfd, "Experimental", 0); foo = enum_controls(vfd, "is that working ?", 0);