From 4aa20dd69bc6fb232cb46ed2e0649b728507909d Mon Sep 17 00:00:00 2001 From: Tonton Th Date: Fri, 24 May 2019 17:40:13 +0200 Subject: [PATCH] adding v4l2 support --- build.sh | 42 +++++++++++++++++++++++------------------- tools/Makefile | 2 ++ v4l2/Makefile | 9 +++++++++ v4l2/t | Bin 0 -> 24064 bytes v4l2/t.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 80 insertions(+), 19 deletions(-) create mode 100644 v4l2/Makefile create mode 100755 v4l2/t create mode 100644 v4l2/t.c diff --git a/build.sh b/build.sh index bc7302d..79dcf5d 100755 --- a/build.sh +++ b/build.sh @@ -1,30 +1,34 @@ #!/bin/bash -cd lib -echo ============= we are in $PWD -make -error=$? -if [ 0 -ne $error ]; then - printf "in %s err %d in %s\n" $PWD $error $0 - exit $error -fi -echo -cd .. +# ------------------------------------------------------------------ -cd funcs -echo ============= we are in $PWD -make +function build +{ +echo ============= $1 ============== +curdir=${PWD} +cd $1 +make error=$? -if [ 0 -ne $error ]; then - printf "in %s err %d in %s\n" $PWD $error $0 - exit $error +cd ${curdir} + +if [ ${error} -ne 0 ] +then + echo === error on $1 = ${error} + exit fi -echo -cd .. +} + +# ------------------------------------------------------------------ + +build lib +build funcs +build tools + +# ------------------------------------------------------------------ cd tools echo -make fimg2pnm addtga2fimg mkfimg png2fimg fimgstats fimg2png +make error=$? cd .. diff --git a/tools/Makefile b/tools/Makefile index 6e45777..63cb07c 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -8,6 +8,8 @@ DEPS = ../floatimg.h ../libfloatimg.a Makefile # ---------- +all: fimg2pnm addtga2fimg mkfimg png2fimg fimgstats fimg2png + fimgstats: fimgstats.c $(DEPS) gcc -g $< ../libfloatimg.a -o $@ diff --git a/v4l2/Makefile b/v4l2/Makefile new file mode 100644 index 0000000..8598717 --- /dev/null +++ b/v4l2/Makefile @@ -0,0 +1,9 @@ + + +COPT = -Wall -fpic -g -DDEBUG_LEVEL=1 +DEPS = ../floatimg.h ../libfloatimg.a Makefile + + + +t: t.c Makefile ${DEPS} + gcc ${COPT} $< ../libfloatimg.a -o $@ \ No newline at end of file diff --git a/v4l2/t b/v4l2/t new file mode 100755 index 0000000000000000000000000000000000000000..3271183e4872cafa15c1eff39f5151afcaed9b1b GIT binary patch literal 24064 zcmeHPdwf*Yoj-SGE}5IhG~j0gfk9=roWnFIn81x*zc6&NO&NoML~CY`wxz?Ie- zbe%@J&~|+lySTOe*w<>?b*0i)RO+L<^#iR{w#$A#S&KCk+fua_D?0oAoyX+PCF$dz zZuiriWbW_$p67Rd=iGbGx#!&b@z!-~9Gb>da5Z12FA^LDnXCut>BN$_9rhSP zPeH}cm**3FW`jqiGYVSuC^kpygx=8=h46r_-b#c5|V->OR4=eGfeq&7jg7Fc$XkE1(n{1p+|oHsY!+XYFXZBacPwPD=4eU8sf2z z#S0ta;ktM%k=aqVqiJ#7;)V6;Wc_?zZ?aFaYp)a?mHL-7#rZYBiAMZ`kKgFNW%uiE z&i(oBPaOW*&we)j(dS<#*-HG#hN#ykkP|e5$09HG5F9NLvuXt9$3XLqKqr4klK;>s zbnhti8%LpE3Od!to~S#GRPOzt`|QHNFUD^q`3}1G>Qr#?Vh9jvI z3z^9{>*`I#5@r_*20M3zf?cshC?2~x!g@NBnS=={*$$?mW(Ipgu>|W%MIvnNy0(^8 z!TI&`>ld+L+lKW)*o$<>(q<&JVg0IjG7;Gj>WD|6-rbW-NcEr)9Z?XKpx)`Q{8=%P z*U)n{NU8HIGbx5EnuDc4qol4s>U#004B~NleNpsYNss!u8dG$IA6_ZwbdIR=izv@q z=+^7PQ43vOnz@1F7P`Fja{8c!PJKhAAq%}+5dqIw=+=I5)9Z~##Ituw>k>$sLUmzr3Dzg08 z?iUEr%S4tRH~9rZbdSi69mgUt7J;z{j74B90%H*vi@={1fk6Ko?!bWl!v@9zw;whg zxub#pBkpJNHgbzz1uHk>B#z}%{m2m>CH|?w9MX)R5>7*@Q%5=eBf@EDcQ>nQ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jnAv;#gIaBFo+MusqRBxkQ?!{aD^YGE40Af&rfmq7wrlKSbchD59Wq| zW=g=Q$|25?R4=PfB+W>Db4y#D8S0i8o>A6!WMcRVV=T<-35$l(QC1(`nSeb3F@574 zHSx0|LGV(Mc!(5at~YM7dfpE8$kul!ftnGlbkx)74WT6OaP^U>JfWju7*Uu|6=$~4 zPcNDZERtn7NAv1>G$pIY<)sIg4A3GSnQo|r65Y5KNi>$|N~(OQqazjRQy9KI z8BuwJYozPlpGl(;Ic`xH`-r6Gg9_S5<|J!P7XzVv8%m$Lc(jL4m9OT%3flcwathuAecBVKa5Ya>&?n2b`!C7t zW@IR)N?*;V6;%5Y?eSCf-!1i9q(QaMQNiPqPWl*i=l5wU{ZD~LF(LnWQsZw4NynPV zS8K`wvFiJzo`MIg!pPgqGrkE2bXERgDWITgZ)HZ|3euJyS(42i_6_hzMCq&N5enXA(WR`t{3k)P>Z|7# z3I>#6X~$kZ%|9`k=I0QJsPBZT@AKN_6|Uew3!Y`$q8&2SM>h@gW8_X zVM=O#ng9N=jGyWsN>8=pz0e^MrLUf=9Bv?MjQRO-_@ML^r2U3g{k%e>(AhSu%5zFj zK{3A`E`OU}C~TAZ%1>oR=_&kOWQeBxSL5?usc)CJxBmywCI6*3av~}HCPk1?hLh_M ziT0{0npN~+X>gmBh`e34b`*U#-B^&qbaA&NyZ*FM^yABg(kWa2wd*&IqQ7ya&|hu~ zm|dTCl@iS!zkREO{ts2d2sB@RWrv{6MJ~B*tyGW~kc)s)Td4L_*I#1Wir|Xd+BsnN a*qEwZ!4-2Zn+Rw9?iwMn)}~-X+5ZBlI8lHA literal 0 HcmV?d00001 diff --git a/v4l2/t.c b/v4l2/t.c new file mode 100644 index 0000000..5845c98 --- /dev/null +++ b/v4l2/t.c @@ -0,0 +1,46 @@ +/* + * tests pour capturer les webcams + */ + +#include +#include +#include +#include +#include + +#include "floatimg.h" + +int verbosity; + +/* --------------------------------------------------------------------- */ +void help(int k) +{ +puts("Options :"); +puts("\t-d WxH\timage size"); +puts("\t-v\tincrease verbosity"); +exit(0); +} +/* --------------------------------------------------------------------- */ + +int main(int argc, char *argv[]) +{ +int foo, opt; +int W = 800, H = 600; +double tb; +int K = 0; + +while ((opt = getopt(argc, argv, "hK:v")) != -1) { + switch(opt) { + case 'h': help(0); break; + case 'K': K = atol(optarg); break; + case 'v': verbosity++; break; + } + } + +if (verbosity) fimg_print_version(0); + +return 0; +} +/* --------------------------------------------------------------------- */ + +