2019-05-24 17:40:13 +02:00
|
|
|
/*
|
|
|
|
* tests pour capturer les webcams
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2019-05-25 16:16:24 +02:00
|
|
|
#include "funcs.h"
|
2019-06-05 10:57:39 +02:00
|
|
|
#include "../floatimg.h"
|
2019-05-24 17:40:13 +02:00
|
|
|
|
|
|
|
int verbosity;
|
|
|
|
|
2019-05-25 16:16:24 +02:00
|
|
|
/* --------------------------------------------------------------------- */
|
|
|
|
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;
|
|
|
|
}
|
2019-05-24 17:40:13 +02:00
|
|
|
/* --------------------------------------------------------------------- */
|
|
|
|
void help(int k)
|
|
|
|
{
|
|
|
|
puts("Options :");
|
2019-05-25 11:56:56 +02:00
|
|
|
puts("\t-d\tselect the video device");
|
2019-05-24 18:34:07 +02:00
|
|
|
puts("\t-K\tset the K parameter");
|
2019-05-25 11:56:56 +02:00
|
|
|
puts("\t-l\tlist video devices");
|
2019-05-24 17:40:13 +02:00
|
|
|
puts("\t-v\tincrease verbosity");
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
/* --------------------------------------------------------------------- */
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int foo, opt;
|
2019-05-25 16:16:24 +02:00
|
|
|
|
|
|
|
char *device = "/dev/video0";
|
2019-05-24 17:40:13 +02:00
|
|
|
int K = 0;
|
|
|
|
|
2019-05-25 16:16:24 +02:00
|
|
|
while ((opt = getopt(argc, argv, "d:hK:v")) != -1) {
|
2019-05-24 17:40:13 +02:00
|
|
|
switch(opt) {
|
2019-05-25 16:16:24 +02:00
|
|
|
case 'd': device = optarg; break;
|
2019-05-24 17:40:13 +02:00
|
|
|
case 'h': help(0); break;
|
|
|
|
case 'K': K = atol(optarg); break;
|
|
|
|
case 'v': verbosity++; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (verbosity) fimg_print_version(0);
|
|
|
|
|
2019-05-25 16:16:24 +02:00
|
|
|
foo = essai(device, K);
|
|
|
|
fprintf(stderr, "\tessai -> %d\n", foo);
|
|
|
|
|
2019-05-24 17:40:13 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* --------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|