00001 #include <stdarg.h> 00002 #include <stdio.h> 00003 00004 #include "FCam/Base.h" 00005 00006 namespace FCam { 00007 int bytesPerPixel(ImageFormat f) { 00008 switch (f) { 00009 case RGB24: case YUV24: 00010 return 3; 00011 case RGB16: case UYVY: case RAW: 00012 return 2; 00013 default: 00014 return 0; 00015 } 00016 } 00017 00018 void panic(const char *fileName, int line, const char *fmt, ...) { 00019 char buf[256]; 00020 va_list arglist; 00021 va_start(arglist, fmt); 00022 vsnprintf(buf, 256, fmt, arglist); 00023 va_end(arglist); 00024 fprintf(stderr, " (Panic!) %s: %d: %s\n", fileName, line, buf); 00025 exit(1); 00026 } 00027 00028 }