Browse Source

Merge branch 'master' of ssh://tetalab.org:2213/tTh/FloatImg

j'ai encore fait un beuhbeuh ?
master
tonton th 2 years ago
parent
commit
0d93070774
  1. 8
      tools/fimgfx.c
  2. 12
      v4l2/funcs.c
  3. 53
      v4l2/nc-camcontrol.c

8
tools/fimgfx.c

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

12
v4l2/funcs.c

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

53
v4l2/nc-camcontrol.c

@ -25,13 +25,55 @@ void help(int n) @@ -25,13 +25,55 @@ void help(int n)
puts("camera controls");
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);
}
/* --------------------------------------------------------------------- */
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 foo, opt;
int foo, opt, devnum;
int etype = 0;
char *device = "/dev/video0";
char *title = NULL;
@ -44,11 +86,18 @@ while ((opt = getopt(argc, argv, "d:e:hK:lT:v")) != -1) { @@ -44,11 +86,18 @@ while ((opt = getopt(argc, argv, "d:e:hK:lT:v")) != -1) {
case 'h': help(0); break;
case 'K': K = atol(optarg); break;
// case 'l': liste_des_devices(0); break;
case 't': title = optarg;
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;
}

Loading…
Cancel
Save