diff options
author | kartofen <mladenovnasko0@gmail.com> | 2022-10-22 21:08:08 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2022-10-22 21:08:08 +0300 |
commit | f4c66a4c77e5818ca9703f59a80ea92e27ed45c6 (patch) | |
tree | e334b3f1c8bdb5c96bd756be4e451836a7762ab4 /src/talker.c | |
parent | 9d88d471ac059c93523c00b96ae1cbbc52e07b69 (diff) |
abstract messages for easier use
Diffstat (limited to 'src/talker.c')
-rw-r--r-- | src/talker.c | 17 |
1 files changed, 7 insertions, 10 deletions
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); |