#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 void on_send(char *buf, int *bytes) { audio_record(buf); int image_sz = X_RES*Y_RES*3; buf[REC_CAP+0] = (unsigned char)X_RES; buf[REC_CAP+1] = (unsigned char)Y_RES; *bytes = REC_CAP + 2 + image_sz; memcpy(&(buf[REC_CAP+2]), camera_get_image(), image_sz); } int main(void) { camera_init(CAM, X_RES, Y_RES); return talker("4950", "localhost", &on_send); }