Compare commits
No commits in common. "c48a3e48701efc142c315808477c7a4e8e9d764b" and "bf5058b8d772823cdf363f9347d6d297e2c223df" have entirely different histories.
c48a3e4870
...
bf5058b8d7
@ -9,9 +9,7 @@ SZ=640x480
|
||||
NBRE=320
|
||||
PERIOD=0.0
|
||||
COUNT=compteur
|
||||
OPTIONS=" -v "
|
||||
SHOW="no"
|
||||
OFORMAT="P_%04d.pnm"
|
||||
OPTIONS=" -u"
|
||||
|
||||
# ------------------------------------
|
||||
# overide parameters from $PWD
|
||||
@ -35,7 +33,7 @@ if [ 1 -eq $# ]
|
||||
then
|
||||
outfile="$1"
|
||||
else
|
||||
outfile=$( printf ${OFORMAT} $numero )
|
||||
outfile=$( printf "P_%04d.pnm" $numero )
|
||||
fi
|
||||
|
||||
# ------------------------------------
|
||||
|
@ -18,10 +18,10 @@ v4l2_pr_structs.o: v4l2_pr_structs.c v4l2_pr_structs.h Makefile
|
||||
gcc ${COPT} -c $<
|
||||
|
||||
grabvidseq: grabvidseq.c ${DEPS} rgb2fimg.o
|
||||
gcc ${COPT} $< rgb2fimg.o ../libfloatimg.a -lpnglite -lz -lm -lv4l2 -o $@
|
||||
gcc ${COPT} $< rgb2fimg.o ../libfloatimg.a -lz -lm -lv4l2 -o $@
|
||||
|
||||
video-infos: video-infos.c Makefile funcs.o v4l2_pr_structs.o
|
||||
gcc -Wall -g $< funcs.o v4l2_pr_structs.o ../libfloatimg.a -o $@
|
||||
gcc -Wall -g $< funcs.o v4l2_pr_structs.o -o $@
|
||||
|
||||
|
||||
# ---------------
|
||||
|
@ -15,10 +15,6 @@
|
||||
|
||||
#include <linux/videodev2.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "funcs.h"
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
extern int verbosity;
|
||||
@ -219,7 +215,7 @@ fprintf(stderr, ">>> %s ( %d )\n", __func__, notused);
|
||||
|
||||
if (-1 == xioctl(fd, VIDIOC_QUERYCAP, &cap)) {
|
||||
if (EINVAL == errno) {
|
||||
fprintf(stderr, "%s is not a V4L2 device\n", dev_name);
|
||||
fprintf(stderr, "%s is no V4L2 device\n", dev_name);
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
errno_exit("VIDIOC_QUERYCAP");
|
||||
|
@ -365,12 +365,6 @@ switch (foo) {
|
||||
case FILE_TYPE_PNM:
|
||||
foo = fimg_save_as_pnm(&cumul, outfile, 1);
|
||||
break;
|
||||
case FILE_TYPE_PNG:
|
||||
foo = fimg_save_as_png(&cumul, outfile, 0);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "can't save as %s\n", outfile);
|
||||
break;
|
||||
}
|
||||
// free buffers
|
||||
fimg_destroy(&cumul);
|
||||
|
14
v4l2/t.c
14
v4l2/t.c
@ -20,9 +20,9 @@
|
||||
int verbosity;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
int essai_get_fmt(char *dev, int k)
|
||||
int essai(char *dev, int k)
|
||||
{
|
||||
int vfd, idx, foo;
|
||||
int vfd, foo;
|
||||
struct v4l2_format fmt;
|
||||
struct v4l2_requestbuffers reqbuf;
|
||||
|
||||
@ -33,20 +33,18 @@ if (verbosity) fprintf(stderr, "\topen %s -> %d\n", dev, vfd);
|
||||
|
||||
memset(&fmt, 0, sizeof(fmt));
|
||||
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
|
||||
foo = ioctl(vfd, VIDIOC_G_FMT, &fmt);
|
||||
fprintf(stderr, "%s : ioctl -> %d\n", __func__, foo);
|
||||
fprintf(stderr, "ioctl -> %d\n", foo);
|
||||
if (0 != foo) {
|
||||
perror("ioctl G_FMT");
|
||||
return -1;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pr_v4l2_format("after ioctl VIDIOC_G_FMT", &fmt);
|
||||
|
||||
/* this function is bugged */
|
||||
|
||||
close(vfd);
|
||||
|
||||
|
||||
return k;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
@ -81,7 +79,7 @@ while ((opt = getopt(argc, argv, "d:hK:v")) != -1) {
|
||||
|
||||
if (verbosity) fimg_print_version(0);
|
||||
|
||||
foo = essai_get_fmt(device, K);
|
||||
foo = essai(device, K);
|
||||
fprintf(stderr, "\tessai -> %d\n", foo);
|
||||
|
||||
return 0;
|
||||
|
@ -59,7 +59,7 @@ fputs("\n", FP);
|
||||
/* --------------------------------------------------------------------- */
|
||||
int pr_v4l2_capability(char *txt, struct v4l2_capability *ptr)
|
||||
{
|
||||
fprintf(FP, "## v4l2_capability, %-15s %p\n", txt, ptr);
|
||||
fprintf(FP, "-- v4l2_capability, %-15s %p\n", txt, ptr);
|
||||
|
||||
fprintf(FP, " driver %s\n", ptr->driver);
|
||||
fprintf(FP, " card %s\n", ptr->card);
|
||||
@ -115,7 +115,7 @@ return "???";
|
||||
/* --------------------------------------------------------------------- */
|
||||
int pr_v4l2_fmtdesc(char *txt, struct v4l2_fmtdesc *ptr)
|
||||
{
|
||||
fprintf(FP, "## v4l2_fmtdesc, %-15s %p\n", txt, ptr);
|
||||
fprintf(FP, "-- v4l2_fmtdesc, %-15s %p\n", txt, ptr);
|
||||
|
||||
fprintf(FP, " index %d\n", ptr->index);
|
||||
fprintf(FP, " type %d\n", ptr->type); /* enum v4l2_buf_type */
|
||||
@ -170,7 +170,7 @@ if (st & V4L2_IN_CAP_NATIVE_SIZE) fputs("nativsz ", FP);
|
||||
/* --------------------------------------------------------------------- */
|
||||
int pr_v4l2_input(char *txt, struct v4l2_input *ptr)
|
||||
{
|
||||
fprintf(FP, "## v4l2_input, %-15s %p\n", txt, ptr);
|
||||
fprintf(FP, "-- v4l2_input, %-15s %p\n", txt, ptr);
|
||||
|
||||
fprintf(FP, " index %d\n", ptr->index);
|
||||
fprintf(FP, " name %s\n", ptr->name);
|
||||
@ -218,7 +218,7 @@ return "???";
|
||||
/* --------------------------------------------------------------------- */
|
||||
int pr_v4l2_format(char *txt, struct v4l2_format *ptr)
|
||||
{
|
||||
fprintf(FP, "## v4l2_format, %-15s %p\n", txt, ptr);
|
||||
fprintf(FP, "-- v4l2_format, %-15s %p\n", txt, ptr);
|
||||
fprintf(FP, " type %d %s\n", ptr->type,/* enum v4l2_buf_type */
|
||||
fmttype2str(ptr->type));
|
||||
|
||||
@ -250,7 +250,7 @@ return 0;
|
||||
/* --------------------------------------------------------------------- */
|
||||
int pr_v4l2_requestbuffers(char *txt, struct v4l2_requestbuffers *ptr)
|
||||
{
|
||||
fprintf(FP, "## v4l2_requestbuffers, %s %p\n", txt, ptr);
|
||||
fprintf(FP, "-- v4l2_requestbuffers, %s %p\n", txt, ptr);
|
||||
fprintf(FP, " type %d\n", ptr->type); /* enum v4l2_buf_type */
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ int enum_image_framesizes(int fd, char *txt, int k)
|
||||
int foo, idx;
|
||||
struct v4l2_frmsizeenum fmtsz;
|
||||
|
||||
printf("## image framesizes enumeration (%s)\n", txt);
|
||||
printf("-- image framesizes enumeration (%s)\n", txt);
|
||||
|
||||
for (idx=0; ; idx++) {
|
||||
memset(&fmtsz, 0, sizeof(fmtsz));
|
||||
@ -57,7 +57,7 @@ int enum_image_formats(int fd, char *txt, int k)
|
||||
int foo, idx;
|
||||
struct v4l2_fmtdesc fmtd;
|
||||
|
||||
printf("## image formats enumeration (%s)\n", txt);
|
||||
printf("-- image formats enumeration (%s)\n", txt);
|
||||
|
||||
idx = 0;
|
||||
for (;;) {
|
||||
@ -93,7 +93,7 @@ int index, foo;
|
||||
struct v4l2_input input;
|
||||
char ligne[50];
|
||||
|
||||
printf("## inputs enumeration (%s)\n", txt);
|
||||
printf("-- inputs enumeration (%s)\n", txt);
|
||||
|
||||
index = 0;
|
||||
for(;;) {
|
||||
@ -130,7 +130,7 @@ struct v4l2_queryctrl qctrl;
|
||||
int idx;
|
||||
|
||||
|
||||
printf("## controls enumeration '%s'\n", txt);
|
||||
printf("-- controls enumeration '%s'\n", txt);
|
||||
|
||||
memset (&qctrl, 0, sizeof (qctrl));
|
||||
|
||||
@ -148,7 +148,7 @@ for (idx=V4L2_CID_BASE; idx<V4L2_CID_LASTP1; idx++) {
|
||||
continue;
|
||||
}
|
||||
|
||||
printf(" %-40s %-10s [%d..%d]\n",
|
||||
printf(" %-32s %-10s [%d..%d]\n",
|
||||
qctrl.name,
|
||||
str_ctrl_type(qctrl.type),
|
||||
qctrl.minimum, qctrl.maximum);
|
||||
@ -179,7 +179,7 @@ int enum_extended_controls(int fd, char *txt, int k)
|
||||
struct v4l2_queryctrl qctrl;
|
||||
int idx;
|
||||
|
||||
printf("##- extended controls enumeration '%s'\n", txt);
|
||||
printf("-- extended controls enumeration '%s'\n", txt);
|
||||
|
||||
memset(&qctrl, 0, sizeof(qctrl));
|
||||
qctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;
|
||||
@ -200,7 +200,7 @@ while (0 == ioctl (fd, VIDIOC_QUERYCTRL, &qctrl)) {
|
||||
return -1;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int show_webcam_infos(char *devname, char *title, int k, int type)
|
||||
int show_webcam_infos(char *devname, char *title, int k)
|
||||
{
|
||||
int vfd, foo;
|
||||
char ligne[100];
|
||||
@ -213,7 +213,7 @@ struct v4l2_format fmt;
|
||||
// struct v4l2_requestbuffers reqbuf;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( '%s' %d %d)\n", __func__, devname, k, type);
|
||||
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, devname, k);
|
||||
#endif
|
||||
|
||||
vfd = open_device(devname);
|
||||
@ -245,17 +245,13 @@ else {
|
||||
pr_v4l2_format("Experimental", &fmt);
|
||||
}
|
||||
|
||||
if (type) {
|
||||
|
||||
;
|
||||
|
||||
}
|
||||
else {
|
||||
foo = enum_image_formats(vfd, "Experimental", 0);
|
||||
|
||||
foo = enum_controls(vfd, "is that working ?", 0);
|
||||
|
||||
foo = enum_extended_controls(vfd, "looking for extended", 0);
|
||||
|
||||
enum_image_framesizes(vfd, "code pas fini", 0);
|
||||
}
|
||||
|
||||
close(vfd);
|
||||
|
||||
@ -271,15 +267,12 @@ return -1;
|
||||
static void help(int k)
|
||||
{
|
||||
puts("Options :");
|
||||
puts("\t-e N\t\texamine that, please");
|
||||
puts("\t-d\t\tselect the video device");
|
||||
puts("\t-K\t\tset the K parameter");
|
||||
puts("\t-l\t\tlist video devices");
|
||||
puts("\t-T bla\t\tadd a title");
|
||||
puts("\t-v\t\tincrease verbosity");
|
||||
|
||||
// if (verbosity)
|
||||
{ puts(""); fimg_print_version(1); }
|
||||
exit(0);
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
@ -300,15 +293,14 @@ puts("\n");
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int foo, opt;
|
||||
int etype = 0;
|
||||
|
||||
char *device = "/dev/video0";
|
||||
char *title = NULL;
|
||||
int K = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "d:e:hK:lT:v")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "d:hK:lT:v")) != -1) {
|
||||
switch(opt) {
|
||||
case 'd': device = optarg; break;
|
||||
case 'e': etype = atol(optarg); break;
|
||||
case 'h': help(0); break;
|
||||
case 'K': K = atol(optarg); break;
|
||||
case 'l': liste_des_devices(0); break;
|
||||
@ -321,7 +313,7 @@ if (NULL != title) {
|
||||
print_title(title);
|
||||
}
|
||||
|
||||
foo = show_webcam_infos(device, "", K, etype);
|
||||
foo = show_webcam_infos(device, "", K);
|
||||
fprintf(stderr, "\n\tshow_webcam_infos -> %d\n", foo);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user