diff --git a/v4l2/Makefile b/v4l2/Makefile index e439bb2..a1e7bec 100644 --- a/v4l2/Makefile +++ b/v4l2/Makefile @@ -18,10 +18,10 @@ v4l2_pr_structs.o: v4l2_pr_structs.c v4l2_pr_structs.h Makefile gcc ${COPT} -c $< grabvidseq: grabvidseq.c ${DEPS} rgb2fimg.o - gcc ${COPT} $< rgb2fimg.o ../libfloatimg.a -lz -lm -lv4l2 -o $@ + gcc ${COPT} $< rgb2fimg.o ../libfloatimg.a -lpnglite -lz -lm -lv4l2 -o $@ video-infos: video-infos.c Makefile funcs.o v4l2_pr_structs.o - gcc -Wall -g $< funcs.o v4l2_pr_structs.o -o $@ + gcc -Wall -g $< funcs.o v4l2_pr_structs.o ../libfloatimg.a -o $@ # --------------- diff --git a/v4l2/funcs.c b/v4l2/funcs.c index ff78abc..d90b4c2 100644 --- a/v4l2/funcs.c +++ b/v4l2/funcs.c @@ -2,18 +2,22 @@ * V4L2 functions - ugly source code */ -#include -#include +#include +#include #include -#include /* low-level i/o */ -#include -#include -#include -#include -#include +#include /* low-level i/o */ +#include +#include +#include +#include +#include -#include +#include + +#include "../floatimg.h" + +#include "funcs.h" /* --------------------------------------------------------------------- */ @@ -215,7 +219,7 @@ fprintf(stderr, ">>> %s ( %d )\n", __func__, notused); if (-1 == xioctl(fd, VIDIOC_QUERYCAP, &cap)) { if (EINVAL == errno) { - fprintf(stderr, "%s is no V4L2 device\n", dev_name); + fprintf(stderr, "%s is not a V4L2 device\n", dev_name); exit(EXIT_FAILURE); } else { errno_exit("VIDIOC_QUERYCAP"); diff --git a/v4l2/v4l2_pr_structs.c b/v4l2/v4l2_pr_structs.c index bbc1e1f..b09db47 100644 --- a/v4l2/v4l2_pr_structs.c +++ b/v4l2/v4l2_pr_structs.c @@ -59,7 +59,7 @@ fputs("\n", FP); /* --------------------------------------------------------------------- */ int pr_v4l2_capability(char *txt, struct v4l2_capability *ptr) { -fprintf(FP, "-- v4l2_capability, %-15s %p\n", txt, ptr); +fprintf(FP, "## v4l2_capability, %-15s %p\n", txt, ptr); fprintf(FP, " driver %s\n", ptr->driver); fprintf(FP, " card %s\n", ptr->card); @@ -115,7 +115,7 @@ return "???"; /* --------------------------------------------------------------------- */ int pr_v4l2_fmtdesc(char *txt, struct v4l2_fmtdesc *ptr) { -fprintf(FP, "-- v4l2_fmtdesc, %-15s %p\n", txt, ptr); +fprintf(FP, "## v4l2_fmtdesc, %-15s %p\n", txt, ptr); fprintf(FP, " index %d\n", ptr->index); fprintf(FP, " type %d\n", ptr->type); /* enum v4l2_buf_type */ @@ -170,7 +170,7 @@ if (st & V4L2_IN_CAP_NATIVE_SIZE) fputs("nativsz ", FP); /* --------------------------------------------------------------------- */ int pr_v4l2_input(char *txt, struct v4l2_input *ptr) { -fprintf(FP, "-- v4l2_input, %-15s %p\n", txt, ptr); +fprintf(FP, "## v4l2_input, %-15s %p\n", txt, ptr); fprintf(FP, " index %d\n", ptr->index); fprintf(FP, " name %s\n", ptr->name); @@ -218,7 +218,7 @@ return "???"; /* --------------------------------------------------------------------- */ int pr_v4l2_format(char *txt, struct v4l2_format *ptr) { -fprintf(FP, "-- v4l2_format, %-15s %p\n", txt, ptr); +fprintf(FP, "## v4l2_format, %-15s %p\n", txt, ptr); fprintf(FP, " type %d %s\n", ptr->type,/* enum v4l2_buf_type */ fmttype2str(ptr->type)); @@ -250,7 +250,7 @@ return 0; /* --------------------------------------------------------------------- */ int pr_v4l2_requestbuffers(char *txt, struct v4l2_requestbuffers *ptr) { -fprintf(FP, "-- v4l2_requestbuffers, %s %p\n", txt, ptr); +fprintf(FP, "## v4l2_requestbuffers, %s %p\n", txt, ptr); fprintf(FP, " type %d\n", ptr->type); /* enum v4l2_buf_type */ diff --git a/v4l2/video-infos.c b/v4l2/video-infos.c index 6d64094..7a7ff00 100644 --- a/v4l2/video-infos.c +++ b/v4l2/video-infos.c @@ -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>> %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;