From f4c66a4c77e5818ca9703f59a80ea92e27ed45c6 Mon Sep 17 00:00:00 2001 From: kartofen Date: Sat, 22 Oct 2022 21:08:08 +0300 Subject: abstract messages for easier use --- src/talker.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/talker.c') diff --git a/src/talker.c b/src/talker.c index bfea616..e7271ad 100644 --- a/src/talker.c +++ b/src/talker.c @@ -15,25 +15,22 @@ camera_handle cam_handle; -void on_send(char *buf, int *bytes) +void on_send(message *m) { - audio_record(buf); + audio_record(m->audio); - int image_sz = X_RES*Y_RES*3; - buf[REC_CAP+0] = (unsigned char)X_RES; - buf[REC_CAP+1] = (unsigned char)Y_RES; + m->WIDTH = X_RES; + m->HEIGHT = Y_RES; - *bytes = REC_CAP + 2 + image_sz; - - memcpy(&(buf[REC_CAP+2]), camera_get_image(&cam_handle), image_sz); + memcpy(m->video, camera_get_image(&cam_handle), X_RES * Y_RES * 3); } int main(void) { camera_params params = {0}; params.device = CAM; - params.x_res = 160; - params.y_res = 120; + params.x_res = X_RES; + params.y_res = Y_RES; camera_init(&cam_handle, params); -- cgit v1.2.3