Compare commits

...

2 Commits

Author SHA1 Message Date
tth
3e0a2eb9d9 more confusion in display 2019-08-02 02:12:54 +02:00
tth
d571d05431 clean memory before use 2019-08-02 01:50:12 +02:00
3 changed files with 30 additions and 2 deletions

View File

@ -74,6 +74,7 @@ if (NULL==fp) {
return -1; return -1;
} }
memset(&filehead, 0, sizeof(filehead));
strcpy(filehead.magic, "FIMG"); strcpy(filehead.magic, "FIMG");
filehead.w = fimg->width; filehead.h = fimg->height; filehead.w = fimg->width; filehead.h = fimg->height;
filehead.t = fimg->type; filehead.t = fimg->type;
@ -138,6 +139,6 @@ if (foo) {
foo = fread(head->R, sizeof(float), filehead.w*filehead.h*3, fp); foo = fread(head->R, sizeof(float), filehead.w*filehead.h*3, fp);
fclose(fp); fclose(fp);
return 0; return 0;
} }

View File

@ -195,6 +195,27 @@ if (ptr->capabilities) {
return -1; return -1;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
char * str_colorspace(int colspace)
{
switch(colspace) {
case V4L2_COLORSPACE_DEFAULT: return "default";
case V4L2_COLORSPACE_SMPTE170M: return "smpte170m";
case V4L2_COLORSPACE_SMPTE240M: return "smpte240m";
case V4L2_COLORSPACE_REC709: return "rec709";
case V4L2_COLORSPACE_BT878: return "bt878";
case V4L2_COLORSPACE_470_SYSTEM_M: return "470-sys-M";
case V4L2_COLORSPACE_470_SYSTEM_BG: return "470-sys-BG";
case V4L2_COLORSPACE_JPEG: return "jpeg";
case V4L2_COLORSPACE_SRGB: return "srgb";
case V4L2_COLORSPACE_ADOBERGB: return "adobergb";
case V4L2_COLORSPACE_BT2020: return "bt2020";
case V4L2_COLORSPACE_RAW: return "raw";
case V4L2_COLORSPACE_DCI_P3: return "dci-p3";
}
return "???";
}
/* --------------------------------------------------------------------- */
int pr_v4l2_format(char *txt, struct v4l2_format *ptr) 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);
@ -213,7 +234,11 @@ switch(ptr->type) {
ptr->fmt.pix.field); /* enum v4l2_field */ ptr->fmt.pix.field); /* enum v4l2_field */
fprintf(FP, " padding %d\n", fprintf(FP, " padding %d\n",
ptr->fmt.pix.bytesperline); ptr->fmt.pix.bytesperline);
fprintf(FP, " sizeimage %d\n",
ptr->fmt.pix.sizeimage);
fprintf(FP, " colorspace %d %s\n",
ptr->fmt.pix.colorspace,
str_colorspace(ptr->fmt.pix.colorspace));
break; break;
default: fprintf(FP, "XXX type %d unknow\n", ptr->type); default: fprintf(FP, "XXX type %d unknow\n", ptr->type);

View File

@ -123,7 +123,9 @@ for (idx=V4L2_CID_BASE; idx<V4L2_CID_LASTP1; idx++) {
} }
else if (EINVAL==errno) { else if (EINVAL==errno) {
#if DEBUG_LEVEL
if (verbosity) fprintf(stderr, "id %d einval\n", idx); if (verbosity) fprintf(stderr, "id %d einval\n", idx);
#endif
continue; continue;
} }
else { else {