From b1b7c92aa96af5502f276819b628b05d54f4655c Mon Sep 17 00:00:00 2001 From: kartofen Date: Sun, 16 Oct 2022 22:55:45 +0300 Subject: nearly works --- src/talker.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/talker.c') diff --git a/src/talker.c b/src/talker.c index 8b09274..027d0e6 100644 --- a/src/talker.c +++ b/src/talker.c @@ -1,29 +1,31 @@ #include +#include #include #include #include #include "socket.h" #include "camera.h" +#include "audio.h" #include "typedef.h" #define CAM "/dev/video0" #define X_RES 160 #define Y_RES 120 + void on_send(char *buf, int *bytes) { - // write here audio + audio_record(buf); - int cisz = camera_get_image_size(); - buf[0] = (unsigned char)X_RES; - buf[1] = (unsigned char)Y_RES; + int image_sz = X_RES*Y_RES*3; + buf[REC_CAP+0] = (unsigned char)X_RES; + buf[REC_CAP+1] = (unsigned char)Y_RES; - *bytes = cisz + 2; + *bytes = REC_CAP + 2 + image_sz; - memcpy(&(buf[2]), camera_get_image(), cisz); + memcpy(&(buf[REC_CAP+2]), camera_get_image(), image_sz); - printf("%d\n", *bytes); } int main(void) -- cgit v1.2.3