Compare commits

..

No commits in common. "6ab57a40468434dbb2b14f446584536e3af7d38c" and "4fec59ec6427cac41a04b8db0157ee7b56b7e5c3" have entirely different histories.

3 changed files with 7 additions and 66 deletions

View File

@ -21,7 +21,7 @@ typedef struct {
} Fx; } Fx;
enum fxid { Fx_cos01=5, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0, Fx_halfsz0, enum fxid { Fx_cos01=5, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0, Fx_halfsz0,
Fx_rot90, Fx_cmixa, Fx_Desat, Fx_rot90, Fx_cmixa,
Fx_xper }; Fx_xper };
Fx fx_list[] = { Fx fx_list[] = {
@ -34,7 +34,6 @@ Fx fx_list[] = {
{ "rot90", Fx_rot90, 0, 0 }, { "rot90", Fx_rot90, 0, 0 },
{ "cmixa", Fx_cmixa, 0, 1 }, { "cmixa", Fx_cmixa, 0, 1 },
{ "xper", Fx_xper, 0, 1 }, { "xper", Fx_xper, 0, 1 },
{ "desat", Fx_Desat, 0, 1 },
{ NULL, 0, 0 } { NULL, 0, 0 }
}; };
@ -167,11 +166,6 @@ switch (action) {
fprintf(stderr, "halfsize was not implemented\n"); fprintf(stderr, "halfsize was not implemented\n");
return -3; return -3;
case Fx_Desat:
fimg_copy_data(&src, &dest);
foo = fimg_mix_rgb_gray(&dest, global_fvalue);
break;
default: default:
fprintf(stderr, "%s %s : %d is bad action\n", fprintf(stderr, "%s %s : %d is bad action\n",
__FILE__, __func__, action); __FILE__, __func__, action);

View File

@ -34,8 +34,7 @@ extern int verbosity;
size_t length; size_t length;
}; };
static char *dev_name; static char *dev_name;
static enum io_method io = IO_METHOD_MMAP; static enum io_method io = IO_METHOD_MMAP;
static int fd = -1; static int fd = -1;
struct buffer *buffers; struct buffer *buffers;
@ -49,12 +48,10 @@ static void errno_exit(const char *s)
fprintf(stderr, "%s error %d, %s\n", s, errno, strerror(errno)); fprintf(stderr, "%s error %d, %s\n", s, errno, strerror(errno));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
static int xioctl(int fh, int request, void *arg) static int xioctl(int fh, int request, void *arg)
{ {
int r; int r;
/* PLEASE EXPLAIN THAT CODE */
do { do {
r = ioctl(fh, request, arg); r = ioctl(fh, request, arg);
} while (-1 == r && EINTR == errno); } while (-1 == r && EINTR == errno);
@ -228,8 +225,7 @@ if (-1 == xioctl(fd, VIDIOC_QUERYCAP, &cap)) {
if (EINVAL == errno) { if (EINVAL == errno) {
fprintf(stderr, "%s is not a V4L2 device\n", dev_name); fprintf(stderr, "%s is not a V4L2 device\n", dev_name);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} } else {
else {
errno_exit("VIDIOC_QUERYCAP"); errno_exit("VIDIOC_QUERYCAP");
} }
} }

View File

@ -25,55 +25,13 @@ void help(int n)
puts("camera controls"); puts("camera controls");
puts("\t-d bla\t\tselect video device"); puts("\t-d bla\t\tselect video device");
puts("\t-e nnn\t\tset 'etype'");
puts("\t-K nnn\t\tinteger parameter");
puts("\t-n bla\t\tset title");
exit(0); exit(0);
}
/* --------------------------------------------------------------------- */
int init_screen(char *title)
{
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, title);
return -1;
}
/* --------------------------------------------------------------------- */
int preparation(char *devname, int param)
{
int fd, foo;
struct v4l2_capability cap;
fd = open_device(devname);
if (fd < 0) {
fprintf(stderr, "err %d on %s opening\n", errno, devname);
return -2;
}
/* est-ce un device qui permet la capture video */
foo = ioctl(fd, VIDIOC_QUERYCAP, &cap);
if (-1 == foo) {
perror("VIDIOC_QUERYCAP");
return -2;
}
if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
fprintf(stderr, "%s is not a video capture device\n", devname);
return -3;
}
return fd;
}
/* --------------------------------------------------------------------- */
int interactive(int fd, int notused)
{
init_screen("prototype");
fprintf(stderr, "file descriptor = %d\n", fd);
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int foo, opt, devnum; int foo, opt;
int etype = 0; int etype = 0;
char *device = "/dev/video0"; char *device = "/dev/video0";
char *title = NULL; char *title = NULL;
@ -86,18 +44,11 @@ while ((opt = getopt(argc, argv, "d:e:hK:lT:v")) != -1) {
case 'h': help(0); break; case 'h': help(0); break;
case 'K': K = atol(optarg); break; case 'K': K = atol(optarg); break;
// case 'l': liste_des_devices(0); break; // case 'l': liste_des_devices(0); break;
case 't': title = optarg;
case 'v': verbosity++; break; case 'v': verbosity++; break;
} }
} }
devnum = preparation(device, K);
if (devnum < 0) {
fprintf(stderr, "%s : erreur init video device\n", argv[0]);
exit(1);
}
foo = interactive(devnum, 0);
return 0; return 0;
} }