diff options
Diffstat (limited to 'src/talker.c')
-rw-r--r-- | src/talker.c | 16 |
1 files changed, 9 insertions, 7 deletions
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 <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #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) |