aboutsummaryrefslogtreecommitdiff
path: root/src/talker.c
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2022-10-16 22:55:45 +0300
committerkartofen <mladenovnasko0@gmail.com>2022-10-16 22:55:45 +0300
commitb1b7c92aa96af5502f276819b628b05d54f4655c (patch)
tree6a04459dc7128fd4259356a88785defeab678b30 /src/talker.c
parent675ded0d66b9fd60777d3037ded1446a3f9ef986 (diff)
nearly works
Diffstat (limited to 'src/talker.c')
-rw-r--r--src/talker.c16
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)