static void trans_mjpeg2bgr(const unsigned char * src, unsigned char * dst, int width, int height, int srcsize) { unsigned char * bmp; unsigned char * jpegbuff; jpegbuff = malloc(srcsize + 0x1a4); int newsrcsize = mjpeg2jpeg(jpegbuff, src, srcsize); bmp = load_memory_jpg(jpegbuff, newsrcsize); memcpy(dst, bmp, width * height * 3); free(jpegbuff); free(bmp); }
void process_image(const void *p, int size) { byte *jpg = NULL; unsigned int jpgSize = 0; jpg = mjpeg2jpeg((const byte*)p, size, &jpgSize); if ( jpg == NULL ) errno_exit("mjpeg2jpeg"); fprintf(stderr, "process_image %d\n", jpgSize); output_data(jpg, jpgSize); free(jpg); }