Prepare for supporting multiple YUV formats.

This commit is contained in:
Pavel Machek
2024-05-07 14:22:50 +02:00
parent bc9085ffad
commit 99eab6ee54

View File

@@ -760,10 +760,20 @@ save_grw(const uint8_t *image, char *fname)
int width = state_proc.mode->width;
int height = state_proc.mode->height;
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);
char buf[1024];
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);
fclose(outfile);
}