#include #include #include #include #include #include #include "socket.h" #include "display.h" #include "audio.h" #include "typedef.h" char cam_data[BUF_CAP]; void *display_thread(void *arg) { (void)arg; int r = display(); if(r == 0) info("display: closed\n"); else err("display: failed\n"); exit(r); // pthread_exit(0); } void on_recv(char *buf, int numbytes) { (void)numbytes; memcpy(cam_data, &(buf[REC_CAP]), BUF_CAP-REC_CAP); audio_play(buf); } int main(void) { memset(cam_data, 0, BUF_CAP); pthread_t tid; pthread_create(&tid, NULL, display_thread, NULL); if(listener("4950", &on_recv) != 0) { err("listener: failed"); return 1; } return 0; }