From 99eab6ee54f5986095dc446511ddac6f22026dc4 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Tue, 7 May 2024 14:22:50 +0200 Subject: [PATCH] Prepare for supporting multiple YUV formats. --- src/process_pipeline.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/process_pipeline.c b/src/process_pipeline.c index 21fdfb0..75e2813 100644 --- a/src/process_pipeline.c +++ b/src/process_pipeline.c @@ -759,11 +759,21 @@ 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; + 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); }