#include #include #include #include #include #include #include "socket.h" #include "display.h" #include "audio.h" #include "typedef.h" char cam_data[BUF_CAP] = {0}; unsigned int WIDTH = 1; unsigned int HEIGHT = 1; audio_handle aud_handle; void *display_thread(void *arg) { (void)arg; int r = display(); if(r == 0) info("display: closed\n"); else err("display: failed\n"); exit(r); } void on_recv(message *m) { WIDTH = m->WIDTH; HEIGHT = m->HEIGHT; memcpy(cam_data, m->video, WIDTH * HEIGHT * 3); audio_play(&aud_handle, m->audio); } int main(void) { pthread_t tid; pthread_create(&tid, NULL, display_thread, NULL); if(audio_create(&aud_handle, PLAYBACK) != 0) { err("audio_create: failed\n"); return 1; } if(listener("4950", &on_recv) != 0) { err("listener: failed"); return 1; } return 0; }