Compare commits
2 Commits
c74695d07e
...
9e60436a35
Author | SHA1 | Date | |
---|---|---|---|
9e60436a35 | |||
535c98df32 |
@ -73,6 +73,46 @@ 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);
|
||||||
@ -98,12 +138,33 @@ 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("nopower", FP);
|
if (st & V4L2_IN_ST_NO_POWER) fputs("nopow ", FP);
|
||||||
if (st & V4L2_IN_ST_NO_SIGNAL) fputs("nosignal", FP);
|
if (st & V4L2_IN_ST_NO_SIGNAL) fputs("nosig ", FP);
|
||||||
if (st & V4L2_IN_ST_NO_COLOR) fputs("nocolor", FP);
|
if (st & V4L2_IN_ST_NO_COLOR) fputs("nocol ", FP);
|
||||||
|
|
||||||
/* to be continued */
|
if (st & V4L2_IN_ST_HFLIP) fputs("hflip ", FP);
|
||||||
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
@ -118,9 +179,18 @@ 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 %d\n", ptr->status);
|
fprintf(FP, " status 0x%X\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;
|
||||||
}
|
}
|
||||||
@ -185,7 +255,7 @@ return "???";
|
|||||||
void pr_ctrl_id(uint32_t id)
|
void pr_ctrl_id(uint32_t id)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (verbosity) fprintf(FP, "%08x : ", id);
|
if (verbosity>1) 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);
|
||||||
|
@ -13,6 +13,9 @@ 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);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
@ -44,7 +44,11 @@ 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++;
|
||||||
}
|
}
|
||||||
@ -97,7 +101,7 @@ for (idx=V4L2_CID_BASE; idx<V4L2_CID_LASTP1; idx++) {
|
|||||||
|
|
||||||
qctrl.id = idx;
|
qctrl.id = idx;
|
||||||
|
|
||||||
if (verbosity) printf(" id %d ", idx);
|
// if (verbosity>1) 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) {
|
||||||
@ -112,7 +116,7 @@ for (idx=V4L2_CID_BASE; idx<V4L2_CID_LASTP1; idx++) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (EINVAL==errno) {
|
else if (EINVAL==errno) {
|
||||||
if (verbosity) puts("einval");
|
if (verbosity) fprintf(stderr, "id %d einval\n", idx);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -142,7 +146,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)) {
|
||||||
|
|
||||||
pr_ctrl_id(qctrl.id);
|
if (verbosity) 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),
|
||||||
@ -197,10 +201,8 @@ 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);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user