This commit is contained in:
tth 2020-08-06 22:30:40 +02:00
parent 0651d8de7a
commit d11ecd0e3f
2 changed files with 34 additions and 8 deletions

View File

@ -26,7 +26,7 @@ video-infos: video-infos.c Makefile funcs.o v4l2_pr_structs.o
gcc -Wall -g $< ${LOBJ} ../libfloatimg.a -o $@
nc-camcontrol: nc-camcontrol.c Makefile funcs.o v4l2_pr_structs.o
gcc -Wall -g $< ${LOBJ} ../libfloatimg.a -o $@
gcc -Wall -g $< ${LOBJ} ../libfloatimg.a -lcurses -o $@
# ---------------
# external things

View File

@ -6,10 +6,11 @@
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>
// #include <string.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <inttypes.h>
#include <curses.h>
#include <linux/videodev2.h>
#include "../floatimg.h"
@ -33,15 +34,35 @@ exit(0);
/* --------------------------------------------------------------------- */
int init_screen(char *title)
{
int foo;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, title);
#endif
initscr();
standout(); mvaddstr(1, 5, title); standend(); refresh();
return -1;
}
/* --------------------------------------------------------------------- */
int preparation(char *devname, int param)
int end_screen(void)
{
endwin();
return 0;
}
/* --------------------------------------------------------------------- */
int preparation_v4l2(char *devname, int param)
{
int fd, foo;
struct v4l2_capability cap;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, devname, param);
#endif
fd = open_device(devname);
if (fd < 0) {
fprintf(stderr, "err %d on %s opening\n", errno, devname);
@ -62,13 +83,18 @@ if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
return fd;
}
/* --------------------------------------------------------------------- */
int interactive(int fd, int notused)
int interactive(int fd, char *text, int notused)
{
init_screen("prototype");
fprintf(stderr, "file descriptor = %d\n", fd);
init_screen("prototype");
sleep(2);
end_screen();
return 0;
}
/* --------------------------------------------------------------------- */
int main(int argc, char *argv[])
@ -91,13 +117,13 @@ while ((opt = getopt(argc, argv, "d:e:hK:lT:v")) != -1) {
}
}
devnum = preparation(device, K);
devnum = preparation_v4l2(device, K);
if (devnum < 0) {
fprintf(stderr, "%s : erreur init video device\n", argv[0]);
exit(1);
}
foo = interactive(devnum, 0);
foo = interactive(devnum, title, 0);
return 0;
}