Prepare for supporting multiple YUV formats.
This commit is contained in:
@@ -759,11 +759,21 @@ save_grw(const uint8_t *image, char *fname)
|
|||||||
}
|
}
|
||||||
int width = state_proc.mode->width;
|
int width = state_proc.mode->width;
|
||||||
int height = state_proc.mode->height;
|
int height = state_proc.mode->height;
|
||||||
int size = width*height*2;
|
int size = width * height * 2;
|
||||||
|
char *format;
|
||||||
|
switch (state_proc.mode->v4l_pixfmt) {
|
||||||
|
case V4L2_PIX_FMT_YUYV:
|
||||||
|
format = "YUY2";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("Please fill appropriate translation for YUV.\n");
|
||||||
|
}
|
||||||
fwrite(image, size, 1, outfile);
|
fwrite(image, size, 1, outfile);
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
int header = sprintf(buf+1, "Caps: video/x-raw,format=YUY2,width=%d,height=%d\nSize: %d\nGRW", width, height, size);
|
int header = sprintf(buf+1,
|
||||||
|
"Caps: video/x-raw,format=%s,width=%d,height=%d\nSize: %d\nGRW",
|
||||||
|
format, width, height, size);
|
||||||
fwrite(buf, header+1, 1, outfile);
|
fwrite(buf, header+1, 1, outfile);
|
||||||
fclose(outfile);
|
fclose(outfile);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user