aboutsummaryrefslogtreecommitdiff
path: root/src/listener.c
blob: 135405c340b91523e65fda1a86ed38e040c505e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <pthread.h>

#include "socket.h"
#include "display.h"
#include "audio.h"
#include "typedef.h"

char *cam_data;

void *display_thread(void *arg)
{
    (void)arg;

    int c = 1;
    char *name = "./display";
    display(&c, &name);
    pthread_exit(0);
}

void on_recv(char *buf, int numbytes)
{
    cam_data = &(buf[REC_CAP]);
    usleep(100000);
    // audio_play(buf);
}

int main(void)
{
    // char empty[1024] = {0};
    // cam_data = empty;

    pthread_t tid;
    pthread_create(&tid, NULL, display_thread, NULL);

    return listener("4950", &on_recv);
}