FloatImg/v4l2/t.c
2019-05-25 16:16:24 +02:00

68 lines
1.3 KiB
C

/*
* tests pour capturer les webcams
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>
#include "funcs.h"
#include "floatimg.h"
int verbosity;
/* --------------------------------------------------------------------- */
int essai(char *dev, int k)
{
int vfd, foo;
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, dev, k);
vfd = open_device(dev);
fprintf(stderr, "\topen %s -> %d\n", dev, vfd);
foo = init_device(0);
fprintf(stderr, "\tinit -> %d\n", foo);
return k;
}
/* --------------------------------------------------------------------- */
void help(int k)
{
puts("Options :");
puts("\t-d\tselect the video device");
puts("\t-K\tset the K parameter");
puts("\t-l\tlist video devices");
puts("\t-v\tincrease verbosity");
exit(0);
}
/* --------------------------------------------------------------------- */
int main(int argc, char *argv[])
{
int foo, opt;
char *device = "/dev/video0";
int K = 0;
while ((opt = getopt(argc, argv, "d:hK:v")) != -1) {
switch(opt) {
case 'd': device = optarg; break;
case 'h': help(0); break;
case 'K': K = atol(optarg); break;
case 'v': verbosity++; break;
}
}
if (verbosity) fimg_print_version(0);
foo = essai(device, K);
fprintf(stderr, "\tessai -> %d\n", foo);
return 0;
}
/* --------------------------------------------------------------------- */