I playing with a ESP32-CAM. I have a image encoded as jpg in a struct as this
typedef struct {
uint8_t * buf; /*!< Pointer to the pixel data */
size_t len; /*!< Length of the buffer in bytes */
size_t width; /*!< Width of the buffer in pixels */
size_t height; /*!< Height of the buffer in pixels */
pixformat_t format; /*!< Format of the pixel data */
struct timeval timestamp; /*!< Timestamp since boot of the first DMA buffer of the frame */
} camera_fb_t;
It is apperant that the raw image data seem to be a uint8_t array.
I want to send this image data across a websocket connection. The send function for binary data has the following syntax
esp_websocket_client_send(client,(char *)fb->buf, 1000, portMAX_DELAY);
I get a compiler error if I change the pointer format from char to uint8_t. So I'm using the above syntax. Still it seems to work and the python websockets server receives data of some sort. In python the data looks like this when printed to the server terminal.
b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x0 etc.
I would like to know if I'm sending the binary jpg data in a suitable data format? I mean, it seems a bit strange to interpret the uint8 array as a char array. Should I perhaps encode it differently before sending it?