#include #include #include #include #include #include "socket.h" #include "camera.h" #include "audio.h" #include "typedef.h" #define CAM "/dev/video0" #define X_RES 160 #define Y_RES 120 camera_handle cam_handle; audio_handle aud_handle; void on_send(message *m) { audio_record(&aud_handle, m->audio); m->WIDTH = X_RES; m->HEIGHT = Y_RES; memcpy(m->video, camera_get_image(&cam_handle), X_RES * Y_RES * 3); } int main(void) { camera_params params = {0}; params.device = CAM; params.x_res = X_RES; params.y_res = Y_RES; camera_init(&cam_handle, params); if(audio_create(&aud_handle, RECORD) != 0) { err("audio_create: failed\n"); return 1; } info("created audio\n"); if(talker("4950", "localhost", &on_send) != 0) { err("talker: failed\n"); return 1; } audio_destroy(&aud_handle); camera_deinit(&cam_handle); return 0; }