#include #include #include #include #include #include #include #include #include static uint8_t *images[2048] = { 0 }; static int image_count = 0; int store_image(const uint8_t *img, int w, int h) { if (image_count >= sizeof(images)/sizeof(images[0])) return -1; images[image_count] = malloc(w*h*4); memcpy(images[image_count], img, w*h*4); return image_count++; } int store_image_idx(const uint8_t *img, int w, int h, int idx) { if (idx >= sizeof(images)/sizeof(images[0])) return -1; if (images[idx]) free(images[idx]); images[idx] = malloc(w*h*4); memcpy(images[idx], img, w*h*4); return 0; } void reset_images() { for (int i=0; i 1400-fmtlen-1) { if (send(fd, out, p-out, 0) < 0) { fprintf(stderr, "Send error. %d %s\n", errno, strerror(errno)); return -5; } p = out; } } } free(out); return 0; } void discct(int fd) { close(fd); }