From 9b8a30f0b7fe76330e1a40190c9a5a64cc08eba6 Mon Sep 17 00:00:00 2001 From: tth Date: Sat, 7 Mar 2020 15:24:31 +0100 Subject: [PATCH] sauvageonnes --- .gitignore | 1 + doc/the_floatimg_hack.tex | 8 ++++-- v4l2/Makefile | 7 +++-- v4l2/funcs.c | 4 +++ v4l2/nc-camcontrol.c | 55 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 v4l2/nc-camcontrol.c diff --git a/.gitignore b/.gitignore index 0aab3cf..3443c8c 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ v4l2/grabvidseq v4l2/*.o v4l2/*.ppm v4l2/video-infos +v4l2/nc-camcontrol tools/fimg2png tools/fimg2pnm diff --git a/doc/the_floatimg_hack.tex b/doc/the_floatimg_hack.tex index 550c083..07fd34d 100644 --- a/doc/the_floatimg_hack.tex +++ b/doc/the_floatimg_hack.tex @@ -424,7 +424,7 @@ semblent cohérents avec la notion d'image flottante. Certains d'entre eux, les plus simples, sont disponibles. Les autres sont à imaginer. -\begin{figure} +\begin{figure}[h] \input{cos01.tex} % XXX XXX XXX \caption{Correcteur cos01} \end{figure} @@ -449,7 +449,7 @@ de contraste, il y a quelques explication en page \pageref{exemplefunc}. -\begin{figure} +\begin{figure}[h] \input{cos010.tex} % XXX XXX XXX \caption{Correcteur cos010} \end{figure} @@ -1160,6 +1160,10 @@ l'\textsc{api} de \textsc{v4l2}, et donc, que ce que raconte ce logiciel doit être pris avec des pincettes. En particulier la liste des résolutions disponibles. +\subsection{nc-camcontrol} + +Ajustement \textsl{Brightness Contrast Saturation Hue\dots} + % ------------------------------------------------------------------- \section{À l'extérieur} diff --git a/v4l2/Makefile b/v4l2/Makefile index a1e7bec..587d0cf 100644 --- a/v4l2/Makefile +++ b/v4l2/Makefile @@ -2,8 +2,9 @@ COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0 DEPS = ../floatimg.h ../libfloatimg.a Makefile +LOBJ = funcs.o v4l2_pr_structs.o -all: grabvidseq t video-infos +all: grabvidseq t video-infos nc-camcontrol t: t.c Makefile ${DEPS} funcs.o v4l2_pr_structs.o gcc ${COPT} $< funcs.o v4l2_pr_structs.o ../libfloatimg.a -o $@ @@ -21,8 +22,10 @@ grabvidseq: grabvidseq.c ${DEPS} rgb2fimg.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 ../libfloatimg.a -o $@ + gcc -Wall -g $< ${LOBJ} ../libfloatimg.a -o $@ +nc-camcontrol: nc-camcontrol.c Makefile funcs.o v4l2_pr_structs.o + gcc -Wall -g $< ${LOBJ} ../libfloatimg.a -o $@ # --------------- # external things diff --git a/v4l2/funcs.c b/v4l2/funcs.c index d90b4c2..efc4cbb 100644 --- a/v4l2/funcs.c +++ b/v4l2/funcs.c @@ -88,6 +88,10 @@ if (-1 == fd) { dev_name = strdup(device); /* XXX */ +if (verbosity) { + fprintf(stderr, "device '%s' opened as #%d\n", device, fd); + } + return fd; } /* --------------------------------------------------------------------- */ diff --git a/v4l2/nc-camcontrol.c b/v4l2/nc-camcontrol.c new file mode 100644 index 0000000..cc5c8a2 --- /dev/null +++ b/v4l2/nc-camcontrol.c @@ -0,0 +1,55 @@ +/* + * tests pour capturer les webcams + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../floatimg.h" + +#include "v4l2_pr_structs.h" +#include "funcs.h" + +int verbosity; + +/* --------------------------------------------------------------------- */ +void help(int n) +{ + +puts("camera controls"); +puts("\t-d bla\t\tselect video device"); + +exit(0); +} +/* --------------------------------------------------------------------- */ +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: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; + case 'v': verbosity++; break; + } + } + + + +return 0; +} +/* --------------------------------------------------------------------- */