31 #define JPEG_SOI_BYTE 0xD8 32 #define JPEG_SOI ((0xFF<<8)|JPEG_SOI_BYTE) 33 #define JPEG_EOI 0xFFD9 40 static unsigned jpgFileNumber = 0;
42 sprintf(outputFileName,
"embedded%d.jpg", ++jpgFileNumber);
43 FILE* outputFid = fopen(outputFileName,
"wb");
44 if (outputFid == NULL) {
45 fprintf(stderr,
"Failed to open output JPG file \"%s\"\n", outputFileName);
47 fprintf(stderr,
"\tOutputting embedded JPEG image to the file \"%s\"\n", outputFileName);
60 if (ptr == limit)
return 1;
65 while (ptr < limit && *ptr++ != 0xFF) {}
71 FILE* outputFid = NULL;
74 if (outputFid == NULL)
return 0;
87 if (ptr == limit)
return 1;
92 if (outputFid == NULL)
return 0;
101 u_int8_t firstByte = next2Bytes >> 8;
102 fputc(firstByte, outputFid);
static char outputJPGFilenamePrefix[]
static FILE * openOutputJPGFile()
int parseRecord_JPEG(u_int8_t const *&ptr, u_int8_t const *limit)
u_int16_t get2BytesBE(u_int8_t const *&ptr, u_int8_t const *limit)