Compare commits

..

No commits in common. "9e60436a359239c2c94801315a7b89b313dfd3da" and "c74695d07e8f9c49f4882877f4e2a227e8f789e6" have entirely different histories.

3 changed files with 13 additions and 88 deletions

View File

@ -73,46 +73,6 @@ fprintf(FP, " device caps 0x%X\n", ptr->device_caps);
return -1; return -1;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/*
* warning, this function return a pointer to a static
* strint, so it was NOT reentrant !
*/
char *str_fourcc(uint32_t fcc)
{
static char chaine[10];
chaine[0] = '['; chaine[5] = ']'; chaine[6] = '\0';
chaine[1] = (fcc>>0) & 0xff;
chaine[2] = (fcc>>8) & 0xff;
chaine[3] = (fcc>>16) & 0xff;
chaine[4] = (fcc>>24) & 0xff;
return chaine;
}
/* --------------------------------------------------------------------- */
char *str_buf_type(int type)
{
switch (type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE: return "vidcapt";
case V4L2_BUF_TYPE_VIDEO_OUTPUT: return "vidout";
case V4L2_BUF_TYPE_VIDEO_OVERLAY: return "vidovrl";
case V4L2_BUF_TYPE_VBI_CAPTURE: return "vbicapt";
case V4L2_BUF_TYPE_VBI_OUTPUT: return "vbicapt";
case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: return "slicevcapt";
case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: return "slicevout";
case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: return "v-outover";
case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: return "v-captmpla";
case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: return "v-outmpla";
case V4L2_BUF_TYPE_SDR_CAPTURE: return "sdrcapt";
case V4L2_BUF_TYPE_SDR_OUTPUT: return "sdrout";
/* Deprecated, do not use */
case V4L2_BUF_TYPE_PRIVATE: return "private";
}
return "???";
}
/* --------------------------------------------------------------------- */
int pr_v4l2_fmtdesc(char *txt, struct v4l2_fmtdesc *ptr) 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);
@ -138,33 +98,12 @@ return "???";
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
static void pr_input_status(uint32_t st) static void pr_input_status(uint32_t st)
{ {
if (st & V4L2_IN_ST_NO_POWER) fputs("nopow ", FP); if (st & V4L2_IN_ST_NO_POWER) fputs("nopower", FP);
if (st & V4L2_IN_ST_NO_SIGNAL) fputs("nosig ", FP); if (st & V4L2_IN_ST_NO_SIGNAL) fputs("nosignal", FP);
if (st & V4L2_IN_ST_NO_COLOR) fputs("nocol ", FP); if (st & V4L2_IN_ST_NO_COLOR) fputs("nocolor", FP);
if (st & V4L2_IN_ST_HFLIP) fputs("hflip ", FP); /* to be continued */
if (st & V4L2_IN_ST_VFLIP) fputs("vflip ", FP);
if (st & V4L2_IN_ST_NO_H_LOCK) fputs("nohlck ", FP);
if (st & V4L2_IN_ST_COLOR_KILL) fputs("colkil ", FP);
if (st & V4L2_IN_ST_NO_V_LOCK) fputs("novlck ", FP);
if (st & V4L2_IN_ST_NO_STD_LOCK) fputs("nostdlk ", FP);
if (st & V4L2_IN_ST_NO_EQU) fputs("noequ ", FP);
if (st & V4L2_IN_ST_NO_CARRIER) fputs("nocarr ", FP);
if (st & V4L2_IN_ST_MACROVISION) fputs("macrov ", FP);
if (st & V4L2_IN_ST_NO_ACCESS) fputs("noacces ", FP);
if (st & V4L2_IN_ST_VTR) fputs("VTR ", FP);
/* to be continued ?*/
}
/* --------------------------------------------------------------------- */
static void pr_input_capabilities(uint32_t st)
{
if (st & V4L2_IN_CAP_DV_TIMINGS) fputs("DVtime ", FP);
if (st & V4L2_IN_CAP_STD) fputs("s_std ", FP);
if (st & V4L2_IN_CAP_NATIVE_SIZE) fputs("nativsz ", FP);
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -179,18 +118,9 @@ fprintf(FP, " type %d %s\n", ptr->type,
fprintf(FP, " audioset 0x%X\n", ptr->audioset); fprintf(FP, " audioset 0x%X\n", ptr->audioset);
fprintf(FP, " tuner 0x%X\n", ptr->tuner); fprintf(FP, " tuner 0x%X\n", ptr->tuner);
/* XXX v4l2_std_id std; */ /* XXX v4l2_std_id std; */
fprintf(FP, " status 0x%X\n", ptr->status); fprintf(FP, " status %d\n", ptr->status);
if (ptr->status) {
fputs(" ",FP);
pr_input_status(ptr->status); pr_input_status(ptr->status);
fputs("\n",FP);
}
fprintf(FP, " capabilities 0x%X\n", ptr->capabilities); fprintf(FP, " capabilities 0x%X\n", ptr->capabilities);
if (ptr->capabilities) {
fputs(" ",FP);
pr_input_capabilities(ptr->capabilities);
fputs("\n",FP);
}
return -1; return -1;
} }
@ -255,7 +185,7 @@ return "???";
void pr_ctrl_id(uint32_t id) void pr_ctrl_id(uint32_t id)
{ {
if (verbosity>1) fprintf(FP, "%08x : ", id); if (verbosity) fprintf(FP, "%08x : ", id);
fprintf(FP, "%x %03x %04x", (id>>28)&0xf, fprintf(FP, "%x %03x %04x", (id>>28)&0xf,
V4L2_CTRL_ID2CLASS(id)>>16, id&0xffff); V4L2_CTRL_ID2CLASS(id)>>16, id&0xffff);

View File

@ -13,9 +13,6 @@ int pr_v4l2_fmtdesc(char *txt, struct v4l2_fmtdesc *ptr);
char *str_input_type(int t); char *str_input_type(int t);
char *str_ctrl_type(int type); char *str_ctrl_type(int type);
char *str_buf_type(int type);
char *str_fourcc(uint32_t fcc); /* NOT REENTRANT */
void pr_ctrl_id(uint32_t id); void pr_ctrl_id(uint32_t id);
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */

View File

@ -44,11 +44,7 @@ for (;;) {
break; break;
} }
} }
pr_v4l2_fmtdesc(__func__, &fmtd);
// pr_v4l2_fmtdesc(__func__, &fmtd);
printf(" %2d %-10s 0x%02x %s %-32s \n",
fmtd.index, str_buf_type(fmtd.type), fmtd.flags,
str_fourcc(fmtd.pixelformat), fmtd.description);
idx++; idx++;
} }
@ -101,7 +97,7 @@ for (idx=V4L2_CID_BASE; idx<V4L2_CID_LASTP1; idx++) {
qctrl.id = idx; qctrl.id = idx;
// if (verbosity>1) printf(" id %d ", idx); if (verbosity) printf(" id %d ", idx);
if (0 == ioctl (fd, VIDIOC_QUERYCTRL, &qctrl)) { if (0 == ioctl (fd, VIDIOC_QUERYCTRL, &qctrl)) {
if (qctrl.flags & V4L2_CTRL_FLAG_DISABLED) { if (qctrl.flags & V4L2_CTRL_FLAG_DISABLED) {
@ -116,7 +112,7 @@ for (idx=V4L2_CID_BASE; idx<V4L2_CID_LASTP1; idx++) {
} }
else if (EINVAL==errno) { else if (EINVAL==errno) {
if (verbosity) fprintf(stderr, "id %d einval\n", idx); if (verbosity) puts("einval");
continue; continue;
} }
else { else {
@ -146,7 +142,7 @@ qctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;
idx = 0; idx = 0;
while (0 == ioctl (fd, VIDIOC_QUERYCTRL, &qctrl)) { while (0 == ioctl (fd, VIDIOC_QUERYCTRL, &qctrl)) {
if (verbosity) pr_ctrl_id(qctrl.id); pr_ctrl_id(qctrl.id);
printf(" %-32s %-10s [%d..%d]\n", printf(" %-32s %-10s [%d..%d]\n",
qctrl.name, qctrl.name,
str_ctrl_type(qctrl.type), str_ctrl_type(qctrl.type),
@ -201,8 +197,10 @@ foo = enum_inputs(vfd, "on peut voir quoi ?", 0);
foo = enum_image_formats(vfd, "Experimental", 0); foo = enum_image_formats(vfd, "Experimental", 0);
fputs("--\n", stderr);
foo = enum_controls(vfd, "is that working ?", 0); foo = enum_controls(vfd, "is that working ?", 0);
fputs("--\n", stderr);
foo = enum_extended_controls(vfd, "looking for extended", 0); foo = enum_extended_controls(vfd, "looking for extended", 0);