diff --git a/v4l2/v4l2_pr_structs.c b/v4l2/v4l2_pr_structs.c index d5877987..4803ad27 100644 --- a/v4l2/v4l2_pr_structs.c +++ b/v4l2/v4l2_pr_structs.c @@ -73,6 +73,46 @@ fprintf(FP, " device caps 0x%X\n", ptr->device_caps); 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) { fprintf(FP, "-- v4l2_fmtdesc, %-15s %p\n", txt, ptr); @@ -98,12 +138,33 @@ return "???"; /* --------------------------------------------------------------------- */ static void pr_input_status(uint32_t st) { -if (st & V4L2_IN_ST_NO_POWER) fputs("nopower", FP); -if (st & V4L2_IN_ST_NO_SIGNAL) fputs("nosignal", FP); -if (st & V4L2_IN_ST_NO_COLOR) fputs("nocolor", FP); +if (st & V4L2_IN_ST_NO_POWER) fputs("nopow ", FP); +if (st & V4L2_IN_ST_NO_SIGNAL) fputs("nosig ", 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, " tuner 0x%X\n", ptr->tuner); /* XXX v4l2_std_id std; */ -fprintf(FP, " status %d\n", ptr->status); -pr_input_status(ptr->status); +fprintf(FP, " status 0x%X\n", ptr->status); +if (ptr->status) { + fputs(" ",FP); + pr_input_status(ptr->status); + fputs("\n",FP); + } fprintf(FP, " capabilities 0x%X\n", ptr->capabilities); +if (ptr->capabilities) { + fputs(" ",FP); + pr_input_capabilities(ptr->capabilities); + fputs("\n",FP); + } return -1; } diff --git a/v4l2/v4l2_pr_structs.h b/v4l2/v4l2_pr_structs.h index 7641387d..320ec257 100644 --- a/v4l2/v4l2_pr_structs.h +++ b/v4l2/v4l2_pr_structs.h @@ -13,6 +13,9 @@ int pr_v4l2_fmtdesc(char *txt, struct v4l2_fmtdesc *ptr); char *str_input_type(int t); 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); /* --------------------------------------------------------------------- */