aboutsummaryrefslogtreecommitdiff
path: root/src/talker.c
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2022-08-31 12:31:38 +0300
committerkartofen <mladenovnasko0@gmail.com>2022-08-31 12:31:38 +0300
commit675ded0d66b9fd60777d3037ded1446a3f9ef986 (patch)
tree6db3f0524437304f9e5a7b90175e3f6b043d4d49 /src/talker.c
Big Bang
Diffstat (limited to 'src/talker.c')
-rw-r--r--src/talker.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/talker.c b/src/talker.c
new file mode 100644
index 0000000..8b09274
--- /dev/null
+++ b/src/talker.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "socket.h"
+#include "camera.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
+
+ int cisz = camera_get_image_size();
+ buf[0] = (unsigned char)X_RES;
+ buf[1] = (unsigned char)Y_RES;
+
+ *bytes = cisz + 2;
+
+ memcpy(&(buf[2]), camera_get_image(), cisz);
+
+ printf("%d\n", *bytes);
+}
+
+int main(void)
+{
+ camera_init(CAM, X_RES, Y_RES);
+ return talker("4950", "localhost", &on_send);
+}