minor improvments

This commit is contained in:
tonton Th
2020-01-28 22:12:12 +01:00
parent 312f892576
commit c48a3e4870
4 changed files with 45 additions and 33 deletions

View File

@@ -28,7 +28,7 @@ int enum_image_framesizes(int fd, char *txt, int k)
int foo, idx;
struct v4l2_frmsizeenum fmtsz;
printf("-- image framesizes enumeration (%s)\n", txt);
printf("## image framesizes enumeration (%s)\n", txt);
for (idx=0; ; idx++) {
memset(&fmtsz, 0, sizeof(fmtsz));
@@ -57,7 +57,7 @@ int enum_image_formats(int fd, char *txt, int k)
int foo, idx;
struct v4l2_fmtdesc fmtd;
printf("-- image formats enumeration (%s)\n", txt);
printf("## image formats enumeration (%s)\n", txt);
idx = 0;
for (;;) {
@@ -93,7 +93,7 @@ int index, foo;
struct v4l2_input input;
char ligne[50];
printf("-- inputs enumeration (%s)\n", txt);
printf("## inputs enumeration (%s)\n", txt);
index = 0;
for(;;) {
@@ -130,7 +130,7 @@ struct v4l2_queryctrl qctrl;
int idx;
printf("-- controls enumeration '%s'\n", txt);
printf("## controls enumeration '%s'\n", txt);
memset (&qctrl, 0, sizeof (qctrl));
@@ -148,7 +148,7 @@ for (idx=V4L2_CID_BASE; idx<V4L2_CID_LASTP1; idx++) {
continue;
}
printf(" %-32s %-10s [%d..%d]\n",
printf(" %-40s %-10s [%d..%d]\n",
qctrl.name,
str_ctrl_type(qctrl.type),
qctrl.minimum, qctrl.maximum);
@@ -179,7 +179,7 @@ int enum_extended_controls(int fd, char *txt, int k)
struct v4l2_queryctrl qctrl;
int idx;
printf("-- extended controls enumeration '%s'\n", txt);
printf("##- extended controls enumeration '%s'\n", txt);
memset(&qctrl, 0, sizeof(qctrl));
qctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;
@@ -200,7 +200,7 @@ while (0 == ioctl (fd, VIDIOC_QUERYCTRL, &qctrl)) {
return -1;
}
/* --------------------------------------------------------------------- */
int show_webcam_infos(char *devname, char *title, int k)
int show_webcam_infos(char *devname, char *title, int k, int type)
{
int vfd, foo;
char ligne[100];
@@ -213,7 +213,7 @@ struct v4l2_format fmt;
// struct v4l2_requestbuffers reqbuf;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, devname, k);
fprintf(stderr, ">>> %s ( '%s' %d %d)\n", __func__, devname, k, type);
#endif
vfd = open_device(devname);
@@ -245,13 +245,17 @@ else {
pr_v4l2_format("Experimental", &fmt);
}
foo = enum_image_formats(vfd, "Experimental", 0);
if (type) {
foo = enum_controls(vfd, "is that working ?", 0);
;
foo = enum_extended_controls(vfd, "looking for extended", 0);
enum_image_framesizes(vfd, "code pas fini", 0);
}
else {
foo = enum_image_formats(vfd, "Experimental", 0);
foo = enum_controls(vfd, "is that working ?", 0);
foo = enum_extended_controls(vfd, "looking for extended", 0);
enum_image_framesizes(vfd, "code pas fini", 0);
}
close(vfd);
@@ -267,12 +271,15 @@ return -1;
static void help(int k)
{
puts("Options :");
puts("\t-e N\t\texamine that, please");
puts("\t-d\t\tselect the video device");
puts("\t-K\t\tset the K parameter");
puts("\t-l\t\tlist video devices");
puts("\t-T bla\t\tadd a title");
puts("\t-v\t\tincrease verbosity");
// if (verbosity)
{ puts(""); fimg_print_version(1); }
exit(0);
}
/* --------------------------------------------------------------------- */
@@ -293,14 +300,15 @@ puts("\n");
int main(int argc, char *argv[])
{
int foo, opt;
int etype = 0;
char *device = "/dev/video0";
char *title = NULL;
int K = 0;
while ((opt = getopt(argc, argv, "d:hK:lT:v")) != -1) {
while ((opt = getopt(argc, argv, "d:e:hK:lT:v")) != -1) {
switch(opt) {
case 'd': device = optarg; break;
case 'e': etype = atol(optarg); break;
case 'h': help(0); break;
case 'K': K = atol(optarg); break;
case 'l': liste_des_devices(0); break;
@@ -313,7 +321,7 @@ if (NULL != title) {
print_title(title);
}
foo = show_webcam_infos(device, "", K);
foo = show_webcam_infos(device, "", K, etype);
fprintf(stderr, "\n\tshow_webcam_infos -> %d\n", foo);
return 0;