aboutsummaryrefslogtreecommitdiff
path: root/src/listener.c
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2022-10-22 21:08:08 +0300
committerkartofen <mladenovnasko0@gmail.com>2022-10-22 21:08:08 +0300
commitf4c66a4c77e5818ca9703f59a80ea92e27ed45c6 (patch)
treee334b3f1c8bdb5c96bd756be4e451836a7762ab4 /src/listener.c
parent9d88d471ac059c93523c00b96ae1cbbc52e07b69 (diff)
abstract messages for easier use
Diffstat (limited to 'src/listener.c')
-rw-r--r--src/listener.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/listener.c b/src/listener.c
index b344b6e..f819383 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -10,7 +10,9 @@
#include "audio.h"
#include "typedef.h"
-char cam_data[BUF_CAP];
+char cam_data[BUF_CAP] = {0};
+unsigned int WIDTH = 1;
+unsigned int HEIGHT = 1;
void *display_thread(void *arg)
{
@@ -24,18 +26,17 @@ void *display_thread(void *arg)
exit(r);
}
-void on_recv(char *buf, int numbytes)
+void on_recv(message *m)
{
- (void)numbytes;
+ WIDTH = m->WIDTH;
+ HEIGHT = m->HEIGHT;
- memcpy(cam_data, &(buf[REC_CAP]), BUF_CAP-REC_CAP);
- audio_play(buf);
+ memcpy(cam_data, m->video, WIDTH * HEIGHT * 3);
+ audio_play(m->audio);
}
int main(void)
{
- memset(cam_data, 0, BUF_CAP);
-
pthread_t tid;
pthread_create(&tid, NULL, display_thread, NULL);