forked from tTh/FloatImg
80 lines
2.0 KiB
C
80 lines
2.0 KiB
C
/*
|
|
* fonctions pour afficher les structures de V4L2
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <linux/videodev2.h>
|
|
|
|
#include "v4l2_pr_structs.h"
|
|
|
|
#define FP (stdout)
|
|
|
|
extern int verbosity;
|
|
|
|
/* --------------------------------------------------------------------- */
|
|
static char *fmttype2str(int type)
|
|
{
|
|
|
|
switch(type) {
|
|
case 0: return "[zero]";
|
|
case 1: return "video capture";
|
|
case 2: return "video output";
|
|
|
|
case 13: return "META capture";
|
|
}
|
|
|
|
return "???";
|
|
}
|
|
/* --------------------------------------------------------------------- */
|
|
int pr_v4l2_capability(char *txt, struct v4l2_capability *ptr)
|
|
{
|
|
fprintf(FP, "-- v4l2_capability, %-15s %p\n", txt, ptr);
|
|
|
|
fprintf(FP, " driver %s\n", ptr->driver);
|
|
fprintf(FP, " card %s\n", ptr->card);
|
|
fprintf(FP, " bus info %s\n", ptr->bus_info);
|
|
|
|
fprintf(FP, " version %X\n", ptr->version);
|
|
fprintf(FP, " capabilities %X\n", ptr->capabilities);
|
|
fprintf(FP, " device caps %X\n", ptr->device_caps);
|
|
|
|
return -1;
|
|
}
|
|
/* --------------------------------------------------------------------- */
|
|
int pr_v4l2_format(char *txt, struct v4l2_format *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));
|
|
|
|
switch(ptr->type) {
|
|
|
|
case 1: // fputs(" Capture\n", FP);
|
|
fprintf(FP, " dims %dx%d\n",
|
|
ptr->fmt.pix.width,
|
|
ptr->fmt.pix.height);
|
|
break;
|
|
|
|
default: fprintf(FP, "type is %d\n", ptr->type);
|
|
break;
|
|
|
|
}
|
|
|
|
fputs(".\n", FP);
|
|
return 0;
|
|
}
|
|
/* --------------------------------------------------------------------- */
|
|
int pr_v4l2_requestbuffers(char *txt, struct v4l2_requestbuffers *ptr)
|
|
{
|
|
fprintf(FP, "-- v4l2_requestbuffers, %s %p\n", txt, ptr);
|
|
fprintf(FP, " type %d\n", ptr->type); /* enum v4l2_buf_type */
|
|
|
|
|
|
return 0;
|
|
}
|
|
/* --------------------------------------------------------------------- */
|
|
/* --------------------------------------------------------------------- */
|
|
/* --------------------------------------------------------------------- */
|
|
|