summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/v4l.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/v4l.cc b/src/v4l.cc
index 90cfb7c..6e71767 100644
--- a/src/v4l.cc
+++ b/src/v4l.cc
@@ -523,11 +523,15 @@ static void init_device(void)
printf("w: %d\n", fmt.fmt.pix.width);
printf("h: %d\n", fmt.fmt.pix.height);
- char *p = (char*)&fmt.fmt.pix.pixelformat;
- printf("f: %c\n", p[0]);
- printf("f: %c\n", p[1]);
- printf("f: %c\n", p[2]);
- printf("f: %c\n", p[3]);
+
+ char format[5];
+ memcpy(format, &fmt.fmt.pix.pixelformat, 4);
+ format[4] = '\0';
+ printf("format: %s\n", format);
+ if(strcmp(format, "JPEG")) {
+ printf("Webcam does not support JPEG...!\n");
+ exit(1);
+ }
/* Note VIDIOC_S_FMT may change width and height. */
} else {